本文整理汇总了PHP中Utils::translate方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::translate方法的具体用法?PHP Utils::translate怎么用?PHP Utils::translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils
的用法示例。
在下文中一共展示了Utils::translate方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notifyModerators
function notifyModerators($id, $page, $text, $userName, $name, $product, $moderators)
{
$template = new Template("./templates/newCommentToModerate.html");
$productTranslate = defined("__PRODUCT_NAME__") ? __PRODUCT_NAME__ : $product;
$subject = "[" . $productTranslate . "] " . Utils::translate('newCommentToModerate');
if (defined('__MODERATE__') && !__MODERATE__) {
$template = new Template("./templates/newUnmoderatedComment.html");
$subject = "[" . $productTranslate . "] " . Utils::translate('newUnmoderatedCommentAdded');
}
$subject .= " [" . $page . "]";
$ca = base64_encode($id . "&approved");
$cr = base64_encode($id . "&deleted");
$confirmationMsg = $template->replace(array("page" => __BASE_URL__ . $page . "#" . $id, "text" => $text, "userName" => $userName, "user" => $name, "productName" => $productTranslate, "aproveLink" => __BASE_URL__ . "oxygen-webhelp/resources/moderate.html?c=" . $ca, "deleteLink" => __BASE_URL__ . "oxygen-webhelp/resources/moderate.html?c=" . $cr));
foreach ($moderators as $key => $value) {
$mail = new Mail();
$mail->Subject($subject);
$mail->To($value);
$mail->From(__EMAIL__);
$mail->Body($confirmationMsg);
$mail->Send();
}
}
示例2: generatePasswd
/**
* Recover lost password
*
* @param array $info containing user email, product , version
* @return array Information about new generated password as: the email match username or not and generated password
*/
function generatePasswd($info)
{
$toReturn = array();
$this->info['msg'] = "Password not generated!";
$db = new RecordSet($this->dbConnectionInfo);
$info['username'] = $db->sanitize($info['username']);
$info['email'] = $db->sanitize($info['email']);
$query = "SELECT userName FROM users WHERE email='" . $info['email'] . "' AND status='validated'";
$rows = $db->Open($query);
$toReturn['match'] = false;
if ($rows == 1) {
$db->MoveNext();
if (LDAP_AUTH && $this->isLdapUser($db->Field("userName"))) {
$toReturn['generated'] = "";
$this->info['msg'] = Utils::translate('email.user.not.match');
} else {
if ($db->Field("userName") == $info['username']) {
$toReturn['match'] = true;
}
$toReturn['generated'] = Utils::generatePassword(6, true, true, false);
}
} else {
$toReturn['generated'] = "";
$this->info['msg'] = Utils::translate('email.user.not.match');
}
$db->Close();
return $toReturn;
}
示例3: date
$mail->To($info['email']);
$mail->From(__EMAIL__);
$mail->Body($confirmationMsg);
$mail->Send();
$user->changePassword($info['email'], $generateInfo['generated']);
$toReturn->set("success", "true");
$toReturn->set("message", Utils::translate('passwordChanged'));
} else {
// confirmation link
$data = date('Y-m-d H:i:s');
$template = new Template("./templates/" . __LANGUAGE__ . "/confirmRecover.html");
$id = base64_encode($info['email'] . "|" . $data . "|recover|" . $generateInfo['generated']);
$link = "<a href='" . __BASE_URL__ . "oxygen-webhelp/resources/confirm.html?id={$id}'>" . __BASE_URL__ . "oxygen-webhelp/resources/confirm.html?id={$id}</a>";
$confirmationMsg = $template->replace(array("product" => $info['product'], "link" => $link, "productName" => $productTranslate));
$mail = new Mail();
$mail->Subject("[" . $productTranslate . "] " . Utils::translate('RecoverConfirmationEmailSubject'));
$mail->To($info['email']);
$mail->From(__EMAIL__);
$mail->Body($confirmationMsg);
$mail->Send();
$toReturn->set("success", "true");
$toReturn->set("message", Utils::translate('confirmationRequired'));
}
}
//echo "Success";
} else {
$toReturn->set("success", "false");
$toReturn->set("message", Utils::translate('noEmailSpecified'));
//echo "Invalid recovery data!";
}
echo $toReturn;
示例4: listForPage
/**
* List all commments for a specified page
*
* @param array $info containing the page, product, version, userId
* @param int $refId referenced comment
* @param boolean $isForAdmin
* @return String html output
*
*/
function listForPage($info, $refId = -1, $isForAdmin = FALSE)
{
$toReturn = "";
$page = $info['page'];
$product = $info['product'];
$version = $info['version'];
$idUser = $info['userId'];
$db = new RecordSet($this->dbConnectionInfo);
$paramVersion = $this->getMinimVersion($product);
$isAnonimous = $this->isAnonymous($idUser);
$sql = "SELECT c.*,u.userName name \n\t\t\tFROM comments c,users u \n\t\t\tWHERE c.visible='true' \n\t\t\tAND u.userId=c.userId \n\t\t\tAND c.version<='" . $version . "' \n\t\t\tAND c.version>='{$paramVersion}'";
if ($isAnonimous) {
$sql .= " AND c.state!='new'";
}
// if (!$isForAdmin){
// $sql.=" AND c.state!='rejected'";
// }
if ($refId > 0) {
$sql .= " AND referedComment={$refId}";
} else {
if (defined('__SHARE_WITH__')) {
$productSelect = "(product='{$product}' OR product in (" . __SHARE_WITH__ . "))";
} else {
$productSelect = "product='{$product}'";
}
$sql .= " AND page='{$page}' AND {$productSelect} AND referedComment=0";
}
// $sql.=" AND c.state!='rejected'";
$sql .= " ORDER BY date ASC";
if ($db->Open($sql)) {
$toReturn .= "<ul class='{$this->cssClass}'>";
while ($db->MoveNext()) {
$parent = $db->Field('commentId');
if ($db->Field('userId') == $idUser && $db->Field('state') == 'new' || $isForAdmin || $db->Field('state') == 'approved') {
$toReturn .= "<li id=\"" . $parent . "\"><a name=\"{$parent}\"></a>";
$query = "SELECT * FROM comments WHERE visible='true' AND referedComment={$parent} AND version<='" . $version . "' AND version>='{$paramVersion}' ";
$mustModerate = false;
$toReturn .= "<div id=\"c_" . $parent . "\" class=\"liContent\">";
if ($idUser == $db->Field('userId') && $db->Field('state') == 'new' && !$isForAdmin) {
$mustModerate = true;
$toReturn .= "<div class=\"mustBeModerate\">";
if (!$this->isAnonymous($idUser)) {
$toReturn .= "<div class=\"actions\">";
$toReturn .= "<input type='button' class='bt_delete' title='Delete' onclick='showConfirmDeleteDialog(" . $parent . ")' value='" . Utils::translate("delete") . "'>";
$toReturn .= "<input type='button' class='bt_edit' title='Edit' onclick='editPost(" . $parent . ")' value='" . Utils::translate("edit") . "'>";
$toReturn .= "</div>";
}
}
if ($db->Field('state') == 'suspended') {
$toReturn .= "<div class=\"suspended\">";
}
$toReturn .= "<div class=\"head\">";
$db1 = new RecordSet($this->dbConnectionInfo);
$drill = false;
if ($db->Field('state') == 'approved') {
if ($db1->Open($query)) {
$drill = true;
}
}
if ($drill) {
$toReturn .= "<span class=\"minus\" id=\"toggle_{$parent}\" onclick='toggleReply({$parent});'/>";
}
$toReturn .= "<div class='name'>" . $db->Field('name') . "</div>";
if ($isForAdmin) {
$toReturn .= "<div class='bt_admin'>";
$toReturn .= "<span class='commentState'>";
$toReturn .= Utils::translate($db->Field("state"));
$toReturn .= "</span>";
$toReturn .= "<div class=\"actions\">";
if ($db->Field("state") != "approved") {
$toReturn .= "<input type='button' class='bt_delete' title='Delete' onclick='showConfirmDeleteDialog(" . $parent . ")' value='" . Utils::translate("delete") . "'>";
$toReturn .= "<input type='button' class='bt_edit' title='Edit' onclick='editPost(" . $parent . ")' value='" . Utils::translate("edit") . "'>";
$toReturn .= "<input type='button' class='bt_approve' title='Approve' onclick='moderatePost(" . $parent . ",\"approved\")' value='" . Utils::translate("approve") . "'>";
} else {
if ($db->Field("state") == "approved") {
$toReturn .= "<input type='button' class='bt_delete' title='Delete' onclick='showConfirmDeleteDialog(" . $parent . ")' value='" . Utils::translate("delete") . "'>";
$toReturn .= "<input type='button' class='bt_edit' title='Edit' onclick='editPost(" . $parent . ")' value='" . Utils::translate("edit") . "'>";
//$toReturn.="<span class='bt_suspend' title='Suspend' onclick='moderatePost(".$parent.",\"suspended\")'>".Utils::translate("suspend")."</span>";
}
}
$toReturn .= "</div>";
$toReturn .= "</div>";
$toReturn .= "<div class='version'>(v " . $db->Field('version') . ")</div>";
$toReturn .= "<div class='product'>" . $db->Field('product') . "</div>";
}
$toReturn .= "<div class='date'>" . $db->Field('date') . "</div>";
$toReturn .= "</div>";
if ($this->isAnonymous($idUser) && $mustModerate) {
$toReturn .= "<div class=\"content\" id=\"cmt_text_" . $parent . "\">" . Utils::translate('unavailableTextTillApproved') . "</div>";
} else {
$toReturn .= "<div class=\"content\" id=\"cmt_text_" . $parent . "\">" . $db->Field('text') . "</div>";
//.........这里部分代码省略.........
示例5: Template
$template = new Template("./templates/" . __LANGUAGE__ . "/recover.html");
$confirmationMsg = $template->replace(array("username" => $userName, "password" => $newPassword, "productName" => $productTranslate));
//
// $confirmationMsg = "Your generated password form username '".$userName."' is '".$newPassword."'";
// $confirmationMsg.="<br/>Thank you !";
$mail = new Mail();
$mail->Subject("[" . $productTranslate . "] " . $translate['RecoveredEmailSubject']);
$mail->To($email);
$mail->From(__EMAIL__);
$mail->Body($confirmationMsg);
$mail->Send();
$toReturn->set("error", false);
$toReturn->set("msg", Utils::translate('passwordChanged'));
} else {
$toReturn->set("error", true);
$toReturn->set("msg", Utils::translate("signUp.invalidPswd"));
}
} else {
// echo print_r($_SESSION,false);
if ($user->confirmUser($id)) {
$pName = isset($_POST['productName']) ? $_POST['productName'] : "";
$pVersion = isset($_POST['productVersion']) ? $_POST['productVersion'] : "";
$fullUser = base64_encode($pName . "_" . $pVersion . "_user");
$ses = Session::getInstance();
$ses->{$fullUser} = $user;
// echo print_r($_SESSION,false);
// echo $user->msg;
$toReturn->set("error", false);
$toReturn->set("msg", $user->msg);
} else {
$toReturn->set("error", true);
示例6: foreach
if (count($vList) > 0) {
$idx = 0;
$toPrint .= "<div class='listTitle'>" . Utils::translate("productsListTitle") . "</div>";
$toPrint .= "<div class='listTitleV'>" . Utils::translate("versionsListTitle") . "</div>";
$toPrint .= "<div class='products'>";
foreach ($vList as $origProduct => $versions) {
$product = $origProduct;
$toPrint .= "<div class='p_selectable' id='p_{$idx}' onclick=\"showVersions('{$idx}','{$product}');\">" . $product . "</div>";
$idx++;
}
$toPrint .= "</div>";
$toPrint .= "<div class='versions' style='display:none;'>";
$idx = 0;
foreach ($vList as $origProduct => $versions) {
$toPrint .= "<div class='product_Versions' id='v_{$idx}' style='display:none;'>";
$vidx = 0;
foreach ($versions as $version) {
$toPrint .= "<div id='ver_" . $idx . "_" . $vidx . "' class='selectable' onclick=\"setExpVersion(this,'{$version}');\">" . $version . "</div>";
$vidx++;
}
$toPrint .= "</div>";
$idx++;
}
$toPrint .= "</div>";
} else {
$toPrint .= "<div class='listTitle'>" . Utils::translate("info.noComments") . "</div>";
}
echo $toPrint;
} else {
echo "No data to query!";
}
示例7: User
$user = new User($dbConnectionInfo);
$return = $user->insertNewUser($info);
if ($return->error == "true") {
echo $return;
} else {
$id = base64_encode($user->userId . "|" . $user->date);
$link = "<a href='" . __BASE_URL__ . "oxygen-webhelp/resources/confirm.html?id={$id}'>" . __BASE_URL__ . "oxygen-webhelp/resources/confirm.html?id={$id}</a>";
$template = new Template("./templates/signUp.html");
$productTranslate = defined("__PRODUCT_NAME__") ? __PRODUCT_NAME__ : $_POST['product'];
$arrayProducts = $user->getSharedProducts();
$products = "";
foreach ($arrayProducts as $productId => $productName) {
$products .= "\"" . $productName . "\" ";
}
$confirmationMsg = $template->replace(array("name" => $info['name'], "username" => $info['username'], "confirmationLink" => $link, "productName" => $productTranslate, "products" => $products));
$mail = new Mail();
$mail->Subject("[" . $productTranslate . "] " . Utils::translate('signUpEmailSubject'));
$mail->To($info['email']);
$mail->From(__EMAIL__);
$mail->Body($confirmationMsg);
$mail->Send();
$json->set("error", "false");
$json->set("msg", "SignUp Success");
echo $json;
}
} else {
$json->set("error", "true");
$json->set("errorCode", "6");
$json->set("msg", "Invalid username!");
echo $json;
}
示例8: moderateComment
function moderateComment($id, $action, $fullUser)
{
global $dbConnectionInfo;
$toReturn = "";
$act = false;
if ($action == "approved") {
$act = true;
}
$cmt = new Comment($dbConnectionInfo, "", $fullUser);
$return = $cmt->moderate($id, $action);
$toReturn = $return['page'];
if ($return['page'] != "" && $act && $return['oldState'] == 'new') {
// notify users
$user = new User($dbConnectionInfo);
$usersToNotify = $user->getUsersToNotify($toReturn, $id);
$cmtInfo = $cmt->getInfo($id);
$productTranslate = defined("__PRODUCT_NAME__") ? __PRODUCT_NAME__ : $cmtInfo['product'];
$template = new Template("./templates/newComment.html");
$confirmationMsg = $template->replace(array("page" => __BASE_URL__ . $toReturn . "#" . $id, "text" => $cmtInfo['text'], "user" => $cmtInfo['name'], "productName" => $productTranslate));
foreach ($usersToNotify as $key => $value) {
$mail = new Mail();
$subject = "[" . $productTranslate . "] " . Utils::translate('newCommentApproved');
$subject .= " [" . $toReturn . "]";
$mail->Subject($subject);
$mail->To($value);
$mail->From(__EMAIL__);
$mail->Body($confirmationMsg);
$mail->Send();
//$toReturn = "\nSEND to ".$value."user email='".$userEmail."'";
}
}
return $toReturn;
}
示例9: JsonResponse
$info['userId'] = $_POST['userId'];
} else {
$info['editByAdmin'] = false;
}
$err = $ses->{$fullUser}->updateProfile($info);
if ($err != "") {
$toReturn->set("msgType", "info");
$toReturn->set("msg", $err);
echo $toReturn;
} else {
$toReturn->set("updated", "true");
echo $toReturn;
}
} else {
$toReturn->set("msgClass", "error");
$toReturn->set("msg", Utils::translate("err.notLoggedIn"));
echo $toReturn;
}
} else {
if (isset($_POST['select']) && trim($_POST['select']) != '') {
$toReturn = new JsonResponse();
$pName = isset($_POST['product']) ? $_POST['product'] : "";
$pVersion = isset($_POST['version']) ? $_POST['version'] : "";
$fullUser = base64_encode($pName . "_" . $pVersion . "_user");
$ses = Session::getInstance();
if (isset($ses->{$fullUser})) {
$delim = $_POST['delimiter'];
$user = $ses->{$fullUser};
$toReturn->set("isLogged", "true");
$toReturn->set("name", $user->name);
$toReturn->set("email", $user->email);
示例10: getTags
static function getTags($id, $limit)
{
$sql = "\n\t SELECT *\n\t FROM tbl_tag_relations tr, tbl_tags t\n\t WHERE tr.tag_id = t.id\n\t AND tr.game_id = '{$id}'\n\t GROUP BY tr.id\n\t ";
$limit > 0 ? $sql .= " LIMIT {$limit}" : $sql;
$result = Query::query($sql) or die(mysql_error());
$spc = 0;
while ($get_tags = $result->fetch_array()) {
if ($spc == 0) {
$spc = 1;
} else {
echo ' ';
}
echo Utils::translate($get_tags['tag_name'], "tag");
}
}
示例11: LinkCellRenderer
$cellRenderer = new LinkCellRenderer($baserUrl);
$cellRenderer->addLinkToField("page");
if ($clean == 'true') {
$cellRenderer = null;
$filter = new ExistingPageFilter(__BASE_DIR__, 'page');
} else {
$filter = new MissingPageFilter(__BASE_DIR__, 'page');
}
$exporter = new InLineExporter('commentId', array('commentId'), array(45, 24, 16, 7));
$exporter->setFilter($filter);
$exporter->setCellRenderer($cellRenderer);
$comment->exportForPage($info, $exporter, array('commentId', 'text', 'page', 'date', 'state'));
if ($exporter->getContent() != "") {
echo $exporter->getContent();
} else {
echo Utils::translate("noDataAvailable");
}
} else {
$exporter = new XmlExporter("comments");
$comment->exportForPage($info, $exporter);
header('Content-Description: File Transfer');
header('Content-Type: text/xml');
header('Content-Disposition: attachment; filename=comments_' . $fName . '_' . $fVersion . '.xml');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
ob_clean();
flush();
echo $exporter->getContent();
exit;
示例12: exportRow
/**
* Export one row
* @param Array $AssociativeRowArray - array containing fieldName=>fieldValue
*/
function exportRow($AssociativeRowArray)
{
if (!$this->filter->filter($AssociativeRowArray)) {
$this->hasLines = true;
$width = 20;
if ($this->rows == 0) {
$this->toReturn .= "<tr class=\"tbHRow\">";
$column = 0;
foreach ($AssociativeRowArray as $field => $value) {
if (!in_array($field, $this->ignoredFields)) {
if ($this->columnSizes != null) {
if ($this->columnSizes[$column]) {
$width = $this->columnSizes[$column];
} else {
$width = 11;
}
}
$this->toReturn .= "<td class=\"tbCell\" style=\"width:{$width}%;\">" . Utils::translate("label.tc." . $field) . "</td>";
$column++;
}
}
if ($this->columnSizes != null) {
$width = $this->columnSizes[count($this->columnSizes) - 1];
}
$this->toReturn .= "<td class=\"tbCell\" style=\"width:{$width}%;\">" . Utils::translate("selected") . "</td>";
$this->toReturn .= "</tr>";
}
$this->rows++;
$this->toReturn .= "<tr class=\"tbRow\">";
$column = 0;
$id = -1;
foreach ($AssociativeRowArray as $field => $value) {
$this->rows++;
if ($field == $this->idField) {
$id = $value;
if ($this->cellRenderer != null) {
$this->cellRenderer->setAName($id);
}
}
if (!in_array($field, $this->ignoredFields)) {
if ($this->columnSizes != null) {
if ($this->columnSizes[$column]) {
$width = $this->columnSizes[$column];
} else {
$width = 11;
}
}
$renderedValue = $value;
if ($this->cellRenderer != null) {
$renderedValue = $this->cellRenderer->render($field, $value);
}
$this->toReturn .= "<td class=\"tbCell\" style=\"width:{$width}%;\">" . $renderedValue . "</td>";
$column++;
}
}
$this->toReturn .= "<td class=\"tbCell\"><input type=\"checkbox\" class=\"cb-element\" value=\"{$id}\" onclick=\"addToDelete({$id});\"/></td>";
$this->toReturn .= "</tr>";
} else {
// row filtered
}
}
示例13: Copyright
Copyright (c) 1998-2015 Syncro Soft SRL, Romania. All rights reserved.
Licensed under the terms stated in the license file EULA_Webhelp.txt
available in the base directory of this Oxygen Webhelp plugin.
*/
require_once 'init.php';
if (isset($_POST["qInfo"]) && trim($_POST["qInfo"]) != "" && $_POST["qInfo"] == "true") {
$pName = isset($_POST['productName']) ? $_POST['productName'] : "";
$pVersion = isset($_POST['productVersion']) ? $_POST['productVersion'] : "";
$fullUser = base64_encode($pName . "_" . $pVersion . "_user");
$comment = new Comment($dbConnectionInfo, "", $fullUser);
$vList = $comment->queryInfo();
$toPrint = "";
if (count($vList) > 0) {
$idx = 0;
$toPrint .= "<div class='listTitle'>" . Utils::translate("productsListTitle") . "</div>";
$toPrint .= "<div class='listTitleV'>" . Utils::translate("versionsListTitle") . "</div>";
$toPrint .= "<div class='products'>";
foreach ($vList as $origProduct => $versions) {
$product = $origProduct;
$toPrint .= "<div class='p_selectable' id='p_{$idx}' onclick=\"showVersions('{$idx}','" . addslashes($product) . "');\">" . $product . "</div>";
$idx++;
}
$toPrint .= "</div>";
$toPrint .= "<div class='versions' style='display:none;'>";
$idx = 0;
foreach ($vList as $origProduct => $versions) {
$toPrint .= "<div class='product_Versions' id='v_{$idx}' style='display:none;'>";
$vidx = 0;
foreach ($versions as $version) {
$toPrint .= "<div id='ver_" . $idx . "_" . $vidx . "' class='selectable' onclick=\"setExpVersion(this,'" . addslashes($version) . "');\">" . $version . "</div>";
$vidx++;