當前位置: 首頁>>代碼示例>>PHP>>正文


PHP i18n::get_owner_module方法代碼示例

本文整理匯總了PHP中i18n::get_owner_module方法的典型用法代碼示例。如果您正苦於以下問題:PHP i18n::get_owner_module方法的具體用法?PHP i18n::get_owner_module怎麽用?PHP i18n::get_owner_module使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在i18n的用法示例。


在下文中一共展示了i18n::get_owner_module方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getBestModuleForKey

 /**
  * Determine the best module to be given ownership over this key
  *
  * @param array $entitiesByModule
  * @param string $key
  * @return string Best module, if found
  */
 protected function getBestModuleForKey($entitiesByModule, $key)
 {
     // Check classes
     $class = current(explode('.', $key));
     $owner = i18n::get_owner_module($class);
     if ($owner) {
         return $owner;
     }
     // @todo - How to determine ownership of templates? Templates can
     // exist in multiple locations with the same name.
     // Display notice if not found
     Debug::message("Duplicate key {$key} detected in multiple modules with no obvious owner", false);
     // Fall back to framework then cms modules
     foreach (array('framework', 'cms') as $module) {
         if (isset($entitiesByModule[$module][$key])) {
             return $module;
         }
     }
     // Do nothing
     return null;
 }
開發者ID:miamollie,項目名稱:echoAerial,代碼行數:28,代碼來源:i18nTextCollector.php

示例2: provideI18nEntities

 /**
  * Provide menu titles to the i18n entity provider
  */
 function provideI18nEntities()
 {
     $cmsClasses = self::get_cms_classes();
     $entities = array();
     foreach ($cmsClasses as $cmsClass) {
         $defaultTitle = LeftAndMain::menu_title_for_class($cmsClass);
         $ownerModule = i18n::get_owner_module($cmsClass);
         $entities["{$cmsClass}.MENUTITLE"] = array($defaultTitle, PR_HIGH, 'Menu title', $ownerModule);
     }
     return $entities;
 }
開發者ID:rixrix,項目名稱:sapphire,代碼行數:14,代碼來源:CMSMenu.php

示例3: findModuleForClass

 /**
  * Given a partial class name, attempt to determine the best module to assign strings to.
  *
  * @param string $class Either a FQN class name, or a non-qualified class name.
  * @return string Name of module
  */
 protected function findModuleForClass($class)
 {
     if (ClassInfo::exists($class)) {
         return i18n::get_owner_module($class);
     }
     // If we can't find a class, see if it needs to be fully qualified
     if (strpos($class, '\\') !== false) {
         return null;
     }
     // Find FQN that ends with $class
     $classes = preg_grep('/' . preg_quote("\\{$class}", '\\/') . '$/i', SS_ClassLoader::instance()->getManifest()->getClassNames());
     // Find all modules for candidate classes
     $modules = array_unique(array_map(function ($class) {
         return i18n::get_owner_module($class);
     }, $classes));
     if (count($modules) === 1) {
         return reset($modules);
     }
     // Couldn't find it! Exists in none, or multiple modules.
     return null;
 }
開發者ID:jacobbuck,項目名稱:silverstripe-framework,代碼行數:27,代碼來源:i18nTextCollector.php


注:本文中的i18n::get_owner_module方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。