QQWorld Auto Save Images - Version 1.7

Version Description

Download this release

Release Info

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

Code changes from version 1.6.1 to 1.7

css/style.css CHANGED
@@ -1,6 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  #banner {
2
  max-width: 100%;
3
- height: auto;
4
  display: block;
5
  margin: 20px 0;
6
  border: 10px solid #fff;
@@ -59,4 +100,38 @@ span.icon.help {
59
  }
60
  ul[id^="noty_"] li {
61
  margin-bottom: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
1
+ #qqworld-auto-save-images-tabs {
2
+ height: 40px;
3
+ margin-top: 35px;
4
+ border-bottom: 1px solid #aaa;
5
+ box-shadow: inset 0 -7px 10px rgba(0,0,0,.05);
6
+ }
7
+ #qqworld-auto-save-images-tabs li {
8
+ float: left;
9
+ height: 39px;
10
+ line-height: 39px;
11
+ font-size: 24px;
12
+ padding: 0 40px;
13
+ border: 1px solid #aaa;
14
+ margin: 0 5px;
15
+ cursor: pointer;
16
+ border-radius: 5px 5px 0 0;
17
+ color: #aaa;
18
+ -webkit-transition: width .25s, height .25s, background .25s, color .25s, box-shadow .25s;
19
+ -moz-transition: width .25s, height .25s, background .25s, color .25s, box-shadow .25s;
20
+ -o-transition: width .25s, height .25s, background .25s, color .25s, box-shadow .25s;
21
+ -ms-transition: width .25s, height .25s, background .25s, color .25s, box-shadow .25s;
22
+ transition: width .25s, height .25s, background .25s, color .25s, box-shadow .25s;
23
+ }
24
+ #qqworld-auto-save-images-tabs li:hover {
25
+ color: #666;
26
+ background: #fff;
27
+ box-shadow: inset 0 -7px 10px rgba(0,0,0,.05);
28
+ }
29
+ #qqworld-auto-save-images-tabs li.current {
30
+ color: #333;
31
+ position: relative;
32
+ top: 1px;
33
+ height: 40px;
34
+ line-height: 40px;
35
+ border-bottom: none;
36
+ background: #f1f1f1;
37
+ box-shadow: none;
38
+ }
39
+ .tab-content.hidden {
40
+ display: none;
41
+ }
42
+
43
  #banner {
44
  max-width: 100%;
 
45
  display: block;
46
  margin: 20px 0;
47
  border: 10px solid #fff;
100
  }
101
  ul[id^="noty_"] li {
102
  margin-bottom: 0;
103
+ }
104
+
105
+ #categories_block .postbox {
106
+ float: left;
107
+ margin-right: 25px;
108
+ min-width: initial;
109
+ }
110
+ #categories_block .postbox .hndle {
111
+ padding: 10px 15px;
112
+ cursor: initial;
113
+ }
114
+ #categories_block .postbox .inside {
115
+ padding: 0 25px 1px 15px;
116
+ }
117
+ #categories_block .postbox .children {
118
+ margin: 10px 0 0 25px;
119
+ }
120
+ #categories_block .postbox .tabs-panel > ul {
121
+ margin: 0;
122
+ }
123
+
124
+ @media screen and ( max-width: 1000px ) {
125
+ #banner {
126
+ height: auto;
127
+ }
128
+ }
129
+ @media screen and ( max-width: 640px ) {
130
+ #banner {
131
+ border-width: 5px;
132
+ }
133
+ #qqworld-auto-save-images-tabs li {
134
+ font-size: 18px;
135
+ padding: 0 20px;
136
+ }
137
  }
js/script.js CHANGED
@@ -110,7 +110,7 @@ QQWorld_auto_save_images.scan_posts = function() {
110
  $('body').data('scan-mode', 'scan').data('r', r);
111
  if (typeof respond[r] == 'undefined') {
112
  $('#scan-result').effect( 'shake', null, 500 );
113
- $('#form').slideDown('slow');
114
  $('body').data('noty').close();
115
  var count = $('#scan_old_post_list tbody tr').length;
116
  var count_remote_images = $('#scan_old_post_list tbody tr.has_remote_images').length;
@@ -127,7 +127,10 @@ QQWorld_auto_save_images.scan_posts = function() {
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 {
132
  $('#scan_old_post_list').slideUp('slow');
133
  count_html = QASI.no_posts_found;
@@ -171,7 +174,7 @@ QQWorld_auto_save_images.scan_posts = function() {
171
  $('body').data('scan-mode', 'list').data('r', r);
172
  if (typeof respond[r] == 'undefined') {
173
  $('#scan-result').effect( 'shake', null, 500 );
174
- $('#form').slideDown('slow');
175
  $('body').data('noty').close();
176
  var count = $('#scan_old_post_list tbody tr').length;
177
  var count_remote_images = $('#scan_old_post_list tbody tr.has_remote_images').length;
@@ -186,7 +189,10 @@ QQWorld_auto_save_images.scan_posts = function() {
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 {
191
  $('#scan_old_post_list').slideUp('slow');
192
  count_html = QASI.no_posts_found;
@@ -272,7 +278,7 @@ QQWorld_auto_save_images.scan_posts = function() {
272
  addClass: 'button button-primary',
273
  text: QASI.yes,
274
  onClick: function ($noty) {
275
- $('#form').slideUp('slow');
276
  $noty.close();
277
  $('#scan_old_posts').attr('disabled', true);
278
  $('#list_all_posts').attr('disabled', true);
@@ -320,10 +326,11 @@ QQWorld_auto_save_images.scan_posts = function() {
320
  });
321
  $('#list_all_posts').on('click', function() {
322
  if (jQuery('input[name="qqworld_auto_save_imagess_post_types[]"]:checked').length) {
323
- $('#form').slideUp('slow');
324
  $('#scan_old_posts').attr('disabled', true);
325
  $('#list_all_posts').attr('disabled', true);
326
  var data = $('#form').serialize()+'&action=get_scan_list';
 
327
  $.ajax({
328
  type: 'POST',
329
  url: ajaxurl,
@@ -383,6 +390,45 @@ QQWorld_auto_save_images.scan_posts = function() {
383
  if (!$('#exclude_domain_list li').length) $('#exclude_domain_list').append('<li class="empty"><input type="hidden" name="qqworld-auto-save-images-exclude-domain" value="" /></li>');
384
  });
385
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  };
387
 
388
  this.create.init = function() {
@@ -391,5 +437,5 @@ QQWorld_auto_save_images.scan_posts = function() {
391
  this.create.init();
392
  };
393
  jQuery(function($) {
394
- QQWorld_auto_save_images.scan_posts();
395
  });
110
  $('body').data('scan-mode', 'scan').data('r', r);
111
  if (typeof respond[r] == 'undefined') {
112
  $('#scan-result').effect( 'shake', null, 500 );
113
+ $('#scan-post-block').slideDown('normal');
114
  $('body').data('noty').close();
115
  var count = $('#scan_old_post_list tbody tr').length;
116
  var count_remote_images = $('#scan_old_post_list tbody tr.has_remote_images').length;
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 {
131
+ $('#scan_old_post_list').slideUp('slow');
132
+ count_html += '<br />'+QASI.no_posts_processed;
133
+ }
134
  } else {
135
  $('#scan_old_post_list').slideUp('slow');
136
  count_html = QASI.no_posts_found;
174
  $('body').data('scan-mode', 'list').data('r', r);
175
  if (typeof respond[r] == 'undefined') {
176
  $('#scan-result').effect( 'shake', null, 500 );
177
+ $('#scan-post-block').slideDown('normal');
178
  $('body').data('noty').close();
179
  var count = $('#scan_old_post_list tbody tr').length;
180
  var count_remote_images = $('#scan_old_post_list tbody tr.has_remote_images').length;
189
  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);
190
  else count_html += _this.lib.sprintf("<br />"+QASI.and_with_n_posts_have_missing_images, count_not_exits_remote_images);
191
  }
192
+ } else {
193
+ $('#scan_old_post_list').slideUp('slow');
194
+ count_html += '<br />'+QASI.no_post_has_remote_images_found;
195
+ }
196
  } else {
197
  $('#scan_old_post_list').slideUp('slow');
198
  count_html = QASI.no_posts_found;
278
  addClass: 'button button-primary',
279
  text: QASI.yes,
280
  onClick: function ($noty) {
281
+ $('#scan-post-block').slideUp('normal');
282
  $noty.close();
283
  $('#scan_old_posts').attr('disabled', true);
284
  $('#list_all_posts').attr('disabled', true);
326
  });
327
  $('#list_all_posts').on('click', function() {
328
  if (jQuery('input[name="qqworld_auto_save_imagess_post_types[]"]:checked').length) {
329
+ $('#scan-post-block').slideUp('normal');
330
  $('#scan_old_posts').attr('disabled', true);
331
  $('#list_all_posts').attr('disabled', true);
332
  var data = $('#form').serialize()+'&action=get_scan_list';
333
+ console.log(data);
334
  $.ajax({
335
  type: 'POST',
336
  url: ajaxurl,
390
  if (!$('#exclude_domain_list li').length) $('#exclude_domain_list').append('<li class="empty"><input type="hidden" name="qqworld-auto-save-images-exclude-domain" value="" /></li>');
391
  });
392
  });
393
+ $(document).on('click', '#qqworld-auto-save-images-tabs li', function() {
394
+ if (!$(this).hasClass('current')) {
395
+ var index = $('#qqworld-auto-save-images-tabs li').index(this);
396
+ $('#qqworld-auto-save-images-tabs li').removeClass('current');
397
+ $(this).addClass('current');
398
+ $('.tab-content').hide().eq(index).fadeIn('normal');
399
+ }
400
+ });
401
+
402
+ $(document).on('click', 'input[name="qqworld_auto_save_imagess_post_types[]"]', function() {
403
+ var checked = $('input[name="qqworld_auto_save_imagess_post_types[]"]:checked');
404
+ if (checked.length) {
405
+ $('#categories_block').html('<img src=" data:image/gif;base64,R0lGODlhgAAPAKIAALCvsMPCwz8/PwAAAPv6+wAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQECgAAACwAAAAAgAAPAAAD50ixS/6sPRfDpPGqfKv2HTeBowiZGLORq1lJqfuW7Gud9YzLud3zQNVOGCO2jDZaEHZk+nRFJ7R5i1apSuQ0OZT+nleuNetdhrfob1kLXrvPariZLGfPuz66Hr8f8/9+gVh4YoOChYhpd4eKdgwAkJEAE5KRlJWTD5iZDpuXlZ+SoZaamKOQp5wEm56loK6isKSdprKotqqttK+7sb2zq6y8wcO6xL7HwMbLtb+3zrnNycKp1bjW0NjT0cXSzMLK3uLd5Mjf5uPo5eDa5+Hrz9vt6e/qosO/GvjJ+sj5F/sC+uMHcCCoBAAh+QQECgAAACwAAAAABwAPAAADEUiyq/wwyknjuDjrzfsmGpEAACH5BAQKAAAALAsAAAAHAA8AAAMRSLKr/DDKSeO4OOvN+yYakQAAIfkEBAoAAAAsFgAAAAcADwAAAxFIsqv8MMpJ47g46837JhqRAAAh+QQECgAAACwhAAAABwAPAAADEUiyq/wwyknjuDjrzfsmGpEAACH5BAQKAAAALCwAAAAHAA8AAAMRSLKr/DDKSeO4OOvN+yYakQAAIfkEBAoAAAAsNwAAAAcADwAAAxFIsqv8MMpJ47g46837JhqRAAAh+QQECgAAACxCAAAABwAPAAADEUiyq/wwyknjuDjrzfsmGpEAACH5BAQKAAAALE0AAAAHAA8AAAMRSLKr/DDKSeO4OOvN+yYakQAAIfkEBAoAAAAsWAAAAAcADwAAAxFIsqv8MMpJ47g46837JhqRAAAh+QQECgAAACxjAAAABwAPAAADEUiyq/wwyknjuDjrzfsmGpEAACH5BAQKAAAALG4AAAAHAA8AAAMRSLKr/DDKSeO4OOvN+yYakQAAIfkEBAoAAAAseQAAAAcADwAAAxFIsqv8MMpJ47g46837JhqRAAA7" />');
406
+ var temp = '';
407
+ checked.each(function() {
408
+ temp += '&posttype[]=' + $(this).val();
409
+ });
410
+ var data = 'action=save_remote_images_get_categories_list'+temp;
411
+ $.ajax({
412
+ type: 'POST',
413
+ url: ajaxurl,
414
+ data: data,
415
+ success: function(data) {
416
+ if ($(data).find('div').length) {
417
+ data = $(data);
418
+ $('#categories_block').html(data);
419
+ data.hide().fadeIn('normal');
420
+ $('#categories_block > div').each(function() {
421
+ var posttype = $(this).attr('post-type');
422
+ $(this).find('input').attr('name', 'terms['+posttype+'][]');
423
+ });
424
+ } else $('#categories_block').html(data);
425
+ },
426
+ error: _this.action.catch_errors
427
+ });
428
+ } else {
429
+ $('#categories_block').html(QASI.pls_select_post_types);
430
+ }
431
+ });
432
  };
433
 
434
  this.create.init = function() {
437
  this.create.init();
438
  };
439
  jQuery(function($) {
440
+ if ($('#post_types_list').length && $('#second_level').length) QQWorld_auto_save_images.scan_posts();
441
  });
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-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,253 +21,257 @@ msgstr ""
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,11 +279,19 @@ msgstr ""
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,16 +302,16 @@ msgstr ""
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'."
@@ -307,34 +319,34 @@ 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,11 +354,11 @@ msgstr ""
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
 
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 20:48+0800\n"
6
+ "PO-Revision-Date: 2014-10-13 20:49+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:22
25
  msgid "Michael Wang"
26
  msgstr "王晓骞"
27
 
28
+ #: qqworld-auto-save-images.php:68
29
+ msgid "No taxonomies found."
30
+ msgstr "没有相关分类方法。"
31
+
32
+ #: qqworld-auto-save-images.php:76 qqworld-auto-save-images.php:255
33
+ #: qqworld-auto-save-images.php:616
34
  msgid "All remote images have been saved."
35
  msgstr "已保存所有远程图像。"
36
 
37
+ #: qqworld-auto-save-images.php:76 qqworld-auto-save-images.php:77
38
  #, php-format
39
  msgid " <a href=\"%s\">View</a>"
40
  msgstr " <a href=\"%s\">查看</a>"
41
 
42
+ #: qqworld-auto-save-images.php:77
43
  msgid "Has missing images or image which could not download."
44
  msgstr "内容包含 不存在/无法下载 的图像。"
45
 
46
+ #: qqworld-auto-save-images.php:98
47
  msgid "In Process..."
48
  msgstr "正在保存……"
49
 
50
+ #: qqworld-auto-save-images.php:118
51
  msgid ""
52
  "Are you sure?<br />Before you click the yes button, I recommend backup site "
53
  "database."
54
  msgstr "你确定吗?<br />在点击确定按钮之前,我建议你备份网站的数据库。"
55
 
56
+ #: qqworld-auto-save-images.php:119 qqworld-auto-save-images.php:466
57
  msgid "Please select post types."
58
  msgstr "请选择文章类型。"
59
 
60
+ #: qqworld-auto-save-images.php:120
61
  msgid "May be a problem with some posts: "
62
  msgstr "也许一些文章有问题:"
63
 
64
+ #: qqworld-auto-save-images.php:121
65
  #, php-format
66
  msgid "%d post has been scanned."
67
  msgstr "已扫描%d篇文章。"
68
 
69
+ #: qqworld-auto-save-images.php:122
70
  #, php-format
71
  msgid "%d posts have been scanned."
72
  msgstr "已扫描%d篇文章。"
73
 
74
+ #: qqworld-auto-save-images.php:123
75
  #, php-format
76
  msgid "%d post included remote images processed."
77
  msgstr "已处理%d篇包含远程图像的文章。"
78
 
79
+ #: qqworld-auto-save-images.php:124
80
  #, php-format
81
  msgid "%d posts included remote images processed."
82
  msgstr "已处理%d篇包含远程图像的文章。"
83
 
84
+ #: qqworld-auto-save-images.php:125
85
  #, php-format
86
  msgid "%d post has missing images couldn't be processed."
87
  msgstr "%d篇包含不存在的远程图像的文章无法处理。"
88
 
89
+ #: qqworld-auto-save-images.php:126
90
  #, php-format
91
  msgid "%d posts have missing images couldn't be processed."
92
  msgstr "%d篇包含不存在的远程图像的文章无法处理。"
93
 
94
+ #: qqworld-auto-save-images.php:127
95
  #, php-format
96
  msgid "found %d post including remote images."
97
  msgstr "找到%d篇包含远程图像的文章。"
98
 
99
+ #: qqworld-auto-save-images.php:128
100
  #, php-format
101
  msgid "found %d posts including remote images."
102
  msgstr "找到%d篇包含远程图像的文章。"
103
 
104
+ #: qqworld-auto-save-images.php:129
105
  #, php-format
106
  msgid "And with %d post has missing images."
107
  msgstr "其中有%d篇文章包含不存在的远程图像。"
108
 
109
+ #: qqworld-auto-save-images.php:130
110
  #, php-format
111
  msgid "And with %d posts have missing images."
112
  msgstr "其中有%d篇文章包含不存在的远程图像。"
113
 
114
+ #: qqworld-auto-save-images.php:131
115
  msgid "No posts processed."
116
  msgstr "未处理任何文章。"
117
 
118
+ #: qqworld-auto-save-images.php:132
119
  msgid "No post has remote images found."
120
  msgstr "没有文章包含远程图像。"
121
 
122
+ #: qqworld-auto-save-images.php:133
123
  msgid "No posts found."
124
  msgstr "未找到任何文章。"
125
 
126
+ #: qqworld-auto-save-images.php:134
127
  msgid "All done."
128
  msgstr "全部完成。"
129
 
130
+ #: qqworld-auto-save-images.php:135
131
  msgid "Yes"
132
  msgstr ""
133
 
134
+ #: qqworld-auto-save-images.php:136 qqworld-auto-save-images.php:420
135
  msgid "No"
136
  msgstr ""
137
 
138
+ #: qqworld-auto-save-images.php:137
139
  msgid "Scanning..."
140
  msgstr "扫描中……"
141
 
142
+ #: qqworld-auto-save-images.php:138
143
  msgid "Listing..."
144
  msgstr "显示列表中……"
145
 
146
+ #: qqworld-auto-save-images.php:139
147
  msgid "ID"
148
  msgstr ""
149
 
150
+ #: qqworld-auto-save-images.php:140
151
  msgid "Post Type"
152
  msgstr "文章类型"
153
 
154
+ #: qqworld-auto-save-images.php:141
155
  msgid "Title"
156
  msgstr ""
157
 
158
+ #: qqworld-auto-save-images.php:142
159
  msgid "Status"
160
  msgstr ""
161
 
162
+ #: qqworld-auto-save-images.php:143
163
  msgid "Control"
164
  msgstr "控制"
165
 
166
+ #: qqworld-auto-save-images.php:144
167
  msgid "Done"
168
  msgstr ""
169
 
170
+ #: qqworld-auto-save-images.php:145 qqworld-auto-save-images.php:434
171
  msgid "Delete"
172
  msgstr ""
173
 
174
+ #: qqworld-auto-save-images.php:255 qqworld-auto-save-images.php:305
175
  msgid "Has missing images."
176
  msgstr "有不存在的远程图像。"
177
 
178
+ #: qqworld-auto-save-images.php:305
179
  msgid "Normal"
180
  msgstr "正常"
181
 
182
+ #: qqworld-auto-save-images.php:306
183
  msgid "Fetch"
184
  msgstr "抓取"
185
 
186
+ #: qqworld-auto-save-images.php:345
187
  msgid "Save Remote Images"
188
  msgstr "保存远程图片"
189
 
190
+ #: qqworld-auto-save-images.php:356 qqworld-auto-save-images.php:374
191
  msgid "Settings"
192
  msgstr ""
193
 
194
+ #: qqworld-auto-save-images.php:362 qqworld-auto-save-images.php:368
195
  msgid "QQWorld Auto Save Images"
196
  msgstr "QQWorld自动保存图片"
197
 
198
+ #: qqworld-auto-save-images.php:369
199
  msgid ""
200
  "Automatically keep the all remote picture to the local, and automatically "
201
  "set featured image."
202
  msgstr ""
203
  "自动保存远程图片到本地,自动设置特色图片,并且支持机器人采集软件从外部提交。"
204
 
205
+ #: qqworld-auto-save-images.php:375
206
+ msgid "Scan Posts"
207
+ msgstr "扫描文章"
208
+
209
+ #: qqworld-auto-save-images.php:381 qqworld-auto-save-images.php:383
210
  msgid "Mode"
211
  msgstr "模式"
212
 
213
+ #: qqworld-auto-save-images.php:386 qqworld-auto-save-images.php:416
214
+ #: qqworld-auto-save-images.php:501
215
  msgid "Automatic"
216
  msgstr "自动"
217
 
218
+ #: qqworld-auto-save-images.php:387
219
  msgid ""
220
  "Automatically save all remote images to local media libary when you save or "
221
  "publish post."
222
  msgstr "在保存或发布文章时,自动将所有远程图像保存到本地媒体库。"
223
 
224
+ #: qqworld-auto-save-images.php:390 qqworld-auto-save-images.php:502
225
  msgid "Manual"
226
  msgstr "手动"
227
 
228
+ #: qqworld-auto-save-images.php:391
229
  msgid ""
230
  "Manually save all remote images to local media libary when you click the "
231
  "button on the top of editor."
232
  msgstr "当单击编辑器顶部的按钮时,手动将所有远程图像保存到本地媒体库。"
233
 
234
+ #: qqworld-auto-save-images.php:396 qqworld-auto-save-images.php:398
235
  msgid "When"
236
  msgstr "什么时候"
237
 
238
+ #: qqworld-auto-save-images.php:401
239
  msgid "Save post (Publish, save draft or pedding review)."
240
  msgstr "保存文章时(发布文章,保存草稿或提交审核)。"
241
 
242
+ #: qqworld-auto-save-images.php:405
243
  msgid "Publish post only."
244
  msgstr "仅发布文章时。"
245
 
246
+ #: qqworld-auto-save-images.php:411 qqworld-auto-save-images.php:413
247
  msgid "Set Featured Image"
248
  msgstr "设置特色图片"
249
 
250
+ #: qqworld-auto-save-images.php:411
251
  msgid "Set first one of the remote images as featured image."
252
  msgstr "设置远程图片中的第1个为特色图片。"
253
 
254
+ #: qqworld-auto-save-images.php:426
255
  msgid "Exclude Domain/Keyword"
256
  msgstr "排除域名/关键词"
257
 
258
+ #: qqworld-auto-save-images.php:426
259
  msgid "Images will not be saved, if that url contains Exclude-Domain/Keyword."
260
  msgstr "如果图片地址包含排除域名/关键词,则不会保存该图片。"
261
 
262
+ #: qqworld-auto-save-images.php:428
263
  msgid "Exclude Domain"
264
  msgstr ""
265
 
266
+ #: qqworld-auto-save-images.php:438
267
  msgid "Add a Domain/Keyword"
268
  msgstr "添加域名/关键词"
269
 
270
+ #: qqworld-auto-save-images.php:451
 
 
 
 
271
  msgid "Select post types"
272
  msgstr "选择文章类型"
273
 
274
+ #: qqworld-auto-save-images.php:451
275
  msgid ""
276
  "If you have too many posts to be scan, sometimes in process looks like "
277
  "stopping, but it may be fake. please be patient."
279
  "如果有太多文章需要扫描,有时候在扫描过程中看起来像是停止了,但可能是假停止,"
280
  "请耐心等待。"
281
 
282
+ #: qqworld-auto-save-images.php:465
283
+ msgid "Categories"
284
+ msgstr ""
285
+
286
+ #: qqworld-auto-save-images.php:465
287
+ msgid "Default empty to scan all categories."
288
+ msgstr "默认留空扫描所有分类。"
289
+
290
+ #: qqworld-auto-save-images.php:470
291
  msgid "Scope of Post ID"
292
  msgstr "文章ID范围"
293
 
294
+ #: qqworld-auto-save-images.php:470
295
  msgid ""
296
  "Default empty for scan all posts ID. If you want to scan posts ID from 50 to "
297
  "100. please type '50' and '100' or '100' and '50', The order in which two "
302
  "者'100'和'50',两个数字的顺序可以颠倒。如果你只输入了1个数字,则系统只会扫描"
303
  "该ID。"
304
 
305
+ #: qqworld-auto-save-images.php:471
306
  #, php-format
307
  msgid "From %1$s to %2$s"
308
  msgstr "从 %1$s 到 %2$s"
309
 
310
+ #: qqworld-auto-save-images.php:475
311
  msgid "Offset"
312
  msgstr "偏移"
313
 
314
+ #: qqworld-auto-save-images.php:475
315
  msgid ""
316
  "Default scan all posts. If you want to scan 50-150 posts, please type '50' "
317
  "in the textfield and select '100'."
319
  "默认扫秒全部文章,如果想扫描50-150篇文章,请在文本框中输入“50”并在下拉菜单中"
320
  "选择“100”。"
321
 
322
+ #: qqworld-auto-save-images.php:477
323
  #, php-format
324
  msgid "Start from %s to Scan"
325
  msgstr "从 %s 开始扫描"
326
 
327
+ #: qqworld-auto-save-images.php:479
328
  msgid "All"
329
  msgstr ""
330
 
331
+ #: qqworld-auto-save-images.php:483
332
  msgid "Posts"
333
  msgstr ""
334
 
335
+ #: qqworld-auto-save-images.php:488
336
  msgid "Speed"
337
  msgstr "速度"
338
 
339
+ #: qqworld-auto-save-images.php:488
340
  msgid "If the server is too much stress may be appropriately reduced speed."
341
  msgstr "如果服务器压力过大,可以适当调低速度。"
342
 
343
+ #: qqworld-auto-save-images.php:501
344
  msgid ""
345
  "Scan posts and keep remote images in all posts to local media library. Maybe "
346
  "take a long time."
347
  msgstr "扫描所有的文章,将所有远程图片保存到本地,可能需要很长时间。"
348
 
349
+ #: qqworld-auto-save-images.php:502
350
  msgid ""
351
  "The list displayed will show you which posts including remote images, then "
352
  "you can keep them to local manually via click \"Fetch\" button."
354
  "显示的列表中将告诉你哪些文章包含远程图片,然后你可以通过点击“抓取”按钮手动保"
355
  "存。"
356
 
357
+ #: qqworld-auto-save-images.php:613
358
  msgid "Has Missing/Undownloadable images."
359
  msgstr "有 不存在/不可下载 的远程图像。"
360
 
361
+ #: qqworld-auto-save-images.php:620
362
  msgid "No remote images found."
363
  msgstr "没有远程图像。"
364
 
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.1
7
  Author: Michael Wang
8
  Author URI: http://www.qqworld.org
9
  Text Domain: qqworld_auto_save_images
@@ -37,6 +37,8 @@ class QQWorld_auto_save_images {
37
 
38
  add_action( 'wp_ajax_get_scan_list', array($this, 'get_scan_list') );
39
  add_action( 'wp_ajax_nopriv_get_scan_list', array($this, 'get_scan_list') );
 
 
40
  add_action( 'wp_ajax_save_remote_images_after_scan', array($this, 'save_remote_images_after_scan') );
41
  add_action( 'wp_ajax_nopriv_save_remote_images_after_scan', array($this, 'save_remote_images_after_scan') );
42
  add_action( 'wp_ajax_save_remote_images_list_all_posts', array($this, 'save_remote_images_list_all_posts') );
@@ -53,6 +55,22 @@ class QQWorld_auto_save_images {
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 );
@@ -134,7 +152,26 @@ class QQWorld_auto_save_images {
134
 
135
  public function get_scan_list() {
136
  if ( !current_user_can( 'manage_options' ) ) return;
 
 
 
137
  $post_types = isset($_REQUEST['qqworld_auto_save_imagess_post_types']) ? $_REQUEST['qqworld_auto_save_imagess_post_types'] : 'post';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  // Scope of ID
139
  $id_from = $_REQUEST['id_from'];
140
  $id_to = $_REQUEST['id_to'];
@@ -150,16 +187,20 @@ class QQWorld_auto_save_images {
150
  elseif ($id_from < $id_to) for ($s=$id_from; $s<=$id_to; $s++) $post__in[]=$s;
151
  elseif($id_from > $id_to) for ($s=$id_from; $s>=$id_to; $s--) $post__in[]=$s;
152
  }
 
 
153
  // Offset
154
  $offset = empty($_REQUEST['offset']) ? 0 : $_POST['offset'];
 
 
 
155
  $posts_per_page = $_REQUEST['posts_per_page'];
156
- $args = array(
157
- 'posts_per_page' => $posts_per_page,
158
- 'offset' => $offset,
159
- 'order' => 'ASC',
160
- 'post_type' => $post_types,
161
- 'post__in' => $post__in
162
- );
163
  $posts = get_posts($args);
164
  $result=array();
165
  foreach ($posts as $post) array_push($result, $post->ID);
@@ -327,129 +368,142 @@ class QQWorld_auto_save_images {
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">
338
- <th scope="row"><label><?php _e('Mode', 'qqworld_auto_save_images'); ?></label></th>
339
- <td><fieldset>
340
- <legend class="screen-reader-text"><span><?php _e('Mode', 'qqworld_auto_save_images'); ?></span></legend>
341
- <label for="auto">
342
- <input name="qqworld_auto_save_imagess_type" type="radio" id="auto" value="auto" <?php checked('auto', $this->type); ?> />
343
- <?php _e('Automatic', 'qqworld_auto_save_images'); ?>
344
- </label> <span class="icon help" title="<?php _e('Automatically save all remote images to local media libary when you save or publish post.', 'qqworld_auto_save_images'); ?>"></span><br />
345
- <label for="manual">
346
- <input name="qqworld_auto_save_imagess_type" type="radio" id="manual" value="manual" <?php checked('manual', $this->type); ?> />
347
- <?php _e('Manual', 'qqworld_auto_save_images'); ?>
348
- </label> <span class="icon help" title="<?php _e('Manually save all remote images to local media libary when you click the button on the top of editor.', 'qqworld_auto_save_images'); ?>"></span>
349
- </fieldset></td>
350
- </tr>
351
-
352
- <tr id="second_level" valign="top"<?php if ($this->type != 'auto') echo ' style="display: none;"'; ?>>
353
- <th scope="row"><label><?php _e('When', 'qqworld_auto_save_images'); ?></label></th>
354
- <td><fieldset>
355
- <legend class="screen-reader-text"><span><?php _e('When', 'qqworld_auto_save_images'); ?></span></legend>
356
- <label for="save">
357
- <input name="using_action" type="radio" id="save" value="save" <?php checked('save', $this->using_action); ?> />
358
- <?php _e('Save post (Publish, save draft or pedding review).', 'qqworld_auto_save_images'); ?>
359
- </label><br />
360
- <label for="publish">
361
- <input name="using_action" type="radio" id="publish" value="publish" <?php checked('publish', $this->using_action); ?> />
362
- <?php _e('Publish post only.', 'qqworld_auto_save_images'); ?>
363
- </label>
364
- </fieldset></td>
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); ?> />
377
- <?php _e('No'); ?>
378
- </label>
379
- </fieldset></td>
380
- </tr>
381
-
382
- <tr valign="top">
383
- <th scope="row"><label><?php _e('Exclude Domain/Keyword', 'qqworld_auto_save_images'); ?></label> <span class="icon help" title="<?php _e("Images will not be saved, if that url contains Exclude-Domain/Keyword.", 'qqworld_auto_save_images'); ?>"></span></th>
384
- <td><fieldset>
385
- <legend class="screen-reader-text"><span><?php _e('Exclude Domain', 'qqworld_auto_save_images'); ?></span></legend>
386
- <ul id="exclude_domain_list">
387
- <?php
388
- if (!empty($this->exclude_domain)) foreach ($this->exclude_domain as $domain) :
389
- if (!empty($domain)) :
390
- ?>
391
- <li><?php echo is_ssl() ? 'https://' : 'http://' ?> <input type="text" name="qqworld-auto-save-images-exclude-domain[]" class="regular-text" value="<?php echo $domain; ?>" /><input type="button" class="button delete-exclude-domain" value="<?php _e('Delete'); ?>"></li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
  }
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.7
7
  Author: Michael Wang
8
  Author URI: http://www.qqworld.org
9
  Text Domain: qqworld_auto_save_images
37
 
38
  add_action( 'wp_ajax_get_scan_list', array($this, 'get_scan_list') );
39
  add_action( 'wp_ajax_nopriv_get_scan_list', array($this, 'get_scan_list') );
40
+ add_action( 'wp_ajax_save_remote_images_get_categories_list', array($this, 'save_remote_images_get_categories_list') );
41
+ add_action( 'wp_ajax_nopriv_save_remote_images_get_categories_list', array($this, 'save_remote_images_get_categories_list') );
42
  add_action( 'wp_ajax_save_remote_images_after_scan', array($this, 'save_remote_images_after_scan') );
43
  add_action( 'wp_ajax_nopriv_save_remote_images_after_scan', array($this, 'save_remote_images_after_scan') );
44
  add_action( 'wp_ajax_save_remote_images_list_all_posts', array($this, 'save_remote_images_list_all_posts') );
55
  add_filter( 'post_updated_messages', array($this, 'post_updated_messages') );
56
  }
57
 
58
+ public function save_remote_images_get_categories_list() {
59
+ if (isset($_REQUEST['posttype']) && !empty($_REQUEST['posttype'])) {
60
+ $posttype = $_REQUEST['posttype'];
61
+ $taxonomies = get_object_taxonomies($posttype);
62
+ if (!empty($taxonomies)) foreach ($taxonomies as $tax) {
63
+ $taxonomy = get_taxonomy($tax);
64
+ echo '<div id="'.$tax.'div" post-type="'.$tax.'" class="postbox"><div class="hndle">'.$taxonomy->labels->name.'</div><div class="inside"><div id="'.$tax.'-all" class="tabs-panel"><ul>';
65
+ wp_terms_checklist('', array(
66
+ 'taxonomy' => $tax
67
+ ));
68
+ echo '</ul></div></div></div>';
69
+ } else _e('No taxonomies found.', 'qqworld_auto_save_images');
70
+ }
71
+ exit;
72
+ }
73
+
74
  public function post_updated_messages($messages) {
75
  global $post, $post_ID;
76
  $post_type = get_post_type( $post_ID );
152
 
153
  public function get_scan_list() {
154
  if ( !current_user_can( 'manage_options' ) ) return;
155
+ $args = array();
156
+
157
+ //post types
158
  $post_types = isset($_REQUEST['qqworld_auto_save_imagess_post_types']) ? $_REQUEST['qqworld_auto_save_imagess_post_types'] : 'post';
159
+ $args['post_type'] = $post_types;
160
+
161
+ //cagegory
162
+ if (isset($_REQUEST['terms']) && !empty($_REQUEST['terms'])) {
163
+ $terms = $_REQUEST['terms'];
164
+ $args['tax_query'] = array(
165
+ 'relation' => 'OR'
166
+ );
167
+ foreach ($terms as $taxonomy => $term_ids) {
168
+ $args['tax_query'][] = array(
169
+ 'taxonomy' => $taxonomy,
170
+ 'terms' => $term_ids,
171
+ 'field' => 'id'
172
+ );
173
+ }
174
+ }
175
  // Scope of ID
176
  $id_from = $_REQUEST['id_from'];
177
  $id_to = $_REQUEST['id_to'];
187
  elseif ($id_from < $id_to) for ($s=$id_from; $s<=$id_to; $s++) $post__in[]=$s;
188
  elseif($id_from > $id_to) for ($s=$id_from; $s>=$id_to; $s--) $post__in[]=$s;
189
  }
190
+ $args['post__in'] = $post__in;
191
+
192
  // Offset
193
  $offset = empty($_REQUEST['offset']) ? 0 : $_POST['offset'];
194
+ $args['offset'] = $offset;
195
+
196
+ // posts per page
197
  $posts_per_page = $_REQUEST['posts_per_page'];
198
+ $args['posts_per_page'] = $posts_per_page;
199
+
200
+ // order
201
+ $args['order'] = 'ASC';
202
+
203
+ //echo '<pre>'; print_r($args); echo '</pre>';
 
204
  $posts = get_posts($args);
205
  $result=array();
206
  foreach ($posts as $post) array_push($result, $post->ID);
368
  <div class="wrap">
369
  <h2><?php _e('QQWorld Auto Save Images', 'qqworld_auto_save_images'); ?></h2>
370
  <p><?php _e('Automatically keep the all remote picture to the local, and automatically set featured image.', 'qqworld_auto_save_images'); ?>
 
371
  <form action="options.php" method="post" id="form">
372
  <?php settings_fields('qqworld_auto_save_images_settings'); ?>
373
  <img src="https://ps.w.org/qqworld-auto-save-images/assets/banner-772x250.png" width="772" height="250" id="banner" />
374
+ <ul id="qqworld-auto-save-images-tabs">
375
+ <li class="current"><?php _e('Settings'); ?></li>
376
+ <li><?php _e('Scan Posts', 'qqworld_auto_save_images'); ?></li>
377
+ </ul>
378
+ <div class="tab-content">
379
+ <table class="form-table">
380
+ <tbody>
381
+ <tr valign="top">
382
+ <th scope="row"><label><?php _e('Mode', 'qqworld_auto_save_images'); ?></label></th>
383
+ <td><fieldset>
384
+ <legend class="screen-reader-text"><span><?php _e('Mode', 'qqworld_auto_save_images'); ?></span></legend>
385
+ <label for="auto">
386
+ <input name="qqworld_auto_save_imagess_type" type="radio" id="auto" value="auto" <?php checked('auto', $this->type); ?> />
387
+ <?php _e('Automatic', 'qqworld_auto_save_images'); ?>
388
+ </label> <span class="icon help" title="<?php _e('Automatically save all remote images to local media libary when you save or publish post.', 'qqworld_auto_save_images'); ?>"></span><br />
389
+ <label for="manual">
390
+ <input name="qqworld_auto_save_imagess_type" type="radio" id="manual" value="manual" <?php checked('manual', $this->type); ?> />
391
+ <?php _e('Manual', 'qqworld_auto_save_images'); ?>
392
+ </label> <span class="icon help" title="<?php _e('Manually save all remote images to local media libary when you click the button on the top of editor.', 'qqworld_auto_save_images'); ?>"></span>
393
+ </fieldset></td>
394
+ </tr>
395
+
396
+ <tr id="second_level" valign="top"<?php if ($this->type != 'auto') echo ' style="display: none;"'; ?>>
397
+ <th scope="row"><label><?php _e('When', 'qqworld_auto_save_images'); ?></label></th>
398
+ <td><fieldset>
399
+ <legend class="screen-reader-text"><span><?php _e('When', 'qqworld_auto_save_images'); ?></span></legend>
400
+ <label for="save">
401
+ <input name="using_action" type="radio" id="save" value="save" <?php checked('save', $this->using_action); ?> />
402
+ <?php _e('Save post (Publish, save draft or pedding review).', 'qqworld_auto_save_images'); ?>
403
+ </label><br />
404
+ <label for="publish">
405
+ <input name="using_action" type="radio" id="publish" value="publish" <?php checked('publish', $this->using_action); ?> />
406
+ <?php _e('Publish post only.', 'qqworld_auto_save_images'); ?>
407
+ </label>
408
+ </fieldset></td>
409
+ </tr>
410
+
411
+ <tr valign="top">
412
+ <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>
413
+ <td><fieldset>
414
+ <legend class="screen-reader-text"><span><?php _e('Set Featured Image', 'qqworld_auto_save_images'); ?></span></legend>
415
+ <label for="qqworld_auto_save_imagess_set_featured_image_yes">
416
+ <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); ?> />
417
+ <?php _e('Automatic', 'qqworld_auto_save_images'); ?>
418
+ </label><br />
419
+ <label for="qqworld_auto_save_imagess_set_featured_image_no">
420
+ <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); ?> />
421
+ <?php _e('No'); ?>
422
+ </label>
423
+ </fieldset></td>
424
+ </tr>
425
+
426
+ <tr valign="top">
427
+ <th scope="row"><label><?php _e('Exclude Domain/Keyword', 'qqworld_auto_save_images'); ?></label> <span class="icon help" title="<?php _e("Images will not be saved, if that url contains Exclude-Domain/Keyword.", 'qqworld_auto_save_images'); ?>"></span></th>
428
+ <td><fieldset>
429
+ <legend class="screen-reader-text"><span><?php _e('Exclude Domain', 'qqworld_auto_save_images'); ?></span></legend>
430
+ <ul id="exclude_domain_list">
431
+ <?php
432
+ if (!empty($this->exclude_domain)) foreach ($this->exclude_domain as $domain) :
433
+ if (!empty($domain)) :
434
+ ?>
435
+ <li><?php echo is_ssl() ? 'https://' : 'http://' ?> <input type="text" name="qqworld-auto-save-images-exclude-domain[]" class="regular-text" value="<?php echo $domain; ?>" /><input type="button" class="button delete-exclude-domain" value="<?php _e('Delete'); ?>"></li>
436
+ <?php endif;
437
+ endforeach; ?>
438
+ </ul>
439
+ <input type="button" id="add_exclude_domain" class="button" value="<?php _e('Add a Domain/Keyword', 'qqworld_auto_save_images');?>" />
440
+ </fieldset></td>
441
+ </tr>
442
+ </tbody>
443
+ </table>
444
+ <?php submit_button(); ?>
445
+ </div>
446
+ <div class="tab-content hidden">
447
+ <div id="scan-result"></div>
448
+ <div id="scan-post-block">
449
+ <table class="form-table">
450
+ <tbody>
451
+ <tr valign="top">
452
+ <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>
453
+ <td>
454
+ <?php $post_types = get_post_types('', 'objects'); ?>
455
+ <ul id="post_types_list">
456
+ <?php foreach ($post_types as $name => $post_type) :
457
+ if ( !in_array($name, array('attachment', 'revision', 'nav_menu_item') )) : ?>
458
+ <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>
459
  <?php endif;
460
+ endforeach;
461
+ ?></ul>
462
+ </td>
463
+ </tr>
464
+
465
+ <tr valign="top">
466
+ <th scope="row"><label><?php _e('Categories'); ?></label> <span class="icon help" title="<?php _e("Default empty to scan all categories.", 'qqworld_auto_save_images') ?>"></span></th>
467
+ <td id="categories_block"><?php _e('Please select post types.', 'qqworld_auto_save_images'); ?></td>
468
+ </tr>
469
+
470
+ <tr valign="top">
471
+ <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>
472
+ <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>
473
+ </tr>
474
+
475
+ <tr valign="top">
476
+ <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>
477
+ <td>
478
+ <?php printf(__('Start from %s to Scan', 'qqworld_auto_save_images'), '<input type="number" class="small-text" name="offset" value="0" disabled />'); ?>
479
+ <select name="posts_per_page">
480
+ <option value="-1"><?php _e('All'); ?></option>
481
+ <?php for ($i=1; $i<=10; $i++) : ?>
482
+ <option value="<?php echo $i*100; ?>"><?php echo $i*100; ?></option>
483
+ <?php endfor; ?>
484
+ </select> <?php _e('Posts'); ?>
485
+ </td>
486
+ </tr>
487
+
488
+ <tr valign="top">
489
+ <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>
490
+ <td>
491
+ <select name="speed">
492
+ <?php for ($i=1; $i<10; $i++) : ?>
493
+ <option value="<?php echo $i; ?>"><?php echo $i; ?></option>
494
+ <?php endfor; ?>
495
+ <option value="10" selected>10</option>
496
+ </select><br />
497
+ </td>
498
+ </tr>
499
+ </tbody>
500
+ </table>
501
+ <p class="submit">
502
+ <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>
503
+ <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>
504
+ </p>
505
+ </div>
506
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
507
  </form>
508
  <?php
509
  }