本文整理汇总了PHP中apply_filters函数的典型用法代码示例。如果您正苦于以下问题:PHP apply_filters函数的具体用法?PHP apply_filters怎么用?PHP apply_filters使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了apply_filters函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: genesis_404
/**
* This function outputs a 404 "Not Found" error message
*
* @since 1.6
*/
function genesis_404()
{
echo genesis_html5() ? '<article class="entry">' : '<div class="post hentry">';
printf('<h1 class="entry-title">%s</h1>', apply_filters('genesis_404_entry_title', __('Not found, error 404', 'genesis')));
echo '<div class="entry-content">';
if (genesis_html5()) {
echo apply_filters('genesis_404_entry_content', '<p>' . sprintf(__('The page you are looking for no longer exists. Perhaps you can return back to the site\'s <a href="%s">homepage</a> and see if you can find what you are looking for. Or, you can try finding it by using the search form below.', 'genesis'), trailingslashit(home_url())) . '</p>');
get_search_form();
} else {
?>
<p><?php
printf(__('The page you are looking for no longer exists. Perhaps you can return back to the site\'s <a href="%s">homepage</a> and see if you can find what you are looking for. Or, you can try finding it with the information below.', 'genesis'), trailingslashit(home_url()));
?>
</p>
<?php
}
if (!genesis_html5()) {
genesis_sitemap('h4');
} elseif (genesis_a11y('404-page')) {
echo '<h2>' . __('Sitemap', 'genesis') . '</h2>';
genesis_sitemap('h3');
}
echo '</div>';
echo genesis_html5() ? '</article>' : '</div>';
}
示例2: start_el
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
$indent = $depth ? str_repeat("\t", $depth) : '';
$classes = empty($item->classes) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
$class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args, $depth));
/**
* Change WP's default classes to match Foundation's required classes
*/
$class_names = str_replace(array('menu-item-has-children'), array('has-submenu'), $class_names);
// ==========================
$class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : '';
$id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth);
$id = $id ? ' id="' . esc_attr($id) . '"' : '';
$output .= $indent . '<li' . $id . $class_names . '>';
$atts = array();
$atts['title'] = !empty($item->attr_title) ? $item->attr_title : '';
$atts['target'] = !empty($item->target) ? $item->target : '';
$atts['rel'] = !empty($item->xfn) ? $item->xfn : '';
$atts['href'] = !empty($item->url) ? $item->url : '';
$atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args, $depth);
$attributes = '';
foreach ($atts as $attr => $value) {
if (!empty($value)) {
$value = 'href' === $attr ? esc_url($value) : esc_attr($value);
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
$item_output = $args->before;
$item_output .= '<a' . $attributes . '>';
$item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
$item_output .= '</a>';
$item_output .= $args->after;
$output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
}
示例3: start_el
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{
global $wp_query;
$indent = $depth ? str_repeat("\t", $depth) : '';
$class_names = $value = '';
$classes = empty($item->classes) ? array() : (array) $item->classes;
$class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item));
$class_names = ' class="' . esc_attr($class_names) . '"';
$output .= $indent . '<li id="shopkeeper-menu-item-' . $item->ID . '"' . $value . $class_names . '>';
$attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
$attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : '';
$attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
$attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : '';
$prepend = '';
$append = '';
//$description = ! empty( $item->description ) ? '<span>'.esc_attr( $item->description ).'</span>' : '';
if ($depth != 0) {
$description = $append = $prepend = "";
}
$item_output = $args->before;
$item_output .= '<a' . $attributes . '>';
$item_output .= $args->link_before . $prepend . apply_filters('the_title', $item->title, $item->ID) . $append;
//$item_output .= $description.$args->link_after;
//$item_output .= ' '.$item->background_url.'</a>';
$item_output .= '</a>';
$item_output .= $args->after;
$output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
apply_filters('walker_nav_menu_start_lvl', $item_output, $depth, $args->background_url = $item->background_url);
}
示例4: educator_theme_fonts_url
/**
* Get fonts URL.
*
* @return string
*/
function educator_theme_fonts_url()
{
$fonts = array();
$fonts[] = get_theme_mod('headings_font', 'Open Sans');
$fonts[] = get_theme_mod('body_font', 'Open Sans');
$font_families = array();
$available_fonts = apply_filters('ib_theme_get_fonts', array());
foreach ($fonts as $font_name) {
if (isset($font_families[$font_name])) {
continue;
}
if (isset($available_fonts[$font_name])) {
$font = $available_fonts[$font_name];
$font_families[$font_name] = urlencode($font_name);
if (!empty($font['font_styles'])) {
$font_families[$font_name] .= ':' . $font['font_styles'];
}
}
}
if (empty($font_families)) {
return false;
}
$query_args = array(array('family' => implode('|', $font_families)));
$charater_sets = get_theme_mod('charater_sets', 'latin,latin-ext');
if (!empty($charater_sets)) {
$query_args['subset'] = educator_sanitize_character_sets($charater_sets);
}
return add_query_arg($query_args, '//fonts.googleapis.com/css');
}
示例5: cp
/**
* s2Member's PayPal Auto-Return/PDT handler (inner processing routine).
*
* @package s2Member\PayPal
* @since 110720
*
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
*/
public static function cp($vars = array())
{
extract($vars);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_paypal_return_before_no_return_data", get_defined_vars());
unset($__refs, $__v);
$paypal["s2member_log"][] = "No Return-Data. Customer MUST wait for Email Confirmation.";
$paypal["s2member_log"][] = "Note. This can sometimes happen when/if you are offering an Initial/Trial Period. There are times when a Payment Gateway will NOT supply s2Member with any data immediately after checkout. When/if this happens, s2Member must process the transaction via IPN only (i.e. behind-the-scene), and the Customer must wait for Email Confirmation in these cases.";
$paypal["s2member_log"][] = var_export($_REQUEST, true);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_paypal_return_during_no_return_data", get_defined_vars());
unset($__refs, $__v);
if ($custom_success_redirection) {
$paypal["s2member_log"][] = "Redirecting Customer to a custom URL: " . $custom_success_redirection . ".";
wp_redirect($custom_success_redirection);
} else {
$paypal["s2member_log"][] = "Redirecting Customer to the Home Page (after asking Customer to check their email).";
echo c_ws_plugin__s2member_return_templates::return_template($paypal["subscr_gateway"], _x('<strong>Thank you! (you MUST check your email before proceeding).</strong><br /><br />* Note: It can take <em>(up to 15 minutes)</em> for Email Confirmation with important details. If you don\'t receive email confirmation in the next 15 minutes, please contact Support.', "s2member-front", "s2member") . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] || c_ws_plugin__s2member_utils_conds::pro_is_installed() && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_" . $paypal["subscr_gateway"] . "_sandbox"]) ? '<br /><br />' . _x('<strong>** Sandbox Mode **</strong> You may NOT receive this Email in Sandbox Mode. Sandbox addresses are usually bogus (for testing).', "s2member-front", "s2member") : ''), _x("Back To Home Page", "s2member-front", "s2member"), home_url("/"));
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_paypal_return_after_no_return_data", get_defined_vars());
unset($__refs, $__v);
return apply_filters("c_ws_plugin__s2member_paypal_return_in_no_tx_data", $paypal, get_defined_vars());
}
示例6: output
/**
* Output the settings
*/
public function output()
{
global $woocommerce, $woocommerce_settings, $current_section, $current_tab;
if (!current_user_can('manage_woocommerce')) {
wp_die(__('You do not have sufficient permissions to access this page.', MAILPOET_WOOCOMMERCE_TEXT_DOMAIN));
}
do_action('woocommerce_mailpoet_settings_start');
$mailpoet_settings = $this->get_settings();
// Get current section
$current_section = empty($_REQUEST['section']) ? 'general' : sanitize_text_field(urldecode($_REQUEST['section']));
$current = $current_section ? '' : ' class="current"';
// Creates each settings section.
$mailpoet_section = apply_filters('woocommerce_mailpoet_settings_sections', array('general' => __('General', MAILPOET_WOOCOMMERCE_TEXT_DOMAIN), 'lists' => __('Lists', MAILPOET_WOOCOMMERCE_TEXT_DOMAIN)));
foreach ($mailpoet_section as $section => $title) {
$title = ucwords($title);
$current = $section == $current_section ? ' class="current"' : '';
$links[] = '<a href="' . add_query_arg('section', $section, admin_url('admin.php?page=woocommerce_settings&tab=mailpoet')) . '"' . $current . '>' . esc_html($title) . '</a>';
}
echo '<ul class="subsubsub"><li>' . implode('| </li><li>', $links) . '</li></ul><br class="clear" />';
woocommerce_admin_fields($mailpoet_settings);
if ($current_section == 'lists') {
include_once MailPoet_WooCommerce_Add_on()->plugin_path() . '/includes/admin/settings/settings-newsletters.php';
$mailpoet_list = mailpoet_lists();
do_action('woocommerce_mailpoet_list_newsletters', $mailpoet_list);
}
}
示例7: top_level
public function top_level()
{
$projects = $this->many("SELECT * FROM {$this->table} WHERE parent_project_id IS NULL OR parent_project_id < 1 ORDER BY name ASC");
/** This filter is documented in gp-includes/things/project.php */
$projects = apply_filters('gp_projects', $projects, 0);
return $projects;
}
示例8: friends_screen_requests
function friends_screen_requests()
{
if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_accept_friendship');
if (friends_accept_friendship(bp_action_variable(1))) {
bp_core_add_message(__('Friendship accepted', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
}
bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
} elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_reject_friendship');
if (friends_reject_friendship(bp_action_variable(1))) {
bp_core_add_message(__('Friendship rejected', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
}
bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
}
do_action('friends_screen_requests');
if (isset($_GET['new'])) {
bp_core_delete_notifications_by_type(bp_loggedin_user_id(), 'friends', 'friendship_request');
}
bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
示例9: get_grid_archive_theme
/**
* Returns classic grid element for a given product
*
* @param object $post Product post object
* @param string $archive_template
* @return string
*/
function get_grid_archive_theme($post, $archive_template = null)
{
$archive_template = isset($archive_template) ? $archive_template : get_product_listing_template();
$return = '';
if ($archive_template == 'grid') {
$image_id = get_post_thumbnail_id($post->ID);
$thumbnail_product = wp_get_attachment_image_src($image_id, 'classic-grid-listing');
$product_name = get_product_name();
if ($thumbnail_product) {
$img_class['alt'] = $product_name;
$img_class['class'] = 'classic-grid-image';
$image = wp_get_attachment_image($image_id, 'classic-grid-listing', false, $img_class);
} else {
$url = default_product_thumbnail_url();
$image = '<img src="' . $url . '" class="classic-grid-image" alt="' . $product_name . '" >';
}
$archive_price = apply_filters('archive_price_filter', '', $post);
$classic_grid_settings = get_classic_grid_settings();
$row_class = get_row_class($classic_grid_settings);
$return = '<div class="archive-listing product-' . $post->ID . ' classic-grid ' . $row_class . ' ' . product_class($post->ID) . '">';
$return .= '<a href="' . get_permalink() . '">';
//$return .= '<div style="background-image:url(\'' . $url . '\');" class="classic-grid-element"></div>';
$return .= '<div class="classic-grid-image-wrapper"><div class="pseudo"></div><div class="image">' . $image . '</div></div>';
$return .= '<h3 class="product-name">' . $product_name . '</h3>' . $archive_price . '</a></div>';
}
return $return;
}
示例10: __construct
/**
* Hook in tabs.
*/
public function __construct()
{
if (apply_filters('woocommerce_enable_setup_wizard', true) && current_user_can('manage_woocommerce')) {
add_action('admin_menu', array($this, 'admin_menus'));
add_action('admin_init', array($this, 'setup_wizard'));
}
}
示例11: widget
function widget($args, $instance)
{
$title = $instance['title'];
$flickrid = $instance['flickrid'];
$number = $instance['number'];
echo ts_essentials_escape($args['before_widget']);
if (!empty($title)) {
echo ts_essentials_escape($args['before_title'] . apply_filters('widget_title', $title) . $args['after_title']);
}
?>
<div class="flickr ts-mfp-gallery">
<ul id="<?php
echo esc_attr($args['widget_id']);
?>
-ul" class="flickr-widget clearfix"></ul>
<div><script type="text/javascript">jQuery(document).ready(function($){if ($.fn.jflickrfeed){jQuery('#<?php
echo esc_js($args['widget_id']);
?>
-ul').jflickrfeed({limit: <?php
echo absint($number);
?>
,qstrings: { id: '<?php
echo esc_js($flickrid);
?>
' }}, function(data){if(typeof(ts_magnificPopup)=="function"){ ts_magnificPopup()}})}});</script></div>
</div>
<?php
echo ts_essentials_escape($args['after_widget']);
}
示例12: activello_setup
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function activello_setup()
{
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
*/
load_theme_textdomain('activello', get_template_directory() . '/languages');
// Add default posts and comments RSS feed links to head.
add_theme_support('automatic-feed-links');
/**
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support('post-thumbnails');
add_image_size('activello-featured', 1170, 550, true);
add_image_size('activello-slider', 1920, 550, true);
add_image_size('activello-thumbnail', 330, 220, true);
add_image_size('activello-medium', 640, 480, true);
// This theme uses wp_nav_menu() in one location.
register_nav_menus(array('primary' => esc_html__('Primary Menu', 'activello')));
// Enable support for Post Formats.
add_theme_support('post-formats', array('video', 'audio'));
// Setup the WordPress core custom background feature.
add_theme_support('custom-background', apply_filters('activello_custom_background_args', array('default-color' => 'FFFFFF', 'default-image' => '')));
// Enable support for HTML5 markup.
add_theme_support('html5', array('comment-list', 'search-form', 'comment-form', 'gallery', 'caption'));
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support('title-tag');
}
示例13: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
$sticky = get_option('sticky_posts');
$number = empty($instance['number']) ? 1 : (int) $instance['number'];
$cat = empty($instance['category']) ? 0 : (int) $instance['category'];
if (is_single()) {
array_push($sticky, get_the_ID());
}
echo $before_widget;
if (!empty($title)) {
echo $before_title . $title . $after_title;
} else {
echo '<br />';
}
$featuredPosts = new WP_Query(array('posts_per_page' => $number, 'cat' => $cat, 'post__not_in' => $sticky, 'no_found_rows' => true));
while ($featuredPosts->have_posts()) {
$featuredPosts->the_post();
global $mb_content_area, $more;
$mb_content_area = 'sidebar';
get_template_part('content', get_post_format());
}
wp_reset_postdata();
echo $after_widget;
}
示例14: widget
function widget($args, $instance)
{
$title = apply_filters('widget_title', $instance['title']);
if (empty($instance['user_id']) || 'invalid' === $instance['user_id']) {
if (current_user_can('edit_theme_options')) {
echo $args['before_widget'];
echo '<p>' . sprintf(__('You need to enter your numeric user ID for the <a href="%1$s">Goodreads Widget</a> to work correctly. <a href="%2$s">Full instructions</a>.', 'jetpack'), esc_url(admin_url('widgets.php')), 'http://support.wordpress.com/widgets/goodreads-widget/#goodreads-user-id') . '</p>';
echo $args['after_widget'];
}
return;
}
if (!array_key_exists($instance['shelf'], $this->shelves)) {
return;
}
$instance['user_id'] = absint($instance['user_id']);
// Set widget ID based on shelf.
$this->goodreads_widget_id = $instance['user_id'] . '_' . $instance['shelf'];
if (empty($title)) {
$title = esc_html__('Goodreads', 'jetpack');
}
echo $args['before_widget'];
echo $args['before_title'] . $title . $args['after_title'];
$goodreads_url = 'https://www.goodreads.com/review/custom_widget/' . urlencode($instance['user_id']) . '.' . urlencode($instance['title']) . ':%20' . urlencode($instance['shelf']) . '?cover_position=&cover_size=small&num_books=5&order=d&shelf=' . urlencode($instance['shelf']) . '&sort=date_added&widget_bg_transparent=&widget_id=' . esc_attr($this->goodreads_widget_id);
echo '<div class="gr_custom_widget" id="gr_custom_widget_' . esc_attr($this->goodreads_widget_id) . '"></div>' . "\n";
echo '<script src="' . esc_url($goodreads_url) . '"></script>' . "\n";
echo $args['after_widget'];
do_action('jetpack_stats_extra', 'widget', 'goodreads');
}
示例15: __construct
public function __construct($data = array())
{
parent::__construct($data);
if (!isset($data['name'])) {
$this->name = 'eventlist';
}
if (!isset($data['posts'])) {
$event_args = array();
// Get the active plugins.
$active_plugins = get_option('active_plugins');
// We do some guessing here for Tzolkin
if (in_array('tzolkin/tzolkin.php', $active_plugins)) {
$event_args = ['post_type' => 'tz_events'];
}
// Some more guessing for The Events Calendar
if (in_array('the-events-calendar/the-events-calendar.php', $active_plugins)) {
$event_args = ['post_type' => \Tribe__Events__Main::POSTTYPE, 'orderby' => 'event_date', 'order' => 'ASC', 'posts_per_page' => tribe_get_option('postsPerPage', 10), 'tribe_render_context' => 'default'];
}
$eventlist_event_args_filter = $this->name . '_event_args';
$event_args = apply_filters($eventlist_event_args_filter, $event_args);
Atom::add_debug_entry('Filter', $eventlist_event_args_filter);
$this->posts = new \WP_Query($event_args);
}
if (!isset($data['posts-structure'])) {
$posts_structure = ['PostClass' => ['children' => ['image', 'text']], 'image' => ['parts' => ['PostThumbnail']], 'text' => ['parts' => ['EventBadge', 'PostTitleLink', 'EventDate', 'ForceExcerpt', 'PostLink' => 'Read More']]];
$postlist_posts_structure_filter = $this->name . '_posts_structure';
$this->posts_structure = apply_filters($postlist_posts_structure_filter, $posts_structure);
Atom::add_debug_entry('Filter', $postlist_posts_structure_filter);
}
}