本文整理汇总了PHP中ezcBaseInit类的典型用法代码示例。如果您正苦于以下问题:PHP ezcBaseInit类的具体用法?PHP ezcBaseInit怎么用?PHP ezcBaseInit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ezcBaseInit类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getInstance
public static function getInstance()
{
if (is_null(self::$instance)) {
self::$instance = new testBaseInitClass();
ezcBaseInit::fetchConfig('testBaseInit', self::$instance);
}
return self::$instance;
}
开发者ID:andikoller,项目名称:FHC-3.0-FHBGLD,代码行数:8,代码来源:base_init_class.php
示例2: getInstance
/**
* 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;
}
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:13,代码来源:static_connections.php
示例3: getInstance
public static function getInstance()
{
if (self::$instance === null) {
self::$instance = new customSingleton();
ezcBaseInit::fetchConfig('customKey', self::$instance);
}
return self::$instance;
}
开发者ID:mediasadc,项目名称:alba,代码行数:8,代码来源:tutorial_lazy_initialization.php
示例4: testDelayedInit
public function testDelayedInit()
{
ezcBaseInit::setCallback('ezcInitLog', 'testDelayedInitLog');
$log = ezcLog::getInstance();
$rule = new ezcLogFilterRule(new ezcLogFilter(), $writer = new ezcLogUnixFileWriter('/'), true);
$expected = new ezcLogFilterSet();
$expected->appendRule($rule);
$this->assertAttributeEquals($expected, 'writers', $log);
}
开发者ID:bmdevel,项目名称:ezc,代码行数:9,代码来源:log_delayed_init_test.php
示例5: testCallback3
public function testCallback3()
{
try {
ezcBaseInit::setCallback('testBaseInit', 'testBaseInitCallback');
$this->fail("Expected exception not thrown.");
} catch (ezcBaseInitCallbackConfiguredException $e) {
$this->assertEquals("The 'testBaseInit' is already configured with callback class 'testBaseInitCallback'.", $e->getMessage());
}
}
开发者ID:BGCX261,项目名称:zphp-svn-to-git,代码行数:9,代码来源:base_init_test.php
示例6: get
/**
* 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];
}
开发者ID:jou,项目名称:ymc-components,代码行数:27,代码来源:instance.php
示例7: testDelayedInit
public function testDelayedInit()
{
ezcBaseInit::setCallback('ezcInitConfigurationManager', 'testDelayedInitConfigurationManager');
$cfg = ezcConfigurationManager::getInstance();
$this->assertAttributeEquals('ezcConfigurationIniReader', 'readerClass', $cfg);
}
开发者ID:zetacomponents,项目名称:configuration,代码行数:6,代码来源:configuration_manager_delayed_init_test.php
示例8: getCache
/**
* 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];
}
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:56,代码来源:manager.php
示例9: testDelayedInit1
public function testDelayedInit1()
{
ezcBaseInit::setCallback('ezcInitDatabaseInstance', 'testDelayedInitDatabaseInstance');
$instance1 = ezcDbInstance::get('delayed1');
}
开发者ID:bmdevel,项目名称:ezc,代码行数:5,代码来源:instance_delayed_init_test.php
示例10: getInstance
/**
* 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;
}
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:13,代码来源:configuration_manager.php
示例11: testDelayedInit
public function testDelayedInit()
{
ezcBaseInit::setCallback('ezcInitDebug', 'testDelayedInitDebug');
$dbg = ezcDebug::getInstance();
$this->assertAttributeEquals(new TestReporter(), 'formatter', $dbg);
}
开发者ID:bmdevel,项目名称:ezc,代码行数:6,代码来源:debug_delayed_init_test.php
示例12: testDelayedInit
public function testDelayedInit()
{
ezcBaseInit::setCallback('ezcUrlConfiguration', 'testDelayedInitUrlConfiguration');
$urlCfg = ezcUrlConfiguration::getInstance();
$this->assertEquals(array('section' => 0), $urlCfg->orderedParameters);
$this->assertEquals(array('article' => 1), $urlCfg->unorderedParameters);
}
开发者ID:zetacomponents,项目名称:url,代码行数:7,代码来源:url_configuration_test.php
示例13: write
<?php
class erLhcoreClassLog implements ezcBaseConfigurationInitializer
{
// to write to the log put a write statement in the code with the content to log
//
// Example: erLhcoreClassLog::write(print_r($_POST,true));
// or: erLhcoreClassLog::write("Log entry");
//
// default log location is CACHE/DEFAULT.LOG since it is writable Change below.
static function write($msg)
{
// Use log
$log = ezcLog::getInstance();
$log->log($msg, ezcLog::WARNING);
}
public static function configureObject($log)
{
$writeAll = new ezcLogUnixFileWriter("cache", "default.log");
$log->getMapper()->appendRule(new ezcLogFilterRule(new ezcLogFilter(), $writeAll, true));
}
}
ezcBaseInit::setCallback('ezcInitLog', 'erLhcoreClassLog');
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:23,代码来源:lhlog.php
示例14: get
/**
* 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];
}
开发者ID:mdb-webdev,项目名称:livehelperchat,代码行数:27,代码来源:instance.php
示例15: getInstance
/**
* 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];
}
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:17,代码来源:configuration.php
示例16: testGetCacheDelayedInit2
public function testGetCacheDelayedInit2()
{
testDelayedInitCacheManager::$tmpDir = $this->createTempDir(__CLASS__);
ezcBaseInit::setCallback('ezcInitCacheManager', 'testDelayedInitCacheManager');
$cache = ezcCacheManager::getCache('simple');
self::assertSame('.cache', $cache->options->extension);
}
开发者ID:zetacomponents,项目名称:cache,代码行数:7,代码来源:manager_test.php
示例17: __get
/**
* 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);
}
开发者ID:bmdevel,项目名称:ezc,代码行数:23,代码来源:configuration.php
示例18: define
<?php
/**
* Tests configurationfile
*/
define( 'ROOT', getcwd() );
ini_set( 'include_path', "/usr/share/php/ezc:/usr/share/php" . ROOT );
require 'Base/ezc_bootstrap.php';
$options = new ezcBaseAutoloadOptions( array( 'debug' => true ) );
ezcBase::setOptions( $options );
// Add the class repository containing our application's classes. We store
// those in the /lib directory and the classes have the "tcl" prefix.
ezcBase::addClassRepository( ROOT . "/lib", ROOT . "/lib/autoload", 'mm' );
class mmLazySettingsConfiguration implements ezcBaseConfigurationInitializer
{
public static function configureObject( $cfgManager )
{
$cfgManager->init( 'ezcConfigurationIniReader', ROOT . "/tests/config" );
}
}
ezcBaseInit::setCallback(
'ezcInitConfigurationManager',
'mmLazySettingsConfiguration'
);
?>
开发者ID:rangulicon,项目名称:mkvmanager,代码行数:30,代码来源:config.php
示例19: configureObject
<?php
require_once 'tutorial_autoload.php';
class customLazyPersistentSessionConfiguration implements ezcBaseConfigurationInitializer
{
public static function configureObject($instance)
{
switch ($instance) {
case null:
// Default instance
$session = new ezcPersistentSession(ezcDbInstance::get(), new ezcPersistentCodeManager('../persistent'));
return $session;
case 'second':
$session = new ezcPersistentSession(ezcDbInstance::get(), new ezcPersistentCodeManager('../additionalPersistent'));
return $session;
}
}
}
ezcBaseInit::setCallback('ezcInitPersistentSessionInstance', 'customLazyPersistentSessionConfiguration');
// Create and configure default persistent session
$db = ezcPersistentSessionInstance::get();
// Create and configure additional persistent session
$sb = ezcPersistentSessionInstance::get('second');
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:23,代码来源:tutorial_lazy_initialization.php
示例20: configureObject
<?php
require_once 'tutorial_autoload.php';
class customLazyTemplateConfiguration implements ezcBaseConfigurationInitializer
{
public static function configureObject($cfg)
{
$cfg->templatePath = "/usr/share/templates";
$cfg->compilePath = "/tmp/compiled_templates";
$cfg->context = new ezcTemplateXhtmlContext();
}
}
ezcBaseInit::setCallback('ezcInitTemplateConfiguration', 'customLazyTemplateConfiguration');
$t = new ezcTemplate();
$t->process("hello_world.ezt");
开发者ID:bmdevel,项目名称:ezc,代码行数:15,代码来源:tutorial_lazy_initialization.php
注:本文中的ezcBaseInit类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论