Version Description
Download this release
Release Info
Developer | qqworld |
Plugin | QQWorld Auto Save Images |
Version | 1.7.1 |
Comparing to | |
See all releases |
Code changes from version 1.7 to 1.7.1
- css/style.css +5 -1
- js/script.js +7 -7
- lang/qqworld_auto_save_images-zh_CN.mo +0 -0
- lang/qqworld_auto_save_images-zh_CN.po +121 -80
- qqworld-auto-save-images.php +118 -94
css/style.css
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
#qqworld-auto-save-images-tabs {
|
2 |
height: 40px;
|
3 |
margin-top: 35px;
|
@@ -30,7 +34,7 @@
|
|
30 |
color: #333;
|
31 |
position: relative;
|
32 |
top: 1px;
|
33 |
-
height:
|
34 |
line-height: 40px;
|
35 |
border-bottom: none;
|
36 |
background: #f1f1f1;
|
1 |
+
#noty_center_layout_container img {
|
2 |
+
vertical-align: middle;
|
3 |
+
}
|
4 |
+
|
5 |
#qqworld-auto-save-images-tabs {
|
6 |
height: 40px;
|
7 |
margin-top: 35px;
|
34 |
color: #333;
|
35 |
position: relative;
|
36 |
top: 1px;
|
37 |
+
height: 43px;
|
38 |
line-height: 40px;
|
39 |
border-bottom: none;
|
40 |
background: #f1f1f1;
|
js/script.js
CHANGED
@@ -2,7 +2,8 @@ if (!QQWorld_auto_save_images) var QQWorld_auto_save_images = {};
|
|
2 |
QQWorld_auto_save_images.scan_posts = function() {
|
3 |
var _this = this,
|
4 |
$ = jQuery,
|
5 |
-
noty_theme = typeof qqworld_ajax == 'object' ? 'qqworldTheme' : 'defaultTheme'
|
|
|
6 |
|
7 |
this.lib = {};
|
8 |
this.lib.sprintf = function() {
|
@@ -83,7 +84,6 @@ QQWorld_auto_save_images.scan_posts = function() {
|
|
83 |
}
|
84 |
error += '<br />' + textStatus + ': ' + errorThrown;
|
85 |
error += '</div>';
|
86 |
-
$('#form').slideDown('slow');
|
87 |
$('body').data('noty').close();
|
88 |
noty({
|
89 |
text: error,
|
@@ -282,7 +282,7 @@ QQWorld_auto_save_images.scan_posts = function() {
|
|
282 |
$noty.close();
|
283 |
$('#scan_old_posts').attr('disabled', true);
|
284 |
$('#list_all_posts').attr('disabled', true);
|
285 |
-
var data = $('#
|
286 |
$.ajax({
|
287 |
type: 'POST',
|
288 |
url: ajaxurl,
|
@@ -301,7 +301,7 @@ QQWorld_auto_save_images.scan_posts = function() {
|
|
301 |
\ </tbody>\
|
302 |
\</table>');
|
303 |
$('body').data('noty', noty({
|
304 |
-
text: QASI.scanning,
|
305 |
type: 'notification',
|
306 |
layout: 'center',
|
307 |
dismissQueue: true,
|
@@ -329,7 +329,7 @@ QQWorld_auto_save_images.scan_posts = function() {
|
|
329 |
$('#scan-post-block').slideUp('normal');
|
330 |
$('#scan_old_posts').attr('disabled', true);
|
331 |
$('#list_all_posts').attr('disabled', true);
|
332 |
-
var data = $('#
|
333 |
console.log(data);
|
334 |
$.ajax({
|
335 |
type: 'POST',
|
@@ -350,7 +350,7 @@ QQWorld_auto_save_images.scan_posts = function() {
|
|
350 |
\ </tbody>\
|
351 |
\</table>');
|
352 |
$('body').data('noty', noty({
|
353 |
-
text: QASI.listing,
|
354 |
type: 'notification',
|
355 |
layout: 'center',
|
356 |
dismissQueue: true,
|
@@ -402,7 +402,7 @@ QQWorld_auto_save_images.scan_posts = function() {
|
|
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(
|
406 |
var temp = '';
|
407 |
checked.each(function() {
|
408 |
temp += '&posttype[]=' + $(this).val();
|
2 |
QQWorld_auto_save_images.scan_posts = function() {
|
3 |
var _this = this,
|
4 |
$ = jQuery,
|
5 |
+
noty_theme = typeof qqworld_ajax == 'object' ? 'qqworldTheme' : 'defaultTheme',
|
6 |
+
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" />';
|
7 |
|
8 |
this.lib = {};
|
9 |
this.lib.sprintf = function() {
|
84 |
}
|
85 |
error += '<br />' + textStatus + ': ' + errorThrown;
|
86 |
error += '</div>';
|
|
|
87 |
$('body').data('noty').close();
|
88 |
noty({
|
89 |
text: error,
|
282 |
$noty.close();
|
283 |
$('#scan_old_posts').attr('disabled', true);
|
284 |
$('#list_all_posts').attr('disabled', true);
|
285 |
+
var data = $('#scan').serialize()+'&action=get_scan_list';
|
286 |
$.ajax({
|
287 |
type: 'POST',
|
288 |
url: ajaxurl,
|
301 |
\ </tbody>\
|
302 |
\</table>');
|
303 |
$('body').data('noty', noty({
|
304 |
+
text: wait_img+' '+QASI.scanning,
|
305 |
type: 'notification',
|
306 |
layout: 'center',
|
307 |
dismissQueue: true,
|
329 |
$('#scan-post-block').slideUp('normal');
|
330 |
$('#scan_old_posts').attr('disabled', true);
|
331 |
$('#list_all_posts').attr('disabled', true);
|
332 |
+
var data = $('#scan').serialize()+'&action=get_scan_list';
|
333 |
console.log(data);
|
334 |
$.ajax({
|
335 |
type: 'POST',
|
350 |
\ </tbody>\
|
351 |
\</table>');
|
352 |
$('body').data('noty', noty({
|
353 |
+
text: wait_img+' '+QASI.listing,
|
354 |
type: 'notification',
|
355 |
layout: 'center',
|
356 |
dismissQueue: true,
|
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(wait_img);
|
406 |
var temp = '';
|
407 |
checked.each(function() {
|
408 |
temp += '&posttype[]=' + $(this).val();
|
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-
|
6 |
-
"PO-Revision-Date: 2014-10-
|
7 |
"Last-Translator: Michael Wang <admin@qqworld.org>\n"
|
8 |
"Language-Team: QQWorld <admin@qqworld.org>\n"
|
9 |
"Language: zh_CN\n"
|
@@ -21,257 +21,266 @@ msgstr ""
|
|
21 |
"X-Poedit-Basepath: ..\n"
|
22 |
"X-Poedit-SearchPath-0: .\n"
|
23 |
|
24 |
-
#: qqworld-auto-save-images.php:
|
25 |
msgid "Michael Wang"
|
26 |
msgstr "王晓骞"
|
27 |
|
28 |
-
#: qqworld-auto-save-images.php:
|
29 |
msgid "No taxonomies found."
|
30 |
msgstr "没有相关分类方法。"
|
31 |
|
32 |
-
#: qqworld-auto-save-images.php:
|
33 |
-
#: qqworld-auto-save-images.php:
|
34 |
msgid "All remote images have been saved."
|
35 |
msgstr "已保存所有远程图像。"
|
36 |
|
37 |
-
#: qqworld-auto-save-images.php:
|
38 |
#, php-format
|
39 |
msgid " <a href=\"%s\">View</a>"
|
40 |
msgstr " <a href=\"%s\">查看</a>"
|
41 |
|
42 |
-
#: qqworld-auto-save-images.php:
|
43 |
msgid "Has missing images or image which could not download."
|
44 |
msgstr "内容包含 不存在/无法下载 的图像。"
|
45 |
|
46 |
-
#: qqworld-auto-save-images.php:
|
47 |
msgid "In Process..."
|
48 |
msgstr "正在保存……"
|
49 |
|
50 |
-
#: qqworld-auto-save-images.php:
|
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:
|
57 |
msgid "Please select post types."
|
58 |
msgstr "请选择文章类型。"
|
59 |
|
60 |
-
#: qqworld-auto-save-images.php:
|
61 |
msgid "May be a problem with some posts: "
|
62 |
msgstr "也许一些文章有问题:"
|
63 |
|
64 |
-
#: qqworld-auto-save-images.php:
|
65 |
#, php-format
|
66 |
msgid "%d post has been scanned."
|
67 |
msgstr "已扫描%d篇文章。"
|
68 |
|
69 |
-
#: qqworld-auto-save-images.php:
|
70 |
#, php-format
|
71 |
msgid "%d posts have been scanned."
|
72 |
msgstr "已扫描%d篇文章。"
|
73 |
|
74 |
-
#: qqworld-auto-save-images.php:
|
75 |
#, php-format
|
76 |
msgid "%d post included remote images processed."
|
77 |
msgstr "已处理%d篇包含远程图像的文章。"
|
78 |
|
79 |
-
#: qqworld-auto-save-images.php:
|
80 |
#, php-format
|
81 |
msgid "%d posts included remote images processed."
|
82 |
msgstr "已处理%d篇包含远程图像的文章。"
|
83 |
|
84 |
-
#: qqworld-auto-save-images.php:
|
85 |
#, php-format
|
86 |
msgid "%d post has missing images couldn't be processed."
|
87 |
msgstr "%d篇包含不存在的远程图像的文章无法处理。"
|
88 |
|
89 |
-
#: qqworld-auto-save-images.php:
|
90 |
#, php-format
|
91 |
msgid "%d posts have missing images couldn't be processed."
|
92 |
msgstr "%d篇包含不存在的远程图像的文章无法处理。"
|
93 |
|
94 |
-
#: qqworld-auto-save-images.php:
|
95 |
#, php-format
|
96 |
msgid "found %d post including remote images."
|
97 |
msgstr "找到%d篇包含远程图像的文章。"
|
98 |
|
99 |
-
#: qqworld-auto-save-images.php:
|
100 |
#, php-format
|
101 |
msgid "found %d posts including remote images."
|
102 |
msgstr "找到%d篇包含远程图像的文章。"
|
103 |
|
104 |
-
#: qqworld-auto-save-images.php:
|
105 |
#, php-format
|
106 |
msgid "And with %d post has missing images."
|
107 |
msgstr "其中有%d篇文章包含不存在的远程图像。"
|
108 |
|
109 |
-
#: qqworld-auto-save-images.php:
|
110 |
#, php-format
|
111 |
msgid "And with %d posts have missing images."
|
112 |
msgstr "其中有%d篇文章包含不存在的远程图像。"
|
113 |
|
114 |
-
#: qqworld-auto-save-images.php:
|
115 |
msgid "No posts processed."
|
116 |
msgstr "未处理任何文章。"
|
117 |
|
118 |
-
#: qqworld-auto-save-images.php:
|
119 |
msgid "No post has remote images found."
|
120 |
msgstr "没有文章包含远程图像。"
|
121 |
|
122 |
-
#: qqworld-auto-save-images.php:
|
123 |
msgid "No posts found."
|
124 |
msgstr "未找到任何文章。"
|
125 |
|
126 |
-
#: qqworld-auto-save-images.php:
|
127 |
msgid "All done."
|
128 |
msgstr "全部完成。"
|
129 |
|
130 |
-
#: qqworld-auto-save-images.php:
|
131 |
msgid "Yes"
|
132 |
msgstr ""
|
133 |
|
134 |
-
#: qqworld-auto-save-images.php:
|
135 |
msgid "No"
|
136 |
msgstr ""
|
137 |
|
138 |
-
#: qqworld-auto-save-images.php:
|
139 |
msgid "Scanning..."
|
140 |
msgstr "扫描中……"
|
141 |
|
142 |
-
#: qqworld-auto-save-images.php:
|
143 |
msgid "Listing..."
|
144 |
msgstr "显示列表中……"
|
145 |
|
146 |
-
#: qqworld-auto-save-images.php:
|
147 |
msgid "ID"
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: qqworld-auto-save-images.php:
|
151 |
msgid "Post Type"
|
152 |
msgstr "文章类型"
|
153 |
|
154 |
-
#: qqworld-auto-save-images.php:
|
155 |
msgid "Title"
|
156 |
msgstr ""
|
157 |
|
158 |
-
#: qqworld-auto-save-images.php:
|
159 |
msgid "Status"
|
160 |
msgstr ""
|
161 |
|
162 |
-
#: qqworld-auto-save-images.php:
|
163 |
msgid "Control"
|
164 |
msgstr "控制"
|
165 |
|
166 |
-
#: qqworld-auto-save-images.php:
|
167 |
msgid "Done"
|
168 |
msgstr ""
|
169 |
|
170 |
-
#: qqworld-auto-save-images.php:
|
171 |
msgid "Delete"
|
172 |
msgstr ""
|
173 |
|
174 |
-
#: qqworld-auto-save-images.php:
|
175 |
msgid "Has missing images."
|
176 |
msgstr "有不存在的远程图像。"
|
177 |
|
178 |
-
#: qqworld-auto-save-images.php:
|
179 |
msgid "Normal"
|
180 |
msgstr "正常"
|
181 |
|
182 |
-
#: qqworld-auto-save-images.php:
|
183 |
msgid "Fetch"
|
184 |
msgstr "抓取"
|
185 |
|
186 |
-
#: qqworld-auto-save-images.php:
|
187 |
msgid "Save Remote Images"
|
188 |
msgstr "保存远程图片"
|
189 |
|
190 |
-
#: qqworld-auto-save-images.php:
|
191 |
msgid "Settings"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#: qqworld-auto-save-images.php:
|
195 |
msgid "QQWorld Auto Save Images"
|
196 |
msgstr "QQWorld自动保存图片"
|
197 |
|
198 |
-
#: qqworld-auto-save-images.php:
|
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:
|
206 |
msgid "Scan Posts"
|
207 |
msgstr "扫描文章"
|
208 |
|
209 |
-
#: qqworld-auto-save-images.php:
|
210 |
msgid "Mode"
|
211 |
msgstr "模式"
|
212 |
|
213 |
-
#: qqworld-auto-save-images.php:
|
214 |
-
#: qqworld-auto-save-images.php:
|
215 |
msgid "Automatic"
|
216 |
msgstr "自动"
|
217 |
|
218 |
-
#: qqworld-auto-save-images.php:
|
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:
|
225 |
msgid "Manual"
|
226 |
msgstr "手动"
|
227 |
|
228 |
-
#: qqworld-auto-save-images.php:
|
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:
|
235 |
msgid "When"
|
236 |
msgstr "什么时候"
|
237 |
|
238 |
-
#: qqworld-auto-save-images.php:
|
239 |
msgid "Save post (Publish, save draft or pedding review)."
|
240 |
msgstr "保存文章时(发布文章,保存草稿或提交审核)。"
|
241 |
|
242 |
-
#: qqworld-auto-save-images.php:
|
243 |
msgid "Publish post only."
|
244 |
msgstr "仅发布文章时。"
|
245 |
|
246 |
-
#: qqworld-auto-save-images.php:
|
247 |
msgid "Set Featured Image"
|
248 |
msgstr "设置特色图片"
|
249 |
|
250 |
-
#: qqworld-auto-save-images.php:
|
251 |
msgid "Set first one of the remote images as featured image."
|
252 |
msgstr "设置远程图片中的第1个为特色图片。"
|
253 |
|
254 |
-
#: qqworld-auto-save-images.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
msgid "Exclude Domain/Keyword"
|
256 |
msgstr "排除域名/关键词"
|
257 |
|
258 |
-
#: qqworld-auto-save-images.php:
|
259 |
msgid "Images will not be saved, if that url contains Exclude-Domain/Keyword."
|
260 |
msgstr "如果图片地址包含排除域名/关键词,则不会保存该图片。"
|
261 |
|
262 |
-
#: qqworld-auto-save-images.php:
|
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:
|
271 |
msgid "Select post types"
|
272 |
msgstr "选择文章类型"
|
273 |
|
274 |
-
#: qqworld-auto-save-images.php:
|
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,19 +288,19 @@ msgstr ""
|
|
279 |
"如果有太多文章需要扫描,有时候在扫描过程中看起来像是停止了,但可能是假停止,"
|
280 |
"请耐心等待。"
|
281 |
|
282 |
-
#: qqworld-auto-save-images.php:
|
283 |
msgid "Categories"
|
284 |
msgstr ""
|
285 |
|
286 |
-
#: qqworld-auto-save-images.php:
|
287 |
msgid "Default empty to scan all categories."
|
288 |
msgstr "默认留空扫描所有分类。"
|
289 |
|
290 |
-
#: qqworld-auto-save-images.php:
|
291 |
msgid "Scope of Post ID"
|
292 |
msgstr "文章ID范围"
|
293 |
|
294 |
-
#: qqworld-auto-save-images.php:
|
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,16 +311,16 @@ msgstr ""
|
|
302 |
"者'100'和'50',两个数字的顺序可以颠倒。如果你只输入了1个数字,则系统只会扫描"
|
303 |
"该ID。"
|
304 |
|
305 |
-
#: qqworld-auto-save-images.php:
|
306 |
#, php-format
|
307 |
msgid "From %1$s to %2$s"
|
308 |
msgstr "从 %1$s 到 %2$s"
|
309 |
|
310 |
-
#: qqworld-auto-save-images.php:
|
311 |
msgid "Offset"
|
312 |
msgstr "偏移"
|
313 |
|
314 |
-
#: qqworld-auto-save-images.php:
|
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,34 +328,62 @@ msgstr ""
|
|
319 |
"默认扫秒全部文章,如果想扫描50-150篇文章,请在文本框中输入“50”并在下拉菜单中"
|
320 |
"选择“100”。"
|
321 |
|
322 |
-
#: qqworld-auto-save-images.php:
|
323 |
#, php-format
|
324 |
msgid "Start from %s to Scan"
|
325 |
msgstr "从 %s 开始扫描"
|
326 |
|
327 |
-
#: qqworld-auto-save-images.php:
|
328 |
msgid "All"
|
329 |
msgstr ""
|
330 |
|
331 |
-
#: qqworld-auto-save-images.php:
|
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:
|
340 |
msgid "If the server is too much stress may be appropriately reduced speed."
|
341 |
msgstr "如果服务器压力过大,可以适当调低速度。"
|
342 |
|
343 |
-
#: qqworld-auto-save-images.php:
|
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:
|
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,13 +391,17 @@ msgstr ""
|
|
354 |
"显示的列表中将告诉你哪些文章包含远程图片,然后你可以通过点击“抓取”按钮手动保"
|
355 |
"存。"
|
356 |
|
357 |
-
#: qqworld-auto-save-images.php:
|
358 |
msgid "Has Missing/Undownloadable images."
|
359 |
msgstr "有 不存在/不可下载 的远程图像。"
|
360 |
|
361 |
-
#: qqworld-auto-save-images.php:
|
362 |
msgid "No remote images found."
|
363 |
msgstr "没有远程图像。"
|
364 |
|
|
|
|
|
|
|
|
|
365 |
#~ msgid "Successed save remote images"
|
366 |
#~ 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-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"
|
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: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 "
|
262 |
+
"suggest enable it."
|
263 |
+
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 |
"如果有太多文章需要扫描,有时候在扫描过程中看起来像是停止了,但可能是假停止,"
|
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 |
"者'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 |
"默认扫秒全部文章,如果想扫描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 |
"显示的列表中将告诉你哪些文章包含远程图片,然后你可以通过点击“抓取”按钮手动保"
|
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 |
|
402 |
+
#, fuzzy
|
403 |
+
#~ msgid "Change Image File Name"
|
404 |
+
#~ msgstr "更改图片文件名"
|
405 |
+
|
406 |
#~ msgid "Successed save remote images"
|
407 |
#~ msgstr "成功保存远程图片"
|
qqworld-auto-save-images.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: QQWorld Auto Save Images
|
4 |
Plugin URI: https://wordpress.org/plugins/qqworld-auto-save-images/
|
5 |
Description: Automatically keep the all remote picture to the local, and automatically set featured image.
|
6 |
-
Version: 1.7
|
7 |
Author: Michael Wang
|
8 |
Author URI: http://www.qqworld.org
|
9 |
Text Domain: qqworld_auto_save_images
|
@@ -14,6 +14,7 @@ define('QQWORLD_AUTO_SAVE_IMAGES_URL', plugin_dir_url(__FILE__));
|
|
14 |
class QQWorld_auto_save_images {
|
15 |
var $using_action;
|
16 |
var $type;
|
|
|
17 |
var $preg = '/<img.*?src=[\"\']((?![\"\']).*?)[\"\']/i';
|
18 |
var $has_remote_image;
|
19 |
var $has_missing_image;
|
@@ -23,6 +24,7 @@ class QQWorld_auto_save_images {
|
|
23 |
$this->using_action = get_option('using_action', 'publish');
|
24 |
$this->type = get_option('qqworld_auto_save_imagess_type', 'auto');
|
25 |
$this->featured_image = get_option('qqworld_auto_save_imagess_set_featured_image', 'yes');
|
|
|
26 |
$this->exclude_domain = get_option('qqworld-auto-save-images-exclude-domain');
|
27 |
switch ($this->type) {
|
28 |
case 'auto':
|
@@ -198,7 +200,13 @@ class QQWorld_auto_save_images {
|
|
198 |
$args['posts_per_page'] = $posts_per_page;
|
199 |
|
200 |
// order
|
201 |
-
$args['order'] = '
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
//echo '<pre>'; print_r($args); echo '</pre>';
|
204 |
$posts = get_posts($args);
|
@@ -213,47 +221,27 @@ class QQWorld_auto_save_images {
|
|
213 |
if ( !current_user_can( 'manage_options' ) ) return;
|
214 |
$post_ids = $_REQUEST['post_id'];
|
215 |
if (!empty($post_ids)) foreach ($post_ids as $post_id) :
|
|
|
|
|
216 |
$post = get_post($post_id);
|
217 |
$post_id = $post->ID;
|
218 |
$post_type = $post->post_type;
|
219 |
$content = $post->post_content;
|
220 |
$title = $post->post_title;
|
221 |
-
$
|
222 |
-
$has_remote_images = false;
|
223 |
-
$has_not_exits_remote_images = false;
|
224 |
-
if($preg){
|
225 |
-
foreach($matches[1] as $image_url){
|
226 |
-
if(empty($image_url)) continue;
|
227 |
-
// exclude domain
|
228 |
-
$allow=true;
|
229 |
-
if (!empty($this->exclude_domain)) foreach ($this->exclude_domain as $domain) {
|
230 |
-
$pos=strpos($image_url, $domain);
|
231 |
-
if($pos) $allow=false;
|
232 |
-
}
|
233 |
-
if ($allow) {
|
234 |
-
$pos=strpos($image_url,get_bloginfo('url'));
|
235 |
-
if($pos===false){
|
236 |
-
$has_remote_images = true;
|
237 |
-
if ($res=$this->save_images($image_url,$post_id)) {
|
238 |
-
$replace=$res['url'];
|
239 |
-
$content=str_replace($image_url,$replace,$content);
|
240 |
-
} else $has_not_exits_remote_images = true;
|
241 |
-
}
|
242 |
-
}
|
243 |
-
}
|
244 |
-
}
|
245 |
wp_update_post(array('ID' => $post_id, 'post_content' => $content));
|
|
|
246 |
$post_type_object = get_post_type_object($post_type);
|
247 |
-
if ($
|
248 |
$class = 'has_remote_images';
|
249 |
-
if ($
|
250 |
$class = ' class="' . $class . '"';
|
251 |
?>
|
252 |
<tr<?php echo $class; ?>>
|
253 |
<td><?php echo $post_id; ?></td>
|
254 |
<td><?php echo $post_type_object->labels->name; ?></td>
|
255 |
<td><a href="<?php echo get_edit_post_link($post_id); ?>" target="_blank"><?php echo $title; ?> ⇛</a></td>
|
256 |
-
<td><?php echo $
|
257 |
</tr>
|
258 |
<?php else: ?>
|
259 |
<tr>
|
@@ -269,41 +257,25 @@ class QQWorld_auto_save_images {
|
|
269 |
if ( !current_user_can( 'manage_options' ) ) return;
|
270 |
$post_ids = $_REQUEST['post_id'];
|
271 |
if (!empty($post_ids)) foreach ($post_ids as $post_id) :
|
|
|
|
|
272 |
$post = get_post($post_id);
|
273 |
$post_id = $post->ID;
|
274 |
$post_type = $post->post_type;
|
275 |
$content = $post->post_content;
|
276 |
$title = $post->post_title;
|
277 |
-
|
278 |
-
$
|
279 |
-
|
280 |
-
if($
|
281 |
-
foreach($matches[1] as $image_url){
|
282 |
-
if(empty($image_url)) continue;
|
283 |
-
// exclude domain
|
284 |
-
$allow=true;
|
285 |
-
if (!empty($this->exclude_domain)) foreach ($this->exclude_domain as $domain) {
|
286 |
-
$pos=strpos($image_url, $domain);
|
287 |
-
if($pos) $allow=false;
|
288 |
-
}
|
289 |
-
if ($allow) {
|
290 |
-
$pos=strpos($image_url,get_bloginfo('url'));
|
291 |
-
if($pos===false) {
|
292 |
-
$has_remote_images = true;
|
293 |
-
$has_not_exits_remote_images = @!fopen( $image_url, 'r' );
|
294 |
-
}
|
295 |
-
}
|
296 |
-
}
|
297 |
-
}
|
298 |
-
if ($has_remote_images) :
|
299 |
$post_type_object = get_post_type_object($post_type);
|
300 |
-
$class = $
|
301 |
?>
|
302 |
<tr class="has_remote_images<?php echo $class; ?>">
|
303 |
<td><?php echo $post_id; ?></td>
|
304 |
<td><?php echo $post_type_object->labels->name; ?></td>
|
305 |
<td><a href="<?php echo get_edit_post_link($post_id); ?>" target="_blank"><?php echo $title; ?> ⇛</a></td>
|
306 |
-
<td><?php echo $
|
307 |
<td id="list-<?php echo $post_id; ?>"><input type="button" post-id="<?php echo $post_id; ?>" class="fetch-remote-images button button-primary" value="✍ <?php _e('Fetch', 'qqworld_auto_save_images'); ?>" /></td>
|
308 |
</tr>
|
309 |
<?php else: ?>
|
@@ -413,12 +385,17 @@ class QQWorld_auto_save_images {
|
|
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="
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
|
|
|
|
|
|
|
|
|
|
422 |
</label>
|
423 |
</fieldset></td>
|
424 |
</tr>
|
@@ -426,7 +403,7 @@ class QQWorld_auto_save_images {
|
|
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) :
|
@@ -443,6 +420,8 @@ class QQWorld_auto_save_images {
|
|
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">
|
@@ -484,6 +463,51 @@ class QQWorld_auto_save_images {
|
|
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>
|
@@ -493,7 +517,7 @@ class QQWorld_auto_save_images {
|
|
493 |
<option value="<?php echo $i; ?>"><?php echo $i; ?></option>
|
494 |
<?php endfor; ?>
|
495 |
<option value="10" selected>10</option>
|
496 |
-
</select
|
497 |
</td>
|
498 |
</tr>
|
499 |
</tbody>
|
@@ -504,7 +528,7 @@ class QQWorld_auto_save_images {
|
|
504 |
</p>
|
505 |
</div>
|
506 |
</div>
|
507 |
-
</
|
508 |
<?php
|
509 |
}
|
510 |
|
@@ -512,6 +536,7 @@ class QQWorld_auto_save_images {
|
|
512 |
register_setting('qqworld_auto_save_images_settings', 'qqworld_auto_save_imagess_type');
|
513 |
register_setting('qqworld_auto_save_images_settings', 'using_action');
|
514 |
register_setting('qqworld_auto_save_images_settings', 'qqworld_auto_save_imagess_set_featured_image');
|
|
|
515 |
register_setting('qqworld_auto_save_images_settings', 'qqworld-auto-save-images-exclude-domain');
|
516 |
}
|
517 |
|
@@ -581,30 +606,8 @@ class QQWorld_auto_save_images {
|
|
581 |
$this->has_remote_image = 0;
|
582 |
$this->has_missing_image = 0;
|
583 |
|
584 |
-
$content = $this->utf8_urldecode($this->utf8_urldecode($_POST['content']));
|
585 |
|
586 |
-
$preg=preg_match_all($this->preg,stripslashes($content),$matches);
|
587 |
-
if($preg){
|
588 |
-
foreach($matches[1] as $image_url){
|
589 |
-
if(empty($image_url)) continue;
|
590 |
-
// exclude domain
|
591 |
-
$allow=true;
|
592 |
-
if (!empty($this->exclude_domain)) foreach ($this->exclude_domain as $domain) {
|
593 |
-
$pos=strpos($image_url, $domain);
|
594 |
-
if($pos) $allow=false;
|
595 |
-
}
|
596 |
-
if ($allow) {
|
597 |
-
$pos=strpos($image_url,get_bloginfo('url'));
|
598 |
-
if($pos===false){
|
599 |
-
$this->has_remote_image = 1;
|
600 |
-
if ($res=$this->save_images($image_url,$post_id)) {
|
601 |
-
$replace=$res['url'];
|
602 |
-
$content=str_replace($image_url,$replace,$content);
|
603 |
-
}
|
604 |
-
}
|
605 |
-
}
|
606 |
-
}
|
607 |
-
}
|
608 |
wp_update_post(array('ID' => $post_id, 'post_content' => $content));
|
609 |
|
610 |
$result = array();
|
@@ -641,9 +644,15 @@ class QQWorld_auto_save_images {
|
|
641 |
|
642 |
$this->remove_actions();
|
643 |
|
644 |
-
$post=get_post($post_id);
|
645 |
-
$content
|
646 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
647 |
if($preg){
|
648 |
foreach($matches[1] as $image_url){
|
649 |
if(empty($image_url)) continue;
|
@@ -665,26 +674,41 @@ class QQWorld_auto_save_images {
|
|
665 |
}
|
666 |
}
|
667 |
}
|
668 |
-
|
669 |
-
|
670 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
671 |
}
|
672 |
|
673 |
//save exterior images
|
674 |
function save_images($image_url, $post_id){
|
675 |
set_time_limit(0);
|
676 |
if ( $file=@file_get_contents($image_url) ) {
|
677 |
-
$filename=
|
678 |
preg_match( '/(.*?)(\.(jpg|jpeg|png|gif|bmp))$/i', $filename, $match );
|
679 |
if ( empty($match) ) {
|
680 |
if ($filetype = $this->getFileType($file) ) {
|
681 |
preg_match( '/(.*?)$/i', $filename, $match );
|
682 |
$pos=strpos($image_url,'?'); // if has '?', md5()
|
683 |
$img_name = $pos ? md5($match[0]) : $match[0];
|
684 |
-
$img_name = $img_name
|
685 |
} else return false;
|
686 |
} else {
|
687 |
-
$img_name = $match[1]
|
688 |
}
|
689 |
$res=wp_upload_bits($img_name,'',$file);
|
690 |
$attach_id = $this->insert_attachment($res['file'],$post_id);
|
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
|
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;
|
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) {
|
30 |
case 'auto':
|
200 |
$args['posts_per_page'] = $posts_per_page;
|
201 |
|
202 |
// order
|
203 |
+
$args['order'] = $_REQUEST['order'];
|
204 |
+
|
205 |
+
// status
|
206 |
+
$args['post_status'] = $_REQUEST['post_status'];
|
207 |
+
|
208 |
+
// orderby
|
209 |
+
$args['orderby'] = $_REQUEST['orderby'];
|
210 |
|
211 |
//echo '<pre>'; print_r($args); echo '</pre>';
|
212 |
$posts = get_posts($args);
|
221 |
if ( !current_user_can( 'manage_options' ) ) return;
|
222 |
$post_ids = $_REQUEST['post_id'];
|
223 |
if (!empty($post_ids)) foreach ($post_ids as $post_id) :
|
224 |
+
$this->has_remote_image = 0;
|
225 |
+
$this->has_missing_image = 0;
|
226 |
$post = get_post($post_id);
|
227 |
$post_id = $post->ID;
|
228 |
$post_type = $post->post_type;
|
229 |
$content = $post->post_content;
|
230 |
$title = $post->post_title;
|
231 |
+
$content = $this->content_save_pre($content, $post_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
wp_update_post(array('ID' => $post_id, 'post_content' => $content));
|
233 |
+
|
234 |
$post_type_object = get_post_type_object($post_type);
|
235 |
+
if ($this->has_remote_image) :
|
236 |
$class = 'has_remote_images';
|
237 |
+
if ($this->has_missing_image) $class += ' has_not_exits_remote_images';
|
238 |
$class = ' class="' . $class . '"';
|
239 |
?>
|
240 |
<tr<?php echo $class; ?>>
|
241 |
<td><?php echo $post_id; ?></td>
|
242 |
<td><?php echo $post_type_object->labels->name; ?></td>
|
243 |
<td><a href="<?php echo get_edit_post_link($post_id); ?>" target="_blank"><?php echo $title; ?> ⇛</a></td>
|
244 |
+
<td><?php echo $this->has_missing_image ? '<span class="red">'.__('Has missing images.', 'qqworld_auto_save_images').'</span>' : '<span class="green">'.__('All remote images have been saved.', 'qqworld_auto_save_images').'</span>'; ?></td>
|
245 |
</tr>
|
246 |
<?php else: ?>
|
247 |
<tr>
|
257 |
if ( !current_user_can( 'manage_options' ) ) return;
|
258 |
$post_ids = $_REQUEST['post_id'];
|
259 |
if (!empty($post_ids)) foreach ($post_ids as $post_id) :
|
260 |
+
$this->has_remote_image = 0;
|
261 |
+
$this->has_missing_image = 0;
|
262 |
$post = get_post($post_id);
|
263 |
$post_id = $post->ID;
|
264 |
$post_type = $post->post_type;
|
265 |
$content = $post->post_content;
|
266 |
$title = $post->post_title;
|
267 |
+
|
268 |
+
$content = $this->content_save_pre($content, $post_id);
|
269 |
+
|
270 |
+
if ($this->has_remote_image) :
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
$post_type_object = get_post_type_object($post_type);
|
272 |
+
$class = $this->has_missing_image ? ' has_not_exits_remote_images' : '';
|
273 |
?>
|
274 |
<tr class="has_remote_images<?php echo $class; ?>">
|
275 |
<td><?php echo $post_id; ?></td>
|
276 |
<td><?php echo $post_type_object->labels->name; ?></td>
|
277 |
<td><a href="<?php echo get_edit_post_link($post_id); ?>" target="_blank"><?php echo $title; ?> ⇛</a></td>
|
278 |
+
<td><?php echo $this->has_missing_image ? '<span class="red">'.__('Has missing images.', 'qqworld_auto_save_images').'</span>' : __('Normal', 'qqworld_auto_save_images'); ?></a></td>
|
279 |
<td id="list-<?php echo $post_id; ?>"><input type="button" post-id="<?php echo $post_id; ?>" class="fetch-remote-images button button-primary" value="✍ <?php _e('Fetch', 'qqworld_auto_save_images'); ?>" /></td>
|
280 |
</tr>
|
281 |
<?php else: ?>
|
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>
|
392 |
+
|
393 |
+
<tr valign="top">
|
394 |
+
<th scope="row"><label><?php _e('Change Image Filename', 'qqworld_auto_save_images'); ?></label> <span class="icon help" title="<?php _e("If you checked this, when the remote image filename have Chinese or other East Asian characters. system will automatically change image filename. I suggest enable it.", 'qqworld_auto_save_images'); ?>"></span></th>
|
395 |
+
<td><fieldset>
|
396 |
+
<legend class="screen-reader-text"><span><?php _e('Change Image Filename', 'qqworld_auto_save_images'); ?></span></legend>
|
397 |
+
<label for="qqworld_auto_save_images_auto_change_name">
|
398 |
+
<input name="qqworld_auto_save_images_auto_change_name" type="checkbox" id="qqworld_auto_save_images_auto_change_name" value="yes" <?php checked('yes', $this->change_image_name); ?> /> <?php _e('Automatic', 'qqworld_auto_save_images'); ?>
|
399 |
</label>
|
400 |
</fieldset></td>
|
401 |
</tr>
|
403 |
<tr valign="top">
|
404 |
<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>
|
405 |
<td><fieldset>
|
406 |
+
<legend class="screen-reader-text"><span><?php _e('Exclude Domain/Keyword', 'qqworld_auto_save_images'); ?></span></legend>
|
407 |
<ul id="exclude_domain_list">
|
408 |
<?php
|
409 |
if (!empty($this->exclude_domain)) foreach ($this->exclude_domain as $domain) :
|
420 |
</table>
|
421 |
<?php submit_button(); ?>
|
422 |
</div>
|
423 |
+
</form>
|
424 |
+
<form action="" method="post" id="scan">
|
425 |
<div class="tab-content hidden">
|
426 |
<div id="scan-result"></div>
|
427 |
<div id="scan-post-block">
|
463 |
</select> <?php _e('Posts'); ?>
|
464 |
</td>
|
465 |
</tr>
|
466 |
+
|
467 |
+
<tr valign="top">
|
468 |
+
<th scope="row"><label><?php _e('Status'); ?></label></th>
|
469 |
+
<td>
|
470 |
+
<select name="post_status">
|
471 |
+
<?php
|
472 |
+
global $wp_post_statuses;
|
473 |
+
echo '<option value="any" /> '.__('Any', 'qqworld_auto_save_images').'</option>';
|
474 |
+
foreach ($wp_post_statuses as $slug => $status) {
|
475 |
+
if (!in_array($slug, array('auto-draft', 'inherit', 'trash'))) echo '<option value="'.$slug.'" '.selected('publish', $slug, false).'> '.$status->label.'</option>';
|
476 |
+
}
|
477 |
+
?>
|
478 |
+
</select>
|
479 |
+
</td>
|
480 |
+
</tr>
|
481 |
+
|
482 |
+
<tr valign="top">
|
483 |
+
<th scope="row"><label><?php _e('Order By', 'qqworld_auto_save_images'); ?></label></th>
|
484 |
+
<td>
|
485 |
+
<select name="orderby">
|
486 |
+
<?php
|
487 |
+
$orderby = array(
|
488 |
+
'ID' => __('ID'),
|
489 |
+
'author' => __('Author'),
|
490 |
+
'title' => __('Title'),
|
491 |
+
'date' => __('Date'),
|
492 |
+
'modified' => __('Last Modified'),
|
493 |
+
'comment_count' => __('Comment Count', 'qqworld_auto_save_images')
|
494 |
+
);
|
495 |
+
foreach ($orderby as $key => $name) : ?>
|
496 |
+
<option value="<?php echo $key; ?>"<?php selected('date', $key); ?>><?php echo $name; ?></option>
|
497 |
+
<?php endforeach; ?>
|
498 |
+
</select>
|
499 |
+
</td>
|
500 |
+
</tr>
|
501 |
+
|
502 |
+
<tr valign="top">
|
503 |
+
<th scope="row"><label for="order"><?php _e('Order'); ?></label></th>
|
504 |
+
<td id="categories_block"><fieldset>
|
505 |
+
<select name="order" id="order">
|
506 |
+
<option value="DESC">DESC</option>
|
507 |
+
<option value="ASC">ASC</option>
|
508 |
+
</select>
|
509 |
+
</td>
|
510 |
+
</tr>
|
511 |
|
512 |
<tr valign="top">
|
513 |
<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>
|
517 |
<option value="<?php echo $i; ?>"><?php echo $i; ?></option>
|
518 |
<?php endfor; ?>
|
519 |
<option value="10" selected>10</option>
|
520 |
+
</select>
|
521 |
</td>
|
522 |
</tr>
|
523 |
</tbody>
|
528 |
</p>
|
529 |
</div>
|
530 |
</div>
|
531 |
+
</div>
|
532 |
<?php
|
533 |
}
|
534 |
|
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 |
}
|
542 |
|
606 |
$this->has_remote_image = 0;
|
607 |
$this->has_missing_image = 0;
|
608 |
|
609 |
+
$content = $this->content_save_pre($this->utf8_urldecode($this->utf8_urldecode($_POST['content'])), $post_id);
|
610 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
611 |
wp_update_post(array('ID' => $post_id, 'post_content' => $content));
|
612 |
|
613 |
$result = array();
|
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;
|
674 |
}
|
675 |
}
|
676 |
}
|
677 |
+
return $content;
|
678 |
+
}
|
679 |
+
|
680 |
+
public function change_images_filename($name, $extension) {
|
681 |
+
if ($this->change_image_name) {
|
682 |
+
preg_match( '/^[\x7f-\xff]+$/', $name, $match );
|
683 |
+
if ( !empty($match) ) {
|
684 |
+
return md5($name) . $extension;
|
685 |
+
}
|
686 |
+
}
|
687 |
+
return $name . $extension;
|
688 |
+
}
|
689 |
+
|
690 |
+
public function get_filename_from_url($url) {
|
691 |
+
$url = parse_url($url);
|
692 |
+
$path = $url['path'];
|
693 |
+
$filename = explode('/', $path);
|
694 |
+
return $filename[count($filename)-1];
|
695 |
}
|
696 |
|
697 |
//save exterior images
|
698 |
function save_images($image_url, $post_id){
|
699 |
set_time_limit(0);
|
700 |
if ( $file=@file_get_contents($image_url) ) {
|
701 |
+
$filename = $this->get_filename_from_url($image_url);
|
702 |
preg_match( '/(.*?)(\.(jpg|jpeg|png|gif|bmp))$/i', $filename, $match );
|
703 |
if ( empty($match) ) {
|
704 |
if ($filetype = $this->getFileType($file) ) {
|
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]);
|
712 |
}
|
713 |
$res=wp_upload_bits($img_name,'',$file);
|
714 |
$attach_id = $this->insert_attachment($res['file'],$post_id);
|