コード例 #1
0
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new testBaseInitClass();
         ezcBaseInit::fetchConfig('testBaseInit', self::$instance);
     }
     return self::$instance;
 }
コード例 #2
0
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new customSingleton();
         ezcBaseInit::fetchConfig('customKey', self::$instance);
     }
     return self::$instance;
 }
コード例 #3
0
 /**
  * Returns the instance of the ezcSignalStaticConnections..
  *
  * @return ezcConfigurationManager
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new ezcSignalStaticConnections();
         ezcBaseInit::fetchConfig('ezcInitSignalStaticConnections', self::$instance);
     }
     return self::$instance;
 }
コード例 #4
0
ファイル: instance.php プロジェクト: jou/ymc-components
 /**
  * Returns the persistent session instance named $identifier.
  *
  * If $identifier is ommited the default persistent session
  * specified by chooseDefault() is returned.
  *
  * @throws ezcPersistentSessionNotFoundException if the specified instance is not found.
  * @param string $identifier
  * @return ezcPersistentSession
  */
 public static function get($identifier = null)
 {
     if ($identifier === null && self::$defaultInstanceIdentifier) {
         $identifier = self::$defaultInstanceIdentifier;
     }
     if (!isset(self::$instances[$identifier])) {
         // The ezcInitPersistentSessionInstance callback should return an
         // ezcPersistentSession object which will then be set as instance.
         $ret = ezcBaseInit::fetchConfig('ymcJobQueueInstance', $identifier);
         if ($ret === null) {
             throw new Exception('Did not find queue instance ' . $identifier);
         } else {
             self::set($ret, $identifier);
         }
     }
     return self::$instances[$identifier];
 }
コード例 #5
0
ファイル: debug.php プロジェクト: Adeelgill/livehelperchat
 /**
  * Returns the instance of this class.
  *
  * When the ezcDebug instance is created it is automatically added to the instance
  * of ezcLog.
  *
  * @return ezcDebug
  */
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new ezcDebug();
         ezcBaseInit::fetchConfig('ezcInitDebug', self::$instance);
     }
     return self::$instance;
 }
コード例 #6
0
 /**
  * Returns the database instance $identifier.
  *
  * If $identifier is ommited the default database instance
  * specified by chooseDefault() is returned.
  *
  * @throws ezcDbHandlerNotFoundException if the specified instance is not found.
  * @param string $identifier
  * @return ezcDbHandler
  */
 public static function get($identifier = false)
 {
     if ($identifier === false && self::$DefaultInstanceIdentifier) {
         $identifier = self::$DefaultInstanceIdentifier;
     }
     if (!isset(self::$Instances[$identifier])) {
         // The DatabaseInstanceFetchConfig callback should return an
         // ezcDbHandler object which will then be set as instance.
         $ret = ezcBaseInit::fetchConfig('ezcInitDatabaseInstance', $identifier);
         if ($ret === null) {
             throw new ezcDbHandlerNotFoundException($identifier);
         } else {
             self::set($ret, $identifier);
         }
     }
     return self::$Instances[$identifier];
 }
コード例 #7
0
ファイル: configuration.php プロジェクト: bmdevel/ezc
 /**
  * Returns the value of the property $name.
  *
  * @throws ezcBasePropertyNotFoundException if the property does not exist.
  * @param string $name
  * @ignore
  */
 public function __get($name)
 {
     switch ($name) {
         case 'locale':
             return $this->properties[$name];
         case 'manager':
             if ($this->properties[$name] === null) {
                 ezcBaseInit::fetchConfig('ezcInitTemplateTranslationManager', $this);
             }
             if ($this->properties[$name] === null) {
                 throw new ezcTemplateTranslationManagerNotConfiguredException();
             }
             return $this->properties[$name];
     }
     throw new ezcBasePropertyNotFoundException($name);
 }
コード例 #8
0
ファイル: manager.php プロジェクト: jacomyma/GEXF-Atlas
 /**
  * Returns the ezcCacheStorage object with the given ID.
  * The cache ID has to be defined before using the
  * {@link ezcCacheManager::createCache()} method. If no instance of this
  * cache does exist yet, it's created on the fly. If one exists, it will
  * be reused.
  *
  * @param string $id       The ID of the cache to return.
  * @return ezcCacheStorage The cache with the given ID.
  *
  * @throws ezcCacheInvalidIdException
  *         If the ID of a cache you try to access does not exist. To access
  *         a cache using this method, it first hast to be created using
  *         {@link ezcCacheManager::createCache()}.
  * @throws ezcBaseFileNotFoundException
  *         If the storage location does not exist. This should usually not
  *         happen, since {@link ezcCacheManager::createCache()} already
  *         performs sanity checks for the cache location. In case this
  *         exception is thrown, your cache location has been corrupted
  *         after the cache was configured.
  * @throws ezcBaseFileNotFoundException
  *         If the storage location is not a directory. This should usually
  *         not happen, since {@link ezcCacheManager::createCache()} already
  *         performs sanity checks for the cache location. In case this
  *         exception is thrown, your cache location has been corrupted
  *         after the cache was configured.
  * @throws ezcBaseFilePermissionException
  *         If the storage location is not writeable. This should usually not
  *         happen, since {@link ezcCacheManager::createCache()} already
  *         performs sanity checks for the cache location. In case this
  *         exception is thrown, your cache location has been corrupted
  *         after the cache was configured.
  * @throws ezcBasePropertyNotFoundException
  *         If you tried to set a non-existent option value. The accepted
  *         options depend on the ezcCacheStorage implementation and may
  *         vary.
  */
 public static function getCache($id)
 {
     // Look for already existing cache object
     if (!isset(self::$caches[$id])) {
         // Failed, look for configuration, and if it does not exist, use
         // delayed initialization.
         if (!isset(self::$configurations[$id])) {
             ezcBaseInit::fetchConfig('ezcInitCacheManager', $id);
         }
         // Check whether delayed initialization actually worked, if not,
         // throw an exception
         if (!isset(self::$configurations[$id])) {
             throw new ezcCacheInvalidIdException($id);
         }
         $class = self::$configurations[$id]['class'];
         self::$caches[$id] = new $class(self::$configurations[$id]['location'], self::$configurations[$id]['options']);
     }
     return self::$caches[$id];
 }
コード例 #9
0
 /**
  * Returns the instance of the class ezcConfigurationManager.
  *
  * @return ezcConfigurationManager
  */
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new ezcConfigurationManager();
         ezcBaseInit::fetchConfig('ezcInitConfigurationManager', self::$instance);
     }
     return self::$instance;
 }
コード例 #10
0
 /**
  * Returns the instance of the class
  *
  * @param boolean $isCliMode
  * @return CjwNewsletterLog
  */
 public static function getInstance($isCliMode = false)
 {
     try {
         if (is_null(self::$instance)) {
             self::$instance = new self($isCliMode);
             ezcBaseInit::fetchConfig('cjwNewsletterInitLog', self::$instance);
         }
         return self::$instance;
     } catch (ezcBaseFilePermissionException $e) {
         eZDebug::writeError($e->getMessage(), 'CjwNewsletterLog::getInstance()');
         if ($isCliMode) {
             $output = new ezcConsoleOutput();
             $output->formats->error->color = 'red';
             $output->formats->error->style = array('bold');
             $output->outputLine($e->getMessage(), 'error');
             exit;
         }
     }
 }
コード例 #11
0
ファイル: configuration.php プロジェクト: jacomyma/GEXF-Atlas
 /**
  * Returns the unique configuration instance named $name.
  *
  * Note: You only need to specify the name if you need multiple configuration
  *       objects.
  *
  * @param string $name  Name of the configuration to use.
  * @return ezcTemplateConfiguration
  */
 public static function getInstance($name = "default")
 {
     if (!isset(self::$instanceList[$name])) {
         self::$instanceList[$name] = new ezcTemplateConfiguration();
         ezcBaseInit::fetchConfig('ezcInitTemplateConfiguration', self::$instanceList[$name]);
     }
     return self::$instanceList[$name];
 }
コード例 #12
0
ファイル: xml.php プロジェクト: jou/ymc-components
 /**
  * Returns an instance of self for the given path.
  *
  * The lazy_initialization mechanism of eZ Components can be used to prepend the given path.
  * 
  * @param string $path optional, 
  * @return ymcPipeDefinitionStorageXml
  */
 public static function getInstance($path = '')
 {
     // ':' may not be a path, so we can use it to store the default instance
     $key = $path ? $path : ':';
     if (!array_key_exists($key, self::$instances)) {
         $instance = ezcBaseInit::fetchConfig(__CLASS__, $path);
         self::$instances[$key] = $instance ? $instance : new self($path);
     }
     return self::$instances[$key];
 }