本文整理汇总了PHP中translate_with_context函数的典型用法代码示例。如果您正苦于以下问题:PHP translate_with_context函数的具体用法?PHP translate_with_context怎么用?PHP translate_with_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了translate_with_context函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __wp_supercustom_cms_get_all_user_roles_names
/**
* __wp_supercustom_cms_get_all_user_roles_names() - Returns an array with all user roles_names in it.
* Inclusive self defined roles (for example with the 'Role Manager' plugin).
* @uses $wp_roles
* @return $user_roles_names
*/
function __wp_supercustom_cms_get_all_user_roles_names()
{
global $wp_roles;
$user_roles_names = array();
foreach ($wp_roles->role_names as $role_name => $data) {
if (function_exists('translate_user_role')) {
$data = translate_user_role($data);
} else {
$data = translate_with_context($data);
}
array_push($user_roles_names, $data);
}
return $user_roles_names;
}
开发者ID:nishant368,项目名称:newlifeoffice-new,代码行数:20,代码来源:__wp_supercustom_cms_user_info.php
示例2: unset
}
}
unset($users_of_blog);
$current_role = false;
$class = empty($role) ? ' class="current"' : '';
$role_links[] = "<li><a href='users.php'{$class}>" . sprintf(__ngettext('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users), number_format_i18n($total_users)) . '</a>';
foreach ($wp_roles->get_names() as $this_role => $name) {
if (!isset($avail_roles[$this_role])) {
continue;
}
$class = '';
if ($this_role == $role) {
$current_role = $role;
$class = ' class="current"';
}
$name = translate_with_context($name);
$name = sprintf(_c('%1$s <span class="count">(%2$s)</span>|user role with count'), $name, $avail_roles[$this_role]);
$role_links[] = "<li><a href='users.php?role={$this_role}'{$class}>{$name}</a>";
}
echo implode(" |</li>\n", $role_links) . '</li>';
unset($role_links);
?>
</ul>
</form>
</div>
<form class="search-form" action="" method="get">
<p class="search-box">
<label class="hidden" for="user-search-input"><?php
_e('Search Users');
?>
开发者ID:blowery,项目名称:wordpress,代码行数:31,代码来源:users.php
示例3: WP_members_list_list
function WP_members_list_list()
{
global $wp_roles, $getWP, $tern_wp_msg, $tern_wp_members_defaults, $current_user, $notice;
get_currentuserinfo();
$o = $getWP->getOption('tern_wp_members', $tern_wp_members_defaults);
$wps = new WP_User_Search($_GET['query'], $_GET['userspage'], $_GET['role']);
$paging_text = paginate_links(array('total' => ceil($wps->total_users_for_query / $wps->users_per_page), 'current' => $wps->page, 'base' => 'admin.php?page=members-list-edit-members-list&%_%', 'format' => 'userspage=%#%', 'add_args' => $args));
if ($paging_text) {
$paging_text = sprintf('<span class="displaying-num">' . __('Displaying %s–%s of %s') . '</span>%s', number_format_i18n(($wps->page - 1) * $wps->users_per_page + 1), number_format_i18n(min($wps->page * $wps->users_per_page, $wps->total_users_for_query)), number_format_i18n($wps->total_users_for_query), $paging_text);
}
?>
<div class="wrap">
<div id="icon-users" class="icon32"><br /></div>
<h2>Members List</h2>
<?php
if (!empty($notice)) {
?>
<div id="notice" class="error"><p><?php
echo $notice;
?>
</p></div><?php
}
?>
<p>Here you are able to select which of your members you'd like to show or hide in your members list. By default all members are showm.</p>
<?php
if (!empty($tern_wp_msg)) {
echo '<div id="message" class="updated fade"><p>' . $tern_wp_msg . '</p></div>';
}
?>
<div class="filter">
<form id="list-filter" action="" method="get">
<ul class="subsubsub">
<?php
$l = array();
$a = array();
$u = get_users_of_blog();
$t = count($u);
foreach ((array) $u as $c) {
$d = unserialize($c->meta_value);
foreach ((array) $d as $e => $v) {
if (!isset($a[$e])) {
$a[$e] = 0;
}
$a[$e]++;
}
}
unset($u);
$current_role = false;
$class = empty($role) ? ' class="current"' : '';
$l[] = "<li><a href='admin.php?page=members-list-edit-members-list'{$class}>" . sprintf(__ngettext('All<span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $t), number_format_i18n($t)) . '</a>';
foreach ($wp_roles->get_names() as $s => $name) {
if (!isset($a[$s])) {
continue;
}
$class = '';
if ($s == $role) {
$current_role = $role;
$class = ' class="current"';
}
$name = translate_with_context($name);
$name = sprintf(_c('%1$s <span class="count">(%2$s)</span>|user role with count'), $name, $a[$s]);
$l[] = "<li><a href='admin.php?page=members-list-edit-members-list&role={$s}'{$class}>{$name}</a>";
}
echo implode(" |</li>\n", $l) . '</li>';
unset($l);
?>
</ul>
</form>
</div>
<form class="search-form" action="" method="get">
<p class="search-box">
<label class="hidden" for="user-search-input">Search Users:</label>
<input type="text" class="search-input" id="user-search-input" name="query" value="" />
<input type="hidden" id="page" name="page" value="<?php
echo $_REQUEST['page'];
?>
" />
<input type="submit" value="Search Users" class="button" />
</p>
</form>
<form id="posts-filter" action="" method="get">
<div class="tablenav">
<?php
if ($wps->results_are_paged()) {
?>
<div class="tablenav-pages"><?php
echo $paging_text;
?>
</div>
<?php
}
?>
<div class="alignleft actions">
<select name="action">
<option value="" selected="selected">Bulk Actions</option>
<option value="show">Show</option>
<option value="hide">Hide</option>
</select>
<input type="submit" value="Apply" name="doaction" id="doaction" class="button-secondary action" />
</div>
//.........这里部分代码省略.........
开发者ID:oligoform,项目名称:WP-Members-Lists,代码行数:101,代码来源:list.php
示例4: wp_dropdown_roles
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $default
*/
function wp_dropdown_roles( $default = false ) {
global $wp_roles;
$p = '';
$r = '';
foreach( $wp_roles->role_names as $role => $name ) {
$name = translate_with_context($name);
if ( $default == $role ) // Make default first in list
$p = "\n\t<option selected='selected' value='$role'>$name</option>";
else
$r .= "\n\t<option value='$role'>$name</option>";
}
echo $p . $r;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:20,代码来源:template.php
示例5: _c
/**
* Retrieve context translated string.
*
* Quite a few times, there will be collisions with similar translatable text
* found in more than two places but with different translated context.
*
* In order to use the separate contexts, the _c() function is used and the
* translatable string uses a pipe ('|') which has the context the string is in.
*
* When the translated string is returned, it is everything before the pipe, not
* including the pipe character. If there is no pipe in the translated text then
* everything is returned.
*
* @since 2.2.0
*
* @param string $text Text to translate
* @param string $domain Optional. Domain to retrieve the translated text
* @return string Translated context string without pipe
*/
function _c($text, $domain = 'default')
{
return translate_with_context($text, $domain);
}
开发者ID:nitzanb,项目名称:letseat,代码行数:23,代码来源:l10n.php
示例6: wp_super_edit_user_management_ui
/**
* Display user management interfaces based on options.
*/
function wp_super_edit_user_management_ui()
{
global $wp_roles, $wp_super_edit;
switch ($wp_super_edit->management_mode) {
case 'single':
$user_management_text = __('This arrangement of visual editor buttons will apply to all users');
break;
case 'roles':
$user_management_text = __('The arrangement of visual editor buttons will apply to all users in the selected Role or Default user button setting.<br />');
$roles = array();
$roles['wp_super_edit_default'] = __('Default Button Settings');
foreach ($wp_roles->role_names as $role => $name) {
$name = translate_with_context($name);
$roles[$role] = $name;
if ($_REQUEST['wp_super_edit_manage_role'] == $role || $_REQUEST['wp_super_edit_user'] == $role) {
$selected = $role;
}
}
$role_select = wp_super_edit_form_select('wp_super_edit_manage_role', $roles, $selected, true);
$submit_button = wp_super_edit_submit_button(__('Load Button Settings'), '', true);
$submit_button_group = wp_super_edit_html_tag(array('tag' => 'p', 'tag_content' => __('Select User Role to Edit: ') . $role_select . $submit_button, 'return' => true));
$user_management_text .= wp_super_edit_form('role_select', $submit_button_group, true, 'submitButtonConfig();');
break;
case 'users':
$user_management_text = __('Users can arrange buttons under the Users tab. Changes to this button arrangement will only affect the defult button settings.');
break;
default:
break;
}
$user_management_text = '<strong>' . $wp_super_edit->management_modes[$wp_super_edit->management_mode] . ':</strong> ' . $user_management_text;
wp_super_edit_html_tag(array('tag' => 'div', 'id' => 'wp_super_edit_user_management', 'tag_content' => $user_management_text));
}
开发者ID:howardlei82,项目名称:IGSM-Website,代码行数:35,代码来源:wp-super-edit-admin.php
示例7: foreach
<th scope="col" class="manage-column column-name" style="">Name</th>
<th scope="col" class="manage-column column-email" style="">E-mail</th>
<th scope="col" class="manage-column column-role" style="">Role</th>
<th scope="col" class="manage-column column-role" style=""><input type="submit" name="reset_explicit_edit" value="reset explicit" class="button-secondary" style="padding: 3px 5px"/></th>
<th scope="col" class="manage-column column-role" style=""><input type="submit" name="reset_explicit_php" value="reset explicit" class="button-secondary" style="padding: 3px 5px"/></th>
</tr>
</tfoot>
<tbody id="users" class="list:user user-list">
<?php
$editOtherConflict = false;
foreach ($search->get_results() as $id) {
$user = new WP_User($id);
$role = $user->roles[0];
$roleName = isset($wp_roles->role_names[$role]) ? translate_with_context($wp_roles->role_names[$role]) : __('None');
$user_has_php_cap = $php_exec_admin->item_has_cap($user, PHP_EXECUTION_CAPABILITY);
$php_is_explicit_cap = $php_exec_admin->is_explicit_cap($user, PHP_EXECUTION_CAPABILITY);
$user_has_edit_cap = $php_exec_admin->item_has_either_caps($user, $EDIT_CAPS);
$edit_is_explicit_cap = $php_exec_admin->user_has_either_role_caps($user, $EDIT_CAPS);
$edit_is_explicit_cap = $user_has_edit_cap != $edit_is_explicit_cap;
switch (true) {
// no permission inherited from role
case !$php_is_explicit_cap && !$user_has_php_cap:
$permission = '<img src="' . PHP_EXECUTION_BASE_URL . '/assets/cross.png" /> <input type="submit" name="userPHP[' . $id . ']" value="enable" class="button-secondary"/> ';
break;
// no permission explicitly set
// no permission explicitly set
case $php_is_explicit_cap && !$user_has_php_cap:
$permission = '<img src="' . PHP_EXECUTION_BASE_URL . '/assets/delete.png" /> <input type="submit" name="userPHP[' . $id . ']" value="enable" class="button-secondary"/> ';
break;
开发者ID:ahsaeldin,项目名称:projects,代码行数:31,代码来源:php_execution_admin.php
示例8: wpmuLdapAddGenRoleBox
function wpmuLdapAddGenRoleBox($id)
{
global $wp_roles;
echo '<select name="user[' . $id . ']" id="' . $id . '">';
foreach ($wp_roles->role_names as $role => $name) {
$name = translate_with_context($name);
$selected = '';
if ($role == 'subscriber') {
$selected = 'selected="selected"';
}
echo "<option {$selected} value=\"{$role}\">{$name}</option>";
}
echo '</select>';
}
开发者ID:alexandreaguiar,项目名称:wpmu-ldap-auth,代码行数:14,代码来源:wpmu_ldap_adduser.functions.php
示例9: groupe_role_option
function groupe_role_option($disible = false)
{
global $wp_roles, $xoops_db;
if ($disible) {
$disible_str = ' disabled="disabled"';
} else {
$disible_str = '';
}
$form = '';
$form .= '<tr><th><label for="role">' . __('Role Setting at Login', 'xpressme') . '</label></th>';
$form .= '<td>';
$form .= "<table>\n";
$form .= "<tr>\n";
if (xpress_is_multiblog_root()) {
$form .= "<td>" . __('XOOPS administrators role is set as all blog administrators.', 'xpressme') . "</td>\n";
$form .= "<td>\n";
$form .= $this->yes_no_radio_option_sub('admin_set_all_blog_admin', __('YES', 'xpressme'), __('NO', 'xpressme'));
$form .= "</td>\n";
$form .= "</tr>\n";
}
$form .= '<tr><td>' . __('XOOPS Groupe', 'xpressme') . '</td><td>' . __('WordPress Role', 'xpressme') . '</td><td>' . __('Role is set at each login', 'xpressme') . "</td></tr>\n";
foreach ($this->groupe_role as $groupe) {
if ($groupe->group_type == 'module_inhibit') {
$form .= "<tr>";
$form .= "<td> {$groupe->name} </td>";
$form .= "<td>" . __('module cannot be read', 'xpressme') . "</td>";
$form .= "</tr>\n";
continue;
}
$form .= "<tr>";
$form .= "<td> {$groupe->name} </td>";
$form .= "<td>\n" . '<select name="role_gid_' . $groupe->groupid . '" id="role_gid_' . $groupe->groupid . '"' . $disible_str . '>' . "\n";
$role_list = '';
$group_has_role = false;
$select_value = $groupe->role;
foreach ($wp_roles->role_names as $role => $name) {
if (function_exists('translate_user_role')) {
$name = translate_user_role($name);
} else {
$name = translate_with_context($name);
}
if ($role == $select_value) {
$selected = ' selected="selected"';
$group_has_role = true;
} else {
$selected = '';
}
$admin_select_role = $this->admin_select_groupe_role();
if ($admin_select_role || $groupe->group_type != 'module_admin' || !empty($selected)) {
$role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>\n";
}
if (!$admin_select_role && $groupe->group_type == 'module_admin') {
if ($role == 'administrator') {
$role_list .= "<option value=\"{$role}\" selected=\"selected\">{$name}</option>\n";
}
}
}
if ($this->admin_select_groupe_role() || $groupe->group_type != 'module_admin') {
if ($group_has_role) {
$role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
$role_list .= '<option value="">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
} else {
if ($select_value == 'default') {
$role_list .= '<option value="default" selected="selected">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
$role_list .= '<option value="">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
} else {
$role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
$role_list .= '<option value="" selected="selected">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
}
}
}
$form .= $role_list . "</select>\n</td>";
if ($groupe->login_all) {
$form .= '<td> <input type="checkbox" name="login_all_gid_' . $groupe->groupid . '" value="1" checked ></td>';
} else {
$form .= '<td> <input type="checkbox" name="login_all_gid_' . $groupe->groupid . '" value="1"></td>';
}
$form .= "</tr>\n";
}
if ($disible) {
$form .= '<tr><p>' . __('Only the Admin can set Group Role Setting', 'xpressme') . "</p></tr>\n";
}
$form .= "</table></td></tr>\n";
return $form;
}
开发者ID:nouphet,项目名称:rata,代码行数:85,代码来源:xpressme_class.php
示例10: _mw_adminimize_get_all_user_roles_names
/**
* _mw_adminimize_get_all_user_roles_names() - Returns an array with all user roles_names in it.
* Inclusive self defined roles (for example with the 'Role Manager' plugin).
* @uses $wp_roles
* @return $user_roles_names
*/
function _mw_adminimize_get_all_user_roles_names()
{
global $wp_roles;
$user_roles_names = array();
foreach ($wp_roles->role_names as $role_name => $data) {
if (function_exists('translate_user_role')) {
$data = translate_user_role($data);
} else {
$data = translate_with_context($data);
}
array_push($user_roles_names, $data);
}
// exclude the new bbPress roles
$user_roles_names = array_diff($user_roles_names, array(__('Keymaster', 'bbpress'), __('Moderator', 'bbpress'), __('Participant', 'bbpress'), __('Spectator', 'bbpress'), __('Blocked', 'bbpress')));
return $user_roles_names;
}
开发者ID:Nsteinel,项目名称:jmb,代码行数:22,代码来源:adminimize.php
示例11: _e
_e('User Login:');
?>
</th>
<td><input type="text" name="newuser" id="newuser" /></td>
</tr>
<tr>
<th scope="row"><?php
_e('Role:');
?>
</th>
<td>
<select name="new_role" id="new_role">
<?php
reset($editblog_roles);
foreach ($editblog_roles as $role => $role_assoc) {
$name = translate_with_context($role_assoc['name']);
$selected = $role == $editblog_default_role ? 'selected="selected"' : '';
echo "<option {$selected} value=\"{$role}\">{$name}</option>";
}
?>
</select>
</td>
</tr>
</table>
<h3><?php
_e('Misc Blog Actions');
?>
</h3>
<table class="form-table">
<?php
开发者ID:alx,项目名称:blogsfera,代码行数:31,代码来源:wpmu-blogs.php
示例12: register_new_user
/**
* Register new user settings in users database table based on management mode.
* @param string $user_name
*/
function register_new_user($user_name)
{
global $wpdb, $wp_roles, $userdata;
if (!$this->is_installed) {
return false;
}
switch ($this->management_mode) {
case 'single':
return;
case 'roles':
if (isset($wp_roles->role_names[$user_name])) {
if ($this->check_registered('user', $user_name)) {
return;
}
$nice_name = translate_with_context($wp_roles->role_names[$user_name]);
$user_settings = $this->get_user_settings('wp_super_edit_default');
$editor_options = maybe_unserialize($user_settings->editor_options);
$this->register_user_settings($user_name, $nice_name, $editor_options, $this->management_mode);
}
break;
case 'users':
if ($this->check_registered('user', $user_name)) {
return;
}
$user_settings = $this->get_user_settings('wp_super_edit_default');
$editor_options = maybe_unserialize($user_settings->editor_options);
$this->register_user_settings($userdata->user_login, 'user', $editor_options, $this->management_mode);
break;
default:
break;
}
}
开发者ID:howardlei82,项目名称:IGSM-Website,代码行数:36,代码来源:wp-super-edit.admin.class.php
示例13: _c
/**
* Retrieve translated string with vertical bar context
*
* Quite a few times, there will be collisions with similar translatable text
* found in more than two places but with different translated context.
*
* In order to use the separate contexts, the _c() function is used and the
* translatable string uses a pipe ('|') which has the context the string is in.
*
* When the translated string is returned, it is everything before the pipe, not
* including the pipe character. If there is no pipe in the translated text then
* everything is returned.
*
* @since 2.2.0
* @deprecated 2.9.0
*
* @param string $text Text to translate
* @param string $domain Optional. Domain to retrieve the translated text
* @return string Translated context string without pipe
*/
function _c($text, $domain = 'default')
{
_deprecated_function(__FUNCTION__, '2.9', '_x');
return translate_with_context($text, $domain);
}
开发者ID:nagyist,项目名称:laura-wordpress,代码行数:25,代码来源:deprecated.php
示例14: tdomf_show_manage_user_menu
//.........这里部分代码省略.........
<td><input type="checkbox" name="moderateusers[]" value="<?php
echo $u->ID;
?>
" /></td>
<th scope="row"><?php
echo $u->ID;
?>
</th>
<td><a href="edit.php?author=<?php
echo $u->ID;
?>
" ><?php
echo $u->user_login;
?>
</a></td>
<td><a href="user-edit.php?user_id=<?php
echo $u->ID;
?>
" ><?php
echo $u->display_name;
?>
</a></td>
<td>
<?php
if (!isset($wp_roles)) {
$wp_roles = new WP_Roles();
}
$roles = $wp_roles->role_objects;
$userrole = new WP_User($u->ID);
foreach ($roles as $role) {
if ($userrole->has_cap($role->name)) {
if (function_exists('translate_with_context')) {
$user_role = translate_with_context($wp_roles->role_names[$role->name]);
} else {
$user_role = $wp_roles->role_names[$role->name];
}
break;
}
}
?>
<?php
echo $user_role;
?>
</td>
<td>
<?php
if ($userrole->has_cap('edit_others_posts')) {
_e("N/A", "tdomf");
} else {
if (!get_usermeta($u->ID, TDOMF_KEY_STATUS)) {
_e("-", "tdomf");
} else {
_e(get_usermeta($u->ID, TDOMF_KEY_STATUS), "tdomf");
}
}
?>
</td>
<td>
<a href="<?php
tdomf_get_mod_posts_url(array('echo' => true, 'user_id' => $u->ID));
?>
">
开发者ID:TheReaCompany,项目名称:pooplog,代码行数:67,代码来源:tdomf-manage.php
示例15: tdomf_show_form_options
//.........这里部分代码省略.........
if (isset($def_role)) {
?>
<label for="tdomf_access_<?php
echo $def_role;
?>
">
<input value="tdomf_access_<?php
echo $def_role;
?>
" type="checkbox"
name="tdomf_access_<?php
echo $def_role;
?>
" id="tdomf_access_<?php
echo $def_role;
?>
"
<?php
if (isset($wp_roles->role_objects[$def_role]->capabilities[TDOMF_CAPABILITY_CAN_SEE_FORM . '_' . $form_id])) {
?>
checked <?php
}
?>
onClick="tdomf_def_role()"
<?php
if (tdomf_get_option_form(TDOMF_OPTION_ALLOW_EVERYONE, $form_id) != false) {
?>
checked disabled <?php
}
?>
/>
<?php
if (function_exists('translate_with_context')) {
$role_name = translate_with_context($wp_roles->role_names[$def_role]);
} else {
$role_name = $wp_roles->role_names[$def_role];
}
?>
<?php
echo $role_name . " " . __("(newly registered users)");
?>
</label><br/>
<?php
}
?>
<?php
foreach ($access_roles as $role) {
?>
<label for="tdomf_access_<?php
echo $role;
?>
">
<input value="tdomf_access_<?php
echo $role;
?>
" type="checkbox"
name="tdomf_access_<?php
echo $role;
?>
" id="tdomf_access_<?php
echo $role;
?>
"
<?php
开发者ID:TheReaCompany,项目名称:pooplog,代码行数:67,代码来源:tdomf-form-options.php
示例16: wp_dropdown_roles
/**
* Print out <option> html elements for role selectors based on $wp_roles
*
* @package WordPress
* @subpackage Administration
* @since 2.1
*
* @uses $wp_roles
* @param string $default slug for the role that should be already selected
*/
function wp_dropdown_roles($selected = false)
{
global $wp_roles;
$p = '';
$r = '';
$editable_roles = get_editable_roles();
foreach ($editable_roles as $role => $details) {
$name = translate_with_context($details['name']);
if ($selected == $role) {
// Make default first in list
$p = "\n\t<option selected='selected' value='{$role}'>{$name}</option>";
} else {
$r .= "\n\t<option value='{$role}'>{$name}</option>";
}
}
echo $p . $r;
}
开发者ID:blowery,项目名称:wordpress,代码行数:27,代码来源:template.php
注:本文中的translate_with_context函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论