.

ControllerDefaultClassInstantiater Class Reference
[Controller]

Class to detect controller classed and create one instance of each. More...

Inheritance diagram for ControllerDefaultClassInstantiater:
IClassInstantiater

List of all members.

Public Member Functions

  get_all ()

Protected Member Functions

  instantiate_direcory ($directory)

Detailed Description

Class to detect controller classed and create one instance of each.

Author:
Gerd Riesselmann

Definition at line 8 of file controllerdefaultclassinstantiater.cls.php.


Member Function Documentation

ControllerDefaultClassInstantiater::get_all (  ) 

Implements IClassInstantiater.

Definition at line 9 of file controllerdefaultclassinstantiater.cls.php.

00009                                   {
00010                 $ret = array();
00011                 $dirs = Load::get_base_directories();
00012                 foreach($dirs as $dir) {
00013                         $ret = array_merge($ret, $this->instantiate_direcory($dir));
00014                 }
00015                 return $ret;
00016         } 
ControllerDefaultClassInstantiater::instantiate_direcory ( directory  )  [protected]

Definition at line 18 of file controllerdefaultclassinstantiater.cls.php.

00018                                                             {
00019                 $ret = array();
00020                 foreach (gyro_glob($directory . 'controller/*.controller.php') as $inc) {
00021                         include_once($inc);
00022                         // Detect controller name from filename
00023                         // ".", "-" and "_" get translated to camel case:
00024                         // index.base.controller.php => IndexBaseController
00025                         $controllername = basename($inc, '.php');
00026                         $controllername = strtr($controllername, '.-_', '   ');
00027                         $controllername = ucwords($controllername);
00028                         $controllername = str_replace(' ', '', $controllername);
00029                         if (class_exists($controllername)) {
00030                                 $ret[] = new $controllername;
00031                         }
00032                         else {
00033                                 throw new Exception(tr('Controller %c not found', 'core', array('%c' => $controllername)));                             
00034                         }
00035                 }
00036                 return $ret;
00037         }

The documentation for this class was generated from the following file: