Example #1
0
 public function getAsides($matches)
 {
     // Get id and decide if to even bother
     preg_match('/id=\\"(.*)\\"/isU', $matches[1], $ids);
     $id = $ids[1];
     $doc = Wright::getInstance();
     if (!$doc->document->countModules($id)) {
         return;
     }
     $class = 'grid_' . $this->columns[$id]->size;
     if ($this->columns[$id]->push) {
         $class .= ' push_' . $this->columns[$id]->push;
     }
     if ($this->columns[$id]->pull) {
         $class .= ' pull_' . $this->columns[$id]->pull;
     }
     if (strpos($matches[1], 'class=')) {
         preg_match('/class="(.*)"/i', $matches[1], $classes);
         $class .= ' ' . $classes[1];
     }
     if (strpos($matches[1], 'class=')) {
         $sidebar = preg_replace('/class=\\".*\\"/iU', 'class="' . $class . '"', $matches[0]);
     } else {
         $sidebar = preg_replace('/<aside/iU', '<div class="' . $class . '"', $matches[0]);
     }
     $sidebar = str_replace('</aside>', '</div>', $sidebar);
     return $sidebar;
 }
Example #2
0
 /**
  * Creates the browser compatibility table
  *
  * @return  JFormField  Formatted input
  */
 protected function getInput()
 {
     $doc = JFactory::getDocument();
     if (version_compare(JVERSION, '3', 'ge')) {
         JHtml::_('jquery.framework');
     } else {
         $doc->addScript(str_replace('/administrator/', '/', JURI::base()) . 'templates/' . $this->form->getValue('template') . '/wright/js/jquery.min.js');
         $doc->addScriptDeclaration('jQuery.noConflict();');
     }
     $doc->addScript(str_replace('/administrator/', '/', JURI::base()) . 'templates/' . $this->form->getValue('template') . '/wright/parameters/assets/browsercompatibility/browsercompatibility.js');
     $doc->addStylesheet(str_replace('/administrator/', '/', JURI::base()) . 'templates/' . $this->form->getValue('template') . '/wright/parameters/assets/browsercompatibility/browsercompatibility.css');
     $this->initializeBrowsers();
     $html = '';
     if ($this->value == '') {
         include_once dirname(__FILE__) . '../../../wright.php';
         $wright = Wright::getInstance();
         $this->value = json_encode($wright->setupDefaultBrowserCompatibility());
     }
     $browserCompatibility = json_decode($this->value);
     $html .= '<table class="wright-browser-table"><tr><th>' . JText::_('TPL_JS_WRIGHT_BROWSER_COMPATIBILITY_BROWSER') . '</th><th>' . JText::_('TPL_JS_WRIGHT_BROWSER_COMPATIBILITY_MINIMUM_VERSION') . '</th><th>' . JText::_('TPL_JS_WRIGHT_BROWSER_COMPATIBILITY_DESKTOP') . '</th><th>' . JText::_('TPL_JS_WRIGHT_BROWSER_COMPATIBILITY_RECOMMENDED') . '</th><th>' . JText::_('TPL_JS_WRIGHT_BROWSER_COMPATIBILITY_MOBILE') . '</th></tr>';
     foreach ($this->_browserCollection as $browserId => $browserName) {
         $html .= '<tr>' . '<td class="text-left">' . $browserName . '</td>' . '<td><input type="text" class="wbminv" name="wbminv_' . $browserId . '" id="wbminv_' . $browserId . '" value="' . (isset($browserCompatibility->{$browserName}) ? $browserCompatibility->{$browserName}->minimumVersion : '') . '" data-browser="' . $browserName . '" data-browserid="' . $browserId . '" /></td>' . '<td><input type="checkbox" class="wbdesktop" name="wbdesktop_' . $browserId . '" id="wbdesktop_' . $browserId . '"' . (isset($browserCompatibility->{$browserName}) ? $browserCompatibility->{$browserName}->desktop ? 'checked="checked"' : '' : '') . ' data-browser="' . $browserName . '" data-browserid="' . $browserId . '" /></td>' . '<td><input type="checkbox" class="wbrecommended" name="wbrecommended_' . $browserId . '" id="wbrecommended_' . $browserId . '"' . (isset($browserCompatibility->{$browserName}) ? $browserCompatibility->{$browserName}->recommended ? 'checked="checked"' : '' : '') . ' data-browser="' . $browserName . '" data-browserid="' . $browserId . '" /></td>' . '<td><input type="checkbox" class="wbmobile" name="wbmobile_' . $browserId . '" id="wbmobile_' . $browserId . '"' . (isset($browserCompatibility->{$browserName}) ? $browserCompatibility->{$browserName}->mobile ? 'checked="checked"' : '' : '') . ' data-browser="' . $browserName . '" data-browserid="' . $browserId . '" /></td>' . '</tr>';
     }
     $html .= "</table>";
     $html .= '<input type="hidden" name="' . $this->name . '" id="wb_compatibility" value=\'' . $this->value . '\' /> ';
     return $html;
 }
Example #3
0
 /**
  * Renders the footer
  *
  * @param   Array  $args  Args sent
  *
  * @return  JFormField  Formatted input
  */
 public function render($args)
 {
     $doc = Wright::getInstance();
     if ($doc->document->params->get('rebrand', 'no') !== 'yes') {
         return '<a target="_blank" class="joomlashack" href="http://www.joomlashack.com"><img src="./templates/' . JFactory::getApplication()->getTemplate() . '/wright/images/jscright.png" alt ="Joomlashack" /> </a>';
     }
 }
Example #4
0
 public function render($args)
 {
     $head = '';
     $dochtml = JFactory::getDocument();
     if ($dochtml->params->get('responsive', 1)) {
         // add viewport meta for tablets
         $head = '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
     }
     $head .= '<jdoc:include type="head" />';
     $head .= "\n";
     $wr = Wright::getInstance();
     $head .= $wr->generateCSS();
     return $head;
 }
Example #5
0
 public function render($args)
 {
     $doc = Wright::getInstance();
     $js = $doc->generateJS();
     if ($doc->document->params->get('rebrand', 'no') !== 'yes') {
         $anchors = array("Joomla Template" => 50, "Joomla Templates" => 100);
         $links = array("Joomla Templates" => "professional-joomla-templates", "Joomla Template" => "professional-joomla-templates");
         $endlines = array(": by JoomlaShack" => 50, ": from JoomlaShack" => 100);
         $host = "http://www.joomlashack.com/";
         $class = 'joomlashack';
         $url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
         $md5 = md5($url);
         $nums = "";
         for ($i = 0; $i < strlen($md5); $i++) {
             $j = ord(substr($md5, $i, 1));
             if ($j == 43 || $j == 43 || $j >= 48 && $j <= 57) {
                 $nums .= substr($md5, $i, 1);
             }
         }
         $first = substr($nums, 0, 2);
         $second = substr($nums, 2, 2);
         $third = substr($nums, 4, 2);
         if (substr($first, 0, 1) == '0') {
             $first = substr($first, 1, 1);
         }
         if (substr($second, 0, 1) == '0') {
             $second = substr($second, 1, 1);
         }
         if (substr($third, 0, 1) == '0') {
             $third = substr($third, 1, 1);
         }
         $anchor = '';
         $endline = '';
         foreach ($anchors as $possibility => $val) {
             if ($anchor == '' && $val > $first) {
                 $anchor = $possibility;
                 $host .= $links[$possibility];
                 foreach ($endlines as $ends => $v) {
                     if ($endline == '' && $v > $third) {
                         $endline = $ends;
                     }
                 }
             }
         }
         return '<a class="joomlashack" href="' . $host . '">' . $anchor . $endline . '</a>' . $js;
     } else {
         return $js;
     }
 }
Example #6
0
 public function render($args)
 {
     $doc = JFactory::getDocument();
     if ($doc->params->get('responsive', 1)) {
         // Add viewport meta for tablets
         $doc->setMetaData('viewport', 'width=device-width, initial-scale=1.0');
     }
     $doc->setMetaData('X-UA-Compatible', 'IE=edge', true);
     // Add favicon links
     $faviconsurl = JURI::root() . 'templates/' . $doc->template . '/favicons/';
     $doc->addFavicon($faviconsurl . 'favicon.ico');
     $doc->addHeadLink($faviconsurl . 'apple-touch-icon-57x57.png', 'apple-touch-icon', 'rel', array('sizes' => '57x57'));
     $doc->addHeadLink($faviconsurl . 'apple-touch-icon-114x114.png', 'apple-touch-icon', 'rel', array('sizes' => '114x114'));
     $doc->addHeadLink($faviconsurl . 'apple-touch-icon-72x72.png', 'apple-touch-icon', 'rel', array('sizes' => '72x72'));
     $doc->addHeadLink($faviconsurl . 'apple-touch-icon-144x144.png', 'apple-touch-icon', 'rel', array('sizes' => '144x144'));
     $doc->addHeadLink($faviconsurl . 'apple-touch-icon-60x60.png', 'apple-touch-icon', 'rel', array('sizes' => '60x60'));
     $doc->addHeadLink($faviconsurl . 'apple-touch-icon-120x120.png', 'apple-touch-icon', 'rel', array('sizes' => '120x120'));
     $doc->addHeadLink($faviconsurl . 'apple-touch-icon-76x76.png', 'apple-touch-icon', 'rel', array('sizes' => '76x76'));
     $doc->addHeadLink($faviconsurl . 'apple-touch-icon-152x152.png', 'apple-touch-icon', 'rel', array('sizes' => '152x152'));
     $doc->addHeadLink($faviconsurl . 'favicon-16x16.png', 'icon', 'rel', array('sizes' => '16x16', 'type' => 'image/png'));
     $doc->addHeadLink($faviconsurl . 'favicon-32x32.png', 'icon', 'rel', array('sizes' => '32x32', 'type' => 'image/png'));
     $doc->addHeadLink($faviconsurl . 'favicon-96x96.png', 'icon', 'rel', array('sizes' => '96x96', 'type' => 'image/png'));
     $doc->addHeadLink($faviconsurl . 'favicon-160x160.png', 'icon', 'rel', array('sizes' => '160x160', 'type' => 'image/png'));
     $doc->addHeadLink($faviconsurl . 'favicon-196x196.png', 'icon', 'rel', array('sizes' => '196x196', 'type' => 'image/png'));
     $doc->setMetaData('msapplication-TileColor', '#b91d47');
     $doc->setMetaData('msapplication-TileImage', $faviconsurl . 'mstile-144x144.png');
     $doc->setMetaData('msapplication-square70x70logo', $faviconsurl . 'mstile-70x70.png');
     $doc->setMetaData('msapplication-square150x150logo', $faviconsurl . 'mstile-150x150.png');
     $doc->setMetaData('msapplication-square310x310logo', $faviconsurl . 'mstile-310x310.png');
     $head = '<jdoc:include type="head" />';
     $head .= "\n";
     $wr = Wright::getInstance();
     $head .= $wr->generateCSS();
     $browser = JBrowser::getInstance();
     // Add responsive for IE
     if ($browser->getBrowser() == 'msie' && (int) $browser->getMajor() <= 9) {
         $head .= '<script src="' . JURI::root() . 'templates/' . $doc->template . '/wright/js/respond.min.js" type="text/javascript"></script>';
     }
     return $head;
 }
Example #7
0
<?php

/**
 * @package     Wright
 * @subpackage  Template Index File
 *
 * @copyright   Copyright (C) 2005 - 2015 Joomlashack. Meritage Assets.  All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 *
 * Expected to see a template file here? Well this template is just a little
 * different. In order to provide some extra features, we've altered a few
 * little things about how Joomla templates work.
 *
 * See usage and customization information at
 * http://wright.joomlashack.com
 */
// No direct access
defined('_JEXEC') or die('Restricted access');
// Include the framework
require dirname(__FILE__) . '/wright/wright.php';
// Initialize the framework and
$tpl = Wright::getInstance();
$tpl->display();
Example #8
0
    public function render($args)
    {
        $uniquePosition = false;
        if (!isset($args['name'])) {
            $args['name'] = 'newsflash';
        }
        if (!isset($args['style'])) {
            $args['style'] = 'xhtml';
        }
        // class for the wrapper of the menu nav bar
        if (!isset($args['menuWrapClass'])) {
            $args['menuWrapClass'] = '';
        }
        $doc = Wright::getInstance();
        $app = JFactory::getApplication();
        $title = '<h2>' . ($doc->document->params->get('headline', '') !== '' ? $doc->document->params->get('headline') : $app->getCfg('sitename')) . '</h2>';
        $title .= $doc->document->params->get('tagline', '') !== '' ? '<h3>' . $doc->document->params->get('tagline') . '</h3>' : '';
        // checks if one ore two modules will be around the logo, and calculates sizes
        $html = "";
        $modulewidth = 12 - $doc->document->params->get('logowidth', '6');
        $modulewidth2 = $modulewidth;
        $logowidth = $doc->document->params->get('logowidth', '6');
        $modules = 0;
        $modulename = isset($args['name']) ? $args['name'] : "";
        $modulename2 = isset($args['name']) ? $args['name'] . 2 : "";
        $module2name = isset($args['name2']) ? $args['name2'] : "";
        $module2name2 = isset($args['name2']) ? $args['name2'] . 2 : "";
        if ($logowidth !== '12' && ($doc->countModules($modulename) || $doc->countModules($module2name))) {
            $modules++;
        }
        if ($logowidth !== '12' && ($doc->countModules($modulename2) || $doc->countModules($module2name2))) {
            $modules++;
        }
        if ($modules == 2) {
            $modulewidth2 = floor($modulewidth / 2);
            $modulewidth = ceil($modulewidth / 2);
            $logowidth = 12 - $modulewidth - $modulewidth2;
            if ($doc->document->params->get('logowidth') !== '12' && ($doc->countModules($modulename) || $doc->countModules($module2name))) {
                $html .= '<div id="' . $modulename . '" class="span' . $modulewidth . '">';
                $html .= $this->renderCompanion($modulename, $args, $modulewidth);
                $html .= $this->renderCompanion($module2name, $args, $modulewidth, true);
                $html .= '</div>';
            }
        } else {
            $modulename2 = $modulename;
            $module2name2 = $module2name;
            $uniquePosition = true;
        }
        // Toolbar opening
        if ($uniquePosition && $modulename2 == "toolbar") {
            $html .= '		
				<div class="navbar ' . $args['menuWrapClass'] . '">
					<div class="navbar-inner">
						<div class="' . $args['containerClass'] . '">
							<div class="' . $args['rowClass'] . '">';
        }
        // If user wants a module, load it instead of image
        if ($doc->document->params->get('logo', 'template') == 'module') {
            $html .= '<div id="logo" class="span' . $doc->document->params->get('logowidth', '6') . '"><jdoc:include type="modules" name="logo" /></div>';
            if ($doc->document->params->get('logowidth') !== '12' && ($doc->countModules($modulename2) || $doc->countModules($module2name2))) {
                $html .= '<div id="' . $modulename2 . '" class="span' . $modulewidth2 . '">';
                $html .= $this->renderCompanion($modulename2, $args, $modulewidth2);
                $html .= $this->renderCompanion($module2name2, $args, $modulewidth2, true);
                $html .= '</div>';
            }
            return $html;
        } elseif ($doc->document->params->get('logo', 'template') == 'title') {
            $html .= '<div id="logo" class="span' . $doc->document->params->get('logowidth', '6') . '"><a href="' . JURI::root() . '" class="title">' . $title . '</a></div>';
            if ($doc->document->params->get('logowidth') !== '12' && ($doc->countModules($modulename2) || $doc->countModules($module2name2))) {
                $html .= '<div id="' . $modulename2 . '" class="span' . $modulewidth2 . '">';
                $html .= $this->renderCompanion($modulename2, $args, $modulewidth2);
                $html .= $this->renderCompanion($module2name2, $args, $modulewidth2, true);
                $html .= '</div>';
            }
            return $html;
        } elseif ($doc->document->params->get('logo', 'template') == 'template') {
            // added support for logo tone (light = "", dark = "-Dark")
            $user = JFactory::getUser();
            $logotone = $user->getParam('templateTone', '');
            if ($logotone == '') {
                $logotone = $doc->document->params->get('Tone', '');
            }
            if (is_file(JPATH_ROOT . '/' . 'templates' . '/' . $doc->document->template . '/' . 'images' . '/' . $doc->document->params->get('style') . '/' . 'logo' . $logotone . '.png')) {
                $logo = JURI::root() . 'templates/' . $doc->document->template . '/images/' . $doc->document->params->get('style') . '/logo' . $logotone . '.png';
            } elseif (is_file(JPATH_ROOT . '/' . 'templates' . '/' . $doc->document->template . '/' . 'images' . '/' . $doc->document->params->get('style') . '/' . 'logo.png')) {
                $logo = JURI::root() . 'templates/' . $doc->document->template . '/images/' . $doc->document->params->get('style') . '/logo.png';
            } elseif (is_file(JPATH_ROOT . '/' . 'templates/' . $doc->document->template . '/images/logo' . $logotone . '.png')) {
                $logo = JURI::root() . 'templates/' . $doc->document->template . '/images/logo' . $logotone . '.png';
            } elseif (is_file(JPATH_ROOT . '/' . 'templates/' . $doc->document->template . '/images/logo.png')) {
                $logo = JURI::root() . 'templates/' . $doc->document->template . '/images/logo.png';
            } else {
                $logo = JURI::root() . 'templates/' . $doc->document->template . '/wright/images/logo.png';
            }
        } else {
            $logo = JURI::root() . 'images/' . $doc->document->params->get('logo', 'logo.png');
        }
        $html .= '<div id="logo" class="span' . $logowidth . '"><a href="' . JURI::root() . '" class="image">' . $title . '<img src="' . $logo . '" alt="" title="" /></a></div>';
        if ($doc->document->params->get('logowidth') !== '12' && ($doc->countModules($modulename2) || $doc->countModules($module2name2))) {
            $html .= '<div id="' . $modulename2 . '" class="span' . $modulewidth2 . '">';
            $html .= $this->renderCompanion($modulename2, $args, $modulewidth2);
            $html .= $this->renderCompanion($module2name2, $args, $modulewidth2, true);
            $html .= '</div>';
        }
        // Toolbar closure
        if ($uniquePosition && $modulename2 == "toolbar") {
            $html .= '
							</div>
						</div>
					</div>
				</div>';
        }
        return $html;
    }
Example #9
0
 /**
  *  Sets up the main columns (main and sidebars)
  *
  * @return  string
  */
 private function setupColumns()
 {
     $doc = Wright::getInstance();
     // Get our column info straight
     $main = 0;
     $check = 0;
     $number = 0;
     $layout = array();
     $wrightTemplate = null;
     $editmode = false;
     // Check editing mode
     if (JRequest::getVar('task') == 'edit' || JRequest::getVar('layout') == 'form' || JRequest::getVar('layout') == 'edit') {
         $editmode = true;
     } else {
     }
     if (class_exists("WrightTemplate") && !$editmode) {
         $wrightTemplate = WrightTemplate::getInstance();
         // Checks if the template has full height sidebars for adding the tag for the columns (sidebars)
         if (property_exists("WrightTemplate", "fullHeightSidebars")) {
             if ($wrightTemplate->fullHeightSidebars) {
                 $this->tags['fullHeightColumns'] = '/(.*)<div class="container_12" id="columnscontainer">(.*)<\\/div><div id="columnscontainer_close"><\\/div>(.*)$/isU';
             }
         }
     } else {
     }
     foreach (explode(';', $doc->document->params->get('columns', 'sidebar1:3;main:6;sidebar2:3')) as $item) {
         list($col, $val) = explode(':', $item);
         if ($col !== 'main' && $check == 0) {
             $main++;
         } else {
             $check = 1;
         }
         $this->columns[$col] = new JObject();
         $this->columns[$col]->name = $col;
         $this->columns[$col]->size = $val;
         $this->columns[$col]->push = 0;
         $this->columns[$col]->pull = 0;
         $this->columns[$col]->check = $check;
         // Contains if column really exists into content or not
         $this->columns[$col]->exists = false;
         $number++;
         if ($val > 0 && $doc->document->countModules($col) || $col == 'main') {
             $layout[] = $col;
         } else {
             // Addition for forcing a sidebar (if it is a template which must have a sidebar for some of its positions)
             if ($wrightTemplate) {
                 if (property_exists("WrightTemplate", "forcedSidebar")) {
                     $wrightTemplate = WrightTemplate::getInstance();
                     if ($col == $wrightTemplate->forcedSidebar) {
                         $layout[] = $col;
                     }
                 }
             }
         }
     }
     // Auto set to full width if editing
     if (JRequest::getVar('task') == 'edit' || JRequest::getVar('layout') == 'form') {
         $layout = array();
         $layout[] = 'main';
     }
     switch (implode('-', $layout)) {
         case 'main':
             $this->columns['main']->size = 12;
             $this->cols = 'wide';
             break;
         case 'main-sidebar1':
             $this->columns['main']->size = 12 - $this->columns['sidebar1']->size;
             $this->cols = 'm_' . $this->columns['main']->size . '_' . $this->columns['sidebar1']->size;
             break;
         case 'sidebar1-main':
             $this->columns['main']->size = 12 - $this->columns['sidebar1']->size;
             $this->columns['sidebar1']->pull = $this->columns['main']->size;
             $this->columns['main']->push = $this->columns['sidebar1']->size;
             $this->cols = 'l_' . $this->columns['main']->size;
             break;
         case 'main-sidebar2':
             $this->columns['main']->size = 12 - $this->columns['sidebar2']->size;
             $this->cols = 'm_' . $this->columns['main']->size . '_r_' . $this->columns['sidebar2']->size;
             break;
         case 'sidebar2-main':
             $this->columns['main']->size = 12 - $this->columns['sidebar2']->size;
             $this->columns['sidebar2']->pull = $this->columns['main']->size;
             $this->columns['main']->push = $this->columns['sidebar2']->size;
             $this->cols = 'l_' . $this->columns['main']->size;
             break;
         case 'main-sidebar1-sidebar2':
             $this->cols = 'm_' . $this->columns['sidebar1']->size . '_' . $this->columns['sidebar2']->size;
             break;
         case 'main-sidebar2-sidebar1':
             $this->columns['sidebar2']->pull = $this->columns['sidebar1']->size;
             $this->columns['sidebar1']->push = $this->columns['sidebar2']->size;
             $this->cols = 'm_' . $this->columns['sidebar2']->size . '_' . $this->columns['sidebar1']->size;
             break;
         case 'sidebar2-main-sidebar1':
             $this->columns['main']->push = $this->columns['sidebar2']->size;
             $this->columns['sidebar2']->pull = $this->columns['main']->size + $this->columns['sidebar1']->size;
             $this->columns['sidebar1']->push = $this->columns['sidebar2']->size;
             $this->cols = $this->columns['sidebar2']->size . '_m_' . $this->columns['sidebar1']->size;
             break;
         case 'sidebar1-main-sidebar2':
             $this->columns['main']->push = $this->columns['sidebar1']->size;
             $this->columns['sidebar1']->pull = $this->columns['main']->size;
             $this->cols = $this->columns['sidebar1']->size . '_m_' . $this->columns['sidebar2']->size;
             break;
         case 'sidebar1-sidebar2-main':
             $this->columns['main']->push = $this->columns['sidebar1']->size + $this->columns['sidebar2']->size;
             $this->columns['sidebar2']->pull = $this->columns['main']->size;
             $this->columns['sidebar1']->pull = $this->columns['main']->size;
             $this->cols = $this->columns['sidebar1']->size . '_' . $this->columns['sidebar2']->size . '_m';
             break;
         case 'sidebar2-sidebar1-main':
             $this->columns['main']->push = $this->columns['sidebar1']->size + $this->columns['sidebar2']->size;
             $this->columns['sidebar2']->pull = $this->columns['main']->size + $this->columns['sidebar1']->size;
             $this->columns['sidebar1']->pull = $this->columns['main']->size - $this->columns['sidebar2']->size;
             $this->cols = 'l_' . $this->columns['sidebar2']->size . '_r_' . $this->columns['sidebar1']->size . '_m_' . $this->columns['main']->size;
             break;
     }
 }
Example #10
0
 public function render($args)
 {
     //Hidden module
     $wr = Wright::getInstance();
     if ($wr->browser->isMobile() && !$wr->browser->isTablet()) {
         $hiddenmodule = $wr->params->get('hiddenmodule', array());
         $modules = JModuleHelper::getModules($args['name']);
         if (count($modules) > 0 && count($hiddenmodule) > 0) {
             foreach ($modules as $module) {
                 if (in_array($module->id, $hiddenmodule)) {
                     $module->position = 'hiddenmodule';
                 }
             }
         }
     }
     // Set display type
     if (!isset($args['type'])) {
         $args['type'] = 'single';
     }
     // Set module name
     if (!isset($args['name'])) {
         $args['name'] = 'left';
     }
     // Set wrapper class value if not given
     if (!isset($args['wrapper'])) {
         $args['wrapper'] = 'module';
     }
     // Set style value if not given
     if (!isset($args['chrome'])) {
         $args['chrome'] = 'xhtml';
     }
     // Set extradivs value if not given
     if (!isset($args['extradivs'])) {
         $args['extradivs'] = '';
     }
     // Extra attribute
     if (!isset($args['extra'])) {
         $args['extra'] = '';
     }
     $html = '';
     switch ($args['type']) {
         case 'none':
             $html .= '<jdoc:include type="modules" name="' . $args['name'] . '" style="' . $args['chrome'] . '" extradivs="' . $args['extradivs'] . '" extra="' . $args['extra'] . '" />';
             break;
         case 'row':
             $doc = JFactory::getDocument();
             $html .= '<div class="' . $args['type'] . '">';
             $html .= '<jdoc:include type="modules" name="' . $args['name'] . '" style="' . $args['chrome'] . '" grid="' . $doc->countModules($args['name']) . '" extradivs="' . $args['extradivs'] . '" extra="' . $args['extra'] . '" />';
             $html .= '</div>';
             break;
         case 'row-fluid':
             $doc = JFactory::getDocument();
             $html .= '<div class="' . $args['type'] . '">';
             $html .= '<jdoc:include type="modules" name="' . $args['name'] . '" style="' . $args['chrome'] . '" grid="' . $doc->countModules($args['name']) . '" extradivs="' . $args['extradivs'] . '" extra="' . $args['extra'] . '" />';
             $html .= '</div>';
             break;
         case 'grid':
             $doc = JFactory::getDocument();
             $html .= '<div class="' . $args['wrapper'] . '">';
             $html .= '<jdoc:include type="modules" name="' . $args['name'] . '" style="' . $args['chrome'] . '" grid="' . $doc->countModules($args['name']) . '" extradivs="' . $args['extradivs'] . '" extra="' . $args['extra'] . '" />';
             $html .= '</div>';
             break;
         case 'fixedgrid':
             $doc = JFactory::getDocument();
             $html .= '<div class="' . $args['wrapper'] . '">';
             $html .= '<jdoc:include type="modules" name="' . $args['name'] . '" style="' . $args['chrome'] . '" grid="' . $args['grid'] . '" extradivs="' . $args['extradivs'] . '" extra="' . $args['extra'] . '" />';
             $html .= '</div>';
             break;
         default:
             $html .= '<div class="' . $args['wrapper'] . '">';
             $html .= '<jdoc:include type="modules" name="' . $args['name'] . '" style="' . $args['chrome'] . '" extradivs="' . $args['extradivs'] . '" extra="' . $args['extra'] . '" />';
             $html .= '</div>';
             break;
     }
     return $html;
 }
Example #11
0
 public function render($args)
 {
     $doc = Wright::getInstance();
     $js = $doc->generateJS();
     return $js;
 }
Example #12
0
 /**
  * Run the whole compilation process
  *
  * @return  void
  */
 public function start()
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     $document = JFactory::getDocument();
     $version = explode('.', JVERSION);
     $joomlaVersion = $version[0] . $version[1];
     $wright = Wright::getInstance();
     $style = $wright->getSelectedStyle();
     $lessPath = JPATH_THEMES . '/' . $document->template . '/less';
     $cssPath = JPATH_THEMES . '/' . $document->template . '/css';
     $wrightBuildPath = JPATH_THEMES . '/' . $document->template . '/wright/build';
     $lessFiles = $this->getLessFiles($style, $joomlaVersion);
     $cssFiles = $this->getCSSFiles($style, $joomlaVersion);
     if ($this->getMaxFileTime($lessFiles) > $this->getMaxFileTime($cssFiles)) {
         if ($cssFiles) {
             foreach ($cssFiles as $file) {
                 if (file_exists($file)) {
                     unlink($file);
                 }
             }
         }
         $this->compileWrightFile(array($lessPath . '/variables-' . $style . '.less', $wrightBuildPath . '/less/bootstrap.less'), $cssPath . '/style-' . $style . '.css');
         $this->compileWrightFile(array($lessPath . '/variables-' . $style . '.less', $wrightBuildPath . '/libraries/bootstrap/less/mixins.less', $wrightBuildPath . '/less/typography.less', $wrightBuildPath . '/less/joomla.less', $wrightBuildPath . '/less/joomla' . $joomlaVersion . '.less', $lessPath . '/template.less', $lessPath . '/style-' . $style . '.less'), $cssPath . '/joomla' . $joomlaVersion . '-' . $style . '-extended.css');
     }
     $lessFiles = $this->getLessFiles($style, $joomlaVersion, true);
     $cssFiles = $this->getCSSFiles($style, $joomlaVersion, true);
     if ($this->getMaxFileTime($lessFiles) > $this->getMaxFileTime($cssFiles)) {
         if ($cssFiles) {
             foreach ($cssFiles as $file) {
                 if (file_exists($file)) {
                     unlink($file);
                 }
             }
         }
         $this->compileWrightFile(array($lessPath . '/variables-' . $style . '.less', $wrightBuildPath . '/less/responsive.less', $wrightBuildPath . '/less/joomla-responsive.less', $wrightBuildPath . '/less/joomla' . $joomlaVersion . '-responsive.less', $lessPath . '/template-responsive.less', $lessPath . '/style-' . $style . '-responsive.less'), $cssPath . '/joomla' . $joomlaVersion . '-' . $style . '-responsive.css');
     }
 }