/** * wp callback */ public function call_wp() { if (!is_admin() && !is_feed()) { // add wp_head for setting js vars and css style add_action('wp_head', array($this, 'call_wp_head')); // set js file if ($this->get_opt('use_js')) { wp_enqueue_script('wp-external-links', plugins_url('js/wp-external-links.js', WP_EXTERNAL_LINKS_FILE), array('jquery'), WP_EXTERNAL_LINKS_VERSION, (bool) $this->get_opt('load_in_footer')); } // set ignored $ignored = $this->get_opt('ignore'); $ignored = trim($ignored); $ignored = explode("\n", $ignored); $ignored = array_map('trim', $ignored); $ignored = array_map('strtolower', $ignored); $this->ignored = $ignored; // filters if ($this->get_opt('filter_page')) { // filter body ob_start(array($this, 'call_filter_content')); // set ob flush add_action('wp_footer', array($this, 'callback_flush_buffer'), 10000); } else { // set filter priority $priority = 1000000000; // content if ($this->get_opt('filter_posts')) { add_filter('the_title', array($this, 'call_filter_content'), $priority); add_filter('the_content', array($this, 'call_filter_content'), $priority); add_filter('get_the_excerpt', array($this, 'call_filter_content'), $priority); // redundant: //add_filter( 'the_excerpt', array( $this, 'call_filter_content' ), $priority ); } // comments if ($this->get_opt('filter_comments')) { add_filter('get_comment_text', array($this, 'call_filter_content'), $priority); // redundant: //add_filter( 'comment_text', array( $this, 'call_filter_content' ), $priority ); add_filter('comment_excerpt', array($this, 'call_filter_content'), $priority); // redundant: //add_filter( 'get_comment_excerpt', array( $this, 'call_filter_content' ), $priority ); add_filter('comment_url', array($this, 'call_filter_content'), $priority); add_filter('get_comment_author_url', array($this, 'call_filter_content'), $priority); add_filter('get_comment_author_link', array($this, 'call_filter_content'), $priority); add_filter('get_comment_author_url_link', array($this, 'call_filter_content'), $priority); } // widgets if ($this->get_opt('filter_widgets')) { if ($this->admin->check_widget_content_filter()) { // only if Widget Logic plugin is installed and 'widget_content' option is activated add_filter('widget_content', array($this, 'call_filter_content'), $priority); } else { // filter text widgets add_filter('widget_title', array($this, 'call_filter_content'), $priority); add_filter('widget_text', array($this, 'call_filter_content'), $priority); } } } } // hook do_action('wpel_ready', array($this, 'call_filter_content'), $this); }
/** * wp callback */ public function call_wp() { if ( ! is_admin() && ! is_feed() ) { // Include phpQuery if ( ! class_exists( 'phpQuery' ) ) { require_once( 'phpQuery.php' ); } // add wp_head for setting js vars and css style add_action( 'wp_head', array( $this, 'call_wp_head' ) ); // add stylesheet wp_enqueue_style( 'wp-external-links', plugins_url( 'css/external-links.css', WP_EXTERNAL_LINKS_FILE ), FALSE, WP_EXTERNAL_LINKS_VERSION ); // set js file if ( $this->get_opt( 'use_js' ) ) wp_enqueue_script( 'wp-external-links', plugins_url( 'js/external-links.js', WP_EXTERNAL_LINKS_FILE ), array( 'jquery' ), WP_EXTERNAL_LINKS_VERSION ); // filters if ( $this->get_opt( 'filter_page' ) ) { // filter body ob_start( array( $this, 'call_filter_content' ) ); } else { // set filter priority $priority = 1000000000; // content if ( $this->get_opt( 'filter_posts' ) ) { add_filter( 'the_title', array( $this, 'call_filter_content' ), $priority ); add_filter( 'the_content', array( $this, 'call_filter_content' ), $priority ); add_filter( 'get_the_excerpt', array( $this, 'call_filter_content' ), $priority ); // redundant: //add_filter( 'the_excerpt', array( $this, 'call_filter_content' ), $priority ); } // comments if ( $this->get_opt( 'filter_comments' ) ) { add_filter( 'get_comment_text', array( $this, 'call_filter_content' ), $priority ); // redundant: //add_filter( 'comment_text', array( $this, 'call_filter_content' ), $priority ); add_filter( 'comment_excerpt', array( $this, 'call_filter_content' ), $priority ); // redundant: //add_filter( 'get_comment_excerpt', array( $this, 'call_filter_content' ), $priority ); add_filter( 'comment_url', array( $this, 'call_filter_content' ), $priority ); add_filter( 'get_comment_author_url', array( $this, 'call_filter_content' ), $priority ); add_filter( 'get_comment_author_link', array( $this, 'call_filter_content' ), $priority ); add_filter( 'get_comment_author_url_link', array( $this, 'call_filter_content' ), $priority ); } // widgets if ( $this->get_opt( 'filter_widgets' ) ) { if ( $this->admin->check_widget_content_filter() ) { // only if Widget Logic plugin is installed and 'widget_content' option is activated add_filter( 'widget_content', array( $this, 'call_filter_content' ), $priority ); } else { // filter text widgets add_filter( 'widget_title', array( $this, 'call_filter_content' ), $priority ); add_filter( 'widget_text', array( $this, 'call_filter_content' ), $priority ); } } } } }