public function gp_pre_tmpl_load($template, $args)
 {
     $url = gp_url_public_root();
     if (is_ssl()) {
         $url = gp_url_ssl($url);
     }
     gp_enqueue_script('gp-remove-powered-by');
 }
 public function gp_pre_tmpl_load($template, $args)
 {
     $url = gp_url_public_root();
     if (is_ssl()) {
         $url = gp_url_ssl($url);
     }
     gp_enqueue_script('new-window-for-external-links');
 }
예제 #3
0
/**
 * Enqueue one or more scripts.
 *
 * @since 2.2.0
 *
 * @param string|array $handles A single script handle to enqueue or an array of enqueue handles to enqueue.
 */
function gp_enqueue_scripts($handles)
{
    // Make sure $handles is an array to simplify the next loop.
    $handles = (array) $handles;
    // Loop through each handle we've been asked to enqueue.
    foreach ($handles as $handle) {
        gp_enqueue_script($handle);
    }
}
예제 #4
0
파일: project.php 프로젝트: akirk/GlotPress
<?php

gp_title(sprintf(__('%s &lt; GlotPress', 'glotpress'), esc_html($project->name)));
gp_breadcrumb_project($project);
gp_enqueue_script('gp-common');
gp_enqueue_script('tablesorter');
$edit_link = gp_link_project_edit_get($project, __('(edit)', 'glotpress'));
if ($project->active) {
    add_filter('gp_breadcrumb_items', function ($items) {
        $items[count($items) - 1] .= ' <span class="active bubble">' . __('Active', 'glotpress') . '</span>';
        return $items;
    });
}
gp_tmpl_header();
?>
<h2><?php 
echo esc_html($project->name);
?>
 <?php 
echo $edit_link;
?>
</h2>
<p class="description">
	<?php 
echo apply_filters('gp_project_description', $project->description, $project);
?>
</p>

<?php 
if ($can_write) {
    ?>
예제 #5
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 
<?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');
<?php

gp_title(sprintf(__('Mass-create Translation Sets &lt; %s &lt; GlotPress', 'glotpress'), $project->name));
gp_breadcrumb_project($project);
gp_enqueue_script('mass-create-sets-page');
wp_localize_script('mass-create-sets-page', '$gp_mass_create_sets_options', array('url' => gp_url_join(gp_url_current(), 'preview'), 'loading' => __('Loading translation sets to create&hellip;', 'glotpress')));
gp_tmpl_header();
?>
<h2><?php 
_e('Mass-create Translation Sets', 'glotpress');
?>
</h2>
<p><?php 
_e('Here you can mass-create translation sets in this project.
The list of translation sets will be mirrored with the sets of a project you choose.
Usually this is one of the parent projects.', 'glotpress');
?>
</p>
<form action="<?php 
echo esc_url(gp_url_current());
?>
" method="post">
	<dl>
		<dt><label for="project_id"><?php 
_e('Project to take translation sets from:', 'glotpress');
?>
</label></dt>
		<dd><?php 
echo gp_projects_dropdown('project_id', null);
?>
</dd>
예제 #8
0
<?php

gp_enqueue_style('base');
gp_enqueue_script('jquery');
function prepare_original($text)
{
    $text = str_replace(array("\r", "\n"), "<span class='invisibles' title='" . esc_attr__('New line', 'glotpress') . "'>&crarr;</span>\n", $text);
    $text = str_replace("\t", "<span class='invisibles' title='" . esc_attr__('Tab character', 'glotpress') . "'>&rarr;</span>\t", $text);
    // Glossaries are injected into the translations prior to escaping and prepare_original() being run.
    $glossary_entries = array();
    $text = preg_replace_callback('!(<span class="glossary-word"[^>]+>)!i', function ($m) use(&$glossary_entries) {
        $item_number = count($glossary_entries);
        $glossary_entries[$item_number] = $m[0];
        return "<span GLOSSARY={$item_number}>";
    }, $text);
    // Wrap full HTML tags with a notranslate class
    $text = preg_replace('/(&lt;.+?&gt;)/', '<span class="notranslate">\\1</span>', $text);
    // Break out & back into notranslate for translatable attributes
    $text = preg_replace('/(title|aria-label)=([\'"])([^\\2]+?)\\2/', '\\1=\\2</span>\\3<span class="notranslate">\\2', $text);
    // Wrap placeholders with notranslate
    $text = preg_replace('/(%(\\d+\\$(?:\\d+)?)?[bcdefgosuxEFGX])/', '<span class="notranslate">\\1</span>', $text);
    // Put the glossaries back!
    $text = preg_replace_callback('!(<span GLOSSARY=(\\d+)>)!', function ($m) use($glossary_entries) {
        return $glossary_entries[$m[2]];
    }, $text);
    return $text;
}
function map_glossary_entries_to_translations_originals($translations, $glossary)
{
    $glossary_entries = GP::$glossary_entry->by_glossary_id($glossary->id);
    if (empty($glossary_entries)) {
 public function gp_pre_tmpl_load($template, $args)
 {
     if ('translations' == $template) {
         gp_enqueue_script('gp-single-click-edit');
     }
 }