grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026/media/akeeba_strapper/css * * @param $theme string The name of the subdirectory holding the theme */ public static function setjQueryUItheme($theme) { if (self::isCli()) { return; } self::$jqUItheme = $theme; } /** * Loads our namespaced jQuery UI and its stylesheet */ public static function jQueryUI() { if (self::isCli()) { return; } // Load only once if (self::$_includedJQueryUI) { return; } self::jQuery(); self::$_includedJQueryUI = true; $jQueryUILoad = self::getPreference('jqueryui_load', 1); if (!$jQueryUILoad) { return; } $theme = self::getPreference('jquery_theme', self::$jqUItheme); self::addJSfile('media://akeeba_strapper/js/akeebajqui.js', AKEEBASTRAPPER_MEDIATAG); self::addCSSfile("media://akeeba_strapper/css/$theme/theme.min.css", AKEEBASTRAPPER_MEDIATAG); } /** * 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); } } } /** * Adds an arbitrary Javascript file. * * @param $path string The path to the file, in the format media://path/to/file * @param $overrideTag string If defined this version tag overrides AkeebaStrapper::$tag */ public static function addJSfile($path, $overrideTag = null) { if (self::isCli()) { return; } $tag = self::getTag($overrideTag); self::$scriptURLs[] = array(F0FTemplateUtils::parsePath($path), $tag); } /** * Add inline Javascript * * @param $script string Raw inline Javascript */ public static function addJSdef($script) { if (self::isCli()) { return; } self::$scriptDefs[] = $script; } /** * Adds an arbitrary CSS file. * * @param $path string The path to the file, in the format media://path/to/file * @param $overrideTag string If defined this version tag overrides AkeebaStrapper::$tag */ public static function addCSSfile($path, $overrideTag = null) { if (self::isCli()) { return; } $tag = self::getTag($overrideTag); self::$cssURLs[] = array(F0FTemplateUtils::parsePath($path), $tag); } /** * Adds an arbitraty LESS file. * * @param $path string The path to the file, in the format media://path/to/file * @param $altPaths string|array The path to the alternate CSS files, in the format media://path/to/file * @param $overrideTag string If defined this version tag overrides AkeebaStrapper::$tag */ public static function addLESSfile($path, $altPaths = null, $overrideTag = null) { if (self::isCli()) { return; } $tag = self::getTag($overrideTag); self::$lessURLs[] = array($path, $altPaths, $tag); } /** * Add inline CSS * * @param $style string Raw inline CSS */ public static function addCSSdef($style) { if (self::isCli()) { return; } self::$cssDefs[] = $style; } /** * Do we need to preload? * * @return bool True if we need to preload */ public static function needPreload() { $isJ2 = version_compare(JVERSION, '3.0', 'lt'); $isJ3 = version_compare(JVERSION, '3.0', 'ge'); $preloadJ2 = (bool)self::getPreference('preload_joomla2', 1); $preloadJ3 = (bool)self::getPreference('preload_joomla3', 0); // Do not allow Joomla! 3+ preloading if jQueryLoad is "auto" or "namespace" (which are both // namespace in Joomla! 3+). Else only the namespacing for the jQuery library will be loaded, // without a jQuery library being loaded on forehand, which results in jQuery error(s). $jQueryLoad = self::getPreference('jquery_load', 'auto'); if(in_array($jQueryLoad, array('auto', 'namespace'))) { $preloadJ3 = false; } $needPreload = $isJ2 && $preloadJ2 || $isJ3 && $preloadJ3; return $needPreload; } } /** * This is a workaround which ensures that Akeeba's namespaced JavaScript and CSS will be loaded * without being tampered with by any system plugin. Moreover, since we are loading first, we can * be pretty sure that namespacing *will* work and we won't cause any incompatibilities with third * party extensions loading different versions of these GUI libraries. * * This code works by registering a system plugin hook :) It will grab the HTML and drop its own * JS and CSS definitions in the head of the script, before anything else has the chance to run. * * Peace. */ function AkeebaStrapperLoader() { // If there are no script defs, just go to sleep if ( empty(AkeebaStrapper::$scriptURLs) && empty(AkeebaStrapper::$scriptDefs) && empty(AkeebaStrapper::$cssDefs) && empty(AkeebaStrapper::$cssURLs) && empty(AkeebaStrapper::$lessURLs) ) { return; } $myscripts = ''; $preload = AkeebaStrapper::needPreload(); if (version_compare(JVERSION, '3.2', 'ge')) { $buffer = JFactory::getApplication()->getBody(); } else { $buffer = JResponse::getBody(); } // Include Javascript files if (!empty(AkeebaStrapper::$scriptURLs)) foreach (AkeebaStrapper::$scriptURLs as $entry) { list($url, $tag) = $entry; if ($preload) { $myscripts .= '' . "\n"; } else { JFactory::getDocument()->addScript($url . $tag); } } // Include Javscript snippets if (!empty(AkeebaStrapper::$scriptDefs)) { if ($preload) { $myscripts .= '' . "\n"; } else { JFactory::getDocument()->addScriptDeclaration($myscripts); } } // Include LESS files if (!empty(AkeebaStrapper::$lessURLs)) { foreach (AkeebaStrapper::$lessURLs as $entry) { list($lessFile, $altFiles, $tag) = $entry; $url = F0FTemplateUtils::addLESS($lessFile, $altFiles, true); if ($preload) { if (empty($url)) { if (!is_array($altFiles) && empty($altFiles)) { $altFiles = array($altFiles); } if (!empty($altFiles)) { foreach ($altFiles as $altFile) { $url = F0FTemplateUtils::parsePath($altFile); $myscripts .= '' . "\n"; } } } else { $myscripts .= '' . "\n"; } } else { if (empty($url)) { if (!is_array($altFiles) && empty($altFiles)) { $altFiles = array($altFiles); } if (!empty($altFiles)) { foreach ($altFiles as $altFile) { $url = F0FTemplateUtils::parsePath($altFile); JFactory::getDocument()->addStyleSheet($url . $tag); } } } else { JFactory::getDocument()->addStyleSheet($url . $tag); } } } } // Include CSS files if (!empty(AkeebaStrapper::$cssURLs)) foreach (AkeebaStrapper::$cssURLs as $entry) { list($url, $tag) = $entry; if ($preload) { $myscripts .= '' . "\n"; } else { JFactory::getDocument()->addStyleSheet($url . $tag); } } // Include style definitions if (!empty(AkeebaStrapper::$cssDefs)) { $myscripts .= '' . "\n"; } if ($preload) { $pos = strpos($buffer, ""); if ($pos > 0) { $buffer = substr($buffer, 0, $pos + 6) . $myscripts . substr($buffer, $pos + 6); if (version_compare(JVERSION, '3.2', 'ge')) { JFactory::getApplication()->setBody($buffer); } else { JResponse::setBody($buffer); } } } } /** * Akeeba Strapper onAfterRender entry point. * * Makes sure Akeeba Strapper's bootstrap[.min].js is only loaded when * bootstrap[.min].js has not yet been loaded. */ function AkeebaStrapperOnAfterRender() { if (AkeebaStrapper::$_includedBootstrap) { if (version_compare(JVERSION, '3.2', 'ge')) { $buffer = JFactory::getApplication()->getBody(); } else { $buffer = JResponse::getBody(); } // Get all bootstrap[.min].js to remove $count = 0; $scriptsToRemove = array(); $scriptRegex = "/