Esempio n. 1
0
 public function __construct($config = array())
 {
     $document = JFactory::getDocument();
     //load dialog stylesheet in backend
     KomentoDocumentHelper::loadHeaders();
     $config = Komento::getConfig();
     $konfig = Komento::getKonfig();
     $toolbar = JToolbar::getInstance('toolbar');
     $toolbar->addButtonPath(KOMENTO_ADMIN_ROOT . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'images');
     if ($document->getType() == 'html') {
         require_once KOMENTO_CLASSES . DIRECTORY_SEPARATOR . 'configuration.php';
         $configuration = KomentoConfiguration::getInstance();
         $configuration->attach();
     }
     $version = str_ireplace('.', '', Komento::komentoVersion());
     $document->addScript(rtrim(JURI::root(), '/') . '/administrator/components/com_komento/assets/js/admin.js?' . $version);
     $document->addStyleSheet(rtrim(JURI::root(), '/') . '/administrator/components/com_komento/assets/css/reset.css?' . $version);
     $document->addStyleSheet(rtrim(JURI::root(), '/') . '/components/com_komento/assets/css/common.css?' . $version);
     $document->addStyleSheet(rtrim(JURI::root(), '/') . '/administrator/components/com_komento/assets/css/style.css?' . $version);
     // For the sake of loading the core.js in Joomla 1.6 (1.6.2 onwards)
     if (Komento::joomlaVersion() >= '1.6') {
         JHTML::_('behavior.framework');
     }
     parent::__construct($config);
 }
Esempio n. 2
0
 /**
  * Function to add js file, js script block and css file
  * to HEAD section
  */
 public static function load($list, $type = 'js', $location = 'themes')
 {
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = Komento::getConfig();
     $kApp = Komento::loadApplication();
     // Always load mootools first so it will not conflict.
     // JHTML::_('behavior.mootools');
     $files = explode(',', $list);
     $dir = JURI::root() . 'components/com_komento/assets';
     $pathdir = KOMENTO_ASSETS;
     $theme = $config->get('layout_theme');
     $version = str_ireplace('.', '', Komento::komentoVersion());
     if ($location != 'assets') {
         $dir = JURI::root() . 'components/com_komento/themes/' . $theme;
         $pathdir = KOMENTO_THEMES . DIRECTORY_SEPARATOR . $theme;
     }
     foreach ($files as $file) {
         if ($type == 'js') {
             $file .= '.js?' . $version;
         } elseif ($type == 'css') {
             $file .= '.css';
         }
         $path = '';
         if ($location == 'themes') {
             $checkOverride = JPATH_ROOT . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $mainframe->getTemplate() . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $file;
             $checkComponent = $kApp->getComponentThemePath() . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $file;
             $checkSelected = KOMENTO_THEMES . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $file;
             $checkDefault = KOMENTO_THEMES . DIRECTORY_SEPARATOR . 'kuro' . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $file;
             $overridePath = JURI::root() . 'templates/' . $mainframe->getTemplate() . '/html/com_komento/' . $type . '/' . $file;
             $componentPath = $kApp->getComponentThemeURI() . '/' . $type . '/' . $file;
             $selectedPath = $dir . '/' . $type . '/' . $file;
             $defaultPath = JURI::root() . 'components/com_komento/themes/kuro/' . $type . '/' . $file;
             // 1. Template overrides
             if (JFile::exists($checkOverride)) {
                 $path = $overridePath;
                 $pathdir = $checkOverride;
             } elseif (JFile::exists($checkSelected)) {
                 $path = $selectedPath;
                 $pathdir = $checkSelected;
             } else {
                 $path = $defaultPath;
                 $path = $checkDefault;
             }
         } else {
             $path = $dir . '/' . $type . '/' . $file;
             $pathdir = $pathdir . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $file;
         }
         if ($type == 'js') {
             $document->addScript($path);
         } elseif ($type == 'css') {
             if (JFile::exists($pathdir)) {
                 $document->addStylesheet($path);
             }
         }
     }
 }
Esempio n. 3
0
 public function getVersion()
 {
     $ajax = Komento::getAjax();
     $local = Komento::komentoVersion();
     $remote = Komento::getHelper('Version')->getVersion();
     $html = '<span class="version_outdated">' . JText::sprintf('COM_KOMENTO_VERSION_OUTDATED', $local) . '</span>';
     if ((string) $local >= (string) $remote) {
         $html = '<span class="version_latest">' . JText::sprintf('COM_KOMENTO_VERSION_LATEST', $local) . '</span>';
     }
     $ajax->success($html);
     $ajax->send();
 }
Esempio n. 4
0
 public function getVersion()
 {
     $ajax = Komento::getAjax();
     $local = Komento::komentoVersion();
     $remote = Komento::getHelper('Version')->getVersion();
     // Test build only since build will always be incremented regardless of version
     $localVersion = explode('.', $local);
     $localBuild = $localVersion[2];
     $remoteVersion = explode('.', $remote);
     $build = $remoteVersion[2];
     $html = '<span class="version_outdated">' . JText::sprintf('COM_KOMENTO_VERSION_OUTDATED', $local) . '</span>';
     if ($localBuild >= $build) {
         $html = '<span class="version_latest">' . JText::sprintf('COM_KOMENTO_VERSION_LATEST', $local) . '</span>';
     }
     $ajax->success($html);
     $ajax->send();
 }