Пример #1
0
 public static function setupRegistry()
 {
     self::$registry = new Zend_Registry(array(), ArrayObject::ARRAY_AS_PROPS);
     Zend_Registry::setInstance(self::$registry);
     $registry = Zend_Registry::getInstance();
     $registry->set('root', self::$root);
 }
Пример #2
0
 /**
  * @return \Zend_Registry
  */
 protected function getRegistry()
 {
     if (null == $this->registry) {
         $this->registry = new \Zend_Registry(array(), \ArrayObject::ARRAY_AS_PROPS);
         \Zend_Registry::setInstance($this->registry);
     }
     return $this->registry;
 }
Пример #3
0
 /**
  * Set the default registry instance to a specified instance.
  *
  * @param Zend_Registry $registry An object instance of type Zend_Registry,
  *   or a subclass.
  * @return void
  * @throws Zend_Exception if registry is already initialized.
  */
 public static function setInstance(Zend_Registry $registry)
 {
     if (self::$_registry !== null) {
         // require_once 'Zend/Exception.php';
         throw new Zend_Exception('Registry is already initialized');
     }
     parent::setInstance($registry);
     self::$_registryClassName = get_class($registry);
     self::$_registry = $registry;
 }
Пример #4
0
 /**
  * Initilize the Zend Registry
  * @return Zend_Registry
  */
 protected function _initRegistry()
 {
     $registry = new Zend_Registry();
     // List of all US states
     $registry["us_states"] = array('AL' => "Alabama", 'AK' => "Alaska", 'AZ' => "Arizona", 'AR' => "Arkansas", 'CA' => "California", 'CO' => "Colorado", 'CT' => "Connecticut", 'DE' => "Delaware", 'DC' => "District Of Columbia", 'FL' => "Florida", 'GA' => "Georgia", 'HI' => "Hawaii", 'ID' => "Idaho", 'IL' => "Illinois", 'IN' => "Indiana", 'IA' => "Iowa", 'KS' => "Kansas", 'KY' => "Kentucky", 'LA' => "Louisiana", 'ME' => "Maine", 'MD' => "Maryland", 'MA' => "Massachusetts", 'MI' => "Michigan", 'MN' => "Minnesota", 'MS' => "Mississippi", 'MO' => "Missouri", 'MT' => "Montana", 'NE' => "Nebraska", 'NV' => "Nevada", 'NH' => "New Hampshire", 'NJ' => "New Jersey", 'NM' => "New Mexico", 'NY' => "New York", 'NC' => "North Carolina", 'ND' => "North Dakota", 'OH' => "Ohio", 'OK' => "Oklahoma", 'OR' => "Oregon", 'PA' => "Pennsylvania", 'RI' => "Rhode Island", 'SC' => "South Carolina", 'SD' => "South Dakota", 'TN' => "Tennessee", 'TX' => "Texas", 'UT' => "Utah", 'VT' => "Vermont", 'VA' => "Virginia", 'WA' => "Washington", 'WV' => "West Virginia", 'WI' => "Wisconsin", 'WY' => "Wyoming");
     // Load our configuration file
     $registry["config"] = new Zend_Config_Ini(APPLICATION_PATH . "/configs/config.ini", APPLICATION_ENV);
     // US Timezones
     $registry["timezones"] = array("America/Juneau" => "Alaska", "America/Phoenix" => "Arizona", "Pacific/Honolulu" => "Hawaii-Aleutian", "America/Seattle" => "Pacific", "America/Denver" => "Mountain", "America/Chicago" => "Central", "America/New_York" => "Eastern", "America/Manaus" => "Atlantic");
     Zend_Registry::setInstance($registry);
     return $registry;
 }
Пример #5
0
 public function testRegistryExceptionAlreadyInitialized()
 {
     $registry = Zend_Registry::getInstance();
     try {
         Zend_Registry::setClassName('anyclass');
         $this->fail('Expected exception, because we cannot initialize the registry if it is already initialized.');
     } catch (Zend_Exception $e) {
         $this->assertContains('Registry is already initialized', $e->getMessage());
     }
     try {
         Zend_Registry::setInstance(new Zend_Registry());
         $this->fail('Expected exception, because we cannot initialize the registry if it is already initialized.');
     } catch (Zend_Exception $e) {
         $this->assertContains('Registry is already initialized', $e->getMessage());
     }
 }
Пример #6
0
 /**
  * Setup the application registry.
  */
 public static function setupRegistry()
 {
     // Create an instance of the registry.
     self::$registry = new Zend_Registry(array(), ArrayObject::ARRAY_AS_PROPS);
     // Set the default instance.
     Zend_Registry::setInstance(self::$registry);
 }
Пример #7
0
<?php

error_reporting(E_ALL);
defined('ROOT_PATH') || define('ROOT_PATH', realpath(dirname(__FILE__)));
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path())));
define('INI_PATH', '/configs/application.ini');
/** Zend_Application */
require_once 'Zend/Application.php';
require_once 'Zend/Registry.php';
require_once APPLICATION_PATH . "/common/Common.php";
$registry = new Zend_Registry(array('index' => $value));
Zend_Registry::setInstance($registry);
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . INI_PATH);
$application->bootstrap()->run();
Пример #8
0
 /**
  * Initializes the Zend_Registry
  * 
  * Was Part of main initialize method
  * 
  * @access private
  * @static
  * @return boolean
  */
 private static function _initializeRegistry()
 {
     $registry = new Zend_Registry(array(), ArrayObject::ARRAY_AS_PROPS);
     Zend_Registry::setInstance($registry);
     return $registry;
 }