The seven dirty words

PHP

Data types

https://secure.php.net/manual/en/language.types.php
https://secure.php.net/manual/en/language.types.string.php
https://secure.php.net/manual/en/language.types.array.php

Control structures

https://secure.php.net/manual/en/language.control-structures.php
https://secure.php.net/manual/en/control-structures.if.php
https://secure.php.net/manual/en/control-structures.foreach.php
https://secure.php.net/manual/en/control-structures.continue.php

Strings

https://secure.php.net/manual/en/book.strings.php
https://secure.php.net/explode
https://secure.php.net/strpos
https://secure.php.net/stripos
https://secure.php.net/substr

Regular expressions (Perl-compatible)

https://secure.php.net/manual/en/book.pcre.php
https://secure.php.net/preg-match
https://secure.php.net/preg-replace1

WordPress

Plugins

https://codex.wordpress.org/Writing_a_Plugin

Filters

https://codex.wordpress.org/Plugin_API#Filters
https://codex.wordpress.org/Function_Reference/add_filter
https://codex.wordpress.org/Function_Reference/comment_text
https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-includes/comment-template.php#L827

Regular expressions

http://www.regular-expressions.info/quickstart.html
https://regex101.com/

Assignment

Create a plugin that will check comments for the seven dirty words. If a comment contains any of them, translate the comment into Pig Latin when it is displayed.


  1. If you are very familiar with regular expressions, try using preg_replace; otherwise, work with preg_match and the resultant $matches array. 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.