本文整理汇总了PHP中ShortcodeHelper::tree方法的典型用法代码示例。如果您正苦于以下问题:PHP ShortcodeHelper::tree方法的具体用法?PHP ShortcodeHelper::tree怎么用?PHP ShortcodeHelper::tree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShortcodeHelper
的用法示例。
在下文中一共展示了ShortcodeHelper::tree方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function pre_compile($content)
{
global $shortcode_tags;
//in case we got none/more than one postcontent elements make sure that replacement doesnt get executed/onle gets executed once
if (strpos($content, 'av_postcontent') === false) {
return $content;
}
//save the "real" shortcode array
$old_sc = $shortcode_tags;
//execute only this single shortcode and return the result
$shortcode_tags = array($this->config['shortcode'] => array($this, 'shortcode_handler'));
$content = do_shortcode($content);
//re create the old shortcode pattern
$shortcode_tags = $old_sc;
//$content = preg_replace("!\[av_postcontent.*?\]!","",$content);
//now we need to re calculate the shortcode tree so that all elements that are pulled from different posts also get the correct location
$pattern = str_replace('av_postcontent', 'av_psprocessed', ShortcodeHelper::get_fake_pattern());
preg_match_all("/" . $pattern . "/s", $content, $matches);
ShortcodeHelper::$tree = ShortcodeHelper::build_shortcode_tree($matches);
return $content;
}
示例2: template_redirect
/**
*function that checks if a dynamic template exists and uses that template instead of the default page template
**/
public function template_redirect()
{
global $avia_config;
$post_id = @get_the_ID();
if ($post_id && is_singular() || isset($avia_config['builder_redirect_id'])) {
if (!empty($avia_config['builder_redirect_id'])) {
$post_id = $avia_config['builder_redirect_id'];
}
ShortcodeHelper::$tree = get_post_meta($post_id, '_avia_builder_shortcode_tree', true);
if ('active' == get_post_meta($post_id, '_aviaLayoutBuilder_active', true) && ($template = locate_template('template-builder.php', false))) {
$avia_config['conditionals']['is_builder'] = true;
//only redirect if no custom template is set
$template_file = get_post_meta($post_id, '_wp_page_template', true);
if ("default" == $template_file || empty($template_file)) {
$avia_config['conditionals']['is_builder_template'] = true;
require_once $template;
exit;
}
}
//if a custom page was passed and the template builder is not active redirect to the default page template
if (isset($avia_config['builder_redirect_id'])) {
if ($template = locate_template('page.php', false)) {
require_once $template;
exit;
}
}
}
}
示例3: foreach
function post_has_layerslider()
{
if (!is_singular()) {
return false;
}
if (empty(ShortcodeHelper::$tree)) {
$id = @get_the_ID();
if (!$id) {
return false;
}
ShortcodeHelper::$tree = get_post_meta($id, '_avia_builder_shortcode_tree', true);
}
if (is_array(ShortcodeHelper::$tree)) {
foreach (ShortcodeHelper::$tree as $sc) {
if ($sc['tag'] == 'av_layerslider') {
return true;
}
}
}
//script below excluded. creates to many layout errors
//is the user tries to use the default layerslider shortcode also include the slider
global $post;
if (!empty($post->post_content) && strpos($post->post_content, "[layerslider") !== false) {
return true;
}
/*
*/
return false;
}
示例4: template_redirect
/**
*function that checks if a dynamic template exists and uses that template instead of the default page template
**/
public function template_redirect()
{
$post_id = @get_the_ID();
if ($post_id && is_singular()) {
ShortcodeHelper::$tree = get_post_meta($post_id, '_avia_builder_shortcode_tree', true);
if ('active' == get_post_meta($post_id, '_aviaLayoutBuilder_active', true) && ($template = locate_template('template-builder.php', false))) {
global $avia_config;
$avia_config['conditionals']['is_builder'] = true;
//only redirect if no custom template is set
$template_file = get_post_meta($post_id, '_wp_page_template', true);
if ("default" == $template_file || empty($template_file)) {
$avia_config['conditionals']['is_builder_template'] = true;
require_once $template;
exit;
}
}
}
}