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


PHP Locale::localize方法代码示例

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


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

示例1: checkForModuleUpdate

 /**
  * This function checks for an update for a particular module at the lotuscms website.
  */
 public function checkForModuleUpdate($req)
 {
     if (isset($_SESSION['MODUPDATE'])) {
         print $_SESSION['MODUPDATE'];
         exit;
     } else {
         include_once "core/lib/RemoteFiles.php";
         include_once "core/lib/ModuleInfo.php";
         //Get information on update status of each plugin.
         //Setup remote file requestor
         $rf = new RemoteFiles();
         //Get site version
         $version = file_get_contents("data/config/site_version.dat");
         $data = "";
         if (isset($_SESSION['MOD_LCMS_ORG_RESPONSE_URL'])) {
             $data = $_SESSION['MOD_LCMS_ORG_RESPONSE_URL'];
         }
         if (file_exists("data/lcmscache/mod_update.dat") && empty($data)) {
             include_once "core/lib/io.php";
             $io = new InputOutput();
             $data = $io->openFile("data/lcmscache/mod_update.dat");
             $_SESSION['MOD_LCMS_ORG_RESPONSE_URL'] = $data;
             //Finally delete the cache
             unlink("data/lcmscache/mod_update.dat");
         } else {
             //Collect information on module updates.
             $data = $rf->getURL("http://cdn.modules.lotuscms.org/lcms-3-series/versioncontrol/allversioncheck.php?m={$req}&v={$version}");
         }
         //Save response in session in case it is required later
         $_SESSION['MOD_LCMS_ORG_RESPONSE_URL'] = $data;
         //Output
         $out = "";
         if (empty($data)) {
             print "<p class='msg error'><strong>Error:</strong> cannot connect to lotuscms.org</p>";
             exit;
         }
         //Get list of plugins
         $m = explode("|", $data);
         $l = new Locale();
         //Loop through each update response.
         for ($i = 0; $i < count($m); $i++) {
             //Split name & version number
             $getFull = explode(":", $m[$i]);
             //Get full number of plugin
             $nv = (double) $getFull[1];
             //Get current version
             include_once "modules/" . $getFull[0] . "/" . $getFull[0] . "ModuleInfo.php";
             $name = $getFull[0] . "ModuleInfo";
             //Load info class
             $info = new $name();
             //Load info
             $info->ModuleInfo();
             //Get current version number
             $cv = (double) $info->getVersion();
             //If new version is actually newer than installed.
             if ($cv < $nv) {
                 $out .= '<p class="msg error">' . $l->localize("Module") . ': ' . $getFull[0] . ' ' . $l->localize("is out of date") . ' [' . $l->localize("version") . ': ' . $getFull[1] . ']. <a href="index.php?system=Modules&page=updateCheck&req=' . $getFull[0] . '">' . $l->localize("Update") . '</a></p>';
             }
         }
         print $out;
         $_SESSION['MODUPDATE'] = $out;
         exit;
     }
 }
开发者ID:andreaspada,项目名称:LotusCMS-Content-Management-System,代码行数:67,代码来源:Abstraction.php

示例2: loadDash

 /**
  * Loads a jQuery based dashboard.
  */
 private function loadDash()
 {
     //Get the Locale
     include_once "core/lib/Locale.php";
     $l = new Locale();
     //Checks for update
     $data = $this->checkForUpdate();
     //If no update available.
     if (empty($data)) {
         $this->view->setErrorData("success", $l->localize("Welcome to the new LotusCMS 3 Series, visit the <a href='http://forum.lotuscms.org'>LotusCMS Forum</a> for help / questions"));
     } else {
         $this->view->setErrorData("error", $data);
     }
     //Buttons.
     $out = "<fieldset><table width='10%'><tr>";
     //Count items
     $i = 0;
     if ($this->hasBlog()) {
         $i++;
         //Creates an icon for the blog
         $out .= $this->createIcon("index.php?system=Modules&page=admin&active=Blog", "modules/Blog/logo.png", $l->localize("Blog"));
     }
     if ($this->hasMenu()) {
         $i++;
         //Creates icon for the menu
         $out .= $this->createIcon("index.php?system=Modules&page=admin&active=Menu", "modules/Menu/logo.png", $l->localize("Menu"));
     }
     if ($this->hasBackup()) {
         $i++;
         //Creates icon for the menu
         $out .= $this->createIcon("index.php?system=Modules&page=admin&active=Backup", "modules/Backup/logo.png", $l->localize("Backup"));
     }
     //Adds an icon for the template
     if ($i < 6) {
         $i++;
         $out .= $this->createIcon("index.php?system=Template&page=change", "style/comps/admin/img/templates.png", $l->localize("Styles"));
     }
     $out .= "</tr></table></fieldset>";
     //Working module update check. Takes Aggeeess to load - due to up to 8 HTTP requests sent to LotusCMS.org.
     $extra = '<script type="text/javascript">
 		<!--
 		$(document).ready(function() {
 			$("#loadNews").load("index.php?system=Modules&page=admin&active=Dashboard&req=news");
 			$(window).load(
 function() {';
     $plugs = $this->getPlugins();
     if (!file_exists("data/modules/Dashboard/stopmodulecheck.dat")) {
         $requests = "";
         for ($k = 0; $k < count($plugs); $k++) {
             if ($k != 0) {
                 $requests .= "|";
             }
             $requests .= $plugs[$k];
         }
         $extra .= '$("#checkModules").load("index.php?system=Modules&page=admin&active=Dashboard&req=checkModules&id=' . $requests . '");';
         $out .= "<div id='checkModules'><p style='border: 1px solid #e3e3e3; font-size:11px;'><img style='float:left;padding-top:3px;padding-left:4px;' src='modules/Dashboard/loading.gif' height='15px' width='15px'/>&nbsp;<span style='display:block;float:left;width: 400px;height:20px;margin-left:20px;'>" . $l->localize("Checking for module updates") . "…</span><span style='display:block;width:60px;height:20px;margin-right:6px;text-align:right;float:right'><a style='color:#b2b2b2;text-decoration:none;' href='index.php?system=Modules&page=admin&active=Dashboard&req=disableModCheck'><!--Disable--></a></span></p></div>";
     }
     $this->getView()->getMeta()->appendExtra($extra . '    } );});
 	--></script>');
     $out .= "<fieldset>";
     $out .= "<p id='loadNews'><strong>" . $l->localize("Loading News...") . "</strong></p>";
     $out .= "</fieldset>";
     //Sets the content of the dashboard.
     $this->getView()->setContent($out);
 }
开发者ID:andreaspada,项目名称:LotusCMS-Content-Management-System,代码行数:68,代码来源:DashViewPlugin.php


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