@link http://www.phyks.me @licence BEERWARE @version 2.0.0 @description Le plugin adblock permet d'empêcher le lancement automatique de contenus embed de type "flash" et notamment des pubs dans les flux RSS. Par défaut, tous les contenus sont bloqués. Il est possible de modifier ce comportement et de régler finement par flux. */ function adblock_plugin_treat_events(&$events) { foreach($events as $event) { $old_content = $event->getContent(); } } function adblock_plugin_setting_link(&$myUser) { echo '
  • Adblock
  • '; } function adblock_plugin_setting_bloc(&$myUser) { $adblock_constants = file_get_contents('plugins/adblock/adblock_constants.php'); $adblock_constants = explode("\n", $adblock_constants); foreach($adblock_constants as $adblock_constant) { if(trim($adblock_constant) != "") { $adblock_constant = explode("=", $adblock_constant); $adblock_params[trim($adblock_constant[0])] = trim($adblock_constant[1]); } } $flash_enabled = ($adblock_params["flash_enabled"] == "1") ? true : false; $flash_block = ($adblock_params["flash_block"] == "1") ? true : false; $flash_list = ""; $img_enabled = ($adblock_params["img_enabled"] == "1") ? true : false; $img_block = ($adblock_params["img_block"] == "1") ? true : false; $img_list = ""; echo '

    Plugin Adblock

    Flash embedded contents :

    Enable / Disable blocking of flash contents in events :

    Default behavior :

    '.(($flash_block) ? 'Blacklist :' : 'Whitelist :').'

    Images :

    Enable / Disable blocking of images in events :

    Default behavior :

    '.(($img_block) ? 'Blacklist :' : 'Whitelist :').'

    '; } function adblock_plugin_setting_update($_) { if($_['action'] == 'adblock_update') { $flash_enabled = int($_['flash_adblock_enable']); $flash_block = int($_['flash_adblock_default_behavior']) $flash_list = ''; $img_enabled = int($_['img_adblock_enable']); $img_block = int($_['img_adblock_default_behavior']) $img_list = ''; if(file_put_contents("plugins/adblock/adblock_constants.php", 'flash_enabled = '.$flash_enabled.'\nflash_block = '.$flash_block.'\nflash_list = '.$flash_list.'\nimg_enabled = '.$img_enabled.'\nimg_block = '.$img_block.'\nimg_list = '.$img_list)) header('location: settings.php'); else exit("Unable to write parameters to plugins/adblock/adblock_constants.php. Check permissions on the folders."); } } Plugin::addCSS("/css/adblock_plugin_css.css"); Plugin::addJS("/js/adblock_plugin_js.js"); Plugin::addHook("index_post_treatment", "adblock_plugin_treat_events"); Plugin::addHook("setting_post_link", "adblock_plugin_setting_link"); Plugin::addHook("setting_post_section", "adblock_plugin_setting_bloc"); Plugin::addHook("action_post_case", "adblock_plugin_setting_update"); ?>