本文整理汇总了PHP中do_action函数的典型用法代码示例。如果您正苦于以下问题:PHP do_action函数的具体用法?PHP do_action怎么用?PHP do_action使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_action函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_admin_bar_render
/**
* Render the admin bar to the page based on the $wp_admin_bar->menu member var.
* This is called very late on the footer actions so that it will render after anything else being
* added to the footer.
*
* It includes the action "admin_bar_menu" which should be used to hook in and
* add new menus to the admin bar. That way you can be sure that you are adding at most optimal point,
* right before the admin bar is rendered. This also gives you access to the $post global, among others.
*
* @since 3.1.0
*/
function wp_admin_bar_render()
{
global $wp_admin_bar;
if (!is_admin_bar_showing() || !is_object($wp_admin_bar)) {
return false;
}
/**
* Load all necessary admin bar items.
*
* This is the hook used to add, remove, or manipulate admin bar items.
*
* @since 3.1.0
*
* @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference
*/
do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
/**
* Fires before the admin bar is rendered.
*
* @since 3.1.0
*/
do_action('wp_before_admin_bar_render');
$wp_admin_bar->render();
/**
* Fires after the admin bar is rendered.
*
* @since 3.1.0
*/
do_action('wp_after_admin_bar_render');
}
示例2: 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());
}
示例3: polldaddy_embed_to_shortcode
function polldaddy_embed_to_shortcode($content)
{
if (false === strpos($content, 'polldaddy.com/p/')) {
return $content;
}
$regexes = array();
$regexes[] = '#<script[^>]+?src="https?://(secure|static)\\.polldaddy\\.com/p/([0-9]+)\\.js"[^>]*+>\\s*?</script>\\r?\\n?(<noscript>.*?</noscript>)?#i';
$regexes[] = '#<script(?:[^&]|&(?!gt;))+?src="https?://(secure|static)\\.polldaddy\\.com/p/([0-9]+)\\.js"(?:[^&]|&(?!gt;))*+>\\s*?</script>\\r?\\n?(<noscript>.*?</noscript>)?#i';
foreach ($regexes as $regex) {
if (!preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) {
continue;
}
foreach ($matches as $match) {
if (!isset($match[2])) {
continue;
}
$id = (int) $match[2];
if ($id > 0) {
$content = str_replace($match[0], " [polldaddy poll={$id}]", $content);
/** This action is documented in modules/shortcodes/youtube.php */
do_action('jetpack_embed_to_shortcode', 'polldaddy', $id);
}
}
}
return $content;
}
示例4: jigoshop_product_tag
function jigoshop_product_tag($attributes)
{
global $paged;
$jigoshop_options = Jigoshop_Base::get_options();
$attributes = shortcode_atts(array('tag' => '', 'per_page' => $jigoshop_options->get('jigoshop_catalog_per_page'), 'columns' => $jigoshop_options->get('jigoshop_catalog_columns'), 'orderby' => $jigoshop_options->get('jigoshop_catalog_sort_orderby'), 'order' => $jigoshop_options->get('jigoshop_catalog_sort_direction'), 'pagination' => false, 'tax_operator' => 'IN'), $attributes);
if (isset($_REQUEST['tag'])) {
$attributes['tag'] = $_REQUEST['tag'];
}
/** Operator validation. */
if (!in_array($attributes['tax_operator'], array('IN', 'NOT IN', 'AND'))) {
$tax_operator = 'IN';
}
/** Multiple category values. */
if (!empty($slug)) {
$slug = explode(',', esc_attr($slug));
$slug = array_map('trim', $slug);
}
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $attributes['per_page'], 'orderby' => $attributes['orderby'], 'order' => $attributes['order'], 'paged' => $paged, 'meta_query' => array(array('key' => 'visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')), 'tax_query' => array(array('taxonomy' => 'product_tag', 'field' => 'slug', 'terms' => $attributes['tag'], 'operator' => $attributes['tax_operator'])));
query_posts($args);
ob_start();
jigoshop_get_template_part('loop', 'shop');
if ($attributes['pagination']) {
do_action('jigoshop_pagination');
}
wp_reset_query();
return ob_get_clean();
}
示例5: ninja_forms_import_form
function ninja_forms_import_form($data)
{
global $wpdb;
$form = unserialize($data);
// change the update date to today
$form['date_updated'] = date('Y-m-d H:i:s');
// get the form fields
$form_fields = $form['field'];
unset($form['field']);
$form = apply_filters('ninja_forms_before_import_form', $form);
$form['data'] = serialize($form['data']);
$wpdb->insert(NINJA_FORMS_TABLE_NAME, $form);
$form_id = $wpdb->insert_id;
$form['id'] = $form_id;
if (is_array($form_fields)) {
for ($x = 0; $x < count($form_fields); $x++) {
$form_fields[$x]['form_id'] = $form_id;
$form_fields[$x]['data'] = serialize($form_fields[$x]['data']);
$old_field_id = $form_fields[$x]['id'];
$form_fields[$x]['id'] = NULL;
$wpdb->insert(NINJA_FORMS_FIELDS_TABLE_NAME, $form_fields[$x]);
$form_fields[$x]['id'] = $wpdb->insert_id;
$form_fields[$x]['old_id'] = $old_field_id;
$form_fields[$x]['data'] = unserialize($form_fields[$x]['data']);
}
}
$form['data'] = unserialize($form['data']);
$form['field'] = $form_fields;
do_action('ninja_forms_after_import_form', $form);
return $form['id'];
}
示例6: aiowps_daily_cron_event_handler
function aiowps_daily_cron_event_handler()
{
//Do stuff that needs checking daily
global $aio_wp_security;
$aio_wp_security->debug_logger->log_debug_cron("Cronjob_Handler - Daily cron handler got fired.");
do_action('aiowps_perform_db_cleanup_tasks');
}
示例7: after_setup_theme
/**
* Loading classes
*/
public function after_setup_theme()
{
do_action(SCF_Config::PREFIX . 'load');
require_once plugin_dir_path(__FILE__) . 'classes/models/class.meta.php';
require_once plugin_dir_path(__FILE__) . 'classes/models/class.setting.php';
require_once plugin_dir_path(__FILE__) . 'classes/models/class.group.php';
require_once plugin_dir_path(__FILE__) . 'classes/models/class.abstract-field-base.php';
require_once plugin_dir_path(__FILE__) . 'classes/models/class.revisions.php';
require_once plugin_dir_path(__FILE__) . 'classes/models/class.ajax.php';
require_once plugin_dir_path(__FILE__) . 'classes/class.scf.php';
new Smart_Custom_Fields_Revisions();
foreach (glob(plugin_dir_path(__FILE__) . 'classes/fields/*.php') as $form_item) {
include_once $form_item;
$basename = basename($form_item, '.php');
$classname = preg_replace('/^class\\.field\\-(.+)$/', 'Smart_Custom_Fields_Field_$1', $basename);
if (class_exists($classname)) {
new $classname();
}
}
do_action(SCF_Config::PREFIX . 'fields-loaded');
add_action('init', array($this, 'register_post_type'));
add_action('init', array($this, 'ajax_request'));
add_action('admin_menu', array($this, 'admin_menu'));
add_action('current_screen', array($this, 'current_screen'));
}
示例8: grid_archive_theme
function grid_archive_theme($post)
{
?>
<div class="archive-listing classic-grid">
<a href="<?php
the_permalink();
?>
">
<div style="background-image:url('<?php
if (wp_get_attachment_url(get_post_thumbnail_id($post->ID))) {
$url = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
} else {
$url = default_product_thumbnail_url();
}
echo $url;
?>
');" class="classic-grid-element"></div>
<div class="product-name"><?php
the_title();
?>
</div>
<?php
do_action('archive_price', $post);
?>
</a>
</div>
<?php
}
示例9: plugins_loaded_action
public function plugins_loaded_action()
{
$this->check_required_plugins();
if (!$this->missing_one) {
do_action('wpml_gfml_has_requirements');
}
}
示例10: comber_login_guest
function comber_login_guest()
{
if (isset($_POST['comber_user_login']) && wp_verify_nonce($_POST['comber_login_nonce'], 'comber-login-nonce')) {
// this returns the user ID and other info from the user name
$user = get_userdatabylogin($_POST['comber_user_login']);
if (!$user) {
// if the user name doesn't exist
comber_errors()->add('empty_username', __('Invalid username'));
}
if (!isset($_POST['comber_user_pass']) || $_POST['comber_user_pass'] == '') {
// if no password was entered
comber_errors()->add('empty_password', __('Please enter a password'));
}
// check the user's login with their password
if (!wp_check_password($_POST['comber_user_pass'], $user->user_pass, $user->ID)) {
// if the password is incorrect for the specified user
comber_errors()->add('empty_password', __('Incorrect password'));
}
// retrieve all error messages
$errors = comber_errors()->get_error_messages();
// only log the user in if there are no errors
if (empty($errors)) {
wp_setcookie($_POST['comber_user_login'], $_POST['comber_user_pass'], true);
wp_set_current_user($user->ID, $_POST['comber_user_login']);
do_action('wp_login', $_POST['comber_user_login']);
wp_redirect(home_url($_POST['current_page']));
exit;
} else {
wp_redirect(home_url($_POST['current_page'] . '/?login=true&fail=true'));
exit;
}
}
}
示例11: init
function init()
{
if (get_option('woocommerce_calc_shipping') != 'no') {
$this->enabled = true;
}
do_action('woocommerce_shipping_init');
$load_methods = apply_filters('woocommerce_shipping_methods', array());
// Get order option
$ordering = (array) get_option('woocommerce_shipping_method_order');
$order_end = 999;
// Load gateways in order
foreach ($load_methods as $method) {
$load_method = new $method();
if (isset($ordering[$load_method->id]) && is_numeric($ordering[$load_method->id])) {
// Add in position
$this->shipping_methods[$ordering[$load_method->id]] = $load_method;
} else {
// Add to end of the array
$this->shipping_methods[$order_end] = $load_method;
$order_end++;
}
}
ksort($this->shipping_methods);
add_action('woocommerce_update_options_shipping', array(&$this, 'process_admin_options'));
}
示例12: 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);
}
}
}
示例13: wsl_component_loginwidget_setup
function wsl_component_loginwidget_setup()
{
// HOOKABLE:
do_action("wsl_component_loginwidget_setup_start");
$sections = array('basic_settings' => 'wsl_component_loginwidget_setup_basic_settings', 'advanced_settings' => 'wsl_component_loginwidget_setup_advanced_settings', 'custom_css' => 'wsl_component_loginwidget_setup_custom_css');
$sections = apply_filters('wsl_component_loginwidget_setup_alter_sections', $sections);
foreach ($sections as $section => $action) {
add_action('wsl_component_loginwidget_setup_sections', $action);
}
?>
<div>
<?php
// HOOKABLE:
do_action('wsl_component_loginwidget_setup_sections');
?>
<br />
<div style="margin-left:5px;margin-top:-20px;">
<input type="submit" class="button-primary" value="<?php
_wsl_e("Save Settings", 'wordpress-social-login');
?>
" />
</div>
</div>
<?php
}
示例14: meta
/**
* Get Meta Data
*
* Get meta data using custom syntax with brackets.
*
* @param string $name
* @param string $fallBack
* @param bool $groups
* @param null $id
*
* @return mixed|null|string
*/
static function meta($name = '', $fallBack = '', $groups = true, $id = null)
{
if (!acpt_validate::bracket($name)) {
die("ACPT Error: You need to use brackets [{$name}]");
}
/*
* Action start_acpt_meta
*
* Do anything you want with input data before it is gotten.
*/
do_action('start_acpt_meta', $name, $fallBack, $groups, $id);
global $post;
empty($id) ? $id = $post->ID : true;
if ($groups === true) {
$data = self::get_groups($name, $id);
} else {
$data = self::get_single($name, $id);
}
/*
* Action end_acpt_meta
*
* Do anything you like with resolved data before it is returned.
*/
do_action('end_acpt_meta', $data);
empty($data) ? $data = $fallBack : true;
return $data;
}
示例15: settings_screen
public function settings_screen()
{
global $NF_Pushover;
$tabs = $this->get_settings_tabs();
$current_tab = $this->get_current_tab();
?>
<div id="<?php
echo $NF_Pushover->token;
?>
" class="wrap">
<?php
screen_icon($this->args['screen_icon']);
?>
<h2 class="nav-tab-wrapper">
<?php
echo $this->get_settings_tabs_html($tabs, $current_tab);
do_action($NF_Pushover->token . '_after_settings_tabs');
?>
</h2>
<form action="options.php" method="post">
<?php
if (is_object($NF_Pushover->settings_objs[$current_tab])) {
$NF_Pushover->settings_objs[$current_tab]->settings_screen();
} else {
_e('Invalid Settings Class', 'nf-pushover');
}
?>
</form>
</div><!--/.wrap-->
<?php
}