Version Description
Download this release
Release Info
Developer | Disqus |
Plugin | Disqus Comment System |
Version | 2.60 |
Comparing to | |
See all releases |
Code changes from version 2.52 to 2.60
- comments.php +8 -0
- disqus.php +34 -14
- lib/api/disqus/url.php +5 -1
- manage.php +28 -2
- readme.txt +18 -1
comments.php
CHANGED
@@ -69,6 +69,14 @@ if (DISQUS_DEBUG) {
|
|
69 |
DISQUS.request.get('?cf_action=sync_comments&post_id=<?php echo $post->ID; ?>');
|
70 |
});
|
71 |
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
};
|
73 |
var facebookXdReceiverPath = '<?php echo DSQ_PLUGIN_URL . '/xd_receiver.htm' ?>';
|
74 |
/* ]]> */
|
69 |
DISQUS.request.get('?cf_action=sync_comments&post_id=<?php echo $post->ID; ?>');
|
70 |
});
|
71 |
<?php endif; ?>
|
72 |
+
<?php
|
73 |
+
$sso = dsq_sso();
|
74 |
+
if ($sso) {
|
75 |
+
foreach ($sso as $k=>$v) {
|
76 |
+
echo "this.page.{$k} = '{$v}';\n";
|
77 |
+
}
|
78 |
+
}
|
79 |
+
?>
|
80 |
};
|
81 |
var facebookXdReceiverPath = '<?php echo DSQ_PLUGIN_URL . '/xd_receiver.htm' ?>';
|
82 |
/* ]]> */
|
disqus.php
CHANGED
@@ -4,33 +4,31 @@ 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.
|
8 |
Author URI: http://disqus.com/
|
9 |
*/
|
10 |
|
11 |
require_once(dirname(__FILE__) . '/lib/wpapi.php');
|
12 |
|
13 |
-
define('DISQUS_URL', 'http://disqus.com/');
|
14 |
-
define('DISQUS_API_URL', DISQUS_URL . 'api/');
|
15 |
-
|
16 |
-
|
17 |
define('DISQUS_URL', 'http://disqus.com/');
|
18 |
define('DISQUS_API_URL', DISQUS_URL . 'api/');
|
19 |
define('DISQUS_DOMAIN', 'disqus.com');
|
20 |
-
define('DISQUS_IMPORTER_URL', 'http://import.disqus.
|
21 |
define('DISQUS_MEDIA_URL', 'http://disqus.com/media/');
|
22 |
define('DISQUS_RSS_PATH', '/latest.rss');
|
23 |
define('DISQUS_CAN_EXPORT', is_file(dirname(__FILE__) . '/export.php'));
|
24 |
if (!defined('DISQUS_DEBUG')) {
|
25 |
define('DISQUS_DEBUG', false);
|
26 |
}
|
27 |
-
define('DISQUS_VERSION', '2.
|
28 |
|
29 |
/**
|
30 |
* Returns an array of all option identifiers used by DISQUS.
|
31 |
*/
|
32 |
function dsq_options() {
|
33 |
return array(
|
|
|
|
|
34 |
'disqus_forum_url',
|
35 |
'disqus_api_key',
|
36 |
'disqus_user_api_key',
|
@@ -690,7 +688,17 @@ function dsq_comments_template($value) {
|
|
690 |
}
|
691 |
|
692 |
// Mark entries in index to replace comments link.
|
693 |
-
function dsq_comments_number($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
694 |
global $post;
|
695 |
|
696 |
if ( dsq_can_replace() ) {
|
@@ -1112,7 +1120,8 @@ add_action('admin_notices', 'dsq_warning');
|
|
1112 |
|
1113 |
// Only replace comments if the disqus_forum_url option is set.
|
1114 |
add_filter('comments_template', 'dsq_comments_template');
|
1115 |
-
add_filter('comments_number', '
|
|
|
1116 |
add_filter('bloginfo_url', 'dsq_bloginfo_url');
|
1117 |
|
1118 |
/**
|
@@ -1210,8 +1219,15 @@ if(!function_exists('cf_json_encode')) {
|
|
1210 |
// Single Sign-on Integration
|
1211 |
|
1212 |
function dsq_sso() {
|
1213 |
-
if (
|
1214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1215 |
}
|
1216 |
global $current_user, $dsq_api;
|
1217 |
get_currentuserinfo();
|
@@ -1232,12 +1248,16 @@ function dsq_sso() {
|
|
1232 |
}
|
1233 |
$user_data = base64_encode(cf_json_encode($user_data));
|
1234 |
$time = time();
|
1235 |
-
$hmac = dsq_hmacsha1($user_data.' '.$time, $
|
1236 |
|
1237 |
$payload = $user_data.' '.$hmac.' '.$time;
|
1238 |
-
|
|
|
|
|
|
|
|
|
|
|
1239 |
}
|
1240 |
-
add_action('wp_head', 'dsq_sso');
|
1241 |
|
1242 |
// from: http://www.php.net/manual/en/function.sha1.php#39492
|
1243 |
//Calculate HMAC-SHA1 according to RFC2104
|
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.60
|
8 |
Author URI: http://disqus.com/
|
9 |
*/
|
10 |
|
11 |
require_once(dirname(__FILE__) . '/lib/wpapi.php');
|
12 |
|
|
|
|
|
|
|
|
|
13 |
define('DISQUS_URL', 'http://disqus.com/');
|
14 |
define('DISQUS_API_URL', DISQUS_URL . 'api/');
|
15 |
define('DISQUS_DOMAIN', 'disqus.com');
|
16 |
+
define('DISQUS_IMPORTER_URL', 'http://import.disqus.com/');
|
17 |
define('DISQUS_MEDIA_URL', 'http://disqus.com/media/');
|
18 |
define('DISQUS_RSS_PATH', '/latest.rss');
|
19 |
define('DISQUS_CAN_EXPORT', is_file(dirname(__FILE__) . '/export.php'));
|
20 |
if (!defined('DISQUS_DEBUG')) {
|
21 |
define('DISQUS_DEBUG', false);
|
22 |
}
|
23 |
+
define('DISQUS_VERSION', '2.60');
|
24 |
|
25 |
/**
|
26 |
* Returns an array of all option identifiers used by DISQUS.
|
27 |
*/
|
28 |
function dsq_options() {
|
29 |
return array(
|
30 |
+
'disqus_public_key',
|
31 |
+
'disqus_secret_key',
|
32 |
'disqus_forum_url',
|
33 |
'disqus_api_key',
|
34 |
'disqus_user_api_key',
|
688 |
}
|
689 |
|
690 |
// Mark entries in index to replace comments link.
|
691 |
+
function dsq_comments_number($count) {
|
692 |
+
global $post;
|
693 |
+
|
694 |
+
if ( dsq_can_replace() ) {
|
695 |
+
return '<span class="dsq-postid" rel="'.htmlspecialchars(dsq_identifier_for_post($post)).'">'.$count.'</span>';
|
696 |
+
} else {
|
697 |
+
return $count;
|
698 |
+
}
|
699 |
+
}
|
700 |
+
|
701 |
+
function dsq_comments_text($comment_text) {
|
702 |
global $post;
|
703 |
|
704 |
if ( dsq_can_replace() ) {
|
1120 |
|
1121 |
// Only replace comments if the disqus_forum_url option is set.
|
1122 |
add_filter('comments_template', 'dsq_comments_template');
|
1123 |
+
add_filter('comments_number', 'dsq_comments_text');
|
1124 |
+
add_filter('get_comments_number', 'dsq_comments_number');
|
1125 |
add_filter('bloginfo_url', 'dsq_bloginfo_url');
|
1126 |
|
1127 |
/**
|
1219 |
// Single Sign-on Integration
|
1220 |
|
1221 |
function dsq_sso() {
|
1222 |
+
if ($key = get_option('disqus_partner_key')) {
|
1223 |
+
// use old style SSO
|
1224 |
+
$new = false;
|
1225 |
+
} elseif (($key = get_option('disqus_secret_key')) && ($public = get_option('disqus_public_key'))) {
|
1226 |
+
// use new style SSO
|
1227 |
+
$new = true;
|
1228 |
+
} else {
|
1229 |
+
// sso is not configured
|
1230 |
+
return array();
|
1231 |
}
|
1232 |
global $current_user, $dsq_api;
|
1233 |
get_currentuserinfo();
|
1248 |
}
|
1249 |
$user_data = base64_encode(cf_json_encode($user_data));
|
1250 |
$time = time();
|
1251 |
+
$hmac = dsq_hmacsha1($user_data.' '.$time, $key);
|
1252 |
|
1253 |
$payload = $user_data.' '.$hmac.' '.$time;
|
1254 |
+
|
1255 |
+
if ($new) {
|
1256 |
+
return array('remote_auth_s3'=>$payload, 'api_key'=>$public);
|
1257 |
+
} else {
|
1258 |
+
return array('remote_auth_s2'=>$payload);
|
1259 |
+
}
|
1260 |
}
|
|
|
1261 |
|
1262 |
// from: http://www.php.net/manual/en/function.sha1.php#39492
|
1263 |
//Calculate HMAC-SHA1 according to RFC2104
|
lib/api/disqus/url.php
CHANGED
@@ -112,7 +112,11 @@ function _dsq_fsockopen_urlopen($url, $postdata, &$response, $file_name, $file_f
|
|
112 |
|
113 |
$fp = @fsockopen($url_pieces['host'], $url_pieces['port'], $errno, $errstr, SOCKET_TIMEOUT);
|
114 |
if(!$fp) { return false; }
|
115 |
-
|
|
|
|
|
|
|
|
|
116 |
$req .= 'Host: ' . $host . "\r\n";
|
117 |
$req .= dsq_get_http_headers_for_request($boundary, $postdata_str, $file_name, $file_field);
|
118 |
if($postdata_str) {
|
112 |
|
113 |
$fp = @fsockopen($url_pieces['host'], $url_pieces['port'], $errno, $errstr, SOCKET_TIMEOUT);
|
114 |
if(!$fp) { return false; }
|
115 |
+
|
116 |
+
$path = $url_pieces['path'];
|
117 |
+
if ($url_pieces['query']) $path .= '?'.$url_pieces['query'];
|
118 |
+
|
119 |
+
$req .= ($postdata_str ? 'POST' : 'GET') . ' ' . $path . " HTTP/1.1\r\n";
|
120 |
$req .= 'Host: ' . $host . "\r\n";
|
121 |
$req .= dsq_get_http_headers_for_request($boundary, $postdata_str, $file_name, $file_field);
|
122 |
if($postdata_str) {
|
manage.php
CHANGED
@@ -69,6 +69,8 @@ if ( isset($_POST['disqus_forum_url']) && isset($_POST['disqus_replace']) ) {
|
|
69 |
update_option('disqus_cc_fix', isset($_POST['disqus_cc_fix']));
|
70 |
update_option('disqus_manual_sync', isset($_POST['disqus_manual_sync']));
|
71 |
update_option('disqus_disable_ssr', isset($_POST['disqus_disable_ssr']));
|
|
|
|
|
72 |
dsq_manage_dialog('Your settings have been changed.');
|
73 |
}
|
74 |
|
@@ -215,7 +217,11 @@ case 0:
|
|
215 |
?>
|
216 |
<div class="dsq-main"<?php if ($show_advanced) echo ' style="display:none;"'; ?>>
|
217 |
<h2><?php echo dsq_i('Comments'); ?></h2>
|
218 |
-
<iframe src="<?php
|
|
|
|
|
|
|
|
|
219 |
</div>
|
220 |
<?php } ?>
|
221 |
</div>
|
@@ -229,6 +235,9 @@ case 0:
|
|
229 |
$dsq_cc_fix = get_option('disqus_cc_fix');
|
230 |
$dsq_manual_sync = get_option('disqus_manual_sync');
|
231 |
$dsq_disable_ssr = get_option('disqus_disable_ssr');
|
|
|
|
|
|
|
232 |
?>
|
233 |
<!-- Advanced options -->
|
234 |
<div id="dsq-advanced" class="dsq-content dsq-advanced"<?php if (!$show_advanced) echo ' style="display:none;"'; ?>>
|
@@ -264,7 +273,7 @@ case 0:
|
|
264 |
<?php echo dsq_i('This is set for you when going through the installation steps.'); ?>
|
265 |
</td>
|
266 |
</tr>
|
267 |
-
|
268 |
<tr>
|
269 |
<th scope="row" valign="top"><?php echo dsq_i('Disqus Partner Key'); ?></th>
|
270 |
<td>
|
@@ -273,6 +282,23 @@ case 0:
|
|
273 |
<?php echo dsq_i('Advanced: Used for single sign-on (SSO) integration. (<a href="%s" onclick="window.open(this.href); return false">more info on SSO</a>)', 'http://disqus.com/help/sso'); ?>
|
274 |
</td>
|
275 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
|
277 |
<tr>
|
278 |
<th scope="row" valign="top"><?php echo dsq_i('Use Disqus Comments on'); ?></th>
|
69 |
update_option('disqus_cc_fix', isset($_POST['disqus_cc_fix']));
|
70 |
update_option('disqus_manual_sync', isset($_POST['disqus_manual_sync']));
|
71 |
update_option('disqus_disable_ssr', isset($_POST['disqus_disable_ssr']));
|
72 |
+
update_option('disqus_public_key', $_POST['disqus_public_key']);
|
73 |
+
update_option('disqus_secret_key', $_POST['disqus_secret_key']);
|
74 |
dsq_manage_dialog('Your settings have been changed.');
|
75 |
}
|
76 |
|
217 |
?>
|
218 |
<div class="dsq-main"<?php if ($show_advanced) echo ' style="display:none;"'; ?>>
|
219 |
<h2><?php echo dsq_i('Comments'); ?></h2>
|
220 |
+
<iframe src="<?php if ($url) {
|
221 |
+
echo 'http://'.$url.'.'.DISQUS_DOMAIN.'/admin/moderate/';
|
222 |
+
} else {
|
223 |
+
echo DISQUS_URL.'admin/moderate/';
|
224 |
+
} ?>?template=wordpress" style="width: 100%; height: 800px"></iframe>
|
225 |
</div>
|
226 |
<?php } ?>
|
227 |
</div>
|
235 |
$dsq_cc_fix = get_option('disqus_cc_fix');
|
236 |
$dsq_manual_sync = get_option('disqus_manual_sync');
|
237 |
$dsq_disable_ssr = get_option('disqus_disable_ssr');
|
238 |
+
|
239 |
+
$dsq_public_key = get_option('disqus_public_key');
|
240 |
+
$dsq_secret_key = get_option('disqus_secret_key');
|
241 |
?>
|
242 |
<!-- Advanced options -->
|
243 |
<div id="dsq-advanced" class="dsq-content dsq-advanced"<?php if (!$show_advanced) echo ' style="display:none;"'; ?>>
|
273 |
<?php echo dsq_i('This is set for you when going through the installation steps.'); ?>
|
274 |
</td>
|
275 |
</tr>
|
276 |
+
<?php if (!empty($dsq_partner_key)) {// this option only shows if it was already present ?>
|
277 |
<tr>
|
278 |
<th scope="row" valign="top"><?php echo dsq_i('Disqus Partner Key'); ?></th>
|
279 |
<td>
|
282 |
<?php echo dsq_i('Advanced: Used for single sign-on (SSO) integration. (<a href="%s" onclick="window.open(this.href); return false">more info on SSO</a>)', 'http://disqus.com/help/sso'); ?>
|
283 |
</td>
|
284 |
</tr>
|
285 |
+
<?php } ?>
|
286 |
+
<tr>
|
287 |
+
<th scope="row" valign="top"><?php echo dsq_i('Application Public Key'); ?></th>
|
288 |
+
<td>
|
289 |
+
<input type="text" name="disqus_public_key" value="<?php echo esc_attr($dsq_public_key); ?>" tabindex="2">
|
290 |
+
<br />
|
291 |
+
<?php echo dsq_i('Advanced: Used for single sign-on (SSO) integration. (<a href="%s" onclick="window.open(this.href); return false">more info on SSO</a>)', 'http://docs.disqus.com/developers/sso/'); ?>
|
292 |
+
</td>
|
293 |
+
</tr>
|
294 |
+
<tr>
|
295 |
+
<th scope="row" valign="top"><?php echo dsq_i('Application Secret Key'); ?></th>
|
296 |
+
<td>
|
297 |
+
<input type="text" name="disqus_secret_key" value="<?php echo esc_attr($dsq_secret_key); ?>" tabindex="2">
|
298 |
+
<br />
|
299 |
+
<?php echo dsq_i('Advanced: Used for single sign-on (SSO) integration. (<a href="%s" onclick="window.open(this.href); return false">more info on SSO</a>)', 'http://docs.disqus.com/developers/sso/'); ?>
|
300 |
+
</td>
|
301 |
+
</tr>
|
302 |
|
303 |
<tr>
|
304 |
<th scope="row" valign="top"><?php echo dsq_i('Use Disqus Comments on'); ?></th>
|
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.0
|
6 |
-
Stable tag: 2.
|
7 |
|
8 |
The Disqus comment system replaces your WordPress comment system with your comments hosted and powered by Disqus.
|
9 |
|
@@ -62,6 +62,23 @@ you should remove it, and the new plugin should be stored in 'disqus'.
|
|
62 |
|
63 |
== Changes ==
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
2.52
|
66 |
|
67 |
* Fixed issue with Disqus-API package not getting updated (only affecting PHP4).
|
3 |
Tags: comments, threaded, email, notification, spam, avatars, community, profile, widget, disqus
|
4 |
Requires at least: 2.8
|
5 |
Tested up to: 3.0
|
6 |
+
Stable tag: 2.60
|
7 |
|
8 |
The Disqus comment system replaces your WordPress comment system with your comments hosted and powered by Disqus.
|
9 |
|
62 |
|
63 |
== Changes ==
|
64 |
|
65 |
+
2.60
|
66 |
+
|
67 |
+
* Added support for new Single Sign-On (API version 3.0).
|
68 |
+
* Improved support for legacy Single Sign-On.
|
69 |
+
|
70 |
+
2.55
|
71 |
+
|
72 |
+
* Added support for get_comments_number in templates.
|
73 |
+
|
74 |
+
2.54
|
75 |
+
|
76 |
+
* Updated URL to forum moderation.
|
77 |
+
|
78 |
+
2.53
|
79 |
+
|
80 |
+
* Fixed an issue with fsockopen and GET requests (only affects certain users).
|
81 |
+
|
82 |
2.52
|
83 |
|
84 |
* Fixed issue with Disqus-API package not getting updated (only affecting PHP4).
|