QQWorld Auto Save Images - Version 1.7.2

Version Description

Download this release

Release Info

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

Code changes from version 1.7.1 to 1.7.2

js/script-post.js CHANGED
@@ -1,6 +1,8 @@
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';
@@ -11,7 +13,7 @@ jQuery(function($) {
11
  switch (mode) {
12
  case 'text':
13
  $('#save-remote-images-button').data('noty', noty({
14
- text: QASI.in_process,
15
  type: 'notification',
16
  layout: 'center',
17
  modal: true,
@@ -28,26 +30,34 @@ jQuery(function($) {
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;
48
  case 'virtual':
49
  $('#save-remote-images-button').data('noty', noty({
50
- text: QASI.in_process,
51
  type: 'notification',
52
  layout: 'center',
53
  modal: true,
1
  jQuery(function($) {
2
  $(window).on('load', function() {
3
+ var noty_theme = typeof qqworld_ajax == 'object' ? 'qqworldTheme' : 'defaultTheme',
4
+ wait_img = '<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" />';
5
+
6
  $('.mce-i-save_remote_images').closest('.mce-widget').hide();
7
  $(document).on('click', '#save-remote-images-button', function() {
8
  var mode = 'text';
13
  switch (mode) {
14
  case 'text':
15
  $('#save-remote-images-button').data('noty', noty({
16
+ text: wait_img + ' &nbsp; ' + QASI.in_process,
17
  type: 'notification',
18
  layout: 'center',
19
  modal: true,
30
  content: encodeURI(encodeURI($('#content').val()))
31
  },
32
  success: function(respond) {
33
+ var options = {
 
 
 
 
 
 
34
  text: respond.msg,
 
35
  layout: 'center',
 
36
  theme: noty_theme
37
+ };
38
+ switch (respond.type) {
39
+ case 1:
40
+ options.type = 'warning';
41
+ options.timeout = 3000;
42
+ break;
43
+ case 2:
44
+ options.type = 'success';
45
+ options.timeout = 3000;
46
+ break;
47
+ case 3:
48
+ options.type = 'error';
49
+ options.modal = true;
50
+ break;
51
+ }
52
+ $('#save-remote-images-button').data('noty').close();
53
+ var n = noty(options);
54
  if (respond.content) $('#content').val(respond.content);
55
  }
56
  });
57
  break;
58
  case 'virtual':
59
  $('#save-remote-images-button').data('noty', noty({
60
+ text: wait_img + ' &nbsp; ' + QASI.in_process,
61
  type: 'notification',
62
  layout: 'center',
63
  modal: true,
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-14 19:51+0800\n"
6
- "PO-Revision-Date: 2014-10-14 19:51+0800\n"
7
  "Last-Translator: Michael Wang <admin@qqworld.org>\n"
8
  "Language-Team: QQWorld <admin@qqworld.org>\n"
9
  "Language: zh_CN\n"
@@ -25,237 +25,261 @@ msgstr ""
25
  msgid "Michael Wang"
26
  msgstr "王晓骞"
27
 
28
- #: qqworld-auto-save-images.php:71
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  msgid "No taxonomies found."
30
  msgstr "没有相关分类方法。"
31
 
32
- #: qqworld-auto-save-images.php:79 qqworld-auto-save-images.php:241
33
- #: qqworld-auto-save-images.php:617
34
  msgid "All remote images have been saved."
35
  msgstr "已保存所有远程图像。"
36
 
37
- #: qqworld-auto-save-images.php:79 qqworld-auto-save-images.php:80
38
  #, php-format
39
  msgid " <a href=\"%s\">View</a>"
40
  msgstr " <a href=\"%s\">查看</a>"
41
 
42
- #: qqworld-auto-save-images.php:80
43
  msgid "Has missing images or image which could not download."
44
  msgstr "内容包含 不存在/无法下载 的图像。"
45
 
46
- #: qqworld-auto-save-images.php:101
47
  msgid "In Process..."
48
  msgstr "正在保存……"
49
 
50
- #: qqworld-auto-save-images.php:121
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:122 qqworld-auto-save-images.php:443
57
  msgid "Please select post types."
58
  msgstr "请选择文章类型。"
59
 
60
- #: qqworld-auto-save-images.php:123
61
  msgid "May be a problem with some posts: "
62
  msgstr "也许一些文章有问题:"
63
 
64
- #: qqworld-auto-save-images.php:124
65
  #, php-format
66
  msgid "%d post has been scanned."
67
  msgstr "已扫描%d篇文章。"
68
 
69
- #: qqworld-auto-save-images.php:125
70
  #, php-format
71
  msgid "%d posts have been scanned."
72
  msgstr "已扫描%d篇文章。"
73
 
74
- #: qqworld-auto-save-images.php:126
75
  #, php-format
76
  msgid "%d post included remote images processed."
77
  msgstr "已处理%d篇包含远程图像的文章。"
78
 
79
- #: qqworld-auto-save-images.php:127
80
  #, php-format
81
  msgid "%d posts included remote images processed."
82
  msgstr "已处理%d篇包含远程图像的文章。"
83
 
84
- #: qqworld-auto-save-images.php:128
85
  #, php-format
86
  msgid "%d post has missing images couldn't be processed."
87
  msgstr "%d篇包含不存在的远程图像的文章无法处理。"
88
 
89
- #: qqworld-auto-save-images.php:129
90
  #, php-format
91
  msgid "%d posts have missing images couldn't be processed."
92
  msgstr "%d篇包含不存在的远程图像的文章无法处理。"
93
 
94
- #: qqworld-auto-save-images.php:130
95
  #, php-format
96
  msgid "found %d post including remote images."
97
  msgstr "找到%d篇包含远程图像的文章。"
98
 
99
- #: qqworld-auto-save-images.php:131
100
  #, php-format
101
  msgid "found %d posts including remote images."
102
  msgstr "找到%d篇包含远程图像的文章。"
103
 
104
- #: qqworld-auto-save-images.php:132
105
  #, php-format
106
  msgid "And with %d post has missing images."
107
  msgstr "其中有%d篇文章包含不存在的远程图像。"
108
 
109
- #: qqworld-auto-save-images.php:133
110
  #, php-format
111
  msgid "And with %d posts have missing images."
112
  msgstr "其中有%d篇文章包含不存在的远程图像。"
113
 
114
- #: qqworld-auto-save-images.php:134
115
  msgid "No posts processed."
116
  msgstr "未处理任何文章。"
117
 
118
- #: qqworld-auto-save-images.php:135
119
  msgid "No post has remote images found."
120
  msgstr "没有文章包含远程图像。"
121
 
122
- #: qqworld-auto-save-images.php:136
123
  msgid "No posts found."
124
  msgstr "未找到任何文章。"
125
 
126
- #: qqworld-auto-save-images.php:137
127
  msgid "All done."
128
  msgstr "全部完成。"
129
 
130
- #: qqworld-auto-save-images.php:138
131
  msgid "Yes"
132
  msgstr ""
133
 
134
- #: qqworld-auto-save-images.php:139
135
  msgid "No"
136
  msgstr ""
137
 
138
- #: qqworld-auto-save-images.php:140
139
  msgid "Scanning..."
140
  msgstr "扫描中……"
141
 
142
- #: qqworld-auto-save-images.php:141
143
  msgid "Listing..."
144
  msgstr "显示列表中……"
145
 
146
- #: qqworld-auto-save-images.php:142 qqworld-auto-save-images.php:485
147
  msgid "ID"
148
  msgstr ""
149
 
150
- #: qqworld-auto-save-images.php:143
151
  msgid "Post Type"
152
  msgstr "文章类型"
153
 
154
- #: qqworld-auto-save-images.php:144 qqworld-auto-save-images.php:487
155
  msgid "Title"
156
  msgstr ""
157
 
158
- #: qqworld-auto-save-images.php:145 qqworld-auto-save-images.php:465
159
  msgid "Status"
160
  msgstr ""
161
 
162
- #: qqworld-auto-save-images.php:146
163
  msgid "Control"
164
  msgstr "控制"
165
 
166
- #: qqworld-auto-save-images.php:147
167
  msgid "Done"
168
  msgstr ""
169
 
170
- #: qqworld-auto-save-images.php:148 qqworld-auto-save-images.php:409
171
  msgid "Delete"
172
  msgstr ""
173
 
174
- #: qqworld-auto-save-images.php:241 qqworld-auto-save-images.php:275
175
  msgid "Has missing images."
176
  msgstr "有不存在的远程图像。"
177
 
178
- #: qqworld-auto-save-images.php:275
179
  msgid "Normal"
180
  msgstr "正常"
181
 
182
- #: qqworld-auto-save-images.php:276
183
  msgid "Fetch"
184
  msgstr "抓取"
185
 
186
- #: qqworld-auto-save-images.php:315
187
  msgid "Save Remote Images"
188
  msgstr "保存远程图片"
189
 
190
- #: qqworld-auto-save-images.php:326 qqworld-auto-save-images.php:344
191
  msgid "Settings"
192
  msgstr ""
193
 
194
- #: qqworld-auto-save-images.php:332 qqworld-auto-save-images.php:338
195
  msgid "QQWorld Auto Save Images"
196
  msgstr "QQWorld自动保存图片"
197
 
198
- #: qqworld-auto-save-images.php:339
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:345
206
  msgid "Scan Posts"
207
  msgstr "扫描文章"
208
 
209
- #: qqworld-auto-save-images.php:351 qqworld-auto-save-images.php:353
210
  msgid "Mode"
211
  msgstr "模式"
212
 
213
- #: qqworld-auto-save-images.php:356 qqworld-auto-save-images.php:385
214
- #: qqworld-auto-save-images.php:395 qqworld-auto-save-images.php:523
 
215
  msgid "Automatic"
216
  msgstr "自动"
217
 
218
- #: qqworld-auto-save-images.php:357
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:360 qqworld-auto-save-images.php:524
225
  msgid "Manual"
226
  msgstr "手动"
227
 
228
- #: qqworld-auto-save-images.php:361
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:366 qqworld-auto-save-images.php:368
235
  msgid "When"
236
  msgstr "什么时候"
237
 
238
- #: qqworld-auto-save-images.php:371
239
  msgid "Save post (Publish, save draft or pedding review)."
240
  msgstr "保存文章时(发布文章,保存草稿或提交审核)。"
241
 
242
- #: qqworld-auto-save-images.php:375
243
  msgid "Publish post only."
244
  msgstr "仅发布文章时。"
245
 
246
- #: qqworld-auto-save-images.php:381 qqworld-auto-save-images.php:383
 
 
 
 
 
 
 
 
 
 
247
  msgid "Set Featured Image"
248
  msgstr "设置特色图片"
249
 
250
- #: qqworld-auto-save-images.php:381
251
  msgid "Set first one of the remote images as featured image."
252
  msgstr "设置远程图片中的第1个为特色图片。"
253
 
254
- #: qqworld-auto-save-images.php:391 qqworld-auto-save-images.php:393
255
  msgid "Change Image Filename"
256
  msgstr "更改图片文件名"
257
 
258
- #: qqworld-auto-save-images.php:391
259
  msgid ""
260
  "If you checked this, when the remote image filename have Chinese or other "
261
  "East Asian characters. system will automatically change image filename. I "
@@ -264,23 +288,23 @@ msgstr ""
264
  "如果勾选了此项,当远程图片名包含中文或其他东亚字符的时候,将自动更改图片文件"
265
  "名。建议开启。"
266
 
267
- #: qqworld-auto-save-images.php:401 qqworld-auto-save-images.php:403
268
  msgid "Exclude Domain/Keyword"
269
  msgstr "排除域名/关键词"
270
 
271
- #: qqworld-auto-save-images.php:401
272
  msgid "Images will not be saved, if that url contains Exclude-Domain/Keyword."
273
  msgstr "如果图片地址包含排除域名/关键词,则不会保存该图片。"
274
 
275
- #: qqworld-auto-save-images.php:413
276
  msgid "Add a Domain/Keyword"
277
  msgstr "添加域名/关键词"
278
 
279
- #: qqworld-auto-save-images.php:428
280
  msgid "Select post types"
281
  msgstr "选择文章类型"
282
 
283
- #: qqworld-auto-save-images.php:428
284
  msgid ""
285
  "If you have too many posts to be scan, sometimes in process looks like "
286
  "stopping, but it may be fake. please be patient."
@@ -288,19 +312,19 @@ msgstr ""
288
  "如果有太多文章需要扫描,有时候在扫描过程中看起来像是停止了,但可能是假停止,"
289
  "请耐心等待。"
290
 
291
- #: qqworld-auto-save-images.php:442
292
  msgid "Categories"
293
  msgstr ""
294
 
295
- #: qqworld-auto-save-images.php:442
296
  msgid "Default empty to scan all categories."
297
  msgstr "默认留空扫描所有分类。"
298
 
299
- #: qqworld-auto-save-images.php:447
300
  msgid "Scope of Post ID"
301
  msgstr "文章ID范围"
302
 
303
- #: qqworld-auto-save-images.php:447
304
  msgid ""
305
  "Default empty for scan all posts ID. If you want to scan posts ID from 50 to "
306
  "100. please type '50' and '100' or '100' and '50', The order in which two "
@@ -311,16 +335,16 @@ msgstr ""
311
  "者'100'和'50',两个数字的顺序可以颠倒。如果你只输入了1个数字,则系统只会扫描"
312
  "该ID。"
313
 
314
- #: qqworld-auto-save-images.php:448
315
  #, php-format
316
  msgid "From %1$s to %2$s"
317
  msgstr "从 %1$s 到 %2$s"
318
 
319
- #: qqworld-auto-save-images.php:452
320
  msgid "Offset"
321
  msgstr "偏移"
322
 
323
- #: qqworld-auto-save-images.php:452
324
  msgid ""
325
  "Default scan all posts. If you want to scan 50-150 posts, please type '50' "
326
  "in the textfield and select '100'."
@@ -328,62 +352,62 @@ msgstr ""
328
  "默认扫秒全部文章,如果想扫描50-150篇文章,请在文本框中输入“50”并在下拉菜单中"
329
  "选择“100”。"
330
 
331
- #: qqworld-auto-save-images.php:454
332
  #, php-format
333
  msgid "Start from %s to Scan"
334
  msgstr "从 %s 开始扫描"
335
 
336
- #: qqworld-auto-save-images.php:456
337
  msgid "All"
338
  msgstr ""
339
 
340
- #: qqworld-auto-save-images.php:460
341
  msgid "Posts"
342
  msgstr ""
343
 
344
- #: qqworld-auto-save-images.php:470
345
  msgid "Any"
346
  msgstr "任意"
347
 
348
- #: qqworld-auto-save-images.php:480
349
  msgid "Order By"
350
  msgstr "排序依据"
351
 
352
- #: qqworld-auto-save-images.php:486
353
  msgid "Author"
354
  msgstr ""
355
 
356
- #: qqworld-auto-save-images.php:488
357
  msgid "Date"
358
  msgstr ""
359
 
360
- #: qqworld-auto-save-images.php:490
 
 
 
 
361
  msgid "Comment Count"
362
  msgstr "评论数"
363
 
364
- #: qqworld-auto-save-images.php:489
365
- msgid "Last Modified)"
366
- msgstr ""
367
-
368
- #: qqworld-auto-save-images.php:500
369
  msgid "Order"
370
  msgstr ""
371
 
372
- #: qqworld-auto-save-images.php:510
373
  msgid "Speed"
374
  msgstr "速度"
375
 
376
- #: qqworld-auto-save-images.php:510
377
  msgid "If the server is too much stress may be appropriately reduced speed."
378
  msgstr "如果服务器压力过大,可以适当调低速度。"
379
 
380
- #: qqworld-auto-save-images.php:523
381
  msgid ""
382
  "Scan posts and keep remote images in all posts to local media library. Maybe "
383
  "take a long time."
384
  msgstr "扫描所有的文章,将所有远程图片保存到本地,可能需要很长时间。"
385
 
386
- #: qqworld-auto-save-images.php:524
387
  msgid ""
388
  "The list displayed will show you which posts including remote images, then "
389
  "you can keep them to local manually via click \"Fetch\" button."
@@ -391,11 +415,11 @@ msgstr ""
391
  "显示的列表中将告诉你哪些文章包含远程图片,然后你可以通过点击“抓取”按钮手动保"
392
  "存。"
393
 
394
- #: qqworld-auto-save-images.php:614
395
  msgid "Has Missing/Undownloadable images."
396
  msgstr "有 不存在/不可下载 的远程图像。"
397
 
398
- #: qqworld-auto-save-images.php:621
399
  msgid "No remote images found."
400
  msgstr "没有远程图像。"
401
 
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-15 11:42+0800\n"
6
+ "PO-Revision-Date: 2014-10-15 11:42+0800\n"
7
  "Last-Translator: Michael Wang <admin@qqworld.org>\n"
8
  "Language-Team: QQWorld <admin@qqworld.org>\n"
9
  "Language: zh_CN\n"
25
  msgid "Michael Wang"
26
  msgstr "王晓骞"
27
 
28
+ #: qqworld-auto-save-images.php:66
29
+ msgid "Notice:"
30
+ msgstr ""
31
+
32
+ #: qqworld-auto-save-images.php:67
33
+ #, php-format
34
+ msgid ""
35
+ "Ever since the QQWorld-Auto-Save-Image v1.7.2 released, the plugin core had "
36
+ "a big modification, please reset the <a href=\"%s\">settings</a>."
37
+ msgstr ""
38
+ "自动 QQWorld自动保存图片 v1.7.2发布,插件核心有较大更新,请重新<a href=\"%s"
39
+ "\">设置</a>。"
40
+
41
+ #: qqworld-auto-save-images.php:83
42
  msgid "No taxonomies found."
43
  msgstr "没有相关分类方法。"
44
 
45
+ #: qqworld-auto-save-images.php:91 qqworld-auto-save-images.php:256
46
+ #: qqworld-auto-save-images.php:639
47
  msgid "All remote images have been saved."
48
  msgstr "已保存所有远程图像。"
49
 
50
+ #: qqworld-auto-save-images.php:91 qqworld-auto-save-images.php:92
51
  #, php-format
52
  msgid " <a href=\"%s\">View</a>"
53
  msgstr " <a href=\"%s\">查看</a>"
54
 
55
+ #: qqworld-auto-save-images.php:92
56
  msgid "Has missing images or image which could not download."
57
  msgstr "内容包含 不存在/无法下载 的图像。"
58
 
59
+ #: qqworld-auto-save-images.php:113
60
  msgid "In Process..."
61
  msgstr "正在保存……"
62
 
63
+ #: qqworld-auto-save-images.php:133
64
  msgid ""
65
  "Are you sure?<br />Before you click the yes button, I recommend backup site "
66
  "database."
67
  msgstr "你确定吗?<br />在点击确定按钮之前,我建议你备份网站的数据库。"
68
 
69
+ #: qqworld-auto-save-images.php:134 qqworld-auto-save-images.php:468
70
  msgid "Please select post types."
71
  msgstr "请选择文章类型。"
72
 
73
+ #: qqworld-auto-save-images.php:135
74
  msgid "May be a problem with some posts: "
75
  msgstr "也许一些文章有问题:"
76
 
77
+ #: qqworld-auto-save-images.php:136
78
  #, php-format
79
  msgid "%d post has been scanned."
80
  msgstr "已扫描%d篇文章。"
81
 
82
+ #: qqworld-auto-save-images.php:137
83
  #, php-format
84
  msgid "%d posts have been scanned."
85
  msgstr "已扫描%d篇文章。"
86
 
87
+ #: qqworld-auto-save-images.php:138
88
  #, php-format
89
  msgid "%d post included remote images processed."
90
  msgstr "已处理%d篇包含远程图像的文章。"
91
 
92
+ #: qqworld-auto-save-images.php:139
93
  #, php-format
94
  msgid "%d posts included remote images processed."
95
  msgstr "已处理%d篇包含远程图像的文章。"
96
 
97
+ #: qqworld-auto-save-images.php:140
98
  #, php-format
99
  msgid "%d post has missing images couldn't be processed."
100
  msgstr "%d篇包含不存在的远程图像的文章无法处理。"
101
 
102
+ #: qqworld-auto-save-images.php:141
103
  #, php-format
104
  msgid "%d posts have missing images couldn't be processed."
105
  msgstr "%d篇包含不存在的远程图像的文章无法处理。"
106
 
107
+ #: qqworld-auto-save-images.php:142
108
  #, php-format
109
  msgid "found %d post including remote images."
110
  msgstr "找到%d篇包含远程图像的文章。"
111
 
112
+ #: qqworld-auto-save-images.php:143
113
  #, php-format
114
  msgid "found %d posts including remote images."
115
  msgstr "找到%d篇包含远程图像的文章。"
116
 
117
+ #: qqworld-auto-save-images.php:144
118
  #, php-format
119
  msgid "And with %d post has missing images."
120
  msgstr "其中有%d篇文章包含不存在的远程图像。"
121
 
122
+ #: qqworld-auto-save-images.php:145
123
  #, php-format
124
  msgid "And with %d posts have missing images."
125
  msgstr "其中有%d篇文章包含不存在的远程图像。"
126
 
127
+ #: qqworld-auto-save-images.php:146
128
  msgid "No posts processed."
129
  msgstr "未处理任何文章。"
130
 
131
+ #: qqworld-auto-save-images.php:147
132
  msgid "No post has remote images found."
133
  msgstr "没有文章包含远程图像。"
134
 
135
+ #: qqworld-auto-save-images.php:148
136
  msgid "No posts found."
137
  msgstr "未找到任何文章。"
138
 
139
+ #: qqworld-auto-save-images.php:149
140
  msgid "All done."
141
  msgstr "全部完成。"
142
 
143
+ #: qqworld-auto-save-images.php:150
144
  msgid "Yes"
145
  msgstr ""
146
 
147
+ #: qqworld-auto-save-images.php:151
148
  msgid "No"
149
  msgstr ""
150
 
151
+ #: qqworld-auto-save-images.php:152
152
  msgid "Scanning..."
153
  msgstr "扫描中……"
154
 
155
+ #: qqworld-auto-save-images.php:153
156
  msgid "Listing..."
157
  msgstr "显示列表中……"
158
 
159
+ #: qqworld-auto-save-images.php:154 qqworld-auto-save-images.php:510
160
  msgid "ID"
161
  msgstr ""
162
 
163
+ #: qqworld-auto-save-images.php:155
164
  msgid "Post Type"
165
  msgstr "文章类型"
166
 
167
+ #: qqworld-auto-save-images.php:156 qqworld-auto-save-images.php:512
168
  msgid "Title"
169
  msgstr ""
170
 
171
+ #: qqworld-auto-save-images.php:157 qqworld-auto-save-images.php:490
172
  msgid "Status"
173
  msgstr ""
174
 
175
+ #: qqworld-auto-save-images.php:158
176
  msgid "Control"
177
  msgstr "控制"
178
 
179
+ #: qqworld-auto-save-images.php:159
180
  msgid "Done"
181
  msgstr ""
182
 
183
+ #: qqworld-auto-save-images.php:160 qqworld-auto-save-images.php:434
184
  msgid "Delete"
185
  msgstr ""
186
 
187
+ #: qqworld-auto-save-images.php:256 qqworld-auto-save-images.php:290
188
  msgid "Has missing images."
189
  msgstr "有不存在的远程图像。"
190
 
191
+ #: qqworld-auto-save-images.php:290
192
  msgid "Normal"
193
  msgstr "正常"
194
 
195
+ #: qqworld-auto-save-images.php:291
196
  msgid "Fetch"
197
  msgstr "抓取"
198
 
199
+ #: qqworld-auto-save-images.php:330
200
  msgid "Save Remote Images"
201
  msgstr "保存远程图片"
202
 
203
+ #: qqworld-auto-save-images.php:341 qqworld-auto-save-images.php:359
204
  msgid "Settings"
205
  msgstr ""
206
 
207
+ #: qqworld-auto-save-images.php:347 qqworld-auto-save-images.php:353
208
  msgid "QQWorld Auto Save Images"
209
  msgstr "QQWorld自动保存图片"
210
 
211
+ #: qqworld-auto-save-images.php:354
212
  msgid ""
213
  "Automatically keep the all remote picture to the local, and automatically "
214
  "set featured image."
215
  msgstr ""
216
  "自动保存远程图片到本地,自动设置特色图片,并且支持机器人采集软件从外部提交。"
217
 
218
+ #: qqworld-auto-save-images.php:360
219
  msgid "Scan Posts"
220
  msgstr "扫描文章"
221
 
222
+ #: qqworld-auto-save-images.php:366 qqworld-auto-save-images.php:368
223
  msgid "Mode"
224
  msgstr "模式"
225
 
226
+ #: qqworld-auto-save-images.php:371 qqworld-auto-save-images.php:400
227
+ #: qqworld-auto-save-images.php:410 qqworld-auto-save-images.php:420
228
+ #: qqworld-auto-save-images.php:548
229
  msgid "Automatic"
230
  msgstr "自动"
231
 
232
+ #: qqworld-auto-save-images.php:372
233
  msgid ""
234
  "Automatically save all remote images to local media libary when you save or "
235
  "publish post."
236
  msgstr "在保存或发布文章时,自动将所有远程图像保存到本地媒体库。"
237
 
238
+ #: qqworld-auto-save-images.php:375 qqworld-auto-save-images.php:549
239
  msgid "Manual"
240
  msgstr "手动"
241
 
242
+ #: qqworld-auto-save-images.php:376
243
  msgid ""
244
  "Manually save all remote images to local media libary when you click the "
245
  "button on the top of editor."
246
  msgstr "当单击编辑器顶部的按钮时,手动将所有远程图像保存到本地媒体库。"
247
 
248
+ #: qqworld-auto-save-images.php:381 qqworld-auto-save-images.php:383
249
  msgid "When"
250
  msgstr "什么时候"
251
 
252
+ #: qqworld-auto-save-images.php:386
253
  msgid "Save post (Publish, save draft or pedding review)."
254
  msgstr "保存文章时(发布文章,保存草稿或提交审核)。"
255
 
256
+ #: qqworld-auto-save-images.php:390
257
  msgid "Publish post only."
258
  msgstr "仅发布文章时。"
259
 
260
+ #: qqworld-auto-save-images.php:396 qqworld-auto-save-images.php:398
261
+ msgid "Remote Publishing"
262
+ msgstr "远程发布"
263
+
264
+ #: qqworld-auto-save-images.php:396
265
+ msgid ""
266
+ "Save remote images via remote publishing from IFTTT or other way using "
267
+ "XMLRPC."
268
+ msgstr "保存通过IFTTT或其他使用XMLRPC方法远程发布的远程图片。"
269
+
270
+ #: qqworld-auto-save-images.php:406 qqworld-auto-save-images.php:408
271
  msgid "Set Featured Image"
272
  msgstr "设置特色图片"
273
 
274
+ #: qqworld-auto-save-images.php:406
275
  msgid "Set first one of the remote images as featured image."
276
  msgstr "设置远程图片中的第1个为特色图片。"
277
 
278
+ #: qqworld-auto-save-images.php:416 qqworld-auto-save-images.php:418
279
  msgid "Change Image Filename"
280
  msgstr "更改图片文件名"
281
 
282
+ #: qqworld-auto-save-images.php:416
283
  msgid ""
284
  "If you checked this, when the remote image filename have Chinese or other "
285
  "East Asian characters. system will automatically change image filename. I "
288
  "如果勾选了此项,当远程图片名包含中文或其他东亚字符的时候,将自动更改图片文件"
289
  "名。建议开启。"
290
 
291
+ #: qqworld-auto-save-images.php:426 qqworld-auto-save-images.php:428
292
  msgid "Exclude Domain/Keyword"
293
  msgstr "排除域名/关键词"
294
 
295
+ #: qqworld-auto-save-images.php:426
296
  msgid "Images will not be saved, if that url contains Exclude-Domain/Keyword."
297
  msgstr "如果图片地址包含排除域名/关键词,则不会保存该图片。"
298
 
299
+ #: qqworld-auto-save-images.php:438
300
  msgid "Add a Domain/Keyword"
301
  msgstr "添加域名/关键词"
302
 
303
+ #: qqworld-auto-save-images.php:453
304
  msgid "Select post types"
305
  msgstr "选择文章类型"
306
 
307
+ #: qqworld-auto-save-images.php:453
308
  msgid ""
309
  "If you have too many posts to be scan, sometimes in process looks like "
310
  "stopping, but it may be fake. please be patient."
312
  "如果有太多文章需要扫描,有时候在扫描过程中看起来像是停止了,但可能是假停止,"
313
  "请耐心等待。"
314
 
315
+ #: qqworld-auto-save-images.php:467
316
  msgid "Categories"
317
  msgstr ""
318
 
319
+ #: qqworld-auto-save-images.php:467
320
  msgid "Default empty to scan all categories."
321
  msgstr "默认留空扫描所有分类。"
322
 
323
+ #: qqworld-auto-save-images.php:472
324
  msgid "Scope of Post ID"
325
  msgstr "文章ID范围"
326
 
327
+ #: qqworld-auto-save-images.php:472
328
  msgid ""
329
  "Default empty for scan all posts ID. If you want to scan posts ID from 50 to "
330
  "100. please type '50' and '100' or '100' and '50', The order in which two "
335
  "者'100'和'50',两个数字的顺序可以颠倒。如果你只输入了1个数字,则系统只会扫描"
336
  "该ID。"
337
 
338
+ #: qqworld-auto-save-images.php:473
339
  #, php-format
340
  msgid "From %1$s to %2$s"
341
  msgstr "从 %1$s 到 %2$s"
342
 
343
+ #: qqworld-auto-save-images.php:477
344
  msgid "Offset"
345
  msgstr "偏移"
346
 
347
+ #: qqworld-auto-save-images.php:477
348
  msgid ""
349
  "Default scan all posts. If you want to scan 50-150 posts, please type '50' "
350
  "in the textfield and select '100'."
352
  "默认扫秒全部文章,如果想扫描50-150篇文章,请在文本框中输入“50”并在下拉菜单中"
353
  "选择“100”。"
354
 
355
+ #: qqworld-auto-save-images.php:479
356
  #, php-format
357
  msgid "Start from %s to Scan"
358
  msgstr "从 %s 开始扫描"
359
 
360
+ #: qqworld-auto-save-images.php:481
361
  msgid "All"
362
  msgstr ""
363
 
364
+ #: qqworld-auto-save-images.php:485
365
  msgid "Posts"
366
  msgstr ""
367
 
368
+ #: qqworld-auto-save-images.php:495
369
  msgid "Any"
370
  msgstr "任意"
371
 
372
+ #: qqworld-auto-save-images.php:505
373
  msgid "Order By"
374
  msgstr "排序依据"
375
 
376
+ #: qqworld-auto-save-images.php:511
377
  msgid "Author"
378
  msgstr ""
379
 
380
+ #: qqworld-auto-save-images.php:513
381
  msgid "Date"
382
  msgstr ""
383
 
384
+ #: qqworld-auto-save-images.php:514
385
+ msgid "Last Modified"
386
+ msgstr ""
387
+
388
+ #: qqworld-auto-save-images.php:515
389
  msgid "Comment Count"
390
  msgstr "评论数"
391
 
392
+ #: qqworld-auto-save-images.php:525
 
 
 
 
393
  msgid "Order"
394
  msgstr ""
395
 
396
+ #: qqworld-auto-save-images.php:535
397
  msgid "Speed"
398
  msgstr "速度"
399
 
400
+ #: qqworld-auto-save-images.php:535
401
  msgid "If the server is too much stress may be appropriately reduced speed."
402
  msgstr "如果服务器压力过大,可以适当调低速度。"
403
 
404
+ #: qqworld-auto-save-images.php:548
405
  msgid ""
406
  "Scan posts and keep remote images in all posts to local media library. Maybe "
407
  "take a long time."
408
  msgstr "扫描所有的文章,将所有远程图片保存到本地,可能需要很长时间。"
409
 
410
+ #: qqworld-auto-save-images.php:549
411
  msgid ""
412
  "The list displayed will show you which posts including remote images, then "
413
  "you can keep them to local manually via click \"Fetch\" button."
415
  "显示的列表中将告诉你哪些文章包含远程图片,然后你可以通过点击“抓取”按钮手动保"
416
  "存。"
417
 
418
+ #: qqworld-auto-save-images.php:636
419
  msgid "Has Missing/Undownloadable images."
420
  msgstr "有 不存在/不可下载 的远程图像。"
421
 
422
+ #: qqworld-auto-save-images.php:643
423
  msgid "No remote images found."
424
  msgstr "没有远程图像。"
425
 
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.7.1
7
  Author: Michael Wang
8
  Author URI: http://www.qqworld.org
9
  Text Domain: qqworld_auto_save_images
@@ -12,18 +12,19 @@ define('QQWORLD_AUTO_SAVE_IMAGES_DIR', __DIR__ . DIRECTORY_SEPARATOR);
12
  define('QQWORLD_AUTO_SAVE_IMAGES_URL', plugin_dir_url(__FILE__));
13
 
14
  class QQWorld_auto_save_images {
15
- var $using_action;
16
  var $type;
 
17
  var $change_image_name;
18
- var $preg = '/<img.*?src=[\"\']((?![\"\']).*?)[\"\']/i';
19
  var $has_remote_image;
20
  var $has_missing_image;
21
  var $exclude_domain;
22
  function __construct() {
23
  __('Michael Wang', 'qqworld_auto_save_images');
24
- $this->using_action = get_option('using_action', 'publish');
25
- $this->type = get_option('qqworld_auto_save_imagess_type', 'auto');
26
- $this->featured_image = get_option('qqworld_auto_save_imagess_set_featured_image', 'yes');
 
27
  $this->change_image_name = get_option('qqworld_auto_save_images_auto_change_name', 'yes');
28
  $this->exclude_domain = get_option('qqworld-auto-save-images-exclude-domain');
29
  switch ($this->type) {
@@ -36,6 +37,7 @@ class QQWorld_auto_save_images {
36
  add_action( 'wp_ajax_nopriv_save_remote_images', array($this, 'save_remote_images') );
37
  break;
38
  }
 
39
 
40
  add_action( 'wp_ajax_get_scan_list', array($this, 'get_scan_list') );
41
  add_action( 'wp_ajax_nopriv_get_scan_list', array($this, 'get_scan_list') );
@@ -55,6 +57,17 @@ class QQWorld_auto_save_images {
55
  add_action( 'admin_enqueue_scripts', array($this, 'add_to_page_qqworld_auto_save_images') );
56
 
57
  add_filter( 'post_updated_messages', array($this, 'post_updated_messages') );
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
 
60
  public function save_remote_images_get_categories_list() {
@@ -314,6 +327,9 @@ class QQWorld_auto_save_images {
314
  ul[id^="noty_"] li {
315
  margin-bottom: 0;
316
  }
 
 
 
317
  </style>
318
  <a href="javascript:" id="save-remote-images-button" class="button save_remote_images" title="<?php _e('Save Remote Images', 'qqworld_auto_save_images'); ?>"><span class="wp-media-buttons-icon"></span><?php _e('Save Remote Images', 'qqworld_auto_save_images'); ?></a>
319
  <?php
@@ -355,11 +371,11 @@ class QQWorld_auto_save_images {
355
  <td><fieldset>
356
  <legend class="screen-reader-text"><span><?php _e('Mode', 'qqworld_auto_save_images'); ?></span></legend>
357
  <label for="auto">
358
- <input name="qqworld_auto_save_imagess_type" type="radio" id="auto" value="auto" <?php checked('auto', $this->type); ?> />
359
  <?php _e('Automatic', 'qqworld_auto_save_images'); ?>
360
  </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 />
361
  <label for="manual">
362
- <input name="qqworld_auto_save_imagess_type" type="radio" id="manual" value="manual" <?php checked('manual', $this->type); ?> />
363
  <?php _e('Manual', 'qqworld_auto_save_images'); ?>
364
  </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>
365
  </fieldset></td>
@@ -370,22 +386,32 @@ class QQWorld_auto_save_images {
370
  <td><fieldset>
371
  <legend class="screen-reader-text"><span><?php _e('When', 'qqworld_auto_save_images'); ?></span></legend>
372
  <label for="save">
373
- <input name="using_action" type="radio" id="save" value="save" <?php checked('save', $this->using_action); ?> />
374
  <?php _e('Save post (Publish, save draft or pedding review).', 'qqworld_auto_save_images'); ?>
375
  </label><br />
376
  <label for="publish">
377
- <input name="using_action" type="radio" id="publish" value="publish" <?php checked('publish', $this->using_action); ?> />
378
  <?php _e('Publish post only.', 'qqworld_auto_save_images'); ?>
379
  </label>
380
  </fieldset></td>
381
  </tr>
382
 
 
 
 
 
 
 
 
 
 
 
383
  <tr valign="top">
384
  <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>
385
  <td><fieldset>
386
  <legend class="screen-reader-text"><span><?php _e('Set Featured Image', 'qqworld_auto_save_images'); ?></span></legend>
387
- <label for="qqworld_auto_save_imagess_set_featured_image_yes">
388
- <input name="qqworld_auto_save_imagess_set_featured_image" type="checkbox" id="qqworld_auto_save_imagess_set_featured_image_yes" value="yes" <?php checked('yes', $this->featured_image); ?> /> <?php _e('Automatic', 'qqworld_auto_save_images'); ?>
389
  </label>
390
  </fieldset></td>
391
  </tr>
@@ -533,9 +559,10 @@ class QQWorld_auto_save_images {
533
  }
534
 
535
  function register_settings() {
536
- register_setting('qqworld_auto_save_images_settings', 'qqworld_auto_save_imagess_type');
537
- register_setting('qqworld_auto_save_images_settings', 'using_action');
538
- register_setting('qqworld_auto_save_images_settings', 'qqworld_auto_save_imagess_set_featured_image');
 
539
  register_setting('qqworld_auto_save_images_settings', 'qqworld_auto_save_images_auto_change_name');
540
  register_setting('qqworld_auto_save_images_settings', 'qqworld-auto-save-images-exclude-domain');
541
  }
@@ -573,18 +600,12 @@ class QQWorld_auto_save_images {
573
 
574
  function add_actions() {
575
  $post_type = $this->get_current_post_type();
576
- if ($post_type) {
577
- add_action($this->using_action.'_'.$post_type, array($this, 'fetch_images') );
578
- }
579
- add_action('xmlrpc_publish_post', array($this, 'fetch_images') );
580
  }
581
 
582
  function remove_actions() {
583
  $post_type = $this->get_current_post_type();
584
- if ($post_type) {
585
- remove_action($this->using_action.'_'.$post_type, array($this, 'fetch_images') );
586
- }
587
- remove_action('xmlrpc_publish_post', array($this, 'fetch_images') );
588
  }
589
 
590
  function utf8_urldecode($str) {
@@ -642,19 +663,22 @@ class QQWorld_auto_save_images {
642
 
643
  add_filter( 'redirect_post_location', array($this, 'redirect_post_location'), 10, 2);
644
 
645
- $this->remove_actions();
 
646
 
647
  $post = get_post($post_id);
648
  $content = $this->content_save_pre($post->post_content, $post_id);
649
  //Replace the image in the post
650
  wp_update_post(array('ID' => $post_id, 'post_content' => $content));
651
- $this->add_actions();
 
 
652
  }
653
 
654
  public function content_save_pre($content, $post_id=null) {
655
- $preg = preg_match_all($this->preg, stripslashes($content), $matches);
656
  if($preg){
657
- foreach($matches[1] as $image_url){
658
  if(empty($image_url)) continue;
659
  // exclude domain
660
  $allow=true;
@@ -705,7 +729,7 @@ class QQWorld_auto_save_images {
705
  preg_match( '/(.*?)$/i', $filename, $match );
706
  $pos=strpos($image_url,'?'); // if has '?', md5()
707
  $img_name = $pos ? md5($match[0]) : $match[0];
708
- $img_name = $this->change_images_filename($img_name, $filetype);
709
  } else return false;
710
  } else {
711
  $img_name = $this->change_images_filename($match[1], $match[2]);
@@ -766,18 +790,18 @@ class QQWorld_auto_save_images {
766
 
767
  //insert attachment
768
  function insert_attachment($file,$id){
769
- $dirs=wp_upload_dir();
770
- $filetype=wp_check_filetype($file);
771
  $attachment=array(
772
- 'guid'=>$dirs['baseurl'].'/'._wp_relative_upload_path($file),
773
- 'post_mime_type'=>$filetype['type'],
774
- 'post_title'=>preg_replace('/\.[^.]+$/','',basename($file)),
775
- 'post_content'=>'',
776
- 'post_status'=>'inherit'
777
  );
778
- $attach_id=wp_insert_attachment($attachment,$file,$id);
779
- $attach_data=wp_generate_attachment_metadata($attach_id,$file);
780
- wp_update_attachment_metadata($attach_id,$attach_data);
781
  return $attach_id;
782
  }
783
  }
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.2
7
  Author: Michael Wang
8
  Author URI: http://www.qqworld.org
9
  Text Domain: qqworld_auto_save_images
12
  define('QQWORLD_AUTO_SAVE_IMAGES_URL', plugin_dir_url(__FILE__));
13
 
14
  class QQWorld_auto_save_images {
15
+ var $mode;
16
  var $type;
17
+ var $remote_publishing;
18
  var $change_image_name;
 
19
  var $has_remote_image;
20
  var $has_missing_image;
21
  var $exclude_domain;
22
  function __construct() {
23
  __('Michael Wang', 'qqworld_auto_save_images');
24
+ $this->mode = get_option('qqworld_auto_save_images_mode', 'publish');
25
+ $this->type = get_option('qqworld_auto_save_images_type', 'auto');
26
+ $this->remote_publishing = get_option('qqworld_auto_save_images_remote_publishing', 'yes');
27
+ $this->featured_image = get_option('qqworld_auto_save_images_set_featured_image', 'yes');
28
  $this->change_image_name = get_option('qqworld_auto_save_images_auto_change_name', 'yes');
29
  $this->exclude_domain = get_option('qqworld-auto-save-images-exclude-domain');
30
  switch ($this->type) {
37
  add_action( 'wp_ajax_nopriv_save_remote_images', array($this, 'save_remote_images') );
38
  break;
39
  }
40
+ if ($this->remote_publishing) add_action('xmlrpc_publish_post', array($this, 'fetch_images') );
41
 
42
  add_action( 'wp_ajax_get_scan_list', array($this, 'get_scan_list') );
43
  add_action( 'wp_ajax_nopriv_get_scan_list', array($this, 'get_scan_list') );
57
  add_action( 'admin_enqueue_scripts', array($this, 'add_to_page_qqworld_auto_save_images') );
58
 
59
  add_filter( 'post_updated_messages', array($this, 'post_updated_messages') );
60
+
61
+ if(get_option('using_action') && !get_option('qqworld_auto_save_images_mode')) add_action( 'admin_notices', array($this, 'error_correction') );
62
+ }
63
+
64
+ public function error_correction() {
65
+ ?>
66
+ <div class="error default-password-nag">
67
+ <p><strong><?php _e('Notice:'); ?></strong>
68
+ <?php printf(__("Ever since the QQWorld-Auto-Save-Image v1.7.2 released, the plugin core had a big modification, please reset the <a href=\"%s\">settings</a>.", 'qqworld_auto_save_images'), menu_page_url( 'qqworld-auto-save-images', 0 )); ?></p>
69
+ </div>
70
+ <?php
71
  }
72
 
73
  public function save_remote_images_get_categories_list() {
327
  ul[id^="noty_"] li {
328
  margin-bottom: 0;
329
  }
330
+ #noty_center_layout_container img {
331
+ vertical-align: middle;
332
+ }
333
  </style>
334
  <a href="javascript:" id="save-remote-images-button" class="button save_remote_images" title="<?php _e('Save Remote Images', 'qqworld_auto_save_images'); ?>"><span class="wp-media-buttons-icon"></span><?php _e('Save Remote Images', 'qqworld_auto_save_images'); ?></a>
335
  <?php
371
  <td><fieldset>
372
  <legend class="screen-reader-text"><span><?php _e('Mode', 'qqworld_auto_save_images'); ?></span></legend>
373
  <label for="auto">
374
+ <input name="qqworld_auto_save_images_type" type="radio" id="auto" value="auto" <?php checked('auto', $this->type); ?> />
375
  <?php _e('Automatic', 'qqworld_auto_save_images'); ?>
376
  </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 />
377
  <label for="manual">
378
+ <input name="qqworld_auto_save_images_type" type="radio" id="manual" value="manual" <?php checked('manual', $this->type); ?> />
379
  <?php _e('Manual', 'qqworld_auto_save_images'); ?>
380
  </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>
381
  </fieldset></td>
386
  <td><fieldset>
387
  <legend class="screen-reader-text"><span><?php _e('When', 'qqworld_auto_save_images'); ?></span></legend>
388
  <label for="save">
389
+ <input name="qqworld_auto_save_images_mode" type="radio" id="save" value="save" <?php checked('save', $this->mode); ?> />
390
  <?php _e('Save post (Publish, save draft or pedding review).', 'qqworld_auto_save_images'); ?>
391
  </label><br />
392
  <label for="publish">
393
+ <input name="qqworld_auto_save_images_mode" type="radio" id="publish" value="publish" <?php checked('publish', $this->mode); ?> />
394
  <?php _e('Publish post only.', 'qqworld_auto_save_images'); ?>
395
  </label>
396
  </fieldset></td>
397
  </tr>
398
 
399
+ <tr valign="top">
400
+ <th scope="row"><label><?php _e('Remote Publishing', 'qqworld_auto_save_images'); ?></label> <span class="icon help" title="<?php _e("Save remote images via remote publishing from IFTTT or other way using XMLRPC.", 'qqworld_auto_save_images'); ?>"></span></th>
401
+ <td><fieldset>
402
+ <legend class="screen-reader-text"><span><?php _e('Remote Publishing', 'qqworld_auto_save_images'); ?></span></legend>
403
+ <label for="qqworld_auto_save_images_remote_publishing">
404
+ <input name="qqworld_auto_save_images_remote_publishing" type="checkbox" id="qqworld_auto_save_images_remote_publishing" value="yes" <?php checked('yes', $this->remote_publishing); ?> /> <?php _e('Automatic', 'qqworld_auto_save_images'); ?>
405
+ </label>
406
+ </fieldset></td>
407
+ </tr>
408
+
409
  <tr valign="top">
410
  <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>
411
  <td><fieldset>
412
  <legend class="screen-reader-text"><span><?php _e('Set Featured Image', 'qqworld_auto_save_images'); ?></span></legend>
413
+ <label for="qqworld_auto_save_images_set_featured_image_yes">
414
+ <input name="qqworld_auto_save_images_set_featured_image" type="checkbox" id="qqworld_auto_save_images_set_featured_image_yes" value="yes" <?php checked('yes', $this->featured_image); ?> /> <?php _e('Automatic', 'qqworld_auto_save_images'); ?>
415
  </label>
416
  </fieldset></td>
417
  </tr>
559
  }
560
 
561
  function register_settings() {
562
+ register_setting('qqworld_auto_save_images_settings', 'qqworld_auto_save_images_type');
563
+ register_setting('qqworld_auto_save_images_settings', 'qqworld_auto_save_images_mode');
564
+ register_setting('qqworld_auto_save_images_settings', 'qqworld_auto_save_images_remote_publishing');
565
+ register_setting('qqworld_auto_save_images_settings', 'qqworld_auto_save_images_set_featured_image');
566
  register_setting('qqworld_auto_save_images_settings', 'qqworld_auto_save_images_auto_change_name');
567
  register_setting('qqworld_auto_save_images_settings', 'qqworld-auto-save-images-exclude-domain');
568
  }
600
 
601
  function add_actions() {
602
  $post_type = $this->get_current_post_type();
603
+ if ($post_type) add_action($this->mode.'_'.$post_type, array($this, 'fetch_images') );
 
 
 
604
  }
605
 
606
  function remove_actions() {
607
  $post_type = $this->get_current_post_type();
608
+ if ($post_type) remove_action($this->mode.'_'.$post_type, array($this, 'fetch_images') );
 
 
 
609
  }
610
 
611
  function utf8_urldecode($str) {
663
 
664
  add_filter( 'redirect_post_location', array($this, 'redirect_post_location'), 10, 2);
665
 
666
+ if ($this->type=='auto') $this->remove_actions();
667
+ if ($this->remote_publishing) remove_action('xmlrpc_publish_post', array($this, 'fetch_images') );
668
 
669
  $post = get_post($post_id);
670
  $content = $this->content_save_pre($post->post_content, $post_id);
671
  //Replace the image in the post
672
  wp_update_post(array('ID' => $post_id, 'post_content' => $content));
673
+
674
+ if ($this->type=='auto') $this->add_actions();
675
+ if ($this->remote_publishing) add_action('xmlrpc_publish_post', array($this, 'fetch_images') );
676
  }
677
 
678
  public function content_save_pre($content, $post_id=null) {
679
+ $preg = preg_match_all('/<img.*?src=[\"\']((?![\"\']).*?)[\"\']/i', stripslashes($content), $matches);
680
  if($preg){
681
+ foreach($matches[1] as $image_url) {
682
  if(empty($image_url)) continue;
683
  // exclude domain
684
  $allow=true;
729
  preg_match( '/(.*?)$/i', $filename, $match );
730
  $pos=strpos($image_url,'?'); // if has '?', md5()
731
  $img_name = $pos ? md5($match[0]) : $match[0];
732
+ $img_name = $this->change_images_filename($img_name, '.'.$filetype);
733
  } else return false;
734
  } else {
735
  $img_name = $this->change_images_filename($match[1], $match[2]);
790
 
791
  //insert attachment
792
  function insert_attachment($file,$id){
793
+ $dirs = wp_upload_dir();
794
+ $filetype = wp_check_filetype($file);
795
  $attachment=array(
796
+ 'guid' => $dirs['baseurl'].'/'._wp_relative_upload_path($file),
797
+ 'post_mime_type' => $filetype['type'],
798
+ 'post_title' => preg_replace('/\.[^.]+$/','',basename($file)),
799
+ 'post_content' => '',
800
+ 'post_status' => 'inherit'
801
  );
802
+ $attach_id = wp_insert_attachment($attachment, $file, $id);
803
+ $attach_data = wp_generate_attachment_metadata($attach_id, $file);
804
+ wp_update_attachment_metadata($attach_id, $attach_data);
805
  return $attach_id;
806
  }
807
  }