本文整理汇总了PHP中_wp_call_all_hook函数的典型用法代码示例。如果您正苦于以下问题:PHP _wp_call_all_hook函数的具体用法?PHP _wp_call_all_hook怎么用?PHP _wp_call_all_hook使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_wp_call_all_hook函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apply_filters_ref_array
function apply_filters_ref_array($tag, $args)
{
global $wp_filter, $merged_filters, $wp_current_filter;
// Do 'all' actions first
if (isset($wp_filter['all'])) {
$wp_current_filter[] = $tag;
$all_args = func_get_args();
_wp_call_all_hook($all_args);
}
if (!isset($wp_filter[$tag])) {
if (isset($wp_filter['all'])) {
array_pop($wp_current_filter);
}
return $args[0];
}
if (!isset($wp_filter['all'])) {
$wp_current_filter[] = $tag;
}
// Sort
if (!isset($merged_filters[$tag])) {
ksort($wp_filter[$tag]);
$merged_filters[$tag] = true;
}
reset($wp_filter[$tag]);
do {
foreach ((array) current($wp_filter[$tag]) as $the_) {
if (!is_null($the_['function'])) {
$args[0] = call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
}
}
} while (next($wp_filter[$tag]) !== false);
array_pop($wp_current_filter);
return $args[0];
}
示例2: apply_filters_if_white
function apply_filters_if_white($tag, $value)
{
global $wp_filter, $merged_filters, $wp_current_filter;
$args = array();
// Do 'all' actions first
if (isset($wp_filter['all'])) {
$wp_current_filter[] = $tag;
$args = func_get_args();
_wp_call_all_hook($args);
}
if (!isset($wp_filter[$tag])) {
if (isset($wp_filter['all'])) {
array_pop($wp_current_filter);
}
return $value;
}
if (!isset($wp_filter['all'])) {
$wp_current_filter[] = $tag;
}
// Sort
if (!isset($merged_filters[$tag])) {
ksort($wp_filter[$tag]);
$merged_filters[$tag] = true;
}
reset($wp_filter[$tag]);
if (empty($args)) {
$args = func_get_args();
}
do {
foreach ((array) current($wp_filter[$tag]) as $the_) {
if (!is_null($the_['function']) and $this->white($the_['function'])) {
// HACK
$args[1] = $value;
$value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));
}
}
} while (next($wp_filter[$tag]) !== false);
array_pop($wp_current_filter);
return $value;
}
示例3: do_action_ref_array
/**
* Execute functions hooked on a specific action hook, specifying arguments in an array.
*
* @since 2.1.0
*
* @see do_action() This function is identical, but the arguments passed to the
* functions hooked to $tag< are supplied using an array.
* @global array $wp_filter Stores all of the filters
* @global array $wp_actions Increments the amount of times action was triggered.
* @global array $wp_current_filter Stores the list of current filters with the current one last
*
* @param string $tag The name of the action to be executed.
* @param array $args The arguments supplied to the functions hooked to `$tag`.
*/
function do_action_ref_array($tag, $args)
{
global $wp_filter, $wp_actions, $wp_current_filter;
if (!isset($wp_actions[$tag])) {
$wp_actions[$tag] = 1;
} else {
++$wp_actions[$tag];
}
// Do 'all' actions first
if (isset($wp_filter['all'])) {
$wp_current_filter[] = $tag;
$all_args = func_get_args();
_wp_call_all_hook($all_args);
}
if (!isset($wp_filter[$tag])) {
if (isset($wp_filter['all'])) {
array_pop($wp_current_filter);
}
return;
}
if (!isset($wp_filter['all'])) {
$wp_current_filter[] = $tag;
}
$wp_filter[$tag]->do_action($args);
array_pop($wp_current_filter);
}
示例4: do_action_ref_array
/**
* Execute functions hooked on a specific action hook, specifying arguments in an array.
*
* @see do_action() This function is identical, but the arguments passed to the
* functions hooked to <tt>$tag</tt> are supplied using an array.
*
* @package MiniYun
* @subpackage Plugin
* @since 1.0
* @global array $wp_filter Stores all of the filters
* @global array $wp_actions Increments the amount of times action was triggered.
*
* @param string $tag The name of the action to be executed.
* @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt>
* @return null Will return null if $tag does not exist in $wp_filter array
*/
function do_action_ref_array($tag, $args)
{
$wp_filter = Yii::app()->hook->wp_filter;
$wp_actions = Yii::app()->hook->wp_actions;
$merged_filters = Yii::app()->hook->merged_filters;
$wp_current_filter = Yii::app()->hook->wp_current_filter;
if (!isset($wp_actions)) {
$wp_actions = array();
}
if (!isset($wp_actions[$tag])) {
$wp_actions[$tag] = 1;
} else {
++$wp_actions[$tag];
}
// Do 'all' actions first
if (isset($wp_filter['all'])) {
$wp_current_filter[] = $tag;
$all_args = func_get_args();
_wp_call_all_hook($all_args);
}
if (!isset($wp_filter[$tag])) {
if (isset($wp_filter['all'])) {
array_pop($wp_current_filter);
}
return;
}
if (!isset($wp_filter['all'])) {
$wp_current_filter[] = $tag;
}
// Sort
if (!isset($merged_filters[$tag])) {
ksort($wp_filter[$tag]);
$merged_filters[$tag] = true;
}
reset($wp_filter[$tag]);
do {
foreach ((array) current($wp_filter[$tag]) as $the_) {
if (!is_null($the_['function'])) {
call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
}
}
} while (next($wp_filter[$tag]) !== false);
array_pop($wp_current_filter);
Yii::app()->hook->wp_filter = $wp_filter;
Yii::app()->hook->wp_actions = $wp_actions;
Yii::app()->hook->merged_filters = $merged_filters;
Yii::app()->hook->wp_current_filter = $wp_current_filter;
}
示例5: do_action_ref_array
/**
* Execute functions hooked on a specific action hook, specifying arguments in an array.
*
* @see do_action() This function is identical, but the arguments passed to the
* functions hooked to <tt>$tag</tt> are supplied using an array.
*
* @since 2.1.0
*
* @global array $wp_filter Stores all of the filters
* @global array $wp_actions Increments the amount of times action was triggered.
*
* @param string $tag The name of the action to be executed.
* @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt>
* @return null Will return null if $tag does not exist in $wp_filter array
*/
function do_action_ref_array($tag, $args)
{
global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
if (!isset($wp_actions[$tag])) {
$wp_actions[$tag] = 1;
} else {
++$wp_actions[$tag];
}
// Do 'all' actions first
if (isset($wp_filter['all'])) {
$wp_current_filter[] = $tag;
$all_args = func_get_args();
_wp_call_all_hook($all_args);
}
if (!isset($wp_filter[$tag])) {
if (isset($wp_filter['all'])) {
array_pop($wp_current_filter);
}
return;
}
if (!isset($wp_filter['all'])) {
$wp_current_filter[] = $tag;
}
// Sort
if (!isset($merged_filters[$tag])) {
ksort($wp_filter[$tag]);
$merged_filters[$tag] = true;
}
reset($wp_filter[$tag]);
do {
foreach ((array) current($wp_filter[$tag]) as $the_) {
if (!is_null($the_['function'])) {
// if($tag=='admin_bar_menu'){
// echo $the_['function'] .':';
// print_r( array_slice($args, 0, (int) $the_['accepted_args']) . '<br>');
// }
call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
}
}
} while (next($wp_filter[$tag]) !== false);
array_pop($wp_current_filter);
}