本文整理汇总了PHP中JLoader::nsMap方法的典型用法代码示例。如果您正苦于以下问题:PHP JLoader::nsMap方法的具体用法?PHP JLoader::nsMap怎么用?PHP JLoader::nsMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JLoader
的用法示例。
在下文中一共展示了JLoader::nsMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
/**
* Method to setup the autoloaders for the Joomla Platform.
* Since the SPL autoloaders are called in a queue we will add our explicit
* class-registration based loader first, then fall back on the autoloader based on conventions.
* This will allow people to register a class in a specific location and override platform libraries
* as was previously possible.
*
* @param integer $caseStrategy An option to define the class finding strategy for the namespace loader
* depending on the namespace and class path case.
* The possible values are :
* JLoader::LOWER_CASE : The namespace can be either lower case or camel case and the path lower case.
* JLoader::NATURAL_CASE : The namespace case matches the path case.
* JLoader::MIXED_CASE : It regroups option 1 and option 2.
* @param boolean $enableNamespaces True to enable PHP namespace based class autoloading.
* @param boolean $enablePrefixes True to enable prefix based class loading (needed to auto load the Joomla core).
* @param boolean $enableClasses True to enable class map based class loading (needed to auto load the Joomla core).
*
* @return void
*
* @since 12.3
*/
public static function setup($caseStrategy = self::LOWER_CASE, $enableNamespaces = true, $enablePrefixes = true, $enableClasses = true, $enableCompatLayer = true)
{
if ($enableCompatLayer) {
self::$nsMap = (include JPATH_PLATFORM . '/compat/NamespaceMap.php');
spl_autoload_register(array(__CLASS__, 'compatLayer'));
}
spl_autoload_register(array(__CLASS__, 'loadByPsr0'));
self::registerNamespace('Joomla', JPATH_PLATFORM);
if ($enableClasses) {
// Register the class map based autoloader.
spl_autoload_register(array(__CLASS__, 'load'));
}
if ($enablePrefixes) {
// Register the prefix autoloader.
spl_autoload_register(array(__CLASS__, '_autoload'));
}
if ($enableNamespaces) {
switch ($caseStrategy) {
// Register the natural case namespace loader.
case self::NATURAL_CASE:
spl_autoload_register(array(__CLASS__, 'loadByNamespaceNaturalCase'));
break;
// Register the mixed case namespace loader.
// Register the mixed case namespace loader.
case self::MIXED_CASE:
spl_autoload_register(array(__CLASS__, 'loadByNamespaceMixedCase'));
break;
// Default to the lower case namespace loader.
// Default to the lower case namespace loader.
case self::LOWER_CASE:
default:
spl_autoload_register(array(__CLASS__, 'loadByNamespaceLowerCase'));
break;
}
}
}