本文整理汇总了PHP中ShortcodeHelper::build_shortcode_tree方法的典型用法代码示例。如果您正苦于以下问题:PHP ShortcodeHelper::build_shortcode_tree方法的具体用法?PHP ShortcodeHelper::build_shortcode_tree怎么用?PHP ShortcodeHelper::build_shortcode_tree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShortcodeHelper
的用法示例。
在下文中一共展示了ShortcodeHelper::build_shortcode_tree方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pre_compile
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: meta_box_save
/**
*set status of builder (open/closed) and save the shortcodes that are used in the post
**/
public function meta_box_save()
{
if (isset($_POST['post_ID'])) {
//save if the editor is active
if (isset($_POST['aviaLayoutBuilder_active'])) {
update_post_meta((int) $_POST['post_ID'], '_aviaLayoutBuilder_active', $_POST['aviaLayoutBuilder_active']);
$_POST['content'] = ShortcodeHelper::clean_up_shortcode($_POST['content']);
}
//save the hidden container with unmodified shortcode
if (isset($_POST['_aviaLayoutBuilderCleanData'])) {
update_post_meta((int) $_POST['post_ID'], '_aviaLayoutBuilderCleanData', $_POST['_aviaLayoutBuilderCleanData']);
}
//extract all shortcodes from the post array and store them so we know what we are dealing with when the user opens a page.
//usesfull for special elements that we might need to render outside of the default loop like fullscreen slideshows
preg_match_all("/" . ShortcodeHelper::get_fake_pattern() . "/s", $_POST['content'], $matches);
if (is_array($matches) && !empty($matches[0])) {
$matches = ShortcodeHelper::build_shortcode_tree($matches);
update_post_meta((int) $_POST['post_ID'], '_avia_builder_shortcode_tree', $matches);
}
}
}