本文整理汇总了PHP中ezcBase::addClassRepository方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcBase::addClassRepository方法的具体用法?PHP ezcBase::addClassRepository怎么用?PHP ezcBase::addClassRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcBase
的用法示例。
在下文中一共展示了ezcBase::addClassRepository方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
require_once dirname(__FILE__) . '/../settings/environment.php';
if (defined('EZC_ROOT')) {
set_include_path(EZC_ROOT . ":" . EZC_ROOT . "/trunk:" . ini_get("include_path"));
}
require_once EZC_BASE;
function __autoload($className)
{
ezcBase::autoload($className);
@(include SITE_ROOT . '/app/model/' . $className . '.php');
}
define('SITE_ROOT', dirname(__FILE__) . '/..');
define('APP_ROOT', dirname(__FILE__) . '/../app');
$cfg = ezcConfigurationManager::getInstance();
$cfg->init('ezcConfigurationIniReader', SITE_ROOT . '/settings');
define('DIR_DEFINITIONS', SITE_ROOT . '/app/model/definitions');
ezcBase::addClassRepository('.', SITE_ROOT . '/core/autoloads');
$driver = $cfg->getSetting('config', 'Database', 'Driver');
$host = $cfg->getSetting('config', 'Database', 'Host');
$port = $cfg->getSetting('config', 'Database', 'Port');
$username = $cfg->getSetting('config', 'Database', 'User');
$password = $cfg->getSetting('config', 'Database', 'Password');
$database = $cfg->getSetting('config', 'Database', 'Database');
$dsn = $driver . '://' . $username . ':' . $password . '@' . $host . '/' . $database;
define('DB_DSN', $dsn);
$dbInstance = ezcDbFactory::create(DB_DSN);
ezcDbInstance::set($dbInstance);
@(include_once SITE_ROOT . '/settings/log.php');
/*
$dbSession = new ezcPersistentSession( $dbInstance,
new ezcPersistentCacheManager( new ezcPersistentCodeManager( DIR_DEFINITIONS ) ) );
*/
示例2: dirname
#!/usr/bin/env php
<?php
require_once 'ezc/Base/ezc_bootstrap.php';
ezcBase::addClassRepository(dirname(__FILE__) . '/..', dirname(__FILE__) . '/..');
$input = new ezcConsoleInput();
$helpOption = $input->registerOption(new ezcConsoleOption('h', 'help'));
$helpOption->isHelpOption = true;
$input->argumentDefinition = new ezcConsoleArguments();
$input->argumentDefinition[0] = new ezcConsoleArgument("infile");
$input->argumentDefinition[0]->mandatory = false;
$input->argumentDefinition[0]->default = '-';
$input->argumentDefinition[0]->type = ezcConsoleInput::TYPE_STRING;
$input->argumentDefinition[0]->shorthelp = "pipe definition file";
$input->argumentDefinition[0]->longhelp = "Pipe XML definition file to convert or - to read from STDIN ( not implemented yet )";
try {
$input->process();
main($input);
} catch (Exception $e) {
echo $e->getMessage();
exit(1);
}
function main(ezcConsoleInput $input)
{
$pipe = getPipe($input->argumentDefinition["infile"]->value);
$dotVisitor = new ymcPipeDotVisitor();
$pipe->accept($dotVisitor);
echo $dotVisitor->getDot();
}
function getPipe($infile)
{
// get XML String
示例3: spl_autoload_register
<?php
require_once 'ezc/Base/base.php';
spl_autoload_register(array('ezcBase', 'autoload'));
ezcBase::addClassRepository(realpath(dirname(__FILE__) . '/../src'));
$exampleFiles = glob(dirname(__FILE__) . '/dir/*.php');
$examples = array();
foreach ($exampleFiles as $exampleFile) {
$examples[pathinfo($exampleFile, PATHINFO_FILENAME)] = $exampleFile;
}
if (isset($_GET['example']) && array_key_exists($_GET['example'], $examples)) {
$example = $_GET['example'];
require $examples[$example];
} else {
$example = '';
}
?>
<html>
<head>
<style>
.failed
{
background-color: #CC0000;
}
</style>
</head>
<body>
<div>
<?php
foreach ($examples as $key => $file) {
echo '<a href="?example=', $key, '">', $key, '</a>, ';
示例4: testNoPrefixAutoload
public function testNoPrefixAutoload()
{
ezcBase::addClassRepository('./Base/tests/test_repository', './Base/tests/test_repository/autoload_files');
__autoload('Object');
if (!class_exists('Object')) {
$this->fail("Autoload does not handle classes with no prefix");
}
}
示例5: spl_autoload_register
<?php
/**
* WebChecker config php file
* Created on January, the 12th 2010 at 21:26:14 by ronan
*
* @copyright Copyright (C) 2011 Ronan Guilloux. All rights reserved.
* @license http://www.gnu.org/licenses/agpl.html GNU AFFERO GPL v3
* @version //autogen//
* @author Ronan Guilloux - coolforest.net
* @package WebChecker
* @filesource config.php
*/
// SPL autoloading for Zeta components
// see http://incubator.apache.org/zetacomponents/documentation/install.html
require_once 'src/zetacomponents/Base/base.php';
spl_autoload_register( array( 'ezcBase', 'autoload' ) );
// Zeta components autoloading for the all rest :
$options = new ezcBaseAutoloadOptions( array( 'debug' => false, 'preload' => true ) );
ezcBase::setOptions( $options );
ezcBase::addClassRepository( dirname( __FILE__ ) . '/src/checker', null, 'chk' );
// here you can add your own libs using addClassRepository()
// App. settings
$reader = new ezcConfigurationIniReader();
$reader->init( dirname( __FILE__ ), 'settings' );
$ini = $reader->load();
?>
示例6: dirname
<?php
$root = dirname(__FILE__);
ini_set('include_path', "/usr/share/php/ezc:{$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($p = "{$root}/lib", null, 'tcl');
class customLazyCacheConfiguration implements ezcBaseConfigurationInitializer
{
public static function configureObject($id)
{
$options = array('ttl' => 1800);
switch ($id) {
case 'scrapers':
ezcCacheManager::createCache('scrapers', '../cache/scrapers', 'ezcCacheStorageFilePlain', $options);
break;
}
}
}
ezcBaseInit::setCallback('ezcInitCacheManager', 'customLazyCacheConfiguration');
示例7: __construct
<?php
// build and initialize the form
require_once 'ezc/Base/ezc_bootstrap.php';
ezcBase::addClassRepository('../../src');
// BEGINFORMINIT
class SimpleGreetingForm extends ymcHtmlFormGeneric
{
public function __construct()
{
parent::__construct();
$this->group->add(new ymcHtmlFormElementText('forename'));
$this->group->add(new ymcHtmlFormElementText('surname'));
$this->init();
}
}
$form = new SimpleGreetingForm();
// ENDFORMINIT
$input = new ymcHtmlFormInputSourceFilterExtension();
if ($input->hasData()) {
$form->validate($input);
}
?>
<html>
<head>
<style>
form .failed{
border:1px solid red;
}
示例8: testNoPrefixAutoload2
public function testNoPrefixAutoload2()
{
ezcBase::addClassRepository(__DIR__ . '/issue15896');
ezc_autoload('ab');
}
示例9: realpath
<?php
$appsPath = realpath(dirname(__FILE__) . '/..');
set_include_path(get_include_path() . PATH_SEPARATOR . $appsPath);
ezcBase::addClassRepository($appsPath);
示例10: testNoPrefixAutoload2
public function testNoPrefixAutoload2()
{
ezcBase::addClassRepository('./Base/tests/issue15896');
__autoload('ab');
}
示例11: registerExtensions
//.........这里部分代码省略.........
}
} else {
include $cacheFilePath;
if (!isset(${$cache_var_name})) {
eZDebug::writeWarning("Cache '{$cache_var_name}' in file '{$cacheFilePath}' not found. Trying to force rewrite of this cache file...", __METHOD__);
$write_cache = $can_write_cache;
} else {
eZDebug::writeNotice("Cache hit: {$cacheFilePath}", __METHOD__);
$defaultActiveExtensions = ${$cache_var_name};
$cache_hit = true;
unset($cache_var_name);
}
}
$additional_lookups = 0;
//Loop registering of extensions until all are loaded
while (!$allExtensionsRegistered) {
//First we asume we do not need to check for new extensions
$allExtensionsRegistered = true;
//these extensions are always active
$activeExtensions = $defaultActiveExtensions;
//Get all active extension
$activeExtensions = array_unique(array_merge($activeExtensions, eZExtension::activeExtensions()));
foreach ($activeExtensions as $activeExtension) {
//only activate an extension if it has not been registered, yet
if (!in_array($activeExtension, $this->registeredExtensions)) {
$this->registeredExtensions[] = $activeExtension;
$fullExtensionPath = eZExtension::baseDirectory() . '/' . $activeExtension;
if (!file_exists($fullExtensionPath)) {
eZDebug::writeWarning("Extension '{$activeExtension}' does not exist, looked for directory '{$fullExtensionPath}'", __METHOD__);
} else {
$fullExtensionAutoloadPath = $fullExtensionPath . '/autoload';
if ($activeExtension !== 'ymcextensionloader' and !in_array($activeExtension, self::$noAutoloadExtensions) and file_exists($fullExtensionAutoloadPath)) {
//add the new extension's autoload-dir to the eZ compontents autoload system (if needed)
ezcBase::addClassRepository($fullExtensionPath, $fullExtensionAutoloadPath);
}
//We are about to activate a new extension which might need to load one ore more other extension (if we do not have a cached info about this)
$allExtensionsRegistered = $cache_hit;
}
}
}
$this->rebuildIniOverrideArray($siteaccess, $isBasicLoad);
if (!$allExtensionsRegistered) {
$additional_lookups++;
}
}
if (!$cache_hit) {
if ($isBasicLoad) {
eZDebug::writeNotice("Loaded all basic extensions in {$additional_lookups} additional lookups...", __METHOD__);
} else {
if ($is_virtual_load) {
eZDebug::writeNotice("Loaded all virtual siteaccess extensions in {$additional_lookups} additional lookups...", __METHOD__);
} else {
eZDebug::writeNotice("Loaded all siteaccess extensions in {$additional_lookups} additional lookups...", __METHOD__);
}
}
}
if ($write_cache) {
if ($isBasicLoad) {
eZDebug::writeNotice("Storing basic extension load information into cache file '{$cacheFilePath}'...", __METHOD__);
} else {
if ($is_virtual_load) {
eZDebug::writeNotice("Storing virtual siteaccess extension load information into cache file '{$cacheFilePath}'...", __METHOD__);
} else {
eZDebug::writeNotice("Storing siteaccess extension load information into cache file '{$cacheFilePath}'...", __METHOD__);
}
}
示例12: ini_set
<?php
//ini_set( 'include_path', ini_get( 'include_path' ) . ':/htdocs/ezc_trunk/:.' );
ini_set('session.gc_maxlifetime', 864000);
require 'Base/src/ezc_bootstrap.php';
// ezcDbInstance::set( ezcDbFactory::create( 'sqlite://'. dirname( __FILE__ ) . '/share.sqlite' ) );
ezcDbInstance::set(ezcDbFactory::create('mysql://root:cawerks@127.0.0.1/UnTrucBien'));
$options = new ezcBaseAutoloadOptions(array('debug' => true));
ezcBase::setOptions($options);
ezcBase::addClassRepository(dirname(__FILE__) . '/lib/share', null, 'share');
ezcBase::addClassRepository(dirname(__FILE__) . '/lib/debug', null, 'debug');
$log = ezcLog::getInstance();
$mapper = $log->getMapper();
$writer = new ezcLogUnixFileWriter("/tmp", "thewire-web.log");
$filter = new ezcLogFilter();
$rule = new ezcLogFilterRule($filter, $writer, true);
$mapper->appendRule($rule);
$reader = new ezcConfigurationIniReader();
$reader->init(dirname(__FILE__), 'settings');
$ini = $reader->load();
if ($ini->getBoolSetting('DevelopmentSettings', 'Debug')) {
ezcBase::setRunMode(ezcBase::MODE_DEVELOPMENT);
$debugHandler = ezcDebug::getInstance();
$debugHandler->setOutputFormatter(new debugHtmlFormatter());
debugLogger::setHandler($debugHandler);
}
$tc = ezcTemplateConfiguration::getInstance();
$tc->templatePath = dirname(__FILE__) . '/templates';
$tc->compilePath = dirname(__FILE__) . '/cache';
$tc->addExtension("shareTemplateFunctions");
示例13: ini_set
<?php
// Set the include path to the eZ Components location, and bootstrap the
// library. The two lines below assume that you're using eZ Components from
// SVN -- see the installation guide at http://ezcomponents.org/docs/install.
ini_set('include_path', '/home/derick/dev/ezcomponents/trunk:.');
require 'Base/src/ezc_bootstrap.php';
// Add the class repository containing our application's classes. We store
// those in the /lib directory and the classes have the "hello" prefix.
ezcBase::addClassRepository(dirname(__FILE__) . '/lib', null, 'hello');
// Configure the template system by telling it where to find templates, and
// where to put the compiled templates.
$tc = ezcTemplateConfiguration::getInstance();
$tc->templatePath = dirname(__FILE__) . '/templates';
$tc->compilePath = dirname(__FILE__) . '/cache';
示例14: spl_autoload_register
<?php
require_once 'ezc/Base/base.php';
spl_autoload_register(array('ezcBase', 'autoload'));
ezcBase::addClassRepository('./lib', './lib/autoload');
$options = new ezcBaseAutoloadOptions();
$options->debug = true;
ezcBase::setOptions($options);
$rootdir = dirname(__FILE__);
$db = ezcDbFactory::create("sqlite://{$rootdir}/tmp/mergequeue.db");
ezcDbInstance::set($db);
示例15: 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'
);
?>