当前位置: 首页>>代码示例>>PHP>>正文


PHP add_action函数代码示例

本文整理汇总了PHP中add_action函数的典型用法代码示例。如果您正苦于以下问题:PHP add_action函数的具体用法?PHP add_action怎么用?PHP add_action使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了add_action函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 function __construct()
 {
     // Backend Widget Realtime action
     add_action('wp_ajax_gadashadmin_get_realtime', array($this, 'ajax_adminwidget_realtime'));
     // Admin Widget get Reports action
     add_action('wp_ajax_gadashadmin_get_widgetreports', array($this, 'ajax_adminwidget_reports'));
 }
开发者ID:kkhalasi,项目名称:cloudrouter.github.io,代码行数:7,代码来源:ajax-actions.php

示例2: optionsframework_add_admin

/**
 * Create Options page
 *
 * @uses add_theme_page()
 * @uses add_action()
 *
 * @since 1.0.0
 */
function optionsframework_add_admin()
{
    $of_page = add_object_page('North', 'North', 'manage_options', 'optionsframework', 'optionsframework_options_page');
    // Add framework functionaily to the head individually
    add_action("admin_enqueue_scripts", 'of_load_only');
    add_action("admin_enqueue_scripts", 'of_style_only');
}
开发者ID:jfbelisle,项目名称:magexpress,代码行数:15,代码来源:functions.interface.php

示例3: __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'));
 }
开发者ID:markoheijnen,项目名称:life-control,代码行数:7,代码来源:overrule.recent-posts.php

示例4: __construct

 /**
  * Constructor for the session class.
  */
 public function __construct()
 {
     global $wpdb;
     $this->_cookie = 'wp_woocommerce_session_' . COOKIEHASH;
     $this->_table = $wpdb->prefix . 'woocommerce_sessions';
     if ($cookie = $this->get_session_cookie()) {
         $this->_customer_id = $cookie[0];
         $this->_session_expiration = $cookie[1];
         $this->_session_expiring = $cookie[2];
         $this->_has_cookie = true;
         // Update session if its close to expiring
         if (time() > $this->_session_expiring) {
             $this->set_session_expiration();
             $this->update_session_timestamp($this->_customer_id, $this->_session_expiration);
         }
     } else {
         $this->set_session_expiration();
         $this->_customer_id = $this->generate_customer_id();
     }
     $this->_data = $this->get_session_data();
     // Actions
     add_action('woocommerce_set_cart_cookies', array($this, 'set_customer_session_cookie'), 10);
     add_action('woocommerce_cleanup_sessions', array($this, 'cleanup_sessions'), 10);
     add_action('shutdown', array($this, 'save_data'), 20);
     add_action('wp_logout', array($this, 'destroy_session'));
     if (!is_user_logged_in()) {
         add_filter('nonce_user_logged_out', array($this, 'nonce_user_logged_out'));
     }
 }
开发者ID:jgcopple,项目名称:drgaryschwantz,代码行数:32,代码来源:class-wc-session-handler.php

示例5: pb_meets_minimum_requirements

/**
 * Check if installation environment meets minimum PB requirements.
 * Can be shared by other plugins that depend on Pressbooks. Example usage:
 *
 *     if ( ! @include_once( WP_PLUGIN_DIR . '/pressbooks/compatibility.php' ) ) {
 *         add_action( 'admin_notices', function () {
 *             echo '<div id="message" class="error fade"><p>' . __( 'Cannot find Pressbooks install.', 'pressbooks' ) . '</p></div>';
 *         } );
 *         return;
 *     }
 *     elseif ( ! pb_meets_minimum_requirements() ) {
 *         return;
 *     }
 *
 *
 * @return bool
 */
function pb_meets_minimum_requirements()
{
    $is_compatible = true;
    // ---------------------------------------------------------------------------------------------------------------
    // PHP Version
    // ---------------------------------------------------------------------------------------------------------------
    // Override PHP version at your own risk!
    global $pb_minimum_php;
    if (empty($pb_minimum_php)) {
        $pb_minimum_php = '5.6.0';
    }
    if (!version_compare(PHP_VERSION, $pb_minimum_php, '>=')) {
        add_action('admin_notices', '_pb_minimum_php');
        $is_compatible = false;
    }
    // ---------------------------------------------------------------------------------------------------------------
    // WordPress Version
    // ---------------------------------------------------------------------------------------------------------------
    // Override WP version at your own risk!
    global $pb_minimum_wp;
    if (empty($pb_minimum_wp)) {
        $pb_minimum_wp = '4.4';
    }
    if (!is_multisite() || !version_compare(get_bloginfo('version'), $pb_minimum_wp, '>=')) {
        add_action('admin_notices', '_pb_minimum_wp');
        $is_compatible = false;
    }
    return $is_compatible;
}
开发者ID:BCcampus,项目名称:candela,代码行数:46,代码来源:compatibility.php

示例6: __construct

 /**
  * Class contructor
  *
  * @since   0.2
  **/
 public function __construct()
 {
     // activation ##
     register_activation_hook(__FILE__, array($this, 'register_activation_hook'));
     // deactivation ##
     register_deactivation_hook(__FILE__, array($this, 'register_deactivation_hook'));
     // uninstall ##
     // TODO ##
     // load in mobile detect class ##
     if (!class_exists('Mobile_Detect')) {
         include Q_BROWSERS_PATH . '/library/mobile_detect.php';
     }
     // instatiate class ##
     $this->detect = new Mobile_Detect();
     $this->detect->setDetectionType('extended');
     // extended search ##
     // grab user agent ##
     $this->useragent = $_SERVER['HTTP_USER_AGENT'] ? $_SERVER['HTTP_USER_AGENT'] : false;
     if (is_admin()) {
         // text-domain ##
         add_action('plugins_loaded', array($this, 'load_plugin_textdomain'), 1);
         // plugin URL ##
         $this->plugin_URL = WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__));
         $this->plugin_dir_path = plugin_dir_url(__FILE__);
     } else {
         // conditional stylesheets for browser tweaks ##
         add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_conditional'), 10000000);
         // load them late ##
         // browser body_class ##
         add_filter('body_class', array($this, 'body_classes'), 1);
         // comments ##
         add_action('wp_footer', array($this, 'comments'), 1000);
     }
 }
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:39,代码来源:browsers.php

示例7: init

 /**
  * Initialize Module 
  *
  * @param none
  * @return void
  */
 public function init()
 {
     // Save custom post data
     add_action('save_post', array(&$this, 'post_save'));
     // Add Force SSL checkbox to edit post screen
     add_action('add_meta_boxes', array(&$this, 'add_meta_box_post'));
 }
开发者ID:tommbaker,项目名称:platform-www,代码行数:13,代码来源:Post.php

示例8: init

 /**
  * Hook in methods.
  */
 public static function init()
 {
     add_action('template_redirect', array(__CLASS__, 'geolocation_ajax_redirect'));
     add_action('before_woocommerce_init', array(__CLASS__, 'prevent_caching'));
     add_action('admin_notices', array(__CLASS__, 'notices'));
     add_action('delete_version_transients', array(__CLASS__, 'delete_version_transients'));
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:10,代码来源:class-wc-cache-helper.php

示例9: _add_hooks

 private function _add_hooks()
 {
     add_action('eab-settings-after_api_settings', array($this, 'show_settings'));
     add_filter('eab-settings-before_save', array($this, 'save_settings'));
     add_filter('eab-event_meta-event_meta_box-after', array($this, 'add_capacity_meta_box'));
     add_action('eab-event_meta-save_meta', array($this, 'save_capacity_meta'));
     add_action('eab-events-recurrent_event_child-save_meta', array($this, 'save_capacity_meta'));
     add_action('admin_print_scripts-post.php', array($this, 'enqueue_admin_dependencies'));
     add_action('admin_print_scripts-post-new.php', array($this, 'enqueue_admin_dependencies'));
     add_action('eab-javascript-enqueue_scripts', array($this, 'enqueue_public_dependencies'));
     add_filter('eab-rsvps-rsvp_form', array($this, 'handle_rsvp_form'), 10, 2);
     add_filter('eab-event-payment_forms', array($this, 'show_remaining_tickets'), 10, 2);
     add_filter('eab-payment-paypal_tickets-extra_attributes', array($this, 'handle_paypal_tickets'), 10, 3);
     // Front page editor integration
     add_filter('eab-events-fpe-add_meta', array($this, 'add_fpe_meta_box'), 10, 2);
     add_action('eab-events-fpe-enqueue_dependencies', array($this, 'enqueue_fpe_dependencies'), 10, 2);
     add_action('eab-events-fpe-save_meta', array($this, 'save_fpe_meta'), 10, 2);
     // Attendance data juggling
     add_filter('_eab-capacity-internal-attendance', array($this, 'get_remaining_capacity'), 10, 2);
     // MarketPress integration
     add_action('eab-mp-variation-meta', array($this, 'add_mp_inventory'), 10, 5);
     add_action('eab-mp-variation-thrash', array($this, 'thrash_mp_inventory'), 10, 2);
     //Prevent the attendion in the hook rather than just use the form
     add_action('incsub_event_booking', array($this, 'validate_attending_submission'), 10, 3);
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:25,代码来源:eab-events-limit_capacity.php

示例10: __construct

 public function __construct()
 {
     $this->registered_settings = array();
     $this->legacy_valid_control_types = array('checkbox', 'color', 'dropdown-pages', 'file', 'image', 'radio', 'select', 'text');
     add_action('customize_register', array($this, 'register_settings'));
     add_action('customize_register', array($this, 'enqueue_sanitization'));
 }
开发者ID:r-moiseev,项目名称:jets,代码行数:7,代码来源:Customizer.php

示例11: dslc_setup_post_options

/**
 * Setup post options
 *
 * @since 1.0
 */
function dslc_setup_post_options()
{
    /* Add meta boxes on the 'add_meta_boxes' hook. */
    add_action('add_meta_boxes', 'dslc_add_post_options');
    /* Save post meta on the 'save_post' hook. */
    add_action('save_post', 'dslc_save_post_options', 10, 2);
}
开发者ID:bibiangel1989,项目名称:vespatour,代码行数:12,代码来源:post-options-framework.php

示例12: __construct

 public function __construct()
 {
     $this->in_jetpack = defined('IS_WPCOM') && IS_WPCOM ? false : true;
     if ($this->in_jetpack) {
         $active = Jetpack::get_active_modules();
         if (!in_array('sharedaddy', $active) && !in_array('publicize', $active) && !in_array('likes', $active)) {
             add_action('admin_menu', array($this, 'sharing_menu'));
             // we don't have a sharing page yet
         }
         add_action('jetpack_activate_module_likes', array($this, 'module_toggle'));
         add_action('jetpack_deactivate_module_likes', array($this, 'module_toggle'));
         Jetpack::enable_module_configurable(__FILE__);
         Jetpack::module_configuration_load(__FILE__, array($this, 'configuration_redirect'));
     }
     // The visible UI elements for the user
     add_action('load-settings_page_sharing', array($this, 'load_management_script_assets'));
     add_action('pre_admin_screen_sharing', array($this, 'connection_screen'), 15);
     add_action('admin_init', array($this, 'add_meta_box'));
     add_action('do_meta_boxes', array($this, 'should_we_show_the_meta_box'));
     add_action('sharing_global_options', array($this, 'admin_settings_init'), 20);
     add_action('sharing_admin_update', array($this, 'admin_settings_callback'), 20);
     if ($this->in_jetpack) {
         add_action('pre_admin_screen_sharing', array($this, 'jetpack_disconnect'), 10);
     }
 }
开发者ID:lokenxo,项目名称:familygenerator,代码行数:25,代码来源:ui.php

示例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'));
 }
开发者ID:kalbac,项目名称:wc-edostavka,代码行数:29,代码来源:wc-edostavka.php

示例14: bp_groups_add_admin_menu

/**
 * Register the Groups component admin screen.
 *
 * @since 1.7.0
 */
function bp_groups_add_admin_menu()
{
    // Add our screen
    $hook = add_menu_page(_x('Groups', 'Admin Groups page title', 'buddypress'), _x('Groups', 'Admin Groups menu', 'buddypress'), 'bp_moderate', 'bp-groups', 'bp_groups_admin', 'div');
    // Hook into early actions to load custom CSS and our init handler.
    add_action("load-{$hook}", 'bp_groups_admin_load');
}
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:12,代码来源:bp-groups-admin.php

示例15: __construct

 function __construct()
 {
     self::$inst =& $this;
     self::$instance =& $this;
     //get all options
     add_filter('__options', array($this, 'tc_get_theme_options'), 10, 1);
     //get single option
     add_filter('__get_option', array($this, 'tc_opt'), 10, 2);
     //deprecated
     //some useful filters
     add_filter('__ID', array($this, 'tc_id'));
     //deprecated
     add_filter('__screen_layout', array($this, 'tc_get_layout'), 10, 2);
     //deprecated
     add_filter('__is_home', array($this, 'tc_is_home'));
     add_filter('__is_home_empty', array($this, 'tc_is_home_empty'));
     add_filter('__post_type', array($this, 'tc_get_post_type'));
     add_filter('__is_no_results', array($this, 'tc_is_no_results'));
     add_filter('__article_selectors', array($this, 'tc_article_selectors'));
     //social networks
     add_filter('__get_socials', array($this, 'tc_get_social_networks'));
     //WP filters
     add_action('after_setup_theme', array($this, 'tc_wp_filters'));
     //init properties
     add_action('after_setup_theme', array($this, 'tc_init_properties'));
 }
开发者ID:un1coin,项目名称:ovn-space,代码行数:26,代码来源:class-fire-utils.php


注:本文中的add_action函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。