本文整理匯總了PHP中Core::getLang方法的典型用法代碼示例。如果您正苦於以下問題:PHP Core::getLang方法的具體用法?PHP Core::getLang怎麽用?PHP Core::getLang使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Core
的用法示例。
在下文中一共展示了Core::getLang方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: indexAction
/**
* Index action.
*
* @return Bengine_Comm_Controller_Index
*/
public function indexAction()
{
Hook::event("CommIndexStart", array($this));
$this->assign("errorMsg", Core::getRequest()->getGET("error"));
if ($this->isPost()) {
$encryption = Core::getOptions("USE_PASSWORD_SALT") ? "md5_salt" : "md5";
$login = new Bengine_Game_Login($this->getParam("username"), $this->getParam("password"), "game", $encryption);
$login->setRedirectOnFailure(false)->checkData();
if ($login->getCanLogin()) {
Hook::event("PreLogin", array($login));
$login->startSession();
Hook::event("PostLogin", array($login));
} else {
$this->assign("errorMsg", $login->getErrors()->getFirst());
}
}
if ($this->errorMsg != "") {
Core::getLang()->load("error");
$this->assign("errorMsg", Core::getLang()->get($this->errorMsg));
}
$this->assign("page", Core::getLang()->getItem("LOGIN"));
if ($cmsPage = Comm::getCMS()->getPage("index")) {
$this->assign("page", $cmsPage["title"]);
$this->assign("content", $cmsPage["content"]);
$this->setTemplate("cms_page");
} else {
$this->assign("showDefaultContent", true);
}
Hook::event("CommIndexEnd", array($this));
return $this;
}
示例2: indexAction
/**
* @return Bengine_Admin_Controller_News
*/
protected function indexAction()
{
if ($this->getParam("add")) {
$this->add($this->getParam("language_id"), $this->getParam("title"), $this->getParam("text"));
}
$first = true;
$i = 1;
$news = array();
$result = Core::getQuery()->select("news", array("news_id", "title", "text", "time", "enabled", "sort_index"), "", "", "sort_index ASC, news_id DESC");
$total = $result->rowCount();
foreach ($result->fetchAll() as $row) {
$down = "";
$up = "";
if (!$first) {
$up = Image::getImage("admin/up.gif", "", 16, 16);
$up = Link::get("admin/news/moveup/" . $row["news_id"], $up);
}
$first = false;
if ($i < $total) {
$down = Image::getImage("admin/down.gif", "", 16, 16);
$down = Link::get("admin/news/movedown/" . $row["news_id"], $down);
}
$i++;
$news[] = array("news_id" => $row["news_id"], "title" => $row["title"], "text" => $row["text"], "time" => Date::timeToString(1, $row["time"]), "enabled" => $row["enabled"], "edit" => Link::get("admin/news/edit/" . $row["news_id"], Core::getLang()->get("Edit")), "delete" => Link::get("admin/news/delete/" . $row["news_id"], Core::getLang()->get("Delete")), "enable" => Link::get("admin/news/enable/" . $row["news_id"], Core::getLang()->get("Enable"), "", "green"), "disable" => Link::get("admin/news/disable/" . $row["news_id"], Core::getLang()->get("Disable"), "", "red"), "down" => $down, "up" => $up);
}
Core::getTemplate()->addLoop("news", $news);
$languages = $this->getLanguages();
Core::getTPL()->assign("languageCount", count($languages));
if (count($languages) == 1) {
Core::getTPL()->assign("languages", key($languages));
} else {
Core::getTPL()->assign("languages", $this->getLanguageSelect());
}
return $this;
}
示例3: render
/**
* @return array
*/
public function render()
{
foreach ($this->getModules() as $module) {
if ($module["enable"]) {
$name = $module["name"];
$translate = true;
if (is_array($name)) {
$translate = $name["noLangVar"];
$name = $name["value"];
}
if ($translate) {
$name = Core::getLang()->get($name);
}
$uri = $module["link"];
if (is_array($uri)) {
$package = isset($uri["package"]) ? $uri["package"] : "admin";
$controller = isset($uri["controller"]) ? $uri["controller"] : "index";
$action = isset($uri["action"]) ? $uri["action"] : "index";
$uri = "{$package}/{$controller}/{$action}";
}
$this->menu[] = Link::get($uri, $name, "", isset($module["class"]) ? $module["class"] : "");
}
}
return $this->menu;
}
示例4: getHtml
/**
* Returns the form html for the field.
*
* @return string
*/
public function getHtml()
{
$field = $this->getModel();
return '<textarea id="' . strtolower($field->getName()) . '" name="' . $field->getName() . '">' . stripslashes($this->getData()) . '</textarea>
<script type="text/javascript">
//<![CDATA[
tinyMCE_GZ.init({
language: "' . Core::getLang()->getOpt("langcode") . '",theme: "advanced",disk_cache : true,debug : false,
plugins: "style,table,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,contextmenu,paste,fullscreen,noneditable,xhtmlxtras"
});
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
tinyMCE.init({
language: "' . Core::getLang()->getOpt("langcode") . '",forced_root_block: "div",theme: "advanced",skin : "alliancetext",mode: "exact",elements: "' . strtolower($field->getName()) . '",theme_advanced_toolbar_location: "top",theme_advanced_toolbar_align : "left",theme_advanced_disable: "anchor,styleselect",theme_advanced_statusbar_location: "bottom",theme_advanced_resizing: true,theme_advanced_resize_horizontal: false,width: 505,height: 370,relative_urls: false,remove_script_host: false,
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,insertdate,inserttime,preview",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,forecolor,backcolor",
theme_advanced_buttons4 : "styleprops,cite,abbr,acronym,|,link,unlink,anchor,image,cleanup,code,fullscreen,|,charmap,emotions,iespell,media,advhr,|,sub,sup",
plugins: "style,table,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,contextmenu,paste,fullscreen,noneditable,xhtmlxtras"
});
//]]>
</script>';
}
示例5: doLogin
/**
* 登錄表單操作
*/
public function doLogin()
{
$codeValue = md5(md5($_SERVER['SERVER_NAME']) . strtoupper($_POST['authcode']));
// 驗證碼不正確
if (!isset($_COOKIE['admin_authcode']) || $codeValue != $_COOKIE['admin_authcode']) {
setcookie('admin_authcode', false);
$this->json(Core::getLang('incorrect_verification_code'), 2);
}
// 賬號密碼驗證失敗
if ('admin' == $_POST['username']) {
include APP_PATH . 'config' . DS . 'adminpass.cfg.php';
if ($_admin_pass == User::hashPassword($_POST['password'], $_admin_salt)) {
$_SESSION['uid'] = 1;
$_SESSION['username'] = 'admin';
} else {
$this->json(Core::getLang('password_incorrect'), 0);
}
} else {
if (!User::verify($_POST['username'], $_POST['password'])) {
$this->json(User::$msg, 0);
}
}
setcookie('admin_authcode', false);
// 成功輸出默認數據
$this->json();
}
示例6: 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;
}
示例7: 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;
}
示例8: _match
/**
* @return bool
*/
protected function _match()
{
if ($this->getUser()->get("hp") == Core::getUser()->get("curplanet")) {
return Game::getPlanet()->getData("planetname") != Core::getLang()->get("HOME_PLANET");
}
$planet = Game::getModel("game/planet")->load($this->getUser()->get("hp"));
return $planet->get("planetname") != Core::getLang()->get("HOME_PLANET");
}
示例9: _sendRemoteRequest
/**
* Sends a remote request.
*
* @param string $url Universe url
* @param string $username Username
* @param string $email E-Mail address
*
* @return Bengine_Comm_Controller_Password
*/
protected function _sendRemoteRequest($url, $username, $email)
{
$url .= Core::getLang()->getOpt("langcode") . "/password/request";
$request = new Recipe_HTTP_Request($url, "Curl");
$request->getSession()->setRequestType("POST")->setPostArgs(array("username" => $username, "email" => $email));
terminate($request->getResponse());
return $this;
}
示例10: addLanguageFilter
/**
* Adds a language filter.
*
* @param integer Language id [optional]
*
* @return Bengine_Game_Model_Collection_News
*/
public function addLanguageFilter($langId = null)
{
if (is_null($langId)) {
$langId = Core::getLang()->getOpt("languageid");
}
$this->getSelect()->where(array("n" => "language_id"), (int) $langId);
return $this;
}
示例11: atomAction
/**
* Shows the pillory as Atom feed.
*
* @return Bengine_Comm_Controller_Pillory
*/
public function atomAction()
{
$this->assign("selfUrl", BASE_URL . "pillory/atom");
$this->assign("alternateUrl", BASE_URL . "pillory");
$this->assign("title", Core::getLang()->get("PILLORY"));
Core::getTPL()->addLoop("feed", $this->getBans(0, self::MAX_FEED_ITEMS));
$this->setTemplate("atom");
return $this;
}
示例12: _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;
}
示例13: run
/**
* Runs the community application.
*
* @return void
*/
public function run()
{
parent::run();
Core::getUser()->removeTheme();
Core::getTPL()->addHTMLHeaderFile("admin.css", "css");
Core::getLang()->load(array("AI_Global"));
$menu = new Bengine_Admin_Menu();
Core::getTPL()->addLoop("menu", $menu->getMenu());
$this->dispatch();
return;
}
示例14: _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;
}
示例15: 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;
}