本文整理汇总了PHP中ShortcodeHelper::pattern方法的典型用法代码示例。如果您正苦于以下问题:PHP ShortcodeHelper::pattern方法的具体用法?PHP ShortcodeHelper::pattern怎么用?PHP ShortcodeHelper::pattern使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShortcodeHelper
的用法示例。
在下文中一共展示了ShortcodeHelper::pattern方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
*creates the shortcode pattern that only matches Avia Builder Shortcodes
**/
static function build_pattern($predefined_tags = false)
{
global $shortcode_tags;
//save the "real" shortcode array
$old_sc = $shortcode_tags;
//if we got allowed shortcodes build the pattern. nested shortcodes are also considered but within a separate array
if (!empty(ShortcodeHelper::$allowed_shortcodes)) {
$shortcode_tags = array_flip(array_merge(ShortcodeHelper::$allowed_shortcodes, ShortcodeHelper::$nested_shortcodes));
}
//filter out all elements that are not in the predefined tags array. this is necessary for nested shortcode modal to work properly
if (is_array($predefined_tags)) {
$predefined_tags = array_flip($predefined_tags);
$shortcode_tags = shortcode_atts($predefined_tags, $shortcode_tags);
}
//create the pattern and store it
ShortcodeHelper::$pattern = get_shortcode_regex();
//restore original shortcode tags
$shortcode_tags = $old_sc;
return ShortcodeHelper::$pattern;
}