本文整理汇总了PHP中Akeeba\Engine\Platform::getPlatformDirectories方法的典型用法代码示例。如果您正苦于以下问题:PHP Platform::getPlatformDirectories方法的具体用法?PHP Platform::getPlatformDirectories怎么用?PHP Platform::getPlatformDirectories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akeeba\Engine\Platform
的用法示例。
在下文中一共展示了Platform::getPlatformDirectories方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: autoload_akeeba_engine
/**
* The actual autoloader
*
* @param string $className The name of the class to load
*
* @return void
*/
public function autoload_akeeba_engine($className)
{
// Trim the trailing backslash
$className = ltrim($className, '\\');
// Make sure the class has an Akeeba\Engine prefix
if (substr($className, 0, 13) != 'Akeeba\\Engine') {
return;
}
// Remove the prefix and explode on backslashes
$className = substr($className, 14);
$class = explode('\\', $className);
// Do we have a list of platform directories?
if (is_null(self::$platformDirs) && class_exists('\\Akeeba\\Engine\\Platform', false)) {
self::$platformDirs = Platform::getPlatformDirectories();
if (!is_array(self::$platformDirs)) {
self::$platformDirs = array();
}
}
$rootPaths = array(self::$enginePath);
if (is_array(self::$platformDirs)) {
$rootPaths = array_merge(self::$platformDirs, array(self::$enginePath));
}
foreach ($rootPaths as $rootPath) {
// First try finding in structured directory format (preferred)
$path = $rootPath . '/' . implode('/', $class) . '.php';
if (@file_exists($path)) {
include_once $path;
}
// Then try the duplicate last name structured directory format (not recommended)
if (!class_exists($className, false)) {
reset($class);
$lastPart = end($class);
$path = $rootPath . '/' . implode('/', $class) . '/' . $lastPart . '.php';
if (@file_exists($path)) {
include_once $path;
}
}
}
}