Example #1
0
 /**
  *
  * @param type $className 
  */
 public static function autoload($className)
 {
     $result = ZendT_Loader::loadFile($className);
     if (!$result) {
         throw new ZendT_Exception(error_get_last());
     }
 }
Example #2
0
 /**
  * Constructor
  *
  * Initialize application. Potentially initializes include_paths, PHP
  * settings, and bootstrap class.
  *
  * @param  string                   $environment
  * @param  string|array|Zend_Config $options String path to configuration file, or array/Zend_Config of configuration options
  * @throws Zend_Application_Exception When invalid options are provided
  * @return void
  */
 public function __construct($environment, $options = null)
 {
     $this->_environment = (string) $environment;
     require_once 'ZendT/Loader.php';
     ZendT_Loader::registerAutoload();
     if (null !== $options) {
         if (is_string($options)) {
             $options = $this->_loadConfig($options);
         } elseif ($options instanceof Zend_Config) {
             $options = $options->toArray();
         } elseif (!is_array($options)) {
             throw new Zend_Application_Exception('Invalid options provided; must be location of config file, a config object, or an array');
         }
         $this->setOptions($options);
     }
 }
Example #3
0
 /**
  *
  * @param string $name
  * @param array $arguments
  * @return stdClass
  * @throws ZendT_Exception 
  */
 public function __call($name, $arguments)
 {
     if (method_exists($this, $name)) {
         $obj = $this;
     } else {
         foreach ($this->_helperPath as $value) {
             $className = $value . '_' . ucfirst($name);
             if (ZendT_Loader::loadFile($className)) {
                 break;
             } else {
                 $className = null;
             }
         }
         if ($className == null) {
             $obj = null;
         } else {
             $obj = new $className();
         }
     }
     if ($obj == null) {
         throw new ZendT_Exception('Plugin "' . $name . '" not found in "' . implode(',', $this->helperPath) . '" ');
     }
     return call_user_method($name, $obj, $arguments);
 }