Exemplo n.º 1
0
 /**
  * Generate an absolute URL to the given path.
  *
  * @param  string  $path
  * @param  mixed  $extra
  * @param  bool|null  $secure
  * @return string
  */
 public function to($path, $extra = [], $secure = null)
 {
     if ($this->isValidUrl($path)) {
         return $path;
     }
     if (!strpos($path, '/rtlweb/rtler/assets/css/rtl.css')) {
         $backendUri = Config::get('cms.backendUri', 'backend');
         $requestUrl = Request::url();
         if (File::exists(base_path(dirname($path)) . '.rtl.' . File::extension($path))) {
             $path = dirname($path) . '.rtl.' . File::extension($path);
         } else {
             if (File::extension($path) == 'css' && (strpos($requestUrl, $backendUri) || strpos($path, 'plugins/') || strpos($path, 'modules/'))) {
                 $path = CssFlipper::flipCss($path);
             }
         }
     }
     return parent::to($path, $extra, $secure);
 }
Exemplo n.º 2
0
 /**
  * Twig Markup Filter 'flipCss'
  * @param $paths
  * @param bool $force
  * @return array|string
  */
 public function flipCss($paths)
 {
     if (!LanguageDetector::isRtl()) {
         return $paths;
     }
     if (!is_array($paths)) {
         $paths = [$paths];
     }
     $rPaths = [];
     foreach ($paths as $path) {
         $assetPath = $path;
         if (File::exists(dirname($assetPath) . '/' . File::name($assetPath) . '.rtl.' . File::extension($assetPath))) {
             $newPath = dirname($assetPath) . '.rtl.' . File::extension($assetPath);
         } else {
             $newPath = CssFlipper::flipCss($assetPath, true);
         }
         $rPaths[] = $newPath;
     }
     return $rPaths;
 }