v1.0.0
This commit is contained in:
parent
0fcf42b47b
commit
443dceb8ca
4830 changed files with 566609 additions and 230 deletions
892
LICENSE
892
LICENSE
|
|
@ -1,232 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
“This License” refers to version 3 of the GNU General Public License.
|
||||
|
||||
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
|
||||
|
||||
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
|
||||
|
||||
A “covered work” means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
|
||||
|
||||
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
|
||||
|
||||
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
|
||||
|
||||
robotstxt-documentation-markdown
|
||||
Copyright (C) 2026 ROBOTSTXT
|
||||
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
robotstxt-documentation-markdown Copyright (C) 2026 ROBOTSTXT
|
||||
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.
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
|
||||
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 <https://www.gnu.org/licenses/>.
|
||||
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
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
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
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
|
|
|||
281
README.md
281
README.md
|
|
@ -1,2 +1,281 @@
|
|||
# robotstxt-documentation-markdown
|
||||
# Documentation Markdown (by ROBOTSTXT)
|
||||
|
||||
Synchronize Markdown documentation from GitHub repositories to WordPress pages and posts automatically.
|
||||
|
||||
## Description
|
||||
|
||||
**Documentation Markdown** is a WordPress plugin that enables seamless synchronization of Markdown documentation files from GitHub repositories into your WordPress site. Perfect for maintaining technical documentation, API references, knowledge bases, and more.
|
||||
|
||||
## Features
|
||||
|
||||
- 🔄 **Automatic Synchronization** - Schedule automatic syncs via WordPress Cron
|
||||
- 📝 **Markdown to HTML** - Convert GitHub Flavored Markdown to clean HTML
|
||||
- 🎯 **Flexible Mapping** - Map individual MD files to specific WordPress posts/pages
|
||||
- 🔍 **Smart Change Detection** - Only sync when content actually changes (using SHA comparison)
|
||||
- 🔐 **Secure** - Encrypted GitHub token storage, full input validation & output escaping
|
||||
- 🌍 **Translatable** - Full internationalization support (i18n/l10n ready)
|
||||
- 📚 **Multi-Repository** - Sync from multiple GitHub repos simultaneously
|
||||
- ⚡ **Manual Sync** - On-demand synchronization from admin interface
|
||||
|
||||
## Requirements
|
||||
|
||||
- **PHP:** 8.2 or higher
|
||||
- **WordPress:** 6.5 or higher
|
||||
- **GitHub Account:** For repository access (public or private)
|
||||
|
||||
## Installation
|
||||
|
||||
### Manual Installation
|
||||
|
||||
1. Download the plugin or clone this repository
|
||||
2. Upload to `/wp-content/plugins/robotstxt-documentation-markdown/`
|
||||
3. Run `composer install --no-dev` in the plugin directory
|
||||
4. Activate the plugin through the 'Plugins' menu in WordPress
|
||||
5. Navigate to 'GitHub Docs' in the WordPress admin menu
|
||||
6. Configure your GitHub Personal Access Token
|
||||
7. Create your first mapping
|
||||
|
||||
### Via Composer (Development)
|
||||
|
||||
```bash
|
||||
cd wp-content/plugins
|
||||
git clone https://git.robotstxt.es/ROBOTSTXT/robotstxt-documentation-markdown.git robotstxt-documentation-markdown
|
||||
cd robotstxt-documentation-markdown
|
||||
composer install
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### 1. GitHub Personal Access Token
|
||||
|
||||
Generate a Personal Access Token from GitHub:
|
||||
- Go to GitHub → Settings → Developer settings → Personal access tokens
|
||||
- Click "Generate new token"
|
||||
- For public repositories: No specific scopes needed
|
||||
- For private repositories: Select `repo` scope
|
||||
- Copy the token (you won't see it again!)
|
||||
|
||||
### 2. Plugin Configuration
|
||||
|
||||
1. In WordPress admin, go to **GitHub Docs → Settings**
|
||||
2. Paste your GitHub token
|
||||
3. Configure sync frequency (hourly, twice daily, daily)
|
||||
4. Save settings
|
||||
|
||||
### 3. Create a Mapping
|
||||
|
||||
1. Go to **GitHub Docs → Mappings**
|
||||
2. Click "Add New Mapping"
|
||||
3. Fill in:
|
||||
- **Repository Owner:** GitHub username or organization
|
||||
- **Repository Name:** Repository name
|
||||
- **File Path:** Path to `.md` file (e.g., `docs/api/auth.md`)
|
||||
- **Branch:** Branch to sync from (default: `main`)
|
||||
- **Target Post Type:** Where to create content (page/post)
|
||||
- **Author:** WordPress user who will be the post author
|
||||
4. Save mapping
|
||||
5. Click "Sync Now" to perform first synchronization
|
||||
|
||||
## Usage Examples
|
||||
|
||||
### Example 1: API Documentation
|
||||
|
||||
Sync your API documentation from GitHub to WordPress pages:
|
||||
|
||||
```
|
||||
Repository: yourcompany/api-docs
|
||||
File Path: docs/authentication.md
|
||||
Branch: main
|
||||
Target: Page
|
||||
```
|
||||
|
||||
Every time `authentication.md` is updated in GitHub, the corresponding WordPress page will automatically update.
|
||||
|
||||
### Example 2: Blog Posts
|
||||
|
||||
Write blog posts in Markdown using Git workflow:
|
||||
|
||||
```
|
||||
Repository: yourblog/content
|
||||
File Path: posts/2026-01-intro-to-api.md
|
||||
Branch: main
|
||||
Target: Post
|
||||
```
|
||||
|
||||
Commit your Markdown post to GitHub, and it automatically publishes to your WordPress blog.
|
||||
|
||||
### Example 3: Knowledge Base
|
||||
|
||||
Maintain a knowledge base with version control:
|
||||
|
||||
```
|
||||
Repository: support/knowledge-base
|
||||
File Path: articles/how-to-install.md
|
||||
Branch: production
|
||||
Target: Page
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Setup Development Environment
|
||||
|
||||
```bash
|
||||
# Clone repository
|
||||
git clone https://git.robotstxt.es/ROBOTSTXT/robotstxt-documentation-markdown.git
|
||||
cd documentation-markdown
|
||||
|
||||
# Install dependencies
|
||||
composer install
|
||||
|
||||
# Run code quality checks
|
||||
composer phpcs # Check coding standards
|
||||
composer phpcbf # Auto-fix coding standards
|
||||
composer phpstan # Static analysis
|
||||
composer test # Run tests
|
||||
```
|
||||
|
||||
### Coding Standards
|
||||
|
||||
This plugin strictly follows:
|
||||
- **WordPress Coding Standards (WPCS)**
|
||||
- **PHP 8.2+ features** (readonly properties, constructor promotion, match expressions)
|
||||
- **Complete PHPDoc** documentation for all code
|
||||
- **PSR-4 autoloading**
|
||||
|
||||
All code must pass:
|
||||
```bash
|
||||
composer lint # Runs both PHPCS and PHPStan
|
||||
```
|
||||
|
||||
### Documentation
|
||||
|
||||
Complete technical documentation available in `/docs/`:
|
||||
- **00-REQUIREMENTS-SUMMARY.md** - Start here! All critical requirements
|
||||
- **01-project-overview.md** - Plugin overview and use cases
|
||||
- **02-architecture.md** - System architecture and components
|
||||
- **03-data-structure.md** - Database schema and data models
|
||||
- **04-development-phases.md** - Development roadmap
|
||||
- **05-technical-specifications.md** - Technical details and APIs
|
||||
- **06-synchronization-flow.md** - How synchronization works
|
||||
- **07-security-considerations.md** - Security best practices
|
||||
- **08-implementation-order.md** - Step-by-step implementation guide
|
||||
|
||||
### Running Tests
|
||||
|
||||
```bash
|
||||
# Unit tests
|
||||
composer test
|
||||
|
||||
# Specific test
|
||||
vendor/bin/phpunit tests/test-github-api-client.php
|
||||
|
||||
# With coverage
|
||||
composer test -- --coverage-html coverage/
|
||||
```
|
||||
|
||||
## Security
|
||||
|
||||
### Reporting Vulnerabilities
|
||||
|
||||
Please report security vulnerabilities privately to: **robotstxt@robotstxt.es**
|
||||
|
||||
Do NOT create public issues for security vulnerabilities.
|
||||
|
||||
### Security Features
|
||||
|
||||
- ✅ GitHub tokens encrypted at rest (AES-256-CBC)
|
||||
- ✅ All user input sanitized
|
||||
- ✅ All output escaped
|
||||
- ✅ Nonce verification on all forms
|
||||
- ✅ Capability checks for all admin actions
|
||||
- ✅ Prepared statements for database queries
|
||||
- ✅ Rate limiting for GitHub API
|
||||
|
||||
## Translation
|
||||
|
||||
The plugin is fully translatable and uses the text domain: `robotstxt-documentation-markdown`
|
||||
|
||||
To translate:
|
||||
1. Use [Poedit](https://poedit.net/) or similar tool
|
||||
2. Open `/languages/robotstxt-documentation-markdown.pot`
|
||||
3. Create translations
|
||||
4. Save as `robotstxt-documentation-markdown-{locale}.mo`
|
||||
5. Place in `/wp-content/languages/plugins/`
|
||||
|
||||
## Changelog
|
||||
|
||||
See [CHANGELOG.md](CHANGELOG.md) for detailed version history.
|
||||
|
||||
### Version 1.0.0 (2026-01-26)
|
||||
- ✨ Initial stable release
|
||||
- 🔄 GitHub repository synchronization
|
||||
- 📝 Markdown to HTML conversion using CommonMark
|
||||
- 🎯 Flexible file-to-content mapping
|
||||
- ⚡ Manual and scheduled synchronization
|
||||
- 🎨 Complete admin interface
|
||||
- 🐛 Built-in debug tools (WP_DEBUG mode)
|
||||
- 🔐 Encrypted token storage
|
||||
- 🌍 Full internationalization support
|
||||
- 🛡️ Security best practices implemented
|
||||
|
||||
## Roadmap
|
||||
|
||||
Future enhancements under consideration:
|
||||
- [ ] Bidirectional sync (WordPress → GitHub)
|
||||
- [ ] Image synchronization from GitHub
|
||||
- [ ] Folder-level mapping (sync entire directory)
|
||||
- [ ] GitHub webhooks support (instant sync on push)
|
||||
- [ ] Gutenberg block for embedded docs
|
||||
- [ ] Multi-branch support per mapping
|
||||
- [ ] Conflict resolution UI
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome contributions! Please follow these guidelines:
|
||||
|
||||
1. Fork the repository
|
||||
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
||||
3. Follow WordPress Coding Standards (run `composer phpcs`)
|
||||
4. Write PHPDoc for all functions
|
||||
5. Include unit tests for new functionality
|
||||
6. Ensure all tests pass (`composer test`)
|
||||
7. Commit with conventional commit messages
|
||||
8. Push to your fork
|
||||
9. Open a Pull Request
|
||||
|
||||
All contributions must:
|
||||
- Be in English
|
||||
- Include complete PHPDoc
|
||||
- Pass PHPCS and PHPStan
|
||||
- Include appropriate unit tests
|
||||
|
||||
## License
|
||||
|
||||
This plugin is licensed under the GNU General Public License v3.0 or later.
|
||||
|
||||
See [LICENSE](LICENSE) file for details.
|
||||
|
||||
## Credits
|
||||
|
||||
**Developed by:** ROBOTSTXT
|
||||
|
||||
**Dependencies:**
|
||||
- [league/commonmark](https://commonmark.thephpleague.com/) - Markdown parser
|
||||
- [WordPress Coding Standards](https://github.com/WordPress/WordPress-Coding-Standards)
|
||||
|
||||
## Support
|
||||
|
||||
- **Documentation:** See `/docs/` directory
|
||||
- **Issues:** [Gitea Issues](https://git.robotstxt.es/ROBOTSTXT/robotstxt-documentation-markdown/issues)
|
||||
- **Discussions:** [Gitea Discussions](https://git.robotstxt.es/ROBOTSTXT/robotstxt-documentation-markdown/discussions)
|
||||
- **Website:** [ROBOTSTXT.es](https://www.robotstxt.es/)
|
||||
- **Security:** robotstxt@robotstxt.es
|
||||
|
||||
---
|
||||
|
||||
**Status:** Stable Release
|
||||
**Version:** 1.0.0
|
||||
**Requires PHP:** 8.2+
|
||||
**Requires WordPress:** 6.5+ (single-site only)
|
||||
**License:** GPL-3.0-or-later
|
||||
**Text Domain:** robotstxt-documentation-markdown
|
||||
|
|
|
|||
263
assets/css/admin.css
Normal file
263
assets/css/admin.css
Normal file
|
|
@ -0,0 +1,263 @@
|
|||
/**
|
||||
* Admin Styles for Documentation Markdown Plugin
|
||||
*
|
||||
* @package RobotsTxt\DocumentationMarkdown
|
||||
* @author ROBOTSTXT
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
.robotstxt-docmd-settings {
|
||||
max-width: 900px;
|
||||
}
|
||||
|
||||
.robotstxt-docmd-intro {
|
||||
background: #fff;
|
||||
border-left: 4px solid #2271b1;
|
||||
padding: 15px 20px;
|
||||
margin: 20px 0;
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.robotstxt-docmd-intro p.description {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.robotstxt-docmd-info {
|
||||
background: #f6f7f7;
|
||||
border: 1px solid #c3c4c7;
|
||||
padding: 20px;
|
||||
margin-top: 30px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.robotstxt-docmd-info h2 {
|
||||
margin-top: 0;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.robotstxt-docmd-info p {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.form-table th {
|
||||
padding: 20px 10px 20px 0;
|
||||
}
|
||||
|
||||
.form-table td {
|
||||
padding: 20px 10px;
|
||||
}
|
||||
|
||||
.form-table input[type="url"],
|
||||
.form-table input[type="password"] {
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
}
|
||||
|
||||
.form-table .description {
|
||||
color: #646970;
|
||||
font-style: normal;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.form-table .notice.inline {
|
||||
margin-left: 0;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.form-table .notice.inline ol {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.form-table .notice.inline ol li {
|
||||
margin-bottom: 8px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.form-table .notice.inline em {
|
||||
color: #646970;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* Mappings Page */
|
||||
.robotstxt-docmd-mappings,
|
||||
.robotstxt-docmd-edit-mapping {
|
||||
max-width: 1200px;
|
||||
}
|
||||
|
||||
/* Statistics Dashboard */
|
||||
.robotstxt-docmd-stats {
|
||||
background: #fff;
|
||||
border: 1px solid #c3c4c7;
|
||||
padding: 20px;
|
||||
margin: 20px 0;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 15px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.stat-box {
|
||||
background: #f6f7f7;
|
||||
padding: 15px 20px;
|
||||
border-radius: 4px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
color: #646970;
|
||||
margin-bottom: 8px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
display: block;
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
color: #1d2327;
|
||||
}
|
||||
|
||||
.bulk-actions {
|
||||
border-top: 1px solid #c3c4c7;
|
||||
padding-top: 15px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Empty State */
|
||||
.robotstxt-docmd-empty {
|
||||
background: #fff;
|
||||
border: 1px dashed #c3c4c7;
|
||||
padding: 40px 20px;
|
||||
margin: 20px 0;
|
||||
text-align: center;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.robotstxt-docmd-empty p {
|
||||
font-size: 16px;
|
||||
color: #646970;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Mappings Table */
|
||||
.robotstxt-docmd-mappings table {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.robotstxt-docmd-mappings table th,
|
||||
.robotstxt-docmd-mappings table td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.robotstxt-docmd-mappings table td code {
|
||||
background: #f6f7f7;
|
||||
padding: 2px 6px;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.robotstxt-docmd-mappings table td small {
|
||||
display: block;
|
||||
color: #646970;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
/* Status Badges */
|
||||
.status-badge {
|
||||
display: inline-block;
|
||||
padding: 4px 10px;
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.status-badge.status-enabled {
|
||||
background: #d7f0db;
|
||||
color: #1e4620;
|
||||
}
|
||||
|
||||
.status-badge.status-disabled {
|
||||
background: #f0f0f1;
|
||||
color: #646970;
|
||||
}
|
||||
|
||||
.status-badge.status-never {
|
||||
background: #f0f0f1;
|
||||
color: #646970;
|
||||
}
|
||||
|
||||
.status-badge.status-pending {
|
||||
background: #fcf9e8;
|
||||
color: #8a6d3b;
|
||||
}
|
||||
|
||||
.status-badge.status-success {
|
||||
background: #d7f0db;
|
||||
color: #1e4620;
|
||||
}
|
||||
|
||||
.status-badge.status-error {
|
||||
background: #f8d7da;
|
||||
color: #721c24;
|
||||
}
|
||||
|
||||
.error-message {
|
||||
color: #d63638;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
/* Action Buttons */
|
||||
.robotstxt-docmd-mappings .button {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.robotstxt-docmd-mappings .button:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.sync-mapping-btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* Edit Mapping Form */
|
||||
.robotstxt-docmd-edit-mapping .form-table input[type="text"],
|
||||
.robotstxt-docmd-edit-mapping .form-table select {
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
}
|
||||
|
||||
.robotstxt-docmd-edit-mapping .required {
|
||||
color: #d63638;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media screen and (max-width: 782px) {
|
||||
.stats-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.bulk-actions {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.robotstxt-docmd-mappings .button {
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin-bottom: 4px;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
155
assets/js/admin.js
Normal file
155
assets/js/admin.js
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
/**
|
||||
* Admin JavaScript
|
||||
*
|
||||
* Handles AJAX functionality for documentation mappings.
|
||||
*
|
||||
* @package RobotsTxt\DocumentationMarkdown
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Sync a single mapping via AJAX
|
||||
*/
|
||||
function syncMapping(mappingId, button) {
|
||||
const $button = $(button);
|
||||
const originalText = $button.text();
|
||||
|
||||
// Disable button and show loading state
|
||||
$button.prop('disabled', true).text(robotstxtDocMd.strings.syncing);
|
||||
|
||||
$.ajax({
|
||||
url: robotstxtDocMd.ajaxUrl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'robotstxt_docmd_sync_mapping',
|
||||
nonce: robotstxtDocMd.nonce,
|
||||
mapping_id: mappingId
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
// Update sync status badge
|
||||
const $row = $button.closest('tr');
|
||||
const $statusCell = $row.find('td').eq(4); // Sync Status column
|
||||
$statusCell.html(response.data.sync_status);
|
||||
|
||||
// Update last sync time
|
||||
const $lastSyncCell = $row.find('td').eq(5); // Last Sync column
|
||||
if (response.data.mapping.last_sync) {
|
||||
$lastSyncCell.text(response.data.mapping.last_sync);
|
||||
}
|
||||
|
||||
// Show success message
|
||||
showNotice(response.data.message, 'success');
|
||||
} else {
|
||||
showNotice(robotstxtDocMd.strings.syncError + ' ' + response.data.message, 'error');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
showNotice(robotstxtDocMd.strings.syncError + ' ' + error, 'error');
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable button
|
||||
$button.prop('disabled', false).text(originalText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync all active mappings via AJAX
|
||||
*/
|
||||
function syncAllMappings() {
|
||||
const $button = $('#sync-all-mappings');
|
||||
const originalText = $button.text();
|
||||
|
||||
// Disable button and show loading state
|
||||
$button.prop('disabled', true).text(robotstxtDocMd.strings.syncingAll);
|
||||
|
||||
$.ajax({
|
||||
url: robotstxtDocMd.ajaxUrl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'robotstxt_docmd_sync_all',
|
||||
nonce: robotstxtDocMd.nonce
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showNotice(response.data.message, 'success');
|
||||
|
||||
// Reload page to show updated statuses
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 1500);
|
||||
} else {
|
||||
showNotice(robotstxtDocMd.strings.syncError + ' ' + response.data.message, 'error');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
showNotice(robotstxtDocMd.strings.syncError + ' ' + error, 'error');
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable button
|
||||
$button.prop('disabled', false).text(originalText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Show admin notice
|
||||
*/
|
||||
function showNotice(message, type) {
|
||||
const $notice = $('<div class="notice notice-' + type + ' is-dismissible"><p>' + message + '</p></div>');
|
||||
|
||||
// Insert after the h1
|
||||
$('.wrap h1').after($notice);
|
||||
|
||||
// Make it dismissible
|
||||
$(document).trigger('wp-updates-notice-added');
|
||||
|
||||
// Auto-dismiss after 5 seconds
|
||||
setTimeout(function() {
|
||||
$notice.fadeOut(400, function() {
|
||||
$(this).remove();
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
// Document ready
|
||||
$(document).ready(function() {
|
||||
// Sync single mapping button click
|
||||
$('.sync-mapping-btn').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
const mappingId = $(this).data('mapping-id');
|
||||
syncMapping(mappingId, this);
|
||||
});
|
||||
|
||||
// Sync all mappings button click
|
||||
$('#sync-all-mappings').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
syncAllMappings();
|
||||
});
|
||||
|
||||
// Form validation
|
||||
$('form[action*="robotstxt_docmd_save_mapping"]').on('submit', function(e) {
|
||||
const title = $('#title').val().trim();
|
||||
const repoOwner = $('#repo_owner').val().trim();
|
||||
const repoName = $('#repo_name').val().trim();
|
||||
const filePath = $('#file_path').val().trim();
|
||||
|
||||
if (!title || !repoOwner || !repoName || !filePath) {
|
||||
e.preventDefault();
|
||||
showNotice('Please fill in all required fields.', 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validate file path ends with .md or .markdown
|
||||
if (!/\.(md|markdown)$/i.test(filePath)) {
|
||||
e.preventDefault();
|
||||
showNotice('File path must end with .md or .markdown', 'error');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
55
composer.json
Normal file
55
composer.json
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"name": "robotstxt/documentation-markdown",
|
||||
"description": "Synchronizes Markdown documentation from GitHub repositories to WordPress pages and posts",
|
||||
"type": "wordpress-plugin",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"authors": [
|
||||
{
|
||||
"name": "ROBOTSTXT",
|
||||
"homepage": "https://www.robotstxt.es"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"league/commonmark": "^2.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
|
||||
"squizlabs/php_codesniffer": "^3.13",
|
||||
"wp-coding-standards/wpcs": "^3.3",
|
||||
"phpcompatibility/php-compatibility": "^9.3",
|
||||
"phpcompatibility/phpcompatibility-wp": "^2.1",
|
||||
"eduardovillao/wp-since": "^1.3",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phpunit/phpunit": "^10.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RobotsTxt\\DocumentationMarkdown\\": "includes/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
},
|
||||
"sort-packages": true,
|
||||
"optimize-autoloader": true
|
||||
},
|
||||
"scripts": {
|
||||
"phpcs": "phpcs",
|
||||
"phpcbf": "phpcbf",
|
||||
"phpstan": "phpstan analyse --memory-limit=512M",
|
||||
"test": "phpunit",
|
||||
"lint": [
|
||||
"@phpcs",
|
||||
"@phpstan"
|
||||
]
|
||||
},
|
||||
"scripts-descriptions": {
|
||||
"phpcs": "Run PHP_CodeSniffer to detect coding standard violations",
|
||||
"phpcbf": "Run PHP Code Beautifier to automatically fix coding standard violations",
|
||||
"phpstan": "Run PHPStan static analysis",
|
||||
"test": "Run PHPUnit tests",
|
||||
"lint": "Run all code quality checks"
|
||||
}
|
||||
}
|
||||
3027
composer.lock
generated
Normal file
3027
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
BIN
languages/robotstxt-documentation-markdown-es_ES.mo
Normal file
BIN
languages/robotstxt-documentation-markdown-es_ES.mo
Normal file
Binary file not shown.
845
languages/robotstxt-documentation-markdown-es_ES.po
Normal file
845
languages/robotstxt-documentation-markdown-es_ES.po
Normal file
|
|
@ -0,0 +1,845 @@
|
|||
# Translation of Documentation Markdown in Spanish (Spain)
|
||||
# Copyright (C) 2026 ROBOTSTXT
|
||||
# This file is distributed under the GPL-3.0-or-later.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Documentation Markdown 0.1.0\n"
|
||||
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/robotstxt-"
|
||||
"documentation-markdown\n"
|
||||
"POT-Creation-Date: 2026-01-25T18:11:49+00:00\n"
|
||||
"PO-Revision-Date: 2026-01-25 17:30+0000\n"
|
||||
"Last-Translator: ROBOTSTXT <info@robotstxt.com>\n"
|
||||
"Language-Team: Spanish (Spain)\n"
|
||||
"Language: es_ES\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: WP-CLI 2.10.0\n"
|
||||
"X-Domain: robotstxt-documentation-markdown\n"
|
||||
|
||||
#. Plugin Name of the plugin
|
||||
#: robotstxt-documentation-markdown.php
|
||||
msgid "Documentation Markdown (by ROBOTSTXT)"
|
||||
msgstr ""
|
||||
|
||||
#. Plugin URI of the plugin
|
||||
#: robotstxt-documentation-markdown.php
|
||||
msgid "https://github.com/robotstxt/documentation-markdown"
|
||||
msgstr ""
|
||||
|
||||
#. Description of the plugin
|
||||
#: robotstxt-documentation-markdown.php
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Synchronizes Markdown documentation from GitHub repositories to WordPress "
|
||||
"pages and posts automatically."
|
||||
msgstr ""
|
||||
"Este plugin sincroniza documentación en formato Markdown desde repositorios "
|
||||
"de GitHub y la convierte en páginas o entradas de WordPress automáticamente."
|
||||
|
||||
#. Author of the plugin
|
||||
#: robotstxt-documentation-markdown.php
|
||||
msgid "ROBOTSTXT"
|
||||
msgstr ""
|
||||
|
||||
#. Author URI of the plugin
|
||||
#: robotstxt-documentation-markdown.php
|
||||
msgid "https://robotstxt.com"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:52
|
||||
msgid "Manage Mappings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:53
|
||||
msgid "Mappings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:61 includes/admin/Admin_Mappings.php:173
|
||||
#: includes/admin/Admin_Mappings.php:382
|
||||
msgid "Add New Mapping"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:62 includes/admin/Admin_Mappings.php:136
|
||||
msgid "Add New"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:105 includes/admin/Admin_Mappings.php:276
|
||||
msgid "Syncing..."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:106 includes/admin/Admin_Mappings.php:653
|
||||
#, fuzzy
|
||||
msgid "Sync completed successfully!"
|
||||
msgstr "Configuración guardada correctamente."
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:107
|
||||
msgid "Sync failed:"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:108 includes/admin/Admin_Mappings.php:342
|
||||
msgid "Are you sure you want to delete this mapping?"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:109
|
||||
msgid "Syncing all mappings..."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:124 includes/admin/Admin_Mappings.php:357
|
||||
#: includes/admin/Admin_Settings.php:542
|
||||
msgid "You do not have sufficient permissions to access this page."
|
||||
msgstr "No tienes permisos suficientes para acceder a esta página."
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:133
|
||||
#, fuzzy
|
||||
msgid "Documentation Mappings"
|
||||
msgstr "Configuración de Documentación"
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:145
|
||||
msgid "Total Mappings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:149
|
||||
msgid "Active"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:153
|
||||
msgid "Last Success"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:157
|
||||
msgid "Last Error"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:164
|
||||
msgid "Sync All Active Mappings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:171
|
||||
msgid "No mappings found. Create your first mapping to get started!"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:180
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:181
|
||||
msgid "Repository"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:182
|
||||
msgid "File"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:183
|
||||
msgid "Frequency"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:184
|
||||
msgid "Status"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:185
|
||||
msgid "Sync Status"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:186
|
||||
msgid "Last Sync"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:187
|
||||
msgid "Next Sync"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:188
|
||||
msgid "Actions"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:208
|
||||
#, php-format
|
||||
msgid "Branch: %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:214 includes/admin/Admin_Mappings.php:232
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:219
|
||||
msgid "Enabled"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:221
|
||||
msgid "Disabled"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:242
|
||||
msgid "Manual Only"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:272
|
||||
msgid "Never Synced"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:280
|
||||
msgid "Success"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:284
|
||||
msgid "Error"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:337
|
||||
msgid "Sync Now"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:340
|
||||
msgid "Edit"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:343
|
||||
msgid "Delete"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:382
|
||||
msgid "Edit Mapping"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:397
|
||||
msgid "Mapping Title"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:401
|
||||
msgid "A descriptive name for this mapping."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:407
|
||||
msgid "Repository Owner"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:411
|
||||
msgid "GitHub username or organization (e.g., \"wordpress\")."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:417
|
||||
msgid "Repository Name"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:421
|
||||
msgid "Repository name (e.g., \"wordpress-develop\")."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:427
|
||||
msgid "File Path"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:431
|
||||
msgid "Path to Markdown file (e.g., \"README.md\" or \"docs/api.md\")."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:437
|
||||
msgid "Branch"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:441
|
||||
msgid "Git branch name (default: \"main\")."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:447
|
||||
msgid "Target Post Type"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:463
|
||||
msgid "WordPress post type for the synced content."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:469
|
||||
msgid "Post Author"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:481
|
||||
msgid "WordPress user to assign as post author."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:487
|
||||
msgid "Sync Frequency"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:503
|
||||
msgid "How often to automatically sync this documentation from GitHub."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:509
|
||||
msgid "Enable Sync"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:514
|
||||
msgid "Enable automatic synchronization for this mapping"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:516
|
||||
msgid "Must be enabled for automatic syncing to work."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:521
|
||||
msgid "Update Mapping"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:521
|
||||
#, fuzzy
|
||||
msgid "Create Mapping"
|
||||
msgstr "Crear un token"
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:536 includes/admin/Admin_Mappings.php:593
|
||||
#, fuzzy
|
||||
msgid "You do not have sufficient permissions."
|
||||
msgstr "No tienes permisos suficientes para acceder a esta página."
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:634 includes/admin/Admin_Mappings.php:670
|
||||
msgid "Insufficient permissions."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:640
|
||||
msgid "Invalid mapping ID."
|
||||
msgstr ""
|
||||
|
||||
#. translators: 1: Success count, 2: Error count
|
||||
#: includes/admin/Admin_Mappings.php:690
|
||||
#, php-format
|
||||
msgid "Sync complete: %1$d succeeded, %2$d failed."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:711
|
||||
#, fuzzy
|
||||
msgid "Mapping created successfully."
|
||||
msgstr "Configuración guardada correctamente."
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:712
|
||||
#, fuzzy
|
||||
msgid "Mapping updated successfully."
|
||||
msgstr "Configuración guardada correctamente."
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:713
|
||||
#, fuzzy
|
||||
msgid "Mapping deleted successfully."
|
||||
msgstr "Configuración guardada correctamente."
|
||||
|
||||
#: includes/admin/Admin_Settings.php:45
|
||||
msgid "Documentation Settings"
|
||||
msgstr "Configuración de Documentación"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:46
|
||||
msgid "Documentation"
|
||||
msgstr "Documentación"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:78
|
||||
msgid "GitHub Repository Settings"
|
||||
msgstr "Configuración del Repositorio de GitHub"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:85
|
||||
msgid "GitHub Documentation URL"
|
||||
msgstr "URL de Documentación en GitHub"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:93
|
||||
msgid "GitHub Personal Access Token"
|
||||
msgstr "Token de Acceso Personal de GitHub"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:102
|
||||
#, fuzzy
|
||||
msgid "Advanced Settings"
|
||||
msgstr "Guardar Configuración"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:109
|
||||
msgid "Delete Data on Uninstall"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:118
|
||||
msgid "Email Notifications"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:125
|
||||
msgid "Enable Notifications"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:133
|
||||
msgid "Notification Email"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:141
|
||||
msgid "Notify on Success"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:149
|
||||
msgid "Notify Unsynchronized"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:181
|
||||
msgid "GitHub URL must use HTTPS protocol for security. URL was not saved."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:210
|
||||
msgid "Warning: Token could not be encrypted. It has been saved in plain text."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:251
|
||||
msgid ""
|
||||
"Configure your GitHub repository settings to synchronize documentation from "
|
||||
"GitHub to WordPress."
|
||||
msgstr ""
|
||||
"Configura los ajustes de tu repositorio de GitHub para sincronizar la "
|
||||
"documentación desde GitHub a WordPress."
|
||||
|
||||
#: includes/admin/Admin_Settings.php:267
|
||||
msgid "Advanced configuration options for plugin behavior."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:295
|
||||
msgid ""
|
||||
"Enter the full URL of your GitHub repository (e.g., https://github.com/owner/"
|
||||
"repository)"
|
||||
msgstr ""
|
||||
"Introduce la URL completa de tu repositorio de GitHub (ej: https://github."
|
||||
"com/propietario/repositorio)"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:322
|
||||
msgid "ghp_xxxxxxxxxxxx"
|
||||
msgstr "ghp_xxxxxxxxxxxx"
|
||||
|
||||
#. translators: %s: Link to GitHub Personal Access Tokens page
|
||||
#: includes/admin/Admin_Settings.php:328
|
||||
#, php-format
|
||||
msgid "Enter your GitHub Personal Access Token. %s"
|
||||
msgstr "Introduce tu Token de Acceso Personal de GitHub. %s"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:333
|
||||
msgid "Create a token"
|
||||
msgstr "Crear un token"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:340
|
||||
msgid "How to create a GitHub Personal Access Token:"
|
||||
msgstr "Cómo crear un Token de Acceso Personal de GitHub:"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:343
|
||||
msgid "Go to GitHub → Settings → Developer settings → Personal access tokens"
|
||||
msgstr ""
|
||||
"Ve a GitHub → Configuración → Ajustes de desarrollador → Tokens de acceso "
|
||||
"personal"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:344
|
||||
msgid "Click \"Generate new token\" (classic)"
|
||||
msgstr "Haz clic en \"Generar nuevo token\" (clásico)"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:345
|
||||
msgid "Give it a descriptive name (e.g., \"WordPress Documentation Sync\")"
|
||||
msgstr ""
|
||||
"Dale un nombre descriptivo (ej: \"Sincronización Documentación WordPress\")"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:348
|
||||
msgid "For public repositories: No specific scopes needed"
|
||||
msgstr "Para repositorios públicos: No se necesitan permisos específicos"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:355
|
||||
msgid "For private repositories: Select the \"repo\" scope"
|
||||
msgstr "Para repositorios privados: Selecciona el permiso \"repo\""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:361
|
||||
msgid "Click \"Generate token\" and copy it immediately"
|
||||
msgstr "Haz clic en \"Generar token\" y cópialo inmediatamente"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:362
|
||||
msgid "Paste the token in the field above and save"
|
||||
msgstr "Pega el token en el campo de arriba y guarda"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:367
|
||||
msgid ""
|
||||
"Note: For security, your token is stored encrypted and will be shown as dots "
|
||||
"once saved."
|
||||
msgstr ""
|
||||
"Nota: Por seguridad, tu token se almacena cifrado y se mostrará como puntos "
|
||||
"una vez guardado."
|
||||
|
||||
#: includes/admin/Admin_Settings.php:397
|
||||
msgid "Delete all plugin data when uninstalling"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:401
|
||||
msgid ""
|
||||
"If enabled, all plugin settings and mapping configurations will be deleted "
|
||||
"when you uninstall the plugin."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:409
|
||||
msgid "Important:"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:411
|
||||
msgid ""
|
||||
"Your synced documentation content (pages/posts) will NOT be deleted, only "
|
||||
"the mapping configurations and plugin settings."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:419
|
||||
msgid ""
|
||||
"This ensures your documentation remains available even after uninstalling "
|
||||
"the plugin."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:438
|
||||
msgid "Configure email notifications for sync events."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:458
|
||||
msgid "Send email notifications for sync errors"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:461
|
||||
msgid ""
|
||||
"You will receive an email when a sync operation fails (rate limited to once "
|
||||
"per hour per mapping)."
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Default admin email
|
||||
#: includes/admin/Admin_Settings.php:482
|
||||
#, php-format
|
||||
msgid "Email address for notifications (default: %s)."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:503
|
||||
msgid "Send email notifications for successful syncs"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:506
|
||||
msgid ""
|
||||
"Receive an email confirmation when content is successfully synchronized (not "
|
||||
"recommended for frequent syncs)."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:524
|
||||
msgid "Notify when mappings have not been synchronized"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:527
|
||||
msgid ""
|
||||
"Receive alerts when enabled mappings with auto-sync have never been "
|
||||
"synchronized (rate limited to once per hour)."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:550
|
||||
msgid "Settings saved successfully."
|
||||
msgstr "Configuración guardada correctamente."
|
||||
|
||||
#: includes/admin/Admin_Settings.php:563
|
||||
msgid ""
|
||||
"Documentation Markdown allows you to automatically synchronize Markdown "
|
||||
"documentation from GitHub repositories to your WordPress site."
|
||||
msgstr ""
|
||||
"Documentation Markdown te permite sincronizar automáticamente documentación "
|
||||
"en formato Markdown desde repositorios de GitHub a tu sitio WordPress."
|
||||
|
||||
#: includes/admin/Admin_Settings.php:575
|
||||
msgid "Save Settings"
|
||||
msgstr "Guardar Configuración"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:580
|
||||
msgid "About This Plugin"
|
||||
msgstr "Acerca de este Plugin"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:583
|
||||
msgid ""
|
||||
"This plugin synchronizes Markdown documentation from GitHub repositories and "
|
||||
"converts it into WordPress pages or posts automatically."
|
||||
msgstr ""
|
||||
"Este plugin sincroniza documentación en formato Markdown desde repositorios "
|
||||
"de GitHub y la convierte en páginas o entradas de WordPress automáticamente."
|
||||
|
||||
#: includes/admin/Admin_Settings.php:590
|
||||
msgid "Version:"
|
||||
msgstr "Versión:"
|
||||
|
||||
#: includes/admin/Admin_Settings.php:594
|
||||
msgid "Developer:"
|
||||
msgstr "Desarrollador:"
|
||||
|
||||
#: includes/Cron_Manager.php:43
|
||||
msgid "Never (Manual Only)"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:47
|
||||
msgid "Every 1 Minute"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:51
|
||||
msgid "Every 5 Minutes"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:55
|
||||
msgid "Every 10 Minutes"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:59
|
||||
msgid "Every 15 Minutes"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:63
|
||||
msgid "Every 30 Minutes"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:67
|
||||
msgid "Every 1 Hour"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:71
|
||||
msgid "Every 2 Hours"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:75
|
||||
msgid "Every 4 Hours"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:79
|
||||
msgid "Every 6 Hours"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:83
|
||||
msgid "Every 12 Hours"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:87
|
||||
msgid "Once Daily"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:238 includes/Cron_Manager.php:247
|
||||
msgid "Now"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Mapping title
|
||||
#: includes/Cron_Manager.php:286
|
||||
#, fuzzy, php-format
|
||||
msgid "[Documentation Sync] Error: %s"
|
||||
msgstr "Configuración de Documentación"
|
||||
|
||||
#. translators: %s: Mapping title
|
||||
#: includes/Cron_Manager.php:332
|
||||
#, fuzzy, php-format
|
||||
msgid "[Documentation Sync] Success: %s"
|
||||
msgstr "Configuración de Documentación"
|
||||
|
||||
#: includes/Cron_Manager.php:397
|
||||
msgid "[Documentation Sync] Unsynchronized Files Found"
|
||||
msgstr ""
|
||||
|
||||
#. translators: 1: Mapping title, 2: Error message
|
||||
#: includes/Cron_Manager.php:491
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Failed to sync documentation: %1$s\n"
|
||||
"\n"
|
||||
"Error: %2$s\n"
|
||||
"\n"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:496 includes/Cron_Manager.php:538
|
||||
#, fuzzy
|
||||
msgid "Repository Details:\n"
|
||||
msgstr "Configuración del Repositorio de GitHub"
|
||||
|
||||
#. translators: %s: Admin URL
|
||||
#: includes/Cron_Manager.php:504
|
||||
#, php-format
|
||||
msgid "Manage mappings: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Mapping title
|
||||
#: includes/Cron_Manager.php:522
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Successfully synchronized documentation: %s\n"
|
||||
"\n"
|
||||
msgstr ""
|
||||
|
||||
#. translators: 1: Post title, 2: Post URL
|
||||
#: includes/Cron_Manager.php:531
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Post: %1$s\n"
|
||||
"View: %2$s\n"
|
||||
"\n"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %d: Number of unsynchronized mappings
|
||||
#: includes/Cron_Manager.php:558
|
||||
#, php-format
|
||||
msgid "There is %d documentation mapping that has not been synchronized:"
|
||||
msgid_plural ""
|
||||
"There are %d documentation mappings that have not been synchronized:"
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#. translators: %s: Admin URL
|
||||
#: includes/Cron_Manager.php:579
|
||||
#, php-format
|
||||
msgid "Please review and sync these mappings: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: includes/encryption-functions.php:34
|
||||
msgid "OpenSSL extension is required for token encryption"
|
||||
msgstr ""
|
||||
|
||||
#: includes/encryption-functions.php:47 includes/encryption-functions.php:112
|
||||
msgid "Failed to determine cipher IV length"
|
||||
msgstr ""
|
||||
|
||||
#: includes/encryption-functions.php:64
|
||||
msgid "Encryption failed"
|
||||
msgstr ""
|
||||
|
||||
#: includes/encryption-functions.php:90
|
||||
msgid "OpenSSL extension is required for token decryption"
|
||||
msgstr ""
|
||||
|
||||
#: includes/encryption-functions.php:99
|
||||
msgid "Invalid encrypted data format"
|
||||
msgstr ""
|
||||
|
||||
#: includes/encryption-functions.php:130
|
||||
msgid "Decryption failed"
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:81
|
||||
msgid "Invalid response from GitHub API: missing required fields"
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:91
|
||||
msgid "Failed to decode file content from GitHub"
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:132
|
||||
msgid "SHA not found in GitHub API response"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Error message
|
||||
#: includes/GitHub_API_Client.php:213
|
||||
#, php-format
|
||||
msgid "GitHub API request failed: %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:230
|
||||
msgid "Unknown error"
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:234
|
||||
msgid "Authentication failed. Please check your GitHub token."
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:235
|
||||
msgid "Access forbidden. Check your token permissions or rate limit."
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:236
|
||||
msgid "File not found in repository. Please verify the file path and branch."
|
||||
msgstr ""
|
||||
|
||||
#. translators: 1: HTTP status code, 2: Error message
|
||||
#: includes/GitHub_API_Client.php:239
|
||||
#, php-format
|
||||
msgid "GitHub API error (%1$d): %2$s"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: JSON error message
|
||||
#: includes/GitHub_API_Client.php:255
|
||||
#, php-format
|
||||
msgid "Invalid JSON response from GitHub: %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:347
|
||||
msgid "unknown"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Reset time
|
||||
#: includes/GitHub_API_Client.php:352
|
||||
#, php-format
|
||||
msgid "GitHub API rate limit nearly exceeded. Resets at: %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:73 includes/mapping-functions.php:118
|
||||
msgid "Invalid mapping ID"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:124
|
||||
msgid "Failed to delete mapping"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:227
|
||||
msgid "Repository owner is required"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:233
|
||||
msgid "Invalid repository owner format"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:238
|
||||
msgid "Repository name is required"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:244
|
||||
msgid "Invalid repository name format"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:249
|
||||
msgid "File path is required"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:256
|
||||
msgid "File path cannot contain \"..\""
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:261
|
||||
msgid "File must be .md or .markdown"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:268
|
||||
msgid "Invalid branch name format"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:275
|
||||
msgid "Post type does not exist"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Plugin.php:172
|
||||
#, fuzzy
|
||||
msgid "GitHub Doc Mappings"
|
||||
msgstr "URL de Documentación en GitHub"
|
||||
|
||||
#: includes/Plugin.php:173
|
||||
#, fuzzy
|
||||
msgid "GitHub Doc Mapping"
|
||||
msgstr "URL de Documentación en GitHub"
|
||||
|
||||
#: includes/Sync_Manager.php:84 includes/Sync_Manager.php:422
|
||||
msgid "Synchronization is disabled for this mapping."
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Error message from GitHub API
|
||||
#: includes/Sync_Manager.php:259
|
||||
#, php-format
|
||||
msgid "Failed to fetch file from GitHub: %s"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Error message
|
||||
#: includes/Sync_Manager.php:441
|
||||
#, php-format
|
||||
msgid "Failed to check for changes: %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Sync_Manager.php:498
|
||||
#, fuzzy
|
||||
msgid "GitHub Personal Access Token is not configured."
|
||||
msgstr "Token de Acceso Personal de GitHub"
|
||||
|
||||
#: includes/Sync_Manager.php:504
|
||||
msgid "No active mappings configured."
|
||||
msgstr ""
|
||||
|
||||
#: includes/Sync_Manager.php:509
|
||||
msgid "OpenSSL extension is not available (required for token encryption)."
|
||||
msgstr ""
|
||||
811
languages/robotstxt-documentation-markdown.pot
Normal file
811
languages/robotstxt-documentation-markdown.pot
Normal file
|
|
@ -0,0 +1,811 @@
|
|||
# Copyright (C) 2026 ROBOTSTXT
|
||||
# This file is distributed under the GPL-3.0-or-later.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Documentation Markdown (by ROBOTSTXT) 1.0.0-rc1\n"
|
||||
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/robotstxt-documentation-markdown\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2026-01-25T18:11:49+00:00\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"X-Generator: WP-CLI 2.12.0\n"
|
||||
"X-Domain: robotstxt-documentation-markdown\n"
|
||||
|
||||
#. Plugin Name of the plugin
|
||||
#: robotstxt-documentation-markdown.php
|
||||
msgid "Documentation Markdown (by ROBOTSTXT)"
|
||||
msgstr ""
|
||||
|
||||
#. Plugin URI of the plugin
|
||||
#: robotstxt-documentation-markdown.php
|
||||
msgid "https://github.com/robotstxt/documentation-markdown"
|
||||
msgstr ""
|
||||
|
||||
#. Description of the plugin
|
||||
#: robotstxt-documentation-markdown.php
|
||||
msgid "Synchronizes Markdown documentation from GitHub repositories to WordPress pages and posts automatically."
|
||||
msgstr ""
|
||||
|
||||
#. Author of the plugin
|
||||
#: robotstxt-documentation-markdown.php
|
||||
msgid "ROBOTSTXT"
|
||||
msgstr ""
|
||||
|
||||
#. Author URI of the plugin
|
||||
#: robotstxt-documentation-markdown.php
|
||||
msgid "https://robotstxt.com"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:52
|
||||
msgid "Manage Mappings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:53
|
||||
msgid "Mappings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:61
|
||||
#: includes/admin/Admin_Mappings.php:173
|
||||
#: includes/admin/Admin_Mappings.php:382
|
||||
msgid "Add New Mapping"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:62
|
||||
#: includes/admin/Admin_Mappings.php:136
|
||||
msgid "Add New"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:105
|
||||
#: includes/admin/Admin_Mappings.php:276
|
||||
msgid "Syncing..."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:106
|
||||
#: includes/admin/Admin_Mappings.php:653
|
||||
msgid "Sync completed successfully!"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:107
|
||||
msgid "Sync failed:"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:108
|
||||
#: includes/admin/Admin_Mappings.php:342
|
||||
msgid "Are you sure you want to delete this mapping?"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:109
|
||||
msgid "Syncing all mappings..."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:124
|
||||
#: includes/admin/Admin_Mappings.php:357
|
||||
#: includes/admin/Admin_Settings.php:542
|
||||
msgid "You do not have sufficient permissions to access this page."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:133
|
||||
msgid "Documentation Mappings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:145
|
||||
msgid "Total Mappings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:149
|
||||
msgid "Active"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:153
|
||||
msgid "Last Success"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:157
|
||||
msgid "Last Error"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:164
|
||||
msgid "Sync All Active Mappings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:171
|
||||
msgid "No mappings found. Create your first mapping to get started!"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:180
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:181
|
||||
msgid "Repository"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:182
|
||||
msgid "File"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:183
|
||||
msgid "Frequency"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:184
|
||||
msgid "Status"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:185
|
||||
msgid "Sync Status"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:186
|
||||
msgid "Last Sync"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:187
|
||||
msgid "Next Sync"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:188
|
||||
msgid "Actions"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:208
|
||||
#, php-format
|
||||
msgid "Branch: %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:214
|
||||
#: includes/admin/Admin_Mappings.php:232
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:219
|
||||
msgid "Enabled"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:221
|
||||
msgid "Disabled"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:242
|
||||
msgid "Manual Only"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:272
|
||||
msgid "Never Synced"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:280
|
||||
msgid "Success"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:284
|
||||
msgid "Error"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:337
|
||||
msgid "Sync Now"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:340
|
||||
msgid "Edit"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:343
|
||||
msgid "Delete"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:382
|
||||
msgid "Edit Mapping"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:397
|
||||
msgid "Mapping Title"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:401
|
||||
msgid "A descriptive name for this mapping."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:407
|
||||
msgid "Repository Owner"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:411
|
||||
msgid "GitHub username or organization (e.g., \"wordpress\")."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:417
|
||||
msgid "Repository Name"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:421
|
||||
msgid "Repository name (e.g., \"wordpress-develop\")."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:427
|
||||
msgid "File Path"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:431
|
||||
msgid "Path to Markdown file (e.g., \"README.md\" or \"docs/api.md\")."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:437
|
||||
msgid "Branch"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:441
|
||||
msgid "Git branch name (default: \"main\")."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:447
|
||||
msgid "Target Post Type"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:463
|
||||
msgid "WordPress post type for the synced content."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:469
|
||||
msgid "Post Author"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:481
|
||||
msgid "WordPress user to assign as post author."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:487
|
||||
msgid "Sync Frequency"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:503
|
||||
msgid "How often to automatically sync this documentation from GitHub."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:509
|
||||
msgid "Enable Sync"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:514
|
||||
msgid "Enable automatic synchronization for this mapping"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:516
|
||||
msgid "Must be enabled for automatic syncing to work."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:521
|
||||
msgid "Update Mapping"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:521
|
||||
msgid "Create Mapping"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:536
|
||||
#: includes/admin/Admin_Mappings.php:593
|
||||
msgid "You do not have sufficient permissions."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:634
|
||||
#: includes/admin/Admin_Mappings.php:670
|
||||
msgid "Insufficient permissions."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:640
|
||||
msgid "Invalid mapping ID."
|
||||
msgstr ""
|
||||
|
||||
#. translators: 1: Success count, 2: Error count
|
||||
#: includes/admin/Admin_Mappings.php:690
|
||||
#, php-format
|
||||
msgid "Sync complete: %1$d succeeded, %2$d failed."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:711
|
||||
msgid "Mapping created successfully."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:712
|
||||
msgid "Mapping updated successfully."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Mappings.php:713
|
||||
msgid "Mapping deleted successfully."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:45
|
||||
msgid "Documentation Settings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:46
|
||||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:78
|
||||
msgid "GitHub Repository Settings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:85
|
||||
msgid "GitHub Documentation URL"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:93
|
||||
msgid "GitHub Personal Access Token"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:102
|
||||
msgid "Advanced Settings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:109
|
||||
msgid "Delete Data on Uninstall"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:118
|
||||
msgid "Email Notifications"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:125
|
||||
msgid "Enable Notifications"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:133
|
||||
msgid "Notification Email"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:141
|
||||
msgid "Notify on Success"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:149
|
||||
msgid "Notify Unsynchronized"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:181
|
||||
msgid "GitHub URL must use HTTPS protocol for security. URL was not saved."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:210
|
||||
msgid "Warning: Token could not be encrypted. It has been saved in plain text."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:251
|
||||
msgid "Configure your GitHub repository settings to synchronize documentation from GitHub to WordPress."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:267
|
||||
msgid "Advanced configuration options for plugin behavior."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:295
|
||||
msgid "Enter the full URL of your GitHub repository (e.g., https://github.com/owner/repository)"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:322
|
||||
msgid "ghp_xxxxxxxxxxxx"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Link to GitHub Personal Access Tokens page
|
||||
#: includes/admin/Admin_Settings.php:328
|
||||
#, php-format
|
||||
msgid "Enter your GitHub Personal Access Token. %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:333
|
||||
msgid "Create a token"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:340
|
||||
msgid "How to create a GitHub Personal Access Token:"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:343
|
||||
msgid "Go to GitHub → Settings → Developer settings → Personal access tokens"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:344
|
||||
msgid "Click \"Generate new token\" (classic)"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:345
|
||||
msgid "Give it a descriptive name (e.g., \"WordPress Documentation Sync\")"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:348
|
||||
msgid "For public repositories: No specific scopes needed"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:355
|
||||
msgid "For private repositories: Select the \"repo\" scope"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:361
|
||||
msgid "Click \"Generate token\" and copy it immediately"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:362
|
||||
msgid "Paste the token in the field above and save"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:367
|
||||
msgid "Note: For security, your token is stored encrypted and will be shown as dots once saved."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:397
|
||||
msgid "Delete all plugin data when uninstalling"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:401
|
||||
msgid "If enabled, all plugin settings and mapping configurations will be deleted when you uninstall the plugin."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:409
|
||||
msgid "Important:"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:411
|
||||
msgid "Your synced documentation content (pages/posts) will NOT be deleted, only the mapping configurations and plugin settings."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:419
|
||||
msgid "This ensures your documentation remains available even after uninstalling the plugin."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:438
|
||||
msgid "Configure email notifications for sync events."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:458
|
||||
msgid "Send email notifications for sync errors"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:461
|
||||
msgid "You will receive an email when a sync operation fails (rate limited to once per hour per mapping)."
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Default admin email
|
||||
#: includes/admin/Admin_Settings.php:482
|
||||
#, php-format
|
||||
msgid "Email address for notifications (default: %s)."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:503
|
||||
msgid "Send email notifications for successful syncs"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:506
|
||||
msgid "Receive an email confirmation when content is successfully synchronized (not recommended for frequent syncs)."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:524
|
||||
msgid "Notify when mappings have not been synchronized"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:527
|
||||
msgid "Receive alerts when enabled mappings with auto-sync have never been synchronized (rate limited to once per hour)."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:550
|
||||
msgid "Settings saved successfully."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:563
|
||||
msgid "Documentation Markdown allows you to automatically synchronize Markdown documentation from GitHub repositories to your WordPress site."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:575
|
||||
msgid "Save Settings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:580
|
||||
msgid "About This Plugin"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:583
|
||||
msgid "This plugin synchronizes Markdown documentation from GitHub repositories and converts it into WordPress pages or posts automatically."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:590
|
||||
msgid "Version:"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/Admin_Settings.php:594
|
||||
msgid "Developer:"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:43
|
||||
msgid "Never (Manual Only)"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:47
|
||||
msgid "Every 1 Minute"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:51
|
||||
msgid "Every 5 Minutes"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:55
|
||||
msgid "Every 10 Minutes"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:59
|
||||
msgid "Every 15 Minutes"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:63
|
||||
msgid "Every 30 Minutes"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:67
|
||||
msgid "Every 1 Hour"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:71
|
||||
msgid "Every 2 Hours"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:75
|
||||
msgid "Every 4 Hours"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:79
|
||||
msgid "Every 6 Hours"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:83
|
||||
msgid "Every 12 Hours"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:87
|
||||
msgid "Once Daily"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:238
|
||||
#: includes/Cron_Manager.php:247
|
||||
msgid "Now"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Mapping title
|
||||
#: includes/Cron_Manager.php:286
|
||||
#, php-format
|
||||
msgid "[Documentation Sync] Error: %s"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Mapping title
|
||||
#: includes/Cron_Manager.php:332
|
||||
#, php-format
|
||||
msgid "[Documentation Sync] Success: %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:397
|
||||
msgid "[Documentation Sync] Unsynchronized Files Found"
|
||||
msgstr ""
|
||||
|
||||
#. translators: 1: Mapping title, 2: Error message
|
||||
#: includes/Cron_Manager.php:491
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Failed to sync documentation: %1$s\n"
|
||||
"\n"
|
||||
"Error: %2$s\n"
|
||||
"\n"
|
||||
""
|
||||
msgstr ""
|
||||
|
||||
#: includes/Cron_Manager.php:496
|
||||
#: includes/Cron_Manager.php:538
|
||||
msgid ""
|
||||
"Repository Details:\n"
|
||||
""
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Admin URL
|
||||
#: includes/Cron_Manager.php:504
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Manage mappings: %s\n"
|
||||
""
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Mapping title
|
||||
#: includes/Cron_Manager.php:522
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Successfully synchronized documentation: %s\n"
|
||||
"\n"
|
||||
""
|
||||
msgstr ""
|
||||
|
||||
#. translators: 1: Post title, 2: Post URL
|
||||
#: includes/Cron_Manager.php:531
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Post: %1$s\n"
|
||||
"View: %2$s\n"
|
||||
"\n"
|
||||
""
|
||||
msgstr ""
|
||||
|
||||
#. translators: %d: Number of unsynchronized mappings
|
||||
#: includes/Cron_Manager.php:558
|
||||
#, php-format
|
||||
msgid "There is %d documentation mapping that has not been synchronized:"
|
||||
msgid_plural "There are %d documentation mappings that have not been synchronized:"
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#. translators: %s: Admin URL
|
||||
#: includes/Cron_Manager.php:579
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Please review and sync these mappings: %s\n"
|
||||
""
|
||||
msgstr ""
|
||||
|
||||
#: includes/encryption-functions.php:34
|
||||
msgid "OpenSSL extension is required for token encryption"
|
||||
msgstr ""
|
||||
|
||||
#: includes/encryption-functions.php:47
|
||||
#: includes/encryption-functions.php:112
|
||||
msgid "Failed to determine cipher IV length"
|
||||
msgstr ""
|
||||
|
||||
#: includes/encryption-functions.php:64
|
||||
msgid "Encryption failed"
|
||||
msgstr ""
|
||||
|
||||
#: includes/encryption-functions.php:90
|
||||
msgid "OpenSSL extension is required for token decryption"
|
||||
msgstr ""
|
||||
|
||||
#: includes/encryption-functions.php:99
|
||||
msgid "Invalid encrypted data format"
|
||||
msgstr ""
|
||||
|
||||
#: includes/encryption-functions.php:130
|
||||
msgid "Decryption failed"
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:81
|
||||
msgid "Invalid response from GitHub API: missing required fields"
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:91
|
||||
msgid "Failed to decode file content from GitHub"
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:132
|
||||
msgid "SHA not found in GitHub API response"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Error message
|
||||
#: includes/GitHub_API_Client.php:213
|
||||
#, php-format
|
||||
msgid "GitHub API request failed: %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:230
|
||||
msgid "Unknown error"
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:234
|
||||
msgid "Authentication failed. Please check your GitHub token."
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:235
|
||||
msgid "Access forbidden. Check your token permissions or rate limit."
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:236
|
||||
msgid "File not found in repository. Please verify the file path and branch."
|
||||
msgstr ""
|
||||
|
||||
#. translators: 1: HTTP status code, 2: Error message
|
||||
#: includes/GitHub_API_Client.php:239
|
||||
#, php-format
|
||||
msgid "GitHub API error (%1$d): %2$s"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: JSON error message
|
||||
#: includes/GitHub_API_Client.php:255
|
||||
#, php-format
|
||||
msgid "Invalid JSON response from GitHub: %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/GitHub_API_Client.php:347
|
||||
msgid "unknown"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Reset time
|
||||
#: includes/GitHub_API_Client.php:352
|
||||
#, php-format
|
||||
msgid "GitHub API rate limit nearly exceeded. Resets at: %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:73
|
||||
#: includes/mapping-functions.php:118
|
||||
msgid "Invalid mapping ID"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:124
|
||||
msgid "Failed to delete mapping"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:227
|
||||
msgid "Repository owner is required"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:233
|
||||
msgid "Invalid repository owner format"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:238
|
||||
msgid "Repository name is required"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:244
|
||||
msgid "Invalid repository name format"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:249
|
||||
msgid "File path is required"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:256
|
||||
msgid "File path cannot contain \"..\""
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:261
|
||||
msgid "File must be .md or .markdown"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:268
|
||||
msgid "Invalid branch name format"
|
||||
msgstr ""
|
||||
|
||||
#: includes/mapping-functions.php:275
|
||||
msgid "Post type does not exist"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Plugin.php:172
|
||||
msgid "GitHub Doc Mappings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Plugin.php:173
|
||||
msgid "GitHub Doc Mapping"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Sync_Manager.php:84
|
||||
#: includes/Sync_Manager.php:422
|
||||
msgid "Synchronization is disabled for this mapping."
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Error message from GitHub API
|
||||
#: includes/Sync_Manager.php:259
|
||||
#, php-format
|
||||
msgid "Failed to fetch file from GitHub: %s"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Error message
|
||||
#: includes/Sync_Manager.php:441
|
||||
#, php-format
|
||||
msgid "Failed to check for changes: %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/Sync_Manager.php:498
|
||||
msgid "GitHub Personal Access Token is not configured."
|
||||
msgstr ""
|
||||
|
||||
#: includes/Sync_Manager.php:504
|
||||
msgid "No active mappings configured."
|
||||
msgstr ""
|
||||
|
||||
#: includes/Sync_Manager.php:509
|
||||
msgid "OpenSSL extension is not available (required for token encryption)."
|
||||
msgstr ""
|
||||
90
robotstxt-documentation-markdown-cron.php
Normal file
90
robotstxt-documentation-markdown-cron.php
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
/**
|
||||
* Cron Functions
|
||||
*
|
||||
* @package RobotsTxt\DocumentationMarkdown
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Register cron hook.
|
||||
add_action( 'robotstxt_docmd_sync_event', 'robotstxt_docmd_handle_cron_sync' );
|
||||
|
||||
/**
|
||||
* Schedule mapping sync
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param int $mapping_id Mapping ID.
|
||||
* @param string $frequency Cron frequency (hourly, twicedaily, daily, weekly).
|
||||
* @return void
|
||||
*/
|
||||
function robotstxt_docmd_schedule_mapping_sync( $mapping_id, $frequency ) {
|
||||
$hook = 'robotstxt_docmd_sync_event';
|
||||
$args = array( $mapping_id );
|
||||
|
||||
// Remove existing schedule.
|
||||
robotstxt_docmd_unschedule_mapping_sync( $mapping_id );
|
||||
|
||||
// Schedule new event.
|
||||
if ( ! wp_next_scheduled( $hook, $args ) ) {
|
||||
wp_schedule_event( time(), $frequency, $hook, $args );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unschedule mapping sync
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param int $mapping_id Mapping ID.
|
||||
* @return void
|
||||
*/
|
||||
function robotstxt_docmd_unschedule_mapping_sync( $mapping_id ) {
|
||||
$hook = 'robotstxt_docmd_sync_event';
|
||||
$args = array( $mapping_id );
|
||||
|
||||
$timestamp = wp_next_scheduled( $hook, $args );
|
||||
if ( $timestamp ) {
|
||||
wp_unschedule_event( $timestamp, $hook, $args );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unschedule all cron events
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function robotstxt_docmd_unschedule_all_crons() {
|
||||
$mappings = robotstxt_docmd_get_all_mappings();
|
||||
|
||||
foreach ( $mappings as $mapping ) {
|
||||
robotstxt_docmd_unschedule_mapping_sync( $mapping['id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle cron sync event
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param int $mapping_id Mapping ID.
|
||||
* @return void
|
||||
*/
|
||||
function robotstxt_docmd_handle_cron_sync( $mapping_id ) {
|
||||
$mapping = robotstxt_docmd_get_mapping( $mapping_id );
|
||||
|
||||
// Check if still enabled.
|
||||
if ( ! $mapping || ! $mapping['sync_enabled'] ) {
|
||||
robotstxt_docmd_unschedule_mapping_sync( $mapping_id );
|
||||
return;
|
||||
}
|
||||
|
||||
// Perform sync.
|
||||
robotstxt_docmd_sync_mapping( $mapping_id );
|
||||
}
|
||||
135
robotstxt-documentation-markdown-functions.php
Normal file
135
robotstxt-documentation-markdown-functions.php
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
<?php
|
||||
/**
|
||||
* General Helper Functions
|
||||
*
|
||||
* @package RobotsTxt\DocumentationMarkdown
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypt GitHub token for storage
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param string $token Plain token.
|
||||
* @return string Encrypted token.
|
||||
*/
|
||||
function robotstxt_docmd_encrypt_token( $token ) {
|
||||
if ( empty( $token ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Use WordPress salts for encryption key.
|
||||
$key = wp_salt( 'auth' );
|
||||
$iv_length = openssl_cipher_iv_length( 'aes-256-cbc' );
|
||||
$iv = openssl_random_pseudo_bytes( $iv_length );
|
||||
|
||||
$encrypted = openssl_encrypt( $token, 'aes-256-cbc', $key, 0, $iv );
|
||||
|
||||
return base64_encode( $iv . $encrypted ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrypt GitHub token from storage
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param string $encrypted_token Encrypted token.
|
||||
* @return string Plain token.
|
||||
*/
|
||||
function robotstxt_docmd_decrypt_token( $encrypted_token ) {
|
||||
if ( empty( $encrypted_token ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$key = wp_salt( 'auth' );
|
||||
$iv_length = openssl_cipher_iv_length( 'aes-256-cbc' );
|
||||
|
||||
$decoded = base64_decode( $encrypted_token ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode
|
||||
$iv = substr( $decoded, 0, $iv_length );
|
||||
$encrypted = substr( $decoded, $iv_length );
|
||||
|
||||
return openssl_decrypt( $encrypted, 'aes-256-cbc', $key, 0, $iv );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate title from file path
|
||||
*
|
||||
* Converts "api-documentation.md" to "API Documentation"
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param string $file_path File path.
|
||||
* @return string Generated title.
|
||||
*/
|
||||
function robotstxt_docmd_generate_title_from_path( $file_path ) {
|
||||
// Get filename without extension.
|
||||
$filename = basename( $file_path );
|
||||
$title = preg_replace( '/\.(md|markdown)$/i', '', $filename );
|
||||
|
||||
// Replace separators with spaces.
|
||||
$title = str_replace( array( '-', '_' ), ' ', $title );
|
||||
|
||||
// Capitalize words.
|
||||
$title = ucwords( $title );
|
||||
|
||||
// Handle common abbreviations.
|
||||
$abbreviations = array(
|
||||
'Api' => 'API',
|
||||
'Faq' => 'FAQ',
|
||||
'Url' => 'URL',
|
||||
'Html' => 'HTML',
|
||||
'Css' => 'CSS',
|
||||
'Php' => 'PHP',
|
||||
'Json' => 'JSON',
|
||||
'Xml' => 'XML',
|
||||
'Sql' => 'SQL',
|
||||
);
|
||||
|
||||
foreach ( $abbreviations as $search => $replace ) {
|
||||
$title = preg_replace( '/\b' . $search . '\b/', $replace, $title );
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status badge HTML
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param string $status Status (never, pending, success, error).
|
||||
* @return string Badge HTML.
|
||||
*/
|
||||
function robotstxt_docmd_get_status_badge( $status ) {
|
||||
$badges = array(
|
||||
'never' => array(
|
||||
'class' => 'status-never',
|
||||
'label' => __( 'Never Synced', 'robotstxt-documentation-markdown' ),
|
||||
),
|
||||
'pending' => array(
|
||||
'class' => 'status-pending',
|
||||
'label' => __( 'Syncing...', 'robotstxt-documentation-markdown' ),
|
||||
),
|
||||
'success' => array(
|
||||
'class' => 'status-success',
|
||||
'label' => __( 'Success', 'robotstxt-documentation-markdown' ),
|
||||
),
|
||||
'error' => array(
|
||||
'class' => 'status-error',
|
||||
'label' => __( 'Error', 'robotstxt-documentation-markdown' ),
|
||||
),
|
||||
);
|
||||
|
||||
$badge = $badges[ $status ] ?? $badges['never'];
|
||||
|
||||
return sprintf(
|
||||
'<span class="status-badge %s">%s</span>',
|
||||
esc_attr( $badge['class'] ),
|
||||
esc_html( $badge['label'] )
|
||||
);
|
||||
}
|
||||
244
robotstxt-documentation-markdown-github.php
Normal file
244
robotstxt-documentation-markdown-github.php
Normal file
|
|
@ -0,0 +1,244 @@
|
|||
<?php
|
||||
/**
|
||||
* GitHub API Functions
|
||||
*
|
||||
* @package RobotsTxt\DocumentationMarkdown
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse GitHub URL
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param string $url GitHub repository URL.
|
||||
* @return array|WP_Error Array with 'owner' and 'repo' or error.
|
||||
*/
|
||||
function robotstxt_docmd_parse_github_url( $url ) {
|
||||
if ( ! str_starts_with( $url, 'https://' ) ) {
|
||||
return new WP_Error( 'invalid_url', __( 'GitHub URL must use HTTPS', 'robotstxt-documentation-markdown' ) );
|
||||
}
|
||||
|
||||
if ( preg_match( '/github\.com\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9._-]+?)(?:\.git)?\/?$/', $url, $matches ) ) {
|
||||
return array(
|
||||
'owner' => $matches[1],
|
||||
'repo' => $matches[2],
|
||||
);
|
||||
}
|
||||
|
||||
return new WP_Error( 'invalid_format', __( 'Could not parse GitHub URL', 'robotstxt-documentation-markdown' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all markdown files from repository
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param string $owner Repository owner.
|
||||
* @param string $repo Repository name.
|
||||
* @param string $branch Branch name.
|
||||
* @param string $token GitHub token (encrypted).
|
||||
* @return array|WP_Error Array of files or error.
|
||||
*/
|
||||
function robotstxt_docmd_get_all_markdown_files( $owner, $repo, $branch, $token ) {
|
||||
// Check cache first.
|
||||
$cache_key = sprintf( 'robotstxt_docmd_files_%s_%s_%s', $owner, $repo, $branch );
|
||||
$cached = get_transient( $cache_key );
|
||||
|
||||
if ( false !== $cached ) {
|
||||
return $cached;
|
||||
}
|
||||
|
||||
// Decrypt token.
|
||||
$decrypted_token = robotstxt_docmd_decrypt_token( $token );
|
||||
|
||||
// Get files recursively.
|
||||
$files = robotstxt_docmd_get_repository_contents_recursive( $owner, $repo, '', $branch, $decrypted_token );
|
||||
|
||||
if ( is_wp_error( $files ) ) {
|
||||
return $files;
|
||||
}
|
||||
|
||||
// Filter only markdown files.
|
||||
$markdown_files = array_filter(
|
||||
$files,
|
||||
function ( $file ) {
|
||||
return preg_match( '/\.(md|markdown)$/i', $file['path'] );
|
||||
}
|
||||
);
|
||||
|
||||
// Re-index array.
|
||||
$markdown_files = array_values( $markdown_files );
|
||||
|
||||
// Cache for 24 hours.
|
||||
set_transient( $cache_key, $markdown_files, DAY_IN_SECONDS );
|
||||
|
||||
return $markdown_files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get repository contents recursively
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param string $owner Repository owner.
|
||||
* @param string $repo Repository name.
|
||||
* @param string $path Path in repository.
|
||||
* @param string $branch Branch name.
|
||||
* @param string $token GitHub token (plain).
|
||||
* @param int $depth Current depth (for recursion limit).
|
||||
* @return array|WP_Error Array of files or error.
|
||||
*/
|
||||
function robotstxt_docmd_get_repository_contents_recursive( $owner, $repo, $path, $branch, $token, $depth = 0 ) {
|
||||
// Prevent infinite recursion.
|
||||
if ( $depth > 10 ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$url = sprintf(
|
||||
'https://api.github.com/repos/%s/%s/contents/%s?ref=%s',
|
||||
$owner,
|
||||
$repo,
|
||||
$path,
|
||||
$branch
|
||||
);
|
||||
|
||||
$response = wp_remote_get(
|
||||
$url,
|
||||
array(
|
||||
'headers' => array(
|
||||
'Authorization' => 'Bearer ' . $token,
|
||||
'Accept' => 'application/vnd.github.v3+json',
|
||||
'User-Agent' => 'WordPress-Documentation-Plugin',
|
||||
),
|
||||
'timeout' => 30,
|
||||
)
|
||||
);
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$code = wp_remote_retrieve_response_code( $response );
|
||||
if ( 200 !== $code ) {
|
||||
return new WP_Error(
|
||||
'github_api_error',
|
||||
sprintf(
|
||||
/* translators: %d: HTTP response code */
|
||||
__( 'GitHub API error: %d', 'robotstxt-documentation-markdown' ),
|
||||
$code
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$body = wp_remote_retrieve_body( $response );
|
||||
$contents = json_decode( $body, true );
|
||||
|
||||
if ( ! is_array( $contents ) ) {
|
||||
return new WP_Error( 'invalid_response', __( 'Invalid GitHub API response', 'robotstxt-documentation-markdown' ) );
|
||||
}
|
||||
|
||||
$files = array();
|
||||
|
||||
foreach ( $contents as $item ) {
|
||||
if ( 'file' === $item['type'] ) {
|
||||
// Skip files larger than 10MB.
|
||||
if ( $item['size'] > 10 * 1024 * 1024 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$files[] = array(
|
||||
'path' => $item['path'],
|
||||
'name' => $item['name'],
|
||||
'size' => $item['size'],
|
||||
'sha' => $item['sha'],
|
||||
);
|
||||
} elseif ( 'dir' === $item['type'] ) {
|
||||
// Recurse into directory.
|
||||
$subfiles = robotstxt_docmd_get_repository_contents_recursive(
|
||||
$owner,
|
||||
$repo,
|
||||
$item['path'],
|
||||
$branch,
|
||||
$token,
|
||||
$depth + 1
|
||||
);
|
||||
|
||||
if ( ! is_wp_error( $subfiles ) ) {
|
||||
$files = array_merge( $files, $subfiles );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file content from GitHub
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param string $owner Repository owner.
|
||||
* @param string $repo Repository name.
|
||||
* @param string $file_path File path.
|
||||
* @param string $branch Branch name.
|
||||
* @param string $token GitHub token (encrypted).
|
||||
* @return string|WP_Error File content or error.
|
||||
*/
|
||||
function robotstxt_docmd_get_file_content( $owner, $repo, $file_path, $branch, $token ) {
|
||||
$decrypted_token = robotstxt_docmd_decrypt_token( $token );
|
||||
|
||||
$url = sprintf(
|
||||
'https://api.github.com/repos/%s/%s/contents/%s?ref=%s',
|
||||
$owner,
|
||||
$repo,
|
||||
$file_path,
|
||||
$branch
|
||||
);
|
||||
|
||||
$response = wp_remote_get(
|
||||
$url,
|
||||
array(
|
||||
'headers' => array(
|
||||
'Authorization' => 'Bearer ' . $decrypted_token,
|
||||
'Accept' => 'application/vnd.github.v3+json',
|
||||
'User-Agent' => 'WordPress-Documentation-Plugin',
|
||||
),
|
||||
'timeout' => 30,
|
||||
)
|
||||
);
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$code = wp_remote_retrieve_response_code( $response );
|
||||
if ( 200 !== $code ) {
|
||||
return new WP_Error(
|
||||
'github_api_error',
|
||||
sprintf(
|
||||
/* translators: %d: HTTP response code */
|
||||
__( 'GitHub API error: %d', 'robotstxt-documentation-markdown' ),
|
||||
$code
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$body = wp_remote_retrieve_body( $response );
|
||||
$data = json_decode( $body, true );
|
||||
|
||||
if ( ! isset( $data['content'] ) || ! isset( $data['encoding'] ) ) {
|
||||
return new WP_Error( 'invalid_response', __( 'Invalid file response from GitHub', 'robotstxt-documentation-markdown' ) );
|
||||
}
|
||||
|
||||
// Decode content (GitHub returns base64).
|
||||
if ( 'base64' === $data['encoding'] ) {
|
||||
return base64_decode( $data['content'] ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode
|
||||
}
|
||||
|
||||
return $data['content'];
|
||||
}
|
||||
315
robotstxt-documentation-markdown-map.php
Normal file
315
robotstxt-documentation-markdown-map.php
Normal file
|
|
@ -0,0 +1,315 @@
|
|||
<?php
|
||||
/**
|
||||
* Mapping Functions
|
||||
*
|
||||
* @package RobotsTxt\DocumentationMarkdown
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all mappings
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @return array Array of mappings.
|
||||
*/
|
||||
function robotstxt_docmd_get_all_mappings() {
|
||||
$args = array(
|
||||
'post_type' => 'robotstxt_map',
|
||||
'posts_per_page' => -1,
|
||||
'post_status' => 'publish',
|
||||
'orderby' => 'title',
|
||||
'order' => 'ASC',
|
||||
);
|
||||
|
||||
$query = new WP_Query( $args );
|
||||
$mappings = array();
|
||||
|
||||
foreach ( $query->posts as $post ) {
|
||||
$mapping = robotstxt_docmd_get_mapping( $post->ID );
|
||||
if ( $mapping ) {
|
||||
$mappings[] = $mapping;
|
||||
}
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
return $mappings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get single mapping
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param int $mapping_id Mapping post ID.
|
||||
* @return array|null Mapping data or null.
|
||||
*/
|
||||
function robotstxt_docmd_get_mapping( $mapping_id ) {
|
||||
$post = get_post( $mapping_id );
|
||||
|
||||
if ( ! $post || 'robotstxt_map' !== $post->post_type ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$repo_owner = get_post_meta( $mapping_id, '_robotstxt_docmd_repo_owner', true );
|
||||
$repo_name = get_post_meta( $mapping_id, '_robotstxt_docmd_repo_name', true );
|
||||
$file_path = get_post_meta( $mapping_id, '_robotstxt_docmd_file_path', true );
|
||||
$branch = get_post_meta( $mapping_id, '_robotstxt_docmd_branch', true );
|
||||
|
||||
if ( empty( $branch ) ) {
|
||||
$branch = 'main';
|
||||
}
|
||||
|
||||
return array(
|
||||
'id' => $mapping_id,
|
||||
'title' => $post->post_title,
|
||||
'repo_owner' => $repo_owner,
|
||||
'repo_name' => $repo_name,
|
||||
'file_path' => $file_path,
|
||||
'branch' => $branch,
|
||||
'github_url' => sprintf( 'https://github.com/%s/%s/blob/%s/%s', $repo_owner, $repo_name, $branch, $file_path ),
|
||||
'target_post_type' => get_post_meta( $mapping_id, '_robotstxt_docmd_target_post_type', true ),
|
||||
'target_post_id' => absint( get_post_meta( $mapping_id, '_robotstxt_docmd_target_post_id', true ) ),
|
||||
'target_author' => absint( get_post_meta( $mapping_id, '_robotstxt_docmd_target_author', true ) ),
|
||||
'target_parent' => absint( get_post_meta( $mapping_id, '_robotstxt_docmd_target_parent', true ) ),
|
||||
'sync_enabled' => (bool) get_post_meta( $mapping_id, '_robotstxt_docmd_sync_enabled', true ),
|
||||
'sync_frequency' => get_post_meta( $mapping_id, '_robotstxt_docmd_sync_frequency', true ),
|
||||
'sync_status' => get_post_meta( $mapping_id, '_robotstxt_docmd_sync_status', true ) ? get_post_meta( $mapping_id, '_robotstxt_docmd_sync_status', true ) : 'never',
|
||||
'last_sync' => get_post_meta( $mapping_id, '_robotstxt_docmd_last_sync', true ),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create mapping
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param array $data Mapping data.
|
||||
* @return int|WP_Error Mapping ID or error.
|
||||
*/
|
||||
function robotstxt_docmd_create_mapping( $data ) {
|
||||
// Check for duplicates.
|
||||
if ( robotstxt_docmd_is_file_mapped( $data['repo_owner'], $data['repo_name'], $data['file_path'], $data['branch'] ) ) {
|
||||
return new WP_Error( 'duplicate_mapping', __( 'This file is already mapped', 'robotstxt-documentation-markdown' ) );
|
||||
}
|
||||
|
||||
// Create mapping post.
|
||||
$post_id = wp_insert_post(
|
||||
array(
|
||||
'post_title' => $data['title'],
|
||||
'post_type' => 'robotstxt_map',
|
||||
'post_status' => 'publish',
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
if ( is_wp_error( $post_id ) ) {
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
// Save metadata.
|
||||
update_post_meta( $post_id, '_robotstxt_docmd_repo_owner', $data['repo_owner'] );
|
||||
update_post_meta( $post_id, '_robotstxt_docmd_repo_name', $data['repo_name'] );
|
||||
update_post_meta( $post_id, '_robotstxt_docmd_file_path', $data['file_path'] );
|
||||
update_post_meta( $post_id, '_robotstxt_docmd_branch', $data['branch'] );
|
||||
update_post_meta( $post_id, '_robotstxt_docmd_target_post_type', $data['target_post_type'] );
|
||||
update_post_meta( $post_id, '_robotstxt_docmd_target_author', $data['target_author'] );
|
||||
update_post_meta( $post_id, '_robotstxt_docmd_target_parent', $data['target_parent'] ?? 0 );
|
||||
update_post_meta( $post_id, '_robotstxt_docmd_sync_enabled', $data['sync_enabled'] ? 1 : 0 );
|
||||
update_post_meta( $post_id, '_robotstxt_docmd_sync_frequency', $data['sync_frequency'] );
|
||||
|
||||
if ( ! empty( $data['target_post_id'] ) ) {
|
||||
update_post_meta( $post_id, '_robotstxt_docmd_target_post_id', $data['target_post_id'] );
|
||||
}
|
||||
|
||||
// Schedule cron if enabled.
|
||||
if ( $data['sync_enabled'] && 'never' !== $data['sync_frequency'] ) {
|
||||
robotstxt_docmd_schedule_mapping_sync( $post_id, $data['sync_frequency'] );
|
||||
}
|
||||
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update mapping
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param int $mapping_id Mapping ID.
|
||||
* @param array $data Mapping data.
|
||||
* @return bool|WP_Error True on success or error.
|
||||
*/
|
||||
function robotstxt_docmd_update_mapping( $mapping_id, $data ) {
|
||||
// Update post title.
|
||||
wp_update_post(
|
||||
array(
|
||||
'ID' => $mapping_id,
|
||||
'post_title' => $data['title'],
|
||||
)
|
||||
);
|
||||
|
||||
// Update metadata.
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_repo_owner', $data['repo_owner'] );
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_repo_name', $data['repo_name'] );
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_file_path', $data['file_path'] );
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_branch', $data['branch'] );
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_target_post_type', $data['target_post_type'] );
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_target_author', $data['target_author'] );
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_target_parent', $data['target_parent'] ?? 0 );
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_sync_enabled', $data['sync_enabled'] ? 1 : 0 );
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_sync_frequency', $data['sync_frequency'] );
|
||||
|
||||
if ( ! empty( $data['target_post_id'] ) ) {
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_target_post_id', $data['target_post_id'] );
|
||||
}
|
||||
|
||||
// Update cron schedule.
|
||||
robotstxt_docmd_unschedule_mapping_sync( $mapping_id );
|
||||
if ( $data['sync_enabled'] && 'never' !== $data['sync_frequency'] ) {
|
||||
robotstxt_docmd_schedule_mapping_sync( $mapping_id, $data['sync_frequency'] );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete mapping
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param int $mapping_id Mapping ID.
|
||||
* @return bool True on success.
|
||||
*/
|
||||
function robotstxt_docmd_delete_mapping( $mapping_id ) {
|
||||
robotstxt_docmd_unschedule_mapping_sync( $mapping_id );
|
||||
wp_delete_post( $mapping_id, true );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if file is already mapped
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param string $owner Repository owner.
|
||||
* @param string $repo Repository name.
|
||||
* @param string $file_path File path.
|
||||
* @param string $branch Branch name.
|
||||
* @return bool True if mapped.
|
||||
*/
|
||||
function robotstxt_docmd_is_file_mapped( $owner, $repo, $file_path, $branch ) {
|
||||
$args = array(
|
||||
'post_type' => 'robotstxt_map',
|
||||
'posts_per_page' => 1,
|
||||
'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
|
||||
array(
|
||||
'key' => '_robotstxt_docmd_repo_owner',
|
||||
'value' => $owner,
|
||||
),
|
||||
array(
|
||||
'key' => '_robotstxt_docmd_repo_name',
|
||||
'value' => $repo,
|
||||
),
|
||||
array(
|
||||
'key' => '_robotstxt_docmd_file_path',
|
||||
'value' => $file_path,
|
||||
),
|
||||
array(
|
||||
'key' => '_robotstxt_docmd_branch',
|
||||
'value' => $branch,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$query = new WP_Query( $args );
|
||||
return $query->have_posts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync mapping (pull content from GitHub and update WordPress)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param int $mapping_id Mapping ID.
|
||||
* @return bool|WP_Error True on success or error.
|
||||
*/
|
||||
function robotstxt_docmd_sync_mapping( $mapping_id ) {
|
||||
$mapping = robotstxt_docmd_get_mapping( $mapping_id );
|
||||
|
||||
if ( ! $mapping ) {
|
||||
return new WP_Error( 'invalid_mapping', __( 'Mapping not found', 'robotstxt-documentation-markdown' ) );
|
||||
}
|
||||
|
||||
// Update status.
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_sync_status', 'pending' );
|
||||
|
||||
// Get settings.
|
||||
$settings = get_option( 'robotstxt_docmd_settings', array() );
|
||||
$token = $settings['github_token'] ?? '';
|
||||
|
||||
if ( empty( $token ) ) {
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_sync_status', 'error' );
|
||||
return new WP_Error( 'no_token', __( 'GitHub token not configured', 'robotstxt-documentation-markdown' ) );
|
||||
}
|
||||
|
||||
// Get file content from GitHub.
|
||||
$content = robotstxt_docmd_get_file_content(
|
||||
$mapping['repo_owner'],
|
||||
$mapping['repo_name'],
|
||||
$mapping['file_path'],
|
||||
$mapping['branch'],
|
||||
$token
|
||||
);
|
||||
|
||||
if ( is_wp_error( $content ) ) {
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_sync_status', 'error' );
|
||||
return $content;
|
||||
}
|
||||
|
||||
// Convert Markdown to HTML using CommonMark.
|
||||
$converter = new \League\CommonMark\CommonMarkConverter();
|
||||
$html_content = $converter->convert( $content )->getContent();
|
||||
|
||||
// Create or update WordPress post.
|
||||
if ( empty( $mapping['target_post_id'] ) ) {
|
||||
// Create new post.
|
||||
$post_id = wp_insert_post(
|
||||
array(
|
||||
'post_title' => $mapping['title'],
|
||||
'post_content' => $html_content,
|
||||
'post_type' => $mapping['target_post_type'],
|
||||
'post_status' => 'publish',
|
||||
'post_author' => $mapping['target_author'],
|
||||
'post_parent' => $mapping['target_parent'],
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
if ( is_wp_error( $post_id ) ) {
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_sync_status', 'error' );
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
// Save the post ID for future syncs.
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_target_post_id', $post_id );
|
||||
} else {
|
||||
// Update existing post.
|
||||
wp_update_post(
|
||||
array(
|
||||
'ID' => $mapping['target_post_id'],
|
||||
'post_content' => $html_content,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Update sync status.
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_sync_status', 'success' );
|
||||
update_post_meta( $mapping_id, '_robotstxt_docmd_last_sync', current_time( 'mysql' ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
1576
robotstxt-documentation-markdown.php
Normal file
1576
robotstxt-documentation-markdown.php
Normal file
File diff suppressed because it is too large
Load diff
113
uninstall.php
Normal file
113
uninstall.php
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
<?php
|
||||
/**
|
||||
* Uninstall Handler
|
||||
*
|
||||
* Fired when the plugin is uninstalled. Removes plugin data based on settings.
|
||||
*
|
||||
* @package RobotsTxt\DocumentationMarkdown
|
||||
* @author ROBOTSTXT
|
||||
* @license GPL-3.0-or-later
|
||||
* @link https://github.com/robotstxt/documentation-markdown
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
// Exit if accessed directly or not called from WordPress.
|
||||
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstall the plugin
|
||||
*
|
||||
* Removes plugin data if user has enabled the cleanup option.
|
||||
* IMPORTANT: Does NOT delete synced content (posts/pages), only mapping
|
||||
* configurations and plugin settings.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function robotstxt_docmd_uninstall(): void {
|
||||
// Get plugin settings.
|
||||
$settings = get_option( 'robotstxt_docmd_settings', array() );
|
||||
|
||||
// Check if user wants to delete data on uninstall.
|
||||
if ( empty( $settings['delete_on_uninstall'] ) ) {
|
||||
// User chose to keep data, do nothing.
|
||||
return;
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
|
||||
// Delete all mapping posts (CPT).
|
||||
$mapping_ids = $wpdb->get_col(
|
||||
$wpdb->prepare(
|
||||
"SELECT ID FROM {$wpdb->posts} WHERE post_type = %s",
|
||||
'robotstxt_map'
|
||||
)
|
||||
);
|
||||
|
||||
foreach ( $mapping_ids as $mapping_id ) {
|
||||
// Force delete (bypass trash).
|
||||
wp_delete_post( $mapping_id, true );
|
||||
}
|
||||
|
||||
// Delete all plugin-specific post meta.
|
||||
$wpdb->query(
|
||||
"DELETE FROM {$wpdb->postmeta}
|
||||
WHERE meta_key LIKE '_robotstxt_docmd_%'"
|
||||
);
|
||||
|
||||
// Delete plugin options.
|
||||
delete_option( 'robotstxt_docmd_settings' );
|
||||
|
||||
// Delete transients (cached data).
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"DELETE FROM {$wpdb->options}
|
||||
WHERE option_name LIKE %s",
|
||||
$wpdb->esc_like( '_transient_robotstxt_docmd_' ) . '%'
|
||||
)
|
||||
);
|
||||
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"DELETE FROM {$wpdb->options}
|
||||
WHERE option_name LIKE %s",
|
||||
$wpdb->esc_like( '_transient_timeout_robotstxt_docmd_' ) . '%'
|
||||
)
|
||||
);
|
||||
|
||||
// Clear all scheduled cron events for each mapping.
|
||||
foreach ( $mapping_ids as $mapping_id ) {
|
||||
$hook = 'robotstxt_docmd_sync_event';
|
||||
$args = array( $mapping_id );
|
||||
$timestamp = wp_next_scheduled( $hook, $args );
|
||||
if ( $timestamp ) {
|
||||
wp_unschedule_event( $timestamp, $hook, $args );
|
||||
}
|
||||
}
|
||||
|
||||
// Clear notification transients.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"DELETE FROM {$wpdb->options}
|
||||
WHERE option_name LIKE %s",
|
||||
$wpdb->esc_like( '_transient_robotstxt_docmd_notification_' ) . '%'
|
||||
)
|
||||
);
|
||||
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"DELETE FROM {$wpdb->options}
|
||||
WHERE option_name LIKE %s",
|
||||
$wpdb->esc_like( '_transient_timeout_robotstxt_docmd_notification_' ) . '%'
|
||||
)
|
||||
);
|
||||
|
||||
// Note: We deliberately DO NOT delete the synced posts/pages themselves.
|
||||
// Users may want to keep the documentation even after uninstalling the plugin.
|
||||
}
|
||||
|
||||
// Run uninstall.
|
||||
robotstxt_docmd_uninstall();
|
||||
25
vendor/autoload.php
vendored
Normal file
25
vendor/autoload.php
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
if (PHP_VERSION_ID < 50600) {
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, $err);
|
||||
} elseif (!headers_sent()) {
|
||||
echo $err;
|
||||
}
|
||||
}
|
||||
trigger_error(
|
||||
$err,
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit5db7b63bf0104878d549f48a1ce8cb76::getLoader();
|
||||
119
vendor/bin/php-parse
vendored
Normal file
119
vendor/bin/php-parse
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy PHP file generated by Composer
|
||||
*
|
||||
* This file includes the referenced bin path (../nikic/php-parser/bin/php-parse)
|
||||
* using a stream wrapper to prevent the shebang from being output on PHP<8
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
$GLOBALS['_composer_bin_dir'] = __DIR__;
|
||||
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
if (!class_exists('Composer\BinProxyWrapper')) {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BinProxyWrapper
|
||||
{
|
||||
private $handle;
|
||||
private $position;
|
||||
private $realpath;
|
||||
|
||||
public function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
|
||||
$opened_path = substr($path, 17);
|
||||
$this->realpath = realpath($opened_path) ?: $opened_path;
|
||||
$opened_path = $this->realpath;
|
||||
$this->handle = fopen($this->realpath, $mode);
|
||||
$this->position = 0;
|
||||
|
||||
return (bool) $this->handle;
|
||||
}
|
||||
|
||||
public function stream_read($count)
|
||||
{
|
||||
$data = fread($this->handle, $count);
|
||||
|
||||
if ($this->position === 0) {
|
||||
$data = preg_replace('{^#!.*\r?\n}', '', $data);
|
||||
}
|
||||
|
||||
$this->position += strlen($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function stream_cast($castAs)
|
||||
{
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
public function stream_close()
|
||||
{
|
||||
fclose($this->handle);
|
||||
}
|
||||
|
||||
public function stream_lock($operation)
|
||||
{
|
||||
return $operation ? flock($this->handle, $operation) : true;
|
||||
}
|
||||
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = ftell($this->handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function stream_eof()
|
||||
{
|
||||
return feof($this->handle);
|
||||
}
|
||||
|
||||
public function stream_stat()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function stream_set_option($option, $arg1, $arg2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function url_stat($path, $flags)
|
||||
{
|
||||
$path = substr($path, 17);
|
||||
if (file_exists($path)) {
|
||||
return stat($path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|
||||
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
|
||||
) {
|
||||
return include("phpvfscomposer://" . __DIR__ . '/..'.'/nikic/php-parser/bin/php-parse');
|
||||
}
|
||||
}
|
||||
|
||||
return include __DIR__ . '/..'.'/nikic/php-parser/bin/php-parse';
|
||||
5
vendor/bin/php-parse.bat
vendored
Normal file
5
vendor/bin/php-parse.bat
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
@ECHO OFF
|
||||
setlocal DISABLEDELAYEDEXPANSION
|
||||
SET BIN_TARGET=%~dp0/php-parse
|
||||
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
|
||||
php "%BIN_TARGET%" %*
|
||||
119
vendor/bin/phpcbf
vendored
Normal file
119
vendor/bin/phpcbf
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy PHP file generated by Composer
|
||||
*
|
||||
* This file includes the referenced bin path (../squizlabs/php_codesniffer/bin/phpcbf)
|
||||
* using a stream wrapper to prevent the shebang from being output on PHP<8
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
$GLOBALS['_composer_bin_dir'] = __DIR__;
|
||||
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
if (!class_exists('Composer\BinProxyWrapper')) {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BinProxyWrapper
|
||||
{
|
||||
private $handle;
|
||||
private $position;
|
||||
private $realpath;
|
||||
|
||||
public function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
|
||||
$opened_path = substr($path, 17);
|
||||
$this->realpath = realpath($opened_path) ?: $opened_path;
|
||||
$opened_path = $this->realpath;
|
||||
$this->handle = fopen($this->realpath, $mode);
|
||||
$this->position = 0;
|
||||
|
||||
return (bool) $this->handle;
|
||||
}
|
||||
|
||||
public function stream_read($count)
|
||||
{
|
||||
$data = fread($this->handle, $count);
|
||||
|
||||
if ($this->position === 0) {
|
||||
$data = preg_replace('{^#!.*\r?\n}', '', $data);
|
||||
}
|
||||
|
||||
$this->position += strlen($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function stream_cast($castAs)
|
||||
{
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
public function stream_close()
|
||||
{
|
||||
fclose($this->handle);
|
||||
}
|
||||
|
||||
public function stream_lock($operation)
|
||||
{
|
||||
return $operation ? flock($this->handle, $operation) : true;
|
||||
}
|
||||
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = ftell($this->handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function stream_eof()
|
||||
{
|
||||
return feof($this->handle);
|
||||
}
|
||||
|
||||
public function stream_stat()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function stream_set_option($option, $arg1, $arg2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function url_stat($path, $flags)
|
||||
{
|
||||
$path = substr($path, 17);
|
||||
if (file_exists($path)) {
|
||||
return stat($path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|
||||
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
|
||||
) {
|
||||
return include("phpvfscomposer://" . __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcbf');
|
||||
}
|
||||
}
|
||||
|
||||
return include __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcbf';
|
||||
5
vendor/bin/phpcbf.bat
vendored
Normal file
5
vendor/bin/phpcbf.bat
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
@ECHO OFF
|
||||
setlocal DISABLEDELAYEDEXPANSION
|
||||
SET BIN_TARGET=%~dp0/phpcbf
|
||||
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
|
||||
php "%BIN_TARGET%" %*
|
||||
119
vendor/bin/phpcs
vendored
Normal file
119
vendor/bin/phpcs
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy PHP file generated by Composer
|
||||
*
|
||||
* This file includes the referenced bin path (../squizlabs/php_codesniffer/bin/phpcs)
|
||||
* using a stream wrapper to prevent the shebang from being output on PHP<8
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
$GLOBALS['_composer_bin_dir'] = __DIR__;
|
||||
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
if (!class_exists('Composer\BinProxyWrapper')) {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BinProxyWrapper
|
||||
{
|
||||
private $handle;
|
||||
private $position;
|
||||
private $realpath;
|
||||
|
||||
public function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
|
||||
$opened_path = substr($path, 17);
|
||||
$this->realpath = realpath($opened_path) ?: $opened_path;
|
||||
$opened_path = $this->realpath;
|
||||
$this->handle = fopen($this->realpath, $mode);
|
||||
$this->position = 0;
|
||||
|
||||
return (bool) $this->handle;
|
||||
}
|
||||
|
||||
public function stream_read($count)
|
||||
{
|
||||
$data = fread($this->handle, $count);
|
||||
|
||||
if ($this->position === 0) {
|
||||
$data = preg_replace('{^#!.*\r?\n}', '', $data);
|
||||
}
|
||||
|
||||
$this->position += strlen($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function stream_cast($castAs)
|
||||
{
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
public function stream_close()
|
||||
{
|
||||
fclose($this->handle);
|
||||
}
|
||||
|
||||
public function stream_lock($operation)
|
||||
{
|
||||
return $operation ? flock($this->handle, $operation) : true;
|
||||
}
|
||||
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = ftell($this->handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function stream_eof()
|
||||
{
|
||||
return feof($this->handle);
|
||||
}
|
||||
|
||||
public function stream_stat()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function stream_set_option($option, $arg1, $arg2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function url_stat($path, $flags)
|
||||
{
|
||||
$path = substr($path, 17);
|
||||
if (file_exists($path)) {
|
||||
return stat($path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|
||||
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
|
||||
) {
|
||||
return include("phpvfscomposer://" . __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcs');
|
||||
}
|
||||
}
|
||||
|
||||
return include __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcs';
|
||||
5
vendor/bin/phpcs.bat
vendored
Normal file
5
vendor/bin/phpcs.bat
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
@ECHO OFF
|
||||
setlocal DISABLEDELAYEDEXPANSION
|
||||
SET BIN_TARGET=%~dp0/phpcs
|
||||
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
|
||||
php "%BIN_TARGET%" %*
|
||||
119
vendor/bin/phpstan
vendored
Normal file
119
vendor/bin/phpstan
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy PHP file generated by Composer
|
||||
*
|
||||
* This file includes the referenced bin path (../phpstan/phpstan/phpstan)
|
||||
* using a stream wrapper to prevent the shebang from being output on PHP<8
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
$GLOBALS['_composer_bin_dir'] = __DIR__;
|
||||
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
if (!class_exists('Composer\BinProxyWrapper')) {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BinProxyWrapper
|
||||
{
|
||||
private $handle;
|
||||
private $position;
|
||||
private $realpath;
|
||||
|
||||
public function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
|
||||
$opened_path = substr($path, 17);
|
||||
$this->realpath = realpath($opened_path) ?: $opened_path;
|
||||
$opened_path = $this->realpath;
|
||||
$this->handle = fopen($this->realpath, $mode);
|
||||
$this->position = 0;
|
||||
|
||||
return (bool) $this->handle;
|
||||
}
|
||||
|
||||
public function stream_read($count)
|
||||
{
|
||||
$data = fread($this->handle, $count);
|
||||
|
||||
if ($this->position === 0) {
|
||||
$data = preg_replace('{^#!.*\r?\n}', '', $data);
|
||||
}
|
||||
|
||||
$this->position += strlen($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function stream_cast($castAs)
|
||||
{
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
public function stream_close()
|
||||
{
|
||||
fclose($this->handle);
|
||||
}
|
||||
|
||||
public function stream_lock($operation)
|
||||
{
|
||||
return $operation ? flock($this->handle, $operation) : true;
|
||||
}
|
||||
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = ftell($this->handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function stream_eof()
|
||||
{
|
||||
return feof($this->handle);
|
||||
}
|
||||
|
||||
public function stream_stat()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function stream_set_option($option, $arg1, $arg2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function url_stat($path, $flags)
|
||||
{
|
||||
$path = substr($path, 17);
|
||||
if (file_exists($path)) {
|
||||
return stat($path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|
||||
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
|
||||
) {
|
||||
return include("phpvfscomposer://" . __DIR__ . '/..'.'/phpstan/phpstan/phpstan');
|
||||
}
|
||||
}
|
||||
|
||||
return include __DIR__ . '/..'.'/phpstan/phpstan/phpstan';
|
||||
5
vendor/bin/phpstan.bat
vendored
Normal file
5
vendor/bin/phpstan.bat
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
@ECHO OFF
|
||||
setlocal DISABLEDELAYEDEXPANSION
|
||||
SET BIN_TARGET=%~dp0/phpstan
|
||||
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
|
||||
php "%BIN_TARGET%" %*
|
||||
119
vendor/bin/phpstan.phar
vendored
Normal file
119
vendor/bin/phpstan.phar
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy PHP file generated by Composer
|
||||
*
|
||||
* This file includes the referenced bin path (../phpstan/phpstan/phpstan.phar)
|
||||
* using a stream wrapper to prevent the shebang from being output on PHP<8
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
$GLOBALS['_composer_bin_dir'] = __DIR__;
|
||||
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
if (!class_exists('Composer\BinProxyWrapper')) {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BinProxyWrapper
|
||||
{
|
||||
private $handle;
|
||||
private $position;
|
||||
private $realpath;
|
||||
|
||||
public function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
|
||||
$opened_path = substr($path, 17);
|
||||
$this->realpath = realpath($opened_path) ?: $opened_path;
|
||||
$opened_path = $this->realpath;
|
||||
$this->handle = fopen($this->realpath, $mode);
|
||||
$this->position = 0;
|
||||
|
||||
return (bool) $this->handle;
|
||||
}
|
||||
|
||||
public function stream_read($count)
|
||||
{
|
||||
$data = fread($this->handle, $count);
|
||||
|
||||
if ($this->position === 0) {
|
||||
$data = preg_replace('{^#!.*\r?\n}', '', $data);
|
||||
}
|
||||
|
||||
$this->position += strlen($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function stream_cast($castAs)
|
||||
{
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
public function stream_close()
|
||||
{
|
||||
fclose($this->handle);
|
||||
}
|
||||
|
||||
public function stream_lock($operation)
|
||||
{
|
||||
return $operation ? flock($this->handle, $operation) : true;
|
||||
}
|
||||
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = ftell($this->handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function stream_eof()
|
||||
{
|
||||
return feof($this->handle);
|
||||
}
|
||||
|
||||
public function stream_stat()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function stream_set_option($option, $arg1, $arg2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function url_stat($path, $flags)
|
||||
{
|
||||
$path = substr($path, 17);
|
||||
if (file_exists($path)) {
|
||||
return stat($path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|
||||
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
|
||||
) {
|
||||
return include("phpvfscomposer://" . __DIR__ . '/..'.'/phpstan/phpstan/phpstan.phar');
|
||||
}
|
||||
}
|
||||
|
||||
return include __DIR__ . '/..'.'/phpstan/phpstan/phpstan.phar';
|
||||
5
vendor/bin/phpstan.phar.bat
vendored
Normal file
5
vendor/bin/phpstan.phar.bat
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
@ECHO OFF
|
||||
setlocal DISABLEDELAYEDEXPANSION
|
||||
SET BIN_TARGET=%~dp0/phpstan.phar
|
||||
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
|
||||
php "%BIN_TARGET%" %*
|
||||
122
vendor/bin/phpunit
vendored
Normal file
122
vendor/bin/phpunit
vendored
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy PHP file generated by Composer
|
||||
*
|
||||
* This file includes the referenced bin path (../phpunit/phpunit/phpunit)
|
||||
* using a stream wrapper to prevent the shebang from being output on PHP<8
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
$GLOBALS['_composer_bin_dir'] = __DIR__;
|
||||
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
|
||||
$GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST'] = $GLOBALS['__PHPUNIT_ISOLATION_BLACKLIST'] = array(realpath(__DIR__ . '/..'.'/phpunit/phpunit/phpunit'));
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
if (!class_exists('Composer\BinProxyWrapper')) {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BinProxyWrapper
|
||||
{
|
||||
private $handle;
|
||||
private $position;
|
||||
private $realpath;
|
||||
|
||||
public function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
|
||||
$opened_path = substr($path, 17);
|
||||
$this->realpath = realpath($opened_path) ?: $opened_path;
|
||||
$opened_path = 'phpvfscomposer://'.$this->realpath;
|
||||
$this->handle = fopen($this->realpath, $mode);
|
||||
$this->position = 0;
|
||||
|
||||
return (bool) $this->handle;
|
||||
}
|
||||
|
||||
public function stream_read($count)
|
||||
{
|
||||
$data = fread($this->handle, $count);
|
||||
|
||||
if ($this->position === 0) {
|
||||
$data = preg_replace('{^#!.*\r?\n}', '', $data);
|
||||
}
|
||||
$data = str_replace('__DIR__', var_export(dirname($this->realpath), true), $data);
|
||||
$data = str_replace('__FILE__', var_export($this->realpath, true), $data);
|
||||
|
||||
$this->position += strlen($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function stream_cast($castAs)
|
||||
{
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
public function stream_close()
|
||||
{
|
||||
fclose($this->handle);
|
||||
}
|
||||
|
||||
public function stream_lock($operation)
|
||||
{
|
||||
return $operation ? flock($this->handle, $operation) : true;
|
||||
}
|
||||
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = ftell($this->handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function stream_eof()
|
||||
{
|
||||
return feof($this->handle);
|
||||
}
|
||||
|
||||
public function stream_stat()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function stream_set_option($option, $arg1, $arg2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function url_stat($path, $flags)
|
||||
{
|
||||
$path = substr($path, 17);
|
||||
if (file_exists($path)) {
|
||||
return stat($path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|
||||
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
|
||||
) {
|
||||
return include("phpvfscomposer://" . __DIR__ . '/..'.'/phpunit/phpunit/phpunit');
|
||||
}
|
||||
}
|
||||
|
||||
return include __DIR__ . '/..'.'/phpunit/phpunit/phpunit';
|
||||
119
vendor/bin/wp-since
vendored
Normal file
119
vendor/bin/wp-since
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy PHP file generated by Composer
|
||||
*
|
||||
* This file includes the referenced bin path (../eduardovillao/wp-since/bin/wp-since)
|
||||
* using a stream wrapper to prevent the shebang from being output on PHP<8
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
$GLOBALS['_composer_bin_dir'] = __DIR__;
|
||||
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
if (!class_exists('Composer\BinProxyWrapper')) {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BinProxyWrapper
|
||||
{
|
||||
private $handle;
|
||||
private $position;
|
||||
private $realpath;
|
||||
|
||||
public function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
|
||||
$opened_path = substr($path, 17);
|
||||
$this->realpath = realpath($opened_path) ?: $opened_path;
|
||||
$opened_path = $this->realpath;
|
||||
$this->handle = fopen($this->realpath, $mode);
|
||||
$this->position = 0;
|
||||
|
||||
return (bool) $this->handle;
|
||||
}
|
||||
|
||||
public function stream_read($count)
|
||||
{
|
||||
$data = fread($this->handle, $count);
|
||||
|
||||
if ($this->position === 0) {
|
||||
$data = preg_replace('{^#!.*\r?\n}', '', $data);
|
||||
}
|
||||
|
||||
$this->position += strlen($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function stream_cast($castAs)
|
||||
{
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
public function stream_close()
|
||||
{
|
||||
fclose($this->handle);
|
||||
}
|
||||
|
||||
public function stream_lock($operation)
|
||||
{
|
||||
return $operation ? flock($this->handle, $operation) : true;
|
||||
}
|
||||
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = ftell($this->handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function stream_eof()
|
||||
{
|
||||
return feof($this->handle);
|
||||
}
|
||||
|
||||
public function stream_stat()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function stream_set_option($option, $arg1, $arg2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function url_stat($path, $flags)
|
||||
{
|
||||
$path = substr($path, 17);
|
||||
if (file_exists($path)) {
|
||||
return stat($path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|
||||
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
|
||||
) {
|
||||
return include("phpvfscomposer://" . __DIR__ . '/..'.'/eduardovillao/wp-since/bin/wp-since');
|
||||
}
|
||||
}
|
||||
|
||||
return include __DIR__ . '/..'.'/eduardovillao/wp-since/bin/wp-since';
|
||||
5
vendor/bin/wp-since.bat
vendored
Normal file
5
vendor/bin/wp-since.bat
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
@ECHO OFF
|
||||
setlocal DISABLEDELAYEDEXPANSION
|
||||
SET BIN_TARGET=%~dp0/wp-since
|
||||
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
|
||||
php "%BIN_TARGET%" %*
|
||||
579
vendor/composer/ClassLoader.php
vendored
Normal file
579
vendor/composer/ClassLoader.php
vendored
Normal file
|
|
@ -0,0 +1,579 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* 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 <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @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<string, array<string, int>>
|
||||
*/
|
||||
private $prefixLengthsPsr4 = array();
|
||||
/**
|
||||
* @var array<string, list<string>>
|
||||
*/
|
||||
private $prefixDirsPsr4 = array();
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
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<string, array<string, list<string>>>
|
||||
*/
|
||||
private $prefixesPsr0 = array();
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
/** @var bool */
|
||||
private $useIncludePath = false;
|
||||
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private $classMap = array();
|
||||
|
||||
/** @var bool */
|
||||
private $classMapAuthoritative = false;
|
||||
|
||||
/**
|
||||
* @var array<string, bool>
|
||||
*/
|
||||
private $missingClasses = array();
|
||||
|
||||
/** @var string|null */
|
||||
private $apcuPrefix;
|
||||
|
||||
/**
|
||||
* @var array<string, self>
|
||||
*/
|
||||
private static $registeredLoaders = array();
|
||||
|
||||
/**
|
||||
* @param string|null $vendorDir
|
||||
*/
|
||||
public function __construct($vendorDir = null)
|
||||
{
|
||||
$this->vendorDir = $vendorDir;
|
||||
self::initializeIncludeClosure();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, list<string>>
|
||||
*/
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, list<string>>
|
||||
*/
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string> Array of classname => path
|
||||
*/
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $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>|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>|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>|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>|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<string, self>
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
359
vendor/composer/InstalledVersions.php
vendored
Normal file
359
vendor/composer/InstalledVersions.php
vendored
Normal file
|
|
@ -0,0 +1,359 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* 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<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
|
||||
*/
|
||||
private static $installed;
|
||||
|
||||
/**
|
||||
* @var bool|null
|
||||
*/
|
||||
private static $canGetVendors;
|
||||
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
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<string>
|
||||
*/
|
||||
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<string>
|
||||
*/
|
||||
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<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
|
||||
*/
|
||||
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<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
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<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
|
||||
*/
|
||||
public static function reload($data)
|
||||
{
|
||||
self::$installed = $data;
|
||||
self::$installedByVendor = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
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<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $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<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||
$required = require __DIR__ . '/installed.php';
|
||||
self::$installed = $required;
|
||||
} else {
|
||||
self::$installed = array();
|
||||
}
|
||||
}
|
||||
|
||||
if (self::$installed !== array()) {
|
||||
$installed[] = self::$installed;
|
||||
}
|
||||
|
||||
return $installed;
|
||||
}
|
||||
}
|
||||
19
vendor/composer/LICENSE
vendored
Normal file
19
vendor/composer/LICENSE
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
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.
|
||||
1916
vendor/composer/autoload_classmap.php
vendored
Normal file
1916
vendor/composer/autoload_classmap.php
vendored
Normal file
File diff suppressed because it is too large
Load diff
14
vendor/composer/autoload_files.php
vendored
Normal file
14
vendor/composer/autoload_files.php
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
// autoload_files.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
|
||||
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
|
||||
'9b38cf48e83f5d8f60375221cd213eee' => $vendorDir . '/phpstan/phpstan/bootstrap.php',
|
||||
'ec07570ca5a812141189b1fa81503674' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
|
||||
);
|
||||
9
vendor/composer/autoload_namespaces.php
vendored
Normal file
9
vendor/composer/autoload_namespaces.php
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
||||
20
vendor/composer/autoload_psr4.php
vendored
Normal file
20
vendor/composer/autoload_psr4.php
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'WP_Since\\' => array($vendorDir . '/eduardovillao/wp-since/src'),
|
||||
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
|
||||
'RobotsTxt\\DocumentationMarkdown\\' => array($baseDir . '/includes'),
|
||||
'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'),
|
||||
'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'),
|
||||
'PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => array($vendorDir . '/dealerdirect/phpcodesniffer-composer-installer/src'),
|
||||
'Nette\\' => array($vendorDir . '/nette/schema/src', $vendorDir . '/nette/utils/src'),
|
||||
'League\\Config\\' => array($vendorDir . '/league/config/src'),
|
||||
'League\\CommonMark\\' => array($vendorDir . '/league/commonmark/src'),
|
||||
'Dflydev\\DotAccessData\\' => array($vendorDir . '/dflydev/dot-access-data/src'),
|
||||
'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
|
||||
);
|
||||
50
vendor/composer/autoload_real.php
vendored
Normal file
50
vendor/composer/autoload_real.php
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit5db7b63bf0104878d549f48a1ce8cb76
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Composer\Autoload\ClassLoader
|
||||
*/
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit5db7b63bf0104878d549f48a1ce8cb76', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit5db7b63bf0104878d549f48a1ce8cb76', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit5db7b63bf0104878d549f48a1ce8cb76::getInitializer($loader));
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit5db7b63bf0104878d549f48a1ce8cb76::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
||||
require $file;
|
||||
}
|
||||
}, null, null);
|
||||
foreach ($filesToLoad as $fileIdentifier => $file) {
|
||||
$requireFile($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
2019
vendor/composer/autoload_static.php
vendored
Normal file
2019
vendor/composer/autoload_static.php
vendored
Normal file
File diff suppressed because it is too large
Load diff
3180
vendor/composer/installed.json
vendored
Normal file
3180
vendor/composer/installed.json
vendored
Normal file
File diff suppressed because it is too large
Load diff
419
vendor/composer/installed.php
vendored
Normal file
419
vendor/composer/installed.php
vendored
Normal file
|
|
@ -0,0 +1,419 @@
|
|||
<?php return array(
|
||||
'root' => array(
|
||||
'name' => 'robotstxt/documentation-markdown',
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => 'c7911a52f403328162659f7318199209c20441db',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'dev' => true,
|
||||
),
|
||||
'versions' => array(
|
||||
'dealerdirect/phpcodesniffer-composer-installer' => array(
|
||||
'pretty_version' => 'v1.2.0',
|
||||
'version' => '1.2.0.0',
|
||||
'reference' => '845eb62303d2ca9b289ef216356568ccc075ffd1',
|
||||
'type' => 'composer-plugin',
|
||||
'install_path' => __DIR__ . '/../dealerdirect/phpcodesniffer-composer-installer',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'dflydev/dot-access-data' => array(
|
||||
'pretty_version' => 'v3.0.3',
|
||||
'version' => '3.0.3.0',
|
||||
'reference' => 'a23a2bf4f31d3518f3ecb38660c95715dfead60f',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../dflydev/dot-access-data',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'eduardovillao/wp-since' => array(
|
||||
'pretty_version' => 'v1.3.0',
|
||||
'version' => '1.3.0.0',
|
||||
'reference' => 'c7ad6e49b045f144fbc40a91a45590c3dfd240c2',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../eduardovillao/wp-since',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'league/commonmark' => array(
|
||||
'pretty_version' => '2.8.0',
|
||||
'version' => '2.8.0.0',
|
||||
'reference' => '4efa10c1e56488e658d10adf7b7b7dcd19940bfb',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../league/commonmark',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'league/config' => array(
|
||||
'pretty_version' => 'v1.2.0',
|
||||
'version' => '1.2.0.0',
|
||||
'reference' => '754b3604fb2984c71f4af4a9cbe7b57f346ec1f3',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../league/config',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'myclabs/deep-copy' => array(
|
||||
'pretty_version' => '1.13.4',
|
||||
'version' => '1.13.4.0',
|
||||
'reference' => '07d290f0c47959fd5eed98c95ee5602db07e0b6a',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../myclabs/deep-copy',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'nette/schema' => array(
|
||||
'pretty_version' => 'v1.3.3',
|
||||
'version' => '1.3.3.0',
|
||||
'reference' => '2befc2f42d7c715fd9d95efc31b1081e5d765004',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../nette/schema',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'nette/utils' => array(
|
||||
'pretty_version' => 'v4.1.1',
|
||||
'version' => '4.1.1.0',
|
||||
'reference' => 'c99059c0315591f1a0db7ad6002000288ab8dc72',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../nette/utils',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'nikic/php-parser' => array(
|
||||
'pretty_version' => 'v4.19.5',
|
||||
'version' => '4.19.5.0',
|
||||
'reference' => '51bd93cc741b7fc3d63d20b6bdcd99fdaa359837',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../nikic/php-parser',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phar-io/manifest' => array(
|
||||
'pretty_version' => '2.0.4',
|
||||
'version' => '2.0.4.0',
|
||||
'reference' => '54750ef60c58e43759730615a392c31c80e23176',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phar-io/manifest',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phar-io/version' => array(
|
||||
'pretty_version' => '3.2.1',
|
||||
'version' => '3.2.1.0',
|
||||
'reference' => '4f7fd7836c6f332bb2933569e566a0d6c4cbed74',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phar-io/version',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpcompatibility/php-compatibility' => array(
|
||||
'pretty_version' => '9.3.5',
|
||||
'version' => '9.3.5.0',
|
||||
'reference' => '9fb324479acf6f39452e0655d2429cc0d3914243',
|
||||
'type' => 'phpcodesniffer-standard',
|
||||
'install_path' => __DIR__ . '/../phpcompatibility/php-compatibility',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpcompatibility/phpcompatibility-paragonie' => array(
|
||||
'pretty_version' => '1.3.4',
|
||||
'version' => '1.3.4.0',
|
||||
'reference' => '244d7b04fc4bc2117c15f5abe23eb933b5f02bbf',
|
||||
'type' => 'phpcodesniffer-standard',
|
||||
'install_path' => __DIR__ . '/../phpcompatibility/phpcompatibility-paragonie',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpcompatibility/phpcompatibility-wp' => array(
|
||||
'pretty_version' => '2.1.8',
|
||||
'version' => '2.1.8.0',
|
||||
'reference' => '7c8d18b4d90dac9e86b0869a608fa09158e168fa',
|
||||
'type' => 'phpcodesniffer-standard',
|
||||
'install_path' => __DIR__ . '/../phpcompatibility/phpcompatibility-wp',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpcsstandards/phpcsextra' => array(
|
||||
'pretty_version' => '1.5.0',
|
||||
'version' => '1.5.0.0',
|
||||
'reference' => 'b598aa890815b8df16363271b659d73280129101',
|
||||
'type' => 'phpcodesniffer-standard',
|
||||
'install_path' => __DIR__ . '/../phpcsstandards/phpcsextra',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpcsstandards/phpcsutils' => array(
|
||||
'pretty_version' => '1.2.2',
|
||||
'version' => '1.2.2.0',
|
||||
'reference' => 'c216317e96c8b3f5932808f9b0f1f7a14e3bbf55',
|
||||
'type' => 'phpcodesniffer-standard',
|
||||
'install_path' => __DIR__ . '/../phpcsstandards/phpcsutils',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpstan/phpstan' => array(
|
||||
'pretty_version' => '1.12.32',
|
||||
'version' => '1.12.32.0',
|
||||
'reference' => '2770dcdf5078d0b0d53f94317e06affe88419aa8',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpstan/phpstan',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpunit/php-code-coverage' => array(
|
||||
'pretty_version' => '10.1.16',
|
||||
'version' => '10.1.16.0',
|
||||
'reference' => '7e308268858ed6baedc8704a304727d20bc07c77',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpunit/php-code-coverage',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpunit/php-file-iterator' => array(
|
||||
'pretty_version' => '4.1.0',
|
||||
'version' => '4.1.0.0',
|
||||
'reference' => 'a95037b6d9e608ba092da1b23931e537cadc3c3c',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpunit/php-file-iterator',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpunit/php-invoker' => array(
|
||||
'pretty_version' => '4.0.0',
|
||||
'version' => '4.0.0.0',
|
||||
'reference' => 'f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpunit/php-invoker',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpunit/php-text-template' => array(
|
||||
'pretty_version' => '3.0.1',
|
||||
'version' => '3.0.1.0',
|
||||
'reference' => '0c7b06ff49e3d5072f057eb1fa59258bf287a748',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpunit/php-text-template',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpunit/php-timer' => array(
|
||||
'pretty_version' => '6.0.0',
|
||||
'version' => '6.0.0.0',
|
||||
'reference' => 'e2a2d67966e740530f4a3343fe2e030ffdc1161d',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpunit/php-timer',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpunit/phpunit' => array(
|
||||
'pretty_version' => '10.5.63',
|
||||
'version' => '10.5.63.0',
|
||||
'reference' => '33198268dad71e926626b618f3ec3966661e4d90',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpunit/phpunit',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'psr/event-dispatcher' => array(
|
||||
'pretty_version' => '1.0.0',
|
||||
'version' => '1.0.0.0',
|
||||
'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../psr/event-dispatcher',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'robotstxt/documentation-markdown' => array(
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => 'c7911a52f403328162659f7318199209c20441db',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'sebastian/cli-parser' => array(
|
||||
'pretty_version' => '2.0.1',
|
||||
'version' => '2.0.1.0',
|
||||
'reference' => 'c34583b87e7b7a8055bf6c450c2c77ce32a24084',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/cli-parser',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/code-unit' => array(
|
||||
'pretty_version' => '2.0.0',
|
||||
'version' => '2.0.0.0',
|
||||
'reference' => 'a81fee9eef0b7a76af11d121767abc44c104e503',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/code-unit',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/code-unit-reverse-lookup' => array(
|
||||
'pretty_version' => '3.0.0',
|
||||
'version' => '3.0.0.0',
|
||||
'reference' => '5e3a687f7d8ae33fb362c5c0743794bbb2420a1d',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/code-unit-reverse-lookup',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/comparator' => array(
|
||||
'pretty_version' => '5.0.5',
|
||||
'version' => '5.0.5.0',
|
||||
'reference' => '55dfef806eb7dfeb6e7a6935601fef866f8ca48d',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/comparator',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/complexity' => array(
|
||||
'pretty_version' => '3.2.0',
|
||||
'version' => '3.2.0.0',
|
||||
'reference' => '68ff824baeae169ec9f2137158ee529584553799',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/complexity',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/diff' => array(
|
||||
'pretty_version' => '5.1.1',
|
||||
'version' => '5.1.1.0',
|
||||
'reference' => 'c41e007b4b62af48218231d6c2275e4c9b975b2e',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/diff',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/environment' => array(
|
||||
'pretty_version' => '6.1.0',
|
||||
'version' => '6.1.0.0',
|
||||
'reference' => '8074dbcd93529b357029f5cc5058fd3e43666984',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/environment',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/exporter' => array(
|
||||
'pretty_version' => '5.1.4',
|
||||
'version' => '5.1.4.0',
|
||||
'reference' => '0735b90f4da94969541dac1da743446e276defa6',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/exporter',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/global-state' => array(
|
||||
'pretty_version' => '6.0.2',
|
||||
'version' => '6.0.2.0',
|
||||
'reference' => '987bafff24ecc4c9ac418cab1145b96dd6e9cbd9',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/global-state',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/lines-of-code' => array(
|
||||
'pretty_version' => '2.0.2',
|
||||
'version' => '2.0.2.0',
|
||||
'reference' => '856e7f6a75a84e339195d48c556f23be2ebf75d0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/lines-of-code',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/object-enumerator' => array(
|
||||
'pretty_version' => '5.0.0',
|
||||
'version' => '5.0.0.0',
|
||||
'reference' => '202d0e344a580d7f7d04b3fafce6933e59dae906',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/object-enumerator',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/object-reflector' => array(
|
||||
'pretty_version' => '3.0.0',
|
||||
'version' => '3.0.0.0',
|
||||
'reference' => '24ed13d98130f0e7122df55d06c5c4942a577957',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/object-reflector',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/recursion-context' => array(
|
||||
'pretty_version' => '5.0.1',
|
||||
'version' => '5.0.1.0',
|
||||
'reference' => '47e34210757a2f37a97dcd207d032e1b01e64c7a',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/recursion-context',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/type' => array(
|
||||
'pretty_version' => '4.0.0',
|
||||
'version' => '4.0.0.0',
|
||||
'reference' => '462699a16464c3944eefc02ebdd77882bd3925bf',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/type',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/version' => array(
|
||||
'pretty_version' => '4.0.1',
|
||||
'version' => '4.0.1.0',
|
||||
'reference' => 'c51fa83a5d8f43f1402e3f32a005e6262244ef17',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/version',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'squizlabs/php_codesniffer' => array(
|
||||
'pretty_version' => '3.13.5',
|
||||
'version' => '3.13.5.0',
|
||||
'reference' => '0ca86845ce43291e8f5692c7356fccf3bcf02bf4',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../squizlabs/php_codesniffer',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'symfony/deprecation-contracts' => array(
|
||||
'pretty_version' => 'v3.6.0',
|
||||
'version' => '3.6.0.0',
|
||||
'reference' => '63afe740e99a13ba87ec199bb07bbdee937a5b62',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/polyfill-php80' => array(
|
||||
'pretty_version' => 'v1.33.0',
|
||||
'version' => '1.33.0.0',
|
||||
'reference' => '0cc9dd0f17f61d8131e7df6b84bd344899fe2608',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/polyfill-php80',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'theseer/tokenizer' => array(
|
||||
'pretty_version' => '1.3.1',
|
||||
'version' => '1.3.1.0',
|
||||
'reference' => 'b7489ce515e168639d17feec34b8847c326b0b3c',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../theseer/tokenizer',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'wp-coding-standards/wpcs' => array(
|
||||
'pretty_version' => '3.3.0',
|
||||
'version' => '3.3.0.0',
|
||||
'reference' => '7795ec6fa05663d716a549d0b44e47ffc8b0d4a6',
|
||||
'type' => 'phpcodesniffer-standard',
|
||||
'install_path' => __DIR__ . '/../wp-coding-standards/wpcs',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
),
|
||||
);
|
||||
26
vendor/composer/platform_check.php
vendored
Normal file
26
vendor/composer/platform_check.php
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
// platform_check.php @generated by Composer
|
||||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 80200)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 8.2.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
|
||||
);
|
||||
}
|
||||
587
vendor/dealerdirect/phpcodesniffer-composer-installer/CHANGELOG.md
vendored
Normal file
587
vendor/dealerdirect/phpcodesniffer-composer-installer/CHANGELOG.md
vendored
Normal file
|
|
@ -0,0 +1,587 @@
|
|||
# Change Log for the Composer Installer for PHP CodeSniffer
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
This projects adheres to [Keep a CHANGELOG](https://keepachangelog.com/) and uses [Semantic Versioning](https://semver.org/).
|
||||
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
_Nothing yet._
|
||||
|
||||
|
||||
## [v1.2.0] - 2025-11-11
|
||||
|
||||
### Changed
|
||||
- Various housekeeping, including improvements to the documentation and tests.
|
||||
|
||||
### Removed
|
||||
- Drop support for PHP_CodeSniffer 2.x. Thanks [@jrfnl] ! [#261]
|
||||
|
||||
[#261]: https://github.com/PHPCSStandards/composer-installer/pull/261
|
||||
|
||||
|
||||
## [v1.1.2] - 2025-07-17
|
||||
|
||||
### Changed
|
||||
- General housekeeping.
|
||||
|
||||
### Fixed
|
||||
- [#247]: Potential fatal error when the Composer EventDispatcher is called programmatically from an integration. Thanks [@jrfnl] ! [#248]
|
||||
|
||||
[#247]: https://github.com/PHPCSStandards/composer-installer/issues/247
|
||||
[#248]: https://github.com/PHPCSStandards/composer-installer/pull/248
|
||||
|
||||
|
||||
## [v1.1.1] - 2025-06-27
|
||||
|
||||
### Changed
|
||||
- Various housekeeping, including improvements to the documentation.
|
||||
|
||||
### Fixed
|
||||
- [#239]: The PHP_CodeSniffer package could not be always found when running the plugin in a Drupal or Magento setup. Thanks [@jrfnl] ! [#245]
|
||||
|
||||
[#239]: https://github.com/PHPCSStandards/composer-installer/issues/239
|
||||
[#245]: https://github.com/PHPCSStandards/composer-installer/pull/245
|
||||
|
||||
|
||||
## [v1.1.0] - 2025-06-24
|
||||
|
||||
### Changed
|
||||
- Various housekeeping, including improvements to the documentation and tests. Thanks [@SplotyCode], [@fredden] for contributing!
|
||||
|
||||
### Removed
|
||||
- Drop support for Composer v1.x. Thanks [@fredden] ! [#230]
|
||||
|
||||
[#230]: https://github.com/PHPCSStandards/composer-installer/pull/230
|
||||
|
||||
|
||||
## [v1.0.0] - 2023-01-05
|
||||
|
||||
### Breaking changes
|
||||
- Rename namespace prefix from Dealerdirect to PHPCSStandards by [@jrfnl] in [#191]
|
||||
- Drop support for PHP 5.3 by [@jrfnl] in [#147]
|
||||
|
||||
### Changed
|
||||
- Correct grammar in error message by [@fredden] in [#189]
|
||||
- .gitattributes: sync with current repo state by [@jrfnl] in [#198]
|
||||
- PHPCSVersions: update URL references by [@jrfnl] in [#161]
|
||||
- README: remove references to Scrutinizer by [@jrfnl] in [#157]
|
||||
- Rename references to master branch by [@Potherca] in [#201]
|
||||
- Update repo references by [@jrfnl] in [#158]
|
||||
- GH Actions: add builds against Composer 2.2 for PHP 7.2 - 8.x by [@jrfnl] in [#172]
|
||||
- GH Actions: bust the cache semi-regularly by [@jrfnl] in [#192]
|
||||
- GH Actions: fix builds on Windows with PHP 8.2 by [@jrfnl] in [#180]
|
||||
- GH Actions: fix up fail-fast for setup-php by [@jrfnl] in [#195]
|
||||
- GH Actions: run integration tests against Composer snapshot by [@jrfnl] in [#163]
|
||||
- GH Actions: run linting against against ubuntu-latest by [@jrfnl] in [#184]
|
||||
- GH Actions/Securitycheck: update the security checker download by [@jrfnl] in [#178]
|
||||
- GH Actions/Securitycheck: update the security checker download by [@jrfnl] in [#186]
|
||||
- GH Actions/Securitycheck: update the security checker download by [@jrfnl] in [#190]
|
||||
- GH Actions: selectively use fail-fast with setup-php by [@jrfnl] in [#194]
|
||||
- GH Actions: stop running tests against PHP 5.5/Composer 1.x on Windows (and remove work-arounds) by [@jrfnl] in [#183]
|
||||
- GH Actions: various tweaks / PHP 8.2 not allowed to fail by [@jrfnl] in [#193]
|
||||
- GH Actions: version update for various predefined actions by [@jrfnl] in [#170]
|
||||
- Update YamLint by [@Potherca] in [#173]
|
||||
- Add initial integration test setup and first few tests by [@jrfnl] in [#153]
|
||||
- BaseLineTest: stabilize the message checks by [@jrfnl] in [#162]
|
||||
- PlayNiceWithScriptsTest: wrap output expectation in condition by [@jrfnl] in [#179]
|
||||
- RegisterExternalStandardsTest: add new tests by [@jrfnl] in [#165]
|
||||
- RegisterExternalStandardsTest: stabilize test for Composer v1 on Windows with PHP 5.5 by [@jrfnl] in [#171]
|
||||
- TestCase::executeCliCommand(): retry Composer commands on a particular exception by [@jrfnl] in [#164]
|
||||
- Tests: add new InstalledPathsOrderTest by [@jrfnl] in [#176]
|
||||
- Tests: add new InstallUpdateEventsTest and NonInstallUpdateEventsTest by [@jrfnl] in [#174]
|
||||
- Tests: add new InvalidPackagesTest by [@jrfnl] in [#168]
|
||||
- Tests: add new PlayNiceWithScriptsTest by [@jrfnl] in [#169]
|
||||
- Tests: add new PreexistingPHPCSConfigTest by [@jrfnl] in [#166]
|
||||
- Tests: add new PreexistingPHPCSInstalledPathsConfigTest + bug fix by [@jrfnl] in [#167]
|
||||
- Tests: add new RemovePluginTest by [@jrfnl] in [#177]
|
||||
- Tests: add new RootPackageHandlingTest + bugfix by [@jrfnl] in [#175]
|
||||
|
||||
### Fixed
|
||||
- Plugin: improve feedback by [@jrfnl] in [#182]
|
||||
|
||||
[#147]: https://github.com/PHPCSStandards/composer-installer/pull/147
|
||||
[#153]: https://github.com/PHPCSStandards/composer-installer/pull/153
|
||||
[#157]: https://github.com/PHPCSStandards/composer-installer/pull/157
|
||||
[#158]: https://github.com/PHPCSStandards/composer-installer/pull/158
|
||||
[#161]: https://github.com/PHPCSStandards/composer-installer/pull/161
|
||||
[#162]: https://github.com/PHPCSStandards/composer-installer/pull/162
|
||||
[#163]: https://github.com/PHPCSStandards/composer-installer/pull/163
|
||||
[#164]: https://github.com/PHPCSStandards/composer-installer/pull/164
|
||||
[#165]: https://github.com/PHPCSStandards/composer-installer/pull/165
|
||||
[#166]: https://github.com/PHPCSStandards/composer-installer/pull/166
|
||||
[#167]: https://github.com/PHPCSStandards/composer-installer/pull/167
|
||||
[#168]: https://github.com/PHPCSStandards/composer-installer/pull/168
|
||||
[#169]: https://github.com/PHPCSStandards/composer-installer/pull/169
|
||||
[#170]: https://github.com/PHPCSStandards/composer-installer/pull/170
|
||||
[#171]: https://github.com/PHPCSStandards/composer-installer/pull/171
|
||||
[#172]: https://github.com/PHPCSStandards/composer-installer/pull/172
|
||||
[#173]: https://github.com/PHPCSStandards/composer-installer/pull/173
|
||||
[#174]: https://github.com/PHPCSStandards/composer-installer/pull/174
|
||||
[#175]: https://github.com/PHPCSStandards/composer-installer/pull/175
|
||||
[#176]: https://github.com/PHPCSStandards/composer-installer/pull/176
|
||||
[#177]: https://github.com/PHPCSStandards/composer-installer/pull/177
|
||||
[#178]: https://github.com/PHPCSStandards/composer-installer/pull/178
|
||||
[#179]: https://github.com/PHPCSStandards/composer-installer/pull/179
|
||||
[#180]: https://github.com/PHPCSStandards/composer-installer/pull/180
|
||||
[#182]: https://github.com/PHPCSStandards/composer-installer/pull/182
|
||||
[#183]: https://github.com/PHPCSStandards/composer-installer/pull/183
|
||||
[#184]: https://github.com/PHPCSStandards/composer-installer/pull/184
|
||||
[#186]: https://github.com/PHPCSStandards/composer-installer/pull/186
|
||||
[#189]: https://github.com/PHPCSStandards/composer-installer/pull/189
|
||||
[#190]: https://github.com/PHPCSStandards/composer-installer/pull/190
|
||||
[#191]: https://github.com/PHPCSStandards/composer-installer/pull/191
|
||||
[#192]: https://github.com/PHPCSStandards/composer-installer/pull/192
|
||||
[#193]: https://github.com/PHPCSStandards/composer-installer/pull/193
|
||||
[#194]: https://github.com/PHPCSStandards/composer-installer/pull/194
|
||||
[#195]: https://github.com/PHPCSStandards/composer-installer/pull/195
|
||||
[#198]: https://github.com/PHPCSStandards/composer-installer/pull/198
|
||||
[#201]: https://github.com/PHPCSStandards/composer-installer/pull/201
|
||||
|
||||
|
||||
## [v0.7.2] - 2022-02-04
|
||||
|
||||
### Changed
|
||||
- Add details regarding QA automation in CONTRIBUTING.md file. by [@Potherca] in [#133]
|
||||
- Add mention of Composer and PHP compatibility to project README. by [@Potherca] in [#132]
|
||||
- Composer: tweak PHPCS version constraint by [@jrfnl] in [#152]
|
||||
- CONTRIBUTING: remove duplicate code of conduct by [@jrfnl] in [#148]
|
||||
- Document release process by [@Potherca] in [#118]
|
||||
- Plugin::loadInstalledPaths(): config-show always shows all by [@jrfnl] in [#154]
|
||||
- README: minor tweaks by [@jrfnl] in [#149]
|
||||
- README: update with information about Composer >= 2.2 by [@jrfnl] in [#141]
|
||||
- Replace deprecated Sensiolabs security checker by [@paras-malhotra] in [#130]
|
||||
- Stabilize a condition by [@jrfnl] in [#127]
|
||||
- Update copyright year by [@jrfnl] in [#138]
|
||||
- Various minor tweaks by [@jrfnl] in [#151]
|
||||
- Change YamlLint config to prevent "truthy" warning. by [@Potherca] in [#144]
|
||||
- GH Actions: PHP 8.1 has been released by [@jrfnl] in [#139]
|
||||
- Travis: line length tweaks by [@jrfnl] in [#128]
|
||||
- CI: Switch to GH Actions by [@jrfnl] in [#137]
|
||||
- CI: various updates by [@jrfnl] in [#140]
|
||||
|
||||
[#118]: https://github.com/PHPCSStandards/composer-installer/pull/118
|
||||
[#127]: https://github.com/PHPCSStandards/composer-installer/pull/127
|
||||
[#128]: https://github.com/PHPCSStandards/composer-installer/pull/128
|
||||
[#130]: https://github.com/PHPCSStandards/composer-installer/pull/130
|
||||
[#132]: https://github.com/PHPCSStandards/composer-installer/pull/132
|
||||
[#133]: https://github.com/PHPCSStandards/composer-installer/pull/133
|
||||
[#137]: https://github.com/PHPCSStandards/composer-installer/pull/137
|
||||
[#138]: https://github.com/PHPCSStandards/composer-installer/pull/138
|
||||
[#139]: https://github.com/PHPCSStandards/composer-installer/pull/139
|
||||
[#140]: https://github.com/PHPCSStandards/composer-installer/pull/140
|
||||
[#141]: https://github.com/PHPCSStandards/composer-installer/pull/141
|
||||
[#144]: https://github.com/PHPCSStandards/composer-installer/pull/144
|
||||
[#148]: https://github.com/PHPCSStandards/composer-installer/pull/148
|
||||
[#149]: https://github.com/PHPCSStandards/composer-installer/pull/149
|
||||
[#151]: https://github.com/PHPCSStandards/composer-installer/pull/151
|
||||
[#152]: https://github.com/PHPCSStandards/composer-installer/pull/152
|
||||
[#154]: https://github.com/PHPCSStandards/composer-installer/pull/154
|
||||
|
||||
|
||||
## [v0.7.1] - 2020-12-07
|
||||
|
||||
### Closed issues
|
||||
- Order of installed_paths inconsistent between runs [#125]
|
||||
- Maintaining this project and Admin rights [#113]
|
||||
|
||||
### Changed
|
||||
- Sort list of installed paths before saving for consistency by [@kevinfodness] in [#126]
|
||||
- Update code of conduct by [@Potherca] in [#117]
|
||||
- Add remark configuration by [@Potherca] in [#122]
|
||||
- Travis: add build against PHP 8.0 by [@jrfnl] in [#124]
|
||||
|
||||
### Fixed
|
||||
- Fixed v4 constraint by [@GrahamCampbell] in [#115]
|
||||
|
||||
[#113]: https://github.com/PHPCSStandards/composer-installer/issues/113
|
||||
[#115]: https://github.com/PHPCSStandards/composer-installer/pull/115
|
||||
[#117]: https://github.com/PHPCSStandards/composer-installer/pull/117
|
||||
[#122]: https://github.com/PHPCSStandards/composer-installer/pull/122
|
||||
[#124]: https://github.com/PHPCSStandards/composer-installer/pull/124
|
||||
[#125]: https://github.com/PHPCSStandards/composer-installer/issues/125
|
||||
[#126]: https://github.com/PHPCSStandards/composer-installer/pull/126
|
||||
|
||||
|
||||
## [v0.7.0] - 2020-06-25
|
||||
|
||||
### Closed issues
|
||||
- Composer 2.x compatibility [#108]
|
||||
- Add link to Packagist on main page [#110]
|
||||
- Switch from Travis CI .org to .com [#112]
|
||||
|
||||
### Added
|
||||
- Allow installation on PHP 8 by [@jrfnl] in [#106]
|
||||
- Support Composer 2.0 by [@jrfnl] in [#111]
|
||||
|
||||
### Changed
|
||||
- Test with PHPCS 4.x and allow installation when using PHPCS 4.x by [@jrfnl] in [#107]
|
||||
- Fix case of class name by [@Seldaek] in [#109]
|
||||
|
||||
[#106]: https://github.com/PHPCSStandards/composer-installer/pull/106
|
||||
[#107]: https://github.com/PHPCSStandards/composer-installer/pull/107
|
||||
[#108]: https://github.com/PHPCSStandards/composer-installer/issues/108
|
||||
[#109]: https://github.com/PHPCSStandards/composer-installer/pull/109
|
||||
[#110]: https://github.com/PHPCSStandards/composer-installer/issues/110
|
||||
[#111]: https://github.com/PHPCSStandards/composer-installer/pull/111
|
||||
[#112]: https://github.com/PHPCSStandards/composer-installer/issues/112
|
||||
|
||||
|
||||
## [v0.6.2] - 2020-01-29
|
||||
|
||||
### Fixed
|
||||
- Composer scripts/commands broken in 0.6.0 update by [@BrianHenryIE] in [#105]
|
||||
|
||||
[#105]: https://github.com/PHPCSStandards/composer-installer/pull/105
|
||||
|
||||
## [v0.6.1] - 2020-01-27
|
||||
|
||||
### Closed issues
|
||||
- Do not exit with code 1 on uninstall (--no-dev) [#103]
|
||||
|
||||
### Changed
|
||||
- Readme: minor tweak now 0.6.0 has been released [#102] ([@jrfnl])
|
||||
|
||||
### Fixed
|
||||
- [#103]: Fix for issue #103 [#104] ([@Potherca])
|
||||
|
||||
[#102]: https://github.com/PHPCSStandards/composer-installer/pull/102
|
||||
[#103]: https://github.com/PHPCSStandards/composer-installer/issues/103
|
||||
[#104]: https://github.com/PHPCSStandards/composer-installer/pull/104
|
||||
|
||||
|
||||
## [v0.6.0] - 2020-01-19
|
||||
|
||||
### Closed issues
|
||||
- Composer PHP version appears not to be respected [#79]
|
||||
- Allow a string value for extra.phpcodesniffer-search-depth [#82]
|
||||
- Add [@jrfnl] as (co)maintainer to this project [#87]
|
||||
|
||||
### Added
|
||||
- Add support for a string phpcodesniffer-search-depth config value set via composer config by [@TravisCarden] in [#85]
|
||||
- Send an exit code when the script terminates by [@jrfnl] in [#93]
|
||||
- Verify the installed_paths after save by [@jrfnl] in [#97]
|
||||
|
||||
### Changed
|
||||
- CS: fix compliance with PSR12 by [@jrfnl] in [#88]
|
||||
- Improve GH issue template by [@jrfnl] in [#94]
|
||||
- Readme: add section about including this plugin from an external PHPCS standard by [@jrfnl] in [#95]
|
||||
- Bug report template: further enhancement by [@jrfnl] in [#99]
|
||||
- Update copyright year. by [@Potherca] in [#101]
|
||||
- Adding linting jobs in github action by [@mjrider] in [#96]
|
||||
- GH Actions: minor tweaks: by [@jrfnl] in [#100]
|
||||
- Travis: disable Xdebug by [@jrfnl] in [#89]
|
||||
- Travis: test against PHP 7.4, not snapshot by [@jrfnl] in [#90]
|
||||
- Travis: use a mix of PHPCS versions in the matrix by [@jrfnl] in [#91]
|
||||
- Update Travis file and fix build by [@Potherca] in [#86]
|
||||
|
||||
### Fixed
|
||||
- [#79]: Respect PHP version used by Composer and provide better feedback on failure by [@jrfnl] in [#80]
|
||||
- Bug fix: loadInstalledPaths() very very broken since PHPCS 3.1.0 by [@jrfnl] in [#98]
|
||||
|
||||
[#79]: https://github.com/PHPCSStandards/composer-installer/issues/79
|
||||
[#80]: https://github.com/PHPCSStandards/composer-installer/issues/80
|
||||
[#82]: https://github.com/PHPCSStandards/composer-installer/issues/82
|
||||
[#85]: https://github.com/PHPCSStandards/composer-installer/pull/85
|
||||
[#86]: https://github.com/PHPCSStandards/composer-installer/pull/86
|
||||
[#87]: https://github.com/PHPCSStandards/composer-installer/issues/87
|
||||
[#88]: https://github.com/PHPCSStandards/composer-installer/pull/88
|
||||
[#89]: https://github.com/PHPCSStandards/composer-installer/pull/89
|
||||
[#90]: https://github.com/PHPCSStandards/composer-installer/pull/90
|
||||
[#91]: https://github.com/PHPCSStandards/composer-installer/pull/91
|
||||
[#93]: https://github.com/PHPCSStandards/composer-installer/pull/93
|
||||
[#94]: https://github.com/PHPCSStandards/composer-installer/pull/94
|
||||
[#95]: https://github.com/PHPCSStandards/composer-installer/pull/95
|
||||
[#96]: https://github.com/PHPCSStandards/composer-installer/pull/96
|
||||
[#97]: https://github.com/PHPCSStandards/composer-installer/pull/97
|
||||
[#98]: https://github.com/PHPCSStandards/composer-installer/issues/98
|
||||
[#99]: https://github.com/PHPCSStandards/composer-installer/pull/99
|
||||
[#100]: https://github.com/PHPCSStandards/composer-installer/pull/100
|
||||
[#101]: https://github.com/PHPCSStandards/composer-installer/pull/101
|
||||
|
||||
|
||||
## [v0.5.0] - 2018-10-26
|
||||
|
||||
### Closed issues
|
||||
- Scan depth as parameter [#45]
|
||||
- phpcs: Exit Code: 127 (Command not found) on every Composer command [#48]
|
||||
- The composer plugin implementation seems to be breaking the composer lifecycle [#49]
|
||||
- Installation error [#53]
|
||||
- Broke composer commands when used with wp-cli/package-command [#59]
|
||||
- Getting a new stable release [#60]
|
||||
- Support PHP CodeSniffer standards in packages installed outside of the vendor directory [#63]
|
||||
|
||||
### Added
|
||||
- Adds the ability to set the max depth from the composer.json file by [@Potherca] in [#46]
|
||||
|
||||
### Changed
|
||||
- Build/PHPCS: update PHPCompatibility repo name by [@jrfnl] in [#54]
|
||||
- README: remove VersionEye badge by [@jrfnl] in [#55]
|
||||
- README: replace maintenance badge by [@jrfnl] in [#56]
|
||||
- Execute phpcs and security-checker from vendor/bin by [@gapple] in [#52]
|
||||
- PHPCS: various minor tweaks by [@jrfnl] in [#57]
|
||||
- Travis: various tweaks by [@jrfnl] in [#58]
|
||||
- Use PHPCompatibility 9.0.0 by [@jrfnl] in [#61]
|
||||
- Build/Travis: test builds against PHP 7.3 by [@jrfnl] in [#62]
|
||||
- Updates copyright year by [@frenck] in [#67]
|
||||
- Enforces PSR12 by [@frenck] in [#66]
|
||||
- Updates contact information by [@frenck] in [#68]
|
||||
- Updates README, spelling/grammar, removed Working section by [@frenck] in [#69]
|
||||
- Replaces ProcessBuilder by ProcessExecutor by [@frenck] in [#70]
|
||||
- Refactors relative path logic by [@frenck] in [#71]
|
||||
- Removes suggested packages by [@frenck] in [#72]
|
||||
- Ensures absolute paths during detection phase by [@frenck] in [#73]
|
||||
- Trivial code cleanup by [@frenck] in [#74]
|
||||
- Fixes duplicate declaration of cwd by [@frenck] in [#75]
|
||||
- Removes HHVM from TravisCI by [@frenck] in [#76]
|
||||
- Adds PHP_CodeSniffer version constraints by [@frenck] in [#77]
|
||||
|
||||
### Fixed
|
||||
- [#49]: Move loadInstalledPaths from init to onDependenciesChangedEvent by [@gapple] in [#51]
|
||||
|
||||
[#45]: https://github.com/PHPCSStandards/composer-installer/issues/45
|
||||
[#46]: https://github.com/PHPCSStandards/composer-installer/pull/46
|
||||
[#48]: https://github.com/PHPCSStandards/composer-installer/issues/48
|
||||
[#49]: https://github.com/PHPCSStandards/composer-installer/issues/49
|
||||
[#51]: https://github.com/PHPCSStandards/composer-installer/pull/51
|
||||
[#52]: https://github.com/PHPCSStandards/composer-installer/pull/52
|
||||
[#53]: https://github.com/PHPCSStandards/composer-installer/issues/53
|
||||
[#54]: https://github.com/PHPCSStandards/composer-installer/pull/54
|
||||
[#55]: https://github.com/PHPCSStandards/composer-installer/pull/55
|
||||
[#56]: https://github.com/PHPCSStandards/composer-installer/pull/56
|
||||
[#57]: https://github.com/PHPCSStandards/composer-installer/pull/57
|
||||
[#58]: https://github.com/PHPCSStandards/composer-installer/pull/58
|
||||
[#59]: https://github.com/PHPCSStandards/composer-installer/issues/59
|
||||
[#60]: https://github.com/PHPCSStandards/composer-installer/issues/60
|
||||
[#61]: https://github.com/PHPCSStandards/composer-installer/pull/61
|
||||
[#62]: https://github.com/PHPCSStandards/composer-installer/pull/62
|
||||
[#63]: https://github.com/PHPCSStandards/composer-installer/issues/63
|
||||
[#66]: https://github.com/PHPCSStandards/composer-installer/pull/66
|
||||
[#67]: https://github.com/PHPCSStandards/composer-installer/pull/67
|
||||
[#68]: https://github.com/PHPCSStandards/composer-installer/pull/68
|
||||
[#69]: https://github.com/PHPCSStandards/composer-installer/pull/69
|
||||
[#70]: https://github.com/PHPCSStandards/composer-installer/pull/70
|
||||
[#71]: https://github.com/PHPCSStandards/composer-installer/pull/71
|
||||
[#72]: https://github.com/PHPCSStandards/composer-installer/pull/72
|
||||
[#73]: https://github.com/PHPCSStandards/composer-installer/pull/73
|
||||
[#74]: https://github.com/PHPCSStandards/composer-installer/pull/74
|
||||
[#75]: https://github.com/PHPCSStandards/composer-installer/pull/75
|
||||
[#76]: https://github.com/PHPCSStandards/composer-installer/pull/76
|
||||
[#77]: https://github.com/PHPCSStandards/composer-installer/pull/77
|
||||
|
||||
|
||||
## [v0.4.4] - 2017-12-06
|
||||
|
||||
### Closed issues
|
||||
- PHP 7.2 compatibility issue [#43]
|
||||
|
||||
### Changed
|
||||
- Update Travis CI svg badge and link URLs [#42] ([@ntwb])
|
||||
- Add PHP 7.2 to Travis CI [#41] ([@ntwb])
|
||||
- Docs: Fix link to releases [#40] ([@GaryJones])
|
||||
|
||||
[#40]: https://github.com/PHPCSStandards/composer-installer/pull/40
|
||||
[#41]: https://github.com/PHPCSStandards/composer-installer/pull/41
|
||||
[#42]: https://github.com/PHPCSStandards/composer-installer/pull/42
|
||||
[#43]: https://github.com/PHPCSStandards/composer-installer/issues/43
|
||||
|
||||
|
||||
## [v0.4.3] - 2017-09-18
|
||||
|
||||
### Changed
|
||||
- CS: Add PHP 5.3 compatibility [#39] ([@GaryJones])
|
||||
- Local PHPCS [#38] ([@GaryJones])
|
||||
|
||||
[#38]: https://github.com/PHPCSStandards/composer-installer/pull/38
|
||||
[#39]: https://github.com/PHPCSStandards/composer-installer/pull/39
|
||||
|
||||
|
||||
## [v0.4.2] - 2017-08-16
|
||||
|
||||
### Changed
|
||||
- Docs: Rename example script [#35] ([@GaryJones])
|
||||
- Update README.md [#36] ([@jrfnl])
|
||||
- Documentation update. [#37] ([@frenck])
|
||||
|
||||
[#35]: https://github.com/PHPCSStandards/composer-installer/pull/35
|
||||
[#36]: https://github.com/PHPCSStandards/composer-installer/pull/36
|
||||
[#37]: https://github.com/PHPCSStandards/composer-installer/pull/37
|
||||
|
||||
|
||||
## [v0.4.1] - 2017-08-01
|
||||
|
||||
### Closed issues
|
||||
- Incorrect relative paths for WPCS [#33]
|
||||
|
||||
### Fixed
|
||||
- [#33]: Changes the way the installed_paths are set. [#34] ([@frenck])
|
||||
|
||||
[#33]: https://github.com/PHPCSStandards/composer-installer/issues/33
|
||||
[#34]: https://github.com/PHPCSStandards/composer-installer/pull/34
|
||||
|
||||
|
||||
## [v0.4.0] - 2017-05-11
|
||||
|
||||
### Closed issues
|
||||
- Add support for code standards in root of repository for PHP_CodeSniffer 3.x [#26]
|
||||
- Config codings styles in composer.json from project [#23]
|
||||
- Check the root package for sniffs to install [#20]
|
||||
- Document the ability to execute the main plugin functionality directly [#18]
|
||||
- Add a CHANGELOG.md [#17]
|
||||
- Install sniffs with relative paths in CodeSniffer.conf [#14]
|
||||
|
||||
### Added
|
||||
- Support for coding standard in the root repository for PHP_CodeSniffer v3.x [#30] ([@frenck])
|
||||
- Added support for having coding standards in the root package [#25] ([@frenck])
|
||||
|
||||
### Changed
|
||||
- Local projects uses relative paths to their coding standards [#28] ([@frenck])
|
||||
- Docs: Updated README. [#31] ([@frenck])
|
||||
- Docs: Adds reference to calling the script directly in the README. [#29] ([@Potherca])
|
||||
- Adds Travis-CI configuration file. [#27] ([@Potherca])
|
||||
|
||||
|
||||
[#14]: https://github.com/PHPCSStandards/composer-installer/issues/14
|
||||
[#17]: https://github.com/PHPCSStandards/composer-installer/issues/17
|
||||
[#18]: https://github.com/PHPCSStandards/composer-installer/issues/18
|
||||
[#20]: https://github.com/PHPCSStandards/composer-installer/issues/20
|
||||
[#23]: https://github.com/PHPCSStandards/composer-installer/issues/23
|
||||
[#25]: https://github.com/PHPCSStandards/composer-installer/pull/25
|
||||
[#26]: https://github.com/PHPCSStandards/composer-installer/issues/26
|
||||
[#27]: https://github.com/PHPCSStandards/composer-installer/pull/27
|
||||
[#28]: https://github.com/PHPCSStandards/composer-installer/pull/28
|
||||
[#29]: https://github.com/PHPCSStandards/composer-installer/pull/29
|
||||
[#31]: https://github.com/PHPCSStandards/composer-installer/pull/31
|
||||
|
||||
|
||||
## [v0.3.2] - 2017-03-29
|
||||
|
||||
### Closed issues
|
||||
- Coding Standard tries itself to install with installPath when it's the root package [#19]
|
||||
|
||||
### Changed
|
||||
- Improvements to the documentation [#22] ([@Potherca])
|
||||
- Added instanceof check to prevent root package from being installed [#21] ([@bastianschwarz])
|
||||
|
||||
### Fixed
|
||||
- [#13]: Incorrect coding standards search depth [#15] ([@frenck])
|
||||
|
||||
[#19]: https://github.com/PHPCSStandards/composer-installer/issues/19
|
||||
[#21]: https://github.com/PHPCSStandards/composer-installer/pull/21
|
||||
[#22]: https://github.com/PHPCSStandards/composer-installer/pull/22
|
||||
|
||||
|
||||
## [v0.3.1] - 2017-02-17
|
||||
|
||||
### Closed issues
|
||||
- Plugin not working correctly when sniffs install depth is equal to "1" [#13]
|
||||
- Create new stable release version to support wider use [#11]
|
||||
|
||||
### Fixed
|
||||
- [#13]: Incorrect coding standards search depth [#15] ([@frenck])
|
||||
|
||||
[#11]: https://github.com/PHPCSStandards/composer-installer/issues/11
|
||||
[#13]: https://github.com/PHPCSStandards/composer-installer/issues/13
|
||||
[#15]: https://github.com/PHPCSStandards/composer-installer/pull/15
|
||||
|
||||
|
||||
## [v0.3.0] - 2017-02-15
|
||||
|
||||
### Implemented enhancements
|
||||
- Install Plugin provides no feedback [#7]
|
||||
- Installing coding standards when executing Composer with --no-scripts [#4]
|
||||
- Github contribution templates [#10] ([@christopher-hopper])
|
||||
- Show config actions and a result as Console output [#8] ([@christopher-hopper])
|
||||
- Adds static function to call the Plugin::onDependenciesChangedEvent() method [#5] ([@Potherca])
|
||||
|
||||
### Added
|
||||
- Support existing standards packages with subfolders [#6] ([@christopher-hopper])
|
||||
|
||||
### Changed
|
||||
- Improved documentation [#12] ([@frenck])
|
||||
- Removal of lgtm.co [#3] ([@frenck])
|
||||
|
||||
[#3]: https://github.com/PHPCSStandards/composer-installer/pull/3
|
||||
[#4]: https://github.com/PHPCSStandards/composer-installer/issues/4
|
||||
[#5]: https://github.com/PHPCSStandards/composer-installer/pull/5
|
||||
[#6]: https://github.com/PHPCSStandards/composer-installer/pull/6
|
||||
[#7]: https://github.com/PHPCSStandards/composer-installer/issues/7
|
||||
[#8]: https://github.com/PHPCSStandards/composer-installer/pull/8
|
||||
[#10]: https://github.com/PHPCSStandards/composer-installer/pull/10
|
||||
[#12]: https://github.com/PHPCSStandards/composer-installer/pull/12
|
||||
|
||||
|
||||
## [v0.2.1] - 2016-11-01
|
||||
|
||||
Fixes an issue with having this plugin installed globally within composer, but using your global composer installation on a local repository without PHP_CodeSniffer installed.
|
||||
|
||||
### Fixed
|
||||
- Bugfix: Plugin fails when PHP_CodeSniffer is not installed [#2] ([@frenck])
|
||||
|
||||
[#2]: https://github.com/PHPCSStandards/composer-installer/pull/2
|
||||
|
||||
|
||||
## [v0.2.0] - 2016-11-01
|
||||
|
||||
For this version on, this installer no longer messes with the installation paths of composer libraries, but instead, it configures PHP_CodeSniffer to look into other directories for coding standards.
|
||||
|
||||
### Changed
|
||||
- PHPCS Configuration management [#1] ([@frenck])
|
||||
|
||||
[#1]: https://github.com/PHPCSStandards/composer-installer/pull/1
|
||||
|
||||
|
||||
## [v0.1.1] - 2016-10-24
|
||||
|
||||
### Changed
|
||||
- Standard name mapping improvements
|
||||
|
||||
|
||||
## v0.1.0 - 2016-10-23
|
||||
|
||||
First useable release.
|
||||
|
||||
[v1.2.0]: https://github.com/PHPCSStandards/composer-installer/compare/v1.1.2...v1.2.0
|
||||
[v1.1.2]: https://github.com/PHPCSStandards/composer-installer/compare/v1.1.1...v1.1.2
|
||||
[v1.1.1]: https://github.com/PHPCSStandards/composer-installer/compare/v1.1.0...v1.1.1
|
||||
[v1.1.0]: https://github.com/PHPCSStandards/composer-installer/compare/v1.0.0...v1.1.0
|
||||
[v1.0.0]: https://github.com/PHPCSStandards/composer-installer/compare/v0.7.2...v1.0.0
|
||||
[v0.7.2]: https://github.com/PHPCSStandards/composer-installer/compare/v0.7.1...v0.7.2
|
||||
[v0.7.1]: https://github.com/PHPCSStandards/composer-installer/compare/v0.7.0...v0.7.1
|
||||
[v0.7.0]: https://github.com/PHPCSStandards/composer-installer/compare/v0.6.2...v0.7.0
|
||||
[v0.6.2]: https://github.com/PHPCSStandards/composer-installer/compare/v0.6.1...v0.6.2
|
||||
[v0.6.1]: https://github.com/PHPCSStandards/composer-installer/compare/v0.6.0...v0.6.1
|
||||
[v0.6.0]: https://github.com/PHPCSStandards/composer-installer/compare/v0.5.0...v0.6.0
|
||||
[v0.5.0]: https://github.com/PHPCSStandards/composer-installer/compare/v0.4.4...v0.5.0
|
||||
[v0.4.4]: https://github.com/PHPCSStandards/composer-installer/compare/v0.4.3...v0.4.4
|
||||
[v0.4.3]: https://github.com/PHPCSStandards/composer-installer/compare/v0.4.2...v0.4.3
|
||||
[v0.4.2]: https://github.com/PHPCSStandards/composer-installer/compare/v0.4.1...v0.4.2
|
||||
[v0.4.1]: https://github.com/PHPCSStandards/composer-installer/compare/v0.4.0...v0.4.1
|
||||
[v0.4.0]: https://github.com/PHPCSStandards/composer-installer/compare/v0.3.2...v0.4.0
|
||||
[v0.3.2]: https://github.com/PHPCSStandards/composer-installer/compare/v0.3.1...v0.3.2
|
||||
[v0.3.1]: https://github.com/PHPCSStandards/composer-installer/compare/v0.3.0...v0.3.1
|
||||
[v0.3.0]: https://github.com/PHPCSStandards/composer-installer/compare/v0.2.1...v0.3.0
|
||||
[v0.2.1]: https://github.com/PHPCSStandards/composer-installer/compare/v0.2.0...v0.2.1
|
||||
[v0.2.0]: https://github.com/PHPCSStandards/composer-installer/compare/v0.1.1...v0.2.0
|
||||
[v0.1.1]: https://github.com/PHPCSStandards/composer-installer/compare/v0.1.0...v0.1.1
|
||||
|
||||
[PHP_CodeSniffer]: https://github.com/PHPCSStandards/PHP_CodeSniffer
|
||||
|
||||
[@bastianschwarz]: https://github.com/bastianschwarz
|
||||
[@BrianHenryIE]: https://github.com/BrianHenryIE
|
||||
[@christopher-hopper]: https://github.com/christopher-hopper
|
||||
[@fredden]: https://github.com/fredden
|
||||
[@frenck]: https://github.com/frenck
|
||||
[@gapple]: https://github.com/gapple
|
||||
[@GaryJones]: https://github.com/GaryJones
|
||||
[@GrahamCampbell]: https://github.com/GrahamCampbell
|
||||
[@jrfnl]: https://github.com/jrfnl
|
||||
[@kevinfodness]: https://github.com/kevinfodness
|
||||
[@mjrider]: https://github.com/mjrider
|
||||
[@ntwb]: https://github.com/ntwb
|
||||
[@paras-malhotra]: https://github.com/paras-malhotra
|
||||
[@Potherca]: https://github.com/Potherca
|
||||
[@Seldaek]: https://github.com/Seldaek
|
||||
[@SplotyCode]: https://github.com/SplotyCode
|
||||
[@TravisCarden]: https://github.com/TravisCarden
|
||||
22
vendor/dealerdirect/phpcodesniffer-composer-installer/LICENSE.md
vendored
Normal file
22
vendor/dealerdirect/phpcodesniffer-composer-installer/LICENSE.md
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2016-2022 Dealerdirect B.V. and contributors
|
||||
Copyright (c) 2022 PHPCSStandards and contributors
|
||||
|
||||
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.
|
||||
278
vendor/dealerdirect/phpcodesniffer-composer-installer/README.md
vendored
Normal file
278
vendor/dealerdirect/phpcodesniffer-composer-installer/README.md
vendored
Normal file
|
|
@ -0,0 +1,278 @@
|
|||
# PHP_CodeSniffer Standards Composer Installer Plugin
|
||||
|
||||
![Last Commit][last-updated-shield]
|
||||
![Awesome][awesome-shield]
|
||||
[![License][license-shield]](LICENSE.md)
|
||||
|
||||
[![Tests][ghactionstest-shield]][ghactions]
|
||||
[![Latest Version on Packagist][packagist-version-shield]][packagist-version]
|
||||
[![Packagist][packagist-shield]][packagist]
|
||||
|
||||
[![Contributor Covenant][code-of-conduct-shield]][code-of-conduct]
|
||||
|
||||
This composer installer plugin makes installation of [PHP_CodeSniffer][codesniffer] coding standards (rulesets) straight-forward.
|
||||
|
||||
No more symbolic linking of directories, checking out repositories on specific locations or manually changing the `phpcs` configuration.
|
||||
|
||||
## Usage
|
||||
|
||||
Installation can be done with [Composer][composer], by requiring this package as a development dependency:
|
||||
|
||||
```bash
|
||||
composer require --dev dealerdirect/phpcodesniffer-composer-installer:"^1.0"
|
||||
```
|
||||
|
||||
Since Composer 2.2, Composer will [ask for your permission](https://blog.packagist.com/composer-2-2/#more-secure-plugin-execution) to allow this plugin to execute code. For this plugin to be functional, permission needs to be granted.
|
||||
|
||||
When permission has been granted, the following snippet will automatically be added to your `composer.json` file by Composer:
|
||||
```json
|
||||
{
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can safely add the permission flag (to avoid Composer needing to ask), by running:
|
||||
```bash
|
||||
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
|
||||
```
|
||||
|
||||
That's it.
|
||||
|
||||
### Compatibility
|
||||
|
||||
This plugin is compatible with:
|
||||
|
||||
- PHP **5.4+**, **7.x**, and **8.x** (Support for PHP v8 is available since [`v0.7.0`][v0.7])
|
||||
- [Composer][composer] **2.2+** (Support for Composer v2 is available since [`v0.7.0`][v0.7]; support for Composer < 2.2 was dropped in [`v1.1.0`][v1.1])
|
||||
- [PHP_CodeSniffer][codesniffer] **3.x** and **4.x**(Support for PHP_CodeSniffer v4 is available since [`v0.7.0`][v0.7], support for PHP_CodeSniffer v2 was dropped in [`v1.2.0`][v1.2])
|
||||
|
||||
### How it works
|
||||
|
||||
Basically, this plugin executes the following steps:
|
||||
|
||||
- This plugin searches for [`phpcodesniffer-standard` packages][] in all of your currently installed Composer packages.
|
||||
- Matching packages and the project itself are scanned for PHP_CodeSniffer rulesets.
|
||||
- The plugin will call PHP_CodeSniffer and configure the `installed_paths` option.
|
||||
|
||||
### Example project
|
||||
|
||||
The following is an example Composer project and has included
|
||||
multiple `phpcodesniffer-standard` packages.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "example/project",
|
||||
"description": "Just an example project",
|
||||
"type": "project",
|
||||
"require": {},
|
||||
"require-dev": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "*",
|
||||
"phpcompatibility/php-compatibility": "*",
|
||||
"wp-coding-standards/wpcs": "*"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
After running `composer install` PHP_CodeSniffer just works:
|
||||
|
||||
```bash
|
||||
$ ./vendor/bin/phpcs -i
|
||||
The installed coding standards are PEAR, PSR1, PSR2, PSR12, Squiz, Zend, PHPCompatibility, Modernize,
|
||||
NormalizedArrays, Universal, PHPCSUtils, WordPress, WordPress-Core, WordPress-Docs and WordPress-Extra
|
||||
```
|
||||
|
||||
### Calling the plugin directly
|
||||
|
||||
In some circumstances, it is desirable to call this plugin's functionality
|
||||
directly. For instance, during development or in [CI][definition-ci] environments.
|
||||
|
||||
As the plugin requires Composer to work, direct calls need to be wired through a
|
||||
project's `composer.json`.
|
||||
|
||||
This is done by adding a call to the `Plugin::run` function in the `script`
|
||||
section of the `composer.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"install-codestandards": [
|
||||
"PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The command can then be called using `composer run-script install-codestandards` or
|
||||
referenced from other script configurations, as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"install-codestandards": [
|
||||
"PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run"
|
||||
],
|
||||
"post-install-cmd": [
|
||||
"@install-codestandards"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For more details about Composer scripts, please refer to [the section on scripts
|
||||
in the Composer manual][composer-manual-scripts].
|
||||
|
||||
### Changing the Coding Standards search depth
|
||||
|
||||
By default, this plugin searches up for Coding Standards up to three directories
|
||||
deep. In most cases, this should be sufficient. However, this plugin allows
|
||||
you to customize the search depth setting if needed.
|
||||
|
||||
```json
|
||||
{
|
||||
"extra": {
|
||||
"phpcodesniffer-search-depth": 5
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Caveats
|
||||
|
||||
When this plugin is installed globally, composer will load the _global_ plugin rather
|
||||
than the one from the local repository. Despite [this behavior being documented
|
||||
in the composer manual][using-composer-plugins], it could potentially confuse
|
||||
as another version of the plugin could be run and not the one specified by the project.
|
||||
|
||||
## Developing Coding Standards
|
||||
|
||||
Coding standard can be developed normally, as documented by [PHP_CodeSniffer][codesniffer], in the [Coding Standard Tutorial][tutorial].
|
||||
|
||||
Create a composer package of your coding standard by adding a `composer.json` file.
|
||||
|
||||
```json
|
||||
{
|
||||
"name" : "acme/phpcodesniffer-our-standards",
|
||||
"description" : "Package contains all coding standards of the Acme company",
|
||||
"require" : {
|
||||
"php" : ">=5.4.0",
|
||||
"squizlabs/php_codesniffer" : "^3.13"
|
||||
},
|
||||
"type" : "phpcodesniffer-standard"
|
||||
}
|
||||
```
|
||||
|
||||
Requirements:
|
||||
* The repository may contain one or more standards.
|
||||
* Each standard can have a separate directory no deeper than 3 levels from the repository root.
|
||||
* The package `type` must be `phpcodesniffer-standard`. Without this, the plugin will not trigger.
|
||||
|
||||
### Requiring the plugin from within your coding standard
|
||||
|
||||
If your coding standard itself depends on additional external PHPCS standards, this plugin can
|
||||
make life easier on your end-users by taking care of the installation of all standards - yours
|
||||
and your dependencies - for them.
|
||||
|
||||
This can help reduce the number of support questions about setting the `installed_paths`, as well
|
||||
as simplify your standard's installation instructions.
|
||||
|
||||
For this to work, make sure your external standard adds this plugin to the `composer.json` config
|
||||
via `require`, **not** `require-dev`.
|
||||
|
||||
> :warning: Your end-user may already `require-dev` this plugin and/or other external standards used
|
||||
> by your end-users may require this plugin as well.
|
||||
>
|
||||
> To prevent your end-users getting into "_dependency hell_", make sure to make the version requirement
|
||||
> for this plugin flexible.
|
||||
>
|
||||
> Remember that [Composer treats unstable minors as majors][composer-manual-caret] and will not be able to resolve
|
||||
> one config requiring this plugin at version `^0.7`, while another requires it at version `^1.0`.
|
||||
> Either allow multiple minors or use `*` as the version requirement.
|
||||
>
|
||||
> Some examples of flexible requirements which can be used:
|
||||
> ```bash
|
||||
> composer require dealerdirect/phpcodesniffer-composer-installer:"*"
|
||||
> composer require dealerdirect/phpcodesniffer-composer-installer:"^0.4.1 || ^0.5 || ^0.6 || ^0.7 || ^1.0"
|
||||
> ```
|
||||
|
||||
## Contributing
|
||||
|
||||
This is an active open-source project. We are always open to people who want to
|
||||
use the code or contribute to it.
|
||||
|
||||
We've set up a separate document for our [contribution guidelines][contributing-guidelines].
|
||||
|
||||
Thank you for being involved! :heart_eyes:
|
||||
|
||||
## Authors & contributors
|
||||
|
||||
The original idea and setup of this repository is by [Franck Nijhof][frenck], employee @ Dealerdirect.
|
||||
|
||||
For a full list of all authors and/or contributors, check [the contributors page][contributors].
|
||||
|
||||
## Funding
|
||||
|
||||
This project is included in the projects supported via the [PHP_CodeSniffer Open Collective][phpcs-open-collective].
|
||||
|
||||
If you use this plugin, financial contributions to the Open Collective are encouraged and appreciated.
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016-2022 Dealerdirect B.V. and contributors
|
||||
Copyright (c) 2022- PHPCSStandards and contributors
|
||||
|
||||
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.
|
||||
|
||||
[awesome-shield]: https://img.shields.io/badge/awesome%3F-yes-brightgreen.svg
|
||||
[code-of-conduct-shield]: https://img.shields.io/badge/Contributor%20Covenant-v2.0-ff69b4.svg
|
||||
[code-of-conduct]: CODE_OF_CONDUCT.md
|
||||
[codesniffer]: https://github.com/PHPCSStandards/PHP_CodeSniffer
|
||||
[composer-manual-scripts]: https://getcomposer.org/doc/articles/scripts.md
|
||||
[composer-manual-caret]: https://getcomposer.org/doc/articles/versions.md#caret-version-range-
|
||||
[composer]: https://getcomposer.org/
|
||||
[contributing-guidelines]: CONTRIBUTING.md
|
||||
[contributors]: https://github.com/PHPCSStandards/composer-installer/graphs/contributors
|
||||
[definition-ci]: https://en.wikipedia.org/wiki/Continuous_integration
|
||||
[frenck]: https://github.com/frenck
|
||||
[last-updated-shield]: https://img.shields.io/github/last-commit/PHPCSStandards/composer-installer.svg
|
||||
[license-shield]: https://img.shields.io/github/license/PHPCSStandards/composer-installer.svg
|
||||
[packagist-shield]: https://img.shields.io/packagist/dt/dealerdirect/phpcodesniffer-composer-installer.svg
|
||||
[packagist-version-shield]: https://img.shields.io/packagist/v/dealerdirect/phpcodesniffer-composer-installer.svg
|
||||
[packagist-version]: https://packagist.org/packages/dealerdirect/phpcodesniffer-composer-installer
|
||||
[packagist]: https://packagist.org/packages/dealerdirect/phpcodesniffer-composer-installer
|
||||
[`phpcodesniffer-standard` packages]: https://packagist.org/explore/?type=phpcodesniffer-standard
|
||||
[phpcs-open-collective]: https://opencollective.com/php_codesniffer
|
||||
[scrutinizer-shield]: https://img.shields.io/scrutinizer/g/dealerdirect/phpcodesniffer-composer-installer.svg
|
||||
[scrutinizer]: https://scrutinizer-ci.com/g/dealerdirect/phpcodesniffer-composer-installer/
|
||||
[ghactionstest-shield]: https://github.com/PHPCSStandards/composer-installer/actions/workflows/integrationtest.yml/badge.svg
|
||||
[ghactions]: https://github.com/PHPCSStandards/composer-installer/actions/workflows/integrationtest.yml
|
||||
[tutorial]: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Coding-Standard-Tutorial
|
||||
[using-composer-plugins]: https://getcomposer.org/doc/articles/plugins.md#using-plugins
|
||||
[v0.7]: https://github.com/PHPCSStandards/composer-installer/releases/tag/v0.7.0
|
||||
[v1.1]: https://github.com/PHPCSStandards/composer-installer/releases/tag/v1.1.0
|
||||
[v1.2]: https://github.com/PHPCSStandards/composer-installer/releases/tag/v1.2.0
|
||||
74
vendor/dealerdirect/phpcodesniffer-composer-installer/composer.json
vendored
Normal file
74
vendor/dealerdirect/phpcodesniffer-composer-installer/composer.json
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"name": "dealerdirect/phpcodesniffer-composer-installer",
|
||||
"description": "PHP_CodeSniffer Standards Composer Installer Plugin",
|
||||
"type": "composer-plugin",
|
||||
"keywords": [
|
||||
"composer", "installer", "plugin",
|
||||
"phpcs", "phpcbf", "codesniffer", "phpcodesniffer", "php_codesniffer",
|
||||
"standard", "standards", "style guide", "stylecheck",
|
||||
"qa", "quality", "code quality", "tests"
|
||||
],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Franck Nijhof",
|
||||
"email": "opensource@frenck.dev",
|
||||
"homepage": "https://frenck.dev",
|
||||
"role": "Open source developer"
|
||||
},
|
||||
{
|
||||
"name" : "Contributors",
|
||||
"homepage" : "https://github.com/PHPCSStandards/composer-installer/graphs/contributors"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHPCSStandards/composer-installer/issues",
|
||||
"source": "https://github.com/PHPCSStandards/composer-installer",
|
||||
"security": "https://github.com/PHPCSStandards/composer-installer/security/policy"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"composer-plugin-api": "^2.2",
|
||||
"squizlabs/php_codesniffer": "^3.1.0 || ^4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-json": "*",
|
||||
"ext-zip": "*",
|
||||
"composer/composer": "^2.2",
|
||||
"phpcompatibility/php-compatibility": "^9.0 || ^10.0.0@dev",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.4.0",
|
||||
"yoast/phpunit-polyfills": "^1.0"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"lock": false
|
||||
},
|
||||
"extra": {
|
||||
"class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
|
||||
},
|
||||
"scripts": {
|
||||
"install-codestandards": [
|
||||
"PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run"
|
||||
],
|
||||
"lint": [
|
||||
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude .git"
|
||||
],
|
||||
"test": [
|
||||
"@php ./vendor/phpunit/phpunit/phpunit --no-coverage"
|
||||
],
|
||||
"coverage": [
|
||||
"@php ./vendor/phpunit/phpunit/phpunit"
|
||||
]
|
||||
}
|
||||
}
|
||||
635
vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php
vendored
Normal file
635
vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php
vendored
Normal file
|
|
@ -0,0 +1,635 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Dealerdirect PHP_CodeSniffer Standards
|
||||
* Composer Installer Plugin package.
|
||||
*
|
||||
* @copyright 2016-2022 Dealerdirect B.V.
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
namespace PHPCSStandards\Composer\Plugin\Installers\PHPCodeSniffer;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\EventDispatcher\EventSubscriberInterface;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\RootPackageInterface;
|
||||
use Composer\Plugin\PluginInterface;
|
||||
use Composer\Script\Event;
|
||||
use Composer\Script\ScriptEvents;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\Process\Exception\LogicException;
|
||||
use Symfony\Component\Process\Exception\ProcessFailedException;
|
||||
use Symfony\Component\Process\Exception\RuntimeException;
|
||||
use Symfony\Component\Process\PhpExecutableFinder;
|
||||
|
||||
/**
|
||||
* PHP_CodeSniffer standard installation manager.
|
||||
*
|
||||
* @author Franck Nijhof <franck.nijhof@dealerdirect.com>
|
||||
*/
|
||||
class Plugin implements PluginInterface, EventSubscriberInterface
|
||||
{
|
||||
const KEY_MAX_DEPTH = 'phpcodesniffer-search-depth';
|
||||
|
||||
const MESSAGE_ERROR_WRONG_MAX_DEPTH =
|
||||
'The value of "%s" (in the composer.json "extra".section) must be an integer larger than %d, %s given.';
|
||||
|
||||
const MESSAGE_NOT_INSTALLED = 'PHPCodeSniffer is not installed';
|
||||
const MESSAGE_NOTHING_TO_INSTALL = 'No PHPCS standards to install or update';
|
||||
const MESSAGE_PLUGIN_UNINSTALLED = 'PHPCodeSniffer Composer Installer is uninstalled';
|
||||
const MESSAGE_RUNNING_INSTALLER = 'Running PHPCodeSniffer Composer Installer';
|
||||
|
||||
const PACKAGE_NAME = 'squizlabs/php_codesniffer';
|
||||
const PACKAGE_TYPE = 'phpcodesniffer-standard';
|
||||
|
||||
const PHPCS_CONFIG_REGEX = '`%s:[^\r\n]+`';
|
||||
const PHPCS_CONFIG_KEY = 'installed_paths';
|
||||
|
||||
const PLUGIN_NAME = 'dealerdirect/phpcodesniffer-composer-installer';
|
||||
|
||||
/**
|
||||
* @var Composer
|
||||
*/
|
||||
private $composer;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $cwd;
|
||||
|
||||
/**
|
||||
* @var Filesystem
|
||||
*/
|
||||
private $filesystem;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $installedPaths;
|
||||
|
||||
/**
|
||||
* @var IOInterface
|
||||
*/
|
||||
private $io;
|
||||
|
||||
/**
|
||||
* @var ProcessExecutor
|
||||
*/
|
||||
private $processExecutor;
|
||||
|
||||
/**
|
||||
* Triggers the plugin's main functionality.
|
||||
*
|
||||
* Makes it possible to run the plugin as a custom command.
|
||||
*
|
||||
* @param Event $event
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws \RuntimeException
|
||||
* @throws LogicException
|
||||
* @throws ProcessFailedException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public static function run(Event $event)
|
||||
{
|
||||
$io = $event->getIO();
|
||||
$composer = $event->getComposer();
|
||||
|
||||
$instance = new static();
|
||||
|
||||
$instance->io = $io;
|
||||
$instance->composer = $composer;
|
||||
$instance->init();
|
||||
$instance->onDependenciesChangedEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
* @throws LogicException
|
||||
* @throws ProcessFailedException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function activate(Composer $composer, IOInterface $io)
|
||||
{
|
||||
$this->composer = $composer;
|
||||
$this->io = $io;
|
||||
|
||||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function deactivate(Composer $composer, IOInterface $io)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function uninstall(Composer $composer, IOInterface $io)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the plugin so it's main functionality can be run.
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
* @throws LogicException
|
||||
* @throws ProcessFailedException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
private function init()
|
||||
{
|
||||
$this->cwd = getcwd();
|
||||
$this->installedPaths = array();
|
||||
|
||||
$this->processExecutor = new ProcessExecutor($this->io);
|
||||
$this->filesystem = new Filesystem($this->processExecutor);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
ScriptEvents::POST_INSTALL_CMD => array(
|
||||
array('onDependenciesChangedEvent', 0),
|
||||
),
|
||||
ScriptEvents::POST_UPDATE_CMD => array(
|
||||
array('onDependenciesChangedEvent', 0),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Entry point for post install and post update events.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws LogicException
|
||||
* @throws ProcessFailedException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function onDependenciesChangedEvent()
|
||||
{
|
||||
$io = $this->io;
|
||||
$isVerbose = $io->isVerbose();
|
||||
$exitCode = 0;
|
||||
|
||||
if ($isVerbose) {
|
||||
$io->write(sprintf('<info>%s</info>', self::MESSAGE_RUNNING_INSTALLER));
|
||||
}
|
||||
|
||||
if ($this->isPHPCodeSnifferInstalled() === true) {
|
||||
$this->loadInstalledPaths();
|
||||
$installPathCleaned = $this->cleanInstalledPaths();
|
||||
$installPathUpdated = $this->updateInstalledPaths();
|
||||
|
||||
if ($installPathCleaned === true || $installPathUpdated === true) {
|
||||
$exitCode = $this->saveInstalledPaths();
|
||||
} elseif ($isVerbose) {
|
||||
$io->write(sprintf('<info>%s</info>', self::MESSAGE_NOTHING_TO_INSTALL));
|
||||
}
|
||||
} else {
|
||||
$pluginPackage = $this
|
||||
->composer
|
||||
->getRepositoryManager()
|
||||
->getLocalRepository()
|
||||
->findPackages(self::PLUGIN_NAME)
|
||||
;
|
||||
|
||||
$isPluginUninstalled = count($pluginPackage) === 0;
|
||||
|
||||
if ($isPluginUninstalled) {
|
||||
if ($isVerbose) {
|
||||
$io->write(sprintf('<info>%s</info>', self::MESSAGE_PLUGIN_UNINSTALLED));
|
||||
}
|
||||
} else {
|
||||
$exitCode = 1;
|
||||
if ($isVerbose) {
|
||||
$io->write(sprintf('<error>%s</error>', self::MESSAGE_NOT_INSTALLED));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $exitCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all paths from PHP_CodeSniffer into an array.
|
||||
*
|
||||
* @throws LogicException
|
||||
* @throws ProcessFailedException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
private function loadInstalledPaths()
|
||||
{
|
||||
if ($this->isPHPCodeSnifferInstalled() === true) {
|
||||
$this->processExecutor->execute(
|
||||
$this->getPhpcsCommand() . ' --config-show',
|
||||
$output,
|
||||
$this->getPHPCodeSnifferInstallPath()
|
||||
);
|
||||
|
||||
$regex = sprintf(self::PHPCS_CONFIG_REGEX, self::PHPCS_CONFIG_KEY);
|
||||
if (preg_match($regex, $output, $match) === 1) {
|
||||
$phpcsInstalledPaths = str_replace(self::PHPCS_CONFIG_KEY . ': ', '', $match[0]);
|
||||
$phpcsInstalledPaths = trim($phpcsInstalledPaths);
|
||||
|
||||
if ($phpcsInstalledPaths !== '') {
|
||||
$this->installedPaths = explode(',', $phpcsInstalledPaths);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save all coding standard paths back into PHP_CodeSniffer
|
||||
*
|
||||
* @throws LogicException
|
||||
* @throws ProcessFailedException
|
||||
* @throws RuntimeException
|
||||
*
|
||||
* @return int Exit code. 0 for success, 1 or higher for failure.
|
||||
*/
|
||||
private function saveInstalledPaths()
|
||||
{
|
||||
// Check if we found installed paths to set.
|
||||
if (count($this->installedPaths) !== 0) {
|
||||
sort($this->installedPaths);
|
||||
$paths = implode(',', $this->installedPaths);
|
||||
$arguments = array('--config-set', self::PHPCS_CONFIG_KEY, $paths);
|
||||
$configMessage = sprintf(
|
||||
'PHP CodeSniffer Config <info>%s</info> <comment>set to</comment> <info>%s</info>',
|
||||
self::PHPCS_CONFIG_KEY,
|
||||
$paths
|
||||
);
|
||||
} else {
|
||||
// Delete the installed paths if none were found.
|
||||
$arguments = array('--config-delete', self::PHPCS_CONFIG_KEY);
|
||||
$configMessage = sprintf(
|
||||
'PHP CodeSniffer Config <info>%s</info> <comment>delete</comment>',
|
||||
self::PHPCS_CONFIG_KEY
|
||||
);
|
||||
}
|
||||
|
||||
// Prepare message in case of failure
|
||||
$failMessage = sprintf(
|
||||
'Failed to set PHP CodeSniffer <info>%s</info> Config',
|
||||
self::PHPCS_CONFIG_KEY
|
||||
);
|
||||
|
||||
// Okay, lets rock!
|
||||
$command = vsprintf(
|
||||
'%s %s',
|
||||
array(
|
||||
'phpcs command' => $this->getPhpcsCommand(),
|
||||
'arguments' => implode(' ', $arguments),
|
||||
)
|
||||
);
|
||||
|
||||
$exitCode = $this->processExecutor->execute($command, $configResult, $this->getPHPCodeSnifferInstallPath());
|
||||
if ($exitCode === 0) {
|
||||
$exitCode = $this->verifySaveSuccess();
|
||||
}
|
||||
|
||||
if ($exitCode === 0) {
|
||||
$this->io->write($configMessage);
|
||||
} else {
|
||||
$this->io->write($failMessage);
|
||||
}
|
||||
|
||||
if ($this->io->isVerbose() && !empty($configResult)) {
|
||||
$this->io->write(sprintf('<info>%s</info>', $configResult));
|
||||
}
|
||||
|
||||
return $exitCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the paths which were expected to be saved, have been.
|
||||
*
|
||||
* @return int Exit code. 0 for success, 1 for failure.
|
||||
*/
|
||||
private function verifySaveSuccess()
|
||||
{
|
||||
$exitCode = 1;
|
||||
$expectedPaths = $this->installedPaths;
|
||||
|
||||
// Request the currently set installed paths after the save.
|
||||
$this->loadInstalledPaths();
|
||||
|
||||
$registeredPaths = array_intersect($this->installedPaths, $expectedPaths);
|
||||
$registeredCount = count($registeredPaths);
|
||||
$expectedCount = count($expectedPaths);
|
||||
|
||||
if ($expectedCount === $registeredCount) {
|
||||
$exitCode = 0;
|
||||
}
|
||||
|
||||
if ($exitCode === 1 && $this->io->isVerbose()) {
|
||||
$verificationMessage = sprintf(
|
||||
"Paths to external standards found by the plugin: <info>%s</info>\n"
|
||||
. 'Actual paths registered with PHPCS: <info>%s</info>',
|
||||
implode(', ', $expectedPaths),
|
||||
implode(', ', $this->installedPaths)
|
||||
);
|
||||
$this->io->write($verificationMessage);
|
||||
}
|
||||
|
||||
return $exitCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the command to call PHPCS.
|
||||
*/
|
||||
protected function getPhpcsCommand()
|
||||
{
|
||||
return vsprintf(
|
||||
'%s %s',
|
||||
array(
|
||||
'php executable' => $this->getPhpExecCommand(),
|
||||
'phpcs executable' => './bin/phpcs',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the current PHP version being used.
|
||||
*
|
||||
* Duplicate of the same in the EventDispatcher class in Composer itself.
|
||||
*/
|
||||
protected function getPhpExecCommand()
|
||||
{
|
||||
$finder = new PhpExecutableFinder();
|
||||
|
||||
$phpPath = $finder->find(false);
|
||||
|
||||
if ($phpPath === false) {
|
||||
throw new \RuntimeException('Failed to locate PHP binary to execute ' . $phpPath);
|
||||
}
|
||||
|
||||
$phpArgs = $finder->findArguments();
|
||||
$phpArgs = $phpArgs
|
||||
? ' ' . implode(' ', $phpArgs)
|
||||
: ''
|
||||
;
|
||||
|
||||
$command = ProcessExecutor::escape($phpPath) .
|
||||
$phpArgs .
|
||||
' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen')) .
|
||||
' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions')) .
|
||||
' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'))
|
||||
;
|
||||
|
||||
return $command;
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate trough all known paths and check if they are still valid.
|
||||
*
|
||||
* If path does not exists, is not an directory or isn't readable, the path
|
||||
* is removed from the list.
|
||||
*
|
||||
* @return bool True if changes where made, false otherwise
|
||||
*/
|
||||
private function cleanInstalledPaths()
|
||||
{
|
||||
$changes = false;
|
||||
foreach ($this->installedPaths as $key => $path) {
|
||||
// This might be a relative path as well
|
||||
$alternativePath = realpath($this->getPHPCodeSnifferInstallPath() . \DIRECTORY_SEPARATOR . $path);
|
||||
|
||||
if (
|
||||
(is_dir($path) === false || is_readable($path) === false) &&
|
||||
(
|
||||
$alternativePath === false ||
|
||||
is_dir($alternativePath) === false ||
|
||||
is_readable($alternativePath) === false
|
||||
)
|
||||
) {
|
||||
unset($this->installedPaths[$key]);
|
||||
$changes = true;
|
||||
}
|
||||
}
|
||||
return $changes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check all installed packages (including the root package) against
|
||||
* the installed paths from PHP_CodeSniffer and add the missing ones.
|
||||
*
|
||||
* @return bool True if changes where made, false otherwise
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
private function updateInstalledPaths()
|
||||
{
|
||||
$changes = false;
|
||||
$searchPaths = array();
|
||||
|
||||
// Add root package only if it has the expected package type.
|
||||
if (
|
||||
$this->composer->getPackage() instanceof RootPackageInterface
|
||||
&& $this->composer->getPackage()->getType() === self::PACKAGE_TYPE
|
||||
) {
|
||||
$searchPaths[] = $this->cwd;
|
||||
}
|
||||
|
||||
$codingStandardPackages = $this->getPHPCodingStandardPackages();
|
||||
foreach ($codingStandardPackages as $package) {
|
||||
$installPath = $this->composer->getInstallationManager()->getInstallPath($package);
|
||||
if ($this->filesystem->isAbsolutePath($installPath) === false) {
|
||||
$installPath = $this->filesystem->normalizePath(
|
||||
$this->cwd . \DIRECTORY_SEPARATOR . $installPath
|
||||
);
|
||||
}
|
||||
$searchPaths[] = $installPath;
|
||||
}
|
||||
|
||||
// Nothing to do.
|
||||
if ($searchPaths === array()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$finder = new Finder();
|
||||
$finder->files()
|
||||
->depth('<= ' . $this->getMaxDepth())
|
||||
->depth('>= ' . $this->getMinDepth())
|
||||
->ignoreUnreadableDirs()
|
||||
->ignoreVCS(true)
|
||||
->in($searchPaths)
|
||||
->name('ruleset.xml');
|
||||
|
||||
// Process each found possible ruleset.
|
||||
foreach ($finder as $ruleset) {
|
||||
$standardsPath = $ruleset->getPath();
|
||||
|
||||
// Pick the directory above the directory containing the standard, unless this is the project root.
|
||||
if ($standardsPath !== $this->cwd) {
|
||||
$standardsPath = dirname($standardsPath);
|
||||
}
|
||||
|
||||
// Use relative paths for local project repositories.
|
||||
if ($this->isRunningGlobally() === false) {
|
||||
$standardsPath = $this->filesystem->findShortestPath(
|
||||
$this->getPHPCodeSnifferInstallPath(),
|
||||
$standardsPath,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// De-duplicate and add when directory is not configured.
|
||||
if (in_array($standardsPath, $this->installedPaths, true) === false) {
|
||||
$this->installedPaths[] = $standardsPath;
|
||||
$changes = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $changes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates through Composers' local repository looking for valid Coding
|
||||
* Standard packages.
|
||||
*
|
||||
* @return array Composer packages containing coding standard(s)
|
||||
*/
|
||||
private function getPHPCodingStandardPackages()
|
||||
{
|
||||
$codingStandardPackages = array_filter(
|
||||
$this->composer->getRepositoryManager()->getLocalRepository()->getPackages(),
|
||||
function (PackageInterface $package) {
|
||||
if ($package instanceof AliasPackage) {
|
||||
return false;
|
||||
}
|
||||
return $package->getType() === Plugin::PACKAGE_TYPE;
|
||||
}
|
||||
);
|
||||
|
||||
return $codingStandardPackages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for the installed PHP_CodeSniffer Composer package
|
||||
*
|
||||
* @param null|string|\Composer\Semver\Constraint\ConstraintInterface $versionConstraint to match against
|
||||
*
|
||||
* @return PackageInterface|null
|
||||
*/
|
||||
private function getPHPCodeSnifferPackage($versionConstraint = null)
|
||||
{
|
||||
$packages = $this
|
||||
->composer
|
||||
->getRepositoryManager()
|
||||
->getLocalRepository()
|
||||
->findPackages(self::PACKAGE_NAME, $versionConstraint);
|
||||
|
||||
return array_shift($packages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to the PHP_CodeSniffer package installation location
|
||||
*
|
||||
* {@internal Do NOT try to modernize via the Composer 2.2 API (`InstalledVersions::getInstallPath()`).
|
||||
* Doing so doesn't play nice with other plugins.
|
||||
* {@link https://github.com/PHPCSStandards/composer-installer/issues/239}}
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getPHPCodeSnifferInstallPath()
|
||||
{
|
||||
return $this->composer->getInstallationManager()->getInstallPath($this->getPHPCodeSnifferPackage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple check if PHP_CodeSniffer is installed.
|
||||
*
|
||||
* {@internal Do NOT try to modernize via the Composer 2.2 API (`InstalledVersions::isInstalled()`).
|
||||
* Doing so doesn't play nice with integrations calling the Composer EventDispatcher programmatically.
|
||||
* {@link https://github.com/PHPCSStandards/composer-installer/issues/247}}
|
||||
*
|
||||
* @param null|string|\Composer\Semver\Constraint\ConstraintInterface $versionConstraint to match against
|
||||
*
|
||||
* @return bool Whether PHP_CodeSniffer is installed
|
||||
*/
|
||||
private function isPHPCodeSnifferInstalled($versionConstraint = null)
|
||||
{
|
||||
return ($this->getPHPCodeSnifferPackage($versionConstraint) !== null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if composer is running "global"
|
||||
* This check kinda dirty, but it is the "Composer Way"
|
||||
*
|
||||
* @return bool Whether Composer is running "globally"
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
private function isRunningGlobally()
|
||||
{
|
||||
return ($this->composer->getConfig()->get('home') === $this->cwd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the maximum search depth when searching for Coding Standards.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
private function getMaxDepth()
|
||||
{
|
||||
$maxDepth = 3;
|
||||
|
||||
$extra = $this->composer->getPackage()->getExtra();
|
||||
|
||||
if (array_key_exists(self::KEY_MAX_DEPTH, $extra)) {
|
||||
$maxDepth = $extra[self::KEY_MAX_DEPTH];
|
||||
$minDepth = $this->getMinDepth();
|
||||
|
||||
if (
|
||||
(string) (int) $maxDepth !== (string) $maxDepth /* Must be an integer or cleanly castable to one */
|
||||
|| $maxDepth <= $minDepth /* Larger than the minimum */
|
||||
|| is_float($maxDepth) === true /* Within the boundaries of integer */
|
||||
) {
|
||||
$message = vsprintf(
|
||||
self::MESSAGE_ERROR_WRONG_MAX_DEPTH,
|
||||
array(
|
||||
'key' => self::KEY_MAX_DEPTH,
|
||||
'min' => $minDepth,
|
||||
'given' => var_export($maxDepth, true),
|
||||
)
|
||||
);
|
||||
|
||||
throw new \InvalidArgumentException($message);
|
||||
}
|
||||
}
|
||||
|
||||
return (int) $maxDepth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minimal search depth for Coding Standard packages.
|
||||
*
|
||||
* Usually this is 0, unless PHP_CodeSniffer >= 3 is used.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function getMinDepth()
|
||||
{
|
||||
if ($this->isPHPCodeSnifferInstalled('>= 3.0.0') !== true) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
74
vendor/dflydev/dot-access-data/CHANGELOG.md
vendored
Normal file
74
vendor/dflydev/dot-access-data/CHANGELOG.md
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [3.0.3] - 2024-07-08
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed PHP 8.4 deprecation notices (#47)
|
||||
|
||||
## [3.0.2] - 2022-10-27
|
||||
|
||||
### Fixed
|
||||
|
||||
- Added missing return types to docblocks (#44, #45)
|
||||
|
||||
## [3.0.1] - 2021-08-13
|
||||
|
||||
### Added
|
||||
|
||||
- Adds ReturnTypeWillChange to suppress PHP 8.1 warnings (#40)
|
||||
|
||||
## [3.0.0] - 2021-01-01
|
||||
|
||||
### Added
|
||||
- Added support for both `.` and `/`-delimited key paths (#24)
|
||||
- Added parameter and return types to everything; enabled strict type checks (#18)
|
||||
- Added new exception classes to better identify certain types of errors (#20)
|
||||
- `Data` now implements `ArrayAccess` (#17)
|
||||
- Added ability to merge non-associative array values (#31, #32)
|
||||
|
||||
### Changed
|
||||
- All thrown exceptions are now instances or subclasses of `DataException` (#20)
|
||||
- Calling `get()` on a missing key path without providing a default will throw a `MissingPathException` instead of returning `null` (#29)
|
||||
- Bumped supported PHP versions to 7.1 - 8.x (#18)
|
||||
|
||||
### Fixed
|
||||
- Fixed incorrect merging of array values into string values (#32)
|
||||
- Fixed `get()` method behaving as if keys with `null` values didn't exist
|
||||
|
||||
## [2.0.0] - 2017-12-21
|
||||
|
||||
### Changed
|
||||
- Bumped supported PHP versions to 7.0 - 7.4 (#12)
|
||||
- Switched to PSR-4 autoloading
|
||||
|
||||
## [1.1.0] - 2017-01-20
|
||||
|
||||
### Added
|
||||
- Added new `has()` method to check for the existence of the given key (#4, #7)
|
||||
|
||||
## [1.0.1] - 2015-08-12
|
||||
|
||||
### Added
|
||||
- Added new optional `$default` parameter to the `get()` method (#2)
|
||||
|
||||
## [1.0.0] - 2012-07-17
|
||||
|
||||
**Initial release!**
|
||||
|
||||
[Unreleased]: https://github.com/dflydev/dflydev-dot-access-data/compare/v3.0.3...main
|
||||
[3.0.3]: https://github.com/dflydev/dflydev-dot-access-data/compare/v3.0.2...v3.0.3
|
||||
[3.0.2]: https://github.com/dflydev/dflydev-dot-access-data/compare/v3.0.1...v3.0.2
|
||||
[3.0.1]: https://github.com/dflydev/dflydev-dot-access-data/compare/v3.0.0...v3.0.1
|
||||
[3.0.0]: https://github.com/dflydev/dflydev-dot-access-data/compare/v2.0.0...v3.0.0
|
||||
[2.0.0]: https://github.com/dflydev/dflydev-dot-access-data/compare/v1.1.0...v2.0.0
|
||||
[1.1.0]: https://github.com/dflydev/dflydev-dot-access-data/compare/v1.0.1...v1.1.0
|
||||
[1.0.1]: https://github.com/dflydev/dflydev-dot-access-data/compare/v1.0.0...v1.0.1
|
||||
[1.0.0]: https://github.com/dflydev/dflydev-dot-access-data/releases/tag/v1.0.0
|
||||
19
vendor/dflydev/dot-access-data/LICENSE
vendored
Normal file
19
vendor/dflydev/dot-access-data/LICENSE
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2012 Dragonfly Development Inc.
|
||||
|
||||
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.
|
||||
158
vendor/dflydev/dot-access-data/README.md
vendored
Normal file
158
vendor/dflydev/dot-access-data/README.md
vendored
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
Dot Access Data
|
||||
===============
|
||||
|
||||
[](https://packagist.org/packages/dflydev/dot-access-data)
|
||||
[](https://packagist.org/packages/dflydev/dot-access-data)
|
||||
[](LICENSE)
|
||||
[](https://github.com/dflydev/dflydev-dot-access-data/actions?query=workflow%3ATests+branch%3Amain)
|
||||
[](https://scrutinizer-ci.com/g/dflydev/dflydev-dot-access-data/code-structure/)
|
||||
[](https://scrutinizer-ci.com/g/dflydev/dflydev-dot-access-data)
|
||||
|
||||
Given a deep data structure, access data by dot notation.
|
||||
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
* PHP (7.1+)
|
||||
|
||||
> For PHP (5.3+) please refer to version `1.0`.
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Abstract example:
|
||||
|
||||
```php
|
||||
use Dflydev\DotAccessData\Data;
|
||||
|
||||
$data = new Data;
|
||||
|
||||
$data->set('a.b.c', 'C');
|
||||
$data->set('a.b.d', 'D1');
|
||||
$data->append('a.b.d', 'D2');
|
||||
$data->set('a.b.e', ['E0', 'E1', 'E2']);
|
||||
|
||||
// C
|
||||
$data->get('a.b.c');
|
||||
|
||||
// ['D1', 'D2']
|
||||
$data->get('a.b.d');
|
||||
|
||||
// ['E0', 'E1', 'E2']
|
||||
$data->get('a.b.e');
|
||||
|
||||
// true
|
||||
$data->has('a.b.c');
|
||||
|
||||
// false
|
||||
$data->has('a.b.d.j');
|
||||
|
||||
|
||||
// 'some-default-value'
|
||||
$data->get('some.path.that.does.not.exist', 'some-default-value');
|
||||
|
||||
// throws a MissingPathException because no default was given
|
||||
$data->get('some.path.that.does.not.exist');
|
||||
```
|
||||
|
||||
A more concrete example:
|
||||
|
||||
```php
|
||||
use Dflydev\DotAccessData\Data;
|
||||
|
||||
$data = new Data([
|
||||
'hosts' => [
|
||||
'hewey' => [
|
||||
'username' => 'hman',
|
||||
'password' => 'HPASS',
|
||||
'roles' => ['web'],
|
||||
],
|
||||
'dewey' => [
|
||||
'username' => 'dman',
|
||||
'password' => 'D---S',
|
||||
'roles' => ['web', 'db'],
|
||||
'nick' => 'dewey dman',
|
||||
],
|
||||
'lewey' => [
|
||||
'username' => 'lman',
|
||||
'password' => 'LP@$$',
|
||||
'roles' => ['db'],
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
// hman
|
||||
$username = $data->get('hosts.hewey.username');
|
||||
// HPASS
|
||||
$password = $data->get('hosts.hewey.password');
|
||||
// ['web']
|
||||
$roles = $data->get('hosts.hewey.roles');
|
||||
// dewey dman
|
||||
$nick = $data->get('hosts.dewey.nick');
|
||||
// Unknown
|
||||
$nick = $data->get('hosts.lewey.nick', 'Unknown');
|
||||
|
||||
// DataInterface instance
|
||||
$dewey = $data->getData('hosts.dewey');
|
||||
// dman
|
||||
$username = $dewey->get('username');
|
||||
// D---S
|
||||
$password = $dewey->get('password');
|
||||
// ['web', 'db']
|
||||
$roles = $dewey->get('roles');
|
||||
|
||||
// No more lewey
|
||||
$data->remove('hosts.lewey');
|
||||
|
||||
// Add DB to hewey's roles
|
||||
$data->append('hosts.hewey.roles', 'db');
|
||||
|
||||
$data->set('hosts.april', [
|
||||
'username' => 'aman',
|
||||
'password' => '@---S',
|
||||
'roles' => ['web'],
|
||||
]);
|
||||
|
||||
// Check if a key exists (true to this case)
|
||||
$hasKey = $data->has('hosts.dewey.username');
|
||||
```
|
||||
|
||||
`Data` may be used as an array, since it implements `ArrayAccess` interface:
|
||||
|
||||
```php
|
||||
// Get
|
||||
$data->get('name') === $data['name']; // true
|
||||
|
||||
$data['name'] = 'Dewey';
|
||||
// is equivalent to
|
||||
$data->set($name, 'Dewey');
|
||||
|
||||
isset($data['name']) === $data->has('name');
|
||||
|
||||
// Remove key
|
||||
unset($data['name']);
|
||||
```
|
||||
|
||||
`/` can also be used as a path delimiter:
|
||||
|
||||
```php
|
||||
$data->set('a/b/c', 'd');
|
||||
echo $data->get('a/b/c'); // "d"
|
||||
|
||||
$data->get('a/b/c') === $data->get('a.b.c'); // true
|
||||
```
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
This library is licensed under the MIT License - see the LICENSE file
|
||||
for details.
|
||||
|
||||
|
||||
Community
|
||||
---------
|
||||
|
||||
If you have questions or want to help out, join us in the
|
||||
[#dflydev](irc://irc.freenode.net/#dflydev) channel on irc.freenode.net.
|
||||
67
vendor/dflydev/dot-access-data/composer.json
vendored
Normal file
67
vendor/dflydev/dot-access-data/composer.json
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"name": "dflydev/dot-access-data",
|
||||
"type": "library",
|
||||
"description": "Given a deep data structure, access data by dot notation.",
|
||||
"homepage": "https://github.com/dflydev/dflydev-dot-access-data",
|
||||
"keywords": ["dot", "access", "data", "notation"],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Dragonfly Development Inc.",
|
||||
"email": "info@dflydev.com",
|
||||
"homepage": "http://dflydev.com"
|
||||
},
|
||||
{
|
||||
"name": "Beau Simensen",
|
||||
"email": "beau@dflydev.com",
|
||||
"homepage": "http://beausimensen.com"
|
||||
},
|
||||
{
|
||||
"name": "Carlos Frutos",
|
||||
"email": "carlos@kiwing.it",
|
||||
"homepage": "https://github.com/cfrutos"
|
||||
},
|
||||
{
|
||||
"name": "Colin O'Dell",
|
||||
"email": "colinodell@gmail.com",
|
||||
"homepage": "https://www.colinodell.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^0.12.42",
|
||||
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.3",
|
||||
"scrutinizer/ocular": "1.6.0",
|
||||
"squizlabs/php_codesniffer": "^3.5",
|
||||
"vimeo/psalm": "^4.0.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Dflydev\\DotAccessData\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Dflydev\\DotAccessData\\": "tests/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.x-dev"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"phpcs": "phpcs",
|
||||
"phpstan": "phpstan analyse",
|
||||
"phpunit": "phpunit --no-coverage",
|
||||
"psalm": "psalm",
|
||||
"test": [
|
||||
"@phpcs",
|
||||
"@phpstan",
|
||||
"@psalm",
|
||||
"@phpunit"
|
||||
]
|
||||
}
|
||||
}
|
||||
286
vendor/dflydev/dot-access-data/src/Data.php
vendored
Normal file
286
vendor/dflydev/dot-access-data/src/Data.php
vendored
Normal file
|
|
@ -0,0 +1,286 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is a part of dflydev/dot-access-data.
|
||||
*
|
||||
* (c) Dragonfly Development Inc.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Dflydev\DotAccessData;
|
||||
|
||||
use ArrayAccess;
|
||||
use Dflydev\DotAccessData\Exception\DataException;
|
||||
use Dflydev\DotAccessData\Exception\InvalidPathException;
|
||||
use Dflydev\DotAccessData\Exception\MissingPathException;
|
||||
|
||||
/**
|
||||
* @implements ArrayAccess<string, mixed>
|
||||
*/
|
||||
class Data implements DataInterface, ArrayAccess
|
||||
{
|
||||
private const DELIMITERS = ['.', '/'];
|
||||
|
||||
/**
|
||||
* Internal representation of data data
|
||||
*
|
||||
* @var array<string, mixed>
|
||||
*/
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
*/
|
||||
public function __construct(array $data = [])
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function append(string $key, $value = null): void
|
||||
{
|
||||
$currentValue =& $this->data;
|
||||
$keyPath = self::keyToPathArray($key);
|
||||
|
||||
$endKey = array_pop($keyPath);
|
||||
foreach ($keyPath as $currentKey) {
|
||||
if (! isset($currentValue[$currentKey])) {
|
||||
$currentValue[$currentKey] = [];
|
||||
}
|
||||
$currentValue =& $currentValue[$currentKey];
|
||||
}
|
||||
|
||||
if (!isset($currentValue[$endKey])) {
|
||||
$currentValue[$endKey] = [];
|
||||
}
|
||||
|
||||
if (!is_array($currentValue[$endKey])) {
|
||||
// Promote this key to an array.
|
||||
// TODO: Is this really what we want to do?
|
||||
$currentValue[$endKey] = [$currentValue[$endKey]];
|
||||
}
|
||||
|
||||
$currentValue[$endKey][] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set(string $key, $value = null): void
|
||||
{
|
||||
$currentValue =& $this->data;
|
||||
$keyPath = self::keyToPathArray($key);
|
||||
|
||||
$endKey = array_pop($keyPath);
|
||||
foreach ($keyPath as $currentKey) {
|
||||
if (!isset($currentValue[$currentKey])) {
|
||||
$currentValue[$currentKey] = [];
|
||||
}
|
||||
if (!is_array($currentValue[$currentKey])) {
|
||||
throw new DataException(sprintf('Key path "%s" within "%s" cannot be indexed into (is not an array)', $currentKey, self::formatPath($key)));
|
||||
}
|
||||
$currentValue =& $currentValue[$currentKey];
|
||||
}
|
||||
$currentValue[$endKey] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function remove(string $key): void
|
||||
{
|
||||
$currentValue =& $this->data;
|
||||
$keyPath = self::keyToPathArray($key);
|
||||
|
||||
$endKey = array_pop($keyPath);
|
||||
foreach ($keyPath as $currentKey) {
|
||||
if (!isset($currentValue[$currentKey])) {
|
||||
return;
|
||||
}
|
||||
$currentValue =& $currentValue[$currentKey];
|
||||
}
|
||||
unset($currentValue[$endKey]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @psalm-mutation-free
|
||||
*/
|
||||
public function get(string $key, $default = null)
|
||||
{
|
||||
/** @psalm-suppress ImpureFunctionCall */
|
||||
$hasDefault = \func_num_args() > 1;
|
||||
|
||||
$currentValue = $this->data;
|
||||
$keyPath = self::keyToPathArray($key);
|
||||
|
||||
foreach ($keyPath as $currentKey) {
|
||||
if (!is_array($currentValue) || !array_key_exists($currentKey, $currentValue)) {
|
||||
if ($hasDefault) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
throw new MissingPathException($key, sprintf('No data exists at the given path: "%s"', self::formatPath($keyPath)));
|
||||
}
|
||||
|
||||
$currentValue = $currentValue[$currentKey];
|
||||
}
|
||||
|
||||
return $currentValue === null ? $default : $currentValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @psalm-mutation-free
|
||||
*/
|
||||
public function has(string $key): bool
|
||||
{
|
||||
$currentValue = $this->data;
|
||||
|
||||
foreach (self::keyToPathArray($key) as $currentKey) {
|
||||
if (
|
||||
!is_array($currentValue) ||
|
||||
!array_key_exists($currentKey, $currentValue)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
$currentValue = $currentValue[$currentKey];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @psalm-mutation-free
|
||||
*/
|
||||
public function getData(string $key): DataInterface
|
||||
{
|
||||
$value = $this->get($key);
|
||||
if (is_array($value) && Util::isAssoc($value)) {
|
||||
return new Data($value);
|
||||
}
|
||||
|
||||
throw new DataException(sprintf('Value at "%s" could not be represented as a DataInterface', self::formatPath($key)));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function import(array $data, int $mode = self::REPLACE): void
|
||||
{
|
||||
$this->data = Util::mergeAssocArray($this->data, $data, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function importData(DataInterface $data, int $mode = self::REPLACE): void
|
||||
{
|
||||
$this->import($data->export(), $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @psalm-mutation-free
|
||||
*/
|
||||
public function export(): array
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists($key)
|
||||
{
|
||||
return $this->has($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($key)
|
||||
{
|
||||
return $this->get($key, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet($key, $value)
|
||||
{
|
||||
$this->set($key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($key)
|
||||
{
|
||||
$this->remove($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
*
|
||||
* @return string[]
|
||||
*
|
||||
* @psalm-return non-empty-list<string>
|
||||
*
|
||||
* @psalm-pure
|
||||
*/
|
||||
protected static function keyToPathArray(string $path): array
|
||||
{
|
||||
if (\strlen($path) === 0) {
|
||||
throw new InvalidPathException('Path cannot be an empty string');
|
||||
}
|
||||
|
||||
$path = \str_replace(self::DELIMITERS, '.', $path);
|
||||
|
||||
return \explode('.', $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|string[] $path
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @psalm-pure
|
||||
*/
|
||||
protected static function formatPath($path): string
|
||||
{
|
||||
if (is_string($path)) {
|
||||
$path = self::keyToPathArray($path);
|
||||
}
|
||||
|
||||
return implode(' » ', $path);
|
||||
}
|
||||
}
|
||||
131
vendor/dflydev/dot-access-data/src/DataInterface.php
vendored
Normal file
131
vendor/dflydev/dot-access-data/src/DataInterface.php
vendored
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is a part of dflydev/dot-access-data.
|
||||
*
|
||||
* (c) Dragonfly Development Inc.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Dflydev\DotAccessData;
|
||||
|
||||
use Dflydev\DotAccessData\Exception\DataException;
|
||||
use Dflydev\DotAccessData\Exception\InvalidPathException;
|
||||
|
||||
interface DataInterface
|
||||
{
|
||||
public const PRESERVE = 0;
|
||||
public const REPLACE = 1;
|
||||
public const MERGE = 2;
|
||||
|
||||
/**
|
||||
* Append a value to a key (assumes key refers to an array value)
|
||||
*
|
||||
* If the key does not yet exist it will be created.
|
||||
* If the key references a non-array it's existing contents will be added into a new array before appending the new value.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @throws InvalidPathException if the given key is empty
|
||||
*/
|
||||
public function append(string $key, $value = null): void;
|
||||
|
||||
/**
|
||||
* Set a value for a key
|
||||
*
|
||||
* If the key does not yet exist it will be created.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @throws InvalidPathException if the given key is empty
|
||||
* @throws DataException if the given key does not target an array
|
||||
*/
|
||||
public function set(string $key, $value = null): void;
|
||||
|
||||
/**
|
||||
* Remove a key
|
||||
*
|
||||
* No exception will be thrown if the key does not exist
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @throws InvalidPathException if the given key is empty
|
||||
*/
|
||||
public function remove(string $key): void;
|
||||
|
||||
/**
|
||||
* Get the raw value for a key
|
||||
*
|
||||
* If the key does not exist, an optional default value can be returned instead.
|
||||
* If no default is provided then an exception will be thrown instead.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws InvalidPathException if the given key is empty
|
||||
* @throws InvalidPathException if the given key does not exist and no default value was given
|
||||
*
|
||||
* @psalm-mutation-free
|
||||
*/
|
||||
public function get(string $key, $default = null);
|
||||
|
||||
/**
|
||||
* Check if the key exists
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws InvalidPathException if the given key is empty
|
||||
*
|
||||
* @psalm-mutation-free
|
||||
*/
|
||||
public function has(string $key): bool;
|
||||
|
||||
/**
|
||||
* Get a data instance for a key
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return DataInterface
|
||||
*
|
||||
* @throws InvalidPathException if the given key is empty
|
||||
* @throws DataException if the given key does not reference an array
|
||||
*
|
||||
* @psalm-mutation-free
|
||||
*/
|
||||
public function getData(string $key): DataInterface;
|
||||
|
||||
/**
|
||||
* Import data into existing data
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
* @param self::PRESERVE|self::REPLACE|self::MERGE $mode
|
||||
*/
|
||||
public function import(array $data, int $mode = self::REPLACE): void;
|
||||
|
||||
/**
|
||||
* Import data from an external data into existing data
|
||||
*
|
||||
* @param DataInterface $data
|
||||
* @param self::PRESERVE|self::REPLACE|self::MERGE $mode
|
||||
*/
|
||||
public function importData(DataInterface $data, int $mode = self::REPLACE): void;
|
||||
|
||||
/**
|
||||
* Export data as raw data
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*
|
||||
* @psalm-mutation-free
|
||||
*/
|
||||
public function export(): array;
|
||||
}
|
||||
21
vendor/dflydev/dot-access-data/src/Exception/DataException.php
vendored
Normal file
21
vendor/dflydev/dot-access-data/src/Exception/DataException.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is a part of dflydev/dot-access-data.
|
||||
*
|
||||
* (c) Dragonfly Development Inc.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Dflydev\DotAccessData\Exception;
|
||||
|
||||
/**
|
||||
* Base runtime exception type thrown by this library
|
||||
*/
|
||||
class DataException extends \RuntimeException
|
||||
{
|
||||
}
|
||||
21
vendor/dflydev/dot-access-data/src/Exception/InvalidPathException.php
vendored
Normal file
21
vendor/dflydev/dot-access-data/src/Exception/InvalidPathException.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is a part of dflydev/dot-access-data.
|
||||
*
|
||||
* (c) Dragonfly Development Inc.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Dflydev\DotAccessData\Exception;
|
||||
|
||||
/**
|
||||
* Thrown when trying to access an invalid path in the data array
|
||||
*/
|
||||
class InvalidPathException extends DataException
|
||||
{
|
||||
}
|
||||
37
vendor/dflydev/dot-access-data/src/Exception/MissingPathException.php
vendored
Normal file
37
vendor/dflydev/dot-access-data/src/Exception/MissingPathException.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is a part of dflydev/dot-access-data.
|
||||
*
|
||||
* (c) Dragonfly Development Inc.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Dflydev\DotAccessData\Exception;
|
||||
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Thrown when trying to access a path that does not exist
|
||||
*/
|
||||
class MissingPathException extends DataException
|
||||
{
|
||||
/** @var string */
|
||||
protected $path;
|
||||
|
||||
public function __construct(string $path, string $message = '', int $code = 0, ?Throwable $previous = null)
|
||||
{
|
||||
$this->path = $path;
|
||||
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
public function getPath(): string
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
}
|
||||
78
vendor/dflydev/dot-access-data/src/Util.php
vendored
Normal file
78
vendor/dflydev/dot-access-data/src/Util.php
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is a part of dflydev/dot-access-data.
|
||||
*
|
||||
* (c) Dragonfly Development Inc.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Dflydev\DotAccessData;
|
||||
|
||||
class Util
|
||||
{
|
||||
/**
|
||||
* Test if array is an associative array
|
||||
*
|
||||
* Note that this function will return true if an array is empty. Meaning
|
||||
* empty arrays will be treated as if they are associative arrays.
|
||||
*
|
||||
* @param array<mixed> $arr
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @psalm-pure
|
||||
*/
|
||||
public static function isAssoc(array $arr): bool
|
||||
{
|
||||
return !count($arr) || count(array_filter(array_keys($arr), 'is_string')) == count($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge contents from one associtative array to another
|
||||
*
|
||||
* @param mixed $to
|
||||
* @param mixed $from
|
||||
* @param DataInterface::PRESERVE|DataInterface::REPLACE|DataInterface::MERGE $mode
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @psalm-pure
|
||||
*/
|
||||
public static function mergeAssocArray($to, $from, int $mode = DataInterface::REPLACE)
|
||||
{
|
||||
if ($mode === DataInterface::MERGE && self::isList($to) && self::isList($from)) {
|
||||
return array_merge($to, $from);
|
||||
}
|
||||
|
||||
if (is_array($from) && is_array($to)) {
|
||||
foreach ($from as $k => $v) {
|
||||
if (!isset($to[$k])) {
|
||||
$to[$k] = $v;
|
||||
} else {
|
||||
$to[$k] = self::mergeAssocArray($to[$k], $v, $mode);
|
||||
}
|
||||
}
|
||||
|
||||
return $to;
|
||||
}
|
||||
|
||||
return $mode === DataInterface::PRESERVE ? $to : $from;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @psalm-pure
|
||||
*/
|
||||
private static function isList($value): bool
|
||||
{
|
||||
return is_array($value) && array_values($value) === $value;
|
||||
}
|
||||
}
|
||||
26
vendor/eduardovillao/wp-since/.editorconfig
vendored
Normal file
26
vendor/eduardovillao/wp-since/.editorconfig
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# EditorConfig: https://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.php]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
max_line_length = 120
|
||||
|
||||
[*.{json,yml,yaml,xml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
1
vendor/eduardovillao/wp-since/.github/CODEOWNERS
vendored
Normal file
1
vendor/eduardovillao/wp-since/.github/CODEOWNERS
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
* @eduardovillao
|
||||
27
vendor/eduardovillao/wp-since/.github/workflows/ci.yml
vendored
Normal file
27
vendor/eduardovillao/wp-since/.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
name: Lint & Test PHP Project
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
quality-checks:
|
||||
name: Code Quality & Tests
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "8.2"
|
||||
tools: composer, phpunit, phpcs
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --no-interaction --prefer-dist
|
||||
|
||||
- name: Run PHPCS (PSR-12)
|
||||
run: composer lint
|
||||
|
||||
- name: Run PHPUnit tests
|
||||
run: composer tests:unit
|
||||
68
vendor/eduardovillao/wp-since/.github/workflows/generate-since.yml
vendored
Normal file
68
vendor/eduardovillao/wp-since/.github/workflows/generate-since.yml
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
name: Generate WP Since Map
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout project
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install PHP depencencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y php php-cli php-mbstring unzip curl
|
||||
|
||||
- name: Install Composer
|
||||
run: |
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
sudo mv composer.phar /usr/local/bin/composer
|
||||
|
||||
- name: Install Composer dependencies
|
||||
run: composer install
|
||||
|
||||
- name: Download WordPress
|
||||
run: |
|
||||
curl -O https://wordpress.org/latest.zip
|
||||
unzip latest.zip -d wp-source
|
||||
mv wp-source/wordpress/* wp-source/
|
||||
|
||||
- name: Generate wp-since.json
|
||||
run: php generate-since-json.php
|
||||
|
||||
- name: Remove temporary files
|
||||
run: rm -rf wp.tar.gz wp-source
|
||||
|
||||
- name: Install GitHub CLI
|
||||
run: sudo apt install gh -y
|
||||
|
||||
- name: Authenticate GitHub CLI
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.WP_SINCE_ACTION }}
|
||||
run: echo "${GH_TOKEN}" | gh auth login --with-token
|
||||
|
||||
- name: Create new branch
|
||||
run: |
|
||||
BRANCH_NAME=update-since-map-${{ github.run_number }}
|
||||
git checkout -b $BRANCH_NAME
|
||||
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --global user.name "GitHub Actions"
|
||||
git add wp-since.json
|
||||
DATE=$(date +"%Y-%m-%d")
|
||||
git commit -m "chore(data): update since map on $DATE" || echo "Nada pra commitar"
|
||||
git push origin $BRANCH_NAME
|
||||
|
||||
- name: Create Pull Request
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.WP_SINCE_ACTION }}
|
||||
run: |
|
||||
gh pr create --head "$BRANCH_NAME" --base main \
|
||||
--title "chore(data): update since map" \
|
||||
--body "This PR was automatically generated by a GitHub Action. It updates the \`wp-since.json\` file with the latest WordPress version and its release date."
|
||||
2
vendor/eduardovillao/wp-since/.gitignore
vendored
Normal file
2
vendor/eduardovillao/wp-since/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/vendor
|
||||
.DS_Store
|
||||
131
vendor/eduardovillao/wp-since/README.md
vendored
Normal file
131
vendor/eduardovillao/wp-since/README.md
vendored
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
# WP Since
|
||||
|
||||

|
||||
[](https://www.php-fig.org/psr/psr-12/)
|
||||
[](./tests)
|
||||
|
||||
**Make sure your plugin works with the right WordPress version — automatically.**
|
||||
Scans your WordPress plugin to detect all used core symbols and validates them against their official @since versions for accurate compatibility checks.
|
||||
|
||||
## ✨ How It Works
|
||||
|
||||
Ever struggled to define the correct minimum WordPress version for your plugin?
|
||||
|
||||
Worried about accidentally using functions or APIs that don’t exist in declared minimum WP version?
|
||||
|
||||
`wp-since` helps you avoid those headaches by automatically analyzing your plugin’s code and checking compatibility against real WordPress versions.
|
||||
|
||||
### Here’s what it does:
|
||||
|
||||
- 🧠 Scans your plugin for used:
|
||||
- Functions
|
||||
- Classes
|
||||
- Class methods (static and instance)
|
||||
- Action and filter hooks
|
||||
- 📖 Reads the declared Requires at least: version from your `readme.txt`
|
||||
- 🗂️ Compares those symbols with a version map built from WordPress core using `@since` tags
|
||||
- 🚨 Reports any used symbols that require a newer WP version than what’s declared
|
||||
|
||||
### Example Output
|
||||
|
||||
Let’s say your plugin uses `register_setting()` (introduced in WP `5.5`), but your `readme.txt` declares compatibility with WordPress `5.4`:
|
||||
|
||||
```bash
|
||||
🔍 Scanning plugin files...
|
||||
✅ Found readme.txt → Minimum version declared: 5.4
|
||||
|
||||
🚨 Compatibility issues found:
|
||||
|
||||
┌──────────────────────┬──────────────────┐
|
||||
│ Symbol │ Introduced in WP │
|
||||
├──────────────────────┼──────────────────┤
|
||||
│ register_setting │ 5.5.0 │
|
||||
└──────────────────────┴──────────────────┘
|
||||
|
||||
📌 Suggested version required: 5.5.0
|
||||
```
|
||||
|
||||
Now imagine your code is fully aligned with your declared version:
|
||||
|
||||
```bash
|
||||
🔍 Scanning plugin files...
|
||||
✅ Found readme.txt → Minimum version declared: 5.5
|
||||
|
||||
🎉 No compatibility issues found!
|
||||
```
|
||||
|
||||
Simple. Powerful. Automatic.
|
||||
Because your plugin deserves reliable compatibility.
|
||||
|
||||
## 🚀 Usage
|
||||
|
||||
**Requirements**
|
||||
|
||||
- PHP 7.4+
|
||||
- Composer
|
||||
|
||||
🛠️ Install via Composer (recommended)
|
||||
|
||||
```bash
|
||||
composer require --dev eduardovillao/wp-since
|
||||
```
|
||||
|
||||
▶️ Run the compatibility check
|
||||
|
||||
```bash
|
||||
./vendor/bin/wp-since check ./path-to-your-plugin
|
||||
```
|
||||
|
||||
### 🧹 Ignore Files & Folders
|
||||
|
||||
By default, wp-since scans all `.php` files in your plugin directory.
|
||||
|
||||
But what about files that don’t make it into your final plugin zip — like tests or dev tools? No worries — wp-since respects your ignore rules.
|
||||
|
||||
**Supported ignore sources:**
|
||||
|
||||
- `.distignore`
|
||||
- `.gitattributes` with `export-ignore`
|
||||
|
||||
If any of those files are present, wp-since will automatically ignore the listed files or folders during analysis — just like svn export or plugin deployment.
|
||||
|
||||
Example: .gitattributes
|
||||
|
||||
```txt
|
||||
/tests/ export-ignore
|
||||
/tools/debug.php export-ignore
|
||||
```
|
||||
|
||||
Example: .distignore
|
||||
|
||||
```txt
|
||||
/tests
|
||||
/tools/debug.php
|
||||
```
|
||||
|
||||
> These paths will be excluded from compatibility checks. This helps avoid false positives caused by test or development files.
|
||||
|
||||
### 📝 Inline Ignore
|
||||
|
||||
You can ignore specific lines from the scan by adding a special inline comment.
|
||||
|
||||
This is useful when you conditionally use a newer function but know it’s safe, like:
|
||||
|
||||
```php
|
||||
if (function_exists('wp_some_new_func')) {
|
||||
return wp_some_new_func(); // @wp-since ignore
|
||||
}
|
||||
```
|
||||
|
||||
> Only inline comments on the same line will be considered — comments above the line won’t trigger ignores.
|
||||
|
||||
## 🛠️ Coming Soon
|
||||
|
||||
- GitHub Action integration
|
||||
- HTML/Markdown reports
|
||||
- Export for CI/CD pipelines
|
||||
|
||||
## 📜 License
|
||||
|
||||
MIT © [Eduardo Villão](https://github.com/eduardovillao)
|
||||
Use freely, contribute gladly.
|
||||
21
vendor/eduardovillao/wp-since/bin/wp-since
vendored
Normal file
21
vendor/eduardovillao/wp-since/bin/wp-since
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
foreach ([__DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php'] as $file) {
|
||||
if (file_exists($file)) {
|
||||
require $file;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
use WP_Since\Runner\PluginCheckCommand;
|
||||
|
||||
if ($argc < 2 || $argv[1] !== 'check') {
|
||||
echo "🛠 Usage: wp-since check /path/to/plugin\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$pluginPath = $argv[2] ?? getcwd();
|
||||
$sinceMapPath = __DIR__ . '/../wp-since.json';
|
||||
|
||||
exit(PluginCheckCommand::run($pluginPath, $sinceMapPath));
|
||||
10
vendor/eduardovillao/wp-since/check-plugin.php
vendored
Normal file
10
vendor/eduardovillao/wp-since/check-plugin.php
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use WP_Since\Runner\PluginCheckCommand;
|
||||
|
||||
$pluginPath = $argv[1] ?? getcwd();
|
||||
$sinceMapPath = __DIR__ . '/wp-since.json';
|
||||
|
||||
exit(PluginCheckCommand::run($pluginPath, $sinceMapPath));
|
||||
35
vendor/eduardovillao/wp-since/composer.json
vendored
Normal file
35
vendor/eduardovillao/wp-since/composer.json
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"name": "eduardovillao/wp-since",
|
||||
"description": "Check WordPress plugin compatibility by analyzing used functions, classes, hooks and comparing against the minimum required WP version.",
|
||||
"type": "library",
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": ">=7.4",
|
||||
"nikic/php-parser": "^4.15"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^10.5",
|
||||
"squizlabs/php_codesniffer": "^3.12"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"WP_Since\\": "src/"
|
||||
}
|
||||
},
|
||||
"bin": [
|
||||
"bin/wp-since"
|
||||
],
|
||||
"scripts": {
|
||||
"check": "php bin/wp-since check ./tests/fixtures/plugin-full-test",
|
||||
"generate-since": "php generate-since-json.php",
|
||||
"tests:unit": "phpunit tests --testdox --colors",
|
||||
"lint": "phpcs",
|
||||
"lint:fix": "phpcbf"
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true,
|
||||
"support": {
|
||||
"issues": "https://github.com/eduardovillao/wp-since/issues",
|
||||
"source": "https://github.com/eduardovillao/wp-since"
|
||||
}
|
||||
}
|
||||
1728
vendor/eduardovillao/wp-since/composer.lock
generated
vendored
Normal file
1728
vendor/eduardovillao/wp-since/composer.lock
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
133
vendor/eduardovillao/wp-since/generate-since-json.php
vendored
Normal file
133
vendor/eduardovillao/wp-since/generate-since-json.php
vendored
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
<?php
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use PhpParser\Error;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\NodeTraverser;
|
||||
use PhpParser\NodeVisitorAbstract;
|
||||
use PhpParser\ParserFactory;
|
||||
use PhpParser\NodeVisitor\ParentConnectingVisitor;
|
||||
|
||||
$sourceDir = __DIR__ . '/wp-source';
|
||||
$outputPath = __DIR__ . '/wp-since.json';
|
||||
|
||||
$excludedPaths = [
|
||||
'wp-content/',
|
||||
'wp-admin/includes/class-pclzip.php',
|
||||
'wp-admin/includes/noop.php',
|
||||
'wp-includes/ID3/',
|
||||
'wp-includes/IXR/',
|
||||
'wp-includes/PHPMailer/',
|
||||
'wp-includes/pomo/',
|
||||
'wp-includes/Requests/',
|
||||
'wp-includes/SimplePie/',
|
||||
'wp-includes/Text/',
|
||||
'wp-includes/sodium_compat/',
|
||||
'wp-includes/js/tinymce',
|
||||
'wp-includes/class-simplepie.php',
|
||||
'wp-includes/atomlib.php',
|
||||
'wp-includes/class-avif-info.php',
|
||||
'wp-includes/class-json.php',
|
||||
'wp-includes/class-pop3.php',
|
||||
'wp-includes/class-requests.php',
|
||||
'wp-includes/class-snoopy.php',
|
||||
'wp-includes/compat.php',
|
||||
'wp-includes/rss.php',
|
||||
];
|
||||
|
||||
$parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7);
|
||||
$result = [];
|
||||
|
||||
class SinceExtractor extends NodeVisitorAbstract
|
||||
{
|
||||
private $file;
|
||||
private $result;
|
||||
|
||||
public function __construct($file, &$result)
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->result = &$result;
|
||||
}
|
||||
|
||||
public function enterNode(Node $node)
|
||||
{
|
||||
$doc = $node->getDocComment();
|
||||
$docText = $doc ? $doc->getText() : null;
|
||||
$since = $this->extractTag($docText, '@since');
|
||||
$deprecated = $this->extractTag($docText, '@deprecated');
|
||||
|
||||
if ($node instanceof Node\Stmt\Function_) {
|
||||
$this->addResult($node->name->toString(), 'function', $since, $deprecated);
|
||||
} elseif ($node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Interface_ || $node instanceof Node\Stmt\Trait_) {
|
||||
$type = $node instanceof Node\Stmt\Class_ ? 'class' : ($node instanceof Node\Stmt\Interface_ ? 'interface' : 'trait');
|
||||
$this->addResult($node->name->toString(), $type, $since, $deprecated);
|
||||
} elseif ($node instanceof Node\Stmt\ClassMethod && !$node->isPrivate()) {
|
||||
$class = $node->getAttribute('parent');
|
||||
$className = $class instanceof Node\Stmt\Class_ && $class->name ? $class->name->toString() : 'Anonymous';
|
||||
$methodName = $node->name->toString();
|
||||
$methodSince = $since ?: ($class && $class->getDocComment() ? $this->extractTag($class->getDocComment()->getText(), '@since') : null);
|
||||
if ($className !== 'Anonymous' && $methodSince) {
|
||||
$this->addResult("$className::$methodName", 'method', $methodSince, $deprecated);
|
||||
}
|
||||
} elseif (
|
||||
$node instanceof Node\Expr\FuncCall &&
|
||||
$node->name instanceof Node\Name &&
|
||||
in_array($node->name->toString(), ['do_action', 'apply_filters'], true)
|
||||
) {
|
||||
$hookNameNode = $node->args[0]->value ?? null;
|
||||
if ($hookNameNode instanceof Node\Scalar\String_) {
|
||||
$hookName = $hookNameNode->value;
|
||||
$this->addResult($hookName, 'hook', $since, $deprecated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function extractTag($docText, $tag)
|
||||
{
|
||||
if ($docText && preg_match('/' . preg_quote($tag) . '\s+([0-9.]+)/', $docText, $matches)) {
|
||||
$version = $matches[1];
|
||||
if ($version === 'MU') return '3.0.0';
|
||||
if (preg_match('/^\d+\.\d+(\.\d+)?$/', $version)) return $version;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private function addResult($name, $type, $since, $deprecated)
|
||||
{
|
||||
if ($since) {
|
||||
$this->result[$name] = array_filter([
|
||||
'type' => $type,
|
||||
'since' => $since,
|
||||
'deprecated' => $deprecated,
|
||||
'file' => $this->file
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($sourceDir));
|
||||
|
||||
foreach ($rii as $file) {
|
||||
if ($file->isDir() || $file->getExtension() !== 'php') continue;
|
||||
$relativePath = str_replace($sourceDir . '/', '', $file->getPathname());
|
||||
|
||||
foreach ($excludedPaths as $excluded) {
|
||||
if (strpos($relativePath, $excluded) === 0) continue 2;
|
||||
}
|
||||
|
||||
try {
|
||||
$code = file_get_contents($file->getPathname());
|
||||
$ast = $parser->parse($code);
|
||||
|
||||
$traverser = new NodeTraverser();
|
||||
$traverser->addVisitor(new ParentConnectingVisitor());
|
||||
$traverser->addVisitor(new SinceExtractor($relativePath, $result));
|
||||
$traverser->traverse($ast);
|
||||
|
||||
} catch (Error $e) {
|
||||
echo "Processing error {$relativePath}: {$e->getMessage()}\n";
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents($outputPath, json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
echo "✅ File generated in: {$outputPath}\n";
|
||||
17
vendor/eduardovillao/wp-since/phpcs.xml
vendored
Normal file
17
vendor/eduardovillao/wp-since/phpcs.xml
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0"?>
|
||||
<ruleset name="WP-Since Ruleset">
|
||||
<description>PHP_CodeSniffer configuration for WP-Since</description>
|
||||
|
||||
<!-- Only PSR-12 -->
|
||||
<rule ref="PSR12"/>
|
||||
|
||||
<!-- To check -->
|
||||
<file>src</file>
|
||||
<file>tests</file>
|
||||
|
||||
<!-- To ignore -->
|
||||
<exclude-pattern>vendor/*</exclude-pattern>
|
||||
<exclude-pattern>tests/fixtures/*</exclude-pattern>
|
||||
|
||||
<arg name="report-width" value="120"/>
|
||||
</ruleset>
|
||||
31
vendor/eduardovillao/wp-since/src/Checker/CompatibilityChecker.php
vendored
Normal file
31
vendor/eduardovillao/wp-since/src/Checker/CompatibilityChecker.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Checker;
|
||||
|
||||
use WP_Since\Utils\VersionHelper;
|
||||
|
||||
class CompatibilityChecker
|
||||
{
|
||||
private array $sinceMap;
|
||||
|
||||
public function __construct(array $sinceMap)
|
||||
{
|
||||
$this->sinceMap = $sinceMap;
|
||||
}
|
||||
|
||||
public function check(array $symbols, string $declaredVersion): array
|
||||
{
|
||||
$incompatible = [];
|
||||
|
||||
foreach ($symbols as $symbol) {
|
||||
if (
|
||||
isset($this->sinceMap[$symbol]) &&
|
||||
VersionHelper::compare($declaredVersion, $this->sinceMap[$symbol]['since']) < 0
|
||||
) {
|
||||
$incompatible[$symbol] = $this->sinceMap[$symbol]['since'];
|
||||
}
|
||||
}
|
||||
|
||||
return $incompatible;
|
||||
}
|
||||
}
|
||||
61
vendor/eduardovillao/wp-since/src/Resolver/IgnoreRulesResolver.php
vendored
Normal file
61
vendor/eduardovillao/wp-since/src/Resolver/IgnoreRulesResolver.php
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Resolver;
|
||||
|
||||
class IgnoreRulesResolver
|
||||
{
|
||||
public static function getIgnoredPaths(string $pluginPath): array
|
||||
{
|
||||
$ignorePatterns = [];
|
||||
|
||||
$distignore = $pluginPath . '/.distignore';
|
||||
if (file_exists($distignore)) {
|
||||
$ignorePatterns = array_merge($ignorePatterns, self::parseIgnoreFile($distignore));
|
||||
}
|
||||
|
||||
$gitattributes = $pluginPath . '/.gitattributes';
|
||||
if (file_exists($gitattributes)) {
|
||||
$ignorePatterns = array_merge($ignorePatterns, self::parseGitAttributes($gitattributes));
|
||||
}
|
||||
|
||||
return array_map(function ($pattern) {
|
||||
return ltrim(rtrim($pattern, '/'), '/');
|
||||
}, $ignorePatterns);
|
||||
}
|
||||
|
||||
private static function parseIgnoreFile(string $file): array
|
||||
{
|
||||
return array_filter(array_map('trim', file($file)), fn($line) => $line !== '' && $line[0] !== '#');
|
||||
}
|
||||
|
||||
private static function parseGitAttributes(string $file): array
|
||||
{
|
||||
$lines = file($file);
|
||||
$ignores = [];
|
||||
|
||||
foreach ($lines as $line) {
|
||||
if (strpos($line, 'export-ignore') !== false) {
|
||||
$parts = preg_split('/\s+/', trim($line));
|
||||
if (!empty($parts[0])) {
|
||||
$ignores[] = $parts[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ignores;
|
||||
}
|
||||
|
||||
public static function shouldIgnore(string $relativePath, array $ignorePaths): bool
|
||||
{
|
||||
foreach ($ignorePaths as $ignored) {
|
||||
$normalized = ltrim($ignored, '/');
|
||||
if (
|
||||
$relativePath === $normalized ||
|
||||
str_starts_with($relativePath, rtrim($normalized, '/') . '/')
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
26
vendor/eduardovillao/wp-since/src/Resolver/InlineIgnoreResolver.php
vendored
Normal file
26
vendor/eduardovillao/wp-since/src/Resolver/InlineIgnoreResolver.php
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Resolver;
|
||||
|
||||
use PhpParser\Lexer\Emulative;
|
||||
|
||||
class InlineIgnoreResolver
|
||||
{
|
||||
public static function extractIgnoredLines(string $code): array
|
||||
{
|
||||
$lexer = new Emulative(['usedAttributes' => ['startLine']]);
|
||||
$lexer->startLexing($code);
|
||||
|
||||
$ignoredLines = [];
|
||||
|
||||
foreach ($lexer->getTokens() as $token) {
|
||||
if (is_array($token) && in_array($token[0], [T_COMMENT, T_DOC_COMMENT], true)) {
|
||||
if (strpos($token[1], '@wp-since ignore') !== false) {
|
||||
$ignoredLines[] = $token[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ignoredLines;
|
||||
}
|
||||
}
|
||||
77
vendor/eduardovillao/wp-since/src/Resolver/VersionResolver.php
vendored
Normal file
77
vendor/eduardovillao/wp-since/src/Resolver/VersionResolver.php
vendored
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Resolver;
|
||||
|
||||
class VersionResolver
|
||||
{
|
||||
public static function resolve(string $pluginPath): ?array
|
||||
{
|
||||
$pluginFile = self::findMainPluginFile($pluginPath);
|
||||
|
||||
if ($pluginFile) {
|
||||
$version = self::extractVersionFromPluginHeader($pluginFile);
|
||||
if ($version) {
|
||||
return ['version' => $version, 'source' => 'main plugin file header'];
|
||||
}
|
||||
}
|
||||
|
||||
$readme = self::findReadmeFile($pluginPath);
|
||||
if ($readme) {
|
||||
$version = self::extractVersionFromReadme($readme);
|
||||
if ($version) {
|
||||
return ['version' => $version, 'source' => 'readme'];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static function findMainPluginFile(string $pluginPath): ?string
|
||||
{
|
||||
$basename = basename($pluginPath);
|
||||
$candidate = "{$pluginPath}/{$basename}.php";
|
||||
if (file_exists($candidate)) {
|
||||
return $candidate;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static function extractVersionFromPluginHeader(string $file): ?string
|
||||
{
|
||||
$contents = file_get_contents($file);
|
||||
if (!$contents) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (preg_match('/^\s*\*\s+Requires at least:\s*([0-9.]+)/mi', $contents, $matches)) {
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static function findReadmeFile(string $pluginPath): ?string
|
||||
{
|
||||
foreach (['readme.txt', 'README.txt'] as $filename) {
|
||||
$full = "{$pluginPath}/{$filename}";
|
||||
if (file_exists($full)) {
|
||||
return $full;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static function extractVersionFromReadme(string $file): ?string
|
||||
{
|
||||
$lines = file($file);
|
||||
foreach ($lines as $line) {
|
||||
if (stripos($line, 'Requires at least:') === 0) {
|
||||
if (preg_match('/Requires at least:\s*([0-9.]+)/i', $line, $matches)) {
|
||||
return $matches[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
57
vendor/eduardovillao/wp-since/src/Runner/PluginCheckCommand.php
vendored
Normal file
57
vendor/eduardovillao/wp-since/src/Runner/PluginCheckCommand.php
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Runner;
|
||||
|
||||
use WP_Since\Resolver\VersionResolver;
|
||||
use WP_Since\Scanner\PluginScanner;
|
||||
use WP_Since\Checker\CompatibilityChecker;
|
||||
use WP_Since\Utils\TablePrinter;
|
||||
use WP_Since\Utils\VersionHelper;
|
||||
|
||||
class PluginCheckCommand
|
||||
{
|
||||
public static function run(string $pluginPath, string $sinceMapPath): int
|
||||
{
|
||||
if (!file_exists($sinceMapPath)) {
|
||||
echo "❌ wp-since.json not found. Run composer generate-since first.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
$versionResolver = VersionResolver::resolve($pluginPath);
|
||||
if (!$versionResolver['version']) {
|
||||
echo "❌ Could not determine the minimum required WP version.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
$source = $versionResolver['source'] ?? '';
|
||||
$declaredVersion = $versionResolver['version'];
|
||||
|
||||
echo "✅ Minimum version declared: {$declaredVersion} (from {$source})\n\n";
|
||||
|
||||
$usedSymbols = PluginScanner::scan($pluginPath);
|
||||
$sinceMap = json_decode(file_get_contents($sinceMapPath), true);
|
||||
|
||||
$checker = new CompatibilityChecker($sinceMap);
|
||||
$incompatible = $checker->check($usedSymbols, $declaredVersion);
|
||||
|
||||
if (count($incompatible)) {
|
||||
echo "🚨 Compatibility issues found:\n\n";
|
||||
$rows = [];
|
||||
foreach ($incompatible as $symbol => $version) {
|
||||
$rows[] = [$symbol, $version];
|
||||
}
|
||||
TablePrinter::render($rows, ['Symbol', 'Introduced in WP']);
|
||||
|
||||
$versions = array_values($incompatible);
|
||||
$maxVersion = array_reduce($versions, function ($carry, $v) {
|
||||
return VersionHelper::compare($carry, $v) < 0 ? $v : $carry;
|
||||
}, $declaredVersion);
|
||||
|
||||
echo "📌 Suggested version required: {$maxVersion}\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
echo "✅ All good! Your plugin is compatible with WP {$declaredVersion}.\n";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
55
vendor/eduardovillao/wp-since/src/Scanner/PluginScanner.php
vendored
Normal file
55
vendor/eduardovillao/wp-since/src/Scanner/PluginScanner.php
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Scanner;
|
||||
|
||||
use PhpParser\NodeTraverser;
|
||||
use PhpParser\ParserFactory;
|
||||
use PhpParser\NodeVisitor\ParentConnectingVisitor;
|
||||
use WP_Since\Resolver\IgnoreRulesResolver;
|
||||
use WP_Since\Scanner\SymbolExtractorVisitor;
|
||||
use WP_Since\Resolver\InlineIgnoreResolver;
|
||||
|
||||
class PluginScanner
|
||||
{
|
||||
public static function scan(string $path): array
|
||||
{
|
||||
$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
|
||||
$traverser = new NodeTraverser();
|
||||
|
||||
$usedSymbols = [];
|
||||
$varMap = [];
|
||||
|
||||
$traverser->addVisitor(new ParentConnectingVisitor());
|
||||
|
||||
$ignorePaths = IgnoreRulesResolver::getIgnoredPaths($path);
|
||||
$rii = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
|
||||
foreach ($rii as $file) {
|
||||
$relativePath = str_replace($path . '/', '', $file->getPathname());
|
||||
|
||||
if (
|
||||
$file->isDir() ||
|
||||
$file->getExtension() !== 'php' ||
|
||||
IgnoreRulesResolver::shouldIgnore($relativePath, $ignorePaths)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$code = file_get_contents($file->getPathname());
|
||||
$ignoredLines = InlineIgnoreResolver::extractIgnoredLines($code);
|
||||
|
||||
$visitor = new SymbolExtractorVisitor($usedSymbols, $varMap, $ignoredLines);
|
||||
$traverser->addVisitor($visitor);
|
||||
|
||||
try {
|
||||
$stmts = $parser->parse($code);
|
||||
$traverser->traverse($stmts);
|
||||
} catch (\Exception $e) {
|
||||
// Add error handling
|
||||
}
|
||||
|
||||
$traverser->removeVisitor($visitor);
|
||||
}
|
||||
|
||||
return array_unique($usedSymbols);
|
||||
}
|
||||
}
|
||||
48
vendor/eduardovillao/wp-since/src/Scanner/SymbolExtractorVisitor.php
vendored
Normal file
48
vendor/eduardovillao/wp-since/src/Scanner/SymbolExtractorVisitor.php
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Scanner;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\NodeVisitorAbstract;
|
||||
use WP_Since\Scanner\SymbolHandlers\SymbolHandlerInterface;
|
||||
|
||||
class SymbolExtractorVisitor extends NodeVisitorAbstract
|
||||
{
|
||||
private array $usedSymbols;
|
||||
private array $varMap;
|
||||
private array $ignoredLines;
|
||||
|
||||
/** @var SymbolHandlerInterface[] */
|
||||
private array $handlers;
|
||||
|
||||
public function __construct(array &$usedSymbols, array &$varMap, array $ignoredLines = [])
|
||||
{
|
||||
$this->usedSymbols = &$usedSymbols;
|
||||
$this->varMap = &$varMap;
|
||||
$this->ignoredLines = $ignoredLines;
|
||||
|
||||
$this->handlers = [
|
||||
new SymbolHandlers\FunctionCallHandler(),
|
||||
new SymbolHandlers\NewClassHandler(),
|
||||
new SymbolHandlers\StaticCallHandler(),
|
||||
new SymbolHandlers\MethodCallHandler(),
|
||||
];
|
||||
}
|
||||
|
||||
public function enterNode(Node $node)
|
||||
{
|
||||
if (in_array($node->getStartLine(), $this->ignoredLines, true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach ($this->handlers as $handler) {
|
||||
if ($handler->supports($node)) {
|
||||
$symbols = $handler->extract($node, $this->varMap);
|
||||
foreach ($symbols as $symbol) {
|
||||
$this->usedSymbols[] = $symbol;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
vendor/eduardovillao/wp-since/src/Scanner/SymbolHandlers/FunctionCallHandler.php
vendored
Normal file
27
vendor/eduardovillao/wp-since/src/Scanner/SymbolHandlers/FunctionCallHandler.php
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Scanner\SymbolHandlers;
|
||||
|
||||
use PhpParser\Node;
|
||||
|
||||
class FunctionCallHandler implements SymbolHandlerInterface
|
||||
{
|
||||
public function supports(Node $node): bool
|
||||
{
|
||||
return $node instanceof Node\Expr\FuncCall && $node->name instanceof Node\Name;
|
||||
}
|
||||
|
||||
public function extract(Node $node, array &$varMap = []): array
|
||||
{
|
||||
$symbols = [(string) $node->name];
|
||||
|
||||
if (in_array((string) $node->name, ['do_action', 'apply_filters'], true)) {
|
||||
$hookNameNode = $node->args[0]->value ?? null;
|
||||
if ($hookNameNode instanceof Node\Scalar\String_) {
|
||||
$symbols[] = $hookNameNode->value;
|
||||
}
|
||||
}
|
||||
|
||||
return $symbols;
|
||||
}
|
||||
}
|
||||
28
vendor/eduardovillao/wp-since/src/Scanner/SymbolHandlers/MethodCallHandler.php
vendored
Normal file
28
vendor/eduardovillao/wp-since/src/Scanner/SymbolHandlers/MethodCallHandler.php
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Scanner\SymbolHandlers;
|
||||
|
||||
use PhpParser\Node;
|
||||
|
||||
class MethodCallHandler implements SymbolHandlerInterface
|
||||
{
|
||||
public function supports(Node $node): bool
|
||||
{
|
||||
return $node instanceof Node\Expr\MethodCall &&
|
||||
$node->var instanceof Node\Expr\Variable &&
|
||||
$node->name instanceof Node\Identifier;
|
||||
}
|
||||
|
||||
public function extract(Node $node, array &$varMap = []): array
|
||||
{
|
||||
$varName = $node->var->name;
|
||||
$method = (string) $node->name;
|
||||
|
||||
if (is_string($varName) && isset($varMap[$varName])) {
|
||||
$class = $varMap[$varName];
|
||||
return ["$class::$method"];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
29
vendor/eduardovillao/wp-since/src/Scanner/SymbolHandlers/NewClassHandler.php
vendored
Normal file
29
vendor/eduardovillao/wp-since/src/Scanner/SymbolHandlers/NewClassHandler.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Scanner\SymbolHandlers;
|
||||
|
||||
use PhpParser\Node;
|
||||
|
||||
class NewClassHandler implements SymbolHandlerInterface
|
||||
{
|
||||
public function supports(Node $node): bool
|
||||
{
|
||||
return $node instanceof Node\Expr\New_ && $node->class instanceof Node\Name;
|
||||
}
|
||||
|
||||
public function extract(Node $node, array &$varMap = []): array
|
||||
{
|
||||
$symbols = [(string) $node->class];
|
||||
|
||||
$parent = $node->getAttribute('parent');
|
||||
if (
|
||||
$parent instanceof Node\Expr\Assign &&
|
||||
$parent->var instanceof Node\Expr\Variable &&
|
||||
is_string($parent->var->name)
|
||||
) {
|
||||
$varMap[$parent->var->name] = (string) $node->class;
|
||||
}
|
||||
|
||||
return $symbols;
|
||||
}
|
||||
}
|
||||
22
vendor/eduardovillao/wp-since/src/Scanner/SymbolHandlers/StaticCallHandler.php
vendored
Normal file
22
vendor/eduardovillao/wp-since/src/Scanner/SymbolHandlers/StaticCallHandler.php
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Scanner\SymbolHandlers;
|
||||
|
||||
use PhpParser\Node;
|
||||
|
||||
class StaticCallHandler implements SymbolHandlerInterface
|
||||
{
|
||||
public function supports(Node $node): bool
|
||||
{
|
||||
return $node instanceof Node\Expr\StaticCall &&
|
||||
$node->class instanceof Node\Name &&
|
||||
$node->name instanceof Node\Identifier;
|
||||
}
|
||||
|
||||
public function extract(Node $node, array &$varMap = []): array
|
||||
{
|
||||
$class = (string) $node->class;
|
||||
$method = (string) $node->name;
|
||||
return ["$class::$method"];
|
||||
}
|
||||
}
|
||||
15
vendor/eduardovillao/wp-since/src/Scanner/SymbolHandlers/SymbolHandlerInterface.php
vendored
Normal file
15
vendor/eduardovillao/wp-since/src/Scanner/SymbolHandlers/SymbolHandlerInterface.php
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Scanner\SymbolHandlers;
|
||||
|
||||
use PhpParser\Node;
|
||||
|
||||
interface SymbolHandlerInterface
|
||||
{
|
||||
public function supports(Node $node): bool;
|
||||
|
||||
/**
|
||||
* @return string[] Symbols extracted from the node
|
||||
*/
|
||||
public function extract(Node $node, array &$varMap = []): array;
|
||||
}
|
||||
46
vendor/eduardovillao/wp-since/src/Utils/TablePrinter.php
vendored
Normal file
46
vendor/eduardovillao/wp-since/src/Utils/TablePrinter.php
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Utils;
|
||||
|
||||
class TablePrinter
|
||||
{
|
||||
public static function render(array $rows, array $headers): void
|
||||
{
|
||||
$widths = [];
|
||||
foreach ($headers as $i => $header) {
|
||||
$widths[$i] = strlen($header);
|
||||
}
|
||||
|
||||
foreach ($rows as $row) {
|
||||
foreach ($row as $i => $cell) {
|
||||
$widths[$i] = max($widths[$i], strlen($cell));
|
||||
}
|
||||
}
|
||||
|
||||
$drawLine = function ($left, $middle, $right, $fill = '─') use ($widths) {
|
||||
echo $left;
|
||||
foreach ($widths as $i => $w) {
|
||||
echo str_repeat($fill, $w + 2);
|
||||
echo $i < count($widths) - 1 ? $middle : $right;
|
||||
}
|
||||
echo "\n";
|
||||
};
|
||||
|
||||
$drawRow = function ($row, $sep = '│') use ($widths) {
|
||||
echo $sep;
|
||||
foreach ($row as $i => $cell) {
|
||||
echo ' ' . str_pad($cell, $widths[$i]) . ' ' . $sep;
|
||||
}
|
||||
echo "\n";
|
||||
};
|
||||
|
||||
$drawLine('┌', '┬', '┐');
|
||||
$drawRow($headers);
|
||||
$drawLine('├', '┼', '┤');
|
||||
foreach ($rows as $row) {
|
||||
$drawRow($row);
|
||||
}
|
||||
$drawLine('└', '┴', '┘');
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
33
vendor/eduardovillao/wp-since/src/Utils/VersionHelper.php
vendored
Normal file
33
vendor/eduardovillao/wp-since/src/Utils/VersionHelper.php
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Utils;
|
||||
|
||||
class VersionHelper
|
||||
{
|
||||
/**
|
||||
* Normaliza uma versão para o formato x.y.z (ex: 5.5 → 5.5.0)
|
||||
*/
|
||||
public static function normalize(string $version): string
|
||||
{
|
||||
$parts = explode('.', $version);
|
||||
while (count($parts) < 3) {
|
||||
$parts[] = '0';
|
||||
}
|
||||
return implode('.', $parts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compara duas versões, normalizando ambas.
|
||||
*
|
||||
* @param string $versionA
|
||||
* @param string $versionB
|
||||
* @return int Retorna -1 se A < B, 0 se A == B, 1 se A > B
|
||||
*/
|
||||
public static function compare(string $versionA, string $versionB): int
|
||||
{
|
||||
return version_compare(
|
||||
self::normalize($versionA),
|
||||
self::normalize($versionB)
|
||||
);
|
||||
}
|
||||
}
|
||||
53
vendor/eduardovillao/wp-since/tests/CompatibilityCheckerTest.php
vendored
Normal file
53
vendor/eduardovillao/wp-since/tests/CompatibilityCheckerTest.php
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use WP_Since\Checker\CompatibilityChecker;
|
||||
|
||||
class CompatibilityCheckerTest extends TestCase
|
||||
{
|
||||
public function testDetectsIncompatibleSymbols()
|
||||
{
|
||||
$sinceMap = [
|
||||
'register_setting' => ['since' => '5.5.0'],
|
||||
'WP_Query' => ['since' => '3.0.0'],
|
||||
'MyClass::boot' => ['since' => '6.2.0'],
|
||||
'custom_hook' => ['since' => '6.0.0'],
|
||||
];
|
||||
|
||||
$symbols = [
|
||||
'register_setting',
|
||||
'WP_Query',
|
||||
'MyClass::boot',
|
||||
'custom_hook',
|
||||
];
|
||||
|
||||
$declaredVersion = '5.5';
|
||||
|
||||
$checker = new CompatibilityChecker($sinceMap);
|
||||
$incompatible = $checker->check($symbols, $declaredVersion);
|
||||
|
||||
$this->assertArrayHasKey('MyClass::boot', $incompatible);
|
||||
$this->assertArrayHasKey('custom_hook', $incompatible);
|
||||
$this->assertArrayNotHasKey('register_setting', $incompatible);
|
||||
$this->assertArrayNotHasKey('WP_Query', $incompatible);
|
||||
$this->assertEquals('6.2.0', $incompatible['MyClass::boot']);
|
||||
}
|
||||
|
||||
public function testAllSymbolsCompatible()
|
||||
{
|
||||
$sinceMap = [
|
||||
'function_one' => ['since' => '5.1.0'],
|
||||
'function_two' => ['since' => '5.0.0'],
|
||||
];
|
||||
|
||||
$symbols = ['function_one', 'function_two'];
|
||||
$declaredVersion = '5.5.0';
|
||||
|
||||
$checker = new CompatibilityChecker($sinceMap);
|
||||
$incompatible = $checker->check($symbols, $declaredVersion);
|
||||
|
||||
$this->assertEmpty($incompatible);
|
||||
}
|
||||
}
|
||||
52
vendor/eduardovillao/wp-since/tests/Integration/FullCompatibilityFlowTest.php
vendored
Normal file
52
vendor/eduardovillao/wp-since/tests/Integration/FullCompatibilityFlowTest.php
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Tests\Integration;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use WP_Since\Resolver\VersionResolver;
|
||||
use WP_Since\Scanner\PluginScanner;
|
||||
use WP_Since\Checker\CompatibilityChecker;
|
||||
|
||||
class FullCompatibilityFlowTest extends TestCase
|
||||
{
|
||||
public function testDetectsAllTypesOfSymbolsCorrectly()
|
||||
{
|
||||
$pluginPath = __DIR__ . '/../fixtures/plugin-full-test';
|
||||
|
||||
$declaredVersion = VersionResolver::resolve($pluginPath);
|
||||
$symbols = PluginScanner::scan($pluginPath);
|
||||
|
||||
$this->assertNotNull($declaredVersion, 'Declared version should not be null');
|
||||
$this->assertEquals('5.5', $declaredVersion['version']);
|
||||
|
||||
$sinceMap = [
|
||||
'add_option' => ['since' => '2.0.0'],
|
||||
'WP_Query' => ['since' => '3.0.0'],
|
||||
'WP_Filesystem::get_contents' => ['since' => '5.1.0'],
|
||||
'WP_User::add_cap' => ['since' => '5.7.0'],
|
||||
'my_custom_hook' => ['since' => '6.0.0'],
|
||||
'my_filter_hook' => ['since' => '5.3.0'],
|
||||
];
|
||||
|
||||
$checker = new CompatibilityChecker($sinceMap);
|
||||
$incompatible = $checker->check($symbols, $declaredVersion['version']);
|
||||
|
||||
$this->assertArrayHasKey('WP_User::add_cap', $incompatible);
|
||||
$this->assertArrayHasKey('my_custom_hook', $incompatible);
|
||||
|
||||
$this->assertArrayNotHasKey('add_option', $incompatible);
|
||||
$this->assertArrayNotHasKey('WP_Query', $incompatible);
|
||||
$this->assertArrayNotHasKey('WP_Filesystem::get_contents', $incompatible);
|
||||
$this->assertArrayNotHasKey('my_filter_hook', $incompatible);
|
||||
|
||||
$expected = array_keys($sinceMap);
|
||||
foreach ($expected as $symbol) {
|
||||
$this->assertContains($symbol, $symbols, "Missing symbol: {$symbol}");
|
||||
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
$this->assertNotContains('some_ignored_func_folder', $symbols, 'Should ignore folder from /ignored-folder/');
|
||||
$this->assertNotContains('some_ignored_func_file', $symbols, 'Should ignore specific file /ignore-this.php');
|
||||
$this->assertNotContains('some_ignored_func_noslash', $symbols, 'Should ignore folder from ignored-no-slash/');
|
||||
}
|
||||
}
|
||||
}
|
||||
44
vendor/eduardovillao/wp-since/tests/PluginScannerTest.php
vendored
Normal file
44
vendor/eduardovillao/wp-since/tests/PluginScannerTest.php
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use WP_Since\Scanner\PluginScanner;
|
||||
|
||||
final class PluginScannerTest extends TestCase
|
||||
{
|
||||
public function testDetectsAllSymbols()
|
||||
{
|
||||
$pluginPath = __DIR__ . '/fixtures/plugin-full-test';
|
||||
$symbols = PluginScanner::scan($pluginPath);
|
||||
|
||||
$expected = [
|
||||
'add_option',
|
||||
'WP_Query',
|
||||
'WP_Filesystem::get_contents',
|
||||
'WP_User::add_cap',
|
||||
'my_custom_hook',
|
||||
'my_filter_hook',
|
||||
];
|
||||
|
||||
foreach ($expected as $symbol) {
|
||||
$this->assertContains($symbol, $symbols, "Missing: $symbol");
|
||||
}
|
||||
}
|
||||
|
||||
public function testIgnoresSymbolsMarkedWithIgnoreComment()
|
||||
{
|
||||
$path = __DIR__ . '/fixtures/plugin-ignore-comment';
|
||||
$symbols = PluginScanner::scan($path);
|
||||
|
||||
$this->assertNotContains('add_option', $symbols, 'Should ignore symbol with @wp-since ignore');
|
||||
$this->assertNotContains('should_be_ignored', $symbols, 'Should ignore symbolwith @wp-since ignore');
|
||||
$this->assertNotContains('wp_is_block_theme', $symbols, 'Should ignore symbol with @wp-since ignore');
|
||||
$this->assertNotContains('should_be_ignored_space', $symbols, 'Should ignore symbol with @wp-since ignore');
|
||||
$this->assertContains('do_action', $symbols, 'Should detect function call without ignore comment');
|
||||
$this->assertContains('my_custom_hook', $symbols, 'Should detect function call without ignore comment');
|
||||
$this->assertContains('register_setting', $symbols, 'Should detect function call without ignore comment');
|
||||
$this->assertContains('wp_detected_function', $symbols, 'Should detect function call without ignore comment');
|
||||
$this->assertContains('need_detect', $symbols, 'Should detect function call without ignore comment');
|
||||
}
|
||||
}
|
||||
42
vendor/eduardovillao/wp-since/tests/Resolver/IgnoreRulesResolverTest.php
vendored
Normal file
42
vendor/eduardovillao/wp-since/tests/Resolver/IgnoreRulesResolverTest.php
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Tests\Resolver;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use WP_Since\Resolver\IgnoreRulesResolver;
|
||||
|
||||
class IgnoreRulesResolverTest extends TestCase
|
||||
{
|
||||
public function testShouldIgnoreExactMatch()
|
||||
{
|
||||
$ignorePaths = ['tests/', 'assets/', 'example.php'];
|
||||
|
||||
$this->assertTrue(IgnoreRulesResolver::shouldIgnore('tests/helper.php', $ignorePaths));
|
||||
$this->assertTrue(IgnoreRulesResolver::shouldIgnore('assets/img/logo.png', $ignorePaths));
|
||||
$this->assertTrue(IgnoreRulesResolver::shouldIgnore('example.php', $ignorePaths));
|
||||
}
|
||||
|
||||
public function testShouldNotIgnoreNonMatchingPath()
|
||||
{
|
||||
$ignorePaths = ['tests/', 'vendor/', 'docs/readme.txt'];
|
||||
|
||||
$this->assertFalse(IgnoreRulesResolver::shouldIgnore('src/Plugin.php', $ignorePaths));
|
||||
$this->assertFalse(IgnoreRulesResolver::shouldIgnore('includes/functions.php', $ignorePaths));
|
||||
}
|
||||
|
||||
public function testShouldIgnoreNestedPaths()
|
||||
{
|
||||
$ignorePaths = ['admin/'];
|
||||
|
||||
$this->assertTrue(IgnoreRulesResolver::shouldIgnore('admin/settings/page.php', $ignorePaths));
|
||||
$this->assertTrue(IgnoreRulesResolver::shouldIgnore('admin/page.php', $ignorePaths));
|
||||
}
|
||||
|
||||
public function testShouldIgnoreWithOrWithoutLeadingSlash()
|
||||
{
|
||||
$ignorePaths = ['/build/', 'temp/'];
|
||||
|
||||
$this->assertTrue(IgnoreRulesResolver::shouldIgnore('build/bundle.js', $ignorePaths));
|
||||
$this->assertTrue(IgnoreRulesResolver::shouldIgnore('temp/cache.php', $ignorePaths));
|
||||
}
|
||||
}
|
||||
29
vendor/eduardovillao/wp-since/tests/TablePrinterTest.php
vendored
Normal file
29
vendor/eduardovillao/wp-since/tests/TablePrinterTest.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use WP_Since\Utils\TablePrinter;
|
||||
|
||||
class TablePrinterTest extends TestCase
|
||||
{
|
||||
public function testRenderOutputsCorrectTable()
|
||||
{
|
||||
$headers = ['Name', 'Version'];
|
||||
$rows = [
|
||||
['register_setting', '5.5.0'],
|
||||
['some_function', '6.0.0'],
|
||||
];
|
||||
|
||||
ob_start();
|
||||
TablePrinter::render($rows, $headers);
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertStringContainsString('register_setting', $output);
|
||||
$this->assertStringContainsString('some_function', $output);
|
||||
$this->assertStringContainsString('┌', $output);
|
||||
$this->assertStringContainsString('┴', $output);
|
||||
$this->assertStringContainsString('│ Name', $output);
|
||||
$this->assertStringContainsString('│ Version', $output);
|
||||
}
|
||||
}
|
||||
24
vendor/eduardovillao/wp-since/tests/VersionHelperTest.php
vendored
Normal file
24
vendor/eduardovillao/wp-since/tests/VersionHelperTest.php
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use WP_Since\Utils\VersionHelper;
|
||||
|
||||
class VersionHelperTest extends TestCase
|
||||
{
|
||||
public function testNormalizeShortVersions()
|
||||
{
|
||||
$this->assertEquals('5.5.0', VersionHelper::normalize('5.5'));
|
||||
$this->assertEquals('5.0.0', VersionHelper::normalize('5'));
|
||||
$this->assertEquals('6.1.2', VersionHelper::normalize('6.1.2'));
|
||||
}
|
||||
|
||||
public function testCompareVersions()
|
||||
{
|
||||
$this->assertSame(0, VersionHelper::compare('5.5', '5.5.0'));
|
||||
$this->assertSame(0, VersionHelper::compare('6.1.0', '6.1'));
|
||||
$this->assertSame(1, VersionHelper::compare('6.2', '6.1.5'));
|
||||
$this->assertSame(-1, VersionHelper::compare('5.9', '6.0'));
|
||||
}
|
||||
}
|
||||
35
vendor/eduardovillao/wp-since/tests/VersionResolverTest.php
vendored
Normal file
35
vendor/eduardovillao/wp-since/tests/VersionResolverTest.php
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use WP_Since\Resolver\VersionResolver;
|
||||
|
||||
class VersionResolverTest extends TestCase
|
||||
{
|
||||
public function testExtractsVersionFromMainPluginFile()
|
||||
{
|
||||
$path = __DIR__ . '/fixtures/plugin-with-header';
|
||||
$resolved = VersionResolver::resolve($path);
|
||||
|
||||
$this->assertEquals('6.2', $resolved['version']);
|
||||
$this->assertEquals('main plugin file header', $resolved['source']);
|
||||
}
|
||||
|
||||
public function testExtractsVersionFromReadmeIfNoHeader()
|
||||
{
|
||||
$path = __DIR__ . '/fixtures/plugin-with-readme-only';
|
||||
$resolved = VersionResolver::resolve($path);
|
||||
|
||||
$this->assertEquals('5.8', $resolved['version']);
|
||||
$this->assertEquals('readme', $resolved['source']);
|
||||
}
|
||||
|
||||
public function testReturnsNullIfVersionNotFoundAnywhere()
|
||||
{
|
||||
$path = __DIR__ . '/fixtures/plugin-without-version';
|
||||
$resolved = VersionResolver::resolve($path);
|
||||
|
||||
$this->assertNull($resolved);
|
||||
}
|
||||
}
|
||||
5
vendor/eduardovillao/wp-since/tests/fixtures/file-a.php
vendored
Normal file
5
vendor/eduardovillao/wp-since/tests/fixtures/file-a.php
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
do_action('init');
|
||||
register_setting('group', 'option');
|
||||
new WP_Query();
|
||||
4
vendor/eduardovillao/wp-since/tests/fixtures/file-b.php
vendored
Normal file
4
vendor/eduardovillao/wp-since/tests/fixtures/file-b.php
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
|
||||
apply_filters('custom_filter', $value);
|
||||
MyClass::boot();
|
||||
3
vendor/eduardovillao/wp-since/tests/fixtures/plugin-full-test/.distignore
vendored
Normal file
3
vendor/eduardovillao/wp-since/tests/fixtures/plugin-full-test/.distignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
/ignored-folder/
|
||||
/ignore-this.php
|
||||
ignored-no-slash/
|
||||
6
vendor/eduardovillao/wp-since/tests/fixtures/plugin-full-test/ignore-this.php
vendored
Normal file
6
vendor/eduardovillao/wp-since/tests/fixtures/plugin-full-test/ignore-this.php
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
function ignored_function_file()
|
||||
{
|
||||
some_ignored_func_file();
|
||||
}
|
||||
6
vendor/eduardovillao/wp-since/tests/fixtures/plugin-full-test/ignored-folder/fake1.php
vendored
Normal file
6
vendor/eduardovillao/wp-since/tests/fixtures/plugin-full-test/ignored-folder/fake1.php
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
function ignored_function_folder()
|
||||
{
|
||||
some_ignored_func_folder();
|
||||
}
|
||||
6
vendor/eduardovillao/wp-since/tests/fixtures/plugin-full-test/ignored-no-slash/file.php
vendored
Normal file
6
vendor/eduardovillao/wp-since/tests/fixtures/plugin-full-test/ignored-no-slash/file.php
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
function ignored_function_noslash()
|
||||
{
|
||||
some_ignored_func_noslash();
|
||||
}
|
||||
28
vendor/eduardovillao/wp-since/tests/fixtures/plugin-full-test/plugin-full-test.php
vendored
Normal file
28
vendor/eduardovillao/wp-since/tests/fixtures/plugin-full-test/plugin-full-test.php
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Plugin Name: My plugin
|
||||
* Plugin URI: https://myddelivery.com/
|
||||
* Description: Simple test plugin.
|
||||
* Author: EduardoVillao.me
|
||||
* Author URI: https://eduardovillao.me/
|
||||
* Version: 1.0
|
||||
* Requires PHP: 7.4
|
||||
* Requires at least: 5.5
|
||||
* Text Domain: test-plugin
|
||||
* Domain Path: /languages
|
||||
* License: GPL-2.0+
|
||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
|
||||
*/
|
||||
|
||||
add_option('foo', 'bar');
|
||||
|
||||
$query = new WP_Query();
|
||||
|
||||
WP_Filesystem::get_contents('/some/path');
|
||||
|
||||
$user = new WP_User();
|
||||
$user->add_cap('edit_posts');
|
||||
|
||||
do_action('my_custom_hook', 'param');
|
||||
apply_filters('my_filter_hook', 'value');
|
||||
10
vendor/eduardovillao/wp-since/tests/fixtures/plugin-full-test/readme.txt
vendored
Normal file
10
vendor/eduardovillao/wp-since/tests/fixtures/plugin-full-test/readme.txt
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
=== Test Plugin ===
|
||||
Contributors: evcode
|
||||
Donate link: https://eduardovillao.me/
|
||||
Tags: delivery, wordpress delivery, delivery whatsapp
|
||||
Requires at least: 5.5
|
||||
Tested up to: 6.7
|
||||
Stable tag: 2.0
|
||||
Requires PHP: 7.4
|
||||
License: GPLv2License
|
||||
URI:https://www.gnu.org/licenses/gpl-2.0.html
|
||||
29
vendor/eduardovillao/wp-since/tests/fixtures/plugin-ignore-comment/plugin-ignore-comment.php
vendored
Normal file
29
vendor/eduardovillao/wp-since/tests/fixtures/plugin-ignore-comment/plugin-ignore-comment.php
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
add_option('should_be_ignored'); // @wp-since ignore
|
||||
|
||||
do_action('should_be_ignored_space'); // @wp-since ignore
|
||||
|
||||
do_action('need_detect'); // simple comment
|
||||
|
||||
do_action('my_custom_hook');
|
||||
|
||||
register_setting('mygroup', 'myoption');
|
||||
|
||||
function isBlockTheme()
|
||||
{
|
||||
if (function_exists( 'wp_is_block_theme')) {
|
||||
return wp_is_block_theme(); // @wp-since ignore
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function exampleWithoutIgnore()
|
||||
{
|
||||
if (function_exists('wp_detected_function')) {
|
||||
return wp_detected_function();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
16
vendor/eduardovillao/wp-since/tests/fixtures/plugin-with-header/plugin-with-header.php
vendored
Normal file
16
vendor/eduardovillao/wp-since/tests/fixtures/plugin-with-header/plugin-with-header.php
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Plugin Name: My plugin
|
||||
* Plugin URI: https://myddelivery.com/
|
||||
* Description: Simple test plugin.
|
||||
* Author: EduardoVillao.me
|
||||
* Author URI: https://eduardovillao.me/
|
||||
* Version: 1.0
|
||||
* Requires PHP: 7.4
|
||||
* Requires at least: 6.2
|
||||
* Text Domain: test-plugin
|
||||
* Domain Path: /languages
|
||||
* License: GPL-2.0+
|
||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
|
||||
*/
|
||||
15
vendor/eduardovillao/wp-since/tests/fixtures/plugin-with-readme-only/plugin-with-readme-only.php
vendored
Normal file
15
vendor/eduardovillao/wp-since/tests/fixtures/plugin-with-readme-only/plugin-with-readme-only.php
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Plugin Name: My plugin
|
||||
* Plugin URI: https://myddelivery.com/
|
||||
* Description: Simple test plugin.
|
||||
* Author: EduardoVillao.me
|
||||
* Author URI: https://eduardovillao.me/
|
||||
* Version: 1.0
|
||||
* Requires PHP: 7.4
|
||||
* Text Domain: test-plugin
|
||||
* Domain Path: /languages
|
||||
* License: GPL-2.0+
|
||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
|
||||
*/
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue