QQWorld Auto Save Images - Version 1.6.1

Version Description

Download this release

Release Info

Developer qqworld
Plugin Icon 128x128 QQWorld Auto Save Images
Version 1.6.1
Comparing to
See all releases

Code changes from version 1.6 to 1.6.1

css/style.css CHANGED
@@ -7,7 +7,9 @@
7
  box-sizing: border-box;
8
  box-shadow: 3px 3px 3px rgba(0,0,0,.1);
9
  }
10
-
 
 
11
  #scan_old_post_list {
12
  border-collapse: collapse;
13
  width: 100%;
7
  box-sizing: border-box;
8
  box-shadow: 3px 3px 3px rgba(0,0,0,.1);
9
  }
10
+ #post_types_list, #exclude_domain_list {
11
+ margin: 0;
12
+ }
13
  #scan_old_post_list {
14
  border-collapse: collapse;
15
  width: 100%;
js/script-post.js CHANGED
@@ -1,5 +1,6 @@
1
  jQuery(function($) {
2
  $(window).on('load', function() {
 
3
  $('.mce-i-save_remote_images').closest('.mce-widget').hide();
4
  $(document).on('click', '#save-remote-images-button', function() {
5
  var mode = 'text';
@@ -14,25 +15,33 @@ jQuery(function($) {
14
  type: 'notification',
15
  layout: 'center',
16
  modal: true,
17
- closeWith: ['button']
 
18
  }) );
19
  $.ajax({
20
  type: "POST",
21
  url: ajaxurl,
 
22
  data: {
23
  action: 'save_remote_images',
24
  post_id: QASI.post_id,
25
  content: encodeURI(encodeURI($('#content').val()))
26
  },
27
  success: function(respond) {
 
 
 
 
 
28
  $('#save-remote-images-button').data('noty').close();
29
  var n = noty({
30
- text: QASI.succesed_save_remote_images,
31
- type: 'success',
32
  layout: 'center',
33
- timeout: 3000
 
34
  });
35
- if (respond) $('#content').val(respond);
36
  }
37
  });
38
  break;
@@ -42,25 +51,33 @@ jQuery(function($) {
42
  type: 'notification',
43
  layout: 'center',
44
  modal: true,
45
- closeWith: ['button']
 
46
  }) );
47
  $.ajax({
48
  type: "POST",
49
  url: ajaxurl,
 
50
  data: {
51
  action: 'save_remote_images',
52
  post_id: QASI.post_id,
53
  content: encodeURI(encodeURI(tinyMCE.activeEditor.getContent()))
54
  },
55
  success: function(respond) {
 
 
 
 
 
56
  $('#save-remote-images-button').data('noty').close();
57
  var n = noty({
58
- text: QASI.succesed_save_remote_images,
59
- type: 'success',
60
  layout: 'center',
61
- timeout: 3000
 
62
  });
63
- if (respond) tinyMCE.activeEditor.setContent(respond);
64
  }
65
  });
66
  break;
1
  jQuery(function($) {
2
  $(window).on('load', function() {
3
+ var noty_theme = typeof qqworld_ajax == 'object' ? 'qqworldTheme' : 'defaultTheme';
4
  $('.mce-i-save_remote_images').closest('.mce-widget').hide();
5
  $(document).on('click', '#save-remote-images-button', function() {
6
  var mode = 'text';
15
  type: 'notification',
16
  layout: 'center',
17
  modal: true,
18
+ closeWith: ['button'],
19
+ theme: noty_theme
20
  }) );
21
  $.ajax({
22
  type: "POST",
23
  url: ajaxurl,
24
+ dataType: 'json',
25
  data: {
26
  action: 'save_remote_images',
27
  post_id: QASI.post_id,
28
  content: encodeURI(encodeURI($('#content').val()))
29
  },
30
  success: function(respond) {
31
+ switch (respond.type) {
32
+ case 1: var type = 'warning'; break;
33
+ case 2: var type = 'success'; break;
34
+ case 3: var type = 'error'; break;
35
+ }
36
  $('#save-remote-images-button').data('noty').close();
37
  var n = noty({
38
+ text: respond.msg,
39
+ type: type,
40
  layout: 'center',
41
+ timeout: 3000,
42
+ theme: noty_theme
43
  });
44
+ if (respond.content) $('#content').val(respond.content);
45
  }
46
  });
47
  break;
51
  type: 'notification',
52
  layout: 'center',
53
  modal: true,
54
+ closeWith: ['button'],
55
+ theme: noty_theme
56
  }) );
57
  $.ajax({
58
  type: "POST",
59
  url: ajaxurl,
60
+ dataType: 'json',
61
  data: {
62
  action: 'save_remote_images',
63
  post_id: QASI.post_id,
64
  content: encodeURI(encodeURI(tinyMCE.activeEditor.getContent()))
65
  },
66
  success: function(respond) {
67
+ switch (respond.type) {
68
+ case 1: var type = 'warning'; break;
69
+ case 2: var type = 'success'; break;
70
+ case 3: var type = 'error'; break;
71
+ }
72
  $('#save-remote-images-button').data('noty').close();
73
  var n = noty({
74
+ text: respond.msg,
75
+ type: type,
76
  layout: 'center',
77
+ timeout: 3000,
78
+ theme: noty_theme
79
  });
80
+ if (respond.content) tinyMCE.activeEditor.setContent(respond.content);
81
  }
82
  });
83
  break;
js/script.js CHANGED
@@ -1,53 +1,55 @@
1
- function str_repeat(i, m) {
2
- for (var o = []; m > 0; o[--m] = i);
3
- return o.join('');
4
- }
5
- function sprintf() {
6
- var i = 0, a, f = arguments[i++], o = [], m, p, c, x, s = '';
7
- while (f) {
8
- if (m = /^[^\x25]+/.exec(f)) {
9
- o.push(m[0]);
10
- }
11
- else if (m = /^\x25{2}/.exec(f)) {
12
- o.push('%');
13
  }
14
- else if (m = /^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(f)) {
15
- if (((a = arguments[m[1] || i++]) == null) || (a == undefined)) {
16
- throw('Too few arguments.');
 
 
 
 
17
  }
18
- if (/[^s]/.test(m[7]) && (typeof(a) != 'number')) {
19
- throw('Expecting number but found ' + typeof(a));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
- switch (m[7]) {
22
- case 'b': a = a.toString(2); break;
23
- case 'c': a = String.fromCharCode(a); break;
24
- case 'd': a = parseInt(a); break;
25
- case 'e': a = m[6] ? a.toExponential(m[6]) : a.toExponential(); break;
26
- case 'f': a = m[6] ? parseFloat(a).toFixed(m[6]) : parseFloat(a); break;
27
- case 'o': a = a.toString(8); break;
28
- case 's': a = ((a = String(a)) && m[6] ? a.substring(0, m[6]) : a); break;
29
- case 'u': a = Math.abs(a); break;
30
- case 'x': a = a.toString(16); break;
31
- case 'X': a = a.toString(16).toUpperCase(); break;
32
  }
33
- a = (/[def]/.test(m[7]) && m[2] && a >= 0 ? '+'+ a : a);
34
- c = m[3] ? m[3] == '0' ? '0' : m[3].charAt(1) : ' ';
35
- x = m[5] - String(a).length - s.length;
36
- p = m[5] ? str_repeat(c, x) : '';
37
- o.push(s + (m[4] ? a + p : p + a));
38
  }
39
- else {
40
- throw('Huh ?!');
41
- }
42
- f = f.substring(m[0].length);
43
  }
44
- return o.join('');
45
- }
46
-
47
- if (!QQWorld_auto_save_images) var QQWorld_auto_save_images = {};
48
- QQWorld_auto_save_images.scan_posts = function() {
49
- var _this = this,
50
- $ = jQuery;
51
 
52
  this.action = {};
53
  this.action.catch_errors = function(XMLHttpRequest, textStatus, errorThrown) {
@@ -88,7 +90,8 @@ QQWorld_auto_save_images.scan_posts = function() {
88
  type: 'error',
89
  layout: 'bottom',
90
  dismissQueue: true,
91
- closeWith: ['button']
 
92
  });
93
  $('#scan_old_posts').removeAttr('disabled');
94
  $('#list_all_posts').removeAttr('disabled');
@@ -114,15 +117,15 @@ QQWorld_auto_save_images.scan_posts = function() {
114
  var count_not_exits_remote_images = $('#scan_old_post_list tbody tr.has_not_exits_remote_images').length;
115
  var count = $('#scan_old_post_list tbody tr').length;
116
  if (count) {
117
- if (count==1) count_html = sprintf(QASI.n_post_has_been_scanned, count);
118
- else count_html = sprintf(QASI.n_posts_have_been_scanned, count);
119
  if (count_remote_images) {
120
  count_remote_images = count_remote_images - count_not_exits_remote_images;
121
- if (count_remote_images<=1) count_html += sprintf("<br />"+QASI.n_post_included_remote_images_processed, count_remote_images);
122
- else count_html += sprintf("<br />"+QASI.n_posts_included_remote_images_processed, count_remote_images);
123
  if (count_not_exits_remote_images) {
124
- if (count_not_exits_remote_images==1) count_html += sprintf("<br />"+QASI.n_post_has_missing_images_couldnt_be_processed, count_not_exits_remote_images);
125
- else count_html += sprintf("<br />"+QASI.n_posts_have_missing_images_couldnt_be_processed, count_not_exits_remote_images);
126
  }
127
  } else count_html += '<br />'+QASI.no_posts_processed;
128
  } else {
@@ -134,7 +137,8 @@ QQWorld_auto_save_images.scan_posts = function() {
134
  type: 'success',
135
  layout: 'center',
136
  dismissQueue: true,
137
- modal: true
 
138
  });
139
  $('#scan_old_posts').removeAttr('disabled');
140
  $('#list_all_posts').removeAttr('disabled');
@@ -173,14 +177,14 @@ QQWorld_auto_save_images.scan_posts = function() {
173
  var count_remote_images = $('#scan_old_post_list tbody tr.has_remote_images').length;
174
  var count_not_exits_remote_images = $('#scan_old_post_list tbody tr.has_not_exits_remote_images').length;
175
  if (count) {
176
- if (count==1) count_html = sprintf(QASI.n_post_has_been_scanned, count);
177
- else count_html = sprintf(QASI.n_posts_have_been_scanned, count);
178
  if (count_remote_images) {
179
- if (count_remote_images==1) count_html += sprintf("<br />"+QASI.found_n_post_including_remote_images, count_remote_images);
180
- else count_html += sprintf("<br />"+QASI.found_n_posts_including_remote_images, count_remote_images);
181
  if (count_not_exits_remote_images) {
182
- if (count_not_exits_remote_images==1) count_html += sprintf("<br />"+QASI.and_with_n_post_has_missing_images, count_not_exits_remote_images);
183
- else count_html += sprintf("<br />"+QASI.and_with_n_posts_have_missing_images, count_not_exits_remote_images);
184
  }
185
  } else count_html += '<br />'+QASI.no_post_has_remote_images_found;
186
  } else {
@@ -192,7 +196,8 @@ QQWorld_auto_save_images.scan_posts = function() {
192
  type: 'success',
193
  layout: 'center',
194
  dismissQueue: true,
195
- modal: true
 
196
  });
197
  $('#scan_old_posts').removeAttr('disabled');
198
  $('#list_all_posts').removeAttr('disabled');
@@ -230,7 +235,8 @@ QQWorld_auto_save_images.scan_posts = function() {
230
  type: 'error',
231
  dismissQueue: true,
232
  layout: 'bottomCenter',
233
- timeout: 3000
 
234
  });
235
  }
236
 
@@ -260,6 +266,7 @@ QQWorld_auto_save_images.scan_posts = function() {
260
  dismissQueue: true,
261
  layout: 'center',
262
  modal: true,
 
263
  buttons: [
264
  {
265
  addClass: 'button button-primary',
@@ -291,7 +298,8 @@ QQWorld_auto_save_images.scan_posts = function() {
291
  text: QASI.scanning,
292
  type: 'notification',
293
  layout: 'center',
294
- dismissQueue: true
 
295
  }) );
296
  _this.action.scan(respond, 0);
297
  },
@@ -338,7 +346,8 @@ QQWorld_auto_save_images.scan_posts = function() {
338
  text: QASI.listing,
339
  type: 'notification',
340
  layout: 'center',
341
- dismissQueue: true
 
342
  }) );
343
  _this.action.list(respond, 0);
344
  },
1
+ if (!QQWorld_auto_save_images) var QQWorld_auto_save_images = {};
2
+ QQWorld_auto_save_images.scan_posts = function() {
3
+ var _this = this,
4
+ $ = jQuery,
5
+ noty_theme = typeof qqworld_ajax == 'object' ? 'qqworldTheme' : 'defaultTheme';
6
+
7
+ this.lib = {};
8
+ this.lib.sprintf = function() {
9
+ var str_repeat = function(i, m) {
10
+ for (var o = []; m > 0; o[--m] = i);
11
+ return o.join('');
 
12
  }
13
+ var i = 0, a, f = arguments[i++], o = [], m, p, c, x, s = '';
14
+ while (f) {
15
+ if (m = /^[^\x25]+/.exec(f)) {
16
+ o.push(m[0]);
17
+ }
18
+ else if (m = /^\x25{2}/.exec(f)) {
19
+ o.push('%');
20
  }
21
+ else if (m = /^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(f)) {
22
+ if (((a = arguments[m[1] || i++]) == null) || (a == undefined)) {
23
+ throw('Too few arguments.');
24
+ }
25
+ if (/[^s]/.test(m[7]) && (typeof(a) != 'number')) {
26
+ throw('Expecting number but found ' + typeof(a));
27
+ }
28
+ switch (m[7]) {
29
+ case 'b': a = a.toString(2); break;
30
+ case 'c': a = String.fromCharCode(a); break;
31
+ case 'd': a = parseInt(a); break;
32
+ case 'e': a = m[6] ? a.toExponential(m[6]) : a.toExponential(); break;
33
+ case 'f': a = m[6] ? parseFloat(a).toFixed(m[6]) : parseFloat(a); break;
34
+ case 'o': a = a.toString(8); break;
35
+ case 's': a = ((a = String(a)) && m[6] ? a.substring(0, m[6]) : a); break;
36
+ case 'u': a = Math.abs(a); break;
37
+ case 'x': a = a.toString(16); break;
38
+ case 'X': a = a.toString(16).toUpperCase(); break;
39
+ }
40
+ a = (/[def]/.test(m[7]) && m[2] && a >= 0 ? '+'+ a : a);
41
+ c = m[3] ? m[3] == '0' ? '0' : m[3].charAt(1) : ' ';
42
+ x = m[5] - String(a).length - s.length;
43
+ p = m[5] ? str_repeat(c, x) : '';
44
+ o.push(s + (m[4] ? a + p : p + a));
45
  }
46
+ else {
47
+ throw('Huh ?!');
 
 
 
 
 
 
 
 
 
48
  }
49
+ f = f.substring(m[0].length);
 
 
 
 
50
  }
51
+ return o.join('');
 
 
 
52
  }
 
 
 
 
 
 
 
53
 
54
  this.action = {};
55
  this.action.catch_errors = function(XMLHttpRequest, textStatus, errorThrown) {
90
  type: 'error',
91
  layout: 'bottom',
92
  dismissQueue: true,
93
+ closeWith: ['button'],
94
+ theme: noty_theme
95
  });
96
  $('#scan_old_posts').removeAttr('disabled');
97
  $('#list_all_posts').removeAttr('disabled');
117
  var count_not_exits_remote_images = $('#scan_old_post_list tbody tr.has_not_exits_remote_images').length;
118
  var count = $('#scan_old_post_list tbody tr').length;
119
  if (count) {
120
+ if (count==1) count_html = _this.lib.sprintf(QASI.n_post_has_been_scanned, count);
121
+ else count_html = _this.lib.sprintf(QASI.n_posts_have_been_scanned, count);
122
  if (count_remote_images) {
123
  count_remote_images = count_remote_images - count_not_exits_remote_images;
124
+ if (count_remote_images<=1) count_html += _this.lib.sprintf("<br />"+QASI.n_post_included_remote_images_processed, count_remote_images);
125
+ else count_html += _this.lib.sprintf("<br />"+QASI.n_posts_included_remote_images_processed, count_remote_images);
126
  if (count_not_exits_remote_images) {
127
+ if (count_not_exits_remote_images==1) count_html += _this.lib.sprintf("<br />"+QASI.n_post_has_missing_images_couldnt_be_processed, count_not_exits_remote_images);
128
+ else count_html += _this.lib.sprintf("<br />"+QASI.n_posts_have_missing_images_couldnt_be_processed, count_not_exits_remote_images);
129
  }
130
  } else count_html += '<br />'+QASI.no_posts_processed;
131
  } else {
137
  type: 'success',
138
  layout: 'center',
139
  dismissQueue: true,
140
+ modal: true,
141
+ theme: noty_theme
142
  });
143
  $('#scan_old_posts').removeAttr('disabled');
144
  $('#list_all_posts').removeAttr('disabled');
177
  var count_remote_images = $('#scan_old_post_list tbody tr.has_remote_images').length;
178
  var count_not_exits_remote_images = $('#scan_old_post_list tbody tr.has_not_exits_remote_images').length;
179
  if (count) {
180
+ if (count==1) count_html = _this.lib.sprintf(QASI.n_post_has_been_scanned, count);
181
+ else count_html = _this.lib.sprintf(QASI.n_posts_have_been_scanned, count);
182
  if (count_remote_images) {
183
+ if (count_remote_images==1) count_html += _this.lib.sprintf("<br />"+QASI.found_n_post_including_remote_images, count_remote_images);
184
+ else count_html += _this.lib.sprintf("<br />"+QASI.found_n_posts_including_remote_images, count_remote_images);
185
  if (count_not_exits_remote_images) {
186
+ if (count_not_exits_remote_images==1) count_html += _this.lib.sprintf("<br />"+QASI.and_with_n_post_has_missing_images, count_not_exits_remote_images);
187
+ else count_html += _this.lib.sprintf("<br />"+QASI.and_with_n_posts_have_missing_images, count_not_exits_remote_images);
188
  }
189
  } else count_html += '<br />'+QASI.no_post_has_remote_images_found;
190
  } else {
196
  type: 'success',
197
  layout: 'center',
198
  dismissQueue: true,
199
+ modal: true,
200
+ theme: noty_theme
201
  });
202
  $('#scan_old_posts').removeAttr('disabled');
203
  $('#list_all_posts').removeAttr('disabled');
235
  type: 'error',
236
  dismissQueue: true,
237
  layout: 'bottomCenter',
238
+ timeout: 3000,
239
+ theme: noty_theme
240
  });
241
  }
242
 
266
  dismissQueue: true,
267
  layout: 'center',
268
  modal: true,
269
+ theme: noty_theme,
270
  buttons: [
271
  {
272
  addClass: 'button button-primary',
298
  text: QASI.scanning,
299
  type: 'notification',
300
  layout: 'center',
301
+ dismissQueue: true,
302
+ theme: noty_theme
303
  }) );
304
  _this.action.scan(respond, 0);
305
  },
346
  text: QASI.listing,
347
  type: 'notification',
348
  layout: 'center',
349
+ dismissQueue: true,
350
+ theme: noty_theme
351
  }) );
352
  _this.action.list(respond, 0);
353
  },
lang/qqworld_auto_save_images-zh_CN.mo CHANGED
Binary file
lang/qqworld_auto_save_images-zh_CN.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: QQworld Auto Save Images\n"
4
  "Report-Msgid-Bugs-To: http://www.qqworld.org\n"
5
- "POT-Creation-Date: 2014-10-11 11:50+0800\n"
6
- "PO-Revision-Date: 2014-10-11 14:45+0800\n"
7
  "Last-Translator: Michael Wang <admin@qqworld.org>\n"
8
  "Language-Team: QQWorld <admin@qqworld.org>\n"
9
  "Language: zh_CN\n"
@@ -21,227 +21,253 @@ msgstr ""
21
  "X-Poedit-Basepath: ..\n"
22
  "X-Poedit-SearchPath-0: .\n"
23
 
24
- #: qqworld-auto-save-images.php:59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  msgid "In Process..."
26
  msgstr "正在保存……"
27
 
28
- #: qqworld-auto-save-images.php:60
29
- msgid "Successed save remote images"
30
- msgstr "成功保存远程图片"
31
-
32
- #: qqworld-auto-save-images.php:80
33
  msgid ""
34
  "Are you sure?<br />Before you click the yes button, I recommend backup site "
35
  "database."
36
  msgstr "你确定吗?<br />在点击确定按钮之前,我建议你备份网站的数据库。"
37
 
38
- #: qqworld-auto-save-images.php:81
39
  msgid "Please select post types."
40
  msgstr "请选择文章类型。"
41
 
42
- #: qqworld-auto-save-images.php:82
43
  msgid "May be a problem with some posts: "
44
  msgstr "也许一些文章有问题:"
45
 
46
- #: qqworld-auto-save-images.php:83
47
  #, php-format
48
  msgid "%d post has been scanned."
49
  msgstr "已扫描%d篇文章。"
50
 
51
- #: qqworld-auto-save-images.php:84
52
  #, php-format
53
  msgid "%d posts have been scanned."
54
  msgstr "已扫描%d篇文章。"
55
 
56
- #: qqworld-auto-save-images.php:85
57
  #, php-format
58
  msgid "%d post included remote images processed."
59
  msgstr "已处理%d篇包含远程图像的文章。"
60
 
61
- #: qqworld-auto-save-images.php:86
62
  #, php-format
63
  msgid "%d posts included remote images processed."
64
  msgstr "已处理%d篇包含远程图像的文章。"
65
 
66
- #: qqworld-auto-save-images.php:87
67
  #, php-format
68
  msgid "%d post has missing images couldn't be processed."
69
  msgstr "%d篇包含不存在的远程图像的文章无法处理。"
70
 
71
- #: qqworld-auto-save-images.php:88
72
  #, php-format
73
  msgid "%d posts have missing images couldn't be processed."
74
  msgstr "%d篇包含不存在的远程图像的文章无法处理。"
75
 
76
- #: qqworld-auto-save-images.php:89
77
  #, php-format
78
  msgid "found %d post including remote images."
79
  msgstr "找到%d篇包含远程图像的文章。"
80
 
81
- #: qqworld-auto-save-images.php:90
82
  #, php-format
83
  msgid "found %d posts including remote images."
84
  msgstr "找到%d篇包含远程图像的文章。"
85
 
86
- #: qqworld-auto-save-images.php:91
87
  #, php-format
88
  msgid "And with %d post has missing images."
89
  msgstr "其中有%d篇文章包含不存在的远程图像。"
90
 
91
- #: qqworld-auto-save-images.php:92
92
  #, php-format
93
  msgid "And with %d posts have missing images."
94
  msgstr "其中有%d篇文章包含不存在的远程图像。"
95
 
96
- #: qqworld-auto-save-images.php:93
97
  msgid "No posts processed."
98
  msgstr "未处理任何文章。"
99
 
100
- #: qqworld-auto-save-images.php:94
101
  msgid "No post has remote images found."
102
  msgstr "没有文章包含远程图像。"
103
 
104
- #: qqworld-auto-save-images.php:95
105
  msgid "No posts found."
106
  msgstr "未找到任何文章。"
107
 
108
- #: qqworld-auto-save-images.php:96
109
  msgid "All done."
110
  msgstr "全部完成。"
111
 
112
- #: qqworld-auto-save-images.php:97 qqworld-auto-save-images.php:347
113
  msgid "Yes"
114
  msgstr ""
115
 
116
- #: qqworld-auto-save-images.php:98 qqworld-auto-save-images.php:351
117
  msgid "No"
118
  msgstr ""
119
 
120
- #: qqworld-auto-save-images.php:99
121
  msgid "Scanning..."
122
  msgstr "扫描中……"
123
 
124
- #: qqworld-auto-save-images.php:100
125
  msgid "Listing..."
126
  msgstr "显示列表中……"
127
 
128
- #: qqworld-auto-save-images.php:101
129
  msgid "ID"
130
  msgstr ""
131
 
132
- #: qqworld-auto-save-images.php:102
133
  msgid "Post Type"
134
  msgstr "文章类型"
135
 
136
- #: qqworld-auto-save-images.php:103
137
  msgid "Title"
138
  msgstr ""
139
 
140
- #: qqworld-auto-save-images.php:104
141
  msgid "Status"
142
  msgstr ""
143
 
144
- #: qqworld-auto-save-images.php:105
145
  msgid "Control"
146
  msgstr "控制"
147
 
148
- #: qqworld-auto-save-images.php:106
149
  msgid "Done"
150
  msgstr ""
151
 
152
- #: qqworld-auto-save-images.php:107 qqworld-auto-save-images.php:365
153
  msgid "Delete"
154
  msgstr ""
155
 
156
- #: qqworld-auto-save-images.php:194 qqworld-auto-save-images.php:244
157
  msgid "Has missing images."
158
  msgstr "有不存在的远程图像。"
159
 
160
- #: qqworld-auto-save-images.php:194
161
- msgid "All remote images have been saved."
162
- msgstr "已保存所有远程图像。"
163
-
164
- #: qqworld-auto-save-images.php:244
165
  msgid "Normal"
166
  msgstr "正常"
167
 
168
- #: qqworld-auto-save-images.php:245
169
  msgid "Fetch"
170
  msgstr "抓取"
171
 
172
- #: qqworld-auto-save-images.php:281
173
  msgid "Save Remote Images"
174
  msgstr "保存远程图片"
175
 
176
- #: qqworld-auto-save-images.php:292
177
  msgid "Settings"
178
  msgstr ""
179
 
180
- #: qqworld-auto-save-images.php:298 qqworld-auto-save-images.php:304
181
  msgid "QQWorld Auto Save Images"
182
  msgstr "QQWorld自动保存图片"
183
 
184
- #: qqworld-auto-save-images.php:312 qqworld-auto-save-images.php:314
 
 
 
 
 
 
 
185
  msgid "Mode"
186
  msgstr "模式"
187
 
188
- #: qqworld-auto-save-images.php:317 qqworld-auto-save-images.php:410
 
189
  msgid "Automatic"
190
  msgstr "自动"
191
 
192
- #: qqworld-auto-save-images.php:318
193
  msgid ""
194
  "Automatically save all remote images to local media libary when you save or "
195
  "publish post."
196
  msgstr "在保存或发布文章时,自动将所有远程图像保存到本地媒体库。"
197
 
198
- #: qqworld-auto-save-images.php:321 qqworld-auto-save-images.php:413
199
  msgid "Manual"
200
  msgstr "手动"
201
 
202
- #: qqworld-auto-save-images.php:322
203
  msgid ""
204
  "Manually save all remote images to local media libary when you click the "
205
  "button on the top of editor."
206
  msgstr "当单击编辑器顶部的按钮时,手动将所有远程图像保存到本地媒体库。"
207
 
208
- #: qqworld-auto-save-images.php:327 qqworld-auto-save-images.php:329
209
  msgid "When"
210
  msgstr "什么时候"
211
 
212
- #: qqworld-auto-save-images.php:332
213
  msgid "Save post (Publish, save draft or pedding review)."
214
  msgstr "保存文章时(发布文章,保存草稿或提交审核)。"
215
 
216
- #: qqworld-auto-save-images.php:336
217
  msgid "Publish post only."
218
  msgstr "仅发布文章时。"
219
 
220
- #: qqworld-auto-save-images.php:342 qqworld-auto-save-images.php:344
221
- msgid "Automatically Set Featured Image"
222
- msgstr "自动设置特色图片"
 
 
 
 
223
 
224
- #: qqworld-auto-save-images.php:357
225
  msgid "Exclude Domain/Keyword"
226
  msgstr "排除域名/关键词"
227
 
228
- #: qqworld-auto-save-images.php:357
229
  msgid "Images will not be saved, if that url contains Exclude-Domain/Keyword."
230
  msgstr "如果图片地址包含排除域名/关键词,则不会保存该图片。"
231
 
232
- #: qqworld-auto-save-images.php:359
233
  msgid "Exclude Domain"
234
  msgstr ""
235
 
236
- #: qqworld-auto-save-images.php:369
237
  msgid "Add a Domain/Keyword"
238
  msgstr "添加域名/关键词"
239
 
240
- #: qqworld-auto-save-images.php:375 qqworld-auto-save-images.php:401
241
  msgid "Scan Posts"
242
  msgstr "扫描文章"
243
 
244
- #: qqworld-auto-save-images.php:375
 
 
 
 
245
  msgid ""
246
  "If you have too many posts to be scan, sometimes in process looks like "
247
  "stopping, but it may be fake. please be patient."
@@ -249,20 +275,11 @@ msgstr ""
249
  "如果有太多文章需要扫描,有时候在扫描过程中看起来像是停止了,但可能是假停止,"
250
  "请耐心等待。"
251
 
252
- #: qqworld-auto-save-images.php:378
253
- msgid "Select post types:"
254
- msgstr "选择文章类型:"
255
 
256
- #: qqworld-auto-save-images.php:389
257
- msgid "Scope of Post ID:"
258
- msgstr "文章ID范围:"
259
-
260
- #: qqworld-auto-save-images.php:389
261
- #, php-format
262
- msgid "From %1$s to %2$s"
263
- msgstr "从 %1$s 到 %2$s"
264
-
265
- #: qqworld-auto-save-images.php:389
266
  msgid ""
267
  "Default empty for scan all posts ID. If you want to scan posts ID from 50 to "
268
  "100. please type '50' and '100' or '100' and '50', The order in which two "
@@ -273,46 +290,51 @@ msgstr ""
273
  "者'100'和'50',两个数字的顺序可以颠倒。如果你只输入了1个数字,则系统只会扫描"
274
  "该ID。"
275
 
276
- #: qqworld-auto-save-images.php:391
277
- msgid "Offset:"
278
- msgstr "偏移:"
 
 
 
 
 
279
 
280
- #: qqworld-auto-save-images.php:391
 
 
 
 
 
 
 
 
281
  #, php-format
282
  msgid "Start from %s to Scan"
283
  msgstr "从 %s 开始扫描"
284
 
285
- #: qqworld-auto-save-images.php:393
286
  msgid "All"
287
  msgstr ""
288
 
289
- #: qqworld-auto-save-images.php:397
290
  msgid "Posts"
291
  msgstr ""
292
 
293
- #: qqworld-auto-save-images.php:397
294
- msgid ""
295
- "Default scan all posts. If you want to scan 50-150 posts, please type '50' "
296
- "in the textfield and select '100'."
297
- msgstr ""
298
- "默认扫秒全部文章,如果想扫描50-150篇文章,请在文本框中输入“50”并在下拉菜单中"
299
- "选择“100”。"
300
-
301
- #: qqworld-auto-save-images.php:402
302
- msgid "Speed:"
303
- msgstr "速度:"
304
 
305
- #: qqworld-auto-save-images.php:408
306
  msgid "If the server is too much stress may be appropriately reduced speed."
307
  msgstr "如果服务器压力过大,可以适当调低速度。"
308
 
309
- #: qqworld-auto-save-images.php:411
310
  msgid ""
311
  "Scan posts and keep remote images in all posts to local media library. Maybe "
312
  "take a long time."
313
  msgstr "扫描所有的文章,将所有远程图片保存到本地,可能需要很长时间。"
314
 
315
- #: qqworld-auto-save-images.php:414
316
  msgid ""
317
  "The list displayed will show you which posts including remote images, then "
318
  "you can keep them to local manually via click \"Fetch\" button."
@@ -320,11 +342,13 @@ msgstr ""
320
  "显示的列表中将告诉你哪些文章包含远程图片,然后你可以通过点击“抓取”按钮手动保"
321
  "存。"
322
 
323
- msgid ""
324
- "Automatically keep the all remote picture to the local, and automatically "
325
- "set featured image."
326
- msgstr ""
327
- "自动保存远程图片到本地,自动设置特色图片,并且支持机器人采集软件从外部提交。"
328
 
329
- msgid "Michael Wang"
330
- msgstr "王晓骞"
 
 
 
 
2
  msgstr ""
3
  "Project-Id-Version: QQworld Auto Save Images\n"
4
  "Report-Msgid-Bugs-To: http://www.qqworld.org\n"
5
+ "POT-Creation-Date: 2014-10-13 07:57+0800\n"
6
+ "PO-Revision-Date: 2014-10-13 07:57+0800\n"
7
  "Last-Translator: Michael Wang <admin@qqworld.org>\n"
8
  "Language-Team: QQWorld <admin@qqworld.org>\n"
9
  "Language: zh_CN\n"
21
  "X-Poedit-Basepath: ..\n"
22
  "X-Poedit-SearchPath-0: .\n"
23
 
24
+ #: qqworld-auto-save-images.php:23
25
+ msgid "Michael Wang"
26
+ msgstr "王晓骞"
27
+
28
+ #: qqworld-auto-save-images.php:60 qqworld-auto-save-images.php:216
29
+ #: qqworld-auto-save-images.php:564
30
+ msgid "All remote images have been saved."
31
+ msgstr "已保存所有远程图像。"
32
+
33
+ #: qqworld-auto-save-images.php:60 qqworld-auto-save-images.php:61
34
+ #, php-format
35
+ msgid " <a href=\"%s\">View</a>"
36
+ msgstr " <a href=\"%s\">查看</a>"
37
+
38
+ #: qqworld-auto-save-images.php:61
39
+ msgid "Has missing images or image which could not download."
40
+ msgstr "内容包含 不存在/无法下载 的图像。"
41
+
42
+ #: qqworld-auto-save-images.php:82
43
  msgid "In Process..."
44
  msgstr "正在保存……"
45
 
46
+ #: qqworld-auto-save-images.php:102
 
 
 
 
47
  msgid ""
48
  "Are you sure?<br />Before you click the yes button, I recommend backup site "
49
  "database."
50
  msgstr "你确定吗?<br />在点击确定按钮之前,我建议你备份网站的数据库。"
51
 
52
+ #: qqworld-auto-save-images.php:103
53
  msgid "Please select post types."
54
  msgstr "请选择文章类型。"
55
 
56
+ #: qqworld-auto-save-images.php:104
57
  msgid "May be a problem with some posts: "
58
  msgstr "也许一些文章有问题:"
59
 
60
+ #: qqworld-auto-save-images.php:105
61
  #, php-format
62
  msgid "%d post has been scanned."
63
  msgstr "已扫描%d篇文章。"
64
 
65
+ #: qqworld-auto-save-images.php:106
66
  #, php-format
67
  msgid "%d posts have been scanned."
68
  msgstr "已扫描%d篇文章。"
69
 
70
+ #: qqworld-auto-save-images.php:107
71
  #, php-format
72
  msgid "%d post included remote images processed."
73
  msgstr "已处理%d篇包含远程图像的文章。"
74
 
75
+ #: qqworld-auto-save-images.php:108
76
  #, php-format
77
  msgid "%d posts included remote images processed."
78
  msgstr "已处理%d篇包含远程图像的文章。"
79
 
80
+ #: qqworld-auto-save-images.php:109
81
  #, php-format
82
  msgid "%d post has missing images couldn't be processed."
83
  msgstr "%d篇包含不存在的远程图像的文章无法处理。"
84
 
85
+ #: qqworld-auto-save-images.php:110
86
  #, php-format
87
  msgid "%d posts have missing images couldn't be processed."
88
  msgstr "%d篇包含不存在的远程图像的文章无法处理。"
89
 
90
+ #: qqworld-auto-save-images.php:111
91
  #, php-format
92
  msgid "found %d post including remote images."
93
  msgstr "找到%d篇包含远程图像的文章。"
94
 
95
+ #: qqworld-auto-save-images.php:112
96
  #, php-format
97
  msgid "found %d posts including remote images."
98
  msgstr "找到%d篇包含远程图像的文章。"
99
 
100
+ #: qqworld-auto-save-images.php:113
101
  #, php-format
102
  msgid "And with %d post has missing images."
103
  msgstr "其中有%d篇文章包含不存在的远程图像。"
104
 
105
+ #: qqworld-auto-save-images.php:114
106
  #, php-format
107
  msgid "And with %d posts have missing images."
108
  msgstr "其中有%d篇文章包含不存在的远程图像。"
109
 
110
+ #: qqworld-auto-save-images.php:115
111
  msgid "No posts processed."
112
  msgstr "未处理任何文章。"
113
 
114
+ #: qqworld-auto-save-images.php:116
115
  msgid "No post has remote images found."
116
  msgstr "没有文章包含远程图像。"
117
 
118
+ #: qqworld-auto-save-images.php:117
119
  msgid "No posts found."
120
  msgstr "未找到任何文章。"
121
 
122
+ #: qqworld-auto-save-images.php:118
123
  msgid "All done."
124
  msgstr "全部完成。"
125
 
126
+ #: qqworld-auto-save-images.php:119
127
  msgid "Yes"
128
  msgstr ""
129
 
130
+ #: qqworld-auto-save-images.php:120 qqworld-auto-save-images.php:378
131
  msgid "No"
132
  msgstr ""
133
 
134
+ #: qqworld-auto-save-images.php:121
135
  msgid "Scanning..."
136
  msgstr "扫描中……"
137
 
138
+ #: qqworld-auto-save-images.php:122
139
  msgid "Listing..."
140
  msgstr "显示列表中……"
141
 
142
+ #: qqworld-auto-save-images.php:123
143
  msgid "ID"
144
  msgstr ""
145
 
146
+ #: qqworld-auto-save-images.php:124
147
  msgid "Post Type"
148
  msgstr "文章类型"
149
 
150
+ #: qqworld-auto-save-images.php:125
151
  msgid "Title"
152
  msgstr ""
153
 
154
+ #: qqworld-auto-save-images.php:126
155
  msgid "Status"
156
  msgstr ""
157
 
158
+ #: qqworld-auto-save-images.php:127
159
  msgid "Control"
160
  msgstr "控制"
161
 
162
+ #: qqworld-auto-save-images.php:128
163
  msgid "Done"
164
  msgstr ""
165
 
166
+ #: qqworld-auto-save-images.php:129 qqworld-auto-save-images.php:392
167
  msgid "Delete"
168
  msgstr ""
169
 
170
+ #: qqworld-auto-save-images.php:216 qqworld-auto-save-images.php:266
171
  msgid "Has missing images."
172
  msgstr "有不存在的远程图像。"
173
 
174
+ #: qqworld-auto-save-images.php:266
 
 
 
 
175
  msgid "Normal"
176
  msgstr "正常"
177
 
178
+ #: qqworld-auto-save-images.php:267
179
  msgid "Fetch"
180
  msgstr "抓取"
181
 
182
+ #: qqworld-auto-save-images.php:306
183
  msgid "Save Remote Images"
184
  msgstr "保存远程图片"
185
 
186
+ #: qqworld-auto-save-images.php:317 qqworld-auto-save-images.php:335
187
  msgid "Settings"
188
  msgstr ""
189
 
190
+ #: qqworld-auto-save-images.php:323 qqworld-auto-save-images.php:329
191
  msgid "QQWorld Auto Save Images"
192
  msgstr "QQWorld自动保存图片"
193
 
194
+ #: qqworld-auto-save-images.php:330
195
+ msgid ""
196
+ "Automatically keep the all remote picture to the local, and automatically "
197
+ "set featured image."
198
+ msgstr ""
199
+ "自动保存远程图片到本地,自动设置特色图片,并且支持机器人采集软件从外部提交。"
200
+
201
+ #: qqworld-auto-save-images.php:339 qqworld-auto-save-images.php:341
202
  msgid "Mode"
203
  msgstr "模式"
204
 
205
+ #: qqworld-auto-save-images.php:344 qqworld-auto-save-images.php:374
206
+ #: qqworld-auto-save-images.php:451
207
  msgid "Automatic"
208
  msgstr "自动"
209
 
210
+ #: qqworld-auto-save-images.php:345
211
  msgid ""
212
  "Automatically save all remote images to local media libary when you save or "
213
  "publish post."
214
  msgstr "在保存或发布文章时,自动将所有远程图像保存到本地媒体库。"
215
 
216
+ #: qqworld-auto-save-images.php:348 qqworld-auto-save-images.php:452
217
  msgid "Manual"
218
  msgstr "手动"
219
 
220
+ #: qqworld-auto-save-images.php:349
221
  msgid ""
222
  "Manually save all remote images to local media libary when you click the "
223
  "button on the top of editor."
224
  msgstr "当单击编辑器顶部的按钮时,手动将所有远程图像保存到本地媒体库。"
225
 
226
+ #: qqworld-auto-save-images.php:354 qqworld-auto-save-images.php:356
227
  msgid "When"
228
  msgstr "什么时候"
229
 
230
+ #: qqworld-auto-save-images.php:359
231
  msgid "Save post (Publish, save draft or pedding review)."
232
  msgstr "保存文章时(发布文章,保存草稿或提交审核)。"
233
 
234
+ #: qqworld-auto-save-images.php:363
235
  msgid "Publish post only."
236
  msgstr "仅发布文章时。"
237
 
238
+ #: qqworld-auto-save-images.php:369 qqworld-auto-save-images.php:371
239
+ msgid "Set Featured Image"
240
+ msgstr "设置特色图片"
241
+
242
+ #: qqworld-auto-save-images.php:369
243
+ msgid "Set first one of the remote images as featured image."
244
+ msgstr "设置远程图片中的第1个为特色图片。"
245
 
246
+ #: qqworld-auto-save-images.php:384
247
  msgid "Exclude Domain/Keyword"
248
  msgstr "排除域名/关键词"
249
 
250
+ #: qqworld-auto-save-images.php:384
251
  msgid "Images will not be saved, if that url contains Exclude-Domain/Keyword."
252
  msgstr "如果图片地址包含排除域名/关键词,则不会保存该图片。"
253
 
254
+ #: qqworld-auto-save-images.php:386
255
  msgid "Exclude Domain"
256
  msgstr ""
257
 
258
+ #: qqworld-auto-save-images.php:396
259
  msgid "Add a Domain/Keyword"
260
  msgstr "添加域名/关键词"
261
 
262
+ #: qqworld-auto-save-images.php:402
263
  msgid "Scan Posts"
264
  msgstr "扫描文章"
265
 
266
+ #: qqworld-auto-save-images.php:406
267
+ msgid "Select post types"
268
+ msgstr "选择文章类型"
269
+
270
+ #: qqworld-auto-save-images.php:406
271
  msgid ""
272
  "If you have too many posts to be scan, sometimes in process looks like "
273
  "stopping, but it may be fake. please be patient."
275
  "如果有太多文章需要扫描,有时候在扫描过程中看起来像是停止了,但可能是假停止,"
276
  "请耐心等待。"
277
 
278
+ #: qqworld-auto-save-images.php:420
279
+ msgid "Scope of Post ID"
280
+ msgstr "文章ID范围"
281
 
282
+ #: qqworld-auto-save-images.php:420
 
 
 
 
 
 
 
 
 
283
  msgid ""
284
  "Default empty for scan all posts ID. If you want to scan posts ID from 50 to "
285
  "100. please type '50' and '100' or '100' and '50', The order in which two "
290
  "者'100'和'50',两个数字的顺序可以颠倒。如果你只输入了1个数字,则系统只会扫描"
291
  "该ID。"
292
 
293
+ #: qqworld-auto-save-images.php:421
294
+ #, php-format
295
+ msgid "From %1$s to %2$s"
296
+ msgstr "从 %1$s 到 %2$s"
297
+
298
+ #: qqworld-auto-save-images.php:425
299
+ msgid "Offset"
300
+ msgstr "偏移"
301
 
302
+ #: qqworld-auto-save-images.php:425
303
+ msgid ""
304
+ "Default scan all posts. If you want to scan 50-150 posts, please type '50' "
305
+ "in the textfield and select '100'."
306
+ msgstr ""
307
+ "默认扫秒全部文章,如果想扫描50-150篇文章,请在文本框中输入“50”并在下拉菜单中"
308
+ "选择“100”。"
309
+
310
+ #: qqworld-auto-save-images.php:427
311
  #, php-format
312
  msgid "Start from %s to Scan"
313
  msgstr "从 %s 开始扫描"
314
 
315
+ #: qqworld-auto-save-images.php:429
316
  msgid "All"
317
  msgstr ""
318
 
319
+ #: qqworld-auto-save-images.php:433
320
  msgid "Posts"
321
  msgstr ""
322
 
323
+ #: qqworld-auto-save-images.php:438
324
+ msgid "Speed"
325
+ msgstr "速度"
 
 
 
 
 
 
 
 
326
 
327
+ #: qqworld-auto-save-images.php:438
328
  msgid "If the server is too much stress may be appropriately reduced speed."
329
  msgstr "如果服务器压力过大,可以适当调低速度。"
330
 
331
+ #: qqworld-auto-save-images.php:451
332
  msgid ""
333
  "Scan posts and keep remote images in all posts to local media library. Maybe "
334
  "take a long time."
335
  msgstr "扫描所有的文章,将所有远程图片保存到本地,可能需要很长时间。"
336
 
337
+ #: qqworld-auto-save-images.php:452
338
  msgid ""
339
  "The list displayed will show you which posts including remote images, then "
340
  "you can keep them to local manually via click \"Fetch\" button."
342
  "显示的列表中将告诉你哪些文章包含远程图片,然后你可以通过点击“抓取”按钮手动保"
343
  "存。"
344
 
345
+ #: qqworld-auto-save-images.php:561
346
+ msgid "Has Missing/Undownloadable images."
347
+ msgstr " 不存在/不可下载 的远程图像。"
 
 
348
 
349
+ #: qqworld-auto-save-images.php:568
350
+ msgid "No remote images found."
351
+ msgstr "没有远程图像。"
352
+
353
+ #~ msgid "Successed save remote images"
354
+ #~ msgstr "成功保存远程图片"
qqworld-auto-save-images.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: QQWorld Auto Save Images
4
  Plugin URI: https://wordpress.org/plugins/qqworld-auto-save-images/
5
  Description: Automatically keep the all remote picture to the local, and automatically set featured image.
6
- Version: 1.6
7
  Author: Michael Wang
8
  Author URI: http://www.qqworld.org
9
  Text Domain: qqworld_auto_save_images
@@ -14,9 +14,12 @@ define('QQWORLD_AUTO_SAVE_IMAGES_URL', plugin_dir_url(__FILE__));
14
  class QQWorld_auto_save_images {
15
  var $using_action;
16
  var $type;
17
- var $preg = '/<img.*?src=[\"\']((?![\"\']).*?)((?![\"\'])\?.*?)?[\"\']/i';
 
 
18
  var $exclude_domain;
19
  function __construct() {
 
20
  $this->using_action = get_option('using_action', 'publish');
21
  $this->type = get_option('qqworld_auto_save_imagess_type', 'auto');
22
  $this->featured_image = get_option('qqworld_auto_save_imagess_set_featured_image', 'yes');
@@ -46,6 +49,24 @@ class QQWorld_auto_save_images {
46
 
47
  add_action( 'admin_enqueue_scripts', array($this, 'add_to_post_php') );
48
  add_action( 'admin_enqueue_scripts', array($this, 'add_to_page_qqworld_auto_save_images') );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
 
51
  public function add_to_post_php() {
@@ -57,8 +78,7 @@ class QQWorld_auto_save_images {
57
  wp_enqueue_script('qqworld-auto-save-images-script-post');
58
  $translation_array = array(
59
  'post_id' => $post->ID,
60
- 'in_process' => __('In Process...', 'qqworld_auto_save_images'),
61
- 'succesed_save_remote_images' => __('Successed save remote images', 'qqworld_auto_save_images')
62
  );
63
  wp_localize_script('qqworld-auto-save-images-script-post', 'QASI', $translation_array, '3.0.0');
64
  }
@@ -306,10 +326,12 @@ class QQWorld_auto_save_images {
306
  ?>
307
  <div class="wrap">
308
  <h2><?php _e('QQWorld Auto Save Images', 'qqworld_auto_save_images'); ?></h2>
 
309
  <div id="scan-result"></div>
310
  <form action="options.php" method="post" id="form">
311
  <?php settings_fields('qqworld_auto_save_images_settings'); ?>
312
  <img src="https://ps.w.org/qqworld-auto-save-images/assets/banner-772x250.png" width="772" height="250" id="banner" />
 
313
  <table class="form-table">
314
  <tbody>
315
  <tr valign="top">
@@ -343,12 +365,12 @@ class QQWorld_auto_save_images {
343
  </tr>
344
 
345
  <tr valign="top">
346
- <th scope="row"><label><?php _e('Automatically Set Featured Image', 'qqworld_auto_save_images'); ?></label></th>
347
  <td><fieldset>
348
- <legend class="screen-reader-text"><span><?php _e('Automatically Set Featured Image', 'qqworld_auto_save_images'); ?></span></legend>
349
  <label for="qqworld_auto_save_imagess_set_featured_image_yes">
350
  <input name="qqworld_auto_save_imagess_set_featured_image" type="radio" id="qqworld_auto_save_imagess_set_featured_image_yes" value="yes" <?php checked('yes', $this->featured_image); ?> />
351
- <?php _e('Yes'); ?>
352
  </label><br />
353
  <label for="qqworld_auto_save_imagess_set_featured_image_no">
354
  <input name="qqworld_auto_save_imagess_set_featured_image" type="radio" id="qqworld_auto_save_imagess_set_featured_image_no" value="no" <?php checked('no', $this->featured_image); ?> />
@@ -370,58 +392,64 @@ class QQWorld_auto_save_images {
370
  <?php endif;
371
  endforeach; ?>
372
  </ul>
373
- <input type="button" id="add_exclude_domain" class="button button-primary" value="<?php _e('Add a Domain/Keyword', 'qqworld_auto_save_images');?>" />
374
  </fieldset></td>
375
  </tr>
376
-
377
-
 
 
 
 
378
  <tr valign="top">
379
- <th scope="row"><label><?php _e('Scan Posts', 'qqworld_auto_save_images'); ?></label> <span class="icon help" title="<?php _e("If you have too many posts to be scan, sometimes in process looks like stopping, but it may be fake. please be patient.", 'qqworld_auto_save_images') ?>"></span></th>
380
  <td>
381
- <div id="post_types_list">
382
- <p><?php _e('Select post types:', 'qqworld_auto_save_images'); ?> <?php
383
- $post_types = get_post_types('', 'objects'); ?>
384
- <ul>
385
  <?php foreach ($post_types as $name => $post_type) :
386
  if ( !in_array($name, array('attachment', 'revision', 'nav_menu_item') )) : ?>
387
  <li><label><input name="qqworld_auto_save_imagess_post_types[]" type="checkbox" value="<?php echo $name; ?>" /> <?php echo $post_type->labels->name; ?> (<?php $count = wp_count_posts($name); echo $count->publish; ?>)</label></li>
388
  <?php endif;
389
  endforeach;
390
  ?></ul>
391
- </div>
 
392
 
393
- <p id="scope-id"><?php _e('Scope of Post ID:', 'qqworld_auto_save_images'); ?> <?php printf(__('From %1$s to %2$s', 'qqworld_auto_save_images'), '<input type="number" class="small-text" name="id_from" />', '<input type="number" class="small-text" name="id_to" />'); ?> <span class="icon help" title="<?php _e("Default empty for scan all posts ID. If you want to scan posts ID from 50 to 100. please type '50' and '100' or '100' and '50', The order in which two numbers can be reversed. If you only type one number, system would only scan that ID.", 'qqworld_auto_save_images'); ?>"></span></p>
394
-
395
- <p><?php _e('Offset:', 'qqworld_auto_save_images'); ?> <?php printf(__('Start from %s to Scan', 'qqworld_auto_save_images'), '<input type="number" class="small-text" name="offset" value="0" disabled />'); ?>
 
 
 
 
 
 
396
  <select name="posts_per_page">
397
  <option value="-1"><?php _e('All'); ?></option>
398
  <?php for ($i=1; $i<=10; $i++) : ?>
399
  <option value="<?php echo $i*100; ?>"><?php echo $i*100; ?></option>
400
  <?php endfor; ?>
401
- </select> <?php _e('Posts'); ?> <span class="icon help" title="<?php _e("Default scan all posts. If you want to scan 50-150 posts, please type '50' in the textfield and select '100'.", 'qqworld_auto_save_images'); ?>"></span>
402
- </p>
403
-
404
- <fieldset>
405
- <legend class="screen-reader-text"><span><?php _e('Scan Posts', 'qqworld_auto_save_images'); ?></span></legend>
406
- <?php _e('Speed:', 'qqworld_auto_save_images'); ?>
407
- <select name="speed">
408
- <?php for ($i=1; $i<10; $i++) : ?>
409
- <option value="<?php echo $i; ?>"><?php echo $i; ?></option>
410
- <?php endfor; ?>
411
- <option value="10" selected>10</option>
412
- </select> <span class="icon help" title="<?php _e('If the server is too much stress may be appropriately reduced speed.', 'qqworld_auto_save_images'); ?>"></span><br />
413
- <label for="scan_old_posts">
414
- <input name="scan_old_posts" type="button" class="button-primary" id="scan_old_posts" value="<?php _e('Automatic', 'qqworld_auto_save_images'); ?> &#8667;" />
415
- </label> <span class="icon help" title="<?php _e('Scan posts and keep remote images in all posts to local media library. Maybe take a long time.', 'qqworld_auto_save_images'); ?>"></span>
416
- <label for="print_all_posts">
417
- <input name="list_all_posts" type="button" class="button-primary" id="list_all_posts" value="<?php _e('Manual', 'qqworld_auto_save_images'); ?> &#9776;" />
418
- </label> <span class="icon help" title="<?php _e("The list displayed will show you which posts including remote images, then you can keep them to local manually via click \"Fetch\" button.", 'qqworld_auto_save_images'); ?>"></span>
419
- </fieldset>
420
  </td>
421
  </tr>
422
  </tbody>
423
  </table>
424
- <?php submit_button(); ?>
 
 
 
425
  </form>
426
  <?php
427
  }
@@ -496,6 +524,9 @@ class QQWorld_auto_save_images {
496
  if ( !current_user_can('edit_post', $post_id) )
497
  return;
498
 
 
 
 
499
  $content = $this->utf8_urldecode($this->utf8_urldecode($_POST['content']));
500
 
501
  $preg=preg_match_all($this->preg,stripslashes($content),$matches);
@@ -511,6 +542,7 @@ class QQWorld_auto_save_images {
511
  if ($allow) {
512
  $pos=strpos($image_url,get_bloginfo('url'));
513
  if($pos===false){
 
514
  if ($res=$this->save_images($image_url,$post_id)) {
515
  $replace=$res['url'];
516
  $content=str_replace($image_url,$replace,$content);
@@ -520,7 +552,22 @@ class QQWorld_auto_save_images {
520
  }
521
  }
522
  wp_update_post(array('ID' => $post_id, 'post_content' => $content));
523
- echo $content;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
524
  exit;
525
  }
526
 
@@ -532,6 +579,11 @@ class QQWorld_auto_save_images {
532
 
533
  if ( !current_user_can('edit_post', $post_id) )
534
  return;
 
 
 
 
 
535
 
536
  $this->remove_actions();
537
 
@@ -550,6 +602,7 @@ class QQWorld_auto_save_images {
550
  if ($allow) {
551
  $pos=strpos($image_url,get_bloginfo('url'));
552
  if($pos===false){
 
553
  if ($res=$this->save_images($image_url,$post_id)) {
554
  $replace=$res['url'];
555
  $content=str_replace($image_url,$replace,$content);
@@ -572,7 +625,9 @@ class QQWorld_auto_save_images {
572
  if ( empty($match) ) {
573
  if ($filetype = $this->getFileType($file) ) {
574
  preg_match( '/(.*?)$/i', $filename, $match );
575
- $img_name = $match[0] . '.' . $filetype;
 
 
576
  } else return false;
577
  } else {
578
  $img_name = $match[1].$match[2];
@@ -581,6 +636,8 @@ class QQWorld_auto_save_images {
581
  $attach_id = $this->insert_attachment($res['file'],$post_id);
582
  if( !has_post_thumbnail($post_id) && $this->featured_image=='yes' ) set_post_thumbnail( $post_id, $attach_id );
583
  return $res;
 
 
584
  }
585
  return false;
586
  }
@@ -589,7 +646,6 @@ class QQWorld_auto_save_images {
589
  $bin = substr($file,0,2);
590
  $strInfo = @unpack("C2chars", $bin);
591
  $typeCode = intval($strInfo['chars1'].$strInfo['chars2']);
592
- $fileType = '';
593
  switch ($typeCode) {
594
  case 7790:
595
  $fileType = 'exe';
3
  Plugin Name: QQWorld Auto Save Images
4
  Plugin URI: https://wordpress.org/plugins/qqworld-auto-save-images/
5
  Description: Automatically keep the all remote picture to the local, and automatically set featured image.
6
+ Version: 1.6.1
7
  Author: Michael Wang
8
  Author URI: http://www.qqworld.org
9
  Text Domain: qqworld_auto_save_images
14
  class QQWorld_auto_save_images {
15
  var $using_action;
16
  var $type;
17
+ var $preg = '/<img.*?src=[\"\']((?![\"\']).*?)[\"\']/i';
18
+ var $has_remote_image;
19
+ var $has_missing_image;
20
  var $exclude_domain;
21
  function __construct() {
22
+ __('Michael Wang', 'qqworld_auto_save_images');
23
  $this->using_action = get_option('using_action', 'publish');
24
  $this->type = get_option('qqworld_auto_save_imagess_type', 'auto');
25
  $this->featured_image = get_option('qqworld_auto_save_imagess_set_featured_image', 'yes');
49
 
50
  add_action( 'admin_enqueue_scripts', array($this, 'add_to_post_php') );
51
  add_action( 'admin_enqueue_scripts', array($this, 'add_to_page_qqworld_auto_save_images') );
52
+
53
+ add_filter( 'post_updated_messages', array($this, 'post_updated_messages') );
54
+ }
55
+
56
+ public function post_updated_messages($messages) {
57
+ global $post, $post_ID;
58
+ $post_type = get_post_type( $post_ID );
59
+ $messages[$post_type][21] = __('All remote images have been saved.', 'qqworld_auto_save_images') . sprintf( __(' <a href="%s">View</a>', 'qqworld_auto_save_images'), esc_url( get_permalink($post_ID) ) );
60
+ $messages[$post_type][22] = __('Has missing images or image which could not download.', 'qqworld_auto_save_images') . sprintf( __(' <a href="%s">View</a>', 'qqworld_auto_save_images'), esc_url( get_permalink($post_ID) ) );
61
+ return $messages;
62
+ }
63
+
64
+ public function redirect_post_location($location, $post_id) {
65
+ if ($this->has_remote_image) {
66
+ if ($this->has_missing_image) $location = add_query_arg( 'message', 22, get_edit_post_link( $post_id, 'url' ) );
67
+ else $location = add_query_arg( 'message', 21, get_edit_post_link( $post_id, 'url' ) );
68
+ }
69
+ return $location;
70
  }
71
 
72
  public function add_to_post_php() {
78
  wp_enqueue_script('qqworld-auto-save-images-script-post');
79
  $translation_array = array(
80
  'post_id' => $post->ID,
81
+ 'in_process' => __('In Process...', 'qqworld_auto_save_images')
 
82
  );
83
  wp_localize_script('qqworld-auto-save-images-script-post', 'QASI', $translation_array, '3.0.0');
84
  }
326
  ?>
327
  <div class="wrap">
328
  <h2><?php _e('QQWorld Auto Save Images', 'qqworld_auto_save_images'); ?></h2>
329
+ <p><?php _e('Automatically keep the all remote picture to the local, and automatically set featured image.', 'qqworld_auto_save_images'); ?>
330
  <div id="scan-result"></div>
331
  <form action="options.php" method="post" id="form">
332
  <?php settings_fields('qqworld_auto_save_images_settings'); ?>
333
  <img src="https://ps.w.org/qqworld-auto-save-images/assets/banner-772x250.png" width="772" height="250" id="banner" />
334
+ <h2><?php _e('Settings'); ?></h2>
335
  <table class="form-table">
336
  <tbody>
337
  <tr valign="top">
365
  </tr>
366
 
367
  <tr valign="top">
368
+ <th scope="row"><label><?php _e('Set Featured Image', 'qqworld_auto_save_images'); ?></label> <span class="icon help" title="<?php _e("Set first one of the remote images as featured image.", 'qqworld_auto_save_images'); ?>"></span></th>
369
  <td><fieldset>
370
+ <legend class="screen-reader-text"><span><?php _e('Set Featured Image', 'qqworld_auto_save_images'); ?></span></legend>
371
  <label for="qqworld_auto_save_imagess_set_featured_image_yes">
372
  <input name="qqworld_auto_save_imagess_set_featured_image" type="radio" id="qqworld_auto_save_imagess_set_featured_image_yes" value="yes" <?php checked('yes', $this->featured_image); ?> />
373
+ <?php _e('Automatic', 'qqworld_auto_save_images'); ?>
374
  </label><br />
375
  <label for="qqworld_auto_save_imagess_set_featured_image_no">
376
  <input name="qqworld_auto_save_imagess_set_featured_image" type="radio" id="qqworld_auto_save_imagess_set_featured_image_no" value="no" <?php checked('no', $this->featured_image); ?> />
392
  <?php endif;
393
  endforeach; ?>
394
  </ul>
395
+ <input type="button" id="add_exclude_domain" class="button" value="<?php _e('Add a Domain/Keyword', 'qqworld_auto_save_images');?>" />
396
  </fieldset></td>
397
  </tr>
398
+ </tbody>
399
+ </table>
400
+ <?php submit_button(); ?>
401
+ <h2><?php _e('Scan Posts', 'qqworld_auto_save_images'); ?></h2>
402
+ <table class="form-table">
403
+ <tbody>
404
  <tr valign="top">
405
+ <th scope="row"><label><?php _e('Select post types', 'qqworld_auto_save_images'); ?></label> <span class="icon help" title="<?php _e("If you have too many posts to be scan, sometimes in process looks like stopping, but it may be fake. please be patient.", 'qqworld_auto_save_images') ?>"></span></th>
406
  <td>
407
+ <?php $post_types = get_post_types('', 'objects'); ?>
408
+ <ul id="post_types_list">
 
 
409
  <?php foreach ($post_types as $name => $post_type) :
410
  if ( !in_array($name, array('attachment', 'revision', 'nav_menu_item') )) : ?>
411
  <li><label><input name="qqworld_auto_save_imagess_post_types[]" type="checkbox" value="<?php echo $name; ?>" /> <?php echo $post_type->labels->name; ?> (<?php $count = wp_count_posts($name); echo $count->publish; ?>)</label></li>
412
  <?php endif;
413
  endforeach;
414
  ?></ul>
415
+ </td>
416
+ </tr>
417
 
418
+ <tr valign="top">
419
+ <th scope="row"><label><?php _e('Scope of Post ID', 'qqworld_auto_save_images'); ?></label> <span class="icon help" title="<?php _e("Default empty for scan all posts ID. If you want to scan posts ID from 50 to 100. please type '50' and '100' or '100' and '50', The order in which two numbers can be reversed. If you only type one number, system would only scan that ID.", 'qqworld_auto_save_images'); ?>"></span></th>
420
+ <td><?php printf(__('From %1$s to %2$s', 'qqworld_auto_save_images'), '<input type="number" class="small-text" name="id_from" />', '<input type="number" class="small-text" name="id_to" />'); ?></td>
421
+ </tr>
422
+
423
+ <tr valign="top">
424
+ <th scope="row"><label><?php _e('Offset', 'qqworld_auto_save_images'); ?></label> <span class="icon help" title="<?php _e("Default scan all posts. If you want to scan 50-150 posts, please type '50' in the textfield and select '100'.", 'qqworld_auto_save_images'); ?>"></span></th>
425
+ <td>
426
+ <?php printf(__('Start from %s to Scan', 'qqworld_auto_save_images'), '<input type="number" class="small-text" name="offset" value="0" disabled />'); ?>
427
  <select name="posts_per_page">
428
  <option value="-1"><?php _e('All'); ?></option>
429
  <?php for ($i=1; $i<=10; $i++) : ?>
430
  <option value="<?php echo $i*100; ?>"><?php echo $i*100; ?></option>
431
  <?php endfor; ?>
432
+ </select> <?php _e('Posts'); ?>
433
+ </td>
434
+ </tr>
435
+
436
+ <tr valign="top">
437
+ <th scope="row"><label><?php _e('Speed', 'qqworld_auto_save_images'); ?></label> <span class="icon help" title="<?php _e('If the server is too much stress may be appropriately reduced speed.', 'qqworld_auto_save_images'); ?>"></span></th>
438
+ <td>
439
+ <select name="speed">
440
+ <?php for ($i=1; $i<10; $i++) : ?>
441
+ <option value="<?php echo $i; ?>"><?php echo $i; ?></option>
442
+ <?php endfor; ?>
443
+ <option value="10" selected>10</option>
444
+ </select><br />
 
 
 
 
 
 
445
  </td>
446
  </tr>
447
  </tbody>
448
  </table>
449
+ <p class="submit">
450
+ <input name="scan_old_posts" type="button" class="button-primary" id="scan_old_posts" value="<?php _e('Automatic', 'qqworld_auto_save_images'); ?> &#8667;" /> <span class="icon help" title="<?php _e('Scan posts and keep remote images in all posts to local media library. Maybe take a long time.', 'qqworld_auto_save_images'); ?>"></span>
451
+ <input name="list_all_posts" type="button" class="button-primary" id="list_all_posts" value="<?php _e('Manual', 'qqworld_auto_save_images'); ?> &#9776;" /> <span class="icon help" title="<?php _e("The list displayed will show you which posts including remote images, then you can keep them to local manually via click \"Fetch\" button.", 'qqworld_auto_save_images'); ?>"></span>
452
+ </p>
453
  </form>
454
  <?php
455
  }
524
  if ( !current_user_can('edit_post', $post_id) )
525
  return;
526
 
527
+ $this->has_remote_image = 0;
528
+ $this->has_missing_image = 0;
529
+
530
  $content = $this->utf8_urldecode($this->utf8_urldecode($_POST['content']));
531
 
532
  $preg=preg_match_all($this->preg,stripslashes($content),$matches);
542
  if ($allow) {
543
  $pos=strpos($image_url,get_bloginfo('url'));
544
  if($pos===false){
545
+ $this->has_remote_image = 1;
546
  if ($res=$this->save_images($image_url,$post_id)) {
547
  $replace=$res['url'];
548
  $content=str_replace($image_url,$replace,$content);
552
  }
553
  }
554
  wp_update_post(array('ID' => $post_id, 'post_content' => $content));
555
+
556
+ $result = array();
557
+ if ($this->has_remote_image) {
558
+ if ($this->has_missing_image) {
559
+ $result['type'] = 3;
560
+ $result['msg'] = __('Has Missing/Undownloadable images.', 'qqworld_auto_save_images');
561
+ } else {
562
+ $result['type'] = 2;
563
+ $result['msg'] = __('All remote images have been saved.', 'qqworld_auto_save_images');
564
+ }
565
+ } else {
566
+ $result['type'] = 1;
567
+ $result['msg'] = __('No remote images found.', 'qqworld_auto_save_images');
568
+ }
569
+ $result['content'] = $content;
570
+ echo json_encode($result);
571
  exit;
572
  }
573
 
579
 
580
  if ( !current_user_can('edit_post', $post_id) )
581
  return;
582
+
583
+ $this->has_remote_image = 0;
584
+ $this->has_missing_image = 0;
585
+
586
+ add_filter( 'redirect_post_location', array($this, 'redirect_post_location'), 10, 2);
587
 
588
  $this->remove_actions();
589
 
602
  if ($allow) {
603
  $pos=strpos($image_url,get_bloginfo('url'));
604
  if($pos===false){
605
+ $this->has_remote_image = 1;
606
  if ($res=$this->save_images($image_url,$post_id)) {
607
  $replace=$res['url'];
608
  $content=str_replace($image_url,$replace,$content);
625
  if ( empty($match) ) {
626
  if ($filetype = $this->getFileType($file) ) {
627
  preg_match( '/(.*?)$/i', $filename, $match );
628
+ $pos=strpos($image_url,'?'); // if has '?', md5()
629
+ $img_name = $pos ? md5($match[0]) : $match[0];
630
+ $img_name = $img_name . '.' . $filetype;
631
  } else return false;
632
  } else {
633
  $img_name = $match[1].$match[2];
636
  $attach_id = $this->insert_attachment($res['file'],$post_id);
637
  if( !has_post_thumbnail($post_id) && $this->featured_image=='yes' ) set_post_thumbnail( $post_id, $attach_id );
638
  return $res;
639
+ } else {
640
+ $this->has_missing_image = 1;
641
  }
642
  return false;
643
  }
646
  $bin = substr($file,0,2);
647
  $strInfo = @unpack("C2chars", $bin);
648
  $typeCode = intval($strInfo['chars1'].$strInfo['chars2']);
 
649
  switch ($typeCode) {
650
  case 7790:
651
  $fileType = 'exe';