Пример #1
0
 /**
  * Function to sync sub-shortcode content become sub-shortcode array
  *
  * @param array $arr_shortcodes
  */
 private function sync_sub_content($sub_shortcode = '')
 {
     $document = JFactory::getDocument();
     JSNPagebuilderHelpersFunctions::loadFancyboxJS();
     JSNPagebuilderHelpersFunctions::print_asset_tag(JSNPB_FRAMEWORK_ASSETS . '/3rd-party/jquery-tipsy/jquery.tipsy.js', 'text/javascript');
     JSNPagebuilderHelpersFunctions::print_asset_tag(JSNPB_FRAMEWORK_ASSETS . '/3rd-party/jquery-tipsy/tipsy.css', 'text/css');
     $document->addStyleSheet(JSNPB_ELEMENT_URL . '/pricingtable/assets/css/pricingtable_frontend.css', 'text/css');
     $document->addScript(JSNPB_ELEMENT_URL . '/pricingtable/assets/js/pricingtable_frontend.js', 'text/javascript');
     $arr_shortcodes = array();
     if (!$sub_shortcode) {
         return;
     }
     // Convert to sub-shortcode array
     $arr_sub_shortcode = $arr_values = array();
     $pattern = '\\[(\\[?)(pb_pricingtableattr_item)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)';
     preg_match_all("/{$pattern}/s", $sub_shortcode, $matches);
     $arr_sub_shortcode['pb_pricingtableattr_item'] = $matches[0];
     if (isset($arr_sub_shortcode['pb_pricingtableattr_item']) && is_array($arr_sub_shortcode['pb_pricingtableattr_item'])) {
         $arr_shortcodes['pb_pricingtableattr_item'] = implode('', $arr_sub_shortcode['pb_pricingtableattr_item']);
     }
     $pattern = '\\[(\\[?)(pb_pricingtable_item)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)';
     preg_match_all("/{$pattern}/s", $sub_shortcode, $matches);
     $arr_sub_shortcode['pb_pricingtable_item'] = $matches[0];
     if (isset($arr_sub_shortcode['pb_pricingtable_item']) && is_array($arr_sub_shortcode['pb_pricingtable_item'])) {
         foreach ($arr_sub_shortcode['pb_pricingtable_item'] as $i => $item) {
             $pattern = '\\[(\\[?)(pb_pricingtable_item_item)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)';
             preg_match_all("/{$pattern}/s", $item, $matches);
             $arr_values['pb_pricingtable_item_item'] = $matches[0];
             $count = count($arr_values['pb_pricingtable_item_item']);
             $_item = preg_replace("/{$pattern}/s", '<!--pb-replace-flag-->', $item);
             // Simulate mechanism process sub-shortcode in modal template
             $sub_sc_data = JSNPBShortcodePricingTableItem::_sub_items_filter($arr_values, 'pb_pricingtable_item', $arr_sub_shortcode['pb_pricingtableattr_item']);
             if (isset($sub_sc_data['pb_pricingtable_item_item']) && is_array($sub_sc_data['pb_pricingtable_item_item'])) {
                 $str_pr_tbl_shortcode = str_replace(str_repeat('<!--pb-replace-flag-->', $count), implode('', $sub_sc_data['pb_pricingtable_item_item']), $_item);
             }
             $str_pr_tbl_shortcode = str_replace('"prtbl_item_attr_value', '" prtbl_item_attr_value', $str_pr_tbl_shortcode);
             $arr_shortcodes['pb_pricingtable_item'][] = $str_pr_tbl_shortcode;
         }
     }
     return $arr_shortcodes;
 }
Пример #2
0
 /**
  * Function to sync sub-shortcode content become sub-shortcode array
  *
  * @param array $arr_shortcodes
  */
 private function sync_sub_content($sub_shortcode = '')
 {
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         $this->load_assets_frontend();
     }
     $arr_shortcodes = array();
     if (!$sub_shortcode) {
         return;
     }
     // Convert to sub-shortcode array
     $arr_sub_shortcode = $arr_values = array();
     $pattern = '\\[(\\[?)(pb_pricingtableattr_item)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)';
     preg_match_all("/{$pattern}/s", $sub_shortcode, $matches);
     $arr_sub_shortcode['pb_pricingtableattr_item'] = $matches[0];
     if (isset($arr_sub_shortcode['pb_pricingtableattr_item']) && is_array($arr_sub_shortcode['pb_pricingtableattr_item'])) {
         $arr_shortcodes['pb_pricingtableattr_item'] = implode('', $arr_sub_shortcode['pb_pricingtableattr_item']);
     }
     $pattern = '\\[(\\[?)(pb_pricingtable_item)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)';
     preg_match_all("/{$pattern}/s", $sub_shortcode, $matches);
     $arr_sub_shortcode['pb_pricingtable_item'] = $matches[0];
     if (isset($arr_sub_shortcode['pb_pricingtable_item']) && is_array($arr_sub_shortcode['pb_pricingtable_item'])) {
         foreach ($arr_sub_shortcode['pb_pricingtable_item'] as $i => $item) {
             $pattern = '\\[(\\[?)(pb_pricingtable_item_item)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)';
             preg_match_all("/{$pattern}/s", $item, $matches);
             $arr_values['pb_pricingtable_item_item'] = $matches[0];
             $count = count($arr_values['pb_pricingtable_item_item']);
             $_item = preg_replace("/{$pattern}/s", '<!--pb-replace-flag-->', $item);
             // Simulate mechanism process sub-shortcode in modal template
             $sub_sc_data = JSNPBShortcodePricingTableItem::_sub_items_filter($arr_values, 'pb_pricingtable_item', $arr_sub_shortcode['pb_pricingtableattr_item']);
             if (isset($sub_sc_data['pb_pricingtable_item_item']) && is_array($sub_sc_data['pb_pricingtable_item_item'])) {
                 $str_pr_tbl_shortcode = str_replace(str_repeat('<!--pb-replace-flag-->', $count), implode('', $sub_sc_data['pb_pricingtable_item_item']), $_item);
             }
             $str_pr_tbl_shortcode = str_replace('"prtbl_item_attr_value', '" prtbl_item_attr_value', $str_pr_tbl_shortcode);
             $arr_shortcodes['pb_pricingtable_item'][] = $str_pr_tbl_shortcode;
         }
     }
     return $arr_shortcodes;
 }