public static function getComponents() { if ($_GET['template']) { header('Content-Type: application/json'); echo Zo2Factory::getFramework()->getComponents($_GET['template']); } }
/** * Init our framework */ public function onAfterRoute() { if ($this->_isZo2()) { include_once __DIR__ . '/framework/includes/bootstrap.php'; Zo2Framework::getInstance()->init(); Zo2Factory::joomlaHook(); Zo2Factory::ajax(); } }
/** * Profile remove */ public function remove() { $framework = Zo2Factory::getFramework(); $id = $framework->template->id; $profile = Zo2Factory::getProfile(); if ($profile->delete()) { $this->_redirect(JRoute::_('index.php?option=com_templates&view=style&layout=edit&id=' . $id, false), JText::_('PLG_ZO2_PROFILE_DELETED')); } }
/** * Admin layout builder * @return type */ public function builder() { $assets = Zo2Assets::getInstance(); $assets->addScript('vendor/bootbox-3.3.0.min.js'); $assets->addScript('zo2/js/adminlayout.min.js'); $assets->addStyleSheet('vendor/bootstrap/core/css/bootstrap.gridsystem.css'); /** * @uses Anything need prepred for display will put here. Do not put process code insite layout template file */ $html = new Zo2Html(); $params = Zo2Framework::getInstance()->template->params; $profile = Zo2Factory::getProfile(); if (is_object($profile->layout)) { $layoutData = $profile->layout->layout; } else { $layoutData = $profile->layout; } $html->set('params', $params); $html->set('layoutData', $layoutData); return $html->fetch('admin/body/sidebar/builder/layout.php'); }
/** * Do build asset file * @param type $assets * @param type $position * @param type $type */ private function _buildAssets($assets, $position, $type) { if (count($assets) > 0) { foreach ($assets as $inputName) { /* Zo2 assets */ if ($position == CORE) { $inputFile = Zo2Factory::getPath('zo2://assets/zo2/development/' . $type . '/' . $inputName, 'path'); } elseif ($position == TEMPLATE) { /* Template assets */ $inputFile = Zo2Factory::getPath('templates://assets/zo2/development/' . $type . '/' . $inputName, 'path'); } if ($inputFile) { if ($type == 'less') { $this->_compileLess($inputFile); } elseif ($type == 'js') { $this->_compileJs($inputFile); } } } } }
public function deleteProfile() { if ($this->_isAuthorized()) { $profile = JFactory::getApplication()->input->getString('profile'); $templateId = JFactory::getApplication()->input->getInt('id'); $template = Zo2Factory::getTemplate($templateId); if ($template) { $profile = JPATH_ROOT . '/templates/' . $template->template . '/assets/profiles/' . $profile . '.json'; if (JFile::delete($profile)) { $this->_ajax->addExecute('location.reload();'); } } } $this->_ajax->response(); }
<?php /** * Zo2 (http://www.zootemplate.com/zo2) * A powerful Joomla template framework * * @link http://www.zootemplate.com/zo2 * @link https://github.com/cleversoft/zo2 * @author ZooTemplate <http://zootemplate.com> * @copyright Copyright (c) 2014 CleverSoft (http://cleversoft.co/) * @license GPL v2 */ defined('_JEXEC') or die; Zo2Factory::import('vendor.less.lessc'); Zo2Factory::import('vendor.minify.css'); Zo2Factory::import('vendor.minify.minifier'); /** * Class exists checking */ if (!class_exists('Zo2HelperCompiler')) { /** * */ class Zo2HelperCompiler { /** * Compile less -> css * @param str $inputFile * @param str $outputFile * @return boolean */
/** * Load profile by name * @param string $file * @return boolean */ public function load($name) { /* Load profile under profiles root dir */ /* Load from profiles directory of assets namespace */ $profileFile = Zo2Factory::getPath('assets://profiles/' . $name . '.json'); /* If asked file is not exists than load default */ if ($profileFile == false) { $profileFile = Zo2Factory::getPath('assets://profiles/' . self::DEFAULT_PROFILE_NAME . '.json'); } /* Profile file is existed */ if ($profileFile) { Zo2Factory::addLog('Loading profile', $profileFile); /* Load profile data by use json file */ $this->loadFile($profileFile); // Layout $layout = $this->get('layout'); if (is_string($layout)) { $layout = json_decode($layout); $this->set('layout', $layout); } // Menu config $menu_config = $this->get('menu_config'); if (is_string($menu_config)) { $menu_config = json_decode($menu_config); $this->set('menu_config', $menu_config); } // Theme $theme = $this->get('theme'); if (is_string($theme)) { $theme = json_decode($theme); $this->set('theme', $theme); } $this->_profileFile = $profileFile; return $this->isValid(); } return false; }
/** * Zo2 (http://www.zootemplate.com/zo2) * A powerful Joomla template framework * * @version 1.4.3 * @since 1.4.3 * @uses For Joomla! 3.x * @link http://www.zootemplate.com/zo2 * @link https://github.com/cleversoft/zo2 * @author ZooTemplate <http://zootemplate.com> * @copyright Copyright (c) 2014 CleverSoft (http://cleversoft.co/) * @license GPL v2 */ defined('_JEXEC') or die('Restricted access'); $currentProfile = Zo2Factory::getProfile(); $url = JUri::getInstance(); $url->setVar('zo2_task', 'admin.downloadBackup'); $downloadProfileUrl = $url->toString(); ?> <div class="row-fluid"> <div class="span12"> <!-- Zo2 Messsage --> <div id="zo2-messages" class="zo2-messages wrapper"> </div> <!-- Overlay --> <div id="zo2-overlay" class="zo2-overlay hide"> <span class="zo2-overlay-loadding"></span> </div> <!-- Navbar --> <div class="navbar">
/** * * @param type $isAdmin * @return string */ function renderMenu($isAdmin = false) { $this->isAdmin = $isAdmin; $prefix = '<nav data-zo2selectable="navbar" class="wrap zo2-menu navbar navbar-default" role="navigation"> <div class="navbar-collapse collapse">'; $suffix = '</div></nav>'; $html = ''; $menuConfig = Zo2Factory::getProfile()->getMenuConfig(); $hover = ' data-hover="' . $menuConfig->get('hover_type') . '"'; $animation = $menuConfig->get('animation'); $duration = $menuConfig->get('duration', 300); if ((int) $duration <= 0) { $duration = 300; } $class = 'class="zo2-megamenu' . ($animation ? ' animate ' . $animation : '') . '"'; $data = $animation && $duration ? ' data-duration="' . $duration . '"' : ''; if (isset($this->_items)) { if (count($this->_items)) { $keys = array_keys($this->_items); $html .= "<div {$class}{$data}{$hover}>"; $html .= $this->getMenu(null, $keys[0]); $html .= "</div>"; if ($isAdmin == true) { return $html; } elseif ($isAdmin == false) { return $prefix . $html . $suffix; } } } return ''; }
?> > <?php echo Zo2Html::field('image', array('label' => JText::_('ZO2_ADMIN_GENERAL_LABEL_BACKGROUND_IMAGE'), 'description' => JText::_('ZO2_ADMIN_GENERAL_DESC_BACKGROUND_IMAGE'), 'class_wrap' => 'zo2-background-image', 'class' => 'zo2-background-image'), array('id' => 'zo2_background_image', 'name' => 'zo2_background_image', 'value' => $preset_data['bg_image'])); ?> <hr /> <div class="zo2_themes_label"> <?php echo JText::_('ZO2_TEMPLATE_THEME_PATTERN_BACKGROUND'); ?> </div> <div class="zo2_themes_for"> <ul class="options background-select"> <?php $zPath = Zo2Path::getInstance(); $backgroundsDir = Zo2Factory::getPath("templates://assets/zo2/images/background-patterns"); $bgPatterns = glob($backgroundsDir . '/*.*'); if (count($bgPatterns) > 0) { foreach ($bgPatterns as $pattern) { if (is_array(getimagesize($pattern))) { $selected = ''; $pattern_src = $zPath->toUrl($pattern); $pattern_path = str_replace(JPATH_ROOT . DIRECTORY_SEPARATOR, '', $pattern); if (isset($preset_data['bg_pattern']) && $pattern_path == $preset_data['bg_pattern']) { $selected = 'selected'; } echo '<li class="' . $selected . '"><img rel="' . $pattern_path . '" src="' . $pattern_src . '" /></li>'; } } } ?>
<?php $presetPath = Zo2Factory::getPath('templates://assets/presets.json'); if (file_exists($presetPath)) { $presets_defined = json_decode(file_get_contents($presetPath)); } $backgroundsDir = Zo2Factory::getPath('templates://assets/zo2/images/background-patterns'); $presetDir = Zo2Factory::getPath('templates://assets/zo2/css/'); $profile = Zo2Factory::getProfile(); $theme = new JObject($profile->get('theme')); ?> <div class="style-switcher switcher-left" id="style-switcher"> <h4>Style Switcher<span class="style-switcher-icon glyphicon glyphicon-cog"></span></h4> <input type="hidden" id="ss_position" value="hide" > <div class="switch-container"> <h5>Layout options</h5> <ul class="options layout-select"> <li class="boxed-layout" id="boxed-layout"><a class="boxed" href="#"><img src="<?php echo JUri::root(); ?> plugins/system/zo2/framework/assets/zo2/images/page-bordered.png" alt="Boxed Layout"></a></li> <li class="fullwidth-layout" id="fullwidth-layout"><a class="fullwidth" href="#"><img src="<?php echo JUri::root(); ?> plugins/system/zo2/framework/assets/zo2/images/page-fullwidth.png" alt="Full Width Layout"></a></li> </ul> <h5>Primary Color</h5> <ul class="options color-select"> <?php if (is_array($presets_defined)) {
/** * Hide component from frontpage * @return bool */ private static function hideComponent() { $framework = Zo2Framework::getInstance(); $params = Zo2Factory::getTemplate()->params; if ((int) $params->get('component_area', 0) && $framework->isFrontPage()) { return true; } else { return false; } }
/** * Get array of exists profiles * @return \Zo2Profile */ public function getProfiles() { $templateProfiles = $this->_getProfiles(Zo2Factory::getPath('templates://assets/profiles/' . $this->template->id)); $defaultProfiles = $this->_getProfiles(Zo2Factory::getPath('templates://assets/profiles')); $profiles = array_merge($defaultProfiles, $templateProfiles); return array_unique($profiles); }
* * @link http://www.zo2framework.org * @link http://github.com/aploss/zo2 * @author Duc Nguyen <*****@*****.**> * @author Hiepvu <*****@*****.**> * @copyright Copyright (c) 2013 APL Solutions (http://apl.vn) * @license GPL v2 */ defined('_JEXEC') or die('Restricted Access'); require_once __DIR__ . '/includes/bootstrap.php'; /** * @todo Opengraph support * @todo Facebook & Twitter ... data attributes support */ /* Get Zo2Framework */ $framework = Zo2Factory::getFramework(); ?> <!DOCTYPE html> <html lang="<?php echo $this->zo2->template->getLanguage(); ?> " dir="<?php echo $this->zo2->template->getDirection(); ?> "> <head> <?php unset($this->_scripts[JURI::root(true) . '/media/jui/js/bootstrap.min.js']); ?> <?php echo $this->zo2->template->fetch('html://layouts/head.response.php');