protected function off($action, $method = false)
 {
     if ($method) {
         return remove_filter($action, array($this, $method));
     }
     return remove_all_filters($action);
 }
示例#2
0
 function __construct()
 {
     global $if_utils;
     parent::__construct();
     // configuration general
     global $ilen_seo;
     if (is_admin()) {
         add_action('admin_enqueue_scripts', array(&$this, 'script_and_style_admin'));
     } elseif (!is_admin()) {
         if (TRUE) {
             global $wp_version;
             if ((double) $wp_version >= 4.4) {
                 add_theme_support("title-tag");
                 add_filter('pre_get_document_title', array(&$this, 'getRealTitle'));
             } else {
                 if (!has_filter('wp_title', array(&$this, 'getRealTitle'))) {
                     remove_all_filters('wp_title');
                     add_filter('wp_title', array(&$this, 'getRealTitle'), 10, 3);
                 }
             }
             // add meta tags
             add_action('wp_head', array(&$this, 'getMetaTags'), 0);
             // remove Wordpress generator (as options)
             if (isset($ilen_seo->remove_link_wp_generator) && $ilen_seo->remove_link_wp_generator) {
                 add_filter('the_generator', array(&$this, 'wp_generator'));
             }
             // remove canonical links
             if (isset($ilen_seo->remove_link_canonical) && $ilen_seo->remove_link_canonical) {
                 remove_action('wp_head', 'rel_canonical');
             }
         }
         // add scripts & styles
         add_action('wp_enqueue_scripts', array(&$this, 'script_and_style_front'));
     }
 }
示例#3
0
 function hook_content_filters()
 {
     /*
      * Allow developers to skip running the advanced excerpt filters on certain page types.
      * They can do so by using the "Disable On" checkboxes on the options page or 
      * by passing in an array of page types they'd like to skip
      * e.g. array( 'search', 'author' );
      * The filter, when implemented, takes precedence over the options page selection.
      *
      * WordPress default themes (and others) do not use the_excerpt() or get_the_excerpt()
      * and instead use the_content(). As such, we also need to hook into the_content().
      * To ensure we're not changing the content of single posts / pages we automatically exclude 'singular' page types.
      */
     $page_types = $this->get_current_page_types();
     $skip_page_types = array_unique(array_merge(array('singular'), $this->options['exclude_pages']));
     $skip_page_types = apply_filters('advanced_excerpt_skip_page_types', $skip_page_types);
     $page_type_matches = array_intersect($page_types, $skip_page_types);
     if (!empty($page_types) && !empty($page_type_matches)) {
         return;
     }
     if (1 == $this->options['the_excerpt']) {
         remove_all_filters('get_the_excerpt');
         remove_all_filters('the_excerpt');
         add_filter('get_the_excerpt', array($this, 'filter_excerpt'));
     }
     if (1 == $this->options['the_content']) {
         add_filter('the_content', array($this, 'filter_content'));
     }
 }
 /**
  * Widget function.
  *
  * @see WP_Widget
  * @access public
  * @param array $args
  * @param array $instance
  * @return void
  */
 function widget($args, $instance)
 {
     if ($this->get_cached_widget($args)) {
         return;
     }
     ob_start();
     extract($args);
     $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     $count = $instance['count'];
     $category = $instance['category'];
     $posts = wp_get_recent_posts(array('post_type' => 'post', 'numberposts' => $count, 'post_status' => 'publish', 'category' => $category), OBJECT);
     global $post;
     echo $before_widget;
     echo '<section class="recent-posts-grid" data-layout="2-2-2-2">';
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     foreach ($posts as $post) {
         setup_postdata($post);
         add_filter('stag_showing_related_posts', '__return_true');
         get_template_part('content', get_post_format());
     }
     echo '</section>';
     wp_reset_postdata();
     remove_all_filters('stag_showing_related_posts');
     echo $after_widget;
     $content = ob_get_clean();
     echo $content;
     $this->cache_widget($args, $content);
 }
 public function test_register()
 {
     //make sure nobody else interfers with this test
     $this->_stop_pretending_addon_hook_time();
     remove_all_filters('FHEE__EE_Data_Migration_Manager__get_data_migration_script_folders');
     $pretend_addon_name = 'More_Core';
     $args = array('dms_paths' => array(EE_TESTS_DIR . 'mocks/core/data_migration_scripts'));
     //try registering at wrong time
     try {
         EE_Register_Data_Migration_Scripts::register($pretend_addon_name, $args);
         $this->fail('We should have had a warning saying that we are setting up the ee addon at the wrong time');
     } catch (PHPUnit_Framework_Error_Notice $e) {
         $this->assertTrue(True);
     }
     //and check we didn't actually register the DMSs (because we attempted to do so at teh wrong time)
     $DMSs_available = EE_Data_Migration_Manager::reset()->get_all_data_migration_scripts_available();
     $this->assertArrayNotHasKey('EE_DMS_Core_1_0_0', $DMSs_available);
     //ok now pretend we're registering the DMS at the right time
     $this->_pretend_addon_hook_time();
     EE_Register_Data_Migration_Scripts::register($pretend_addon_name, $args);
     $DMSs_available = EE_Data_Migration_Manager::reset()->get_all_data_migration_scripts_available();
     $this->assertArrayHasKey('EE_DMS_Core_1_0_0', $DMSs_available);
     //now deregister it
     EE_Register_Data_Migration_Scripts::deregister($pretend_addon_name);
     $DMSs_available = EE_Data_Migration_Manager::reset()->get_all_data_migration_scripts_available();
     $this->assertArrayNotHasKey('EE_DMS_Core_1_0_0', $DMSs_available);
     $this->_stop_pretending_addon_hook_time();
 }
示例#6
0
 /**
  * Срабатывает на событие Init.
  * метод приватный, публичный доступ оставлен для корректной работы user_function_call
  */
 public function _initHooks()
 {
     remove_all_filters('woocommerce_cart_link');
     //удаляем ссылку на корзину
     remove_all_filters('woo_nav_after');
     //удаляем сам блок корзины
     remove_all_filters('woocommerce_simple_add_to_cart');
     remove_action('woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30);
     /**
      * удаляем станицу корзины из базы
      */
     $cart_id = woocommerce_get_page_id('cart');
     if ($cart_id) {
         wp_delete_post($cart_id);
     }
     /**
      * Меняем работу ссылки добавления в корзину. Теперь она переадресовывает на партнёрку.
      */
     add_action('woocommerce_simple_add_to_cart', array($this, 'hook_change_link'), 1, 2);
     add_filter('woocommerce_loop_add_to_cart_link', array($this, 'hook_change_link'), 1, 2);
     /**
      * Подгружаем изображение из мета-поля поста
      */
     add_filter('woocommerce_single_product_image_html', array($this, 'hook_woocommerce_single_product_image_html'), 1, 2);
     add_action('woocommerce_placeholder_img', array($this, 'hook_woocommerce_placeholder_img'), 11, 1);
 }
示例#7
0
 public function tearDown()
 {
     parent::tearDown();
     remove_all_filters('bbpnns_dry_run');
     remove_all_filters('bbpnns_skip_reply_notification');
     remove_all_filters('bbpnns_skip_topic_notification');
 }
示例#8
0
 /**
  * @group canonical
  * @covers ::bbp_insert_topic
  */
 public function test_bbp_insert_topic()
 {
     $f = $this->factory->forum->create();
     $now = time();
     $post_date = date('Y-m-d H:i:s', $now - 60 * 60 * 100);
     $t = $this->factory->topic->create(array('post_title' => 'Topic 1', 'post_content' => 'Content for Topic 1', 'post_parent' => $f, 'post_date' => $post_date, 'topic_meta' => array('forum_id' => $f)));
     $r = $this->factory->reply->create(array('post_parent' => $t, 'post_date' => $post_date, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     // Get the topic.
     $topic = bbp_get_topic($t);
     remove_all_filters('bbp_get_topic_content');
     // Topic post.
     $this->assertSame('Topic 1', bbp_get_topic_title($t));
     $this->assertSame('Content for Topic 1', bbp_get_topic_content($t));
     $this->assertSame('publish', bbp_get_topic_status($t));
     $this->assertSame($f, wp_get_post_parent_id($t));
     $this->assertEquals('http://' . WP_TESTS_DOMAIN . '/?topic=' . $topic->post_name, $topic->guid);
     // Topic meta.
     $this->assertSame($f, bbp_get_topic_forum_id($t));
     $this->assertSame(1, bbp_get_topic_reply_count($t, true));
     $this->assertSame(0, bbp_get_topic_reply_count_hidden($t, true));
     $this->assertSame(1, bbp_get_topic_voice_count($t, true));
     $this->assertSame($r, bbp_get_topic_last_reply_id($t));
     $this->assertSame($r, bbp_get_topic_last_active_id($t));
     $this->assertSame('4 days, 4 hours ago', bbp_get_topic_last_active_time($t));
 }
示例#9
0
function converio_image_slider($atts, $content = '')
{
    if (isset($atts) && !empty($atts)) {
        array_walk($atts, 'converio_arrangement_shortcode_arr_value');
    }
    extract(shortcode_atts(array('type' => '', 'translate_next' => '', 'translate_previous' => ''), $atts));
    remove_all_filters('converio_filters_image_slider', 10);
    if ($type == '2') {
        add_filter('converio_filters_image_slider', 'converio_filter_image_slider_two', 10);
        $output = '<div class="slider-image">';
        $output .= '<div class="container">';
        $output .= '<p class="number"><span></span>/<b></b></p>';
        $output .= '<ul id="slides">';
        $output .= '<a class="slidesjs-previous slidesjs-navigation" href="#" title="Previous">' . $translate_next . '</a> <a class="slidesjs-next slidesjs-navigation" href="#" title="Next">' . $translate_previous . '</a>';
        $output .= do_shortcode($content);
        $output .= '</ul>';
        $output .= '</div>';
        $output .= '</div>';
    } else {
        add_filter('converio_filters_image_slider', 'converio_filter_image_slider_one', 10);
        $output = '<section class="slider3">';
        $output .= '<div class="slider">';
        $output .= do_shortcode($content);
        $output .= '</div>';
        $output .= '</section>';
    }
    return $output;
}
示例#10
0
 /**
  * Test /settings without valid permissions/creds.
  *
  * @since 2.7.0
  * @covers WC_Rest_Settings_Controller::get_items
  */
 public function test_get_groups_none_registered()
 {
     wp_set_current_user($this->user);
     remove_all_filters('woocommerce_settings_groups');
     $response = $this->server->dispatch(new WP_REST_Request('GET', '/wc/v1/settings'));
     $this->assertEquals(500, $response->get_status());
     WC_Helper_Settings::register();
 }
示例#11
0
function ac_user_bio_save_filters()
{
    // Contributor level user or higher required
    if (!current_user_can('edit_posts')) {
        return;
    }
    remove_all_filters('pre_user_description');
}
示例#12
0
function wprcd_admin_init()
{
    if (!is_admin() || basename($_SERVER['PHP_SELF']) != 'edit-tags.php' || $_REQUEST['taxonomy'] != 'category') {
        return;
    }
    remove_all_filters('pre_term_description');
    WP_Rich_Category_Description::init();
}
示例#13
0
function converio_team_slider($atts, $content)
{
    add_filter('converio_filters_columns_class', 'converio_filter_team_slider_class', 10);
    add_filter('converio_filters_team_member', 'converio_filter_team_slider_member', 10);
    $output = '<div class="slider-box"><div>' . do_shortcode($content) . '</div></div>';
    remove_all_filters('converio_filters_team_member');
    return $output;
}
 public function tearDown()
 {
     parent::tearDown();
     // Remove filters after running tests
     remove_all_filters('wp_mail');
     remove_all_filters('grunion_still_email_spam');
     remove_all_filters('jetpack_contact_form_is_spam');
 }
示例#15
0
 function setUp()
 {
     parent::setUp();
     remove_all_filters('session_token_manager');
     $user_id = $this->factory->user->create();
     $this->manager = WP_Session_Tokens::get_instance($user_id);
     $this->assertInstanceOf('WP_Session_Tokens', $this->manager);
     $this->assertInstanceOf('WP_User_Meta_Session_Tokens', $this->manager);
 }
示例#16
0
 /**
  * @inheritDoc
  */
 function setUp()
 {
     parent::setUp();
     /* Remove temporary tables which causes problems with GF */
     remove_all_filters('query', 10);
     /* Ensure the database is correctly set up */
     @GFForms::setup_database();
     $this->factory = new GF_UnitTest_Factory($this);
 }
 function cornerstone_search_form_no_filters()
 {
     // look for local searchform template
     $search_form_template = locate_template('searchform.php');
     if ('' !== $search_form_template) {
         // searchform.php exists, remove all filters
         remove_all_filters('get_search_form');
     }
 }
示例#18
0
 function testWPTitleSingle()
 {
     //since we're testing with twentyfourteen -- need to remove its filters on wp_title
     remove_all_filters('wp_title');
     $post_id = $this->factory->post->create(array('post_title' => 'My New Post'));
     $post = get_post($post_id);
     $this->go_to(site_url('?p=' . $post_id));
     $this->assertEquals('My New Post', TimberHelper::get_wp_title());
 }
 /**
  * Simulate going to an iThemes Exchange custom page.
  *
  * @since 1.0
  *
  * @param string $exchange_page
  */
 public function go_to_exchange_page($exchange_page)
 {
     remove_all_filters('it_exchange_is_page');
     add_filter('it_exchange_is_page', function ($result, $page) use($exchange_page) {
         if ($page == $exchange_page) {
             $result = true;
         }
         return $result;
     }, 10, 2);
 }
示例#20
0
function converio_price($atts, $content = '')
{
    remove_all_filters('converio_filters_price_class');
    $output_content = do_shortcode($content);
    $output = '<p class="price' . apply_filters('converio_filters_price_class', '');
    $output .= '">';
    $output .= $output_content;
    $output .= '</p>';
    return $output;
}
 function initialise_plugin()
 {
     add_action('ultimatebranding_settings_menu_footer', array(&$this, 'output_admin_options'));
     add_filter('ultimatebranding_settings_menu_footer_process', array(&$this, 'update_admin_options'), 10, 1);
     // remove all the remaining filters for the admin footer so that they don't mess the footer up
     remove_all_filters('admin_footer_text');
     add_filter('admin_footer_text', array(&$this, 'output'), 1, 1);
     add_filter('update_footer', array(&$this, 'blank_version'), 99);
     add_action('in_admin_footer', array(&$this, 'stuff'));
 }
示例#22
0
 function add_custom_wp_hooks()
 {
     if (!MY_ISADMIN) {
         add_shortcode('antispambot', array($this, 'antispambot_shortcode'));
         // TODO shortcode for permalinking
     } else {
         remove_all_filters('theme_root');
         // #hack some crazy #bug
     }
 }
示例#23
0
/**
 * Added frontend builder assets.
 * Note: loading assets on head is way too early, computedVars returns undefined on header.
 *
 * @return void
 */
function et_fb_wp_footer()
{
    et_fb_enqueue_assets();
    // TODO: this is specific to Audio Module and we should conditionally call it once we have
    // $content set as an object, we can then to a check whether the audio module is
    // present.
    remove_all_filters('wp_audio_shortcode_library');
    remove_all_filters('wp_audio_shortcode');
    remove_all_filters('wp_audio_shortcode_class');
}
示例#24
0
 public function load_page()
 {
     remove_all_filters('pre_option_' . GENESIS_SEO_SETTINGS_FIELD);
     $message = isset($_POST['options_update']) ? $this->copy_meta() : '';
     $callback_params = array('message' => $message);
     $this->add_meta_box('yoast-intro', 'Introduction', 'intro_panel', $callback_params);
     $this->add_meta_box('yoast-copy', 'Copy SEO Data', 'copy_panel', $callback_params);
     $this->add_meta_box('news', 'Genesis Club News', 'news_panel', $callback_params, 'advanced');
     $this->set_tooltips($this->tips);
 }
示例#25
0
 /**
  * Checks to see if adding tokens via the 
  * filter is functional.
  *  
  * @since 2.0
  */
 public function testTokenAddViaFilter()
 {
     add_filter("wpsqt_replacement_tokens", array($this, "filter_test"));
     $objTokens = new Wpsqt_Tokens();
     $objTokens->addToken("name", "My name", "Iain Cambridge")->addToken("email", "My email address", "*****@*****.**");
     $this->assertEquals("Iain Cambridge-backie@backie.org-Fubra Limited", $objTokens->doReplacement("%name%-%email%-%work%"), "The replacement doesn't match what it should be");
     $this->assertEquals("Iain Cambridge-backie@backie.org-Fubra Limited", $objTokens->doReplacement("%NAME%-%email%-%work%"), "The replacement doesn't match what it should be");
     $this->assertEquals("Iain Cambridge-%email-Fubra Limited", $objTokens->doReplacement("%name%-%email-%work%"), "The replacement doesn't match what it should be");
     remove_all_filters("wpsqt_replacement_tokens");
 }
 function justified_infinite_scroll_set_filter($tag, $saved)
 {
     # Sets the given WordPress filter to a state saved by get_filter.
     remove_all_filters($tag);
     foreach ($saved as $priority => $func_list) {
         foreach ($func_list as $func_name => $func_args) {
             add_filter($tag, $func_args['function'], $priority, $func_args['accepted_args']);
         }
     }
 }
示例#27
0
 /**
  * Load GravityView
  *
  * @since 1.9
  */
 public function load()
 {
     require_once $this->plugin_dir . '/tmp/gravityforms/gravityforms.php';
     $this->load_rest_api();
     require_once $this->plugin_dir . '/gravityview.php';
     /* Remove temporary tables which causes problems with GF */
     remove_all_filters('query', 10);
     // set up Gravity Forms database
     @GFForms::setup(true);
     $this->create_stubs();
 }
function sfput_sanitize_settings_and_cache($settings = array())
{
    static $done = false;
    if (!$done || apply_filters('sfput_options_clear_options_cache', false)) {
        $settings = sfput_sanitize_settings($settings);
        wp_cache_set('sfput_options', maybe_serialize($settings), 'options');
        $done = true;
        remove_all_filters('sfput_options_clear_options_cache');
    }
    return $settings;
}
 /**
  * Removes all other ``login_redirect`` Filters to prevent conflicts with s2Member.
  *
  * @attaches-to ``add_action('init');``
  *
  * @package s2Member\Login_Redirects
  * @since 3.5
  */
 public static function remove_login_redirect_filters()
 {
     do_action('ws_plugin__s2member_before_remove_login_redirect_filters', get_defined_vars());
     if (!apply_filters('ws_plugin__s2member_allow_other_login_redirect_filters', false, get_defined_vars())) {
         remove_all_filters('login_redirect');
         // Remove all others.
         do_action('ws_plugin__s2member_during_remove_login_redirect_filters', get_defined_vars());
     }
     add_filter('login_redirect', 'c_ws_plugin__s2member_login_redirects_r::_empty_login_redirect_filter');
     add_filter('login_redirect', 'c_ws_plugin__s2member_login_redirects_r::_http_login_redirect_filter');
     do_action('ws_plugin__s2member_after_remove_login_redirect_filters', get_defined_vars());
 }
示例#30
0
 /**
  * The main import process
  */
 private function process()
 {
     remove_all_filters('wp_get_nav_menu_items');
     $locations = array();
     foreach ($this->menus as $menu) {
         $this->processMenu($menu);
         foreach ($menu->locations as $location) {
             $locations[$location] = $menu->id;
         }
     }
     set_theme_mod('nav_menu_locations', $locations);
 }