/** *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; }