Example #1
1
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 />Попробуйте позже или свяжитесь с администрацией сайта')));
}
Example #2
0
 /**
  * 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');
         }
     }
 }
Example #3
0
 /**
  * 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);
 }
Example #4
0
 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'));
     }
 }
 /**
  * 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);
 }
Example #6
0
 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);
 }
 /**
  * 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;
 }
Example #8
0
 function tearDown()
 {
     remove_filter('extra_theme_headers', array($this, '_theme_data_extra_headers'));
     wp_clean_themes_cache();
     unset($GLOBALS['wp_themes']);
     parent::tearDown();
 }
Example #9
0
 /**
  * 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();
 }
Example #10
0
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);
}
 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);
 }
 /**
  * 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;
     }
 }
Example #13
0
 /**
  * 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'));
 }
Example #14
0
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;
}
Example #15
0
 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');
 }
Example #16
0
 function tearDown()
 {
     foreach (array('curl', 'streams', 'fsockopen') as $t) {
         remove_filter("use_{$t}_transport", '__return_false');
     }
     parent::tearDown();
 }
 function __construct()
 {
     global $wp_version;
     //check WP version to include customizer functions, must be >= 3.4
     if (version_compare($wp_version, '3.4', '>=')) {
         //require_once( TC_BASE.'inc/admin/tc_customize.php' );
         tc__('admin', 'customize');
     } else {
         //redirect to an upgrade message page on activation if version < 3.4
         add_action('admin_menu', array($this, 'tc_add_fallback_page'));
         add_action('admin_init', array($this, 'tc_theme_activation_fallback'));
     }
     //load the meta boxes
     add_action('admin_init', array($this, 'tc_load_meta_boxes'));
     //add welcome page in menu
     add_action('admin_menu', array($this, 'tc_add_welcome_page'));
     //Redirect on activation (first activation only)
     add_action('admin_init', array($this, 'tc_theme_activation'));
     //enqueue additional styling for admin screens
     add_action('admin_init', array($this, 'tc_admin_style'));
     add_filter('upgrader_post_install', array($this, 'tc_redirect_after_update'), 1000);
     remove_filter('upgrader_post_install', array($this, 'tc_redirect_after_update'), 1100);
     //changelog
     add_action('changelog', array($this, 'tc_extract_changelog'));
 }
Example #18
0
    public static function front_main($data)
    {
        $data->name = __CLASS__;
        ?>
		<div class="<?php 
        echo $data->name;
        ?>
 front-single-module<?php 
        echo video_module::FRONT_SAVE == true ? '-save' : '';
        ?>
">

			<?php 
        if ($data->post_title != '' && parent::display_title_on_front($data)) {
            ?>
				<h2 class="module_title"><?php 
            echo $data->post_title;
            ?>
</h2>
			<?php 
        }
        ?>
			<?php 
        remove_filter('the_content', 'wpautop');
        echo cp_do_attachment_caption($data);
        ?>
		</div>
	<?php 
    }
function wpv_filter_limit_query_post_process_filter($query, $view_settings)
{
    remove_filter('wpv_filter_query_post_process', 'wpv_filter_limit_query_post_process_filter', 10, 2);
    if (!empty($query->posts)) {
        $limit = intval($view_settings['limit']);
        $offset = intval($view_settings['offset']);
        if ($limit == -1) {
            $posts = array_slice($query->posts, $offset);
        } else {
            $posts = array_slice($query->posts, $offset, $limit);
        }
        add_filter('wpv_filter_query', 'wpv_filter_limit_arg_post_in', 10, 2);
        global $wpv_limit_post_in;
        if (!empty($posts)) {
            $wpv_limit_post_in = array();
            foreach ($posts as $key => $post) {
                $wpv_limit_post_in[] = $post->ID;
            }
        } else {
            $wpv_limit_post_in = array(0);
        }
        $query = wpv_filter_get_posts($view_settings['view_id']);
        remove_filter('wpv_filter_query', 'wpv_filter_limit_arg_post_in', 10, 2);
        add_filter('wpv_filter_query', 'wpv_filter_limit_arg', 10, 2);
        return $query;
    }
    add_filter('wpv_filter_query', 'wpv_filter_limit_arg', 10, 2);
    return $query;
}
Example #20
0
function revert_to_default_wp_avatar($img, $params, $item_id)
{
    // we are concerned only with users
    if ($params['object'] != 'user') {
        return $img;
    }
    //check if user has uploaded an avatar
    //if not then revert back to wordpress core get_avatar method
    //remove the filter first, or else it will go in infinite loop
    remove_filter('bp_core_fetch_avatar', 'revert_to_default_wp_avatar', 80, 3);
    if (!userpro_user_has_avatar($item_id)) {
        $width = $params['width'];
        // Set image width
        if (false !== $width) {
            $img_width = $width;
        } elseif ('thumb' == $type) {
            $img_width = bp_core_avatar_thumb_width();
        } else {
            $img_width = bp_core_avatar_full_width();
        }
        $img = get_avatar($item_id, $img_width);
    }
    //add the filter back again
    add_filter('bp_core_fetch_avatar', 'revert_to_default_wp_avatar', 80, 3);
    return $img;
}
 /**
  * Alter the SQL
  * 
  * @global object $wpdb
  * @param string $orderby
  * @return string
  */
 public function modify_query_orderby($orderby)
 {
     global $wpdb;
     $orderby = "( TRIM( LEADING 'A ' FROM TRIM( LEADING 'AN ' FROM TRIM( LEADING 'THE ' FROM UPPER( {$wpdb->posts}.post_title ) ) ) ) )";
     remove_filter('posts_orderby', array($this, 'modify_query_orderby'));
     return $orderby;
 }
Example #22
0
 /**
  * Handler for wpcf7_submit hook.
  *
  * @param \WPCF7_ContactForm $contactform
  */
 public function submitForm($contactform)
 {
     if ($contactform->in_demo_mode()) {
         return;
     }
     $submission = \WPCF7_Submission::get_instance();
     $posted = $submission->get_posted_data();
     $groovehq_copy_email = $contactform->additional_setting("groovehq_copy_email");
     $groovehq_tags = $contactform->additional_setting("groovehq_tags");
     $groovehq_inbox = $contactform->additional_setting("groovehq_inbox");
     if (!$submission || !$posted) {
         return;
     }
     if (!isset($posted['your-email'])) {
         $sender = get_option('admin_email');
     } else {
         $sender = $posted['your-email'];
     }
     $ticket = array('state' => 'pending', 'to' => $sender, 'subject' => sprintf('%s: %s', $contactform->title(), $sender), 'from' => $this->getOption("inbox", "Inbox"), 'note' => true, 'body' => $this->getMessage($posted, $contactform->prop('form')));
     if (!is_null($groovehq_tags)) {
         $ticket = array_merge($ticket, array("tags" => explode(",", $groovehq_tags[0])));
     }
     if (!is_null($groovehq_inbox)) {
         $ticket["from"] = $groovehq_inbox[0];
     }
     if (!is_null($groovehq_copy_email)) {
         add_filter('wp_mail_content_type', array(&$this, "set_html_content_type"));
         wp_mail($groovehq_copy_email[0], $ticket["subject"], $ticket["body"]);
         remove_filter('wp_mail_content_type', array(&$this, "set_html_content_type"));
     }
     $res = $this->postAPI("/tickets", $ticket);
     if ($res && $this->getOption("to_pending", false)) {
         $this->setPendingTicket($res->ticket->number);
     }
 }
 /**
  * We are doing some of the functionality ourselves so reduce the overhead...
  */
 function _removeKnownFilters()
 {
     remove_filter('the_content', 'addthis_social_widget');
     remove_filter('the_content', 'A2A_SHARE_SAVE_to_bottom_of_content', 98);
     remove_filter("gettext", "ws_plugin__s2member_translation_mangler", 10, 3);
     remove_filter('the_content', 'shrsb_position_menu');
 }
function do_widget_area($atts)
{
    global $wp_registered_widgets, $_wp_sidebars_widgets, $wp_registered_sidebars;
    extract(shortcode_atts(array('widget_area' => 'widgets_for_shortcodes', 'class' => 'amr-widget-area', 'widget_area_class' => '', 'widget_classes' => ''), $atts));
    if (empty($wp_registered_sidebars[$widget_area])) {
        echo '<br/>Widget area "' . $widget_area . '" not found. Registered widget areas (sidebars) are: <br/>';
        foreach ($wp_registered_sidebars as $area => $sidebar) {
            echo $area . '<br />';
        }
    }
    if (isset($_REQUEST['do_widget_debug']) and current_user_can('administrator')) {
        var_dump($wp_registered_sidebars);
    }
    /**/
    if ($widget_area_class == 'none') {
        $class = '';
    } else {
        if (!empty($widget_area_class)) {
            //2014 08
            $class .= 'class="' . $class . ' ' . $widget_area_class . '"';
        } else {
            $class = 'class="' . $class . '"';
        }
    }
    if (!empty($widget_classes) and $widget_classes == 'none') {
        add_filter('dynamic_sidebar_params', 'amr_remove_widget_class');
    }
    ob_start();
    /* catch the echo output, so we can control where it appears in the text  */
    dynamic_sidebar($widget_area);
    $output = ob_get_clean();
    remove_filter('dynamic_sidebar_params', 'amr_remove_widget_class');
    $output = PHP_EOL . '<div id="' . $widget_area . '" ' . $class . '>' . $output . '</div>' . PHP_EOL;
    return $output;
}
function post_save_images($content)
{
    if (($_POST['save'] || $_POST['publish']) && ot_get_option('auto_save_image') === "on") {
        set_time_limit(240);
        global $post;
        $post_id = $post->ID;
        $preg = preg_match_all('/<img.*?src="(.*?)"/', stripslashes($content), $matches);
        if ($preg) {
            $i = 1;
            foreach ($matches[1] as $image_url) {
                if (empty($image_url)) {
                    continue;
                }
                $pos = strpos($image_url, get_bloginfo('url'));
                if ($pos === false) {
                    $res = save_images($image_url, $post_id, $i);
                    $replace = $res['url'];
                    if ($replace) {
                        $content = str_replace($image_url, $replace, $content);
                    }
                }
                $i++;
            }
        }
    }
    remove_filter('content_save_pre', array($this, 'post_save_images'));
    return $content;
}
Example #26
0
/**
 * Clean up wp_head()
 *
 * Remove unnecessary <link>'s
 * Remove inline CSS and JS from WP emoji support
 * Remove inline CSS used by Recent Comments widget
 * Remove inline CSS used by posts with galleries
 * Remove self-closing tag and change ''s to "'s on rel_canonical()
 *
 * You can enable/disable this feature in functions.php (or lib/setup.php if you're using Sage):
 * add_theme_support('soil-clean-up');
 */
function head_cleanup()
{
    // Originally from http://wpengineer.com/1438/wordpress-header/
    remove_action('wp_head', 'feed_links_extra', 3);
    add_action('wp_head', 'ob_start', 1, 0);
    add_action('wp_head', function () {
        $pattern = '/.*' . preg_quote(esc_url(get_feed_link('comments_' . get_default_feed())), '/') . '.*[\\r\\n]+/';
        echo preg_replace($pattern, '', ob_get_clean());
    }, 3, 0);
    remove_action('wp_head', 'rsd_link');
    remove_action('wp_head', 'wlwmanifest_link');
    remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
    remove_action('wp_head', 'wp_generator');
    remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
    remove_action('wp_head', 'print_emoji_detection_script', 7);
    remove_action('admin_print_scripts', 'print_emoji_detection_script');
    remove_action('wp_print_styles', 'print_emoji_styles');
    remove_action('admin_print_styles', 'print_emoji_styles');
    remove_action('wp_head', 'wp_oembed_add_discovery_links');
    remove_action('wp_head', 'wp_oembed_add_host_js');
    remove_action('wp_head', 'rest_output_link_wp_head', 10, 0);
    remove_filter('the_content_feed', 'wp_staticize_emoji');
    remove_filter('comment_text_rss', 'wp_staticize_emoji');
    remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
    add_filter('use_default_gallery_style', '__return_false');
    global $wp_widget_factory;
    if (isset($wp_widget_factory->widgets['WP_Widget_Recent_Comments'])) {
        remove_action('wp_head', [$wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style']);
    }
    if (!class_exists('WPSEO_Frontend')) {
        remove_action('wp_head', 'rel_canonical');
        add_action('wp_head', __NAMESPACE__ . '\\rel_canonical');
    }
}
Example #27
0
function replace_wp_die_handler()
{
    \remove_filter('wp_die_handler', '_default_wp_die_handler');
    \add_filter('wp_die_handler', function () {
        return __NAMESPACE__ . '\\' . 'wp_die_handler';
    });
}
 /**
  * Widget
  *
  * @return   void
  * @since    1.0
  */
 function widget($args, $instance)
 {
     if (false == ($cache = get_transient('edd_widgets_archives'))) {
         // get the title and apply filters
         $title = apply_filters('widget_title', $instance['title'] ? $instance['title'] : '');
         // get show count boolean
         $show_count = isset($instance['show_count']) && $instance['show_count'] === 1 ? 1 : 0;
         // start collecting the output
         $out = "";
         // check if there is a title
         if ($title) {
             // add the title to the ouput
             $out .= $args['before_title'] . $title . $args['after_title'];
         }
         $out .= "<ul>\n";
         // add download post type to archives
         add_filter('getarchives_where', array(&$this, 'getarchives_where_filter'), 10, 2);
         add_filter('month_link', array($this, 'month_link'), 10, 3);
         // output the archives
         $out .= wp_get_archives(array('echo' => 0, 'show_post_count' => $show_count));
         // remove filter
         remove_filter('getarchives_where', array(&$this, 'getarchives_where_filter'), 10, 2);
         remove_filter('month_link', array($this, 'month_link'), 10, 3);
         // finish the list
         $out .= "</ul>\n";
         // set the widget's containers
         $cache = $args['before_widget'] . $out . $args['after_widget'];
         // store the result on a temporal transient
         set_transient('edd_widgets_archives', $cache);
     }
     echo $cache;
 }
 public static function remote($url = FALSE, $post_vars = FALSE, $args = array())
 {
     static $http_response_filtered = false;
     /* Apply GZ filters only once. */
     /**/
     $args = !is_array($args) ? array() : $args;
     /* Disable SSL verifications. */
     $args["sslverify"] = !isset($args["sslverify"]) ? false : $args["sslverify"];
     /**/
     if (!$http_response_filtered && ($http_response_filtered = true)) {
         add_filter("http_response", "c_ws_plugin__qcache_utils_urls::_remote_gz_variations");
     }
     /**/
     if ($url) {
         if (preg_match("/^https/i", $url) && strtolower(substr(PHP_OS, 0, 3)) === "win") {
             add_filter("use_curl_transport", "__return_false", $curl_disabled = 1352);
         }
         /**/
         if ((is_array($post_vars) || is_string($post_vars)) && !empty($post_vars)) {
             $args = array_merge($args, array("method" => "POST", "body" => $post_vars));
         }
         /**/
         $body = wp_remote_retrieve_body(wp_remote_request($url, $args));
         /**/
         if ($curl_was_disabled_by_this_routine_with_1352_priority = $curl_disabled) {
             remove_filter("use_curl_transport", "__return_false", 1352);
         }
         /**/
         return $body;
         /* The body content received. */
     }
     /**/
     return false;
     /* Else return false. */
 }
Example #30
-1
function optionscheck_change_santiziation()
{
    remove_filter('of_sanitize_textarea', 'of_sanitize_textarea');
    remove_filter('of_sanitize_text', 'sanitize_text_field');
    add_filter('of_sanitize_textarea', 'custom_sanitize_input');
    add_filter('of_sanitize_text', 'custom_sanitize_input');
}