Version Description
Download this release
Release Info
Developer | Disqus |
Plugin | Disqus Comment System |
Version | 2.3.8581 |
Comparing to | |
See all releases |
Code changes from version 2.12.7121 to 2.3.8581
- comments-legacy.php +1 -1
- comments.php +9 -1
- disqus.php +668 -94
- export.php +252 -220
- images/logo.png +0 -0
- lib/api.php +23 -20
- lib/url.php +22 -17
- manage.php +43 -73
- readme.txt +15 -11
- styles/manage.css +16 -9
comments-legacy.php
CHANGED
@@ -10,4 +10,4 @@
|
|
10 |
var disqus_message = '<?php echo $excerpt; ?>';
|
11 |
</script>
|
12 |
<script type="text/javascript" src="<?php echo DISQUS_URL; ?>/forums/<?php echo get_option('disqus_forum_url'); ?>/embed.js"></script>
|
13 |
-
<noscript
|
10 |
var disqus_message = '<?php echo $excerpt; ?>';
|
11 |
</script>
|
12 |
<script type="text/javascript" src="<?php echo DISQUS_URL; ?>/forums/<?php echo get_option('disqus_forum_url'); ?>/embed.js"></script>
|
13 |
+
<noscript>Please enable JavaScript to view the <a href="<?php echo 'http://disqus.com/?ref_noscript=' . get_option('disqus_forum_url') ?>">comments powered by Disqus.</a></noscript>
|
comments.php
CHANGED
@@ -62,4 +62,12 @@
|
|
62 |
};
|
63 |
</script>
|
64 |
|
65 |
-
<script type="text/javascript" charset="utf-8"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
};
|
63 |
</script>
|
64 |
|
65 |
+
<script type="text/javascript" charset="utf-8">
|
66 |
+
(function() {
|
67 |
+
var dsq = document.createElement('script');
|
68 |
+
dsq.type = 'text/javascript';
|
69 |
+
dsq.async = true;
|
70 |
+
dsq.src = "http://<?php echo strtolower(get_option('disqus_forum_url')); ?>.<?php echo DISQUS_DOMAIN; ?>/disqus.js?v=2.0&slug=<?php echo $dsq_response['thread_slug']; ?>&pname=wordpress&pver=<?php echo $dsq_version; ?>";
|
71 |
+
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
72 |
+
})();
|
73 |
+
</script>
|
disqus.php
CHANGED
@@ -1,12 +1,11 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Plugin Name:
|
4 |
Plugin URI: http://disqus.com/
|
5 |
-
Description: The
|
6 |
-
Author:
|
7 |
-
Version: 2.
|
8 |
Author URI: http://disqus.com/
|
9 |
-
|
10 |
*/
|
11 |
|
12 |
require_once('lib/api.php');
|
@@ -44,15 +43,15 @@ if ( !defined('PLUGINDIR') ) {
|
|
44 |
define('DSQ_PLUGIN_URL', WP_CONTENT_URL . '/plugins/' . dsq_plugin_basename(__FILE__));
|
45 |
|
46 |
/**
|
47 |
-
*
|
48 |
*
|
49 |
* @global string $dsq_version
|
50 |
* @since 1.0
|
51 |
*/
|
52 |
-
$dsq_version = '2.
|
53 |
$mt_dsq_version = '2.01';
|
54 |
/**
|
55 |
-
* Response from
|
56 |
*
|
57 |
* @global string $dsq_response
|
58 |
* @since 1.0
|
@@ -73,19 +72,35 @@ $dsq_sort = 1;
|
|
73 |
*/
|
74 |
$dsq_cc_script_embedded = false;
|
75 |
/**
|
76 |
-
*
|
77 |
*
|
78 |
* @global string $dsq_api
|
79 |
* @since 1.0
|
80 |
*/
|
81 |
$dsq_api = new DisqusAPI(get_option('disqus_forum_url'), get_option('disqus_api_key'));
|
82 |
/**
|
83 |
-
*
|
84 |
*
|
85 |
-
* @global
|
86 |
-
* @since
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
*/
|
88 |
-
$
|
89 |
|
90 |
/**
|
91 |
* Helper functions.
|
@@ -142,7 +157,7 @@ function dsq_manage_dialog($message, $error = false) {
|
|
142 |
echo '<div '
|
143 |
. ( $error ? 'id="disqus_warning" ' : '')
|
144 |
. 'class="updated fade'
|
145 |
-
. ( ($wp_version
|
146 |
. '"><p><strong>'
|
147 |
. $message
|
148 |
. '</strong></p></div>';
|
@@ -214,6 +229,198 @@ function dsq_sync_comments($post, $comments) {
|
|
214 |
}
|
215 |
}
|
216 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
/**
|
218 |
* Filters/Actions
|
219 |
*/
|
@@ -230,7 +437,7 @@ function dsq_comments_template($value) {
|
|
230 |
global $dsq_api;
|
231 |
global $post;
|
232 |
|
233 |
-
if ( ! (
|
234 |
return;
|
235 |
}
|
236 |
|
@@ -271,54 +478,12 @@ function dsq_comments_template($value) {
|
|
271 |
return dirname(__FILE__) . '/comments.php';
|
272 |
}
|
273 |
|
274 |
-
function dsq_comment_count() {
|
275 |
-
global $dsq_cc_script_embedded, $dsq_wp_query, $wp_query;
|
276 |
-
|
277 |
-
if ( $dsq_cc_script_embedded ) {
|
278 |
-
return;
|
279 |
-
} else if ( (is_single() || is_page() || $withcomments || is_feed()) ) {
|
280 |
-
return;
|
281 |
-
} else if ( $dsq_wp_query->is_feed ) {
|
282 |
-
// Protect ourselves from other plugins which begin their own loop
|
283 |
-
// and clobber $wp_query.
|
284 |
-
return;
|
285 |
-
}
|
286 |
-
|
287 |
-
?>
|
288 |
-
|
289 |
-
<script type="text/javascript">
|
290 |
-
// <![CDATA[
|
291 |
-
(function() {
|
292 |
-
var links = document.getElementsByTagName('a');
|
293 |
-
var query = '&';
|
294 |
-
for(var i = 0; i < links.length; i++) {
|
295 |
-
if(links[i].href.indexOf('#disqus_thread') >= 0) {
|
296 |
-
links[i].innerHTML = 'View Comments';
|
297 |
-
query += 'wpid' + i + '=' + encodeURIComponent(links[i].getAttribute('wpid')) + '&';
|
298 |
-
}
|
299 |
-
}
|
300 |
-
document.write('<script charset="utf-8" type="text/javascript" src="http://<?php echo strtolower(get_option('disqus_forum_url')); ?>.<?php echo DISQUS_DOMAIN; ?>/get_num_replies_from_wpid.js?v=2.0' + query + '"><' + '/script>');
|
301 |
-
|
302 |
-
})();
|
303 |
-
//]]>
|
304 |
-
</script>
|
305 |
-
|
306 |
-
<?php
|
307 |
-
|
308 |
-
$dsq_cc_script_embedded = true;
|
309 |
-
}
|
310 |
-
|
311 |
// Mark entries in index to replace comments link.
|
312 |
function dsq_comments_number($comment_text) {
|
313 |
global $post;
|
314 |
|
315 |
if ( dsq_can_replace() ) {
|
316 |
-
|
317 |
-
the_permalink();
|
318 |
-
$the_permalink = ob_get_contents();
|
319 |
-
ob_end_clean();
|
320 |
-
|
321 |
-
return '</a><noscript><a href="http://' . strtolower(get_option('disqus_forum_url')) . '.' . DISQUS_DOMAIN . '/?url=' . $the_permalink .'">View comments</a></noscript><a class="dsq-comment-count" href="' . $the_permalink . '#disqus_thread" wpid="' . $post->ID . '">Comments</a>';
|
322 |
} else {
|
323 |
return $comment_text;
|
324 |
}
|
@@ -332,51 +497,177 @@ function dsq_bloginfo_url($url) {
|
|
332 |
}
|
333 |
}
|
334 |
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
$dsq_wp_query = $wp_query;
|
341 |
-
}
|
342 |
-
|
343 |
-
if ( isset($comment_count_cache) ) {
|
344 |
-
foreach ( $comment_count_cache as $key => $value ) {
|
345 |
-
if ( 0 == $value ) {
|
346 |
-
$comment_count_cache[$key] = -1;
|
347 |
-
}
|
348 |
-
}
|
349 |
}
|
|
|
350 |
}
|
|
|
351 |
|
|
|
352 |
function dsq_add_pages() {
|
353 |
-
|
354 |
-
|
355 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
|
357 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
}
|
365 |
|
366 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
}
|
|
|
|
|
|
|
|
|
368 |
|
369 |
function dsq_manage() {
|
370 |
-
|
371 |
-
include_once('manage.php');
|
372 |
}
|
373 |
|
374 |
-
|
375 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
|
377 |
function dsq_warning() {
|
378 |
-
global $wp_version;
|
379 |
-
|
380 |
if ( !get_option('disqus_forum_url') && !isset($_POST['forum_url']) && $_GET['page'] != 'disqus' ) {
|
381 |
dsq_manage_dialog('You must <a href="edit-comments.php?page=disqus">configure the plugin</a> to enable Disqus Comments.', true);
|
382 |
}
|
@@ -391,9 +682,151 @@ function dsq_check_version() {
|
|
391 |
|
392 |
$latest_version = $dsq_api->wp_check_version();
|
393 |
if ( $latest_version ) {
|
394 |
-
dsq_manage_dialog('You are running an old version of the Disqus Comments plugin. Please <a href="http://disqus.com/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
}
|
396 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
|
398 |
add_action('admin_notices', 'dsq_warning');
|
399 |
add_action('admin_notices', 'dsq_check_version');
|
@@ -402,12 +835,153 @@ add_action('admin_notices', 'dsq_check_version');
|
|
402 |
add_filter('comments_template', 'dsq_comments_template');
|
403 |
add_filter('comments_number', 'dsq_comments_number');
|
404 |
add_filter('bloginfo_url', 'dsq_bloginfo_url');
|
405 |
-
add_action('loop_start', 'dsq_loop_start');
|
406 |
|
407 |
-
|
408 |
-
|
409 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
}
|
411 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
412 |
|
413 |
?>
|
1 |
<?php
|
2 |
/*
|
3 |
+
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.3.8581
|
8 |
Author URI: http://disqus.com/
|
|
|
9 |
*/
|
10 |
|
11 |
require_once('lib/api.php');
|
43 |
define('DSQ_PLUGIN_URL', WP_CONTENT_URL . '/plugins/' . dsq_plugin_basename(__FILE__));
|
44 |
|
45 |
/**
|
46 |
+
* Disqus WordPress plugin version.
|
47 |
*
|
48 |
* @global string $dsq_version
|
49 |
* @since 1.0
|
50 |
*/
|
51 |
+
$dsq_version = '2.3';
|
52 |
$mt_dsq_version = '2.01';
|
53 |
/**
|
54 |
+
* Response from Disqus get_thread API call for comments template.
|
55 |
*
|
56 |
* @global string $dsq_response
|
57 |
* @since 1.0
|
72 |
*/
|
73 |
$dsq_cc_script_embedded = false;
|
74 |
/**
|
75 |
+
* Disqus API instance.
|
76 |
*
|
77 |
* @global string $dsq_api
|
78 |
* @since 1.0
|
79 |
*/
|
80 |
$dsq_api = new DisqusAPI(get_option('disqus_forum_url'), get_option('disqus_api_key'));
|
81 |
/**
|
82 |
+
* DISQUS is_feed check.
|
83 |
*
|
84 |
+
* @global bool $dsq_is_feed
|
85 |
+
* @since 2.2
|
86 |
+
*/
|
87 |
+
$dsq_is_feed = false;
|
88 |
+
|
89 |
+
/**
|
90 |
+
* DISQUS currently unsupported dev toggle to output comments for this query.
|
91 |
+
*
|
92 |
+
* @global bool $dsq_comments_for_query
|
93 |
+
* @since ?
|
94 |
+
*/
|
95 |
+
$DSQ_QUERY_COMMENTS = false;
|
96 |
+
|
97 |
+
/**
|
98 |
+
* DISQUS array to store post_ids from WP_Query for comment JS output.
|
99 |
+
*
|
100 |
+
* @global array $DSQ_QUERY_POST_IDS
|
101 |
+
* @since 2.2
|
102 |
*/
|
103 |
+
$DSQ_QUERY_POST_IDS = array();
|
104 |
|
105 |
/**
|
106 |
* Helper functions.
|
157 |
echo '<div '
|
158 |
. ( $error ? 'id="disqus_warning" ' : '')
|
159 |
. 'class="updated fade'
|
160 |
+
. ( (version_compare($wp_version, '2.5', '<') && $error) ? '-ff0000' : '' )
|
161 |
. '"><p><strong>'
|
162 |
. $message
|
163 |
. '</strong></p></div>';
|
229 |
}
|
230 |
}
|
231 |
|
232 |
+
function dsq_request_handler() {
|
233 |
+
if (!empty($_GET['cf_action'])) {
|
234 |
+
switch ($_GET['cf_action']) {
|
235 |
+
case 'export_comments':
|
236 |
+
if (current_user_can('manage_options')) {
|
237 |
+
// handle vars
|
238 |
+
$post_id = intval($_GET['post_id']);
|
239 |
+
$limit = 2;
|
240 |
+
global $wpdb, $dsq_api;
|
241 |
+
$posts = $wpdb->get_results("
|
242 |
+
SELECT *
|
243 |
+
FROM $wpdb->posts
|
244 |
+
WHERE post_type != 'revision'
|
245 |
+
AND post_status = 'publish'
|
246 |
+
AND comment_count > 0
|
247 |
+
AND ID > $post_id
|
248 |
+
ORDER BY ID ASC
|
249 |
+
LIMIT $limit
|
250 |
+
");
|
251 |
+
$first_post_id = $posts[0]->ID;
|
252 |
+
$last_post_id = $posts[(count($posts) - 1)]->ID;
|
253 |
+
$max_post_id = $wpdb->get_var("
|
254 |
+
SELECT MAX(ID)
|
255 |
+
FROM $wpdb->posts
|
256 |
+
WHERE post_type != 'revision'
|
257 |
+
AND post_status = 'publish'
|
258 |
+
AND comment_count > 0
|
259 |
+
AND ID > $post_id
|
260 |
+
");
|
261 |
+
if ($last_post_id == $max_post_id) {
|
262 |
+
$status = 'complete';
|
263 |
+
$msg = 'All comments sent to Disqus!';
|
264 |
+
}
|
265 |
+
else {
|
266 |
+
$status = 'partial';
|
267 |
+
if (count($posts) == 1) {
|
268 |
+
$msg = 'Processed comments on post #'.$first_post_id.'…';
|
269 |
+
}
|
270 |
+
else {
|
271 |
+
$msg = 'Processed comments on posts #'.$first_post_id.'-'.$last_post_id.'…';
|
272 |
+
}
|
273 |
+
}
|
274 |
+
$result = 'fail';
|
275 |
+
if (count($posts)) {
|
276 |
+
include_once(dirname(__FILE__) . '/export.php');
|
277 |
+
$wxr = dsq_export_wp($posts);
|
278 |
+
$import_id = $dsq_api->import_wordpress_comments($wxr);
|
279 |
+
if ($import_id < 0) {
|
280 |
+
$result = 'fail';
|
281 |
+
$msg = '<p class="status dsq-export-fail">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="http://disqus.com/help/wordpress" onclick="window.open(this.href); return false">WordPress help page</a>.</p>';
|
282 |
+
}
|
283 |
+
else {
|
284 |
+
$result = 'success';
|
285 |
+
}
|
286 |
+
}
|
287 |
+
// send AJAX response
|
288 |
+
$response = compact('result', 'status', 'last_post_id', 'msg');
|
289 |
+
header('Content-type: text/javascript');
|
290 |
+
echo cf_json_encode($response);
|
291 |
+
die();
|
292 |
+
}
|
293 |
+
break;
|
294 |
+
}
|
295 |
+
}
|
296 |
+
}
|
297 |
+
add_action('init', 'dsq_request_handler');
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Compatibility
|
301 |
+
*/
|
302 |
+
|
303 |
+
if (!function_exists ( '_wp_specialchars' ) ) {
|
304 |
+
function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
|
305 |
+
$string = (string) $string;
|
306 |
+
|
307 |
+
if ( 0 === strlen( $string ) ) {
|
308 |
+
return '';
|
309 |
+
}
|
310 |
+
|
311 |
+
// Don't bother if there are no specialchars - saves some processing
|
312 |
+
if ( !preg_match( '/[&<>"\']/', $string ) ) {
|
313 |
+
return $string;
|
314 |
+
}
|
315 |
+
|
316 |
+
// Account for the previous behaviour of the function when the $quote_style is not an accepted value
|
317 |
+
if ( empty( $quote_style ) ) {
|
318 |
+
$quote_style = ENT_NOQUOTES;
|
319 |
+
} elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
|
320 |
+
$quote_style = ENT_QUOTES;
|
321 |
+
}
|
322 |
+
|
323 |
+
// Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
|
324 |
+
if ( !$charset ) {
|
325 |
+
static $_charset;
|
326 |
+
if ( !isset( $_charset ) ) {
|
327 |
+
$alloptions = wp_load_alloptions();
|
328 |
+
$_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : '';
|
329 |
+
}
|
330 |
+
$charset = $_charset;
|
331 |
+
}
|
332 |
+
if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) ) {
|
333 |
+
$charset = 'UTF-8';
|
334 |
+
}
|
335 |
+
|
336 |
+
$_quote_style = $quote_style;
|
337 |
+
|
338 |
+
if ( $quote_style === 'double' ) {
|
339 |
+
$quote_style = ENT_COMPAT;
|
340 |
+
$_quote_style = ENT_COMPAT;
|
341 |
+
} elseif ( $quote_style === 'single' ) {
|
342 |
+
$quote_style = ENT_NOQUOTES;
|
343 |
+
}
|
344 |
+
|
345 |
+
// Handle double encoding ourselves
|
346 |
+
if ( !$double_encode ) {
|
347 |
+
$string = wp_specialchars_decode( $string, $_quote_style );
|
348 |
+
$string = preg_replace( '/&(#?x?[0-9a-z]+);/i', '|wp_entity|$1|/wp_entity|', $string );
|
349 |
+
}
|
350 |
+
|
351 |
+
$string = @htmlspecialchars( $string, $quote_style, $charset );
|
352 |
+
|
353 |
+
// Handle double encoding ourselves
|
354 |
+
if ( !$double_encode ) {
|
355 |
+
$string = str_replace( array( '|wp_entity|', '|/wp_entity|' ), array( '&', ';' ), $string );
|
356 |
+
}
|
357 |
+
|
358 |
+
// Backwards compatibility
|
359 |
+
if ( 'single' === $_quote_style ) {
|
360 |
+
$string = str_replace( "'", ''', $string );
|
361 |
+
}
|
362 |
+
|
363 |
+
return $string;
|
364 |
+
}
|
365 |
+
}
|
366 |
+
|
367 |
+
if (!function_exists ( 'wp_check_invalid_utf8' ) ) {
|
368 |
+
function wp_check_invalid_utf8( $string, $strip = false ) {
|
369 |
+
$string = (string) $string;
|
370 |
+
|
371 |
+
if ( 0 === strlen( $string ) ) {
|
372 |
+
return '';
|
373 |
+
}
|
374 |
+
|
375 |
+
// Store the site charset as a static to avoid multiple calls to get_option()
|
376 |
+
static $is_utf8;
|
377 |
+
if ( !isset( $is_utf8 ) ) {
|
378 |
+
$is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) );
|
379 |
+
}
|
380 |
+
if ( !$is_utf8 ) {
|
381 |
+
return $string;
|
382 |
+
}
|
383 |
+
|
384 |
+
// Check for support for utf8 in the installed PCRE library once and store the result in a static
|
385 |
+
static $utf8_pcre;
|
386 |
+
if ( !isset( $utf8_pcre ) ) {
|
387 |
+
$utf8_pcre = @preg_match( '/^./u', 'a' );
|
388 |
+
}
|
389 |
+
// We can't demand utf8 in the PCRE installation, so just return the string in those cases
|
390 |
+
if ( !$utf8_pcre ) {
|
391 |
+
return $string;
|
392 |
+
}
|
393 |
+
|
394 |
+
// preg_match fails when it encounters invalid UTF8 in $string
|
395 |
+
if ( 1 === @preg_match( '/^./us', $string ) ) {
|
396 |
+
return $string;
|
397 |
+
}
|
398 |
+
|
399 |
+
// Attempt to strip the bad chars if requested (not recommended)
|
400 |
+
if ( $strip && function_exists( 'iconv' ) ) {
|
401 |
+
return iconv( 'utf-8', 'utf-8', $string );
|
402 |
+
}
|
403 |
+
|
404 |
+
return '';
|
405 |
+
}
|
406 |
+
}
|
407 |
+
|
408 |
+
if (!function_exists ( 'esc_html' ) ) {
|
409 |
+
function esc_html( $text ) {
|
410 |
+
$safe_text = wp_check_invalid_utf8( $text );
|
411 |
+
$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
|
412 |
+
return apply_filters( 'esc_html', $safe_text, $text );
|
413 |
+
}
|
414 |
+
}
|
415 |
+
|
416 |
+
if (!function_exists ( 'esc_attr' ) ) {
|
417 |
+
function esc_attr( $text ) {
|
418 |
+
$safe_text = wp_check_invalid_utf8( $text );
|
419 |
+
$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
|
420 |
+
return apply_filters( 'attribute_escape', $safe_text, $text );
|
421 |
+
}
|
422 |
+
}
|
423 |
+
|
424 |
/**
|
425 |
* Filters/Actions
|
426 |
*/
|
437 |
global $dsq_api;
|
438 |
global $post;
|
439 |
|
440 |
+
if ( !( is_singular() && ( have_comments() || 'open' == $post->comment_status ) ) ) {
|
441 |
return;
|
442 |
}
|
443 |
|
478 |
return dirname(__FILE__) . '/comments.php';
|
479 |
}
|
480 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
// Mark entries in index to replace comments link.
|
482 |
function dsq_comments_number($comment_text) {
|
483 |
global $post;
|
484 |
|
485 |
if ( dsq_can_replace() ) {
|
486 |
+
return '<span class="dsq-postid-'.$post->ID.'">View Comments</span>';
|
|
|
|
|
|
|
|
|
|
|
487 |
} else {
|
488 |
return $comment_text;
|
489 |
}
|
497 |
}
|
498 |
}
|
499 |
|
500 |
+
function dsq_plugin_action_links($links, $file) {
|
501 |
+
$plugin_file = basename(__FILE__);
|
502 |
+
if (basename($file) == $plugin_file) {
|
503 |
+
$settings_link = '<a href="edit-comments.php?page=disqus#adv">'.__('Settings', 'disqus-comment-system').'</a>';
|
504 |
+
array_unshift($links, $settings_link);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
505 |
}
|
506 |
+
return $links;
|
507 |
}
|
508 |
+
add_filter('plugin_action_links', 'dsq_plugin_action_links', 10, 2);
|
509 |
|
510 |
+
// Always add Disqus management page to the admin menu
|
511 |
function dsq_add_pages() {
|
512 |
+
add_submenu_page(
|
513 |
+
'edit-comments.php',
|
514 |
+
'Disqus',
|
515 |
+
'Disqus',
|
516 |
+
'moderate_comments',
|
517 |
+
'disqus',
|
518 |
+
'dsq_manage'
|
519 |
+
);
|
520 |
+
}
|
521 |
+
add_action('admin_menu', 'dsq_add_pages', 10);
|
522 |
|
523 |
+
// a little jQuery goodness to get comments menu working as desired
|
524 |
+
function sdq_menu_admin_head() {
|
525 |
+
?>
|
526 |
+
<script type="text/javascript">
|
527 |
+
jQuery(function($) {
|
528 |
+
// fix menu
|
529 |
+
var mc = $('#menu-comments');
|
530 |
+
mc.find('a.wp-has-submenu').attr('href', 'edit-comments.php?page=disqus').end().find('.wp-submenu li:has(a[href=edit-comments.php?page=disqus])').prependTo(mc.find('.wp-submenu ul'));
|
531 |
+
});
|
532 |
+
</script>
|
533 |
+
<?php
|
534 |
+
}
|
535 |
+
add_action('admin_head', 'sdq_menu_admin_head');
|
536 |
|
537 |
+
// only active on dashboard
|
538 |
+
function dsq_dash_comment_counts() {
|
539 |
+
global $wpdb;
|
540 |
+
// taken from wp-includes/comment.php - WP 2.8.5
|
541 |
+
$count = $wpdb->get_results("
|
542 |
+
SELECT comment_approved, COUNT( * ) AS num_comments
|
543 |
+
FROM {$wpdb->comments}
|
544 |
+
WHERE comment_type != 'trackback'
|
545 |
+
AND comment_type != 'pingback'
|
546 |
+
GROUP BY comment_approved
|
547 |
+
", ARRAY_A );
|
548 |
+
$total = 0;
|
549 |
+
$approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
|
550 |
+
$known_types = array_keys( $approved );
|
551 |
+
foreach( (array) $count as $row_num => $row ) {
|
552 |
+
$total += $row['num_comments'];
|
553 |
+
if ( in_array( $row['comment_approved'], $known_types ) )
|
554 |
+
$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
|
555 |
}
|
556 |
|
557 |
+
$stats['total_comments'] = $total;
|
558 |
+
foreach ( $approved as $key ) {
|
559 |
+
if ( empty($stats[$key]) )
|
560 |
+
$stats[$key] = 0;
|
561 |
+
}
|
562 |
+
$stats = (object) $stats;
|
563 |
+
?>
|
564 |
+
<style type="text/css">
|
565 |
+
#dashboard_right_now .inside,
|
566 |
+
#dashboard_recent_comments div.trackback {
|
567 |
+
display: none;
|
568 |
+
}
|
569 |
+
</style>
|
570 |
+
<script type="text/javascript">
|
571 |
+
jQuery(function($) {
|
572 |
+
$('#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();
|
573 |
+
$('#dashboard_recent_comments div.trackback').remove();
|
574 |
+
$('#dashboard_right_now .inside table td.last a, #dashboard_recent_comments .inside .textright a.button').attr('href', 'edit-comments.php?page=disqus');
|
575 |
+
});
|
576 |
+
</script>
|
577 |
+
<?php
|
578 |
}
|
579 |
+
function dsq_wp_dashboard_setup() {
|
580 |
+
add_action('admin_head', 'dsq_dash_comment_counts');
|
581 |
+
}
|
582 |
+
add_action('wp_dashboard_setup', 'dsq_wp_dashboard_setup');
|
583 |
|
584 |
function dsq_manage() {
|
585 |
+
include_once(dirname(__FILE__) . '/manage.php');
|
|
|
586 |
}
|
587 |
|
588 |
+
function dsq_admin_head() {
|
589 |
+
if (isset($_GET['page']) && $_GET['page'] == 'disqus') {
|
590 |
+
?>
|
591 |
+
<link rel='stylesheet' href='<?php echo DSQ_PLUGIN_URL; ?>/styles/manage.css' type='text/css' />
|
592 |
+
<style type="text/css">
|
593 |
+
.dsq-exporting, .dsq-exported, .dsq-export-fail {
|
594 |
+
background: url(<?php echo admin_url('images/loading.gif'); ?>) left center no-repeat;
|
595 |
+
line-height: 16px;
|
596 |
+
padding-left: 20px;
|
597 |
+
}
|
598 |
+
.dsq-exported {
|
599 |
+
background: url(<?php echo admin_url('images/yes.png'); ?>) left center no-repeat;
|
600 |
+
}
|
601 |
+
.dsq-export-fail {
|
602 |
+
background: url(<?php echo admin_url('images/no.png'); ?>) left center no-repeat;
|
603 |
+
}
|
604 |
+
</style>
|
605 |
+
<script type="text/javascript">
|
606 |
+
jQuery(function($) {
|
607 |
+
$('#dsq-tabs li').click(function() {
|
608 |
+
$('#dsq-tabs li.selected').removeClass('selected');
|
609 |
+
$(this).addClass('selected');
|
610 |
+
$('.dsq-main, .dsq-advanced').hide();
|
611 |
+
$('.' + $(this).attr('rel')).show();
|
612 |
+
});
|
613 |
+
if (location.href.indexOf('#adv') != -1) {
|
614 |
+
$('#dsq-tab-advanced').click();
|
615 |
+
}
|
616 |
+
dsq_fire_export();
|
617 |
+
});
|
618 |
+
dsq_fire_export = function() {
|
619 |
+
var $ = jQuery;
|
620 |
+
$('#dsq_export a.button, #dsq_export_retry').unbind().click(function() {
|
621 |
+
$('#dsq_export').html('<p class="status"></p>');
|
622 |
+
$('#dsq_export .status').removeClass('dsq-export-fail').addClass('dsq-exporting').html('Processing...');
|
623 |
+
dsq_export_comments();
|
624 |
+
return false;
|
625 |
+
});
|
626 |
+
}
|
627 |
+
dsq_export_comments = function() {
|
628 |
+
var $ = jQuery;
|
629 |
+
var status = $('#dsq_export .status');
|
630 |
+
var post_id = status.attr('rel') || 0;
|
631 |
+
$.get(
|
632 |
+
'<?php echo admin_url('index.php'); ?>',
|
633 |
+
{
|
634 |
+
cf_action: 'export_comments',
|
635 |
+
post_id: post_id
|
636 |
+
},
|
637 |
+
function(response) {
|
638 |
+
switch (response.result) {
|
639 |
+
case 'success':
|
640 |
+
status.html(response.msg).attr('rel', response.last_post_id);
|
641 |
+
switch (response.status) {
|
642 |
+
case 'partial':
|
643 |
+
dsq_export_comments();
|
644 |
+
break;
|
645 |
+
case 'complete':
|
646 |
+
status.removeClass('dsq-exporting').addClass('dsq-exported');
|
647 |
+
break;
|
648 |
+
}
|
649 |
+
break;
|
650 |
+
case 'fail':
|
651 |
+
status.parent().html(response.msg);
|
652 |
+
dsq_fire_export();
|
653 |
+
break;
|
654 |
+
}
|
655 |
+
},
|
656 |
+
'json'
|
657 |
+
);
|
658 |
+
}
|
659 |
+
</script>
|
660 |
+
<?php
|
661 |
+
// HACK: Our own styles for older versions of WordPress.
|
662 |
+
global $wp_version;
|
663 |
+
if ( version_compare($wp_version, '2.5', '<') ) {
|
664 |
+
echo "<link rel='stylesheet' href='" . DSQ_PLUGIN_URL . "/styles/manage-pre25.css' type='text/css' />";
|
665 |
+
}
|
666 |
+
}
|
667 |
+
}
|
668 |
+
add_action('admin_head', 'dsq_admin_head');
|
669 |
|
670 |
function dsq_warning() {
|
|
|
|
|
671 |
if ( !get_option('disqus_forum_url') && !isset($_POST['forum_url']) && $_GET['page'] != 'disqus' ) {
|
672 |
dsq_manage_dialog('You must <a href="edit-comments.php?page=disqus">configure the plugin</a> to enable Disqus Comments.', true);
|
673 |
}
|
682 |
|
683 |
$latest_version = $dsq_api->wp_check_version();
|
684 |
if ( $latest_version ) {
|
685 |
+
dsq_manage_dialog('You are running an old version of the Disqus Comments plugin. Please <a href="http://disqus.com/help/wordpress" onclick="window.open(this.href); return false">check the website</a> for updates.');
|
686 |
+
}
|
687 |
+
}
|
688 |
+
|
689 |
+
// catch original query
|
690 |
+
function dsq_parse_query($query) {
|
691 |
+
add_action('the_posts', 'dsq_add_request_post_ids', 999);
|
692 |
+
}
|
693 |
+
add_action('parse_request', 'dsq_parse_query');
|
694 |
+
|
695 |
+
// track the original request post_ids, only run once
|
696 |
+
function dsq_add_request_post_ids($posts) {
|
697 |
+
dsq_add_query_posts($posts);
|
698 |
+
remove_action('the_posts', 'dsq_log_request_post_ids', 999);
|
699 |
+
return $posts;
|
700 |
+
}
|
701 |
+
|
702 |
+
function dsq_maybe_add_post_ids($posts) {
|
703 |
+
global $DSQ_QUERY_COMMENTS;
|
704 |
+
if ($DSQ_QUERY_COMMENTS) {
|
705 |
+
dsq_add_query_posts($posts);
|
706 |
+
}
|
707 |
+
return $posts;
|
708 |
+
}
|
709 |
+
add_action('the_posts', 'dsq_maybe_add_post_ids');
|
710 |
+
|
711 |
+
function dsq_add_query_posts($posts) {
|
712 |
+
global $DSQ_QUERY_POST_IDS;
|
713 |
+
if (count($posts)) {
|
714 |
+
foreach ($posts as $post) {
|
715 |
+
$post_ids[] = intval($post->ID);
|
716 |
+
}
|
717 |
+
$DSQ_QUERY_POST_IDS[md5(serialize($post_ids))] = $post_ids;
|
718 |
+
}
|
719 |
+
}
|
720 |
+
|
721 |
+
// check to see if the posts in the loop match the original request or an explicit request, if so output the JS
|
722 |
+
function dsq_loop_end($query) {
|
723 |
+
if ( get_option('disqus_cc_fix') == '1' || !count($query->posts) || is_single() || is_page() || is_feed() ) {
|
724 |
+
return;
|
725 |
+
}
|
726 |
+
global $DSQ_QUERY_POST_IDS;
|
727 |
+
foreach ($query->posts as $post) {
|
728 |
+
$loop_ids[] = intval($post->ID);
|
729 |
+
}
|
730 |
+
$posts_key = md5(serialize($loop_ids));
|
731 |
+
if (isset($DSQ_QUERY_POST_IDS[$posts_key])) {
|
732 |
+
dsq_output_loop_comment_js($DSQ_QUERY_POST_IDS[$posts_key]);
|
733 |
+
}
|
734 |
+
}
|
735 |
+
add_action('loop_end', 'dsq_loop_end');
|
736 |
+
|
737 |
+
function dsq_js_comment_count_url() {
|
738 |
+
return 'http://'.strtolower(get_option('disqus_forum_url')).'.'.DISQUS_DOMAIN.'/get_num_replies_from_wpid.js?v=2.2&t=span';
|
739 |
+
}
|
740 |
+
|
741 |
+
function dsq_output_loop_comment_js($post_ids = null) {
|
742 |
+
if (count($post_ids)) {
|
743 |
+
$post_id_str = '';
|
744 |
+
$i = 0;
|
745 |
+
foreach ($post_ids as $post_id) {
|
746 |
+
$post_id_str .= '&wpid'.$i.'='.$post_id;
|
747 |
+
$i++;
|
748 |
+
}
|
749 |
+
?>
|
750 |
+
<script type="text/javascript">
|
751 |
+
// <![CDATA[
|
752 |
+
(function() {
|
753 |
+
document.write('<script charset="utf-8" type="text/javascript" src="<?php echo dsq_js_comment_count_url().$post_id_str; ?>"><' + '/script>');
|
754 |
+
|
755 |
+
})();
|
756 |
+
//]]>
|
757 |
+
</script>
|
758 |
+
<?php
|
759 |
+
}
|
760 |
+
}
|
761 |
+
|
762 |
+
function dsq_output_footer_comment_js() {
|
763 |
+
if (get_option('disqus_cc_fix') == '1') {
|
764 |
+
?>
|
765 |
+
<script type="text/javascript">
|
766 |
+
// <![CDATA[
|
767 |
+
(function() {
|
768 |
+
var nodes = document.getElementsByTagName('span');
|
769 |
+
var query = '&';
|
770 |
+
for (var i = 0; i < nodes.length; i++) {
|
771 |
+
if (nodes[i].className.indexOf('dsq-postid') != -1) {
|
772 |
+
query += 'wpid' + i + '=' + encodeURIComponent(nodes[i].className.replace('dsq-postid-', '')) + '&';
|
773 |
+
}
|
774 |
+
}
|
775 |
+
document.write('<script charset="utf-8" type="text/javascript" src="<?php echo dsq_js_comment_count_url(); ?>' + query + '"><' + '/script>');
|
776 |
+
|
777 |
+
})();
|
778 |
+
//]]>
|
779 |
+
</script>
|
780 |
+
<?php
|
781 |
}
|
782 |
}
|
783 |
+
add_action('wp_footer', 'dsq_output_footer_comment_js');
|
784 |
+
|
785 |
+
// UPDATE DSQ when a permalink changes
|
786 |
+
|
787 |
+
$dsq_prev_permalinks = array();
|
788 |
+
|
789 |
+
function dsq_prev_permalink($post_id) {
|
790 |
+
// if post not published, return
|
791 |
+
$post = &get_post($post_id);
|
792 |
+
if ($post->post_status != 'publish') {
|
793 |
+
return;
|
794 |
+
}
|
795 |
+
global $dsq_prev_permalinks;
|
796 |
+
$dsq_prev_permalinks['post_'.$post_id] = get_permalink($post_id);
|
797 |
+
}
|
798 |
+
add_action('pre_post_update', 'dsq_prev_permalink');
|
799 |
+
|
800 |
+
function dsq_check_permalink($post_id) {
|
801 |
+
global $dsq_prev_permalinks;
|
802 |
+
if (!empty($dsq_prev_permalinks['post_'.$post_id]) && $dsq_prev_permalinks['post_'.$post_id] != get_permalink($post_id)) {
|
803 |
+
// API request to get old DSQ ID - get_thread_by_url
|
804 |
+
$post = get_post($post_id);
|
805 |
+
global $dsq_api;
|
806 |
+
$thread = $dsq_api->get_thread(
|
807 |
+
$post,
|
808 |
+
$dsq_prev_permalinks['post_'.$post_id],
|
809 |
+
get_the_title($post_id),
|
810 |
+
get_the_excerpt($post_id)
|
811 |
+
);
|
812 |
+
// API request to update DSQ ID to new permalink - update_thread
|
813 |
+
if (is_array($thread) && !empty($thread['thread_id'])) {
|
814 |
+
$http = new WP_Http;
|
815 |
+
$response = $http->request(
|
816 |
+
DISQUS_API_URL . '/api/update_thread/',
|
817 |
+
array(
|
818 |
+
'method' => 'POST',
|
819 |
+
'body' => array(
|
820 |
+
'thread_id' => $thread['thread_id'],
|
821 |
+
'url' => get_permalink($post_id),
|
822 |
+
'forum_api_key' => $dsq_api->forum_api_key,
|
823 |
+
)
|
824 |
+
)
|
825 |
+
);
|
826 |
+
}
|
827 |
+
}
|
828 |
+
}
|
829 |
+
add_action('edit_post', 'dsq_check_permalink');
|
830 |
|
831 |
add_action('admin_notices', 'dsq_warning');
|
832 |
add_action('admin_notices', 'dsq_check_version');
|
835 |
add_filter('comments_template', 'dsq_comments_template');
|
836 |
add_filter('comments_number', 'dsq_comments_number');
|
837 |
add_filter('bloginfo_url', 'dsq_bloginfo_url');
|
|
|
838 |
|
839 |
+
/**
|
840 |
+
* JSON ENCODE for PHP < 5.2.0
|
841 |
+
* Checks if json_encode is not available and defines json_encode
|
842 |
+
* to use php_json_encode in its stead
|
843 |
+
* Works on iteratable objects as well - stdClass is iteratable, so all WP objects are gonna be iteratable
|
844 |
+
*/
|
845 |
+
if(!function_exists('cf_json_encode')) {
|
846 |
+
function cf_json_encode($data) {
|
847 |
+
// json_encode is sending an application/x-javascript header on Joyent servers
|
848 |
+
// for some unknown reason.
|
849 |
+
// if(function_exists('json_encode')) { return json_encode($data); }
|
850 |
+
// else { return cfjson_encode($data); }
|
851 |
+
return cfjson_encode($data);
|
852 |
+
}
|
853 |
+
|
854 |
+
function cfjson_encode_string($str) {
|
855 |
+
if(is_bool($str)) {
|
856 |
+
return $str ? 'true' : 'false';
|
857 |
+
}
|
858 |
+
|
859 |
+
return str_replace(
|
860 |
+
array(
|
861 |
+
'"'
|
862 |
+
, '/'
|
863 |
+
, "\n"
|
864 |
+
, "\r"
|
865 |
+
)
|
866 |
+
, array(
|
867 |
+
'\"'
|
868 |
+
, '\/'
|
869 |
+
, '\n'
|
870 |
+
, '\r'
|
871 |
+
)
|
872 |
+
, $str
|
873 |
+
);
|
874 |
+
}
|
875 |
+
|
876 |
+
function cfjson_encode($arr) {
|
877 |
+
$json_str = '';
|
878 |
+
if (is_array($arr)) {
|
879 |
+
$pure_array = true;
|
880 |
+
$array_length = count($arr);
|
881 |
+
for ( $i = 0; $i < $array_length ; $i++) {
|
882 |
+
if (!isset($arr[$i])) {
|
883 |
+
$pure_array = false;
|
884 |
+
break;
|
885 |
+
}
|
886 |
+
}
|
887 |
+
if ($pure_array) {
|
888 |
+
$json_str = '[';
|
889 |
+
$temp = array();
|
890 |
+
for ($i=0; $i < $array_length; $i++) {
|
891 |
+
$temp[] = sprintf("%s", cfjson_encode($arr[$i]));
|
892 |
+
}
|
893 |
+
$json_str .= implode(',', $temp);
|
894 |
+
$json_str .="]";
|
895 |
+
}
|
896 |
+
else {
|
897 |
+
$json_str = '{';
|
898 |
+
$temp = array();
|
899 |
+
foreach ($arr as $key => $value) {
|
900 |
+
$temp[] = sprintf("\"%s\":%s", $key, cfjson_encode($value));
|
901 |
+
}
|
902 |
+
$json_str .= implode(',', $temp);
|
903 |
+
$json_str .= '}';
|
904 |
+
}
|
905 |
+
}
|
906 |
+
else if (is_object($arr)) {
|
907 |
+
$json_str = '{';
|
908 |
+
$temp = array();
|
909 |
+
foreach ($arr as $k => $v) {
|
910 |
+
$temp[] = '"'.$k.'":'.cfjson_encode($v);
|
911 |
+
}
|
912 |
+
$json_str .= implode(',', $temp);
|
913 |
+
$json_str .= '}';
|
914 |
+
}
|
915 |
+
else if (is_string($arr)) {
|
916 |
+
$json_str = '"'. cfjson_encode_string($arr) . '"';
|
917 |
+
}
|
918 |
+
else if (is_numeric($arr)) {
|
919 |
+
$json_str = $arr;
|
920 |
+
}
|
921 |
+
else if (is_bool($arr)) {
|
922 |
+
$json_str = $arr ? 'true' : 'false';
|
923 |
+
}
|
924 |
+
else {
|
925 |
+
$json_str = '"'. cfjson_encode_string($arr) . '"';
|
926 |
+
}
|
927 |
+
return $json_str;
|
928 |
+
}
|
929 |
}
|
930 |
+
|
931 |
+
// Single Sign-on Integration
|
932 |
+
|
933 |
+
function dsq_sso() {
|
934 |
+
if (!$partner_key = get_option('disqus_partner_key')) {
|
935 |
+
return;
|
936 |
+
}
|
937 |
+
global $current_user, $dsq_api;
|
938 |
+
get_currentuserinfo();
|
939 |
+
if ($current_user->ID) {
|
940 |
+
$avatar_tag = get_avatar($current_user->ID);
|
941 |
+
$avatar_data = array();
|
942 |
+
preg_match('/(src)=((\'|")[^(\'|")]*(\'|"))/i', $avatar_tag, $avatar_data);
|
943 |
+
$avatar = str_replace(array('"', "'"), '', $avatar_data[2]);
|
944 |
+
$user_data = array(
|
945 |
+
'username' => $current_user->display_name,
|
946 |
+
'id' => $current_user->ID,
|
947 |
+
'avatar' => $avatar,
|
948 |
+
'email' => $current_user->user_email,
|
949 |
+
);
|
950 |
+
}
|
951 |
+
else {
|
952 |
+
$user_data = array();
|
953 |
+
}
|
954 |
+
$user_data = base64_encode(cf_json_encode($user_data));
|
955 |
+
$time = time();
|
956 |
+
$hmac = dsq_hmacsha1($user_data.' '.$time, $partner_key);
|
957 |
+
|
958 |
+
$payload = $user_data.' '.$hmac.' '.$time;
|
959 |
+
echo '<script type="text/javascript" src="http://'.$dsq_api->short_name.'.disqus.com/remote_auth.js?remote_auth_s2='.urlencode($payload).'"></script>';
|
960 |
+
}
|
961 |
+
add_action('wp_head', 'dsq_sso');
|
962 |
+
|
963 |
+
// from: http://www.php.net/manual/en/function.sha1.php#39492
|
964 |
+
//Calculate HMAC-SHA1 according to RFC2104
|
965 |
+
// http://www.ietf.org/rfc/rfc2104.txt
|
966 |
+
function dsq_hmacsha1($data, $key) {
|
967 |
+
$blocksize=64;
|
968 |
+
$hashfunc='sha1';
|
969 |
+
if (strlen($key)>$blocksize)
|
970 |
+
$key=pack('H*', $hashfunc($key));
|
971 |
+
$key=str_pad($key,$blocksize,chr(0x00));
|
972 |
+
$ipad=str_repeat(chr(0x36),$blocksize);
|
973 |
+
$opad=str_repeat(chr(0x5c),$blocksize);
|
974 |
+
$hmac = pack(
|
975 |
+
'H*',$hashfunc(
|
976 |
+
($key^$opad).pack(
|
977 |
+
'H*',$hashfunc(
|
978 |
+
($key^$ipad).$data
|
979 |
+
)
|
980 |
+
)
|
981 |
+
)
|
982 |
+
);
|
983 |
+
return bin2hex($hmac);
|
984 |
+
}
|
985 |
+
|
986 |
|
987 |
?>
|
export.php
CHANGED
@@ -1,257 +1,289 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Adapted from WordPress 2.
|
4 |
*/
|
5 |
-
set_time_limit(0);
|
6 |
-
ini_set('memory_limit', '256M');
|
7 |
define('WXR_VERSION', '1.0');
|
8 |
|
9 |
-
//
|
10 |
-
|
11 |
-
require_once(ABSPATH . WPINC . '/functions-formatting.php');
|
12 |
-
} else {
|
13 |
-
require_once(ABSPATH . WPINC . '/formatting.php');
|
14 |
-
}
|
15 |
|
16 |
-
|
17 |
-
if ( defined('WP_TEMP_DIR') ) {
|
18 |
-
if ( is_writable(WP_TEMP_DIR) ) {
|
19 |
-
return trailingslashit(WP_TEMP_DIR);
|
20 |
-
}
|
21 |
-
}
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
if ( is_writable($temp_dir) ) {
|
26 |
-
return trailingslashit($temp_dir);
|
27 |
-
}
|
28 |
-
}
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
if ( is_writable($_ENV['TMP']) ) {
|
38 |
-
return realpath(trailingslashit($_ENV['TMP']));
|
39 |
-
}
|
40 |
-
}
|
41 |
|
42 |
-
|
43 |
-
if ( is_writable($_ENV['TMPDIR']) ) {
|
44 |
-
return realpath(trailingslashit($_ENV['TMPDIR']));
|
45 |
-
}
|
46 |
-
}
|
47 |
|
48 |
-
if (
|
49 |
-
|
50 |
-
return realpath(trailingslashit($_ENV['TEMP']));
|
51 |
-
}
|
52 |
-
}
|
53 |
|
54 |
-
|
55 |
-
return '/tmp/';
|
56 |
}
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
61 |
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
-
$
|
68 |
-
if ( isset( $_GET['author'] ) && $_GET['author'] != 'all' ) {
|
69 |
-
$author_id = (int) $_GET['author'];
|
70 |
-
$where = " WHERE post_author = '$author_id' ";
|
71 |
-
}
|
72 |
|
73 |
-
$
|
74 |
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
}
|
82 |
-
// wp: the blog url
|
83 |
-
else {
|
84 |
-
return get_bloginfo_rss('url');
|
85 |
-
}
|
86 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
-
|
|
|
93 |
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
-
|
97 |
-
|
98 |
|
99 |
-
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
-
|
104 |
-
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
-
|
|
|
|
|
|
|
|
|
111 |
}
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
<!--
|
118 |
-
This is a WordPress eXtended RSS file generated by WordPress as an export of
|
119 |
-
your blog. It contains information about your blog's posts, comments, and
|
120 |
-
categories. You may use this file to transfer that content from one site to
|
121 |
-
another. This file is not intended to serve as a complete backup of your
|
122 |
-
blog.
|
123 |
-
|
124 |
-
To import this information into a WordPress blog follow these steps:
|
125 |
-
|
126 |
-
1. Log into that blog as an administrator.
|
127 |
-
2. Go to Manage > Import in the blog's admin.
|
128 |
-
3. Choose "WordPress" from the list of importers.
|
129 |
-
4. Upload this file using the form provided on that page.
|
130 |
-
5. You will first be asked to map the authors in this export file to users
|
131 |
-
on the blog. For each author, you may choose to map an existing user on
|
132 |
-
the blog or to create a new user.
|
133 |
-
6. WordPress will then import each of the posts, comments, and categories
|
134 |
-
contained in this file onto your blog.
|
135 |
-
-->
|
136 |
-
|
137 |
-
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:i'); ?>"-->
|
138 |
-
<rss version="2.0"
|
139 |
-
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
140 |
-
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
141 |
-
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
142 |
-
xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/"
|
143 |
-
>
|
144 |
-
|
145 |
-
<channel>
|
146 |
-
<title><?php bloginfo_rss('name'); ?></title>
|
147 |
-
<link><?php bloginfo_rss('url') ?></link>
|
148 |
-
<description><?php bloginfo_rss("description") ?></description>
|
149 |
-
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
|
150 |
-
<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
|
151 |
-
<language><?php echo get_option('rss_language'); ?></language>
|
152 |
-
<wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
|
153 |
-
<wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
|
154 |
-
<wp:base_blog_url><?php bloginfo_rss('url'); ?></wp:base_blog_url>
|
155 |
-
|
156 |
-
<?php
|
157 |
-
$contents = ob_get_clean();
|
158 |
-
fwrite($fp, $contents);
|
159 |
-
?>
|
160 |
-
|
161 |
-
<?php if ( $cats ) : foreach ( $cats as $c ) : ?>
|
162 |
-
<?php
|
163 |
-
ob_start();
|
164 |
-
?>
|
165 |
-
<wp:category><wp:category_nicename><?php echo $c->category_nicename; ?></wp:category_nicename><wp:category_parent><?php echo $c->category_parent ? $cats[$c->category_parent]->cat_name : ''; ?></wp:category_parent><wp:posts_private><?php echo $c->posts_private ? '1' : '0'; ?></wp:posts_private><wp:links_private><?php echo $c->links_private ? '1' : '0'; ?></wp:links_private><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
|
166 |
-
<?php
|
167 |
-
$contents = ob_get_clean();
|
168 |
-
fwrite($fp, $contents);
|
169 |
-
?>
|
170 |
-
<?php endforeach; endif; ?>
|
171 |
-
<?php do_action('rss2_head'); ?>
|
172 |
-
<?php
|
173 |
-
if ($posts) {
|
174 |
-
foreach ($posts as $post) {
|
175 |
-
ob_start();
|
176 |
-
start_wp();
|
177 |
-
?>
|
178 |
-
<item>
|
179 |
-
<title><?php the_title_rss() ?></title>
|
180 |
-
<link><?php permalink_single_rss() ?></link>
|
181 |
-
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
|
182 |
-
<dc:creator><?php the_author() ?></dc:creator>
|
183 |
-
<?php the_category_rss() ?>
|
184 |
-
|
185 |
-
<guid isPermaLink="false"><?php the_guid(); ?></guid>
|
186 |
-
<description></description>
|
187 |
-
<content:encoded><![CDATA[<?php echo $post->post_content ?>]]></content:encoded>
|
188 |
-
<wp:post_id><?php echo $post->ID; ?></wp:post_id>
|
189 |
-
<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
|
190 |
-
<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
|
191 |
-
<wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
|
192 |
-
<wp:ping_status><?php echo $post->ping_status; ?></wp:ping_status>
|
193 |
-
<wp:post_name><?php echo $post->post_name; ?></wp:post_name>
|
194 |
-
<wp:status><?php echo $post->post_status; ?></wp:status>
|
195 |
-
<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
|
196 |
-
<wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
|
197 |
-
<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
|
198 |
-
<?php
|
199 |
-
$postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
|
200 |
-
if ( $postmeta ) {
|
201 |
-
?>
|
202 |
-
<?php foreach( $postmeta as $meta ) { ?>
|
203 |
-
<wp:postmeta>
|
204 |
-
<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
|
205 |
-
<wp:meta_value><?Php echo $meta->meta_value; ?></wp:meta_value>
|
206 |
-
</wp:postmeta>
|
207 |
-
<?php } ?>
|
208 |
-
<?php } ?>
|
209 |
-
<?php
|
210 |
-
$contents = ob_get_clean();
|
211 |
-
fwrite($fp, $contents);
|
212 |
-
?>
|
213 |
-
<?php
|
214 |
-
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID AND comment_agent NOT LIKE 'Disqus/%'");
|
215 |
ob_start();
|
216 |
-
if ( $comments ) { foreach ( $comments as $c ) { ?>
|
217 |
-
<wp:comment>
|
218 |
-
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
|
219 |
-
<wp:comment_author><?php echo $c->comment_author; ?></wp:comment_author>
|
220 |
-
<wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
|
221 |
-
<wp:comment_author_url><?php echo $c->comment_author_url; ?></wp:comment_author_url>
|
222 |
-
<wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
|
223 |
-
<wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
|
224 |
-
<wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
|
225 |
-
<wp:comment_content><?php echo $c->comment_content; ?></wp:comment_content>
|
226 |
-
<wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
|
227 |
-
<wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
|
228 |
-
<wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
|
229 |
-
</wp:comment>
|
230 |
-
<?php } } ?>
|
231 |
-
</item>
|
232 |
-
<?php
|
233 |
-
$contents = ob_get_clean();
|
234 |
-
fwrite($fp, $contents);
|
235 |
-
?>
|
236 |
-
<?php } } ?>
|
237 |
-
<?php ob_start(); ?>
|
238 |
-
</channel>
|
239 |
-
</rss>
|
240 |
-
<?php
|
241 |
-
$contents = ob_get_clean();
|
242 |
-
fwrite($fp, $contents);
|
243 |
|
244 |
-
$response = $dsq_api->import_wordpress_comments($filename);
|
245 |
-
$import_id = $response;
|
246 |
|
247 |
-
|
248 |
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
}
|
256 |
|
257 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Adapted from WordPress 2.8
|
4 |
*/
|
5 |
+
@set_time_limit(0);
|
6 |
+
@ini_set('memory_limit', '256M');
|
7 |
define('WXR_VERSION', '1.0');
|
8 |
|
9 |
+
// receives an array of posts to export
|
10 |
+
function dsq_export_wp($posts) {
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
global $wpdb;
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
$categories = (array) get_categories('get=all');
|
15 |
+
$tags = (array) get_tags('get=all');
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
/**
|
18 |
+
* {@internal Missing Short Description}}
|
19 |
+
*
|
20 |
+
* @since unknown
|
21 |
+
*
|
22 |
+
* @param unknown_type $categories
|
23 |
+
*/
|
24 |
+
function wxr_missing_parents($categories) {
|
25 |
+
if ( !is_array($categories) || empty($categories) )
|
26 |
+
return array();
|
27 |
|
28 |
+
foreach ( $categories as $category )
|
29 |
+
$parents[$category->term_id] = $category->parent;
|
|
|
|
|
|
|
|
|
30 |
|
31 |
+
$parents = array_unique(array_diff($parents, array_keys($parents)));
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
if ( $zero = array_search('0', $parents) )
|
34 |
+
unset($parents[$zero]);
|
|
|
|
|
|
|
35 |
|
36 |
+
return $parents;
|
|
|
37 |
}
|
38 |
|
39 |
+
while ( $parents = wxr_missing_parents($categories) ) {
|
40 |
+
$found_parents = get_categories("include=" . join(', ', $parents));
|
41 |
+
if ( is_array($found_parents) && count($found_parents) )
|
42 |
+
$categories = array_merge($categories, $found_parents);
|
43 |
+
else
|
44 |
+
break;
|
45 |
+
}
|
46 |
|
47 |
+
// Put them in order to be inserted with no child going before its parent
|
48 |
+
$pass = 0;
|
49 |
+
$passes = 1000 + count($categories);
|
50 |
+
while ( ( $cat = array_shift($categories) ) && ++$pass < $passes ) {
|
51 |
+
if ( $cat->parent == 0 || isset($cats[$cat->parent]) ) {
|
52 |
+
$cats[$cat->term_id] = $cat;
|
53 |
+
} else {
|
54 |
+
$categories[] = $cat;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
unset($categories);
|
58 |
|
59 |
+
/**
|
60 |
+
* Place string in CDATA tag.
|
61 |
+
*
|
62 |
+
* @since unknown
|
63 |
+
*
|
64 |
+
* @param string $str String to place in XML CDATA tag.
|
65 |
+
*/
|
66 |
+
function wxr_cdata($str) {
|
67 |
+
if ( seems_utf8($str) == false )
|
68 |
+
$str = utf8_encode($str);
|
69 |
|
70 |
+
// $str = ent2ncr(esc_html($str));
|
|
|
|
|
|
|
|
|
71 |
|
72 |
+
$str = "<![CDATA[$str" . ( ( substr($str, -1) == ']' ) ? ' ' : '') . "]]>";
|
73 |
|
74 |
+
return $str;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* {@internal Missing Short Description}}
|
79 |
+
*
|
80 |
+
* @since unknown
|
81 |
+
*
|
82 |
+
* @return string Site URL.
|
83 |
+
*/
|
84 |
+
function wxr_site_url() {
|
85 |
+
global $current_site;
|
86 |
|
87 |
+
// mu: the base url
|
88 |
+
if ( isset($current_site->domain) ) {
|
89 |
+
return 'http://'.$current_site->domain.$current_site->path;
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
+
// wp: the blog url
|
92 |
+
else {
|
93 |
+
return get_bloginfo_rss('url');
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* {@internal Missing Short Description}}
|
99 |
+
*
|
100 |
+
* @since unknown
|
101 |
+
*
|
102 |
+
* @param object $c Category Object
|
103 |
+
*/
|
104 |
+
function wxr_cat_name($c) {
|
105 |
+
if ( empty($c->name) )
|
106 |
+
return;
|
107 |
+
|
108 |
+
echo '<wp:cat_name>' . wxr_cdata($c->name) . '</wp:cat_name>';
|
109 |
+
}
|
110 |
|
111 |
+
/**
|
112 |
+
* {@internal Missing Short Description}}
|
113 |
+
*
|
114 |
+
* @since unknown
|
115 |
+
*
|
116 |
+
* @param object $c Category Object
|
117 |
+
*/
|
118 |
+
function wxr_category_description($c) {
|
119 |
+
if ( empty($c->description) )
|
120 |
+
return;
|
121 |
|
122 |
+
echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
|
123 |
+
}
|
124 |
|
125 |
+
/**
|
126 |
+
* {@internal Missing Short Description}}
|
127 |
+
*
|
128 |
+
* @since unknown
|
129 |
+
*
|
130 |
+
* @param object $t Tag Object
|
131 |
+
*/
|
132 |
+
function wxr_tag_name($t) {
|
133 |
+
if ( empty($t->name) )
|
134 |
+
return;
|
135 |
|
136 |
+
echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
|
137 |
+
}
|
138 |
|
139 |
+
/**
|
140 |
+
* {@internal Missing Short Description}}
|
141 |
+
*
|
142 |
+
* @since unknown
|
143 |
+
*
|
144 |
+
* @param object $t Tag Object
|
145 |
+
*/
|
146 |
+
function wxr_tag_description($t) {
|
147 |
+
if ( empty($t->description) )
|
148 |
+
return;
|
149 |
|
150 |
+
echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
|
151 |
+
}
|
152 |
|
153 |
+
/**
|
154 |
+
* {@internal Missing Short Description}}
|
155 |
+
*
|
156 |
+
* @since unknown
|
157 |
+
*/
|
158 |
+
function wxr_post_taxonomy() {
|
159 |
+
$categories = get_the_category();
|
160 |
+
$tags = get_the_tags();
|
161 |
+
$the_list = '';
|
162 |
+
$filter = 'rss';
|
163 |
+
|
164 |
+
if ( !empty($categories) ) foreach ( (array) $categories as $category ) {
|
165 |
+
$cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
|
166 |
+
// for backwards compatibility
|
167 |
+
$the_list .= "\n\t\t<category><![CDATA[$cat_name]]></category>\n";
|
168 |
+
// forwards compatibility: use a unique identifier for each cat to avoid clashes
|
169 |
+
// http://trac.wordpress.org/ticket/5447
|
170 |
+
$the_list .= "\n\t\t<category domain=\"category\" nicename=\"{$category->slug}\"><![CDATA[$cat_name]]></category>\n";
|
171 |
+
}
|
172 |
|
173 |
+
if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {
|
174 |
+
$tag_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
|
175 |
+
$the_list .= "\n\t\t<category domain=\"tag\"><![CDATA[$tag_name]]></category>\n";
|
176 |
+
// forwards compatibility as above
|
177 |
+
$the_list .= "\n\t\t<category domain=\"tag\" nicename=\"{$tag->slug}\"><![CDATA[$tag_name]]></category>\n";
|
178 |
}
|
179 |
|
180 |
+
echo $the_list;
|
181 |
+
}
|
182 |
+
|
183 |
+
// start catching output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
ob_start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
|
|
|
|
|
186 |
|
187 |
+
echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
|
188 |
|
189 |
+
?>
|
190 |
+
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->
|
191 |
+
<!-- It contains information about your blog's posts, comments, and categories. -->
|
192 |
+
<!-- You may use this file to transfer that content from one site to another. -->
|
193 |
+
<!-- This file is not intended to serve as a complete backup of your blog. -->
|
194 |
+
|
195 |
+
<!-- To import this information into a WordPress blog follow these steps. -->
|
196 |
+
<!-- 1. Log into that blog as an administrator. -->
|
197 |
+
<!-- 2. Go to Tools: Import in the blog's admin panels (or Manage: Import in older versions of WordPress). -->
|
198 |
+
<!-- 3. Choose "WordPress" from the list. -->
|
199 |
+
<!-- 4. Upload this file using the form provided on that page. -->
|
200 |
+
<!-- 5. You will first be asked to map the authors in this export file to users -->
|
201 |
+
<!-- on the blog. For each author, you may choose to map to an -->
|
202 |
+
<!-- existing user on the blog or to create a new user -->
|
203 |
+
<!-- 6. WordPress will then import each of the posts, comments, and categories -->
|
204 |
+
<!-- contained in this file into your blog -->
|
205 |
+
|
206 |
+
<?php the_generator('export');?>
|
207 |
+
<rss version="2.0"
|
208 |
+
xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/"
|
209 |
+
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
210 |
+
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
211 |
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
212 |
+
xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/"
|
213 |
+
>
|
214 |
+
|
215 |
+
<channel>
|
216 |
+
<title><?php bloginfo_rss('name'); ?></title>
|
217 |
+
<link><?php bloginfo_rss('url') ?></link>
|
218 |
+
<description><?php bloginfo_rss("description") ?></description>
|
219 |
+
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
|
220 |
+
<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
|
221 |
+
<language><?php echo get_option('rss_language'); ?></language>
|
222 |
+
<wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
|
223 |
+
<wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
|
224 |
+
<wp:base_blog_url><?php bloginfo_rss('url'); ?></wp:base_blog_url>
|
225 |
+
<?php if ( $cats ) : foreach ( $cats as $c ) : ?>
|
226 |
+
<wp:category><wp:category_nicename><?php echo $c->slug; ?></wp:category_nicename><wp:category_parent><?php echo $c->parent ? $cats[$c->parent]->name : ''; ?></wp:category_parent><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
|
227 |
+
<?php endforeach; endif; ?>
|
228 |
+
<?php if ( $tags ) : foreach ( $tags as $t ) : ?>
|
229 |
+
<wp:tag><wp:tag_slug><?php echo $t->slug; ?></wp:tag_slug><?php wxr_tag_name($t); ?><?php wxr_tag_description($t); ?></wp:tag>
|
230 |
+
<?php endforeach; endif; ?>
|
231 |
+
<?php
|
232 |
+
if (count($posts)) {
|
233 |
+
global $wp_query, $post;
|
234 |
+
$wp_query->in_the_loop = true; // Fake being in the loop.
|
235 |
+
foreach ($posts as $post) {
|
236 |
+
setup_postdata($post); ?>
|
237 |
+
<item>
|
238 |
+
<title><?php echo apply_filters('the_title_rss', $post->post_title); ?></title>
|
239 |
+
<link><?php the_permalink_rss() ?></link>
|
240 |
+
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
|
241 |
+
<dc:creator><?php echo wxr_cdata(get_the_author()); ?></dc:creator>
|
242 |
+
<?php wxr_post_taxonomy() ?>
|
243 |
+
|
244 |
+
<guid isPermaLink="false"><?php the_guid(); ?></guid>
|
245 |
+
<description></description>
|
246 |
+
<content:encoded><?php echo wxr_cdata( apply_filters('the_content_export', $post->post_content) ); ?></content:encoded>
|
247 |
+
<excerpt:encoded><?php echo wxr_cdata( apply_filters('the_excerpt_export', $post->post_excerpt) ); ?></excerpt:encoded>
|
248 |
+
<wp:post_id><?php echo $post->ID; ?></wp:post_id>
|
249 |
+
<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
|
250 |
+
<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
|
251 |
+
<wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
|
252 |
+
<wp:ping_status><?php echo $post->ping_status; ?></wp:ping_status>
|
253 |
+
<wp:post_name><?php echo $post->post_name; ?></wp:post_name>
|
254 |
+
<wp:status><?php echo $post->post_status; ?></wp:status>
|
255 |
+
<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
|
256 |
+
<wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
|
257 |
+
<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
|
258 |
+
<?php
|
259 |
+
$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_agent NOT LIKE 'Disqus/%'", $post->ID) );
|
260 |
+
if ( $comments ) { foreach ( $comments as $c ) { ?>
|
261 |
+
<wp:comment>
|
262 |
+
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
|
263 |
+
<wp:comment_author><?php echo wxr_cdata($c->comment_author); ?></wp:comment_author>
|
264 |
+
<wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
|
265 |
+
<wp:comment_author_url><?php echo $c->comment_author_url; ?></wp:comment_author_url>
|
266 |
+
<wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
|
267 |
+
<wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
|
268 |
+
<wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
|
269 |
+
<wp:comment_content><?php echo wxr_cdata($c->comment_content) ?></wp:comment_content>
|
270 |
+
<wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
|
271 |
+
<wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
|
272 |
+
<wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
|
273 |
+
<wp:comment_user_id><?php echo $c->user_id; ?></wp:comment_user_id>
|
274 |
+
</wp:comment>
|
275 |
+
<?php } } // comments ?>
|
276 |
+
</item>
|
277 |
+
<?php } } // count(posts) ?>
|
278 |
+
</channel>
|
279 |
+
</rss>
|
280 |
+
<?php
|
281 |
+
|
282 |
+
// end of WXR output
|
283 |
+
$output = ob_get_contents();
|
284 |
+
ob_end_clean();
|
285 |
+
|
286 |
+
return $output;
|
287 |
}
|
288 |
|
289 |
+
?>
|
images/logo.png
CHANGED
Binary file
|
lib/api.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Implementation of the
|
4 |
*
|
5 |
-
* @author
|
6 |
* @copyright 2007-2008 Big Head Labs
|
7 |
* @link http://disqus.com/
|
8 |
* @package Disqus
|
@@ -11,17 +11,18 @@
|
|
11 |
*/
|
12 |
|
13 |
require_once('url.php');
|
|
|
14 |
|
15 |
/** @#+
|
16 |
* Constants
|
17 |
*/
|
18 |
/**
|
19 |
-
* Base URL for
|
20 |
*/
|
21 |
define('ALLOWED_HTML', '<b><u><i><h1><h2><h3><code><blockquote><br><hr>');
|
22 |
|
23 |
/**
|
24 |
-
* Helper methods for all of the
|
25 |
*
|
26 |
* @package Disqus
|
27 |
* @author DISQUS.com <team@disqus.com>
|
@@ -39,7 +40,7 @@ class DisqusAPI {
|
|
39 |
|
40 |
function get_forum_list($username, $password) {
|
41 |
$credentials = base64_encode($username . ':' . $password);
|
42 |
-
$response =
|
43 |
'credentials' => $credentials,
|
44 |
'response_type' => 'php'
|
45 |
));
|
@@ -56,7 +57,7 @@ class DisqusAPI {
|
|
56 |
|
57 |
function get_forum_api_key($username, $password, $short_name) {
|
58 |
$credentials = base64_encode($username . ':' . $password);
|
59 |
-
$response =
|
60 |
'credentials' => $credentials,
|
61 |
'short_name' => $short_name,
|
62 |
'response_type' => 'php'
|
@@ -83,7 +84,7 @@ class DisqusAPI {
|
|
83 |
|
84 |
$thread_meta = $post->ID . ' ' . $post->guid;
|
85 |
|
86 |
-
$response = @
|
87 |
'short_name' => $this->short_name,
|
88 |
'thread_url' => $permalink,
|
89 |
'thread_meta' => $thread_meta,
|
@@ -107,27 +108,29 @@ class DisqusAPI {
|
|
107 |
return $data;
|
108 |
}
|
109 |
|
110 |
-
function import_wordpress_comments($
|
111 |
-
$
|
|
|
|
|
112 |
array(
|
113 |
-
'
|
114 |
-
'
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
119 |
)
|
120 |
);
|
121 |
-
|
122 |
-
|
123 |
-
if(!$data || $data['stat'] == 'fail') {
|
124 |
return -1;
|
125 |
}
|
126 |
return $data['import_id'];
|
127 |
}
|
128 |
|
129 |
function get_import_status($import_id) {
|
130 |
-
$response = @
|
131 |
'forum_url' => $this->short_name,
|
132 |
'forum_api_key' => $this->forum_api_key,
|
133 |
'import_id' => $import_id,
|
@@ -144,7 +147,7 @@ class DisqusAPI {
|
|
144 |
function wp_check_version() {
|
145 |
global $dsq_version;
|
146 |
|
147 |
-
$response = @
|
148 |
$latest_version = floatval($response['data']);
|
149 |
if($dsq_version < $latest_version) {
|
150 |
return $latest_version;
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Implementation of the Disqus v2 API.
|
4 |
*
|
5 |
+
* @author Disqus <team@disqus.com>
|
6 |
* @copyright 2007-2008 Big Head Labs
|
7 |
* @link http://disqus.com/
|
8 |
* @package Disqus
|
11 |
*/
|
12 |
|
13 |
require_once('url.php');
|
14 |
+
require_once(ABSPATH.WPINC.'/http.php');
|
15 |
|
16 |
/** @#+
|
17 |
* Constants
|
18 |
*/
|
19 |
/**
|
20 |
+
* Base URL for Disqus.
|
21 |
*/
|
22 |
define('ALLOWED_HTML', '<b><u><i><h1><h2><h3><code><blockquote><br><hr>');
|
23 |
|
24 |
/**
|
25 |
+
* Helper methods for all of the Disqus v2 API methods.
|
26 |
*
|
27 |
* @package Disqus
|
28 |
* @author DISQUS.com <team@disqus.com>
|
40 |
|
41 |
function get_forum_list($username, $password) {
|
42 |
$credentials = base64_encode($username . ':' . $password);
|
43 |
+
$response = dsq_urlopen(DISQUS_API_URL . '/api/v2/get_forum_list/', array(
|
44 |
'credentials' => $credentials,
|
45 |
'response_type' => 'php'
|
46 |
));
|
57 |
|
58 |
function get_forum_api_key($username, $password, $short_name) {
|
59 |
$credentials = base64_encode($username . ':' . $password);
|
60 |
+
$response = dsq_urlopen(DISQUS_API_URL . '/api/v2/get_forum_api_key/', array(
|
61 |
'credentials' => $credentials,
|
62 |
'short_name' => $short_name,
|
63 |
'response_type' => 'php'
|
84 |
|
85 |
$thread_meta = $post->ID . ' ' . $post->guid;
|
86 |
|
87 |
+
$response = @dsq_urlopen(DISQUS_API_URL . '/api/v2/get_thread/', array(
|
88 |
'short_name' => $this->short_name,
|
89 |
'thread_url' => $permalink,
|
90 |
'thread_meta' => $thread_meta,
|
108 |
return $data;
|
109 |
}
|
110 |
|
111 |
+
function import_wordpress_comments($wxr) {
|
112 |
+
$http = new WP_Http();
|
113 |
+
$response = $http->request(
|
114 |
+
DISQUS_IMPORTER_URL . '/api/import-wordpress-comments/',
|
115 |
array(
|
116 |
+
'method' => 'POST',
|
117 |
+
'body' => array(
|
118 |
+
'forum_url' => $this->short_name,
|
119 |
+
'forum_api_key' => $this->forum_api_key,
|
120 |
+
'response_type' => 'php',
|
121 |
+
'wxr' => $wxr,
|
122 |
+
)
|
123 |
)
|
124 |
);
|
125 |
+
$data = unserialize($response['body']);
|
126 |
+
if (!$data || $data['stat'] == 'fail') {
|
|
|
127 |
return -1;
|
128 |
}
|
129 |
return $data['import_id'];
|
130 |
}
|
131 |
|
132 |
function get_import_status($import_id) {
|
133 |
+
$response = @dsq_urlopen(DISQUS_IMPORTER_URL . '/api/get-import-status/', array(
|
134 |
'forum_url' => $this->short_name,
|
135 |
'forum_api_key' => $this->forum_api_key,
|
136 |
'import_id' => $import_id,
|
147 |
function wp_check_version() {
|
148 |
global $dsq_version;
|
149 |
|
150 |
+
$response = @dsq_urlopen(DISQUS_MEDIA_URL . '/wp/LATEST_VERSION');
|
151 |
$latest_version = floatval($response['data']);
|
152 |
if($dsq_version < $latest_version) {
|
153 |
return $latest_version;
|
lib/url.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
define('USER_AGENT', 'Disqus-WPPlugin/2.0-dev');
|
3 |
|
4 |
-
function
|
5 |
$postdata_str = '';
|
6 |
|
7 |
if($postdata) {
|
@@ -14,9 +14,9 @@ function get_query_string($postdata) {
|
|
14 |
}
|
15 |
|
16 |
|
17 |
-
function
|
18 |
if(!$file_name || !$file_field) {
|
19 |
-
return
|
20 |
}
|
21 |
|
22 |
$content = array();
|
@@ -35,7 +35,7 @@ function get_post_content($boundary, $postdata, $file_name, $file_field) {
|
|
35 |
}
|
36 |
|
37 |
|
38 |
-
function
|
39 |
$headers = array();
|
40 |
$headers[] = 'User-Agent: ' . USER_AGENT;
|
41 |
$headers[] = 'Connection: close';
|
@@ -51,14 +51,15 @@ function get_http_headers_for_request($boundary, $content, $file_name, $file_fie
|
|
51 |
}
|
52 |
|
53 |
|
54 |
-
function
|
55 |
$c = curl_init($url);
|
56 |
-
$postdata_str =
|
57 |
|
58 |
$c_options = array(
|
59 |
CURLOPT_USERAGENT => USER_AGENT,
|
60 |
CURLOPT_RETURNTRANSFER => true,
|
61 |
CURLOPT_POST => ($postdata_str ? 1 : 0),
|
|
|
62 |
);
|
63 |
if($postdata) {
|
64 |
$c_options[CURLOPT_POSTFIELDS] = $postdata_str;
|
@@ -75,12 +76,12 @@ function _curl_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
|
75 |
}
|
76 |
|
77 |
|
78 |
-
function
|
79 |
$buf = '';
|
80 |
$req = '';
|
81 |
$length = 0;
|
82 |
$boundary = '----------' . md5(time());
|
83 |
-
$postdata_str =
|
84 |
$url_pieces = parse_url($url);
|
85 |
|
86 |
// Set default port for supported schemes if none is provided.
|
@@ -111,7 +112,7 @@ function _fsockopen_urlopen($url, $postdata, &$response, $file_name, $file_field
|
|
111 |
if(!$fp) { return false; }
|
112 |
$req .= ($postdata_str ? 'POST' : 'GET') . ' ' . $url_pieces['path'] . " HTTP/1.1\r\n";
|
113 |
$req .= 'Host: ' . $host . "\r\n";
|
114 |
-
$req .=
|
115 |
if($postdata_str) {
|
116 |
$req .= "\r\n\r\n" . $postdata_str;
|
117 |
}
|
@@ -160,12 +161,12 @@ function _fsockopen_urlopen($url, $postdata, &$response, $file_name, $file_field
|
|
160 |
}
|
161 |
|
162 |
|
163 |
-
function
|
164 |
$params = array();
|
165 |
if($file_name && $file_field) {
|
166 |
$boundary = '----------' . md5(time());
|
167 |
-
$content =
|
168 |
-
$header =
|
169 |
|
170 |
$params = array('http' => array(
|
171 |
'method' => 'POST',
|
@@ -177,7 +178,7 @@ function _fopen_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
|
177 |
$params = array('http' => array(
|
178 |
'method' => 'POST',
|
179 |
'header' => 'Content-Type: application/x-www-form-urlencoded',
|
180 |
-
'content' =>
|
181 |
));
|
182 |
}
|
183 |
}
|
@@ -220,7 +221,7 @@ function _fopen_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
|
220 |
* be the name of the file and field is the name
|
221 |
* of the field to POST.
|
222 |
*/
|
223 |
-
function
|
224 |
$response = array(
|
225 |
'data' => '',
|
226 |
'code' => 0
|
@@ -234,6 +235,8 @@ function urlopen($url, $postdata=false, $file=false) {
|
|
234 |
$file_field = false;
|
235 |
}
|
236 |
|
|
|
|
|
237 |
// Try curl, fsockopen, fopen + stream (PHP5 only), exec wget
|
238 |
if(function_exists('curl_init')) {
|
239 |
if (!function_exists('curl_setopt_array')) {
|
@@ -247,14 +250,16 @@ function urlopen($url, $postdata=false, $file=false) {
|
|
247 |
return true;
|
248 |
}
|
249 |
}
|
250 |
-
|
251 |
} else if(ini_get('allow_url_fopen') && function_exists('stream_get_contents')) {
|
252 |
-
|
253 |
} else {
|
254 |
// TODO: Find the failure condition for fsockopen() (sockets?)
|
255 |
-
|
256 |
}
|
257 |
|
|
|
|
|
258 |
return $response;
|
259 |
}
|
260 |
?>
|
1 |
<?php
|
2 |
define('USER_AGENT', 'Disqus-WPPlugin/2.0-dev');
|
3 |
|
4 |
+
function dsq_get_query_string($postdata) {
|
5 |
$postdata_str = '';
|
6 |
|
7 |
if($postdata) {
|
14 |
}
|
15 |
|
16 |
|
17 |
+
function dsq_get_post_content($boundary, $postdata, $file_name, $file_field) {
|
18 |
if(!$file_name || !$file_field) {
|
19 |
+
return dsq_get_query_string($postdata);
|
20 |
}
|
21 |
|
22 |
$content = array();
|
35 |
}
|
36 |
|
37 |
|
38 |
+
function dsq_get_http_headers_for_request($boundary, $content, $file_name, $file_field) {
|
39 |
$headers = array();
|
40 |
$headers[] = 'User-Agent: ' . USER_AGENT;
|
41 |
$headers[] = 'Connection: close';
|
51 |
}
|
52 |
|
53 |
|
54 |
+
function _dsq_curl_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
55 |
$c = curl_init($url);
|
56 |
+
$postdata_str = dsq_get_query_string($postdata);
|
57 |
|
58 |
$c_options = array(
|
59 |
CURLOPT_USERAGENT => USER_AGENT,
|
60 |
CURLOPT_RETURNTRANSFER => true,
|
61 |
CURLOPT_POST => ($postdata_str ? 1 : 0),
|
62 |
+
CURLOPT_HTTPHEADER => array('Expect:')
|
63 |
);
|
64 |
if($postdata) {
|
65 |
$c_options[CURLOPT_POSTFIELDS] = $postdata_str;
|
76 |
}
|
77 |
|
78 |
|
79 |
+
function _dsq_fsockopen_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
80 |
$buf = '';
|
81 |
$req = '';
|
82 |
$length = 0;
|
83 |
$boundary = '----------' . md5(time());
|
84 |
+
$postdata_str = dsq_get_post_content($boundary, $postdata, $file_name, $file_field);
|
85 |
$url_pieces = parse_url($url);
|
86 |
|
87 |
// Set default port for supported schemes if none is provided.
|
112 |
if(!$fp) { return false; }
|
113 |
$req .= ($postdata_str ? 'POST' : 'GET') . ' ' . $url_pieces['path'] . " HTTP/1.1\r\n";
|
114 |
$req .= 'Host: ' . $host . "\r\n";
|
115 |
+
$req .= dsq_get_http_headers_for_request($boundary, $postdata_str, $file_name, $file_field);
|
116 |
if($postdata_str) {
|
117 |
$req .= "\r\n\r\n" . $postdata_str;
|
118 |
}
|
161 |
}
|
162 |
|
163 |
|
164 |
+
function _dsq_fopen_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
165 |
$params = array();
|
166 |
if($file_name && $file_field) {
|
167 |
$boundary = '----------' . md5(time());
|
168 |
+
$content = dsq_get_post_content($boundary, $postdata, $file_name, $file_field);
|
169 |
+
$header = dsq_get_http_headers_for_request($boundary, $content, $file_name, $file_field);
|
170 |
|
171 |
$params = array('http' => array(
|
172 |
'method' => 'POST',
|
178 |
$params = array('http' => array(
|
179 |
'method' => 'POST',
|
180 |
'header' => 'Content-Type: application/x-www-form-urlencoded',
|
181 |
+
'content' => dsq_get_query_string($postdata)
|
182 |
));
|
183 |
}
|
184 |
}
|
221 |
* be the name of the file and field is the name
|
222 |
* of the field to POST.
|
223 |
*/
|
224 |
+
function dsq_urlopen($url, $postdata=false, $file=false) {
|
225 |
$response = array(
|
226 |
'data' => '',
|
227 |
'code' => 0
|
235 |
$file_field = false;
|
236 |
}
|
237 |
|
238 |
+
//
|
239 |
+
|
240 |
// Try curl, fsockopen, fopen + stream (PHP5 only), exec wget
|
241 |
if(function_exists('curl_init')) {
|
242 |
if (!function_exists('curl_setopt_array')) {
|
250 |
return true;
|
251 |
}
|
252 |
}
|
253 |
+
_dsq_curl_urlopen($url, $postdata, $response, $file_name, $file_field);
|
254 |
} else if(ini_get('allow_url_fopen') && function_exists('stream_get_contents')) {
|
255 |
+
_dsq_fopen_urlopen($url, $postdata, $response, $file_name, $file_field);
|
256 |
} else {
|
257 |
// TODO: Find the failure condition for fsockopen() (sockets?)
|
258 |
+
_dsq_fsockopen_urlopen($url, $postdata, $response, $file_name, $file_field);
|
259 |
}
|
260 |
|
261 |
+
// returns array with keys data and code (from headers)
|
262 |
+
|
263 |
return $response;
|
264 |
}
|
265 |
?>
|
manage.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<?php
|
2 |
-
global $
|
3 |
-
global $dsq_version;
|
4 |
-
global $dsq_api;
|
5 |
|
6 |
if ( !current_user_can('manage_options') ) {
|
7 |
die();
|
@@ -30,6 +28,7 @@ if( isset($_POST['export']) ) {
|
|
30 |
if ( isset($_POST['uninstall']) ) {
|
31 |
update_option('disqus_forum_url', '');
|
32 |
update_option('disqus_api_key', '');
|
|
|
33 |
}
|
34 |
|
35 |
// Clean-up POST parameters.
|
@@ -44,11 +43,18 @@ if ( isset($_POST['dsq_forum_url']) && isset($_POST['dsq_username']) && isset($_
|
|
44 |
|
45 |
if ( is_numeric($api_key) && $api_key < 0 ) {
|
46 |
update_option('disqus_replace', 'replace');
|
47 |
-
dsq_manage_dialog('There was an error completing the installation of Disqus. If you are still having issues, refer to the <a href="http://disqus.com/
|
48 |
} else {
|
49 |
update_option('disqus_api_key', $api_key);
|
50 |
update_option('disqus_replace', 'all');
|
51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
|
54 |
// Handle advanced options.
|
@@ -58,19 +64,14 @@ if ( isset($_POST['disqus_forum_url']) && isset($_POST['disqus_replace']) ) {
|
|
58 |
$disqus_forum_url = substr($disqus_forum_url, 0, $dot_pos);
|
59 |
}
|
60 |
update_option('disqus_forum_url', $disqus_forum_url);
|
|
|
61 |
update_option('disqus_replace', $_POST['disqus_replace']);
|
62 |
-
|
63 |
-
if(isset($_POST['disqus_cc_fix'])) {
|
64 |
-
update_option('disqus_cc_fix', true);
|
65 |
-
} else {
|
66 |
-
update_option('disqus_cc_fix', false);
|
67 |
-
}
|
68 |
-
|
69 |
dsq_manage_dialog('Your settings have been changed.');
|
70 |
}
|
71 |
|
72 |
// Get installation step process (or 0 if we're already installed).
|
73 |
-
$step = intval($_GET['step']);
|
74 |
$step = ($step > 0 && isset($_POST['dsq_username'])) ? $step : 1;
|
75 |
$step = (dsq_is_installed()) ? 0 : $step;
|
76 |
|
@@ -86,24 +87,12 @@ if ( 2 == $step && isset($_POST['dsq_username']) && isset($_POST['dsq_password']
|
|
86 |
}
|
87 |
}
|
88 |
|
89 |
-
// HACK: Our own styles for older versions of WordPress.
|
90 |
-
if ( $wp_version < 2.5 ) {
|
91 |
-
echo "<link rel='stylesheet' href='" . DSQ_PLUGIN_URL . "/styles/manage-pre25.css' type='text/css' />";
|
92 |
-
}
|
93 |
-
|
94 |
?>
|
95 |
-
<!-- Header -->
|
96 |
-
<link rel='stylesheet' href='<?php echo DSQ_PLUGIN_URL; ?>/styles/manage.css' type='text/css' />
|
97 |
-
<script type="text/javascript" src='<?php echo DSQ_PLUGIN_URL; ?>/scripts/manage.js'></script>
|
98 |
-
|
99 |
<div class="wrap" id="dsq-wrap">
|
100 |
-
<img src="<?php echo DSQ_PLUGIN_URL; ?>/images/logo.png">
|
101 |
-
|
102 |
<ul id="dsq-tabs">
|
103 |
-
<li class="selected" id="dsq-tab-main"><?php echo (dsq_is_installed() ? 'Manage' : 'Install'); ?></li>
|
104 |
-
<li id="dsq-tab-advanced">Advanced Options</li>
|
105 |
</ul>
|
106 |
-
<!-- /Header -->
|
107 |
|
108 |
<div id="dsq-main" class="dsq-content">
|
109 |
<?php
|
@@ -154,7 +143,7 @@ case 1:
|
|
154 |
<tr>
|
155 |
<th scope="row" valign="top">Username</th>
|
156 |
<td>
|
157 |
-
<input id="dsq-username" name="dsq_username" tabindex="1"
|
158 |
<a href="http://disqus.com/profile/">(don't have a Disqus Profile yet?)</a>
|
159 |
</td>
|
160 |
</tr>
|
@@ -179,9 +168,8 @@ case 1:
|
|
179 |
case 0:
|
180 |
?>
|
181 |
<div class="dsq-main">
|
182 |
-
<h2>
|
183 |
-
<
|
184 |
-
<iframe src="<?php echo DISQUS_API_URL; ?>/admin/moderate/<?php echo get_option('disqus_forum_url'); ?>/?template=wordpress" style="width: 100%; height: 800px"></iframe>
|
185 |
</div>
|
186 |
<?php } ?>
|
187 |
</div>
|
@@ -190,33 +178,20 @@ case 0:
|
|
190 |
$dsq_replace = get_option('disqus_replace');
|
191 |
$dsq_forum_url = strtolower(get_option('disqus_forum_url'));
|
192 |
$dsq_api_key = get_option('disqus_api_key');
|
|
|
193 |
$dsq_cc_fix = get_option('disqus_cc_fix');
|
194 |
-
|
195 |
-
if(dsq_is_installed()) {
|
196 |
-
$dsq_last_import_id = get_option('disqus_last_import_id');
|
197 |
-
$dsq_import_status = $dsq_api->get_import_status($dsq_last_import_id);
|
198 |
-
}
|
199 |
?>
|
200 |
<!-- Advanced options -->
|
201 |
-
<div id="dsq-advanced" class="dsq-content" style="display:none;">
|
202 |
<h2>Advanced Options</h2>
|
203 |
-
Version: <?php echo $dsq_version; ?>
|
204 |
-
<?php
|
205 |
-
if(function_exists('curl_init')) {
|
206 |
-
echo ' (Using cURL libraries.)';
|
207 |
-
} else if(ini_get('allow_url_fopen') && function_exists('stream_get_contents')) {
|
208 |
-
echo ' (Using fopen.)';
|
209 |
-
} else {
|
210 |
-
echo ' (Using fsockopen.)';
|
211 |
-
}
|
212 |
-
?>
|
213 |
<form method="POST">
|
214 |
<?php wp_nonce_field('dsq-advanced'); ?>
|
215 |
<table class="form-table">
|
216 |
<tr>
|
217 |
<th scope="row" valign="top">Disqus short name</th>
|
218 |
<td>
|
219 |
-
<input name="disqus_forum_url" value="<?php echo $dsq_forum_url; ?>" tabindex="1"
|
220 |
<br />
|
221 |
This is the unique identifier for your website on Disqus Comments.
|
222 |
</td>
|
@@ -225,12 +200,21 @@ if(function_exists('curl_init')) {
|
|
225 |
<tr>
|
226 |
<th scope="row" valign="top">Disqus API Key</th>
|
227 |
<td>
|
228 |
-
<input type="text" name="disqus_api_key" value="<?php echo $dsq_api_key; ?>" tabindex="2">
|
229 |
<br />
|
230 |
This is set for you when going through the installation steps.
|
231 |
</td>
|
232 |
</tr>
|
233 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
<tr>
|
235 |
<th scope="row" valign="top">Use Disqus Comments on</th>
|
236 |
<td>
|
@@ -247,44 +231,28 @@ if(function_exists('curl_init')) {
|
|
247 |
</tr>
|
248 |
|
249 |
<tr>
|
250 |
-
<th scope="row" valign="top">Comment
|
251 |
<td>
|
252 |
<input type="checkbox" id="disqus_comment_count" name="disqus_cc_fix" <?php if($dsq_cc_fix){echo 'checked="checked"';}?> >
|
253 |
-
<label for="disqus_comment_count">
|
|
|
254 |
</td>
|
255 |
</tr>
|
256 |
|
257 |
</table>
|
258 |
|
259 |
<p class="submit" style="text-align: left">
|
260 |
-
<input name="submit" type="submit" value="Save" tabindex="4">
|
261 |
</p>
|
262 |
</form>
|
263 |
|
264 |
<table class="form-table">
|
265 |
<tr>
|
266 |
-
<th scope="row" valign="top">
|
267 |
<td>
|
268 |
-
<
|
269 |
-
|
270 |
-
|
271 |
-
<?php if($dsq_last_import_id) : ?>
|
272 |
-
onclick="return confirm('You\'ve already imported your comments. Are you sure you want to do this again?');"
|
273 |
-
<?php endif; ?>
|
274 |
-
> This will sync your WordPress comments with Disqus
|
275 |
-
<br />
|
276 |
-
<span style="font-size: 14px;">
|
277 |
-
<?php if($dsq_last_import_id) : ?>
|
278 |
-
<strong>Import status:</strong> <?php echo $dsq_import_status['status_name']; ?><br />
|
279 |
-
<?php if($dsq_import_status['finished_at']) : ?>
|
280 |
-
<strong>Finished:</strong> <?php echo $dsq_import_status['finished_at']; ?><br />
|
281 |
-
<?php elseif($dsq_import_status['started_at']) : ?>
|
282 |
-
<strong>Started:</strong> <?php echo $dsq_import_status['started_at']; ?><br />
|
283 |
-
<?php endif; ?>
|
284 |
-
<br /><br />
|
285 |
-
<?php endif; ?>
|
286 |
-
</span>
|
287 |
-
</form>
|
288 |
</td>
|
289 |
</tr>
|
290 |
|
@@ -293,10 +261,12 @@ if(function_exists('curl_init')) {
|
|
293 |
<td>
|
294 |
<form action="?page=disqus" method="POST">
|
295 |
<?php wp_nonce_field('dsq-uninstall'); ?>
|
296 |
-
<input type="submit" value="Uninstall" name="uninstall" onclick="return confirm('Are you sure you want to uninstall
|
297 |
</form>
|
298 |
</td>
|
299 |
</tr>
|
|
|
300 |
</table>
|
|
|
301 |
</div>
|
302 |
</div>
|
1 |
<?php
|
2 |
+
global $dsq_version, $dsq_api;
|
|
|
|
|
3 |
|
4 |
if ( !current_user_can('manage_options') ) {
|
5 |
die();
|
28 |
if ( isset($_POST['uninstall']) ) {
|
29 |
update_option('disqus_forum_url', '');
|
30 |
update_option('disqus_api_key', '');
|
31 |
+
update_option('disqus_partner_key', '');
|
32 |
}
|
33 |
|
34 |
// Clean-up POST parameters.
|
43 |
|
44 |
if ( is_numeric($api_key) && $api_key < 0 ) {
|
45 |
update_option('disqus_replace', 'replace');
|
46 |
+
dsq_manage_dialog('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>.', true);
|
47 |
} else {
|
48 |
update_option('disqus_api_key', $api_key);
|
49 |
update_option('disqus_replace', 'all');
|
50 |
}
|
51 |
+
|
52 |
+
if (!empty($_POST['disqus_partner_key'])) {
|
53 |
+
$partner_key = trim(stripslashes($_POST['disqus_partner_key']));
|
54 |
+
if (!empty($partner_key)) {
|
55 |
+
update_option('disqus_partner_key', $partner_key);
|
56 |
+
}
|
57 |
+
}
|
58 |
}
|
59 |
|
60 |
// Handle advanced options.
|
64 |
$disqus_forum_url = substr($disqus_forum_url, 0, $dot_pos);
|
65 |
}
|
66 |
update_option('disqus_forum_url', $disqus_forum_url);
|
67 |
+
update_option('disqus_partner_key', trim(stripslashes($_POST['disqus_partner_key'])));
|
68 |
update_option('disqus_replace', $_POST['disqus_replace']);
|
69 |
+
update_option('disqus_cc_fix', isset($_POST['disqus_cc_fix']));
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
dsq_manage_dialog('Your settings have been changed.');
|
71 |
}
|
72 |
|
73 |
// Get installation step process (or 0 if we're already installed).
|
74 |
+
$step = @intval($_GET['step']);
|
75 |
$step = ($step > 0 && isset($_POST['dsq_username'])) ? $step : 1;
|
76 |
$step = (dsq_is_installed()) ? 0 : $step;
|
77 |
|
87 |
}
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
90 |
?>
|
|
|
|
|
|
|
|
|
91 |
<div class="wrap" id="dsq-wrap">
|
|
|
|
|
92 |
<ul id="dsq-tabs">
|
93 |
+
<li class="selected" id="dsq-tab-main" rel="dsq-main"><?php echo (dsq_is_installed() ? 'Manage' : 'Install'); ?></li>
|
94 |
+
<li id="dsq-tab-advanced" rel="dsq-advanced">Advanced Options</li>
|
95 |
</ul>
|
|
|
96 |
|
97 |
<div id="dsq-main" class="dsq-content">
|
98 |
<?php
|
143 |
<tr>
|
144 |
<th scope="row" valign="top">Username</th>
|
145 |
<td>
|
146 |
+
<input id="dsq-username" name="dsq_username" tabindex="1" type="text" />
|
147 |
<a href="http://disqus.com/profile/">(don't have a Disqus Profile yet?)</a>
|
148 |
</td>
|
149 |
</tr>
|
168 |
case 0:
|
169 |
?>
|
170 |
<div class="dsq-main">
|
171 |
+
<h2>Comments</h2>
|
172 |
+
<iframe src="<?php echo DISQUS_API_URL; ?>/comments/moderate/<?php echo get_option('disqus_forum_url'); ?>/?template=wordpress" style="width: 100%; height: 800px"></iframe>
|
|
|
173 |
</div>
|
174 |
<?php } ?>
|
175 |
</div>
|
178 |
$dsq_replace = get_option('disqus_replace');
|
179 |
$dsq_forum_url = strtolower(get_option('disqus_forum_url'));
|
180 |
$dsq_api_key = get_option('disqus_api_key');
|
181 |
+
$dsq_partner_key = get_option('disqus_partner_key');
|
182 |
$dsq_cc_fix = get_option('disqus_cc_fix');
|
|
|
|
|
|
|
|
|
|
|
183 |
?>
|
184 |
<!-- Advanced options -->
|
185 |
+
<div id="dsq-advanced" class="dsq-content dsq-advanced" style="display:none;">
|
186 |
<h2>Advanced Options</h2>
|
187 |
+
Version: <?php echo esc_html($dsq_version); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
<form method="POST">
|
189 |
<?php wp_nonce_field('dsq-advanced'); ?>
|
190 |
<table class="form-table">
|
191 |
<tr>
|
192 |
<th scope="row" valign="top">Disqus short name</th>
|
193 |
<td>
|
194 |
+
<input name="disqus_forum_url" value="<?php echo esc_attr($dsq_forum_url); ?>" tabindex="1" type="text" />
|
195 |
<br />
|
196 |
This is the unique identifier for your website on Disqus Comments.
|
197 |
</td>
|
200 |
<tr>
|
201 |
<th scope="row" valign="top">Disqus API Key</th>
|
202 |
<td>
|
203 |
+
<input type="text" name="disqus_api_key" value="<?php echo esc_attr($dsq_api_key); ?>" tabindex="2">
|
204 |
<br />
|
205 |
This is set for you when going through the installation steps.
|
206 |
</td>
|
207 |
</tr>
|
208 |
|
209 |
+
<tr>
|
210 |
+
<th scope="row" valign="top">Disqus Partner Key</th>
|
211 |
+
<td>
|
212 |
+
<input type="text" name="disqus_partner_key" value="<?php echo esc_attr($dsq_partner_key); ?>" tabindex="2">
|
213 |
+
<br />
|
214 |
+
Advanced: Used for single sign-on (SSO) integration. (<a href="http://disqus.com/help/sso" onclick="window.open(this.href); return false">more info on SSO</a>)
|
215 |
+
</td>
|
216 |
+
</tr>
|
217 |
+
|
218 |
<tr>
|
219 |
<th scope="row" valign="top">Use Disqus Comments on</th>
|
220 |
<td>
|
231 |
</tr>
|
232 |
|
233 |
<tr>
|
234 |
+
<th scope="row" valign="top">Comment Counts</th>
|
235 |
<td>
|
236 |
<input type="checkbox" id="disqus_comment_count" name="disqus_cc_fix" <?php if($dsq_cc_fix){echo 'checked="checked"';}?> >
|
237 |
+
<label for="disqus_comment_count">Output JavaScript in footer</label>
|
238 |
+
<br />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="http://disqus.com/help/wordpress" onclick="window.open(this.href); return false">more info</a>).
|
239 |
</td>
|
240 |
</tr>
|
241 |
|
242 |
</table>
|
243 |
|
244 |
<p class="submit" style="text-align: left">
|
245 |
+
<input name="submit" type="submit" value="Save" class="button-primary button" tabindex="4">
|
246 |
</p>
|
247 |
</form>
|
248 |
|
249 |
<table class="form-table">
|
250 |
<tr>
|
251 |
+
<th scope="row" valign="top">Export comments to Disqus</th>
|
252 |
<td>
|
253 |
+
<div id="dsq_export">
|
254 |
+
<p class="status"><a href="#" class="button">Export Comments</a> This will sync your WordPress comments with Disqus</p>
|
255 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
</td>
|
257 |
</tr>
|
258 |
|
261 |
<td>
|
262 |
<form action="?page=disqus" method="POST">
|
263 |
<?php wp_nonce_field('dsq-uninstall'); ?>
|
264 |
+
<input type="submit" value="Uninstall" name="uninstall" onclick="return confirm('Are you sure you want to uninstall Disqus?')" class="button" />
|
265 |
</form>
|
266 |
</td>
|
267 |
</tr>
|
268 |
+
|
269 |
</table>
|
270 |
+
|
271 |
</div>
|
272 |
</div>
|
readme.txt
CHANGED
@@ -1,17 +1,16 @@
|
|
1 |
-
===
|
2 |
-
Contributors:
|
3 |
Tags: comments, threaded, email, notification, spam, avatars, community, profile, widget
|
4 |
-
Requires at least: 2.
|
5 |
-
Tested up to: 2.
|
6 |
-
Stable tag: 2.
|
7 |
|
8 |
-
The
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
Disqus, pronounced "discuss", is a service and tool for web comments and
|
13 |
-
discussions.
|
14 |
-
blog, or application. Disqus makes commenting easier and more interactive,
|
15 |
while connecting websites and commenters across a thriving discussion
|
16 |
community.
|
17 |
|
@@ -29,8 +28,9 @@ The Disqus for WordPress plugin seamlessly integrates using the Disqus API and b
|
|
29 |
* Threaded comments and replies
|
30 |
* Notifications and reply by email
|
31 |
* Subscribe and RSS options
|
|
|
32 |
* Powerful moderation and admin tools
|
33 |
-
* Full spam filtering
|
34 |
* Support for Disqus community widgets
|
35 |
* Connected with a large discussion community
|
36 |
* Increased exposure and readership
|
@@ -50,7 +50,7 @@ The Disqus for WordPress plugin seamlessly integrates using the Disqus API and b
|
|
50 |
|
51 |
= More documentation =
|
52 |
|
53 |
-
Go to http://disqus.com/
|
54 |
|
55 |
== Upgrading ==
|
56 |
|
@@ -63,4 +63,8 @@ Go to http://disqus.com/docs/wordpress
|
|
63 |
|
64 |
== Support ==
|
65 |
|
66 |
-
* Visit
|
|
|
|
|
|
|
|
1 |
+
=== Disqus Comment System ===
|
2 |
+
Contributors: disqus, alexkingorg, crowdfavorite
|
3 |
Tags: comments, threaded, email, notification, spam, avatars, community, profile, widget
|
4 |
+
Requires at least: 2.8
|
5 |
+
Tested up to: 2.9.2
|
6 |
+
Stable tag: 2.3.8581
|
7 |
|
8 |
+
The Disqus comment system replaces your WordPress comment system with your comments hosted and powered by Disqus.
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
Disqus, pronounced "discuss", is a service and tool for web comments and
|
13 |
+
discussions. Disqus makes commenting easier and more interactive,
|
|
|
14 |
while connecting websites and commenters across a thriving discussion
|
15 |
community.
|
16 |
|
28 |
* Threaded comments and replies
|
29 |
* Notifications and reply by email
|
30 |
* Subscribe and RSS options
|
31 |
+
* Aggregated comments and social mentions
|
32 |
* Powerful moderation and admin tools
|
33 |
+
* Full spam filtering, blacklists and whitelists
|
34 |
* Support for Disqus community widgets
|
35 |
* Connected with a large discussion community
|
36 |
* Increased exposure and readership
|
50 |
|
51 |
= More documentation =
|
52 |
|
53 |
+
Go to [http://disqus.com/help/wordpress](http://disqus.com/help/wordpress)
|
54 |
|
55 |
== Upgrading ==
|
56 |
|
63 |
|
64 |
== Support ==
|
65 |
|
66 |
+
* Visit http://disqus.com/help/wordpress for help documentation.
|
67 |
+
|
68 |
+
* Visit http://help.disqus.com for help from our support team.
|
69 |
+
|
70 |
+
* Disqus also recommends the [WordPress HelpCenter](http://wphelpcenter.com/) for extended help. Disqus is not associated with the WordPress HelpCenter in any way.
|
styles/manage.css
CHANGED
@@ -1,28 +1,35 @@
|
|
1 |
-
ul#dsq-tabs li
|
2 |
-
|
3 |
-
|
|
|
4 |
}
|
5 |
ul#dsq-tabs li {
|
6 |
float: left;
|
7 |
-
border: 3px solid #999;
|
8 |
-
border-left-color: #ccc;
|
9 |
-
border-top-color: #ccc;
|
10 |
color: #333;
|
11 |
padding: 0.25em;
|
12 |
-
height:
|
13 |
cursor: pointer;
|
14 |
-
margin-right:
|
15 |
}
|
16 |
|
17 |
ul#dsq-tabs {
|
18 |
display: block;
|
19 |
-
height:
|
20 |
list-style: none;
|
21 |
margin: 15px 0;
|
22 |
padding: 0;
|
23 |
border: 0;
|
|
|
|
|
24 |
}
|
25 |
|
26 |
select.disqus-replace {
|
27 |
border-color: #C6D9E9;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
1 |
+
ul#dsq-tabs li {
|
2 |
+
}
|
3 |
+
ul#dsq-tabs li.selected {
|
4 |
+
border-bottom: 3px solid #ffa100;
|
5 |
}
|
6 |
ul#dsq-tabs li {
|
7 |
float: left;
|
|
|
|
|
|
|
8 |
color: #333;
|
9 |
padding: 0.25em;
|
10 |
+
height: 16px;
|
11 |
cursor: pointer;
|
12 |
+
margin-right: 8px;
|
13 |
}
|
14 |
|
15 |
ul#dsq-tabs {
|
16 |
display: block;
|
17 |
+
height: 20px;
|
18 |
list-style: none;
|
19 |
margin: 15px 0;
|
20 |
padding: 0;
|
21 |
border: 0;
|
22 |
+
position: absolute;
|
23 |
+
right: 10px;
|
24 |
}
|
25 |
|
26 |
select.disqus-replace {
|
27 |
border-color: #C6D9E9;
|
28 |
+
}
|
29 |
+
|
30 |
+
.dsq-content h2 {
|
31 |
+
background: url(../images/logo.png) no-repeat;
|
32 |
+
line-height: 41px;
|
33 |
+
margin: 15px 0 10px;
|
34 |
+
padding: 0 0 0 150px;
|
35 |
}
|