QQWorld Auto Save Images - Version 1.5.9

Version Description

Download this release

Release Info

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

Code changes from version 1.5.8 to 1.5.9

js/script.js CHANGED
@@ -360,7 +360,20 @@ QQWorld_auto_save_images.scan_posts = function() {
360
  },
361
  error: _this.action.catch_errors
362
  });
363
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  };
365
 
366
  this.create.init = function() {
360
  },
361
  error: _this.action.catch_errors
362
  });
363
+ });
364
+ $(document).on('click', '#add_exclude_domain', function() {
365
+ var code = $('<li>'+QASI.scheme+' <input type="text" name="qqworld-auto-save-images-exclude-domain[]" class="regular-text" value="" /><input type="button" class="button delete-exclude-domain" value="'+QASI.delete+'"></li>');
366
+ if (!$('#exclude_domain_list li').length || $('#exclude_domain_list li.empty').length) $('#exclude_domain_list').html(code);
367
+ else $('#exclude_domain_list').append(code);
368
+ code.hide().slideDown('fast');
369
+ });
370
+ $(document).on('click', '.delete-exclude-domain', function() {
371
+ var parent = $(this).parent();
372
+ parent.slideUp('fast', function() {
373
+ parent.remove();
374
+ 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>');
375
+ });
376
+ });
377
  };
378
 
379
  this.create.init = function() {
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: 2011-12-10 19:47:15+00:00\n"
6
- "PO-Revision-Date: 2014-10-08 13:38+0800\n"
7
  "Last-Translator: Michael Wang <admin@qqworld.org>\n"
8
  "Language-Team: QQWorld <admin@qqworld.org>\n"
9
  "Language: zh_CN\n"
@@ -13,171 +13,256 @@ msgstr ""
13
  "Plural-Forms: nplurals=1; plural=0;\n"
14
  "X-Generator: Poedit 1.6.9\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- msgid "QQWorld Auto Save Images"
18
- msgstr "QQWorld自动保存图片"
 
19
 
20
- msgid "Mode"
21
- msgstr "模式"
 
 
 
22
 
23
- msgid "Save Remote Images"
24
- msgstr "保存远程图片"
 
25
 
26
- msgid "When"
27
- msgstr "什么时候"
 
28
 
29
- msgid "Save post (Publish, save draft or pedding review)."
30
- msgstr "保存文章时(发布文章,保存草稿或提交审核)。"
 
 
31
 
32
- msgid "Publish post only."
33
- msgstr "仅发布文章时。"
 
 
34
 
35
- msgid "In Process..."
36
- msgstr "正在保存……"
 
 
37
 
38
- msgid "Successed save remote images"
39
- msgstr "成功保存远程图片"
 
 
40
 
41
- msgid ""
42
- "Automatically save all remote images to local media libary when you save or "
43
- "publish post."
44
- msgstr "在保存或发布文章时,自动将所有远程图像保存到本地媒体库。"
45
 
46
- msgid ""
47
- "Manually save all remote images to local media libary when you click the "
48
- "button on the top of editor."
49
- msgstr "当单击编辑器顶部的按钮时,手动将所有远程图像保存到本地媒体库。"
50
 
51
- msgid "Automatically Set Featured Image"
52
- msgstr "自动设置特色图片"
 
 
53
 
54
- msgid "Scan Posts"
55
- msgstr "扫描文章"
 
 
56
 
57
- msgid "Automatic"
58
- msgstr "自动"
 
 
59
 
60
- msgid "Manual"
61
- msgstr "手动"
 
 
62
 
63
- msgid ""
64
- "Are you sure?<br />Before you click the yes button, I recommend backup site "
65
- "database."
66
- msgstr "你确定吗?<br />在点击确定按钮之前,我建议你备份网站的数据库。"
67
 
68
- msgid ""
69
- "Scan posts and keep remote images in all posts to local media library. Maybe "
70
- "take a long time."
71
- msgstr "扫描所有的文章,将所有远程图片保存到本地,可能需要很长时间。"
 
 
 
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  msgid "Scanning..."
74
  msgstr "扫描中……"
75
 
 
76
  msgid "Listing..."
77
  msgstr "显示列表中……"
78
 
79
- msgid "Select post types:"
80
- msgstr "选择文章类型:"
81
-
82
- msgid "All done."
83
- msgstr "全部完成。"
84
 
 
85
  msgid "Post Type"
86
  msgstr "文章类型"
87
 
88
- msgid "Please select post types."
89
- msgstr "请选择文章类型。"
 
90
 
91
- msgid "Offset:"
92
- msgstr "偏移:"
 
93
 
94
- msgid "Start from %s to Scan"
95
- msgstr "从 %s 开始扫描"
 
96
 
97
- msgid ""
98
- "Default scan all posts. If you want to scan 50-150 posts, please type '50' "
99
- "in the textfield and select '100'."
100
  msgstr ""
101
- "默认扫秒全部文章,如果想扫描50-150篇文章,请在文本框中输入“50”并在下拉菜单中"
102
- "选择“100”。"
103
 
104
- msgid ""
105
- "If you have too many posts to be scan, sometimes in process looks like "
106
- "stopping, but it may be fake. please be patient."
107
  msgstr ""
108
- "如果有太多文章需要扫描,有时候在扫描过程中看起来像是停止了,但可能是假停止,"
109
- "请耐心等待。"
110
 
111
- msgid "Speed:"
112
- msgstr "速度:"
 
113
 
114
- msgid ""
115
- "The list displayed will show you which posts including remote images, then "
116
- "you can keep them to local manually via click \"Fetch\" button."
117
- msgstr ""
118
- "显示的列表中将告诉你哪些文章包含远程图片,然后你可以通过点击“抓取”按钮手动保"
119
- "存。"
 
120
 
 
121
  msgid "Fetch"
122
  msgstr "抓取"
123
 
124
- msgid "No post has remote images found."
125
- msgstr "没有文章包含远程图像。"
 
126
 
127
- msgid "No posts processed."
128
- msgstr "未处理任何文章。"
 
129
 
130
- msgid "Control"
131
- msgstr "控制"
 
132
 
133
- msgid "Normal"
134
- msgstr "正常"
 
135
 
136
- msgid "No posts found."
137
- msgstr "未找到任何文章。"
 
138
 
139
- msgid "Has missing images."
140
- msgstr "有不存在的远程图像。"
 
 
 
141
 
142
- msgid "All remote images have been saved."
143
- msgstr "已保存所有远程图像。"
 
144
 
145
- msgid "%d post has been scanned."
146
- msgstr "已扫描%d篇文章。"
 
 
 
147
 
148
- msgid "%d posts have been scanned."
149
- msgstr "已扫描%d篇文章。"
 
150
 
151
- msgid "%d post included remote images processed."
152
- msgstr "已处理%d篇包含远程图像的文章。"
 
153
 
154
- msgid "%d posts included remote images processed."
155
- msgstr "已处理%d篇包含远程图像的文章。"
 
156
 
157
- msgid "found %d post including remote images."
158
- msgstr "找到%d篇包含远程图像的文章。"
 
159
 
160
- msgid "found %d posts including remote images."
161
- msgstr "找到%d篇包含远程图像的文章。"
 
162
 
163
- msgid "And with %d post has missing images."
164
- msgstr "其中有%d篇文章包含不存在的远程图像。"
 
165
 
166
- msgid "And with %d posts have missing images."
167
- msgstr "其中有%d篇文章包含不存在的远程图像。"
 
168
 
169
- msgid "%d post has missing images couldn't be processed."
170
- msgstr "%d篇包含不存在的远程图像的文章无法处理。"
 
171
 
172
- msgid "%d posts have missing images couldn't be processed."
173
- msgstr "%d篇包含不存在的远程图像的文章无法处理。"
 
 
 
 
 
 
 
 
 
174
 
 
 
 
 
 
175
  msgid "Scope of Post ID:"
176
  msgstr "文章ID范围:"
177
 
 
 
178
  msgid "From %1$s to %2$s"
179
  msgstr "从 %1$s 到 %2$s"
180
 
 
181
  msgid ""
182
  "Default empty for scan all posts ID. If you want to scan posts ID from 50 to "
183
  "100. please type '50' and '100' or '100' and '50', The order in which two "
@@ -188,8 +273,58 @@ msgstr ""
188
  "者'100'和'50',两个数字的顺序可以颠倒。如果你只输入了1个数字,则系统只会扫描"
189
  "该ID。"
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  msgid "If the server is too much stress may be appropriately reduced speed."
192
  msgstr "如果服务器压力过大,可以适当调低速度。"
193
 
194
- msgid "May be a problem with some posts: "
195
- msgstr "也许一些文章有问题:"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  msgstr ""
3
  "Project-Id-Version: QQworld Auto Save Images\n"
4
  "Report-Msgid-Bugs-To: http://www.qqworld.org\n"
5
+ "POT-Creation-Date: 2014-10-11 11:50+0800\n"
6
+ "PO-Revision-Date: 2014-10-11 14:45+0800\n"
7
  "Last-Translator: Michael Wang <admin@qqworld.org>\n"
8
  "Language-Team: QQWorld <admin@qqworld.org>\n"
9
  "Language: zh_CN\n"
13
  "Plural-Forms: nplurals=1; plural=0;\n"
14
  "X-Generator: Poedit 1.6.9\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
17
+ "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
18
+ "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
19
+ "Plural-Forms: nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
20
+ "&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5);\n"
21
+ "X-Poedit-Basepath: ..\n"
22
+ "X-Poedit-SearchPath-0: .\n"
23
+
24
+ #: qqworld-auto-save-images.php:59
25
+ msgid "In Process..."
26
+ msgstr "正在保存……"
27
 
28
+ #: qqworld-auto-save-images.php:60
29
+ msgid "Successed save remote images"
30
+ msgstr "成功保存远程图片"
31
 
32
+ #: qqworld-auto-save-images.php:80
33
+ msgid ""
34
+ "Are you sure?<br />Before you click the yes button, I recommend backup site "
35
+ "database."
36
+ msgstr "你确定吗?<br />在点击确定按钮之前,我建议你备份网站的数据库。"
37
 
38
+ #: qqworld-auto-save-images.php:81
39
+ msgid "Please select post types."
40
+ msgstr "请选择文章类型。"
41
 
42
+ #: qqworld-auto-save-images.php:82
43
+ msgid "May be a problem with some posts: "
44
+ msgstr "也许一些文章有问题:"
45
 
46
+ #: qqworld-auto-save-images.php:83
47
+ #, php-format
48
+ msgid "%d post has been scanned."
49
+ msgstr "已扫描%d篇文章。"
50
 
51
+ #: qqworld-auto-save-images.php:84
52
+ #, php-format
53
+ msgid "%d posts have been scanned."
54
+ msgstr "已扫描%d篇文章。"
55
 
56
+ #: qqworld-auto-save-images.php:85
57
+ #, php-format
58
+ msgid "%d post included remote images processed."
59
+ msgstr "已处理%d篇包含远程图像的文章。"
60
 
61
+ #: qqworld-auto-save-images.php:86
62
+ #, php-format
63
+ msgid "%d posts included remote images processed."
64
+ msgstr "已处理%d篇包含远程图像的文章。"
65
 
66
+ #: qqworld-auto-save-images.php:87
67
+ #, php-format
68
+ msgid "%d post has missing images couldn't be processed."
69
+ msgstr "%d篇包含不存在的远程图像的文章无法处理。"
70
 
71
+ #: qqworld-auto-save-images.php:88
72
+ #, php-format
73
+ msgid "%d posts have missing images couldn't be processed."
74
+ msgstr "%d篇包含不存在的远程图像的文章无法处理。"
75
 
76
+ #: qqworld-auto-save-images.php:89
77
+ #, php-format
78
+ msgid "found %d post including remote images."
79
+ msgstr "找到%d篇包含远程图像的文章。"
80
 
81
+ #: qqworld-auto-save-images.php:90
82
+ #, php-format
83
+ msgid "found %d posts including remote images."
84
+ msgstr "找到%d篇包含远程图像的文章。"
85
 
86
+ #: qqworld-auto-save-images.php:91
87
+ #, php-format
88
+ msgid "And with %d post has missing images."
89
+ msgstr "其中有%d篇文章包含不存在的远程图像。"
90
 
91
+ #: qqworld-auto-save-images.php:92
92
+ #, php-format
93
+ msgid "And with %d posts have missing images."
94
+ msgstr "其中有%d篇文章包含不存在的远程图像。"
95
 
96
+ #: qqworld-auto-save-images.php:93
97
+ msgid "No posts processed."
98
+ msgstr "未处理任何文章。"
 
99
 
100
+ #: qqworld-auto-save-images.php:94
101
+ msgid "No post has remote images found."
102
+ msgstr "没有文章包含远程图像。"
103
+
104
+ #: qqworld-auto-save-images.php:95
105
+ msgid "No posts found."
106
+ msgstr "未找到任何文章。"
107
 
108
+ #: qqworld-auto-save-images.php:96
109
+ msgid "All done."
110
+ msgstr "全部完成。"
111
+
112
+ #: qqworld-auto-save-images.php:97 qqworld-auto-save-images.php:347
113
+ msgid "Yes"
114
+ msgstr ""
115
+
116
+ #: qqworld-auto-save-images.php:98 qqworld-auto-save-images.php:351
117
+ msgid "No"
118
+ msgstr ""
119
+
120
+ #: qqworld-auto-save-images.php:99
121
  msgid "Scanning..."
122
  msgstr "扫描中……"
123
 
124
+ #: qqworld-auto-save-images.php:100
125
  msgid "Listing..."
126
  msgstr "显示列表中……"
127
 
128
+ #: qqworld-auto-save-images.php:101
129
+ msgid "ID"
130
+ msgstr ""
 
 
131
 
132
+ #: qqworld-auto-save-images.php:102
133
  msgid "Post Type"
134
  msgstr "文章类型"
135
 
136
+ #: qqworld-auto-save-images.php:103
137
+ msgid "Title"
138
+ msgstr ""
139
 
140
+ #: qqworld-auto-save-images.php:104
141
+ msgid "Status"
142
+ msgstr ""
143
 
144
+ #: qqworld-auto-save-images.php:105
145
+ msgid "Control"
146
+ msgstr "控制"
147
 
148
+ #: qqworld-auto-save-images.php:106
149
+ msgid "Done"
 
150
  msgstr ""
 
 
151
 
152
+ #: qqworld-auto-save-images.php:107 qqworld-auto-save-images.php:365
153
+ msgid "Delete"
 
154
  msgstr ""
 
 
155
 
156
+ #: qqworld-auto-save-images.php:194 qqworld-auto-save-images.php:244
157
+ msgid "Has missing images."
158
+ msgstr "有不存在的远程图像。"
159
 
160
+ #: qqworld-auto-save-images.php:194
161
+ msgid "All remote images have been saved."
162
+ msgstr "已保存所有远程图像。"
163
+
164
+ #: qqworld-auto-save-images.php:244
165
+ msgid "Normal"
166
+ msgstr "正常"
167
 
168
+ #: qqworld-auto-save-images.php:245
169
  msgid "Fetch"
170
  msgstr "抓取"
171
 
172
+ #: qqworld-auto-save-images.php:281
173
+ msgid "Save Remote Images"
174
+ msgstr "保存远程图片"
175
 
176
+ #: qqworld-auto-save-images.php:292
177
+ msgid "Settings"
178
+ msgstr ""
179
 
180
+ #: qqworld-auto-save-images.php:298 qqworld-auto-save-images.php:304
181
+ msgid "QQWorld Auto Save Images"
182
+ msgstr "QQWorld自动保存图片"
183
 
184
+ #: qqworld-auto-save-images.php:312 qqworld-auto-save-images.php:314
185
+ msgid "Mode"
186
+ msgstr "模式"
187
 
188
+ #: qqworld-auto-save-images.php:317 qqworld-auto-save-images.php:410
189
+ msgid "Automatic"
190
+ msgstr "自动"
191
 
192
+ #: qqworld-auto-save-images.php:318
193
+ msgid ""
194
+ "Automatically save all remote images to local media libary when you save or "
195
+ "publish post."
196
+ msgstr "在保存或发布文章时,自动将所有远程图像保存到本地媒体库。"
197
 
198
+ #: qqworld-auto-save-images.php:321 qqworld-auto-save-images.php:413
199
+ msgid "Manual"
200
+ msgstr "手动"
201
 
202
+ #: qqworld-auto-save-images.php:322
203
+ msgid ""
204
+ "Manually save all remote images to local media libary when you click the "
205
+ "button on the top of editor."
206
+ msgstr "当单击编辑器顶部的按钮时,手动将所有远程图像保存到本地媒体库。"
207
 
208
+ #: qqworld-auto-save-images.php:327 qqworld-auto-save-images.php:329
209
+ msgid "When"
210
+ msgstr "什么时候"
211
 
212
+ #: qqworld-auto-save-images.php:332
213
+ msgid "Save post (Publish, save draft or pedding review)."
214
+ msgstr "保存文章时(发布文章,保存草稿或提交审核)。"
215
 
216
+ #: qqworld-auto-save-images.php:336
217
+ msgid "Publish post only."
218
+ msgstr "仅发布文章时。"
219
 
220
+ #: qqworld-auto-save-images.php:342 qqworld-auto-save-images.php:344
221
+ msgid "Automatically Set Featured Image"
222
+ msgstr "自动设置特色图片"
223
 
224
+ #: qqworld-auto-save-images.php:357
225
+ msgid "Exclude Domain/Keyword"
226
+ msgstr "排除域名/关键词"
227
 
228
+ #: qqworld-auto-save-images.php:357
229
+ msgid "Images will not be saved, if that url contains Exclude-Domain/Keyword."
230
+ msgstr "如果图片地址包含排除域名/关键词,则不会保存该图片。"
231
 
232
+ #: qqworld-auto-save-images.php:359
233
+ msgid "Exclude Domain"
234
+ msgstr ""
235
 
236
+ #: qqworld-auto-save-images.php:369
237
+ msgid "Add a Domain/Keyword"
238
+ msgstr "添加域名/关键词"
239
 
240
+ #: qqworld-auto-save-images.php:375 qqworld-auto-save-images.php:401
241
+ msgid "Scan Posts"
242
+ msgstr "扫描文章"
243
+
244
+ #: qqworld-auto-save-images.php:375
245
+ msgid ""
246
+ "If you have too many posts to be scan, sometimes in process looks like "
247
+ "stopping, but it may be fake. please be patient."
248
+ msgstr ""
249
+ "如果有太多文章需要扫描,有时候在扫描过程中看起来像是停止了,但可能是假停止,"
250
+ "请耐心等待。"
251
 
252
+ #: qqworld-auto-save-images.php:378
253
+ msgid "Select post types:"
254
+ msgstr "选择文章类型:"
255
+
256
+ #: qqworld-auto-save-images.php:389
257
  msgid "Scope of Post ID:"
258
  msgstr "文章ID范围:"
259
 
260
+ #: qqworld-auto-save-images.php:389
261
+ #, php-format
262
  msgid "From %1$s to %2$s"
263
  msgstr "从 %1$s 到 %2$s"
264
 
265
+ #: qqworld-auto-save-images.php:389
266
  msgid ""
267
  "Default empty for scan all posts ID. If you want to scan posts ID from 50 to "
268
  "100. please type '50' and '100' or '100' and '50', The order in which two "
273
  "者'100'和'50',两个数字的顺序可以颠倒。如果你只输入了1个数字,则系统只会扫描"
274
  "该ID。"
275
 
276
+ #: qqworld-auto-save-images.php:391
277
+ msgid "Offset:"
278
+ msgstr "偏移:"
279
+
280
+ #: qqworld-auto-save-images.php:391
281
+ #, php-format
282
+ msgid "Start from %s to Scan"
283
+ msgstr "从 %s 开始扫描"
284
+
285
+ #: qqworld-auto-save-images.php:393
286
+ msgid "All"
287
+ msgstr ""
288
+
289
+ #: qqworld-auto-save-images.php:397
290
+ msgid "Posts"
291
+ msgstr ""
292
+
293
+ #: qqworld-auto-save-images.php:397
294
+ msgid ""
295
+ "Default scan all posts. If you want to scan 50-150 posts, please type '50' "
296
+ "in the textfield and select '100'."
297
+ msgstr ""
298
+ "默认扫秒全部文章,如果想扫描50-150篇文章,请在文本框中输入“50”并在下拉菜单中"
299
+ "选择“100”。"
300
+
301
+ #: qqworld-auto-save-images.php:402
302
+ msgid "Speed:"
303
+ msgstr "速度:"
304
+
305
+ #: qqworld-auto-save-images.php:408
306
  msgid "If the server is too much stress may be appropriately reduced speed."
307
  msgstr "如果服务器压力过大,可以适当调低速度。"
308
 
309
+ #: qqworld-auto-save-images.php:411
310
+ msgid ""
311
+ "Scan posts and keep remote images in all posts to local media library. Maybe "
312
+ "take a long time."
313
+ msgstr "扫描所有的文章,将所有远程图片保存到本地,可能需要很长时间。"
314
+
315
+ #: qqworld-auto-save-images.php:414
316
+ msgid ""
317
+ "The list displayed will show you which posts including remote images, then "
318
+ "you can keep them to local manually via click \"Fetch\" button."
319
+ msgstr ""
320
+ "显示的列表中将告诉你哪些文章包含远程图片,然后你可以通过点击“抓取”按钮手动保"
321
+ "存。"
322
+
323
+ msgid ""
324
+ "Automatically keep the all remote picture to the local, and automatically "
325
+ "set featured image."
326
+ msgstr ""
327
+ "自动保存远程图片到本地,自动设置特色图片,并且支持机器人采集软件从外部提交。"
328
+
329
+ msgid "Michael Wang"
330
+ msgstr "王晓骞"
qqworld-auto-save-images.php CHANGED
@@ -2,10 +2,11 @@
2
  /*
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.5.8
7
  Author: Michael Wang
8
  Author URI: http://www.qqworld.org
 
9
  */
10
  define('QQWORLD_AUTO_SAVE_IMAGES_DIR', __DIR__ . DIRECTORY_SEPARATOR);
11
  define('QQWORLD_AUTO_SAVE_IMAGES_URL', plugin_dir_url(__FILE__));
@@ -14,10 +15,12 @@ class QQWorld_auto_save_images {
14
  var $using_action;
15
  var $type;
16
  var $preg = '/<img.*?src=[\"\']((?![\"\']).*?)((?![\"\'])\?.*?)?[\"\']/';
 
17
  function __construct() {
18
  $this->using_action = get_option('using_action', 'publish');
19
  $this->type = get_option('qqworld_auto_save_imagess_type', 'auto');
20
  $this->featured_image = get_option('qqworld_auto_save_imagess_set_featured_image', 'yes');
 
21
  switch ($this->type) {
22
  case 'auto':
23
  $this->add_actions();
@@ -101,7 +104,9 @@ class QQWorld_auto_save_images {
101
  'title' => __('Title'),
102
  'status' => __('Status'),
103
  'control' => __('Control', 'qqworld_auto_save_images'),
104
- 'done' => __('Done')
 
 
105
  );
106
  wp_localize_script('qqworld-auto-save-images-script', 'QASI', $translation_array, '3.0.0');
107
  }
@@ -158,13 +163,21 @@ class QQWorld_auto_save_images {
158
  if($preg){
159
  foreach($matches[1] as $image_url){
160
  if(empty($image_url)) continue;
161
- $pos=strpos($image_url,get_bloginfo('url'));
162
- if($pos===false){
163
- $has_remote_images = true;
164
- if ($res=$this->save_images($image_url,$post_id)) {
165
- $replace=$res['url'];
166
- $content=str_replace($image_url,$replace,$content);
167
- } else $has_not_exits_remote_images = true;
 
 
 
 
 
 
 
 
168
  }
169
  }
170
  }
@@ -206,10 +219,18 @@ class QQWorld_auto_save_images {
206
  if($preg){
207
  foreach($matches[1] as $image_url){
208
  if(empty($image_url)) continue;
209
- $pos=strpos($image_url,get_bloginfo('url'));
210
- if($pos===false) {
211
- $has_remote_images = true;
212
- $has_not_exits_remote_images = @!fopen( $image_url, 'r' );
 
 
 
 
 
 
 
 
213
  }
214
  }
215
  }
@@ -257,13 +278,16 @@ class QQWorld_auto_save_images {
257
  -ms-transform: scale(1.1);
258
  transform: scale(1.1);
259
  }
 
 
 
260
  </style>
261
  <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>
262
  <?php
263
  }
264
 
265
  public function load_language() {
266
- load_plugin_textdomain( 'qqworld_auto_save_images', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
267
  }
268
 
269
  function registerPluginLinks($links, $file) {
@@ -333,6 +357,24 @@ class QQWorld_auto_save_images {
333
  </fieldset></td>
334
  </tr>
335
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  <tr valign="top">
337
  <th scope="row"><label><?php _e('Scan Posts', 'qqworld_auto_save_images'); ?></label> <span class="icon help" title="<?php _e("If you have too many posts to be scan, sometimes in process looks like stopping, but it may be fake. please be patient.", 'qqworld_auto_save_images') ?>"></span></th>
338
  <td>
@@ -379,7 +421,7 @@ class QQWorld_auto_save_images {
379
  </tr>
380
  </tbody>
381
  </table>
382
- <p class="submit"><input type="submit" value="<?php _e('Save Changes') ?>" class="button-primary" name="Submit" /></p>
383
  </form>
384
  <?php
385
  }
@@ -388,6 +430,7 @@ class QQWorld_auto_save_images {
388
  register_setting('qqworld_auto_save_images_settings', 'qqworld_auto_save_imagess_type');
389
  register_setting('qqworld_auto_save_images_settings', 'using_action');
390
  register_setting('qqworld_auto_save_images_settings', 'qqworld_auto_save_imagess_set_featured_image');
 
391
  }
392
 
393
  /**
@@ -442,7 +485,7 @@ class QQWorld_auto_save_images {
442
  return html_entity_decode($str, null, 'UTF-8');
443
  }
444
 
445
- function save_remote_images() {
446
  set_time_limit(0);
447
  //Check to make sure function is not executed more than once on save
448
  if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
@@ -459,11 +502,19 @@ class QQWorld_auto_save_images {
459
  if($preg){
460
  foreach($matches[1] as $image_url){
461
  if(empty($image_url)) continue;
 
 
 
 
 
 
 
462
  $pos=strpos($image_url,get_bloginfo('url'));
463
- if($pos===false){
464
- if ($res=$this->save_images($image_url,$post_id)) {
465
- $replace=$res['url'];
466
- $content=str_replace($image_url,$replace,$content);
 
467
  }
468
  }
469
  }
@@ -473,7 +524,7 @@ class QQWorld_auto_save_images {
473
  exit;
474
  }
475
 
476
- function fetch_images($post_id) {
477
  set_time_limit(0);
478
  //Check to make sure function is not executed more than once on save
479
  if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
@@ -490,11 +541,19 @@ class QQWorld_auto_save_images {
490
  if($preg){
491
  foreach($matches[1] as $image_url){
492
  if(empty($image_url)) continue;
493
- $pos=strpos($image_url,get_bloginfo('url'));
494
- if($pos===false){
495
- if ($res=$this->save_images($image_url,$post_id)) {
496
- $replace=$res['url'];
497
- $content=str_replace($image_url,$replace,$content);
 
 
 
 
 
 
 
 
498
  }
499
  }
500
  }
2
  /*
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.5.9
7
  Author: Michael Wang
8
  Author URI: http://www.qqworld.org
9
+ Text Domain: qqworld_auto_save_images
10
  */
11
  define('QQWORLD_AUTO_SAVE_IMAGES_DIR', __DIR__ . DIRECTORY_SEPARATOR);
12
  define('QQWORLD_AUTO_SAVE_IMAGES_URL', plugin_dir_url(__FILE__));
15
  var $using_action;
16
  var $type;
17
  var $preg = '/<img.*?src=[\"\']((?![\"\']).*?)((?![\"\'])\?.*?)?[\"\']/';
18
+ var $exclude_domain;
19
  function __construct() {
20
  $this->using_action = get_option('using_action', 'publish');
21
  $this->type = get_option('qqworld_auto_save_imagess_type', 'auto');
22
  $this->featured_image = get_option('qqworld_auto_save_imagess_set_featured_image', 'yes');
23
+ $this->exclude_domain = get_option('qqworld-auto-save-images-exclude-domain');
24
  switch ($this->type) {
25
  case 'auto':
26
  $this->add_actions();
104
  'title' => __('Title'),
105
  'status' => __('Status'),
106
  'control' => __('Control', 'qqworld_auto_save_images'),
107
+ 'done' => __('Done'),
108
+ 'delete' => __('Delete'),
109
+ 'scheme' => is_ssl() ? 'https://' : 'http://'
110
  );
111
  wp_localize_script('qqworld-auto-save-images-script', 'QASI', $translation_array, '3.0.0');
112
  }
163
  if($preg){
164
  foreach($matches[1] as $image_url){
165
  if(empty($image_url)) continue;
166
+ // exclude domain
167
+ $allow=true;
168
+ if (!empty($this->exclude_domain)) foreach ($this->exclude_domain as $domain) {
169
+ $pos=strpos($image_url, $domain);
170
+ if($pos) $allow=false;
171
+ }
172
+ if ($allow) {
173
+ $pos=strpos($image_url,get_bloginfo('url'));
174
+ if($pos===false){
175
+ $has_remote_images = true;
176
+ if ($res=$this->save_images($image_url,$post_id)) {
177
+ $replace=$res['url'];
178
+ $content=str_replace($image_url,$replace,$content);
179
+ } else $has_not_exits_remote_images = true;
180
+ }
181
  }
182
  }
183
  }
219
  if($preg){
220
  foreach($matches[1] as $image_url){
221
  if(empty($image_url)) continue;
222
+ // exclude domain
223
+ $allow=true;
224
+ if (!empty($this->exclude_domain)) foreach ($this->exclude_domain as $domain) {
225
+ $pos=strpos($image_url, $domain);
226
+ if($pos) $allow=false;
227
+ }
228
+ if ($allow) {
229
+ $pos=strpos($image_url,get_bloginfo('url'));
230
+ if($pos===false) {
231
+ $has_remote_images = true;
232
+ $has_not_exits_remote_images = @!fopen( $image_url, 'r' );
233
+ }
234
  }
235
  }
236
  }
278
  -ms-transform: scale(1.1);
279
  transform: scale(1.1);
280
  }
281
+ ul[id^="noty_"] li {
282
+ margin-bottom: 0;
283
+ }
284
  </style>
285
  <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>
286
  <?php
287
  }
288
 
289
  public function load_language() {
290
+ load_plugin_textdomain( 'qqworld_auto_save_images', dirname( __FILE__ ) . '/lang' . 'lang', basename( dirname( __FILE__ ) ) . '/lang' );
291
  }
292
 
293
  function registerPluginLinks($links, $file) {
357
  </fieldset></td>
358
  </tr>
359
 
360
+ <tr valign="top">
361
+ <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>
362
+ <td><fieldset>
363
+ <legend class="screen-reader-text"><span><?php _e('Exclude Domain', 'qqworld_auto_save_images'); ?></span></legend>
364
+ <ul id="exclude_domain_list">
365
+ <?php
366
+ if (!empty($this->exclude_domain)) foreach ($this->exclude_domain as $domain) :
367
+ if (!empty($domain)) :
368
+ ?>
369
+ <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>
370
+ <?php endif;
371
+ endforeach; ?>
372
+ </ul>
373
+ <input type="button" id="add_exclude_domain" class="button button-primary" value="<?php _e('Add a Domain/Keyword', 'qqworld_auto_save_images');?>" />
374
+ </fieldset></td>
375
+ </tr>
376
+
377
+
378
  <tr valign="top">
379
  <th scope="row"><label><?php _e('Scan Posts', 'qqworld_auto_save_images'); ?></label> <span class="icon help" title="<?php _e("If you have too many posts to be scan, sometimes in process looks like stopping, but it may be fake. please be patient.", 'qqworld_auto_save_images') ?>"></span></th>
380
  <td>
421
  </tr>
422
  </tbody>
423
  </table>
424
+ <?php submit_button(); ?>
425
  </form>
426
  <?php
427
  }
430
  register_setting('qqworld_auto_save_images_settings', 'qqworld_auto_save_imagess_type');
431
  register_setting('qqworld_auto_save_images_settings', 'using_action');
432
  register_setting('qqworld_auto_save_images_settings', 'qqworld_auto_save_imagess_set_featured_image');
433
+ register_setting('qqworld_auto_save_images_settings', 'qqworld-auto-save-images-exclude-domain');
434
  }
435
 
436
  /**
485
  return html_entity_decode($str, null, 'UTF-8');
486
  }
487
 
488
+ function save_remote_images() { // for manual mode
489
  set_time_limit(0);
490
  //Check to make sure function is not executed more than once on save
491
  if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
502
  if($preg){
503
  foreach($matches[1] as $image_url){
504
  if(empty($image_url)) continue;
505
+ // exclude domain
506
+ $allow=true;
507
+ if (!empty($this->exclude_domain)) foreach ($this->exclude_domain as $domain) {
508
+ $pos=strpos($image_url, $domain);
509
+ if($pos) $allow=false;
510
+ }
511
+ if ($allow) {
512
  $pos=strpos($image_url,get_bloginfo('url'));
513
+ if($pos===false){
514
+ if ($res=$this->save_images($image_url,$post_id)) {
515
+ $replace=$res['url'];
516
+ $content=str_replace($image_url,$replace,$content);
517
+ }
518
  }
519
  }
520
  }
524
  exit;
525
  }
526
 
527
+ function fetch_images($post_id) { // for automatic mode
528
  set_time_limit(0);
529
  //Check to make sure function is not executed more than once on save
530
  if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
541
  if($preg){
542
  foreach($matches[1] as $image_url){
543
  if(empty($image_url)) continue;
544
+ // exclude domain
545
+ $allow=true;
546
+ if (!empty($this->exclude_domain)) foreach ($this->exclude_domain as $domain) {
547
+ $pos=strpos($image_url, $domain);
548
+ if($pos) $allow=false;
549
+ }
550
+ if ($allow) {
551
+ $pos=strpos($image_url,get_bloginfo('url'));
552
+ if($pos===false){
553
+ if ($res=$this->save_images($image_url,$post_id)) {
554
+ $replace=$res['url'];
555
+ $content=str_replace($image_url,$replace,$content);
556
+ }
557
  }
558
  }
559
  }