Guest User

Untitled

a guest
Nov 21st, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. class AssetManager extends \Nette\Object
  2. {
  3.     /** @var array */
  4.     protected static $stylesheets = array();
  5.  
  6.     public static function addCss($file)
  7.     {
  8.     list($filename, $path) = static::parseFile($file);
  9.  
  10.     if (!in_array($filename, static::$stylesheets)) {
  11.         static::$stylesheets[$filename] = [
  12.         'src' => $path . $filename,
  13.         ];
  14.     }
  15.     }
  16.     public static function getCss()
  17.     {
  18.     return static::$stylesheets;
  19.     }
  20.  
  21.     private static function parseFile($file)
  22.     {
  23.     $explode = explode('/', $file);
  24.  
  25.     $path = preg_replace('/[^\/]+$/', '$1', $file) ? : NULL;
  26.     $filename = end($explode);
  27.  
  28.     return array($filename, $path);
  29.     }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment