• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP gp_url_project函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中gp_url_project函数的典型用法代码示例。如果您正苦于以下问题:PHP gp_url_project函数的具体用法?PHP gp_url_project怎么用?PHP gp_url_project使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了gp_url_project函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: bulk_translate

 public function bulk_translate($project_path)
 {
     $project_path = urldecode($project_path);
     $url = gp_url_project($project_path);
     // If we don't have rights, just redirect back to the project.
     if (!GP::$user->current()->can('write', 'project')) {
         gp_redirect($url);
     }
     // Create a project class to use to get the project object.
     $project_class = new GP_Project();
     // Get the project object from the project path that was passed in.
     $project_obj = $project_class->by_path($project_path);
     // Get the translations sets from the project ID.
     $translation_sets = GP::$translation_set->by_project_id($project_obj->id);
     // Loop through all the sets.
     foreach ($translation_sets as $set) {
         //Array ( [action] => gtranslate [priority] => 0 [redirect_to] => http://localhost/wp40/gp/projects/sample/bg/my [row-ids] => Array ( [0] => 1 [1] => 2 ) )
         $bulk = array('action' => 'gtranslate', 'priority' => 0, 'row-ids' => array());
         $translation = new GP_Translation();
         $strings = $translation->for_translation($project_obj, $set, null, array('status' => 'untranslated'));
         foreach ($strings as $string) {
             $bulk['row-ids'][] .= $string->row_id;
         }
         $locale = GP_Locales::by_slug($set->locale);
         $this->gp_translation_set_bulk_action_post($project_obj, $locale, $set, $bulk);
     }
     $url = gp_url_project($project_path);
     gp_redirect($url);
 }
开发者ID:Tucev,项目名称:Glot-O-Matic,代码行数:29,代码来源:google-translate.php


示例2: gp_link_project_delete_get

function gp_link_project_delete_get($project, $text = false, $attrs = array())
{
    if (!GP::$permission->current_user_can('delete', 'project', $project->id)) {
        return '';
    }
    $text = $text ? $text : __('Delete', 'glotpress');
    return gp_link_get(gp_url_project($project, '-delete'), $text, gp_attrs_add_class($attrs, 'action edit'));
}
开发者ID:ramiy,项目名称:GlotPress-WP,代码行数:8,代码来源:template-links.php


示例3: gp_link_project_delete_get

function gp_link_project_delete_get($project, $text = false, $attrs = array())
{
    if (!current_user_can('manage_options')) {
        return '';
    }
    $text = $text ? $text : __('Delete', 'glotpress');
    return gp_link_get(gp_url_project($project, '-delete'), $text, gp_attrs_add_class($attrs, 'action delete'));
}
开发者ID:akirk,项目名称:GlotPress,代码行数:8,代码来源:template-links.php


示例4: gp_link_project_delete_get

function gp_link_project_delete_get($project, $text = false, $attrs = array())
{
    if (!GP::$user->current()->can('write', 'project', $project->id)) {
        return '';
    }
    $text = $text ? $text : __('Delete');
    return gp_link_get(gp_url_project($project, '-delete'), $text, gp_attrs_add_class($attrs, 'action delete'));
}
开发者ID:rmccue,项目名称:glotpress-plugin,代码行数:8,代码来源:template-links.php


示例5: test_gp_url_with_arrays

 function test_gp_url_with_arrays()
 {
     $this->assertEquals('baba', gp_url_join(array('baba')));
     $this->assertEquals('baba/dyado', gp_url_join(array('baba', 'dyado')));
     // test some shortcuts -- arrays instead of gp_url_join calls
     $this->assertEquals(gp_url_join(gp_url_project('/x'), 'import-originals'), gp_url_project('/x', 'import-originals'));
     $this->assertEquals(gp_url_project('/x', gp_url_join('slug', 'slugslug', 'import-translations')), gp_url_project('/x', array('slug', 'slugslug', 'import-translations')));
 }
开发者ID:rmccue,项目名称:GlotPress,代码行数:8,代码来源:test_urls.php


示例6: edit_get

 function edit_get($set_id)
 {
     $items = $this->get_set_project_and_locale_from_set_id_or_404($set_id);
     if (!$items) {
         return;
     }
     list($set, $project, $locale) = $items;
     if ($this->cannot_and_redirect('write', 'project', $set->project_id, gp_url_project($project))) {
         return;
     }
     $url = gp_url_project($project, gp_url_join($set->locale, $set->slug));
     $this->tmpl('translation-set-edit', get_defined_vars());
 }
开发者ID:pedro-mendonca,项目名称:GlotPress-WP,代码行数:13,代码来源:translation-set.php


示例7: edit_post

 function edit_post($glossary_id)
 {
     $glossary = GP::$glossary->get($glossary_id);
     $new_glossary = new GP_Glossary(gp_post('glossary'));
     if ($this->cannot_edit_glossary_and_redirect($glossary)) {
         return;
     }
     if (!$glossary->update($new_glossary)) {
         $this->errors[] = __('Error in updating glossary!');
         $this->redirect();
         return;
     }
     $this->notices[] = __('The glossary was updated!');
     $translation_set = $new_glossary->translation_set_id ? GP::$translation_set->get($new_glossary->translation_set_id) : null;
     $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')));
 }
开发者ID:pedro-mendonca,项目名称:GlotPress-WP,代码行数:17,代码来源:glossary.php


示例8: 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


示例9: auto_extract

 public function auto_extract($project_path)
 {
     // First let's ensure we have decoded the project path for use later.
     $project_path = urldecode($project_path);
     // Get the URL to the project for use later.
     $url = gp_url_project($project_path);
     // Create a project class to use to get the project object.
     $project_class = new GP_Project();
     // Get the project object from the project path that was passed in.
     $project_obj = $project_class->by_path($project_path);
     if (GP::$permission->user_can(wp_get_current_user(), 'write', 'project', $project->id)) {
         // Get the project settings.
         $project_settings = (array) get_option('gp_auto_extract', array());
         // Since we're running on the front end we need to load the download_url() function from the wp-admin/includes directory.
         include ABSPATH . 'wp-admin/includes/file.php';
         // Extract the strings, the third parameter disables HTML formating of the returned messages as GP doesn't need them.
         $message = $this->extract_project($project_obj, $project_settings, false);
     } else {
         $message = 'You do not have rights to auto extract originals!';
     }
     gp_notice_set($message);
     // Redirect back to the project home.
     wp_redirect($url);
 }
开发者ID:toolstack,项目名称:gp-auto-extract,代码行数:24,代码来源:gp-auto-extract.php


示例10: gp_url_project_locale

/**
 * Constructs URL for a project and locale.
 * /<project-path>/<locale>/<path>/<page>
 */
function gp_url_project_locale($project_or_path, $locale, $path = '', $query = null)
{
    return gp_url_project($project_or_path, array($locale, $path), $query);
}
开发者ID:johnjamesjacoby,项目名称:GlotPress-WP,代码行数:8,代码来源:url.php


示例11: gp_link_project

    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>



<?php 
gp_tmpl_footer();
开发者ID:WeFoster,项目名称:translate.wefoster.co,代码行数:31,代码来源:projects.php


示例12: gp_link

			<a class="ternary" href="#" onclick="jQuery('#personal-options-toggle').click();return false;">Cancel</a>
		</p>		
		</form>
	</div>
	</div>
<?php 
}
if ($can_write) {
    ?>
	<p class="secondary actionlist">
		<?php 
    gp_link(gp_url_project($project, 'import-originals'), __('Import originals'));
    ?>
 &bull;
		<?php 
    gp_link(gp_url_project('', '_new', array('parent_project_id' => $project->id)), __('Create a New Sub-Project'));
    ?>
 &bull;
		<?php 
    gp_link(gp_url('/sets/_new', array('project_id' => $project->id)), __('Create a New Translation Set'));
    ?>
	</p>
<?php 
}
?>
<script type="text/javascript" charset="utf-8">
	$gp.showhide('a.personal-options', 'Personal project options &darr;', 'Personal project options &uarr;', 'div.personal-options', '#source-url-template');
	$('div.personal-options').hide();
</script>
<?php 
gp_tmpl_footer();
开发者ID:rmccue,项目名称:GlotPress,代码行数:31,代码来源:project.php


示例13: foreach

foreach ($translations as $t) {
    gp_tmpl_load('translation-row', get_defined_vars());
    ?>
	
<?php 
}
if (!$translations) {
    ?>
	<tr><td colspan="4">No translations were found!</td></tr>
<?php 
}
?>
</table>
<?php 
echo gp_pagination($page, $per_page, $total_translations_count);
?>
<p class="clear actionlist secondary">
	<?php 
$footer_links = array();
if ($can_approve) {
    $footer_links[] = gp_link_get(gp_url_project($project, array($locale->slug, $translation_set->slug, 'import-translations')), __('Import translations'));
}
if (GP::$user->logged_in()) {
    $footer_links[] = gp_link_get(gp_url_project($project, array($locale->slug, $translation_set->slug, 'export-translations')), __('Export as PO file'));
}
$footer_links[] = gp_link_get(gp_url_project($project, array($locale->slug, $translation_set->slug, '_permissions')), 'Permissions');
echo implode(' &bull; ', $footer_links);
?>
</p>
<?php 
gp_tmpl_footer();
开发者ID:rmccue,项目名称:GlotPress,代码行数:31,代码来源:translations.php


示例14: _e

	</div><?php 
}
?>
	<div class="box has-warnings"></div>
	<div><?php 
_e('with warnings', 'glotpress');
?>
</div>

</div>
<p class="clear actionlist secondary">
	<?php 
$footer_links = array();
if ($can_approve) {
    $footer_links[] = gp_link_get(gp_url_project($project, array($locale->slug, $translation_set->slug, 'import-translations')), __('Import translations', 'glotpress'));
}
$export_url = gp_url_project($project, array($locale->slug, $translation_set->slug, 'export-translations'));
$export_link = gp_link_get($export_url, __('Export', 'glotpress'), array('id' => 'export', 'filters' => add_query_arg(array('filters' => $filters), $export_url)));
$format_options = array();
foreach (GP::$formats as $slug => $format) {
    $format_options[$slug] = $format->name;
}
$what_dropdown = gp_select('what-to-export', array('all' => _x('all current', 'export choice', 'glotpress'), 'filtered' => _x('only matching the filter', 'export choice', 'glotpress')), 'all');
$format_dropdown = gp_select('export-format', $format_options, 'po');
/* translators: 1: export 2: what to export dropdown (all/filtered) 3: export format */
$footer_links[] = sprintf(__('%1$s %2$s as %3$s', 'glotpress'), $export_link, $what_dropdown, $format_dropdown);
echo implode(' &bull; ', apply_filters('gp_translations_footer_links', $footer_links, $project, $locale, $translation_set));
?>
</p>
<?php 
gp_tmpl_footer();
开发者ID:akirk,项目名称:GlotPress,代码行数:31,代码来源:translations.php


示例15: gp_project_options_form

function gp_project_options_form($project)
{
    return '
			<a href="#" class="personal-options" id="personal-options-toggle"> ' . __('Personal project options &darr;') . '</a>
			<div class="personal-options">
				<form action="' . gp_url_project($project, '-personal') . '" method="post">
				<dl>
					<dt><label for="source-url-template">' . __('Source file URL') . '</label></dt>
					<dd>
						<input type="text" value="' . esc_html($project->source_url_template()) . '" name="source-url-template" id="source-url-template" />
						<small>' . __('URL to a source file in the project. You can use <code>%file%</code> and <code>%line%</code>. Ex. <code>https://trac.example.org/browser/%file%#L%line%</code>') . '</small>
					</dd>
				</dl>
				<p>
					<input type="submit" name="submit" value="' . esc_attr(__('Save &rarr;')) . '" id="save" />
					<a class="ternary" href="#" onclick="jQuery(\'#personal-options-toggle\').click();return false;">' . __('Cancel') . '</a>
				</p>
				</form>
			</div>';
}
开发者ID:rmccue,项目名称:glotpress-plugin,代码行数:20,代码来源:template.php


示例16: index

 public function index()
 {
     $this->redirect(gp_url_project(''));
 }
开发者ID:ramiy,项目名称:GlotPress-WP,代码行数:4,代码来源:index.php


示例17: printf

printf(__('Delete project &#8220;%s&#8221;', 'glotpress'), esc_html($project->name));
?>
</h2>
<form action="" method="post">
	<p>
		<?php 
_e('Note this will delete all translations, translation sets and child projects!', 'glotpress');
?>
	</p>
	<p>
		<input type="submit" name="submit" value="<?php 
esc_attr_e('Delete', 'glotpress');
?>
" id="submit" />
		<span class="or-cancel"><?php 
_e('or', 'glotpress');
?>
 <a href="<?php 
echo esc_url(gp_url_project($project));
?>
"><?php 
_e('Cancel', 'glotpress');
?>
</a></span>
	</p>
	<?php 
gp_route_nonce_field('delete-project_' . $project->id);
?>
</form>
<?php 
gp_tmpl_footer();
开发者ID:ramiy,项目名称:GlotPress-WP,代码行数:31,代码来源:project-delete.php


示例18: get_translation_set

 private function get_translation_set($set)
 {
     if (!isset($this->projects[$set->project_id])) {
         $this->projects[$set->project_id] = GP::$project->get($set->project_id);
     }
     $project = $this->projects[$set->project_id];
     if (!$project) {
         return false;
     }
     $project_url = gp_url_project($project, gp_url_join($set->locale, $set->slug));
     $set_name = gp_project_names_from_root($project) . ' | ' . $set->name_with_locale();
     return (object) array('project_id' => $project->id, 'project_url' => $project_url, 'set_name' => $set_name);
 }
开发者ID:akirk,项目名称:GlotPress,代码行数:13,代码来源:profile.php


示例19: gp_link

            ?>
						</td>
						<td class="stats translated"><?php 
            gp_link(gp_url_project($set_data->project_path, gp_url_join($locale->slug, $set_data->slug), array('filters[translated]' => 'yes', 'filters[status]' => 'current')), absint($set_data->current_count));
            ?>
</td>
						<td class="stats fuzzy"><?php 
            gp_link(gp_url_project($set_data->project_path, gp_url_join($locale->slug, $set_data->slug), array('filters[status]' => 'fuzzy')), absint($set_data->fuzzy_count));
            ?>
</td>
						<td class="stats untranslated"><?php 
            gp_link(gp_url_project($set_data->project_path, gp_url_join($locale->slug, $set_data->slug), array('filters[status]' => 'untranslated')), absint($set_data->all_count) - absint($set_data->current_count));
            ?>
</td>
						<td class="stats waiting"><?php 
            gp_link(gp_url_project($set_data->project_path, gp_url_join($locale->slug, $set_data->slug), array('filters[translated]' => 'yes', 'filters[status]' => 'waiting')), absint($set_data->waiting_count));
            ?>
</td>
						</tr>
					<?php 
        }
        //sub project slugs
        ?>
					</tr>
				<?php 
    }
    //sub projects
    ?>
				</tbody>
			</table>
		</div>
开发者ID:WeFoster,项目名称:translate.wefoster.co,代码行数:31,代码来源:locale.php


示例20: gp_link_project

			<li><?php 
    gp_link_project($project, esc_html($project->name));
    ?>
 <?php 
    gp_link_project_edit($project, null, array('class' => 'bubble'));
    ?>
</li>
		<?php 
}
?>
	</ul>

	<p class="actionlist secondary">
		<?php 
if (GP::$user->current()->can('write', 'project')) {
    ?>
			<?php 
    gp_link(gp_url_project('-new'), __('Create a New Project'));
    ?>
  &bull;&nbsp;
		<?php 
}
?>

		<?php 
gp_link(gp_url('/languages'), __('Projects by language'));
?>
	</p>

<?php 
gp_tmpl_footer();
开发者ID:pedro-mendonca,项目名称:GlotPress-WP,代码行数:31,代码来源:projects.php



注:本文中的gp_url_project函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP gp_url_project_locale函数代码示例发布时间:2022-05-15
下一篇:
PHP gp_url_join函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap