示例#1
0
 /**
  * Initializes all the stylesheet that needs to load on the page
  *
  * @since	1.0
  * @access	public
  * @return
  */
 public function initStylesheets()
 {
     static $profiles = array();
     if (isset(self::$options['processStylesheets']) && self::$options['processStylesheets'] == false) {
         self::$loaded = true;
         return;
     }
     if (self::$stylesheetsLoaded) {
         return;
     }
     $app = JFactory::getApplication();
     $config = FD::config();
     $doc = JFactory::getDocument();
     // Build theme styles
     $location = $app->isAdmin() ? 'admin' : 'site';
     $theme = strtolower($config->get('theme.' . $location));
     if ($location == 'site') {
         $profile = FD::user()->getProfile();
         if ($profile && !isset($profiles[$profile->id])) {
             $params = $profile->getParams();
             $override = $params->get('theme');
             if ($override) {
                 $theme = $override;
             }
             $profiles[$profile->id] = $theme;
         }
         if ($profile && isset($profiles[$profile->id])) {
             $theme = $profiles[$profile->id];
         }
     }
     $stylesheet = FD::stylesheet($location, $theme);
     $stylesheet->attach();
     // @TODO: Make this part of ATS in the future
     // If this is RTL, load RTL specific styles
     $direction = $doc->getDirection();
     if ($direction == 'rtl') {
         $rtlStylesheet = rtrim(JURI::root(), '/') . '/components/com_easysocial/themes/wireframe/styles/rtl.css';
         $doc->addStylesheet($rtlStylesheet);
     }
     self::$stylesheetsLoaded = true;
 }
示例#2
0
 /**
  * Initializes all the stylesheet that needs to load on the page
  *
  * @since	1.0
  * @access	public
  * @return
  */
 public function initStylesheets()
 {
     static $profiles = array();
     if (isset(self::$options['processStylesheets']) && self::$options['processStylesheets'] == false) {
         self::$loaded = true;
         return;
     }
     if (self::$stylesheetsLoaded) {
         return;
     }
     // Build theme styles
     $location = $this->app->isAdmin() ? 'admin' : 'site';
     $theme = strtolower($this->config->get('theme.' . $location));
     // Build theme styles
     $stylesheet = FD::stylesheet($location, $theme);
     $stylesheet->attach();
     // Site location
     if ($location == 'site') {
         $profile = FD::user()->getProfile();
         if ($profile && !isset($profiles[$profile->id])) {
             $params = $profile->getParams();
             $override = $params->get('theme');
             if ($override) {
                 $theme = $override;
             }
             $profiles[$profile->id] = $theme;
         }
         if ($profile && isset($profiles[$profile->id])) {
             $theme = $profiles[$profile->id];
         }
         // Check if custom.css exists on the site as template overrides
         $file = JPATH_ROOT . '/templates/' . $this->app->getTemplate() . '/html/com_easysocial/css/custom.css';
         if (JFile::exists($file)) {
             $customCssFile = rtrim(JURI::root(), '/') . '/templates/' . $this->app->getTemplate() . '/html/com_easysocial/css/custom.css';
             $this->doc->addStylesheet($customCssFile);
         }
     }
     // @TODO: Make this part of ATS in the future
     // If this is RTL, load RTL specific styles
     $direction = $this->doc->getDirection();
     if ($direction == 'rtl') {
         if ($theme == 'wireframe' || $theme == 'frosty') {
             $rtlStylesheet = rtrim(JURI::root(), '/') . '/components/com_easysocial/themes/' . $theme . '/styles/rtl.css';
             $this->doc->addStylesheet($rtlStylesheet);
         }
     }
     self::$stylesheetsLoaded = true;
 }