├── license ├── modules ├── dashboard-cleanup │ ├── cleanup │ │ ├── dashboard.php │ │ ├── elements.php │ │ └── woocommerce.php │ ├── core │ │ ├── core.php │ │ └── factory.php │ └── module.php ├── delete-expired-transients │ ├── core │ │ ├── core.php │ │ └── factory.php │ ├── module.php │ └── transients │ │ ├── cron.php │ │ └── transients.php ├── disable-admin-ajax │ ├── core │ │ └── core.php │ └── module.php ├── disable-cart-fragments │ ├── core │ │ └── core.php │ └── module.php ├── disable-embeds │ ├── core │ │ ├── core.php │ │ └── factory.php │ ├── embeds │ │ ├── allowed.php │ │ ├── cleaner.php │ │ └── hooks.php │ └── module.php ├── disable-emojis │ ├── core │ │ ├── core.php │ │ └── factory.php │ ├── emojis │ │ ├── actions.php │ │ ├── emojis.php │ │ └── filters.php │ └── module.php ├── disable-gutenberg │ └── disable-gutenberg.php ├── disable-jquery-migrate │ ├── core │ │ └── core.php │ └── module.php ├── disable-post-via-email │ ├── core │ │ └── core.php │ └── module.php ├── disable-woocommerce-status │ ├── core │ │ └── core.php │ └── module.php ├── disable-woocommerce-styles │ ├── core │ │ ├── core.php │ │ └── factory.php │ ├── module.php │ └── styles │ │ └── filter.php ├── disable-xml-rpc │ └── disable-xml-rpc.php ├── header-cleanup │ ├── core │ │ └── cleaner.php │ └── module.php ├── inline-styles │ ├── core │ │ ├── core.php │ │ └── factory.php │ ├── module.php │ └── styles │ │ ├── inline.php │ │ ├── parser.php │ │ └── relative.php ├── minify-html │ ├── core │ │ ├── core.php │ │ ├── factory.php │ │ └── options.php │ ├── html │ │ ├── buffer.php │ │ └── parser.php │ └── module.php └── remove-query-strings │ ├── core │ └── filter.php │ └── module.php ├── readme.md ├── readme.txt └── speed-demon.php /license: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /modules/dashboard-cleanup/cleanup/dashboard.php: -------------------------------------------------------------------------------- 1 | ')) && false !== ($pos2 = strpos($text, '', $pos)) ) { 32 | $text = substr($text, 0, $pos).substr($text, $pos2 + 7); 33 | } 34 | 35 | // Done 36 | return $text; 37 | } 38 | 39 | /** 40 | * Removes the WP.org logo and shortcut links (top left of the screen) 41 | */ 42 | public function WPORGShortcutLinks() { 43 | 44 | // Last minute check 45 | if ( 46 | defined('DASHBOARD_CLEANUP_WP_ORG_SHORTCUT_LINKS') && 47 | !DASHBOARD_CLEANUP_WP_ORG_SHORTCUT_LINKS 48 | ) { 49 | return; 50 | } 51 | 52 | // Done 53 | remove_action('admin_bar_menu', 'wp_admin_bar_wp_menu'); 54 | } 55 | 56 | /** 57 | * Removes the Link Manager menu item, enabled it or disabled 58 | * This behaviour is controlled in wp_options table record link_manager_enabled (values 0 or 1) 59 | */ 60 | public function linkManagerMenu() { 61 | 62 | // Last minute check 63 | if ( 64 | defined('DASHBOARD_CLEANUP_LINK_MANAGER_MENU') && 65 | !DASHBOARD_CLEANUP_LINK_MANAGER_MENU 66 | ) { 67 | return; 68 | } 69 | 70 | // Globals 71 | global $submenu; 72 | 73 | // Check first the submenu (fast method) 74 | if (empty($submenu) || !is_array($submenu) || !isset($submenu['link-manager.php'])) { 75 | return; 76 | } 77 | 78 | // Remove submenus 79 | unset($submenu['link-manager.php']); 80 | 81 | // Check menu 82 | global $menu; 83 | if (empty($menu) || !is_array($menu)) { 84 | return; 85 | } 86 | 87 | // Find the Links item in main menu 88 | foreach ($menu as $index => $data) { 89 | 90 | // Check data 91 | if (empty($data) || !is_array($data)) { 92 | continue; 93 | } 94 | 95 | // Check links handler 96 | if (!empty($data[1]) && 'manage_links' == $data[1]) { 97 | unset($menu[$index]); 98 | return; 99 | } 100 | } 101 | } 102 | 103 | /** 104 | * Removes Add new plugin Featured and Favorites tab, and set Popular as the default tab 105 | */ 106 | public function addPluginTabs($tabs) { 107 | 108 | // Last minute check 109 | if ( 110 | defined('DASHBOARD_CLEANUP_ADD_PLUGIN_TABS') && 111 | !DASHBOARD_CLEANUP_ADD_PLUGIN_TABS 112 | ) { 113 | return $tabs; 114 | } 115 | 116 | // Check tabs value 117 | if (!empty($tabs) && is_array($tabs)) { 118 | unset($tabs['featured']); 119 | unset($tabs['favorites']); 120 | } 121 | 122 | // Set Popular as default 123 | if (empty($_GET['tab'])) { 124 | global $tab; 125 | $tab = 'popular'; 126 | } 127 | 128 | // Done 129 | return $tabs; 130 | } 131 | 132 | /** 133 | * Removes Add new theme Featured and Favorites tab, 134 | * also sets Popular as the default tab using redirection 135 | */ 136 | public function addThemeTabs() { 137 | 138 | // Last minute check 139 | if ( 140 | defined('DASHBOARD_CLEANUP_ADD_THEME_TABS') && 141 | !DASHBOARD_CLEANUP_ADD_THEME_TABS 142 | ) { 143 | return; 144 | } 145 | 146 | // Check current theme install screen 147 | $currentScreen = get_current_screen(); 148 | if (empty($currentScreen) || empty($currentScreen->id) || 'theme-install' != $currentScreen->id) { 149 | return; 150 | } 151 | 152 | // Redirects for not allowed tabs 153 | if (empty($_GET['browse']) || in_array($_GET['browse'], ['featured', 'favorites'])) { 154 | $url = admin_url('theme-install.php?browse=popular'); 155 | wp_redirect($url); 156 | die; 157 | } 158 | 159 | // Enqueue inline styles 160 | add_action('admin_print_styles', [$this, 'styleThemeTabs']); 161 | } 162 | 163 | /** 164 | * Alter the tabs menu hiding elements 165 | */ 166 | public function styleThemeTabs() { 167 | $css = 'ul.filter-links a[data-sort="featured"], ul.filter-links a[data-sort="favorites"] { display: none; }'; 168 | echo ''."\n"; 169 | } 170 | 171 | /** 172 | * Remove top admin bar search icon/field 173 | */ 174 | public function removeAdminTopSearch() { 175 | 176 | // Last minute check 177 | if ( 178 | defined('DASHBOARD_CLEANUP_DISABLE_SEARCH') && 179 | !DASHBOARD_CLEANUP_DISABLE_SEARCH 180 | ) { 181 | return; 182 | } 183 | 184 | // Remove WP hook handler 185 | remove_action('admin_bar_menu', 'wp_admin_bar_search_menu', 4); 186 | } 187 | 188 | /** 189 | * Removes Import and Export items from the Tools menu 190 | */ 191 | public function adminMenu() { 192 | 193 | // Last minute check 194 | if ( 195 | defined('DASHBOARD_CLEANUP_IMPORT_EXPORT_MENU') && 196 | !DASHBOARD_CLEANUP_IMPORT_EXPORT_MENU 197 | ) { 198 | return; 199 | } 200 | 201 | // Globals 202 | global $submenu; 203 | 204 | // Check tools menu 205 | if (empty($submenu['tools.php']) || !is_array($submenu['tools.php'])) { 206 | return; 207 | } 208 | 209 | // Enum items 210 | foreach ($submenu['tools.php'] as $index => $item) { 211 | 212 | // Check file reference 213 | if (!empty($item[2])) { 214 | 215 | // Import 216 | if ('import.php' == $item[2]) { 217 | $indexImport = $index; 218 | 219 | // Export 220 | } elseif ('export.php' == $item[2]) { 221 | $indexExport = $index; 222 | } 223 | } 224 | } 225 | 226 | // Late removing 227 | if (isset($indexImport)) { 228 | unset($submenu['tools.php'][$indexImport]); 229 | } 230 | 231 | // Late removing 232 | if (isset($indexExport)) { 233 | unset($submenu['tools.php'][$indexExport]); 234 | } 235 | } 236 | 237 | /** 238 | * Removes admin notice for css files on theme editor screen 239 | */ 240 | public function themeEditor() { 241 | 242 | // Last minute check 243 | if ( 244 | defined('DASHBOARD_CLEANUP_CSS_ADMIN_NOTICE') && 245 | !DASHBOARD_CLEANUP_CSS_ADMIN_NOTICE 246 | ) { 247 | return; 248 | } 249 | 250 | // Check current theme editor screen 251 | $currentScreen = get_current_screen(); 252 | if (empty($currentScreen) || empty($currentScreen->id) || 'theme-editor' != $currentScreen->id) { 253 | return; 254 | } 255 | 256 | // Check current editing file 257 | if (empty($_GET['file']) || preg_match('/\.css$/', $_GET['file'])) { 258 | add_action('admin_print_styles', [$this, 'styleThemeEditor']); 259 | } 260 | } 261 | 262 | /** 263 | * Alter the tabs menu hiding elements 264 | */ 265 | public function styleThemeEditor() { 266 | $css = '.wrap > #message.notice-info.notice { display: none; }'; 267 | echo ''."\n"; 268 | } 269 | } -------------------------------------------------------------------------------- /modules/dashboard-cleanup/cleanup/woocommerce.php: -------------------------------------------------------------------------------- 1 | id) || 'woocommerce_page_wc-settings' != $currentScreen->id) { 106 | return; 107 | } 108 | 109 | // Enqueue inline styles 110 | add_action('admin_print_footer_scripts', [$this, 'grayedoutSuggestionsScript']); 111 | } 112 | 113 | /** 114 | * Disables suggestions checkbox and add greyout style to wrapper label 115 | */ 116 | public function grayedoutSuggestionsScript() { 117 | $js = "jQuery(document).ready(function($) { "; 118 | $js .= "$('#woocommerce_show_marketplace_suggestions').prop('checked', false).prop('disabled', true).closest('label').css({ color: '#ccc', 'font-style': 'italic' });"; 119 | $js .= "$('#woocommerce_allow_tracking').prop('checked', false).prop('disabled', true).closest('label').css({ color: '#ccc', 'font-style': 'italic' });"; 120 | $js .= "});"; 121 | echo ''."\n"; 122 | } 123 | 124 | /** 125 | * Returns a fake tracker last sent timestamp in order to disable tracking 126 | */ 127 | public function trackerSendTime($default) { 128 | 129 | // Debug point 130 | //error_log('tracker before'); 131 | 132 | // Last minute check 133 | if ( 134 | defined('DASHBOARD_CLEANUP_WOOCOMMERCE_TRACKER') && 135 | !DASHBOARD_CLEANUP_WOOCOMMERCE_TRACKER 136 | ) { 137 | return $default; 138 | } 139 | 140 | // Debug point 141 | //error_log('tracker after'); 142 | 143 | // Done 144 | return strtotime('+1 year'); 145 | } 146 | } -------------------------------------------------------------------------------- /modules/dashboard-cleanup/core/core.php: -------------------------------------------------------------------------------- 1 | plugin->context()->admin()) { 25 | 26 | // Factory object 27 | $this->plugin->factory = new Factory($this->plugin); 28 | 29 | // Elements 30 | add_filter('admin_footer_text', [$this->plugin->factory->elements(), 'footerText']); 31 | add_action('admin_init', [$this->plugin->factory->elements(), 'WPORGShortcutLinks']); 32 | add_action('admin_init', [$this->plugin->factory->elements(), 'linkManagerMenu']); 33 | add_filter('install_plugins_tabs', [$this->plugin->factory->elements(), 'addPluginTabs']); 34 | add_action('current_screen', [$this->plugin->factory->elements(), 'addThemeTabs']); 35 | add_action('admin_menu', [$this->plugin->factory->elements(), 'adminMenu'], PHP_INT_MAX); 36 | add_action('current_screen', [$this->plugin->factory->elements(), 'themeEditor']); 37 | 38 | // Dashboard 39 | add_action('admin_init', [$this->plugin->factory->dashboard(), 'quickDraft']); 40 | add_action('admin_init', [$this->plugin->factory->dashboard(), 'welcomePanel']); 41 | add_action('admin_init', [$this->plugin->factory->dashboard(), 'eventsAndNews']); 42 | 43 | // WooCommerce 44 | add_filter('woocommerce_helper_suppress_connect_notice', [$this->plugin->factory->woocommerce(), 'connectStore']); 45 | add_filter('woocommerce_show_admin_notice', [$this->plugin->factory->woocommerce(), 'productsBlock'], 10, 2); 46 | add_filter('woocommerce_display_admin_footer_text', [$this->plugin->factory->woocommerce(), 'footerText']); 47 | add_filter('woocommerce_allow_marketplace_suggestions', [$this->plugin->factory->woocommerce(), 'marketplaceSuggestions']); 48 | add_action('current_screen', [$this->plugin->factory->woocommerce(), 'grayedoutSuggestions']); 49 | add_filter('woocommerce_tracker_last_send_time', [$this->plugin->factory->woocommerce(), 'trackerSendTime'], PHP_INT_MAX); 50 | 51 | // WC debug point 52 | //wp_schedule_single_event( time() + 10, 'woocommerce_tracker_send_event', array( true ) ); 53 | 54 | // Check frontend execution 55 | } elseif ($this->plugin->context()->front()) { 56 | 57 | // Factory object 58 | $this->plugin->factory = new Factory($this->plugin); 59 | 60 | // Remove WP.org logo and shortcut links before template load 61 | add_action('template_redirect', [$this->plugin->factory->elements(), 'WPORGShortcutLinks']); 62 | 63 | // Removes front search icon/field before template load 64 | add_action('template_redirect', [$this->plugin->factory->elements(), 'removeAdminTopSearch'], PHP_INT_MAX); 65 | 66 | // Check cron execution 67 | } elseif ($this->plugin->context()->cron()) { 68 | 69 | // Factory object 70 | $this->plugin->factory = new Factory($this->plugin); 71 | 72 | // Add also here the last_send_time filter 73 | add_filter('woocommerce_tracker_last_send_time', [$this->plugin->factory->woocommerce(), 'trackerSendTime'], PHP_INT_MAX); 74 | } 75 | } 76 | 77 | } -------------------------------------------------------------------------------- /modules/dashboard-cleanup/core/factory.php: -------------------------------------------------------------------------------- 1 | plugin); 23 | } 24 | 25 | /** 26 | * Cleanup Dashboard object 27 | */ 28 | protected function createDashboard() { 29 | return Cleanup\Dashboard::instance($this->plugin); 30 | } 31 | 32 | /** 33 | * Cleanup Woocommerce object 34 | */ 35 | protected function createWoocommerce() { 36 | return Cleanup\Woocommerce::instance($this->plugin); 37 | } 38 | } -------------------------------------------------------------------------------- /modules/dashboard-cleanup/module.php: -------------------------------------------------------------------------------- 1 | enabled()) { 29 | Core\Core::instance($this); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /modules/delete-expired-transients/core/core.php: -------------------------------------------------------------------------------- 1 | factory = new Factory($plugin); 62 | 63 | // Start the process 64 | $this->factory->cron(); 65 | } 66 | 67 | 68 | 69 | } -------------------------------------------------------------------------------- /modules/delete-expired-transients/core/factory.php: -------------------------------------------------------------------------------- 1 | plugin); 25 | } 26 | 27 | 28 | /** 29 | * Filters object 30 | */ 31 | protected function createTransients() { 32 | return new Transients\Transients; 33 | } 34 | 35 | 36 | 37 | } -------------------------------------------------------------------------------- /modules/delete-expired-transients/module.php: -------------------------------------------------------------------------------- 1 | enabled()) { 33 | Core\Core::instance($this); 34 | } 35 | } 36 | 37 | 38 | 39 | } -------------------------------------------------------------------------------- /modules/delete-expired-transients/transients/cron.php: -------------------------------------------------------------------------------- 1 | factory = $factory; 59 | $this->plugin = $plugin; 60 | 61 | // Cron actions 62 | $this->initialize(); 63 | } 64 | 65 | 66 | 67 | /** 68 | * Start cron checks 69 | */ 70 | private function initialize() { 71 | 72 | // Schedules filter 73 | add_filter('cron_schedules', [$this, 'schedules']); 74 | 75 | // Debug 76 | //$this->onSchedule();return; 77 | 78 | // Generation check 79 | if (!wp_next_scheduled($this->plugin->prefix.'_clean')) 80 | wp_schedule_event(time(), $this->plugin->prefix.'_interval', $this->plugin->prefix.'_clean'); 81 | 82 | // Generation hook 83 | add_action($this->plugin->prefix.'_clean', [$this, 'onSchedule']); 84 | } 85 | 86 | 87 | 88 | // WP Hooks 89 | // --------------------------------------------------------------------------------------------------- 90 | 91 | 92 | 93 | /** 94 | * Add custom schedule 95 | */ 96 | public function schedules($schedules) { 97 | 98 | // Define period 99 | $hours = defined('DELETE_EXPIRED_TRANSIENTS_HOURS')? (int) DELETE_EXPIRED_TRANSIENTS_HOURS : self::HOURS; 100 | 101 | // Check custom period 102 | if (!empty($hours)) { 103 | $schedules[$this->plugin->prefix.'_interval'] = [ 104 | 'interval' => $hours * HOUR_IN_SECONDS, 105 | 'display' => __('Delete Expired Transients in '.$hours.' hours'), 106 | ]; 107 | } 108 | 109 | // Done 110 | return $schedules; 111 | } 112 | 113 | 114 | 115 | /** 116 | * Start the clean procedure 117 | */ 118 | public function onSchedule() { 119 | 120 | // Last minute check 121 | if (!$this->plugin->enabled()) { 122 | return; 123 | } 124 | 125 | // Check external object cache 126 | if (wp_using_ext_object_cache()) 127 | return; 128 | 129 | // Remove expired transients 130 | $this->factory->transients->cleanExpired(); 131 | } 132 | 133 | 134 | 135 | } -------------------------------------------------------------------------------- /modules/delete-expired-transients/transients/transients.php: -------------------------------------------------------------------------------- 1 | options} a, {$wpdb->options} b 76 | WHERE 77 | a.option_name LIKE '%_transient_%' AND 78 | a.option_name NOT LIKE '%_transient_timeout_%' AND 79 | b.option_name = CONCAT( 80 | '_transient_timeout_', 81 | SUBSTRING( 82 | a.option_name, 83 | CHAR_LENGTH('_transient_') + 1 84 | ) 85 | ) AND 86 | b.option_value < '{$beforeTimestamp}' 87 | ORDER BY b.option_id ASC 88 | LIMIT {$limit} 89 | "; 90 | 91 | // Execute and check affected rows 92 | $rows = $wpdb->get_results($sql); 93 | if (empty($rows) || !is_array($rows)) 94 | break; 95 | 96 | // Debug 97 | //error_log(print_r($rows, true)); 98 | 99 | // Populate data 100 | $Ids = []; 101 | foreach ($rows as $row) { 102 | $Ids[] = esc_sql((int) $row->option_id2); 103 | $Ids[] = esc_sql((int) $row->option_id1); 104 | } 105 | 106 | // Prepare identifiers 107 | $Ids = implode(',', $Ids); 108 | 109 | // Debug 110 | //error_log($Ids); 111 | 112 | // Remove detected expired options 113 | $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_id IN ({$Ids})"); 114 | } 115 | } 116 | 117 | 118 | 119 | } -------------------------------------------------------------------------------- /modules/disable-admin-ajax/core/core.php: -------------------------------------------------------------------------------- 1 | enabled()) { 35 | return; 36 | } 37 | 38 | // Check AJAX context and server referer var 39 | if (!defined('DOING_AJAX') || empty($_SERVER['HTTP_REFERER'])) 40 | return; 41 | 42 | // Run the module 43 | Core\Core::instance(); 44 | } 45 | 46 | 47 | 48 | } -------------------------------------------------------------------------------- /modules/disable-cart-fragments/core/core.php: -------------------------------------------------------------------------------- 1 | plugin->enabled()) { 35 | return; 36 | } 37 | 38 | // Check wp-config constant for exceptions 39 | if (defined('DISABLE_CART_FRAGMENTS') && !is_bool(DISABLE_CART_FRAGMENTS) && is_page()) { 40 | $ids = array_map('intval', explode(',', DISABLE_CART_FRAGMENTS)); 41 | if (in_array((int) get_the_ID(), $ids)) 42 | return; 43 | } 44 | 45 | // Dequeue script 46 | wp_dequeue_script('wc-cart-fragments'); 47 | } 48 | 49 | 50 | 51 | } -------------------------------------------------------------------------------- /modules/disable-cart-fragments/module.php: -------------------------------------------------------------------------------- 1 | enabled()) { 33 | Core\Core::instance($this); 34 | } 35 | } 36 | 37 | 38 | 39 | } -------------------------------------------------------------------------------- /modules/disable-embeds/core/core.php: -------------------------------------------------------------------------------- 1 | plugin->factory = new Factory($this->plugin); 31 | 32 | // Allowed sources from constant 33 | $this->plugin->allowed = $this->plugin->factory->allowed(); 34 | 35 | // Create registrar object and set hooks handler 36 | $this->plugin->factory->registrar->setHandler($this); 37 | 38 | // Start the hooks object 39 | $this->plugin->factory->hooks(); 40 | } 41 | 42 | 43 | 44 | // Registrar events 45 | // --------------------------------------------------------------------------------------------------- 46 | 47 | 48 | 49 | /** 50 | * Plugin activation 51 | */ 52 | public function onActivation() { 53 | add_filter('rewrite_rules_array', [$this->plugin->factory->cleaner, 'rules']); 54 | flush_rewrite_rules(); 55 | } 56 | 57 | 58 | 59 | /** 60 | * Plugin deactivation 61 | */ 62 | public function onDeactivation() { 63 | add_filter('rewrite_rules_array', [$this->plugin->factory->cleaner, 'rules']); 64 | flush_rewrite_rules(); 65 | } 66 | 67 | 68 | 69 | } -------------------------------------------------------------------------------- /modules/disable-embeds/core/factory.php: -------------------------------------------------------------------------------- 1 | plugin); 25 | } 26 | 27 | 28 | 29 | /** 30 | * Cleaner object 31 | */ 32 | protected function createCleaner() { 33 | return Embeds\Cleaner::instance($this->plugin); 34 | } 35 | 36 | 37 | 38 | /** 39 | * Allowed object 40 | */ 41 | protected function createAllowed() { 42 | return new Embeds\Allowed; 43 | } 44 | 45 | 46 | 47 | /** 48 | * Registrar object (needs real plugin object) 49 | */ 50 | protected function createRegistrar() { 51 | return new Helpers\Registrar($this->plugin->plugin()); 52 | } 53 | 54 | 55 | 56 | } -------------------------------------------------------------------------------- /modules/disable-embeds/embeds/allowed.php: -------------------------------------------------------------------------------- 1 | supported = array_map('trim', explode("\n", trim(self::SERVICES))); 58 | 59 | // Detect services 60 | $services = defined('DISABLE_EMBEDS_ALLOWED_SOURCES')? array_map('strtolower', array_map('trim', explode(',', ''.DISABLE_EMBEDS_ALLOWED_SOURCES))) : []; 61 | foreach ($services as $service) { 62 | 63 | // Check empty 64 | if ('' === $service) 65 | continue; 66 | 67 | // Check supported 68 | if (in_array($service, $this->supported)) 69 | $this->services[] = $service; 70 | } 71 | } 72 | 73 | 74 | 75 | // Methods 76 | // --------------------------------------------------------------------------------------------------- 77 | 78 | 79 | 80 | /** 81 | * Detected services flag 82 | */ 83 | public function detected() { 84 | return !empty($this->services); 85 | } 86 | 87 | 88 | 89 | /** 90 | * Allowed services 91 | */ 92 | public function services() { 93 | return $this->services; 94 | } 95 | 96 | 97 | 98 | /** 99 | * Supported 100 | */ 101 | public function supported() { 102 | return $this->supported; 103 | } 104 | 105 | 106 | 107 | } -------------------------------------------------------------------------------- /modules/disable-embeds/embeds/cleaner.php: -------------------------------------------------------------------------------- 1 | $rewrite) { 29 | 30 | // Check embed param 31 | if (false !== ($pos = strpos($rewrite, '?'))) { 32 | $params = explode('&', substr($rewrite, $pos + 1)); 33 | if (in_array('embed=true', $params)) 34 | continue; 35 | } 36 | 37 | // Add rule 38 | $rules[$rule] = $rewrite; 39 | } 40 | 41 | // Done 42 | return $rules; 43 | } 44 | 45 | 46 | 47 | /** 48 | * Remove any related embed TinyMCE plugin 49 | */ 50 | public function tinyMCE($plugins) { 51 | return array_diff($plugins, array('wpembed', 'wpview')); 52 | } 53 | 54 | 55 | 56 | /** 57 | * Remove the embed query var. 58 | */ 59 | public function queryVar() { 60 | global $wp; 61 | $wp->public_query_vars = array_diff($wp->public_query_vars, array('embed')); 62 | } 63 | 64 | 65 | 66 | /** 67 | * Remove the_content filter 68 | */ 69 | public function contentFilter() { 70 | global $wp_embed; 71 | remove_filter('the_content', array($wp_embed, 'autoembed'), 8); 72 | } 73 | 74 | 75 | 76 | /** 77 | * Disables oEmbed postmeta cache 78 | */ 79 | public function oembedCache() { 80 | global $wp_embed; 81 | $wp_embed->usecache = false; 82 | add_filter('oembed_ttl', '__return_zero'); 83 | } 84 | 85 | 86 | 87 | } -------------------------------------------------------------------------------- /modules/disable-embeds/embeds/hooks.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 40 | 41 | // Init hook 42 | add_action('init', [$this, 'init'], PHP_INT_MAX); 43 | } 44 | 45 | 46 | 47 | /** 48 | * WP init action 49 | */ 50 | public function init() { 51 | 52 | // Last minute check 53 | if (!$this->plugin->enabled()) { 54 | return; 55 | } 56 | 57 | // Actions and filters 58 | $this->handle(); 59 | 60 | // Remove from query vars 61 | $this->plugin->factory->cleaner->queryVar(); 62 | 63 | // Check allowed sources 64 | if ($this->plugin->allowed->detected()) { 65 | 66 | // Disallow oEmbed cache 67 | $this->plugin->factory->cleaner->oembedCache(); 68 | 69 | // Process detected exceptions 70 | add_filter('oembed_providers', [$this, 'providers']); 71 | add_filter('pre_oembed_result', [$this, 'preResults'], 10, 2); 72 | 73 | // No exceptions 74 | } else { 75 | 76 | // Remove from content 77 | $this->plugin->factory->cleaner->contentFilter(); 78 | 79 | // Alter Tiny MCE plugins 80 | add_filter('tiny_mce_plugins', [$this->plugin->factory->cleaner, 'tinyMCE']); 81 | } 82 | } 83 | 84 | 85 | 86 | /** 87 | * Handle hooks 88 | */ 89 | private function handle() { 90 | 91 | // Remove content feed filter 92 | remove_filter('the_content_feed', '_oembed_filter_feed_content'); 93 | 94 | // Abort embed libraries loading 95 | remove_action('plugins_loaded', 'wp_maybe_load_embeds', 0); 96 | 97 | // No auto-embedding support 98 | add_filter('pre_option_embed_autourls', '__return_false'); 99 | 100 | // Avoid oEmbed auto discovery 101 | add_filter('embed_oembed_discover', '__return_false'); 102 | 103 | // Remove REST API related hooks 104 | remove_action('rest_api_init', 'wp_oembed_register_route'); 105 | remove_filter('rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10); 106 | 107 | // Remove header actions 108 | remove_action('wp_head', 'wp_oembed_add_discovery_links'); 109 | remove_action('wp_head', 'wp_oembed_add_host_js'); 110 | 111 | remove_action('embed_head', 'enqueue_embed_scripts', 1); 112 | remove_action('embed_head', 'print_emoji_detection_script'); 113 | remove_action('embed_head', 'print_embed_styles'); 114 | remove_action('embed_head', 'wp_print_head_scripts', 20); 115 | remove_action('embed_head', 'wp_print_styles', 20); 116 | remove_action('embed_head', 'wp_no_robots'); 117 | remove_action('embed_head', 'rel_canonical'); 118 | remove_action('embed_head', 'locale_stylesheet', 30); 119 | 120 | remove_action('embed_content_meta', 'print_embed_comments_button'); 121 | remove_action('embed_content_meta', 'print_embed_sharing_button'); 122 | 123 | remove_action('embed_footer', 'print_embed_sharing_dialog'); 124 | remove_action('embed_footer', 'print_embed_scripts'); 125 | remove_action('embed_footer', 'wp_print_footer_scripts', 20); 126 | 127 | remove_filter('excerpt_more', 'wp_embed_excerpt_more', 20); 128 | remove_filter('the_excerpt_embed', 'wptexturize'); 129 | remove_filter('the_excerpt_embed', 'convert_chars'); 130 | remove_filter('the_excerpt_embed', 'wpautop'); 131 | remove_filter('the_excerpt_embed', 'shortcode_unautop'); 132 | remove_filter('the_excerpt_embed', 'wp_embed_excerpt_attachment'); 133 | 134 | // Remove data and results filters 135 | remove_filter('oembed_dataparse', 'wp_filter_oembed_result', 10); 136 | remove_filter('oembed_response_data', 'get_oembed_response_data_rich', 10); 137 | remove_filter('pre_oembed_result', 'wp_filter_pre_oembed_result', 10); 138 | 139 | // WooCommerce embeds in short description 140 | remove_filter('woocommerce_short_description', 'wc_do_oembeds'); 141 | 142 | // Alter rewrite rules 143 | add_filter('rewrite_rules_array', [$this->plugin->factory->cleaner, 'rules']); 144 | } 145 | 146 | 147 | 148 | // WP filters 149 | // --------------------------------------------------------------------------------------------------- 150 | 151 | 152 | 153 | /** 154 | * Allow only specific providers 155 | */ 156 | public function providers($currentProviders) { 157 | 158 | // Check input value 159 | if (empty($currentProviders) || !is_array($currentProviders)) 160 | return $currentProviders; 161 | 162 | // Init 163 | $providers = []; 164 | $allowedServices = $this->plugin->allowed->services(); 165 | 166 | // Enum original providers 167 | foreach ($currentProviders as $regExp => $info) { 168 | 169 | // Check provider info 170 | if (empty($info) || !is_array($info)) 171 | continue; 172 | 173 | // Breakdown URL parts 174 | $parts = @parse_url($info[0]); 175 | if (empty($parts) || !is_array($parts) || empty($parts['host'])) 176 | continue; 177 | 178 | // Extract name from domain 179 | $domain = explode('.', $parts['host']); 180 | $domain = in_array($domain[0], ['www', 'api', 'publish', 'public-api', 'embed', 'read'])? $domain[1] : $domain[0]; 181 | 182 | // Add provider if it match 183 | if (in_array(strtolower($domain), $allowedServices)) 184 | $providers[$regExp] = $info; 185 | } 186 | 187 | // Done 188 | return $providers; 189 | } 190 | 191 | 192 | 193 | /** 194 | * Filter pre-results to avoid automatic discover process 195 | */ 196 | public function preResults($result, $url) { 197 | 198 | // Filtered (by this plugin) providers; 199 | $oembed = _wp_oembed_get_object(); 200 | if (empty($oembed->providers) || !is_array($oembed->providers)) 201 | return ''; 202 | 203 | /* From core WP_oEmbed class */ 204 | 205 | $provider = false; 206 | 207 | foreach ( $oembed->providers as $matchmask => $data ) { 208 | list( $providerurl, $regex ) = $data; 209 | 210 | // Turn the asterisk-type provider URLs into regex 211 | if ( !$regex ) { 212 | $matchmask = '#' . str_replace( '___wildcard___', '(.+)', preg_quote( str_replace( '*', '___wildcard___', $matchmask ), '#' ) ) . '#i'; 213 | $matchmask = preg_replace( '|^#http\\\://|', '#https?\://', $matchmask ); 214 | } 215 | 216 | if ( preg_match( $matchmask, $url ) ) { 217 | $provider = str_replace( '{format}', 'json', $providerurl ); // JSON is easier to deal with than XML 218 | break; 219 | } 220 | } 221 | 222 | /* Back to plugin code */ 223 | 224 | // Check allowed 225 | return empty($provider)? '' : $result; 226 | } 227 | 228 | 229 | 230 | } -------------------------------------------------------------------------------- /modules/disable-embeds/module.php: -------------------------------------------------------------------------------- 1 | enabled()) { 33 | Core\Core::instance($this); 34 | } 35 | } 36 | 37 | 38 | 39 | } -------------------------------------------------------------------------------- /modules/disable-emojis/core/core.php: -------------------------------------------------------------------------------- 1 | factory = new Factory($plugin); 62 | 63 | // Start the process 64 | $this->factory->actions(); 65 | $this->factory->filters(); 66 | } 67 | 68 | 69 | 70 | } -------------------------------------------------------------------------------- /modules/disable-emojis/core/factory.php: -------------------------------------------------------------------------------- 1 | plugin); 25 | } 26 | 27 | 28 | /** 29 | * Filters object 30 | */ 31 | protected function createFilters() { 32 | return new Emojis\Filters($this->plugin); 33 | } 34 | 35 | 36 | 37 | } -------------------------------------------------------------------------------- /modules/disable-emojis/emojis/actions.php: -------------------------------------------------------------------------------- 1 | [ 26 | ['wp_head', 7], 27 | 'admin_print_scripts', 28 | 'embed_head', // Unsupported by the original plugin 29 | ], 30 | 'print_emoji_styles' => [ 31 | 'wp_print_styles', 32 | 'admin_print_styles', 33 | ], 34 | ]; 35 | 36 | 37 | 38 | // WP hooks 39 | // --------------------------------------------------------------------------------------------------- 40 | 41 | 42 | 43 | /** 44 | * Handle the WP init hook 45 | */ 46 | public function init() { 47 | 48 | // Last minute check 49 | if (!$this->plugin->enabled()) { 50 | return; 51 | } 52 | 53 | // Remove actions 54 | $this->remove('actions', $this->actions); 55 | } 56 | 57 | 58 | 59 | } -------------------------------------------------------------------------------- /modules/disable-emojis/emojis/emojis.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 38 | add_action('init', [$this, 'init']); 39 | } 40 | 41 | 42 | 43 | /** 44 | * Declared for overwriting 45 | */ 46 | public function init() {} 47 | 48 | 49 | 50 | // Util 51 | // --------------------------------------------------------------------------------------------------- 52 | 53 | 54 | 55 | /** 56 | * Remove actions of filters 57 | */ 58 | protected function remove($type, $items) { 59 | 60 | // Enum all items 61 | foreach ($items as $func => $hooks) { 62 | 63 | // Allowed hooks 64 | foreach ($hooks as $hook) { 65 | 66 | // Check priority 67 | $tag = is_array($hook)? $hook[0]: $hook; 68 | $priority = (is_array($hook) && isset($hook[1]))? $hook[1] : 10; 69 | 70 | // Actions 71 | if ('actions' == $type) { 72 | remove_action($tag, $func, $priority); 73 | 74 | // Filters 75 | } elseif ('filters' == $type) { 76 | remove_filter($tag, $func, $priority); 77 | } 78 | } 79 | } 80 | } 81 | 82 | 83 | 84 | } -------------------------------------------------------------------------------- /modules/disable-emojis/emojis/filters.php: -------------------------------------------------------------------------------- 1 | [ 26 | 'the_content_feed', 27 | 'comment_text_rss', 28 | ], 29 | 'wp_staticize_emoji_for_email' => [ 30 | 'wp_mail', 31 | ], 32 | ]; 33 | 34 | 35 | 36 | /** 37 | * Partial matching URL 38 | */ 39 | protected $matchingURL = 's.w.org/images/core/emoji/'; 40 | 41 | 42 | 43 | // WP hooks 44 | // --------------------------------------------------------------------------------------------------- 45 | 46 | 47 | 48 | /** 49 | * Handle the WP init hook 50 | */ 51 | public function init() { 52 | 53 | // Last minute check 54 | if (!$this->plugin->enabled()) { 55 | return; 56 | } 57 | 58 | // Remove filters 59 | $this->remove('filters', $this->filters); 60 | 61 | // Modifications 62 | add_filter('tiny_mce_plugins', [$this, 'tinyMCEPlugins']); 63 | add_filter('wp_resource_hints', [$this, 'removeDNSPrefetch'], 10, 2); 64 | } 65 | 66 | 67 | 68 | /** 69 | * Handle tinyMCE supported plugins 70 | */ 71 | public function tinyMCEPlugins($plugins) { 72 | return (empty($plugins) || !is_array($plugins))? [] : array_diff($plugins, ['wpemoji']); 73 | } 74 | 75 | 76 | 77 | /** 78 | * Remove emoji URL's from DNS prefetching hints 79 | */ 80 | public function removeDNSPrefetch($urls, $relation_type) { 81 | 82 | // Avoid non-dns-prefetch cases 83 | if ('dns-prefetch' != $relation_type) 84 | return $urls; 85 | 86 | // Initilize 87 | $newURLs = []; 88 | 89 | // Enum current values 90 | foreach ($urls as $index => $value) { 91 | 92 | // Check item 93 | $url = $value; 94 | if (is_array($url)) { 95 | 96 | // Copy attr 97 | $url = empty($url['href'])? null : $url['href']; 98 | } 99 | 100 | // Add item if not contains coincidences 101 | if (empty($url) || false === stripos($url, $this->matchingURL)) 102 | $newURLs[] = $value; 103 | } 104 | 105 | // Done 106 | return $newURLs; 107 | } 108 | 109 | 110 | 111 | } -------------------------------------------------------------------------------- /modules/disable-emojis/module.php: -------------------------------------------------------------------------------- 1 | enabled()) { 33 | Core\Core::instance($this); 34 | } 35 | } 36 | 37 | 38 | 39 | } -------------------------------------------------------------------------------- /modules/disable-gutenberg/disable-gutenberg.php: -------------------------------------------------------------------------------- 1 | get_all_registered() as $block_type => $block ) { 212 | unregister_block_type( $block_type ); // Unregister all core blocks. 213 | } 214 | }, 20 ); 215 | 216 | // Prevent block editor assets from preloading in REST API requests. 217 | add_filter( 'rest_preload_paths', function( $preload_paths ) { 218 | return array_filter( $preload_paths, function( $path ) { 219 | return false === strpos( $path, '/wp/v2/block-editor' ); 220 | } ); 221 | }, 20, 1 ); 222 | 223 | // Disable Gutenberg-specific admin notices and Global Styles interface. 224 | add_action( 'admin_init', function() { 225 | remove_action( 'admin_notices', 'gutenberg_wordpress_version_notice' ); // Remove Gutenberg version notice. 226 | remove_action( 'admin_init', 'gutenberg_add_global_styles_panel' ); // Remove Global Styles panel. 227 | }, 20 ); 228 | 229 | // Disable Gutenberg for Customizer Selective Refresh. 230 | add_filter( 'customize_selective_refresh_block_editor', '__return_false', 10 ); 231 | 232 | // Ref: ChatGPT 233 | -------------------------------------------------------------------------------- /modules/disable-jquery-migrate/core/core.php: -------------------------------------------------------------------------------- 1 | plugin->enabled()) { 45 | return; 46 | } 47 | 48 | // Check the jQuery registry 49 | if (!isset($scripts->registered['jquery'])) { 50 | return; 51 | } 52 | 53 | // Check dependencies and if jQuery Migrate exists 54 | $script = $scripts->registered['jquery']; 55 | if (empty($script->deps) || !is_array($script->deps) || !in_array('jquery-migrate', $script->deps)) { 56 | return; 57 | } 58 | 59 | // Remove jQuery Migrate dependency 60 | $scripts->registered['jquery']->deps = array_diff($script->deps, ['jquery-migrate']); 61 | } 62 | 63 | 64 | 65 | } -------------------------------------------------------------------------------- /modules/disable-jquery-migrate/module.php: -------------------------------------------------------------------------------- 1 | enabled()) { 33 | Core\Core::instance($this); 34 | } 35 | } 36 | 37 | 38 | 39 | } -------------------------------------------------------------------------------- /modules/disable-post-via-email/core/core.php: -------------------------------------------------------------------------------- 1 | enabled()) { 33 | Core\Core::instance($this); 34 | } 35 | } 36 | 37 | 38 | 39 | } -------------------------------------------------------------------------------- /modules/disable-woocommerce-status/core/core.php: -------------------------------------------------------------------------------- 1 | plugin->enabled()) { 37 | 38 | // Removes WC dashboard status metabox 39 | remove_meta_box('woocommerce_dashboard_status', 'dashboard', 'normal'); 40 | } 41 | } 42 | 43 | 44 | 45 | } -------------------------------------------------------------------------------- /modules/disable-woocommerce-status/module.php: -------------------------------------------------------------------------------- 1 | enabled()) { 33 | Core\Core::instance($this); 34 | } 35 | } 36 | 37 | 38 | 39 | } -------------------------------------------------------------------------------- /modules/disable-woocommerce-styles/core/core.php: -------------------------------------------------------------------------------- 1 | plugin->factory = new Factory($this->plugin); 31 | 32 | // Handles WP Print Styles hook 33 | add_action('wp_print_styles', [$this, 'onWPPrintStyles'], PHP_INT_MAX); 34 | } 35 | 36 | 37 | 38 | /** 39 | * WP Print Styles setup hook 40 | */ 41 | public function onWPPrintStyles() { 42 | 43 | // Check module already enabled 44 | if ($this->plugin->enabled()) { 45 | 46 | // Filter styles 47 | $this->plugin->factory->filter(); 48 | } 49 | } 50 | 51 | 52 | 53 | } -------------------------------------------------------------------------------- /modules/disable-woocommerce-styles/core/factory.php: -------------------------------------------------------------------------------- 1 | plugin); 25 | } 26 | 27 | 28 | 29 | } -------------------------------------------------------------------------------- /modules/disable-woocommerce-styles/module.php: -------------------------------------------------------------------------------- 1 | enabled()) { 33 | Core\Core::instance($this); 34 | } 35 | } 36 | 37 | 38 | 39 | } -------------------------------------------------------------------------------- /modules/disable-woocommerce-styles/styles/filter.php: -------------------------------------------------------------------------------- 1 | restrict(); 24 | } 25 | 26 | 27 | 28 | /** 29 | * Restrict WC styles basend on this plugin constants 30 | */ 31 | private function restrict() { 32 | 33 | // Initialize 34 | $replacement = array(); 35 | 36 | // WP Styles object 37 | $styles = wp_styles(); 38 | if (empty($styles->queue) || !is_array($styles->queue)) 39 | return; 40 | 41 | // Process constants 42 | $names = $this->values('DISABLE_WOOCOMMERCE_STYLES_NAMES', 'select2'); 43 | $prefixes = $this->values('DISABLE_WOOCOMMERCE_STYLES_PREFIXES', 'woocommerce,wc'); 44 | 45 | // Enum queued styles 46 | foreach ($styles->queue as $handler) { 47 | 48 | // Check prefixes 49 | $prefixed = false; 50 | foreach ($prefixes as $prefix) { 51 | if (0 === strpos($handler, $prefix.'-') || 52 | 0 === strpos($handler, $prefix.'_')) { 53 | $prefixed = true; 54 | break; 55 | } 56 | } 57 | 58 | // Exception 59 | if ($prefixed) { 60 | continue; 61 | } 62 | 63 | // Check names 64 | $match = false; 65 | foreach ($names as $name) { 66 | if ($name == $handler) { 67 | $match = true; 68 | break; 69 | } 70 | } 71 | 72 | // Exception 73 | if ($match) { 74 | continue; 75 | } 76 | 77 | // Add valid handler 78 | $replacement[] = $handler; 79 | } 80 | 81 | // Switch 82 | wp_styles()->queue = $replacement; 83 | } 84 | 85 | 86 | 87 | /** 88 | * Sanitize target values 89 | */ 90 | private function values($constant, $default) { 91 | 92 | // Initialize 93 | $result = array(); 94 | 95 | // Check values 96 | $values = defined($constant)? constant($constant) : $default; 97 | 98 | // Cast to array 99 | $values = array_map('trim', explode(',', $values)); 100 | 101 | // Enum values 102 | foreach ($values as $value) { 103 | 104 | // Check content 105 | if ('' !== $value) { 106 | $result[] = $value; 107 | } 108 | } 109 | 110 | // Done 111 | return $result; 112 | } 113 | 114 | 115 | 116 | } -------------------------------------------------------------------------------- /modules/disable-xml-rpc/disable-xml-rpc.php: -------------------------------------------------------------------------------- 1 | 2.1 27 | 28 | // Windows Live Writer 29 | ['wp_head', 'wlwmanifest_link'], 30 | 31 | // Shortlinks 32 | ['wp_head', 'wp_shortlink_wp_head'], 33 | 34 | // Relational links 35 | ['wp_head', 'start_post_rel_link'], // Deprecated 3.3.0 36 | ['wp_head', 'parent_post_rel_link'], // Deprecated 3.3.0 37 | ['wp_head', 'index_rel_link'], // Deprecated 3.3.0 38 | ['wp_head', 'adjacent_posts_rel_link'], 39 | ['wp_head', 'adjacent_posts_rel_link_wp_head'], 40 | 41 | // All feeds/RSS links 42 | ['wp_head', 'feed_links', 2], 43 | ['wp_head', 'feed_links_extra', 3], 44 | 45 | // WP-JSON REST API link 46 | ['wp_head', 'rest_output_link_wp_head'], 47 | 48 | // Default DNS prefetch 49 | ['wp_head', 'wp_resource_hints', 2], 50 | ]; 51 | 52 | 53 | 54 | /** 55 | * Constructor 56 | */ 57 | public function __construct() { 58 | 59 | // Remove WP actions 60 | foreach ($this->actionsToRemove as $action) { 61 | remove_action($action[0], $action[1], isset($action[2])? $action[2] : 10); 62 | } 63 | 64 | // WC hooks 65 | add_action('get_header', [$this, 'removeWCGenerator']); 66 | add_action('woocommerce_init', [$this, 'removeWCGenerator']); 67 | } 68 | 69 | 70 | 71 | /** 72 | * Remove generator from WooCommerce old versions 73 | */ 74 | public function removeWCGenerator() { 75 | 76 | // Generator WC function 77 | remove_action('wp_head', 'wc_generator_tag'); // WC >= 2.1.0 78 | 79 | // Generator method depending on the global WC object 80 | if (isset($GLOBALS['woocommerce']) && is_object($GLOBALS['woocommerce'])) 81 | remove_action('wp_head', [$GLOBALS['woocommerce'], 'generator']); // WC < 2.1.0 82 | } 83 | 84 | 85 | 86 | } -------------------------------------------------------------------------------- /modules/header-cleanup/module.php: -------------------------------------------------------------------------------- 1 | enabled()) { 52 | new Core\Cleaner; 53 | } 54 | } 55 | 56 | 57 | 58 | } -------------------------------------------------------------------------------- /modules/inline-styles/core/core.php: -------------------------------------------------------------------------------- 1 | plugin->factory = new Factory($this->plugin); 26 | 27 | // WP loaded hook 28 | add_action('wp_loaded', [$this, 'loaded'], PHP_INT_MAX); 29 | } 30 | 31 | 32 | 33 | /** 34 | * Output parser object 35 | */ 36 | public function loaded() { 37 | 38 | // Last minute check 39 | if (!$this->plugin->enabled()) { 40 | return; 41 | } 42 | 43 | // Start parsing the whole HTML 44 | $this->plugin->factory->parser->start(); 45 | 46 | // Print styles hook 47 | add_action('wp_print_styles', [$this, 'styles'], PHP_INT_MAX); 48 | } 49 | 50 | 51 | 52 | /** 53 | * Handle the print styles hook 54 | */ 55 | public function styles() { 56 | $this->plugin->factory->inline->transform(); 57 | } 58 | 59 | 60 | 61 | } -------------------------------------------------------------------------------- /modules/inline-styles/core/factory.php: -------------------------------------------------------------------------------- 1 | plugin); 25 | } 26 | 27 | 28 | 29 | /** 30 | * Relative object 31 | */ 32 | protected function createRelative($base) { 33 | return new Styles\Relative($base); 34 | } 35 | 36 | 37 | 38 | /** 39 | * Parser object 40 | */ 41 | protected function createParser() { 42 | return Styles\Parser::instance($this->plugin); 43 | } 44 | 45 | 46 | 47 | } -------------------------------------------------------------------------------- /modules/inline-styles/module.php: -------------------------------------------------------------------------------- 1 | enabled()) { 33 | Core\Core::instance($this); 34 | } 35 | } 36 | 37 | 38 | 39 | } -------------------------------------------------------------------------------- /modules/inline-styles/styles/inline.php: -------------------------------------------------------------------------------- 1 | registered as $key => &$object) { 46 | 47 | // Check queued item 48 | if (!in_array($object->handle, $styles->queue)) 49 | continue; 50 | 51 | // Check conditional IE declaration 52 | if (!empty($object->extra['conditional'])) { 53 | 54 | // Check conditional value 55 | $conditional = explode(' ', preg_replace('/\s+/', ' ', ''.$object->extra['conditional'])); 56 | if (!empty($conditional)) { 57 | 58 | // Remove in case of IE condition 59 | if ('ie' == strtolower($conditional[0]) || (isset($conditional[1]) && 'ie' == strtolower($conditional[1]))) { 60 | unset($styles->registered[$key]); 61 | 62 | // Check src exception 63 | } elseif (!empty($object->src)) { 64 | $this->exception($object); 65 | } 66 | 67 | // Done 68 | continue; 69 | } 70 | } 71 | 72 | // Check src value 73 | if (empty($object->src)) 74 | continue; 75 | 76 | // Check valid src 77 | if (false === stripos($object->src, '/wp-content/')) { 78 | $this->exception($object); 79 | continue; 80 | } 81 | 82 | // Check src path 83 | $src = explode('/wp-content/', $object->src, 2); 84 | $src = $src[1]; 85 | if (empty($src)) 86 | continue; 87 | 88 | // Retrieve file content 89 | $path = WP_CONTENT_DIR.'/'.$src; 90 | $content = @file_get_contents($path); 91 | if (empty($content)) 92 | continue; 93 | 94 | // Convert relative URLs 95 | $content = $this->absolutize($content, $src); 96 | 97 | // Remove reference 98 | $object->src = null; 99 | 100 | // Check extra data 101 | if (empty($object->extra) || !is_array($object->extra)) 102 | $object->extra = []; 103 | 104 | // Check previous inline styles 105 | $before = isset($object->extra['after'])? (array) $object->extra['after'] : []; 106 | 107 | // Add inline content 108 | $object->extra['after'] = array_merge([$content], $before); 109 | } 110 | } 111 | 112 | 113 | 114 | /** 115 | * Retrieve allowed excpetions 116 | */ 117 | public function allowed() { 118 | return $this->exceptions; 119 | } 120 | 121 | 122 | 123 | // Internal 124 | // --------------------------------------------------------------------------------------------------- 125 | 126 | 127 | 128 | /** 129 | * Register exception 130 | */ 131 | private function exception($object) { 132 | 133 | // Check URL version 134 | $url = $object->src; 135 | if (!empty($object->ver)) 136 | $url .= '&ver='.$object->ver; 137 | 138 | // Done 139 | $this->exceptions[] = $url; 140 | } 141 | 142 | 143 | 144 | /** 145 | * Convert relative stylesheets URLs to absolute URLs 146 | */ 147 | private function absolutize($content, $src) { 148 | 149 | // Early check 150 | if (false !== stripos($content, 'url(')) { 151 | 152 | // Prepare base URL 153 | $url = WP_CONTENT_URL.'/'.$src; 154 | $relative = $this->plugin->factory->relative($url); 155 | 156 | // Convert URLs 157 | $content = $relative->absolute($content); 158 | } 159 | 160 | // Done 161 | return $content; 162 | } 163 | 164 | 165 | 166 | } -------------------------------------------------------------------------------- /modules/inline-styles/styles/parser.php: -------------------------------------------------------------------------------- 1 | enabled = true; 70 | } 71 | 72 | 73 | 74 | // Methods 75 | // --------------------------------------------------------------------------------------------------- 76 | 77 | 78 | 79 | /** 80 | * Init output buffering 81 | */ 82 | public function start() { 83 | 84 | // Check mode 85 | if (!$this->enabled) 86 | return; 87 | 88 | // Buffering 89 | ob_start([$this, 'output']); 90 | } 91 | 92 | 93 | 94 | /** 95 | * Handles the output buffer 96 | */ 97 | public function output($buffer) { 98 | 99 | // Allowed stylesheet src's 100 | $this->allowed = $this->plugin->factory->inline->allowed(); 101 | 102 | // Check every stylesheet link 103 | $buffer = preg_replace_callback('/]*(rel[\s|\t]*=[\s|\t]*[\'"]stylesheet[\'"]|type[\s|\t]*=[\s|\t]*[\'"]text\/css[\'"])[^>]*>/is', [$this, 'replace'], $buffer); 104 | 105 | // Done 106 | return $buffer; 107 | } 108 | 109 | 110 | 111 | /** 112 | * Check and remove unallowed stylesheets 113 | */ 114 | public function replace($matches) { 115 | 116 | // Init 117 | $approved = true; 118 | 119 | // Entire link 120 | $link = $matches[0]; 121 | 122 | // Check href 123 | if (!preg_match('/[\s|\t]+href[\s|\t]*=[\s|\t]*[\'"](.*?)[\'"]/is', $link, $url)) { 124 | $approved = false; 125 | 126 | // With URL 127 | } else { 128 | 129 | // Decode URL 130 | $url = $url[1]; 131 | $url = str_replace('&', '&', $url); 132 | $url = str_replace(''', "'", $url); 133 | 134 | // Check URL 135 | if (empty($url)) { 136 | $approved = false; 137 | 138 | // Check allowed URL's 139 | } elseif (!in_array($url, $this->allowed)) { 140 | 141 | // Abort unallowed wp-content URL's 142 | if (false !== stripos($url, '/wp-content/')) 143 | $approved = false; 144 | } 145 | } 146 | 147 | // Done 148 | return $approved? $link : ''; 149 | } 150 | 151 | 152 | 153 | } -------------------------------------------------------------------------------- /modules/inline-styles/styles/relative.php: -------------------------------------------------------------------------------- 1 | base = $base; 38 | } 39 | 40 | 41 | 42 | // Methods 43 | // --------------------------------------------------------------------------------------------------- 44 | 45 | 46 | 47 | /** 48 | * Convert URLs to absolute 49 | */ 50 | public function absolute($content) { 51 | $result = preg_replace_callback('/url\((.*?)\)/i', [$this, 'replace'], $content); 52 | return empty($result)? $content : $result; 53 | } 54 | 55 | 56 | 57 | /** 58 | * Matched strings 59 | */ 60 | public function replace($matches) { 61 | return 'url("'.$this->convert($matches[1]).'")'; 62 | } 63 | 64 | 65 | 66 | // Internal 67 | // --------------------------------------------------------------------------------------------------- 68 | 69 | 70 | 71 | /** 72 | * Convert relative to absolute URLs 73 | * 74 | * Inspired by this code: 75 | * http://www.gambit.ph/converting-relative-urls-to-absolute-urls-in-php/ 76 | */ 77 | private function convert($rel) { 78 | 79 | // Triming 80 | $rel = trim($rel); 81 | $rel = trim($rel, "'"); 82 | $rel = trim($rel, '"'); 83 | $rel = trim($rel); 84 | 85 | // Base URL components 86 | $base = @parse_url($this->base); 87 | if (empty($base) || !is_array($base)) 88 | return $rel; 89 | 90 | // Base vars: $scheme, $host, $path 91 | extract($base); 92 | 93 | // Relative URL 94 | if (0 === strpos($rel,"//")) 95 | return $scheme . ':' . $rel; 96 | 97 | // Check if already is an absolute URL 98 | $result = @parse_url($rel, PHP_URL_SCHEME); 99 | if (!empty($result)) 100 | return $rel; 101 | 102 | // Queries and anchors 103 | if ('#' == $rel[0] || '?' == $rel[0]) 104 | return $this->base.$rel; 105 | 106 | // Remove non-directory element from path 107 | $path = preg_replace('#/[^/]*$#', '', $path); 108 | 109 | // Destroy path if relative url points to root 110 | if ('/' == $rel[0]) 111 | $path = ''; 112 | 113 | // First absolute URL 114 | $abs = $host.$path. '/'.$rel; 115 | 116 | // Replace '//' or '/./' or '/foo/../' with '/' 117 | $abs = preg_replace("/(\/\.?\/)/", "/", $abs); 118 | $abs = preg_replace("/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs); 119 | 120 | // Absolute URL is ready! 121 | return $scheme.'://'.$abs; 122 | } 123 | 124 | 125 | 126 | } -------------------------------------------------------------------------------- /modules/minify-html/core/core.php: -------------------------------------------------------------------------------- 1 | front()) { 26 | 27 | // Factory object 28 | $this->plugin->factory = new Factory($this->plugin); 29 | 30 | // WP loaded hook 31 | add_action('wp_loaded', [$this, 'loaded'], PHP_INT_MAX); 32 | } 33 | } 34 | 35 | 36 | 37 | /** 38 | * Check options in order to start buffering 39 | */ 40 | public function loaded() { 41 | $options = $this->plugin->factory->options; 42 | if ($options->minify()) { 43 | $this->plugin->factory->buffer->start($options->args()); 44 | } 45 | } 46 | 47 | 48 | 49 | /** 50 | * Check front context 51 | */ 52 | private function front() { 53 | 54 | // Admin 55 | if (is_admin()) { 56 | return false; 57 | } 58 | 59 | // Installing processes 60 | if (defined('WP_INSTALLING') && WP_INSTALLING) { 61 | return false; 62 | } 63 | 64 | // Avoid CRON requests 65 | if (defined('DOING_CRON') && DOING_CRON) { 66 | return false; 67 | } 68 | 69 | // XML-RPC request 70 | if (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) { 71 | return false; 72 | } 73 | 74 | // No WP-Cli allowed 75 | if (defined('WP_CLI') && WP_CLI) { 76 | return false; 77 | } 78 | 79 | // Login page 80 | global $pagenow; 81 | if (!empty($pagenow) && 'wp-login.php' == $pagenow) { 82 | return false; 83 | } 84 | 85 | // Allow 86 | return true; 87 | } 88 | 89 | 90 | 91 | } -------------------------------------------------------------------------------- /modules/minify-html/core/factory.php: -------------------------------------------------------------------------------- 1 | plugin); 34 | } 35 | 36 | 37 | 38 | /** 39 | * Parser object 40 | */ 41 | protected function createParser($args) { 42 | return new Html\Parser($args); 43 | } 44 | 45 | 46 | 47 | } -------------------------------------------------------------------------------- /modules/minify-html/core/options.php: -------------------------------------------------------------------------------- 1 | args['enabled'] = !defined('MINIFY_HTML') || MINIFY_HTML; 40 | 41 | /** 42 | * Decides if replace extra spaces in HTML and espaces between tags (except in styles, javascript code, and the content of textarea and pre tags) 43 | * Enabled by default, can be deactivated via constant 44 | */ 45 | $this->args['spacing'] = !defined('MINIFY_HTML_REMOVE_EXTRA_SPACING') || MINIFY_HTML_REMOVE_EXTRA_SPACING; 46 | 47 | /** 48 | * Decides if remove line breaks in HTML (except in styles, javascript code, and the content of textarea and pre tags) 49 | * Enabled by default, it can be deactivated via constant 50 | */ 51 | $this->args['lineBreaks'] = !defined('MINIFY_HTML_REMOVE_LINE_BREAKS') || MINIFY_HTML_REMOVE_LINE_BREAKS; 52 | 53 | /** 54 | * Defines the regexp pattern modifiers for proper UTF8 support 55 | * Enabled by default, it can be deactivated via constant 56 | */ 57 | $this->args['utf8Support'] = !defined('MINIFY_HTML_UTF8_SUPPORT') || MINIFY_HTML_UTF8_SUPPORT; 58 | 59 | /** 60 | * Decides if remove HTML comments (including HTML comments inside the pre tag but leaving the textarea comments) 61 | * Enabled by default, it can be deactivated via constant 62 | */ 63 | $this->args['comments'] = !defined('MINIFY_HTML_REMOVE_COMMENTS') || MINIFY_HTML_REMOVE_COMMENTS; 64 | 65 | /** 66 | * Decides if minify inline styles between tags removing extra espaces and line breaks 67 | * Enabled by default, it can be deactivated via constant 68 | */ 69 | $this->args['styles'] = !defined('MINIFY_HTML_INLINE_STYLES') || MINIFY_HTML_INLINE_STYLES; 70 | 71 | /** 72 | * Decides if remove inline styles comments 73 | * Enabled by default, it can be deactivated via constant 74 | */ 75 | $this->args['stylesComments'] = !defined('MINIFY_HTML_INLINE_STYLES_COMMENTS') || MINIFY_HTML_INLINE_STYLES_COMMENTS; 76 | 77 | /** 78 | * Decides if minify inline scripts between tags, removing extra espaces and line breaks 79 | * Disabled by default, it can be enabled via constant 80 | */ 81 | $this->args['scripts'] = defined('MINIFY_HTML_INLINE_SCRIPTS') && MINIFY_HTML_INLINE_SCRIPTS; 82 | 83 | /** 84 | * Decides if remove inline scripts comments 85 | * Disabled by default, it can be enabled via constant 86 | */ 87 | $this->args['scriptsComments'] = defined('MINIFY_HTML_INLINE_SCRIPTS_COMMENTS') && MINIFY_HTML_INLINE_SCRIPTS_COMMENTS; 88 | 89 | /** 90 | * Decides if remove conditional tags like 91 | * 92 | * Enabled by default, it can be deactivated via constant 93 | */ 94 | $this->args['conditionals'] = !defined('MINIFY_HTML_REMOVE_CONDITIONALS') || MINIFY_HTML_REMOVE_CONDITIONALS; 95 | 96 | /** 97 | * Decides if removes self-closing markup for HTML5 documents 98 | * Disabled by default, it can be enabled via constant 99 | */ 100 | $this->args['selfClosing'] = defined('MINIFY_HTML_REMOVE_HTML5_SELF_CLOSING') && MINIFY_HTML_REMOVE_HTML5_SELF_CLOSING; 101 | 102 | // Minify or not decision 103 | $this->minify = $this->args['enabled'] && ( 104 | $this->args['spacing'] || $this->args['lineBreaks'] || $this->args['comments'] || 105 | $this->args['styles'] || $this->args['scripts'] || $this->args['conditionals'] || $this->args['selfClosing']); 106 | } 107 | 108 | 109 | 110 | /** 111 | * Returns minify decision 112 | */ 113 | public function minify() { 114 | return $this->minify; 115 | } 116 | 117 | 118 | 119 | /** 120 | * Retrieve parsing arguments 121 | */ 122 | public function args() { 123 | return $this->args; 124 | } 125 | 126 | 127 | 128 | } -------------------------------------------------------------------------------- /modules/minify-html/html/buffer.php: -------------------------------------------------------------------------------- 1 | args = $args; 31 | @ob_start([$this, 'output']); 32 | } 33 | 34 | 35 | 36 | /** 37 | * Ouput buffer operations 38 | */ 39 | public function output($buffer) { 40 | 41 | // XML test 42 | $test = strtolower(substr(ltrim($buffer), 0, 5)); 43 | if ($test == 'plugin->factory->parser($this->args)->parse($buffer); 49 | 50 | // Done 51 | return $buffer; 52 | } 53 | 54 | 55 | 56 | } -------------------------------------------------------------------------------- /modules/minify-html/html/parser.php: -------------------------------------------------------------------------------- 1 | true, 36 | 'spacing' => false, 37 | 'lineBreaks' => false, 38 | 'comments' => false, 39 | 'styles' => false, 40 | 'stylesComments' => false, 41 | 'scripts' => false, 42 | 'scriptsComments' => false, 43 | 'conditionals' => false, 44 | 'selfClosing' => false, 45 | ]; 46 | 47 | 48 | 49 | /** 50 | * Constructor 51 | */ 52 | public function __construct($args) { 53 | $this->args = array_merge($this->defaults, $args); 54 | } 55 | 56 | 57 | 58 | /** 59 | * Parse HTML using the provided options 60 | * Strongly inspired in Minify HTML plugin 61 | * https://wordpress.org/plugins/minify-html-markup/ 62 | */ 63 | public function parse($html) { 64 | 65 | 66 | /* Prepare input */ 67 | 68 | // Get vars 69 | extract($this->args); 70 | 71 | // Check regexp pattern modifier 72 | $pm = $utf8Support? 'u' : ''; 73 | 74 | // Evaluates self-closing tags 75 | if ($selfClosing) { 76 | $test = strtolower(substr(ltrim($html), 0, 15)); 77 | $selfClosing = ($test == ''); 78 | } 79 | 80 | 81 | /* Early replacements */ 82 | 83 | /* 84 | * Removes conditional tags 85 | */ 86 | if ($conditionals) { 87 | $html = preg_replace('/)[^\]]*)*]-->/U'.$pm, '', $html); 88 | } 89 | 90 | 91 | /* Transformations */ 92 | 93 | // Sensitive tags 94 | $tags_src = []; 95 | $tags_new = []; 96 | $tags = ['style', 'script', 'textarea', 'pre']; 97 | 98 | // Prepare delimiters 99 | foreach ($tags as $tag) { 100 | 101 | // Tag 102 | $ini = '<'.$tag; 103 | $end = '/'.$tag.'>'; 104 | 105 | // Source and new tag 106 | $tags_src[] = $ini; 107 | $tags_src[] = $end; 108 | $tags_new[] = self::TAG_INI.$ini; 109 | $tags_new[] = $end.self::TAG_END; 110 | } 111 | 112 | // Splits the content 113 | $parts = str_ireplace($tags_src, $tags_new, $html); 114 | $parts = explode(self::TAG_END, $parts); 115 | 116 | // Init output 117 | $minified = ''; 118 | 119 | // Enum parts 120 | foreach ($parts as $part) { 121 | 122 | // Init 123 | $insideComments = false; 124 | 125 | // Find tag start 126 | $pos = stripos($part, self::TAG_INI); 127 | if (false === $pos) { 128 | $before = $part; 129 | $inside = ''; 130 | 131 | /** 132 | * Process sensitive tags 133 | * Note: tags textarea and pre will remain intact (but pre tag could lose the html comments) 134 | */ 135 | } else { 136 | 137 | // Detect before and inside content 138 | $before = substr($part, 0, $pos); 139 | $inside = substr($part, $pos + 32); 140 | 141 | // Process styles 142 | if (''); 149 | $pos2 = strrpos($inside, '<'); 150 | if ($pos1 && $pos2 && $pos2 > $pos1) { 151 | 152 | // Split in lines 153 | $code = trim(substr($inside, $pos1 + 1, $pos2 - $pos1 - 1)); 154 | if ('' !== $code) { 155 | 156 | // Remove CSS comments 157 | if ($stylesComments) { 158 | $code = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $code); 159 | } 160 | 161 | // Minification 162 | $code = $this->spacing($code); 163 | $code = str_replace([chr(10), ' {', '{ ', ' }', '} ', '( ', ' )', ' :', ': ', ' ;', '; ', ' ,', ', ', ';}'], 164 | ['', '{', '{', '}', '}', '(', ')', ':', ':', ';', ';', ',', ',', '}'], $code); 165 | 166 | // Prepare surrounding tags 167 | $open = $this->inline(substr($inside, 0, $pos1 + 1)); 168 | $close = $this->inline(substr($inside, $pos2)); 169 | 170 | // Done 171 | $inside = $open.$code.$close; 172 | } 173 | } 174 | } 175 | 176 | // Process scripts 177 | } elseif (''); 184 | $pos2 = strrpos($inside, '<'); 185 | if ($pos1 && $pos2 && $pos2 > $pos1) { 186 | 187 | // Split in lines 188 | $code = trim(substr($inside, $pos1 + 1, $pos2 - $pos1 - 1)); 189 | if ('' !== $code) { 190 | // Debug point 191 | //error_log($inside); 192 | // Split in lines 193 | $code = str_replace(chr(13).chr(10), chr(10), $code); 194 | $code = explode(chr(10), $code); 195 | 196 | // Enumeration 197 | $lines = []; 198 | foreach ($code as $line) { 199 | 200 | // Check line 201 | $line = trim($line); 202 | if ('' === $line) { 203 | continue; 204 | } 205 | 206 | // Remove extra characters 207 | $line = $this->spacing($line); 208 | $line = preg_replace('/;+/', ';', $line); 209 | $line = str_replace([' {', '{ ', ' }', '} ', '( ', ' )', ' =', '= ', ' :', ': ', ' ;', '; ', ' ,', ', '], 210 | ['{', '{', '}', '}', '(', ')', '=', '=', ':', ':', ';', ';', ',', ',' ], $line); 211 | 212 | // Added 213 | $lines[] = trim($line); 214 | } 215 | 216 | // Minify it 217 | $code = implode('', $lines); 218 | 219 | /** 220 | * Remove Javascript comments 221 | * https://stackoverflow.com/questions/19509863/how-to-remove-js-comments-using-php 222 | */ 223 | if ($scriptsComments) { 224 | $pattern = '/(?:(?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:(?inline(substr($inside, 0, $pos1 + 1)); 233 | $close = $this->inline(substr($inside, $pos2)); 234 | 235 | // Done 236 | $inside = $open.$code.$close; 237 | // Debug point 238 | //error_log($inside); 239 | } 240 | } 241 | } 242 | 243 | // Process pre tag 244 | } elseif ('', '>', $before); 267 | $before = str_replace('/>', '>', $before); 268 | } 269 | 270 | // Remove line breaks 271 | if ($lineBreaks) { 272 | $before = str_replace(chr(13).chr(10), chr(10), $before); 273 | $before = str_replace(chr(10), '', $before); 274 | } 275 | 276 | // Remove tabs and extra spacing 277 | if ($spacing) { 278 | $before = $this->spacing($before); 279 | } 280 | 281 | // Add chunk 282 | $minified .= $before.$inside; 283 | } 284 | 285 | // Done 286 | return $minified; 287 | } 288 | 289 | 290 | 291 | /** 292 | * Prepares inline tag 293 | */ 294 | private function inline($string) { 295 | $string = str_replace(chr(13).chr(10), chr(10), $string); 296 | $string = str_replace(chr(10), ' ', $string); 297 | $string = $this->spacing($string); 298 | return $string; 299 | } 300 | 301 | 302 | 303 | /** 304 | * Removes extra spacing 305 | */ 306 | private function spacing($string) { 307 | $string = preg_replace('/\x9/', ' ', $string); 308 | $string = preg_replace('/\x20+/', ' ', trim($string, ' \0\x0B')); 309 | return $string; 310 | } 311 | 312 | 313 | 314 | } -------------------------------------------------------------------------------- /modules/minify-html/module.php: -------------------------------------------------------------------------------- 1 | enabled()) { 33 | Core\Core::instance($this); 34 | } 35 | } 36 | 37 | 38 | 39 | } -------------------------------------------------------------------------------- /modules/remove-query-strings/core/filter.php: -------------------------------------------------------------------------------- 1 | prefix = $prefix; 28 | } 29 | 30 | 31 | 32 | /** 33 | * Process query strings 34 | */ 35 | public function run($src) { 36 | 37 | // Decomposes URL 38 | if (false !== ($url = @parse_url($src))) { 39 | 40 | // Check result array 41 | if (!empty($url) && is_array($url) && !empty($url['query'])) { 42 | 43 | // Extract arguments 44 | @parse_str($url['query'], $args); 45 | if (!empty($args) && is_array($args)) { 46 | 47 | // Remove arguments without value 48 | foreach ($args as $arg => $value) { 49 | if ('' === trim(''.$value)) 50 | $src = remove_query_arg($arg, $src); 51 | } 52 | 53 | // Load unwanted args 54 | $unwanted = apply_filters($this->prefix.'_unwanted_args', $this->unwanted(), $src); 55 | if (empty($unwanted) || !is_array($unwanted)) 56 | return $src; 57 | 58 | // Enum URL args 59 | foreach ($args as $arg => $value) { 60 | 61 | // Check removable arg 62 | if (in_array($arg, $unwanted)) { 63 | 64 | // Remove avoiding agressive arg removing 65 | $src = remove_query_arg($arg, $src); 66 | } 67 | } 68 | } 69 | } 70 | } 71 | 72 | // Done 73 | return $src; 74 | } 75 | 76 | 77 | 78 | /** 79 | * Check the constant REMOVE_QUERY_STRINGS_ARGS 80 | * Example: define('REMOVE_QUERY_STRINGS_ARGS', 'ver,test,w'); 81 | */ 82 | private function unwanted() { 83 | 84 | // Local cache 85 | static $unwanted; 86 | if (isset($unwanted)) 87 | return $unwanted; 88 | 89 | // Inspect wp-config.php constant 90 | if (defined('REMOVE_QUERY_STRINGS_ARGS')) { 91 | 92 | // Initialize user args 93 | $args = []; 94 | 95 | // Extract arguments 96 | $const = explode(',', REMOVE_QUERY_STRINGS_ARGS); 97 | foreach ($const as $arg) { 98 | $arg = trim($arg); 99 | if ('' !== $arg) 100 | $args[] = $arg; 101 | } 102 | } 103 | 104 | // Set result 105 | $unwanted = empty($args)? $this->defaultArgs() : $args; 106 | 107 | // Done 108 | return $unwanted; 109 | } 110 | 111 | 112 | 113 | /** 114 | * Default remove query string args 115 | */ 116 | private function defaultArgs() { 117 | return ['ver', 'version', 'v']; 118 | } 119 | 120 | 121 | 122 | } -------------------------------------------------------------------------------- /modules/remove-query-strings/module.php: -------------------------------------------------------------------------------- 1 | enabled() ) { 39 | return $src; 40 | } 41 | 42 | if ( defined('REMOVE_QUERY_STRINGS') && REMOVE_QUERY_STRINGS ) { 43 | // Local cache 44 | static $filter; 45 | 46 | if ( !isset($filter) ) { 47 | $filter = new Core\Filter(self::PREFIX); 48 | } 49 | 50 | // Process filter 51 | return $filter->run($src); 52 | } 53 | 54 | return $src; 55 | } 56 | } -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Speed Demon 2 | 3 | Performance hacks for WordPress 4 | 5 | ## Changelog 6 | 7 | ### 1.4.0 8 | * bundled Dashboard Cleanup 1.1.2 9 | * removed Index Autoload (included in WP Core after 5.3+) 10 | * changed Remove Query Strings to be disabled by default (all constants) 11 | 12 | ### 1.3.2 13 | * updated plugin meta 14 | 15 | ### 1.3.1 16 | * updated plugin meta 17 | 18 | ### 1.3.0 19 | * tested with WP 5.0 20 | * bundled Disable Gutenberg (1.0.0) default = true 21 | * bundled Disable WooCommerce Status (1.0.4) default = false 22 | * bundled Disable WooCommerce Styles (1.0.1) default = false 23 | 24 | ### 1.2.2 25 | * updated Minify HTML (1.0.1) 26 | * (fixed bug in `REMOVE_EXTRA_SPACING` that was removing spaces before/after inline HTML tags) 27 | 28 | ### 1.2.1 29 | * updated plugin meta 30 | 31 | ### 1.2.0 32 | * bundled Minify HTML (1.0.0) default = true 33 | * changed Inline Styles default = false 34 | * changed Disable Admin-AJAX default = false 35 | * optimized plugin code 36 | * fixed PHP 5.x error... you're welcome, now upgrade to PHP 7.2! ;) e.g. `Parse error: syntax error, unexpected 'default' (T_DEFAULT), expecting identifier (T_STRING) in ../wp-content/plugins/speed-demon-littlebizzy/modules/remove-query-strings/core/filter.php on line 116` 37 | 38 | ### 1.1.0 39 | * bundled Disable Admin-AJAX (1.0.0) default = true 40 | * bundled Disable Cart Fragments (1.1.3) default = true 41 | * bundled Disable jQuery Migrate (1.0.0) default = true 42 | * bundled Header Cleanup (1.1.1) default = true 43 | * bundled Index Autoload (1.1.1) default = true 44 | * added recommended plugins notice 45 | * added rating request notice 46 | 47 | ### 1.0.0 48 | * initial release 49 | * tested with PHP 7.0, 7.1, 7.2 50 | * implemented PHP namespaces 51 | * implemented object-oriented codebase 52 | * added warning for Multisite installations 53 | * bundled Delete Expired Transients (1.0.3) default = true 54 | * bundled Disable Embeds (1.1.1) default = true 55 | * bundled Disable Emojis (1.1.2) default = true 56 | * bundled Disable Post Via Email (1.0.0) default = true 57 | * bundled Disable XML-RPC (1.0.8) default = true 58 | * bundled Inline Styles (1.1.0) default = true 59 | * bundled Remove Query Strings (1.3.1) default = true 60 | 61 | ### Defined Constants 62 | 63 | /** Speed Demon Functions v1.4.0 */ 64 | define('DASHBOARD_CLEANUP', true); // default = true 65 | define('DASHBOARD_CLEANUP_ADD_PLUGIN_TABS', true); // default = true 66 | define('DASHBOARD_CLEANUP_ADD_THEME_TABS', true); // default = true 67 | define('DASHBOARD_CLEANUP_CSS_ADMIN_NOTICE', true); // default = true 68 | define('DASHBOARD_CLEANUP_DISABLE_SEARCH', true); // default = true 69 | define('DASHBOARD_CLEANUP_EVENTS_AND_NEWS', true); // default = true 70 | define('DASHBOARD_CLEANUP_IMPORT_EXPORT_MENU', true); // default = true 71 | define('DASHBOARD_CLEANUP_LINK_MANAGER_MENU', true); // default = true 72 | define('DASHBOARD_CLEANUP_QUICK_DRAFT', true); // default = true 73 | define('DASHBOARD_CLEANUP_THANKS_FOOTER', true); // default = true 74 | define('DASHBOARD_CLEANUP_WELCOME_TO_WORDPRESS', true); // default = true 75 | define('DASHBOARD_CLEANUP_WOOCOMMERCE_CONNECT_STORE', true); // default = true 76 | define('DASHBOARD_CLEANUP_WOOCOMMERCE_FOOTER_TEXT', true); // default = true 77 | define('DASHBOARD_CLEANUP_WOOCOMMERCE_MARKETPLACE_SUGGESTIONS', true); // default = true 78 | define('DASHBOARD_CLEANUP_WOOCOMMERCE_PRODUCTS_BLOCK', true); // default = true 79 | define('DASHBOARD_CLEANUP_WOOCOMMERCE_TRACKER', true); // default = true 80 | define('DASHBOARD_CLEANUP_WP_ORG_SHORTCUT_LINKS', true); // default = true 81 | define('DELETE_EXPIRED_TRANSIENTS', true); // default = true 82 | define('DELETE_EXPIRED_TRANSIENTS_HOURS', '6'); // default = 6 83 | define('DELETE_EXPIRED_TRANSIENTS_MAX_EXECUTION_TIME', '10'); // default = 10 84 | define('DELETE_EXPIRED_TRANSIENTS_MAX_BATCH_RECORDS', '50'); // default = 50 85 | define('DISABLE_ADMIN_AJAX', false); // default = false 86 | define('DISABLE_CART_FRAGMENTS', true); // default = true 87 | define('DISABLE_EMBEDS', true); // default = true 88 | define('DISABLE_EMBEDS_ALLOWED_SOURCES', 'none'); // default = (none) 89 | define('DISABLE_EMOJIS', true); // default = true 90 | define('DISABLE_GUTENBERG', true); // default = true 91 | define('DISABLE_JQUERY_MIGRATE', true); // default = true 92 | define('DISABLE_POST_VIA_EMAIL', true); // default = true 93 | define('DISABLE_WOOCOMMERCE_STATUS', false); // default = false 94 | define('DISABLE_WOOCOMMERCE_STYLES', false); // default = false 95 | define('DISABLE_WOOCOMMERCE_STYLES_NAMES', 'select2'); // default = select2 96 | define('DISABLE_WOOCOMMERCE_STYLES_PREFIXES', 'woocommerce,wc'); // default = woocommerce,wc 97 | define('DISABLE_XML_RPC', true); // default = true 98 | define('HEADER_CLEANUP', true); // default = true 99 | define('INLINE_STYLES', false); // default = false 100 | define('MINIFY_HTML', true); // default = true 101 | define('MINIFY_HTML_INLINE_STYLES', true); // default = true 102 | define('MINIFY_HTML_INLINE_STYLES_COMMENTS', true); // default = true 103 | define('MINIFY_HTML_REMOVE_COMMENTS', true); // default = true 104 | define('MINIFY_HTML_REMOVE_CONDITIONALS', true); // default = true 105 | define('MINIFY_HTML_REMOVE_EXTRA_SPACING', true); // default = true 106 | define('MINIFY_HTML_REMOVE_HTML5_SELF_CLOSING', false); // default = false 107 | define('MINIFY_HTML_REMOVE_LINE_BREAKS', true); // default = true 108 | define('MINIFY_HTML_INLINE_SCRIPTS', false); // default = false 109 | define('MINIFY_HTML_INLINE_SCRIPTS_COMMENTS', false); // default = false 110 | define('MINIFY_HTML_UTF8_SUPPORT', true); // default = true 111 | define('REMOVE_QUERY_STRINGS', false); // default = false 112 | define('REMOVE_QUERY_STRINGS_ARGS', 'v,ver,version'); // default = v,ver,version 113 | 114 | ### Included Modules 115 | 116 | * [Dashboard Cleanup](https://www.littlebizzy.com/plugins/dashboard-cleanup) 117 | * [Delete Expired Transients](https://www.littlebizzy.com/plugins/delete-expired-transients) 118 | * [Disable Admin-AJAX](https://www.littlebizzy.com/plugins/disable-admin-ajax) 119 | * [Disable Cart Fragments](https://www.littlebizzy.com/plugins/disable-cart-fragments) 120 | * [Disable Dashicons](https://www.littlebizzy.com/plugins/disable-dashicons) 121 | * [Disable Embeds](https://www.littlebizzy.com/plugins/disable-embeds) 122 | * [Disable Emojis](https://www.littlebizzy.com/plugins/disable-emojis) 123 | * Disable Feeds 124 | * [Disable Gutenberg](https://www.littlebizzy.com/plugins/disable-gutenberg) 125 | * [Disable jQuery Migrate](https://www.littlebizzy.com/plugins/disable-jquery-migrate) 126 | * [Disable Post Via Email](https://www.littlebizzy.com/plugins/disable-post-via-email) 127 | * Disable Thumbnail Regeneration 128 | * [Disable WooCommerce Status](https://www.littlebizzy.com/plugins/disable-woocommerce-status) 129 | * [Disable WooCommerce Styles](https://www.littlebizzy.com/plugins/disable-woocommerce-styles) 130 | * [Disable XML-RPC](https://www.littlebizzy.com/plugins/disable-xml-rpc) 131 | * [Header Cleanup](https://www.littlebizzy.com/plugins/header-cleanup) 132 | * [Inline Styles](https://www.littlebizzy.com/plugins/inline-styles) 133 | * [Minify HTML](https://www.littlebizzy.com/plugins/minify-html) 134 | * [Remove Query Strings](https://www.littlebizzy.com/plugins/remove-query-strings) 135 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === Speed Demon === 2 | 3 | A powerful bundle of lightweight tweaks that drastically improve the loading speed of WordPress by reducing bloat and improving overall efficiency. 4 | 5 | == Description == 6 | 7 | A powerful bundle of lightweight tweaks that drastically improve the loading speed of WordPress by reducing bloat and improving overall efficiency. 8 | 9 | #### Current Features #### 10 | 11 | * *Check Gzip Compression (1.4+)* 12 | * *Combine Google Fonts (1.4+)* 13 | * *Dashboard Cleanup (1.4+)* 14 | * Remove WordPress.org shortcuts 15 | * Remove "Thank you for creating with WordPress." 16 | * Remove "If you like WooCommerce please leave us a rating. A huge thanks in advance!" 17 | * Disable Welcome To WordPress admin notice 18 | * Disable Quick Draft dashboard widget 19 | * Disable WordPress Events and News dashboard widget 20 | * Disable Gutenberg admin notice 21 | * *Database Cleanup (1.4+)* 22 | * [Delete Expired Transients](https://wordpress.org/plugins/delete-expired-transients-littlebizzy/) 23 | * *Delete Old Revisions (1.4+)* 24 | * *Delete Orphan Data (1.4+)* 25 | * [Disable Admin-AJAX](https://wordpress.org/plugins/disable-admin-ajax-littlebizzy/) 26 | * [Disable Cart Fragments](https://wordpress.org/plugins/disable-cart-fragments-littlebizzy/) 27 | * [Disable Embeds](https://wordpress.org/plugins/disable-embeds-littlebizzy/) 28 | * Disable External Embeds (oEmbeds) 29 | * Disable Self Embeds (Internal Embeds) 30 | * (Allowed Sources supported) 31 | * [Disable Emojis](https://wordpress.org/plugins/disable-emojis-littlebizzy/) 32 | * *Disable Feeds (1.4+)* 33 | * Disable RSS Feeds 34 | * Disable Atom Feeds 35 | * *Disable Gravatars (1.4+)* 36 | * [Disable Gutenberg](https://wordpress.org/plugins/disable-gutenberg-littlebizzy/) 37 | * Disable Gutenberg block editor 38 | * Disable Gutenberg settings page 39 | * Disable Gutenberg admin notice 40 | * [Disable jQuery Migrate](https://wordpress.org/plugins/disable-jq-migrate-littlebizzy/) 41 | * *Disable Pinging (1.4+)* 42 | * Disable Update Services 43 | * [Disable Post Via Email](https://wordpress.org/plugins/disable-post-via-email-littlebizzy/) 44 | * *Disable REST API (1.4+)* 45 | * *Disable Widgets (1.4+)* 46 | * [Disable WooCommerce Status](https://wordpress.org/plugins/disable-wc-status-littlebizzy/) 47 | * [Disable WooCommerce Styles](https://wordpress.org/plugins/disable-wc-styles-littlebizzy/) 48 | * [Disable XML-RPC](https://wordpress.org/plugins/disable-xml-rpc-littlebizzy/) 49 | * Disable Pingbacks 50 | * Disable Self Ping (Pingbacks) 51 | * Disable Trackbacks 52 | * [Header Cleanup](https://wordpress.org/plugins/header-cleanup-littlebizzy/) 53 | * Remove `adjacent_posts_rel_link` 54 | * Remove `adjacent_posts_rel_link_wp_head` 55 | * Remove `feed_links` 56 | * Remove `feed_links_extra` 57 | * Remove `index_rel_link` 58 | * Remove `parent_post_rel_link` 59 | * Remove `rest_output_link_wp_head` 60 | * Remove `rsd_link` 61 | * Remove `start_post_rel_link` 62 | * Remove `wc_generator_tag` 63 | * Remove `wlwmanifest_link` 64 | * Remove `wp_generator` 65 | * Remove `wp_resource_hints` 66 | * Remove `wp_shortlink_wp_head` 67 | * *Inline Scripts (1.4+)* 68 | * [Inline Styles](https://wordpress.org/plugins/inline-styles-littlebizzy/) 69 | * *Lazy Load (1.4+)* 70 | * *Limit WP Cron (1.4+)* 71 | * *Limit Heartbeat (1.4+)* 72 | * [Minify HTML](https://wordpress.org/plugins/minify-html-littlebizzy/) 73 | * [Remove Query Strings](https://wordpress.org/plugins/remove-query-strings-littlebizzy/) 74 | * (more modules coming soon...) 75 | 76 | #### Technical Details #### 77 | 78 | * Parent Plugin: N/A 79 | * Disable Nag Notices: [Yes](https://codex.wordpress.org/Plugin_API/Action_Reference/admin_notices#Disable_Nag_Notices) 80 | * Settings Page: No 81 | * PHP Namespaces: Yes 82 | * Object-Oriented Code: Yes 83 | * Includes Media (images, icons, etc): No 84 | * Includes CSS: No 85 | * Database Storage: Yes 86 | * Transients: No 87 | * WP Options Table: Yes 88 | * Other Tables: No 89 | * Creates New Tables: No 90 | * Database Queries: Backend Only (Options API) 91 | * Must-Use Support: [Yes](https://github.com/littlebizzy/autoloader) 92 | * Multisite Support: No 93 | * Uninstalls Data: Yes 94 | 95 | #### Disclaimer #### 96 | 97 | We released this plugin in response to our managed hosting clients asking for better access to their server, and our primary goal will remain supporting that purpose. Although we are 100% open to fielding requests from the WordPress community, we kindly ask that you keep these conditions in mind, and refrain from slandering, threatening, or harassing our team members in order to get a feature added, or to otherwise get "free" support. The only place you should be contacting us is in our free [**Facebook group**](https://www.facebook.com/groups/littlebizzy/) which has been setup for this purpose, or via GitHub if you are an experienced developer. Thank you! 98 | 99 | == Installation == 100 | 101 | 1. Upload to `/wp-content/plugins/speed-demon-littlebizzy` 102 | 2. Activate via WP Admin > Plugins 103 | 3. Test plugin is working: 104 | 105 | After activating the plugin, all defined constants should work properly. Don't forget to purge all caches. 106 | 107 | == Frequently Asked Questions == 108 | 109 | = What makes this plugin different from others? = 110 | 111 | Speed Demon is a lightweight PHP-only plugin that bundles several of our popular performance micro-plugins into a single plugin. All functions can be controlled precisely using defined constants. The purpose of this plugin is to bundle several of our popular performance plugins into one single plugin for easier installation and management. In order to do this efficiently, however, Speed Demon maintains our popular "no settings page" approach to avoid database queries and instability/setup requirements. The most stable functions (sub-plugins) are enabled by default, while less predictable functions (sub-plugins) such as Inline Styles are disabled by default. In order to enable or disable any given function (sub-plugin) simply use the defined constants below inside your wp-config.php file or using our free Custom Functions plugin instead. 112 | 113 | = Do all your plugins support the defined constants? = 114 | 115 | Note: these defined constants are ONLY supported within Speed Demon. If you have one of these installed as a standalone plugin already, that function WILL REMAIN ENABLED until you disable the standalone version of the function. For example, if you disable Index Autoload in Speed Demon using a defined constant, but you still have our other Index Autoload plugin installed + enabled, then that function will continue to function until you disable or delete the standalone Index Autoload plugin. This allows for web hosts or other agencies to force-control their WordPress environment using our standalone plugins. 116 | 117 | = How can I change this plugin's settings? = 118 | 119 | There is no settings page. To enable/disable a certain function (sub-plugin) use the defined constants only. 120 | 121 | = Why don't you have a settings page? = 122 | 123 | Because that would mean database queries and more time/hassle/confusion for setup. No settings page means web developers, agencies, or web hosts can automate their WordPress setups (such as with Bash scripts, etc) much faster and easier, and clients have less chance of accidentally messing things up by snooping around a settings page. 124 | 125 | = Does it work alongside XYZ plugin? = 126 | 127 | Yes, it will work no matter what plugins/theme you have installed, there should be no conflicts. However we don't recommend using other similar performance plugins at the same time as Speed Demon to avoid conflicts or redundancy. 128 | 129 | = My site looks horrible after installing this? = 130 | 131 | Turn off Inline Styles using the defined constant `define('INLINE_STYLES', 'false');` and consider ditching whatever bloated and horribly coded plugin is causing the problem, such as janky "slider" plugins, etc. Also ensure you are using PHP 7+ 132 | 133 | = Why don't you support defer, async, or concantenation of JS/CSS files? = 134 | 135 | No serious website uses these methods. Don't believe us? Check the Alexa Top 100 sites and look at their source code. You will never see any high traffic or serious website using these methods because they are so risky. "But PageSpeed Insights told me to! I'm scared of Google!" ... do what you wish, we know from experience it will not help your rankings (or speed, in the vast majority of cases... and no, "scores" are not the same as "speed"). Rather than altering or manipulating the loading order (or loading location) of JS/CSS it makes much more sense to only install plugins or themes from quality authors, who should be trusted to load JS/CSS resources how and where they want. The only method we currently support is inlining all CSS stylesheets, which should work fine on 90% of WordPress sites (bloated/unstable plugins like sliders may have an issue). Likewise, many JS scripts inherently support defer/async, such as Google's Universal Analytics snippet. We don't believe in "hacky" solutions, but rather in trusting code sources to handle these things (in other words, choose your software wisely). Lastly, if you really want to concatenate all your JS into one crap-pile, it would be better to let you CDN provider do this for you (such as CloudFlare's free RocketLoader feature) rather than bundling your JS into some nasty temp file on your origin server. 136 | 137 | = What if I already have the corresponding micro-plugin installed? = 138 | 139 | Each module checks some constant(s) and class(es) from the original plugin release, and if some are detected then aborts the module execution. this is the sequence when a module ask if can continue the execution: 140 | 141 | * First check the existence of the corresponding module constants (REMOVE_QUERY_STRINGS, DISABLE_XML_RPC) and stops the module execution if defined with a false value. 142 | * Next step looks for a inherent constant of the original plugin to check if is running (RMQRST_FILE for Remove Query Strings, \LittleBizzy\DisableEmojis\FILE for Disable Emojis, etc.), aborting if detect the previous plugin. 143 | * Sometimes the original plugin does not have a constant (code from other developers), so just in case checks the plugin class existence (\LB_Disable_XML_RPC etc.) 144 | * But these checks do not do anything with the original plugin optional constants: REMOVE_QUERY_STRINGS_ARGS, DELETE_EXPIRED_TRANSIENTS_HOURS, etc.) 145 | 146 | These checks of existing constants and classes are performed as late as possible, in order to give time to execute these constants/classes from different locations: wp-config.php, other plugins, functions.php from theme, etc. 147 | 148 | = Technically speaking, how does it check for micro-plugin code? = 149 | 150 | Some modules code have changes from the original due the common module/plugin adaptation mechanisms, but I tried to keep the original code fragments (Always will need small changes: namespaces, a separated main module folder, calls to check if the module is enabled, unified activation/deactivacion/uninstall hooks, etc.) 151 | 152 | Regarding the modules: 153 | 154 | - Remove Query Strings 155 | The cancellation check works right on the style and loader filters. 156 | 157 | - Disable XML-RPC 158 | The last minute check occurs after the WP init hook. I have reorganized the plugin structure to fit the common module mechanism. 159 | 160 | - Disable Embeds 161 | Checks constants/classes at the beginning and after the init hook. Tested the correct execution on activation/deactivation hooks. 162 | 163 | - Disable Emojis 164 | Checks constants/classes at first and also after the init hook. 165 | 166 | - Delete Expired Transients 167 | Checking on start and under cron event execution. 168 | 169 | - Disable Post Via Email 170 | Just checks on start, it is not possible to check the module later due the early execution in wp-mail.php 171 | 172 | - Inline Styles 173 | Checks on start, and on the `wp_loaded` hook. 174 | 175 | - Disable Admin-AJAX 176 | The associated constant must be defined at the wp-config.php level because this module does not use any wp hook and runs at the same time of the plugin execution. 177 | 178 | - Disable Cart Fragments 179 | There is a conflict with previous constant DISABLE_CART_FRAGMENTS, which if exists is expected to be an array from the old plugin. The new module supports the different data types (boolean or array), but if the constant remains boolean and the old plugin is activated, then the `true`value is interpreted as page 1 (due the type casting). 180 | The last check looking if the module is enabled works just before to remove the enqueued carts fragments scripts, so this module constant can be located anywhere. 181 | 182 | - Disable jQuery Migrate 183 | Module is checked on the wp_default_scripts WP core hook, so the module constant can be defined in any place. 184 | 185 | - Header Cleanup 186 | Plugin functionality is checked at WP init hook, so the module constant can be defined anywhere. 187 | 188 | = I have a suggestion, how can I let you know? = 189 | 190 | Please avoid leaving negative reviews in order to get a feature implemented. Join our Facebook group instead. 191 | -------------------------------------------------------------------------------- /speed-demon.php: -------------------------------------------------------------------------------- 1 |