当前位置: 首页>>代码示例>>PHP>>正文


PHP JLoader::nsMap方法代码示例

本文整理汇总了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;
         }
     }
 }
开发者ID:Alibek,项目名称:joomla-platform-namespace-example,代码行数:57,代码来源:loader.php


注:本文中的JLoader::nsMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。