/** * Generate html for PageBuilder layout. * * @return string */ public function html() { $helper = new JSNPagebuilderHelpersBuilder(); JSNHtmlAsset::addScript(JSNPB_ADMIN_URL . '/assets/js/elements-lang.js'); JSNHtmlAsset::addScript(JSNPB_ADMIN_URL . '/assets/js/handle.js'); JSNHtmlAsset::addScript(JSNPB_ADMIN_URL . '/assets/js/shortcodesetting/settings-handler.js'); // Genrate pagebuilder element template. $helper->generateElementColumnTemplate(); $helper->generateElementRowTemplate(); $source_content = ''; $data = array(); $source_content = $_POST['form_data']; // Remove all p tags which auto added by the editor $source_content = JSNPagebuilderHelpersShortcode::removeAutop($source_content); $source_content = html_entity_decode($source_content, ENT_COMPAT, 'UTF-8'); $html[] = '<link rel="stylesheet" href="' . JSNPB_ADMIN_URL . '/assets/css/jsn-element-font.css' . '" type="text/css" />'; $html[] = '<link rel="stylesheet" href="' . JSNPB_ADMIN_URL . '/assets/css/pb-layout-font.css' . '" type="text/css" />'; $html[] = '<div id="form-container" class="jsn-layout jsn-section-content">'; if ($source_content) { //$shortcodeTags = $helper->getShortcodeTags(); $html[] = $helper->generateShortCode($source_content); } else { $html[] = $helper->getRowStructure(); } $html[] = '<a href="javascript:void(0);" id="jsn-add-container" class="jsn-add-more jsn-add-more-row"><i class="icon-plus"></i> Add Row </a>'; /** * Show thumbnail for default layouts */ $html[] = '<div class="row-fluid pb-layout-thumbs">'; $layouts = JSNPBShortcodeRow::$layouts; foreach ($layouts as $columns) { $columns_name = implode('x', $columns); $icon_class = implode('-', $columns); $data_columns = implode(',', $columns); $icon_class = 'pb-layout-' . $icon_class; $icon = '<i class="' . $icon_class . '"></i>'; $html[] = '<div class="thumb-wrapper" data-columns="' . $data_columns . '" title="' . $columns_name . '">' . $icon . '</div>'; } $html[] = '</div>'; $html[] = JSNHtmlGenerate::footer(array(), false); $html[] = '</div>'; $html[] = $helper->getAddShortcodesPopup(); if (defined("JSN_PAGEBUILDER_EDITION")) { if (strtolower(JSN_PAGEBUILDER_EDITION) == "free") { if (file_exists(JPATH_ROOT . '/administrator/components/com_pagebuilder/helpers/articles.php')) { include_once JPATH_ROOT . '/administrator/components/com_pagebuilder/helpers/articles.php'; $pbTotal = JSNPagebuilderHelpersArticles::getCountArticleUsedPageBuilderFromPlugin(); if ($pbTotal >= 5 && !JFactory::getApplication()->input->getInt('article_id') && JFactory::getApplication()->input->getInt('is_com_modules') != 1) { $html = array(); $html[] = '<div class="jsn-bootstrap3"><div class="pb-element-container"><p class="jsn-bglabel">You have reached 5 pages limit of using JSN PageBuilder.</p><p style="font-size: 20px;text-align: center;color: #d3d3d3;">Please to upgrade <a target=\'_blank\' href=\'' . JSN_PAGEBUILDER_INFO_LINK . '\'>Pro version</a> or remove your old pages that used JSN PageBuilder.</p><div style="text-align: center"><a href="index.php?option=com_pagebuilder&view=upgrade" target="_blank" class="btn-primary btn-large btn"> Upgrade </a></div></div></div>'; } } } } print_r(implode("\n", $html)); exit; }