Disqus Comment System - Version 2.67

Version Description

Download this release

Release Info

Developer Disqus
Plugin Icon Disqus Comment System
Version 2.67
Comparing to
See all releases

Code changes from version 2.66 to 2.67

comments.php CHANGED
@@ -5,7 +5,7 @@ if (DISQUS_DEBUG) {
5
  ?>
6
 
7
  <div id="disqus_thread">
8
- <?php if (!get_option('disqus_disable_ssr')): ?>
9
  <?php
10
  // if (is_file(TEMPLATEPATH . '/comments.php')) {
11
  // include(TEMPLATEPATH . '/comments.php');
5
  ?>
6
 
7
  <div id="disqus_thread">
8
+ <?php if (!get_option('disqus_disable_ssr') && !empty($comments)): ?>
9
  <?php
10
  // if (is_file(TEMPLATEPATH . '/comments.php')) {
11
  // include(TEMPLATEPATH . '/comments.php');
disqus.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Disqus Comment System
4
  Plugin URI: http://disqus.com/
5
  Description: The Disqus comment system replaces your WordPress comment system with your comments hosted and powered by Disqus. Head over to the Comments admin page to set up your DISQUS Comment System.
6
  Author: Disqus <team@disqus.com>
7
- Version: 2.66
8
  Author URI: http://disqus.com/
9
  */
10
 
@@ -17,8 +17,8 @@ Author URI: http://disqus.com/
17
  require_once(dirname(__FILE__) . '/lib/wp-api.php');
18
 
19
  if (defined('DISQUS_LOCAL')) { // DISQUS defines this for local development purposes
20
- define('DISQUS_DOMAIN', 'disqus.com');
21
- define('DISQUS_IMPORTER_URL', 'http://import.disqus.com/');
22
  } else {
23
  define('DISQUS_DOMAIN', 'disqus.com');
24
  define('DISQUS_IMPORTER_URL', 'http://import.disqus.com/');
@@ -31,7 +31,7 @@ define('DISQUS_CAN_EXPORT', is_file(dirname(__FILE__) . '/export.php'));
31
  if (!defined('DISQUS_DEBUG')) {
32
  define('DISQUS_DEBUG', false);
33
  }
34
- define('DISQUS_VERSION', '2.66');
35
 
36
  /**
37
  * Returns an array of all option identifiers used by DISQUS.
@@ -39,6 +39,8 @@ define('DISQUS_VERSION', '2.66');
39
  */
40
  function dsq_options() {
41
  return array(
 
 
42
  # render disqus in the embed
43
  'disqus_active',
44
  'disqus_public_key',
@@ -286,7 +288,7 @@ function dsq_sync_comments($comments) {
286
  }
287
  $commentdata = array(
288
  'comment_post_ID' => $thread_map[$comment->thread->id],
289
- 'comment_date' => $comment->created_at,
290
  'comment_date_gmt' => $comment->created_at,
291
  'comment_content' => apply_filters('pre_comment_content', $comment->message),
292
  'comment_approved' => $approved,
@@ -385,8 +387,14 @@ function dsq_request_handler() {
385
  header("HTTP/1.0 400 Bad Request");
386
  die();
387
  }
388
- // schedule the event for 30 seconds from now in case they
389
  // happen to make a quick post
 
 
 
 
 
 
390
  if (DISQUS_DEBUG) {
391
  dsq_sync_post($post_id);
392
  $response = dsq_sync_forum();
@@ -397,8 +405,8 @@ function dsq_request_handler() {
397
  die('// synced '.$comments.' comments');
398
  }
399
  } else {
400
- wp_schedule_single_event(time(), 'dsq_sync_post', array($post_id));
401
- wp_schedule_single_event(time(), 'dsq_sync_forum');
402
  die('// sync scheduled');
403
  }
404
  break;
@@ -466,13 +474,15 @@ function dsq_request_handler() {
466
  if (!isset($_GET['last_comment_id'])) $last_comment_id = false;
467
  else $last_comment_id = $_GET['last_comment_id'];
468
 
 
 
469
  if ($_GET['wipe'] == '1') {
470
  $wpdb->query("DELETE FROM `".$wpdb->prefix."commentmeta` WHERE meta_key IN ('dsq_post_id', 'dsq_parent_post_id')");
471
  $wpdb->query("DELETE FROM `".$wpdb->prefix."comments` WHERE comment_agent LIKE 'Disqus/%%'");
472
  }
473
 
474
  ob_start();
475
- $response = dsq_sync_forum($last_comment_id);
476
  $debug = ob_get_clean();
477
  if (!$response) {
478
  $status = 'error';
@@ -503,6 +513,14 @@ function dsq_request_handler() {
503
 
504
  add_action('init', 'dsq_request_handler');
505
 
 
 
 
 
 
 
 
 
506
  function dsq_sync_post($post_id) {
507
  global $dsq_api, $wpdb;
508
 
@@ -512,11 +530,30 @@ function dsq_sync_post($post_id) {
512
  dsq_update_permalink($post);
513
  }
514
 
515
- add_action('dsq_sync_post', 'dsq_sync_post');
516
-
517
- function dsq_sync_forum($last_comment_id=false) {
518
  global $dsq_api, $wpdb;
519
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
  if ($last_comment_id === false) {
521
  $last_comment_id = get_option('disqus_last_comment_id');
522
  if (!$last_comment_id) {
@@ -548,6 +585,7 @@ function dsq_sync_forum($last_comment_id=false) {
548
  }
549
  }
550
  unset($comment);
 
551
  return array($total, $last_comment_id);
552
  }
553
 
@@ -827,7 +865,7 @@ function dsq_dash_comment_counts() {
827
  </style>
828
  <script type="text/javascript">
829
  jQuery(function($) {
830
- $('#dashboard_right_now').find('.b-comments a').html('<?php echo $stats->total_comments; ?>').end().find('.b_approved a').html('<?php echo $stats->approved; ?>').end().find('.b-waiting a').html('<?php echo $stats->moderated; ?>').end().find('.b-spam a').html('<?php echo $stats->spam; ?>').end().find('.inside').slideDown();
831
  $('#dashboard_recent_comments div.trackback').remove();
832
  $('#dashboard_right_now .inside table td.last a, #dashboard_recent_comments .inside .textright a.button').attr('href', 'edit-comments.php?page=disqus');
833
  });
@@ -933,13 +971,14 @@ dsq_fire_import = function() {
933
  var $ = jQuery;
934
  $('#dsq_import a.button, #dsq_import_retry').unbind().click(function() {
935
  var wipe = $('#dsq_import_wipe').is(':checked');
 
936
  $('#dsq_import').html('<p class="status"></p>');
937
  $('#dsq_import .status').removeClass('dsq-import-fail').addClass('dsq-importing').html('Processing...');
938
- dsq_import_comments(wipe);
939
  return false;
940
  });
941
  }
942
- dsq_import_comments = function(wipe) {
943
  var $ = jQuery;
944
  var status = $('#dsq_import .status');
945
  var last_comment_id = status.attr('rel') || '0';
@@ -948,7 +987,8 @@ dsq_import_comments = function(wipe) {
948
  {
949
  cf_action: 'import_comments',
950
  last_comment_id: last_comment_id,
951
- wipe: (wipe ? 1 : 0)
 
952
  },
953
  function(response) {
954
  switch (response.result) {
4
  Plugin URI: http://disqus.com/
5
  Description: The Disqus comment system replaces your WordPress comment system with your comments hosted and powered by Disqus. Head over to the Comments admin page to set up your DISQUS Comment System.
6
  Author: Disqus <team@disqus.com>
7
+ Version: 2.67
8
  Author URI: http://disqus.com/
9
  */
10
 
17
  require_once(dirname(__FILE__) . '/lib/wp-api.php');
18
 
19
  if (defined('DISQUS_LOCAL')) { // DISQUS defines this for local development purposes
20
+ define('DISQUS_DOMAIN', 'dev.disqus.org:8000');
21
+ define('DISQUS_IMPORTER_URL', 'http://dev.disqus.org:8001/');
22
  } else {
23
  define('DISQUS_DOMAIN', 'disqus.com');
24
  define('DISQUS_IMPORTER_URL', 'http://import.disqus.com/');
31
  if (!defined('DISQUS_DEBUG')) {
32
  define('DISQUS_DEBUG', false);
33
  }
34
+ define('DISQUS_VERSION', '2.67');
35
 
36
  /**
37
  * Returns an array of all option identifiers used by DISQUS.
39
  */
40
  function dsq_options() {
41
  return array(
42
+ '_disqus_sync_lock',
43
+ '_disqus_sync_post_ids',
44
  # render disqus in the embed
45
  'disqus_active',
46
  'disqus_public_key',
288
  }
289
  $commentdata = array(
290
  'comment_post_ID' => $thread_map[$comment->thread->id],
291
+ 'comment_date' => date('Y-m-d\TH:i:s', strtotime($comment->created_at) + (get_option('gmt_offset') * 3600)),
292
  'comment_date_gmt' => $comment->created_at,
293
  'comment_content' => apply_filters('pre_comment_content', $comment->message),
294
  'comment_approved' => $approved,
387
  header("HTTP/1.0 400 Bad Request");
388
  die();
389
  }
390
+ // schedule the event for 5 minutes from now in case they
391
  // happen to make a quick post
392
+ $post_ids = dsq_get_pending_post_ids();
393
+ if (!in_array($post_id, $post_ids)) {
394
+ $post_ids[] = $post_id;
395
+ update_option('_disqus_sync_post_ids', $post_ids);
396
+ }
397
+
398
  if (DISQUS_DEBUG) {
399
  dsq_sync_post($post_id);
400
  $response = dsq_sync_forum();
405
  die('// synced '.$comments.' comments');
406
  }
407
  } else {
408
+ $ts = time() + 300;
409
+ wp_schedule_single_event($ts, 'dsq_sync_forum');
410
  die('// sync scheduled');
411
  }
412
  break;
474
  if (!isset($_GET['last_comment_id'])) $last_comment_id = false;
475
  else $last_comment_id = $_GET['last_comment_id'];
476
 
477
+ $force = ($_GET['force'] == '1');
478
+
479
  if ($_GET['wipe'] == '1') {
480
  $wpdb->query("DELETE FROM `".$wpdb->prefix."commentmeta` WHERE meta_key IN ('dsq_post_id', 'dsq_parent_post_id')");
481
  $wpdb->query("DELETE FROM `".$wpdb->prefix."comments` WHERE comment_agent LIKE 'Disqus/%%'");
482
  }
483
 
484
  ob_start();
485
+ $response = dsq_sync_forum($last_comment_id, $force);
486
  $debug = ob_get_clean();
487
  if (!$response) {
488
  $status = 'error';
513
 
514
  add_action('init', 'dsq_request_handler');
515
 
516
+ function dsq_get_pending_post_ids() {
517
+ $post_ids = get_option('_disqus_sync_post_ids');
518
+ if (empty($post_ids)) {
519
+ return array();
520
+ }
521
+ return (array)$post_ids;
522
+ }
523
+
524
  function dsq_sync_post($post_id) {
525
  global $dsq_api, $wpdb;
526
 
530
  dsq_update_permalink($post);
531
  }
532
 
533
+ function dsq_sync_forum($last_comment_id=false, $force=false) {
 
 
534
  global $dsq_api, $wpdb;
535
 
536
+ if ($force) {
537
+ $sync_time = null;
538
+ } else {
539
+ $sync_time = (int)get_option('_disqus_sync_lock');
540
+ }
541
+
542
+ // lock expires after 1 day
543
+ if ($sync_time && $sync_time > time() - 86400) {
544
+ $dsq_api->api->last_error = 'Sync already in progress (lock found)';
545
+ return false;
546
+ } else {
547
+ update_option('_disqus_sync_lock', time());
548
+ }
549
+
550
+ // sync all pending posts
551
+ $post_ids = dsq_get_pending_post_ids();
552
+ delete_option('_disqus_sync_post_ids');
553
+ foreach ($post_ids as $post_id) {
554
+ dsq_sync_post($post_id);
555
+ }
556
+
557
  if ($last_comment_id === false) {
558
  $last_comment_id = get_option('disqus_last_comment_id');
559
  if (!$last_comment_id) {
585
  }
586
  }
587
  unset($comment);
588
+ delete_option('_disqus_sync_lock');
589
  return array($total, $last_comment_id);
590
  }
591
 
865
  </style>
866
  <script type="text/javascript">
867
  jQuery(function($) {
868
+ $('#dashboard_right_now').find('.b-comments a').html('<?php echo number_format($stats->total_comments); ?>').end().find('.b_approved a').html('<?php echo number_format($stats->approved); ?>').end().find('.b-waiting a').html('<?php echo number_format($stats->moderated); ?>').end().find('.b-spam a').html('<?php echo number_format($stats->spam); ?>').end().find('.inside').slideDown();
869
  $('#dashboard_recent_comments div.trackback').remove();
870
  $('#dashboard_right_now .inside table td.last a, #dashboard_recent_comments .inside .textright a.button').attr('href', 'edit-comments.php?page=disqus');
871
  });
971
  var $ = jQuery;
972
  $('#dsq_import a.button, #dsq_import_retry').unbind().click(function() {
973
  var wipe = $('#dsq_import_wipe').is(':checked');
974
+ var force = $('#dsq_import_force').is(':checked');
975
  $('#dsq_import').html('<p class="status"></p>');
976
  $('#dsq_import .status').removeClass('dsq-import-fail').addClass('dsq-importing').html('Processing...');
977
+ dsq_import_comments(wipe, force);
978
  return false;
979
  });
980
  }
981
+ dsq_import_comments = function(wipe, force) {
982
  var $ = jQuery;
983
  var status = $('#dsq_import .status');
984
  var last_comment_id = status.attr('rel') || '0';
987
  {
988
  cf_action: 'import_comments',
989
  last_comment_id: last_comment_id,
990
+ wipe: (wipe ? 1 : 0),
991
+ force: (force ? 1 : 0)
992
  },
993
  function(response) {
994
  switch (response.result) {
lib/api/LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2010 DISQUS
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
lib/api/README.rst ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Disqus API 1.1
2
+
3
+ Please see http://groups.google.com/group/disqus-dev/web/api-1-1 for more information.
4
+
5
+ Sample usage::
6
+
7
+ require('disqus/disqus.php');
8
+
9
+ $dsq = new DisqusAPI($user_api_key, $forum_api_key);
10
+ if (($username = $dsq->get_user_name()) === false)
11
+ {
12
+ throw new Exception($dsq->get_last_error());
13
+ }
14
+
15
+
16
+ To run the included unit tests you will need to install PHPUnit::
17
+
18
+ php disqus/tests.php <your user_api_key>
lib/api/disqus/disqus.php CHANGED
@@ -155,6 +155,8 @@ class DisqusAPI {
155
  }
156
  return false;
157
  }
 
 
158
 
159
  return $data->message;
160
  }
155
  }
156
  return false;
157
  }
158
+
159
+ $this->last_error = null;
160
 
161
  return $data->message;
162
  }
lib/wp-cli.php CHANGED
@@ -4,6 +4,14 @@
4
  */
5
  error_reporting(E_ALL | E_STRICT);
6
 
 
 
 
 
 
 
 
 
7
  if (!isset($argv)) {
8
  $argv = array();
9
  }
@@ -69,4 +77,4 @@ class DummyWP_Object_Cache extends WP_Object_Cache {
69
 
70
  $wp_object_cache = new DummyWP_Object_Cache();
71
 
72
- ?>
4
  */
5
  error_reporting(E_ALL | E_STRICT);
6
 
7
+ var_dump($_SERVER);
8
+
9
+
10
+ if (php_sapi_name() != 'cli' && !empty($_SERVER['REMOTE_ADDR'])) {
11
+ // Don't execute for web requests
12
+ die("This script must be run from CLI.");
13
+ }
14
+
15
  if (!isset($argv)) {
16
  $argv = array();
17
  }
77
 
78
  $wp_object_cache = new DummyWP_Object_Cache();
79
 
80
+ ?>
locales/default.mo ADDED
Binary file
locales/default.po ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: disqus-wordpress\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2010-08-25 12:46-0800\n"
6
+ "PO-Revision-Date: 2010-08-25 12:46-0800\n"
7
+ "Last-Translator: David Cramer <dcramer@gmail.com>\n"
8
+ "Language-Team: DISQUS <team@disqus.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: _;gettext;gettext_noop;dsq_i;__;_e\n"
13
+ "X-Poedit-Basepath: ../\n"
14
+ "X-Poedit-SearchPath-0: ..\n"
15
+
16
+ #: ../disqus/disqus.php:326
17
+ #, php-format
18
+ msgid "Processed comments on post #%s&hellip;"
19
+ msgstr ""
20
+
21
+ #: ../disqus/disqus.php:329
22
+ #, php-format
23
+ msgid "Processed comments on posts #%s-%s&hellip;"
24
+ msgstr ""
25
+
26
+ #: ../disqus/disqus.php:340
27
+ #, php-format
28
+ msgid "Sorry, something unexpected happened with the export. Please <a href=\"#\" id=\"dsq_export_retry\">try again</a></p><p>If your API key has changed, you may need to reinstall Disqus (deactivate the plugin and then reactivate it). If you are still having issues, refer to the <a href=\"%s\" onclick=\"window.open(this.href); return false\">WordPress help page</a>."
29
+ msgstr ""
30
+
31
+ #: ../disqus/disqus.php:345
32
+ #, php-format
33
+ msgid "Your comments have been sent to Disqus and queued for import!<br/><a href=\"%s\" target=\"_blank\">See the status of your import at Disqus</a>"
34
+ msgstr ""
35
+
36
+ #: ../disqus/disqus.php:386
37
+ msgid "Your comments have been downloaded from Disqus and saved in your local database."
38
+ msgstr ""
39
+
40
+ #: ../disqus/disqus.php:391
41
+ #, php-format
42
+ msgid "Imported comments on post #%s&hellip;"
43
+ msgstr ""
44
+
45
+ #: ../disqus/disqus.php:394
46
+ #, php-format
47
+ msgid "Imported comments on posts #%s-%s&hellip;"
48
+ msgstr ""
49
+
50
+ #: ../disqus/disqus.php:647
51
+ msgid "Settings"
52
+ msgstr ""
53
+
54
+ #: ../disqus/manage.php:48
55
+ msgid "There was an error completing the installation of Disqus. If you are still having issues, refer to the <a href=\"http://disqus.com/help/wordpress\">WordPress help page</a>."
56
+ msgstr ""
57
+
58
+ #: ../disqus/manage.php:105
59
+ #: ../disqus/manage.php:199
60
+ msgid "Advanced Options"
61
+ msgstr ""
62
+
63
+ #: ../disqus/manage.php:114
64
+ #: ../disqus/manage.php:148
65
+ msgid "Install Disqus Comments"
66
+ msgstr ""
67
+
68
+ #: ../disqus/manage.php:120
69
+ msgid "Select a website"
70
+ msgstr ""
71
+
72
+ #: ../disqus/manage.php:132
73
+ msgid "Or register a new one on the Disqus website."
74
+ msgstr ""
75
+
76
+ #: ../disqus/manage.php:154
77
+ msgid "Username"
78
+ msgstr ""
79
+
80
+ #: ../disqus/manage.php:157
81
+ msgid "(don't have a Disqus Profile yet?)"
82
+ msgstr ""
83
+
84
+ #: ../disqus/manage.php:161
85
+ msgid "Password"
86
+ msgstr ""
87
+
88
+ #: ../disqus/manage.php:164
89
+ msgid "(forgot your password?)"
90
+ msgstr ""
91
+
92
+ #: ../disqus/manage.php:182
93
+ msgid "Comments"
94
+ msgstr ""
95
+
96
+ #: ../disqus/manage.php:200
97
+ #, php-format
98
+ msgid "Version: %s"
99
+ msgstr ""
100
+
101
+ #: ../disqus/manage.php:205
102
+ msgid "Disqus short name"
103
+ msgstr ""
104
+
105
+ #: ../disqus/manage.php:209
106
+ msgid "This is the unique identifier for your website on Disqus Comments."
107
+ msgstr ""
108
+
109
+ #: ../disqus/manage.php:214
110
+ msgid "Disqus API Key"
111
+ msgstr ""
112
+
113
+ #: ../disqus/manage.php:218
114
+ #: ../disqus/manage.php:227
115
+ msgid "This is set for you when going through the installation steps."
116
+ msgstr ""
117
+
118
+ #: ../disqus/manage.php:223
119
+ msgid "Disqus User API Key"
120
+ msgstr ""
121
+
122
+ #: ../disqus/manage.php:232
123
+ msgid "Disqus Partner Key"
124
+ msgstr ""
125
+
126
+ #: ../disqus/manage.php:236
127
+ #, php-format
128
+ msgid "Advanced: Used for single sign-on (SSO) integration. (<a href=\"%s\" onclick=\"window.open(this.href); return false\">more info on SSO</a>)"
129
+ msgstr ""
130
+
131
+ #: ../disqus/manage.php:241
132
+ msgid "Use Disqus Comments on"
133
+ msgstr ""
134
+
135
+ #: ../disqus/manage.php:244
136
+ msgid "On all existing and future blog posts."
137
+ msgstr ""
138
+
139
+ #: ../disqus/manage.php:245
140
+ msgid "Only on blog posts with closed comments."
141
+ msgstr ""
142
+
143
+ #: ../disqus/manage.php:248
144
+ msgid "NOTE: Your WordPress comments will never be lost."
145
+ msgstr ""
146
+
147
+ #: ../disqus/manage.php:253
148
+ msgid "Comment Counts"
149
+ msgstr ""
150
+
151
+ #: ../disqus/manage.php:256
152
+ msgid "Output JavaScript in footer"
153
+ msgstr ""
154
+
155
+ #: ../disqus/manage.php:257
156
+ #, php-format
157
+ msgid "NOTE: Check this if you have problems with the comment count displays including: not showing on permalinks, broken featured image carousels, or longer-than-usual homepage load times (<a href=\"%s\" onclick=\"window.open(this.href); return false\">more info</a>)."
158
+ msgstr ""
159
+
160
+ #: ../disqus/manage.php:262
161
+ msgid "Comment Sync"
162
+ msgstr ""
163
+
164
+ #: ../disqus/manage.php:265
165
+ msgid "Disable automated comment importing"
166
+ msgstr ""
167
+
168
+ #: ../disqus/manage.php:266
169
+ msgid "NOTE: If you have problems with WP cron taking too long and large numbers of comments you may wish to disable the automated sync cron. Keep in mind that this means comments will not automatically get synced to your local Wordpress database."
170
+ msgstr ""
171
+
172
+ #: ../disqus/manage.php:280
173
+ msgid "Export comments to Disqus"
174
+ msgstr ""
175
+
176
+ #: ../disqus/manage.php:283
177
+ msgid "Export Comments"
178
+ msgstr ""
179
+
180
+ #: ../disqus/manage.php:283
181
+ msgid "This will sync your WordPress comments with Disqus"
182
+ msgstr ""
183
+
184
+ #: ../disqus/manage.php:289
185
+ msgid "Sync Disqus with WordPress"
186
+ msgstr ""
187
+
188
+ #: ../disqus/manage.php:292
189
+ msgid "Sync Comments"
190
+ msgstr ""
191
+
192
+ #: ../disqus/manage.php:292
193
+ msgid "This will download your Disqus comments and store them locally in WordPress"
194
+ msgstr ""
195
+
196
+ #: ../disqus/manage.php:297
197
+ msgid "Uninstall Disqus Comments"
198
+ msgstr ""
199
+
200
+ #: ../disqus/manage.php:301
201
+ msgid "Are you sure you want to uninstall Disqus?"
202
+ msgstr ""
203
+
204
+ #: ../disqus/manage.php:308
205
+ msgid "Debug Information"
206
+ msgstr ""
207
+
208
+ #: ../disqus/manage.php:309
209
+ #, php-format
210
+ msgid "Having problems with the plugin? <a href=\"%s\">Drop us a line</a> and include the following details and we'll do what we can."
211
+ msgstr ""
212
+
locales/index.html ADDED
File without changes
manage.php CHANGED
@@ -375,8 +375,12 @@ case 0:
375
  <th scope="row" valign="top"><?php echo dsq_i('Sync Disqus with WordPress'); ?></th>
376
  <td>
377
  <div id="dsq_import">
378
- <p class="status"><a href="#" class="button"><?php echo dsq_i('Sync Comments'); ?></a> <label><input type="checkbox" id="dsq_import_wipe" name="dsq_import_wipe" value="1"/> <?php echo dsq_i('Remove all imported Disqus comments before syncing.'); ?></label><br/><br/>
379
- <?php echo dsq_i('This will download your Disqus comments and store them locally in WordPress'); ?></p>
 
 
 
 
380
  </div>
381
  </td>
382
  </tr>
375
  <th scope="row" valign="top"><?php echo dsq_i('Sync Disqus with WordPress'); ?></th>
376
  <td>
377
  <div id="dsq_import">
378
+ <div class="status">
379
+ <p><?php echo dsq_i('This will download your Disqus comments and store them locally in WordPress'); ?></p>
380
+ <label><input type="checkbox" id="dsq_import_wipe" name="dsq_import_wipe" value="1"/> <?php echo dsq_i('Remove all imported Disqus comments before syncing.'); ?></label><br/>
381
+ <label><input type="checkbox" id="dsq_import_force" name="dsq_import_force" value="1"/> <?php echo dsq_i('Force the sync task even if it\'s already in progress.'); ?></label><br/>
382
+ <p><a href="#" class="button"><?php echo dsq_i('Sync Comments'); ?></a></p>
383
+ </div>
384
  </div>
385
  </td>
386
  </tr>
media/styles/manage.css CHANGED
@@ -28,8 +28,8 @@ select.disqus-replace {
28
  }
29
 
30
  .dsq-content h2 {
31
- background: url(../media/images/logo.png) no-repeat;
32
  line-height: 41px;
33
  margin: 15px 0 10px;
34
  padding: 0 0 0 150px;
35
- }
28
  }
29
 
30
  .dsq-content h2 {
31
+ background: url(../../media/images/logo.png) no-repeat;
32
  line-height: 41px;
33
  margin: 15px 0 10px;
34
  padding: 0 0 0 150px;
35
+ }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: disqus, alexkingorg, crowdfavorite
3
  Tags: comments, threaded, email, notification, spam, avatars, community, profile, widget, disqus
4
  Requires at least: 2.8
5
  Tested up to: 3.1.2
6
- Stable tag: 2.66
7
 
8
  The Disqus comment system replaces your WordPress comment system with your comments hosted and powered by Disqus.
9
 
@@ -43,7 +43,7 @@ The Disqus for WordPress plugin seamlessly integrates using the Disqus API and b
43
  of WordPress
44
 
45
  * Maintain the directory structure of the archive (all extracted files
46
- should exist in 'wp-content/plugins/disqus/'
47
 
48
  2. From your blog administration, click on Comments to change settings
49
  (WordPress 2.0 users can find the settings under Options > Disqus.)
@@ -52,15 +52,17 @@ The Disqus for WordPress plugin seamlessly integrates using the Disqus API and b
52
 
53
  Go to [http://disqus.com/help/wordpress](http://disqus.com/help/wordpress)
54
 
55
- == Upgrading ==
56
-
57
- (If you were using legacy mode you will need to re-install the plugin completely)
58
 
59
- Replace the old plugin with the new plugin (the plugin must stay in
60
- the disqus directory). If the old plugin directory was 'disqus-comment-system'
61
- you should remove it, and the new plugin should be stored in 'disqus'.
62
 
63
- == Changes ==
 
 
 
 
 
 
64
 
65
  2.66
66
 
3
  Tags: comments, threaded, email, notification, spam, avatars, community, profile, widget, disqus
4
  Requires at least: 2.8
5
  Tested up to: 3.1.2
6
+ Stable tag: 2.67
7
 
8
  The Disqus comment system replaces your WordPress comment system with your comments hosted and powered by Disqus.
9
 
43
  of WordPress
44
 
45
  * Maintain the directory structure of the archive (all extracted files
46
+ should exist in 'wp-content/plugins/disqus-comment-system/'
47
 
48
  2. From your blog administration, click on Comments to change settings
49
  (WordPress 2.0 users can find the settings under Options > Disqus.)
52
 
53
  Go to [http://disqus.com/help/wordpress](http://disqus.com/help/wordpress)
54
 
55
+ == Changes ==
 
 
56
 
57
+ 2.67
 
 
58
 
59
+ * Bumped synchronization timer delays to 5 minutes.
60
+ * wp-cli.php now requires php_sapi_name to be set to 'cli' for execution.
61
+ * Fixed a bug with imported comments not storing the correct relative date.
62
+ * Added a lock for dsq_sync_forum, which can be overriden in the command line script
63
+ with the --force tag.
64
+ * dsq_sync_forum will now handle all pending post metadata updates (formerly a separate
65
+ cron task, dsq_sync_post).
66
 
67
  2.66
68
 
scripts/import-comments.php CHANGED
@@ -26,13 +26,14 @@ if (in_array('--reset', $argv)) {
26
  } else {
27
  $last_comment_id = get_option('disqus_last_comment_id');
28
  }
 
29
  $total = 0;
30
  $global_start = microtime();
31
 
32
  while ($imported) {
33
  print_line(' Importing chunk starting at comment id %d', $last_comment_id);
34
  $start = microtime();
35
- $result = dsq_sync_forum($last_comment_id);
36
  if ($result === false) {
37
  print_line('---------------------------------------------------------');
38
  print_line('There was an error communicating with DISQUS!');
26
  } else {
27
  $last_comment_id = get_option('disqus_last_comment_id');
28
  }
29
+ $force = (in_array('--force', $argv));
30
  $total = 0;
31
  $global_start = microtime();
32
 
33
  while ($imported) {
34
  print_line(' Importing chunk starting at comment id %d', $last_comment_id);
35
  $start = microtime();
36
+ $result = dsq_sync_forum($last_comment_id, $force);
37
  if ($result === false) {
38
  print_line('---------------------------------------------------------');
39
  print_line('There was an error communicating with DISQUS!');