Don't be nervous. This question means adding a limit to comments, the submission will fail and the system will prompt you not to mention the small butterfly. I know that you have missed me for a day. to surprise you a little, I have developed this function today, please try it in the comment box. before you complete this code, let me parse it.
Don't be nervous. This question means adding a limit to comments, the submission will fail and prompt "Do not say little butterfly is wretched". I know that you have missed me for a day. to surprise you, I have provided this function today, please try it in the comment box. before you complete this code, let me parse it.
Don't be nervous. This question means adding a limit to the comments. If you say I am a zombie in the comments, the comments will fail to be submitted and prompt "do not say I'm a zombie"
I know that you have missed me for a day. To give you a small surprise, I have provided this feature today. Please try it in the comment box.
Before you complete this code, let me dissect it for you (otherwise it will not be long written). If you want to detect someone who says in the comments that the butterfly is cool, of course, a regular expression is required to match the comment content:
Preg_match_all ('/small butterfly wretched/', $ ccontent, $ match)
But now, I think again, if you have no conscience to say "little butterfly is really cool" "Little butterfly is so cool" Little butterfly is so cool ", what should you do?
So we need to reconcile the things between the little butterfly and the wretched one,
Preg_match_all ('/little butterfly [^>] * wretched/', $ ccontent, $ match)
In this way, no matter what you insert Between the butterfly and the zombie, it will be detected and returned, but I thought again, what if some good people say that "the butterfly is not trivial" is also harmonious? Such a good person must be retained. Therefore, before the above match:
If (preg_match_all ('/little butterfly is not trivial/', $ ccontent, $ match) {return $ comment ;}
Now, the article is long enough. The complete version is as follows:
Function xiaohudie_buweisuo ($ comment) {$ ccontent = $ comment ['comment _ content']; $ mattings = '/butterfly [^>] * trivial /'; $ match2 = '/the butterfly is not trivial/'; if (preg_match_all ($ match2, $ ccontent, $ match) {return $ comment ;} // if it is "Little butterfly is not trivial", the comments if (preg_match_all ($ mattings, $ ccontent, $ match) {header ("Content-type: text/html; charset = UTF-8 "); exit ('change to" Little butterfly "'); // unfortunately, if it is not "no" between a butterfly and a zombie "....} else {return $ comment; // ignore other situations} add_filter ('preprocess _ comment', 'xiaohudie _ buweisuo ');
Finally, let's talk about it again: You have no conscience. At the end of the previous article, I raised such a touching question. Why didn't Nima come to answer me? NO benefits any more!
Here is the feeling of being bombed in the afternoon: first, the hacker's broken mailbox crashes again, and then the anger summarizes the vulnerabilities that have been fixed so far: "The little butterfly is not so cool" has expired. The HTML Tag in "The Little butterfly" has expired. "small. invalid. butterfly. invalid. "NO, NO! My goal is to make you have to add a butterfly in your comments. Although you still express the meaning of a butterfly, I will win if I don't care! Who
Original article address: wordpress harmonious comment: it is not allowed to mention that the butterfly is wretched. Thank you for sharing it with the original author.