本文整理汇总了PHP中has_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP has_filter函数的具体用法?PHP has_filter怎么用?PHP has_filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了has_filter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _wpsc_get_exchange_rate
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;
}
}
示例2: mp_stacks_doubletext_create_meta_box
/**
* 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);
}
示例3: mp_stacks_image_create_meta_box
/**
* 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);
}
示例4: __construct
/**
* 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();
}
示例5: test_methods_added_via_add_filters
/**
* 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');
}
示例6: set_product_page_image_html
/**
* 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);
}
}
示例7: test_hooks
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')));
}
示例8: __construct
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'));
}
}
示例9: widget
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>';
}
示例10: mp_stacks_show_insert_shortcode
/**
* 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);
}
示例11: settings_page_tabs_late
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;
}
示例12: mp_stacks_size_create_meta_box
/**
* 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);
}
示例13: get_visible_children
/**
* 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);
}
示例14: do_hook
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;
}
}
示例15: wck_cptc_create_cpts
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']));
}
}
}