コード例 #1
0
ファイル: shortcode.php プロジェクト: zulfnore/WR-PageBuilder
 /**
  * List of WR shortcode tags, seperating by '|', to use in regular expression
  *
  * @global array $Wr_Pb_Shortcodes
  * @global string $sc_tag
  * @return string
  */
 public static function regex_wr_sc_tag($sc_tag = '')
 {
     if (empty($sc_tag)) {
         global $Wr_Pb_Shortcodes;
         $wr_shortcode_tags = !empty($Wr_Pb_Shortcodes) ? $Wr_Pb_Shortcodes : WR_Pb_Helper_Shortcode::wr_pb_shortcode_tags();
         $tagnames = array_keys($wr_shortcode_tags);
     } else {
         $tagnames = (array) $sc_tag;
     }
     $tagregexp = join('|', array_map('preg_quote', $tagnames));
     return $tagregexp;
 }
コード例 #2
0
ファイル: core.php プロジェクト: zulfnore/WR-PageBuilder
 /**
  * Register all Parent & No-child element, for Add Element popover
  */
 function register_element()
 {
     global $Wr_Pb_Shortcodes;
     $current_shortcode = WR_Pb_Helper_Functions::current_shortcode();
     $Wr_Pb_Shortcodes = !empty($Wr_Pb_Shortcodes) ? $Wr_Pb_Shortcodes : WR_Pb_Helper_Shortcode::wr_pb_shortcode_tags();
     foreach ($Wr_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 = WR_Pb_Helper_Shortcode::get_shortcode_class($name);
             if (class_exists($class)) {
                 $element = new $class();
                 $this->set_element($type, $class, $element);
                 //				$this->register_sub_el( $class, 1 );
             }
         }
     }
 }