Should now do the same with flash objects too. TODO : Elegant degradation and click to play.
This commit is contained in:
parent
bf3672034b
commit
b4cdd31c2a
@ -8,7 +8,9 @@ This is a plugin for Leed written by Phyks (phyks@phyks.me) to allow a leed user
|
|||||||
|
|
||||||
This behavior can be fully customized in a per feed way (with either a blacklist or a whitelist). You can also choose to disable images only on mobile browsers.
|
This behavior can be fully customized in a per feed way (with either a blacklist or a whitelist). You can also choose to disable images only on mobile browsers.
|
||||||
|
|
||||||
**Important note :** To install the plugin, just do as usual with leed plugins. The adblock folder goes in the plugins directory of your leed installation. **Don't rename** the adblock directory unless you know what you do (you will need to change some paths values in the script itself).
|
**Important note :** To install the plugin, just do as usual with leed plugins. The adblock folder goes in the plugins directory of your leed installation. **Don't rename** the adblock directory unless you know what you do (you will need to change some paths values in the script itself). For an elegant degradation, _ie_ replacement of the deleted content by neutral content of the same size, you will need the GD library.
|
||||||
|
|
||||||
|
**Note :** This will replace all images (found by searching for <img> tags) and all embedded objects (found by searching for <object> tags). This will only mask them when you display the page (and not load them) on a server side. If you click on the replacement content, it will load the masked content.
|
||||||
|
|
||||||
## Constants (_adblock_constants.php_ file)
|
## Constants (_adblock_constants.php_ file)
|
||||||
|
|
||||||
|
@ -76,7 +76,13 @@ function adblock_plugin_treat_events(&$events) {
|
|||||||
if($filter_flash) {
|
if($filter_flash) {
|
||||||
if(($block_flash && !in_array($event->getFeed(), $flash_except_list)) || (!$block_flash && in_array($event->getFeed(), $flash_except_list))) {
|
if(($block_flash && !in_array($event->getFeed(), $flash_except_list)) || (!$block_flash && in_array($event->getFeed(), $flash_except_list))) {
|
||||||
//Replace flash content
|
//Replace flash content
|
||||||
$event->setContent($filered_content); // TODO
|
$object_list_in_event = preg_match_all("#<object.{0,}>.{0,}</object>#U", $filtered_content);
|
||||||
|
|
||||||
|
foreach($object_list_in_event as $object) {
|
||||||
|
$filtered_content = str_replace($object[0], "", $filtered_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
$event->setContent($filtered_content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +93,7 @@ function adblock_plugin_treat_events(&$events) {
|
|||||||
$img_list_in_event = preg_match_all("#<img.{0,}src=[\"'](.{1,})[\"'].{0,}/>#U", $filtered_content);
|
$img_list_in_event = preg_match_all("#<img.{0,}src=[\"'](.{1,})[\"'].{0,}/>#U", $filtered_content);
|
||||||
|
|
||||||
foreach($img_list_in_event as $img) {
|
foreach($img_list_in_event as $img) {
|
||||||
$filtered_event = str_replace($img[0], "", $filtered_content);
|
$filtered_content = str_replace($img[0], "", $filtered_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->setContent($filtered_content);
|
$event->setContent($filtered_content);
|
||||||
|
Loading…
Reference in New Issue
Block a user