/** * Register all Parent & No-child element, for Add Element popover */ function register_element() { global $Ig_Pb_Shortcodes; $current_shortcode = IG_Pb_Helper_Functions::current_shortcode(); $Ig_Pb_Shortcodes = !empty($Ig_Pb_Shortcodes) ? $Ig_Pb_Shortcodes : IG_Pb_Helper_Shortcode::ig_pb_shortcode_tags(); foreach ($Ig_Pb_Shortcodes as $name => $sc_info) { $arr = explode('_', $name); $type = $sc_info['type']; if (!$current_shortcode || !is_admin() || in_array($current_shortcode, $arr) || !$current_shortcode && $type == 'layout') { $class = IG_Pb_Helper_Shortcode::get_shortcode_class($name); $element = new $class(); $this->set_element($type, $class, $element); // $this->register_sub_el( $class, 1 ); } } }
/** * List of IG shortcode tags, seperating by '|', to use in regular expression * * @global array $Ig_Pb_Shortcodes * @global string $sc_tag * @return string */ public static function regex_ig_sc_tag($sc_tag = '') { if (empty($sc_tag)) { global $Ig_Pb_Shortcodes; $ig_shortcode_tags = !empty($Ig_Pb_Shortcodes) ? $Ig_Pb_Shortcodes : IG_Pb_Helper_Shortcode::ig_pb_shortcode_tags(); $tagnames = array_keys($ig_shortcode_tags); } else { $tagnames = (array) $sc_tag; } $tagregexp = join('|', array_map('preg_quote', $tagnames)); return $tagregexp; }