• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP has_action函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testWL_Metabox_constructor

 function testWL_Metabox_constructor()
 {
     $metabox = new WL_Metabox();
     // Verify the object has hooked correctly (default priority for hooks is 10)
     $this->assertEquals(10, has_action('add_meta_boxes', array($metabox, 'add_main_metabox')));
     $this->assertEquals(10, has_action('wl_linked_data_save_post', array($metabox, 'save_form_data')));
 }
开发者ID:Byrlyne,项目名称:wordlift-plugin,代码行数:7,代码来源:test-metaboxes.php


示例2: __construct

 /**
  * Constructor
  * 
  * @access public
  * @since 1.0.0
  */
 public function __construct($version)
 {
     $this->options = $this->_initOptions();
     $this->version = $version;
     //Actions
     add_action('init', array($this, 'init'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_scripts'));
     add_filter('plugin_action_links_' . plugin_basename(dirname(__FILE__) . '/init.php'), array($this, 'action_links'));
     add_action('woocommerce_settings_tabs_yith_wcas', array($this, 'print_plugin_options'));
     add_action('woocommerce_update_options_yith_wcas', array($this, 'update_options'));
     add_action('woocommerce_admin_field_banner', array($this, 'admin_fields_banner'));
     if (!has_action('woocommerce_admin_field_slider')) {
         add_action('woocommerce_admin_field_slider', array($this, 'admin_fields_slider'));
     }
     if (!has_action('woocommerce_admin_field_picker')) {
         add_action('woocommerce_admin_field_picker', array($this, 'admin_fields_picker'));
     }
     add_action('woocommerce_update_option_slider', array($this, 'admin_update_option'));
     add_action('woocommerce_update_option_picker', array($this, 'admin_update_option'));
     //Filters
     add_filter('woocommerce_settings_tabs_array', array($this, 'add_tab_woocommerce'), 30);
     //add_filter( 'woocommerce_catalog_settings', array( $this, 'add_catalog_image_size' ) );
     //Apply filters
     $this->banner_url = apply_filters('yith_wcas_banner_url', $this->banner_url);
     // YITH WCAS Loaded
     do_action('yith_wcas_loaded');
 }
开发者ID:epiii,项目名称:aros,代码行数:33,代码来源:class.yith-wcas-admin.php


示例3: set_theme_option

 /**
  * Sets option defaults
  *
  * @since 1.7.0
  */
 function set_theme_option()
 {
     // Load settings
     $optionsframework_settings = get_option('optionsframework');
     // Updates the unique option id in the database if it has changed
     if (function_exists('optionsframework_option_name')) {
         optionsframework_option_name();
     } elseif (has_action('optionsframework_option_name')) {
         do_action('optionsframework_option_name');
     } else {
         $default_themename = get_option('stylesheet');
         $default_themename = preg_replace("/\\W/", "_", strtolower($default_themename));
         $default_themename = 'optionsframework_' . $default_themename;
         if (isset($optionsframework_settings['id'])) {
             if ($optionsframework_settings['id'] == $default_themename) {
                 // All good, using default theme id
             } else {
                 $optionsframework_settings['id'] = $default_themename;
                 update_option('optionsframework', $optionsframework_settings);
             }
         } else {
             $optionsframework_settings['id'] = $default_themename;
             update_option('optionsframework', $optionsframework_settings);
         }
     }
 }
开发者ID:onenonlycasper,项目名称:infinitum,代码行数:31,代码来源:class-options-framework.php


示例4: __construct

 /**
  * Build The Layout
  */
 function __construct($args = array(), PL_Platform $platform)
 {
     $this->platform = $platform;
     $defaults = array('title' => '', 'callback' => false, 'page_slug' => '', 'config' => array(), 'render' => 'settings');
     $this->set = wp_parse_args($args, $defaults);
     /** Gets the control array */
     $this->config = isset($this->set['callback']) && $this->set['callback'] ? call_user_func($this->set['callback']) : $this->set['config'];
     $this->current_tab_slug = isset($_GET['sel_tab']) ? $_GET['sel_tab'] : 'default';
     $this->settings_tab_slug = isset($_GET['settings_tab']) ? $_GET['settings_tab'] : 'default';
     $tab_default = array('title' => '', 'groups' => false, 'mode' => 'banner');
     $current_tab_info = isset($this->config[$this->current_tab_slug]) ? $this->config[$this->current_tab_slug] : current($this->config);
     $this->current_tab_config = wp_parse_args($current_tab_info, $tab_default);
     $this->current_page = $this->platform->tab();
     // Draw the thing
     $this->build_header();
     // if not logged in and user is a super admin.. show banner to connect account
     if ('account' == $this->current_page && !$this->platform->oauth->is_connected() && is_super_admin()) {
         $this->platform_banner();
     } elseif (has_action('pl_ui_build_body')) {
         do_action('pl_ui_build_body', $this);
     } else {
         $this->build_body();
     }
     $this->build_footer();
 }
开发者ID:voomco,项目名称:WordPress,代码行数:28,代码来源:ui.php


示例5: render_admin_page_contents

 public function render_admin_page_contents()
 {
     $tab = $this->get_active_tab();
     switch ($tab) {
         case 'general':
             $this->render_general_tab();
             break;
         case 'csv-importer':
             $this->render_csv_tab();
             break;
         default:
             include Tribe__Events__Importer__Plugin::path('src/io/csv/admin-views/header.php');
             if (has_action('tribe-import-render-tab-' . $tab)) {
                 /**
                  * Remove this Action on 4.3
                  * @deprecated
                  */
                 _doing_it_wrong('tribe-import-render-tab-' . $tab, sprintf(esc_html__('This Action has been deprecated, to comply with WordPress Standards we are now using Underscores (_) instead of Dashes (-). From: "%s" To: "%s"', 'the-events-calendar'), 'tribe-import-render-tab-' . $tab, 'tribe_import_render_tab_' . $tab), '4.0');
                 do_action('tribe-import-render-tab-' . $tab);
             }
             do_action('tribe_import_render_tab_' . $tab);
             include Tribe__Events__Importer__Plugin::path('src/io/csv/admin-views/footer.php');
             break;
     }
 }
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:25,代码来源:Admin_Page.php


示例6: __construct

 /**
  * 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'));
     }
 }
开发者ID:Idealien,项目名称:wordpress-fields-api,代码行数:38,代码来源:class-wp-customize-control.php


示例7: handle_deprecation

 public static function handle_deprecation($data)
 {
     // determine the current filter
     $current_filter = current_filter();
     // figure out if the current filter is actually in our map list
     if (isset(self::$map[$current_filter])) {
         // get a list of this function call's args, for use when calling deprecated filters
         $args = func_get_args();
         array_unshift($args, null);
         // get the list of all the potential old filters
         $old_filters = (array) self::$map[$current_filter];
         // for each matching old filter we have..
         foreach ($old_filters as $old_filter_info) {
             list($old_filter, $deprecation_version) = $old_filter_info;
             // if there is a register function on that old filter
             if (has_action($old_filter)) {
                 // then call those register functions
                 $args[0] = $old_filter;
                 $data = call_user_func_array('apply_filters', $args);
                 // pop the deprecation message
                 _deprecated_function(sprintf(__('The "%s" filter', 'opentickets-community-edition'), $old_filter), $deprecation_version, sprintf(__('The "%s" filter', 'opentickets-community-edition'), $current_filter));
             }
         }
     }
     return $data;
 }
开发者ID:Jayriq,项目名称:opentickets-community,代码行数:26,代码来源:deprecated.php


示例8: save_schemes_into_option

 /**
  * Save schemes to option allow front-end query
  */
 function save_schemes_into_option()
 {
     global $_wp_admin_css_colors;
     if (count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker')) {
         update_option('wp_admin_color_schemes', $_wp_admin_css_colors);
     }
 }
开发者ID:0aveRyan,项目名称:american-admin-schemes,代码行数:10,代码来源:american-admin-schemes.php


示例9: __construct

 public function __construct()
 {
     //load conf data into stack
     $this->_get_conf();
     if (is_admin()) {
         //  update notices
         $this->readme_URL = 'http://plugins.trac.wordpress.org/browser/fv-wordpress-flowplayer/trunk/readme.txt?format=txt';
         if (!has_action('in_plugin_update_message-fv-wordpress-flowplayer/flowplayer.php')) {
             add_action('in_plugin_update_message-fv-wordpress-flowplayer/flowplayer.php', array(&$this, 'plugin_update_message'));
         }
         //  pointer boxes
         parent::__construct();
     }
     // define needed constants
     if (!defined('FV_FP_RELATIVE_PATH')) {
         define('FV_FP_RELATIVE_PATH', flowplayer::get_plugin_url());
         $vid = 'http://' . $_SERVER['SERVER_NAME'];
         if (dirname($_SERVER['PHP_SELF']) != '/') {
             $vid .= dirname($_SERVER['PHP_SELF']);
         }
         define('VIDEO_DIR', '/videos/');
         define('VIDEO_PATH', $vid . VIDEO_DIR);
     }
     add_filter('fv_flowplayer_caption', array($this, 'get_duration_playlist'), 10, 3);
     add_filter('fv_flowplayer_inner_html', array($this, 'get_duration_video'), 10, 2);
     add_filter('fv_flowplayer_video_src', array($this, 'get_amazon_secure'), 10, 2);
     add_filter('fv_flowplayer_css_writeout', array($this, 'css_writeout_option'));
     add_action('wp_enqueue_scripts', array($this, 'css_enqueue'));
     add_action('admin_enqueue_scripts', array($this, 'css_enqueue'));
     add_filter('post_rewrite_rules', array($this, 'rewrite_embed'));
     add_filter('page_rewrite_rules', array($this, 'rewrite_embed'));
     add_filter('query_vars', array($this, 'rewrite_vars'));
     add_filter('init', array($this, 'rewrite_check'));
     add_action('template_redirect', array($this, 'template_embed'));
 }
开发者ID:nikitansk,项目名称:devschool,代码行数:35,代码来源:flowplayer.php


示例10: __invoke

 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;
 }
开发者ID:JonathanAJ,项目名称:Seara-da-Ciencia-UFC,代码行数:27,代码来源:birch.php


示例11: init

 /**
  * Bootstraps the class and hooks required actions & filters.
  *
  * @since 2.0
  */
 public static function init()
 {
     self::$paypal_settings = self::get_options();
     // wc-api handler for express checkout transactions
     if (!has_action('woocommerce_api_wcs_paypal')) {
         add_action('woocommerce_api_wcs_paypal', __CLASS__ . '::handle_wc_api');
     }
     // When necessary, set the PayPal args to be for a subscription instead of shopping cart
     add_action('woocommerce_update_options_payment_gateways_paypal', __CLASS__ . '::reload_options', 100);
     // When necessary, set the PayPal args to be for a subscription instead of shopping cart
     add_action('woocommerce_update_options_payment_gateways_paypal', __CLASS__ . '::are_reference_transactions_enabled', 100);
     // When necessary, set the PayPal args to be for a subscription instead of shopping cart
     add_filter('woocommerce_paypal_args', __CLASS__ . '::get_paypal_args', 10, 2);
     // Check a valid PayPal IPN request to see if it's a subscription *before* WCS_Gateway_Paypal::successful_request()
     add_action('valid-paypal-standard-ipn-request', __CLASS__ . '::process_ipn_request', 0);
     add_action('woocommerce_scheduled_subscription_payment_paypal', __CLASS__ . '::process_subscription_payment', 10, 2);
     // Don't copy over PayPal details to Resubscribe Orders
     add_filter('wcs_resubscribe_order_created', __CLASS__ . '::remove_resubscribe_order_meta', 10, 2);
     // Triggered by WCS_SV_API_Base::broadcast_request() whenever an API request is made
     add_action('wc_paypal_api_request_performed', __CLASS__ . '::log_api_requests', 10, 2);
     add_filter('woocommerce_subscriptions_admin_meta_boxes_script_parameters', __CLASS__ . '::maybe_add_change_payment_method_warning');
     WCS_PayPal_Supports::init();
     WCS_PayPal_Status_Manager::init();
     WCS_PayPal_Standard_Switcher::init();
     if (is_admin()) {
         WCS_PayPal_Admin::init();
         WCS_PayPal_Change_Payment_Method_Admin::init();
     }
 }
开发者ID:DustinHartzler,项目名称:TheCLEFT,代码行数:34,代码来源:class-wcs-paypal.php


示例12: __construct

 function __construct($theme)
 {
     $this->theme = $theme;
     // Don't bother doing this stuff if the current user lacks permissions
     if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) {
         return;
     }
     // Add only in Rich Editor mode
     if (get_user_option('rich_editing') == 'true') {
         add_filter('mce_external_plugins', array($this, 'oxy_add_mce_shortcode_plugin'));
         add_filter('mce_buttons', array(&$this, 'oxy_add_mce_shortcode_button'));
     }
     // enqueue scripts & styles
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     // add tinyMCE shortcode plugin
     add_action('admin_init', array(&$this, 'oxy_add_mce_shortcode'));
     // add action for loading shortcode page
     add_action('wp_ajax_oxy_shortcodes', array(&$this, 'oxy_load_mce_shortcode_page'));
     // add action for loading shortcode page
     add_action('wp_ajax_oxy_shortcode_preview', array(&$this, 'oxy_load_mce_shortcode_preview'));
     // add action for loading menu data
     add_action('wp_ajax_oxy_shortcodes_menu', array(&$this, 'oxy_load_mce_shortcode_menu'));
     // remove wordpress 3.6 action that is undocumented and throws notices.
     if (has_action('admin_enqueue_scripts', 'wp_auth_check_load')) {
         remove_action('admin_enqueue_scripts', 'wp_auth_check_load');
     }
 }
开发者ID:vanie3,项目名称:appland,代码行数:27,代码来源:shortcode-admin.php


示例13: wc_do_deprecated_action

/**
 * Runs a deprecated action with notice only if used.
 *
 * @since  2.7.0
 * @param  string $action
 * @param  array $args
 * @param  string $deprecated_in
 * @param  string $replacement
 */
function wc_do_deprecated_action($action, $args, $deprecated_in, $replacement)
{
    if (has_action($action)) {
        wc_deprecated_function('Action: ' . $action, $deprecated_in, $replacement);
        do_action_ref_array($action, $args);
    }
}
开发者ID:shivapoudel,项目名称:woocommerce,代码行数:16,代码来源:wc-deprecated-functions.php


示例14: maybe_show_admin_notices

 /**
  * Display an assortment of notices to administrators to encourage them to get PayPal setup right.
  *
  * @since 2.0
  */
 public static function maybe_show_admin_notices()
 {
     self::maybe_disable_invalid_profile_notice();
     self::maybe_update_credentials_error_flag();
     if (!in_array(get_woocommerce_currency(), apply_filters('woocommerce_paypal_supported_currencies', array('AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB')))) {
         $valid_for_use = false;
     } else {
         $valid_for_use = true;
     }
     $payment_gateway_tab_url = admin_url('admin.php?page=wc-settings&tab=checkout&section=wc_gateway_paypal');
     $notices = array();
     if ($valid_for_use && 'yes' == WCS_PayPal::get_option('enabled') && !has_action('admin_notices', 'WC_Subscriptions_Admin::admin_installed_notice') && current_user_can('manage_options')) {
         if (!WCS_PayPal::are_credentials_set()) {
             $notices[] = array('type' => 'warning', 'text' => sprintf(esc_html__('PayPal is inactive for subscription transactions. Please %1$sset up the PayPal IPN%2$s and %3$senter your API credentials%4$s to enable PayPal for Subscriptions.', 'woocommerce-subscriptions'), '<a href="http://docs.woothemes.com/document/subscriptions/store-manager-guide/#section-4" target="_blank">', '</a>', '<a href="' . esc_url($payment_gateway_tab_url) . '">', '</a>'));
         } elseif ('woocommerce_page_wc-settings' === get_current_screen()->base && isset($_GET['tab']) && in_array($_GET['tab'], array('subscriptions', 'checkout')) && !WCS_PayPal::are_reference_transactions_enabled()) {
             $notices[] = array('type' => 'warning', 'text' => sprintf(esc_html__('%1$sPayPal Reference Transactions are not enabled on your account%2$s, some subscription management features are not enabled. Please contact PayPal and request they %3$senable PayPal Reference Transactions%4$s on your account. %5$sCheck PayPal Account%6$s  %7$sLearn more %8$s', 'woocommerce-subscriptions'), '<strong>', '</strong>', '<a href="http://docs.woothemes.com/document/subscriptions/store-manager-guide/#section-4" target="_blank">', '</a>', '</p><p><a class="button" href="' . esc_url(wp_nonce_url(add_query_arg('wcs_paypal', 'check_reference_transaction_support'), __CLASS__)) . '">', '</a>', '<a class="button button-primary" href="http://docs.woothemes.com/document/subscriptions/store-manager-guide/#section-4" target="_blank">', '&raquo;</a>'));
         }
         if (isset($_GET['wcs_paypal']) && 'rt_enabled' === $_GET['wcs_paypal']) {
             $notices[] = array('type' => 'confirmation', 'text' => sprintf(esc_html__('%1$sPayPal Reference Transactions are enabled on your account%2$s. All subscription management features are now enabled. Happy selling!', 'woocommerce-subscriptions'), '<strong>', '</strong>'));
         }
         if (false !== get_option('wcs_paypal_credentials_error')) {
             $notices[] = array('type' => 'error', 'text' => sprintf(esc_html__('There is a problem with PayPal. Your API credentials may be incorrect. Please update your %1$sAPI credentials%2$s. %3$sLearn more%4$s.', 'woocommerce-subscriptions'), '<a href="' . esc_url($payment_gateway_tab_url) . '">', '</a>', '<a href="https://support.woothemes.com/hc/en-us/articles/202882473#paypal-credentials" target="_blank">', '</a>'));
         }
         if ('yes' == get_option('wcs_paypal_invalid_profile_id')) {
             $notices[] = array('type' => 'error', 'text' => sprintf(esc_html__('There is a problem with PayPal. Your PayPal account is issuing out-of-date subscription IDs. %1$sLearn more%2$s. %3$sDismiss%4$s.', 'woocommerce-subscriptions'), '<a href="https://support.woothemes.com/hc/en-us/articles/202882473#old-paypal-account" target="_blank">', '</a>', '<a href="' . esc_url(add_query_arg('wcs_disable_paypal_invalid_profile_id_notice', 'true')) . '">', '</a>'));
         }
     }
     if (!empty($notices)) {
         include_once dirname(__FILE__) . '/../templates/admin-notices.php';
     }
 }
开发者ID:DustinHartzler,项目名称:TheCLEFT,代码行数:36,代码来源:class-wcs-paypal-admin.php


示例15: test_file_hooks

 /**
  * Test if all the file hooks are working.
  *
  * @since 1.0
  */
 public function test_file_hooks()
 {
     $this->assertNotFalse(has_action('wp_enqueue_scripts', 'give_load_scripts'));
     $this->assertNotFalse(has_action('wp_enqueue_scripts', 'give_register_styles'));
     $this->assertNotFalse(has_action('admin_enqueue_scripts', 'give_load_admin_scripts'));
     $this->assertNotFalse(has_action('admin_head', 'give_admin_icon'));
 }
开发者ID:wordimpress,项目名称:give,代码行数:12,代码来源:tests-scripts.php


示例16: format_module

 protected static function format_module($module_slug)
 {
     $module_data = Jetpack::get_module($module_slug);
     $module = array();
     $module['id'] = $module_slug;
     $module['active'] = Jetpack::is_module_active($module_slug);
     $module['name'] = $module_data['name'];
     $module['short_description'] = $module_data['description'];
     $module['sort'] = $module_data['sort'];
     $module['introduced'] = $module_data['introduced'];
     $module['changed'] = $module_data['changed'];
     $module['free'] = $module_data['free'];
     $module['module_tags'] = $module_data['module_tags'];
     // Fetch the HTML formatted long description
     ob_start();
     if (Jetpack::is_active() && has_action('jetpack_module_more_info_connected_' . $module_slug)) {
         /** This action is documented in class.jetpack-modules-list-table.php */
         do_action('jetpack_module_more_info_connected_' . $module_slug);
     } else {
         /** This action is documented in class.jetpack-modules-list-table.php */
         do_action('jetpack_module_more_info_' . $module_slug);
     }
     $module['description'] = ob_get_clean();
     return $module;
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:25,代码来源:class.jetpack-json-api-modules-endpoint.php


示例17: test_sync_initalize_Jetpack_Sync_Action_on_init

 public function test_sync_initalize_Jetpack_Sync_Action_on_init()
 {
     // prioroty should be set so that plugins can set their own filers initialize the whitelist_filter before.
     // Priority is set earlier now plugins_loaded but we plugins should still be able to set whitelist_filters by
     // using the plugins_loaded action.
     $this->assertEquals(90, has_action('plugins_loaded', array('Jetpack_Sync_Actions', 'init')));
 }
开发者ID:automattic,项目名称:jetpack,代码行数:7,代码来源:test_class.jetpack-sync-options.php


示例18: rtp_has_postmeta

/**
 * Checks whether the post meta div needs to be displayed or not
 *
 * @uses $rtp_post_comments Post Comments DB array
 * @uses $post Post Data
 * @param string $position Specify the position of the post meta (u/l)
 *
 * @since rtPanel 2.1
 */
function rtp_has_postmeta($position = 'u')
{
    global $post, $rtp_post_comments;
    $can_edit = get_edit_post_link() ? 1 : 0;
    $flag = 0;
    // Show Author?
    if ($rtp_post_comments['post_author_' . $position]) {
        $flag++;
    } elseif ($rtp_post_comments['post_date_' . $position]) {
        $flag++;
    } elseif (get_the_category_list() && $rtp_post_comments['post_category_' . $position]) {
        $flag++;
    } elseif (get_the_tag_list() && $rtp_post_comments['post_tags_' . $position]) {
        $flag++;
    } else {
        if ($can_edit && $position == 'u') {
            $flag++;
        } elseif ((has_action('rtp_hook_begin_post_meta_top') || has_action('rtp_hook_end_post_meta_top') && $can_edit) && $position == 'u') {
            $flag++;
        } elseif ((has_action('rtp_hook_begin_post_meta_bottom') || has_action('rtp_hook_end_post_meta_bottom')) && $position == 'l') {
            $flag++;
        } else {
            // Show Custom Taxonomies?
            $args = array('_builtin' => false);
            $taxonomies = get_taxonomies($args, 'names');
            foreach ($taxonomies as $taxonomy) {
                if (get_the_terms($post->ID, $taxonomy) && isset($rtp_post_comments['post_' . $taxonomy . '_' . $position]) && $rtp_post_comments['post_' . $taxonomy . '_' . $position]) {
                    $flag++;
                }
            }
        }
    }
    return $flag;
}
开发者ID:Phillydevs,项目名称:rtpanel,代码行数:43,代码来源:rtp-default-functions.php


示例19: __construct

 function __construct($args = array())
 {
     //Load defaults
     $defaults = array('pagehooks' => array(), 'pass1' => 'pass1', 'pass2' => 'pass2', 'button_id' => 'pb_generate_password', 'password_length' => 12, 'special_chars' => true, 'extra_special_chars' => false);
     $args = wp_parse_args($args, $defaults);
     extract($args);
     $this->pass1 = $pass1;
     $this->pass2 = $pass2;
     $this->button_id = $button_id;
     $this->password_length = $password_length;
     $this->special_chars = $special_chars;
     $this->extra_special_chars = $extra_special_chars;
     $this->plugin_url = rtrim(plugin_dir_url(__FILE__), '/');
     //Add actions based on page detection
     if (is_string($pagehooks)) {
         add_action('admin_print_scripts-' . $pagehooks, array(&$this, 'load_scripts'));
         add_action('admin_print_styles-' . $pagehooks, array(&$this, 'load_scripts'));
     } elseif (is_array($pagehooks)) {
         foreach ($pagehooks as $hook) {
             add_action('admin_print_scripts-' . $hook, array(&$this, 'load_scripts'));
             add_action('admin_print_styles-' . $hook, array(&$this, 'load_scripts'));
         }
         //end foreach
     }
     //end $pagehooks
     if (!has_action('wp_ajax_pb_generate_password', array(&$this, 'ajax_generate_password'))) {
         add_action('wp_ajax_pb_generate_password', array(&$this, 'ajax_generate_password'));
     }
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:29,代码来源:passwords.php


示例20: test_add_hooks

 /**
  * @covers Two_Factor_Core::add_hooks
  */
 public function test_add_hooks()
 {
     Two_Factor_Core::add_hooks();
     $this->assertGreaterThan(0, has_action('init', array('Two_Factor_Core', 'get_providers')));
     $this->assertGreaterThan(0, has_action('login_form_validate_2fa', array('Two_Factor_Core', 'login_form_validate_2fa')));
     $this->assertGreaterThan(0, has_action('login_form_backup_2fa', array('Two_Factor_Core', 'backup_2fa')));
 }
开发者ID:kraftbj,项目名称:two-factor,代码行数:10,代码来源:class.two-factor-core.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP has_actual_page_access函数代码示例发布时间:2022-05-15
下一篇:
PHP has_access_to_entity函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap