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


PHP Translator::readLanguageFile方法代码示例

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


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

示例1: Singapore

 /**
  * Constructor, does all init type stuff. This code is a total mess.
  * @param string the path to the base singapore directory
  */
 function Singapore($basePath = "")
 {
     //import class definitions
     //io handler class included once config is loaded
     require_once $basePath . "includes/translator.class.php";
     require_once $basePath . "includes/thumbnail.class.php";
     require_once $basePath . "includes/gallery.class.php";
     require_once $basePath . "includes/config.class.php";
     require_once $basePath . "includes/image.class.php";
     require_once $basePath . "includes/user.class.php";
     //start execution timer
     $this->scriptStartTime = microtime();
     //remove slashes
     if (get_magic_quotes_gpc()) {
         $_REQUEST = array_map(array("Singapore", "arraystripslashes"), $_REQUEST);
     }
     //desanitize request
     $_REQUEST = array_map("htmlentities", $_REQUEST);
     //load config from singapore root directory
     $this->config = sgConfig::getInstance();
     $this->config->loadConfig($basePath . "singapore.ini");
     $this->config->loadConfig($basePath . "secret.ini.php");
     //if instantiated remotely...
     if (!empty($basePath)) {
         //...try to guess base path and relative url
         if (empty($this->config->base_path)) {
             $this->config->base_path = $basePath;
         }
         if (empty($this->config->base_url)) {
             $this->config->base_url = $basePath;
         }
         //...load local config if present
         //may over-ride guessed values above
         $this->config->loadConfig("singapore.local.ini");
     }
     //set current gallery to root if not specified in url
     $galleryId = isset($_GET[$this->config->url_gallery]) ? $_GET[$this->config->url_gallery] : ".";
     //load config from gallery ini file (gallery.ini) if present
     $this->config->loadConfig($basePath . $this->config->pathto_galleries . $galleryId . "/gallery.ini");
     //set current template from request vars or config
     //first, preset template to default one
     $this->template = $this->config->default_template;
     //then check if requested template exists
     if (!empty($_REQUEST[$this->config->url_template])) {
         $templates = Singapore::getListing($this->config->base_path . $this->config->pathto_templates);
         foreach ($templates->dirs as $single) {
             if ($single == $_REQUEST[$this->config->url_template]) {
                 $this->template = $single;
                 break;
             }
         }
     }
     $this->config->pathto_current_template = $this->config->pathto_templates . $this->template . '/';
     //load config from template ini file (template.ini) if present
     $this->config->loadConfig($basePath . $this->config->pathto_current_template . "template.ini");
     //set runtime values
     $this->config->pathto_logs = $this->config->pathto_data_dir . "logs/";
     $this->config->pathto_cache = $this->config->pathto_data_dir . "cache/";
     $this->config->pathto_admin_template = $this->config->pathto_templates . $this->config->admin_template_name . "/";
     //set current language from request vars or config
     if (!empty($_REQUEST[$this->config->url_lang])) {
         $this->language = $_REQUEST[$this->config->url_lang];
     } else {
         $this->language = $this->config->default_language;
         if ($this->config->detect_language) {
             foreach ($this->getBrowserLanguages() as $lang) {
                 if ($lang == "en" || file_exists($basePath . $this->config->pathto_locale . "singapore." . $lang . ".pmo")) {
                     $this->language = $lang;
                     break;
                 }
             }
         }
     }
     //read the language file
     $this->translator = Translator::getInstance($this->language);
     $this->translator->readLanguageFile($this->config->base_path . $this->config->pathto_locale . "singapore." . $this->language . ".pmo");
     //clear the UMASK
     umask(0);
     //include IO handler class and create instance
     require_once $basePath . "includes/io_" . $this->config->io_handler . ".class.php";
     $ioClassName = "sgIO_" . $this->config->io_handler;
     $this->io = new $ioClassName($this->config);
     //load gallery and image info
     $this->selectGallery($galleryId);
     //set character set
     if (!empty($this->translator->languageStrings[0]["charset"])) {
         $this->character_set = $this->translator->languageStrings[0]["charset"];
     } else {
         $this->character_set = $this->config->default_charset;
     }
     if (ini_get("mbstring.func_overload") == "7") {
         $this->character_set = "UTF-8";
     }
     //set action to perform
     if (empty($_REQUEST["action"])) {
         $this->action = "view";
//.........这里部分代码省略.........
开发者ID:kyroskoh,项目名称:singapore-1,代码行数:101,代码来源:singapore.class.php


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