Exemplo n.º 1
0
 /**
  * Add a css style file to the document with browser based checks
  * @param  $file
  * @return void
  */
 function gantry_addStyle($file)
 {
     gantry_import('core.gantrybrowser');
     $browser = new GantryBrowser();
     $document =& JFactory::getDocument();
     $filename = basename($file);
     $relative_path = dirname($file);
     // For local url path get the local path based on checks
     $file_path = gantry_getFilePath($file);
     $url_file_checks = $browser->getChecks($file_path, true);
     foreach ($url_file_checks as $url_file) {
         $full_path = realpath($url_file);
         if ($full_path !== false && file_exists($full_path)) {
             $document->addStyleSheet($relative_path . '/' . basename($full_path) . '?ver=3.2.11');
         }
     }
 }
Exemplo n.º 2
0
 /**
  * @param      $file
  *
  * @param bool $keep_path
  *
  * @return array
  */
 protected function getBrowserBasedChecks($file, $keep_path = false)
 {
     $ext = substr($file, strrpos($file, '.'));
     $path = $keep_path ? dirname($file) . '/' : '';
     $filename = basename($file, $ext);
     $checks = $this->browser->getChecks($file, $keep_path);
     // check if RTL version needed
     $document = $this->document;
     if ($document->direction == 'rtl' && $this->get('rtl-enabled')) {
         $checks[] = $path . $filename . '-rtl' . $ext;
     }
     return $checks;
 }