├── LICENSE ├── admin ├── admin.php ├── assets │ ├── css │ │ └── comment-hacks.css │ └── js │ │ ├── comment-hacks.js │ │ └── remove-url.js ├── comment-parent.php └── views │ ├── comment-parent-box.php │ └── config-page.php ├── comment-hacks.php ├── inc ├── autoload.php ├── clean-emails.php ├── email-links.php ├── forms.php ├── hacks.php ├── length.php ├── notifications.php ├── progress-planner-tasks.php └── progress-planner │ ├── comment-moderation.php │ ├── comment-policy.php │ └── comment-redirect.php ├── index.php ├── phpcs.xml.dist ├── phpstan.neon.dist └── readme.txt /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 | -------------------------------------------------------------------------------- /admin/admin.php: -------------------------------------------------------------------------------- 1 | options = Hacks::get_options(); 76 | } 77 | 78 | /** 79 | * Enqueue a small script on the discussion settings page to link to the comment experience settings page. 80 | * 81 | * @param string $hook The current admin page. 82 | * 83 | * @return void 84 | */ 85 | public function enqueue_discussion_settings_script( $hook ) { 86 | if ( $hook !== 'options-discussion.php' ) { 87 | return; 88 | } 89 | 90 | \wp_add_inline_script( 91 | 'jquery-core', 92 | 'jQuery(document).ready(function($){ 93 | var link = "
Note: You will find more comment settings on the Comment Experience plugin\'s settings page.
"; 94 | $(".wrap > h1").after(link); 95 | });' 96 | ); 97 | } 98 | 99 | /** 100 | * Show when a comment was forwarded already. 101 | * 102 | * @param string $comment_text Text of the current comment. 103 | * @param WP_Comment $comment The comment object. Null if not found. 104 | * 105 | * @return string 106 | */ 107 | public function show_forward_status( $comment_text, $comment ): string { 108 | if ( ! \is_admin() ) { 109 | return $comment_text; 110 | } 111 | 112 | $ch_forwarded = \get_comment_meta( (int) $comment->comment_ID, 'ch_forwarded' ); 113 | if ( $ch_forwarded ) { 114 | /* translators: %s is replaced by the name you're forwarding to. */ 115 | $pre = '

' . \sprintf( \esc_html__( 'This comment was forwarded to %s.', 'comment-hacks' ), \esc_html( $this->options['forward_name'] ) ) . '

'; 116 | $comment_text = $pre . $comment_text; 117 | } 118 | 119 | return $comment_text; 120 | } 121 | 122 | /** 123 | * Forwards a comment to an email address chosen in the settings. 124 | * 125 | * @return void 126 | */ 127 | public function forward_comment(): void { 128 | if ( empty( $this->options['forward_email'] ) ) { 129 | return; 130 | } 131 | 132 | if ( 133 | isset( $_GET['ch_action'] ) 134 | && isset( $_GET['nonce'] ) 135 | && isset( $_GET['comment_id'] ) 136 | && $_GET['ch_action'] === 'forward_comment' 137 | && \wp_verify_nonce( \wp_strip_all_tags( \wp_unslash( $_GET['nonce'] ) ), 'comment-hacks-forward' ) 138 | ) { 139 | $comment_id = (int) $_GET['comment_id']; 140 | $comment = \get_comment( $comment_id ); 141 | 142 | echo '

'; 143 | \printf( 144 | /* translators: %1$s is replaced by (a link to) the blog's name, %2$s by (a link to) the title of the blogpost. */ 145 | \esc_html__( 'Forwarding comment from %1$s to %2$s.', 'comment-hacks' ), 146 | '' . \esc_html( $comment->comment_author ) . '', 147 | \esc_html( $this->options['forward_name'] ) 148 | ); 149 | echo '

'; 150 | 151 | $intro = \sprintf( 152 | /* translators: %1$s is replaced by (a link to) the blog's name, %2$s by (a link to) the title of the post. */ 153 | \esc_html__( 'This comment was forwarded from %1$s where it was left on: %2$s.', 'comment-hacks' ), 154 | '' . \esc_html( \get_bloginfo( 'name' ) ) . '', 155 | '' . \esc_html( \get_the_title( (int) $comment->comment_post_ID ) ) . '' 156 | ) . "\n\n"; 157 | 158 | if ( ! empty( $this->options['forward_extra'] ) ) { 159 | $intro .= $this->options['forward_extra'] . "\n\n"; 160 | } 161 | 162 | $intro .= '---------- Forwarded message --------- 163 | From: ' . \esc_html( $comment->comment_author ) . ' <' . \esc_html( $comment->comment_author_email ) . '> 164 | Date: ' . \gmdate( 'D, M j, Y \a\t h:i A', \strtotime( $comment->comment_date ) ) . ' 165 | Subject: ' . \esc_html__( 'Comment on', 'comment-hacks' ) . ' ' . \esc_html( \get_bloginfo( 'name' ) ) . ' 166 | To: ' . \esc_html( \get_bloginfo( 'name' ) ) . ' <' . \esc_html( $this->options['forward_from_email'] ) . '>'; 167 | $intro .= "\n\n"; 168 | 169 | $content = \nl2br( $intro . $comment->comment_content ); 170 | 171 | $headers = [ 172 | 'From: ' . \get_bloginfo( 'name' ) . ' <' . \esc_html( $this->options['forward_from_email'] ) . '>', 173 | 'Content-Type: text/html; charset=UTF-8', 174 | ]; 175 | \wp_mail( $this->options['forward_email'], $this->options['forward_subject'], $content, $headers ); 176 | 177 | // Don't send an already approved comment to the trash. 178 | if ( ! $comment->comment_approved ) { 179 | \update_comment_meta( $comment_id, 'ch_forwarded', true ); 180 | \wp_set_comment_status( $comment_id, 'trash' ); 181 | } 182 | } 183 | } 184 | 185 | /** 186 | * Adds an action link to forward a comment to your support team. 187 | * 188 | * @param string[] $actions The actions shown underneath comments. 189 | * @param WP_Comment $comment The individual comment object. 190 | * 191 | * @return string[] 192 | */ 193 | public function forward_to_support_action_link( $actions, $comment ): array { 194 | if ( empty( $this->options['forward_email'] ) ) { 195 | return $actions; 196 | } 197 | 198 | // Escaped before returning the actions array. 199 | $label = \__( 'Forward to support', 'comment-hacks' ); 200 | 201 | // '1' === approved, 'trash' === trashed. 202 | if ( $comment->comment_approved !== '1' && $comment->comment_approved !== 'trash' ) { 203 | // Escaped before returning the actions array. 204 | $label = \__( 'Forward to support & trash', 'comment-hacks' ); 205 | } 206 | 207 | $actions['ch_forward'] = '' . \esc_html( $label ) . ''; 208 | 209 | return $actions; 210 | } 211 | 212 | /** 213 | * Register meta box(es). 214 | * 215 | * @return void 216 | */ 217 | public function register_meta_boxes(): void { 218 | \add_meta_box( 219 | 'comment-hacks-reroute', 220 | \__( 'Comment Experience', 'comment-hacks' ), 221 | [ 222 | $this, 223 | 'meta_box_callback', 224 | ], 225 | 'post', 226 | 'side' 227 | ); 228 | } 229 | 230 | /** 231 | * Meta box display callback. 232 | * 233 | * @param WP_Post $post Current post object. 234 | * 235 | * @return void 236 | */ 237 | public function meta_box_callback( $post ): void { 238 | ?> 239 | 244 | 247 |
248 | \get_post_meta( $post->ID, self::NOTIFICATION_RECIPIENT_KEY, true ), 266 | 'show_option_none' => 'Post author', 267 | 'name' => 'comment_notification_recipient', 268 | 'id' => 'comment_notification_recipient', 269 | 'role__in' => $roles, 270 | 'option_none_value' => 0, 271 | ] 272 | ); 273 | } 274 | 275 | /** 276 | * Register the options array along with the validation function. 277 | * 278 | * @return void 279 | */ 280 | public function init(): void { 281 | // Register our option array. 282 | \register_setting( 283 | Hacks::$option_name, 284 | Hacks::$option_name, 285 | [ 286 | $this, 287 | 'options_validate', 288 | ] 289 | ); 290 | } 291 | 292 | /** 293 | * Enqueue our admin script. 294 | * 295 | * @return void 296 | */ 297 | public function enqueue(): void { 298 | $page = \filter_input( \INPUT_GET, 'page' ); 299 | 300 | if ( $page === 'comment-experience' ) { 301 | \wp_enqueue_style( 302 | 'emiliaprojects-comment-hacks-admin-css', 303 | \plugins_url( 'admin/assets/css/comment-hacks.css', \EMILIA_COMMENT_HACKS_FILE ), 304 | [], 305 | \EMILIA_COMMENT_HACKS_VERSION 306 | ); 307 | 308 | \wp_enqueue_script( 309 | 'emiliaprojects-comment-hacks-admin-js', 310 | \plugins_url( 'admin/assets/js/comment-hacks.js', \EMILIA_COMMENT_HACKS_FILE ), 311 | [], 312 | \EMILIA_COMMENT_HACKS_VERSION, 313 | true 314 | ); 315 | } 316 | } 317 | 318 | /** 319 | * Saves the comment email recipients post meta. 320 | * 321 | * @param int $post_id The post ID. 322 | * 323 | * @return void 324 | */ 325 | public function save_reroute_comment_emails( $post_id ): void { 326 | 327 | if ( ! isset( $_POST['comment_notification_recipient'] ) || ! \wp_verify_nonce( \filter_input( \INPUT_POST, 'comment_notification_recipient_nonce' ), 'comment_notification_recipient_nonce' ) ) { 328 | return; 329 | } 330 | 331 | $recipient_id = (int) \sanitize_key( \wp_unslash( $_POST['comment_notification_recipient'] ) ); 332 | if ( $recipient_id > 0 ) { 333 | \update_post_meta( $post_id, self::NOTIFICATION_RECIPIENT_KEY, $recipient_id ); 334 | } 335 | } 336 | 337 | /** 338 | * Validate the input, make sure comment length is an integer and above the minimum value. 339 | * 340 | * @since 1.0 341 | * 342 | * @param string[] $input Input with unvalidated options. 343 | * 344 | * @return string[] 345 | */ 346 | public function options_validate( array $input ): array { 347 | $defaults = Hacks::get_defaults(); 348 | 349 | foreach ( $input as $key => $value ) { 350 | switch ( $key ) { 351 | case 'mincomlength': 352 | case 'maxcomlength': 353 | case 'redirect_page': 354 | case 'comment_policy_page': 355 | $input[ $key ] = (int) $value; 356 | break; 357 | case 'version': 358 | $input[ $key ] = \EMILIA_COMMENT_HACKS_VERSION; 359 | break; 360 | case 'comment_policy': 361 | case 'clean_emails': 362 | case 'disable_email_all_commenters': 363 | $input[ $key ] = $this->sanitize_bool( $value ); 364 | break; 365 | case 'email_subject': 366 | case 'email_body': 367 | case 'mass_email_body': 368 | case 'forward_name': 369 | case 'forward_subject': 370 | $input[ $key ] = $this->sanitize_string( $value, $defaults[ $key ] ); 371 | break; 372 | case 'forward_email': 373 | case 'forward_from_email': 374 | $input[ $key ] = \sanitize_email( $value ); 375 | } 376 | } 377 | 378 | if ( ( $this->absolute_min + 1 ) > $input['mincomlength'] || empty( $input['mincomlength'] ) ) { 379 | \add_settings_error( 380 | $this->hook, 381 | 'min_length_invalid', 382 | \sprintf( 383 | /* translators: %d is replaced with the minimum number of characters */ 384 | \__( 'The minimum length you entered is invalid, please enter a minimum length above %d.', 'comment-hacks' ), 385 | $this->absolute_min 386 | ) 387 | ); 388 | $input['mincomlength'] = 15; 389 | } 390 | 391 | return $input; 392 | } 393 | 394 | /** 395 | * Turns checkbox values into booleans. 396 | * 397 | * @param string|bool $value The input value to cast to boolean. 398 | * 399 | * @return bool 400 | */ 401 | private function sanitize_bool( $value ): bool { 402 | return ( $value || ! empty( $value ) ); 403 | } 404 | 405 | /** 406 | * Turns empty string into defaults. 407 | * 408 | * @param string $value The input value. 409 | * @param string $default_value The default value of the string. 410 | * 411 | * @return string 412 | */ 413 | private function sanitize_string( $value, $default_value ) { 414 | return ( $value === '' ) ? $default_value : $value; 415 | } 416 | 417 | /** 418 | * Register the config page for all users that have the manage_options capability. 419 | * 420 | * @return void 421 | */ 422 | public function add_config_page() { 423 | \add_options_page( 424 | \__( 'Comment Experience', 'comment-hacks' ), 425 | \__( 'Comment Experience', 'comment-hacks' ), 426 | 'manage_options', 427 | $this->hook, 428 | [ 429 | $this, 430 | 'config_page', 431 | ] 432 | ); 433 | } 434 | 435 | /** 436 | * Register the settings link for the plugins page. 437 | * 438 | * @param string[] $links The plugin action links. 439 | * @param string $file The plugin file. 440 | * 441 | * @return string[] 442 | */ 443 | public function filter_plugin_actions( $links, $file ): array { 444 | /* Static so we don't call plugin_basename on every plugin row. */ 445 | static $this_plugin; 446 | if ( ! $this_plugin ) { 447 | $this_plugin = \plugin_basename( \EMILIA_COMMENT_HACKS_FILE ); 448 | } 449 | 450 | if ( $file === $this_plugin ) { 451 | $settings_link = '' . \__( 'Settings', 'comment-hacks' ) . ''; 452 | // Put our link before other links. 453 | \array_unshift( $links, $settings_link ); 454 | } 455 | 456 | return $links; 457 | } 458 | 459 | /** 460 | * Output the config page. 461 | * 462 | * @return void 463 | */ 464 | public function config_page(): void { 465 | require_once \EMILIA_COMMENT_HACKS_PATH . 'admin/views/config-page.php'; 466 | 467 | // Show the content of the options array when debug is enabled. 468 | if ( \defined( 'WP_DEBUG' ) && \WP_DEBUG ) { 469 | ?> 470 |

471 |
472 | ', 476 | '', 477 | // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export -- This is only shown in debug mode. 478 | \highlight_string( "options = " . \var_export( $this->options, true ) . ';', true ), 479 | $num 480 | ); 481 | ?> 482 |
483 | comment_parent = $comment_parent; 83 | 84 | // Remove our filter, or we'll keep looping. 85 | \remove_action( 'edit_comment', [ $this, 'update_comment_parent' ] ); 86 | \wp_update_comment( (array) $comment ); 87 | 88 | // Add our filter back. 89 | \add_action( 'edit_comment', [ $this, 'update_comment_parent' ] ); 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /admin/views/comment-parent-box.php: -------------------------------------------------------------------------------- 1 | 12 |
13 | 14 | 15 | 18 | 21 | 22 |
16 | 17 | 19 | 20 |
23 |
24 | -------------------------------------------------------------------------------- /admin/views/config-page.php: -------------------------------------------------------------------------------- 1 | 12 |
13 |

14 | 15 | 38 | 39 |
40 | 41 | 42 |
43 |

44 | 45 |

46 | 47 | 48 | 53 | 64 | 65 | 66 | 71 | 79 | 80 |
49 | 52 | 54 | 63 |
67 | 70 | 72 | 78 |
81 | 82 |

83 | 84 |

85 | 86 | 87 | 92 | 102 | 103 | 104 | 109 | 117 | 118 |
88 | 91 | 93 | 101 |
105 | 108 | 110 | 116 |
119 |
120 | 121 |
122 |

123 |

124 | 125 | 126 | 131 | 144 | 145 | 146 | 151 | 166 | 167 | 168 | 173 | 183 | 184 | 185 | 190 | 198 | 199 |
127 | 130 | 132 | options['comment_policy'] ); ?> 135 | name="" 136 | id="comment_policy" 137 | /> 138 |

139 | 142 |

143 |
147 | 150 | 152 | 0, 156 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $selected is not put out, only compared against. 157 | 'selected' => ( isset( $this->options['comment_policy_page'] ) ? (int) $this->options['comment_policy_page'] : 0 ), 158 | 'name' => esc_attr( Hacks::$option_name . '[comment_policy_page]' ), 159 | 'id' => 'comment_policy_page', 160 | 'show_option_none' => esc_html__( 'Select comment policy page', 'comment-hacks' ), 161 | 'option_none_value' => '0', 162 | ] 163 | ); 164 | ?> 165 |
169 | 172 | 174 | 181 |

182 |
186 | 189 | 191 | 197 |
200 |
201 | 202 | 262 | 263 |
264 |

265 | 266 |

267 | 268 | 269 | 274 | 298 | 299 |
270 | 273 | 275 | 0, 280 | 'id' => 'redirect_page', 281 | // phpcs:ignore WordPress.Security.EscapeOutput -- This is a hard-coded string, just passed around as a variable. 282 | 'name' => Hacks::$option_name . '[redirect_page]', 283 | 'option_none_value' => '0', 284 | 'selected' => ( isset( $this->options['redirect_page'] ) ? (int) $this->options['redirect_page'] : 0 ), 285 | 'show_option_none' => esc_html__( 'Don\'t redirect first time commenters', 'comment-hacks' ), 286 | ] 287 | ); 288 | ?> 289 | 290 | options['redirect_page'] ) && (int) $this->options['redirect_page'] !== 0 ) : ?> 291 |
292 |
293 | 294 | 295 | 296 | 297 |
300 | 301 |

302 | 303 |

304 |

305 | 306 | 307 | 312 | 336 | 337 |
308 | 311 | 313 | 0, 318 | 'id' => 'redirect_repeat_page', 319 | // phpcs:ignore WordPress.Security.EscapeOutput -- This is a hard-coded string, just passed around as a variable. 320 | 'name' => Hacks::$option_name . '[redirect_repeat_page]', 321 | 'option_none_value' => '0', 322 | 'selected' => ( isset( $this->options['redirect_repeat_page'] ) ? (int) $this->options['redirect_repeat_page'] : 0 ), 323 | 'show_option_none' => esc_html__( 'Don\'t redirect repeat commenters', 'comment-hacks' ), 324 | ] 325 | ); 326 | ?> 327 | 328 | options['redirect_repeat_page'] ) && $this->options['redirect_repeat_page'] !== 0 ) : ?> 329 |
330 |
331 | 332 | 333 | 334 | 335 |
338 |
339 |
340 |

341 | 342 |

343 | 344 | 345 | 350 | 358 | 359 |
346 | 349 | 351 | options['clean_emails'] ); ?> 356 | /> 357 |
360 |
361 | 362 |
363 |

364 | 365 |

366 | 367 | 368 | 373 | 382 | 383 | 384 | 389 | 398 | 399 | 400 | 405 | 414 | 415 | 416 | 421 | 430 | 431 | 432 | 437 | 445 | 446 |
369 | 372 | 374 | 381 |
385 | 388 | 390 | 397 |
401 | 404 | 406 | 413 |
417 | 420 | 422 | 429 |
433 | 436 | 438 | 444 |
447 |
448 | 449 |
450 |

451 | 452 |

453 | 454 | 455 | 460 | 468 | 469 |
456 | 459 | 461 | options['disable_email_all_commenters'] ); ?> 466 | /> 467 |
470 |
471 | 472 |
473 |
474 | 475 | 'admin/admin.php', 17 | 'EmiliaProjects\WP\Comment\Admin\Comment_Parent' => 'admin/comment-parent.php', 18 | 'EmiliaProjects\WP\Comment\Inc\Clean_Emails' => 'inc/clean-emails.php', 19 | 'EmiliaProjects\WP\Comment\Inc\Email_Links' => 'inc/email-links.php', 20 | 'EmiliaProjects\WP\Comment\Inc\Forms' => 'inc/forms.php', 21 | 'EmiliaProjects\WP\Comment\Inc\Hacks' => 'inc/hacks.php', 22 | 'EmiliaProjects\WP\Comment\Inc\Length' => 'inc/length.php', 23 | 'EmiliaProjects\WP\Comment\Inc\Notifications' => 'inc/notifications.php', 24 | 'EmiliaProjects\WP\Comment\Inc\Progress_Planner_Tasks' => 'inc/progress-planner-tasks.php', 25 | 'EmiliaProjects\WP\Comment\Inc\Progress_Planner\Comment_Policy' => 'inc/progress-planner/comment-policy.php', 26 | 'EmiliaProjects\WP\Comment\Inc\Progress_Planner\Comment_Redirect' => 'inc/progress-planner/comment-redirect.php', 27 | 'EmiliaProjects\WP\Comment\Inc\Progress_Planner\Comment_Moderation' => 'inc/progress-planner/comment-moderation.php', 28 | ]; 29 | 30 | /** 31 | * Constructor. 32 | * 33 | * Register the autoloader. 34 | */ 35 | public function __construct() { 36 | \spl_autoload_register( [ self::class, 'autoload' ] ); 37 | } 38 | 39 | /** 40 | * Autoload the classes. 41 | * 42 | * @param string $class_name The class name. 43 | * 44 | * @return void 45 | */ 46 | public static function autoload( string $class_name ): void { 47 | if ( ! isset( self::$classmap[ $class_name ] ) ) { 48 | return; 49 | } 50 | require_once \EMILIA_COMMENT_HACKS_PATH . self::$classmap[ $class_name ]; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /inc/clean-emails.php: -------------------------------------------------------------------------------- 1 | setup_data( $comment_id ); 83 | 84 | $comment_url = \get_permalink( (int) $this->comment->comment_post_ID ) . '#comment-' . $comment_id; 85 | $comment_link = '' . \esc_html( $this->post->post_title ) . ''; 86 | 87 | switch ( $this->comment->comment_type ) { 88 | case 'pingback': 89 | /* translators: %s is replaced with the post title */ 90 | $this->message = \sprintf( \esc_html__( 'New pingback on "%s"', 'comment-hacks' ), $comment_link ) . '

'; 91 | break; 92 | case 'trackback': 93 | /* translators: %s is replaced with the post title */ 94 | $this->message = \sprintf( \esc_html__( 'New trackback on "%s"', 'comment-hacks' ), $comment_link ) . '

'; 95 | break; 96 | default: 97 | /* translators: %s is replaced with the post title */ 98 | $this->message = \sprintf( \esc_html__( 'New comment on "%s"', 'comment-hacks' ), $comment_link ) . '

'; 99 | break; 100 | } 101 | $this->add_comment_basics(); 102 | 103 | if ( \user_can( (int) $this->post->post_author, 'edit_comment', $comment_id ) ) { 104 | $this->comment_notification_actions(); 105 | } 106 | 107 | return $this->wrap_message(); 108 | } 109 | 110 | /** 111 | * Clean up the comment moderation message. 112 | * 113 | * @param string $message The comment moderation message. 114 | * @param int $comment_id The ID of the comment the moderation notification is for. 115 | * 116 | * @return string 117 | */ 118 | public function comment_moderation_text( $message, $comment_id ): string { 119 | $this->setup_data( $comment_id ); 120 | 121 | $comment_link = '' . \esc_html( $this->post->post_title ) . ''; 122 | 123 | switch ( $this->comment->comment_type ) { 124 | case 'pingback': 125 | $this->message = \sprintf( 126 | /* translators: %1$s is replaced with the post title */ 127 | \esc_html__( 'A new pingback on the post "%1$s" is waiting for your approval:', 'comment-hacks' ), 128 | $comment_link 129 | ) . '

'; 130 | break; 131 | case 'trackback': 132 | $this->message = \sprintf( 133 | /* translators: %1$s is replaced with the post title */ 134 | \esc_html__( 'A new trackback on the post "%1$s" is waiting for your approval:', 'comment-hacks' ), 135 | $comment_link 136 | ) . '

'; 137 | break; 138 | default: 139 | $this->message = \sprintf( 140 | /* translators: %1$s is replaced with the post title */ 141 | \esc_html__( 'A new comment on the post "%1$s" is waiting for your approval:', 'comment-hacks' ), 142 | $comment_link 143 | ) . '

'; 144 | break; 145 | } 146 | $this->add_comment_basics(); 147 | 148 | $this->comment_moderation_actions(); 149 | $this->message .= ' | ' . \sprintf( 150 | '%2$s', 151 | $this->comment->comment_author_IP, 152 | \esc_html__( 'Whois', 'comment-hacks' ) 153 | ); 154 | $this->message .= '

'; 155 | 156 | $this->get_moderation_msg(); 157 | 158 | return $this->wrap_message(); 159 | } 160 | 161 | /** 162 | * Adds the basics of the email. 163 | * 164 | * @return void 165 | */ 166 | private function add_comment_basics(): void { 167 | $this->add_author_line(); 168 | $this->add_url_line(); 169 | $this->message .= '
'; 170 | $this->add_content_line(); 171 | } 172 | 173 | /** 174 | * Adds the author line to the message. 175 | * 176 | * @return void 177 | */ 178 | private function add_author_line(): void { 179 | if ( $this->comment->comment_type === 'comment' ) { 180 | /* translators: %1$s is replaced with the comment author's name, %2$s is replaced with the comment author's email */ 181 | $this->message .= \sprintf( \esc_html__( 'Author: %1$s (%2$s)', 'comment-hacks' ), \esc_html( $this->comment->comment_author ), '' . \esc_html( $this->comment->comment_author_email ) . '' ) . '
'; 182 | } 183 | else { 184 | /* translators: %1$s is replaced with the website doing the ping or trackback */ 185 | $this->message .= \sprintf( \esc_html__( 'Website: %1$s', 'comment-hacks' ), \esc_html( $this->comment->comment_author ) ) . '
'; 186 | } 187 | } 188 | 189 | /** 190 | * Adds the content line to the message. 191 | * 192 | * @return void 193 | */ 194 | private function add_content_line(): void { 195 | if ( $this->comment->comment_type === 'comment' ) { 196 | $this->message .= \esc_html__( 'Comment:', 'comment-hacks' ); 197 | } 198 | else { 199 | $this->message .= \esc_html__( 'Excerpt:', 'comment-hacks' ); 200 | } 201 | 202 | $this->message .= '
' . \wpautop( $this->comment->comment_content ) . '
'; 203 | } 204 | 205 | /** 206 | * Adds the URL line to the message. 207 | * 208 | * @return void 209 | */ 210 | private function add_url_line(): void { 211 | if ( isset( $this->comment->comment_author_url ) && $this->comment->comment_author_url !== '' ) { 212 | /* translators: %s is replaced with the URL */ 213 | $this->message .= \sprintf( \esc_html__( 'URL: %s', 'comment-hacks' ), '' . \esc_html( $this->comment->comment_author_url ) . '' ) . '
'; 214 | } 215 | } 216 | 217 | /** 218 | * Wraps the message in some styling. 219 | * 220 | * @return string 221 | */ 222 | private function wrap_message(): string { 223 | return '
' . $this->message . '
'; 224 | } 225 | 226 | /** 227 | * Sets up class variables used with all emails. 228 | * 229 | * @param int $comment_id The comment we're setting up variables for. 230 | * 231 | * @return void 232 | */ 233 | private function setup_data( int $comment_id ): void { 234 | $this->comment_id = $comment_id; 235 | $this->comment = \get_comment( $this->comment_id ); 236 | $this->post = \get_post( (int) $this->comment->comment_post_ID ); 237 | } 238 | 239 | /** 240 | * Adds a sentence about the number of comments awaiting moderation. 241 | * 242 | * @return void 243 | */ 244 | private function get_moderation_msg(): void { 245 | $comments_waiting = \get_comment_count()['awaiting_moderation']; 246 | 247 | if ( $comments_waiting > 1 ) { 248 | --$comments_waiting; 249 | $this->message .= \sprintf( 250 | /* translators: %s is replaced with the number of comments waiting for approval */ 251 | \esc_html__( 'Currently this and %s other comments are waiting for approval.', 'comment-hacks' ), 252 | \number_format_i18n( $comments_waiting ) 253 | ); 254 | $this->message .= ' '; 255 | $this->message .= \sprintf( 256 | /* translators: %s is replaced with the HTML for a link to the moderation panel, with text "moderation panel". */ 257 | \esc_html__( 'Please visit the %s.', 'comment-hacks' ), 258 | '' . \esc_html__( 'moderation panel', 'comment-hacks' ) . '' 259 | ) . '
'; 260 | } 261 | } 262 | 263 | /** 264 | * Returns a string containing comment moderation links. 265 | * 266 | * @return void 267 | */ 268 | private function comment_moderation_actions(): void { 269 | $actions = [ 270 | 'approve' => \esc_html__( 'Approve', 'comment-hacks' ), 271 | 'spam' => \esc_html__( 'Spam', 'comment-hacks' ), 272 | 'trash' => \esc_html__( 'Trash', 'comment-hacks' ), 273 | 'editcomment' => \esc_html__( 'Edit', 'comment-hacks' ), 274 | ]; 275 | 276 | $this->comment_action_links( $actions ); 277 | } 278 | 279 | /** 280 | * Returns a string containing comment action links. 281 | * 282 | * @return void 283 | */ 284 | private function comment_notification_actions(): void { 285 | $actions = [ 286 | 'spam' => \esc_html__( 'Spam', 'comment-hacks' ), 287 | 'trash' => \esc_html__( 'Trash', 'comment-hacks' ), 288 | 'editcomment' => \esc_html__( 'Edit', 'comment-hacks' ), 289 | ]; 290 | 291 | $this->comment_action_links( $actions ); 292 | } 293 | 294 | /** 295 | * Add action links to the message 296 | * 297 | * @param string[] $actions The array of actions we're adding our action for. 298 | * 299 | * @return void 300 | */ 301 | private function comment_action_links( array $actions ): void { 302 | $links = ''; 303 | foreach ( $actions as $action => $label ) { 304 | $links .= $this->comment_action_link( $label, $action ) . ' | '; 305 | } 306 | 307 | $links = \rtrim( $links, '| ' ); 308 | 309 | $this->message .= $links; 310 | } 311 | 312 | /** 313 | * Creates a comment action link. 314 | * 315 | * @param string $label The label for the comment action link. 316 | * @param string $action The action we're going to add. 317 | * 318 | * @return string 319 | */ 320 | private function comment_action_link( string $label, string $action ): string { 321 | $url = \admin_url( \sprintf( 'comment.php?action=%s&c=%d', $action, $this->comment_id ) ); 322 | 323 | return '' . \esc_html( $label ) . ''; 324 | } 325 | } 326 | -------------------------------------------------------------------------------- /inc/email-links.php: -------------------------------------------------------------------------------- 1 | options = Hacks::get_options(); 22 | 23 | \add_action( 'init', [ $this, 'init' ] ); 24 | } 25 | 26 | /** 27 | * Init our hooks. 28 | * 29 | * @return void 30 | */ 31 | public function init(): void { 32 | if ( \is_admin() ) { 33 | // Adds the email link to the actions on the comment overview page. 34 | \add_filter( 'comment_row_actions', [ $this, 'add_mailto_action_row' ] ); 35 | 36 | return; 37 | } 38 | \add_action( 'admin_bar_menu', [ $this, 'admin_bar_comment_link' ], 65 ); 39 | \add_action( 'wp_head', [ $this, 'wp_head_css' ] ); 40 | } 41 | 42 | /** 43 | * Adds an email link to the admin bar to email all commenters. 44 | * 45 | * @return void 46 | */ 47 | public function admin_bar_comment_link(): void { 48 | if ( ! \is_singular() || $this->options['disable_email_all_commenters'] ) { 49 | return; 50 | } 51 | 52 | global $wp_admin_bar, $post; 53 | 54 | $current_user = \wp_get_current_user(); 55 | 56 | $comments = \get_comments( 57 | [ 58 | 'post_id' => $post->ID, 59 | 'type' => 'comment', 60 | 'status' => 'approve', 61 | ] 62 | ); 63 | if ( \count( $comments ) === 0 ) { 64 | return; 65 | } 66 | $emails = []; 67 | foreach ( $comments as $comment ) { 68 | $emails[] = $comment->comment_author_email; 69 | } 70 | $emails = \array_unique( $emails ); 71 | 72 | $url = 'mailto:' . $current_user->user_email . '?bcc='; 73 | foreach ( $emails as $email ) { 74 | if ( $email !== $current_user->user_email ) { 75 | $url .= \rawurlencode( $email . ',' ); 76 | } 77 | } 78 | $url .= '&subject=' . $this->replace_variables( $this->options['email_subject'], false, $post->ID ); 79 | $url .= '&body=' . $this->replace_variables( $this->options['mass_email_body'], false, $post->ID ); 80 | 81 | // We can't set the 'href' attribute to the $url as then esc_url would garble the mailto link. 82 | // So we do a nasty bit of JS workaround. The reason we grab the href from the alternate link is 83 | // so browser extensions like the Google Mail one that change mailto: links still work. 84 | echo ''; 94 | 95 | $wp_admin_bar->add_menu( 96 | [ 97 | 'id' => 'epch-email-commenters', 98 | 'title' => '', 99 | 'href' => '#', 100 | 'meta' => [ 'onclick' => 'epch_email_commenters(event)' ], 101 | ] 102 | ); 103 | } 104 | 105 | /** 106 | * Adds styling to our email button. 107 | * 108 | * @return void 109 | */ 110 | public function wp_head_css(): void { 111 | if ( ! \is_admin_bar_showing() ) { 112 | return; 113 | } 114 | 115 | echo ' 116 | '; 127 | } 128 | 129 | /** 130 | * Adds an "E-Mail" action to the comment action list on the comments overview page. 131 | * 132 | * @param string[] $actions Array of actions we'll be adding our action to. 133 | * 134 | * @return string[] 135 | */ 136 | public function add_mailto_action_row( $actions ): array { 137 | /** 138 | * The comment. 139 | * 140 | * @var $comment \WP_Comment 141 | */ 142 | global $comment; 143 | 144 | if ( $comment->comment_type !== 'comment' ) { 145 | return $actions; 146 | } 147 | 148 | $subject = $this->replace_variables( $this->options['email_subject'], $comment ); 149 | $body = $this->replace_variables( $this->options['email_body'], $comment ); 150 | $link = 'mailto:' . $comment->comment_author_email . '?subject=' . $subject . '&body=' . $body; 151 | 152 | $left_actions = \array_slice( $actions, 0, 5 ); 153 | $right_actions = \array_slice( $actions, 5 ); 154 | 155 | $new_action = [ 156 | /* translators: %s is replaced with the comment authors name */ 157 | 'mailto' => ' ' . \esc_html( \sprintf( \__( 'E-mail %s', 'comment-hacks' ), $comment->comment_author ) ) . '', 158 | ]; 159 | 160 | return \array_merge( $left_actions, $new_action, $right_actions ); 161 | } 162 | 163 | /** 164 | * Replace variables with values in the message. 165 | * 166 | * @param string $msg The message in which we're replacing variables. 167 | * @param bool|object $comment The comment object. 168 | * @param int|bool $post The post the comment belongs to. 169 | * 170 | * @return string 171 | */ 172 | private function replace_variables( $msg, $comment = false, $post = false ): string { 173 | $replacements = $this->get_replacements( $comment ); 174 | 175 | if ( \is_numeric( $post ) ) { 176 | $post = \get_post( $post ); 177 | } 178 | elseif ( \is_object( $comment ) && $comment->comment_post_ID > 0 ) { 179 | $post = \get_post( $comment->comment_post_ID ); 180 | } 181 | 182 | if ( ! \is_object( $post ) ) { 183 | return $msg; 184 | } 185 | 186 | $replacements = \array_merge( 187 | $replacements, 188 | [ 189 | 'title' => $post->post_title, 190 | 'permalink' => \get_permalink( $post->ID ), 191 | ] 192 | ); 193 | 194 | foreach ( $replacements as $key => $value ) { 195 | $msg = \str_replace( '%' . $key . '%', $value, $msg ); 196 | } 197 | 198 | return \rawurlencode( $msg ); 199 | } 200 | 201 | /** 202 | * Getting the replacements with comment data if there is a comment. 203 | * 204 | * @param bool|object $comment The comment object. 205 | * 206 | * @return string[] 207 | */ 208 | private function get_replacements( $comment ): array { 209 | $replacements = [ 210 | 'email' => '', 211 | 'firstname' => '', 212 | 'name' => '', 213 | 'url' => '', 214 | ]; 215 | 216 | if ( \is_object( $comment ) ) { 217 | $name = \explode( ' ', $comment->comment_author ); 218 | 219 | $replacements = [ 220 | 'email' => $comment->comment_author_email, 221 | 'firstname' => $name[0], 222 | 'name' => $comment->comment_author, 223 | 'url' => $comment->comment_author_url, 224 | ]; 225 | } 226 | 227 | return $replacements; 228 | } 229 | } 230 | -------------------------------------------------------------------------------- /inc/forms.php: -------------------------------------------------------------------------------- 1 | options = Hacks::get_options(); 33 | Hacks::get_defaults(); 34 | 35 | if ( $this->options['comment_policy'] ) { 36 | \add_action( 'comment_form_after_fields', [ $this, 'comment_form_fields' ] ); 37 | \add_filter( 'preprocess_comment', [ $this, 'check_comment_policy' ] ); 38 | } 39 | } 40 | 41 | /** 42 | * Adds the comment policy checkbox to the comment form. 43 | * 44 | * @return void 45 | */ 46 | public function comment_form_fields() { 47 | ?> 48 | 54 | options['comment_policy_error'] ) . '

' . \esc_html__( 'Go back and try again.', 'comment-hacks' ) . '' ); 69 | } 70 | } 71 | 72 | return $comment_data; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /inc/hacks.php: -------------------------------------------------------------------------------- 1 | options = self::get_options(); 66 | if ( ! isset( $this->options['version'] ) || \EMILIA_COMMENT_HACKS_VERSION > $this->options['version'] ) { 67 | $this->set_defaults(); 68 | $this->upgrade(); 69 | } 70 | 71 | if ( $this->options['clean_emails'] ) { 72 | new Clean_Emails(); 73 | } 74 | } 75 | 76 | /** 77 | * AJAX handler to remove the URL from a comment. 78 | * 79 | * @return void 80 | */ 81 | public function remove_comment_url() { 82 | \check_ajax_referer( 'ch_remove_comment_url_nonce', 'nonce' ); 83 | 84 | if ( ! isset( $_POST['commentId'] ) ) { 85 | \wp_send_json_error( \esc_html__( 'Comment ID not set.', 'comment-hacks' ) ); 86 | } 87 | 88 | $comment_id = \intval( $_POST['commentId'] ); 89 | 90 | if ( ! \current_user_can( 'edit_comment', $comment_id ) ) { 91 | \wp_send_json_error( \esc_html__( 'You do not have permission to edit this comment.', 'comment-hacks' ) ); 92 | } 93 | 94 | $comment = \get_comment( $comment_id ); 95 | 96 | if ( ! $comment ) { 97 | \wp_send_json_error( \esc_html__( 'Comment not found.', 'comment-hacks' ) ); 98 | } 99 | 100 | // Remove the URL. 101 | $comment->comment_author_url = ''; 102 | 103 | // Update the comment. 104 | \wp_update_comment( 105 | [ 106 | 'comment_ID' => $comment_id, 107 | 'comment_author_url' => $comment->comment_author_url, 108 | ] 109 | ); 110 | 111 | \wp_send_json_success( \esc_html__( 'URL removed successfully.', 'comment-hacks' ) ); 112 | } 113 | 114 | /** 115 | * Enqueue the necessary scripts. 116 | * 117 | * @return void 118 | */ 119 | public function enqueue_comment_block_scripts() { 120 | if ( \current_user_can( 'edit_posts' ) ) { 121 | \wp_enqueue_script( 'ch-comment-block-edit', \plugin_dir_url( \EMILIA_COMMENT_HACKS_FILE ) . 'admin/assets/js/remove-url.js', [ 'jquery' ], '1.0.0', true ); 122 | \wp_localize_script( 123 | 'ch-comment-block-edit', 124 | 'chCommentBlockEdit', 125 | [ 126 | 'ajax_url' => \admin_url( 'admin-ajax.php' ), 127 | 'nonce' => \wp_create_nonce( 'ch_remove_comment_url_nonce' ), 128 | ] 129 | ); 130 | } 131 | } 132 | 133 | /** 134 | * Modifies the output of the comment-edit-link block. 135 | * 136 | * @param string $block_content The block content. 137 | * @param string[] $block The block data array. 138 | * 139 | * @return string Modified block content with the "Remove URL" option. 140 | */ 141 | public function modify_comment_edit_link_block( $block_content, $block ) { 142 | if ( ! empty( $block_content ) && isset( $block['blockName'] ) && $block['blockName'] === 'core/comment-edit-link' ) { 143 | \preg_match( '/c=(\d+)/', $block_content, $matches ); 144 | 145 | $remove_url_link = $this->get_remove_comment_url_link( (int) $matches[1] ); 146 | 147 | if ( ! empty( $remove_url_link ) ) { 148 | $block_content = \str_replace( '', '   ·   ' . $remove_url_link . '', $block_content ); 149 | } 150 | } 151 | 152 | return $block_content; 153 | } 154 | 155 | /** 156 | * Returns the "Remove URL" link for a comment. 157 | * 158 | * @param int $comment_id The ID of the comment. 159 | * 160 | * @return string The HTML for the "Remove URL" link. 161 | */ 162 | public function get_remove_comment_url_link( $comment_id ) { 163 | $comment = \get_comment( $comment_id ); 164 | 165 | if ( isset( $comment ) && $comment instanceof WP_Comment && ! empty( $comment->comment_author_url ) ) { 166 | return \sprintf( 167 | '%s', 168 | \esc_attr( (string) $comment_id ), 169 | \esc_attr__( 'Remove URL from this comment', 'comment-hacks' ), 170 | '' . \esc_html__( 'Remove URL', 'comment-hacks' ) . ' ' . \htmlentities( $comment->comment_author_url ) . '' 171 | ); 172 | } 173 | 174 | return ''; 175 | } 176 | 177 | /** 178 | * Adds a link to remove the author's URL from the comment. 179 | * 180 | * @param string $link The original edit comment link. 181 | * @param int $comment_id The ID of the comment. 182 | * 183 | * @return string The modified link HTML. 184 | */ 185 | public function edit_comment_link( $link, $comment_id ) { 186 | return $link . '   ·   ' . $this->get_remove_comment_url_link( $comment_id ); 187 | } 188 | 189 | /** 190 | * Returns the comment hacks options. 191 | * 192 | * @return string[] 193 | */ 194 | public static function get_options(): array { 195 | $options = \get_option( self::$option_name ); 196 | return \is_array( $options ) ? $options : []; 197 | } 198 | 199 | /** 200 | * Use the same default WordPress core uses for a "from" email address. 201 | * 202 | * @return string 203 | */ 204 | private static function get_from_email_default(): string { 205 | // Code below taken from WP core's pluggable.php file. 206 | // Get the site domain and get rid of www. 207 | $sitename = \wp_parse_url( \network_home_url(), \PHP_URL_HOST ); 208 | if ( $sitename === null ) { 209 | return ''; 210 | } 211 | 212 | if ( \substr( $sitename, 0, 4 ) === 'www.' ) { 213 | $sitename = \substr( $sitename, 4 ); 214 | } 215 | 216 | return 'wordpress@' . $sitename; 217 | } 218 | 219 | /** 220 | * Check whether the current commenter is a first time commenter, if so, redirect them to the specified settings. 221 | * 222 | * @param string $url The original redirect URL. 223 | * @param WP_Comment $comment The comment object. 224 | * 225 | * @return string The URL to be redirected to, altered if this was a first time comment. 226 | */ 227 | public function comment_redirect( string $url, WP_Comment $comment ): string { 228 | $has_approved_comment = \get_comments( 229 | [ 230 | 'author_email' => $comment->comment_author_email, 231 | 'number' => 1, 232 | 'status' => 'approve', 233 | ] 234 | ); 235 | 236 | // If no approved comments have been found, show the thank-you page. 237 | if ( empty( $has_approved_comment ) ) { 238 | // Only change $url when the page option is actually set and not zero. 239 | if ( isset( $this->options['redirect_page'] ) && (int) $this->options['redirect_page'] !== 0 ) { 240 | $url = \get_permalink( (int) $this->options['redirect_page'] ); 241 | 242 | /** 243 | * Allow other plugins to hook in when the user is being redirected, 244 | * for analytics calls or even to change the target URL. 245 | * 246 | * @param string $url URL to which the first-time commenter will be redirected. 247 | * @param object $comment The comment object. 248 | * @param string $type The type of redirect. 249 | * 250 | * @since 1.6.0 251 | */ 252 | $url = \apply_filters( 'EmiliaProjects\WP\Comment\redirect', $url, $comment, 'first' ); 253 | } 254 | } 255 | 256 | // Only change $url when the page option is actually set and not zero. 257 | if ( isset( $this->options['redirect_repeat_page'] ) && (int) $this->options['redirect_repeat_page'] !== 0 ) { 258 | $url = \get_permalink( (int) $this->options['redirect_repeat_page'] ); 259 | 260 | /** 261 | * Allow other plugins to hook in when the user is being redirected, 262 | * for analytics calls or even to change the target URL. 263 | * 264 | * @param string $url URL to which a repeat commenter will be redirected. 265 | * @param object $comment The comment object. 266 | * @param string $type The type of redirect. 267 | * 268 | * @since 2.2.0 269 | */ 270 | $url = \apply_filters( 'EmiliaProjects\WP\Comment\redirect', $url, $comment, 'repeat' ); 271 | } 272 | 273 | return $url; 274 | } 275 | 276 | /** 277 | * See if the option has been cached, if it is, return it, otherwise return false. 278 | * 279 | * @param string $option The option to check for. 280 | * 281 | * @return bool|string 282 | * 283 | * @since 1.3 284 | */ 285 | private function get_option_from_cache( string $option ) { 286 | $options = \wp_load_alloptions(); 287 | return isset( $options[ $option ] ) ? $option : false; 288 | } 289 | 290 | /** 291 | * Check whether any old options are in there and if so upgrade them. 292 | * 293 | * @since 1.0 294 | * 295 | * @return void 296 | */ 297 | private function upgrade(): void { 298 | $options_changed = false; 299 | 300 | foreach ( [ 'MinComLengthOptions', 'min_comment_length_option', 'CommentRedirect' ] as $old_option ) { 301 | $old_option_values = $this->get_option_from_cache( $old_option ); 302 | if ( \is_array( $old_option_values ) ) { 303 | if ( isset( $old_option_values['page'] ) ) { 304 | $old_option_values['redirect_page'] = $old_option_values['page']; 305 | unset( $old_option_values['page'] ); 306 | } 307 | $this->options = \wp_parse_args( $this->options, $old_option_values ); 308 | \delete_option( $old_option ); 309 | $options_changed = true; 310 | } 311 | } 312 | 313 | if ( ! isset( $this->options['version'] ) ) { 314 | $this->options['clean_emails'] = true; 315 | $options_changed = true; 316 | } 317 | 318 | if ( ! isset( $this->options['version'] ) || \EMILIA_COMMENT_HACKS_VERSION > $this->options['version'] ) { 319 | $this->options['version'] = \EMILIA_COMMENT_HACKS_VERSION; 320 | $options_changed = true; 321 | } 322 | 323 | if ( ! isset( $this->options['disable_email_all_commenters'] ) ) { 324 | $this->options['disable_email_all_commenters'] = false; 325 | $options_changed = true; 326 | } 327 | 328 | if ( $options_changed ) { 329 | \update_option( self::$option_name, $this->options ); 330 | } 331 | } 332 | 333 | /** 334 | * Returns the default settings. 335 | * 336 | * @return string[] 337 | */ 338 | public static function get_defaults(): array { 339 | return [ 340 | 'clean_emails' => true, 341 | 'comment_policy' => false, 342 | 'comment_policy_text' => \__( 'I agree to the comment policy.', 'comment-hacks' ), 343 | 'comment_policy_error' => \__( 'You have to agree to the comment policy.', 'comment-hacks' ), 344 | 'comment_policy_page' => '0', 345 | 'disable_email_all_commenters' => false, 346 | /* translators: %s expands to the post title */ 347 | 'email_subject' => \sprintf( \__( 'RE: %s', 'comment-hacks' ), '%title%' ), 348 | /* translators: %1$s expands to the commenters first name, %2$s to the post tittle, %3$s to the post permalink, %4$s expands to a double line break. */ 349 | 'email_body' => \sprintf( \__( 'Hi %1$s,%4$sI\'m emailing you because you commented on my post "%2$s" - %3$s', 'comment-hacks' ), '%firstname%', '%title%', '%permalink%', "\r\n\r\n" ) . "\r\n", 350 | /* translators: %1$s expands to the post tittle, %2$s to the post permalink, %3$s expands to a double line break. */ 351 | 'mass_email_body' => \sprintf( \__( 'Hi,%3$sI\'m sending you all this email because you commented on my post "%1$s" - %2$s', 'comment-hacks' ), '%title%', '%permalink%', "\r\n\r\n" ) . "\r\n", 352 | 'mincomlength' => 15, 353 | 'mincomlengtherror' => \__( 'Error: Your comment is too short. Please try to say something useful.', 'comment-hacks' ), 354 | 'maxcomlength' => 1500, 355 | 'maxcomlengtherror' => \__( 'Error: Your comment is too long. Please try to be more concise.', 'comment-hacks' ), 356 | 'redirect_page' => '0', 357 | 'forward_email' => '', 358 | 'forward_name' => \__( 'Support', 'comment-hacks' ), 359 | /* translators: %1$s is replaced by the blog's name. */ 360 | 'forward_subject' => \sprintf( \__( 'Comment forwarded from %1$s', 'comment-hacks' ), \get_bloginfo( 'name' ) ), 361 | 'forward_from_email' => self::get_from_email_default(), 362 | ]; 363 | } 364 | 365 | /** 366 | * Set default values for the plugin. If old, as in pre 1.0, settings are there, use them and then delete them. 367 | * 368 | * @since 1.0 369 | * 370 | * @return void 371 | */ 372 | public function set_defaults(): void { 373 | $this->options = \wp_parse_args( $this->options, self::get_defaults() ); 374 | 375 | \update_option( self::$option_name, $this->options ); 376 | } 377 | 378 | /** 379 | * Load plugin textdomain. 380 | * 381 | * @return void 382 | */ 383 | public function load_text_domain(): void { 384 | \load_plugin_textdomain( 'comment-hacks', false, \dirname( \plugin_basename( \EMILIA_COMMENT_HACKS_FILE ) ) . '/languages' ); 385 | } 386 | } 387 | -------------------------------------------------------------------------------- /inc/length.php: -------------------------------------------------------------------------------- 1 | options = Hacks::get_options(); 22 | 23 | // Process the comment and check it for length. 24 | \add_filter( 'preprocess_comment', [ $this, 'check_comment_length' ] ); 25 | } 26 | 27 | /** 28 | * Check the length of the comment and if it's too short: die. 29 | * 30 | * @since 1.0 31 | * 32 | * @param string[] $comment_data All the data for the comment. 33 | * 34 | * @return string[] All the data for the comment (only returned when the comment is long enough). 35 | */ 36 | public function check_comment_length( $comment_data ): array { 37 | // Bail early for editors and admins, they can leave short or long comments if they want. 38 | if ( \current_user_can( 'edit_posts' ) ) { 39 | return $comment_data; 40 | } 41 | 42 | $length = $this->get_comment_length( $comment_data['comment_content'] ); 43 | 44 | // Check for comment length and die if too short or too long. 45 | $error = false; 46 | if ( $length < $this->options['mincomlength'] ) { 47 | $error = $this->options['mincomlengtherror']; 48 | } 49 | if ( $length > $this->options['maxcomlength'] ) { 50 | $error = $this->options['maxcomlengtherror']; 51 | } 52 | 53 | if ( $error ) { 54 | \wp_die( \esc_html( $error ) . '
' . \esc_html__( 'Go back and try again.', 'comment-hacks' ) . '' ); 55 | } 56 | return $comment_data; 57 | } 58 | 59 | /** 60 | * Returns the comment length for a comment. 61 | * 62 | * @since 1.3 63 | * 64 | * @param string $comment The comment to determine length. 65 | * 66 | * @return int The length of the comment. 67 | */ 68 | private function get_comment_length( string $comment ): int { 69 | $comment = \trim( $comment ); 70 | 71 | if ( \function_exists( 'mb_strlen' ) ) { 72 | return \mb_strlen( $comment, \get_bloginfo( 'charset' ) ); 73 | } 74 | return \strlen( $comment ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /inc/notifications.php: -------------------------------------------------------------------------------- 1 | comment_post_ID, '_comment_notification_recipient', true ); 32 | 33 | if ( ! empty( $new_recipient ) ) { 34 | $user = \get_userdata( $new_recipient ); 35 | 36 | return [ $user->user_email ]; 37 | } 38 | 39 | return $recipients; 40 | } 41 | 42 | /** 43 | * Filter the headers of the comment notification. 44 | * 45 | * @param string $message_headers The headers of the message. 46 | * @param int $comment_id The ID of the comment. 47 | * 48 | * @return string Enhanced headers. 49 | */ 50 | public function filter_notification_headers( $message_headers, $comment_id ): string { 51 | $comment = \get_comment( $comment_id ); 52 | 53 | if ( $comment->comment_author !== '' && $comment->comment_author_email !== '' ) { 54 | $name = \esc_html( $comment->comment_author ); 55 | $message_headers .= "\nReply-To: $name <$comment->comment_author_email>\n"; 56 | 57 | return $message_headers; 58 | } 59 | 60 | if ( $comment->comment_author_email !== '' ) { 61 | $message_headers .= "\nReply-To: $comment->comment_author_email <$comment->comment_author_email>\n"; 62 | 63 | return $message_headers; 64 | } 65 | 66 | return $message_headers; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /inc/progress-planner-tasks.php: -------------------------------------------------------------------------------- 1 | $providers Array of task provider objects. 23 | * 24 | * @return array Array of task provider objects. 25 | */ 26 | public function add_task_providers( $providers ) { 27 | // Bail early if the version is less than 1.1.1. 28 | $progress_planner_version = \get_file_data( \PROGRESS_PLANNER_FILE, [ 'Version' => 'Version' ] )['Version']; 29 | if ( \version_compare( $progress_planner_version, '1.1.1', '<' ) ) { 30 | return $providers; 31 | } 32 | 33 | // Bail early if the Tasks class does not exist. 34 | if ( ! \class_exists( '\Progress_Planner\Suggested_Tasks\Providers\Tasks' ) ) { 35 | return $providers; 36 | } 37 | 38 | // Remove the disable-comments provider - if you have this plugin installed, you don't need to see this task. 39 | foreach ( $providers as $key => $provider ) { 40 | if ( $provider->get_provider_id() === 'disable-comments' ) { 41 | unset( $providers[ $key ] ); 42 | } 43 | } 44 | 45 | // Add the tasks. 46 | $providers[] = new Progress_Planner\Comment_Policy(); 47 | $providers[] = new Progress_Planner\Comment_Redirect(); 48 | $providers[] = new Progress_Planner\Comment_Moderation(); 49 | 50 | return $providers; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /inc/progress-planner/comment-moderation.php: -------------------------------------------------------------------------------- 1 | url = \admin_url( 'edit-comments.php?comment_status=moderated' ); 55 | } 56 | 57 | /** 58 | * Get the title. 59 | * 60 | * @return string 61 | */ 62 | public function get_title() { 63 | return \esc_html__( 'Moderate comments', 'comment-hacks' ); 64 | } 65 | 66 | /** 67 | * Get the description. 68 | * 69 | * @return string 70 | */ 71 | public function get_description() { 72 | return \esc_html__( 'Moderate comments to make sure they are not spam.', 'comment-hacks' ); 73 | } 74 | 75 | /** 76 | * Check if the task should be added. 77 | * 78 | * @return bool 79 | */ 80 | public function should_add_task() { 81 | $comments = \get_comments( 82 | [ 83 | 'status' => 'hold', 84 | 'count' => true, 85 | ] 86 | ); 87 | 88 | return $comments > 0; // @phpstan-ignore-line 89 | } 90 | 91 | /** 92 | * Get the task details. 93 | * 94 | * @param string $task_id The task ID. 95 | * 96 | * @return array{ 97 | * task_id: string, 98 | * title: string, 99 | * parent: int, 100 | * priority: string, 101 | * category: string, 102 | * points: int, 103 | * url: string, 104 | * description: string 105 | * } The task details. 106 | */ 107 | public function get_task_details( $task_id = '' ) { 108 | 109 | if ( ! $task_id ) { 110 | $task_id = $this->get_task_id(); 111 | } 112 | 113 | return [ 114 | 'task_id' => $task_id, 115 | 'title' => $this->get_title(), 116 | 'parent' => 0, 117 | 'priority' => 'high', 118 | 'category' => $this->get_provider_category(), 119 | 'points' => 1, 120 | 'url' => $this->get_url(), 121 | 'description' => $this->get_description(), 122 | ]; 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /inc/progress-planner/comment-policy.php: -------------------------------------------------------------------------------- 1 | options = Hacks::get_options(); 50 | $this->url = \admin_url( 'options-general.php?page=comment-experience#top#comment-policy' ); 51 | } 52 | 53 | /** 54 | * Get the title. 55 | * 56 | * @return string 57 | */ 58 | public function get_title() { 59 | return \esc_html__( 'Implement a comment policy', 'comment-hacks' ); 60 | } 61 | 62 | /** 63 | * Get the description. 64 | * 65 | * @return string 66 | */ 67 | public function get_description() { 68 | return \sprintf( 69 | /* translators: %s:comment policy link */ 70 | \esc_html__( 'Implement a %s to make sure your commenters know what they can and cannot do.', 'comment-hacks' ), 71 | '' . \esc_html__( 'comment policy', 'comment-hacks' ) . '' 72 | ); 73 | } 74 | 75 | /** 76 | * Check if the task should be added. 77 | * 78 | * @return bool 79 | */ 80 | public function should_add_task() { 81 | if ( ! (int) $this->options['comment_policy_page'] || ! (int) $this->options['comment_policy'] ) { 82 | return true; 83 | } 84 | 85 | return false; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /inc/progress-planner/comment-redirect.php: -------------------------------------------------------------------------------- 1 | options = Hacks::get_options(); 49 | $this->url = \admin_url( 'options-general.php?page=comment-experience#top#comment-redirect' ); 50 | } 51 | 52 | /** 53 | * Get the title. 54 | * 55 | * @return string 56 | */ 57 | public function get_title() { 58 | return \esc_html__( 'Implement a comment redirect', 'comment-hacks' ); 59 | } 60 | 61 | /** 62 | * Get the description. 63 | * 64 | * @return string 65 | */ 66 | public function get_description() { 67 | return \sprintf( 68 | /* translators: %s:comment redirect link */ 69 | \esc_html__( 'Implement a %s to thank first-time commenters for their comment.', 'comment-hacks' ), 70 | '' . \esc_html__( 'comment redirect', 'comment-hacks' ) . '' 71 | ); 72 | } 73 | 74 | /** 75 | * Check if the task should be added. 76 | * 77 | * @return bool 78 | */ 79 | public function should_add_task() { 80 | if ( ! $this->options['redirect_page'] ) { 81 | return true; 82 | } 83 | 84 | return false; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | 7 | Emilia Projects Standards 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /phpstan.neon.dist: -------------------------------------------------------------------------------- 1 | parameters: 2 | level: 6 3 | paths: 4 | - . 5 | excludePaths: 6 | - vendor 7 | - tests 8 | - node_modules 9 | treatPhpDocTypesAsCertain: false 10 | ignoreErrors: 11 | - '#Constant EMILIA_COMMENT_HACKS_PATH not found.#' 12 | - '#Constant PROGRESS_PLANNER_FILE not found.#' 13 | - '#Call to an undefined method EmiliaProjects\\WP\\Comment\\Inc\\Progress_Planner\\[a-zA-Z0-9_\\\:\(\)].#' 14 | - '#Call to method [a-zA-Z0-9_\\\]+() on an unknown class Progress_Planner\\[a-zA-Z0-9_\\].#' 15 | - '#Method EmiliaProjects\\WP\\Comment\\Inc\\Progress_Planner_Tasks\:\:add_task_providers\(\) has invalid return type Progress_Planner\\Suggested_Tasks\\Tasks\\Providers\\Provider.#' 16 | - '#Parameter \$providers of method EmiliaProjects\\WP\\Comment\\Inc\\Progress_Planner_Tasks\:\:add_task_providers\(\) has invalid type Progress_Planner\\Suggested_Tasks\\Tasks\\Providers\\Provider.#' 17 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === Comment Experience by Progress Planner === 2 | Contributors: joostdevalk 3 | Tags: comments, spam, emails 4 | Text Domain: comment-hacks 5 | Requires at least: 6.6 6 | Tested up to: 6.8 7 | Stable tag: 2.1.4 8 | License: GPLv3 9 | License URI: https://www.gnu.org/licenses/gpl-3.0.html 10 | Requires PHP: 7.4 11 | 12 | Make comments management easier by applying the simple hacks Joost has gathered over the years. 13 | 14 | == Description == 15 | 16 | Make comments management easier by applying the simple hacks Joost has gathered over the years. 17 | 18 | This plugin adds some small hacks around core WordPress comments to make them more bearable: 19 | 20 | * Cleaner comment notification emails. 21 | * The option to enforce a comment policy: just create a comment policy page, toggle the option on and select it, and 22 | commenters will have to accept your comment policy before being able to comment. 23 | * The option to forward comments to an email address (for instance for your support team) and then trash them. 24 | * The option to disallow comments below and above a certain length. 25 | * The option to redirect first time commenters to a "thank you" page. 26 | * An input field on the comment edit screen to change the comment parent ID. 27 | * Links in the admin comments section to email individual commenters. 28 | * A button in the WP toolbar to email all the commenters on a post. 29 | * Adds a comment routing option. This adds a dropdown in a post's discussion settings, allowing the routing of comment emails to another user. 30 | 31 | See the screenshots to get an even better idea of the plugins' functionality. 32 | 33 | === Have you found an issue? === 34 | 35 | If you have bugs to report, please go to [the plugin's GitHub repository](https://github.com/emilia-capital/comment-hacks). For security issues, please use our [vulnerability disclosure program](https://patchstack.com/database/vdp/comment-hacks), which is managed by PatchStack. They will assist you with verification, CVE assignment, and, of course, notify us. 36 | 37 | 38 | == Installation == 39 | 40 | **Install through your backend** 41 | 42 | 1. Search for "comment hacks", click install. 43 | 1. You're done. 44 | 45 | **Install manually** 46 | 47 | 1. Download and unzip the plugin. 48 | 1. Upload the `comment-hacks` directory to the `/wp-content/plugins/` directory. 49 | 1. Activate the plugin through the 'Plugins' menu in WordPress. 50 | 1. Configure your settings on the Settings → Comment Experience screen. 51 | 52 | == Screenshots == 53 | 54 | 1. Screenshot of a clean comment notification email. 55 | 2. The comment parent edit box. 56 | 3. The plugins admin settings. 57 | 4. The button on the frontend to email all the commenters on a post. 58 | 5. The link in the backend to email an individual commenters on a post. 59 | 60 | == Changelog == 61 | 62 | = 2.1.4 = 63 | 64 | * Add compatibility with WordPress 6.8. 65 | * Save proper values for Redirect page settings when no selection is made. 66 | * Run upgrade routine only when plugin version is increased 67 | * Migrate PHPUnit XML schema 68 | * Compatibility with Progress Planner v1.4 69 | 70 | = 2.1.3 = 71 | 72 | * Add necessary compatibility to Progress Planner integration for the upcoming WordPress 6.8. 73 | 74 | = 2.1.2 = 75 | 76 | * Rename the plugin from "Comment Hacks" to "Comment Experience". 77 | * Bring up to date with changes in Progress Planner 78 | 79 | = 2.1.1 = 80 | 81 | * Don't enqueue the remove URL script on the frontend for logged out users or users without the `edit_posts` capability. 82 | 83 | = 2.1 = 84 | 85 | * Added a link to remove the author's URL from the comment from the frontend. 86 | * Fix comment policy function for admins and editors. 87 | 88 | = 1.9.4 = 89 | 90 | * Fix fatal due to wrong class import, props [@andizer](https://profiles.wordpress.org/andizer/). 91 | 92 | = 1.9.3 = 93 | 94 | * Fix bug where comment reroute recipient would not save. 95 | * Added an option to disable the "Email all commenters" admin bar button. 96 | 97 | = 1.9.2 = 98 | 99 | * Fix missing autoloader. 100 | 101 | = 1.9 = 102 | 103 | * Introduces a new option to the plugin: adding a comment policy was never easier than this: just create a comment 104 | policy page, toggle the option on and select it, and commenters will have to accept your comment policy before being 105 | able to comment. 106 | * Fixes a bug where editing a comment on the quick edit screen would cause that comment to lose its parent. 107 | * Enhances performance by preventing too frequent option updates. 108 | * Remove all direct DB queries in favor of using WordPress core functions. 109 | 110 | = 1.8.1 = 111 | 112 | * Fixed a couple of PHP 7.4 related issues. 113 | 114 | = 1.8 = 115 | 116 | * Changed namespace to `JoostBlog`. 117 | * Removed Yoast branding. 118 | * Updated plugin to require PHP 7.4. 119 | 120 | = 1.7 = 121 | 122 | * Bugfixes: 123 | * Fixed: the "Email commenters" link would not be displayed in the WordPress admin bar and in the Comments list. 124 | * Fixed: the "Email commenters" link in the front end admin bar wouldn't work when jQuery wasn't enqueued. 125 | * Fixed: the notification emails for new comments would have incorrect content for the Author line and the text displayed before the comment. 126 | 127 | = 1.6 = 128 | 129 | * Fix language packs. 130 | 131 | = 1.5 = 132 | 133 | * Bugfixes: 134 | * Fixed: comment recipient dropdown would reset on reload of the page. 135 | * Fixed: admin bar CSS showing when no admin bar is showing. 136 | 137 | = 1.4 = 138 | 139 | * Enhancements: 140 | * Limit the roles shown in the comment notifications dropdown to roles that normally exist and can write. Introduces a new filter to allow expanding them. 141 | 142 | = 1.3 = 143 | 144 | * Enhancements: 145 | * Add option to restrict comments that are too long, next to too small. 146 | * Add `reply-to` header to comment notification and moderation emails, pointing to the post author. 147 | * Preserve the active tab when saving settings. 148 | * Remove `[...]` from pingback / trackback excerpt in cleaned emails as that's already included by core. 149 | * Replace link to ARIN with link to [ip-lookup.net](http://ip-lookup.net) for details about the IP. 150 | * Refactored code for readability and code quality. 151 | * Refactor upgrade routine to do less DB queries. 152 | 153 | = 1.2 = 154 | 155 | Fixes several issues: 156 | 157 | * Differentiate between AJAX request and normal POST for nonce checking, fixes #7. 158 | * Make sure comment type isn't empty in cleaned email, fixes #8. 159 | * Allow setting the comment parent to 0, fixes #10. 160 | * Prevents defaults from being reinstated, fixes #14. 161 | 162 | Also: 163 | 164 | * Adds translator comments to all strings with `sprintf` / `printf`. 165 | * Updates to new version of Yoast i18n, in the process switching from `translate.yoast.com` to `translate.wordpress.org` and removing packaged translations. 166 | * Added `yarn.lock` and removed no longer needed i18n grunt tasks. 167 | 168 | = 1.1.1 = 169 | 170 | * Add text domain so the plugin can be translated. 171 | 172 | = 1.1 = 173 | 174 | * Add comment routing option, adds a dropdown in a post's discussion settings, allowing the routing of comment emails to another user. 175 | 176 | = 1.0 = 177 | 178 | * Initial version. 179 | --------------------------------------------------------------------------------