public static function gp_breadcrumb()
 {
     // We can't change the template of breadcrumbs so some string replaces to correct it.
     $breadcrumbs = gp_breadcrumb();
     $breadcrumbs = str_replace('<span class="separator">&rarr;</span>', '</li><li>', $breadcrumbs);
     $breadcrumbs = str_replace('<span class="breadcrumb"></li>', '<ol class="breadcrumb">', $breadcrumbs);
     $breadcrumbs = str_replace('</a></span>', '</a> &nbsp;', $breadcrumbs);
     $breadcrumbs = $breadcrumbs . '</ol>';
     echo $breadcrumbs;
 }
<?php

gp_title(sprintf(__('Permissions &lt; %s &lt; %s &lt; GlotPress'), $translation_set->name, $project->name));
gp_breadcrumb(array(gp_link_project_get($project, $project->name), $locale->english_name, 'default' != $translation_set->slug ? $translation_set->name : '', 'Permissions'));
gp_tmpl_header();
?>
<h2>Permissions</h2>
<ul id="translation-set-permissions">
<?php 
foreach ($permissions as $permission) {
    ?>
	<li>
		<span class="permission-action">user</span>
		<span class="user"><?php 
    echo esc_html($permission->user->user_login);
    ?>
</span>
		<span class="permission-action">can <?php 
    echo esc_html($permission->action);
    ?>
</span>
		<a href="<?php 
    echo gp_url_join(gp_url_current(), '_delete/' . $permission->id);
    ?>
" class="action delete">Remove</a>
	</li>
<?php 
}
if (!$permissions) {
    ?>
	<strong>No validators defined for this translation set.</strong>
Exemple #3
0
<?php

gp_title(__('Create New Project &lt; GlotPress', 'glotpress'));
gp_breadcrumb(array(__('Create New Project', 'glotpress')));
gp_tmpl_header();
?>
<h2><?php 
_e('Create New Project', 'glotpress');
?>
</h2>
<form action="" method="post">
<?php 
gp_tmpl_load('project-form', get_defined_vars());
?>
	<p>
		<input type="submit" name="submit" value="<?php 
esc_attr_e('Create', 'glotpress');
?>
" id="submit" />
		<span class="or-cancel"><?php 
_e('or', 'glotpress');
?>
 <a href="<?php 
echo gp_url();
?>
"><?php 
_e('Cancel', 'glotpress');
?>
</a></span>
	</p>
	<?php 
Exemple #4
0
<?php

gp_title(__('Projects &lt; GlotPress'));
gp_breadcrumb(array(__('Projects')));
gp_tmpl_header();
?>
<h2>Projects</h2>
<ul>
<?php 
foreach ($projects as $project) {
    ?>
	<li><?php 
    gp_link_project($project, esc_html($project->name));
    ?>
 <?php 
    gp_link_project_edit($project);
    ?>
 <?php 
    gp_link_project_delete($project);
    ?>
</li>
<?php 
}
?>
</ul>
<?php 
if (GP::$user->current()->can('write', 'project')) {
    ?>
	<p class="actionlist secondary"><?php 
    gp_link(gp_url_project('_new'), __('Create a New Project'));
    ?>
<?php

gp_title(__('Profile &lt; GlotPress'));
gp_breadcrumb(array(__('Profile')));
gp_tmpl_header();
?>

<h2><?php 
echo $user->display_name;
?>
 <?php 
if ($user->admin()) {
    _e('(Admin)');
}
?>
</h2>

<div>
	<div class="user-card">
		<div class="user-avatar"><img src="<?php 
echo $user->get_avatar();
?>
" /> </div>

		<dl class="user-info">
			<dd><?php 
$locale_keys = array_keys($locales);
if (1 < count($locales)) {
    vprintf(__('%s is a polyglot who knows %s but also knows %s.'), array_merge(array($user->display_name), $locale_keys));
} else {
    if (!empty($locale_keys)) {
Exemple #6
0
function gp_breadcrumb_project($project)
{
    return gp_breadcrumb(gp_project_links_from_root($project));
}
<?php

gp_title(__('View Glossary &lt; GlotPress', 'glotpress'));
gp_breadcrumb(array(gp_project_links_from_root($project), gp_link_get(gp_url_project_locale($project->path, $locale->slug, $translation_set->slug), $translation_set->name), __('Glossary', 'glotpress')));
$ge_delete_ays = __('Are you sure you want to delete this entry?', 'glotpress');
$delete_url = $url . '/-delete';
$glossary_options = compact('can_edit', 'url', 'delete_url', 'ge_delete_ays');
gp_enqueue_script('gp-glossary');
wp_localize_script('gp-glossary', '$gp_glossary_options', $glossary_options);
gp_tmpl_header();
?>

<h2><?php 
printf(_x('Glossary for %1$s translation of %2$s', '{language} / { project name}', 'glotpress'), esc_html($translation_set->name), esc_html($project->name));
?>
	<?php 
gp_link_glossary_edit($glossary, $translation_set, __('(edit)', 'glotpress'));
?>
</h2>

<?php 
if ($glossary->description) {
    echo '<p class="description">' . make_clickable(nl2br(wp_kses_post($glossary->description))) . '</p>';
}
?>

<table class="glossary" id="glossary">
	<thead>
		<tr>
			<th style="width:20%"><?php 
_ex('Item', 'glossary entry', 'glotpress');
Exemple #8
0
<?php

gp_title(__('Create New Project &lt; GlotPress'));
gp_breadcrumb(array(__('Create New Project')));
gp_tmpl_header();
?>
<h2><?php 
_e('Create New Project');
?>
</h2>
<form action="" method="post">
<?php 
gp_tmpl_load('project-form', get_defined_vars());
?>
	<p><input type="submit" name="submit" value="<?php 
echo esc_attr(__('Create'));
?>
" id="submit" /></p>
</form>
<?php 
gp_tmpl_footer();
<?php

gp_title(sprintf(__('Edit Translation Set &lt; %s &lt; %s &lt; GlotPress'), $set->name, $project->name));
gp_breadcrumb(array(gp_link_project_get($project, $project->name), gp_link_get($url, $locale->english_name . 'default' != $set->slug ? ' ' . $set->name : '')));
gp_tmpl_header();
?>
<h2><?php 
_e('Edit Translation Set');
?>
</h2>
<form action="" method="post">
<?php 
gp_tmpl_load('translation-set-form', get_defined_vars());
?>
	<p>
		<input type="submit" name="submit" value="<?php 
echo esc_attr(__('Save'));
?>
" id="submit" />
		<span class="or-cancel">or <a href="javascript:history.back();">Cancel</a></span>
	</p>
</form>
<?php 
gp_tmpl_footer();
<?php

gp_title(sprintf(__('Projects translated to %s &lt; GlotPress'), esc_html($locale->english_name)));
$breadcrumb = array();
$breadcrumb[] = gp_link_get('/languages', __('Locales'));
if ('default' == $current_set_slug) {
    $breadcrumb[] = esc_html($locale->english_name);
} else {
    $breadcrumb[] = gp_link_get(gp_url_join('/languages', $locale->slug), esc_html($locale->english_name));
    $breadcrumb[] = $set_list[$current_set_slug];
}
gp_breadcrumb($breadcrumb);
gp_tmpl_header();
?>

	<h2><?php 
printf(__('Active Projects translated to %s'), '<span>' . esc_html($locale->english_name) . '</span>');
?>
</h2>

	<?php 
if (count($set_list) > 1) {
    ?>
		<p class="actionlist secondary">
			<?php 
    echo implode(' &bull;&nbsp;', $set_list);
    ?>
		</p>
	<?php 
}
?>
<?php

/**
 * Templates: Delete Translation Set
 *
 * @package GlotPress
 * @subpackage Templates
 * @since 2.0.0
 */
gp_title(sprintf(__('Delete Translation Set &lt; %s &lt; %s &lt; GlotPress', 'glotpress'), $set->name, $project->name));
gp_breadcrumb(array(gp_project_links_from_root($project), gp_link_get($url, $locale->english_name . ('default' !== $set->slug ? ' ' . $set->name : ''))));
gp_tmpl_header();
?>
<h2><?php 
_e('Delete Translation Set', 'glotpress');
?>
</h2>
<form action="" method="post">
	<p>
		<?php 
_e('Note this will delete all translations associated with this set!', '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');
?>
Exemple #12
0
<?php

gp_title(sprintf(__('%s &lt; GlotPress'), esc_html($project->name)));
gp_breadcrumb(array(gp_link_project_get($project, $project->name)));
wp_enqueue_script('common');
gp_tmpl_header();
if ($sub_projects) {
    ?>
<ul>
<?php 
    foreach ($sub_projects as $sub_project) {
        ?>
	<li>
		<?php 
        gp_link_project($sub_project, esc_html($sub_project->name));
        ?>
			
		<?php 
        gp_link_project_edit($sub_project);
        ?>
			
		<?php 
        gp_link_project_delete($sub_project);
        ?>
	</li>
<?php 
    }
    ?>
</ul>	
<?php 
}
Exemple #13
0
<?php

/**
 * The settings page
 *
 * Displays the settings page for a user.
 *
 * @link http://glotpress.org
 *
 * @package GlotPress
 * @since 2.0.0
 */
gp_title(__('Your Settings &lt; GlotPress', 'glotpress'));
gp_breadcrumb(array(__('Your Settings', 'glotpress')));
gp_tmpl_header();
$per_page = (int) get_user_option('gp_per_page');
if (0 === $per_page) {
    $per_page = 15;
}
$default_sort = get_user_option('gp_default_sort');
if (!is_array($default_sort)) {
    $default_sort = array('by' => 'priority', 'how' => 'desc');
}
?>
<h2><?php 
_e('Your Settings', 'glotpress');
?>
</h2>
<form action="" method="post">
	<?php 
include_once __DIR__ . '/settings-edit.php';
<?php

gp_title(sprintf(__('Projects translated to %s &lt; GlotPress'), esc_html($locale->english_name)));
gp_breadcrumb(array(gp_link_get('/languages', __('Locales')), esc_html($locale->english_name)));
gp_tmpl_header();
?>

	<h2><?php 
printf(__('Active Projects translated to %s'), '<span>' . esc_html($locale->english_name) . '</span>');
?>
</h2>

	<?php 
if (empty($projects_data)) {
    _e('No active projects found.');
}
?>

	<?php 
foreach ($projects_data as $project_id => $sub_projects) {
    ?>
		<div class="locale-project">
			<h3><?php 
    echo $projects[$project_id]->name;
    ?>
</h3>

			<table class="locale-sub-projects table table-striped">
				<thead>
				<tr>
					<th class="header" <?php 
Exemple #15
0
<?php

gp_title(__('Projects &lt; GlotPress', 'glotpress'));
gp_breadcrumb(array(__('Projects', 'glotpress')));
gp_tmpl_header();
?>

	<h2><?php 
_e('Projects', 'glotpress');
?>
</h2>

	<ul>
		<?php 
foreach ($projects as $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 (current_user_can('manage_options')) {
<?php

gp_title(__('Profile &lt; GlotPress', 'glotpress'));
gp_breadcrumb(array(__('Profile', 'glotpress')));
gp_tmpl_header();
?>

<h2><?php 
echo $user->display_name;
?>
</h2>

<div>
	<div class="user-card">
		<div class="user-avatar"><?php 
echo get_avatar($user->user_email, 100);
?>
</div>

		<dl class="user-info">
			<dd><?php 
$locale_keys = array_keys($locales);
if (1 < count($locales)) {
    /* translators: 1: display name of a user, 2: language, 3: language */
    vprintf(__('%1$s is a polyglot who knows %2$s but also knows %3$s.', 'glotpress'), array_merge(array($user->display_name), $locale_keys));
} else {
    if (!empty($locale_keys)) {
        /* translators: 1: display name of a user, 2: language */
        printf(__('%1$s is a polyglot who contributes to %2$s', 'glotpress'), $user->display_name, $locale_keys[0]);
    }
}
<?php

gp_title(sprintf(__('%s &lt; 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'));
Exemple #18
0
>
	<script type="text/javascript">document.body.className = document.body.className.replace('no-js','js');</script>
		<div class="gp-content">
	    <div id="gp-js-message"></div>
		<h1>
			<a class="logo" href="<?php 
echo apply_filters('gp_logo_url', gp_url('/'));
?>
" rel="home">
				<img alt="GlotPress" src="<?php 
echo apply_filters('gp_logo_img_url', gp_url_img('glotpress-logo.png'));
?>
" />
			</a>
			<?php 
echo gp_breadcrumb();
?>
			<span id="hello">
			<?php 
if (GP::$user->logged_in()) {
    $user = GP::$user->current();
    printf(__('Hi, %s.'), '<a href="' . gp_url('/profile') . '">' . $user->user_login . '</a>');
    $logout_string = '<a href="' . gp_url('/logout') . '">' . __('Log out') . '</a>';
    echo apply_filters('gp_logout_link', $logout_string);
    ?>
			<?php 
} elseif (!GP_INSTALLING) {
    $login_string = '<strong><a href="' . gp_url_login() . '">' . __('Log in') . '</a></strong>';
    echo apply_filters('gp_login_link', $login_string);
}
?>
Exemple #19
0
<?php

gp_title(__('Install &lt; GlotPress'));
gp_breadcrumb(array('upgrade' == $action ? __('Upgrade') : __('Install')));
wp_enqueue_style('install');
gp_tmpl_header();
?>

<?php 
if (isset($errors)) {
    _e('There were some errors:');
    echo '<pre class="message">';
    echo implode("\n", $errors);
    echo '</pre>';
} else {
    if (isset($success_message)) {
        echo '<p>' . $success_message . '</p>';
    }
}
?>

<?php 
// TODO: deny access to scripts folder
if ($show_htaccess_instructions) {
    ?>
	<p>
		<?php 
    _e('If your <code>.htaccess</code> file was writeable, we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file.');
    ?>

		<pre><?php 
Exemple #20
0
<?php

gp_title(sprintf(__('Translations &lt; %s &lt; %s &lt; GlotPress', 'glotpress'), $translation_set->name, $project->name));
gp_breadcrumb(array(gp_project_links_from_root($project), gp_link_get($url, $translation_set->name)));
gp_enqueue_script('jquery-ui-core');
gp_enqueue_script('gp-editor');
gp_enqueue_script('gp-translations-page');
wp_localize_script('gp-translations-page', '$gp_translations_options', array('sort' => __('Sort', 'glotpress'), 'filter' => __('Filter', 'glotpress')));
// localizer adds var in front of the variable name, so we can't use $gp.editor.options
$editor_options = compact('can_approve', 'can_write', 'url', 'discard_warning_url', 'set_priority_url', 'set_status_url');
wp_localize_script('gp-editor', '$gp_editor_options', $editor_options);
gp_tmpl_header();
$i = 0;
?>
<h2>
	<?php 
printf(__('Translation of %s', 'glotpress'), esc_html($project->name));
?>
: <?php 
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 
Exemple #21
0
<?php

gp_title(__('Locales &lt; GlotPress', 'glotpress'));
gp_enqueue_script('gp-common');
gp_enqueue_script('tablesorter');
gp_breadcrumb(array(__('Locales', 'glotpress')));
gp_tmpl_header();
?>

	<h2><?php 
_e('Locales and Languages', 'glotpress');
?>
</h2>
	<div class="locales-filter">
		<?php 
_e('Filter:', 'glotpress');
?>
<input id="locales-filter" type="text" placeholder="<?php 
esc_attr_e('search', 'glotpress');
?>
" />
	</div>

	<table class="tablesorter locales">
		<thead>
		<tr>
			<th class="header"><?php 
_e('Name (in English)', 'glotpress');
?>
</th>
			<th class="header"><?php 
<?php

gp_title(__('Create New Translation Set &lt; GlotPress'));
gp_breadcrumb(array(__('Create New Translation Set')));
gp_tmpl_header();
?>
<h2><?php 
_e('Create New Translation Set');
?>
</h2>
<form action="" method="post">
<?php 
gp_tmpl_load('translation-set-form', get_defined_vars());
?>
	<p><input type="submit" name="submit" value="<?php 
echo esc_attr(__('Create'));
?>
" id="submit" /></p>
</form>
<?php 
gp_tmpl_footer();
<?php

gp_title(__('Create New Translation Set &lt; GlotPress'));
$project ? gp_breadcrumb_project($project) : gp_breadcrumb(array(__('New Translation Set')));
gp_tmpl_header();
?>

		<h2><?php 
_e('Create New Translation Set');
?>
</h2>

		<form action="" method="post" class="form-left form-horizontal" role="form">
			<?php 
gp_tmpl_load('translation-set-form', get_defined_vars());
?>

			<div class="form-group">
				<div class="col-sm-offset-4 col-md-offset-3 col-sm-8">
					<input type="submit" name="submit" value="<?php 
echo esc_attr(__('Create'));
?>
" id="submit" class="btn btn-primary" />
					<span class="or-cancel"><?php 
_e('or');
?>
 <a href="javascript:history.back();"><?php 
_e('Cancel');
?>
</a></span>
				</div>
 function test_gp_breadcrumb_should_flatten_the_given_array_of_crumbs()
 {
     gp_breadcrumb(array('baba', array('dyado'), 'muu'));
     $this->assertEquals('babadyadomuu', gp_breadcrumb(null, array('before' => '', 'after' => '', 'breadcrumb-template' => '{breadcrumb}')));
 }
Exemple #25
0
<?php

gp_title($kind == 'originals' ? sprintf(__('Import Originals &lt; %s &lt; GlotPress'), esc_html($project->name)) : sprintf(__('Import Translations &lt; %s &lt; GlotPress'), esc_html($project->name)));
gp_breadcrumb(array(gp_link_project_get($project, $project->name), $kind == 'originals' ? __('Import originals') : __('Import translations')));
gp_tmpl_header();
?>
<form action="" method="post" enctype="multipart/form-data">
	<p>
		<label for="mo-file"><?php 
echo __('MO file');
?>
</label><input type="file" name="mo-file" id="mo-file" />
	</p>
	<p>
		<label for="pot-file"><?php 
echo __('PO/POT file');
?>
</label><input type="file" name="pot-file" id="pot-file" />
	</p>

	<p><input type="submit" value="<?php 
echo esc_attr(__('Import'));
?>
"></p>
</form>
<?php 
gp_tmpl_footer();