first commit

This commit is contained in:
DESKTOP-GBA0BK8\Admin
2023-04-08 12:19:53 -04:00
commit 7c8c8b1c76
4586 changed files with 2050693 additions and 0 deletions
@@ -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>.
@@ -0,0 +1,67 @@
.arve-license-input {
width: 280px;
}
.arve-btn {
padding-left: 3px;
}
.arve-icon:before {
content: "\f236" !important; /* dashicon-video-alt */
}
.edit-shortcode-form-fields.shortcode-ui-edit-arve .field-block {
padding-top: .4em;
padding-bottom: .4em;
}
.edit-shortcode-form-fields.shortcode-ui-edit-arve .field-block label {
display: inline-block;
margin: 0;
}
.edit-shortcode-form-fields.shortcode-ui-edit-arve .field-block label:first-child {
width: 110px;
}
.edit-shortcode-form-fields.shortcode-ui-edit-arve .shortcode-ui-attribute-upload_date input,
.edit-shortcode-form-fields.shortcode-ui-edit-arve .shortcode-ui-attribute-aspect_ratio input,
.edit-shortcode-form-fields.shortcode-ui-edit-arve .shortcode-ui-attribute-url input,
.edit-shortcode-form-fields.shortcode-ui-edit-arve .shortcode-ui-attribute-title input,
.edit-shortcode-form-fields.shortcode-ui-edit-arve .shortcode-ui-attribute-description input {
width: 700px;
}
.arve-list-small {
font-size: .85em;
list-style: square;
padding-left: 20px;
}
.arve-list-small li {
margin-bottom: 2px;
}
.arve-settings-page-ad {
margin: 0;
padding-right: .7rem !important;
}
.arve-corner-spacer {
float: right;
width: 20px;
height: 38px;
}
@media all and (min-width: 1024px) {
.arve-settings-page-ad {
position: absolute !important;
right: 0;
width: 320px;
}
.arve-options-wrap {
padding-right: 350px;
position: relative;
}
}
@@ -0,0 +1,108 @@
(function ( $ ) {
'use strict';
/*global ajaxurl */
/*global sui */
/*global tb_show */
// Options Page
$('.arve-settings-section').each( function() {
$(this).insertBefore( $(this).parent() );
});
$('.arve-settings-section').each( function() {
var id = $(this).attr( 'id' );
var classs = $(this).attr( 'class' );
var title = $(this).attr( 'title' );
$(this).nextUntil( '.arve-settings-section' ).wrapAll( '<section id="' + id + '" class="' + classs + '" />' );
$( '<a href="#" data-target="#' + id + '" class="nav-tab">' + title + '</a>' ).appendTo( '.arve-settings-tabs' );
$(this).remove();
});
function show_tab( target ) {
$('.arve-settings-section').show();
$( target ).prependTo( '.arve-options-form' );
$('.arve-settings-section').not( target ).hide();
$('.arve-settings-tabs a').removeClass( 'nav-tab-active' );
$('.arve-settings-tabs a[data-target="' + target + '"]').addClass( 'nav-tab-active' );
}
if ( $( '#arve_options_main\\[last_settings_tab\\]' ).length && $( '#arve_options_main\\[last_settings_tab\\]' ).val().length ) {
show_tab( $( '#arve_options_main\\[last_settings_tab\\]' ).val() );
}
$(document).on( 'click', '.arve-settings-tabs a', function(e) {
e.preventDefault();
var target = $(this).attr('data-target');
show_tab( target );
$( '#arve_options_main\\[last_settings_tab\\]' ).val( target );
} );
$(document).on( 'click', '[data-image-upload]', function(e) {
e.preventDefault();
var target = $( this ).attr('data-image-upload');
var image = wp.media({
title: 'Upload Image',
// mutiple: true if you want to upload multiple files at once
multiple: false
}).open()
.on('select', function(){
// This will return the selected image from the Media Uploader, the result is an object
var uploaded_image = image.state().get('selection').first();
// We convert uploaded_image to a JSON object to make accessing it easier
// Output to the console uploaded_image
var attachment_id = uploaded_image.toJSON().id;
// Let's assign the url value to the input field
$( target ).val(attachment_id);
});
});
$(document).on( 'click', '.arve-pro-notice .notice-dismiss', function() {
jQuery.ajax({
url: ajaxurl,
data: {
action: 'arve_ajax_dismiss_pro_notice'
}
});
});
$(document).on( 'click', '[data-nj-notice-id] .notice-dismiss', function() {
var id = $(this).closest('[data-nj-notice-id]').attr('data-nj-notice-id');
jQuery.ajax({
url: ajaxurl,
data: {
action: id
}
});
});
$(document).on( 'click', '#arve-btn', function() {
if ( typeof( sui ) !== 'undefined' ) {
var arve_shortcode = sui.utils.shortcodeViewConstructor.parseShortcodeString( '[arve]' );
wp.media({
frame : 'post',
state : 'shortcode-ui',
currentShortcode : arve_shortcode
}).open();
} else {
tb_show( 'ARVE Optional Features', '#TB_inline?inlineId=arve-thickbox' );
}
} );
}(jQuery));
@@ -0,0 +1,74 @@
function arve_extract_url( changed, collection, shortcode ) {
function attr_by_name( name ) {
return _.find(
collection,
function( viewModel ) {
return name === viewModel.model.get( 'attr' );
}
);
}
var val = changed.value,
short_val = changed.value,
input = attr_by_name( 'url' ).$el.find( 'input' );
if( typeof val === 'undefined' ) {
return;
}
if( val.match(/src="?([^\s"]+)/) ) {
var test_url = val.match(/src="?([^\s"]+)/),
only_url = test_url && test_url[1];
input.val( only_url ).trigger( 'input' );
}
}
function arve_mode_select_listener( changed, collection, shortcode ) {
function attr_by_name(name) {
return _.find(
collection,
function( viewModel ) {
return name === viewModel.model.get('attr');
}
);
}
var val = changed.value,
autoplay = attr_by_name( 'autoplay' ),
grow = attr_by_name( 'grow' ),
align = attr_by_name( 'align' ),
hide_title = attr_by_name( 'hide_title' );
if( typeof val === 'undefined' ) {
return;
}
if ( 'lazyload-lightbox' === val ) {
align.$el.show();
autoplay.$el.hide();
grow.$el.hide();
hide_title.$el.show();
} else if ( 'lazyload' === val ) {
align.$el.show();
autoplay.$el.hide();
grow.$el.show();
hide_title.$el.show();
} else if ( 'link-lightbox' === val ) {
align.$el.hide();
autoplay.$el.hide();
grow.$el.hide();
hide_title.$el.hide();
} else { // normal
align.$el.show();
autoplay.$el.show();
grow.$el.hide();
hide_title.$el.hide();
}
}
wp.shortcake.hooks.addAction( 'arve.mode', arve_mode_select_listener );
wp.shortcake.hooks.addAction( 'arve.url', arve_extract_url );
@@ -0,0 +1,61 @@
<?php
class ARVE_Admin_Notice_Factory {
private $notice_id;
private $notice;
private $dismiss_forever;
public function __construct( $notice_id, $notice, $dismiss_forever = true, $capabilities = 'activate_plugins' ) {
if ( ! current_user_can( $capabilities ) ) {
return;
}
$this->notice_id = "admin-notice-factory-$notice_id";
$this->notice = $notice;
$this->dismiss_forever = $dismiss_forever;
if ( 'admin-notice-factory-arve_dismiss_pro_notice' === $this->notice_id ) {
$this->notice_id = 'arve_dismiss_pro_notice';
}
add_action( 'admin_notices', array( $this, 'action_admin_notices' ) );
add_action( 'wp_ajax_' . $this->notice_id, array( $this, 'ajax_call' ) );
}
public function action_admin_notices() {
if ( apply_filters( 'nj_debug_admin_message', false ) ) {
delete_user_meta( get_current_user_id(), $this->notice_id );
delete_transient( $this->notice_id );
}
$user_id = get_current_user_id();
$user_meta = get_user_meta( $user_id, $this->notice_id );
if ( $this->dismiss_forever && ! empty( $user_meta ) ) {
return;
} elseif ( get_transient( $this->notice_id ) ) {
return;
}
printf(
'<div class="notice is-dismissible updated" data-nj-notice-id="%s">%s</div>',
esc_attr( $this->notice_id ),
$this->notice // phpcs:ignore
);
}
public function ajax_call() {
$user_id = get_current_user_id();
if ( $this->dismiss_forever ) {
add_user_meta( $user_id, $this->notice_id, true );
} else {
set_transient( $this->notice_id, true, HOUR_IN_SECONDS );
}
wp_die();
}
}
@@ -0,0 +1,586 @@
<?php
// phpcs:disable
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
/**
* Allows plugins to use their own update API.
*
* @author Easy Digital Downloads
* @version 1.6.19
*/
class Nextgenthemes_Plugin_Updater {
private $api_url = '';
private $api_data = array();
private $name = '';
private $slug = '';
private $version = '';
private $wp_override = false;
private $cache_key = '';
private $health_check_timeout = 5;
/**
* Class constructor.
*
* @uses plugin_basename()
* @uses hook()
*
* @param string $_api_url The URL pointing to the custom API endpoint.
* @param string $_plugin_file Path to the plugin file.
* @param array $_api_data Optional data to send with API calls.
*/
public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
global $edd_plugin_data;
$this->api_url = trailingslashit( $_api_url );
$this->api_data = $_api_data;
$this->name = plugin_basename( $_plugin_file );
$this->slug = basename( $_plugin_file, '.php' );
$this->version = $_api_data['version'];
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
$this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
$this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
$edd_plugin_data[ $this->slug ] = $this->api_data;
/**
* Fires after the $edd_plugin_data is setup.
*
* @since x.x.x
*
* @param array $edd_plugin_data Array of EDD SL plugin data.
*/
do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
// Set up hooks.
$this->init();
}
/**
* Set up WordPress filters to hook into WP's update process.
*
* @uses add_filter()
*
* @return void
*/
public function init() {
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
add_action( 'admin_init', array( $this, 'show_changelog' ) );
}
/**
* Check for Updates at the defined API endpoint and modify the update array.
*
* This function dives into the update API just when WordPress creates its update array,
* then adds a custom API call and injects the custom plugin data retrieved from the API.
* It is reassembled from parts of the native WordPress plugin update code.
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
*
* @uses api_request()
*
* @param array $_transient_data Update array build by WordPress.
* @return array Modified update array with custom plugin data.
*/
public function check_update( $_transient_data ) {
global $pagenow;
if ( ! is_object( $_transient_data ) ) {
$_transient_data = new stdClass;
}
if ( 'plugins.php' == $pagenow && is_multisite() ) {
return $_transient_data;
}
if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
return $_transient_data;
}
$version_info = $this->get_cached_version_info();
if ( false === $version_info ) {
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
$this->set_version_info_cache( $version_info );
}
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
$_transient_data->response[ $this->name ] = $version_info;
// Make sure the plugin property is set to the plugin's name/location. See issue 1463 on Software Licensing's GitHub repo.
$_transient_data->response[ $this->name ]->plugin = $this->name;
}
$_transient_data->last_checked = time();
$_transient_data->checked[ $this->name ] = $this->version;
}
return $_transient_data;
}
/**
* show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
*
* @param string $file
* @param array $plugin
*/
public function show_update_notification( $file, $plugin ) {
if ( is_network_admin() ) {
return;
}
if( ! current_user_can( 'update_plugins' ) ) {
return;
}
if( ! is_multisite() ) {
return;
}
if ( $this->name != $file ) {
return;
}
// Remove our filter on the site transient
remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
$update_cache = get_site_transient( 'update_plugins' );
$update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
$version_info = $this->get_cached_version_info();
if ( false === $version_info ) {
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
// Since we disabled our filter for the transient, we aren't running our object conversion on banners, sections, or icons. Do this now:
if ( isset( $version_info->banners ) && ! is_array( $version_info->banners ) ) {
$version_info->banners = $this->convert_object_to_array( $version_info->banners );
}
if ( isset( $version_info->sections ) && ! is_array( $version_info->sections ) ) {
$version_info->sections = $this->convert_object_to_array( $version_info->sections );
}
if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
$version_info->icons = $this->convert_object_to_array( $version_info->icons );
}
if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
$version_info->icons = $this->convert_object_to_array( $version_info->icons );
}
if ( isset( $version_info->contributors ) && ! is_array( $version_info->contributors ) ) {
$version_info->contributors = $this->convert_object_to_array( $version_info->contributors );
}
$this->set_version_info_cache( $version_info );
}
if ( ! is_object( $version_info ) ) {
return;
}
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
$update_cache->response[ $this->name ] = $version_info;
}
$update_cache->last_checked = time();
$update_cache->checked[ $this->name ] = $this->version;
set_site_transient( 'update_plugins', $update_cache );
} else {
$version_info = $update_cache->response[ $this->name ];
}
// Restore our filter
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
// build a plugin list row, with update notification
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
# <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
echo '<td colspan="3" class="plugin-update colspanchange">';
echo '<div class="update-message notice inline notice-warning notice-alt">';
$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
if ( empty( $version_info->download_link ) ) {
printf(
__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ),
esc_html( $version_info->name ),
'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
esc_html( $version_info->new_version ),
'</a>'
);
} else {
printf(
__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads' ),
esc_html( $version_info->name ),
'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
esc_html( $version_info->new_version ),
'</a>',
'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
'</a>'
);
}
do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
echo '</div></td></tr>';
}
}
/**
* Updates information on the "View version x.x details" page with custom data.
*
* @uses api_request()
*
* @param mixed $_data
* @param string $_action
* @param object $_args
* @return object $_data
*/
public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
if ( $_action != 'plugin_information' ) {
return $_data;
}
if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
return $_data;
}
$to_send = array(
'slug' => $this->slug,
'is_ssl' => is_ssl(),
'fields' => array(
'banners' => array(),
'reviews' => false,
'icons' => array(),
)
);
$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
// Get the transient where we store the api request for this plugin for 24 hours
$edd_api_request_transient = $this->get_cached_version_info( $cache_key );
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
if ( empty( $edd_api_request_transient ) ) {
$api_response = $this->api_request( 'plugin_information', $to_send );
// Expires in 3 hours
$this->set_version_info_cache( $api_response, $cache_key );
if ( false !== $api_response ) {
$_data = $api_response;
}
} else {
$_data = $edd_api_request_transient;
}
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
$_data->sections = $this->convert_object_to_array( $_data->sections );
}
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
$_data->banners = $this->convert_object_to_array( $_data->banners );
}
// Convert icons into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->icons ) && ! is_array( $_data->icons ) ) {
$_data->icons = $this->convert_object_to_array( $_data->icons );
}
// Convert contributors into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->contributors ) && ! is_array( $_data->contributors ) ) {
$_data->contributors = $this->convert_object_to_array( $_data->contributors );
}
if( ! isset( $_data->plugin ) ) {
$_data->plugin = $this->name;
}
return $_data;
}
/**
* Convert some objects to arrays when injecting data into the update API
*
* Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
* decoding, they are objects. This method allows us to pass in the object and return an associative array.
*
* @since 3.6.5
*
* @param stdClass $data
*
* @return array
*/
private function convert_object_to_array( $data ) {
$new_data = array();
foreach ( $data as $key => $value ) {
$new_data[ $key ] = is_object( $value ) ? $this->convert_object_to_array( $value ) : $value;
}
return $new_data;
}
/**
* Disable SSL verification in order to prevent download update failures
*
* @param array $args
* @param string $url
* @return object $array
*/
public function http_request_args( $args, $url ) {
$verify_ssl = $this->verify_ssl();
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
$args['sslverify'] = $verify_ssl;
}
return $args;
}
/**
* Calls the API and, if successfull, returns the object delivered by the API.
*
* @uses get_bloginfo()
* @uses wp_remote_post()
* @uses is_wp_error()
*
* @param string $_action The requested action.
* @param array $_data Parameters for the API action.
* @return false|object
*/
private function api_request( $_action, $_data ) {
global $wp_version, $edd_plugin_url_available;
$verify_ssl = $this->verify_ssl();
// Do a quick status check on this domain if we haven't already checked it.
$store_hash = md5( $this->api_url );
if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
$test_url_parts = parse_url( $this->api_url );
$scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http';
$host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
$port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
if ( empty( $host ) ) {
$edd_plugin_url_available[ $store_hash ] = false;
} else {
$test_url = $scheme . '://' . $host . $port;
$response = wp_remote_get( $test_url, array( 'timeout' => $this->health_check_timeout, 'sslverify' => $verify_ssl ) );
$edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
}
}
if ( false === $edd_plugin_url_available[ $store_hash ] ) {
return;
}
$data = array_merge( $this->api_data, $_data );
if ( $data['slug'] != $this->slug ) {
return;
}
if( $this->api_url == trailingslashit ( home_url() ) ) {
return false; // Don't allow a plugin to ping itself
}
$api_params = array(
'edd_action' => 'get_version',
'license' => ! empty( $data['license'] ) ? $data['license'] : '',
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
'version' => isset( $data['version'] ) ? $data['version'] : false,
'slug' => $data['slug'],
'author' => $data['author'],
'url' => home_url(),
'beta' => ! empty( $data['beta'] ),
);
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
if ( ! is_wp_error( $request ) ) {
$request = json_decode( wp_remote_retrieve_body( $request ) );
}
if ( $request && isset( $request->sections ) ) {
$request->sections = maybe_unserialize( $request->sections );
} else {
$request = false;
}
if ( $request && isset( $request->banners ) ) {
$request->banners = maybe_unserialize( $request->banners );
}
if ( $request && isset( $request->icons ) ) {
$request->icons = maybe_unserialize( $request->icons );
}
if( ! empty( $request->sections ) ) {
foreach( $request->sections as $key => $section ) {
$request->$key = (array) $section;
}
}
return $request;
}
public function show_changelog() {
global $edd_plugin_data;
if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
return;
}
if( empty( $_REQUEST['plugin'] ) ) {
return;
}
if( empty( $_REQUEST['slug'] ) ) {
return;
}
if( ! current_user_can( 'update_plugins' ) ) {
wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
}
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
$beta = ! empty( $data['beta'] ) ? true : false;
$cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
$version_info = $this->get_cached_version_info( $cache_key );
if( false === $version_info ) {
$api_params = array(
'edd_action' => 'get_version',
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
'slug' => $_REQUEST['slug'],
'author' => $data['author'],
'url' => home_url(),
'beta' => ! empty( $data['beta'] )
);
$verify_ssl = $this->verify_ssl();
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
if ( ! is_wp_error( $request ) ) {
$version_info = json_decode( wp_remote_retrieve_body( $request ) );
}
if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
$version_info->sections = maybe_unserialize( $version_info->sections );
} else {
$version_info = false;
}
if( ! empty( $version_info ) ) {
foreach( $version_info->sections as $key => $section ) {
$version_info->$key = (array) $section;
}
}
$this->set_version_info_cache( $version_info, $cache_key );
}
if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
}
exit;
}
public function get_cached_version_info( $cache_key = '' ) {
if( empty( $cache_key ) ) {
$cache_key = $this->cache_key;
}
$cache = get_option( $cache_key );
if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
return false; // Cache is expired
}
// We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
$cache['value'] = json_decode( $cache['value'] );
if ( ! empty( $cache['value']->icons ) ) {
$cache['value']->icons = (array) $cache['value']->icons;
}
return $cache['value'];
}
public function set_version_info_cache( $value = '', $cache_key = '' ) {
if( empty( $cache_key ) ) {
$cache_key = $this->cache_key;
}
$data = array(
'timeout' => strtotime( '+3 hours', time() ),
'value' => json_encode( $value )
);
update_option( $cache_key, $data, 'no' );
}
/**
* Returns if the SSL of the store should be verified.
*
* @since 1.6.13
* @return bool
*/
private function verify_ssl() {
return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
}
}
@@ -0,0 +1,643 @@
<?php
function arve_action_admin_init_setup_messages() {
if ( defined( 'ARVE_PRO_VERSION' ) && version_compare( ARVE_PRO_VERSION_REQUIRED, ARVE_PRO_VERSION, '>' ) ) {
$msg = sprintf(
__( 'Your ARVE Pro Addon is outdated, you need version %1$s or later. If you have setup your license <a href="%2$s">here</a> semi auto updates (Admin panel notice and auto install on confirmation) should work again. If not please <a href="%3$s">report it</a> and manually update as <a href="%4$s">described here.</a>', ARVE_SLUG ),
ARVE_PRO_VERSION_REQUIRED,
get_admin_url() . 'admin.php?page=nextgenthemes-licenses',
'https://nextgenthemes.com/support/',
'https://nextgenthemes.com/plugins/arve/documentation/installing-and-license-management/'
);
new ARVE_Admin_Notice_Factory( 'arve-pro-outdated', "<p>$msg</p>", false );
}
if ( arve_display_pro_ad() ) {
$pro_ad_message = __( '<p>Hi, this is Nico(las Jonas) the author of the ARVE - Advanced Responsive Video Embedder plugin. If you are interrested in additional features and/or want to support the work I do on this plugin please consider buying the Pro Addon.</p>', ARVE_SLUG );
$pro_ad_message .= file_get_contents( ARVE_PATH . 'admin/pro-ad.html' );
new ARVE_Admin_Notice_Factory( 'arve_dismiss_pro_notice', $pro_ad_message, true );
}
}
function arve_add_tinymce_plugin( $plugin_array ) {
$plugin_array['arve'] = ARVE_ADMIN_URL . 'tinymce.js';
return $plugin_array;
}
function arve_display_pro_ad() {
$inst = (int) get_option( 'arve_install_date' );
if ( ! current_user_can( 'update_plugins' ) || ! apply_filters( 'arve_pro_ad', true ) || current_time( 'timestamp' ) < strtotime( '+1 week', $inst ) ) {
return false;
}
return true;
}
function arve_widget_text() {
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<p>';
printf( '<a href="%s">Documentation</a>, ', 'https://nextgenthemes.com/plugins/arve/documentation/' );
printf( '<a href="%s">Support</a>, ', 'https://nextgenthemes.com/support/' );
printf( '<a href="%s">%s</a>', admin_url( 'admin.php?page=advanced-responsive-video-embedder' ), __( 'Settings', ARVE_SLUG ) );
echo '</p>';
printf( '<a href="%s">ARVE Pro Addon Features</a>:', 'https://nextgenthemes.com/plugins/arve-pro/' );
echo file_get_contents( ARVE_PATH . 'admin/pro-ad.html' );
}
function arve_add_dashboard_widget() {
if ( ! arve_display_pro_ad() ) {
return false;
}
wp_add_dashboard_widget(
'arve_dashboard_widget', // Widget slug.
'Advanced Responsive Video Embedder', // Title.
'arve_widget_text' // Display function.
);
// phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
// Globalize the metaboxes array, this holds all the widgets for wp-admin.
global $wp_meta_boxes, $pagenow;
if ( 'index.php' === $pagenow ) {
// Get the regular dashboard widgets array.
// (which has our new widget already but at the end).
$normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
// Backup and delete our new dashboard widget from the end of the array.
$arve_widget_backup = array( 'arve_dashboard_widget' => $normal_dashboard['arve_dashboard_widget'] );
unset( $normal_dashboard['arve_dashboard_widget'] );
// Merge the two arrays together so our widget is at the beginning.
$sorted_dashboard = array_merge( $arve_widget_backup, $normal_dashboard );
// Save the sorted array back into the original metaboxes.
$wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
}
// phpcs:enable WordPress.WP.GlobalVariablesOverride.Prohibited
}
/**
* Register the administration menu for this plugin into the WordPress Dashboard menu.
*
* @since 1.0.0
*/
function arve_add_plugin_admin_menu() {
$plugin_screen_hook_suffix = add_options_page(
__( 'Advanced Responsive Video Embedder Settings', ARVE_SLUG ),
__( 'ARVE', ARVE_SLUG ),
'manage_options',
ARVE_SLUG, # menu-slug
function() {
require_once plugin_dir_path( __FILE__ ) . 'html-settings-page.php';
}
);
add_submenu_page(
'nextgenthemes', # parent_slug
__( 'Advanced Responsive Video Embedder Settings', ARVE_SLUG ), # Page Title
__( 'ARVE', ARVE_SLUG ), # Menu Title
'manage_options', # capability
ARVE_SLUG # menu-slug
);
}
/**
* Add settings action link to the plugins page.
*
* @since 1.0.0
*/
function arve_add_action_links( $links ) {
if ( ! is_plugin_active( 'arve-pro/arve-pro.php' ) ) {
$extra_links['buy_pro_addon'] = sprintf(
'<a href="%s"><strong style="display: inline;">%s</strong></a>',
'https://nextgenthemes.com/plugins/arve-pro/',
__( 'Buy Pro Addon', ARVE_SLUG )
);
}
$extra_links['donate'] = sprintf( '<a href="https://nextgenthemes.com/donate/"><strong style="display: inline;">%s</strong></a>', __( 'Donate', ARVE_SLUG ) );
$extra_links['settings'] = sprintf( '<a href="%s">%s</a>', admin_url( 'options-general.php?page=' . ARVE_SLUG ), __( 'Settings', ARVE_SLUG ) );
return array_merge( $extra_links, $links );
}
/**
* Action to add a custom button to the content editor
*
* @since 4.3.0
*/
function arve_add_media_button() {
$options = arve_get_options();
add_thickbox();
$p1 = __( 'This button can open a optional ARVE a Shortcode creation dialog. ARVE needs the <a href="%s">Shortcode UI plugin</a> active for this fuctionality.', ARVE_SLUG );
$p2 = __( 'The "Shortcake (Shortcode UI)" plugin also adds What You See Is What You Get functionality to WordPress visual post editor.', ARVE_SLUG );
$p3 = __( 'It is perfectly fine to pass on this and <a href="%s">manually</a> write shortcodes or don\'t use shortcodes at all, but it makes things easier.', ARVE_SLUG );
printf(
"<div id='arve-thickbox' style='display:none;'><p>$p1</p><p>$p2</p><p>$p3</p></div>",
nextgenthemes_admin_install_search_url( 'Shortcode+UI' ),
esc_url( 'https://nextgenthemes.com/plugins/arve/documentation/' )
);
printf(
'<button id="arve-btn" title="%s" data-mode="%s" class="arve-btn button add_media" type="button"><span class="wp-media-buttons-icon arve-icon"></span> %s</button>',
esc_attr__( 'ARVE Advanced Responsive Video Embedder', ARVE_SLUG ),
esc_attr( $options['mode'] ),
esc_html__( 'Embed Video (ARVE)', ARVE_SLUG )
);
}
function arve_register_shortcode_ui() {
$attrs = arve_get_settings_definitions();
if ( function_exists( 'arve_pro_get_settings_definitions' ) ) {
$attrs = array_merge( $attrs, arve_pro_get_settings_definitions() );
}
foreach ( $attrs as $key => $values ) {
if ( isset( $values['hide_from_sc'] ) && $values['hide_from_sc'] ) {
continue;
}
$sc_attrs[] = $values;
}
shortcode_ui_register_for_shortcode(
'arve',
array(
'label' => esc_html( 'ARVE' ),
'listItemImage' => 'dashicons-format-video',
'attrs' => $sc_attrs,
)
);
}
function arve_input( $args ) {
$out = sprintf( '<input%s>', arve_attr( $args['input_attr'] ) );
if ( ! empty( $args['option_values']['attr'] ) && 'thumbnail_fallback' === $args['option_values']['attr'] ) {
// jQuery
wp_enqueue_script( 'jquery' );
// This will enqueue the Media Uploader script
wp_enqueue_media();
$out .= sprintf(
'<a %s>%s</a>',
arve_attr(
array(
'data-image-upload' => sprintf( '[name="%s"]', $args['input_attr']['name'] ),
'class' => 'button-secondary',
)
),
__( 'Upload Image', ARVE_SLUG )
);
}
if ( ! empty( $args['description'] ) ) {
$out = $out . '<p class="description">' . $args['description'] . '</p>';
}
echo $out;
}
function arve_textarea( $args ) {
unset( $args['input_attr']['type'] );
$out = sprintf( '<textarea%s></textarea>', arve_attr( $args['input_attr'] ) );
if ( ! empty( $args['description'] ) ) {
$out = $out . '<p class="description">' . $args['description'] . '</p>';
}
echo $out;
}
function arve_select( $args ) {
unset( $args['input_attr']['type'] );
foreach ( $args['option_values']['options'] as $key => $value ) {
if (
2 === count( $args['option_values']['options'] ) &&
array_key_exists( 'yes', $args['option_values']['options'] ) &&
array_key_exists( 'no', $args['option_values']['options'] )
) {
$current_option = $args['input_attr']['value'] ? 'yes' : 'no';
} else {
$current_option = $args['input_attr']['value'];
}
$options[] = sprintf(
'<option value="%s" %s>%s</option>',
esc_attr( $key ),
selected( $current_option, $key, false ),
esc_html( $value )
);
}
$select_attr = $args['input_attr'];
unset( $select_attr['value'] );
$out = sprintf( '<select%s>%s</select>', arve_attr( $select_attr ), implode( '', $options ) );
if ( ! empty( $args['description'] ) ) {
$out = $out . '<p class="description">' . $args['description'] . '</p>';
}
echo $out;
}
/**
*
*
* @since 2.6.0
*/
function arve_register_settings() {
$options = arve_get_options();
// Main
$main_title = __( 'Main Options', ARVE_SLUG );
add_settings_section(
'main_section',
sprintf( '<span class="arve-settings-section" id="arve-settings-section-main" title="%s"></span>%s', esc_attr( $main_title ), esc_html( $main_title ) ),
null,
ARVE_SLUG
);
foreach ( arve_get_settings_definitions() as $key => $value ) {
if ( ! empty( $value['hide_from_settings'] ) ) {
continue;
};
if ( empty( $value['meta'] ) ) {
$value['meta'] = array();
};
if ( isset( $value['options'][''] ) ) {
unset( $value['options'][''] );
}
if ( in_array( $value['type'], array( 'text', 'number', 'url' ), true ) ) {
$callback_function = 'arve_input';
} else {
$callback_function = 'arve_' . $value['type'];
}
add_settings_field(
"arve_options_main[{$value['attr']}]", // ID
$value['label'], // title
$callback_function, // callback
ARVE_SLUG, // page
'main_section', // section
array( // args
'label_for' => ( 'radio' === $value['type'] ) ? null : "arve_options_main[{$value['attr']}]",
'input_attr' => $value['meta'] + array(
'type' => $value['type'],
'value' => $options[ $value['attr'] ],
'id' => "arve_options_main[{$value['attr']}]",
'name' => "arve_options_main[{$value['attr']}]",
),
'description' => ! empty( $value['description'] ) ? $value['description'] : null,
'option_values' => $value,
)
);
}
add_settings_field(
'arve_options_main[reset]',
null,
'arve_submit_reset',
ARVE_SLUG,
'main_section',
array(
'reset_name' => 'arve_options_main[reset]',
)
);
// Params
$params_title = __( 'URL Parameters', ARVE_SLUG );
add_settings_section(
'params_section',
sprintf( '<span class="arve-settings-section" id="arve-settings-section-params" title="%s"></span>%s', esc_attr( $params_title ), esc_html( $params_title ) ),
'arve_params_section_description',
ARVE_SLUG
);
// Options
foreach ( $options['params'] as $provider => $params ) {
add_settings_field(
"arve_options_params[$provider]",
ucfirst( $provider ),
'arve_input',
ARVE_SLUG,
'params_section',
array(
'label_for' => "arve_options_params[$provider]",
'input_attr' => array(
'type' => 'text',
'value' => $params,
'id' => "arve_options_params[$provider]",
'name' => "arve_options_params[$provider]",
'class' => 'large-text'
),
)
);
}
add_settings_field(
'arve_options_params[reset]',
null,
'arve_submit_reset',
ARVE_SLUG,
'params_section',
array(
'reset_name' => 'arve_options_params[reset]',
)
);
// Shortcode Tags
$shortcodes_title = __( 'Shortcode Tags', ARVE_SLUG );
add_settings_section(
'shortcodes_section',
sprintf( '<span class="arve-settings-section" id="arve-settings-section-shortcodes" title="%s"></span>%s', esc_attr( $shortcodes_title ), esc_html( $shortcodes_title ) ),
'arve_shortcodes_section_description',
ARVE_SLUG
);
foreach ( $options['shortcodes'] as $provider => $shortcode ) {
add_settings_field(
"arve_options_shortcodes[$provider]",
ucfirst( $provider ),
'arve_input',
ARVE_SLUG,
'shortcodes_section',
array(
'label_for' => "arve_options_shortcodes[$provider]",
'input_attr' => array(
'type' => 'text',
'value' => $shortcode,
'id' => "arve_options_shortcodes[$provider]",
'name' => "arve_options_shortcodes[$provider]",
'class' => 'medium-text'
),
)
);
}
add_settings_field(
'arve_options_shortcodes[reset]',
null,
'arve_submit_reset',
ARVE_SLUG,
'shortcodes_section',
array(
'reset_name' => 'arve_options_shortcodes[reset]',
)
);
register_setting( 'arve-settings-group', 'arve_options_main', 'arve_validate_options_main' );
register_setting( 'arve-settings-group', 'arve_options_params', 'arve_validate_options_params' );
register_setting( 'arve-settings-group', 'arve_options_shortcodes', 'arve_validate_options_shortcodes' );
}
/**
*
*
* @since 6.0.6
*/
function arve_register_settings_debug() {
// Debug Information
$debug_title = __( 'Debug Info', ARVE_SLUG );
add_settings_section(
'debug_section',
sprintf( '<span class="arve-settings-section" id="arve-settings-section-debug" title="%s"></span>%s', esc_attr( $debug_title ), esc_html( $debug_title ) ),
'arve_debug_section_description',
ARVE_SLUG
);
}
function arve_submit_reset( $args ) {
submit_button( __( 'Save Changes', ARVE_SLUG ), 'primary', 'submit', false );
echo '&nbsp;&nbsp;';
submit_button( __( 'Reset This Settings Section', ARVE_SLUG ), 'secondary', $args['reset_name'], false );
}
function arve_shortcodes_section_description() {
$desc = __( 'This shortcodes exist for backwards compatiblity only. It is not recommended to use them at all, please use the <code>[arve]</code> shortcode. You can change the old shortcode tags here. You may need this to prevent conflicts with other plugins you want to use.', ARVE_SLUG );
echo "<p>$desc</p>";
}
function arve_params_section_description() {
$desc = sprintf(
__(
'This parameters will be added to the <code>iframe src</code> urls, you can control the video players behavior with them. Please read <a href="%s" target="_blank">the documentation</a> on.',
ARVE_SLUG
),
esc_url( 'https://nextgenthemes.com/arve/documentation' )
);
echo "<p>$desc</p>";
?>
<p>
See
<a target="_blank" href="https://developers.google.com/youtube/player_parameters">Youtube Parameters</a>,
<a target="_blank" href="http://www.dailymotion.com/doc/api/player.html#parameters">Dailymotion Parameters</a>,
<a target="_blank" href="https://developer.vimeo.com/player/embedding">Vimeo Parameters</a>,
<a target="_blank" href="https://nextgenthemes.com/arve-pro/documentation">Vimeo Parameters</a>,
</p>
<?php
}
function arve_get_plugin_version_and_status( $folder_and_filename ) {
$file = WP_PLUGIN_DIR . '/' . $folder_and_filename;
if ( ! is_file( $file ) ) {
return 'NOT INSTALLED';
}
$data = get_plugin_data( $file );
$out = $data['Version'];
if ( ! is_plugin_active( $folder_and_filename ) ) {
$out .= ' INACTIVE';
}
return $out;
}
function arve_debug_section_description() {
global $wp_version;
$arve_version = arve_get_plugin_version_and_status( 'advanced-responsive-video-embedder/advanced-responsive-video-embedder.php' );
$arve_pro_version = arve_get_plugin_version_and_status( 'arve-pro/arve-pro.php' );
if ( ! is_plugin_active( 'arve-pro/arve-pro.php' ) ) {
$pro_options_dump = '';
} else {
$pro_options = get_option( 'arve_options_pro' );
unset( $pro_options['key'] );
ob_start();
var_dump( $pro_options ); // phpcs:ignore
$pro_options_dump = ob_get_clean();
}
include_once plugin_dir_path( __FILE__ ) . 'html-debug-info.php';
}
/**
*
*
* @since 2.6.0
*/
function arve_validate_options_main( $input ) {
// Storing the Options Section as a empty array will cause the plugin to use defaults
if ( isset( $input['reset'] ) ) {
return array();
}
$output['align'] = sanitize_text_field( $input['align'] );
$output['mode'] = sanitize_text_field( $input['mode'] );
$output['last_settings_tab'] = sanitize_text_field( $input['last_settings_tab'] );
$output['controlslist'] = sanitize_text_field( $input['controlslist'] );
$output['vimeo_api_token'] = sanitize_text_field( $input['vimeo_api_token'] );
$output['always_enqueue_assets'] = ( 'yes' === $input['always_enqueue_assets'] ) ? true : false;
$output['autoplay'] = ( 'yes' === $input['autoplay'] ) ? true : false;
$output['promote_link'] = ( 'yes' === $input['promote_link'] ) ? true : false;
$output['wp_video_override'] = ( 'yes' === $input['wp_video_override'] ) ? true : false;
$output['youtube_nocookie'] = ( 'yes' === $input['youtube_nocookie'] ) ? true : false;
$output['wp_image_cache_time'] = (int) $input['wp_image_cache_time'];
if ( (int) $input['video_maxwidth'] > 100 ) {
$output['video_maxwidth'] = (int) $input['video_maxwidth'];
} else {
$output['video_maxwidth'] = '';
}
if ( (int) $input['align_maxwidth'] > 100 ) {
$output['align_maxwidth'] = (int) $input['align_maxwidth'];
}
$options_defaults = arve_get_options_defaults( 'main' );
// Store only the options in the database that are different from the defaults.
return array_diff_assoc( $output, $options_defaults );
}
function arve_validate_options_params( $input ) {
// Storing the Options Section as a empty array will cause the plugin to use defaults
if ( isset( $input['reset'] ) ) {
return array();
}
$output = array();
foreach ( $input as $key => $var ) {
$output[ $key ] = preg_replace( '!\s+!', '&', trim( $var ) );
$output[ $key ] = preg_replace( '!\s+!', '&', trim( $var ) );
}
$options_defaults = arve_get_options_defaults( 'params' );
//* Store only the options in the database that are different from the defaults.
return array_diff_assoc( $output, $options_defaults );
}
function arve_validate_options_shortcodes( $input ) {
$output = array();
//* Storing the Options Section as a empty array will cause the plugin to use defaults
if ( isset( $input['reset'] ) ) {
return array();
}
foreach ( $input as $key => $var ) {
$var = preg_replace( '/[_]+/', '_', $var ); // remove multiple underscores
$var = preg_replace( '/[^A-Za-z0-9_]/', '', $var ); // strip away everything except a-z,0-9 and underscores
if ( strlen( $var ) < 3 ) {
continue;
}
$output[ $key ] = $var;
}
$options_defaults = arve_get_options_defaults( 'shortcodes' );
//* Store only the options in the database that are different from the defaults.
return array_diff_assoc( $output, $options_defaults );
}
function arve_admin_enqueue_styles() {
wp_enqueue_style( ARVE_SLUG, ARVE_ADMIN_URL . 'arve-admin.css', array(), ARVE_VERSION, 'all' );
}
function arve_mce_css( $mce_css ) {
$min = arve_get_min_suffix();
if ( ! empty( $mce_css ) ) {
$mce_css .= ',';
}
$mce_css .= ARVE_PUBLIC_URL . "arve{$min}.css";
return $mce_css;
}
/**
* Register the JavaScript for the dashboard.
*
* @since 1.0.0
*/
function arve_admin_enqueue_scripts() {
wp_enqueue_script( ARVE_SLUG, ARVE_ADMIN_URL . 'arve-admin.js', array( 'jquery' ), ARVE_VERSION, true );
if ( is_plugin_active( 'shortcode-ui/shortcode-ui.php' ) ) {
wp_enqueue_script( ARVE_SLUG . '-sc-ui', ARVE_ADMIN_URL . 'arve-shortcode-ui.js', array( 'shortcode-ui' ), ARVE_VERSION, true );
}
}
@@ -0,0 +1,621 @@
<?php
add_action( 'admin_init', 'nextgenthemes_init_edd_updaters', 0 );
add_action( 'admin_init', 'nextgenthemes_activation_notices' );
add_action( 'admin_init', 'nextgenthemes_register_settings' );
add_action( 'admin_menu', 'nextgenthemes_menus' );
function nextgenthemes_admin_install_search_url( $search_term ) {
$path = "plugin-install.php?s={$search_term}&tab=search&type=term";
if ( is_multisite() ) {
return network_admin_url( $path );
} else {
return admin_url( $path );
}
}
function nextgenthemes_ads_page() { ?>
<style>
body {
background: hsl(210, 13%, 16%);
}
#wpcontent {
padding: 0;
}
#wpbody-content {
/* padding-bottom: 2rem; */
}
#wpfooter {
display: none;
}
#nextgenthemes-ads {
padding: 1.7rem;
column-width: 40rem;
column-gap: 1.7rem;
}
@media only screen and (max-device-width: 400px) {
#nextgenthemes-ads {
padding-left: 0;
padding-right: 0;
}
}
#nextgenthemes-ads,
#nextgenthemes-ads * {
box-sizing: border-box;
}
#nextgenthemes-ads::after {
content: "";
display: table;
clear: both;
}
#nextgenthemes-ads {
color: white;
}
#nextgenthemes-ads h1,
#nextgenthemes-ads h2,
#nextgenthemes-ads h3 {
color: inherit;
margin-left: 2rem;
margin-right: 1.7rem;
}
#nextgenthemes-ads h1 {
line-height: 1;
}
#nextgenthemes-ads img {
width: 100%;
height: auto;
}
#nextgenthemes-ads > a {
text-decoration: none;
position: relative;
display: inline-block;
width: 100%;
background-color: hsl(210, 13%, 13%);
border: 1px solid hsl(207, 48%, 30%);
transition: box-shadow .3s, background-color .3s, border-color .3s;
color: #eee;
font-size: 1.05rem;
margin-bottom: 2rem;
line-height: 1.4;
}
#nextgenthemes-ads > a:hover {
background-color: hsl(210, 13%, 10%);
box-shadow: 0 0 10px hsla(207, 48%, 50%, 1);
border-color: hsl(207, 48%, 40%);
}
#nextgenthemes-ads p {
margin-left: 2rem;
margin-right: 1.7rem;
font-size: 1.2rem;
}
#nextgenthemes-ads ul {
list-style: square;
margin-left: 2.5rem;
margin-right: .7rem;
}
#nextgenthemes-ads > a > span {
position: absolute;
padding: .6rem 1rem;
right: 0px;
bottom: 0px;
font-size: 2rem;
color: white;
background-color: hsl(207, 48%, 30%);
border-top-left-radius: 3px;
//transform: rotate(3deg);
}
#nextgenthemes-ads figure {
margin: 1rem;
}
</style>
<?php
$img_dir = plugin_dir_url( __FILE__ ) . 'product-images/';
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
?>
<div id="nextgenthemes-ads">
<?php if ( ! defined( 'ARVE_PRO_VERSION' ) ) : ?>
<a href="https://nextgenthemes.com/plugins/arve-pro/">
<figure><img src="<?php echo $img_dir; ?>arve.svg" alt"ARVE"></figure>
<?php nextgenthemes_feature_list_html( ARVE_PATH . 'readme/html/20-description-features-pro.html' ); ?>
<span>Paid</span>
</a>
<?php endif; ?>
<?php if ( ! defined( 'ARVE_AMP_VERSION' ) ) : ?>
<a href="https://nextgenthemes.com/plugins/arve-accelerated-mobile-pages-addon/">
<figure><img src="<?php echo $img_dir; ?>arve.svg" alt"ARVE"></figure>
<?php nextgenthemes_feature_list_html( ARVE_PATH . 'readme/html/25-description-features-amp.html' ); ?>
<span>Paid</span>
</a>
<?php endif; ?>
<?php if ( ! is_plugin_active( 'regenerate-thumbnails-reminder/regenerate-thumbnails-reminder.php' ) ) : ?>
<a href="<?php echo nextgenthemes_admin_install_search_url( 'Regenerate+Thumbnails+Reminder' ); ?>">
<h1>Regenerate Thumbnails Reminder</h1>
<p>Get a reminder when you change your thumbnail sizes to regenerate them. Note Thumbnails sizes change automatically if you swtich themes.</p>
<span>Free</span>
</a>
<?php endif; ?>
</div>
<?php
}
function nextgenthemes_feature_list_html( $filepath ) {
echo strip_tags( file_get_contents( $filepath ), '<ul></ul><li></li><h3></h3>' );
}
function nextgenthemes_activation_notices() {
$products = nextgenthemes_get_products();
foreach ( $products as $key => $value ) {
if ( $value['active'] && ! $value['valid_key'] ) {
$msg = sprintf(
__( 'Hi there, thanks for your purchase. One last step, please activate your %1$s <a href="%2$s">here now</a>.', ARVE_SLUG ),
$value['name'],
get_admin_url() . 'admin.php?page=nextgenthemes-licenses'
);
new ARVE_Admin_Notice_Factory( $key . '-activation-notice', "<p>$msg</p>", false );
}
}
}
function nextgenthemes_get_products() {
$products = array(
'arve_pro' => array(
'name' => 'ARVE Pro',
'id' => 1253,
'type' => 'plugin',
'author' => 'Nicolas Jonas',
'url' => 'https://nextgenthemes.com/plugins/arve-pro/',
),
'arve_amp' => array(
'name' => 'ARVE AMP',
'id' => 16941,
'type' => 'plugin',
'author' => 'Nicolas Jonas',
'url' => 'https://nextgenthemes.com/plugins/arve-amp/',
),
'arve_random_video' => array(
'name' => 'ARVE Random Video',
'id' => 31933,
'type' => 'plugin',
'author' => 'Nicolas Jonas',
'url' => 'https://nextgenthemes.com/plugins/arve-random-video/',
)
);
$products = apply_filters( 'nextgenthemes_products', $products );
foreach ( $products as $key => $value ) {
$products[ $key ]['slug'] = $key;
$products[ $key ]['installed'] = false;
$products[ $key ]['active'] = false;
$products[ $key ]['valid_key'] = nextgenthemes_has_valid_key( $key );
$version_define = strtoupper( $key ) . '_VERSION';
$file_define = strtoupper( $key ) . '_FILE';
if ( defined( $version_define ) ) {
$products[ $key ]['version'] = constant( $version_define );
}
if ( defined( $file_define ) ) {
$products[ $key ]['file'] = constant( $file_define );
}
$version_define = "\\nextgenthemes\\$key\\VERSION";
$file_define = "\\nextgenthemes\\$key\\FILE";
if ( defined( $version_define ) ) {
$products[ $key ]['version'] = constant( $version_define );
}
if ( defined( $file_define ) ) {
$products[ $key ]['file'] = constant( $file_define );
}
if ( 'plugin' === $value['type'] ) {
$file_slug = str_replace( '_', '-', $key );
$products[ $key ]['installed'] = nextgenthemes_is_plugin_installed( "$file_slug/$file_slug.php" );
$products[ $key ]['active'] = is_plugin_active( "$file_slug/$file_slug.php" );
}
}
return $products;
}
function nextgenthemes_is_plugin_installed( $plugin_basename ) {
$plugins = get_plugins();
if ( array_key_exists( $plugin_basename, $plugins ) ) {
return true;
} else {
return false;
}
}
/**
* Register the administration menu for this plugin into the WordPress Dashboard menu.
*
* @since 1.0.0
*/
function nextgenthemes_menus() {
$plugin_screen_hook_suffix = add_options_page(
__( 'ARVE Licenses', ARVE_SLUG ),
__( 'ARVE Licenses', ARVE_SLUG ),
'manage_options',
'nextgenthemes-licenses',
'nextgenthemes_licenses_page'
);
}
function nextgenthemes_register_settings() {
add_settings_section(
'keys', # id,
__( 'Licenses', ARVE_SLUG ), # title,
'__return_empty_string', # callback,
'nextgenthemes-licenses' # page
);
foreach ( nextgenthemes_get_products() as $product_slug => $product ) :
$option_basename = "nextgenthemes_{$product_slug}_key";
$option_keyname = $option_basename . '[key]';
add_settings_field(
$option_keyname, # id,
$product['name'], # title,
'nextgenthemes_key_callback', # callback,
'nextgenthemes-licenses', # page,
'keys', # section
array( # args
'product' => $product,
'label_for' => $option_keyname,
'option_basename' => $option_basename,
'attr' => array(
'type' => 'text',
'id' => $option_keyname,
'name' => $option_keyname,
'class' => 'arve-license-input',
'value' => nextgenthemes_get_defined_key( $product_slug ) ? __( 'is defined (wp-config.php?)', ARVE_SLUG ) : nextgenthemes_get_key( $product_slug, 'option_only' ),
)
)
);
register_setting(
'nextgenthemes', # option_group
$option_basename, # option_name
'nextgenthemes_validate_license' # validation callback
);
endforeach;
}
function nextgenthemes_key_callback( $args ) {
echo '<p>';
printf(
'<input%s>',
arve_attr(
array(
'type' => 'hidden',
'id' => $args['option_basename'] . '[product]',
'name' => $args['option_basename'] . '[product]',
'value' => $args['product']['slug'],
)
)
);
printf(
'<input%s%s>',
arve_attr( $args['attr'] ),
nextgenthemes_get_defined_key( $args['product']['slug'] ) ? ' disabled' : ''
);
$defined_key = nextgenthemes_get_defined_key( $args['product']['slug'] );
$key = nextgenthemes_get_key( $args['product']['slug'] );
if ( $defined_key || ! empty( $key ) ) {
submit_button( __( 'Activate License', ARVE_SLUG ), 'primary', $args['option_basename'] . '[activate_key]', false );
submit_button( __( 'Deactivate License', ARVE_SLUG ), 'secondary', $args['option_basename'] . '[deactivate_key]', false );
submit_button( __( 'Check License', ARVE_SLUG ), 'secondary', $args['option_basename'] . '[check_key]', false );
}
echo '</p>';
echo '<p>';
echo __( 'License Status: ', ARVE_SLUG ) . nextgenthemes_get_key_status( $args['product']['slug'] );
echo '</p>';
if ( $args['product']['installed'] && ! $args['product']['active'] ) {
printf( '<strong>%s</strong>', __( 'Plugin is installed but not activated', ARVE_SLUG ) );
} elseif ( ! $args['product']['active'] ) {
printf(
'<a%s>%s</a>',
arve_attr(
array(
'href' => $args['product']['url'],
'class' => 'button button-primary',
)
),
__( 'Not installed, check it out', ARVE_SLUG )
);
}
}
function nextgenthemes_validate_license( $input ) {
if ( ! is_array( $input ) ) {
return sanitize_text_field( $input );
}
$product = $input['product'];
$defined_key = nextgenthemes_get_defined_key( $product );
if ( $defined_key ) {
$option_key = $defined_key;
$key = $defined_key;
} else {
$key = sanitize_text_field( $input['key'] );
$option_key = nextgenthemes_get_key( $product );
}
if ( ( $key !== $option_key ) || isset( $input['activate_key'] ) ) {
nextgenthemes_api_update_key_status( $product, $key, 'activate' );
} elseif ( isset( $input['deactivate_key'] ) ) {
nextgenthemes_api_update_key_status( $product, $key, 'deactivate' );
} elseif ( isset( $input['check_key'] ) ) {
nextgenthemes_api_update_key_status( $product, $key, 'check' );
}
return $key;
}
function nextgenthemes_get_key( $product, $option_only = false ) {
$defined_key = nextgenthemes_get_defined_key( $product );
if ( ! $option_only && $defined_key ) {
return $defined_key;
}
return get_option( "nextgenthemes_{$product}_key" );
}
function nextgenthemes_get_key_status( $product ) {
return get_option( "nextgenthemes_{$product}_key_status" );
}
function nextgenthemes_update_key_status( $product, $key ) {
update_option( "nextgenthemes_{$product}_key_status", $key );
}
function nextgenthemes_has_valid_key( $product ) {
return ( 'valid' === nextgenthemes_get_key_status( $product ) ) ? true : false;
}
function nextgenthemes_api_update_key_status( $product, $key, $action ) {
$products = nextgenthemes_get_products();
$key_status = nextgenthemes_api_action( $products[ $product ]['id'], $key, $action );
nextgenthemes_update_key_status( $product, $key_status );
}
function nextgenthemes_get_defined_key( $slug ) {
$constant_name = str_replace( '-', '_', strtoupper( $slug . '_KEY' ) );
if ( defined( $constant_name ) && constant( $constant_name ) ) {
return constant( $constant_name );
} else {
return false;
}
}
function nextgenthemes_licenses_page() {
?>
<div class="wrap">
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
<form method="post" action="options.php">
<?php do_settings_sections( 'nextgenthemes-licenses' ); ?>
<?php settings_fields( 'nextgenthemes' ); ?>
<?php submit_button( __( 'Save Changes' ), 'primary', 'submit', false ); ?>
</form>
</div>
<?php
}
function nextgenthemes_init_edd_updaters() {
$products = nextgenthemes_get_products();
foreach ( $products as $product ) {
if ( 'plugin' === $product['type'] && ! empty( $product['file'] ) ) {
nextgenthemes_init_plugin_updater( $product );
} elseif ( 'theme' === $product['type'] ) {
nextgenthemes_init_theme_updater( $product );
}
}
}
function nextgenthemes_init_plugin_updater( $product ) {
// setup the updater
new Nextgenthemes_Plugin_Updater(
apply_filters( 'nextgenthemes_api_url', 'https://nextgenthemes.com' ),
$product['file'],
array(
'version' => $product['version'],
'license' => nextgenthemes_get_key( $product['slug'] ),
'item_id' => $product['id'],
'author' => $product['author']
)
);
}
function nextgenthemes_init_theme_updater( $product ) {
new EDD_Theme_Updater(
array(
'remote_api_url' => 'https://nextgenthemes.com',
'version' => $product['version'],
'license' => nextgenthemes_get_key( $product['slug'] ),
'item_id' => $product['name'],
'author' => $product['id'],
'theme_slug' => $product['slug'],
'download_id' => $product['download_id'], // Optional, used for generating a license renewal link
#'renew_url' => $product['renew_link'], // Optional, allows for a custom license renewal link
),
array(
'theme-license' => __( 'Theme License', ARVE_SLUG ),
'enter-key' => __( 'Enter your theme license key.', ARVE_SLUG ),
'license-key' => __( 'License Key', ARVE_SLUG ),
'license-action' => __( 'License Action', ARVE_SLUG ),
'deactivate-license' => __( 'Deactivate License', ARVE_SLUG ),
'activate-license' => __( 'Activate License', ARVE_SLUG ),
'status-unknown' => __( 'License status is unknown.', ARVE_SLUG ),
'renew' => __( 'Renew?', ARVE_SLUG ),
'unlimited' => __( 'unlimited', ARVE_SLUG ),
'license-key-is-active' => __( 'License key is active.', ARVE_SLUG ),
'expires%s' => __( 'Expires %s.', ARVE_SLUG ),
'expires-never' => __( 'Lifetime License.', ARVE_SLUG ),
'%1$s/%2$-sites' => __( 'You have %1$s / %2$s sites activated.', ARVE_SLUG ),
'license-key-expired-%s' => __( 'License key expired %s.', ARVE_SLUG ),
'license-key-expired' => __( 'License key has expired.', ARVE_SLUG ),
'license-keys-do-not-match' => __( 'License keys do not match.', ARVE_SLUG ),
'license-is-inactive' => __( 'License is inactive.', ARVE_SLUG ),
'license-key-is-disabled' => __( 'License key is disabled.', ARVE_SLUG ),
'site-is-inactive' => __( 'Site is inactive.', ARVE_SLUG ),
'license-status-unknown' => __( 'License status is unknown.', ARVE_SLUG ),
'update-notice' => __( "Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.", ARVE_SLUG ),
'update-available' => __( '<strong>%1$s %2$s</strong> is available. <a href="%3$s" class="thickbox" title="%4$s">Check out what\'s new</a> or <a href="%5$s"%6$s>update now</a>.', ARVE_SLUG ),
)
);
}
function nextgenthemes_api_action( $item_id, $key, $action ) {
if ( ! in_array( $action, array( 'activate', 'deactivate', 'check' ), true ) ) {
wp_die( 'invalid action' );
}
// data to send in our API request
$api_params = array(
'edd_action' => $action . '_license',
'license' => sanitize_text_field( $key ),
'item_id' => $item_id,
'url' => home_url()
);
// Call the custom API.
$response = wp_remote_post(
'https://nextgenthemes.com',
array(
'timeout' => 15,
'sslverify' => true,
'body' => $api_params
)
);
// make sure the response came back okay
if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
if ( is_wp_error( $response ) ) {
$message = $response->get_error_message();
} else {
$message = __( 'An error occurred, please try again.', ARVE_SLUG );
}
} else {
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
if ( false === $license_data->success ) {
switch ( $license_data->error ) {
case 'expired':
$message = sprintf(
__( 'Your license key expired on %s.' ),
date_i18n( get_option( 'date_format' ), strtotime( $license_data->expires, current_time( 'timestamp' ) ) )
);
break;
case 'revoked':
$message = __( 'Your license key has been disabled.', ARVE_SLUG );
break;
case 'missing':
$message = __( 'Invalid license.', ARVE_SLUG );
break;
case 'invalid':
case 'site_inactive':
$message = __( 'Your license is not active for this URL.', ARVE_SLUG );
break;
case 'item_name_mismatch':
$message = sprintf( __( 'This appears to be an invalid license key for %s.' ), ARVE_SLUG );
break;
case 'no_activations_left':
$message = __( 'Your license key has reached its activation limit.', ARVE_SLUG );
break;
default:
$message = __( 'An error occurred, please try again.', ARVE_SLUG );
break;
}
}
}
if ( empty( $message ) ) {
if ( empty( $license_data->license ) ) {
$textarea_dump = arve_textarea_dump( $response );
$message = sprintf(
__( 'Error. Please report the following:<br> %s', ARVE_SLUG ),
$textarea_dump
);
} else {
$message = $license_data->license;
}
}
return $message;
}
function arve_dump( $var ) {
ob_start();
var_dump( $var ); // phpcs:ignore
return ob_get_clean();
}
function arve_textarea_dump( $var ) {
return sprintf( '<textarea style="width: 100%; height: 70vh;">%s</textarea>', esc_textarea( arve_dump( $var ) ) );
}
@@ -0,0 +1,60 @@
<?php
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.PHP.DevelopmentFunctions.error_log_var_dump
?>
<textarea style="font-family: monospace; width: 100%" rows="25">
ARVE Version: <?php echo $arve_version . "\n"; ?>
ARVE-Pro Version: <?php echo $arve_pro_version . "\n"; ?>
WordPress Version: <?php echo $wp_version . "\n"; ?>
PHP Version: <?php echo phpversion() . "\n"; ?>
ACTIVE PLUGINS:
<?php
$get_plugins = get_plugins();
$active_plugins = get_option( 'active_plugins', array() );
foreach ( $get_plugins as $plugin_path => $plugin ) {
// If the plugin isn't active, don't show it.
if ( ! in_array( $plugin_path, $active_plugins, true ) ) {
continue;
}
echo $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
}
if ( is_multisite() ) :
?>
NETWORK ACTIVE PLUGINS:
<?php
$netw_plugins = wp_get_active_network_plugins();
$active_plugins = get_site_option( 'active_sitewide_plugins', array() );
foreach ( $netw_plugins as $plugin_path ) {
$plugin_base = plugin_basename( $plugin_path );
// If the plugin isn't active, don't show it.
if ( ! array_key_exists( $plugin_base, $active_plugins ) ) {
continue;
}
$plugin = get_plugin_data( $plugin_path );
echo $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
}
endif;
?>
ARVE OPTIONS:
<?php var_dump( get_option( 'arve_options_main' ) ); ?>
<?php var_dump( get_option( 'arve_options_params' ) ); ?>
<?php var_dump( get_option( 'arve_options_shortcodes' ) ); ?>
<?php if ( is_plugin_active( 'arve-pro/arve-pro.php' ) ) : ?>
ARVE PRO OPTIONS:
<?php
$pro_options = get_option( 'arve_options_pro' );
unset( $pro_options['key'] );
var_dump( $pro_options );
?>
<?php endif; ?>
</textarea>
@@ -0,0 +1,75 @@
<?php
/**
* Represents the view for the administration dashboard.
*
* This includes the header, options, and other information that should provide
* The User Interface to the end user.
*
* @package Advanced_Responsive_Video_Embedder
* @author Nicolas Jonas
* @license GPL-3.0+
* @link http://nextgenthemes.com
* @copyright 2013 Nicolas Jonas
*/
$options = arve_get_options();
?>
<div class="wrap arve-options-wrap">
<?php if ( arve_display_pro_ad() ) : ?>
<div class="arve-settings-page-ad notice is-dismissible updated">
<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>
<div class="arve-corner-spacer"></div>
<h3>Please rate</h3>
It would really help to get a <a href="https://wordpress.org/support/plugin/advanced-responsive-video-embedder/reviews/#new-post">5 star rating from you.</a>
<h3><a href="https://nextgenthemes.com/plugins/arve-pro/">Pro Addon</a></h3>
<strong><big>10% off</big></strong> first year with discount code <code>settingspage</code></p>
<p>This plugin is financed by purchases of the <a href="https://nextgenthemes.com/plugins/arve-pro/">Pro Addon</a>. The development and support of this plugins has become a job for me so I hope you understand that I can not make all features gratis and that you <a href="https://nextgenthemes.com/plugins/arve-pro/">purchase it</a> to get extra features and support the development.</p>
<ul>
<li><strong>Disable links in embeds (killer feature!)</strong><br>
For example: Clicking on a title in a YouTube embed will not open a new popup/tab/window. <strong>Prevent video hosts to lead your visitors away from your site!</strong> Note this also breaks sharing functionality and is not possible when the provider requires flash. Try it on <a href="https://nextgenthemes.com/plugins/arve-pro/">this page</a>. Right click on links still works.</li>
<li><strong>Lazyload mode</strong><br>
Make your site load <strong>faster</strong> by loading only a image instead of the entire video player on pageload. </li>
<li><strong>Lazyload -> Lightbox</strong><br>
Shows the Video in a Lightbox after clicking a preview image</li>
<li><strong>Link -> Lightbox</strong><br>
Use simple links as triggers for lightboxed videos</li>
<li>Automatic or custom thumbnail images</li>
<li>Automatic or custom titles on top of your thumbnails</li>
<li>'Expand on click' feature</li>
<li>3 hover styles</li>
<li>2 play icon styles to choose from</li>
<li>Responsive thumbnails using cutting edge HTML5 technology</li>
<li><strong>Feel good about yourself</strong><br>
for supporting my 5+ years work on this plugin. Tons of hours, weekends … always worked on improving it.</li>
<li>Show the latest video of a YouTube channel by using the channel URL (updated/cached hourly)</li>
<li><strong><a href="https://nextgenthemes.com/plugins/arve-pro/">Get the ARVE Pro Addon</a></strong></li>
</ul>
</div>
<?php endif; ?>
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
<h2 class="nav-tab-wrapper arve-settings-tabs"></h2>
<form class="arve-options-form" method="post" action="options.php">
<?php do_settings_sections( ARVE_SLUG ); ?>
<?php settings_fields( 'arve-settings-group' ); ?>
<input type="hidden" id="arve_options_main[last_settings_tab]" name="arve_options_main[last_settings_tab]" value="<?php echo esc_attr( $options['last_settings_tab'] ); ?>">
</form>
</div>
@@ -0,0 +1 @@
<?php // Silence is golden
@@ -0,0 +1,14 @@
<ul class="arve-list-small">
<li><strong>Disable links in embeds</strong><br>
For example: Clicking on a title in a YouTube embed will not open a new popup/tab/window. <strong>Prevent video hosts to lead your visitors away from your site!</strong> Note this also breaks sharing functionality and is not possible when the provider requires flash.</li>
<li><strong>Lazyload mode</strong><br>
Make your site load <strong>faster</strong> by loading only a image instead of the entire video player on pageload. </li>
<li><strong>Lazyload -> Lightbox</strong><br>
Shows the Video in a Lightbox after clicking a preview image</li>
<li><strong>Link -> Lightbox</strong><br>
Use simple links as triggers for lightboxed videos</li>
<li>Automatic or custom titles and thumbnails images</li>
<li>'Expand on click' feature</li>
<li>Show the latest video of a YouTube channel by using the channel URL (updated/cached hourly)</li>
<li>And more, for a <strong><a href="https://nextgenthemes.com/plugins/arve-pro/">complete feature list</a></strong> and purchase please visit the <strong><a href="https://nextgenthemes.com/plugins/arve-pro/">official site</a></strong></li>
</ul>
File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 63 KiB

@@ -0,0 +1,105 @@
<?php
/**
* Plugin Name: ARVE Advanced Responsive Video Embedder
* Plugin URI: https://nextgenthemes.com/plugins/arve-pro/
* Description: Easy responsive video embeds via URL (like WordPress) or Shortcodes. Supports almost anything you can imagine.
* Version: 8.10.17
* Author: Nicolas Jonas
* Author URI: https://nextgenthemes.com
* License: GPL-3.0
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: advanced-responsive-video-embedder
* Domain Path: /languages
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
define( 'ARVE_SLUG', 'advanced-responsive-video-embedder' );
define( 'ARVE_VERSION', '8.10.12' );
define( 'ARVE_PRO_VERSION_REQUIRED', '4.2.5' );
define( 'ARVE_URL', plugin_dir_url( __FILE__ ) );
define( 'ARVE_PUBLIC_URL', ARVE_URL . 'public/' );
define( 'ARVE_ADMIN_URL', ARVE_URL . 'admin/' );
define( 'ARVE_PATH', plugin_dir_path( __FILE__ ) );
define( 'ARVE_NUM_TRACKS', 10 );
arve_init();
function arve_init() {
add_option( 'arve_install_date', current_time( 'timestamp' ) );
require_once __DIR__ . '/admin/class-arve-admin-notice-factory.php';
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
add_action( 'admin_init', 'arve_php_outdated_message' );
return;
}
require_once __DIR__ . '/admin/class-nextgenthemes-plugin-updater.php';
require_once __DIR__ . '/admin/functions-licensing.php';
require_once __DIR__ . '/admin/functions-admin.php';
require_once __DIR__ . '/public/functions-enqueue.php';
require_once __DIR__ . '/public/functions-html-output.php';
require_once __DIR__ . '/public/functions-misc.php';
require_once __DIR__ . '/public/functions-shortcode-data.php';
require_once __DIR__ . '/public/functions-shortcode-filters.php';
require_once __DIR__ . '/public/functions-shortcodes.php';
require_once __DIR__ . '/public/functions-thumbnails.php';
require_once __DIR__ . '/public/functions-url-handlers.php';
require_once __DIR__ . '/public/functions-validation.php';
require_once __DIR__ . '/shared/functions-shared.php';
add_action( 'plugins_loaded', 'arve_load_plugin_textdomain' );
# Public hooks
add_action( 'plugins_loaded', 'arve_create_shortcodes', 999 );
add_action( 'plugins_loaded', 'arve_create_url_handlers', 999 );
add_action( 'plugins_loaded', 'arve_oembed_remove_providers', 998 );
add_action( 'wp_enqueue_scripts', 'arve_register_styles', 0 );
add_action( 'wp_enqueue_scripts', 'arve_register_scripts', 0 );
add_action( 'wp_enqueue_scripts', 'arve_maybe_enqueue_assets' );
add_action( 'wp_video_shortcode_override', 'arve_wp_video_shortcode_override', 10, 4 );
add_filter( 'widget_text', 'do_shortcode' );
add_filter( 'language_attributes', 'arve_html_id' );
add_filter( 'shortcode_atts_arve', 'arve_sc_filter_sanitise', -12 );
add_filter( 'shortcode_atts_arve', 'arve_sc_filter_detect_provider_and_id_from_url', -10 );
add_filter( 'shortcode_atts_arve', 'arve_sc_filter_detect_youtube_playlist', -8 );
add_filter( 'shortcode_atts_arve', 'arve_sc_filter_get_media_gallery_video', -7 );
add_filter( 'shortcode_atts_arve', 'arve_sc_filter_detect_html5', -6 );
add_filter( 'shortcode_atts_arve', 'arve_sc_filter_iframe_fallback', -4 );
add_filter( 'shortcode_atts_arve', 'arve_sc_filter_validate', -2 );
add_filter( 'shortcode_atts_arve', 'arve_sc_filter_get_media_gallery_thumbnail', 0 );
add_filter( 'shortcode_atts_arve', 'arve_sc_filter_set_fixed_dimensions', 15 );
add_filter( 'shortcode_atts_arve', 'arve_sc_filter_attr', 20 );
add_filter( 'shortcode_atts_arve', 'arve_sc_filter_build_tracks_html', 20 );
# Admin Hooks
add_action( 'admin_enqueue_scripts', 'arve_admin_enqueue_scripts' );
add_action( 'admin_enqueue_scripts', 'arve_admin_enqueue_styles', 99 );
add_action( 'admin_init', 'arve_action_admin_init_setup_messages' );
add_action( 'admin_init', 'arve_register_settings_debug', 99 );
add_action( 'admin_init', 'arve_register_settings' );
add_action( 'admin_menu', 'arve_add_plugin_admin_menu' );
add_action( 'media_buttons', 'arve_add_media_button', 11 );
add_action( 'register_shortcode_ui', 'arve_register_shortcode_ui' );
add_action( 'wp_dashboard_setup', 'arve_add_dashboard_widget' );
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'arve_add_action_links' );
add_filter( 'mce_css', 'arve_mce_css' );
}
function arve_php_outdated_message() {
$msg = sprintf(
__( 'ARVE requres at least PHP version 5.3! Your PHP version is %s and has reached End Of Life (insecure and slow). You should ask your host to update it for you not only to make ARVE work but to make your site faster and more secure. Wordpress.org recommends PHP 7.0, I use 7.1 at nextgenthemes.com', ARVE_SLUG ),
PHP_VERSION
);
new ARVE_Admin_Notice_Factory( 'arve-php-outdated', "<p>$msg</p>", false );
}
@@ -0,0 +1,71 @@
#arve .arve-wrapper,
#tinymce .arve-wrapper {
display: block;
margin-bottom: 1.5em;
width: 100%;
}
#arve .arve-wrapper::after,
#tinymce .arve-wrapper::after {
content: "";
display: table;
clear: both;
}
#arve .arve-wrapper.alignright,
#tinymce .arve-wrapper.alignright {
margin-top: .4em;
margin-left: 1.5em;
}
#arve .arve-wrapper.alignleft,
#tinymce .arve-wrapper.alignleft {
margin-top: .4em;
margin-right: 1.5em;
}
#arve .arve-embed-container,
#tinymce .arve-embed-container {
position: relative;
display: block;
padding: 0;
padding-bottom: 56.25%;
margin: 0;
height: 0;
overflow: hidden;
}
#arve .arve-thumbnail,
#tinymce .arve-thumbnail,
#arve .arve-play-btn,
#tinymce .arve-play-btn,
#arve .arve-iframe,
#tinymce .arve-iframe {
position: absolute;
padding: 0;
margin: 0;
top: 0;
left: 0;
bottom: 0;
height: 100%;
width: 100%;
border: 0;
}
#arve .arve-video,
#tinymce .arve-video {
padding: 0;
margin: 0;
width: 100%;
}
#arve .arve-promote-link,
#tinymce .arve-promote-link {
float: right;
font-family: "Open Sans", "Sagoe UI", "Arvo", "Lato", Arial, sans-serif;
font-size: .8em;
}
.arve-hidden {
display: none !important;
}
@@ -0,0 +1,50 @@
(function ($) {
'use strict';
function remove_unwanted_stuff() {
$('.arve-wrapper').find('p, .video-wrap, .fluid-width-video-wrapper, .fluid-vids').contents().unwrap();
$('.arve-wrapper br').remove();
$('.arve-iframe, .arve-video').removeAttr('width height style');
$('.wp-block-embed').each( function( index ) {
if ( $(this).has('.arve-wrapper') ) {
$(this).removeClass( 'wp-embed-aspect-16-9 wp-has-aspect-ratio' );
if ( $(this).has('.wp-block-embed__wrapper') ) {
$(this).find('.wp-block-embed__wrapper').contents().unwrap();
}
}
} );
};
function global_id() {
if ( $( 'html[id="arve"]' ).length ) {
return;
}
if ( $( 'html[id]' ).length <= 0 ) {
$( 'html' ).attr( 'id', 'arve' );
} else if ( $( 'body[id]' ).length <= 0 ) {
$( 'body' ).attr( 'id', 'arve' );
} else {
$( 'body' ).wrapInner( '<div id="arve">' );
}
}
remove_unwanted_stuff();
global_id();
$( document ).ready( function() {
remove_unwanted_stuff();
global_id();
} );
}(jQuery));
@@ -0,0 +1 @@
#arve .arve-wrapper,#tinymce .arve-wrapper{display:block;margin-bottom:1.5em;width:100%}#arve .arve-wrapper::after,#tinymce .arve-wrapper::after{content:"";display:table;clear:both}#arve .arve-wrapper.alignright,#tinymce .arve-wrapper.alignright{margin-top:.4em;margin-left:1.5em}#arve .arve-wrapper.alignleft,#tinymce .arve-wrapper.alignleft{margin-top:.4em;margin-right:1.5em}#arve .arve-embed-container,#tinymce .arve-embed-container{position:relative;display:block;padding:0;padding-bottom:56.25%;margin:0;height:0;overflow:hidden}#arve .arve-iframe,#arve .arve-play-btn,#arve .arve-thumbnail,#tinymce .arve-iframe,#tinymce .arve-play-btn,#tinymce .arve-thumbnail{position:absolute;padding:0;margin:0;top:0;left:0;bottom:0;height:100%;width:100%;border:0}#arve .arve-video,#tinymce .arve-video{padding:0;margin:0;width:100%}#arve .arve-promote-link,#tinymce .arve-promote-link{float:right;font-family:"Open Sans","Sagoe UI",Arvo,Lato,Arial,sans-serif;font-size:.8em}.arve-hidden{display:none!important}
@@ -0,0 +1 @@
!function(r){"use strict";function e(){r(".arve-wrapper").find("p, .video-wrap, .fluid-width-video-wrapper, .fluid-vids").contents().unwrap(),r(".arve-wrapper br").remove(),r(".arve-iframe, .arve-video").removeAttr("width height style"),r(".wp-block-embed").each(function(e){r(this).has(".arve-wrapper")&&(r(this).removeClass("wp-embed-aspect-16-9 wp-has-aspect-ratio"),r(this).has(".wp-block-embed__wrapper")&&r(this).find(".wp-block-embed__wrapper").contents().unwrap())})}function t(){r('html[id="arve"]').length||(r("html[id]").length<=0?r("html").attr("id","arve"):r("body[id]").length<=0?r("body").attr("id","arve"):r("body").wrapInner('<div id="arve">'))}e(),t(),r(document).ready(function(){e(),t()})}(jQuery);
@@ -0,0 +1,39 @@
<?php
function arve_register_styles() {
$min = arve_get_min_suffix();
wp_register_style(
ARVE_SLUG,
ARVE_PUBLIC_URL . "arve$min.css",
array(),
ARVE_VERSION
);
}
function arve_register_scripts() {
$min = arve_get_min_suffix();
wp_register_script(
ARVE_SLUG,
ARVE_PUBLIC_URL . "arve$min.js",
array( 'jquery' ),
ARVE_VERSION,
true
);
}
function arve_maybe_enqueue_assets() {
$options = arve_get_options();
if ( $options['always_enqueue_assets'] ) {
wp_enqueue_style( ARVE_SLUG );
wp_enqueue_script( ARVE_SLUG );
wp_enqueue_style( 'arve-pro' );
wp_enqueue_script( 'arve-pro' );
}
}
@@ -0,0 +1,253 @@
<?php
function arve_html_id( $html_attr ) {
if ( ! arve_contains( $html_attr, 'id=' ) ) {
$html_attr .= ' id="arve"';
}
return $html_attr;
}
function arve_get_var_dump( $var ) {
ob_start();
var_dump( $var ); // phpcs:ignore
return ob_get_clean();
};
function arve_get_debug_info( $input_html, $atts, $input_atts ) {
$html = '';
// phpcs:disable WordPress.Security.NonceVerification.Recommended
if ( isset( $_GET['arve-debug-options'] ) ) {
static $show_options_debug = true;
$options = get_option( 'arve_options_main' );
$options['shortcodes'] = get_option( 'arve_options_shortcodes' );
$options['params'] = get_option( 'arve_options_params' );
if ( $show_options_debug ) {
$html .= sprintf( 'Options: <pre>%s</pre>', arve_get_var_dump( $options ) );
}
$show_options_debug = false;
}
$pre_style = ''
. 'background-color: #111;'
. 'color: #eee;'
. 'font-size: 15px;'
. 'white-space: pre-wrap;'
. 'word-wrap: break-word;';
if ( ! empty( $_GET['arve-debug-attr'] ) ) {
$html .= sprintf(
'<pre style="%s">attr[%s]: %s</pre>',
esc_attr( $pre_style ),
esc_html( $_GET['arve-debug-attr'] ),
arve_get_var_dump( $atts[ $_GET['arve-debug-attr'] ] )
);
}
if ( isset( $_GET['arve-debug-atts'] ) ) {
$html .= sprintf( '<pre style="%s">$atts: %s</pre>', esc_attr( $pre_style ), arve_get_var_dump( $input_atts ) );
$html .= sprintf( '<pre style="%s">$arve: %s</pre>', esc_attr( $pre_style ), arve_get_var_dump( $atts ) );
}
if ( isset( $_GET['arve-debug-html'] ) ) {
$html .= sprintf( '<pre style="%s"">%s</pre>', esc_attr( $pre_style ), esc_html( $input_html ) );
}
// phpcs:enable WordPress.Security.NonceVerification.Recommended
return $html;
}
function arve_build_meta_html( $a ) {
$meta = '';
if ( ! empty( $a['sources'] ) ) {
$first_source = arve_get_first_array_value( $a['sources'] );
$meta .= sprintf( '<meta itemprop="contentURL" content="%s">', esc_attr( $first_source['src'] ) );
}
if ( ! empty( $a['iframe_src'] ) ) {
$meta .= sprintf( '<meta itemprop="embedURL" content="%s">', esc_attr( $a['iframe_src'] ) );
}
if ( ! empty( $a['upload_date'] ) ) {
$meta .= sprintf( '<meta itemprop="uploadDate" content="%s">', esc_attr( $a['upload_date'] ) );
}
if ( ! empty( $a['duration'] ) ) {
$meta .= sprintf( '<meta itemprop="duration" content="PT%s">', esc_attr( $a['duration'] ) );
}
if ( ! empty( $a['img_src'] ) ) :
$thumbnail = sprintf( '<meta itemprop="thumbnailUrl" content="%s">', esc_attr( $a['img_src'] ) );
$meta .= arve_build_tag(
array(
'name' => 'thumbnail',
'tag' => 'meta',
'attr' => array(
'itemprop' => 'thumbnailUrl',
'content' => $a['img_src'],
),
),
$a
);
endif;
if ( ! empty( $a['title'] ) ) {
$meta .= arve_build_tag(
array(
'name' => 'title',
'tag' => 'meta',
'attr' => array(
'itemprop' => 'name',
'content' => trim( $a['title'] ),
)
),
$a
);
}
if ( ! empty( $a['description'] ) ) {
$meta .= sprintf( '<span itemprop="description" class="arve-description arve-hidden">%s</span>', esc_html( trim( $a['description'] ) ) );
}
return $meta;
}
function arve_build_tag( $args, $a ) {
$args = apply_filters( "nextgenthemes/arve/{$args['name']}", $args, $a );
if ( ! empty( $args['content'] ) ) {
$out = sprintf(
'<%1$s%2$s>%3$s</%1$s>',
esc_html( $args['tag'] ),
arve_attr( $args['attr'] ),
$args['content']
);
} else {
$out = sprintf(
'<%s%s>',
esc_html( $args['tag'] ),
arve_attr( $args['attr'] )
);
}
return $out;
}
function arve_build_promote_link_html( $arve_link ) {
if ( $arve_link ) {
return sprintf(
'<a href="%s" title="%s" class="arve-promote-link" target="_blank">%s</a>',
esc_url( 'https://nextgenthemes.com/plugins/arve-pro/' ),
esc_attr( __( 'Embedded with ARVE Advanced Responsive Video Embedder WordPress plugin', ARVE_SLUG ) ),
esc_html__( 'ARVE', ARVE_SLUG )
);
}
return '';
}
function arve_arve_embed_container( $html, $atts ) {
$attr['class'] = 'arve-embed-container';
if ( false === $atts['aspect_ratio'] ) {
$attr['style'] = 'height:auto;padding:0';
} else {
$attr['style'] = sprintf( 'padding-bottom:%F%%', arve_aspect_ratio_to_percentage( $atts['aspect_ratio'] ) );
}
return sprintf( '<div%s>%s</div>', arve_attr( $attr ), $html );
}
function arve_arve_wrapper( $html, $atts ) {
$element = ( 'link-lightbox' === $atts['mode'] ) ? 'span' : 'div';
return sprintf(
'<%s%s>%s</%s>',
$element,
arve_attr( $atts['wrapper_attr'] ),
$html,
$element
);
}
function arve_video_or_iframe( $atts ) {
switch ( $atts['provider'] ) {
case 'html5':
return arve_create_video_tag( $atts );
default:
return arve_create_iframe_tag( $atts );
}
}
/**
*
*
* @since 2.6.0
*/
function arve_create_iframe_tag( $a ) {
if ( in_array( $a['mode'], array( 'lazyload', 'lazyload-lightbox', 'link-lightbox' ), true ) ) {
$html = sprintf(
'<span class="arve-lazyload"%s></span>',
arve_attr( arve_prefix_array_keys( 'data-', $a['iframe_attr'] ) )
);
} else {
$html = sprintf( '<iframe%s></iframe>', arve_attr( $a['iframe_attr'] ) );
}
return apply_filters( 'arve_iframe_tag', $html, $a, $a['iframe_attr'] );
}
function arve_create_video_tag( $a ) {
$html = sprintf(
'<video%s>%s%s</video>',
arve_attr( $a['video_attr'] ),
$a['video_sources_html'],
$a['video_tracks_html']
);
return apply_filters( 'arve_video_tag', $html, $a, $a['video_attr'] );
}
function arve_error( $message ) {
return sprintf(
'<p><strong>%s</strong> %s</p>',
__( '<abbr title="Advanced Responsive Video Embedder">ARVE</abbr> Error:', ARVE_SLUG ),
$message
);
}
function arve_output_errors( $atts ) {
$errors = '';
foreach ( $atts as $key => $value ) {
if ( is_wp_error( $value ) ) {
$errors .= arve_error( $value->get_error_message() );
}
}
return $errors;
}
@@ -0,0 +1,152 @@
<?php
function arve_is_bool_option( $array ) {
$yes_no = array(
'' => 1,
'yes' => 1,
'no' => 1
);
$check = array_diff_key( $array, $yes_no );
if ( empty( $check ) ) {
return 'bool';
} else {
return $array;
}
}
function arve_get_pre_style() {
return '';
}
function arve_load_plugin_textdomain() {
load_plugin_textdomain(
ARVE_SLUG,
false,
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
);
}
function arve_get_first_array_value( $array ) {
reset( $array );
$key = key( $array );
return $array[ $key ];
}
function arve_prefix_array_keys( $keyprefix, $array ) {
foreach ( $array as $key => $value ) {
$array[ $keyprefix . $key ] = $value;
unset( $array[ $key ] );
}
return $array;
}
function arve_check_filetype( $url, $ext ) {
$check = wp_check_filetype( $url, wp_get_mime_types() );
if ( strtolower( $check['ext'] ) === $ext ) {
return $check['type'];
} else {
return false;
}
}
/**
* Calculates seconds based on youtube times
*
* @param string $yttime The '1h25m13s' part of youtube URLs
*
* @return int Starttime in seconds
*/
function arve_youtube_time_to_seconds( $yttime ) {
$format = false;
$hours = 0;
$minutes = 0;
$seconds = 0;
$pattern['hms'] = '/([0-9]+)h([0-9]+)m([0-9]+)s/'; // hours, minutes, seconds
$pattern['ms'] = '/([0-9]+)m([0-9]+)s/'; // minutes, seconds
$pattern['h'] = '/([0-9]+)h/';
$pattern['m'] = '/([0-9]+)m/';
$pattern['s'] = '/([0-9]+)s/';
foreach ( $pattern as $key => $value ) {
preg_match( $value, $yttime, $result );
if ( ! empty( $result ) ) {
$format = $key;
break;
}
}
switch ( $format ) {
case 'hms':
$hours = $result[1];
$minutes = $result[2];
$seconds = $result[3];
break;
case 'ms':
$minutes = $result[1];
$seconds = $result[2];
break;
case 'h':
$hours = $result[1];
break;
case 'm':
$minutes = $result[1];
break;
case 's':
$seconds = $result[1];
break;
default:
return false;
}
return ( $hours * 60 * 60 ) + ( $minutes * 60 ) + $seconds;
}
/**
* Calculates padding percentage value for a particular aspect ratio
*
* @since 4.2.0
*
* @param string $aspect_ratio '4:3' or percentage value with percent sign
*
* @return float
*/
function arve_aspect_ratio_to_percentage( $aspect_ratio ) {
if ( is_wp_error( $aspect_ratio ) ) {
return 52.25;
}
$a = explode( ':', $aspect_ratio );
return ( ( $a[1] / $a[0] ) * 100 );
}
/**
* Calculates
*
* @since 8.2.0
*/
function arve_calculate_height( $width, $aspect_ratio ) {
$width = (int) $width;
$aspect_ratio = empty( $aspect_ratio ) ? '16:9' : $aspect_ratio;
$percent = arve_aspect_ratio_to_percentage( $aspect_ratio );
if ( $width > 100 && $percent ) {
return ( ( $width / 100 ) * $percent );
}
return false;
}
@@ -0,0 +1,298 @@
<?php
function arve_get_default_aspect_ratio( $aspect_ratio, $provider ) {
$properties = arve_get_host_properties();
if ( empty( $aspect_ratio ) ) {
return $properties[ $provider ]['aspect_ratio'];
}
return $aspect_ratio;
}
function arve_get_html5_attributes() {
return array( 'mp4', 'm4v', 'webm', 'ogv', 'ogg', 'ogm' );
}
function arve_url_query_array( $url ) {
$url = wp_parse_url( $url );
if ( empty( $url['query'] ) ) {
return array();
}
parse_str( $url['query'], $url_params );
return $url_params;
}
function arve_build_iframe_src( $atts ) {
$id = $atts['id'];
$lang = $atts['lang'];
$provider = $atts['provider'];
$options = arve_get_options();
$properties = arve_get_host_properties();
if ( $options['youtube_nocookie'] ) {
$properties['youtube']['embed_url'] = 'https://www.youtube-nocookie.com/embed/%s';
$properties['youtubelist']['embed_url'] = 'https://www.youtube-nocookie.com/embed/videoseries?list=%s';
}
if ( isset( $properties[ $provider ]['embed_url'] ) ) {
$pattern = $properties[ $provider ]['embed_url'];
} else {
$pattern = '%s';
}
if ( 'facebook' === $provider && is_numeric( $id ) ) {
$id = "https://www.facebook.com/facebook/videos/$id/";
} elseif ( 'twitch' === $provider && is_numeric( $id ) ) {
$pattern = 'https://player.twitch.tv/?video=v%s';
} elseif ( 'ted' === $provider && preg_match( '/^[a-z]{2}$/', $lang ) === 1 ) {
$pattern = 'https://embed-ssl.ted.com/talks/lang/' . $lang . '/%s.html';
}
if ( isset( $properties[ $provider ]['url_encode_id'] ) && $properties[ $provider ]['url_encode_id'] ) {
$id = rawurlencode( $id );
}
if ( 'brightcove' === $provider ) {
$src = sprintf( $pattern, $atts['brightcove_account'], $atts['brightcove_player'], $atts['brightcove_embed'], $id );
} else {
$src = sprintf( $pattern, $id );
}
return $src;
}
function arve_id_fixes( $id, $provider ) {
if (
'liveleak' === $provider &&
! arve_starts_with( $id, 'i=' ) &&
! arve_starts_with( $id, 'f=' )
) {
$id = 'i=' . $id;
}
return $id;
}
function arve_aspect_ratio_fixes( $aspect_ratio, $provider, $mode ) {
if ( 'dailymotionlist' === $provider ) {
switch ( $mode ) {
case 'normal':
case 'lazyload':
$aspect_ratio = '640:370';
break;
}
}
return $aspect_ratio;
}
function arve_add_autoplay_query_arg( $src, $a ) {
switch ( $a['provider'] ) {
case 'alugha':
case 'archiveorg':
case 'dailymotion':
case 'dailymotionlist':
case 'facebook':
case 'vevo':
case 'viddler':
case 'vimeo':
case 'youtube':
case 'youtubelist':
$on = add_query_arg( 'autoplay', 1, $src );
$off = add_query_arg( 'autoplay', 0, $src );
break;
case 'twitch':
case 'ustream':
$on = add_query_arg( 'autoplay', 'true', $src );
$off = add_query_arg( 'autoplay', 'false', $src );
break;
case 'livestream':
case 'wistia':
$on = add_query_arg( 'autoPlay', 'true', $src );
$off = add_query_arg( 'autoPlay', 'false', $src );
break;
case 'metacafe':
$on = add_query_arg( 'ap', 1, $src );
$off = remove_query_arg( 'ap', $src );
break;
case 'videojug':
$on = add_query_arg( 'ap', 1, $src );
$off = add_query_arg( 'ap', 0, $src );
break;
case 'veoh':
$on = add_query_arg( 'videoAutoPlay', 1, $src );
$off = add_query_arg( 'videoAutoPlay', 0, $src );
break;
case 'brightcove':
case 'snotr':
$on = add_query_arg( 'autoplay', 1, $src );
$off = remove_query_arg( 'autoplay', $src );
break;
case 'yahoo':
$on = add_query_arg( 'player_autoplay', 'true', $src );
$off = add_query_arg( 'player_autoplay', 'false', $src );
break;
default:
# Do nothing for providers that to not support autoplay or fail with parameters
$on = $src;
$off = $src;
break;
}
if ( $a['autoplay'] ) {
return $on;
} else {
return $off;
}
}
function arve_add_query_args_to_iframe_src( $src, $atts ) {
$options = arve_get_options();
$host = $atts['provider'];
$parameters = wp_parse_args( preg_replace( '!\s+!', '&', trim( $atts['parameters'] ) ) );
$option_parameters = array();
if ( isset( $options['params'][ $host ] ) ) {
$option_parameters = wp_parse_args( preg_replace( '!\s+!', '&', trim( $options['params'][ $host ] ) ) );
}
$parameters = wp_parse_args( $parameters, $option_parameters );
return add_query_arg( $parameters, $src );
}
function arve_maxwidth_when_aligned( $maxwidth, $align ) {
$options = arve_get_options();
if ( $maxwidth < 100 && in_array( $align, array( 'left', 'right', 'center' ), true ) ) {
$maxwidth = (int) $options['align_maxwidth'];
}
return $maxwidth;
}
function arve_get_language_name_from_code( $lang_code ) {
// This list is based on languages available from localize.drupal.org. See
// http://localize.drupal.org/issues for information on how to add languages
// there.
//
// The "Left-to-right marker" comments and the enclosed UTF-8 markers are to
// make otherwise strange looking PHP syntax natural (to not be displayed in
// right to left). See https://www.drupal.org/node/128866#comment-528929.
$lang = array(
'af' => array( 'Afrikaans', 'Afrikaans' ),
'am' => array( 'Amharic', 'አማርኛ' ),
'ar' => array( 'Arabic', /* Left-to-right marker "" */ 'العربية', 'RTL' ),
'ast' => array( 'Asturian', 'Asturianu' ),
'az' => array( 'Azerbaijani', 'Azərbaycanca' ),
'be' => array( 'Belarusian', 'Беларуская' ),
'bg' => array( 'Bulgarian', 'Български' ),
'bn' => array( 'Bengali', 'বাংলা' ),
'bo' => array( 'Tibetan', 'བོད་སྐད་' ),
'bs' => array( 'Bosnian', 'Bosanski' ),
'ca' => array( 'Catalan', 'Català' ),
'cs' => array( 'Czech', 'Čeština' ),
'cy' => array( 'Welsh', 'Cymraeg' ),
'da' => array( 'Danish', 'Dansk' ),
'de' => array( 'German', 'Deutsch' ),
'dz' => array( 'Dzongkha', 'རྫོང་ཁ' ),
'el' => array( 'Greek', 'Ελληνικά' ),
'en' => array( 'English', 'English' ),
'en-x-simple' => array( 'Simple English', 'Simple English' ),
'eo' => array( 'Esperanto', 'Esperanto' ),
'es' => array( 'Spanish', 'Español' ),
'et' => array( 'Estonian', 'Eesti' ),
'eu' => array( 'Basque', 'Euskera' ),
'fa' => array( 'Persian, Farsi', /* Left-to-right marker "" */ 'فارسی', 'RTL' ),
'fi' => array( 'Finnish', 'Suomi' ),
'fil' => array( 'Filipino', 'Filipino' ),
'fo' => array( 'Faeroese', 'Føroyskt' ),
'fr' => array( 'French', 'Français' ),
'fy' => array( 'Frisian, Western', 'Frysk' ),
'ga' => array( 'Irish', 'Gaeilge' ),
'gd' => array( 'Scots Gaelic', 'Gàidhlig' ),
'gl' => array( 'Galician', 'Galego' ),
'gsw-berne' => array( 'Swiss German', 'Schwyzerdütsch' ),
'gu' => array( 'Gujarati', 'ગુજરાતી' ),
'he' => array( 'Hebrew', /* Left-to-right marker "" */ 'עברית', 'RTL' ),
'hi' => array( 'Hindi', 'हिन्दी' ),
'hr' => array( 'Croatian', 'Hrvatski' ),
'ht' => array( 'Haitian Creole', 'Kreyòl ayisyen' ),
'hu' => array( 'Hungarian', 'Magyar' ),
'hy' => array( 'Armenian', 'Հայերեն' ),
'id' => array( 'Indonesian', 'Bahasa Indonesia' ),
'is' => array( 'Icelandic', 'Íslenska' ),
'it' => array( 'Italian', 'Italiano' ),
'ja' => array( 'Japanese', '日本語' ),
'jv' => array( 'Javanese', 'Basa Java' ),
'ka' => array( 'Georgian', 'ქართული ენა' ),
'kk' => array( 'Kazakh', 'Қазақ' ),
'km' => array( 'Khmer', 'ភាសាខ្មែរ' ),
'kn' => array( 'Kannada', 'ಕನ್ನಡ' ),
'ko' => array( 'Korean', '한국어' ),
'ku' => array( 'Kurdish', 'Kurdî' ),
'ky' => array( 'Kyrgyz', 'Кыргызча' ),
'lo' => array( 'Lao', 'ພາສາລາວ' ),
'lt' => array( 'Lithuanian', 'Lietuvių' ),
'lv' => array( 'Latvian', 'Latviešu' ),
'mg' => array( 'Malagasy', 'Malagasy' ),
'mk' => array( 'Macedonian', 'Македонски' ),
'ml' => array( 'Malayalam', 'മലയാളം' ),
'mn' => array( 'Mongolian', 'монгол' ),
'mr' => array( 'Marathi', 'मराठी' ),
'ms' => array( 'Bahasa Malaysia', 'بهاس ملايو' ),
'my' => array( 'Burmese', 'ဗမာစကား' ),
'ne' => array( 'Nepali', 'नेपाली' ),
'nl' => array( 'Dutch', 'Nederlands' ),
'nb' => array( 'Norwegian Bokmål', 'Norsk, bokmål' ),
'nn' => array( 'Norwegian Nynorsk', 'Norsk, nynorsk' ),
'oc' => array( 'Occitan', 'Occitan' ),
'pa' => array( 'Punjabi', 'ਪੰਜਾਬੀ' ),
'pl' => array( 'Polish', 'Polski' ),
'pt-pt' => array( 'Portuguese, Portugal', 'Português, Portugal' ),
'pt-br' => array( 'Portuguese, Brazil', 'Português, Brasil' ),
'ro' => array( 'Romanian', 'Română' ),
'ru' => array( 'Russian', 'Русский' ),
'sco' => array( 'Scots', 'Scots' ),
'se' => array( 'Northern Sami', 'Sámi' ),
'si' => array( 'Sinhala', 'සිංහල' ),
'sk' => array( 'Slovak', 'Slovenčina' ),
'sl' => array( 'Slovenian', 'Slovenščina' ),
'sq' => array( 'Albanian', 'Shqip' ),
'sr' => array( 'Serbian', 'Српски' ),
'sv' => array( 'Swedish', 'Svenska' ),
'sw' => array( 'Swahili', 'Kiswahili' ),
'ta' => array( 'Tamil', 'தமிழ்' ),
'ta-lk' => array( 'Tamil, Sri Lanka', 'தமிழ், இலங்கை' ),
'te' => array( 'Telugu', 'తెలుగు' ),
'th' => array( 'Thai', 'ภาษาไทย' ),
'tr' => array( 'Turkish', 'Türkçe' ),
'tyv' => array( 'Tuvan', 'Тыва дыл' ),
'ug' => array( 'Uyghur', 'Уйғур' ),
'uk' => array( 'Ukrainian', 'Українська' ),
'ur' => array( 'Urdu', /* Left-to-right marker "" */ 'اردو', 'RTL' ),
'vi' => array( 'Vietnamese', 'Tiếng Việt' ),
'xx-lolspeak' => array( 'Lolspeak', 'Lolspeak' ),
'zh-hans' => array( 'Chinese, Simplified', '简体中文' ),
'zh-hant' => array( 'Chinese, Traditional', '繁體中文' ),
);
return $lang[ $lang_code ][1];
}
@@ -0,0 +1,435 @@
<?php
function arve_load_vimeo_api( $a ) {
require_once ARVE_PATH . '/vendor/autoload.php';
return $a;
}
function arve_get_wrapper_id( $a ) {
static $wrapper_ids = array();
$wrapper_id = null;
foreach ( array( 'id', 'mp4', 'm4v', 'webm', 'ogv', 'url', 'random_video_url', 'webtorrent' ) as $att ) {
if ( ! empty( $a[ $att ] ) && is_string( $a[ $att ] ) ) {
$wrapper_id = 'arve-' . $a[ $att ];
$wrapper_id = preg_replace( '/[^a-zA-Z0-9-]/', '', $wrapper_id );
break;
}
}
if ( empty( $wrapper_id ) ) {
return null;
} else {
$wrapper_ids[] = $wrapper_id;
}
if ( in_array( $wrapper_id, $wrapper_ids, true ) ) {
$id_counts = array_count_values( $wrapper_ids );
$id_count = $id_counts[ $wrapper_id ];
if ( $id_count >= 2 ) {
$wrapper_id .= '-' . $id_count;
}
}
return $wrapper_id;
}
function arve_sc_filter_attr( $a ) {
$wrapper_id = arve_get_wrapper_id( $a );
if ( empty( $wrapper_id ) ) {
$a['wrapper_id_error'] = new WP_Error( 'wrapper_id', __( 'Wrapper ID could not be build, please report this bug.', ARVE_SLUG ) );
}
$align_class = empty( $a['align'] ) ? '' : ' align' . $a['align'];
$a['wrapper_attr'] = array(
'class' => "arve-wrapper$align_class",
'data-mode' => $a['mode'],
'data-provider' => $a['provider'],
'id' => $wrapper_id,
'style' => empty( $a['maxwidth'] ) ? false : sprintf( 'max-width:%dpx;', $a['maxwidth'] ),
// Schema.org
'itemscope' => '',
'itemtype' => 'http://schema.org/VideoObject',
);
if ( 'html5' === $a['provider'] ) {
$a['video_attr'] = array(
# WP
'autoplay' => in_array( $a['mode'], array( 'lazyload', 'lazyload-lightbox', 'link-lightbox' ), true ) ? false : $a['autoplay'],
'controls' => $a['controls'],
'controlslist' => $a['controlslist'],
'loop' => $a['loop'],
'preload' => $a['preload'],
'width' => empty( $a['width'] ) ? false : $a['width'],
'height' => empty( $a['height'] ) ? false : $a['height'],
'poster' => empty( $a['img_src'] ) ? false : $a['img_src'],
'src' => empty( $a['video_src'] ) ? false : $a['video_src'],
# ARVE only
'class' => 'arve-video fitvidsignore',
'muted' => $a['muted'],
'playsinline' => $a['playsinline'],
'webkit-playsinline' => $a['playsinline'],
);
} else {
$properties = arve_get_host_properties();
$options = arve_get_options();
$iframe_src = arve_build_iframe_src( $a );
$iframe_src = arve_add_query_args_to_iframe_src( $iframe_src, $a );
$iframe_src = arve_add_autoplay_query_arg( $iframe_src, $a );
if ( 'vimeo' === $a['provider'] && ! empty( $a['start'] ) ) {
$iframe_src .= '#t=' . (int) $a['start'];
}
$a['iframe_attr'] = array(
'allow' => 'accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture',
'allowfullscreen' => '',
'class' => 'arve-iframe fitvidsignore',
'frameborder' => '0',
'name' => $a['iframe_name'],
'sandbox' => 'allow-scripts allow-same-origin allow-presentation allow-popups allow-popups-to-escape-sandbox',
'scrolling' => 'no',
'src' => $iframe_src,
'width' => empty( $a['width'] ) ? false : $a['width'],
'height' => empty( $a['height'] ) ? false : $a['height'],
);
if ( 'vimeo' === $a['provider'] ) {
$a['iframe_attr']['sandbox'] .= ' allow-forms';
}
if ( false === $a['sandbox'] ) {
$a['iframe_attr']['sandbox'] = false;
}
}
return $a;
}
function arve_sc_filter_validate( $a ) {
$a['align'] = arve_validate_align( $a['align'], $a['provider'] );
$a['mode'] = arve_validate_mode( $a['mode'], $a['provider'] );
$a['autoplay'] = arve_validate_bool( $a['autoplay'], 'autoplay' );
$a['arve_link'] = arve_validate_bool( $a['arve_link'], 'arve_link' );
$a['loop'] = arve_validate_bool( $a['loop'], 'loop' );
$a['controls'] = arve_validate_bool( $a['controls'], 'controls' );
$a['sandbox'] = arve_validate_bool( $a['sandbox'], 'sandbox' );
$a['muted'] = arve_validate_bool( $a['muted'], 'muted' );
$a['playsinline'] = arve_validate_bool( $a['playsinline'], 'playsinline' );
$a['maxwidth'] = (int) $a['maxwidth'];
$a['maxwidth'] = (int) arve_maxwidth_when_aligned( $a['maxwidth'], $a['align'] );
$a['id'] = arve_id_fixes( $a['id'], $a['provider'] );
$a['aspect_ratio'] = arve_get_default_aspect_ratio( $a['aspect_ratio'], $a['provider'] );
$a['aspect_ratio'] = arve_aspect_ratio_fixes( $a['aspect_ratio'], $a['provider'], $a['mode'] );
$a['aspect_ratio'] = arve_validate_aspect_ratio( $a['aspect_ratio'] );
return $a;
}
function arve_sc_filter_set_fixed_dimensions( $a ) {
$width = 480;
$a['width'] = $width;
$a['height'] = arve_calculate_height( $width, $a['aspect_ratio'] );
return $a;
}
function arve_sc_filter_sanitise( $atts ) {
if ( ! empty( $atts['src'] ) ) {
$atts['url'] = $atts['src'];
}
foreach ( $atts as $key => $value ) {
$atts[ $key ] = (string) $value;
if ( '' === $value ) {
$atts[ $key ] = null;
}
}
return $atts;
}
function arve_sc_filter_missing_attribute_check( $atts ) {
# Old shortcodes
if ( ! array_key_exists( 'url', $atts ) ) {
return $atts;
}
$required_attributes = arve_get_html5_attributes();
$required_attributes[] = 'url';
$array = array_intersect_key( $atts, array_flip( $required_attributes ) );
if ( count( array_filter( $array ) ) !== count( $array ) ) {
$atts['missing_atts_error'] = arve_error(
sprintf(
esc_html__( 'The [arve] shortcode needs one of this attributes %s', ARVE_SLUG ),
implode( $required_attributes )
)
);
}
return $atts;
}
function arve_sc_filter_get_media_gallery_thumbnail( $atts ) {
if ( empty( $atts['thumbnail'] ) ) {
return $atts;
}
if ( is_numeric( $atts['thumbnail'] ) ) {
$attchment_id = $atts['thumbnail'];
$atts['img_src'] = arve_get_attachment_image_url_or_srcset( 'url', $attchment_id );
$atts['img_srcset'] = arve_get_attachment_image_url_or_srcset( 'srcset', $attchment_id );
} elseif ( arve_validate_url( $atts['thumbnail'] ) ) {
$atts['img_src'] = $atts['thumbnail'];
} else {
$atts['img_src'] = new WP_Error( 'thumbnail', __( 'Not a valid thumbnail URL or Media ID given', ARVE_SLUG ) );
}
return $atts;
}
function arve_sc_filter_get_media_gallery_video( $atts ) {
$html5_ext = arve_get_html5_attributes();
foreach ( $html5_ext as $ext ) {
if ( ! empty( $atts[ $ext ] ) && is_numeric( $atts[ $ext ] ) ) {
$atts[ $ext ] = wp_get_attachment_url( $atts[ $ext ] );
}
}
return $atts;
}
function arve_sc_filter_detect_provider_and_id_from_url( $atts ) {
$properties = arve_get_host_properties();
if ( ! empty( $atts['provider'] ) || empty( $atts['url'] ) ) {
return $atts;
}
foreach ( $properties as $host_id => $host ) :
if ( empty( $host['regex'] ) ) {
continue;
}
$preg_match = preg_match( '#' . $host['regex'] . '#i', $atts['url'], $matches );
if ( 1 !== $preg_match ) {
continue;
}
foreach ( $matches as $key => $value ) {
if ( is_string( $key ) ) {
$atts['provider'] = $host_id;
$atts[ $key ] = $matches[ $key ];
}
}
endforeach;
return $atts;
}
function arve_sc_filter_detect_query_args( $atts ) {
if ( empty( $atts['url'] ) ) {
return $atts;
}
$to_extract = array(
'brightcove' => array( 'videoId', 'something' ),
);
foreach ( $to_extract as $provider => $parameters ) {
if ( $provider !== $atts['provider'] ) {
return $atts;
}
$query_array = arve_url_query_array( $atts['url'] );
foreach ( $parameters as $key => $parameter ) {
$att_name = $atts['provider'] . "_$parameter";
if ( empty( $query_array[ $parameter ] ) ) {
$atts[ $att_name ] = new WP_Error( $att_name, "$parameter not found in URL" );
} else {
$atts[ $att_name ] = $query_array[ $parameter ];
}
}
}
return $atts;
}
function arve_sc_filter_detect_youtube_playlist( $atts ) {
if (
'youtube' !== $atts['provider'] ||
( empty( $atts['url'] ) && empty( $atts['id'] ) )
) {
return $atts;
}
if ( empty( $atts['url'] ) ) {
# Not a url but it will work
$url = str_replace( array( '&list=', '&amp;list=' ), '?list=', $atts['id'] );
} else {
$url = $atts['url'];
}
$query_array = arve_url_query_array( $url );
if ( empty( $query_array['list'] ) ) {
return $atts;
}
$atts['id'] = strtok( $atts['id'], '?' );
$atts['id'] = strtok( $atts['id'], '&' );
$atts['youtube_playlist_id'] = $query_array['list'];
$atts['parameters'] .= 'list=' . $query_array['list'];
return $atts;
}
function arve_get_video_type( $ext ) {
switch ( $ext ) {
case 'ogv':
case 'ogm':
return 'video/ogg';
default:
return 'video/' . $ext;
}
}
function arve_sc_filter_detect_html5( $atts ) {
if ( ! empty( $atts['provider'] ) && 'html5' !== $atts['provider'] ) {
return $atts;
}
$html5_extensions = arve_get_html5_attributes();
$atts['video_sources_html'] = '';
foreach ( $html5_extensions as $ext ) :
if ( ! empty( $atts[ $ext ] ) ) {
if ( arve_starts_with( $atts[ $ext ], 'https://www.dropbox.com' ) ) {
$atts[ $ext ] = add_query_arg( 'dl', 1, $atts[ $ext ] );
}
$atts['video_sources_html'] .= sprintf( '<source type="%s" src="%s">', arve_get_video_type( $ext ), $atts[ $ext ] );
}
if ( ! empty( $atts['url'] ) && arve_ends_with( $atts['url'], ".$ext" ) ) {
if ( arve_starts_with( $atts['url'], 'https://www.dropbox.com' ) ) {
$atts['url'] = add_query_arg( 'dl', 1, $atts['url'] );
}
$atts['video_src'] = $atts['url'];
}
endforeach;
if ( empty( $atts['video_src'] ) && empty( $atts['video_sources_html'] ) ) {
return $atts;
}
$atts['provider'] = 'html5';
return $atts;
}
function arve_sc_filter_iframe_fallback( $atts ) {
if ( empty( $atts['provider'] ) ) {
$atts['provider'] = 'iframe';
if ( empty( $atts['id'] ) && ! empty( $atts['url'] ) ) {
$atts['id'] = $atts['url'];
}
}
return $atts;
}
function arve_sc_filter_build_tracks_html( $atts ) {
if ( 'html5' !== $atts['provider'] ) {
return $atts;
}
$atts['video_tracks_html'] = '';
for ( $n = 1; $n <= ARVE_NUM_TRACKS; $n++ ) {
if ( empty( $atts[ "track_{$n}" ] ) ) {
return $atts;
}
preg_match( '#-(?<type>captions|chapters|descriptions|metadata|subtitles)-(?<lang>[a-z]{2}).vtt$#i', $atts[ "track_{$n}" ], $matches );
if ( empty( $matches[1] ) ) {
$atts[ "track_{$n}" ] = new WP_Error( 'track', __( 'Track kind or language code could not detected from filename', ARVE_SLUG ) );
return $atts;
}
$label = empty( $atts[ "track_{$n}_label" ] ) ? arve_get_language_name_from_code( $matches['lang'] ) : $atts[ "track_{$n}_label" ];
$attr = array(
'default' => ( 1 === $n ) ? true : false,
'kind' => $matches['type'],
'label' => $label,
'src' => $atts[ "track_{$n}" ],
'srclang' => $matches['lang'],
);
$atts['video_tracks_html'] .= sprintf( '<track%s>', arve_attr( $attr ) );
}
return $atts;
}
@@ -0,0 +1,286 @@
<?php
function arve_shortcode( $a, $content = null ) {
$a = (array) $a;
/**
* Filters the default arve shortcode output.
*
* If the filtered output isn't empty, it will be used instead of generating
* the default video template.
*
* @since 8.8.2
*
* @param string $html Empty variable to be replaced with shortcode markup.
* @param array $atts Attributes of the shortcode.
* @param string $content Video shortcode content.
*/
$override = apply_filters( 'arve_shortcode_overwride', '', $a, $content );
if ( '' !== $override ) {
return $override;
}
return arve_shortcode_arve( $a, $content );
}
function arve_default_maxwidth() {
$options = arve_get_options();
if ( empty( $options['video_maxwidth'] ) ) {
return empty( $GLOBALS['content_width'] ) ? 900 : $GLOBALS['content_width'];
}
return $options['video_maxwidth'];
}
function arve_shortcode_arve( $input_atts, $content = null, $arve_shortcode = true ) {
$errors = '';
$options = arve_get_options();
$properties = arve_get_host_properties();
$input_atts = (array) $input_atts;
$pairs = array(
'align' => $options['align'],
'arve_link' => arve_bool_to_shortcode_string( $options['promote_link'] ),
'aspect_ratio' => null,
'autoplay' => arve_bool_to_shortcode_string( $options['autoplay'] ),
'description' => null,
'duration' => null,
'sandbox' => 'y',
'iframe_name' => null,
'maxwidth' => (string) arve_default_maxwidth(),
'mode' => $options['mode'],
'parameters' => null,
'src' => null, // Just a alias for url to make it simple
'thumbnail' => null,
'title' => null,
'upload_date' => null,
// <video>
'm4v' => null,
'mp4' => null,
'ogv' => null,
'webm' => null,
'preload' => 'metadata',
'playsinline' => null,
'muted' => null,
'controls' => 'y',
'controlslist' => empty( $options['controlslist'] ) ? null : (string) $options['controlslist'],
'loop' => 'n',
// TED only
'lang' => null,
// Vimeo only
'start' => null,
// Old Shortcodes / URL embeds
'id' => null,
'provider' => null,
// deprecated, title should be used
'link_text' => null,
);
for ( $n = 1; $n <= ARVE_NUM_TRACKS; $n++ ) {
$pairs[ "track_{$n}" ] = null;
$pairs[ "track_{$n}_label" ] = null;
}
if ( $arve_shortcode ) {
$pairs['url'] = null;
} else {
$pairs['provider'] = null;
$pairs['id'] = null;
if ( empty( $input_atts['provider'] ) || empty( $input_atts['id'] ) ) {
return arve_error( __( 'id and provider shortcodes attributes are mandatory for old shortcodes. It is recommended to switch to new shortcodes that need only url', ARVE_SLUG ) );
}
}
$atts = shortcode_atts( apply_filters( 'arve_shortcode_pairs', $pairs ), $input_atts, 'arve' );
$errors = arve_output_errors( $atts );
if ( $errors ) {
return $errors . arve_get_debug_info( '', $atts, $input_atts );
}
$html['video'] = arve_video_or_iframe( $atts );
$html['meta'] = arve_build_meta_html( $atts );
$html['ad_link'] = arve_build_promote_link_html( $atts['arve_link'] );
$html['embed_container'] = arve_arve_embed_container( $html['meta'] . $html['video'], $atts );
$normal_embed = arve_arve_wrapper( $html['embed_container'] . $html['ad_link'], $atts );
$output = apply_filters( 'arve_output', $normal_embed, $html, $atts );
if ( empty( $output ) ) {
return arve_error( 'The output is empty, this should not happen', ARVE_SLUG );
} elseif ( is_wp_error( $output ) ) {
return arve_error( $output->get_error_message() );
}
wp_enqueue_style( ARVE_SLUG );
wp_enqueue_script( ARVE_SLUG );
return arve_get_debug_info( $output, $atts, $input_atts ) . $output;
}
/**
* Create all shortcodes at a late stage because people over and over again using this plugin toghter with jetback or
* other plugins that handle shortcodes we will now overwrite all this suckers.
*
* @since 2.6.2
*
* @uses Advanced_Responsive_Video_Embedder_Create_Shortcodes()
*/
function arve_create_shortcodes() {
$options = arve_get_options();
foreach ( $options['shortcodes'] as $provider => $shortcode ) {
$function = function( $atts ) use ( $provider ) {
$atts['provider'] = $provider;
return arve_shortcode_arve( $atts, null, false );
};
add_shortcode( $shortcode, $function );
}
add_shortcode( 'arve', 'arve_shortcode' );
add_shortcode( 'arve-supported', 'arve_shortcode_arve_supported' );
add_shortcode( 'arve-supported-list', 'arve_shortcode_arve_supported_list' );
add_shortcode( 'arve-params', 'arve_shortcode_arve_params' );
}
function arve_shortcode_arve_supported() {
$providers = arve_get_host_properties();
// unset deprecated and doubled
unset( $providers['dailymotionlist'] );
unset( $providers['iframe'] );
$out = '<h3 id="video-host-support">Video Host Support</h3>';
$out .= '<p>The limiting factor of the following features is not ARVE but what the prividers offer.</p>';
$out .= '<table class="table table-sm table-hover">';
$out .= '<tr>';
$out .= '<th></th>';
$out .= '<th>Provider</th>';
$out .= '<th>Requires<br>embed code</th>';
$out .= '<th>SSL</th>';
$out .= '<th>Auto Thumbnail<br>(Pro Addon)</th>';
$out .= '<th>Auto Title<br>(Pro Addon)</th>';
$out .= '</tr>';
$out .= '<tr>';
$out .= '<td></td>';
$out .= '<td colspan="6"><a href="https://nextgenthemes.com/plugins/arve/documentation/#general-iframe-embedding">All providers with responsive iframe embed codes</a></td>';
$out .= '</tr>';
$count = 1;
foreach ( $providers as $key => $values ) {
if ( ! isset( $values['name'] ) ) {
$values['name'] = $key;
}
$out .= '<tr>';
$out .= sprintf( '<td>%d</td>', $count++ );
$out .= sprintf( '<td>%s</td>', esc_html( $values['name'] ) );
$out .= sprintf( '<td>%s</td>', ( isset( $values['requires_src'] ) && $values['requires_src'] ) ? '&#x2713;' : '' );
$out .= sprintf( '<td>%s</td>', ( isset( $values['embed_url'] ) && arve_starts_with( $values['embed_url'], 'https' ) ) ? '&#x2713;' : '' );
$out .= sprintf( '<td>%s</td>', ( isset( $values['auto_thumbnail'] ) && $values['auto_thumbnail'] ) ? '&#x2713;' : '' );
$out .= sprintf( '<td>%s</td>', ( isset( $values['auto_title'] ) && $values['auto_title'] ) ? '&#x2713;' : '' );
$out .= '</tr>';
}
$out .= '<tr>';
$out .= '<td></td>';
$out .= '<td colspan="6"><a href="https://nextgenthemes.com/plugins/arve/documentation/#general-iframe-embedding">All providers with responsive iframe embed codes</a></td>';
$out .= '</tr>';
$out .= '</table>';
return $out;
}
function arve_shortcode_arve_supported_list() {
$list = '';
$providers = arve_get_host_properties();
// unset deprecated and doubled
unset( $providers['dailymotionlist'] );
unset( $providers['iframe'] );
foreach ( $providers as $key => $values ) {
$list .= '* ' . $values['name'] . PHP_EOL;
}
return '<textarea style="width:100%" rows="15">' . $list . '</textarea>';
}
function arve_shortcode_arve_params() {
$attrs = arve_get_settings_definitions();
if ( function_exists( 'arve_pro_get_settings_definitions' ) ) {
$attrs = array_merge( $attrs, arve_pro_get_settings_definitions() );
}
$out = '<table class="table table-hover table-arve-params">';
$out .= '<tr>';
$out .= '<th>Parameter</th>';
$out .= '<th>Function</th>';
$out .= '</tr>';
foreach ( $attrs as $key => $values ) {
if ( isset( $values['hide_from_sc'] ) && $values['hide_from_sc'] ) {
continue;
}
$desc = '';
unset( $values['options'][''] );
unset( $choices );
if ( ! empty( $values['options'] ) ) {
foreach ( $values['options'] as $key => $value ) {
$choices[] = sprintf( '<code>%s</code>', $key );
}
$desc .= __( 'Options: ', ARVE_SLUG ) . implode( ', ', $choices ) . '<br>';
}
if ( ! empty( $values['description'] ) ) {
$desc .= $values['description'];
}
if ( ! empty( $values['meta']['placeholder'] ) ) {
$desc .= $values['meta']['placeholder'];
}
$out .= '<tr>';
$out .= sprintf( '<td>%s</td>', $values['attr'] );
$out .= sprintf( '<td>%s</td>', $desc );
$out .= '</tr>';
}
$out .= '</table>';
return $out;
}
function arve_wp_video_shortcode_override( $out, $attr, $content, $instance ) {
$options = arve_get_options();
if ( ! $options['wp_video_override'] || ! empty( $attr['wmv'] ) || ! empty( $attr['flv'] ) ) {
return $out;
}
if ( ! empty( $attr['poster'] ) ) {
$attr['thumbnail'] = $attr['poster'];
}
return arve_shortcode_arve( $attr, null );
}
@@ -0,0 +1,47 @@
<?php
function arve_get_attachment_image_url_or_srcset( $url_or_srcset, $thumbnail ) {
$found = arve_get_cached_attachment_image_url_or_srcset( $url_or_srcset, $thumbnail );
if ( $found ) {
return $found;
} elseif ( 'url' === $url_or_srcset ) {
return new WP_Error( 'wp thumbnail', __( 'No attachment with that ID', ARVE_SLUG ) );
} else {
return false;
}
}
function arve_get_cached_attachment_image_url_or_srcset( $url_or_srcset, $attachment_id ) {
$options = arve_get_options();
$transient_name = "arve_attachment_image_{$url_or_srcset}_{$attachment_id}";
$transient = get_transient( $transient_name );
$time = (int) $options['wp_image_cache_time'];
if ( false === $transient || $time <= 0 ) {
if ( 'srcset' === $url_or_srcset ) {
$out = wp_get_attachment_image_srcset( $attachment_id, 'small' );
} elseif ( 'url' === $url_or_srcset ) {
$out = wp_get_attachment_image_url( $attachment_id, 'small' );
}
set_transient( $transient_name, (string) $out, $time );
} else {
$out = $transient;
}
return $out;
}
@@ -0,0 +1,140 @@
<?php
function arve_create_url_handlers() {
$properties = arve_get_host_properties();
foreach ( $properties as $provider => $values ) {
$function = function( $matches, $attr, $url, $rawattr ) use ( $provider ) {
return arve_url_detection_to_shortcode( $provider, $matches, $attr, $url, $rawattr );
};
if ( ! empty( $values['regex'] ) ) {
wp_embed_register_handler( 'arve_' . $provider, '#' . $values['regex'] . '#i', $function );
}
}
}
function arve_url_detection_to_shortcode( $provider, $matches, $attr, $url, $rawattr ) {
//* Fix 'Markdown on save enhanced' issue
if ( substr( $url, -4 ) === '</p>' ) {
$url = substr( $url, 0, -4 );
}
$parsed_url = wp_parse_url( $url );
$url_query = array();
$old_atts = array();
$new_atts = array();
if ( ! empty( $parsed_url['query'] ) ) {
parse_str( $parsed_url['query'], $url_query );
}
foreach ( $url_query as $key => $value ) {
if ( arve_starts_with( $key, 'arve-' ) ) {
$key = substr( $key, 5 );
$old_atts[ $key ] = $value;
}
}
unset( $old_atts['param'] );
if ( isset( $url_query['arve'] ) ) {
$new_atts = $url_query['arve'];
}
if ( isset( $url_query['t'] ) ) {
$url_query['start'] = arve_youtube_time_to_seconds( $url_query['t'] );
}
unset( $url_query['arve'] );
if ( 'youtube' === $provider ) {
unset( $url_query['v'] );
unset( $url_query['t'] );
}
//* Pure awesomeness!
$atts = array_merge( (array) $old_atts, (array) $new_atts );
$atts['parameters'] = empty( $url_query ) ? null : build_query( $url_query );
$atts['url'] = $url;
return arve_shortcode_arve( $atts, null );
}
/**
* Remove the WordPress default Oembed support for video providers that ARVE Supports. Array taken from wp-includes/class-oembed.php __construct
*
* @since 5.9.9
*
*/
function arve_oembed_remove_providers() {
// phpcs:disable Squiz.PHP.CommentedOutCode.Found
$wp_core_oembed_shits = array(
'#http://(www\.)?youtube\.com/watch.*#i' => array( 'http://www.youtube.com/oembed', true ),
'#https://(www\.)?youtube\.com/watch.*#i' => array( 'http://www.youtube.com/oembed?scheme=https', true ),
#'#http://(www\.)?youtube\.com/playlist.*#i' => array( 'http://www.youtube.com/oembed', true ),
#'#https://(www\.)?youtube\.com/playlist.*#i' => array( 'http://www.youtube.com/oembed?scheme=https', true ),
'#http://youtu\.be/.*#i' => array( 'http://www.youtube.com/oembed', true ),
'#https://youtu\.be/.*#i' => array( 'http://www.youtube.com/oembed?scheme=https', true ),
'#https?://(.+\.)?vimeo\.com/.*#i' => array( 'http://vimeo.com/api/oembed.{format}', true ),
'#https?://(www\.)?dailymotion\.com/.*#i' => array( 'http://www.dailymotion.com/services/oembed', true ),
'http://dai.ly/*' => array( 'http://www.dailymotion.com/services/oembed', false ),
#'#https?://(www\.)?flickr\.com/.*#i' => array( 'https://www.flickr.com/services/oembed/', true ),
#'#https?://flic\.kr/.*#i' => array( 'https://www.flickr.com/services/oembed/', true ),
#'#https?://(.+\.)?smugmug\.com/.*#i' => array( 'http://api.smugmug.com/services/oembed/', true ),
#'#https?://(www\.)?hulu\.com/watch/.*#i' => array( 'http://www.hulu.com/api/oembed.{format}', true ),
#'http://revision3.com/*' => array( 'http://revision3.com/api/oembed/', false ),
#'http://i*.photobucket.com/albums/*' => array( 'http://photobucket.com/oembed', false ),
#'http://gi*.photobucket.com/groups/*' => array( 'http://photobucket.com/oembed', false ),
#'#https?://(www\.)?scribd\.com/doc/.*#i' => array( 'http://www.scribd.com/services/oembed', true ),
#'#https?://wordpress.tv/.*#i' => array( 'http://wordpress.tv/oembed/', true ),
#'#https?://(.+\.)?polldaddy\.com/.*#i' => array( 'https://polldaddy.com/oembed/', true ),
#'#https?://poll\.fm/.*#i' => array( 'https://polldaddy.com/oembed/', true ),
'#https?://(www\.)?funnyordie\.com/videos/.*#i' => array( 'http://www.funnyordie.com/oembed', true ),
#'#https?://(www\.)?twitter\.com/.+?/status(es)?/.*#i' => array( 'https://api.twitter.com/1/statuses/oembed.{format}', true ),
'#https?://vine.co/v/.*#i' => array( 'https://vine.co/oembed.{format}', true ),
#'#https?://(www\.)?soundcloud\.com/.*#i' => array( 'http://soundcloud.com/oembed', true ),
#'#https?://(.+?\.)?slideshare\.net/.*#i' => array( 'https://www.slideshare.net/api/oembed/2', true ),
#'#http://instagr(\.am|am\.com)/p/.*#i' => array( 'http://api.instagram.com/oembed', true ),
#'#https?://(www\.)?rdio\.com/.*#i' => array( 'http://www.rdio.com/api/oembed/', true ),
#'#https?://rd\.io/x/.*#i' => array( 'http://www.rdio.com/api/oembed/', true ),
#'#https?://(open|play)\.spotify\.com/.*#i' => array( 'https://embed.spotify.com/oembed/', true ),
#'#https?://(.+\.)?imgur\.com/.*#i' => array( 'http://api.imgur.com/oembed', true ),
#'#https?://(www\.)?meetu(\.ps|p\.com)/.*#i' => array( 'http://api.meetup.com/oembed', true ),
#'#https?://(www\.)?issuu\.com/.+/docs/.+#i' => array( 'http://issuu.com/oembed_wp', true ),
'#https?://(www\.)?collegehumor\.com/video/.*#i' => array( 'http://www.collegehumor.com/oembed.{format}', true ),
#'#https?://(www\.)?mixcloud\.com/.*#i' => array( 'http://www.mixcloud.com/oembed', true ),
'#https?://(www\.|embed\.)?ted\.com/talks/.*#i' => array( 'http://www.ted.com/talks/oembed.{format}', true ),
#'#https?://(www\.)?(animoto|video214)\.com/play/.*#i' => array( 'http://animoto.com/oembeds/create', true ),
);
foreach ( $wp_core_oembed_shits as $shit => $fuck ) {
wp_oembed_remove_provider( $shit );
}
// Jetpack shit
remove_shortcode( 'dailymotion', 'dailymotion_shortcode' );
remove_filter( 'pre_kses', 'jetpack_dailymotion_embed_reversal' );
remove_filter( 'pre_kses', 'dailymotion_embed_to_shortcode' );
remove_shortcode( 'vimeo', 'vimeo_shortcode' );
remove_filter( 'pre_kses', 'vimeo_embed_to_shortcode' );
wp_embed_unregister_handler( 'jetpack_vine' );
remove_shortcode( 'vine', 'vine_shortcode' );
remove_filter( 'pre_kses', 'youtube_embed_to_short_code' );
remove_shortcode( 'youtube', 'youtube_shortcode' );
remove_shortcode( 'ted', 'shortcode_ted' );
wp_oembed_remove_provider( '!https?://(www\.)?ted.com/talks/view/id/.+!i' );
wp_oembed_remove_provider( '!https?://(www\.)?ted.com/talks/[a-zA-Z\-\_]+\.html!i' );
}
@@ -0,0 +1,106 @@
<?php
function arve_validate_url( $url ) {
if ( arve_starts_with( $url, '//' ) ) {
$url = 'https:' . $url;
}
if ( arve_starts_with( $url, 'http' ) && filter_var( $url, FILTER_VALIDATE_URL ) !== false ) {
return true;
}
return false;
}
function arve_validate_aspect_ratio( $aspect_ratio ) {
if ( empty( $aspect_ratio ) ) {
return $aspect_ratio;
}
$a = explode( ':', $aspect_ratio );
if ( ! empty( $a[0] ) && is_numeric( $a[0] ) && ! empty( $a[1] ) && is_numeric( $a[1] ) ) {
return $aspect_ratio;
}
return new WP_Error(
'Aspect ratio',
sprintf( __( 'Aspect ratio <code>%s</code> is not valid', ARVE_SLUG ), $aspect_ratio )
);
}
function arve_bool_to_shortcode_string( $val ) {
if ( false === $val ) {
return 'n';
}
return (string) $val;
}
function arve_validate_bool( $val, $name ) {
switch ( $val ) {
case 'true':
case '1':
case 'y':
case 'yes':
case 'on':
return true;
case null:
return null;
case 'false':
case '0':
case 'n':
case 'no':
case 'off':
return false;
default:
return new WP_Error(
$name,
sprintf( __( '%1$s <code>%2$s</code> not valid', ARVE_SLUG ), $name, $val )
);
}
}
function arve_validate_align( $align ) {
switch ( $align ) {
case null:
case '':
case 'none':
$align = null;
break;
case 'left':
case 'right':
case 'center':
break;
default:
$align = new WP_Error( 'align', sprintf( __( 'Align <code>%s</code> not valid', ARVE_SLUG ), esc_html( $align ) ) );
break;
}
return $align;
}
function arve_validate_mode( $mode, $provider ) {
if ( 'thumbnail' === $mode ) {
$mode = 'lazyload-lightbox';
}
if ( 'veoh' === $mode ) {
$mode = 'normal';
}
$supported_modes = arve_get_supported_modes();
if ( ! array_key_exists( $mode, $supported_modes ) ) {
$mode = 'normal';
}
return $mode;
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,31 @@
<?php
/**
* Fired when the plugin is uninstalled.
*
* When populating this file, consider the following flow
* of control:
*
* - This method should be static
* - Check if the $_REQUEST content actually is the plugin name
* - Run an admin referrer check to make sure it goes through authentication
* - Verify the output of $_GET makes sense
* - Repeat with other user roles. Best directly by using the links/query string parameters.
* - Repeat things for multisite. Once for a single site in the network, once sitewide.
*
* This file may be updated more in future version of the Boilerplate; however, this is the
* general skeleton and outline for how the file should work.
*
* For more information, see the following discussion:
* https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
*
* @link https://nextgenthemes.com
* @since 1.0.0
*
* @package Advanced_Responsive_Video_Embedder
*/
// If uninstall not called from WordPress, then exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}