Version Description
Download this release
Release Info
Developer | qqworld |
Plugin | QQWorld Auto Save Images |
Version | 1.5.5 |
Comparing to | |
See all releases |
Code changes from version 1.5.4 to 1.5.5
lang/qqworld_auto_save_images-zh_CN.mo
CHANGED
Binary file
|
lang/qqworld_auto_save_images-zh_CN.po
CHANGED
@@ -3,7 +3,7 @@ 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-09-30
|
7 |
"Last-Translator: Michael Wang <admin@qqworld.org>\n"
|
8 |
"Language-Team: QQWorld <admin@qqworld.org>\n"
|
9 |
"Language: zh_CN\n"
|
@@ -91,3 +91,6 @@ msgid ""
|
|
91 |
msgstr ""
|
92 |
"如果想扫描50-150篇文章,请在文本框中输入“50”并在下拉菜单中选择“100”,不能"
|
93 |
"选“全部”。"
|
|
|
|
|
|
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-09-30 19:50+0800\n"
|
7 |
"Last-Translator: Michael Wang <admin@qqworld.org>\n"
|
8 |
"Language-Team: QQWorld <admin@qqworld.org>\n"
|
9 |
"Language: zh_CN\n"
|
91 |
msgstr ""
|
92 |
"如果想扫描50-150篇文章,请在文本框中输入“50”并在下拉菜单中选择“100”,不能"
|
93 |
"选“全部”。"
|
94 |
+
|
95 |
+
msgid "Speed:"
|
96 |
+
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.5.
|
7 |
Author: Michael Wang
|
8 |
Author URI: http://www.qqworld.org
|
9 |
*/
|
@@ -56,34 +56,38 @@ class QQWorld_auto_save_images {
|
|
56 |
}
|
57 |
|
58 |
public function save_remote_images_after_scan() {
|
|
|
59 |
if ( !current_user_can( 'manage_options' ) ) return;
|
60 |
-
$
|
61 |
-
$
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
if
|
73 |
-
$
|
74 |
-
|
|
|
|
|
75 |
}
|
76 |
}
|
77 |
}
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
87 |
exit;
|
88 |
}
|
89 |
|
@@ -192,7 +196,6 @@ class QQWorld_auto_save_images {
|
|
192 |
});
|
193 |
})
|
194 |
});
|
195 |
-
|
196 |
</script>
|
197 |
<?php
|
198 |
}
|
@@ -280,7 +283,7 @@ class QQWorld_auto_save_images {
|
|
280 |
<label><input name="qqworld_auto_save_imagess_post_types[]" type="checkbox" value="<?php echo $name; ?>" /> <?php echo $post_type->labels->name; ?></label>
|
281 |
<?php endforeach;
|
282 |
?></p>
|
283 |
-
<p><?php _e('Filter:', 'qqworld_auto_save_images'); ?> <?php printf(__('Start from %s Scan', 'qqworld_auto_save_images'), '<input type="number" name="offset" value="0" disabled />'); ?>
|
284 |
<select name="posts_per_page">
|
285 |
<option value="-1"><?php _e('All'); ?></option>
|
286 |
<?php for ($i=1; $i<=10; $i++) : ?>
|
@@ -293,8 +296,14 @@ class QQWorld_auto_save_images {
|
|
293 |
|
294 |
<fieldset>
|
295 |
<legend class="screen-reader-text"><span><?php _e('Scan Old Posts', 'qqworld_auto_save_images'); ?></span></legend>
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
<label for="scan_old_posts">
|
297 |
-
<input name="scan_old_posts" type="button" class="button-primary" id="scan_old_posts" value="<?php _e('Scan', 'qqworld_auto_save_images'); ?>" />
|
298 |
</label>
|
299 |
<p class="description"><?php _e('Scan posts and keep remote images in all posts to local media library. Maybe take a long time.', 'qqworld_auto_save_images'); ?></p>
|
300 |
</fieldset>
|
@@ -313,23 +322,26 @@ class QQWorld_auto_save_images {
|
|
313 |
text: '<?php _e('All done.', 'qqworld_auto_save_images'); ?>',
|
314 |
type: 'success',
|
315 |
layout: 'bottomCenter',
|
316 |
-
dismissQueue: true
|
317 |
-
timeout: 3000
|
318 |
});
|
319 |
$('#scan_old_posts').removeAttr('disabled');
|
320 |
return;
|
321 |
}
|
322 |
-
var
|
323 |
-
|
324 |
-
|
325 |
-
|
|
|
|
|
326 |
$.ajax({
|
327 |
type: 'POST',
|
328 |
url: ajaxurl,
|
329 |
data: data,
|
330 |
success: function(data) {
|
|
|
331 |
$('#scan_old_post_list tbody').append(data);
|
332 |
-
|
|
|
333 |
QQWorld_auto_save_images.scan(respond, r);
|
334 |
}
|
335 |
});
|
@@ -488,6 +500,7 @@ class QQWorld_auto_save_images {
|
|
488 |
}
|
489 |
}
|
490 |
}
|
|
|
491 |
echo $content;
|
492 |
exit;
|
493 |
}
|
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.5
|
7 |
Author: Michael Wang
|
8 |
Author URI: http://www.qqworld.org
|
9 |
*/
|
56 |
}
|
57 |
|
58 |
public function save_remote_images_after_scan() {
|
59 |
+
set_time_limit(0);
|
60 |
if ( !current_user_can( 'manage_options' ) ) return;
|
61 |
+
$post_ids = $_REQUEST['post_id'];
|
62 |
+
if (!empty($post_ids)) foreach ($post_ids as $post_id) :
|
63 |
+
$post = get_post($post_id);
|
64 |
+
$post_id = $post->ID;
|
65 |
+
$post_type = $post->post_type;
|
66 |
+
$content = $post->post_content;
|
67 |
+
$title = $post->post_title;
|
68 |
+
$preg=preg_match_all('/<img.*?src="((?![\"\']).*?)((?![\"\'])\?.*?)?"/',stripslashes($content),$matches);
|
69 |
+
if($preg){
|
70 |
+
foreach($matches[1] as $image_url){
|
71 |
+
if(empty($image_url)) continue;
|
72 |
+
$pos=strpos($image_url,get_bloginfo('url'));
|
73 |
+
if($pos===false){
|
74 |
+
if ($res=$this->save_images($image_url,$post_id)) {
|
75 |
+
$replace=$res['url'];
|
76 |
+
$content=str_replace($image_url,$replace,$content);
|
77 |
+
}
|
78 |
}
|
79 |
}
|
80 |
}
|
81 |
+
wp_update_post(array('ID' => $post_id, 'post_content' => $content));
|
82 |
+
?>
|
83 |
+
<tr>
|
84 |
+
<td><?php echo $post_id; ?></td>
|
85 |
+
<td><?php echo $post_type; ?></td>
|
86 |
+
<td><a href="<?php echo get_edit_post_link($post_id); ?>" target="_blank"><?php echo $title; ?></a></td>
|
87 |
+
<td><?php _e('Done'); ?></td>
|
88 |
+
</tr>
|
89 |
+
<?php
|
90 |
+
endforeach;
|
91 |
exit;
|
92 |
}
|
93 |
|
196 |
});
|
197 |
})
|
198 |
});
|
|
|
199 |
</script>
|
200 |
<?php
|
201 |
}
|
283 |
<label><input name="qqworld_auto_save_imagess_post_types[]" type="checkbox" value="<?php echo $name; ?>" /> <?php echo $post_type->labels->name; ?></label>
|
284 |
<?php endforeach;
|
285 |
?></p>
|
286 |
+
<p><?php _e('Filter:', 'qqworld_auto_save_images'); ?> <?php printf(__('Start from %s Scan', 'qqworld_auto_save_images'), '<input type="number" class="small-text" name="offset" value="0" disabled />'); ?>
|
287 |
<select name="posts_per_page">
|
288 |
<option value="-1"><?php _e('All'); ?></option>
|
289 |
<?php for ($i=1; $i<=10; $i++) : ?>
|
296 |
|
297 |
<fieldset>
|
298 |
<legend class="screen-reader-text"><span><?php _e('Scan Old Posts', 'qqworld_auto_save_images'); ?></span></legend>
|
299 |
+
<?php _e('Speed:', 'qqworld_auto_save_images'); ?>
|
300 |
+
<select name="speed">
|
301 |
+
<?php for ($i=1; $i<=10; $i++) : ?>
|
302 |
+
<option value="<?php echo $i; ?>"><?php echo $i; ?></option>
|
303 |
+
<?php endfor; ?>
|
304 |
+
</select>
|
305 |
<label for="scan_old_posts">
|
306 |
+
<input name="scan_old_posts" type="button" class="button-primary" id="scan_old_posts" value="<?php _e('Scan', 'qqworld_auto_save_images'); ?> ⇛" />
|
307 |
</label>
|
308 |
<p class="description"><?php _e('Scan posts and keep remote images in all posts to local media library. Maybe take a long time.', 'qqworld_auto_save_images'); ?></p>
|
309 |
</fieldset>
|
322 |
text: '<?php _e('All done.', 'qqworld_auto_save_images'); ?>',
|
323 |
type: 'success',
|
324 |
layout: 'bottomCenter',
|
325 |
+
dismissQueue: true
|
|
|
326 |
});
|
327 |
$('#scan_old_posts').removeAttr('disabled');
|
328 |
return;
|
329 |
}
|
330 |
+
var speed = parseInt($('select[name="speed"]').val()),
|
331 |
+
post_id = new Array;
|
332 |
+
var data = 'action=save_remote_images_after_scan';
|
333 |
+
for (var p=r; p<r+speed; p++) {
|
334 |
+
if (typeof respond[p] != 'undefined') data += '&post_id[]='+respond[p]['ID'];
|
335 |
+
}
|
336 |
$.ajax({
|
337 |
type: 'POST',
|
338 |
url: ajaxurl,
|
339 |
data: data,
|
340 |
success: function(data) {
|
341 |
+
data = $(data);
|
342 |
$('#scan_old_post_list tbody').append(data);
|
343 |
+
data.hide().fadeIn('fast');
|
344 |
+
r += speed;
|
345 |
QQWorld_auto_save_images.scan(respond, r);
|
346 |
}
|
347 |
});
|
500 |
}
|
501 |
}
|
502 |
}
|
503 |
+
wp_update_post(array('ID' => $post_id, 'post_content' => $content));
|
504 |
echo $content;
|
505 |
exit;
|
506 |
}
|