本文整理汇总了PHP中Core::getLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::getLanguage方法的具体用法?PHP Core::getLanguage怎么用?PHP Core::getLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::getLanguage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRanking
/**
* Checks for ranking type and calls the page.
*
* @param integer $mode Ranking mode (Alliance or Player)
* @param integer $type Points type and order
* @param boolean $avg Average mode
* @param integer $position Start position
*
* @return Bengine_Game_Controller_Ranking
*/
protected function getRanking($mode, $type, $avg, $position)
{
Core::getLanguage()->load(array("Statistics", "Galaxy", "Alliance"));
$this->assignRelationTypes();
$validTypes = array("points", "fpoints", "rpoints", "dpoints", "level");
if (!in_array($type, $validTypes)) {
$type = "points";
}
if ($avg) {
$this->average = true;
}
Core::getTPL()->assign("type1Sel", $type == "points" ? " selected=\"selected\"" : "");
Core::getTPL()->assign("type2Sel", $type == "fpoints" ? " selected=\"selected\"" : "");
Core::getTPL()->assign("type3Sel", $type == "rpoints" ? " selected=\"selected\"" : "");
Core::getTPL()->assign("type4Sel", $type == "level" ? " selected=\"selected\"" : "");
Core::getTPL()->assign("type5Sel", $type == "dpoints" ? " selected=\"selected\"" : "");
Core::getTPL()->assign("avg_on", $this->average);
if ($mode == 2) {
Core::getTPL()->assign("mod1Sel", "");
Core::getTPL()->assign("mod2Sel", " selected=\"selected\"");
$this->allianceRanking($type, $position);
} else {
Core::getTPL()->assign("mod2Sel", "");
Core::getTPL()->assign("mod1Sel", " selected=\"selected\"");
$this->playerRanking($type, $position);
}
return $this;
}
示例2: indexAction
/**
* Index action.
*
* @return Bengine_Comm_Controller_Signup
*/
public function indexAction()
{
$this->assign("page", Core::getLang()->getItem("REGISTRATION"));
$this->assign("userCheck", sprintf(Core::getLanguage()->getItem("USER_CHECK"), Core::getOptions()->get("MIN_USER_CHARS"), Core::getOptions()->get("MAX_USER_CHARS")));
$this->assign("passwordCheck", sprintf(Core::getLanguage()->getItem("PASSWORD_CHECK"), Core::getOptions()->get("MIN_PASSWORD_LENGTH"), Core::getOptions()->get("MAX_PASSWORD_LENGTH")));
return $this;
}
示例3: reportAction
/**
* Combat report action.
*
* @return Bengine_Comm_Controller_Combat
*/
public function reportAction()
{
if (!defined("SID")) {
define("SID", "");
}
Core::getLanguage()->load(array("info", "AssaultReport"));
Core::getTPL()->clearHTMLHeaderFiles();
Core::getTPL()->addHTMLHeaderFile("game.css", "css");
Core::getTPL()->addHTMLHeaderFile("lib/jquery.js", "js");
$select = new Recipe_Database_Select();
$select->from(array("a" => "assault"))->join(array("p" => "planet"), "p.planetid = a.planetid")->attributes(array("a" => array("report"), "p" => array("planetname")))->where(array("a" => "assaultid"), $this->getParam("1"))->where(array("a" => "key"), $this->getParam("2"));
$result = $select->getStatement();
$row = $result->fetchRow();
if ($row) {
$report = $row["report"];
$report = preg_replace_callback("/\\{lang}([^\"]+)\\{\\/lang}/siU", function ($matches) {
return Core::getLanguage()->getItem($matches[1]);
}, $report);
$report = preg_replace_callback("/\\{embedded\\[([^\"]+)]}(.*)\\{\\/embedded}/siU", function ($matches) {
return sprintf(Core::getLanguage()->getItem($matches[1]), $matches[2]);
}, $report);
Hook::event("ShowCombatReport", array(&$report, &$row));
$this->assign("report", $report);
$this->assign("planetName", $row["planetname"]);
$this->setIsAjax();
} else {
$this->setNoDisplay(true);
}
return $this;
}
示例4: run
/**
* Runs the community application.
*
* @return Comm
*/
public function run()
{
parent::run();
Hook::event("CommStart");
define("LANG", Core::getLang()->getOpt("langcode") . "/");
Core::getLang()->load("Registration");
self::setCMS();
self::initUniverses();
self::initLanguage();
Core::getTPL()->addHTMLHeaderFile("lib/jquery.js", "js");
Core::getTPL()->addHTMLHeaderFile("lib/bootstrap.js", "js");
Core::getTPL()->addHTMLHeaderFile("main.js", "js");
Core::getTPL()->addHTMLHeaderFile("sign.js", "js");
Core::getTPL()->addHTMLHeaderFile("style.css", "css");
Core::getTPL()->assign("containerClass", "content");
Core::getTPL()->addLoop("headerMenu", self::getCMS()->getMenu("h"));
$userCheck = sprintf(Core::getLanguage()->getItem("USER_CHECK"), Core::getOptions()->get("MIN_USER_CHARS"), Core::getOptions()->get("MAX_USER_CHARS"));
$passwordCheck = sprintf(Core::getLanguage()->getItem("PASSWORD_CHECK"), Core::getOptions()->get("MIN_PASSWORD_LENGTH"), Core::getOptions()->get("MAX_PASSWORD_LENGTH"));
Core::getTPL()->assign("userCheck", $userCheck);
Core::getTPL()->assign("passwordCheck", $passwordCheck);
Core::getTPL()->assign("uniSelection", self::getUnisAsOptionList());
Hook::event("CommTemplateAssign");
$this->dispatch();
Hook::event("CommEnd");
return $this;
}
示例5: pageAction
/**
* Alliance page action.
*
* @return Bengine_Comm_Controller_Alliance
*/
public function pageAction()
{
Core::getLanguage()->load("Alliance");
Core::getTPL()->clearHTMLHeaderFiles();
Core::getTPL()->addHTMLHeaderFile("game.css", "css");
Core::getTPL()->addHTMLHeaderFile("lib/jquery.js", "js");
$tag = $this->getParam("1");
$fNumber = array("member", "points", "rpoints", "fpoints", "dpoints");
$attr = array("a.aid", "a.name", "a.tag", "a.logo", "a.textextern", "a.homepage", "a.showhomepage", "COUNT(u2a.userid) AS member", "SUM(u.points) AS points", "SUM(u.rpoints) AS rpoints", "SUM(u.fpoints) AS fpoints", "SUM(u.dpoints) AS dpoints");
$joins = "LEFT JOIN " . PREFIX . "user2ally u2a ON (u2a.aid = a.aid) ";
$joins .= "LEFT JOIN " . PREFIX . "user u ON (u2a.userid = u.userid) ";
$result = Core::getQuery()->select("alliance a", $attr, $joins, Core::getDB()->quoteInto("tag = ?", $tag), "", 1, "a.aid");
$row = $result->fetchRow();
if ($row) {
foreach ($fNumber as $field) {
$row[$field] = fNumber($row[$field]);
}
$parser = new Bengine_Game_Alliance_Page_Parser($row["aid"]);
if (Str::length(strip_tags($row["textextern"])) > 0) {
$row["textextern"] = $parser->startParser($row["textextern"]);
} else {
$row["textextern"] = Core::getLang()->get("WELCOME");
}
$row["homepage"] = $row["homepage"] != "" ? Link::get($row["homepage"], $row["homepage"], $row["homepage"]) : "";
$row["logo"] = $row["logo"] != "" ? Image::getImage($row["logo"], "") : "";
Hook::event("ShowPublicAlliancePage", array(&$row));
$this->assign($row);
$this->setIsAjax();
} else {
$this->setNoDisplay(true);
}
return $this;
}
示例6: timeToString
public static function timeToString($type = 1, $timestamp = -1, $format = "", $replaceShortDate = 1)
{
$time = self::getTimestamp();
$timestamp = (int) $timestamp;
if ($timestamp < 0) {
$timestamp = $time;
}
if ($format != "") {
$type = 3;
}
$date = "";
$isShortDate = false;
Hook::event("ConvertTimestampStart", array($type, $timestamp, &$format));
// Replace date designation, if timestamp is today or yesterday.
// Note: Does not work with specific date format.
if ($replaceShortDate && $format == "") {
$dateRepresentive = date("Y-m-d", $timestamp);
if (date("Y-m-d", strtotime("-1 day", $time)) == $dateRepresentive) {
$date = Core::getLanguage()->getItem("YESTERDAY");
$isShortDate = true;
} else {
if (date("Y-m-d", $time) == $dateRepresentive) {
$date = Core::getLanguage()->getItem("TODAY");
$isShortDate = true;
} else {
if (date("Y-m-d", strtotime("+1 day", $time)) == $dateRepresentive) {
$date = Core::getLanguage()->getItem("TOMORROW");
$isShortDate = true;
}
}
}
if ($type == 1 && $isShortDate) {
return "<span class=\"cur-day\">" . $date . "</span> " . date(self::getTimeFormat(), $timestamp);
} else {
if ($type == 2 && $isShortDate) {
return "<span class=\"cur-day\">" . $date . "</span>";
}
}
}
switch ($type) {
// Date + Time Format
default:
case 1:
$date = date(self::getDateFormat() . " " . self::getTimeFormat(), $timestamp);
break;
// Only Date Format
// Only Date Format
case 2:
$date = date(self::getDateFormat(), $timestamp);
break;
// Specific Format
// Specific Format
case 3:
$date = date($format, $timestamp);
break;
}
Hook::event("ConvertTimestampClose", array($type, $timestamp, &$format, &$date));
return $date;
}
示例7: printIt
/**
* Prints either an error or success message.
*
* @param string $output
* @param boolean $error
*
* @return Bengine_Game_Account_Password_Changer
*/
protected function printIt($output, $error = true)
{
if ($error === true) {
$this->display("<div class=\"error\">" . Core::getLanguage()->getItem($output) . "</div>");
}
$this->display("<div class=\"success\">" . Core::getLanguage()->getItem($output) . "</div><br />");
return $this;
}
示例8: __construct
/**
* Creates a new user list object.
*
* @param resource $list Query result for a list
* @param int $start
* @return \Bengine_Game_User_List
*/
public function __construct($list = null, $start = 0)
{
$this->pmPic = Image::getImage("pm.gif", Core::getLanguage()->getItem("WRITE_MESSAGE"));
$this->buddyPic = Image::getImage("b.gif", Core::getLanguage()->getItem("ADD_TO_BUDDYLIST"));
$this->modPic = Image::getImage("moderator.gif", Core::getLanguage()->getItem("MODERATE"));
$this->points = Core::getUser()->get("points");
parent::__construct($list, $start);
}
示例9: getMessageField
/**
* Formats a message.
*
* @param string $message Raw log message
* @param string $mode Log mode
*
* @return string Formatted message
*/
public static function getMessageField($message, $mode = "error")
{
Core::getLanguage()->load("error");
$message = Core::getLanguage()->getItem($message);
$message = "<span class=\"field_" . $mode . "\">" . $message . "</span>";
Hook::event("MessageField", array(&$message));
return $message;
}
示例10: _format
/**
* Formats the message.
*
* @param Bengine_Game_Model_Message $message
*
* @return Bengine_Game_MessageFolder_System
*/
protected function _format(Bengine_Game_Model_Message $message)
{
if (!$message->get("sender")) {
$message->set("sender", Core::getLanguage()->getItem("FLEET_COMMAND"));
}
$message->set("subject", str_replace("%SID%", SID, $message->get("subject")));
$message->set("message", str_replace("%SID%", SID, $message->get("message")));
return $this;
}
示例11: _formatFeed
/**
* Formats the message for news feeds.
*
* @param Bengine_Game_Model_Message $message
*
* @return Bengine_Game_MessageFolder_Combat
*/
protected function _formatFeed(Bengine_Game_Model_Message $message)
{
$assaultId = (int) $message->get("message");
$assault = Application::getModel("game/assault")->load($assaultId);
$link = BASE_URL . Core::getLang()->getOpt("langcode") . "/combat/report/" . $assaultId . "/" . $assault->get("key");
$gentime = $assault->get("gentime") / 1000;
$text = Core::getLanguage()->getItem("ASSAULT_REPORT") . " (A: " . fNumber($assault->get("lostunits_attacker")) . ", D: " . fNumber($assault->get("lostunits_defender")) . ") " . $gentime . "s";
$subject = Core::getLang()->get($message->get("subject")) . ": " . $assault->get("planetname") . " [" . $assault->getCoords(false) . "]";
$message->set(array("message" => $text, "subject" => $subject, "link" => $link));
return $this;
}
示例12: __construct
/**
* Creates a new controller object.
*
* @param array $args
*
* @return Recipe_Controller_Abstract
*/
public function __construct(array $args = array())
{
if (!empty($args["action"])) {
$this->_action = strtolower($args["action"]);
}
$this->_requestMethod = strtolower($_SERVER["REQUEST_METHOD"]);
$this->setPackage(Core::getRequest()->getGET("package"));
$this->setMainTemplate($this->getPackage());
$this->view = Core::getTemplate();
$this->language = Core::getLanguage();
$this->init();
return $this;
}
示例13: _match
/**
* @return bool
*/
protected function _match()
{
Core::getLanguage()->load(array("Profile"));
$userId = $this->getUser()->get("userid");
/* @var Bengine_Game_Model_Profile $avatar */
$avatar = Game::getModel("game/profile")->loadByCode("AVATAR", $userId);
/* @var Bengine_Game_Model_Profile $about */
$about = Game::getModel("game/profile")->loadByCode("ABOUT_ME", $userId);
if ($avatar->get("data") != "" && strip_tags($about->get("data")) != "" && $about->get("data") != Core::getLang()->get("DEFAULT_ABOUT_ME")) {
return true;
}
return false;
}
示例14: indexAction
/**
* @return Bengine_Admin_Controller_Cronjob
*/
protected function indexAction()
{
if ($this->getParam("add_cronjob")) {
$this->add($this->getParam("month"), $this->getParam("day"), $this->getParam("weekday"), $this->getParam("hour"), $this->getParam("minute"), $this->getParam("class"));
}
$minute = "";
$hour = "";
$weekday = "";
$day = "";
$month = "";
$i = 0;
while ($i < 60) {
$minute .= createOption($i, $i, 0);
$i += 5;
}
for ($i = 0; $i < 24; $i++) {
$hour .= createOption($i, $i, 0);
}
$wds = array(1 => "Mon", 2 => "Tue", 3 => "Wed", 4 => "Thu", 5 => "Fri", 6 => "Sat", 7 => "Sun");
for ($i = 1; $i <= 7; $i++) {
$weekday .= createOption($i, $wds[$i], 0);
}
for ($i = 1; $i <= 31; $i++) {
$day .= createOption($i, $i, 0);
}
for ($i = 1; $i <= 12; $i++) {
$month .= createOption($i, $i, 0);
}
Core::getTPL()->assign("minute", $minute);
Core::getTPL()->assign("hour", $hour);
Core::getTPL()->assign("weekday", $weekday);
Core::getTPL()->assign("day", $day);
Core::getTPL()->assign("month", $month);
$tabs = array();
$result = Core::getQuery()->select("cronjob", array("cronid", "class", "xtime", "last", "active"), "ORDER BY xtime ASC");
foreach ($result->fetchAll() as $row) {
$id = $row["cronid"];
$tabs[$id]["cronid"] = $row["cronid"];
$tabs[$id]["class"] = $row["class"];
$tabs[$id]["xtime"] = empty($row["xtime"]) ? Core::getLang()->get("NEVER") : date("Y-m-d H:i:s", $row["xtime"]);
$tabs[$id]["last"] = empty($row["last"]) ? Core::getLang()->get("NEVER") : date("Y-m-d H:i:s", $row["last"]);
$tabs[$id]["delete"] = Link::get("admin/cronjob/delete/" . $id, Core::getLanguage()->getItem("Delete"));
$tabs[$id]["exec"] = Link::get("admin/cronjob/execute/" . $id, Core::getLanguage()->getItem("Execute"));
$tabs[$id]["edit"] = Link::get("admin/cronjob/edit/" . $id, Core::getLanguage()->getItem("Edit"));
$tabs[$id]["active"] = $row["active"] ? Link::get("admin/cronjob/disable/" . $id, "<span class=\"green\">On</span>", Core::getLanguage()->getItem("Disable")) : Link::get("admin/cronjob/enable/" . $id, "<span class=\"red\">Off</span>", Core::getLanguage()->getItem("Enable"));
}
Core::getTPL()->addLoop("crontabs", $tabs);
return $this;
}
示例15: userAction
/**
* @var int $user
* @return Bengine_Game_Controller_Achievements
*/
public function userAction($user)
{
Core::getLanguage()->load(array("Achievements"));
$user = Application::getModel("game/user")->load((int) $user);
/* @var Bengine_Game_Model_Collection_Achievement $achievements */
$achievements = Application::getCollection("game/achievement");
$achievements->addUserJoin($user->get("userid"), true)->addDefaultSorting();
$this->view->addLoop("achievements", $achievements);
$this->view->assign("user", $user);
$this->language->assign("leftXP", $user->getLeftXPForNextLevel());
$this->language->assign("nextLevel", $user->get("level") + 1);
$this->language->assign("xp", $user->get("xp"));
$this->language->assign("level", $user->get("level"));
$this->language->assign("achievementUser", Link::get("game/" . SID . "/Profile/Page/" . $user->get("userid"), $user->get("username")));
}