コード例 #1
0
ファイル: template.php プロジェクト: stonyyi/anahita
 /**
  * Get the classname based on an identifier.
  *
  * @param 	mixed  		 An identifier object - koowa:[path].name
  *
  * @return string|false Return object on success, returns FALSE on failure
  */
 public function findClass(KServiceIdentifier $identifier)
 {
     $classname = 'Tmpl' . ucfirst($identifier->package) . KInflector::implode($identifier->path) . ucfirst($identifier->name);
     if (!$this->getService('koowa:loader')->loadClass($classname, $identifier->basepath)) {
         $classname = AnServiceClass::findDefaultClass($identifier);
         if (!$classname) {
             //$path      = KInflector::implode($identifier->path);
             $classpath = $identifier->path;
             $classtype = !empty($classpath) ? array_shift($classpath) : '';
             //Create the fallback path and make an exception for views
             $path = $classtype != 'view' ? ucfirst($classtype) . KInflector::camelize(implode('_', $classpath)) : ucfirst($classtype);
             $classes[] = 'Tmpl' . ucfirst($identifier->package) . $path . ucfirst($identifier->name);
             $classes[] = 'Tmpl' . ucfirst($identifier->package) . $path . 'Default';
             $classes[] = 'ComApplication' . $path . ucfirst($identifier->name);
             $classes[] = 'ComApplication' . $path . 'Default';
             $classes[] = 'LibApplication' . $path . ucfirst($identifier->name);
             $classes[] = 'LibApplication' . $path . 'Default';
             $classes[] = 'LibBase' . $path . ucfirst($identifier->name);
             $classes[] = 'LibBase' . $path . 'Default';
             $classes[] = 'K' . $path . ucfirst($identifier->name);
             $classes[] = 'K' . $path . 'Default';
             foreach ($classes as $class) {
                 if ($this->getService('koowa:loader')->loadClass($class, $identifier->basepath)) {
                     $classname = $class;
                     break;
                 }
             }
             if ($classname) {
                 AnServiceClass::setDefaultClass($identifier, $classname);
             }
         }
     }
     return $classname;
 }
コード例 #2
0
ファイル: class.php プロジェクト: stonyyi/anahita
function unregister_default($identifier)
{
    AnServiceClass::setDefaultClass($identifier, null);
}