File manager - Edit - /home/theblueo/tv/fb4e3b/bundle.tar
Back
SetupController.php 0000666 00000015120 15214044162 0010423 0 ustar 00 <?php /** * */ class Loco_admin_bundle_SetupController extends Loco_admin_bundle_BaseController { /** * {@inheritdoc} */ public function init(){ parent::init(); $bundle = $this->getBundle(); // translators: where %s is a plugin or theme $this->set( 'title', sprintf( __('Set up %s','loco'),$bundle->getName() ) ); } /** * {@inheritdoc} */ public function getHelpTabs(){ return array ( __('Setup tab','loco') => $this->view('tab-bundle-setup'), ); } /** * {@inheritdoc} */ public function render(){ $this->prepareNavigation()->add( __('Bundle setup','loco') ); $bundle = $this->getBundle(); $action = 'setup:'.$bundle->getId(); // execute auto-configure if posted $post = Loco_mvc_PostParams::get(); if( $post->has('auto-setup') && $this->checkNonce( 'auto-'.$action) ){ if( 0 === count($bundle) ){ $bundle->createDefault(); } foreach( $bundle as $project ){ if( ! $project->getPot() && ( $file = $project->guessPot() ) ){ $project->setPot( $file ); } } // forcefully add every additional project into bundle foreach( $bundle->invert() as $project ){ if( ! $project->getPot() && ( $file = $project->guessPot() ) ){ $project->setPot( $file ); } $bundle[] = $project; } $this->saveBundle(); $bundle = $this->getBundle(); $this->set('auto', null ); } // execute XML-based config if posted else if( $post->has('xml-setup') && $this->checkNonce( 'xml-'.$action) ){ $bundle->clear(); $model = new Loco_config_XMLModel; $model->loadXml( trim( $post['xml-content'] ) ); $reader = new Loco_config_BundleReader($bundle); $reader->loadModel( $model ); $this->saveBundle(); $bundle = $this->getBundle(); $this->set('xml', null ); } // execute JSON-based config if posted else if( $post->has('json-setup') && $this->checkNonce( 'json-'.$action) ){ $bundle->clear(); $model = new Loco_config_ArrayModel; $model->loadJson( trim( $post['json-content'] ) ); $reader = new Loco_config_BundleReader($bundle); $reader->loadModel( $model ); $this->saveBundle(); $bundle = $this->getBundle(); $this->set('json', null ); } // execute reset if posted else if( $post->has('reset-setup') && $this->checkNonce( 'reset-'.$action) ){ $this->resetBundle(); $bundle = $this->getBundle(); } // bundle author links $info = $bundle->getHeaderInfo(); $this->set( 'credit', $info->getAuthorCredit() ); // render according to current configuration method (save type) $configured = $this->get('force') or $configured = $bundle->isConfigured(); $notices = new ArrayIterator; $this->set('notices', $notices ); // collect configuration warnings foreach( $bundle as $project ){ $potfile = $project->getPot(); if( ! $potfile ){ $notices[] = sprintf('No translation template for the "%s" text domain', $project->getSlug() ); } } // if extra files found consider incomplete if( $bundle->isTheme() || ( $bundle->isPlugin() && ! $bundle->isSingleFile() ) ){ $unknown = Loco_package_Inverter::export($bundle); $n = 0; foreach( $unknown as $ext => $files ){ $n += count($files); } if( $n ){ $notices[] = sprintf( _n("One file can't be matched to a known set of strings","%s files can't be matched to a known set of strings",$n,'loco'), number_format($n) ); } } // display setup options if at least one option specified $doconf = false; // enable form to invoke auto-configuration if( $this->get('auto') ){ $fields = new Loco_mvc_HiddenFields(); $fields->setNonce( 'auto-'.$action ); $this->set('autoFields', $fields ); $doconf = true; } // enable form to paste XML config if( $this->get('xml') ){ $fields = new Loco_mvc_HiddenFields(); $fields->setNonce( 'xml-'.$action ); $this->set('xmlFields', $fields ); $doconf = true; } // enable form to paste JSON config (via remote lookup) if( $this->get('json') ){ $fields = new Loco_mvc_HiddenFields( array( 'json-content' => '', 'version' => $info->Version, ) ); $fields->setNonce( 'json-'.$action ); $this->set('jsonFields', $fields ); // other information for looking up bundle via api $this->set('vendorSlug', $bundle->getSlug() ); // remote config is done via JavaScript $this->enqueueScript('setup'); $apiBase = apply_filters( 'loco_api_url', 'https://localise.biz/api' ); $this->set('js', new Loco_mvc_ViewParams( array( 'apiUrl' => $apiBase.'/wp/'.strtolower( $bundle->getType() ), ) ) ); $doconf = true; } // display configurator if configurating if( $doconf ){ return $this->view( 'admin/bundle/setup/conf' ); } // else set configurator links back to self with required option // ... if( ! $configured || ! count($bundle) ){ return $this->view( 'admin/bundle/setup/none' ); } if( 'db' === $configured ){ // form for resetting config $fields = new Loco_mvc_HiddenFields(); $fields->setNonce( 'reset-'.$action ); $this->set( 'reset', $fields ); return $this->view('admin/bundle/setup/saved'); } if( 'internal' === $configured ){ return $this->view('admin/bundle/setup/core'); } if( 'file' === $configured ){ return $this->view('admin/bundle/setup/author'); } if( count($notices) ){ return $this->view('admin/bundle/setup/partial'); } return $this->view('admin/bundle/setup/meta'); } } DebugController.php 0000666 00000002664 15214044162 0010362 0 ustar 00 <?php /** * Bundle debugger. * Shows bundle diagnostics and highlights problems */ class Loco_admin_bundle_DebugController extends Loco_admin_bundle_BaseController { /** * {@inheritdoc} */ public function init(){ parent::init(); $bundle = $this->getBundle(); $this->set('title', 'Debug: '.$bundle ); } /** * {@inheritdoc} */ public function render(){ $this->prepareNavigation()->add( __('Bundle diagnostics','loco') ); $bundle = $this->getBundle(); $debugger = new Loco_package_Debugger($bundle); $this->set('notices', $notices = new Loco_mvc_ViewParams ); /* @var $notice Loco_error_Exception */ foreach( $debugger as $notice ){ $notices[] = new Loco_mvc_ViewParams( array( 'style' => 'notice inline notice-'.$notice->getType(), 'title' => $notice->getTitle(), 'body' => $notice->getMessage(), ) ); } $meta = $bundle->getHeaderInfo(); $this->set('meta', new Loco_mvc_ViewParams( array( 'vendor' => $meta->getVendorHost(), 'author' => $meta->getAuthorCredit(), ) ) ); if( count($bundle) ){ $writer = new Loco_config_BundleWriter( $bundle ); $this->set( 'xml', $writer->toXml() ); } return $this->view('admin/bundle/debug'); } } ViewController.php 0000666 00000027032 15214044162 0010242 0 ustar 00 <?php /** * Bundle overview. * First tier bundle view showing resources across all projects */ class Loco_admin_bundle_ViewController extends Loco_admin_bundle_BaseController { /** * {@inheritdoc} */ public function init(){ parent::init(); $bundle = $this->getBundle(); $this->set('title', $bundle->getName() ); $this->enqueueStyle('bundle'); } /** * {@inheritdoc} */ public function getHelpTabs(){ return array ( __('Overview','default') => $this->view('tab-bundle-view'), ); } /** * Generate a link for a specific file resource within a project * @return string */ private function getResourceLink( $page, Loco_package_Project $project, Loco_gettext_Metadata $meta, array $args = array() ){ $args['path'] = $meta->getPath(false); return $this->getProjectLink( $page, $project, $args ); } /** * Generate a link for a project, but without being for a specific file * @return string */ private function getProjectLink( $page, Loco_package_Project $project, array $args = array() ){ $args['bundle'] = $this->get('bundle'); $args['domain'] = $project->getId(); return $this->getLink( $page, $args ); } /** * Generate a link for the same type of bundle as this one * @return string */ private function getLink( $page, array $args ){ $route = strtolower( $this->get('type') ).'-'.$page; return Loco_mvc_AdminRouter::generate( $route, $args ); } /** * Initialize view parameters for a project * @return Loco_mvc_ViewParams */ private function createProjectParams( Loco_package_Project $project ){ $name = $project->getName(); $domain = $project->getDomain()->getName(); $slug = $project->getSlug(); $p = new Loco_mvc_ViewParams( array ( 'id' => $project->getId(), 'name' => $name, 'slug' => $slug, 'domain' => $domain, 'short' => ! $slug || $project->isDomainDefault() ? $domain : $domain.'→'.$slug, ) ); // POT template file $file = $project->getPot(); if( $file && $file->exists() ){ $meta = Loco_gettext_Metadata::load($file)->persistIfDirty( 0, true ); $p['pot'] = new Loco_mvc_ViewParams( array( // POT info 'name' => $file->basename(), 'time' => $file->modified(), // POT links 'info' => $this->getResourceLink('file-info', $project, $meta ), 'edit' => $this->getResourceLink('file-edit', $project, $meta ), ) ); } // PO/MO files $po = $project->findLocaleFiles('po'); $mo = $project->findLocaleFiles('mo'); $p['po'] = $this->createProjectPairs( $project, $po, $mo ); // also pull invalid files so everything is available to the UI $mo = $project->findNotLocaleFiles('mo'); $po = $project->findNotLocaleFiles('po')->augment( $project->findNotLocaleFiles('pot') ); $p['_po'] = $this->createProjectPairs( $project, $po, $mo ); // always offer msginit even if we find out later we can't extract any strings $p['nav'][] = new Loco_mvc_ViewParams( array( 'href' => $this->getProjectLink('msginit', $project ), 'name' => __('New language','loco'), 'icon' => 'add', ) ); // offer template editing if permitted if( ! $project->isPotLocked() ){ $pot = $project->getPot(); if( $pot && $pot->exists() ){ $p['pot'] = $pot; $meta = Loco_gettext_Metadata::load($pot)->persistIfDirty( 0, true ); $p['nav'][] = new Loco_mvc_ViewParams( array( 'href' => $this->getResourceLink('file-edit', $project, $meta ), 'name' => __('Edit template','loco'), 'icon' => 'pencil', ) ); } // else offer creation of new Template else { $p['nav'][] = new Loco_mvc_ViewParams( array( 'href' => $this->getProjectLink('xgettext', $project ), 'name' => __('Create template','loco'), 'icon' => 'add', ) ); } } return $p; } /** * Collect PO/MO pairings, ignoring any PO that is in use as a template */ private function createPairs( Loco_fs_FileList $po, Loco_fs_FileList $mo, Loco_fs_File $pot = null ){ $pairs = array(); /* @var $pofile Loco_fs_LocaleFile */ foreach( $po as $pofile ){ if( $pot && $pofile->equal($pot) ){ continue; } $pair = array( $pofile, null ); $mofile = $pofile->cloneExtension('mo'); if( $mofile->exists() ){ $pair[1] = $mofile; } $pairs[] = $pair; } /* @var $mofile Loco_fs_LocaleFile */ foreach( $mo as $mofile ){ $pofile = $mofile->cloneExtension('po'); if( $pot && $pofile->equal($pot) ){ continue; } if( ! $pofile->exists() ){ $pairs[] = array( null, $mofile ); } } return $pairs; } /** * Initialize view parameters for each row representing a localized resource pair * @return array collection of entries corresponding to available PO/MO pair. */ private function createProjectPairs( Loco_package_Project $project, Loco_fs_LocaleFileList $po, Loco_fs_LocaleFileList $mo ){ // populate official locale names for all found, or default to our own if( $locales = $po->getLocales() + $mo->getLocales() ){ $api = new Loco_api_WordPressTranslations; /* @var $locale Loco_Locale */ foreach( $locales as $tag => $locale ){ $locale->fetchName($api) or $locale->buildName() or $locale->setName($tag); } } // collate as unique [PO,MO] pairs ensuring canonical template excluded $pairs = $this->createPairs( $po, $mo, $project->getPot() ); $rows = array(); foreach( $pairs as $pair ){ // favour PO file if it exists list( $pofile, $mofile ) = $pair; $file = $pofile or $file = $mofile; // establish locale, or assume invalid $locale = null; if( 'pot' !== $file->extension() ){ $tag = $file->getSuffix(); if( isset($locales[$tag]) ){ $locale = $locales[$tag]; } } $rows[] = $this->createFileParams( $project, $file, $locale ); } return $rows; } /** * */ private function createFileParams( Loco_package_Project $project, Loco_fs_File $file, Loco_Locale $locale = null ){ // Pull Gettext meta data from cache if possible // TODO save write when cached version was used $meta = Loco_gettext_Metadata::load($file)->persistIfDirty( 0, true ); // Establish whether translations are official or otherwise $dir = new Loco_fs_LocaleDirectory( $file->dirname() ); // Retuen data required for PO table row return new Loco_mvc_ViewParams( array ( // locale info 'lcode' => $locale ? (string) $locale : '', 'lname' => $locale ? $locale->getName() : '', 'lattr' => $locale ? 'class="'.$locale->getIcon().'" lang="'.$locale->lang.'"' : '', // file info 'meta' => $meta, 'name' => $file->basename(), 'time' => $file->modified(), 'todo' => $meta->countIncomplete(), 'total' => $meta->getTotal(), // author / contrib 'store' => $dir->getTypeLabel( $dir->getTypeId() ), // links 'info' => $this->getResourceLink('file-info', $project, $meta ), 'edit' => $this->getResourceLink('file-edit', $project, $meta ), 'delete' => $this->getResourceLink('file-delete', $project, $meta ), 'copy' => $this->getProjectLink('msginit', $project, array( 'source' => $meta->getPath(false) ) ), ) ); } /** * Prepare view parameters for all projects in a bundle * @return array<Loco_mvc_ViewParams> */ private function createBundleListing( Loco_package_Bundle $bundle ){ $projects = array(); /* @var $project Loco_package_Project */ foreach( $bundle as $project ){ $projects[] = $this->createProjectParams($project); } return $projects; } /** * {@inheritdoc} */ public function render(){ $this->prepareNavigation(); $bundle = $this->getBundle(); $this->set('name', $bundle->getName() ); // bundle may not be fully configured $configured = $bundle->isConfigured(); // Hello Dolly is an exception. don't show unless configured deliberately if( ! $configured && 'hello.php' === $bundle->getHandle() && 'Hello Dolly' === $bundle->getName() ){ $this->set( 'redirect', Loco_mvc_AdminRouter::generate('core-view') ); return $this->view('admin/bundle/alias'); } // Collect all configured projects $projects = $this->createBundleListing( $bundle ); $unknown = array(); // sniff additional unknown files if bundle is a theme or directory-based plugin that's been auto-detected if( 'file' === $configured || 'internal' === $configured ){ // presumed complete } else if( $bundle->isTheme() || ( $bundle->isPlugin() && ! $bundle->isSingleFile() ) ){ // TODO This needs absracting into the Loco_package_Inverter class $prefixes = array(); $po = new Loco_fs_LocaleFileList; $mo = new Loco_fs_LocaleFileList; foreach( Loco_package_Inverter::export($bundle) as $ext => $files ){ $list = 'mo' === $ext ? $mo : $po; foreach( $files as $file ){ $file = new Loco_fs_LocaleFile($file); $list->addLocalized( $file ); // Only look in system locations if locale is valid and domain/prefix available $locale = $file->getLocale(); if( $locale->isValid() && ( $domain = $file->getPrefix() ) ){ $prefixes[$domain] = true; } } } // pick up given files in system locations only foreach( $prefixes as $domain => $_bool ){ $dummy = new Loco_package_Project( $bundle, new Loco_package_TextDomain($domain), '' ); $bundle->addProject( $dummy ); // <- required to configure locations $dummy->excludeTargetPath( $bundle->getDirectoryPath() ); $po->augment( $dummy->findLocaleFiles('po') ); $mo->augment( $dummy->findLocaleFiles('mo') ); } // a fake project is required to disable functions that require a configured project $dummy = new Loco_package_Project( $bundle, new Loco_package_TextDomain(''), '' ); $unknown = $this->createProjectPairs( $dummy, $po, $mo ); } $this->set('projects', $projects ); $this->set('unknown', $unknown ); return $this->view( 'admin/bundle/view' ); } } ConfController.php 0000666 00000010737 15214044162 0010221 0 ustar 00 <?php /** * Bundle configuration page */ class Loco_admin_bundle_ConfController extends Loco_admin_bundle_BaseController { /** * {@inheritdoc} */ public function init(){ parent::init(); $this->enqueueStyle('config'); $this->enqueueScript('config'); $bundle = $this->getBundle(); // translators: where %s is a plugin or theme $this->set( 'title', sprintf( __('Configure %s','loco'),$bundle->getName() ) ); $post = Loco_mvc_PostParams::get(); // always set a nonce for current bundle $nonce = $this->setNonce( $this->get('_route').'-'.$this->get('bundle') ); $this->set('nonce', $nonce ); try { // Save configuration if posted if( $post->has('conf') ){ if( ! $post->name ){ $post->name = $bundle->getName(); } $this->checkNonce( $nonce->action ); $model = new Loco_config_FormModel; $model->loadForm( $post ); // configure bundle from model in full $bundle->clear(); $reader = new Loco_config_BundleReader( $bundle ); $reader->loadModel( $model ); $this->saveBundle(); } // Delete configuration if posted else if( $post->has('unconf') ){ $this->resetBundle(); } } catch( Exception $e ){ Loco_error_AdminNotices::warn( $e->getMessage() ); } } /** * {@inheritdoc} */ public function getHelpTabs(){ return array ( __('Advanced tab','loco') => $this->view('tab-bundle-conf'), ); } /** * {@inheritdoc} */ public function render() { $bundle = $this->getBundle(); $base = $bundle->getDirectoryPath(); // parent themes are inherited into bundle, we don't want them in the child theme config if( $bundle->isTheme() && ( $parent = $bundle->getParentTheme() ) ){ $this->set( 'parent', new Loco_mvc_ViewParams( array( 'name' => $parent->getName(), 'href' => Loco_mvc_AdminRouter::generate('theme-conf', array( 'bundle' => $parent->getSlug() ) + $_GET ), ) ) ); } // render postdata straight back to form if sent $data = Loco_mvc_PostParams::get(); // else build initial data from current bundle state if( ! $data->has('conf') ){ if( 0 === count($bundle) ){ $bundle->createDefault(''); } $writer = new Loco_config_BundleWriter($bundle); $data = $writer->toForm(); // removed parent bundle configs, as they are inherited /* @var Loco_package_Project $project */ foreach( $bundle as $i => $project ){ if( isset($parent) && $parent->hasProject($project) ){ $data['conf'][$i]['removed'] = true; } } } // build config blocks for form $i = 0; $conf = array(); foreach( $data['conf'] as $raw ){ if( empty($raw['removed']) ){ $slug = $raw['slug']; $domain = $raw['domain'] or $domain = 'untitled'; $raw['prefix'] = sprintf('conf[%u]', $i++ ); $raw['short'] = ! $slug || ( $slug === $domain ) ? $domain : $domain.'→'.$slug; $conf[] = new Loco_mvc_ViewParams( $raw ); } } // bundle level configs $name = $bundle->getName(); $excl = $data['exclude']; // access to type of configuration that's currently saved $this->set('saved', $bundle->isConfigured() ); // link to author if there are config problems $info = $bundle->getHeaderInfo(); $this->set('author', $info->getAuthorLink() ); // link for downloading current configuration XML file $args = array ( 'path' => 'loco.xml', 'action' => 'loco_download', 'bundle' => $bundle->getHandle(), 'type' => $bundle->getType() ); $this->set( 'xmlUrl', Loco_mvc_AjaxRouter::generate( 'DownloadConf', $args ) ); $this->prepareNavigation()->add( __('Advanced configuration','loco') ); return $this->view('admin/bundle/conf', compact('conf','base','name','excl') ); } } BaseController.php 0000666 00000010054 15214044162 0010176 0 ustar 00 <?php /** * Base controller for any admin screen related to a bundle */ abstract class Loco_admin_bundle_BaseController extends Loco_mvc_AdminController { /** * @var Loco_package_Bundle */ private $bundle; /** * @var Loco_package_Project */ private $project; /** * @return Loco_package_Bundle */ public function getBundle(){ if( ! $this->bundle ){ $type = $this->get('type'); $handle = $this->get('bundle'); $this->bundle = Loco_package_Bundle::createType( $type, $handle ); } return $this->bundle; } /** * Commit bundle config to database * @return Loco_admin_bundle_BaseController */ protected function saveBundle(){ $custom = new Loco_config_CustomSaved; if( $custom->setBundle($this->bundle)->persist() ){ Loco_error_AdminNotices::success( __('Configuration saved','loco') ); } // invalidate bundle in memory so next fetch is re-configured from DB $this->bundle = null; return $this; } /** * Remove bundle config from database * @return Loco_admin_bundle_BaseController */ protected function resetBundle(){ $option = $this->bundle->getCustomConfig(); if( $option && $option->remove() ){ Loco_error_AdminNotices::success( __('Configuration reset','loco') ); // invalidate bundle in memory so next fetch falls back to auto-config $this->bundle = null; } return $this; } /** * @return Loco_package_Project */ public function getProject(){ if( ! $this->project ){ $bundle = $this->getBundle(); $domain = $this->get('domain'); if( ! $domain ){ throw new Loco_error_Exception( sprintf('Translation set not known in %s', $bundle ) ); } $this->project = $bundle->getProjectById($domain); if( ! $this->project ){ throw new Loco_error_Exception( sprintf('Unknown translation set: %s not in %s', json_encode($domain), $bundle ) ); } } return $this->project; } /** * @return Loco_admin_Navigation */ protected function prepareNavigation(){ $bundle = $this->getBundle(); // navigate up to bundle listing page $breadcrumb = Loco_admin_Navigation::createBreadcrumb( $bundle ); $this->set( 'breadcrumb', $breadcrumb ); // navigate between bundle view siblings $tabs = new Loco_admin_Navigation; $this->set( 'tabs', $tabs ); $actions = array ( 'view' => __('Overview','loco'), 'setup' => __('Setup','loco'), 'conf' => __('Advanced','loco'), ); if( loco_debugging() ){ $actions['debug'] = __('Debug','loco'); } $suffix = $this->get('action'); $prefix = strtolower( $this->get('type') ); $getarg = array_intersect_key( $_GET, array('bundle'=>'') ); foreach( $actions as $action => $name ){ $href = Loco_mvc_AdminRouter::generate( $prefix.'-'.$action, $getarg ); $tabs->add( $name, $href, $action === $suffix ); } return $breadcrumb; } /** * Prepare file system connect * @return Loco_mvc_HiddenFields */ protected function prepareFsConnect( $type, $path ){ $fields = new Loco_mvc_HiddenFields( array( 'auth' => $type, 'path' => $path, 'loco-nonce' => wp_create_nonce('fsConnect'), ) ); $this->set('fsFields', $fields ); // may have fs credentials saved in session try { $session = Loco_data_Session::get(); if( isset($session['loco-fs']) ){ $fields['connection_type'] = $session['loco-fs']['connection_type']; } } catch( Exception $e ){ Loco_error_AdminNotices::debug( $e->getMessage() ); } return $fields; } } inc-po-table.php 0000666 00000011064 15214044166 0007540 0 ustar 00 <?php /** * Table of localised file pairs in a project */ if( $pairs ):?> <table class="wp-list-table widefat fixed striped"> <thead> <tr> <th data-sort-type="s"> <?php esc_html_e('Language','loco')?> </th> <th colspan="2" data-sort-type="n"> <?php esc_html_e('Translation progress','loco')?> </th> <th data-sort-type="n"> <?php esc_html_e('Pending','loco')?> </th> <th data-sort-type="s"> <?php esc_html_e('File info','loco')?> </th> <th data-sort-type="n"> <?php esc_html_e('Last modified','loco')?> </th> <th data-sort-type="s"> <?php esc_html_e('Folder','loco')?> </th> </tr> </thead> <tbody><?php /* @var $po Loco_pages_ViewParams */ foreach( $pairs as $po ): $ispo = (bool) $po->lcode;?> <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('English','loco')?> (<?php esc_html_e('Template','loco')?>)</span><?php endif?> </a><?php if( $domain ):?> <nav class="row-actions"> <span class="edit"> <a href="<?php $po->e('edit')?>"><?php esc_html_e('Edit','loco')?></a> | </span> <span class="_edit"> <a href="<?php $po->e('copy')?>"><?php esc_html_e('Copy','loco')?></a> | </span> <span class="trash"> <a href="<?php $po->e('delete')?>"><?php esc_html_e('Delete','loco')?></a> | </span> <span class="_edit"> <a href="<?php $po->e('info')?>"><?php esc_html_e('Info','loco')?></a> </span> </nav><?php endif?> </td><?php if( $ispo ):?> <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 pendingfor template --> </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','Y-m-d H:i:s')?>"><?php $po->date('time')?></time> </td> <td> <?php $po->e('store')?> </td> </tr><?php endforeach;?> </tbody> </table><?php else:?> <table class="wp-list-table widefat fixed striped"> <tr> <td><?php self::e( __('No translations found for "%s"','loco'), $domain )?></td> </tr> </table><?php endif; alias.php 0000666 00000001254 15214044166 0006357 0 ustar 00 <?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="notice inline notice-info"> <h3 class="has-icon"> <?php esc_attr_e('"Hello Dolly" is part of the WordPress core','loco')?> </h3> <p> <?php esc_html_e("This plugin doesn't have its own translation files, but its metadata can be translated in the core Admin bundle", 'loco')?>. </p> <p> <a href="<?php $params->e('redirect')?>"><?php esc_html_e('Go to WordPress Core','loco')?></a> </p> </div> conf.php 0000666 00000023012 15214044166 0006207 0 ustar 00 <?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')?></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')?> </p> </td> </tr> <tr valign="top"> <th scope="row"> <label for="<?php echo $id?>-domain"><?php esc_html_e('Text domain','loco')?></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')?> </p> </td> </tr> <tr valign="top"> <th scope="row"> <label for="<?php echo $id?>-slug"><?php esc_html_e('File prefix','loco')?></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')?> </p> </td> </tr> <tr valign="top"> <th scope="row"> <label for="<?php echo $id?>-template"><?php esc_html_e('Template file','loco')?></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')?> </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')?> </p> </td> </tr> <tr valign="top"> <th scope="row"> <label for="<?php echo $id?>-target"><?php esc_html_e('Domain path','loco')?></label> </th> <td class="twin"> <div> <span class="description"><?php esc_html_e('Include','loco')?>:</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')?>:</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')?>. (<?php esc_html_e('no wildcards','loco')?>) </p> </td> </tr> <tr valign="top"> <th scope="row"> <label for="<?php echo $id?>-source"><?php esc_html_e('Source file paths','loco')?></label> </th> <td class="twin"> <div> <span class="description"><?php esc_html_e('Include','loco')?>:</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')?>:</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')?>. (<?php esc_html_e('no wildcards','loco')?>) </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')?>:</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')?>. (<?php esc_html_e('no wildcards','loco')?>) </p> </td> </tr> </tbody> </table> <p class="submit" > <input type="submit" class="button-primary" value="<?php esc_html_e('Save config','loco')?>" /> <button type="button" class="button" disabled id="loco-add-butt"><?php esc_html_e('Add set','loco')?></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')?></a><?php endif?> <a class="button button-link has-icon icon-download" href="<?php $params->e('xmlUrl')?>"><?php esc_html_e('XML','loco')?></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')?>" /> <input type="hidden" name="<?php $nonce->e('name')?>" value="<?php $nonce->e('value')?>" /> </p> </form><?php endif; setup/author.php 0000666 00000001100 15214044166 0007716 0 ustar 00 <?php /** * Bundle is configured by official author */ $this->extend('../setup'); $this->start('header'); ?> <div class="notice inline notice-success"> <h3 class="has-icon"> <?php esc_html_e('Official configuration','loco')?> </h3> <p> <?php esc_html_e("This bundle's configuration is provided by the author",'loco')?>. <?php esc_html_e("You can make changes in the Advanced tab if you need to override the current settings",'loco')?>. </p> <?php echo $this->render('inc-nav')?> </div> setup/inc-nav.php 0000666 00000002215 15214044166 0007757 0 ustar 00 <?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')?></a> </p> <p> <a href="<?php $tabs[1]->e('href')?>&xml=1" class="button button-link has-icon icon-upload"><?php esc_html_e('Import config from XML','loco')?></a> </p> <p> <a href="<?php $tabs[1]->e('href')?>&json=1" class="button button-link has-icon icon-database"><?php esc_html_e('Check config repository','loco')?></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')?></a> </p> setup/conf.php 0000666 00000006250 15214044166 0007354 0 ustar 00 <?php /** * "auto" config options */ $this->extend('../setup'); $this->start('header'); if( $params->has('jsonFields') ):?> <form action="" method="post" enctype="application/x-www-form-urlencoded" class="notice inline notice-generic" id="loco-remote"> <h3> <?php esc_html_e('Check config repository','loco')?> </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')?> </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')?></button> <a href="<?php $tabs[1]->e('href')?>" class="button button-link"><?php esc_html_e('Cancel','default')?></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')?>" /> <input type="reset" class="button button-link" value="<?php esc_attr_e('Cancel','default')?>" /> </p> </div> <?php $jsonFields->_e()?> </form><?php endif; if( $params->has('xmlFields') ):?> <form action="" method="post" enctype="application/x-www-form-urlencoded" class="notice inline notice-generic"> <h3> <?php esc_html_e('XML setup','loco')?> </h3> <p> <?php esc_html_e("If you've been given a configuration file by a developer, paste the XML code here",'loco')?>: </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')?>" /> <a href="<?php $tabs[1]->e('href')?>" class="button button-link"><?php esc_html_e('Cancel','default')?></a> </p> <?php $xmlFields->_e()?> </form><?php endif; if( $params->has('autoFields') ):?> <form action="" method="post" enctype="application/x-www-form-urlencoded" class="notice inline notice-generic"> <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; setup/none.php 0000666 00000001033 15214044166 0007360 0 ustar 00 <?php /** * Bundle is not set up at all */ $this->extend('../setup'); $this->start('header'); ?> <div class="notice inline notice-error"> <h3 class="has-icon"> <?php esc_html_e('Unconfigured bundle','loco')?> </h3> <p> <?php esc_html_e('This bundle isn\'t set up for translation in a way we understand','loco')?>. <?php esc_html_e('It needs configuring before you can do any translations','loco')?>. </p> <?php echo $this->render('inc-nav')?> </div>