QQWorld Auto Save Images - Version 1.5.7.2

Version Description

Download this release

Release Info

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

Code changes from version 1.5.7 to 1.5.7.2

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-10-06 07:27+0800\n"
7
  "Last-Translator: Michael Wang <admin@qqworld.org>\n"
8
  "Language-Team: QQWorld <admin@qqworld.org>\n"
9
  "Language: zh_CN\n"
@@ -187,3 +187,6 @@ msgstr ""
187
 
188
  msgid "If the server is too much stress may be appropriately reduced speed."
189
  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-07 14:37+0800\n"
7
  "Last-Translator: Michael Wang <admin@qqworld.org>\n"
8
  "Language-Team: QQWorld <admin@qqworld.org>\n"
9
  "Language: zh_CN\n"
187
 
188
  msgid "If the server is too much stress may be appropriately reduced speed."
189
  msgstr "如果服务器压力过大,可以适当调低速度。"
190
+
191
+ msgid "May be a problem with some posts: "
192
+ 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
7
  Author: Michael Wang
8
  Author URI: http://www.qqworld.org
9
  */
@@ -139,7 +139,6 @@ class QQWorld_auto_save_images {
139
  set_time_limit(0);
140
  if ( !current_user_can( 'manage_options' ) ) return;
141
  $post_ids = $_REQUEST['post_id'];
142
- echo 1;
143
  if (!empty($post_ids)) foreach ($post_ids as $post_id) :
144
  $post = get_post($post_id);
145
  $post_id = $post->ID;
@@ -456,8 +455,59 @@ class QQWorld_auto_save_images {
456
  if (!QQWorld_auto_save_images) var QQWorld_auto_save_images = {};
457
  QQWorld_auto_save_images.are_your_sure = '<?php _e('Are you sure?<br />Before you click the yes button, I recommend backup site database.', 'qqworld_auto_save_images'); ?>';
458
  QQWorld_auto_save_images.pls_select_post_types = '<?php _e('Please select post types.', 'qqworld_auto_save_images'); ?>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
  QQWorld_auto_save_images.scan = function(respond, r) {
460
  var $ = jQuery;
 
461
  if (typeof respond[r] == 'undefined') {
462
  $('#scan-result').effect( 'shake', null, 500 );
463
  $('#form').slideDown('slow');
@@ -493,12 +543,14 @@ class QQWorld_auto_save_images {
493
  $('#list_all_posts').removeAttr('disabled');
494
  return;
495
  }
496
- var speed = parseInt($('select[name="speed"]').val()),
497
  post_id = new Array;
 
498
  var data = 'action=save_remote_images_after_scan';
499
  for (var p=r; p<r+speed; p++) {
500
  if (typeof respond[p] != 'undefined') data += '&post_id[]='+respond[p];
501
  }
 
502
  $.ajax({
503
  type: 'POST',
504
  url: ajaxurl,
@@ -509,11 +561,13 @@ class QQWorld_auto_save_images {
509
  data.hide().fadeIn('fast');
510
  r += speed;
511
  QQWorld_auto_save_images.scan(respond, r);
512
- }
 
513
  });
514
  };
515
  QQWorld_auto_save_images.list = function(respond, r) {
516
  var $ = jQuery;
 
517
  if (typeof respond[r] == 'undefined') {
518
  $('#scan-result').effect( 'shake', null, 500 );
519
  $('#form').slideDown('slow');
@@ -547,12 +601,14 @@ class QQWorld_auto_save_images {
547
  $('#list_all_posts').removeAttr('disabled');
548
  return;
549
  }
550
- var speed = parseInt($('select[name="speed"]').val()),
551
  post_id = new Array;
 
552
  var data = 'action=save_remote_images_list_all_posts';
553
  for (var p=r; p<r+speed; p++) {
554
  if (typeof respond[p] != 'undefined') data += '&post_id[]='+respond[p];
555
  }
 
556
  $.ajax({
557
  type: 'POST',
558
  url: ajaxurl,
@@ -564,12 +620,7 @@ class QQWorld_auto_save_images {
564
  r += speed;
565
  QQWorld_auto_save_images.list(respond, r);
566
  },
567
- error: function (XMLHttpRequest, textStatus, errorThrown) {
568
- if (XMLHttpRequest) console.log('XMLHttpRequest: ' + XMLHttpRequest);
569
- else if (textStatus) console.log('textStatus: ' + textStatus);
570
- else if (errorThrown) console.log('errorThrown' + errorThrown);
571
- console.log(this);
572
- }
573
  });
574
  };
575
  QQWorld_auto_save_images.if_not_select_post_type = function() {
@@ -625,6 +676,7 @@ class QQWorld_auto_save_images {
625
  data: data,
626
  dataType: 'json',
627
  success: function(respond) {
 
628
  $('#scan-result').html('<table id="scan_old_post_list">\
629
  \ <thead>\
630
  \ <th><?php _e('ID'); ?></th>\
@@ -641,8 +693,9 @@ class QQWorld_auto_save_images {
641
  layout: 'center',
642
  dismissQueue: true
643
  }) );
644
- QQWorld_auto_save_images.scan(respond, 0);
645
- }
 
646
  });
647
  }
648
  },
@@ -669,6 +722,7 @@ class QQWorld_auto_save_images {
669
  data: data,
670
  dataType: 'json',
671
  success: function(respond) {
 
672
  $('#scan-result').html('<table id="scan_old_post_list">\
673
  \ <thead>\
674
  \ <th><?php _e('ID'); ?></th>\
@@ -687,7 +741,8 @@ class QQWorld_auto_save_images {
687
  dismissQueue: true
688
  }) );
689
  QQWorld_auto_save_images.list(respond, 0);
690
- }
 
691
  });
692
  } else QQWorld_auto_save_images.if_not_select_post_type();
693
  });
@@ -702,7 +757,8 @@ class QQWorld_auto_save_images {
702
  data: data,
703
  success: function(data) {
704
  $('#list-'+post_id).html('<span class="green"><?php _e('Done'); ?></span>');
705
- }
 
706
  });
707
  })
708
  };
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.2
7
  Author: Michael Wang
8
  Author URI: http://www.qqworld.org
9
  */
139
  set_time_limit(0);
140
  if ( !current_user_can( 'manage_options' ) ) return;
141
  $post_ids = $_REQUEST['post_id'];
 
142
  if (!empty($post_ids)) foreach ($post_ids as $post_id) :
143
  $post = get_post($post_id);
144
  $post_id = $post->ID;
455
  if (!QQWorld_auto_save_images) var QQWorld_auto_save_images = {};
456
  QQWorld_auto_save_images.are_your_sure = '<?php _e('Are you sure?<br />Before you click the yes button, I recommend backup site database.', 'qqworld_auto_save_images'); ?>';
457
  QQWorld_auto_save_images.pls_select_post_types = '<?php _e('Please select post types.', 'qqworld_auto_save_images'); ?>';
458
+ QQWorld_auto_save_images.maybe_problem = '<?php _e('May be a problem with some posts: ', 'qqworld_auto_save_images'); ?>';
459
+ QQWorld_auto_save_images.catch_errors = function(XMLHttpRequest, textStatus, errorThrown) {
460
+ var $=jQuery, error='', args=new Array;
461
+ error += '<div style="text-align: left;">';
462
+ var query = this.data.split('&');
463
+ var data = new Array;
464
+ for (var d in query) {
465
+ var q = query[d].split('=');
466
+ if (q[0]=='post_id[]') {
467
+ data.push(q[1]);
468
+ }
469
+ }
470
+ error += QQWorld_auto_save_images.maybe_problem + data.join(', ');
471
+ if (XMLHttpRequest) {
472
+ error += '<hr />';
473
+ args = new Array;
474
+ for (var x in XMLHttpRequest) {
475
+ switch (x) {
476
+ case 'readyState':
477
+ case 'responseText':
478
+ case 'status':
479
+ args.push( x + ': ' + XMLHttpRequest[x] );
480
+ break;
481
+ }
482
+ }
483
+ error += args.join('<br />', args);
484
+ }
485
+ error += '<br />' + textStatus + ': ' + errorThrown;
486
+ error += '</div>';
487
+ $('#form').slideDown('slow');
488
+ $('body').data('noty').close();
489
+ noty({
490
+ text: error,
491
+ type: 'error',
492
+ layout: 'bottom',
493
+ dismissQueue: true,
494
+ closeWith: ['button']
495
+ });
496
+ $('#scan_old_posts').removeAttr('disabled');
497
+ $('#list_all_posts').removeAttr('disabled');
498
+ $('body').data('r', $('body').data('r')+$('body').data('speed'));
499
+ switch ($('body').data('scan-mode')) {
500
+ case 'scan':
501
+ QQWorld_auto_save_images.scan($('body').data('respond'), $('body').data('r'));
502
+ break;
503
+ case 'list':
504
+ QQWorld_auto_save_images.list($('body').data('respond'), $('body').data('r'));
505
+ break;
506
+ }
507
+ };
508
  QQWorld_auto_save_images.scan = function(respond, r) {
509
  var $ = jQuery;
510
+ $('body').data('scan-mode', 'scan').data('r', r);
511
  if (typeof respond[r] == 'undefined') {
512
  $('#scan-result').effect( 'shake', null, 500 );
513
  $('#form').slideDown('slow');
543
  $('#list_all_posts').removeAttr('disabled');
544
  return;
545
  }
546
+ var speed = parseInt($('select[name="speed"]').val());
547
  post_id = new Array;
548
+ $('body').data('speed', speed);
549
  var data = 'action=save_remote_images_after_scan';
550
  for (var p=r; p<r+speed; p++) {
551
  if (typeof respond[p] != 'undefined') data += '&post_id[]='+respond[p];
552
  }
553
+ console.log(data);
554
  $.ajax({
555
  type: 'POST',
556
  url: ajaxurl,
561
  data.hide().fadeIn('fast');
562
  r += speed;
563
  QQWorld_auto_save_images.scan(respond, r);
564
+ },
565
+ error: QQWorld_auto_save_images.catch_errors
566
  });
567
  };
568
  QQWorld_auto_save_images.list = function(respond, r) {
569
  var $ = jQuery;
570
+ $('body').data('scan-mode', 'list').data('r', r);
571
  if (typeof respond[r] == 'undefined') {
572
  $('#scan-result').effect( 'shake', null, 500 );
573
  $('#form').slideDown('slow');
601
  $('#list_all_posts').removeAttr('disabled');
602
  return;
603
  }
604
+ var speed = parseInt($('select[name="speed"]').val());
605
  post_id = new Array;
606
+ $('body').data('speed', speed);
607
  var data = 'action=save_remote_images_list_all_posts';
608
  for (var p=r; p<r+speed; p++) {
609
  if (typeof respond[p] != 'undefined') data += '&post_id[]='+respond[p];
610
  }
611
+ console.log(data);
612
  $.ajax({
613
  type: 'POST',
614
  url: ajaxurl,
620
  r += speed;
621
  QQWorld_auto_save_images.list(respond, r);
622
  },
623
+ error: QQWorld_auto_save_images.catch_errors
 
 
 
 
 
624
  });
625
  };
626
  QQWorld_auto_save_images.if_not_select_post_type = function() {
676
  data: data,
677
  dataType: 'json',
678
  success: function(respond) {
679
+ QQWorld_auto_save_images.respond = respond;
680
  $('#scan-result').html('<table id="scan_old_post_list">\
681
  \ <thead>\
682
  \ <th><?php _e('ID'); ?></th>\
693
  layout: 'center',
694
  dismissQueue: true
695
  }) );
696
+ QQWorld_auto_save_images.scan(QQWorld_auto_save_images.respond, 0);
697
+ },
698
+ error: QQWorld_auto_save_images.catch_errors
699
  });
700
  }
701
  },
722
  data: data,
723
  dataType: 'json',
724
  success: function(respond) {
725
+ $('body').data('respond', respond);
726
  $('#scan-result').html('<table id="scan_old_post_list">\
727
  \ <thead>\
728
  \ <th><?php _e('ID'); ?></th>\
741
  dismissQueue: true
742
  }) );
743
  QQWorld_auto_save_images.list(respond, 0);
744
+ },
745
+ error: QQWorld_auto_save_images.catch_errors
746
  });
747
  } else QQWorld_auto_save_images.if_not_select_post_type();
748
  });
757
  data: data,
758
  success: function(data) {
759
  $('#list-'+post_id).html('<span class="green"><?php _e('Done'); ?></span>');
760
+ },
761
+ error: QQWorld_auto_save_images.catch_errors
762
  });
763
  })
764
  };