/** * Initialize the addon * * @since 4.6 */ public static function init() { self::$_slug = self::_generate_slug(); if (is_admin()) { // Called from the PopUp Settings screen. add_filter('popup-settings-loading-method', array(__CLASS__, 'settings')); } else { // Called when initializing custom loading method in the Front-End. add_action('popup-init-loading-method', array(__CLASS__, 'init_public'), 10, 2); } // Modify the HTML/CSS code of the ajax response. add_filter('popup-output-data', array(__CLASS__, 'filter_script_data'), 10, 2); }
{ const METHOD = 'anonymous'; /** * Initialize the addon * * @since 4.6 */ public static function init() { if (is_admin()) { // Called from the PopUp Settings screen. add_filter('popup-settings-loading-method', array(__CLASS__, 'settings')); } } /** * Filter that returns a modified version of the loading methods * (displayed in the settings page) * * @since 4.6 * @param array $loading_methods * @return array */ public static function settings($loading_methods) { $pro_only = ' - ' . __('PRO Verson', PO_LANG); $loading_methods[] = (object) array('id' => self::METHOD, 'label' => __('Anonymous Script', PO_LANG) . $pro_only, 'info' => __('Drastically increase the chance to bypass ad-blockers. ' . 'Loads PopUp like WordPress AJAX, but the URL to the ' . 'JavaScript file is masked. ', PO_LANG), 'disabled' => true); return $loading_methods; } } IncPopupAddon_AnonyousLoading::init();