本文整理汇总了PHP中Classes::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Classes::get方法的具体用法?PHP Classes::get怎么用?PHP Classes::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Classes
的用法示例。
在下文中一共展示了Classes::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _doBuild
/**
* load all app files for given path and build.xml document
*
* @param string $path app base path
* @param DOMDocument $build build.xml
* @return boolean
*/
private function _doBuild($path, DOMDocument $build)
{
$Classes = Classes::get();
$x = new DOMXPath($build);
$app = $x->query('/build/app');
if ($app->length != 1) {
throw new PException('App error!');
}
$app = $app->item(0);
if (!$app->hasAttribute('name')) {
throw new PException('App name error!');
}
$this->_apps[$app->getAttribute('name')] = $build;
$files = $x->query('/build/files/file');
foreach ($files as $file) {
if ($file->hasAttribute('class')) {
$Classes->addClass($file->getAttribute('class'), $path . $file->nodeValue);
continue;
}
if ($file->hasAttribute('include')) {
if (!file_exists($path . $file->nodeValue)) {
continue;
}
$this->_includes[] = $path . $file->nodeValue;
continue;
}
}
return true;
}
示例2: loadModules
public function loadModules()
{
if (!isset($this->_moduleDir)) {
return false;
}
$Classes = Classes::get();
$dir = dir($this->_moduleDir);
while ($d = $dir->read()) {
if ($d == '.' || $d == '..') {
continue;
}
$dp = $dir->path . '/' . $d;
if (!is_dir($dp)) {
continue;
}
if (!file_exists($dp . '/module.xml')) {
continue;
}
$d = @DOMDocument::load($dp . '/module.xml');
if (!$d) {
continue;
}
$d->XPath = new DOMXPath($d);
$moduleName = $d->XPath->query('/module/moduleName');
if ($moduleName->length != 1) {
throw new PException('Module load error in "' . $dp . '/module.xml"!');
}
$moduleFiles = $d->XPath->query('/module/moduleFiles');
if ($moduleFiles->length != 1) {
throw new PException('Module load error in "' . $dp . '/module.xml"!');
}
foreach ($moduleFiles->item(0)->childNodes as $node) {
if (!is_a($node, 'DOMElement')) {
continue;
}
foreach ($node->childNodes as $file) {
if (!is_a($file, 'DOMElement')) {
continue;
}
if ($file->hasAttribute('class')) {
$Classes->addClass($file->getAttribute('class'), $dp . '/' . $node->nodeName . '/' . $file->nodeValue);
}
}
}
$this->_modules[$moduleName->item(0)->nodeValue] = $d;
}
}
示例3: Exception
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License (GPL)
* @version $Id: libs.php 122 2006-07-13 16:48:45Z kang $
*/
if (!defined('SCRIPT_BASE')) {
throw new Exception('Internal base error!', 0);
}
if (!defined('LIB_DIR')) {
throw new Exception('Internal base error!', 0);
}
$version = '0.0';
/**
* The version of this library set
*/
define('PLATFORM_VERSION', $version);
require_once SCRIPT_BASE . 'lib/misc/classes.autoload.php';
$Classes = Classes::get();
//***************************************************************
// Miscellaneous
//***************************************************************
$Classes->addClass('PException', SCRIPT_BASE . 'lib/misc/exception.lib.php');
$Classes->addClass('PPHP', SCRIPT_BASE . 'lib/misc/phpi.lib.php');
$Classes->addClass('PVars', SCRIPT_BASE . 'lib/misc/vars.lib.php');
$Classes->addClass('PVarObj', SCRIPT_BASE . 'lib/misc/var_obj.lib.php');
$Classes->addClass('PFunctions', SCRIPT_BASE . 'lib/misc/functions.lib.php');
$Classes->addClass('PModules', SCRIPT_BASE . 'lib/misc/modules.lib.php');
$Classes->addClass('PDate', SCRIPT_BASE . 'lib/misc/date.lib.php');
$Classes->addClass('PSurveillance', SCRIPT_BASE . 'lib/misc/surveillance.lib.php');
$Classes->addClass('PDataDir', SCRIPT_BASE . 'lib/misc/datadir.lib.php');
//***************************************************************
// DB
//***************************************************************