Advertisement
fruffl

WTF WTF WTF

Jan 26th, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.06 KB | None | 0 0
  1.  
  2.        
  3.         public static function type($type, $content = null, array $options = array())
  4.         {
  5.             $defaults =
  6.             [
  7.                 'view'      => false,
  8.                 'encode'    => false,
  9.                 'decode'    => false,
  10.                 'cast'      => true,
  11.                 'conditions'    => [],
  12.                 'paths'     =>
  13.                 [
  14.                     'template'  => '{:lib}/views/{:controller}/{:template}.{:type}.php',
  15.                     'layout'    => '{:lib}/views/layouts/{:layout}.{:type}.php',
  16.                     'element'   => '{:lib}/views/elements/{:template}.{:type}.php'
  17.                 ]
  18.             ];
  19.        
  20.             if($content === false)
  21.                 unset(static::$__types[$type], static::$__handlers[$type]);
  22.            
  23.             if(!$content && !$options)
  24.             {
  25.                 if(!$content = static::__types($type))
  26.                     return;
  27.                
  28.                 if(strpos($type, '/'))
  29.                     return $content;
  30.                
  31.                 if(is_array($content) && isset($content['alias']))
  32.                     return static::type($content['alias']);
  33.                
  34.                 return compact('content') + array('options' => static::handlers($type));
  35.             }
  36.            
  37.             if($content)
  38.                 static::$__types[$type] = (array) $content;
  39.            
  40.             static::$__handlers[$type] = $options ? Set::merge($defaults, $options) : [];
  41.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement