當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。