Initial commit

This commit is contained in:
Felix Förtsch
2020-10-20 14:39:50 +02:00
commit 648ded8896
1225 changed files with 216511 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
tests/**
assets/**
bin/**
inc/**
vendor/**

View File

@@ -0,0 +1,11 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4

View File

@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

View File

@@ -0,0 +1,4 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @Remzi1993 will be requested for review when someone opens a pull request.
* @Remzi1993

View File

@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -0,0 +1,26 @@
# Set to true to add reviewers to pull requests
addReviewers: true
# Set to true to add assignees to pull requests
addAssignees: true
# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
- Remzi1993
# A number of reviewers added to the pull request
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 0
# A list of assignees, overrides reviewers if set
# assignees:
# - assigneeA
# A number of assignees to add to the pull request
# Set to 0 to add all of the assignees.
# Uses numberOfReviewers if unset.
# numberOfAssignees: 2
# A list of keywords to be skipped the process that add reviewers if pull requests include it
# skipKeywords:
# - wip

View File

@@ -0,0 +1,4 @@
exclude:
- master
- develop
- development

View File

@@ -0,0 +1,4 @@
# You can change the labels to suit your needs if "first-timers-only" is not what you are looking for.
# These are some examples.
labels:
- First timers

View File

@@ -0,0 +1,13 @@
# Configuration for probot-no-response - https://github.com/probot/no-response
# Number of days of inactivity before an Issue is closed for lack of response
daysUntilClose: 14
# Label requiring a response
responseRequiredLabel: Needs more info
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
closeComment: >
This issue has been automatically closed because there has been no response
to our request for more information from the original author. With only the
information that is currently in the issue, we don't have enough information
to take action. Please reach out if you have or find the answers we need so
that we can investigate further.

View File

@@ -0,0 +1,30 @@
name-template: 'jQuery Manager v$NEXT_PATCH_VERSION'
tag-template: '$NEXT_PATCH_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'Feature'
- title: '🐛 Bug fixes'
labels:
- 'Fix'
- 'Bug'
- title: '🔒 Security updates'
labels:
- 'Security'
- title: '🧰 Maintenance'
labels:
- 'Library'
- 'Code Climate'
- 'Docs'
- 'dependencies'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
template: |
# What's changed (changelog)
$CHANGES
## 👍 Thanks to
$CONTRIBUTORS
## [Download latest version](https://downloads.wordpress.org/plugin/jquery-manager.zip) from [wordpress.org](https://wordpress.org/plugins/jquery-manager/)

View File

@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 40
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- Pinned
- Security
# Label to use when marking an issue as stale
staleLabel: Won't fix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

View File

@@ -0,0 +1,120 @@
# Created by https://www.gitignore.io/api/macos,windows,composer,wordpress
# Edit at https://www.gitignore.io/?templates=macos,windows,composer,wordpress
### Composer ###
composer.phar
/vendor/*
!vendor/collizo4sky/
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
### WordPress ###
*.log
wp-config.php
wp-content/advanced-cache.php
wp-content/backup-db/
wp-content/backups/
wp-content/blogs.dir/
wp-content/cache/
wp-content/upgrade/
wp-content/uploads/
wp-content/mu-plugins/
wp-content/wp-cache-config.php
wp-content/plugins/hello.php
/.htaccess
/license.txt
/readme.html
/sitemap.xml
/sitemap.xml.gz
# End of https://www.gitignore.io/api/macos,windows,composer,wordpress
# WP-CLI
config.yml
PHAR_BUILD_VERSION
/cache
/packages
/*.phar
/codesniffer
/PHP_Codesniffer-VariableAnalysis
.*.swp
*.log
# PHPUnit
/.ant_targets
/.idea
/.php_cs
/.php_cs.cache
/build/documentation
/build/logfiles
/build/phar
/build/phar-scoped
/build/phpdox
/build/*.phar
/build/*.phar.asc
/build/binary-phar-autoload.php
/cache.properties
/tests/end-to-end/*.diff
/tests/end-to-end/*.exp
/tests/end-to-end/*.log
/tests/end-to-end/*.out
/tests/end-to-end/*.php
.phpunit.result.cache

View File

@@ -0,0 +1,49 @@
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards based custom ruleset for your plugin">
<description>Generally-applicable sniffs for WordPress plugins.</description>
<!-- What to scan -->
<file>.</file>
<exclude-pattern>/vendor/</exclude-pattern>
<exclude-pattern>/node_modules/</exclude-pattern>
<!-- How to scan -->
<!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
<!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
<arg value="sp"/> <!-- Show sniff and progress -->
<arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit -->
<arg name="colors"/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="8"/><!-- Enables parallel processing when available for faster results. -->
<!-- Rules: Check PHP version compatibility -->
<!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
<config name="testVersion" value="5.3-"/>
<!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
<rule ref="PHPCompatibilityWP"/>
<!-- Rules: WordPress Coding Standards -->
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
<config name="minimum_supported_wp_version" value="4.9"/>
<rule ref="WordPress">
<exclude name="WordPress.VIP"/>
</rule>
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<!-- Value: replace the function, class, and variable prefixes used. Separate multiple prefixes with a comma. -->
<property name="prefixes" type="array" value="my-plugin"/>
</properties>
</rule>
<rule ref="WordPress.WP.I18n">
<properties>
<!-- Value: replace the text domain used. -->
<property name="text_domain" type="array" value="my-plugin"/>
</properties>
</rule>
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
<properties>
<property name="blank_line_check" value="true"/>
</properties>
</rule>
</ruleset>

View File

@@ -0,0 +1,66 @@
sudo: false
dist: trusty
language: php
notifications:
email:
on_success: never
on_failure: change
branches:
only:
- master
cache:
directories:
- $HOME/.composer/cache
matrix:
include:
- php: 7.4
env: WP_VERSION=trunk
- php: 7.4
env: WP_VERSION=latest
- php: 7.3
env: WP_VERSION=latest
- php: 7.2
env: WP_VERSION=latest
- php: 7.1
env: WP_VERSION=latest
- php: 7.0
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=4.9
- php: 5.6
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=trunk
before_script:
- "curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | sudo bash"
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- |
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
phpenv config-rm xdebug.ini
else
echo "xdebug.ini does not exist"
fi
- |
if [[ ! -z "$WP_VERSION" ]]; then
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
composer global require "phpunit/phpunit=4.8.*|5.7.*"
fi
script:
- fossa init
- fossa analyze
- |
if [[ ! -z "$WP_VERSION" ]] ; then
phpunit
WP_MULTISITE=1 phpunit
fi
- |
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
phpcs
fi

View File

@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at ict@remzi.info. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@@ -0,0 +1,102 @@
**Working on your first Pull Request?** You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
Some reading about the [fork and pull model](https://en.wikipedia.org/wiki/Fork_and_pull_model)
- https://opensource.guide/how-to-contribute/#opening-a-pull-request
- https://guides.github.com/introduction/flow/
- https://hisham.hm/2016/01/01/how-to-make-a-pull-request-on-github-a-quick-tutorial/
- https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow
- https://nvie.com/posts/a-successful-git-branching-model/
- https://help.github.com/en/articles/syncing-a-fork
# Contributing
When contributing to this repository, please first discuss the change you wish to make via issue,
email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct, please follow it in all your interactions with the project.
## Pull Request Process
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
build.
2. Update the README.md with details of changes to the interface, this includes new environment
variables, exposed ports, useful file locations and container parameters.
3. Increase the version numbers in any examples files and the README.md to the new version that this
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
do not have permission to do that, you may request the second reviewer to merge it for you.
## Code of Conduct
### Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
### Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
### Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
### Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
### Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at ict@remzi.info. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
### Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@@ -0,0 +1,38 @@
# Pull Request Template
## Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
## Type of change
Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
## How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [ ] Test A
- [ ] Test B
**Test Configuration**:
* WordPress version:
* PHP version:
## Checklist:
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

View File

@@ -0,0 +1,121 @@
# [Download jQuery Manager](https://downloads.wordpress.org/plugin/jquery-manager.zip) (WordPress plugin)
[![GitHub release](https://img.shields.io/github/release/Remzi1993/jquery-manager.svg)](https://github.com/Remzi1993/jquery-manager/releases/latest)
[![GitHub issues](https://img.shields.io/github/issues/Remzi1993/jquery-manager.svg)](https://github.com/Remzi1993/jquery-manager/issues)
[![GitHub forks](https://img.shields.io/github/forks/Remzi1993/jquery-manager.svg)](https://github.com/Remzi1993/jquery-manager/network/members)
[![GitHub stars](https://img.shields.io/github/stars/Remzi1993/jquery-manager.svg)](https://github.com/Remzi1993/jquery-manager/stargazers)
[![GitHub license](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://github.com/Remzi1993/jquery-manager/blob/master/LICENSE)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FRemzi1993%2Fjquery-manager.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FRemzi1993%2Fjquery-manager?ref=badge_shield)
[![Travis (.com) branch](https://img.shields.io/travis/com/Remzi1993/jquery-manager/master.svg)](https://travis-ci.com/Remzi1993/jquery-manager)
[![Maintainability](https://api.codeclimate.com/v1/badges/3dab8e92324e8227109e/maintainability)](https://codeclimate.com/github/Remzi1993/jquery-manager/maintainability)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![first-timers-only](https://img.shields.io/badge/first--timers--only-friendly-blue.svg?style=flat-square)](https://www.firsttimersonly.com)
# jQuery Manager for WordPress
jQuery Manager for WordPress is an open source project and I would like to invite anyone to contribute. The development and issue tracker is located here on GitHub.
## About this debugging tool
Manage jQuery and jQuery Migrate on a WordPress website, activate/select a specific jQuery and/or jQuery Migrate version. The ultimate jQuery debugging tool for WordPress.
## Why yet another jQuery Updater / Manager / Developer / Debugging tool?
Because none of the developer tools let's you select a specific version of jQuery and/or jQuery Migrate. Providing both the compressed minified / production and the uncompressed / development version. See features below! :trophy:<br>
:white_check_mark: **Turn on/off** jQuery and/or jQuery Migrate<br>
:white_check_mark: Activate a **specific version** of jQuery and/or jQuery Migrate<br>
:white_check_mark: Choose how to load **jQuery Migrate** in the **`Head`** or at the end of the **`Body`** **What's the effect?** [source 1](https://flaviocopes.com/javascript-async-defer/)<br>
:white_check_mark: **`Async`** or **`defer`** jQuery and/or jQuery Migrate **What's the effect?** [source 2](https://www.growingwiththeweb.com/2014/02/async-vs-defer-attributes.html), [source 3](https://bitsofco.de/async-vs-defer/)<br>
:white_check_mark: Development done using [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/), also a lot of "jQuery Updater" plugins are outdated and/or buggy / bloated<br>
:white_check_mark: Only executed in the front-end, **doesn't interfere with WordPress admin/backend and WP customizer** (for compatibility reasons) See: https://core.trac.wordpress.org/ticket/45130 and https://core.trac.wordpress.org/ticket/37110 <br>
:new: Debug mode<br>
:thumbsup: Active development<br>
:thumbsup: Active support<br>
:arrows_counterclockwise: Working on more features
## [Download](https://downloads.wordpress.org/plugin/jquery-manager.zip) jQuery Manager for WordPress
Go to the wordpress.org plugin page [wordpress.org/plugins/jquery-manager/](https://wordpress.org/plugins/jquery-manager/) and download the .zip file.
### Manual installation by uploading .zip file via WordPress admin
1. Navigate to > `Plugins` > `Add New`
2. On your top left > click on `Upload Plugin` and select the .zip file you downloaded earlier and click `Install Now`
3. By activating the plugin, jQuery and jQuery Migrate are updated to the latest stable version by default. (Plugin settings are located under `Tools`)
### Manual installation by uploading folder/directory via FTP, SFTP or SSH
1. Unzip (extract/unpack/uncompress) the .zip file you downloaded earlier
2. Upload the folder `jquery-manager` to the `/wp-content/plugins/` directory on your server
3. By activating the plugin, jQuery and jQuery Migrate are updated to the latest stable version by default.
(Plugin settings are located under `Tools`)
## I have a few people I would like to thank
[@YahnisElsts](https://github.com/YahnisElsts) for his amazing work on a updater, that we were using in this
open source project before we became an official WP plugin:<br> https://github.com/YahnisElsts/plugin-update-checker<br>
[@tareq1988](https://github.com/tareq1988) for his awesome WordPress Settings API abstraction class:<br> https://github.com/tareq1988/wordpress-settings-api-class<br>
I thank [@collizo4sky](https://github.com/collizo4sky) for a library which made my live easier: https://github.com/collizo4sky/persist-admin-notices-dismissal
## Bug reports
Report bugs, issues, questions and/or feature request on our GitHub
[issues](https://github.com/Remzi1993/jquery-manager/issues) page.
## Screenshots
<img src="https://ps.w.org/jquery-manager/assets/screenshot-1.png">
<img src="https://ps.w.org/jquery-manager/assets/screenshot-2.png">
## Do you want to help with development?
Working on some awesome feature or a fix? **Fork this repo** and **create a new branch** (branch name for example: feature-name or fix-name) and when you're finished do a **pull request**.
Go to your working WP plugins directory / WordPress install: `/wp-content/plugins/` this is where you want to clone this project or your forked repo in.<br>
Use the following command to clone this repository:<br>
`$ git clone git@github.com:Remzi1993/jquery-manager.git` (example)<br>
If you have forked this repo. You should clone your own repo. To begin working on your feature or fix you should create a branch, this will be easier for us to check your pull request later on.
### Git workflow explained
- https://opensource.guide/how-to-contribute/#opening-a-pull-request
- https://guides.github.com/introduction/flow/
- https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow
- https://en.wikipedia.org/wiki/Fork_and_pull_model
- https://nvie.com/posts/a-successful-git-branching-model/
#### Keep your forks up to date with the upstream repo - or use the [Pull](https://github.com/apps/pull) GitHub App
- https://help.github.com/en/articles/syncing-a-fork
Tutorial: http://makeapullrequest.com
**Working on your first Pull Request?** You can learn how from this _free_ series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
[![WordPress](https://forthebadge.com/images/badges/built-with-wordpress.svg)](https://wordpress.org)
## This project uses [Semantic Versioning](https://semver.org/)
Given a version number MAJOR.MINOR.PATCH:
1. MAJOR version number increases when incompatible API changes are made
2. MINOR version number increases when functionality in a backwards-compatible manner are added
3. PATCH version number increases when backwards-compatible bug fixes are made
## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FRemzi1993%2Fjquery-manager.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FRemzi1993%2Fjquery-manager?ref=badge_large)
## First timers test - add your name below! - https://www.firsttimersonly.com
- Akhil
- tavaresjaime00
- Arun
- sharduldesai7
- Anushka
- Finewitch
- SkelleyBelly

View File

@@ -0,0 +1,22 @@
# Security Policy
## Supported Versions
Only the latest stable version is supported with bug fixes and security updates.
| Version | Supported |
| ---------------------| ------------------ |
| (MAJOR.MINOR.PATCH) | :white_check_mark: |
1. Increasing the MAJOR version means incompatible API changes
2. Increasing the MINOR version means functionality added in a backwards-compatible manner
3. Increasing the PATCH version means backwards-compatible bug fixes and security updates
## Reporting a vulnerability
Due to different time zones (I live in Europe/Amsterdam) it may take me longer to reply. Please, bear this in mind.
You can mail me at: ict@remzi.info (in private for serious security issues) or create an issue on the GitHub project page at https://github.com/Remzi1993/jquery-manager/issues.
I will reply/respond within 24 / 48 hours. Please, give me time to fix this in a timely manner.

View File

@@ -0,0 +1,3 @@
/* General */
.metabox-holder { background: white; padding: 10px 20px; margin-top: 10px; }
.metabox-holder h2 { padding: 0; }

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,752 @@
/*!
* jQuery Migrate - v1.4.1 - 2016-05-19
* Copyright jQuery Foundation and other contributors
*/
(function( jQuery, window, undefined ) {
// See http://bugs.jquery.com/ticket/13335
// "use strict";
jQuery.migrateVersion = "1.4.1";
var warnedAbout = {};
// List of warnings already given; public read only
jQuery.migrateWarnings = [];
// Set to true to prevent console output; migrateWarnings still maintained
// jQuery.migrateMute = false;
// Show a message on the console so devs know we're active
if ( window.console && window.console.log ) {
window.console.log( "JQMIGRATE: Migrate is installed" +
( jQuery.migrateMute ? "" : " with logging active" ) +
", version " + jQuery.migrateVersion );
}
// Set to false to disable traces that appear with warnings
if ( jQuery.migrateTrace === undefined ) {
jQuery.migrateTrace = true;
}
// Forget any warnings we've already given; public
jQuery.migrateReset = function() {
warnedAbout = {};
jQuery.migrateWarnings.length = 0;
};
function migrateWarn( msg) {
var console = window.console;
if ( !warnedAbout[ msg ] ) {
warnedAbout[ msg ] = true;
jQuery.migrateWarnings.push( msg );
if ( console && console.warn && !jQuery.migrateMute ) {
console.warn( "JQMIGRATE: " + msg );
if ( jQuery.migrateTrace && console.trace ) {
console.trace();
}
}
}
}
function migrateWarnProp( obj, prop, value, msg ) {
if ( Object.defineProperty ) {
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
// allow property to be overwritten in case some other plugin wants it
try {
Object.defineProperty( obj, prop, {
configurable: true,
enumerable: true,
get: function() {
migrateWarn( msg );
return value;
},
set: function( newValue ) {
migrateWarn( msg );
value = newValue;
}
});
return;
} catch( err ) {
// IE8 is a dope about Object.defineProperty, can't warn there
}
}
// Non-ES5 (or broken) browser; just set the property
jQuery._definePropertyBroken = true;
obj[ prop ] = value;
}
if ( document.compatMode === "BackCompat" ) {
// jQuery has never supported or tested Quirks Mode
migrateWarn( "jQuery is not compatible with Quirks Mode" );
}
var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
oldAttr = jQuery.attr,
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
function() { return null; },
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
function() { return undefined; },
rnoType = /^(?:input|button)$/i,
rnoAttrNodeType = /^[238]$/,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
ruseDefault = /^(?:checked|selected)$/i;
// jQuery.attrFn
migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
jQuery.attr = function( elem, name, value, pass ) {
var lowerName = name.toLowerCase(),
nType = elem && elem.nodeType;
if ( pass ) {
// Since pass is used internally, we only warn for new jQuery
// versions where there isn't a pass arg in the formal params
if ( oldAttr.length < 4 ) {
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
}
if ( elem && !rnoAttrNodeType.test( nType ) &&
(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
return jQuery( elem )[ name ]( value );
}
}
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
}
// Restore boolHook for boolean property/attribute synchronization
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
jQuery.attrHooks[ lowerName ] = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode,
property = jQuery.prop( elem, name );
return property === true || typeof property !== "boolean" &&
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// Warn only for attributes that can remain distinct from their properties post-1.9
if ( ruseDefault.test( lowerName ) ) {
migrateWarn( "jQuery.fn.attr('" + lowerName + "') might use property instead of attribute" );
}
}
return oldAttr.call( jQuery, elem, name, value );
};
// attrHooks: value
jQuery.attrHooks.value = {
get: function( elem, name ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "button" ) {
return valueAttrGet.apply( this, arguments );
}
if ( nodeName !== "input" && nodeName !== "option" ) {
migrateWarn("jQuery.fn.attr('value') no longer gets properties");
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "button" ) {
return valueAttrSet.apply( this, arguments );
}
if ( nodeName !== "input" && nodeName !== "option" ) {
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
}
// Does not return so that setAttribute is also used
elem.value = value;
}
};
var matched, browser,
oldInit = jQuery.fn.init,
oldFind = jQuery.find,
oldParseJSON = jQuery.parseJSON,
rspaceAngle = /^\s*</,
rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,
// Note: XSS check is done below after string is trimmed
rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
// $(html) "looks like html" rule change
jQuery.fn.init = function( selector, context, rootjQuery ) {
var match, ret;
if ( selector && typeof selector === "string" ) {
if ( !jQuery.isPlainObject( context ) &&
(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
// This is an HTML string according to the "old" rules; is it still?
if ( !rspaceAngle.test( selector ) ) {
migrateWarn("$(html) HTML strings must start with '<' character");
}
if ( match[ 3 ] ) {
migrateWarn("$(html) HTML text after last tag is ignored");
}
// Consistently reject any HTML-like string starting with a hash (gh-9521)
// Note that this may break jQuery 1.6.x code that otherwise would work.
if ( match[ 0 ].charAt( 0 ) === "#" ) {
migrateWarn("HTML string cannot start with a '#' character");
jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
}
// Now process using loose rules; let pre-1.8 play too
// Is this a jQuery context? parseHTML expects a DOM element (#178)
if ( context && context.context && context.context.nodeType ) {
context = context.context;
}
if ( jQuery.parseHTML ) {
return oldInit.call( this,
jQuery.parseHTML( match[ 2 ], context && context.ownerDocument ||
context || document, true ), context, rootjQuery );
}
}
}
ret = oldInit.apply( this, arguments );
// Fill in selector and context properties so .live() works
if ( selector && selector.selector !== undefined ) {
// A jQuery object, copy its properties
ret.selector = selector.selector;
ret.context = selector.context;
} else {
ret.selector = typeof selector === "string" ? selector : "";
if ( selector ) {
ret.context = selector.nodeType? selector : context || document;
}
}
return ret;
};
jQuery.fn.init.prototype = jQuery.fn;
jQuery.find = function( selector ) {
var args = Array.prototype.slice.call( arguments );
// Support: PhantomJS 1.x
// String#match fails to match when used with a //g RegExp, only on some strings
if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
// First see if qS thinks it's a valid selector, if so avoid a false positive
try {
document.querySelector( selector );
} catch ( err1 ) {
// Didn't *look* valid to qSA, warn and try quoting what we think is the value
selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
return "[" + attr + op + "\"" + value + "\"]";
} );
// If the regexp *may* have created an invalid selector, don't update it
// Note that there may be false alarms if selector uses jQuery extensions
try {
document.querySelector( selector );
migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] );
args[ 0 ] = selector;
} catch ( err2 ) {
migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] );
}
}
}
return oldFind.apply( this, args );
};
// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
var findProp;
for ( findProp in oldFind ) {
if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
jQuery.find[ findProp ] = oldFind[ findProp ];
}
}
// Let $.parseJSON(falsy_value) return null
jQuery.parseJSON = function( json ) {
if ( !json ) {
migrateWarn("jQuery.parseJSON requires a valid JSON string");
return null;
}
return oldParseJSON.apply( this, arguments );
};
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
// Don't clobber any existing jQuery.browser in case it's different
if ( !jQuery.browser ) {
matched = jQuery.uaMatch( navigator.userAgent );
browser = {};
if ( matched.browser ) {
browser[ matched.browser ] = true;
browser.version = matched.version;
}
// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
browser.webkit = true;
} else if ( browser.webkit ) {
browser.safari = true;
}
jQuery.browser = browser;
}
// Warn if the code tries to get jQuery.browser
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
// jQuery.boxModel deprecated in 1.3, jQuery.support.boxModel deprecated in 1.7
jQuery.boxModel = jQuery.support.boxModel = (document.compatMode === "CSS1Compat");
migrateWarnProp( jQuery, "boxModel", jQuery.boxModel, "jQuery.boxModel is deprecated" );
migrateWarnProp( jQuery.support, "boxModel", jQuery.support.boxModel, "jQuery.support.boxModel is deprecated" );
jQuery.sub = function() {
function jQuerySub( selector, context ) {
return new jQuerySub.fn.init( selector, context );
}
jQuery.extend( true, jQuerySub, this );
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init( selector, context ) {
var instance = jQuery.fn.init.call( this, selector, context, rootjQuerySub );
return instance instanceof jQuerySub ?
instance :
jQuerySub( instance );
};
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
migrateWarn( "jQuery.sub() is deprecated" );
return jQuerySub;
};
// The number of elements contained in the matched element set
jQuery.fn.size = function() {
migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" );
return this.length;
};
var internalSwapCall = false;
// If this version of jQuery has .swap(), don't false-alarm on internal uses
if ( jQuery.swap ) {
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
if ( oldHook ) {
jQuery.cssHooks[ name ].get = function() {
var ret;
internalSwapCall = true;
ret = oldHook.apply( this, arguments );
internalSwapCall = false;
return ret;
};
}
});
}
jQuery.swap = function( elem, options, callback, args ) {
var ret, name,
old = {};
if ( !internalSwapCall ) {
migrateWarn( "jQuery.swap() is undocumented and deprecated" );
}
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
};
// Ensure that $.ajax gets the new parseJSON defined in core.js
jQuery.ajaxSetup({
converters: {
"text json": jQuery.parseJSON
}
});
var oldFnData = jQuery.fn.data;
jQuery.fn.data = function( name ) {
var ret, evt,
elem = this[0];
// Handles 1.7 which has this behavior and 1.8 which doesn't
if ( elem && name === "events" && arguments.length === 1 ) {
ret = jQuery.data( elem, name );
evt = jQuery._data( elem, name );
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
return evt;
}
}
return oldFnData.apply( this, arguments );
};
var rscriptType = /\/(java|ecma)script/i;
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
if ( !jQuery.clean ) {
jQuery.clean = function( elems, context, fragment, scripts ) {
// Set context per 1.8 logic
context = context || document;
context = !context.nodeType && context[0] || context;
context = context.ownerDocument || context;
migrateWarn("jQuery.clean() is deprecated");
var i, elem, handleScript, jsTags,
ret = [];
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
// Complex logic lifted directly from jQuery 1.8
if ( fragment ) {
// Special handling of each script element
handleScript = function( elem ) {
// Check if we consider it executable
if ( !elem.type || rscriptType.test( elem.type ) ) {
// Detach the script and store it in the scripts array (if provided) or the fragment
// Return truthy to indicate that it has been handled
return scripts ?
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
fragment.appendChild( elem );
}
};
for ( i = 0; (elem = ret[i]) != null; i++ ) {
// Check if we're done after handling an executable script
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
// Append to fragment and handle embedded scripts
fragment.appendChild( elem );
if ( typeof elem.getElementsByTagName !== "undefined" ) {
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
// Splice the scripts into ret after their former ancestor and advance our index beyond them
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
i += jsTags.length;
}
}
}
}
return ret;
};
}
var eventAdd = jQuery.event.add,
eventRemove = jQuery.event.remove,
eventTrigger = jQuery.event.trigger,
oldToggle = jQuery.fn.toggle,
oldLive = jQuery.fn.live,
oldDie = jQuery.fn.die,
oldLoad = jQuery.fn.load,
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
hoverHack = function( events ) {
if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
return events;
}
if ( rhoverHack.test( events ) ) {
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
}
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
// Event props removed in 1.9, put them back if needed; no practical way to warn them
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
}
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
if ( jQuery.event.dispatch ) {
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
}
// Support for 'hover' pseudo-event and ajax event warnings
jQuery.event.add = function( elem, types, handler, data, selector ){
if ( elem !== document && rajaxEvent.test( types ) ) {
migrateWarn( "AJAX events should be attached to document: " + types );
}
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
};
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
};
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
jQuery.fn[ name ] = function() {
var args = Array.prototype.slice.call( arguments, 0 );
// If this is an ajax load() the first arg should be the string URL;
// technically this could also be the "Anything" arg of the event .load()
// which just goes to show why this dumb signature has been deprecated!
// jQuery custom builds that exclude the Ajax module justifiably die here.
if ( name === "load" && typeof args[ 0 ] === "string" ) {
return oldLoad.apply( this, args );
}
migrateWarn( "jQuery.fn." + name + "() is deprecated" );
args.splice( 0, 0, name );
if ( arguments.length ) {
return this.bind.apply( this, args );
}
// Use .triggerHandler here because:
// - load and unload events don't need to bubble, only applied to window or image
// - error event should not bubble to window, although it does pre-1.7
// See http://bugs.jquery.com/ticket/11820
this.triggerHandler.apply( this, args );
return this;
};
});
jQuery.fn.toggle = function( fn, fn2 ) {
// Don't mess with animation or css toggles
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
return oldToggle.apply( this, arguments );
}
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
};
jQuery.fn.live = function( types, data, fn ) {
migrateWarn("jQuery.fn.live() is deprecated");
if ( oldLive ) {
return oldLive.apply( this, arguments );
}
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
};
jQuery.fn.die = function( types, fn ) {
migrateWarn("jQuery.fn.die() is deprecated");
if ( oldDie ) {
return oldDie.apply( this, arguments );
}
jQuery( this.context ).off( types, this.selector || "**", fn );
return this;
};
// Turn global events into document-triggered events
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
if ( !elem && !rajaxEvent.test( event ) ) {
migrateWarn( "Global events are undocumented and deprecated" );
}
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
};
jQuery.each( ajaxEvents.split("|"),
function( _, name ) {
jQuery.event.special[ name ] = {
setup: function() {
var elem = this;
// The document needs no shimming; must be !== for oldIE
if ( elem !== document ) {
jQuery.event.add( document, name + "." + jQuery.guid, function() {
jQuery.event.trigger( name, Array.prototype.slice.call( arguments, 1 ), elem, true );
});
jQuery._data( this, name, jQuery.guid++ );
}
return false;
},
teardown: function() {
if ( this !== document ) {
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
}
return false;
}
};
}
);
jQuery.event.special.ready = {
setup: function() {
if ( this === document ) {
migrateWarn( "'ready' event is deprecated" );
}
}
};
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack,
oldFnFind = jQuery.fn.find;
jQuery.fn.andSelf = function() {
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
return oldSelf.apply( this, arguments );
};
jQuery.fn.find = function( selector ) {
var ret = oldFnFind.apply( this, arguments );
ret.context = this.context;
ret.selector = this.selector ? this.selector + " " + selector : selector;
return ret;
};
// jQuery 1.6 did not support Callbacks, do not warn there
if ( jQuery.Callbacks ) {
var oldDeferred = jQuery.Deferred,
tuples = [
// action, add listener, callbacks, .then handlers, final state
[ "resolve", "done", jQuery.Callbacks("once memory"),
jQuery.Callbacks("once memory"), "resolved" ],
[ "reject", "fail", jQuery.Callbacks("once memory"),
jQuery.Callbacks("once memory"), "rejected" ],
[ "notify", "progress", jQuery.Callbacks("memory"),
jQuery.Callbacks("memory") ]
];
jQuery.Deferred = function( func ) {
var deferred = oldDeferred(),
promise = deferred.promise();
deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
migrateWarn( "deferred.pipe() is deprecated" );
return jQuery.Deferred(function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
// deferred.done(function() { bind to newDefer or newDefer.resolve })
// deferred.fail(function() { bind to newDefer or newDefer.reject })
// deferred.progress(function() { bind to newDefer or newDefer.notify })
deferred[ tuple[1] ](function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ tuple[ 0 ] + "With" ](
this === promise ? newDefer.promise() : this,
fn ? [ returned ] : arguments
);
}
});
});
fns = null;
}).promise();
};
deferred.isResolved = function() {
migrateWarn( "deferred.isResolved is deprecated" );
return deferred.state() === "resolved";
};
deferred.isRejected = function() {
migrateWarn( "deferred.isRejected is deprecated" );
return deferred.state() === "rejected";
};
if ( func ) {
func.call( deferred, deferred );
}
return deferred;
};
}
})( jQuery, window );

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,838 @@
/*!
* jQuery Migrate - v3.3.0 - 2020-05-05T01:57Z
* Copyright OpenJS Foundation and other contributors
*/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery" ], function( jQuery ) {
return factory( jQuery, window );
} );
} else if ( typeof module === "object" && module.exports ) {
// Node/CommonJS
// eslint-disable-next-line no-undef
module.exports = factory( require( "jquery" ), window );
} else {
// Browser globals
factory( jQuery, window );
}
} )( function( jQuery, window ) {
"use strict";
jQuery.migrateVersion = "3.3.0";
// Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2
function compareVersions( v1, v2 ) {
var i,
rVersionParts = /^(\d+)\.(\d+)\.(\d+)/,
v1p = rVersionParts.exec( v1 ) || [ ],
v2p = rVersionParts.exec( v2 ) || [ ];
for ( i = 1; i <= 3; i++ ) {
if ( +v1p[ i ] > +v2p[ i ] ) {
return 1;
}
if ( +v1p[ i ] < +v2p[ i ] ) {
return -1;
}
}
return 0;
}
function jQueryVersionSince( version ) {
return compareVersions( jQuery.fn.jquery, version ) >= 0;
}
( function() {
// Support: IE9 only
// IE9 only creates console object when dev tools are first opened
// IE9 console is a host object, callable but doesn't have .apply()
if ( !window.console || !window.console.log ) {
return;
}
// Need jQuery 3.0.0+ and no older Migrate loaded
if ( !jQuery || !jQueryVersionSince( "3.0.0" ) ) {
window.console.log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" );
}
if ( jQuery.migrateWarnings ) {
window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" );
}
// Show a message on the console so devs know we're active
window.console.log( "JQMIGRATE: Migrate is installed" +
( jQuery.migrateMute ? "" : " with logging active" ) +
", version " + jQuery.migrateVersion );
} )();
var warnedAbout = {};
// By default each warning is only reported once.
jQuery.migrateDeduplicateWarnings = true;
// List of warnings already given; public read only
jQuery.migrateWarnings = [];
// Set to false to disable traces that appear with warnings
if ( jQuery.migrateTrace === undefined ) {
jQuery.migrateTrace = true;
}
// Forget any warnings we've already given; public
jQuery.migrateReset = function() {
warnedAbout = {};
jQuery.migrateWarnings.length = 0;
};
function migrateWarn( msg ) {
var console = window.console;
if ( !jQuery.migrateDeduplicateWarnings || !warnedAbout[ msg ] ) {
warnedAbout[ msg ] = true;
jQuery.migrateWarnings.push( msg );
if ( console && console.warn && !jQuery.migrateMute ) {
console.warn( "JQMIGRATE: " + msg );
if ( jQuery.migrateTrace && console.trace ) {
console.trace();
}
}
}
}
function migrateWarnProp( obj, prop, value, msg ) {
Object.defineProperty( obj, prop, {
configurable: true,
enumerable: true,
get: function() {
migrateWarn( msg );
return value;
},
set: function( newValue ) {
migrateWarn( msg );
value = newValue;
}
} );
}
function migrateWarnFunc( obj, prop, newFunc, msg ) {
obj[ prop ] = function() {
migrateWarn( msg );
return newFunc.apply( this, arguments );
};
}
if ( window.document.compatMode === "BackCompat" ) {
// JQuery has never supported or tested Quirks Mode
migrateWarn( "jQuery is not compatible with Quirks Mode" );
}
var findProp,
class2type = {},
oldInit = jQuery.fn.init,
oldFind = jQuery.find,
rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,
// Support: Android <=4.0 only
// Make sure we trim BOM and NBSP
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
jQuery.fn.init = function( arg1 ) {
var args = Array.prototype.slice.call( arguments );
if ( typeof arg1 === "string" && arg1 === "#" ) {
// JQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0
migrateWarn( "jQuery( '#' ) is not a valid selector" );
args[ 0 ] = [];
}
return oldInit.apply( this, args );
};
jQuery.fn.init.prototype = jQuery.fn;
jQuery.find = function( selector ) {
var args = Array.prototype.slice.call( arguments );
// Support: PhantomJS 1.x
// String#match fails to match when used with a //g RegExp, only on some strings
if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
// First see if qS thinks it's a valid selector, if so avoid a false positive
try {
window.document.querySelector( selector );
} catch ( err1 ) {
// Didn't *look* valid to qSA, warn and try quoting what we think is the value
selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
return "[" + attr + op + "\"" + value + "\"]";
} );
// If the regexp *may* have created an invalid selector, don't update it
// Note that there may be false alarms if selector uses jQuery extensions
try {
window.document.querySelector( selector );
migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] );
args[ 0 ] = selector;
} catch ( err2 ) {
migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] );
}
}
}
return oldFind.apply( this, args );
};
// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
for ( findProp in oldFind ) {
if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
jQuery.find[ findProp ] = oldFind[ findProp ];
}
}
// The number of elements contained in the matched element set
migrateWarnFunc( jQuery.fn, "size", function() {
return this.length;
},
"jQuery.fn.size() is deprecated and removed; use the .length property" );
migrateWarnFunc( jQuery, "parseJSON", function() {
return JSON.parse.apply( null, arguments );
},
"jQuery.parseJSON is deprecated; use JSON.parse" );
migrateWarnFunc( jQuery, "holdReady", jQuery.holdReady,
"jQuery.holdReady is deprecated" );
migrateWarnFunc( jQuery, "unique", jQuery.uniqueSort,
"jQuery.unique is deprecated; use jQuery.uniqueSort" );
// Now jQuery.expr.pseudos is the standard incantation
migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos,
"jQuery.expr.filters is deprecated; use jQuery.expr.pseudos" );
migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos,
"jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos" );
// Prior to jQuery 3.1.1 there were internal refs so we don't warn there
if ( jQueryVersionSince( "3.1.1" ) ) {
migrateWarnFunc( jQuery, "trim", function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
"jQuery.trim is deprecated; use String.prototype.trim" );
}
// Prior to jQuery 3.2 there were internal refs so we don't warn there
if ( jQueryVersionSince( "3.2.0" ) ) {
migrateWarnFunc( jQuery, "nodeName", function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
"jQuery.nodeName is deprecated" );
}
if ( jQueryVersionSince( "3.3.0" ) ) {
migrateWarnFunc( jQuery, "isNumeric", function( obj ) {
// As of jQuery 3.0, isNumeric is limited to
// strings and numbers (primitives or objects)
// that can be coerced to finite numbers (gh-2662)
var type = typeof obj;
return ( type === "number" || type === "string" ) &&
// parseFloat NaNs numeric-cast false positives ("")
// ...but misinterprets leading-number strings, e.g. hex literals ("0x...")
// subtraction forces infinities to NaN
!isNaN( obj - parseFloat( obj ) );
},
"jQuery.isNumeric() is deprecated"
);
// Populate the class2type map
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".
split( " " ),
function( _, name ) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
} );
migrateWarnFunc( jQuery, "type", function( obj ) {
if ( obj == null ) {
return obj + "";
}
// Support: Android <=2.3 only (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[ Object.prototype.toString.call( obj ) ] || "object" :
typeof obj;
},
"jQuery.type is deprecated" );
migrateWarnFunc( jQuery, "isFunction",
function( obj ) {
return typeof obj === "function";
},
"jQuery.isFunction() is deprecated" );
migrateWarnFunc( jQuery, "isWindow",
function( obj ) {
return obj != null && obj === obj.window;
},
"jQuery.isWindow() is deprecated"
);
migrateWarnFunc( jQuery, "isArray", Array.isArray,
"jQuery.isArray is deprecated; use Array.isArray"
);
}
// Support jQuery slim which excludes the ajax module
if ( jQuery.ajax ) {
var oldAjax = jQuery.ajax;
jQuery.ajax = function( ) {
var jQXHR = oldAjax.apply( this, arguments );
// Be sure we got a jQXHR (e.g., not sync)
if ( jQXHR.promise ) {
migrateWarnFunc( jQXHR, "success", jQXHR.done,
"jQXHR.success is deprecated and removed" );
migrateWarnFunc( jQXHR, "error", jQXHR.fail,
"jQXHR.error is deprecated and removed" );
migrateWarnFunc( jQXHR, "complete", jQXHR.always,
"jQXHR.complete is deprecated and removed" );
}
return jQXHR;
};
}
var oldRemoveAttr = jQuery.fn.removeAttr,
oldToggleClass = jQuery.fn.toggleClass,
rmatchNonSpace = /\S+/g;
jQuery.fn.removeAttr = function( name ) {
var self = this;
jQuery.each( name.match( rmatchNonSpace ), function( _i, attr ) {
if ( jQuery.expr.match.bool.test( attr ) ) {
migrateWarn( "jQuery.fn.removeAttr no longer sets boolean properties: " + attr );
self.prop( attr, false );
}
} );
return oldRemoveAttr.apply( this, arguments );
};
jQuery.fn.toggleClass = function( state ) {
// Only deprecating no-args or single boolean arg
if ( state !== undefined && typeof state !== "boolean" ) {
return oldToggleClass.apply( this, arguments );
}
migrateWarn( "jQuery.fn.toggleClass( boolean ) is deprecated" );
// Toggle entire class name of each element
return this.each( function() {
var className = this.getAttribute && this.getAttribute( "class" ) || "";
if ( className ) {
jQuery.data( this, "__className__", className );
}
// If the element has a class name or if we're passed `false`,
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
if ( this.setAttribute ) {
this.setAttribute( "class",
className || state === false ?
"" :
jQuery.data( this, "__className__" ) || ""
);
}
} );
};
function camelCase( string ) {
return string.replace( /-([a-z])/g, function( _, letter ) {
return letter.toUpperCase();
} );
}
var oldFnCss,
internalSwapCall = false,
ralphaStart = /^[a-z]/,
// The regex visualized:
//
// /----------\
// | | /-------\
// | / Top \ | | |
// /--- Border ---+-| Right |-+---+- Width -+---\
// | | Bottom | |
// | \ Left / |
// | |
// | /----------\ |
// | /-------------\ | | |- END
// | | | | / Top \ | |
// | | / Margin \ | | | Right | | |
// |---------+-| |-+---+-| Bottom |-+----|
// | \ Padding / \ Left / |
// BEGIN -| |
// | /---------\ |
// | | | |
// | | / Min \ | / Width \ |
// \--------------+-| |-+---| |---/
// \ Max / \ Height /
rautoPx = /^(?:Border(?:Top|Right|Bottom|Left)?(?:Width|)|(?:Margin|Padding)?(?:Top|Right|Bottom|Left)?|(?:Min|Max)?(?:Width|Height))$/;
// If this version of jQuery has .swap(), don't false-alarm on internal uses
if ( jQuery.swap ) {
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
if ( oldHook ) {
jQuery.cssHooks[ name ].get = function() {
var ret;
internalSwapCall = true;
ret = oldHook.apply( this, arguments );
internalSwapCall = false;
return ret;
};
}
} );
}
jQuery.swap = function( elem, options, callback, args ) {
var ret, name,
old = {};
if ( !internalSwapCall ) {
migrateWarn( "jQuery.swap() is undocumented and deprecated" );
}
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
};
if ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) {
jQuery.cssProps = new Proxy( jQuery.cssProps || {}, {
set: function() {
migrateWarn( "JQMIGRATE: jQuery.cssProps is deprecated" );
return Reflect.set.apply( this, arguments );
}
} );
}
// Create a dummy jQuery.cssNumber if missing. It won't be used by jQuery but
// it will prevent code adding new keys to it unconditionally from crashing.
if ( !jQuery.cssNumber ) {
jQuery.cssNumber = {};
}
function isAutoPx( prop ) {
// The first test is used to ensure that:
// 1. The prop starts with a lowercase letter (as we uppercase it for the second regex).
// 2. The prop is not empty.
return ralphaStart.test( prop ) &&
rautoPx.test( prop[ 0 ].toUpperCase() + prop.slice( 1 ) );
}
oldFnCss = jQuery.fn.css;
jQuery.fn.css = function( name, value ) {
var origThis = this;
if ( typeof name !== "string" ) {
jQuery.each( name, function( n, v ) {
jQuery.fn.css.call( origThis, n, v );
} );
}
if ( typeof value === "number" && !isAutoPx( camelCase( name ) ) ) {
migrateWarn( "Use of number-typed values is deprecated in jQuery.fn.css" );
}
return oldFnCss.apply( this, arguments );
};
var oldData = jQuery.data;
jQuery.data = function( elem, name, value ) {
var curData, sameKeys, key;
// Name can be an object, and each entry in the object is meant to be set as data
if ( name && typeof name === "object" && arguments.length === 2 ) {
curData = jQuery.hasData( elem ) && oldData.call( this, elem );
sameKeys = {};
for ( key in name ) {
if ( key !== camelCase( key ) ) {
migrateWarn( "jQuery.data() always sets/gets camelCased names: " + key );
curData[ key ] = name[ key ];
} else {
sameKeys[ key ] = name[ key ];
}
}
oldData.call( this, elem, sameKeys );
return name;
}
// If the name is transformed, look for the un-transformed name in the data object
if ( name && typeof name === "string" && name !== camelCase( name ) ) {
curData = jQuery.hasData( elem ) && oldData.call( this, elem );
if ( curData && name in curData ) {
migrateWarn( "jQuery.data() always sets/gets camelCased names: " + name );
if ( arguments.length > 2 ) {
curData[ name ] = value;
}
return curData[ name ];
}
}
return oldData.apply( this, arguments );
};
// Support jQuery slim which excludes the effects module
if ( jQuery.fx ) {
var intervalValue, intervalMsg,
oldTweenRun = jQuery.Tween.prototype.run,
linearEasing = function( pct ) {
return pct;
};
jQuery.Tween.prototype.run = function( ) {
if ( jQuery.easing[ this.easing ].length > 1 ) {
migrateWarn(
"'jQuery.easing." + this.easing.toString() + "' should use only one argument"
);
jQuery.easing[ this.easing ] = linearEasing;
}
oldTweenRun.apply( this, arguments );
};
intervalValue = jQuery.fx.interval || 13;
intervalMsg = "jQuery.fx.interval is deprecated";
// Support: IE9, Android <=4.4
// Avoid false positives on browsers that lack rAF
// Don't warn if document is hidden, jQuery uses setTimeout (#292)
if ( window.requestAnimationFrame ) {
Object.defineProperty( jQuery.fx, "interval", {
configurable: true,
enumerable: true,
get: function() {
if ( !window.document.hidden ) {
migrateWarn( intervalMsg );
}
return intervalValue;
},
set: function( newValue ) {
migrateWarn( intervalMsg );
intervalValue = newValue;
}
} );
}
}
var oldLoad = jQuery.fn.load,
oldEventAdd = jQuery.event.add,
originalFix = jQuery.event.fix;
jQuery.event.props = [];
jQuery.event.fixHooks = {};
migrateWarnProp( jQuery.event.props, "concat", jQuery.event.props.concat,
"jQuery.event.props.concat() is deprecated and removed" );
jQuery.event.fix = function( originalEvent ) {
var event,
type = originalEvent.type,
fixHook = this.fixHooks[ type ],
props = jQuery.event.props;
if ( props.length ) {
migrateWarn( "jQuery.event.props are deprecated and removed: " + props.join() );
while ( props.length ) {
jQuery.event.addProp( props.pop() );
}
}
if ( fixHook && !fixHook._migrated_ ) {
fixHook._migrated_ = true;
migrateWarn( "jQuery.event.fixHooks are deprecated and removed: " + type );
if ( ( props = fixHook.props ) && props.length ) {
while ( props.length ) {
jQuery.event.addProp( props.pop() );
}
}
}
event = originalFix.call( this, originalEvent );
return fixHook && fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
};
jQuery.event.add = function( elem, types ) {
// This misses the multiple-types case but that seems awfully rare
if ( elem === window && types === "load" && window.document.readyState === "complete" ) {
migrateWarn( "jQuery(window).on('load'...) called after load event occurred" );
}
return oldEventAdd.apply( this, arguments );
};
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
jQuery.fn[ name ] = function() {
var args = Array.prototype.slice.call( arguments, 0 );
// If this is an ajax load() the first arg should be the string URL;
// technically this could also be the "Anything" arg of the event .load()
// which just goes to show why this dumb signature has been deprecated!
// jQuery custom builds that exclude the Ajax module justifiably die here.
if ( name === "load" && typeof args[ 0 ] === "string" ) {
return oldLoad.apply( this, args );
}
migrateWarn( "jQuery.fn." + name + "() is deprecated" );
args.splice( 0, 0, name );
if ( arguments.length ) {
return this.on.apply( this, args );
}
// Use .triggerHandler here because:
// - load and unload events don't need to bubble, only applied to window or image
// - error event should not bubble to window, although it does pre-1.7
// See http://bugs.jquery.com/ticket/11820
this.triggerHandler.apply( this, args );
return this;
};
} );
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup contextmenu" ).split( " " ),
function( _i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
migrateWarn( "jQuery.fn." + name + "() event shorthand is deprecated" );
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
} );
// Trigger "ready" event only once, on document ready
jQuery( function() {
jQuery( window.document ).triggerHandler( "ready" );
} );
jQuery.event.special.ready = {
setup: function() {
if ( this === window.document ) {
migrateWarn( "'ready' event is deprecated" );
}
}
};
jQuery.fn.extend( {
bind: function( types, data, fn ) {
migrateWarn( "jQuery.fn.bind() is deprecated" );
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
migrateWarn( "jQuery.fn.unbind() is deprecated" );
return this.off( types, null, fn );
},
delegate: function( selector, types, data, fn ) {
migrateWarn( "jQuery.fn.delegate() is deprecated" );
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
migrateWarn( "jQuery.fn.undelegate() is deprecated" );
return arguments.length === 1 ?
this.off( selector, "**" ) :
this.off( types, selector || "**", fn );
},
hover: function( fnOver, fnOut ) {
migrateWarn( "jQuery.fn.hover() is deprecated" );
return this.on( "mouseenter", fnOver ).on( "mouseleave", fnOut || fnOver );
}
} );
var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
origHtmlPrefilter = jQuery.htmlPrefilter,
makeMarkup = function( html ) {
var doc = window.document.implementation.createHTMLDocument( "" );
doc.body.innerHTML = html;
return doc.body && doc.body.innerHTML;
},
warnIfChanged = function( html ) {
var changed = html.replace( rxhtmlTag, "<$1></$2>" );
if ( changed !== html && makeMarkup( html ) !== makeMarkup( changed ) ) {
migrateWarn( "HTML tags must be properly nested and closed: " + html );
}
};
jQuery.UNSAFE_restoreLegacyHtmlPrefilter = function() {
jQuery.htmlPrefilter = function( html ) {
warnIfChanged( html );
return html.replace( rxhtmlTag, "<$1></$2>" );
};
};
jQuery.htmlPrefilter = function( html ) {
warnIfChanged( html );
return origHtmlPrefilter( html );
};
var oldOffset = jQuery.fn.offset;
jQuery.fn.offset = function() {
var docElem,
elem = this[ 0 ],
bogus = { top: 0, left: 0 };
if ( !elem || !elem.nodeType ) {
migrateWarn( "jQuery.fn.offset() requires a valid DOM element" );
return undefined;
}
docElem = ( elem.ownerDocument || window.document ).documentElement;
if ( !jQuery.contains( docElem, elem ) ) {
migrateWarn( "jQuery.fn.offset() requires an element connected to a document" );
return bogus;
}
return oldOffset.apply( this, arguments );
};
// Support jQuery slim which excludes the ajax module
// The jQuery.param patch is about respecting `jQuery.ajaxSettings.traditional`
// so it doesn't make sense for the slim build.
if ( jQuery.ajax ) {
var oldParam = jQuery.param;
jQuery.param = function( data, traditional ) {
var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
if ( traditional === undefined && ajaxTraditional ) {
migrateWarn( "jQuery.param() no longer uses jQuery.ajaxSettings.traditional" );
traditional = ajaxTraditional;
}
return oldParam.call( this, data, traditional );
};
}
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
jQuery.fn.andSelf = function() {
migrateWarn( "jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" );
return oldSelf.apply( this, arguments );
};
// Support jQuery slim which excludes the deferred module in jQuery 4.0+
if ( jQuery.Deferred ) {
var oldDeferred = jQuery.Deferred,
tuples = [
// Action, add listener, callbacks, .then handlers, final state
[ "resolve", "done", jQuery.Callbacks( "once memory" ),
jQuery.Callbacks( "once memory" ), "resolved" ],
[ "reject", "fail", jQuery.Callbacks( "once memory" ),
jQuery.Callbacks( "once memory" ), "rejected" ],
[ "notify", "progress", jQuery.Callbacks( "memory" ),
jQuery.Callbacks( "memory" ) ]
];
jQuery.Deferred = function( func ) {
var deferred = oldDeferred(),
promise = deferred.promise();
deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
migrateWarn( "deferred.pipe() is deprecated" );
return jQuery.Deferred( function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var fn = typeof fns[ i ] === "function" && fns[ i ];
// Deferred.done(function() { bind to newDefer or newDefer.resolve })
// deferred.fail(function() { bind to newDefer or newDefer.reject })
// deferred.progress(function() { bind to newDefer or newDefer.notify })
deferred[ tuple[ 1 ] ]( function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && typeof returned.promise === "function" ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ tuple[ 0 ] + "With" ](
this === promise ? newDefer.promise() : this,
fn ? [ returned ] : arguments
);
}
} );
} );
fns = null;
} ).promise();
};
if ( func ) {
func.call( deferred, deferred );
}
return deferred;
};
// Preserve handler of uncaught exceptions in promise chains
jQuery.Deferred.exceptionHook = oldDeferred.exceptionHook;
}
return jQuery;
} );

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,155 @@
#!/usr/bin/env bash
if [ $# -lt 3 ]; then
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]"
exit 1
fi
DB_NAME=$1
DB_USER=$2
DB_PASS=$3
DB_HOST=${4-localhost}
WP_VERSION=${5-latest}
SKIP_DB_CREATE=${6-false}
TMPDIR=${TMPDIR-/tmp}
TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/}
download() {
if [ `which curl` ]; then
curl -s "$1" > "$2";
elif [ `which wget` ]; then
wget -nv -O "$2" "$1"
fi
}
if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+\-(beta|RC)[0-9]+$ ]]; then
WP_BRANCH=${WP_VERSION%\-*}
WP_TESTS_TAG="branches/$WP_BRANCH"
elif [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then
WP_TESTS_TAG="branches/$WP_VERSION"
elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
WP_TESTS_TAG="tags/${WP_VERSION%??}"
else
WP_TESTS_TAG="tags/$WP_VERSION"
fi
elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
WP_TESTS_TAG="trunk"
else
# http serves a single offer, whereas https serves multiple. we only want one
download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json
grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json
LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
if [[ -z "$LATEST_VERSION" ]]; then
echo "Latest WordPress version could not be found"
exit 1
fi
WP_TESTS_TAG="tags/$LATEST_VERSION"
fi
set -ex
install_wp() {
if [ -d $WP_CORE_DIR ]; then
return;
fi
mkdir -p $WP_CORE_DIR
if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
mkdir -p $TMPDIR/wordpress-nightly
download https://wordpress.org/nightly-builds/wordpress-latest.zip $TMPDIR/wordpress-nightly/wordpress-nightly.zip
unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/
mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR
else
if [ $WP_VERSION == 'latest' ]; then
local ARCHIVE_NAME='latest'
elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then
# https serves multiple offers, whereas http serves single.
download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
LATEST_VERSION=${WP_VERSION%??}
else
# otherwise, scan the releases and get the most up to date minor version of the major release
local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'`
LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1)
fi
if [[ -z "$LATEST_VERSION" ]]; then
local ARCHIVE_NAME="wordpress-$WP_VERSION"
else
local ARCHIVE_NAME="wordpress-$LATEST_VERSION"
fi
else
local ARCHIVE_NAME="wordpress-$WP_VERSION"
fi
download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz
tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR
fi
download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
}
install_test_suite() {
# portable in-place argument for both GNU sed and Mac OSX sed
if [[ $(uname -s) == 'Darwin' ]]; then
local ioption='-i.bak'
else
local ioption='-i'
fi
# set up testing suite if it doesn't yet exist
if [ ! -d $WP_TESTS_DIR ]; then
# set up testing suite
mkdir -p $WP_TESTS_DIR
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
fi
if [ ! -f wp-tests-config.php ]; then
download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
# remove all forward slashes in the end
WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::")
sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
fi
}
install_db() {
if [ ${SKIP_DB_CREATE} = "true" ]; then
return 0
fi
# parse DB_HOST for port or socket references
local PARTS=(${DB_HOST//\:/ })
local DB_HOSTNAME=${PARTS[0]};
local DB_SOCK_OR_PORT=${PARTS[1]};
local EXTRA=""
if ! [ -z $DB_HOSTNAME ] ; then
if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then
EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
elif ! [ -z $DB_SOCK_OR_PORT ] ; then
EXTRA=" --socket=$DB_SOCK_OR_PORT"
elif ! [ -z $DB_HOSTNAME ] ; then
EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
fi
fi
# create database
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
}
install_wp
install_test_suite
install_db

View File

@@ -0,0 +1,26 @@
codecov:
notify:
require_ci_to_pass: yes
coverage:
precision: 2
round: down
range: "70...100"
status:
project: yes
patch: yes
changes: no
parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no
comment:
layout: "header, diff"
behavior: default
require_changes: no

View File

@@ -0,0 +1,37 @@
{
"name": "remzi1993/jquery-manager",
"description": "Manage jQuery on a WordPress website. The ultimate jQuery debugging tool for WordPress",
"keywords": [
"wordpress",
"plugin",
"jQuery",
"jQuery Migrate",
"jQuery Updater",
"jQuery Manager",
"jQuery Debugging Tool",
"jQuery Developer Tool"
],
"homepage": "https://github.com/Remzi1993/jquery-manager",
"license": "GPL-3.0-only",
"authors": [
{
"name": "Remzi Cavdar",
"email": "ict@remzi.info",
"homepage": "https://twitter.com/remzicavdar"
}
],
"type": "wordpress-plugin",
"require": {
"php": ">=5.6.38",
"composer/installers": "1.9.0",
"collizo4sky/persist-admin-notices-dismissal": "1.4.3"
},
"require-dev": {
"phpunit/phpunit": "9.2.6",
"squizlabs/php_codesniffer": "*",
"phpcompatibility/php-compatibility": "*",
"dealerdirect/phpcodesniffer-composer-installer": "*",
"ext-xdebug": "*",
"roave/security-advisories": "dev-master"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,657 @@
<?php
/**
* weDevs Settings API wrapper class
*
* @version 1.3 (27-Sep-2016)
*
* @author Tareq Hasan <tareq@weDevs.com>
* @link https://tareq.co Tareq Hasan
* @example example/oop-example.php How to use the class
*/
if ( !class_exists( 'WeDevs_Settings_API' ) ) {
class WeDevs_Settings_API {
/**
* settings sections array
*
* @var array
*/
protected $settings_sections = array();
/**
* Settings fields array
*
* @var array
*/
protected $settings_fields = array();
public function __construct() {
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
}
/**
* Enqueue scripts and styles
*/
function admin_enqueue_scripts() {
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_media();
wp_enqueue_script( 'wp-color-picker' );
wp_enqueue_script( 'jquery' );
}
/**
* Set settings sections
*
* @param array $sections setting sections array
*/
function set_sections( $sections ) {
$this->settings_sections = $sections;
return $this;
}
/**
* Add a single section
*
* @param array $section
*/
function add_section( $section ) {
$this->settings_sections[] = $section;
return $this;
}
/**
* Set settings fields
*
* @param array $fields settings fields array
*/
function set_fields( $fields ) {
$this->settings_fields = $fields;
return $this;
}
function add_field( $section, $field ) {
$defaults = array(
'name' => '',
'label' => '',
'desc' => '',
'type' => 'text'
);
$arg = wp_parse_args( $field, $defaults );
$this->settings_fields[$section][] = $arg;
return $this;
}
/**
* Initialize and registers the settings sections and fileds to WordPress
*
* Usually this should be called at `admin_init` hook.
*
* This function gets the initiated settings sections and fields. Then
* registers them to WordPress and ready for use.
*/
function admin_init() {
//register settings sections
foreach ( $this->settings_sections as $section ) {
if ( false == get_option( $section['id'] ) ) {
add_option( $section['id'] );
}
if ( isset($section['desc']) && !empty($section['desc']) ) {
$section['desc'] = '<div class="inside">' . $section['desc'] . '</div>';
$callback = function() use ( $section ) {
echo str_replace( '"', '\"', $section['desc'] );
};
} else if ( isset( $section['callback'] ) ) {
$callback = $section['callback'];
} else {
$callback = null;
}
add_settings_section( $section['id'], $section['title'], $callback, $section['id'] );
}
//register settings fields
foreach ( $this->settings_fields as $section => $field ) {
foreach ( $field as $option ) {
$name = $option['name'];
$type = isset( $option['type'] ) ? $option['type'] : 'text';
$label = isset( $option['label'] ) ? $option['label'] : '';
$callback = isset( $option['callback'] ) ? $option['callback'] : array( $this, 'callback_' . $type );
$args = array(
'id' => $name,
'class' => isset( $option['class'] ) ? $option['class'] : $name,
'label_for' => "{$section}[{$name}]",
'desc' => isset( $option['desc'] ) ? $option['desc'] : '',
'name' => $label,
'section' => $section,
'size' => isset( $option['size'] ) ? $option['size'] : null,
'options' => isset( $option['options'] ) ? $option['options'] : '',
'std' => isset( $option['default'] ) ? $option['default'] : '',
'sanitize_callback' => isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : '',
'type' => $type,
'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : '',
'min' => isset( $option['min'] ) ? $option['min'] : '',
'max' => isset( $option['max'] ) ? $option['max'] : '',
'step' => isset( $option['step'] ) ? $option['step'] : '',
);
add_settings_field( "{$section}[{$name}]", $label, $callback, $section, $section, $args );
}
}
// creates our settings in the options table
foreach ( $this->settings_sections as $section ) {
register_setting( $section['id'], $section['id'], array( $this, 'sanitize_options' ) );
}
}
/**
* Get field description for display
*
* @param array $args settings field args
*/
public function get_field_description( $args ) {
if ( ! empty( $args['desc'] ) ) {
$desc = sprintf( '<p class="description">%s</p>', $args['desc'] );
} else {
$desc = '';
}
return $desc;
}
/**
* Displays a text field for a settings field
*
* @param array $args settings field args
*/
function callback_text( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
$type = isset( $args['type'] ) ? $args['type'] : 'text';
$placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
$html = sprintf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder );
$html .= $this->get_field_description( $args );
echo $html;
}
/**
* Displays a url field for a settings field
*
* @param array $args settings field args
*/
function callback_url( $args ) {
$this->callback_text( $args );
}
/**
* Displays a number field for a settings field
*
* @param array $args settings field args
*/
function callback_number( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
$type = isset( $args['type'] ) ? $args['type'] : 'number';
$placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
$min = ( $args['min'] == '' ) ? '' : ' min="' . $args['min'] . '"';
$max = ( $args['max'] == '' ) ? '' : ' max="' . $args['max'] . '"';
$step = ( $args['step'] == '' ) ? '' : ' step="' . $args['step'] . '"';
$html = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step );
$html .= $this->get_field_description( $args );
echo $html;
}
/**
* Displays a checkbox for a settings field
*
* @param array $args settings field args
*/
function callback_checkbox( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$html = '<fieldset>';
$html .= sprintf( '<label for="wpuf-%1$s[%2$s]">', $args['section'], $args['id'] );
$html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id'] );
$html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s />', $args['section'], $args['id'], checked( $value, 'on', false ) );
$html .= sprintf( '%1$s</label>', $args['desc'] );
$html .= '</fieldset>';
echo $html;
}
/**
* Displays a multicheckbox for a settings field
*
* @param array $args settings field args
*/
function callback_multicheck( $args ) {
$value = $this->get_option( $args['id'], $args['section'], $args['std'] );
$html = '<fieldset>';
$html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] );
foreach ( $args['options'] as $key => $label ) {
$checked = isset( $value[$key] ) ? $value[$key] : '0';
$html .= sprintf( '<label for="wpuf-%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
$html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) );
$html .= sprintf( '%1$s</label><br>', $label );
}
$html .= $this->get_field_description( $args );
$html .= '</fieldset>';
echo $html;
}
/**
* Displays a radio button for a settings field
*
* @param array $args settings field args
*/
function callback_radio( $args ) {
$value = $this->get_option( $args['id'], $args['section'], $args['std'] );
$html = '<fieldset>';
foreach ( $args['options'] as $key => $label ) {
$html .= sprintf( '<label for="wpuf-%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
$html .= sprintf( '<input type="radio" class="radio" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $value, $key, false ) );
$html .= sprintf( '%1$s</label><br>', $label );
}
$html .= $this->get_field_description( $args );
$html .= '</fieldset>';
echo $html;
}
/**
* Displays a selectbox for a settings field
*
* @param array $args settings field args
*/
function callback_select( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
$html = sprintf( '<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] );
foreach ( $args['options'] as $key => $label ) {
$html .= sprintf( '<option value="%s"%s>%s</option>', $key, selected( $value, $key, false ), $label );
}
$html .= sprintf( '</select>' );
$html .= $this->get_field_description( $args );
echo $html;
}
/**
* Displays a textarea for a settings field
*
* @param array $args settings field args
*/
function callback_textarea( $args ) {
$value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
$placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="'.$args['placeholder'].'"';
$html = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value );
$html .= $this->get_field_description( $args );
echo $html;
}
/**
* Displays the html for a settings field
*
* @param array $args settings field args
* @return string
*/
function callback_html( $args ) {
echo $this->get_field_description( $args );
}
/**
* Displays a rich text textarea for a settings field
*
* @param array $args settings field args
*/
function callback_wysiwyg( $args ) {
$value = $this->get_option( $args['id'], $args['section'], $args['std'] );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : '500px';
echo '<div style="max-width: ' . $size . ';">';
$editor_settings = array(
'teeny' => true,
'textarea_name' => $args['section'] . '[' . $args['id'] . ']',
'textarea_rows' => 10
);
if ( isset( $args['options'] ) && is_array( $args['options'] ) ) {
$editor_settings = array_merge( $editor_settings, $args['options'] );
}
wp_editor( $value, $args['section'] . '-' . $args['id'], $editor_settings );
echo '</div>';
echo $this->get_field_description( $args );
}
/**
* Displays a file upload field for a settings field
*
* @param array $args settings field args
*/
function callback_file( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
$id = $args['section'] . '[' . $args['id'] . ']';
$label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File' );
$html = sprintf( '<input type="text" class="%1$s-text wpsa-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
$html .= '<input type="button" class="button wpsa-browse" value="' . $label . '" />';
$html .= $this->get_field_description( $args );
echo $html;
}
/**
* Displays a password field for a settings field
*
* @param array $args settings field args
*/
function callback_password( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
$html = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
$html .= $this->get_field_description( $args );
echo $html;
}
/**
* Displays a color picker field for a settings field
*
* @param array $args settings field args
*/
function callback_color( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
$html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );
$html .= $this->get_field_description( $args );
echo $html;
}
/**
* Displays a select box for creating the pages select box
*
* @param array $args settings field args
*/
function callback_pages( $args ) {
$dropdown_args = array(
'selected' => esc_attr($this->get_option($args['id'], $args['section'], $args['std'] ) ),
'name' => $args['section'] . '[' . $args['id'] . ']',
'id' => $args['section'] . '[' . $args['id'] . ']',
'echo' => 0
);
$html = wp_dropdown_pages( $dropdown_args );
echo $html;
}
/**
* Sanitize callback for Settings API
*
* @return mixed
*/
function sanitize_options( $options ) {
if ( !$options ) {
return $options;
}
foreach( $options as $option_slug => $option_value ) {
$sanitize_callback = $this->get_sanitize_callback( $option_slug );
// If callback is set, call it
if ( $sanitize_callback ) {
$options[ $option_slug ] = call_user_func( $sanitize_callback, $option_value );
continue;
}
}
return $options;
}
/**
* Get sanitization callback for given option slug
*
* @param string $slug option slug
*
* @return mixed string or bool false
*/
function get_sanitize_callback( $slug = '' ) {
if ( empty( $slug ) ) {
return false;
}
// Iterate over registered fields and see if we can find proper callback
foreach( $this->settings_fields as $section => $options ) {
foreach ( $options as $option ) {
if ( $option['name'] != $slug ) {
continue;
}
// Return the callback name
return isset( $option['sanitize_callback'] ) && is_callable( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : false;
}
}
return false;
}
/**
* Get the value of a settings field
*
* @param string $option settings field name
* @param string $section the section name this field belongs to
* @param string $default default text if it's not found
* @return string
*/
function get_option( $option, $section, $default = '' ) {
$options = get_option( $section );
if ( isset( $options[$option] ) ) {
return $options[$option];
}
return $default;
}
/**
* Show navigations as tab
*
* Shows all the settings section labels as tab
*/
function show_navigation() {
$html = '<h2 class="nav-tab-wrapper">';
$count = count( $this->settings_sections );
// don't show the navigation if only one section exists
if ( $count === 1 ) {
return;
}
foreach ( $this->settings_sections as $tab ) {
$html .= sprintf( '<a href="#%1$s" class="nav-tab" id="%1$s-tab">%2$s</a>', $tab['id'], $tab['title'] );
}
$html .= '</h2>';
echo $html;
}
/**
* Show the section settings forms
*
* This function displays every sections in a different form
*/
function show_forms() {
?>
<div class="metabox-holder">
<?php foreach ( $this->settings_sections as $form ) { ?>
<div id="<?php echo $form['id']; ?>" class="group" style="display: none;">
<form method="post" action="options.php">
<?php
do_action( 'wsa_form_top_' . $form['id'], $form );
settings_fields( $form['id'] );
do_settings_sections( $form['id'] );
do_action( 'wsa_form_bottom_' . $form['id'], $form );
if ( isset( $this->settings_fields[ $form['id'] ] ) ) {
submit_button();
}
?>
</form>
</div>
<?php } ?>
</div>
<?php
$this->script();
}
/**
* Tabbable JavaScript codes & Initiate Color Picker
*
* This code uses localstorage for displaying active tabs
*/
function script() {
?>
<script>
jQuery(document).ready(function($) {
//Initiate Color Picker
$('.wp-color-picker-field').wpColorPicker();
// Switches option sections
$('.group').hide();
var activetab = '';
if (typeof(localStorage) != 'undefined' ) {
activetab = localStorage.getItem("activetab");
}
//if url has section id as hash then set it as active or override the current local storage value
if(window.location.hash){
activetab = window.location.hash;
if (typeof(localStorage) != 'undefined' ) {
localStorage.setItem("activetab", activetab);
}
}
if (activetab != '' && $(activetab).length ) {
$(activetab).fadeIn();
} else {
$('.group:first').fadeIn();
}
$('.group .collapsed').each(function(){
$(this).find('input:checked').parent().parent().parent().nextAll().each(
function(){
if ($(this).hasClass('last')) {
$(this).removeClass('hidden');
return false;
}
$(this).filter('.hidden').removeClass('hidden');
});
});
if (activetab != '' && $(activetab + '-tab').length ) {
$(activetab + '-tab').addClass('nav-tab-active');
}
else {
$('.nav-tab-wrapper a:first').addClass('nav-tab-active');
}
$('.nav-tab-wrapper a').click(function(evt) {
$('.nav-tab-wrapper a').removeClass('nav-tab-active');
$(this).addClass('nav-tab-active').blur();
var clicked_group = $(this).attr('href');
if (typeof(localStorage) != 'undefined' ) {
localStorage.setItem("activetab", $(this).attr('href'));
}
$('.group').hide();
$(clicked_group).fadeIn();
evt.preventDefault();
});
$('.wpsa-browse').on('click', function (event) {
event.preventDefault();
var self = $(this);
// Create the media frame.
var file_frame = wp.media.frames.file_frame = wp.media({
title: self.data('uploader_title'),
button: {
text: self.data('uploader_button_text'),
},
multiple: false
});
file_frame.on('select', function () {
attachment = file_frame.state().get('selection').first().toJSON();
self.prev('.wpsa-url').val(attachment.url).change();
});
// Finally, open the modal
file_frame.open();
});
});
</script>
<?php
$this->_style_fix();
}
function _style_fix() {
global $wp_version;
if (version_compare($wp_version, '3.8', '<=')):
?>
<style type="text/css">
/** WordPress 3.8 Fix **/
.form-table th { padding: 20px 10px; }
#wpbody-content .metabox-holder { padding-top: 5px; }
</style>
<?php
endif;
}
}
}

View File

@@ -0,0 +1 @@
<?php // Silence is golden, some servers are configured to show all the folders if there is no index file aka directory listings. This is to prevent that, security through obscurity.

View File

@@ -0,0 +1,693 @@
<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
* @wordpress-plugin
* Plugin Name: jQuery Manager for WordPress
* Plugin URI: https://github.com/Remzi1993/jquery-manager
* Description: Manage jQuery and jQuery Migrate, activate a specific jQuery and/or jQuery Migrate version. The ultimate jQuery debugging tool for WordPress. This plugin is an open source project, made possible by your contribution (code). Development is done on GitHub.
* Version: 1.10.6
* Author: Remzi Cavdar
* Author URI: https://twitter.com/remzicavdar
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl-3.0
* Text Domain: jquery-manager
* Domain Path: /languages
*/
// If this file is called directly, abort.
defined('ABSPATH') or exit();
if ( defined('WP_CLI') && WP_CLI ) {
$_SERVER['HTTP_HOST'] = 'localhost';
}
// Config - CONSTANTS
// http://php.net/manual/en/dir.constants.php & https://www.quora.com/Should-class-constants-be-all-uppercase-in-PHP
define( 'WP_JQUERY_MANAGER_PLUGIN_DIR_PATH', str_replace( "\\", "/", plugin_dir_path(__FILE__) ) );
define( 'WP_JQUERY_MANAGER_PLUGIN_DIR_URL', plugin_dir_url( __FILE__ ) );
define( 'WP_JQUERY_MANAGER_PLUGIN_SLUG', 'wp-jquery-manager-plugin-settings' );
define( 'WP_JQUERY_MANAGER_PLUGIN_ADMIN_URL', admin_url( 'tools.php?page=' . WP_JQUERY_MANAGER_PLUGIN_SLUG ) );
define( 'WP_JQUERY_MANAGER_PLUGIN_TEXT_DOMAIN', 'jquery-manager' );
define( 'WP_JQUERY_MANAGER_PLUGIN_SITE_URL', get_site_url() );
define( 'WP_JQUERY_MANAGER_PLUGIN_DOMAIN_NAME', $_SERVER['HTTP_HOST'] );
// jQuery versions, don't forget to update the files! .js and .min.js are automatically added accordingly at the end of the name/file.
define( 'WP_JQUERY_MANAGER_PLUGIN_JQUERY_3X', 'jquery-3.5.1' );
define( 'WP_JQUERY_MANAGER_PLUGIN_JQUERY_3X_SLIM', 'jquery-3.5.1.slim' );
define( 'WP_JQUERY_MANAGER_PLUGIN_JQUERY_2X', 'jquery-2.2.4' );
define( 'WP_JQUERY_MANAGER_PLUGIN_JQUERY_1X', 'jquery-1.12.4' );
// jQuery Migrate versions, don't forget to update your files! .js and .min.js are automatically added accordingly at the end of the name/file.
define( 'WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_3X', 'jquery-migrate-3.3.0' );
define( 'WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_1X', 'jquery-migrate-1.4.1' );
// Settings
$wp_jquery_manager_plugin_jquery_settings = (array) get_option( 'wp_jquery_manager_plugin_jquery_settings' );
$wp_jquery_manager_plugin_jquery_migrate_settings = (array) get_option( 'wp_jquery_manager_plugin_jquery_migrate_settings' );
// Include weDevs Settings API wrapper class
require WP_JQUERY_MANAGER_PLUGIN_DIR_PATH . 'inc/settings-api.php';
// All filters
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'wp_jquery_manager_plugin_add_action_links' );
add_filter( 'autoptimize_filter_js_dontmove', array( 'wp_jquery_manager_plugin', 'autoptimize_support' ) );
add_filter( 'script_loader_tag', 'wp_jquery_manager_plugin_add_attribute', 10, 2 );
// All actions
add_action( 'admin_init', array( 'PAnD', 'init' ) );
add_action( 'admin_notices', 'wp_jquery_manager_plugin_admin_notice' );
// Add settings link to our plugin section on the plugin list page
function wp_jquery_manager_plugin_add_action_links ( $links ) {
$plugin_links = array(
'<a href="' . WP_JQUERY_MANAGER_PLUGIN_ADMIN_URL . '">Settings</a>',
);
return array_merge( $links, $plugin_links );
}
// Activation process
register_activation_hook( __FILE__, 'wp_jquery_manager_plugin_activation' );
function wp_jquery_manager_plugin_activation() {
if ( ! current_user_can( 'activate_plugins' ) ) {
exit;
}
global $wp_version;
$php = '5.6';
$wp = '4.9';
if ( version_compare( PHP_VERSION, $php, '<' ) || version_compare( $wp_version, $wp, '<' ) ) {
deactivate_plugins( basename( __FILE__ ) );
wp_die(
'<p>' .
sprintf(
__( 'This plugin can not be activated because either your WordPress instalation has an outdated/unsuported PHP version or you are using an outdated/old WordPress version.<br><br>This plugin requires a minimum of <strong>PHP 5.6 or greater</strong> and <strong>WordPress 4.9 or greater</strong>.<br><br> Your install:<br><strong>PHP: ' . PHP_VERSION . '</strong><br><strong>WordPress: ' . $wp_version . '</strong><br><br>You need to update either one of them or both, before you are able to activate and use this plugin.<br>- <a href="https://wordpress.org/support/update-php/" target="_blank" rel="noopener noreferrer">Learn more about updating PHP</a><br>- <a href="https://wordpress.org/support/article/updating-wordpress/" target="_blank" rel="noopener noreferrer">Learn more about updating WordPress</a>', 'wp_jquery_manager_plugin' ),
$php
)
. '</p> <a href="' . admin_url( 'plugins.php' ) . '">' . __( 'go back', 'wp_jquery_manager_plugin' ) . '</a>'
);
}
}
// Initial admin notice for new users of this plugin
require WP_JQUERY_MANAGER_PLUGIN_DIR_PATH . 'vendor/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php';
function wp_jquery_manager_plugin_admin_notice() {
if ( ! PAnD::is_admin_notice_active( 'disable-done-notice-forever' ) ) {
return;
}
?>
<div data-dismissible="disable-done-notice-forever" class="updated notice notice-success is-dismissible">
<p><?php _e( '<strong style="font-size: 21px;">Thank you for using jQuery Manager 👍</strong> <span style="margin-right: 10px;font-size: 18px;">This plugin is brand new, it could use some attention. Please leave a review 😉</span><a href="https://wordpress.org/support/plugin/jquery-manager/reviews/#new-post" class="button secondary" target="_blank" rel="noopener noreferrer">Add your review</a>', WP_JQUERY_MANAGER_PLUGIN_TEXT_DOMAIN ); ?></p>
</div>
<?php
}
/**
* Load plugin textdomain.
* This feature is not stable, so it is commented out.
*/
// function wp_jquery_manager_plugin_load_textdomain() {
// load_plugin_textdomain( WP_JQUERY_MANAGER_PLUGIN_TEXT_DOMAIN, false, WP_JQUERY_MANAGER_PLUGIN_DIR_PATH . 'languages' );
// }
// add_action( 'init', 'wp_jquery_manager_plugin_load_textdomain' );
// Our plugin class
if ( !class_exists( 'wp_jquery_manager_plugin' ) ) {
class wp_jquery_manager_plugin {
private $settings_api;
public $text_domain;
public $title;
public $capability;
public $slug;
public function __construct() {
// Using the weDevs WordPress Settings API wrapper class
$this->settings_api = new WeDevs_Settings_API;
// Plugin text domain
$this->text_domain = WP_JQUERY_MANAGER_PLUGIN_TEXT_DOMAIN;
// Plugin menu title and settings
$this->title = 'jQuery Manager';
$this->capability = 'administrator';
$this->slug = WP_JQUERY_MANAGER_PLUGIN_SLUG;
add_action( 'admin_init', array( $this, 'admin_init' ) );
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
}
public function admin_init() {
// set the settings
$this->settings_api->set_sections( $this->get_settings_sections() );
$this->settings_api->set_fields( $this->get_settings_fields() );
// initialize settings
$this->settings_api->admin_init();
}
public function admin_menu() {
$page_title = $this->title;
$menu_title = $this->title;
$capability = $this->capability;
$menu_slug = $this->slug;
$function = array( $this, 'plugin_settings_page' );
add_management_page( $page_title, $menu_title, $capability, $menu_slug, $function );
}
public function autoptimize_support( $dontmove_array ) {
$dontmove_array[] = '/jquery-manager/assets/js';
return $dontmove_array;
}
public function get_settings_sections() {
$sections = array(
array(
'id' => 'wp_jquery_manager_plugin_jquery_settings',
'title' => __( 'jQuery settings', $this->text_domain )
),
array(
'id' => 'wp_jquery_manager_plugin_jquery_migrate_settings',
'title' => __( 'jQuery Migrate settings', $this->text_domain )
)
);
return $sections;
}
/**
* Returns all the settings fields
*
* @return array settings fields
*/
public function get_settings_fields() {
$jquery_3x = WP_JQUERY_MANAGER_PLUGIN_JQUERY_3X;
$jquery_3x_slim = WP_JQUERY_MANAGER_PLUGIN_JQUERY_3X_SLIM;
$jquery_2x = WP_JQUERY_MANAGER_PLUGIN_JQUERY_2X;
$jquery_1x = WP_JQUERY_MANAGER_PLUGIN_JQUERY_1X;
$jquery_migrate_3x = WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_3X;
$jquery_migrate_1x = WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_1X;
$settings_fields = array(
// jQuery settings
'wp_jquery_manager_plugin_jquery_settings' => array(
array(
'name' => 'jquery',
'label' => __( 'jQuery', $this->text_domain ),
'desc' => __( 'On / Off', $this->text_domain ),
'default' => 'on',
'type' => 'checkbox'
),
array(
'name' => 'jquery_version',
'label' => __( 'jQuery version', $this->text_domain ),
'desc' => __( 'Select a particular jQuery version', $this->text_domain ),
'type' => 'select',
'default' => 'jquery_3x_min',
'options' => array(
'jquery_3x_min' => $jquery_3x . '.min.js (default)',
'jquery_3x' => $jquery_3x . '.js',
'jquery_3x_slim_min' => $jquery_3x_slim . '.min.js',
'jquery_3x_slim' => $jquery_3x_slim . '.js',
'jquery_2x_min' => $jquery_2x . '.min.js',
'jquery_2x' => $jquery_2x . '.js',
'jquery_1x_min' => $jquery_1x . '.min.js',
'jquery_1x' => $jquery_1x . '.js'
)
),
array(
'name' => 'jquery_execution',
'label' => __( 'jQuery execution', $this->text_domain ),
'desc' => __( 'Experimental! Some plugins and/or themes may not support this. <strong>Broken for now, does nothing.</strong> See: https://github.com/Remzi1993/jquery-manager/issues/8', $this->text_domain ),
'type' => 'radio',
'default' => 'default',
'options' => array(
'default' => 'Default / Normal',
'async' => 'Async',
'defer' => 'Defer'
)
),
array(
'name' => 'debug_mode',
'label' => __( 'Debug mode', $this->text_domain ),
'desc' => __( 'On / Off', $this->text_domain ),
'default' => 'off',
'type' => 'checkbox'
)
), // End jQuery settings
// jQuery Migrate settings
'wp_jquery_manager_plugin_jquery_migrate_settings' => array(
array(
'name' => 'jquery_migrate',
'label' => __( 'jQuery Migrate', $this->text_domain ),
'desc' => __( 'On / Off', $this->text_domain ),
'default' => 'on',
'type' => 'checkbox'
),
array(
'name' => 'jquery_migrate_version',
'label' => __( 'jQuery Migrate version', $this->text_domain ),
'desc' => __( 'Select a particular jQuery Migrate version', $this->text_domain ),
'type' => 'select',
'default' => 'jquery_migrate_3x_min',
'options' => array(
'jquery_migrate_3x_min' => $jquery_migrate_3x . '.min.js (default)',
'jquery_migrate_3x' => $jquery_migrate_3x . '.js',
'jquery_migrate_1x_min' => $jquery_migrate_1x . '.min.js',
'jquery_migrate_1x' => $jquery_migrate_1x . '.js'
)
),
array(
'name' => 'jquery_migrate_head_body',
'label' => __( 'jQuery Migrate code', $this->text_domain ),
'desc' => __( 'Choose where to put jQuery Migrate in the <strong>&lt;head&gt;</strong> or at the end of the <strong>&lt;body&gt;</strong> tag, just before it closes', $this->text_domain ),
'type' => 'radio',
'default' => 'head',
'options' => array(
'head' => '&lt;head&gt; (default)',
'body' => '&lt;body&gt;'
)
),
array(
'name' => 'jquery_migrate_execution',
'label' => __( 'jQuery Migrate execution', $this->text_domain ),
'desc' => __( 'Experimental! Some plugins and/or themes do not support this. <strong>Broken for now, does nothing.</strong> See: https://github.com/Remzi1993/jquery-manager/issues/8', $this->text_domain ),
'type' => 'radio',
'default' => 'default',
'options' => array(
'default' => 'Default / Normal',
'async' => 'Async',
'defer' => 'Defer'
)
)
) // End jQuery Migrate settings
); // End $settings_fields
return $settings_fields;
}
public function plugin_settings_page() {
$jquery_options = $GLOBALS['wp_jquery_manager_plugin_jquery_settings'];
$jquery_migrate_options = $GLOBALS['wp_jquery_manager_plugin_jquery_migrate_settings'];
// Get jQuery version
if ( isset( $jquery_options['jquery_version'] ) ) {
switch ( $jquery_options['jquery_version'] ) {
case 'jquery_3x_min':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_3X . '.min.js';
break;
case 'jquery_3x':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_3X . '.js';
break;
case 'jquery_3x_slim_min':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_3X_SLIM . '.min.js';
break;
case 'jquery_3x_slim':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_3X_SLIM . '.js';
break;
case 'jquery_2x_min':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_2X . '.min.js';
break;
case 'jquery_2x':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_2X . '.js';
break;
case 'jquery_1x_min':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_1X . '.min.js';
break;
case 'jquery_1x':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_1X . '.js';
break;
} // End switch case
}
// Get jQuery Migrate version
if ( isset( $jquery_migrate_options['jquery_migrate_version'] ) ) {
switch ( $jquery_migrate_options['jquery_migrate_version'] ) {
case 'jquery_migrate_3x':
$jquery_migrate_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_3X . '.js';
break;
case 'jquery_migrate_3x_min':
$jquery_migrate_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_3X . '.min.js';
break;
case 'jquery_migrate_1x':
$jquery_migrate_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_1X . '.js';
break;
case 'jquery_migrate_1x_min':
$jquery_migrate_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_1X . '.min.js';
break;
} // End switch case
}
// For debugging
if ( isset( $jquery_options['debug_mode'] ) ) {
if ( $jquery_options['debug_mode'] == 'on' ) {
echo '<h1>Debug information</h1>';
echo '<p>';
echo '<span><strong>Plugin directory:</strong> ' . WP_JQUERY_MANAGER_PLUGIN_DIR_PATH . '</span><br>';
echo '<span><strong>Plugin URL:</strong> ' . WP_JQUERY_MANAGER_PLUGIN_DIR_URL . '</span><br>';
echo '<span><strong>Plugin admin URL:</strong> ' . WP_JQUERY_MANAGER_PLUGIN_ADMIN_URL . '</span>';
echo '</p>';
echo '<p>';
echo '<span><strong>Domain name:</strong> ' . WP_JQUERY_MANAGER_PLUGIN_DOMAIN_NAME . '</span><br>';
echo '<span><strong>URL:</strong> ' . WP_JQUERY_MANAGER_PLUGIN_SITE_URL . '</span>';
echo '</p>';
echo '<p>';
if ( $jquery_options['jquery'] == 'off' ) {
echo '<span><strong>jQuery:</strong> disabled</span><br>';
}
else {
echo '<span><strong>jQuery:</strong> ' . $jquery_version . '</span><br>';
}
if ( !isset( $jquery_migrate_options['jquery_migrate'] ) ) {
echo '<strong>jQuery Migrate:</strong> ' . WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_3X . '.min.js';
}
elseif ( $jquery_migrate_options['jquery_migrate'] == 'off' ) {
echo '<span><strong>jQuery Migrate:</strong> disabled</span><br>';
}
else {
echo '<strong>jQuery Migrate:</strong> ' . $jquery_migrate_version;
}
echo '</p>';
}
}
// Plugin settings
echo '<div class="wrap">';
settings_errors();
$this->settings_api->show_navigation();
$this->settings_api->show_forms();
echo '</div>';
}
/**
* Get all the pages
*
* @return array page names with key value pairs
*/
public function get_pages() {
$pages = get_pages();
$pages_options = array();
if ( $pages ) {
foreach ($pages as $page) {
$pages_options[$page->ID] = $page->post_title;
}
}
return $pages_options;
}
} // End wp_jquery_manager_plugin class
new wp_jquery_manager_plugin();
}
// Front-end not excuted in the wp admin and the wp customizer (for compatibility reasons)
// See: https://core.trac.wordpress.org/ticket/45130 and https://core.trac.wordpress.org/ticket/37110
function wp_jquery_manager_plugin_front_end_scripts() {
$wp_admin = is_admin();
$wp_customizer = is_customize_preview();
$jquery_options = $GLOBALS['wp_jquery_manager_plugin_jquery_settings'];
$jquery_migrate_options = $GLOBALS['wp_jquery_manager_plugin_jquery_migrate_settings'];
// Get jQuery version
if ( isset( $jquery_options['jquery_version'] ) ) {
switch ( $jquery_options['jquery_version'] ) {
case 'jquery_3x_min':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_3X . '.min.js';
break;
case 'jquery_3x':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_3X . '.js';
break;
case 'jquery_3x_slim_min':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_3X_SLIM . '.min.js';
break;
case 'jquery_3x_slim':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_3X_SLIM . '.js';
break;
case 'jquery_2x_min':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_2X . '.min.js';
break;
case 'jquery_2x':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_2X . '.js';
break;
case 'jquery_1x_min':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_1X . '.min.js';
break;
case 'jquery_1x':
$jquery_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_1X . '.js';
break;
} // End switch case
}
// Get jQuery Migrate version
if ( isset( $jquery_migrate_options['jquery_migrate_version'] ) ) {
switch ( $jquery_migrate_options['jquery_migrate_version'] ) {
case 'jquery_migrate_3x':
$jquery_migrate_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_3X . '.js';
break;
case 'jquery_migrate_3x_min':
$jquery_migrate_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_3X . '.min.js';
break;
case 'jquery_migrate_1x':
$jquery_migrate_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_1X . '.js';
break;
case 'jquery_migrate_1x_min':
$jquery_migrate_version = WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_1X . '.min.js';
break;
} // End switch case
}
// Default setting
if ( $wp_admin || $wp_customizer ) {
// echo 'We are in the WP Admin or in the WP Customizer';
return;
}
elseif ( !isset( $jquery_options['jquery'] ) ) { // Default setting
// Removing WP core jQuery, see https://github.com/Remzi1993/jquery-manager/issues/2 and https://github.com/WordPress/WordPress/blob/91da29d9afaa664eb84e1261ebb916b18a362aa9/wp-includes/script-loader.php#L226
wp_dequeue_script( 'jquery' );
wp_deregister_script( 'jquery' );
// Removing WP core jQuery
wp_dequeue_script( 'jquery-core' );
wp_deregister_script( 'jquery-core' );
// Get jQuery version
$jquery = 'assets/js/' . WP_JQUERY_MANAGER_PLUGIN_JQUERY_3X . '.min.js';
// Register jQuery in the head
wp_register_script( 'jquery-core', WP_JQUERY_MANAGER_PLUGIN_DIR_URL . $jquery, array(), null, false );
/**
* Register jquery using jquery-core as a dependency, so other scripts could use the jquery handle
* see https://wordpress.stackexchange.com/questions/283828/wp-register-script-multiple-identifiers
* We first register the script and afther that we enqueue it, see why:
* https://wordpress.stackexchange.com/questions/82490/when-should-i-use-wp-register-script-with-wp-enqueue-script-vs-just-wp-enque
* https://stackoverflow.com/questions/39653993/what-is-diffrence-between-wp-enqueue-script-and-wp-register-script
*/
wp_register_script( 'jquery', false, array( 'jquery-core' ), null, false ); // The jquery handle is an alias to load jquery-core
wp_enqueue_script( 'jquery' );
}
elseif ( $jquery_options['jquery'] == 'on' ) {
// Removing WP core jQuery
wp_dequeue_script( 'jquery' );
wp_deregister_script( 'jquery' );
wp_dequeue_script( 'jquery-core' );
wp_deregister_script( 'jquery-core' );
// Get jQuery version
$jquery = 'assets/js/' . $jquery_version;
// Register jQuery in the head
wp_register_script( 'jquery-core', WP_JQUERY_MANAGER_PLUGIN_DIR_URL . $jquery, array(), null, false );
wp_register_script( 'jquery', false, array( 'jquery-core' ), null, false ); // Alias
wp_enqueue_script( 'jquery' );
}
elseif ( $jquery_options['jquery'] == 'off' ) {
// Removing WP core jQuery
wp_dequeue_script( 'jquery' );
wp_deregister_script( 'jquery' );
wp_dequeue_script( 'jquery-core' );
wp_deregister_script( 'jquery-core' );
} // End jQuery
// jQuery Migrate
if ( $wp_admin || $wp_customizer ) {
// echo 'We are in the WP Admin or in the WP Customizer';
return;
}
elseif ( !isset( $jquery_migrate_options['jquery_migrate'] ) ) { // Default setting
// Removing WP core jQuery Migrate
wp_dequeue_script( 'jquery-migrate' );
wp_deregister_script( 'jquery-migrate' );
// Get jQuery Migrate version
$jquery_migrate = 'assets/js/' . WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_3X . '.min.js';
// Register and than enqueue jQuery Migrate in the head
wp_register_script( 'jquery-migrate', WP_JQUERY_MANAGER_PLUGIN_DIR_URL . $jquery_migrate, array(), null, false );
wp_enqueue_script( 'jquery-migrate' );
}
elseif ( $jquery_migrate_options['jquery_migrate'] == 'on' ) {
// Removing WP core jQuery Migrate
wp_dequeue_script( 'jquery-migrate' );
wp_deregister_script( 'jquery-migrate' );
// Get jQuery Migrate version
$jquery_migrate = 'assets/js/' . $jquery_migrate_version;
// Setting head or body
if ( $jquery_migrate_options['jquery_migrate_head_body'] == 'head' ) {
// Enqueue jQuery Migrate in the head
wp_register_script( 'jquery-migrate', WP_JQUERY_MANAGER_PLUGIN_DIR_URL . $jquery_migrate, array(), null, false );
wp_enqueue_script( 'jquery-migrate' );
}
else {
// Enqueue jQuery Migrate before </body>
wp_register_script( 'jquery-migrate', WP_JQUERY_MANAGER_PLUGIN_DIR_URL . $jquery_migrate, array(), null, true );
wp_enqueue_script( 'jquery-migrate' );
}
}
elseif ( $jquery_migrate_options['jquery_migrate'] == 'off' ) {
// Removing WP core jQuery Migrate
wp_dequeue_script( 'jquery-migrate' );
wp_deregister_script( 'jquery-migrate' );
} // End jQuery Migrate
// When debugging is enabled
if ( $wp_admin || $wp_customizer ) {
return;
}
elseif ( isset( $jquery_options['debug_mode'] ) ) {
if ( $jquery_options['debug_mode'] == 'on' ) {
$margin_j = "margin: 40px 0 0 20px;";
$margin_jm = "margin: 140px 0 0 20px;";
$style_j = "position: fixed; top: 0; left: 0; z-index: 9999; color: black; background: gray; " . $margin_j . " padding: 20px; font-size: 30px;";
$style_jm = "position: fixed; top: 0; left: 0; z-index: 9999; color: black; background: gray; " . $margin_jm . " padding: 20px; font-size: 30px;";
if ( $jquery_options['jquery'] == 'on' ) {
echo '<div style="'. $style_j .'">jQuery version: ' . $jquery_version . '</div>';
}
else {
echo '<div style="'. $style_j .'">jQuery is disabled</div>';
}
if ( !isset( $jquery_migrate_options['jquery_migrate'] ) ) {
echo '<div style="'. $style_jm .'">jQuery Migrate version: ' . WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_3X . '.min.js</div>';
}
elseif ( $jquery_migrate_options['jquery_migrate'] == 'on' ) {
echo '<div style="'. $style_jm .'">jQuery Migrate version: ' . $jquery_migrate_version . '</div>';
}
else {
echo '<div style="'. $style_jm .'">jQuery Migrate is disabled</div>';
}
if ( $jquery_options['jquery'] == 'off' && $jquery_migrate_options['jquery_migrate'] == 'off' ) {
echo '<div style="'. $style_j .'">jQuery and jQuery Migrate are both disabled</div>';
}
}
}
} // End function wp_jquery_manager_plugin_front_end_scripts
// Back end specific CSS
// Load only on tools.php?page=wp-jquery-manager-plugin-settings (plugin settings)
function wp_jquery_manager_plugin_admin_scripts($hook) {
if( $hook != 'tools_page_' . WP_JQUERY_MANAGER_PLUGIN_SLUG ) {
return;
}
wp_enqueue_style( 'wp-jquery-manager-plugin-admin', WP_JQUERY_MANAGER_PLUGIN_DIR_URL . 'assets/css/admin.css', array(), null );
}
// Register styles and scripts
add_action( 'wp_enqueue_scripts', 'wp_jquery_manager_plugin_front_end_scripts', 1 );
add_action( 'login_enqueue_scripts', 'wp_jquery_manager_plugin_front_end_scripts', 1 );
add_action( 'admin_enqueue_scripts', 'wp_jquery_manager_plugin_admin_scripts' );
// Defer and/or async jQuery and/or jQuery Migrate
function wp_jquery_manager_plugin_add_attribute( $tag, $handle ) {
if ( is_admin() || is_customize_preview() ) {
return $tag;
}
elseif ( !isset( $jquery_options['jquery_execution'] ) && !isset( $jquery_migrate_options['jquery_migrate_execution'] ) ) { // No settings, default. Exit and stop wasting time :)
return $tag;
}
$jquery_options = $GLOBALS['wp_jquery_manager_plugin_jquery_settings'];
$jquery_migrate_options = $GLOBALS['wp_jquery_manager_plugin_jquery_migrate_settings'];
if ( isset( $jquery_options['jquery_execution'] ) ) {
switch ( $jquery_options['jquery_execution'] ) {
case 'async':
if ( 'jquery' === $handle ) {
return str_replace( "src", "async src", $tag );
}
break;
case 'defer':
if ( 'jquery' === $handle ) {
return str_replace( "src", "defer src", $tag );
}
break;
}
}
if ( isset( $jquery_migrate_options['jquery_migrate_execution'] ) ) {
switch ( $jquery_migrate_options['jquery_migrate_execution'] ) {
case 'async':
if ( 'jquery-migrate' === $handle ) {
return str_replace( "src", "async src", $tag );
}
break;
case 'defer':
if ( 'jquery-migrate' === $handle ) {
return str_replace( "src", "defer src", $tag );
}
break;
}
}
return $tag;
}
// Deactivation
register_deactivation_hook( __FILE__, 'wp_jquery_manager_plugin_deactivation' );
function wp_jquery_manager_plugin_deactivation() {
delete_option( 'wp_jquery_manager_plugin_jquery_settings' );
delete_option( 'wp_jquery_manager_plugin_jquery_migrate_settings' );
}

View File

@@ -0,0 +1,32 @@
{
"name": "jquery-manager",
"version": "1.10.6",
"description": "Manage jQuery and jQuery Migrate on a WordPress website, select a specific jQuery and/or jQuery Migrate version. The ultimate jQuery debugging tool for WordPress. This plugin is a open source project, made possible by your contribution (code). Development is done on GitHub.",
"main": "jquery-manager.php",
"directories": {
"test": "tests"
},
"dependencies": {
"collizo4sky/persist-admin-notices-dismissal": "^1.4.3",
"tareq1988/wordpress-settings-api-class": "^1.2",
"pull": "^2.1.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Remzi1993/jquery-manager.git"
},
"keywords": [
"wordpress",
"wordpress plugin",
"jquery"
],
"author": "Remzi Cavdar <ict@remzi.info> (https://twitter.com/remzicavdar)",
"license": "GPL-3.0",
"bugs": {
"url": "https://github.com/Remzi1993/jquery-manager/issues"
},
"homepage": "https://github.com/Remzi1993/jquery-manager"
}

View File

@@ -0,0 +1,91 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Example Project" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<description>A custom set of rules to check for a WPized WordPress project</description>
<!-- Exclude WP Core folders and files from being checked. -->
<exclude-pattern>/docroot/wp-admin/*</exclude-pattern>
<exclude-pattern>/docroot/wp-includes/*</exclude-pattern>
<exclude-pattern>/docroot/wp-*.php</exclude-pattern>
<exclude-pattern>/docroot/index.php</exclude-pattern>
<exclude-pattern>/docroot/xmlrpc.php</exclude-pattern>
<exclude-pattern>/docroot/wp-content/plugins/*</exclude-pattern>
<!-- Exclude the Composer Vendor directory. -->
<exclude-pattern>/vendor/*</exclude-pattern>
<!-- Exclude the Node Modules directory. -->
<exclude-pattern>/node_modules/*</exclude-pattern>
<!-- Exclude minified Javascript files. -->
<exclude-pattern>*.min.js</exclude-pattern>
<!-- Include the WordPress-Extra standard. -->
<rule ref="WordPress-Extra">
<!--
We may want a middle ground though. The best way to do this is add the
entire ruleset, then rule by rule, remove ones that don't suit a project.
We can do this by running `phpcs` with the '-s' flag, which allows us to
see the names of the sniffs reporting errors.
Once we know the sniff names, we can opt to exclude sniffs which don't
suit our project like so.
The below two examples just show how you can exclude rules.
They are not intended as advice about which sniffs to exclude.
-->
<!--
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing"/>
<exclude name="WordPress.Security.EscapeOutput"/>
-->
</rule>
<!-- Let's also check that everything is properly documented. -->
<rule ref="WordPress-Docs"/>
<!-- Add in some extra rules from other standards. -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
<rule ref="Generic.Commenting.Todo"/>
<!-- Check for PHP cross-version compatibility. -->
<!--
To enable this, the PHPCompatibilityWP standard needs
to be installed.
See the readme for installation instructions:
https://github.com/PHPCompatibility/PHPCompatibilityWP
For more information, also see:
https://github.com/PHPCompatibility/PHPCompatibility
-->
<!--
<config name="testVersion" value="5.2-"/>
<rule ref="PHPCompatibilityWP"/>
-->
<!--
To get the optimal benefits of using WPCS, we should add a couple of
custom properties.
Adjust the values of these properties to fit our needs.
For information on additional custom properties available, check out
the wiki:
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
-->
<config name="minimum_supported_wp_version" value="4.9"/>
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="jquery-manager"/>
</property>
</properties>
</rule>
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="wp_jquery_manager"/>
</property>
</properties>
</rule>
</ruleset>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<phpunit
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
>
<testsuites>
<testsuite>
<directory prefix="test-" suffix=".php">./tests/</directory>
<exclude>./tests/test-sample.php</exclude>
</testsuite>
</testsuites>
</phpunit>

View File

@@ -0,0 +1,125 @@
=== jQuery Manager for WordPress ===
Contributors: remzicavdar
Tags: jquery, jquery manager, jquery updater, jquery migrate, jquery update, remove jquery migrate, javascript, jquery ui, update, jquery update, jquery wordpress, jquery wordpress updater, manage jquery, jquery settings, jquery tool, jquery debugger, debug
Requires at least: 4.9
Tested up to: 5.5
Requires PHP: 5.6
Stable tag: trunk
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0
Manage jQuery and jQuery Migrate, activate a specific jQuery and/or jQuery Migrate version. The ultimate jQuery debugging tool for WordPress. This plugin is an open source project, made possible by your contribution (code). Development is done on GitHub.
== Description ==
Manage [jQuery](https://jquery.com) and [jQuery Migrate](https://jquery.com/download/#jquery-migrate-plugin) on a WordPress website, activate a specific jQuery and/or jQuery Migrate version. The ultimate jQuery debugging tool for WordPress
**TLDR:** Update jQuery / Remove jQuery Migrate / jQuery Updater and get notified of a jQuery update / manage jQuery
### Features ###
* **Remove jQuery Migrate** - if you use plugins which are updated regularly, then you can probably disable / remove jQuery Migrate.
* **jQuery Updater** - If this plugin is installed and activated, jQuery will be updated when you update this plugin
* **Select jQuery (Migrate) version** — Activate / select a specific version of jQuery and/or jQuery Migrate.
* **Debug mode** - Debug mode for developers
* **Active support** - Active support through [WordPress support forum](https://wordpress.org/support/plugin/jquery-manager/) and [GitHub issues page](https://github.com/Remzi1993/jquery-manager/issues)
Note that jQuery Manager requires PHP 5.6+ to run.
When the plugin is activated the latest stable version of jQuery and jQuery Migrate are added to your website. The default is sufficient for most people, however the settings provide a way for you to tweak your jQuery install.
jQuery Manager for WordPress is an open source project and I would like to invite anyone to contribute. The development and issue tracker is located on GitHub, see: [https://github.com/Remzi1993/jquery-manager](https://github.com/Remzi1993/jquery-manager)
### jQuery Updater - checks jQuery version ###
This plugin is especially designed to update and keep track of jQuery. When a new version of jQuery is released we update the plugin.
Updating the plugin will updates the jQuery version activated. Updates will be periodic, we also do (small) optimizations to our plugin from time to time.
Keep the plugin activated if you want to be alerted for any jQuery updates.
### Also a Developer / Debugging tool ###
Everything should work as intended, you should check your website if everything works fine. If things don't work, don't panic. You can deactivate the plugin and return to the state before or tweak it's settings until everything works as intended.
You should understand that not all themes and/or plugins support the latest jQuery version even with jQuery Migrate turned on, but for you to encounter this is highly unlikely if your theme or plugins are up to date.
This is also a developer/debugging tool.
I will not provide support on debugging your own JavaScript and/or jQuery code. (Only if you like to hire me, of course)
### Reporting problems ###
Report bugs, issues, questions and/or feature request on our [GitHub issues page](https://github.com/Remzi1993/jquery-manager/issues).
I will only provide support on issues caused by this plugin, not your own JavaScript and/or jQuery code. (Again, I will provide paid support or fix all your issues if you're willing to hire me to debug and/or optimize your website)
If you run into any bugs, turning this plugin off (by deactivation the plugin) will fully deactivate everything and return your website to it`s original state.
== Installation ==
Manual installation by uploading .zip file via WordPress admin
1. Navigate to > `Plugins` > `Add New`
2. On your top left > click on `Upload Plugin` and select your .zip file you downloaded from [wordpress.org](https://wordpress.org/plugins/jquery-manager/) and click `Install Now`
3. By activating the plugin, jQuery and jQuery Migrate are updated to the latest stable version. (Plugin settings are located under `Tools`)
Manual installation by uploading folder/directory via FTP, SFTP or SSH
1. Unzip (extract/unpack/uncompress) the .zip file you downloaded from [wordpress.org](https://wordpress.org/plugins/jquery-manager/)
2. Upload the folder `jquery-manager` to the `/wp-content/plugins/` directory on your server
3. Activate the plugin through the 'Plugins' menu in WordPress
4. By activating the plugin, jQuery and jQuery Migrate are updated to the latest stable version. (Plugin settings are located under `Tools`)
== Frequently Asked Questions ==
= Is this plugin compatible with PHP 5.6, 7, 7.1, 7.2, HHVM, et cetera, et cetera? =
Short answer: probably. Long answer: I honestly don't know for sure. As far as I know I didn't use specific PHP 7 features. I made a simple plugin. That's why I recommend a minimum of PHP 5.6. Also I do specific tests to ensure that I stay compatible with PHP 5.6
= This plugin breaks my site! How do I fix it? =
Deactivate the plugin and report this on the [plugin support forum](https://wordpress.org/support/plugin/jquery-manager/) or report it on the [GitHub project page](https://github.com/Remzi1993/jquery-manager/issues), so that I could take a look into the matter.
= Does this plugin modify my WP installation? =
**No** modification to the WordPress installation is made, therefore deactivation and/or uninstallation of this plugin returns your site to it`s original state.
= Which jQuery (Migrate) version do you support? =
This plugin supports the 3 jQuery branches/versions and 2 versions of jQuery Migrate. You're able to select/activate a specific version or to disable it/turn it off completely<br>
There are two versions of jQuery Migrate. jQuery Migrate 1.x will help you update your pre-1.9 jQuery code to jQuery 1.9 up to 3.0.
jQuery Migrate 3.x helps you update code to run on jQuery 3.0 or higher. Most websites need jQuery Migrate 3.x, but if you have a modern/well supported WP theme and/or plugin(s) than you could give it a try to disable it. Check your browser dev tools if you see any errors.
**jQuery versions**
jQuery 3.x (default is compressed/minified production)
jQuery 2.x
jQuery 1.x
**jQuery Migrate versions**
jQuery Migrate 3.x (default is compressed/minified production)
jQuery Migrate 1.x
= Is it possible to disable jQuery Migrate? =
Yes, this is possible and done in the plugin settings.
= Is it possible to enable a specific version of jQuery (Migrate) =
Yes, this is possible and done in the plugin settings.
= What is jQuery Migrate? =
The jQuery Migrate plugin was created to simplify the transition from older versions of jQuery. The plugin restores deprecated features and behaviors so that older code will still run properly on newer versions of jQuery.
Use the uncompressed development version to diagnose compatibility issues, it will generate warnings on the console that you can use to identify and fix problems. Use the compressed production version to simply fix compatibility issues without generating console warnings.
There are two versions of jQuery Migrate. jQuery Migrate 1.x will help you update your pre-1.9 jQuery code to jQuery 1.9 up to 3.0.
jQuery Migrate 3.x helps you update code to run on jQuery 3.0 or higher.
= How does the jQuery Updater work? =
We update the plugin if a new version of jQuery is released. If you update the plugin, all jQuery versions will be updated.
== Screenshots ==
1. jQuery settings: enable / disable jQuery, select version and etc
2. jQuery Migrate settings: enable / disable jQuery Migrate, select version and etc
== Changelog ==
See changelog on the [GitHub project page](https://github.com/Remzi1993/jquery-manager/releases)
== Upgrade Notice ==
See changelog on the [GitHub project page](https://github.com/Remzi1993/jquery-manager/releases)
== Translations ==
This plugin is not ready for translation. Plugin Internationalization (i18n) will eventually happen, see: [https://github.com/Remzi1993/jquery-manager/issues/14](https://github.com/Remzi1993/jquery-manager/issues/14)
== Additional Info ==
**Idea Behind / Philosophy:** It began as a plugin internally at our company, we would uses jQuery Updater plugin and this plugin was buggy and slow. That's why we decided to fork this plugin and create our own WP plugin.
I think this plugin solves a major shortcoming in WordPress and gives you finite control over jQuery (giving you control which version you want to use).

View File

@@ -0,0 +1,5 @@
{
"extends": [
"config:base"
]
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* PHPUnit bootstrap file
*
* @package Jquery_Manager
*/
$_tests_dir = getenv( 'WP_TESTS_DIR' );
if ( ! $_tests_dir ) {
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
}
if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; // WPCS: XSS ok.
exit( 1 );
}
// Give access to tests_add_filter() function.
require_once $_tests_dir . '/includes/functions.php';
/**
* Manually load the plugin being tested.
*/
function _manually_load_plugin() {
require dirname( dirname( __FILE__ ) ) . '/jquery-manager.php';
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
// Start up the WP testing environment.
require $_tests_dir . '/includes/bootstrap.php';

View File

@@ -0,0 +1,4 @@
<?php
// Only possible in PHP 7
define( 'WP_JQUERY_MANAGER_PLUGIN_JQUERY_SETTINGS', (array) get_option( 'wp_jquery_manager_plugin_jquery_settings' ) );
define( 'WP_JQUERY_MANAGER_PLUGIN_JQUERY_MIGRATE_SETTINGS', (array) get_option( 'wp_jquery_manager_plugin_jquery_migrate_settings' ) );

View File

@@ -0,0 +1,20 @@
<?php
/**
* Class SampleTest
*
* @package Jquery_Manager
*/
/**
* Sample test case.
*/
class SampleTest extends WP_UnitTestCase {
/**
* A single example test.
*/
public function test_sample() {
// Replace this with some actual testing code.
$this->assertTrue( true );
}
}

View File

@@ -0,0 +1,11 @@
<?php
// If uninstall not called from WordPress, then exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
// Deleting plugin options
delete_option( 'wp_jquery_manager_plugin_jquery_settings' );
delete_option( 'wp_jquery_manager_plugin_jquery_migrate_settings' );
delete_option( 'external_updates-wp_jquery_manager_plugin' );

View File

@@ -0,0 +1,18 @@
#### 1.4.3
* added filter hook `pand_dismiss_notice_js_url` in case you're using this in a theme or a local environment that doesn't quite find the correct URL.
* added filter hook `pand_theme_loader` that returns a boolean for simpler usage of the `pand_dismiss_notice_js_url` hook
#### 1.4.2
* No changes to `class PAnD`
* updated `.gitignore` and `.gitattributes`
* now use classmap in composer's autoloader, should be more efficient
#### 1.4.1
* fixed the `forever` setting with options
#### 1.4.0
* WPCS 1.1.0 linting done
* switched from storing timeout in transients to storing in the options table, this should play much better with object caching
#### 1.3.x
* uses transients to store timeout

View File

@@ -0,0 +1,128 @@
# Persist Admin notice Dismissals
[![Latest Stable Version](https://poser.pugx.org/collizo4sky/persist-admin-notices-dismissal/v/stable)](https://packagist.org/packages/collizo4sky/persist-admin-notices-dismissal)
[![Total Downloads](https://poser.pugx.org/collizo4sky/persist-admin-notices-dismissal/downloads)](https://packagist.org/packages/collizo4sky/persist-admin-notices-dismissal)
Simple framework library that persists the dismissal of admin notices across pages in WordPress dashboard.
## Installation
Run `composer require collizo4sky/persist-admin-notices-dismissal`
Alternatively, clone or download this repo into the `vendor/` folder in your plugin, and include/require the `persist-admin-notices-dismissal.php` file like so
```php
require __DIR__ . '/vendor/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php';
add_action( 'admin_init', array( 'PAnD', 'init' ) );
```
or let Composer's autoloader do the work.
## How to Use
Firstly, install and activate this library within a plugin.
Say you have the following markup as your admin notice,
```php
function sample_admin_notice__success() {
?>
<div class="updated notice notice-success is-dismissible">
<p><?php _e( 'Done!', 'sample-text-domain' ); ?></p>
</div>
<?php
}
add_action( 'admin_notices', 'sample_admin_notice__success' );
```
To make it hidden forever when dismissed, add the following data attribute `data-dismissible="disable-done-notice-forever"` to the div markup like so:
```php
function sample_admin_notice__success() {
if ( ! PAnD::is_admin_notice_active( 'disable-done-notice-forever' ) ) {
return;
}
?>
<div data-dismissible="disable-done-notice-forever" class="updated notice notice-success is-dismissible">
<p><?php _e( 'Done!', 'sample-text-domain' ); ?></p>
</div>
<?php
}
add_action( 'admin_init', array( 'PAnD', 'init' ) );
add_action( 'admin_notices', 'sample_admin_notice__success' );
```
## Autoloaders
When using the framework with an autoloader you **must** also load the class outside of the `admin_notices` or `network_admin_notices` hooks. The reason is that these hooks come after the `admin_enqueue_script` hook that loads the javascript.
Just add the following in your main plugin file.
```php
add_action( 'admin_init', array( 'PAnD', 'init' ) );
```
#### Usage Instructions and Examples
If you have two notices displayed when certain actions are triggered; firstly, choose a string to uniquely identify them, e.g. `notice-one` and `notice-two`
To make the first notice never appear once dismissed, its `data-dismissible` attribute will be `data-dismissible="notice-one-forever"` where `notice-one` is its unique identifier and `forever` is the dismissal time period.
To make the second notice only hidden for 2 days, its `data-dismissible` attribute will be `data-dismissible="notice-two-2"` where `notice-two` is its unique identifier and the `2`, the number of days it will be hidden is the dismissal time period.
You **must** append the dismissal time period to the end of your unique identifier with a hyphen (`-`) and this value must be an integer. The only exception is the string `forever`.
To actually make the dismissed admin notice not to appear, use the `is_admin_notice_active()` function like so:
```php
function sample_admin_notice__success1() {
if ( ! PAnD::is_admin_notice_active( 'notice-one-forever' ) ) {
return;
}
?>
<div data-dismissible="notice-one-forever" class="updated notice notice-success is-dismissible">
<p><?php _e( 'Done 1!', 'sample-text-domain' ); ?></p>
</div>
<?php
}
function sample_admin_notice__success2() {
if ( ! PAnD::is_admin_notice_active( 'notice-two-2' ) ) {
return;
}
?>
<div data-dismissible="notice-two-2" class="updated notice notice-success is-dismissible">
<p><?php _e( 'Done 2!', 'sample-text-domain' ); ?></p>
</div>
<?php
}
add_action( 'admin_init', array( 'PAnD', 'init' ) );
add_action( 'admin_notices', 'sample_admin_notice__success1' );
add_action( 'admin_notices', 'sample_admin_notice__success2' );
```
Please note that if you cleanup after your plugin deletion please try to make the removal of stored options as specific as possible. Otherwise you may end up deleting the stored options from other projects.
A filter hook is available to return the proper URL to the Javascript file. An example usage is as follows, especially if this is being used in a theme.
```php
add_filter( 'pand_theme_loader', '__return_true' );
```
The `pand_theme_loader` runs the following hook if `true`. You can directly change the URL to the Javascript file by using another hook in the following manner by changing the return value.
```php
add_filter(
'pand_dismiss_notice_js_url',
function( $js_url, $composer_path ) {
return get_stylesheet_directory_uri() . $composer_path;
},
10,
2
);
```
Cool beans. Isn't it?

View File

@@ -0,0 +1,15 @@
{
"name": "collizo4sky/persist-admin-notices-dismissal",
"description": "Simple library to persist dismissal of admin notices across pages in WordPress dashboard.",
"authors": [
{
"name": "Collins Agbonghama",
"email": "me@w3guy.com"
}
],
"autoload": {
"classmap": [
"persist-admin-notices-dismissal.php"
]
}
}

View File

@@ -0,0 +1,33 @@
(function ($) {
//shorthand for ready event.
$(
function () {
$( 'div[data-dismissible] button.notice-dismiss' ).click(
function (event) {
event.preventDefault();
var $this = $( this );
var attr_value, option_name, dismissible_length, data;
attr_value = $this.parent().attr( 'data-dismissible' ).split( '-' );
// remove the dismissible length from the attribute value and rejoin the array.
dismissible_length = attr_value.pop();
option_name = attr_value.join( '-' );
data = {
'action': 'dismiss_admin_notice',
'option_name': option_name,
'dismissible_length': dismissible_length,
'nonce': dismissible_notice.nonce
};
// We can also pass the url value separately from ajaxurl for front end AJAX implementations
$.post( ajaxurl, data );
}
);
}
)
}(jQuery));

View File

@@ -0,0 +1,190 @@
<?php
/**
* Persist Admin notices Dismissal
*
* Copyright (C) 2016 Collins Agbonghama <http://w3guy.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package Persist Admin notices Dismissal
* @author Collins Agbonghama
* @author Andy Fragen
* @license http://www.gnu.org/licenses GNU General Public License
* @version 1.4.3
*/
/**
* Exit if called directly.
*/
if ( ! defined( 'ABSPATH' ) ) {
die;
}
if ( ! class_exists( 'PAnD' ) ) {
/**
* Class PAnD
*/
class PAnD {
/**
* Init hooks.
*/
public static function init() {
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'load_script' ) );
add_action( 'wp_ajax_dismiss_admin_notice', array( __CLASS__, 'dismiss_admin_notice' ) );
/**
* Filter to activate another filter providing a simpler use case.
*
* @since 1.4.3
*
* @param bool
*/
if ( apply_filters( 'pand_theme_loader', false ) ) {
add_filter(
'pand_dismiss_notice_js_url',
function( $js_url, $composer_path ) {
return get_stylesheet_directory_uri() . $composer_path;
},
10,
2
);
}
}
/**
* Enqueue javascript and variables.
*/
public static function load_script() {
if ( is_customize_preview() ) {
return;
}
$js_url = plugins_url( 'dismiss-notice.js', __FILE__ );
$composer_path = '/vendor/collizo4sky/persist-admin-notices-dismissal/dismiss-notice.js';
/**
* Filter dismiss-notice.js URL.
*
* @since 1.4.3
*
* @param string $js_url URL to the Javascript file.
* @param string $composer_path Relative path of Javascript file from composer install.
*/
$js_url = apply_filters( 'pand_dismiss_notice_js_url', $js_url, $composer_path );
wp_enqueue_script(
'dismissible-notices',
$js_url,
array( 'jquery', 'common' ),
false,
true
);
wp_localize_script(
'dismissible-notices',
'dismissible_notice',
array(
'nonce' => wp_create_nonce( 'dismissible-notice' ),
)
);
}
/**
* Handles Ajax request to persist notices dismissal.
* Uses check_ajax_referer to verify nonce.
*/
public static function dismiss_admin_notice() {
$option_name = sanitize_text_field( $_POST['option_name'] );
$dismissible_length = sanitize_text_field( $_POST['dismissible_length'] );
if ( 'forever' != $dismissible_length ) {
// If $dismissible_length is not an integer default to 1
$dismissible_length = ( 0 == absint( $dismissible_length ) ) ? 1 : $dismissible_length;
$dismissible_length = strtotime( absint( $dismissible_length ) . ' days' );
}
check_ajax_referer( 'dismissible-notice', 'nonce' );
self::set_admin_notice_cache( $option_name, $dismissible_length );
wp_die();
}
/**
* Is admin notice active?
*
* @param string $arg data-dismissible content of notice.
*
* @return bool
*/
public static function is_admin_notice_active( $arg ) {
$array = explode( '-', $arg );
$length = array_pop( $array );
$option_name = implode( '-', $array );
$db_record = self::get_admin_notice_cache( $option_name );
if ( 'forever' == $db_record ) {
return false;
} elseif ( absint( $db_record ) >= time() ) {
return false;
} else {
return true;
}
}
/**
* Returns admin notice cached timeout.
*
* @access public
*
* @param string|bool $id admin notice name or false.
*
* @return array|bool The timeout. False if expired.
*/
public static function get_admin_notice_cache( $id = false ) {
if ( ! $id ) {
return false;
}
$cache_key = 'pand-' . md5( $id );
$timeout = get_site_option( $cache_key );
$timeout = 'forever' === $timeout ? time() + 60 : $timeout;
if ( empty( $timeout ) || time() > $timeout ) {
return false;
}
return $timeout;
}
/**
* Sets admin notice timeout in site option.
*
* @access public
*
* @param string $id Data Identifier.
* @param string|bool $timeout Timeout for admin notice.
*
* @return bool
*/
public static function set_admin_notice_cache( $id, $timeout ) {
$cache_key = 'pand-' . md5( $id );
update_site_option( $cache_key, $timeout );
return true;
}
}
}