Example #1
0
function _wpsc_get_exchange_rate($from, $to)
{
    if ($from == $to) {
        return 1;
    }
    $key = "wpsc_exchange_{$from}_{$to}";
    if ($rate = get_transient($key)) {
        return (double) $rate;
    }
    $url = add_query_arg(array('a' => '1', 'from' => $from, 'to' => $to), 'http://www.google.com/finance/converter');
    $url = esc_url_raw(apply_filters('_wpsc_get_exchange_rate_service_endpoint', $url, $from, $to));
    $response = wp_remote_retrieve_body(wp_safe_remote_get($url, array('timeout' => 10)));
    if (has_filter('_wpsc_get_exchange_rate')) {
        return (double) apply_filters('_wpsc_get_exchange_rate', $response, $from, $to);
    }
    if (empty($response)) {
        return $response;
    } else {
        $rate = explode('bld>', $response);
        $rate = explode($to, $rate[1]);
        $rate = trim($rate[0]);
        set_transient($key, $rate, DAY_IN_SECONDS);
        return (double) $rate;
    }
}
/**
 * Function which creates new Meta Box
 *
 */
function mp_stacks_doubletext_create_meta_box()
{
    /**
     * Array which stores all info about the new metabox
     *
     */
    $mp_stacks_text_add_meta_box = array('metabox_id' => 'mp_stacks_text_metabox', 'metabox_title' => __('"Text" Content-Type', 'mp_stacks'), 'metabox_posttype' => 'mp_brick', 'metabox_context' => 'advanced', 'metabox_priority' => 'low');
    /**
     * Array which stores all info about the options within the metabox
     *
     */
    $mp_stacks_text_items_array = array(array('field_id' => 'brick_text_media_type_description', 'field_title' => __('Description:', 'mp_stacks'), 'field_description' => '<br />The "Text" Media-Type has repeatable Text-Pairs which sit on top of each other.', 'field_type' => 'basictext', 'field_value' => ''), array('field_id' => 'brick_text_pair_title', 'field_title' => __('2 Text Areas', 'mp_stacks'), 'field_description' => __('Two text areas.', 'mp_stacks'), 'field_type' => 'repeatertitle', 'field_value' => '', 'field_repeater' => 'mp_stacks_text_content_type_repeater'), array('field_id' => 'brick_line_1_color', 'field_title' => __('Text Color 1', 'mp_stacks'), 'field_description' => '<br />Select the color of text area 1.', 'field_type' => 'colorpicker', 'field_value' => '', 'field_container_class' => 'mp_brick_text_option', 'field_repeater' => 'mp_stacks_text_content_type_repeater'), array('field_id' => 'brick_line_1_font_size', 'field_title' => __('Text Size 1', 'mp_stacks'), 'field_description' => '<br />Enter the size (in pixels).', 'field_type' => 'number', 'field_value' => '35', 'field_container_class' => 'mp_brick_text_option', 'field_repeater' => 'mp_stacks_text_content_type_repeater'), array('field_id' => 'brick_line_1_line_height', 'field_title' => __('Line-Height 1', 'mp_stacks'), 'field_description' => '<br />Enter the line-height in pixels.', 'field_type' => 'number', 'field_value' => '', 'field_container_class' => 'mp_brick_text_option', 'field_repeater' => 'mp_stacks_text_content_type_repeater'), array('field_id' => 'brick_line_1_paragraph_margin_bottom', 'field_title' => __('Paragraph Spacing 1', 'mp_stacks'), 'field_description' => '<br />Enter the number of pixels separating each paragraph. Default: 15px', 'field_type' => 'number', 'field_value' => '15', 'field_container_class' => 'mp_brick_text_option', 'field_repeater' => 'mp_stacks_text_content_type_repeater'), array('field_id' => 'brick_text_line_1', 'field_title' => __('Text Area 1', 'mp_stacks'), 'field_description' => 'Enter the text to display on text area 1', 'field_type' => 'wp_editor', 'field_value' => '', 'field_repeater' => 'mp_stacks_text_content_type_repeater'), array('field_id' => 'brick_line_2_color', 'field_title' => __('Text Color 2', 'mp_stacks'), 'field_description' => '<br />Select the color of text area 2', 'field_type' => 'colorpicker', 'field_value' => '', 'field_container_class' => 'mp_brick_text_option', 'field_repeater' => 'mp_stacks_text_content_type_repeater'), array('field_id' => 'brick_line_2_font_size', 'field_title' => __('Text Size 2', 'mp_stacks'), 'field_description' => '<br />Enter the size (in pixels).', 'field_type' => 'number', 'field_value' => '20', 'field_container_class' => 'mp_brick_text_option', 'field_repeater' => 'mp_stacks_text_content_type_repeater'), array('field_id' => 'brick_line_2_line_height', 'field_title' => __('Line-Height 2', 'mp_stacks'), 'field_description' => '<br />Enter the line-height in pixels.', 'field_type' => 'number', 'field_value' => '', 'field_container_class' => 'mp_brick_text_option', 'field_repeater' => 'mp_stacks_text_content_type_repeater'), array('field_id' => 'brick_line_2_paragraph_margin_bottom', 'field_title' => __('Paragraph Spacing 2', 'mp_stacks'), 'field_description' => '<br />Enter the number of pixels separating each paragraph. Default: 15px', 'field_type' => 'number', 'field_value' => '15', 'field_container_class' => 'mp_brick_text_option', 'field_repeater' => 'mp_stacks_text_content_type_repeater'), array('field_id' => 'brick_text_line_2', 'field_title' => __('Text Area 2', 'mp_stacks'), 'field_description' => 'Enter the text to display on text area 2', 'field_type' => 'wp_editor', 'field_value' => '', 'field_repeater' => 'mp_stacks_text_content_type_repeater'), array('field_id' => 'brick_content_type_help', 'field_title' => 'Content Types', 'field_description' => NULL, 'field_type' => 'help', 'field_value' => '', 'field_select_values' => array(array('type' => 'oembed', 'link' => 'https://mintplugins.com/embed/?post_id=3872', 'link_text' => __('"Text" Content-Type Tutorial', 'mp_stacks'), 'target' => NULL))));
    /**
     * Custom filter to allow for add-on plugins to hook in their own data for add_meta_box array
     */
    $mp_stacks_text_add_meta_box = has_filter('mp_stacks_text_meta_box_array') ? apply_filters('mp_stacks_text_meta_box_array', $mp_stacks_text_add_meta_box) : $mp_stacks_text_add_meta_box;
    /**
     * Custom filter to allow for add on plugins to hook in their own extra fields 
     */
    $mp_stacks_text_items_array = has_filter('mp_stacks_text_items_array') ? apply_filters('mp_stacks_text_items_array', $mp_stacks_text_items_array) : $mp_stacks_text_items_array;
    /**
     * Create Metabox class
     */
    global $mp_stacks_text_meta_box;
    $mp_stacks_text_meta_box = new MP_CORE_Metabox($mp_stacks_text_add_meta_box, $mp_stacks_text_items_array);
}
Example #3
0
/**
 * Function which creates new Meta Box
 *
 */
function mp_stacks_image_create_meta_box()
{
    /**
     * Array which stores all info about the new metabox
     *
     */
    $mp_stacks_image_add_meta_box = array('metabox_id' => 'mp_stacks_image_metabox', 'metabox_title' => __('"Image" Content-Type', 'mp_stacks'), 'metabox_posttype' => 'mp_brick', 'metabox_context' => 'advanced', 'metabox_priority' => 'low');
    /**
     * Array which stores all info about the options within the metabox
     *
     */
    $mp_stacks_image_items_array = array('brick_main_image' => array('field_id' => 'brick_main_image', 'field_title' => __('Main Image', 'mp_stacks'), 'field_description' => 'Select an image to display beside the text on this stack item.', 'field_type' => 'mediaupload', 'field_value' => ''), 'brick_main_image_max_width' => array('field_id' => 'brick_main_image_max_width', 'field_title' => __('Max Image Width (Optional)', 'mp_stacks'), 'field_description' => 'Set the maximum width (in pixels) this image should show at. Image will shrink to fit smaller screens but never get bigger than this width.', 'field_type' => 'number', 'field_value' => ''), 'brick_main_image_link_showhider' => array('field_id' => 'brick_main_image_link_showhider', 'field_title' => __('Image Link Settings', 'mp_stacks'), 'field_description' => '', 'field_type' => 'showhider', 'field_value' => ''), 'brick_main_image_link_url' => array('field_id' => 'brick_main_image_link_url', 'field_title' => __('Link URL', 'mp_stacks'), 'field_description' => 'Enter the URL the above image will go to when clicked. EG: http://mylink.com', 'field_type' => 'url', 'field_value' => '', 'field_showhider' => 'brick_main_image_link_showhider'), 'brick_main_image_open_type' => array('field_id' => 'brick_main_image_open_type', 'field_title' => __('Link Open Type', 'mp_stacks'), 'field_description' => 'Enter the URL the above image will go to when clicked. EG: http://mylink.com', 'field_type' => 'select', 'field_value' => '', 'field_select_values' => array('lightbox' => __('Open in Lightbox', 'mp_stacks'), 'parent' => __('Open in current Window/Tab', 'mp_stacks'), 'blank' => __('Open in New Window/Tab', 'mp_stacks')), 'field_showhider' => 'brick_main_image_link_showhider'), 'brick_main_image_lightbox_width' => array('field_id' => 'brick_main_image_lightbox_width', 'field_title' => __('Lightbox Width', 'mp_stacks'), 'field_description' => 'Enter width the lightbox popup should be. Leave blank for 100% of screen. Video Tip: If you are linking to a video that is 16x9 aspect ratio, try using "640" here.', 'field_type' => 'number', 'field_value' => '', 'field_conditional_id' => 'brick_main_image_open_type', 'field_conditional_values' => array('lightbox'), 'field_showhider' => 'brick_main_image_link_showhider'), 'brick_main_image_lightbox_height' => array('field_id' => 'brick_main_image_lightbox_height', 'field_title' => __('Lightbox Height', 'mp_stacks'), 'field_description' => 'Enter height the lightbox popup should be. Leave blank for 100% of screen. Video Tip: If you are linking to a video that is 16x9 aspect ratio, try using "360" here.', 'field_type' => 'number', 'field_value' => '', 'field_conditional_id' => 'brick_main_image_open_type', 'field_conditional_values' => array('lightbox'), 'field_showhider' => 'brick_main_image_link_showhider'), 'brick_content_type_help' => array('field_id' => 'brick_content_type_help', 'field_title' => 'Content Types', 'field_description' => NULL, 'field_type' => 'help', 'field_value' => '', 'field_select_values' => array(array('type' => 'oembed', 'link' => 'https://mintplugins.com/embed/?post_id=3898', 'link_text' => __('"Image" Content-Type Tutorial', 'mp_stacks'), 'target' => NULL))));
    /**
     * Custom filter to allow for add-on plugins to hook in their own data for add_meta_box array
     */
    $mp_stacks_image_add_meta_box = has_filter('mp_stacks_image_meta_box_array') ? apply_filters('mp_stacks_image_meta_box_array', $mp_stacks_image_add_meta_box) : $mp_stacks_image_add_meta_box;
    /**
     * Custom filter to allow for add on plugins to hook in their own extra fields 
     */
    $mp_stacks_image_items_array = has_filter('mp_stacks_image_items_array') ? apply_filters('mp_stacks_image_items_array', $mp_stacks_image_items_array) : $mp_stacks_image_items_array;
    /**
     * Create Metabox class
     */
    global $mp_stacks_image_meta_box;
    $mp_stacks_image_meta_box = new MP_CORE_Metabox($mp_stacks_image_add_meta_box, $mp_stacks_image_items_array);
}
Example #4
0
 /**
  * Field Constructor.
  * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
  *
  * @since ReduxFramework 1.0.0
  */
 function __construct($field = array(), $value = '', $parent)
 {
     $this->parent = $parent;
     $this->field = $field;
     $this->value = $value;
     if (has_filter('mom_custom_fonts')) {
         $this->std_fonts = apply_filters('mom_custom_fonts', $this->std_fonts) + $this->std_fonts;
     }
     // Shim out old arg to new
     if (isset($this->field['all_styles']) && !empty($this->field['all_styles'])) {
         $this->field['all-styles'] = $this->field['all_styles'];
         unset($this->field['all_styles']);
     }
     // Set field array defaults.  No errors please
     $defaults = array('font-family' => true, 'font-size' => true, 'font-weight' => true, 'font-style' => true, 'font-backup' => false, 'subsets' => true, 'custom_fonts' => true, 'text-align' => true, 'text-transform' => false, 'font-variant' => false, 'text-decoration' => false, 'color' => true, 'preview' => true, 'line-height' => true, 'word-spacing' => false, 'letter-spacing' => false, 'google' => true, 'update_weekly' => false, 'font_family_clear' => true);
     $this->field = wp_parse_args($this->field, $defaults);
     // Set value defaults.
     $defaults = array('font-family' => '', 'font-options' => '', 'font-backup' => '', 'text-align' => '', 'text-transform' => '', 'font-variant' => '', 'text-decoration' => '', 'line-height' => '', 'word-spacing' => '', 'letter-spacing' => '', 'subsets' => '', 'google' => false, 'font-script' => '', 'font-weight' => '', 'font-style' => '', 'color' => '', 'font-size' => '');
     $this->value = wp_parse_args($this->value, $defaults);
     // Get the google array
     $this->getGoogleArray();
     if (empty($this->field['fonts'])) {
         $this->user_fonts = false;
         $this->field['fonts'] = $this->std_fonts;
     }
     // Localize std fonts
     $this->localizeStdFonts();
 }
 /**
  * Test that our methods gets added in add_filters
  *
  * @since 1.0.0
  *
  * @param null
  * @return null
  */
 public function test_methods_added_via_add_filters()
 {
     $ubc_use_template_shortcode = new \UBC\Shortcode\Use_Template();
     $ubc_use_template_shortcode->init();
     $this->assertEquals(10, has_filter('wp_kses_allowed_html', array($ubc_use_template_shortcode, 'wp_kses_allowed_html__add_data_attributes')), 'wp_kses_allowed_html__add_data_attributes() not added to filter wp_kses_allowed_html');
     $this->assertEquals(10, has_filter('safe_style_css', array($ubc_use_template_shortcode, 'safe_style_css__allow_display_none')), 'safe_style_css__allow_display_none() not added to filter safe_style_css');
 }
/**
 * Sets product page image html if was modified by third party
 */
function set_product_page_image_html()
{
    if (has_filter('post_thumbnail_html')) {
        add_filter('post_thumbnail_html', 'get_default_product_page_image_html', 1);
        add_filter('post_thumbnail_html', 'product_page_image_html', 99);
    }
}
Example #7
0
 function test_hooks()
 {
     $this->assertEquals(10, has_action('after_setup_theme', array(Charitable_Public::get_instance(), 'load_template_files')));
     $this->assertEquals(10, has_action('wp_enqueue_scripts', array(Charitable_Public::get_instance(), 'wp_enqueue_scripts')));
     $this->assertEquals(10, has_filter('post_class', array(Charitable_Public::get_instance(), 'campaign_post_class')));
     $this->assertEquals(10, has_filter('comments_open', array(Charitable_Public::get_instance(), 'disable_comments_on_application_pages')));
 }
Example #8
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'));
     }
 }
Example #9
0
 function widget($args, $instance)
 {
     print '<div class="widget azexo-post">';
     if (!empty($instance['title'])) {
         print '<div class="widget-title"><h3>' . $instance['title'] . '</h3></div>';
     }
     if (!empty($instance['post'])) {
         if ($instance['full'] == 'on') {
             global $post;
             $original = $post;
             $post = get_post($instance['post']);
             setup_postdata($post);
             $template_name = $instance['template'];
             print '<div class="scoped-style">' . azexo_get_post_wpb_css($instance['post']);
             include locate_template('content.php');
             print '</div>';
             wp_reset_postdata();
             $post = $original;
         } else {
             $wpautop = false;
             if (has_filter('the_content', 'wpautop')) {
                 remove_filter('the_content', 'wpautop');
                 $wpautop = true;
             }
             print azexo_get_post_content($instance['post']);
             if ($wpautop) {
                 add_filter('the_content', 'wpautop');
             }
         }
     }
     print '</div>';
 }
/**
 * Show "Insert Shortcode" above posts
 */
function mp_stacks_show_insert_shortcode()
{
    $args = array('shortcode_id' => 'mp_stack', 'shortcode_title' => __('Stack', 'mp_stacks'), 'shortcode_description' => __('Use the form below to insert the shortcode for your Stack:', 'mp_stacks'), 'shortcode_icon_spot' => true, 'shortcode_options' => array(array('option_id' => 'stack', 'option_title' => 'Choose an existing Stack', 'option_description' => 'Select the stack you wish to display and then click "Insert Stack"', 'option_type' => 'select', 'option_value' => mp_core_get_all_terms_by_tax('mp_stacks'))));
    //Shortcode args filter
    $args = has_filter('mp_stacks_insert_shortcode_args') ? apply_filters('mp_stacks_insert_shortcode_args', $args) : $args;
    new MP_CORE_Shortcode_Insert($args);
}
 public function settings_page_tabs_late($tabs)
 {
     if (has_filter('ccbpress_license_keys')) {
         $tabs[] = array('tab_id' => 'licenses', 'settings_id' => 'ccbpress_settings_licenses', 'title' => __('Licenses', 'ccbpress-core'), 'submit' => TRUE);
     }
     return $tabs;
 }
Example #12
0
/**
 * Function which creates new Meta Box
 *
 */
function mp_stacks_size_create_meta_box()
{
    /**
     * Array which stores all info about the new metabox
     *
     */
    $mp_stacks_size_add_meta_box = array('metabox_id' => 'mp_stacks_size_metabox', 'metabox_title' => __('Brick Size Settings', 'mp_stacks'), 'metabox_posttype' => 'mp_brick', 'metabox_context' => 'side', 'metabox_priority' => 'default');
    /**
     * Array which stores all info about the options within the metabox
     *
     */
    $mp_stacks_size_items_array = array(array('field_id' => 'brick_max_width', 'field_title' => __('Maximum Content Width:', 'mp_stacks'), 'field_description' => 'Enter the maximum width for Content in this Brick (in pixels) ', 'field_type' => 'number', 'field_value' => '1000'), array('field_id' => 'brick_min_above_below', 'field_title' => __('Space Above Content:', 'mp_stacks'), 'field_description' => __('Enter the amount of space above the Content in this Brick. (in pixels)', 'mp_stacks'), 'field_type' => 'number', 'field_value' => '50'), array('field_id' => 'brick_min_below', 'field_title' => __('Space Below Content:', 'mp_stacks'), 'field_description' => __('If blank, this matches the "Space Above".', 'mp_stacks'), 'field_type' => 'number', 'field_value' => ''), array('field_id' => 'brick_centered_inner_margins_showhider', 'field_title' => __('Content-Type Margins', 'mp_stacks'), 'field_description' => __('Click to open the controls for inner margins. These controls only affect Content Types when "centered" (which automatically happens on mobile devices)', 'mp_stacks'), 'field_value' => '', 'field_type' => 'showhider'), array('field_id' => 'brick_min_above_c1', 'field_title' => __('1st Content-Type - Space Above:', 'mp_stacks'), 'field_description' => 'Enter the space above the 1st Content-Type (in pixels) for this brick. Default: 0', 'field_type' => 'number', 'field_value' => '', 'field_showhider' => 'brick_centered_inner_margins_showhider'), array('field_id' => 'brick_min_below_c1', 'field_title' => __('1st Content-Type - Space Below:', 'mp_stacks'), 'field_description' => 'Enter the space below the 1st Content-Type (in pixels) for this brick. Default: 20', 'field_type' => 'number', 'field_value' => '', 'field_showhider' => 'brick_centered_inner_margins_showhider'), array('field_id' => 'brick_min_above_c2', 'field_title' => __('2nd Content-Type - Space Above:', 'mp_stacks'), 'field_description' => 'Enter the space above the 2nd Content-Type (in pixels) for this brick. Default: 0', 'field_type' => 'number', 'field_value' => '', 'field_showhider' => 'brick_centered_inner_margins_showhider'), array('field_id' => 'brick_min_below_c2', 'field_title' => __('2nd Content-Type - Space Below:', 'mp_stacks'), 'field_description' => 'Enter the space below the 2nd Content-Type (in pixels) for this brick. Default: 0', 'field_type' => 'number', 'field_value' => '', 'field_showhider' => 'brick_centered_inner_margins_showhider'), array('field_id' => 'brick_min_height', 'field_title' => __('Minimum Height:', 'mp_stacks'), 'field_description' => 'Enter the smallest height this brick could ever be. (in pixels)', 'field_type' => 'number', 'field_value' => '50', 'field_showhider' => 'brick_centered_inner_margins_showhider'), array('field_id' => 'brick_no_borders', 'field_title' => __('Full Width Content-Types', 'mp_stacks'), 'field_description' => 'If you want the content types to be able to touch the left and right sides, check this option.', 'field_type' => 'checkbox', 'field_value' => '', 'field_showhider' => 'brick_centered_inner_margins_showhider'), array('field_id' => 'brick_content_type_widths_and_floats', 'field_title' => __('Content-Type Widths', 'mp_stacks'), 'field_description' => __('Click to open the controls content-type widths.', 'mp_stacks'), 'field_value' => '', 'field_type' => 'showhider'), array('field_id' => 'brick_max_width_c1', 'field_title' => __('1st Content-Type\'s Max-Width:', 'mp_stacks'), 'field_description' => 'Enter the maximum width the 1st Content-Type can be:', 'field_type' => 'number', 'field_value' => '', 'field_showhider' => 'brick_content_type_widths_and_floats'), array('field_id' => 'brick_float_c1', 'field_title' => __('1st Content-Type - Float:', 'mp_stacks'), 'field_description' => 'Should this sit all the way to the left, right, or center?', 'field_type' => 'select', 'field_value' => '', 'field_select_values' => array('center' => __('Center', 'mp_stacks'), 'left' => __('Left', 'mp_stacks'), 'right' => __('Right', 'mp_stacks')), 'field_showhider' => 'brick_content_type_widths_and_floats'), array('field_id' => 'brick_max_width_c2', 'field_title' => __('2nd Content-Type\'s Max-Width:', 'mp_stacks'), 'field_description' => 'Enter the maximum width the 2nd Content-Type can be:', 'field_type' => 'number', 'field_value' => '', 'field_showhider' => 'brick_content_type_widths_and_floats'), array('field_id' => 'brick_float_c2', 'field_title' => __('2nd Content-Type - Float:', 'mp_stacks'), 'field_description' => 'Should this sit all the way to the left, right, or center?', 'field_type' => 'select', 'field_value' => '', 'field_select_values' => array('center' => __('Center', 'mp_stacks'), 'left' => __('Left', 'mp_stacks'), 'right' => __('Right', 'mp_stacks')), 'field_showhider' => 'brick_content_type_widths_and_floats'), array('field_id' => 'brick_split_percentage', 'field_title' => __('Split Percentage:', 'mp_stacks'), 'field_description' => __('What should the split percentage be? By default, it splits down the middle by using 50%. <br /> (NOTE: Does not apply if this brick is Centered)', 'mp_stacks') . '<br /><img width="129px" style="margin-top:10px;" src="' . plugins_url('assets/images/left-right.png', dirname(dirname(dirname(__FILE__)))) . '" />', 'field_type' => 'input_range', 'field_value' => '50', 'field_showhider' => 'brick_content_type_widths_and_floats'), array('field_id' => 'brick_class_name', 'field_title' => __('Brick Class Name:', 'mp_stacks'), 'field_description' => 'This field will allow you to attach a unique classname to this brick which travels with it in templates', 'field_type' => 'hidden', 'field_value' => ''));
    /**
     * Custom filter to allow for add-on plugins to hook in their own data for add_meta_box array
     */
    $mp_stacks_size_add_meta_box = has_filter('mp_stacks_size_meta_box_array') ? apply_filters('mp_stacks_size_meta_box_array', $mp_stacks_size_add_meta_box) : $mp_stacks_size_add_meta_box;
    /**
     * Custom filter to allow for add on plugins to hook in their own extra fields 
     */
    $mp_stacks_size_items_array = has_filter('mp_stacks_size_items_array') ? apply_filters('mp_stacks_size_items_array', $mp_stacks_size_items_array) : $mp_stacks_size_items_array;
    /**
     * Create Metabox class
     */
    global $mp_stacks_size_meta_box;
    $mp_stacks_size_meta_box = new MP_CORE_Metabox($mp_stacks_size_add_meta_box, $mp_stacks_size_items_array);
}
 /**
  * Return a products child ids - visible only.
  *
  * @since 2.7.0
  * @param  string $context
  * @return array Children ids
  */
 public function get_visible_children($context = 'view')
 {
     if (has_filter('woocommerce_get_children')) {
         wc_deprecated_function('The woocommerce_get_children filter', '', 'woocommerce_product_get_children or woocommerce_product_get_visible_children');
     }
     return apply_filters('woocommerce_get_children', $this->get_prop('visible_children', $context), $this, true);
 }
Example #14
0
 static function do_hook()
 {
     global $wp_filter;
     $current_hook = current_filter();
     if (!isset(self::$hooks[$current_hook])) {
         return;
     }
     $hook = self::$hooks[$current_hook];
     $hook_args = func_get_args();
     if ('filter' == $hook['hook_type']) {
         $value = $hook_args[0];
     }
     if (has_filter($hook['old_hook'])) {
         self::_deprecated_hook($current_hook);
         if ('filter' == $hook['hook_type']) {
             $type = 'apply_filters';
         } else {
             $type = 'do_action';
         }
         $value = call_user_func_array($type, array_merge(array($hook['old_hook']), array_slice($hook_args, 0, $hook['args'])));
     }
     if ('filter' == $hook['hook_type']) {
         return $value;
     }
 }
Example #15
0
function wck_cptc_create_cpts()
{
    $cpts = get_option('wck_cptc');
    if (!empty($cpts)) {
        foreach ($cpts as $cpt) {
            $labels = array('name' => _x($cpt['plural-label'], 'post type general name'), 'singular_name' => _x($cpt['singular-label'], 'post type singular name'), 'add_new' => _x($cpt['add-new'] ? $cpt['add-new'] : 'Add New', strtolower($cpt['singular-label'])), 'add_new_item' => __($cpt['add-new-item'] ? $cpt['add-new-item'] : "Add New " . $cpt['singular-label']), 'edit_item' => __($cpt['edit-item'] ? $cpt['edit-item'] : "Edit " . $cpt['singular-label'], 'wck'), 'new_item' => __($cpt['new-item'] ? $cpt['new-item'] : "New " . $cpt['singular-label'], 'wck'), 'all_items' => __($cpt['all-items'] ? $cpt['all-items'] : "All " . $cpt['plural-label'], 'wck'), 'view_item' => __(!empty($cpt['view-item']) ? $cpt['view-item'] : "View " . $cpt['singular-label'], 'wck'), 'search_items' => __($cpt['search-items'] ? $cpt['search-items'] : "Search " . $cpt['plural-label'], 'wck'), 'not_found' => __($cpt['not-found'] ? $cpt['not-found'] : "No " . strtolower($cpt['plural-label']) . " found", 'wck'), 'not_found_in_trash' => __($cpt['not-found-in-trash'] ? $cpt['not-found-in-trash'] : "No " . strtolower($cpt['plural-label']) . " found in Trash", 'wck'), 'parent_item_colon' => __(!empty($cpt['parent-item-colon']) ? $cpt['parent-item-colon'] : "Parent Page", 'wck'), 'menu_name' => $cpt['menu-name'] ? $cpt['menu-name'] : $cpt['plural-label']);
            $args = array('labels' => $labels, 'public' => $cpt['public'] == 'false' ? false : true, 'description' => $cpt['description'], 'show_ui' => $cpt['show-ui'] == 'false' ? false : true, 'show_in_nav_menus' => !empty($cpt['show-in-nav-menus']) && $cpt['show-in-nav-menus'] == 'false' ? false : true, 'has_archive' => $cpt['has-archive'] == 'false' ? false : true, 'hierarchical' => $cpt['hierarchical'] == 'false' ? false : true, 'supports' => explode(', ', $cpt['supports']));
            if (!empty($cpt['show-in-menu'])) {
                $args['show_in_menu'] = $cpt['show-in-menu'] == 'true' ? true : $cpt['show-in-menu'];
            }
            if (!empty($cpt['menu-position'])) {
                $args['menu_position'] = intval($cpt['menu-position']);
            }
            if (has_filter("wck_cptc_capabilities_{$cpt['post-type']}")) {
                $args['capabilities'] = apply_filters("wck_cptc_capabilities_{$cpt['post-type']}", $cpt['capability-type']);
            } else {
                $args['capability_type'] = $cpt['capability-type'];
            }
            if (!empty($cpt['taxonomies'])) {
                $args['taxonomies'] = explode(', ', $cpt['taxonomies']);
            }
            if (!empty($cpt['menu-icon'])) {
                $args['menu_icon'] = $cpt['menu-icon'];
            }
            if ($cpt['rewrite'] == 'false') {
                $args['rewrite'] = $cpt['rewrite'] == 'false' ? false : true;
            } else {
                if (!empty($cpt['rewrite-slug'])) {
                    $args['rewrite'] = array('slug' => $cpt['rewrite-slug']);
                }
            }
            register_post_type($cpt['post-type'], apply_filters('wck_cptc_register_post_type_args', $args, $cpt['post-type']));
        }
    }
}
 /**
  * Constructor
  */
 public function __construct()
 {
     if (!has_filter('msls_blog_collection_description')) {
         add_filter('msls_blog_collection_description', array($this, 'get_configured_blog_description'), 10, 2);
     }
     $this->current_blog_id = get_current_blog_id();
     $options = MslsOptions::instance();
     $this->current_blog_output = isset($options->output_current_blog);
     $this->objects_order = $options->get_order();
     if (!$options->is_excluded()) {
         /**
          * Returns custom filtered blogs of the blogs_collection
          * @since 0.9.8
          * @param array $blogs_collection
          */
         $blogs_collection = (array) apply_filters('msls_blog_collection_construct', $this->get_blogs_of_reference_user($options));
         foreach ($blogs_collection as $blog) {
             $description = false;
             if ($blog->userblog_id == $this->current_blog_id) {
                 $description = $options->description;
             } elseif (!$this->is_plugin_active($blog->userblog_id)) {
                 continue;
             }
             $description = apply_filters('msls_blog_collection_description', $blog->userblog_id, $description);
             if (false !== $description) {
                 $this->objects[$blog->userblog_id] = new MslsBlog($blog, $description);
             }
         }
         uasort($this->objects, array('MslsBlog', $this->objects_order));
     }
 }
Example #17
0
/**
 * Function which creates new Meta Box
 *
 */
function mp_stacks_bg_create_meta_box()
{
    /**
     * Array which stores all info about the new metabox
     *
     */
    $mp_stacks_bg_add_meta_box = array('metabox_id' => 'mp_stacks_bg_metabox', 'metabox_title' => __('Brick Background Settings', 'mp_stacks'), 'metabox_posttype' => 'mp_brick', 'metabox_context' => 'side', 'metabox_priority' => 'core');
    /**
     * Array which stores all info about the options within the metabox
     *
     */
    $mp_stacks_bg_items_array = array('brick_bg_hook_anchor_0' => array('field_type' => 'hook_anchor'), 'brick_bg_image_showhider' => array('field_id' => 'brick_bg_image_showhider', 'field_title' => __('Background Image:', 'mp_stacks'), 'field_description' => 'Click here to open the background image controls for this brick', 'field_type' => 'showhider', 'field_value' => ''), 'brick_bg_image' => array('field_id' => 'brick_bg_image', 'field_title' => __('Background Image: ', 'mp_stacks'), 'field_description' => 'Select an image to use as your background image for this brick.', 'field_type' => 'mediaupload', 'field_value' => '', 'field_showhider' => 'brick_bg_image_showhider'), 'brick_display_type' => array('field_id' => 'brick_display_type', 'field_title' => __('Background Image Display: ', 'mp_stacks'), 'field_description' => 'Select how you want this background image to display', 'field_type' => 'select', 'field_value' => '', 'field_select_values' => array('fill' => 'Fill Area', 'tiled' => 'Tiled'), 'field_showhider' => 'brick_bg_image_showhider'), 'brick_bg_image_opacity' => array('field_id' => 'brick_bg_image_opacity', 'field_title' => __('Background Image Opacity: ', 'mp_stacks'), 'field_description' => 'Set how see-through you want your background image to be over your color.', 'field_type' => 'input_range', 'field_value' => '100', 'field_showhider' => 'brick_bg_image_showhider'), 'brick_bg_color_showhider' => array('field_id' => 'brick_bg_color_showhider', 'field_title' => __('Background Color: ', 'mp_stacks'), 'field_description' => 'Click here to open the background color controls for this brick', 'field_type' => 'showhider', 'field_value' => ''), 'brick_bg_color' => array('field_id' => 'brick_bg_color', 'field_title' => __('Background Color: ', 'mp_stacks'), 'field_description' => 'Select a color as your background color for this brick.', 'field_type' => 'colorpicker', 'field_value' => '', 'field_showhider' => 'brick_bg_color_showhider'), 'brick_bg_color_opacity' => array('field_id' => 'brick_bg_color_opacity', 'field_title' => __('Background Color Opacity: ', 'mp_stacks'), 'field_description' => 'Set how see-through you want your background color to be.', 'field_type' => 'input_range', 'field_value' => '100', 'field_showhider' => 'brick_bg_color_showhider'));
    /**
     * Custom filter to allow for add-on plugins to hook in their own data for add_meta_box array
     */
    $mp_stacks_bg_add_meta_box = has_filter('mp_stacks_bg_meta_box_array') ? apply_filters('mp_stacks_bg_meta_box_array', $mp_stacks_bg_add_meta_box) : $mp_stacks_bg_add_meta_box;
    /**
     * Custom filter to allow for add on plugins to hook in their own extra fields 
     */
    $mp_stacks_bg_items_array = has_filter('mp_stacks_bg_items_array') ? apply_filters('mp_stacks_bg_items_array', $mp_stacks_bg_items_array) : $mp_stacks_bg_items_array;
    /**
     * Create Metabox class
     */
    global $mp_stacks_bg_meta_box;
    $mp_stacks_bg_meta_box = new MP_CORE_Metabox($mp_stacks_bg_add_meta_box, $mp_stacks_bg_items_array);
}
Example #18
0
/**
 * Ensure akismet runs before OpenID.
 */
function openid_setup_akismet()
{
    if (has_filter('preprocess_comment', 'akismet_auto_check_comment')) {
        remove_action('preprocess_comment', 'akismet_auto_check_comment', 1);
        add_action('preprocess_comment', 'akismet_auto_check_comment', -99);
    }
}
Example #19
0
/**
 * Function which creates new Meta Box
 *
 */
function mp_stacks_content_create_meta_box()
{
    /**
     * Array which stores all info about the new metabox
     *
     */
    $mp_stacks_content_add_meta_box = array('metabox_id' => 'mp_stacks_content_metabox', 'metabox_title' => __('Brick\'s Content-Types', 'mp_stacks'), 'metabox_posttype' => 'mp_brick', 'metabox_context' => 'advanced', 'metabox_priority' => 'high');
    //Set up and filter the default content types available.
    $default_content_types = apply_filters('mp_stacks_default_content_types', array('none' => 'None', 'singletext' => 'Text', 'image' => 'Image', 'video' => 'Video'));
    /**
     * Array which stores all info about the options within the metabox
     *
     */
    $mp_stacks_content_types_array = array(array('field_id' => 'brick_first_content_type', 'field_title' => __('1st Content Type', 'mp_stacks'), 'field_description' => 'Select the first content type to use for this brick.', 'field_type' => 'select', 'field_value' => '', 'field_select_values' => $default_content_types, 'field_popup_help' => esc_html('<img class="mp-core-popup-help-float-right" src="' . MP_STACKS_PLUGIN_URL . 'assets/images/help-images/content-types/Content-Type-1.png" \\/>
				<strong class="mp-ajax-popup-title">' . __('1st Content-Type:', 'mp_stacks') . '</strong>
				' . __('If this brick is aligned "Left/Right", this is the content that will appear on the left side of the brick. If "Centered", it will sit at the top.', 'mp_stacks'))), array('field_id' => 'brick_second_content_type', 'field_title' => __('2nd Content Type', 'mp_stacks'), 'field_description' => 'Select the second content type to use for this brick.', 'field_type' => 'select', 'field_value' => '', 'field_select_values' => $default_content_types, 'field_popup_help' => esc_html('<img class="mp-core-popup-help-float-right" src="' . MP_STACKS_PLUGIN_URL . 'assets/images/help-images/content-types/Content-Type-2.png" \\/>
				<strong class="mp-ajax-popup-title">' . __('2nd Content-Type:', 'mp_stacks') . '</strong>
				' . __('If this brick is aligned "Left/Right", this is the content that will appear on the right side of the brick. If "Centered", it will sit below the 1st Content-Type.', 'mp_stacks'))), array('field_id' => 'brick_alignment', 'field_title' => __('Alignment', 'mp_stacks'), 'field_description' => 'How would you like these content types to be aligned?', 'field_type' => 'radio', 'field_value' => 'leftright', 'field_select_values' => array('leftright' => 'Left/Right', 'centered' => 'Centered', 'allleft' => 'All on left', 'allright' => 'All on right')));
    /**
     * Custom filter to allow for add-on plugins to hook in their own data for add_meta_box array
     */
    $mp_stacks_content_add_meta_box = has_filter('mp_stacks_content_meta_box_array') ? apply_filters('mp_stacks_content_meta_box_array', $mp_stacks_content_add_meta_box) : $mp_stacks_content_add_meta_box;
    /**
     * Custom filter to allow for add on plugins to hook in their own extra fields 
     */
    $mp_stacks_content_types_array = has_filter('mp_stacks_content_types_array') ? apply_filters('mp_stacks_content_types_array', $mp_stacks_content_types_array) : $mp_stacks_content_types_array;
    /**
     * Create Metabox class
     */
    global $mp_stacks_content_meta_box;
    $mp_stacks_content_meta_box = new MP_CORE_Metabox($mp_stacks_content_add_meta_box, $mp_stacks_content_types_array);
}
Example #20
0
 function __construct()
 {
     $this->add_shortcode();
     // While generating the output of a text widget with a contact-form shortcode, we need to know its widget ID.
     add_action('dynamic_sidebar', array($this, 'track_current_widget'));
     // Add a "widget" shortcode attribute to all contact-form shortcodes embedded in widgets
     add_filter('widget_text', array($this, 'widget_atts'), 0);
     // If Text Widgets don't get shortcode processed, hack ours into place.
     if (!has_filter('widget_text', 'do_shortcode')) {
         add_filter('widget_text', array($this, 'widget_shortcode_hack'), 5);
     }
     // Akismet to the rescue
     if (function_exists('akismet_http_post')) {
         add_filter('contact_form_is_spam', array($this, 'is_spam_akismet'), 10);
         add_action('contact_form_akismet', array($this, 'akismet_submit'), 10, 2);
     }
     add_action('loop_start', array('Grunion_Contact_Form', '_style_on'));
     // custom post type we'll use to keep copies of the feedback items
     register_post_type('feedback', array('labels' => array('name' => __('Feedbacks', 'jetpack'), 'singular_name' => __('Feedback', 'jetpack'), 'search_items' => __('Search Feedback', 'jetpack'), 'not_found' => __('No feedback found', 'jetpack'), 'not_found_in_trash' => __('No feedback found', 'jetpack')), 'menu_icon' => GRUNION_PLUGIN_URL . '/images/grunion-menu.png', 'show_ui' => TRUE, 'show_in_admin_bar' => FALSE, 'public' => FALSE, 'rewrite' => FALSE, 'query_var' => FALSE, 'capability_type' => 'page'));
     // Add "spam" as a post status
     register_post_status('spam', array('label' => 'Spam', 'public' => FALSE, 'exclude_from_search' => TRUE, 'show_in_admin_all_list' => FALSE, 'label_count' => _n_noop('Spam <span class="count">(%s)</span>', 'Spam <span class="count">(%s)</span>', 'jetpack'), 'protected' => TRUE, '_builtin' => FALSE));
     // POST handler
     if ('POST' == strtoupper($_SERVER['REQUEST_METHOD']) && isset($_POST['action']) && 'grunion-contact-form' == $_POST['action'] && isset($_POST['contact-form-id'])) {
         add_action('template_redirect', array($this, 'process_form_submission'));
     }
     /* Can be dequeued by placing the following in wp-content/themes/yourtheme/functions.php
      *
      * 	function remove_grunion_style() {
      *		wp_deregister_style('grunion.css');
      *	}
      *	add_action('wp_print_styles', 'remove_grunion_style');
      */
     wp_register_style('grunion.css', GRUNION_PLUGIN_URL . 'css/grunion.css', array(), JETPACK__VERSION);
 }
Example #21
0
 function __invoke()
 {
     $args = func_get_args();
     $message_name = $this->get_message_name();
     $event_before = $message_name . '_before';
     if (has_action($event_before)) {
         do_action_ref_array($event_before, $args);
     }
     $event_pre = $message_name . '_args';
     if (has_filter($event_pre)) {
         $args = apply_filters_ref_array($event_pre, $args);
     }
     $result = null;
     $fn = $this->find_real_function($args);
     if (is_callable($fn)) {
         $result = call_user_func_array($fn, $args);
     }
     if (has_filter($message_name)) {
         $new_args = array_merge(array($result), $args);
         $result = apply_filters_ref_array($message_name, $new_args);
     }
     $event_after = $message_name . '_after';
     if (has_action($event_after)) {
         do_action_ref_array($event_after, array_merge($args, array($result)));
     }
     return $result;
 }
Example #22
0
 public function meta_box_row_shortcodes($row = array())
 {
     $out = '';
     if (method_exists($this->optigen, $row['type'])) {
         $img = 'upload' == $row['type'] && !empty($row['value']) ? ' rel="' . $row['value'] . '"' : '';
         $divider = array_key_exists('divider', $row) && $row['divider'] === TRUE ? ' divider' : '';
         $out .= '<div option="' . $row['id'] . '" class="option option-' . $row['type'] . ' ' . $row['id'] . '">';
         $out .= '<div class="option-inner">';
         $out .= '<label class="titledesc">' . $row['name'] . '</label>';
         $out .= '<div class="formcontainer">';
         $out .= $this->optigen->{$row}['type']($row);
         if (!empty($row['desc'])) {
             $out .= '<div class="desc">' . $row['desc'] . '</div>';
         }
         $out .= '</div>';
         if ('upload' == $row['type']) {
             $out .= '<div class="uploaded_thumb"' . $img . '></div>';
         }
         $out .= '<div class="tfclear"></div>';
         $out .= '</div></div>';
         $out .= '<div class="tfclear' . $divider . '"></div>' . "\n";
     }
     // Filtru pentru schimbarea unei optinui specifice dupa id, tip sau toate
     if (has_filter("tfuse_meta_box_row_template_{$row['id']}")) {
         return apply_filters("tfuse_meta_box_row_template_{$row['id']}", $out, $row);
     } else {
         if (has_filter("tfuse_meta_box_row_template_{$row['type']}")) {
             return apply_filters("tfuse_meta_box_row_template_{$row['type']}", $out, $row);
         }
     }
     return apply_filters('tfuse_meta_box_row_template', $out, $row);
 }
function nf_override_plugin_version()
{
    // Init Freemius and override plugin's version.
    if (!has_filter('fs_plugin_version_ninja-forms')) {
        add_filter('fs_plugin_version_ninja-forms', 'nf_plugin_version');
    }
}
 /**
  * Constructor.
  *
  * Supplied $args override class property defaults.
  *
  * If $args['fields'] is not defined, use the $id as the field ID.
  *
  * @since 3.4.0
  *
  * @param WP_Customize_Manager $manager
  * @param string $id
  * @param array $args
  */
 public function __construct($manager, $id, $args = array())
 {
     $this->manager = $manager;
     $this->object_name = $this->manager->get_customizer_object_name();
     // Backwards compatibility for old property names
     foreach ($this->property_map as $backcompat_arg => $actual_arg) {
         if (isset($args[$backcompat_arg])) {
             $args[$actual_arg] = $args[$backcompat_arg];
             unset($args[$backcompat_arg]);
         }
     }
     parent::__construct($this->object_type, $id, $args);
     if (empty($this->active_callback)) {
         $this->active_callback = array($this, 'active_callback');
     }
     if (!has_action('fields_render_control_' . $this->object_type, array('WP_Customize_Control', 'customize_render_control'))) {
         add_action('fields_render_control_' . $this->object_type, array('WP_Customize_Control', 'customize_render_control'));
     }
     if (!has_filter('fields_control_active_' . $this->object_type, array('WP_Customize_Control', 'customize_control_active'))) {
         add_filter('fields_control_active_' . $this->object_type, array('WP_Customize_Control', 'customize_control_active'), 10, 2);
     }
     if ('' !== $this->id) {
         add_action('fields_render_control_' . $this->object_type . '_' . $this->object_name . '_' . $this->id, array('WP_Customize_Control', 'customize_render_control_id'));
     }
 }
 public function test_column_heading_is_hooked()
 {
     self::$class_instance->setup_page_analysis();
     // @todo -> is this double ! correct ?
     $hooked = !!has_filter('manage_post_posts_columns', array(self::$class_instance, 'column_heading'));
     $this->assertTrue($hooked);
 }
function wp_comment_filters()
{
    global $wp_sh_setting_opt;
    if (!current_user_can('unfiltered_html')) {
        // Remove wp_filter_kses filter
        remove_filter('pre_comment_content', 'wp_filter_kses');
        // Apply substitute wp_filter_kses filter to comments excluding codes
        add_filter('pre_comment_content', 'wp_sh_wp_filter_kses');
    }
    if (has_filter('comment_text', 'make_clickable')) {
        // Remove make_clickable filter
        remove_filter('comment_text', 'make_clickable', 9);
        // Apply substitute make_clickable filter to comments excluding codes
        add_filter('comment_text', 'wp_sh_make_clickable', 9);
    }
    // Apply filters to escape to HTML entities
    add_filter('pre_comment_content', 'wp_sh_escape_code', 1);
    add_filter('comment_text', 'wp_sh_escape_code');
    // Replaced marker with escaped <pre>
    add_filter('pre_comment_content', 'wp_sh_replace_marker', 2);
    // Add extra "[]" into shortcode when shown
    if ($wp_sh_setting_opt['comment_hl_bt_shorcode'] == 1) {
        add_filter('comment_text', 'wp_sh_add_extra_bracket', -1);
    }
}
Example #27
0
 function action_init()
 {
     //syncing must wait until after init so
     //post types that support comments
     $filt_post_types = array();
     $all_post_types = get_post_types();
     foreach ($all_post_types as $post_type) {
         if (post_type_supports($post_type, 'comments')) {
             $filt_post_types[] = $post_type;
         }
     }
     Jetpack_Sync::sync_posts(__FILE__, array('post_types' => $filt_post_types, 'post_stati' => array('publish')));
     Jetpack_Sync::sync_comments(__FILE__, array('post_types' => $filt_post_types, 'post_stati' => array('publish'), 'comment_stati' => array('approve', 'approved', '1', 'hold', 'unapproved', 'unapprove', '0', 'spam', 'trash')));
     if (defined('DOING_AJAX') && DOING_AJAX) {
         return;
     }
     if (!has_filter('show_admin_bar', '__return_true') && !is_user_logged_in()) {
         return;
     }
     if (!self::current_browser_is_supported()) {
         return;
     }
     add_action('admin_bar_menu', array(&$this, 'admin_bar_menu'), 120);
     add_action('wp_head', array(&$this, 'styles_and_scripts'), 120);
     add_action('admin_head', array(&$this, 'styles_and_scripts'));
 }
function wcml_check_wpml_functions()
{
    if (defined('ICL_SITEPRESS_VERSION') && version_compare(preg_replace('#-(.+)$#', '', ICL_SITEPRESS_VERSION), '3.1.5', '<')) {
        function wpml_is_ajax()
        {
            if (defined('DOING_AJAX')) {
                return true;
            }
            return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ? true : false;
        }
    }
    if (!has_filter('translate_object_id')) {
        add_filter('translate_object_id', 'icl_object_id', 10, 4);
    }
    if (!has_action('wpml_register_single_string')) {
        if (function_exists('wpml_register_single_string_action')) {
            add_action('wpml_register_single_string', 'wpml_register_single_string_action', 10, 4);
        } elseif (function_exists('icl_register_string')) {
            add_action('wpml_register_single_string', 'icl_register_string', 10, 4);
        }
    }
    if (!has_filter('wpml_translate_single_string')) {
        add_filter('wpml_translate_single_string', 'wcml_translate_single_string_filter', 10, 6);
    }
}
Example #29
0
 /**
  * @author Panagiotis Vagenas <*****@*****.**>
  * @since  0.0.2
  */
 public function testRemoveAll()
 {
     /* @var \WPluginCore003\Plugin\Plugin $WpPluginCore */
     global $WpPluginCore;
     $hooksFactory = $WpPluginCore->getHookFactory();
     $filterTag = 'myFilterTag';
     $actionTag = 'myActionTag';
     $hooksFactory->removeAll($filterTag);
     $hooksFactory->removeAll($actionTag);
     $dumFilFun = function () {
     };
     $dumActFun = function () {
     };
     $dummyFilter = $hooksFactory->filter($filterTag, $dumFilFun);
     $dummyAction = $hooksFactory->action($actionTag, $dumActFun);
     $this->assertFalse(has_filter($filterTag));
     $this->assertFalse(has_action($actionTag));
     $this->assertFalse($dummyFilter->has());
     $this->assertFalse($dummyAction->has());
     $dummyFilter->add();
     $dummyAction->add();
     $this->assertTrue(has_filter($filterTag));
     $this->assertTrue(has_action($actionTag));
     $this->assertTrue($dummyFilter->has() === $dummyFilter->getPriority());
     $this->assertTrue($dummyAction->has() === $dummyAction->getPriority());
     $hooksFactory->removeAll($filterTag);
     $this->assertTrue(has_action($actionTag));
     $this->assertTrue($dummyAction->has() === $dummyAction->getPriority());
     $hooksFactory->removeAll($actionTag);
     $this->assertFalse(has_filter($filterTag));
     $this->assertFalse(has_action($actionTag));
     $this->assertFalse($dummyFilter->has());
     $this->assertFalse($dummyAction->has());
 }
Example #30
-2
function ac_output_first_category($class = '', $span_wrap = false)
{
    global $post;
    $output_category = '';
    $gpt = get_post_type(get_the_ID());
    if (has_filter('ac_output_first_category_class_filter')) {
        $applied_class = apply_filters('ac_output_first_category_class_filter', $class);
        if (!empty($applied_class)) {
            $show_class = 'class="' . esc_attr($applied_class) . '" ';
        } else {
            $show_class = '';
        }
    } elseif (!empty($class)) {
        $show_class = 'class="' . esc_attr($class) . '" ';
    } else {
        $show_class = '';
    }
    $category = get_the_category();
    if ($category) {
        $output_category = '<a href="' . get_category_link($category[0]->term_id) . '" ' . $show_class . 'title="' . sprintf(__("View all posts in %s", "justwrite"), $category[0]->name) . '" ' . '>' . $category[0]->name . '</a> ';
    }
    if (!$span_wrap) {
        if ($gpt != 'page' && !empty($category)) {
            echo $output_category;
        }
    } else {
        $output_category = '<span ' . $show_class . '>' . $category[0]->name . '</span> ';
        echo $output_category;
    }
}