本文整理汇总了PHP中add_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP add_filter函数的具体用法?PHP add_filter怎么用?PHP add_filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_filter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
add_action('in_widget_form', array(&$this, 'extend_recent_posts_form'), 10, 3);
add_filter('widget_update_callback', array(&$this, 'extend_recent_posts_update'), 10, 4);
add_filter('widget_title', array(&$this, 'extend_recent_posts_init_query_filter'), 10, 3);
add_filter('widget_posts_args', array(&$this, 'extend_recent_posts_query'));
}
示例2: __construct
function __construct()
{
parent::__construct();
epl_log('init', get_class() . " initialized", 1);
$this->epl->load_config('global-discount-fields');
$this->ecm = $this->epl->load_model('epl-common-model');
global $epl_fields;
$this->fields = $epl_fields;
//$this->epl_fields = $this->epl_util->combine_array_keys( $this->fields );
$this->epl_fields = $epl_fields;
$post_ID = '';
if (isset($_GET['post'])) {
$post_ID = $_GET['post'];
} elseif (isset($_POST['post_ID'])) {
$post_ID = $_POST['post_ID'];
}
$this->data['values'] = $this->ecm->get_post_meta_all((int) $post_ID, false, true);
$this->edit_mode = epl_get_element('post', $_GET) || epl_get_element('post_ID', $_REQUEST);
if (isset($_REQUEST['epl_ajax']) && $_REQUEST['epl_ajax'] == 1) {
$this->run();
} else {
add_action('default_title', array($this, 'pre'));
add_action('add_meta_boxes', array($this, 'epl_add_meta_boxes'));
add_action('save_post', array($this, 'save_postdata'));
add_filter('manage_edit-' . self::post_type . '_columns', array($this, 'add_new_columns'));
add_action('manage_' . self::post_type . '_posts_custom_column', array($this, 'column_data'), 10, 2);
}
}
示例3: __construct
/**
* Constrcut the plugin
*/
public function __construct()
{
add_filter('is_active_sidebar', array($this, 'activateSidebars'));
add_action('dynamic_sidebar_before', array($this, 'before'));
add_action('dynamic_sidebar_after', array($this, 'after'));
add_action('wp_enqueue_scripts', array($this, 'assets'));
}
示例4: init
function init()
{
$args = array('labels' => $this->create_labels(), 'description' => '', 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'show_in_menu' => true, 'menu_position' => 50, 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt'), 'register_meta_box_cb' => array($this, 'metaboxes'), 'rewrite' => array('slug' => strtolower($this->single), 'with_front' => false, 'feeds' => true, 'pages' => true), 'can_export' => true, 'show_in_nav_menus' => true);
$args = array_merge($args, $this->overwrite);
register_post_type($this->name, $args);
add_filter('post_updated_messages', array($this, 'post_updated_messages'));
}
示例5: public_init
public function public_init()
{
add_filter("previous_post_link", array(&$this, "linkFilter"));
add_filter("next_post_link", array(&$this, "linkFilter"));
add_shortcode('club_event', array(&$this, 'eventShortCode'));
$this->urlHandler();
}
示例6: __construct
function __construct()
{
// global
global $sitepress;
// vars
$this->lang = ICL_LANGUAGE_CODE;
// update settings
acf_update_setting('default_language', $sitepress->get_default_language());
acf_update_setting('current_language', $this->lang);
// actions
add_action('acf/verify_ajax', array($this, 'verify_ajax'));
add_action('acf/field_group/admin_head', array($this, 'admin_head'));
add_action('acf/input/admin_head', array($this, 'admin_head'));
// bail early if not transaltable
if (!$this->is_translatable()) {
return;
}
// actions
add_action('acf/upgrade_start/5.0.0', array($this, 'upgrade_start_5'));
add_action('acf/upgrade_finish/5.0.0', array($this, 'upgrade_finish_5'));
add_action('acf/update_field_group', array($this, 'update_field_group'), 2, 1);
add_action('icl_make_duplicate', array($this, 'icl_make_duplicate'), 10, 4);
// filters
add_filter('acf/settings/save_json', array($this, 'settings_save_json'));
add_filter('acf/settings/load_json', array($this, 'settings_load_json'));
}
示例7: Destro_setup
function Destro_setup()
{
// This theme uses wp_nav_menu() in one location.
register_nav_menus(array('mainmenu' => __('Main Navigation', 'Destro')));
// This theme uses post thumbnails
add_theme_support('post-thumbnails');
add_image_size('Destrothumb', 450, 300, true);
// Add default posts and comments RSS feed links to head
add_theme_support('automatic-feed-links');
// Add translation support
load_theme_textdomain('Destro', get_template_directory() . '/languages');
// Delete default WordPress gallery css
add_filter('use_default_gallery_style', '__return_false');
// Add Custom background feature
if (of_get_option('skin_style')) {
$custombgargsskin = of_get_option('skin_style');
} else {
$custombgargsskin = 'destro';
}
if (get_stylesheet_directory() == get_template_directory()) {
$custombgargs = array('default-color' => '292929', 'default-image' => get_template_directory_uri() . '/images/' . $custombgargsskin . '/page_bg.png');
} else {
$custombgargs = array('default-image' => get_stylesheet_directory_uri() . '/images/page_bg.png');
}
add_theme_support('custom-background', $custombgargs);
}
示例8: __construct
function __construct()
{
add_filter('manage_edit-team_columns', array($this, 'arrange_team_columns'));
add_action('manage_team_posts_custom_column', array($this, 'manage_team_columns'), 10, 2);
// add_action( 'restrict_manage_posts', array( $this, 'add_taxonomy_filters' ) );
add_filter("manage_edit-team_sortable_columns", array($this, 'team_column_sort'));
}
示例9: init
public static function init()
{
if (!is_admin()) {
return;
}
if (!isset($_FILES['podlove_import_tracking'])) {
return;
}
set_time_limit(10 * MINUTE_IN_SECONDS);
// allow xml+gz uploads
add_filter('upload_mimes', function ($mimes) {
return array_merge($mimes, array('xml' => 'application/xml', 'gz|gzip' => 'application/x-gzip'));
});
require_once ABSPATH . '/wp-admin/includes/file.php';
$file = wp_handle_upload($_FILES['podlove_import_tracking'], array('test_form' => false));
if ($file && (!isset($file['error']) || !$file['error'])) {
update_option('podlove_import_tracking_file', $file['file']);
if (!($file = get_option('podlove_import_tracking_file'))) {
return;
}
$importer = new \Podlove\Modules\ImportExport\Import\TrackingImporter($file);
$importer->import();
} else {
echo '<div class="error"><p>' . $file['error'] . '</p></div>';
}
}
示例10: __construct
public function __construct($main)
{
parent::__construct($main);
add_filter('login_redirect', array($this, 'login_redirect_callback'), 10, 3);
add_action('admin_init', array($this, 'admin_init'));
add_filter('show_admin_bar', array($this, 'show_toolbar'), 10, 1);
}
示例11: _initHooks
protected function _initHooks()
{
add_action('admin_init', array($this, 'admin_init'), 20);
add_action('admin_menu', array($this, 'admin_menu'));
add_action('network_admin_menu', array($this, 'network_admin_menu'));
add_action('admin_head', array($this, 'admin_head'));
add_action('wp_dashboard_setup', array($this, 'dashboard_setup'));
add_action('wp_ajax_better-analytics_heatmaps', array($this, 'display_page'));
add_action('wp_ajax_better-analytics_area_charts', array($this, 'display_page'));
add_action('wp_ajax_better-analytics_monitor', array($this, 'display_page'));
add_action('wp_ajax_better-analytics_events', array($this, 'display_page'));
add_action('wp_ajax_better-analytics_charts', array($this, 'display_charts'));
add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
add_filter('wp_redirect', array($this, 'filter_redirect'));
add_filter('admin_footer_text', array($this, 'admin_footer_text'));
add_filter('all_plugins', array($this, 'all_plugins'));
add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2);
add_filter('wpmu_options', array($this, 'show_network_settings'));
add_action('update_wpmu_options', array($this, 'save_network_settings'));
add_filter('removable_query_args', array($this, 'removable_query_args'));
$betterAnalyticsOptions = get_option('better_analytics');
if (!$betterAnalyticsOptions['property_id']) {
add_action('admin_notices', array($this, 'not_configured'));
}
if (!get_site_option('ba_site_tokens') && !get_option('ba_tokens')) {
add_action('admin_notices', array($this, 'cant_auto_configure'));
} elseif (!$betterAnalyticsOptions['api']['profile']) {
add_action('admin_notices', array($this, 'can_auto_configure'));
}
if (get_transient('ba_last_error')) {
add_action('admin_notices', array($this, 'last_error'));
}
}
示例12: __construct
/**
* Constructor
*/
public function __construct()
{
add_filter('metaslider_css', array($this, 'get_theme_css'), 15, 3);
add_filter('metaslider_css_classes', array($this, 'get_theme_css_classes'), 10, 3);
add_action('admin_menu', array($this, 'register_theme_editor_menu'), 9556);
add_filter('metaslider_get_available_themes', array($this, 'get_theme_select_options'), 10, 2);
}
示例13: __construct
/**
*
*/
private function __construct()
{
register_activation_hook(__FILE__, array($this, 'activate'));
$this->includes();
if (is_admin()) {
$this->admin_includes();
}
add_filter('woocommerce_shipping_methods', array($this, 'add_method'));
add_filter('woocommerce_checkout_fields', array($this, 'add_delivery_points_field'), 99);
add_filter('woocommerce_default_address_fields', array($this, 'default_address_fields'), 99);
add_filter('woocommerce_country_locale_field_selectors', array($this, 'add_city_id_field_selector'));
add_filter('woocommerce_form_field_hidden', array($this, 'form_field_hidden'), 10, 4);
add_action('woocommerce_after_checkout_billing_form', array($this, 'delivery_points_map'));
add_action('woocommerce_checkout_process', array($this, 'delivery_point_field_process'));
add_action('woocommerce_checkout_update_order_review', array($this, 'update_order_review'));
add_action('woocommerce_checkout_update_order_meta', array($this, 'checkout_field_update_order_meta'));
add_action('woocommerce_email_order_meta', array($this, 'email_order_meta'), 99);
add_filter('default_checkout_state', array($this, 'default_checkout_state'));
add_filter('pre_update_option_woocommerce_' . self::$method_id . '_settings', array($this, 'check_shop_contract'), 10, 2);
add_filter('woocommerce_cart_shipping_packages', array($this, 'shipping_packages'), 10);
//Ajax
add_filter('woocommerce_update_order_review_fragments', array($this, 'ajax_update_delivery_points'));
add_filter('woocommerce_params', array($this, 'is_door_params'));
add_action('wp_enqueue_scripts', array($this, 'load_script'));
add_action('admin_enqueue_scripts', array($this, 'admin_load_script'));
}
示例14: gsalborz_ahoy
function gsalborz_ahoy()
{
//Allow editor style.
//add_editor_style( get_stylesheet_directory_uri() . '/library/css/editor-style.css' );
// let's get language support going, if you need it
load_theme_textdomain('gsalborz', get_template_directory() . '/languages');
// USE THIS TEMPLATE TO CREATE CUSTOM POST TYPES EASILY
require_once 'library/custom-post-type.php';
// launching operation cleanup
add_action('init', 'gsalborz_head_cleanup');
// A better title
add_filter('wp_title', 'rw_title', 10, 3);
// remove WP version from RSS
add_filter('the_generator', 'gsalborz_rss_version');
// remove pesky injected css for recent comments widget
add_filter('wp_head', 'gsalborz_remove_wp_widget_recent_comments_style', 1);
// clean up comment styles in the head
add_action('wp_head', 'gsalborz_remove_recent_comments_style', 1);
// clean up gallery output in wp
add_filter('gallery_style', 'gsalborz_gallery_style');
// enqueue base scripts and styles
add_action('wp_enqueue_scripts', 'gsalborz_scripts_and_styles', 999);
// ie conditional wrapper
// launching this stuff after theme setup
gsalborz_theme_support();
// adding sidebars to Wordpress (these are created in functions.php)
add_action('widgets_init', 'gsalborz_register_sidebars');
// cleaning up random code around images
add_filter('the_content', 'gsalborz_filter_ptags_on_images');
// cleaning up excerpt
add_filter('excerpt_more', 'gsalborz_excerpt_more');
}
示例15: run
function run($core)
{
$this->core = $core;
$this->settings = get_site_option('itsec_malware');
$this->module_path = ITSEC_Lib::get_module_path(__FILE__);
add_action('itsec_add_admin_meta_boxes', array($this, 'add_admin_meta_boxes'));
//add meta boxes to admin page
add_action('itsec_admin_init', array($this, 'initialize_admin'));
//initialize admin area
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
//enqueue scripts for admin page
add_action('wp_ajax_itsec_malware_request_url_scan_ajax', array($this, 'wp_ajax_itsec_malware_request_url_scan_ajax'));
//Execute manual homepage scan request
add_action('wp_ajax_itsec_malware_get_scan_results_ajax', array($this, 'wp_ajax_itsec_malware_get_scan_results_ajax'));
//Execute manual homepage scan report
add_filter('itsec_add_dashboard_status', array($this, 'dashboard_status'));
//add information for plugin status
add_filter('itsec_tracking_vars', array($this, 'tracking_vars'));
add_filter('itsec_logger_displays', array($this, 'itsec_logger_displays'));
//adds logs metaboxes
//manually save options on multisite
if (is_multisite()) {
add_action('itsec_admin_init', array($this, 'save_network_options'));
//save multisite options
}
}