first commit

This commit is contained in:
Roman Pyrih
2025-08-26 10:50:15 +02:00
commit 97352dcdc9
6905 changed files with 2717203 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<?php
/**
* Special case for viewing Hello Dolly plugin
* TODO implement package aliasing in a generic fashion as part of bundle configuration.
*/
$this->extend('../layout');
?>
<div class="panel panel-info">
<h3 class="has-icon">
<?php esc_attr_e('"Hello Dolly" is part of the WordPress core','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This plugin doesn't have its own translation files, but can be translated in the default text domain", 'loco-translate')?>.
</p>
<p>
<a href="<?php $params->e('redirect')?>"><?php esc_html_e('Go to WordPress Core','loco-translate')?></a>
</p>
</div>

View File

@@ -0,0 +1,163 @@
<?php
/**
* Bundle configuration form
*/
$this->extend('../layout');
?>
<form action="" method="post" enctype="application/x-www-form-urlencoded" id="loco-conf"><?php
/* @var $p Loco_mvc_ViewParams */
foreach( $conf as $i => $p ): $id = sprintf('loco-conf-%u',$i)?>
<div id="<?php echo $id?>">
<a href="#" tabindex="-1" class="has-icon icon-del"><span class="screen-reader-text">remove</span></a>
<input type="hidden" name="<?php echo $p->prefix?>[removed]" value="" />
<?php
// display package name, and slug if it differs.
if( $p->name === $p->short ):?>
<h2><?php $p->e('name')?></h2><?php
else:?>
<h2><?php $p->e('name')?> <span>(<?php $p->e('short')?>)</span></h2><?php
endif;?>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row">
<label for="<?php echo $id?>-name"><?php esc_html_e('Project name','loco-translate')?></label>
</th>
<td>
<input type="text" name="<?php echo $p->prefix?>[name]" value="<?php $p->e('name')?>" id="<?php echo $id?>-name" class="regular-text" />
<p class="description">
<?php // Translators: Help tip for "Project name" field in advanced bundle config
esc_html_e('Descriptive name for this set of translatable strings','loco-translate')?>
</p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="<?php echo $id?>-domain"><?php esc_html_e('Text domain','loco-translate')?></label>
</th>
<td>
<input type="text" name="<?php echo $p->prefix?>[domain]" value="<?php $p->e('domain')?>" id="<?php echo $id?>-domain" class="regular-text" />
<p class="description">
<?php // Translators: Help tip for "Text domain" field in advanced bundle config
esc_html_e('The namespace into which WordPress will load translated strings','loco-translate')?>
</p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="<?php echo $id?>-slug"><?php esc_html_e('File prefix','loco-translate')?></label>
</th>
<td>
<input type="text" name="<?php echo $p->prefix?>[slug]" value="<?php $p->e('slug')?>" id="<?php echo $id?>-slug" class="regular-text" />
<p class="description">
<?php // Translators: Help tip for "File prefix" field in advanced bundle config
esc_html_e("Usually the same as the text domain, but don't leave blank unless you mean to",'loco-translate')?>
</p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="<?php echo $id?>-template"><?php esc_html_e('Template file','loco-translate')?></label>
</th>
<td>
<input type="text" name="<?php echo $p->prefix?>[template][path]" id="<?php echo $id?>-template" class="regular-text" value="<?php echo $p->escape( $p->template['path'] )?>" />
<label>
<input type="checkbox" value="1" name="<?php echo $p->prefix?>[template][locked]" <?php empty($p->template['locked']) || print('checked');?> />
<?php esc_html_e('Locked','loco-translate')?>
</label>
<p class="description">
<?php // Translators: Help tip for "Template file" field in advanced bundle config
esc_html_e('Relative path from bundle root to the official POT file','loco-translate')?>
</p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="<?php echo $id?>-target"><?php esc_html_e('Domain path','loco-translate')?></label>
</th>
<td class="twin">
<div>
<span class="description"><?php esc_html_e('Include','loco-translate')?>:</span>
<textarea name="<?php echo $p->prefix?>[target][path]" id="<?php echo $id?>-target" rows="2" cols="30" class="large-text"><?php echo $p->escape( $p->target['path'] )?></textarea>
</div>
<div>
<span class="description"><?php esc_html_e('Exclude','loco-translate')?>:</span>
<textarea name="<?php echo $p->prefix?>[target][exclude][path]" id="<?php echo $id?>-xtarget" rows="2" cols="30" class="large-text"><?php echo $p->escape( $p->target['exclude']['path'] )?></textarea>
</div>
<p class="description">
<?php // Translators: Help tip for "Domain path" field in advanced bundle config
esc_html_e('Folders within the bundle that contain author-supplied translations','loco-translate')?>. (<?php esc_html_e('no wildcards','loco-translate')?>)
</p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="<?php echo $id?>-source"><?php esc_html_e('Source file paths','loco-translate')?></label>
</th>
<td class="twin">
<div>
<span class="description"><?php esc_html_e('Include','loco-translate')?>:</span>
<textarea name="<?php echo $p->prefix?>[source][path]" id="<?php echo $id?>-source" rows="2" cols="30" class="large-text"><?php echo $p->escape( $p->source['path'] )?></textarea>
</div>
<div>
<span class="description"><?php esc_html_e('Exclude','loco-translate')?>:</span>
<textarea name="<?php echo $p->prefix?>[source][exclude][path]" id="<?php echo $id?>-xsource" rows="2" cols="30" class="large-text"><?php echo $p->escape( $p->source['exclude']['path'] )?></textarea>
</div>
<p class="description">
<?php // Translators: Help tip for "Source file paths" field in advanced bundle config
esc_html_e('Files and folders within the bundle that contain localized PHP code','loco-translate')?>. (<?php esc_html_e('no wildcards','loco-translate')?>)
</p>
</td>
</tr>
</tbody>
</table>
</div><?php
endforeach;?>
<footer id="loco-form-foot">
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row">
<label for="all-excl"><?php esc_html_e('Blocked paths','loco-translate')?>:</label>
</th>
<td>
<textarea name="exclude[path]" id="all-excl" rows="3" cols="30" class="large-text"><?php echo $params->escape($excl['path'])?></textarea>
<p class="description">
<?php // Translators: Help tip for "Blocked paths" field in advanced bundle config
esc_html_e('Folders within the bundle that will never be searched for files','loco-translate')?>. (<?php esc_html_e('no wildcards','loco-translate')?>)
</p>
</td>
</tr>
</tbody>
</table>
<p class="submit" >
<input type="submit" class="button-primary" value="<?php esc_html_e('Save config','loco-translate')?>" />
<button type="button" class="button" disabled id="loco-add-butt"><?php esc_html_e('Add set','loco-translate')?></button><?php
if( $params->parent ):?>
<a class="button button-link has-icon icon-cog" href="<?php $parent->e('href')?>"><?php esc_html_e('Parent theme','loco-translate')?></a><?php
endif?>
<a class="button button-link has-icon icon-download" href="<?php $params->e('xmlUrl')?>"><?php esc_html_e('XML','loco-translate')?></a>
</p>
</footer>
<input type="hidden" name="<?php $nonce->e('name')?>" value="<?php $nonce->e('value')?>" />
<input type="hidden" name="name" value="<?php $params->e('name')?>" />
</form>
<?php if( 'db' === $saved ):?>
<form action="" method="post" id="loco-reset">
<p class="submit">
<input type="submit" name="unconf" class="button button-danger" value="<?php esc_html_e('Reset config','loco-translate')?>" />
<input type="hidden" name="<?php $nonce->e('name')?>" value="<?php $nonce->e('value')?>" />
</p>
</form><?php
endif;

View File

@@ -0,0 +1,13 @@
<?php
/**
* Links above PO files table
*/
?>
<nav class="above-list-table"><?php
/* @var $link Loco_mvc_ViewParams */
foreach( $nav as $link ):?>
<a class="has-icon icon-<?php $link->e('icon')?>" href="<?php $link->e('href')?>"><?php $link->e('name')?></a><?php
endforeach;
echo $this->render('../common/inc-table-filter');
?>
</nav>

View File

@@ -0,0 +1,128 @@
<?php
/**
* Table of localised file pairs in a project
*/
/* @var Loco_mvc_ViewParams[] $pairs */
if( $pairs ):?>
<table class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th data-sort-type="s">
<?php esc_html_e('Language','loco-translate')?>
</th>
<th colspan="2" data-sort-type="n">
<?php esc_html_e('Translation progress','loco-translate')?>
</th>
<th data-sort-type="n">
<?php esc_html_e('Strings','loco-translate')?>
</th>
<th data-sort-type="n">
<?php esc_html_e('Pending','loco-translate')?>
</th>
<th data-sort-type="s">
<?php esc_html_e('File info','loco-translate')?>
</th>
<th data-sort-type="n">
<?php esc_html_e('Last modified','loco-translate')?>
</th>
<th data-sort-type="s">
<?php esc_html_e('Folder','loco-translate')?>
</th>
</tr>
</thead>
<tbody><?php
foreach( $pairs as $po ): $lc = $po->lcode; $ispo = (bool) $lc;?>
<tr>
<td class="has-row-actions" data-sort-value="<?php $po->e('lname')?>">
<a href="<?php $po->e('edit')?>" class="row-title"><?php
if( $ispo ):?>
<span <?php echo $po->lattr?>><code><?php $po->e('lcode')?></code></span>
<span><?php $po->e('lname')?></span><?php
else:?>
<span class="icon icon-file"></span>
<span><?php esc_html_e('Template file','loco-translate')?></span><?php
endif?>
</a><?php
if( $domain ):?>
<nav class="row-actions">
<span>
<a href="<?php $po->e('edit')?>"><?php esc_html_e('Edit','loco-translate')?></a> |
</span>
<span>
<a href="<?php $po->e('view')?>"><?php esc_html_e('View','loco-translate')?></a> |
</span>
<span>
<a href="<?php $po->e('info')?>"><?php esc_html_e('Info','loco-translate')?></a> |
</span>
<span>
<a href="<?php $po->e('copy')?>"><?php esc_html_e('Copy','loco-translate')?></a> |
</span>
<span>
<a href="<?php $po->e('move')?>"><?php esc_html_e('Move','loco-translate')?></a> |
</span>
<span class="trash">
<a href="<?php $po->e('delete')?>"><?php esc_html_e('Delete','loco-translate')?></a>
</span>
</nav><?php
endif?>
</td><?php
if( $ispo ):?>
<td data-sort-value="<?php echo $po->meta->getPercent()?>">
<?php $po->meta->printProgress()?>
</td>
<td>
<?php echo $po->meta->getPercent()?>%
</td>
<td data-sort-value="<?php $po->f('total','%u')?> ">
<?php $po->n('total')?>
</td>
<td data-sort-value="<?php $po->f('todo','%u')?>">
<?php $po->n('todo')?>
</td><?php
// else is a template, so has no progress
else:?>
<td data-sort-value="-1"> -- </td>
<td data-sort-value="-1"> -- </td>
<td data-sort-value="-1"> -- </td>
<td data-sort-value="-1"> -- </td><?php
endif?>
<td data-sort-value="<?php $po->e('name')?>">
<a href="<?php $po->e('info')?>"><?php $po->e('name')?></a>
</td>
<td data-sort-value="<?php $po->f('time','%u')?>">
<time datetime="<?php $po->date('time','c')?>"><?php $po->date('time')?></time>
</td>
<td><?php
$po->e('store');?>
</td>
</tr><?php
endforeach?>
</tbody><?php
/* @var string[] $warnings */
if( isset($warnings) && is_array($warnings) && $warnings ):?>
<tfoot><?php
foreach( $warnings as $text ):?>
<tr>
<td colspan="8">
<span class="has-icon icon-warn"><?php self::e($text)?></span>
</td>
</tr><?php
endforeach?>
</tfoot><?php
endif?>
</table><?php
else:?>
<table class="wp-list-table widefat fixed striped">
<tr>
<td><?php self::e( __('No translations found for "%s"','loco-translate'), $domain )?></td>
</tr>
</table><?php
endif;

View File

@@ -0,0 +1,121 @@
<?php
/**
* Listing of all files within a locale, grouped by bundle
*/
$this->extend('../layout');
?>
<div class="panel panel-info">
<h3 class="has-lang">
<span <?php echo $locale->attr?>><code><?php $locale->e('code')?></code></span>
<span><?php $locale->e('name')?></span>
<span class="loco-meta">
<span><?php echo esc_html_x('Updated','Modified time','loco-translate')?>:</span>
<span><?php $params->date('modified')?></span>
</span>
</h3>
</div>
<?php
foreach( $translations as $t => $group ): $type = $types[$t];?>
<div class="loco-projects">
<h3>
<?php $type->e('name')?>
</h3><?php
echo $this->render('../common/inc-table-filter');
?>
<table class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th data-sort-type="s">
<?php esc_html_e('Bundle name','loco-translate')?>
</th><?php
if( $npofiles ):?>
<th colspan="2" data-sort-type="n">
<?php esc_html_e('Translation progress','loco-translate')?>
</th>
<th data-sort-type="n">
<?php esc_html_e('Pending','loco-translate')?>
</th><?php
endif?>
<th data-sort-type="s">
<?php esc_html_e('File info','loco-translate')?>
</th>
<th data-sort-type="n">
<?php esc_html_e('Last modified','loco-translate')?>
</th>
<th data-sort-type="s">
<?php esc_html_e('Folder','loco-translate')?>
</th>
</tr>
</thead>
<tbody><?php
/* @var Loco_mvc_ViewParams $po */
foreach( $group as $po ): ?>
<tr>
<td class="has-row-actions" data-sort-value="<?php $po->e('lname')?>">
<a href="<?php $po->e('edit')?>" class="row-title">
<?php $po->e('title')?>
</a>
<nav class="row-actions">
<span>
<a href="<?php $po->e('edit')?>"><?php esc_html_e('Edit','loco-translate')?></a> |
</span>
<span>
<a href="<?php $po->e('view')?>"><?php esc_html_e('View','loco-translate')?></a> |
</span>
<span>
<a href="<?php $po->e('info')?>"><?php esc_html_e('Info','loco-translate')?></a> |
</span>
<span>
<a href="<?php $po->e('copy')?>"><?php esc_html_e('Copy','loco-translate')?></a> |
</span>
<span class="trash">
<a href="<?php $po->e('delete')?>"><?php esc_html_e('Delete','loco-translate')?></a>
</span>
</nav>
</td><?php
if( $npofiles ):
if( 'PO' === $po->type ):?>
<td data-sort-value="<?php echo $po->meta->getPercent()?>">
<?php $po->meta->printProgress()?>
</td>
<td title="of <?php $po->n('total')?>">
<?php echo $po->meta->getPercent()?>%
</td>
<td data-sort-value="<?php $po->f('todo','%u')?>">
<?php $po->n('todo')?>
</td><?php
else:?>
<td data-sort-value="-1">
-- <!-- no progress for template -->
</td>
<td>
<!-- no percentage for template -->
</td>
<td data-sort-value="-1">
-- <!-- no pending translations in templates -->
</td><?php
endif;
endif?>
<td data-sort-value="<?php $po->e('name')?>">
<a href="<?php $po->e('info')?>"><?php $po->e('name')?></a>
</td>
<td data-sort-value="<?php $po->f('time','%u')?>">
<time datetime="<?php $po->date('time','Y-m-d H:i:s')?>"><?php $po->date('time')?></time>
</td>
<td>
<?php $po->e('store')?>
</td>
</tr><?php
endforeach;?>
</tbody>
</table>
<p>
<a href="<?php $type->e('href')?>" class="button button-link has-raquo"><?php $type->e('text')?></a>
</p>
</div><?php
endforeach;

View File

@@ -0,0 +1,45 @@
<?php
/**
* Bundle setup layout.
* See setup/*.php for header definitions
*/
$this->extend('../layout');
echo $header;
/* @var Loco_mvc_ViewParams $params */
/* @var Loco_mvc_ViewParams[] $debug */
if( $params->has('debug') && $debug ):
foreach( $debug['notices'] as $type => $notes ): if($notes):?>
<div class="panel panel-<?php echo $params->escape($type)?>"><?php
foreach( $notes as $text ):?>
<p>
<strong class="has-icon"> </strong>
<?php echo $params->escape($text);?>.
</p><?php
endforeach?>
</div><?php
endif; endforeach?>
<div class="panel">
<h4><?php esc_html_e('Current configuration as XML','loco-translate')?>:</h4>
<pre><?php $debug->e('xml')?></pre>
</div><?php
endif;
/* @var string $credit */
if( $params->has('credit') ):?>
<div class="panel">
<h3 class="has-icon">
<?php esc_html_e('Author details','loco-translate')?>
</h3>
<p>
<?php esc_html_e('If you have trouble translating this bundle, consider asking the author for help','loco-translate')?>.
</p>
<p>
<?php echo $credit?>
</p>
</div><?php
endif;

View File

@@ -0,0 +1,18 @@
<?php
/**
* Bundle is configured by official author
*/
$this->extend('../setup');
$this->start('header');
?>
<div class="panel panel-success">
<h3 class="has-icon">
<?php esc_html_e('Official configuration','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This bundle's configuration is provided by the author",'loco-translate')?>.
<?php esc_html_e("You can make changes in the Advanced tab if you need to override the current settings",'loco-translate')?>.
</p>
<?php echo $this->render('inc-nav')?>
</div>

View File

@@ -0,0 +1,80 @@
<?php
/**
* "auto" config options
*/
$this->extend('../setup');
$this->start('header');
/*if( $params->has('jsonFields') ):
Remote JSON config is scrapped
<form action="" method="post" enctype="application/x-www-form-urlencoded" class="panel jsonly" id="loco-remote">
<h3>
<?php esc_html_e('Check config repository','loco-translate')?>
</h3>
<fieldset id="loco-remote-query">
<p>
<?php esc_html_e("We have a database of non-standard bundle configurations.\nIf we know your bundle, we'll configure it for you automatically",'loco-translate')?>
</p>
<p>
<select name="vendor">
<option value="wordpress"><?php esc_html_e('WordPress','default')?></option>
</select>
<input type="text" name="slug" value="<?php $params->e('vendorSlug')?>" class="regular-text" />
</p>
</fieldset>
<div id="loco-remote-empty">
<p>
<button type="button" class="button button-primary"><?php esc_html_e('Find config','loco-translate')?></button>
<a href="<?php $tabs[1]->e('href')?>" class="button button-link"><?php esc_html_e('Cancel','loco-translate')?></a>
<span></span>
</p>
</div>
<div id="loco-remote-found" class="jshide">
<p>
<input type="submit" class="button button-success" name="json-setup" value="<?php esc_attr_e('OK, Load this config','loco-translate')?>" />
<input type="reset" class="button button-link" value="<?php esc_attr_e('Cancel','loco-translate')?>" />
</p>
</div>
<?php $jsonFields->_e()?>
</form><?php
endif;*/
if( $params->has('xmlFields') ):?>
<form action="" method="post" enctype="application/x-www-form-urlencoded" class="panel">
<h3>
<?php esc_html_e('XML setup','loco-translate')?>
</h3>
<p>
<?php esc_html_e("If you've been given a configuration file by a developer, paste the XML code here",'loco-translate')?>:
</p>
<fieldset>
<textarea name="xml-content" class="large-text" rows="3" wrap="virtual"></textarea>
</fieldset>
<p>
<input type="submit" class="button button-primary" name="xml-setup" value="<?php esc_html_e('Load config','loco-translate')?>" />
<a href="<?php $tabs[1]->e('href')?>" class="button button-link"><?php esc_html_e('Cancel','loco-translate')?></a>
</p>
<?php $xmlFields->_e()?>
</form><?php
endif;
if( $params->has('autoFields') ):?>
<form action="" method="post" enctype="application/x-www-form-urlencoded" class="panel">
<h3>
Auto setup
</h3>
<p>
We can make some guesses about how this bundle is set up, but we can't guarantee they'll be right.
</p>
<p>
This is not recommended unless you're a developer able to make manual changes afterwards.
</p>
<p>
<input type="submit" class="button button-primary" name="auto-setup" value="Guess config" />
</p>
<?php $autoFields->_e()?>
</form><?php
endif;

View File

@@ -0,0 +1,20 @@
<?php
/**
* Bundle is set up internally
*/
$this->extend('../../layout');
?>
<div class="panel panel-success">
<h3 class="has-icon">
<?php esc_html_e('Bundle auto-configured','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This bundle's configuration is built into Loco Translate",'loco-translate')?>.
<?php esc_html_e("You can make changes in the Advanced tab if you need to override the current settings",'loco-translate')?>.
</p>
<p class="submit">
<a href="<?php $tabs[2]->e('href')?>" class="button button-link has-icon icon-wrench"><?php esc_html_e('Advanced configuration','loco-translate')?></a>
</p>
</div>

View File

@@ -0,0 +1,26 @@
<?php
/**
* Common links below variable setup header.
*/
$help = esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/bundle-setup') );
if( $params->has('notices') ):?>
<ul class="problems"><?php
foreach( $params->notices as $text ):?>
<li class="has-icon icon-remove">
<?php echo $params->escape( $text )?>
</li><?php
endforeach?>
</ul><?php
endif?>
<p class="submit">
<a href="<?php $tabs[2]->e('href')?>" class="button button-link has-icon icon-wrench"><?php esc_html_e('Advanced configuration','loco-translate')?></a>
</p>
<p>
<a href="<?php $tabs[1]->e('href')?>&amp;xml=1" class="button button-link has-icon icon-upload"><?php esc_html_e('Import config from XML','loco-translate')?></a>
</p>
<p>
<a href="<?php echo $help?>" class="button button-link has-icon icon-help" target="_blank"><?php esc_html_e('Get help with this','loco-translate')?></a>
</p>

View File

@@ -0,0 +1,18 @@
<?php
/**
* Bundle is set up fully from self-declared metadata
*/
$this->extend('../setup');
$this->start('header');
?>
<div class="panel panel-success">
<h3 class="has-icon">
<?php esc_html_e('Bundle auto-configured','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This bundle's configuration has been automatically detected and seems to be fully compatible",'loco-translate')?>.
<?php esc_html_e("You can make changes in the Advanced tab if you need to override the current settings",'loco-translate')?>.
</p>
<?php echo $this->render('inc-nav')?>
</div>

View File

@@ -0,0 +1,18 @@
<?php
/**
* Bundle is not set up at all
*/
$this->extend('../setup');
$this->start('header');
?>
<div class="panel panel-error">
<h3 class="has-icon">
<?php esc_html_e('Unconfigured bundle','loco-translate')?>
</h3>
<p>
<?php esc_html_e('This bundle isn\'t set up for translation in a way we understand','loco-translate')?>.
<?php esc_html_e('It needs configuring before you can do any translations','loco-translate')?>.
</p>
<?php echo $this->render('inc-nav')?>
</div>

View File

@@ -0,0 +1,18 @@
<?php
/**
* Bundle is set up from self-declared metadata, but has some missing bits
*/
$this->extend('../setup');
$this->start('header');
?>
<div class="panel panel-warning">
<h3 class="has-icon icon-info">
<?php esc_html_e('Partially configured bundle','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This bundle's configuration has been automatically detected, but isn't fully complete",'loco-translate')?>.
</p>
<?php echo $this->render('inc-nav')?>
</div>

View File

@@ -0,0 +1,23 @@
<?php
/**
* Bundle is saved in database, but can be reset
*/
$this->extend('../setup');
$this->start('header');
?>
<div class="panel panel-info">
<h3 class="has-icon">
<?php esc_html_e('Bundle configuration saved','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This bundle's configuration is saved in the WordPress database",'loco-translate')?>.
</p>
<form action="" method="post" enctype="application/x-www-form-urlencoded">
<p class="submit">
<input type="submit" name="reset-setup" class="button button-danger" value="<?php esc_html_e('Reset config','loco-translate')?>" />
<a href="<?php $tabs[2]->e('href')?>" class="button button-link has-icon icon-wrench"><?php esc_html_e('Edit config','loco-translate')?></a>
</p>
<?php $reset->_e()?>
</form>
</div>

View File

@@ -0,0 +1,68 @@
<?php
/**
* Bundle overview
*/
$this->extend('../layout');
/* @var Loco_mvc_ViewParams[] $projects */
/* @var Loco_mvc_ViewParams[] $unknown */
if( $projects ):
foreach( $projects as $p ): ?>
<div class="loco-project" id="loco-<?php $p->e('id')?>"><?php
// display package name, and slug if it differs.
if( $p->name === $p->short ):?>
<h2><?php $p->e('name')?></h2><?php
else:?>
<h2><?php $p->e('name')?> <span>(<?php $p->e('short')?>)</span></h2><?php
endif;
echo $this->render('inc-po-links', [ 'nav' => $p->nav ] );
echo $this->render('inc-po-table', [ 'pairs' => $p->po, 'domain' => $p->domain, 'installed'=>$p->installed, 'warnings'=>$p->warnings ] );
?>
</div><?php
endforeach;
if( $unknown ):?>
<div class="loco-project">
<div class="panel panel-info">
<h2><?php esc_html_e('Additional files found','loco-translate')?></h2>
<p>
<?php
esc_html_e("This bundle isn't fully configured, so we don't know what the following files are for",'loco-translate')?>. <?php
// Translators: %s is a URL. Keep the <a> tag intact
echo wp_kses(
sprintf( __('Click the <a href="%s">setup</a> tab to complete the bundle configuration','loco-translate'), $tabs[1]->href ),
['a'=>['href'=>true]], ['http','https']
);?>.
</p>
</div>
<?php
echo $this->render('../common/inc-table-filter');
echo $this->render('inc-po-table', [ 'pairs' => $unknown, 'domain' => null ] )?>
</div><?php
endif;
// showing incompatibility message if no configured projects available
else:?>
<div class="loco-project">
<div class="panel panel-error">
<h2><?php $params->e('name')?> <span>(<?php esc_html_e('unconfigured','loco-translate')?>)</span></h2>
<p>
<?php
esc_html_e("This bundle isn't automatically compatible and requires configuring before you can use all the functions of Loco Translate",'loco-translate')?>. <?php
echo wp_kses(
sprintf( __('Click the <a href="%s">setup</a> tab to complete the bundle configuration','loco-translate'), $tabs[1]->href ),
['a'=>['href'=>true]], ['http','https']
);?>.
</p>
</div>
</div><?php
if( $unknown ):?>
<div class="loco-project">
<?php echo $this->render('inc-po-table', [ 'pairs' => $unknown, 'domain' => null ] )?>
</div><?php
endif;
endif;

View File

@@ -0,0 +1,65 @@
<?php
/**
* Include standard file system connect dialog
*/
$help = esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/filesystem') );
// Total file lock prevents any kind of update, regardless of connection
if( $params->has('fsLocked') ):?>
<div class="has-nav panel panel-locked">
<p>
<strong class="has-icon"><?php esc_html_e('Locked','loco-translate')?>:</strong>
<span><?php $params->e('fsLocked')?>.</span>
</p>
<nav>
<a href="<?php echo $help?>#wp" target="_blank"><?php esc_html_e('Documentation','loco-translate')?></a>
<span>|</span>
<a href="<?php $this->route('config')->e('href')?>#loco--fs-protect"><?php esc_html_e('Settings','loco-translate')?></a>
</nav>
</div><?php
// else specific file may be protected from updates by the bundle config
elseif( $params->has('fsDenied') ):?>
<div class="has-nav panel panel-locked">
<p>
<strong class="has-icon"><?php esc_html_e('Read only','loco-translate')?>:</strong>
<span><?php esc_html_e('File is protected by the bundle configuration','loco-translate')?>.</span>
</p>
</div><?php
// else render remote connection form
else:?>
<div id="loco-fs-warn" class="has-nav panel panel-info jshide">
<p>
<strong class="has-icon"><?php esc_html_e('Notice','loco-translate')?>:</strong>
<span class="loco-msg"><!-- warning to be loaded by ajax --></span>
</p>
<nav>
<a href="<?php echo $help?>#wp" target="_blank"><?php esc_html_e('Documentation','loco-translate')?></a>
<span>|</span>
<a href="<?php $this->route('config')->e('href')?>#loco--fs-protect"><?php esc_html_e('Settings','loco-translate')?></a>
</nav>
</div>
<form id="loco-fs" class="has-nav panel panel-locked jshide jsonly">
<p>
<strong class="has-icon"><?php
// Translators: When a file or folder cannot be modified due to filesystem permissions
esc_html_e('Write protected','loco-translate')?>:
</strong>
<span class="loco-msg">
<!-- specific reason to be loaded by ajax -->
</span>
<span><?php
esc_html_e('Click "Connect" to authenticate with the server','loco-translate')?>.
</span>
</p>
<nav>
<button type="button" class="button button-small button-primary"><?php esc_html_e('Connect','loco-translate')?></button>
<a class="button button-small" href="<?php echo $help?>#remote" target="_blank"> ? </a>
</nav><?php
$fsFields->_e();?>
</form><?php
endif;

View File

@@ -0,0 +1,13 @@
<h3>
<a href="<?php $locale->e('href')?>" class="has-lang">
<span class="<?php $locale->e('icon')?>" lang="<?php $locale->e('lang')?>"><code><?php $locale->e('code')?></code></span>
<span><?php $locale->e('name')?></span>
</a>
<span class="loco-meta">
<span><?php echo esc_html_x('Updated','Modified time','loco-translate')?>:</span>
<span id="loco-po-modified"><?php $params->date('modified')?></span>
&ndash;
<span id="loco-po-status"><?php $params->has('meta') && self::e( $meta->getProgressSummary() )?></span>
</span>
</h3>

View File

@@ -0,0 +1,8 @@
<form class="loco-filter" action="#">
<fieldset class="loco-clearable">
<input type="text" name="q" value="" autocomplete="off" placeholder="<?php
// translators: text field placeholder
esc_html_e('Filter...','loco-translate')?>" size="20" />
</fieldset>
</form>

View File

@@ -0,0 +1,169 @@
<?php
/**
* API keys/settings screen
*/
$this->extend('../layout');
/* @var Loco_mvc_ViewParams $ui */
/* @var Loco_mvc_ViewParams[] $apis */
/* @var Loco_mvc_ViewParams $nonce */
$help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/providers');
?>
<form action="" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="<?php $nonce->e('name')?>" value="<?php $nonce->e('value')?>" />
<table class="form-table">
<tbody><?php
// DEEPL
$api = $apis['deepl']?>
<tr>
<th scope="row"><?php $api->e('name')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php $ui->e('api_key')?></span>
</legend>
<p>
<label for="loco--deepl_api_key">
<?php $ui->e('api_key')?>:
</label>
<input type="text" size="50" name="api[deepl][key]" id="loco--deepl_api_key" value="<?php $api->e('key')?>" spellcheck="false" />
</p>
<p>
<span class="description"><a href="https://www.deepl.com/translator" target="_blank" tabindex="-1">https://www.deepl.com/translator</a></span>
</p>
</fieldset>
</td>
</tr><?php
// GOOGLE
$api = $apis['google']?>
<tr>
<th scope="row"><?php $api->e('name')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php $ui->e('api_key')?></span>
</legend>
<p>
<label for="loco--google_api_key">
<?php $ui->e('api_key')?>:
</label>
<input type="text" size="50" name="api[google][key]" id="loco--google_api_key" value="<?php $api->e('key')?>" spellcheck="false" />
</p>
<p>
<span class="description"><a href="https://cloud.google.com/translate/" target="_blank" tabindex="-1">https://cloud.google.com/translate</a></span>
</p>
</fieldset>
</td>
</tr><?php
// LECTO AI
$api = $apis['lecto']?>
<tr>
<th scope="row"><?php $api->e('name')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php $ui->e('api_key')?></span>
</legend>
<p>
<label for="loco--lecto_api_key">
<?php $ui->e('api_key')?>:
</label>
<input type="text" size="50" name="api[lecto][key]" id="loco--lecto_api_key" value="<?php $api->e('key')?>" spellcheck="false" />
</p>
<p>
<span class="description"><a href="https://lecto.ai/?ref=loco" target="_blank" tabindex="-1">https://lecto.ai/?ref=loco</a></span>
</p>
</fieldset>
</td>
</tr><?php
// MICROSOFT
$api = $apis['microsoft']?>
<tr>
<th scope="row"><?php $api->e('name')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php $ui->e('api_key')?></span>
</legend>
<p>
<label for="loco--microsoft_api_key">
<?php $ui->e('api_key')?>:
</label>
<input type="text" size="50" name="api[microsoft][key]" id="loco--microsoft_api_key" value="<?php $api->e('key')?>" spellcheck="false" />
</p>
<p>
<label for="loco--microsoft_api_region">
<?php $ui->e('api_region')?>:
</label>
<input type="text" size="20" name="api[microsoft][region]" id="loco--microsoft_api_region" value="<?php $api->e('region')?>" spellcheck="false" placeholder="global" />
</p>
<p>
<span class="description"><a href="https://aka.ms/MicrosoftTranslator" target="_blank" tabindex="-1">https://aka.ms/MicrosoftTranslator</a></span>
</p>
</fieldset>
</td>
</tr><?php
// OPENAI (CHATGPT)
$api = $apis['openai']?>
<tr>
<th scope="row"><?php $api->e('name')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php $ui->e('api_key')?></span>
</legend>
<p>
<label for="loco--openai_api_key">
<?php $ui->e('api_key')?>:
</label>
<input type="text" size="50" name="api[openai][key]" id="loco--openai_api_key" value="<?php $api->e('key')?>" spellcheck="false" />
</p>
<p>
<label for="loco--openai_api_model">
Model:
</label>
<input type="text" size="50" name="api[openai][model]" id="loco--openai_api_model" value="<?php $api->e('model')?>" placeholder="gpt-4o-mini" spellcheck="false" />
</p>
<p>
<label for="loco--openai_prompt" style="vertical-align: top">
Prompt:
</label>
<textarea class="regular-text" name="api[openai][prompt]" id="loco--openai_prompt"><?php $api->e('prompt')?></textarea>
</p>
<p>
<span class="description"><a href="https://platform.openai.com/" target="_blank" tabindex="-1">https://platform.openai.com/</a></span>
</p>
</fieldset>
</td>
</tr><?php
/* @var Loco_mvc_ViewParams[] $hooked */
foreach( $hooked as $api ):?>
<tr>
<th scope="row"><?php $api->e('name')?></th>
<td>
<p><?php
$api->key ? esc_html_e('Configured externally','loco-translate') : esc_html_e('No API key','loco-translate') ?><br />
<span class="description"><a href="<?php $api->e('url')?>" target="_blank" tabindex="-1"><?php $api->e('url')?></a></span>
</p>
</td>
</tr><?php
endforeach?>
</tbody>
</table>
<div class="panel">
<p>
<strong class="has-icon"><?php esc_html_e('Important','loco-translate')?>:</strong>
<span>
<?php esc_html_e('Third party services are subject to their own terms of use and may incur costs from the provider','loco-translate')?>.
<a href="<?php self::e($help)?>#legal" target="_blank" tabindex="-1"><?php esc_html_e('See full disclaimer','loco-translate')?></a>.
</span>
</p>
</div>
<p class="submit">
<input type="submit" class="button-primary" value="<?php esc_html_e('Save settings','loco-translate')?>" />
<a class="button button-link" href="<?php self::e($help)?>" target="_blank"><?php esc_html_e('Documentation','loco-translate')?></a>
</p>
</form>

View File

@@ -0,0 +1,137 @@
<?php
/**
* System diagnostics
*/
$this->extend('../layout');
/* @var Loco_mvc_ViewParams $versions */
/* @var Loco_mvc_ViewParams $encoding */
?>
<div class="panel" id="loco-versions">
<h3>
Versions
<a href="#loco-versions" class="loco-anchor" aria-hidden="true"></a>
</h3>
<dl><?php
foreach( $versions as $key => $value ): if( $value ):?>
<dt>
<?php self::e($key)?>:
</dt>
<dd>
<code class="path" id="loco-vers-<?php self::e(strtolower(strtr($key,' ','-')))?>"><?php
$versions->e($key)?></code>
</dd><?php
endif; endforeach?>
</dl>
</div>
<div class="panel" id="loco-unicode">
<h3>
Unicode
<a href="#loco-unicode" class="loco-anchor" aria-hidden="true"></a>
</h3>
<dl>
<dt>UTF-8 rendering:</dt>
<dd><?php echo $encoding->OK?> <span id="loco-utf8-check"><?php echo $encoding->tick?></span></dd>
<dt>Multibyte support:</dt>
<dd><?php $encoding->e('mbstring')?></dd>
<dt>Site character set</dt>
<dd><?php $encoding->e('charset')?></dd>
</dl>
</div>
<div class="panel" id="loco-ajax">
<h3>
Ajax
<a href="#loco-ajax" class="loco-anchor" aria-hidden="true"></a>
</h3>
<dl>
<dt>Endpoint:</dt>
<dd><code id="loco-ajax-url" class="path">/wp-admin/admin-ajax.php</code></dd>
<dt>JSON decoding:</dt>
<dd><?php echo $encoding->json?></dd>
<dt class="jsonly">Ajax test result:</dt>
<dd class="jsonly" id="loco-ajax-check"><span class="inline-spinner"> </span></dd>
</dl>
</div>
<div class="panel" id="loco-apis">
<h3>
Translation APIs
<a href="#loco-apis" class="loco-anchor" aria-hidden="true"></a>
</h3>
<dl><?php
/* @var Loco_mvc_ViewParams[] $apis */
foreach( $apis as $api ):?>
<dt><?php $api->e('name')?>:</dt>
<dd class="jsonly" id="loco-api-<?php $api->e('id')?>"><span class="inline-spinner"> </span></dd><?php
endforeach?>
</dl>
</div>
<div class="panel" id="loco-sizes">
<h3>
Limits
<a href="#loco-sizes" class="loco-anchor" aria-hidden="true"></a>
</h3>
<dl><?php
/* @var Loco_mvc_ViewParams $memory */
foreach( $memory as $key => $value ):?>
<dt>
<?php echo $memory->escape($key)?>:
</dt>
<dd>
<?php $memory->e($key)?>
</dd><?php
endforeach?>
</dl>
</div>
<div class="panel" id="loco-files">
<h3>
Filesystem
<a href="#loco-files" class="loco-anchor" aria-hidden="true"></a>
</h3>
<dl>
<dt>File mods disallowed:</dt>
<dd><?php echo $fs->disabled?'Yes':'No'?></dd>
<dt>File mod safety level:</dt>
<dd><?php $fs->e('fs_protect')?></dd><?php
/* @var Loco_mvc_ViewParams[] $locations */
foreach( $locations as $label => $f ):?>
<dt><?php echo $f->escape($label)?>:</dt>
<dd><?php
$f->e('path');
if( $f->writable ): echo ' ✓'; else:?>
<span class="icon icon-warn" title="Not writable directly by PHP"></span><?php
endif?>
</dd><?php
endforeach?>
<dt>PHP open_basedir:</dt>
<dd><?php self::e(ini_get('open_basedir'))?></dd>
</dl>
</div>
<div class="panel" id="loco-debug">
<h3>
Debug settings
<a href="#loco-debug" class="loco-anchor" aria-hidden="true"></a>
</h3>
<dl><?php
foreach( $debug as $key => $value ):?>
<dt>
<?php echo $debug->escape($key)?>:
</dt>
<dd>
<?php $debug->e($key)?>
</dd><?php
endforeach?>
</dl>
</div>

View File

@@ -0,0 +1,47 @@
<?php
/**
* User preferences screen
*/
$this->extend('../layout');
/* @var Loco_data_Preferences $opts */
$help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/settings');
?>
<form action="" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="<?php $nonce->e('name')?>" value="<?php $nonce->e('value')?>" />
<table class="form-table">
<tbody>
<tr>
<th scope="row"><?php esc_html_e('Translator credit','loco-translate')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('Translator credit','loco-translate')?></span>
</legend>
<p>
<input type="text" size="64" name="opts[credit]" id="loco--credit" value="<?php echo esc_attr($opts->credit)?>" placeholder="<?php echo esc_attr($opts->default_credit())?>" />
</p>
</fieldset>
</td>
</tr>
<tr>
<th scope="row"><?php esc_html_e('Restrict locales','loco-translate')?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('Restrict locales','loco-translate')?></span>
</legend>
<p>
<input type="text" size="64" name="opts[locales]" id="loco--locales" value="<?php echo esc_attr(implode(', ',$opts->locales) )?>" placeholder="en_US, ..." />
</p>
</fieldset>
</td>
</tr>
</tbody>
</table>
<p class="submit">
<input type="submit" class="button-primary" value="<?php esc_html_e('Save settings','loco-translate')?>" />
<a class="button button-link" href="<?php self::e($help)?>#user" target="_blank"><?php esc_html_e('Documentation','loco-translate')?></a>
</p>
</form>

View File

@@ -0,0 +1,236 @@
<?php
/**
* Global settings screen. (plugin options)
*/
$this->extend('../layout');
$help_url = esc_html( apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/settings') );
/* @var Loco_data_Settings $opts */
/* @var Loco_data_Settings $dflt */
/* @var Loco_mvc_ViewParams $nonce */
/* @var Loco_mvc_ViewParams $verbose */
?>
<form action="#" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="<?php $nonce->e('name')?>" value="<?php $nonce->e('value')?>" />
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<?php esc_html_e('Extracting strings','loco-translate')?>
<a class="icon only-icon icon-help" href="<?php echo $help_url?>#xgettext" target="_blank"><span>(?)</span></a>
</th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('Extracting strings','loco-translate')?></span>
</legend>
<p>
<label for="loco--max_php_size">
<?php esc_html_e('Skip PHP files larger than:','loco-translate')?>
</label>
<input type="text" size="5" name="opts[max_php_size]" id="loco--max_php_size" value="<?php echo esc_attr( $opts->max_php_size)?>" placeholder="<?php echo esc_attr($dflt->max_php_size)?>" />
</p>
<p>
<label for="loco--php_alias">
<?php esc_html_e('Scan PHP files with extensions:','loco-translate')?>
</label>
<input type="text" size="15" name="opts[php_alias]" id="loco--php_alias" value="<?php echo esc_attr( implode(' ',$opts->php_alias) )?>" placeholder="<?php echo esc_attr(implode(' ',$dflt->php_alias))?>" />
</p>
<p>
<label for="loco--jsx_alias">
<?php esc_html_e('Scan JavaScript files with extensions:','loco-translate')?>
</label>
<input type="text" size="15" name="opts[jsx_alias]" id="loco--jsx_alias" value="<?php echo esc_attr( implode(' ',$opts->jsx_alias) )?>" placeholder="<?php echo esc_attr(implode(' ',$dflt->jsx_alias))?>" />
</p>
</fieldset>
</td>
</tr>
<tr>
<th scope="row">
<?php esc_html_e('Saving PO/POT files','loco-translate')?>
<a class="icon only-icon icon-help" href="<?php echo $help_url?>#po" target="_blank"><span>(?)</span></a>
</th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('Saving PO/POT files','loco-translate')?></span>
</legend>
<p>
<label for="loco--num-backups">
<?php esc_html_e('Number of backups to keep of each file:','loco-translate')?>
</label>
<input type="number" min="0" max="99" size="2" name="opts[num_backups]" id="loco--num-backups" value="<?php printf('%u',$opts->num_backups)?>" />
</p>
<p>
<label for="loco--po-width">
<?php esc_html_e('Maximum line length (zero disables wrapping)','loco-translate')?>
</label>
<input type="number" min="0" max="999" size="2" name="opts[po_width]" id="loco--po-width" value="<?php printf('%u',$opts->po_width)?>" />
</p>
<p>
<label for="loco--po-utf8-bom">
<input type="checkbox" name="opts[po_utf8_bom]" value="1" id="loco--po-utf8-bom"<?php echo $opts->po_utf8_bom?' checked':''?> />
<?php esc_html_e('Add UTF-8 byte order mark','loco-translate')?> (<?php esc_html_e('Not recommended','loco-translate')?>)
</label>
</p>
<p>
<label for="loco--ajax-files">
<input type="checkbox" name="opts[ajax_files]" value="1" id="loco--ajax-files"<?php echo $opts->ajax_files?' checked':''?> />
<?php esc_html_e('Enable Ajax file uploads','loco-translate')?> (<?php esc_html_e('Recommended','loco-translate')?>)
</label>
</p>
</fieldset>
</td>
</tr>
<tr>
<th scope="row">
<?php esc_html_e('Syncing PO files','loco-translate')?>
<a class="icon only-icon icon-help" href="<?php echo $help_url?>#sync" target="_blank"><span>(?)</span></a>
</th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('Syncing PO files','loco-translate')?></span>
</legend>
<p>
<label for="loco--fuzziness">
<?php esc_html_e('Fuzzy matching tolerance','loco-translate')?>:
</label>
<input type="text" size="5" maxlength="3" name="opts[fuzziness]" id="loco--fuzziness" value="<?php echo esc_attr( $opts->fuzziness)?>" placeholder="0-100" />
<span>%</span>
</p>
<p>
<label for="loco--pot-expected">
<?php // translators: Indicates that POT files are optional, which is not recommended
esc_html_e('Sync with source when template missing','loco-translate')?>:
</label>
<select name="opts[pot_expected]" id="loco--pot-expected">
<option value="0"><?php $verbose->e(0)?></option>
<option value="1"<?php echo 1 === $opts->pot_expected?' selected':''?>><?php $verbose->e(1)?></option>
<option value="2"<?php echo 2 === $opts->pot_expected?' selected':''?>><?php $verbose->e(2)?></option>
</select>
</p>
</fieldset>
</td>
</tr>
<tr>
<th scope="row">
<?php esc_html_e('Compiling MO files','loco-translate')?>
<a class="icon only-icon icon-help" href="<?php echo $help_url?>#mo" target="_blank"><span>(?)</span></a>
</th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('Compiling MO files','loco-translate')?></span>
</legend>
<p>
<label for="loco--gen-hash">
<input type="checkbox" name="opts[gen_hash]" value="1" id="loco--gen-hash"<?php echo $opts->gen_hash?' checked':''?> />
<?php esc_html_e('Generate hash tables','loco-translate')?>
</label>
</p>
<p>
<label for="loco--use-fuzzy">
<input type="checkbox" name="opts[use_fuzzy]" value="1" id="loco--use-fuzzy"<?php echo $opts->use_fuzzy?' checked':''?> />
<?php esc_html_e('Include Fuzzy strings','loco-translate')?>
</label>
</p>
</fieldset>
</td>
</tr>
<tr>
<th scope="row">
<?php esc_html_e('Compiling JSON files','loco-translate')?>
<a class="icon only-icon icon-help" href="<?php echo $help_url?>#json" target="_blank"><span>(?)</span></a>
</th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('Compiling JSON files','loco-translate')?></span>
</legend>
<p>
<label for="loco--jed-pretty">
<input type="checkbox" name="opts[jed_pretty]" value="1" id="loco--jed-pretty"<?php echo $opts->jed_pretty?' checked':''?> />
<?php esc_html_e('Pretty formatting','loco-translate')?>
</label>
</p>
<p>
<label for="loco--jed-clean">
<input type="checkbox" name="opts[jed_clean]" value="1" id="loco--jed-clean"<?php echo $opts->jed_clean?' checked':''?> />
<?php esc_html_e('Delete redundant files','loco-translate')?>
</label>
</p>
</fieldset>
</td>
</tr>
<tr>
<th scope="row">
<?php esc_html_e('File system access','loco-translate')?>
<a class="icon only-icon icon-help" href="<?php echo $help_url?>#fs" target="_blank"><span>(?)</span></a>
</th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('File system access','loco-translate')?></span>
</legend>
<p>
<label for="loco--fs-persist">
<input type="checkbox" name="opts[fs_persist]" value="1" id="loco--fs-persist"<?php echo $opts->fs_persist?' checked':''?> />
<?php esc_html_e('Save credentials in session','loco-translate')?>
(<?php esc_html_e('Not recommended','loco-translate')?>)
</label>
</p>
<p>
<label for="loco--fs-protect">
<?php esc_html_e('Modification of installed files','loco-translate');?>:
</label>
<select name="opts[fs_protect]" id="loco--fs-protect">
<option value="0"><?php $verbose->e(0)?></option>
<option value="1"<?php echo 1 === $opts->fs_protect?' selected':''?>><?php $verbose->e(1)?></option>
<option value="2"<?php echo 2 === $opts->fs_protect?' selected':''?>><?php $verbose->e(2)?></option>
</select>
</p>
<p>
<label for="loco--pot-protect">
<?php esc_html_e('Editing of POT (template) files','loco-translate');?>:
</label>
<select name="opts[pot_protect]" id="loco--pot-protect">
<option value="0"><?php $verbose->e(0)?></option>
<option value="1"<?php echo 1 === $opts->pot_protect?' selected':''?>><?php $verbose->e(1)?></option>
<option value="2"<?php echo 2 === $opts->pot_protect?' selected':''?>><?php $verbose->e(2)?></option>
</select>
</p>
</fieldset>
</td>
</tr>
<tr>
<th scope="row">
<?php esc_html_e('Grant access to roles','loco-translate')?>
<a class="icon only-icon icon-help" href="<?php echo $help_url?>#roles" target="_blank"><span>(?)</span></a>
</th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php esc_html_e('Allow full access to these roles','loco-translate')?></span>
</legend><?php
/* @var Loco_mvc_ViewParams[] $caps */
foreach( $caps as $cap ):?>
<p>
<label>
<input type="checkbox" name="<?php $cap->e('name')?>" value="<?php $cap->e('label')?>" <?php echo $cap->attrs?> />
<?php $cap->e('label')?>
</label>
</p><?php
endforeach;?>
</fieldset>
</td>
</tr>
</tbody>
</table>
<p class="submit">
<input type="submit" class="button-primary" value="<?php esc_html_e('Save settings','loco-translate')?>" />
<a class="button button-link" href="<?php echo $help_url?>" target="_blank"><?php esc_html_e('Documentation','loco-translate')?></a>
</p>
</form>

View File

@@ -0,0 +1,78 @@
<?php
/**
* Plugin version information
*/
$this->extend('../layout');
// Loco Translate version:
if( $params->has('update') ):?>
<div class="panel panel-warning">
<h3 class="has-icon">
<?php self::e( __('Version %s','loco-translate'), $version )?>
</h3>
<p>
<?php esc_html_e('A newer version of Loco Translate is available for download','loco-translate')?>.
</p>
<p class="submit">
<a class="button button-primary" href="<?php echo $update_href?>" target="_blank"><?php self::e(__('Upgrade to %s','loco-translate'), 'v'.$update )?></a>
<a class="button button-link has-icon icon-ext" href="https://wordpress.org/plugins/loco-translate/installation/" target="_blank"><?php esc_html_e('Install manually','loco-translate')?></a>
</p>
</div><?php
elseif( $params->has('devel') ):?>
<div class="panel panel-debug">
<h3 class="has-icon">
<?php self::e( __('Version %s','loco-translate'), $version )?>
</h3>
<p>
<?php esc_html_e("You're running a development snapshot of Loco Translate",'loco-translate')?>
</p>
</div><?php
else:?>
<div class="panel panel-success">
<h3 class="has-icon">
<?php self::e( __('Version %s','loco-translate'), $version)?>
</h3>
<p>
<?php esc_html_e("You're running the latest version of Loco Translate",'loco-translate')?>
</p>
</div><?php
endif;
// PHP version (warnings only)
if( $params->has('phpupdate') ):?>
<div class="panel panel-warning">
<h3 class="has-icon"><?php
// translators: Where %s is the full version number of PHP
self::e( __('PHP %s','loco-translate'), $phpversion )?>
</h3>
<p><?php
// translators: (1) Name of software, e.g. "WordPress" (2) Version number, e.g. "5.6"
self::e( __('Your version of %1$s is out of date. We recommend you upgrade to at least v%2$s, but preferably to the latest stable version.','loco-translate'),'PHP',$phpupdate)?>
</p>
<p class="submit">
<a class="button" href="https://www.php.net/downloads.php#v7" target="_blank">PHP 7.4</a>
<a class="button button-primary" href="https://www.php.net/downloads.php#v8" target="_blank">PHP 8.x</a>
</p>
</div><?php
endif;
// WordPress version (warnings only)
if( $params->has('wpupdate') ):?>
<div class="panel panel-warning">
<h3 class="has-icon"><?php
// translators: Where %s is the full version number of WordPress
self::e( __('WordPress %s','loco-translate'), $wpversion )?>
</h3>
<p><?php
self::e( __('Your version of %1$s is out of date. We recommend you upgrade to at least v%2$s, but preferably to the latest stable version.','loco-translate'),'WordPress',$wpupdate)?>
</p>
<p class="submit">
<a class="button button-primary" href="<?php echo esc_url($wpupdate_href)?>"><?php esc_html_e('Update Now','loco-translate')?></a>
<a class="button-link has-icon icon-ext" target="_blank" href="https://wordpress.org/download/releases/"><?php esc_html_e( __('Install manually','loco-translate') )?></a>
</p>
</div><?php
endif;

View File

@@ -0,0 +1,16 @@
<?php
/**
* Debug
*/
$this->extend('layout');
?>
<h1>Debug</h1>
<?php
echo $this->render('../debug/dump');
?>
<form>
<button class="button button-primary button-large has-icon icon-save loco-loading" disabled>Test spinner</button>
</form>

View File

@@ -0,0 +1,127 @@
<?php
/* @var Loco_mvc_View $this */
$this->extend('debug-layout');
$this->start('form');
// Translators: This file is intentionally in English only.
/* @var Loco_mvc_ViewParams $form */
/* @var Loco_mvc_ViewParams $default */
?>
<form action="" method="get" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="page" value="loco-debug" />
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label for="debug-msgid">Source string</label><br />
</th>
<td>
<textarea required class="regular-text" name="msgid" rows="4" id="debug-msgid" placeholder="e.g. %s comment"><?php $form->e('msgid')?></textarea>
<p class="description">
Enter the original string <strong>exactly</strong>. This field is mandatory.
</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="debug-msgctxt">Context</label>
</th>
<td>
<input type="text" class="regular-text" name="msgctxt" id="debug-msgctxt" value="<?php $form->e('msgctxt')?>" placeholder="e.g. Comments title" />
<p class="description">
Context is optional. It's used to disambiguate duplicate strings. If in doubt, leave blank.
</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="debug-plural">Plural form</label>
</th>
<td>
<input type="text" class="regular-text" name="msgid_plural" id="debug-plural" value="<?php $form->e('msgid_plural')?>" placeholder="e.g. %s comments" />
<label for="debug-n">n=</label>
<input type="number" min="0" name="n" id="debug-n" value="<?php $form->e('n')?>" placeholder="<?php $default->e('n')?>" />
<p class="description">
Plural form is optional, and will only work if the string has been pluralized.
</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="debug-domain">Text domain</label>
</th>
<td>
<input type="text" class="regular-text" name="domain" id="debug-domain" value="<?php $form->e('domain')?>" placeholder="<?php $default->e('domain')?>"/>
<p class="description">Leaving empty will use the WordPress core (default) text domain.</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="debug-locale">Language</label>
</th>
<td>
<input type="text" class="regular-text" name="locale" id="debug-locale" value="<?php $form->e('locale')?>" placeholder="<?php $default->e('locale')?>" />
<p class="description">Enter a valid locale code. Your translation files must be suffixed exactly with this value.</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="debug-loader">Loader</label>
</th>
<td>
<select name="loader" id="debug-loader"><?php $value = $form['loader'];?>
<option value="">
Auto (recommended)
</option>
<option value="plugin"<?php $value==='plugin' and print(' selected')?>>
load_plugin_textdomain
</option>
<option value="theme"<?php $value==='theme' and print(' selected')?>>
load_theme_textdomain
</option>
<option value="custom"<?php $value==='custom' and print(' selected')?>>
load_textdomain
</option>
<option value="none"<?php $value==='none' and print(' selected')?>>
None
</option>
</select>
<label for="debug-loadpath">path: </label>
<input type="text" class="regular-text code" name="loadpath" id="debug-loadpath" value="<?php $form->e('loadpath')?>" placeholder="" />
<p class="description">
See the WordPress documentation for correct usage of the path argument.
</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="debug-jspath">Script path</label>
</th>
<td>
<input type="text" class="regular-text code" name="jspath" id="debug-jspath" value="<?php $form->e('jspath')?>" placeholder="" />
<p class="description">
Simulate <a href="https://developer.wordpress.org/reference/functions/wp_set_script_translations/" tabindex="-1">wp_set_script_translations</a>
with a relative script path, e.g. <code>blocks/example.js</code>.
</p>
</td>
</tr>
<tr>
<th scope="row">
Options
</th>
<td>
<label>
<input type="checkbox" name="unhook" value="1"<?php $form->unhook and print(' checked')?> />
Unhook filters before test. This may help isolate translation from other plugins.
</label>
</td>
</tr>
</tbody>
</table>
<p class="submit">
<input type="submit" class="button-primary" value="Translate" />
<a class="button button-link" href="?page=loco-debug&randomize">Lucky dip</a>
</p>
</form>

View File

@@ -0,0 +1,39 @@
<?php
/* @var Loco_mvc_View $this */
$this->extend('../layout');
?>
<style>
code.po {
font-weight: bold;
}
#loco-log textarea {
width: 100%;
font-size: 12px;
}
</style>
<?php
/* @var Loco_mvc_View $params */
/* @var string $header */
$params->has('header') and print $header;
/* @var ArrayIterator|null $log */
if( $params->has('log') ):?>
<div class="panel" id="loco-log">
<h3>
Trace log:
</h3>
<p>
If you're asking for help on the WordPress forum, please post the full text below.
</p>
<form action="#">
<textarea spellcheck="false" class="code" name="l" rows="<?=$log->count()?>"><?php echo $params->escape( implode("\n",iterator_to_array($log) ) );?></textarea>
</form>
</div><?php
endif;
/* @var string $form */
echo $form;

View File

@@ -0,0 +1,53 @@
<?php
/* @var Loco_mvc_View $this */
$this->extend('debug-form');
$this->start('header');
/* @var Loco_mvc_ViewParams $result */
if( $result->translated ):?>
<div class="panel panel-success">
<h3 class="has-icon">Translation result:</h3>
<p><code class="po"><?php $result->e('msgstr')?></code></p>
<p>
This is the translation value returned from the
<a href="<?php $result->e('calleeDoc')?>" target="_blank"><code><?php $result->e('callee')?></code></a> function.
</p>
</div><?php
else:?>
<div class="panel panel-warning">
<h3 class="has-icon">String found, but no translation returned</h3>
<p>
The <a href="<?php $result->e('calleeDoc')?>" target="_blank"><code><?php $result->e('callee')?></code></a> function
returned the same value as the source string. Either the string isn't translated, or the required translation file wasn't loaded.
</p>
<p>
See below for the exact string matches we found in your translation files.
</p>
</div><?php
endif;
/* @var Loco_mvc_ViewParams[] $matched */
foreach( $result->matches as $g => $matched ):
/* @var Loco_mvc_FileParams $group */
$group = $result->grouped[$g];?>
<div class="panel panel-info">
<h3>
<?php $group->e('type');?> translations:
</h3><?php
foreach( $matched as $file ):?>
<p>
<span class="icon icon-file"> </span>
<code class="path"><?php $file->e('relpath') ?></code> &rarr; <code class="po"><?php $file->e('msgstr');?></code>
</p><?php
endforeach;
if( $group->has('href') ):?>
<p>
<span class="icon icon-pencil"> </span>
<a href="<?php $group->e('href')?>">Edit PO</a>
</p><?php
endif;?>
</div><?php
endforeach;

View File

@@ -0,0 +1,19 @@
<?php
/**
* File is actually a directory
*/
$this->extend('../layout');
?>
<div class="panel panel-error">
<h3 class="has-icon">
<?php esc_html_e('File is a directory','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This page was expecting a file, but the path is actually a directory",'loco-translate')?>:
</p>
<p>
<code><?php $info->e('relpath')?></code>
</p>
</div>

View File

@@ -0,0 +1,19 @@
<?php
/**
* File path not found
*/
$this->extend('../layout');
?>
<div class="panel panel-error">
<h3 class="has-icon">
<?php esc_html_e('File not found','loco-translate')?>
</h3>
<p>
<?php esc_html_e("Either this file is missing or the server doesn't have permission to access it",'loco-translate')?>:
</p>
<p>
<code class="path"><?php $params->e('path')?></code>
</p>
</div>

View File

@@ -0,0 +1,17 @@
<?php
/**
* File security issue
*/
$this->extend('../layout');
?>
<div class="panel panel-error">
<h3 class="has-icon">
<?php esc_html_e('File access disallowed','loco-translate')?>
</h3>
<p>
<?php esc_html_e("Access to this file is blocked for security reasons",'loco-translate')?>:
<strong><?php $params->e('reason')?></strong>
</p>
</div>

View File

@@ -0,0 +1,35 @@
<?php
/*
* Generic admin page error template
*/
$this->extend('../layout');
/* @var Loco_mvc_View $this */
/* @var Loco_error_Exception $error */
?>
<h1><?php echo esc_html( $error->getTitle() )?></h1>
<div class="panel panel-error">
<h3 class="has-icon">
<?php self::e( $error->getMessage() )?>
</h3><?php
/* @var Loco_mvc_FileParams $file */
if( $params->has('file') && $file->line ):?>
<p>
<code class="path"><?php $file->e('relpath')?>#<?php $file->e('line')?></code>
</p><?php
endif?>
</div>
<?php
/* @var Loco_mvc_ViewParams[] $trace */
if( $this->has('trace') ):
echo "<!-- DEBUG:\n";
foreach( $trace as $f ):
echo ' ',($f->has('class')?$f['class'].'::':''), $f->e('function'),' ', $f->e('file'),':',$f->e('line'), "\n";
endforeach;
echo " -->\n";
endif;

View File

@@ -0,0 +1,26 @@
<?php
/**
* Information page when a file has no backups.
*/
$this->extend('../layout');
$help = esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/settings') );
?>
<div class="panel panel-warning">
<h3><?php
esc_html_e('No previous file revisions','loco-translate')?>
</h3>
<p><?php
if( $enabled ):
esc_html_e('Backup files will be written when you save translations from Loco Translate editor','loco-translate');
else:
esc_html_e('File backups are disabled in your plugin settings','loco-translate');
endif?>.
</p>
<p class="submit">
<a href="<?php echo $help?>#po" target="_blank"><?php esc_html_e('Documentation','loco-translate')?></a>
<span>|</span>
<a href="<?php $this->route('config')->e('href')?>"><?php esc_html_e('Settings','loco-translate')?></a>
</p>
</div>

View File

@@ -0,0 +1,17 @@
<?php
/*
* Full screen error when there are no installed files for a given locale
*/
$this->extend('../layout');
?>
<div class="panel panel-error">
<h3 class="has-icon">
<?php esc_html_e('No files found for this language','loco-translate')?>
</h3>
<p>
It may not be installed properly.
See <a href="https://codex.wordpress.org/Installing_WordPress_in_Your_Language">Installing WordPress in your language</a>.
</p>
</div>

View File

@@ -0,0 +1,29 @@
<?php
/**
* Tokenizer extension required.
* Warning should also appear in the usual notices location. This page is just for information.
*/
$this->extend('../layout');
?>
<div class="panel panel-info">
<h3 class="has-icon">
<?php esc_html_e('About the Tokenizer','loco-translate')?>
</h3>
<p>
<?php
echo wp_kses(
// Translators: change "en" in the URL to your language if it's available at https://www.php.net/docs.php
__('Loco requires the <a href="http://php.net/manual/en/book.tokenizer.php" target="_blank">Tokenizer extension</a> to scan PHP source code for translatable strings','loco-translate'),
['a'=>['href'=>true,'target'=>true]], ['http','https']
);?>.
</p>
<p><?php
$help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/templates');
echo wp_kses(
// Translators: %s is a URL. Keep the <a> tag intact
sprintf( __('You can still translate any bundle that has a <a href="%s" target="_blank">template</a>','loco-translate'), $help ),
['a'=>['href'=>true,'target'=>true]], ['https']
);?>.
</p>
</div>

View File

@@ -0,0 +1,63 @@
<?php
/**
* PO file options form
*/
$this->extend('../layout');
/* @var Loco_gettext_SyncOptions $conf */
/* @var Loco_mvc_ViewParams $params */
?>
<div class="panel">
<h3>
<?php esc_html_e('Template options','loco-translate')?>
</h3>
<form action="" method="post" enctype="application/x-www-form-urlencoded" id="loco-main"><?php
/* @var Loco_mvc_HiddenFields $hidden */
$hidden->_e();?>
<table class="form-table">
<tbody>
<tr valign="top" class="compact">
<td>
<label for="loco-conf-template"><?php esc_html_e('Relative path to template file','loco-translate');?>:</label><br />
<input type="text" name="conf[template]" value="<?php self::e( (string) $conf->getTemplate() )?>" size="100" id="loco-conf-template" />
</td>
</tr>
<tr valign="top" class="compact">
<td>
<p>
<label>
<input type="radio" name="conf[mode]" value="po" <?php echo $conf->mergeMsgstr()?'checked ':''?>/>
<?php $params->f('potName', __('Copy target translations from "%s"','loco-translate') )?>
</label>
</p>
<p>
<label>
<input type="radio" name="conf[mode]" value="pot" <?php echo $conf->mergeMsgstr()?'':'checked '?>/>
<?php esc_html_e('Just copy English source strings','loco-translate')?>
</label>
</p>
</td>
</tr>
<tr valign="top" class="compact">
<td>
<p>
<label>
<input type="checkbox" name="conf[json]" value="1" <?php echo $conf->mergeJson()?'checked ':''?>/>
<?php esc_html_e('Merge strings from related JSON files','loco-translate')?>
</label>
</p>
</td>
</tr>
</tbody>
</table>
<p class="submit">
<button type="submit" class="button button-primary" disabled><?php esc_html_e('Save','loco-translate')?></button>
<a href="<?php $params->e('advanced')?>" class="button button-link"><?php esc_html_e('Advanced','loco-translate')?></a>
</p>
</form>
</div>

View File

@@ -0,0 +1,36 @@
<?php
/**
* Confirmation form for deleting a file
*/
$this->extend('../layout');
?>
<form action="" method="post" enctype="application/x-www-form-urlencoded" id="loco-del">
<div class="panel panel-danger">
<h3>
<span class="has-icon icon-trash"> </span>
<span><?php esc_html_e('Confirm delete','loco-translate')?></span>
</h3>
<p>
<?php
echo __('Are you sure you want to <strong>permanently</strong> delete the following file?','loco-translate')?>
</p>
<p>
<code><?php $info->e('relpath')?></code>
</p><?php
if( $params->has('deps') ):?>
<p>
<strong><?php $params->e('warn')?></strong><?php
foreach( $deps as $info ):?>
<div><?php $info->e('name')?></div><?php
endforeach?>
</p><?php
endif?>
<p class="submit">
<button type="submit" class="button button-danger" disabled><?php esc_html_e('Delete Permanently','loco-translate')?></button>
</p>
</div>
<?php
/* @var Loco_mvc_HiddenFields $hidden */
$hidden->_e();?>
</form>

View File

@@ -0,0 +1,45 @@
<?php
/**
* File revisions and rollback UI
*/
$this->extend('../layout');
$dfmt = _x( 'j M @ H:i', 'revision date short format', 'default' );
/* @var Loco_mvc_ViewParams $master */
?>
<div class="revisions loading" id="loco-ui">
<form class="revisions-control-frame" action="" method="post" enctype="application/x-www-form-urlencoded">
<div class="loco-clearfix">
<div class="revisions-previous jshide">
<button type="button" class="button" disabled><?php echo esc_attr_x('Previous','Button label for a previous revision','loco-translate'); ?></button>
</div>
<div class="revisions-next jshide">
<button type="button" class="button" disabled><?php echo esc_attr_x('Next','Button label for a next revision','loco-translate');?></button>
</div>
</div>
<div class="revisions-meta loco-clearfix">
<div class="diff-meta diff-right">
<span>Current revision saved <?php $master->e('reltime')?></span><br />
<time><?php $master->date('mtime',$dfmt)?></time><br />
<button type="button" class="button disabled" disabled>Restore</button>
</div><?php
/* @var Loco_mvc_FileParams[] $files */
foreach( $files as $i => $file ):?>
<div class="diff-meta jshide">
<span><?php $file->e('name')?></span><br />
<time><?php $file->date('potime',$dfmt)?></time><br />
<button type="submit" class="button button-primary" name="backup" value="<?php $file->e('relpath')?>"><?php esc_html_e('Restore','loco-translate')?></button>
<button type="submit" class="button button-danger" name="delete" value="<?php $file->e('relpath')?>"><?php esc_html_e('Delete','loco-translate')?></button>
</div><?php
endforeach?>
</div><?php
/* @var Loco_mvc_HiddenFields $hidden */
$hidden->_e();?>
</form>
<div class="revisions-diff-frame jsonly">
<div class="revisions-diff">
<div class="loading-indicator"><span class="spinner"></span></div>
<div class="diff"></div>
</div>
</div>
</div>

View File

@@ -0,0 +1,39 @@
<?php
/**
* PO file editor
*/
$this->extend('editor');
$this->start('header');
/* @var Loco_mvc_ViewParams $params */
?>
<form action="<?php $params->e('dlAction')?>" method="post" target="_blank" id="loco-download" class="aux wp-core-ui">
<fieldset><?php
// first download button is a direct download of the current file (.po, .pot, and potentially .mo)
/* @var Loco_mvc_ViewParams $ui */?>
<button class="button button-link has-icon icon-download" data-loco="source" disabled title="<?php $ui->e('download')?> <?php $params->e('filetype')?>">
<span><?php $params->e('filetype')?></span>
</button><?php
// second button is language pack if zip is available and project is configured
/* @var Loco_Locale $locale */
/* @var Loco_mvc_HiddenFields $dlFields */
if( $locale && class_exists('ZipArchive',false) && $dlFields->has('domain') ):?>
<button class="button button-link has-icon icon-zip" data-loco="archive" disabled title="<?php $ui->e('download')?> Zip">
<span>ZIP</span>
</button><?php
// else legacy MO file
elseif( $locale ):?>
<button class="button button-link has-icon icon-download" data-loco="binary" disabled title="<?php $ui->e('download')?> MO">
<span>MO</span>
</button><?php
endif?>
</fieldset><?php
$dlFields->_e();?>
</form><?php
echo $this->render('../common/inc-po-header');

View File

@@ -0,0 +1,32 @@
<?php
/**
* POT file editor
*/
$this->extend('editor');
$this->start('header');
?>
<form action="<?php $params->e('dlAction')?>" method="post" target="_blank" id="loco-download" class="aux wp-core-ui">
<fieldset>
<button class="button button-link has-icon icon-download" data-loco="source" disabled title="<?php $ui->e('download')?>">
<span>POT</span>
</button>
</fieldset>
<?php
$dlFields->_e();?>
</form>
<h3 class="has-lang">
<span><?php esc_html_e('Template file','loco-translate')?>:</span>
<span class="loco-meta">
<span><?php echo esc_html_x('Updated','Modified time','loco-translate')?>:</span>
<span id="loco-po-modified"><?php $params->date('modified')?></span>
&ndash;
<span id="loco-po-status"></span>
</span>
</h3>
<div id="loco-auto" title="Error">
<p>Template files cannot be translated</p>
</div>

View File

@@ -0,0 +1,67 @@
<?php
/**
* Editor layout for PO and POT files
*/
$this->extend('../layout');
echo $header;
/* @var Loco_mvc_ViewParams $js */
/* @var Loco_mvc_ViewParams $ui */
/* @var Loco_mvc_ViewParams $params */
/* @var Loco_mvc_ViewParams $locale */
/* @var Loco_mvc_HiddenFields $dlFields */
?>
<div id="loco-editor">
<nav class="wp-core-ui">
<form action="#" id="loco-actions">
<fieldset>
<button class="button has-icon icon-save" data-loco="save" disabled>
<span><?php $ui->e('save')?></span>
</button>
<button class="button has-icon icon-revert" data-loco="revert" disabled>
<span><?php $ui->e('revert')?></span>
</button>
<button class="button has-icon icon-sync" data-loco="sync" disabled>
<span><?php $ui->e('sync')?></span>
</button>
</fieldset><?php
if( $locale ):?>
<fieldset>
<button class="button has-icon icon-ok" data-loco="lint" disabled>
<span><?php $ui->e('lint')?></span>
</button>
<button class="button has-icon icon-robot" data-loco="auto" disabled>
<span><?php $ui->e('auto')?></span>
</button>
</fieldset><?php
else:?>
<fieldset>
<button class="button has-icon icon-add" data-loco="add" disabled>
<span><?php $ui->e('add')?></span>
</button>
<button class="button has-icon icon-del" data-loco="del" disabled>
<span><?php $ui->e('del')?></span>
</button>
</fieldset><?php
endif?>
<fieldset class="loco-clearable">
<input type="text" maxlength="100" name="q" id="loco-search" placeholder="<?php $ui->e('filter')?>" autocomplete="off" disabled />
</fieldset>
<fieldset>
<button class="button has-icon only-icon icon-pilcrow" data-loco="invs" disabled title="<?php $ui->e('invs')?>">
<span><?php $ui->e('invs')?></span>
</button>
<button class="button has-icon only-icon icon-code" data-loco="code" disabled title="<?php $ui->e('code')?>">
<span><?php $ui->e('code')?></span>
</button>
</fieldset>
</form>
</nav>
<div id="loco-editor-inner" class="jsonly">
<div class="loco-loading"></div>
</div>
</div>

View File

@@ -0,0 +1,39 @@
<?php
/**
* PO/POT headers form
*/
$this->extend('../layout');
?>
<div class="panel">
<h3>
<?php esc_html_e('Edit file headers','loco-translate');?>
</h3>
<form action="" method="post" enctype="application/x-www-form-urlencoded" id="loco-main"><?php
/* @var Loco_mvc_HiddenFields $hidden */
$hidden->_e();?>
<table class="form-table">
<tbody><?php
/* @var LocoPoHeaders $head */
foreach( $head as $key => $value ): if( preg_match('/^[-A-Za-z]+$/',$key) ):?>
<tr>
<th scope="row">
<label for="loco-header-<?php echo $key?>"><?php echo $key?></label>
</th>
<td>
<input type="text" name="headers[<?php echo $key?>]" value="<?php self::e($value) ?>" size="100" id="loco-header-<?php echo $key?>" />
</td>
</tr><?php
endif; endforeach;?>
</tbody>
</table>
<p class="submit">
<button type="submit" class="button button-primary" disabled><?php esc_html_e('Save','loco-translate')?></button>
</p>
</form>
</div>

View File

@@ -0,0 +1,44 @@
<?php
/**
* File info for a binary MO where the PO file is missing
*/
$this->extend('info');
$this->start('header');
?>
<div class="panel panel-info">
<h3>
<a href="<?php $locale->e('href')?>">
<span class="<?php $locale->e('icon')?>" lang="<?php $locale->e('lang')?>"><code><?php $locale->e('code')?></code></span>
<span><?php $locale->e('name')?></span>
</a>
<span>&mdash; <?php esc_html_e('compiled','loco-translate')?></span>
</h3>
<dl>
<dt><?php self::e( __('File size','loco-translate') )?>:</dt>
<dd><?php $file->e('size')?></dd>
<dt><?php esc_html_e('File modified','loco-translate')?>:</dt>
<dd><?php $file->date('mtime')?></dd>
<dt><?php esc_html_e('Last translation','loco-translate')?>:</dt>
<dd><?php $params->e('author')?> &mdash; <date><?php $params->date('potime')?></date></dd>
<dt><?php esc_html_e('Compiled translations','loco-translate')?>:</dt>
<dd>
<?php echo esc_html( $meta->getTotalSummary() )?>
</dd>
</dl>
</div>
<?php
if( ! $sibling->existent ):?>
<div class="panel panel-warning">
<h3 class="has-icon">
<?php esc_html_e('PO file missing','loco-translate')?>
</h3>
<p>
<?php esc_html_e("We can't find the original PO file from which this was compiled",'loco-translate')?>.
</p>
</div><?php
endif;

View File

@@ -0,0 +1,17 @@
<?php
/**
* File info for a file type we know nothing about
*/
$this->extend('info');
$this->start('header');
?>
<div class="panel panel-error">
<h3 class="has-icon">
<?php esc_html_e('Unexpected file type','loco-translate')?>
</h3>
<p>
<?php $params->e('error')?>
</p>
</div>

View File

@@ -0,0 +1,91 @@
<?php
/**
* File info for a translation source PO
*/
$this->extend('info');
$this->start('header');
/* @var Loco_mvc_FileParams $file */
/* @var Loco_mvc_FileParams $locale */
/* @var Loco_gettext_Metadata $meta */
?>
<div class="panel panel-info">
<nav>
<a class="icon only-icon icon-cog" title="Configure" href="<?php $file->e('configure')?>"><span>configure</span></a>
<a class="icon only-icon icon-download" title="Download" href="<?php $file->e('download')?>"><span>download</span></a>
</nav>
<h3>
<a href="<?php $locale->e('href')?>" class="has-lang">
<span class="<?php $locale->e('icon')?>" lang="<?php $locale->e('lang')?>"><code><?php $locale->e('code')?></code></span>
<span><?php $locale->e('name')?></span>
</a>
</h3>
<dl>
<dt><?php self::e( __('File size','loco-translate') )?>:</dt>
<dd><?php $file->e('size')?></dd>
<dt><?php self::e( __('File modified','loco-translate') )?>:</dt>
<dd><time><?php $file->date('mtime')?></time></dd>
<dt><?php self::e( __('Last translation','loco-translate') )?>:</dt>
<dd><?php $params->e('author')?> &mdash; <date><?php $params->date('potime')?></date></dd>
<dt><?php self::e( __('Translation progress','loco-translate') )?>:</dt>
<dd>
<?php self::e( $meta->getProgressSummary() )?>
</dd>
<dd>
<?php $meta->printProgress()?>
</dd>
</dl>
</div>
<?php
if( ! $sibling->existent ):?>
<div class="panel panel-warning">
<h3 class="has-icon">
<?php self::e( __('Binary file missing','loco-translate') )?>
</h3>
<p>
<?php self::e( __("We can't find the binary MO file that belongs with these translations",'loco-translate') )?>.
</p>
</div><?php
endif;
if( $params->has('potfile') ):
if( $potfile->synced ):?>
<div class="panel panel-success">
<h3 class="has-icon">
<?php self::e( __('In sync with template','loco-translate') )?>
</h3>
<p>
<?php // Translators: Where %s is the name of a template file
self::e( __('PO file has the same source strings as "%s"','loco-translate'), $potfile->name )?>.
</p>
</div><?php
else:?>
<div class="panel panel-info">
<h3 class="has-icon">
<?php self::e( __('Out of sync with template','loco-translate') )?>
</h3>
<p>
<?php // Translators: Where %s is the name of a template file
self::e( __('PO file has different source strings to "%s". Try running Sync before making any changes.','loco-translate'), $potfile->name )?>
</p>
</div><?php
endif;
// only showing missing template warning when project was matched. Avoids confusion if something went wrong
elseif( $params->has('project') ):?>
<div class="panel panel-debug">
<h3 class="has-icon">
<?php self::e( __('Missing template','loco-translate') )?>
</h3>
<p>
<?php
self::e( __('These translations are not linked to a POT file. Sync operations will extract strings directly from source code.','loco-translate') )?>
</p>
</div><?php
endif;

View File

@@ -0,0 +1,46 @@
<?php
/**
* File info for a template file (POT)
*/
$this->extend('info');
$this->start('header');
/* @var Loco_mvc_FileParams $file */
/* @var Loco_mvc_ViewParams $params */
/* @var Loco_gettext_Metadata $meta */
/* @var int $words */
?>
<div class="panel panel-info">
<nav>
<a class="icon only-icon icon-download" title="Download" href="<?php $file->e('download')?>"><span>download</span></a>
</nav>
<h3>
<?php esc_html_e('Template file','loco-translate')?>
</h3>
<dl>
<dt><?php self::e( __('File size','loco-translate') )?>:</dt>
<dd><?php $file->e('size')?></dd>
<dt><?php esc_html_e('File modified','loco-translate')?>:</dt>
<dd><time><?php $file->date('mtime')?></time></dd>
<dt><?php esc_html_e('Last extracted','loco-translate')?>:</dt>
<dd><time><?php $params->date('potime')?></time></dd>
<dt><?php echo esc_html_x('Source text','Editor','loco-translate')?>:</dt>
<dd><?php echo esc_html( $meta->getTotalSummary() )?> <span>(<?php echo sprintf( _n('%s word','%s words', $words, 'loco-translate'), number_format_i18n($words) )?>)</span></dd>
</dl>
</div>
<?php
if( 'POT' !== $file->type && ! $params->isTemplate ):?>
<div class="panel panel-debug">
<h3 class="has-icon">
Unconventional file name
</h3>
<p>
Template files should have the extension ".pot".<br />
If this is intended to be a translation file it should end with a language code.
</p>
</div><?php
endif;

View File

@@ -0,0 +1,127 @@
<?php
/**
* File information for any type of file. Extended by specific views for supported types
*/
$this->extend('../layout');
echo $header;
/* @var Loco_mvc_FileParams $file */
?>
<?php
if( ! $file->existent ):?>
<div class="panel panel-error">
<h3 class="has-icon">
<?php esc_html_e("File doesn't exist",'loco-translate')?>
</h3>
<p>
<code><?php $file->e('relpath')?></code>
</p>
</div><?php
elseif( $file->writable ):?>
<div class="panel panel-success">
<h3 class="has-icon">
<?php // Translators: Where %s is the type of file, e.g. "po"
self::e( __('%s file is writeable','loco-translate'), $file->type )?>
</h3>
<p>
<?php esc_html_e('You can update these translations directly from the editor to the file system','loco-translate')?>.
</p>
<p>
<code><?php $file->ls()?></code>
</p>
</div><?php
else:?>
<div class="panel panel-locked">
<h3 class="has-icon">
<?php esc_html_e('Write protected','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This file can't be updated directly by the web server",'loco-translate')?>.
</p>
<p>
<?php // Translators: Where %s is the name (or number) of an operating system user
self::e( __("To make changes you'll have to connect to the remote file system, or make the file writeable by %s",'loco-translate'), $params->httpd )?>.
</p>
<p>
<code><?php $file->ls()?></code>
</p>
</div><?php
endif;
if( ! $dir->existent ):?>
<div class="panel panel-error">
<h3 class="has-icon">
<?php esc_html_e("Directory doesn't exist",'loco-translate')?>
</h3>
<p>
<?php // Translators: "either" meaning that the file itself can't exist without a containing directory
esc_html_e("The containing directory for this file doesn't exist either",'loco-translate')?>.
</p>
<p>
<code><?php $dir->e('relpath')?></code>
</p>
</div><?php
elseif( $dir->writable ):?>
<div class="panel panel-success">
<h3 class="has-icon">
<?php esc_html_e('Directory is writeable','loco-translate')?>
</h3>
<p>
<?php // Translators: Where %s is the name (or number) of an operating system user
self::e( __('The containing directory is writeable by %s, so you can add new files in the same location','loco-translate'), $params->httpd )?>.
</p>
<p>
<code><?php $dir->ls()?></code>
</p><?php
if( ! $file->deletable ):?>
<p>
<span class="has-icon icon-warn"></span>
<?php esc_html_e('Note that the file may not be deletable due to additional ownership permissions','loco-translate')?>.
</p><?php
endif;?>
</div><?php
else:?>
<div class="panel panel-locked">
<h3 class="has-icon">
<?php esc_html_e('Write protected','loco-translate')?>
</h3>
<p>
<?php esc_html_e("This directory can't be written to directly by the web server",'loco-translate')?>.
</p>
<p>
<?php // Translators: Where %s is the name (or number) of an operating system user
self::e( __("To create new files here you'll have to connect to the remote file system, or make the directory writeable by %s",'loco-translate'), $params->httpd )?>.
</p>
<p>
<code><?php $dir->ls()?></code>
</p>
</div><?php
endif;
if( $file->autoupdate ):?>
<div class="panel panel-info">
<h3 class="has-icon"><?php
esc_html_e('WordPress updates','loco-translate')?>
</h3>
<p><?php
esc_html_e("Files in this location can be modified or deleted by WordPress automatic updates",'loco-translate')?>.
<a target="_blank" href="<?php
echo esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin/faqs/files-deleted') )?>"><?php
esc_html_e("What's this?",'loco-translate');
?></a>
</p>
</div><?php
endif;
if( $params->has('debug') ):?>
<div class="panel panel-debug">
<h3 class="has-icon">Developer notes</h3>
<div><?php
foreach( $debug as $prop => $raw ):?>
<p><?php $debug->e($prop)?></p><?php
endforeach?>
</div><?php
endif;

View File

@@ -0,0 +1,43 @@
<?php
/**
* Confirmation form for moving localized files to a new location.
*/
$this->extend('move');
$this->start('source');
/* @var Loco_mvc_ViewParams $current */
/* @var Loco_mvc_ViewParams[] $locations */
?>
<div class="panel">
<h2>
<?php self::e( __('Choose a new location for these translations','loco-translate') );?>
</h2>
<table class="form-table">
<tbody class="loco-paths"><?php
foreach( $locations as $typeId => $location ):?>
<tr class="compact">
<td>
<p class="description"><?php $location->e('label')?>:</p>
</td>
<td><?php
/* @var Loco_mvc_ViewParams $choice */
foreach( $location['paths'] as $choice ):?>
<p><?php
if( $choice->active ):?>
<label>
<input type="radio" name="dest" value="" disabled checked /><?php
else:?>
<label>
<input type="radio" name="dest" value="<?php $choice->e('path')?>" /><?php
endif?>
<code class="path"><?php $choice->e('path')?></code>
</label>
</p><?php
endforeach?>
</td>
</tr><?php
endforeach?>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,19 @@
<?php
/**
* Confirmation form for moving file or group of files to an exact/custom location.
* Use for moving POT file, but also moving PO siblings when locale or text domain is unknown
*/
$this->extend('move');
$this->start('source');
/* @var Loco_mvc_FileParams $file */
/* @var Loco_mvc_ViewParams $current */
?>
<div class="panel">
<h2>
<?php self::e( __('Enter a new location for this file','loco-translate') );?>
</h2>
<p>
<input type="text" name="dest" value="<?php $file->e('relpath')?>" class="large-text" />
</p>
</div>

View File

@@ -0,0 +1,31 @@
<?php
/**
* Confirmation form for moving any file or group of file siblings.
*/
$this->extend('../layout');
?>
<form action="" method="post" enctype="application/x-www-form-urlencoded" id="loco-main"><?php
/* @var Loco_mvc_HiddenFields $hidden */
$hidden->_e();
echo $source?>
<div class="panel panel-info">
<h2>
<?php self::e( __('Confirm relocation','loco-translate') );?>
</h2>
<p>
<?php self::e(_n('The following file will be moved/renamed to the new location:','The following files will be moved/renamed to the new location:',count($files),'loco-translate'));
/* @var Loco_fs_File[] $files */
foreach( $files as $file ):
echo '<div>',$params->escape( $file->basename() ),'</div>';
endforeach?>
</p>
<p class="submit">
<button type="submit" class="button button-primary" disabled><?php esc_html_e('Move files','loco-translate')?></button><?php
if( $params->has('advanced') ):?>
<a href="<?php $params->e('advanced')?>" class="button button-link"><?php esc_html_e('Advanced','loco-translate')?></a><?php
endif?>
</p>
</div>
</form>

View File

@@ -0,0 +1,58 @@
<?php
/* @var Loco_mvc_ViewParams $params */
/* @var string[] $lines */
echo $this->render('../common/inc-table-filter');?>
<div class="panel loco-loading" id="loco-po">
<ol class="msgcat"><?php
foreach( $lines as $i => $line ):?>
<li id="po-l<?php printf('%u',$i+1)?>"><?php
// may be totally blank line
if( '' === $line ){
echo '<span class="po-none"></span>';
continue;
}
// may be a comment line
if( '#' === substr($line,0,1) ){
// may be able to parse out references
$symbol = (string) substr($line,1,1);
if( '' !== $symbol ){
$line = substr($line,2);
if( ':' === $symbol ){
echo '<span class="po-refs">#:',preg_replace('/\\S+:\d+/', '<a href="#\\0" class="po-text">\\0</a>', $params->escape($line) ),'</span>';
}
// parse out flags and formatting directives
else if( ',' === $symbol ){
echo '<span class="po-flags">#,<span class="po-text">',preg_replace('/[-a-z]+/', '<em>\\0</em>', $params->escape($line) ),'</span></span>';
}
// else treat as normal comment even if empty
else {
echo '<span class="po-comment">#',$symbol,'<span class="po-text">',$params->escape($line),'</span></span>';
}
}
// else probably an empty comment
else {
echo '<span class="po-comment">',$params->escape($line),'</span>';
}
continue;
}
// grab keyword if there is one before quoted string
if( preg_match('/^(msg[_a-z0-9\\[\\]]+)(\\s+)/', $line, $r ) ){
echo '<span class="po-word">',$params->escape($r[1]),'</span><span class="po-space">',$params->escape($r[2]),'</span>';
$line = substr( $line, strlen($r[0]) );
}
// remainder of line (or whole line) should be a quoted string
if( preg_match('/^"(.*)"\s*$/', $line, $r ) ){
echo '<span class="po-string">&quot;<span class="po-text">',$params->escape($r[1]),'</span>&quot;</span>';
continue;
}
// else print whatever junk is left of line
echo '<span class="po-junk">',$params->escape($line),'</span>';
?></li><?php
endforeach?>
</ol>
</div>

View File

@@ -0,0 +1,65 @@
<?php
/**
* Binary MO hex view
*/
$this->extend('view');
$this->start('source');
/* @var Loco_mvc_ViewParams $params */
/* @var string $bin */
?>
<div class="panel panel-info">
<p>
<?php esc_html_e('File is in binary MO format','loco-translate')?>.
</p>
</div>
<div class="panel">
<pre><?php
// crude hex dump
// TODO make dynamic - flowing to width + clicking bytes highlights right-hand character ranges
$i = 0;
$r = 0;
$cols = 24;
$line = [];
$bytes = strlen($bin);
// establish formatting of row offset, based on largest row number
$rowfmt = sprintf( '%%0%uX | ', strlen( sprintf( '%02X', $cols * floor( $bytes / $cols ) ) ) );
for( $b = 0; $b < $bytes; $b++ ){
$c = substr($bin,$b,1);
$n = ord($c);
// print byte offset
if( ! $line ){
printf( $rowfmt, $b );
}
// print actual byte
printf('%02X ', $n );
// add printable to line
if( $n === 9 ){
$line[] = ' '; // <- tab?
}
else if ( $n < 32 || $n > 126 ) {
$line[] = '.'; // <- unprintable
}
else {
$line[] = $params->escape($c); // <- printable
}
// wrap at cols, and print plain text
if( ++$i === $cols ){
echo ' ', implode('', $line ), "\n";
$line = [];
$i = 0;
$r++;
}
}
if( $line ){
if( $r ){
echo str_repeat( ' ', $cols - $i );
}
echo ' ', implode('', $line ), "\n";
}
?></pre>
</div>

View File

@@ -0,0 +1,16 @@
<?php
/**
* PHP source view
*/
$this->extend('view');
$this->start('source');
/* @var Loco_mvc_ViewParams $params */
/* @var string $phps */
echo $this->render('../common/inc-po-header');?>
<div class="panel">
<?php highlight_string($phps);?>
</div>

View File

@@ -0,0 +1,9 @@
<?php
/**
* PO source view
*/
$this->extend('view');
$this->start('source');
echo $this->render('../common/inc-po-header');
echo $this->render('msgcat');

View File

@@ -0,0 +1,19 @@
<?php
/**
* POT source view
*/
$this->extend('view');
$this->start('source');
?>
<h3 class="has-lang">
<span><?php esc_html_e('Template file','loco-translate')?>:</span>
<span class="loco-meta">
<span><?php echo esc_html_x('Updated','Modified time','loco-translate')?>:</span>
<span id="loco-po-modified"><?php $params->date('modified')?></span>
&ndash;
<span id="loco-po-status"><?php echo esc_html( $meta->getTotalSummary() )?></span>
</span>
</h3>
<?php
echo $this->render('msgcat');

View File

@@ -0,0 +1,6 @@
<?php
/**
* Source view - displays file in raw form if possible
*/
$this->extend('../layout');
echo $source;

View File

@@ -0,0 +1,16 @@
<?php
/**
* Help tab sidebar, more information links
*/
?><p>
<strong><?php esc_html_e('Useful links:','loco-translate')?></strong>
</p>
<p>
<a href="<?php echo esc_url( apply_filters('loco_external','https://wordpress.org/plugins/loco-translate/') )?>" target="_blank"><?php esc_html_e('Official plugin page','loco-translate')?></a>
</p>
<p>
<a href="<?php echo esc_url( apply_filters('loco_external','https://wordpress.org/support/plugin/loco-translate/') )?>" target="_blank"><?php esc_html_e('Support forum','loco-translate')?></a>
</p>
<p>
<a href="<?php echo esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin') )?>" target="_blank"><?php esc_html_e('Info and tutorials','loco-translate')?></a>
</p>

View File

@@ -0,0 +1,12 @@
<h2>
Advanced configuration
</h2>
<p>
The Advanced tab provides full, manual configuration of the bundle.
</p>
<p>
This screen is designed for bundle developers, if you don't know what to enter try asking the author.
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/bundle-config'))?>" target="_blank">Full documentation</a>
</p>

View File

@@ -0,0 +1,15 @@
<h2>
Bundle setup
</h2>
<p>
The Setup tab shows a summary of whether the bundle is configured for translation and where the configuration is stored.
</p>
<p>
See our help pages for how to set up unconfigured bundles.</p>
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/bundle-setup'))?>" target="_blank">Full documentation</a>
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/authors'))?>" target="_blank">Help for bundle authors</a>
</p>

View File

@@ -0,0 +1,9 @@
<h2>
Bundle overview
</h2>
<p>
The Overview tab lists each set of available translations in the current bundle.
</p>
<p>
If Loco Translate can't configure your bundle automatically, click the Setup tab to see your options.
</p>

View File

@@ -0,0 +1,10 @@
<h2>
<?php esc_html_e('API keys','loco-translate')?>
</h2>
<p>
Loco Translate supports integration with several third party machine translation services.
Each of these requires an account with the service provider and an API key for enabling access via the Loco Translate editor.
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/providers'))?>" target="_blank"><?php esc_html_e('Full documentation','loco-translate')?></a>
</p>

View File

@@ -0,0 +1,10 @@
<h2>
<?php esc_html_e('Plugin settings','loco-translate')?>
</h2>
<p>
<?php esc_html_e('Site options apply to all users of Loco Translate across the current site','loco-translate')?>.
<?php esc_html_e('User options apply to your WordPress login, across all sites','loco-translate')?>.
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/settings'))?>" target="_blank"><?php esc_html_e('Full documentation','loco-translate')?></a>
</p>

View File

@@ -0,0 +1,9 @@
<h2>
The translation editor
</h2>
<p>
This editor allows you to translate and save strings to your server's file system in the correct file format.
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/editor'))?>" target="_blank">Full documentation</a>
</p>

View File

@@ -0,0 +1,10 @@
<h2>
File information
</h2>
<p>
This screen shows technical information about the selected file.
You may find it useful in debugging problems
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/filesystem'))?>" target="_blank">About filesystem access</a>
</p>

View File

@@ -0,0 +1,8 @@
<h2>
Source view
</h2>
<p>
This screen shows translation files in their <strong>raw</strong> form.
It's read-only because the file syntax is very easy to get wrong.
Click the "Editor" tab to make changes safely.
</p>

View File

@@ -0,0 +1,7 @@
<h2>
Loco Translate home screen
</h2>
<p>
From the home screen you can access recently used items and your active theme.
To translate other themes, plugins, or the WordPress core, use the subsection links in the side menu.
</p>

View File

@@ -0,0 +1,13 @@
<h2>
Adding a new language
</h2>
<p>
This screen is for adding new translation files on your server's file system.
</p>
<p>
The location you choose is important. Some file locations can be overwritten by WordPress updates.
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/faqs/files-deleted'))?>" target="_blank">See FAQ</a>
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/msginit'))?>" target="_blank">Full documentation</a>
</p>

View File

@@ -0,0 +1,12 @@
<h2>
Creating a template
</h2>
<p>
This screen is for adding a new translations template for a set of translatable strings.
</p>
<p>
Your language files use this template to ensure they all reference the same strings.
</p>
<p>
<a href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/templates'))?>" target="_blank">Full documentation</a>
</p>

View File

@@ -0,0 +1,10 @@
<h2>
Bundle listings
</h2>
<p>
This screen lists all bundles of the current type installed in your WordPress.
They may not all be ready for translation, but compatible bundles will show at least one "set" of translatable strings.
</p>
<p>
Clicking a bundle takes you to its translation management screen.
</p>

View File

@@ -0,0 +1,10 @@
<h2>
Installed languages
</h2>
<p>
This screen lists all the languages that are installed in your WordPress.
For a language to show up here, you must have the WordPress core translation files installed.
</p>
<p>
Clicking a language takes you to its translation management screen.
</p>

View File

@@ -0,0 +1,10 @@
<h2>
Installed language files
</h2>
<p>
This screen lists all files installed for the selected language.
</p>
<p>
Only files from correctly configured bundles will show up here.
If you don't see the files you expect, then locate the bundle in the Themes or Plugins section and ensure it's configured correctly.
</p>

View File

@@ -0,0 +1,20 @@
<?php
/**
* Common "Help & support" help tab
*/
?><h2>
<?php esc_html_e('Getting help with Loco Translate','loco-translate')?>
</h2>
<p>
If you have problems using Loco Translate, please try our
<a href="<?php echo esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin') )?>" target="_blank">help pages</a>.
There's a lot of information there to help you understand how it works and the most common pitfalls to avoid.
</p>
<p>
To report a bug please start a new topic in the
<a href="https://wordpress.org/support/plugin/loco-translate" target="_blank">plugin support forum</a>,
but please check the <a href="<?php echo esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin/faqs') )?>">FAQs</a>
for similar issues first. If you decide to submit a bug report please post enough
<a href="<?php echo esc_url( apply_filters('loco_external','https://localise.biz/wordpress/plugin/faqs/debug-info') )?>">relevant detail</a>
for us to reproduce your issue.
</p>

View File

@@ -0,0 +1,25 @@
<?php
/**
* Notice before creating a PO that an existing one can be copied
*/
$this->extend('../layout');
$help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/templates');
/* @var Loco_mvc_ViewParams $params */
/* @var Loco_mvc_ViewParams $ext */
/* @var Loco_mvc_ViewParams $skip */
/* @var Loco_mvc_ViewParams $copy */
?>
<div class="panel panel-warning">
<h3 class="has-icon">
<?php esc_html_e('Template missing','loco-translate')?>
</h3>
<p>
<?php esc_html_e('You can copy an existing PO file (recommended), or extract directly from source (advanced)','loco-translate')?>.
</p>
<p>
<a href="<?php $copy->e('link')?>" class="button button-link button-primary has-icon icon-copy"><?php $copy->e('text')?></a>
<a href="<?php $ext->e('link')?>" class="button button-link has-icon icon-add"><?php $ext->e('text')?></a>
<a href="<?php $skip->e('link')?>" class="button button-link has-icon icon-next"><?php $skip->e('text')?></a>
</p>
</div>

View File

@@ -0,0 +1,174 @@
<?php
/**
* Initialize a new PO translations file
*/
$this->extend('../layout');
/* @var Loco_mvc_ViewParams $params */
/* @var Loco_mvc_ViewParams $prompt */
if( $params->has('prompt') ):?>
<div class="panel panel-info">
<p><?php
$prompt->e('title')?>.
<a href="<?php $prompt->e('link')?>"><?php $prompt->e('text')?></a>.
</p>
</div><?php
endif?>
<div class="panel">
<h2><?php $params->e('subhead')?></h2>
<p><?php $params->e('summary')?></p>
<form action="" method="post" enctype="application/x-www-form-urlencoded" id="loco-poinit"><?php
/* @var Loco_mvc_HiddenFields $hidden */
$hidden->_e();?>
<table class="form-table">
<tbody class="loco-locales">
<tr>
<th scope="row">
<label for="loco-select-locale">
1. <?php esc_html_e('Choose a language','loco-translate')?>:
</label>
</th>
<td>
<fieldset>
<label for="loco-use-selector-1">
<span><input type="radio" name="use-selector" value="1" checked id="loco-use-selector-1" /></span>
<?php esc_attr_e('WordPress language','loco-translate')?>:
</label>
<div>
<span class="lang nolang"></span>
<select id="loco-select-locale" name="select-locale">
<option value=""><?php esc_attr_e('No language selected','loco-translate')?></option>
<optgroup label="<?php esc_attr_e( 'Installed languages', 'loco-translate' )?>"><?php
/* @var Loco_mvc_ViewParams[] $installed */
foreach( $installed as $option ):?>
<option value="<?php $option->e('value')?>" data-icon="<?php $option->e('icon')?>"<?php $option->e('selected')?>><?php $option->e('label')?></option><?php
endforeach;?>
</optgroup>
<optgroup label="<?php esc_attr_e( 'Available languages', 'loco-translate' )?>"><?php
/* @var Loco_mvc_ViewParams[] $locales */
foreach( $locales as $option ):?>
<option value="<?php $option->e('value')?>" data-icon="<?php $option->e('icon')?>"<?php $option->e('selected')?>><?php $option->e('label')?></option><?php
endforeach;?>
</optgroup>
</select>
</div>
</fieldset>
<fieldset class="disabled">
<label for="loco-use-selector-0">
<span><input type="radio" name="use-selector" value="0" id="loco-use-selector-0" <?php $params->has('custom') && print 'checked '?>/></span>
<?php esc_attr_e('Custom language','loco-translate')?>:
</label>
<div>
<span class="lang nolang"></span>
<span class="loco-clearable"><input type="text" maxlength="14" name="custom-locale" value="<?php $params->e('custom')?>" /></span>
</div>
</fieldset>
</td>
</tr>
</tbody>
<tbody class="loco-paths">
<tr valign="top">
<th scope="row">
<label>
2. <?php esc_html_e('Choose a location','loco-translate')?>:
</label>
</th>
<td>
<a href="<?php
/* @var Loco_mvc_ViewParams $help */
$help->e('href')?>#locations" class="has-icon icon-help" target="_blank" tabindex="-1"><?php $help->e('text')?></a>
</td>
</tr><?php
$choiceId = 0;
/* @var Loco_mvc_ViewParams[] $locations */
foreach( $locations as $typeId => $location ):?>
<tr class="compact">
<td>
<p class="description"><?php $location->e('label')?>:</p>
</td>
<td><?php
/* @var Loco_mvc_FileParams $choice */
/* @var Loco_mvc_FileParams $parent */
foreach( $location['paths'] as $choice ):
$parent = $choice['parent'];
$offset = sprintf('%u',++$choiceId);?>
<p><?php
if( $choice->disabled ):?>
<label class="for-disabled">
<span class="icon icon-lock"></span>
<input type="radio" name="select-path" class="disabled" disabled /><?php
else:?>
<label>
<input type="radio" name="select-path" value="<?php echo $offset?>" <?php echo $choice->checked?> />
<input type="hidden" name="path[<?php echo $offset?>]" value="<?php $choice->e('hidden')?>" /><?php
endif?>
<code class="path"><?php $parent->e('relpath')?>/<?php echo $choice->holder?></code>
</label>
</p><?php
endforeach?>
</td>
</tr><?php
endforeach;?>
</tbody><?php
if( $params->has('sourceLocale') ):?>
<tbody id="loco-copy" data-locale="<?php $params->e('sourceLocale')?>">
<tr>
<th scope="row" rowspan="4">
3. <?php esc_html_e('Template options','loco-translate')?>:
</th>
<td>
<a href="<?php $help->e('href')?>#copy" class="has-icon icon-help" target="_blank" tabindex="-1"><?php $help->e('text')?></a>
</td>
</tr>
<tr class="compact">
<td>
<p>
<label>
<input type="radio" name="strip" value="" />
<?php $params->f('sourceLocale', __('Copy target translations from "%s"','loco-translate') )?>
</label>
</p>
<p>
<label>
<input type="radio" name="strip" value="1" checked />
<?php esc_html_e('Just copy English source strings','loco-translate')?>
</label>
</p>
</td>
</tr>
<tr class="compact">
<td>
<p>
<label>
<input type="checkbox" name="json" value="1" checked />
<?php esc_html_e('Merge strings from related JSON files','loco-translate')?>
</label>
</p>
</td>
</tr>
<tr class="compact">
<td>
<p>
<label>
<input type="checkbox" name="link" value="1" checked />
<?php esc_html_e('Use this file as template when running Sync','loco-translate')?>
</label>
</p>
</td>
</tr>
</tbody><?php
endif?>
</table>
<p class="submit">
<button type="submit" class="button button-large button-primary" disabled><?php esc_html_e('Start translating','loco-translate')?></button>
</p>
</form>
</div>

View File

@@ -0,0 +1,46 @@
<?php
/**
* Initialize a new POT template file
*/
$this->extend('../layout');
$help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/templates');
?>
<div class="panel">
<h2><?php $params->e('subhead')?></h2>
<p>
<?php esc_html_e('Source files to scan:','loco-translate')?>
<strong><?php $scan->n('count')?></strong>
<span>(<?php
// Translators: Where %s is the size of a file
$scan->f( 'size', __('%s on disk','loco-translate') );?>, <?php
// Translators: Where %s is the size of a file
$scan->f( 'largest', __('largest is %s','loco-translate') )?>)</span>
</p><?php
if( $n = $scan->skip ):?>
<p>
<em><?php
// Translators: (1) Number of files excluded (2) the maximum size of file that was included
self::e( _n('Excludes %1$s file over %2$s','Excludes %1$s files over %2$s',$n,'loco-translate'), $n, $scan->large )?>.
<a class="icon icon-help" href="<?php echo esc_url(apply_filters('loco_external','https://localise.biz/wordpress/plugin/faqs/skipped-files'))?>" target="_blank"><span class="screen-reader-text">Help</span></a>
</em>
</p><?php
endif?>
<p>
<?php esc_html_e('Strings will be extracted to:','loco-translate')?>
<code class="path"><?php $pot->e('relpath')?></code>
</p>
<form action="" method="post" enctype="application/x-www-form-urlencoded" id="loco-potinit"><?php
foreach( $hidden as $name => $value ):?>
<input type="hidden" name="<?php echo $name?>" value="<?php $hidden->e($name)?>" /><?php
endforeach;?>
<p class="submit">
<button type="submit" class="button button-large button-primary" disabled><?php esc_html_e('Create template','loco-translate')?></button>
<a href="<?php echo esc_url($help)?>" class="button button-large button-link" target="_blank"><?php
esc_html_e('About templates','loco-translate')?></a>
</p>
</form>
</div>

View File

@@ -0,0 +1,33 @@
<?php
/**
* Notice before creating a PO that there is no POT.
*/
$this->extend('../layout');
$help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/templates');
/* @var Loco_mvc_ViewParams $params */
/* @var Loco_mvc_ViewParams $ext */
/* @var Loco_mvc_ViewParams $skip */
/* @var Loco_mvc_ViewParams $conf */
?>
<div class="panel panel-warning">
<h3 class="has-icon">
<?php esc_html_e('Template missing','loco-translate')?>
</h3><?php
if( $params->has('pot') ):?>
<p>
<?php esc_html_e("This bundle's template file doesn't exist yet. We recommend you create it before adding languages",'loco-translate')?>.
</p><?php
else:?>
<p>
<?php esc_html_e("This bundle doesn't define a translations template file",'loco-translate')?>.
</p><?php
endif?>
<p>
<a href="<?php $ext->e('link')?>" class="button button-link has-icon icon-add"><?php $ext->e('text')?></a>
<a href="<?php $skip->e('link')?>" class="button button-link has-icon icon-next"><?php $skip->e('text')?></a><?php
if( $this->has('conf') ):?>
<a href="<?php $conf->e('link')?>" class="button button-link has-icon icon-wrench"><?php $conf->e('text')?></a><?php endif?>
<a class="button button-link has-icon icon-help" href="<?php echo esc_url($help)?>" target="_blank"><?php esc_html_e('About templates','loco-translate')?></a>
</p>
</div>

View File

@@ -0,0 +1,62 @@
<?php
/**
* Generic upload template for installing a file into a translation set.
*/
$this->extend('../layout');
/* @var Loco_Locale $locale */
?>
<form action="" method="post" enctype="multipart/form-data" id="loco-main"><?php
/* @var Loco_mvc_HiddenFields $hidden */
$hidden->_e();?>
<div class="panel">
<h2>
<?php self::e( __('Choose a location','loco-translate') );?>
</h2>
<table class="form-table">
<tbody class="loco-paths"><?php
/* @var Loco_mvc_ViewParams[] $locations */
foreach( $locations as $typeId => $location ):?>
<tr class="compact">
<td>
<p class="description"><?php $location->e('label')?>:</p>
</td>
<td><?php
/* @var Loco_mvc_ViewParams $choice */
/* @var Loco_mvc_FileParams $parent */
foreach( $location['paths'] as $choice ):
$parent = $choice['parent'];?>
<p>
<label>
<input type="radio" name="dir" value="<?php $parent->e('relpath')?>" />
<code class="path"><?php $parent->e('relpath')?>/<?php echo $choice->holder?></code>
</label>
</p><?php
endforeach?>
</td>
</tr><?php
endforeach?>
</tbody>
</table>
</div>
<div class="panel panel-info">
<h2>
<?php esc_html_e('Upload PO file','loco-translate')?>
</h2>
<p><?php
// translators: This is HTML formatted. (1) placeholder for language code, (2) Example language code
echo wp_kses (
sprintf( __('Your file must be named as shown above where %1$s is the language code, e.g. %2$s','loco-translate'), '<code>{locale}</code>', '<code>'.$locale.'</code>' ),
['code'=>[]]
)?>
</p>
<p>
<input type="file" name="f" />
</p>
<p class="submit">
<button type="submit" class="button button-large button-primary has-icon icon-upload" disabled><?php esc_html_e('Upload','loco-translate')?></button>
</p>
</div>
</form>

View File

@@ -0,0 +1,101 @@
<?php
/**
* Base layout for all admin pages
*/
/* @var Loco_mvc_View $this */
/* @var Loco_mvc_ViewParams $params */
?><div class="wrap" id="loco-admin"><?php
if( $this->has('breadcrumb') ):?>
<h1>
<ul><?php
/* @var Loco_mvc_ViewParams[] $breadcrumb */
foreach( $breadcrumb as $item ):?>
<li><?php
if( $item->href ):?>
<a href="<?php $item->e('href')?>">
<?php $item->e('name')?>
</a><?php
else:?>
<span>
<?php $item->e('name')?>
</span><?php
endif?>
</li><?php
endforeach?>
</ul>
</h1><?php
elseif( $this->has('title') ):?>
<h1>
<?php $params->e('title')?>
</h1><?php
endif;
if( $this->has('tabs') ):?>
<h2 class="nav-tab-wrapper"><?php
/* @var Loco_mvc_ViewParams[] $tabs */
foreach( $tabs as $item ):?>
<a href="<?php $item->e('href')?>" class="nav-tab<?php echo $item->active?' nav-tab-active':''?>">
<?php $item->e('name')?>
</a><?php
endforeach;?>
</h2><?php
endif?>
<div id="loco-notices">
<noscript>
<div class="panel panel-danger">
<p>
<strong class="has-icon icon-warn">JavaScript disabled:</strong>
<span>Loco Translate requires JavaScript for most functions to work as expected.</span>
</p>
</div>
</noscript><?php
// flush message buffer
do_action('loco_admin_notices');
// standard file system dialogues
if( $params->has('fsFields') ):
echo $this->render('common/inc-fsconn');
endif?>
</div>
<div id="loco-content">
<?php echo $this->_content;?>
</div>
</div>
<?php
/* @var null|Loco_mvc_ViewParams $js */
if( $this->has('js') && $js instanceof Loco_mvc_ViewParams ):?><script>
/*<![CDATA[*/
window.loco = { conf: <?php echo $js->exportJson()?> };
document.addEventListener && document.addEventListener('DOMContentLoaded', function(loco,v,s){
return function() {
function enumJs(s) {
let i = s.length;
while( 0 !== i-- ){
if( null == document.getElementById(s[i]+'-js') ){
return false;
}
}
return true;
}
if( window.loco !== loco || ! loco.validate || ! loco.validate(v) || ! enumJs(s) ) {
var t = 'Scripts on this page are not running as expected. Please empty all relevant caches and refresh the screen.\nIf the issue persists, try disabling other plugins that may be modifying the functionality of Loco Translate.';
if( loco.notices && loco.notices.warn ){
loco.notices.warn(t).link('https://localise.biz/wordpress/plugin/faqs/script-warnings','See FAQ');
}
else {
throw new Error(t);
}
}
};
}( loco, <?php $js->j('$v')?>, <?php $js->j('$js')?> ) );
/*]]>*/
</script><?php
endif;

View File

@@ -0,0 +1,8 @@
<?php
/**
* Generic listing of bundles of a given type
*/
$this->extend('../layout');
echo $this->render('../common/inc-table-filter');
echo $this->render('inc-table');

View File

@@ -0,0 +1,43 @@
<?php
/**
* List of bundles
*/
?>
<table class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th data-sort-type="s">
<?php esc_html_e('Bundle name', 'loco-translate')?>
</th>
<th data-sort-type="s">
<?php esc_html_e('Text domain','loco-translate')?>
</th>
<th data-sort-type="n">
<?php esc_html_e('Last modified','loco-translate')?>
</th>
<th data-sort-type="n">
<?php esc_html_e('Sets','loco-translate')?>
</th>
</tr>
</thead>
<tbody><?php
/* @var Loco_mvc_ViewParams[] $bundles */
foreach( $bundles as $bundle ):?>
<tr id="loco-<?php $bundle->e('id')?>">
<td data-sort-value="<?php $bundle->e('name')?>">
<a href="<?php $bundle->e('view')?>"><?php $bundle->e('name')?></a>
</td>
<td>
<?php $bundle->e('dflt')?>
</td>
<td data-sort-value="<?php $bundle->f('time','%u')?>">
<time datetime="<?php $bundle->date('time','c')?>"><?php $bundle->time ? $bundle->date('time') : print '--'?></time>
</td>
<td data-sort-value="<?php $bundle->f('size','%u')?>">
<?php $bundle->n('size')?>
</td>
</tr><?php
endforeach;?>
</tbody>
</table>

View File

@@ -0,0 +1,54 @@
<?php
/**
* Listing of installed languages
*/
$this->extend('../layout');
echo $this->render('../common/inc-table-filter');
?>
<table class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th data-sort-type="s">
<?php esc_html_e('Locale name', 'loco-translate')?>
</th>
<th data-sort-type="s">
<?php esc_html_e('Locale code', 'loco-translate')?>
</th>
<th data-sort-type="n">
<?php esc_html_e('Last modified','loco-translate')?>
</th>
<th data-sort-type="n">
<?php esc_html_e('Files found', 'loco-translate')?>
</th>
<th data-sort-type="s">
<?php esc_html_e('Site language', 'loco-translate')?>
</th>
</tr>
</thead>
<tbody><?php
/* @var Loco_mvc_ViewParams[] $locales */
foreach( $locales as $p ):?>
<tr>
<td>
<a href="<?php $p->e('href')?>" class="row-title">
<span <?php echo $p->lattr?>><code><?php $p->e('lcode')?></code></span>
<span><?php $p->e('lname')?></span>
</a>
</td>
<td>
<?php $p->e('lcode')?>
</td>
<td data-sort-value="<?php $p->f('time','%u')?>">
<time datetime="<?php $p->date('time','c')?>"><?php $p->time ? $p->date('time') : print '--'?></time>
</td>
<td data-sort-value="<?php $p->e('nfiles')?>">
<?php $p->n('nfiles',0)?>
</td>
<td class="loco-<?php echo $p->active?'is':'not' ?>-active">
<?php $p->e('used')?>
</td>
</tr><?php
endforeach?>
</tbody>
</table>

View File

@@ -0,0 +1,61 @@
<?php
/**
* Root admin screen
*/
/* @var Loco_mvc_View $this */
$this->extend('layout');
?>
<div class="panel panel-info">
<p class="has-lang">
<span <?php echo $siteLocale->attr?>><code><?php $siteLocale->e('code')?></code></span>
<span><?php
// translators: %s will be replaced with the full name of the site language
printf( esc_html( __('The language of this site is %s.','loco-translate') ), $siteLocale->link );
if( $params->has('adminLocale') ): echo ' ';
// translators: %s will be replaced with the full name of the user profile's admin language
printf( esc_html( __('Your admin language is %s.','loco-translate') ), $adminLocale->link );
endif?>
</span>
</p>
</div><?php
if( $recent ):?>
<div>
<h2>
<?php esc_html_e('Recently updated:','loco-translate')?>
</h2>
<p>
<?php esc_html_e("Translations have been recently modified in the following bundles",'loco-translate')?>:
</p><?php
echo $this->render('list/inc-table', [ 'bundles' => $recent ] );?>
</div><?php
endif;?>
<div>
<h2>
<?php esc_html_e('Active theme:','loco-translate')?>
</h2><?php
echo $this->render('list/inc-table', [ 'bundles' => [$theme] ] )?>
<p>
<a href="<?php $this->route('theme')->e('href')?>" class="button button-link has-raquo"><?php esc_html_e('See all themes','loco-translate')?></a>
</p>
</div>
<?php if( $plugins ):?>
<div>
<h2>
<?php esc_html_e('Running plugins:','loco-translate')?>
</h2>
<p>
<?php esc_html_e('These plugins have recently loaded translation files into the admin area','loco-translate')?>:
</p><?php
echo $this->render('list/inc-table', [ 'bundles' => $plugins ] )?>
<p>
<a href="<?php $this->route('plugin')->e('href')?>" class="button button-link has-raquo"><?php esc_html_e('See all plugins','loco-translate')?></a>
</p>
</div><?php
endif;