当前位置: 首页>>代码示例>>PHP>>正文


PHP remove_filter函数代码示例

本文整理汇总了PHP中remove_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP remove_filter函数的具体用法?PHP remove_filter怎么用?PHP remove_filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了remove_filter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send_form_feedback

function send_form_feedback()
{
    if ($_POST) {
        // Set wp_mail html content type
        add_filter('wp_mail_content_type', 'set_html_content_type');
        $name = isset($_POST['name']) ? $_POST['name'] : '';
        $email = isset($_POST['email']) ? $_POST['email'] : '';
        $phone = isset($_POST['phone']) ? $_POST['phone'] : '';
        $message = isset($_POST['message']) ? $_POST['message'] : '';
        $to = get_option('admin_email');
        $subject = 'Новое сообщение';
        $content = '<p><b>Имя:</b> ' . $name . '</p>';
        $content .= '<p><b>E-mail:</b> ' . $email . '</p>';
        $content .= '<p><b>Телефон:</b> ' . $phone . '</p>';
        $content .= '<p><b>Сообщение:</b></p>';
        $content .= '<p>' . $message . '</p>';
        $content .= '<br /><br />';
        $content .= 'Это сообщение отправлено с сайта <a href="' . get_site_url() . '">' . get_site_url() . '</a>';
        if (wp_mail($to, $subject, $content)) {
            $json = array('status' => 'success', 'message' => '<b>Поздравляем!</b><br />Сообщение успешно отправлено');
        } else {
            $json = array('status' => 'error', 'message' => '<b>Ошибка!</b><br />Попробуйте позже или свяжитесь с администрацией сайта');
        }
        // Reset wp_mail html content type
        remove_filter('wp_mail_content_type', 'set_html_content_type');
        die(json_encode($json));
    }
    die(json_encode(array('status' => 'error', 'message' => '<b>Что-то пошло не так!</b><br />Попробуйте позже или свяжитесь с администрацией сайта')));
}
开发者ID:antarx,项目名称:wp-blank,代码行数:29,代码来源:functions.php

示例2: init_hooks

 /**
  * Initializes WordPress hooks
  */
 private static function init_hooks()
 {
     self::$initiated = true;
     add_action('wp_insert_comment', array('Akismet', 'auto_check_update_meta'), 10, 2);
     add_action('preprocess_comment', array('Akismet', 'auto_check_comment'), 1);
     add_action('akismet_scheduled_delete', array('Akismet', 'delete_old_comments'));
     add_action('akismet_scheduled_delete', array('Akismet', 'delete_old_comments_meta'));
     add_action('akismet_schedule_cron_recheck', array('Akismet', 'cron_recheck'));
     $akismet_comment_nonce_option = apply_filters('akismet_comment_nonce', get_option('akismet_comment_nonce'));
     if ($akismet_comment_nonce_option == 'true' || $akismet_comment_nonce_option == '') {
         add_action('comment_form', array('Akismet', 'add_comment_nonce'), 1);
     }
     add_action('admin_head-edit-comments.php', array('Akismet', 'load_form_js'));
     add_action('comment_form', array('Akismet', 'load_form_js'));
     add_action('comment_form', array('Akismet', 'inject_ak_js'));
     add_filter('comment_moderation_recipients', array('Akismet', 'disable_moderation_emails_if_unreachable'), 1000, 2);
     add_filter('pre_comment_approved', array('Akismet', 'last_comment_status'), 10, 2);
     add_action('transition_comment_status', array('Akismet', 'transition_comment_status'), 10, 3);
     if ('3.0.5' == $GLOBALS['wp_version']) {
         remove_filter('comment_text', 'wp_kses_data');
         if (is_admin()) {
             add_filter('comment_text', 'wp_kses_post');
         }
     }
 }
开发者ID:uwitec,项目名称:findgreatmaster,代码行数:28,代码来源:class.akismet.php

示例3: get_users

 /**
  * Ajax callback function to search users that is used on exclude setting page
  *
  * @uses WP_User_Query WordPress User Query class.
  * @return void
  */
 public static function get_users()
 {
     if (!defined('DOING_AJAX') || !current_user_can(WP_Stream_Admin::SETTINGS_CAP)) {
         return;
     }
     check_ajax_referer('stream_get_users', 'nonce');
     $response = (object) array('status' => false, 'message' => esc_html__('There was an error in the request', 'stream'));
     $search = isset($_POST['find']) ? wp_unslash(trim($_POST['find'])) : '';
     $request = (object) array('find' => $search);
     add_filter('user_search_columns', array(__CLASS__, 'add_display_name_search_columns'), 10, 3);
     $users = new WP_User_Query(array('search' => "*{$request->find}*", 'search_columns' => array('user_login', 'user_nicename', 'user_email', 'user_url'), 'orderby' => 'display_name', 'number' => WP_Stream_Admin::PRELOAD_AUTHORS_MAX));
     remove_filter('user_search_columns', array(__CLASS__, 'add_display_name_search_columns'), 10);
     if (0 === $users->get_total()) {
         wp_send_json_error($response);
     }
     $response->status = true;
     $response->message = '';
     $response->users = array();
     require_once WP_STREAM_INC_DIR . 'class-wp-stream-author.php';
     foreach ($users->results as $key => $user) {
         $author = new WP_Stream_Author($user->ID);
         $args = array('id' => $author->ID, 'text' => $author->display_name);
         $args['tooltip'] = esc_attr(sprintf(__("ID: %d\nUser: %s\nEmail: %s\nRole: %s", 'stream'), $author->id, $author->user_login, $author->user_email, ucwords($author->get_role())));
         $args['icon'] = $author->get_avatar_src(32);
         $response->users[] = $args;
     }
     if (empty($search) || preg_match('/wp|cli|system|unknown/i', $search)) {
         $author = new WP_Stream_Author(0);
         $response->users[] = array('id' => $author->id, 'text' => $author->get_display_name(), 'icon' => $author->get_avatar_src(32), 'tooltip' => esc_html__('Actions performed by the system when a user is not logged in (e.g. auto site upgrader, or invoking WP-CLI without --user)', 'stream'));
     }
     wp_send_json_success($response);
 }
开发者ID:xwp,项目名称:stream-legacy,代码行数:38,代码来源:settings.php

示例4: stop

 function stop()
 {
     $item = array_pop($this->stack);
     $time = $this->microtime($item['start']);
     $name = $item['name'];
     global $wpdb;
     $item['queries'] = $wpdb->queries;
     global $wp_object_cache;
     $cache_dirty_count = $this->_dirty_objects_count($wp_object_cache->dirty_objects);
     $cache_dirty_delta = $this->array_sub($cache_dirty_count, $item['cache_dirty_objects']);
     if (isset($this->profile[$name])) {
         $this->profile[$name]['time'] += $time;
         $this->profile[$name]['calls']++;
         $this->profile[$name]['cache_cold_hits'] += $wp_object_cache->cold_cache_hits - $item['cache_cold_hits'];
         $this->profile[$name]['cache_warm_hits'] += $wp_object_cache->warm_cache_hits - $item['cache_warm_hits'];
         $this->profile[$name]['cache_misses'] += $wp_object_cache->cache_misses - $item['cache_misses'];
         $this->profile[$name]['cache_dirty_objects'] = array_add($this->profile[$name]['cache_dirty_objects'], $cache_dirty_delta);
         $this->profile[$name]['actions'] = array_add($this->profile[$name]['actions'], $item['actions']);
         $this->profile[$name]['filters'] = array_add($this->profile[$name]['filters'], $item['filters']);
         $this->profile[$name]['queries'] = array_add($this->profile[$name]['queries'], $item['queries']);
         #$this->_query_summary($item['queries'], $this->profile[$name]['queries']);
     } else {
         $queries = array();
         $this->_query_summary($item['queries'], $queries);
         $this->profile[$name] = array('time' => $time, 'calls' => 1, 'cache_cold_hits' => $wp_object_cache->cold_cache_hits - $item['cache_cold_hits'], 'cache_warm_hits' => $wp_object_cache->warm_cache_hits - $item['cache_warm_hits'], 'cache_misses' => $wp_object_cache->cache_misses - $item['cache_misses'], 'cache_dirty_objects' => $cache_dirty_delta, 'actions' => $item['actions'], 'filters' => $item['filters'], 'queries' => $queries);
     }
     if (!$this->stack) {
         remove_filter('all', array($this, 'log_filter'));
     }
 }
开发者ID:boonebgorges,项目名称:wp,代码行数:30,代码来源:wp-profiler.php

示例5: widget

 /**
  * Display the widget on the frontend.
  * @since  1.0.0
  * @param  array $args     Widget arguments.
  * @param  array $instance Widget settings for this instance.
  * @return void
  */
 public function widget($args, $instance)
 {
     remove_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
     if (in_array($instance['component'], array_keys($this->woo_widget_componentslist)) && ('activecourses' == $instance['component'] || 'completedcourses' == $instance['component']) && !is_user_logged_in()) {
         // No Output
         return;
     } else {
         /* Our variables from the widget settings. */
         $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
         /* Before widget (defined by themes). */
         echo $args['before_widget'];
         /* Display the widget title if one was input (before and after defined by themes). */
         if ($title) {
             echo $args['before_title'] . $title . $args['after_title'];
         }
         /* Widget content. */
         // Add actions for plugins/themes to hook onto.
         do_action($this->woo_widget_cssclass . '_top');
         if (in_array($instance['component'], array_keys($this->woo_widget_componentslist))) {
             $this->load_component($instance);
         }
         // Add actions for plugins/themes to hook onto.
         do_action($this->woo_widget_cssclass . '_bottom');
         /* After widget (defined by themes). */
         echo $args['after_widget'];
     }
     // End If Statement
     add_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
 }
开发者ID:bramburn,项目名称:sensei,代码行数:36,代码来源:widget-woothemes-sensei-course-component.php

示例6: process_after

 function process_after($code, $target)
 {
     global $wp_query;
     $wp_query->is_404 = true;
     // Page comments plugin interferes with this
     remove_filter('template_redirect', 'paged_comments_alter_source', 12);
 }
开发者ID:developmentDM2,项目名称:The-Haute-Mess,代码行数:7,代码来源:error.php

示例7: filter_tribe_events_rewrite_i18n_slugs_raw

 /**
  * Filters the bases used to generate TEC rewrite rules to use WPML managed translations.
  *
  * @param array  $bases
  * @param string $method
  * @param array  $domains
  *
  * @return array An array of bases each with its (optional) WPML managed translations set.
  */
 public function filter_tribe_events_rewrite_i18n_slugs_raw($bases, $method, $domains)
 {
     /** @var SitePress $sitepress */
     global $sitepress, $sitepress_settings;
     if (empty($sitepress) || !is_a($sitepress, 'SitePress')) {
         return $bases;
     }
     $tec = Tribe__Events__Main::instance();
     // Grab all languages
     $langs = $sitepress->get_active_languages();
     if (empty($langs)) {
         return $bases;
     }
     foreach ($langs as $lang) {
         $languages[] = $sitepress->get_locale($lang['code']);
     }
     // Prevent Duplicates and Empty langs
     $languages = array_filter(array_unique($languages));
     // Query the Current Language
     $current_locale = $sitepress->get_locale($sitepress->get_current_language());
     // Get the strings on multiple Domains and Languages
     // remove WPML filter to avoid the locale being set to the default one
     remove_filter('locale', array($sitepress, 'locale_filter'));
     $bases = $tec->get_i18n_strings($bases, $languages, $domains, $current_locale);
     // re-hook WPML filter
     add_filter('locale', array($sitepress, 'locale_filter'));
     $string_translation_active = function_exists('wpml_st_load_slug_translation');
     $post_slug_translation_on = !empty($sitepress_settings['posts_slug_translation']['on']);
     if ($string_translation_active && $post_slug_translation_on) {
         $bases = $this->translate_single_slugs($bases);
     }
     return $bases;
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:42,代码来源:Filters.php

示例8: tearDown

 function tearDown()
 {
     remove_filter('extra_theme_headers', array($this, '_theme_data_extra_headers'));
     wp_clean_themes_cache();
     unset($GLOBALS['wp_themes']);
     parent::tearDown();
 }
开发者ID:Benrajalu,项目名称:philRaj,代码行数:7,代码来源:theme.php

示例9: tearDown

 /**
  * Clean up after each test. Reset our mocks
  *
  * @since 2.1
  * @group search
  */
 public function tearDown()
 {
     parent::tearDown();
     //make sure no one attached to this
     remove_filter('ep_sync_terms_allow_hierarchy', array($this, 'ep_allow_multiple_level_terms_sync'), 100);
     $this->fired_actions = array();
 }
开发者ID:10up,项目名称:elasticpress,代码行数:13,代码来源:test-search.php

示例10: jetpack_amp_disable_the_content_filters

function jetpack_amp_disable_the_content_filters($post_id)
{
    add_filter('post_flair_disable', '__return_true', 99);
    remove_filter('the_title', 'widont');
    remove_filter('pre_kses', array('Filter_Embedded_HTML_Objects', 'filter'), 11);
    remove_filter('pre_kses', array('Filter_Embedded_HTML_Objects', 'maybe_create_links'), 100);
}
开发者ID:hrkhal,项目名称:amp-wp,代码行数:7,代码来源:wpcom-helper.php

示例11: match_existing_post

 protected function match_existing_post(array $record)
 {
     $start_date = $this->get_event_start_date($record);
     $end_date = $this->get_event_end_date($record);
     $all_day = $this->get_boolean_value_by_key($record, 'event_all_day');
     // Base query - only the meta query will be different
     $query_args = array('post_type' => Tribe__Events__Main::POSTTYPE, 'post_title' => $this->get_value_by_key($record, 'event_name'), 'fields' => 'ids', 'posts_per_page' => 1);
     // When trying to find matches for all day events, the comparison should only be against the date
     // component only since a) the time is irrelevant and b) the time may have been adjusted to match
     // the eod cutoff setting
     if (Tribe__Events__Date_Utils::is_all_day($all_day)) {
         $meta_query = array(array('key' => '_EventStartDate', 'value' => $this->get_event_start_date($record, true), 'compare' => 'LIKE'), array('key' => '_EventAllDay', 'value' => 'yes'));
         // For regular, non-all day events, use the full date *and* time in the start date comparison
     } else {
         $meta_query = array(array('key' => '_EventStartDate', 'value' => $start_date));
     }
     // Optionally use the end date/time for matching, where available
     if (!empty($end_date) && !$all_day) {
         $meta_query[] = array('key' => '_EventEndDate', 'value' => $end_date);
     }
     $query_args['meta_query'] = $meta_query;
     add_filter('posts_search', array($this, 'filter_query_for_title_search'), 10, 2);
     $matches = get_posts($query_args);
     remove_filter('posts_search', array($this, 'filter_query_for_title_search'), 10, 2);
     if (empty($matches)) {
         return 0;
     }
     return reset($matches);
 }
开发者ID:hubbardsc,项目名称:field_day,代码行数:29,代码来源:File_Importer_Events.php

示例12: __set

 /**
  * Sets the legacy public variables for backwards compatibility.
  *
  * @param string $key
  * @param mixed $value
  */
 public function __set($key, $value)
 {
     switch ($key) {
         case 'enable_signup':
             $bool_value = wc_string_to_bool($value);
             if ($bool_value !== $this->is_registration_enabled()) {
                 remove_filter('woocommerce_checkout_registration_enabled', '__return_true', 0);
                 remove_filter('woocommerce_checkout_registration_enabled', '__return_false', 0);
                 add_filter('woocommerce_checkout_registration_enabled', $bool_value ? '__return_true' : '__return_false', 0);
             }
             break;
         case 'enable_guest_checkout':
             $bool_value = wc_string_to_bool($value);
             if ($bool_value !== $this->is_registration_required()) {
                 remove_filter('woocommerce_checkout_registration_required', '__return_true', 0);
                 remove_filter('woocommerce_checkout_registration_required', '__return_false', 0);
                 add_filter('woocommerce_checkout_registration_required', $bool_value ? '__return_false' : '__return_true', 0);
             }
             break;
         case 'checkout_fields':
             $this->fields = $value;
             break;
         case 'shipping_methods':
             WC()->session->set('chosen_shipping_methods', $value);
             break;
         case 'legacy_posted_data':
             $this->legacy_posted_data = $value;
             break;
     }
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:36,代码来源:class-wc-checkout.php

示例13: tear_down

 /**
  * Tear down the hooks, url filtering etc for S3 Uploads
  */
 public function tear_down()
 {
     stream_wrapper_unregister('s3');
     remove_filter('upload_dir', array($this, 'filter_upload_dir'));
     remove_filter('wp_image_editors', array($this, 'filter_editors'), 9);
     remove_filter('wp_handle_sideload_prefilter', array($this, 'filter_sideload_move_temp_file_to_s3'));
 }
开发者ID:bdurette,项目名称:S3-Uploads,代码行数:10,代码来源:class-s3-uploads.php

示例14: cfct_about_text

function cfct_about_text()
{
    $about_text = get_option('cfct_about_text');
    if (!empty($about_text)) {
        $about_text = cfct_basic_content_formatting($about_text);
    } else {
        global $post, $wp_query;
        $orig_post = $post;
        isset($wp_query->query_vars['page']) ? $page = $wp_query->query_vars['page'] : ($page = null);
        // temporary - resetting below
        $wp_query->query_vars['page'] = null;
        remove_filter('the_excerpt', 'st_add_widget');
        $about_query = new WP_Query('pagename=about');
        while ($about_query->have_posts()) {
            $about_query->the_post();
            $about_text = get_the_excerpt() . sprintf(__('<a class="more" href="%s">more &rarr;</a>', 'carrington'), get_permalink());
        }
        $wp_query->query_vars['page'] = $page;
        $post = $orig_post;
        setup_postdata($post);
    }
    if (function_exists('st_add_widget')) {
        add_filter('the_excerpt', 'st_add_widget');
    }
    return $about_text;
}
开发者ID:Linuxwang,项目名称:PIE,代码行数:26,代码来源:carrington.php

示例15: et_setup_theme

 function et_setup_theme()
 {
     global $themename, $shortname, $et_store_options_in_one_row, $default_colorscheme;
     $themename = 'Fusion';
     $shortname = 'fusion';
     $et_store_options_in_one_row = true;
     $default_colorscheme = "Default";
     $template_directory = get_template_directory();
     require_once $template_directory . '/epanel/custom_functions.php';
     require_once $template_directory . '/includes/functions/comments.php';
     require_once $template_directory . '/includes/functions/sidebars.php';
     load_theme_textdomain('Fusion', $template_directory . '/lang');
     require_once $template_directory . '/epanel/core_functions.php';
     require_once $template_directory . '/epanel/post_thumbnails_fusion.php';
     include $template_directory . '/includes/widgets.php';
     register_nav_menus(array('primary-menu' => __('Primary Menu', 'Fusion'), 'footer-menu' => __('Footer Menu', 'Fusion')));
     add_action('init', 'et_fusion_register_posttype', 0);
     add_action('wp_enqueue_scripts', 'et_fusion_load_scripts_styles');
     add_action('wp_head', 'et_add_viewport_meta');
     add_action('pre_get_posts', 'et_home_posts_query');
     add_action('et_epanel_changing_options', 'et_delete_featured_ids_cache');
     add_action('delete_post', 'et_delete_featured_ids_cache');
     add_action('save_post', 'et_delete_featured_ids_cache');
     add_filter('wp_page_menu_args', 'et_add_home_link');
     add_filter('et_get_additional_color_scheme', 'et_remove_additional_stylesheet');
     add_action('wp_head', 'et_attach_bg_images');
     add_action('et_header_menu', 'et_add_mobile_navigation');
     add_action('wp_enqueue_scripts', 'et_add_responsive_shortcodes_css', 11);
     // don't display the empty title bar if the widget title is not set
     remove_filter('widget_title', 'et_widget_force_title');
     add_filter('body_class', 'et_add_standard_homepage_class');
 }
开发者ID:iinspiration,项目名称:theme,代码行数:32,代码来源:functions.php


注:本文中的remove_filter函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。