Plugin Directory

Changeset 1200576


Ignore:
Timestamp:
07/16/2015 10:51:30 PM (11 years ago)
Author:
smithworx
Message:

updated stable release tag and archived v1.0.1

Location:
lingotek-translation
Files:
84 added
8 edited

Legend:

Unmodified
Added
Removed
  • lingotek-translation/trunk/admin/actions.php

    r1200571 r1200576  
    8787
    8888            'current' => array(
    89                 'title' => __('Current', 'wp-lingotek'),
     89                'title' => __('current', 'wp-lingotek'),
    9090                'icon'  => 'edit'
    9191            ),
  • lingotek-translation/trunk/admin/admin.php

    r1200571 r1200576  
    99     */
    1010    public function __construct() {
     11
    1112        $plugin = Lingotek::get_instance();
    1213        $this->plugin_slug = $plugin->get_plugin_slug();
     
    2627        add_filter('set-screen-option', array($this, 'set_screen_option'), 10, 3);
    2728
    28     add_action('wp_ajax_'.$this->ajax_dashboard_language_endpoint, array(&$this->dashboard, 'ajax_language_dashboard'));
    29     add_action('wp_ajax_get_current_status', array($this,'ajax_get_current_status'));
     29        add_action('wp_ajax_'.$this->ajax_dashboard_language_endpoint, array(&$this->dashboard, 'ajax_language_dashboard'));
     30
    3031        //Network admin menu
    3132        add_action('network_admin_menu', array($this, 'add_network_admin_menu'));
    3233    }
    33   public function ajax_get_current_status(){
    34     global $wpdb;
    35     $languages = pll_languages_list(array('fields' => 'locale'));
    36     $object_ids = $_POST['check_ids'];
    37     if($object_ids === null){
    38       return;
    39     }
    40     $terms = isset($_POST['terms_translations']);
    41     $taxonomy = $terms ? 'term_translations'
    42         : 'post_translations';
    43     //this function allows for sanitization of a variable amount of sql IN values
    44     $relationship_placeholders = $this->lingotek_get_placeholders($object_ids);
    45 
    46     $terms_query = $wpdb->prepare("SELECT term_tax.*, terms.name AS doc_id, wp_tr.object_id FROM wp_term_taxonomy term_tax "
    47         . "INNER JOIN wp_terms terms ON term_tax.term_id = terms.term_id "
    48         . "INNER JOIN wp_term_relationships wp_tr ON term_tax.term_taxonomy_id = wp_tr.term_taxonomy_id "
    49         . "WHERE taxonomy = '$taxonomy' "
    50         . "AND wp_tr.object_id in ($relationship_placeholders)", $object_ids);
    51     $results = $wpdb->get_results($terms_query);
    52 
    53     //package up the db results into an associative array. The main array consists of
    54     //ids and nonces. Each id has a source language, languages with statuses, and a workbench link
    55     $content_metadata = [];
    56     foreach($results as $group => $result){
    57       $id = $result->object_id;
    58       $post_data = unserialize($result->description)['lingotek'];
    59 
    60       $source_language = $terms ? pll_get_term_language($post_data['source'], 'locale')
    61         : pll_get_post_language($post_data['source'], 'locale');
    62 
    63       $content_metadata[$id]['source'] = $source_language;
    64       $content_metadata[$id]['doc_id'] = $result->doc_id;
    65       $content_metadata[$id][$source_language]['status'] = $post_data['status'];
    66       foreach($post_data['translations']as $locale => $translation_status){
    67         $content_metadata[$id][$locale]['status'] = $translation_status;
    68         $workbench_link = Lingotek_Actions::workbench_link($result->doc_id, $locale);
    69         $content_metadata[$id][$locale]['workbench_link'] = $workbench_link;
    70       }
    71     }
    72 
    73     //fills in missing languages to be able to update all the ones listed on Wordpress
    74     foreach($languages as $language){
    75       foreach($content_metadata as $group => $status){
    76         if(!isset($status[$language])){
    77           $content_metadata[$group][$language]['status'] = "none";
    78         }
    79       }
    80     }
    81     //get the nonces associated with the different actions
    82     $content_metadata['request_nonce'] = $this->lingotek_get_matching_nonce('lingotek-request');
    83     $content_metadata['download_nonce'] = $this->lingotek_get_matching_nonce('lingotek-download');
    84     $content_metadata['upload_nonce'] = $this->lingotek_get_matching_nonce('lingotek-upload');
    85     $content_metadata['status_nonce'] = $this->lingotek_get_matching_nonce('lingotek-status');
    86 
    87     wp_send_json($content_metadata);
    88   }
    89 
    90   public function lingotek_get_matching_nonce($action){
    91     $upload_link = wp_nonce_url(add_query_arg(array(
    92               'action' => $action)),
    93               $action);
    94     $nonce_begin = strpos($upload_link, 'wpnonce=') + 8;
    95     $nonce = substr($upload_link,$nonce_begin);
    96     return $nonce;
    97   }
    98 
    99   public function lingotek_get_placeholders($items){
    100     foreach($items as $item){
    101       $placeholders .= '%s,';
    102     }
    103     $placeholders = rtrim($placeholders, ',');
    104     return $placeholders;
    105   }
    10634
    10735    public function get_dashboard_endpoint(){
     
    12856        $scripts = array(
    12957            'progress'  => array(array('edit', 'upload', 'edit-tags', 'translation_page_wp-lingotek_manage', 'translation_page_wp-lingotek_settings'), array('jquery-ui-progressbar', 'jquery-ui-dialog', 'wp-ajax-response'), 1),
    130             'updater'   => array(array('edit', 'upload', 'edit-tags'), array('jquery-ui-progressbar', 'jquery-ui-dialog', 'wp-ajax-response'), 1),
    13158        );
    13259
     
    483410     */
    484411    public function set_screen_option($status, $option, $value) {
    485         if ('lingotek_strings_per_page' == $option) {
     412        if ('lingotek_strings_per_page' == $option)
    486413            return $value;
    487     }
    488414        return $status;
    489415    }
  • lingotek-translation/trunk/admin/filters-columns.php

    r1200571 r1200576  
    4444
    4545        foreach ($this->model->get_languages_list() as $language) {
    46             $columns['language_'.$language->locale] = $language->flag ? $language->flag :
     46            $columns['language_'.$language->slug] = $language->flag ? $language->flag :
    4747                sprintf('<a href="" title="%s">%s</a>',
    4848                    esc_html("$language->name ($language->locale)"),
     
    7171            call_user_func(array($this->model, 'get_' . $type . '_language'), $object_id);
    7272
    73         if (false === strpos($column, 'language_') || !$lang) {
     73        if (false === strpos($column, 'language_') || !$lang)
    7474            return '';
    75     }
    7675
    7776        $language = $this->model->get_language(substr($column, 9));
     
    8079        // yes for uploaded posts, but I will need js as the field is built for all posts
    8180        // /!\ also take care not add this field two times when translations are managed by Polylang
     81
    8282        // hidden field containing the post language for quick edit (used to filter categories since Polylang 1.7)
    83         if ($column == $this->get_first_language_column()  /*&& !$this->model->get_translation_id('post', $post_id)*/) {
     83        if ($column == $this->get_first_language_column() /*&& !$this->model->get_translation_id('post', $post_id)*/)
    8484            printf('<div class="hidden" id="lang_%d">%s</div>', esc_attr($object_id), esc_html($lang->slug));
    85     }
    8685
    8786        $id = ($inline && $lang->slug != $this->model->get_language($_POST['old_lang'])->slug) ?
     
    9897
    9998        // post ready for upload
    100         if ($this->lgtm->can_upload($type, $object_id) && $object_id == $id) {
     99        if ($this->lgtm->can_upload($type, $object_id) && $object_id == $id)
    101100            return $disabled ?
    102                 ('post' == $type ? parent::post_column($column, $object_id)
    103           : parent::term_column('', $column, $object_id))
    104           : $actions->upload_icon($object_id);
    105     }
     101                ('post' == $type ? parent::post_column($column, $object_id) : parent::term_column('', $column, $object_id)) :
     102                $actions->upload_icon($object_id);
    106103
    107104        // translation disabled
    108         elseif (isset($document->source) && $document->is_disabled_target($language)) {
     105        elseif (isset($document->source) && $document->is_disabled_target($language))
    109106            return 'post' == $type ? parent::post_column($column, $object_id) : parent::term_column('', $column, $object_id);
    110     }
    111107
    112108        // source post is uploaded
    113109        elseif (isset($document->source) && $document->source == $id) {
    114110            // source ready for upload
    115             if ($this->lgtm->can_upload($type, $id)) {
     111            if ($this->lgtm->can_upload($type, $id))
    116112                return $actions->upload_icon($id);
    117       }
    118113
    119114            // importing source
    120             if ($id == $object_id && 'importing' == $document->status) {
     115            if ($id == $object_id && 'importing' == $document->status)
    121116                return Lingotek_Actions::importing_icon($document);
    122       }
    123117
    124118            // uploaded
     
    127121
    128122        // translations
    129         elseif (isset($document->translations[$language->locale]) || (isset($document->source) && 'current' == $document->status)){
     123        elseif (isset($document->translations[$language->locale]) || (isset($document->source) && 'current' == $document->status))
    130124            return Lingotek_Actions::translation_icon($document, $language);
    131     }
    132125
    133126        // translations exist but are not managed by Lingotek TMS
    134         elseif (empty($document->source)) {
    135             return $object_id == $id && !$disabled ? $actions->upload_icon($object_id, true)
    136           : ('post' == $type ? parent::post_column($column, $object_id)
    137           : parent::term_column('', $column, $object_id));
    138     }
     127        elseif (empty($document->source))
     128            return $object_id == $id && !$disabled ?
     129                $actions->upload_icon($object_id, true) :
     130                ('post' == $type ? parent::post_column($column, $object_id) : parent::term_column('', $column, $object_id));
    139131
    140132        // no translation
    141         else {
     133        else
    142134            return  '<div class="lingotek-color dashicons dashicons-no"></div>';
    143     }
    144135    }
    145136
  • lingotek-translation/trunk/admin/manage/view-string-groups.php

    r1200571 r1200576  
    1717    $table = new Lingotek_Strings_Table($string_actions);
    1818    $action = $table->current_action();
    19     if (!empty($action)) {
     19    if (!empty($action))
    2020        $string_actions->manage_actions($action);
    21   }
    2221
    2322    $data = Lingotek_Model::get_strings();
    24     foreach ($data as $key => $row) {
     23    foreach ($data as $key => $row)
    2524        $data[$key]['row'] = $key; // store the row number for convenience
    26   }
    2725
    2826    $table->prepare_items($data); ?>
     
    3331
    3432    foreach (Lingotek_String_actions::$actions as $action => $strings) {
    35         if (!empty($_GET['bulk-lingotek-' . $action])) {
     33        if (!empty($_GET['bulk-lingotek-' . $action]))
    3634            printf('<div id="lingotek-progressdialog" title="%s"><div id="lingotek-progressbar"></div></div>', $strings['progress']);
    37     }
    3835    }
    3936}
  • lingotek-translation/trunk/admin/post-actions.php

    r1200571 r1200576  
    9595    public function manage_actions() {
    9696        global $typenow;
    97     printf('<div id="auto-update" class="hidden"></div>');
    9897        $post_type = 'load-upload.php' == current_filter() ? 'attachment' : $typenow;
    9998
  • lingotek-translation/trunk/admin/tutorial/faq.php

    r1199446 r1200576  
    2626
    2727<b><?php _e("Why can't I upload my existing content to Lingotek?", 'wp-lingotek') ?></b>
    28 <p><?php printf(__("You must assign a language to content that existed before you installed the <i>Polylang</i> and <i>Lingotek</i> plugins. You can do this manually or use the <a href='%s'><i>Lingotek Language Utility</i></a> to set all content that doesn't have an assigned language to the default language. This will allow you to upload your existing content to Lingotek.", 'wp-lingotek'), 'admin.php?page=wp-lingotek_settings&sm=utilities'); ?></p>
     28<p><?php printf(__("You must assign a language to content that existed before you installed the <i>Polylang</i> and <i>Lingotek</i> plugins. You can do this manually or use the <a href='%s'><i>Lingotek Language Utility</i></a> to set all content that doesn't have an assigned language to the default language. This will allow you to upload your exisiting content to Lingotek.", 'wp-lingotek'), 'admin.php?page=wp-lingotek_settings&sm=utilities'); ?></p>
    2929
    3030<b><?php _e("Can I use my own translation agency with Lingotek?", 'wp-lingotek') ?></b>
     
    4545
    4646<b><?php _e('What happens when I <i>Disassociate Translations</i>?', 'wp-lingotek') ?></b>
    47 <p><?php _e('When content is disassociated, the connection between WordPress and <i>Lingotek</i> is safely removed so that translations can be solely managed inside of WordPress.', 'wp-lingotek') ?></p>
     47<p><?php _e('When content is disassociated the connection between WordPress and <i>Lingotek</i> safely disconnected from Lingotek, so that translations can be solely managed inside of WordPress.', 'wp-lingotek') ?></p>
    4848
    4949<b><?php _e("How do I translate strings within widgets or general WordPress settings (e.g., Site Title, Tagline)?", 'wp-lingotek') ?></b>
  • lingotek-translation/trunk/js/progress.js

    r1200571 r1200576  
    11jQuery(document).ready(function($) {
     2
    23    function lingotek_progress(i) {
    34        if (i < lingotek_data.ids.length) {
  • lingotek-translation/trunk/readme.txt

    r1200571 r1200576  
    55Requires at least: 3.8
    66Tested up to: 4.2
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2525* __Community__ - If you're looking to save money by avoiding professional translation, you can take the do-it-yourself approach and have your bilingual employees, partners and/or users perform translations right within Wordpress. The plugin integrates with and provides use of the Lingotek Workbench, a professional-grade text editor used for translating, reviewing, and post-editing multilingual content.
    2626
    27 * __Free Automatic__ - Machine translation is an excellent option if you're on a tight budget, looking for near-instant results, and are okay with less-than-perfect quality. The plugin allows you to quickly and automatically translate your site by providing use of the commercial API for Microsoft Translator (the cost is covered by Lingotek for up to 100,000 characters). Machine translations can be post-edited at any time using the Lingotek Workbench.
     27* __Free Automatic__ - Machine translation is an excellent option if you're on a tight budget, looking for near-instant results, and are okay with less-than-perfect quality. The plugin allows you to quickly and automatically translate your site by providing use of the commercial API for Microsoft Translator (the cost is covered by Lingotek for up to 100,000 words). Machine translations can be post-edited at any time using the Lingotek Workbench.
    2828
    2929= Cloud-Based Translation Management System =
     
    7070== Frequently Asked Questions ==
    7171
    72 = What does the Lingotek plugin do? =
    73 
    74 Lingotek has teamed up with [Polylang](https://wordpress.org/plugins/polylang/) to offer a simple way to make your WordPress site truly multilingual. Manage all your multilingual content in the same site. No need to have a different site for each language!
    75 
    76 = How can I add a language? =
    77 
    78 On the *translation dashboard,* click on the *Translate my site into...* textbox and choose from the list or start typing to quickly find a language.
    79 
    80 = How can I remove a language? =
    81 
    82 On the *translation dashboard,* click on the blue check mark for the language you would like to remove. *Note: if you have translated content in a language you will not be able to remove that language until that content has been deleted.*
    83 
    84 = Why can't I upload my existing content to Lingotek? =
    85 
    86 You must assign a language to content that existed before you installed the Polylang and Lingotek plugins. You can do this manually or use the Lingotek Language Utility to set all content that doesn't have an assigned language to the default language. This will allow you to upload your existing content to Lingotek.
    87 
    88 = Can I use my own translation agency with Lingotek? =
    89 
    90 Use your own translation agency or tap into Lingotek's network of more than 5,000+ in-country translators. Content transfer is fully automated between WordPress and Lingotek. You'll have full visibility into the translation process every step of the way. And once the translations are completed, they'll automatically download and publish to your website according to the preferences you've set.
    91 
    92 = How can I check the overall translation progress of my site? =
    93 
    94 On the *translation dashboard,* the bars under *Completed Percentage* show the translation progress of content for each language. You can filter by content type or show progress for all content.
    95 
    96 = Why are there two different shades of blue in the progress bar? =
    97 
    98 The *translation dashboard* not only shows how much of your content is translated, but also indicates the language that your source content was authored in.
    99 
    100 * *Dark Blue:* Indicates that this is a source language that the content was authored in.
    101 * *Light Blue:* Indicates that this is a target language that the content was translated into.
    102 
    103 = What happens when I Disassociate Translations? =
    104 
    105 When content is disassociated, the connection between WordPress and Lingotek is safely removed so that translations can be solely managed inside of WordPress.
    106 
    107 For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net/wiki/display/PDOC/WordPress)
     72Visit the [Lingotek documentation site](https://lingotek.atlassian.net/wiki/display/PDOC/WordPress)
    10873
    10974== Screenshots ==
     
    11580
    11681== Changelog ==
    117 
    118 = 1.0.2 (2015-07-16) =
    119 
    120 * Real-time translation status updates!
    12182
    12283= 1.0.1 (2015-07-14) =
Note: See TracChangeset for help on using the changeset viewer.