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


PHP Kurogo::getLocalizedString方法代码示例

本文整理汇总了PHP中Kurogo::getLocalizedString方法的典型用法代码示例。如果您正苦于以下问题:PHP Kurogo::getLocalizedString方法的具体用法?PHP Kurogo::getLocalizedString怎么用?PHP Kurogo::getLocalizedString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kurogo的用法示例。


在下文中一共展示了Kurogo::getLocalizedString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formatDate

 public static function formatDate($date, $dateStyle, $timeStyle)
 {
     $dateStyleConstant = self::getDateConstant($dateStyle);
     $timeStyleConstant = self::getTimeConstant($timeStyle);
     if ($date instanceof DateTime) {
         $date = $date->format('U');
     }
     $string = '';
     if ($dateStyleConstant) {
         $string .= strftime(Kurogo::getLocalizedString($dateStyleConstant), $date);
         if ($timeStyleConstant) {
             $string .= " ";
         }
     }
     if ($timeStyleConstant) {
         // Work around lack of %P support in Mac OS X
         $format = Kurogo::getLocalizedString($timeStyleConstant);
         $lowercase = false;
         if (strpos($format, '%P') !== false) {
             $format = str_replace('%P', '%p', $format);
             $lowercase = true;
         }
         $formatted = strftime($format, $date);
         if ($lowercase) {
             $formatted = strtolower($formatted);
         }
         // Work around leading spaces that come from use of %l (but don't exist in date())
         if (strpos($format, '%l') !== false) {
             $formatted = trim($formatted);
         }
         $string .= $formatted;
     }
     return $string;
 }
开发者ID:narenv,项目名称:Kurogo-Mobile-Web,代码行数:34,代码来源:DateTimeUtils.php

示例2: formatDate

 public static function formatDate($date, $dateStyle, $timeStyle)
 {
     $dateStyleConstant = self::getDateConstant($dateStyle);
     $timeStyleConstant = self::getTimeConstant($timeStyle);
     if ($date instanceof DateTime) {
         $date = $date->format('U');
     }
     $string = '';
     if ($dateStyleConstant) {
         $string .= strftime(Kurogo::getLocalizedString($dateStyleConstant), $date);
         if ($timeStyleConstant) {
             $string .= " ";
         }
     }
     if ($timeStyleConstant) {
         $string .= strftime(Kurogo::getLocalizedString($timeStyleConstant), $date);
     }
     return $string;
 }
开发者ID:hxfnd,项目名称:Kurogo-Mobile-Web,代码行数:19,代码来源:DateTimeUtils.php

示例3: formatDate

 public static function formatDate($date, $dateStyle, $timeStyle)
 {
     $dateStyleConstant = self::getDateConstant($dateStyle);
     $timeStyleConstant = self::getTimeConstant($timeStyle);
     if ($date instanceof DateTime) {
         $date = $date->format('U');
     }
     $string = '';
     if ($dateStyleConstant) {
         $format = Kurogo::getLocalizedString($dateStyleConstant);
         // Work around lack of %e support in windows
         // http://php.net/manual/en/function.strftime.php
         if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
             $format = preg_replace('#(?<!%)((?:%%)*)%e#', '\\1%#d', $format);
         }
         $string .= strftime($format, $date);
         if ($timeStyleConstant) {
             $string .= " ";
         }
     }
     if ($timeStyleConstant) {
         // Work around lack of %P support in Mac OS X
         $format = Kurogo::getLocalizedString($timeStyleConstant);
         $lowercase = false;
         if (strpos($format, '%P') !== false) {
             $format = str_replace('%P', '%p', $format);
             $lowercase = true;
         }
         $formatted = strftime($format, $date);
         if ($lowercase) {
             $formatted = strtolower($formatted);
         }
         // Work around leading spaces that come from use of %l (but don't exist in date())
         if (strpos($format, '%l') !== false) {
             $formatted = trim($formatted);
         }
         $string .= $formatted;
     }
     return $string;
 }
开发者ID:nncsang,项目名称:Kurogo,代码行数:40,代码来源:DateFormatter.php

示例4: formatDate

 public static function formatDate($date, $dateStyle = self::DEFAULT_STYLE, $timeStyle = self::DEFAULT_STYLE)
 {
     if ($dateStyle === self::DEFAULT_STYLE) {
         $dateStyle = self::MEDIUM_STYLE;
     }
     if ($timeStyle === self::DEFAULT_STYLE) {
         $timeStyle = self::MEDIUM_STYLE;
     }
     $dateStyleConstant = self::getDateConstant($dateStyle);
     $timeStyleConstant = self::getTimeConstant($timeStyle);
     $timestamp = $date instanceof DateTime ? $date->format('U') : $date;
     $dateFormat = null;
     if ($dateStyleConstant) {
         if ($dateStyleConstant == 'SHORT_DATE_FORMAT' && date('Y') != date('Y', $timestamp)) {
             $dateStyleConstant .= "_YEAR";
         }
         $dateFormat = Kurogo::getLocalizedString($dateStyleConstant);
     }
     $timeFormat = null;
     if ($timeStyleConstant) {
         $timeFormat = Kurogo::getLocalizedString($timeStyleConstant);
     }
     return self::formatDateUsingFormat($date, $dateFormat, $timeFormat);
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:24,代码来源:DateFormatter.php

示例5: factory

 /**
  * Factory method. Used to instantiate a subclass
  * @param string $id, the module id to load
  * @param string $type, the type of module to load (web/api)
  */
 public static function factory($id, $type = null)
 {
     Kurogo::log(LOG_INFO, "Initializing {$type} module {$id}", 'module');
     $configModule = $id;
     //attempt to load config/$id/module.ini
     if ($config = ModuleConfigFile::factory($id, 'module', ModuleConfigFile::OPTION_DO_NOT_CREATE)) {
         //use the ID parameter if it's present, otherwise use the included id
         $id = $config->getOptionalVar('id', $id);
     } elseif (!Kurogo::getOptionalSiteVar('CREATE_DEFAULT_CONFIG', false, 'modules')) {
         Kurogo::log(LOG_ERR, "Module config file not found for module {$id}", 'module');
         throw new KurogoModuleNotFound(Kurogo::getLocalizedString('ERROR_MODULE_NOT_FOUND', $id));
     }
     // see if the class location has been cached
     if ($moduleFile = Kurogo::getCache(self::cacheKey($id, $type))) {
         $className = basename($moduleFile, '.php');
         include_once $moduleFile;
         $module = new $className();
         $module->setConfigModule($configModule);
         if ($config) {
             $module->setConfig('module', $config);
         }
         return $module;
     }
     // when run without a type it will find either
     $classNames = array('web' => ucfirst($id) . 'WebModule', 'api' => ucfirst($id) . 'APIModule');
     // if we specified a type, include only that type in the array
     if ($type) {
         if (isset($classNames[$type])) {
             $classNames = array($classNames[$type]);
         } else {
             throw new KurogoException("Invalid module type {$type}");
         }
     }
     // possible module paths.
     // 1. Site Folder SiteMODULEIDXXXModule
     // 2. Site Folder MODULEIDXXXModule
     // 3. Project folder MODULEIDXXXModule
     $modulePaths = array(SITE_MODULES_DIR . "/{$id}/Site%s.php" => "Site%s", SITE_MODULES_DIR . "/{$id}/%s.php" => "%s", MODULES_DIR . "/{$id}/%s.php" => "%s");
     //cycle module paths
     foreach ($modulePaths as $path => $className) {
         //cycle class names to find a valid module
         foreach ($classNames as $class) {
             $className = sprintf($className, $class);
             $path = sprintf($path, $class);
             Kurogo::log(LOG_DEBUG, "Looking for {$path} for {$id}", 'module');
             // see if it exists
             $moduleFile = realpath_exists($path);
             if ($moduleFile && (include_once $moduleFile)) {
                 //found it
                 $info = new ReflectionClass($className);
                 if (!$info->isAbstract()) {
                     Kurogo::log(LOG_INFO, "Found {$moduleFile} for {$id}", 'module');
                     $module = new $className();
                     $module->setConfigModule($configModule);
                     if ($config) {
                         $module->setConfig('module', $config);
                     }
                     // cache the location of the class (which also includes the classname)
                     Kurogo::setCache(self::cacheKey($id, $type), $moduleFile);
                     return $module;
                 }
                 Kurogo::log(LOG_NOTICE, "{$class} found at {$moduleFile} is abstract and cannot be used for {$id}", 'module');
                 return false;
             }
         }
     }
     Kurogo::log(LOG_ERR, "No valid class found for module {$id}", 'module');
     throw new KurogoModuleNotFound(Kurogo::getLocalizedString('ERROR_MODULE_NOT_FOUND', $id));
 }
开发者ID:nncsang,项目名称:Kurogo,代码行数:74,代码来源:Module.php

示例6: factory

 /**
  * Factory method. Used to instantiate a subclass
  * @param string $id, the module id to load
  * @param string $type, the type of module to load (web/api)
  */
 public static function factory($id, $type = null)
 {
     if ($id == 'kurogo') {
         set_exception_handler("exceptionHandlerForError");
     }
     if (!self::isValidModuleName($id)) {
         throw new KurogoException(Kurogo::getLocalizedString('ERROR_INVALID_MODULE'));
     }
     Kurogo::log(LOG_INFO, "Initializing {$type} module {$id}", 'module');
     $configModule = $id;
     $configStore = Kurogo::configStore();
     //attempt to load config/$id/module.ini
     if ($moduleData = $configStore->getOptionalSection('module', 'module', $configModule)) {
         $id = Kurogo::arrayVal($moduleData, 'id', $configModule);
     } else {
         throw new KurogoModuleNotFound(Kurogo::getLocalizedString('ERROR_MODULE_NOT_FOUND', $id));
     }
     // see if the class location has been cached
     if ($moduleFile = Kurogo::getCache(self::cacheKey($id, $type))) {
         $className = basename($moduleFile, '.php');
         include_once $moduleFile;
         $module = new $className();
         if (is_a($module, KurogoWebBridge::STUB_API_CLASS)) {
             $module->setID($id);
         }
         $module->setConfigModule($configModule);
         Kurogo::addModuleLib($id);
         return $module;
     }
     // when run without a type it will find either
     $classNames = array('web' => ucfirst($id) . 'WebModule', 'api' => ucfirst($id) . 'APIModule', 'shell' => ucfirst($id) . 'ShellModule');
     // if we specified a type, include only that type in the array
     if ($type) {
         if (isset($classNames[$type])) {
             $classNames = array($classNames[$type]);
         } else {
             throw new KurogoException("Invalid module type {$type}");
         }
     }
     // possible module paths.
     // 1. Site Folder SiteMODULEIDXXXModule
     // 2. Site Folder MODULEIDXXXModule
     // 3. Project folder MODULEIDXXXModule
     // Note: The PHP class name MUST be the basename of the file path.
     $modulePaths = array(SITE_MODULES_DIR . "/{$id}/Site%s.php", SITE_MODULES_DIR . "/{$id}/%s.php", SHARED_MODULES_DIR . "/{$id}/Site%s.php", SHARED_MODULES_DIR . "/{$id}/%s.php", MODULES_DIR . "/{$id}/%s.php");
     if ($type == 'api' && KurogoWebBridge::moduleHasMediaAssets($configModule)) {
         $modulePaths[] = LIB_DIR . '/' . KurogoWebBridge::STUB_API_CLASS . ".php";
     }
     //cycle module paths
     foreach ($modulePaths as $path) {
         $className = basename($path, '.php');
         //cycle class names to find a valid module
         foreach ($classNames as $class) {
             $className = sprintf($className, $class);
             $path = sprintf($path, $class);
             Kurogo::log(LOG_DEBUG, "Looking for {$path} for {$id}", 'module');
             // see if it exists
             $moduleFile = realpath_exists($path);
             if ($moduleFile && (include_once $moduleFile)) {
                 //found it
                 $info = new ReflectionClass($className);
                 if (!$info->isAbstract()) {
                     Kurogo::log(LOG_INFO, "Found {$moduleFile} for {$id}", 'module');
                     $module = new $className();
                     if (is_a($module, KurogoWebBridge::STUB_API_CLASS)) {
                         $module->setID($id);
                     }
                     $module->setConfigModule($configModule);
                     // cache the location of the class (which also includes the classname)
                     Kurogo::setCache(self::cacheKey($id, $type), $moduleFile);
                     Kurogo::addModuleLib($id);
                     return $module;
                 }
                 Kurogo::log(LOG_NOTICE, "{$class} found at {$moduleFile} is abstract and cannot be used for {$id}", 'module');
                 return false;
             }
         }
     }
     Kurogo::log(LOG_NOTICE, "No valid {$type} class found for module {$id}", 'module');
     throw new KurogoModuleNotFound(Kurogo::getLocalizedString('ERROR_MODULE_NOT_FOUND', $id));
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:86,代码来源:Module.php

示例7: getDeviceDetectionTypes

 public static function getDeviceDetectionTypes()
 {
     return array(0 => Kurogo::getLocalizedString('DEVICE_DETECTION_INTERNAL'), 1 => Kurogo::getLocalizedString('DEVICE_DETECTION_EXTERNAL'));
 }
开发者ID:nncsang,项目名称:Kurogo,代码行数:4,代码来源:DeviceClassifier.php

示例8: generateErrorMessage

 protected function generateErrorMessage($error_code)
 {
     $error_codes = array(LDAP_SIZELIMIT_EXCEEDED => 'ERROR_TOO_MANY_RESULTS', LDAP_PARTIAL_RESULTS => 'ERROR_TOO_MANY_RESULTS', LDAP_TIMELIMIT_EXCEEDED => 'ERROR_SERVER', LDAP_INSUFFICIENT_ACCESS => 'ERROR_SERVER', LDAP_ADMINLIMIT_EXCEEDED => 'ERROR_TOO_MANY_RESULTS');
     $key = isset($error_codes[$error_code]) ? $error_codes[$error_code] : 'ERROR_GENERIC_SERVER_ERROR';
     return Kurogo::getLocalizedString($key, $error_code, ldap_err2str($error_code));
 }
开发者ID:nncsang,项目名称:Kurogo,代码行数:6,代码来源:LDAPPeopleRetriever.php

示例9: loadPageConfig

 private function loadPageConfig()
 {
     if (!isset($this->pageConfig)) {
         Kurogo::log(LOG_DEBUG, "Loading page configuration for {$this->configModule} - {$this->page}", 'module');
         $this->setPageTitle($this->moduleName);
         // Load site configuration and help text
         $this->assign('strings', Kurogo::getSiteSection('strings'));
         // load module config file
         $pageData = $this->getPageData();
         if (!isset($pageData[$this->page])) {
             throw new KurogoPageNotFoundException(Kurogo::getLocalizedString("ERROR_PAGE_NOT_FOUND", $this->page));
         }
         $pageConfig = $pageData[$this->page];
         if (KurogoWebBridge::isNativeCall()) {
             $this->hasWebBridgePageRefresh = self::argVal($pageConfig, 'nativePageRefresh', false);
             $this->hasWebBridgeAutoRefresh = self::argVal($pageConfig, 'nativePageAutoRefresh', false);
         }
         if (KurogoWebBridge::isNativeCall() && self::argVal($pageConfig, 'nativePageTitle', '')) {
             $this->pageTitle = $pageConfig['nativePageTitle'];
         } else {
             if (isset($pageConfig['pageTitle']) && strlen($pageConfig['pageTitle'])) {
                 $this->pageTitle = $pageConfig['pageTitle'];
             }
         }
         if (KurogoWebBridge::isNativeCall() && self::argVal($pageConfig, 'nativeBreadcrumbTitle', '')) {
             $this->breadcrumbTitle = $pageConfig['nativeBreadcrumbTitle'];
         } else {
             if (isset($pageConfig['breadcrumbTitle']) && strlen($pageConfig['breadcrumbTitle'])) {
                 $this->breadcrumbTitle = $pageConfig['breadcrumbTitle'];
             } else {
                 $this->breadcrumbTitle = $this->pageTitle;
             }
         }
         if (isset($pageConfig['breadcrumbLongTitle']) && strlen($pageConfig['breadcrumbLongTitle'])) {
             $this->breadcrumbLongTitle = $pageConfig['breadcrumbLongTitle'];
         } else {
             $this->breadcrumbLongTitle = $this->pageTitle;
         }
         $this->pageConfig = $pageConfig;
     }
     // Ajax overrides for breadcrumb title and long title
     if (isset($this->args[self::AJAX_BREADCRUMB_TITLE])) {
         $this->breadcrumbTitle = $this->args[self::AJAX_BREADCRUMB_TITLE];
         $this->breadcrumbLongTitle = $this->breadcrumbTitle;
     }
     if (isset($this->args[self::AJAX_BREADCRUMB_LONG_TITLE])) {
         $this->breadcrumbLongTitle = $this->args[self::AJAX_BREADCRUMB_LONG_TITLE];
     }
 }
开发者ID:sponto,项目名称:msbm-mobile,代码行数:49,代码来源:WebModule.php

示例10: appendTruncationSuffix

 private static function appendTruncationSuffix(&$dom, &$node, $replacementText = null)
 {
     $text = isset($replacementText) ? $replacementText : $node->wholeText;
     $clipped = preg_replace('/[.\\s]*$/', '', $text);
     if (trim($clipped)) {
         $node->replaceData(0, $node->length, $clipped);
         $suffix = $dom->createElement('span');
         $suffix->appendChild($dom->createTextNode(Kurogo::getLocalizedString('SANITIZER_HTML_TRUNCATION_SUFFIX')));
         $suffix->setAttribute('class', 'trunctation-suffix');
         if ($node->nextSibling) {
             $node->parentNode->insertBefore($suffix, $node->nextSibling);
         } else {
             $node->parentNode->appendChild($suffix);
         }
     }
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:16,代码来源:Sanitizer.php


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