本文整理汇总了PHP中tr函数的典型用法代码示例。如果您正苦于以下问题:PHP tr函数的具体用法?PHP tr怎么用?PHP tr使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wikiplugin_trackerstat_info
function wikiplugin_trackerstat_info()
{
return array('name' => tra('Tracker Stats'), 'documentation' => 'PluginTrackerStat', 'description' => tra('Display statistics about a tracker.'), 'prefs' => array('feature_trackers', 'wikiplugin_trackerstat'), 'body' => tra('Title'), 'iconname' => 'chart', 'introduced' => 2, 'params' => array('trackerId' => array('required' => true, 'name' => tra('Tracker ID'), 'description' => tra('Numeric value representing the tracker ID'), 'since' => '2.0', 'filter' => 'digits', 'default' => '', 'profile_reference' => 'tracker'), 'fields' => array('required' => false, 'name' => tra('Fields'), 'description' => tra('Colon-separated list of field IDs to be displayed. Example:') . ' <code>2:4:5</code>' . tra('. ') . tra('Leave it empty to display all fields from this tracker.'), 'since' => '2.0', 'default' => '', 'separator' => ':', 'profile_reference' => 'tracker_field'), 'show_count' => array('required' => false, 'name' => tra('Show Count'), 'description' => tra('Choose whether to show the count of votes each option received (shown by default)'), 'since' => '10.3', 'filter' => 'alpha', 'default' => 'y', 'options' => array(array('text' => '', 'value' => ''), array('text' => tra('Yes'), 'value' => 'y'), array('text' => tra('No'), 'value' => 'n'))), 'show_percent' => array('required' => false, 'name' => tra('Show Percentage'), 'description' => tra('Choose whether to show the percentage of the vote each option received (not shown
by default)'), 'since' => '2.0', 'filter' => 'alpha', 'default' => 'n', 'options' => array(array('text' => '', 'value' => ''), array('text' => tra('Yes'), 'value' => 'y'), array('text' => tra('No'), 'value' => 'n'))), 'show_bar' => array('required' => false, 'name' => tra('Show Bar'), 'description' => tra('Choose whether to show a bar representing the number of votes each option received
(not shown by default)'), 'since' => '2.0', 'filter' => 'alpha', 'default' => 'n', 'options' => array(array('text' => '', 'value' => ''), array('text' => tra('Yes'), 'value' => 'y'), array('text' => tra('No'), 'value' => 'n'))), 'status' => array('required' => false, 'name' => tra('Status Filter'), 'description' => tra('Only show items matching certain status filters'), 'since' => '2.0', 'filter' => 'alpha', 'default' => 'o', 'options' => array(array('text' => '', 'value' => ''), array('text' => tra('Open'), 'value' => 'o'), array('text' => tra('Pending'), 'value' => 'p'), array('text' => tra('Closed'), 'value' => 'c'), array('text' => tra('Open & Pending'), 'value' => 'op'), array('text' => tra('Open & Closed'), 'value' => 'oc'), array('text' => tra('Pending & Closed'), 'value' => 'pc'), array('text' => tra('Open, Pending & Closed'), 'value' => 'opc'))), 'show_link' => array('required' => false, 'name' => tra('Show Link'), 'description' => tra('Add a link to the tracker'), 'since' => '3.0', 'filter' => 'alpha', 'default' => 'n', 'options' => array(array('text' => '', 'value' => ''), array('text' => tra('Yes'), 'value' => 'y'), array('text' => tra('No'), 'value' => 'n'))), 'show_lastmodif' => array('required' => false, 'name' => tra('Last Modification Date'), 'description' => tr('Show last modification date of a tracker. Set to Yes (%0) to use site setting for
the short date format or use PHP\'s format (www.php.net/strftime). Example:', '<code>y</code>', '<code>%A %d of %B, %Y</code>'), 'since' => '5.0', 'filter' => 'text', 'default' => '')));
}
示例2: smarty_function_favorite
function smarty_function_favorite($params, $smarty)
{
global $prefs, $user;
// Disabled, do nothing
if (empty($user) || $prefs['user_favorites'] != 'y') {
return;
}
$servicelib = TikiLib::lib('service');
$smarty = TikiLib::lib('smarty');
$smarty->loadPlugin('smarty_modifier_escape');
$url = $servicelib->getUrl(array('controller' => 'favorite', 'action' => 'toggle', 'type' => $params['type'], 'object' => $params['object']));
$url = smarty_modifier_escape($url, 'url');
$e_user = smarty_modifier_escape($user);
if (isset($params['label'])) {
$label = $params['label'];
} else {
$label = tr('Favorite');
}
if (isset($params['button_classes'])) {
$button_classes = $params['button_classes'];
} else {
$button_classes = "btn btn-default";
}
return '<a class="' . $button_classes . ' favorite-toggle" href="' . $url . '" data-key="favorite_' . $e_user . '"> ' . $label . '</a>';
}
示例3: iconset_orange
function iconset_orange()
{
/* This and themes/fivealive-lite/options/orange/icons/information.png are
* just a demo of how to override an icon in a theme option
* probably should be removed before release? */
return array('name' => tr('Theme icons'), 'description' => tr('Icons to be used for this theme'), 'tag' => 'span', 'icons' => array('information' => array('id' => 'eye')));
}
示例4: gen_reseller_table
/**
* @todo check if it's useful to have the table admin two times in the same query
* @param EasySCP_TemplateEngine $tpl
*/
function gen_reseller_table($tpl)
{
$cfg = EasySCP_Registry::get('Config');
$sql = EasySCP_Registry::get('Db');
$query = "\n\t\tSELECT\n\t\t\tt1.`admin_id`, t1.`admin_name`, t2.`admin_name` AS created_by\n\t\tFROM\n\t\t\t`admin` AS t1,\n\t\t\t`admin` AS t2\n\t\tWHERE\n\t\t\tt1.`admin_type` = 'reseller'\n\t\tAND\n\t\t\tt1.`created_by` = t2.`admin_id`\n\t\tORDER BY\n\t\t\t`created_by`,\n\t\t\t`admin_id`\n\t";
$rs = exec_query($sql, $query);
$i = 0;
if ($rs->recordCount() == 0) {
set_page_message(tr('Reseller list is empty!'), 'info');
} else {
while (!$rs->EOF) {
$admin_id = $rs->fields['admin_id'];
$admin_id_var_name = "admin_id_" . $admin_id;
$tpl->append(array('NUMBER' => $i + 1, 'RESELLER_NAME' => tohtml($rs->fields['admin_name']), 'OWNER' => tohtml($rs->fields['created_by']), 'CKB_NAME' => $admin_id_var_name));
$rs->moveNext();
$i++;
}
$tpl->assign('PAGE_MESSAGE', '');
}
$query = "\n\t\tSELECT\n\t\t\t`admin_id`, `admin_name`\n\t\tFROM\n\t\t\t`admin`\n\t\tWHERE\n\t\t\t`admin_type` = 'admin'\n\t\tORDER BY\n\t\t\t`admin_name`\n\t";
$rs = exec_query($sql, $query);
while (!$rs->EOF) {
if (isset($_POST['uaction']) && $_POST['uaction'] === 'reseller_owner' && (isset($_POST['dest_admin']) && $_POST['dest_admin'] == $rs->fields['admin_id'])) {
$selected = $cfg->HTML_SELECTED;
} else {
$selected = '';
}
$tpl->append(array('OPTION' => tohtml($rs->fields['admin_name']), 'VALUE' => $rs->fields['admin_id'], 'SELECTED' => $selected));
$rs->moveNext();
}
$tpl->assign('PAGE_MESSAGE', '');
}
示例5: module_forums_last_posts_info
function module_forums_last_posts_info()
{
return array(
'name' => tra('Newest Forum Posts'),
'description' => tra('Displays the latest forum posts.'),
'prefs' => array('feature_forums'),
'params' => array(
'topics' => array(
'name' => tra('Topics only'),
'description' => tra('If set to "y", only displays topics.') . " " . tr('Not set by default.')
),
'forumId' => array(
'name' => tra('List of forum identifiers'),
'description' => tra('If set to a list of forum identifiers, restricts the posts to those in the identified forums. Identifiers are separated by colons (":").') . " " . tra('Example values:') . '"13", "31:49". ' . tra('Not set by default.'),
'separator' => ':'
),
'date' => array(
'name' => tra('Show date'),
'description' => tra('If set to "y", show post date directly instead of as tooltip.') . ' ' . tra('Default:') . ' n',
),
'author' => array(
'name' => tra('Show author'),
'description' => tra('If set to "y", show post author directly instead of as tooltip.') . ' ' . tra('Default:') . ' n',
),
),
'common_params' => array('nonums', 'rows')
);
}
示例6: smarty_function_error_report
function smarty_function_error_report($params, $smarty)
{
$errorreportlib = TikiLib::lib('errorreport');
$errors = $errorreportlib->get_errors();
$pre = '<div id="error_report">';
$post = '</div>';
TikiLib::lib('header')->add_js('
$("#error_report").ajaxComplete(function (e, jqxhr) {
var error = jqxhr.getResponseHeader("X-Tiki-Error");
if (error) {
if ($("ul", this).length === 0) {
$(this).append($(error)[0].childNodes);
} else {
$("ul", this).append($(error).find("li"));
}
}
});
$("#error_report .clear").live("click", function () {
$("#error_report").empty();
return false;
});
');
if (count($errors)) {
$smarty->loadPlugin('smarty_block_remarksbox');
$repeat = false;
return $pre . smarty_block_remarksbox(array('type' => 'errors', 'title' => tra('Error(s)')), '<a class="clear" style="float: right;" href="#">' . tr('Clear errors') . '</a><ul><li>' . implode('</li><li>', $errors) . '</li></ul>', $smarty, $repeat) . $post;
} else {
return $pre . $post;
}
}
示例7: wikiplugin_adjustinventory
function wikiplugin_adjustinventory($data, $params)
{
if (!isset($params['add'])) {
$params['add'] = 'y';
}
if (!isset($params['subtract'])) {
$params['subtract'] = 'y';
}
$smarty = TikiLib::lib('smarty');
$smarty->assign('code', $params['code']);
$smarty->assign('add', $params['add']);
$smarty->assign('subtract', $params['subtract']);
$form = $smarty->fetch('wiki-plugins/wikiplugin_adjustinventory.tpl');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
global $jitPost;
$access = TikiLib::lib('access');
$add_quantity = $jitPost->add_quantity->int();
$subtract_quantity = $jitPost->subtract_quantity->int();
$quantity = $add_quantity - $subtract_quantity;
if ($jitPost->code->text() == $params['code'] && $quantity != 0) {
$cartlib = TikiLib::lib('cart');
$cartlib->change_inventory($params['code'], $quantity);
}
$access->redirect($_SERVER['REQUEST_URI'], tr('Inventory was adjusted by %0', $quantity));
}
return $form;
}
示例8: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('Importing tracker...');
$lib = \TikiLib::lib('tabular');
$info = $lib->getInfo($input->getArgument('tabularId'));
$perms = \Perms::get('tabular', $info['tabularId']);
if (!$info || !$perms->tabular_import) {
throw new \Exception('Tracker Import: Tabular Format not found');
}
$fileName = $input->getArgument('filename');
if (!file_exists($fileName)) {
throw new \Exception('Tracker Import: File not found');
}
// from \Services_Tracker_TabularController::getSchema TODO refactor?
$tracker = \Tracker_Definition::get($info['trackerId']);
if (!$tracker) {
throw new \Exception('Tracker Import: Tracker not found');
}
$schema = new \Tracker\Tabular\Schema($tracker);
$schema->loadFormatDescriptor($info['format_descriptor']);
$schema->loadFilterDescriptor($info['filter_descriptor']);
$schema->validate();
if (!$schema->getPrimaryKey()) {
throw new \Exception(tr('Primary Key required'));
}
// this will throw exceptions and not return if there's a problem
$source = new \Tracker\Tabular\Source\CsvSource($schema, $fileName);
$writer = new \Tracker\Tabular\Writer\TrackerWriter();
$writer->write($source);
$output->writeln('Import done');
return 0;
}
示例9: __get
/**
* {@inheritdoc}
*/
public function __get($field)
{
if (isset($this->_fields[$field])) {
return $this->_fields[$field];
}
throw new InvalidPropertyException(tr('Invalid property: %1', $field));
}
示例10: scheduleBackupRestoration
/**
* Schedule backup restoration.
*
* @param int $userId Customer unique identifier
* @return void
*/
function scheduleBackupRestoration($userId)
{
exec_query("UPDATE `domain` SET `domain_status` = ? WHERE `domain_admin_id` = ?", array('torestore', $userId));
send_request();
write_log($_SESSION['user_logged'] . ": scheduled backup restoration.", E_USER_NOTICE);
set_page_message(tr('Backup has been successfully scheduled for restoration.'), 'success');
}
示例11: smarty_modifier_userlink
/**
* \brief Smarty modifier plugin to create user links with optional mouseover info
*
* - type: modifier
* - name: userlink
* - purpose: to return a user link
*
* @author
* @param string class (optional)
* @param string idletime (optional)
* @param string fullname (optional)
* @param integer max_length (optional)
* @return string user link
*
* Syntax: {$foo|userlink[:"<class>"][:"<idletime>"][:"<fullname>"][:<max_length>]} (optional params in brackets)
*
* Example: {$userinfo.login|userlink:'link':::25}
*/
function smarty_modifier_userlink($other_user, $class = 'userlink', $idletime = 'not_set', $fullname = '', $max_length = 0, $popup = 'y')
{
if (empty($other_user)) {
return "";
}
if (is_array($other_user)) {
if (count($other_user) > 1) {
$other_user = array_map(function ($username) use($class, $idletime, $popup) {
return smarty_modifier_userlink($username, $class, $idletime, '', 0, $popup);
}, $other_user);
$last = array_pop($other_user);
return tr('%0 and %1', implode(', ', $other_user), $last);
} else {
$other_user = reset($other_user);
}
}
if (!$fullname) {
$fullname = TikiLib::lib('user')->clean_user($other_user);
}
if ($max_length) {
TikiLib::lib('smarty')->loadPlugin('smarty_modifier_truncate');
$fullname = smarty_modifier_truncate($fullname, $max_length, '...', true);
}
if ($popup === 'y') {
return TikiLib::lib('user')->build_userinfo_tag($other_user, $fullname, $class);
} else {
return $fullname;
}
}
示例12: wikiplugin_mail_info
function wikiplugin_mail_info()
{
global $prefs;
return array('name' => tra('Mail'), 'documentation' => 'PluginMail', 'description' => tra('Mail other users or groups'), 'validate' => 'all', 'prefs' => array('wikiplugin_mail'), 'iconname' => 'envelope', 'introduced' => 3, 'params' => array('group' => array('required' => false, 'name' => tra('Group'), 'description' => tra('Limit the list of groups to the groups including each group'), 'filter' => 'groupname', 'since' => '5.0', 'default' => '', 'separator' => ':'), 'showgroupdd' => array('required' => false, 'name' => tra('Group Dropdown'), 'description' => tra('Show a dropdown list of groups (not shown by default)'), 'since' => '5.0', 'filter' => 'alpha', 'default' => 'n', 'options' => array(array('text' => '', 'value' => ''), array('text' => tra('Yes'), 'value' => 'y'), array('text' => tra('No'), 'value' => 'n'))), 'recurse' => array('required' => false, 'name' => tra('Recurse Groups'), 'description' => tra('Show each group and each group included in this group'), 'since' => '8.0', 'filter' => 'alpha', 'default' => 'y', 'options' => array(array('text' => '', 'value' => ''), array('text' => tra('Yes'), 'value' => 'y'), array('text' => tra('No'), 'value' => 'n'))), 'recurseuser' => array('required' => false, 'name' => tra('Recurse Group Users'), 'description' => tr('Indicate how many times to recurse to collect the users of a selected group and
the users of each included groups. If %00%1 do not recurse, if %01%1, recurse one time, %02%1 for
two times....', '<code>', '</code>'), 'since' => '8.0', 'filter' => 'int', 'default' => '0'), 'showuserdd' => array('required' => false, 'name' => tra('User Dropdown'), 'description' => tra('Show a dropdown list of users (not shown by default)'), 'since' => '5.0', 'filter' => 'alpha', 'default' => 'n', 'options' => array(array('text' => '', 'value' => ''), array('text' => tra('Yes'), 'value' => 'y'), array('text' => tra('No'), 'value' => 'n'))), 'showuser' => array('required' => false, 'name' => tra('User Emails'), 'description' => tra('Show a box for user to enter email addresses'), 'since' => '5.0', 'filter' => 'alpha', 'default' => 'y', 'options' => array(array('text' => '', 'value' => ''), array('text' => tra('Yes'), 'value' => 'y'), array('text' => tra('No'), 'value' => 'n'))), 'showrealnamedd' => array('required' => false, 'name' => tra('Real Name Dropdown'), 'description' => tra('Show a dropdown list of user real names (not shown by default)'), 'since' => '5.0', 'filter' => 'alpha', 'default' => 'n', 'options' => array(array('text' => '', 'value' => ''), array('text' => tra('Yes'), 'value' => 'y'), array('text' => tra('No'), 'value' => 'n'))), 'popup' => array('required' => false, 'name' => tra('Popup'), 'description' => tra('Show in popup instead of inline.'), 'since' => '14.0', 'filter' => 'alpha', 'default' => 'n', 'options' => array(array('text' => '', 'value' => ''), array('text' => tra('Yes'), 'value' => 'y'), array('text' => tra('No'), 'value' => 'n'))), 'label_name' => array('required' => false, 'name' => tra('Button Text'), 'description' => tr('Text to show on the button to send emails (default: %0Send mail%1)', '<code>', '</code>'), 'since' => '14.0', 'filter' => 'text', 'default' => tra('Send mail')), 'mail_subject' => array('required' => true, 'name' => tra('Email Subject'), 'description' => tra('Present Email subject content'), 'since' => '14.0', 'filter' => 'text', 'default' => ''), 'bypass_preview' => array('required' => false, 'name' => tra('Bypass Preview'), 'description' => tra('Send emails without first previewing'), 'since' => '14.0', 'filter' => 'alpha', 'default' => 'n', 'options' => array(array('text' => '', 'value' => ''), array('text' => tra('Yes'), 'value' => 'y'), array('text' => tra('No'), 'value' => 'n'))), 'debug' => array('required' => false, 'name' => tra('Debug mode (admins only)'), 'description' => tra('Show list of emails that are sent (admins only)'), 'since' => '14.0', 'filter' => 'alpha', 'default' => 'n', 'options' => array(array('text' => '', 'value' => ''), array('text' => tra('Yes'), 'value' => 'y'), array('text' => tra('No'), 'value' => 'n')))));
}
示例13: getLanguage
function getLanguage($type, $object)
{
$lang = null;
switch ($type) {
case 'wiki page':
$info = TikiLib::lib('tiki')->get_page_info($object);
$lang = $info['lang'];
break;
case 'article':
$info = TikiLib::lib('art')->get_article($object);
$lang = $info['lang'];
break;
case 'trackeritem':
$info = TikiLib::lib('trk')->get_tracker_item($object);
$definition = Tracker_Definition::get($info['trackerId']);
if ($field = $definition->getLanguageField()) {
$lang = $info[$field];
}
break;
case 'forum post':
$object = TikiLib::lib('comments')->get_comment_forum_id($object);
// no break: drop through to forum
// no break: drop through to forum
case 'forum':
$info = TikiLib::lib('comments')->get_forum($object);
$lang = $info['forumLanguage'];
break;
}
if (!$lang) {
throw new Services_Exception(tr('Object has no language and cannot be translated'), 400);
}
return $lang;
}
示例14: css_edit_raw
function css_edit_raw()
{
global $event, $step;
$default_name = safe_field('css', 'txp_section', "name = 'default'");
extract(gpsa(array('name', 'newname', 'copy', 'savenew')));
if ($step == 'css_delete' || empty($name) && $step != 'pour' && !$savenew) {
$name = $default_name;
} elseif (($copy || $savenew) && trim(preg_replace('/[<>&"\']/', '', $newname))) {
$name = $newname;
}
if (empty($name)) {
$buttons = '<div class="edit-title">' . gTxt('name_for_this_style') . ': ' . fInput('text', 'newname', '', 'edit', '', '', 20) . hInput('savenew', 'savenew') . '</div>';
$thecss = gps('css');
} else {
$buttons = '<div class="edit-title">' . gTxt('you_are_editing_css') . sp . strong(htmlspecialchars($name)) . '</div>';
$thecss = fetch("css", 'txp_css', 'name', $name);
}
if (!empty($name)) {
$copy = '<span class="copy-as"><label for="copy-css">' . gTxt('copy_css_as') . '</label>' . sp . fInput('text', 'newname', '', 'edit', '', '', '', '', 'copy-css') . sp . fInput('submit', 'copy', gTxt('copy'), 'smallerbox') . '</span>';
} else {
$copy = '';
}
$right = '<div id="content_switcher">' . hed(gTxt('all_stylesheets'), 2) . graf(sLink('css', 'pour', gTxt('create_new_css')), ' class="action-create smallerbox"') . css_list($name, $default_name) . '</div>';
echo '<div id="' . $event . '_container" class="txp-container txp-edit">' . startTable('edit') . tr(td(form('<div id="main_content">' . $buttons . '<textarea id="css" class="code" name="css" cols="78" rows="32">' . htmlspecialchars($thecss) . '</textarea>' . br . fInput('submit', '', gTxt('save'), 'publish') . eInput('css') . sInput('css_save') . hInput('name', $name) . $copy . '</div>', '', '', 'post', 'edit-form', '', 'style_form'), '', 'column') . tdtl($right, ' class="column"')) . endTable() . '</div>';
}
示例15: padd_group
function padd_group($tpl, $sql, $dmn_id)
{
$cfg = EasySCP_Registry::get('Config');
if (isset($_POST['uaction']) && $_POST['uaction'] == 'add_group') {
// we have to add the group
if (isset($_POST['groupname'])) {
if (!validates_username($_POST['groupname'])) {
set_page_message(tr('Invalid group name!'), 'warning');
return;
}
$groupname = $_POST['groupname'];
$query = "\n\t\t\t\tSELECT\n\t\t\t\t\t`id`\n\t\t\t\tFROM\n\t\t\t\t\t`htaccess_groups`\n\t\t\t\tWHERE\n\t\t\t\t\t`ugroup` = ?\n\t\t\t\tAND\n\t\t\t\t\t`dmn_id` = ?\n\t\t\t";
$rs = exec_query($sql, $query, array($groupname, $dmn_id));
if ($rs->recordCount() == 0) {
$change_status = $cfg->ITEM_ADD_STATUS;
$query = "\n\t\t\t\t\tINSERT INTO `htaccess_groups`\n\t\t\t\t\t\t(`dmn_id`, `ugroup`, `status`)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t(?, ?, ?)\n\t\t\t\t";
exec_query($sql, $query, array($dmn_id, $groupname, $change_status));
send_request();
$admin_login = $_SESSION['user_logged'];
write_log("{$admin_login}: add group (protected areas): {$groupname}");
user_goto('protected_user_manage.php');
} else {
set_page_message(tr('Group already exists!'), 'error');
return;
}
} else {
set_page_message(tr('Invalid group name!'), 'error');
return;
}
} else {
return;
}
}