本文整理汇总了PHP中gp_url函数的典型用法代码示例。如果您正苦于以下问题:PHP gp_url函数的具体用法?PHP gp_url怎么用?PHP gp_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gp_url函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: new_post
function new_post()
{
$new_glossary = new GP_Glossary(gp_post('glossary'));
$translation_set = $new_glossary->translation_set_id ? GP::$translation_set->get($new_glossary->translation_set_id) : null;
if (!$translation_set) {
$this->redirect_with_error(__('Cannot find translation set with this ID.'), gp_url('/glossaries/-new', array('translation_set_id' => $new_glossary->translation_set_id)));
return;
}
if (GP::$glossary->by_set_id($new_glossary->translation_set_id)) {
$this->redirect_with_error(__('The glossary for this translation set already exists.'), gp_url('/glossaries/-new', array('translation_set_id' => $new_glossary->translation_set_id)));
return;
}
if ($this->cannot_edit_glossary_and_redirect($new_glossary)) {
return;
}
$created_glossary = GP::$glossary->create_and_select($new_glossary);
if ($created_glossary) {
$this->notices[] = __('The glossary was created!');
$set_project = GP::$project->get($translation_set->project_id);
$this->redirect(gp_url_join(gp_url_project($set_project, array($translation_set->locale, $translation_set->slug)), array('glossary')));
} else {
$this->errors[] = __('Error in creating glossary!');
$this->redirect(gp_url('/glossaries/-new', array('translation_set_id' => $new_glossary->translation_set_id)));
}
}
开发者ID:pedro-mendonca,项目名称:GlotPress-WP,代码行数:25,代码来源:glossary.php
示例2: after_notices
function after_notices()
{
if ($this->is_notice_hidden()) {
return;
}
$hide_url = gp_url('/getting-started/hide-notice');
?>
<div class="notice" id="help-notice">
New to <em>translate.wordpress.org</em>?
Have a look at the <a href="<?php
echo esc_url(gp_url('/getting-started'));
?>
">Getting Started guide.</a>
<a id="hide-help-notice" class="secondary" style="float: right;" href="<?php
echo esc_url($hide_url);
?>
">Hide</a>
</div>
<script type="text/javascript">
jQuery('#hide-help-notice').click(function() {
jQuery.ajax({url: '<?php
echo esc_js($hide_url);
?>
'});
jQuery('#help-notice').fadeOut(1000);
return false;
});
</script>
<?php
}
开发者ID:serhi,项目名称:wordpress-sites,代码行数:30,代码来源:wporg-help.php
示例3: gp_project_actions
public function gp_project_actions($actions, $project)
{
$project_settings = (array) get_option('gp_auto_extract', array());
if ('none' != $project_settings[$project->id]['type']) {
$actions[] .= gp_link_get(gp_url('auto-extract/' . $project->slug), __('Auto Extract'));
}
return $actions;
}
开发者ID:toolstack,项目名称:gp-auto-extract,代码行数:8,代码来源:gp-auto-extract.php
示例4: profile_post
function profile_post()
{
if (isset($_POST['submit'])) {
$per_page = (int) $_POST['per_page'];
GP::$user->current()->set_meta('per_page', $per_page);
$default_sort = $_POST['default_sort'];
GP::$user->current()->set_meta('default_sort', $default_sort);
}
$this->redirect(gp_url('/profile'));
}
开发者ID:Tucev,项目名称:Glot-O-Matic,代码行数:10,代码来源:profile.php
示例5: profile_post
function profile_post()
{
if (isset($_POST['submit'])) {
$per_page = (int) $_POST['per_page'];
update_user_option(get_current_user_id(), 'gp_per_page', $per_page);
$default_sort = array('by' => 'priority', 'how' => 'desc');
$user_sort = wp_parse_args($_POST['default_sort'], $default_sort);
update_user_option(get_current_user_id(), 'gp_default_sort', $user_sort);
}
$this->redirect(gp_url('/profile'));
}
开发者ID:akirk,项目名称:GlotPress,代码行数:11,代码来源:profile.php
示例6: profile_post
function profile_post()
{
if (isset($_POST['submit'])) {
$per_page = (int) $_POST['per_page'];
GP::$user->current()->set_meta('per_page', $per_page);
$default_sort = array('by' => 'priority', 'how' => 'desc');
$user_sort = wp_parse_args($_POST['default_sort'], $default_sort);
GP::$user->current()->set_meta('default_sort', $user_sort);
}
$this->redirect(gp_url('/profile'));
}
开发者ID:pedro-mendonca,项目名称:GlotPress-WP,代码行数:11,代码来源:profile.php
示例7: gp_scripts_default
function gp_scripts_default(&$scripts)
{
$scripts->base_url = gp_url('js');
$scripts->default_version = gp_get_option('version');
$scripts->add('jquery', '/jquery/jquery.js', array(), '1.3.2-min');
$scripts->add('jquery-ui-core', '/jquery/ui.core.js', array('jquery'), '1.7.2');
$scripts->add('jquery-ui-tabs', '/jquery/ui.tabs.js', array('jquery-ui-core'), '1.7.2');
$scripts->add('jquery-ui-tabs', '/jquery/ui.tabs.js', array('jquery-ui-core'), '1.7.2');
$scripts->add('jquery-ui-selectable', '/jquery/ui.selectable.js', array('jquery-ui-core'), '1.7.2');
$scripts->add('common', '/common.js', array('jquery'));
$scripts->add('editor', '/editor.js', array('common'));
$scripts->add('translations-page', '/translations-page.js', array('common'));
}
开发者ID:rmccue,项目名称:GlotPress,代码行数:13,代码来源:assets-loader.php
示例8: test_gp_url
function test_gp_url()
{
$this->assertEquals($this->url . 'baba', gp_url('baba'));
$this->assertEquals($this->url . 'baba', gp_url('baba', ''));
$this->assertEquals($this->url . 'baba', gp_url('baba', array()));
$this->assertEquals($this->url . '?a=b', gp_url('', 'a=b'));
$this->assertEquals($this->url . '?a=b', gp_url('', '?a=b'));
$this->assertEquals($this->url . '?a=b', gp_url('', array('a' => 'b')));
$this->assertEquals($this->url . '?a=b&b=c', gp_url('', array('a' => 'b', 'b' => 'c')));
$this->assertEquals($this->url . 'baba?a=b&b=c', gp_url('baba', array('a' => 'b', 'b' => 'c')));
$this->assertEquals($this->url . 'baba/wink?a=b&b=c', gp_url('/baba/wink', array('a' => 'b', 'b' => 'c')));
$this->assertEquals($this->url . 'baba/wink?a=a%26b&b=c', gp_url('/baba/wink', array('a' => 'a&b', 'b' => 'c')));
}
开发者ID:rmccue,项目名称:GlotPress,代码行数:13,代码来源:test_urls.php
示例9: new_post
function new_post()
{
$new_set = new GP_Translation_Set(gp_post('set'));
if ($new_set->project_id) {
$this->can_or_redirect('write', 'project', $new_set->project_id, gp_url_project(GP::$project->get($new_set->project_id)));
} else {
$this->can_or_redirect('write', 'project', null, gp_url_project(''));
}
$this->validate_or_redirect($new_set, gp_url('/sets/_new', array('project_id' => $new_set->project_id)));
$set = GP::$translation_set->create_and_select($new_set);
$project = GP::$project->get($set->project_id);
if (!$set) {
$this->errors[] = __('Error in creating translation set!');
gp_redirect(gp_url('/sets/_new', array('project_id' => $new_set['project_id'])));
} else {
$this->notices[] = __('The translation set was created!');
gp_redirect(gp_url_project_locale($project, $set->locale, $set->slug));
}
}
开发者ID:rmccue,项目名称:GlotPress,代码行数:19,代码来源:translation-set.php
示例10: get
public static function get($option)
{
switch ($option) {
case 'application_id':
return 'glotpress';
case 'application_uri':
return gp_url();
case 'cron_uri':
return '';
case 'cron_check':
return '';
case 'charset':
return 'UTF-8';
case 'wp_http_version':
return 'GlotPress/' . gp_get_option('version');
case 'hash_function_name':
return 'gp_hash';
default:
return gp_get_option(BP_Options::prefix() . $option);
}
}
开发者ID:pedro-mendonca,项目名称:GlotPress-WP,代码行数:21,代码来源:class.bp-options.php
示例11: settings_post
/**
* Saves settings for a user and redirects back to the settings page.
*
* @param int $user_id Optional. A user id, if not provided the id of the currently logged in user will be used.
*/
public function settings_post($user_id = null)
{
if (isset($_POST['submit'])) {
// Sometimes we get null, sometimes we get 0, depending on where it comes from.
// Let's make sure we have a consistent value to test against and that it's an integer.
$user_id = (int) $user_id;
if (0 === $user_id) {
$user_id = get_current_user_id();
}
if ($this->invalid_nonce_and_redirect('update-settings_' . $user_id)) {
return;
}
$per_page = (int) $_POST['per_page'];
update_user_option($user_id, 'gp_per_page', $per_page);
$default_sort = array('by' => 'priority', 'how' => 'desc');
$user_sort = wp_parse_args($_POST['default_sort'], $default_sort);
update_user_option($user_id, 'gp_default_sort', $user_sort);
$this->notices[] = __('Settings saved!', 'glotpress');
}
$this->redirect(gp_url('/settings'));
exit;
}
开发者ID:ramiy,项目名称:GlotPress-WP,代码行数:27,代码来源:settings.php
示例12: edit_post
function edit_post($set_id)
{
$items = $this->get_set_project_and_locale_from_set_id_or_404($set_id);
if (!$items) {
return;
}
list($set, $project, $locale) = $items;
$new_set = new GP_Translation_Set(gp_post('set', array()));
if ($this->cannot_edit_set_and_redirect($new_set)) {
return;
}
if ($this->invalid_and_redirect($new_set, gp_url('/sets/-new'))) {
return;
}
if (!$set->update($new_set)) {
$this->errors[] = __('Error in updating translation set!');
$this->redirect();
return;
}
$project = GP::$project->get($new_set->project_id);
$this->notices[] = __('The translation set was updated!');
$this->redirect(gp_url_project_locale($project, $new_set->locale, $new_set->slug));
}
开发者ID:pedro-mendonca,项目名称:GlotPress-WP,代码行数:23,代码来源:translation-set.php
示例13: esc_html
echo esc_html($translation_set->name);
?>
<?php
gp_link_set_edit($translation_set, $project, __('(edit)', 'glotpress'));
?>
<?php
if ($glossary) {
?>
<?php
echo gp_link($glossary->path(), __('glossary', 'glotpress'), array('class' => 'glossary-link'));
?>
<?php
} elseif ($can_approve) {
?>
<?php
echo gp_link_get(gp_url('/glossaries/-new', array('translation_set_id' => $translation_set->id)), __('Create glossary', 'glotpress'), array('class' => 'glossary-link'));
?>
<?php
}
?>
</h2>
<?php
if ($can_approve) {
?>
<form id="bulk-actions-toolbar" class="filters-toolbar bulk-actions" action="<?php
echo $bulk_action;
?>
" method="post">
<div>
<select name="bulk[action]" id="bulk-action">
<option value="" selected="selected"><?php
开发者ID:akirk,项目名称:GlotPress,代码行数:31,代码来源:translations.php
示例14: printf
<?php
printf(__("Translation of %s"), esc_html($project->name));
?>
: <span><?php
echo esc_html($translation_set->name);
?>
</span>
<?php
gp_link_set_edit($translation_set, $project, __('Edit'), array('class' => 'btn btn-xs btn-primary'));
?>
<?php
if ($glossary) {
echo gp_link(gp_url_project_locale($project, $locale->slug, $translation_set->slug) . '/glossary', __('glossary'), array('class' => 'btn btn-xs btn-primary'));
} elseif ($can_approve) {
echo gp_link_get(gp_url('/glossaries/-new', array('translation_set_id' => $translation_set->id)), __('Create glossary'), array('class' => 'btn btn-xs btn-primary'));
}
?>
</h2>
<?php
if ($can_approve) {
?>
<form id="bulk-actions-toolbar" class="filters-toolbar bulk-actions form-inline pull-left" action="<?php
echo $bulk_action;
?>
" method="post" role="form">
<select name="bulk[action]" id="bulk-action" class="form-control input-sm">
<option value="" selected="selected"><?php
_e('Bulk Actions');
?>
开发者ID:WeFoster,项目名称:translate.wefoster.co,代码行数:31,代码来源:translations.php
示例15: translations_get
function translations_get($project_path, $locale_slug, $translation_set_slug)
{
$project = GP::$project->by_path($project_path);
$locale = GP_Locales::by_slug($locale_slug);
if (!$project || !$locale) {
return $this->die_with_404();
}
$translation_set = GP::$translation_set->by_project_id_slug_and_locale($project->id, $translation_set_slug, $locale_slug);
if (!$translation_set) {
return $this->die_with_404();
}
$glossary = GP::$glossary->by_set_or_parent_project($translation_set, $project);
$page = gp_get('page', 1);
$filters = gp_get('filters', array());
$sort = gp_get('sort', array());
if ('random' == gp_array_get($sort, 'by')) {
add_filter('gp_pagination', '__return_null');
}
$per_page = get_user_option('gp_per_page');
if (0 == $per_page) {
$per_page = GP::$translation->per_page;
} else {
GP::$translation->per_page = $per_page;
}
$translations = GP::$translation->for_translation($project, $translation_set, $page, $filters, $sort);
$total_translations_count = GP::$translation->found_rows;
$can_edit = $this->can('edit', 'translation-set', $translation_set->id);
$can_write = $this->can('write', 'project', $project->id);
$can_approve = $this->can('approve', 'translation-set', $translation_set->id);
$url = gp_url_project($project, gp_url_join($locale->slug, $translation_set->slug));
$set_priority_url = gp_url('/originals/%original-id%/set_priority');
$discard_warning_url = gp_url_project($project, gp_url_join($locale->slug, $translation_set->slug, '-discard-warning'));
$set_status_url = gp_url_project($project, gp_url_join($locale->slug, $translation_set->slug, '-set-status'));
$bulk_action = gp_url_join($url, '-bulk');
// Add action to use different font for translations
add_action('gp_head', function () use($locale) {
return gp_preferred_sans_serif_style_tag($locale);
});
$this->tmpl('translations', get_defined_vars());
}
开发者ID:akirk,项目名称:GlotPress,代码行数:40,代码来源:translation.php
示例16: gp_url_profile
function gp_url_profile($user_nicename)
{
return apply_filters('gp_url_profile', gp_url(array('/profile', $user_nicename)), $user_nicename);
}
开发者ID:johnjamesjacoby,项目名称:GlotPress-WP,代码行数:4,代码来源:url.php
示例17: gp_link_project
<li class="list-group-item">
<?php
gp_link_project($project, esc_html($project->name));
?>
<?php
gp_link_project_edit($project, null, array('class' => 'btn btn-xs btn-primary'));
?>
</li>
<?php
}
?>
</ul>
<p>
<?php
gp_link(gp_url('/languages'), __('Projects by language'), array('class' => 'btn btn-primary'));
?>
<?php
if (GP::$user->current()->can('write', 'project')) {
?>
<?php
gp_link(gp_url_project('-new'), __('Create a New Project'), array('class' => 'btn btn-default'));
?>
<?php
}
?>
</p>
开发者ID:WeFoster,项目名称:translate.wefoster.co,代码行数:28,代码来源:projects.php
示例18: gp_project_actions
function gp_project_actions($project, $translation_sets)
{
$actions = array(gp_link_get(gp_url_project($project, 'import-originals'), __('Import originals')), gp_link_get(gp_url_project($project, array('-permissions')), __('Permissions')), gp_link_get(gp_url_project('', '-new', array('parent_project_id' => $project->id)), __('New Sub-Project')), gp_link_get(gp_url('/sets/-new', array('project_id' => $project->id)), __('New Translation Set')), gp_link_get(gp_url_project($project, array('-mass-create-sets')), __('Mass-create Translation Sets')), gp_link_get(gp_url_project($project, '-branch'), __('Branch Project')), gp_link_with_ays_get(gp_url_project($project, '-delete'), __('Delete Project'), array('ays-text' => 'Do you really want to delete this project?')));
$actions = apply_filters('gp_project_actions', $actions, $project);
echo '<ul>';
foreach ($actions as $action) {
echo '<li>' . $action . '</li>';
}
if ($translation_sets) {
echo '<li>' . gp_project_options_form($project) . '</li>';
}
echo '</ul>';
}
开发者ID:rmccue,项目名称:glotpress-plugin,代码行数:13,代码来源:template.php
示例19: gp_link_glossary_edit_get
function gp_link_glossary_edit_get($glossary, $set, $text = false, $attrs = array())
{
if (!GP::$user->current()->can('approve', 'translation_set', $set->id)) {
return '';
}
$text = $text ? $text : __('Edit');
return gp_link_get(gp_url(gp_url_join('/glossaries', $glossary->id, '-edit')), $text, gp_attrs_add_class($attrs, 'action edit'));
}
开发者ID:rmccue,项目名称:glotpress-plugin,代码行数:8,代码来源:template-links.php
示例20: urlencode
$url = __WP_HOME__ . '/api/user/register/?username=' . urlencode($date['username']) . '&email=' . urlencode($date['email']) . '&nonce=' . urlencode($j->nonce) . '&display_name=' . urlencode($date['name'] . ' ' . $date['surname']) . '&first_name=' . urlencode($date['name']) . '&last_name=' . urlencode($date['surname']) . '&user_pass=' . urlencode($date['password']);
$user_info = json_decode(file_get_contents($url));
header('Location: ' . gp_url('/'));
}
gp_title(__('Projects < GlotPress'));
gp_tmpl_header();
?>
<h2><?php
_e('Register User');
?>
</h2>
<div id="projects_box">
<img src="http://www.ctlr.it/translate/plugins/templates/img/ctlr.png" title="CTLR Translate" alt="CTLR Translate"/>
<p>This is the home of the CTLR Translate. Here we translate all CTLR Software.</p>
<p> If you're new, you can <a href="<?php
echo gp_url('/register');
?>
">register here</a> and start translating. We usually encourage people to start translating on one of our free plugins, if you're doing well we'll happily provide you a copy of one of the premium plugins to translate it.</p>
</div>
<div class="register_form">
<form action="" method="post">
<table class="form-table">
<tr>
<td>
<label ><?php
echo _('Name');
?>
</label><br />
<input type="text" name="name" />
</td>
<td>
开发者ID:ctlr,项目名称:glotpress-register-page,代码行数:31,代码来源:register.php
注:本文中的gp_url函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论