本文整理汇总了PHP中BizSystem::getLibFileWithPath方法的典型用法代码示例。如果您正苦于以下问题:PHP BizSystem::getLibFileWithPath方法的具体用法?PHP BizSystem::getLibFileWithPath怎么用?PHP BizSystem::getLibFileWithPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BizSystem
的用法示例。
在下文中一共展示了BizSystem::getLibFileWithPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadMetadataClass
public static function loadMetadataClass($className, $packageName = '')
{
if (class_exists($className, false)) {
return true;
}
if (isset(self::$_classNameCache[$packageName . $className])) {
return true;
}
if (strpos($className, 'Zend') === 0) {
return true;
}
$filePath = BizSystem::getLibFileWithPath($className, $packageName);
if ($filePath) {
include_once $filePath;
self::$_classNameCache[$packageName . $className] = 1;
return true;
}
return false;
}
示例2: constructObject
/**
* Construct an instance of an object
*
* @param string $objName object name
* @param array $xmlArr xml array
* @return object the instance of the object
*/
protected function constructObject($objName, &$xmlArr = null)
{
if (!$xmlArr) {
$xmlFile = BizSystem::GetXmlFileWithPath($objName);
if (!$xmlFile) {
$dotPos = strrpos($objName, ".");
$package = $dotPos > 0 ? substr($objName, 0, $dotPos) : null;
$class = $dotPos > 0 ? substr($objName, $dotPos + 1) : $objName;
} else {
$xmlArr = BizSystem::getXmlArray($xmlFile);
}
}
if ($xmlArr) {
$keys = array_keys($xmlArr);
$root = $keys[0];
// add by mr_a_ton , atrubut name must match with object name
$dotPos = strrpos($objName, ".");
$shortObjectName = $dotPos > 0 ? substr($objName, $dotPos + 1) : $objName;
if ($xmlArr[$root]["ATTRIBUTES"]["NAME"] == "") {
$xmlArr[$root]["ATTRIBUTES"]["NAME"] = $shortObjectName;
} else {
if ($shortObjectName != $xmlArr[$root]["ATTRIBUTES"]["NAME"]) {
trigger_error("Metadata file parsing error for object {$objName}. Name attribut [" . $xmlArr[$root]["ATTRIBUTES"]["NAME"] . "] not same with object name. Please double check your metadata xml file again.", E_USER_ERROR);
}
}
//$package = $xmlArr[$root]["ATTRIBUTES"]["PACKAGE"];
$class = $xmlArr[$root]["ATTRIBUTES"]["CLASS"];
// if class has package name as prefix, change the package to the prefix
$dotPos = strrpos($class, ".");
$classPrefix = $dotPos > 0 ? substr($class, 0, $dotPos) : null;
$classPackage = $classPrefix ? $classPrefix : null;
if ($classPrefix) {
$class = substr($class, $dotPos + 1);
}
// set object package
$dotPos = strrpos($objName, ".");
$package = $dotPos > 0 ? substr($objName, 0, $dotPos) : null;
if (!$classPackage) {
$classPackage = $package;
}
$xmlArr[$root]["ATTRIBUTES"]["PACKAGE"] = $package;
}
if ($class == "BizObj") {
// convert BizObj to BizDataObj, support <1.2 version
$class = "BizDataObj";
}
if (!class_exists($class, false)) {
$classFile = BizSystem::getLibFileWithPath($class, $classPackage);
if (!$classFile) {
if ($package) {
trigger_error("Cannot find the class with name as {$package}.{$class}", E_USER_ERROR);
} else {
trigger_error("Cannot find the class with name as {$class}", E_USER_ERROR);
}
exit;
}
include_once $classFile;
}
if (class_exists($class, false)) {
$obj_ref = new $class($xmlArr);
if ($obj_ref) {
return $obj_ref;
}
} else {
trigger_error("Cannot find the class with name as {$class} in {$classFile}", E_USER_ERROR);
}
return null;
}