當前位置: 首頁>>代碼示例>>PHP>>正文


PHP I18n::L方法代碼示例

本文整理匯總了PHP中I18n::L方法的典型用法代碼示例。如果您正苦於以下問題:PHP I18n::L方法的具體用法?PHP I18n::L怎麽用?PHP I18n::L使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在I18n的用法示例。


在下文中一共展示了I18n::L方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: header

     if (User::Logged()) {
         // Validation for user input
         if (empty($_POST["idea_title"]) || empty($_POST["idea_description"])) {
             $error_message = I18n::L("Please fill title and description.");
         }
         if (strlen($_POST["idea_title"]) > 115) {
             $error_message = I18n::L("Your idea title is too long.");
         }
         if (empty($error_message)) {
             $idea = Idea::Add(Idea::Create($_POST["idea_title"], $_POST["idea_description"], User::$current));
             header("Location:" . PREFIX . "/idea?" . $idea->idea_id);
             exit;
         } else {
             Viewer::AddData("idea_title", $_POST["idea_title"]);
             Viewer::UseTemplate("new_idea.tpl");
             Viewer::AddData("title", I18n::L("Title New Idea"));
             Viewer::AddData("error_message", $error_message);
         }
     } else {
         Viewer::Restricted();
     }
     $action = "new_idea";
 }
 // Default view
 if (!empty($id)) {
     if ($idea = Idea::GetById($id)) {
         Viewer::AddData("comments", Comments::GetByIdea($idea));
         Viewer::AddData("idea", $idea);
         Viewer::AddData("title", $idea->idea_title);
         if (isset($_GET["rate_plus"])) {
             $rated = 3;
開發者ID:BGCX261,項目名稱:zoneideas-svn-to-git,代碼行數:31,代碼來源:index.php

示例2: array

        } else {
            if (User::FindUser($user_name)) {
                $error_message = I18n::L("Username «%s» is already taken, please find another username.", array($user_name));
            } else {
                if (User::FindUserByEmail($user_email)) {
                    $error_message = I18n::L("This email «%s» is already regesitered, please use another email.", array($user_email));
                } else {
                    $obj = User::Add(User::Create($user_name, $user_email, $_POST["user_password"]));
                    if ($obj->user_id) {
                        Session::StartUser($obj);
                        header("Location:" . PREFIX . "/dashboard/");
                        exit;
                    } else {
                        $error_message = I18n::L("Error while registring user.");
                    }
                    //todo: add some error log
                }
            }
        }
    }
} else {
    if (!empty($_POST["register"])) {
        $error_message = I18n::L("Please fill all required fields.");
    }
}
Viewer::AddData("title", I18n::L("Title Registration"));
Viewer::AddData("error_message", $error_message);
Viewer::UseTemplate("register.tpl");
Viewer::AddData("action", $action);
Viewer::Show();
ob_end_flush();
開發者ID:BGCX261,項目名稱:zoneideas-svn-to-git,代碼行數:31,代碼來源:index.php

示例3: ob_start

<?php

/**
 * @package    zoneideas
 * @subpackage dashboard
 * @author     Serg Podtynnyi <serg.podtynnyi@gmail.com>
 */
/**
 *
 *
 */
ob_start();
include_once "../core.php";
$action = false;
if (User::Logged()) {
    Viewer::AddData("ideas", Ideas::GetByUser(User::$current));
    Viewer::AddData("user", User::$current);
    Viewer::AddData("title", I18n::L("Title Dashboard"));
    Viewer::UseTemplate("dashboard.tpl");
    $action = "dashboard";
} else {
    Viewer::Restricted();
    $action = "restricted";
}
if (!$action) {
    Viewer::RequestError();
}
Viewer::AddData("action", $action);
Viewer::Show();
ob_end_flush();
開發者ID:BGCX261,項目名稱:zoneideas-svn-to-git,代碼行數:30,代碼來源:index.php

示例4: ob_start

/**
 *
 *
 */
ob_start();
include_once "../core.php";
$action = "login";
if (!empty($_POST["login"])) {
    if (!empty($_POST["user_name"]) && !empty($_POST["user_password"])) {
        $obj = User::CheckUser($_POST["user_name"], $_POST["user_password"]);
        User::$current = Session::StartUser($obj);
    } else {
        $error_message = I18n::L("Please fill all required fields.");
    }
}
if (User::Logged()) {
    header("Location:" . PREFIX . "/dashboard/");
    exit;
}
if (!empty($_POST["login"]) && !User::Logged()) {
    if (empty($error_message)) {
        $error_message = I18n::L("Wrong password.");
    }
    Viewer::AddData("error_message", $error_message);
    Viewer::AddData("user_name", $_POST["user_name"]);
}
Viewer::AddData("title", I18n::L("Title Login"));
Viewer::UseTemplate("login.tpl");
Viewer::AddData("action", $action);
Viewer::Show();
ob_end_flush();
開發者ID:BGCX261,項目名稱:zoneideas-svn-to-git,代碼行數:31,代碼來源:index.php


注:本文中的I18n::L方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。