I have the same problem, and thanks to @Brian Fegter, you can use the following working code that searches for your copyright citation.
add_action('template_redirect', 'foobar_explode_if_no_citation');
function foobar_explode_if_no_citation(){
#Get the absolute server path to footer.php
$footer_path = locate_template('footer.php');
#Store the footer file contents in a var
$footer_contents = file_get_contents($footer_path);
#The required string
$citation_string = 'Designed by Foo Bar';
#Set off the nuclear bomb if there is an egregious offense
if(!preg_match("/$citation_string/", $footer_contents))
exit('All your website belongs to me. Make sure this string "Designed by Foo Bar" is included in footer.php');
}
All you need to do is change $citation_string
to match yours, for example: Designed by Foo Bar
The code will search into the file footer.php
(you can change it with any file name) for the string "Designed by Foo Bar"
, if it doesn't find it it will output a warning message, for example
All your website belongs to me. Make sure this string "Designed by Foo
Bar" is included in footer.php
Also if you want to add a link in your citation you just need to replace the preg_match()
by this (credit goes to @Rizier123 )
if(!preg_match("/" . preg_quote($citation_string, "/") . "/", $footer_contents))
I think it will help others who work days and nights coding. Peoples must respect copyrights.