Example #1
0
/**
 * Enqueue one or more styles.
 *
 * @since 2.2.0
 *
 * @param string|array $handles A single style handle to enqueue or an array or style handles to enqueue.
 */
function gp_enqueue_styles($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_style($handle);
    }
}
Example #2
0
<?php

gp_title(sprintf(__('%s &lt; GlotPress', 'glotpress'), esc_html($project->name)));
gp_breadcrumb_project($project);
gp_enqueue_scripts(array('gp-editor', 'tablesorter'));
gp_enqueue_style('tablesorter-theme');
$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 
/**
 * Filter a project description.
 *
 * @since 1.0.0
 *
 * @param string     $description Project description.
 * @param GP_Project $project     The current project.
Example #3
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)) {