Пример #1
0
 /**
  * Loads our namespaced Twitter Bootstrap. You have to wrap the output you want style
  * with an element having the class akeeba-bootstrap added to it.
  */
 public static function bootstrap()
 {
     if (self::isCli()) {
         return;
     }
     // Load Bootstrap only once
     if (self::$_includedBootstrap) {
         return;
     }
     if (version_compare(JVERSION, '3.2', 'ge')) {
         $key = 'joomla32';
         $default = 'lite';
     } elseif (version_compare(JVERSION, '3.0', 'ge')) {
         $key = 'joomla3';
         $default = 'lite';
     } else {
         $key = 'joomla2';
         $default = 'full';
     }
     $loadBootstrap = self::getPreference('bootstrap_' . $key, $default);
     if ($loadBootstrap == 'front') {
         if (in_array($key, array('joomla3', 'joomla32'))) {
             $isFrontend = F0FPlatform::getInstance()->isFrontend();
             $loadBootstrap = $isFrontend ? 'full' : 'lite';
         } else {
             $loadBootstrap = 'full';
         }
     } elseif (!in_array($loadBootstrap, array('full', 'lite', 'none'))) {
         if ($key == 'joomla3') {
             $loadBootstrap = 'lite';
         } elseif ($key == 'joomla32') {
             $loadBootstrap = 'lite';
         } else {
             $loadBootstrap = 'full';
         }
     }
     if ($key == 'joomla3' && in_array($loadBootstrap, array('lite', 'none'))) {
         // Use Joomla!'s Javascript
         JHtml::_('bootstrap.framework');
     }
     if (!self::$_includedJQuery) {
         self::jQuery();
     }
     if ($loadBootstrap == 'none') {
         return;
     }
     self::$_includedBootstrap = true;
     $source = self::getPreference('bootstrap_source', 'css');
     if (!in_array($source, array('css', 'less'))) {
         $source = 'css';
     }
     $altCss = array('media://akeeba_strapper/css/strapper.min.css');
     switch ($key) {
         case 'joomla3':
         case 'joomla32':
             $altCss[] = 'media://akeeba_strapper/css/strapper.j3.css';
             break;
         case 'joomla2':
             $altCss[] = 'media://akeeba_strapper/css/strapper.j25.css';
             break;
     }
     if ($loadBootstrap == 'full') {
         array_unshift($altCss, 'media://akeeba_strapper/css/bootstrap.min.css');
         $filename = F0FTemplateUtils::parsePath('media://akeeba_strapper/js/bootstrap.min.js', true);
         if (@filesize($filename) > 5) {
             self::addJSfile('media://akeeba_strapper/js/bootstrap.min.js', AKEEBASTRAPPER_MEDIATAG);
         }
         if ($source == 'less') {
             self::addLESSfile('media://akeeba_strapper/less/bootstrap.j25.less', $altCss, AKEEBASTRAPPER_MEDIATAG);
         }
     } else {
         switch ($key) {
             case 'joomla3':
                 $qualifier = '.j3';
                 break;
             case 'joomla32':
                 $qualifier = '.j32';
                 break;
             default:
                 $qualifier = '';
                 break;
         }
         array_unshift($altCss, 'media://akeeba_strapper/css/bootstrap' . $qualifier . '.min.css');
         if ($source == 'less') {
             self::addLESSfile('media://akeeba_strapper/less/bootstrap' . $qualifier . '.less', $altCss, AKEEBASTRAPPER_MEDIATAG);
         }
     }
     if ($source == 'css') {
         foreach ($altCss as $css) {
             self::addCSSfile($css, AKEEBASTRAPPER_MEDIATAG);
         }
     }
 }
Пример #2
0
 /**
  * Loads our namespaced Twitter Bootstrap. You have to wrap the output you want style
  * with an element having the class akeeba-bootstrap added to it.
  */
 public static function bootstrap()
 {
     if (self::isCli()) {
         return;
     }
     if (version_compare(JVERSION, '3.0', 'gt')) {
         $key = 'joomla3';
         $default = 'lite';
     } else {
         $key = 'joomla2';
         $default = 'full';
     }
     $loadBootstrap = self::getPreference('bootstrap_' . $key, $default);
     if (!in_array($loadBootstrap, array('full', 'lite', 'none'))) {
         if ($key == 'joomla3') {
             $loadBootstrap = 'lite';
         } else {
             $loadBootstrap = 'full';
         }
     }
     if ($key == 'joomla3' && $loadBootstrap == 'lite') {
         // Use Joomla!'s Javascript
         JHtml::_('bootstrap.framework');
     }
     if (!self::$_includedJQuery) {
         self::jQuery();
     }
     if ($loadBootstrap == 'none') {
         return;
     }
     self::$_includedBootstrap = true;
     $source = self::getPreference('bootstrap_source', 'css');
     if (!in_array($source, array('css', 'less'))) {
         $source = 'css';
     }
     $altCss = array('media://akeeba_strapper/css/strapper.css');
     if ($loadBootstrap == 'full') {
         array_unshift($altCss, 'media://akeeba_strapper/css/bootstrap.min.css');
         self::$scriptURLs[] = FOFTemplateUtils::parsePath('media://akeeba_strapper/js/bootstrap.min.js');
         if ($source == 'less') {
             self::$lessURLs[] = array('media://akeeba_strapper/less/bootstrap.j25.less', $altCss);
         }
     } else {
         array_unshift($altCss, 'media://akeeba_strapper/css/bootstrap.j3.css');
         if ($source == 'less') {
             self::$lessURLs[] = array('media://akeeba_strapper/less/bootstrap.j3.less', $altCss);
         }
     }
     if ($source == 'css') {
         foreach ($altCss as $css) {
             self::$cssURLs[] = FOFTemplateUtils::parsePath($css);
         }
     }
 }