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; }
protected function getInput() { require_once JSNPB_ADMIN_PATH . '/helpers/extensions.php'; require_once JSNPB_ADMIN_PATH . '/helpers/pagebuilder.php'; $supportedExtList = JSNPagebuilderHelpersExtensions::getSupportedExtList(); JSNHtmlAsset::addStyle(JSNPB_PLG_SYSTEM_ASSETS_URL . 'css/pagebuilder.css'); JSNHtmlAsset::addScript('http://code.jquery.com/jquery-2.1.0.min.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_PLG_SYSTEM_ASSETS_URL . 'js/joomlashine.noconflict.js'); JSNHtmlAsset::addScript(JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/jquery-tipsy/jquery.tipsy.js'); JSNHtmlAsset::addScript(JSNPB_ASSETS_URL . 'js/configuration/extmanager.js'); $customScript = "var baseUrl = '" . JURI::root() . "';"; JSNHtmlAsset::addInlineScript($customScript); if (count($supportedExtList)) { $installedComponents = JSNPagebuilderHelpersPagebuilder::getInstalledComponents(); foreach ($supportedExtList as $key => $ext) { $_shortName = str_ireplace("com_", "", $key); $ext->name = $_shortName; $ext->comInstalled = in_array($key, $installedComponents) ? true : false; $extStatus = JSNPagebuilderHelpersExtensions::checkInstalledPlugin($_shortName); if ($extStatus['isInstalled']) { $ext->plgInstalled = true; $ext->enabled = $extStatus['isEnabled']; } else { $ext->plgInstalled = false; $ext->enabled = false; } $list[$_shortName] = $ext; } } $html[] = '<div class="jsn-supported-ext-list"> <input type="hidden" id="label-disable" value="' . JText::_('JSN_PAGEBUILDER_EXTPAGE_DISABLE') . '"> <input type="hidden" id="label-enable" value="' . JText::_('JSN_PAGEBUILDER_EXTPAGE_ENABLE') . '"> <input type="hidden" id="label-install" value="' . JText::_('JSN_PAGEBUILDER_EXTPAGE_INSTALL') . '"> '; $html[] = '<ul class="thumbnails">'; foreach ($list as $ext) { $_className = ''; $_alt = ''; $posibleAct = ''; $_id = JSN_PAGEBUILDER_EXT_IDENTIFIED_NAME_PREFIX . $ext->name; if (!$ext->plgInstalled) { if (!$ext->comInstalled) { $_className = 'item-locked'; $_alt = JText::_('JSN_PAGEBUILDER_EXTPAGE_COM_NOT_INSTALLED_EXPLAIN'); $posibleAct = '<a class="btn btn-primary disabled"' . JText::_('JSN_PAGEBUILDER_EXTPAGE_COM_NOT_INSTALLED_EXPLAIN') . '">' . JText::_('JSN_PAGEBUILDER_EXTPAGE_INSTALL') . '</a>'; } else { $_className = 'item-locked'; $_alt = JText::_('JSN_PAGEBUILDER_EXTPAGE_COM_NOT_INSTALLED_EXPLAIN'); $posibleAct = '<a class="btn btn-primary" id="' . $_id . '" act="install" href="#">' . JText::_('JSN_PAGEBUILDER_EXTPAGE_INSTALL') . '</a>'; } } else { if ($ext->plgInstalled) { if (!$ext->enabled) { $_className = 'item-installed item-disabled'; $_alt = JText::_('JSN_PAGEBUILDER_EXTPAGE_CLICK_TO_ENABLED'); $posibleAct = '<a class="btn btn-primary" id="' . $_id . '" act="enable" href="#">' . JText::_('JSN_PAGEBUILDER_EXTPAGE_ENABLE') . '</a>'; } else { $_className = 'item-installed item-enabled'; $_alt = JText::_('JSN_PAGEBUILDER_EXTPAGE_CLICK_TO_DISABLE'); $posibleAct = '<a class="btn btn-primary" id="' . $_id . '" act="disable" href="#">' . JText::_('JSN_PAGEBUILDER_EXTPAGE_DISABLE') . '</a>'; } } else { $_className = 'item-notinstalled'; $_alt = JText::_('JSN_PAGEBUILDER_EXTPAGE_CLICK_TO_INSTALL'); $posibleAct = '<a class="btn btn-primary" id="' . $_id . '" act="install" href="#">' . JText::_('JSN_PAGEBUILDER_EXTPAGE_INSTALL') . '</a>'; } } $html[] = '<li class="span4"> <div class="thumbnail"> <img src="' . $ext->thumbnail . '" alt=""> <div class="caption"> <h2>' . ucfirst($ext->name) . ' </h2> <p>' . $posibleAct . '</p> </div> </div> </li>'; } $html[] = '</ul>'; $html[] = '</div>'; return implode($html); }