WP Meta SEO - Version 3.2.6

Version Description

  • Add : Add builtin translation tool
  • Fix : Wrong function used to get description length
Download this release

Release Info

Developer JoomUnited
Plugin Icon 128x128 WP Meta SEO
Version 3.2.6
Comparing to
See all releases

Code changes from version 3.2.5 to 3.2.6

css/metaseo_admin.css CHANGED
@@ -498,10 +498,11 @@ strong {
498
499
.content-box{
500
padding: 10px;
501
}
502
503
- .content-wpms-redirection,.content-wpms-email{
504
- display: none;
505
}
506
507
.wpms_content_settings{
@@ -622,4 +623,8 @@ strong {
622
float:left;
623
width: 70px;
624
line-height: 25px;
625
}
498
499
.content-box{
500
padding: 10px;
501
+ display: none;
502
}
503
504
+ .content-wpms-global{
505
+ display: block;
506
}
507
508
.wpms_content_settings{
623
float:left;
624
width: 70px;
625
line-height: 25px;
626
+ }
627
+
628
+ #jutranslation{
629
+ margin-top: 40px;
630
}
inc/class.metaseo-admin.php CHANGED
@@ -272,7 +272,7 @@ class MetaSeo_Admin {
272
* Loads translated strings.
273
*/
274
function wpms_load_langguage() {
275
- load_plugin_textdomain('wp-meta-seo', false, dirname(plugin_basename(WPMSEO_FILE)) . '/languages/');
276
}
277
278
function metaseo_create_field($data_title, $alt, $dashicon, $label, $value_hidden) {
272
* Loads translated strings.
273
*/
274
function wpms_load_langguage() {
275
+ load_plugin_textdomain('wp-meta-seo', false, dirname(plugin_basename(__FILE__)) . DIRECTORY_SEPARATOR . 'languages' .DIRECTORY_SEPARATOR);
276
}
277
278
function metaseo_create_field($data_title, $alt, $dashicon, $label, $value_hidden) {
inc/class.metaseo-broken-link-table.php CHANGED
@@ -126,7 +126,7 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
126
127
if (!empty($columns['cb'])) {
128
static $cb_counter = 1;
129
- $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __('Select All') . '</label>'
130
. '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" style="margin:0;" />';
131
$cb_counter++;
132
}
@@ -384,7 +384,7 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
384
</select>
385
386
<?php
387
- submit_button(__('Filter'), 'button', 'filter_type_action', false, array('id' => 'broken-submit'));
388
echo '<div style="float:left;padding-left: 5px;"><div class="wpms_process" data-w="0"></div>';
389
echo '<div data-comment_paged="1" data-paged="1" class="button wpms_scan_link">' . __('Index internal broken links', 'wp-meta-seo') . '</div></div>';
390
echo '<span class="spinner"></span>';
@@ -593,7 +593,7 @@ class MetaSeo_Broken_Link_Table extends WP_List_Table {
593
$source = get_comment($rec->source_id);
594
if (!empty($source)) {
595
$row_action = array(
596
- 'edit' => '<a target="_blank" href="' . get_edit_comment_link($rec->source_id) . '" title="'.__('Edit this item','wp-meta-seo').'">'.__('Edit','wp-meta-seo').'</a>',
597
'view' => '<a target="_blank" href="' . get_comment_link($rec->source_id) . '" title="View &#8220;test&#8221;" rel="permalink">'.__('View','wp-meta-seo').'</a>'
598
);
599
126
127
if (!empty($columns['cb'])) {
128
static $cb_counter = 1;
129
+ $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __('Select All', 'wp-meta-seo') . '</label>'
130
. '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" style="margin:0;" />';
131
$cb_counter++;
132
}
384
</select>
385
386
<?php
387
+ submit_button(__('Filter', 'wp-meta-seo'), 'button', 'filter_type_action', false, array('id' => 'broken-submit'));
388
echo '<div style="float:left;padding-left: 5px;"><div class="wpms_process" data-w="0"></div>';
389
echo '<div data-comment_paged="1" data-paged="1" class="button wpms_scan_link">' . __('Index internal broken links', 'wp-meta-seo') . '</div></div>';
390
echo '<span class="spinner"></span>';
593
$source = get_comment($rec->source_id);
594
if (!empty($source)) {
595
$row_action = array(
596
+ 'edit' => '<a target="_blank" href="' . get_edit_comment_link($rec->source_id) . '" title="'.__('Edit this item','wp-meta-seo').'">'.__('Edit','wp-meta-seo','wp-meta-seo').'</a>',
597
'view' => '<a target="_blank" href="' . get_comment_link($rec->source_id) . '" title="View &#8220;test&#8221;" rel="permalink">'.__('View','wp-meta-seo').'</a>'
598
);
599
inc/class.metaseo-content-list-table.php CHANGED
@@ -113,7 +113,7 @@ class MetaSeo_Content_List_Table extends WP_List_Table {
113
$btn_bulk = '<input type="button" name="do_copy" id="post_do_copy" class="button button-primary btn_do_copy post_do_copy" value="' . __('Content title as meta title', 'wp-meta-seo') . '"><span class="spinner"></span>';
114
115
echo sprintf('<select name="post_type_filter" class="metaseo-filter">%1$s</select>', $options);
116
- submit_button(__('Filter'), 'button', 'do_filter', false, array('id' => 'post-query-submit'));
117
echo $sl_bulk . $btn_bulk;
118
echo "</div>";
119
}
@@ -373,15 +373,15 @@ class MetaSeo_Content_List_Table extends WP_List_Table {
373
$actions = array();
374
375
if ($can_edit_post && 'trash' != $rec->post_status) {
376
- $actions['edit'] = '<a href="' . get_edit_post_link($rec->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>';
377
}
378
379
if ($post_type_object->public) {
380
if (in_array($rec->post_status, array('pending', 'draft', 'future'))) {
381
if ($can_edit_post)
382
- $actions['view'] = '<a href="' . esc_url(add_query_arg('preview', 'true', get_permalink($rec->ID))) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $rec->post_title)) . '" rel="permalink">' . __('Preview') . '</a>';
383
} elseif ('trash' != $rec->post_status) {
384
- $actions['view'] = '<a target="_blank" href="' . get_permalink($rec->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $rec->post_title)) . '" rel="permalink">' . __('View') . '</a>';
385
}
386
}
387
113
$btn_bulk = '<input type="button" name="do_copy" id="post_do_copy" class="button button-primary btn_do_copy post_do_copy" value="' . __('Content title as meta title', 'wp-meta-seo') . '"><span class="spinner"></span>';
114
115
echo sprintf('<select name="post_type_filter" class="metaseo-filter">%1$s</select>', $options);
116
+ submit_button(__('Filter', 'wp-meta-seo'), 'button', 'do_filter', false, array('id' => 'post-query-submit'));
117
echo $sl_bulk . $btn_bulk;
118
echo "</div>";
119
}
373
$actions = array();
374
375
if ($can_edit_post && 'trash' != $rec->post_status) {
376
+ $actions['edit'] = '<a href="' . get_edit_post_link($rec->ID, true) . '" title="' . esc_attr(__('Edit this item','wp-meta-seo')) . '">' . __('Edit', 'wp-meta-seo') . '</a>';
377
}
378
379
if ($post_type_object->public) {
380
if (in_array($rec->post_status, array('pending', 'draft', 'future'))) {
381
if ($can_edit_post)
382
+ $actions['view'] = '<a href="' . esc_url(add_query_arg('preview', 'true', get_permalink($rec->ID))) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;', 'wp-meta-seo'), $rec->post_title)) . '" rel="permalink">' . __('Preview', 'wp-meta-seo') . '</a>';
383
} elseif ('trash' != $rec->post_status) {
384
+ $actions['view'] = '<a target="_blank" href="' . get_permalink($rec->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;', 'wp-meta-seo'), $rec->post_title)) . '" rel="permalink">' . __('View', 'wp-meta-seo') . '</a>';
385
}
386
}
387
inc/class.metaseo-image-list-table.php CHANGED
@@ -209,7 +209,7 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
209
210
if (!empty($columns['cb'])) {
211
static $cb_counter = 1;
212
- $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __('Select All') . '</label>'
213
. '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" style="margin:0;" />';
214
$cb_counter++;
215
}
@@ -416,14 +416,14 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
416
continue;
417
$month = zeroise($arc_row->month, 2);
418
$year = $arc_row->year;
419
- printf("<option %s value='%s' >%s</option>\n", selected($m, "$year-$month", false), esc_attr("$arc_row->year-$month"), sprintf(__('%1$s %2$d'), $wp_locale->get_month($month), $year)
420
);
421
}
422
?>
423
</select>
424
425
<?php
426
- submit_button(__('Filter'), 'button', $namebutton, false, array('id' => 'image-submit'));
427
}
428
429
/**
@@ -792,7 +792,7 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
792
<td colspan="8"></td>
793
<td colspan="2">
794
<a href="javascript:void(0);" id="metaseo-replace-all" class="button button-primary" onclick="optimize_imgs_group(this)">
795
- <?php echo __('Replace All') ?>
796
</a>
797
<span class="optimizing spinner"></span>
798
</td>
@@ -1333,7 +1333,7 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
1333
$response->msg = __('This image has been removed from the post, please check again!', 'wp-meta-seo');
1334
}
1335
} else {
1336
- $response->msg = __('Content of the post is empty, please check again', 'wpms!');
1337
}
1338
}
1339
209
210
if (!empty($columns['cb'])) {
211
static $cb_counter = 1;
212
+ $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __('Select All', 'wp-meta-seo') . '</label>'
213
. '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" style="margin:0;" />';
214
$cb_counter++;
215
}
416
continue;
417
$month = zeroise($arc_row->month, 2);
418
$year = $arc_row->year;
419
+ printf("<option %s value='%s' >%s</option>\n", selected($m, "$year-$month", false), esc_attr("$arc_row->year-$month"), sprintf(__('%1$s %2$d', 'wp-meta-seo'), $wp_locale->get_month($month), $year)
420
);
421
}
422
?>
423
</select>
424
425
<?php
426
+ submit_button(__('Filter', 'wp-meta-seo'), 'button', $namebutton, false, array('id' => 'image-submit'));
427
}
428
429
/**
792
<td colspan="8"></td>
793
<td colspan="2">
794
<a href="javascript:void(0);" id="metaseo-replace-all" class="button button-primary" onclick="optimize_imgs_group(this)">
795
+ <?php echo __('Replace All', 'wp-meta-seo') ?>
796
</a>
797
<span class="optimizing spinner"></span>
798
</td>
1333
$response->msg = __('This image has been removed from the post, please check again!', 'wp-meta-seo');
1334
}
1335
} else {
1336
+ $response->msg = __('Content of the post is empty, please check again', 'wp-meta-seo');
1337
}
1338
}
1339
inc/class.metaseo-link-list-table.php CHANGED
@@ -207,7 +207,7 @@ class MetaSeo_Link_List_Table extends WP_List_Table {
207
208
if (!empty($columns['cb'])) {
209
static $cb_counter = 1;
210
- $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __('Select All') . '</label>'
211
. '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" style="margin:0;" />';
212
$cb_counter++;
213
}
@@ -451,14 +451,14 @@ class MetaSeo_Link_List_Table extends WP_List_Table {
451
continue;
452
$month = zeroise($arc_row->month, 2);
453
$year = $arc_row->year;
454
- printf("<option %s value='%s' >%s</option>\n", selected($m, "$year-$month", false), esc_attr("$arc_row->year-$month"), sprintf(__('%1$s %2$d'), $wp_locale->get_month($month), $year)
455
);
456
}
457
?>
458
</select>
459
460
<?php
461
- submit_button(__('Filter'), 'button', $namebutton, false, array('id' => 'image-submit'));
462
}
463
464
/**
207
208
if (!empty($columns['cb'])) {
209
static $cb_counter = 1;
210
+ $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __('Select All', 'wp-meta-seo') . '</label>'
211
. '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" style="margin:0;" />';
212
$cb_counter++;
213
}
451
continue;
452
$month = zeroise($arc_row->month, 2);
453
$year = $arc_row->year;
454
+ printf("<option %s value='%s' >%s</option>\n", selected($m, "$year-$month", false), esc_attr("$arc_row->year-$month"), sprintf(__('%1$s %2$d', 'wp-meta-seo'), $wp_locale->get_month($month), $year)
455
);
456
}
457
?>
458
</select>
459
460
<?php
461
+ submit_button(__('Filter', 'wp-meta-seo'), 'button', $namebutton, false, array('id' => 'image-submit'));
462
}
463
464
/**
inc/class.metaseo-metabox.php CHANGED
@@ -67,7 +67,7 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
67
self::$meta_fields['general']['snippetpreview']['help'] = sprintf(__('This is a preview of what your content will looks like in search engine results: title, description and URL', 'wp-meta-seo'), '<a target="_blank" href="https://www.joomunited.com/wordpress-products/wpms">', '</a>');
68
69
self::$meta_fields['general']['title']['title'] = __('Search engine title', 'wp-meta-seo');
70
- self::$meta_fields['general']['title']['description'] = sprintf(__('<span id="metaseo_wpmseo_title-length">%s</span>'), self::$meta_length_reason);
71
self::$meta_fields['general']['title']['help'] = __('This is the title of your content that may be displayed in search engine results (meta title). By default it’s the content title (page title, post title…). 69 characters max allowed.', 'wp-meta-seo');
72
73
$settings = get_option('_metaseo_settings');
@@ -81,7 +81,7 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
81
82
83
self::$meta_fields['general']['desc']['title'] = __('Search engine description', 'wp-meta-seo');
84
- self::$meta_fields['general']['desc']['description'] = sprintf(__('<span id="metaseo_wpmseo_desc-length">%s</span>'), self::$meta_length_reason);
85
self::$meta_fields['general']['desc']['help'] = __('The description of your content that may be displayed in search engine results aka meta description. By default search engine take an excerpt from your content (depending on the search query). 156 characters max allowed.', 'wp-meta-seo');
86
87
self::$meta_fields['social']['opengraph-title']['title'] = __('Facebook Title', 'wp-meta-seo');
67
self::$meta_fields['general']['snippetpreview']['help'] = sprintf(__('This is a preview of what your content will looks like in search engine results: title, description and URL', 'wp-meta-seo'), '<a target="_blank" href="https://www.joomunited.com/wordpress-products/wpms">', '</a>');
68
69
self::$meta_fields['general']['title']['title'] = __('Search engine title', 'wp-meta-seo');
70
+ self::$meta_fields['general']['title']['description'] = sprintf('<span id="metaseo_wpmseo_title-length">%s</span>', self::$meta_length_reason);
71
self::$meta_fields['general']['title']['help'] = __('This is the title of your content that may be displayed in search engine results (meta title). By default it’s the content title (page title, post title…). 69 characters max allowed.', 'wp-meta-seo');
72
73
$settings = get_option('_metaseo_settings');
81
82
83
self::$meta_fields['general']['desc']['title'] = __('Search engine description', 'wp-meta-seo');
84
+ self::$meta_fields['general']['desc']['description'] = sprintf('<span id="metaseo_wpmseo_desc-length">%s</span>', self::$meta_length_reason);
85
self::$meta_fields['general']['desc']['help'] = __('The description of your content that may be displayed in search engine results aka meta description. By default search engine take an excerpt from your content (depending on the search query). 156 characters max allowed.', 'wp-meta-seo');
86
87
self::$meta_fields['social']['opengraph-title']['title'] = __('Facebook Title', 'wp-meta-seo');
inc/class.metaseo-sitemap.php CHANGED
@@ -147,7 +147,7 @@ class MetaSeo_Sitemap {
147
?>
148
<?php if (is_multisite()) { ?>
149
<label><input id="wpms_sitemap_add" type='checkbox' disabled="disabled" name='_metaseo_settings_sitemap[wpms_sitemap_add]' value="1" <?php checked(1, $this->settings_sitemap['wpms_sitemap_add']); ?> /> <?php _e("add sitemap file path in robots.txt", 'wp-meta-seo'); ?></label>
150
- <p style="color:red"><?php _e("Since you are using multisiting, the plugin does not allow to add a sitemap to robots.txt", 'wp-meta-seo'); ?></div>
151
<?php } else { ?>
152
<!-- for robots.txt we need to use site_url instead home_url ! -->
153
<label><input id="wpms_sitemap_add" type='checkbox' name='_metaseo_settings_sitemap[wpms_sitemap_add]' value="1" <?php checked(1, $this->settings_sitemap['wpms_sitemap_add']); ?> /> <?php _e("add sitemap link in the", 'wp-meta-seo'); ?> <a href="<?php echo site_url('/'); ?>robots.txt" target="_new">robots.txt</a></label>
@@ -764,7 +764,7 @@ class MetaSeo_Sitemap {
764
if ($i == 1) {
765
// Authors
766
if ($this->settings_sitemap['wpms_sitemap_author'] == 1) {
767
- $html .= '<div id="sitemap_authors"><h3>' . __('Authors') . '</h3>
768
<ul>';
769
770
$authEx = implode(", ", get_users('orderby=nicename&meta_key=wpms_excludeauthorsitemap&meta_value=on'));
147
?>
148
<?php if (is_multisite()) { ?>
149
<label><input id="wpms_sitemap_add" type='checkbox' disabled="disabled" name='_metaseo_settings_sitemap[wpms_sitemap_add]' value="1" <?php checked(1, $this->settings_sitemap['wpms_sitemap_add']); ?> /> <?php _e("add sitemap file path in robots.txt", 'wp-meta-seo'); ?></label>
150
+ <p style="color:red"><?php _e("Since you are using multisite, the plugin does not allow to add a sitemap to robots.txt", 'wp-meta-seo'); ?></p>
151
<?php } else { ?>
152
<!-- for robots.txt we need to use site_url instead home_url ! -->
153
<label><input id="wpms_sitemap_add" type='checkbox' name='_metaseo_settings_sitemap[wpms_sitemap_add]' value="1" <?php checked(1, $this->settings_sitemap['wpms_sitemap_add']); ?> /> <?php _e("add sitemap link in the", 'wp-meta-seo'); ?> <a href="<?php echo site_url('/'); ?>robots.txt" target="_new">robots.txt</a></label>
764
if ($i == 1) {
765
// Authors
766
if ($this->settings_sitemap['wpms_sitemap_author'] == 1) {
767
+ $html .= '<div id="sitemap_authors"><h3>' . __('Authors', 'wp-meta-seo') . '</h3>
768
<ul>';
769
770
$authEx = implode(", ", get_users('orderby=nicename&meta_key=wpms_excludeauthorsitemap&meta_value=on'));
inc/google_analytics/wpmsga.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists('WPMSGA_Manager')) {
19
*/
20
private function __construct() {
21
if (null !== self::$instance) {
22
- _doing_it_wrong(__FUNCTION__, __("This is not allowed, read the documentation!", 'wp-meta-seo'), '4.6');
23
}
24
}
25
19
*/
20
private function __construct() {
21
if (null !== self::$instance) {
22
+ _doing_it_wrong(__FUNCTION__, __("This is not allowed, please read the documentation!", 'wp-meta-seo'), '4.6');
23
}
24
}
25
inc/pages/content-meta.php CHANGED
@@ -78,7 +78,7 @@ if (!empty($_REQUEST['_wp_http_referer'])) {
78
});
79
80
$('.metaseo-metadesc').bind('input propertychange', function () {
81
- metaseo_keywordlength(this.id, true);
82
});
83
84
$('.metaseo-metadesc').blur(function () {
78
});
79
80
$('.metaseo-metadesc').bind('input propertychange', function () {
81
+ metaseo_desclength(this.id, true);
82
});
83
84
$('.metaseo-metadesc').blur(function () {
inc/pages/dashboard.php CHANGED
@@ -51,7 +51,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
51
<span class="sr-only">0% Complete (success)</span>
52
</div>
53
</div>
54
- <p><?php _e('Meta title filled', 'wp-meta-seo') ?>: <?php _e('Loading...','wp-meta-seo-addon') ?></p>
55
</div>
56
<div class="col-xs-5 col-lg-4 text-right">
57
<input type="text" value="0" class="dial-warning">
@@ -73,7 +73,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
73
<span class="sr-only">0% Complete (success)</span>
74
</div>
75
</div>
76
- <p><?php _e('Meta description filled', 'wp-meta-seo') ?>: <?php _e('Loading...','wp-meta-seo-addon') ?></p>
77
</div>
78
<div class="col-xs-5 col-lg-4 text-right">
79
<input type="text" value="0" class="dial-info">
@@ -96,7 +96,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
96
<span class="sr-only">0% Complete (success)</span>
97
</div>
98
</div>
99
- <p><?php _e('Wrong resized images', 'wp-meta-seo') ?>: <?php _e('Loading...','wp-meta-seo-addon') ?></p>
100
</div>
101
<div class="col-xs-5 col-lg-4 text-right">
102
<input type="text" value="0" class="dial-danger">
@@ -118,7 +118,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
118
<span class="sr-only">0% Complete (success)</span>
119
</div>
120
</div>
121
- <p><?php _e('Image data filled (in content)', 'wp-meta-seo') ?>: <?php _e('Loading...','wp-meta-seo-addon') ?></p>
122
</div>
123
<div class="col-xs-5 col-lg-4 text-right">
124
<input type="text" value="0" class="dial-success">
@@ -140,7 +140,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
140
<span class="sr-only">0% Complete (success)</span>
141
</div>
142
</div>
143
- <p><?php _e('Latest month new or updated content', 'wp-meta-seo') ?>: <?php _e('Loading...','wp-meta-seo-addon') ?></p>
144
</div>
145
<div class="col-xs-5 col-lg-4 text-right">
146
<input type="text" value="0" class="dial-warning">
@@ -162,7 +162,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
162
<span class="sr-only">0% Complete (success)</span>
163
</div>
164
</div>
165
- <p><?php _e('Links title completed', 'wp-meta-seo') ?>: <?php _e('Loading...','wp-meta-seo-addon') ?></p>
166
</div>
167
<div class="col-xs-5 col-lg-4 text-right">
168
<input type="text" value="0" class="dial-warning">
51
<span class="sr-only">0% Complete (success)</span>
52
</div>
53
</div>
54
+ <p><?php _e('Meta title filled', 'wp-meta-seo') ?>: <?php _e('Loading...','wp-meta-seo') ?></p>
55
</div>
56
<div class="col-xs-5 col-lg-4 text-right">
57
<input type="text" value="0" class="dial-warning">
73
<span class="sr-only">0% Complete (success)</span>
74
</div>
75
</div>
76
+ <p><?php _e('Meta description filled', 'wp-meta-seo') ?>: <?php _e('Loading...','wp-meta-seo') ?></p>
77
</div>
78
<div class="col-xs-5 col-lg-4 text-right">
79
<input type="text" value="0" class="dial-info">
96
<span class="sr-only">0% Complete (success)</span>
97
</div>
98
</div>
99
+ <p><?php _e('Wrong resized images', 'wp-meta-seo') ?>: <?php _e('Loading...','wp-meta-seo') ?></p>
100
</div>
101
<div class="col-xs-5 col-lg-4 text-right">
102
<input type="text" value="0" class="dial-danger">
118
<span class="sr-only">0% Complete (success)</span>
119
</div>
120
</div>
121
+ <p><?php _e('Image data filled (in content)', 'wp-meta-seo') ?>: <?php _e('Loading...','wp-meta-seo') ?></p>
122
</div>
123
<div class="col-xs-5 col-lg-4 text-right">
124
<input type="text" value="0" class="dial-success">
140
<span class="sr-only">0% Complete (success)</span>
141
</div>
142
</div>
143
+ <p><?php _e('Latest month new or updated content', 'wp-meta-seo') ?>: <?php _e('Loading...','wp-meta-seo') ?></p>
144
</div>
145
<div class="col-xs-5 col-lg-4 text-right">
146
<input type="text" value="0" class="dial-warning">
162
<span class="sr-only">0% Complete (success)</span>
163
</div>
164
</div>
165
+ <p><?php _e('Links title completed', 'wp-meta-seo') ?>: <?php _e('Loading...','wp-meta-seo') ?></p>
166
</div>
167
<div class="col-xs-5 col-lg-4 text-right">
168
<input type="text" value="0" class="dial-warning">
inc/pages/google-analytics/metaseo-google-analytics-trackcode.php CHANGED
@@ -12,8 +12,7 @@
12
}
13
14
if (empty($this->google_alanytics['tableid_jail'])) {
15
- $message = "<div class='error'><p>" . __( "You need select a profile: " . '<a href="' . admin_url('admin.php?page=metaseo_google_analytics&view=wpmsga_trackcode') . '">' . __("authorize the plugin", 'wp-meta-seo') . '</a>.', 'wp-meta-seo' ) . ".</p></div>";
16
- //$message = __("You need select a profile:", 'wp-meta-seo') . ' <a href="' . admin_url('admin.php?page=metaseo_google_analytics&view=wpmsga_trackcode') . '">' . __("authorize the plugin", 'wp-meta-seo') . '</a>.';
17
echo $message;
18
}
19
@@ -62,7 +61,7 @@
62
}
63
}
64
} else {
65
- echo '<option value="">' . __("Property not found", 'google-analytics-dashboard-for-wp') . '</option>';
66
}
67
?>
68
</select>
12
}
13
14
if (empty($this->google_alanytics['tableid_jail'])) {
15
+ $message = "<div class='error'><p>" . __( 'You have to select a profile: ', 'wp-meta-seo') . '<a href="' . admin_url('admin.php?page=metaseo_google_analytics&view=wpmsga_trackcode') . '">' . __("authorize the plugin", 'wp-meta-seo') . '</a></p></div>';
16
echo $message;
17
}
18
61
}
62
}
63
} else {
64
+ echo '<option value="">' . __('Property not found', 'wp-meta-seo') . '</option>';
65
}
66
?>
67
</select>
inc/pages/metaseo-image-compression.php CHANGED
@@ -13,7 +13,7 @@ if (isset($_GET['action'])) {
13
if ('install-plugin' == $action) {
14
15
if (!current_user_can('install_plugins'))
16
- wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
17
18
include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
19
@@ -40,11 +40,11 @@ if (isset($_GET['action'])) {
40
wp_die($api);
41
}
42
43
- $title = __('Plugin Install');
44
$parent_file = 'plugins.php';
45
$submenu_file = 'plugin-install.php';
46
47
- $title = sprintf(__('Installing Plugin: %s'), $api->name . ' ' . $api->version);
48
$nonce = 'install-plugin_' . $plugin;
49
$url = 'update.php?action=install-plugin&plugin=' . urlencode($plugin);
50
if (isset($_GET['from']))
@@ -56,7 +56,7 @@ if (isset($_GET['action'])) {
56
$upgrader->install($api->download_link);
57
}elseif ('activate' == $action) {
58
if (!current_user_can('activate_plugins'))
59
- wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
60
61
if (is_multisite() && !is_network_admin() && is_network_only_plugin($plugin)) {
62
wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
13
if ('install-plugin' == $action) {
14
15
if (!current_user_can('install_plugins'))
16
+ wp_die(__('You do not have sufficient permissions to install plugins on this site.', 'wp-meta-seo'));
17
18
include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
19
40
wp_die($api);
41
}
42
43
+ $title = __('Plugin Install', 'wp-meta-seo');
44
$parent_file = 'plugins.php';
45
$submenu_file = 'plugin-install.php';
46
47
+ $title = sprintf(__('Installing Plugin: %s', 'wp-meta-seo'), $api->name . ' ' . $api->version);
48
$nonce = 'install-plugin_' . $plugin;
49
$url = 'update.php?action=install-plugin&plugin=' . urlencode($plugin);
50
if (isset($_GET['from']))
56
$upgrader->install($api->download_link);
57
}elseif ('activate' == $action) {
58
if (!current_user_can('activate_plugins'))
59
+ wp_die(__('You do not have sufficient permissions to activate plugins for this site.', 'wp-meta-seo'));
60
61
if (is_multisite() && !is_network_admin() && is_network_only_plugin($plugin)) {
62
wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
inc/pages/settings.php CHANGED
@@ -23,6 +23,7 @@ if (is_array($wpms_settings_404)) {
23
<?php
24
endif;
25
?>
26
</div>
27
</div>
28
<div class="wpms_content_settings">
@@ -75,6 +76,10 @@ if (is_array($wpms_settings_404)) {
75
<span class="message_saved"><?php _e('Saved', 'wp-meta-seo') ?></span>
76
</div>
77
78
<?php
79
if(is_plugin_active(WPMSEO_ADDON_FILENAME)){
80
echo $html_tabemail;
23
<?php
24
endif;
25
?>
26
+ <div class="wpms-tab-header" data-label="wpms-jutranslation"><?php _e('Translation', 'wp-meta-seo') ?></div>
27
</div>
28
</div>
29
<div class="wpms_content_settings">
76
<span class="message_saved"><?php _e('Saved', 'wp-meta-seo') ?></span>
77
</div>
78
79
+ <div class="content-box content-wpms-jutranslation">
80
+ <?php echo \Joomunited\WPMetaSEO\Jutranslation\Jutranslation::getInput(); ?>
81
+ </div>
82
+
83
<?php
84
if(is_plugin_active(WPMSEO_ADDON_FILENAME)){
85
echo $html_tabemail;
inc/pages/sitemaps/metaseo-google-sitemap.php CHANGED
@@ -25,7 +25,7 @@
25
}
26
echo '<div class="div_wpms_save_sitemaps"><input type="button" class="button button-primary wpms_save_create_sitemaps" value="' . __('Regenerate and save sitemaps', 'wp-meta-seo') . '"><span class="spinner spinner_save_sitemaps"></span></div>';
27
if(is_plugin_active(WPMSEO_ADDON_FILENAME)){
28
- echo '<p class="description">'.__("Sitemap automatic submission to Google Search Console on save, ","wp-meta-seo-addon").'<a href="'.admin_url('admin.php?page=metaseo_console&tab=settings').'">'.__("requires authentication","wp-meta-seo-addon").'</a></p>';
29
}
30
?>
31
</form>
25
}
26
echo '<div class="div_wpms_save_sitemaps"><input type="button" class="button button-primary wpms_save_create_sitemaps" value="' . __('Regenerate and save sitemaps', 'wp-meta-seo') . '"><span class="spinner spinner_save_sitemaps"></span></div>';
27
if(is_plugin_active(WPMSEO_ADDON_FILENAME)){
28
+ echo '<p class="description">'.__("Sitemap automatic submission to Google Search Console on save, ","wp-meta-seo").'<a href="'.admin_url('admin.php?page=metaseo_console&tab=settings').'">'.__("requires authentication","wp-meta-seo").'</a></p>';
29
}
30
?>
31
</form>
jutranslation/assets/css/jutranslation.css ADDED
@@ -0,0 +1,348 @@
1
+ #jutranslation {
2
+ font-family: 'Open Sans', Helvetica, Arial, sans-serif !important;
3
+ }
4
+
5
+ #jutranslation a {
6
+ text-decoration: none;
7
+ }
8
+
9
+ /* START WordPress only
10
+ -----------------------------------------------*/
11
+
12
+ div#jutranslation.wordpress div.control-group table#jutranslations-languages.table.table-striped {
13
+ width: 80%;
14
+ text-align: left;
15
+ }
16
+
17
+ div#jutranslation.wordpress div.control-group table#jutranslations-languages tbody tr td {
18
+ padding: 0 10px;
19
+ }
20
+
21
+ div#jutranslation.wordpress div.control-group.edition table {
22
+ width: 90%;
23
+ }
24
+
25
+ @media only screen and (min-width: 1920px) {
26
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(1) {
27
+ width: 35%;
28
+ }
29
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(2) {
30
+ width: 22%;
31
+ }
32
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(3) {
33
+ width: 22%;
34
+ }
35
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(4) {
36
+ width: 22%;
37
+ }
38
+ div#jutranslation.wordpress tr.do_table_filters td input.do_table_filter_reference,
39
+ div#jutranslation.wordpress tr.do_table_line td input.do_table_reference,
40
+ div#jutranslation.wordpress tr.do_table_filters td input.do_table_filter_language,
41
+ div#jutranslation.wordpress tr.do_table_line td input.do_table_language,
42
+ div#jutranslation.wordpress div.control-group.edition td input.do_table_filter_override,
43
+ div#jutranslation.wordpress div.control-group.edition td input.do_table_override {
44
+ min-width: 310px;
45
+ }
46
+ }
47
+
48
+ @media only screen and (min-width: 1480px) and (max-width: 1920px) {
49
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(1) {
50
+ width: 25%;
51
+ }
52
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(2) {
53
+ width: 22%;
54
+ }
55
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(3) {
56
+ width: 22%;
57
+ }
58
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(4) {
59
+ width: 22%;
60
+ }
61
+ div#jutranslation.wordpress tr.do_table_filters td input.do_table_filter_reference,
62
+ div#jutranslation.wordpress tr.do_table_line td input.do_table_reference,
63
+ div#jutranslation.wordpress tr.do_table_filters td input.do_table_filter_language,
64
+ div#jutranslation.wordpress tr.do_table_line td input.do_table_language,
65
+ div#jutranslation.wordpress div.control-group.edition td input.do_table_filter_override,
66
+ div#jutranslation.wordpress div.control-group.edition td input.do_table_override {
67
+ min-width: 250px;
68
+ }
69
+ }
70
+
71
+ @media only screen and (min-width: 1230px) and (max-width: 1480px) {
72
+ div#jutranslation.wordpress div.control-group.edition table {
73
+ width: 100%;
74
+ }
75
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(1) {
76
+ width: 35%;
77
+ }
78
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(2) {
79
+ width: auto;
80
+ }
81
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(3) {
82
+ width: auto;
83
+ }
84
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(4) {
85
+ width: auto;
86
+ }
87
+ div#jutranslation.wordpress tr.do_table_filters td input.do_table_filter_reference,
88
+ div#jutranslation.wordpress tr.do_table_line td input.do_table_reference,
89
+ div#jutranslation.wordpress tr.do_table_filters td input.do_table_filter_language,
90
+ div#jutranslation.wordpress tr.do_table_line td input.do_table_language,
91
+ div#jutranslation.wordpress div.control-group.edition td input.do_table_filter_override,
92
+ div#jutranslation.wordpress div.control-group.edition td input.do_table_override {
93
+ min-width: 200px;
94
+ }
95
+ }
96
+
97
+ @media only screen and (min-width: 740px) and (max-width: 1230px) {
98
+ div#jutranslation.wordpress div.control-group.edition table {
99
+ width: 100%;
100
+ }
101
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(1) {
102
+ width: 35%;
103
+ }
104
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(2) {
105
+ width: auto;
106
+ }
107
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(3) {
108
+ width: auto;
109
+ }
110
+ #jutranslation.wordpress > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(4) {
111
+ width: auto;
112
+ }
113
+ div#jutranslation.wordpress tr.do_table_filters td input.do_table_filter_reference,
114
+ div#jutranslation.wordpress tr.do_table_line td input.do_table_reference,
115
+ div#jutranslation.wordpress tr.do_table_filters td input.do_table_filter_language,
116
+ div#jutranslation.wordpress tr.do_table_line td input.do_table_language,
117
+ div#jutranslation.wordpress div.control-group.edition td input.do_table_filter_override,
118
+ div#jutranslation.wordpress div.control-group.edition td input.do_table_override {
119
+ min-width: 120px;
120
+ }
121
+ }
122
+
123
+
124
+ /* END WordPress only
125
+ -----------------------------------------------*/
126
+
127
+ #jutranslations-languages div.original_content a.jutranslation-override,
128
+ #jutranslations-languages div.original_content span a {
129
+ height: auto;
130
+ width: auto;
131
+ border: none;
132
+ text-shadow: none;
133
+ box-shadow: none;
134
+ background-color: #1d6cb0;
135
+ background: #1d6cb0;
136
+ border-radius: 2px;
137
+ padding: 2px 10px;
138
+ font-size: 12px;
139
+ text-transform: uppercase;
140
+ color: #fff;
141
+ line-height: 35px;
142
+ margin-right: 5px;
143
+ transition: all 0.2s ease-in;
144
+ }
145
+
146
+ #jutranslations-languages div.original_content a.jutranslation-override:hover,
147
+ #jutranslations-languages div.original_content a.jutranslation-override:active,
148
+ #jutranslations-languages div.original_content a.jutranslation-override:focus,
149
+ #jutranslations-languages div.original_content span a:hover,
150
+ #jutranslations-languages div.original_content span a:active,
151
+ #jutranslations-languages div.original_content span a:focus {
152
+ box-shadow: 1px 1px 12px #ccc;
153
+ text-decoration: none;
154
+ }
155
+
156
+ #jutranslations-languages div.original_content a.jutranslation-edition {
157
+ height: auto;
158
+ width: auto;
159
+ border: none;
160
+ text-shadow: none;
161
+ box-shadow: none;
162
+ background-color: #F9A541;
163
+ background: #F9A541;
164
+ border-radius: 2px;
165
+ padding: 2px 10px;
166
+ font-size: 12px;
167
+ text-transform: uppercase;
168
+ color: #fff;
169
+ line-height: 35px;
170
+ margin-right: 5px;
171
+ transition: all 0.2s ease-in;
172
+ }
173
+
174
+ #jutranslations-languages div.original_content a.jutranslation-edition:hover,
175
+ #jutranslations-languages div.original_content a.jutranslation-edition:active,
176
+ #jutranslations-languages div.original_content a.jutranslation-edition:focus {
177
+ box-shadow: 1px 1px 12px #ccc;
178
+ text-decoration: none;
179
+ }
180
+
181
+ #jutranslations-languages div.original_content a.jutranslation-share {
182
+ height: auto;
183
+ width: auto;
184
+ border: none;
185
+ text-shadow: none;
186
+ box-shadow: none;
187
+ background-color: #7AC143;
188
+ background: #7AC143;
189
+ border-radius: 2px;
190
+ padding: 2px 10px;
191
+ font-size: 12px;
192
+ text-transform: uppercase;
193
+ color: #fff;
194
+ line-height: 35px;
195
+ margin-right: 5px;
196
+ transition: all 0.2s ease-in;
197
+ }
198
+
199
+ #jutranslations-languages div.original_content a.jutranslation-share:hover,
200
+ #jutranslations-languages div.original_content a.jutranslation-share:active,
201
+ #jutranslations-languages div.original_content a.jutranslation-share:focus {
202
+ box-shadow: 1px 1px 12px #ccc;
203
+ text-decoration: none;
204
+ }
205
+
206
+ #jutranslations-languages thead tr th {
207
+ font-size: 14px;
208
+ text-transform: uppercase;
209
+ font-weight: bold;
210
+ line-height: 30px;
211
+ border-bottom: 1px solid #eee;
212
+ }
213
+
214
+ #jutranslations-languages tbody tr td.current_version,
215
+ #jutranslations-languages tbody tr td div.original_content {
216
+ font-weight: normal;
217
+ }
218
+
219
+ #jutranslations-languages tbody tr td {
220
+ font-weight: bold;
221
+ }
222
+
223
+ div#jutranslation.wordpress div.control-group p,
224
+ #jutranslation div.control-group div.controls p {
225
+ font-weight: bold;
226
+ text-transform: uppercase;
227
+ padding-left: 8px;
228
+ }
229
+
230
+ #jutranslations-languages tbody tr td {
231
+ vertical-align: middle;
232
+ }
233
+
234
+ #jutranslation .do_table_reference_copy,
235
+ #jutranslation .do_table_language_copy,
236
+ #jutranslation .do_table_override_copy {
237
+ font-size: 15px;
238
+ padding: 2px 2px 2px 5px;
239
+ vertical-align: middle;
240
+ }
241
+
242
+ #jutranslation > div.tab-description.alert.alert-info {
243
+ display: none;
244
+ }
245
+
246
+ #jutranslation .do_table_buttons {}
247
+
248
+ .jutranslation-share.just-added {
249
+ transition: all 1s ease-in;
250
+ color: #2167da;
251
+ font-weight: bold;
252
+ }
253
+
254
+ #jutranslation tr.do_table_heading td {
255
+ font-size: 14px;
256
+ text-transform: uppercase;
257
+ font-weight: bold;
258
+ line-height: 30px;
259
+ border-bottom: 1px solid #eee;
260
+ }
261
+
262
+ #jutranslation tr.do_table_filters {
263
+ height: 80px;
264
+ }
265
+
266
+ #jutranslation div.control-group.edition input {
267
+ border: 1px solid #ccc;
268
+ border-radius: 0;
269
+ box-shadow: none;
270
+ padding: 5px;
271
+ margin: 3px 0;
272
+ }
273
+
274
+ #jutranslation tr.do_table_filters > td:nth-child(1) {
275
+ vertical-align: middle;
276
+ }
277
+
278
+ #jutranslation tr.do_table_filters td input.do_table_filter_empty_reference,
279
+ #jutranslation tr.do_table_filters td input.do_table_filter_empty_language,
280
+ #jutranslation tr.do_table_filters td input.do_table_filter_empty_override {
281
+ margin: 0;
282
+ }
283
+
284
+ #jutranslation div.control-group.edition-message {
285
+ background-color: #2DAEF0;
286
+ padding: 15px;
287
+ color: #fff;
288
+ font-size: 15px;
289
+ }
290
+
291
+ #jutranslation #jutranslation_show_edition,
292
+ #jutranslation #jutranslation_cancel_edition {
293
+ margin: 10px 5px;
294
+ }
295
+
296
+ @media only screen and (min-width: 1680px) {
297
+ #jutranslation > div.control-group.edition > table > tbody > tr.do_table_heading > td:nth-child(1) {
298
+ min-width: 400px;
299
+ }
300
+ }
301
+
302
+ #jutranslation div.control-group.edition table tbody tr td textarea {
303
+ box-shadow: 1px 1px 12px #ccc;
304
+ border: 1px solid #888;
305
+ border-radius: 0;
306
+ transition: all 0.2s ease-in;
307
+ }
308
+
309
+ body > form > div:nth-child(3) > textarea {
310
+ border: 1px solid #ccc;
311
+ border-radius: 0;
312
+ box-shadow: none;
313
+ padding: 5px;
314
+ transition: all 0.2s ease-in;
315
+ }
316
+
317
+ #jutranslation div.control-group.edition tr td a i {
318
+ color: #444;
319
+ }
320
+
321
+ .wordpress .table-striped tbody > tr:nth-child(odd) > td,
322
+ .wordpress .table-striped tbody > tr:nth-child(odd) > th {
323
+ background-color: #f9f9f9;
324
+ }
325
+
326
+ .wordpress .dashicons-arrow-right-alt2 {
327
+ font-size: 15px;
328
+ vertical-align: sub;
329
+ }
330
+
331
+ a.disabled {
332
+ background-color: #c3c2c2 !important;
333
+ color: #333 !important;
334
+ cursor: default;
335
+ position: relative;
336
+ }
337
+
338
+ #jutranslation_toast {
339
+ position: fixed;
340
+ top: 40px;
341
+ right: 20px;
342
+ padding: 14px 15px;
343
+ background-color: #323232;
344
+ color: #FFFFFF;
345
+ font-size: 14px;
346
+ border-radius: 2px;
347
+ z-index: 1000;
348
+ }
jutranslation/assets/images/preview_loader.gif ADDED
Binary file
jutranslation/assets/images/radio.svg ADDED
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="utf-8"?><svg width='14px' height='14px' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-blank"><rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect><g transform="scale(0.55)"><circle cx="30" cy="150" r="30" fill="#7b92bd"><animate attributeName="opacity" from="0" to="1" dur="1s" begin="0" repeatCount="indefinite" keyTimes="0;0.5;1" values="0;1;1"></animate></circle><path d="M90,150h30c0-49.7-40.3-90-90-90v30C63.1,90,90,116.9,90,150z" fill="#545f85"><animate attributeName="opacity" from="0" to="1" dur="1s" begin="0.1" repeatCount="indefinite" keyTimes="0;0.5;1" values="0;1;1"></animate></path><path d="M150,150h30C180,67.2,112.8,0,30,0v30C96.3,30,150,83.7,150,150z" fill="#545f85"><animate attributeName="opacity" from="0" to="1" dur="1s" begin="0.2" repeatCount="indefinite" keyTimes="0;0.5;1" values="0;1;1"></animate></path></g></svg>
jutranslation/assets/js/jutranslation.js ADDED
@@ -0,0 +1,815 @@
1
+ var joomunited_url = 'https://www.joomunited.com/';
2
+
3
+ jQuery(document).ready(function($){
4
+ // Define jutranslation_ajax_action if doesn't exist
5
+ if (typeof jutranslation_ajax_action === 'undefined') {
6
+ jutranslation_ajax_action='';
7
+ }
8
+
9
+ //Load the available version from Joomunited
10
+ $.each(julanguages, function(){
11
+ var julanguage = this;
12
+ $.ajax({
13
+ url : joomunited_url + "index.php?option=com_jutranslation&task=translations.getTranslations",
14
+ type : 'POST',
15
+ data : julanguage,
16
+ success : function(data){
17
+ data = JSON.parse(data);
18
+
19
+ $('#jutranslations-languages tbody tr[data-slug="'+ julanguage.extension + '"]').each(function(){
20
+ var lang = $(this).data('lang');
21
+ var slug = $(this).data('slug');
22
+
23
+ //Is this language one of Joomunited has translated
24
+ var found = false;
25
+
26
+ //For each translation found add the version and an install btn
27
+ $.each(data.data,function(){
28
+ if(this.language === lang && this.extension === slug){
29
+ found = true;
30
+ //Add new version availability information
31
+ var html;
32
+ switch (versionCompare(julanguage.versions[this.language], this.extension_version, julanguage.revisions[this.language], this.revision)) {
33
+ case 1:
34
+ html = 'You already have the newer version<br/>The latest version on Joomunited is ' + this.extension_version + ' rev'+this.revision + ' <a class="jutranslation-install" href="#" data-extension="' + this.extension + '" data-id="' + this.id + '">Install this version</a>';
35
+ break;
36
+ case 0:
37
+ html = 'You already have the latest version <a class="jutranslation-install" href="#" data-extension="' + this.extension + '" data-id="' + this.id + '">Reinstall</a>';
38
+ break;
39
+ case -1:
40
+ if (julanguage.versions[this.language]) {
41
+ install_update = 'Update';
42
+ } else {
43
+ install_update = 'Install';
44
+ }
45
+
46
+ html = 'There is a new version of language file available v' + this.extension_version + ' rev'+this.revision + ' <a class="jutranslation-install" href="#" data-extension="' + this.extension + '" data-id="' + this.id + '">' + install_update + '</a>';
47
+ }
48
+ $('#jutranslations-languages tr[data-lang="'+ this.language + '"][data-slug="'+ julanguage.extension + '"] td .latest_version').html(html);
49
+
50
+ //Initialize all installation button
51
+ $('.jutranslation-install').unbind().bind('click',function(e){
52
+ e.preventDefault();
53
+
54
+ var $clicked_button = $(this);
55
+ var $parent_line = $clicked_button.parents('tr');
56
+ var slug = $clicked_button.parents('tr').data('slug');
57
+
58
+ //Get from Joomunited the translation
59
+ $.ajax({
60
+ url : joomunited_url + "/index.php?option=com_jutranslation&task=translations.download",
61
+ type : 'POST',
62
+ data : {
63
+ extension : $clicked_button.data("extension"),
64
+ translation : $clicked_button.data("id")
65
+ },
66
+ success : function(result){
67
+ result = JSON.parse(result);
68
+
69
+ //Do not show language columns if it's en-US
70
+ var show_reference = true;
71
+ if(result.datas.language==='en-US'){
72
+ show_reference = false;
73
+ }
74
+
75
+ var table_option = {
76
+ language : result.datas.language,
77
+ confirm_button_action : function(e, $_content, close){
78
+ e.preventDefault();
79
+
80
+ var caller = this;
81
+
82
+ //Get the strings
83
+ strings = {};
84
+ var modified = 0;
85
+ $.each($_content.find('.do_table_line'),function(){
86
+ //Get only strings if they need to be translated and have actually been translated
87
+ switch (1===1){
88
+ case $(this).find('.do_table_language').is('[readonly]'):
89
+ strings[$(this).find('.do_table_constant').data('value')] = $(this).find('.do_table_language').val();
90
+ break;
91
+ case $(this).find('.do_table_language').prop('defaultValue') !== $(this).find('.do_table_language').val():
92
+ strings[$(this).find('.do_table_constant').data('value')] = $(this).find('.do_table_language').val();
93
+ modified = 1;
94
+ break;
95
+ }
96
+ });
97
+
98
+ //Initialize ajax request datas
99
+ ajax_data = {
100
+ action : jutranslation_ajax_action,
101
+ slug: slug,
102
+ strings : JSON.stringify(strings),
103
+ language : result.datas.language,
104
+ extension_version : result.datas.version,
105
+ revision : result.datas.revision,
106
+ modified : modified,
107
+ wp_nonce : jutranslation_token
108
+ };
109
+ ajax_data[jutranslation_token] = 1;
110
+
111
+ $.ajax({
112
+ type: 'POST',
113
+ url: jutranslation_base_url + 'task=jutranslation.saveStrings',
114
+ data: ajax_data,
115
+ success: function (result2) {
116
+ result2 = JSON.parse(result2);
117
+ if (result2.status === 'success') {
118
+ //Close the edition
119
+ if(close) {
120
+ caller.cancel_button_action(e);
121
+ }
122
+ toast('Modifications saved');
123
+
124
+ $parent_line.find('.current_version').html(result.datas.version + ' rev' + result.datas.revision);
125
+ $parent_line.attr('data-version', result.datas.version);
126
+
127
+ if(modified){
128
+ $parent_line.find('.jutranslation-share').show().addClass('just-added');
129
+ }else{
130
+ $parent_line.find('.jutranslation-share').hide();
131
+ }
132
+
133
+ $parent_line.find('.latest_version').html('The language file has been updated');
134
+ $parent_line.find('.jutranslation-edition').removeClass('disabled');
135
+ } else {
136
+ alert('Error while updating language file');
137
+ }
138
+ }
139
+ });
140
+ },
141
+ columns : {
142
+ reference : {
143
+ show : show_reference
144
+ },
145
+ language : {
146
+ editable : true,
147
+ title : 'Language ' + result.datas.language,
148
+ allow_copy : false
149
+ },
150
+ override : {
151
+ show : false
152
+ }
153
+ },
154
+ copy_destination : 'do_table_language',
155
+ after_init : function($_content){
156
+ //Do not allow to edit already translated strings
157
+ $_content.find('.do_table_language').filter(function () {
158
+ return this.value.length > 0
159
+ }).attr('readonly','readonly').parents('tr').find('[class^="do_table_copy_"]').hide();
160
+
161
+ //Set an introduction message
162
+ if($_content.find('.do_table_language').not('[readonly="readonly"]').length){
163
+ $_content.prepend('<h3>Some strings are not currently translated to your language, you can translate it now. If you don\'t translate the english translation will be used instead</h3>');
164
+ }
165
+ }
166
+ };
167
+
168
+ //Generate the table
169
+ doTable(result.datas.strings, table_option);
170
+ }
171
+ });
172
+ });
173
+ }
174
+ });
175
+
176
+ //Check if a translation has been found on joomunited
177
+ var $line = $('#jutranslations-languages tr[data-lang="'+ lang + '"][data-slug="'+ julanguage.extension + '"]');
178
+ if(found===false){
179
+ $line.find('td .latest_version').html('No translation found');
180
+ }else{
181
+ if(!$line.attr('data-installed')){
182
+ $line.find('td .jutranslation-edition').addClass('disabled').attr('title','Please install the latest available version first');
183
+ }
184
+ }
185
+ });
186
+ }
187
+ });
188
+ });
189
+ // Edit an installed version
190
+ $('.jutranslation-edition').click(function(e){
191
+ e.preventDefault();
192
+
193
+ var $clicked_button = $(this);
194
+
195
+ // Do nothing is disabled
196
+ if ($clicked_button.hasClass('disabled')) {
197
+ return;
198
+ }
199
+
200
+ var language = $clicked_button.parents('tr').data('lang');
201
+ var slug = $clicked_button.parents('tr').data('slug');
202
+
203
+ getStrings(language, slug, function(datas){
204
+
205
+ var table_option = {
206
+ language : language,
207
+ slug : slug,
208
+ confirm_button_action : function(e, $_content, close){
209
+ e.preventDefault();
210
+
211
+ var caller = this;
212
+
213
+ //Get the strings
214
+ values = {};
215
+ modified = 0;
216
+
217
+ $.each($_content.find('.do_table_line'),function(){
218
+ var value = $(this).find('.do_table_language').val();
219
+ if(value !== ''){
220
+ values[$(this).find('.do_table_constant').data('value')] = value;
221
+ }
222
+
223
+ //Check if something has been modified
224
+ if ($(this).find('.do_table_language').prop('defaultValue') !== $(this).find('.do_table_language').val()) {
225
+ modified = 1;
226
+ }
227
+ });
228
+
229
+ if (modified === 1) {
230
+ //Initialize ajax request datas
231
+ ajax_data = {
232
+ action : jutranslation_ajax_action,
233
+ strings: JSON.stringify(values),
234
+ language: language,
235
+ slug: slug,
236
+ destination: 'edition',
237
+ modified: '1',
238
+ wp_nonce : jutranslation_token
239
+ };
240
+ ajax_data[jutranslation_token] = 1;
241
+
242
+ $.ajax({
243
+ type: 'POST',
244
+ url: jutranslation_base_url + 'task=jutranslation.saveStrings',
245
+ data: ajax_data,
246
+ success: function (result) {
247
+ result = JSON.parse(result);
248
+ if (result.status === 'success') {
249
+ //Close the edition
250
+ if(close) {
251
+ caller.cancel_button_action(e);
252
+ }
253
+ toast('Modifications saved');
254
+
255
+ $clicked_button.parents('tr').find('.jutranslation-share').show().addClass('just-added');
256
+ } else {
257
+ alert('Error while updating language file');
258
+ }
259
+ }
260
+ });
261
+ }else{
262
+ //Do nothing and close the edition
263
+ if(close) {
264
+ caller.cancel_button_action(e);
265
+ }
266
+ toast('Modifications saved');
267
+ }
268
+ },
269
+ columns : {
270
+ language : {
271
+ editable : true,
272
+ title : 'Language ' + language,
273
+ allow_copy : false
274
+ },
275
+ override : {
276
+ show : false
277
+ }
278
+ },
279
+ copy_destination : 'do_table_language',
280
+ after_init : function($_content){
281
+ //Add a message for translators before allowing to do anything
282
+ var message = '<p>This feature is for translators only, the content may be overwritten during the next language update. ' +
283
+ 'If you only want to edit language strings for your own purpose please use the override feature.</p>' +
284
+ '<p><a href="#" id="jutranslation_show_edition" class="btn btn-lg btn-success button button-primary">OK got it, let me translate and share</a>' +
285
+ '<a href="#" id="jutranslation_cancel_edition" class="btn btn-lg btn-success button button-primary">Cancel</a></p>';
286
+
287
+ $_content.hide().after('<div class="control-group edition-message">' + message + '</div>');
288
+
289
+ //Click on ok edit button
290
+ $('#jutranslation_show_edition').click(function(){
291
+ $('#jutranslation .control-group.edition-message').remove();
292
+ $('#jutranslation .control-group.edition').show();
293
+ });
294
+
295
+ //Click on cancel edition button
296
+ $('#jutranslation_cancel_edition').click(function(){
297
+ $('#jutranslation .control-group.edition-message').remove();
298
+ $('#jutranslation .control-group.edition').remove();
299
+ $('#jutranslation .control-group').show();
300
+ });
301
+ }
302
+ };
303
+
304
+ //Generate the table
305
+ doTable(datas, table_option);
306
+ });
307
+ });
308
+
309
+ $('.jutranslation-override').click(function(e){
310
+ e.preventDefault();
311
+
312
+ var $clicked_button = $(this);
313
+
314
+ var language = $clicked_button.parents('tr').data('lang');
315
+ var slug = $clicked_button.parents('tr').data('slug');
316
+
317
+ //Do not show language columns if it's en-US
318
+ var show_language = true;
319
+ if(language==='en-US'){
320
+ show_language = false;
321
+ }
322
+
323
+ getStrings(language, slug, function(datas) {
324
+ var table_option = {
325
+ language : language,
326
+ confirm_button_action : function(e, $_content, close){
327
+ e.preventDefault();
328
+
329
+ var caller = this;
330
+
331
+ //Get the strings
332
+ overrides = {};
333
+ $.each($_content.find('.do_table_line'),function(){
334
+ var value = $(this).find('.do_table_override').val();
335
+ if(value !== ''){
336
+ overrides[$(this).find('.do_table_constant').data('value')] = value;
337
+ }
338
+ });
339
+
340
+ //Initialize ajax request datas
341
+ ajax_data = {
342
+ action : jutranslation_ajax_action,
343
+ strings : JSON.stringify(overrides),
344
+ language : this.language,
345
+ slug: slug,
346
+ destination : 'override',
347
+ wp_nonce : jutranslation_token
348
+ };
349
+ ajax_data[jutranslation_token] = 1;
350
+
351
+ $.ajax({
352
+ type : 'POST',
353
+ url : jutranslation_base_url + 'task=jutranslation.saveStrings',
354
+ data : ajax_data,
355
+ success : function(result){
356
+ result = JSON.parse(result);
357
+ if(result.status === 'success'){
358
+ $clicked_button.parents('tr').find('.jutranslation-override-count').html(Object.keys(overrides).length);
359
+
360
+ if(close) {
361
+ caller.cancel_button_action(e);
362
+ }
363
+ toast('Modifications saved');
364
+ }else{
365
+ alert('Error while updating language file');
366
+ }
367
+ }
368
+ });
369
+ },
370
+ columns : {
371
+ language : {
372
+ title : 'Language ' + language,
373
+ show : show_language
374
+ }
375
+ }
376
+ };
377
+
378
+ //Generate the table
379
+ doTable(datas, table_option);
380
+ });
381
+ });
382
+
383
+ //Share a translation to Joomunited
384
+ $('.jutranslation-share').click(function(e){
385
+ e.preventDefault();
386
+ if(typeof SqueezeBox !== 'undefined' ){
387
+ //Open Joomla lightbox
388
+ SqueezeBox.open(jutranslation_base_url + 'action=&task=jutranslation.showViewForm&language=' + $(this).closest('tr').attr('data-lang'), {handler: 'iframe'});
389
+ }else{
390
+ //Open Wordpress lightbox
391
+ tb_show('Share with Joomunited',jutranslation_base_url + 'action=' + jutranslation_ajax_action + '&task=jutranslation.showViewForm&slug=' + $(this).closest('tr').attr('data-slug') + '&language=' + $(this).closest('tr').attr('data-lang') + '&TB_iframe=true');
392
+ }
393
+ });
394
+
395
+ function doTable(datas, options) {
396
+ // DOM element containing the generated content
397
+ var $_content;
398
+
399
+ var default_options = {
400
+ language : null,
401
+ slug : null,
402
+ confirm_button_label: 'Save and close',
403
+ save_button_label: 'Save',
404
+ cancel_button_label: 'Cancel',
405
+ cancel_button_action: function (e) {
406
+ if(e!==undefined){
407
+ e.preventDefault();
408
+ }
409
+
410
+ $('#jutranslation .control-group.edition').remove();
411
+ $('#jutranslation .control-group').show();
412
+ },
413
+ confirm_button_action : function (e) {
414
+ if(e!==undefined){
415
+ e.preventDefault();
416
+ }
417
+
418
+ options.cancel_button_action(e);
419
+ },
420
+ after_init : function() {},
421
+ columns : {
422
+ constant : {
423
+ show : true,
424
+ title : 'Constant',
425
+ allow_copy : false
426
+ },
427
+ reference : {
428
+ show : true,
429
+ editable : false,
430
+ title : 'Reference en-US',
431
+ allow_copy : true
432
+
433
+ },
434
+ language : {
435
+ show : true,
436
+ editable : false,
437
+ title : 'Language',
438
+ allow_copy : true
439
+ },
440
+ override : {
441
+ show : true,
442
+ editable : true,
443
+ title : 'Override',
444
+ allow_copy : false
445
+ }
446
+ },
447
+ copy_destination : 'do_table_override'
448
+ };
449
+
450
+ // Initialize options variable if not already
451
+ if(options === undefined){
452
+ var options = {};
453
+ }
454
+
455
+ // Merge the default options to the passed ones
456
+ options = $.extend(true, {}, default_options, options);
457
+
458
+ //Add a button to save
459
+ var content = '';
460
+ content += '<p class="do_table_buttons">';
461
+ content += ' <a href="#" class="do_table_confirm btn btn-primary button button-primary">' + options.confirm_button_label + '</a>';
462
+ content += ' <a href="#" class="do_table_save btn btn-primary button button-primary">' + options.save_button_label + '</a>';
463
+ content += ' <a href="#" class="do_table_cancel btn btn-primary button">' + options.cancel_button_label + '</a>';
464
+ content += '</p>';
465
+
466
+ //Create the table of strings
467
+ content += '<table>';
468
+
469
+ //Add columns names
470
+ content += '<tr class="do_table_heading">' +
471
+ ' <td' + ( options.columns.constant.show?'':' class="hidden"' ) + '>' + options.columns.constant.title + '</td>' +
472
+ ' <td' + ( options.columns.reference.show?'':' class="hidden"' ) + '>' + options.columns.reference.title + '</td>' +
473
+ ' <td' + ( options.columns.language.show?'':' class="hidden"' ) + '>' + options.columns.language.title + '</td>' +
474
+ ' <td' + ( options.columns.override.show?'':' class="hidden"' ) + '>' + options.columns.override.title + '</td>' +
475
+ '</tr>';
476
+
477
+ //Add filter inputs
478
+ content += '<tr class="do_table_filters">' +
479
+ ' <td' + ( options.columns.constant.show?'':' class="hidden"' ) + '><input class="do_table_filter_constant" type="text" placeholder="Filter by constant"/></td>' +
480
+ ' <td' + ( options.columns.reference.show?'':' class="hidden"' ) + '><input class="do_table_filter_reference" type="text" placeholder="Filter by reference"/><br/>Show only empty <input type="checkbox" class="do_table_filter_empty_reference"/><br/>Show only not empty <input type="checkbox" class="do_table_filter_not_empty_reference"/></td>' +
481
+ ' <td' + ( options.columns.language.show?'':' class="hidden"' ) + '><input class="do_table_filter_language" type="text" placeholder="Filter by language"/><br/>Show only empty <input type="checkbox" class="do_table_filter_empty_language"/><br/>Show only not empty <input type="checkbox" class="do_table_filter_not_empty_language"/></td>' +
482
+ ' <td' + ( options.columns.override.show?'':' class="hidden"' ) + '><input class="do_table_filter_override" type="text" placeholder="Filter by override"/><br/>Show only empty <input type="checkbox" class="do_table_filter_empty_override"/><br/>Show only not empty <input type="checkbox" class="do_table_filter_not_empty_override"/></td>' +
483
+ '</tr>';
484
+
485
+ $.each(datas, function(key,value){
486
+ content += '' +
487
+ '<tr class="do_table_line">' +
488
+ ' <td' + ( options.columns.constant.show?'':' class="hidden"' ) + '>' +
489
+ ' <span class="do_table_constant" data-value="' + htmlEntities(value.key) + '">' + htmlEntities(value.key) + '</span>' +
490
+ ' </td>' +
491
+ ' <td' + ( options.columns.reference.show?'':' class="hidden"' ) + '>' +
492
+ ' <input type="text" class="do_table_reference" value="' + htmlEntities(value.reference) + '" ' + ( options.columns.reference.editable?'':'readonly="readonly"' ) + ' />' + (options.columns.reference.allow_copy?'<a title="copy" href="#" class="do_table_copy_reference"><i class="icon-arrow-right-4 dashicons dashicons-arrow-right-alt2"></i></a>':'') +
493
+ ' </td>' +
494
+ ' <td' + ( options.columns.language.show?'':' class="hidden"' ) + '>' +
495
+ ' <input type="text" class="do_table_language" value="' + htmlEntities(value.language) + '" ' + ( options.columns.language.editable?'':'readonly="readonly"' ) + ' >' + (options.columns.language.allow_copy?'<a title="copy" href="#" class="do_table_copy_language"><i class="icon-arrow-right-4 dashicons dashicons-arrow-right-alt2"></i></a>':'') +
496
+ ' </td>' +
497
+ ' <td' + ( options.columns.override.show?'':' class="hidden"' ) + '>' +
498
+ ' <input type="text" class="do_table_override" value="' + htmlEntities(value.override) + '" ' + ( options.columns.override.editable?'':'readonly="readonly"' ) + ' >' + (options.columns.override.allow_copy?'<a title="copy" href="#" class="do_table_copy_override"><i class="icon-arrow-right-4 dashicons dashicons-arrow-right-alt2"></i></a>':'') +
499
+ ' </td>' +
500
+ '</tr>';
501
+ });
502
+ content += '</table>';
503
+
504
+ $('#jutranslation .control-group').after('<div class="control-group edition">' + content + '</div>');
505
+ $_content = $('#jutranslation .control-group.edition');
506
+
507
+ // Enable filtering
508
+ $_content.find('[class^="do_table_filter_"]').on("change keyup paste", function(){
509
+ //Texts filters
510
+ var filter_constant = $_content.find('.do_table_filter_constant').val();
511
+ var filter_reference = $_content.find('.do_table_filter_reference').val();
512
+ var filter_language = $_content.find('.do_table_filter_language').val();
513
+ var filter_override = $_content.find('.do_table_filter_override').val();
514
+
515
+ // Do not allow to check both filters
516
+ switch (1==1) {
517
+ case $(this).hasClass('do_table_filter_empty_reference') && $(this).is(':checked'):
518
+ $_content.find('.do_table_filter_not_empty_reference').attr('checked',null);
519
+ break;
520
+ case $(this).hasClass('do_table_filter_empty_language') && $(this).is(':checked'):
521
+ $_content.find('.do_table_filter_not_empty_language').attr('checked',null);
522
+ break;
523
+ case $(this).hasClass('do_table_filter_empty_override') && $(this).is(':checked'):
524
+ $_content.find('.do_table_filter_not_empty_override').attr('checked',null);
525
+ break;
526
+ case $(this).hasClass('do_table_filter_not_empty_reference') && $(this).is(':checked'):
527
+ $_content.find('.do_table_filter_empty_reference').attr('checked',null);
528
+ break;
529
+ case $(this).hasClass('do_table_filter_not_empty_language') && $(this).is(':checked'):
530
+ $_content.find('.do_table_filter_empty_language').attr('checked',null);
531
+ break;
532
+ case $(this).hasClass('do_table_filter_not_empty_override') && $(this).is(':checked'):
533
+ $_content.find('.do_table_filter_empty_override').attr('checked',null);
534
+ break;
535
+
536
+ }
537
+ if($(this).is('[class^="do_table_filter_empty"]')){
538
+
539
+ } else if ($(this).is('[class^="do_table_filter_not_empty"]')) {
540
+
541
+ }
542
+ $_content.find('.do_table_filter_not_empty_reference')
543
+
544
+ //Empty filters
545
+ var filter_empty_reference = $_content.find('.do_table_filter_empty_reference').is(":checked");
546
+ var filter_empty_language = $_content.find('.do_table_filter_empty_language').is(":checked");
547
+ var filter_empty_override = $_content.find('.do_table_filter_empty_override').is(":checked");
548
+
549
+ var filter_not_empty_reference = $_content.find('.do_table_filter_not_empty_reference').is(":checked");
550
+ var filter_not_empty_language = $_content.find('.do_table_filter_not_empty_language').is(":checked");
551
+ var filter_not_empty_override = $_content.find('.do_table_filter_not_empty_override').is(":checked");
552
+
553
+ // Show all rows
554
+ $_content.find('tr.do_table_line').show();
555
+
556
+ // Filtering is active
557
+ if(filter_constant !== '' || filter_reference !== '' || filter_language !== '' || filter_override != '' || filter_empty_reference!==false || filter_empty_language !== false || filter_empty_override !== false || filter_not_empty_reference!==false || filter_not_empty_language !== false || filter_not_empty_override !== false){
558
+ // Show only rows matching search
559
+ $_content.find('.do_table_line').filter(function(){
560
+ //Filter by empty reference
561
+ if(filter_empty_reference && $(this).find('.do_table_reference').val() !== ''){
562
+ return true;
563
+ }
564
+
565
+ //Filter by empty language
566
+ if(filter_empty_language && $(this).find('.do_table_language').val() !== ''){
567
+ return true;
568
+ }
569
+
570
+ //Filter by empty override
571
+ if(filter_empty_override && $(this).find('.do_table_override').val() !== ''){
572
+ return true;
573
+ }
574
+
575
+ //Filter by not empty reference
576
+ if(filter_not_empty_reference && $(this).find('.do_table_reference').val() === ''){
577
+ return true;
578
+ }
579
+
580
+ //Filter by empty language
581
+ if(filter_not_empty_language && $(this).find('.do_table_language').val() === ''){
582
+ return true;
583
+ }
584
+
585
+ //Filter by empty override
586
+ if(filter_not_empty_override && $(this).find('.do_table_override').val() === ''){
587
+ return true;
588
+ }
589
+
590
+ //Filter by constant
591
+ if(filter_constant !== ''){
592
+ var regex = new RegExp(escapeRegExp(filter_constant), 'i');
593
+ if(!regex.test($(this).find('.do_table_constant').data('value'))){
594
+ return true;
595
+ }
596
+ }
597
+
598
+ //Filter by reference
599
+ if(filter_reference !== ''){
600
+ var regex = new RegExp(escapeRegExp(filter_reference), 'i');
601
+ if(!regex.test($(this).find('.do_table_reference').val())){
602
+ return true;
603
+ }
604
+ }
605
+
606
+ //Filter by current language
607
+ if(filter_language !== ''){
608
+ var regex = new RegExp(escapeRegExp(filter_language), 'i');
609
+ if(!regex.test($(this).find('.do_table_language').val())){
610
+ return true;
611
+ }
612
+ }
613
+
614
+ //Filter by override
615
+ if(filter_override !== ''){
616
+ var regex = new RegExp(escapeRegExp(filter_override), 'i');
617
+ if(!regex.test($(this).find('.do_table_override').val())){
618
+ return true;
619
+ }
620
+ }
621
+
622
+ return false;
623
+ }).hide();
624
+ return;
625
+ }
626
+ });
627
+
628
+ // Enable copy from one input to another
629
+ $_content.find('[class^="do_table_copy_"]').click(function(e){
630
+ e.preventDefault();
631
+
632
+ //Get the value from clicked element
633
+ if($(this).hasClass('do_table_copy_reference')){
634
+ var value = $(this).parents('tr').find('.do_table_reference').val();
635
+ }else if($(this).hasClass('do_table_copy_language')){
636
+ var value = $(this).parents('tr').find('.do_table_language').val();
637
+ }else if($(this).hasClass('do_table_copy_override')){
638
+ var value = $(this).parents('tr').find('.do_table_override').val();
639
+ }
640
+
641
+ //Copy value to destination input
642
+ $(this).parents('tr').find('.'+options.copy_destination).val(value);
643
+ });
644
+
645
+ //Save and close
646
+ $_content.find('.do_table_confirm').click(function(e){
647
+ options.confirm_button_action(e, $_content, true);
648
+ });
649
+
650
+ //Confirm the current action
651
+ $_content.find('.do_table_save').click(function(e){
652
+ options.confirm_button_action(e, $_content, false);
653
+ });
654
+
655
+ //Cancel the current action
656
+ $_content.find('.do_table_cancel').click(function(e, $_content){
657
+ options.cancel_button_action(e);
658
+ });
659
+
660
+ $('#jutranslation .control-group').not('.edition').hide();
661
+
662
+ $_content.find('.do_table_line input').focus(function(){
663
+ $this = $(this);
664
+ $this_line = $this.parents('tr');
665
+
666
+ //Do nothing if already hidden
667
+ if($(this).is(":hidden")){
668
+ return;
669
+ }
670
+
671
+ //Remove all old textarea
672
+ $this_line.find('textarea').remove();
673
+
674
+ $this_line.find('input').each(function(){
675
+ // Get the input value
676
+ var val = $(this).val();
677
+
678
+ // Add a textarea after the inpu
679
+ $('<textarea style="width:' + $(this).css('width') + '" ' + ($(this).is('[readonly="readonly"]')?'readonly="readonly"':'') + '>' + htmlEntities(val) + '</textarea>').insertAfter(this);
680
+
681
+ // Hide the input
682
+ $(this).hide();
683
+ });
684
+
685
+ // Remove textarea on focus out
686
+ $this.siblings('textarea').focus().focusout(function(){
687
+ $this.val(($(this).val()));
688
+ $this_line.find('input').show();
689
+ $this_line.find('textarea').hide(); //Hide instead of remove to avoid html5fallback.js error
690
+ });
691
+ });
692
+
693
+ options.after_init($_content);
694
+ }
695
+
696
+ function getStrings(language, slug, done_function) {
697
+ var strings = {};
698
+ $.ajax({
699
+ type: 'POST',
700
+ url: jutranslation_base_url + 'task=jutranslation.getTranslation',
701
+ data: {
702
+ action : jutranslation_ajax_action,
703
+ language: language,
704
+ slug: slug
705
+ },
706
+ success: function (result) {
707
+ result = JSON.parse(result);
708
+
709
+ if (result.status === 'success') {
710
+ done_function(result.datas.strings);
711
+ } else {
712
+ alert('Error while loading strings');
713
+ }
714
+ }
715
+ });
716
+ }
717
+
718
+ /**
719
+ * Escape a string to allow using it literally in a regex
720
+ * @param string
721
+ * @return string escaped
722
+ */
723
+ function escapeRegExp(string) {
724
+ return string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\amp;");
725
+ }
726
+
727
+ /**
728
+ * Secure a string to use it in html content
729
+ * @param string to espace
730
+ * @return {string} escaped string
731
+ */
732
+ function htmlEntities(string){
733
+ return String(string).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
734
+ }
735
+
736
+ /**
737
+ * Compare two version numbers and their revisions
738
+ * @param version1
739
+ * @param version2
740
+ * @param revision_version1
741
+ * @param revision_version2
742
+ * @return 1 if version1>version2, -1 if version1<version2 , 0 if version1==version2
743
+ */
744
+ function versionCompare(version1, version2, revision_version1, revision_version2){
745
+ if(version1==='') {
746
+ version1 = '0';
747
+ }
748
+
749
+ if(version2==='') {
750
+ version2 = '0';
751
+ }
752
+
753
+ version1 = version1.split('.');
754
+ version2 = version2.split('.');
755
+
756
+ if(typeof revision_version1 === 'undefined'){
757
+ revision_version1 = 0;
758
+ }
759
+
760
+ if(typeof revision_version2 === 'undefined'){
761
+ revision_version2 = 0;
762
+ }
763
+
764
+ for(var ij=0; ij < version1.length; ij++ ) {
765
+ if(typeof version2[ij] === 'undefined'){
766
+ //Version 1 has the longest version
767
+ for(var ik=ij; ik < version1.length; ik++){
768
+ //Check if it has another thing as 0 trailing
769
+ if(parseInt(version[1]) > 0){
770
+ //Latest version is upper
771
+ return 1;
772
+ }
773
+ }
774
+ //End only with 0 version numbers, it's equal
775
+ if(revision_version1 > revision_version2){
776
+ return 1;
777
+ } else if(revision_version1 < revision_version2){
778
+ return -1;
779
+ }
780
+ return 0;
781
+ } else {
782
+ if(parseInt(version1[ij]) > parseInt(version2[ij])) {
783
+ return 1;
784
+ } else if(parseInt(version1[ij]) < parseInt(version2[ij])) {
785
+ return -1;
786
+ }
787
+ }
788
+ }
789
+
790
+ //Version 2 has the longest version or is equal
791
+ for(var ik=ij; ik < version2.length; ik++){
792
+ //Check if it has another thing as 0 trailing
793
+ if(parseInt(version2[ik]) > 0){
794
+ //Latest version is upper
795
+ return -1;
796
+ }
797
+ }
798
+
799
+ //End only with 0 version numbers, it's equal
800
+ if(revision_version1 > revision_version2){
801
+ return 1;
802
+ } else if(revision_version1 < revision_version2){
803
+ return -1;
804
+ }
805
+ return 0;
806
+ }
807
+
808
+ function toast(text) {
809
+ $('#jutranslation_toast').remove();
810
+ $('body').append('<div id="jutranslation_toast">' + text + '</div>');
811
+ setTimeout(function() {
812
+ $('#jutranslation_toast').remove();
813
+ }, 2000);
814
+ }
815
+ });
jutranslation/jutranslation.php ADDED
@@ -0,0 +1,609 @@
1
+ <?php
2
+ namespace Joomunited\WPMetaSEO\Jutranslation;
3
+
4
+ /**
5
+ * Class Jutranslation
6
+ * @package Joomunited\WPMetaSEO\Jutranslation
7
+ */
8
+ class Jutranslation {
9
+ public static $extension_slug;
10
+ public static $extension_name;
11
+ public static $text_domain;
12
+ public static $language_file;
13
+
14
+ public static $main_plugin_file;
15
+
16
+ /**
17
+ * Initialize Jutranslation
18
+ * @param $main_plugin_file
19
+ * @param $extension_slug
20
+ * @param $extension_name
21
+ * @param $text_domain
22
+ * @param $language_file
23
+ */
24
+ public static function init($main_plugin_file, $extension_slug, $extension_name, $text_domain, $language_file){
25
+ Jutranslation::$main_plugin_file = $main_plugin_file;
26
+ Jutranslation::$extension_slug = $extension_slug;
27
+ Jutranslation::$extension_name = $extension_name;
28
+ Jutranslation::$text_domain = $text_domain;
29
+ Jutranslation::$language_file = plugin_dir_path( Jutranslation::$main_plugin_file ) . $language_file;
30
+
31
+ //Load override file
32
+ add_action( 'load_textdomain', array(__CLASS__, 'overrideLanguage'), 1, 2);
33
+
34
+ add_filter(Jutranslation::$extension_slug . '_get_addons', function ($addons) {
35
+ $addon = new \StdClass();
36
+ $addon->main_plugin_file = Jutranslation::$main_plugin_file;
37
+ $addon->extension_name = Jutranslation::$extension_name;
38
+ $addon->extension_slug = Jutranslation::$extension_slug;
39
+ $addon->text_domain = Jutranslation::$text_domain;
40
+ $addon->language_file = Jutranslation::$language_file;
41
+ $addons[$addon->extension_slug] = $addon;
42
+ return $addons;
43
+ });
44
+
45
+ //Only need Jutranslation on admin side
46
+ if(!is_admin()){
47
+ return;
48
+ }
49
+
50
+ // Check if the current user
51
+ add_action('admin_init', function(){
52
+ if(current_user_can('manage_options')) {
53
+ //Initialize needed ajax mehtods
54
+ add_action( 'wp_ajax_jutranslation_'.Jutranslation::$extension_slug, array(__CLASS__, 'dispatchQuery') );
55
+ }
56
+ });
57
+ }
58
+
59
+ /**
60
+ * Ajax queries dispatcher
61
+ */
62
+ public static function dispatchQuery() {
63
+ if(!isset($_REQUEST['task'])) {
64
+ die;
65
+ }
66
+
67
+ switch ($_REQUEST['task']) {
68
+ case 'jutranslation.saveStrings':
69
+ Jutranslation::saveStrings();
70
+ break;
71
+ case 'jutranslation.getTranslation':
72
+ Jutranslation::getTranslation();
73
+ break;
74
+ case 'jutranslation.showViewForm':
75
+ Jutranslation::showViewForm();
76
+ break;
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Return the main html content for jutranslation
82
+ * @return void
83
+ */
84
+ public static function getInput(){
85
+ echo '<div id="jutranslation" class="wordpress">';
86
+ echo '<div class="control-group">';
87
+
88
+ //Declare all js and css to include
89
+ $jsInline = array(
90
+ 'jutranslation_token="'.wp_create_nonce( 'jutranslation' ).'";',
91
+ 'jutranslation_ajax_action="jutranslation_'.Jutranslation::$extension_slug.'";',
92
+ 'jutranslation_base_url=ajaxurl+"?";'
93
+ );
94
+ echo '<script type="text/javascript">'.implode(PHP_EOL,$jsInline).'</script>';
95
+ wp_enqueue_script('jutranslation', plugin_dir_url( Jutranslation::$main_plugin_file ) . 'jutranslation/assets/js/jutranslation.js');
96
+ wp_enqueue_style('jutranslation', plugin_dir_url( Jutranslation::$main_plugin_file ) . 'jutranslation/assets/css/jutranslation.css');
97
+
98
+ add_thickbox();
99
+
100
+
101
+ //Get all installed languages
102
+ $installed_languages = array();
103
+ foreach ( wp_get_installed_translations('core') as $type) {
104
+ foreach ( $type as $lang => $value ) {
105
+ $lang = str_replace('_', '-', $lang);
106
+ $installed_languages[] = $lang;
107
+ }
108
+ }
109
+
110
+ //Add Polylang languages
111
+ if(function_exists('pll_languages_list')){
112
+ foreach ( pll_languages_list(array('fields'=>'locale')) as $pll_language) {
113
+ $lang = str_replace('_', '-', $pll_language);
114
+ $installed_languages[] = $lang;
115
+ }
116
+ }
117
+
118
+ //Add WPML languages
119
+ if(!function_exists('pll_languages_list') && function_exists('icl_get_languages')){
120
+ foreach ( icl_get_languages() as $wpml_language) {
121
+ $lang = str_replace('_', '-', $wpml_language['default_locale']);
122
+ $installed_languages[] = $lang;
123
+ }
124
+ }
125
+
126
+ //Add default en-US language
127
+ if(!isset($installed_languages['en-US'])){
128
+ $installed_languages = array_merge(array('en-US'), $installed_languages);
129
+ }
130
+
131
+ $installed_languages = array_unique($installed_languages);
132
+
133
+ //Get addons
134
+ $addons = apply_filters(Jutranslation::$extension_slug.'_get_addons', array());
135
+ ksort($addons);
136
+
137
+ $languages = array();
138
+ foreach ($installed_languages as $installed_language) {
139
+ foreach ($addons as $addon) {
140
+ $langObject = new \stdClass();
141
+ $langObject->extension = $addon;
142
+ $langObject->installed = false;
143
+ $langObject->extension_version = '';
144
+ $langObject->language_version = '';
145
+ $langObject->revision = '1';
146
+ $langObject->languageCode = $installed_language;
147
+ $langObject->modified = '0';
148
+
149
+ $languages[] = $langObject;
150
+ }
151
+ }
152
+
153
+ //Check if language is installed
154
+ foreach ($languages as &$language) {
155
+ if (str_replace('-', '_', $language->languageCode) === 'en_US') {
156
+ $file = $language->extension->language_file;
157
+ } else {
158
+ $file = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $language->extension->text_domain . '-' . str_replace('-', '_', $language->languageCode) . '.mo';
159
+ }
160
+
161
+ if (file_exists($file)) {
162
+ $language->installed = true;
163
+
164
+ // Load language file
165
+ $mo = new \MO();
166
+ $mo->import_from_file($file);
167
+
168
+ //Assign it to the language
169
+ if (isset($mo->headers['Version'])) {
170
+ $language->language_version = $mo->headers['Version'];
171
+ }
172
+ if (isset($mo->headers['Revision'])) {
173
+ $language->revision = $mo->headers['Revision'];
174
+ }
175
+ if (isset($mo->headers['Modified'])) {
176
+ $language->modified = $mo->headers['Modified'];
177
+ } else {
178
+