Example #1
0
 public static function prepare($tpl)
 {
     //set the compress tool
     self::$exclude = $tpl->getParam('minify_exclude', '');
     self::$jstool = $tpl->getParam('minify_js_tool', 'jsmin');
     if (self::$exclude) {
         self::$exclude = '@' . preg_replace('@[,]+@', '|', preg_quote(self::$exclude)) . '@';
     }
 }
Example #2
0
 /**
  * Update head - detect if devmode or themermode is enabled and less file existed, use less file instead of css
  */
 function updateHead()
 {
     // As Joomla 3.0 bootstrap is buggy, we will not use it
     // We also prevent both Joomla bootstrap and Plazart bootsrap are loaded
     $plazartbootstrap = false;
     $jabootstrap = false;
     $legacy = $this->getParam('bootstrapversion', 3) == 3 ? '' : '/legacy';
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $doc = JFactory::getDocument();
         $scripts = array();
         foreach ($doc->_scripts as $url => $script) {
             if (strpos($url, PLAZART_URL . '/bootstrap' . $legacy . '/js/bootstrap.min.js') !== false || strpos($url, PLAZART_TEMPLATE_URL . '/bootstrap' . $legacy . '/js/bootstrap.min.js') !== false) {
                 $plazartbootstrap = true;
                 if ($jabootstrap) {
                     //we already have the Joomla bootstrap and we also replace to Plazart bootstrap
                     continue;
                 }
             }
             if (preg_match('@media/jui/js/bootstrap(.min)?.js@', $url)) {
                 if ($plazartbootstrap) {
                     //we have Plazart bootstrap, no need to add Joomla bootstrap
                     continue;
                 } else {
                     $scripts[PLAZART_URL . '/bootstrap' . $legacy . '/js/bootstrap.min.js'] = $script;
                 }
                 $jabootstrap = true;
             } else {
                 $scripts[$url] = $script;
             }
         }
         $doc->_scripts = $scripts;
     }
     // end update javascript
     $minify = $this->getParam('minify', 0);
     $minifyjs = $this->getParam('minify_js', 0);
     $devmode = $this->getParam('devmode', 0);
     //only check for minify if devmode is disabled
     if (!$devmode && ($minify || $minifyjs)) {
         Plazart::import('core/minify');
         if ($minify) {
             PlazartMinify::optimizecss($this);
         }
         if ($minifyjs) {
             PlazartMinify::optimizejs($this);
         }
     }
 }