How do I put a notice reminder when somebody remove the powered on my theme footer
Example link on my footer
$powered = 'Powered by <a href="htp://stackoverflow开发者_JS百科.com">Stackoverflow</a>';
theme file
<?php echo $powered; ?>
How to make if $powered
removed from my footer and the error/reminder notice it.
Example die('Do not remove the powered link')
Short answer: not possible.
Long answer:
<?php
$powered = 'Powered by <a href="htp://stackoverflow.com">Stackoverflow</a>';
ob_start();
echo $powered;
$html = ob_get_clean();
/*
* If you remove the "echo $powered;" part, please don't remove the following lines
* so I can detect the license violation. Thank you for your cooperation!
*/
if( strpos($html, $powered)===FALSE ){
echo die('Do not remove the powered link');
}else{
echo $html;
}
?>
It's possible... you can use Zend Guard to protect your code from being altered.
精彩评论