public static function getComponents()
 {
     if ($_GET['template']) {
         header('Content-Type: application/json');
         echo Zo2Factory::getFramework()->getComponents($_GET['template']);
     }
 }
 /**
  * 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'));
     }
 }
 /**
  * Generate html from a column item
  * @param $item
  * @return string
  */
 private function _generateColumn($item)
 {
     /* Check is allowed to show this jdoc */
     if ($this->_checkShowColumn($item)) {
         $jdoc = $item->get('jdoc', 'modules');
         if (trim($jdoc) == '') {
             $jdoc = 'modules';
         }
         $html = '';
         $html .= '<!-- build column: ' . trim($item->get('name', 'unknown')) . ' -->' . "\n\r";
         $html .= '<!-- jdoc: ' . $jdoc . ' - position: ' . $item->get('position') . ' -->';
         $class[] = 'col-md-' . $item->get('span');
         $class[] = 'col-sm-' . $item->get('span');
         if ($item->get('offset') != 0) {
             $class[] = ' col-md-offset-' . $item->get('offset');
         }
         $class = array_merge($class, $item->getVisibilityClass());
         $customClass = explode(' ', $item->get('customClass'));
         $class = array_merge($class, $customClass);
         $class = array_unique($class);
         $gridClass = array();
         /* Find grid core class */
         foreach ($class as $key => $value) {
             if (strpos($value, 'col-xs-') !== false || strpos($value, 'col-sm-') !== false || strpos($value, 'col-md-') !== false || strpos($value, 'col-lg-') !== false) {
                 $subs = explode('-', $value);
                 if (count($subs) == 3) {
                     $gridClass[$subs[0] . '-' . $subs[1]] = $subs[2];
                 }
                 unset($class[$key]);
             }
         }
         foreach ($gridClass as $key => $value) {
             $class[] = $key . '-' . $value;
         }
         $class = array_unique($class);
         /* BEGIN COL */
         $id = JFilterOutput::stringURLSafe(strtolower(trim($item->get('name', $item->get('position')))));
         $id = str_replace('_', '-', $id);
         $html .= '<div id="zo2-' . $id . '" class="' . trim(implode(' ', $class)) . '">';
         switch ($jdoc) {
             case 'component':
                 $html .= '<jdoc:include type="component" />';
                 break;
             case 'message':
                 $html .= '<jdoc:include type="message" />';
                 break;
             case 'modules':
                 /**
                  * old code
                  * @todo position only used to define where is element render not what kind of element
                  */
                 if ($item->get('position') == 'component') {
                     $html .= '<jdoc:include type="component" />';
                 } else {
                     if ($item->get('position') == 'message') {
                         $html .= '<jdoc:include type="message" />';
                     } else {
                         $html .= '<jdoc:include type="modules" name="' . $item->get('position') . '"  style="' . $item->get('style') . '" />';
                     }
                 }
                 /**
                  * @todo need move to correct jdoc
                  */
                 $template = new Zo2Template();
                 switch ($item->get('position')) {
                     case 'footer_copyright':
                     case 'footer-copyright':
                         $html .= Zo2Html::_('copyright', 'render');
                         break;
                     case 'header_logo':
                     case 'header-logo':
                         $html .= Zo2Html::_('headerlogo', 'render');
                         break;
                     case 'mega_menu':
                     case 'mega-menu':
                         /* Display frontend megamenu */
                         $framework = Zo2Framework::getInstance();
                         $megamenu = $framework->displayMegaMenu(Zo2Framework::getInstance()->profile->menu_type);
                         $html .= $megamenu;
                         break;
                 }
                 break;
             case 'megamenu':
                 /* Display frontend megamenu */
                 $framework = Zo2Framework::getInstance();
                 $megamenu = $framework->displayMegaMenu(Zo2Framework::getInstance()->profile->menu_type);
                 $html .= $megamenu;
                 break;
             case 'canvasmenu':
                 $this->set('canvasMenu', $item);
                 $html .= '<span class="button-canvas"><i class="fa fa-2x fa-bars" data-toggle="offcanvas"></i></span>';
                 break;
             default:
                 /**
                  * 3rd addons
                  */
                 if (strpos($jdoc, 'addon-') !== false) {
                     $jdoc = str_replace('addon-', '', $jdoc);
                     $addons = Zo2Factory::getFramework()->getRegisteredAddons();
                     if (isset($addons[$jdoc])) {
                         /**
                          * Prevent evil code
                          */
                         $html .= call_user_func($addons[$jdoc]);
                     }
                 } else {
                 }
         }
         foreach ($item->get('children') as $child) {
             $html .= $this->_buildItem($child);
         }
         /* END COLUMN */
         $html .= '</div>';
         return $html;
     }
 }
Example #4
0
 *
 * @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');