Posts Tagged protect image
TIProtector
Posted by Im a programmer in PHP, wordpress on 07/01/2011
In following of the last post…
After finishing protect_content function I thought I can use it in wp too
So I tried to learn how to make a plugin for wordpress
At the beginning it was really hard but after an hour I got used to it And i finished writing a simple plugin in 5 hours(lots of time XD)
Download the plugin HERE
I hope you enjoy it
Have a good day
Protect Content Function
Posted by Im a programmer in PHP on 07/01/2011
Hi everyone
Last night I wrote a function to protect content of my site
For whoever has a site and wants to use my function here is the function
* I used simple_html_dom class in this function, you can download it here Simple html DOM
function protect_images($text, $protect_images = true, $protect_text = true){
require("simple_html_dom.php");
$html = str_get_html($text);
$image_original = array();
$image_protected = array();
if ($protect_images)
foreach($html->find('img') as $element){
$src = $element->src;
$width = $element->width;
$width_p = $width + 2;
$height = $element->height;
$height_p = $height + 2;
$element->outertext = '
';
}
if ($protect_text)
return '
';
else
return $html;
}
}

