本文整理汇总了PHP中gp_url_current函数的典型用法代码示例。如果您正苦于以下问题:PHP gp_url_current函数的具体用法?PHP gp_url_current怎么用?PHP gp_url_current使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gp_url_current函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugins_loaded
public function plugins_loaded()
{
// Check to see if we're connected via https, if not, redirect.
if (!is_ssl()) {
gp_redirect(gp_url_ssl(gp_url_current()));
}
}
示例2: gp_nav_menu_items
function gp_nav_menu_items($location = 'main')
{
$items = array();
if ('main' === $location) {
$items[gp_url('/projects')] = __('Projects', 'glotpress');
$items[gp_url('/languages')] = __('Locales', 'glotpress');
} elseif ('side' === $location) {
if (is_user_logged_in()) {
$items[gp_url('/profile')] = __('Profile', 'glotpress');
$items[esc_url(wp_logout_url(gp_url_current()))] = __('Log out', 'glotpress');
} else {
$items[esc_url(wp_login_url(gp_url_current()))] = __('Log in', 'glotpress');
}
}
return apply_filters('gp_nav_menu_items', $items, $location);
}
示例3: esc_html
?>
</span>
<span class="user"><?php
echo esc_html($permission->locale_slug);
?>
</span>
<span class="permission-action"><?php
_e('and slug');
?>
</span>
<span class="user"><?php
echo esc_html($permission->set_slug);
?>
</span>
<a href="<?php
echo gp_url_join(gp_url_current(), '-delete/' . $permission->id);
?>
" class="action delete"><?php
_e('Remove');
?>
</a>
</li>
<?php
}
?>
</ul>
<?php
}
?>
<?php
if ($parent_permissions) {
示例4: foreach
<?php
if ($can_write) {
?>
<select name="bulk[priority]" id="bulk-priority">
<?php
foreach (GP::$original->get_static('priorities') as $value => $label) {
$selected = $value == 'normal' ? " selected='selected'" : '';
echo "\t<option value='" . esc_attr($value) . "' {$selected}>" . esc_html($label) . "</option>\n";
}
?>
</select>
<?php
}
?>
<input type="hidden" name="bulk[redirect_to]" value="<?php
echo esc_attr(gp_url_current());
?>
" id="bulk[redirect_to]" />
<input type="hidden" name="bulk[row-ids]" value="" id="bulk[row-ids]" />
<input type="submit" class="button" value="<?php
esc_attr_e('Apply', 'glotpress');
?>
" />
</div>
</form>
<?php
}
echo gp_pagination($page, $per_page, $total_translations_count);
?>
<form id="upper-filters-toolbar" class="filters-toolbar" action="" method="get" accept-charset="utf-8">
<div>
示例5: gp_title
<?php
gp_title(sprintf(__('Branch Project %s < GlotPress', 'glotpress'), $project->name));
gp_breadcrumb_project($project);
gp_tmpl_header();
?>
<h2><?php
echo wptexturize(sprintf(__('Branch project "%s"', 'glotpress'), esc_html($project->name)));
?>
</h2>
<p><?php
_e('Here you can branch out this project: everything will be duplicated into a new project for you.', 'glotpress');
?>
</p>
<form action="<?php
echo esc_url(gp_url_current());
?>
" method="post">
<dt><label for="project[name]"><?php
_e('New branch name', 'glotpress');
?>
</label></dt>
<dd><input type="text" name="project[name]" value="" placeholder="type tag project name here" id="project[name]"></dd>
<!-- TODO: make slug edit WordPress style -->
<dt><label for="project[slug]"><?php
_e('New Slug', 'glotpress');
?>
</label></dt>
<dd>
<input type="text" name="project[slug]" value="" id="project[slug]">
示例6: test_gp_url_current_should_return_non_standard_port_url
function test_gp_url_current_should_return_non_standard_port_url()
{
$server_vars = $_SERVER;
$_SERVER['HTTPS'] = 0;
$_SERVER['HTTP_HOST'] = 'glotpress.org:8888';
$_SERVER['REQUEST_URI'] = '/';
$_SERVER['SERVER_PORT'] = 8888;
$this->assertEquals('http://glotpress.org:8888/', gp_url_current());
$_SERVER = $server_vars;
}
示例7: permissions_post
public function permissions_post($project_path)
{
$project = GP::$project->by_path($project_path);
if (!$project) {
return $this->die_with_404();
}
if ($this->cannot_and_redirect('write', 'project', $project->id)) {
return;
}
if ('add-validator' == gp_post('action')) {
$user = get_user_by('login', gp_post('user_login'));
if (!$user) {
$this->redirect_with_error(__('User wasn’t found!', 'glotpress'), gp_url_current());
return;
}
$new_permission = new GP_Validator_Permission(array('user_id' => $user->ID, 'action' => 'approve', 'project_id' => $project->id, 'locale_slug' => gp_post('locale'), 'set_slug' => gp_post('set-slug')));
if ($this->invalid_and_redirect($new_permission, gp_url_current())) {
return;
}
$permission = GP::$validator_permission->create($new_permission);
$permission ? $this->notices[] = __('Validator was added.', 'glotpress') : ($this->errors[] = __('Error in adding validator.', 'glotpress'));
}
$this->redirect(gp_url_current());
}
示例8: foreach
<tbody>
<?php
foreach ($locales as $locale) {
?>
<tr class="<?php
echo $parity();
?>
">
<?php
echo "<td>" . gp_link_get(gp_url_join(gp_url_current(), $locale->slug), $locale->english_name) . "</td>";
?>
<?php
echo "<td>" . gp_link_get(gp_url_join(gp_url_current(), $locale->slug), $locale->native_name) . "</td>";
?>
<?php
echo "<td>" . gp_link_get(gp_url_join(gp_url_current(), $locale->slug), $locale->slug) . "</td>";
?>
</tr>
<?php
}
?>
</tbody>
</table>
<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function($) {
$('.locales').tablesorter({
headers: {
0: {
sorter: 'text'
}
示例9: esc_html
?>
</td>
<td><?php
echo esc_html($permission->action);
?>
</td>
<td><?php
echo esc_html($permission->locale_slug);
?>
</td>
<td><?php
echo esc_html($permission->set_slug);
?>
</td>
<td><a href="<?php
echo esc_url(gp_route_nonce_url(gp_url_join(gp_url_current(), '-delete/' . $permission->id), 'delete-project-permission_' . $permission->id));
?>
" class="action delete"><?php
_e('Delete', 'glotpress');
?>
</a></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
?>
<?php
示例10: gp_nav_menu_items
function gp_nav_menu_items($location = 'main')
{
$items = array();
if ('main' === $location) {
$items[gp_url('/projects')] = __('Projects', 'glotpress');
$items[gp_url('/languages')] = __('Locales', 'glotpress');
} elseif ('side' === $location) {
if (is_user_logged_in()) {
$items[gp_url('/profile')] = __('Profile', 'glotpress');
$items[esc_url(wp_logout_url(gp_url_current()))] = __('Log out', 'glotpress');
} else {
$items[esc_url(wp_login_url(gp_url_current()))] = __('Log in', 'glotpress');
}
}
/**
* Filter the list of navigation menu items.
*
* @since 1.0.0
*
* @param array $items Menu items. URL as the key, menu label as the value.
* @param string $location Location of the menu.
*/
return apply_filters('gp_nav_menu_items', $items, $location);
}
示例11: permissions_post
function permissions_post($project_path, $locale_slug, $translation_set_slug)
{
$project = GP::$project->by_path($project_path);
$locale = GP_Locales::by_slug($locale_slug);
$translation_set = GP::$translation_set->by_project_id_slug_and_locale($project->id, $translation_set_slug, $locale_slug);
if (!$project || !$locale || !$translation_set) {
gp_tmpl_404();
}
$this->can_or_redirect('write', 'project', $project->id);
if ('add-approver' == gp_post('action')) {
$user = GP::$user->by_login(gp_post('user_login'));
if ($user) {
$res = GP::$permission->create(array('user_id' => $user->id, 'action' => 'approve', 'object_type' => 'translation-set', 'object_id' => $translation_set->id));
$res ? $this->notices[] = 'Validator was added.' : ($this->errors[] = 'Error in adding validator.');
} else {
$this->errors[] = 'User wasn’t found!';
}
}
gp_redirect(gp_url_current());
}
示例12: gp_title
<?php
gp_title(sprintf(__('%s < GlotPress'), __('Login')));
gp_breadcrumb(array(__('Login')));
gp_tmpl_header();
?>
<form action="<?php
echo gp_url_ssl(gp_url_current());
?>
" method="post" class="form-signin" role="form">
<h2 class="form-signin-heading"><?php
_e('Login');
?>
</h2>
<?php
do_action('before_login_form');
?>
<input name="user_login" type="text" class="form-control" placeholder="<?php
_e('Username');
?>
" required="" autofocus="">
<input name="user_pass" type="password" class="form-control" placeholder="<?php
_e('Password');
?>
" required="">
<input type="hidden" value="<?php
echo esc_attr(gp_get('redirect_to'));
示例13: foreach
foreach ($locales as $locale) {
$class = 'odd' === $class ? 'even' : 'odd';
?>
<tr class="<?php
echo $class;
// WPCS: XSS ok.
?>
">
<?php
echo '<td>' . gp_link_get(gp_url_join(gp_url_current(), $locale->slug), $locale->english_name) . '</td>';
?>
<?php
echo '<td>' . gp_link_get(gp_url_join(gp_url_current(), $locale->slug), $locale->native_name) . '</td>';
?>
<?php
echo '<td>' . gp_link_get(gp_url_join(gp_url_current(), $locale->slug), $locale->slug) . '</td>';
?>
</tr>
<?php
}
?>
</tbody>
</table>
<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function($) {
$('.locales').tablesorter({
theme: 'glotpress',
sortList: [[0,0]],
headers: {
0: {
示例14: gp_url_login
function gp_url_login($redirect_to = null)
{
return gp_url('/login', array('redirect_to' => $redirect_to ? $redirect_to : gp_url_current()));
}