commit 5d80babd5a5b076e28b7ec64e031d6784dccd4c4 Author: Isabelle Anno Date: Wed Nov 19 13:17:30 2025 +0100 Initial commit: is_themecore out of the box v4.1.3 diff --git a/is_themecore/.DS_Store b/is_themecore/.DS_Store new file mode 100644 index 0000000..483d23a Binary files /dev/null and b/is_themecore/.DS_Store differ diff --git a/is_themecore/.php-cs-fixer.dist.php b/is_themecore/.php-cs-fixer.dist.php new file mode 100644 index 0000000..5b524f8 --- /dev/null +++ b/is_themecore/.php-cs-fixer.dist.php @@ -0,0 +1,9 @@ +setUsingCache(true)->getFinder(); +$finder->in(__DIR__)->exclude('vendor'); + +return $config; diff --git a/is_themecore/LICENSE.md b/is_themecore/LICENSE.md new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/is_themecore/LICENSE.md @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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. + + + Copyright (C) + + 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 . + +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: + + Copyright (C) + 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 +. + + 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 +. diff --git a/is_themecore/Makefile b/is_themecore/Makefile new file mode 100644 index 0000000..47b6394 --- /dev/null +++ b/is_themecore/Makefile @@ -0,0 +1,21 @@ +build-module-zip: build-composer build-assets build-zip + +build-zip: + rm -rf is_themecore.zip + cp -Ra $(PWD) /tmp/is_themecore + rm -rf /tmp/is_themecore/config_*.xml + rm -rf /tmp/is_themecore/_theme_dev/node_modules + rm -rf /tmp/is_themecore/_module_dev/node_modules + rm -rf /tmp/is_themecore/.github + rm -rf /tmp/is_themecore/.gitignore + rm -rf /tmp/is_themecore/.php-cs-fixer.cache + rm -rf /tmp/is_themecore/.git + mv -v /tmp/is_themecore $(PWD)/is_themecore + zip -r is_themecore.zip is_themecore + rm -rf $(PWD)/is_themecore + +build-composer: + composer install --no-dev -o + +build-assets: + cd _module_dev && . ${HOME}/.nvm/nvm.sh && nvm install && npm install && npm run build diff --git a/is_themecore/README.md b/is_themecore/README.md new file mode 100644 index 0000000..3810d36 --- /dev/null +++ b/is_themecore/README.md @@ -0,0 +1,96 @@ +# Theme core module +Prestashop module created for [starter theme](https://github.com/Oksydan/modern-prestashop-starter-theme) + +#### How to use assets.yml file + +`assets.yml` file have to be placed inside `themes/THEME_NAME/config/` to work. +Example of `assets.yml` file: + +```yml +css: + product: + fileName: product.css + priority: 200 + include: + - product + checkout: + fileName: checkout.css + priority: 200 + include: + - cart + - order + - orderconfirmation + blog: + fileName: blog.css + priority: 200 + include: + - module-blog-* + example_remote_bootstrap: + fileName: //cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css + server: remote # required to set server: remote for remote file + priority: 200 + +js: + product: + fileName: product.js + priority: 200 + include: + - product + checkout: + fileName: checkout.js + priority: 200 + include: + - cart + - order + - orderconfirmation + blog: + fileName: blog.js + priority: 200 + include: + - module-blog-* + example_remote_bootstrap: + fileName: //cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js + server: remote # required to set server: remote for remote file + priority: 200 +``` + +You are able to use windcard `*` with include page name. + + +#### Structured data modification + +You are able to modify structured data with hooks. List of hooks: + - `actionStructuredDataBreadcrumb` + - `actionStructuredDataProduct` + - `actionStructuredDataShop` + - `actionStructuredDataWebsite` + +Every hook $param is an array with two keys: + - `$data` - reference of structured data array + - `$rawData` - raw structured data array (provided by data provider) + +#### Partytown + +You are able to use [partytown](https://partytown.builder.io/) with this module. You have to enable it first in module configuration. +Example of usage for GTAG: + +```html + + + +``` + +##### Beware that partytown is still in beta, and it may not work as expected. Make sure to test it before using in production. + diff --git a/is_themecore/_module_dev/.nvmrc b/is_themecore/_module_dev/.nvmrc new file mode 100644 index 0000000..e44a38e --- /dev/null +++ b/is_themecore/_module_dev/.nvmrc @@ -0,0 +1 @@ +v18.12.1 diff --git a/is_themecore/_module_dev/package-lock.json b/is_themecore/_module_dev/package-lock.json new file mode 100644 index 0000000..a0a5a41 --- /dev/null +++ b/is_themecore/_module_dev/package-lock.json @@ -0,0 +1,3049 @@ +{ + "name": "is_themecore_module", + "version": "4.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "is_themecore_module", + "version": "4.0.0", + "dependencies": { + "@builder.io/partytown": "^0.8.0" + }, + "devDependencies": { + "copy-webpack-plugin": "^11.0.0", + "webpack": "^5.81.0", + "webpack-cli": "^5.0.2" + } + }, + "node_modules/@builder.io/partytown": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@builder.io/partytown/-/partytown-0.8.0.tgz", + "integrity": "sha512-M6H7nSMwW2dHd1/MQ+9J1Jqdw22uhl1nKv90kIiL9G7gjFVqqouQp4qSS1oZclmtW1XjAa4Q5UnbHB4iytmxZA==", + "bin": { + "partytown": "bin/partytown.cjs" + } + }, + "node_modules/@discoveryjs/json-ext": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", + "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", + "dev": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.3.tgz", + "integrity": "sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", + "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@types/eslint": { + "version": "8.37.0", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.37.0.tgz", + "integrity": "sha512-Piet7dG2JBuDIfohBngQ3rCt7MgO9xCO4xIMKxBThCq5PNRB91IjlJ10eJVwfoNtvTErmxLzwBZ7rHZtbOMmFQ==", + "dev": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/eslint-scope": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz", + "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==", + "dev": true, + "dependencies": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", + "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==", + "dev": true + }, + "node_modules/@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, + "node_modules/@types/node": { + "version": "18.16.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz", + "integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==", + "dev": true + }, + "node_modules/@webassemblyjs/ast": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.5.tgz", + "integrity": "sha512-LHY/GSAZZRpsNQH+/oHqhRQ5FT7eoULcBqgfyTB5nQHogFnK3/7QoN7dLnwSE/JkUAF0SrRuclT7ODqMFtWxxQ==", + "dev": true, + "dependencies": { + "@webassemblyjs/helper-numbers": "1.11.5", + "@webassemblyjs/helper-wasm-bytecode": "1.11.5" + } + }, + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.5.tgz", + "integrity": "sha512-1j1zTIC5EZOtCplMBG/IEwLtUojtwFVwdyVMbL/hwWqbzlQoJsWCOavrdnLkemwNoC/EOwtUFch3fuo+cbcXYQ==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.5.tgz", + "integrity": "sha512-L65bDPmfpY0+yFrsgz8b6LhXmbbs38OnwDCf6NpnMUYqa+ENfE5Dq9E42ny0qz/PdR0LJyq/T5YijPnU8AXEpA==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.5.tgz", + "integrity": "sha512-fDKo1gstwFFSfacIeH5KfwzjykIE6ldh1iH9Y/8YkAZrhmu4TctqYjSh7t0K2VyDSXOZJ1MLhht/k9IvYGcIxg==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-numbers": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.5.tgz", + "integrity": "sha512-DhykHXM0ZABqfIGYNv93A5KKDw/+ywBFnuWybZZWcuzWHfbp21wUfRkbtz7dMGwGgT4iXjWuhRMA2Mzod6W4WA==", + "dev": true, + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.11.5", + "@webassemblyjs/helper-api-error": "1.11.5", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.5.tgz", + "integrity": "sha512-oC4Qa0bNcqnjAowFn7MPCETQgDYytpsfvz4ujZz63Zu/a/v71HeCAAmZsgZ3YVKec3zSPYytG3/PrRCqbtcAvA==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.5.tgz", + "integrity": "sha512-uEoThA1LN2NA+K3B9wDo3yKlBfVtC6rh0i4/6hvbz071E8gTNZD/pT0MsBf7MeD6KbApMSkaAK0XeKyOZC7CIA==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.5", + "@webassemblyjs/helper-buffer": "1.11.5", + "@webassemblyjs/helper-wasm-bytecode": "1.11.5", + "@webassemblyjs/wasm-gen": "1.11.5" + } + }, + "node_modules/@webassemblyjs/ieee754": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.5.tgz", + "integrity": "sha512-37aGq6qVL8A8oPbPrSGMBcp38YZFXcHfiROflJn9jxSdSMMM5dS5P/9e2/TpaJuhE+wFrbukN2WI6Hw9MH5acg==", + "dev": true, + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/@webassemblyjs/leb128": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.5.tgz", + "integrity": "sha512-ajqrRSXaTJoPW+xmkfYN6l8VIeNnR4vBOTQO9HzR7IygoCcKWkICbKFbVTNMjMgMREqXEr0+2M6zukzM47ZUfQ==", + "dev": true, + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/utf8": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.5.tgz", + "integrity": "sha512-WiOhulHKTZU5UPlRl53gHR8OxdGsSOxqfpqWeA2FmcwBMaoEdz6b2x2si3IwC9/fSPLfe8pBMRTHVMk5nlwnFQ==", + "dev": true + }, + "node_modules/@webassemblyjs/wasm-edit": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.5.tgz", + "integrity": "sha512-C0p9D2fAu3Twwqvygvf42iGCQ4av8MFBLiTb+08SZ4cEdwzWx9QeAHDo1E2k+9s/0w1DM40oflJOpkZ8jW4HCQ==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.5", + "@webassemblyjs/helper-buffer": "1.11.5", + "@webassemblyjs/helper-wasm-bytecode": "1.11.5", + "@webassemblyjs/helper-wasm-section": "1.11.5", + "@webassemblyjs/wasm-gen": "1.11.5", + "@webassemblyjs/wasm-opt": "1.11.5", + "@webassemblyjs/wasm-parser": "1.11.5", + "@webassemblyjs/wast-printer": "1.11.5" + } + }, + "node_modules/@webassemblyjs/wasm-gen": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.5.tgz", + "integrity": "sha512-14vteRlRjxLK9eSyYFvw1K8Vv+iPdZU0Aebk3j6oB8TQiQYuO6hj9s4d7qf6f2HJr2khzvNldAFG13CgdkAIfA==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.5", + "@webassemblyjs/helper-wasm-bytecode": "1.11.5", + "@webassemblyjs/ieee754": "1.11.5", + "@webassemblyjs/leb128": "1.11.5", + "@webassemblyjs/utf8": "1.11.5" + } + }, + "node_modules/@webassemblyjs/wasm-opt": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.5.tgz", + "integrity": "sha512-tcKwlIXstBQgbKy1MlbDMlXaxpucn42eb17H29rawYLxm5+MsEmgPzeCP8B1Cl69hCice8LeKgZpRUAPtqYPgw==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.5", + "@webassemblyjs/helper-buffer": "1.11.5", + "@webassemblyjs/wasm-gen": "1.11.5", + "@webassemblyjs/wasm-parser": "1.11.5" + } + }, + "node_modules/@webassemblyjs/wasm-parser": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.5.tgz", + "integrity": "sha512-SVXUIwsLQlc8srSD7jejsfTU83g7pIGr2YYNb9oHdtldSxaOhvA5xwvIiWIfcX8PlSakgqMXsLpLfbbJ4cBYew==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.5", + "@webassemblyjs/helper-api-error": "1.11.5", + "@webassemblyjs/helper-wasm-bytecode": "1.11.5", + "@webassemblyjs/ieee754": "1.11.5", + "@webassemblyjs/leb128": "1.11.5", + "@webassemblyjs/utf8": "1.11.5" + } + }, + "node_modules/@webassemblyjs/wast-printer": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.5.tgz", + "integrity": "sha512-f7Pq3wvg3GSPUPzR0F6bmI89Hdb+u9WXrSKc4v+N0aV0q6r42WoF92Jp2jEorBEBRoRNXgjp53nBniDXcqZYPA==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.5", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webpack-cli/configtest": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.0.1.tgz", + "integrity": "sha512-njsdJXJSiS2iNbQVS0eT8A/KPnmyH4pv1APj2K0d1wrZcBLw+yppxOy4CGqa0OxDJkzfL/XELDhD8rocnIwB5A==", + "dev": true, + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + } + }, + "node_modules/@webpack-cli/info": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.1.tgz", + "integrity": "sha512-fE1UEWTwsAxRhrJNikE7v4EotYflkEhBL7EbajfkPlf6E37/2QshOy/D48Mw8G5XMFlQtS6YV42vtbG9zBpIQA==", + "dev": true, + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + } + }, + "node_modules/@webpack-cli/serve": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.2.tgz", + "integrity": "sha512-S9h3GmOmzUseyeFW3tYNnWS7gNUuwxZ3mmMq0JyW78Vx1SGKPSkt5bT4pB0rUnVfHjP0EL9gW2bOzmtiTfQt0A==", + "dev": true, + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + }, + "peerDependenciesMeta": { + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-import-assertions": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", + "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", + "dev": true, + "peerDependencies": { + "acorn": "^8" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "dev": true, + "peerDependencies": { + "ajv": "^6.9.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.21.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", + "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001449", + "electron-to-chromium": "^1.4.284", + "node-releases": "^2.0.8", + "update-browserslist-db": "^1.0.10" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001482", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001482.tgz", + "integrity": "sha512-F1ZInsg53cegyjroxLNW9DmrEQ1SuGRTO1QlpA0o2/6OpQ0gFeDRoq1yFmnr8Sakn9qwwt9DmbxHB6w167OSuQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/chrome-trace-event": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", + "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", + "dev": true, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/copy-webpack-plugin": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-11.0.0.tgz", + "integrity": "sha512-fX2MWpamkW0hZxMEg0+mYnA40LTosOSa5TqZ9GYIBzyJa9C3QUaMPSE2xAi/buNr8u89SfD9wHSQVBzrRa/SOQ==", + "dev": true, + "dependencies": { + "fast-glob": "^3.2.11", + "glob-parent": "^6.0.1", + "globby": "^13.1.1", + "normalize-path": "^3.0.0", + "schema-utils": "^4.0.0", + "serialize-javascript": "^6.0.0" + }, + "engines": { + "node": ">= 14.15.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, + "node_modules/copy-webpack-plugin/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/copy-webpack-plugin/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/copy-webpack-plugin/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/copy-webpack-plugin/node_modules/schema-utils": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.1.tgz", + "integrity": "sha512-lELhBAAly9NowEsX0yZBlw9ahZG+sK/1RJ21EpzdYHKEs13Vku3LJ+MIPhh4sMs0oCCeufZQEQbMekiA4vuVIQ==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.4.380", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.380.tgz", + "integrity": "sha512-XKGdI4pWM78eLH2cbXJHiBnWUwFSzZM7XujsB6stDiGu9AeSqziedP6amNLpJzE3i0rLTcfAwdCTs5ecP5yeSg==", + "dev": true + }, + "node_modules/enhanced-resolve": { + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.13.0.tgz", + "integrity": "sha512-eyV8f0y1+bzyfh8xAwW/WTSZpLbjhqc4ne9eGSH4Zo2ejdyiNG9pU6mf9DG8a7+Auk6MFTlNOT4Y2y/9k8GKVg==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/envinfo": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", + "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", + "dev": true, + "bin": { + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/es-module-lexer": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.2.1.tgz", + "integrity": "sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==", + "dev": true + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true, + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "dev": true, + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true + }, + "node_modules/globby": { + "version": "13.1.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.4.tgz", + "integrity": "sha512-iui/IiiW+QrJ1X1hKH5qwlMQyv34wJAYwH1vrf8b9kBA4sNiif3gKsMHa+BrdnOpEudWjpotfa7LrTzB1ERS/g==", + "dev": true, + "dependencies": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.11", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dev": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/interpret": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", + "dev": true, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/is-core-module": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", + "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "dev": true, + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/loader-runner": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "dev": true, + "engines": { + "node": ">=6.11.5" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true + }, + "node_modules/node-releases": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", + "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/rechoir": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", + "dev": true, + "dependencies": { + "resolve": "^1.20.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "dev": true, + "dependencies": { + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-cwd/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/schema-utils": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.2.tgz", + "integrity": "sha512-pvjEHOgWc9OWA/f/DE3ohBWTD6EleVLf7iFUkoSwAxttdBhB9QUebQgxER2kWueOvRJXPHNnyrvvh9eZINB8Eg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz", + "integrity": "sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/terser": { + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.17.1.tgz", + "integrity": "sha512-hVl35zClmpisy6oaoKALOpS0rDYLxRFLHhRuDlEGTKey9qHjS1w9GMORjuwIMt70Wan4lwsLYyWDVnWgF+KUEw==", + "dev": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.2", + "acorn": "^8.5.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser-webpack-plugin": { + "version": "5.3.7", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.7.tgz", + "integrity": "sha512-AfKwIktyP7Cu50xNjXF/6Qb5lBNzYaWpU6YfoX3uZicTx0zTy0stDDCsvjDapKsSDvOeWo5MEq4TmdBy2cNoHw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.17", + "jest-worker": "^27.4.5", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.1", + "terser": "^5.16.5" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "uglify-js": { + "optional": true + } + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", + "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/watchpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "dev": true, + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack": { + "version": "5.81.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.81.0.tgz", + "integrity": "sha512-AAjaJ9S4hYCVODKLQTgG5p5e11hiMawBwV2v8MYLE0C/6UAGLuAF4n1qa9GOwdxnicaP+5k6M5HrLmD4+gIB8Q==", + "dev": true, + "dependencies": { + "@types/eslint-scope": "^3.7.3", + "@types/estree": "^1.0.0", + "@webassemblyjs/ast": "^1.11.5", + "@webassemblyjs/wasm-edit": "^1.11.5", + "@webassemblyjs/wasm-parser": "^1.11.5", + "acorn": "^8.7.1", + "acorn-import-assertions": "^1.7.6", + "browserslist": "^4.14.5", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.13.0", + "es-module-lexer": "^1.2.1", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.9", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.1.2", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.3.7", + "watchpack": "^2.4.0", + "webpack-sources": "^3.2.3" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-cli": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.0.2.tgz", + "integrity": "sha512-4y3W5Dawri5+8dXm3+diW6Mn1Ya+Dei6eEVAdIduAmYNLzv1koKVAqsfgrrc9P2mhrYHQphx5htnGkcNwtubyQ==", + "dev": true, + "dependencies": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^2.0.1", + "@webpack-cli/info": "^2.0.1", + "@webpack-cli/serve": "^2.0.2", + "colorette": "^2.0.14", + "commander": "^10.0.1", + "cross-spawn": "^7.0.3", + "envinfo": "^7.7.3", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^3.1.1", + "rechoir": "^0.8.0", + "webpack-merge": "^5.7.3" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=14.15.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "5.x.x" + }, + "peerDependenciesMeta": { + "@webpack-cli/generators": { + "optional": true + }, + "webpack-bundle-analyzer": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/webpack-cli/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/webpack-merge": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", + "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", + "dev": true, + "dependencies": { + "clone-deep": "^4.0.1", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "dev": true, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wildcard": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", + "dev": true + } + }, + "dependencies": { + "@builder.io/partytown": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@builder.io/partytown/-/partytown-0.8.0.tgz", + "integrity": "sha512-M6H7nSMwW2dHd1/MQ+9J1Jqdw22uhl1nKv90kIiL9G7gjFVqqouQp4qSS1oZclmtW1XjAa4Q5UnbHB4iytmxZA==" + }, + "@discoveryjs/json-ext": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", + "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", + "dev": true + }, + "@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true + }, + "@jridgewell/source-map": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.3.tgz", + "integrity": "sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", + "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@types/eslint": { + "version": "8.37.0", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.37.0.tgz", + "integrity": "sha512-Piet7dG2JBuDIfohBngQ3rCt7MgO9xCO4xIMKxBThCq5PNRB91IjlJ10eJVwfoNtvTErmxLzwBZ7rHZtbOMmFQ==", + "dev": true, + "requires": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "@types/eslint-scope": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz", + "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==", + "dev": true, + "requires": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "@types/estree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", + "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==", + "dev": true + }, + "@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, + "@types/node": { + "version": "18.16.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz", + "integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==", + "dev": true + }, + "@webassemblyjs/ast": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.5.tgz", + "integrity": "sha512-LHY/GSAZZRpsNQH+/oHqhRQ5FT7eoULcBqgfyTB5nQHogFnK3/7QoN7dLnwSE/JkUAF0SrRuclT7ODqMFtWxxQ==", + "dev": true, + "requires": { + "@webassemblyjs/helper-numbers": "1.11.5", + "@webassemblyjs/helper-wasm-bytecode": "1.11.5" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.5.tgz", + "integrity": "sha512-1j1zTIC5EZOtCplMBG/IEwLtUojtwFVwdyVMbL/hwWqbzlQoJsWCOavrdnLkemwNoC/EOwtUFch3fuo+cbcXYQ==", + "dev": true + }, + "@webassemblyjs/helper-api-error": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.5.tgz", + "integrity": "sha512-L65bDPmfpY0+yFrsgz8b6LhXmbbs38OnwDCf6NpnMUYqa+ENfE5Dq9E42ny0qz/PdR0LJyq/T5YijPnU8AXEpA==", + "dev": true + }, + "@webassemblyjs/helper-buffer": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.5.tgz", + "integrity": "sha512-fDKo1gstwFFSfacIeH5KfwzjykIE6ldh1iH9Y/8YkAZrhmu4TctqYjSh7t0K2VyDSXOZJ1MLhht/k9IvYGcIxg==", + "dev": true + }, + "@webassemblyjs/helper-numbers": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.5.tgz", + "integrity": "sha512-DhykHXM0ZABqfIGYNv93A5KKDw/+ywBFnuWybZZWcuzWHfbp21wUfRkbtz7dMGwGgT4iXjWuhRMA2Mzod6W4WA==", + "dev": true, + "requires": { + "@webassemblyjs/floating-point-hex-parser": "1.11.5", + "@webassemblyjs/helper-api-error": "1.11.5", + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.5.tgz", + "integrity": "sha512-oC4Qa0bNcqnjAowFn7MPCETQgDYytpsfvz4ujZz63Zu/a/v71HeCAAmZsgZ3YVKec3zSPYytG3/PrRCqbtcAvA==", + "dev": true + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.5.tgz", + "integrity": "sha512-uEoThA1LN2NA+K3B9wDo3yKlBfVtC6rh0i4/6hvbz071E8gTNZD/pT0MsBf7MeD6KbApMSkaAK0XeKyOZC7CIA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.5", + "@webassemblyjs/helper-buffer": "1.11.5", + "@webassemblyjs/helper-wasm-bytecode": "1.11.5", + "@webassemblyjs/wasm-gen": "1.11.5" + } + }, + "@webassemblyjs/ieee754": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.5.tgz", + "integrity": "sha512-37aGq6qVL8A8oPbPrSGMBcp38YZFXcHfiROflJn9jxSdSMMM5dS5P/9e2/TpaJuhE+wFrbukN2WI6Hw9MH5acg==", + "dev": true, + "requires": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.5.tgz", + "integrity": "sha512-ajqrRSXaTJoPW+xmkfYN6l8VIeNnR4vBOTQO9HzR7IygoCcKWkICbKFbVTNMjMgMREqXEr0+2M6zukzM47ZUfQ==", + "dev": true, + "requires": { + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/utf8": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.5.tgz", + "integrity": "sha512-WiOhulHKTZU5UPlRl53gHR8OxdGsSOxqfpqWeA2FmcwBMaoEdz6b2x2si3IwC9/fSPLfe8pBMRTHVMk5nlwnFQ==", + "dev": true + }, + "@webassemblyjs/wasm-edit": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.5.tgz", + "integrity": "sha512-C0p9D2fAu3Twwqvygvf42iGCQ4av8MFBLiTb+08SZ4cEdwzWx9QeAHDo1E2k+9s/0w1DM40oflJOpkZ8jW4HCQ==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.5", + "@webassemblyjs/helper-buffer": "1.11.5", + "@webassemblyjs/helper-wasm-bytecode": "1.11.5", + "@webassemblyjs/helper-wasm-section": "1.11.5", + "@webassemblyjs/wasm-gen": "1.11.5", + "@webassemblyjs/wasm-opt": "1.11.5", + "@webassemblyjs/wasm-parser": "1.11.5", + "@webassemblyjs/wast-printer": "1.11.5" + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.5.tgz", + "integrity": "sha512-14vteRlRjxLK9eSyYFvw1K8Vv+iPdZU0Aebk3j6oB8TQiQYuO6hj9s4d7qf6f2HJr2khzvNldAFG13CgdkAIfA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.5", + "@webassemblyjs/helper-wasm-bytecode": "1.11.5", + "@webassemblyjs/ieee754": "1.11.5", + "@webassemblyjs/leb128": "1.11.5", + "@webassemblyjs/utf8": "1.11.5" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.5.tgz", + "integrity": "sha512-tcKwlIXstBQgbKy1MlbDMlXaxpucn42eb17H29rawYLxm5+MsEmgPzeCP8B1Cl69hCice8LeKgZpRUAPtqYPgw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.5", + "@webassemblyjs/helper-buffer": "1.11.5", + "@webassemblyjs/wasm-gen": "1.11.5", + "@webassemblyjs/wasm-parser": "1.11.5" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.5.tgz", + "integrity": "sha512-SVXUIwsLQlc8srSD7jejsfTU83g7pIGr2YYNb9oHdtldSxaOhvA5xwvIiWIfcX8PlSakgqMXsLpLfbbJ4cBYew==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.5", + "@webassemblyjs/helper-api-error": "1.11.5", + "@webassemblyjs/helper-wasm-bytecode": "1.11.5", + "@webassemblyjs/ieee754": "1.11.5", + "@webassemblyjs/leb128": "1.11.5", + "@webassemblyjs/utf8": "1.11.5" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.11.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.5.tgz", + "integrity": "sha512-f7Pq3wvg3GSPUPzR0F6bmI89Hdb+u9WXrSKc4v+N0aV0q6r42WoF92Jp2jEorBEBRoRNXgjp53nBniDXcqZYPA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.5", + "@xtuc/long": "4.2.2" + } + }, + "@webpack-cli/configtest": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.0.1.tgz", + "integrity": "sha512-njsdJXJSiS2iNbQVS0eT8A/KPnmyH4pv1APj2K0d1wrZcBLw+yppxOy4CGqa0OxDJkzfL/XELDhD8rocnIwB5A==", + "dev": true, + "requires": {} + }, + "@webpack-cli/info": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.1.tgz", + "integrity": "sha512-fE1UEWTwsAxRhrJNikE7v4EotYflkEhBL7EbajfkPlf6E37/2QshOy/D48Mw8G5XMFlQtS6YV42vtbG9zBpIQA==", + "dev": true, + "requires": {} + }, + "@webpack-cli/serve": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.2.tgz", + "integrity": "sha512-S9h3GmOmzUseyeFW3tYNnWS7gNUuwxZ3mmMq0JyW78Vx1SGKPSkt5bT4pB0rUnVfHjP0EL9gW2bOzmtiTfQt0A==", + "dev": true, + "requires": {} + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "dev": true + }, + "acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "dev": true + }, + "acorn-import-assertions": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", + "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", + "dev": true, + "requires": {} + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "requires": { + "ajv": "^8.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } + } + }, + "ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "dev": true, + "requires": {} + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "browserslist": { + "version": "4.21.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", + "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001449", + "electron-to-chromium": "^1.4.284", + "node-releases": "^2.0.8", + "update-browserslist-db": "^1.0.10" + } + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001482", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001482.tgz", + "integrity": "sha512-F1ZInsg53cegyjroxLNW9DmrEQ1SuGRTO1QlpA0o2/6OpQ0gFeDRoq1yFmnr8Sakn9qwwt9DmbxHB6w167OSuQ==", + "dev": true + }, + "chrome-trace-event": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", + "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", + "dev": true + }, + "clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + } + }, + "colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "copy-webpack-plugin": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-11.0.0.tgz", + "integrity": "sha512-fX2MWpamkW0hZxMEg0+mYnA40LTosOSa5TqZ9GYIBzyJa9C3QUaMPSE2xAi/buNr8u89SfD9wHSQVBzrRa/SOQ==", + "dev": true, + "requires": { + "fast-glob": "^3.2.11", + "glob-parent": "^6.0.1", + "globby": "^13.1.1", + "normalize-path": "^3.0.0", + "schema-utils": "^4.0.0", + "serialize-javascript": "^6.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.3" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "schema-utils": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.1.tgz", + "integrity": "sha512-lELhBAAly9NowEsX0yZBlw9ahZG+sK/1RJ21EpzdYHKEs13Vku3LJ+MIPhh4sMs0oCCeufZQEQbMekiA4vuVIQ==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + } + } + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "electron-to-chromium": { + "version": "1.4.380", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.380.tgz", + "integrity": "sha512-XKGdI4pWM78eLH2cbXJHiBnWUwFSzZM7XujsB6stDiGu9AeSqziedP6amNLpJzE3i0rLTcfAwdCTs5ecP5yeSg==", + "dev": true + }, + "enhanced-resolve": { + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.13.0.tgz", + "integrity": "sha512-eyV8f0y1+bzyfh8xAwW/WTSZpLbjhqc4ne9eGSH4Zo2ejdyiNG9pU6mf9DG8a7+Auk6MFTlNOT4Y2y/9k8GKVg==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + } + }, + "envinfo": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", + "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", + "dev": true + }, + "es-module-lexer": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.2.1.tgz", + "integrity": "sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==", + "dev": true + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "dependencies": { + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + } + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "dev": true + }, + "fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true + }, + "globby": { + "version": "13.1.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.4.tgz", + "integrity": "sha512-iui/IiiW+QrJ1X1hKH5qwlMQyv34wJAYwH1vrf8b9kBA4sNiif3gKsMHa+BrdnOpEudWjpotfa7LrTzB1ERS/g==", + "dev": true, + "requires": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.11", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^4.0.0" + } + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true + }, + "import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dev": true, + "requires": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + } + }, + "interpret": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", + "dev": true + }, + "is-core-module": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", + "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true + }, + "jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "dev": true, + "requires": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + } + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + }, + "loader-runner": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "dev": true + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "requires": { + "mime-db": "1.52.0" + } + }, + "neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true + }, + "node-releases": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", + "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", + "dev": true + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + } + } + }, + "punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dev": true + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "rechoir": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", + "dev": true, + "requires": { + "resolve": "^1.20.0" + } + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, + "resolve": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "dev": true, + "requires": { + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "requires": { + "resolve-from": "^5.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + } + } + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, + "schema-utils": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.2.tgz", + "integrity": "sha512-pvjEHOgWc9OWA/f/DE3ohBWTD6EleVLf7iFUkoSwAxttdBhB9QUebQgxER2kWueOvRJXPHNnyrvvh9eZINB8Eg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + }, + "serialize-javascript": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz", + "integrity": "sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "requires": { + "kind-of": "^6.0.2" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true + }, + "terser": { + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.17.1.tgz", + "integrity": "sha512-hVl35zClmpisy6oaoKALOpS0rDYLxRFLHhRuDlEGTKey9qHjS1w9GMORjuwIMt70Wan4lwsLYyWDVnWgF+KUEw==", + "dev": true, + "requires": { + "@jridgewell/source-map": "^0.3.2", + "acorn": "^8.5.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + } + }, + "terser-webpack-plugin": { + "version": "5.3.7", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.7.tgz", + "integrity": "sha512-AfKwIktyP7Cu50xNjXF/6Qb5lBNzYaWpU6YfoX3uZicTx0zTy0stDDCsvjDapKsSDvOeWo5MEq4TmdBy2cNoHw==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.17", + "jest-worker": "^27.4.5", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.1", + "terser": "^5.16.5" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "update-browserslist-db": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", + "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "dev": true, + "requires": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + } + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "watchpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "dev": true, + "requires": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + } + }, + "webpack": { + "version": "5.81.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.81.0.tgz", + "integrity": "sha512-AAjaJ9S4hYCVODKLQTgG5p5e11hiMawBwV2v8MYLE0C/6UAGLuAF4n1qa9GOwdxnicaP+5k6M5HrLmD4+gIB8Q==", + "dev": true, + "requires": { + "@types/eslint-scope": "^3.7.3", + "@types/estree": "^1.0.0", + "@webassemblyjs/ast": "^1.11.5", + "@webassemblyjs/wasm-edit": "^1.11.5", + "@webassemblyjs/wasm-parser": "^1.11.5", + "acorn": "^8.7.1", + "acorn-import-assertions": "^1.7.6", + "browserslist": "^4.14.5", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.13.0", + "es-module-lexer": "^1.2.1", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.9", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.1.2", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.3.7", + "watchpack": "^2.4.0", + "webpack-sources": "^3.2.3" + } + }, + "webpack-cli": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.0.2.tgz", + "integrity": "sha512-4y3W5Dawri5+8dXm3+diW6Mn1Ya+Dei6eEVAdIduAmYNLzv1koKVAqsfgrrc9P2mhrYHQphx5htnGkcNwtubyQ==", + "dev": true, + "requires": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^2.0.1", + "@webpack-cli/info": "^2.0.1", + "@webpack-cli/serve": "^2.0.2", + "colorette": "^2.0.14", + "commander": "^10.0.1", + "cross-spawn": "^7.0.3", + "envinfo": "^7.7.3", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^3.1.1", + "rechoir": "^0.8.0", + "webpack-merge": "^5.7.3" + }, + "dependencies": { + "commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true + } + } + }, + "webpack-merge": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", + "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", + "dev": true, + "requires": { + "clone-deep": "^4.0.1", + "wildcard": "^2.0.0" + } + }, + "webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "wildcard": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", + "dev": true + } + } +} diff --git a/is_themecore/_module_dev/package.json b/is_themecore/_module_dev/package.json new file mode 100644 index 0000000..6db1b8d --- /dev/null +++ b/is_themecore/_module_dev/package.json @@ -0,0 +1,20 @@ +{ + "name": "is_themecore_module", + "label": "Theme core module", + "version": "4.0.0", + "description": "Theme core module", + "author": "Igor Stępień", + "scripts": { + "build": "webpack --progress --mode=production --env stats=errors-only", + "js-lint": "eslint -c .eslintrc.js --ext .js,.vue ./src", + "js-lint-fix": "eslint -c .eslintrc.js --ext .js,.vue ./src --fix" + }, + "devDependencies": { + "copy-webpack-plugin": "^11.0.0", + "webpack": "^5.81.0", + "webpack-cli": "^5.0.2" + }, + "dependencies": { + "@builder.io/partytown": "^0.8.0" + } +} diff --git a/is_themecore/_module_dev/src/index.js b/is_themecore/_module_dev/src/index.js new file mode 100644 index 0000000..ddb9ee5 --- /dev/null +++ b/is_themecore/_module_dev/src/index.js @@ -0,0 +1,10 @@ +import { partytownSnippet } from '@builder.io/partytown/integration'; + +const snippetContent = partytownSnippet(); + +document.addEventListener('DOMContentLoaded', () => { + const script = document.createElement("script"); + + script.textContent=snippetContent; + document.body.append(script) +}); diff --git a/is_themecore/_module_dev/webpack.config.js b/is_themecore/_module_dev/webpack.config.js new file mode 100644 index 0000000..0b4c475 --- /dev/null +++ b/is_themecore/_module_dev/webpack.config.js @@ -0,0 +1,26 @@ +// webpack.config.js +const path = require('path'); +const CopyPlugin = require('copy-webpack-plugin'); +const partytown = require('@builder.io/partytown/utils'); + +module.exports = { + entry: { + partytown: './src/index.js', + }, + output: { + path: path.resolve(__dirname, '../public'), + }, + resolve: { + extensions: ['.ts', '.js', '.mjs'], + }, + plugins: [ + new CopyPlugin({ + patterns: [ + { + from: partytown.libDirPath(), + to: path.join(__dirname, '../public', '~partytown'), + }, + ], + }), + ], +}; diff --git a/is_themecore/_theme_dev/.eslintignore b/is_themecore/_theme_dev/.eslintignore new file mode 100644 index 0000000..a93bc5e --- /dev/null +++ b/is_themecore/_theme_dev/.eslintignore @@ -0,0 +1,4 @@ +/node_modules/ +/webpack/ +postcss.config.js +webpack.config.js diff --git a/is_themecore/_theme_dev/.eslintrc.js b/is_themecore/_theme_dev/.eslintrc.js new file mode 100644 index 0000000..2e440f1 --- /dev/null +++ b/is_themecore/_theme_dev/.eslintrc.js @@ -0,0 +1,27 @@ +module.exports = { + root: true, + env: { + browser: true, + node: false, + es6: true, + jquery: true, + }, + globals: { + google: true, + document: true, + navigator: false, + window: true, + prestashop: true, + }, + extends: ['airbnb-base'], + rules: { + 'max-len': ['error', {code: 140}], + 'no-underscore-dangle': 'off', + 'no-restricted-syntax': 'off', + 'no-param-reassign': 'off', + 'import/no-unresolved': 'off', + }, + parserOptions: { + ecmaVersion: 2022 + }, +} diff --git a/is_themecore/_theme_dev/.nvmrc b/is_themecore/_theme_dev/.nvmrc new file mode 100644 index 0000000..e44a38e --- /dev/null +++ b/is_themecore/_theme_dev/.nvmrc @@ -0,0 +1 @@ +v18.12.1 diff --git a/is_themecore/_theme_dev/.stylelintrc.json b/is_themecore/_theme_dev/.stylelintrc.json new file mode 100644 index 0000000..4622303 --- /dev/null +++ b/is_themecore/_theme_dev/.stylelintrc.json @@ -0,0 +1,6 @@ +{ + "extends": "stylelint-config-recommended-scss", + "rules": { + "scss/at-extend-no-missing-placeholder": null + } +} diff --git a/is_themecore/_theme_dev/index.php b/is_themecore/_theme_dev/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/_theme_dev/index.php @@ -0,0 +1,11 @@ + { + const target = e.target.closest('[data-toggle-listing]'); + + if (target && target.dataset.toggleListing !== undefined) { + e.preventDefault(); + + if (target.classList.contains('active')) { + return; + } + + const display = target.dataset.displayType; + const allButtons = document.querySelectorAll('[data-toggle-listing]'); + + allButtons.forEach((button) => { + button.classList.remove('active'); + }); + + target.classList.add('active'); + + let requestData = { + displayType: display, + ajax: 1, + }; + + requestData = Object.keys(requestData).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(requestData[key])}`).join('&'); + + fetch(window.listDisplayAjaxUrl, { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + body: requestData, + }) + .then((resp) => resp.text()) + .then((resp) => { + try { + const response = JSON.parse(resp); + + if (response.success) { + prestashop.emit('updateFacets', window.location.href); + } + } catch (error) { + console.error(error); // eslint-disable-line no-console + } + }) + .catch((error) => { + console.error(error); // eslint-disable-line no-console + }); + } + }; + + document.addEventListener('click', handleClickEvent); +} + +document.addEventListener('DOMContentLoaded', () => { + initListDisplay(); +}); diff --git a/is_themecore/_theme_dev/src/js/listing/index.php b/is_themecore/_theme_dev/src/js/listing/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/_theme_dev/src/js/listing/index.php @@ -0,0 +1,11 @@ +=7.1.0", + "rosell-dk/webp-convert": "^2.9" + }, + "require-dev": { + "prestashop/php-dev-tools": "^4.2" + }, + "autoload": { + "psr-4": { + "Oksydan\\Module\\IsThemeCore\\": "src/" + } + }, + "config": { + "prepend-autoloader": false, + "allow-plugins": { + "phpro/grumphp-shim": false, + "phpstan/extension-installer": false + } + } +} diff --git a/is_themecore/composer.lock b/is_themecore/composer.lock new file mode 100644 index 0000000..2738bd8 --- /dev/null +++ b/is_themecore/composer.lock @@ -0,0 +1,2788 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "e4be3267d3460c86338ab2b6a5a711aa", + "packages": [ + { + "name": "rosell-dk/exec-with-fallback", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/exec-with-fallback.git", + "reference": "f88a6b29abd0b580566056b7c1eb0434eb5db20d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/exec-with-fallback/zipball/f88a6b29abd0b580566056b7c1eb0434eb5db20d", + "reference": "f88a6b29abd0b580566056b7c1eb0434eb5db20d", + "shasum": "" + }, + "require": { + "php": "^5.6 | ^7.0 | ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "suggest": { + "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing" + }, + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { + "ExecWithFallback\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "An exec() with fallback to emulations (proc_open, etc)", + "keywords": [ + "command", + "exec", + "fallback", + "open_proc", + "resiliant", + "sturdy" + ], + "support": { + "issues": "https://github.com/rosell-dk/exec-with-fallback/issues", + "source": "https://github.com/rosell-dk/exec-with-fallback/tree/1.2.0" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "time": "2021-12-08T12:09:43+00:00" + }, + { + "name": "rosell-dk/file-util", + "version": "0.1.1", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/file-util.git", + "reference": "2ff895308c37f448b34b031cfbfd8e45f43936fd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/file-util/zipball/2ff895308c37f448b34b031cfbfd8e45f43936fd", + "reference": "2ff895308c37f448b34b031cfbfd8e45f43936fd", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "rosell-dk/exec-with-fallback": "^1.0.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "mikey179/vfsstream": "^1.6", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { + "FileUtil\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "Functions for dealing with files and paths", + "keywords": [ + "files", + "path", + "util" + ], + "support": { + "issues": "https://github.com/rosell-dk/file-util/issues", + "source": "https://github.com/rosell-dk/file-util/tree/0.1.1" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "time": "2022-04-19T10:12:31+00:00" + }, + { + "name": "rosell-dk/image-mime-type-guesser", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/image-mime-type-guesser.git", + "reference": "72f7040e95a78937ae2edece452530224fcacea6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/image-mime-type-guesser/zipball/72f7040e95a78937ae2edece452530224fcacea6", + "reference": "72f7040e95a78937ae2edece452530224fcacea6", + "shasum": "" + }, + "require": { + "php": "^5.6 | ^7.0 | ^8.0", + "rosell-dk/image-mime-type-sniffer": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { + "ImageMimeTypeGuesser\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "Guess mime type of images", + "keywords": [ + "image", + "images", + "mime", + "mime type" + ], + "support": { + "issues": "https://github.com/rosell-dk/image-mime-type-guesser/issues", + "source": "https://github.com/rosell-dk/image-mime-type-guesser/tree/1.1.1" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "time": "2022-05-19T09:57:15+00:00" + }, + { + "name": "rosell-dk/image-mime-type-sniffer", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/image-mime-type-sniffer.git", + "reference": "9ed14cc5d2c14c417660a4dd1946b5f056494691" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/image-mime-type-sniffer/zipball/9ed14cc5d2c14c417660a4dd1946b5f056494691", + "reference": "9ed14cc5d2c14c417660a4dd1946b5f056494691", + "shasum": "" + }, + "require": { + "php": ">=5.4" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "mikey179/vfsstream": "^1.6", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { + "ImageMimeTypeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "Sniff mime type (images only)", + "keywords": [ + "image", + "images", + "mime", + "mime type" + ], + "support": { + "issues": "https://github.com/rosell-dk/image-mime-type-sniffer/issues", + "source": "https://github.com/rosell-dk/image-mime-type-sniffer/tree/1.1.1" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "time": "2022-04-20T14:31:25+00:00" + }, + { + "name": "rosell-dk/locate-binaries", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/locate-binaries.git", + "reference": "bd2f493383ecd55aa519828dd2898e30f3b9cbb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/locate-binaries/zipball/bd2f493383ecd55aa519828dd2898e30f3b9cbb0", + "reference": "bd2f493383ecd55aa519828dd2898e30f3b9cbb0", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "rosell-dk/exec-with-fallback": "^1.0.0", + "rosell-dk/file-util": "^0.1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { + "LocateBinaries\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "Locate a binaries by means of exec() or similar", + "keywords": [ + "binary", + "discover", + "locate", + "whereis", + "which" + ], + "support": { + "issues": "https://github.com/rosell-dk/locate-binaries/issues", + "source": "https://github.com/rosell-dk/locate-binaries/tree/1.0" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "time": "2022-04-20T07:20:07+00:00" + }, + { + "name": "rosell-dk/webp-convert", + "version": "2.9.2", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/webp-convert.git", + "reference": "5ccba85ebe3b28ae229459fd0baed25314616ac9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/webp-convert/zipball/5ccba85ebe3b28ae229459fd0baed25314616ac9", + "reference": "5ccba85ebe3b28ae229459fd0baed25314616ac9", + "shasum": "" + }, + "require": { + "php": "^5.6 | ^7.0 | ^8.0", + "rosell-dk/exec-with-fallback": "^1.0.0", + "rosell-dk/image-mime-type-guesser": "^1.1.1", + "rosell-dk/locate-binaries": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "suggest": { + "ext-gd": "to use GD extension for converting. Note: Gd must be compiled with webp support", + "ext-imagick": "to use Imagick extension for converting. Note: Gd must be compiled with webp support", + "ext-vips": "to use Vips extension for converting.", + "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing" + }, + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { + "WebPConvert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + }, + { + "name": "Martin Folkers", + "homepage": "https://twobrain.io", + "role": "Collaborator" + } + ], + "description": "Convert JPEG & PNG to WebP with PHP", + "keywords": [ + "Webp", + "cwebp", + "gd", + "image conversion", + "images", + "imagick", + "jpg", + "jpg2webp", + "png", + "png2webp" + ], + "support": { + "issues": "https://github.com/rosell-dk/webp-convert/issues", + "source": "https://github.com/rosell-dk/webp-convert/tree/2.9.2" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "time": "2022-05-19T13:56:36+00:00" + } + ], + "packages-dev": [ + { + "name": "composer/pcre", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.1.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-11-17T09:50:14+00:00" + }, + { + "name": "composer/semver", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.4", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.3.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-04-01T19:23:25+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "ced299686f41dce890debac69273b47ffe98a40c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", + "reference": "ced299686f41dce890debac69273b47ffe98a40c", + "shasum": "" + }, + "require": { + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-02-25T21:32:43+00:00" + }, + { + "name": "doctrine/annotations", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", + "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^2 || ^3", + "ext-tokenizer": "*", + "php": "^7.2 || ^8.0", + "psr/cache": "^1 || ^2 || ^3" + }, + "require-dev": { + "doctrine/cache": "^2.0", + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.8.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "symfony/cache": "^5.4 || ^6", + "vimeo/psalm": "^4.10" + }, + "suggest": { + "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "https://www.doctrine-project.org/projects/annotations.html", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "support": { + "issues": "https://github.com/doctrine/annotations/issues", + "source": "https://github.com/doctrine/annotations/tree/2.0.1" + }, + "time": "2023-02-02T22:02:53+00:00" + }, + { + "name": "doctrine/lexer", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "84a527db05647743d50373e0ec53a152f2cde568" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/84a527db05647743d50373e0ec53a152f2cde568", + "reference": "84a527db05647743d50373e0ec53a152f2cde568", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.9", + "phpunit/phpunit": "^9.5", + "psalm/plugin-phpunit": "^0.18.3", + "vimeo/psalm": "^5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/3.0.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "time": "2022-12-15T16:57:16+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v3.16.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "d40f9436e1c448d309fa995ab9c14c5c7a96f2dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/d40f9436e1c448d309fa995ab9c14c5c7a96f2dc", + "reference": "d40f9436e1c448d309fa995ab9c14c5c7a96f2dc", + "shasum": "" + }, + "require": { + "composer/semver": "^3.3", + "composer/xdebug-handler": "^3.0.3", + "doctrine/annotations": "^2", + "doctrine/lexer": "^2 || ^3", + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0", + "sebastian/diff": "^4.0 || ^5.0", + "symfony/console": "^5.4 || ^6.0", + "symfony/event-dispatcher": "^5.4 || ^6.0", + "symfony/filesystem": "^5.4 || ^6.0", + "symfony/finder": "^5.4 || ^6.0", + "symfony/options-resolver": "^5.4 || ^6.0", + "symfony/polyfill-mbstring": "^1.27", + "symfony/polyfill-php80": "^1.27", + "symfony/polyfill-php81": "^1.27", + "symfony/process": "^5.4 || ^6.0", + "symfony/stopwatch": "^5.4 || ^6.0" + }, + "require-dev": { + "justinrainbow/json-schema": "^5.2", + "keradus/cli-executor": "^2.0", + "mikey179/vfsstream": "^1.6.11", + "php-coveralls/php-coveralls": "^2.5.3", + "php-cs-fixer/accessible-object": "^1.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", + "phpspec/prophecy": "^1.16", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", + "phpunitgoodpractices/polyfill": "^1.6", + "phpunitgoodpractices/traits": "^1.9.2", + "symfony/phpunit-bridge": "^6.2.3", + "symfony/yaml": "^5.4 || ^6.0" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "keywords": [ + "Static code analysis", + "fixer", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.16.0" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2023-04-02T19:30:06+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.15.4", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" + }, + "time": "2023-03-05T19:49:14+00:00" + }, + { + "name": "prestashop/autoindex", + "version": "v2.1.0", + "source": { + "type": "git", + "url": "https://github.com/PrestaShopCorp/autoindex.git", + "reference": "235f3ec115432ffc32d582198ea498467b3946d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PrestaShopCorp/autoindex/zipball/235f3ec115432ffc32d582198ea498467b3946d0", + "reference": "235f3ec115432ffc32d582198ea498467b3946d0", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.10", + "php": "^8.0 || ^7.2", + "symfony/console": "^3.4 || ~4.0 || ~5.0 || ~6.0", + "symfony/finder": "^3.4 || ~4.0 || ~5.0 || ~6.0" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.83", + "prestashop/php-dev-tools": "1.*" + }, + "bin": [ + "bin/autoindex" + ], + "type": "library", + "autoload": { + "psr-4": { + "PrestaShop\\AutoIndex\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AFL-3.0" + ], + "authors": [ + { + "name": "PrestaShop SA", + "email": "contact@prestashop.com" + } + ], + "description": "Automatically add an 'index.php' in all the current or specified directories and all sub-directories.", + "homepage": "https://github.com/PrestaShopCorp/autoindex", + "support": { + "source": "https://github.com/PrestaShopCorp/autoindex/tree/v2.1.0" + }, + "time": "2022-10-10T08:35:00+00:00" + }, + { + "name": "prestashop/header-stamp", + "version": "v2.3", + "source": { + "type": "git", + "url": "https://github.com/PrestaShopCorp/header-stamp.git", + "reference": "3104b69ad73b6039c7082dbba4af9dbeb0b936b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PrestaShopCorp/header-stamp/zipball/3104b69ad73b6039c7082dbba4af9dbeb0b936b3", + "reference": "3104b69ad73b6039c7082dbba4af9dbeb0b936b3", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.10", + "php": "^8.0 || ^7.2", + "symfony/console": "^3.4 || ~4.0 || ~5.0 || ~6.0", + "symfony/finder": "^3.4 || ~4.0 || ~5.0 || ~6.0" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.83", + "prestashop/php-dev-tools": "1.*" + }, + "bin": [ + "bin/header-stamp" + ], + "type": "library", + "autoload": { + "psr-4": { + "PrestaShop\\HeaderStamp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AFL-3.0" + ], + "authors": [ + { + "name": "PrestaShop SA", + "email": "contact@prestashop.com" + } + ], + "description": "Rewrite your file headers to add the license or to make them up-to-date", + "homepage": "https://github.com/PrestaShopCorp/header-stamp", + "support": { + "issues": "https://github.com/PrestaShopCorp/header-stamp/issues", + "source": "https://github.com/PrestaShopCorp/header-stamp/tree/v2.3" + }, + "time": "2023-03-23T14:44:10+00:00" + }, + { + "name": "prestashop/php-dev-tools", + "version": "v4.3.0", + "source": { + "type": "git", + "url": "https://github.com/PrestaShop/php-dev-tools.git", + "reference": "843275b19729ba810d8ba2b9c97b568e5bbabe03" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PrestaShop/php-dev-tools/zipball/843275b19729ba810d8ba2b9c97b568e5bbabe03", + "reference": "843275b19729ba810d8ba2b9c97b568e5bbabe03", + "shasum": "" + }, + "require": { + "friendsofphp/php-cs-fixer": "^3.2", + "php": ">=7.2.5", + "prestashop/autoindex": "^2.0", + "prestashop/header-stamp": "^2.0", + "squizlabs/php_codesniffer": "^3.4", + "symfony/console": "~3.2 || ~4.0 || ~5.0 || ~6.0", + "symfony/filesystem": "~3.2 || ~4.0 || ~5.0 || ~6.0" + }, + "bin": [ + "bin/prestashop-coding-standards" + ], + "type": "library", + "autoload": { + "psr-4": { + "PrestaShop\\CodingStandards\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PrestaShop coding standards", + "support": { + "issues": "https://github.com/PrestaShop/php-dev-tools/issues", + "source": "https://github.com/PrestaShop/php-dev-tools/tree/v4.3.0" + }, + "time": "2022-10-18T14:19:51+00:00" + }, + { + "name": "psr/cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/3.0.0" + }, + "time": "2021-02-03T23:26:27+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.0" + }, + "time": "2021-07-14T16:46:02+00:00" + }, + { + "name": "sebastian/diff", + "version": "5.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/aae9a0a43bff37bd5d8d0311426c87bf36153f02", + "reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-03-23T05:12:41+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.7.2", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, + "time": "2023-02-22T23:07:41+00:00" + }, + { + "name": "symfony/console", + "version": "v6.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "3582d68a64a86ec25240aaa521ec8bc2342b369b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/3582d68a64a86ec25240aaa521ec8bc2342b369b", + "reference": "3582d68a64a86ec25240aaa521ec8bc2342b369b", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.4|^6.0" + }, + "conflict": { + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/lock": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v6.2.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-03-29T21:42:15+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.3-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-03-01T10:25:55+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v6.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "04046f35fd7d72f9646e721fc2ecb8f9c67d3339" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/04046f35fd7d72f9646e721fc2ecb8f9c67d3339", + "reference": "04046f35fd7d72f9646e721fc2ecb8f9c67d3339", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/event-dispatcher-contracts": "^2|^3" + }, + "conflict": { + "symfony/dependency-injection": "<5.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/error-handler": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^5.4|^6.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v6.2.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-03-20T16:06:02+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v3.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "0ad3b6f1e4e2da5690fefe075cd53a238646d8dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/0ad3b6f1e4e2da5690fefe075cd53a238646d8dd", + "reference": "0ad3b6f1e4e2da5690fefe075cd53a238646d8dd", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/event-dispatcher": "^1" + }, + "suggest": { + "symfony/event-dispatcher-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.3-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.2.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-03-01T10:32:47+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v6.2.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "82b6c62b959f642d000456f08c6d219d749215b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/82b6c62b959f642d000456f08c6d219d749215b3", + "reference": "82b6c62b959f642d000456f08c6d219d749215b3", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v6.2.7" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-02-14T08:44:56+00:00" + }, + { + "name": "symfony/finder", + "version": "v6.2.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/20808dc6631aecafbe67c186af5dcb370be3a0eb", + "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "symfony/filesystem": "^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v6.2.7" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-02-16T09:57:23+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v6.2.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "aa0e85b53bbb2b4951960efd61d295907eacd629" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/aa0e85b53bbb2b4951960efd61d295907eacd629", + "reference": "aa0e85b53bbb2b4951960efd61d295907eacd629", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v6.2.7" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-02-14T08:44:56+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a", + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/process", + "version": "v6.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "75ed64103df4f6615e15a7fe38b8111099f47416" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/75ed64103df4f6615e15a7fe38b8111099f47416", + "reference": "75ed64103df4f6615e15a7fe38b8111099f47416", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v6.2.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-03-09T16:20:02+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v3.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "a8c9cedf55f314f3a186041d19537303766df09a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a8c9cedf55f314f3a186041d19537303766df09a", + "reference": "a8c9cedf55f314f3a186041d19537303766df09a", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/container": "^2.0" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.3-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v3.2.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-03-01T10:32:47+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v6.2.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "f3adc98c1061875dd2edcd45e5b04e63d0e29f8f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/f3adc98c1061875dd2edcd45e5b04e63d0e29f8f", + "reference": "f3adc98c1061875dd2edcd45e5b04e63d0e29f8f", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/service-contracts": "^1|^2|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a way to profile code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v6.2.7" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-02-14T08:44:56+00:00" + }, + { + "name": "symfony/string", + "version": "v6.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/193e83bbd6617d6b2151c37fff10fa7168ebddef", + "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.0" + }, + "require-dev": { + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/intl": "^6.2", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v6.2.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-03-20T16:06:02+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.1.0" + }, + "platform-dev": [], + "plugin-api-version": "2.3.0" +} diff --git a/is_themecore/config/admin/services.yml b/is_themecore/config/admin/services.yml new file mode 100644 index 0000000..db8e7e0 --- /dev/null +++ b/is_themecore/config/admin/services.yml @@ -0,0 +1,75 @@ +imports: + - { resource: ../common.yml } +services: + _defaults: + public: true + + oksydan.module.is_themecore.form.settings.general_type: + class: 'Oksydan\Module\IsThemeCore\Form\Settings\GeneralType' + parent: "form.type.translatable.aware" + public: true + arguments: + $displayListChoices: '@=service("oksydan.module.is_themecore.form.choice_provider.list_display_choice_provider").getChoices()' + tags: + - { name: form.type } + + oksydan.module.is_themecore.form.settings.general_form_data_provider: + class: 'Oksydan\Module\IsThemeCore\Form\Settings\GeneralFormDataProvider' + arguments: + - "@oksydan.module.is_themecore.form.settings.general_configuration" + + oksydan.module.is_themecore.form.settings.general_form_data_handler: + class: 'PrestaShop\PrestaShop\Core\Form\Handler' + arguments: + - "@form.factory" + - "@prestashop.core.hook.dispatcher" + - "@oksydan.module.is_themecore.form.settings.general_form_data_provider" + - 'Oksydan\Module\IsThemeCore\Form\Settings\GeneralType' + - "General" + + oksydan.module.is_themecore.form.settings.webp_type: + class: 'Oksydan\Module\IsThemeCore\Form\Settings\WebpType' + parent: "form.type.translatable.aware" + public: true + arguments: + $convertersList: '@=service("oksydan.module.is_themecore.form.choice_provider.webp_library_choice_provider").getChoices()' + $convertersListFull: '@=service("oksydan.module.is_themecore.form.choice_provider.webp_library_choice_provider").getChoicesFull()' + $router: "@router" + tags: + - { name: form.type } + + oksydan.module.is_themecore.form.settings.webp_form_data_provider: + class: 'Oksydan\Module\IsThemeCore\Form\Settings\WebpFormDataProvider' + arguments: + - "@oksydan.module.is_themecore.form.settings.webp_configuration" + + oksydan.module.is_themecore.form.settings.webp_form_data_handler: + class: 'PrestaShop\PrestaShop\Core\Form\Handler' + arguments: + - "@form.factory" + - "@prestashop.core.hook.dispatcher" + - "@oksydan.module.is_themecore.form.settings.webp_form_data_provider" + - 'Oksydan\Module\IsThemeCore\Form\Settings\WebpType' + - "Webp" + + oksydan.module.is_themecore.form.choice_provider.webp_library_choice_provider: + class: Oksydan\Module\IsThemeCore\Form\ChoiceProvider\WebpLibraryChoiceProvider + arguments: + - "@oksydan.module.is_themecore.core.webp.webp_convert_libraries" + + oksydan.module.is_themecore.form.choice_provider.list_display_choice_provider: + class: Oksydan\Module\IsThemeCore\Form\ChoiceProvider\ListDisplayChoiceProvider + arguments: + - "@oksydan.module.is_themecore.core.listing_display.theme_list_display" + + oksydan.module.is_themecore.form.settings.webp_configuration: + class: Oksydan\Module\IsThemeCore\Form\Settings\WebpConfiguration + arguments: + - "@prestashop.adapter.legacy.configuration" + + oksydan.module.is_themecore.form.settings.general_configuration: + class: Oksydan\Module\IsThemeCore\Form\Settings\GeneralConfiguration + arguments: + - "@prestashop.adapter.legacy.configuration" + - "@prestashop.adapter.shop.context" + - "@prestashop.adapter.multistore_feature" diff --git a/is_themecore/config/common.yml b/is_themecore/config/common.yml new file mode 100644 index 0000000..5815693 --- /dev/null +++ b/is_themecore/config/common.yml @@ -0,0 +1,39 @@ +services: + _defaults: + public: true + + oksydan.module.is_themecore.module: + class: Is_themecore + factory: [ 'Module', 'getInstanceByName' ] + public: false + arguments: + - 'is_themecore' + + Is_themecore: '@oksydan.module.is_themecore.module' + + oksydan.module.is_themecore.core.webp.webp_convert_libraries: + class: Oksydan\Module\IsThemeCore\Core\Webp\WebpConvertLibraries + + oksydan.module.is_themecore.core.webp.webp_files_eraser: + class: Oksydan\Module\IsThemeCore\Core\Webp\WebpFilesEraser + + oksydan.module.is_themecore.core.listing_display.theme_list_display: + class: Oksydan\Module\IsThemeCore\Core\ListingDisplay\ThemeListDisplay + + oksydan.module.is_themecore.core.htaccess.htaccess_generator: + class: Oksydan\Module\IsThemeCore\Core\Htaccess\HtaccessGenerator + arguments: + - "@Is_themecore" + + oksydan.module.is_themecore.core.webp.related_image_file_finder: + class: Oksydan\Module\IsThemeCore\Core\Webp\RelatedImageFileFinder + + oksydan.module.is_themecore.core.webp.webp_generator: + class: Oksydan\Module\IsThemeCore\Core\Webp\WebpGenerator + arguments: + - "@oksydan.module.is_themecore.core.webp.related_image_file_finder" + + Oksydan\Module\IsThemeCore\Core\Partytown\FilesInstallation: + class: Oksydan\Module\IsThemeCore\Core\Partytown\FilesInstallation + arguments: + - "@Is_themecore" diff --git a/is_themecore/config/front/services.yml b/is_themecore/config/front/services.yml new file mode 100644 index 0000000..6806acd --- /dev/null +++ b/is_themecore/config/front/services.yml @@ -0,0 +1,81 @@ +imports: + - { resource: ../common.yml } +services: + _defaults: + public: true + + Oksydan\Module\IsThemeCore\Core\StructuredData\Presenter\StructuredDataBreadcrumbPresenter: + class: 'Oksydan\Module\IsThemeCore\Core\StructuredData\Presenter\StructuredDataBreadcrumbPresenter' + + Oksydan\Module\IsThemeCore\Core\StructuredData\Provider\StructuredDataBreadcrumbProvider: + class: 'Oksydan\Module\IsThemeCore\Core\StructuredData\Provider\StructuredDataBreadcrumbProvider' + arguments: + - "@=service('prestashop.adapter.legacy.context').getContext()" + + Oksydan\Module\IsThemeCore\Core\StructuredData\BreadcrumbStructuredData: + class: 'Oksydan\Module\IsThemeCore\Core\StructuredData\BreadcrumbStructuredData' + public: true + arguments: + - '@Oksydan\Module\IsThemeCore\Core\StructuredData\Provider\StructuredDataBreadcrumbProvider' + - '@Oksydan\Module\IsThemeCore\Core\StructuredData\Presenter\StructuredDataBreadcrumbPresenter' + + Oksydan\Module\IsThemeCore\Core\StructuredData\Presenter\StructuredDataWebsitePresenter: + class: 'Oksydan\Module\IsThemeCore\Core\StructuredData\Presenter\StructuredDataWebsitePresenter' + arguments: + - "@=service('prestashop.adapter.legacy.context').getContext()" + + Oksydan\Module\IsThemeCore\Core\StructuredData\Provider\StructuredDataWebsiteProvider: + class: 'Oksydan\Module\IsThemeCore\Core\StructuredData\Provider\StructuredDataWebsiteProvider' + arguments: + - "@=service('prestashop.adapter.legacy.context').getContext()" + + Oksydan\Module\IsThemeCore\Core\StructuredData\WebsiteStructuredData: + class: 'Oksydan\Module\IsThemeCore\Core\StructuredData\WebsiteStructuredData' + public: true + arguments: + - '@Oksydan\Module\IsThemeCore\Core\StructuredData\Provider\StructuredDataWebsiteProvider' + - '@Oksydan\Module\IsThemeCore\Core\StructuredData\Presenter\StructuredDataWebsitePresenter' + + Oksydan\Module\IsThemeCore\Core\StructuredData\Presenter\StructuredDataShopPresenter: + class: 'Oksydan\Module\IsThemeCore\Core\StructuredData\Presenter\StructuredDataShopPresenter' + arguments: + - "@=service('prestashop.adapter.legacy.context').getContext()" + + Oksydan\Module\IsThemeCore\Core\StructuredData\Provider\StructuredDataShopProvider: + class: 'Oksydan\Module\IsThemeCore\Core\StructuredData\Provider\StructuredDataShopProvider' + arguments: + - "@=service('prestashop.adapter.legacy.context').getContext()" + + Oksydan\Module\IsThemeCore\Core\StructuredData\ShopStructuredData: + class: 'Oksydan\Module\IsThemeCore\Core\StructuredData\ShopStructuredData' + public: true + arguments: + - '@Oksydan\Module\IsThemeCore\Core\StructuredData\Provider\StructuredDataShopProvider' + - '@Oksydan\Module\IsThemeCore\Core\StructuredData\Presenter\StructuredDataShopPresenter' + + Oksydan\Module\IsThemeCore\Core\StructuredData\Presenter\StructuredDataProductPresenter: + class: 'Oksydan\Module\IsThemeCore\Core\StructuredData\Presenter\StructuredDataProductPresenter' + arguments: + - "@=service('prestashop.adapter.legacy.context').getContext()" + + Oksydan\Module\IsThemeCore\Core\StructuredData\Provider\StructuredDataProductProvider: + class: 'Oksydan\Module\IsThemeCore\Core\StructuredData\Provider\StructuredDataProductProvider' + arguments: + - "@=service('prestashop.adapter.legacy.context').getContext()" + + Oksydan\Module\IsThemeCore\Core\StructuredData\ProductStructuredData: + class: 'Oksydan\Module\IsThemeCore\Core\StructuredData\ProductStructuredData' + public: true + arguments: + - '@Oksydan\Module\IsThemeCore\Core\StructuredData\Provider\StructuredDataProductProvider' + - '@Oksydan\Module\IsThemeCore\Core\StructuredData\Presenter\StructuredDataProductPresenter' + + Oksydan\Module\IsThemeCore\Core\Partytown\PartytownScript: + class: Oksydan\Module\IsThemeCore\Core\Partytown\PartytownScript + arguments: + - "@Is_themecore" + + Oksydan\Module\IsThemeCore\Core\Partytown\PartytownScriptUriResolver: + class: Oksydan\Module\IsThemeCore\Core\Partytown\PartytownScriptUriResolver + arguments: + - "@=service('prestashop.adapter.legacy.context').getContext()" diff --git a/is_themecore/config/index.php b/is_themecore/config/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/config/index.php @@ -0,0 +1,11 @@ +displayType = Tools::getValue('displayType'); + } + + public function initContent() + { + parent::initContent(); + + $themeDisplay = new ThemeListDisplay(); + + if ($this->displayType) { + $themeDisplay->setDisplay($this->displayType); + $this->ajaxRender(json_encode([ + 'hasError' => false, + 'success' => true, + ])); + } else { + $this->ajaxRender(json_encode([ + 'hasError' => true, + 'success' => false, + ])); + } + } +} diff --git a/is_themecore/controllers/front/index.php b/is_themecore/controllers/front/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/controllers/front/index.php @@ -0,0 +1,11 @@ + Configuration values + */ + public const CONFIGURATION_VALUES = [ + GeneralConfiguration::THEMECORE_DISPLAY_LIST => 'grid', + GeneralConfiguration::THEMECORE_EARLY_HINTS => false, + GeneralConfiguration::THEMECORE_PRELOAD_CSS => false, + GeneralConfiguration::THEMECORE_LOAD_PARTY_TOWN => false, + GeneralConfiguration::THEMECORE_DEBUG_PARTY_TOWN => false, + WebpConfiguration::THEMECORE_WEBP_ENABLED => false, + WebpConfiguration::THEMECORE_WEBP_QUALITY => 90, + WebpConfiguration::THEMECORE_WEBP_CONVERTER => null, + WebpConfiguration::THEMECORE_WEBP_SHARPYUV => false, + ]; + + /** + * @var string[] Hooks to register + */ + public const HOOKS = [ + 'actionOutputHTMLBefore', + 'actionDispatcherBefore', + 'actionFrontControllerSetMedia', + 'displayListingStructuredData', + 'displayHeader', + 'actionProductSearchAfter', + 'actionHtaccessCreate', + 'objectShopUrlAddAfter', + 'objectShopUrlUpdateAfter', + 'objectShopUrlDeleteAfter', + 'actionFrontControllerInitBefore', + ]; + + /** + * @var Configuration Configuration + */ + private $configuration; + + public function __construct() + { + $this->name = 'is_themecore'; + $this->tab = 'others'; + $this->version = '4.1.3'; + $this->author = 'Igor Stępień'; + $this->ps_versions_compliancy = ['min' => '8.0.0', 'max' => _PS_VERSION_]; + + $this->bootstrap = true; + + parent::__construct(); + + $this->displayName = $this->trans( + 'Theme core module', + [], + 'Modules.isthemecore.Admin' + ); + $this->description = $this->trans( + 'Required for theme to work.', + [], + 'Modules.isthemecore.Admin' + ); + + $this->tabs = [ + [ + 'name' => 'Theme core module settings', + 'class_name' => 'themecoreSettings', + 'route_name' => 'is_themecore_module_settings', + 'parent_class_name' => 'CONFIGURE', + 'visible' => false, + 'wording' => 'Theme core module settings', + 'wording_domain' => 'Modules.isthemecore.Admin', + ], + ]; + + $this->configuration = new Configuration(); + } + + /** + * {@inheritdoc} + */ + public function isUsingNewTranslationSystem(): bool + { + return true; + } + + /** + * {@inheritdoc} + */ + public function install(): bool + { + return parent::install() + && $this->installConfiguration() + && $this->installPartytown() + && $this->registerHook(self::HOOKS) + ; + } + + /** + * Install configuration values + */ + private function installConfiguration(): bool + { + try { + foreach (self::CONFIGURATION_VALUES as $key => $default_value) { + $this->configuration->set($key, $default_value); + } + } catch (Exception $e) { + return false; + } + + return true; + } + + /** + * Install Partytown + */ + private function installPartytown(): bool + { + $installer = new FilesInstallation($this); // SERVICES NOT AVAILABLE DURING INSTALLATION + + try { + $installer->installFiles(); + } catch (Exception $e) { + return false; + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function uninstall(): bool + { + return parent::uninstall() + && $this->uninstallConfiguration() + ; + } + + /** + * Uninstall configuration values + */ + private function uninstallConfiguration(): bool + { + try { + foreach (array_keys(self::CONFIGURATION_VALUES) as $key) { + $this->configuration->remove($key); + } + } catch (Exception $e) { + return false; + } + + return true; + } + + /** + * Get module configuration page content + */ + public function getContent(): void + { + $container = SymfonyContainer::getInstance(); + + if ($container != null) { + /** @var UrlGeneratorInterface */ + $router = $container->get('router'); + + Tools::redirectAdmin($router->generate('is_themecore_module_settings')); + } + } + + public function __call(string $methodName, array $arguments) + { + return $this + ->getHookDispatcher() + ->dispatch($methodName, $arguments[0] ?? []); + } + + protected function getHookDispatcher(): HookDispatcher + { + if (!isset($this->hookDispatcher)) { + if (!class_exists(HookDispatcher::class)) { + require_once dirname(__FILE__) . '/vendor/autoload.php'; + } + + $this->hookDispatcher = new HookDispatcher($this); + } + + return $this->hookDispatcher; + } +} diff --git a/is_themecore/logo.png b/is_themecore/logo.png new file mode 100644 index 0000000..0316df9 Binary files /dev/null and b/is_themecore/logo.png differ diff --git a/is_themecore/src/Controller/Admin/SettingsController.php b/is_themecore/src/Controller/Admin/SettingsController.php new file mode 100644 index 0000000..c6f7ca4 --- /dev/null +++ b/is_themecore/src/Controller/Admin/SettingsController.php @@ -0,0 +1,206 @@ +getGeneralFormHandler(); + $webpFormDataHandler = $this->getWebpFormHandler(); + + /** @var FormInterface $generalForm */ + $generalForm = $generalFormDataHandler->getForm(); + $webpForm = $webpFormDataHandler->getForm(); + + return $this->render('@Modules/is_themecore/views/templates/back/components/layouts/settings.html.twig', [ + 'general_form' => $generalForm->createView(), + 'webp_form' => $webpForm->createView(), + ]); + } + + /** + * @AdminSecurity( + * "is_granted('update', request.get('_legacy_controller')) && is_granted('create', request.get('_legacy_controller')) && is_granted('delete', request.get('_legacy_controller'))", + * message="You do not have permission to update this.", + * redirectRoute="is_themecore_module_settings" + * ) + * + * @DemoRestricted(redirectRoute="is_themecore_module_settings") + * + * @param Request $request + * + * @return RedirectResponse + * + * @throws \LogicException + */ + public function processGeneralFormAction(Request $request) + { + return $this->processForm( + $request, + $this->getGeneralFormHandler(), + 'General' + ); + } + + /** + * @AdminSecurity( + * "is_granted('update', request.get('_legacy_controller')) && is_granted('create', request.get('_legacy_controller')) && is_granted('delete', request.get('_legacy_controller'))", + * message="You do not have permission to update this.", + * redirectRoute="is_themecore_module_settings" + * ) + * + * @DemoRestricted(redirectRoute="is_themecore_module_settings") + * + * @param Request $request + * + * @return RedirectResponse + * + * @throws \LogicException + */ + public function processWebpFormAction(Request $request) + { + return $this->processForm( + $request, + $this->getWebpFormHandler(), + 'Webp' + ); + } + + /** + * @DemoRestricted(redirectRoute="is_themecore_module_settings") + * + * @param Request $request + * + * @return RedirectResponse + * + * @throws \LogicException + */ + public function processWebpEraseImages(Request $request) + { + $time_start = microtime(true); + $eraser = $this->get('oksydan.module.is_themecore.core.webp.webp_files_eraser'); + + switch ($request->get('type')) { + case 'all': + $eraser->setQuery(_PS_ROOT_DIR_); + break; + case 'product': + $eraser->setQuery(_PS_PROD_IMG_DIR_); + break; + case 'module': + $eraser->setQuery(_PS_MODULE_DIR_); + break; + case 'cms': + $eraser->setQuery(_PS_IMG_DIR_ . 'cms/'); + break; + case 'themes': + $eraser->setQuery(_PS_ROOT_DIR_ . '/themes/'); + break; + default: + $eraser->setQuery(_PS_ROOT_DIR_); + break; + } + + $eraser->eraseFiles(); + + $time_end = microtime(true); + $execution_time = round($time_end - $time_start, 2); + + $this->addFlash('success', $this->trans('%1$s - webp images has been erased successfully in %2$ss', 'Modules.isthemecore.Admin', [$eraser->getFilesCount(), $execution_time])); + + return $this->redirectToRoute('is_themecore_module_settings'); + } + + /** + * Process form. + * + * @param Request $request + * @param FormHandlerInterface $formHandler + * @param string $hookName + * + * @return RedirectResponse + */ + private function processForm(Request $request, FormHandlerInterface $formHandler) + { + $form = $formHandler->getForm(); + $form->handleRequest($request); + + if ($form->isSubmitted()) { + if ($form->isValid()) { + $data = $form->getData(); + $saveErrors = $formHandler->save($data); + + if (!empty($data['webp_enabled'])) { + $generator = $this->get('oksydan.module.is_themecore.core.htaccess.htaccess_generator'); + + $generator->generate((bool) $data['webp_enabled']); + $generator->writeFile(); + } + + if (0 === count($saveErrors)) { + $this->addFlash('success', $this->trans('Successful update.', 'Admin.Notifications.Success')); + } else { + $this->flashErrors($saveErrors); + } + } + + $formErrors = []; + foreach ($form->getErrors(true) as $error) { + $formErrors[] = $error->getMessage(); + } + $this->flashErrors($formErrors); + } + + return $this->redirectToRoute('is_themecore_module_settings'); + } + + /** + * @return FormHandlerInterface + */ + private function getGeneralFormHandler() + { + /** @var FormHandlerInterface */ + $formDataHandler = $this->get('oksydan.module.is_themecore.form.settings.general_form_data_handler'); + + return $formDataHandler; + } + + /** + * @return FormHandlerInterface + */ + private function getWebpFormHandler() + { + /** @var FormHandlerInterface */ + $formDataHandler = $this->get('oksydan.module.is_themecore.form.settings.webp_form_data_handler'); + + return $formDataHandler; + } +} diff --git a/is_themecore/src/Controller/Admin/index.php b/is_themecore/src/Controller/Admin/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/src/Controller/Admin/index.php @@ -0,0 +1,11 @@ +context = \Context::getContext(); + $this->pageName = $this->context->controller->getPageName(); + $this->getAvailableBreadcrumbs(); + } + + protected function getAvailableBreadcrumbs() + { + $this->breadcrumbs = $this->getCommonBreadcrumbs(); + } + + public function getBreadcrumb() + { + $breadcrumb = []; + $breadcrumb['links'] = $this->getBreadcrumbByPageName(); + $breadcrumb['count'] = count($breadcrumb['links']); + + return $breadcrumb; + } + + public function getBreadcrumbByPageName() + { + $breadcrumb = []; + + if (isset($this->breadcrumbs[$this->pageName])) { + $breadcrumb = $this->breadcrumbs[$this->pageName]; + } + + return $breadcrumb; + } + + protected function getCommonBreadcrumbs() + { + $pages = [ + [ + 'controller' => 'cart', + 'name' => $this->context->getTranslator()->trans('Shopping Cart', [], 'Shop.Theme.Checkout'), + ], + [ + 'controller' => 'pagenotfound', + 'name' => $this->context->getTranslator()->trans('404', [], 'Shop.Theme.Global'), + ], + [ + 'controller' => 'stores', + 'name' => $this->context->getTranslator()->trans('Our stores', [], 'Shop.Theme.Global'), + ], + [ + 'controller' => 'sitemap', + 'name' => $this->context->getTranslator()->trans('Sitemap', [], 'Shop.Theme.Global'), + ], + ]; + + $breadcrumbs = []; + foreach ($pages as $page) { + $breadcrumbs[$page['controller']] = [ + [ + 'url' => $this->context->link->getPageLink('index'), + 'title' => $this->context->getTranslator()->trans('Home', [], 'Shop.Theme.Global'), + ], + [ + 'url' => $this->context->link->getPageLink($page['controller']), + 'title' => $page['name'], + ], + ]; + } + + return $breadcrumbs; + } +} diff --git a/is_themecore/src/Core/Breadcrumbs/index.php b/is_themecore/src/Core/Breadcrumbs/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/src/Core/Breadcrumbs/index.php @@ -0,0 +1,11 @@ + '~~start-is_themecore~~', + 'COMMENT_END' => '~~end-is_themecore~~', + ]; + + public function __construct(\Is_themecore $module) + { + $this->domains = \Tools::getDomains(); + $this->module = $module; + $this->moduleWebpGeneratorFile = "%{ENV:REWRITEBASE}modules/{$this->module->name}/webp.php"; + } + + public function generate($addRewrite = true): void + { + $htaccessFile = $this->getHtaccessFilePath(); + + if (file_exists($htaccessFile)) { + $content = \Tools::file_get_contents($htaccessFile); + + if (preg_match('#^(.*)\# ' . $this->wrapperBlockComments['COMMENT_START'] . '.*\# ' . $this->wrapperBlockComments['COMMENT_END'] . '[^\n]*(.*)$#s', $content, $match)) { + $this->contentBefore = $match[1]; + $this->contentAfter = $match[2]; + } else { + $this->contentAfter = $content; + } + } + + if ($addRewrite) { + $this->generateHtaccessHeader(); + + $this->write(''); + $this->write('RewriteEngine On'); + $this->writeNl(); + $this->generateImagesRewrites(); + $this->write(''); + + $this->write("# {$this->wrapperBlockComments['COMMENT_END']} Do not remove this comment"); + } + + $this->write($this->contentAfter); + } + + public function writeFile(): bool + { + $htaccessFile = $this->getHtaccessFilePath(); + + if (!$writeToFile = @fopen($htaccessFile, 'wb')) { + return false; + } + + if (!fwrite($writeToFile, $this->tempContent)) { + return false; + } + + fclose($writeToFile); + + return true; + } + + protected function getMediaDomains(): string + { + if ($this->mediaDomains === null) { + if (\Configuration::getMultiShopValues('PS_MEDIA_SERVER_1') + && \Configuration::getMultiShopValues('PS_MEDIA_SERVER_2') + && \Configuration::getMultiShopValues('PS_MEDIA_SERVER_3') + ) { + $this->medias = [ + \Configuration::getMultiShopValues('PS_MEDIA_SERVER_1'), + \Configuration::getMultiShopValues('PS_MEDIA_SERVER_2'), + \Configuration::getMultiShopValues('PS_MEDIA_SERVER_3'), + ]; + } + + $this->mediaDomains = ''; + + foreach ($this->medias as $media) { + foreach ($media as $mediaUrl) { + if ($mediaUrl) { + $this->mediaDomains .= 'RewriteCond %{HTTP_HOST} ^' . $mediaUrl . '$ [OR]' . PHP_EOL; + } + } + } + } + + return $this->mediaDomains; + } + + protected function getDomainRewriteCond($domain): string + { + return "RewriteCond %{HTTP_HOST} ^$domain$"; + } + + protected function generateImagesRewrites(): void + { + foreach ($this->domains as $domain => $uri) { + $this->generateProductImagesRewrite($domain); + $this->generateCategoryImagesRewrite($domain); + $this->generateOtherImagesRewrite($domain); + } + } + + protected function writeMediaDomainsCondition() + { + $mediaDomains = $this->getMediaDomains(); + + if ($mediaDomains) { + $this->write($mediaDomains, false); + } + } + + protected function generateProductImagesRewrite($domain): void + { + $domainRewriteCond = $this->getDomainRewriteCond($domain); + + for ($i = 1; $i <= 7; ++$i) { + $imgPath = $imgName = ''; + for ($j = 1; $j <= $i; ++$j) { + $imgPath .= '$' . $j . '/'; + $imgName .= '$' . $j; + } + $imgName .= '$' . $j; + + // WEBP FILE EXISTS + $this->writeMediaDomainsCondition(); + $this->write($domainRewriteCond); + $this->write('RewriteCond %{DOCUMENT_ROOT}/img/p/' . $imgPath . $imgName . '$' . ($j + 1) . '.webp -f'); + $this->write('RewriteRule ^' . str_repeat('([0-9])', $i) . '(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.webp$ %{ENV:REWRITEBASE}img/p/' . $imgPath . $imgName . '$' . ($j + 1) . '.webp [L]'); + $this->writeNl(); + + // WEBP FILE NOT EXISTS + $this->writeMediaDomainsCondition(); + $this->write($domainRewriteCond); + $this->write('RewriteCond %{DOCUMENT_ROOT}/img/p/' . $imgPath . $imgName . '$' . ($j + 1) . '.webp !-f'); + $this->write('RewriteRule ^' . str_repeat('([0-9])', $i) . '(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.webp$ ' . $this->moduleWebpGeneratorFile . '?source=%{DOCUMENT_ROOT}/img/p/' . $imgPath . $imgName . '$' . ($j + 1) . '.webp [NC,L]'); + $this->writeNl(); + } + } + + protected function generateCategoryImagesRewrite($domain): void + { + $domainRewriteCond = $this->getDomainRewriteCond($domain); + + // WEBP FILE EXISTS + $this->writeMediaDomainsCondition(); + $this->write($domainRewriteCond); + $this->write('RewriteCond %{DOCUMENT_ROOT}/img/c/$1$2.webp -f'); + $this->write('RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.webp$ %{ENV:REWRITEBASE}img/c/$1$2.webp [L]'); + $this->writeNl(); + + $this->writeMediaDomainsCondition(); + $this->write($domainRewriteCond); + $this->write('RewriteCond %{DOCUMENT_ROOT}/img/c/$1$2$3.webp -f'); + $this->write('RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.webp$ %{ENV:REWRITEBASE}img/c/$1$2$3.webp [L]'); + $this->writeNl(); + + // WEBP FILE NOT EXISTS + $this->writeMediaDomainsCondition(); + $this->write($domainRewriteCond); + $this->write('RewriteCond %{DOCUMENT_ROOT}/img/c/$1$2.webp !-f'); + $this->write('RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.webp$ ' . $this->moduleWebpGeneratorFile . '?source=%{DOCUMENT_ROOT}/img/c/$1$2.webp [NC,L]'); + $this->writeNl(); + + $this->writeMediaDomainsCondition(); + $this->write($domainRewriteCond); + $this->write('RewriteCond %{DOCUMENT_ROOT}/img/c/$1$2$3.webp !-f'); + $this->write('RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.webp$ ' . $this->moduleWebpGeneratorFile . '?source=%{DOCUMENT_ROOT}/img/c/$1$2$3.webp [NC,L]'); + $this->writeNl(); + } + + protected function generateOtherImagesRewrite($domain): void + { + $domainRewriteCond = $this->getDomainRewriteCond($domain); + + // WEBP FILE NOT EXISTS + $this->writeMediaDomainsCondition(); + $this->write($domainRewriteCond); + $this->write('RewriteCond %{REQUEST_FILENAME} !-f'); + $this->write('RewriteRule ^(.*)\.webp$ ' . $this->moduleWebpGeneratorFile . '?source=%{DOCUMENT_ROOT}/$1.webp [NC,L]'); + $this->writeNl(); + } + + protected function generateHtaccessHeader(): void + { + $this->write("# {$this->wrapperBlockComments['COMMENT_START']} Do not remove this comment"); + $this->write('# Allow webp files to be sent by Apache 2.2'); + $this->write(''); + $this->write('', true, 1); + $this->write('Allow from all', true, 2); + $this->write('', true, 1); + $this->write(''); + $this->writeNl(); + + $this->write('# Allow webp files to be sent by Apache 2.4'); + $this->write(''); + $this->write('', true, 1); + $this->write('Require all granted', true, 2); + $this->write('allow from all', true, 2); + $this->write('', true, 1); + $this->write(''); + $this->writeNl(); + } + + protected function write($line, $addEOL = true, $tabs = 0): void + { + $this->tempContent .= str_repeat("\t", $tabs) . $line . ($addEOL ? PHP_EOL : ''); + } + + protected function writeNl(): void + { + $this->write(''); + } + + protected function getHtaccessFilePath(): string + { + return _PS_ROOT_DIR_ . '/.htaccess'; + } +} diff --git a/is_themecore/src/Core/Htaccess/index.php b/is_themecore/src/Core/Htaccess/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/src/Core/Htaccess/index.php @@ -0,0 +1,11 @@ +displayList)) { + $display = \Configuration::get(GeneralConfiguration::THEMECORE_DISPLAY_LIST); + } + + $response = new Response(); + + $response->headers->setCookie(new Cookie( + $this->cookieName, + $display, + (new \DateTime('now'))->modify('+ 30 days')->getTimestamp(), + '/' + )); + + return $response->sendHeaders(); + } + + public function getDisplay() + { + $displayFromCookie = $this->getRequest()->cookies->get($this->cookieName); + + if ($displayFromCookie) { + return $displayFromCookie; + } + + return \Configuration::get(GeneralConfiguration::THEMECORE_DISPLAY_LIST); + } + + public function getDisplayOptions() + { + return $this->displayList; + } +} diff --git a/is_themecore/src/Core/ListingDisplay/index.php b/is_themecore/src/Core/ListingDisplay/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/src/Core/ListingDisplay/index.php @@ -0,0 +1,11 @@ +module = $module; + } + + public function installFiles(): void + { + $this->installPartytown(); + } + + protected function getFileSystem(): Filesystem + { + return new Filesystem(); + } + + private function installPartytown(): void + { + $source = _PS_MODULE_DIR_ . $this->module->name . '/public/~partytown'; + $destination = _PS_ROOT_DIR_ . '/~partytown'; + $fileSystem = $this->getFileSystem(); + + if (!file_exists($source)) { + return; + } + + if (file_exists($destination)) { + $fileSystem->remove($destination); + } + + $fileSystem->mkdir($destination); + + $directoryIterator = new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS); + $iterator = new \RecursiveIteratorIterator($directoryIterator, \RecursiveIteratorIterator::SELF_FIRST); + + foreach ($iterator as $item) { + if ($item->isDir()) { + $fileSystem->mkdir($destination . DIRECTORY_SEPARATOR . $iterator->getSubPathName()); + } else { + $fileSystem->copy($item, $destination . DIRECTORY_SEPARATOR . $iterator->getSubPathName()); + } + } + } +} diff --git a/is_themecore/src/Core/Partytown/PartytownScript.php b/is_themecore/src/Core/Partytown/PartytownScript.php new file mode 100644 index 0000000..d145361 --- /dev/null +++ b/is_themecore/src/Core/Partytown/PartytownScript.php @@ -0,0 +1,36 @@ +module = $module; + } + + public function getScriptPath(): string + { + return _PS_MODULE_DIR_ . $this->module->name . '/public/partytown.js'; + } + + public function getScriptUri(): string + { + return $this->module->getPathUri() . '/public/partytown.js'; + } + + public function getScriptContent(): string + { + $script = ''; + $filePath = $this->getScriptPath(); + + if (file_exists($filePath)) { + $script = file_get_contents($filePath); + } + + return $script; + } +} diff --git a/is_themecore/src/Core/Partytown/PartytownScriptUriResolver.php b/is_themecore/src/Core/Partytown/PartytownScriptUriResolver.php new file mode 100644 index 0000000..951e0db --- /dev/null +++ b/is_themecore/src/Core/Partytown/PartytownScriptUriResolver.php @@ -0,0 +1,21 @@ +context = $context; + } + + public function getScriptUri(): string + { + return $this->context->shop->physical_uri . self::PUBLIC_PARTYTOWN_PATH; + } +} diff --git a/is_themecore/src/Core/Smarty/SmartyHelperFunctions.php b/is_themecore/src/Core/Smarty/SmartyHelperFunctions.php new file mode 100644 index 0000000..ab209ff --- /dev/null +++ b/is_themecore/src/Core/Smarty/SmartyHelperFunctions.php @@ -0,0 +1,192 @@ + $width, 'height' => $height]); + + $attributes['src'] = $placeholderSrc; + } + + $attributesToPrint = []; + + foreach ($attributes as $attr => $value) { + $attributesToPrint[] = $attr . '="' . $value . '"'; + } + + return implode(PHP_EOL, $attributesToPrint); + } + + public static function generateImageSvgPlaceholder($params) + { + $width = $params['width']; + $height = $params['height']; + + return "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='$width' height='$height' viewBox='0 0 1 1'%3E%3C/svg%3E"; + } + + public static function appendParamToUrl($params) + { + list( + 'url' => $url, + 'key' => $key, + 'value' => $value + ) = $params; + + $replace = false; + + if (isset($params['replace'])) { + $replace = $params['replace']; + } + + if (!is_array($value)) { + $value = [$value]; + } else { + $replace = false; + } + + foreach ($value as $qValue) { + $query = parse_url($url, PHP_URL_QUERY); + + if ($query) { + if ($replace) { + parse_str($query, $queryParams); + $queryParams[$key] = $qValue; + $url = str_replace("?$query", '?' . http_build_query($queryParams), $url); + } else { + $queryParams = []; + $queryParams[$key] = $qValue; + $url .= '&' . http_build_query($queryParams); + } + } else { + $url .= '?' . urlencode($key) . '=' . urlencode($qValue); + } + } + + return $url; + } + + public static function imagesBlock($params, $content, $smarty) + { + $webpEnabled = isset($params['webpEnabled']) ? $params['webpEnabled'] : \Configuration::get(WebpConfiguration::THEMECORE_WEBP_ENABLED); + + if ($webpEnabled && !empty($content)) { + $pictureGenerator = new WebpPictureGenerator($content); + + $pictureGenerator + ->loadContent() + ->generatePictureTags(); + + return $pictureGenerator->getContent(); + } + + return $content; + } + + public static function displayMobileBlock($params, $content, $smarty) + { + if (!empty($content) && \Context::getContext()->isMobile()) { + return $content; + } + + return ''; + } + + public static function displayDesktopBlock($params, $content, $smarty) + { + if (!empty($content) && !\Context::getContext()->isMobile()) { + return $content; + } + + return ''; + } + + public static function cmsImagesBlock($params, $content, $smarty) + { + $doc = new \DOMDocument(); + $doc->loadHTML('' . $content); + $context = \Context::getContext(); + + $images = $doc->getElementsByTagName('img'); + + $domains = \Tools::getDomains(); + $medias = [ + \Configuration::get('PS_MEDIA_SERVER_1'), + \Configuration::get('PS_MEDIA_SERVER_2'), + \Configuration::get('PS_MEDIA_SERVER_3'), + ]; + + $internalUrls = []; + + foreach ($domains as $domain => $options) { + $internalUrls[] = $domain; + } + + foreach ($medias as $media) { + if ($media) { + $internalUrls[] = $media; + } + } + + foreach ($images as $image) { + $newImg = $doc->createElement('img'); + $src = urldecode($image->attributes->getNamedItem('src')->nodeValue); + + if (!preg_match('/' . implode('|', $internalUrls) . '/i', $src)) { + $newImg->setAttribute('data-external-url', ''); + } + + foreach ($image->attributes as $attribute) { + $newImg->setAttribute($attribute->nodeName, $attribute->nodeValue); + } + + $image->parentNode->replaceChild($newImg, $image); + } + + $content = $doc->saveHTML(); + $content = str_replace('', '', $content); + + $webpEnabled = isset($params['webpEnabled']) ? $params['webpEnabled'] : \Configuration::get(WebpConfiguration::THEMECORE_WEBP_ENABLED); + + if ($webpEnabled && !empty($content)) { + $pictureGenerator = new WebpPictureGenerator($content); + + $pictureGenerator + ->loadContent() + ->generatePictureTags(); + + return $pictureGenerator->getContent(); + } + + return $content; + } +} diff --git a/is_themecore/src/Core/StructuredData/AbstractStructuredData.php b/is_themecore/src/Core/StructuredData/AbstractStructuredData.php new file mode 100644 index 0000000..c8f32d2 --- /dev/null +++ b/is_themecore/src/Core/StructuredData/AbstractStructuredData.php @@ -0,0 +1,45 @@ +provider = $provider; + $this->presenter = $presenter; + } + + /** + * Return formatted json data + * + * @return string + */ + public function getFormattedData(): string + { + $data = $this->provider->getData(); + + $jsonData = $this->presenter->present($data); + + \Hook::exec('actionStructuredData' . ucfirst($this->getStructuredDataType()), + [ + 'jsonData' => &$jsonData, + 'rawData' => $data, + ] + ); + + if (empty($jsonData)) { + return ''; + } else { + return json_encode($jsonData, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); + } + } +} diff --git a/is_themecore/src/Core/StructuredData/BreadcrumbStructuredData.php b/is_themecore/src/Core/StructuredData/BreadcrumbStructuredData.php new file mode 100644 index 0000000..7bd16aa --- /dev/null +++ b/is_themecore/src/Core/StructuredData/BreadcrumbStructuredData.php @@ -0,0 +1,11 @@ +breadcrumbData = $data; + + $this->presentBreadcrumbData(); + + return $this->presentedData; + } + + private function presentBreadcrumbData(): void + { + $breadcrumbs = $this->breadcrumbData['links']; + + if ($this->breadcrumbData['count'] > 1) { + $this->presentedData['@context'] = 'http://schema.org'; + $this->presentedData['@type'] = 'BreadcrumbList'; + $this->presentedData['itemListElement'] = []; + + foreach ($breadcrumbs as $i => $breadcrumb) { + $this->presentedData['itemListElement'][] = [ + '@type' => 'ListItem', + 'position' => $i + 1, + 'name' => $breadcrumb['title'], + 'item' => $breadcrumb['url'], + ]; + } + } + } +} diff --git a/is_themecore/src/Core/StructuredData/Presenter/StructuredDataPresenterInterface.php b/is_themecore/src/Core/StructuredData/Presenter/StructuredDataPresenterInterface.php new file mode 100644 index 0000000..2be69d3 --- /dev/null +++ b/is_themecore/src/Core/StructuredData/Presenter/StructuredDataPresenterInterface.php @@ -0,0 +1,15 @@ +context = $context; + } + + public function present($data): array + { + $this->productData = $data; + + $this->getProductBasics(); + $this->getProductIdentifier(); + $this->getProductBrandData(); + $this->getProductReviewsData(); + $this->getProductOffers(); + + return $this->presentedData; + } + + private function getProductBasics(): void + { + $this->presentedData['@context'] = 'http://schema.org/'; + $this->presentedData['@type'] = 'Product'; + $this->presentedData['name'] = $this->productData['name']; + $this->presentedData['category'] = $this->productData['category_name']; + + if (!empty($this->productData['description_short'])) { + $this->presentedData['description'] = strip_tags($this->productData['description_short']); + } + + if ($this->productData['default_image']) { + $this->presentedData['image'] = $this->productData['default_image']['large']['url']; + } + + if ($this->productData['reference']) { + $this->presentedData['sku'] = $this->productData['reference']; + } + + if (!empty($this->productData['weight']) && $this->productData['weight'] > 0) { + $this->presentedData['weight'] = [ + '@context' => 'https://schema.org', + '@type' => 'QuantitativeValue', + 'value' => $this->productData['weight'], + 'unitCode' => $this->productData['weight_unit'], + ]; + } + } + + private function getProductBrandData(): void + { + if (empty($this->productData['id_manufacturer'])) { + return; + } + + $productManufacturer = new \Manufacturer((int) $this->productData['id_manufacturer'], $this->context->language->id); + + if (!empty($productManufacturer->name)) { + $this->presentedData['brand'] = [ + '@type' => 'Brand', + 'name' => $productManufacturer->name, + ]; + } + } + + private function getProductIdentifier(): void + { + if (!empty($this->productData['ean13'])) { + $this->presentedData['gtin13'] = $this->productData['ean13']; + } elseif (!empty($this->productData['upc'])) { + $this->presentedData['gtin13'] = '0' . $this->productData['upc']; + } elseif (!empty($this->productData['isbn'])) { + $this->presentedData['isbn'] = $this->productData['isbn']; + } elseif (!empty($this->productData['reference'])) { + $this->presentedData['mpn'] = $this->productData['reference']; + } + } + + private function getProductOffers(): void + { + if (!$this->productData['show_price']) { + return; + } + + $this->presentedData['offers'] = [ + '@type' => 'Offer', + 'name' => $this->productData['name'], + 'price' => $this->productData['price_amount'], + 'url' => $this->productData['url'], + 'priceCurrency' => $this->context->currency->iso_code, + ]; + + if (count($this->productData['images']) > 0) { + $images = []; + + foreach ($this->productData['images'] as $img) { + $images[] = $img['large']['url']; + } + + $this->presentedData['offers']['image'] = $images; + } + + if ($this->productData['reference']) { + $this->presentedData['offers']['sku'] = $this->productData['reference']; + } + + $this->presentedData['offers']['availability'] = $this->productData['quantity'] > 0 || $this->productData['allow_oosp'] ? 'http://schema.org/InStock' : 'http://schema.org/OutOfStock'; + + if ($this->productData['show_condition'] && isset($this->productData['condition'])) { + $this->presentedData['offers']['itemCondition'] = $this->productData['condition']['schema_url']; + } + + if ($this->productData['specific_prices'] && $this->productData['specific_prices']['to'] > (new \DateTime())->format('Y-m-d H:i:s')) { + $date = new \DateTime($this->productData['specific_prices']['to']); + $this->presentedData['offers']['priceValidUntil'] = $date->format('Y-m-d'); + } + } + + private function getProductReviewsData(): void + { + if (empty($this->productData['productRating'])) { + return; + } + + $reviews = []; + + foreach ($this->productData['productRating']['reviews'] as $review) { + $datePublished = new \DateTime($review['date_add']); + + $reviews[] = [ + '@type' => 'Review', + 'author' => [ + '@type' => 'Person', + 'name' => $review['customer_name'], + ], + 'name' => $review['title'], + 'reviewBody' => $review['content'], + 'datePublished' => $datePublished->format(\DateTime::ATOM), + 'reviewRating' => [ + '@type' => 'Rating', + 'ratingValue' => $review['grade'], + ], + ]; + } + + $aggregateRating = [ + '@type' => 'AggregateRating', + 'ratingValue' => $this->productData['productRating']['averageGrade'], + 'ratingCount' => $this->productData['productRating']['commentsNb'], + 'reviewCount' => $this->productData['productRating']['commentsNb'], + ]; + + if ($reviews) { + $this->presentedData['review'] = $reviews; + } + $this->presentedData['aggregateRating'] = $aggregateRating; + } +} diff --git a/is_themecore/src/Core/StructuredData/Presenter/StructuredDataShopPresenter.php b/is_themecore/src/Core/StructuredData/Presenter/StructuredDataShopPresenter.php new file mode 100644 index 0000000..7e67d10 --- /dev/null +++ b/is_themecore/src/Core/StructuredData/Presenter/StructuredDataShopPresenter.php @@ -0,0 +1,75 @@ +context = $context; + } + + public function present($data): array + { + $this->shopData = $data; + + $this->presentShopData(); + + return $this->presentedData; + } + + private function presentShopData(): void + { + $this->presentedData['@context'] = 'http://schema.org'; + $this->presentedData['@type'] = 'Organization'; + $this->presentedData['name'] = $this->shopData['name']; + $this->presentedData['url'] = $this->context->link->getPageLink('index'); + $this->presentedData['logo'] = [ + '@type' => 'ImageObject', + 'url' => $this->shopData['logo'], + ]; + + if ($this->shopData['phone']) { + $this->presentedData['contactPoint'] = [ + '@type' => 'ContactPoint', + 'telephone' => $this->shopData['phone'], + 'contactType' => 'customer service', + ]; + } + + $address = $this->shopData['address']; + $postalCode = $address['postcode']; + $city = $address['city']; + $country = $address['country']; + $addressRegion = $address['state']; + $streetAddress = $address['address1']; + + if ($postalCode || $city || $country || $addressRegion || $streetAddress) { + $this->presentedData['address'] = [ + '@type' => 'PostalAddress', + ]; + + if ($postalCode) { + $this->presentedData['address']['postalCode'] = $postalCode; + } + if ($streetAddress) { + $this->presentedData['address']['streetAddress'] = $streetAddress; + } + if ($country || $city) { + $addressLocality = ''; + if ($city) { + $addressLocality = $city; + } + if ($country) { + $addressLocality .= ($addressLocality != '' ? ', ' : '') . $country; + } + + $this->presentedData['address']['addressLocality'] = $addressLocality; + } + } + } +} diff --git a/is_themecore/src/Core/StructuredData/Presenter/StructuredDataWebsitePresenter.php b/is_themecore/src/Core/StructuredData/Presenter/StructuredDataWebsitePresenter.php new file mode 100644 index 0000000..2dd591b --- /dev/null +++ b/is_themecore/src/Core/StructuredData/Presenter/StructuredDataWebsitePresenter.php @@ -0,0 +1,35 @@ +context = $context; + } + + public function present($data): array + { + $this->websiteData = $data; + + $this->presentShopData(); + + return $this->presentedData; + } + + private function presentShopData(): void + { + $this->presentedData['@context'] = 'http://schema.org'; + $this->presentedData['@type'] = 'WebSite'; + $this->presentedData['url'] = $this->context->link->getPageLink('index'); + $this->presentedData['image'] = [ + '@type' => 'ImageObject', + 'url' => $this->websiteData['logo'], + ]; + } +} diff --git a/is_themecore/src/Core/StructuredData/ProductStructuredData.php b/is_themecore/src/Core/StructuredData/ProductStructuredData.php new file mode 100644 index 0000000..ad82831 --- /dev/null +++ b/is_themecore/src/Core/StructuredData/ProductStructuredData.php @@ -0,0 +1,11 @@ +context = $context; + } + + public function getData(): array + { + return $this->context->controller->getBreadcrumb(); + } +} diff --git a/is_themecore/src/Core/StructuredData/Provider/StructuredDataProductProvider.php b/is_themecore/src/Core/StructuredData/Provider/StructuredDataProductProvider.php new file mode 100644 index 0000000..ec9ce9d --- /dev/null +++ b/is_themecore/src/Core/StructuredData/Provider/StructuredDataProductProvider.php @@ -0,0 +1,51 @@ +context = $context; + } + + private function provideProductCommentsDataIfModuleEnabled(): void + { + $commentsData = []; + + if (\Module::isEnabled('productcomments')) { + $productCommentRepository = $this->context->controller->getContainer()->get('product_comment_repository'); + $commentsModerate = (bool) \Configuration::get('PRODUCT_COMMENTS_MODERATE'); + $commentsNb = $productCommentRepository->getCommentsNumber($this->data['id'], $commentsModerate); + + if ($commentsNb > 0) { + $averageGrade = $productCommentRepository->getAverageGrade($this->data['id'], $commentsModerate); + $reviewsData = $productCommentRepository->paginate($this->data['id'], 1, 50, $commentsModerate); // get 50 reviews + + $commentsData = [ + 'averageGrade' => $averageGrade, + 'commentsNb' => $commentsNb, + 'reviews' => $reviewsData, + ]; + } + } + + $this->data['productRating'] = $commentsData; + } + + public function getProductData(): void + { + $this->data = $this->context->controller->getTemplateVarProduct()->jsonSerialize(); + } + + public function getData(): array + { + $this->getProductData(); + $this->provideProductCommentsDataIfModuleEnabled(); + + return $this->data; + } +} diff --git a/is_themecore/src/Core/StructuredData/Provider/StructuredDataProviderInterface.php b/is_themecore/src/Core/StructuredData/Provider/StructuredDataProviderInterface.php new file mode 100644 index 0000000..79dbeed --- /dev/null +++ b/is_themecore/src/Core/StructuredData/Provider/StructuredDataProviderInterface.php @@ -0,0 +1,13 @@ +context = $context; + } + + public function getData(): array + { + return $this->context->smarty->getTemplateVars('shop'); + } +} diff --git a/is_themecore/src/Core/StructuredData/Provider/StructuredDataWebsiteProvider.php b/is_themecore/src/Core/StructuredData/Provider/StructuredDataWebsiteProvider.php new file mode 100644 index 0000000..077c685 --- /dev/null +++ b/is_themecore/src/Core/StructuredData/Provider/StructuredDataWebsiteProvider.php @@ -0,0 +1,18 @@ +context = $context; + } + + public function getData(): array + { + return $this->context->smarty->getTemplateVars('shop'); + } +} diff --git a/is_themecore/src/Core/StructuredData/ShopStructuredData.php b/is_themecore/src/Core/StructuredData/ShopStructuredData.php new file mode 100644 index 0000000..76d25e3 --- /dev/null +++ b/is_themecore/src/Core/StructuredData/ShopStructuredData.php @@ -0,0 +1,11 @@ +themeAssetsFileDir = $themeDir . 'config/assets.yml'; + } + + public function getFileParsed(): array + { + if (!$this->fileContentRead) { + if (file_exists($this->themeAssetsFileDir)) { + $this->fileParsed = Yaml::parse(file_get_contents($this->themeAssetsFileDir)); + } + + $this->fileContentRead = true; + } + + return $this->fileParsed; + } + + public function getCssAssets(): array + { + $cssAssets = []; + + if (!empty($this->getFileParsed()['css'])) { + $cssAssets = $this->getFileParsed()['css']; + } + + return $cssAssets; + } + + public function getJsAssets(): array + { + $jsAssets = []; + + if (!empty($this->getFileParsed()['js'])) { + $jsAssets = $this->getFileParsed()['js']; + } + + return $jsAssets; + } +} diff --git a/is_themecore/src/Core/ThemeAssets/ThemeAssetsRegister.php b/is_themecore/src/Core/ThemeAssets/ThemeAssetsRegister.php new file mode 100644 index 0000000..b4937fe --- /dev/null +++ b/is_themecore/src/Core/ThemeAssets/ThemeAssetsRegister.php @@ -0,0 +1,140 @@ +assetsDataProvider = $assetsDataProvider; + $this->context = $context; + $this->themeName = $this->context->shop->theme->getName(); + $this->currentPageName = $this->context->controller->getPageName(); + $this->themePath = 'themes/' . $this->themeName . '/assets/'; + $this->cssAssets = $assetsDataProvider->getCssAssets(); + $this->jsAssets = $assetsDataProvider->getJsAssets(); + } + + private function getFilteredCssAssetsByPage(): array + { + return $this->filterAssetsArrayByPage($this->cssAssets); + } + + private function getFilteredJsAssetsByPage(): array + { + return $this->filterAssetsArrayByPage($this->jsAssets); + } + + private function filterAssetsArrayByPage($assetsArray): array + { + $pageName = $this->currentPageName; + + return array_filter($assetsArray, function ($asset) use ($pageName) { + if (empty($asset['include'])) { + return true; + } + + if (in_array($pageName, $asset['include'])) { + return true; + } + + foreach ($asset['include'] as $matchType) { + $regex = str_replace( + ['\*'], + ['.*', '.'], + preg_quote($matchType) + ); + + if (preg_match('/^' . $regex . '$/is', $pageName)) { + return true; + } + } + + return false; + }); + } + + public function registerThemeAssets(): void + { + $this->registerJsAssets(); + $this->registerCssAssets(); + } + + public function registerJsAssets(): void + { + $assetsToRegister = $this->getFilteredJsAssetsByPage(); + + $default_params = [ + 'position' => \AbstractAssetManager::DEFAULT_JS_POSITION, + 'priority' => \AbstractAssetManager::DEFAULT_PRIORITY, + 'inline' => false, + 'attributes' => null, + 'server' => 'local', + ]; + + foreach ($assetsToRegister as $id => $asset) { + $params = array_merge($default_params, $asset); + $file = $params['server'] === 'local' ? $this->themePath . 'js/' . $asset['fileName'] : $asset['fileName']; + + $this->context->controller->registerJavascript( + 'theme-' . $id, + $file, + [ + 'position' => $params['position'], + 'priority' => $params['priority'], + 'inline' => $params['inline'], + 'attributes' => $params['attributes'], + 'server' => $params['server'], + ] + ); + } + } + + public function registerCssAssets(): void + { + $assetsToRegister = $this->getFilteredCssAssetsByPage(); + + $default_params = [ + 'media' => \AbstractAssetManager::DEFAULT_MEDIA, + 'priority' => \AbstractAssetManager::DEFAULT_PRIORITY, + 'inline' => false, + 'server' => 'local', + ]; + + foreach ($assetsToRegister as $id => $asset) { + $params = array_merge($default_params, $asset); + $file = $params['server'] === 'local' ? $this->themePath . 'css/' . $asset['fileName'] : $asset['fileName']; + + $this->context->controller->registerStylesheet( + 'theme-' . $id, + $file, + [ + 'media' => $params['media'], + 'priority' => $params['priority'], + 'server' => $params['server'], + ] + ); + } + } +} diff --git a/is_themecore/src/Core/Webp/RelatedImageFileFinder.php b/is_themecore/src/Core/Webp/RelatedImageFileFinder.php new file mode 100644 index 0000000..d8eaa4a --- /dev/null +++ b/is_themecore/src/Core/Webp/RelatedImageFileFinder.php @@ -0,0 +1,38 @@ +allowedImagesExtensions = $allowedImagesExtensions; + + return $this; + } + + public function getAllowedImagesExtensions() + { + return $this->allowedImagesExtensions; + } + + public function findFile($relatedFile) + { + $fileData = pathinfo($relatedFile); + $possibleFiles = []; + + $extensions = $this->getAllowedImagesExtensions(); + + foreach ($extensions as $ext) { + $possibleFiles[] = $fileData['dirname'] . '/' . $fileData['filename'] . '.' . $ext; + } + + foreach ($possibleFiles as $file) { + if (file_exists($file)) { + return $file; + } + } + } +} diff --git a/is_themecore/src/Core/Webp/WebpConvertLibraries.php b/is_themecore/src/Core/Webp/WebpConvertLibraries.php new file mode 100644 index 0000000..5b63676 --- /dev/null +++ b/is_themecore/src/Core/Webp/WebpConvertLibraries.php @@ -0,0 +1,60 @@ + ['label' => 'Cwebp binary'], + 'vips' => ['label' => 'Vips PHP extension'], + 'imagick' => ['label' => 'Imagick PHP extension'], + 'gmagick' => ['label' => 'Gmagick PHP extension'], + 'imagemagick' => ['label' => 'Imagemagick binary'], + 'graphicsmagick' => ['label' => 'Graphicsmagick binary (gm)'], + 'gd' => ['label' => 'Gd PHP extension'], + // NOT SUPPORTED + // 'ewww' => ['label' => 'EWWW cloud service'], + ]; + + protected $exampleImgFile = _PS_MODULE_DIR_ . 'is_themecore/views/img/example.jpg'; + protected $exampleImgFileDesc = _PS_MODULE_DIR_ . 'is_themecore/views/img/example.webp'; + + public function getConvertersList(): array + { + $converters = $this->converters; + + foreach ($converters as $converterId => $converterOptions) { + $converters[$converterId]['id'] = $converterId; + + try { + $converterInstance = ConverterFactory::makeConverter($converterId, $this->exampleImgFile, $this->exampleImgFileDesc, []); + $converterInstance->checkOperationality(); + $converterInstance->doConvert(); + $converters[$converterId]['disabled'] = false; + } catch (ConversionFailedException $conversionFailedException) { + $converters[$converterId]['disabled'] = true; + } catch (ConverterNotFoundException $converterNotFoundException) { + $converters[$converterId]['disabled'] = true; + } + } + + return $converters; + } + + public function getFirstAvailableConverter(): array + { + $list = $this->getConvertersList(); + + foreach ($list as $converter) { + if (!$converter['disabled']) { + return $converter; + } + } + + return []; + } +} diff --git a/is_themecore/src/Core/Webp/WebpFilesEraser.php b/is_themecore/src/Core/Webp/WebpFilesEraser.php new file mode 100644 index 0000000..17987e8 --- /dev/null +++ b/is_themecore/src/Core/Webp/WebpFilesEraser.php @@ -0,0 +1,79 @@ +finder = new Finder(); + } + + public function setQuery($query) + { + $this->query = $query; + + return $this; + } + + public function getQuery() + { + return $this->query; + } + + public function setExcludeList(array $excludeList) + { + $this->excludeList = $excludeList; + + return $this; + } + + public function getExcludeList() + { + return $this->excludeList; + } + + private function setFilesCount() + { + $this->filesCount = iterator_count($this->files); + + return $this; + } + + public function getFilesCount() + { + return $this->filesCount; + } + + private function findFiles() + { + $this->files = $this->finder + ->files() + ->ignoreUnreadableDirs() + ->in($this->query) + ->exclude($this->excludeList) + ->name('*.webp'); + } + + public function eraseFiles() + { + $this->findFiles(); + $this->setFilesCount(); + + foreach ($this->files as $file) { + try { + unlink($file->getPathname()); + } catch (\Throwable $error) { + throw $error; + } + } + } +} diff --git a/is_themecore/src/Core/Webp/WebpGenerator.php b/is_themecore/src/Core/Webp/WebpGenerator.php new file mode 100644 index 0000000..fdc493c --- /dev/null +++ b/is_themecore/src/Core/Webp/WebpGenerator.php @@ -0,0 +1,110 @@ +fileFinder = $fileFinder; + } + + public function setQuality($quality) + { + $this->quality = $quality; + + return $this; + } + + public function getQuality(): int + { + return $this->quality; + } + + public function setConverter($converter) + { + $this->converter = $converter; + + return $this; + } + + public function getConverter(): string + { + return $this->converter; + } + + public function setSharpYuv($sharpYuv) + { + $this->sharpYuv = $sharpYuv; + + return $this; + } + + public function getSharpYuv(): bool + { + return $this->sharpYuv; + } + + public function setDebugEnabled($debugEnabled) + { + $this->debugEnabled = $debugEnabled; + + return $this; + } + + public function getDebugEnabled(): bool + { + return $this->debugEnabled; + } + + public function setDestinationFile($destinationFile) + { + $this->destinationFile = $destinationFile; + + return $this; + } + + public function getDestinationFile(): string + { + return $this->destinationFile; + } + + public function findRelatedFile() + { + return $this->fileFinder->findFile($this->getDestinationFile()); + } + + public function convertAndServe() + { + $sourceFile = $this->findRelatedFile(); + + WebPConvert::serveConverted($sourceFile, $this->destinationFile, [ + 'fail' => 'original', + 'show-report' => $this->getDebugEnabled(), + + 'serve-image' => [ + 'headers' => [ + 'cache-control' => true, + 'vary-accept' => true, + // other headers can be toggled... + ], + 'cache-control-header' => 'max-age=2', + ], + 'convert' => [ + 'stack-converters' => [$this->getConverter()], + 'quality' => $this->getQuality(), + 'encoding' => 'auto', + 'sharp-yuv' => $this->getSharpYuv(), + ], + ]); + } +} diff --git a/is_themecore/src/Core/Webp/WebpPictureGenerator.php b/is_themecore/src/Core/Webp/WebpPictureGenerator.php new file mode 100644 index 0000000..e770148 --- /dev/null +++ b/is_themecore/src/Core/Webp/WebpPictureGenerator.php @@ -0,0 +1,109 @@ +content = $content; + $this->doc = new \DOMDocument(); + } + + public function loadContent() + { + $this->doc->loadHTML('' . $this->content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); + + return $this; + } + + public function generatePictureTags(): void + { + $images = $this->doc->getElementsByTagName('img'); + + if (0 === count($images)) { + return; + } + + foreach ($images as $image) { + if ($image->hasAttribute('data-external-url')) { + continue; + } + + $this->generatePictureTagFromImg($image); + } + + $this->content = $this->doc->saveHTML(); + $this->content = str_replace('', '', $this->content); + } + + private function generatePictureTagFromImg($image) + { + $lazyLoad = !empty($params['lazyload']) ? $params['lazyload'] : (bool) preg_match('/' . implode('|', ['lazyload', 'swiper-lazy']) . '/i', $image->ownerDocument->saveHTML($image)); + $srcAttributePrefix = $lazyLoad ? 'data-' : ''; + $containSrcset = $image->hasAttribute($srcAttributePrefix . 'srcset'); + $srcAttribute = $srcAttributePrefix . ($containSrcset ? 'srcset' : 'src'); + + $src = $image->getAttribute($srcAttribute); + $rawSrcArray = explode(',', $src); + $imageSrcArray = []; + + foreach ($rawSrcArray as $rawSrc) { + $srcWithMediaArray = explode(' ', $rawSrc); + + $srcWithMediaArray = array_values(array_filter($srcWithMediaArray, function ($elem) { + return !empty($elem); + })); + + $imageSrcArray[] = [ + 'file' => $srcWithMediaArray[0] ?? null, + 'media' => $srcWithMediaArray[1] ?? null, + 'ext' => isset($srcWithMediaArray[0]) ? pathinfo($srcWithMediaArray[0], PATHINFO_EXTENSION) : null, + ]; + } + + $picture = $this->doc->createElement('picture'); + $pict_clone = $picture->cloneNode(); + $image->parentNode->replaceChild($pict_clone, $image); + $pict_clone->appendChild($image); + + $source = $this->doc->createElement('source'); + $source->setAttribute('type', 'image/webp'); + $sourceWebp = ''; + + $lastKey = array_key_last($imageSrcArray); + + foreach ($imageSrcArray as $key => $imageSrc) { + $ext = explode('?', $imageSrc['ext']); + $ext = $ext[0] ?? null; + + if (!in_array($ext, $this->allowedExtensions)) { + continue; + } + + $newWebpSrc = str_replace('.' . $imageSrc['ext'], '.webp', $imageSrc['file']); + + $sourceWebp .= $newWebpSrc . ($imageSrc['media'] ? ' ' . $imageSrc['media'] : ''); + + if ($key != $lastKey) { + $sourceWebp .= ', '; + } + } + + if ($sourceWebp) { + $source->setAttribute($lazyLoad ? 'data-srcset' : 'srcset', $sourceWebp); + $src_clone = $source->cloneNode(); + $image->parentNode->replaceChild($src_clone, $image); + $src_clone->appendChild($image); + } + } + + public function getContent(): string + { + return $this->content; + } +} diff --git a/is_themecore/src/Core/Webp/index.php b/is_themecore/src/Core/Webp/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/src/Core/Webp/index.php @@ -0,0 +1,11 @@ +themeListDisplay = $themeListDisplay; + } + + /** + * @return array + */ + public function getChoices(): array + { + $choices = []; + + foreach ($this->themeListDisplay->getDisplayOptions() as $display) { + $choices[$display] = $display; + } + + return $choices; + } +} diff --git a/is_themecore/src/Form/ChoiceProvider/WebpLibraryChoiceProvider.php b/is_themecore/src/Form/ChoiceProvider/WebpLibraryChoiceProvider.php new file mode 100644 index 0000000..2752c2d --- /dev/null +++ b/is_themecore/src/Form/ChoiceProvider/WebpLibraryChoiceProvider.php @@ -0,0 +1,50 @@ +webpConvertLibraries = $webpConvertLibraries; + } + + /** + * @return array + */ + public function getChoices(): array + { + $choices = []; + + foreach ($this->webpConvertLibraries->getConvertersList() as $converter) { + $choices[$converter['label']] = $converter['id']; + } + + return $choices; + } + + /** + * @return array + */ + public function getChoicesFull(): array + { + $choices = []; + + foreach ($this->webpConvertLibraries->getConvertersList() as $converter) { + $choices[$converter['id']] = $converter; + } + + return $choices; + } +} diff --git a/is_themecore/src/Form/ChoiceProvider/index.php b/is_themecore/src/Form/ChoiceProvider/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/src/Form/ChoiceProvider/index.php @@ -0,0 +1,11 @@ + + */ + private array $fields = [ + 'list_display_settings' => self::THEMECORE_DISPLAY_LIST, + 'early_hints' => self::THEMECORE_EARLY_HINTS, + 'preload_css' => self::THEMECORE_PRELOAD_CSS, + 'load_party_town' => self::THEMECORE_LOAD_PARTY_TOWN, + 'debug_party_town' => self::THEMECORE_DEBUG_PARTY_TOWN, + ]; + + /** + * {@inheritdoc} + * + * @return array + */ + public function getConfiguration(): array + { + $configurationValues = []; + + foreach ($this->fields as $field => $configurationKey) { + $configurationValues[$field] = $this->configuration->get($configurationKey); + } + + return $configurationValues; + } + + /** + * {@inheritdoc} + * + * @param array $configuration + * + * @return array> + */ + public function updateConfiguration(array $configuration): array + { + $errors = []; + + if (!$this->validateConfiguration($configuration)) { + $errors[] = [ + 'key' => 'Invalid configuration', + 'parameters' => [], + 'domain' => 'Admin.Notifications.Warning', + ]; + } else { + $shopConstraint = $this->getShopConstraint(); + + try { + foreach ($this->fields as $field => $configurationKey) { + $this->updateConfigurationValue($configurationKey, $field, $configuration, $shopConstraint); + } + } catch (\Exception $exception) { + $errors[] = [ + 'key' => $exception->getMessage(), + 'parameters' => [], + 'domain' => 'Admin.Notifications.Warning', + ]; + } + } + + return $errors; + } + + /** + * Ensure the parameters passed are valid. + * + * @param array $configuration + * + * @return bool Returns true if no exception are thrown + */ + public function validateConfiguration(array $configuration): bool + { + foreach ($this->fields as $field => $configurationKey) { + $multistoreKey = MultistoreCheckboxEnabler::MULTISTORE_FIELD_PREFIX . $field; + $this->fields[$multistoreKey] = ''; + } + + foreach ($configuration as $key => $value) { + if (!key_exists($key, $this->fields)) { + return false; + } + } + + return true; + } + + /** + * @return OptionsResolver + */ + protected function buildResolver(): OptionsResolver + { + return (new OptionsResolver()) + ->setDefined(self::CONFIGURATION_FIELDS) + ->setAllowedTypes('list_display_settings', ['string', 'null']) + ->setAllowedTypes('early_hints', 'bool') + ->setAllowedTypes('preload_css', 'bool') + ->setAllowedTypes('load_party_town', 'bool') + ->setAllowedTypes('debug_party_town', 'bool'); + } +} diff --git a/is_themecore/src/Form/Settings/GeneralFormDataProvider.php b/is_themecore/src/Form/Settings/GeneralFormDataProvider.php new file mode 100644 index 0000000..17911a5 --- /dev/null +++ b/is_themecore/src/Form/Settings/GeneralFormDataProvider.php @@ -0,0 +1,49 @@ +generalConfiguration = $generalConfiguration; + } + + /** + * {@inheritdoc} + * + * @return array The form data as an associative array + */ + public function getData(): array + { + return $this->generalConfiguration->getConfiguration(); + } + + /** + * {@inheritdoc} + * + * @param array $data + * + * @return array> An array of errors messages if data can't persisted + */ + public function setData(array $data): array + { + return $this->generalConfiguration->updateConfiguration($data); + } +} diff --git a/is_themecore/src/Form/Settings/GeneralType.php b/is_themecore/src/Form/Settings/GeneralType.php new file mode 100644 index 0000000..dc88221 --- /dev/null +++ b/is_themecore/src/Form/Settings/GeneralType.php @@ -0,0 +1,104 @@ +displayListChoices = $displayListChoices; + } + + /** + * {@inheritdoc} + * + * @param FormBuilderInterface $builder + * @param array $options + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder + ->add('list_display_settings', + ChoiceType::class, + [ + 'choices' => $this->displayListChoices, + 'label' => $this->trans('Default list display', 'Modules.isthemecore.Admin'), + 'multistore_configuration_key' => GeneralConfiguration::THEMECORE_DISPLAY_LIST, + ] + ) + ->add('early_hints', + SwitchType::class, + [ + 'required' => false, + 'label' => $this->trans('Early hints (HTTP 103) enabled', 'Modules.isthemecore.Admin'), + 'help' => $this->trans('Cloudflare CDN, Early hints option have to enabled. More information', 'Modules.isthemecore.Admin'), + 'multistore_configuration_key' => GeneralConfiguration::THEMECORE_EARLY_HINTS, + ] + ) + ->add('preload_css', + SwitchType::class, + [ + 'required' => false, + 'label' => $this->trans('Preload css enabled, only working with CCC for css option enabled', 'Modules.isthemecore.Admin'), + 'multistore_configuration_key' => GeneralConfiguration::THEMECORE_PRELOAD_CSS, + ] + ) + ->add('load_party_town', + SwitchType::class, + [ + 'required' => false, + 'label' => $this->trans('Load partytown script', 'Modules.isthemecore.Admin'), + 'help' => $this->trans('Be aware that partytown is still beta. Make sure that everything is working as expected before pushing it to your production store.', 'Modules.isthemecore.Admin'), + 'multistore_configuration_key' => GeneralConfiguration::THEMECORE_LOAD_PARTY_TOWN, + ] + ) + ->add('debug_party_town', + SwitchType::class, + [ + 'required' => false, + 'label' => $this->trans('Enable debug mode for partytown', 'Modules.isthemecore.Admin'), + 'multistore_configuration_key' => GeneralConfiguration::THEMECORE_DEBUG_PARTY_TOWN, + ] + ); + } + + /** + * {@inheritdoc} + * + * @see MultistoreConfigurationTypeExtension + */ + public function getParent(): string + { + return MultistoreConfigurationType::class; + } +} diff --git a/is_themecore/src/Form/Settings/WebpConfiguration.php b/is_themecore/src/Form/Settings/WebpConfiguration.php new file mode 100644 index 0000000..d75160f --- /dev/null +++ b/is_themecore/src/Form/Settings/WebpConfiguration.php @@ -0,0 +1,131 @@ + + */ + private $fields = [ + 'webp_enabled' => self::THEMECORE_WEBP_ENABLED, + 'webp_quality' => self::THEMECORE_WEBP_QUALITY, + 'webp_converter' => self::THEMECORE_WEBP_CONVERTER, + 'webp_sharpyuv' => self::THEMECORE_WEBP_SHARPYUV, + ]; + + /** + * @var Configuration + */ + protected $configuration; + + public function __construct(Configuration $configuration) + { + $this->configuration = $configuration; + } + + /** + * {@inheritdoc} + * + * @return array + */ + public function getConfiguration(): array + { + $configurationValues = []; + + foreach ($this->fields as $field => $configurationKey) { + $configurationValues[$field] = $this->configuration->get($configurationKey); + } + + return $configurationValues; + } + + /** + * {@inheritdoc} + * + * @param array $configuration + * + * @return array> + */ + public function updateConfiguration(array $configuration): array + { + $errors = []; + + if (!$this->validateConfiguration($configuration)) { + $errors[] = [ + 'key' => 'Invalid configuration', + 'parameters' => [], + 'domain' => 'Admin.Notifications.Warning', + ]; + } else { + try { + foreach ($this->fields as $field => $configurationKey) { + $this->configuration->set($configurationKey, $configuration[$field]); + } + } catch (\Exception $exception) { + $errors[] = [ + 'key' => $exception->getMessage(), + 'parameters' => [], + 'domain' => 'Admin.Notifications.Warning', + ]; + } + } + + return $errors; + } + + /** + * Ensure the parameters passed are valid. + * + * @param array $configuration + * + * @return bool Returns true if no exception are thrown + */ + public function validateConfiguration(array $configuration): bool + { + foreach ($configuration as $key => $value) { + if (!key_exists($key, $this->fields)) { + return false; + } + } + + return true; + } + + /** + * @return OptionsResolver + */ + protected function buildResolver(): OptionsResolver + { + return (new OptionsResolver()) + ->setDefined(self::CONFIGURATION_FIELDS) + ->setAllowedTypes('webp_enabled', 'bool') + ->setAllowedTypes('webp_quality', 'string') + ->setAllowedTypes('webp_converter', 'string') + ->setAllowedTypes('webp_sharpyuv', 'bool'); + } +} diff --git a/is_themecore/src/Form/Settings/WebpFormDataProvider.php b/is_themecore/src/Form/Settings/WebpFormDataProvider.php new file mode 100644 index 0000000..f165a10 --- /dev/null +++ b/is_themecore/src/Form/Settings/WebpFormDataProvider.php @@ -0,0 +1,49 @@ +webpConfiguration = $webpConfiguration; + } + + /** + * {@inheritdoc} + * + * @return array The form data as an associative array + */ + public function getData(): array + { + return $this->webpConfiguration->getConfiguration(); + } + + /** + * {@inheritdoc} + * + * @param array $data + * + * @return array> An array of errors messages if data can't persisted + */ + public function setData(array $data): array + { + return $this->webpConfiguration->updateConfiguration($data); + } +} diff --git a/is_themecore/src/Form/Settings/WebpType.php b/is_themecore/src/Form/Settings/WebpType.php new file mode 100644 index 0000000..7d50ad4 --- /dev/null +++ b/is_themecore/src/Form/Settings/WebpType.php @@ -0,0 +1,247 @@ +convertersList = $convertersList; + $this->convertersListFull = $convertersListFull; + $this->router = $router; + } + + private function allWebpConvertersDisabled(): bool + { + return array_reduce($this->convertersListFull, function ($carry, $item) { + return $carry && $item['disabled']; + }, true); + } + + /** + * {@inheritdoc} + * + * @param FormBuilderInterface $builder + * @param array $options + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $webpDisabled = $this->allWebpConvertersDisabled(); + $extraAttributes = []; + + if ($webpDisabled) { + $extraAttributes = [ + 'alert_message' => $this->trans('Webp converters not available contact your admin or hosting provider.', 'Modules.isthemecore.Admin'), + 'alert_type' => 'danger', + 'alert_position' => 'append', + ]; + } + + $builder + ->add('webp_enabled', + SwitchType::class, + array_merge( + [ + 'required' => false, + 'label' => $this->trans('Enable WEBP', 'Modules.isthemecore.Admin'), + 'disabled' => $webpDisabled, + ], + $extraAttributes + ) + ) + ->add('webp_sharpyuv', + SwitchType::class, + [ + 'required' => false, + 'label' => $this->trans('Enable better RGB->YUV color conversion', 'Modules.isthemecore.Admin'), + 'disabled' => $webpDisabled, + ] + ) + ->add('webp_quality', + TextType::class, + [ + 'required' => false, + 'label' => $this->trans('Webp quality', 'Modules.isthemecore.Admin'), + 'help' => $this->trans('Range 1-100', 'Modules.isthemecore.Admin'), + 'disabled' => $webpDisabled, + 'constraints' => [ + $this->getRangeConstraint(1, 100), + $this->getNotBlankConstraint(), + ], + ] + ) + ->add('webp_converter', + ChoiceType::class, + [ + 'choices' => $this->convertersList, + 'label' => $this->trans('Webp converter options', 'Modules.isthemecore.Admin'), + 'disabled' => $webpDisabled, + 'expanded' => true, + 'multiple' => false, + 'choice_attr' => function ($choice) { + return ['disabled' => $this->convertersListFull[$choice]['disabled']]; + }, + 'choice_label' => function ($choice) { + return $this->convertersListFull[$choice]['label'] . ($this->convertersListFull[$choice]['disabled'] ? '' . $this->trans('not available', 'Modules.isthemecore.Admin') . '' : ''); + }, + ] + ) + ->add('erase_all_webp', IconButtonType::class, [ + 'label' => $this->trans('Erase all webp images', 'Modules.isthemecore.Admin'), + 'type' => 'link', + 'icon' => 'delete', + 'attr' => [ + 'class' => 'btn-danger', + 'href' => $this->router->generate( + 'is_themecore_module_settings_webp_erase_all', + [ + 'type' => 'all', + ] + ), + ], + ]) + ->add('erase_product_webp', IconButtonType::class, [ + 'label' => $this->trans('Erase all product webp images', 'Modules.isthemecore.Admin'), + 'type' => 'link', + 'icon' => 'delete', + 'attr' => [ + 'class' => 'btn-danger', + 'href' => $this->router->generate( + 'is_themecore_module_settings_webp_erase_all', + [ + 'type' => 'product', + ] + ), + ], + ]) + ->add('erase_modules_webp', IconButtonType::class, [ + 'label' => $this->trans('Erase all modules webp images', 'Modules.isthemecore.Admin'), + 'type' => 'link', + 'icon' => 'delete', + 'attr' => [ + 'class' => 'btn-danger', + 'href' => $this->router->generate( + 'is_themecore_module_settings_webp_erase_all', + [ + 'type' => 'module', + ] + ), + ], + ]) + ->add('erase_cms_webp', IconButtonType::class, [ + 'label' => $this->trans('Erase all CMS webp images', 'Modules.isthemecore.Admin'), + 'type' => 'link', + 'icon' => 'delete', + 'attr' => [ + 'class' => 'btn-danger', + 'href' => $this->router->generate( + 'is_themecore_module_settings_webp_erase_all', + [ + 'type' => 'cms', + ] + ), + ], + ]) + ->add('erase_themes_webp', IconButtonType::class, [ + 'label' => $this->trans('Erase all themes webp images', 'Modules.isthemecore.Admin'), + 'type' => 'link', + 'icon' => 'delete', + 'attr' => [ + 'class' => 'btn-danger', + 'href' => $this->router->generate( + 'is_themecore_module_settings_webp_erase_all', + [ + 'type' => 'themes', + ] + ), + ], + ]); + } + + /** + * {@inheritdoc} + * + * @see MultistoreConfigurationTypeExtension + */ + public function getParent(): string + { + return MultistoreConfigurationType::class; + } + + /** + * @return NotBlank + */ + private function getNotBlankConstraint() + { + return new NotBlank([ + 'message' => $this->trans('This field cannot be empty.', 'Modules.isthemecore.Admin'), + ]); + } + + /** + * @return Range + */ + private function getRangeConstraint(int $min = 1, int $max = 100) + { + return new Range([ + 'min' => $min, + 'max' => $max, + 'invalidMessage' => $this->trans( + 'This field value have to be between %min% and %max%.', + 'Modules.isthemecore.Admin', + [ + '%min%' => $min, + '%max%' => $max, + ] + ), + ]); + } +} diff --git a/is_themecore/src/Form/Settings/index.php b/is_themecore/src/Form/Settings/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/src/Form/Settings/index.php @@ -0,0 +1,11 @@ +module = $module; + $this->context = \Context::getContext(); + } + + /** + * @return array + */ + public function getAvailableHooks() + { + return static::HOOK_LIST; + } +} diff --git a/is_themecore/src/Hook/Assets.php b/is_themecore/src/Hook/Assets.php new file mode 100644 index 0000000..133a3f8 --- /dev/null +++ b/is_themecore/src/Hook/Assets.php @@ -0,0 +1,45 @@ +context->controller->unregisterJavascript('facetedsearch_front'); + $this->context->controller->unregisterStylesheet('facetedsearch_front'); + + $needsJQueryUi = \Module::isEnabled('pm_advancedsearch4') && $this->context->controller instanceof \ProductListingFrontController; + + if (!$needsJQueryUi) { + $this->context->controller->unregisterJavascript('jquery-ui'); + $this->context->controller->unregisterStylesheet('jquery-ui'); + $this->context->controller->unregisterStylesheet('jquery-ui-theme'); + } + } + + public function hookActionFrontControllerSetMedia() + { + $assetsRegister = new ThemeAssetsRegister( + new ThemeAssetConfigProvider(_PS_THEME_DIR_), + $this->context + ); + + $assetsRegister->registerThemeAssets(); + + \Media::addJsDef([ + 'listDisplayAjaxUrl' => $this->context->link->getModuleLink($this->module->name, 'ajaxTheme'), + ]); + } +} diff --git a/is_themecore/src/Hook/Header.php b/is_themecore/src/Hook/Header.php new file mode 100644 index 0000000..1e66050 --- /dev/null +++ b/is_themecore/src/Hook/Header.php @@ -0,0 +1,136 @@ +context->smarty->assign([ + 'listingDisplayType' => $themeListDisplay->getDisplay(), + 'preloadCss' => \Configuration::get(GeneralConfiguration::THEMECORE_PRELOAD_CSS), + 'webpEnabled' => \Configuration::get(WebpConfiguration::THEMECORE_WEBP_ENABLED), + 'loadPartytown' => (bool) \Configuration::get(GeneralConfiguration::THEMECORE_LOAD_PARTY_TOWN), + 'debugPartytown' => (bool) \Configuration::get(GeneralConfiguration::THEMECORE_DEBUG_PARTY_TOWN), + ]); + } + + public function hookDisplayHeader(): string + { + $themeListDisplay = new ThemeListDisplay(); + $breadcrumbs = (new ThemeBreadcrumbs())->getBreadcrumb(); + + if ($breadcrumbs['count']) { + $this->context->smarty->assign([ + 'breadcrumb' => $breadcrumbs, + ]); + } + + $this->context->smarty->assign([ + 'jsonData' => $this->getStructuredData(), + 'partytownScript' => $this->getPartytownScript(), + 'partytownScriptUri' => $this->getPartytownScriptUri(), + ]); + + return $this->module->fetch('module:is_themecore/views/templates/hook/head.tpl'); + } + + private function getPartytownScriptUri(): string + { + try { + $uriResolver = $this->module->get(PartytownScriptUriResolver::class); + } catch (\Exception $e) { + $uriResolver = null; + } + + if ($uriResolver) { + return $uriResolver->getScriptUri(); + } + + return ''; + } + + private function getPartytownScript(): string + { + try { + $partytownScript = $this->module->get(PartytownScript::class); + } catch (\Exception $e) { + $partytownScript = null; + } + + if ($partytownScript instanceof PartytownScript) { + return $partytownScript->getScriptContent(); + } + + return ''; + } + + private function getStructuredData(): array + { + $dataArray = []; + + if ($this->context->controller instanceof \ProductControllerCore && $this->context->controller->getProduct()->id !== null) { + try { + $productData = $this->module->get(ProductStructuredData::class); + } catch (\Exception $e) { + $productData = null; + } + + if ($productData instanceof StructuredDataInterface) { + $dataArray[] = $productData->getFormattedData(); + } + } + + try { + $breadcrumbData = $this->module->get(BreadcrumbStructuredData::class); + } catch (\Exception $e) { + $breadcrumbData = null; + } + + if ($breadcrumbData instanceof StructuredDataInterface) { + $dataArray[] = $breadcrumbData->getFormattedData(); + } + + try { + $shopData = $this->module->get(ShopStructuredData::class); + } catch (\Exception $e) { + $shopData = null; + } + + if ($shopData instanceof StructuredDataInterface) { + $dataArray[] = $shopData->getFormattedData(); + } + + if ($this->context->controller->getPageName() === 'index') { + try { + $website = $this->module->get(WebsiteStructuredData::class); + } catch (\Exception $e) { + $website = null; + } + + if ($website instanceof StructuredDataInterface) { + $dataArray[] = $website->getFormattedData(); + } + } + + return $dataArray; + } +} diff --git a/is_themecore/src/Hook/Htaccess.php b/is_themecore/src/Hook/Htaccess.php new file mode 100644 index 0000000..efcfba2 --- /dev/null +++ b/is_themecore/src/Hook/Htaccess.php @@ -0,0 +1,36 @@ +module->get('oksydan.module.is_themecore.core.htaccess.htaccess_generator'); + + $generator->generate(); + $generator->writeFile(); + } + + public function hookObjectShopUrlAddAfter() + { + $this->hookActionHtaccessCreate(); + } + + public function hookObjectShopUrlUpdateAfter() + { + $this->hookActionHtaccessCreate(); + } + + public function hookObjectShopUrlDeleteAfter() + { + $this->hookActionHtaccessCreate(); + } +} diff --git a/is_themecore/src/Hook/HtmlOutput.php b/is_themecore/src/Hook/HtmlOutput.php new file mode 100644 index 0000000..a90bedd --- /dev/null +++ b/is_themecore/src/Hook/HtmlOutput.php @@ -0,0 +1,111 @@ +loadHTML( + '' . $html, + LIBXML_NOERROR | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD + ); + $links = $doc->getElementsByTagName('link'); + + foreach ($links as $link) { + $rel = $link->hasAttribute('rel') ? $link->attributes->getNamedItem('rel')->nodeValue : false; + $as = $link->hasAttribute('as') ? $link->attributes->getNamedItem('as')->nodeValue : false; + + if ($webpEnabled && $rel === 'preload' && $as === 'image') { + $newLink = $doc->createElement('link'); + $src = urldecode($link->attributes->getNamedItem('href')->nodeValue); + + $newLink->setAttribute('href', str_replace(['.png', '.jpg', '.jpeg'], '.webp', $src)); + + foreach ($link->attributes as $attribute) { + if ($attribute->nodeName !== 'href') { + $newLink->setAttribute($attribute->nodeName, $attribute->nodeValue); + } + } + + $link->parentNode->replaceChild($newLink, $link); + } + + if ($earlyHintsEnabled && in_array($rel, self::REL_LIST)) { + if (isset($newLink)) { + $link = $newLink; + unset($newLink); + } + + switch ($rel) { + case 'preload': + $this->handlePreloadFromNodeElement($link); + break; + case 'preconnect': + $this->handlePreconnectFromNodeElement($link); + break; + } + } + } + + if ($webpEnabled) { + $content = $doc->saveHTML(); + $content = str_replace('', '', $content); + $params['html'] = $content; + } + + if (!empty($this->headers)) { + header('Link: ' . implode(', ', $this->headers)); + } + + libxml_use_internal_errors($preConfig); + } + + private function handlePreloadFromNodeElement($nodeElement) + { + $preloadAs = $nodeElement->attributes->getNamedItem('as')->nodeValue; + + if (in_array($preloadAs, self::PRELOAD_TYPES_TO_EARLY_HINT)) { + $url = $nodeElement->attributes->getNamedItem('href')->nodeValue; + + $this->headers[] = "<$url>; rel=preload; as=$preloadAs"; + } + } + + private function handlePreconnectFromNodeElement($nodeElement) + { + $url = $nodeElement->attributes->getNamedItem('href')->nodeValue; + + $this->headers[] = "<$url>; rel=preconnect"; + } +} diff --git a/is_themecore/src/Hook/Smarty.php b/is_themecore/src/Hook/Smarty.php new file mode 100644 index 0000000..70796a4 --- /dev/null +++ b/is_themecore/src/Hook/Smarty.php @@ -0,0 +1,21 @@ +context->smarty->registerPlugin('function', 'generateImagesSources', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'generateImagesSources']); + $this->context->smarty->registerPlugin('function', 'generateImageSvgPlaceholder', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'generateImageSvgPlaceholder']); + $this->context->smarty->registerPlugin('function', 'appendParamToUrl', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'appendParamToUrl']); + $this->context->smarty->registerPlugin('block', 'images_block', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'imagesBlock']); + $this->context->smarty->registerPlugin('block', 'cms_images_block', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'cmsImagesBlock']); + $this->context->smarty->registerPlugin('block', 'display_mobile', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'displayMobileBlock']); + $this->context->smarty->registerPlugin('block', 'display_desktop', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'displayDesktopBlock']); + } +} diff --git a/is_themecore/src/HookDispatcher.php b/is_themecore/src/HookDispatcher.php new file mode 100644 index 0000000..0598c8b --- /dev/null +++ b/is_themecore/src/HookDispatcher.php @@ -0,0 +1,63 @@ +hooks[] = $hook; + } + } + + /** + * Get available hooks + * + * @return string[] + */ + public function getAvailableHooks() + { + $availableHooks = []; + foreach ($this->hooks as $hook) { + $availableHooks = array_merge($availableHooks, $hook->getAvailableHooks()); + } + + return $availableHooks; + } + + public function dispatch($hookName, array $params = []) + { + foreach ($this->hooks as $hook) { + if (method_exists($hook, $hookName)) { + return $hook->{$hookName}($params); + } + } + + return false; + } +} diff --git a/is_themecore/src/index.php b/is_themecore/src/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/src/index.php @@ -0,0 +1,11 @@ +in($rootDir) + ->exclude(['vendor', 'node_modules']) +; + +$config = new PrestaShop\CodingStandards\CsFixer\Config(); +return $config + ->setUsingCache(true) + ->setCacheFile(__DIR__.'/.php-cs-fixer.cache') + ->setFinder($finder) +; diff --git a/is_themecore/tests/php/.phpstan_bootstrap.neon b/is_themecore/tests/php/.phpstan_bootstrap.neon new file mode 100644 index 0000000..5111ecf --- /dev/null +++ b/is_themecore/tests/php/.phpstan_bootstrap.neon @@ -0,0 +1,3 @@ +parameters: + bootstrapFiles: + - %currentWorkingDirectory%/tests/php/.phpstan_bootstrap.php \ No newline at end of file diff --git a/is_themecore/tests/php/.phpstan_bootstrap.php b/is_themecore/tests/php/.phpstan_bootstrap.php new file mode 100644 index 0000000..d961241 --- /dev/null +++ b/is_themecore/tests/php/.phpstan_bootstrap.php @@ -0,0 +1,70 @@ +getMessage(); + exit(1); +} + +// ----------- end of script ------------- + +function include_env_configuration(): bool +{ + if (file_exists(PHPSTAN_PS_ROOT_CONFIG_FILE)) { + require PHPSTAN_PS_ROOT_CONFIG_FILE; + + return true; + } + + return false; +} + +function create_default_config_file_and_exit(): void +{ + if (!getenv('_PS_ROOT_DIR_')) { + echo 'Environment variable _PS_ROOT_DIR_ not set.' . PHP_EOL; + + // check if config file exists and create a default one if needed. + if (!file_exists(PHPSTAN_PS_ROOT_CONFIG_FILE)) { + file_put_contents(PHPSTAN_PS_ROOT_CONFIG_FILE, + '&1 | (! grep -v "No syntax errors detected") \ No newline at end of file diff --git a/is_themecore/tests/php/phpstan.dist.neon b/is_themecore/tests/php/phpstan.dist.neon new file mode 100644 index 0000000..cff2f13 --- /dev/null +++ b/is_themecore/tests/php/phpstan.dist.neon @@ -0,0 +1,14 @@ +parameters: + paths: + # We consider that the extension file will be stored the folder test/phpstan + # From Phpstan 0.12, paths are relative to the .neon file. + - ../../src + - ../../is_themecore.php + ignoreErrors: + # - "#Insert your error here (don't forget to escape special characters like the following hash: \\#)#" + reportUnmatchedIgnoredErrors: true + level: 9 + +includes: + - %currentWorkingDirectory%/tests/php/.phpstan_bootstrap.neon + - %currentWorkingDirectory%/vendor/prestashop/php-dev-tools/phpstan/ps-module-extension.neon diff --git a/is_themecore/translations/index.php b/is_themecore/translations/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/translations/index.php @@ -0,0 +1,11 @@ +registerHook('actionDispatcherBefore'); + + return $module->registerHook('actionOutputHTMLBefore'); +} diff --git a/is_themecore/upgrade/upgrade-2-2-1.php b/is_themecore/upgrade/upgrade-2-2-1.php new file mode 100644 index 0000000..583e2bf --- /dev/null +++ b/is_themecore/upgrade/upgrade-2-2-1.php @@ -0,0 +1,10 @@ +registerHook('actionDispatcherBefore'); +} diff --git a/is_themecore/upgrade/upgrade-2-3-0.php b/is_themecore/upgrade/upgrade-2-3-0.php new file mode 100644 index 0000000..62d42e7 --- /dev/null +++ b/is_themecore/upgrade/upgrade-2-3-0.php @@ -0,0 +1,15 @@ +registerHook('actionHtaccessCreate'); + $res &= $module->registerHook('objectShopUrlAddAfter'); + $res &= $module->registerHook('objectShopUrlUpdateAfter'); + $res &= $module->registerHook('objectShopUrlDeleteAfter'); + + return $res; +} diff --git a/is_themecore/upgrade/upgrade-2-4-0.php b/is_themecore/upgrade/upgrade-2-4-0.php new file mode 100644 index 0000000..c00c440 --- /dev/null +++ b/is_themecore/upgrade/upgrade-2-4-0.php @@ -0,0 +1,20 @@ +installPartytown(); + $success &= Configuration::updateValue(GeneralConfiguration::THEMECORE_LOAD_PARTY_TOWN, false); + $success &= Configuration::updateValue(GeneralConfiguration::THEMECORE_DEBUG_PARTY_TOWN, false); + + return $success; +} diff --git a/is_themecore/upgrade/upgrade-4.1.2.php b/is_themecore/upgrade/upgrade-4.1.2.php new file mode 100644 index 0000000..561db06 --- /dev/null +++ b/is_themecore/upgrade/upgrade-4.1.2.php @@ -0,0 +1,14 @@ +registerHook('actionFrontControllerInitBefore'); +} diff --git a/is_themecore/upgrade/upgrade-4.1.3.php b/is_themecore/upgrade/upgrade-4.1.3.php new file mode 100644 index 0000000..bc47f9a --- /dev/null +++ b/is_themecore/upgrade/upgrade-4.1.3.php @@ -0,0 +1,20 @@ +registerHook('actionFrontControllerInitBefore'); + $success &= Configuration::updateValue(GeneralConfiguration::THEMECORE_LOAD_PARTY_TOWN, false); + $success &= Configuration::updateValue(GeneralConfiguration::THEMECORE_DEBUG_PARTY_TOWN, false); + + return $success; +} diff --git a/is_themecore/vendor/.htaccess b/is_themecore/vendor/.htaccess new file mode 100644 index 0000000..3de9e40 --- /dev/null +++ b/is_themecore/vendor/.htaccess @@ -0,0 +1,10 @@ +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/is_themecore/vendor/autoload.php b/is_themecore/vendor/autoload.php new file mode 100644 index 0000000..770ab51 --- /dev/null +++ b/is_themecore/vendor/autoload.php @@ -0,0 +1,25 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var string|null */ + private $vendorDir; + + // PSR-4 + /** + * @var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var list + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> + */ + private $prefixesPsr0 = array(); + /** + * @var list + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var array + */ + private $missingClasses = array(); + + /** @var string|null */ + private $apcuPrefix; + + /** + * @var array + */ + private static $registeredLoaders = array(); + + /** + * @param string|null $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); + } + + /** + * @return array> + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return list + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return list + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return array Array of classname => path + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + $includeFile = self::$includeFile; + $includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders keyed by their corresponding vendor directories. + * + * @return array + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } + + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } +} diff --git a/is_themecore/vendor/composer/InstalledVersions.php b/is_themecore/vendor/composer/InstalledVersions.php new file mode 100644 index 0000000..51e734a --- /dev/null +++ b/is_themecore/vendor/composer/InstalledVersions.php @@ -0,0 +1,359 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final + */ +class InstalledVersions +{ + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints((string) $constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + + if (self::$canGetVendors) { + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + self::$installed = $installed[count($installed) - 1]; + } + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; + } else { + self::$installed = array(); + } + } + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } + + return $installed; + } +} diff --git a/is_themecore/vendor/composer/LICENSE b/is_themecore/vendor/composer/LICENSE new file mode 100644 index 0000000..f27399a --- /dev/null +++ b/is_themecore/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/is_themecore/vendor/composer/autoload_classmap.php b/is_themecore/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..e7026f5 --- /dev/null +++ b/is_themecore/vendor/composer/autoload_classmap.php @@ -0,0 +1,150 @@ + $vendorDir . '/composer/InstalledVersions.php', + 'ExecWithFallback\\Availability' => $vendorDir . '/rosell-dk/exec-with-fallback/src/Availability.php', + 'ExecWithFallback\\ExecWithFallback' => $vendorDir . '/rosell-dk/exec-with-fallback/src/ExecWithFallback.php', + 'ExecWithFallback\\ExecWithFallbackNoMercy' => $vendorDir . '/rosell-dk/exec-with-fallback/src/ExecWithFallbackNoMercy.php', + 'ExecWithFallback\\POpen' => $vendorDir . '/rosell-dk/exec-with-fallback/src/POpen.php', + 'ExecWithFallback\\Passthru' => $vendorDir . '/rosell-dk/exec-with-fallback/src/Passthru.php', + 'ExecWithFallback\\ProcOpen' => $vendorDir . '/rosell-dk/exec-with-fallback/src/ProcOpen.php', + 'ExecWithFallback\\ShellExec' => $vendorDir . '/rosell-dk/exec-with-fallback/src/ShellExec.php', + 'FileUtil\\FileExists' => $vendorDir . '/rosell-dk/file-util/src/FileExists.php', + 'FileUtil\\FileExistsUsingExec' => $vendorDir . '/rosell-dk/file-util/src/FileExistsUsingExec.php', + 'FileUtil\\PathValidator' => $vendorDir . '/rosell-dk/file-util/src/PathValidator.php', + 'ImageMimeTypeGuesser\\Detectors\\AbstractDetector' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/Detectors/AbstractDetector.php', + 'ImageMimeTypeGuesser\\Detectors\\ExifImageType' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/Detectors/ExifImageType.php', + 'ImageMimeTypeGuesser\\Detectors\\FInfo' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/Detectors/FInfo.php', + 'ImageMimeTypeGuesser\\Detectors\\GetImageSize' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/Detectors/GetImageSize.php', + 'ImageMimeTypeGuesser\\Detectors\\MimeContentType' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/Detectors/MimeContentType.php', + 'ImageMimeTypeGuesser\\Detectors\\SignatureSniffer' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/Detectors/SignatureSniffer.php', + 'ImageMimeTypeGuesser\\Detectors\\Stack' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/Detectors/Stack.php', + 'ImageMimeTypeGuesser\\GuessFromExtension' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/GuessFromExtension.php', + 'ImageMimeTypeGuesser\\ImageMimeTypeGuesser' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/ImageMimeTypeGuesser.php', + 'ImageMimeTypeGuesser\\MimeMap' => $vendorDir . '/rosell-dk/image-mime-type-guesser/src/MimeMap.php', + 'ImageMimeTypeSniffer\\ImageMimeTypeSniffer' => $vendorDir . '/rosell-dk/image-mime-type-sniffer/src/ImageMimeTypeSniffer.php', + 'LocateBinaries\\LocateBinaries' => $vendorDir . '/rosell-dk/locate-binaries/src/LocateBinaries.php', + 'Oksydan\\Module\\IsThemeCore\\Controller\\Admin\\SettingsController' => $baseDir . '/src/Controller/Admin/SettingsController.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Breadcrumbs\\ThemeBreadcrumbs' => $baseDir . '/src/Core/Breadcrumbs/ThemeBreadcrumbs.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Htaccess\\HtaccessGenerator' => $baseDir . '/src/Core/Htaccess/HtaccessGenerator.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\ListingDisplay\\ThemeListDisplay' => $baseDir . '/src/Core/ListingDisplay/ThemeListDisplay.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Partytown\\FilesInstallation' => $baseDir . '/src/Core/Partytown/FilesInstallation.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Partytown\\PartytownScript' => $baseDir . '/src/Core/Partytown/PartytownScript.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Partytown\\PartytownScriptUriResolver' => $baseDir . '/src/Core/Partytown/PartytownScriptUriResolver.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Smarty\\SmartyHelperFunctions' => $baseDir . '/src/Core/Smarty/SmartyHelperFunctions.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\AbstractStructuredData' => $baseDir . '/src/Core/StructuredData/AbstractStructuredData.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\BreadcrumbStructuredData' => $baseDir . '/src/Core/StructuredData/BreadcrumbStructuredData.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Presenter\\StructuredDataBreadcrumbPresenter' => $baseDir . '/src/Core/StructuredData/Presenter/StructuredDataBreadcrumbPresenter.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Presenter\\StructuredDataPresenterInterface' => $baseDir . '/src/Core/StructuredData/Presenter/StructuredDataPresenterInterface.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Presenter\\StructuredDataProductPresenter' => $baseDir . '/src/Core/StructuredData/Presenter/StructuredDataProductPresenter.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Presenter\\StructuredDataShopPresenter' => $baseDir . '/src/Core/StructuredData/Presenter/StructuredDataShopPresenter.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Presenter\\StructuredDataWebsitePresenter' => $baseDir . '/src/Core/StructuredData/Presenter/StructuredDataWebsitePresenter.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\ProductStructuredData' => $baseDir . '/src/Core/StructuredData/ProductStructuredData.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Provider\\StructuredDataBreadcrumbProvider' => $baseDir . '/src/Core/StructuredData/Provider/StructuredDataBreadcrumbProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Provider\\StructuredDataProductProvider' => $baseDir . '/src/Core/StructuredData/Provider/StructuredDataProductProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Provider\\StructuredDataProviderInterface' => $baseDir . '/src/Core/StructuredData/Provider/StructuredDataProviderInterface.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Provider\\StructuredDataShopProvider' => $baseDir . '/src/Core/StructuredData/Provider/StructuredDataShopProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Provider\\StructuredDataWebsiteProvider' => $baseDir . '/src/Core/StructuredData/Provider/StructuredDataWebsiteProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\ShopStructuredData' => $baseDir . '/src/Core/StructuredData/ShopStructuredData.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\StructuredDataInterface' => $baseDir . '/src/Core/StructuredData/StructuredDataInterface.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\WebsiteStructuredData' => $baseDir . '/src/Core/StructuredData/WebsiteStructuredData.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\ThemeAssets\\ThemeAssetConfigProvider' => $baseDir . '/src/Core/ThemeAssets/ThemeAssetConfigProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\ThemeAssets\\ThemeAssetsRegister' => $baseDir . '/src/Core/ThemeAssets/ThemeAssetsRegister.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Webp\\RelatedImageFileFinder' => $baseDir . '/src/Core/Webp/RelatedImageFileFinder.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Webp\\WebpConvertLibraries' => $baseDir . '/src/Core/Webp/WebpConvertLibraries.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Webp\\WebpFilesEraser' => $baseDir . '/src/Core/Webp/WebpFilesEraser.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Webp\\WebpGenerator' => $baseDir . '/src/Core/Webp/WebpGenerator.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Webp\\WebpPictureGenerator' => $baseDir . '/src/Core/Webp/WebpPictureGenerator.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\ChoiceProvider\\ListDisplayChoiceProvider' => $baseDir . '/src/Form/ChoiceProvider/ListDisplayChoiceProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\ChoiceProvider\\WebpLibraryChoiceProvider' => $baseDir . '/src/Form/ChoiceProvider/WebpLibraryChoiceProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\Settings\\GeneralConfiguration' => $baseDir . '/src/Form/Settings/GeneralConfiguration.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\Settings\\GeneralFormDataProvider' => $baseDir . '/src/Form/Settings/GeneralFormDataProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\Settings\\GeneralType' => $baseDir . '/src/Form/Settings/GeneralType.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\Settings\\WebpConfiguration' => $baseDir . '/src/Form/Settings/WebpConfiguration.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\Settings\\WebpFormDataProvider' => $baseDir . '/src/Form/Settings/WebpFormDataProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\Settings\\WebpType' => $baseDir . '/src/Form/Settings/WebpType.php', + 'Oksydan\\Module\\IsThemeCore\\HookDispatcher' => $baseDir . '/src/HookDispatcher.php', + 'Oksydan\\Module\\IsThemeCore\\Hook\\AbstractHook' => $baseDir . '/src/Hook/AbstractHook.php', + 'Oksydan\\Module\\IsThemeCore\\Hook\\Assets' => $baseDir . '/src/Hook/Assets.php', + 'Oksydan\\Module\\IsThemeCore\\Hook\\Header' => $baseDir . '/src/Hook/Header.php', + 'Oksydan\\Module\\IsThemeCore\\Hook\\Htaccess' => $baseDir . '/src/Hook/Htaccess.php', + 'Oksydan\\Module\\IsThemeCore\\Hook\\HtmlOutput' => $baseDir . '/src/Hook/HtmlOutput.php', + 'Oksydan\\Module\\IsThemeCore\\Hook\\Smarty' => $baseDir . '/src/Hook/Smarty.php', + 'WebPConvert\\Convert\\ConverterFactory' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/ConverterFactory.php', + 'WebPConvert\\Convert\\Converters\\AbstractConverter' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/AbstractConverter.php', + 'WebPConvert\\Convert\\Converters\\BaseTraits\\AutoQualityTrait' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/AutoQualityTrait.php', + 'WebPConvert\\Convert\\Converters\\BaseTraits\\DestinationPreparationTrait' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/DestinationPreparationTrait.php', + 'WebPConvert\\Convert\\Converters\\BaseTraits\\LoggerTrait' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/LoggerTrait.php', + 'WebPConvert\\Convert\\Converters\\BaseTraits\\OptionsTrait' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/OptionsTrait.php', + 'WebPConvert\\Convert\\Converters\\BaseTraits\\WarningLoggerTrait' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/WarningLoggerTrait.php', + 'WebPConvert\\Convert\\Converters\\ConverterTraits\\CloudConverterTrait' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/CloudConverterTrait.php', + 'WebPConvert\\Convert\\Converters\\ConverterTraits\\CurlTrait' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/CurlTrait.php', + 'WebPConvert\\Convert\\Converters\\ConverterTraits\\EncodingAutoTrait' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/EncodingAutoTrait.php', + 'WebPConvert\\Convert\\Converters\\ConverterTraits\\ExecTrait' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/ExecTrait.php', + 'WebPConvert\\Convert\\Converters\\Cwebp' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/Cwebp.php', + 'WebPConvert\\Convert\\Converters\\Ewww' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/Ewww.php', + 'WebPConvert\\Convert\\Converters\\FFMpeg' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/FFMpeg.php', + 'WebPConvert\\Convert\\Converters\\Gd' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/Gd.php', + 'WebPConvert\\Convert\\Converters\\Gmagick' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/Gmagick.php', + 'WebPConvert\\Convert\\Converters\\GmagickBinary' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/GmagickBinary.php', + 'WebPConvert\\Convert\\Converters\\GraphicsMagick' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/GraphicsMagick.php', + 'WebPConvert\\Convert\\Converters\\ImageMagick' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/ImageMagick.php', + 'WebPConvert\\Convert\\Converters\\Imagick' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/Imagick.php', + 'WebPConvert\\Convert\\Converters\\ImagickBinary' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/ImagickBinary.php', + 'WebPConvert\\Convert\\Converters\\Stack' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/Stack.php', + 'WebPConvert\\Convert\\Converters\\Vips' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/Vips.php', + 'WebPConvert\\Convert\\Converters\\Wpc' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Converters/Wpc.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailedException' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailedException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\ConversionSkippedException' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/ConversionSkippedException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\ConverterNotOperationalException' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/ConverterNotOperationalException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\ConverterNotOperational\\InvalidApiKeyException' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/ConverterNotOperational/InvalidApiKeyException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\ConverterNotOperational\\SystemRequirementsNotMetException' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/ConverterNotOperational/SystemRequirementsNotMetException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\FileSystemProblemsException' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/FileSystemProblemsException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\FileSystemProblems\\CreateDestinationFileException' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/FileSystemProblems/CreateDestinationFileException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\FileSystemProblems\\CreateDestinationFolderException' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/FileSystemProblems/CreateDestinationFolderException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\InvalidInputException' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/InvalidInputException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\InvalidInput\\ConverterNotFoundException' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/InvalidInput/ConverterNotFoundException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\InvalidInput\\InvalidImageTypeException' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/InvalidInput/InvalidImageTypeException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\InvalidInput\\TargetNotFoundException' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/InvalidInput/TargetNotFoundException.php', + 'WebPConvert\\Convert\\Helpers\\JpegQualityDetector' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Helpers/JpegQualityDetector.php', + 'WebPConvert\\Convert\\Helpers\\PhpIniSizes' => $vendorDir . '/rosell-dk/webp-convert/src/Convert/Helpers/PhpIniSizes.php', + 'WebPConvert\\Exceptions\\InvalidInputException' => $vendorDir . '/rosell-dk/webp-convert/src/Exceptions/InvalidInputException.php', + 'WebPConvert\\Exceptions\\InvalidInput\\InvalidImageTypeException' => $vendorDir . '/rosell-dk/webp-convert/src/Exceptions/InvalidInput/InvalidImageTypeException.php', + 'WebPConvert\\Exceptions\\InvalidInput\\TargetNotFoundException' => $vendorDir . '/rosell-dk/webp-convert/src/Exceptions/InvalidInput/TargetNotFoundException.php', + 'WebPConvert\\Exceptions\\WebPConvertException' => $vendorDir . '/rosell-dk/webp-convert/src/Exceptions/WebPConvertException.php', + 'WebPConvert\\Helpers\\InputValidator' => $vendorDir . '/rosell-dk/webp-convert/src/Helpers/InputValidator.php', + 'WebPConvert\\Helpers\\MimeType' => $vendorDir . '/rosell-dk/webp-convert/src/Helpers/MimeType.php', + 'WebPConvert\\Helpers\\PathChecker' => $vendorDir . '/rosell-dk/webp-convert/src/Helpers/PathChecker.php', + 'WebPConvert\\Helpers\\Sanitize' => $vendorDir . '/rosell-dk/webp-convert/src/Helpers/Sanitize.php', + 'WebPConvert\\Loggers\\BaseLogger' => $vendorDir . '/rosell-dk/webp-convert/src/Loggers/BaseLogger.php', + 'WebPConvert\\Loggers\\BufferLogger' => $vendorDir . '/rosell-dk/webp-convert/src/Loggers/BufferLogger.php', + 'WebPConvert\\Loggers\\EchoLogger' => $vendorDir . '/rosell-dk/webp-convert/src/Loggers/EchoLogger.php', + 'WebPConvert\\Options\\ArrayOption' => $vendorDir . '/rosell-dk/webp-convert/src/Options/ArrayOption.php', + 'WebPConvert\\Options\\BooleanOption' => $vendorDir . '/rosell-dk/webp-convert/src/Options/BooleanOption.php', + 'WebPConvert\\Options\\Exceptions\\InvalidOptionTypeException' => $vendorDir . '/rosell-dk/webp-convert/src/Options/Exceptions/InvalidOptionTypeException.php', + 'WebPConvert\\Options\\Exceptions\\InvalidOptionValueException' => $vendorDir . '/rosell-dk/webp-convert/src/Options/Exceptions/InvalidOptionValueException.php', + 'WebPConvert\\Options\\Exceptions\\OptionNotFoundException' => $vendorDir . '/rosell-dk/webp-convert/src/Options/Exceptions/OptionNotFoundException.php', + 'WebPConvert\\Options\\GhostOption' => $vendorDir . '/rosell-dk/webp-convert/src/Options/GhostOption.php', + 'WebPConvert\\Options\\IntegerOption' => $vendorDir . '/rosell-dk/webp-convert/src/Options/IntegerOption.php', + 'WebPConvert\\Options\\IntegerOrNullOption' => $vendorDir . '/rosell-dk/webp-convert/src/Options/IntegerOrNullOption.php', + 'WebPConvert\\Options\\MetadataOption' => $vendorDir . '/rosell-dk/webp-convert/src/Options/MetadataOption.php', + 'WebPConvert\\Options\\Option' => $vendorDir . '/rosell-dk/webp-convert/src/Options/Option.php', + 'WebPConvert\\Options\\OptionFactory' => $vendorDir . '/rosell-dk/webp-convert/src/Options/OptionFactory.php', + 'WebPConvert\\Options\\Options' => $vendorDir . '/rosell-dk/webp-convert/src/Options/Options.php', + 'WebPConvert\\Options\\QualityOption' => $vendorDir . '/rosell-dk/webp-convert/src/Options/QualityOption.php', + 'WebPConvert\\Options\\SensitiveArrayOption' => $vendorDir . '/rosell-dk/webp-convert/src/Options/SensitiveArrayOption.php', + 'WebPConvert\\Options\\SensitiveStringOption' => $vendorDir . '/rosell-dk/webp-convert/src/Options/SensitiveStringOption.php', + 'WebPConvert\\Options\\StringOption' => $vendorDir . '/rosell-dk/webp-convert/src/Options/StringOption.php', + 'WebPConvert\\Serve\\Exceptions\\ServeFailedException' => $vendorDir . '/rosell-dk/webp-convert/src/Serve/Exceptions/ServeFailedException.php', + 'WebPConvert\\Serve\\Header' => $vendorDir . '/rosell-dk/webp-convert/src/Serve/Header.php', + 'WebPConvert\\Serve\\Report' => $vendorDir . '/rosell-dk/webp-convert/src/Serve/Report.php', + 'WebPConvert\\Serve\\ServeConvertedWebP' => $vendorDir . '/rosell-dk/webp-convert/src/Serve/ServeConvertedWebP.php', + 'WebPConvert\\Serve\\ServeConvertedWebPWithErrorHandling' => $vendorDir . '/rosell-dk/webp-convert/src/Serve/ServeConvertedWebPWithErrorHandling.php', + 'WebPConvert\\Serve\\ServeFile' => $vendorDir . '/rosell-dk/webp-convert/src/Serve/ServeFile.php', + 'WebPConvert\\WebPConvert' => $vendorDir . '/rosell-dk/webp-convert/src/WebPConvert.php', +); diff --git a/is_themecore/vendor/composer/autoload_namespaces.php b/is_themecore/vendor/composer/autoload_namespaces.php new file mode 100644 index 0000000..15a2ff3 --- /dev/null +++ b/is_themecore/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ + array($vendorDir . '/rosell-dk/webp-convert/src'), + 'Oksydan\\Module\\IsThemeCore\\' => array($baseDir . '/src'), + 'LocateBinaries\\' => array($vendorDir . '/rosell-dk/locate-binaries/src'), + 'ImageMimeTypeSniffer\\' => array($vendorDir . '/rosell-dk/image-mime-type-sniffer/src'), + 'ImageMimeTypeGuesser\\' => array($vendorDir . '/rosell-dk/image-mime-type-guesser/src'), + 'FileUtil\\' => array($vendorDir . '/rosell-dk/file-util/src'), + 'ExecWithFallback\\' => array($vendorDir . '/rosell-dk/exec-with-fallback/src'), +); diff --git a/is_themecore/vendor/composer/autoload_real.php b/is_themecore/vendor/composer/autoload_real.php new file mode 100644 index 0000000..034a08d --- /dev/null +++ b/is_themecore/vendor/composer/autoload_real.php @@ -0,0 +1,38 @@ +register(false); + + return $loader; + } +} diff --git a/is_themecore/vendor/composer/autoload_static.php b/is_themecore/vendor/composer/autoload_static.php new file mode 100644 index 0000000..f518928 --- /dev/null +++ b/is_themecore/vendor/composer/autoload_static.php @@ -0,0 +1,221 @@ + + array ( + 'WebPConvert\\' => 12, + ), + 'O' => + array ( + 'Oksydan\\Module\\IsThemeCore\\' => 27, + ), + 'L' => + array ( + 'LocateBinaries\\' => 15, + ), + 'I' => + array ( + 'ImageMimeTypeSniffer\\' => 21, + 'ImageMimeTypeGuesser\\' => 21, + ), + 'F' => + array ( + 'FileUtil\\' => 9, + ), + 'E' => + array ( + 'ExecWithFallback\\' => 17, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'WebPConvert\\' => + array ( + 0 => __DIR__ . '/..' . '/rosell-dk/webp-convert/src', + ), + 'Oksydan\\Module\\IsThemeCore\\' => + array ( + 0 => __DIR__ . '/../..' . '/src', + ), + 'LocateBinaries\\' => + array ( + 0 => __DIR__ . '/..' . '/rosell-dk/locate-binaries/src', + ), + 'ImageMimeTypeSniffer\\' => + array ( + 0 => __DIR__ . '/..' . '/rosell-dk/image-mime-type-sniffer/src', + ), + 'ImageMimeTypeGuesser\\' => + array ( + 0 => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src', + ), + 'FileUtil\\' => + array ( + 0 => __DIR__ . '/..' . '/rosell-dk/file-util/src', + ), + 'ExecWithFallback\\' => + array ( + 0 => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src', + ), + ); + + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'ExecWithFallback\\Availability' => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src/Availability.php', + 'ExecWithFallback\\ExecWithFallback' => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src/ExecWithFallback.php', + 'ExecWithFallback\\ExecWithFallbackNoMercy' => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src/ExecWithFallbackNoMercy.php', + 'ExecWithFallback\\POpen' => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src/POpen.php', + 'ExecWithFallback\\Passthru' => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src/Passthru.php', + 'ExecWithFallback\\ProcOpen' => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src/ProcOpen.php', + 'ExecWithFallback\\ShellExec' => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src/ShellExec.php', + 'FileUtil\\FileExists' => __DIR__ . '/..' . '/rosell-dk/file-util/src/FileExists.php', + 'FileUtil\\FileExistsUsingExec' => __DIR__ . '/..' . '/rosell-dk/file-util/src/FileExistsUsingExec.php', + 'FileUtil\\PathValidator' => __DIR__ . '/..' . '/rosell-dk/file-util/src/PathValidator.php', + 'ImageMimeTypeGuesser\\Detectors\\AbstractDetector' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/Detectors/AbstractDetector.php', + 'ImageMimeTypeGuesser\\Detectors\\ExifImageType' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/Detectors/ExifImageType.php', + 'ImageMimeTypeGuesser\\Detectors\\FInfo' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/Detectors/FInfo.php', + 'ImageMimeTypeGuesser\\Detectors\\GetImageSize' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/Detectors/GetImageSize.php', + 'ImageMimeTypeGuesser\\Detectors\\MimeContentType' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/Detectors/MimeContentType.php', + 'ImageMimeTypeGuesser\\Detectors\\SignatureSniffer' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/Detectors/SignatureSniffer.php', + 'ImageMimeTypeGuesser\\Detectors\\Stack' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/Detectors/Stack.php', + 'ImageMimeTypeGuesser\\GuessFromExtension' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/GuessFromExtension.php', + 'ImageMimeTypeGuesser\\ImageMimeTypeGuesser' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/ImageMimeTypeGuesser.php', + 'ImageMimeTypeGuesser\\MimeMap' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src/MimeMap.php', + 'ImageMimeTypeSniffer\\ImageMimeTypeSniffer' => __DIR__ . '/..' . '/rosell-dk/image-mime-type-sniffer/src/ImageMimeTypeSniffer.php', + 'LocateBinaries\\LocateBinaries' => __DIR__ . '/..' . '/rosell-dk/locate-binaries/src/LocateBinaries.php', + 'Oksydan\\Module\\IsThemeCore\\Controller\\Admin\\SettingsController' => __DIR__ . '/../..' . '/src/Controller/Admin/SettingsController.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Breadcrumbs\\ThemeBreadcrumbs' => __DIR__ . '/../..' . '/src/Core/Breadcrumbs/ThemeBreadcrumbs.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Htaccess\\HtaccessGenerator' => __DIR__ . '/../..' . '/src/Core/Htaccess/HtaccessGenerator.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\ListingDisplay\\ThemeListDisplay' => __DIR__ . '/../..' . '/src/Core/ListingDisplay/ThemeListDisplay.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Partytown\\FilesInstallation' => __DIR__ . '/../..' . '/src/Core/Partytown/FilesInstallation.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Partytown\\PartytownScript' => __DIR__ . '/../..' . '/src/Core/Partytown/PartytownScript.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Partytown\\PartytownScriptUriResolver' => __DIR__ . '/../..' . '/src/Core/Partytown/PartytownScriptUriResolver.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Smarty\\SmartyHelperFunctions' => __DIR__ . '/../..' . '/src/Core/Smarty/SmartyHelperFunctions.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\AbstractStructuredData' => __DIR__ . '/../..' . '/src/Core/StructuredData/AbstractStructuredData.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\BreadcrumbStructuredData' => __DIR__ . '/../..' . '/src/Core/StructuredData/BreadcrumbStructuredData.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Presenter\\StructuredDataBreadcrumbPresenter' => __DIR__ . '/../..' . '/src/Core/StructuredData/Presenter/StructuredDataBreadcrumbPresenter.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Presenter\\StructuredDataPresenterInterface' => __DIR__ . '/../..' . '/src/Core/StructuredData/Presenter/StructuredDataPresenterInterface.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Presenter\\StructuredDataProductPresenter' => __DIR__ . '/../..' . '/src/Core/StructuredData/Presenter/StructuredDataProductPresenter.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Presenter\\StructuredDataShopPresenter' => __DIR__ . '/../..' . '/src/Core/StructuredData/Presenter/StructuredDataShopPresenter.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Presenter\\StructuredDataWebsitePresenter' => __DIR__ . '/../..' . '/src/Core/StructuredData/Presenter/StructuredDataWebsitePresenter.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\ProductStructuredData' => __DIR__ . '/../..' . '/src/Core/StructuredData/ProductStructuredData.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Provider\\StructuredDataBreadcrumbProvider' => __DIR__ . '/../..' . '/src/Core/StructuredData/Provider/StructuredDataBreadcrumbProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Provider\\StructuredDataProductProvider' => __DIR__ . '/../..' . '/src/Core/StructuredData/Provider/StructuredDataProductProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Provider\\StructuredDataProviderInterface' => __DIR__ . '/../..' . '/src/Core/StructuredData/Provider/StructuredDataProviderInterface.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Provider\\StructuredDataShopProvider' => __DIR__ . '/../..' . '/src/Core/StructuredData/Provider/StructuredDataShopProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\Provider\\StructuredDataWebsiteProvider' => __DIR__ . '/../..' . '/src/Core/StructuredData/Provider/StructuredDataWebsiteProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\ShopStructuredData' => __DIR__ . '/../..' . '/src/Core/StructuredData/ShopStructuredData.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\StructuredDataInterface' => __DIR__ . '/../..' . '/src/Core/StructuredData/StructuredDataInterface.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\StructuredData\\WebsiteStructuredData' => __DIR__ . '/../..' . '/src/Core/StructuredData/WebsiteStructuredData.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\ThemeAssets\\ThemeAssetConfigProvider' => __DIR__ . '/../..' . '/src/Core/ThemeAssets/ThemeAssetConfigProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\ThemeAssets\\ThemeAssetsRegister' => __DIR__ . '/../..' . '/src/Core/ThemeAssets/ThemeAssetsRegister.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Webp\\RelatedImageFileFinder' => __DIR__ . '/../..' . '/src/Core/Webp/RelatedImageFileFinder.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Webp\\WebpConvertLibraries' => __DIR__ . '/../..' . '/src/Core/Webp/WebpConvertLibraries.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Webp\\WebpFilesEraser' => __DIR__ . '/../..' . '/src/Core/Webp/WebpFilesEraser.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Webp\\WebpGenerator' => __DIR__ . '/../..' . '/src/Core/Webp/WebpGenerator.php', + 'Oksydan\\Module\\IsThemeCore\\Core\\Webp\\WebpPictureGenerator' => __DIR__ . '/../..' . '/src/Core/Webp/WebpPictureGenerator.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\ChoiceProvider\\ListDisplayChoiceProvider' => __DIR__ . '/../..' . '/src/Form/ChoiceProvider/ListDisplayChoiceProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\ChoiceProvider\\WebpLibraryChoiceProvider' => __DIR__ . '/../..' . '/src/Form/ChoiceProvider/WebpLibraryChoiceProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\Settings\\GeneralConfiguration' => __DIR__ . '/../..' . '/src/Form/Settings/GeneralConfiguration.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\Settings\\GeneralFormDataProvider' => __DIR__ . '/../..' . '/src/Form/Settings/GeneralFormDataProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\Settings\\GeneralType' => __DIR__ . '/../..' . '/src/Form/Settings/GeneralType.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\Settings\\WebpConfiguration' => __DIR__ . '/../..' . '/src/Form/Settings/WebpConfiguration.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\Settings\\WebpFormDataProvider' => __DIR__ . '/../..' . '/src/Form/Settings/WebpFormDataProvider.php', + 'Oksydan\\Module\\IsThemeCore\\Form\\Settings\\WebpType' => __DIR__ . '/../..' . '/src/Form/Settings/WebpType.php', + 'Oksydan\\Module\\IsThemeCore\\HookDispatcher' => __DIR__ . '/../..' . '/src/HookDispatcher.php', + 'Oksydan\\Module\\IsThemeCore\\Hook\\AbstractHook' => __DIR__ . '/../..' . '/src/Hook/AbstractHook.php', + 'Oksydan\\Module\\IsThemeCore\\Hook\\Assets' => __DIR__ . '/../..' . '/src/Hook/Assets.php', + 'Oksydan\\Module\\IsThemeCore\\Hook\\Header' => __DIR__ . '/../..' . '/src/Hook/Header.php', + 'Oksydan\\Module\\IsThemeCore\\Hook\\Htaccess' => __DIR__ . '/../..' . '/src/Hook/Htaccess.php', + 'Oksydan\\Module\\IsThemeCore\\Hook\\HtmlOutput' => __DIR__ . '/../..' . '/src/Hook/HtmlOutput.php', + 'Oksydan\\Module\\IsThemeCore\\Hook\\Smarty' => __DIR__ . '/../..' . '/src/Hook/Smarty.php', + 'WebPConvert\\Convert\\ConverterFactory' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/ConverterFactory.php', + 'WebPConvert\\Convert\\Converters\\AbstractConverter' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/AbstractConverter.php', + 'WebPConvert\\Convert\\Converters\\BaseTraits\\AutoQualityTrait' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/AutoQualityTrait.php', + 'WebPConvert\\Convert\\Converters\\BaseTraits\\DestinationPreparationTrait' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/DestinationPreparationTrait.php', + 'WebPConvert\\Convert\\Converters\\BaseTraits\\LoggerTrait' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/LoggerTrait.php', + 'WebPConvert\\Convert\\Converters\\BaseTraits\\OptionsTrait' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/OptionsTrait.php', + 'WebPConvert\\Convert\\Converters\\BaseTraits\\WarningLoggerTrait' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/WarningLoggerTrait.php', + 'WebPConvert\\Convert\\Converters\\ConverterTraits\\CloudConverterTrait' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/CloudConverterTrait.php', + 'WebPConvert\\Convert\\Converters\\ConverterTraits\\CurlTrait' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/CurlTrait.php', + 'WebPConvert\\Convert\\Converters\\ConverterTraits\\EncodingAutoTrait' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/EncodingAutoTrait.php', + 'WebPConvert\\Convert\\Converters\\ConverterTraits\\ExecTrait' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/ExecTrait.php', + 'WebPConvert\\Convert\\Converters\\Cwebp' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/Cwebp.php', + 'WebPConvert\\Convert\\Converters\\Ewww' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/Ewww.php', + 'WebPConvert\\Convert\\Converters\\FFMpeg' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/FFMpeg.php', + 'WebPConvert\\Convert\\Converters\\Gd' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/Gd.php', + 'WebPConvert\\Convert\\Converters\\Gmagick' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/Gmagick.php', + 'WebPConvert\\Convert\\Converters\\GmagickBinary' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/GmagickBinary.php', + 'WebPConvert\\Convert\\Converters\\GraphicsMagick' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/GraphicsMagick.php', + 'WebPConvert\\Convert\\Converters\\ImageMagick' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/ImageMagick.php', + 'WebPConvert\\Convert\\Converters\\Imagick' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/Imagick.php', + 'WebPConvert\\Convert\\Converters\\ImagickBinary' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/ImagickBinary.php', + 'WebPConvert\\Convert\\Converters\\Stack' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/Stack.php', + 'WebPConvert\\Convert\\Converters\\Vips' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/Vips.php', + 'WebPConvert\\Convert\\Converters\\Wpc' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Converters/Wpc.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailedException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailedException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\ConversionSkippedException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/ConversionSkippedException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\ConverterNotOperationalException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/ConverterNotOperationalException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\ConverterNotOperational\\InvalidApiKeyException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/ConverterNotOperational/InvalidApiKeyException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\ConverterNotOperational\\SystemRequirementsNotMetException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/ConverterNotOperational/SystemRequirementsNotMetException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\FileSystemProblemsException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/FileSystemProblemsException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\FileSystemProblems\\CreateDestinationFileException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/FileSystemProblems/CreateDestinationFileException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\FileSystemProblems\\CreateDestinationFolderException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/FileSystemProblems/CreateDestinationFolderException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\InvalidInputException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/InvalidInputException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\InvalidInput\\ConverterNotFoundException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/InvalidInput/ConverterNotFoundException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\InvalidInput\\InvalidImageTypeException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/InvalidInput/InvalidImageTypeException.php', + 'WebPConvert\\Convert\\Exceptions\\ConversionFailed\\InvalidInput\\TargetNotFoundException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/InvalidInput/TargetNotFoundException.php', + 'WebPConvert\\Convert\\Helpers\\JpegQualityDetector' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Helpers/JpegQualityDetector.php', + 'WebPConvert\\Convert\\Helpers\\PhpIniSizes' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Convert/Helpers/PhpIniSizes.php', + 'WebPConvert\\Exceptions\\InvalidInputException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Exceptions/InvalidInputException.php', + 'WebPConvert\\Exceptions\\InvalidInput\\InvalidImageTypeException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Exceptions/InvalidInput/InvalidImageTypeException.php', + 'WebPConvert\\Exceptions\\InvalidInput\\TargetNotFoundException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Exceptions/InvalidInput/TargetNotFoundException.php', + 'WebPConvert\\Exceptions\\WebPConvertException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Exceptions/WebPConvertException.php', + 'WebPConvert\\Helpers\\InputValidator' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Helpers/InputValidator.php', + 'WebPConvert\\Helpers\\MimeType' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Helpers/MimeType.php', + 'WebPConvert\\Helpers\\PathChecker' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Helpers/PathChecker.php', + 'WebPConvert\\Helpers\\Sanitize' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Helpers/Sanitize.php', + 'WebPConvert\\Loggers\\BaseLogger' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Loggers/BaseLogger.php', + 'WebPConvert\\Loggers\\BufferLogger' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Loggers/BufferLogger.php', + 'WebPConvert\\Loggers\\EchoLogger' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Loggers/EchoLogger.php', + 'WebPConvert\\Options\\ArrayOption' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/ArrayOption.php', + 'WebPConvert\\Options\\BooleanOption' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/BooleanOption.php', + 'WebPConvert\\Options\\Exceptions\\InvalidOptionTypeException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/Exceptions/InvalidOptionTypeException.php', + 'WebPConvert\\Options\\Exceptions\\InvalidOptionValueException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/Exceptions/InvalidOptionValueException.php', + 'WebPConvert\\Options\\Exceptions\\OptionNotFoundException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/Exceptions/OptionNotFoundException.php', + 'WebPConvert\\Options\\GhostOption' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/GhostOption.php', + 'WebPConvert\\Options\\IntegerOption' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/IntegerOption.php', + 'WebPConvert\\Options\\IntegerOrNullOption' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/IntegerOrNullOption.php', + 'WebPConvert\\Options\\MetadataOption' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/MetadataOption.php', + 'WebPConvert\\Options\\Option' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/Option.php', + 'WebPConvert\\Options\\OptionFactory' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/OptionFactory.php', + 'WebPConvert\\Options\\Options' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/Options.php', + 'WebPConvert\\Options\\QualityOption' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/QualityOption.php', + 'WebPConvert\\Options\\SensitiveArrayOption' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/SensitiveArrayOption.php', + 'WebPConvert\\Options\\SensitiveStringOption' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/SensitiveStringOption.php', + 'WebPConvert\\Options\\StringOption' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Options/StringOption.php', + 'WebPConvert\\Serve\\Exceptions\\ServeFailedException' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Serve/Exceptions/ServeFailedException.php', + 'WebPConvert\\Serve\\Header' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Serve/Header.php', + 'WebPConvert\\Serve\\Report' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Serve/Report.php', + 'WebPConvert\\Serve\\ServeConvertedWebP' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Serve/ServeConvertedWebP.php', + 'WebPConvert\\Serve\\ServeConvertedWebPWithErrorHandling' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Serve/ServeConvertedWebPWithErrorHandling.php', + 'WebPConvert\\Serve\\ServeFile' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/Serve/ServeFile.php', + 'WebPConvert\\WebPConvert' => __DIR__ . '/..' . '/rosell-dk/webp-convert/src/WebPConvert.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInitf15e3531cda7d0057952c1e2751a9b0a::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitf15e3531cda7d0057952c1e2751a9b0a::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitf15e3531cda7d0057952c1e2751a9b0a::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/is_themecore/vendor/composer/installed.json b/is_themecore/vendor/composer/installed.json new file mode 100644 index 0000000..83d99b8 --- /dev/null +++ b/is_themecore/vendor/composer/installed.json @@ -0,0 +1,468 @@ +{ + "packages": [ + { + "name": "rosell-dk/exec-with-fallback", + "version": "1.2.0", + "version_normalized": "1.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/exec-with-fallback.git", + "reference": "f88a6b29abd0b580566056b7c1eb0434eb5db20d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/exec-with-fallback/zipball/f88a6b29abd0b580566056b7c1eb0434eb5db20d", + "reference": "f88a6b29abd0b580566056b7c1eb0434eb5db20d", + "shasum": "" + }, + "require": { + "php": "^5.6 | ^7.0 | ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "suggest": { + "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing" + }, + "time": "2021-12-08T12:09:43+00:00", + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "ExecWithFallback\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "An exec() with fallback to emulations (proc_open, etc)", + "keywords": [ + "command", + "exec", + "fallback", + "open_proc", + "resiliant", + "sturdy" + ], + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "install-path": "../rosell-dk/exec-with-fallback" + }, + { + "name": "rosell-dk/file-util", + "version": "0.1.1", + "version_normalized": "0.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/file-util.git", + "reference": "2ff895308c37f448b34b031cfbfd8e45f43936fd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/file-util/zipball/2ff895308c37f448b34b031cfbfd8e45f43936fd", + "reference": "2ff895308c37f448b34b031cfbfd8e45f43936fd", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "rosell-dk/exec-with-fallback": "^1.0.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "mikey179/vfsstream": "^1.6", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "time": "2022-04-19T10:12:31+00:00", + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "FileUtil\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "Functions for dealing with files and paths", + "keywords": [ + "files", + "path", + "util" + ], + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "install-path": "../rosell-dk/file-util" + }, + { + "name": "rosell-dk/image-mime-type-guesser", + "version": "1.1.1", + "version_normalized": "1.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/image-mime-type-guesser.git", + "reference": "72f7040e95a78937ae2edece452530224fcacea6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/image-mime-type-guesser/zipball/72f7040e95a78937ae2edece452530224fcacea6", + "reference": "72f7040e95a78937ae2edece452530224fcacea6", + "shasum": "" + }, + "require": { + "php": "^5.6 | ^7.0 | ^8.0", + "rosell-dk/image-mime-type-sniffer": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "time": "2022-05-19T09:57:15+00:00", + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "ImageMimeTypeGuesser\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "Guess mime type of images", + "keywords": [ + "image", + "images", + "mime", + "mime type" + ], + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "install-path": "../rosell-dk/image-mime-type-guesser" + }, + { + "name": "rosell-dk/image-mime-type-sniffer", + "version": "1.1.1", + "version_normalized": "1.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/image-mime-type-sniffer.git", + "reference": "9ed14cc5d2c14c417660a4dd1946b5f056494691" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/image-mime-type-sniffer/zipball/9ed14cc5d2c14c417660a4dd1946b5f056494691", + "reference": "9ed14cc5d2c14c417660a4dd1946b5f056494691", + "shasum": "" + }, + "require": { + "php": ">=5.4" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "mikey179/vfsstream": "^1.6", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "time": "2022-04-20T14:31:25+00:00", + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "ImageMimeTypeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "Sniff mime type (images only)", + "keywords": [ + "image", + "images", + "mime", + "mime type" + ], + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "install-path": "../rosell-dk/image-mime-type-sniffer" + }, + { + "name": "rosell-dk/locate-binaries", + "version": "1.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/locate-binaries.git", + "reference": "bd2f493383ecd55aa519828dd2898e30f3b9cbb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/locate-binaries/zipball/bd2f493383ecd55aa519828dd2898e30f3b9cbb0", + "reference": "bd2f493383ecd55aa519828dd2898e30f3b9cbb0", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "rosell-dk/exec-with-fallback": "^1.0.0", + "rosell-dk/file-util": "^0.1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "time": "2022-04-20T07:20:07+00:00", + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "LocateBinaries\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "Locate a binaries by means of exec() or similar", + "keywords": [ + "binary", + "discover", + "locate", + "whereis", + "which" + ], + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "install-path": "../rosell-dk/locate-binaries" + }, + { + "name": "rosell-dk/webp-convert", + "version": "2.9.2", + "version_normalized": "2.9.2.0", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/webp-convert.git", + "reference": "5ccba85ebe3b28ae229459fd0baed25314616ac9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/webp-convert/zipball/5ccba85ebe3b28ae229459fd0baed25314616ac9", + "reference": "5ccba85ebe3b28ae229459fd0baed25314616ac9", + "shasum": "" + }, + "require": { + "php": "^5.6 | ^7.0 | ^8.0", + "rosell-dk/exec-with-fallback": "^1.0.0", + "rosell-dk/image-mime-type-guesser": "^1.1.1", + "rosell-dk/locate-binaries": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "suggest": { + "ext-gd": "to use GD extension for converting. Note: Gd must be compiled with webp support", + "ext-imagick": "to use Imagick extension for converting. Note: Gd must be compiled with webp support", + "ext-vips": "to use Vips extension for converting.", + "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing" + }, + "time": "2022-05-19T13:56:36+00:00", + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "WebPConvert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + }, + { + "name": "Martin Folkers", + "homepage": "https://twobrain.io", + "role": "Collaborator" + } + ], + "description": "Convert JPEG & PNG to WebP with PHP", + "keywords": [ + "Webp", + "cwebp", + "gd", + "image conversion", + "images", + "imagick", + "jpg", + "jpg2webp", + "png", + "png2webp" + ], + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "install-path": "../rosell-dk/webp-convert" + } + ], + "dev": false, + "dev-package-names": [] +} diff --git a/is_themecore/vendor/composer/installed.php b/is_themecore/vendor/composer/installed.php new file mode 100644 index 0000000..166ec19 --- /dev/null +++ b/is_themecore/vendor/composer/installed.php @@ -0,0 +1,77 @@ + array( + 'name' => 'oksydan/is_themecore', + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', + 'reference' => '151e70ae2811e504b191dd09240b953614d7185d', + 'type' => 'prestashop-module', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev' => false, + ), + 'versions' => array( + 'oksydan/is_themecore' => array( + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', + 'reference' => '151e70ae2811e504b191dd09240b953614d7185d', + 'type' => 'prestashop-module', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'rosell-dk/exec-with-fallback' => array( + 'pretty_version' => '1.2.0', + 'version' => '1.2.0.0', + 'reference' => 'f88a6b29abd0b580566056b7c1eb0434eb5db20d', + 'type' => 'library', + 'install_path' => __DIR__ . '/../rosell-dk/exec-with-fallback', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'rosell-dk/file-util' => array( + 'pretty_version' => '0.1.1', + 'version' => '0.1.1.0', + 'reference' => '2ff895308c37f448b34b031cfbfd8e45f43936fd', + 'type' => 'library', + 'install_path' => __DIR__ . '/../rosell-dk/file-util', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'rosell-dk/image-mime-type-guesser' => array( + 'pretty_version' => '1.1.1', + 'version' => '1.1.1.0', + 'reference' => '72f7040e95a78937ae2edece452530224fcacea6', + 'type' => 'library', + 'install_path' => __DIR__ . '/../rosell-dk/image-mime-type-guesser', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'rosell-dk/image-mime-type-sniffer' => array( + 'pretty_version' => '1.1.1', + 'version' => '1.1.1.0', + 'reference' => '9ed14cc5d2c14c417660a4dd1946b5f056494691', + 'type' => 'library', + 'install_path' => __DIR__ . '/../rosell-dk/image-mime-type-sniffer', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'rosell-dk/locate-binaries' => array( + 'pretty_version' => '1.0', + 'version' => '1.0.0.0', + 'reference' => 'bd2f493383ecd55aa519828dd2898e30f3b9cbb0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../rosell-dk/locate-binaries', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'rosell-dk/webp-convert' => array( + 'pretty_version' => '2.9.2', + 'version' => '2.9.2.0', + 'reference' => '5ccba85ebe3b28ae229459fd0baed25314616ac9', + 'type' => 'library', + 'install_path' => __DIR__ . '/../rosell-dk/webp-convert', + 'aliases' => array(), + 'dev_requirement' => false, + ), + ), +); diff --git a/is_themecore/vendor/composer/platform_check.php b/is_themecore/vendor/composer/platform_check.php new file mode 100644 index 0000000..6d3407d --- /dev/null +++ b/is_themecore/vendor/composer/platform_check.php @@ -0,0 +1,26 @@ += 70100)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 7.1.0". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/.github/FUNDING.yml b/is_themecore/vendor/rosell-dk/exec-with-fallback/.github/FUNDING.yml new file mode 100644 index 0000000..8dd1d30 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: rosell-dk +ko_fi: rosell diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/.github/workflows/php.yml b/is_themecore/vendor/rosell-dk/exec-with-fallback/.github/workflows/php.yml new file mode 100644 index 0000000..db74bc2 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/.github/workflows/php.yml @@ -0,0 +1,36 @@ +name: PHP + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + php80: + name: PHP 8.1 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + php: [8.1] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/.github/workflows/release.yml b/is_themecore/vendor/rosell-dk/exec-with-fallback/.github/workflows/release.yml new file mode 100644 index 0000000..f82c28f --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/.github/workflows/release.yml @@ -0,0 +1,262 @@ +name: Large testsuite (run manually before releases) + +on: workflow_dispatch + +jobs: + php81: + name: PHP 8.1 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, ubuntu-18.04, windows-2022, windows-2019, windows-2016, macos-11, macos-10.15] + php: [8.1] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + php80: + name: PHP 8.0 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-2022] + php: [8.0] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + php74: + name: PHP 7.4 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, ubuntu-18.04, windows-2019, windows-2016] + php: [7.4] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + php73: + name: PHP 7.3 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + php: [7.3] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + php72: + name: PHP 7.2 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + php: [7.2] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Downgrade PHP unit to a version that supports PHP 7.2 + run: composer require "phpunit/phpunit:^8.0" --dev + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + php71: + name: PHP 7.1 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + php: [7.1] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Downgrade PHP unit to a version that supports PHP 7.1 + run: composer require "phpunit/phpunit:^7.0" --dev + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + + php70: + name: PHP 7.0 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-18.04] + php: [7.0] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Downgrade PHP unit to a version that supports PHP 7.1 + run: composer require "phpunit/phpunit:^6.0" --dev + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + + disabled: + name: Disabled functions + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, windows-2019] + php: [8.0, 7.4] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP (disable some functions) + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + # PS: I would have liked to test disabling ini_get, but then composer fails + # composer alse needs proc_open, so I cannot test without that either + ini-values: disable_functions="exec,passthru" + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + - name: Re-setup PHP (disable other functions) + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + ini-values: disable_functions="exec" + + - name: Run test suite + run: composer run-script test + + - name: Re-setup PHP (disable yet other functions) + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + ini-values: disable_functions="passthru" + + - name: Run test suite + run: composer run-script test diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/LICENSE b/is_themecore/vendor/rosell-dk/exec-with-fallback/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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. + + + Copyright (C) + + 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 . + +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: + + Copyright (C) + 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 +. + + 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 +. diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/README.md b/is_themecore/vendor/rosell-dk/exec-with-fallback/README.md new file mode 100644 index 0000000..bdd7106 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/README.md @@ -0,0 +1,69 @@ +# Exec with fallback + +[![Latest Stable Version](http://poser.pugx.org/rosell-dk/exec-with-fallback/v)](https://packagist.org/packages/rosell-dk/exec-with-fallback) +[![Build Status](https://github.com/rosell-dk/exec-with-fallback/actions/workflows/php.yml/badge.svg)](https://github.com/rosell-dk/exec-with-fallback/actions/workflows/php.yml) +[![Software License](http://poser.pugx.org/rosell-dk/exec-with-fallback/license)](https://github.com/rosell-dk/exec-with-fallback/blob/master/LICENSE) +[![PHP Version Require](http://poser.pugx.org/rosell-dk/exec-with-fallback/require/php)](https://packagist.org/packages/rosell-dk/exec-with-fallback) +[![Daily Downloads](http://poser.pugx.org/rosell-dk/exec-with-fallback/d/daily)](https://packagist.org/packages/rosell-dk/exec-with-fallback) + +Some shared hosts may have disabled *exec()*, but leaved *proc_open()*, *passthru()*, *popen()* or *shell_exec()* open. In case you want to easily fall back to emulating *exec()* with one of these, you have come to the right library. + +This library can be useful if you a writing code that is meant to run on a broad spectrum of systems, as it makes your exec() call succeed on more of these systems. + +## Usage: +Simply swap out your current *exec()* calls with *ExecWithFallback::exec()*. The signatures are exactly the same. + +```php +use ExecWithFallback\ExecWithFallback; +$result = ExecWithFallback::exec('echo "hi"', $output, $result_code); +// $output (array) now holds the output +// $result_code (int) now holds the result code +// $return (string | false) is now false in case of failure or the last line of the output +``` + +Note that while the signatures are the same, errors are not exactly the same. There is a reason for that. On some systems, a real `exec()` call results in a FATAL error when the function has been disabled. That is: An error, that cannot be catched. You probably don't want to halt execution on some systems, but not on other. But if you do, use `ExecWithFallback::execNoMercy` instead of `ExecWithFallback::exec`. In case no emulations are available, it calls *exec()*, ensuring exact same error handling as normal *exec()*. + +If you have `function_exists('exec')` in your code, you probably want to change them to `ExecWithFallback::anyAvailable()` + +## Installing +`composer require rosell-dk/exec-with-fallback` + +## Implementation +*ExecWithFallback::exec()* first checks if *exec()* is available and calls it, if it is. In case *exec* is unavailable (deactivated on server), or exec() returns false, it moves on to checking if *passthru()* is available and so on. The order is as follows: +- exec() +- passthru() +- popen() +- proc_open() +- shell_exec() + +In case all functions are unavailable, a normal exception is thrown (class: Exception). This is more gentle behavior than real exec(), which on some systems throws FATAL error when the function is disabled. If you want exactly same errors, use `ExecWithFallback::execNoMercy` instead, which instead of throwing an exception calls *exec*, which will result in a throw (to support older PHP, you need to catch both Exception and Throwable. And note that you cannot catch on all systems, because some throws FATAL) + +In case none succeeded, but at least one failed by returning false, false is returned. Again to mimic *exec()* behavior. + +PS: As *shell_exec()* does not support *$result_code*, it will only be used when $result_code isn't supplied. *system()* is not implemented, as it cannot return the last line of output and there is no way to detect if your code relies on that. + +If you for some reason want to run a specific exec() emulation, you can use the corresponding class directly, ie *ProcOpen::exec()*. + +## Is it worth it? +Well, often these functions are often all enabled or all disabled. So on the majority of systems, it will not make a difference. But on the other hand: This library is easily installed, very lightweight and very well tested. + +**easily installed**\ +Install with composer (`composer require rosell-dk/exec-with-fallback`) and substitute your *exec()* calls. + +**lightweight**\ +The library is extremely lightweight. In case *exec()* is available, it is called immediately and only the main file is autoloaded. In case all are unavailable, it only costs a little loop, amounting to five *function_exists()* calls, and again, only the main file is autoloaded. In case *exec()* is unavailable, but one of the others are available, only that implementation is autoloaded, besides the main file. + +**well tested**\ +I made sure that the function behaves exactly like *exec()*, and wrote a lot of test cases. It is tested on ubuntu, windows, mac (all in several versions). It is tested in PHP 7.0, 7.1, 7.2, 7.3, 7.4 and 8.0. And it is tested in different combinations of disabled functions. + +**going to be maintained**\ +I'm going to use this library in [webp-convert](https://github.com/rosell-dk/webp-convert), which is used in many projects. So it is going to be widely used. While I don't expect much need for maintenance for this project, it is going to be there, if needed. + +**Con: risk of being recognized as malware** +There is a slight risk that a lazy malware creator uses this library for his malware. The risk is however very small, as the library isn't suitable for malware. First off, the library doesn't try *system()*, as that function does not return output and thus cannot be used to emulate *exec()*. A malware creator would desire to try all possible ways to get his malware executed. Secondly, malware creators probably don't use composer for their malware and would probably want a single function instead of having it spread over multiple files. Third, the library here use a lot of efford in getting the emululated functions to behave exactly as exec(). This concern is probably non-existant for malware creators, who probably cares more about the effect of running the malware. Lastly, a malware creator would want to write his own function instead of copying code found on the internet. Copying stuff would impose a chance that the code is used by another malware creator which increases the risk of anti malware software recognizing it as malware. + +## Do you like what I do? +Perhaps you want to support my work, so I can continue doing it :) + +- [Become a backer or sponsor on Patreon](https://www.patreon.com/rosell). +- [Buy me a Coffee](https://ko-fi.com/rosell) diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/composer.json b/is_themecore/vendor/rosell-dk/exec-with-fallback/composer.json new file mode 100644 index 0000000..a2224ca --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/composer.json @@ -0,0 +1,67 @@ +{ + "name": "rosell-dk/exec-with-fallback", + "description": "An exec() with fallback to emulations (proc_open, etc)", + "type": "library", + "license": "MIT", + "keywords": ["exec", "open_proc", "command", "fallback", "sturdy", "resiliant"], + "scripts": { + "ci": [ + "@test", + "@phpcs-all", + "@composer validate --no-check-all --strict", + "@phpstan-global" + ], + "test": "./vendor/bin/phpunit --coverage-text", + "test-41": "phpunit --coverage-text --configuration 'phpunit-41.xml.dist'", + "phpunit": "phpunit --coverage-text", + "test-no-cov": "phpunit --no-coverage", + "cs-fix-all": [ + "php-cs-fixer fix src" + ], + "cs-fix": "php-cs-fixer fix", + "cs-dry": "php-cs-fixer fix --dry-run --diff", + "phpcs": "phpcs --standard=PSR2", + "phpcs-all": "phpcs --standard=PSR2 src", + "phpcbf": "phpcbf --standard=PSR2", + "phpstan": "vendor/bin/phpstan analyse src --level=4", + "phpstan-global-old": "~/.composer/vendor/bin/phpstan analyse src --level=4", + "phpstan-global": "~/.config/composer/vendor/bin/phpstan analyse src --level=4" + }, + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { "ExecWithFallback\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "ExecWithFallback\\Tests\\": "tests/" } + }, + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "require": { + "php": "^5.6 | ^7.0 | ^8.0" + }, + "suggest": { + "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "config": { + "sort-packages": true + } +} diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/phpstan.neon b/is_themecore/vendor/rosell-dk/exec-with-fallback/phpstan.neon new file mode 100644 index 0000000..e32c6ed --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/phpstan.neon @@ -0,0 +1,3 @@ +parameters: + ignoreErrors: + - '#PHPDoc tag @param.*Unexpected token "&"#' diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist b/is_themecore/vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist new file mode 100644 index 0000000..0d4d964 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist @@ -0,0 +1,21 @@ + + + + + src/ + + + + + + + + + + ./tests/ + + + + + + diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist.bak b/is_themecore/vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist.bak new file mode 100644 index 0000000..c2d24d1 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist.bak @@ -0,0 +1,28 @@ + + + + + ./tests/ + + + + + src/ + + + + + + + + + diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/src/Availability.php b/is_themecore/vendor/rosell-dk/exec-with-fallback/src/Availability.php new file mode 100644 index 0000000..db4302d --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/src/Availability.php @@ -0,0 +1,39 @@ + + */ +class Availability extends ExecWithFallback +{ + + /** + * Check if any of the methods are available on the system. + * + * @param boolean $needResultCode Whether the code using this library is going to supply $result_code to the exec + * call. This matters because shell_exec is only available when not. + */ + public static function anyAvailable($needResultCode = true) + { + foreach (self::$methods as $method) { + if (self::methodAvailable($method, $needResultCode)) { + return true; + } + } + return false; + } + + public static function methodAvailable($method, $needResultCode = true) + { + if (!ExecWithFallback::functionEnabled($method)) { + return false; + } + if ($needResultCode) { + return ($method != 'shell_exec'); + } + return true; + } +} diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/src/ExecWithFallback.php b/is_themecore/vendor/rosell-dk/exec-with-fallback/src/ExecWithFallback.php new file mode 100644 index 0000000..ad571b9 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/src/ExecWithFallback.php @@ -0,0 +1,127 @@ + + */ +class ExecWithFallback +{ + + protected static $methods = ['exec', 'passthru', 'popen', 'proc_open', 'shell_exec']; + + /** + * Check if any of the methods are available on the system. + * + * @param boolean $needResultCode Whether the code using this library is going to supply $result_code to the exec + * call. This matters because shell_exec is only available when not. + */ + public static function anyAvailable($needResultCode = true) + { + return Availability::anyAvailable($needResultCode); + } + + /** + * Check if a function is enabled (function_exists as well as ini is tested) + * + * @param string $functionName The name of the function + * + * @return boolean If the function is enabled + */ + public static function functionEnabled($functionName) + { + if (!function_exists($functionName)) { + return false; + } + if (function_exists('ini_get')) { + if (ini_get('safe_mode')) { + return false; + } + $d = ini_get('disable_functions') . ',' . ini_get('suhosin.executor.func.blacklist'); + if ($d === false) { + $d = ''; + } + $d = preg_replace('/,\s*/', ',', $d); + if (strpos(',' . $d . ',', ',' . $functionName . ',') !== false) { + return false; + } + } + return is_callable($functionName); + } + + + /** + * Execute. - A substitute for exec() + * + * Same signature and results as exec(): https://www.php.net/manual/en/function.exec.php + * In case neither exec(), nor emulations are available, it throws an Exception. + * This is more gentle than real exec(), which on some systems throws a FATAL when exec() is disabled + * If you want the more acurate substitute, which might halt execution, use execNoMercy() instead. + * + * @param string $command The command to execute + * @param string &$output (optional) + * @param int &$result_code (optional) + * + * @return string | false The last line of output or false in case of failure + * @throws \Exception If no methods are available + */ + public static function exec($command, &$output = null, &$result_code = null) + { + foreach (self::$methods as $method) { + if (self::functionEnabled($method)) { + if (func_num_args() >= 3) { + if ($method == 'shell_exec') { + continue; + } + $result = self::runExec($method, $command, $output, $result_code); + } else { + $result = self::runExec($method, $command, $output); + } + if ($result !== false) { + return $result; + } + } + } + if (isset($result) && ($result === false)) { + return false; + } + throw new \Exception('exec() is not available'); + } + + /** + * Execute. - A substitute for exec(), with exact same errors thrown if exec() is missing. + * + * Danger: On some systems, this results in a fatal (non-catchable) error. + */ + public static function execNoMercy($command, &$output = null, &$result_code = null) + { + if (func_num_args() == 3) { + return ExecWithFallbackNoMercy::exec($command, $output, $result_code); + } else { + return ExecWithFallbackNoMercy::exec($command, $output); + } + } + + public static function runExec($method, $command, &$output = null, &$result_code = null) + { + switch ($method) { + case 'exec': + return exec($command, $output, $result_code); + case 'passthru': + return Passthru::exec($command, $output, $result_code); + case 'popen': + return POpen::exec($command, $output, $result_code); + case 'proc_open': + return ProcOpen::exec($command, $output, $result_code); + case 'shell_exec': + if (func_num_args() == 4) { + return ShellExec::exec($command, $output, $result_code); + } else { + return ShellExec::exec($command, $output); + } + } + return false; + } +} diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/src/ExecWithFallbackNoMercy.php b/is_themecore/vendor/rosell-dk/exec-with-fallback/src/ExecWithFallbackNoMercy.php new file mode 100644 index 0000000..888bc1a --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/src/ExecWithFallbackNoMercy.php @@ -0,0 +1,56 @@ + + */ +class ExecWithFallbackNoMercy +{ + + /** + * Execute. - A substitute for exec() + * + * Same signature and results as exec(): https://www.php.net/manual/en/function.exec.php + * + * This is our hardcore version of our exec(). It does not merely throw an Exception, if + * no methods are available. It calls exec(). + * This ensures exactly same behavior as normal exec() - the same error is thrown. + * You might want that. But do you really? + * DANGER: On some systems, calling a disabled exec() results in a fatal (non-catchable) error. + * + * @param string $command The command to execute + * @param string &$output (optional) + * @param int &$result_code (optional) + * + * @return string | false The last line of output or false in case of failure + * @throws \Exception|\Error If no methods are available. Note: On some systems, it is FATAL! + */ + public static function exec($command, &$output = null, &$result_code = null) + { + foreach (self::$methods as $method) { + if (self::functionEnabled($method)) { + if (func_num_args() >= 3) { + if ($method == 'shell_exec') { + continue; + } + $result = self::runExec($method, $command, $output, $result_code); + } else { + $result = self::runExec($method, $command, $output); + } + if ($result !== false) { + return $result; + } + } + } + if (isset($result) && ($result === false)) { + return false; + } + // MIGHT THROW FATAL! + return exec($command, $output, $result_code); + } + + +} diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/src/POpen.php b/is_themecore/vendor/rosell-dk/exec-with-fallback/src/POpen.php new file mode 100644 index 0000000..8d0d047 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/src/POpen.php @@ -0,0 +1,60 @@ + + */ +class POpen +{ + + /** + * Emulate exec() with system() + * + * @param string $command The command to execute + * @param string &$output (optional) + * @param int &$result_code (optional) + * + * @return string | false The last line of output or false in case of failure + */ + public static function exec($command, &$output = null, &$result_code = null) + { + + $handle = @popen($command, "r"); + if ($handle === false) { + return false; + } + + $result = ''; + while (!@feof($handle)) { + $result .= fread($handle, 1024); + } + + //Note: Unix Only: + // pclose() is internally implemented using the waitpid(3) system call. + // To obtain the real exit status code the pcntl_wexitstatus() function should be used. + $result_code = pclose($handle); + + $theOutput = preg_split('/\s*\r\n|\s*\n\r|\s*\n|\s*\r/', $result); + + // remove the last element if it is blank + if ((count($theOutput) > 0) && ($theOutput[count($theOutput) -1] == '')) { + array_pop($theOutput); + } + + if (count($theOutput) == 0) { + return ''; + } + if (gettype($output) == 'array') { + foreach ($theOutput as $line) { + $output[] = $line; + } + } else { + $output = $theOutput; + } + return $theOutput[count($theOutput) -1]; + } +} diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/src/Passthru.php b/is_themecore/vendor/rosell-dk/exec-with-fallback/src/Passthru.php new file mode 100644 index 0000000..0cbfea1 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/src/Passthru.php @@ -0,0 +1,58 @@ + + */ +class Passthru +{ + + /** + * Emulate exec() with passthru() + * + * @param string $command The command to execute + * @param string &$output (optional) + * @param int &$result_code (optional) + * + * @return string | false The last line of output or false in case of failure + */ + public static function exec($command, &$output = null, &$result_code = null) + { + ob_start(); + // Note: We use try/catch in order to close output buffering in case it throws + try { + passthru($command, $result_code); + } catch (\Exception $e) { + ob_get_clean(); + passthru($command, $result_code); + } catch (\Throwable $e) { + ob_get_clean(); + passthru($command, $result_code); + } + $result = ob_get_clean(); + + // split new lines. Also remove trailing space, as exec() does + $theOutput = preg_split('/\s*\r\n|\s*\n\r|\s*\n|\s*\r/', $result); + + // remove the last element if it is blank + if ((count($theOutput) > 0) && ($theOutput[count($theOutput) -1] == '')) { + array_pop($theOutput); + } + + if (count($theOutput) == 0) { + return ''; + } + if (gettype($output) == 'array') { + foreach ($theOutput as $line) { + $output[] = $line; + } + } else { + $output = $theOutput; + } + return $theOutput[count($theOutput) -1]; + } +} diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/src/ProcOpen.php b/is_themecore/vendor/rosell-dk/exec-with-fallback/src/ProcOpen.php new file mode 100644 index 0000000..213c7bb --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/src/ProcOpen.php @@ -0,0 +1,67 @@ + + */ +class ProcOpen +{ + + /** + * Emulate exec() with proc_open() + * + * @param string $command The command to execute + * @param string &$output (optional) + * @param int &$result_code (optional) + * + * @return string | false The last line of output or false in case of failure + */ + public static function exec($command, &$output = null, &$result_code = null) + { + $descriptorspec = array( + //0 => array("pipe", "r"), + 1 => array("pipe", "w"), + //2 => array("pipe", "w"), + //2 => array("file", "/tmp/error-output.txt", "a") + ); + + $cwd = getcwd(); // or is "/tmp" better? + $processHandle = proc_open($command, $descriptorspec, $pipes, $cwd); + $result = ""; + if (is_resource($processHandle)) { + // Got this solution here: + // https://stackoverflow.com/questions/5673740/php-or-apache-exec-popen-system-and-proc-open-commands-do-not-execute-any-com + //fclose($pipes[0]); + $result = stream_get_contents($pipes[1]); + fclose($pipes[1]); + //fclose($pipes[2]); + $result_code = proc_close($processHandle); + + // split new lines. Also remove trailing space, as exec() does + $theOutput = preg_split('/\s*\r\n|\s*\n\r|\s*\n|\s*\r/', $result); + + // remove the last element if it is blank + if ((count($theOutput) > 0) && ($theOutput[count($theOutput) -1] == '')) { + array_pop($theOutput); + } + + if (count($theOutput) == 0) { + return ''; + } + if (gettype($output) == 'array') { + foreach ($theOutput as $line) { + $output[] = $line; + } + } else { + $output = $theOutput; + } + return $theOutput[count($theOutput) -1]; + } else { + return false; + } + } +} diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/src/ShellExec.php b/is_themecore/vendor/rosell-dk/exec-with-fallback/src/ShellExec.php new file mode 100644 index 0000000..a16715e --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/src/ShellExec.php @@ -0,0 +1,69 @@ + + */ +class ShellExec +{ + + /** + * Emulate exec() with shell_exec() + * + * @param string $command The command to execute + * @param string &$output (optional) + * @param int &$result_code (optional) + * + * @return string | false The last line of output or false in case of failure + */ + public static function exec($command, &$output = null, &$result_code = null) + { + $resultCodeSupplied = (func_num_args() >= 3); + if ($resultCodeSupplied) { + throw new \Exception('ShellExec::exec() does not support $result_code argument'); + } + + $result = shell_exec($command); + + // result: + // - A string containing the output from the executed command, + // - false if the pipe cannot be established + // - or null if an error occurs or the command produces no output. + + if ($result === false) { + return false; + } + if (is_null($result)) { + // hm, "null if an error occurs or the command produces no output." + // What were they thinking? + // And yes, it does return null, when no output, which is confirmed in the test "echo hi 1>/dev/null" + // What should we do? Throw or accept? + // Perhaps shell_exec throws in newer versions of PHP instead of returning null. + // We are counting on it until proved wrong. + return ''; + } + + $theOutput = preg_split('/\s*\r\n|\s*\n\r|\s*\n|\s*\r/', $result); + + // remove the last element if it is blank + if ((count($theOutput) > 0) && ($theOutput[count($theOutput) -1] == '')) { + array_pop($theOutput); + } + + if (count($theOutput) == 0) { + return ''; + } + if (gettype($output) == 'array') { + foreach ($theOutput as $line) { + $output[] = $line; + } + } else { + $output = $theOutput; + } + return $theOutput[count($theOutput) -1]; + } +} diff --git a/is_themecore/vendor/rosell-dk/exec-with-fallback/test.php b/is_themecore/vendor/rosell-dk/exec-with-fallback/test.php new file mode 100644 index 0000000..89addb0 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/exec-with-fallback/test.php @@ -0,0 +1,9 @@ + /dev/null; then XDEBUG=xdebug2; else XDEBUG=xdebug; fi + + # Store XDEBUG in github env, so we can access it later through env.XDEBUG + echo "XDEBUG=$XDEBUG" >> $GITHUB_ENV + + echo "Result: ${{ env.XDEBUG }}" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: ${{ env.XDEBUG }} + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key, and for install + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all + + - name: Create coverage badge json + run: | + # Extract total coverage + COVERAGE=$(grep -oP -m 1 'Lines:\s*\K[0-9.%]+' build/coverage.txt) + + # Set COLOR based on COVERAGE + # 0-49%: red, 50%-69%: orange, 70%-80%: yellow, 90%-100%: brightgreen + if grep -oP '(^9\d.)|(^100.)' <<< "$COVERAGE" > /dev/null; then COLOR=brightgreen; elif grep -oP '[87]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=yellow; elif grep -oP '[65]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=orange; else COLOR=red; fi; + + # Generate bagde json + echo \{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"$COVERAGE\",\"color\":\"$COLOR\"\} | tee build/coverage-badge.json + + # PS: If we needed COVERAGE elsewhere, we could store in ENV like this: + # echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV + + - name: Install SSH Key (for deployment of code coverage) + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.DEPLOY_KEY }} + known_hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }} + + - name: Upload code coverage report + run: | + sh -c "rsync -rtog --chown :www-data $GITHUB_WORKSPACE/build/ $DEPLOY_DESTINATION --delete" + env: + DEPLOY_DESTINATION: ${{ secrets.DEPLOY_DESTINATION }} diff --git a/is_themecore/vendor/rosell-dk/file-util/.github/workflows/release.yml b/is_themecore/vendor/rosell-dk/file-util/.github/workflows/release.yml new file mode 100644 index 0000000..6c90335 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/file-util/.github/workflows/release.yml @@ -0,0 +1,83 @@ +name: Big test (trigger manually before releasing) + +on: workflow_dispatch + +permissions: + contents: read + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-20.04, ubuntu-18.04, windows-2022, windows-2019, macos-11, macos-10.15] + php: [8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0] + #os: [windows-2022, macos-10.15] + #php: [8.1] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test-no-cov + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all diff --git a/is_themecore/vendor/rosell-dk/file-util/LICENSE b/is_themecore/vendor/rosell-dk/file-util/LICENSE new file mode 100644 index 0000000..78457aa --- /dev/null +++ b/is_themecore/vendor/rosell-dk/file-util/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2018 Bjørn Rosell + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/is_themecore/vendor/rosell-dk/file-util/README.md b/is_themecore/vendor/rosell-dk/file-util/README.md new file mode 100644 index 0000000..a26d86a --- /dev/null +++ b/is_themecore/vendor/rosell-dk/file-util/README.md @@ -0,0 +1,22 @@ +# File Util + +[![Build Status](https://github.com/rosell-dk/file-util/workflows/build/badge.svg)](https://github.com/rosell-dk/file-util/actions/workflows/php.yml) +[![Software License](https://img.shields.io/badge/license-MIT-418677.svg)](https://github.com/rosell-dk/file-util/blob/master/LICENSE) +[![Coverage](https://img.shields.io/endpoint?url=https://little-b.it/file-util/code-coverage/coverage-badge.json)](http://little-b.it/file-util/code-coverage/coverage/index.html) +[![Latest Stable Version](https://img.shields.io/packagist/v/rosell-dk/file-util.svg)](https://packagist.org/packages/rosell-dk/file-util) +[![Minimum PHP Version](https://img.shields.io/packagist/php-v/rosell-dk/file-util)](https://php.net) + +Just a bunch of handy methods for dealing with files and paths: + + +- *FileExists::fileExists($path)*:\ +A well-behaved version of *file_exists* that throws upon failure rather than emitting a warning + +- *FileExists::fileExistsTryHarder($path)*:\ +Also well-behaved. Tries FileExists::fileExists(). In case of failure, tries exec()-based implementation + +- *PathValidator::checkPath($path)*:\ +Check if path looks valid and doesn't contain suspecious patterns + +- *PathValidator::checkFilePathIsRegularFile($path)*:\ +Check if path points to a regular file (and doesnt match suspecious patterns) diff --git a/is_themecore/vendor/rosell-dk/file-util/composer.json b/is_themecore/vendor/rosell-dk/file-util/composer.json new file mode 100644 index 0000000..346b78a --- /dev/null +++ b/is_themecore/vendor/rosell-dk/file-util/composer.json @@ -0,0 +1,69 @@ +{ + "name": "rosell-dk/file-util", + "description": "Functions for dealing with files and paths", + "type": "library", + "license": "MIT", + "keywords": ["files", "path", "util"], + "scripts": { + "ci": [ + "@test", + "@phpcs-all", + "@composer validate --no-check-all --strict", + "@phpstan-global" + ], + "phpunit": "phpunit --coverage-text", + "test": "phpunit --coverage-text=build/coverage.txt --coverage-clover=build/coverage.clover --coverage-html=build/coverage --whitelist=src tests", + "test-no-cov": "phpunit --no-coverage tests", + "test-41": "phpunit --no-coverage --configuration 'phpunit-41.xml.dist'", + "test-with-coverage": "phpunit --coverage-text --configuration 'phpunit-with-coverage.xml.dist'", + "test-41-with-coverage": "phpunit --coverage-text --configuration 'phpunit-41.xml.dist'", + "cs-fix-all": [ + "php-cs-fixer fix src" + ], + "cs-fix": "php-cs-fixer fix", + "cs-dry": "php-cs-fixer fix --dry-run --diff", + "phpcs": "phpcs --standard=phpcs-ruleset.xml", + "phpcs-all": "phpcs --standard=phpcs-ruleset.xml src", + "phpcbf": "phpcbf --standard=PSR2", + "phpstan": "vendor/bin/phpstan analyse src --level=4", + "phpstan-global-old": "~/.composer/vendor/bin/phpstan analyse src --level=4", + "phpstan-global": "~/.config/composer/vendor/bin/phpstan analyse src --level=4" + }, + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { "FileUtil\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "FileUtil\\Tests\\": "tests/" } + }, + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "require": { + "php": ">=5.4", + "rosell-dk/exec-with-fallback": "^1.0.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*", + "phpstan/phpstan": "^1.5", + "mikey179/vfsstream": "^1.6" + }, + "config": { + "sort-packages": true + } +} diff --git a/is_themecore/vendor/rosell-dk/file-util/phpcs-ruleset.xml b/is_themecore/vendor/rosell-dk/file-util/phpcs-ruleset.xml new file mode 100644 index 0000000..37d5689 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/file-util/phpcs-ruleset.xml @@ -0,0 +1,8 @@ + + + PSR2 without line ending rule - let git manage the EOL cross the platforms + + + + + diff --git a/is_themecore/vendor/rosell-dk/file-util/src/FileExists.php b/is_themecore/vendor/rosell-dk/file-util/src/FileExists.php new file mode 100644 index 0000000..2ecdd4c --- /dev/null +++ b/is_themecore/vendor/rosell-dk/file-util/src/FileExists.php @@ -0,0 +1,96 @@ + + */ +class FileExists +{ + + private static $lastWarning; + + /** + * A warning handler that registers that a warning has occured and suppresses it. + * + * The function is a callback used with "set_error_handler". + * It is declared public because it needs to be accessible from the point where the warning is triggered. + * + * @param integer $errno + * @param string $errstr + * @param string $errfile + * @param integer $errline + * + * @return void + */ + public static function warningHandler($errno, $errstr, $errfile, $errline) + { + self::$lastWarning = [$errstr, $errno]; + + // Suppress the warning by returning void + return; + } + + /** + * A well behaved replacement for file_exist that throws upon failure rather than emitting a warning. + * + * @throws \Exception Throws an exception in case file_exists emits a warning + * @return boolean True if file exists. False if it doesn't. + */ + public static function fileExists($path) + { + // There is a challenges here: + // We want to suppress warnings, but at the same time we want to know that it happened. + // We achieve this by registering an error handler + set_error_handler( + array('FileUtil\FileExists', "warningHandler"), + E_WARNING | E_USER_WARNING | E_NOTICE | E_USER_NOTICE + ); + self::$lastWarning = null; + $found = @file_exists($path); + + // restore previous error handler immediately + restore_error_handler(); + + // If file_exists returns true, we can rely on there being a file there + if ($found) { + return true; + } + + // file_exists returned false. + // this result is only trustworthy if no warning was emitted. + if (is_null(self::$lastWarning)) { + return false; + } + + list($errstr, $errno) = self::$lastWarning; + throw new \Exception($errstr, $errno); + } + + /** + * A fileExist doing the best it can. + * + * @throws \Exception If it cannot be determined if the file exists + * @return boolean|null True if file exists. False if it doesn't. + */ + public static function fileExistsTryHarder($path) + { + try { + $result = self::fileExists($path); + } catch (\Exception $e) { + try { + $result = FileExistsUsingExec::fileExists($path); + } catch (\Exception $e) { + throw new \Exception('Cannot determine if file exists or not'); + } catch (\Throwable $e) { + throw new \Exception('Cannot determine if file exists or not'); + } + } + return $result; + } +} diff --git a/is_themecore/vendor/rosell-dk/file-util/src/FileExistsUsingExec.php b/is_themecore/vendor/rosell-dk/file-util/src/FileExistsUsingExec.php new file mode 100644 index 0000000..493316b --- /dev/null +++ b/is_themecore/vendor/rosell-dk/file-util/src/FileExistsUsingExec.php @@ -0,0 +1,40 @@ + + */ +class FileExistsUsingExec +{ + + /** + * A fileExist based on an exec call. + * + * @throws \Exception If exec cannot be called + * @return boolean|null True if file exists. False if it doesn't. + */ + public static function fileExists($path) + { + if (!ExecWithFallback::anyAvailable()) { + throw new \Exception( + 'cannot determine if file exists using exec() or similar - the function is unavailable' + ); + } + + // Lets try to find out by executing "ls path/to/cwebp" + ExecWithFallback::exec('ls ' . $path, $output, $returnCode); + if (($returnCode == 0) && (isset($output[0]))) { + return true; + } + + // We assume that "ls" command is general available! + // As that failed, we can conclude the file does not exist. + return false; + } +} diff --git a/is_themecore/vendor/rosell-dk/file-util/src/PathValidator.php b/is_themecore/vendor/rosell-dk/file-util/src/PathValidator.php new file mode 100644 index 0000000..a68598c --- /dev/null +++ b/is_themecore/vendor/rosell-dk/file-util/src/PathValidator.php @@ -0,0 +1,70 @@ + + */ +class PathValidator +{ + /** + * Check if path looks valid and doesn't contain suspecious patterns. + + * The path must meet the following criteria: + * + * - It must be a string + * - No NUL character + * - No control characters between 0-20 + * - No phar stream wrapper + * - No php stream wrapper + * - No glob stream wrapper + * - Not empty path + * + * @throws \Exception In case the path doesn't meet all criteria + */ + public static function checkPath($path) + { + if (gettype($path) !== 'string') { + throw new \Exception('File path must be string'); + } + if (strpos($path, chr(0)) !== false) { + throw new \Exception('NUL character is not allowed in file path!'); + } + if (preg_match('#[\x{0}-\x{1f}]#', $path)) { + // prevents line feed, new line, tab, charater return, tab, ets. + throw new \Exception('Control characters #0-#20 not allowed in file path!'); + } + // Prevent phar stream wrappers (security threat) + if (preg_match('#^phar://#', $path)) { + throw new \Exception('phar stream wrappers are not allowed in file path'); + } + if (preg_match('#^(php|glob)://#', $path)) { + throw new \Exception('php and glob stream wrappers are not allowed in file path'); + } + if (empty($path)) { + throw new \Exception('File path is empty!'); + } + } + + /** + * Check if path points to a regular file (and doesnt match suspecious patterns). + * + * @throws \Exception In case the path doesn't point to a regular file or matches suspecious patterns + */ + public static function checkFilePathIsRegularFile($path) + { + self::checkPath($path); + + if (!FileExists::fileExists($path)) { + throw new \Exception('File does not exist'); + } + if (@is_dir($path)) { + throw new \Exception('Expected a regular file, not a dir'); + } + } +} diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.circleci/config.yml b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.circleci/config.yml new file mode 100644 index 0000000..a656400 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.circleci/config.yml @@ -0,0 +1,76 @@ +# PHP CircleCI 2.0 configuration file +# +# Check https://circleci.com/docs/2.0/language-php/ for more details +# +version: 2 +jobs: + build71: + docker: + - image: circleci/php:7.1 + + steps: + - checkout + + - run: sudo apt update + - run: sudo docker-php-ext-install zip + + - restore_cache: + keys: + # "composer.lock" can be used if it is committed to the repo + - v1-dependencies-{{ checksum "composer.json" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + + - run: composer install -n --prefer-dist + + - save_cache: + key: v1-dependencies-{{ checksum "composer.json" }} + paths: + - ./vendor + + - run: ./vendor/bin/phpunit + - run: wget https://scrutinizer-ci.com/ocular.phar + - run: php ocular.phar code-coverage:upload --format=php-clover coverage.clover + + + build70: + docker: + - image: circleci/php:7.0 + steps: + - checkout + - run: sudo apt update + - restore_cache: + keys: + - v0-dependencies-{{ checksum "composer.json" }} + - v0-dependencies- + - run: composer install -n --prefer-dist + - save_cache: + key: v0-dependencies-{{ checksum "composer.json" }} + paths: + - ./vendor + - run: composer test + + build56: + docker: + - image: circleci/php:5.6 + steps: + - checkout + - run: sudo apt update + - restore_cache: + keys: + - v56-dependencies-{{ checksum "composer.json" }} + - v56-dependencies- + - run: composer install -n --prefer-dist + - save_cache: + key: v56-dependencies-{{ checksum "composer.json" }} + paths: + - ./vendor + - run: composer test + +workflows: + version: 2 + build_and_test_all: + jobs: + #- build71 + #- build70 + #- build56 diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.github/FUNDING.yml b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.github/FUNDING.yml new file mode 100644 index 0000000..8dd1d30 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: rosell-dk +ko_fi: rosell diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.github/workflows/php.yml b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.github/workflows/php.yml new file mode 100644 index 0000000..00766a6 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.github/workflows/php.yml @@ -0,0 +1,123 @@ +name: build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest] + php: [8.1] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Determine which version of xdebug to use + run: | + # Set XDEBUG to "xdebug2" for PHP 7.2-7.4, but to "xdebug" for + if grep -oP '^7.[234]' <<< "$PHP" > /dev/null; then XDEBUG=xdebug2; else XDEBUG=xdebug; fi + + # Store XDEBUG in github env, so we can access it later through env.XDEBUG + echo "XDEBUG=$XDEBUG" >> $GITHUB_ENV + + echo "Result: ${{ env.XDEBUG }}" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: ${{ env.XDEBUG }} + extensions: exif, mbstring, fileinfo, gd + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key, and for install + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all + + - name: Create coverage badge json + run: | + # Extract total coverage + COVERAGE=$(grep -oP -m 1 'Lines:\s*\K[0-9.%]+' build/coverage.txt) + + # Set COLOR based on COVERAGE + # 0-49%: red, 50%-69%: orange, 70%-80%: yellow, 90%-100%: brightgreen + if grep -oP '(^9\d.)|(^100.)' <<< "$COVERAGE" > /dev/null; then COLOR=brightgreen; elif grep -oP '[87]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=yellow; elif grep -oP '[65]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=orange; else COLOR=red; fi; + + # Generate bagde json + echo \{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"$COVERAGE\",\"color\":\"$COLOR\"\} | tee build/coverage-badge.json + + # PS: If we needed COVERAGE elsewhere, we could store in ENV like this: + # echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV + + - name: Install SSH Key (for deployment of code coverage) + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.DEPLOY_KEY }} + known_hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }} + + - name: Upload code coverage report + run: | + sh -c "rsync -rtog --chown :www-data $GITHUB_WORKSPACE/build/ $DEPLOY_DESTINATION --delete" + env: + DEPLOY_DESTINATION: ${{ secrets.DEPLOY_DESTINATION }} diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.github/workflows/release.yml b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.github/workflows/release.yml new file mode 100644 index 0000000..785a7d9 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.github/workflows/release.yml @@ -0,0 +1,85 @@ +name: Big test (trigger manually before releasing) + +on: workflow_dispatch + +permissions: + contents: read + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-20.04, ubuntu-18.04, windows-2022, windows-2019, macos-11, macos-10.15] + #os: [windows-2022, windows-2019] + php: [8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0] + #os: [windows-2022] + #php: [8.1, 7.0] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + extensions: exif, mbstring, fileinfo, gd + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test-no-cov + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.php_cs.dist b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.php_cs.dist new file mode 100644 index 0000000..327ab2b --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/.php_cs.dist @@ -0,0 +1,19 @@ +exclude('tests') + ->in(__DIR__) +; + +$config = PhpCsFixer\Config::create(); +$config + ->setRules([ + '@PSR2' => true, + 'array_syntax' => [ + 'syntax' => 'short', + ], + ]) + ->setFinder($finder) +; + +return $config; diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/LICENSE b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/LICENSE new file mode 100644 index 0000000..78457aa --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2018 Bjørn Rosell + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/README.md b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/README.md new file mode 100644 index 0000000..d7eea84 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/README.md @@ -0,0 +1,110 @@ +# image-mime-type-guesser + +[![Latest Stable Version](https://img.shields.io/packagist/v/rosell-dk/image-mime-type-guesser.svg?style=flat-square)](https://packagist.org/packages/rosell-dk/image-mime-type-guesser) +[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg?style=flat-square)](https://php.net) +[![Build Status](https://img.shields.io/github/workflow/status/rosell-dk/image-mime-type-guesser/PHP?logo=GitHub&style=flat-square)](https://github.com/rosell-dk/image-mime-type-guesser/actions/workflows/php.yml) +[![Coverage](https://img.shields.io/endpoint?url=https://little-b.it/image-mime-type-guesser/code-coverage/coverage-badge.json)](http://little-b.it/image-mime-type-guesser/code-coverage/coverage/index.html) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/rosell-dk/image-mime-type-guesser/blob/master/LICENSE) +[![Monthly Downloads](http://poser.pugx.org/rosell-dk/image-mime-type-guesser/d/monthly)](https://packagist.org/packages/rosell-dk/image-mime-type-guesser) +[![Dependents](http://poser.pugx.org/rosell-dk/image-mime-type-guesser/dependents)](https://packagist.org/packages/rosell-dk/image-mime-type-guesser/dependents?order_by=downloads) + + +*Detect / guess mime type of an image* + +Do you need to determine if a file is an image?
+And perhaps you also want to know the mime type of the image?
+ +– You come to the right library. + +Ok, actually the library cannot offer mime type detection for images which works *on all platforms*, but it can try a whole stack of methods and optionally fall back to guess from the file extension. + +The stack of detect methods are currently (and in that order): +- [This signature sniffer](https://github.com/rosell-dk/image-mime-type-sniffer) *Does not require any extensions. Recognizes popular image formats only* +- [`finfo`](https://www.php.net/manual/en/class.finfo.php) *Requires fileinfo extension to be enabled. (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL fileinfo >= 0.1.0)* +- [`exif_imagetype`](https://www.php.net/manual/en/function.exif-imagetype.php) *Requires that PHP is compiled with exif (PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)* +- [`mime_content_type`](https://www.php.net/manual/en/function.mime-content-type.php) *Requires fileinfo. (PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)* + +Note that all these methods except the signature sniffer relies on the mime type mapping on the server (the `mime.types` file in Apache). If the server doesn't know about a certain mime type, it will not be detected. This does however not mean that the methods relies on the file extension. A png file renamed to "png.jpeg" will be correctly identified as *image/png*. + +Besides the detection methods, the library also comes with a method for mapping file extension to mime type. It is rather limited, though. + +## Installation + +Install with composer: +``` +composer require rosell-dk/image-mime-type-guesser +``` + +## Usage + +To detect the mime type of a file, use `ImageMimeTypeGuesser::detect($filePath)`. It returns the mime-type, if the file is recognized as an image. *false* is returned if it is not recognized as an image. *null* is returned if the mime type could not be determined (ie due to none of the methods being available). + +Example: +```php +use ImageMimeTypeGuesser\ImageMimeTypeGuesser; +$result = ImageMimeTypeGuesser::detect($filePath); +if (is_null($result)) { + // the mime type could not be determined +} elseif ($result === false) { + // it is NOT an image (not a mime type that the server knows about anyway) + // This happens when: + // a) The mime type is identified as something that is not an image (ie text) + // b) The mime type isn't identified (ie if the image type is not known by the server) +} else { + // it is an image, and we know its mime type! + $mimeType = $result; +} +``` + +For convenience, you can use *detectIsIn* method to test if a detection is in a list of mimetypes. + +```php +if (ImageMimeTypeGuesser::detectIsIn($filePath, ['image/jpeg','image/png'])) { + // The file is a jpeg or a png +} +``` + +The `detect` method does not resort to mapping from file extension. In most cases you do not want to do that. In some cases it can be insecure to do that. For example, if you want to prevent a user from uploading executable files, you probably do not want to allow her to upload executable files with innocent looking file extenions, such as "evil-exe.jpg". + +In some cases, though, you simply want a best guess, and in that case, falling back to mapping from file extension makes sense. In that case, you can use the *guess* method instead of the *detect* method. Or you can use *lenientGuess*. Lenient guess is even more slacky and will turn to mapping not only when dectect return *null*, but even when it returns *false*. + +*Warning*: Beware that guessing from file extension is unsuited when your aim is to protect the server from harmful uploads. + +*Notice*: Only a limited set of image extensions is recognized by the extension to mimetype mapper - namely the following: { apng, avif, bmp, gif, ico, jpg, jpeg, png, tif, tiff, webp, svg }. If you need some other specifically, feel free to add a PR, or ask me to do it by creating an issue. + + +Example: +```php +$result = ImageMimeTypeGuesser::guess($filePath); +if ($result !== false) { + // It appears to be an image + // BEWARE: This is only a guess, as we resort to mapping from file extension, + // when the file cannot be properly detected. + // DO NOT USE THIS GUESS FOR PROTECTING YOUR SERVER + $mimeType = $result; +} else { + // It does not appear to be an image +} +``` + +The guess functions also have convenience methods for testing against a list of mime types. They are called `ImageMimeTypeGuesser::guessIsIn` and `ImageMimeTypeGuesser::lenientGuessIsIn`. + +Example: +```php +if (ImageMimeTypeGuesser::guessIsIn($filePath, ['image/jpeg','image/png'])) { + // The file appears to be a jpeg or a png +} +``` + +## Alternatives + +Other sniffers: +- https://github.com/Intervention/mimesniffer +- https://github.com/zjsxwc/mime-type-sniffer +- https://github.com/Tinram/File-Identifier + +## Do you like what I do? +Perhaps you want to support my work, so I can continue doing it :) + +- [Become a backer or sponsor on Patreon](https://www.patreon.com/rosell). +- [Buy me a Coffee](https://ko-fi.com/rosell) diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/composer.json b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/composer.json new file mode 100644 index 0000000..3b16065 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/composer.json @@ -0,0 +1,63 @@ +{ + "name": "rosell-dk/image-mime-type-guesser", + "description": "Guess mime type of images", + "type": "library", + "license": "MIT", + "keywords": ["mime", "mime type", "image", "images"], + "scripts": { + "ci": [ + "@test", + "@phpcs-all", + "@composer validate --no-check-all --strict", + "@phpstan" + ], + "cs-fix-all": [ + "php-cs-fixer fix src" + ], + "cs-fix": "php-cs-fixer fix", + "cs-dry": "php-cs-fixer fix --dry-run --diff", + "test": "phpunit --coverage-text=build/coverage.txt --coverage-clover=build/coverage.clover --coverage-html=build/coverage --whitelist=src tests", + "test-no-cov": "phpunit tests", + "test2": "phpunit tests", + "phpcs": "phpcs --standard=phpcs-ruleset.xml", + "phpcs-all": "phpcs --standard=phpcs-ruleset.xml src", + "phpcbf": "phpcbf --standard=PSR2", + "phpstan": "vendor/bin/phpstan analyse src --level=4" + }, + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { "ImageMimeTypeGuesser\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "ImageMimeTypeGuesser\\Tests\\": "tests/" } + }, + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "require": { + "php": "^5.6 | ^7.0 | ^8.0", + "rosell-dk/image-mime-type-sniffer": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*", + "phpstan/phpstan": "^1.5" + }, + "config": { + "sort-packages": true + } +} diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/phpcs-ruleset.xml b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/phpcs-ruleset.xml new file mode 100644 index 0000000..37d5689 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/phpcs-ruleset.xml @@ -0,0 +1,8 @@ + + + PSR2 without line ending rule - let git manage the EOL cross the platforms + + + + + diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/phpstan.neon b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/phpstan.neon new file mode 100644 index 0000000..a471b0f --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/phpstan.neon @@ -0,0 +1,4 @@ +parameters: + reportUnmatchedIgnoredErrors: false + ignoreErrors: + - '#Unsafe usage of new static#' diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/phpunit.xml.dist b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/phpunit.xml.dist new file mode 100644 index 0000000..1a03a9e --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/phpunit.xml.dist @@ -0,0 +1,22 @@ + + + + + ./tests/ + + + + + src/ + + + diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/AbstractDetector.php b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/AbstractDetector.php new file mode 100644 index 0000000..56fd1fa --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/AbstractDetector.php @@ -0,0 +1,54 @@ +doDetect($filePath); + } +} diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/ExifImageType.php b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/ExifImageType.php new file mode 100644 index 0000000..8082098 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/ExifImageType.php @@ -0,0 +1,43 @@ +getMessage(); + //throw($e); + } + } + return null; + } +} diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/FInfo.php b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/FInfo.php new file mode 100644 index 0000000..1712ad3 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/FInfo.php @@ -0,0 +1,44 @@ +file($filePath); + if ($result === false) { + // false means an error occured + return null; + } else { + $mime = explode('; ', $result); + $result = $mime[0]; + + if (strpos($result, 'image/') === 0) { + return $result; + } else { + return false; + } + } + } + return null; + } +} diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/GetImageSize.php b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/GetImageSize.php new file mode 100644 index 0000000..cc3a2e8 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/GetImageSize.php @@ -0,0 +1,36 @@ + /dev/null; then XDEBUG=xdebug2; else XDEBUG=xdebug; fi + + # Store XDEBUG in github env, so we can access it later through env.XDEBUG + echo "XDEBUG=$XDEBUG" >> $GITHUB_ENV + + echo "Result: ${{ env.XDEBUG }}" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: ${{ env.XDEBUG }} + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key, and for install + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all + + - name: Create coverage badge json + run: | + # Extract total coverage + COVERAGE=$(grep -oP -m 1 'Lines:\s*\K[0-9.%]+' build/coverage.txt) + + # Set COLOR based on COVERAGE + # 0-49%: red, 50%-69%: orange, 70%-80%: yellow, 90%-100%: brightgreen + if grep -oP '(^9\d.)|(^100.)' <<< "$COVERAGE" > /dev/null; then COLOR=brightgreen; elif grep -oP '[87]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=yellow; elif grep -oP '[65]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=orange; else COLOR=red; fi; + + # Generate bagde json + echo \{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"$COVERAGE\",\"color\":\"$COLOR\"\} | tee build/coverage-badge.json + + # PS: If we needed COVERAGE elsewhere, we could store in ENV like this: + # echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV + + - name: Install SSH Key (for deployment of code coverage) + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.DEPLOY_KEY }} + known_hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }} + + - name: Upload code coverage report + run: | + sh -c "rsync -rtog --chown :www-data $GITHUB_WORKSPACE/build/ $DEPLOY_DESTINATION --delete" + env: + DEPLOY_DESTINATION: ${{ secrets.DEPLOY_DESTINATION }} diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/.github/workflows/release.yml b/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/.github/workflows/release.yml new file mode 100644 index 0000000..6f53be3 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/.github/workflows/release.yml @@ -0,0 +1,83 @@ +name: Big test (trigger manually before releasing) + +on: workflow_dispatch + +permissions: + contents: read + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-20.04, ubuntu-18.04, windows-2022, windows-2019, macos-11, macos-10.15] + php: [8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0] + #os: [ubuntu-20.04] + #php: [8.1] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test-no-cov + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/LICENSE b/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/LICENSE new file mode 100644 index 0000000..78457aa --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2018 Bjørn Rosell + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/README.md b/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/README.md new file mode 100644 index 0000000..24b350d --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/README.md @@ -0,0 +1,65 @@ +# Image Mime Type Sniffer + +[![Latest Stable Version](https://img.shields.io/packagist/v/rosell-dk/image-mime-type-sniffer.svg)](https://packagist.org/packages/rosell-dk/image-mime-type-sniffer) +[![Minimum PHP Version](https://img.shields.io/packagist/php-v/rosell-dk/image-mime-type-sniffer)](https://php.net) +[![Build Status](https://github.com/rosell-dk/image-mime-type-sniffer/actions/workflows/php.yml/badge.svg)](https://github.com/rosell-dk/image-mime-type-sniffer/actions/workflows/php.yml) +[![Software License](https://img.shields.io/badge/license-MIT-418677.svg)](https://github.com/rosell-dk/image-mime-type-sniffer/blob/master/LICENSE) +[![Coverage](https://img.shields.io/endpoint?url=https://little-b.it/image-mime-type-sniffer/code-coverage/coverage-badge.json)](http://little-b.it/image-mime-type-sniffer/code-coverage/coverage/index.html) +[![Monthly Downloads](http://poser.pugx.org/rosell-dk/image-mime-type-sniffer/d/monthly)](https://packagist.org/packages/rosell-dk/image-mime-type-sniffer) +[![Dependents](http://poser.pugx.org/rosell-dk/image-mime-type-sniffer/dependents)](https://packagist.org/packages/rosell-dk/image-mime-type-sniffer/dependents?order_by=downloads) + + +Gets mime type of common *image* files by sniffing the file content, looking for signatures. + +The fact that this library limits its ambition to sniff images makes it light and simple. It is also quite fast. Most other sniffers iterates through all common signatures, however this library uses a mix of finite-state machine approach and iteration to achieve a good balance of speed, compactness, simplicity and readability. + +The library recognizes the most widespread image formats, such as GIF, JPEG, WEBP, AVIF, JPEG-2000 and HEIC. + +# Usage + +```php +use \ImageMimeTypeSniffer\ImageMimeTypeSniffer; + +$mimeType = ImageMimeTypeSniffer::detect($fileName); +if (is_null($mimeType)) { + // mimetype was not detected, which means the file is probably not an image (unless it is a rare type) +} else { + // It is an image, and we know the mimeType +} +``` + +PS: An `\Exception` is thrown if the file is unreadable. + +# List of recognized image types: + +- application/psd +- image/avif +- image/bmp +- image/gif +- image/heic +- image/jp2 +- image/jp20 +- image/jpeg +- image/jpm +- image/jpx +- image/png +- image/svg+xml +- image/tiff +- image/webp +- image/x-icon +- video/mj2 + +TODO: image/heif + + +# Alternatives + +I have created a library that uses this library as well as other methods (*finfo*, *exif_imagetype*, etc) for determining image type. You might want to use that instead, to cover all bases. It is available here: [image-mime-type-guesser](https://github.com/rosell-dk/image-mime-type-guesser). + +There are also other PHP mime type sniffers out there: + +- https://github.com/Intervention/mimesniffer +- https://github.com/Tinram/File-Identifier +- https://github.com/shanept/MimeSniffer +- https://github.com/zjsxwc/mime-type-sniffer +- https://github.com/thephpleague/mime-type-detection/tree/main/src diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/composer.json b/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/composer.json new file mode 100644 index 0000000..47cdd2e --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/composer.json @@ -0,0 +1,63 @@ +{ + "name": "rosell-dk/image-mime-type-sniffer", + "description": "Sniff mime type (images only)", + "type": "library", + "license": "MIT", + "keywords": ["mime", "mime type", "image", "images"], + "scripts": { + "ci": [ + "@test", + "@phpcs-all", + "@composer validate --no-check-all --strict", + "@phpstan" + ], + "cs-fix-all": [ + "php-cs-fixer fix src" + ], + "cs-fix": "php-cs-fixer fix", + "cs-dry": "php-cs-fixer fix --dry-run --diff", + "test": "phpunit --coverage-text=build/coverage.txt --coverage-clover=build/coverage.clover --coverage-html=build/coverage --whitelist=src tests", + "test-no-cov": "phpunit --no-coverage tests", + "test2": "phpunit tests", + "phpcs": "phpcs --standard=phpcs-ruleset.xml", + "phpcs-all": "phpcs --standard=phpcs-ruleset.xml src", + "phpcbf": "phpcbf --standard=PSR2", + "phpstan": "vendor/bin/phpstan analyse src --level=4" + }, + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { "ImageMimeTypeSniffer\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "ImageMimeTypeSniffer\\Tests\\": "tests/" } + }, + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "require": { + "php": ">=5.4" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*", + "phpstan/phpstan": "^1.5", + "mikey179/vfsstream": "^1.6" + }, + "config": { + "sort-packages": true + } +} diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/phpcs-ruleset.xml b/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/phpcs-ruleset.xml new file mode 100644 index 0000000..37d5689 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/phpcs-ruleset.xml @@ -0,0 +1,8 @@ + + + PSR2 without line ending rule - let git manage the EOL cross the platforms + + + + + diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/phpunit.xml.dist b/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/phpunit.xml.dist new file mode 100644 index 0000000..b29fdd5 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/phpunit.xml.dist @@ -0,0 +1,8 @@ + + + + + ./tests/ + + + diff --git a/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/src/ImageMimeTypeSniffer.php b/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/src/ImageMimeTypeSniffer.php new file mode 100644 index 0000000..b3b318e --- /dev/null +++ b/is_themecore/vendor/rosell-dk/image-mime-type-sniffer/src/ImageMimeTypeSniffer.php @@ -0,0 +1,177 @@ + tag might be big too... - so we read in 200 extra + $moreBytes = @fread($handle, 200); + if ($moreBytes !== false) { + $sampleBin .= $moreBytes; + } + $binPatterns[] = ['image/svg+xml', "/^(<\?xml[^>]*\?>.*)? /dev/null; then XDEBUG=xdebug2; else XDEBUG=xdebug; fi + + # Store XDEBUG in github env, so we can access it later through env.XDEBUG + echo "XDEBUG=$XDEBUG" >> $GITHUB_ENV + + echo "Result: ${{ env.XDEBUG }}" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: ${{ env.XDEBUG }} + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key, and for install + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all + + - name: Create coverage badge json + run: | + # Extract total coverage + COVERAGE=$(grep -oP -m 1 'Lines:\s*\K[0-9.%]+' build/coverage.txt) + + # Set COLOR based on COVERAGE + # 0-49%: red, 50%-69%: orange, 70%-80%: yellow, 90%-100%: brightgreen + if grep -oP '(^9\d.)|(^100.)' <<< "$COVERAGE" > /dev/null; then COLOR=brightgreen; elif grep -oP '[87]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=yellow; elif grep -oP '[65]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=orange; else COLOR=red; fi; + + # Generate bagde json + echo \{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"$COVERAGE\",\"color\":\"$COLOR\"\} | tee build/coverage-badge.json + + # PS: If we needed COVERAGE elsewhere, we could store in ENV like this: + # echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV + + - name: Install SSH Key (for deployment of code coverage) + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.DEPLOY_KEY }} + known_hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }} + + - name: Upload code coverage report + run: | + sh -c "rsync -rtog --chown :www-data $GITHUB_WORKSPACE/build/ $DEPLOY_DESTINATION --delete" + env: + DEPLOY_DESTINATION: ${{ secrets.DEPLOY_DESTINATION }} diff --git a/is_themecore/vendor/rosell-dk/locate-binaries/.github/workflows/release.yml b/is_themecore/vendor/rosell-dk/locate-binaries/.github/workflows/release.yml new file mode 100644 index 0000000..54ebc66 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/locate-binaries/.github/workflows/release.yml @@ -0,0 +1,84 @@ +name: Big test (trigger manually before releasing) + +on: workflow_dispatch + +permissions: + contents: read + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-20.04, ubuntu-18.04, windows-2022, windows-2019, macos-11, macos-10.15] + #os: [macos-11, macos-10.15, windows-2022, windows-2019] + php: [8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0] + #os: [windows-2022] + #php: [8.1, 7.0] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test-no-cov + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all diff --git a/is_themecore/vendor/rosell-dk/locate-binaries/LICENSE b/is_themecore/vendor/rosell-dk/locate-binaries/LICENSE new file mode 100644 index 0000000..78457aa --- /dev/null +++ b/is_themecore/vendor/rosell-dk/locate-binaries/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2018 Bjørn Rosell + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/is_themecore/vendor/rosell-dk/locate-binaries/README.md b/is_themecore/vendor/rosell-dk/locate-binaries/README.md new file mode 100644 index 0000000..36673e5 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/locate-binaries/README.md @@ -0,0 +1,39 @@ +# Locate Binaries + +[![Build Status](https://github.com/rosell-dk/locate-binaries/workflows/build/badge.svg)](https://github.com/rosell-dk/locate-binaries/actions/workflows/php.yml) +[![Coverage](https://img.shields.io/endpoint?url=https://little-b.it/locate-binaries/code-coverage/coverage-badge.json)](http://little-b.it/locate-binaries/code-coverage/coverage/index.html) +[![Software License](https://img.shields.io/badge/license-MIT-418677.svg)](https://github.com/rosell-dk/locate-binary/blob/master/LICENSE) +[![Latest Stable Version](https://img.shields.io/packagist/v/rosell-dk/locate-binaries.svg)](https://packagist.org/packages/rosell-dk/locate-binaries) +[![Minimum PHP Version](https://img.shields.io/packagist/php-v/rosell-dk/locate-binaries)](https://php.net) + +Just a little class for locating binaries. +You need `exec()`, `shell_exec()` or similar enabled for it to work. Otherwise, it will throw. + +Works on Linux, Windows and Mac. + +## Usage + +To locate installed `cwebp` binaries (found on Linux with `which -a`, falling back to `whereis -b`; on Windows found using `where`): +``` +$cwebBinariesFound = LocateBinaries::locateInstalledBinaries('cwebp'); +``` +Note that you get an array of matches - there may be several versions of a binary on a system. + +The library also adds another method for locating binaries by peeking in common system paths, such as *usr/bin* and `C:\Windows\System32` +However, beware that these dirs could be subject to open_basedir restrictions which can lead to warning entries in the error log. The other method is therefore best. + +Well warned, here it is the alternative, which you in some cases might want to fall back to after trying the first. +``` +$imagickBinariesFound = LocateBinaries::locateInCommonSystemPaths('convert'); +``` + +## Notes +The library uses the [exec-with-fallback](https://github.com/rosell-dk/exec-with-fallback) library in order to be able to use alternatives to exec() when exec() is disabled. + +## Do you like what I do? +Perhaps you want to support my work, so I can continue doing it :) + +- [Become a backer or sponsor on Patreon](https://www.patreon.com/rosell). +- [Buy me a Coffee](https://ko-fi.com/rosell) + +Thanks! diff --git a/is_themecore/vendor/rosell-dk/locate-binaries/composer.json b/is_themecore/vendor/rosell-dk/locate-binaries/composer.json new file mode 100644 index 0000000..c4bdc1c --- /dev/null +++ b/is_themecore/vendor/rosell-dk/locate-binaries/composer.json @@ -0,0 +1,69 @@ +{ + "name": "rosell-dk/locate-binaries", + "description": "Locate a binaries by means of exec() or similar", + "type": "library", + "license": "MIT", + "keywords": ["locate", "binary", "whereis", "which", "discover"], + "scripts": { + "ci": [ + "@test", + "@phpcs-all", + "@composer validate --no-check-all --strict", + "@phpstan" + ], + "phpunit": "phpunit --coverage-text", + "test": "phpunit --coverage-text=build/coverage.txt --coverage-clover=build/coverage.clover --coverage-html=build/coverage --whitelist=src tests", + "test-no-cov": "phpunit --no-coverage tests", + "test-41": "phpunit --no-coverage --configuration 'phpunit-41.xml.dist'", + "test-with-coverage": "phpunit --coverage-text --configuration 'phpunit-with-coverage.xml.dist'", + "test-41-with-coverage": "phpunit --coverage-text --configuration 'phpunit-41.xml.dist'", + "cs-fix-all": [ + "php-cs-fixer fix src" + ], + "cs-fix": "php-cs-fixer fix", + "cs-dry": "php-cs-fixer fix --dry-run --diff", + "phpcs": "phpcs --standard=phpcs-ruleset.xml", + "phpcs-all": "phpcs --standard=phpcs-ruleset.xml src", + "phpcbf": "phpcbf --standard=PSR2", + "phpstan": "vendor/bin/phpstan analyse src --level=4", + "phpstan-global-old": "~/.composer/vendor/bin/phpstan analyse src --level=4", + "phpstan-global": "~/.config/composer/vendor/bin/phpstan analyse src --level=4" + }, + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { "LocateBinaries\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "LocateBinaries\\Tests\\": "tests/" } + }, + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "require": { + "php": ">=5.6", + "rosell-dk/exec-with-fallback": "^1.0.0", + "rosell-dk/file-util": "^0.1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*", + "phpstan/phpstan": "^1.5" + }, + "config": { + "sort-packages": true + } +} diff --git a/is_themecore/vendor/rosell-dk/locate-binaries/phpcs-ruleset.xml b/is_themecore/vendor/rosell-dk/locate-binaries/phpcs-ruleset.xml new file mode 100644 index 0000000..37d5689 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/locate-binaries/phpcs-ruleset.xml @@ -0,0 +1,8 @@ + + + PSR2 without line ending rule - let git manage the EOL cross the platforms + + + + + diff --git a/is_themecore/vendor/rosell-dk/locate-binaries/src/LocateBinaries.php b/is_themecore/vendor/rosell-dk/locate-binaries/src/LocateBinaries.php new file mode 100644 index 0000000..9707cde --- /dev/null +++ b/is_themecore/vendor/rosell-dk/locate-binaries/src/LocateBinaries.php @@ -0,0 +1,163 @@ + + */ +class LocateBinaries +{ + + /** + * Locate binaries by looking in common system paths. + * + * We try a small set of common system paths, such as "/usr/bin". + * On Windows, we only try C:\Windows\System32 + * Note that you do not have to add ".exe" file extension on Windows, it is taken care of + * + * @param string $binary the binary to look for (ie "cwebp") + * + * @return array binaries found in common system locations + */ + public static function locateInCommonSystemPaths($binary) + { + $binaries = []; + + $commonSystemPaths = []; + + if (stripos(PHP_OS, 'WIN') === 0) { + $commonSystemPaths = [ + 'C:\Windows\System32', + ]; + $binary .= '.exe'; + } else { + $commonSystemPaths = [ + '/usr/bin', + '/usr/local/bin', + '/usr/gnu/bin', + '/usr/syno/bin', + '/bin', + ]; + } + + foreach ($commonSystemPaths as $dir) { + // PS: FileExists might throw if exec() or similar is unavailable. We let it. + // - this class assumes exec is available + if (FileExists::fileExistsTryHarder($dir . DIRECTORY_SEPARATOR . $binary)) { + $binaries[] = $dir . DIRECTORY_SEPARATOR . $binary; + } + } + return $binaries; + } + + /** + * Locate installed binaries using ie "whereis -b cwebp" (for Linux, Mac, etc) + * + * @return array Array of paths locateed (possibly empty) + */ + private static function locateBinariesUsingWhereIs($binary) + { + $isMac = (PHP_OS == 'Darwin'); + $command = 'whereis ' . ($isMac ? '' : '-b ') . $binary . ' 2>&1'; + + ExecWithFallback::exec($command, $output, $returnCode); + //echo 'command:' . $command; + //echo 'output:' . print_r($output, true); + + if (($returnCode == 0) && (isset($output[0]))) { + // On linux, result looks like this: + // "cwebp: /usr/bin/cwebp /usr/local/bin/cwebp" + // or, for empty: "cwebp:" + + if ($output[0] == ($binary . ':')) { + return []; + } + + // On mac, it is not prepended with name of binary. + // I don't know if mac returns one result per line or is space seperated + // As I don't know if some systems might return several lines, + // I assume that some do and convert to space-separation: + $result = implode(' ', $output); + + // Next, lets remove the prepended binary (if exists) + $result = preg_replace('#\b' . $binary . ':\s?#', '', $result); + + // And back to array + return explode(' ', $result); + } + return []; + } + + /** + * locate installed binaries using "which -a cwebp" + * + * @param string $binary the binary to look for (ie "cwebp") + * + * @return array Array of paths locateed (possibly empty) + */ + private static function locateBinariesUsingWhich($binary) + { + // As suggested by @cantoute here: + // https://wordpress.org/support/topic/sh-1-usr-local-bin-cwebp-not-found/ + ExecWithFallback::exec('which -a ' . $binary . ' 2>&1', $output, $returnCode); + if ($returnCode == 0) { + return $output; + } + return []; + } + + /** + * Locate binaries using where.exe (for Windows) + * + * @param string $binary the binary to look for (ie "cwebp") + * + * @return array binaries found + */ + private static function locateBinariesUsingWhere($binary) + { + ExecWithFallback::exec('where.exe ' . $binary . ' 2>&1', $output, $returnCode); + if ($returnCode == 0) { + return $output; + } + return []; + } + + /** + * Locate installed binaries + * + * For linuk, we use "which -a" or, if that fails "whereis -b" + * For Windows, we use "where.exe" + * These commands only searces within $PATH. So it only finds installed binaries (which is good, + * as it would be unsafe to deal with binaries found scattered around) + * + * @param string $binary the binary to look for (ie "cwebp") + * + * @return array binaries found + */ + public static function locateInstalledBinaries($binary) + { + if (stripos(PHP_OS, 'WIN') === 0) { + $paths = self::locateBinariesUsingWhere($binary); + if (count($paths) > 0) { + return $paths; + } + } else { + $paths = self::locateBinariesUsingWhich($binary); + if (count($paths) > 0) { + return $paths; + } + + $paths = self::locateBinariesUsingWhereIs($binary); + if (count($paths) > 0) { + return $paths; + } + } + return []; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/.github/FUNDING.yml b/is_themecore/vendor/rosell-dk/webp-convert/.github/FUNDING.yml new file mode 100644 index 0000000..8dd1d30 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: rosell-dk +ko_fi: rosell diff --git a/is_themecore/vendor/rosell-dk/webp-convert/.github/install-gmagick-with-webp.sh b/is_themecore/vendor/rosell-dk/webp-convert/.github/install-gmagick-with-webp.sh new file mode 100644 index 0000000..bab5aa6 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/.github/install-gmagick-with-webp.sh @@ -0,0 +1,74 @@ +# https://duntuk.com/how-install-graphicsmagick-gmagick-php-extension +# https://gist.github.com/basimhennawi/21c39f9758b0b1cb5e0bd5ee08b5be58 +# https://github.com/rosell-dk/webp-convert/wiki/Installing-gmagick-extension + +#if [ -d "$HOME/vips/bin" ]; then +#fi; + + +$HOME/opt/bin/gm -version | grep -i 'WebP.*yes' && { + gmagick_installed_with_webp=1 +} + +if [[ $gmagick_installed_with_webp == 1 ]]; then + echo "Gmagick is already compiled with webp. Nothing to do :)" + echo ":)" +else + echo "Gmagick is is not installed or not compiled with webp." + compile_libwebp=1 + compile_gmagick=1 +fi; +#ls $HOME/opt/bin + + +cores=$(nproc) +LIBWEBP_VERSION=1.0.2 + +if [[ $compile_libwebp == 2 ]]; then + echo "We are going to be compiling libwebp..." + echo "Using $cores cores." + echo "Downloading libwebp version $LIBWEBP_VERSION" + cd /tmp + curl -O https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$LIBWEBP_VERSION.tar.gz + tar xzf libwebp-$LIBWEBP_VERSION.tar.gz + cd libwebp-* + + echo "./configure --prefix=$HOME/opt" + ./configure --prefix=$HOME/opt + + echo "make -j$CORES" + make -j$CORES + + echo "make install -j$CORES" + make install -j$CORES +fi; + +if [[ $compile_gmagick == 2 ]]; then + echo "Compiling Gmagick" + echo "Using $cores cores." + cd /tmp + echo "Downloading GraphicsMagick-LATEST.tar.gz" + wget http://78.108.103.11/MIRROR/ftp/GraphicsMagick/GraphicsMagick-LATEST.tar.gz + tar xfz GraphicsMagick-LATEST.tar.gz + cd GraphicsMagick-* + + echo "Configuring" + ./configure --prefix=$HOME/opt --enable-shared --with-webp=yes + + echo "make -j$CORES" + make -j$CORES + + echo "make install -j$CORES" + make install -j$CORES +fi; + + +#./configure --prefix=$HOME/opt --with-webp=yes && + +#$HOME/opt/bin/gm -version + +#convert -version | grep 'webp' || { + +#convert -list delegate | grep 'webp =>' || { +#} +##libgraphicsmagick1-dev diff --git a/is_themecore/vendor/rosell-dk/webp-convert/.github/install-imagemagick-with-webp.sh b/is_themecore/vendor/rosell-dk/webp-convert/.github/install-imagemagick-with-webp.sh new file mode 100644 index 0000000..5dfc8ba --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/.github/install-imagemagick-with-webp.sh @@ -0,0 +1,40 @@ + +# Install imagick with webp support (if not already there) and update library paths +# Got the script from here: +# https://stackoverflow.com/questions/41138404/how-to-install-newer-imagemagick-with-webp-support-in-travis-ci-container + +if ! [[ $IMAGEMAGICK_VERSION ]]; then + export IMAGEMAGICK_VERSION="7.0.8-43" +fi; + +convert -list delegate | grep 'webp =>' && { + echo "Imagick is already compiled with webp. Nothing to do :)" && + echo ":)" +} + +#convert -version | grep 'webp' || { + +convert -list delegate | grep 'webp =>' || { + export CORES=$(nproc) && + export LIBWEBP_VERSION=1.0.2 && + echo "Using $CORES cores for compiling..." && + cd /tmp && + curl -O https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$LIBWEBP_VERSION.tar.gz && + tar xzf libwebp-$LIBWEBP_VERSION.tar.gz && + cd libwebp-* && + ./configure --prefix=$HOME/opt && + make -j$CORES && + make install -j$CORES && + cd /tmp && + curl -O https://www.imagemagick.org/download/ImageMagick-$IMAGEMAGICK_VERSION.tar.gz && + tar xzf ImageMagick-$IMAGEMAGICK_VERSION.tar.gz && + cd ImageMagick-* && + ./configure --prefix=$HOME/opt --with-webp=yes && + make -j$CORES && + make install -j$CORES && + $HOME/opt/bin/magick -version | grep $IMAGEMAGICK_VERSION +} + +export LD_FLAGS=-L$HOME/opt/lib +export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:$HOME/opt/lib +export CPATH=$CPATH:$HOME/opt/include diff --git a/is_themecore/vendor/rosell-dk/webp-convert/.github/install-vips.sh b/is_themecore/vendor/rosell-dk/webp-convert/.github/install-vips.sh new file mode 100644 index 0000000..ef081c6 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/.github/install-vips.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +if ! [[ $VIPS_VERSION ]]; then + export VIPS_VERSION="8.10.6" +fi; + +export PATH=$HOME/vips/bin:$PATH +export LD_LIBRARY_PATH=$HOME/vips/lib:$LD_LIBRARY_PATH +export PKG_CONFIG_PATH=$HOME/vips/lib/pkgconfig:$PKG_CONFIG_PATH +export PYTHONPATH=$HOME/vips/lib/python2.7/site-packages:$PYTHONPATH +export GI_TYPELIB_PATH=$HOME/vips/lib/girepository-1.0:$GI_TYPELIB_PATH + +vips_site=https://github.com/libvips/libvips/releases/download + +set -e + +# do we already have the correct vips built? early exit if yes +# we could check the configure params as well I guess +if [ -d "$HOME/vips/bin" ]; then + installed_version=$($HOME/vips/bin/vips --version) + escaped_version="${VIPS_VERSION//\./\\.}" + echo "Need vips-$version" + echo "Found $installed_version" + if [[ "$installed_version" =~ ^vips-$escaped_version ]]; then + echo "Using cached directory" + exit 0 + fi +fi + +rm -rf $HOME/vips +echo "wget: $vips_site/v$VIPS_VERSION/vips-$VIPS_VERSION.tar.gz" +wget $vips_site/v$VIPS_VERSION/vips-$VIPS_VERSION.tar.gz +tar xf vips-$VIPS_VERSION.tar.gz +cd vips-$VIPS_VERSION +CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 ./configure --prefix=$HOME/vips --disable-debug --disable-dependency-tracking --disable-introspection --disable-static --enable-gtk-doc-html=no --enable-gtk-doc=no --enable-pyvips8=no --without-orc --without-python +make && make install + +# Install PHP extension +# ---------------------- +yes '' | pecl install vips diff --git a/is_themecore/vendor/rosell-dk/webp-convert/.github/workflows/code-coverage.yml b/is_themecore/vendor/rosell-dk/webp-convert/.github/workflows/code-coverage.yml new file mode 100644 index 0000000..ec773cf --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/.github/workflows/code-coverage.yml @@ -0,0 +1,61 @@ +name: Code Coverage + +on: workflow_dispatch + +jobs: + + codecov: + runs-on: ubuntu-20.04 + env: + WEBPCONVERT_EWWW_API_KEY: ${{ secrets.WEBPCONVERT_EWWW_API_KEY }} + WEBPCONVERT_WPC_API_URL: ${{ secrets.WEBPCONVERT_WPC_API_URL }} + WEBPCONVERT_WPC_API_KEY: ${{ secrets.WEBPCONVERT_WPC_API_KEY }} + WEBPCONVERT_WPC_API_URL_API0: ${{ secrets.WEBPCONVERT_WPC_API_URL_API0 }} + steps: + - name: Checkout + uses: actions/checkout@v2 + +# - name: Setup vips +# run: | +# chmod +x ./.github/install-vips.sh +# ./.github/install-vips.sh + + - name: Setup ffmpeg + uses: FedericoCarboni/setup-ffmpeg@v1 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + # Note: Currently, gmagick and imagick are mutually exclusive. + # It seems they are installed in the order indicated in "extensions" and the latter cancels the former + extensions: exif, mbstring, fileinfo, gd, vips, gmagick, imagick + + - name: Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-codecov-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-codecov- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test-with-coverage + + - name: Upload Scrutinizer coverage + uses: sudo-bot/action-scrutinizer@latest + with: + cli-args: "--format=php-clover build/coverage.clover" diff --git a/is_themecore/vendor/rosell-dk/webp-convert/.github/workflows/php-debug.yml b/is_themecore/vendor/rosell-dk/webp-convert/.github/workflows/php-debug.yml new file mode 100644 index 0000000..551555d --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/.github/workflows/php-debug.yml @@ -0,0 +1,51 @@ +name: Debug + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + php73: + runs-on: ${{ matrix.os }} + env: + WEBPCONVERT_EWWW_API_KEY: ${{ secrets.WEBPCONVERT_EWWW_API_KEY }} + strategy: + fail-fast: true + matrix: + os: [macos-11] + php: [7.3] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: exif, mbstring, fileinfo, gd + + - name: Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php73-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php73- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test diff --git a/is_themecore/vendor/rosell-dk/webp-convert/.github/workflows/php.yml b/is_themecore/vendor/rosell-dk/webp-convert/.github/workflows/php.yml new file mode 100644 index 0000000..cfd3189 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/.github/workflows/php.yml @@ -0,0 +1,131 @@ +name: build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ${{ matrix.os }} + env: + WEBPCONVERT_EWWW_API_KEY: ${{ secrets.WEBPCONVERT_EWWW_API_KEY }} + + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest] + php: [8.1] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup ffmpeg + uses: FedericoCarboni/setup-ffmpeg@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Determine which version of xdebug to use + run: | + # Set XDEBUG to "xdebug2" for PHP 7.2-7.4, but to "xdebug" for + if grep -oP '^7.[234]' <<< "$PHP" > /dev/null; then XDEBUG=xdebug2; else XDEBUG=xdebug; fi + + # Store XDEBUG in github env, so we can access it later through env.XDEBUG + echo "XDEBUG=$XDEBUG" >> $GITHUB_ENV + + echo "Result: ${{ env.XDEBUG }}" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: ${{ env.XDEBUG }} + extensions: exif, mbstring, fileinfo, gd, vips, imagick, gmagick + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key, and for install + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test + + #- name: Run phpstan on PHP>=7.2 (to check php syntax) + # if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + # run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all + + - name: Create coverage badge json + run: | + # Extract total coverage + COVERAGE=$(grep -oP -m 1 'Lines:\s*\K[0-9.%]+' build/coverage.txt) + + # Set COLOR based on COVERAGE + # 0-49%: red, 50%-69%: orange, 70%-80%: yellow, 90%-100%: brightgreen + if grep -oP '(^9\d.)|(^100.)' <<< "$COVERAGE" > /dev/null; then COLOR=brightgreen; elif grep -oP '[87]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=yellow; elif grep -oP '[65]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=orange; else COLOR=red; fi; + + # Generate bagde json + echo \{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"$COVERAGE\",\"color\":\"$COLOR\"\} | tee build/coverage-badge.json + + # PS: If we needed COVERAGE elsewhere, we could store in ENV like this: + # echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV + + - name: Install SSH Key (for deployment of code coverage) + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.DEPLOY_KEY }} + known_hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }} + + - name: Upload code coverage report + run: | + sh -c "rsync -rtog --chown :www-data $GITHUB_WORKSPACE/build/ $DEPLOY_DESTINATION --delete" + env: + DEPLOY_DESTINATION: ${{ secrets.DEPLOY_DESTINATION }} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/.github/workflows/release.yml b/is_themecore/vendor/rosell-dk/webp-convert/.github/workflows/release.yml new file mode 100644 index 0000000..6847aba --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/.github/workflows/release.yml @@ -0,0 +1,186 @@ +name: Big test (trigger manually before releasing) + +on: workflow_dispatch + +permissions: + contents: read + +jobs: + build: + + runs-on: ${{ matrix.os }} + env: + WEBPCONVERT_EWWW_API_KEY: ${{ secrets.WEBPCONVERT_EWWW_API_KEY }} + #WEBPCONVERT_WPC_API_URL: ${{ secrets.WEBPCONVERT_WPC_API_URL }} + #WEBPCONVERT_WPC_API_KEY: ${{ secrets.WEBPCONVERT_WPC_API_KEY }} + #WEBPCONVERT_WPC_API_URL_API0: ${{ secrets.WEBPCONVERT_WPC_API_URL_API0 }} + + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest, ubuntu-20.04, ubuntu-18.04, windows-2022, windows-2019, macos-11, macos-10.15] + php: [8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0] + #php: [8.1, 7.0] + #os: [windows-2022, macos-11] + #os: [windows-2022, windows-2019] + #os: [macos-11] + os: [macos-11, macos-10.15] + #os: [ubuntu-18.04] + #os: [ubuntu-18.04] + #os: [ubuntu-latest] + #os: [ubuntu-18.04,windows-2022, macos-11] + #php: [8.1] + + # For some reason PHP 7.0 testing fails on Windows, so we exclude + exclude: + - os: windows-2019 + php: 7.0 + - os: windows-2022 + php: 7.0 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup ffmpeg + uses: FedericoCarboni/setup-ffmpeg@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + extensions: exif, mbstring, fileinfo, gd, vips, imagick, gmagick + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test-no-cov + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all + + with_disabled_functions: + runs-on: ${{ matrix.os }} + env: + WEBPCONVERT_EWWW_API_KEY: ${{ secrets.WEBPCONVERT_EWWW_API_KEY }} + strategy: + fail-fast: true + matrix: + #os: [ubuntu-18.04,windows-2022, windows-2019, macos-11] + #php: [8.1, 7.1] + os: [ubuntu-18.04] + php: [8.1] + # unfortunately, proc_open is needed by phpunit, so we cannot disable proc_open + disabled_functions: ["exec", "exec,passthru,shell_exec,popen"] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup ffmpeg + uses: FedericoCarboni/setup-ffmpeg@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: exif, mbstring, fileinfo, gd, vips, imagick, gmagick + ini-values: disable_functions="${{ matrix.disabled_functions }}" + + - name: Validate composer.json + run: composer validate --strict + + - name: Remove PHP stan + run: | + echo "Removing phpstan, as we have PHP stan test in other tests" + composer remove phpstan/phpstan --dev --no-update + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-disabled-functions-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-disabled-functions-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-disabled-functions-${{ matrix.php }} + ${{ runner.os }}-php-disabled-functions- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test-no-cov diff --git a/is_themecore/vendor/rosell-dk/webp-convert/BACKERS.md b/is_themecore/vendor/rosell-dk/webp-convert/BACKERS.md new file mode 100644 index 0000000..da4232b --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/BACKERS.md @@ -0,0 +1,32 @@ + +# Backers + +WebP Convert is an MIT-licensed open source project. It is free and always will be. + +How is it financed then? Well, it isn't exactly. However, some people choose to support the development by buying the developer a cup of coffee, and some go even further, by becoming backers. Backers are nice folks making recurring monthly donations, and by doing this, they give me an excuse to put more work into the library than I really should. + +To become a backer yourself, visit [my page at patreon](https://www.patreon.com/rosell) + + +## Active backers via Patron + +| Name | Since date | +| ---------------------- | -------------- | +| Max Kreminsky | 2019-08-02 | +| [Mathieu Gollain-Dupont](https://www.linkedin.com/in/mathieu-gollain-dupont-9938a4a/) | 2020-08-26 | +| Nodeflame | 2019-10-31 | +| Ruben Solvang | 2020-01-08 | + + +Hi-scores: + +| Name | Life time contribution | +| ------------------------ | ------------------------ | +| Tammy Valgardson | $90 | +| Max Kreminsky | $65 | +| Ruben Solvang | $14 | +| Dmitry Verzjikovsky | $5 | + +## Former backers - I'm still grateful :) +- Dmitry Verzjikovsky +- Tammy Valgardson diff --git a/is_themecore/vendor/rosell-dk/webp-convert/LICENSE b/is_themecore/vendor/rosell-dk/webp-convert/LICENSE new file mode 100644 index 0000000..78457aa --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2018 Bjørn Rosell + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/is_themecore/vendor/rosell-dk/webp-convert/README.md b/is_themecore/vendor/rosell-dk/webp-convert/README.md new file mode 100644 index 0000000..b127f6e --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/README.md @@ -0,0 +1,171 @@ +# WebP Convert + +[![Latest Stable Version](https://img.shields.io/packagist/v/rosell-dk/webp-convert.svg)](https://packagist.org/packages/rosell-dk/webp-convert) +[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg)](https://php.net) +[![Build Status](https://img.shields.io/github/workflow/status/rosell-dk/webp-convert/PHP?logo=GitHub)](https://github.com/rosell-dk/webp-convert/actions/workflows/php.yml) +[![Coverage](https://img.shields.io/endpoint?url=https://little-b.it/webp-convert/code-coverage/coverage-badge.json)](http://little-b.it/webp-convert/code-coverage/coverage/index.html) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/rosell-dk/webp-convert/blob/master/LICENSE) +[![Monthly Downloads](http://poser.pugx.org/rosell-dk/webp-convert/d/monthly)](https://packagist.org/packages/rosell-dk/webp-convert) +[![Dependents](http://poser.pugx.org/rosell-dk/webp-convert/dependents)](https://packagist.org/packages/rosell-dk/webp-convert/dependents?order_by=downloads) + +*Convert JPEG & PNG to WebP with PHP* + +This library enables you to do webp conversion with PHP. It supports an abundance of methods for converting and automatically selects the most capable of these that is available on the system. + +The library can convert using the following methods: +- *cwebp* (executing [cwebp](https://developers.google.com/speed/webp/docs/cwebp) binary using an `exec` call) +- *vips* (using [Vips PHP extension](https://github.com/libvips/php-vips-ext)) +- *imagick* (using [Imagick PHP extension](https://github.com/Imagick/imagick)) +- *gmagick* (using [Gmagick PHP extension](https://www.php.net/manual/en/book.gmagick.php)) +- *imagemagick* (executing [imagemagick](https://imagemagick.org/index.php) binary using an `exec` call) +- *graphicsmagick* (executing [graphicsmagick](http://www.graphicsmagick.org/) binary using an `exec` call) +- *ffmpeg* (executing [ffmpeg](https://ffmpeg.org/) binary using an `exec` call) +- *wpc* (using [WebPConvert Cloud Service](https://github.com/rosell-dk/webp-convert-cloud-service/) - an open source webp converter for PHP - based on this library) +- *ewwww* (using the [ewww](https://ewww.io/plans/) cloud converter (1 USD startup and then free webp conversion)) +- *gd* (using the [Gd PHP extension](https://www.php.net/manual/en/book.image.php)) + +In addition to converting, the library also has a method for *serving* converted images, and we have instructions here on how to set up a solution for automatically serving webp images to browsers that supports webp. + +## Installation +Require the library with *Composer*, like this: + +```text +composer require rosell-dk/webp-convert +``` + +## Converting images +Here is a minimal example of converting using the *WebPConvert::convert* method: + +```php +// Initialise your autoloader (this example is using Composer) +require 'vendor/autoload.php'; + +use WebPConvert\WebPConvert; + +$source = __DIR__ . '/logo.jpg'; +$destination = $source . '.webp'; +$options = []; +WebPConvert::convert($source, $destination, $options); +``` + +The *WebPConvert::convert* method comes with a bunch of options. The following introduction is a *must-read*: +[docs/v2.0/converting/introduction-for-converting.md](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md). + +If you are migrating from 1.3.9, [read this](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/migrating-to-2.0.md) + +## Serving converted images +The *WebPConvert::serveConverted* method tries to serve a converted image. If there already is an image at the destination, it will take that, unless the original is newer or smaller. If the method cannot serve a converted image, it will serve original image, a 404, or whatever the 'fail' option is set to. It also adds *X-WebP-Convert-Log* headers, which provides insight into what happened. + +Example (version 2.0): +```php +require 'vendor/autoload.php'; +use WebPConvert\WebPConvert; + +$source = __DIR__ . '/logo.jpg'; +$destination = $source . '.webp'; + +WebPConvert::serveConverted($source, $destination, [ + 'fail' => 'original', // If failure, serve the original image (source). Other options include 'throw', '404' and 'report' + //'show-report' => true, // Generates a report instead of serving an image + + 'serve-image' => [ + 'headers' => [ + 'cache-control' => true, + 'vary-accept' => true, + // other headers can be toggled... + ], + 'cache-control-header' => 'max-age=2', + ], + + 'convert' => [ + // all convert option can be entered here (ie "quality") + ], +]); +``` + +The following introduction is a *must-read* (for 2.0): +[docs/v2.0/serving/introduction-for-serving.md](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/serving/introduction-for-serving.md). + +The old introduction (for 1.3.9) is available here: [docs/v1.3/serving/convert-and-serve.md](https://github.com/rosell-dk/webp-convert/blob/master/docs/v1.3/serving/convert-and-serve.md) + + +## WebP on demand +The library can be used to create a *WebP On Demand* solution, which automatically serves WebP images instead of jpeg/pngs for browsers that supports WebP. To set this up, follow what's described [in this tutorial (not updated for 2.0 yet)](https://github.com/rosell-dk/webp-convert/blob/master/docs/v1.3/webp-on-demand/webp-on-demand.md). + + +## Projects using WebP Convert + +### CMS plugins using WebP Convert +This library is used as the engine to provide webp conversions to a handful of platforms. Hopefully this list will be growing over time. Currently there are plugins / extensions / modules / whatever the term is for the following CMS'es (ordered by [market share](https://w3techs.com/technologies/overview/content_management/all)): + +- [Wordpress](https://github.com/rosell-dk/webp-express) +- [Drupal 7](https://github.com/HDDen/Webp-Drupal-7) +- [Contao](https://github.com/postyou/contao-webp-bundle) +- [Kirby](https://github.com/S1SYPHOS/kirby-webp) +- [October CMS](https://github.com/OFFLINE-GmbH/oc-responsive-images-plugin/) + +### Other projects using WebP Convert + +- [webp-convert-cloud-service](https://github.com/rosell-dk/webp-convert-cloud-service) +A cloud service based on WebPConvert + +- [webp-convert-concat](https://github.com/rosell-dk/webp-convert-concat) +The webp-convert library and its dependents as a single PHP file (or two) + +## Supporting WebP Convert +Bread on the table don't come for free, even though this library does, and always will. I enjoy developing this, and supporting you guys, but I kind of need the bread too. Please make it possible for me to have both: + +- [Become a backer or sponsor on Patreon](https://www.patreon.com/rosell). +- [Buy me a Coffee](https://ko-fi.com/rosell) + +## Supporters +*Persons currently backing the project via patreon - Thanks!* + +- Max Kreminsky +- Nodeflame +- [Mathieu Gollain-Dupont](https://www.linkedin.com/in/mathieu-gollain-dupont-9938a4a/) +- Ruben Solvang + +*Persons who recently contributed with [ko-fi](https://ko-fi.com/rosell) - Thanks!* +* 3 Dec: Dallas +* 29 Nov: tadesco.org +* 20 Nov: Ben J +* 13 Nov: @sween +* 9 Nov: @utrenkner + +*Persons who contributed with extra generously amounts of coffee / lifetime backing (>50$) - thanks!:* + +- Justin - BigScoots ($105) +- Sebastian ($99) +- Tammy Lee ($90) +- Max Kreminsky ($65) +- Steven Sullivan ($51) + +## New in 2.9.0 (released 7 dec 2021, on my daughters 10 years birthday!) +- When exec() is unavailable, alternatives are now tried (emulations with proc_open(), passthru() etc). Using [this library](https://github.com/rosell-dk/exec-with-fallback) to do it. +- Gd is now marked as not operational when the needed functions for converting palette images to RGB is missing. Rationale: A half-working converter causes more trouble than one that is marked as not operational +- Improved CI tests. It is now tested on Windows, Mac and with deactivated functions (such as when exec() is disabled) +- And more (view closed issues [here](https://github.com/rosell-dk/webp-convert/milestone/25?closed=1) + +## New in 2.8.0: +- Converter option definitions are now accessible along with suggested UI and helptexts. This allows one to auto-generate a frontend based on conversion options. The feature is already in use in the [webp-convert file manager](https://github.com/rosell-dk/webp-convert-filemanager), which is used in WebP Express. New method: `WebPConvert::getConverterOptionDefinitions()` +- The part of the log that displays the options are made more readable. It also now warns about deprecated options. +- Bumped image-mime-type guesser library to 0.4. This version is able to dectect more mime types by sniffing the first couple of bytes. +- And more (view closed issues [here](https://github.com/rosell-dk/webp-convert/milestone/23?closed=1) + +## New in 2.7.0: +- ImageMagick now supports the "near-lossless" option (provided Imagick >= 7.0.10-54) [#299](https://github.com/rosell-dk/webp-convert/issues/299) +- Added "try-common-system-paths" option for ImageMagick (default: true). So ImageMagick will now peek for "convert" in common system paths [#293](https://github.com/rosell-dk/webp-convert/issues/293) +- Fixed memory leak in Gd on very old versions of PHP [#264](https://github.com/rosell-dk/webp-convert/issues/264) +- And more (view closed issues [here](https://github.com/rosell-dk/webp-convert/milestone/24?closed=1) + +## New in 2.6.0: +- Introduced [auto-limit](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#auto-limit) option which replaces setting "quality" to "auto" [#281](https://github.com/rosell-dk/webp-convert/issues/281) +- Added "sharp-yuv" option and made it default on. [Its great](https://www.ctrl.blog/entry/webp-sharp-yuv.html), use it! Works in most converters (works in cwebp, vips, imagemagick, graphicsmagick, imagick and gmagick) [#267](https://github.com/rosell-dk/webp-convert/issues/267), [#280](https://github.com/rosell-dk/webp-convert/issues/280), [#284](https://github.com/rosell-dk/webp-convert/issues/284) +- Bumped cwebp binaries to 1.2.0 [#273](https://github.com/rosell-dk/webp-convert/issues/273) +- vips now supports "method" option and "preset" option. +- graphicsmagick now supports "auto-filter" potion +- vips, imagick, imagemagick, graphicsmagick and gmagick now supports "preset" option [#275](https://github.com/rosell-dk/webp-convert/issues/275) +- cwebp now only validates hash of supplied precompiled binaries when necessary. This cuts down conversion time. [#287](https://github.com/rosell-dk/webp-convert/issues/287) +- Added [new option](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#cwebp-skip-these-precompiled-binaries) to cwebp for skipping precompiled binaries that are known not to work on current system. This will cut down on conversion time. [#288](https://github.com/rosell-dk/webp-convert/issues/288) +- And more (view closed issues [here](https://github.com/rosell-dk/webp-convert/milestone/22?closed=1)) diff --git a/is_themecore/vendor/rosell-dk/webp-convert/composer-php56.json b/is_themecore/vendor/rosell-dk/webp-convert/composer-php56.json new file mode 100644 index 0000000..3a767c9 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/composer-php56.json @@ -0,0 +1,75 @@ +{ + "name": "rosell-dk/webp-convert", + "description": "Convert JPEG & PNG to WebP with PHP", + "type": "library", + "license": "MIT", + "keywords": ["webp", "images", "cwebp", "imagick", "gd", "jpg2webp", "png2webp", "jpg", "png", "image conversion"], + "scripts": { + "ci": [ + "@test", + "@phpcs-all", + "@composer validate --no-check-all --strict", + "@phpstan-global" + ], + "test": "phpunit --coverage-text", + "phpunit": "phpunit --coverage-text", + "test-no-cov": "phpunit --no-coverage", + "cs-fix-all": [ + "php-cs-fixer fix src" + ], + "cs-fix": "php-cs-fixer fix", + "cs-dry": "php-cs-fixer fix --dry-run --diff", + "phpcs": "phpcs --standard=PSR2", + "phpcs-all": "phpcs --standard=PSR2 src", + "phpcbf": "phpcbf --standard=PSR2", + "phpstan": "vendor/bin/phpstan analyse src --level=4", + "phpstan-global-old": "~/.composer/vendor/bin/phpstan analyse src --level=4", + "phpstan-global": "~/.config/composer/vendor/bin/phpstan analyse src --level=4" + }, + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { "WebPConvert\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "WebPConvert\\Tests\\": "tests/" } + }, + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + }, + { + "name": "Martin Folkers", + "homepage": "https://twobrain.io", + "role": "Collaborator" + } + ], + "require": { + "php": "^5.6", + "rosell-dk/image-mime-type-guesser": "^0.3" + }, + "suggest": { + "ext-gd": "to use GD extension for converting. Note: Gd must be compiled with webp support", + "ext-imagick": "to use Imagick extension for converting. Note: Gd must be compiled with webp support", + "ext-vips": "to use Vips extension for converting.", + "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "5.7.27", + "squizlabs/php_codesniffer": "3.*" + }, + "config": { + "sort-packages": true + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/composer-php72.json b/is_themecore/vendor/rosell-dk/webp-convert/composer-php72.json new file mode 100644 index 0000000..2135779 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/composer-php72.json @@ -0,0 +1,75 @@ +{ + "name": "rosell-dk/webp-convert", + "description": "Convert JPEG & PNG to WebP with PHP", + "type": "library", + "license": "MIT", + "keywords": ["webp", "images", "cwebp", "imagick", "gd", "jpg2webp", "png2webp", "jpg", "png", "image conversion"], + "scripts": { + "ci": [ + "@test", + "@phpcs-all", + "@composer validate --no-check-all --strict", + "@phpstan-global" + ], + "test": "phpunit --coverage-text", + "phpunit": "phpunit --coverage-text", + "test-no-cov": "phpunit --no-coverage", + "cs-fix-all": [ + "php-cs-fixer fix src" + ], + "cs-fix": "php-cs-fixer fix", + "cs-dry": "php-cs-fixer fix --dry-run --diff", + "phpcs": "phpcs --standard=PSR2", + "phpcs-all": "phpcs --standard=PSR2 src", + "phpcbf": "phpcbf --standard=PSR2", + "phpstan": "vendor/bin/phpstan analyse src --level=4", + "phpstan-global-old": "~/.composer/vendor/bin/phpstan analyse src --level=4", + "phpstan-global": "~/.config/composer/vendor/bin/phpstan analyse src --level=4" + }, + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { "WebPConvert\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "WebPConvert\\Tests\\": "tests/" } + }, + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + }, + { + "name": "Martin Folkers", + "homepage": "https://twobrain.io", + "role": "Collaborator" + } + ], + "require": { + "php": "^7.2", + "rosell-dk/image-mime-type-guesser": "^0.3" + }, + "suggest": { + "ext-gd": "to use GD extension for converting. Note: Gd must be compiled with webp support", + "ext-imagick": "to use Imagick extension for converting. Note: Gd must be compiled with webp support", + "ext-vips": "to use Vips extension for converting.", + "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^8.0", + "squizlabs/php_codesniffer": "3.*" + }, + "config": { + "sort-packages": true + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/composer.json b/is_themecore/vendor/rosell-dk/webp-convert/composer.json new file mode 100644 index 0000000..1515bfe --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/composer.json @@ -0,0 +1,81 @@ +{ + "name": "rosell-dk/webp-convert", + "description": "Convert JPEG & PNG to WebP with PHP", + "type": "library", + "license": "MIT", + "keywords": ["webp", "images", "cwebp", "imagick", "gd", "jpg2webp", "png2webp", "jpg", "png", "image conversion"], + "scripts": { + "ci": [ + "@test", + "@phpcs-all", + "@composer validate --no-check-all --strict", + "@phpstan-global" + ], + "phpunit": "phpunit --coverage-text", + "test": "phpunit --coverage-text=build/coverage.txt --coverage-clover=build/coverage.clover --coverage-html=build/coverage --whitelist=src tests", + "test-41": "phpunit --no-coverage --configuration 'phpunit-41.xml.dist'", + "test-with-coverage": "phpunit --coverage-text --configuration 'phpunit-with-coverage.xml.dist'", + "test-41-with-coverage": "phpunit --coverage-text --configuration 'phpunit-41.xml.dist'", + "test-no-cov": "phpunit --no-coverage tests", + "cs-fix-all": [ + "php-cs-fixer fix src" + ], + "cs-fix": "php-cs-fixer fix", + "cs-dry": "php-cs-fixer fix --dry-run --diff", + "phpcs": "phpcs --standard=phpcs-ruleset.xml", + "phpcs-all": "phpcs --standard=phpcs-ruleset.xml src", + "phpcbf": "phpcbf --standard=PSR2", + "phpstan": "vendor/bin/phpstan analyse src --level=4", + "phpstan-global-old": "~/.composer/vendor/bin/phpstan analyse src --level=4", + "phpstan-global": "~/.config/composer/vendor/bin/phpstan analyse src --level=4" + }, + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { "WebPConvert\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "WebPConvert\\Tests\\": "tests/" } + }, + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + }, + { + "name": "Martin Folkers", + "homepage": "https://twobrain.io", + "role": "Collaborator" + } + ], + "require": { + "php": "^5.6 | ^7.0 | ^8.0", + "rosell-dk/exec-with-fallback": "^1.0.0", + "rosell-dk/image-mime-type-guesser": "^1.1.1", + "rosell-dk/locate-binaries": "^1.0" + }, + "suggest": { + "ext-gd": "to use GD extension for converting. Note: Gd must be compiled with webp support", + "ext-imagick": "to use Imagick extension for converting. Note: Gd must be compiled with webp support", + "ext-vips": "to use Vips extension for converting.", + "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*", + "phpstan/phpstan": "^1.5" + }, + "config": { + "sort-packages": true + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/development.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/development.md new file mode 100644 index 0000000..2e56c49 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/development.md @@ -0,0 +1,79 @@ +# Development + +## Setting up the environment. + +First, clone the repository: +``` +cd whatever/folder/you/want +git clone https://github.com/rosell-dk/webp-convert.git +``` + +Then install the dev tools with composer: + +``` +composer install +``` + +If you don't have composer yet: +- Get it ([download phar](https://getcomposer.org/composer.phar) and move it to /usr/local/bin/composer) +- PS: PHPUnit requires php-xml, php-mbstring and php-curl. To install: `sudo apt install php-xml php-mbstring curl php-curl` + + +## Unit Testing +To run all the unit tests do this: +``` +composer test +``` +This also runs tests on the builds. + + +Individual test files can be executed like this: +``` +composer phpunit tests/Convert/Converters/WPCTest +composer phpunit tests/Serve/ServeConvertedTest +``` + + +## Coding styles +WebPConvert complies with the [PSR-2](https://www.php-fig.org/psr/psr-2/) coding standard. + +To validate coding style of all files, do this: +``` +composer phpcs src +``` + +To automatically fix the coding style of all files, using [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer), do this: +``` +composer phpcbf src +``` + +Or, alternatively, you can fix with the use the [PHP-CS-FIXER](https://github.com/FriendsOfPHP/PHP-CS-Fixer) library instead: +``` +composer cs-fix +``` + +## Running all tests in one command +The following script runs the unit tests, checks the coding styles, validates `composer.json` and runs the builds. +Run this before pushing anything to github. "ci" btw stands for *continuous integration*. +``` +composer ci +``` + +## Generating api docs +Install phpdox and run it in the project root: +``` +phpdox +``` + +## Committing +Before committing, first make sure to: +- run `composer ci` + +## Releasing +Before releasing: +- Update the version number in `Converters/AbstractConverter.php` (search for "WebP Convert") +- Make sure that ci build is successful + +When releasing: +- update the [webp-convert-concat](https://github.com/rosell-dk/webp-convert-concat) library +- consider updating the require in the composer file in libraries that uses webp-convert (ie `webp-convert-cloud-service` and `webp-express`) diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/converting/convert-options.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/converting/convert-options.md new file mode 100644 index 0000000..0dd79de --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/converting/convert-options.md @@ -0,0 +1,322 @@ +# The webp converters + +## The converters at a glance +When it comes to webp conversion, there is actually only one library in town: *libwebp* from Google. All conversion methods below ultimately uses that very same library for conversion. This means that it does not matter much, which conversion method you use. Whatever works. There is however one thing to take note of, if you set *quality* to *auto*, and your system cannot determine the quality of the source (this requires imagick or gmagick), and you do not have access to install those, then the only way to get quality-detection is to connect to a *wpc* cloud converter. However, with *cwebp*, you can specify the desired reduction (the *size-in-percentage* option) - at the cost of doubling the conversion time. Read more about those considerations in the API. + +Speed-wise, there is too little difference for it to matter, considering that images usually needs to be converted just once. Anyway, here are the results: *cweb* is the fastest (with method=3). *gd* is right behind, merely 3% slower than *cwebp*. *gmagick* are third place, ~8% slower than *cwebp*. *imagick* comes in ~22% slower than *cwebp*. *ewww* depends on connection speed. On my *digital ocean* account, it takes ~2 seconds to upload, convert, and download a tiny image (10 times longer than the local *cwebp*). A 1MB image however only takes ~4.5 seconds to upload, convert and download (1.5 seconds longer). A 2 MB image takes ~5 seconds to convert (only 16% longer than my *cwebp*). The *ewww* thus converts at a very decent speeds. Probably faster than your average shared host. If multiple big images needs to be converted at the same time, *ewww* will probably perform much better than the local converters. + +[`cwebp`](#cwebp) works by executing the *cwebp* binary from Google, which is build upon the *libwebp* (also from Google). That library is actually the only library in town for generating webp images, which means that the other conversion methods ultimately uses that very same library. Which again means that the results using the different methods are very similar. However, with *cwebp*, we have more parameters to tweak than with the rest. We for example have the *method* option, which controls the trade off between encoding speed and the compressed file size and quality. Setting this to max, we can squeeze the images a few percent extra - without loosing quality (the converter is still pretty fast, so in most cases it is probably worth it). + +Of course, as we here have to call a binary directly, *cwebp* requires the *exec* function to be enabled, and that the webserver user is allowed to execute the `cwebp` binary (either at known system locations, or one of the precompiled binaries, that comes with this library). + +[`vips`](#vips) (**new in 2.0**) works by using the vips extension, if available. Vips is great! It offers many webp options, it is fast and installation is easier than imagick and gd, as it does not need to be configured for webp support. + +[`imagick`](#imagick) does not support any special webp options, but is at least able to strip all metadata, if metadata is set to none. Imagick has a very nice feature - that it is able to detect the quality of a jpeg file. This enables it to automatically use same quality for destination as for source, which eliminates the risk of setting quality higher for the destination than for source (the result of that is that the file size gets higher, but the quality remains the same). As the other converters lends this capability from Imagick, this is however no reason for using Imagick rather than the other converters. Requirements: Imagick PHP extension compiled with WebP support + +[`gmagick`](#gmagick) uses the *gmagick* extension. It is very similar to *imagick*. Requirements: Gmagick PHP extension compiled with WebP support. + +[`gd`](#gd) uses the *Gd* extension to do the conversion. The *Gd* extension is pretty common, so the main feature of this converter is that it may work out of the box. It does not support any webp options, and does not support stripping metadata. Requirements: GD PHP extension compiled with WebP support. + +[`wpc`](#wpc) is an open source cloud service for converting images to webp. To use it, you must either install [webp-convert-cloud-service](https://github.com/rosell-dk/webp-convert-cloud-service) directly on a remote server, or install the Wordpress plugin, [WebP Express](https://github.com/rosell-dk/webp-express) in Wordpress. Btw: Beware that upload limits will prevent conversion of big images. The converter checks your *php.ini* settings and abandons upload right away, if an image is larger than your *upload_max_filesize* or your *post_max_size* setting. Requirements: Access to a running service. The service can be installed [directly](https://github.com/rosell-dk/webp-convert-cloud-service) or by using [this Wordpress plugin](https://wordpress.org/plugins/webp-express/) + +[`ewww`](#ewww) is also a cloud service. Not free, but cheap enough to be considered *practically* free. It supports lossless encoding, but this cannot be controlled. *Ewww* always uses lossy encoding for jpeg and lossless for png. For jpegs this is usually a good choice, however, many pngs are compressed better using lossy encoding. As lossless cannot be controlled, the "lossless:auto" option cannot be used for automatically trying both lossy and lossless and picking the smallest file. Also, unfortunately, *ewww* does not support quality=auto, like *wpc*, and it does not support *size-in-percentage* like *cwebp*, either. I have requested such features, and he is considering... As with *wpc*, beware of upload limits. Requirements: A key to the *EWWW Image Optimizer* cloud service. Can be purchaced [here](https://ewww.io/plans/) + +[`stack`](#stack) takes a stack of converters and tries it from the top, until success. The main convert method actually calls this converter. Stacks within stacks are supported (not really needed, though). + + +**Summary:** + +| | cwebp | vips | imagick / gmagick | imagickbinary | gd | ewww | +| ------------------------------------------ | --------- | ------ | ----------------- | ------------- | --------- | ------ | +| supports lossless encoding ? | yes | yes | no | no | no | yes | +| supports lossless auto ? | yes | yes | no | no | no | no | +| supports near-lossless ? | yes | yes | no | no | no | ? | +| supports metadata stripping / preserving | yes | yes | yes | no | no | ? | +| supports setting alpha quality | no | yes | no | no | no | no | +| supports fixed quality (for lossy) | yes | yes | yes | yes | yes | yes | +| supports auto quality without help | no | no | yes | yes | no | no | + + + +*WebPConvert* currently supports the following converters: + +| Converter | Method | Requirements | +| ------------------------------------ | ------------------------------------------------ | -------------------------------------------------- | +| [`cwebp`](#cwebp) | Calls `cwebp` binary directly | `exec()` function *and* that the webserver user has permission to run `cwebp` binary | +| [`vips`](#vips) (new in 2.0) | Vips extension | Vips extension | +| [`imagick`](#imagick) | Imagick extension (`ImageMagick` wrapper) | Imagick PHP extension compiled with WebP support | +| [`gmagick`](#gmagick) | Gmagick extension (`ImageMagick` wrapper) | Gmagick PHP extension compiled with WebP support | +| [`gd`](#gd) | GD Graphics (Draw) extension (`LibGD` wrapper) | GD PHP extension compiled with WebP support | +| [`imagickbinary`](#imagickbinary) | Calls imagick binary directly | exec() and imagick installed and compiled with WebP support | +| [`wpc`](#wpc) | Connects to an open source cloud service | Access to a running service. The service can be installed [directly](https://github.com/rosell-dk/webp-convert-cloud-service) or by using [this Wordpress plugin](https://wordpress.org/plugins/webp-express/). +| [`ewww`](#ewww) | Connects to *EWWW Image Optimizer* cloud service | Purchasing a key | + +## Installation +Instructions regarding getting the individual converters to work are [on the wiki](https://github.com/rosell-dk/webp-convert/wiki) + +## cwebp + + + + + + + +
Requirementsexec() function and that the webserver has permission to run `cwebp` binary (either found in system path, or a precompiled version supplied with this library)
Performance~40-120ms to convert a 40kb image (depending on *method* option)
ReliabilityNo problems detected so far!
AvailabilityAccording to ewww docs, requirements are met on surprisingly many webhosts. Look here for a list
General options supportedAll (`quality`, `metadata`, `lossless`)
Extra options`method` (0-6)
`use-nice` (boolean)
`try-common-system-paths` (boolean)
`try-supplied-binary-for-os` (boolean)
`autofilter` (boolean)
`size-in-percentage` (number / null)
`command-line-options` (string)
`low-memory` (boolean)
+ +[cwebp](https://developers.google.com/speed/webp/docs/cwebp) is a WebP conversion command line converter released by Google. Our implementation ships with precompiled binaries for Linux, FreeBSD, WinNT, Darwin and SunOS. If however a cwebp binary is found in a usual location, that binary will be preferred. It is executed with [exec()](http://php.net/manual/en/function.exec.php). + +In more detail, the implementation does this: +- It is tested whether cwebp is available in a common system path (eg `/usr/bin/cwebp`, ..) +- If not, then supplied binary is selected from `Converters/Binaries` (according to OS) - after validating checksum +- Command-line options are generated from the options +- If [`nice`]( https://en.wikipedia.org/wiki/Nice_(Unix)) command is found on host, binary is executed with low priority in order to save system resources +- Permissions of the generated file are set to be the same as parent folder + +### Cwebp options + +The following options are supported, besides the general options (such as quality, lossless etc): + +| Option | Type | Default | +| -------------------------- | ------------------------- | -------------------------- | +| autofilter | boolean | false | +| command-line-options | string | '' | +| low-memory | boolean | false | +| method | integer (0-6) | 6 | +| near-lossless | integer (0-100) | 60 | +| size-in-percentage | integer (0-100) (or null) | null | +| rel-path-to-precompiled-binaries | string | './Binaries' | +| size-in-percentage | number (or null) | is_null | +| try-common-system-paths | boolean | true | +| try-supplied-binary-for-os | boolean | true | +| use-nice | boolean | false | + +Descriptions (only of some of the options): + +#### the `autofilter` option +Turns auto-filter on. This algorithm will spend additional time optimizing the filtering strength to reach a well-balanced quality. Unfortunately, it is extremely expensive in terms of computation. It takes about 5-10 times longer to do a conversion. A 1MB picture which perhaps typically takes about 2 seconds to convert, will takes about 15 seconds to convert with auto-filter. So in most cases, you will want to leave this at its default, which is off. + +#### the `command-line-options` option +This allows you to set any parameter available for cwebp in the same way as you would do when executing *cwebp*. You could ie set it to "-sharpness 5 -mt -crop 10 10 40 40". Read more about all the available parameters in [the docs](https://developers.google.com/speed/webp/docs/cwebp) + +#### the `low-memory` option +Reduce memory usage of lossy encoding at the cost of ~30% longer encoding time and marginally larger output size. Default: `false`. Read more in [the docs](https://developers.google.com/speed/webp/docs/cwebp). Default: *false* + +#### The `method` option +This parameter controls the trade off between encoding speed and the compressed file size and quality. Possible values range from 0 to 6. 0 is fastest. 6 results in best quality. + +#### the `near-lossless` option +Specify the level of near-lossless image preprocessing. This option adjusts pixel values to help compressibility, but has minimal impact on the visual quality. It triggers lossless compression mode automatically. The range is 0 (maximum preprocessing) to 100 (no preprocessing). The typical value is around 60. Read more [here](https://groups.google.com/a/webmproject.org/forum/#!topic/webp-discuss/0GmxDmlexek). Default: 60 + +#### The `size-in-percentage` option +This option sets the file size, *cwebp* should aim for, in percentage of the original. If you for example set it to *45*, and the source file is 100 kb, *cwebp* will try to create a file with size 45 kb (we use the `-size` option). This is an excellent alternative to the "quality:auto" option. If the quality detection isn't working on your system (and you do not have the rights to install imagick or gmagick), you should consider using this options instead. *Cwebp* is generally able to create webp files with the same quality at about 45% the size. So *45* would be a good choice. The option overrides the quality option. And note that it slows down the conversion - it takes about 2.5 times longer to do a conversion this way, than when quality is specified. Default is *off* (null) + + +#### final words on cwebp +The implementation is based on the work of Shane Bishop for his plugin, [EWWW Image Optimizer](https://ewww.io). Thanks for letting us do that! + +See [the wiki](https://github.com/rosell-dk/webp-convert/wiki/Installing-cwebp---using-official-precompilations) for instructions regarding installing cwebp or using official precompilations. + +## vips + + + + + + + +
RequirementsVips extension
PerformanceGreat
ReliabilityNo problems detected so far!
AvailabilityNot that widespread yet, but gaining popularity
General options supportedAll (`quality`, `metadata`, `lossless`)
Extra options`smart-subsample`(boolean)
`alpha-quality`(0-100)
`near-lossless` (0-100)
`preset` (0-6)
+ +For installation instructions, go [here](https://github.com/libvips/php-vips-ext). + +The options are described [here](https://jcupitt.github.io/libvips/API/current/VipsForeignSave.html#vips-webpsave) + +*near-lossless* is however an integer (0-100), in order to have the option behave like in cwebp. + + + +## wpc +*WebPConvert Cloud Service* + + + + + + + + + +
RequirementsAccess to a server with [webp-convert-cloud-service](https://github.com/rosell-dk/webp-convert-cloud-service) installed, cURL and PHP >= 5.5.0
PerformanceDepends on the server where [webp-convert-cloud-service](https://github.com/rosell-dk/webp-convert-cloud-service) is set up, and the speed of internet connections. But perhaps ~1000ms to convert a 40kb image
ReliabilityGreat (depends on the reliability on the server where it is set up)
AvailabilityShould work on almost any webhost
General options supportedAll (`quality`, `metadata`, `lossless`)
Extra options (old api)`url`, `secret`
Extra options (new api)`url`, `api-version`, `api-key`, `crypt-api-key-in-transfer`
+ +[wpc](https://github.com/rosell-dk/webp-convert-cloud-service) is an open source cloud service. You do not buy a key, you set it up on a server, or you set up [the Wordpress plugin](https://wordpress.org/plugins/webp-express/). As WebPConvert Cloud Service itself is based on WebPConvert, all options are supported. + +To use it, you need to set the `converter-options` (to add url etc). + +#### Example, where api-key is not crypted, on new API: + +```php +WebPConvert::convert($source, $destination, [ + 'max-quality' => 80, + 'converters' => ['cwebp', 'wpc'], + 'converter-options' => [ + 'wpc' => [ + 'api-version' => 1, /* from wpc release 1.0.0 */ + 'url' => 'http://example.com/wpc.php', + 'api-key' => 'my dog is white', + 'crypt-api-key-in-transfer' => false + ] + ] +)); +``` + +#### Example, where api-key is crypted: + +```php + +WebPConvert::convert($source, $destination, [ + 'max-quality' => 80, + 'converters' => ['cwebp', 'wpc'], + 'converter-options' => [ + 'wpc' => [ + 'api-version' => 1, + 'url' => 'https://example.com/wpc.php', + 'api-key' => 'my dog is white', + 'crypt-api-key-in-transfer' => true + ], + ] +)); +``` + +In 2.0, you can alternatively set the api key and urls through through the *WPC_API_KEY* and *WPC_API_URL* environment variables. This is a safer place to store it. + +To set an environment variable in Apache, you can use the `SetEnv` directory. Ie, place something like the following in your virtual host / or .htaccess file (replace the key with the one you purchased!) + +``` +SetEnv WPC_API_KEY my-dog-is-dashed +SetEnv WPC_API_URL https://wpc.example.com/wpc.php +``` + + +#### Example, old API: + +```php +WebPConvert::convert($source, $destination, [ + 'max-quality' => 80, + 'converters' => ['cwebp', 'wpc'], + 'converter-options' => [ + 'wpc' => [ + 'url' => 'https://example.com/wpc.php', + 'secret' => 'my dog is white', + ], + ] +)); +``` + + +## ewww + + + + + + + + +
RequirementsValid EWWW Image Optimizer API key, cURL and PHP >= 5.5.0
Performance~1300ms to convert a 40kb image
ReliabilityGreat (but, as with any cloud service, there is a risk of downtime)
AvailabilityShould work on almost any webhost
General options supported`quality`, `metadata` (partly)
Extra options`key`
+ +EWWW Image Optimizer is a very cheap cloud service for optimizing images. After purchasing an API key, add the converter in the `extra-converters` option, with `key` set to the key. Be aware that the `key` should be stored safely to avoid exploitation - preferably in the environment, ie with [dotenv](https://github.com/vlucas/phpdotenv). + +The EWWW api doesn't support the `lossless` option, but it does automatically convert PNG's losslessly. Metadata is either all or none. If you have set it to something else than one of these, all metadata will be preserved. + +In more detail, the implementation does this: +- Validates that there is a key, and that `curl` extension is working +- Validates the key, using the [/verify/ endpoint](https://ewww.io/api/) (in order to [protect the EWWW service from unnecessary file uploads, when key has expired](https://github.com/rosell-dk/webp-convert/issues/38)) +- Converts, using the [/ endpoint](https://ewww.io/api/). + +
+Roadmap 👁 + +The converter could be improved by using `fsockopen` when `cURL` is not available - which is extremely rare. PHP >= 5.5.0 is also widely available (PHP 5.4.0 reached end of life [more than two years ago!](http://php.net/supported-versions.php)). +
+ +#### Example: + +```php +WebPConvert::convert($source, $destination, [ + 'max-quality' => 80, + 'converters' => ['gd', 'ewww'], + 'converter-options' => [ + 'ewww' => [ + 'key' => 'your-api-key-here' + ], + ] +)); +``` +In 2.0, you can alternatively set the api key by through the *EWWW_API_KEY* environment variable. This is a safer place to store it. + +To set an environment variable in Apache, you can use the `SetEnv` directory. Ie, place something like the following in your virtual host / or .htaccess file (replace the key with the one you purchased!) + +``` + SetEnv EWWW_API_KEY sP3LyPpsKWZy8CVBTYegzEGN6VsKKKKA +``` + +## gd + + + + + + + + +
RequirementsGD PHP extension and PHP >= 5.5.0 (compiled with WebP support)
Performance~30ms to convert a 40kb image
ReliabilityNot sure - I have experienced corrupted images, but cannot reproduce
AvailabilityUnfortunately, according to this link, WebP support on shared hosts is rare.
General options supported`quality`
Extra options`skip-pngs`
+ +[imagewebp](http://php.net/manual/en/function.imagewebp.php) is a function that comes with PHP (>5.5.0), *provided* that PHP has been compiled with WebP support. + +`gd` neither supports copying metadata nor exposes any WebP options. Lacking the option to set lossless encoding results in poor encoding of PNGs - the filesize is generally much larger than the original. For this reason, PNG conversion is *disabled* by default, but it can be enabled my setting `skip-pngs` option to `false`. + +Installaition instructions are [available in the wiki](https://github.com/rosell-dk/webp-convert/wiki/Installing-Gd-extension). + +
+Known bugs 👁 +Due to a [bug](https://bugs.php.net/bug.php?id=66590), some versions sometimes created corrupted images. That bug can however easily be fixed in PHP (fix was released [here](https://stackoverflow.com/questions/30078090/imagewebp-php-creates-corrupted-webp-files)). However, I have experienced corrupted images *anyway* (but cannot reproduce that bug). So use this converter with caution. The corrupted images look completely transparent in Google Chrome, but have the correct size. +
+ +## imagick + + + + + + + + + +
RequirementsImagick PHP extension (compiled with WebP support)
QualityPoor. [See this issue]( https://github.com/rosell-dk/webp-convert/issues/43)
General options supported`quality`
Extra optionsNone
Performance~20-320ms to convert a 40kb image
ReliabilityNo problems detected so far
AvailabilityProbably only available on few shared hosts (if any)
+ +WebP conversion with `imagick` is fast and [exposes many WebP options](http://www.imagemagick.org/script/webp.php). Unfortunately, WebP support for the `imagick` extension is pretty uncommon. At least not on the systems I have tried (Ubuntu 16.04 and Ubuntu 17.04). But if installed, it works great and has several WebP options. + +See [this page](https://github.com/rosell-dk/webp-convert/wiki/Installing-Imagick-extension) in the Wiki for instructions on installing the extension. + +## imagickbinary + + + + + + + +
Requirementsexec() function and that imagick is installed on webserver, compiled with webp support
Performancejust fine
ReliabilityNo problems detected so far!
AvailabilityNot sure
General options supported`quality`
Extra options`use-nice` (boolean)
+ +This converter tryes to execute `convert source.jpg webp:destination.jpg.webp`. + +## stack + + + + +
General options supportedall (passed to the converters in the stack )
Extra options`converters` (array) and `converter-options` (array)
+ +Stack implements the functionality you know from `WebPConvert::convert`. In fact, all `WebPConvert::convert` does is to call `Stack::convert($source, $destination, $options, $logger);` + +It has two special options: `converters` and `converter-options`. You can read about those in `docs/api/convert.md` diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/converting/convert.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/converting/convert.md new file mode 100644 index 0000000..b3ed080 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/converting/convert.md @@ -0,0 +1,96 @@ +# API: The convert() method + +**WebPConvert::convert($source, $destination, $options, $logger)** + +| Parameter | Type | Description | +| ---------------- | ------- | ------------------------------------------------------------------------------------------ | +| `$source` | String | Absolute path to source image (only forward slashes allowed) | +| `$destination` | String | Absolute path to converted image (only forward slashes allowed) | +| `$options` (optional) | Array | Array of conversion (option) options | +| `$logger` (optional) | Baselogger | Information about the conversion process will be passed to this object. Read more below | + +Returns true if success or false if no converters are *operational*. If any converter seems to have its requirements met (are *operational*), but fails anyway, and no other converters in the stack could convert the image, an the exception from that converter is rethrown (either *ConverterFailedException* or *ConversionDeclinedException*). Exceptions are also thrown if something is wrong entirely (*InvalidFileExtensionException*, *TargetNotFoundException*, *ConverterNotFoundException*, *CreateDestinationFileException*, *CreateDestinationFolderException*, or any unanticipated exceptions thrown by the converters). + +### Available options for all converters + +Many options correspond to options of *cwebp*. These are documented [here](https://developers.google.com/speed/webp/docs/cwebp) + + +| Option | Type | Default | Description | +| ----------------- | ------- | -------------------------- | -------------------------------------------------------------------- | +| quality | An integer between 0-100, or "auto" | "auto" | Lossy quality of converted image (JPEG only - PNGs are always losless).

If set to "auto", *WebPConvert* will try to determine the quality of the JPEG (this is only possible, if Imagick or GraphicsMagic is installed). If successfully determined, the quality of the webp will be set to the same as that of the JPEG. however not to more than specified in the new `max-quality` option. If quality cannot be determined, quality will be set to what is specified in the new `default-quality` option (however, if you use the *wpc* converter, it will also get a shot at detecting the quality) | +| max-quality | An integer between 0-100 | 85 | See the `quality` option. Only relevant, when quality is set to "auto". +| default-quality | An integer between 0-100 | 75 | See the `quality` option. Only relevant, when quality is set to "auto". +| metadata | String | 'none' | Valid values: all, none, exif, icc, xmp. Note: Only *cwebp* supports all values. *gd* will always remove all metadata. *ewww*, *imagick* and *gmagick* can either strip all, or keep all (they will keep all, unless metadata is set to *none*) | +| lossless | Boolean | false ("auto" for pngs in 2.0) | Encode the image without any loss. The option is ignored for PNG's (forced true). In 2.0, it can also be "auto", and it is not forced to anything - rather it deafaults to false for Jpegs and "auto" for PNGs | +| converters | Array | ['cwebp', 'gd', 'imagick'] | Specify conversion methods to use, and their order. Also optionally set converter options (see below) | +| converter-options | Array | [] | Set options of the individual converters (see below) | +| jpeg | Array | null | These options will be merged into the other options when source is jpeg | +| png | Array | null | These options will be merged into the other options when source is jpeg | +| skip (new in 2.0) | Boolean | false | If true, conversion will be skipped (ie for skipping png conversion for some converters) | +| skip-png (removed in 2.0) | Boolean | false | If true, conversion will be skipped for png (ie for skipping png conversion for some converters) | + +#### More on quality=auto +Unfortunately, *libwebp* does not provide a way to use the same quality for the converted image, as for source. This feature is implemented by *imagick* and *gmagick*. No matter which conversion method you choose, if you set *quality* to *auto*, our library will try to detect the quality of the source file using one of these libraries. If this isn't available, it will revert to the value set in the *default-quality* option (75 per default). *However*, with the *wpc* converter you have a second chance: If quality cannot be detected locally, it will send quality="auto" to *wpc*. + +The bottom line is: If you do not have imagick or gmagick installed on your host (and have no way to install it), your best option quality-wise is to install *wpc* on a server that you do have access to, and connect to that. However,... read on: + +**How much does it matter?** +The effect of not having quality detection is that jpeg images with medium quality (say 50) will be converted with higher quality (say 75). Converting a q=50 to a q=50 would typically result in a ~60% reduction. But converting it to q=75 will only result in a ~45% reduction. When converting low quality jpeg images, it gets worse. Converting q=30 to q=75 only achieves ~25% reduction. + +I guess it is a rare case having jpeg images in low quality. Even having middle quality is rare, as there seems to have been a tendency to choose higher quality than actually needed for web. So, in many cases, the impact of not having quality detection is minor. If you set the *default-quality* a bit low, ie 65, you will further minimize the effect. + +To determine if *webp-convert* is able to autodetect quality on your system, run a conversion with the *$logger* parameter set to `new EchoLogger()` (see api). + +#### More on the `converter-options` option +You use this option to set options for the individual converters. Example: + +``` +'converter-options' => [ + 'ewww' => [ + 'key' => 'your-api-key-here' + ], + 'wpc' => [ + 'url' => 'https://example.com/wpc.php', + 'secret' => 'my dog is white' + ] +] +``` +Besides options that are special to a converter, you can also override general options. For example, you may generally want the `max-quality` to be 85, but for a single converter, you would like it to be 100 (sorry, it is hard to come up with a useful example). + +#### More on the `converters` option +The *converters* option specifies the conversion methods to use and their order. But it can also be used as an alternative way of setting converter options. Usually, you probably want to use the *converter-options* for that, but there may be cases where it is more convenient to specify them here. Also, specifying here allows you to put the same converter method to the stack multiple times, with different options (this could for example be used to have an extra *ewww* converter as a fallback). + +Example: +``` +WebPConvert::convert($source, $destination, [ + 'converters' => [ + 'cwebp', + 'imagick', + [ + 'converter' => 'ewww', + 'options' => [ + 'key' => 'your api key here', + ], + ], + ]; +) +``` +In 2.0, it will be possible to use your own custom converter. Instead of the "converter id" (ie "ewww"), specify the full class name of your custom converter. Ie '\\MyProject\\BraveConverter'. The converter must extend `\WebPConvert\Convert\Converters\AbstractConverters\AbstractConverter` and you must implement `doConvert()` and the define the extra options it takes (check out how it is done in the build-in converters). + +### More on the `$logger` parameter +WebPConvert and the individual converters can provide information regarding the conversion process. Per default (when the parameter isn't provided), they write this to `\WebPConvert\Loggers\VoidLogger`, which does nothing with it. +In order to get this information echoed out, you can use `\WebPConvert\Loggers\EchoLogger` - like this: + +```php +use WebPConvert\Loggers\EchoLogger; + +WebPConvert::convert($source, $destination, $options, new EchoLogger()); +``` + +In order to do something else with the information (perhaps write it to a log file?), you can extend `\WebPConvert\Loggers\BaseLogger`. + +## Converters +In the most basic design, a converter consists of a static convert function which takes the same arguments as `WebPConvert::convert`. Its job is then to convert `$source` to WebP and save it at `$destination`, preferably taking the options specified in $options into account. + +The converters may be called directly. But you probably don't want to do that, as it really doesn't hurt having other converters ready to take over, in case your preferred converter should fail. diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/converting/converters.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/converting/converters.md new file mode 100644 index 0000000..4d9b072 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/converting/converters.md @@ -0,0 +1,322 @@ +# The webp converters + +## The converters at a glance +When it comes to webp conversion, there is actually only one library in town: *libwebp* from Google. All conversion methods below ultimately uses that very same library for conversion. This means that it does not matter much, which conversion method you use. Whatever works. There is however one thing to take note of, if you set *quality* to *auto*, and your system cannot determine the quality of the source (this requires imagick or gmagick), and you do not have access to install those, then the only way to get quality-detection is to connect to a *wpc* cloud converter. However, with *cwebp*, you can specify the desired reduction (the *size-in-percentage* option) - at the cost of doubling the conversion time. Read more about those considerations in the API. + +Speed-wise, there is too little difference for it to matter, considering that images usually needs to be converted just once. Anyway, here are the results: *cweb* is the fastest (with method=3). *gd* is right behind, merely 3% slower than *cwebp*. *gmagick* are third place, ~8% slower than *cwebp*. *imagick* comes in ~22% slower than *cwebp*. *ewww* depends on connection speed. On my *digital ocean* account, it takes ~2 seconds to upload, convert, and download a tiny image (10 times longer than the local *cwebp*). A 1MB image however only takes ~4.5 seconds to upload, convert and download (1.5 seconds longer). A 2 MB image takes ~5 seconds to convert (only 16% longer than my *cwebp*). The *ewww* thus converts at a very decent speeds. Probably faster than your average shared host. If multiple big images needs to be converted at the same time, *ewww* will probably perform much better than the local converters. + +[`cwebp`](#cwebp) works by executing the *cwebp* binary from Google, which is build upon the *libwebp* (also from Google). That library is actually the only library in town for generating webp images, which means that the other conversion methods ultimately uses that very same library. Which again means that the results using the different methods are very similar. However, with *cwebp*, we have more parameters to tweak than with the rest. We for example have the *method* option, which controls the trade off between encoding speed and the compressed file size and quality. Setting this to max, we can squeeze the images a few percent extra - without loosing quality (the converter is still pretty fast, so in most cases it is probably worth it). + +Of course, as we here have to call a binary directly, *cwebp* requires the *exec* function to be enabled, and that the webserver user is allowed to execute the `cwebp` binary (either at known system locations, or one of the precompiled binaries, that comes with this library). + +[`vips`](#vips) (**new in 2.0**) works by using the vips extension, if available. Vips is great! It offers many webp options, it is fast and installation is easier than imagick and gd, as it does not need to be configured for webp support. + +[`imagick`](#imagick) does not support any special webp options, but is at least able to strip all metadata, if metadata is set to none. Imagick has a very nice feature - that it is able to detect the quality of a jpeg file. This enables it to automatically use same quality for destination as for source, which eliminates the risk of setting quality higher for the destination than for source (the result of that is that the file size gets higher, but the quality remains the same). As the other converters lends this capability from Imagick, this is however no reason for using Imagick rather than the other converters. Requirements: Imagick PHP extension compiled with WebP support + +[`gmagick`](#gmagick) uses the *gmagick* extension. It is very similar to *imagick*. Requirements: Gmagick PHP extension compiled with WebP support. + +[`gd`](#gd) uses the *Gd* extension to do the conversion. The *Gd* extension is pretty common, so the main feature of this converter is that it may work out of the box. It does not support any webp options, and does not support stripping metadata. Requirements: GD PHP extension compiled with WebP support. + +[`wpc`](#wpc) is an open source cloud service for converting images to webp. To use it, you must either install [webp-convert-cloud-service](https://github.com/rosell-dk/webp-convert-cloud-service) directly on a remote server, or install the Wordpress plugin, [WebP Express](https://github.com/rosell-dk/webp-express) in Wordpress. Btw: Beware that upload limits will prevent conversion of big images. The converter checks your *php.ini* settings and abandons upload right away, if an image is larger than your *upload_max_filesize* or your *post_max_size* setting. Requirements: Access to a running service. The service can be installed [directly](https://github.com/rosell-dk/webp-convert-cloud-service) or by using [this Wordpress plugin](https://wordpress.org/plugins/webp-express/) + +[`ewww`](#ewww) is also a cloud service. Not free, but cheap enough to be considered *practically* free. It supports lossless encoding, but this cannot be controlled. *Ewww* always uses lossy encoding for jpeg and lossless for png. For jpegs this is usually a good choice, however, many pngs are compressed better using lossy encoding. As lossless cannot be controlled, the "lossless:auto" option cannot be used for automatically trying both lossy and lossless and picking the smallest file. Also, unfortunately, *ewww* does not support quality=auto, like *wpc*, and it does not support *size-in-percentage* like *cwebp*, either. I have requested such features, and he is considering... As with *wpc*, beware of upload limits. Requirements: A key to the *EWWW Image Optimizer* cloud service. Can be purchaced [here](https://ewww.io/plans/) + +[`stack`](#stack) takes a stack of converters and tries it from the top, until success. The main convert method actually calls this converter. Stacks within stacks are supported (not really needed, though). + + +**Summary:** + +| | cwebp | vips | imagickbinary | imagick / gmagick | gd | ewww | +| ------------------------------------------ | --------- | ------ | -------------- | ----------------- | --------- | ------ | +| supports lossless encoding ? | yes | yes | yes | no | no | yes | +| supports lossless auto ? | yes | yes | yes | no | no | no | +| supports near-lossless ? | yes | yes | no | no | no | ? | +| supports metadata stripping / preserving | yes | yes | yes | yes | no | ? | +| supports setting alpha quality | yes | yes | yes | no | no | no | +| supports fixed quality (for lossy) | yes | yes | yes | yes | yes | yes | +| supports auto quality without help | no | no | yes | yes | no | no | + + + +*WebPConvert* currently supports the following converters: + +| Converter | Method | Requirements | +| ------------------------------------ | ------------------------------------------------ | -------------------------------------------------- | +| [`cwebp`](#cwebp) | Calls `cwebp` binary directly | `exec()` function *and* that the webserver user has permission to run `cwebp` binary | +| [`vips`](#vips) (new in 2.0) | Vips extension | Vips extension | +| [`imagick`](#imagick) | Imagick extension (`ImageMagick` wrapper) | Imagick PHP extension compiled with WebP support | +| [`gmagick`](#gmagick) | Gmagick extension (`ImageMagick` wrapper) | Gmagick PHP extension compiled with WebP support | +| [`gd`](#gd) | GD Graphics (Draw) extension (`LibGD` wrapper) | GD PHP extension compiled with WebP support | +| [`imagickbinary`](#imagickbinary) | Calls imagick binary directly | exec() and imagick installed and compiled with WebP support | +| [`wpc`](#wpc) | Connects to an open source cloud service | Access to a running service. The service can be installed [directly](https://github.com/rosell-dk/webp-convert-cloud-service) or by using [this Wordpress plugin](https://wordpress.org/plugins/webp-express/). +| [`ewww`](#ewww) | Connects to *EWWW Image Optimizer* cloud service | Purchasing a key | + +## Installation +Instructions regarding getting the individual converters to work are [on the wiki](https://github.com/rosell-dk/webp-convert/wiki) + +## cwebp + + + + + + + +
Requirementsexec() function and that the webserver has permission to run `cwebp` binary (either found in system path, or a precompiled version supplied with this library)
Performance~40-120ms to convert a 40kb image (depending on *method* option)
ReliabilityNo problems detected so far!
AvailabilityAccording to ewww docs, requirements are met on surprisingly many webhosts. Look here for a list
General options supportedAll (`quality`, `metadata`, `lossless`)
Extra options`method` (0-6)
`use-nice` (boolean)
`try-common-system-paths` (boolean)
`try-supplied-binary-for-os` (boolean)
`autofilter` (boolean)
`size-in-percentage` (number / null)
`command-line-options` (string)
`low-memory` (boolean)
+ +[cwebp](https://developers.google.com/speed/webp/docs/cwebp) is a WebP conversion command line converter released by Google. Our implementation ships with precompiled binaries for Linux, FreeBSD, WinNT, Darwin and SunOS. If however a cwebp binary is found in a usual location, that binary will be preferred. It is executed with [exec()](http://php.net/manual/en/function.exec.php). + +In more detail, the implementation does this: +- It is tested whether cwebp is available in a common system path (eg `/usr/bin/cwebp`, ..) +- If not, then supplied binary is selected from `Converters/Binaries` (according to OS) - after validating checksum +- Command-line options are generated from the options +- If [`nice`]( https://en.wikipedia.org/wiki/Nice_(Unix)) command is found on host, binary is executed with low priority in order to save system resources +- Permissions of the generated file are set to be the same as parent folder + +### Cwebp options + +The following options are supported, besides the general options (such as quality, lossless etc): + +| Option | Type | Default | +| -------------------------- | ------------------------- | -------------------------- | +| autofilter | boolean | false | +| command-line-options | string | '' | +| low-memory | boolean | false | +| method | integer (0-6) | 6 | +| near-lossless | integer (0-100) | 60 | +| size-in-percentage | integer (0-100) (or null) | null | +| rel-path-to-precompiled-binaries | string | './Binaries' | +| size-in-percentage | number (or null) | is_null | +| try-common-system-paths | boolean | true | +| try-supplied-binary-for-os | boolean | true | +| use-nice | boolean | false | + +Descriptions (only of some of the options): + +#### the `autofilter` option +Turns auto-filter on. This algorithm will spend additional time optimizing the filtering strength to reach a well-balanced quality. Unfortunately, it is extremely expensive in terms of computation. It takes about 5-10 times longer to do a conversion. A 1MB picture which perhaps typically takes about 2 seconds to convert, will takes about 15 seconds to convert with auto-filter. So in most cases, you will want to leave this at its default, which is off. + +#### the `command-line-options` option +This allows you to set any parameter available for cwebp in the same way as you would do when executing *cwebp*. You could ie set it to "-sharpness 5 -mt -crop 10 10 40 40". Read more about all the available parameters in [the docs](https://developers.google.com/speed/webp/docs/cwebp) + +#### the `low-memory` option +Reduce memory usage of lossy encoding at the cost of ~30% longer encoding time and marginally larger output size. Default: `false`. Read more in [the docs](https://developers.google.com/speed/webp/docs/cwebp). Default: *false* + +#### The `method` option +This parameter controls the trade off between encoding speed and the compressed file size and quality. Possible values range from 0 to 6. 0 is fastest. 6 results in best quality. + +#### the `near-lossless` option +Specify the level of near-lossless image preprocessing. This option adjusts pixel values to help compressibility, but has minimal impact on the visual quality. It triggers lossless compression mode automatically. The range is 0 (maximum preprocessing) to 100 (no preprocessing). The typical value is around 60. Read more [here](https://groups.google.com/a/webmproject.org/forum/#!topic/webp-discuss/0GmxDmlexek). Default: 60 + +#### The `size-in-percentage` option +This option sets the file size, *cwebp* should aim for, in percentage of the original. If you for example set it to *45*, and the source file is 100 kb, *cwebp* will try to create a file with size 45 kb (we use the `-size` option). This is an excellent alternative to the "quality:auto" option. If the quality detection isn't working on your system (and you do not have the rights to install imagick or gmagick), you should consider using this options instead. *Cwebp* is generally able to create webp files with the same quality at about 45% the size. So *45* would be a good choice. The option overrides the quality option. And note that it slows down the conversion - it takes about 2.5 times longer to do a conversion this way, than when quality is specified. Default is *off* (null) + + +#### final words on cwebp +The implementation is based on the work of Shane Bishop for his plugin, [EWWW Image Optimizer](https://ewww.io). Thanks for letting us do that! + +See [the wiki](https://github.com/rosell-dk/webp-convert/wiki/Installing-cwebp---using-official-precompilations) for instructions regarding installing cwebp or using official precompilations. + +## vips + + + + + + + +
RequirementsVips extension
PerformanceGreat
ReliabilityNo problems detected so far!
AvailabilityNot that widespread yet, but gaining popularity
General options supportedAll (`quality`, `metadata`, `lossless`)
Extra options`smart-subsample`(boolean)
`alpha-quality`(0-100)
`near-lossless` (0-100)
`preset` (0-6)
+ +For installation instructions, go [here](https://github.com/libvips/php-vips-ext). + +The options are described [here](https://jcupitt.github.io/libvips/API/current/VipsForeignSave.html#vips-webpsave) + +*near-lossless* is however an integer (0-100), in order to have the option behave like in cwebp. + + + +## wpc +*WebPConvert Cloud Service* + + + + + + + + + +
RequirementsAccess to a server with [webp-convert-cloud-service](https://github.com/rosell-dk/webp-convert-cloud-service) installed, cURL and PHP >= 5.5.0
PerformanceDepends on the server where [webp-convert-cloud-service](https://github.com/rosell-dk/webp-convert-cloud-service) is set up, and the speed of internet connections. But perhaps ~1000ms to convert a 40kb image
ReliabilityGreat (depends on the reliability on the server where it is set up)
AvailabilityShould work on almost any webhost
General options supportedAll (`quality`, `metadata`, `lossless`)
Extra options (old api)`url`, `secret`
Extra options (new api)`url`, `api-version`, `api-key`, `crypt-api-key-in-transfer`
+ +[wpc](https://github.com/rosell-dk/webp-convert-cloud-service) is an open source cloud service. You do not buy a key, you set it up on a server, or you set up [the Wordpress plugin](https://wordpress.org/plugins/webp-express/). As WebPConvert Cloud Service itself is based on WebPConvert, all options are supported. + +To use it, you need to set the `converter-options` (to add url etc). + +#### Example, where api-key is not crypted, on new API: + +```php +WebPConvert::convert($source, $destination, [ + 'max-quality' => 80, + 'converters' => ['cwebp', 'wpc'], + 'converter-options' => [ + 'wpc' => [ + 'api-version' => 1, /* from wpc release 1.0.0 */ + 'url' => 'http://example.com/wpc.php', + 'api-key' => 'my dog is white', + 'crypt-api-key-in-transfer' => false + ] + ] +)); +``` + +#### Example, where api-key is crypted: + +```php + +WebPConvert::convert($source, $destination, [ + 'max-quality' => 80, + 'converters' => ['cwebp', 'wpc'], + 'converter-options' => [ + 'wpc' => [ + 'api-version' => 1, + 'url' => 'https://example.com/wpc.php', + 'api-key' => 'my dog is white', + 'crypt-api-key-in-transfer' => true + ], + ] +)); +``` + +In 2.0, you can alternatively set the api key and urls through through the *WPC_API_KEY* and *WPC_API_URL* environment variables. This is a safer place to store it. + +To set an environment variable in Apache, you can use the `SetEnv` directory. Ie, place something like the following in your virtual host / or .htaccess file (replace the key with the one you purchased!) + +``` +SetEnv WPC_API_KEY my-dog-is-dashed +SetEnv WPC_API_URL https://wpc.example.com/wpc.php +``` + + +#### Example, old API: + +```php +WebPConvert::convert($source, $destination, [ + 'max-quality' => 80, + 'converters' => ['cwebp', 'wpc'], + 'converter-options' => [ + 'wpc' => [ + 'url' => 'https://example.com/wpc.php', + 'secret' => 'my dog is white', + ], + ] +)); +``` + + +## ewww + + + + + + + + +
RequirementsValid EWWW Image Optimizer API key, cURL and PHP >= 5.5.0
Performance~1300ms to convert a 40kb image
ReliabilityGreat (but, as with any cloud service, there is a risk of downtime)
AvailabilityShould work on almost any webhost
General options supported`quality`, `metadata` (partly)
Extra options`key`
+ +EWWW Image Optimizer is a very cheap cloud service for optimizing images. After purchasing an API key, add the converter in the `extra-converters` option, with `key` set to the key. Be aware that the `key` should be stored safely to avoid exploitation - preferably in the environment, ie with [dotenv](https://github.com/vlucas/phpdotenv). + +The EWWW api doesn't support the `lossless` option, but it does automatically convert PNG's losslessly. Metadata is either all or none. If you have set it to something else than one of these, all metadata will be preserved. + +In more detail, the implementation does this: +- Validates that there is a key, and that `curl` extension is working +- Validates the key, using the [/verify/ endpoint](https://ewww.io/api/) (in order to [protect the EWWW service from unnecessary file uploads, when key has expired](https://github.com/rosell-dk/webp-convert/issues/38)) +- Converts, using the [/ endpoint](https://ewww.io/api/). + +
+Roadmap 👁 + +The converter could be improved by using `fsockopen` when `cURL` is not available - which is extremely rare. PHP >= 5.5.0 is also widely available (PHP 5.4.0 reached end of life [more than two years ago!](http://php.net/supported-versions.php)). +
+ +#### Example: + +```php +WebPConvert::convert($source, $destination, [ + 'max-quality' => 80, + 'converters' => ['gd', 'ewww'], + 'converter-options' => [ + 'ewww' => [ + 'key' => 'your-api-key-here' + ], + ] +)); +``` +In 2.0, you can alternatively set the api key by through the *EWWW_API_KEY* environment variable. This is a safer place to store it. + +To set an environment variable in Apache, you can use the `SetEnv` directory. Ie, place something like the following in your virtual host / or .htaccess file (replace the key with the one you purchased!) + +``` + SetEnv EWWW_API_KEY sP3LyPpsKWZy8CVBTYegzEGN6VsKKKKA +``` + +## gd + + + + + + + + +
RequirementsGD PHP extension and PHP >= 5.5.0 (compiled with WebP support)
Performance~30ms to convert a 40kb image
ReliabilityNot sure - I have experienced corrupted images, but cannot reproduce
AvailabilityUnfortunately, according to this link, WebP support on shared hosts is rare.
General options supported`quality`
Extra options`skip-pngs`
+ +[imagewebp](http://php.net/manual/en/function.imagewebp.php) is a function that comes with PHP (>5.5.0), *provided* that PHP has been compiled with WebP support. + +`gd` neither supports copying metadata nor exposes any WebP options. Lacking the option to set lossless encoding results in poor encoding of PNGs - the filesize is generally much larger than the original. For this reason, PNG conversion is *disabled* by default, but it can be enabled my setting `skip-pngs` option to `false`. + +Installaition instructions are [available in the wiki](https://github.com/rosell-dk/webp-convert/wiki/Installing-Gd-extension). + +
+Known bugs 👁 +Due to a [bug](https://bugs.php.net/bug.php?id=66590), some versions sometimes created corrupted images. That bug can however easily be fixed in PHP (fix was released [here](https://stackoverflow.com/questions/30078090/imagewebp-php-creates-corrupted-webp-files)). However, I have experienced corrupted images *anyway* (but cannot reproduce that bug). So use this converter with caution. The corrupted images look completely transparent in Google Chrome, but have the correct size. +
+ +## imagick + + + + + + + + + +
RequirementsImagick PHP extension (compiled with WebP support)
QualityPoor. [See this issue]( https://github.com/rosell-dk/webp-convert/issues/43)
General options supported`quality`
Extra optionsNone
Performance~20-320ms to convert a 40kb image
ReliabilityNo problems detected so far
AvailabilityProbably only available on few shared hosts (if any)
+ +WebP conversion with `imagick` is fast and [exposes many WebP options](http://www.imagemagick.org/script/webp.php). Unfortunately, WebP support for the `imagick` extension is pretty uncommon. At least not on the systems I have tried (Ubuntu 16.04 and Ubuntu 17.04). But if installed, it works great and has several WebP options. + +See [this page](https://github.com/rosell-dk/webp-convert/wiki/Installing-Imagick-extension) in the Wiki for instructions on installing the extension. + +## imagickbinary + + + + + + + +
Requirementsexec() function and that imagick is installed on webserver, compiled with webp support
Performancejust fine
ReliabilityNo problems detected so far!
AvailabilityNot sure
General options supported`quality`
Extra options`use-nice` (boolean)
+ +This converter tryes to execute `convert source.jpg webp:destination.jpg.webp`. + +## stack + + + + +
General options supportedall (passed to the converters in the stack )
Extra options`converters` (array) and `converter-options` (array)
+ +Stack implements the functionality you know from `WebPConvert::convert`. In fact, all `WebPConvert::convert` does is to call `Stack::convert($source, $destination, $options, $logger);` + +It has two special options: `converters` and `converter-options`. You can read about those in `docs/api/convert.md` diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/serving/convert-and-serve.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/serving/convert-and-serve.md new file mode 100644 index 0000000..96a673f --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/serving/convert-and-serve.md @@ -0,0 +1,167 @@ +# API: The WebPConvert::convertAndServe() method + +*NOTE:* In 2.0, the method is renamed to *serveConverted* ("convertAndServe" was implying that a conversion was always made, but the method simply serves destination if it exists and is smaller and newer than source) + +The method tries to serve a converted image. If destination already exists, the already converted image will be served. Unless the original is newer or smaller. If the method fails, it will serve original image, a 404, or whatever the 'fail' option is set to. + +**WebPConvert::convertAndServe($source, $destination, $options)** + +| Parameter | Type | Description | +| ---------------- | ------- | ------------------------------------------------------------------- | +| `$source` | String | Absolute path to source image (only forward slashes allowed) | +| `$destination` | String | Absolute path to converted image (only forward slashes allowed) | +| `$options` | Array | Array of options (see below) | + +## The *$options* argument +The options argument is a named array. Besides the options described below, you can also use any options that the *convert* method takes (if a fresh convertion needs to be created, this method will call the *convert* method and hand over the options argument) + +### *convert* +Conversion options, handed over to the convert method, in case a conversion needs to be made. The convert options are documented [here](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md). + +### *fail* +Indicate what to do, in case of normal conversion failure. +Default value: *"original"* + +| Possible values | Meaning | +| ----------------- | ----------------------------------------------- | +| "serve-original" | Serve the original image. | +| "404" | Serve 404 status (not found) | +| "report-as-image" | Serve an image with text explaining the problem | +| "report" | Serve a textual report explaining the problem | + +### *fail-when-original-unavailable* +Possible values: Same as above, except that "original" is not an option. +Default value: *"404"* + +### *show-report* +Produce a report rather than serve an image. +Default value: *false* + +### *reconvert* +Force a conversion, discarding existing converted image (if any). +Default value: *false* + +### *serve-original* +Forces serving original image. This will skip conversion. +Default value: *false* + +### *add-x-header-status* +When set to *true*, a *X-WebP-Convert-Status* header will be added describing how things went. +Default value: *true* + +Depending on how things goes, the header will be set to one of the following: +- "Failed (missing source argument)" +- "Failed (source not found)"" +- "Failed (missing destination argument)" +- "Reporting..." +- "Serving original image (was explicitly told to)" +- "Serving original image - because it is smaller than the converted!" +- "Serving freshly converted image (the original had changed)" +- "Serving existing converted image" +- "Converting image (handed over to WebPConvertAndServe)" +- "Serving freshly converted image" +- "Failed (could not convert image)" + +### *add-vary-header* +Add a "Vary: Accept" header when an image is served. Experimental. +Default value: *true* + +### *add-content-type-header* +Add a "Content-Type" header +Default value: *true* +If set, a *Content-Type* header will be added. It will be set to "image/webp" if a converted image is served, "image/jpeg" or "image/png", if the original is served or "image/gif", if an error message is served (as image). You can set it to false when debugging (to check if any errors are being outputted) + +### *add-last-modified-header* +Add a "Last-Modified" header +Default value: *true* +If set, a *Last-Modified* header will be added. When a cached image is served, it will be set to the modified time of the converted file. When a fresh image is served, it is set to current time. + +### *cache-control-header* +Specify a cache control header, which will be served when caching is appropriate. +Default value: "public, max-age=86400" (1 day) +Caching is "deemed appropriate", when destination is served, source is served, because it is lighter or a fresh conversion is made, due to there not being any converted image at the destination yet. Caching is not deemed appropriate when something fails, a report is requested, or the *reconvert* option have been set. Note: in version 1.3.2 and below, the *serve-original* option also prevented caching, but it no longer does. previous In those cases, standard headers will be used for preventing caching. +For your convenience, here is a little table: + +| duration | max-age | +| -------- | ---------------- | +| 1 second | max-age=1 | +| 1 minute | max-age=60 | +| 1 hour | max-age=3600 | +| 1 day | max-age=86400 | +| 1 week | max-age=604800 | +| 1 month | max-age=2592000 | +| 1 year | max-age=31536000 | + +To learn about the options for the Cache-Control header, go [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) + +### *error-reporting* +Set error reporting +Allowed values: *"auto"*, *"dont-mess"*, *true*, *false* +Default value: *"auto"* + +If set to true, error reporting will be turned on, like this: +``` + error_reporting(E_ALL); + ini_set('display_errors', 'On'); +``` + +If set to false, error reporting will be turned off, like this: +``` + error_reporting(0); + ini_set('display_errors', 'Off'); +``` +If set to "auto", errors will be turned off, unless the `show-report` option is set, in which case errors will be turned off. +If set to "dont-mess", error reporting will not be touched. + +### *aboutToServeImageCallBack* +This callback is called right before response headers and image is served. This is a great chance to adding headers. You can stop the image and the headers from being served by returning *false*. + +**Arguments:** +The first argument to the callback contains a string that tells what is about to be served. It can be 'fresh-conversion', 'destination' or 'source'. + +The second argument tells you why that is served. It can be one of the following: +for 'source': +- "explicitly-told-to" (when the "serve-original" option is set) +- "source-lighter" (when original image is actually smaller than the converted) + +for 'fresh-conversion': +- "explicitly-told-to" (when the "reconvert" option is set) +- "source-modified" (when source is newer than existing) +- "no-existing" (when there is no existing at the destination) + +for 'destination': +- "no-reason-not-to" (it is lighter than source, its not older, and we were not told to do otherwise) + +Example of callback: +``` +function aboutToServeImageCallBack($servingWhat, $whyServingThis, $obj) +{ + echo 'about to serve: ' . $servingWhat . '
'; + echo 'Why? - because: ' . $whyServingThis; + return false; // Do not serve! (this also prevents any response headers from being added) +} +``` + +### *aboutToPerformFailActionCallback* +This callback is called right before doing the action specified in the `fail` option, or the `fail-when-original-unavailable` option. You can stop the fail action from being executod by returning *false*. + +Documentation by example: +``` +function aboutToPerformFailActionCallback($errorTitle, $errorDescription, $actionAboutToBeTaken, $serveConvertedObj) +{ + echo '

' . $errorTitle . '

'; + echo $errorDescription; + if (actionAboutToBeTaken == '404') { + // handle 404 differently than webp-convert would + $protocol = isset($_SERVER["SERVER_PROTOCOL"]) ? $_SERVER["SERVER_PROTOCOL"] : 'HTTP/1.0'; + $serveConvertedObj->header($protocol . " 404 Not Found. We take this very seriously. Heads will roll."); + + return false; // stop webp-convert from doing what it would do + } + +} +``` + +### *require-for-conversion* +If set, makes the library 'require in' a file just before doing an actual conversion with `ConvertAndServe::convertAndServe()`. This is not needed for composer projects, as composer takes care of autoloading classes when needed. +Default value: *null* diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/webp-on-demand/tweaks.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/webp-on-demand/tweaks.md new file mode 100644 index 0000000..56e2acf --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/webp-on-demand/tweaks.md @@ -0,0 +1,167 @@ +# Tweaks + +## Store converted images in separate folder + +In most cases, you probably want the cache of converted images to be stored in their own folder rather than have them mingled with the source files. + +To have have the cache folder contain a file structure mirroring the structure of the original files, you can do this: + +```php +$applicationRoot = $_SERVER["DOCUMENT_ROOT"]; // If your application is not in document root, you can change accordingly. +$imageRoot = $applicationRoot . '/webp-images'; // Change to where you want the webp images to be saved +$sourceRel = substr($source, strlen($applicationRoot)); +$destination = $imageRoot . $sourceRel . '.webp'; +``` + +If your images are stored outside document root (a rare case), you can simply use the complete absolute path: +```php +$destination = $imageRoot . $source . '.webp'; // pst: $source is an absolute path, and starts with '/' +``` +This will ie store a converted image in */var/www/example.com/public_html/app/webp-images/var/www/example.com/images/logo.jpg.webp* + +If your application can be configured to store outside document root, but rarely is, you can go for this structure: + +```php +$docRoot = $_SERVER["DOCUMENT_ROOT"]; +$imageRoot = $contentDirAbs . '/webp-images'; + +if (substr($source, 0, strlen($docRoot)) === $docRoot) { + // Source file is residing inside document root. + // We can store relative to that. + $sourceRel = substr($source, strlen($docRoot)); + $destination = $imageRoot . '/doc-root' . $sourceRel . '.webp'; +} else { + // Source file is residing outside document root. + // we must add complete path to structure + $destination = $imageRoot . '/abs' . $source . '.webp'; +} +``` + +If you do not know the application root beforehand, and thus do not know the appropriate root for the converted images, see next tweak. + + +## Get the application root automatically +When you want destination files to be put in their own folder, you need to know the root of the application (the folder in which the .htaccess rules resides). In most applications, you know the root. In many cases, it is simply the document root. However, if you are writing an extension, plugin or module to a framework that can be installed in a subfolder, you may have trouble finding it. Many applications have a *index.php* in the root, which can get it with `__DIR__`. However, you do not want to run an entire bootstrap each time you serve an image. Obviously, to get around this, you can place *webp-on-demand.php* in the webroot. However, some frameworks, such as Wordpress, will not allow a plugin to put a file in the root. Now, how could we determine the application root from a file inside some subdir? Here are three suggestions: + +1. You could traverse parent folders until you find a file you expect to be in application root (ie a .htaccess containing the string "webp-on-demand.php"). This should work. +2. If the rules in the *.htaccess* file are generated by your application, you probably have access to the path at generation time. You can then simply put the path in the *.htaccess*, as an extra parameter to the script (or better: the relative path from document root to the application). +3. You can use the following hack: + +### The hack +The idea is to grab the URL path of the image in the *.htaccess* and pass it to the script. Assuming that the URL paths always matches the file paths, we can get the application root by subtracting that relative path to source from the absolute path to source. + +In *.htaccess*, we grab the url-path by appending "&url-path=$1.$2" to the rewrite rule: +``` +RewriteRule ^(.*)\.(jpe?g|png)$ webp-on-demand.php?source=%{SCRIPT_FILENAME}&url-path=$1.$2 [NC,L] +``` + +In the script, we can then calculate the application root like this: + +```php +$applicationRoot = substr($_GET['source'], 0, -strlen($_GET['url-path'])); +``` + +## CDN +To work properly with a CDN, a "Vary Accept" header should be added when serving images. This is a declaration that the response varies with the *Accept* header (recall that we inspect *Accept* header in the .htaccess to determine if the browsers supports webp images). If this header is missing, the CDN will see no reason to cache separate images depending on the Accept header. + +Add this snippet to the *.htaccess* to make webp-on-demand work with CDN's: + +``` + + SetEnvIf Request_URI "\.(jpe?g|png)" ADDVARY + + # Declare that the response varies depending on the accept header. + # The purpose is to make CDN cache both original images and converted images. + Header append "Vary" "Accept" env=ADDVARY + +``` + +***Note:*** When configuring the CDN, you must make sure to set it up to forward the the "Accept" header to your origin server. + + + +## Make .htaccess route directly to existing images + +There may be a performance benefit of using the *.htaccess* file to route to already converted images, instead of letting the PHP script serve it. Note however: +- If you do the routing in .htaccess, the solution will not be able to discard converted images when original images are updated. +- Performance benefit may be insignificant (*WebPConvertAndServe* class is not autoloaded when serving existing images) + +Add the following to the *.htaccess* to make it route to existing converted images. Place it above the # Redirect images to webp-on-demand.php" comment. Take care of replacing [[your-base-path]] with the directory your *.htaccess* lives in (relative to document root, and [[your-destination-root]] with the directory the converted images resides. +``` + # Redirect to existing converted image (under appropriate circumstances) + RewriteCond %{HTTP_ACCEPT} image/webp + RewriteCond %{DOCUMENT_ROOT}/[[your-base-path]]/[[your-destination-root]]/$1.$2.webp -f + RewriteRule ^\/?(.*)\.(jpe?g|png)$ /[[your-base-path]]/[[your-destination-root]]/$1.$2.webp [NC,T=image/webp,L] +``` +*edit:* Removed the QSD flag from the RewriteRule because it is not supported in Apache < 2.4 (and it [triggers error](https://github.com/rosell-dk/webp-express/issues/155)) + +### Redirect with CDN support +If you are using a CDN, and want to redirect to existing images with the .htaccess, it is a good idea to add a "Vary Accept" header. This instructs the CDN that the response varies with the *Accept* header (we do not need to do that when routing to webp-on-demand.php, because the script takes care of adding this header, when appropriate.) + +You can achieve redirect with CDN support with the following rules: +``` + + + RewriteEngine On + + # Redirect to existing converted image (under appropriate circumstances) + RewriteCond %{HTTP_ACCEPT} image/webp + RewriteCond %{DOCUMENT_ROOT}/[[your-base-path]]/[[your-destination-root]]/$1.$2.webp -f + RewriteRule ^\/?(.*)\.(jpe?g|png)$ /[[your-base-path]]/[[your-destination-root]]/$1.$2.webp [NC,T=image/webp,QSD,E=WEBPACCEPT:1,L] + + # Redirect images to webp-on-demand.php (if browser supports webp) + RewriteCond %{HTTP_ACCEPT} image/webp + RewriteRule ^(.*)\.(jpe?g|png)$ webp-on-demand.php?source=%{SCRIPT_FILENAME}&url-path=$1.$2 [NC,L] + + + + + # Apache appends "REDIRECT_" in front of the environment variables, but LiteSpeed does not. + # These next line is for Apache, in order to set environment variables without "REDIRECT_" + SetEnvIf REDIRECT_WEBPACCEPT 1 WEBPACCEPT=1 + + # Make CDN caching possible. + # The effect is that the CDN will cache both the webp image and the jpeg/png image and return the proper + # image to the proper clients (for this to work, make sure to set up CDN to forward the "Accept" header) + Header append Vary Accept env=WEBPACCEPT + + +AddType image/webp .webp +``` + +## Forward the querystring +By forwarding the query string, you can allow control directly from the URL. You could for example make it possible to add "?debug" to an image URL, and thereby getting a conversion report. Or make "?reconvert" force reconversion. + +In order to forward the query string, you need to add this condition before the RewriteRule that redirects to *webp-on-demand.php*: +``` +RewriteCond %{QUERY_STRING} (.*) +``` +That condition will always be met. The side effect is that it stores the match (the complete querystring). That match will be available as %1 in the RewriteRule. So, in the RewriteRule, we will have to add "&%1" after the last argument. Here is a complete solution: +``` + + RewriteEngine On + + # Redirect images to webp-on-demand.php (if browser supports webp) + RewriteCond %{HTTP_ACCEPT} image/webp + RewriteCond %{QUERY_STRING} (.*) + RewriteRule ^(.*)\.(jpe?g|png)$ webp-on-demand.php?source=%{SCRIPT_FILENAME}&%1 [NC,L] + + +AddType image/webp .webp +``` + +Of course, in order to *do* something with that querystring, you must use them in your *webp-on-demand.php* script. You could for example use them directly in the options array sent to the *convertAndServe()* method. To achieve the mentioned "debug" and "reconvert" features, do this: +```php +$options = [ + 'show-report' => isset($_GET['debug']), + 'reconvert' => isset($_GET['reconvert']), + 'serve-original' => isset($_GET['original']), +]; +``` + +*EDIT:* +I have just discovered a simpler way to achieve the querystring forward: The [QSA flag](https://httpd.apache.org/docs/trunk/rewrite/flags.html). +So, simply set the QSA flag in the RewriteRule, and nothing more: +``` +RewriteRule ^(.*)\.(jpe?g|png)$ webp-on-demand.php?source=%{SCRIPT_FILENAME} [NC,QSA,L] +``` diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/webp-on-demand/webp-on-demand.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/webp-on-demand/webp-on-demand.md new file mode 100644 index 0000000..8343902 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/webp-on-demand/webp-on-demand.md @@ -0,0 +1,133 @@ +# WebP on demand + +This is a solution for automatically serving WebP images instead of jpeg/pngs [for browsers that supports WebP](https://caniuse.com/#feat=webp) (At the time of writing, 78% of all mobile users and 72% of all desktop users uses browsers supporting webp) + +Once set up, it will automatically convert images, no matter how they are referenced. It for example also works on images referenced in CSS. As the solution does not require any change in the HTML, it can easily be integrated into any website / framework + +## Overview + +A setup consists of a PHP script that serves converted images and some *redirect rules* that redirects JPG/PNG images to the script. + + +## Requirements + +* *Apache* or *LiteSpeed* web server. Can be made to work with *NGINX* as well. Documentation is on the roadmap. +* *mod_rewrite* module for Apache +* PHP >= 5.6 (we are only testing down to 5.6. It should however work in 5.5 as well) +* That one of the *webp-convert* converters are working (these have different requirements) + +## Installation + +Here we assume you are using Composer. [Not using composer? - Follow me!](https://github.com/rosell-dk/webp-convert/blob/master/docs/v1.3/webp-on-demand/without-composer.md) + +### 1. Require the webp-convert library with composer +``` +composer require rosell-dk/webp-convert +``` + + +### 2. Create the script + +Create a file *webp-on-demand.php*, and place it in webroot, or where-ever you like in you web-application. + +Here is a minimal example to get started with: + +```php + true // Show a conversion report instead of serving the converted image. + + // More options available! +]; +WebPConvert::convertAndServe($source, $destination, $options); +``` + +### 3. Add redirect rules +Place the following rewrite rules in a *.htaccess* file in the directory where you want the solution to take effect: + +``` + + RewriteEngine On + + # Redirect images to webp-on-demand.php (if browser supports webp) + RewriteCond %{HTTP_ACCEPT} image/webp + RewriteCond %{REQUEST_FILENAME} -f + RewriteRule ^(.*)\.(jpe?g|png)$ webp-on-demand.php?source=%{SCRIPT_FILENAME} [NC,L] + + +AddType image/webp .webp +``` +If you have placed *webp-on-demand.php* in a subfolder, you will need to change the rewrite rule accordingly. + +The `RewriteCond %{REQUEST_FILENAME} -f` is not strictly necessary, but there to be sure that we got an existing file, and it could perhaps also prevent some undiscovered way of misuse. + +### 4. Validate that it works + +Browse to a JPEG image. Instead of an image, you should see a conversion report. Hopefully, you get a success. Otherwise, you need to hook up to a cloud converter or try to meet the requirements for cwebp, gd or imagick. + +Once you get a successful conversion, you can uncomment the "show-report" option in the script. + +It should work now, but to be absolute sure: + +- Visit a page on your site with an image on it, using *Google Chrome*. +- Right-click the page and choose "Inspect" +- Click the "Network" tab +- Reload the page +- Find a jpeg or png image in the list. In the "type" column, it should say "webp". There should also be a *X-WebP-Convert-Status* header on the image that provides some insights on how things went. + + +### 5. Try this improvement and see if it works + +It seems that it is not necessary to pass the filename in the query string. + +Try replacing `$source = $_GET['source'];` in the script with the following: + +```php +$docRoot = rtrim($_SERVER["DOCUMENT_ROOT"], '/'); +$requestUriNoQS = explode('?', $_SERVER['REQUEST_URI'])[0]; +$source = $docRoot . urldecode($requestUriNoQS); +``` + +And you can then remove `?source=%{SCRIPT_FILENAME}` from the `.htaccess` file. + +There are some benefits of not passing in query string: +1. Passing a path in the query string may be blocked by a firewall, as it looks suspicious. +2. The script called to convert arbitrary files +3. One person experienced problems with spaces in filenames passed in the query string. See [this issue](https://github.com/rosell-dk/webp-convert/issues/95) + + +### 6. Customizing and tweaking + +Basic customizing is done by setting options in the `$options` array. Check out the [docs on convert()](https://github.com/rosell-dk/webp-convert/blob/master/docs/v1.3/converting/convert.md) and the [docs on convertAndServe()](https://github.com/rosell-dk/webp-convert/blob/master/docs/v1.3/serving/convert-and-serve.md) + +Other tweaking is described in *docs/webp-on-demand/tweaks.md*: +- [Store converted images in separate folder](https://github.com/rosell-dk/webp-convert/blob/master/docs/v1.3/webp-on-demand/tweaks.md#store-converted-images-in-separate-folder) +- [CDN](https://github.com/rosell-dk/webp-convert/blob/master/docs/v1.3/webp-on-demand/tweaks.md#cdn) +- [Make .htaccess route directly to existing images](https://github.com/rosell-dk/webp-convert/blob/master/docs/v1.3/webp-on-demand/tweaks.md#make-htaccess-route-directly-to-existing-images) +- [Forward the query string](https://github.com/rosell-dk/webp-convert/blob/master/docs/v1.3/webp-on-demand/tweaks.md#forward-the-querystring) + + +## Troubleshooting + +### The redirect rule doesn't seem to be working +If images are neither routed to the converter or a 404, it means that the redirect rule isn't taking effect. Common reasons for this includes: + +- Perhaps there are other rules in your *.htaccess* that interfere with the rules? +- Perhaps your site is on *Apache*, but it has been configured to use *Nginx* to serve image files. To find out which server that is handling the images, browse to an image and eximine the "Server" response header. In case *NGINX* are serving images, see if you can reconfigure your server setup. Alternatively, you can create *NGINX* rewrite rules. There are some [here](https://github.com/S1SYPHOS/kirby-webp#nginx) and [there](https://github.com/uhop/grunt-tight-sprite/wiki/Recipe:-serve-WebP-with-nginx-conditionally). +- Perhaps the server isn't configured to allow *.htaccess* files? Try inserting rubbish in the top of the *.htaccess* file and refresh. You should now see an *Internal Server Error* error page. If you don't, your *.htaccess* file is ignored. Probably you will need to set *AllowOverride All* in your Virtual Host. [Look here for more help]( +https://docs.bolt.cm/3.4/howto/making-sure-htaccess-works#test-if-htaccess-is-working) +- Perhaps the Apache *mod_rewrite* extension isn't enabled? Try removing both `` and `` lines: if you get an *Internal Server Error* error page after this change, it's probably that it's indeed not enabled. + + +## Related +* https://www.maxcdn.com/blog/how-to-reduce-image-size-with-webp-automagically/ +* https://www.digitalocean.com/community/tutorials/how-to-create-and-serve-webp-images-to-speed-up-your-website diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/webp-on-demand/without-composer.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/webp-on-demand/without-composer.md new file mode 100644 index 0000000..bc45061 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v1.3/webp-on-demand/without-composer.md @@ -0,0 +1,45 @@ +# WebP On Demand without composer + +For your convenience, the library has been cooked down to two files: *webp-on-demand-1.inc* and *webp-on-demand-2.inc*. The second one is loaded when the first one decides it needs to do a conversion (and not simply serve existing image). + +## Installing + +### 1. Copy the latest build files into your website +Copy *webp-on-demand-1.inc* and *webp-on-demand-2.inc* from the *build* folder into your website (in 2.0, they are located in "src-build"). They can be located wherever you like. + +### 2. Create a *webp-on-demand.php* + +Create a file *webp-on-demand.php*, and place it in webroot, or where-ever you like in you web-application. + +Here is a minimal example to get started with. Note that this example only works in version 1.x. In 2.0, the `require-for-conversion` option has been removed, so the [procedure is different](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/webp-on-demand/without-composer.md). + +```php + 'webp-on-demand-2.inc', + + // UNCOMMENT NEXT LINE, WHEN YOU ARE UP AND RUNNING! + 'show-report' => true // Show a conversion report instead of serving the converted image. + + // More options available! +]; +WebPConvert::convertAndServe($source, $destination, $options); +``` + +### 3. Continue the main install instructions from step 3 +[Click here to continue...](https://github.com/rosell-dk/webp-on-demand#3-add-redirect-rules) diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/architecture-q50-w600.jpg b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/architecture-q50-w600.jpg new file mode 100644 index 0000000..5dae8f8 Binary files /dev/null and b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/architecture-q50-w600.jpg differ diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/converters/stack.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/converters/stack.md new file mode 100644 index 0000000..7f981c2 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/converters/stack.md @@ -0,0 +1,248 @@ +# Stack converter + +The stack converter is a mechanism for trying all available converters until success. Well, the default is to try all converters, but this can be configured. + +When calling `WebPConvert::convert($source, $destination, $options);`, you are actually invoking the stack converter. + +## Passing options down to the individual converters + +Any option that you pass to the Stack converter will be passed on to the individual converters. For example, setting options to the following will set the metadata option on all converters: + +```php +$options = [ + 'metadata' => 'all', +]; +``` + +If you need the option to be different for a single converter there are several ways to do it: + +#### 1. Prefixing + +Options prefixed with a converter id are only effective for that converter, and overrides the non-prefixed option. + +Ie, the following will set "metadata" to "all" for all converters, except *cwebp*, where "metadata" is set to "exif" + +```php +$options = [ + 'metadata' => 'all', + 'cwebp-metadata' => 'exif' +]; +``` + +Prefixing is by the way a general feature in the way options are handled and thus not confined to the stack converter. (though it admittedly only finds its use in the context of a stack converter). + + +#### 2. Using the `converter-options` option +The *converter-options* option is convenient for setting a whole bunch of converter-specific options in one go. + +Example: +```php +$options = [ + 'converter-options' => [ + 'wpc' => [ + 'crypt-api-key-in-transfer' => true + 'api-key' => 'my dog is white', + 'api-url' => 'https://example.com/wpc.php', + 'api-version' => 1, + ], + ], +] +``` + +#### 3. As part of the `converters` option +This option is explained further down this document. + + +## Modifying the stack + +The default stack consists of the following converters: +- cwebp +- vips +- imagick +- gmagick +- imagemagick +- graphicsmagick +- wpc +- ewww +- gd + +The order has carefully been chosen based on the capabilities of the converters. It is a rank, if you will. + +Now, say that on your system, you only have *gd* working. With the default stack, this means that eight converters will be tested for operationality before getting to *gd* – each time a conversion is made. You might be tempted to optimizing the flow by putting *gd* on the top. *I would generally advise against this* for the following reasons: + +1. It might be that one of the other (and better) converters starts working without you noticing. You will then miss out. +2. All converters have all been designed to exit very quickly when they are not operational. It only takes a few milliseconds for the library to detect that a converter is not operational - literally. For example, if no api key is provided for ewww, it will exit immediately. + +However, there are valid reasons to modify the stack. For example, you may prefer *vips* over *cwebp*, or you may wish to remove a converter completely due to problems with that converter on your platform. + +### Changing the order of the converters +To change the order, you can use the `preferred-converters` option. With this option you move selected converters to the top of the stack. + +So, if you want the stack to start with *vips* and then *ewww*, but keep the rest of the order, you can set the following: + +```php +$options[ + 'preferred-converters' => ['vips', 'ewww']; +]; +``` + +### Removing converters from the stack +To remove converters, you can use the `skip` option and prefixing. For example, to remove *cwebp* and *gd*: + +```php +$options = [ + 'ewww-skip' => true, + 'cwebp-skip' => true, +]; +``` + +### Adding converters to the stack +If you are using a custom converter, you can add it to the stack like this: + +```php +$options = [ + 'extra-converters' => [ + '\\MyNameSpace\\WonderConverter' + ], +]; +``` + +It will be added to the bottom of the stack. To place it differently, use the `preferred-converters` option and set it to ie `'preferred-converters' => ['vips','\\MyNameSpace\\WonderConverter']` + + +Here is an example which adds an extra ewww converter. This way you can have a backup api-key in case the quota of the first has been exceeded. + +``` +$options = [ + 'extra-converters' => [ + [ + 'converter' => 'ewww', + 'options' => [ + 'api-key' => 'provide-backup-key-here', + ] + ] + ] +]; +``` +Note however that you will not be able to reorder that new ewww converter using `preferred-converters`, as there are now two converters with id=ewww, and that option has not been designed for that. Instead, you can add a sub-stack of ewww converters - see the "Stacking" section below. + + +### Setting the converter array explicitly +Using the `converters` option, you can set the converter array explicitly. What differentiates this from the `preferred-converters` option (besides that it completely redefines the converter ordering) is that it allows you to set both the converters *and* options for each converter in one go and that it allows a complex structure - such as a stack within a stack. Also, this structure can simplify things in some cases, such as when the options is generated by a GUI, as it is in WebP Express. + +The array specifies the converters to try and their order. Each item can be: + +- An id (ie "cwebp") +- A fully qualified class name (in case you have programmed your own custom converter) +- An array with two keys: "converter" and "options". + +Example: + +```php +$options = [ + 'quality' => 71, + 'converters' => [ + 'cwebp', + [ + 'converter' => 'vips', + 'options' => [ + 'quality' => 72 + ] + ], + [ + 'converter' => 'ewww', + 'options' => [ + 'quality' => 73 + ] + ], + 'wpc', + 'imagemagick', + '\\MyNameSpace\\WonderConverter' + ], +]; +``` + +### Stacking +Stack converters behave just like regular converters. They ARE in fact "regular", as they extend the same base class as all converters. This means that you can have a stack within a stack. You can for example utilize this for supplying a backup api key for the ewww converter. Like this: + +```php +$options = [ + 'ewww-skip' => true, // skip the default ewww converter (we use stack of ewww converters instead) + 'extra-converters' => [ + [ + // stack of ewww converters + 'converter' => 'stack', + 'options' => [ + 'ewww-skip' => false, // do not skip ewww from here on + 'converters' => [ + [ + 'converter' => 'ewww', + 'options' => [ + 'api-key' => 'provide-preferred-key-here', + ] + ], + [ + 'converter' => 'ewww', + 'options' => [ + 'api-key' => 'provide-backup-key-here', + ] + ] + ], + ] + ] + ], + 'preferred-converters' => ['cwebp', 'vips', 'stack'], // set our stack of ewww converters third in queue +]; +``` +Note that we set `ewww-skip` in order to disable the *ewww* converter which is part of the defaults. As options are inherited, we have to reset this option again. These steps are not necessary when using the `converters` option. + +Also note that the options for modifying the converters (`converters`, `extra-converters`, `converter-options`) does not get passed down. + +Also note that if you want to add two stacks with `extra-converters`, the `preferred-converters` option will not work, as there are two converters called "stack". One workaround is to add those two stacks to their own stack, so you have three levels. Or you can of course simply use the `converters` option to get complete control. + + +### Shuffling + +The stack can be configured to shuffling, meaning that the the order will be random. This can for example be used to balance load between several wpc instances in a sub stack. + +Shuffling is enabled with the `shuffle` option. + +Here is an example of balancing load between several *wpc* instances: + +```php +$options = [ + 'wpc-skip' => true, // skip the default wpc converter (we use stack of wpc converters instead) + 'extra-converters' => [ + [ + // stack of wpc converters + 'converter' => 'stack', + 'options' => [ + 'wpc-skip' => false, // do not skip wpc from here on + 'shuffle' => true, + + 'converters' => [ + [ + 'converter' => 'wpc', + 'options' => [ + 'api-key' => 'my-dog', + 'api-url' => 'my-wpc.com/wpc.php', + 'api-version' => 1, + 'crypt-api-key-in-transfer' => true, + ] + ], + [ + 'converter' => 'wpc', + 'options' => [ + 'api-key' => 'my-other-dog', + 'api-url' => 'my-other-wpc.com/wpc.php', + 'api-version' => 1, + 'crypt-api-key-in-transfer' => true, + ] + ] + ], + ] + ] + ], + 'preferred-converters' => ['cwebp', 'vips', 'stack'], // set our stack of wpc converters third in queue +]; +``` diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/dice.png b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/dice.png new file mode 100644 index 0000000..80c7e95 Binary files /dev/null and b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/dice.png differ diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/introduction-for-converting.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/introduction-for-converting.md new file mode 100644 index 0000000..5958e3e --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/introduction-for-converting.md @@ -0,0 +1,251 @@ +# Introduction to converting with WebPConvert + +The library is able to convert images to webp using a variety of methods (*gd*, *imagick*, *vips* etc.), which we call "converters". A converter is called like this: + +```php +use WebPConvert\Convert\Converters\Gd; + +Gd::convert($source, $destination, $options=[], $logger=null); +``` + +All converters comes with requirements. For example, the *Gd* converter requires that Gd is installed and compiled with webp support. The cloud converters requires an api key. In case the conversion fails, an exception is thrown. + +## Insights to the process +If *$logger* is supplied, the converter will log the details of how the conversion process went to that logger. You can for example use the supplied *EchoLogger* to print directly to screen or the *BufferLogger* to collect the log entries. Here is a simple example which prints the process to screen: + +```php +use WebPConvert\Convert\Converters\Gd; +use WebPConvert\Loggers\EchoLogger; + +Gd::convert($source, $destination, $options=[], new EchoLogger()); +``` + +It will output something like this: + +```text +GD Version: 2.2.5 +image is true color +Quality set to same as source: 61 + +Converted image in 20 ms, reducing file size with 34% (went from 12 kb to 8 kb) +``` + +## The stack converter +When your software is going to be installed on a variety of systems which you do not control, you can try the converters one at the time until success. The converters has been designed to exit quickly when system requirements are not met. To make this task easy, a *Stack* converter has been created. + +The stack converter has two special options: + +| option | description | +| ------------------------- | ----------- | +| converters (array) | Converters to try (ids or class names, in case you have your own custom converter) | +| converter-options (array) | Extra options for specific converters. | + +Alternatively to the converter-options array, you can simply prefix options with the converter id. + +I recommend leave the converters array at the default unless you have strong reasons not to. Otherwise you might miss out when new converters are added. + +### Example: + +```php +use WebPConvert\Convert\Converters\Stack; + +Stack::convert($source, $destination, $options = [ + + // PS: only set converters if you have strong reasons to do so + 'converters' => [ + 'cwebp', 'vips', 'imagick', 'gmagick', 'imagemagick', 'graphicsmagick', 'wpc', 'ewww', 'gd' + ], + + // Any available options can be set here, they dribble down to all converters. + 'metadata' => 'all', + + // To override for specific converter, you can prefix with converter id: + 'cwebp-metadata' => 'exif', + + // This can for example be used for setting ewww api key: + 'ewww-api-key' => 'your-ewww-api-key-here', + + // As an alternative to prefixing, you can use "converter-options" to set a whole bunch of overrides in one go: + 'converter-options' => [ + 'wpc' => [ + 'crypt-api-key-in-transfer' => true + 'api-key' => 'my dog is white', + 'api-url' => 'https://example.com/wpc.php', + 'api-version' => 1, + ], + ], +], $logger=null); +``` + +Note: As an alternative to setting the third party credentials in the options, you can set them through constants or environment variables ("WEBPCONVERT_EWWW_API_KEY", "WEBPCONVERT_WPC_API_KEY", "WEBPCONVERT_WPC_API_URL"). Paths to binaries can also be set like that (it is rarely needed to do this): "WEBPCONVERT_CWEBP_PATH", "WEBPCONVERT_GRAPHICSMAGICK_PATH" and WEBPCONVERT_IMAGEMAGICK_PATH" + +To set an environment variable in Apache, you can add a line like this in your `.htaccess` or vhost configuration: +``` +# Set ewww api key for WebP Convert +SetEnv WEBPCONVERT_EWWW_API_KEY yourVerySecretApiKeyGoesHere + +# Set custom path to imagick for WebP Convert +SetEnv WEBPCONVERT_IMAGEMAGICK_PATH /usr/local/bin/magick +``` +To set a constant: +```php +define('WEBPCONVERT_IMAGEMAGICK_PATH', '/usr/local/bin/magick'); +``` + + +## Configuring the options + +### Preventing unnecessarily high quality setting for low quality jpegs +**Q:** What do you get if you convert a low quality jpeg (ie q=50) into a high quality webp (ie q=90) ?\ +**A:** You maintain the low quality, but you get a large file` + +What should we have done instead? We should have converted with a quality around 50. Of course, quality is still low - we cannot fix that - but it will not be less, *and the converted file will be much smaller*. + +As unnecessary large conversions are rarely desirable, this library per default limits the quality setting so it does not exceed that of the source. This functionality requires that either *imagemagick*, *graphicsmagick* or *imagick* is installed (not necessarily compiled with webp support). When they are, all converters will have the "auto-limit" functionality. Otherwise, only *wpc* will support it (provided that one of these libraries is installed on the server of the cloud service). + +How much can be gained? A lot! +The following low quality (q=50) jpeg weighs 54 kb. If this is converted to webp with quality=80, the size of the converted file is 52kb - almost no reduction! With auto-limit, the quality of the webp will be set to 50, and the size will be 34kb. Visually, the results are indistinguable. + +![A low quality jpeg](https://raw.githubusercontent.com/rosell-dk/webp-convert/master/docs/v2.0/converting/architecture-q50-w600.jpg) + +### Auto selecting between lossless/lossy encoding +WebP files can be encoded using either *lossless* or *lossy* encoding. The JPEG format is lossy and the PNG is lossless. However, this does not mean that you necessarily get the best conversion by always encoding JPEG to lossy and PNG to lossless. With JPEGs it is often the case, as they are usually pictures and pictures usually best encoded as lossy. With PNG it is however a different story, as you often can get a better compression using lossy encoding, also when using high quality level of say 85, which should be enough for the web. + +As unnecessary large conversions are rarely desirable, this library per default tries to convert images using both lossy and lossless encoding and automatically selects the smallest. This is controlled using the *encoding* option, which per default is "auto", but can also be set to "lossy" or "lossless". + +As an example, the following PNG (231 kb) will be compressed to 156 kb when converting to *lossless* webp. But when converting to *lossy* (quality: 85), it is compressed to merely 68 kb - less than half. (in case you are confused about the combination of lossy and transparency: Yes, you can have both at the same time with webp). + +![Dice](https://raw.githubusercontent.com/rosell-dk/webp-convert/master/docs/v2.0/converting/dice.png) + +Unless you changed the `near-lossless` option described below, the choice is actually between lossy and *near-lossless*. + +Note that *gd* and *ewww* does not support this feature. *gd* can only produce lossy, and will simply do that. *ewww* can not be configured to use a certain encoding, but automatically chooses *lossless* encoding for PNGs and lossy for JPEGs. + +### Near-lossless +*cwebp* and *vips* supports "near-lossless" mode. Near lossless produces a webp with lossless encoding but adjusts pixel values to help compressibility. The result is a smaller file. The price is described as a minimal impact on the visual quality. + +As unnecessary large conversions are rarely desirable, this library per default sets *near-lossless* to 60. To disable near-lossless, set it to 100. + +When compressing the image above (231 kb) to lossless, it compressed to 156 kb when near-lossless is set to 100. Setting near-lossless to 60 gets the size down to 110 kb while still looking great. + +You can read more about the near-lossless mode [here](https://groups.google.com/a/webmproject.org/forum/#!topic/webp-discuss/0GmxDmlexek) + +### Alpha-quality +All converters, except *gd* and *ewww* supports "alpha-quality" option. This allows lossy compressing of the alpha channel. + +As unnecessary large conversions are rarely desirable, this library per default sets *alpha-quality* to 85. Set it to 100 to achieve lossless compression of alhpa. + +Btw, the image above gets compressed to 68 kb with alpha quality set to 100. Surprisingly, it gets slightly larger (70 kb) with alpha quality set to 85. Setting alpha quality to 50 gets it down to merely 35 kb - about half - while still looking great. + +You can read more about the alpha-quality option [here](https://developers.google.com/speed/webp/docs/cwebp) and [here](https://www.smashingmagazine.com/2018/07/converting-images-to-webp/) + +### Sharp YUV +libwebp has an overlooked option which improves accuracy for RGB to YUV mapping at the price for longer conversion time. You can control it with the new 'sharp-yuv' option (introduced in webp-convert 2.6.0). Read an appraisal of the option [here](https://www.ctrl.blog/entry/webp-sharp-yuv.html). + +### Tip: don't set quality too high... +**Q:** What do you get if you convert an excessively high quality jpeg into an excessively high quality webp?\ +**A:** An excessively big file + +The size of a webp file grows enormously with the quality setting. For the web however, a quality above 75 is rarely needed. For this reason the library has a per default sets the quality to 75 for jpegs. + +So, how much can be gained? A lot! +The following excessively high quality jpeg (q=100) weighs 146 kb. Converting it to webp with quality=100 results in a 99kb image. Converting it to quality=85 results in a 40kb image. + +![A (too) high quality jpeg](https://raw.githubusercontent.com/rosell-dk/webp-convert/master/docs/v2.0/converting/mouse-q100.jpg) + +### PNG og JPEG-specific options. + +To have options depending on the image type of the source, you can use the `png` and `jpeg` keys. + +The following options mimics the default behaviour (version 2.0 - 2.5): + +```php +$options = [ + 'png' => [ + 'encoding' => 'auto', /* Try both lossy and lossless and pick smallest */ + 'near-lossless' => 60, /* The level of near-lossless image preprocessing (when trying lossless) */ + 'quality' => 85, /* Quality when trying lossy. It is set high because pngs is often selected to ensure high quality */ + 'sharp-yuv' => true, + ], + 'jpeg' => [ + 'encoding' => 'auto', /* If you are worried about the longer conversion time, you could set it to "lossy" instead (lossy will often be smaller than lossless for jpegs) */ + 'quality' => 'auto', /* Set to same as jpeg (requires imagick or gmagick extension, not necessarily compiled with webp) */ + 'max-quality' => 80, /* Only relevant if quality is set to "auto" */ + 'default-quality' => 75, /* Fallback quality if quality detection isnt working */ + 'sharp-yuv' => true, + ] +]; +``` +PS: From version 2.6 on, you should use the new "auto-limit" option instead of setting quality to "auto". + +The following options mimics the default behaviour (version 2.6 and forth): + +```php +$options = [ + 'png' => [ + 'encoding' => 'auto', /* Try both lossy and lossless and pick smallest */ + 'near-lossless' => 60, /* The level of near-lossless image preprocessing (when trying lossless) */ + 'quality' => 85, /* Quality when trying lossy. It is set high because pngs is often selected to ensure high quality */ + 'sharp-yuv' => true, + ], + 'jpeg' => [ + 'encoding' => 'auto', /* If you are worried about the longer conversion time, you could set it to "lossy" instead (lossy will often be smaller than lossless for jpegs) */ + 'quality' => 75, /* Quality when trying lossy. It is set a bit lower for jpeg than png */ + 'auto-limit' => true, /* Prevents using a higher quality than that of the source (requires imagick or gmagick extension, not necessarily compiled with webp) */ + 'sharp-yuv' => true, + ] +]; +``` + +The *png* and *jpeg* options can hold any other option - also the converter specific options. +A use case could for example be to use different converters for png and jpeg: + +```php +$options = [ + 'png' => [ + 'converters' => ['ewww'], + ], + 'jpeg' => [ + 'converters' => ['gd'], + ] +]; +``` + +## Available options + +**All** available options are documented [here](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md). + +Here is a quick overview of the few ones discussed here. + +### Version 2.0 - 2.5 + +| Option | Default (jpeg) | Default (png) | Description | +| ----------------- | ------------------ | ------------------- | ---------------------------------------------------------------------------------- | +| quality | "auto" | 85 | See the "Auto quality" section above. | +| max-quality | 85 | 85 | Only relevant for jpegs and when quality is set to "auto". | +| default-quality | 75 | 85 | | +| metadata | "none" | "none" | Valid values: "all", "none", "exif", "icc", "xmp".

Note: Currently only *cwebp* supports all values. *gd* will always remove all metadata. *ewww*, *imagick* and *gmagick* can either strip all, or keep all (they will keep all, unless metadata is set to *none*) | +| encoding | "auto" | "auto" | See the "Auto selecting between lossless/lossy encoding" section above | +| jpeg | - | - | Array of options which will be merged into the other options when source is a JPEG | +| png | - | - | Array of options which will be merged into the other options when source is a PNG | +| skip | false | false | If true, conversion will be skipped (ie for skipping png conversion for some converters) | + +### Version > 2.6 + +| Option | Default (jpeg) | Default (png) | Description | +| ----------------- | ------------------ | ------------------- | ---------------------------------------------------------------------------------- | +| quality | 75 | 85 | Quality for lossy encoding | +| auto-limit | true | true | Only relevant for jpegs and lossy encoding | +| metadata | "none" | "none" | Valid values: "all", "none", "exif", "icc", "xmp".

Note: Currently only *cwebp* supports all values. *gd* will always remove all metadata. *ewww*, *imagick* and *gmagick* can either strip all, or keep all (they will keep all, unless metadata is set to *none*) | +| encoding | "auto" | "auto" | See the "Auto selecting between lossless/lossy encoding" section above | +| jpeg | - | - | Array of options which will be merged into the other options when source is a JPEG | +| png | - | - | Array of options which will be merged into the other options when source is a PNG | +| skip | false | false | If true, conversion will be skipped (ie for skipping png conversion for some converters) | + + +## More info + +- The complete api is available [here](https://www.bitwise-it.dk/webp-convert/api/2.0/html/index.xhtml) +- The converters are described in more detail here (for 1.3.9): [docs/v1.3/converting/converters.md](https://github.com/rosell-dk/webp-convert/blob/master/docs/v1.3/converting/converters.md). +- On the github wiki you can find installation instructions for imagick with webp, gd with webp, etc. +- This document is a newly written introduction to the convert api, which has been created as part of the 2.0 release. The old introduction, which was made for 1.3 is available here: [docs/converting/v1.3/convert.md](https://github.com/rosell-dk/webp-convert/blob/master/docs/v1.3/converting/convert.md). diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/mouse-q100.jpg b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/mouse-q100.jpg new file mode 100644 index 0000000..bb586d8 Binary files /dev/null and b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/mouse-q100.jpg differ diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/options.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/options.md new file mode 100644 index 0000000..4ff4292 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/converting/options.md @@ -0,0 +1,403 @@ +# Options + +This is a list of all options available for converting. + +Note that as the *stack* and *wpc* converters delegates the options to their containing converters, the options that they supports depend upon the converters they have been configured to use (and which of them that are operational)

+ +## General options + +### `alpha-quality` +``` +Type: integer (0-100) +Default: 85 +Supported by: cwebp, vips, imagick, gmagick, imagemagick and graphicsmagick +``` +Quality of alpha channel. Often, there is no need for high quality transparency layer and in some cases you can tweak this all the way down to 10 and save a lot in file size. The option only has effect with lossy encoding, and of course only on images with transparency (so it is irrelevant when converting jpegs). Read more about tweaking the option [here](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md#alpha-quality)

+ +### `auto-filter` +``` +Type: boolean +Default: false +Supported by: cwebp, vips, imagick, gmagick, imagemagick and graphicsmagick +``` +Turns auto-filter on. This algorithm will spend additional time optimizing the filtering strength to reach a well-balanced quality. Unfortunately, it is extremely expensive in terms of computation. It takes about 5-10 times longer to do a conversion. A 1MB picture which perhaps typically takes about 2 seconds to convert, will takes about 15 seconds to convert with auto-filter. So in most cases, you will want to leave this at its default, which is off.

+ +### `auto-limit` +``` +Type: boolean +Default: true +Supported by: all +``` +Limits the quality to be no more than that of the jpeg. The option is only relevant when converting jpegs to lossy webp. To be functional, webp-convert needs to be able to detect the quality of the jpeg, which requires ImageMagick or GraphicsMagick. Read about the option in the [introduction](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md#auto-quality). In 2.7.0, it will become possible to adjust the limit with a new option. I'm currently debating with myself how this should work. Your comments and opinions would be appreciated - [here](https://github.com/rosell-dk/webp-convert/issues/289) + +### `converter` (new in 2.8.0) +``` +Type: string +Default: null +Supported by: WebPConvert::convert method +``` +Simplifies using a specific converter. Before this option, you would either need to call the converter class (ie `Ewww::convert`) (not very flexible), or set the stack to contain just one converter (unnecessary overhead). If you do not use this option, `WebPConvert::convert` works as normal (it calls `Stack::convert`), if you do use it, it hands over the converting to the converter specified (specified by id, ie. "cwebp"). + +### `default-quality` (DEPRECATED) +``` +Type: integer (0-100) +Default: 75 for jpegs and 85 for pngs +Supported by: all (cwebp, ewww, gd, ffmpeg, gmagick, graphicsmagick, imagick, imagemagick, vips) +``` +This option has been deprecated. See why [here](https://github.com/rosell-dk/webp-convert/issues/281). It was used to determine the quality in case auto limiting was not available.

+ +### `encoding` +``` +Type: string ("lossy" | "lossless" | "auto") +Default: "auto" +Supported by: cwebp, vips, ffmpeg, imagick, gmagick, imagemagick and graphicsmagick (gd always uses lossy encoding, ewww uses lossless for pngs and lossy for jpegs) +``` +Set encoding for the webp. If you choose "auto", webp-convert will convert to both lossy and lossless and pick the smallest result. Read more about this option in the ["lossy/lossless" section in the introduction](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md#auto-selecting-between-losslesslossy-encoding).

+ +### `ewww-api-key` +``` +Type: string +Default: '' +Supported by: ewww +``` +Api key for the ewww converter. The option is actually called *api-key*, however, any option can be prefixed with a converter id to only apply to that converter. As this option is only for the ewww converter, it is natural to use the "ewww-" prefix. + +Note: This option can alternatively be set through the *EWWW_API_KEY* environment variable.

+ +### `ewww-check-key-status-before-converting` +``` +Type: boolean +Default: true +Supported by: ewww +``` +Decides whether or not the ewww service should be invoked in order to check if the api key is valid. Doing this for every conversion is not optimal. However, it would be worse if the service was contacted repeatedly to do conversions with an invalid api key - as conversion requests carries a big upload with them. As this library cannot prevent such repeated failures (it is stateless), it per default does the additional check. However, your application can prevent it from happening by picking up invalid / exceeded api keys discovered during conversion. Such failures are stored in `Ewww::$nonFunctionalApiKeysDiscoveredDuringConversion` (this is also set even though a converter later in the stack succeeds. Do not only read this value off in a catch clauses). + +You should only set this option to *false* if you handle when the converter discovers invalid api keys during conversion. + +### `jpeg` +``` +Type: array +Default: [] +Supported by: all +``` +Override selected options when the source is a jpeg. The options provided here are simply merged into the other options when the source is a jpeg. +Read about this option in the [introduction](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md#png-og-jpeg-specific-options).

+ +### `log-call-arguments` +``` +Type: boolean +Default: false +Supported by: all +``` +Enabling this simply puts some more in the log - namely the arguments that was supplied to the call. Sensitive information is starred out. + +### `low-memory` +``` +Type: boolean +Default: false +Supported by: cwebp, imagick, imagemagick and graphicsmagick +``` +Reduce memory usage of lossy encoding at the cost of ~30% longer encoding time and marginally larger output size. Only effective when the *method* option is 3 or more. Read more in [the docs](https://developers.google.com/speed/webp/docs/cwebp).

+ +### `max-quality` (DEPRECATED) +``` +Type: integer (0-100) +Default: 85 +Supported by: all (cwebp, ewww, ffmpeg, gd, gmagick, graphicsmagick, imagick, imagemagick, vips) +``` +This option has been deprecated. See why [here](https://github.com/rosell-dk/webp-convert/issues/281)

+ +### `metadata` +``` +Type: string ("all" | "none" | "exif" | "icc" | "xmp" | "exif,icc" | "exif,xmp" | "icc,xmp") +Default: 'none' +Supported by: Only *cwebp* supports "exif", "icc" and "xmp". *gd* cannot copy metadata. *ffmpeg* always copies metadata. The rest supports "all" and "none" (ewww, gmagick, graphicsmagick, imagick, imagemagick, vips) +``` +Determines which metadata that should be copied over to the webp. Setting it to "all" preserves all metadata, setting it to "none" strips all metadata. *cwebp* can take a comma-separated list of which kinds of metadata that should be copied (ie "exif,icc"). *gd* will always remove all metadata and *ffmpeg* will always keep all metadata. The rest can either strip all or keep all (they will keep all, unless the option is set to *none*).

+ +### `method` +``` +Type: integer (0-6) +Default: 6 +Supported by: cwebp, vips, imagick, gmagick, imagemagick, graphicsmagick and ffmpeg +``` +This parameter controls the trade off between encoding speed and the compressed file size and quality. Possible values range from 0 to 6. 0 is fastest. 6 results in best quality. PS: "method" is not a very descriptive name, but this is what its called in libwebp, which is why we also choose it for webpconvert. In ffmpeg, they renamed it "compression_level", in vips, they call it "reduction_effort". Both better names, but as said, use "method" with webpconvert

+ +### `near-lossless` +``` +Type: integer (0-100) +Default: 60 +Supported by: cwebp, vips +``` +This option allows you to get impressively better compression for lossless encoding, with minimal impact on visual quality. The result is still lossless (lossless encoding). What libwebp does is that it preprocesses the image before encoding it, in order to make it better suited for compression. The range is 0 (maximum preprocessing) to 100 (no preprocessing). A good compromise would be around 60. The option is ignored when encoding is set to lossy. Read more [here](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md#near-lossless).

+ +### `png` +``` +Type: array +Default: [] +Supported by: all +``` +Override selected options when the source is a png. The options provided here are simply merged into the other options when the source is a png. +Read about this option in the [introduction](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md#png-og-jpeg-specific-options).

+ +### `preset` +``` +Type: string ('none', 'default', 'photo', 'picture', 'drawing', 'icon' or 'text') +Default: "none" +Supported by: cwebp, vips, gmagick, graphicsmagick, imagick, imagemagick, ffmpeg +``` +Using a preset will set many of the other options to suit a particular type of source material. It even overrides them. It does however not override the quality option. "none" means that no preset will be set. PS: The imagemagick family only partly supports this setting, as they have grouped three of the options ("drawing", "icon" and "text") into "graph". So if you for example set "preset" to "icon" with the imagemagick converter, imagemagick will be executed like this: "-define webp:image-hint='graph'".

+ +### `quality` +``` +Type: integer (0-100) | "auto" ("auto" is now deprecated - use the "auto-limit" option instead) +Default: 75 for jpegs and 85 for pngs +Supported by: all (cwebp, ewww, gd, gmagick, graphicsmagick, imagick, imagemagick, vips, ffmpeg) +``` +Quality for lossy encoding.

+ +### `sharp-yuv` +``` +Type: boolean +Default: true +Supported by: cwebp, vips, gmagick, graphicsmagick, imagick, imagemagick +``` +Better RGB->YUV color conversion (sharper and more accurate) at the expense of a little extra conversion time. Read more [here](https://www.ctrl.blog/entry/webp-sharp-yuv.html). + +### `size-in-percentage` +``` +Type: integer (0-100) | null +Default: null +Supported by: cwebp +``` +This option sets the file size, *cwebp* should aim for, in percentage of the original. If you for example set it to *45*, and the source file is 100 kb, *cwebp* will try to create a file with size 45 kb (we use the `-size` option). This is an excellent alternative to the "quality:auto" option. If the quality detection isn't working on your system (and you do not have the rights to install imagick or gmagick), you should consider using this options instead. *Cwebp* is generally able to create webp files with the same quality at about 45% the size. So *45* would be a good choice. The option overrides the quality option. And note that it slows down the conversion - it takes about 2.5 times longer to do a conversion this way, than when quality is specified. Default is *off* (null).

+ +### `skip` +``` +Type: boolean +Default: false +Supported by: all +``` +Simply skips conversion. For example this can be used to skip png conversion for a specific converter like this: +```php +$options = [ + 'png' => [ + 'gd-skip' => true, + ] +]; +``` + +Or it can be used to skip unwanted converters from the default stack, like this: +```php +$options = [ + 'ewww-skip' => true, + 'wpc-skip' => true, + 'gd-skip' => true, + 'imagick-skip' => true, + 'gmagick-skip' => true, +]; +``` +
+ +### `use-nice` +``` +Type: boolean +Default: false +Supported by: cwebp, graphicsmagick, imagemagick, ffmpeg +``` +This option only applies to converters which are using exec() to execute a binary directly on the host. If *use-nice* is set, it will be examined if the [`nice`]( https://en.wikipedia.org/wiki/Nice_(Unix)) command is available on the host. If it is, the binary is executed using *nice*. This assigns low priority to the process and will save system resources - but result in slower conversion.

+ + +# Options unique for individual converters + +## cwebp options +Options unique to the "cwebp" converter + +### `command-line-options` +``` +Type: string +Default: '' +Supported by: cwebp +``` +This allows you to set any parameter available for cwebp in the same way as you would do when executing *cwebp*. You could ie set it to "-sharpness 5 -mt -crop 10 10 40 40". Read more about all the available parameters in [the docs](https://developers.google.com/speed/webp/docs/cwebp).

+ +### `rel-path-to-precompiled-binaries` +``` +Type: string +Default: './Binaries' +Supported by: cwebp +``` +Allows you to change where to look for the precompiled binaries. While this may look as a risk, it is completely safe, as the binaries are hash-checked before being executed. The option is needed when you are using two-file version of webp-on-demand. + +### `try-cwebp` +``` +Type: boolean +Default: true +Supported by: cwebp +``` +If set, the converter will try executing "cwebp -version". In case it succeeds, and the version is higher than those working cwebp's found using other methods, the conversion will be done by executing this cwebp. + +### `try-common-system-paths` +``` +Type: boolean +Default: true +Supported by: cwebp +``` +If set, the converter will look for a cwebp binaries residing in common system locations such as `/usr/bin/cwebp`. If such exist, it is assumed that they are valid cwebp binaries. A version check will be run on the binaries found (they are executed with the "-version" flag. The cwebp with the highest version found using this method and the other enabled methods will be used for the actual conversion. + +This method might find a cwebp binary something that isn't found using `try-discovering-cwebp` if these common paths are not within PATH or neither `which` or `whereis` are available. + +Note: All methods for discovering cwebp binaries are per default enabled. You can save a few microseconds by disabling all, but the one that discovers the cwebp binary with the highest version (check the conversion log to find out). However, it is probably not worth it, as your setup will then become less resilient to system changes. + +### `try-discovering-cwebp` +``` +Type: boolean +Default: true +Supported by: cwebp +``` +If set, the converter will try to discover installed cwebp binaries using the `which -a cwebp` command, or in case that fails, the `whereis -b cwebp` command. These commands will find cwebp binaries residing in PATH + +### `try-supplied-binary-for-os` +``` +Type: boolean +Default: true +Supported by: cwebp +``` +If set, the converter will try use a precompiled cwebp binary that comes with webp-convert. But only if it has a higher version that those found by other methods. As the library knows the versions of its cwebps, no additional time is spent executing them with the "-version" parameter. The binaries are hash-checked before executed. The library btw. comes with several versions of precompiled cwebps because they have different dependencies - some works on some systems and others on others. + +### `skip-these-precompiled-binaries` +``` +Type: string +Default: '' +Supported by: cwebp +``` +The precompiled binaries from google have dependencies, and they are different. This means that some of them works on some systems, others on others. For this reason, several precompiled binaries are shipped with the library - we want it to simply work on as many systems as possible. Of course, the binary with the highest version number is tried first. But if it doesn't work, time has been wasted running an executable that doesn't work, and validating the hash before running it. To avoid this, use this option to bypass precompiled binaries that you know doesn't work on your current system. You pass in the filenames (comma separated), ie "cwebp-120-linux-x86-64,cwebp-110-linux-x86-64". In order to see if time is wasted on a supplied binary, that doesn't work, check the conversion log. You can also get info about the filenames of the binaries in the conversion log. Instructions on viewing the conversion log are available [here](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md#insights-to-the-process). +Btw: If minimizing the overhead is a priority, there are alternatives to this option that speeds up conversion time more. It is the hash-check that is costly. Hash-checking is only done on the cwebps shipped with the library. + +Alternative 1: Disabling the "cwebp-try-supplied-binary-for-os" option thus avoids the rather expensive job of hash-checking the binary each time it is run. The cost of this is that you don't get the newest cwebp available (the ones shipped with the library will only be used when you don't have a newer one available). + +Alternative 2: If you set an environment variable called "WEBPCONVERT_CWEBP_PATH" (or define a "WEBPCONVERT_CWEBP_PATH" variable in PHP), cwebp will simply execute the binary found at that path and not examine other alternatives. Also, there will be no hash check either. Doing so however makes your system a little bit less secure - exactly because it bypasses the hash-checking. If some security whole allows an attacker to upload a binary, replacing the one set like this, an attacker would then have a way to have that binary executed. Here is how you define the variable in PHP: `define("WEBPCONVERT_CWEBP_PATH", "/path/to/working/cwebp/for/example/one/in/src/Convert/Converters/Binaries/dir");`. Also beware that by doing this, you will need to update your code in order to take advantage of future cwebp releases. + +## stack options +Options unique to the "stack" converter + +### `stack-converters` +``` +Type: array +Default: ['cwebp', 'vips', 'imagick', 'gmagick', 'imagemagick', 'graphicsmagick', 'wpc', 'ewww', 'gd'] +Supported by: stack +``` + +Specify the converters to try and their order. + +Beware that if you use this option, you will miss out when more converters are added in future updates. If the purpose of setting this option is to remove converters that you do not want to use, you can use the *skip* option instead. Ie, to skip ewww, set *ewww-skip* to true. On the other hand, if what you actually want is to change the order, you can use the *stack-preferred-converters* option, ie setting *stack-preferred-converters* to `['vips', 'wpc']` will move vips and wpc in front of the others. Should they start to fail, you will still have the others as backup. + +The array specifies the converters to try and their order. Each item can be: + +- An id (ie "cwebp") +- A fully qualified class name (in case you have programmed your own custom converter) +- An array with two keys: "converter" and "options". + +` +Alternatively, converter options can be set using the *converter-options* option. + +Read more about the stack converter in the [introduction](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md#the-stack-converter).

+ +### `stack-converter-options` +``` +Type: array +Default: [] +Supported by: stack +``` +Extra options for specific converters. Example: + +```php +$options = [ + 'converter-options' => [ + 'vips' => [ + 'quality' => 72 + ], + ] +] +``` +
+ +### `stack-extra-converters` +``` +Type: array +Default: [] +Supported by: stack +``` +Add extra converters to the bottom of the stack. The items are similar to those in the `stack-converters` option.

+ +### `stack-preferred-converters` +``` +Type: array +Default: [] +Supported by: stack +``` +With this option you can move specified converters to the top of the stack. The converters are specified by id. For example, setting this option to ['vips', 'wpc'] ensures that *vips* will be tried first and - in case that fails - *wpc* will be tried. The rest of the converters keeps their relative order.

+ +### `stack-shuffle` +``` +Type: boolean +Default: false +Supported by: stack +``` +Shuffle the converters in the stack. This can for example be used to balance load between several wpc instances in a substack, as illustrated [here](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/converters/stack.md)

+ +## vips options + +### `vips-smart-subsample` (DEPRECATED) +``` +Type: boolean +Default: false +Supported by: vips +``` +This feature seemed not to be part of *libwebp* but intrinsic to vips. However, we were wrong - the feature is the same as 'sharp-yuv'. Use that instead.

+ + +## wcp options + +### `wpc-api-key` +``` +Type: string +Default: '' +Supported by: wpc +``` +Api key for the wpc converter. The option is actually called *api-key*, however, any option can be prefixed with a converter id to only apply to that converter. As this option is only for the wpc converter, it is natural to use the "wpc-" prefix. Same goes for the other "wpc-" options. + +Note: You can alternatively set the api key through the *WPC_API_KEY* environment variable.

+ +### `wpc-api-url` +``` +Type: string +Default: '' +Supported by: wpc +``` +Note: You can alternatively set the api url through the *WPC_API_URL* environment variable.

+ +### `wpc-api-version` +``` +Type: integer (0 - 1 - 2) +Default: 2 +Supported by: wpc +``` +PS: In many releases, you had to set this to 1 even though you were running on 2. This will be fixed in 2.9.0 +
+ +### `wpc-crypt-api-key-in-transfer` +``` +Type: boolean +Default: false +Supported by: wpc +``` +
+ +### `wpc-secret` +``` +Type: string +Default: '' +Supported by: wpc +``` +Note: This option is only relevant for api version 0. diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/cwebp.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/cwebp.md new file mode 100644 index 0000000..c749a08 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/cwebp.md @@ -0,0 +1,3 @@ +# Installing cwebp using official precompilations + +Official precompilations are available [here](https://developers.google.com/speed/webp/docs/precompiled). Since `WebPConvert` compares each binary's checksum first, you will have to change the checksums hardcoded in `Converters/Cwebp.php` if you want to replace any of them. If you feel the need of using another binary, please let us know - chances are that it should be added to the project! diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/ffmpeg.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/ffmpeg.md new file mode 100644 index 0000000..73cba30 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/ffmpeg.md @@ -0,0 +1,15 @@ +# Installing FFMpeg +Its very easy. + + +# Ubuntu +Here is a tutorial for ubuntu: https://linuxize.com/post/how-to-install-ffmpeg-on-ubuntu-18-04/ + +## GitHub actions workflow +As easy as adding this step to your workflow yaml: + +```yaml +- name: Setup ffmpeg + uses: FedericoCarboni/setup-ffmpeg@v1 +``` +docs: https://github.com/marketplace/actions/setup-ffmpeg diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gd.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gd.md new file mode 100644 index 0000000..4198175 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gd.md @@ -0,0 +1,19 @@ +# Installing Gd extension with WebP support + +## Ubuntu 18.04 + +On Ubuntu 18.04, I did not have to do anything special to configure Gd for WebP support. The following worked right away: +``` +sudo apt-get install php7.2-gd +``` + +## Ubuntu 16.04 +The official page with installation instructions is [available here](http://il1.php.net/manual/en/image.installation.php) + +In summary: + +PHP 5.5.0: +To get WebP support for `gd` in PHP 5.5.0, PHP must be configured with the `--with-vpx-dir` flag. + +PHP >7.0.0: +PHP has to be configured with the `--with-webp-dir` flag diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gmagick-extension.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gmagick-extension.md new file mode 100644 index 0000000..ea1ee9d --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gmagick-extension.md @@ -0,0 +1,40 @@ +# Installing GMagick PHP extension with WebP support + +See: +https://github.com/rosell-dk/webp-convert/issues/37 + +## MX-19.4 +I succeeded by simply doing the following after installing graphicsmagick, libwebp and libwebp-dev: +``` +sudo apt install php-gmagick +sudo service apache2 restart +``` +Note: For some reason this disables the imagick extension. It seems they cannot both be installed at the same time. + + +## Ubuntu 18.04, using *PECL* +In Ubuntu 18.04, you will not have to do any special steps in order to compile with webp :) + +1. Find out which version of PHP you are using and the location of the relevant php.ini file. Both of these can be obtained with `phpinfo();` +2. Find out which is the latest version of *gmagick* on pecl. https://pecl.php.net/package/gmagick +3. Do the following - but alter to use the info you just collected + +``` +sudo apt-get update +sudo apt-get install graphicsmagick gcc libgraphicsmagick1-dev php-pear php7.2-dev +sudo pecl install gmagick-2.0.5RC1 +sudo echo "extension=gmagick.so" >> /etc/php/7.2/apache2/php.ini +sudo service apache2 restart +``` + +Notes: +- The php-pear contains *pecl*. +- *php7.2-dev* provides *phpize*, which is needed by pecl. Use *php7.1-dev*, if you are on PHP 7.1 +- We do not simply do a `pecl install gmagick` because the latest package is in beta, and pecl would not allow. You should however be able to do *pecl install gmagick-beta*, which should install the latest beta. +- If you are on *fpm*, remember to restart that as well (ie `sudo service php7.2-fpm restart`) + +## Plesk +https://support.plesk.com/hc/en-us/articles/115003511013-How-to-install-Gmagick-PHP-extension-on-Ubuntu-Debian- + +## From source +https://duntuk.com/how-install-graphicsmagick-gmagick-php-extension diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/imagick-extension.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/imagick-extension.md new file mode 100644 index 0000000..9453be8 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/imagick-extension.md @@ -0,0 +1,80 @@ +# Installing Imagick extension with WebP support + +## MX-19.4 +I succeeded by simply doing the following after installing imagemagick, libwebp and libwebp-dev: +``` +sudo apt install php-imagick +sudo service apache2 restart +``` + +## Ubuntu 16.04 +In order to get imagick with WebP on Ubuntu 16.04, you (currently) need to: +1. [Compile libwebp from source](https://developers.google.com/speed/webp/docs/compiling) +2. [Compile imagemagick from source](https://www.imagemagick.org/script/install-source.php) (```./configure --with-webp=yes```) +3. Compile php-imagick from source, phpize it and add ```extension=/path/to/imagick.so``` to php.ini + +## Ubuntu 18.04 (from source) +A simple `sudo apt-get install php-imagick` unfortunately does not give you webp support. +Again, you must: + +### 1. Compile libwebp from source +Instructions are [here](https://developers.google.com/speed/webp/docs/compiling). +In short, you need to: +``` +sudo apt-get install libjpeg-dev libpng-dev +wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.1.0.tar.gz +tar xvzf libwebp-1.1.0.tar.gz +cd into the dir +./configure +make +sudo make install +``` + +### 2. Compile *imagemagick* from source, configured with *webp* +See tutorial [here](https://linuxconfig.org/how-to-install-imagemagick-7-on-ubuntu-18-04-linux), but configure with *webp* (`./configure --with-webp=yes`) + +``` +sudo apt-get update +sudo apt build-dep imagemagick +wget https://imagemagick.org/download/ImageMagick.tar.gz +tar xvzf ImageMagick.tar.gz +cd into the dir +./configure --with-webp=yes +sudo make +sudo make install +sudo ldconfig /usr/local/lib +sudo identify -version # to check if installed ok +make check # optional run in-depth check +``` +Check it this way: `identify -list format | grep WEBP` +- It should print a line + +### 3a. Install extension with pecl +First find out which version of PHP you are using and the location of the relevant *php.ini* file. Both of these can be obtained with `phpinfo();`. Next do the following (but alter to use the info you just collected): + +``` +sudo apt-get update +sudo apt-get install imagemagick gcc libmagickwand-dev php-pear php7.2-dev +sudo pecl install imagick +sudo echo "extension=imagick.so" >> /etc/php/7.2/apache2/php.ini +sudo service apache2 restart +``` +Related: +https://askubuntu.com/questions/769396/how-to-install-imagemagick-for-php7-on-ubuntu-16-04 + + +### 3b. Alternively to using pecl, compile php-imagick from source +https://github.com/mkoppanen/imagick +First find out which version of PHP you are using and the location of the relevant *php.ini* file. Both of these can be obtained with `phpinfo();`. Next do the following (but alter to use the info you just collected): + +``` +wget https://pecl.php.net/get/imagick-3.4.3.tgz +tar xvzf imagick-3.4.3.tgz +cd into the dir +sudo /usr/bin/phpize7.2 # note: find you version of phpize with locate phpize +./configure +make +make install +sudo echo "extension=imagick.so" >> /etc/php/7.2/apache2/php.ini +sudo service apache2 restart +``` diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/vips.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/vips.md new file mode 100644 index 0000000..e7353a0 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/vips.md @@ -0,0 +1,35 @@ +# Installing vips extension + +### Step 1: Install the vips library +Follow the instructions on the [vips library github page](https://github.com/libvips/libvips/) + +Don't forget to install required packages before running `./configure`: +``` +sudo apt-get install libglib2.0-dev pkg-config build-essential libexpat1-dev libjpeg-dev libpng-dev libwebp-dev gobject-introspection libgs-dev +``` + +### Step 2: Install the vips extension + +``` +sudo pecl install vips +``` +– And add the following to the relevant php.ini: +``` +extension=vips +``` + +(or `extension=vips.so` if you are in older PHP) + +The vips extension is btw [also on github](https://github.com/libvips/php-vips-ext): + + +## GitHub actions workflow +As easy as adding "vips" to the extensions for `setup-php@v2`: + +```yaml +- name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + extensions: vips +``` diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/migrating-to-2.0.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/migrating-to-2.0.md new file mode 100644 index 0000000..94bb8fc --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/migrating-to-2.0.md @@ -0,0 +1,73 @@ +convert# Migrating to 2.0 + +## Converting + +### Changes in conversion api +While the code have been refactored quite extensively, if you have stuck to `WebPConvert::convert()` and/or `WebPConvert::convertAndServe()`, there is only a few things you need to know. + +First and foremost: *`WebPConvert::convert` no longer returns a boolean indicating the result*. So, if conversion fails, an exception is thrown, no matter what the reason is. When migrating, you will probably need to remove some lines of code where you test the result. + +Also, a few options has been renamed and a few option defaults has been changed. + +#### The options that has been renamed are the following: + +- Two converters have changed IDs and class names: The ids that are changed are: *imagickbinary* => *imagemagick* and *gmagickbinary* => *graphicsmagick* +- In *ewww*, the `key` option has been renamed to `api-key` (or [`ewww-api-key`](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#ewww-api-key)) +- In *wpc*, the `url` option has been renamed to `api-url` (or [`wpc-api-url`](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#wpc-api-url)) +* In *cwebp*, the [`lossless`] option is now replaced with the new `encoding` option (which is not boolean, but "lossy", "lossless" or ["auto"](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md#auto-selecting-between-losslesslossy-encoding)) +* In *cwebp*, the [`autofilter`] option has been renamed to "auto-filter" +- In *gd*, the `skip-pngs` option has been removed and replaced with the general `skip` option and prefixing. So `gd-skip` amounts to the same thing, but notice that Gd no longer skips per default. + +#### The option defaults that has been changed are the following: +- the `converters` default now includes the cloud converters (*ewww* and *wpc*) and also two new converters, *vips* and *graphicsmagick*. So it is not necessary to add *ewww* or *wpc* explicitly. Also, when you set options with `converter-options` and point to a converter that isn't in the stack, in 1.3.9, this resulted in the converter automatically being added. This behavior has been removed. +- *gd* no longer skips pngs per default. To make it skip pngs, set `gd-skip` to *true* +- Default quality is now 75 for jpegs and 85 for pngs (it was 75 for both) +- For *cwebp*, the `lossless` has been removed. Use the new `encoding` option instead. +- For *wpc*, default `secret` and `api-key` are now "" (they were "my dog is white") + +### New convert options +You might also be interested in the new options available in 2.0: + +- Added a syntax for conveniently targeting specific converters. If you for example prefix the "quality" option with "gd-", it will override the "quality" option, but only for gd. +- Certain options can now be set with environment variables too ("EWWW_API_KEY", "WPC_API_KEY" and "WPC_API_URL") +- Added new *vips* converter. +- Added new *graphicsmagick* converter. +- Added new *stack* converter (the stack functionality has been moved into a converter) +- Added [`jpeg`](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#jpeg) and [`png`](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#png) options +- Added [`alpha-quality`](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#alpha-quality) option for *cwebp*, *vips*, *imagick*, *imagemagick* and *graphicsmagick*. +- Added [`auto-filter`](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#autofilter) option for *cwebp*, *imagick*, *imagemagick* and the new *vips* converter. +- Added [`encoding`](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#encoding) option (lossy | lossless | auto). lossless and auto is supported for *cwebp*, *imagick*, *imagemagick*, *graphicsmagick* and the new *vips* converter. +- Added [`near-lossless`](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#near-lossless) option for *cwebp* and *imagemagick*. +- Added [`preset`](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#preset) option for *cwebp* and the new *vips* converter. +- Added [`skip`](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#skip) option (its general and works for all converters) +- Besides the ones mentioned above, *imagemagick* now also supports [`low-memory`](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#low-memory), [`metadata`](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#metadata) ("all" or "none") and [`method`](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md#method). *imagemagick* has become very potent! + +## Serving +The classes for serving has also been refactored quite extensively, but again, if you have stuck to `WebPConvert::convertAndServe`, there is only a few things you need to know. + +First and foremost, *`WebPConvert::convertAndServe` has been renamed to `WebPConvert::serveConverted()`*. The reason for this change is that it more accurately describes what is happening: A converted file is served. The old name implied that a conversion was always going on, which is not the case (if the file at destination already exists, which is not bigger or older than the source, that file is served directly). + +Besides this, there is the following changes in options: + +- A new option `convert` has been created for supplying the conversion options. So the conversion options are no longer "mingled" with the serving options, but has its own option. +- Options regarding serving the image are now organized into its own `serve-image` setting, which again has been reorganized. +- A new option `serve-image > headers > cache-control` controls whether to set cache control header (default: false). +- The `fail` option no longer support the "report-as-image" value. It however supports a new value: "throw". +- The `fail-when-original-unavailable` option has been renamed to `fail-when-fail-fails`. In 2.0, the original not being available is no longer the only thing that can cause the fail action to fail – the library now checks the mime type of the source file and only serves it if it is either png or jpeg. +- The `error-reporting` option has been removed. The reason for it being removed is that it is considered bad practice for a library to mess with error handling. However, *this pushes the responsibility to you*. You should make sure that no warnings ends up in the output, as this will corrupt the image being served. You can for example ensure that by calling `ini_set('display_errors', '0');` or `error_reporting(0);` (or both), or by creating your own error handler. +- The `aboutToServeImageCallBack` option has been removed. You can instead extend the `ServeConvertedWebP` class and override `serveOriginal` and `serveDestination`. You can call the serve method of your extended class, but then you will not have the error handling (the `fail` and `fail-if-fail-fails` options). Too add this, you can call `ServeConvertedWebPWithErrorHandling::serve` and make sure to override the default of the last argument. +- The `aboutToPerformFailAction` option has been removed. You can instead set `fail` to `throw` and handle the exception in a *catch* clause. Or you can extend the `ServeConvertedWebPWithErrorHandling` class and override the `performFailAction` method. +- The `add-x-header-status` and `add-x-header-options` options have been removed. +- The `require-for-conversion` option has been removed. You must either use with composer or create a simple autoloader (see next section) + +## WebP On demand +If you are using the "non-composer" version of webp demand (the one where you only upload two files - `webp-on-demand-1.inc` and `webp-on-demand-2.inc`), you were probably using the `require-for-conversion` option. This option is no longer supported. But you never really needed it in the first place, because the you create and register an autoloader instead: + +```php +function autoloader($class) { + if (strpos($class, 'WebPConvert\\') === 0) { + require_once __DIR__ . '/webp-on-demand-2.inc'; + } +} +spl_autoload_register('autoloader', true, true); +``` diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/serving/introduction-for-serving.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/serving/introduction-for-serving.md new file mode 100644 index 0000000..08e605d --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/serving/introduction-for-serving.md @@ -0,0 +1,157 @@ +# Introduction to serving converted WebP files with WebPConvert + +**NOTE: This document only applies to the upcoming 2.0 version** + +The classes for serving first and foremost helps you handle the cached files intelligently (not serving them if they are larger or older than the original). It also provides a convenient way to deal with conversion failures and setting headers. + + +In the following example, all available *serve* options are explicitly set to their default values. + +```php +use WebPConvert\WebPConvert; + +WebPConvert::serveConverted($source, $destination, [ + + // failure handling + 'fail' => 'original', // ('original' | 404' | 'throw' | 'report') + 'fail-when-fail-fails' => 'throw', // ('original' | 404' | 'throw' | 'report') + + // options influencing the decision process of what to be served + 'reconvert' => false, // if true, existing (cached) image will be discarded + 'serve-original' => false, // if true, the original image will be served rather than the converted + 'show-report' => false, // if true, a report will be output rather than the raw image + + // warning handling + 'suppress-warnings' => true, // if you set to false, make sure that warnings are not echoed out! + + // options when serving an image (be it the webp or the original, if the original is smaller than the webp) + 'serve-image' => [ + 'headers' => [ + 'cache-control' => true, + 'content-length' => true, + 'content-type' => true, + 'expires' => false, + 'last-modified' => true, + 'vary-accept' => false + ], + 'cache-control-header' => 'public, max-age=31536000', + ], + + // redirect tweak + 'redirect-to-self-instead-of-serving' => false, // if true, a redirect will be issues rather than serving + + 'convert' => [ + // options for converting goes here + 'quality' => 'auto', + ] +]); +``` + +## Failure handling +The `fail` option gives you an easy way to handle errors. Setting it to 'original' tells it to handle errors by serving the original file instead (*$source*). This could be a good choice on production servers. On development servers, 'throw' might be a good option. It simply rethrows the exception that was thrown by *WebPConvert::convert()*. '404' could also be an option, but it has the weakness that it will probably only be discovered by real persons seeing a missing image. + +The fail action might fail too. For example, if it is set to 'original' and the failure is that the original file doesn't exist. Or, more delicately, it may have a wrong mime type - our serve method will not let itself be tricked into serving *exe* files as the 'original'. Anyway, you can control what to do when fail fails using the *fail-when-fail-fails* option. If that fails too, the original exception is thrown. The fun stops there, there is no "fail-when-fail-when-fail-fails" option to customize this. + +The failure handling is implemented as an extra layer. You can bypass it by calling `WebPConvert\Serve\ServeConvertedWebP::serve()` directly. Doing that will give the same result as if you set `fail` to 'throw'. + +## Options influencing the decision process +The default process is like this: + +1. Is there a file at the destination? If not, trigger conversion +2. Is the destination older than the source? If yes, delete destination and trigger conversion +3. Serve the smallest file (destination or source) + +You can influence the process with the following options: + +*reconvert* +If you set *reconvert* to true, the destination and conversion is triggered (between step 1 and 2) + +*serve-original* +If you set *serve-original* to true, process will take its cause from (1) to (2) and then end with source being served. + +*show-report* +If you set `show-report`, the process is skipped entirely, and instead a report is generated of how a fresh conversion using the supplied options goes. + +## Headers +Leaving errors and reports out of account for a moment, the *WebPConvert::serveConverted()* ultimately has two possible outcomes: Either a converted image is served or - if smaller - the source image. If the source is to be served, its mime type will be detected in order to make sure it is an image and to be able to set the content type header. Either way, the actual serving is passed to `Serve\ServeFile::serve`. The main purpose of this class is to add/set headers. + +#### *Cache-Control* and *Expires* headers +Default behavior is to neither set the *Cache-Control* nor the *Expires* header. Once you are on production, you will probably want to turn these on. The default is btw one year (31536000 seconds). I recommend the following for production: + +``` +'serve-image' => [ + 'headers' => [ + 'cache-control' => true, + 'expires' => false, + ], + 'cache-control-header' => 'public, max-age=31536000', +], +``` + +The value for the *Expires* header is calculated from "max-age" found in the *cache-control-header* option and the time of the request. The result is an absolute time, ie "Expires: Thu, 07 May 2020 07:02:37 GMT". As most browsers now supports the *Cache-Control* header, *from a performance perspective*, there is no need to also add the expires header. However, some tools complains if you don't (gtmetrix allegedly), and there is no harm in adding both headers. More on this discussion [[here]](https://github.com/rosell-dk/webp-convert/issues/126). + +#### *Vary: Accept* header +This library can be used as part of a solution that serves webp files to browsers that supports it, while serving the original file to browsers that does not *on the same URL*. Such a solution typically inspects the *Accept* request header in order to determine if the client supports webp or not. Thus, the response will *vary* along with the "Accept" header and the world (and proxies) should be informed about this, so they don't end up serving cached webps to browsers that does not support it. To add the "Vary: Accept" header, simply set the *serve-image > headers > vary-accept* option to true. + +#### *Last-Modified* header +The Last-Modified header is also used for caching purposes. You should leave that setting on, unless you set it by other means. You control it with the *serve-image > headers > last-modified* option. + +#### *Content-Type* header +The *Content-Type* header tells browsers what they are receiving. This is important information and you should leave the *serve-image > headers > content-type* option at its default (true), unless you set it by other means. + +When the outcome is to serve a webp, the header will be set to: "Content-Type: image/webp". When the original is to be served, the library will try to detect the mime type of the file and set the content type accordingly. The [image-mime-type-guesser](https://github.com/rosell-dk/image-mime-type-guesser) library is used for that. + +#### *Content-Length* header +The *Content-Length* header tells browsers the length of the content. According to [the specs](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13), it should be set unless it is prohibited by rules in [section 4.4](https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4). In that section we learn that it should not be set when the *Transfer-Encoding* header is set (which it often is, to "chunked"). However, no harm done, because it also says that clients should ignore the header in case *Transfer-Encoding* is set. From this I concluded that it makes sense to default the *serve-image > headers > content-length* to true. I might however change this in case I should learn that the header could be problematic in some way. So if you decided you want it, do not rely on the default, but set it to *true*. See discussion on this subject [here](https://stackoverflow.com/questions/3854842/content-length-header-with-head-requests/3854983#3854983). + +#### *X-WebP-Convert-Log* headers +The serve method adds *X-WebP-Convert-Log* headers in order to let you know what went on. +For example, if there is no converted image and conversion was successful, the following headers will be sent: + +``` +X-WebP-Convert-Log: Converting (there were no file at destination) +X-WebP-Convert-Log: Serving converted file +``` + +On the next call (presuming the webp has not been deleted), no conversion is needed and you should simply see: +``` +X-WebP-Convert-Log: Serving converted file +``` + +But say that the first conversion actually failed. In case you have permission problems, the output could be: +``` +X-WebP-Convert-Log: Converting (there were no file at destination) +X-WebP-Convert-Log: Failed creating folder. Check the permissions! +X-WebP-Convert-Log: Performing fail action: original +``` + +In case the problem is that the conversion failed, you could see the following: +``` +X-WebP-Convert-Log: Converting (there were no file at destination) +X-WebP-Convert-Log: None of the converters in the stack are operational +X-WebP-Convert-Log: Performing fail action: original +``` + +If you need more info about the conversion process in order to learn why the converters aren't working, enable the *show-report* option. + +As a last example, say you have supplied a non-existing file as source and `fail` is set to "original" (which will also fail). Result: +``` +X-WebP-Convert-Log: Source file was not found +X-WebP-Convert-Log: Performing fail action: original +X-WebP-Convert-Log: Performing fail action: throw +``` + +## The redirect tweak (will be available in 2.3.0) +There are cases where serving the image directly with PHP isn't optimal. + +One case is WP Engine. Even though webp-convert adds a Vary:Accept header, the header is not present in the response on WP Engine. It is somehow overwritten by the caching machinery and set to Vary:Accept-Encoding, Cookie. + +If however rules have been set up to redirect images directly to existing webps, one can overcome the problem by redirecting the image request back to itself rather than serving the webp directly. + +You can achieve this by setting the *redirect-to-self-instead-of-serving* option to true. + +Beware of risk of an endless redirect loop. Such loop will happen if the redirection to existing webp rules aren't set up correctly. To prevent this, it is recommended that you only set the option to true after checking that the destination file does not exist. But note that this check does not completely prevent such loops occurring when redirection to existing rules are missing - as the 302 redirect could get cached (it does that on WP Engine). So bottom line: Only use this feature when you have server rules set up for redirecting images to their corresponding webp images (for client that supports webp) - *and you are certain that these rules works*. + +## More info + +- The complete api is available [here](https://www.bitwise-it.dk/webp-convert/api/2.0/html/index.xhtml) diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/serving/laravel-nginx-serving.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/serving/laravel-nginx-serving.md new file mode 100644 index 0000000..d4a9118 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/serving/laravel-nginx-serving.md @@ -0,0 +1,116 @@ +# Serving WebP from a Laravel Nginx site + +**NOTE: This document only applies to the upcoming 2.0 version** + +This should work with most php sites although I'm basing the Nginx configuration around what's commonly seen with Laravel installations. + +Create webp converter script in ```project_root/public/webp-on-demand.php``` + +``` + 'original', // If failure, serve the original image (source). Other options include 'throw', '404' and 'report' + // 'show-report' => true, // Generates a report instead of serving an image + + 'serve-image' => [ + 'headers' => [ + 'cache-control' => true, + 'vary-accept' => true, + // other headers can be toggled... + ], + 'cache-control-header' => 'max-age=2', + ], + +'convert' => [ + // all convert option can be entered here (ie "quality") + ], +]); + +``` + + +### Configure Nginx + +We just need to add the following block to our site in ```/etc/sites-enabled/``` + +``` +location ~* ^/.*\.(png|jpe?g)$ { + add_header Vary Accept; + expires 365d; + if ($http_accept !~* "webp"){ + break; + } + try_files + $uri.webp + /webp-on-demand.php?source=$uri + ; +} +``` + +Then reload Nginx ```sudo systemctl restart nginx``` + +The full Nginx block should look like + +``` +server { + server_name webp-testing.com; + root /home/forge/webp-testing.com/public; + + index index.html index.htm index.php; + + charset utf-8; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~* ^/.*\.(png|jpe?g)$ { + add_header Vary Accept; + expires 365d; + if ($http_accept !~* "webp"){ + break; + } + try_files + $uri.webp + /webp-on-demand.php?source=$uri + ; + } + + location = /favicon.ico { access_log off; log_not_found off; } + location = /robots.txt { access_log off; log_not_found off; } + + access_log off; + error_log /var/log/nginx/webp-testing.com-error.log error; + + error_page 404 /index.php; + + location ~ \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; + fastcgi_index index.php; + include fastcgi_params; + } + + location ~ /\.(?!well-known).* { + deny all; + } + + # cache static assets + location ~* \.(gif|ico|css|pdf|svg)$ { + expires 365d; + } + + location ~* \.(js)$ { + add_header Cache-Control no-cache; + } + +} +``` diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/webp-on-demand/tweaks.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/webp-on-demand/tweaks.md new file mode 100644 index 0000000..585b81c --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/webp-on-demand/tweaks.md @@ -0,0 +1,181 @@ +# Tweaks + +## Store converted images in separate folder + +In most cases, you probably want the cache of converted images to be stored in their own folder rather than have them mingled with the source files. + +To have have the cache folder contain a file structure mirroring the structure of the original files, you can do this: + +```php +$applicationRoot = $_SERVER["DOCUMENT_ROOT"]; // If your application is not in document root, you can change accordingly. +$imageRoot = $applicationRoot . '/webp-images'; // Change to where you want the webp images to be saved +$sourceRel = substr($source, strlen($applicationRoot)); +$destination = $imageRoot . $sourceRel . '.webp'; +``` + +If your images are stored outside document root (a rare case), you can simply use the complete absolute path: +```php +$destination = $imageRoot . $source . '.webp'; // pst: $source is an absolute path, and starts with '/' +``` +This will ie store a converted image in */var/www/example.com/public_html/app/webp-images/var/www/example.com/images/logo.jpg.webp* + +If your application can be configured to store outside document root, but rarely is, you can go for this structure: + +```php +$docRoot = $_SERVER["DOCUMENT_ROOT"]; +$imageRoot = $contentDirAbs . '/webp-images'; + +if (substr($source, 0, strlen($docRoot)) === $docRoot) { + // Source file is residing inside document root. + // We can store relative to that. + $sourceRel = substr($source, strlen($docRoot)); + $destination = $imageRoot . '/doc-root' . $sourceRel . '.webp'; +} else { + // Source file is residing outside document root. + // we must add complete path to structure + $destination = $imageRoot . '/abs' . $source . '.webp'; +} +``` + +If you do not know the application root beforehand, and thus do not know the appropriate root for the converted images, see next tweak. + + +## Get the application root automatically +When you want destination files to be put in their own folder, you need to know the root of the application (the folder in which the .htaccess rules resides). In most applications, you know the root. In many cases, it is simply the document root. However, if you are writing an extension, plugin or module to a framework that can be installed in a subfolder, you may have trouble finding it. Many applications have a *index.php* in the root, which can get it with `__DIR__`. However, you do not want to run an entire bootstrap each time you serve an image. Obviously, to get around this, you can place *webp-on-demand.php* in the webroot. However, some frameworks, such as Wordpress, will not allow a plugin to put a file in the root. Now, how could we determine the application root from a file inside some subdir? Here are three suggestions: + +1. You could traverse parent folders until you find a file you expect to be in application root (ie a .htaccess containing the string "webp-on-demand.php"). This should work. +2. If the rules in the *.htaccess* file are generated by your application, you probably have access to the path at generation time. You can then simply put the path in the *.htaccess*, as an extra parameter to the script (or better: the relative path from document root to the application). +3. You can use the following hack: + +### The hack +The idea is to grab the URL path of the image in the *.htaccess* and pass it to the script. Assuming that the URL paths always matches the file paths, we can get the application root by subtracting that relative path to source from the absolute path to source. + +In *.htaccess*, we grab the url-path by appending "&url-path=$1.$2" to the rewrite rule: +``` +RewriteRule ^(.*)\.(jpe?g|png)$ webp-on-demand.php?source=%{SCRIPT_FILENAME}&url-path=$1.$2 [NC,L] +``` + +In the script, we can then calculate the application root like this: + +```php +$applicationRoot = substr($_GET['source'], 0, -strlen($_GET['url-path'])); +``` + +## CDN +To work properly with a CDN, a "Vary Accept" header should be added when serving images. This is a declaration that the response varies with the *Accept* header (recall that we inspect *Accept* header in the .htaccess to determine if the browsers supports webp images). If this header is missing, the CDN will see no reason to cache separate images depending on the Accept header. + +Add this snippet to the *.htaccess* to make webp-on-demand work with CDN's: + +``` + + SetEnvIf Request_URI "\.(jpe?g|png)" ADDVARY + + # Declare that the response varies depending on the accept header. + # The purpose is to make CDN cache both original images and converted images. + Header append "Vary" "Accept" env=ADDVARY + +``` + +***Note:*** When configuring the CDN, you must make sure to set it up to forward the the "Accept" header to your origin server. + + + +## Make .htaccess route directly to existing images + +There may be a performance benefit of using the *.htaccess* file to route to already converted images, instead of letting the PHP script serve it. Note however: +- If you do the routing in .htaccess, the solution will not be able to discard converted images when original images are updated. +- Performance benefit may be insignificant (*WebPConvertAndServe* class is not autoloaded when serving existing images) + +Add the following to the *.htaccess* to make it route to existing converted images. Place it above the # Redirect images to webp-on-demand.php" comment. Take care of replacing [[your-base-path]] with the directory your *.htaccess* lives in (relative to document root, and [[your-destination-root]] with the directory the converted images resides. +``` + # Redirect to existing converted image (under appropriate circumstances) + RewriteCond %{HTTP_ACCEPT} image/webp + RewriteCond %{DOCUMENT_ROOT}/[[your-base-path]]/[[your-destination-root]]/$1.$2.webp -f + RewriteRule ^\/?(.*)\.(jpe?g|png)$ /[[your-base-path]]/[[your-destination-root]]/$1.$2.webp [NC,T=image/webp,L] +``` +*edit:* Removed the QSD flag from the RewriteRule because it is not supported in Apache < 2.4 (and it [triggers error](https://github.com/rosell-dk/webp-express/issues/155)) + +Note however that DOCUMENT_ROOT can be unreliable. + +If you store the webp images in the same folder as the originals and append ".webp" (rather than replace the file extension), you can do this instead: + +``` +# Redirect to existing converted image (under appropriate circumstances) +RewriteCond %{HTTP_ACCEPT} image/webp +RewriteCond %{REQUEST_FILENAME}.webp -f +RewriteRule ^/?(.+)\.(jpe?g|png)$ $1.$2.webp [T=image/webp,L] +``` + + +RewriteCond %{REQUEST_FILENAME}.webp -f + +### Redirect with CDN support +If you are using a CDN, and want to redirect to existing images with the .htaccess, it is a good idea to add a "Vary Accept" header. This instructs the CDN that the response varies with the *Accept* header (we do not need to do that when routing to webp-on-demand.php, because the script takes care of adding this header, when appropriate.) + +You can achieve redirect with CDN support with the following rules: +``` + + + RewriteEngine On + + # Redirect to existing converted image (under appropriate circumstances) + RewriteCond %{HTTP_ACCEPT} image/webp + RewriteCond %{DOCUMENT_ROOT}/[[your-base-path]]/[[your-destination-root]]/$1.$2.webp -f + RewriteRule ^\/?(.*)\.(jpe?g|png)$ /[[your-base-path]]/[[your-destination-root]]/$1.$2.webp [NC,T=image/webp,QSD,E=WEBPACCEPT:1,L] + + # Redirect images to webp-on-demand.php (if browser supports webp) + RewriteCond %{HTTP_ACCEPT} image/webp + RewriteRule ^(.*)\.(jpe?g|png)$ webp-on-demand.php?source=%{SCRIPT_FILENAME}&url-path=$1.$2 [NC,L] + + + + + # Apache appends "REDIRECT_" in front of the environment variables, but LiteSpeed does not. + # These next line is for Apache, in order to set environment variables without "REDIRECT_" + SetEnvIf REDIRECT_WEBPACCEPT 1 WEBPACCEPT=1 + + # Make CDN caching possible. + # The effect is that the CDN will cache both the webp image and the jpeg/png image and return the proper + # image to the proper clients (for this to work, make sure to set up CDN to forward the "Accept" header) + Header append Vary Accept env=WEBPACCEPT + + +AddType image/webp .webp +``` + +## Forward the querystring +By forwarding the query string, you can allow control directly from the URL. You could for example make it possible to add "?debug" to an image URL, and thereby getting a conversion report. Or make "?reconvert" force reconversion. + +In order to forward the query string, you need to add this condition before the RewriteRule that redirects to *webp-on-demand.php*: +``` +RewriteCond %{QUERY_STRING} (.*) +``` +That condition will always be met. The side effect is that it stores the match (the complete querystring). That match will be available as %1 in the RewriteRule. So, in the RewriteRule, we will have to add "&%1" after the last argument. Here is a complete solution: +``` + + RewriteEngine On + + # Redirect images to webp-on-demand.php (if browser supports webp) + RewriteCond %{HTTP_ACCEPT} image/webp + RewriteCond %{QUERY_STRING} (.*) + RewriteRule ^(.*)\.(jpe?g|png)$ webp-on-demand.php?source=%{SCRIPT_FILENAME}&%1 [NC,L] + + +AddType image/webp .webp +``` + +Of course, in order to *do* something with that querystring, you must use them in your *webp-on-demand.php* script. You could for example use them directly in the options array sent to the *convertAndServe()* method. To achieve the mentioned "debug" and "reconvert" features, do this: +```php +$options = [ + 'show-report' => isset($_GET['debug']), + 'reconvert' => isset($_GET['reconvert']), + 'serve-original' => isset($_GET['original']), +]; +``` + +*EDIT:* +I have just discovered a simpler way to achieve the querystring forward: The [QSA flag](https://httpd.apache.org/docs/trunk/rewrite/flags.html). +So, simply set the QSA flag in the RewriteRule, and nothing more: +``` +RewriteRule ^(.*)\.(jpe?g|png)$ webp-on-demand.php?source=%{SCRIPT_FILENAME} [NC,QSA,L] +``` diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/webp-on-demand/webp-on-demand.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/webp-on-demand/webp-on-demand.md new file mode 100644 index 0000000..6844524 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/webp-on-demand/webp-on-demand.md @@ -0,0 +1,145 @@ +# WebP on demand + +This is a solution for automatically serving WebP images instead of jpeg/pngs [for browsers that supports WebP](https://caniuse.com/#feat=webp) (At the time of writing, 78% of all mobile users and 72% of all desktop users uses browsers supporting webp) + +Once set up, it will automatically convert images, no matter how they are referenced. It for example also works on images referenced in CSS. As the solution does not require any change in the HTML, it can easily be integrated into any website / framework + +## Overview + +A setup consists of a PHP script that serves converted images and some *redirect rules* that redirects JPG/PNG images to the script. + + +## Requirements + +* *Apache* or *LiteSpeed* web server. Can be made to work with *NGINX* as well. Documentation is on the roadmap. +* *mod_rewrite* module for Apache +* PHP >= 5.6 (we are only testing down to 5.6. It should however work in 5.5 as well) +* That one of the *webp-convert* converters are working (these have different requirements) + +## Installation + +Here we assume you are using Composer. [Not using composer? - Follow me!](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/webp-on-demand/without-composer.md) + +### 1. Require the webp-convert library with composer +``` +composer require rosell-dk/webp-convert +``` + +### 2. Create the script + +Create a file *webp-on-demand.php*, and place it in webroot, or where-ever you like in you web-application. + +Here is a minimal example to get started with: + +```php + true // Show a conversion report instead of serving the converted image. + + // More options available! + // https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md + // https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/serving/introduction-for-serving.md +]; +WebPConvert::serveConverted($source, $destination, $options); +``` + +### 3. Add redirect rules +Place the following rewrite rules in a *.htaccess* file in the directory where you want the solution to take effect: + +``` + + RewriteEngine On + + # Redirect images to webp-on-demand.php (if browser supports webp) + RewriteCond %{HTTP_ACCEPT} image/webp + RewriteCond %{REQUEST_FILENAME} -f + RewriteRule ^(.*)\.(jpe?g|png)$ webp-on-demand.php?source=%{SCRIPT_FILENAME} [NC,L] + + +AddType image/webp .webp +``` +If you have placed *webp-on-demand.php* in a subfolder, you will need to change the rewrite rule accordingly. + +The `RewriteCond %{REQUEST_FILENAME} -f` is not strictly necessary, but there to be sure that we got an existing file, and it could perhaps also prevent some undiscovered way of misuse. + +### 4. Validate that it works + +Browse to a JPEG image. Instead of an image, you should see a conversion report. Hopefully, you get a success. Otherwise, you need to hook up to a cloud converter or try to meet the requirements for cwebp, gd or imagick. + +Once you get a successful conversion, you can uncomment the "show-report" option in the script. + +It should work now, but to be absolute sure: + +- Visit a page on your site with an image on it, using *Google Chrome*. +- Right-click the page and choose "Inspect" +- Click the "Network" tab +- Reload the page +- Find a jpeg or png image in the list. In the "type" column, it should say "webp". There should also be a *X-WebP-Convert-Status* header on the image that provides some insights on how things went. + + +### 5. Try this improvement and see if it works + +It seems that it is not necessary to pass the filename in the query string. + +Try replacing `$source = $_GET['source'];` in the script with the following: + +```php +$docRoot = rtrim($_SERVER["DOCUMENT_ROOT"], '/'); +$requestUriNoQS = explode('?', $_SERVER['REQUEST_URI'])[0]; +$source = $docRoot . urldecode($requestUriNoQS); +``` + +And you can then remove `?source=%{SCRIPT_FILENAME}` from the `.htaccess` file. + +There are some benefits of not passing in query string: +1. Passing a path in the query string may be blocked by a firewall, as it looks suspicious. +2. The script called to convert arbitrary files +3. One person experienced problems with spaces in filenames passed in the query string. See [this issue](https://github.com/rosell-dk/webp-convert/issues/95) + + +### 6. Customizing and tweaking + +Basic customizing is done by setting options in the `$options` array. Check out the [docs on convert()](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/convert.md) and the [docs on convertAndServe()](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/serving/convert-and-serve.md) + +Other tweaking is described in *docs/webp-on-demand/tweaks.md*: +- [Store converted images in separate folder](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/webp-on-demand/tweaks.md#store-converted-images-in-separate-folder) +- [CDN](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/webp-on-demand/tweaks.md#cdn) +- [Make .htaccess route directly to existing images](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/webp-on-demand/tweaks.md#make-htaccess-route-directly-to-existing-images) +- [Forward the query string](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/webp-on-demand/tweaks.md#forward-the-querystring) + + +## Troubleshooting + +### The redirect rule doesn't seem to be working +If images are neither routed to the converter or a 404, it means that the redirect rule isn't taking effect. Common reasons for this includes: + +- Perhaps there are other rules in your *.htaccess* that interfere with the rules? +- Perhaps your site is on *Apache*, but it has been configured to use *Nginx* to serve image files. To find out which server that is handling the images, browse to an image and eximine the "Server" response header. In case *NGINX* are serving images, see if you can reconfigure your server setup. Alternatively, you can create *NGINX* rewrite rules. There are some [here](https://github.com/S1SYPHOS/kirby-webp#nginx) and [there](https://github.com/uhop/grunt-tight-sprite/wiki/Recipe:-serve-WebP-with-nginx-conditionally). +- Perhaps the server isn't configured to allow *.htaccess* files? Try inserting rubbish in the top of the *.htaccess* file and refresh. You should now see an *Internal Server Error* error page. If you don't, your *.htaccess* file is ignored. Probably you will need to set *AllowOverride All* in your Virtual Host. [Look here for more help]( +https://docs.bolt.cm/3.4/howto/making-sure-htaccess-works#test-if-htaccess-is-working) +- Perhaps the Apache *mod_rewrite* extension isn't enabled? Try removing both `` and `` lines: if you get an *Internal Server Error* error page after this change, it's probably that it's indeed not enabled. + + +## Related +* https://www.maxcdn.com/blog/how-to-reduce-image-size-with-webp-automagically/ +* https://www.digitalocean.com/community/tutorials/how-to-create-and-serve-webp-images-to-speed-up-your-website diff --git a/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/webp-on-demand/without-composer.md b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/webp-on-demand/without-composer.md new file mode 100644 index 0000000..9707c7b --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/docs/v2.0/webp-on-demand/without-composer.md @@ -0,0 +1,58 @@ +# WebP On Demand without composer + +For your convenience, the library has been cooked down to two files: *webp-on-demand-1.inc* and *webp-on-demand-2.inc*. The second one is loaded when the first one decides it needs to do a conversion (and not simply serve existing image). + +## Installing + +### 1. Copy the latest build files into your website +The build files are distributed [here](https://github.com/rosell-dk/webp-convert-concat/tree/master/build). Open the "latest" folder and copy *webp-on-demand-1.inc* and *webp-on-demand-2.inc* into your website. They can be located wherever you like. + +### 2. Create a *webp-on-demand.php* + +Create a file *webp-on-demand.php*, and place it in webroot, or where-ever you like in you web-application. + +Here is a minimal example to get started with: + +```php + true // Show a conversion report instead of serving the converted image. + + // More options available! + // https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md + // https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/serving/introduction-for-serving.md +]; +WebPConvert::serveConverted($source, $destination, $options); +``` + +Note that the procedure has changed in 2.0. In 1.x, the library supported a `require-for-conversion` option, but this option has been removed in 2.0. It was not really needed, as the example above illustrates. + +### 3. Continue the regular install instructions from step 3 +[Click here to continue...](https://github.com/rosell-dk/webp-on-demand#3-add-redirect-rules) diff --git a/is_themecore/vendor/rosell-dk/webp-convert/phpcs-ruleset.xml b/is_themecore/vendor/rosell-dk/webp-convert/phpcs-ruleset.xml new file mode 100644 index 0000000..37d5689 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/phpcs-ruleset.xml @@ -0,0 +1,8 @@ + + + PSR2 without line ending rule - let git manage the EOL cross the platforms + + + + + diff --git a/is_themecore/vendor/rosell-dk/webp-convert/phpunit-41.xml.dist b/is_themecore/vendor/rosell-dk/webp-convert/phpunit-41.xml.dist new file mode 100644 index 0000000..e45b1e0 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/phpunit-41.xml.dist @@ -0,0 +1,39 @@ + + + + + + ./tests/ + + + + + + src/ + + ./vendor + ./tests + + + + + + + + + + + + diff --git a/is_themecore/vendor/rosell-dk/webp-convert/phpunit-with-coverage.xml.dist b/is_themecore/vendor/rosell-dk/webp-convert/phpunit-with-coverage.xml.dist new file mode 100644 index 0000000..15c9673 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/phpunit-with-coverage.xml.dist @@ -0,0 +1,25 @@ + + + + + src/ + + + ./vendor + ./tests + + + + + + + + + + ./tests/ + + + + + + diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/ConverterFactory.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/ConverterFactory.php new file mode 100644 index 0000000..01a16b4 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/ConverterFactory.php @@ -0,0 +1,112 @@ + + * @since Class available since Release 2.0.0 + */ +class ConverterFactory +{ + /** + * Get classname of a converter (by id) + * + * @param string $converterId Id of converter (ie "cwebp") + * + * @throws ConverterNotFoundException If there is no converter with that id. + * @return string Fully qualified class name of converter + */ + public static function converterIdToClassname($converterId) + { + switch ($converterId) { + case 'ffmpeg': + $classNameShort = 'FFMpeg'; + break; + case 'imagickbinary': + $classNameShort = 'ImagickBinary'; + break; + case 'imagemagick': + $classNameShort = 'ImageMagick'; + break; + case 'gmagickbinary': + $classNameShort = 'GmagickBinary'; + break; + case 'graphicsmagick': + $classNameShort = 'GraphicsMagick'; + break; + default: + $classNameShort = ucfirst($converterId); + } + $className = 'WebPConvert\\Convert\\Converters\\' . $classNameShort; + if (is_callable([$className, 'convert'])) { + return $className; + } else { + throw new ConverterNotFoundException('There is no converter with id:' . $converterId); + } + } + + /** + * Make a converter instance by class name. + * + * @param string $converterClassName Fully qualified class name + * @param string $source The path to the file to convert + * @param string $destination The path to save the converted file to + * @param array $options (optional) + * @param \WebPConvert\Loggers\BaseLogger $logger (optional) + * + * @throws ConverterNotFoundException If the specified converter class isn't found + * @return AbstractConverter An instance of the specified converter + */ + public static function makeConverterFromClassname( + $converterClassName, + $source, + $destination, + $options = [], + $logger = null + ) { + if (!is_callable([$converterClassName, 'convert'])) { + throw new ConverterNotFoundException( + 'There is no converter with class name:' . $converterClassName . ' (or it is not a converter)' + ); + } + //$converter = new $converterClassName($source, $destination, $options, $logger); + + return call_user_func( + [$converterClassName, 'createInstance'], + $source, + $destination, + $options, + $logger + ); + } + + /** + * Make a converter instance by either id or class name. + * + * @param string $converterIdOrClassName Either a converter ID or a fully qualified class name + * @param string $source The path to the file to convert + * @param string $destination The path to save the converted file to + * @param array $options (optional) + * @param \WebPConvert\Loggers\BaseLogger $logger (optional) + * + * @throws ConverterNotFoundException If the specified converter class isn't found + * @return AbstractConverter An instance of the specified converter + */ + public static function makeConverter($converterIdOrClassName, $source, $destination, $options = [], $logger = null) + { + // We take it that all lowercase means it is an id rather than a class name + if (strtolower($converterIdOrClassName) == $converterIdOrClassName) { + $converterClassName = self::converterIdToClassname($converterIdOrClassName); + } else { + $converterClassName = $converterIdOrClassName; + } + + return self::makeConverterFromClassname($converterClassName, $source, $destination, $options, $logger); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/AbstractConverter.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/AbstractConverter.php new file mode 100644 index 0000000..d11284b --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/AbstractConverter.php @@ -0,0 +1,387 @@ + + * @since Class available since Release 2.0.0 + */ +abstract class AbstractConverter +{ + use AutoQualityTrait; + use OptionsTrait; + use WarningLoggerTrait; + use DestinationPreparationTrait; + use LoggerTrait; + + /** + * The actual conversion is be done by a concrete converter extending this class. + * + * At the stage this method is called, the abstract converter has taken preparational steps. + * - It has created the destination folder (if neccesary) + * - It has checked the input (valid mime type) + * - It has set up an error handler, mostly in order to catch and log warnings during the doConvert fase + * + * Note: This method is not meant to be called from the outside. Use the static *convert* method for converting + * or, if you wish, create an instance with ::createInstance() and then call ::doConvert() + * + * @throws ConversionFailedException in case conversion failed in an antipiciated way (or subclass) + * @throws \Exception in case conversion failed in an unantipiciated way + */ + abstract protected function doActualConvert(); + + /** + * Whether or not the converter supports lossless encoding (even for jpegs) + * + * PS: Converters that supports lossless encoding all use the EncodingAutoTrait, which + * overrides this function. + * + * @return boolean Whether the converter supports lossless encoding (even for jpegs). + */ + public function supportsLossless() + { + return false; + } + + /** @var string The filename of the image to convert (complete path) */ + protected $source; + + /** @var string Where to save the webp (complete path) */ + protected $destination; + + /** + * Check basis operationality + * + * Converters may override this method for the purpose of performing basic operationaly checks. It is for + * running general operation checks for a conversion method. + * If some requirement is not met, it should throw a ConverterNotOperationalException (or subtype) + * + * The method is called internally right before calling doActualConvert() method. + * - It SHOULD take options into account when relevant. For example, a missing api key for a + * cloud converter should be detected here + * - It should NOT take the actual filename into consideration, as the purpose is *general* + * For that pupose, converters should override checkConvertability + * Also note that doConvert method is allowed to throw ConverterNotOperationalException too. + * + * @return void + */ + public function checkOperationality() + { + } + + /** + * Converters may override this for the purpose of performing checks on the concrete file. + * + * This can for example be used for rejecting big uploads in cloud converters or rejecting unsupported + * image types. + * + * @return void + */ + public function checkConvertability() + { + } + + /** + * Constructor. + * + * @param string $source path to source file + * @param string $destination path to destination + * @param array $options (optional) options for conversion + * @param BaseLogger $logger (optional) + */ + final public function __construct($source = '', $destination = '', $options = [], $logger = null) + { + if ($source == '') { + return; + } + InputValidator::checkSourceAndDestination($source, $destination); + + $this->source = $source; + $this->destination = $destination; + + $this->setLogger($logger); + $this->setProvidedOptions($options); + + if (!isset($this->options['_skip_input_check'])) { + $this->logLn('WebP Convert 2.9.0 ignited', 'bold'); + $this->logLn('PHP version: ' . phpversion()); + if (isset($_SERVER['SERVER_SOFTWARE'])) { + $this->logLn('Server software: ' . $_SERVER['SERVER_SOFTWARE']); + } + $this->logLn(''); + if (isset($this->options['log-call-arguments']) && $this->options['log-call-arguments']) { + $this->logLn('source: ' . $this->source); + $this->logLn('destination: ' . $this->destination); + $this->logLn(''); + } + + $this->logLn(self::getConverterDisplayName() . ' converter ignited', 'bold'); + } + } + + /** + * Get source. + * + * @return string The source. + */ + public function getSource() + { + return $this->source; + } + + /** + * Get destination. + * + * @return string The destination. + */ + public function getDestination() + { + return $this->destination; + } + + /** + * Set destination. + * + * @param string $destination path to destination + * @return void + */ + public function setDestination($destination) + { + $this->destination = $destination; + } + + + /** + * Get converter name for display (defaults to the class name (short)). + * + * Converters can override this. + * + * @return string A display name, ie "Gd" + */ + protected static function getConverterDisplayName() + { + // https://stackoverflow.com/questions/19901850/how-do-i-get-an-objects-unqualified-short-class-name/25308464 + return substr(strrchr('\\' . static::class, '\\'), 1); + } + + + /** + * Get converter id (defaults to the class name lowercased) + * + * Converters can override this. + * + * @return string A display name, ie "Gd" + */ + protected static function getConverterId() + { + return strtolower(self::getConverterDisplayName()); + } + + + /** + * Create an instance of this class + * + * @param string $source The path to the file to convert + * @param string $destination The path to save the converted file to + * @param array $options (optional) + * @param \WebPConvert\Loggers\BaseLogger $logger (optional) + * + * @return static + */ + public static function createInstance($source, $destination, $options = [], $logger = null) + { + return new static($source, $destination, $options, $logger); + } + + protected function logReduction($source, $destination) + { + $sourceSize = filesize($source); + $destSize = filesize($destination); + $this->log(round(($sourceSize - $destSize) / $sourceSize * 100) . '% '); + if ($sourceSize < 10000) { + $this->logLn('(went from ' . strval($sourceSize) . ' bytes to ' . strval($destSize) . ' bytes)'); + } else { + $this->logLn('(went from ' . round($sourceSize / 1024) . ' kb to ' . round($destSize / 1024) . ' kb)'); + } + } + + /** + * Run conversion. + * + * @return void + */ + private function doConvertImplementation() + { + $beginTime = microtime(true); + + $this->activateWarningLogger(); + + $this->checkOptions(); + + // Prepare destination folder + $this->createWritableDestinationFolder(); + $this->removeExistingDestinationIfExists(); + + if (!isset($this->options['_skip_input_check'])) { + // Check that a file can be written to destination + $this->checkDestinationWritable(); + } + + $this->checkOperationality(); + $this->checkConvertability(); + + if ($this->options['log-call-arguments']) { + $this->logOptions(); + $this->logLn(''); + } + + $this->runActualConvert(); + + $source = $this->source; + $destination = $this->destination; + + if (!@file_exists($destination)) { + throw new ConversionFailedException('Destination file is not there: ' . $destination); + } elseif (@filesize($destination) === 0) { + unlink($destination); + throw new ConversionFailedException('Destination file was completely empty'); + } else { + if (!isset($this->options['_suppress_success_message'])) { + $this->ln(); + $this->log('Converted image in ' . round((microtime(true) - $beginTime) * 1000) . ' ms'); + + $sourceSize = @filesize($source); + if ($sourceSize !== false) { + $this->log(', reducing file size with '); + $this->logReduction($source, $destination); + } + } + } + + $this->deactivateWarningLogger(); + } + + //private function logEx + /** + * Start conversion. + * + * Usually it would be more convenience to call the static convert method, but alternatively you can call + * call ::createInstance to get an instance and then ::doConvert(). + * + * @return void + */ + public function doConvert() + { + try { + //trigger_error('hello', E_USER_ERROR); + $this->doConvertImplementation(); + } catch (WebPConvertException $e) { + $this->logLn(''); + /* + if (isset($e->description) && ($e->description != '')) { + $this->log('Error: ' . $e->description . '. ', 'bold'); + } else { + $this->log('Error: ', 'bold'); + } + */ + $this->log('Error: ', 'bold'); + $this->logLn($e->getMessage(), 'bold'); + throw $e; + } catch (\Exception $e) { + $className = get_class($e); + $classNameParts = explode("\\", $className); + $shortClassName = array_pop($classNameParts); + + $this->logLn(''); + $this->logLn($shortClassName . ' thrown in ' . $e->getFile() . ':' . $e->getLine(), 'bold'); + $this->logLn('Message: "' . $e->getMessage() . '"', 'bold'); + + $this->logLn('Trace:'); + foreach ($e->getTrace() as $trace) { + //$this->logLn(print_r($trace, true)); + if (isset($trace['file']) && isset($trace['line'])) { + $this->logLn( + $trace['file'] . ':' . $trace['line'] + ); + } + } + throw $e; + } catch (\Throwable $e) { + $className = get_class($e); + $classNameParts = explode("\\", $className); + $shortClassName = array_pop($classNameParts); + + $this->logLn(''); + $this->logLn($shortClassName . ' thrown in ' . $e->getFile() . ':' . $e->getLine(), 'bold'); + $this->logLn('Message: "' . $e->getMessage() . '"', 'bold'); + throw $e; + } + } + + /** + * Runs the actual conversion (after setup and checks) + * Simply calls the doActualConvert() of the actual converter. + * However, in the EncodingAutoTrait, this method is overridden to make two conversions + * and select the smallest. + * + * @return void + */ + protected function runActualConvert() + { + $this->doActualConvert(); + } + + /** + * Convert an image to webp. + * + * @param string $source path to source file + * @param string $destination path to destination + * @param array $options (optional) options for conversion + * @param BaseLogger $logger (optional) + * + * @throws ConversionFailedException in case conversion fails in an antipiciated way + * @throws \Exception in case conversion fails in an unantipiciated way + * @return void + */ + public static function convert($source, $destination, $options = [], $logger = null) + { + $c = self::createInstance($source, $destination, $options, $logger); + $c->doConvert(); + //echo $instance->id; + } + + /** + * Get mime type for image (best guess). + * + * It falls back to using file extension. If that fails too, false is returned + * + * PS: Is it a security risk to fall back on file extension? + * - By setting file extension to "jpg", one can lure our library into trying to convert a file, which isn't a jpg. + * hmm, seems very unlikely, though not unthinkable that one of the converters could be exploited + * + * @return string|false|null mimetype (if it is an image, and type could be determined / guessed), + * false (if it is not an image type that the server knowns about) + * or null (if nothing can be determined) + */ + public function getMimeTypeOfSource() + { + return MimeType::getMimeTypeDetectionResult($this->source); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/AutoQualityTrait.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/AutoQualityTrait.php new file mode 100644 index 0000000..71eee64 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/AutoQualityTrait.php @@ -0,0 +1,186 @@ + + * @since Class available since Release 2.0.0 + */ +trait AutoQualityTrait +{ + + abstract public function logLn($msg, $style = ''); + abstract public function getMimeTypeOfSource(); + + /** @var boolean Whether the quality option has been processed or not */ + private $processed = false; + + /** @var boolean Whether the quality of the source could be detected or not (set upon processing) */ + private $qualityCouldNotBeDetected = false; + + /** @var integer The calculated quality (set upon processing - on successful detection) */ + private $calculatedQuality; + + + /** + * Determine if quality detection is required but failing. + * + * It is considered "required" when: + * - Mime type is "image/jpeg" + * - Quality is set to "auto" + * + * If quality option hasn't been proccessed yet, it is triggered. + * + * @return boolean + */ + public function isQualityDetectionRequiredButFailing() + { + $this->processQualityOptionIfNotAlready(); + return $this->qualityCouldNotBeDetected; + } + + /** + * Get calculated quality. + * + * If the "quality" option is a number, that number is returned. + * If mime type of source is something else than "image/jpeg", the "default-quality" option is returned + * If quality is "auto" and source is a jpeg image, it will be attempted to detect jpeg quality. + * In case of failure, the value of the "default-quality" option is returned. + * In case of success, the detected quality is returned, or the value of the "max-quality" if that is lower. + * + * @return int + */ + public function getCalculatedQuality() + { + $this->processQualityOptionIfNotAlready(); + return $this->calculatedQuality; + } + + /** + * Process the quality option if it is not already processed. + * + * @return void + */ + private function processQualityOptionIfNotAlready() + { + if (!$this->processed) { + $this->processed = true; + $this->processQualityOption(); + } + } + + /** + * Process the quality option. + * + * Sets the private property "calculatedQuality" according to the description for the getCalculatedQuality + * function. + * In case quality detection was attempted and failed, the private property "qualityCouldNotBeDetected" is set + * to true. This is used by the "isQualityDetectionRequiredButFailing" (and documented there too). + * + * @return void + */ + private function processQualityOption() + { + $options = $this->options; + $source = $this->source; + + /* + Mapping from old options to new options: + quality: "auto", max-quality: 85, default-quality: 75 + becomes: quality: 85, auto-limit: true + + quality: 80 + becomes: quality: 80, auto-limit: false + */ + $q = $options['quality']; + $useDeprecatedDefaultQuality = false; + if ($q == 'auto') { + $q = $options['quality'] = $options['max-quality']; + $this->logLn( + '*Setting "quality" to "auto" is deprecated. ' . + 'Instead, set "quality" to a number (0-100) and "auto-limit" to true. ' + ); + $this->logLn( + '*"quality" has been set to: ' . $options['max-quality'] . ' (took the value of "max-quality").*' + ); + if (!$this->options2->getOptionById('auto-limit')->isValueExplicitlySet()) { + $options['auto-limit'] = true; + $this->logLn( + '*"auto-limit" has been set to: true."*' + ); + } else { + $this->logLn( + '*PS: "auto-limit" is set to false, as it was set explicitly to false in the options."*' + ); + } + $useDeprecatedDefaultQuality = true; + } + + if ($options['auto-limit']) { + if (($this->/** @scrutinizer ignore-call */getMimeTypeOfSource() == 'image/jpeg')) { + $this->logLn('Running auto-limit'); + $this->logLn( + 'Quality setting: ' . $q . '. ' + ); + $q = JpegQualityDetector::detectQualityOfJpg($source); + if (is_null($q)) { + $this->/** @scrutinizer ignore-call */logLn( + 'Quality of source image could not be established (Imagick or GraphicsMagick is required). ' . + 'Sorry, no auto-limit functionality for you. ' + ); + if ($useDeprecatedDefaultQuality) { + $q = $options['default-quality']; + $this->/** @scrutinizer ignore-call */logLn( + 'Using default-quality (' . $q . ').' + ); + } else { + $q = $options['quality']; + $this->/** @scrutinizer ignore-call */logLn( + 'Using supplied quality (' . $q . ').' + ); + } + + $this->qualityCouldNotBeDetected = true; + } else { + $this->logLn( + 'Quality of jpeg: ' . $q . '. ' + ); + if ($q < $options['quality']) { + $this->logLn( + 'Auto-limit result: ' . $q . ' ' . + '(limiting applied).' + ); + } else { + $q = $options['quality']; + $this->logLn( + 'Auto-limit result: ' . $q . ' ' . + '(no limiting needed this time).' + ); + } + } + $q = min($q, $options['max-quality']); + } else { + $this->logLn('Bypassing auto-limit (it is only active for jpegs)'); + $this->logLn('Quality: ' . $q . '. '); + } + } else { + $this->logLn( + 'Quality: ' . $q . '. ' + ); + if (($this->getMimeTypeOfSource() == 'image/jpeg')) { + $this->logLn( + 'Consider enabling "auto-limit" option. This will prevent unnecessary high quality' + ); + } + } + $this->calculatedQuality = $q; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/DestinationPreparationTrait.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/DestinationPreparationTrait.php new file mode 100644 index 0000000..6d22d3a --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/DestinationPreparationTrait.php @@ -0,0 +1,101 @@ + + * @since Class available since Release 2.0.0 + */ +trait DestinationPreparationTrait +{ + + abstract public function getDestination(); + abstract public function logLn($msg, $style = ''); + + /** + * Create writable folder in provided path (if it does not exist already) + * + * @throws CreateDestinationFolderException if folder cannot be removed + * @return void + */ + private function createWritableDestinationFolder() + { + $destination = $this->getDestination(); + + $folder = dirname($destination); + if (!file_exists($folder)) { + $this->logLn('Destination folder does not exist. Creating folder: ' . $folder); + // TODO: what if this is outside open basedir? + // see http://php.net/manual/en/ini.core.php#ini.open-basedir + + // Trying to create the given folder (recursively) + if (!mkdir($folder, 0777, true)) { + throw new CreateDestinationFolderException( + 'Failed creating folder. Check the permissions!', + 'Failed creating folder: ' . $folder . '. Check permissions!' + ); + } + } + } + + /** + * Check that we can write file at destination. + * + * It is assumed that the folder already exists (that ::createWritableDestinationFolder() was called first) + * + * @throws CreateDestinationFileException if file cannot be created at destination + * @return void + */ + private function checkDestinationWritable() + { + $destination = $this->getDestination(); + $dirName = dirname($destination); + + if (@is_writable($dirName) && @is_executable($dirName)) { + // all is well + return; + } + + // The above might fail on Windows, even though dir is writable + // So, to be absolute sure that we cannot write, we make an actual write test (writing a dummy file) + // No harm in doing that for non-Windows systems either. + if (file_put_contents($destination, 'dummy') !== false) { + // all is well, after all + unlink($destination); + return; + } + + throw new CreateDestinationFileException( + 'Cannot create file: ' . basename($destination) . ' in dir:' . dirname($destination) + ); + } + + /** + * Remove existing destination. + * + * @throws CreateDestinationFileException if file cannot be removed + * @return void + */ + private function removeExistingDestinationIfExists() + { + $destination = $this->getDestination(); + if (file_exists($destination)) { + // A file already exists in this folder... + // We delete it, to make way for a new webp + if (!unlink($destination)) { + throw new CreateDestinationFileException( + 'Existing file cannot be removed: ' . basename($destination) + ); + } + } + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/LoggerTrait.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/LoggerTrait.php new file mode 100644 index 0000000..79329fe --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/LoggerTrait.php @@ -0,0 +1,71 @@ + + * @since Class available since Release 2.0.0 + */ +trait LoggerTrait +{ + + /** @var \WebPConvert\Loggers\BaseLogger|null The logger (or null if not set) */ + protected $logger; + + /** + * Set logger + * + * @param \WebPConvert\Loggers\BaseLogger $logger (optional) $logger + * @return void + */ + public function setLogger($logger = null) + { + $this->logger = $logger; + } + + /** + * Write a line to the logger. + * + * @param string $msg The line to write. + * @param string $style (optional) Ie "italic" or "bold" + * @return void + */ + public function logLn($msg, $style = '') + { + if (isset($this->logger)) { + $this->logger->logLn($msg, $style); + } + } + + /** + * New line + * + * @return void + */ + protected function ln() + { + if (isset($this->logger)) { + $this->logger->ln(); + } + } + + /** + * Write to the logger, without newline + * + * @param string $msg What to write. + * @param string $style (optional) Ie "italic" or "bold" + * @return void + */ + public function log($msg, $style = '') + { + if (isset($this->logger)) { + $this->logger->log($msg, $style); + } + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/OptionsTrait.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/OptionsTrait.php new file mode 100644 index 0000000..2606f44 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/OptionsTrait.php @@ -0,0 +1,581 @@ + + * @since Class available since Release 2.0.0 + */ +trait OptionsTrait +{ + + abstract public function log($msg, $style = ''); + abstract public function logLn($msg, $style = ''); + abstract protected function getMimeTypeOfSource(); + + /** @var array Provided conversion options (array of simple objects)*/ + public $providedOptions; + + /** @var array Calculated conversion options (merge of default options and provided options)*/ + protected $options; + + /** @var Options */ + protected $options2; + + /** + * Get the "general" options (options that are standard in the meaning that they + * are generally available (unless specifically marked as unsupported by a given converter) + * + * @param string $imageType (png | jpeg) The image type - determines the defaults + * + * @return array Array of options + */ + public function getGeneralOptions($imageType) + { + $isPng = ($imageType == 'png'); + + /* + return [ + //new IntegerOption('auto-limit-adjustment', 5, -100, 100), + new BooleanOption('log-call-arguments', false), + new BooleanOption('skip', false), + new BooleanOption('use-nice', false), + new ArrayOption('jpeg', []), + new ArrayOption('png', []) + ];*/ + + $introMd = 'https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/' . + 'converting/introduction-for-converting.md'; + + return OptionFactory::createOptions([ + ['encoding', 'string', [ + 'title' => 'Encoding', + 'description' => 'Set encoding for the webp. ' . + 'If you choose "auto", webp-convert will ' . + 'convert to both lossy and lossless and pick the smallest result', + 'default' => 'auto', + 'enum' => ['auto', 'lossy', 'lossless'], + 'ui' => [ + 'component' => 'select', + 'links' => [['Guide', $introMd . '#auto-selecting-between-losslesslossy-encoding']], + ] + ]], + ['quality', 'int', [ + 'title' => 'Quality (Lossy)', + 'description' => + 'Quality for lossy encoding. ' . + 'In case you enable "auto-limit", you can consider this property a maximum quality.', + 'default' => ($isPng ? 85 : 75), + 'default-png' => 85, + 'default-jpeg' => 75, + //'minimum' => 0, + //'maximum' => 100, + "oneOf" => [ + ["type" => "number", "minimum" => 0, 'maximum' => 100], + ["type" => "string", "enum" => ["auto"]] + ], + 'ui' => [ + 'component' => 'slider', + 'display' => "option('encoding') != 'lossless'" + ] + ]], + ['auto-limit', 'boolean', [ + 'title' => 'Auto-limit', + 'description' => + 'Enable this option to prevent an unnecessarily high quality setting for low ' . + 'quality jpegs. It works by adjusting quality setting down to the quality of the jpeg. ' . + 'Converting ie a jpeg with quality:50 to ie quality:80 does not get you better quality ' . + 'than converting it to quality:80, but it does get you a much bigger file - so you ' . + 'really should enable this option.' . "\n\n" . + 'The option is ignored for PNG and never adjusts quality up. ' . "\n\n" . + 'The feature requires Imagick, ImageMagick or Gmagick in order to detect the quality of ' . + 'the jpeg. ' . "\n\n" . + 'PS: The "auto-limit" option is relative new. However, before this option, you could achieve ' . + 'the same by setting quality to "auto" and specifying a "max-quality" and a "default-quality". ' . + 'These are deprecated now, but still works.', + 'default' => true, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true, + 'links' => [ + [ + 'Guide', + $introMd . '#preventing-unnecessarily-high-quality-setting-for-low-quality-jpegs' + ] + ], + 'display' => "option('encoding') != 'lossless'" + ] + ]], + ['alpha-quality', 'int', [ + 'title' => 'Alpha quality', + 'description' => + 'Quality of alpha channel. ' . + 'Often, there is no need for high quality transparency layer and in some cases you ' . + 'can tweak this all the way down to 10 and save a lot in file size. The option only ' . + 'has effect with lossy encoding, and of course only on images with transparency.', + 'default' => 85, + 'minimum' => 0, + 'maximum' => 100, + 'ui' => [ + 'component' => 'slider', + 'links' => [['Guide', $introMd . '#alpha-quality']], + 'display' => "(option('encoding') != 'lossless') && (imageType!='jpeg')" + ] + ]], + ['near-lossless', 'int', [ + 'title' => '"Near lossless" quality', + 'description' => + 'This option allows you to get impressively better compression for lossless encoding, with ' . + 'minimal impact on visual quality. The range is 0 (maximum preprocessing) to 100 (no ' . + 'preprocessing). Read the guide for more info.', + 'default' => 60, + 'minimum' => 0, + 'maximum' => 100, + 'ui' => [ + 'component' => 'slider', + 'links' => [['Guide', $introMd . '#near-lossless']], + 'display' => "option('encoding') != 'lossy'" + ] + ]], + ['metadata', 'string', [ + 'title' => 'Metadata', + 'description' => + 'Determines which metadata that should be copied over to the webp. ' . + 'Setting it to "all" preserves all metadata, setting it to "none" strips all metadata. ' . + '*cwebp* can take a comma-separated list of which kinds of metadata that should be copied ' . + '(ie "exif,icc"). *gd* will always remove all metadata and *ffmpeg* will always keep all ' . + 'metadata. The rest can either strip all or keep all (they will keep all, unless the option ' . + 'is set to *none*)', + 'default' => 'none', + 'ui' => [ + 'component' => 'multi-select', + 'options' => ['all', 'none', 'exif', 'icc', 'xmp'], + ] + // TODO: set regex validation + ]], + ['method', 'int', [ + 'title' => 'Reduction effort (0-6)', + 'description' => + 'Controls the trade off between encoding speed and the compressed file size and quality. ' . + 'Possible values range from 0 to 6. 0 is fastest. 6 results in best quality and compression. ' . + 'PS: The option corresponds to the "method" option in libwebp', + 'default' => 6, + 'minimum' => 0, + 'maximum' => 6, + 'ui' => [ + 'component' => 'slider', + 'advanced' => true, + ] + ]], + ['sharp-yuv', 'boolean', [ + 'title' => 'Sharp YUV', + 'description' => + 'Better RGB->YUV color conversion (sharper and more accurate) at the expense of a little extra ' . + 'conversion time.', + 'default' => true, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true, + 'links' => [ + ['Ctrl.blog', 'https://www.ctrl.blog/entry/webp-sharp-yuv.html'], + ], + ] + ]], + ['auto-filter', 'boolean', [ + 'title' => 'Auto-filter', + 'description' => + 'Turns auto-filter on. ' . + 'This algorithm will spend additional time optimizing the filtering strength to reach a well-' . + 'balanced quality. Unfortunately, it is extremely expensive in terms of computation. It takes ' . + 'about 5-10 times longer to do a conversion. A 1MB picture which perhaps typically takes about ' . + '2 seconds to convert, will takes about 15 seconds to convert with auto-filter. ', + 'default' => false, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true, + ] + ]], + ['low-memory', 'boolean', [ + 'title' => 'Low memory', + 'description' => + 'Reduce memory usage of lossy encoding at the cost of ~30% longer encoding time and marginally ' . + 'larger output size. Only effective when the *method* option is 3 or more. Read more in ' . + '[the docs](https://developers.google.com/speed/webp/docs/cwebp)', + 'default' => false, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true, + 'display' => "(option('encoding') != 'lossless') && (option('method')>2)" + ] + ]], + ['preset', 'string', [ + 'title' => 'Preset', + 'description' => + 'Using a preset will set many of the other options to suit a particular type of ' . + 'source material. It even overrides them. It does however not override the quality option. ' . + '"none" means that no preset will be set', + 'default' => 'none', + 'enum' => ['none', 'default', 'photo', 'picture', 'drawing', 'icon', 'text'], + 'ui' => [ + 'component' => 'select', + 'advanced' => true, + ] + ]], + ['size-in-percentage', 'int', ['default' => null, 'minimum' => 0, 'maximum' => 100, 'allow-null' => true]], + ['skip', 'boolean', ['default' => false]], + ['log-call-arguments', 'boolean', ['default' => false]], + // TODO: use-nice should not be a "general" option + //['use-nice', 'boolean', ['default' => false]], + ['jpeg', 'array', ['default' => []]], + ['png', 'array', ['default' => []]], + + // Deprecated options + ['default-quality', 'int', [ + 'default' => ($isPng ? 85 : 75), + 'minimum' => 0, + 'maximum' => 100, + 'deprecated' => true] + ], + ['max-quality', 'int', ['default' => 85, 'minimum' => 0, 'maximum' => 100, 'deprecated' => true]], + ]); + } + + /** + * Get the unique options for a converter + * + * @param string $imageType (png | jpeg) The image type - determines the defaults + * + * @return array Array of options + */ + public function getUniqueOptions($imageType) + { + return []; + } + + /** + * Create options. + * + * The options created here will be available to all converters. + * Individual converters may add options by overriding this method. + * + * @param string $imageType (png | jpeg) The image type - determines the defaults + * + * @return void + */ + protected function createOptions($imageType = 'png') + { + $this->options2 = new Options(); + $this->options2->addOptions(... $this->getGeneralOptions($imageType)); + $this->options2->addOptions(... $this->getUniqueOptions($imageType)); + } + + /** + * Set "provided options" (options provided by the user when calling convert(). + * + * This also calculates the protected options array, by merging in the default options, merging + * jpeg and png options and merging prefixed options (such as 'vips-quality'). + * The resulting options array are set in the protected property $this->options and can be + * retrieved using the public ::getOptions() function. + * + * @param array $providedOptions (optional) + * @return void + */ + public function setProvidedOptions($providedOptions = []) + { + $imageType = ($this->getMimeTypeOfSource() == 'image/png' ? 'png' : 'jpeg'); + $this->createOptions($imageType); + + $this->providedOptions = $providedOptions; + + if (isset($this->providedOptions['png'])) { + if ($this->getMimeTypeOfSource() == 'image/png') { + $this->providedOptions = array_merge($this->providedOptions, $this->providedOptions['png']); +// $this->logLn(print_r($this->providedOptions, true)); + unset($this->providedOptions['png']); + } + } + + if (isset($this->providedOptions['jpeg'])) { + if ($this->getMimeTypeOfSource() == 'image/jpeg') { + $this->providedOptions = array_merge($this->providedOptions, $this->providedOptions['jpeg']); + unset($this->providedOptions['jpeg']); + } + } + + // merge down converter-prefixed options + $converterId = self::getConverterId(); + $strLen = strlen($converterId); + foreach ($this->providedOptions as $optionKey => $optionValue) { + if (substr($optionKey, 0, $strLen + 1) == ($converterId . '-')) { + $this->providedOptions[substr($optionKey, $strLen + 1)] = $optionValue; + unset($this->providedOptions[$optionKey]); + } + } + + // Create options (Option objects) + foreach ($this->providedOptions as $optionId => $optionValue) { + $this->options2->setOrCreateOption($optionId, $optionValue); + } + //$this->logLn(print_r($this->options2->getOptions(), true)); +//$this->logLn($this->options2->getOption('hello')); + + // Create flat associative array of options + $this->options = $this->options2->getOptions(); + + // - Merge $defaultOptions into provided options + //$this->options = array_merge($this->getDefaultOptions(), $this->providedOptions); + + //$this->logOptions(); + } + + /** + * Get the resulting options after merging provided options with default options. + * + * Note that the defaults depends on the mime type of the source. For example, the default value for quality + * is "auto" for jpegs, and 85 for pngs. + * + * @return array An associative array of options: ['metadata' => 'none', ...] + */ + public function getOptions() + { + return $this->options; + } + + /** + * Change an option specifically. + * + * This method is probably rarely neeeded. We are using it to change the "encoding" option temporarily + * in the EncodingAutoTrait. + * + * @param string $id Id of option (ie "metadata") + * @param mixed $value The new value. + * @return void + */ + protected function setOption($id, $value) + { + $this->options[$id] = $value; + $this->options2->setOrCreateOption($id, $value); + } + + /** + * Check options. + * + * @throws InvalidOptionTypeException if an option have wrong type + * @throws InvalidOptionValueException if an option value is out of range + * @throws ConversionSkippedException if 'skip' option is set to true + * @return void + */ + protected function checkOptions() + { + $this->options2->check(); + + if ($this->options['skip']) { + if (($this->getMimeTypeOfSource() == 'image/png') && isset($this->options['png']['skip'])) { + throw new ConversionSkippedException( + 'skipped conversion (configured to do so for PNG)' + ); + } else { + throw new ConversionSkippedException( + 'skipped conversion (configured to do so)' + ); + } + } + } + + public function logOptions() + { + $this->logLn(''); + $this->logLn('Options:'); + $this->logLn('------------'); + + $unsupported = $this->getUnsupportedDefaultOptions(); + $received = []; + $implicitlySet = []; + foreach ($this->options2->getOptionsMap() as $id => $option) { + if (in_array($id, [ + 'png', 'jpeg', '_skip_input_check', '_suppress_success_message', 'skip', 'log_call_arguments' + ])) { + continue; + } + if ($option->isValueExplicitlySet()) { + $received[] = $option; + } else { + if (($option instanceof GhostOption) || in_array($id, $unsupported)) { + //$received[] = $option; + } else { + if (!$option->isDeprecated()) { + $implicitlySet[] = $option; + } + } + } + } + + if (count($received) > 0) { + foreach ($received as $option) { + $this->log('- ' . $option->getId() . ': '); + if ($option instanceof GhostOption) { + $this->log(' (unknown to ' . $this->getConverterId() . ')', 'bold'); + $this->logLn(''); + continue; + } + $this->log($option->getValueForPrint()); + if ($option->isDeprecated()) { + $this->log(' (deprecated)', 'bold'); + } + if (in_array($option->getId(), $unsupported)) { + if ($this instanceof Stack) { + //$this->log(' *(passed on)*'); + } else { + $this->log(' (unsupported by ' . $this->getConverterId() . ')', 'bold'); + } + } + $this->logLn(''); + } + $this->logLn(''); + $this->logLn( + 'Note that these are the resulting options after merging down the "jpeg" and "png" options and any ' . + 'converter-prefixed options' + ); + } + + if (count($implicitlySet) > 0) { + $this->logLn(''); + $this->logLn('Defaults:'); + $this->logLn('------------'); + $this->logLn( + 'The following options was not set, so using the following defaults:' + ); + foreach ($implicitlySet as $option) { + $this->log('- ' . $option->getId() . ': '); + $this->log($option->getValueForPrint()); + /*if ($option instanceof GhostOption) { + $this->log(' **(ghost)**'); + }*/ + $this->logLn(''); + } + } + } + + // to be overridden by converters + protected function getUnsupportedDefaultOptions() + { + return []; + } + + public function getUnsupportedGeneralOptions() + { + return $this->getUnsupportedDefaultOptions(); + } + + /** + * Get unique option definitions. + * + * Gets definitions of the converters "unique" options (that is, those options that + * are not general). It was added in order to give GUI's a way to automatically adjust + * their setting screens. + * + * @param bool $filterOutOptionsWithoutUI If options without UI defined should be filtered out + * @param string $imageType (png | jpeg) The image type - determines the defaults + * + * @return array Array of options definitions - ready to be json encoded, or whatever + */ + public function getUniqueOptionDefinitions($filterOutOptionsWithoutUI = true, $imageType = 'jpeg') + { + $uniqueOptions = new Options(); + //$uniqueOptions->addOptions(... $this->getUniqueOptions($imageType)); + foreach ($this->getUniqueOptions($imageType) as $uoption) { + $uoption->setId(self::getConverterId() . '-' . $uoption->getId()); + $uniqueOptions->addOption($uoption); + } + + $optionDefinitions = $uniqueOptions->getDefinitions(); + if ($filterOutOptionsWithoutUI) { + $optionDefinitions = array_filter($optionDefinitions, function ($value) { + return !is_null($value['ui']); + }); + $optionDefinitions = array_values($optionDefinitions); // re-index + } + return $optionDefinitions; + } + + /** + * Get general option definitions. + * + * Gets definitions of all general options (not just the ones supported by current converter) + * For UI's, as a way to automatically adjust their setting screens. + * + * @param bool $filterOutOptionsWithoutUI If options without UI defined should be filtered out + * @param string $imageType (png | jpeg) The image type - determines the defaults + * + * @return array Array of options definitions - ready to be json encoded, or whatever + */ + public function getGeneralOptionDefinitions($filterOutOptionsWithoutUI = true, $imageType = 'jpeg') + { + $generalOptions = new Options(); + $generalOptions->addOptions(... $this->getGeneralOptions($imageType)); + //$generalOptions->setUI($this->getUIForGeneralOptions($imageType)); + $optionDefinitions = $generalOptions->getDefinitions(); + if ($filterOutOptionsWithoutUI) { + $optionDefinitions = array_filter($optionDefinitions, function ($value) { + return !is_null($value['ui']); + }); + $optionDefinitions = array_values($optionDefinitions); // re-index + } + return $optionDefinitions; + } + + public function getSupportedGeneralOptions($imageType = 'png') + { + $unsupportedGeneral = $this->getUnsupportedDefaultOptions(); + $generalOptionsArr = $this->getGeneralOptions($imageType); + $supportedIds = []; + foreach ($generalOptionsArr as $i => $option) { + if (in_array($option->getId(), $unsupportedGeneral)) { + unset($generalOptionsArr[$i]); + } + } + return $generalOptionsArr; + } + + /** + * Get general option definitions. + * + * Gets definitions of the converters "general" options. (that is, those options that + * It was added in order to give GUI's a way to automatically adjust their setting screens. + * + * @param string $imageType (png | jpeg) The image type - determines the defaults + * + * @return array Array of options definitions - ready to be json encoded, or whatever + */ + public function getSupportedGeneralOptionDefinitions($imageType = 'png') + { + $generalOptions = new Options(); + $generalOptions->addOptions(... $this->getSupportedGeneralOptions($imageType)); + return $generalOptions->getDefinitions(); + } + + public function getSupportedGeneralOptionIds() + { + $supportedGeneralOptions = $this->getSupportedGeneralOptions(); + $supportedGeneralIds = []; + foreach ($supportedGeneralOptions as $option) { + $supportedGeneralIds[] = $option->getId(); + } + return $supportedGeneralIds; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/WarningLoggerTrait.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/WarningLoggerTrait.php new file mode 100644 index 0000000..25a6aed --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/WarningLoggerTrait.php @@ -0,0 +1,175 @@ + + * @since Class available since Release 2.0.0 + */ +trait WarningLoggerTrait +{ + abstract public function logLn($msg, $style = ''); + + /** @var string|array|null Previous error handler (stored in order to be able pass warnings on) */ + private $previousErrorHandler; + + /** @var boolean Suppress ALL warnings? (both from log and from bubbling up) */ + private $suppressWarnings; + + /** @var int Count number of warnings */ + private $warningCounter; + + /** + * Handle warnings and notices during conversion by logging them and passing them on. + * + * The function is a callback used with "set_error_handler". + * It is declared public because it needs to be accessible from the point where the warning is triggered. + * + * PS: The fifth parameter ($errcontext) of an error handler is deprecated since PHP 7.2, however we have + * it here to avoid calling another error handler with too few parameters (see #266) + * + * @param integer $errno + * @param string $errstr + * @param string $errfile + * @param integer $errline + * @param array $errcontext + * + * @return false|null|void + */ + public function warningHandler($errno, $errstr, $errfile, $errline, $errcontext = null) + { + /* + We do NOT do the following (even though it is generally recommended): + + if (!(error_reporting() & $errno)) { + // This error code is not included in error_reporting, so let it fall + // through to the standard PHP error handler + return false; + } + + - Because we want to log all warnings and errors (also the ones that was suppressed with @) + https://secure.php.net/manual/en/language.operators.errorcontrol.php + + If we were to decide suppressing the ones with @, I could do this: + + if (error_reporting() == 0) { + /// @ sign temporary disabled error reporting + return; + } + [https://stackoverflow.com/questions/7380782/error-suppression-operator-and-set-error-handler] + + However, that would also disable the warnings on systems with error reporting set to E_NONE. + And I really want the conversion log file to contain these warnings on all systems. + + If it was possible to suppress the warnings with @ without suppressing warnings on systems + with error reporting set to E_NONE, I would do that. + */ + + $this->warningCounter++; + if ($this->suppressWarnings) { + return; + } + + $errorTypes = [ + E_WARNING => "Warning", + E_NOTICE => "Notice", + E_STRICT => "Strict Notice", + E_DEPRECATED => "Deprecated", + E_USER_DEPRECATED => "User Deprecated", + + /* + The following can never be catched by a custom error handler: + E_PARSE, E_ERROR, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING + + We do do not currently trigger the following: + E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE + + But we may want to do that at some point, like this: + trigger_error('Your version of Gd is very old', E_USER_WARNING); + in that case, remember to add them to this array + */ + ]; + + if (isset($errorTypes[$errno])) { + $errType = $errorTypes[$errno]; + } else { + $errType = "Unknown error/warning/notice ($errno)"; + } + + $msg = $errType . ': ' . $errstr . ' in ' . $errfile . ', line ' . $errline . ', PHP ' . PHP_VERSION . + ' (' . PHP_OS . ')'; + $this->logLn(''); + $this->logLn($msg, 'italic'); + $this->logLn(''); + + if (!is_null($this->previousErrorHandler)) { + // If previousErrorHandler is this very error handler, exit to avoid recursion + // (this could happen if ::activateWarningLogger() were called twice) + if (is_array($this->previousErrorHandler) && + isset($this->previousErrorHandler[0]) && + ($this->previousErrorHandler[0] == $this) + ) { + return false; + } else { + return call_user_func($this->previousErrorHandler, $errno, $errstr, $errfile, $errline, $errcontext); + } + } else { + return false; + } + } + + /** + * Activate warning logger. + * + * Sets the error handler and stores the previous so our error handler can bubble up warnings + * + * @return void + */ + protected function activateWarningLogger() + { + $this->suppressWarnings = false; + $this->warningCounter = 0; + $this->previousErrorHandler = set_error_handler( + array($this, "warningHandler"), + E_WARNING | E_USER_WARNING | E_NOTICE | E_USER_NOTICE + ); + } + + /** + * Deactivate warning logger. + * + * Restores the previous error handler. + * + * @return void + */ + protected function deactivateWarningLogger() + { + restore_error_handler(); + } + + protected function disableWarningsTemporarily() + { + $this->suppressWarnings = true; + } + + protected function reenableWarnings() + { + $this->suppressWarnings = false; + } + + protected function getWarningCount() + { + return $this->warningCounter; + } + + protected function resetWarningCount() + { + $this->warningCounter = 0; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-060-fbsd b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-060-fbsd new file mode 100644 index 0000000..570294d Binary files /dev/null and b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-060-fbsd differ diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-060-solaris b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-060-solaris new file mode 100644 index 0000000..3f30d24 Binary files /dev/null and b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-060-solaris differ diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-061-linux-x86-64 b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-061-linux-x86-64 new file mode 100644 index 0000000..e8c1dcb Binary files /dev/null and b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-061-linux-x86-64 differ diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-103-linux-x86-64-static b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-103-linux-x86-64-static new file mode 100644 index 0000000..14ec7f7 Binary files /dev/null and b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-103-linux-x86-64-static differ diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-110-linux-x86-64 b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-110-linux-x86-64 new file mode 100644 index 0000000..d068991 Binary files /dev/null and b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-110-linux-x86-64 differ diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-110-mac-10_15 b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-110-mac-10_15 new file mode 100644 index 0000000..b6c6c0f Binary files /dev/null and b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-110-mac-10_15 differ diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-110-windows-x64.exe b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-110-windows-x64.exe new file mode 100644 index 0000000..ed85dba Binary files /dev/null and b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-110-windows-x64.exe differ diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-120-linux-x86-64 b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-120-linux-x86-64 new file mode 100644 index 0000000..bfabe84 Binary files /dev/null and b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-120-linux-x86-64 differ diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-120-windows-x64.exe b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-120-windows-x64.exe new file mode 100644 index 0000000..477b337 Binary files /dev/null and b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-120-windows-x64.exe differ diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/CloudConverterTrait.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/CloudConverterTrait.php new file mode 100644 index 0000000..9bd1d4a --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/CloudConverterTrait.php @@ -0,0 +1,72 @@ + + * @since Class available since Release 2.0.0 + */ +trait CloudConverterTrait +{ + + /** + * Test that filesize is below "upload_max_filesize" and "post_max_size" values in php.ini. + * + * @param string $iniSettingId Id of ini setting (ie "upload_max_filesize") + * + * @throws ConversionFailedException if filesize is larger than the ini setting + * @return void + */ + private function checkFileSizeVsIniSetting($iniSettingId) + { + $fileSize = @filesize($this->source); + if ($fileSize === false) { + return; + } + $sizeInIni = PhpIniSizes::getIniBytes($iniSettingId); + if ($sizeInIni === false) { + // Not sure if we should throw an exception here, or not... + return; + } + if ($sizeInIni < $fileSize) { + throw new ConversionFailedException( + 'File is larger than your ' . $iniSettingId . ' (set in your php.ini). File size:' . + round($fileSize / 1024) . ' kb. ' . + $iniSettingId . ' in php.ini: ' . ini_get($iniSettingId) . + ' (parsed as ' . round($sizeInIni / 1024) . ' kb)' + ); + } + } + + /** + * Check convertability of cloud converters (that file is not bigger than limits set in php.ini). + * + * Performs the same as ::Convertability(). It is here so converters that overrides the + * ::Convertability() still has a chance to do the checks. + * + * @throws ConversionFailedException if filesize is larger than "upload_max_filesize" or "post_max_size" + * @return void + */ + public function checkConvertabilityCloudConverterTrait() + { + $this->checkFileSizeVsIniSetting('upload_max_filesize'); + $this->checkFileSizeVsIniSetting('post_max_size'); + } + + /** + * Check convertability of cloud converters (file upload limits). + */ + public function checkConvertability() + { + $this->checkConvertabilityCloudConverterTrait(); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/CurlTrait.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/CurlTrait.php new file mode 100644 index 0000000..2a48593 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/CurlTrait.php @@ -0,0 +1,72 @@ + + * @since Class available since Release 2.0.0 + */ +trait CurlTrait +{ + + /** + * Check basis operationality for converters relying on curl. + * + * Performs the same as ::checkOperationality(). It is here so converters that overrides the + * ::checkOperationality() still has a chance to do the checks. + * + * @throws SystemRequirementsNotMetException + * @return void + */ + public function checkOperationalityForCurlTrait() + { + if (!extension_loaded('curl')) { + throw new SystemRequirementsNotMetException('Required cURL extension is not available.'); + } + + if (!function_exists('curl_init')) { + throw new SystemRequirementsNotMetException('Required url_init() function is not available.'); + } + + if (!function_exists('curl_file_create')) { + throw new SystemRequirementsNotMetException( + 'Required curl_file_create() function is not available (requires PHP > 5.5).' + ); + } + } + + /** + * Check basis operationality for converters relying on curl + * + * @throws SystemRequirementsNotMetException + * @return void + */ + public function checkOperationality() + { + $this->checkOperationalityForCurlTrait(); + } + + /** + * Init curl. + * + * @throws SystemRequirementsNotMetException if curl could not be initialized + * @return resource|\CurlHandle curl handle (from PHP8: CurlHandle) + */ + protected static function initCurl() + { + // Get curl handle + $ch = \curl_init(); + if ($ch === false) { + throw new SystemRequirementsNotMetException('Could not initialise cURL.'); + } + return $ch; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/EncodingAutoTrait.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/EncodingAutoTrait.php new file mode 100644 index 0000000..4eca862 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/EncodingAutoTrait.php @@ -0,0 +1,91 @@ + + * @since Class available since Release 2.0.0 + */ +trait EncodingAutoTrait +{ + + abstract protected function doActualConvert(); + abstract public function getSource(); + abstract public function getDestination(); + abstract public function setDestination($destination); + abstract public function getOptions(); + abstract protected function setOption($optionName, $optionValue); + abstract protected function logLn($msg, $style = ''); + abstract protected function log($msg, $style = ''); + abstract protected function ln(); + abstract protected function logReduction($source, $destination); + + public function supportsLossless() + { + return true; + } + + /** Default is to not pass "lossless:auto" on, but implement it. + * + * The Stack converter passes it on (it does not even use this trait) + * WPC currently implements it, but this might be configurable in the future. + * + */ + public function passOnEncodingAuto() + { + return false; + } + + private function convertTwoAndSelectSmallest() + { + $destination = $this->getDestination(); + $destinationLossless = $destination . '.lossless.webp'; + $destinationLossy = $destination . '.lossy.webp'; + + $this->logLn( + 'Encoding is set to auto - converting to both lossless and lossy and selecting the smallest file' + ); + + $this->ln(); + $this->logLn('Converting to lossy'); + $this->setDestination($destinationLossy); + $this->setOption('encoding', 'lossy'); + $this->doActualConvert(); + $this->log('Reduction: '); + $this->logReduction($this->getSource(), $destinationLossy); + $this->ln(); + + $this->logLn('Converting to lossless'); + $this->setDestination($destinationLossless); + $this->setOption('encoding', 'lossless'); + $this->doActualConvert(); + $this->log('Reduction: '); + $this->logReduction($this->getSource(), $destinationLossless); + $this->ln(); + + if (filesize($destinationLossless) > filesize($destinationLossy)) { + $this->logLn('Picking lossy'); + unlink($destinationLossless); + rename($destinationLossy, $destination); + } else { + $this->logLn('Picking lossless'); + unlink($destinationLossy); + rename($destinationLossless, $destination); + } + $this->setDestination($destination); + $this->setOption('encoding', 'auto'); + } + + protected function runActualConvert() + { + if (!$this->passOnEncodingAuto() && ($this->getOptions()['encoding'] == 'auto') && $this->supportsLossless()) { + $this->convertTwoAndSelectSmallest(); + } else { + $this->doActualConvert(); + } + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/ExecTrait.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/ExecTrait.php new file mode 100644 index 0000000..aa6c856 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/ExecTrait.php @@ -0,0 +1,107 @@ + + * @since Class available since Release 2.0.0 + */ +trait ExecTrait +{ + + abstract protected function logLn($msg, $style = ''); + + + /** + * Helper function for examining if "nice" command is available + * + * @return boolean true if nice is available + */ + protected static function hasNiceSupport() + { + ExecWithFallback::exec("nice 2>&1", $niceOutput); + + if (is_array($niceOutput) && isset($niceOutput[0])) { + if (preg_match('/usage/', $niceOutput[0]) || (preg_match('/^\d+$/', $niceOutput[0]))) { + /* + * Nice is available - default niceness (+10) + * https://www.lifewire.com/uses-of-commands-nice-renice-2201087 + * https://www.computerhope.com/unix/unice.htm + */ + + return true; + } + return false; + } + return false; // to satisfy phpstan + } + + protected function checkNiceSupport() + { + $ok = self::hasNiceSupport(); + if ($ok) { + $this->logLn('Tested "nice" command - it works :)'); + } else { + $this->logLn( + '**No "nice" support. To save a few ms, you can disable the "use-nice" option.**' + ); + } + return $ok; + } + + protected static function niceOption() + { + return ['use-nice', 'boolean', [ + 'title' => 'Use nice', + 'description' => + 'If *use-nice* is set, it will be examined if the *nice* command is available. ' . + 'If it is, the binary is executed using *nice*. This assigns low priority to the process and ' . + 'will save system resources - but result in slower conversion.', + 'default' => true, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true + ] + ]]; + } + + /** + * Logs output from the exec call. + * + * @param array $output + * + * @return void + */ + protected function logExecOutput($output) + { + if (is_array($output) && count($output) > 0) { + $this->logLn(''); + $this->logLn('Output:', 'italic'); + foreach ($output as $line) { + $this->logLn(print_r($line, true)); + } + $this->logLn(''); + } + } + + /** + * Check basic operationality of exec converters (that the "exec" or similar function is available) + * + * @throws WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException + * @return void + */ + public function checkOperationalityExecTrait() + { + if (!ExecWithFallback::anyAvailable()) { + throw new SystemRequirementsNotMetException( + 'exec() is not enabled (nor is alternative methods, such as proc_open())' + ); + } + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Cwebp.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Cwebp.php new file mode 100644 index 0000000..03e293b --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Cwebp.php @@ -0,0 +1,980 @@ + + * @since Class available since Release 2.0.0 + */ +class Cwebp extends AbstractConverter +{ + + use EncodingAutoTrait; + use ExecTrait; + + protected function getUnsupportedDefaultOptions() + { + return []; + } + + /** + * Get the options unique for this converter + * + * @return array Array of options + */ + public function getUniqueOptions($imageType) + { + $binariesForOS = []; + if (isset(self::$suppliedBinariesInfo[PHP_OS])) { + foreach (self::$suppliedBinariesInfo[PHP_OS] as $i => list($file, $hash, $version)) { + $binariesForOS[] = $file; + } + } + + return OptionFactory::createOptions([ + self::niceOption(), + ['try-cwebp', 'boolean', [ + 'title' => 'Try plain cwebp command', + 'description' => + 'If set, the converter will try executing "cwebp -version". In case it succeeds, ' . + 'and the version is higher than those working cwebps found using other methods, ' . + 'the conversion will be done by executing this cwebp.', + 'default' => true, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true + ] + ]], + ['try-discovering-cwebp', 'boolean', [ + 'title' => 'Try discovering cwebp binary', + 'description' => + 'If set, the converter will try to discover installed cwebp binaries using a "which -a cwebp" ' . + 'command, or in case that fails, a "whereis -b cwebp" command. These commands will find ' . + 'cwebp binaries residing in PATH', + 'default' => true, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true + ] + ]], + ['try-common-system-paths', 'boolean', [ + 'title' => 'Try locating cwebp in common system paths', + 'description' => + 'If set, the converter will look for a cwebp binaries residing in common system locations ' . + 'such as "/usr/bin/cwebp". If such exist, it is assumed that they are valid cwebp binaries. ' . + 'A version check will be run on the binaries found (they are executed with the "-version" flag. ' . + 'The cwebp with the highest version found using this method and the other enabled methods will ' . + 'be used for the actual conversion.' . + 'Note: All methods for discovering cwebp binaries are per default enabled. You can save a few ' . + 'microseconds by disabling some, but it is probably not worth it, as your ' . + 'setup will then become less resilient to system changes.', + 'default' => true, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true + ] + ]], + ['try-supplied-binary-for-os', 'boolean', [ + 'title' => 'Try precompiled cwebp binaries', + 'description' => + 'If set, the converter will try use a precompiled cwebp binary that comes with webp-convert. ' . + 'But only if it has a higher version that those found by other methods. As the library knows ' . + 'the versions of its bundled binaries, no additional time is spent executing them with the ' . + '"-version" parameter. The binaries are hash-checked before executed. ' . + 'The library btw. comes with several versions of precompiled cwebps because they have different ' . + 'dependencies - some works on some systems and others on others.', + 'default' => true, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true + ] + ]], + ['skip-these-precompiled-binaries', 'string', [ + 'title' => 'Skip these precompiled binaries', + 'description' => + '', + 'default' => '', + 'ui' => [ + 'component' => 'multi-select', + 'advanced' => true, + 'options' => $binariesForOS, + 'display' => "option('cwebp-try-supplied-binary-for-os') == true" + ] + + ]], + ['rel-path-to-precompiled-binaries', 'string', [ + 'title' => 'Rel path to precompiled binaries', + 'description' => + '', + 'default' => './Binaries', + 'ui' => [ + 'component' => '', + 'advanced' => true, + 'display' => "option('cwebp-try-supplied-binary-for-os') == true" + ], + 'sensitive' => true + ]], + ['command-line-options', 'string', [ + 'title' => 'Command line options', + 'description' => + '', + 'default' => '', + 'ui' => [ + 'component' => 'input', + 'advanced' => true, + ] + + ]], + ]); + } + + + // OS-specific binaries included in this library, along with hashes + // If other binaries are going to be added, notice that the first argument is what PHP_OS returns. + // (possible values, see here: https://stackoverflow.com/questions/738823/possible-values-for-php-os) + // Got the precompiled binaries here: https://developers.google.com/speed/webp/docs/precompiled + // Note when changing binaries: + // 1: Do NOT use "." in filename. It causes unzipping to fail on some hosts + // 2: Set permission to 775. 755 causes unzipping to fail on some hosts + private static $suppliedBinariesInfo = [ + 'WINNT' => [ + ['cwebp-120-windows-x64.exe', '2849fd06012a9eb311b02a4f8918ae4b16775693bc21e95f4cc6a382eac299f9', '1.2.0'], + + // Keep the 1.1.0 version a while, in case some may have problems with the 1.2.0 version + ['cwebp-110-windows-x64.exe', '442682869402f92ad2c8b3186c02b0ea6d6da68d2f908df38bf905b3411eb9fb', '1.1.0'], + ], + 'Darwin' => [ + ['cwebp-110-mac-10_15', 'bfce742da09b959f9f2929ba808fed9ade25c8025530434b6a47d217a6d2ceb5', '1.1.0'], + ], + 'SunOS' => [ + // Got this from ewww Wordpress plugin, which unfortunately still uses the old 0.6.0 versions + // Can you help me get a 1.0.3 version? + ['cwebp-060-solaris', '1febaffbb18e52dc2c524cda9eefd00c6db95bc388732868999c0f48deb73b4f', '0.6.0'] + ], + 'FreeBSD' => [ + // Got this from ewww Wordpress plugin, which unfortunately still uses the old 0.6.0 versions + // Can you help me get a 1.0.3 version? + ['cwebp-060-fbsd', 'e5cbea11c97fadffe221fdf57c093c19af2737e4bbd2cb3cd5e908de64286573', '0.6.0'] + ], + 'Linux' => [ + + // PS: Some experience the following error with 1.20: + // /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found + // (see #278) + + ['cwebp-120-linux-x86-64', 'f1b7dc03e95535a6b65852de07c0404be4dba078af48369f434ee39b2abf8f4e', '1.2.0'], + + // As some experience the an error with 1.20 (see #278), we keep the 1.10 + ['cwebp-110-linux-x86-64', '1603b07b592876dd9fdaa62b44aead800234c9474ff26dc7dd01bc0f4785c9c6', '1.1.0'], + + // Statically linked executable + // It may be that it on some systems works, where the dynamically linked does not (see #196) + [ + 'cwebp-103-linux-x86-64-static', + 'ab96f01b49336da8b976c498528080ff614112d5985da69943b48e0cb1c5228a', + '1.0.3' + ], + + // Old executable for systems in case all of the above fails + ['cwebp-061-linux-x86-64', '916623e5e9183237c851374d969aebdb96e0edc0692ab7937b95ea67dc3b2568', '0.6.1'], + ] + ]; + + /** + * Check all hashes of the precompiled binaries. + * + * This isn't used when converting, but can be used as a startup check. + */ + public static function checkAllHashes() + { + foreach (self::$suppliedBinariesInfo as $os => $arr) { + foreach ($arr as $i => list($filename, $expectedHash)) { + $actualHash = hash_file("sha256", __DIR__ . '/Binaries/' . $filename); + if ($expectedHash != $actualHash) { + throw new \Exception( + 'Hash for ' . $filename . ' is incorrect! ' . + 'Checksum is: ' . $actualHash . ', ' . + ', but expected: ' . $expectedHash . + '. Did you transfer with FTP, but not in binary mode? ' + ); + } + } + } + } + + public function checkOperationality() + { + $this->checkOperationalityExecTrait(); + + $options = $this->options; + if (!$options['try-supplied-binary-for-os'] && + !$options['try-common-system-paths'] && + !$options['try-cwebp'] && + !$options['try-discovering-cwebp'] + ) { + throw new ConverterNotOperationalException( + 'Configured to neither try pure cwebp command, ' . + 'nor look for cweb binaries in common system locations and ' . + 'nor to use one of the supplied precompiled binaries. ' . + 'But these are the only ways this converter can convert images. No conversion can be made!' + ); + } + } + + private function executeBinary($binary, $commandOptions, $useNice) + { + //$version = $this->detectVersion($binary); + + // Redirect stderr to same place as stdout with "2>&1" + // https://www.brianstorti.com/understanding-shell-script-idiom-redirect/ + + $command = ($useNice ? 'nice ' : '') . $binary . ' ' . $commandOptions . ' 2>&1'; + + //$logger->logLn('command options:' . $commandOptions); + $this->logLn('Trying to convert by executing the following command:'); + $startExecuteBinaryTime = self::startTimer(); + ; + $this->logLn($command); + ExecWithFallback::exec($command, $output, $returnCode); + $this->logExecOutput($output); + $this->logTimeSpent($startExecuteBinaryTime, 'Executing cwebp binary took: '); + $this->logLn(''); + /* + if ($returnCode == 255) { + if (isset($output[0])) { + // Could be an error like 'Error! Cannot open output file' or 'Error! ...preset... ' + $this->logLn(print_r($output[0], true)); + } + }*/ + //$logger->logLn(self::msgForExitCode($returnCode)); + return intval($returnCode); + } + + /** + * Use "escapeshellarg()" on all arguments in a commandline string of options + * + * For example, passing '-sharpness 5 -crop 10 10 40 40 -low_memory' will result in: + * [ + * "-sharpness '5'" + * "-crop '10' '10' '40' '40'" + * "-low_memory" + * ] + * @param string $commandLineOptions string which can contain multiple commandline options + * @return array Array of command options + */ + private static function escapeShellArgOnCommandLineOptions($commandLineOptions) + { + if (!ctype_print($commandLineOptions)) { + throw new ConversionFailedException( + 'Non-printable characters are not allowed in the extra command line options' + ); + } + + if (preg_match('#[^a-zA-Z0-9_\s\-]#', $commandLineOptions)) { + throw new ConversionFailedException('The extra command line options contains inacceptable characters'); + } + + $cmdOptions = []; + $arr = explode(' -', ' ' . $commandLineOptions); + foreach ($arr as $cmdOption) { + $pos = strpos($cmdOption, ' '); + $cName = ''; + if (!$pos) { + $cName = $cmdOption; + if ($cName == '') { + continue; + } + $cmdOptions[] = '-' . $cName; + } else { + $cName = substr($cmdOption, 0, $pos); + $cValues = substr($cmdOption, $pos + 1); + $cValuesArr = explode(' ', $cValues); + foreach ($cValuesArr as &$cArg) { + $cArg = escapeshellarg($cArg); + } + $cValues = implode(' ', $cValuesArr); + $cmdOptions[] = '-' . $cName . ' ' . $cValues; + } + } + return $cmdOptions; + } + + /** + * Build command line options for a given version of cwebp. + * + * The "-near_lossless" param is not supported on older versions of cwebp, so skip on those. + * + * @param string $version Version of cwebp (ie "1.0.3") + * @return string + */ + private function createCommandLineOptions($version) + { + + $this->logLn('Creating command line options for version: ' . $version); + + // we only need two decimal places for version. + // convert to number to make it easier to compare + $version = preg_match('#^\d+\.\d+#', $version, $matches); + $versionNum = 0; + if (isset($matches[0])) { + $versionNum = floatval($matches[0]); + } else { + $this->logLn( + 'Could not extract version number from the following version string: ' . $version, + 'bold' + ); + } + + //$this->logLn('version:' . strval($versionNum)); + + $options = $this->options; + + $cmdOptions = []; + + // Metadata (all, exif, icc, xmp or none (default)) + // Comma-separated list of existing metadata to copy from input to output + if ($versionNum >= 0.3) { + $cmdOptions[] = '-metadata ' . $options['metadata']; + } else { + $this->logLn('Ignoring metadata option (requires cwebp 0.3)', 'italic'); + } + + // preset. Appears first in the list as recommended in the docs + if (!is_null($options['preset'])) { + if ($options['preset'] != 'none') { + $cmdOptions[] = '-preset ' . escapeshellarg($options['preset']); + } + } + + // Size + $addedSizeOption = false; + if (!is_null($options['size-in-percentage'])) { + $sizeSource = filesize($this->source); + if ($sizeSource !== false) { + $targetSize = floor($sizeSource * $options['size-in-percentage'] / 100); + $cmdOptions[] = '-size ' . $targetSize; + $addedSizeOption = true; + } + } + + // quality + if (!$addedSizeOption) { + $cmdOptions[] = '-q ' . $this->getCalculatedQuality(); + } + + // alpha-quality + if ($this->options['alpha-quality'] !== 100) { + $cmdOptions[] = '-alpha_q ' . escapeshellarg($this->options['alpha-quality']); + } + + // Losless PNG conversion + if ($options['encoding'] == 'lossless') { + // No need to add -lossless when near-lossless is used (on version >= 0.5) + if (($options['near-lossless'] === 100) || ($versionNum < 0.5)) { + $cmdOptions[] = '-lossless'; + } + } + + // Near-lossles + if ($options['near-lossless'] !== 100) { + if ($versionNum < 0.5) { + $this->logLn('Ignoring near-lossless option (requires cwebp 0.5)', 'italic'); + } else { + // The "-near_lossless" flag triggers lossless encoding. We don't want that to happen, + // we want the "encoding" option to be respected, and we need it to be in order for + // encoding=auto to work. + // So: Only set when "encoding" is set to "lossless" + if ($options['encoding'] == 'lossless') { + $cmdOptions[] = '-near_lossless ' . $options['near-lossless']; + } else { + $this->logLn( + 'The near-lossless option ignored for lossy' + ); + } + } + } + + // Autofilter + if ($options['auto-filter'] === true) { + $cmdOptions[] = '-af'; + } + + // SharpYUV + if ($options['sharp-yuv'] === true) { + if ($versionNum >= 0.6) { // #284 + $cmdOptions[] = '-sharp_yuv'; + } else { + $this->logLn('Ignoring sharp-yuv option (requires cwebp 0.6)', 'italic'); + } + } + + + // Built-in method option + $cmdOptions[] = '-m ' . strval($options['method']); + + // Built-in low memory option + if ($options['low-memory']) { + $cmdOptions[] = '-low_memory'; + } + + // command-line-options + if ($options['command-line-options']) { + /* + In some years, we can use the splat instead (requires PHP 5.6) + array_push( + $cmdOptions, + ...self::escapeShellArgOnCommandLineOptions($options['command-line-options']) + ); + */ + foreach (self::escapeShellArgOnCommandLineOptions($options['command-line-options']) as $cmdLineOption) { + array_push($cmdOptions, $cmdLineOption); + } + } + + // Source file + $cmdOptions[] = escapeshellarg($this->source); + + // Output + $cmdOptions[] = '-o ' . escapeshellarg($this->destination); + + $commandOptions = implode(' ', $cmdOptions); + //$this->logLn('command line options:' . $commandOptions); + + return $commandOptions; + } + + private function checkHashForSuppliedBinary($binaryFile, $hash) + { + // File exists, now generate its hash + // hash_file() is normally available, but it is not always + // - https://stackoverflow.com/questions/17382712/php-5-3-20-undefined-function-hash + // If available, validate that hash is correct. + + if (function_exists('hash_file')) { + $this->logLn( + 'Checking checksum for supplied binary: ' . $binaryFile + ); + $startHashCheckTime = self::startTimer(); + + $binaryHash = hash_file('sha256', $binaryFile); + + if ($binaryHash != $hash) { + $this->logLn( + 'Binary checksum of supplied binary is invalid! ' . + 'Did you transfer with FTP, but not in binary mode? ' . + 'File:' . $binaryFile . '. ' . + 'Expected checksum: ' . $hash . '. ' . + 'Actual checksum:' . $binaryHash . '.', + 'bold' + ); + return false; + ; + } + + $this->logTimeSpent($startHashCheckTime, 'Checksum test took: '); + } + return true; + } + + /** + * Get supplied binary info for current OS. + * paths are made absolute and checked. Missing are removed + * + * @return array Two arrays. + * First array: array of files (absolute paths) + * Second array: array of info objects (absolute path, hash and version) + */ + private function getSuppliedBinaryInfoForCurrentOS() + { + $this->log('Checking if we have a supplied precompiled binary for your OS (' . PHP_OS . ')... '); + + // Try supplied binary (if available for OS, and hash is correct) + $options = $this->options; + if (!isset(self::$suppliedBinariesInfo[PHP_OS])) { + $this->logLn('No we dont - not for that OS'); + return []; + } + + $filesFound = []; + $info = []; + $files = self::$suppliedBinariesInfo[PHP_OS]; + if (count($files) == 1) { + $this->logLn('We do.'); + } else { + $this->logLn('We do. We in fact have ' . count($files)); + } + + $skipThese = explode(',', $this->options['skip-these-precompiled-binaries']); + + //$this->logLn('However, skipping' . print_r($skipThese, true)); + + foreach ($files as $i => list($file, $hash, $version)) { + //$file = $info[0]; + //$hash = $info[1]; + + $binaryFile = __DIR__ . '/' . $options['rel-path-to-precompiled-binaries'] . '/' . $file; + + // Replace "/./" with "/" in path (we could alternatively use realpath) + //$binaryFile = preg_replace('#\/\.\/#', '/', $binaryFile); + // The file should exist, but may have been removed manually. + /* + if (!file_exists($binaryFile)) { + $this->logLn('Supplied binary not found! It ought to be here:' . $binaryFile, 'italic'); + return false; + }*/ + if (in_array($file, $skipThese)) { + $this->logLn('Skipped: ' . $file . ' (was told to in the "skip-these-precompiled-binaries" option)'); + continue; + } + + + $realPathResult = realpath($binaryFile); + if ($realPathResult === false) { + $this->logLn('Supplied binary not found! It ought to be here:' . $binaryFile, 'italic'); + continue; + } + $binaryFile = $realPathResult; + $filesFound[] = $realPathResult; + $info[] = [$realPathResult, $hash, $version, $file]; + } + return [$filesFound, $info]; + } + + private function who() + { + ExecWithFallback::exec('whoami 2>&1', $whoOutput, $whoReturnCode); + if (($whoReturnCode == 0) && (isset($whoOutput[0]))) { + return 'user: "' . $whoOutput[0] . '"'; + } else { + return 'the user that the command was run with'; + } + } + + /** + * Detect the version of a cwebp binary. + * + * @param string $binary The binary to detect version for (path to cwebp or simply "cwebp") + * + * @return string|int Version string (ie "1.0.2") OR return code, in case of failure + */ + private function detectVersion($binary) + { + $command = $binary . ' -version 2>&1'; + $this->log('- Executing: ' . $command); + ExecWithFallback::exec($command, $output, $returnCode); + + if ($returnCode == 0) { + if (isset($output[0])) { + $this->logLn('. Result: version: *' . $output[0] . '*'); + return $output[0]; + } + } else { + $this->log('. Result: '); + if ($returnCode == 127) { + $this->logLn( + '*Exec failed* (the cwebp binary was not found at path: ' . $binary . + ', or it had missing library dependencies)' + ); + } else { + if ($returnCode == 126) { + $this->logLn( + '*Exec failed*. ' . + 'Permission denied (' . $this->who() . ' does not have permission to execute that binary)' + ); + } else { + $this->logLn( + '*Exec failed* (return code: ' . $returnCode . ')' + ); + $this->logExecOutput($output); + } + } + return $returnCode; + } + return ''; // Will not happen. Just so phpstan doesn't complain + } + + /** + * Check versions for an array of binaries. + * + * @param array $binaries array of binaries to detect the version of + * + * @return array the "detected" key holds working binaries and their version numbers, the + * the "failed" key holds failed binaries and their error codes. + */ + private function detectVersions($binaries) + { + $binariesWithVersions = []; + $binariesWithFailCodes = []; + + foreach ($binaries as $binary) { + $versionStringOrFailCode = $this->detectVersion($binary); + // $this->logLn($binary . ': ' . $versionString); + if (gettype($versionStringOrFailCode) == 'string') { + $binariesWithVersions[$binary] = $versionStringOrFailCode; + } else { + $binariesWithFailCodes[$binary] = $versionStringOrFailCode; + } + } + return ['detected' => $binariesWithVersions, 'failed' => $binariesWithFailCodes]; + } + + private function logBinariesFound($binaries, $startTime) + { + if (count($binaries) == 0) { + $this->logLn('Found 0 binaries' . self::getTimeStr($startTime)); + } else { + $this->logLn('Found ' . count($binaries) . ' binaries' . self::getTimeStr($startTime)); + foreach ($binaries as $binary) { + $this->logLn('- ' . $binary); + } + } + } + + private function logDiscoverAction($optionName, $description) + { + if ($this->options[$optionName]) { + $this->logLn( + 'Discovering binaries ' . $description . ' ' . + '(to skip this step, disable the "' . $optionName . '" option)' + ); + } else { + $this->logLn( + 'Skipped discovering binaries ' . $description . ' ' . + '(enable "' . $optionName . '" if you do not want to skip that step)' + ); + } + } + + private static function startTimer() + { + if (function_exists('microtime')) { + return microtime(true); + } else { + return 0; + } + } + + private static function readTimer($startTime) + { + if (function_exists('microtime')) { + $endTime = microtime(true); + $seconds = ($endTime - $startTime); + return round(($seconds * 1000)); + } else { + return 0; + } + } + + private static function getTimeStr($startTime, $pre = ' (spent ', $post = ')') + { + if (function_exists('microtime')) { + $ms = self::readTimer($startTime); + return $pre . $ms . ' ms' . $post; + } + return ''; + } + + private function logTimeSpent($startTime, $pre = 'Spent: ') + { + if (function_exists('microtime')) { + $ms = self::readTimer($startTime); + $this->logLn($pre . $ms . ' ms'); + } + } + + /** + * @return array Two arrays (in an array). + * First array: binaries found, + * Second array: supplied binaries info for current OS + */ + private function discoverCwebpBinaries() + { + $this->logLn( + 'Looking for cwebp binaries.' + ); + + $startDiscoveryTime = self::startTimer(); + + $binaries = []; + + if (defined('WEBPCONVERT_CWEBP_PATH')) { + $this->logLn('WEBPCONVERT_CWEBP_PATH was defined, so using that path and ignoring any other'); + return [[constant('WEBPCONVERT_CWEBP_PATH')],[[], []]]; + } + if (!empty(getenv('WEBPCONVERT_CWEBP_PATH'))) { + $this->logLn( + 'WEBPCONVERT_CWEBP_PATH environment variable was set, so using that path and ignoring any other' + ); + return [[getenv('WEBPCONVERT_CWEBP_PATH')],[[], []]]; + } + + if ($this->options['try-cwebp']) { + $startTime = self::startTimer(); + $this->logLn( + 'Discovering if a plain cwebp call works (to skip this step, disable the "try-cwebp" option)' + ); + $result = $this->detectVersion('cwebp'); + if (gettype($result) == 'string') { + $this->logLn('We could get the version, so yes, a plain cwebp call works ' . + '(spent ' . self::readTimer($startTime) . ' ms)'); + $binaries[] = 'cwebp'; + } else { + $this->logLn('Nope a plain cwebp call does not work' . self::getTimeStr($startTime)); + } + } else { + $this->logLn( + 'Skipped discovering if a plain cwebp call works' . + ' (enable the "try-cwebp" option if you do not want to skip that step)' + ); + } + + // try-discovering-cwebp + $startTime = self::startTimer(); + $this->logDiscoverAction('try-discovering-cwebp', 'using "which -a cwebp" command.'); + if ($this->options['try-discovering-cwebp']) { + $moreBinaries = LocateBinaries::locateInstalledBinaries('cwebp'); + $this->logBinariesFound($moreBinaries, $startTime); + $binaries = array_merge($binaries, $moreBinaries); + } + + // 'try-common-system-paths' + $startTime = self::startTimer(); + $this->logDiscoverAction('try-common-system-paths', 'by peeking in common system paths'); + if ($this->options['try-common-system-paths']) { + $moreBinaries = LocateBinaries::locateInCommonSystemPaths('cwebp'); + $this->logBinariesFound($moreBinaries, $startTime); + $binaries = array_merge($binaries, $moreBinaries); + } + + // try-supplied-binary-for-os + $suppliedBinariesInfo = [[], []]; + $startTime = self::startTimer(); + $this->logDiscoverAction('try-supplied-binary-for-os', 'which are distributed with the webp-convert library'); + if ($this->options['try-supplied-binary-for-os']) { + $suppliedBinariesInfo = $this->getSuppliedBinaryInfoForCurrentOS(); + $moreBinaries = $suppliedBinariesInfo[0]; + $this->logBinariesFound($moreBinaries, $startTime); + //$binaries = array_merge($binaries, $moreBinaries); + } + + $this->logTimeSpent($startDiscoveryTime, 'Discovering cwebp binaries took: '); + $this->logLn(''); + + return [array_values(array_unique($binaries)), $suppliedBinariesInfo]; + } + + /** + * Try executing a cwebp binary (or command, like: "cwebp") + * + * @param string $binary + * @param string $version Version of cwebp (ie "1.0.3") + * @param boolean $useNice Whether to use "nice" command or not + * + * @return boolean success or not. + */ + private function tryCwebpBinary($binary, $version, $useNice) + { + + //$this->logLn('Trying binary: ' . $binary); + $commandOptions = $this->createCommandLineOptions($version); + + $returnCode = $this->executeBinary($binary, $commandOptions, $useNice); + if ($returnCode == 0) { + // It has happened that even with return code 0, there was no file at destination. + if (!file_exists($this->destination)) { + $this->logLn('executing cweb returned success code - but no file was found at destination!'); + return false; + } else { + $this->logLn('Success'); + return true; + } + } else { + $this->logLn( + 'Exec failed (return code: ' . $returnCode . ')' + ); + return false; + } + } + + /** + * Helper for composing an error message when no converters are working. + * + * @param array $versions The array which we get from calling ::detectVersions($binaries) + * @return string An informative and to the point error message. + */ + private function composeMeaningfullErrorMessageNoVersionsWorking($versions) + { + // TODO: Take "supplied" into account + + // PS: array_values() is used to reindex + $uniqueFailCodes = array_values(array_unique(array_values($versions['failed']))); + $justOne = (count($versions['failed']) == 1); + + if (count($uniqueFailCodes) == 1) { + if ($uniqueFailCodes[0] == 127) { + return 'No cwebp binaries located. Check the conversion log for details.'; + } + } + // If there are more failures than 127, the 127 failures are unintesting. + // It is to be expected that some of the common system paths does not contain a cwebp. + $uniqueFailCodesBesides127 = array_values(array_diff($uniqueFailCodes, [127])); + + if (count($uniqueFailCodesBesides127) == 1) { + if ($uniqueFailCodesBesides127[0] == 126) { + return 'No cwebp binaries could be executed (permission denied for ' . $this->who() . ').'; + } + } + + $errorMsg = ''; + if ($justOne) { + $errorMsg .= 'The cwebp file found cannot be can be executed '; + } else { + $errorMsg .= 'None of the cwebp files can be executed '; + } + if (count($uniqueFailCodesBesides127) == 1) { + $errorMsg .= '(failure code: ' . $uniqueFailCodesBesides127[0] . ')'; + } else { + $errorMsg .= '(failure codes: ' . implode(', ', $uniqueFailCodesBesides127) . ')'; + } + return $errorMsg; + } + + protected function doActualConvert() + { + list($foundBinaries, $suppliedBinariesInfo) = $this->discoverCwebpBinaries(); + $suppliedBinaries = $suppliedBinariesInfo[0]; + $allBinaries = array_merge($foundBinaries, $suppliedBinaries); + + //$binaries = $this->discoverCwebpBinaries(); + if (count($allBinaries) == 0) { + $this->logLn('No cwebp binaries found!'); + + $discoverOptions = [ + 'try-supplied-binary-for-os', + 'try-common-system-paths', + 'try-cwebp', + 'try-discovering-cwebp' + ]; + $disabledDiscoverOptions = []; + foreach ($discoverOptions as $discoverOption) { + if (!$this->options[$discoverOption]) { + $disabledDiscoverOptions[] = $discoverOption; + } + } + if (count($disabledDiscoverOptions) == 0) { + throw new SystemRequirementsNotMetException( + 'No cwebp binaries found.' + ); + } else { + throw new SystemRequirementsNotMetException( + 'No cwebp binaries found. Try enabling the "' . + implode('" option or the "', $disabledDiscoverOptions) . '" option.' + ); + } + } + + $detectedVersions = []; + if (count($foundBinaries) > 0) { + $this->logLn( + 'Detecting versions of the cwebp binaries found' . + (count($suppliedBinaries) > 0 ? ' (except supplied binaries)' : '.') + ); + $startDetectionTime = self::startTimer(); + $versions = $this->detectVersions($foundBinaries); + $detectedVersions = $versions['detected']; + + $this->logTimeSpent($startDetectionTime, 'Detecting versions took: '); + } + + //$suppliedVersions = []; + $suppliedBinariesHash = []; + $suppliedBinariesFilename = []; + + $binaryVersions = $detectedVersions; + foreach ($suppliedBinariesInfo[1] as list($path, $hash, $version, $filename)) { + $binaryVersions[$path] = $version; + $suppliedBinariesHash[$path] = $hash; + $suppliedBinariesFilename[$path] = $filename; + } + + //$binaryVersions = array_merge($detectedVersions, $suppliedBinariesInfo); + + // TODO: reimplement + /* + $versions['supplied'] = $suppliedBinariesInfo; + + $binaryVersions = $versions['detected']; + if ((count($binaryVersions) == 0) && (count($suppliedBinaries) == 0)) { + // No working cwebp binaries found, no supplied binaries found + + throw new SystemRequirementsNotMetException( + $this->composeMeaningfullErrorMessageNoVersionsWorking($versions) + ); + }*/ + + // Sort binaries so those with highest numbers comes first + arsort($binaryVersions); + $this->logLn( + 'Binaries ordered by version number.' + ); + foreach ($binaryVersions as $binary => $version) { + $this->logLn('- ' . $binary . ': (version: ' . $version . ')'); + } + + // Execute! + $this->logLn( + 'Starting conversion, using the first of these. If that should fail, ' . + 'the next will be tried and so on.' + ); + $useNice = ($this->options['use-nice'] && $this->checkNiceSupport()); + + $success = false; + foreach ($binaryVersions as $binary => $version) { + if (isset($suppliedBinariesHash[$binary])) { + if (!$this->checkHashForSuppliedBinary($binary, $suppliedBinariesHash[$binary])) { + continue; + } + } + if ($this->tryCwebpBinary($binary, $version, $useNice)) { + $success = true; + break; + } else { + if (isset($suppliedBinariesFilename[$binary])) { + $this->logLn( + 'Note: You can prevent trying this precompiled binary, by setting the ' . + '"skip-these-precompiled-binaries" option to "' . $suppliedBinariesFilename[$binary] . '"' + ); + } + } + } + + // cwebp sets file permissions to 664 but instead .. + // .. $this->source file permissions should be used + + if ($success) { + $fileStatistics = stat($this->source); + if ($fileStatistics !== false) { + // Apply same permissions as source file, but strip off the executable bits + $permissions = $fileStatistics['mode'] & 0000666; + chmod($this->destination, $permissions); + } + } else { + throw new SystemRequirementsNotMetException('Failed converting. Check the conversion log for details.'); + } + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Ewww.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Ewww.php new file mode 100644 index 0000000..2fc885a --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Ewww.php @@ -0,0 +1,393 @@ + + * @since Class available since Release 2.0.0 + */ +class Ewww extends AbstractConverter +{ + use CloudConverterTrait; + use CurlTrait; + + /** @var array|null Array of invalid or exceeded api keys discovered during conversions (during the request) */ + public static $nonFunctionalApiKeysDiscoveredDuringConversion; + + public function getUniqueOptions($imageType) + { + return OptionFactory::createOptions([ + ['api-key', 'string', [ + 'title' => 'Ewww API key', + 'description' => 'ewww API key. ' . + 'If you choose "auto", webp-convert will ' . + 'convert to both lossy and lossless and pick the smallest result', + 'default' => '', + 'sensitive' => true, + 'ui' => [ + 'component' => 'password', + ] + ]], + ['check-key-status-before-converting', 'boolean', [ + 'title' => 'Check key status before converting', + 'description' => + 'If enabled, the api key will be validated (relative inexpensive) before trying ' . + 'to convert. For automatic conversions, you should enable it. Otherwise you run the ' . + 'risk that the same files will be uploaded to ewww cloud service over and over again, ' . + 'in case the key has expired. For manually triggered conversions, you can safely disable ' . + 'the option.', + 'default' => true, + 'ui' => [ + 'component' => 'checkbox', + ] + ]], + ]); + } + + protected function getUnsupportedDefaultOptions() + { + return [ + 'alpha-quality', + 'auto-filter', + 'encoding', + 'low-memory', + 'method', + 'near-lossless', + 'preset', + 'sharp-yuv', + 'size-in-percentage', + ]; + } + + /** + * Get api key from options or environment variable + * + * @return string|false api key or false if none is set + */ + private function getKey() + { + if (!empty($this->options['api-key'])) { + return $this->options['api-key']; + } + if (defined('WEBPCONVERT_EWWW_API_KEY')) { + return constant('WEBPCONVERT_EWWW_API_KEY'); + } + if (!empty(getenv('WEBPCONVERT_EWWW_API_KEY'))) { + return getenv('WEBPCONVERT_EWWW_API_KEY'); + } + return false; + } + + + /** + * Check operationality of Ewww converter. + * + * @throws SystemRequirementsNotMetException if system requirements are not met (curl) + * @throws ConverterNotOperationalException if key is missing or invalid, or quota has exceeded + */ + public function checkOperationality() + { + + $apiKey = $this->getKey(); + + if ($apiKey === false) { + if (isset($this->options['key'])) { + throw new InvalidApiKeyException( + 'The "key" option has been renamed to "api-key" in webp-convert 2.0. ' . + 'You must change the configuration accordingly.' + ); + } + + throw new InvalidApiKeyException('Missing API key.'); + } + + if (strlen($apiKey) < 20) { + throw new InvalidApiKeyException( + 'Api key is invalid. Api keys are supposed to be 32 characters long - ' . + 'the provided api key is much shorter' + ); + } + + // Check for curl requirements + $this->checkOperationalityForCurlTrait(); + + if ($this->options['check-key-status-before-converting']) { + $keyStatus = self::getKeyStatus($apiKey); + switch ($keyStatus) { + case 'great': + break; + case 'exceeded': + throw new ConverterNotOperationalException('Quota has exceeded'); + //break; + case 'invalid': + throw new InvalidApiKeyException('Api key is invalid'); + //break; + } + } + } + + /* + public function checkConvertability() + { + // check upload limits + $this->checkConvertabilityCloudConverterTrait(); + } + */ + + // Although this method is public, do not call directly. + // You should rather call the static convert() function, defined in AbstractConverter, which + // takes care of preparing stuff before calling doConvert, and validating after. + protected function doActualConvert() + { + + $options = $this->options; + + $ch = self::initCurl(); + + //$this->logLn('api key:' . $this->getKey()); + + $postData = [ + 'api_key' => $this->getKey(), + 'webp' => '1', + 'file' => curl_file_create($this->source), + 'quality' => $this->getCalculatedQuality(), + 'metadata' => ($options['metadata'] == 'none' ? '0' : '1') + ]; + + curl_setopt_array( + $ch, + [ + CURLOPT_URL => "https://optimize.exactlywww.com/v2/", + CURLOPT_HTTPHEADER => [ + 'User-Agent: WebPConvert', + 'Accept: image/*' + ], + CURLOPT_POSTFIELDS => $postData, + CURLOPT_BINARYTRANSFER => true, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HEADER => false, + CURLOPT_SSL_VERIFYPEER => false + ] + ); + + $response = curl_exec($ch); + + if (curl_errno($ch)) { + throw new ConversionFailedException(curl_error($ch)); + } + + // The API does not always return images. + // For example, it may return a message such as '{"error":"invalid","t":"exceeded"} + // Messages has a http content type of ie 'text/html; charset=UTF-8 + // Images has application/octet-stream. + // So verify that we got an image back. + if (curl_getinfo($ch, CURLINFO_CONTENT_TYPE) != 'application/octet-stream') { + //echo curl_getinfo($ch, CURLINFO_CONTENT_TYPE); + curl_close($ch); + + /* + For bogus or expired key it returns: {"error":"invalid","t":"exceeded"} + For exceeded key it returns: {"error":"exceeded"} + */ + $responseObj = json_decode($response); + if (isset($responseObj->error)) { + $this->logLn('We received the following error response: ' . $responseObj->error); + $this->logLn('Complete response: ' . json_encode($responseObj)); + + // Store the invalid key in array so it can be received once the Stack is completed + // (even when stack succeeds) + if (!isset(self::$nonFunctionalApiKeysDiscoveredDuringConversion)) { + self::$nonFunctionalApiKeysDiscoveredDuringConversion = []; + } + if (!in_array($options['api-key'], self::$nonFunctionalApiKeysDiscoveredDuringConversion)) { + self::$nonFunctionalApiKeysDiscoveredDuringConversion[] = $options['api-key']; + } + if ($responseObj->error == "invalid") { + throw new InvalidApiKeyException('The api key is invalid (or expired)'); + } else { + throw new InvalidApiKeyException('The quota is exceeded for the api-key'); + } + } + + throw new ConversionFailedException( + 'ewww api did not return an image. It could be that the key is invalid. Response: ' + . $response + ); + } + + // Not sure this can happen. So just in case + if ($response == '') { + throw new ConversionFailedException('ewww api did not return anything'); + } + + $success = file_put_contents($this->destination, $response); + + if (!$success) { + throw new ConversionFailedException('Error saving file'); + } + } + + /** + * Keep subscription alive by optimizing a jpeg + * (ewww closes accounts after 6 months of inactivity - and webp conversions seems not to be counted? ) + */ + public static function keepSubscriptionAlive($source, $key) + { + try { + $ch = curl_init(); + } catch (\Exception $e) { + return 'curl is not installed'; + } + if ($ch === false) { + return 'curl could not be initialized'; + } + curl_setopt_array( + $ch, + [ + CURLOPT_URL => "https://optimize.exactlywww.com/v2/", + CURLOPT_HTTPHEADER => [ + 'User-Agent: WebPConvert', + 'Accept: image/*' + ], + CURLOPT_POSTFIELDS => [ + 'api_key' => $key, + 'webp' => '0', + 'file' => curl_file_create($source), + 'domain' => $_SERVER['HTTP_HOST'], + 'quality' => 60, + 'metadata' => 0 + ], + CURLOPT_BINARYTRANSFER => true, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HEADER => false, + CURLOPT_SSL_VERIFYPEER => false + ] + ); + + $response = curl_exec($ch); + if (curl_errno($ch)) { + return 'curl error' . curl_error($ch); + } + if (curl_getinfo($ch, CURLINFO_CONTENT_TYPE) != 'application/octet-stream') { + curl_close($ch); + + /* May return this: {"error":"invalid","t":"exceeded"} */ + $responseObj = json_decode($response); + if (isset($responseObj->error)) { + return 'The key is invalid'; + } + + return 'ewww api did not return an image. It could be that the key is invalid. Response: ' . $response; + } + + // Not sure this can happen. So just in case + if ($response == '') { + return 'ewww api did not return anything'; + } + + return true; + } + + /* + public static function blacklistKey($key) + { + } + + public static function isKeyBlacklisted($key) + { + }*/ + + /** + * Return "great", "exceeded" or "invalid" + */ + public static function getKeyStatus($key) + { + $ch = self::initCurl(); + + curl_setopt($ch, CURLOPT_URL, "https://optimize.exactlywww.com/verify/"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, [ + 'api_key' => $key + ]); + + curl_setopt($ch, CURLOPT_USERAGENT, 'WebPConvert'); + + $response = curl_exec($ch); + // echo $response; + if (curl_errno($ch)) { + throw new \Exception(curl_error($ch)); + } + curl_close($ch); + + // Possible responses: + // “great” = verification successful + // “exceeded” = indicates a valid key with no remaining image credits. + // an empty response indicates that the key is not valid + + if ($response == '') { + return 'invalid'; + } + $responseObj = json_decode($response); + if (isset($responseObj->error)) { + if ($responseObj->error == 'invalid') { + return 'invalid'; + } else { + if ($responseObj->error == 'bye invalid') { + return 'invalid'; + } else { + throw new \Exception('Ewww returned unexpected error: ' . $response); + } + } + } + if (!isset($responseObj->status)) { + throw new \Exception('Ewww returned unexpected response to verify request: ' . $response); + } + switch ($responseObj->status) { + case 'great': + case 'exceeded': + return $responseObj->status; + } + throw new \Exception('Ewww returned unexpected status to verify request: "' . $responseObj->status . '"'); + } + + public static function isWorkingKey($key) + { + return (self::getKeyStatus($key) == 'great'); + } + + public static function isValidKey($key) + { + return (self::getKeyStatus($key) != 'invalid'); + } + + public static function getQuota($key) + { + $ch = self::initCurl(); + + curl_setopt($ch, CURLOPT_URL, "https://optimize.exactlywww.com/quota/"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, [ + 'api_key' => $key + ]); + curl_setopt($ch, CURLOPT_USERAGENT, 'WebPConvert'); + + $response = curl_exec($ch); + return $response; // ie -830 23. Seems to return empty for invalid keys + // or empty + //echo $response; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/FFMpeg.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/FFMpeg.php new file mode 100644 index 0000000..bfaaf08 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/FFMpeg.php @@ -0,0 +1,178 @@ + + * @since Class available since Release 2.0.0 + */ +class FFMpeg extends AbstractConverter +{ + use ExecTrait; + use EncodingAutoTrait; + + protected function getUnsupportedDefaultOptions() + { + return [ + 'alpha-quality', + 'auto-filter', + 'low-memory', + 'metadata', + 'near-lossless', + 'sharp-yuv', + 'size-in-percentage', + ]; + } + + /** + * Get the options unique for this converter + * + * @return array Array of options + */ + public function getUniqueOptions($imageType) + { + return OptionFactory::createOptions([ + self::niceOption() + ]); + } + + private function getPath() + { + if (defined('WEBPCONVERT_FFMPEG_PATH')) { + return constant('WEBPCONVERT_FFMPEG_PATH'); + } + if (!empty(getenv('WEBPCONVERT_FFMPEG_PATH'))) { + return getenv('WEBPCONVERT_FFMPEG_PATH'); + } + return 'ffmpeg'; + } + + public function isInstalled() + { + ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode); + return ($returnCode == 0); + } + + // Check if webp delegate is installed + public function isWebPDelegateInstalled() + { + ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode); + foreach ($output as $line) { + if (preg_match('# --enable-libwebp#i', $line)) { + return true; + } + } + return false; + } + + /** + * Check (general) operationality of imagack converter executable + * + * @throws SystemRequirementsNotMetException if system requirements are not met + */ + public function checkOperationality() + { + $this->checkOperationalityExecTrait(); + + if (!$this->isInstalled()) { + throw new SystemRequirementsNotMetException( + 'ffmpeg is not installed (cannot execute: "' . $this->getPath() . '")' + ); + } + if (!$this->isWebPDelegateInstalled()) { + throw new SystemRequirementsNotMetException('ffmpeg was compiled without libwebp'); + } + } + + /** + * Build command line options + * + * @return string + */ + private function createCommandLineOptions() + { + // PS: Available webp options for ffmpeg are documented here: + // https://www.ffmpeg.org/ffmpeg-codecs.html#libwebp + + $commandArguments = []; + + $commandArguments[] = '-i'; + $commandArguments[] = escapeshellarg($this->source); + + // preset. Appears first in the list as recommended in the cwebp docs + if (!is_null($this->options['preset'])) { + if ($this->options['preset'] != 'none') { + $commandArguments[] = '-preset ' . $this->options['preset']; + } + } + + // Overwrite existing files?, yes! + $commandArguments[] = '-y'; + + if ($this->isQualityDetectionRequiredButFailing()) { + // quality:auto was specified, but could not be determined. + // we cannot apply the max-quality logic, but we can provide auto quality + // simply by not specifying the quality option. + } else { + $commandArguments[] = '-qscale ' . escapeshellarg($this->getCalculatedQuality()); + } + if ($this->options['encoding'] == 'lossless') { + $commandArguments[] = '-lossless 1'; + } else { + $commandArguments[] = '-lossless 0'; + } + + if ($this->options['metadata'] == 'none') { + // Unfortunately there seems to be no easy solution available for removing all metadata. + } + + // compression_level maps to method, according to https://www.ffmpeg.org/ffmpeg-codecs.html#libwebp + $commandArguments[] = '-compression_level ' . $this->options['method']; + + $commandArguments[] = escapeshellarg($this->destination); + + + return implode(' ', $commandArguments); + } + + protected function doActualConvert() + { + //$this->logLn($this->getVersion()); + + $command = $this->getPath() . ' ' . $this->createCommandLineOptions() . ' 2>&1'; + + $useNice = ($this->options['use-nice'] && $this->checkNiceSupport()); + if ($useNice) { + $command = 'nice ' . $command; + } + $this->logLn('Executing command: ' . $command); + ExecWithFallback::exec($command, $output, $returnCode); + + $this->logExecOutput($output); + if ($returnCode == 0) { + $this->logLn('success'); + } else { + $this->logLn('return code: ' . $returnCode); + } + + if ($returnCode == 127) { + throw new SystemRequirementsNotMetException('ffmpeg is not installed'); + } + if ($returnCode != 0) { + throw new SystemRequirementsNotMetException('The exec() call failed'); + } + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Gd.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Gd.php new file mode 100644 index 0000000..101acce --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Gd.php @@ -0,0 +1,536 @@ + + * @since Class available since Release 2.0.0 + */ +class Gd extends AbstractConverter +{ + public function supportsLossless() + { + return false; + } + + protected function getUnsupportedDefaultOptions() + { + return [ + 'alpha-quality', + 'auto-filter', + 'encoding', + 'low-memory', + 'metadata', + 'method', + 'near-lossless', + 'preset', + 'sharp-yuv', + 'size-in-percentage', + ]; + } + + private $errorMessageWhileCreating = ''; + private $errorNumberWhileCreating; + + /** + * Check (general) operationality of Gd converter. + * + * @throws SystemRequirementsNotMetException if system requirements are not met + */ + public function checkOperationality() + { + if (!extension_loaded('gd')) { + throw new SystemRequirementsNotMetException('Required Gd extension is not available.'); + } + + if (!function_exists('imagewebp')) { + throw new SystemRequirementsNotMetException( + 'Gd has been compiled without webp support.' + ); + } + + if (!function_exists('imagepalettetotruecolor')) { + if (!self::functionsExist([ + 'imagecreatetruecolor', 'imagealphablending', 'imagecolorallocatealpha', + 'imagefilledrectangle', 'imagecopy', 'imagedestroy', 'imagesx', 'imagesy' + ])) { + throw new SystemRequirementsNotMetException( + 'Gd cannot convert palette color images to RGB. ' . + 'Even though it would be possible to convert RGB images to webp with Gd, ' . + 'we refuse to do it. A partial working converter causes more trouble than ' . + 'a non-working. To make this converter work, you need the imagepalettetotruecolor() ' . + 'function to be enabled on your system.' + ); + } + } + } + + /** + * Check if specific file is convertable with current converter / converter settings. + * + * @throws SystemRequirementsNotMetException if Gd has been compiled without support for image type + */ + public function checkConvertability() + { + $mimeType = $this->getMimeTypeOfSource(); + switch ($mimeType) { + case 'image/png': + if (!function_exists('imagecreatefrompng')) { + throw new SystemRequirementsNotMetException( + 'Gd has been compiled without PNG support and can therefore not convert this PNG image.' + ); + } + break; + + case 'image/jpeg': + if (!function_exists('imagecreatefromjpeg')) { + throw new SystemRequirementsNotMetException( + 'Gd has been compiled without Jpeg support and can therefore not convert this jpeg image.' + ); + } + } + } + + /** + * Find out if all functions exists. + * + * @return boolean + */ + private static function functionsExist($functionNamesArr) + { + foreach ($functionNamesArr as $functionName) { + if (!function_exists($functionName)) { + return false; + } + } + return true; + } + + /** + * Try to convert image pallette to true color on older systems that does not have imagepalettetotruecolor(). + * + * The aim is to function as imagepalettetotruecolor, but for older systems. + * So, if the image is already rgb, nothing will be done, and true will be returned + * PS: Got the workaround here: https://secure.php.net/manual/en/function.imagepalettetotruecolor.php + * + * @param resource|\GdImage $image + * @return boolean TRUE if the convertion was complete, or if the source image already is a true color image, + * otherwise FALSE is returned. + */ + private function makeTrueColorUsingWorkaround(&$image) + { + //return $this->makeTrueColor($image); + /* + if (function_exists('imageistruecolor') && imageistruecolor($image)) { + return true; + }*/ + if (self::functionsExist(['imagecreatetruecolor', 'imagealphablending', 'imagecolorallocatealpha', + 'imagefilledrectangle', 'imagecopy', 'imagedestroy', 'imagesx', 'imagesy'])) { + $dst = imagecreatetruecolor(imagesx($image), imagesy($image)); + + if ($dst === false) { + return false; + } + + $success = false; + + //prevent blending with default black + if (imagealphablending($dst, false) !== false) { + //change the RGB values if you need, but leave alpha at 127 + $transparent = imagecolorallocatealpha($dst, 255, 255, 255, 127); + + if ($transparent !== false) { + //simpler than flood fill + if (imagefilledrectangle($dst, 0, 0, imagesx($image), imagesy($image), $transparent) !== false) { + //restore default blending + if (imagealphablending($dst, true) !== false) { + if (imagecopy($dst, $image, 0, 0, 0, 0, imagesx($image), imagesy($image)) !== false) { + $success = true; + } + }; + } + } + } + if ($success) { + imagedestroy($image); + $image = $dst; + } else { + imagedestroy($dst); + } + return $success; + } else { + // The necessary methods for converting color palette are not avalaible + return false; + } + } + + /** + * Try to convert image pallette to true color. + * + * Try to convert image pallette to true color. If imagepalettetotruecolor() exists, that is used (available from + * PHP >= 5.5.0). Otherwise using workaround found on the net. + * + * @param resource|\GdImage $image + * @return boolean TRUE if the convertion was complete, or if the source image already is a true color image, + * otherwise FALSE is returned. + */ + private function makeTrueColor(&$image) + { + if (function_exists('imagepalettetotruecolor')) { + return imagepalettetotruecolor($image); + } else { + $this->logLn( + 'imagepalettetotruecolor() is not available on this system - using custom implementation instead' + ); + return $this->makeTrueColorUsingWorkaround($image); + } + } + + /** + * Create Gd image resource from source + * + * @throws InvalidInputException if mime type is unsupported or could not be detected + * @throws ConversionFailedException if imagecreatefrompng or imagecreatefromjpeg fails + * @return resource|\GdImage $image The created image + */ + private function createImageResource() + { + $mimeType = $this->getMimeTypeOfSource(); + + switch ($mimeType) { + case 'image/png': + $image = imagecreatefrompng($this->source); + if ($image === false) { + throw new ConversionFailedException( + 'Gd failed when trying to load/create image (imagecreatefrompng() failed)' + ); + } + return $image; + + case 'image/jpeg': + $image = imagecreatefromjpeg($this->source); + if ($image === false) { + throw new ConversionFailedException( + 'Gd failed when trying to load/create image (imagecreatefromjpeg() failed)' + ); + } + return $image; + } + + throw new InvalidInputException('Unsupported mime type'); + } + + /** + * Try to make image resource true color if it is not already. + * + * @param resource|\GdImage $image The image to work on + * @return boolean|null True if it is now true color. False if it is NOT true color. null, if we cannot tell + */ + protected function tryToMakeTrueColorIfNot(&$image) + { + $whatIsItNow = null; + $mustMakeTrueColor = false; + if (function_exists('imageistruecolor')) { + if (imageistruecolor($image)) { + $this->logLn('image is true color'); + $whatIsItNow = true; + } else { + $this->logLn('image is not true color'); + $mustMakeTrueColor = true; + $whatIsItNow = false; + } + } else { + $this->logLn('It can not be determined if image is true color'); + $mustMakeTrueColor = true; + } + + if ($mustMakeTrueColor) { + $this->logLn('converting color palette to true color'); + $success = $this->makeTrueColor($image); + if ($success) { + return true; + } else { + $this->logLn( + 'FAILED converting color palette to true color. ' + ); + } + } + return $whatIsItNow; + } + + /** + * + * @param resource|\GdImage $image + * @return boolean true if alpha blending was set successfully, false otherwise + */ + protected function trySettingAlphaBlending($image) + { + if (function_exists('imagealphablending')) { + // TODO: Should we set second parameter to false instead? + // As here: https://www.texelate.co.uk/blog/retaining-png-transparency-with-php-gd + // (PS: I have backed up some local changes - to Gd.php, which includes changing that param + // to false. But I didn't finish up back then and now I forgot, so need to retest before + // changing anything... + if (!imagealphablending($image, true)) { + $this->logLn('Warning: imagealphablending() failed'); + return false; + } + } else { + $this->logLn( + 'Warning: imagealphablending() is not available on your system.' . + ' Converting PNGs with transparency might fail on some systems' + ); + return false; + } + + if (function_exists('imagesavealpha')) { + if (!imagesavealpha($image, true)) { + $this->logLn('Warning: imagesavealpha() failed'); + return false; + } + } else { + $this->logLn( + 'Warning: imagesavealpha() is not available on your system. ' . + 'Converting PNGs with transparency might fail on some systems' + ); + return false; + } + return true; + } + + protected function errorHandlerWhileCreatingWebP($errno, $errstr, $errfile, $errline) + { + $this->errorNumberWhileCreating = $errno; + $this->errorMessageWhileCreating = $errstr . ' in ' . $errfile . ', line ' . $errline . + ', PHP ' . PHP_VERSION . ' (' . PHP_OS . ')'; + //return false; + } + + /** + * + * @param resource|\GdImage $image + * @return void + */ + protected function destroyAndRemove($image) + { + imagedestroy($image); + if (file_exists($this->destination)) { + unlink($this->destination); + } + } + + /** + * + * @param resource|\GdImage $image + * @return void + */ + protected function tryConverting($image) + { + + // Danger zone! + // Using output buffering to generate image. + // In this zone, Do NOT do anything that might produce unwanted output + // Do NOT call $this->logLn + // --------------------------------- (start of danger zone) + + $addedZeroPadding = false; + set_error_handler(array($this, "errorHandlerWhileCreatingWebP")); + + // This line may trigger log, so we need to do it BEFORE ob_start() ! + $q = $this->getCalculatedQuality(); + + ob_start(); + + // Adding this try/catch is perhaps not neccessary. + // I'm not certain that the error handler takes care of Throwable errors. + // and - sorry - was to lazy to find out right now. So for now: better safe than sorry. #320 + $error = null; + $success = false; + + try { + // Beware: This call can throw FATAL on windows (cannot be catched) + // This for example happens on palette images + $success = imagewebp($image, null, $q); + } catch (\Exception $e) { + $error = $e; + } catch (\Throwable $e) { + $error = $e; + } + if (!is_null($error)) { + restore_error_handler(); + ob_end_clean(); + $this->destroyAndRemove($image); + throw $error; + } + if (!$success) { + $this->destroyAndRemove($image); + ob_end_clean(); + restore_error_handler(); + throw new ConversionFailedException( + 'Failed creating image. Call to imagewebp() failed.', + $this->errorMessageWhileCreating + ); + } + + + // The following hack solves an `imagewebp` bug + // See https://stackoverflow.com/questions/30078090/imagewebp-php-creates-corrupted-webp-files + if (ob_get_length() % 2 == 1) { + echo "\0"; + $addedZeroPadding = true; + } + $output = ob_get_clean(); + restore_error_handler(); + + if ($output == '') { + $this->destroyAndRemove($image); + throw new ConversionFailedException( + 'Gd failed: imagewebp() returned empty string' + ); + } + + // --------------------------------- (end of danger zone). + + + if ($this->errorMessageWhileCreating != '') { + switch ($this->errorNumberWhileCreating) { + case E_WARNING: + $this->logLn('An warning was produced during conversion: ' . $this->errorMessageWhileCreating); + break; + case E_NOTICE: + $this->logLn('An notice was produced during conversion: ' . $this->errorMessageWhileCreating); + break; + default: + $this->destroyAndRemove($image); + throw new ConversionFailedException( + 'An error was produced during conversion', + $this->errorMessageWhileCreating + ); + //break; + } + } + + if ($addedZeroPadding) { + $this->logLn( + 'Fixing corrupt webp by adding a zero byte ' . + '(older versions of Gd had a bug, but this hack fixes it)' + ); + } + + $success = file_put_contents($this->destination, $output); + + if (!$success) { + $this->destroyAndRemove($image); + throw new ConversionFailedException( + 'Gd failed when trying to save the image. Check file permissions!' + ); + } + + /* + Previous code was much simpler, but on a system, the hack was not activated (a file with uneven number of bytes + was created). This is puzzeling. And the old code did not provide any insights. + Also, perhaps having two subsequent writes to the same file could perhaps cause a problem. + In the new code, there is only one write. + However, a bad thing about the new code is that the entire webp file is read into memory. This might cause + memory overflow with big files. + Perhaps we should check the filesize of the original and only use the new code when it is smaller than + memory limit set in PHP by a certain factor. + Or perhaps only use the new code on older versions of Gd + https://wordpress.org/support/topic/images-not-seen-on-chrome/#post-11390284 + + Here is the old code: + + $success = imagewebp($image, $this->destination, $this->getCalculatedQuality()); + + if (!$success) { + throw new ConversionFailedException( + 'Gd failed when trying to save the image as webp (call to imagewebp() failed). ' . + 'It probably failed writing file. Check file permissions!' + ); + } + + + // This hack solves an `imagewebp` bug + // See https://stackoverflow.com/questions/30078090/imagewebp-php-creates-corrupted-webp-files + if (filesize($this->destination) % 2 == 1) { + file_put_contents($this->destination, "\0", FILE_APPEND); + } + */ + } + + // Although this method is public, do not call directly. + // You should rather call the static convert() function, defined in AbstractConverter, which + // takes care of preparing stuff before calling doConvert, and validating after. + protected function doActualConvert() + { + $versionString = gd_info()["GD Version"]; + $this->logLn('GD Version: ' . $versionString); + + // Btw: Check out processWebp here: + // https://github.com/Intervention/image/blob/master/src/Intervention/Image/Gd/Encoder.php + + // Create image resource + $image = $this->createImageResource(); + + // Try to convert color palette if it is not true color + $isItTrueColorNow = $this->tryToMakeTrueColorIfNot($image); + if ($isItTrueColorNow === false) { + // our tests shows that converting palette fails on all systems, + throw new ConversionFailedException( + 'Cannot convert image because it is a palette image and the palette image cannot ' . + 'be converted to RGB (which is required). To convert to RGB, we would need ' . + 'imagepalettetotruecolor(), which is not available on your system. ' . + 'Our workaround does not have the neccasary functions for converting to RGB either.' + ); + } + if (is_null($isItTrueColorNow)) { + $isWindows = preg_match('/^win/i', PHP_OS); + $isMacDarwin = preg_match('/^darwin/i', PHP_OS); // actually no problem in PHP 7.4 and 8.0 + if ($isWindows || $isMacDarwin) { + throw new ConversionFailedException( + 'Cannot convert image because it appears to be a palette image and the palette image ' . + 'cannot be converted to RGB, as you do not have imagepalettetotruecolor() enabled. ' . + 'Converting palette on ' . + ($isWindows ? 'Windows causes FATAL error' : 'Mac causes halt') . + 'So we abort now' + ); + } + } + + if ($this->getMimeTypeOfSource() == 'image/png') { + if (function_exists('version_compare')) { + if (version_compare($versionString, "2.1.1", "<=")) { + $this->logLn( + 'BEWARE: Your version of Gd looses the alpha chanel when converting to webp.' . + 'You should upgrade Gd, use another converter or stop converting PNGs. ' . + 'See: https://github.com/rosell-dk/webp-convert/issues/238' + ); + } elseif (version_compare($versionString, "2.2.4", "<=")) { + $this->logLn( + 'BEWARE: Older versions of Gd looses the alpha chanel when converting to webp.' . + 'We have not tested if transparency fails on your (rather old) version of Gd. ' . + 'Please let us know. ' . + 'See: https://github.com/rosell-dk/webp-convert/issues/238' + ); + } + } + + // Try to set alpha blending + $this->trySettingAlphaBlending($image); + } + + // Try to convert it to webp + $this->tryConverting($image); + + // End of story + imagedestroy($image); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Gmagick.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Gmagick.php new file mode 100644 index 0000000..0108c72 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Gmagick.php @@ -0,0 +1,173 @@ + + * @since Class available since Release 2.0.0 + */ +class Gmagick extends AbstractConverter +{ + use EncodingAutoTrait; + + protected function getUnsupportedDefaultOptions() + { + return [ + 'near-lossless', + 'size-in-percentage', + ]; + } + + /** + * Check (general) operationality of Gmagick converter. + * + * Note: + * It may be that Gd has been compiled without jpeg support or png support. + * We do not check for this here, as the converter could still be used for the other. + * + * @throws SystemRequirementsNotMetException if system requirements are not met + */ + public function checkOperationality() + { + if (!extension_loaded('Gmagick')) { + throw new SystemRequirementsNotMetException('Required Gmagick extension is not available.'); + } + + if (!class_exists('Gmagick')) { + throw new SystemRequirementsNotMetException( + 'Gmagick is installed, but not correctly. The class Gmagick is not available' + ); + } + + $im = new \Gmagick($this->source); + + if (!in_array('WEBP', $im->queryformats())) { + throw new SystemRequirementsNotMetException('Gmagick was compiled without WebP support.'); + } + } + + /** + * Check if specific file is convertable with current converter / converter settings. + * + * @throws SystemRequirementsNotMetException if Gmagick does not support image type + */ + public function checkConvertability() + { + $im = new \Gmagick(); + $mimeType = $this->getMimeTypeOfSource(); + switch ($mimeType) { + case 'image/png': + if (!in_array('PNG', $im->queryFormats())) { + throw new SystemRequirementsNotMetException( + 'Gmagick has been compiled without PNG support and can therefore not convert this PNG image.' + ); + } + break; + case 'image/jpeg': + if (!in_array('JPEG', $im->queryFormats())) { + throw new SystemRequirementsNotMetException( + 'Gmagick has been compiled without Jpeg support and can therefore not convert this Jpeg image.' + ); + } + break; + } + } + + // Although this method is public, do not call directly. + // You should rather call the static convert() function, defined in AbstractConverter, which + // takes care of preparing stuff before calling doConvert, and validating after. + protected function doActualConvert() + { + + // PS: graphicsmagick options are documented here: (search for "webp:") + // http://www.graphicsmagick.org/GraphicsMagick.html + + $options = $this->options; + + try { + $im = new \Gmagick($this->source); + } catch (\Exception $e) { + throw new ConversionFailedException( + 'Failed creating Gmagick object of file', + 'Failed creating Gmagick object of file: "' . $this->source . '" - Gmagick threw an exception.', + $e + ); + } + + $im->setimageformat('WEBP'); + + // setimageoption() has not always been there, so check first. #169 + if (method_exists($im, 'setimageoption')) { + // Finally cracked setting webp options. + // See #167 + // - and https://stackoverflow.com/questions/47294962/how-to-write-lossless-webp-files-with-perlmagick + + if (!is_null($options['preset'])) { + if ($options['preset'] != 'none') { + $imageHint = $options['preset']; + switch ($imageHint) { + case 'drawing': + case 'icon': + case 'text': + $imageHint = 'graph'; + $this->logLn( + 'The "preset" value was mapped to "graph" because gmagick does not support "drawing",' . + ' "icon" and "text", but grouped these into one option: "graph".' + ); + } + $im->setimageoption('webp', 'image-hint', $imageHint); + } + } + $im->setimageoption('webp', 'method', $options['method']); + $im->setimageoption('webp', 'lossless', $options['encoding'] == 'lossless' ? 'true' : 'false'); + $im->setimageoption('webp', 'alpha-quality', $options['alpha-quality']); + + if ($options['auto-filter'] === true) { + $im->setimageoption('webp', 'auto-filter', 'true'); + } + + if ($options['sharp-yuv'] === true) { + $im->setimageoption('webp', 'use-sharp-yuv', 'true'); + } + } + + /* + low-memory seems not to be supported: + $im->setimageoption('webp', 'low-memory', $options['low-memory'] ? true : false); + */ + + if ($options['metadata'] == 'none') { + // Strip metadata and profiles + $im->stripImage(); + } + + // Ps: Imagick automatically uses same quality as source, when no quality is set + // This feature is however not present in Gmagick + // TODO: However, it might be possible after all - see #91 + $im->setcompressionquality($this->getCalculatedQuality()); + + // We call getImageBlob(). + // That method is undocumented, but it is there! + // - just like it is in imagick, as pointed out here: + // https://www.php.net/manual/ru/gmagick.readimageblob.php + + /** @scrutinizer ignore-call */ + $imageBlob = $im->getImageBlob(); + + $success = @file_put_contents($this->destination, $imageBlob); + + if (!$success) { + throw new ConversionFailedException('Failed writing file'); + } + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/GmagickBinary.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/GmagickBinary.php new file mode 100644 index 0000000..c3cd5b8 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/GmagickBinary.php @@ -0,0 +1,28 @@ + + * @since Class available since Release 2.0.0 + */ +class GmagickBinary extends AbstractConverter +{ + public function checkOperationality() + { + throw new ConversionFailedException( + 'This converter has changed ID from "gmagickbinary" to "graphicsmagick". You need to change!' + ); + } + + protected function doActualConvert() + { + $this->checkOperationality(); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/GraphicsMagick.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/GraphicsMagick.php new file mode 100644 index 0000000..86d1e30 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/GraphicsMagick.php @@ -0,0 +1,220 @@ + + * @since Class available since Release 2.0.0 + */ +class GraphicsMagick extends AbstractConverter +{ + use ExecTrait; + use EncodingAutoTrait; + + protected function getUnsupportedDefaultOptions() + { + return [ + 'near-lossless', + 'size-in-percentage', + ]; + } + + /** + * Get the options unique for this converter + * + * @return array Array of options + */ + public function getUniqueOptions($imageType) + { + return OptionFactory::createOptions([ + self::niceOption() + ]); + } + + private function getPath() + { + if (defined('WEBPCONVERT_GRAPHICSMAGICK_PATH')) { + return constant('WEBPCONVERT_GRAPHICSMAGICK_PATH'); + } + if (!empty(getenv('WEBPCONVERT_GRAPHICSMAGICK_PATH'))) { + return getenv('WEBPCONVERT_GRAPHICSMAGICK_PATH'); + } + return 'gm'; + } + + public function isInstalled() + { + ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode); + return ($returnCode == 0); + } + + public function getVersion() + { + ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode); + if (($returnCode == 0) && isset($output[0])) { + return preg_replace('#http.*#', '', $output[0]); + } + return 'unknown'; + } + + // Check if webp delegate is installed + public function isWebPDelegateInstalled() + { + ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode); + foreach ($output as $line) { + if (preg_match('#WebP.*yes#i', $line)) { + return true; + } + } + return false; + } + + /** + * Check (general) operationality of imagack converter executable + * + * @throws SystemRequirementsNotMetException if system requirements are not met + */ + public function checkOperationality() + { + $this->checkOperationalityExecTrait(); + + if (!$this->isInstalled()) { + throw new SystemRequirementsNotMetException('gmagick is not installed'); + } + if (!$this->isWebPDelegateInstalled()) { + throw new SystemRequirementsNotMetException('webp delegate missing'); + } + } + + /** + * Build command line options + * + * @return string + */ + private function createCommandLineOptions() + { + // For available webp options, check out: + // https://github.com/kstep/graphicsmagick/blob/master/coders/webp.c + + $commandArguments = []; + + /* + if ($this->isQualityDetectionRequiredButFailing()) { + // Unlike imagick binary, it seems gmagick binary uses a fixed + // quality (75) when quality is omitted + // So we cannot simply omit in order to get same quality as source. + // But perhaps there is another way? + // Check out #91 - it is perhaps as easy as this: "-define jpeg:preserve-settings" + } + */ + $commandArguments[] = '-quality ' . escapeshellarg($this->getCalculatedQuality()); + + $options = $this->options; + + // preset + if (!is_null($options['preset'])) { + if ($options['preset'] != 'none') { + $imageHint = $options['preset']; + switch ($imageHint) { + case 'drawing': + case 'icon': + case 'text': + $imageHint = 'graph'; + $this->logLn( + 'Note: the preset was mapped to "graph" because graphicsmagick does not support ' . + '"drawing", "icon" and "text", but grouped these into one option: "graph".' + ); + } + $commandArguments[] = '-define webp:image-hint=' . escapeshellarg($imageHint); + } + } + + // encoding + if ($options['encoding'] == 'lossless') { + // Btw: + // I am not sure if we should set "quality" for lossless. + // Quality should not apply to lossless, but my tests shows that it does in some way for gmagick + // setting it low, you get bad visual quality and small filesize. Setting it high, you get the opposite + // Some claim it is a bad idea to set quality, but I'm not so sure. + // https://stackoverflow.com/questions/4228027/ + // First, I do not just get bigger images when setting quality, as toc777 does. + // Secondly, the answer is very old and that bad behaviour is probably fixed by now. + $commandArguments[] = '-define webp:lossless=true'; + } else { + $commandArguments[] = '-define webp:lossless=false'; + } + + if ($options['auto-filter'] === true) { + $commandArguments[] = '-define webp:auto-filter=true'; + } + + if ($options['alpha-quality'] !== 100) { + $commandArguments[] = '-define webp:alpha-quality=' . strval($options['alpha-quality']); + } + + if ($options['low-memory']) { + $commandArguments[] = '-define webp:low-memory=true'; + } + + if ($options['sharp-yuv'] === true) { + $commandArguments[] = '-define webp:use-sharp-yuv=true'; + } + + if ($options['metadata'] == 'none') { + $commandArguments[] = '-strip'; + } + + $commandArguments[] = '-define webp:method=' . $options['method']; + + $commandArguments[] = escapeshellarg($this->source); + $commandArguments[] = escapeshellarg('webp:' . $this->destination); + + return implode(' ', $commandArguments); + } + + protected function doActualConvert() + { + //$this->logLn('Using quality:' . $this->getCalculatedQuality()); + + $this->logLn('Version: ' . $this->getVersion()); + + $command = $this->getPath() . ' convert ' . $this->createCommandLineOptions() . ' 2>&1'; + + $useNice = ($this->options['use-nice'] && $this->checkNiceSupport()); + if ($useNice) { + $command = 'nice ' . $command; + } + $this->logLn('Executing command: ' . $command); + ExecWithFallback::exec($command, $output, $returnCode); + + $this->logExecOutput($output); + if ($returnCode == 0) { + $this->logLn('success'); + } else { + $this->logLn('return code: ' . $returnCode); + } + + if ($returnCode == 127) { + throw new SystemRequirementsNotMetException('gmagick is not installed'); + } + if ($returnCode != 0) { + $this->logLn('command:' . $command); + $this->logLn('return code:' . $returnCode); + $this->logLn('output:' . print_r(implode("\n", $output), true)); + throw new SystemRequirementsNotMetException('The exec() call failed'); + } + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ImageMagick.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ImageMagick.php new file mode 100644 index 0000000..2470b8e --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ImageMagick.php @@ -0,0 +1,275 @@ + + * @since Class available since Release 2.0.0 + */ +class ImageMagick extends AbstractConverter +{ + use ExecTrait; + use EncodingAutoTrait; + + protected function getUnsupportedDefaultOptions() + { + return [ + 'size-in-percentage', + ]; + } + + /** + * Get the options unique for this converter + * + * @return array Array of options + */ + public function getUniqueOptions($imageType) + { + return OptionFactory::createOptions([ + self::niceOption(), + ['try-common-system-paths', 'boolean', [ + 'title' => 'Try locating ImageMagick in common system paths', + 'description' => + 'If set, the converter will look for a ImageMagick binaries residing in common system locations ' . + 'such as "/usr/bin/convert". ' . + 'If such exist, it is assumed that they are valid ImageMagick binaries. ', + 'default' => true, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true + ] + ]], + ]); + } + + // To futher improve this converter, I could check out: + // https://github.com/Orbitale/ImageMagickPHP + + private function getPath() + { + if (defined('WEBPCONVERT_IMAGEMAGICK_PATH')) { + return constant('WEBPCONVERT_IMAGEMAGICK_PATH'); + } + if (!empty(getenv('WEBPCONVERT_IMAGEMAGICK_PATH'))) { + return getenv('WEBPCONVERT_IMAGEMAGICK_PATH'); + } + + if ($this->options['try-common-system-paths']) { + $binaries = LocateBinaries::locateInCommonSystemPaths('convert'); + if (!empty($binaries)) { + return $binaries[0]; + } + } + + return 'convert'; + } + + private function getVersion() + { + ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode); + if (($returnCode == 0) && isset($output[0])) { + return $output[0]; + } else { + return 'unknown'; + } + } + + public function isInstalled() + { + ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode); + return ($returnCode == 0); + } + + // Check if webp delegate is installed + public function isWebPDelegateInstalled() + { + ExecWithFallback::exec($this->getPath() . ' -list delegate 2>&1', $output, $returnCode); + foreach ($output as $line) { + if (preg_match('#webp\\s*=#i', $line)) { + return true; + } + } + + // try other command + ExecWithFallback::exec($this->getPath() . ' -list configure 2>&1', $output, $returnCode); + foreach ($output as $line) { + if (preg_match('#DELEGATE.*webp#i', $line)) { + return true; + } + } + + return false; + + // PS, convert -version does not output delegates on travis, so it is not reliable + } + + /** + * Check (general) operationality of imagack converter executable + * + * @throws SystemRequirementsNotMetException if system requirements are not met + */ + public function checkOperationality() + { + $this->checkOperationalityExecTrait(); + + if (!$this->isInstalled()) { + throw new SystemRequirementsNotMetException( + 'imagemagick is not installed (cannot execute: "' . $this->getPath() . '")' + ); + } + if (!$this->isWebPDelegateInstalled()) { + throw new SystemRequirementsNotMetException('webp delegate missing'); + } + } + + /** + * Build command line options + * + * @param string $versionNumber. Ie "6.9.10-23" + * @return string + */ + private function createCommandLineOptions($versionNumber = 'unknown') + { + // Available webp options for imagemagick are documented here: + // - https://imagemagick.org/script/webp.php + // - https://github.com/ImageMagick/ImageMagick/blob/main/coders/webp.c + + // We should perhaps implement low-memory. Its already in cwebp, it + // could perhaps be promoted to a general option + + $commandArguments = []; + if ($this->isQualityDetectionRequiredButFailing()) { + // quality:auto was specified, but could not be determined. + // we cannot apply the max-quality logic, but we can provide auto quality + // simply by not specifying the quality option. + } else { + $commandArguments[] = '-quality ' . escapeshellarg($this->getCalculatedQuality()); + } + + $options = $this->options; + + if (!is_null($options['preset'])) { + // "image-hint" is at least available from 6.9.4-0 (I can't see further back) + if ($options['preset'] != 'none') { + $imageHint = $options['preset']; + switch ($imageHint) { + case 'drawing': + case 'icon': + case 'text': + $imageHint = 'graph'; + $this->logLn( + 'The "preset" value was mapped to "graph" because imagemagick does not support "drawing",' . + ' "icon" and "text", but grouped these into one option: "graph".' + ); + } + $commandArguments[] = '-define webp:image-hint=' . escapeshellarg($imageHint); + } + } + + if ($options['encoding'] == 'lossless') { + // lossless is at least available from 6.9.4-0 (I can't see further back) + $commandArguments[] = '-define webp:lossless=true'; + } + + if ($options['low-memory']) { + // low-memory is at least available from 6.9.4-0 (I can't see further back) + $commandArguments[] = '-define webp:low-memory=true'; + } + + if ($options['auto-filter'] === true) { + // auto-filter is at least available from 6.9.4-0 (I can't see further back) + $commandArguments[] = '-define webp:auto-filter=true'; + } + + if ($options['metadata'] == 'none') { + $commandArguments[] = '-strip'; + } + + if ($options['alpha-quality'] !== 100) { + // alpha-quality is at least available from 6.9.4-0 (I can't see further back) + $commandArguments[] = '-define webp:alpha-quality=' . strval($options['alpha-quality']); + } + + if ($options['sharp-yuv'] === true) { + if (version_compare($versionNumber, '7.0.8-26', '>=')) { + $commandArguments[] = '-define webp:use-sharp-yuv=true'; + } else { + $this->logLn( + 'Note: "sharp-yuv" option is not supported in your version of ImageMagick. ' . + 'ImageMagic >= 7.0.8-26 is required', + 'italic' + ); + } + } + + if ($options['near-lossless'] != 100) { + if (version_compare($versionNumber, '7.0.10-54', '>=')) { // #299 + $commandArguments[] = '-define webp:near-lossless=' . escapeshellarg($options['near-lossless']); + } else { + $this->logLn( + 'Note: "near-lossless" option is not supported in your version of ImageMagick. ' . + 'ImageMagic >= 7.0.10-54 is required', + 'italic' + ); + } + } + + // "method" is at least available from 6.9.4-0 (I can't see further back) + $commandArguments[] = '-define webp:method=' . $options['method']; + + $commandArguments[] = escapeshellarg($this->source); + $commandArguments[] = escapeshellarg('webp:' . $this->destination); + + return implode(' ', $commandArguments); + } + + protected function doActualConvert() + { + $version = $this->getVersion(); + + $this->logLn($version); + + preg_match('#\d+\.\d+\.\d+[\d\.\-]+#', $version, $matches); + $versionNumber = (isset($matches[0]) ? $matches[0] : 'unknown'); + + $this->logLn('Extracted version number: ' . $versionNumber); + + $command = $this->getPath() . ' ' . $this->createCommandLineOptions($versionNumber) . ' 2>&1'; + + $useNice = ($this->options['use-nice'] && $this->checkNiceSupport()); + if ($useNice) { + $command = 'nice ' . $command; + } + $this->logLn('Executing command: ' . $command); + ExecWithFallback::exec($command, $output, $returnCode); + + $this->logExecOutput($output); + if ($returnCode == 0) { + $this->logLn('success'); + } else { + $this->logLn('return code: ' . $returnCode); + } + + if ($returnCode == 127) { + throw new SystemRequirementsNotMetException('imagemagick is not installed'); + } + if ($returnCode != 0) { + throw new SystemRequirementsNotMetException('The exec call failed'); + } + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Imagick.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Imagick.php new file mode 100644 index 0000000..eee71c5 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Imagick.php @@ -0,0 +1,229 @@ + + * @since Class available since Release 2.0.0 + */ +class Imagick extends AbstractConverter +{ + use EncodingAutoTrait; + + protected function getUnsupportedDefaultOptions() + { + return [ + 'size-in-percentage', + ]; + } + + /** + * Check operationality of Imagick converter. + * + * Note: + * It may be that Gd has been compiled without jpeg support or png support. + * We do not check for this here, as the converter could still be used for the other. + * + * @throws SystemRequirementsNotMetException if system requirements are not met + * @return void + */ + public function checkOperationality() + { + if (!extension_loaded('imagick')) { + throw new SystemRequirementsNotMetException('Required iMagick extension is not available.'); + } + + if (!class_exists('\\Imagick')) { + throw new SystemRequirementsNotMetException( + 'iMagick is installed, but not correctly. The class Imagick is not available' + ); + } + + $im = new \Imagick(); + if (!in_array('WEBP', $im->queryFormats('WEBP'))) { + throw new SystemRequirementsNotMetException('iMagick was compiled without WebP support.'); + } + } + + /** + * Check if specific file is convertable with current converter / converter settings. + * + * @throws SystemRequirementsNotMetException if Imagick does not support image type + */ + public function checkConvertability() + { + $im = new \Imagick(); + $mimeType = $this->getMimeTypeOfSource(); + switch ($mimeType) { + case 'image/png': + if (!in_array('PNG', $im->queryFormats('PNG'))) { + throw new SystemRequirementsNotMetException( + 'Imagick has been compiled without PNG support and can therefore not convert this PNG image.' + ); + } + break; + case 'image/jpeg': + if (!in_array('JPEG', $im->queryFormats('JPEG'))) { + throw new SystemRequirementsNotMetException( + 'Imagick has been compiled without Jpeg support and can therefore not convert this Jpeg image.' + ); + } + break; + } + } + + /** + * + * It may also throw an ImagickException if imagick throws an exception + * @throws CreateDestinationFileException if imageblob could not be saved to file + */ + protected function doActualConvert() + { + /* + * More about iMagick's WebP options: + * - Inspect source code: https://github.com/ImageMagick/ImageMagick/blob/master/coders/webp.c#L559 + * (search for "webp:") + * - http://www.imagemagick.org/script/webp.php + * - https://developers.google.com/speed/webp/docs/cwebp + * - https://stackoverflow.com/questions/37711492/imagemagick-specific-webp-calls-in-php + */ + + $options = $this->options; + + // This might throw - we let it! + $im = new \Imagick($this->source); + //$im = new \Imagick(); + //$im->pingImage($this->source); + //$im->readImage($this->source); + + $version = \Imagick::getVersion(); + $this->logLn('ImageMagic API version (full): ' . $version['versionString']); + + preg_match('#\d+\.\d+\.\d+[\d\.\-]+#', $version['versionString'], $matches); + $versionNumber = (isset($matches[0]) ? $matches[0] : 'unknown'); + $this->logLn('ImageMagic API version (just the number): ' . $versionNumber); + + // Note: good enough for info, but not entirely reliable - see #304 + $extVersion = (defined('\Imagick::IMAGICK_EXTVER') ? \Imagick::IMAGICK_EXTVER : phpversion('imagick')); + $this->logLn('Imagic extension version: ' . $extVersion); + + $im->setImageFormat('WEBP'); + + if (!is_null($options['preset'])) { + if ($options['preset'] != 'none') { + $imageHint = $options['preset']; + switch ($imageHint) { + case 'drawing': + case 'icon': + case 'text': + $imageHint = 'graph'; + $this->logLn( + 'The "preset" value was mapped to "graph" because imagick does not support "drawing",' . + ' "icon" and "text", but grouped these into one option: "graph".' + ); + } + $im->setOption('webp:image-hint', $imageHint); + } + } + + $im->setOption('webp:method', $options['method']); + $im->setOption('webp:lossless', $options['encoding'] == 'lossless' ? 'true' : 'false'); + $im->setOption('webp:low-memory', $options['low-memory'] ? 'true' : 'false'); + $im->setOption('webp:alpha-quality', $options['alpha-quality']); + + if ($options['near-lossless'] != 100) { + if (version_compare($versionNumber, '7.0.10-54', '>=')) { + $im->setOption('webp:near-lossless', $options['near-lossless']); + } else { + $this->logLn( + 'Note: near-lossless is not supported in your version of ImageMagick. ' . + 'ImageMagic >= 7.0.10-54 is required', + 'italic' + ); + } + } + + if ($options['auto-filter'] === true) { + $im->setOption('webp:auto-filter', 'true'); + } + + if ($options['sharp-yuv'] === true) { + if (version_compare($versionNumber, '7.0.8-26', '>=')) { + $im->setOption('webp:use-sharp-yuv', 'true'); + } else { + $this->logLn( + 'Note: "sharp-yuv" option is not supported in your version of ImageMagick. ' . + 'ImageMagic >= 7.0.8-26 is required', + 'italic' + ); + } + } + + if ($options['metadata'] == 'none') { + // To strip metadata, we need to use the stripImage() method. However, that method does not only remove + // metadata, but color profiles as well. We want to keep the color profiles, so we grab it now to be able + // to restore it. (Thanks, Max Eremin: https://www.php.net/manual/en/imagick.stripimage.php#120380) + + // Grab color profile (to be able to restore them) + $profiles = $im->getImageProfiles("icc", true); + + // Strip metadata (and color profiles) + $im->stripImage(); + + // Restore color profiles + if (!empty($profiles)) { + $im->profileImage("icc", $profiles['icc']); + } + } + + if ($this->isQualityDetectionRequiredButFailing()) { + // Luckily imagick is a big boy, and automatically converts with same quality as + // source, when the quality isn't set. + // So we simply do not set quality. + // This actually kills the max-quality functionality. But I deem that this is more important + // because setting image quality to something higher than source generates bigger files, + // but gets you no extra quality. When failing to limit quality, you at least get something + // out of it + $this->logLn('Converting without setting quality in order to achieve auto quality'); + } else { + $im->setImageCompressionQuality($this->getCalculatedQuality()); + } + + // https://stackoverflow.com/questions/29171248/php-imagick-jpeg-optimization + // setImageFormat + + // TODO: Read up on + // https://www.smashingmagazine.com/2015/06/efficient-image-resizing-with-imagemagick/ + // https://github.com/nwtn/php-respimg + + // TODO: + // Should we set alpha channel for PNG's like suggested here: + // https://gauntface.com/blog/2014/09/02/webp-support-with-imagemagick-and-php ?? + // It seems that alpha channel works without... (at least I see completely transparerent pixels) + + // We used to use writeImageFile() method. But we now use getImageBlob(). See issue #43 + + // This might throw - we let it! + $imageBlob = $im->getImageBlob(); + + $success = file_put_contents($this->destination, $imageBlob); + + if (!$success) { + throw new CreateDestinationFileException('Failed writing file'); + } + + // Btw: check out processWebp() method here: + // https://github.com/Intervention/image/blob/master/src/Intervention/Image/Imagick/Encoder.php + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ImagickBinary.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ImagickBinary.php new file mode 100644 index 0000000..1869ec3 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/ImagickBinary.php @@ -0,0 +1,28 @@ + + * @since Class available since Release 2.0.0 + */ +class ImagickBinary extends AbstractConverter +{ + public function checkOperationality() + { + throw new ConversionFailedException( + 'This converter has changed ID from "imagickbinary" to "imagemagick". You need to change!' + ); + } + + protected function doActualConvert() + { + $this->checkOperationality(); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Stack.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Stack.php new file mode 100644 index 0000000..c81cf4e --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Stack.php @@ -0,0 +1,283 @@ + + * @since Class available since Release 2.0.0 + */ +class Stack extends AbstractConverter +{ + + protected function getUnsupportedDefaultOptions() + { + return [ + 'alpha-quality', + 'auto-filter', + 'encoding', + 'low-memory', + 'metadata', + 'method', + 'near-lossless', + 'preset', + 'sharp-yuv', + 'size-in-percentage', + 'skip', + 'default-quality', + 'quality', + 'max-quality', + ]; + } + + public function getUniqueOptions($imageType) + { + return OptionFactory::createOptions([ + ['converters', 'array', [ + 'title' => 'Converters', + 'description' => 'Converters to try, ordered by priority.', + 'default' => self::getAvailableConverters(), + 'sensitive' => true, + 'ui' => [ + 'component' => 'multi-select', + 'options' => self::getAvailableConverters(), + 'advanced' => true + ] + ]], + ['converter-options', 'array', [ + 'title' => 'Converter options', + 'description' => + 'Extra options for specific converters.', + 'default' => [], + 'sensitive' => true, + 'ui' => null + ]], + ['preferred-converters', 'array', [ + 'title' => 'Preferred converters', + 'description' => + 'With this option you can move specified converters to the top of the stack. ' . + 'The converters are specified by id.', + 'default' => [], + 'ui' => null + ]], + ['extra-converters', 'array', [ + 'title' => 'Extra converters', + 'description' => + 'Add extra converters to the bottom of the stack', + 'default' => [], + 'sensitive' => true, + 'ui' => null + ]], + ['shuffle', 'boolean', [ + 'title' => 'Shuffle', + 'description' => + 'Shuffles the converter order on each conversion. ' . + 'Can for example be used to spread out requests on multiple cloud converters', + 'default' => false, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true + ] + ]], + ]); + + +/* + return [ + new SensitiveArrayOption('converters', self::getAvailableConverters()), + new SensitiveArrayOption('converter-options', []), + new BooleanOption('shuffle', false), + new ArrayOption('preferred-converters', []), + new SensitiveArrayOption('extra-converters', []) + ];*/ + } + + /** + * Get available converters (ids) - ordered by awesomeness. + * + * @return array An array of ids of converters that comes with this library + */ + public static function getAvailableConverters() + { + return [ + 'cwebp', 'vips', 'imagick', 'gmagick', 'imagemagick', 'graphicsmagick', 'wpc', 'ffmpeg', 'ewww', 'gd' + ]; + } + + /** + * Check (general) operationality of imagack converter executable + * + * @throws SystemRequirementsNotMetException if system requirements are not met + */ + public function checkOperationality() + { + if (count($this->options['converters']) == 0) { + throw new ConverterNotOperationalException( + 'Converter stack is empty! - no converters to try, no conversion can be made!' + ); + } + + // TODO: We should test if all converters are found in order to detect problems early + + //$this->logLn('Stack converter ignited'); + } + + protected function doActualConvert() + { + $options = $this->options; + + $beginTimeStack = microtime(true); + + $anyRuntimeErrors = false; + + $converters = $options['converters']; + if (count($options['extra-converters']) > 0) { + $converters = array_merge($converters, $options['extra-converters']); + /*foreach ($options['extra-converters'] as $extra) { + $converters[] = $extra; + }*/ + } + + // preferred-converters + if (count($options['preferred-converters']) > 0) { + foreach (array_reverse($options['preferred-converters']) as $prioritizedConverter) { + foreach ($converters as $i => $converter) { + if (is_array($converter)) { + $converterId = $converter['converter']; + } else { + $converterId = $converter; + } + if ($converterId == $prioritizedConverter) { + unset($converters[$i]); + array_unshift($converters, $converter); + break; + } + } + } + // perhaps write the order to the log? (without options) - but this requires some effort + } + + // shuffle + if ($options['shuffle']) { + shuffle($converters); + } + + //$this->logLn(print_r($converters)); + //$options['converters'] = $converters; + //$defaultConverterOptions = $options; + $defaultConverterOptions = []; + + foreach ($this->options2->getOptionsMap() as $id => $option) { + // Right here, there used to be a check that ensured that unknown options was not passed down to the + // converters (" && !($option instanceof GhostOption)"). But well, as the Stack doesn't know about + // converter specific options, such as "try-cwebp", these was not passed down (see #259) + // I'm not sure why the check was made in the first place, but it does not seem neccessary, as the + // converters simply ignore unknown options. So the check has now been removed. + if ($option->isValueExplicitlySet()) { + $defaultConverterOptions[$id] = $option->getValue(); + } + } + + //unset($defaultConverterOptions['converters']); + //unset($defaultConverterOptions['converter-options']); + $defaultConverterOptions['_skip_input_check'] = true; + $defaultConverterOptions['_suppress_success_message'] = true; + unset($defaultConverterOptions['converters']); + unset($defaultConverterOptions['extra-converters']); + unset($defaultConverterOptions['converter-options']); + unset($defaultConverterOptions['preferred-converters']); + unset($defaultConverterOptions['shuffle']); + +// $this->logLn('converters: ' . print_r($converters, true)); + + //return; + foreach ($converters as $converter) { + if (is_array($converter)) { + $converterId = $converter['converter']; + $converterOptions = isset($converter['options']) ? $converter['options'] : []; + } else { + $converterId = $converter; + $converterOptions = []; + if (isset($options['converter-options'][$converterId])) { + // Note: right now, converter-options are not meant to be used, + // when you have several converters of the same type + $converterOptions = $options['converter-options'][$converterId]; + } + } + $converterOptions = array_merge($defaultConverterOptions, $converterOptions); + /* + if ($converterId != 'stack') { + //unset($converterOptions['converters']); + //unset($converterOptions['converter-options']); + } else { + //$converterOptions['converter-options'] = + $this->logLn('STACK'); + $this->logLn('converterOptions: ' . print_r($converterOptions, true)); + }*/ + + $beginTime = microtime(true); + + $this->ln(); + $this->logLn($converterId . ' converter ignited', 'bold'); + + $converter = ConverterFactory::makeConverter( + $converterId, + $this->source, + $this->destination, + $converterOptions, + $this->logger + ); + + try { + $converter->doConvert(); + + //self::runConverterWithTiming($converterId, $source, $destination, $converterOptions, false, $logger); + + $this->logLn($converterId . ' succeeded :)'); + //throw new ConverterNotOperationalException('...'); + return; + } catch (ConverterNotOperationalException $e) { + $this->logLn($e->getMessage()); + } catch (ConversionSkippedException $e) { + $this->logLn($e->getMessage()); + } catch (ConversionFailedException $e) { + $this->logLn($e->getMessage(), 'italic'); + $prev = $e->getPrevious(); + if (!is_null($prev)) { + $this->logLn($prev->getMessage(), 'italic'); + $this->logLn(' in ' . $prev->getFile() . ', line ' . $prev->getLine(), 'italic'); + $this->ln(); + } + //$this->logLn($e->getTraceAsString()); + $anyRuntimeErrors = true; + } + $this->logLn($converterId . ' failed in ' . round((microtime(true) - $beginTime) * 1000) . ' ms'); + } + + $this->ln(); + $this->logLn('Stack failed in ' . round((microtime(true) - $beginTimeStack) * 1000) . ' ms'); + + // Hm, Scrutinizer complains that $anyRuntimeErrors is always false. But that is not true! + if ($anyRuntimeErrors) { + // At least one converter failed + throw new ConversionFailedException( + 'None of the converters in the stack could convert the image.' + ); + } else { + // All converters threw a SystemRequirementsNotMetException + throw new ConverterNotOperationalException('None of the converters in the stack are operational'); + } + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Vips.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Vips.php new file mode 100644 index 0000000..dd3fd9b --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Vips.php @@ -0,0 +1,306 @@ + + * @since Class available since Release 2.0.0 + */ +class Vips extends AbstractConverter +{ + use EncodingAutoTrait; + + protected function getUnsupportedDefaultOptions() + { + return [ + 'auto-filter', + 'size-in-percentage', + ]; + } + + /** + * Get the options unique for this converter + * + * @return array Array of options + */ + public function getUniqueOptions($imageType) + { + $ssOption = new BooleanOption('smart-subsample', false); + $ssOption->markDeprecated(); + return [ + $ssOption + ]; + } + + /** + * Check operationality of Vips converter. + * + * @throws SystemRequirementsNotMetException if system requirements are not met + */ + public function checkOperationality() + { + if (!extension_loaded('vips')) { + throw new SystemRequirementsNotMetException('Required Vips extension is not available.'); + } + + if (!function_exists('vips_image_new_from_file')) { + throw new SystemRequirementsNotMetException( + 'Vips extension seems to be installed, however something is not right: ' . + 'the function "vips_image_new_from_file" is not available.' + ); + } + + if (!function_exists('vips_call')) { + throw new SystemRequirementsNotMetException( + 'Vips extension seems to be installed, however something is not right: ' . + 'the function "vips_call" is not available.' + ); + } + + if (!function_exists('vips_error_buffer')) { + throw new SystemRequirementsNotMetException( + 'Vips extension seems to be installed, however something is not right: ' . + 'the function "vips_error_buffer" is not available.' + ); + } + + + vips_error_buffer(); // clear error buffer + $result = vips_call('webpsave', null); + if ($result === -1) { + $message = vips_error_buffer(); + if (strpos($message, 'VipsOperation: class "webpsave" not found') === 0) { + throw new SystemRequirementsNotMetException( + 'Vips has not been compiled with webp support.' + ); + } + } + } + + /** + * Check if specific file is convertable with current converter / converter settings. + * + * @throws SystemRequirementsNotMetException if Vips does not support image type + */ + public function checkConvertability() + { + // It seems that png and jpeg are always supported by Vips + // - so nothing needs to be done here + + if (function_exists('vips_version')) { + $this->logLn('vipslib version: ' . vips_version()); + } + $this->logLn('vips extension version: ' . phpversion('vips')); + } + + /** + * Create vips image resource from source file + * + * @throws ConversionFailedException if image resource cannot be created + * @return resource vips image resource + */ + private function createImageResource() + { + // We are currently using vips_image_new_from_file(), but we could consider + // calling vips_jpegload / vips_pngload instead + $result = /** @scrutinizer ignore-call */ vips_image_new_from_file($this->source, []); + if ($result === -1) { + /*throw new ConversionFailedException( + 'Failed creating new vips image from file: ' . $this->source + );*/ + $message = /** @scrutinizer ignore-call */ vips_error_buffer(); + throw new ConversionFailedException($message); + } + + if (!is_array($result)) { + throw new ConversionFailedException( + 'vips_image_new_from_file did not return an array, which we expected' + ); + } + + if (count($result) != 1) { + throw new ConversionFailedException( + 'vips_image_new_from_file did not return an array of length 1 as we expected ' . + '- length was: ' . count($result) + ); + } + + $im = array_shift($result); + return $im; + } + + /** + * Create parameters for webpsave + * + * @return array the parameters as an array + */ + private function createParamsForVipsWebPSave() + { + // webpsave options are described here: + // https://libvips.github.io/libvips/API/current/VipsForeignSave.html#vips-webpsave + // near_lossless option is described here: https://github.com/libvips/libvips/pull/430 + + // NOTE: When a new option becomes available, we MUST remember to add + // it to the array of possibly unsupported options in webpsave() ! + $options = [ + "Q" => $this->getCalculatedQuality(), + 'lossless' => ($this->options['encoding'] == 'lossless'), + 'strip' => $this->options['metadata'] == 'none', + ]; + + // Only set the following options if they differ from the default of vipslib + // This ensures we do not get warning if that property isn't supported + if ($this->options['smart-subsample'] !== false) { + // PS: The smart-subsample option is now deprecated, as it turned out + // it was corresponding to the "sharp-yuv" option (see #280) + $options['smart_subsample'] = $this->options['smart-subsample']; + $this->logLn( + '*Note: the "smart-subsample" option is now deprecated. It turned out it corresponded to ' . + 'the general option "sharp-yuv". You should use "sharp-yuv" instead.*' + ); + } + if ($this->options['sharp-yuv'] !== false) { + $options['smart_subsample'] = $this->options['sharp-yuv']; + } + + if ($this->options['alpha-quality'] !== 100) { + $options['alpha_q'] = $this->options['alpha-quality']; + } + + if (!is_null($this->options['preset']) && ($this->options['preset'] != 'none')) { + // preset. 0:default, 1:picture, 2:photo, 3:drawing, 4:icon, 5:text, 6:last + $options['preset'] = array_search( + $this->options['preset'], + ['default', 'picture', 'photo', 'drawing', 'icon', 'text'] + ); + } + if ($this->options['near-lossless'] !== 100) { + if ($this->options['encoding'] == 'lossless') { + // We only let near_lossless have effect when encoding is set to lossless + // otherwise encoding=auto would not work as expected + // Available in https://github.com/libvips/libvips/pull/430, merged 1 may 2016 + // seems it corresponds to release 8.4.2 + $options['near_lossless'] = true; + + // In Vips, the near-lossless value is controlled by Q. + // this differs from how it is done in cwebp, where it is an integer. + // We have chosen same option syntax as cwebp + $options['Q'] = $this->options['near-lossless']; + } + } + if ($this->options['method'] !== 4) { + $options['reduction_effort'] = $this->options['method']; + } + + return $options; + } + + /** + * Save as webp, using vips extension. + * + * Tries to save image resource as webp, using the supplied options. + * Vips fails when a parameter is not supported, but we detect this and unset that parameter and try again + * (recursively call itself until there is no more of these kind of errors). + * + * @param resource $im A vips image resource to save + * @throws ConversionFailedException if conversion fails. + */ + private function webpsave($im, $options) + { + /** @scrutinizer ignore-call */ vips_error_buffer(); // clear error buffer + $result = /** @scrutinizer ignore-call */ vips_call('webpsave', $im, $this->destination, $options); + + //trigger_error('test-warning', E_USER_WARNING); + if ($result === -1) { + $message = /** @scrutinizer ignore-call */ vips_error_buffer(); + + $nameOfPropertyNotFound = ''; + if (preg_match("#no property named .(.*).#", $message, $matches)) { + $nameOfPropertyNotFound = $matches[1]; + } elseif (preg_match("#(.*)\\sunsupported$#", $message, $matches)) { + // Actually, I am not quite sure if this ever happens. + // I got a "near_lossless unsupported" error message in a build, but perhaps it rather a warning + if (in_array($matches[1], [ + 'lossless', + 'alpha_q', + 'near_lossless', + 'smart_subsample', + 'reduction_effort', + 'preset' + ])) { + $nameOfPropertyNotFound = $matches[1]; + } + } + + if ($nameOfPropertyNotFound != '') { + $msg = 'Note: Your version of vipslib does not support the "' . + $nameOfPropertyNotFound . '" property'; + + switch ($nameOfPropertyNotFound) { + case 'alpha_q': + $msg .= ' (It was introduced in vips 8.4)'; + break; + case 'near_lossless': + $msg .= ' (It was introduced in vips 8.4)'; + break; + case 'smart_subsample': + $msg .= ' (its the vips equalent to the "sharp-yuv" option. It was introduced in vips 8.4)'; + break; + case 'reduction_effort': + $msg .= ' (its the vips equalent to the "method" option. It was introduced in vips 8.8.0)'; + break; + case 'preset': + $msg .= ' (It was introduced in vips 8.4)'; + break; + } + $msg .= '. The option is ignored.'; + + + $this->logLn($msg, 'bold'); + + unset($options[$nameOfPropertyNotFound]); + $this->webpsave($im, $options); + } else { + throw new ConversionFailedException($message); + } + } + } + + /** + * Convert, using vips extension. + * + * Tries to create image resource and save it as webp using the calculated options. + * PS: The Vips "webpsave" call fails when a parameter is not supported, but our webpsave() method + * detect this and unset that parameter and try again (repeat until success). + * + * @throws ConversionFailedException if conversion fails. + */ + protected function doActualConvert() + { +/* + $im = \Jcupitt\Vips\Image::newFromFile($this->source); + //$im->writeToFile(__DIR__ . '/images/small-vips.webp', ["Q" => 10]); + + $im->webpsave($this->destination, [ + "Q" => 80, + //'near_lossless' => true + ]); + return;*/ + + $im = $this->createImageResource(); + $options = $this->createParamsForVipsWebPSave(); + $this->webpsave($im, $options); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Wpc.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Wpc.php new file mode 100644 index 0000000..5b9fd47 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Converters/Wpc.php @@ -0,0 +1,415 @@ + + * @since Class available since Release 2.0.0 + */ +class Wpc extends AbstractConverter +{ + use CloudConverterTrait; + use CurlTrait; + use EncodingAutoTrait; + + protected function getUnsupportedDefaultOptions() + { + return []; + } + + public function getUniqueOptions($imageType) + { + return OptionFactory::createOptions([ + ['api-key', 'string', [ + 'title' => 'API key', + 'description' => 'The API key is set up on the remote. Copy that.', + 'default' => '', + 'sensitive' => true, + 'ui' => [ + 'component' => 'password', + 'advanced' => false, + 'display' => "option('wpc-api-version') != 0" + ] + ]], + ['secret', 'string', [ + 'title' => 'Secret', + 'description' => '', + 'default' => '', + 'sensitive' => true, + 'ui' => [ + 'component' => 'password', + 'advanced' => false, + 'display' => "option('wpc-api-version') == 0" + ] + ]], + ['api-url', 'string', [ + 'title' => 'API url', + 'description' => 'The endpoint of the web service. Copy it from the remote setup', + 'default' => '', + 'sensitive' => true, + 'ui' => [ + 'component' => 'password', + 'advanced' => false, + ] + ]], + ['api-version', 'int', [ + 'title' => 'API version', + 'description' => + 'Refers to the major version of Wpc. ' . + 'It is probably 2, as it is a long time since 2.0 was released', + 'default' => 2, + 'minimum' => 0, + 'maximum' => 2, + 'ui' => [ + 'component' => 'select', + 'advanced' => false, + 'options' => [0, 1, 2], + ] + ]], + ['crypt-api-key-in-transfer', 'boolean', [ + 'title' => 'Crypt API key in transfer', + 'description' => + 'If checked, the api key will be crypted in requests. ' . + 'Crypting the api-key protects it from being stolen during transfer', + 'default' => false, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true, + 'display' => "option('wpc-api-version') >= 1" + ] + ]], + ]); + + /*return [ + new SensitiveStringOption('api-key', ''), + new SensitiveStringOption('secret', ''), + new SensitiveStringOption('api-url', ''), + new SensitiveStringOption('url', ''), // DO NOT USE. Only here to keep the protection + new IntegerOption('api-version', 2, 0, 2), + new BooleanOption('crypt-api-key-in-transfer', false) // new in api v.1 + ];*/ + } + + public function supportsLossless() + { + return ($this->options['api-version'] >= 2); + } + + public function passOnEncodingAuto() + { + // We could make this configurable. But I guess passing it on is always to be preferred + // for api >= 2. + return ($this->options['api-version'] >= 2); + } + + private static function createRandomSaltForBlowfish() + { + $salt = ''; + $validCharsForSalt = array_merge( + range('A', 'Z'), + range('a', 'z'), + range('0', '9'), + ['.', '/'] + ); + + for ($i = 0; $i < 22; $i++) { + $salt .= $validCharsForSalt[array_rand($validCharsForSalt)]; + } + return $salt; + } + + /** + * Get api key from options or environment variable + * + * @return string api key or empty string if none is set + */ + private function getApiKey() + { + if ($this->options['api-version'] == 0) { + if (!empty($this->options['secret'])) { + return $this->options['secret']; + } + } elseif ($this->options['api-version'] >= 1) { + if (!empty($this->options['api-key'])) { + return $this->options['api-key']; + } + } + if (defined('WEBPCONVERT_WPC_API_KEY')) { + return constant('WEBPCONVERT_WPC_API_KEY'); + } + if (!empty(getenv('WEBPCONVERT_WPC_API_KEY'))) { + return getenv('WEBPCONVERT_WPC_API_KEY'); + } + return ''; + } + + /** + * Get url from options or environment variable + * + * @return string URL to WPC or empty string if none is set + */ + private function getApiUrl() + { + if (!empty($this->options['api-url'])) { + return $this->options['api-url']; + } + if (defined('WEBPCONVERT_WPC_API_URL')) { + return constant('WEBPCONVERT_WPC_API_URL'); + } + if (!empty(getenv('WEBPCONVERT_WPC_API_URL'))) { + return getenv('WEBPCONVERT_WPC_API_URL'); + } + return ''; + } + + + /** + * Check operationality of Wpc converter. + * + * @throws SystemRequirementsNotMetException if system requirements are not met (curl) + * @throws ConverterNotOperationalException if key is missing or invalid, or quota has exceeded + */ + public function checkOperationality() + { + + $options = $this->options; + + $apiVersion = $options['api-version']; + + if ($this->getApiUrl() == '') { + if (isset($this->options['url']) && ($this->options['url'] != '')) { + throw new ConverterNotOperationalException( + 'The "url" option has been renamed to "api-url" in webp-convert 2.0. ' . + 'You must change the configuration accordingly.' + ); + } + throw new ConverterNotOperationalException( + 'Missing URL. You must install Webp Convert Cloud Service on a server, ' . + 'or the WebP Express plugin for Wordpress - and supply the url.' + ); + } + + if ($apiVersion == 0) { + if (!empty($this->getApiKey())) { + // if secret is set, we need md5() and md5_file() functions + if (!function_exists('md5')) { + throw new ConverterNotOperationalException( + 'A secret has been set, which requires us to create a md5 hash from the secret and the file ' . + 'contents. ' . + 'But the required md5() PHP function is not available.' + ); + } + if (!function_exists('md5_file')) { + throw new ConverterNotOperationalException( + 'A secret has been set, which requires us to create a md5 hash from the secret and the file ' . + 'contents. But the required md5_file() PHP function is not available.' + ); + } + } + } else { + if ($options['crypt-api-key-in-transfer']) { + if (!function_exists('crypt')) { + throw new ConverterNotOperationalException( + 'Configured to crypt the api-key, but crypt() function is not available.' + ); + } + + if (!defined('CRYPT_BLOWFISH')) { + throw new ConverterNotOperationalException( + 'Configured to crypt the api-key. ' . + 'That requires Blowfish encryption, which is not available on your current setup.' + ); + } + } + } + + // Check for curl requirements + $this->checkOperationalityForCurlTrait(); + } + + /* + public function checkConvertability() + { + // check upload limits + $this->checkConvertabilityCloudConverterTrait(); + + // TODO: some from below can be moved up here + } + */ + + private function createOptionsToSend() + { + $optionsToSend = $this->options; + + if ($this->isQualityDetectionRequiredButFailing()) { + // quality was set to "auto", but we could not meassure the quality of the jpeg locally + // Ask the cloud service to do it, rather than using what we came up with. + $optionsToSend['quality'] = 'auto'; + } else { + $optionsToSend['quality'] = $this->getCalculatedQuality(); + } + + // The following are unset for security reasons. + unset($optionsToSend['converters']); + unset($optionsToSend['secret']); + unset($optionsToSend['api-key']); + unset($optionsToSend['api-url']); + + $apiVersion = $optionsToSend['api-version']; + + if ($apiVersion == 1) { + // Lossless can be "auto" in api 2, but in api 1 "auto" is not supported + //unset($optionsToSend['lossless']); + } elseif ($apiVersion == 2) { + //unset($optionsToSend['png']); + //unset($optionsToSend['jpeg']); + + // The following are unset for security reasons. + unset($optionsToSend['cwebp-command-line-options']); + unset($optionsToSend['command-line-options']); + } + + return $optionsToSend; + } + + private function createPostData() + { + $options = $this->options; + + $postData = [ + 'file' => curl_file_create($this->source), + 'options' => json_encode($this->createOptionsToSend()), + 'servername' => (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '') + ]; + + $apiVersion = $options['api-version']; + + $apiKey = $this->getApiKey(); + + if ($apiVersion == 0) { + $postData['hash'] = md5(md5_file($this->source) . $apiKey); + } else { + //$this->logLn('api key: ' . $apiKey); + + if ($options['crypt-api-key-in-transfer']) { + $salt = self::createRandomSaltForBlowfish(); + $postData['salt'] = $salt; + + // Strip off the first 28 characters (the first 6 are always "$2y$10$". The next 22 is the salt) + $postData['api-key-crypted'] = substr(crypt($apiKey, '$2y$10$' . $salt . '$'), 28); + } else { + $postData['api-key'] = $apiKey; + } + } + return $postData; + } + + protected function doActualConvert() + { + $ch = self::initCurl(); + + //$this->logLn('api url: ' . $this->getApiUrl()); + + curl_setopt_array($ch, [ + CURLOPT_URL => $this->getApiUrl(), + CURLOPT_POST => 1, + CURLOPT_POSTFIELDS => $this->createPostData(), + CURLOPT_BINARYTRANSFER => true, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HEADER => false, + CURLOPT_SSL_VERIFYPEER => false + ]); + + $response = curl_exec($ch); + if (curl_errno($ch)) { + $this->logLn('Curl error: ', 'bold'); + $this->logLn(curl_error($ch)); + throw new ConverterNotOperationalException('Curl error:'); + } + + // Check if we got a 404 + $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + if ($httpCode == 404) { + curl_close($ch); + throw new ConversionFailedException( + 'WPC was not found at the specified URL - we got a 404 response.' + ); + } + + // Check for empty response + if (empty($response)) { + throw new ConversionFailedException( + 'Error: Unexpected result. We got nothing back. ' . + 'HTTP CODE: ' . $httpCode . '. ' . + 'Content type:' . curl_getinfo($ch, CURLINFO_CONTENT_TYPE) + ); + }; + + // The WPC cloud service either returns an image or an error message + // Images has application/octet-stream. + // Verify that we got an image back. + if (curl_getinfo($ch, CURLINFO_CONTENT_TYPE) != 'application/octet-stream') { + curl_close($ch); + + if (substr($response, 0, 1) == '{') { + $responseObj = json_decode($response, true); + if (isset($responseObj['errorCode'])) { + switch ($responseObj['errorCode']) { + case 0: + throw new ConverterNotOperationalException( + 'There are problems with the server setup: "' . + $responseObj['errorMessage'] . '"' + ); + case 1: + throw new InvalidApiKeyException( + 'Access denied. ' . $responseObj['errorMessage'] + ); + default: + throw new ConversionFailedException( + 'Conversion failed: "' . $responseObj['errorMessage'] . '"' + ); + } + } + } + + // WPC 0.1 returns 'failed![error messag]' when conversion fails. Handle that. + if (substr($response, 0, 7) == 'failed!') { + throw new ConversionFailedException( + 'WPC failed converting image: "' . substr($response, 7) . '"' + ); + } + + $this->logLn('Bummer, we did not receive an image'); + $this->log('What we received starts with: "'); + $this->logLn( + str_replace("\r", '', str_replace("\n", '', htmlentities(substr($response, 0, 400)))) . '..."' + ); + + throw new ConversionFailedException('Unexpected result. We did not receive an image but something else.'); + //throw new ConverterNotOperationalException($response); + } + + $success = file_put_contents($this->destination, $response); + curl_close($ch); + + if (!$success) { + throw new ConversionFailedException('Error saving file. Check file permissions'); + } + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/ConversionSkippedException.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/ConversionSkippedException.php new file mode 100644 index 0000000..82b5475 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Exceptions/ConversionFailed/ConversionSkippedException.php @@ -0,0 +1,10 @@ + + * @since Class available since Release 2.0.0 + */ +class JpegQualityDetector +{ + + /** + * Try to detect quality of jpeg using imagick extension. + * + * Note that the detection might fail for two different reasons: + * 1) Imagick is not installed + * 2) Imagick for some reason fails to detect quality for some images + * + * In both cases, null is returned. + * + * @param string $filename A complete file path to file to be examined + * @return int|null Quality, or null if it was not possible to detect quality + */ + private static function detectQualityOfJpgUsingImagick($filename) + { + if (extension_loaded('imagick') && class_exists('\\Imagick')) { + try { + $img = new \Imagick($filename); + + // The required function is available as from PECL imagick v2.2.2 + if (method_exists($img, 'getImageCompressionQuality')) { + $quality = $img->getImageCompressionQuality(); + if ($quality === 0) { + // We have experienced that this Imagick method returns 0 for some images, + // (even though the imagemagick binary is able to detect the quality) + // ie "/test/images/quality-undetectable-with-imagick.jpg". See #208 + $quality = null; + } + return $quality; + } + } catch (\Exception $e) { + // Well well, it just didn't work out. + // - But perhaps next method will work... + } catch (\Throwable $e) { + } + } + return null; + } + + + /** + * Try to detect quality of jpeg using imagick binary. + * + * Note that the detection might fail for three different reasons: + * 1) exec function is not available + * 2) the 'identify' command is not available on the system + * 3) imagemagick for some reason fails to detect quality for some images + * + * In the first two cases, null is returned. + * In the third case, 92 is returned. This is what imagemagick returns when it cannot detect the quality. + * and unfortunately we cannot distinguish between the situation where the quality is undetectable + * and the situation where the quality is actually 92 (at least, I have not found a way to do so) + * + * @param string $filename A complete file path to file to be examined + * @return int|null Quality, or null if it was not possible to detect quality + */ + private static function detectQualityOfJpgUsingImageMagick($filename) + { + if (ExecWithFallback::anyAvailable()) { + // Try Imagick using exec, and routing stderr to stdout (the "2>$1" magic) + + try { + ExecWithFallback::exec( + "identify -format '%Q' " . escapeshellarg($filename) . " 2>&1", + $output, + $returnCode + ); + //echo 'out:' . print_r($output, true); + if ((intval($returnCode) == 0) && (is_array($output)) && (count($output) == 1)) { + return intval($output[0]); + } + } catch (\Exception $e) { + // its ok, there are other fish in the sea + } catch (\Throwable $e) { + } + } + return null; + } + + + /** + * Try to detect quality of jpeg using graphicsmagick binary. + * + * It seems that graphicsmagick is never able to detect the quality! - and always returns + * the default quality, which is 75. + * However, as this might be solved in future versions, the method might be useful one day. + * But we treat "75" as a failure to detect and shall return null in that case. + * + * @param string $filename A complete file path to file to be examined + * @return int|null Quality, or null if it was not possible to detect quality + */ + private static function detectQualityOfJpgUsingGraphicsMagick($filename) + { + if (ExecWithFallback::anyAvailable()) { + // Try GraphicsMagick + try { + ExecWithFallback::exec( + "gm identify -format '%Q' " . escapeshellarg($filename) . " 2>&1", + $output, + $returnCode + ); + if ((intval($returnCode) == 0) && (is_array($output)) && (count($output) == 1)) { + $quality = intval($output[0]); + + // It seems that graphicsmagick is (currently) never able to detect the quality! + // - and always returns 75 as a fallback + // We shall therefore treat 75 as a failure to detect. (#209) + if ($quality == 75) { + return null; + } + return $quality; + } + } catch (\Exception $e) { + } catch (\Throwable $e) { + } + } + return null; + } + + + /** + * Try to detect quality of jpeg. + * + * Note: This method does not throw errors, but might dispatch warnings. + * You can use the WarningsIntoExceptions class if it is critical to you that nothing gets "printed" + * + * @param string $filename A complete file path to file to be examined + * @return int|null Quality, or null if it was not possible to detect quality + */ + public static function detectQualityOfJpg($filename) + { + + //trigger_error('warning test', E_USER_WARNING); + + // Test that file exists in order not to break things. + if (!file_exists($filename)) { + // One could argue that it would be better to throw an Exception...? + return null; + } + + // Try Imagick extension, if available + $quality = self::detectQualityOfJpgUsingImagick($filename); + + if (is_null($quality)) { + $quality = self::detectQualityOfJpgUsingImageMagick($filename); + } + + if (is_null($quality)) { + $quality = self::detectQualityOfJpgUsingGraphicsMagick($filename); + } + + return $quality; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Helpers/PhpIniSizes.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Helpers/PhpIniSizes.php new file mode 100644 index 0000000..c8c79df --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Convert/Helpers/PhpIniSizes.php @@ -0,0 +1,70 @@ + + * @since Class available since Release 2.0.0 + */ +class PhpIniSizes +{ + + /** + * Parse a shordhandsize string as the ones returned by ini_get() + * + * Parse a shorthandsize string having the syntax allowed in php.ini and returned by ini_get(). + * Ie "1K" => 1024. + * Strings without units are also accepted. + * The shorthandbytes syntax is described here: https://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes + * + * @param string $shortHandSize A size string of the type returned by ini_get() + * @return float|false The parsed size (beware: it is float, do not check high numbers for equality), + * or false if parse error + */ + public static function parseShortHandSize($shortHandSize) + { + + $result = preg_match("#^\\s*(\\d+(?:\\.\\d+)?)([bkmgtpezy]?)\\s*$#i", $shortHandSize, $matches); + if ($result !== 1) { + return false; + } + + // Truncate, because that is what php does. + $digitsValue = floor($matches[1]); + + if ((count($matches) >= 3) && ($matches[2] != '')) { + $unit = $matches[2]; + + // Find the position of the unit in the ordered string which is the power + // of magnitude to multiply a kilobyte by. + $position = stripos('bkmgtpezy', $unit); + + return floatval($digitsValue * pow(1024, $position)); + } else { + return $digitsValue; + } + } + + /* + * Get the size of an php.ini option. + * + * Calls ini_get() and parses the size to a number. + * If the configuration option is null, does not exist, or cannot be parsed as a shorthandsize, false is returned + * + * @param string $varname The configuration option name. + * @return float|false The parsed size or false if the configuration option does not exist + */ + public static function getIniBytes($iniVarName) + { + $iniVarValue = ini_get($iniVarName); + if (($iniVarValue == '') || $iniVarValue === false) { + return false; + } + return self::parseShortHandSize($iniVarValue); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Exceptions/InvalidInput/InvalidImageTypeException.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Exceptions/InvalidInput/InvalidImageTypeException.php new file mode 100644 index 0000000..0c1f0c8 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Exceptions/InvalidInput/InvalidImageTypeException.php @@ -0,0 +1,10 @@ +detailedMessage; + } + + public function getShortMessage() + { + return $this->shortMessage; + } + + public function __construct($shortMessage = "", $detailedMessage = "", $previous = null) + { + $detailedMessage = ($detailedMessage != '') ? $detailedMessage : $shortMessage; + $this->detailedMessage = $detailedMessage; + $this->shortMessage = $shortMessage; + + parent::__construct( + $detailedMessage, + 0, + $previous + ); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Helpers/InputValidator.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Helpers/InputValidator.php new file mode 100644 index 0000000..c791d98 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Helpers/InputValidator.php @@ -0,0 +1,61 @@ + + * @since Class available since Release 2.0.6 + */ +class InputValidator +{ + + private static $allowedMimeTypes = [ + 'image/jpeg', + 'image/png' + ]; + + /** + * Check mimetype and if file path is ok and exists + */ + public static function checkMimeType($filePath, $allowedMimeTypes = null) + { + if (is_null($allowedMimeTypes)) { + $allowedMimeTypes = self::$allowedMimeTypes; + } + // the following also tests that file path is ok and file exists + $fileMimeType = MimeType::getMimeTypeDetectionResult($filePath); + + if (is_null($fileMimeType)) { + throw new InvalidImageTypeException('Image type could not be detected'); + } elseif ($fileMimeType === false) { + throw new InvalidImageTypeException('File seems not to be an image.'); + } elseif (!in_array($fileMimeType, $allowedMimeTypes)) { + throw new InvalidImageTypeException('Unsupported mime type: ' . $fileMimeType); + } + } + + public static function checkSource($source) + { + PathChecker::checkSourcePath($source); + self::checkMimeType($source); + } + + public static function checkDestination($destination) + { + PathChecker::checkDestinationPath($destination); + } + + public static function checkSourceAndDestination($source, $destination) + { + self::checkSource($source); + self::checkDestination($destination); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Helpers/MimeType.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Helpers/MimeType.php new file mode 100644 index 0000000..4722728 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Helpers/MimeType.php @@ -0,0 +1,40 @@ + + * @since Class available since Release 2.0.6 + */ +class MimeType +{ + private static $cachedDetections = []; + + /** + * Get mime type for image (best guess). + * + * It falls back to using file extension. If that fails too, false is returned + * + * @return string|false|null mimetype (if it is an image, and type could be determined / guessed), + * false (if it is not an image type that the server knowns about) + * or null (if nothing can be determined) + */ + public static function getMimeTypeDetectionResult($absFilePath) + { + PathChecker::checkAbsolutePathAndExists($absFilePath); + + if (isset(self::$cachedDetections[$absFilePath])) { + return self::$cachedDetections[$absFilePath]; + } + self::$cachedDetections[$absFilePath] = ImageMimeTypeGuesser::lenientGuess($absFilePath); + return self::$cachedDetections[$absFilePath]; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Helpers/PathChecker.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Helpers/PathChecker.php new file mode 100644 index 0000000..0a7573a --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Helpers/PathChecker.php @@ -0,0 +1,115 @@ + + * @since Class available since Release 2.0.6 + */ +class PathChecker +{ + + /** + * Check absolute file path to prevent attacks. + * + * - Prevents non printable characters + * - Prevents stream wrappers + * - Prevents directory traversal + * + * Preventing non printable characters is especially done to prevent the NUL character, which can be used + * to bypass other tests. See https://st-g.de/2011/04/doing-filename-checks-securely-in-PHP. + * + * Preventeng stream wrappers is especially done to protect against Phar Deserialization. + * See https://blog.ripstech.com/2018/new-php-exploitation-technique/ + * + * @param string $absFilePath + * @return void + */ + public static function checkAbsolutePath($absFilePath, $text = 'file') + { + if (empty($absFilePath)) { + throw new InvalidInputException('Empty filepath for ' . $text); + } + + // Prevent non printable characters + /* + if (!ctype_print($absFilePath)) { + throw new InvalidInputException('Non-printable characters are not allowed in ' . $text); + }*/ + + // Prevent control characters (at least the first 32 (#0 - #1f) + if (preg_match('#[\x{0}-\x{1f}]#', $absFilePath)) { + throw new InvalidInputException('Non-printable characters are not allowed'); + } + + // Prevent directory traversal + /* Disabled. We DO allow it again (#203) + if (preg_match('#\.\.\/#', $absFilePath)) { + throw new InvalidInputException('Directory traversal is not allowed in ' . $text . ' path'); + }*/ + + // Prevent stream wrappers ("phar://", "php://" and the like) + // https://www.php.net/manual/en/wrappers.phar.php + if (preg_match('#^\\w+://#', $absFilePath)) { + throw new InvalidInputException('Stream wrappers are not allowed in ' . $text . ' path'); + } + } + + public static function checkAbsolutePathAndExists($absFilePath, $text = 'file') + { + if (empty($absFilePath)) { + throw new TargetNotFoundException($text . ' argument missing'); + } + self::checkAbsolutePath($absFilePath, $text); + if (@!file_exists($absFilePath)) { + throw new TargetNotFoundException($text . ' file was not found'); + } + if (@is_dir($absFilePath)) { + throw new InvalidInputException($text . ' is a directory'); + } + } + + /** + * Checks that source path is secure, file exists and it is not a dir. + * + * To also check mime type, use InputValidator::checkSource + */ + public static function checkSourcePath($source) + { + self::checkAbsolutePathAndExists($source, 'source'); + } + + public static function checkDestinationPath($destination) + { + if (empty($destination)) { + throw new InvalidInputException('Destination argument missing'); + } + self::checkAbsolutePath($destination, 'destination'); + + if (!preg_match('#\.webp$#i', $destination)) { + // Prevent overriding important files. + // Overriding an .htaccess file would lay down the website. + throw new InvalidInputException( + 'Destination file must end with ".webp". ' . + 'If you deliberately want to store the webp files with another extension, you must rename ' . + 'the file after successful conversion' + ); + } + + if (@is_dir($destination)) { + throw new InvalidInputException('Destination is a directory'); + } + } + + public static function checkSourceAndDestinationPaths($source, $destination) + { + self::checkSourcePath($source); + self::checkDestinationPath($destination); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Helpers/Sanitize.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Helpers/Sanitize.php new file mode 100644 index 0000000..0e3ebc7 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Helpers/Sanitize.php @@ -0,0 +1,30 @@ +'; + $realPathResult = realpath($dir); + if ($realPathResult !== false) { + return $realPathResult; + } + if (($dir == '/') || (strlen($dir) < 4)) { + return $dir; + } + $levelsUp++; + } + return '/'; + } + + public static function pathBeginsWithSymLinksExpanded($input, $beginsWith, $errorMsg = 'Path is outside allowed path') { + $closestExistingFolder = self::findClosestExistingFolderSymLinksExpanded($input); + //throw new SanityException('hm.' . $input . ' :
' . $closestExistingFolder); + self::pathBeginsWith($closestExistingFolder, $beginsWith, $errorMsg); + } + + + + public static function absPathExists($input, $errorMsg = 'Path does not exist') + { + self::absPath($input); + if (@!file_exists($input)) { + throw new SanityException($errorMsg); + } + return $input; + } + + public static function absPathExistsAndIsDir( + $input, + $errorMsg = 'Path points to a file (it should point to a directory)' + ) { + self::absPathExists($input); + if (!is_dir($input)) { + throw new SanityException($errorMsg); + } + return $input; + } + + public static function absPathExistsAndIsFile( + $input, + $errorMsg = 'Path points to a directory (it should not do that)' + ) { + self::absPathExists($input, 'File does not exist'); + if (@is_dir($input)) { + throw new SanityException($errorMsg); + } + return $input; + } + + public static function absPathExistsAndIsNotDir( + $input, + $errorMsg = 'Path points to a directory (it should point to a file)' + ) { + self::absPathExistsAndIsFile($input, $errorMsg); + return $input; + } + + + public static function pregMatch($pattern, $input, $errorMsg = 'Does not match expected pattern') + { + self::noNUL($input); + self::mustBeString($input); + if (!preg_match($pattern, $input)) { + throw new SanityException($errorMsg); + } + return $input; + } + + public static function isJSONArray($input, $errorMsg = 'Not a JSON array') + { + self::noNUL($input); + self::mustBeString($input); + self::notEmpty($input); + if ((strpos($input, '[') !== 0) || (!is_array(json_decode($input)))) { + throw new SanityException($errorMsg); + } + return $input; + } + + public static function isJSONObject($input, $errorMsg = 'Not a JSON object') + { + self::noNUL($input); + self::mustBeString($input); + self::notEmpty($input); + if ((strpos($input, '{') !== 0) || (!is_object(json_decode($input)))) { + throw new SanityException($errorMsg); + } + return $input; + } + +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Loggers/BaseLogger.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Loggers/BaseLogger.php new file mode 100644 index 0000000..a251b12 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Loggers/BaseLogger.php @@ -0,0 +1,44 @@ + + * @since Class available since Release 2.0.0 + */ +abstract class BaseLogger +{ + /** + * Write a message to the log + * + * @param string $msg message to log + * @param string $style style (null | bold | italic) + * @return void + */ + abstract public function log($msg, $style = ''); + + /** + * Add new line to the log + * @return void + */ + abstract public function ln(); + + /** + * Write a line to the log + * + * @param string $msg message to log + * @param string $style style (null | bold | italic) + * @return void + */ + public function logLn($msg, $style = '') + { + $this->log($msg, $style); + $this->ln(); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Loggers/BufferLogger.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Loggers/BufferLogger.php new file mode 100644 index 0000000..47d7724 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Loggers/BufferLogger.php @@ -0,0 +1,113 @@ + + * @since Class available since Release 2.0.0 + */ +class BufferLogger extends BaseLogger +{ + public $entries = array(); + + /** + * Write a message to the buffer - all entries can later be retrieved with getText() or getHtlm(). + * + * @param string $msg message to log + * @param string $style style (null | bold | italic) + * @return void + */ + public function log($msg, $style = '') + { + $this->entries[] = [$msg, $style]; + } + + /** + * Write a new line to the buffer. + * + * @return void + */ + public function ln() + { + $this->entries[] = ''; + } + + /** + * Get everything logged - as HTML. + * + * @return string The log, formatted as HTML. + */ + public function getHtml() + { + $html = ''; + foreach ($this->entries as $entry) { + if ($entry == '') { + $html .= '
'; + } else { + list($msg, $style) = $entry; + $msg = htmlspecialchars($msg); + if ($style == 'bold') { + $html .= '' . $msg . ''; + } elseif ($style == 'italic') { + $html .= '' . $msg . ''; + } else { + $html .= $msg; + } + } + } + return $html; + } + + /** + * Get everything logged - as markdown. + * + * @return string The log, formatted as MarkDown. + */ + public function getMarkDown($newLineChar = "\n\r") + { + $md = ''; + foreach ($this->entries as $entry) { + if ($entry == '') { + $md .= $newLineChar; + } else { + list($msg, $style) = $entry; + if ($style == 'bold') { + $md .= '**' . $msg . '** '; + } elseif ($style == 'italic') { + $md .= '*' . $msg . '* '; + } else { + $md .= $msg; + } + } + } + return $md; + } + + /** + * Get everything logged - as plain text. + * + * @param string $newLineChar. The character used for new lines. + * @return string The log, formatted as plain text. + */ + public function getText($newLineChar = ' ') + { + $text = ''; + foreach ($this->entries as $entry) { + if ($entry == '') { // empty string means new line + if (substr($text, -2) != '.' . $newLineChar) { + $text .= '.' . $newLineChar; + } + } else { + list($msg, $style) = $entry; + $text .= $msg; + } + } + + return $text; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Loggers/EchoLogger.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Loggers/EchoLogger.php new file mode 100644 index 0000000..12f45ca --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Loggers/EchoLogger.php @@ -0,0 +1,43 @@ + + * @since Class available since Release 2.0.0 + */ +class EchoLogger extends BaseLogger +{ + + /** + * Handle log() by echoing the message. + * + * @param string $msg message to log + * @param string $style style (null | bold | italic) + * @return void + */ + public function log($msg, $style = '') + { + $msg = htmlspecialchars($msg); + if ($style == 'bold') { + echo '' . $msg . ''; + } elseif ($style == 'italic') { + echo '' . $msg . ''; + } else { + echo $msg; + } + } + + /** + * Handle ln by echoing a
tag. + * + * @return void + */ + public function ln() + { + echo '
'; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Options/ArrayOption.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/ArrayOption.php new file mode 100644 index 0000000..6bdd909 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/ArrayOption.php @@ -0,0 +1,41 @@ + + * @since Class available since Release 2.0.0 + */ +class ArrayOption extends Option +{ + + protected $typeId = 'array'; + protected $schemaType = ['array']; + + public function check() + { + $this->checkType('array'); + } + + public function getValueForPrint() + { + if (count($this->getValue()) == 0) { + return '(empty array)'; + } else { + return parent::getValueForPrint(); + } + } + + public function getDefinition() + { + $obj = parent::getDefinition(); + $obj['sensitive'] = false; + return $obj; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Options/BooleanOption.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/BooleanOption.php new file mode 100644 index 0000000..4fde690 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/BooleanOption.php @@ -0,0 +1,30 @@ + + * @since Class available since Release 2.0.0 + */ +class BooleanOption extends Option +{ + + protected $typeId = 'boolean'; + protected $schemaType = ['boolean']; + + public function check() + { + $this->checkType('boolean'); + } + + public function getValueForPrint() + { + return ($this->getValue() === true ? 'true' : 'false'); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Options/Exceptions/InvalidOptionTypeException.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/Exceptions/InvalidOptionTypeException.php new file mode 100644 index 0000000..14a0fa9 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/Exceptions/InvalidOptionTypeException.php @@ -0,0 +1,10 @@ + + * @since Class available since Release 2.0.0 + */ +class GhostOption extends Option +{ + + protected $typeId = 'ghost'; + + public function getValueForPrint() + { + return '(not defined for this converter)'; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Options/IntegerOption.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/IntegerOption.php new file mode 100644 index 0000000..db442db --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/IntegerOption.php @@ -0,0 +1,76 @@ + + * @since Class available since Release 2.0.0 + */ +class IntegerOption extends Option +{ + protected $typeId = 'int'; + protected $schemaType = ['integer']; + protected $minValue; + protected $maxValue; + + /** + * Constructor. + * + * @param string $id id of the option + * @param integer $defaultValue default value for the option + * @throws InvalidOptionValueException if the default value cannot pass the check + * @return void + */ + public function __construct($id, $defaultValue, $minValue = null, $maxValue = null) + { + $this->minValue = $minValue; + $this->maxValue = $maxValue; + parent::__construct($id, $defaultValue); + } + + protected function checkMin() + { + if (!is_null($this->minValue) && $this->getValue() < $this->minValue) { + throw new InvalidOptionValueException( + '"' . $this->id . '" option must be set to minimum ' . $this->minValue . '. ' . + 'It was however set to: ' . $this->getValue() + ); + } + } + + protected function checkMax() + { + if (!is_null($this->maxValue) && $this->getValue() > $this->maxValue) { + throw new InvalidOptionValueException( + '"' . $this->id . '" option must be set to max ' . $this->maxValue . '. ' . + 'It was however set to: ' . $this->getValue() + ); + } + } + + protected function checkMinMax() + { + $this->checkMin(); + $this->checkMax(); + } + + public function check() + { + $this->checkType('integer'); + $this->checkMinMax(); + } + + public function getSchema() + { + $obj = parent::getSchema(); + $obj['minimum'] = $this->minValue; + $obj['maximum'] = $this->maxValue; + return $obj; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Options/IntegerOrNullOption.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/IntegerOrNullOption.php new file mode 100644 index 0000000..85f41bc --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/IntegerOrNullOption.php @@ -0,0 +1,50 @@ + + * @since Class available since Release 2.0.0 + */ +class IntegerOrNullOption extends IntegerOption +{ + protected $schemaType = ['integer', 'null']; + + public function __construct($id, $defaultValue, $minValue = null, $maxValue = null) + { + parent::__construct($id, $defaultValue, $minValue, $maxValue); + } + + public function check() + { + $this->checkMinMax(); + + $valueType = gettype($this->getValue()); + if (!in_array($valueType, ['integer', 'NULL'])) { + throw new InvalidOptionValueException( + 'The "' . $this->id . '" option must be either integer or NULL. ' . + 'You however provided a value of type: ' . $valueType + ); + } + } + + public function getValueForPrint() + { + if (gettype($this->getValue() == 'NULL')) { + return 'null (not set)'; + } + return parent::getValueForPrint(); + } + + public function getDefinition() + { + $obj = parent::getDefinition(); + return $obj; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Options/MetadataOption.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/MetadataOption.php new file mode 100644 index 0000000..a56601f --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/MetadataOption.php @@ -0,0 +1,47 @@ + + * @since Class available since Release 2.0.0 + */ +class MetadataOption extends StringOption +{ + + protected $typeId = 'metadata'; + protected $schemaType = ['string']; + + public function __construct($id, $defaultValue) + { + parent::__construct($id, $defaultValue); + } + + public function check() + { + parent::check(); + + $value = $this->getValue(); + + if (($value == 'all') || ($value == 'none')) { + return; + } + + foreach (explode(',', $value) as $item) { + if (!in_array($value, ['exif', 'icc', 'xmp'])) { + throw new InvalidOptionValueException( + '"metadata" option must be "all", "none" or a comma-separated list of "exif", "icc" or "xmp". ' . + 'It was however set to: "' . $value . '"' + ); + } + } + + //$this->checkType('string'); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Options/Option.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/Option.php new file mode 100644 index 0000000..0d874ae --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/Option.php @@ -0,0 +1,254 @@ + + * @since Class available since Release 2.0.0 + */ +class Option +{ + /** @var string The id of the option */ + protected $id; + + /** @var mixed The default value of the option */ + protected $defaultValue; + + /** @var mixed The value of the option */ + protected $value; + + /** @var boolean Whether the value has been set (if not, getValue() will return the default value) */ + protected $isExplicitlySet = false; + + /** @var string An option must supply a type id */ + protected $typeId; + + /** @var array Type constraints for the value (JSON schema syntax) */ + protected $schemaType = []; + + /** @var array|null Array of allowed values (JSON schema syntax) */ + protected $enum = null; //https://json-schema.org/understanding-json-schema/reference/generic.html#enumerated-values + + /** @var boolean Whether the option has been deprecated */ + protected $deprecated = false; + + /** @var string Help text */ + protected $helpText = ''; + + /** @var array UI Def */ + protected $ui; + + /** @var array|null Extra Schema Def (ie holding 'title', 'description' or other)*/ + protected $extraSchemaDefs; + + + /** + * Constructor. + * + * @param string $id id of the option + * @param mixed $defaultValue default value for the option + * @throws InvalidOptionValueException if the default value cannot pass the check + * @throws InvalidOptionTypeException if the default value is wrong type + * @return void + */ + public function __construct($id, $defaultValue) + { + $this->id = $id; + $this->defaultValue = $defaultValue; + + // Check that default value is ok + $this->check(); + } + + /** + * Get Id. + * + * @return string The id of the option + */ + public function getId() + { + return $this->id; + } + + /** + * Get Id. + * + * @param string $id The id of the option + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * Get default value. + * + * @return mixed The default value for the option + */ + public function getDefaultValue() + { + return $this->defaultValue; + } + + + /** + * Get value, or default value if value has not been explicitly set. + * + * @return mixed The value/default value + */ + public function getValue() + { + if (!$this->isExplicitlySet) { + return $this->defaultValue; + } else { + return $this->value; + } + } + + /** + * Get to know if value has been set. + * + * @return boolean Whether or not the value has been set explicitly + */ + public function isValueExplicitlySet() + { + return $this->isExplicitlySet; + } + + /** + * Set value + * + * @param mixed $value The value + * @return void + */ + public function setValue($value) + { + $this->isExplicitlySet = true; + $this->value = $value; + } + + /** + * Check if the value is valid. + * + * This base class does no checking, but this method is overridden by most other options. + * @return void + */ + public function check() + { + } + + /** + * Helpful function for checking type - used by subclasses. + * + * @param string $expectedType The expected type, ie 'string' + * @throws InvalidOptionTypeException If the type is invalid + * @return void + */ + protected function checkType($expectedType) + { + if (gettype($this->getValue()) != $expectedType) { + throw new InvalidOptionTypeException( + 'The "' . $this->id . '" option must be a ' . $expectedType . + ' (you provided a ' . gettype($this->getValue()) . ')' + ); + } + } + + public function markDeprecated() + { + $this->deprecated = true; + } + + public function isDeprecated() + { + return $this->deprecated; + } + + public function getValueForPrint() + { + return print_r($this->getValue(), true); + } + + /** + * Set help text for the option + * + * @param string $helpText The help text + * @return void + */ + public function setHelpText($helpText) + { + $this->helpText = $helpText; + } + + /** + * Get help text for the option + * + * @return string $helpText The help text + */ + public function getHelpText() + { + return $this->helpText; + } + + /** + * Set ui definition for the option + * + * @param array $ui The UI def + * @return void + */ + public function setUI($ui) + { + $this->ui = $ui; + } + + public function setExtraSchemaDefs($def) + { + $this->extraSchemaDefs = $def; + } + + + /** + * Get ui definition for the option + * + * @return array $ui The UI def + */ + public function getUI() + { + return $this->ui; + } + + public function getSchema() + { + if (isset($this->extraSchemaDefs)) { + $schema = $this->extraSchemaDefs; + } else { + $schema = []; + } + $schema['type'] = $this->schemaType; + $schema['default'] = $this->defaultValue; + if (!is_null($this->enum)) { + $schema['enum'] = $this->enum; + } + return $schema; + } + + + public function getDefinition() + { + $obj = [ + 'id' => $this->id, + 'schema' => $this->getSchema(), + 'ui' => $this->ui, + ]; + if ($this->deprecated) { + $obj['deprecated'] = true; + } + return $obj; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Options/OptionFactory.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/OptionFactory.php new file mode 100644 index 0000000..f69cfd9 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/OptionFactory.php @@ -0,0 +1,96 @@ + + * @since Class available since Release 2.7.0 + */ +class OptionFactory +{ + + public static function createOption($optionName, $optionType, $def) + { + $option = null; + switch ($optionType) { + case 'int': + $minValue = (isset($def['minimum']) ? $def['minimum'] : null); + $maxValue = (isset($def['maximum']) ? $def['maximum'] : null); + unset($def['minimum']); + unset($def['maximum']); + if (isset($def['allow-null']) && $def['allow-null']) { + $option = new IntegerOrNullOption($optionName, $def['default'], $minValue, $maxValue); + } else { + if ($optionName == 'quality') { + $option = new QualityOption($optionName, $def['default']); + } else { + $option = new IntegerOption($optionName, $def['default'], $minValue, $maxValue); + } + } + break; + + case 'string': + if ($optionName == 'metadata') { + $option = new MetadataOption($optionName, $def['default']); + } else { + $enum = (isset($def['enum']) ? $def['enum'] : null); + if (isset($def['sensitive']) && ($def['sensitive'] == true)) { + unset($def['sensitive']); + $option = new SensitiveStringOption($optionName, $def['default'], $enum); + } else { + $option = new StringOption($optionName, $def['default'], $enum); + } + } + break; + + case 'boolean': + $option = new BooleanOption($optionName, $def['default']); + break; + + case 'array': + if (isset($def['sensitive']) && ($def['sensitive'] == true)) { + $option = new SensitiveArrayOption($optionName, $def['default']); + } else { + $option = new ArrayOption($optionName, $def['default']); + } + break; + } + unset($def['default']); + + if (!is_null($option)) { + if (isset($def['deprecated'])) { + $option->markDeprecated(); + } + if (isset($def['ui'])) { + $option->setUI($def['ui']); + unset($def['ui']); + } + } + $option->setExtraSchemaDefs($def); + return $option; + } + + public static function createOptions($def) + { + $result = []; + foreach ($def as $i => list($optionName, $optionType, $optionDef)) { + $option = self::createOption($optionName, $optionType, $optionDef); + if (!is_null($option)) { + $result[] = $option; + } + } + return $result; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Options/Options.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/Options.php new file mode 100644 index 0000000..d8c64bf --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/Options.php @@ -0,0 +1,209 @@ + + * @since Class available since Release 2.0.0 + */ +class Options +{ + + /** @var array A map of options, keyed by their id */ + private $options = []; + + /** + * Add option. + * + * @param Option $option The option object to add to collection. + * @return void + */ + public function addOption($option) + { + $this->options[$option->getId()] = $option; + } + + /** + * Add options. + * + * Conveniently add several options in one call. + * + * @return void + */ + public function addOptions() + { + $options = func_get_args(); + foreach ($options as $option) { + $this->addOption($option); + } + } + + /* + In some years, we can use the splat instead (requires PHP 5.6): + @param Option[] ...$options Array of options objects to add + public function addOptions(...$options) + { + foreach ($options as $option) { + $this->addOption($option); + } + }*/ + + /** + * Set the value of an option. + * + * @param string $id Id of the option + * @param mixed $value Value of the option + * @return void + */ + public function setOption($id, $value) + { + if (!isset($this->options[$id])) { + throw new OptionNotFoundException( + 'Could not set option. There is no option called "' . $id . '" in the collection.' + ); + } + $option = $this->options[$id]; + $option->setValue($value); + } + + /** + * Set option, or create a new, if no such option exists. + * + * @param string $id Id of option to set/create + * @param mixed $value Value of option + * @return void + */ + public function setOrCreateOption($id, $value) + { + if (!isset($this->options[$id])) { + $newOption = new GhostOption($id, null); + $newOption->setValue($value); + //$newOption = new Option($id, $value); + $this->addOption($newOption); + } else { + $this->setOption($id, $value); + } + } + + /** + * Get the value of an option in the collection - by id. + * + * @deprecated Use getOptionValue() instead + * @param string $id Id of the option to get + * @throws OptionNotFoundException if the option is not in the collection + * @return mixed The value of the option + */ + public function getOption($id) + { + return $this->getOptionValue($id); + } + + /** + * Get the Option in the collection by id. + * + * @param string $id Id of the option to get + * @throws OptionNotFoundException if the option is not in the collection + * @return mixed The value of the option + */ + public function getOptionById($id) + { + if (!isset($this->options[$id])) { + throw new OptionNotFoundException( + 'There is no option called "' . $id . '" in the collection.' + ); + } + return $this->options[$id]; + } + + /** + * Get the value of an option in the collection - by id. + * + * @param string $id Id of the option to get + * @throws OptionNotFoundException if the option is not in the collection + * @return mixed The value of the option + */ + public function getOptionValue($id) + { + $option = $this->getOptionById($id); + return $option->getValue(); + } + + /** + * Return map of Option objects. + * + * @return array map of option objects + */ + public function getOptionsMap() + { + return $this->options; + } + + /** + * Return flat associative array of options (simple objects). + * + * @return array associative array of options + */ + public function getOptions() + { + $values = []; + foreach ($this->options as $id => $option) { + $values[$id] = $option->getValue(); + } + return $values; + } + + /** + * Check all options in the collection. + */ + public function check() + { + foreach ($this->options as $id => $option) { + $option->check(); + } + } + + /** + * Set help texts on multiple options + * + * @param array $helpTexts Hash of helptexts indexed by option id + */ + public function setHelpTexts($helpTexts) + { + foreach ($this->options as $option) { + if (array_key_exists($option->getId(), $helpTexts)) { + $option->setHelpText($helpTexts[$option->getId()]); + } + } + } + + /** + * Set ui definitions on multiple options + * + * @param array $uis Hash of ui definitions indexed by option id + */ + public function setUI($uis) + { + foreach ($this->options as $option) { + if (array_key_exists($option->getId(), $uis)) { + $option->setUI($uis[$option->getId()]); + } + } + } + + public function getDefinitions($deprecatedToo = false) + { + $defs = []; + foreach ($this->options as $option) { + if ($deprecatedToo || !($option->isDeprecated())) { + $defs[] = $option->getDefinition(); + } + } + return $defs; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Options/QualityOption.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/QualityOption.php new file mode 100644 index 0000000..11f8295 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/QualityOption.php @@ -0,0 +1,59 @@ + + * @since Class available since Release 2.0.0 + */ +class QualityOption extends Option +{ + protected $typeId = 'int'; + protected $schemaType = ['integer', 'string']; + + public function __construct($id, $defaultValue) + { + parent::__construct($id, $defaultValue); + } + + public function check() + { + $value = $this->getValue(); + if (gettype($value) == 'string') { + if ($value != 'auto') { + throw new InvalidOptionValueException( + 'The "quality" option must be either "auto" or a number between 0-100. ' . + 'A string, different from "auto" was given' + ); + } + } elseif (gettype($value) == 'integer') { + if (($value < 0) || ($value > 100)) { + throw new InvalidOptionValueException( + 'The "quality" option must be either "auto" or a number between 0-100. ' . + 'The number you provided (' . strval($value) . ') is out of range.' + ); + } + } else { + throw new InvalidOptionValueException( + 'The "quality" option must be either "auto" or an integer. ' . + 'You however provided a value of type: ' . gettype($value) + ); + } + } + + public function getValueForPrint() + { + if (gettype($this->getValue()) == 'string') { + return '"' . $this->getValue() . '"'; + } + return $this->getValue(); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Options/SensitiveArrayOption.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/SensitiveArrayOption.php new file mode 100644 index 0000000..1d36cdc --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/SensitiveArrayOption.php @@ -0,0 +1,39 @@ + + * @since Class available since Release 2.0.0 + */ +class SensitiveArrayOption extends ArrayOption +{ + + public function check() + { + parent::check(); + } + + public function getValueForPrint() + { + if (count($this->getValue()) == 0) { + return '(empty array)'; + } else { + return '(array of ' . count($this->getValue()) . ' items)'; + } + //return '*****'; + } + + public function getDefinition() + { + $obj = parent::getDefinition(); + $obj['sensitive'] = true; + return $obj; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Options/SensitiveStringOption.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/SensitiveStringOption.php new file mode 100644 index 0000000..cba7c0f --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/SensitiveStringOption.php @@ -0,0 +1,42 @@ + + * @since Class available since Release 2.0.0 + */ +class SensitiveStringOption extends StringOption +{ + + public function __construct($id, $defaultValue, $enum = null) + { + parent::__construct($id, $defaultValue, $enum); + } + + public function check() + { + parent::check(); + } + + public function getValueForPrint() + { + if (strlen($this->getValue()) == 0) { + return '""'; + } + return '*****'; + } + + public function getDefinition() + { + $obj = parent::getDefinition(); + $obj['sensitive'] = true; + return $obj; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Options/StringOption.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/StringOption.php new file mode 100644 index 0000000..bacc7de --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Options/StringOption.php @@ -0,0 +1,55 @@ + + * @since Class available since Release 2.0.0 + */ +class StringOption extends Option +{ + + protected $typeId = 'string'; + protected $enum; + protected $schemaType = ['string']; + + public function __construct($id, $defaultValue, $enum = null) + { + $this->enum = $enum; + parent::__construct($id, $defaultValue); + } + + public function check() + { + $this->checkType('string'); + + if (!is_null($this->enum) && (!in_array($this->getValue(), $this->enum))) { + throw new InvalidOptionValueException( + '"' . $this->id . '" option must be on of these values: ' . + '[' . implode(', ', $this->enum) . ']. ' . + 'It was however set to: "' . $this->getValue() . '"' + ); + } + } + + public function getValueForPrint() + { + return '"' . $this->getValue() . '"'; + } + + public function getDefinition() + { + $obj = parent::getDefinition(); + $obj['sensitive'] = false; + if (!is_null($this->enum)) { + $obj['options'] = $this->enum; + } + return $obj; + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Serve/Exceptions/ServeFailedException.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Serve/Exceptions/ServeFailedException.php new file mode 100644 index 0000000..3d9c2e7 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Serve/Exceptions/ServeFailedException.php @@ -0,0 +1,10 @@ + + * @since Class available since Release 2.0.0 + */ +class Header +{ + /** + * Convenience function for adding header (append). + * + * @param string $header The header to add. + * @return void + */ + public static function addHeader($header) + { + header($header, false); + } + + /** + * Convenience function for replacing header. + * + * @param string $header The header to set. + * @return void + */ + public static function setHeader($header) + { + header($header, true); + } + + /** + * Add log header and optionally send it to a logger as well. + * + * @param string $msg Message to add to "X-WebP-Convert-Log" header + * @param \WebPConvert\Loggers\BaseLogger $logger (optional) + * @return void + */ + public static function addLogHeader($msg, $logger = null) + { + self::addHeader('X-WebP-Convert-Log: ' . $msg); + if (!is_null($logger)) { + $logger->logLn($msg); + } + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Serve/Report.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Serve/Report.php new file mode 100644 index 0000000..0cc1b6c --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Serve/Report.php @@ -0,0 +1,54 @@ + + * @since Class available since Release 2.0.0 + */ +class Report +{ + public static function convertAndReport($source, $destination, $options) + { + InputValidator::checkSourceAndDestination($source, $destination); + ?> + + + + + + + + + +
source:
destination:
+
+ getMessage(); + echo '' . $msg . ''; + + //echo '

Rethrowing exception for your convenience

'; + //throw ($e); + } + ?> + + + + * @since Class available since Release 2.0.0 + */ +class ServeConvertedWebP +{ + + /** + * Process options. + * + * @throws \WebPConvert\Options\Exceptions\InvalidOptionTypeException If the type of an option is invalid + * @throws \WebPConvert\Options\Exceptions\InvalidOptionValueException If the value of an option is invalid + * @param array $options + */ + private static function processOptions($options) + { + $options2 = new Options(); + $options2->addOptions( + new BooleanOption('reconvert', false), + new BooleanOption('serve-original', false), + new BooleanOption('show-report', false), + new BooleanOption('suppress-warnings', true), + new BooleanOption('redirect-to-self-instead-of-serving', false), + new ArrayOption('serve-image', []), + new SensitiveArrayOption('convert', []) + ); + foreach ($options as $optionId => $optionValue) { + $options2->setOrCreateOption($optionId, $optionValue); + } + $options2->check(); + return $options2->getOptions(); + } + + /** + * Serve original file (source). + * + * @param string $source path to source file + * @param array $serveImageOptions (optional) options for serving an image + * Supported options: + * - All options supported by ServeFile::serve() + * @throws ServeFailedException if source is not an image or mime type cannot be determined + * @return void + */ + public static function serveOriginal($source, $serveImageOptions = []) + { + // PS: We do not use InputValidator::checkSource($source) because we want to be + // a bit more lenient here and allow any image to be served (even though ie webp does not + // qualify for being used as a source when converting) + + // Check that the filename is ok (no control chars, streamwrappers), and that the file exists + // and is not a dir + PathChecker::checkSourcePath($source); + + $contentType = MimeType::getMimeTypeDetectionResult($source); + if (is_null($contentType)) { + throw new ServeFailedException('Rejecting to serve original (mime type cannot be determined)'); + } elseif ($contentType === false) { + throw new ServeFailedException('Rejecting to serve original (it is not an image)'); + } else { + ServeFile::serve($source, $contentType, $serveImageOptions); + } + } + + /** + * Serve destination file. + * + * TODO: SHould this really be public? + * + * @param string $destination path to destination file + * @param array $serveImageOptions (optional) options for serving (such as which headers to add) + * Supported options: + * - All options supported by ServeFile::serve() + * @return void + */ + public static function serveDestination($destination, $serveImageOptions = []) + { + InputValidator::checkDestination($destination); + ServeFile::serve($destination, 'image/webp', $serveImageOptions); + } + + + public static function warningHandler() + { + // do nothing! - as we do not return anything, the warning is suppressed + } + + /** + * Serve converted webp. + * + * Serve a converted webp. If a file already exists at the destination, that is served (unless it is + * older than the source - in that case a fresh conversion will be made, or the file at the destination + * is larger than the source - in that case the source is served). Some options may alter this logic. + * In case no file exists at the destination, a fresh conversion is made and served. + * + * @param string $source path to source file + * @param string $destination path to destination + * @param array $options (optional) options for serving/converting + * Supported options: + * 'show-report' => (boolean) If true, the decision will always be 'report' + * 'serve-original' => (boolean) If true, the decision will be 'source' (unless above option is set) + * 'reconvert ' => (boolean) If true, the decision will be 'fresh-conversion' (unless one of the + * above options is set) + * - All options supported by WebPConvert::convert() + * - All options supported by ServeFile::serve() + * @param \WebPConvert\Loggers\BaseLogger $serveLogger (optional) + * @param \WebPConvert\Loggers\BaseLogger $convertLogger (optional) + * + * @throws \WebPConvert\Exceptions\WebPConvertException If something went wrong. + * @return void + */ + public static function serve($source, $destination, $options = [], $serveLogger = null, $convertLogger = null) + { + InputValidator::checkSourceAndDestination($source, $destination); + + $options = self::processOptions($options); + + if ($options['suppress-warnings']) { + set_error_handler( + array('\\WebPConvert\\Serve\\ServeConvertedWebP', "warningHandler"), + E_WARNING | E_USER_WARNING | E_NOTICE | E_USER_NOTICE + ); + } + + + //$options = array_merge(self::$defaultOptions, $options); + + // Step 1: Is there a file at the destination? If not, trigger conversion + // However 1: if "show-report" option is set, serve the report instead + // However 2: "reconvert" option should also trigger conversion + if ($options['show-report']) { + Header::addLogHeader('Showing report', $serveLogger); + Report::convertAndReport($source, $destination, $options); + return; + } + + if (!@file_exists($destination)) { + Header::addLogHeader('Converting (there were no file at destination)', $serveLogger); + WebPConvert::convert($source, $destination, $options['convert'], $convertLogger); + } elseif ($options['reconvert']) { + Header::addLogHeader('Converting (told to reconvert)', $serveLogger); + WebPConvert::convert($source, $destination, $options['convert'], $convertLogger); + } else { + // Step 2: Is the destination older than the source? + // If yes, trigger conversion (deleting destination is implicit) + $timestampSource = @filemtime($source); + $timestampDestination = @filemtime($destination); + if (($timestampSource !== false) && + ($timestampDestination !== false) && + ($timestampSource > $timestampDestination)) { + Header::addLogHeader('Converting (destination was older than the source)', $serveLogger); + WebPConvert::convert($source, $destination, $options['convert'], $convertLogger); + } + } + + // Step 3: Serve the smallest file (destination or source) + // However, first check if 'serve-original' is set + if ($options['serve-original']) { + Header::addLogHeader('Serving original (told to)', $serveLogger); + self::serveOriginal($source, $options['serve-image']); + return; + } + + if ($options['redirect-to-self-instead-of-serving']) { + Header::addLogHeader( + 'Redirecting to self! ' . + '(hope you got redirection to existing webps set up, otherwise you will get a loop!)', + $serveLogger + ); + header('Location: ?fresh', 302); + return; + } + + $filesizeDestination = @filesize($destination); + $filesizeSource = @filesize($source); + if (($filesizeSource !== false) && + ($filesizeDestination !== false) && + ($filesizeDestination > $filesizeSource)) { + Header::addLogHeader('Serving original (it is smaller)', $serveLogger); + self::serveOriginal($source, $options['serve-image']); + return; + } + + Header::addLogHeader('Serving converted file', $serveLogger); + self::serveDestination($destination, $options['serve-image']); + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Serve/ServeConvertedWebPWithErrorHandling.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Serve/ServeConvertedWebPWithErrorHandling.php new file mode 100644 index 0000000..883a622 --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Serve/ServeConvertedWebPWithErrorHandling.php @@ -0,0 +1,160 @@ + + * @since Class available since Release 2.0.0 + */ +class ServeConvertedWebPWithErrorHandling +{ + + /** + * Process options. + * + * @throws \WebPConvert\Options\Exceptions\InvalidOptionTypeException If the type of an option is invalid + * @throws \WebPConvert\Options\Exceptions\InvalidOptionValueException If the value of an option is invalid + * @param array $options + */ + private static function processOptions($options) + { + $options2 = new Options(); + $options2->addOptions( + new StringOption('fail', 'original', ['original', '404', 'throw', 'report']), + new StringOption('fail-when-fail-fails', 'throw', ['original', '404', 'throw', 'report']) + ); + foreach ($options as $optionId => $optionValue) { + $options2->setOrCreateOption($optionId, $optionValue); + } + $options2->check(); + return $options2->getOptions(); + } + + /** + * Add headers for preventing caching. + * + * @return void + */ + private static function addHeadersPreventingCaching() + { + Header::setHeader("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); + Header::addHeader("Cache-Control: post-check=0, pre-check=0"); + Header::setHeader("Pragma: no-cache"); + } + + /** + * Perform fail action. + * + * @param string $fail Action to perform (original | 404 | report) + * @param string $failIfFailFails Action to perform if $fail action fails + * @param string $source path to source file + * @param string $destination path to destination + * @param array $options (optional) options for serving/converting + * @param \Exception $e exception that was thrown when trying to serve + * @param string $serveClass (optional) Full class name to a class that has a serveOriginal() method + * @return void + */ + public static function performFailAction($fail, $failIfFailFails, $source, $destination, $options, $e, $serveClass) + { + self::addHeadersPreventingCaching(); + + Header::addLogHeader('Performing fail action: ' . $fail); + + switch ($fail) { + case 'original': + try { + //ServeConvertedWebP::serveOriginal($source, $options); + call_user_func($serveClass . '::serveOriginal', $source, $options); + } catch (\Exception $e) { + self::performFailAction($failIfFailFails, '404', $source, $destination, $options, $e, $serveClass); + } + break; + + case '404': + $protocol = isset($_SERVER["SERVER_PROTOCOL"]) ? $_SERVER["SERVER_PROTOCOL"] : 'HTTP/1.0'; + Header::setHeader($protocol . " 404 Not Found"); + break; + + case 'report': + $options['show-report'] = true; + Report::convertAndReport($source, $destination, $options); + break; + + case 'throw': + throw $e; + //break; commented out as phpstan complains. But do something else complain now? + + case 'report-as-image': + // TODO: Implement or discard ? + break; + } + } + + /** + * Serve webp image and handle errors as specified in the 'fail' option. + * + * This method basically wraps ServeConvertedWebP:serve in order to provide exception handling. + * The error handling is set with the 'fail' option and can be either '404', 'original' or 'report'. + * If set to '404', errors results in 404 Not Found headers being issued. If set to 'original', an + * error results in the original being served. + * Look up the ServeConvertedWebP:serve method to learn more. + * + * @param string $source path to source file + * @param string $destination path to destination + * @param array $options (optional) options for serving/converting + * Supported options: + * - 'fail' => (string) Action to take on failure (404 | original | report | throw). + * "404" or "throw" is recommended for development and "original" is recommended for production. + * Default: 'original'. + * - 'fail-when-fail-fails' => (string) Action to take if fail action also fails. Default: '404'. + * - All options supported by WebPConvert::convert() + * - All options supported by ServeFile::serve() + * - All options supported by DecideWhatToServe::decide) + * @param \WebPConvert\Loggers\BaseLogger $serveLogger (optional) + * @param \WebPConvert\Loggers\BaseLogger $convertLogger (optional) + * @param string $serveClass (optional) Full class name to a class that has a serve() method and a + * serveOriginal() method + * @return void + */ + public static function serve( + $source, + $destination, + $options = [], + $serveLogger = null, + $convertLogger = null, + $serveClass = '\\WebPConvert\\Serve\\ServeConvertedWebP' + ) { + + $options = self::processOptions($options); + try { + InputValidator::checkSourceAndDestination($source, $destination); + //ServeConvertedWebP::serve($source, $destination, $options, $serveLogger); + call_user_func($serveClass . '::serve', $source, $destination, $options, $serveLogger, $convertLogger); + } catch (\Exception $e) { + if ($e instanceof \WebPConvert\Exceptions\WebPConvertException) { + Header::addLogHeader($e->getShortMessage(), $serveLogger); + } + + self::performFailAction( + $options['fail'], + $options['fail-when-fail-fails'], + $source, + $destination, + $options, + $e, + $serveClass + ); + } + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/Serve/ServeFile.php b/is_themecore/vendor/rosell-dk/webp-convert/src/Serve/ServeFile.php new file mode 100644 index 0000000..726087c --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/Serve/ServeFile.php @@ -0,0 +1,133 @@ + + * @since Class available since Release 2.0.0 + */ +class ServeFile +{ + + /** + * Process options. + * + * @throws \WebPConvert\Options\Exceptions\InvalidOptionTypeException If the type of an option is invalid + * @throws \WebPConvert\Options\Exceptions\InvalidOptionValueException If the value of an option is invalid + * @param array $options + */ + private static function processOptions($options) + { + $options2 = new Options(); + $options2->addOptions( + new ArrayOption('headers', []), + new StringOption('cache-control-header', 'public, max-age=31536000') + ); + foreach ($options as $optionId => $optionValue) { + $options2->setOrCreateOption($optionId, $optionValue); + } + $options2->check(); + $options = $options2->getOptions(); + + // headers option + // -------------- + + $headerOptions = new Options(); + $headerOptions->addOptions( + new BooleanOption('cache-control', false), + new BooleanOption('content-length', true), + new BooleanOption('content-type', true), + new BooleanOption('expires', false), + new BooleanOption('last-modified', true), + new BooleanOption('vary-accept', false) + ); + foreach ($options['headers'] as $optionId => $optionValue) { + $headerOptions->setOrCreateOption($optionId, $optionValue); + } + $options['headers'] = $headerOptions->getOptions(); + return $options; + } + + /** + * Serve existing file. + * + * @param string $filename File to serve (absolute path) + * @param string $contentType Content-type (used to set header). + * Only used when the "set-content-type-header" option is set. + * Set to ie "image/jpeg" for serving jpeg file. + * @param array $options Array of named options (optional). + * Supported options: + * 'add-vary-accept-header' => (boolean) Whether to add *Vary: Accept* header or not. Default: true. + * 'set-content-type-header' => (boolean) Whether to set *Content-Type* header or not. Default: true. + * 'set-last-modified-header' => (boolean) Whether to set *Last-Modified* header or not. Default: true. + * 'set-cache-control-header' => (boolean) Whether to set *Cache-Control* header or not. Default: true. + * 'cache-control-header' => string Cache control header. Default: "public, max-age=86400" + * + * @throws ServeFailedException if serving failed + * @return void + */ + public static function serve($filename, $contentType, $options = []) + { + // Check mimetype - this also checks that path is secure and file exists + InputValidator::checkMimeType($filename, [ + 'image/jpeg', + 'image/png', + 'image/webp', + 'image/gif' + ]); + + /* + if (!file_exists($filename)) { + Header::addHeader('X-WebP-Convert-Error: Could not read file'); + throw new ServeFailedException('Could not read file'); + }*/ + + $options = self::processOptions($options); + + if ($options['headers']['last-modified']) { + Header::setHeader("Last-Modified: " . gmdate("D, d M Y H:i:s", @filemtime($filename)) . " GMT"); + } + + if ($options['headers']['content-type']) { + Header::setHeader('Content-Type: ' . $contentType); + } + + if ($options['headers']['vary-accept']) { + Header::addHeader('Vary: Accept'); + } + + if (!empty($options['cache-control-header'])) { + if ($options['headers']['cache-control']) { + Header::setHeader('Cache-Control: ' . $options['cache-control-header']); + } + if ($options['headers']['expires']) { + // Add exprires header too (#126) + // Check string for something like this: max-age:86400 + if (preg_match('#max-age\\s*=\\s*(\\d*)#', $options['cache-control-header'], $matches)) { + $seconds = $matches[1]; + Header::setHeader('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + intval($seconds))); + } + } + } + + if ($options['headers']['content-length']) { + Header::setHeader('Content-Length: ' . filesize($filename)); + } + + if (@readfile($filename) === false) { + Header::addHeader('X-WebP-Convert-Error: Could not read file'); + throw new ServeFailedException('Could not read file'); + } + } +} diff --git a/is_themecore/vendor/rosell-dk/webp-convert/src/WebPConvert.php b/is_themecore/vendor/rosell-dk/webp-convert/src/WebPConvert.php new file mode 100644 index 0000000..a65a6cf --- /dev/null +++ b/is_themecore/vendor/rosell-dk/webp-convert/src/WebPConvert.php @@ -0,0 +1,159 @@ + + * @since Class available since Release 2.0.0 + */ +class WebPConvert +{ + + /** + * Convert jpeg or png into webp + * + * Convenience method for calling Stack::convert. + * + * @param string $source The image to convert (absolute,no backslashes) + * Image must be jpeg or png. + * @param string $destination Where to store the converted file (absolute path, no backslashes). + * @param array $options (optional) Array of named options + * The options are documented here: + * https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/options.md + * @param \WebPConvert\Loggers\BaseLogger $logger (optional) + * + * @throws \WebPConvert\Convert\Exceptions\ConversionFailedException in case conversion fails + * @return void + */ + public static function convert($source, $destination, $options = [], $logger = null) + { + if (isset($options['converter'])) { + $converter = $options['converter']; + unset($options['converter']); + $c = ConverterFactory::makeConverter($converter, $source, $destination, $options, $logger); + $c->doConvert(); + } else { + Stack::convert($source, $destination, $options, $logger); + } + } + + /** + * Serve webp image, converting first if neccessary. + * + * If an image already exists, it will be served, unless it is older or larger than the source. (If it is larger, + * the original is served, if it is older, the existing webp will be deleted and a fresh conversion will be made + * and served). In case of error, the action indicated in the 'fail' option will be triggered (default is to serve + * the original). Look up the ServeConvertedWebP:serve() and the ServeConvertedWebPWithErrorHandling::serve() + * methods to learn more. + * + * @param string $source path to source file + * @param string $destination path to destination + * @param array $options (optional) options for serving/converting. The options are documented in the + * ServeConvertedWebPWithErrorHandling::serve() method + * @param \WebPConvert\Loggers\BaseLogger $serveLogger (optional) + * @param \WebPConvert\Loggers\BaseLogger $convertLogger (optional) + * @return void + */ + public static function serveConverted( + $source, + $destination, + $options = [], + $serveLogger = null, + $convertLogger = null + ) { + //return ServeExistingOrHandOver::serveConverted($source, $destination, $options); + //if (isset($options['handle-errors']) && $options['handle-errors'] === true) { + if (isset($options['fail']) && ($options['fail'] != 'throw')) { + ServeConvertedWebPWithErrorHandling::serve($source, $destination, $options, $serveLogger, $convertLogger); + } else { + ServeConvertedWebP::serve($source, $destination, $options, $serveLogger, $convertLogger); + } + } + + /** + * Get ids of all converters available in webp-convert. + * + * @return array Array of ids. + */ + public static function getConverterIds() + { + $all = Stack::getAvailableConverters(); + $all[] = 'stack'; + return $all; + } + + /** + * Get option definitions for all converters + * + * Added in order to give GUI's a way to automatically adjust their setting screens. + * + * @param bool $filterOutOptionsWithoutUI If options without UI defined should be filtered out + * + * @return array Array of options definitions - ready to be json encoded, or whatever + * @since 2.8.0 + */ + public static function getConverterOptionDefinitions($filterOutOptionsWithoutUI = true) + { + $converterIds = self::getConverterIds(); + $result = []; + + $ewww = ConverterFactory::makeConverter('ewww', '', ''); + $result['general'] = $ewww->getGeneralOptionDefinitions($filterOutOptionsWithoutUI); + + $generalOptionHash = []; + $generalOptionIds = []; + foreach ($result['general'] as &$option) { + $generalOptionIds[] = $option['id']; + $option['unsupportedBy'] = []; + $generalOptionHash[$option['id']] = &$option; + } + //$result['general'] = $generalOptionIds; + array_unshift($result['general'], OptionFactory::createOption('converter', 'string', [ + 'title' => 'Converter', + 'description' => 'Conversion method. ' . + "Cwebp and vips are best. " . + 'the *magick are nearly as good, but only recent versions supports near-lossless. ' . + 'gd is poor, as it does not support any webp options. ' . + 'For full discussion, check the guide', + 'default' => 'stack', + 'enum' => $converterIds, + 'ui' => [ + 'component' => 'select', + 'links' => [ + [ + 'Guide', + 'https://github.com/rosell-dk/webp-convert/blob/master/docs/v1.3/converting/converters.md' + ] + ], + ] + ])->getDefinition()); + + $supportedBy = []; + $uniqueOptions = []; + + foreach ($converterIds as $converterId) { + $c = ConverterFactory::makeConverter($converterId, '', ''); + foreach ($c->getUnsupportedGeneralOptions() as $optionId) { + $generalOptionHash[$optionId]['unsupportedBy'][] = $converterId; + } + $optionDefinitions = $c->getUniqueOptionDefinitions($filterOutOptionsWithoutUI); + $uniqueOptions[$converterId] = $optionDefinitions; + } + $result['unique'] = $uniqueOptions; + return $result; + } +} diff --git a/is_themecore/views/img/example.jpg b/is_themecore/views/img/example.jpg new file mode 100644 index 0000000..b603a5f Binary files /dev/null and b/is_themecore/views/img/example.jpg differ diff --git a/is_themecore/views/index.php b/is_themecore/views/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/views/index.php @@ -0,0 +1,11 @@ + + {{ icon|default('settings') }} {{ header }} + diff --git a/is_themecore/views/templates/back/components/atoms/index.php b/is_themecore/views/templates/back/components/atoms/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/views/templates/back/components/atoms/index.php @@ -0,0 +1,11 @@ + +
+ {% include '@Modules/is_themecore/views/templates/back/components/organisms/form.html.twig' with { + 'form': general_form, + 'form_id': 'settings_general_form', + 'form_action': path('is_themecore_module_settings_general_save'), + 'card_header': 'General' | trans({}, 'Modules.isthemecore.Admin'), + 'cancel_path': 'is_themecore_module_settings' + } %} +
+ +
+ {% include '@Modules/is_themecore/views/templates/back/components/organisms/form.html.twig' with { + 'form': webp_form, + 'form_id': 'settings_webp_form', + 'form_action': path('is_themecore_module_settings_webp_save'), + 'card_header': 'Webp' | trans({}, 'Modules.isthemecore.Admin'), + 'icon_header': 'image', + 'cancel_path': 'is_themecore_module_settings' + } %} +
+ +{% endblock %} diff --git a/is_themecore/views/templates/back/components/molecules/index.php b/is_themecore/views/templates/back/components/molecules/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/views/templates/back/components/molecules/index.php @@ -0,0 +1,11 @@ + + {% include '@Modules/is_themecore/views/templates/back/components/atoms/card-header.html.twig' + with { + 'header': card_header, + 'icon': icon_header|default('settings') + } + %} +
+
+ {{ form_widget(form) }} +
+
+ + + {{ form_end(form) }} +{% endblock %} diff --git a/is_themecore/views/templates/back/components/organisms/index.php b/is_themecore/views/templates/back/components/organisms/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/views/templates/back/components/organisms/index.php @@ -0,0 +1,11 @@ + + {$jsonElem nofilter} + + {/if} +{/foreach} + +{if $loadPartytown && $partytownScript && $partytownScriptUri} + + + +{/if} diff --git a/is_themecore/views/templates/hook/og-data.tpl b/is_themecore/views/templates/hook/og-data.tpl new file mode 100644 index 0000000..d452253 --- /dev/null +++ b/is_themecore/views/templates/hook/og-data.tpl @@ -0,0 +1,34 @@ + +{if !empty($page.meta.description)} + +{/if} + + + + +{if isset($product) && $page.page_name == 'product'} + + {if $product.images|count > 0} + {foreach from=$product.images item=p_img name="p_img_list"} + + {/foreach} + + + + {/if} + {if $product.show_price} + + + {if $product.has_discount} + + {/if} + {/if} + {if !empty($product_manufacturer) && $product_manufacturer->name} + + {/if} + +{elseif $page.page_name === 'category' && isset($category) && !empty($category.image.large.url)} + +{else} + +{/if} diff --git a/is_themecore/views/templates/hook/twitter-data.tpl b/is_themecore/views/templates/hook/twitter-data.tpl new file mode 100644 index 0000000..45858e3 --- /dev/null +++ b/is_themecore/views/templates/hook/twitter-data.tpl @@ -0,0 +1,25 @@ + + +{if !empty($page.meta.description)} + +{/if} + + + + +{if isset($product) && $page.page_name == 'product' && !empty($product.default_image)} + + {if !empty($page.meta.description)} + + {/if} +{elseif $page.page_name === 'category' && isset($category) && !empty($category.image.large.url)} + + {if !empty($page.meta.description)} + + {/if} +{else} + + {if !empty($page.meta.description)} + + {/if} +{/if} diff --git a/is_themecore/views/templates/index.php b/is_themecore/views/templates/index.php new file mode 100644 index 0000000..88355f6 --- /dev/null +++ b/is_themecore/views/templates/index.php @@ -0,0 +1,11 @@ +setDestinationFile($_GET['source']); +$webpGenerator->setQuality((int) Configuration::get(WebpConfiguration::THEMECORE_WEBP_QUALITY)); +$webpGenerator->setConverter(Configuration::get(WebpConfiguration::THEMECORE_WEBP_CONVERTER)); +$webpGenerator->setSharpYuv((bool) Configuration::get(WebpConfiguration::THEMECORE_WEBP_SHARPYUV)); +$webpGenerator->convertAndServe(); +exit;