本文整理汇总了PHP中__gettext函数的典型用法代码示例。如果您正苦于以下问题:PHP __gettext函数的具体用法?PHP __gettext怎么用?PHP __gettext使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了__gettext函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: viewfolder
function viewfolder($folderid, $userid, $level, $selected = -1)
{
$prefix = "";
for ($i = 0; $i < $level; $i++) {
$prefix .= ">";
}
$fileprefix = $prefix . ">";
$folders = get_records_select('file_folders', "files_owner = ? AND parent = ?", array($userid, $folderid));
if ($folderid == -1) {
$body = "<option value=\"-1\" ";
if ($selected == -1) {
$body .= "selected = \"selected\"";
}
$root = __gettext("Root");
$body .= ">{$root}</option>";
} else {
$current_folder = get_record('file_folders', 'files_owner', $userid, 'ident', $folderid);
$name = stripslashes($current_folder->name);
$ident = $current_folder->ident;
if ($ident == $selected) {
$selectstring = "selected=\"selected\"";
} else {
$selectstring = "";
}
$body = <<<END
<option value="{$ident}" {$selectstring} >{$prefix} {$name} </option>
END;
}
if (!empty($folders)) {
foreach ($folders as $folder) {
$body .= viewfolder($folder->ident, $userid, $level + 1, $selected);
}
}
return $body;
}
示例2: admin_pagesetup
function admin_pagesetup()
{
global $PAGE, $CFG;
/*
if (isadmin()) {
$PAGE->menu_top [] = array( 'name' => 'admin',
//'html' => a_href("{$CFG->wwwroot}_admin/",
// "Administration"));
'html' => "<li><a href=\"" . $CFG->wwwroot . "mod/admin/\">" . __gettext("Administration") . "</a></li>");
}
*/
if (defined("context") && context == "account") {
$PAGE->menu_sub[] = array('name' => 'user:edit', 'html' => a_href("{$CFG->wwwroot}_userdetails/", __gettext("Edit user details")));
/*$PAGE->menu_sub[] = array (
'name' => 'user:icon',
'html' => a_href("{$CFG->wwwroot}_icons/",__gettext("Your site picture")));*/
}
if (defined("context") && context == "admin" && isloggedin() && user_flag_get("admin", $_SESSION['userid'])) {
$PAGE->menu_sub[] = array('name' => 'admin', 'html' => a_href(get_url(-1, 'admin::main'), __gettext("Main")));
$PAGE->menu_sub[] = array('name' => 'admin:users:add', 'html' => a_href(get_url(-1, 'admin::users::add'), __gettext("Add users")));
$PAGE->menu_sub[] = array('name' => 'admin:users', 'html' => a_href(get_url(-1, 'admin::users'), __gettext("Manage users")));
$PAGE->menu_sub[] = array('name' => 'admin:users:banned', 'html' => a_href(get_url(-1, 'admin::users::banned'), __gettext("Banned users")));
$PAGE->menu_sub[] = array('name' => 'admin:users:admin', 'html' => a_href(get_url(-1, 'admin::users::admin'), __gettext("Admin users")));
$PAGE->menu_sub[] = array('name' => 'admin:flags', 'html' => a_href(get_url(-1, 'admin::flags'), __gettext("Manage flagged content")));
$PAGE->menu_sub[] = array('name' => 'admin:spam', 'html' => a_href(get_url(-1, 'admin::spam'), __gettext("Spam control")));
}
}
示例3: friend_pagesetup
function friend_pagesetup()
{
// register links --
global $profile_id;
global $PAGE;
global $CFG;
global $metatags;
require_once dirname(__FILE__) . "/default_template.php";
require_once dirname(__FILE__) . "/lib/friends_config.php";
$metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/friend/css.css\" type=\"text/css\" media=\"screen\" />";
$page_owner = $profile_id;
if (isloggedin()) {
if (defined("context") && context == "network" && $page_owner == $_SESSION['userid']) {
$PAGE->menu[] = array('name' => 'friends', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/friends/\" class=\"selected\" >" . __gettext("Contacts") . '</a></li>');
} else {
$PAGE->menu[] = array('name' => 'friends', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/friends/\" >" . __gettext("Contacts") . '</a></li>');
}
}
if (defined("context") && context == "network") {
if (user_type($page_owner) == "person" || user_type($page_owner) == "external") {
$friends_username = user_info('username', $page_owner);
$PAGE->menu_sub[] = array('name' => 'friend', 'html' => a_href("{$CFG->wwwroot}{$friends_username}/friends/", __gettext("My friends")));
/*$PAGE->menu_sub[] = array( 'name' => 'friend:of',
'html' => a_href( "{$CFG->wwwroot}{$friends_username}/friendsof/",
__gettext("Friend of")));*/
if (isloggedin() && $page_owner == $_SESSION['userid']) {
$PAGE->menu_sub[] = array('name' => 'friend:requests', 'html' => a_href("{$CFG->wwwroot}{$friends_username}/friends/requests", __gettext("Friendship requests")));
}
if (FRIENDS_FOAF) {
$PAGE->menu_sub[] = array('name' => 'friend:foaf', 'html' => a_href("{$CFG->wwwroot}{$friends_username}/foaf/", __gettext("FOAF")));
}
}
}
}
示例4: messages_pagesetup
function messages_pagesetup()
{
// register links --
global $profile_id, $PAGE, $CFG, $metatags, $function, $USER;
$pgowner = $profile_id;
require_once $CFG->dirroot . "mod/messages/lib/messages_config.php";
require_once $CFG->dirroot . "mod/messages/default_template.php";
if (isloggedin() && user_info("user_type", $_SESSION['userid']) != "external") {
// Add the JavaScript functions
// Lose the trailing slash
$url = substr($CFG->wwwroot, 0, -1);
$metatags .= "<script language=\"javascript\" type=\"text/javascript\" src=\"{$url}/mod/messages/messages.js\"></script>";
$metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/messages/css.css\" type=\"text/css\" media=\"screen\" />";
$messages = count_records_select('messages', 'to_id=' . $USER->ident . " AND status='unread'");
if (defined("context") && context == "messages" && $pgowner == $_SESSION['userid']) {
$PAGE->menu[] = array('name' => 'messages', 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/" class="selected">' . __gettext("Messages") . " ({$messages})" . '</a></li>');
} else {
$PAGE->menu[] = array('name' => 'messages', 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("Messages") . " ({$messages})" . '</a></li>');
}
if (profile_permissions_check("profile") && defined("context") && context == "messages") {
if (user_type($pgowner) == "person") {
$PAGE->menu_sub[] = array('name' => 'messages:list', 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("View Messages") . '</a>');
$PAGE->menu_sub[] = array('name' => 'messages:compose', 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/compose">' . __gettext("Compose") . '</a>');
$PAGE->menu_sub[] = array('name' => 'messages:sent', 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/sent">' . __gettext("Sent Messages") . '</a>');
}
}
}
}
示例5: elggadmin_pagesetup
function elggadmin_pagesetup()
{
// first login?
global $CFG;
if (user_flag_get('admin', $_SESSION['userid']) && !isset($CFG->elggadmin_installed)) {
$CFG->elggadmin_installed = true;
set_config('elggadmin_installed', true);
header_redirect(get_url(null, 'elggadmin::config'), __gettext('Welcome to the Elgg configuration manager!'));
}
if (context() == 'admin') {
if (!plugin_is_loaded('pages')) {
elgg_messages_add(__gettext('Error: <code>elggadmin</code> plugin needs <code>pages</code> plugin to run'));
} else {
pages_submenu_add('elggadmin', __gettext('Site administration'), get_url(null, 'elggadmin::'), 10);
}
} elseif (context() == 'elggadmin') {
if (!plugin_is_loaded('pages')) {
elgg_messages_add(__gettext('Error: <code>elggadmin</code> plugin needs <code>pages</code> plugin to run'));
header_redirect(get_url(null, 'admin::'));
}
// submenu options
pages_submenu_add('elggadmin', __gettext('Configuration manager'), get_url(null, 'elggadmin::'));
pages_submenu_add('elggadmin:theme', __gettext('Default theme editor'), get_url(null, 'elggadmin::theme'));
pages_submenu_add('elggadmin:frontpage', __gettext('Frontpage template editor'), get_url(null, 'elggadmin::frontpage'));
pages_submenu_add('elggadmin:logs', __gettext('Error log'), get_url(null, 'elggadmin::logs'));
sidebar_add(50, 'sidebar-' . elggadmin_currentpage(), elggadmin_sidebar());
// clear sidebar
$clear_sidebar[] = 'sidebar-profile';
$clear_sidebar[] = 'sidebar-' . elggadmin_currentpage();
sidebar_remove($clear_sidebar, true);
if (elggadmin_is_404()) {
header('HTTP/1.0 404 Not Found');
}
}
}
示例6: GetXMLTreeProfile
function GetXMLTreeProfile($xmlloc)
{
if (file_exists($xmlloc)) {
$data = implode('', file($xmlloc));
} else {
$fp = fopen($xmlloc, 'r');
$data = fread($fp, 100000000);
fclose($fp);
}
$data = preg_replace("/<knows>.*<\\/knows>/is", "", $data);
$parser = xml_parser_create('UTF-8');
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
xml_parse_into_struct($parser, $data, $vals, $index);
xml_parser_free($parser);
$code = xml_get_error_code($parser);
if ($code != XML_ERROR_NONE) {
global $messages;
$messages[] = __gettext("XML error: ") . xml_error_string($code);
}
$tree = array();
$i = 0;
if (isset($vals[$i]['attributes'])) {
$tree[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes'];
$index = count($tree[$vals[$i]['tag']]) - 1;
$tree[$vals[$i]['tag']][$index] = array_merge($tree[$vals[$i]['tag']][$index], GetChildren($vals, $i));
} else {
$tree[$vals[$i]['tag']][] = GetChildren($vals, $i);
}
return $tree;
}
示例7: invite_pagesetup
function invite_pagesetup()
{
global $PAGE;
if (defined('context') && context == 'network' && isloggedin()) {
if (!maxusers_limit()) {
$PAGE->menu_sub[] = array('name' => 'invite:friend', 'html' => a_href(get_url(null, 'invite::invite'), __gettext("Invite a friend")));
}
}
}
示例8: template_pagesetup
function template_pagesetup()
{
// register links --
global $profile_id;
global $PAGE;
global $CFG;
$page_owner = $profile_id;
if (defined("context") && context == "account" && !$CFG->disable_templatechanging && user_info("user_type", $_SESSION['userid']) != "external") {
if ($page_owner == $_SESSION['userid'] && $page_owner != -1) {
$PAGE->menu_sub[] = array('name' => 'template:change', 'html' => a_href("{$CFG->wwwroot}mod/template/", __gettext("Change theme")));
}
}
$CFG->templates->variables_substitute['templatesroot'][] = "templates_root";
}
示例9: a_home_pagesetup
function a_home_pagesetup()
{
// register links --
global $profile_id;
global $PAGE;
global $CFG;
$page_owner = $profile_id;
$rss_username = user_info('username', $page_owner);
define("home", $context);
if (isloggedin()) {
if (defined("context") && context == "home" && $page_owner == $_SESSION['userid']) {
$PAGE->menu[] = array('name' => 'home', 'html' => "<li><a href=\"{$CFG->wwwroot}/ \" class=\"selected\" >" . __gettext("Home") . '</a></li>');
} else {
$PAGE->menu[] = array('name' => 'home', 'html' => "<li><a href=\"{$CFG->wwwroot} \" >" . __gettext("Home") . '</a></li>');
}
}
}
示例10: contenttoolbar_widget_display
function contenttoolbar_widget_display($widget)
{
global $CFG;
$video_url = widget_get_data("video_url", $widget->ident);
$video_width = widget_get_data("video_width", $widget->ident);
$video_height = widget_get_data("video_height", $widget->ident);
$embedpattern = "/<embed[\\w\\s\"=;:.&\\?\\/-]*>\\s*<\\/embed>/";
$urlpattern = "/(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?\"/";
preg_match($embedpattern, $video_url, $embed);
if (empty($embed)) {
$body = __gettext("Invalid video param edit an check that if is a valid <embed> object.");
} else {
preg_match($urlpattern, $video_url, $url);
$video_url = substr($url[0], 0, -1);
$body = run("video:text:process", "{{video:{$video_url}}}");
}
return array('title' => "", 'content' => $body);
}
示例11: profile_photo_display_output_field
function profile_photo_display_output_field($parameter)
{
global $CFG, $profile_id;
$html = '';
if ($parameter[1] == "profile_photo") {
if (!empty($parameter[4]) && $parameter[0] != "photo") {
$html .= "<img class=\"profile-photo\" src=\"{$CFG->wwwroot}mod/profile_photo/img.php?id={$parameter[4]}&constraint1=w&size1=250\" alt=\"Profile photo\" />";
} else {
$pictureglyph = __gettext("Click here to upload a photo");
$html = <<<END
</p>
<style type="text/css">
div#default-profile-icon {
width:250px;
height:200px;
background:url({$CFG->wwwroot}mod/profile_photo/default.gif) no-repeat;
position:relative;
}
div#default-profile-icon p {
position:absolute;
top:150px;
right:40px;
margin:0;
padding:0;
color:#fff;
}
div#default-profile-icon p a {
text-decoration:underline;
color:#fff;
}
</style>
<div id="default-profile-icon">
<p><a href="{$CFG->wwwroot}profile/edit.php?profile_id={$profile_id}">{$pictureglyph}</a></p>
</div>
<p>
END;
}
}
return $html;
}
示例12: deleteMessage
/**
* Deletes the specified message
* @param int $msg Message id
* @param int $user Current user id
* @param boolean $sent If the message its a sent message or not
*/
function deleteMessage($msg, $user, $sent = 0)
{
global $messages;
if ($msg_info = get_record('messages', 'ident', $msg)) {
if ($sent) {
$msg_info->hidden_from = '1';
} else {
$msg_info->hidden_to = '1';
}
$msg_info->status = "read";
update_record('messages', $msg_info);
if ($msg_info->hidden_from && $msg_info->hidden_to) {
delete_records('messages', 'ident', $msg);
}
$messages[] = __gettext("The selected message was deleted.");
} else {
$messages[] = __gettext("The message ID its not valid!.");
}
return $sent;
}
示例13: toolbar_searchbox
function toolbar_searchbox($vars)
{
global $CFG;
$all = __gettext("all");
$people = __gettext("People");
$communities = __gettext("Communities");
$tagcloud = __gettext("Tag cloud");
$browse = __gettext("Browse");
//$searchdefault = __gettext("Search");
$go = __gettext("Search");
$searchbox = <<<END
<div id="search-header"><!-- open search-header div -->
<form id="searchform" action="{$CFG->wwwroot}search/index.php" method="get">
<p><input type="text" size="20" name="tag" value="{$searchdefault}" onclick="if (this.value=='{$searchdefault}') { this.value='' }" />
<input type="submit" value={$go} />
</form>
</div><!-- close search-header div -->
END;
return $searchbox;
}
示例14: execute_sql
/**
* Execute a given sql command string
*
* Completely general function - it just runs some SQL and reports success.
*
* @uses $db
* @param string $command The sql string you wish to be executed.
* @param bool $feedback Set this argument to true if the results generated should be printed. Default is true.
* @return string
*/
function execute_sql($command, $feedback = true)
{
/// Completely general function - it just runs some SQL and reports success.
global $db, $CFG;
$olddebug = $db->debug;
if (!$feedback) {
$db->debug = false;
}
if (defined('ELGG_PERFDB')) {
global $PERF;
$PERF->dbqueries++;
}
$result = $db->Execute($command);
$db->debug = $olddebug;
if ($result) {
// elggcache_purge(); // TODO - should probably be here, given function can do anything, but very inefficient
if ($feedback && $CFG->debug > 7) {
notify(__gettext('Success'), 'notifysuccess');
}
return true;
} else {
if ($feedback) {
echo '<p><span class="error">' . __gettext('Error') . '</span></p>';
}
if (!empty($CFG->dblogerror)) {
$debug = debug_backtrace();
foreach ($debug as $d) {
if (strpos($d['file'], 'datalib') === false) {
error_log("SQL " . $db->ErrorMsg() . " in {$d['file']} on line {$d['line']}. STATEMENT: {$command}");
break;
}
}
}
return false;
}
}
示例15: sprintf
<?php
global $CFG;
$descOne = sprintf(__gettext("Access controls let you control exactly who sees everything you upload to %s, including files, blog posts and profile items."), $CFG->sitename);
$descTwo = __gettext("This screen lets you create new access controls. To get started, add a new access control by typing in its name below.");
$run_result .= <<<END
<p>{$descOne}</p>
<p>{$descTwo}</p>
END
;