Exemple #1
0
 public static function load($parser, $token)
 {
     $bits = self::split($token->contents);
     foreach (array_slice($bits, 1) as $taglib) {
         try {
             if (strpos($taglib, '.')) {
                 $tmp = explode('.', $taglib);
                 foreach ($tmp as &$val) {
                     $val = ucfirst(strtolower($val));
                 }
                 $classname = implode(DIRECTORY_SEPARATOR, $tmp);
             } else {
                 $classname = ucfirst(strtolower($taglib));
             }
             try {
                 Shine::loadTag($classname);
             } catch (Shine_Exception $e) {
                 throw new Shine_Exception_InvalidTemplateLibrary();
             }
             $lib = new $classname();
             $parser->addLibrary($lib);
         } catch (Shine_Exception_InvalidTemplateLibrary $e) {
             throw new Shine_Exception_SyntaxError("'{$taglib}' is not a valid tag library");
         }
     }
     return new Shine_Node_Load();
 }