本文整理汇总了PHP中ezcBase类的典型用法代码示例。如果您正苦于以下问题:PHP ezcBase类的具体用法?PHP ezcBase怎么用?PHP ezcBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ezcBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __autoload
function __autoload($className)
{
try {
ezcBase::autoload($className);
} catch (Exception $e) {
echo $e->getMessage();
}
}
示例2: __construct
/**
* Creates a new controller object and sets all the request variables as class variables.
*
* @throws ezcMvcControllerException if the action method is empty
* @param string $action
* @param ezcMvcRequest $request
*/
public function __construct($action, ezcMvcRequest $request)
{
if (ezcBase::inDevMode() && (!is_string($action) || strlen($action) == 0)) {
throw new ezcMvcControllerException("The '" . get_class($this) . "' controller requires an action.");
}
$this->action = $action;
$this->setRequestVariables($request);
}
示例3: __callstatic
public static function __callstatic($name, $args)
{
if (ezcBase::getRunMode() == ezcBase::MODE_DEVELOPMENT) {
return call_user_func_array(array(self::$ezcDebugInstance, $name), $args);
} else {
return null;
}
}
示例4: __autoload
function __autoload($className)
{
if (strpos($className, '_') !== false) {
$file = str_replace('_', '/', $className) . '.php';
@($val = (require_once $file));
return $val === true;
}
ezcBase::autoload($className);
}
示例5: glpiautoload
function glpiautoload($classname)
{
global $DEBUG_AUTOLOAD, $CFG_GLPI;
static $notfound = array();
// empty classname or non concerted plugin
if (empty($classname) || is_numeric($classname)) {
return false;
}
$dir = GLPI_ROOT . "/inc/";
//$classname="PluginExampleProfile";
if ($plug = isPluginItemType($classname)) {
$plugname = strtolower($plug['plugin']);
$dir = GLPI_ROOT . "/plugins/{$plugname}/inc/";
$item = strtolower($plug['class']);
// Is the plugin activate ?
// Command line usage of GLPI : need to do a real check plugin activation
if (isCommandLine()) {
$plugin = new Plugin();
if (count($plugin->find("directory='{$plugname}' AND state=" . Plugin::ACTIVATED)) == 0) {
// Plugin does not exists or not activated
return false;
}
} else {
// Standard use of GLPI
if (!in_array($plugname, $_SESSION['glpi_plugins'])) {
// Plugin not activated
return false;
}
}
} else {
// Is ezComponent class ?
if (preg_match('/^ezc([A-Z][a-z]+)/', $classname, $matches)) {
include_once GLPI_EZC_BASE;
ezcBase::autoload($classname);
return true;
} else {
$item = strtolower($classname);
}
}
// No errors for missing classes due to implementation
if (!isset($CFG_GLPI['missingclasses']) or !in_array($item, $CFG_GLPI['missingclasses'])) {
if (file_exists("{$dir}{$item}.class.php")) {
include_once "{$dir}{$item}.class.php";
if ($_SESSION['glpi_use_mode'] == DEBUG_MODE) {
$DEBUG_AUTOLOAD[] = $classname;
}
} else {
if (!isset($notfound["x{$classname}"])) {
// trigger an error to get a backtrace, but only once (use prefix 'x' to handle empty case)
//logInFile('debug',"file $dir$item.class.php not founded trying to load class $classname\n");
trigger_error("GLPI autoload : file {$dir}{$item}.class.php not founded trying to load class '{$classname}'");
$notfound["x{$classname}"] = true;
}
}
}
}
示例6: __construct
/**
* Creates a ezcBaseMetaData object
*
* The sole parameter $installMethod should only be used if you are really
* sure that you need to use it. It is mostly there to make testing at
* least slightly possible. Again, do not set it unless instructed.
*
* @param string $installMethod
*/
public function __construct($installMethod = NULL)
{
$installMethod = $installMethod !== NULL ? $installMethod : ezcBase::getInstallMethod();
// figure out which reader to use
switch ($installMethod) {
case 'tarball':
$this->reader = new ezcBaseMetaDataTarballReader();
break;
case 'pear':
$this->reader = new ezcBaseMetaDataPearReader();
break;
default:
throw new ezcBaseMetaDataReaderException("Unknown install method '{$installMethod}'.");
break;
}
}
示例7: getRoutingInformation
/**
* Returns routing information, including a controller classname from the set of routes.
*
* This method is run by the dispatcher to obtain a controller. It uses the
* user implemented createRoutes() method from the inherited class to fetch the
* routes. It then loops over these routes in order - the first one that
* matches the request returns the routing information. The loop stops as
* soon as a route has matched. In case none of the routes matched
* with the request data an exception is thrown.
*
* @throws ezcMvcNoRoutesException when there are no routes defined.
* @throws ezcBaseValueException when one of the returned routes was not
* actually an object implementing the ezcMvcRoute interface.
* @throws ezcMvcRouteNotFoundException when no routes matched the request URI.
* @return ezcMvcRoutingInformation
*/
public function getRoutingInformation()
{
$routes = $this->createRoutes();
if (ezcBase::inDevMode() && (!is_array($routes) || !count($routes))) {
throw new ezcMvcNoRoutesException();
}
foreach ($routes as $route) {
if (ezcBase::inDevMode() && !$route instanceof ezcMvcRoute) {
throw new ezcBaseValueException('route', $route, 'instance of ezcMvcRoute');
}
$routingInformation = $route->matches($this->request);
if ($routingInformation !== null) {
return $routingInformation;
}
}
throw new ezcMvcRouteNotFoundException($this->request);
}
示例8: getRoutingInformation
/**
* Returns routing information, including a controller classname from the set of routes.
*
* This method is run by the dispatcher to obtain a controller. It uses the
* user implemented createRoutes() method from the inherited class to fetch the
* routes. It then loops over these routes in order - the first one that
* matches the request returns the routing information. The loop stops as
* soon as a route has matched. In case none of the routes matched
* with the request data an exception is thrown.
*
* @throws ezcMvcNoRoutesException when there are no routes defined.
* @throws ezcBaseValueException when one of the returned routes was not
* actually an object implementing the ezcMvcRoute interface.
* @throws ezcMvcRouteNotFoundException when no routes matched the request URI.
* @return ezcMvcRoutingInformation
*/
public function getRoutingInformation()
{
$routes = $this->createRoutes();
if (ezcBase::inDevMode() && (!is_array($routes) || !count($routes))) {
throw new ezcMvcNoRoutesException();
}
foreach ($routes as $route) {
if (ezcBase::inDevMode() && !$route instanceof ezcMvcRoute) {
throw new ezcBaseValueException('route', $route, 'instance of ezcMvcRoute');
}
$routingInformation = $route->matches($this->request);
if ($routingInformation !== null) {
// Add the router to the routing information struct, so that
// can be passed to the controllers for reversed route
// generation.
$routingInformation->router = $this;
return $routingInformation;
}
}
throw new ezcMvcRouteNotFoundException($this->request);
}
示例9: teardown
public function teardown()
{
$options = new ezcBaseAutoloadOptions();
$options->debug = true;
ezcBase::setOptions($options);
}
示例10: autoload
public static function autoload($className)
{
if (class_exists('ezcBase')) {
ezcBase::autoload($className);
}
}
示例11: 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>, ';
示例12: 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();
?>
示例13: __autoload
function __autoload($className)
{
ezcBase::autoload($className);
}
示例14: setRunMode
/**
* Sets the development mode to the one specified.
*
* @param int $runMode
*/
public static function setRunMode($runMode)
{
if (!in_array($runMode, array(ezcBase::MODE_PRODUCTION, ezcBase::MODE_DEVELOPMENT))) {
throw new ezcBaseValueException('runMode', $runMode, 'ezcBase::MODE_PRODUCTION or ezcBase::MODE_DEVELOPMENT');
}
self::$runMode = $runMode;
}
示例15: __construct
/**
* Constructor
*
* @param array $options Default option array
* @return void
* @ignore
*/
public function __construct(array $options = array())
{
ezcBase::checkDependency('Graph', ezcBase::DEP_PHP_EXTENSION, 'dom');
$this->options = new ezcGraphSvgDriverOptions($options);
$this->font = new ezcGraphSvgFont();
}