/** * DEFINE setting options of shortcode * * @return type */ public function element_shortcode($atts = null, $content = null) { /** @var JDocumentHTML $document */ $document = JFactory::getDocument(); $document->addScript(JSNPB_ELEMENT_URL . '/uniform/assets/js/uniform.js'); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/uniform/assets/css/uniform.css'); $output = ''; $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); if (!JSNPagebuilderHelpersPagebuilder::checkComponentEnabled("com_uniform")) { $html_element = JText::_('JSN_PAGEBUILDER_ELEMENT_UNIFORM_MSG_INSTALL_EASYSLIDER_AND_ENABLE'); return $this->element_wrapper($html_element, $arr_params); } // No matches, skip this $formID = $arr_params['uniform_id']; if (isset($formID)) { $output = $this->loadJSNUniform($formID, $formID); } // We should replace only first occurrence in order to allow positions with the same name to regenerate their content: $html = $output; // Disable submit button in backend $app = JFactory::getApplication(); $isAdmin = $app->isAdmin() ? true : false; if ($isAdmin) { $html .= '<input type="hidden" id="form-preview-backend" name="form_preview_backend" value="1">'; $_errorStyleSheets = array('/administrator/components/com_uniform/assets/css/form.css', 'task=generateStylePages'); $_styleSheets = $document->_styleSheets; foreach ($_styleSheets as $_key => $_value) { unset($document->_styleSheets[$_key]); foreach ($_errorStyleSheets as $_errorStyleSheet) { if (strpos($_key, $_errorStyleSheet) !== false) { $_key = preg_replace("/\\/administrator/", "", $_key); break; } } $document->_styleSheets[$_key] = $_value; } $_errorScripts = array('/administrator/components/com_uniform/assets/js/libs/json-2.3.min.js', '/administrator/components/com_uniform/assets/js/jsn_uf_jquery_safe.js', '/administrator/components/com_uniform/assets/js/jsn_uf_conflict.js', '/administrator/components/com_uniform/assets/js/form.js', '/administrator/components/com_uniform/assets/js/libs/jquery-ui-1.10.3.custom.min.js'); $_scripts = $document->_scripts; foreach ($_scripts as $_key => $_value) { unset($document->_scripts[$_key]); foreach ($_errorScripts as $_errorScript) { if (strpos($_key, $_errorScript) !== false) { $_key = preg_replace("/\\/administrator/", "", $_key); break; } } $document->_scripts[$_key] = $_value; } } else { $html .= '<input type="hidden" id="form-preview-backend" name="form_preview_backend" value="0">'; } return $this->element_wrapper($html, $arr_params); }
/** * */ public static function getAllShowCase() { $allShowCase = array(); if (JSNPagebuilderHelpersPagebuilder::checkComponentEnabled("com_imageshow")) { $db = JFactory::getDBO(); $query = 'SELECT a.showcase_title AS title, a.showcase_id AS id' . ' FROM #__imageshow_showcase AS a' . ' WHERE a.published = 1' . ' ORDER BY id'; $db->setQuery($query); $allShowCase = $db->loadAssocList('id', 'title'); } if (count($allShowCase) == 0) { $allShowCase[0] = JText::_('PLG_EDITOR_DO_NOT_HAVE_ANY_SHOWCASE'); } return $allShowCase; }
/** * DEFINE setting options of shortcode * * @return type */ public function element_shortcode($atts = null, $content = null) { $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); if (!JSNPagebuilderHelpersPagebuilder::checkComponentEnabled("com_easyslider")) { $html_element = JText::_('JSN_PAGEBUILDER_ELEMENT_EASYSLIDER_MSG_INSTALL_EASYSLIDER_AND_ENABLE'); return $this->element_wrapper($html_element, $arr_params); } $easySliderId = (int) $arr_params['easyslider_id']; /** @var JSNEasySliderRender $objJSNEasySliderRender */ $objJSNEasySliderRender = new JSNEasySliderRender(); $html = $objJSNEasySliderRender->render($easySliderId, true); return $this->element_wrapper($html, $arr_params); }
/** * Include admin scripts * * @return type */ public function backend_element_assets() { //fix conflict with com_flexicontent $flexicontent = JSNPagebuilderHelpersPagebuilder::checkComponentEnabled('com_flexicontent'); if ($flexicontent) { JSNPagebuilderHelpersFunctions::print_asset_tag(JSNPB_ELEMENT_URL . '/video/assets/css/video.css', 'css'); } else { JSNPagebuilderHelpersFunctions::print_asset_tag(JSNPB_FRAMEWORK_ASSETS . '/3rd-party/jquery-select2/select2.min.js', 'js'); JSNPagebuilderHelpersFunctions::print_asset_tag(JSNPB_FRAMEWORK_ASSETS . '/3rd-party/jquery-select2/select2.css', 'css'); } JSNPagebuilderHelpersFunctions::print_asset_tag(JSNPB_FRAMEWORK_ASSETS . '/3rd-party/jquery-colorpicker/js/colorpicker.js', 'js'); JSNPagebuilderHelpersFunctions::print_asset_tag(JSNPB_FRAMEWORK_ASSETS . '/3rd-party/jquery-colorpicker/css/colorpicker.css', 'css'); JSNPagebuilderHelpersFunctions::print_asset_tag(JSNPB_ADMIN_URL . '/assets/joomlashine/js/jsn-colorpicker.js', 'js'); JSNPagebuilderHelpersFunctions::print_asset_tag(JSNPB_ELEMENT_URL . '/video/assets/js/video-setting.js', 'js'); }
/** * */ public static function getAllUniform() { $allForm = array(); if (JSNPagebuilderHelpersPagebuilder::checkComponentEnabled("com_uniform")) { $db = JFactory::getDBO(); $query = $db->getQuery(true); //build the list of categories $query->select('uf.form_title AS title, uf.form_id AS id')->from('#__jsn_uniform_forms AS uf')->where('uf.form_state = 1'); $db->setQuery($query); $allForm = $db->loadAssocList('id', 'title'); } if (count($allForm) == 0) { $allForm[0] = JText::_('PLG_EDITOR_DO_NOT_HAVE_ANY_FORM'); } return $allForm; }
/** * */ public static function getAllSlider() { $allSlider = array(); if (JSNPagebuilderHelpersPagebuilder::checkComponentEnabled("com_easyslider")) { $db = JFactory::getDBO(); $query = $db->getQuery(true); //build the list of categories $query->select('es.slider_title AS title, es.slider_id AS id')->from('#__jsn_easyslider_sliders AS es')->where('es.published = 1'); $db->setQuery($query); $allSlider = $db->loadAssocList('id', 'title'); } if (count($allSlider) == 0) { $allSlider[0] = JText::_('PLG_EDITOR_DO_NOT_HAVE_ANY_SLIDER'); } return $allSlider; }
public static function getExtensionSupports($includeExtPlgs = true) { $config = JSNConfigHelper::get('com_pagebuilder'); $extSupportOrder = json_decode($config->extension_support); $com_advancedmodules = JSNPagebuilderHelpersPagebuilder::checkComponentEnabled('com_advancedmodules') ? array('com_advancedmodules') : ''; $flexiContent = JSNPagebuilderHelpersPagebuilder::checkComponentEnabled('com_flexicontent') ? array('com_flexicontent') : ''; $extensions = array(); if (count($extSupportOrder) > 0) { $configExtensions = json_decode($config->extension_support); $configExtensionsOrder = explode(",", $config->extension_support_order); if (count($configExtensionsOrder) > 0) { foreach ($configExtensionsOrder as $_exts) { if (in_array($_exts, $configExtensions)) { array_push($extensions, $_exts); } } } else { $extensions = $configExtensions; } } else { $extensions = array('com_content', 'com_modules'); if ($com_advancedmodules != '') { $extensions = array_merge($extensions, $com_advancedmodules); } if ($flexiContent != '') { $extensions = array_merge($extensions, $flexiContent); } if ($includeExtPlgs) { include_once JPATH_ROOT . '/administrator/components/com_pagebuilder/helpers/extensions.php'; $installedComponents = self::getInstalledComponents(); $supportList = JSNPagebuilderHelpersExtensions::getSupportedExtList(); if (count($supportList)) { foreach ($supportList as $extName => $value) { if (in_array($extName, $installedComponents)) { $extensions[] = $value->extension; } } } } } return $extensions; }
<?php /** * @version $Id$ * @package JSN_PageBuilder * @author JoomlaShine Team <*****@*****.**> * @copyright Copyright (C) 2012 JoomlaShine.com. All Rights Reserved. * @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html * * Websites: http://www.joomlashine.com * Technical Support: Feedback - http://www.joomlashine.com/contact-us/get-support.html */ // No direct access to this file. defined('_JEXEC') || die('Restricted access'); if (!JSNPagebuilderHelpersPagebuilder::checkComponentEnabled("com_easyblog")) { return; } if (JSNPbArticleListHelper::checkOldVersionEasyBlog()) { include_once JPATH_ROOT . '/components/com_easyblog/models/blogs.php'; } else { include_once JPATH_ROOT . '/administrator/components/com_easyblog/models/blogs.php'; } include_once JPATH_ROOT . '/plugins/jsnpagebuilder/defaultelements/articlelist/models/easyblogcategories.php'; /** * Model class for Easy blog posts * * @package JSN_PageBuilder * @since 1.0.0 */ class JSNPbEasyblogArticlesModel extends EasyBlogModelBlogs {
/** * Display the button * * @return */ function onDisplay($name) { $app = JFactory::getApplication(); if ($app->isSite()) { return; } include_once JPATH_ROOT . '/administrator/components/com_pagebuilder/helpers/articles.php'; $listId = JSNPagebuilderHelpersArticles::getListArticleUedPagebuilderFromPlugin(); $pbTotal = JSNPagebuilderHelpersArticles::getCountArticleUsedPageBuilderFromPlugin(); JSNPagebuilderHelpersArticles::updateArticleUsedPageBuilderToPlugin(); //Check if JoomlaShine extension framework is enabled? global $id, $option, $framework, $conf, $supported_list, $params, $random_id; // Check if JoomlaShine extension framework is enabled? $framework = JTable::getInstance('Extension'); $framework->load(array('element' => 'jsnframework', 'type' => 'plugin', 'folder' => 'system')); $isInstalledPbExtension = false; $option = JRequest::getVar('option'); $com_advancedmodules = JSNPagebuilderHelpersPagebuilder::checkComponentEnabled('com_advancedmodules') ? array('com_advancedmodules') : ''; $flexiContent = JSNPagebuilderHelpersPagebuilder::checkComponentEnabled('com_flexicontent') ? array('com_flexicontent') : ''; $supported_list = array('com_content', 'com_modules'); if ($com_advancedmodules != '') { $supported_list = array_merge($supported_list, $com_advancedmodules); } if ($flexiContent != '') { $supported_list = array_merge($supported_list, $flexiContent); } if (isset($params)) { if ($params->extension_support != '') { $supported_list = json_decode($params->extension_support); } } $installedPbExtensions = JSNPagebuilderHelpersExtensions::getPbExtensions(); if (count($installedPbExtensions)) { foreach ($installedPbExtensions as $installedPbExtension) { if ($option == "com_" . $installedPbExtension->element) { if (!$installedPbExtension->enabled) { $app->enqueueMessage(sprintf('Please enable the %s plugin before using. How to enable it, click <a href="%s" target="_blank">here</a>', 'JSN PageBuilder ' . strtoupper($installedPbExtension->element) . ' element', 'index.php?option=com_pagebuilder&view=configuration&s=maintainence&g=extensions'), 'warning'); return; } else { $isInstalledPbExtension = true; } break; } } } if ($isInstalledPbExtension) { if (!in_array($option, $supported_list)) { $app->enqueueMessage(sprintf('Please enable the JSN PageBuilder %s Extention Support before using. How to enable it, click <a href="%s" target="_blank">here</a>', strtoupper($installedPbExtension->element), 'index.php?option=com_pagebuilder&view=configuration&s=configuration&g=msgs'), 'warning'); return; } } if ($framework->extension_id && in_array($option, $supported_list)) { // Get PageBuilder configuration if (!in_array($option, $supported_list)) { $isInstalled = JSNPagebuilderHelpersExtensions::checkInstalledPlugin(str_replace('com_', '', $option)); if (!$isInstalled['isInstalled']) { return; } } // Check if it's enabled or not $isEnabled = $params->get('enable_pagebuilder', 1); if ($isEnabled) { $conf = JFactory::getConfig(); $editor = $conf->get('editor'); // Inlcude the entry js file. JSNHtmlAsset::addScript(JSNPB_ADMIN_URL . '/assets/js/joomlashine.noconflict.js'); JSNHtmlAsset::addScript(JSNPB_PLG_SYSTEM_ASSETS_URL . '3rd-party/jquery-ui/js/jquery-ui-1.10.3.custom.js'); JSNHtmlAsset::addScript(JSNPB_PLG_SYSTEM_ASSETS_URL . '3rd-party/jquery-livequery/jquery.livequery.min.js'); JSNHtmlAsset::addScript(JSNPB_ADMIN_URL . '/assets/js/builder-layout.js'); JSNHtmlAsset::addScript(JSNPB_ADMIN_URL . '/assets/joomlashine/js/jsn-modal.js'); JSNHtmlAsset::addScript(JSNPB_ADMIN_URL . '/assets/js/elements-lang.js'); JSNHtmlAsset::addScript(JSNPB_ADMIN_URL . '/assets/js/jquery.alphanumeric/jquery.alphanumeric.js'); JSNHtmlAsset::addScript(JSNPB_ADMIN_URL . '/assets/js/shortcodesetting/settings-handler.js'); JSNHtmlAsset::addScript(JSNPB_ADMIN_URL . '/assets/js/handle.js'); // Include supoported editor script switch ($editor) { case 'codemirror': JSNHtmlAsset::addScript(JURI::root(true) . '/plugins/editors-xtd/pagebuilder/assets/js/supported-editor/codemirror.js'); break; case 'tinymce': JSNHtmlAsset::addScript(JURI::root(true) . '/plugins/editors-xtd/pagebuilder/assets/js/supported-editor/tiny-mce.js'); break; case 'jce': JSNHtmlAsset::addScript(JURI::root(true) . '/plugins/editors-xtd/pagebuilder/assets/js/supported-editor/jce.js'); break; case 'jckeditor': JSNHtmlAsset::addScript(JURI::root(true) . '/plugins/editors-xtd/pagebuilder/assets/js/supported-editor/jckeditor.js'); break; case 'ckeditor': JSNHtmlAsset::addScript(JURI::root(true) . '/plugins/editors-xtd/pagebuilder/assets/js/supported-editor/ckeditor.js'); break; case 'artofeditor': JSNHtmlAsset::addScript(JURI::root(true) . '/plugins/editors-xtd/pagebuilder/assets/js/supported-editor/artofeditor.js'); break; case 'arkeditor': JSNHtmlAsset::addScript(JURI::root(true) . '/plugins/editors-xtd/pagebuilder/assets/js/supported-editor/arkeditor.js'); break; default: JSNHtmlAsset::addScript(JURI::root(true) . '/plugins/editors-xtd/pagebuilder/assets/js/supported-editor/default.js'); break; } // Generate random string to assign to switcher button $random_id = JSNPagebuilderHelpersShortcode::generateRandomString(); JSNHtmlAsset::addScript(JSNPB_ADMIN_URL . '/assets/js/entry.js'); $js = "\n\t\t\t\t\tvar Pb_Ajax\t= {};\n\n\t\t\t\t\tvar JSNPbParams = {pbstrings:{}};\n\t\t\t\t\tJSNPbParams.rootUrl = '" . JUri::root() . "';\n\t\t\t\t\tJSNPbParams.pbstrings.COPY = '" . JText::_('copy') . "';\n\t\t\t\t\tJSNPbParams.pbstrings.EMPTY = '" . JText::_('(Untitled)') . "';\n\t\t\t\t\tJSNPbParams.pbstrings.ALERT_DELETE_ROW = '" . JText::_('Are you sure you want to delete the whole row including all elements it contains?') . "';\n\t\t\t\t\tJSNPbParams.pbstrings.ALERT_DELETE_COLUMN = '" . JText::_('Are you sure you want to delete the whole column including all elements it contains?') . "';\n\t\t\t\t\tJSNPbParams.pbstrings.ALERT_DELETE_ELEMENT = '" . JText::_('Are you sure you want to delete the element?') . "';\n\t\t\t\t\tvar pb;\n\t\t\t\t\tvar pbContentStatus_{$random_id}\t= 'normal';\n\n\t\t\t\t\t// Set global pagebuilder instance\n\t\t\t\t\tvar jsnpb_{$random_id};\n\n\t\t\t\t\t// Method to switch between Joomla editor and PageBuilder\n\t\t\t\t\tfunction switchPagebuilder(id, status){\n\t\t\t\t\t\t(function (\$){\n\t\t\t\t\t\t\tif (status == 'on') {\n\t\t\t\t\t\t\t\tjsnpb_{$random_id}\t= new \$.JSNPageBuilder(id);\n\t\t\t\t\t\t\t\tpbContentStatus_{$random_id} = 'pb';\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tjsnpb_{$random_id}.transformToSource();\n\t\t\t\t\t\t\t\tpbContentStatus_{$random_id} = 'normal';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})(JoomlaShine.jQuery);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Entry button group structure which will be appended to the aditor\n\t\t\t\t\tvar pbEntryButtons\t= '<div class=\"jsn-form-bar pb-switcher-group\">'\n\t\t\t\t\t\t\t+ '<div id=\"pb-editor-switcher\" class=\"btn-group\">'\n\t\t\t\t\t\t\t+\t'<button type=\"button\" class=\"switchmode-button pb-off btn active btn-success\" id=\"pagebuilder-off-{$random_id}\" >Default Editor</button>'\n\t\t\t\t\t\t\t+\t'<button type=\"button\" class=\"switchmode-button pb-on btn\" id=\"pagebuilder-on-{$random_id}\" >PageBuilder</button>'\n\t\t\t\t\t\t\t+'</div>'\n\t\t\t\t\t\t\t+\t'<input type=\"hidden\" id=\"jform_pb_total\" name=\"jform_pb_total\" value=\"{$pbTotal}\">'\n\t\t\t\t\t\t\t+\t'<input type=\"hidden\" id=\"jform_content_id\" name=\"jform_content_id\" value=\"{$id}\">'\n\t\t\t\t\t\t\t+\t'<input type=\"hidden\" id=\"jform_list_id\" name=\"jform_list_id\" value=\"{$listId}\">'\n\t\t\t\t\t\t\t+'<div class=\"pull-right\" id=\"top-btn-actions\">'\n +'<!--<button class=\"btn btn-default page-custom-css\" onclick=\"return false;\">Custom CSS</button>-->'\n + '<input type=\"hidden\" id=\"pb_content_id\" name=\"pb_content_id\" value=\"{$id}\">'\n +'</div>'\n\t\t\t\t\t\t+'</div>';\n\n\t\t\t\t\t(function (\$){\n\t\t\t\t\t\t\$(window).load(function (){\n\t\t\t\t\t\t\$('body').find('ul#myTabTabs li:first').on('click', function(){\n\t\t\t\t\t\t\t\$('.switchmode-button.pb-off').click();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (\$('#jform_module').length)\n\t\t\t\t\t\t \t\t{\n\t\t\t\t\t\t\t\t\tif (\$('#jform_module').val() != 'mod_custom')\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t \treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\tvar editorHelper_{$random_id}\t= new \$.JSNPbEditorHelper();\n\t\t\t\t\t\t\tvar buttonGroups\t= editorHelper_{$random_id}.initEntryButtons('" . $name . "', pbEntryButtons);\n\n\t\t\t\t\t\t\t//Auto switch to PageBuilder if shortcode structure detected\n\t\t\t\t\t\t\tvar _content\t= \$('#" . $name . "').val();\n\t\t\t\t\t\t\tif (_content.indexOf('[pb_row') >= 0) {\n\t\t\t\t\t\t\t\t//setTimeout(function (){\n\t\t\t\t\t\t\t\t\t\$('.switchmode-button.pb-on', buttonGroups).click();\n\t\t\t\t\t\t\t\t//}, 500);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t})(JoomlaShine.jQuery);\n\t\t\t\t"; JSNHtmlAsset::addInlineScript($js); JSNHtmlAsset::addStyle(JSNPB_FRAMEWORK_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.9.0.custom.css'); JSNHtmlAsset::addStyle(JSNPB_FRAMEWORK_ASSETS . '/joomlashine/css/jsn-gui.css'); JSNHtmlAsset::addStyle(JSNPB_PLG_SYSTEM_ASSETS_URL . 'css/pagebuilder.css'); JSNHtmlAsset::addStyle(JSNPB_ADMIN_URL . '/assets/css/jsn-element-font.css'); JSNHtmlAsset::addStyle(JSNPB_FRAMEWORK_ASSETS . '/joomlashine/css/jsn-advanced-parameters.css'); // for text, JSNHtmlAsset::addStyle(JSNPB_ADMIN_URL . '/assets/css/settings.css'); } } }
/** * @param array $attributes * * @return array */ public static function getArticles($attributes) { $articles = array(); switch ($attributes['articlelist_source']) { case self::PB_ARTICLE_SOURCE_K2: // Check Com K2 Enabled if (!JSNPagebuilderHelpersPagebuilder::checkComponentEnabled("com_k2")) { return array(); } $k2ArticleModel = new JSNPbK2ArticlesModel(); $result = $k2ArticleModel->jsnGetData($attributes); foreach ($result as $_key => $_value) { $articles[$_key] = $_value; $articles[$_key]['direct_url'] = JRoute::_(K2HelperRoute::getItemRoute($_value['id'], $_value['catid'])); $articles[$_key]['category_direct_url'] = JRoute::_(K2HelperRoute::getCategoryRoute($_value['catid'])); $articles[$_key]['category_title'] = $_value['category']; $imageName = md5("Image" . $_value['id']); if (JFile::exists(JPATH_ROOT . '/media/k2/items/src/' . $imageName . '.jpg')) { $images = array('image_intro' => JRoute::_(JUri::root() . 'media/k2/items/cache/' . $imageName . '_XL.jpg'), 'image_intro_alt' => $_value['title']); $articles[$_key]['images'] = json_encode($images); } } break; case self::PB_ARTICLE_SOURCE_EASY: // Check EasyBlog Enabled if (!JSNPagebuilderHelpersPagebuilder::checkComponentEnabled("com_easyblog")) { return array(); } // Get version EasyBlog $attributes['is_old_version'] = self::checkOldVersionEasyBlog(); if (!$attributes['is_old_version']) { include_once JPATH_ROOT . '/administrator/components/com_easyblog/includes/post/post.php'; } $easyArticleModel = new JSNPbEasyblogArticlesModel(); $result = $easyArticleModel->jsnGetData($attributes); foreach ($result as $_key => $_value) { $articles[$_key] = $_value; $articles[$_key]['direct_url'] = JRoute::_(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $_value['id'])); $articles[$_key]['category_direct_url'] = JRoute::_(EasyBlogRouter::_('index.php?option=com_easyblog&view=categories&layout=listings&id=' . $_value['category_id'])); if ($attributes['is_old_version']) { $articles[$_key]['introtext'] = $_value['intro']; $imageData = json_decode($_value['image'], true); if (!is_null($imageData) && isset($imageData['title']) && isset($imageData['url'])) { $images = array('image_intro' => JRoute::_($imageData['url']), 'image_intro_alt' => $imageData['title']); $articles[$_key]['images'] = json_encode($images); } } else { $_blog = new EasyBlogPost((int) $_value['id']); $articles[$_key]['introtext'] = $_blog->getIntro(); $images = array('image_intro' => JRoute::_($_blog->getImage('original', true, true)), 'image_intro_alt' => $_value['title']); $articles[$_key]['images'] = json_encode($images); } } break; default: $articlesModel = new JSNPbArticlesModel(); $result = $articlesModel->getArticlesByAttributes($attributes); foreach ($result as $_key => $_value) { $articles[$_key] = $_value; $articles[$_key]['direct_url'] = JRoute::_(ContentHelperRoute::getArticleRoute($_value['id'], $_value['catid'])); $articles[$_key]['category_direct_url'] = JRoute::_(ContentHelperRoute::getCategoryRoute($_value['catid'])); } break; } return $articles; }
/** * DEFINE shortcode content * * @param null $attributes * @param mixed $content * @return string */ function element_shortcode($attributes = null, $content = null) { $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $attributes); extract($arr_params); if (!JSNPagebuilderHelpersPagebuilder::checkComponentEnabled("com_imageshow")) { $html_element = "<p class='jsn-bglabel'>" . JText::_('JSN_PAGEBUILDER_ELEMENT_IMAGESHOW_MSG_INSTALL_IMAGESHOW_AND_ENABLE') . '</p>'; return $this->element_wrapper($html_element, $arr_params); } /** @var JSNISUtils $objUtils */ $objUtils = JSNISFactory::getObj('classes.jsn_is_utils'); /** @var JSNISShow $objJSNShow */ $objJSNShow = JSNISFactory::getObj('classes.jsn_is_show'); /** @var JSNISShowcase $objJSNShowcase */ $objJSNShowcase = JSNISFactory::getObj('classes.jsn_is_showcase'); /** @var JSNISShowlist $objJSNShowlist */ $objJSNShowlist = JSNISFactory::getObj('classes.jsn_is_showlist'); /** @var JSNISImages $objJSNImages */ $objJSNImages = JSNISFactory::getObj('classes.jsn_is_images'); $language = ''; $shortEdition = $objUtils->getShortEdition(); if ($objUtils->checkSupportLang()) { $objLanguage = JFactory::getLanguage(); $language = $objLanguage->getTag(); } $html = ''; $width = !isset($attributes['width_value']) ? '' : $attributes['width_value'] . $attributes['width_unit']; $height = !isset($attributes['height']) ? '' : $attributes['height']; $showListID = isset($attributes['imageshow_showlist']) ? (int) $attributes['imageshow_showlist'] : 0; $showCaseID = isset($attributes['imageshow_showcase']) ? (int) $attributes['imageshow_showcase'] : 0; if ($showListID == 0) { $html_element = "<p class='jsn-bglabel'>" . JText::_("JSN_PAGEBUILDER_ELEMENT_IMAGESHOW_MSG_CREATE_SHOWLIST") . '</p>'; return $this->element_wrapper($html_element, $arr_params); } if ($showCaseID == 0) { $html_element = "<p class='jsn-bglabel'>" . JText::_('JSN_PAGEBUILDER_ELEMENT_IMAGESHOW_MSG_CREATE_SHOWCASE') . '</p>'; return $this->element_wrapper($html_element, $arr_params); } $showlistInfo = $objJSNShowlist->getShowListByID($showListID); if (is_null($showlistInfo)) { $missingDataBox = $objUtils->displayShowlistMissingMessage(); } $showcaseInfo = $objJSNShowcase->getShowCaseByID($showCaseID); if (is_null($showcaseInfo)) { $missingDataBox = $objUtils->displayShowcaseMissingMessage(); } $themeProfile = false; if ($showcaseInfo) { /** @var JSNISShowcaseTheme $objJSNTheme */ $objJSNTheme = JSNISFactory::getObj('classes.jsn_is_showcasetheme'); $themeProfile = $objJSNTheme->getThemeProfile($showcaseInfo->showcase_id); } if (!$themeProfile) { $missingDataBox = $objUtils->displayThemeMissingMessage(); } if (!is_null($showcaseInfo) && !is_null($showlistInfo) && $themeProfile) { $width = $width != '' ? $width : @$showcaseInfo->general_overall_width; $width = $width != '' ? $width : '100%'; $height = $height != '' ? $height : @$showcaseInfo->general_overall_height; $height = $height != '' ? $height : '450'; $imagesData = $objJSNImages->getImagesByShowlistID($showlistInfo['showlist_id']); $posPercentageWidth = strpos($width, '%'); if ($posPercentageWidth) { $width = substr($width, 0, $posPercentageWidth + 1); } else { $width = (int) $width; } $height = (int) $height; $object = new stdClass(); $object->width = $width; $object->height = $height; $object->showlist_id = $showListID; $object->showcase_id = $showCaseID; $object->item_id = 0; $object->random_number = $objUtils->randSTR(8); $object->language = $language; $object->edition = $shortEdition; $object->images = $imagesData; $object->showlist = $showlistInfo; $object->showcase = $showcaseInfo; $object->theme_id = $themeProfile->theme_id; $object->theme_name = $themeProfile->theme_name; $object->plugin = true; $html .= '<div class="jsn-container">'; $html .= '<div class="jsn-gallery">'; $result = $objJSNTheme->displayTheme($object); if (JFactory::$application->isAdmin()) { $result = str_replace(JUri::root() . "administrator/", JUri::root(), $result); } if ($result !== false) { $html .= $result; } $html .= '</div>'; $html .= '</div>'; $html_element = $html; } else { $html_element = $missingDataBox; } return $this->element_wrapper($html_element, $arr_params); }
/** * @return array */ public static function getArticleListEasyAuthors() { if (!JSNPagebuilderHelpersPagebuilder::checkComponentEnabled("com_easyblog")) { return array(); } self::loadEasyblogLibraries(); $authorModel = new JSNPbAuthorsModel(); $result = $authorModel->getAuthorsHaveArticle('easy_article'); $listAuthor = array(); foreach ($result as $_key => $_value) { $listAuthor[$_key] = $_value['name']; } return $listAuthor; }
// No direct access to this file defined('_JEXEC') or die('Restricted access'); JHtml::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_content/helpers/html'); JHtml::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_modules/helpers/html'); $user = JFactory::getUser(); $userId = $user->get('id'); include_once JPATH_ROOT . '/administrator/components/com_pagebuilder/helpers/extensions.php'; include_once JPATH_ROOT . '/administrator/components/com_pagebuilder/helpers/pagebuilder.php'; $config = JSNConfigHelper::get('com_pagebuilder'); $extSupport = array('com_content', 'com_modules', 'com_advancedmodules'); if (isset($config->extension_support)) { if ($config->extension_support != '') { $extSupport = json_decode($config->extension_support); } } $com_modules = JSNPagebuilderHelpersPagebuilder::checkComponentEnabled('com_advancedmodules') ? 'com_advancedmodules' : 'com_modules'; if (!count($extSupport)) { ?> <div class="jsn-bootstrap3"> <div class="pb-element-container"> <p class="jsn-bglabel"><?php echo JText::_('JSN_PAGEBUILDER_BUILDER_MANAGER_MSG_ENABLE_EXT'); ?> </p> <div style="text-align: center"> <a href="index.php?option=com_pagebuilder&view=configuration" target="" class="btn-primary btn-large btn"> <?php echo JText::_('JSN_PAGEBUILDER_BUILDER_SETTING_CONFIG'); ?>