Version Description
Download this release
Release Info
Developer | ryanv12 |
Plugin | Disqus Comment System |
Version | 2.77 |
Comparing to | |
See all releases |
Code changes from version 2.74 to 2.77
- comments.php +5 -5
- disqus.php +16 -20
- lib/api/disqus/disqus.php +2 -2
- lib/api/disqus/json.php +1 -1
- lib/wp-api.php +2 -1
- locales/default.mo +0 -0
- locales/default.po +112 -116
- manage.php +179 -121
- media/styles/manage.css +17 -0
- readme.txt +24 -2
- trunk/LICENSE +0 -674
- trunk/comments.php +0 -134
- trunk/disqus.php +0 -1583
- trunk/export.php +0 -195
- trunk/lib/api/LICENSE +0 -202
- trunk/lib/api/README.rst +0 -18
- trunk/lib/api/disqus/disqus.php +0 -461
- trunk/lib/api/disqus/json.php +0 -378
- trunk/lib/api/disqus/url.php +0 -295
- trunk/lib/wp-api.php +0 -107
- trunk/lib/wp-cli.php +0 -88
- trunk/locales/default.mo +0 -0
- trunk/locales/default.po +0 -423
- trunk/locales/index.html +0 -0
- trunk/manage.php +0 -601
- trunk/media/images/logo.png +0 -0
- trunk/media/styles/manage-pre25.css +0 -67
- trunk/media/styles/manage.css +0 -42
- trunk/readme.txt +0 -287
- trunk/screenshot-1.png +0 -0
- trunk/screenshot-2.png +0 -0
- trunk/screenshot-3.png +0 -0
- trunk/scripts/export-comments.php +0 -106
- trunk/scripts/import-comments.php +0 -63
- trunk/upgrade.php +0 -21
- trunk/xd_receiver.htm +0 -1
- upgrade.php +2 -1
comments.php
CHANGED
@@ -49,13 +49,13 @@ if (DISQUS_DEBUG) {
|
|
49 |
var disqus_domain = '<?php echo DISQUS_DOMAIN; ?>';
|
50 |
var disqus_shortname = '<?php echo strtolower(get_option('disqus_forum_url')); ?>';
|
51 |
var disqus_title = <?php echo cf_json_encode(dsq_title_for_post($post)); ?>;
|
52 |
-
<?php if (false && get_option('disqus_developer')): ?>
|
53 |
-
var disqus_developer = 1;
|
54 |
-
<?php endif; ?>
|
55 |
var disqus_config = function () {
|
56 |
var config = this; // Access to the config object
|
57 |
config.language = '<?php echo esc_js(apply_filters('disqus_language_filter', '')) ?>';
|
58 |
|
|
|
|
|
|
|
59 |
/*
|
60 |
All currently supported events:
|
61 |
* preData — fires just before we request for initial data
|
@@ -99,7 +99,7 @@ if (DISQUS_DEBUG) {
|
|
99 |
'trackbacks': [
|
100 |
<?php
|
101 |
$count = 0;
|
102 |
-
foreach ($comments as $comment) {
|
103 |
$comment_type = get_comment_type();
|
104 |
if ( $comment_type != 'comment' ) {
|
105 |
if( $count ) { echo ','; }
|
@@ -127,7 +127,7 @@ if (DISQUS_DEBUG) {
|
|
127 |
(function() {
|
128 |
var dsq = document.createElement('script'); dsq.type = 'text/javascript';
|
129 |
dsq.async = true;
|
130 |
-
dsq.src = '//' + disqus_shortname + '.' + '<?php echo DISQUS_DOMAIN; ?>' + '/embed.js?pname=wordpress&pver=<?php echo DISQUS_VERSION; ?>';
|
131 |
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
132 |
})();
|
133 |
/* ]]> */
|
49 |
var disqus_domain = '<?php echo DISQUS_DOMAIN; ?>';
|
50 |
var disqus_shortname = '<?php echo strtolower(get_option('disqus_forum_url')); ?>';
|
51 |
var disqus_title = <?php echo cf_json_encode(dsq_title_for_post($post)); ?>;
|
|
|
|
|
|
|
52 |
var disqus_config = function () {
|
53 |
var config = this; // Access to the config object
|
54 |
config.language = '<?php echo esc_js(apply_filters('disqus_language_filter', '')) ?>';
|
55 |
|
56 |
+
/* Add the ability to add javascript callbacks */
|
57 |
+
<?php do_action( 'disqus_config' ); ?>
|
58 |
+
|
59 |
/*
|
60 |
All currently supported events:
|
61 |
* preData — fires just before we request for initial data
|
99 |
'trackbacks': [
|
100 |
<?php
|
101 |
$count = 0;
|
102 |
+
foreach ((array)$comments as $comment) {
|
103 |
$comment_type = get_comment_type();
|
104 |
if ( $comment_type != 'comment' ) {
|
105 |
if( $count ) { echo ','; }
|
127 |
(function() {
|
128 |
var dsq = document.createElement('script'); dsq.type = 'text/javascript';
|
129 |
dsq.async = true;
|
130 |
+
dsq.src = '//' + disqus_shortname + '.' + '<?php echo DISQUS_DOMAIN; ?>' + '/' + 'embed' + '.js' + '?pname=wordpress&pver=<?php echo DISQUS_VERSION; ?>';
|
131 |
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
132 |
})();
|
133 |
/* ]]> */
|
disqus.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Disqus Comment System
|
|
4 |
Plugin URI: http://disqus.com/
|
5 |
Description: The Disqus comment system replaces your WordPress comment system with your comments hosted and powered by Disqus. Head over to the Comments admin page to set up your DISQUS Comment System.
|
6 |
Author: Disqus <team@disqus.com>
|
7 |
-
Version: 2.
|
8 |
Author URI: http://disqus.com/
|
9 |
*/
|
10 |
|
@@ -21,7 +21,7 @@ if (defined('DISQUS_LOCAL')) { // DISQUS defines this for local development purp
|
|
21 |
define('DISQUS_IMPORTER_URL', 'http://dev.disqus.org:8001/');
|
22 |
} else {
|
23 |
define('DISQUS_DOMAIN', 'disqus.com');
|
24 |
-
define('DISQUS_IMPORTER_URL', '
|
25 |
}
|
26 |
define('DISQUS_URL', 'http://' . DISQUS_DOMAIN . '/');
|
27 |
define('DISQUS_MEDIA_URL', 'http://' . DISQUS_DOMAIN . '/media/');
|
@@ -31,7 +31,7 @@ define('DISQUS_CAN_EXPORT', is_file(dirname(__FILE__) . '/export.php'));
|
|
31 |
if (!defined('DISQUS_DEBUG')) {
|
32 |
define('DISQUS_DEBUG', false);
|
33 |
}
|
34 |
-
define('DISQUS_VERSION', '2.
|
35 |
define('DISQUS_SYNC_TIMEOUT', 30);
|
36 |
|
37 |
/**
|
@@ -85,15 +85,10 @@ function dsq_plugin_basename($file) {
|
|
85 |
return !empty($pieces[count($pieces)-1]) ? $pieces[count($pieces)-1] : $pieces[count($pieces)-2];
|
86 |
}
|
87 |
|
88 |
-
if ( !defined('WP_CONTENT_URL') ) {
|
89 |
-
define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
|
90 |
-
}
|
91 |
if ( !defined('PLUGINDIR') ) {
|
92 |
define('PLUGINDIR', 'wp-content/plugins'); // Relative to ABSPATH. For back compat.
|
93 |
}
|
94 |
|
95 |
-
define('DSQ_PLUGIN_URL', WP_CONTENT_URL . '/plugins/' . dsq_plugin_basename(__FILE__));
|
96 |
-
|
97 |
$mt_disqus_version = '2.01';
|
98 |
/**
|
99 |
* Response from Disqus get_thread API call for comments template.
|
@@ -149,6 +144,7 @@ function dsq_can_replace() {
|
|
149 |
$replace = get_option('disqus_replace');
|
150 |
|
151 |
if ( is_feed() ) { return false; }
|
|
|
152 |
if ( 'draft' == $post->post_status ) { return false; }
|
153 |
if ( !get_option('disqus_forum_url') ) { return false; }
|
154 |
else if ( 'all' == $replace ) { return true; }
|
@@ -282,7 +278,7 @@ function dsq_sync_comments($comments) {
|
|
282 |
|
283 |
// and follow up using legacy Disqus agent
|
284 |
if (!$commentdata) {
|
285 |
-
$commentdata = $wpdb->get_row($wpdb->prepare( "SELECT comment_ID, comment_parent FROM $wpdb->comments WHERE comment_agent = 'Disqus/1.0:
|
286 |
}
|
287 |
if (!$commentdata) {
|
288 |
// Comment doesnt exist yet, lets insert it
|
@@ -861,7 +857,7 @@ function dsq_comments_text($comment_text) {
|
|
861 |
|
862 |
function dsq_bloginfo_url($url) {
|
863 |
if ( get_feed_link('comments_rss2') == $url && dsq_can_replace() ) {
|
864 |
-
return '
|
865 |
} else {
|
866 |
return $url;
|
867 |
}
|
@@ -967,7 +963,7 @@ function dsq_manage() {
|
|
967 |
dsq_install();
|
968 |
}
|
969 |
|
970 |
-
if (dsq_does_need_update() && isset($_POST['reset'])) {
|
971 |
include_once(dirname(__FILE__) . '/upgrade.php');
|
972 |
} else {
|
973 |
include_once(dirname(__FILE__) . '/manage.php');
|
@@ -977,7 +973,7 @@ function dsq_manage() {
|
|
977 |
function dsq_admin_head() {
|
978 |
if (isset($_GET['page']) && $_GET['page'] == 'disqus') {
|
979 |
?>
|
980 |
-
<link rel='stylesheet' href='<?php echo
|
981 |
<style type="text/css">
|
982 |
.dsq-importing, .dsq-imported, .dsq-import-fail, .dsq-exporting, .dsq-exported, .dsq-export-fail {
|
983 |
background: url(<?php echo admin_url('images/loading.gif'); ?>) left center no-repeat;
|
@@ -1100,7 +1096,7 @@ dsq_import_comments = function(wipe) {
|
|
1100 |
// HACK: Our own styles for older versions of WordPress.
|
1101 |
global $wp_version;
|
1102 |
if ( version_compare($wp_version, '2.5', '<') ) {
|
1103 |
-
echo "<link rel='stylesheet' href='" .
|
1104 |
}
|
1105 |
}
|
1106 |
}
|
@@ -1193,7 +1189,7 @@ function dsq_output_loop_comment_js($post_ids = null) {
|
|
1193 |
}
|
1194 |
var s = document.createElement('script'); s.async = true;
|
1195 |
s.type = 'text/javascript';
|
1196 |
-
s.src = '//' + '
|
1197 |
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
1198 |
}());
|
1199 |
//]]>
|
@@ -1222,7 +1218,7 @@ function dsq_output_footer_comment_js() {
|
|
1222 |
}
|
1223 |
var s = document.createElement('script'); s.async = true;
|
1224 |
s.type = 'text/javascript';
|
1225 |
-
s.src = '//' + '
|
1226 |
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
1227 |
}());
|
1228 |
//]]>
|
@@ -1236,8 +1232,8 @@ add_action('wp_footer', 'dsq_output_footer_comment_js');
|
|
1236 |
$dsq_prev_permalinks = array();
|
1237 |
|
1238 |
function dsq_prev_permalink($post_id) {
|
1239 |
-
|
1240 |
-
|
1241 |
if ($post->post_status != 'publish') {
|
1242 |
return;
|
1243 |
}
|
@@ -1404,7 +1400,7 @@ function dsq_sso_login() {
|
|
1404 |
$button = get_option('disqus_sso_button');
|
1405 |
$icon = get_option('disqus_sso_icon');
|
1406 |
$sso_login_str = 'this.sso = {
|
1407 |
-
name: "'
|
1408 |
button: "'.$button.'",
|
1409 |
icon: "'.$icon.'",
|
1410 |
url: "'.$siteurl.'/wp-login.php",
|
@@ -1482,9 +1478,9 @@ function dsq_install($allow_database_install=true) {
|
|
1482 |
|
1483 |
// if this is a new install, we should not set disqus active
|
1484 |
if ($version == '0') {
|
1485 |
-
add_option('disqus_active', 0);
|
1486 |
} else {
|
1487 |
-
add_option('disqus_active', 1);
|
1488 |
}
|
1489 |
|
1490 |
update_option('disqus_version', DISQUS_VERSION);
|
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.77
|
8 |
Author URI: http://disqus.com/
|
9 |
*/
|
10 |
|
21 |
define('DISQUS_IMPORTER_URL', 'http://dev.disqus.org:8001/');
|
22 |
} else {
|
23 |
define('DISQUS_DOMAIN', 'disqus.com');
|
24 |
+
define('DISQUS_IMPORTER_URL', 'https://import.disqus.com/');
|
25 |
}
|
26 |
define('DISQUS_URL', 'http://' . DISQUS_DOMAIN . '/');
|
27 |
define('DISQUS_MEDIA_URL', 'http://' . DISQUS_DOMAIN . '/media/');
|
31 |
if (!defined('DISQUS_DEBUG')) {
|
32 |
define('DISQUS_DEBUG', false);
|
33 |
}
|
34 |
+
define('DISQUS_VERSION', '2.77');
|
35 |
define('DISQUS_SYNC_TIMEOUT', 30);
|
36 |
|
37 |
/**
|
85 |
return !empty($pieces[count($pieces)-1]) ? $pieces[count($pieces)-1] : $pieces[count($pieces)-2];
|
86 |
}
|
87 |
|
|
|
|
|
|
|
88 |
if ( !defined('PLUGINDIR') ) {
|
89 |
define('PLUGINDIR', 'wp-content/plugins'); // Relative to ABSPATH. For back compat.
|
90 |
}
|
91 |
|
|
|
|
|
92 |
$mt_disqus_version = '2.01';
|
93 |
/**
|
94 |
* Response from Disqus get_thread API call for comments template.
|
144 |
$replace = get_option('disqus_replace');
|
145 |
|
146 |
if ( is_feed() ) { return false; }
|
147 |
+
if ( !isset($post) ) { return false; }
|
148 |
if ( 'draft' == $post->post_status ) { return false; }
|
149 |
if ( !get_option('disqus_forum_url') ) { return false; }
|
150 |
else if ( 'all' == $replace ) { return true; }
|
278 |
|
279 |
// and follow up using legacy Disqus agent
|
280 |
if (!$commentdata) {
|
281 |
+
$commentdata = $wpdb->get_row($wpdb->prepare( "SELECT comment_ID, comment_parent FROM $wpdb->comments WHERE comment_agent = %s LIMIT 1", 'Disqus/1.0:'.$comment->id), ARRAY_A);
|
282 |
}
|
283 |
if (!$commentdata) {
|
284 |
// Comment doesnt exist yet, lets insert it
|
857 |
|
858 |
function dsq_bloginfo_url($url) {
|
859 |
if ( get_feed_link('comments_rss2') == $url && dsq_can_replace() ) {
|
860 |
+
return 'https://' . strtolower(get_option('disqus_forum_url')) . '.' . DISQUS_DOMAIN . DISQUS_RSS_PATH;
|
861 |
} else {
|
862 |
return $url;
|
863 |
}
|
963 |
dsq_install();
|
964 |
}
|
965 |
|
966 |
+
if (dsq_does_need_update() && !isset($_POST['reset'])) {
|
967 |
include_once(dirname(__FILE__) . '/upgrade.php');
|
968 |
} else {
|
969 |
include_once(dirname(__FILE__) . '/manage.php');
|
973 |
function dsq_admin_head() {
|
974 |
if (isset($_GET['page']) && $_GET['page'] == 'disqus') {
|
975 |
?>
|
976 |
+
<link rel='stylesheet' href='<?php echo plugins_url( 'media/styles/manage.css', __FILE__ ); ?>' type='text/css' />
|
977 |
<style type="text/css">
|
978 |
.dsq-importing, .dsq-imported, .dsq-import-fail, .dsq-exporting, .dsq-exported, .dsq-export-fail {
|
979 |
background: url(<?php echo admin_url('images/loading.gif'); ?>) left center no-repeat;
|
1096 |
// HACK: Our own styles for older versions of WordPress.
|
1097 |
global $wp_version;
|
1098 |
if ( version_compare($wp_version, '2.5', '<') ) {
|
1099 |
+
echo "<link rel='stylesheet' href='" . plugins_url( 'media/styles/manage-pre25.css', __FILE__ ) . "' type='text/css' />";
|
1100 |
}
|
1101 |
}
|
1102 |
}
|
1189 |
}
|
1190 |
var s = document.createElement('script'); s.async = true;
|
1191 |
s.type = 'text/javascript';
|
1192 |
+
s.src = '//' + disqus_shortname + '.<?php echo DISQUS_DOMAIN; ?>/count.js';
|
1193 |
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
1194 |
}());
|
1195 |
//]]>
|
1218 |
}
|
1219 |
var s = document.createElement('script'); s.async = true;
|
1220 |
s.type = 'text/javascript';
|
1221 |
+
s.src = '//' + disqus_shortname + '.<?php echo DISQUS_DOMAIN; ?>/count.js';
|
1222 |
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
1223 |
}());
|
1224 |
//]]>
|
1232 |
$dsq_prev_permalinks = array();
|
1233 |
|
1234 |
function dsq_prev_permalink($post_id) {
|
1235 |
+
$post = get_post($post_id);
|
1236 |
+
// if post not published, return
|
1237 |
if ($post->post_status != 'publish') {
|
1238 |
return;
|
1239 |
}
|
1400 |
$button = get_option('disqus_sso_button');
|
1401 |
$icon = get_option('disqus_sso_icon');
|
1402 |
$sso_login_str = 'this.sso = {
|
1403 |
+
name: "'.wp_specialchars_decode($sitename, ENT_QUOTES).'",
|
1404 |
button: "'.$button.'",
|
1405 |
icon: "'.$icon.'",
|
1406 |
url: "'.$siteurl.'/wp-login.php",
|
1478 |
|
1479 |
// if this is a new install, we should not set disqus active
|
1480 |
if ($version == '0') {
|
1481 |
+
add_option('disqus_active', '0');
|
1482 |
} else {
|
1483 |
+
add_option('disqus_active', '1');
|
1484 |
}
|
1485 |
|
1486 |
update_option('disqus_version', DISQUS_VERSION);
|
lib/api/disqus/disqus.php
CHANGED
@@ -59,7 +59,7 @@ if (!extension_loaded('json')) {
|
|
59 |
class DisqusAPI {
|
60 |
var $user_api_key;
|
61 |
var $forum_api_key;
|
62 |
-
var $api_url = '
|
63 |
var $api_version = '1.1';
|
64 |
|
65 |
/**
|
@@ -72,7 +72,7 @@ class DisqusAPI {
|
|
72 |
* @param $api_url
|
73 |
* (optional) The prefix URL to use when calling the Disqus API.
|
74 |
*/
|
75 |
-
function DisqusAPI($user_api_key, $forum_api_key, $api_url='
|
76 |
$this->user_api_key = $user_api_key;
|
77 |
$this->forum_api_key = $forum_api_key;
|
78 |
$this->api_url = $api_url;
|
59 |
class DisqusAPI {
|
60 |
var $user_api_key;
|
61 |
var $forum_api_key;
|
62 |
+
var $api_url = 'https://www.disqus.com/api/';
|
63 |
var $api_version = '1.1';
|
64 |
|
65 |
/**
|
72 |
* @param $api_url
|
73 |
* (optional) The prefix URL to use when calling the Disqus API.
|
74 |
*/
|
75 |
+
function DisqusAPI($user_api_key, $forum_api_key, $api_url='https://www.disqus.com/api/') {
|
76 |
$this->user_api_key = $user_api_key;
|
77 |
$this->forum_api_key = $forum_api_key;
|
78 |
$this->api_url = $api_url;
|
lib/api/disqus/json.php
CHANGED
@@ -255,7 +255,7 @@ class JSON
|
|
255 |
$buf .= $e[$i];
|
256 |
}
|
257 |
$i++;
|
258 |
-
return
|
259 |
break;
|
260 |
case ":":
|
261 |
$state = IN_ASSIGN;
|
255 |
$buf .= $e[$i];
|
256 |
}
|
257 |
$i++;
|
258 |
+
return $buf;
|
259 |
break;
|
260 |
case ":":
|
261 |
$state = IN_ASSIGN;
|
lib/wp-api.php
CHANGED
@@ -79,6 +79,7 @@ class DisqusWordPressAPI {
|
|
79 |
DISQUS_IMPORTER_URL . 'api/import-wordpress-comments/',
|
80 |
array(
|
81 |
'method' => 'POST',
|
|
|
82 |
'body' => array(
|
83 |
'forum_url' => $this->short_name,
|
84 |
'forum_api_key' => $this->forum_api_key,
|
@@ -86,7 +87,7 @@ class DisqusWordPressAPI {
|
|
86 |
'wxr' => $wxr,
|
87 |
'timestamp' => $timestamp,
|
88 |
'eof' => (int)$eof
|
89 |
-
)
|
90 |
)
|
91 |
);
|
92 |
if ($response->errors) {
|
79 |
DISQUS_IMPORTER_URL . 'api/import-wordpress-comments/',
|
80 |
array(
|
81 |
'method' => 'POST',
|
82 |
+
'timeout' => 60,
|
83 |
'body' => array(
|
84 |
'forum_url' => $this->short_name,
|
85 |
'forum_api_key' => $this->forum_api_key,
|
87 |
'wxr' => $wxr,
|
88 |
'timestamp' => $timestamp,
|
89 |
'eof' => (int)$eof
|
90 |
+
),
|
91 |
)
|
92 |
);
|
93 |
if ($response->errors) {
|
locales/default.mo
CHANGED
Binary file
|
locales/default.po
CHANGED
@@ -2,16 +2,18 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: disqus-wordpress\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date:
|
6 |
-
"PO-Revision-Date:
|
7 |
-
"Last-Translator:
|
8 |
"Language-Team: DISQUS <translation@disqus.com>\n"
|
|
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"X-Poedit-KeywordsList: _;gettext;gettext_noop;dsq_i;__;_e\n"
|
13 |
"X-Poedit-Basepath: ../\n"
|
14 |
-
"X-Generator: Poedit 1.5
|
|
|
15 |
"X-Poedit-SearchPath-0: ..\n"
|
16 |
|
17 |
#: ../disqus/comments.php:18 ../disqus/comments.php:34
|
@@ -22,17 +24,17 @@ msgstr ""
|
|
22 |
msgid "Newer Comments <span class=\"meta-nav\">→</span>"
|
23 |
msgstr ""
|
24 |
|
25 |
-
#: ../disqus/disqus.php:
|
26 |
msgid ""
|
27 |
"Your comments have been sent to Disqus and queued for import!<br/><a href=\""
|
28 |
msgstr ""
|
29 |
|
30 |
-
#: ../disqus/disqus.php:
|
31 |
#, php-format
|
32 |
msgid "Processed comments on post #%s…"
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: ../disqus/disqus.php:
|
36 |
#, php-format
|
37 |
msgid ""
|
38 |
"Sorry, something unexpected happened with the export. Please <a href=\"#\" "
|
@@ -42,239 +44,252 @@ msgid ""
|
|
42 |
"open(this.href); return false\">WordPress help page</a>."
|
43 |
msgstr ""
|
44 |
|
45 |
-
#: ../disqus/disqus.php:
|
46 |
#, php-format
|
47 |
msgid ""
|
48 |
"Your comments have been sent to Disqus and queued for import!<br/><a href="
|
49 |
"\"%s\" target=\"_blank\">See the status of your import at Disqus</a>"
|
50 |
msgstr ""
|
51 |
|
52 |
-
#: ../disqus/disqus.php:
|
53 |
msgid "There was an error downloading your comments from Disqus."
|
54 |
msgstr ""
|
55 |
|
56 |
-
#: ../disqus/disqus.php:
|
57 |
msgid ""
|
58 |
"Your comments have been downloaded from Disqus and saved in your local "
|
59 |
"database."
|
60 |
msgstr ""
|
61 |
|
62 |
-
#: ../disqus/disqus.php:
|
63 |
#, php-format
|
64 |
msgid "Import in progress (last post id: %s) …"
|
65 |
msgstr ""
|
66 |
|
67 |
-
#: ../disqus/disqus.php:
|
68 |
msgid "Pingback:"
|
69 |
msgstr ""
|
70 |
|
71 |
-
#: ../disqus/disqus.php:
|
72 |
msgid "(Edit)"
|
73 |
msgstr ""
|
74 |
|
75 |
-
#: ../disqus/disqus.php:
|
76 |
msgid "Configure"
|
77 |
msgstr ""
|
78 |
|
79 |
-
#: ../disqus/disqus.php:
|
80 |
msgid "Settings"
|
81 |
msgstr ""
|
82 |
|
83 |
-
#: ../disqus/disqus.php:
|
84 |
msgid ""
|
85 |
"Sorry, the built-in commenting system is disabled because Disqus is active."
|
86 |
msgstr ""
|
87 |
|
88 |
-
#: ../disqus/manage.php:
|
89 |
msgid "Disqus Reset"
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: ../disqus/manage.php:
|
93 |
msgid "Disqus has been reset successfully."
|
94 |
msgstr ""
|
95 |
|
96 |
-
#: ../disqus/manage.php:
|
97 |
msgid "Local settings for the plugin were removed."
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: ../disqus/manage.php:
|
101 |
msgid "Database changes by Disqus were reverted."
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: ../disqus/manage.php:
|
105 |
msgid ""
|
106 |
"If you wish to <a href=\"?page=disqus&step=1\">reinstall</a>, you can do "
|
107 |
"that now."
|
108 |
msgstr ""
|
109 |
|
110 |
-
#: ../disqus/manage.php:
|
111 |
msgid "Your settings have been changed."
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: ../disqus/manage.php:
|
115 |
msgid ""
|
116 |
"There was an error completing the installation of Disqus. If you are still "
|
117 |
-
"having issues, refer to the <a href=\"
|
118 |
-
"\">WordPress help page</a>."
|
119 |
msgstr ""
|
120 |
|
121 |
-
#: ../disqus/manage.php:
|
122 |
#, php-format
|
123 |
msgid ""
|
124 |
"There aren't any sites associated with this account. Maybe you want to <a "
|
125 |
"href=\"%s\">create a site</a>?"
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: ../disqus/manage.php:
|
129 |
msgid "Moderate"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: ../disqus/manage.php:
|
133 |
msgid "Install"
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: ../disqus/manage.php:
|
137 |
msgid "Plugin Settings"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: ../disqus/manage.php:
|
141 |
msgid "Install Disqus Comments"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: ../disqus/manage.php:
|
145 |
msgid "Disqus has been installed on your blog."
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: ../disqus/manage.php:
|
149 |
msgid ""
|
150 |
"If you have existing comments, you may wish to <a href=\"?page=disqus&"
|
151 |
"t=adv#export\">export them</a> now. Otherwise, you're all set, and the "
|
152 |
"Disqus network is now powering comments on your blog."
|
153 |
msgstr ""
|
154 |
|
155 |
-
#: ../disqus/manage.php:
|
156 |
msgid "Continue to the moderation dashboard"
|
157 |
msgstr ""
|
158 |
|
159 |
-
#: ../disqus/manage.php:
|
160 |
msgid "Select a website"
|
161 |
msgstr ""
|
162 |
|
163 |
-
#: ../disqus/manage.php:
|
164 |
msgid "Or register a new one on the Disqus website."
|
165 |
msgstr ""
|
166 |
|
167 |
-
#: ../disqus/manage.php:
|
168 |
-
msgid "Username"
|
169 |
msgstr ""
|
170 |
|
171 |
-
#: ../disqus/manage.php:
|
172 |
msgid "(don't have a Disqus Profile yet?)"
|
173 |
msgstr ""
|
174 |
|
175 |
-
#: ../disqus/manage.php:
|
176 |
msgid "Password"
|
177 |
msgstr ""
|
178 |
|
179 |
-
#: ../disqus/manage.php:
|
180 |
msgid "(forgot your password?)"
|
181 |
msgstr ""
|
182 |
|
183 |
-
#: ../disqus/manage.php:
|
184 |
#, php-format
|
185 |
msgid "Version: %s"
|
186 |
msgstr ""
|
187 |
|
188 |
-
#: ../disqus/manage.php:
|
189 |
msgid ""
|
190 |
-
"<p class=\"status\">Disqus comments are currently
|
191 |
-
"page=disqus&active=1\">Enable</a>)</
|
|
|
192 |
msgstr ""
|
193 |
|
194 |
-
#: ../disqus/manage.php:
|
195 |
msgid ""
|
196 |
-
"<p class=\"status\">Disqus comments are currently
|
197 |
-
"page=disqus&active=0\">Disable</a>)</
|
|
|
198 |
msgstr ""
|
199 |
|
200 |
-
#: ../disqus/manage.php:
|
201 |
msgid "<h3>General</h3>"
|
202 |
msgstr ""
|
203 |
|
204 |
-
#: ../disqus/manage.php:
|
205 |
msgid "Forum Shortname"
|
206 |
msgstr ""
|
207 |
|
208 |
-
#: ../disqus/manage.php:
|
209 |
msgid ""
|
210 |
"This is the unique identifier for your website in Disqus, automatically set "
|
211 |
"during installation."
|
212 |
msgstr ""
|
213 |
|
214 |
-
#: ../disqus/manage.php:
|
215 |
msgid "<h3>Appearance</h3>"
|
216 |
msgstr ""
|
217 |
|
218 |
-
#: ../disqus/manage.php:
|
219 |
msgid "Use Disqus Comments on"
|
220 |
msgstr ""
|
221 |
|
222 |
-
#: ../disqus/manage.php:
|
223 |
-
msgid "
|
224 |
msgstr ""
|
225 |
|
226 |
-
#: ../disqus/manage.php:
|
227 |
-
msgid "
|
228 |
msgstr ""
|
229 |
|
230 |
-
#: ../disqus/manage.php:
|
231 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
msgstr ""
|
233 |
|
234 |
-
#: ../disqus/manage.php:
|
235 |
msgid "<h3>Sync</h3>"
|
236 |
msgstr ""
|
237 |
|
238 |
-
#: ../disqus/manage.php:
|
239 |
-
msgid "Comment
|
240 |
msgstr ""
|
241 |
|
242 |
-
#: ../disqus/manage.php:
|
243 |
msgid "Disable automated comment importing"
|
244 |
msgstr ""
|
245 |
|
246 |
-
#: ../disqus/manage.php:
|
247 |
msgid ""
|
248 |
"If you have problems with WP-Cron taking too long, or have a large number of "
|
249 |
-
"comments, you may wish to disable automated sync.
|
250 |
-
"
|
251 |
msgstr ""
|
252 |
|
253 |
-
#: ../disqus/manage.php:
|
254 |
msgid "Server-Side Rendering"
|
255 |
msgstr ""
|
256 |
|
257 |
-
#: ../disqus/manage.php:
|
258 |
msgid "Disable server-side rendering of comments"
|
259 |
msgstr ""
|
260 |
|
261 |
-
#: ../disqus/manage.php:
|
262 |
msgid "Hides comments from nearly all search engines."
|
263 |
msgstr ""
|
264 |
|
265 |
-
#: ../disqus/manage.php:
|
266 |
msgid "<h3>Patches</h3>"
|
267 |
msgstr ""
|
268 |
|
269 |
-
#: ../disqus/manage.php:
|
270 |
msgid "Template Conflicts"
|
271 |
msgstr ""
|
272 |
|
273 |
-
#: ../disqus/manage.php:
|
274 |
msgid "Output JavaScript in footer"
|
275 |
msgstr ""
|
276 |
|
277 |
-
#: ../disqus/manage.php:
|
278 |
#, php-format
|
279 |
msgid ""
|
280 |
"Enable this if you have problems with comment counts or other "
|
@@ -284,7 +299,7 @@ msgid ""
|
|
284 |
"\">more info</a>)."
|
285 |
msgstr ""
|
286 |
|
287 |
-
#: ../disqus/manage.php:
|
288 |
#, php-format
|
289 |
msgid ""
|
290 |
"<h3>Advanced</h3><h4>Single Sign-On</h4><p>Allows users to log in to Disqus "
|
@@ -292,126 +307,107 @@ msgid ""
|
|
292 |
"\">More info on SSO</a>)</p>"
|
293 |
msgstr ""
|
294 |
|
295 |
-
#: ../disqus/manage.php:
|
296 |
msgid "Disqus Partner Key"
|
297 |
msgstr ""
|
298 |
|
299 |
-
#: ../disqus/manage.php:
|
300 |
msgid "API Application Public Key"
|
301 |
msgstr ""
|
302 |
|
303 |
-
#: ../disqus/manage.php:
|
304 |
#, php-format
|
305 |
msgid "Found at <a href=\"%s\">Disqus API Applications</a>."
|
306 |
msgstr ""
|
307 |
|
308 |
-
#: ../disqus/manage.php:
|
309 |
msgid "API Application Secret Key"
|
310 |
msgstr ""
|
311 |
|
312 |
-
#: ../disqus/manage.php:
|
313 |
msgid "Custom Log-in Button"
|
314 |
msgstr ""
|
315 |
|
316 |
-
#: ../disqus/manage.php:
|
317 |
msgid "Change"
|
318 |
msgstr ""
|
319 |
|
320 |
-
#: ../disqus/manage.php:
|
321 |
msgid "Choose"
|
322 |
msgstr ""
|
323 |
|
324 |
-
#: ../disqus/manage.php:
|
325 |
msgid "button"
|
326 |
msgstr ""
|
327 |
|
328 |
-
#: ../disqus/manage.php:
|
329 |
#, php-format
|
330 |
msgid ""
|
331 |
"Adds a button to the Disqus log-in interface. (<a href=\"%s\">Example "
|
332 |
"screenshot</a>.)"
|
333 |
msgstr ""
|
334 |
|
335 |
-
#: ../disqus/manage.php:
|
336 |
#, php-format
|
337 |
msgid ""
|
338 |
"<br />See <a href=\"%s\">our SSO button documentation</a> for a template to "
|
339 |
"create your own button."
|
340 |
msgstr ""
|
341 |
|
342 |
-
#: ../disqus/manage.php:
|
343 |
-
msgid "Custom Log-in Icon<br>"
|
344 |
-
msgstr ""
|
345 |
-
|
346 |
-
#: ../disqus/manage.php:471
|
347 |
-
msgid "icon"
|
348 |
-
msgstr ""
|
349 |
-
|
350 |
-
#: ../disqus/manage.php:477
|
351 |
-
#, php-format
|
352 |
-
msgid ""
|
353 |
-
"Adds an icon to the Disqus Classic log-in modal. This does not apply for "
|
354 |
-
"sites using Disqus 2012. (<a href=\"%s\">Example screenshot</a>.)"
|
355 |
-
msgstr ""
|
356 |
-
|
357 |
-
#: ../disqus/manage.php:478
|
358 |
-
msgid "<br />Dimensions: 16x16."
|
359 |
-
msgstr ""
|
360 |
-
|
361 |
-
#: ../disqus/manage.php:496
|
362 |
msgid "Export comments to Disqus"
|
363 |
msgstr ""
|
364 |
|
365 |
-
#: ../disqus/manage.php:
|
366 |
msgid "Export Comments"
|
367 |
msgstr ""
|
368 |
|
369 |
-
#: ../disqus/manage.php:
|
370 |
msgid "This will export your existing WordPress comments to Disqus"
|
371 |
msgstr ""
|
372 |
|
373 |
-
#: ../disqus/manage.php:
|
374 |
msgid "Sync Disqus with WordPress"
|
375 |
msgstr ""
|
376 |
|
377 |
-
#: ../disqus/manage.php:
|
378 |
msgid "Sync Comments"
|
379 |
msgstr ""
|
380 |
|
381 |
-
#: ../disqus/manage.php:
|
382 |
msgid ""
|
383 |
"This will download your Disqus comments and store them locally in WordPress"
|
384 |
msgstr ""
|
385 |
|
386 |
-
#: ../disqus/manage.php:
|
387 |
msgid "Remove all imported Disqus comments before syncing."
|
388 |
msgstr ""
|
389 |
|
390 |
-
#: ../disqus/manage.php:
|
391 |
msgid "Reset Disqus"
|
392 |
msgstr ""
|
393 |
|
394 |
-
#: ../disqus/manage.php:
|
395 |
msgid "Are you sure you want to reset the Disqus plugin?"
|
396 |
msgstr ""
|
397 |
|
398 |
-
#: ../disqus/manage.php:
|
399 |
msgid ""
|
400 |
"This removes all Disqus-specific settings. Comments will remain unaffected."
|
401 |
msgstr ""
|
402 |
|
403 |
-
#: ../disqus/manage.php:
|
404 |
msgid ""
|
405 |
"If you have problems with resetting taking too long you may wish to first "
|
406 |
"manually drop the <code>disqus_dupecheck</code> index from your "
|
407 |
"<code>commentmeta</code> table."
|
408 |
msgstr ""
|
409 |
|
410 |
-
#: ../disqus/manage.php:
|
411 |
msgid "Debug Information"
|
412 |
msgstr ""
|
413 |
|
414 |
-
#: ../disqus/manage.php:
|
415 |
#, php-format
|
416 |
msgid ""
|
417 |
"Having problems with the plugin? Check out our <a href=\"%s\" onclick="
|
@@ -424,6 +420,6 @@ msgstr ""
|
|
424 |
msgid "Upgrade Disqus Comments"
|
425 |
msgstr ""
|
426 |
|
427 |
-
#: ../disqus/upgrade.php:
|
428 |
msgid "You need to upgrade your database to continue."
|
429 |
msgstr ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: disqus-wordpress\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2014-06-23 16:22-0800\n"
|
6 |
+
"PO-Revision-Date: 2014-06-23 16:23-0800\n"
|
7 |
+
"Last-Translator: Ryan Valentin <ryan@disqus.com>\n"
|
8 |
"Language-Team: DISQUS <translation@disqus.com>\n"
|
9 |
+
"Language: en_US\n"
|
10 |
"MIME-Version: 1.0\n"
|
11 |
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
"Content-Transfer-Encoding: 8bit\n"
|
13 |
"X-Poedit-KeywordsList: _;gettext;gettext_noop;dsq_i;__;_e\n"
|
14 |
"X-Poedit-Basepath: ../\n"
|
15 |
+
"X-Generator: Poedit 1.6.5\n"
|
16 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
17 |
"X-Poedit-SearchPath-0: ..\n"
|
18 |
|
19 |
#: ../disqus/comments.php:18 ../disqus/comments.php:34
|
24 |
msgid "Newer Comments <span class=\"meta-nav\">→</span>"
|
25 |
msgstr ""
|
26 |
|
27 |
+
#: ../disqus/disqus.php:442
|
28 |
msgid ""
|
29 |
"Your comments have been sent to Disqus and queued for import!<br/><a href=\""
|
30 |
msgstr ""
|
31 |
|
32 |
+
#: ../disqus/disqus.php:446
|
33 |
#, php-format
|
34 |
msgid "Processed comments on post #%s…"
|
35 |
msgstr ""
|
36 |
|
37 |
+
#: ../disqus/disqus.php:456
|
38 |
#, php-format
|
39 |
msgid ""
|
40 |
"Sorry, something unexpected happened with the export. Please <a href=\"#\" "
|
44 |
"open(this.href); return false\">WordPress help page</a>."
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: ../disqus/disqus.php:461
|
48 |
#, php-format
|
49 |
msgid ""
|
50 |
"Your comments have been sent to Disqus and queued for import!<br/><a href="
|
51 |
"\"%s\" target=\"_blank\">See the status of your import at Disqus</a>"
|
52 |
msgstr ""
|
53 |
|
54 |
+
#: ../disqus/disqus.php:491
|
55 |
msgid "There was an error downloading your comments from Disqus."
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: ../disqus/disqus.php:496
|
59 |
msgid ""
|
60 |
"Your comments have been downloaded from Disqus and saved in your local "
|
61 |
"database."
|
62 |
msgstr ""
|
63 |
|
64 |
+
#: ../disqus/disqus.php:499
|
65 |
#, php-format
|
66 |
msgid "Import in progress (last post id: %s) …"
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: ../disqus/disqus.php:833
|
70 |
msgid "Pingback:"
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: ../disqus/disqus.php:833
|
74 |
msgid "(Edit)"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: ../disqus/disqus.php:870
|
78 |
msgid "Configure"
|
79 |
msgstr ""
|
80 |
|
81 |
+
#: ../disqus/disqus.php:872 ../disqus/manage.php:360
|
82 |
msgid "Settings"
|
83 |
msgstr ""
|
84 |
|
85 |
+
#: ../disqus/disqus.php:1577
|
86 |
msgid ""
|
87 |
"Sorry, the built-in commenting system is disabled because Disqus is active."
|
88 |
msgstr ""
|
89 |
|
90 |
+
#: ../disqus/manage.php:61
|
91 |
msgid "Disqus Reset"
|
92 |
msgstr ""
|
93 |
|
94 |
+
#: ../disqus/manage.php:64
|
95 |
msgid "Disqus has been reset successfully."
|
96 |
msgstr ""
|
97 |
|
98 |
+
#: ../disqus/manage.php:66
|
99 |
msgid "Local settings for the plugin were removed."
|
100 |
msgstr ""
|
101 |
|
102 |
+
#: ../disqus/manage.php:67
|
103 |
msgid "Database changes by Disqus were reverted."
|
104 |
msgstr ""
|
105 |
|
106 |
+
#: ../disqus/manage.php:69
|
107 |
msgid ""
|
108 |
"If you wish to <a href=\"?page=disqus&step=1\">reinstall</a>, you can do "
|
109 |
"that now."
|
110 |
msgstr ""
|
111 |
|
112 |
+
#: ../disqus/manage.php:182
|
113 |
msgid "Your settings have been changed."
|
114 |
msgstr ""
|
115 |
|
116 |
+
#: ../disqus/manage.php:206
|
117 |
msgid ""
|
118 |
"There was an error completing the installation of Disqus. If you are still "
|
119 |
+
"having issues, refer to the <a href=\"https://help.disqus.com/customer/"
|
120 |
+
"portal/articles/472005-wordpress-troubleshooting\">WordPress help page</a>."
|
121 |
msgstr ""
|
122 |
|
123 |
+
#: ../disqus/manage.php:236
|
124 |
#, php-format
|
125 |
msgid ""
|
126 |
"There aren't any sites associated with this account. Maybe you want to <a "
|
127 |
"href=\"%s\">create a site</a>?"
|
128 |
msgstr ""
|
129 |
|
130 |
+
#: ../disqus/manage.php:246
|
131 |
msgid "Moderate"
|
132 |
msgstr ""
|
133 |
|
134 |
+
#: ../disqus/manage.php:246
|
135 |
msgid "Install"
|
136 |
msgstr ""
|
137 |
|
138 |
+
#: ../disqus/manage.php:247
|
139 |
msgid "Plugin Settings"
|
140 |
msgstr ""
|
141 |
|
142 |
+
#: ../disqus/manage.php:256 ../disqus/manage.php:267 ../disqus/manage.php:301
|
143 |
msgid "Install Disqus Comments"
|
144 |
msgstr ""
|
145 |
|
146 |
+
#: ../disqus/manage.php:258
|
147 |
msgid "Disqus has been installed on your blog."
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: ../disqus/manage.php:259
|
151 |
msgid ""
|
152 |
"If you have existing comments, you may wish to <a href=\"?page=disqus&"
|
153 |
"t=adv#export\">export them</a> now. Otherwise, you're all set, and the "
|
154 |
"Disqus network is now powering comments on your blog."
|
155 |
msgstr ""
|
156 |
|
157 |
+
#: ../disqus/manage.php:260
|
158 |
msgid "Continue to the moderation dashboard"
|
159 |
msgstr ""
|
160 |
|
161 |
+
#: ../disqus/manage.php:273
|
162 |
msgid "Select a website"
|
163 |
msgstr ""
|
164 |
|
165 |
+
#: ../disqus/manage.php:285
|
166 |
msgid "Or register a new one on the Disqus website."
|
167 |
msgstr ""
|
168 |
|
169 |
+
#: ../disqus/manage.php:307
|
170 |
+
msgid "Username or email"
|
171 |
msgstr ""
|
172 |
|
173 |
+
#: ../disqus/manage.php:310
|
174 |
msgid "(don't have a Disqus Profile yet?)"
|
175 |
msgstr ""
|
176 |
|
177 |
+
#: ../disqus/manage.php:314
|
178 |
msgid "Password"
|
179 |
msgstr ""
|
180 |
|
181 |
+
#: ../disqus/manage.php:317
|
182 |
msgid "(forgot your password?)"
|
183 |
msgstr ""
|
184 |
|
185 |
+
#: ../disqus/manage.php:361
|
186 |
#, php-format
|
187 |
msgid "Version: %s"
|
188 |
msgstr ""
|
189 |
|
190 |
+
#: ../disqus/manage.php:365
|
191 |
msgid ""
|
192 |
+
"<p class=\"status\">Disqus comments are currently <span class=\"dsq-disabled-"
|
193 |
+
"text\">disabled</span>. (<a href=\"?page=disqus&active=1\">Enable</a>)</"
|
194 |
+
"p>"
|
195 |
msgstr ""
|
196 |
|
197 |
+
#: ../disqus/manage.php:367
|
198 |
msgid ""
|
199 |
+
"<p class=\"status\">Disqus comments are currently <span class=\"dsq-enabled-"
|
200 |
+
"text\">enabled</span>. (<a href=\"?page=disqus&active=0\">Disable</a>)</"
|
201 |
+
"p>"
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: ../disqus/manage.php:375
|
205 |
msgid "<h3>General</h3>"
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: ../disqus/manage.php:378
|
209 |
msgid "Forum Shortname"
|
210 |
msgstr ""
|
211 |
|
212 |
+
#: ../disqus/manage.php:383
|
213 |
msgid ""
|
214 |
"This is the unique identifier for your website in Disqus, automatically set "
|
215 |
"during installation."
|
216 |
msgstr ""
|
217 |
|
218 |
+
#: ../disqus/manage.php:388
|
219 |
msgid "<h3>Appearance</h3>"
|
220 |
msgstr ""
|
221 |
|
222 |
+
#: ../disqus/manage.php:391
|
223 |
msgid "Use Disqus Comments on"
|
224 |
msgstr ""
|
225 |
|
226 |
+
#: ../disqus/manage.php:394
|
227 |
+
msgid "All blog posts."
|
228 |
msgstr ""
|
229 |
|
230 |
+
#: ../disqus/manage.php:395
|
231 |
+
msgid "Blog posts with closed comments only."
|
232 |
msgstr ""
|
233 |
|
234 |
+
#: ../disqus/manage.php:399
|
235 |
+
msgid ""
|
236 |
+
"You have selected to only enable Disqus on posts with closed comments. If "
|
237 |
+
"you aren't seeing Disqus on new posts, change this option to <strong>All "
|
238 |
+
"blog posts</strong>."
|
239 |
+
msgstr ""
|
240 |
+
|
241 |
+
#: ../disqus/manage.php:400
|
242 |
+
msgid ""
|
243 |
+
"Shows comments on either all blog posts, or ones with closed comments. "
|
244 |
+
"Select the <strong>Blog posts with closed comments only</strong> option if "
|
245 |
+
"you plan on disabling Disqus, but want to keep it on posts which already "
|
246 |
+
"have comments."
|
247 |
msgstr ""
|
248 |
|
249 |
+
#: ../disqus/manage.php:406
|
250 |
msgid "<h3>Sync</h3>"
|
251 |
msgstr ""
|
252 |
|
253 |
+
#: ../disqus/manage.php:409
|
254 |
+
msgid "Comment Importing"
|
255 |
msgstr ""
|
256 |
|
257 |
+
#: ../disqus/manage.php:412
|
258 |
msgid "Disable automated comment importing"
|
259 |
msgstr ""
|
260 |
|
261 |
+
#: ../disqus/manage.php:413
|
262 |
msgid ""
|
263 |
"If you have problems with WP-Cron taking too long, or have a large number of "
|
264 |
+
"comments, you may wish to disable automated sync. Comments will only be "
|
265 |
+
"imported to your local Wordpress database if you do so manually."
|
266 |
msgstr ""
|
267 |
|
268 |
+
#: ../disqus/manage.php:417
|
269 |
msgid "Server-Side Rendering"
|
270 |
msgstr ""
|
271 |
|
272 |
+
#: ../disqus/manage.php:420
|
273 |
msgid "Disable server-side rendering of comments"
|
274 |
msgstr ""
|
275 |
|
276 |
+
#: ../disqus/manage.php:421
|
277 |
msgid "Hides comments from nearly all search engines."
|
278 |
msgstr ""
|
279 |
|
280 |
+
#: ../disqus/manage.php:426
|
281 |
msgid "<h3>Patches</h3>"
|
282 |
msgstr ""
|
283 |
|
284 |
+
#: ../disqus/manage.php:430
|
285 |
msgid "Template Conflicts"
|
286 |
msgstr ""
|
287 |
|
288 |
+
#: ../disqus/manage.php:433
|
289 |
msgid "Output JavaScript in footer"
|
290 |
msgstr ""
|
291 |
|
292 |
+
#: ../disqus/manage.php:434
|
293 |
#, php-format
|
294 |
msgid ""
|
295 |
"Enable this if you have problems with comment counts or other "
|
299 |
"\">more info</a>)."
|
300 |
msgstr ""
|
301 |
|
302 |
+
#: ../disqus/manage.php:439
|
303 |
#, php-format
|
304 |
msgid ""
|
305 |
"<h3>Advanced</h3><h4>Single Sign-On</h4><p>Allows users to log in to Disqus "
|
307 |
"\">More info on SSO</a>)</p>"
|
308 |
msgstr ""
|
309 |
|
310 |
+
#: ../disqus/manage.php:443
|
311 |
msgid "Disqus Partner Key"
|
312 |
msgstr ""
|
313 |
|
314 |
+
#: ../disqus/manage.php:450
|
315 |
msgid "API Application Public Key"
|
316 |
msgstr ""
|
317 |
|
318 |
+
#: ../disqus/manage.php:454 ../disqus/manage.php:462
|
319 |
#, php-format
|
320 |
msgid "Found at <a href=\"%s\">Disqus API Applications</a>."
|
321 |
msgstr ""
|
322 |
|
323 |
+
#: ../disqus/manage.php:458
|
324 |
msgid "API Application Secret Key"
|
325 |
msgstr ""
|
326 |
|
327 |
+
#: ../disqus/manage.php:466
|
328 |
msgid "Custom Log-in Button"
|
329 |
msgstr ""
|
330 |
|
331 |
+
#: ../disqus/manage.php:516
|
332 |
msgid "Change"
|
333 |
msgstr ""
|
334 |
|
335 |
+
#: ../disqus/manage.php:516
|
336 |
msgid "Choose"
|
337 |
msgstr ""
|
338 |
|
339 |
+
#: ../disqus/manage.php:516
|
340 |
msgid "button"
|
341 |
msgstr ""
|
342 |
|
343 |
+
#: ../disqus/manage.php:522
|
344 |
#, php-format
|
345 |
msgid ""
|
346 |
"Adds a button to the Disqus log-in interface. (<a href=\"%s\">Example "
|
347 |
"screenshot</a>.)"
|
348 |
msgstr ""
|
349 |
|
350 |
+
#: ../disqus/manage.php:523
|
351 |
#, php-format
|
352 |
msgid ""
|
353 |
"<br />See <a href=\"%s\">our SSO button documentation</a> for a template to "
|
354 |
"create your own button."
|
355 |
msgstr ""
|
356 |
|
357 |
+
#: ../disqus/manage.php:541
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
msgid "Export comments to Disqus"
|
359 |
msgstr ""
|
360 |
|
361 |
+
#: ../disqus/manage.php:544
|
362 |
msgid "Export Comments"
|
363 |
msgstr ""
|
364 |
|
365 |
+
#: ../disqus/manage.php:544
|
366 |
msgid "This will export your existing WordPress comments to Disqus"
|
367 |
msgstr ""
|
368 |
|
369 |
+
#: ../disqus/manage.php:550
|
370 |
msgid "Sync Disqus with WordPress"
|
371 |
msgstr ""
|
372 |
|
373 |
+
#: ../disqus/manage.php:554
|
374 |
msgid "Sync Comments"
|
375 |
msgstr ""
|
376 |
|
377 |
+
#: ../disqus/manage.php:554
|
378 |
msgid ""
|
379 |
"This will download your Disqus comments and store them locally in WordPress"
|
380 |
msgstr ""
|
381 |
|
382 |
+
#: ../disqus/manage.php:555
|
383 |
msgid "Remove all imported Disqus comments before syncing."
|
384 |
msgstr ""
|
385 |
|
386 |
+
#: ../disqus/manage.php:566
|
387 |
msgid "Reset Disqus"
|
388 |
msgstr ""
|
389 |
|
390 |
+
#: ../disqus/manage.php:570
|
391 |
msgid "Are you sure you want to reset the Disqus plugin?"
|
392 |
msgstr ""
|
393 |
|
394 |
+
#: ../disqus/manage.php:570
|
395 |
msgid ""
|
396 |
"This removes all Disqus-specific settings. Comments will remain unaffected."
|
397 |
msgstr ""
|
398 |
|
399 |
+
#: ../disqus/manage.php:571
|
400 |
msgid ""
|
401 |
"If you have problems with resetting taking too long you may wish to first "
|
402 |
"manually drop the <code>disqus_dupecheck</code> index from your "
|
403 |
"<code>commentmeta</code> table."
|
404 |
msgstr ""
|
405 |
|
406 |
+
#: ../disqus/manage.php:578
|
407 |
msgid "Debug Information"
|
408 |
msgstr ""
|
409 |
|
410 |
+
#: ../disqus/manage.php:579
|
411 |
#, php-format
|
412 |
msgid ""
|
413 |
"Having problems with the plugin? Check out our <a href=\"%s\" onclick="
|
420 |
msgid "Upgrade Disqus Comments"
|
421 |
msgstr ""
|
422 |
|
423 |
+
#: ../disqus/upgrade.php:15
|
424 |
msgid "You need to upgrade your database to continue."
|
425 |
msgstr ""
|
manage.php
CHANGED
@@ -1,23 +1,46 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
global $dsq_api;
|
3 |
|
4 |
require(ABSPATH . 'wp-includes/version.php');
|
5 |
|
6 |
if ( !current_user_can('moderate_comments') ) {
|
7 |
-
die();
|
8 |
}
|
9 |
|
10 |
-
|
11 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
}
|
13 |
|
14 |
-
if(
|
15 |
-
$
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
21 |
}
|
22 |
|
23 |
// Handle export function.
|
@@ -37,6 +60,7 @@ if ( isset($_POST['reset']) ) {
|
|
37 |
<div class="wrap">
|
38 |
<h2><?php echo dsq_i('Disqus Reset'); ?></h2>
|
39 |
<form method="POST" action="?page=disqus">
|
|
|
40 |
<p><?php echo dsq_i('Disqus has been reset successfully.') ?></p>
|
41 |
<ul style="list-style: circle;padding-left:20px;">
|
42 |
<li><?php echo dsq_i('Local settings for the plugin were removed.') ?></li>
|
@@ -49,11 +73,90 @@ if ( isset($_POST['reset']) ) {
|
|
49 |
die();
|
50 |
}
|
51 |
|
52 |
-
//
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
// Handle advanced options.
|
59 |
if ( isset($_POST['disqus_forum_url']) && isset($_POST['disqus_replace']) ) {
|
@@ -70,21 +173,17 @@ if ( isset($_POST['disqus_forum_url']) && isset($_POST['disqus_replace']) ) {
|
|
70 |
|
71 |
// Only update if a value is actually POSTed, otherwise any time the form is saved the button and icon will be un-set
|
72 |
if ($_POST['disqus_sso_button']) { update_option('disqus_sso_button', $_POST['disqus_sso_button']); }
|
73 |
-
if ($_POST['disqus_sso_icon']) { update_option('disqus_sso_icon', $_POST['disqus_sso_icon']); }
|
74 |
} else {
|
75 |
// WP is older than 3.5, use legacy, less-elegant media uploader
|
76 |
if(isset($_FILES['disqus_sso_button'])) {
|
77 |
dsq_image_upload_handler('disqus_sso_button');
|
78 |
}
|
79 |
-
if(isset($_FILES['disqus_sso_icon'])) {
|
80 |
-
dsq_image_upload_handler('disqus_sso_icon');
|
81 |
-
}
|
82 |
}
|
83 |
dsq_manage_dialog(dsq_i('Your settings have been changed.'));
|
84 |
}
|
85 |
|
86 |
// handle disqus_active
|
87 |
-
if (isset($_GET['active'])) {
|
88 |
update_option('disqus_active', ($_GET['active'] == '1' ? '1' : '0'));
|
89 |
}
|
90 |
|
@@ -100,14 +199,16 @@ $step = (dsq_is_installed()) ? 0 : ($step ? $step : 1);
|
|
100 |
if ( 3 == $step && isset($_POST['dsq_forum']) && isset($_POST['dsq_user_api_key']) ) {
|
101 |
list($dsq_forum_id, $dsq_forum_url) = explode(':', $_POST['dsq_forum']);
|
102 |
update_option('disqus_forum_url', $dsq_forum_url);
|
|
|
103 |
$api_key = $dsq_api->get_forum_api_key($_POST['dsq_user_api_key'], $dsq_forum_id);
|
104 |
if ( !$api_key || $api_key < 0 ) {
|
105 |
update_option('disqus_replace', 'replace');
|
106 |
-
dsq_manage_dialog(dsq_i('There was an error completing the installation of Disqus. If you are still having issues, refer to the <a href="
|
107 |
} else {
|
108 |
update_option('disqus_api_key', $api_key);
|
109 |
update_option('disqus_user_api_key', $_POST['dsq_user_api_key']);
|
110 |
update_option('disqus_replace', 'all');
|
|
|
111 |
}
|
112 |
|
113 |
if (!empty($_POST['disqus_partner_key'])) {
|
@@ -132,7 +233,7 @@ if ( 2 == $step && isset($_POST['dsq_username']) && isset($_POST['dsq_password']
|
|
132 |
dsq_manage_dialog($dsq_api->get_last_error(), true);
|
133 |
} else if ( !$dsq_sites ) {
|
134 |
$step = 1;
|
135 |
-
dsq_manage_dialog(dsq_i('There aren\'t any sites associated with this account. Maybe you want to <a href="%s">create a site</a>?', '
|
136 |
}
|
137 |
}
|
138 |
}
|
@@ -166,7 +267,7 @@ case 2:
|
|
166 |
<h2><?php echo dsq_i('Install Disqus Comments'); ?></h2>
|
167 |
|
168 |
<form method="POST" action="?page=disqus&step=3">
|
169 |
-
<?php wp_nonce_field('dsq-
|
170 |
<table class="form-table">
|
171 |
<tr>
|
172 |
<th scope="row" valign="top"><?php echo dsq_i('Select a website'); ?></th>
|
@@ -200,20 +301,20 @@ case 1:
|
|
200 |
<h2><?php echo dsq_i('Install Disqus Comments'); ?></h2>
|
201 |
|
202 |
<form method="POST" action="?page=disqus&step=2">
|
203 |
-
<?php wp_nonce_field('dsq-
|
204 |
<table class="form-table">
|
205 |
<tr>
|
206 |
-
<th scope="row" valign="top"><?php echo dsq_i('Username'); ?></th>
|
207 |
<td>
|
208 |
<input id="dsq-username" name="dsq_username" tabindex="1" type="text" />
|
209 |
-
<a href="
|
210 |
</td>
|
211 |
</tr>
|
212 |
<tr>
|
213 |
<th scope="row" valign="top"><?php echo dsq_i('Password'); ?></th>
|
214 |
<td>
|
215 |
<input type="password" id="dsq-password" name="dsq_password" tabindex="2">
|
216 |
-
<a href="
|
217 |
</td>
|
218 |
</tr>
|
219 |
</table>
|
@@ -228,12 +329,14 @@ case 1:
|
|
228 |
<?php
|
229 |
break;
|
230 |
case 0:
|
|
|
231 |
$url = get_option('disqus_forum_url');
|
232 |
-
if ($url) { $mod_url =
|
233 |
else { $mod_url = DISQUS_URL.'admin/moderate/'; }
|
|
|
234 |
?>
|
235 |
<div class="dsq-main"<?php if ($show_advanced) echo ' style="display:none;"'; ?>>
|
236 |
-
<h2><a href="<?php echo $mod_url ?>"><img src="<?php echo
|
237 |
<iframe src="<?php echo $mod_url ?>?template=wordpress" style="width: 100%; height: 80%; min-height: 600px;"></iframe>
|
238 |
</div>
|
239 |
<?php } ?>
|
@@ -251,24 +354,23 @@ case 0:
|
|
251 |
$dsq_public_key = get_option('disqus_public_key');
|
252 |
$dsq_secret_key = get_option('disqus_secret_key');
|
253 |
$dsq_sso_button = get_option('disqus_sso_button');
|
254 |
-
$dsq_sso_icon = get_option('disqus_sso_icon');
|
255 |
?>
|
256 |
<!-- Settings -->
|
257 |
<div id="dsq-advanced" class="dsq-content dsq-advanced"<?php if (!$show_advanced) echo ' style="display:none;"'; ?>>
|
258 |
<h2><?php echo dsq_i('Settings'); ?></h2>
|
259 |
<p><?php echo dsq_i('Version: %s', esc_html(DISQUS_VERSION)); ?></p>
|
260 |
<?php
|
261 |
-
if (get_option('disqus_active')
|
262 |
// disqus is not active
|
263 |
-
echo dsq_i('<p class="status">Disqus comments are currently disabled
|
264 |
} else {
|
265 |
-
echo dsq_i('<p class="status">Disqus comments are currently enabled
|
266 |
}
|
267 |
?>
|
268 |
<form method="POST" enctype="multipart/form-data">
|
269 |
-
<?php wp_nonce_field('dsq-
|
270 |
<table class="form-table">
|
271 |
-
|
272 |
<tr>
|
273 |
<th scope="row" valign="top"><?php echo dsq_i('<h3>General</h3>'); ?></th>
|
274 |
</tr>
|
@@ -289,11 +391,14 @@ case 0:
|
|
289 |
<th scope="row" valign="top"><?php echo dsq_i('Use Disqus Comments on'); ?></th>
|
290 |
<td>
|
291 |
<select name="disqus_replace" tabindex="1" class="disqus-replace">
|
292 |
-
<option value="all" <?php if('all'
|
293 |
-
<option value="closed" <?php if('closed'==$dsq_replace){echo 'selected';}?>><?php echo dsq_i('
|
294 |
</select>
|
295 |
<br />
|
296 |
-
<?php
|
|
|
|
|
|
|
297 |
</td>
|
298 |
</tr>
|
299 |
|
@@ -301,11 +406,11 @@ case 0:
|
|
301 |
<th scope="row" valign="top"><?php echo dsq_i('<h3>Sync</h3>'); ?></th>
|
302 |
</tr>
|
303 |
<tr>
|
304 |
-
<th scope="row" valign="top"><?php echo dsq_i('Comment
|
305 |
<td>
|
306 |
<input type="checkbox" id="disqus_manual_sync" name="disqus_manual_sync" <?php if($dsq_manual_sync){echo 'checked="checked"';}?> >
|
307 |
<label for="disqus_manual_sync"><?php echo dsq_i('Disable automated comment importing'); ?></label>
|
308 |
-
<br /><?php echo dsq_i('If you have problems with WP-Cron taking too long, or have a large number of comments, you may wish to disable automated sync.
|
309 |
</td>
|
310 |
</tr>
|
311 |
<tr>
|
@@ -324,14 +429,14 @@ case 0:
|
|
324 |
<tr>
|
325 |
<th scope="row" valign="top"><?php echo dsq_i('Template Conflicts'); ?></th>
|
326 |
<td>
|
327 |
-
<input type="checkbox" id="disqus_comment_count" name="disqus_cc_fix" <?php if($dsq_cc_fix){echo 'checked="checked"';}?> >
|
328 |
<label for="disqus_comment_count"><?php echo dsq_i('Output JavaScript in footer'); ?></label>
|
329 |
-
<br /><?php echo dsq_i('Enable this if you have problems with comment counts or other irregularities. For example: missing counts, counts always at 0, Disqus code showing on the page, broken image carousels, or longer-than-usual home page load times (<a href="%s" onclick="window.open(this.href); return false">more info</a>).', '
|
330 |
</td>
|
331 |
</tr>
|
332 |
|
333 |
<tr>
|
334 |
-
<th scope="row" valign="top" colspan="2"><?php echo dsq_i('<h3>Advanced</h3><h4>Single Sign-On</h4><p>Allows users to log in to Disqus via WordPress. (<a href="%s" onclick="window.open(this.href); return false">More info on SSO</a>)</p>', '
|
335 |
</tr>
|
336 |
<?php if (!empty($dsq_partner_key)) {// this option only shows if it was already present ?>
|
337 |
<tr>
|
@@ -346,7 +451,7 @@ case 0:
|
|
346 |
<td>
|
347 |
<input type="text" name="disqus_public_key" value="<?php echo esc_attr($dsq_public_key); ?>" tabindex="2">
|
348 |
<br />
|
349 |
-
<?php echo dsq_i('Found at <a href="%s">Disqus API Applications</a>.','
|
350 |
</td>
|
351 |
</tr>
|
352 |
<tr>
|
@@ -354,7 +459,7 @@ case 0:
|
|
354 |
<td>
|
355 |
<input type="text" name="disqus_secret_key" value="<?php echo esc_attr($dsq_secret_key); ?>" tabindex="2">
|
356 |
<br />
|
357 |
-
<?php echo dsq_i('Found at <a href="%s">Disqus API Applications</a>.','
|
358 |
</td>
|
359 |
</tr>
|
360 |
<tr>
|
@@ -367,24 +472,24 @@ case 0:
|
|
367 |
|
368 |
<?php if ( version_compare($wp_version, '3.5', '>=') ) {
|
369 |
// HACK: Use WP's new (as of WP 3.5), streamlined, much-improved built-in media uploader
|
370 |
-
|
371 |
// Use WP 3.5's new consolidated call to get all necessary media uploader scripts and styles
|
372 |
wp_enqueue_media(); ?>
|
373 |
|
374 |
<script type="text/javascript">
|
375 |
// Uploading files
|
376 |
var file_frame;
|
377 |
-
|
378 |
jQuery('.upload_image_button').live('click', function( event ){
|
379 |
-
|
380 |
event.preventDefault();
|
381 |
-
|
382 |
// If the media frame already exists, reopen it.
|
383 |
if ( file_frame ) {
|
384 |
file_frame.open();
|
385 |
return;
|
386 |
}
|
387 |
-
|
388 |
// Create the media frame.
|
389 |
file_frame = wp.media.frames.file_frame = wp.media({
|
390 |
title: jQuery( this ).data( 'uploader_title' ),
|
@@ -393,16 +498,16 @@ case 0:
|
|
393 |
},
|
394 |
multiple: false // Set to true to allow multiple files to be selected
|
395 |
});
|
396 |
-
|
397 |
// When an image is selected, run a callback.
|
398 |
file_frame.on( 'select', function() {
|
399 |
// We set multiple to false so only get one image from the uploader
|
400 |
attachment = file_frame.state().get('selection').first().toJSON();
|
401 |
-
|
402 |
// Do something with attachment.id and/or attachment.url here
|
403 |
jQuery('#disqus_sso_button').val(attachment.url);
|
404 |
});
|
405 |
-
|
406 |
// Finally, open the modal
|
407 |
file_frame.open();
|
408 |
});
|
@@ -414,68 +519,8 @@ case 0:
|
|
414 |
<input type="file" name="disqus_sso_button" value="<?php echo esc_attr($dsq_sso_button); ?>" tabindex="2">
|
415 |
<?php } ?>
|
416 |
<br />
|
417 |
-
<?php echo dsq_i('Adds a button to the Disqus log-in interface. (<a href="%s">Example screenshot</a>.)','
|
418 |
-
<?php echo dsq_i('<br />See <a href="%s">our SSO button documentation</a> for a template to create your own button.','
|
419 |
-
</td>
|
420 |
-
</tr>
|
421 |
-
<tr>
|
422 |
-
<th scope="row" valign="top"><?php echo dsq_i('Custom Log-in Icon<br>'); ?></th>
|
423 |
-
<td>
|
424 |
-
<?php if (!empty($dsq_sso_icon)) { ?>
|
425 |
-
<img src="<?php echo esc_attr($dsq_sso_icon); ?>" alt="<?php echo esc_attr($dsq_sso_icon); ?>" />
|
426 |
-
<br />
|
427 |
-
<?php } ?>
|
428 |
-
<?php if ( version_compare($wp_version, '3.5', '>=') ) {
|
429 |
-
// HACK: Use WP's new (as of WP 3.5), streamlined, much-improved built-in media uploader
|
430 |
-
|
431 |
-
// Use WP 3.5's new consolidated call to get all necessary media uploader scripts and styles
|
432 |
-
wp_enqueue_media(); ?>
|
433 |
-
|
434 |
-
<script type="text/javascript">
|
435 |
-
// Uploading files
|
436 |
-
var file_frame2;
|
437 |
-
|
438 |
-
jQuery('.upload_image_button2').live('click', function( event ){
|
439 |
-
|
440 |
-
event.preventDefault();
|
441 |
-
|
442 |
-
// If the media frame already exists, reopen it.
|
443 |
-
if ( file_frame2 ) {
|
444 |
-
file_frame2.open();
|
445 |
-
return;
|
446 |
-
}
|
447 |
-
|
448 |
-
// Create the media frame.
|
449 |
-
file_frame2 = wp.media.frames.file_frame = wp.media({
|
450 |
-
title: jQuery( this ).data( 'uploader_title' ),
|
451 |
-
button: {
|
452 |
-
text: jQuery( this ).data( 'uploader_button_text' ),
|
453 |
-
},
|
454 |
-
multiple: false // Set to true to allow multiple files to be selected
|
455 |
-
});
|
456 |
-
|
457 |
-
// When an image is selected, run a callback.
|
458 |
-
file_frame2.on( 'select', function() {
|
459 |
-
// We set multiple to false so only get one image from the uploader
|
460 |
-
attachment = file_frame2.state().get('selection').first().toJSON();
|
461 |
-
|
462 |
-
// Do something with attachment.id and/or attachment.url here
|
463 |
-
jQuery('#disqus_sso_icon').val(attachment.url);
|
464 |
-
});
|
465 |
-
|
466 |
-
// Finally, open the modal
|
467 |
-
file_frame2.open();
|
468 |
-
});
|
469 |
-
</script>
|
470 |
-
|
471 |
-
<input type="button" value="<?php echo ($dsq_sso_icon ? dsq_i('Change') : dsq_i('Choose')).' '.dsq_i('icon'); ?>" class="button upload_image_button2" tabindex="2">
|
472 |
-
<input type="hidden" name="disqus_sso_icon" id="disqus_sso_icon" value=""/>
|
473 |
-
<?php } else { // use pre-WP 3.5 media upload functionality ?>
|
474 |
-
<input type="file" name="disqus_sso_icon" value="<?php echo esc_attr($dsq_sso_icon); ?>" tabindex="2">
|
475 |
-
<?php } ?>
|
476 |
-
<br />
|
477 |
-
<?php echo dsq_i('Adds an icon to the Disqus Classic log-in modal. This does not apply for sites using Disqus 2012. (<a href="%s">Example screenshot</a>.)','http://content.disqus.com/docs/sso-icon.png'); ?>
|
478 |
-
<?php echo dsq_i('<br />Dimensions: 16x16.'); ?>
|
479 |
</td>
|
480 |
</tr>
|
481 |
|
@@ -521,7 +566,7 @@ case 0:
|
|
521 |
<th scope="row" valign="top"><?php echo dsq_i('Reset Disqus'); ?></th>
|
522 |
<td>
|
523 |
<form action="?page=disqus" method="POST">
|
524 |
-
<?php wp_nonce_field('dsq-
|
525 |
<p><input type="submit" value="Reset" name="reset" onclick="return confirm('<?php echo dsq_i('Are you sure you want to reset the Disqus plugin?'); ?>')" class="button" /> <?php echo dsq_i('This removes all Disqus-specific settings. Comments will remain unaffected.') ?></p>
|
526 |
<?php echo dsq_i('If you have problems with resetting taking too long you may wish to first manually drop the <code>disqus_dupecheck</code> index from your <code>commentmeta</code> table.') ?>
|
527 |
</form>
|
@@ -531,25 +576,37 @@ case 0:
|
|
531 |
<br/>
|
532 |
|
533 |
<h3><?php echo dsq_i('Debug Information'); ?></h3>
|
534 |
-
<p><?php echo dsq_i('Having problems with the plugin? Check out our <a href="%s" onclick="window.open(this.href); return false">WordPress Troubleshooting</a> documentation. You can also <a href="%s">drop us a line</a> including the following details and we\'ll do what we can.', '
|
535 |
-
<textarea style="width:90%; height:200px;">
|
|
|
|
|
536 |
PHP Version: <?php echo phpversion(); ?>
|
|
|
537 |
Version: <?php echo $wp_version; ?>
|
538 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
539 |
URLOpen Method: <?php echo dsq_url_method(); ?>
|
540 |
|
541 |
Plugin Version: <?php echo DISQUS_VERSION; ?>
|
542 |
|
543 |
Settings:
|
544 |
-
|
545 |
dsq_is_installed: <?php echo dsq_is_installed(); ?>
|
546 |
-
|
547 |
<?php foreach (dsq_options() as $opt) {
|
548 |
-
echo $opt.': '.get_option($opt)."\n";
|
549 |
-
}
|
|
|
550 |
|
551 |
Plugins:
|
552 |
-
|
553 |
<?php
|
554 |
foreach (get_plugins() as $key => $plugin) {
|
555 |
$isactive = "";
|
@@ -558,6 +615,7 @@ foreach (get_plugins() as $key => $plugin) {
|
|
558 |
}
|
559 |
echo $plugin['Name'].' '.$plugin['Version'].' '.$isactive."\n";
|
560 |
}
|
561 |
-
|
|
|
562 |
</div>
|
563 |
</div>
|
1 |
<?php
|
2 |
+
// HACK: For old versions of WordPress
|
3 |
+
if ( !function_exists('wp_nonce_field') ) {
|
4 |
+
function wp_nonce_field() {}
|
5 |
+
}
|
6 |
+
|
7 |
global $dsq_api;
|
8 |
|
9 |
require(ABSPATH . 'wp-includes/version.php');
|
10 |
|
11 |
if ( !current_user_can('moderate_comments') ) {
|
12 |
+
die('The account you\'re logged in to doesn\'t have permission to access this page.');
|
13 |
}
|
14 |
|
15 |
+
function has_valid_nonce() {
|
16 |
+
$nonce_actions = array('upgrade', 'reset', 'install', 'settings');
|
17 |
+
$nonce_form_prefix = 'dsq-form_nonce_';
|
18 |
+
$nonce_action_prefix = 'dsq-wpnonce_';
|
19 |
+
|
20 |
+
// Check all available nonce actions
|
21 |
+
foreach ( $nonce_actions as $key => $value ) {
|
22 |
+
if ( isset($_POST[$nonce_form_prefix.$value]) ) {
|
23 |
+
check_admin_referer($nonce_action_prefix.$value, $nonce_form_prefix.$value);
|
24 |
+
return true;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
return false;
|
29 |
}
|
30 |
|
31 |
+
if ( ! empty($_POST) ) {
|
32 |
+
$nonce_result_check = has_valid_nonce();
|
33 |
+
if ($nonce_result_check === false) {
|
34 |
+
die('Unable to save changes. Make sure you are accessing this page from the Wordpress dashboard.');
|
35 |
+
}
|
36 |
}
|
37 |
|
38 |
+
if( isset($_POST['dsq_username']) ) {
|
39 |
+
$_POST['dsq_username'] = stripslashes($_POST['dsq_username']);
|
40 |
+
}
|
41 |
+
|
42 |
+
if( isset($_POST['dsq_password']) ) {
|
43 |
+
$_POST['dsq_password'] = stripslashes($_POST['dsq_password']);
|
44 |
}
|
45 |
|
46 |
// Handle export function.
|
60 |
<div class="wrap">
|
61 |
<h2><?php echo dsq_i('Disqus Reset'); ?></h2>
|
62 |
<form method="POST" action="?page=disqus">
|
63 |
+
<?php wp_nonce_field('dsq-wpnonce_reset', 'dsq-form_nonce_reset'); ?>
|
64 |
<p><?php echo dsq_i('Disqus has been reset successfully.') ?></p>
|
65 |
<ul style="list-style: circle;padding-left:20px;">
|
66 |
<li><?php echo dsq_i('Local settings for the plugin were removed.') ?></li>
|
73 |
die();
|
74 |
}
|
75 |
|
76 |
+
// Post fields that require verification.
|
77 |
+
$check_fields = array(
|
78 |
+
'dsq_user_api_key' => array(
|
79 |
+
'key_name' => 'dsq_user_api_key',
|
80 |
+
'min' => 64,
|
81 |
+
'max' => 64,
|
82 |
+
),
|
83 |
+
'disqus_api_key' => array(
|
84 |
+
'key_name' => 'disqus_api_key',
|
85 |
+
'min' => 64,
|
86 |
+
'max' => 64,
|
87 |
+
),
|
88 |
+
'disqus_public_key' => array(
|
89 |
+
'key_name' => 'disqus_public_key',
|
90 |
+
'min' => 64,
|
91 |
+
'max' => 64,
|
92 |
+
),
|
93 |
+
'disqus_secret_key' => array(
|
94 |
+
'key_name' => 'disqus_secret_key',
|
95 |
+
'min' => 64,
|
96 |
+
'max' => 64,
|
97 |
+
),
|
98 |
+
'disqus_partner_key' => array(
|
99 |
+
'key_name' => 'disqus_partner_key',
|
100 |
+
'min' => 64,
|
101 |
+
'max' => 64,
|
102 |
+
),
|
103 |
+
'dsq_forum' => array(
|
104 |
+
'key_name' => 'dsq_forum',
|
105 |
+
'min' => 1,
|
106 |
+
'max' => 64,
|
107 |
+
),
|
108 |
+
'disqus_forum_url' => array(
|
109 |
+
'key_name' => 'disqus_forum_url',
|
110 |
+
'min' => 1,
|
111 |
+
'max' => 64,
|
112 |
+
),
|
113 |
+
'disqus_replace' => array(
|
114 |
+
'key_name' => 'disqus_replace',
|
115 |
+
'min' => 3,
|
116 |
+
'max' => 6,
|
117 |
+
),
|
118 |
+
'dsq_username' => array(
|
119 |
+
'key_name' => 'dsq_username',
|
120 |
+
'min' => 3,
|
121 |
+
'max' => 250,
|
122 |
+
),
|
123 |
+
);
|
124 |
+
|
125 |
+
// Check keys keys and remove bad input.
|
126 |
+
foreach ( $check_fields as $key ) {
|
127 |
+
|
128 |
+
if ( isset($_POST[$key['key_name']]) ) {
|
129 |
+
|
130 |
+
// Strip tags before checking
|
131 |
+
$_POST[$key['key_name']] = trim(strip_tags($_POST[$key['key_name']]));
|
132 |
+
|
133 |
+
// Check usernames independently because they can have special characters
|
134 |
+
// or be email addresses
|
135 |
+
if ( 'dsq_username' === $key['key_name'] ) {
|
136 |
+
if ( !is_valid_dsq_username($_POST[$key['key_name']], $key['min'], $key['max']) ) {
|
137 |
+
unset($_POST[$key['key_name']]);
|
138 |
+
}
|
139 |
+
}
|
140 |
+
else {
|
141 |
+
if ( !is_valid_dsq_key($_POST[$key['key_name']], $key['min'], $key['max']) ) {
|
142 |
+
unset($_POST[$key['key_name']]);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
}
|
146 |
}
|
147 |
|
148 |
+
function is_valid_dsq_username($value, $min=3, $max=250) {
|
149 |
+
if ( is_email($value) ) {
|
150 |
+
return true;
|
151 |
+
}
|
152 |
+
else {
|
153 |
+
return is_valid_dsq_key($value, $min, $max);
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
function is_valid_dsq_key($value, $min=1, $max=64) {
|
158 |
+
return preg_match('/^[\0-9\\:A-Za-z_-]{'.$min.','.$max.'}+$/', $value);
|
159 |
+
}
|
160 |
|
161 |
// Handle advanced options.
|
162 |
if ( isset($_POST['disqus_forum_url']) && isset($_POST['disqus_replace']) ) {
|
173 |
|
174 |
// Only update if a value is actually POSTed, otherwise any time the form is saved the button and icon will be un-set
|
175 |
if ($_POST['disqus_sso_button']) { update_option('disqus_sso_button', $_POST['disqus_sso_button']); }
|
|
|
176 |
} else {
|
177 |
// WP is older than 3.5, use legacy, less-elegant media uploader
|
178 |
if(isset($_FILES['disqus_sso_button'])) {
|
179 |
dsq_image_upload_handler('disqus_sso_button');
|
180 |
}
|
|
|
|
|
|
|
181 |
}
|
182 |
dsq_manage_dialog(dsq_i('Your settings have been changed.'));
|
183 |
}
|
184 |
|
185 |
// handle disqus_active
|
186 |
+
if ( isset($_GET['active']) ) {
|
187 |
update_option('disqus_active', ($_GET['active'] == '1' ? '1' : '0'));
|
188 |
}
|
189 |
|
199 |
if ( 3 == $step && isset($_POST['dsq_forum']) && isset($_POST['dsq_user_api_key']) ) {
|
200 |
list($dsq_forum_id, $dsq_forum_url) = explode(':', $_POST['dsq_forum']);
|
201 |
update_option('disqus_forum_url', $dsq_forum_url);
|
202 |
+
update_option('disqus_cc_fix', '1');
|
203 |
$api_key = $dsq_api->get_forum_api_key($_POST['dsq_user_api_key'], $dsq_forum_id);
|
204 |
if ( !$api_key || $api_key < 0 ) {
|
205 |
update_option('disqus_replace', 'replace');
|
206 |
+
dsq_manage_dialog(dsq_i('There was an error completing the installation of Disqus. If you are still having issues, refer to the <a href="https://help.disqus.com/customer/portal/articles/472005-wordpress-troubleshooting">WordPress help page</a>.'), true);
|
207 |
} else {
|
208 |
update_option('disqus_api_key', $api_key);
|
209 |
update_option('disqus_user_api_key', $_POST['dsq_user_api_key']);
|
210 |
update_option('disqus_replace', 'all');
|
211 |
+
update_option('disqus_active', '1');
|
212 |
}
|
213 |
|
214 |
if (!empty($_POST['disqus_partner_key'])) {
|
233 |
dsq_manage_dialog($dsq_api->get_last_error(), true);
|
234 |
} else if ( !$dsq_sites ) {
|
235 |
$step = 1;
|
236 |
+
dsq_manage_dialog(dsq_i('There aren\'t any sites associated with this account. Maybe you want to <a href="%s">create a site</a>?', 'https://disqus.com/admin/register/'), true);
|
237 |
}
|
238 |
}
|
239 |
}
|
267 |
<h2><?php echo dsq_i('Install Disqus Comments'); ?></h2>
|
268 |
|
269 |
<form method="POST" action="?page=disqus&step=3">
|
270 |
+
<?php wp_nonce_field('dsq-wpnonce_install', 'dsq-form_nonce_install'); ?>
|
271 |
<table class="form-table">
|
272 |
<tr>
|
273 |
<th scope="row" valign="top"><?php echo dsq_i('Select a website'); ?></th>
|
301 |
<h2><?php echo dsq_i('Install Disqus Comments'); ?></h2>
|
302 |
|
303 |
<form method="POST" action="?page=disqus&step=2">
|
304 |
+
<?php wp_nonce_field('dsq-wpnonce_install', 'dsq-form_nonce_install'); ?>
|
305 |
<table class="form-table">
|
306 |
<tr>
|
307 |
+
<th scope="row" valign="top"><?php echo dsq_i('Username or email'); ?></th>
|
308 |
<td>
|
309 |
<input id="dsq-username" name="dsq_username" tabindex="1" type="text" />
|
310 |
+
<a href="https://disqus.com/profile/signup/"><?php echo dsq_i('(don\'t have a Disqus Profile yet?)'); ?></a>
|
311 |
</td>
|
312 |
</tr>
|
313 |
<tr>
|
314 |
<th scope="row" valign="top"><?php echo dsq_i('Password'); ?></th>
|
315 |
<td>
|
316 |
<input type="password" id="dsq-password" name="dsq_password" tabindex="2">
|
317 |
+
<a href="https://disqus.com/forgot/"><?php echo dsq_i('(forgot your password?)'); ?></a>
|
318 |
</td>
|
319 |
</tr>
|
320 |
</table>
|
329 |
<?php
|
330 |
break;
|
331 |
case 0:
|
332 |
+
$base = is_ssl() ? 'https://' : 'http://';
|
333 |
$url = get_option('disqus_forum_url');
|
334 |
+
if ($url) { $mod_url = $base.$url.'.'.DISQUS_DOMAIN.'/admin/moderate/'; }
|
335 |
else { $mod_url = DISQUS_URL.'admin/moderate/'; }
|
336 |
+
|
337 |
?>
|
338 |
<div class="dsq-main"<?php if ($show_advanced) echo ' style="display:none;"'; ?>>
|
339 |
+
<h2><a href="<?php echo $mod_url ?>"><img src="<?php echo plugins_url( '/media/images/logo.png', __FILE__ ); ?>"></a></h2>
|
340 |
<iframe src="<?php echo $mod_url ?>?template=wordpress" style="width: 100%; height: 80%; min-height: 600px;"></iframe>
|
341 |
</div>
|
342 |
<?php } ?>
|
354 |
$dsq_public_key = get_option('disqus_public_key');
|
355 |
$dsq_secret_key = get_option('disqus_secret_key');
|
356 |
$dsq_sso_button = get_option('disqus_sso_button');
|
|
|
357 |
?>
|
358 |
<!-- Settings -->
|
359 |
<div id="dsq-advanced" class="dsq-content dsq-advanced"<?php if (!$show_advanced) echo ' style="display:none;"'; ?>>
|
360 |
<h2><?php echo dsq_i('Settings'); ?></h2>
|
361 |
<p><?php echo dsq_i('Version: %s', esc_html(DISQUS_VERSION)); ?></p>
|
362 |
<?php
|
363 |
+
if (get_option('disqus_active') == '0') {
|
364 |
// disqus is not active
|
365 |
+
echo dsq_i('<p class="status">Disqus comments are currently <span class="dsq-disabled-text">disabled</span>. (<a href="?page=disqus&active=1">Enable</a>)</p>');
|
366 |
} else {
|
367 |
+
echo dsq_i('<p class="status">Disqus comments are currently <span class="dsq-enabled-text">enabled</span>. (<a href="?page=disqus&active=0">Disable</a>)</p>');
|
368 |
}
|
369 |
?>
|
370 |
<form method="POST" enctype="multipart/form-data">
|
371 |
+
<?php wp_nonce_field('dsq-wpnonce_settings', 'dsq-form_nonce_settings'); ?>
|
372 |
<table class="form-table">
|
373 |
+
|
374 |
<tr>
|
375 |
<th scope="row" valign="top"><?php echo dsq_i('<h3>General</h3>'); ?></th>
|
376 |
</tr>
|
391 |
<th scope="row" valign="top"><?php echo dsq_i('Use Disqus Comments on'); ?></th>
|
392 |
<td>
|
393 |
<select name="disqus_replace" tabindex="1" class="disqus-replace">
|
394 |
+
<option value="all" <?php if($dsq_replace == 'all'){echo 'selected';}?>><?php echo dsq_i('All blog posts.'); ?></option>
|
395 |
+
<option value="closed" <?php if('closed'==$dsq_replace){echo 'selected';}?>><?php echo dsq_i('Blog posts with closed comments only.'); ?></option>
|
396 |
</select>
|
397 |
<br />
|
398 |
+
<?php
|
399 |
+
if ($dsq_replace == 'closed') echo '<p class="dsq-alert">'.dsq_i('You have selected to only enable Disqus on posts with closed comments. If you aren\'t seeing Disqus on new posts, change this option to <strong>All blog posts</strong>.').'</p>';
|
400 |
+
else echo dsq_i('Shows comments on either all blog posts, or ones with closed comments. Select the <strong>Blog posts with closed comments only</strong> option if you plan on disabling Disqus, but want to keep it on posts which already have comments.');
|
401 |
+
?>
|
402 |
</td>
|
403 |
</tr>
|
404 |
|
406 |
<th scope="row" valign="top"><?php echo dsq_i('<h3>Sync</h3>'); ?></th>
|
407 |
</tr>
|
408 |
<tr>
|
409 |
+
<th scope="row" valign="top"><?php echo dsq_i('Comment Importing'); ?></th>
|
410 |
<td>
|
411 |
<input type="checkbox" id="disqus_manual_sync" name="disqus_manual_sync" <?php if($dsq_manual_sync){echo 'checked="checked"';}?> >
|
412 |
<label for="disqus_manual_sync"><?php echo dsq_i('Disable automated comment importing'); ?></label>
|
413 |
+
<br /><?php echo dsq_i('If you have problems with WP-Cron taking too long, or have a large number of comments, you may wish to disable automated sync. Comments will only be imported to your local Wordpress database if you do so manually.'); ?>
|
414 |
</td>
|
415 |
</tr>
|
416 |
<tr>
|
429 |
<tr>
|
430 |
<th scope="row" valign="top"><?php echo dsq_i('Template Conflicts'); ?></th>
|
431 |
<td>
|
432 |
+
<input type="checkbox" id="disqus_comment_count" name="disqus_cc_fix" <?php if($dsq_cc_fix == '1'){ echo 'checked="checked"'; } ?> >
|
433 |
<label for="disqus_comment_count"><?php echo dsq_i('Output JavaScript in footer'); ?></label>
|
434 |
+
<br /><?php echo dsq_i('Enable this if you have problems with comment counts or other irregularities. For example: missing counts, counts always at 0, Disqus code showing on the page, broken image carousels, or longer-than-usual home page load times (<a href="%s" onclick="window.open(this.href); return false">more info</a>).', 'https://help.disqus.com/customer/portal/articles/472005-wordpress-troubleshooting'); ?>
|
435 |
</td>
|
436 |
</tr>
|
437 |
|
438 |
<tr>
|
439 |
+
<th scope="row" valign="top" colspan="2"><?php echo dsq_i('<h3>Advanced</h3><h4>Single Sign-On</h4><p>Allows users to log in to Disqus via WordPress. (<a href="%s" onclick="window.open(this.href); return false">More info on SSO</a>)</p>', 'https://help.disqus.com/customer/portal/articles/684744'); ?></th>
|
440 |
</tr>
|
441 |
<?php if (!empty($dsq_partner_key)) {// this option only shows if it was already present ?>
|
442 |
<tr>
|
451 |
<td>
|
452 |
<input type="text" name="disqus_public_key" value="<?php echo esc_attr($dsq_public_key); ?>" tabindex="2">
|
453 |
<br />
|
454 |
+
<?php echo dsq_i('Found at <a href="%s">Disqus API Applications</a>.','https://disqus.com/api/applications/'); ?>
|
455 |
</td>
|
456 |
</tr>
|
457 |
<tr>
|
459 |
<td>
|
460 |
<input type="text" name="disqus_secret_key" value="<?php echo esc_attr($dsq_secret_key); ?>" tabindex="2">
|
461 |
<br />
|
462 |
+
<?php echo dsq_i('Found at <a href="%s">Disqus API Applications</a>.','https://disqus.com/api/applications/'); ?>
|
463 |
</td>
|
464 |
</tr>
|
465 |
<tr>
|
472 |
|
473 |
<?php if ( version_compare($wp_version, '3.5', '>=') ) {
|
474 |
// HACK: Use WP's new (as of WP 3.5), streamlined, much-improved built-in media uploader
|
475 |
+
|
476 |
// Use WP 3.5's new consolidated call to get all necessary media uploader scripts and styles
|
477 |
wp_enqueue_media(); ?>
|
478 |
|
479 |
<script type="text/javascript">
|
480 |
// Uploading files
|
481 |
var file_frame;
|
482 |
+
|
483 |
jQuery('.upload_image_button').live('click', function( event ){
|
484 |
+
|
485 |
event.preventDefault();
|
486 |
+
|
487 |
// If the media frame already exists, reopen it.
|
488 |
if ( file_frame ) {
|
489 |
file_frame.open();
|
490 |
return;
|
491 |
}
|
492 |
+
|
493 |
// Create the media frame.
|
494 |
file_frame = wp.media.frames.file_frame = wp.media({
|
495 |
title: jQuery( this ).data( 'uploader_title' ),
|
498 |
},
|
499 |
multiple: false // Set to true to allow multiple files to be selected
|
500 |
});
|
501 |
+
|
502 |
// When an image is selected, run a callback.
|
503 |
file_frame.on( 'select', function() {
|
504 |
// We set multiple to false so only get one image from the uploader
|
505 |
attachment = file_frame.state().get('selection').first().toJSON();
|
506 |
+
|
507 |
// Do something with attachment.id and/or attachment.url here
|
508 |
jQuery('#disqus_sso_button').val(attachment.url);
|
509 |
});
|
510 |
+
|
511 |
// Finally, open the modal
|
512 |
file_frame.open();
|
513 |
});
|
519 |
<input type="file" name="disqus_sso_button" value="<?php echo esc_attr($dsq_sso_button); ?>" tabindex="2">
|
520 |
<?php } ?>
|
521 |
<br />
|
522 |
+
<?php echo dsq_i('Adds a button to the Disqus log-in interface. (<a href="%s">Example screenshot</a>.)','https://d8v2sqslxfuhj.cloudfront.net/docs/sso-button.png'); ?>
|
523 |
+
<?php echo dsq_i('<br />See <a href="%s">our SSO button documentation</a> for a template to create your own button.','https://help.disqus.com/customer/portal/articles/236206#sso-login-button'); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
</td>
|
525 |
</tr>
|
526 |
|
566 |
<th scope="row" valign="top"><?php echo dsq_i('Reset Disqus'); ?></th>
|
567 |
<td>
|
568 |
<form action="?page=disqus" method="POST">
|
569 |
+
<?php wp_nonce_field('dsq-wpnonce_reset', 'dsq-form_nonce_reset'); ?>
|
570 |
<p><input type="submit" value="Reset" name="reset" onclick="return confirm('<?php echo dsq_i('Are you sure you want to reset the Disqus plugin?'); ?>')" class="button" /> <?php echo dsq_i('This removes all Disqus-specific settings. Comments will remain unaffected.') ?></p>
|
571 |
<?php echo dsq_i('If you have problems with resetting taking too long you may wish to first manually drop the <code>disqus_dupecheck</code> index from your <code>commentmeta</code> table.') ?>
|
572 |
</form>
|
576 |
<br/>
|
577 |
|
578 |
<h3><?php echo dsq_i('Debug Information'); ?></h3>
|
579 |
+
<p><?php echo dsq_i('Having problems with the plugin? Check out our <a href="%s" onclick="window.open(this.href); return false">WordPress Troubleshooting</a> documentation. You can also <a href="%s">drop us a line</a> including the following details and we\'ll do what we can.', 'https://help.disqus.com/customer/portal/articles/472005-wordpress-troubleshooting', 'mailto:help+wp@disqus.com'); ?></p>
|
580 |
+
<textarea style="width:90%; height:200px;">
|
581 |
+
URL: <?php echo esc_attr(get_option('siteurl')); ?>
|
582 |
+
|
583 |
PHP Version: <?php echo phpversion(); ?>
|
584 |
+
|
585 |
Version: <?php echo $wp_version; ?>
|
586 |
+
|
587 |
+
Active Theme:
|
588 |
+
<?php
|
589 |
+
if ( !function_exists('wp_get_theme') ) {
|
590 |
+
$theme = get_theme(get_current_theme());
|
591 |
+
echo $theme['Name'] . ' ' . $theme['Version'];
|
592 |
+
} else {
|
593 |
+
$theme = wp_get_theme();
|
594 |
+
echo $theme->Name . ' ' . $theme->Version;
|
595 |
+
}
|
596 |
+
?>
|
597 |
+
|
598 |
URLOpen Method: <?php echo dsq_url_method(); ?>
|
599 |
|
600 |
Plugin Version: <?php echo DISQUS_VERSION; ?>
|
601 |
|
602 |
Settings:
|
|
|
603 |
dsq_is_installed: <?php echo dsq_is_installed(); ?>
|
|
|
604 |
<?php foreach (dsq_options() as $opt) {
|
605 |
+
echo $opt.': '.esc_attr(get_option($opt))."\n";
|
606 |
+
}
|
607 |
+
?>
|
608 |
|
609 |
Plugins:
|
|
|
610 |
<?php
|
611 |
foreach (get_plugins() as $key => $plugin) {
|
612 |
$isactive = "";
|
615 |
}
|
616 |
echo $plugin['Name'].' '.$plugin['Version'].' '.$isactive."\n";
|
617 |
}
|
618 |
+
?>
|
619 |
+
</textarea><br/>
|
620 |
</div>
|
621 |
</div>
|
media/styles/manage.css
CHANGED
@@ -33,3 +33,20 @@ select.disqus-replace {
|
|
33 |
line-height: 41px;
|
34 |
margin: 15px 0 10px;
|
35 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
line-height: 41px;
|
34 |
margin: 15px 0 10px;
|
35 |
}
|
36 |
+
|
37 |
+
.dsq-alert {
|
38 |
+
color: #fff;
|
39 |
+
background: #e76c35;
|
40 |
+
border: 1px solid #8f3e1c;
|
41 |
+
padding: 5px;
|
42 |
+
}
|
43 |
+
|
44 |
+
.dsq-disabled-text {
|
45 |
+
color: #e76c35;
|
46 |
+
font-weight: 700;
|
47 |
+
}
|
48 |
+
|
49 |
+
.dsq-enabled-text {
|
50 |
+
color: #7fbd5a;
|
51 |
+
font-weight: 700;
|
52 |
+
}
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: disqus, alexkingorg, crowdfavorite, zeeg, tail, thetylerhayes
|
3 |
Tags: comments, threaded, email, notification, spam, avatars, community, profile, widget, disqus
|
4 |
Requires at least: 2.8
|
5 |
-
Tested up to: 3.
|
6 |
-
Stable tag: 2.
|
7 |
|
8 |
The Disqus comment system replaces your WordPress comment system with your comments hosted and powered by Disqus.
|
9 |
|
@@ -60,6 +60,28 @@ Go to [http://disqus.com/help/wordpress](http://disqus.com/help/wordpress)
|
|
60 |
|
61 |
== Changes ==
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
2.74
|
64 |
|
65 |
* Updated settings UI
|
2 |
Contributors: disqus, alexkingorg, crowdfavorite, zeeg, tail, thetylerhayes
|
3 |
Tags: comments, threaded, email, notification, spam, avatars, community, profile, widget, disqus
|
4 |
Requires at least: 2.8
|
5 |
+
Tested up to: 3.9.1
|
6 |
+
Stable tag: 2.77
|
7 |
|
8 |
The Disqus comment system replaces your WordPress comment system with your comments hosted and powered by Disqus.
|
9 |
|
60 |
|
61 |
== Changes ==
|
62 |
|
63 |
+
2.77
|
64 |
+
|
65 |
+
* Fixes login by email issue
|
66 |
+
* Make sure Disqus is enabled after installation
|
67 |
+
* Additional security fixes
|
68 |
+
|
69 |
+
2.76
|
70 |
+
|
71 |
+
* Security fixes (Thanks to Nik Cubrilovic, Alexander Concha and Marc-Alexandre Montpas)
|
72 |
+
* Bump tested Wordpress version to 3.9.1
|
73 |
+
* Remove obsolete SSO button uploader
|
74 |
+
* Enable 'Output javascript in footer' by default during installation
|
75 |
+
* Fix for 'Reset' function not completely working the first time
|
76 |
+
|
77 |
+
2.75
|
78 |
+
|
79 |
+
* Bump supported WordPress version to 3.8.
|
80 |
+
* Properly encode site name for SSO login button.
|
81 |
+
* Increased timeout for comment exporter to 60 seconds.
|
82 |
+
* Use https: for admin pages
|
83 |
+
* Miscellaneous bug fixes and improvements.
|
84 |
+
|
85 |
2.74
|
86 |
|
87 |
* Updated settings UI
|
trunk/LICENSE
DELETED
@@ -1,674 +0,0 @@
|
|
1 |
-
GNU GENERAL PUBLIC LICENSE
|
2 |
-
Version 3, 29 June 2007
|
3 |
-
|
4 |
-
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
-
Everyone is permitted to copy and distribute verbatim copies
|
6 |
-
of this license document, but changing it is not allowed.
|
7 |
-
|
8 |
-
Preamble
|
9 |
-
|
10 |
-
The GNU General Public License is a free, copyleft license for
|
11 |
-
software and other kinds of works.
|
12 |
-
|
13 |
-
The licenses for most software and other practical works are designed
|
14 |
-
to take away your freedom to share and change the works. By contrast,
|
15 |
-
the GNU General Public License is intended to guarantee your freedom to
|
16 |
-
share and change all versions of a program--to make sure it remains free
|
17 |
-
software for all its users. We, the Free Software Foundation, use the
|
18 |
-
GNU General Public License for most of our software; it applies also to
|
19 |
-
any other work released this way by its authors. You can apply it to
|
20 |
-
your programs, too.
|
21 |
-
|
22 |
-
When we speak of free software, we are referring to freedom, not
|
23 |
-
price. Our General Public Licenses are designed to make sure that you
|
24 |
-
have the freedom to distribute copies of free software (and charge for
|
25 |
-
them if you wish), that you receive source code or can get it if you
|
26 |
-
want it, that you can change the software or use pieces of it in new
|
27 |
-
free programs, and that you know you can do these things.
|
28 |
-
|
29 |
-
To protect your rights, we need to prevent others from denying you
|
30 |
-
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
-
certain responsibilities if you distribute copies of the software, or if
|
32 |
-
you modify it: responsibilities to respect the freedom of others.
|
33 |
-
|
34 |
-
For example, if you distribute copies of such a program, whether
|
35 |
-
gratis or for a fee, you must pass on to the recipients the same
|
36 |
-
freedoms that you received. You must make sure that they, too, receive
|
37 |
-
or can get the source code. And you must show them these terms so they
|
38 |
-
know their rights.
|
39 |
-
|
40 |
-
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
-
(1) assert copyright on the software, and (2) offer you this License
|
42 |
-
giving you legal permission to copy, distribute and/or modify it.
|
43 |
-
|
44 |
-
For the developers' and authors' protection, the GPL clearly explains
|
45 |
-
that there is no warranty for this free software. For both users' and
|
46 |
-
authors' sake, the GPL requires that modified versions be marked as
|
47 |
-
changed, so that their problems will not be attributed erroneously to
|
48 |
-
authors of previous versions.
|
49 |
-
|
50 |
-
Some devices are designed to deny users access to install or run
|
51 |
-
modified versions of the software inside them, although the manufacturer
|
52 |
-
can do so. This is fundamentally incompatible with the aim of
|
53 |
-
protecting users' freedom to change the software. The systematic
|
54 |
-
pattern of such abuse occurs in the area of products for individuals to
|
55 |
-
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
-
have designed this version of the GPL to prohibit the practice for those
|
57 |
-
products. If such problems arise substantially in other domains, we
|
58 |
-
stand ready to extend this provision to those domains in future versions
|
59 |
-
of the GPL, as needed to protect the freedom of users.
|
60 |
-
|
61 |
-
Finally, every program is threatened constantly by software patents.
|
62 |
-
States should not allow patents to restrict development and use of
|
63 |
-
software on general-purpose computers, but in those that do, we wish to
|
64 |
-
avoid the special danger that patents applied to a free program could
|
65 |
-
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
-
patents cannot be used to render the program non-free.
|
67 |
-
|
68 |
-
The precise terms and conditions for copying, distribution and
|
69 |
-
modification follow.
|
70 |
-
|
71 |
-
TERMS AND CONDITIONS
|
72 |
-
|
73 |
-
0. Definitions.
|
74 |
-
|
75 |
-
"This License" refers to version 3 of the GNU General Public License.
|
76 |
-
|
77 |
-
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
-
works, such as semiconductor masks.
|
79 |
-
|
80 |
-
"The Program" refers to any copyrightable work licensed under this
|
81 |
-
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
-
"recipients" may be individuals or organizations.
|
83 |
-
|
84 |
-
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
-
in a fashion requiring copyright permission, other than the making of an
|
86 |
-
exact copy. The resulting work is called a "modified version" of the
|
87 |
-
earlier work or a work "based on" the earlier work.
|
88 |
-
|
89 |
-
A "covered work" means either the unmodified Program or a work based
|
90 |
-
on the Program.
|
91 |
-
|
92 |
-
To "propagate" a work means to do anything with it that, without
|
93 |
-
permission, would make you directly or secondarily liable for
|
94 |
-
infringement under applicable copyright law, except executing it on a
|
95 |
-
computer or modifying a private copy. Propagation includes copying,
|
96 |
-
distribution (with or without modification), making available to the
|
97 |
-
public, and in some countries other activities as well.
|
98 |
-
|
99 |
-
To "convey" a work means any kind of propagation that enables other
|
100 |
-
parties to make or receive copies. Mere interaction with a user through
|
101 |
-
a computer network, with no transfer of a copy, is not conveying.
|
102 |
-
|
103 |
-
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
-
to the extent that it includes a convenient and prominently visible
|
105 |
-
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
-
tells the user that there is no warranty for the work (except to the
|
107 |
-
extent that warranties are provided), that licensees may convey the
|
108 |
-
work under this License, and how to view a copy of this License. If
|
109 |
-
the interface presents a list of user commands or options, such as a
|
110 |
-
menu, a prominent item in the list meets this criterion.
|
111 |
-
|
112 |
-
1. Source Code.
|
113 |
-
|
114 |
-
The "source code" for a work means the preferred form of the work
|
115 |
-
for making modifications to it. "Object code" means any non-source
|
116 |
-
form of a work.
|
117 |
-
|
118 |
-
A "Standard Interface" means an interface that either is an official
|
119 |
-
standard defined by a recognized standards body, or, in the case of
|
120 |
-
interfaces specified for a particular programming language, one that
|
121 |
-
is widely used among developers working in that language.
|
122 |
-
|
123 |
-
The "System Libraries" of an executable work include anything, other
|
124 |
-
than the work as a whole, that (a) is included in the normal form of
|
125 |
-
packaging a Major Component, but which is not part of that Major
|
126 |
-
Component, and (b) serves only to enable use of the work with that
|
127 |
-
Major Component, or to implement a Standard Interface for which an
|
128 |
-
implementation is available to the public in source code form. A
|
129 |
-
"Major Component", in this context, means a major essential component
|
130 |
-
(kernel, window system, and so on) of the specific operating system
|
131 |
-
(if any) on which the executable work runs, or a compiler used to
|
132 |
-
produce the work, or an object code interpreter used to run it.
|
133 |
-
|
134 |
-
The "Corresponding Source" for a work in object code form means all
|
135 |
-
the source code needed to generate, install, and (for an executable
|
136 |
-
work) run the object code and to modify the work, including scripts to
|
137 |
-
control those activities. However, it does not include the work's
|
138 |
-
System Libraries, or general-purpose tools or generally available free
|
139 |
-
programs which are used unmodified in performing those activities but
|
140 |
-
which are not part of the work. For example, Corresponding Source
|
141 |
-
includes interface definition files associated with source files for
|
142 |
-
the work, and the source code for shared libraries and dynamically
|
143 |
-
linked subprograms that the work is specifically designed to require,
|
144 |
-
such as by intimate data communication or control flow between those
|
145 |
-
subprograms and other parts of the work.
|
146 |
-
|
147 |
-
The Corresponding Source need not include anything that users
|
148 |
-
can regenerate automatically from other parts of the Corresponding
|
149 |
-
Source.
|
150 |
-
|
151 |
-
The Corresponding Source for a work in source code form is that
|
152 |
-
same work.
|
153 |
-
|
154 |
-
2. Basic Permissions.
|
155 |
-
|
156 |
-
All rights granted under this License are granted for the term of
|
157 |
-
copyright on the Program, and are irrevocable provided the stated
|
158 |
-
conditions are met. This License explicitly affirms your unlimited
|
159 |
-
permission to run the unmodified Program. The output from running a
|
160 |
-
covered work is covered by this License only if the output, given its
|
161 |
-
content, constitutes a covered work. This License acknowledges your
|
162 |
-
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
-
|
164 |
-
You may make, run and propagate covered works that you do not
|
165 |
-
convey, without conditions so long as your license otherwise remains
|
166 |
-
in force. You may convey covered works to others for the sole purpose
|
167 |
-
of having them make modifications exclusively for you, or provide you
|
168 |
-
with facilities for running those works, provided that you comply with
|
169 |
-
the terms of this License in conveying all material for which you do
|
170 |
-
not control copyright. Those thus making or running the covered works
|
171 |
-
for you must do so exclusively on your behalf, under your direction
|
172 |
-
and control, on terms that prohibit them from making any copies of
|
173 |
-
your copyrighted material outside their relationship with you.
|
174 |
-
|
175 |
-
Conveying under any other circumstances is permitted solely under
|
176 |
-
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
-
makes it unnecessary.
|
178 |
-
|
179 |
-
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
-
|
181 |
-
No covered work shall be deemed part of an effective technological
|
182 |
-
measure under any applicable law fulfilling obligations under article
|
183 |
-
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
-
similar laws prohibiting or restricting circumvention of such
|
185 |
-
measures.
|
186 |
-
|
187 |
-
When you convey a covered work, you waive any legal power to forbid
|
188 |
-
circumvention of technological measures to the extent such circumvention
|
189 |
-
is effected by exercising rights under this License with respect to
|
190 |
-
the covered work, and you disclaim any intention to limit operation or
|
191 |
-
modification of the work as a means of enforcing, against the work's
|
192 |
-
users, your or third parties' legal rights to forbid circumvention of
|
193 |
-
technological measures.
|
194 |
-
|
195 |
-
4. Conveying Verbatim Copies.
|
196 |
-
|
197 |
-
You may convey verbatim copies of the Program's source code as you
|
198 |
-
receive it, in any medium, provided that you conspicuously and
|
199 |
-
appropriately publish on each copy an appropriate copyright notice;
|
200 |
-
keep intact all notices stating that this License and any
|
201 |
-
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
-
keep intact all notices of the absence of any warranty; and give all
|
203 |
-
recipients a copy of this License along with the Program.
|
204 |
-
|
205 |
-
You may charge any price or no price for each copy that you convey,
|
206 |
-
and you may offer support or warranty protection for a fee.
|
207 |
-
|
208 |
-
5. Conveying Modified Source Versions.
|
209 |
-
|
210 |
-
You may convey a work based on the Program, or the modifications to
|
211 |
-
produce it from the Program, in the form of source code under the
|
212 |
-
terms of section 4, provided that you also meet all of these conditions:
|
213 |
-
|
214 |
-
a) The work must carry prominent notices stating that you modified
|
215 |
-
it, and giving a relevant date.
|
216 |
-
|
217 |
-
b) The work must carry prominent notices stating that it is
|
218 |
-
released under this License and any conditions added under section
|
219 |
-
7. This requirement modifies the requirement in section 4 to
|
220 |
-
"keep intact all notices".
|
221 |
-
|
222 |
-
c) You must license the entire work, as a whole, under this
|
223 |
-
License to anyone who comes into possession of a copy. This
|
224 |
-
License will therefore apply, along with any applicable section 7
|
225 |
-
additional terms, to the whole of the work, and all its parts,
|
226 |
-
regardless of how they are packaged. This License gives no
|
227 |
-
permission to license the work in any other way, but it does not
|
228 |
-
invalidate such permission if you have separately received it.
|
229 |
-
|
230 |
-
d) If the work has interactive user interfaces, each must display
|
231 |
-
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
-
interfaces that do not display Appropriate Legal Notices, your
|
233 |
-
work need not make them do so.
|
234 |
-
|
235 |
-
A compilation of a covered work with other separate and independent
|
236 |
-
works, which are not by their nature extensions of the covered work,
|
237 |
-
and which are not combined with it such as to form a larger program,
|
238 |
-
in or on a volume of a storage or distribution medium, is called an
|
239 |
-
"aggregate" if the compilation and its resulting copyright are not
|
240 |
-
used to limit the access or legal rights of the compilation's users
|
241 |
-
beyond what the individual works permit. Inclusion of a covered work
|
242 |
-
in an aggregate does not cause this License to apply to the other
|
243 |
-
parts of the aggregate.
|
244 |
-
|
245 |
-
6. Conveying Non-Source Forms.
|
246 |
-
|
247 |
-
You may convey a covered work in object code form under the terms
|
248 |
-
of sections 4 and 5, provided that you also convey the
|
249 |
-
machine-readable Corresponding Source under the terms of this License,
|
250 |
-
in one of these ways:
|
251 |
-
|
252 |
-
a) Convey the object code in, or embodied in, a physical product
|
253 |
-
(including a physical distribution medium), accompanied by the
|
254 |
-
Corresponding Source fixed on a durable physical medium
|
255 |
-
customarily used for software interchange.
|
256 |
-
|
257 |
-
b) Convey the object code in, or embodied in, a physical product
|
258 |
-
(including a physical distribution medium), accompanied by a
|
259 |
-
written offer, valid for at least three years and valid for as
|
260 |
-
long as you offer spare parts or customer support for that product
|
261 |
-
model, to give anyone who possesses the object code either (1) a
|
262 |
-
copy of the Corresponding Source for all the software in the
|
263 |
-
product that is covered by this License, on a durable physical
|
264 |
-
medium customarily used for software interchange, for a price no
|
265 |
-
more than your reasonable cost of physically performing this
|
266 |
-
conveying of source, or (2) access to copy the
|
267 |
-
Corresponding Source from a network server at no charge.
|
268 |
-
|
269 |
-
c) Convey individual copies of the object code with a copy of the
|
270 |
-
written offer to provide the Corresponding Source. This
|
271 |
-
alternative is allowed only occasionally and noncommercially, and
|
272 |
-
only if you received the object code with such an offer, in accord
|
273 |
-
with subsection 6b.
|
274 |
-
|
275 |
-
d) Convey the object code by offering access from a designated
|
276 |
-
place (gratis or for a charge), and offer equivalent access to the
|
277 |
-
Corresponding Source in the same way through the same place at no
|
278 |
-
further charge. You need not require recipients to copy the
|
279 |
-
Corresponding Source along with the object code. If the place to
|
280 |
-
copy the object code is a network server, the Corresponding Source
|
281 |
-
may be on a different server (operated by you or a third party)
|
282 |
-
that supports equivalent copying facilities, provided you maintain
|
283 |
-
clear directions next to the object code saying where to find the
|
284 |
-
Corresponding Source. Regardless of what server hosts the
|
285 |
-
Corresponding Source, you remain obligated to ensure that it is
|
286 |
-
available for as long as needed to satisfy these requirements.
|
287 |
-
|
288 |
-
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
-
you inform other peers where the object code and Corresponding
|
290 |
-
Source of the work are being offered to the general public at no
|
291 |
-
charge under subsection 6d.
|
292 |
-
|
293 |
-
A separable portion of the object code, whose source code is excluded
|
294 |
-
from the Corresponding Source as a System Library, need not be
|
295 |
-
included in conveying the object code work.
|
296 |
-
|
297 |
-
A "User Product" is either (1) a "consumer product", which means any
|
298 |
-
tangible personal property which is normally used for personal, family,
|
299 |
-
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
-
into a dwelling. In determining whether a product is a consumer product,
|
301 |
-
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
-
product received by a particular user, "normally used" refers to a
|
303 |
-
typical or common use of that class of product, regardless of the status
|
304 |
-
of the particular user or of the way in which the particular user
|
305 |
-
actually uses, or expects or is expected to use, the product. A product
|
306 |
-
is a consumer product regardless of whether the product has substantial
|
307 |
-
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
-
the only significant mode of use of the product.
|
309 |
-
|
310 |
-
"Installation Information" for a User Product means any methods,
|
311 |
-
procedures, authorization keys, or other information required to install
|
312 |
-
and execute modified versions of a covered work in that User Product from
|
313 |
-
a modified version of its Corresponding Source. The information must
|
314 |
-
suffice to ensure that the continued functioning of the modified object
|
315 |
-
code is in no case prevented or interfered with solely because
|
316 |
-
modification has been made.
|
317 |
-
|
318 |
-
If you convey an object code work under this section in, or with, or
|
319 |
-
specifically for use in, a User Product, and the conveying occurs as
|
320 |
-
part of a transaction in which the right of possession and use of the
|
321 |
-
User Product is transferred to the recipient in perpetuity or for a
|
322 |
-
fixed term (regardless of how the transaction is characterized), the
|
323 |
-
Corresponding Source conveyed under this section must be accompanied
|
324 |
-
by the Installation Information. But this requirement does not apply
|
325 |
-
if neither you nor any third party retains the ability to install
|
326 |
-
modified object code on the User Product (for example, the work has
|
327 |
-
been installed in ROM).
|
328 |
-
|
329 |
-
The requirement to provide Installation Information does not include a
|
330 |
-
requirement to continue to provide support service, warranty, or updates
|
331 |
-
for a work that has been modified or installed by the recipient, or for
|
332 |
-
the User Product in which it has been modified or installed. Access to a
|
333 |
-
network may be denied when the modification itself materially and
|
334 |
-
adversely affects the operation of the network or violates the rules and
|
335 |
-
protocols for communication across the network.
|
336 |
-
|
337 |
-
Corresponding Source conveyed, and Installation Information provided,
|
338 |
-
in accord with this section must be in a format that is publicly
|
339 |
-
documented (and with an implementation available to the public in
|
340 |
-
source code form), and must require no special password or key for
|
341 |
-
unpacking, reading or copying.
|
342 |
-
|
343 |
-
7. Additional Terms.
|
344 |
-
|
345 |
-
"Additional permissions" are terms that supplement the terms of this
|
346 |
-
License by making exceptions from one or more of its conditions.
|
347 |
-
Additional permissions that are applicable to the entire Program shall
|
348 |
-
be treated as though they were included in this License, to the extent
|
349 |
-
that they are valid under applicable law. If additional permissions
|
350 |
-
apply only to part of the Program, that part may be used separately
|
351 |
-
under those permissions, but the entire Program remains governed by
|
352 |
-
this License without regard to the additional permissions.
|
353 |
-
|
354 |
-
When you convey a copy of a covered work, you may at your option
|
355 |
-
remove any additional permissions from that copy, or from any part of
|
356 |
-
it. (Additional permissions may be written to require their own
|
357 |
-
removal in certain cases when you modify the work.) You may place
|
358 |
-
additional permissions on material, added by you to a covered work,
|
359 |
-
for which you have or can give appropriate copyright permission.
|
360 |
-
|
361 |
-
Notwithstanding any other provision of this License, for material you
|
362 |
-
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
-
that material) supplement the terms of this License with terms:
|
364 |
-
|
365 |
-
a) Disclaiming warranty or limiting liability differently from the
|
366 |
-
terms of sections 15 and 16 of this License; or
|
367 |
-
|
368 |
-
b) Requiring preservation of specified reasonable legal notices or
|
369 |
-
author attributions in that material or in the Appropriate Legal
|
370 |
-
Notices displayed by works containing it; or
|
371 |
-
|
372 |
-
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
-
requiring that modified versions of such material be marked in
|
374 |
-
reasonable ways as different from the original version; or
|
375 |
-
|
376 |
-
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
-
authors of the material; or
|
378 |
-
|
379 |
-
e) Declining to grant rights under trademark law for use of some
|
380 |
-
trade names, trademarks, or service marks; or
|
381 |
-
|
382 |
-
f) Requiring indemnification of licensors and authors of that
|
383 |
-
material by anyone who conveys the material (or modified versions of
|
384 |
-
it) with contractual assumptions of liability to the recipient, for
|
385 |
-
any liability that these contractual assumptions directly impose on
|
386 |
-
those licensors and authors.
|
387 |
-
|
388 |
-
All other non-permissive additional terms are considered "further
|
389 |
-
restrictions" within the meaning of section 10. If the Program as you
|
390 |
-
received it, or any part of it, contains a notice stating that it is
|
391 |
-
governed by this License along with a term that is a further
|
392 |
-
restriction, you may remove that term. If a license document contains
|
393 |
-
a further restriction but permits relicensing or conveying under this
|
394 |
-
License, you may add to a covered work material governed by the terms
|
395 |
-
of that license document, provided that the further restriction does
|
396 |
-
not survive such relicensing or conveying.
|
397 |
-
|
398 |
-
If you add terms to a covered work in accord with this section, you
|
399 |
-
must place, in the relevant source files, a statement of the
|
400 |
-
additional terms that apply to those files, or a notice indicating
|
401 |
-
where to find the applicable terms.
|
402 |
-
|
403 |
-
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
-
form of a separately written license, or stated as exceptions;
|
405 |
-
the above requirements apply either way.
|
406 |
-
|
407 |
-
8. Termination.
|
408 |
-
|
409 |
-
You may not propagate or modify a covered work except as expressly
|
410 |
-
provided under this License. Any attempt otherwise to propagate or
|
411 |
-
modify it is void, and will automatically terminate your rights under
|
412 |
-
this License (including any patent licenses granted under the third
|
413 |
-
paragraph of section 11).
|
414 |
-
|
415 |
-
However, if you cease all violation of this License, then your
|
416 |
-
license from a particular copyright holder is reinstated (a)
|
417 |
-
provisionally, unless and until the copyright holder explicitly and
|
418 |
-
finally terminates your license, and (b) permanently, if the copyright
|
419 |
-
holder fails to notify you of the violation by some reasonable means
|
420 |
-
prior to 60 days after the cessation.
|
421 |
-
|
422 |
-
Moreover, your license from a particular copyright holder is
|
423 |
-
reinstated permanently if the copyright holder notifies you of the
|
424 |
-
violation by some reasonable means, this is the first time you have
|
425 |
-
received notice of violation of this License (for any work) from that
|
426 |
-
copyright holder, and you cure the violation prior to 30 days after
|
427 |
-
your receipt of the notice.
|
428 |
-
|
429 |
-
Termination of your rights under this section does not terminate the
|
430 |
-
licenses of parties who have received copies or rights from you under
|
431 |
-
this License. If your rights have been terminated and not permanently
|
432 |
-
reinstated, you do not qualify to receive new licenses for the same
|
433 |
-
material under section 10.
|
434 |
-
|
435 |
-
9. Acceptance Not Required for Having Copies.
|
436 |
-
|
437 |
-
You are not required to accept this License in order to receive or
|
438 |
-
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
-
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
-
to receive a copy likewise does not require acceptance. However,
|
441 |
-
nothing other than this License grants you permission to propagate or
|
442 |
-
modify any covered work. These actions infringe copyright if you do
|
443 |
-
not accept this License. Therefore, by modifying or propagating a
|
444 |
-
covered work, you indicate your acceptance of this License to do so.
|
445 |
-
|
446 |
-
10. Automatic Licensing of Downstream Recipients.
|
447 |
-
|
448 |
-
Each time you convey a covered work, the recipient automatically
|
449 |
-
receives a license from the original licensors, to run, modify and
|
450 |
-
propagate that work, subject to this License. You are not responsible
|
451 |
-
for enforcing compliance by third parties with this License.
|
452 |
-
|
453 |
-
An "entity transaction" is a transaction transferring control of an
|
454 |
-
organization, or substantially all assets of one, or subdividing an
|
455 |
-
organization, or merging organizations. If propagation of a covered
|
456 |
-
work results from an entity transaction, each party to that
|
457 |
-
transaction who receives a copy of the work also receives whatever
|
458 |
-
licenses to the work the party's predecessor in interest had or could
|
459 |
-
give under the previous paragraph, plus a right to possession of the
|
460 |
-
Corresponding Source of the work from the predecessor in interest, if
|
461 |
-
the predecessor has it or can get it with reasonable efforts.
|
462 |
-
|
463 |
-
You may not impose any further restrictions on the exercise of the
|
464 |
-
rights granted or affirmed under this License. For example, you may
|
465 |
-
not impose a license fee, royalty, or other charge for exercise of
|
466 |
-
rights granted under this License, and you may not initiate litigation
|
467 |
-
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
-
any patent claim is infringed by making, using, selling, offering for
|
469 |
-
sale, or importing the Program or any portion of it.
|
470 |
-
|
471 |
-
11. Patents.
|
472 |
-
|
473 |
-
A "contributor" is a copyright holder who authorizes use under this
|
474 |
-
License of the Program or a work on which the Program is based. The
|
475 |
-
work thus licensed is called the contributor's "contributor version".
|
476 |
-
|
477 |
-
A contributor's "essential patent claims" are all patent claims
|
478 |
-
owned or controlled by the contributor, whether already acquired or
|
479 |
-
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
-
by this License, of making, using, or selling its contributor version,
|
481 |
-
but do not include claims that would be infringed only as a
|
482 |
-
consequence of further modification of the contributor version. For
|
483 |
-
purposes of this definition, "control" includes the right to grant
|
484 |
-
patent sublicenses in a manner consistent with the requirements of
|
485 |
-
this License.
|
486 |
-
|
487 |
-
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
-
patent license under the contributor's essential patent claims, to
|
489 |
-
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
-
propagate the contents of its contributor version.
|
491 |
-
|
492 |
-
In the following three paragraphs, a "patent license" is any express
|
493 |
-
agreement or commitment, however denominated, not to enforce a patent
|
494 |
-
(such as an express permission to practice a patent or covenant not to
|
495 |
-
sue for patent infringement). To "grant" such a patent license to a
|
496 |
-
party means to make such an agreement or commitment not to enforce a
|
497 |
-
patent against the party.
|
498 |
-
|
499 |
-
If you convey a covered work, knowingly relying on a patent license,
|
500 |
-
and the Corresponding Source of the work is not available for anyone
|
501 |
-
to copy, free of charge and under the terms of this License, through a
|
502 |
-
publicly available network server or other readily accessible means,
|
503 |
-
then you must either (1) cause the Corresponding Source to be so
|
504 |
-
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
-
patent license for this particular work, or (3) arrange, in a manner
|
506 |
-
consistent with the requirements of this License, to extend the patent
|
507 |
-
license to downstream recipients. "Knowingly relying" means you have
|
508 |
-
actual knowledge that, but for the patent license, your conveying the
|
509 |
-
covered work in a country, or your recipient's use of the covered work
|
510 |
-
in a country, would infringe one or more identifiable patents in that
|
511 |
-
country that you have reason to believe are valid.
|
512 |
-
|
513 |
-
If, pursuant to or in connection with a single transaction or
|
514 |
-
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
-
covered work, and grant a patent license to some of the parties
|
516 |
-
receiving the covered work authorizing them to use, propagate, modify
|
517 |
-
or convey a specific copy of the covered work, then the patent license
|
518 |
-
you grant is automatically extended to all recipients of the covered
|
519 |
-
work and works based on it.
|
520 |
-
|
521 |
-
A patent license is "discriminatory" if it does not include within
|
522 |
-
the scope of its coverage, prohibits the exercise of, or is
|
523 |
-
conditioned on the non-exercise of one or more of the rights that are
|
524 |
-
specifically granted under this License. You may not convey a covered
|
525 |
-
work if you are a party to an arrangement with a third party that is
|
526 |
-
in the business of distributing software, under which you make payment
|
527 |
-
to the third party based on the extent of your activity of conveying
|
528 |
-
the work, and under which the third party grants, to any of the
|
529 |
-
parties who would receive the covered work from you, a discriminatory
|
530 |
-
patent license (a) in connection with copies of the covered work
|
531 |
-
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
-
for and in connection with specific products or compilations that
|
533 |
-
contain the covered work, unless you entered into that arrangement,
|
534 |
-
or that patent license was granted, prior to 28 March 2007.
|
535 |
-
|
536 |
-
Nothing in this License shall be construed as excluding or limiting
|
537 |
-
any implied license or other defenses to infringement that may
|
538 |
-
otherwise be available to you under applicable patent law.
|
539 |
-
|
540 |
-
12. No Surrender of Others' Freedom.
|
541 |
-
|
542 |
-
If conditions are imposed on you (whether by court order, agreement or
|
543 |
-
otherwise) that contradict the conditions of this License, they do not
|
544 |
-
excuse you from the conditions of this License. If you cannot convey a
|
545 |
-
covered work so as to satisfy simultaneously your obligations under this
|
546 |
-
License and any other pertinent obligations, then as a consequence you may
|
547 |
-
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
-
to collect a royalty for further conveying from those to whom you convey
|
549 |
-
the Program, the only way you could satisfy both those terms and this
|
550 |
-
License would be to refrain entirely from conveying the Program.
|
551 |
-
|
552 |
-
13. Use with the GNU Affero General Public License.
|
553 |
-
|
554 |
-
Notwithstanding any other provision of this License, you have
|
555 |
-
permission to link or combine any covered work with a work licensed
|
556 |
-
under version 3 of the GNU Affero General Public License into a single
|
557 |
-
combined work, and to convey the resulting work. The terms of this
|
558 |
-
License will continue to apply to the part which is the covered work,
|
559 |
-
but the special requirements of the GNU Affero General Public License,
|
560 |
-
section 13, concerning interaction through a network will apply to the
|
561 |
-
combination as such.
|
562 |
-
|
563 |
-
14. Revised Versions of this License.
|
564 |
-
|
565 |
-
The Free Software Foundation may publish revised and/or new versions of
|
566 |
-
the GNU General Public License from time to time. Such new versions will
|
567 |
-
be similar in spirit to the present version, but may differ in detail to
|
568 |
-
address new problems or concerns.
|
569 |
-
|
570 |
-
Each version is given a distinguishing version number. If the
|
571 |
-
Program specifies that a certain numbered version of the GNU General
|
572 |
-
Public License "or any later version" applies to it, you have the
|
573 |
-
option of following the terms and conditions either of that numbered
|
574 |
-
version or of any later version published by the Free Software
|
575 |
-
Foundation. If the Program does not specify a version number of the
|
576 |
-
GNU General Public License, you may choose any version ever published
|
577 |
-
by the Free Software Foundation.
|
578 |
-
|
579 |
-
If the Program specifies that a proxy can decide which future
|
580 |
-
versions of the GNU General Public License can be used, that proxy's
|
581 |
-
public statement of acceptance of a version permanently authorizes you
|
582 |
-
to choose that version for the Program.
|
583 |
-
|
584 |
-
Later license versions may give you additional or different
|
585 |
-
permissions. However, no additional obligations are imposed on any
|
586 |
-
author or copyright holder as a result of your choosing to follow a
|
587 |
-
later version.
|
588 |
-
|
589 |
-
15. Disclaimer of Warranty.
|
590 |
-
|
591 |
-
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
-
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
-
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
-
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
-
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
-
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
-
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
-
|
600 |
-
16. Limitation of Liability.
|
601 |
-
|
602 |
-
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
-
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
-
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
-
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
-
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
-
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
-
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
-
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
-
SUCH DAMAGES.
|
611 |
-
|
612 |
-
17. Interpretation of Sections 15 and 16.
|
613 |
-
|
614 |
-
If the disclaimer of warranty and limitation of liability provided
|
615 |
-
above cannot be given local legal effect according to their terms,
|
616 |
-
reviewing courts shall apply local law that most closely approximates
|
617 |
-
an absolute waiver of all civil liability in connection with the
|
618 |
-
Program, unless a warranty or assumption of liability accompanies a
|
619 |
-
copy of the Program in return for a fee.
|
620 |
-
|
621 |
-
END OF TERMS AND CONDITIONS
|
622 |
-
|
623 |
-
How to Apply These Terms to Your New Programs
|
624 |
-
|
625 |
-
If you develop a new program, and you want it to be of the greatest
|
626 |
-
possible use to the public, the best way to achieve this is to make it
|
627 |
-
free software which everyone can redistribute and change under these terms.
|
628 |
-
|
629 |
-
To do so, attach the following notices to the program. It is safest
|
630 |
-
to attach them to the start of each source file to most effectively
|
631 |
-
state the exclusion of warranty; and each file should have at least
|
632 |
-
the "copyright" line and a pointer to where the full notice is found.
|
633 |
-
|
634 |
-
Disqus WordPress Plugin
|
635 |
-
Copyright (C) 2010 DISQUS
|
636 |
-
|
637 |
-
This program is free software: you can redistribute it and/or modify
|
638 |
-
it under the terms of the GNU General Public License as published by
|
639 |
-
the Free Software Foundation, either version 3 of the License, or
|
640 |
-
(at your option) any later version.
|
641 |
-
|
642 |
-
This program is distributed in the hope that it will be useful,
|
643 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
-
GNU General Public License for more details.
|
646 |
-
|
647 |
-
You should have received a copy of the GNU General Public License
|
648 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
649 |
-
|
650 |
-
Also add information on how to contact you by electronic and paper mail.
|
651 |
-
|
652 |
-
If the program does terminal interaction, make it output a short
|
653 |
-
notice like this when it starts in an interactive mode:
|
654 |
-
|
655 |
-
Disqus WordPress Plugin Copyright (C) 2010 DISQUS
|
656 |
-
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
-
This is free software, and you are welcome to redistribute it
|
658 |
-
under certain conditions; type `show c' for details.
|
659 |
-
|
660 |
-
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
-
parts of the General Public License. Of course, your program's commands
|
662 |
-
might be different; for a GUI interface, you would use an "about box".
|
663 |
-
|
664 |
-
You should also get your employer (if you work as a programmer) or school,
|
665 |
-
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
-
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
-
<http://www.gnu.org/licenses/>.
|
668 |
-
|
669 |
-
The GNU General Public License does not permit incorporating your program
|
670 |
-
into proprietary programs. If your program is a subroutine library, you
|
671 |
-
may consider it more useful to permit linking proprietary applications with
|
672 |
-
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
-
Public License instead of this License. But first, please read
|
674 |
-
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/comments.php
DELETED
@@ -1,134 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (DISQUS_DEBUG) {
|
3 |
-
echo "<p><strong>Disqus Debug</strong> thread_id: ".get_post_meta($post->ID, 'dsq_thread_id', true)."</p>";
|
4 |
-
}
|
5 |
-
?>
|
6 |
-
|
7 |
-
<div id="disqus_thread">
|
8 |
-
<?php if (!get_option('disqus_disable_ssr') && have_comments()): ?>
|
9 |
-
<?php
|
10 |
-
// if (is_file(TEMPLATEPATH . '/comments.php')) {
|
11 |
-
// include(TEMPLATEPATH . '/comments.php');
|
12 |
-
// }
|
13 |
-
?>
|
14 |
-
<div id="dsq-content">
|
15 |
-
|
16 |
-
<?php if (get_comment_pages_count() > 1 && get_option('page_comments')): // Are there comments to navigate through? ?>
|
17 |
-
<div class="navigation">
|
18 |
-
<div class="nav-previous"><?php previous_comments_link(dsq_i( '<span class="meta-nav">←</span> Older Comments')); ?></div>
|
19 |
-
<div class="nav-next"><?php next_comments_link(dsq_i('Newer Comments <span class="meta-nav">→</span>')); ?></div>
|
20 |
-
</div> <!-- .navigation -->
|
21 |
-
<?php endif; // check for comment navigation ?>
|
22 |
-
|
23 |
-
<ul id="dsq-comments">
|
24 |
-
<?php
|
25 |
-
/* Loop through and list the comments. Tell wp_list_comments()
|
26 |
-
* to use dsq_comment() to format the comments.
|
27 |
-
*/
|
28 |
-
wp_list_comments(array('callback' => 'dsq_comment'));
|
29 |
-
?>
|
30 |
-
</ul>
|
31 |
-
|
32 |
-
<?php if (get_comment_pages_count() > 1 && get_option('page_comments')): // Are there comments to navigate through? ?>
|
33 |
-
<div class="navigation">
|
34 |
-
<div class="nav-previous"><?php previous_comments_link(dsq_i( '<span class="meta-nav">←</span> Older Comments')); ?></div>
|
35 |
-
<div class="nav-next"><?php next_comments_link(dsq_i( 'Newer Comments <span class="meta-nav">→</span>')); ?></div>
|
36 |
-
</div><!-- .navigation -->
|
37 |
-
<?php endif; // check for comment navigation ?>
|
38 |
-
|
39 |
-
</div>
|
40 |
-
|
41 |
-
<?php endif; ?>
|
42 |
-
</div>
|
43 |
-
|
44 |
-
<script type="text/javascript">
|
45 |
-
/* <![CDATA[ */
|
46 |
-
var disqus_url = '<?php echo get_permalink(); ?>';
|
47 |
-
var disqus_identifier = '<?php echo dsq_identifier_for_post($post); ?>';
|
48 |
-
var disqus_container_id = 'disqus_thread';
|
49 |
-
var disqus_domain = '<?php echo DISQUS_DOMAIN; ?>';
|
50 |
-
var disqus_shortname = '<?php echo strtolower(get_option('disqus_forum_url')); ?>';
|
51 |
-
var disqus_title = <?php echo cf_json_encode(dsq_title_for_post($post)); ?>;
|
52 |
-
var disqus_config = function () {
|
53 |
-
var config = this; // Access to the config object
|
54 |
-
config.language = '<?php echo esc_js(apply_filters('disqus_language_filter', '')) ?>';
|
55 |
-
|
56 |
-
/* Add the ability to add javascript callbacks */
|
57 |
-
<?php do_action( 'disqus_config' ); ?>
|
58 |
-
|
59 |
-
/*
|
60 |
-
All currently supported events:
|
61 |
-
* preData — fires just before we request for initial data
|
62 |
-
* preInit - fires after we get initial data but before we load any dependencies
|
63 |
-
* onInit - fires when all dependencies are resolved but before dtpl template is rendered
|
64 |
-
* afterRender - fires when template is rendered but before we show it
|
65 |
-
* onReady - everything is done
|
66 |
-
*/
|
67 |
-
|
68 |
-
config.callbacks.preData.push(function() {
|
69 |
-
// clear out the container (its filled for SEO/legacy purposes)
|
70 |
-
document.getElementById(disqus_container_id).innerHTML = '';
|
71 |
-
});
|
72 |
-
<?php if (!get_option('disqus_manual_sync')): ?>
|
73 |
-
config.callbacks.onReady.push(function() {
|
74 |
-
// sync comments in the background so we don't block the page
|
75 |
-
var script = document.createElement('script');
|
76 |
-
script.async = true;
|
77 |
-
script.src = '?cf_action=sync_comments&post_id=<?php echo $post->ID; ?>';
|
78 |
-
|
79 |
-
var firstScript = document.getElementsByTagName( "script" )[0];
|
80 |
-
firstScript.parentNode.insertBefore(script, firstScript);
|
81 |
-
});
|
82 |
-
<?php endif; ?>
|
83 |
-
<?php
|
84 |
-
$sso = dsq_sso();
|
85 |
-
if ($sso) {
|
86 |
-
foreach ($sso as $k=>$v) {
|
87 |
-
echo "this.page.{$k} = '{$v}';\n";
|
88 |
-
}
|
89 |
-
echo dsq_sso_login();
|
90 |
-
}
|
91 |
-
?>
|
92 |
-
};
|
93 |
-
/* ]]> */
|
94 |
-
</script>
|
95 |
-
|
96 |
-
<script type="text/javascript">
|
97 |
-
/* <![CDATA[ */
|
98 |
-
var DsqLocal = {
|
99 |
-
'trackbacks': [
|
100 |
-
<?php
|
101 |
-
$count = 0;
|
102 |
-
foreach ((array)$comments as $comment) {
|
103 |
-
$comment_type = get_comment_type();
|
104 |
-
if ( $comment_type != 'comment' ) {
|
105 |
-
if( $count ) { echo ','; }
|
106 |
-
?>
|
107 |
-
{
|
108 |
-
'author_name': <?php echo cf_json_encode(get_comment_author()); ?>,
|
109 |
-
'author_url': <?php echo cf_json_encode(get_comment_author_url()); ?>,
|
110 |
-
'date': <?php echo cf_json_encode(get_comment_date('m/d/Y h:i A')); ?>,
|
111 |
-
'excerpt': <?php echo cf_json_encode(str_replace(array("\r\n", "\n", "\r"), '<br />', get_comment_excerpt())); ?>,
|
112 |
-
'type': <?php echo cf_json_encode($comment_type); ?>
|
113 |
-
}
|
114 |
-
<?php
|
115 |
-
$count++;
|
116 |
-
}
|
117 |
-
}
|
118 |
-
?>
|
119 |
-
],
|
120 |
-
'trackback_url': <?php echo cf_json_encode(get_trackback_url()); ?>
|
121 |
-
};
|
122 |
-
/* ]]> */
|
123 |
-
</script>
|
124 |
-
|
125 |
-
<script type="text/javascript">
|
126 |
-
/* <![CDATA[ */
|
127 |
-
(function() {
|
128 |
-
var dsq = document.createElement('script'); dsq.type = 'text/javascript';
|
129 |
-
dsq.async = true;
|
130 |
-
dsq.src = '//' + disqus_shortname + '.' + '<?php echo DISQUS_DOMAIN; ?>' + '/' + 'embed' + '.js' + '?pname=wordpress&pver=<?php echo DISQUS_VERSION; ?>';
|
131 |
-
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
132 |
-
})();
|
133 |
-
/* ]]> */
|
134 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/disqus.php
DELETED
@@ -1,1583 +0,0 @@
|
|
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.76
|
8 |
-
Author URI: http://disqus.com/
|
9 |
-
*/
|
10 |
-
|
11 |
-
/*.
|
12 |
-
require_module 'standard';
|
13 |
-
require_module 'pcre';
|
14 |
-
require_module 'mysql';
|
15 |
-
.*/
|
16 |
-
|
17 |
-
require_once(dirname(__FILE__) . '/lib/wp-api.php');
|
18 |
-
|
19 |
-
if (defined('DISQUS_LOCAL')) { // DISQUS defines this for local development purposes
|
20 |
-
define('DISQUS_DOMAIN', 'dev.disqus.org:8000');
|
21 |
-
define('DISQUS_IMPORTER_URL', 'http://dev.disqus.org:8001/');
|
22 |
-
} else {
|
23 |
-
define('DISQUS_DOMAIN', 'disqus.com');
|
24 |
-
define('DISQUS_IMPORTER_URL', 'https://import.disqus.com/');
|
25 |
-
}
|
26 |
-
define('DISQUS_URL', 'http://' . DISQUS_DOMAIN . '/');
|
27 |
-
define('DISQUS_MEDIA_URL', 'http://' . DISQUS_DOMAIN . '/media/');
|
28 |
-
define('DISQUS_API_URL', 'http://' . DISQUS_DOMAIN . '/api/');
|
29 |
-
define('DISQUS_RSS_PATH', '/latest.rss');
|
30 |
-
define('DISQUS_CAN_EXPORT', is_file(dirname(__FILE__) . '/export.php'));
|
31 |
-
if (!defined('DISQUS_DEBUG')) {
|
32 |
-
define('DISQUS_DEBUG', false);
|
33 |
-
}
|
34 |
-
define('DISQUS_VERSION', '2.76');
|
35 |
-
define('DISQUS_SYNC_TIMEOUT', 30);
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Returns an array of all option identifiers used by DISQUS.
|
39 |
-
* @return array[int]string
|
40 |
-
*/
|
41 |
-
function dsq_options() {
|
42 |
-
return array(
|
43 |
-
'_disqus_sync_lock',
|
44 |
-
'_disqus_sync_post_ids',
|
45 |
-
# render disqus in the embed
|
46 |
-
'disqus_active',
|
47 |
-
'disqus_forum_url',
|
48 |
-
'disqus_api_key',
|
49 |
-
'disqus_user_api_key',
|
50 |
-
'disqus_replace',
|
51 |
-
'disqus_cc_fix',
|
52 |
-
# SSO features
|
53 |
-
'disqus_partner_key',
|
54 |
-
'disqus_public_key',
|
55 |
-
'disqus_secret_key',
|
56 |
-
'disqus_sso_button',
|
57 |
-
'disqus_sso_icon',
|
58 |
-
# disables automatic sync via cron
|
59 |
-
'disqus_manual_sync',
|
60 |
-
# disables server side rendering
|
61 |
-
'disqus_disable_ssr',
|
62 |
-
# the last sync comment id (from get_forum_posts)
|
63 |
-
'disqus_last_comment_id',
|
64 |
-
'disqus_version',
|
65 |
-
);
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* @param string $file
|
70 |
-
* @return string
|
71 |
-
*/
|
72 |
-
function dsq_plugin_basename($file) {
|
73 |
-
$file = dirname($file);
|
74 |
-
|
75 |
-
// From WP2.5 wp-includes/plugin.php:plugin_basename()
|
76 |
-
$file = str_replace('\\','/',$file); // sanitize for Win32 installs
|
77 |
-
$file = preg_replace('|/+|','/', $file); // remove any duplicate slash
|
78 |
-
$file = preg_replace('|^.*/' . PLUGINDIR . '/|','',$file); // get relative path from plugins dir
|
79 |
-
|
80 |
-
if ( strstr($file, '/') === false ) {
|
81 |
-
return $file;
|
82 |
-
}
|
83 |
-
|
84 |
-
$pieces = explode('/', $file);
|
85 |
-
return !empty($pieces[count($pieces)-1]) ? $pieces[count($pieces)-1] : $pieces[count($pieces)-2];
|
86 |
-
}
|
87 |
-
|
88 |
-
if ( !defined('PLUGINDIR') ) {
|
89 |
-
define('PLUGINDIR', 'wp-content/plugins'); // Relative to ABSPATH. For back compat.
|
90 |
-
}
|
91 |
-
|
92 |
-
$mt_disqus_version = '2.01';
|
93 |
-
/**
|
94 |
-
* Response from Disqus get_thread API call for comments template.
|
95 |
-
*
|
96 |
-
* @global string $dsq_response
|
97 |
-
* @since 1.0
|
98 |
-
*/
|
99 |
-
$dsq_response = '';
|
100 |
-
/**
|
101 |
-
* Disqus API instance.
|
102 |
-
*
|
103 |
-
* @global string $dsq_api
|
104 |
-
* @since 1.0
|
105 |
-
*/
|
106 |
-
$dsq_api = new DisqusWordPressAPI(get_option('disqus_forum_url'), get_option('disqus_api_key'));
|
107 |
-
|
108 |
-
/**
|
109 |
-
* DISQUS currently unsupported dev toggle to output comments for this query.
|
110 |
-
*
|
111 |
-
* @global bool $DSQ_QUERY_COMMENTS
|
112 |
-
* @since ?
|
113 |
-
*/
|
114 |
-
$DSQ_QUERY_COMMENTS = false;
|
115 |
-
|
116 |
-
/**
|
117 |
-
* DISQUS array to store post_ids from WP_Query for comment JS output.
|
118 |
-
*
|
119 |
-
* @global array $DSQ_QUERY_POST_IDS
|
120 |
-
* @since 2.2
|
121 |
-
*/
|
122 |
-
$DSQ_QUERY_POST_IDS = array();
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Helper functions.
|
126 |
-
*/
|
127 |
-
|
128 |
-
/**
|
129 |
-
* Tests if required options are configured to display the Disqus embed.
|
130 |
-
* @return bool
|
131 |
-
*/
|
132 |
-
function dsq_is_installed() {
|
133 |
-
return get_option('disqus_forum_url') && get_option('disqus_api_key');
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* @return bool
|
138 |
-
*/
|
139 |
-
function dsq_can_replace() {
|
140 |
-
global $id, $post;
|
141 |
-
|
142 |
-
if (get_option('disqus_active') === '0'){ return false; }
|
143 |
-
|
144 |
-
$replace = get_option('disqus_replace');
|
145 |
-
|
146 |
-
if ( is_feed() ) { return false; }
|
147 |
-
if ( !isset($post) ) { return false; }
|
148 |
-
if ( 'draft' == $post->post_status ) { return false; }
|
149 |
-
if ( !get_option('disqus_forum_url') ) { return false; }
|
150 |
-
else if ( 'all' == $replace ) { return true; }
|
151 |
-
|
152 |
-
if ( !isset($post->comment_count) ) {
|
153 |
-
$num_comments = 0;
|
154 |
-
} else {
|
155 |
-
if ( 'empty' == $replace ) {
|
156 |
-
// Only get count of comments, not including pings.
|
157 |
-
|
158 |
-
// If there are comments, make sure there are comments (that are not track/pingbacks)
|
159 |
-
if ( $post->comment_count > 0 ) {
|
160 |
-
// Yuck, this causes a DB query for each post. This can be
|
161 |
-
// replaced with a lighter query, but this is still not optimal.
|
162 |
-
$comments = get_approved_comments($post->ID);
|
163 |
-
foreach ( $comments as $comment ) {
|
164 |
-
if ( $comment->comment_type != 'trackback' && $comment->comment_type != 'pingback' ) {
|
165 |
-
$num_comments++;
|
166 |
-
}
|
167 |
-
}
|
168 |
-
} else {
|
169 |
-
$num_comments = 0;
|
170 |
-
}
|
171 |
-
}
|
172 |
-
else {
|
173 |
-
$num_comments = $post->comment_count;
|
174 |
-
}
|
175 |
-
}
|
176 |
-
|
177 |
-
return ( ('empty' == $replace && 0 == $num_comments)
|
178 |
-
|| ('closed' == $replace && 'closed' == $post->comment_status) );
|
179 |
-
}
|
180 |
-
|
181 |
-
function dsq_manage_dialog($message, $error = false) {
|
182 |
-
global $wp_version;
|
183 |
-
|
184 |
-
echo '<div '
|
185 |
-
. ( $error ? 'id="disqus_warning" ' : '')
|
186 |
-
. 'class="updated fade'
|
187 |
-
. ( (version_compare($wp_version, '2.5', '<') && $error) ? '-ff0000' : '' )
|
188 |
-
. '"><p><strong>'
|
189 |
-
. $message
|
190 |
-
. '</strong></p></div>';
|
191 |
-
}
|
192 |
-
|
193 |
-
function dsq_sync_comments($comments) {
|
194 |
-
global $wpdb;
|
195 |
-
|
196 |
-
// user MUST be logged out during this process
|
197 |
-
wp_set_current_user(0);
|
198 |
-
|
199 |
-
// we need the thread_ids so we can map them to posts
|
200 |
-
$thread_map = array();
|
201 |
-
foreach ( $comments as $comment ) {
|
202 |
-
$thread_map[$comment->thread->id] = null;
|
203 |
-
}
|
204 |
-
$thread_ids = "'" . implode("', '", array_keys($thread_map)) . "'";
|
205 |
-
|
206 |
-
$results = $wpdb->get_results( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = 'dsq_thread_id' AND meta_value IN ({$thread_ids}) LIMIT 1");
|
207 |
-
foreach ( $results as $result ) {
|
208 |
-
$thread_map[$result->meta_value] = $result->post_id;
|
209 |
-
}
|
210 |
-
unset($result);
|
211 |
-
|
212 |
-
foreach ( $comments as $comment ) {
|
213 |
-
$ts = strtotime($comment->created_at);
|
214 |
-
if (!$thread_map[$comment->thread->id] && !empty($comment->thread->identifier)) {
|
215 |
-
// legacy threads dont already have their meta stored
|
216 |
-
foreach ( $comment->thread->identifier as $identifier ) {
|
217 |
-
// we know identifier starts with post_ID
|
218 |
-
if ($post_ID = (int)substr($identifier, 0, strpos($identifier, ' '))) {
|
219 |
-
$thread_map[$comment->thread->id] = $post_ID;
|
220 |
-
update_post_meta($post_ID, 'dsq_thread_id', $comment->thread->id);
|
221 |
-
if (DISQUS_DEBUG) {
|
222 |
-
echo "updated post {$post_ID}: dsq_thread_id set to {$comment->thread->id}\n";
|
223 |
-
}
|
224 |
-
}
|
225 |
-
}
|
226 |
-
unset($identifier);
|
227 |
-
}
|
228 |
-
if (!$thread_map[$comment->thread->id]) {
|
229 |
-
// shouldn't ever happen, but we can't be certain
|
230 |
-
if (DISQUS_DEBUG) {
|
231 |
-
if (!empty($comment->thread->identifier)) {
|
232 |
-
$idents = implode(', ', $comment->thread->identifier);
|
233 |
-
echo "skipped {$comment->id}: missing thread for identifiers ({$idents})\n";
|
234 |
-
} else {
|
235 |
-
echo "skipped {$comment->id}: missing thread (no identifier)\n";
|
236 |
-
}
|
237 |
-
}
|
238 |
-
continue;
|
239 |
-
}
|
240 |
-
$results = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = 'dsq_post_id' AND meta_value = %s LIMIT 1", $comment->id));
|
241 |
-
if (count($results)) {
|
242 |
-
// already exists
|
243 |
-
if (DISQUS_DEBUG) {
|
244 |
-
echo "skipped {$comment->id}: comment already exists\n";
|
245 |
-
}
|
246 |
-
if (count($results) > 1) {
|
247 |
-
// clean up duplicates -- fixes an issue where a race condition allowed comments to be synced multiple times
|
248 |
-
$results = array_slice($results, 1);
|
249 |
-
foreach ($results as $result) {
|
250 |
-
$wpdb->prepare("DELETE FROM $wpdb->commentmeta WHERE comment_id = %s LIMIT 1", $result);
|
251 |
-
}
|
252 |
-
}
|
253 |
-
continue;
|
254 |
-
}
|
255 |
-
|
256 |
-
$commentdata = false;
|
257 |
-
|
258 |
-
// first lets check by the id we have stored
|
259 |
-
if ($comment->meta) {
|
260 |
-
$meta = explode(';', $comment->meta);
|
261 |
-
foreach ($meta as $value) {
|
262 |
-
$value = explode('=', $value);
|
263 |
-
$meta[$value[0]] = $value[1];
|
264 |
-
}
|
265 |
-
unset($value);
|
266 |
-
if ($meta['wp_id']) {
|
267 |
-
$commentdata = $wpdb->get_row($wpdb->prepare( "SELECT comment_ID, comment_parent FROM $wpdb->comments WHERE comment_ID = %s LIMIT 1", $meta['wp_id']), ARRAY_A);
|
268 |
-
}
|
269 |
-
}
|
270 |
-
|
271 |
-
// skip comments that were imported but are missing meta information
|
272 |
-
if (!$commentdata && $comment->imported) {
|
273 |
-
if (DISQUS_DEBUG) {
|
274 |
-
echo "skipped {$comment->id}: comment not found and marked as imported\n";
|
275 |
-
}
|
276 |
-
continue;
|
277 |
-
}
|
278 |
-
|
279 |
-
// and follow up using legacy Disqus agent
|
280 |
-
if (!$commentdata) {
|
281 |
-
$commentdata = $wpdb->get_row($wpdb->prepare( "SELECT comment_ID, comment_parent FROM $wpdb->comments WHERE comment_agent = %s LIMIT 1", 'Disqus/1.0:'.$comment->id), ARRAY_A);
|
282 |
-
}
|
283 |
-
if (!$commentdata) {
|
284 |
-
// Comment doesnt exist yet, lets insert it
|
285 |
-
if ($comment->status == 'approved') {
|
286 |
-
$approved = 1;
|
287 |
-
} elseif ($comment->status == 'spam') {
|
288 |
-
$approved = 'spam';
|
289 |
-
} else {
|
290 |
-
$approved = 0;
|
291 |
-
}
|
292 |
-
$commentdata = array(
|
293 |
-
'comment_post_ID' => $thread_map[$comment->thread->id],
|
294 |
-
'comment_date' => date('Y-m-d\TH:i:s', strtotime($comment->created_at) + (get_option('gmt_offset') * 3600)),
|
295 |
-
'comment_date_gmt' => $comment->created_at,
|
296 |
-
'comment_content' => apply_filters('pre_comment_content', $comment->message),
|
297 |
-
'comment_approved' => $approved,
|
298 |
-
'comment_agent' => 'Disqus/1.1('.DISQUS_VERSION.'):'.intval($comment->id),
|
299 |
-
'comment_type' => '',
|
300 |
-
);
|
301 |
-
if ($comment->is_anonymous) {
|
302 |
-
$commentdata['comment_author'] = $comment->anonymous_author->name;
|
303 |
-
$commentdata['comment_author_email'] = $comment->anonymous_author->email;
|
304 |
-
$commentdata['comment_author_url'] = $comment->anonymous_author->url;
|
305 |
-
$commentdata['comment_author_IP'] = $comment->ip_address;
|
306 |
-
} else {
|
307 |
-
if (!empty($comment->author->display_name)) {
|
308 |
-
$commentdata['comment_author'] = $comment->author->display_name;
|
309 |
-
} else {
|
310 |
-
$commentdata['comment_author'] = $comment->author->username;
|
311 |
-
}
|
312 |
-
$commentdata['comment_author_email'] = $comment->author->email;
|
313 |
-
$commentdata['comment_author_url'] = $comment->author->url;
|
314 |
-
$commentdata['comment_author_IP'] = $comment->ip_address;
|
315 |
-
}
|
316 |
-
$commentdata = wp_filter_comment($commentdata);
|
317 |
-
if ($comment->parent_post) {
|
318 |
-
$parent_id = $wpdb->get_var($wpdb->prepare( "SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = 'dsq_post_id' AND meta_value = %s LIMIT 1", $comment->parent_post));
|
319 |
-
if ($parent_id) {
|
320 |
-
$commentdata['comment_parent'] = $parent_id;
|
321 |
-
}
|
322 |
-
}
|
323 |
-
|
324 |
-
// due to a race condition we need to test again for coment existance
|
325 |
-
if ($wpdb->get_row($wpdb->prepare( "SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = 'dsq_post_id' AND meta_value = %s LIMIT 1", $comment->id))) {
|
326 |
-
// already exists
|
327 |
-
if (DISQUS_DEBUG) {
|
328 |
-
echo "skipped {$comment->id}: comment already exists (second check)\n";
|
329 |
-
}
|
330 |
-
continue;
|
331 |
-
}
|
332 |
-
|
333 |
-
$commentdata['comment_ID'] = wp_insert_comment($commentdata);
|
334 |
-
if (DISQUS_DEBUG) {
|
335 |
-
echo "inserted {$comment->id}: id is {$commentdata[comment_ID]}\n";
|
336 |
-
}
|
337 |
-
}
|
338 |
-
if (!$commentdata['comment_parent'] && $comment->parent_post) {
|
339 |
-
$parent_id = $wpdb->get_var($wpdb->prepare( "SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = 'dsq_post_id' AND meta_value = %s LIMIT 1", $comment->parent_post));
|
340 |
-
if ($parent_id) {
|
341 |
-
$wpdb->query($wpdb->prepare( "UPDATE $wpdb->comments SET comment_parent = %s WHERE comment_id = %s", $parent_id, $commentdata['comment_ID']));
|
342 |
-
if (DISQUS_DEBUG) {
|
343 |
-
echo "updated {$comment->id}: comment_parent changed to {$parent_id}\n";
|
344 |
-
}
|
345 |
-
|
346 |
-
}
|
347 |
-
}
|
348 |
-
$comment_id = $commentdata['comment_ID'];
|
349 |
-
update_comment_meta($comment_id, 'dsq_parent_post_id', $comment->parent_post);
|
350 |
-
update_comment_meta($comment_id, 'dsq_post_id', $comment->id);
|
351 |
-
}
|
352 |
-
unset($comment);
|
353 |
-
|
354 |
-
if( isset($_POST['dsq_api_key']) && $_POST['dsq_api_key'] == get_option('disqus_api_key') ) {
|
355 |
-
if( isset($_GET['dsq_sync_action']) && isset($_GET['dsq_sync_comment_id']) ) {
|
356 |
-
$comment_parts = explode('=', $_GET['dsq_sync_comment_id']);
|
357 |
-
|
358 |
-
if (!($comment_id = intval($comment_parts[1])) > 0) {
|
359 |
-
return;
|
360 |
-
}
|
361 |
-
|
362 |
-
if( 'wp_id' != $comment_parts[0] ) {
|
363 |
-
$comment_id = $wpdb->get_var($wpdb->prepare('SELECT comment_ID FROM ' . $wpdb->comments . ' WHERE comment_post_ID = %d AND comment_agent LIKE %s', intval($post->ID), 'Disqus/1.0:' . $comment_id));
|
364 |
-
}
|
365 |
-
|
366 |
-
switch( $_GET['dsq_sync_action'] ) {
|
367 |
-
case 'mark_spam':
|
368 |
-
wp_set_comment_status($comment_id, 'spam');
|
369 |
-
echo "<!-- dsq_sync: wp_set_comment_status($comment_id, 'spam') -->";
|
370 |
-
break;
|
371 |
-
case 'mark_approved':
|
372 |
-
wp_set_comment_status($comment_id, 'approve');
|
373 |
-
echo "<!-- dsq_sync: wp_set_comment_status($comment_id, 'approve') -->";
|
374 |
-
break;
|
375 |
-
case 'mark_killed':
|
376 |
-
wp_set_comment_status($comment_id, 'hold');
|
377 |
-
echo "<!-- dsq_sync: wp_set_comment_status($comment_id, 'hold') -->";
|
378 |
-
break;
|
379 |
-
}
|
380 |
-
}
|
381 |
-
}
|
382 |
-
}
|
383 |
-
|
384 |
-
function dsq_request_handler() {
|
385 |
-
global $dsq_response;
|
386 |
-
global $dsq_api;
|
387 |
-
global $post;
|
388 |
-
global $wpdb;
|
389 |
-
|
390 |
-
if (!empty($_GET['cf_action'])) {
|
391 |
-
switch ($_GET['cf_action']) {
|
392 |
-
case 'sync_comments':
|
393 |
-
if( !( $post_id = $_GET['post_id'] ) ) {
|
394 |
-
header("HTTP/1.0 400 Bad Request");
|
395 |
-
die();
|
396 |
-
}
|
397 |
-
// schedule the event for 5 minutes from now in case they
|
398 |
-
// happen to make a quick post
|
399 |
-
dsq_add_pending_post_id($post_id);
|
400 |
-
|
401 |
-
if (DISQUS_DEBUG) {
|
402 |
-
$response = dsq_sync_forum();
|
403 |
-
if (!$response) {
|
404 |
-
die('// error: '.$dsq_api->get_last_error());
|
405 |
-
} else {
|
406 |
-
list($last_comment_id, $comments) = $response;
|
407 |
-
die('// synced '.$comments.' comments');
|
408 |
-
}
|
409 |
-
} else {
|
410 |
-
$ts = time() + 300;
|
411 |
-
wp_schedule_single_event($ts, 'dsq_sync_forum');
|
412 |
-
die('// sync scheduled');
|
413 |
-
}
|
414 |
-
break;
|
415 |
-
case 'export_comments':
|
416 |
-
if (current_user_can('manage_options') && DISQUS_CAN_EXPORT) {
|
417 |
-
$timestamp = intval($_GET['timestamp']);
|
418 |
-
$post_id = intval($_GET['post_id']);
|
419 |
-
global $wpdb, $dsq_api;
|
420 |
-
$post = $wpdb->get_results($wpdb->prepare("
|
421 |
-
SELECT *
|
422 |
-
FROM $wpdb->posts
|
423 |
-
WHERE post_type != 'revision'
|
424 |
-
AND post_status = 'publish'
|
425 |
-
AND comment_count > 0
|
426 |
-
AND ID > %d
|
427 |
-
ORDER BY ID ASC
|
428 |
-
LIMIT 1
|
429 |
-
", $post_id));
|
430 |
-
$post = $post[0];
|
431 |
-
$post_id = $post->ID;
|
432 |
-
$max_post_id = $wpdb->get_var($wpdb->prepare("
|
433 |
-
SELECT MAX(ID)
|
434 |
-
FROM $wpdb->posts
|
435 |
-
WHERE post_type != 'revision'
|
436 |
-
AND post_status = 'publish'
|
437 |
-
AND comment_count > 0
|
438 |
-
", $post_id));
|
439 |
-
$eof = (int)($post_id == $max_post_id);
|
440 |
-
if ($eof) {
|
441 |
-
$status = 'complete';
|
442 |
-
$msg = dsq_i('Your comments have been sent to Disqus and queued for import!<br/><a href="'.DISQUS_IMPORTER_URL.'" target="_blank">See the status of your import at Disqus</a>');
|
443 |
-
}
|
444 |
-
else {
|
445 |
-
$status = 'partial';
|
446 |
-
$msg = dsq_i('Processed comments on post #%s…', $post_id);
|
447 |
-
}
|
448 |
-
$result = 'fail';
|
449 |
-
$response = null;
|
450 |
-
if ($post) {
|
451 |
-
require_once(dirname(__FILE__) . '/export.php');
|
452 |
-
$wxr = dsq_export_wp($post);
|
453 |
-
$response = $dsq_api->import_wordpress_comments($wxr, $timestamp, $eof);
|
454 |
-
if (!($response['group_id'] > 0)) {
|
455 |
-
$result = 'fail';
|
456 |
-
$msg = '<p class="status dsq-export-fail">'. dsq_i('Sorry, something unexpected happened with the export. Please <a href="#" id="dsq_export_retry">try again</a></p><p>If your API key has changed, you may need to reinstall Disqus (deactivate the plugin and then reactivate it). If you are still having issues, refer to the <a href="%s" onclick="window.open(this.href); return false">WordPress help page</a>.', 'http://disqus.com/help/wordpress'). '</p>';
|
457 |
-
$response = $dsq_api->get_last_error();
|
458 |
-
}
|
459 |
-
else {
|
460 |
-
if ($eof) {
|
461 |
-
$msg = dsq_i('Your comments have been sent to Disqus and queued for import!<br/><a href="%s" target="_blank">See the status of your import at Disqus</a>', $response['link']);
|
462 |
-
|
463 |
-
}
|
464 |
-
$result = 'success';
|
465 |
-
}
|
466 |
-
}
|
467 |
-
// send AJAX response
|
468 |
-
$response = compact('result', 'timestamp', 'status', 'post_id', 'msg', 'eof', 'response');
|
469 |
-
header('Content-type: text/javascript');
|
470 |
-
echo cf_json_encode($response);
|
471 |
-
die();
|
472 |
-
}
|
473 |
-
break;
|
474 |
-
case 'import_comments':
|
475 |
-
if (current_user_can('manage_options')) {
|
476 |
-
if (!isset($_GET['last_comment_id'])) $last_comment_id = false;
|
477 |
-
else $last_comment_id = $_GET['last_comment_id'];
|
478 |
-
|
479 |
-
if ($_GET['wipe'] == '1') {
|
480 |
-
$wpdb->query("DELETE FROM `".$wpdb->prefix."commentmeta` WHERE meta_key IN ('dsq_post_id', 'dsq_parent_post_id')");
|
481 |
-
$wpdb->query("DELETE FROM `".$wpdb->prefix."comments` WHERE comment_agent LIKE 'Disqus/%%'");
|
482 |
-
}
|
483 |
-
|
484 |
-
ob_start();
|
485 |
-
$response = dsq_sync_forum($last_comment_id, true);
|
486 |
-
$debug = ob_get_clean();
|
487 |
-
if (!$response) {
|
488 |
-
$status = 'error';
|
489 |
-
$result = 'fail';
|
490 |
-
$error = $dsq_api->get_last_error();
|
491 |
-
$msg = '<p class="status dsq-export-fail">'.dsq_i('There was an error downloading your comments from Disqus.').'<br/>'.htmlspecialchars($error).'</p>';
|
492 |
-
} else {
|
493 |
-
list($comments, $last_comment_id) = $response;
|
494 |
-
if (!$comments) {
|
495 |
-
$status = 'complete';
|
496 |
-
$msg = dsq_i('Your comments have been downloaded from Disqus and saved in your local database.');
|
497 |
-
} else {
|
498 |
-
$status = 'partial';
|
499 |
-
$msg = dsq_i('Import in progress (last post id: %s) …', $last_comment_id);
|
500 |
-
}
|
501 |
-
$result = 'success';
|
502 |
-
}
|
503 |
-
$debug = explode("\n", $debug);
|
504 |
-
$response = compact('result', 'status', 'comments', 'msg', 'last_comment_id', 'debug');
|
505 |
-
header('Content-type: text/javascript');
|
506 |
-
echo cf_json_encode($response);
|
507 |
-
die();
|
508 |
-
}
|
509 |
-
break;
|
510 |
-
}
|
511 |
-
}
|
512 |
-
}
|
513 |
-
|
514 |
-
add_action('init', 'dsq_request_handler');
|
515 |
-
|
516 |
-
/**
|
517 |
-
* @param string $option_name
|
518 |
-
*/
|
519 |
-
function dsq_image_upload_handler($option_name) {
|
520 |
-
// If the upload field has a file in it
|
521 |
-
if(isset($_FILES[$option_name]) && ($_FILES[$option_name]['size'] > 0)) {
|
522 |
-
// Get the type of the uploaded file. This is returned as "type/extension"
|
523 |
-
$arr_file_type = wp_check_filetype(basename($_FILES[$option_name]['name']));
|
524 |
-
$uploaded_file_type = $arr_file_type['type'];
|
525 |
-
// Set an array containing a list of acceptable formats
|
526 |
-
$allowed_file_types = array('image/jpg','image/jpeg','image/gif','image/png','image/x-icon');
|
527 |
-
// If the uploaded file is the right format
|
528 |
-
if(in_array($uploaded_file_type, $allowed_file_types)) {
|
529 |
-
// Options array for the wp_handle_upload function. 'test_upload' => false
|
530 |
-
$upload_overrides = array( 'test_form' => false );
|
531 |
-
// Handle the upload using WP's wp_handle_upload function. Takes the posted file and an options array
|
532 |
-
$uploaded_file = wp_handle_upload($_FILES[$option_name], $upload_overrides);
|
533 |
-
// If the wp_handle_upload call returned a local path for the image
|
534 |
-
if(isset($uploaded_file['url'])) {
|
535 |
-
update_option($option_name, $uploaded_file['url']);
|
536 |
-
}
|
537 |
-
}
|
538 |
-
}
|
539 |
-
}
|
540 |
-
|
541 |
-
function dsq_add_pending_post_id($post_id) {
|
542 |
-
update_post_meta($post_id, 'dsq_needs_sync', '1', $unique=true);
|
543 |
-
}
|
544 |
-
|
545 |
-
function dsq_get_pending_post_ids() {
|
546 |
-
global $wpdb;
|
547 |
-
|
548 |
-
$results = $wpdb->get_results( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = 'dsq_needs_sync'");
|
549 |
-
$post_ids = array();
|
550 |
-
foreach ($results as $result) {
|
551 |
-
$post_ids[] = $result->post_id;
|
552 |
-
}
|
553 |
-
return $post_ids;
|
554 |
-
}
|
555 |
-
|
556 |
-
function dsq_clear_pending_post_ids($post_ids) {
|
557 |
-
global $wpdb;
|
558 |
-
|
559 |
-
$post_ids_query = "'" . implode("', '", $post_ids) . "'";
|
560 |
-
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE meta_key = 'dsq_needs_sync' AND post_id IN ({$post_ids_query})");
|
561 |
-
|
562 |
-
update_meta_cache('dsq_needs_sync', $post_ids);
|
563 |
-
}
|
564 |
-
|
565 |
-
|
566 |
-
function dsq_sync_post($post_id) {
|
567 |
-
global $dsq_api, $wpdb;
|
568 |
-
|
569 |
-
$post = get_post($post_id);
|
570 |
-
|
571 |
-
// Call update_thread to ensure our permalink is up to date
|
572 |
-
dsq_update_permalink($post);
|
573 |
-
}
|
574 |
-
|
575 |
-
function dsq_sync_forum($last_comment_id=false, $force=false) {
|
576 |
-
global $dsq_api, $wpdb;
|
577 |
-
|
578 |
-
set_time_limit(DISQUS_SYNC_TIMEOUT);
|
579 |
-
|
580 |
-
if ($force) {
|
581 |
-
$sync_time = null;
|
582 |
-
} else {
|
583 |
-
$sync_time = (int)get_option('_disqus_sync_lock');
|
584 |
-
}
|
585 |
-
|
586 |
-
// lock expires after 1 hour
|
587 |
-
if ($sync_time && $sync_time > time() - 60*60) {
|
588 |
-
$dsq_api->api->last_error = 'Sync already in progress (lock found)';
|
589 |
-
return false;
|
590 |
-
} else {
|
591 |
-
update_option('_disqus_sync_lock', time());
|
592 |
-
}
|
593 |
-
|
594 |
-
// sync all pending posts
|
595 |
-
$post_ids = dsq_get_pending_post_ids();
|
596 |
-
dsq_clear_pending_post_ids($post_ids);
|
597 |
-
|
598 |
-
foreach ($post_ids as $post_id) {
|
599 |
-
dsq_sync_post($post_id);
|
600 |
-
}
|
601 |
-
|
602 |
-
if ($last_comment_id === false) {
|
603 |
-
$last_comment_id = get_option('disqus_last_comment_id');
|
604 |
-
if (!$last_comment_id) {
|
605 |
-
$last_comment_id = 0;
|
606 |
-
}
|
607 |
-
}
|
608 |
-
if ($last_comment_id) {
|
609 |
-
$last_comment_id++;
|
610 |
-
}
|
611 |
-
|
612 |
-
//$last_comment_id = 0;
|
613 |
-
|
614 |
-
// Pull comments from API
|
615 |
-
$dsq_response = $dsq_api->get_forum_posts($last_comment_id);
|
616 |
-
if( $dsq_response < 0 || $dsq_response === false ) {
|
617 |
-
return false;
|
618 |
-
}
|
619 |
-
|
620 |
-
// Sync comments with database.
|
621 |
-
dsq_sync_comments($dsq_response);
|
622 |
-
$total = 0;
|
623 |
-
if ($dsq_response) {
|
624 |
-
foreach ($dsq_response as $comment) {
|
625 |
-
$total += 1;
|
626 |
-
if ($comment->id > $last_comment_id) $last_comment_id = $comment->id;
|
627 |
-
}
|
628 |
-
if ($last_comment_id > get_option('disqus_last_comment_id')) {
|
629 |
-
update_option('disqus_last_comment_id', $last_comment_id);
|
630 |
-
}
|
631 |
-
}
|
632 |
-
unset($comment);
|
633 |
-
delete_option('_disqus_sync_lock');
|
634 |
-
return array($total, $last_comment_id);
|
635 |
-
}
|
636 |
-
|
637 |
-
add_action('dsq_sync_forum', 'dsq_sync_forum');
|
638 |
-
|
639 |
-
function dsq_update_permalink($post) {
|
640 |
-
global $dsq_api;
|
641 |
-
|
642 |
-
if (DISQUS_DEBUG) {
|
643 |
-
echo "updating post on disqus: {$post->ID}\n";
|
644 |
-
}
|
645 |
-
|
646 |
-
$response = $dsq_api->api->update_thread(null, array(
|
647 |
-
'thread_identifier' => dsq_identifier_for_post($post),
|
648 |
-
'title' => dsq_title_for_post($post),
|
649 |
-
'url' => dsq_link_for_post($post)
|
650 |
-
));
|
651 |
-
|
652 |
-
update_post_meta($post->ID, 'dsq_thread_id', $response->id);
|
653 |
-
|
654 |
-
return $response;
|
655 |
-
}
|
656 |
-
|
657 |
-
/**
|
658 |
-
* Compatibility
|
659 |
-
*/
|
660 |
-
|
661 |
-
if (!function_exists ( '_wp_specialchars' ) ) {
|
662 |
-
function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
|
663 |
-
$string = (string) $string;
|
664 |
-
|
665 |
-
if ( 0 === strlen( $string ) ) {
|
666 |
-
return '';
|
667 |
-
}
|
668 |
-
|
669 |
-
// Don't bother if there are no specialchars - saves some processing
|
670 |
-
if ( !preg_match( '/[&<>"\']/', $string ) ) {
|
671 |
-
return $string;
|
672 |
-
}
|
673 |
-
|
674 |
-
// Account for the previous behaviour of the function when the $quote_style is not an accepted value
|
675 |
-
if ( empty( $quote_style ) ) {
|
676 |
-
$quote_style = ENT_NOQUOTES;
|
677 |
-
} elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
|
678 |
-
$quote_style = ENT_QUOTES;
|
679 |
-
}
|
680 |
-
|
681 |
-
// Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
|
682 |
-
if ( !$charset ) {
|
683 |
-
static $_charset;
|
684 |
-
if ( !isset( $_charset ) ) {
|
685 |
-
$alloptions = wp_load_alloptions();
|
686 |
-
$_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : '';
|
687 |
-
}
|
688 |
-
$charset = $_charset;
|
689 |
-
}
|
690 |
-
if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) ) {
|
691 |
-
$charset = 'UTF-8';
|
692 |
-
}
|
693 |
-
|
694 |
-
$_quote_style = $quote_style;
|
695 |
-
|
696 |
-
if ( $quote_style === 'double' ) {
|
697 |
-
$quote_style = ENT_COMPAT;
|
698 |
-
$_quote_style = ENT_COMPAT;
|
699 |
-
} elseif ( $quote_style === 'single' ) {
|
700 |
-
$quote_style = ENT_NOQUOTES;
|
701 |
-
}
|
702 |
-
|
703 |
-
// Handle double encoding ourselves
|
704 |
-
if ( !$double_encode ) {
|
705 |
-
$string = wp_specialchars_decode( $string, $_quote_style );
|
706 |
-
$string = preg_replace( '/&(#?x?[0-9a-z]+);/i', '|wp_entity|$1|/wp_entity|', $string );
|
707 |
-
}
|
708 |
-
|
709 |
-
$string = @htmlspecialchars( $string, $quote_style, $charset );
|
710 |
-
|
711 |
-
// Handle double encoding ourselves
|
712 |
-
if ( !$double_encode ) {
|
713 |
-
$string = str_replace( array( '|wp_entity|', '|/wp_entity|' ), array( '&', ';' ), $string );
|
714 |
-
}
|
715 |
-
|
716 |
-
// Backwards compatibility
|
717 |
-
if ( 'single' === $_quote_style ) {
|
718 |
-
$string = str_replace( "'", ''', $string );
|
719 |
-
}
|
720 |
-
|
721 |
-
return $string;
|
722 |
-
}
|
723 |
-
}
|
724 |
-
|
725 |
-
if (!function_exists ( 'wp_check_invalid_utf8' ) ) {
|
726 |
-
function wp_check_invalid_utf8( $string, $strip = false ) {
|
727 |
-
$string = (string) $string;
|
728 |
-
|
729 |
-
if ( 0 === strlen( $string ) ) {
|
730 |
-
return '';
|
731 |
-
}
|
732 |
-
|
733 |
-
// Store the site charset as a static to avoid multiple calls to get_option()
|
734 |
-
static $is_utf8;
|
735 |
-
if ( !isset( $is_utf8 ) ) {
|
736 |
-
$is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) );
|
737 |
-
}
|
738 |
-
if ( !$is_utf8 ) {
|
739 |
-
return $string;
|
740 |
-
}
|
741 |
-
|
742 |
-
// Check for support for utf8 in the installed PCRE library once and store the result in a static
|
743 |
-
static $utf8_pcre;
|
744 |
-
if ( !isset( $utf8_pcre ) ) {
|
745 |
-
$utf8_pcre = @preg_match( '/^./u', 'a' );
|
746 |
-
}
|
747 |
-
// We can't demand utf8 in the PCRE installation, so just return the string in those cases
|
748 |
-
if ( !$utf8_pcre ) {
|
749 |
-
return $string;
|
750 |
-
}
|
751 |
-
|
752 |
-
// preg_match fails when it encounters invalid UTF8 in $string
|
753 |
-
if ( 1 === @preg_match( '/^./us', $string ) ) {
|
754 |
-
return $string;
|
755 |
-
}
|
756 |
-
|
757 |
-
// Attempt to strip the bad chars if requested (not recommended)
|
758 |
-
if ( $strip && function_exists( 'iconv' ) ) {
|
759 |
-
return iconv( 'utf-8', 'utf-8', $string );
|
760 |
-
}
|
761 |
-
|
762 |
-
return '';
|
763 |
-
}
|
764 |
-
}
|
765 |
-
|
766 |
-
if (!function_exists ( 'esc_html' ) ) {
|
767 |
-
function esc_html( $text ) {
|
768 |
-
$safe_text = wp_check_invalid_utf8( $text );
|
769 |
-
$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
|
770 |
-
return apply_filters( 'esc_html', $safe_text, $text );
|
771 |
-
}
|
772 |
-
}
|
773 |
-
|
774 |
-
if (!function_exists ( 'esc_attr' ) ) {
|
775 |
-
function esc_attr( $text ) {
|
776 |
-
$safe_text = wp_check_invalid_utf8( $text );
|
777 |
-
$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
|
778 |
-
return apply_filters( 'attribute_escape', $safe_text, $text );
|
779 |
-
}
|
780 |
-
}
|
781 |
-
|
782 |
-
/**
|
783 |
-
* Filters/Actions
|
784 |
-
*/
|
785 |
-
|
786 |
-
// ugly global hack for comments closing
|
787 |
-
$EMBED = false;
|
788 |
-
function dsq_comments_template($value) {
|
789 |
-
global $EMBED;
|
790 |
-
global $post;
|
791 |
-
global $comments;
|
792 |
-
|
793 |
-
if ( !( is_singular() && ( have_comments() || 'open' == $post->comment_status ) ) ) {
|
794 |
-
return;
|
795 |
-
}
|
796 |
-
|
797 |
-
if ( !dsq_is_installed() || !dsq_can_replace() ) {
|
798 |
-
return $value;
|
799 |
-
}
|
800 |
-
|
801 |
-
// TODO: If a disqus-comments.php is found in the current template's
|
802 |
-
// path, use that instead of the default bundled comments.php
|
803 |
-
//return TEMPLATEPATH . '/disqus-comments.php';
|
804 |
-
$EMBED = true;
|
805 |
-
return dirname(__FILE__) . '/comments.php';
|
806 |
-
}
|
807 |
-
|
808 |
-
function dsq_comment( $comment, $args, $depth ) {
|
809 |
-
$GLOBALS['comment'] = $comment;
|
810 |
-
switch ($comment->comment_type):
|
811 |
-
case '' :
|
812 |
-
?>
|
813 |
-
<li <?php comment_class(); ?> id="dsq-comment-<?php echo comment_ID(); ?>">
|
814 |
-
<div id="dsq-comment-header-<?php echo comment_ID(); ?>" class="dsq-comment-header">
|
815 |
-
<cite id="dsq-cite-<?php echo comment_ID(); ?>">
|
816 |
-
<?php if(comment_author_url()) : ?>
|
817 |
-
<a id="dsq-author-user-<?php echo comment_ID(); ?>" href="<?php echo comment_author_url(); ?>" target="_blank" rel="nofollow"><?php echo comment_author(); ?></a>
|
818 |
-
<?php else : ?>
|
819 |
-
<span id="dsq-author-user-<?php echo comment_ID(); ?>"><?php echo comment_author(); ?></span>
|
820 |
-
<?php endif; ?>
|
821 |
-
</cite>
|
822 |
-
</div>
|
823 |
-
<div id="dsq-comment-body-<?php echo comment_ID(); ?>" class="dsq-comment-body">
|
824 |
-
<div id="dsq-comment-message-<?php echo comment_ID(); ?>" class="dsq-comment-message"><?php echo wp_filter_kses(comment_text()); ?></div>
|
825 |
-
</div>
|
826 |
-
|
827 |
-
<?php
|
828 |
-
break;
|
829 |
-
case 'pingback' :
|
830 |
-
case 'trackback' :
|
831 |
-
?>
|
832 |
-
<li class="post pingback">
|
833 |
-
<p><?php echo dsq_i('Pingback:'); ?> <?php comment_author_link(); ?><?php edit_comment_link(dsq_i('(Edit)'), ' '); ?></p>
|
834 |
-
</li>
|
835 |
-
<?php
|
836 |
-
break;
|
837 |
-
endswitch;
|
838 |
-
}
|
839 |
-
|
840 |
-
// Mark entries in index to replace comments link.
|
841 |
-
// As of WordPress 3.1 this is required to return a numerical value
|
842 |
-
function dsq_comments_number($count) {
|
843 |
-
global $post;
|
844 |
-
|
845 |
-
return $count;
|
846 |
-
}
|
847 |
-
|
848 |
-
function dsq_comments_text($comment_text) {
|
849 |
-
global $post;
|
850 |
-
|
851 |
-
if ( dsq_can_replace() ) {
|
852 |
-
return '<span class="dsq-postid" rel="'.htmlspecialchars(dsq_identifier_for_post($post)).'">'.$comment_text.'</span>';
|
853 |
-
} else {
|
854 |
-
return $comment_text;
|
855 |
-
}
|
856 |
-
}
|
857 |
-
|
858 |
-
function dsq_bloginfo_url($url) {
|
859 |
-
if ( get_feed_link('comments_rss2') == $url && dsq_can_replace() ) {
|
860 |
-
return 'https://' . strtolower(get_option('disqus_forum_url')) . '.' . DISQUS_DOMAIN . DISQUS_RSS_PATH;
|
861 |
-
} else {
|
862 |
-
return $url;
|
863 |
-
}
|
864 |
-
}
|
865 |
-
|
866 |
-
function dsq_plugin_action_links($links, $file) {
|
867 |
-
$plugin_file = basename(__FILE__);
|
868 |
-
if (basename($file) == $plugin_file) {
|
869 |
-
if (!dsq_is_installed()) {
|
870 |
-
$settings_link = '<a href="edit-comments.php?page=disqus">'.dsq_i('Configure').'</a>';
|
871 |
-
} else {
|
872 |
-
$settings_link = '<a href="edit-comments.php?page=disqus#adv">'.dsq_i('Settings').'</a>';
|
873 |
-
}
|
874 |
-
array_unshift($links, $settings_link);
|
875 |
-
}
|
876 |
-
return $links;
|
877 |
-
}
|
878 |
-
add_filter('plugin_action_links', 'dsq_plugin_action_links', 10, 2);
|
879 |
-
|
880 |
-
/**
|
881 |
-
* Hide the default comment form to stop spammers by marking all comments
|
882 |
-
* as closed.
|
883 |
-
*/
|
884 |
-
function dsq_comments_open($open, $post_id=null) {
|
885 |
-
global $EMBED;
|
886 |
-
if ($EMBED) return false;
|
887 |
-
return $open;
|
888 |
-
}
|
889 |
-
add_filter('comments_open', 'dsq_comments_open');
|
890 |
-
|
891 |
-
// Always add Disqus management page to the admin menu
|
892 |
-
function dsq_add_pages() {
|
893 |
-
add_submenu_page(
|
894 |
-
'edit-comments.php',
|
895 |
-
'Disqus',
|
896 |
-
'Disqus',
|
897 |
-
'moderate_comments',
|
898 |
-
'disqus',
|
899 |
-
'dsq_manage'
|
900 |
-
);
|
901 |
-
}
|
902 |
-
add_action('admin_menu', 'dsq_add_pages', 10);
|
903 |
-
|
904 |
-
// a little jQuery goodness to get comments menu working as desired
|
905 |
-
function dsq_menu_admin_head() {
|
906 |
-
?>
|
907 |
-
<script type="text/javascript">
|
908 |
-
jQuery(function($) {
|
909 |
-
// fix menu
|
910 |
-
var mc = $('#menu-comments');
|
911 |
-
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'));
|
912 |
-
// fix admin bar
|
913 |
-
$('#wp-admin-bar-comments').find('a.ab-item').attr('href', 'edit-comments.php?page=disqus');
|
914 |
-
});
|
915 |
-
</script>
|
916 |
-
<?php
|
917 |
-
}
|
918 |
-
add_action('admin_head', 'dsq_menu_admin_head');
|
919 |
-
|
920 |
-
// only active on dashboard
|
921 |
-
function dsq_dash_comment_counts() {
|
922 |
-
global $wpdb;
|
923 |
-
// taken from wp-includes/comment.php - WP 2.8.5
|
924 |
-
$count = $wpdb->get_results("
|
925 |
-
SELECT comment_approved, COUNT( * ) AS num_comments
|
926 |
-
FROM {$wpdb->comments}
|
927 |
-
WHERE comment_type != 'trackback'
|
928 |
-
AND comment_type != 'pingback'
|
929 |
-
GROUP BY comment_approved
|
930 |
-
", ARRAY_A );
|
931 |
-
$total = 0;
|
932 |
-
$approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
|
933 |
-
$known_types = array_keys( $approved );
|
934 |
-
foreach( (array) $count as $row_num => $row ) {
|
935 |
-
$total += $row['num_comments'];
|
936 |
-
if ( in_array( $row['comment_approved'], $known_types ) && array_key_exists($row['comment_approved'], $approved) )
|
937 |
-
$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
|
938 |
-
}
|
939 |
-
|
940 |
-
$stats['total_comments'] = $total;
|
941 |
-
foreach ( $approved as $key ) {
|
942 |
-
if ( empty($stats[$key]) )
|
943 |
-
$stats[$key] = 0;
|
944 |
-
}
|
945 |
-
$stats = (object) $stats;
|
946 |
-
?>
|
947 |
-
<script type="text/javascript">
|
948 |
-
jQuery(function($) {
|
949 |
-
$('#dashboard_right_now').find('.b-comments a').html('<?php echo number_format($stats->total_comments); ?>').end().find('.b_approved a').html('<?php echo number_format($stats->approved); ?>').end().find('.b-waiting a').html('<?php echo number_format($stats->moderated); ?>').end().find('.b-spam a').html('<?php echo number_format($stats->spam); ?>');
|
950 |
-
$('#dashboard_recent_comments div.trackback').remove();
|
951 |
-
$('#dashboard_right_now .inside table td.last a, #dashboard_recent_comments .inside .textright a.button').attr('href', 'edit-comments.php?page=disqus');
|
952 |
-
});
|
953 |
-
</script>
|
954 |
-
<?php
|
955 |
-
}
|
956 |
-
function dsq_wp_dashboard_setup() {
|
957 |
-
add_action('admin_head', 'dsq_dash_comment_counts');
|
958 |
-
}
|
959 |
-
add_action('wp_dashboard_setup', 'dsq_wp_dashboard_setup');
|
960 |
-
|
961 |
-
function dsq_manage() {
|
962 |
-
if (dsq_does_need_update() && isset($_POST['upgrade'])) {
|
963 |
-
dsq_install();
|
964 |
-
}
|
965 |
-
|
966 |
-
if (dsq_does_need_update() && !isset($_POST['reset'])) {
|
967 |
-
include_once(dirname(__FILE__) . '/upgrade.php');
|
968 |
-
} else {
|
969 |
-
include_once(dirname(__FILE__) . '/manage.php');
|
970 |
-
}
|
971 |
-
}
|
972 |
-
|
973 |
-
function dsq_admin_head() {
|
974 |
-
if (isset($_GET['page']) && $_GET['page'] == 'disqus') {
|
975 |
-
?>
|
976 |
-
<link rel='stylesheet' href='<?php echo plugins_url( 'media/styles/manage.css', __FILE__ ); ?>' type='text/css' />
|
977 |
-
<style type="text/css">
|
978 |
-
.dsq-importing, .dsq-imported, .dsq-import-fail, .dsq-exporting, .dsq-exported, .dsq-export-fail {
|
979 |
-
background: url(<?php echo admin_url('images/loading.gif'); ?>) left center no-repeat;
|
980 |
-
line-height: 16px;
|
981 |
-
padding-left: 20px;
|
982 |
-
}
|
983 |
-
p.status {
|
984 |
-
padding-top: 0;
|
985 |
-
padding-bottom: 0;
|
986 |
-
margin: 0;
|
987 |
-
}
|
988 |
-
.dsq-imported, .dsq-exported {
|
989 |
-
background: url(<?php echo admin_url('images/yes.png'); ?>) left center no-repeat;
|
990 |
-
}
|
991 |
-
.dsq-import-fail, .dsq-export-fail {
|
992 |
-
background: url(<?php echo admin_url('images/no.png'); ?>) left center no-repeat;
|
993 |
-
}
|
994 |
-
</style>
|
995 |
-
<script type="text/javascript">
|
996 |
-
jQuery(function($) {
|
997 |
-
$('#dsq-tabs li').click(function() {
|
998 |
-
$('#dsq-tabs li.selected').removeClass('selected');
|
999 |
-
$(this).addClass('selected');
|
1000 |
-
$('.dsq-main, .dsq-advanced').hide();
|
1001 |
-
$('.' + $(this).attr('rel')).show();
|
1002 |
-
});
|
1003 |
-
if (location.href.indexOf('#adv') != -1) {
|
1004 |
-
$('#dsq-tab-advanced').click();
|
1005 |
-
}
|
1006 |
-
dsq_fire_export();
|
1007 |
-
dsq_fire_import();
|
1008 |
-
});
|
1009 |
-
dsq_fire_export = function() {
|
1010 |
-
var $ = jQuery;
|
1011 |
-
$('#dsq_export a.button, #dsq_export_retry').unbind().click(function() {
|
1012 |
-
$('#dsq_export').html('<p class="status"></p>');
|
1013 |
-
$('#dsq_export .status').removeClass('dsq-export-fail').addClass('dsq-exporting').html('Processing...');
|
1014 |
-
dsq_export_comments();
|
1015 |
-
return false;
|
1016 |
-
});
|
1017 |
-
}
|
1018 |
-
dsq_export_comments = function() {
|
1019 |
-
var $ = jQuery;
|
1020 |
-
var status = $('#dsq_export .status');
|
1021 |
-
var export_info = (status.attr('rel') || '0|' + (new Date().getTime()/1000)).split('|');
|
1022 |
-
$.get(
|
1023 |
-
'<?php echo admin_url('index.php'); ?>',
|
1024 |
-
{
|
1025 |
-
cf_action: 'export_comments',
|
1026 |
-
post_id: export_info[0],
|
1027 |
-
timestamp: export_info[1]
|
1028 |
-
},
|
1029 |
-
function(response) {
|
1030 |
-
switch (response.result) {
|
1031 |
-
case 'success':
|
1032 |
-
status.html(response.msg).attr('rel', response.post_id + '|' + response.timestamp);
|
1033 |
-
switch (response.status) {
|
1034 |
-
case 'partial':
|
1035 |
-
dsq_export_comments();
|
1036 |
-
break;
|
1037 |
-
case 'complete':
|
1038 |
-
status.removeClass('dsq-exporting').addClass('dsq-exported');
|
1039 |
-
break;
|
1040 |
-
}
|
1041 |
-
break;
|
1042 |
-
case 'fail':
|
1043 |
-
status.parent().html(response.msg);
|
1044 |
-
dsq_fire_export();
|
1045 |
-
break;
|
1046 |
-
}
|
1047 |
-
},
|
1048 |
-
'json'
|
1049 |
-
);
|
1050 |
-
}
|
1051 |
-
dsq_fire_import = function() {
|
1052 |
-
var $ = jQuery;
|
1053 |
-
$('#dsq_import a.button, #dsq_import_retry').unbind().click(function() {
|
1054 |
-
var wipe = $('#dsq_import_wipe').is(':checked');
|
1055 |
-
$('#dsq_import').html('<p class="status"></p>');
|
1056 |
-
$('#dsq_import .status').removeClass('dsq-import-fail').addClass('dsq-importing').html('Processing...');
|
1057 |
-
dsq_import_comments(wipe);
|
1058 |
-
return false;
|
1059 |
-
});
|
1060 |
-
}
|
1061 |
-
dsq_import_comments = function(wipe) {
|
1062 |
-
var $ = jQuery;
|
1063 |
-
var status = $('#dsq_import .status');
|
1064 |
-
var last_comment_id = status.attr('rel') || '0';
|
1065 |
-
$.get(
|
1066 |
-
'<?php echo admin_url('index.php'); ?>',
|
1067 |
-
{
|
1068 |
-
cf_action: 'import_comments',
|
1069 |
-
last_comment_id: last_comment_id,
|
1070 |
-
wipe: (wipe ? 1 : 0)
|
1071 |
-
},
|
1072 |
-
function(response) {
|
1073 |
-
switch (response.result) {
|
1074 |
-
case 'success':
|
1075 |
-
status.html(response.msg).attr('rel', response.last_comment_id);
|
1076 |
-
switch (response.status) {
|
1077 |
-
case 'partial':
|
1078 |
-
dsq_import_comments(false);
|
1079 |
-
break;
|
1080 |
-
case 'complete':
|
1081 |
-
status.removeClass('dsq-importing').addClass('dsq-imported');
|
1082 |
-
break;
|
1083 |
-
}
|
1084 |
-
break;
|
1085 |
-
case 'fail':
|
1086 |
-
status.parent().html(response.msg);
|
1087 |
-
dsq_fire_import();
|
1088 |
-
break;
|
1089 |
-
}
|
1090 |
-
},
|
1091 |
-
'json'
|
1092 |
-
);
|
1093 |
-
}
|
1094 |
-
</script>
|
1095 |
-
<?php
|
1096 |
-
// HACK: Our own styles for older versions of WordPress.
|
1097 |
-
global $wp_version;
|
1098 |
-
if ( version_compare($wp_version, '2.5', '<') ) {
|
1099 |
-
echo "<link rel='stylesheet' href='" . plugins_url( 'media/styles/manage-pre25.css', __FILE__ ) . "' type='text/css' />";
|
1100 |
-
}
|
1101 |
-
}
|
1102 |
-
}
|
1103 |
-
add_action('admin_head', 'dsq_admin_head');
|
1104 |
-
|
1105 |
-
/**
|
1106 |
-
* Wrapper for built-in __() which pulls all text from
|
1107 |
-
* the disqus domain and supports variable interpolation.
|
1108 |
-
*/
|
1109 |
-
function dsq_i($text, $params=null) {
|
1110 |
-
if (!is_array($params))
|
1111 |
-
{
|
1112 |
-
$params = func_get_args();
|
1113 |
-
$params = array_slice($params, 1);
|
1114 |
-
}
|
1115 |
-
return vsprintf(__($text, 'disqus'), $params);
|
1116 |
-
}
|
1117 |
-
|
1118 |
-
// catch original query
|
1119 |
-
function dsq_parse_query($query) {
|
1120 |
-
add_action('the_posts', 'dsq_add_request_post_ids', 999);
|
1121 |
-
}
|
1122 |
-
add_action('parse_request', 'dsq_parse_query');
|
1123 |
-
|
1124 |
-
// track the original request post_ids, only run once
|
1125 |
-
function dsq_add_request_post_ids($posts) {
|
1126 |
-
dsq_add_query_posts($posts);
|
1127 |
-
remove_action('the_posts', 'dsq_log_request_post_ids', 999);
|
1128 |
-
return $posts;
|
1129 |
-
}
|
1130 |
-
|
1131 |
-
function dsq_maybe_add_post_ids($posts) {
|
1132 |
-
global $DSQ_QUERY_COMMENTS;
|
1133 |
-
if ($DSQ_QUERY_COMMENTS) {
|
1134 |
-
dsq_add_query_posts($posts);
|
1135 |
-
}
|
1136 |
-
return $posts;
|
1137 |
-
}
|
1138 |
-
add_action('the_posts', 'dsq_maybe_add_post_ids');
|
1139 |
-
|
1140 |
-
function dsq_add_query_posts($posts) {
|
1141 |
-
global $DSQ_QUERY_POST_IDS;
|
1142 |
-
if (count($posts)) {
|
1143 |
-
foreach ($posts as $post) {
|
1144 |
-
$post_ids[] = intval($post->ID);
|
1145 |
-
}
|
1146 |
-
$DSQ_QUERY_POST_IDS[md5(serialize($post_ids))] = $post_ids;
|
1147 |
-
}
|
1148 |
-
}
|
1149 |
-
|
1150 |
-
// check to see if the posts in the loop match the original request or an explicit request, if so output the JS
|
1151 |
-
function dsq_loop_end($query) {
|
1152 |
-
if ( get_option('disqus_cc_fix') == '1' || !count($query->posts) || is_single() || is_page() || is_feed() || !dsq_can_replace() ) {
|
1153 |
-
return;
|
1154 |
-
}
|
1155 |
-
global $DSQ_QUERY_POST_IDS;
|
1156 |
-
foreach ($query->posts as $post) {
|
1157 |
-
$loop_ids[] = intval($post->ID);
|
1158 |
-
}
|
1159 |
-
$posts_key = md5(serialize($loop_ids));
|
1160 |
-
if (isset($DSQ_QUERY_POST_IDS[$posts_key])) {
|
1161 |
-
dsq_output_loop_comment_js($DSQ_QUERY_POST_IDS[$posts_key]);
|
1162 |
-
}
|
1163 |
-
}
|
1164 |
-
add_action('loop_end', 'dsq_loop_end');
|
1165 |
-
|
1166 |
-
// if someone has a better hack, let me know
|
1167 |
-
// prevents duplicate calls to count.js
|
1168 |
-
$_HAS_COUNTS = false;
|
1169 |
-
|
1170 |
-
function dsq_output_loop_comment_js($post_ids = null) {
|
1171 |
-
global $_HAS_COUNTS;
|
1172 |
-
if ($_HAS_COUNTS) return;
|
1173 |
-
$_HAS_COUNTS = true;
|
1174 |
-
if (count($post_ids)) {
|
1175 |
-
?>
|
1176 |
-
<script type="text/javascript">
|
1177 |
-
// <![CDATA[
|
1178 |
-
var disqus_shortname = '<?php echo strtolower(get_option('disqus_forum_url')); ?>';
|
1179 |
-
(function () {
|
1180 |
-
var nodes = document.getElementsByTagName('span');
|
1181 |
-
for (var i = 0, url; i < nodes.length; i++) {
|
1182 |
-
if (nodes[i].className.indexOf('dsq-postid') != -1) {
|
1183 |
-
nodes[i].parentNode.setAttribute('data-disqus-identifier', nodes[i].getAttribute('rel'));
|
1184 |
-
url = nodes[i].parentNode.href.split('#', 1);
|
1185 |
-
if (url.length == 1) { url = url[0]; }
|
1186 |
-
else { url = url[1]; }
|
1187 |
-
nodes[i].parentNode.href = url + '#disqus_thread';
|
1188 |
-
}
|
1189 |
-
}
|
1190 |
-
var s = document.createElement('script'); s.async = true;
|
1191 |
-
s.type = 'text/javascript';
|
1192 |
-
s.src = '//' + disqus_shortname + '.<?php echo DISQUS_DOMAIN; ?>/count.js';
|
1193 |
-
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
1194 |
-
}());
|
1195 |
-
//]]>
|
1196 |
-
</script>
|
1197 |
-
<?php
|
1198 |
-
}
|
1199 |
-
}
|
1200 |
-
|
1201 |
-
function dsq_output_footer_comment_js() {
|
1202 |
-
if (!dsq_can_replace()) return;
|
1203 |
-
if (get_option('disqus_cc_fix') != '1') return;
|
1204 |
-
?>
|
1205 |
-
<script type="text/javascript">
|
1206 |
-
// <![CDATA[
|
1207 |
-
var disqus_shortname = '<?php echo strtolower(get_option('disqus_forum_url')); ?>';
|
1208 |
-
(function () {
|
1209 |
-
var nodes = document.getElementsByTagName('span');
|
1210 |
-
for (var i = 0, url; i < nodes.length; i++) {
|
1211 |
-
if (nodes[i].className.indexOf('dsq-postid') != -1) {
|
1212 |
-
nodes[i].parentNode.setAttribute('data-disqus-identifier', nodes[i].getAttribute('rel'));
|
1213 |
-
url = nodes[i].parentNode.href.split('#', 1);
|
1214 |
-
if (url.length == 1) url = url[0];
|
1215 |
-
else url = url[1]
|
1216 |
-
nodes[i].parentNode.href = url + '#disqus_thread';
|
1217 |
-
}
|
1218 |
-
}
|
1219 |
-
var s = document.createElement('script'); s.async = true;
|
1220 |
-
s.type = 'text/javascript';
|
1221 |
-
s.src = '//' + disqus_shortname + '.<?php echo DISQUS_DOMAIN; ?>/count.js';
|
1222 |
-
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
1223 |
-
}());
|
1224 |
-
//]]>
|
1225 |
-
</script>
|
1226 |
-
<?php
|
1227 |
-
}
|
1228 |
-
add_action('wp_footer', 'dsq_output_footer_comment_js');
|
1229 |
-
|
1230 |
-
// UPDATE DSQ when a permalink changes
|
1231 |
-
|
1232 |
-
$dsq_prev_permalinks = array();
|
1233 |
-
|
1234 |
-
function dsq_prev_permalink($post_id) {
|
1235 |
-
$post = get_post($post_id);
|
1236 |
-
// if post not published, return
|
1237 |
-
if ($post->post_status != 'publish') {
|
1238 |
-
return;
|
1239 |
-
}
|
1240 |
-
global $dsq_prev_permalinks;
|
1241 |
-
$dsq_prev_permalinks['post_'.$post_id] = get_permalink($post_id);
|
1242 |
-
}
|
1243 |
-
add_action('pre_post_update', 'dsq_prev_permalink');
|
1244 |
-
|
1245 |
-
function dsq_check_permalink($post_id) {
|
1246 |
-
global $dsq_prev_permalinks;
|
1247 |
-
if (!empty($dsq_prev_permalinks['post_'.$post_id]) && $dsq_prev_permalinks['post_'.$post_id] != get_permalink($post_id)) {
|
1248 |
-
$post = get_post($post_id);
|
1249 |
-
dsq_update_permalink($post);
|
1250 |
-
}
|
1251 |
-
}
|
1252 |
-
add_action('edit_post', 'dsq_check_permalink');
|
1253 |
-
|
1254 |
-
// Only replace comments if the disqus_forum_url option is set.
|
1255 |
-
add_filter('comments_template', 'dsq_comments_template');
|
1256 |
-
add_filter('comments_number', 'dsq_comments_text');
|
1257 |
-
add_filter('get_comments_number', 'dsq_comments_number');
|
1258 |
-
add_filter('bloginfo_url', 'dsq_bloginfo_url');
|
1259 |
-
|
1260 |
-
/**
|
1261 |
-
* JSON ENCODE for PHP < 5.2.0
|
1262 |
-
* Checks if json_encode is not available and defines json_encode
|
1263 |
-
* to use php_json_encode in its stead
|
1264 |
-
* Works on iteratable objects as well - stdClass is iteratable, so all WP objects are gonna be iteratable
|
1265 |
-
*/
|
1266 |
-
if(!function_exists('cf_json_encode')) {
|
1267 |
-
function cf_json_encode($data) {
|
1268 |
-
// json_encode is sending an application/x-javascript header on Joyent servers
|
1269 |
-
// for some unknown reason.
|
1270 |
-
// if(function_exists('json_encode')) { return json_encode($data); }
|
1271 |
-
// else { return cfjson_encode($data); }
|
1272 |
-
return cfjson_encode($data);
|
1273 |
-
}
|
1274 |
-
|
1275 |
-
function cfjson_encode_string($str) {
|
1276 |
-
if(is_bool($str)) {
|
1277 |
-
return $str ? 'true' : 'false';
|
1278 |
-
}
|
1279 |
-
|
1280 |
-
return str_replace(
|
1281 |
-
array(
|
1282 |
-
'"'
|
1283 |
-
, '/'
|
1284 |
-
, "\n"
|
1285 |
-
, "\r"
|
1286 |
-
)
|
1287 |
-
, array(
|
1288 |
-
'\"'
|
1289 |
-
, '\/'
|
1290 |
-
, '\n'
|
1291 |
-
, '\r'
|
1292 |
-
)
|
1293 |
-
, $str
|
1294 |
-
);
|
1295 |
-
}
|
1296 |
-
|
1297 |
-
function cfjson_encode($arr) {
|
1298 |
-
$json_str = '';
|
1299 |
-
if (is_array($arr)) {
|
1300 |
-
$pure_array = true;
|
1301 |
-
$array_length = count($arr);
|
1302 |
-
for ( $i = 0; $i < $array_length ; $i++) {
|
1303 |
-
if (!isset($arr[$i])) {
|
1304 |
-
$pure_array = false;
|
1305 |
-
break;
|
1306 |
-
}
|
1307 |
-
}
|
1308 |
-
if ($pure_array) {
|
1309 |
-
$json_str = '[';
|
1310 |
-
$temp = array();
|
1311 |
-
for ($i=0; $i < $array_length; $i++) {
|
1312 |
-
$temp[] = sprintf("%s", cfjson_encode($arr[$i]));
|
1313 |
-
}
|
1314 |
-
$json_str .= implode(',', $temp);
|
1315 |
-
$json_str .="]";
|
1316 |
-
}
|
1317 |
-
else {
|
1318 |
-
$json_str = '{';
|
1319 |
-
$temp = array();
|
1320 |
-
foreach ($arr as $key => $value) {
|
1321 |
-
$temp[] = sprintf("\"%s\":%s", $key, cfjson_encode($value));
|
1322 |
-
}
|
1323 |
-
$json_str .= implode(',', $temp);
|
1324 |
-
$json_str .= '}';
|
1325 |
-
}
|
1326 |
-
}
|
1327 |
-
else if (is_object($arr)) {
|
1328 |
-
$json_str = '{';
|
1329 |
-
$temp = array();
|
1330 |
-
foreach ($arr as $k => $v) {
|
1331 |
-
$temp[] = '"'.$k.'":'.cfjson_encode($v);
|
1332 |
-
}
|
1333 |
-
$json_str .= implode(',', $temp);
|
1334 |
-
$json_str .= '}';
|
1335 |
-
}
|
1336 |
-
else if (is_string($arr)) {
|
1337 |
-
$json_str = '"'. cfjson_encode_string($arr) . '"';
|
1338 |
-
}
|
1339 |
-
else if (is_numeric($arr)) {
|
1340 |
-
$json_str = $arr;
|
1341 |
-
}
|
1342 |
-
else if (is_bool($arr)) {
|
1343 |
-
$json_str = $arr ? 'true' : 'false';
|
1344 |
-
}
|
1345 |
-
else {
|
1346 |
-
$json_str = '"'. cfjson_encode_string($arr) . '"';
|
1347 |
-
}
|
1348 |
-
return $json_str;
|
1349 |
-
}
|
1350 |
-
}
|
1351 |
-
|
1352 |
-
// Single Sign-on Integration
|
1353 |
-
|
1354 |
-
function dsq_sso() {
|
1355 |
-
if ($key = get_option('disqus_partner_key')) {
|
1356 |
-
// use old style SSO
|
1357 |
-
$new = false;
|
1358 |
-
} elseif (($key = get_option('disqus_secret_key')) && ($public = get_option('disqus_public_key'))) {
|
1359 |
-
// use new style SSO
|
1360 |
-
$new = true;
|
1361 |
-
} else {
|
1362 |
-
// sso is not configured
|
1363 |
-
return array();
|
1364 |
-
}
|
1365 |
-
global $current_user, $dsq_api;
|
1366 |
-
get_currentuserinfo();
|
1367 |
-
if ($current_user->ID) {
|
1368 |
-
$avatar_tag = get_avatar($current_user->ID);
|
1369 |
-
$avatar_data = array();
|
1370 |
-
preg_match('/(src)=((\'|")[^(\'|")]*(\'|"))/i', $avatar_tag, $avatar_data);
|
1371 |
-
$avatar = str_replace(array('"', "'"), '', $avatar_data[2]);
|
1372 |
-
$user_data = array(
|
1373 |
-
'username' => $current_user->display_name,
|
1374 |
-
'id' => $current_user->ID,
|
1375 |
-
'avatar' => $avatar,
|
1376 |
-
'email' => $current_user->user_email,
|
1377 |
-
'url' => $current_user->user_url,
|
1378 |
-
);
|
1379 |
-
}
|
1380 |
-
else {
|
1381 |
-
$user_data = array();
|
1382 |
-
}
|
1383 |
-
$user_data = base64_encode(cf_json_encode($user_data));
|
1384 |
-
$time = time();
|
1385 |
-
$hmac = dsq_hmacsha1($user_data.' '.$time, $key);
|
1386 |
-
|
1387 |
-
$payload = $user_data.' '.$hmac.' '.$time;
|
1388 |
-
|
1389 |
-
if ($new) {
|
1390 |
-
return array('remote_auth_s3'=>$payload, 'api_key'=>$public);
|
1391 |
-
} else {
|
1392 |
-
return array('remote_auth_s2'=>$payload);
|
1393 |
-
}
|
1394 |
-
}
|
1395 |
-
|
1396 |
-
function dsq_sso_login() {
|
1397 |
-
global $current_site;
|
1398 |
-
$sitename = get_bloginfo('name');
|
1399 |
-
$siteurl = site_url();
|
1400 |
-
$button = get_option('disqus_sso_button');
|
1401 |
-
$icon = get_option('disqus_sso_icon');
|
1402 |
-
$sso_login_str = 'this.sso = {
|
1403 |
-
name: "'.wp_specialchars_decode($sitename, ENT_QUOTES).'",
|
1404 |
-
button: "'.$button.'",
|
1405 |
-
icon: "'.$icon.'",
|
1406 |
-
url: "'.$siteurl.'/wp-login.php",
|
1407 |
-
logout: "'.$siteurl.'/wp-login.php?action=logout",
|
1408 |
-
width: "800",
|
1409 |
-
height: "700"
|
1410 |
-
}';
|
1411 |
-
return $sso_login_str;
|
1412 |
-
}
|
1413 |
-
|
1414 |
-
// from: http://www.php.net/manual/en/function.sha1.php#39492
|
1415 |
-
// Calculate HMAC-SHA1 according to RFC2104
|
1416 |
-
// http://www.ietf.org/rfc/rfc2104.txt
|
1417 |
-
function dsq_hmacsha1($data, $key) {
|
1418 |
-
$blocksize=64;
|
1419 |
-
$hashfunc='sha1';
|
1420 |
-
if (strlen($key)>$blocksize)
|
1421 |
-
$key=pack('H*', $hashfunc($key));
|
1422 |
-
$key=str_pad($key,$blocksize,chr(0x00));
|
1423 |
-
$ipad=str_repeat(chr(0x36),$blocksize);
|
1424 |
-
$opad=str_repeat(chr(0x5c),$blocksize);
|
1425 |
-
$hmac = pack(
|
1426 |
-
'H*',$hashfunc(
|
1427 |
-
($key^$opad).pack(
|
1428 |
-
'H*',$hashfunc(
|
1429 |
-
($key^$ipad).$data
|
1430 |
-
)
|
1431 |
-
)
|
1432 |
-
)
|
1433 |
-
);
|
1434 |
-
return bin2hex($hmac);
|
1435 |
-
}
|
1436 |
-
|
1437 |
-
function dsq_identifier_for_post($post) {
|
1438 |
-
return $post->ID . ' ' . $post->guid;
|
1439 |
-
}
|
1440 |
-
|
1441 |
-
function dsq_title_for_post($post) {
|
1442 |
-
$title = get_the_title($post);
|
1443 |
-
$title = strip_tags($title, DISQUS_ALLOWED_HTML);
|
1444 |
-
return $title;
|
1445 |
-
}
|
1446 |
-
|
1447 |
-
function dsq_link_for_post($post) {
|
1448 |
-
return get_permalink($post);
|
1449 |
-
}
|
1450 |
-
|
1451 |
-
function dsq_does_need_update() {
|
1452 |
-
$version = (string)get_option('disqus_version');
|
1453 |
-
if (empty($version)) {
|
1454 |
-
$version = '0';
|
1455 |
-
}
|
1456 |
-
|
1457 |
-
if (version_compare($version, '2.49', '<')) {
|
1458 |
-
return true;
|
1459 |
-
}
|
1460 |
-
|
1461 |
-
return false;
|
1462 |
-
}
|
1463 |
-
|
1464 |
-
function dsq_install($allow_database_install=true) {
|
1465 |
-
global $wpdb, $userdata;
|
1466 |
-
|
1467 |
-
$version = (string)get_option('disqus_version');
|
1468 |
-
if (!$version) {
|
1469 |
-
$version = '0';
|
1470 |
-
}
|
1471 |
-
|
1472 |
-
if ($allow_database_install)
|
1473 |
-
{
|
1474 |
-
dsq_install_database($version);
|
1475 |
-
}
|
1476 |
-
|
1477 |
-
if (version_compare($version, DISQUS_VERSION, '=')) return;
|
1478 |
-
|
1479 |
-
// if this is a new install, we should not set disqus active
|
1480 |
-
if ($version == '0') {
|
1481 |
-
add_option('disqus_active', 0);
|
1482 |
-
} else {
|
1483 |
-
add_option('disqus_active', 1);
|
1484 |
-
}
|
1485 |
-
|
1486 |
-
update_option('disqus_version', DISQUS_VERSION);
|
1487 |
-
}
|
1488 |
-
|
1489 |
-
/**
|
1490 |
-
* Adds a simple WordPress pointer to Comments menu, to remind the user to configure the plugin
|
1491 |
-
*/
|
1492 |
-
function dsq_enqueue_pointer_script_style( $hook_suffix ) {
|
1493 |
-
|
1494 |
-
// Assume pointer shouldn't be shown
|
1495 |
-
$enqueue_pointer_script_style = false;
|
1496 |
-
|
1497 |
-
// Get array list of dismissed pointers for current user and convert it to array
|
1498 |
-
$dismissed_pointers = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
|
1499 |
-
|
1500 |
-
// Check if our pointer is not among dismissed ones
|
1501 |
-
if( !in_array( 'disqus_settings_pointer', $dismissed_pointers ) ) {
|
1502 |
-
$enqueue_pointer_script_style = true;
|
1503 |
-
|
1504 |
-
// Add footer scripts using callback function
|
1505 |
-
add_action( 'admin_print_footer_scripts', 'dsq_pointer_print_scripts' );
|
1506 |
-
}
|
1507 |
-
|
1508 |
-
// Enqueue pointer CSS and JS files, if needed
|
1509 |
-
if( $enqueue_pointer_script_style ) {
|
1510 |
-
wp_enqueue_style( 'wp-pointer' );
|
1511 |
-
wp_enqueue_script( 'wp-pointer' );
|
1512 |
-
}
|
1513 |
-
|
1514 |
-
}
|
1515 |
-
if (!dsq_is_installed()) {
|
1516 |
-
// Only show the pointer when Disqus isn't already configured
|
1517 |
-
add_action( 'admin_enqueue_scripts', 'dsq_enqueue_pointer_script_style' );
|
1518 |
-
}
|
1519 |
-
|
1520 |
-
function dsq_pointer_print_scripts() {
|
1521 |
-
|
1522 |
-
$pointer_content = '<h3>DISQUS needs to be configured</h3>';
|
1523 |
-
$pointer_content .= '<p>Configure DISQUS by clicking Comments to the left.</p>';
|
1524 |
-
?>
|
1525 |
-
|
1526 |
-
<script type="text/javascript">
|
1527 |
-
//<![CDATA[
|
1528 |
-
jQuery(document).ready( function($) {
|
1529 |
-
$('#menu-comments').pointer({
|
1530 |
-
content: '<?php echo $pointer_content; ?>',
|
1531 |
-
position: {
|
1532 |
-
edge: 'left', // arrow direction
|
1533 |
-
align: 'center' // vertical alignment
|
1534 |
-
},
|
1535 |
-
pointerWidth: 350,
|
1536 |
-
close: function() {
|
1537 |
-
$.post( ajaxurl, {
|
1538 |
-
pointer: 'disqus_settings_pointer', // pointer ID
|
1539 |
-
action: 'dismiss-wp-pointer'
|
1540 |
-
});
|
1541 |
-
}
|
1542 |
-
}).pointer('open');
|
1543 |
-
});
|
1544 |
-
//]]>
|
1545 |
-
</script>
|
1546 |
-
|
1547 |
-
<?php
|
1548 |
-
}
|
1549 |
-
|
1550 |
-
/**
|
1551 |
-
* Initializes the database if it's not already present.
|
1552 |
-
*/
|
1553 |
-
function dsq_install_database($version=0) {
|
1554 |
-
global $wpdb;
|
1555 |
-
|
1556 |
-
if (version_compare($version, '2.49', '<')) {
|
1557 |
-
$wpdb->query("CREATE INDEX disqus_dupecheck ON `".$wpdb->prefix."commentmeta` (meta_key, meta_value(11));");
|
1558 |
-
}
|
1559 |
-
}
|
1560 |
-
function dsq_reset_database($version=0) {
|
1561 |
-
global $wpdb;
|
1562 |
-
|
1563 |
-
if (version_compare($version, '2.49', '>=')) {
|
1564 |
-
$wpdb->query("DROP INDEX disqus_dupecheck ON `".$wpdb->prefix."commentmeta`;");
|
1565 |
-
}
|
1566 |
-
}
|
1567 |
-
|
1568 |
-
/**
|
1569 |
-
* Disable internal Wordpress commenting if Disqus is enabled - this prevents spam bots from
|
1570 |
-
* commenting using POST requests to /wp-comments-post.php.
|
1571 |
-
*
|
1572 |
-
* @param int $comment_post_ID
|
1573 |
-
* @return int
|
1574 |
-
*/
|
1575 |
-
function dsq_pre_comment_on_post($comment_post_ID) {
|
1576 |
-
if (dsq_can_replace()) {
|
1577 |
-
wp_die( dsq_i('Sorry, the built-in commenting system is disabled because Disqus is active.') );
|
1578 |
-
}
|
1579 |
-
return $comment_post_ID;
|
1580 |
-
}
|
1581 |
-
add_action('pre_comment_on_post', 'dsq_pre_comment_on_post');
|
1582 |
-
|
1583 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/export.php
DELETED
@@ -1,195 +0,0 @@
|
|
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 |
-
/**
|
10 |
-
* {@internal Missing Short Description}}
|
11 |
-
*
|
12 |
-
* @since unknown
|
13 |
-
*
|
14 |
-
* @param unknown_type $categories
|
15 |
-
*/
|
16 |
-
function dsq_export_wxr_missing_parents($categories) {
|
17 |
-
if ( !is_array($categories) || empty($categories) )
|
18 |
-
return array();
|
19 |
-
|
20 |
-
foreach ( $categories as $category )
|
21 |
-
$parents[$category->term_id] = $category->parent;
|
22 |
-
|
23 |
-
$parents = array_unique(array_diff($parents, array_keys($parents)));
|
24 |
-
|
25 |
-
if ( $zero = array_search('0', $parents) )
|
26 |
-
unset($parents[$zero]);
|
27 |
-
|
28 |
-
return $parents;
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Place string in CDATA tag.
|
33 |
-
*
|
34 |
-
* @since unknown
|
35 |
-
*
|
36 |
-
* @param string $str String to place in XML CDATA tag.
|
37 |
-
*/
|
38 |
-
function dsq_export_wxr_cdata($str) {
|
39 |
-
if ( seems_utf8($str) == false )
|
40 |
-
$str = utf8_encode($str);
|
41 |
-
|
42 |
-
// $str = ent2ncr(esc_html($str));
|
43 |
-
|
44 |
-
$str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
|
45 |
-
|
46 |
-
return $str;
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* {@internal Missing Short Description}}
|
51 |
-
*
|
52 |
-
* @since unknown
|
53 |
-
*
|
54 |
-
* @return string Site URL.
|
55 |
-
*/
|
56 |
-
function dsq_export_wxr_site_url() {
|
57 |
-
global $current_site;
|
58 |
-
|
59 |
-
// mu: the base url
|
60 |
-
if ( isset($current_site->domain) ) {
|
61 |
-
return 'http://'.$current_site->domain.$current_site->path;
|
62 |
-
}
|
63 |
-
// wp: the blog url
|
64 |
-
else {
|
65 |
-
return get_bloginfo_rss('url');
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* {@internal Missing Short Description}}
|
71 |
-
*
|
72 |
-
* @since unknown
|
73 |
-
*
|
74 |
-
* @param object $c Category Object
|
75 |
-
*/
|
76 |
-
function dsq_export_wxr_cat_name($c) {
|
77 |
-
if ( empty($c->name) )
|
78 |
-
return;
|
79 |
-
|
80 |
-
echo '<wp:cat_name>' . dsq_export_wxr_cdata($c->name) . '</wp:cat_name>';
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* {@internal Missing Short Description}}
|
85 |
-
*
|
86 |
-
* @since unknown
|
87 |
-
*
|
88 |
-
* @param object $c Category Object
|
89 |
-
*/
|
90 |
-
function dsq_export_wxr_category_description($c) {
|
91 |
-
if ( empty($c->description) )
|
92 |
-
return;
|
93 |
-
|
94 |
-
echo '<wp:category_description>' . dsq_export_wxr_cdata($c->description) . '</wp:category_description>';
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* {@internal Missing Short Description}}
|
99 |
-
*
|
100 |
-
* @since unknown
|
101 |
-
*
|
102 |
-
* @param object $t Tag Object
|
103 |
-
*/
|
104 |
-
function dsq_export_wxr_tag_name($t) {
|
105 |
-
if ( empty($t->name) )
|
106 |
-
return;
|
107 |
-
|
108 |
-
echo '<wp:tag_name>' . dsq_export_wxr_cdata($t->name) . '</wp:tag_name>';
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* {@internal Missing Short Description}}
|
113 |
-
*
|
114 |
-
* @since unknown
|
115 |
-
*
|
116 |
-
* @param object $t Tag Object
|
117 |
-
*/
|
118 |
-
function dsq_export_wxr_tag_description($t) {
|
119 |
-
if ( empty($t->description) )
|
120 |
-
return;
|
121 |
-
|
122 |
-
echo '<wp:tag_description>' . dsq_export_wxr_cdata($t->description) . '</wp:tag_description>';
|
123 |
-
}
|
124 |
-
|
125 |
-
// receives an array of posts to export
|
126 |
-
function dsq_export_wp($post, $comments=null) {
|
127 |
-
global $wpdb;
|
128 |
-
|
129 |
-
if (!$comments) {
|
130 |
-
$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_agent NOT LIKE 'Disqus/%%'", $post->ID) );
|
131 |
-
}
|
132 |
-
|
133 |
-
// start catching output
|
134 |
-
ob_start();
|
135 |
-
|
136 |
-
echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
|
137 |
-
?>
|
138 |
-
<?php the_generator('export');?>
|
139 |
-
<rss version="2.0"
|
140 |
-
xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/"
|
141 |
-
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
142 |
-
xmlns:dsq="http://www.disqus.com/"
|
143 |
-
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
144 |
-
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
145 |
-
xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/"
|
146 |
-
>
|
147 |
-
|
148 |
-
<channel>
|
149 |
-
<title><?php bloginfo_rss('name'); ?></title>
|
150 |
-
<link><?php bloginfo_rss('url') ?></link>
|
151 |
-
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
|
152 |
-
<generator>WordPress <?php bloginfo_rss('version'); ?>; Disqus <?php echo DISQUS_VERSION; ?></generator>
|
153 |
-
<?php
|
154 |
-
global $wp_query, $post;
|
155 |
-
$wp_query->in_the_loop = true; // Fake being in the loop.
|
156 |
-
setup_postdata($post); ?>
|
157 |
-
<item>
|
158 |
-
<title><?php echo apply_filters('the_title_rss', $post->post_title); ?></title>
|
159 |
-
<link><?php the_permalink_rss() ?></link>
|
160 |
-
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
|
161 |
-
<dc:creator><?php echo dsq_export_wxr_cdata(get_the_author()); ?></dc:creator>
|
162 |
-
<guid isPermaLink="false"><?php the_guid(); ?></guid>
|
163 |
-
<content:encoded><?php echo dsq_export_wxr_cdata( apply_filters('the_content_export', $post->post_content) ); ?></content:encoded>
|
164 |
-
<dsq:thread_identifier><?php echo dsq_identifier_for_post($post); ?></dsq:thread_identifier>
|
165 |
-
<wp:post_id><?php echo $post->ID; ?></wp:post_id>
|
166 |
-
<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
|
167 |
-
<wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
|
168 |
-
<?php
|
169 |
-
if ( $comments ) { foreach ( $comments as $c ) { ?>
|
170 |
-
<wp:comment>
|
171 |
-
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
|
172 |
-
<wp:comment_author><?php echo dsq_export_wxr_cdata($c->comment_author); ?></wp:comment_author>
|
173 |
-
<wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
|
174 |
-
<wp:comment_author_url><?php echo $c->comment_author_url; ?></wp:comment_author_url>
|
175 |
-
<wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
|
176 |
-
<wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
|
177 |
-
<wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
|
178 |
-
<wp:comment_content><?php echo dsq_export_wxr_cdata($c->comment_content) ?></wp:comment_content>
|
179 |
-
<wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
|
180 |
-
<wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
|
181 |
-
<wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
|
182 |
-
</wp:comment>
|
183 |
-
<?php } } // comments ?>
|
184 |
-
</item>
|
185 |
-
</channel>
|
186 |
-
</rss>
|
187 |
-
<?php
|
188 |
-
|
189 |
-
// end of WXR output
|
190 |
-
$output = ob_get_clean();
|
191 |
-
|
192 |
-
return $output;
|
193 |
-
}
|
194 |
-
|
195 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/lib/api/LICENSE
DELETED
@@ -1,202 +0,0 @@
|
|
1 |
-
|
2 |
-
Apache License
|
3 |
-
Version 2.0, January 2004
|
4 |
-
http://www.apache.org/licenses/
|
5 |
-
|
6 |
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7 |
-
|
8 |
-
1. Definitions.
|
9 |
-
|
10 |
-
"License" shall mean the terms and conditions for use, reproduction,
|
11 |
-
and distribution as defined by Sections 1 through 9 of this document.
|
12 |
-
|
13 |
-
"Licensor" shall mean the copyright owner or entity authorized by
|
14 |
-
the copyright owner that is granting the License.
|
15 |
-
|
16 |
-
"Legal Entity" shall mean the union of the acting entity and all
|
17 |
-
other entities that control, are controlled by, or are under common
|
18 |
-
control with that entity. For the purposes of this definition,
|
19 |
-
"control" means (i) the power, direct or indirect, to cause the
|
20 |
-
direction or management of such entity, whether by contract or
|
21 |
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22 |
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
23 |
-
|
24 |
-
"You" (or "Your") shall mean an individual or Legal Entity
|
25 |
-
exercising permissions granted by this License.
|
26 |
-
|
27 |
-
"Source" form shall mean the preferred form for making modifications,
|
28 |
-
including but not limited to software source code, documentation
|
29 |
-
source, and configuration files.
|
30 |
-
|
31 |
-
"Object" form shall mean any form resulting from mechanical
|
32 |
-
transformation or translation of a Source form, including but
|
33 |
-
not limited to compiled object code, generated documentation,
|
34 |
-
and conversions to other media types.
|
35 |
-
|
36 |
-
"Work" shall mean the work of authorship, whether in Source or
|
37 |
-
Object form, made available under the License, as indicated by a
|
38 |
-
copyright notice that is included in or attached to the work
|
39 |
-
(an example is provided in the Appendix below).
|
40 |
-
|
41 |
-
"Derivative Works" shall mean any work, whether in Source or Object
|
42 |
-
form, that is based on (or derived from) the Work and for which the
|
43 |
-
editorial revisions, annotations, elaborations, or other modifications
|
44 |
-
represent, as a whole, an original work of authorship. For the purposes
|
45 |
-
of this License, Derivative Works shall not include works that remain
|
46 |
-
separable from, or merely link (or bind by name) to the interfaces of,
|
47 |
-
the Work and Derivative Works thereof.
|
48 |
-
|
49 |
-
"Contribution" shall mean any work of authorship, including
|
50 |
-
the original version of the Work and any modifications or additions
|
51 |
-
to that Work or Derivative Works thereof, that is intentionally
|
52 |
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
53 |
-
or by an individual or Legal Entity authorized to submit on behalf of
|
54 |
-
the copyright owner. For the purposes of this definition, "submitted"
|
55 |
-
means any form of electronic, verbal, or written communication sent
|
56 |
-
to the Licensor or its representatives, including but not limited to
|
57 |
-
communication on electronic mailing lists, source code control systems,
|
58 |
-
and issue tracking systems that are managed by, or on behalf of, the
|
59 |
-
Licensor for the purpose of discussing and improving the Work, but
|
60 |
-
excluding communication that is conspicuously marked or otherwise
|
61 |
-
designated in writing by the copyright owner as "Not a Contribution."
|
62 |
-
|
63 |
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64 |
-
on behalf of whom a Contribution has been received by Licensor and
|
65 |
-
subsequently incorporated within the Work.
|
66 |
-
|
67 |
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
68 |
-
this License, each Contributor hereby grants to You a perpetual,
|
69 |
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70 |
-
copyright license to reproduce, prepare Derivative Works of,
|
71 |
-
publicly display, publicly perform, sublicense, and distribute the
|
72 |
-
Work and such Derivative Works in Source or Object form.
|
73 |
-
|
74 |
-
3. Grant of Patent License. Subject to the terms and conditions of
|
75 |
-
this License, each Contributor hereby grants to You a perpetual,
|
76 |
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77 |
-
(except as stated in this section) patent license to make, have made,
|
78 |
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79 |
-
where such license applies only to those patent claims licensable
|
80 |
-
by such Contributor that are necessarily infringed by their
|
81 |
-
Contribution(s) alone or by combination of their Contribution(s)
|
82 |
-
with the Work to which such Contribution(s) was submitted. If You
|
83 |
-
institute patent litigation against any entity (including a
|
84 |
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85 |
-
or a Contribution incorporated within the Work constitutes direct
|
86 |
-
or contributory patent infringement, then any patent licenses
|
87 |
-
granted to You under this License for that Work shall terminate
|
88 |
-
as of the date such litigation is filed.
|
89 |
-
|
90 |
-
4. Redistribution. You may reproduce and distribute copies of the
|
91 |
-
Work or Derivative Works thereof in any medium, with or without
|
92 |
-
modifications, and in Source or Object form, provided that You
|
93 |
-
meet the following conditions:
|
94 |
-
|
95 |
-
(a) You must give any other recipients of the Work or
|
96 |
-
Derivative Works a copy of this License; and
|
97 |
-
|
98 |
-
(b) You must cause any modified files to carry prominent notices
|
99 |
-
stating that You changed the files; and
|
100 |
-
|
101 |
-
(c) You must retain, in the Source form of any Derivative Works
|
102 |
-
that You distribute, all copyright, patent, trademark, and
|
103 |
-
attribution notices from the Source form of the Work,
|
104 |
-
excluding those notices that do not pertain to any part of
|
105 |
-
the Derivative Works; and
|
106 |
-
|
107 |
-
(d) If the Work includes a "NOTICE" text file as part of its
|
108 |
-
distribution, then any Derivative Works that You distribute must
|
109 |
-
include a readable copy of the attribution notices contained
|
110 |
-
within such NOTICE file, excluding those notices that do not
|
111 |
-
pertain to any part of the Derivative Works, in at least one
|
112 |
-
of the following places: within a NOTICE text file distributed
|
113 |
-
as part of the Derivative Works; within the Source form or
|
114 |
-
documentation, if provided along with the Derivative Works; or,
|
115 |
-
within a display generated by the Derivative Works, if and
|
116 |
-
wherever such third-party notices normally appear. The contents
|
117 |
-
of the NOTICE file are for informational purposes only and
|
118 |
-
do not modify the License. You may add Your own attribution
|
119 |
-
notices within Derivative Works that You distribute, alongside
|
120 |
-
or as an addendum to the NOTICE text from the Work, provided
|
121 |
-
that such additional attribution notices cannot be construed
|
122 |
-
as modifying the License.
|
123 |
-
|
124 |
-
You may add Your own copyright statement to Your modifications and
|
125 |
-
may provide additional or different license terms and conditions
|
126 |
-
for use, reproduction, or distribution of Your modifications, or
|
127 |
-
for any such Derivative Works as a whole, provided Your use,
|
128 |
-
reproduction, and distribution of the Work otherwise complies with
|
129 |
-
the conditions stated in this License.
|
130 |
-
|
131 |
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132 |
-
any Contribution intentionally submitted for inclusion in the Work
|
133 |
-
by You to the Licensor shall be under the terms and conditions of
|
134 |
-
this License, without any additional terms or conditions.
|
135 |
-
Notwithstanding the above, nothing herein shall supersede or modify
|
136 |
-
the terms of any separate license agreement you may have executed
|
137 |
-
with Licensor regarding such Contributions.
|
138 |
-
|
139 |
-
6. Trademarks. This License does not grant permission to use the trade
|
140 |
-
names, trademarks, service marks, or product names of the Licensor,
|
141 |
-
except as required for reasonable and customary use in describing the
|
142 |
-
origin of the Work and reproducing the content of the NOTICE file.
|
143 |
-
|
144 |
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
145 |
-
agreed to in writing, Licensor provides the Work (and each
|
146 |
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147 |
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148 |
-
implied, including, without limitation, any warranties or conditions
|
149 |
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150 |
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151 |
-
appropriateness of using or redistributing the Work and assume any
|
152 |
-
risks associated with Your exercise of permissions under this License.
|
153 |
-
|
154 |
-
8. Limitation of Liability. In no event and under no legal theory,
|
155 |
-
whether in tort (including negligence), contract, or otherwise,
|
156 |
-
unless required by applicable law (such as deliberate and grossly
|
157 |
-
negligent acts) or agreed to in writing, shall any Contributor be
|
158 |
-
liable to You for damages, including any direct, indirect, special,
|
159 |
-
incidental, or consequential damages of any character arising as a
|
160 |
-
result of this License or out of the use or inability to use the
|
161 |
-
Work (including but not limited to damages for loss of goodwill,
|
162 |
-
work stoppage, computer failure or malfunction, or any and all
|
163 |
-
other commercial damages or losses), even if such Contributor
|
164 |
-
has been advised of the possibility of such damages.
|
165 |
-
|
166 |
-
9. Accepting Warranty or Additional Liability. While redistributing
|
167 |
-
the Work or Derivative Works thereof, You may choose to offer,
|
168 |
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
169 |
-
or other liability obligations and/or rights consistent with this
|
170 |
-
License. However, in accepting such obligations, You may act only
|
171 |
-
on Your own behalf and on Your sole responsibility, not on behalf
|
172 |
-
of any other Contributor, and only if You agree to indemnify,
|
173 |
-
defend, and hold each Contributor harmless for any liability
|
174 |
-
incurred by, or claims asserted against, such Contributor by reason
|
175 |
-
of your accepting any such warranty or additional liability.
|
176 |
-
|
177 |
-
END OF TERMS AND CONDITIONS
|
178 |
-
|
179 |
-
APPENDIX: How to apply the Apache License to your work.
|
180 |
-
|
181 |
-
To apply the Apache License to your work, attach the following
|
182 |
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
183 |
-
replaced with your own identifying information. (Don't include
|
184 |
-
the brackets!) The text should be enclosed in the appropriate
|
185 |
-
comment syntax for the file format. We also recommend that a
|
186 |
-
file or class name and description of purpose be included on the
|
187 |
-
same "printed page" as the copyright notice for easier
|
188 |
-
identification within third-party archives.
|
189 |
-
|
190 |
-
Copyright 2010 DISQUS
|
191 |
-
|
192 |
-
Licensed under the Apache License, Version 2.0 (the "License");
|
193 |
-
you may not use this file except in compliance with the License.
|
194 |
-
You may obtain a copy of the License at
|
195 |
-
|
196 |
-
http://www.apache.org/licenses/LICENSE-2.0
|
197 |
-
|
198 |
-
Unless required by applicable law or agreed to in writing, software
|
199 |
-
distributed under the License is distributed on an "AS IS" BASIS,
|
200 |
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201 |
-
See the License for the specific language governing permissions and
|
202 |
-
limitations under the License.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/lib/api/README.rst
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
Disqus API 1.1
|
2 |
-
|
3 |
-
Please see http://groups.google.com/group/disqus-dev/web/api-1-1 for more information.
|
4 |
-
|
5 |
-
Sample usage::
|
6 |
-
|
7 |
-
require('disqus/disqus.php');
|
8 |
-
|
9 |
-
$dsq = new DisqusAPI($user_api_key, $forum_api_key);
|
10 |
-
if (($username = $dsq->get_user_name()) === false)
|
11 |
-
{
|
12 |
-
throw new Exception($dsq->get_last_error());
|
13 |
-
}
|
14 |
-
|
15 |
-
|
16 |
-
To run the included unit tests you will need to install PHPUnit::
|
17 |
-
|
18 |
-
php disqus/tests.php <your user_api_key>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/lib/api/disqus/disqus.php
DELETED
@@ -1,461 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Implementation of the Disqus v1.1 API.
|
4 |
-
*
|
5 |
-
* http://groups.google.com/group/disqus-dev/web/api-1-1
|
6 |
-
*
|
7 |
-
* @author Disqus <team@disqus.com>
|
8 |
-
* @copyright 2007-2010 Big Head Labs
|
9 |
-
* @link http://disqus.com/
|
10 |
-
* @package Disqus
|
11 |
-
* @version 1.1
|
12 |
-
*/
|
13 |
-
|
14 |
-
require_once(dirname(__FILE__) . '/url.php');
|
15 |
-
|
16 |
-
/** @#+
|
17 |
-
* Constants
|
18 |
-
*/
|
19 |
-
/**
|
20 |
-
* Base URL for Disqus.
|
21 |
-
*/
|
22 |
-
|
23 |
-
define('DISQUS_TYPE_SPAM', 'spam');
|
24 |
-
define('DISQUS_TYPE_DELETED', 'killed');
|
25 |
-
define('DISQUS_TYPE_KILLED', DISQUS_TYPE_DELETED);
|
26 |
-
define('DISQUS_TYPE_NEW', 'new');
|
27 |
-
|
28 |
-
define('DISQUS_STATE_APPROVED', 'approved');
|
29 |
-
define('DISQUS_STATE_UNAPPROVED', 'unapproved');
|
30 |
-
define('DISQUS_STATE_SPAM', 'spam');
|
31 |
-
define('DISQUS_STATE_DELETED', 'killed');
|
32 |
-
define('DISQUS_STATE_KILLED', DISQUS_STATE_DELETED);
|
33 |
-
|
34 |
-
define('DISQUS_ACTION_SPAM', 'spam');
|
35 |
-
define('DISQUS_ACTION_APPROVE', 'approve');
|
36 |
-
define('DISQUS_ACTION_DELETE', 'delete');
|
37 |
-
define('DISQUS_ACTION_KILL', 'kill');
|
38 |
-
|
39 |
-
if (!extension_loaded('json')) {
|
40 |
-
require_once(dirname(__FILE__) . '/json.php');
|
41 |
-
function dsq_json_decode($data) {
|
42 |
-
$json = new JSON;
|
43 |
-
return $json->unserialize($data);
|
44 |
-
}
|
45 |
-
} else {
|
46 |
-
function dsq_json_decode($data) {
|
47 |
-
return json_decode($data);
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Helper methods for all of the Disqus 1.1 API methods.
|
53 |
-
*
|
54 |
-
* @package Disqus
|
55 |
-
* @author DISQUS.com <team@disqus.com>
|
56 |
-
* @copyright 2007-2010 Big Head Labs
|
57 |
-
* @version 1.1
|
58 |
-
*/
|
59 |
-
class DisqusAPI {
|
60 |
-
var $user_api_key;
|
61 |
-
var $forum_api_key;
|
62 |
-
var $api_url = 'https://www.disqus.com/api/';
|
63 |
-
var $api_version = '1.1';
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Creates a new interface to the Disqus API.
|
67 |
-
*
|
68 |
-
* @param $user_api_key
|
69 |
-
* (optional) The User API key to use.
|
70 |
-
* @param $forum_api_key
|
71 |
-
* (optional) The Forum API key to use.
|
72 |
-
* @param $api_url
|
73 |
-
* (optional) The prefix URL to use when calling the Disqus API.
|
74 |
-
*/
|
75 |
-
function DisqusAPI($user_api_key, $forum_api_key, $api_url='https://www.disqus.com/api/') {
|
76 |
-
$this->user_api_key = $user_api_key;
|
77 |
-
$this->forum_api_key = $forum_api_key;
|
78 |
-
$this->api_url = $api_url;
|
79 |
-
$this->last_error = null;
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Makes a call to a Disqus API method.
|
84 |
-
*
|
85 |
-
* @return
|
86 |
-
* The Disqus object.
|
87 |
-
* @param $method
|
88 |
-
* The Disqus API method to call.
|
89 |
-
* @param $args
|
90 |
-
* An associative array of arguments to be passed.
|
91 |
-
* @param $post
|
92 |
-
* TRUE or FALSE, depending on whether we're making a POST call.
|
93 |
-
*/
|
94 |
-
function call($method, $args=array(), $post=false) {
|
95 |
-
$url = $this->api_url . $method . '/';
|
96 |
-
|
97 |
-
if (!isset($args['user_api_key'])) {
|
98 |
-
$args['user_api_key'] = $this->user_api_key;
|
99 |
-
}
|
100 |
-
if (!isset($args['forum_api_key'])) {
|
101 |
-
$args['forum_api_key'] = $this->forum_api_key;
|
102 |
-
}
|
103 |
-
if (!isset($args['api_version'])) {
|
104 |
-
$args['api_version'] = $this->api_version;
|
105 |
-
}
|
106 |
-
|
107 |
-
foreach ($args as $key=>$value) {
|
108 |
-
// XXX: Disqus is lacking some exception handling and we sometimes
|
109 |
-
// end up with 500s when passing invalid values
|
110 |
-
if (empty($value)) unset($args[$key]);
|
111 |
-
}
|
112 |
-
|
113 |
-
if (!$post) {
|
114 |
-
$url .= '?' . dsq_get_query_string($args);
|
115 |
-
$args = null;
|
116 |
-
}
|
117 |
-
|
118 |
-
if (!($response = dsq_urlopen($url, $args)) || !$response['code']) {
|
119 |
-
$this->last_error = 'Unable to connect to the Disqus API servers';
|
120 |
-
return false;
|
121 |
-
}
|
122 |
-
|
123 |
-
if ($response['code'] != 200) {
|
124 |
-
if ($response['code'] == 500) {
|
125 |
-
// Try to grab the exception ID for better reporting
|
126 |
-
if (!empty($response['headers']['X-Sentry-ID'])) {
|
127 |
-
$this->last_error = 'DISQUS returned a bad response (HTTP '.$response['code'].', ReferenceID: '.$response['headers']['X-Sentry-ID'].')';
|
128 |
-
return false;
|
129 |
-
}
|
130 |
-
} elseif ($response['code'] == 400) {
|
131 |
-
$data = dsq_json_decode($response['data']);
|
132 |
-
if ($data && $data->message) {
|
133 |
-
$this->last_error = $data->message;
|
134 |
-
} else {
|
135 |
-
$this->last_error = "DISQUS returned a bad response (HTTP ".$response['code'].")";
|
136 |
-
}
|
137 |
-
return false;
|
138 |
-
}
|
139 |
-
$this->last_error = "DISQUS returned a bad response (HTTP ".$response['code'].")";
|
140 |
-
return false;
|
141 |
-
}
|
142 |
-
|
143 |
-
$data = dsq_json_decode($response['data']);
|
144 |
-
|
145 |
-
if (!$data) {
|
146 |
-
$this->last_error = 'No valid JSON content returned from Disqus';
|
147 |
-
return false;
|
148 |
-
}
|
149 |
-
|
150 |
-
if (!$data->succeeded) {
|
151 |
-
if (!$data->message) {
|
152 |
-
$this->last_error = '(No error message was received)';
|
153 |
-
} else {
|
154 |
-
$this->last_error = $data->message;
|
155 |
-
}
|
156 |
-
return false;
|
157 |
-
}
|
158 |
-
|
159 |
-
$this->last_error = null;
|
160 |
-
|
161 |
-
return $data->message;
|
162 |
-
}
|
163 |
-
|
164 |
-
/**
|
165 |
-
* Retrieve the last error message recorded.
|
166 |
-
*
|
167 |
-
* @return
|
168 |
-
* The last recorded error from the API
|
169 |
-
*/
|
170 |
-
function get_last_error() {
|
171 |
-
if (empty($this->last_error)) return;
|
172 |
-
if (!is_string($this->last_error)) {
|
173 |
-
return var_export($this->last_error);
|
174 |
-
}
|
175 |
-
return $this->last_error;
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Validate API key and get username.
|
180 |
-
*
|
181 |
-
* @return
|
182 |
-
* Username matching the API key
|
183 |
-
*/
|
184 |
-
function get_user_name() {
|
185 |
-
return $this->call('get_user_name', array(), true);
|
186 |
-
}
|
187 |
-
|
188 |
-
/**
|
189 |
-
* Returns an array of hashes representing all forums the user owns.
|
190 |
-
*
|
191 |
-
* @return
|
192 |
-
* An array of hashes representing all forums the user owns.
|
193 |
-
*/
|
194 |
-
function get_forum_list() {
|
195 |
-
return $this->call('get_forum_list');
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* Get a forum API key for a specific forum.
|
200 |
-
*
|
201 |
-
* @param $forum_id
|
202 |
-
* the unique id of the forum
|
203 |
-
* @return
|
204 |
-
* A string which is the Forum Key for the given forum.
|
205 |
-
*/
|
206 |
-
function get_forum_api_key($forum_id) {
|
207 |
-
$params = array(
|
208 |
-
'forum_id' => $forum_id,
|
209 |
-
);
|
210 |
-
|
211 |
-
return $this->call('get_forum_api_key', $params);
|
212 |
-
}
|
213 |
-
|
214 |
-
/**
|
215 |
-
* Get a list of comments on a website.
|
216 |
-
*
|
217 |
-
* Both filter and exclude are multivalue arguments with comma as a divider.
|
218 |
-
* That makes is possible to use combined requests. For example, if you want
|
219 |
-
* to get all deleted spam messages, your filter argument should contain
|
220 |
-
* 'spam,killed' string.
|
221 |
-
*
|
222 |
-
* @param $forum_id
|
223 |
-
* The forum ID.
|
224 |
-
* @param $params
|
225 |
-
* - limit: Number of entries that should be included in the response. Default is 25.
|
226 |
-
* - start: Starting point for the query. Default is 0.
|
227 |
-
* - filter: Type of entries that should be returned.
|
228 |
-
* - exclude: Type of entries that should be excluded from the response.
|
229 |
-
* @return
|
230 |
-
* Returns posts from a forum specified by id.
|
231 |
-
*/
|
232 |
-
function get_forum_posts($forum_id, $params=array()) {
|
233 |
-
$params['forum_id'] = $forum_id;
|
234 |
-
|
235 |
-
return $this->call('get_forum_posts', $params);
|
236 |
-
}
|
237 |
-
|
238 |
-
/**
|
239 |
-
* Count a number of comments in articles.
|
240 |
-
*
|
241 |
-
* @param $thread_ids
|
242 |
-
* an array of thread IDs belonging to the given forum.
|
243 |
-
* @return
|
244 |
-
* A hash having thread_ids as keys and 2-element arrays as values.
|
245 |
-
*/
|
246 |
-
function get_num_posts($thread_ids) {
|
247 |
-
$params = array(
|
248 |
-
'thread_ids' => is_array($thread_ids) ? implode(',', $thread_ids) : $thread_ids,
|
249 |
-
);
|
250 |
-
|
251 |
-
return $this->call('get_num_posts', $params);
|
252 |
-
}
|
253 |
-
|
254 |
-
/**
|
255 |
-
* Returns a list of categories that were created for a website (forum) provided.
|
256 |
-
*
|
257 |
-
* @param $forum_id
|
258 |
-
* the unique of the forum
|
259 |
-
* @return
|
260 |
-
* A hash containing category_id, title, forum_id, and is_default.
|
261 |
-
*/
|
262 |
-
function get_categories_list($forum_id) {
|
263 |
-
$params = array(
|
264 |
-
'forum_id' => $forum_id,
|
265 |
-
);
|
266 |
-
|
267 |
-
return $this->call('get_categories_list', $params);
|
268 |
-
}
|
269 |
-
|
270 |
-
/**
|
271 |
-
* Get a list of threads on a website.
|
272 |
-
*
|
273 |
-
* @param $forum_id
|
274 |
-
* the unique id of the forum.
|
275 |
-
* @param $params
|
276 |
-
* - limit: Number of entries that should be included in the response. Default is 25.
|
277 |
-
* - start: Starting point for the query. Default is 0.
|
278 |
-
* - category_id: Filter entries by category
|
279 |
-
* @return
|
280 |
-
* An array of hashes representing all threads belonging to the given forum.
|
281 |
-
*/
|
282 |
-
function get_thread_list($forum_id, $params=array()) {
|
283 |
-
$params['forum_id'] = $forum_id;
|
284 |
-
|
285 |
-
return $this->call('get_thread_list', $params);
|
286 |
-
}
|
287 |
-
|
288 |
-
/**
|
289 |
-
* Get a list of threads with new comments.
|
290 |
-
*
|
291 |
-
* @param $forum_id
|
292 |
-
* The Forum ID.
|
293 |
-
* @param $since
|
294 |
-
* Start date for new posts. Format: 2009-03-30T15:41, Timezone: UTC.
|
295 |
-
* @return
|
296 |
-
* An array of hashes representing all threads with new comments since offset.
|
297 |
-
*/
|
298 |
-
function get_updated_threads($forum_id, $since) {
|
299 |
-
$params = array(
|
300 |
-
'forum_id' => $forum_id,
|
301 |
-
'since' => is_string($since) ? $string : strftime('%Y-%m-%dT%H:%M', $since),
|
302 |
-
);
|
303 |
-
|
304 |
-
return $this->call('get_updated_threads', $params);
|
305 |
-
}
|
306 |
-
|
307 |
-
/**
|
308 |
-
* Get a list of comments in a thread.
|
309 |
-
*
|
310 |
-
* Both filter and exclude are multivalue arguments with comma as a divider.
|
311 |
-
* That makes is possible to use combined requests. For example, if you want
|
312 |
-
* to get all deleted spam messages, your filter argument should contain
|
313 |
-
* 'spam,killed' string. Note that values are joined by AND statement so
|
314 |
-
* 'spam,new' will return all messages that are new and marked as spam. It
|
315 |
-
* will not return messages that are new and not spam or that are spam but
|
316 |
-
* not new (i.e. has already been moderated).
|
317 |
-
*
|
318 |
-
* @param $thread_id
|
319 |
-
* The ID of a thread belonging to the given forum
|
320 |
-
* @param $params
|
321 |
-
* - limit: Number of entries that should be included in the response. Default is 25.
|
322 |
-
* - start: Starting point for the query. Default is 0.
|
323 |
-
* - filter: Type of entries that should be returned (new, spam or killed).
|
324 |
-
* - exclude: Type of entries that should be excluded from the response (new, spam or killed).
|
325 |
-
* @return
|
326 |
-
* An array of hashes representing representing all posts belonging to the
|
327 |
-
* given forum.
|
328 |
-
*/
|
329 |
-
function get_thread_posts($thread_id, $params=array()) {
|
330 |
-
$params['thread_id'] = $thread_id;
|
331 |
-
|
332 |
-
return $this->call('get_thread_posts', $params);
|
333 |
-
}
|
334 |
-
|
335 |
-
/**
|
336 |
-
* Get or create thread by identifier.
|
337 |
-
*
|
338 |
-
* This method tries to find a thread by its identifier and title. If there is
|
339 |
-
* no such thread, the method creates it. In either case, the output value is
|
340 |
-
* a thread object.
|
341 |
-
*
|
342 |
-
* @param $identifier
|
343 |
-
* Unique value (per forum) for a thread that is used to keep be able to get
|
344 |
-
* data even if permalink is changed.
|
345 |
-
* @param $title
|
346 |
-
* The title of the thread to possibly be created.
|
347 |
-
* @param $params
|
348 |
-
* - category_id: Filter entries by category
|
349 |
-
* - create_on_fail: if thread does not exist, the method will create it
|
350 |
-
* @return
|
351 |
-
* Returns a hash with two keys:
|
352 |
-
* - thread: a hash representing the thread corresponding to the identifier.
|
353 |
-
* - created: indicates whether the thread was created as a result of this
|
354 |
-
* method call. If created, it will have the specified title.
|
355 |
-
*/
|
356 |
-
function thread_by_identifier($identifier, $title, $params=array()) {
|
357 |
-
$params['identifier'] = $identifier;
|
358 |
-
$params['title'] = $title;
|
359 |
-
|
360 |
-
return $this->call('thread_by_identifier', $params, true);
|
361 |
-
}
|
362 |
-
|
363 |
-
/**
|
364 |
-
* Get thread by URL.
|
365 |
-
*
|
366 |
-
* Finds a thread by its URL. Output value is a thread object.
|
367 |
-
*
|
368 |
-
* @param $url
|
369 |
-
* the URL to check for an associated thread
|
370 |
-
* @param $partner_api_key
|
371 |
-
* (optional) The Partner API key.
|
372 |
-
* @return
|
373 |
-
* A thread object, otherwise NULL.
|
374 |
-
*/
|
375 |
-
function get_thread_by_url($url, $partner_api_key=null) {
|
376 |
-
$params = array(
|
377 |
-
'url' => $url,
|
378 |
-
'partner_api_key' => $partner_api_key,
|
379 |
-
);
|
380 |
-
|
381 |
-
return $this->call('get_thread_by_url', $params);
|
382 |
-
}
|
383 |
-
|
384 |
-
/**
|
385 |
-
* Updates thread.
|
386 |
-
*
|
387 |
-
* Updates thread, specified by id and forum API key, with values described in
|
388 |
-
* the optional arguments.
|
389 |
-
*
|
390 |
-
* @param $thread_id
|
391 |
-
* the ID of a thread belonging to the given forum
|
392 |
-
* @param $params
|
393 |
-
* - title: the title of the thread
|
394 |
-
* - slug: the per-forum-unique string used for identifying this thread in
|
395 |
-
* disqus.com URL’s relating to this thread. Composed of
|
396 |
-
* underscore-separated alphanumeric strings.
|
397 |
-
* - url: the URL this thread is on, if known.
|
398 |
-
* - allow_comments: whether this thread is open to new comments
|
399 |
-
* @return
|
400 |
-
* Returns an empty success message.
|
401 |
-
*/
|
402 |
-
function update_thread($thread_id, $params=array()) {
|
403 |
-
$params['thread_id'] = $thread_id;
|
404 |
-
|
405 |
-
return $this->call('update_thread', $params, true);
|
406 |
-
}
|
407 |
-
|
408 |
-
/**
|
409 |
-
* Creates a new post.
|
410 |
-
*
|
411 |
-
* Creates a comment to the thread specified by id.
|
412 |
-
*
|
413 |
-
* @param $thread_id
|
414 |
-
* the thread to post to
|
415 |
-
* @param $message
|
416 |
-
* the content of the post
|
417 |
-
* @param $author_name
|
418 |
-
* the post creator’s name
|
419 |
-
* @param $author_email
|
420 |
-
* the post creator’s email address
|
421 |
-
* @param $params
|
422 |
-
* - partner_api_key
|
423 |
-
* - created_at: Format: 2009-03-30T15:41, Timezone: UTC
|
424 |
-
* - ip_address: the author’s IP address
|
425 |
-
* - author_url: the author's homepage
|
426 |
-
* - parent_post: the id of the parent post
|
427 |
-
* - state: Comment's state, must be one of the following: approved,
|
428 |
-
* unapproved, spam, killed
|
429 |
-
* @return
|
430 |
-
* Returns modified version.
|
431 |
-
*/
|
432 |
-
function create_post($thread_id, $message, $author_name, $author_email, $params=array()) {
|
433 |
-
$params['thread_id'] = $thread_id;
|
434 |
-
$params['message'] = $message;
|
435 |
-
$params['author_name'] = $author_name;
|
436 |
-
$params['author_email'] = $author_email;
|
437 |
-
|
438 |
-
return $this->call('create_post', $params, true);
|
439 |
-
}
|
440 |
-
|
441 |
-
/**
|
442 |
-
* Delete a comment or mark it as spam (or not spam).
|
443 |
-
*
|
444 |
-
* @param $post_id
|
445 |
-
* The Post ID.
|
446 |
-
* @param $action
|
447 |
-
* Name of action to be performed. Value can be 'spam', 'approve' or 'kill'.
|
448 |
-
* @return
|
449 |
-
* Returns modified version.
|
450 |
-
*/
|
451 |
-
function moderate_post($post_id, $action) {
|
452 |
-
$params = array(
|
453 |
-
'post_id' => $post_id,
|
454 |
-
'action' => $action,
|
455 |
-
);
|
456 |
-
|
457 |
-
return $this->call('moderate_post', $params, true);
|
458 |
-
}
|
459 |
-
}
|
460 |
-
|
461 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/lib/api/disqus/json.php
DELETED
@@ -1,378 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
***************************************************************************
|
4 |
-
* Copyright (C) 2007 by Cesar D. Rodas *
|
5 |
-
* crodas@phpy.org *
|
6 |
-
* *
|
7 |
-
* Permission is hereby granted, free of charge, to any person obtaining *
|
8 |
-
* a copy of this software and associated documentation files (the *
|
9 |
-
* "Software"), to deal in the Software without restriction, including *
|
10 |
-
* without limitation the rights to use, copy, modify, merge, publish, *
|
11 |
-
* distribute, sublicense, and/or sell copies of the Software, and to *
|
12 |
-
* permit persons to whom the Software is furnished to do so, subject to *
|
13 |
-
* the following conditions: *
|
14 |
-
* *
|
15 |
-
* The above copyright notice and this permission notice shall be *
|
16 |
-
* included in all copies or substantial portions of the Software. *
|
17 |
-
* *
|
18 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
|
19 |
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
20 |
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
|
21 |
-
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR *
|
22 |
-
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
|
23 |
-
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
|
24 |
-
* OTHER DEALINGS IN THE SOFTWARE. *
|
25 |
-
***************************************************************************
|
26 |
-
*/
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Serialize and Unserialize PHP Objects and array
|
30 |
-
* into JSON notation.
|
31 |
-
*
|
32 |
-
* @category Javascript
|
33 |
-
* @package JSON
|
34 |
-
* @author Cesar D. Rodas <crodas@phpy.org>
|
35 |
-
* @copyright 2007 Cesar D. Rodas
|
36 |
-
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
37 |
-
* @version 1.0
|
38 |
-
* @link http://cesars.users.phpclasses.org/json
|
39 |
-
*/
|
40 |
-
|
41 |
-
define('IN_NOWHERE',0);
|
42 |
-
define('IN_STRING',1);
|
43 |
-
define('IN_OBJECT',2);
|
44 |
-
define('IN_ATOMIC',3);
|
45 |
-
define('IN_ASSIGN',4);
|
46 |
-
define('IN_ENDSTMT',5);
|
47 |
-
define('IN_ARRAY',6);
|
48 |
-
|
49 |
-
/**
|
50 |
-
* JSON
|
51 |
-
*
|
52 |
-
* This class serilize an PHP OBJECT or an ARRAY into JSON
|
53 |
-
* notation. Also convert a JSON text into a PHP OBJECT or
|
54 |
-
* array.
|
55 |
-
*
|
56 |
-
* @category Javascript
|
57 |
-
* @package JSON
|
58 |
-
* @author Cesar D. Rodas <crodas@phpy.org>
|
59 |
-
* @copyright 2007 Cesar D. Rodas
|
60 |
-
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
61 |
-
* @version 1.0
|
62 |
-
* @link http://cesars.users.phpclasses.org/json
|
63 |
-
*/
|
64 |
-
class JSON
|
65 |
-
{
|
66 |
-
/**
|
67 |
-
* Was parsed with an error?
|
68 |
-
*
|
69 |
-
* var bool
|
70 |
-
* @access private
|
71 |
-
*/
|
72 |
-
var $error;
|
73 |
-
|
74 |
-
function Json() {
|
75 |
-
$this->error = false;
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Serialize
|
80 |
-
*
|
81 |
-
* Serialize a PHP OBJECT or an ARRAY into
|
82 |
-
* JSON notation.
|
83 |
-
*
|
84 |
-
* param mixed $obj Object or array to serialize
|
85 |
-
* return string JSON.
|
86 |
-
*/
|
87 |
-
function serialize($obj) {
|
88 |
-
if ( is_object($obj) ) {
|
89 |
-
$e = get_object_vars($obj);
|
90 |
-
/* bug reported by Ben Rowe */
|
91 |
-
/* Adding default empty array if the */
|
92 |
-
/* object doesn't have any property */
|
93 |
-
$properties = array();
|
94 |
-
foreach ($e as $k => $v) {
|
95 |
-
$properties[] = $this->_serialize( $k,$v );
|
96 |
-
}
|
97 |
-
return "{".implode(",",$properties)."}";
|
98 |
-
} else if ( is_array($obj) ) {
|
99 |
-
return $this->_serialize('',$obj);
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
/**
|
104 |
-
* UnSerialize
|
105 |
-
*
|
106 |
-
* Transform an JSON text into a PHP object
|
107 |
-
* and return it.
|
108 |
-
* @access public
|
109 |
-
* @param string $text JSON text
|
110 |
-
* @return mixed PHP Object, array or false.
|
111 |
-
*/
|
112 |
-
function unserialize( $text ) {
|
113 |
-
$this->error = false;
|
114 |
-
|
115 |
-
return !$this->error ? $this->_unserialize($text) : false;
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* UnSerialize
|
120 |
-
*
|
121 |
-
* Transform an JSON text into a PHP object
|
122 |
-
* and return it.
|
123 |
-
* @access private
|
124 |
-
* @param string $text JSON text
|
125 |
-
* @return mixed PHP Object, array or false.
|
126 |
-
*/
|
127 |
-
function _unserialize($text) {
|
128 |
-
$ret = new stdClass;
|
129 |
-
|
130 |
-
while ( $f = $this->getNextToken($text,$i,$type) ) {
|
131 |
-
switch ( $type ) {
|
132 |
-
case IN_ARRAY:
|
133 |
-
$tmp = $this->_unserializeArray($text);
|
134 |
-
$ret = $tmp[0];
|
135 |
-
break;
|
136 |
-
case IN_OBJECT:
|
137 |
-
$g=0;
|
138 |
-
do {
|
139 |
-
$varName = $this->getNextToken($f,$g,$xType);
|
140 |
-
if ( $xType != IN_STRING ) {
|
141 |
-
return false; /* error parsing */
|
142 |
-
}
|
143 |
-
$this->getNextToken($f,$g,$xType);
|
144 |
-
if ( $xType != IN_ASSIGN) return false;
|
145 |
-
$value = $this->getNextToken($f,$g,$xType);
|
146 |
-
|
147 |
-
if ( $xType == IN_OBJECT) {
|
148 |
-
$ret->$varName = $this->unserialize( "{".$value."}" );
|
149 |
-
$g--;
|
150 |
-
} else if ($xType == IN_ARRAY) {
|
151 |
-
$ret->$varName = $this->_unserializeArray( $value);
|
152 |
-
$g--;
|
153 |
-
} else
|
154 |
-
$ret->$varName = $value;
|
155 |
-
|
156 |
-
$this->getNextToken($f,$g,$xType);
|
157 |
-
} while ( $xType == IN_ENDSTMT);
|
158 |
-
break;
|
159 |
-
default:
|
160 |
-
$this->error = true;
|
161 |
-
break 2;
|
162 |
-
}
|
163 |
-
}
|
164 |
-
return $ret;
|
165 |
-
}
|
166 |
-
|
167 |
-
/**
|
168 |
-
* JSON Array Parser
|
169 |
-
*
|
170 |
-
* This method transform an json-array into a PHP
|
171 |
-
* array
|
172 |
-
* @access private
|
173 |
-
* @param string $text String to parse
|
174 |
-
* @return Array PHP Array
|
175 |
-
*/
|
176 |
-
function _unserializeArray($text) {
|
177 |
-
$r = array();
|
178 |
-
do {
|
179 |
-
$f = $this->getNextToken($text,$i,$type);
|
180 |
-
switch ( $type ) {
|
181 |
-
case IN_STRING:
|
182 |
-
case IN_ATOMIC:
|
183 |
-
$r[] = $f;
|
184 |
-
break;
|
185 |
-
case IN_OBJECT:
|
186 |
-
$r[] = $this->unserialize("{".$f."}");
|
187 |
-
$i--;
|
188 |
-
break;
|
189 |
-
case IN_ARRAY:
|
190 |
-
$r[] = $this->_unserializeArray($f);
|
191 |
-
$i--;
|
192 |
-
break;
|
193 |
-
|
194 |
-
}
|
195 |
-
$this->getNextToken($text,$i,$type);
|
196 |
-
} while ( $type == IN_ENDSTMT);
|
197 |
-
|
198 |
-
return $r;
|
199 |
-
}
|
200 |
-
|
201 |
-
/**
|
202 |
-
* Tokenizer
|
203 |
-
*
|
204 |
-
* Return to the Parser the next valid token and the type
|
205 |
-
* of the token. If the tokenizer fails it returns false.
|
206 |
-
*
|
207 |
-
* @access private
|
208 |
-
* @param string $e Text to extract token
|
209 |
-
* @param integer $i Start position to search next token
|
210 |
-
* @param integer $state Variable to get the token type
|
211 |
-
* @return string|bool Token in string or false on error.
|
212 |
-
*/
|
213 |
-
function getNextToken($e, &$i, &$state) {
|
214 |
-
$state = IN_NOWHERE;
|
215 |
-
$end = -1;
|
216 |
-
$start = -1;
|
217 |
-
while ( $i < strlen($e) && $end == -1 ) {
|
218 |
-
switch( $e[$i] ) {
|
219 |
-
/* objects */
|
220 |
-
case "{":
|
221 |
-
case "[":
|
222 |
-
$_tag = $e[$i];
|
223 |
-
$_endtag = $_tag == "{" ? "}" : "]";
|
224 |
-
if ( $state == IN_NOWHERE ) {
|
225 |
-
$start = $i+1;
|
226 |
-
switch ($state) {
|
227 |
-
case IN_NOWHERE:
|
228 |
-
$aux = 1; /* for loop objects */
|
229 |
-
$state = $_tag == "{" ? IN_OBJECT : IN_ARRAY;
|
230 |
-
break;
|
231 |
-
default:
|
232 |
-
break 2; /* exit from switch and while */
|
233 |
-
}
|
234 |
-
while ( ++$i && $i < strlen($e) && $aux != 0 ) {
|
235 |
-
switch( $e[$i] ) {
|
236 |
-
case $_tag:
|
237 |
-
$aux++;
|
238 |
-
break;
|
239 |
-
case $_endtag:
|
240 |
-
$aux--;
|
241 |
-
break;
|
242 |
-
}
|
243 |
-
}
|
244 |
-
$end = $i-1;
|
245 |
-
}
|
246 |
-
break;
|
247 |
-
|
248 |
-
case '"':
|
249 |
-
case "'":
|
250 |
-
$state = IN_STRING;
|
251 |
-
$buf = "";
|
252 |
-
while ( ++$i && $i < strlen($e) && $e[$i] != '"' ) {
|
253 |
-
if ( $e[$i] == "\\")
|
254 |
-
$i++;
|
255 |
-
$buf .= $e[$i];
|
256 |
-
}
|
257 |
-
$i++;
|
258 |
-
return $buf;
|
259 |
-
break;
|
260 |
-
case ":":
|
261 |
-
$state = IN_ASSIGN;
|
262 |
-
$end = 1;
|
263 |
-
break;
|
264 |
-
case "n":
|
265 |
-
if ( substr($e,$i,4) == "null" ) {
|
266 |
-
$i=$i+4;
|
267 |
-
$state = IN_ATOMIC;
|
268 |
-
return NULL;
|
269 |
-
}
|
270 |
-
else break 2; /* exit from switch and while */
|
271 |
-
case "t":
|
272 |
-
if ( substr($e,$i,4) == "true") {
|
273 |
-
$state = IN_ATOMIC;
|
274 |
-
$i=$i+4;
|
275 |
-
return true;
|
276 |
-
}
|
277 |
-
else break 2; /* exit from switch and while */
|
278 |
-
break;
|
279 |
-
case "f":
|
280 |
-
if ( substr($e,$i,5) == "false") {
|
281 |
-
$state = IN_ATOMIC;
|
282 |
-
$i=$i+5;
|
283 |
-
return false;
|
284 |
-
}
|
285 |
-
else break 2; /* exit from switch and while */
|
286 |
-
break;
|
287 |
-
case ",":
|
288 |
-
$state = IN_ENDSTMT;
|
289 |
-
$end = 1;
|
290 |
-
break;
|
291 |
-
case " ":
|
292 |
-
case "\t":
|
293 |
-
case "\r":
|
294 |
-
case "\n":
|
295 |
-
break;
|
296 |
-
case "+":
|
297 |
-
case "-":
|
298 |
-
case 0:
|
299 |
-
case 1:
|
300 |
-
case 2:
|
301 |
-
case 3:
|
302 |
-
case 4:
|
303 |
-
case 5:
|
304 |
-
case 6:
|
305 |
-
case 7:
|
306 |
-
case 8:
|
307 |
-
case 9:
|
308 |
-
case '.':
|
309 |
-
$state = IN_ATOMIC;
|
310 |
-
$start = (int)$i;
|
311 |
-
if ( $e[$i] == "-" || $e[$i] == "+")
|
312 |
-
$i++;
|
313 |
-
for ( ; $i < strlen($e) && (is_numeric($e[$i]) || $e[$i] == "." || strtolower($e[$i]) == "e") ;$i++){
|
314 |
-
$n = $i+1 < strlen($e) ? $e[$i+1] : "";
|
315 |
-
$a = strtolower($e[$i]);
|
316 |
-
if ( $a == "e" && ($n == "+" || $n == "-"))
|
317 |
-
$i++;
|
318 |
-
else if ( $a == "e")
|
319 |
-
$this->error=true;
|
320 |
-
}
|
321 |
-
|
322 |
-
$end = $i;
|
323 |
-
break 2; /* break while too */
|
324 |
-
default:
|
325 |
-
$this->error = true;
|
326 |
-
|
327 |
-
}
|
328 |
-
$i++;
|
329 |
-
}
|
330 |
-
|
331 |
-
return $start == -1 || $end == -1 ? false : substr($e, $start, $end - $start);
|
332 |
-
}
|
333 |
-
|
334 |
-
/**
|
335 |
-
* Internal Serializer
|
336 |
-
*
|
337 |
-
* @param string $key Variable name
|
338 |
-
* @param mixed $value Value of the variable
|
339 |
-
* @access private
|
340 |
-
* @return string Serialized variable
|
341 |
-
*/
|
342 |
-
function _serialize ( $key = '', &$value ) {
|
343 |
-
$r = '';
|
344 |
-
if ( $key != '')$r .= "\"${key}\" : ";
|
345 |
-
if ( is_numeric($value) ) {
|
346 |
-
$r .= ''.$value.'';
|
347 |
-
} else if ( is_string($value) ) {
|
348 |
-
$r .= '"'.$this->toString($value).'"';
|
349 |
-
} else if ( is_object($value) ) {
|
350 |
-
$r .= $this->serialize($value);
|
351 |
-
} else if ( is_null($value) ) {
|
352 |
-
$r .= "null";
|
353 |
-
} else if ( is_bool($value) ) {
|
354 |
-
$r .= $value ? "true":"false";
|
355 |
-
} else if ( is_array($value) ) {
|
356 |
-
foreach($value as $k => $v)
|
357 |
-
$f[] = $this->_serialize('',$v);
|
358 |
-
$r .= "[".implode(",",$f)."]";
|
359 |
-
unset($f);
|
360 |
-
}
|
361 |
-
return $r;
|
362 |
-
}
|
363 |
-
|
364 |
-
/**
|
365 |
-
* Convert String variables
|
366 |
-
*
|
367 |
-
* @param string $e Variable with an string value
|
368 |
-
* @access private
|
369 |
-
* @return string Serialized variable
|
370 |
-
*/
|
371 |
-
function toString($e) {
|
372 |
-
$rep = array("\\","\r","\n","\t","'",'"');
|
373 |
-
$val = array("\\\\",'\r','\n','\t','\'','\"');
|
374 |
-
$e = str_replace($rep, $val, $e);
|
375 |
-
return $e;
|
376 |
-
}
|
377 |
-
}
|
378 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/lib/api/disqus/url.php
DELETED
@@ -1,295 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
define('USER_AGENT', 'Disqus-WPPlugin/2.0-dev');
|
3 |
-
define('SOCKET_TIMEOUT', 10);
|
4 |
-
|
5 |
-
function dsq_get_query_string($postdata) {
|
6 |
-
$postdata_str = '';
|
7 |
-
|
8 |
-
if($postdata) {
|
9 |
-
foreach($postdata as $key=>$value) {
|
10 |
-
$postdata_str .= urlencode($key) . '=' . urlencode($value) . '&';
|
11 |
-
}
|
12 |
-
}
|
13 |
-
|
14 |
-
return $postdata_str;
|
15 |
-
}
|
16 |
-
|
17 |
-
|
18 |
-
function dsq_get_post_content($boundary, $postdata, $file_name, $file_field) {
|
19 |
-
if(empty($file_name) || empty($file_field)) {
|
20 |
-
return dsq_get_query_string($postdata);
|
21 |
-
}
|
22 |
-
|
23 |
-
$content = array();
|
24 |
-
$content[] = '--' . $boundary;
|
25 |
-
foreach($postdata as $key=>$value) {
|
26 |
-
$content[] = 'Content-Disposition: form-data; name="' . $key . '"' . "\r\n\r\n" . $value;
|
27 |
-
$content[] = '--' . $boundary;
|
28 |
-
}
|
29 |
-
$content[] = 'Content-Disposition: form-data; name="' . $file_field . '"; filename="' . $file_name . '"';
|
30 |
-
// HACK: We only need to handle text/plain files right now.
|
31 |
-
$content[] = "Content-Type: text/plain\r\n";
|
32 |
-
$content[] = file_get_contents($file_name);
|
33 |
-
$content[] = '--' . $boundary . '--';
|
34 |
-
$content = implode("\r\n", $content);
|
35 |
-
return $content;
|
36 |
-
}
|
37 |
-
|
38 |
-
|
39 |
-
function dsq_get_http_headers_for_request($boundary, $content, $file_name, $file_field) {
|
40 |
-
$headers = array();
|
41 |
-
$headers[] = 'User-Agent: ' . USER_AGENT;
|
42 |
-
$headers[] = 'Connection: close';
|
43 |
-
if($content) {
|
44 |
-
$headers[] = 'Content-Length: ' . strlen($content);
|
45 |
-
if($file_name && $file_field) {
|
46 |
-
$headers[] = 'Content-Type: multipart/form-data; boundary=' . $boundary;
|
47 |
-
} else {
|
48 |
-
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
|
49 |
-
}
|
50 |
-
}
|
51 |
-
return implode("\r\n", $headers);
|
52 |
-
}
|
53 |
-
|
54 |
-
|
55 |
-
function _dsq_curl_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
56 |
-
$c = curl_init($url);
|
57 |
-
$postdata_str = dsq_get_query_string($postdata);
|
58 |
-
|
59 |
-
$c_options = array(
|
60 |
-
CURLOPT_USERAGENT => USER_AGENT,
|
61 |
-
CURLOPT_RETURNTRANSFER => true,
|
62 |
-
CURLOPT_POST => ($postdata_str ? 1 : 0),
|
63 |
-
CURLOPT_HEADER => true,
|
64 |
-
CURLOPT_HTTPHEADER => array('Expect:'),
|
65 |
-
CURLOPT_TIMEOUT => SOCKET_TIMEOUT
|
66 |
-
);
|
67 |
-
if($postdata) {
|
68 |
-
$c_options[CURLOPT_POSTFIELDS] = $postdata_str;
|
69 |
-
}
|
70 |
-
if($file_name && $file_field) {
|
71 |
-
$postdata[$file_field] = '@' . $file_name;
|
72 |
-
$c_options[CURLOPT_POSTFIELDS] = $postdata;
|
73 |
-
$c_options[CURLOPT_RETURNTRANSFER] = 1;
|
74 |
-
}
|
75 |
-
curl_setopt_array($c, $c_options);
|
76 |
-
|
77 |
-
$data = curl_exec($c);
|
78 |
-
list($headers, $response['data']) = explode("\r\n\r\n", $data, 2);
|
79 |
-
|
80 |
-
$response['headers'] = _dsq_get_response_headers($headers, $response);
|
81 |
-
$response['code'] = curl_getinfo($c, CURLINFO_HTTP_CODE);
|
82 |
-
}
|
83 |
-
|
84 |
-
function _dsq_get_response_headers($headers, &$response) {
|
85 |
-
$headers = explode("\r\n", $headers);
|
86 |
-
list($unused, $response['code'], $unused) = explode(' ', $headers[0], 3);
|
87 |
-
$headers = array_slice($headers, 1);
|
88 |
-
|
89 |
-
// Convert headers into associative array.
|
90 |
-
foreach($headers as $unused=>$header) {
|
91 |
-
$header = explode(':', $header);
|
92 |
-
$header[0] = trim($header[0]);
|
93 |
-
$header[1] = trim($header[1]);
|
94 |
-
$headers[strtolower($header[0])] = $header[1];
|
95 |
-
}
|
96 |
-
|
97 |
-
return $headers;
|
98 |
-
}
|
99 |
-
|
100 |
-
function _dsq_fsockopen_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
101 |
-
$buf = '';
|
102 |
-
$req = '';
|
103 |
-
$length = 0;
|
104 |
-
$boundary = '----------' . md5(time());
|
105 |
-
$postdata_str = dsq_get_post_content($boundary, $postdata, $file_name, $file_field);
|
106 |
-
$url_pieces = parse_url($url);
|
107 |
-
|
108 |
-
// Set default port for supported schemes if none is provided.
|
109 |
-
if(!isset($url_pieces['port'])) {
|
110 |
-
switch($url_pieces['scheme']) {
|
111 |
-
case 'http':
|
112 |
-
$url_pieces['port'] = 80;
|
113 |
-
break;
|
114 |
-
case 'https':
|
115 |
-
$url_pieces['port'] = 443;
|
116 |
-
$url_pieces['host'] = 'ssl://' . $url_pieces['host'];
|
117 |
-
break;
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
121 |
-
// Set default path if trailing slash is not provided.
|
122 |
-
if(!isset($url_pieces['path'])) { $url_pieces['path'] = '/'; }
|
123 |
-
|
124 |
-
// Determine if we need to include the port in the Host header or not.
|
125 |
-
if(($url_pieces['port'] == 80 && $url_pieces['scheme'] == 'http') ||
|
126 |
-
($url_pieces['port'] == 443 && $url_pieces['scheme'] == 'https')) {
|
127 |
-
$host = $url_pieces['host'];
|
128 |
-
} else {
|
129 |
-
$host = $url_pieces['host'] . ':' . $url_pieces['port'];
|
130 |
-
}
|
131 |
-
|
132 |
-
$fp = @fsockopen($url_pieces['host'], $url_pieces['port'], $errno, $errstr, SOCKET_TIMEOUT);
|
133 |
-
if(!$fp) { return false; }
|
134 |
-
|
135 |
-
$path = $url_pieces['path'];
|
136 |
-
if ($url_pieces['query']) $path .= '?'.$url_pieces['query'];
|
137 |
-
|
138 |
-
$req .= ($postdata_str ? 'POST' : 'GET') . ' ' . $path . " HTTP/1.1\r\n";
|
139 |
-
$req .= 'Host: ' . $host . "\r\n";
|
140 |
-
$req .= dsq_get_http_headers_for_request($boundary, $postdata_str, $file_name, $file_field);
|
141 |
-
if($postdata_str) {
|
142 |
-
$req .= "\r\n\r\n" . $postdata_str;
|
143 |
-
}
|
144 |
-
$req .= "\r\n\r\n";
|
145 |
-
|
146 |
-
fwrite($fp, $req);
|
147 |
-
while(!feof($fp)) {
|
148 |
-
$buf .= fgets($fp, 4096);
|
149 |
-
}
|
150 |
-
|
151 |
-
// Parse headers from the response buffers.
|
152 |
-
list($headers, $response['data']) = explode("\r\n\r\n", $buf, 2);
|
153 |
-
|
154 |
-
// Get status code from headers.
|
155 |
-
$headers = _dsq_get_response_headers($headers, $response);
|
156 |
-
|
157 |
-
// If transfer-coding is set to chunked, we need to join the message body
|
158 |
-
// together.
|
159 |
-
if(isset($headers['transfer-encoding']) && 'chunked' == strtolower($headers['transfer-encoding'])) {
|
160 |
-
$chunk_data = $response['data'];
|
161 |
-
$joined_data = '';
|
162 |
-
while(true) {
|
163 |
-
// Strip length from body.
|
164 |
-
list($chunk_length, $chunk_data) = explode("\r\n", $chunk_data, 2);
|
165 |
-
$chunk_length = hexdec($chunk_length);
|
166 |
-
if(!$chunk_length || !strlen($chunk_data)) { break; }
|
167 |
-
|
168 |
-
$joined_data .= substr($chunk_data, 0, $chunk_length);
|
169 |
-
$chunk_data = substr($chunk_data, $chunk_length + 1);
|
170 |
-
$length += $chunk_length;
|
171 |
-
}
|
172 |
-
$response['data'] = $joined_data;
|
173 |
-
} else {
|
174 |
-
$length = $headers['content-length'];
|
175 |
-
}
|
176 |
-
$response['headers'] = $headers;
|
177 |
-
}
|
178 |
-
|
179 |
-
|
180 |
-
function _dsq_fopen_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
181 |
-
$params = array();
|
182 |
-
if($file_name && $file_field) {
|
183 |
-
$boundary = '----------' . md5(time());
|
184 |
-
$content = dsq_get_post_content($boundary, $postdata, $file_name, $file_field);
|
185 |
-
$header = dsq_get_http_headers_for_request($boundary, $content, $file_name, $file_field);
|
186 |
-
|
187 |
-
$params = array('http' => array(
|
188 |
-
'method' => 'POST',
|
189 |
-
'header' => $header,
|
190 |
-
'content' => $content,
|
191 |
-
'timeout' => SOCKET_TIMEOUT
|
192 |
-
));
|
193 |
-
} else {
|
194 |
-
if($postdata) {
|
195 |
-
$params = array('http' => array(
|
196 |
-
'method' => 'POST',
|
197 |
-
'header' => 'Content-Type: application/x-www-form-urlencoded',
|
198 |
-
'content' => dsq_get_query_string($postdata),
|
199 |
-
'timeout' => SOCKET_TIMEOUT
|
200 |
-
));
|
201 |
-
}
|
202 |
-
}
|
203 |
-
|
204 |
-
|
205 |
-
ini_set('user_agent', USER_AGENT);
|
206 |
-
$ctx = stream_context_create($params);
|
207 |
-
$fp = fopen($url, 'rb', false, $ctx);
|
208 |
-
if(!$fp) {
|
209 |
-
return false;
|
210 |
-
}
|
211 |
-
|
212 |
-
// Get status code from headers.
|
213 |
-
list($unused, $response['code'], $unused) = explode(' ', $http_response_header[0], 3);
|
214 |
-
$headers = array_slice($http_response_header, 1);
|
215 |
-
|
216 |
-
// Convert headers into associative array.
|
217 |
-
foreach($headers as $unused=>$header) {
|
218 |
-
$header = explode(':', $header);
|
219 |
-
$header[0] = trim($header[0]);
|
220 |
-
$header[1] = trim($header[1]);
|
221 |
-
$headers[strtolower($header[0])] = strtolower($header[1]);
|
222 |
-
}
|
223 |
-
|
224 |
-
$response['data'] = stream_get_contents($fp);
|
225 |
-
$response['headers'] = $headers;
|
226 |
-
}
|
227 |
-
|
228 |
-
|
229 |
-
/**
|
230 |
-
* Wrapper to provide a single interface for making an HTTP request.
|
231 |
-
*
|
232 |
-
* Attempts to use cURL, fopen(), or fsockopen(), whichever is available
|
233 |
-
* first.
|
234 |
-
*
|
235 |
-
* @param string $url URL to make request to.
|
236 |
-
* @param array $postdata (optional) If postdata is provided, the request
|
237 |
-
* method is POST with the key/value pairs as
|
238 |
-
* the data.
|
239 |
-
* @param array $file (optional) Should provide associative array
|
240 |
-
* with two keys: name and field. Name should
|
241 |
-
* be the name of the file and field is the name
|
242 |
-
* of the field to POST.
|
243 |
-
*/
|
244 |
-
function dsq_urlopen($url, $postdata=false, $file=false) {
|
245 |
-
$response = array(
|
246 |
-
'data' => '',
|
247 |
-
'code' => 0
|
248 |
-
);
|
249 |
-
|
250 |
-
if($file) {
|
251 |
-
extract($file, EXTR_PREFIX_ALL, 'file');
|
252 |
-
}
|
253 |
-
if(empty($file_name) || empty($file_field)) {
|
254 |
-
$file_name = false;
|
255 |
-
$file_field = false;
|
256 |
-
}
|
257 |
-
|
258 |
-
//
|
259 |
-
|
260 |
-
// Try curl, fsockopen, fopen + stream (PHP5 only), exec wget
|
261 |
-
if(function_exists('curl_init')) {
|
262 |
-
if (!function_exists('curl_setopt_array')) {
|
263 |
-
function curl_setopt_array(&$ch, $curl_options)
|
264 |
-
{
|
265 |
-
foreach ($curl_options as $option => $value) {
|
266 |
-
if (!curl_setopt($ch, $option, $value)) {
|
267 |
-
return false;
|
268 |
-
}
|
269 |
-
}
|
270 |
-
return true;
|
271 |
-
}
|
272 |
-
}
|
273 |
-
_dsq_curl_urlopen($url, $postdata, $response, $file_name, $file_field);
|
274 |
-
} else if(ini_get('allow_url_fopen') && function_exists('stream_get_contents')) {
|
275 |
-
_dsq_fopen_urlopen($url, $postdata, $response, $file_name, $file_field);
|
276 |
-
} else {
|
277 |
-
// TODO: Find the failure condition for fsockopen() (sockets?)
|
278 |
-
_dsq_fsockopen_urlopen($url, $postdata, $response, $file_name, $file_field);
|
279 |
-
}
|
280 |
-
|
281 |
-
// returns array with keys data and code (from headers)
|
282 |
-
|
283 |
-
return $response;
|
284 |
-
}
|
285 |
-
|
286 |
-
function dsq_url_method() {
|
287 |
-
if(function_exists('curl_init')) {
|
288 |
-
return 'curl';
|
289 |
-
} else if(ini_get('allow_url_fopen') && function_exists('stream_get_contents')) {
|
290 |
-
return 'fopen';
|
291 |
-
} else {
|
292 |
-
return 'fsockopen';
|
293 |
-
}
|
294 |
-
}
|
295 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/lib/wp-api.php
DELETED
@@ -1,107 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Implementation of the Disqus API designed for WordPress.
|
4 |
-
*
|
5 |
-
* @author Disqus <team@disqus.com>
|
6 |
-
* @copyright 2007-2010 Big Head Labs
|
7 |
-
* @link http://disqus.com/
|
8 |
-
* @package Disqus
|
9 |
-
* @subpackage DisqusWordPressAPI
|
10 |
-
* @version 2.0
|
11 |
-
*/
|
12 |
-
|
13 |
-
require_once(ABSPATH.WPINC.'/http.php');
|
14 |
-
require_once(dirname(__FILE__) . '/api/disqus/disqus.php');
|
15 |
-
/** @#+
|
16 |
-
* Constants
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* Base URL for Disqus.
|
20 |
-
*/
|
21 |
-
define('DISQUS_ALLOWED_HTML', '<b><u><i><h1><h2><h3><code><blockquote><br><hr>');
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Helper methods for all of the Disqus v2 API methods.
|
25 |
-
*
|
26 |
-
* @package Disqus
|
27 |
-
* @subpackage DisqusWordPressAPI
|
28 |
-
* @author DISQUS.com <team@disqus.com>
|
29 |
-
* @copyright 2007-2008 Big Head Labs
|
30 |
-
* @version 1.0
|
31 |
-
*/
|
32 |
-
class DisqusWordPressAPI {
|
33 |
-
var $short_name;
|
34 |
-
var $forum_api_key;
|
35 |
-
|
36 |
-
function DisqusWordPressAPI($short_name=null, $forum_api_key=null, $user_api_key=null) {
|
37 |
-
$this->short_name = $short_name;
|
38 |
-
$this->forum_api_key = $forum_api_key;
|
39 |
-
$this->user_api_key = $user_api_key;
|
40 |
-
$this->api = new DisqusAPI($user_api_key, $forum_api_key, DISQUS_API_URL);
|
41 |
-
}
|
42 |
-
|
43 |
-
function get_last_error() {
|
44 |
-
return $this->api->get_last_error();
|
45 |
-
}
|
46 |
-
|
47 |
-
function get_user_api_key($username, $password) {
|
48 |
-
$response = $this->api->call('get_user_api_key', array(
|
49 |
-
'username' => $username,
|
50 |
-
'password' => $password,
|
51 |
-
), true);
|
52 |
-
return $response;
|
53 |
-
}
|
54 |
-
|
55 |
-
function get_forum_list($user_api_key) {
|
56 |
-
$this->api->user_api_key = $user_api_key;
|
57 |
-
return $this->api->get_forum_list();
|
58 |
-
}
|
59 |
-
|
60 |
-
function get_forum_api_key($user_api_key, $id) {
|
61 |
-
$this->api->user_api_key = $user_api_key;
|
62 |
-
return $this->api->get_forum_api_key($id);
|
63 |
-
}
|
64 |
-
|
65 |
-
function get_forum_posts($start_id=0) {
|
66 |
-
$response = $this->api->get_forum_posts(null, array(
|
67 |
-
'filter' => 'approved',
|
68 |
-
'start_id' => $start_id,
|
69 |
-
'limit' => 100,
|
70 |
-
'order' => 'asc',
|
71 |
-
'full_info' => 1
|
72 |
-
));
|
73 |
-
return $response;
|
74 |
-
}
|
75 |
-
|
76 |
-
function import_wordpress_comments(&$wxr, $timestamp, $eof=true) {
|
77 |
-
$http = new WP_Http();
|
78 |
-
$response = $http->request(
|
79 |
-
DISQUS_IMPORTER_URL . 'api/import-wordpress-comments/',
|
80 |
-
array(
|
81 |
-
'method' => 'POST',
|
82 |
-
'timeout' => 60,
|
83 |
-
'body' => array(
|
84 |
-
'forum_url' => $this->short_name,
|
85 |
-
'forum_api_key' => $this->forum_api_key,
|
86 |
-
'response_type' => 'php',
|
87 |
-
'wxr' => $wxr,
|
88 |
-
'timestamp' => $timestamp,
|
89 |
-
'eof' => (int)$eof
|
90 |
-
),
|
91 |
-
)
|
92 |
-
);
|
93 |
-
if ($response->errors) {
|
94 |
-
// hack
|
95 |
-
$this->api->last_error = $response->errors;
|
96 |
-
return -1;
|
97 |
-
}
|
98 |
-
$data = unserialize($response['body']);
|
99 |
-
if (!$data || $data['stat'] == 'fail') {
|
100 |
-
return -1;
|
101 |
-
}
|
102 |
-
|
103 |
-
return $data;
|
104 |
-
}
|
105 |
-
}
|
106 |
-
|
107 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/lib/wp-cli.php
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Helper script for setting up the WP command line environment
|
4 |
-
*/
|
5 |
-
error_reporting(E_ALL | E_STRICT);
|
6 |
-
|
7 |
-
if (php_sapi_name() != 'cli' && !empty($_SERVER['REMOTE_ADDR'])) {
|
8 |
-
// Don't execute for web requests
|
9 |
-
die("This script must be run from CLI.");
|
10 |
-
}
|
11 |
-
|
12 |
-
if (!isset($argv)) {
|
13 |
-
$argv = array();
|
14 |
-
}
|
15 |
-
|
16 |
-
function print_line() {
|
17 |
-
$args = func_get_args();
|
18 |
-
$result = call_user_func_array('sprintf', $args);
|
19 |
-
print("{$result}\n");
|
20 |
-
}
|
21 |
-
|
22 |
-
define('DOING_AJAX', true);
|
23 |
-
define('WP_USE_THEMES', false);
|
24 |
-
if (isset($_ENV['WORDPRESS_PATH'])) {
|
25 |
-
define('ABSPATH', $_ENV['WORDPRESS_PATH']);
|
26 |
-
} else {
|
27 |
-
if (substr($_SERVER['SCRIPT_FILENAME'], 0, 1) != '/') {
|
28 |
-
$script_path = $_SERVER['PWD'] . $_SERVER['SCRIPT_FILENAME'];
|
29 |
-
} else {
|
30 |
-
$script_path = $_SERVER['SCRIPT_FILENAME'];
|
31 |
-
}
|
32 |
-
$tree = '';
|
33 |
-
$paths = array();
|
34 |
-
$chunks = explode('/', dirname($script_path));
|
35 |
-
foreach ($chunks as $chunk) {
|
36 |
-
if (!$chunk) continue;
|
37 |
-
$tree = $tree.'/'.$chunk;
|
38 |
-
array_push($paths, $tree);
|
39 |
-
}
|
40 |
-
$paths = array_reverse($paths);
|
41 |
-
|
42 |
-
foreach ($paths as $path) {
|
43 |
-
if (is_file($path.'/wp-config.php')) {
|
44 |
-
define('ABSPATH', $path . '/');
|
45 |
-
break;
|
46 |
-
}
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
if (!defined('ABSPATH')) {
|
51 |
-
print_line("Unable to determine wordpress path. Please set it using WORDPRESS_PATH.");
|
52 |
-
die();
|
53 |
-
}
|
54 |
-
|
55 |
-
$_SERVER = array(
|
56 |
-
"HTTP_HOST" => "disqus.com",
|
57 |
-
"SCRIPT_NAME" => "",
|
58 |
-
"PHP_SELF" => __FILE__,
|
59 |
-
"SERVER_NAME" => "localhost",
|
60 |
-
"REQUEST_URI" => "/",
|
61 |
-
"REQUEST_METHOD" => "GET"
|
62 |
-
);
|
63 |
-
require_once(ABSPATH . 'wp-config.php');
|
64 |
-
|
65 |
-
// swap out the object cache due to memory constraints
|
66 |
-
|
67 |
-
global $wp_object_cache;
|
68 |
-
|
69 |
-
class DummyWP_Object_Cache extends WP_Object_Cache {
|
70 |
-
function set($id, $data, $group = 'default', $expire = '') {
|
71 |
-
return;
|
72 |
-
}
|
73 |
-
function delete($id, $group = 'default', $force = false) {
|
74 |
-
return;
|
75 |
-
}
|
76 |
-
function add($id, $data, $group = 'default', $expire = '') {
|
77 |
-
return;
|
78 |
-
}
|
79 |
-
}
|
80 |
-
|
81 |
-
// HACK: kill all output buffers (some plugins, like Hyper Cache, use theses)
|
82 |
-
while (@ob_end_flush());
|
83 |
-
|
84 |
-
// We cant simply replace the object cache incase set/add do something that
|
85 |
-
// matters to the webserver
|
86 |
-
// $wp_object_cache = new DummyWP_Object_Cache();
|
87 |
-
|
88 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/locales/default.mo
DELETED
Binary file
|
trunk/locales/default.po
DELETED
@@ -1,423 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: disqus-wordpress\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2014-06-20 11:21-0800\n"
|
6 |
-
"PO-Revision-Date: 2014-06-20 11:22-0800\n"
|
7 |
-
"Last-Translator: Ryan Valentin <ryan@disqus.com>\n"
|
8 |
-
"Language-Team: DISQUS <translation@disqus.com>\n"
|
9 |
-
"Language: en_US\n"
|
10 |
-
"MIME-Version: 1.0\n"
|
11 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
-
"Content-Transfer-Encoding: 8bit\n"
|
13 |
-
"X-Poedit-KeywordsList: _;gettext;gettext_noop;dsq_i;__;_e\n"
|
14 |
-
"X-Poedit-Basepath: ../\n"
|
15 |
-
"X-Generator: Poedit 1.6.5\n"
|
16 |
-
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
17 |
-
"X-Poedit-SearchPath-0: ..\n"
|
18 |
-
|
19 |
-
#: ../disqus/comments.php:18 ../disqus/comments.php:34
|
20 |
-
msgid "<span class=\"meta-nav\">←</span> Older Comments"
|
21 |
-
msgstr ""
|
22 |
-
|
23 |
-
#: ../disqus/comments.php:19 ../disqus/comments.php:35
|
24 |
-
msgid "Newer Comments <span class=\"meta-nav\">→</span>"
|
25 |
-
msgstr ""
|
26 |
-
|
27 |
-
#: ../disqus/disqus.php:442
|
28 |
-
msgid ""
|
29 |
-
"Your comments have been sent to Disqus and queued for import!<br/><a href=\""
|
30 |
-
msgstr ""
|
31 |
-
|
32 |
-
#: ../disqus/disqus.php:446
|
33 |
-
#, php-format
|
34 |
-
msgid "Processed comments on post #%s…"
|
35 |
-
msgstr ""
|
36 |
-
|
37 |
-
#: ../disqus/disqus.php:456
|
38 |
-
#, php-format
|
39 |
-
msgid ""
|
40 |
-
"Sorry, something unexpected happened with the export. Please <a href=\"#\" "
|
41 |
-
"id=\"dsq_export_retry\">try again</a></p><p>If your API key has changed, you "
|
42 |
-
"may need to reinstall Disqus (deactivate the plugin and then reactivate it). "
|
43 |
-
"If you are still having issues, refer to the <a href=\"%s\" onclick=\"window."
|
44 |
-
"open(this.href); return false\">WordPress help page</a>."
|
45 |
-
msgstr ""
|
46 |
-
|
47 |
-
#: ../disqus/disqus.php:461
|
48 |
-
#, php-format
|
49 |
-
msgid ""
|
50 |
-
"Your comments have been sent to Disqus and queued for import!<br/><a href="
|
51 |
-
"\"%s\" target=\"_blank\">See the status of your import at Disqus</a>"
|
52 |
-
msgstr ""
|
53 |
-
|
54 |
-
#: ../disqus/disqus.php:491
|
55 |
-
msgid "There was an error downloading your comments from Disqus."
|
56 |
-
msgstr ""
|
57 |
-
|
58 |
-
#: ../disqus/disqus.php:496
|
59 |
-
msgid ""
|
60 |
-
"Your comments have been downloaded from Disqus and saved in your local "
|
61 |
-
"database."
|
62 |
-
msgstr ""
|
63 |
-
|
64 |
-
#: ../disqus/disqus.php:499
|
65 |
-
#, php-format
|
66 |
-
msgid "Import in progress (last post id: %s) …"
|
67 |
-
msgstr ""
|
68 |
-
|
69 |
-
#: ../disqus/disqus.php:833
|
70 |
-
msgid "Pingback:"
|
71 |
-
msgstr ""
|
72 |
-
|
73 |
-
#: ../disqus/disqus.php:833
|
74 |
-
msgid "(Edit)"
|
75 |
-
msgstr ""
|
76 |
-
|
77 |
-
#: ../disqus/disqus.php:870
|
78 |
-
msgid "Configure"
|
79 |
-
msgstr ""
|
80 |
-
|
81 |
-
#: ../disqus/disqus.php:872 ../disqus/manage.php:340
|
82 |
-
msgid "Settings"
|
83 |
-
msgstr ""
|
84 |
-
|
85 |
-
#: ../disqus/disqus.php:1577
|
86 |
-
msgid ""
|
87 |
-
"Sorry, the built-in commenting system is disabled because Disqus is active."
|
88 |
-
msgstr ""
|
89 |
-
|
90 |
-
#: ../disqus/manage.php:61
|
91 |
-
msgid "Disqus Reset"
|
92 |
-
msgstr ""
|
93 |
-
|
94 |
-
#: ../disqus/manage.php:64
|
95 |
-
msgid "Disqus has been reset successfully."
|
96 |
-
msgstr ""
|
97 |
-
|
98 |
-
#: ../disqus/manage.php:66
|
99 |
-
msgid "Local settings for the plugin were removed."
|
100 |
-
msgstr ""
|
101 |
-
|
102 |
-
#: ../disqus/manage.php:67
|
103 |
-
msgid "Database changes by Disqus were reverted."
|
104 |
-
msgstr ""
|
105 |
-
|
106 |
-
#: ../disqus/manage.php:69
|
107 |
-
msgid ""
|
108 |
-
"If you wish to <a href=\"?page=disqus&step=1\">reinstall</a>, you can do "
|
109 |
-
"that now."
|
110 |
-
msgstr ""
|
111 |
-
|
112 |
-
#: ../disqus/manage.php:163
|
113 |
-
msgid "Your settings have been changed."
|
114 |
-
msgstr ""
|
115 |
-
|
116 |
-
#: ../disqus/manage.php:187
|
117 |
-
msgid ""
|
118 |
-
"There was an error completing the installation of Disqus. If you are still "
|
119 |
-
"having issues, refer to the <a href=\"https://help.disqus.com/customer/"
|
120 |
-
"portal/articles/472005-wordpress-troubleshooting\">WordPress help page</a>."
|
121 |
-
msgstr ""
|
122 |
-
|
123 |
-
#: ../disqus/manage.php:216
|
124 |
-
#, php-format
|
125 |
-
msgid ""
|
126 |
-
"There aren't any sites associated with this account. Maybe you want to <a "
|
127 |
-
"href=\"%s\">create a site</a>?"
|
128 |
-
msgstr ""
|
129 |
-
|
130 |
-
#: ../disqus/manage.php:226
|
131 |
-
msgid "Moderate"
|
132 |
-
msgstr ""
|
133 |
-
|
134 |
-
#: ../disqus/manage.php:226
|
135 |
-
msgid "Install"
|
136 |
-
msgstr ""
|
137 |
-
|
138 |
-
#: ../disqus/manage.php:227
|
139 |
-
msgid "Plugin Settings"
|
140 |
-
msgstr ""
|
141 |
-
|
142 |
-
#: ../disqus/manage.php:236 ../disqus/manage.php:247 ../disqus/manage.php:281
|
143 |
-
msgid "Install Disqus Comments"
|
144 |
-
msgstr ""
|
145 |
-
|
146 |
-
#: ../disqus/manage.php:238
|
147 |
-
msgid "Disqus has been installed on your blog."
|
148 |
-
msgstr ""
|
149 |
-
|
150 |
-
#: ../disqus/manage.php:239
|
151 |
-
msgid ""
|
152 |
-
"If you have existing comments, you may wish to <a href=\"?page=disqus&"
|
153 |
-
"t=adv#export\">export them</a> now. Otherwise, you're all set, and the "
|
154 |
-
"Disqus network is now powering comments on your blog."
|
155 |
-
msgstr ""
|
156 |
-
|
157 |
-
#: ../disqus/manage.php:240
|
158 |
-
msgid "Continue to the moderation dashboard"
|
159 |
-
msgstr ""
|
160 |
-
|
161 |
-
#: ../disqus/manage.php:253
|
162 |
-
msgid "Select a website"
|
163 |
-
msgstr ""
|
164 |
-
|
165 |
-
#: ../disqus/manage.php:265
|
166 |
-
msgid "Or register a new one on the Disqus website."
|
167 |
-
msgstr ""
|
168 |
-
|
169 |
-
#: ../disqus/manage.php:287
|
170 |
-
msgid "Username"
|
171 |
-
msgstr ""
|
172 |
-
|
173 |
-
#: ../disqus/manage.php:290
|
174 |
-
msgid "(don't have a Disqus Profile yet?)"
|
175 |
-
msgstr ""
|
176 |
-
|
177 |
-
#: ../disqus/manage.php:294
|
178 |
-
msgid "Password"
|
179 |
-
msgstr ""
|
180 |
-
|
181 |
-
#: ../disqus/manage.php:297
|
182 |
-
msgid "(forgot your password?)"
|
183 |
-
msgstr ""
|
184 |
-
|
185 |
-
#: ../disqus/manage.php:341
|
186 |
-
#, php-format
|
187 |
-
msgid "Version: %s"
|
188 |
-
msgstr ""
|
189 |
-
|
190 |
-
#: ../disqus/manage.php:345
|
191 |
-
msgid ""
|
192 |
-
"<p class=\"status\">Disqus comments are currently disabled. (<a href=\"?"
|
193 |
-
"page=disqus&active=1\">Enable</a>)</p>"
|
194 |
-
msgstr ""
|
195 |
-
|
196 |
-
#: ../disqus/manage.php:347
|
197 |
-
msgid ""
|
198 |
-
"<p class=\"status\">Disqus comments are currently enabled. (<a href=\"?"
|
199 |
-
"page=disqus&active=0\">Disable</a>)</p>"
|
200 |
-
msgstr ""
|
201 |
-
|
202 |
-
#: ../disqus/manage.php:355
|
203 |
-
msgid "<h3>General</h3>"
|
204 |
-
msgstr ""
|
205 |
-
|
206 |
-
#: ../disqus/manage.php:358
|
207 |
-
msgid "Forum Shortname"
|
208 |
-
msgstr ""
|
209 |
-
|
210 |
-
#: ../disqus/manage.php:363
|
211 |
-
msgid ""
|
212 |
-
"This is the unique identifier for your website in Disqus, automatically set "
|
213 |
-
"during installation."
|
214 |
-
msgstr ""
|
215 |
-
|
216 |
-
#: ../disqus/manage.php:368
|
217 |
-
msgid "<h3>Appearance</h3>"
|
218 |
-
msgstr ""
|
219 |
-
|
220 |
-
#: ../disqus/manage.php:371
|
221 |
-
msgid "Use Disqus Comments on"
|
222 |
-
msgstr ""
|
223 |
-
|
224 |
-
#: ../disqus/manage.php:374
|
225 |
-
msgid "All blog posts."
|
226 |
-
msgstr ""
|
227 |
-
|
228 |
-
#: ../disqus/manage.php:375
|
229 |
-
msgid "Blog posts with closed comments only."
|
230 |
-
msgstr ""
|
231 |
-
|
232 |
-
#: ../disqus/manage.php:379
|
233 |
-
msgid ""
|
234 |
-
"You have selected to only enable Disqus on posts with closed comments. If "
|
235 |
-
"you aren't seeing Disqus on new posts, change this option to <strong>All "
|
236 |
-
"blog posts</strong>."
|
237 |
-
msgstr ""
|
238 |
-
|
239 |
-
#: ../disqus/manage.php:380
|
240 |
-
msgid ""
|
241 |
-
"Shows comments on either all blog posts, or ones with closed comments. "
|
242 |
-
"Select the <strong>Blog posts with closed comments only</strong> option if "
|
243 |
-
"you plan on disabling Disqus, but want to keep it on posts which already "
|
244 |
-
"have comments."
|
245 |
-
msgstr ""
|
246 |
-
|
247 |
-
#: ../disqus/manage.php:386
|
248 |
-
msgid "<h3>Sync</h3>"
|
249 |
-
msgstr ""
|
250 |
-
|
251 |
-
#: ../disqus/manage.php:389
|
252 |
-
msgid "Comment Importing"
|
253 |
-
msgstr ""
|
254 |
-
|
255 |
-
#: ../disqus/manage.php:392
|
256 |
-
msgid "Disable automated comment importing"
|
257 |
-
msgstr ""
|
258 |
-
|
259 |
-
#: ../disqus/manage.php:393
|
260 |
-
msgid ""
|
261 |
-
"If you have problems with WP-Cron taking too long, or have a large number of "
|
262 |
-
"comments, you may wish to disable automated sync. Comments will only be "
|
263 |
-
"imported to your local Wordpress database if you do so manually."
|
264 |
-
msgstr ""
|
265 |
-
|
266 |
-
#: ../disqus/manage.php:397
|
267 |
-
msgid "Server-Side Rendering"
|
268 |
-
msgstr ""
|
269 |
-
|
270 |
-
#: ../disqus/manage.php:400
|
271 |
-
msgid "Disable server-side rendering of comments"
|
272 |
-
msgstr ""
|
273 |
-
|
274 |
-
#: ../disqus/manage.php:401
|
275 |
-
msgid "Hides comments from nearly all search engines."
|
276 |
-
msgstr ""
|
277 |
-
|
278 |
-
#: ../disqus/manage.php:406
|
279 |
-
msgid "<h3>Patches</h3>"
|
280 |
-
msgstr ""
|
281 |
-
|
282 |
-
#: ../disqus/manage.php:410
|
283 |
-
msgid "Template Conflicts"
|
284 |
-
msgstr ""
|
285 |
-
|
286 |
-
#: ../disqus/manage.php:413
|
287 |
-
msgid "Output JavaScript in footer"
|
288 |
-
msgstr ""
|
289 |
-
|
290 |
-
#: ../disqus/manage.php:414
|
291 |
-
#, php-format
|
292 |
-
msgid ""
|
293 |
-
"Enable this if you have problems with comment counts or other "
|
294 |
-
"irregularities. For example: missing counts, counts always at 0, Disqus code "
|
295 |
-
"showing on the page, broken image carousels, or longer-than-usual home page "
|
296 |
-
"load times (<a href=\"%s\" onclick=\"window.open(this.href); return false"
|
297 |
-
"\">more info</a>)."
|
298 |
-
msgstr ""
|
299 |
-
|
300 |
-
#: ../disqus/manage.php:419
|
301 |
-
#, php-format
|
302 |
-
msgid ""
|
303 |
-
"<h3>Advanced</h3><h4>Single Sign-On</h4><p>Allows users to log in to Disqus "
|
304 |
-
"via WordPress. (<a href=\"%s\" onclick=\"window.open(this.href); return false"
|
305 |
-
"\">More info on SSO</a>)</p>"
|
306 |
-
msgstr ""
|
307 |
-
|
308 |
-
#: ../disqus/manage.php:423
|
309 |
-
msgid "Disqus Partner Key"
|
310 |
-
msgstr ""
|
311 |
-
|
312 |
-
#: ../disqus/manage.php:430
|
313 |
-
msgid "API Application Public Key"
|
314 |
-
msgstr ""
|
315 |
-
|
316 |
-
#: ../disqus/manage.php:434 ../disqus/manage.php:442
|
317 |
-
#, php-format
|
318 |
-
msgid "Found at <a href=\"%s\">Disqus API Applications</a>."
|
319 |
-
msgstr ""
|
320 |
-
|
321 |
-
#: ../disqus/manage.php:438
|
322 |
-
msgid "API Application Secret Key"
|
323 |
-
msgstr ""
|
324 |
-
|
325 |
-
#: ../disqus/manage.php:446
|
326 |
-
msgid "Custom Log-in Button"
|
327 |
-
msgstr ""
|
328 |
-
|
329 |
-
#: ../disqus/manage.php:496
|
330 |
-
msgid "Change"
|
331 |
-
msgstr ""
|
332 |
-
|
333 |
-
#: ../disqus/manage.php:496
|
334 |
-
msgid "Choose"
|
335 |
-
msgstr ""
|
336 |
-
|
337 |
-
#: ../disqus/manage.php:496
|
338 |
-
msgid "button"
|
339 |
-
msgstr ""
|
340 |
-
|
341 |
-
#: ../disqus/manage.php:502
|
342 |
-
#, php-format
|
343 |
-
msgid ""
|
344 |
-
"Adds a button to the Disqus log-in interface. (<a href=\"%s\">Example "
|
345 |
-
"screenshot</a>.)"
|
346 |
-
msgstr ""
|
347 |
-
|
348 |
-
#: ../disqus/manage.php:503
|
349 |
-
#, php-format
|
350 |
-
msgid ""
|
351 |
-
"<br />See <a href=\"%s\">our SSO button documentation</a> for a template to "
|
352 |
-
"create your own button."
|
353 |
-
msgstr ""
|
354 |
-
|
355 |
-
#: ../disqus/manage.php:521
|
356 |
-
msgid "Export comments to Disqus"
|
357 |
-
msgstr ""
|
358 |
-
|
359 |
-
#: ../disqus/manage.php:524
|
360 |
-
msgid "Export Comments"
|
361 |
-
msgstr ""
|
362 |
-
|
363 |
-
#: ../disqus/manage.php:524
|
364 |
-
msgid "This will export your existing WordPress comments to Disqus"
|
365 |
-
msgstr ""
|
366 |
-
|
367 |
-
#: ../disqus/manage.php:530
|
368 |
-
msgid "Sync Disqus with WordPress"
|
369 |
-
msgstr ""
|
370 |
-
|
371 |
-
#: ../disqus/manage.php:534
|
372 |
-
msgid "Sync Comments"
|
373 |
-
msgstr ""
|
374 |
-
|
375 |
-
#: ../disqus/manage.php:534
|
376 |
-
msgid ""
|
377 |
-
"This will download your Disqus comments and store them locally in WordPress"
|
378 |
-
msgstr ""
|
379 |
-
|
380 |
-
#: ../disqus/manage.php:535
|
381 |
-
msgid "Remove all imported Disqus comments before syncing."
|
382 |
-
msgstr ""
|
383 |
-
|
384 |
-
#: ../disqus/manage.php:546
|
385 |
-
msgid "Reset Disqus"
|
386 |
-
msgstr ""
|
387 |
-
|
388 |
-
#: ../disqus/manage.php:550
|
389 |
-
msgid "Are you sure you want to reset the Disqus plugin?"
|
390 |
-
msgstr ""
|
391 |
-
|
392 |
-
#: ../disqus/manage.php:550
|
393 |
-
msgid ""
|
394 |
-
"This removes all Disqus-specific settings. Comments will remain unaffected."
|
395 |
-
msgstr ""
|
396 |
-
|
397 |
-
#: ../disqus/manage.php:551
|
398 |
-
msgid ""
|
399 |
-
"If you have problems with resetting taking too long you may wish to first "
|
400 |
-
"manually drop the <code>disqus_dupecheck</code> index from your "
|
401 |
-
"<code>commentmeta</code> table."
|
402 |
-
msgstr ""
|
403 |
-
|
404 |
-
#: ../disqus/manage.php:558
|
405 |
-
msgid "Debug Information"
|
406 |
-
msgstr ""
|
407 |
-
|
408 |
-
#: ../disqus/manage.php:559
|
409 |
-
#, php-format
|
410 |
-
msgid ""
|
411 |
-
"Having problems with the plugin? Check out our <a href=\"%s\" onclick="
|
412 |
-
"\"window.open(this.href); return false\">WordPress Troubleshooting</a> "
|
413 |
-
"documentation. You can also <a href=\"%s\">drop us a line</a> including the "
|
414 |
-
"following details and we'll do what we can."
|
415 |
-
msgstr ""
|
416 |
-
|
417 |
-
#: ../disqus/upgrade.php:12
|
418 |
-
msgid "Upgrade Disqus Comments"
|
419 |
-
msgstr ""
|
420 |
-
|
421 |
-
#: ../disqus/upgrade.php:15
|
422 |
-
msgid "You need to upgrade your database to continue."
|
423 |
-
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/locales/index.html
DELETED
File without changes
|
trunk/manage.php
DELETED
@@ -1,601 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// HACK: For old versions of WordPress
|
3 |
-
if ( !function_exists('wp_nonce_field') ) {
|
4 |
-
function wp_nonce_field() {}
|
5 |
-
}
|
6 |
-
|
7 |
-
global $dsq_api;
|
8 |
-
|
9 |
-
require(ABSPATH . 'wp-includes/version.php');
|
10 |
-
|
11 |
-
if ( !current_user_can('moderate_comments') ) {
|
12 |
-
die('The account you\'re logged in to doesn\'t have permission to access this page.');
|
13 |
-
}
|
14 |
-
|
15 |
-
function has_valid_nonce() {
|
16 |
-
$nonce_actions = array('upgrade', 'reset', 'install', 'settings');
|
17 |
-
$nonce_form_prefix = 'dsq-form_nonce_';
|
18 |
-
$nonce_action_prefix = 'dsq-wpnonce_';
|
19 |
-
|
20 |
-
// Check all available nonce actions
|
21 |
-
foreach ( $nonce_actions as $key => $value ) {
|
22 |
-
if ( isset($_POST[$nonce_form_prefix.$value]) ) {
|
23 |
-
check_admin_referer($nonce_action_prefix.$value, $nonce_form_prefix.$value);
|
24 |
-
return true;
|
25 |
-
}
|
26 |
-
}
|
27 |
-
|
28 |
-
return false;
|
29 |
-
}
|
30 |
-
|
31 |
-
if ( ! empty($_POST) ) {
|
32 |
-
$nonce_result_check = has_valid_nonce();
|
33 |
-
if ($nonce_result_check === false) {
|
34 |
-
die('Unable to save changes. Make sure you are accessing this page from the Wordpress dashboard.');
|
35 |
-
}
|
36 |
-
}
|
37 |
-
|
38 |
-
if( isset($_POST['dsq_username']) ) {
|
39 |
-
$_POST['dsq_username'] = stripslashes($_POST['dsq_username']);
|
40 |
-
}
|
41 |
-
|
42 |
-
if( isset($_POST['dsq_password']) ) {
|
43 |
-
$_POST['dsq_password'] = stripslashes($_POST['dsq_password']);
|
44 |
-
}
|
45 |
-
|
46 |
-
// Handle export function.
|
47 |
-
if( isset($_POST['export']) and DISQUS_CAN_EXPORT ) {
|
48 |
-
require_once(dirname(__FILE__) . '/export.php');
|
49 |
-
dsq_export_wp();
|
50 |
-
}
|
51 |
-
|
52 |
-
// Handle resetting.
|
53 |
-
if ( isset($_POST['reset']) ) {
|
54 |
-
foreach (dsq_options() as $opt) {
|
55 |
-
delete_option($opt);
|
56 |
-
}
|
57 |
-
unset($_POST);
|
58 |
-
dsq_reset_database();
|
59 |
-
?>
|
60 |
-
<div class="wrap">
|
61 |
-
<h2><?php echo dsq_i('Disqus Reset'); ?></h2>
|
62 |
-
<form method="POST" action="?page=disqus">
|
63 |
-
<?php wp_nonce_field('dsq-wpnonce_reset', 'dsq-form_nonce_reset'); ?>
|
64 |
-
<p><?php echo dsq_i('Disqus has been reset successfully.') ?></p>
|
65 |
-
<ul style="list-style: circle;padding-left:20px;">
|
66 |
-
<li><?php echo dsq_i('Local settings for the plugin were removed.') ?></li>
|
67 |
-
<li><?php echo dsq_i('Database changes by Disqus were reverted.') ?></li>
|
68 |
-
</ul>
|
69 |
-
<p><?php echo dsq_i('If you wish to <a href="?page=disqus&step=1">reinstall</a>, you can do that now.') ?></p>
|
70 |
-
</form>
|
71 |
-
</div>
|
72 |
-
<?php
|
73 |
-
die();
|
74 |
-
}
|
75 |
-
|
76 |
-
// Post fields that require verification.
|
77 |
-
$check_fields = array(
|
78 |
-
'dsq_user_api_key' => array(
|
79 |
-
'key_name' => 'dsq_user_api_key',
|
80 |
-
'min' => 64,
|
81 |
-
'max' => 64,
|
82 |
-
),
|
83 |
-
'disqus_api_key' => array(
|
84 |
-
'key_name' => 'disqus_api_key',
|
85 |
-
'min' => 64,
|
86 |
-
'max' => 64,
|
87 |
-
),
|
88 |
-
'disqus_public_key' => array(
|
89 |
-
'key_name' => 'disqus_public_key',
|
90 |
-
'min' => 64,
|
91 |
-
'max' => 64,
|
92 |
-
),
|
93 |
-
'disqus_secret_key' => array(
|
94 |
-
'key_name' => 'disqus_secret_key',
|
95 |
-
'min' => 64,
|
96 |
-
'max' => 64,
|
97 |
-
),
|
98 |
-
'disqus_partner_key' => array(
|
99 |
-
'key_name' => 'disqus_partner_key',
|
100 |
-
'min' => 64,
|
101 |
-
'max' => 64,
|
102 |
-
),
|
103 |
-
'dsq_forum' => array(
|
104 |
-
'key_name' => 'dsq_forum',
|
105 |
-
'min' => 1,
|
106 |
-
'max' => 64,
|
107 |
-
),
|
108 |
-
'disqus_forum_url' => array(
|
109 |
-
'key_name' => 'disqus_forum_url',
|
110 |
-
'min' => 1,
|
111 |
-
'max' => 64,
|
112 |
-
),
|
113 |
-
'dsq_username' => array(
|
114 |
-
'key_name' => 'dsq_username',
|
115 |
-
'min' => 3,
|
116 |
-
'max' => 250,
|
117 |
-
),
|
118 |
-
'disqus_replace' => array(
|
119 |
-
'key_name' => 'disqus_replace',
|
120 |
-
'min' => 3,
|
121 |
-
'max' => 6,
|
122 |
-
)
|
123 |
-
);
|
124 |
-
|
125 |
-
// Check keys keys and remove bad input.
|
126 |
-
foreach ( $check_fields as $key ) {
|
127 |
-
if ( isset($_POST[$key['key_name']]) ) {
|
128 |
-
|
129 |
-
// Strip tags before checking
|
130 |
-
$_POST[$key['key_name']] = trim(strip_tags($_POST[$key['key_name']]));
|
131 |
-
|
132 |
-
if ( !is_valid_dsq_key($_POST[$key['key_name']], $key['min'], $key['max']) ) {
|
133 |
-
unset($_POST[$key['key_name']]);
|
134 |
-
}
|
135 |
-
}
|
136 |
-
}
|
137 |
-
|
138 |
-
function is_valid_dsq_key($value, $min=1, $max=64) {
|
139 |
-
return preg_match('/^[\0-9\\:A-Za-z]{'.$min.','.$max.'}+$/', $value);
|
140 |
-
}
|
141 |
-
|
142 |
-
// Handle advanced options.
|
143 |
-
if ( isset($_POST['disqus_forum_url']) && isset($_POST['disqus_replace']) ) {
|
144 |
-
update_option('disqus_partner_key', trim(stripslashes($_POST['disqus_partner_key'])));
|
145 |
-
update_option('disqus_replace', $_POST['disqus_replace']);
|
146 |
-
update_option('disqus_cc_fix', isset($_POST['disqus_cc_fix']));
|
147 |
-
update_option('disqus_manual_sync', isset($_POST['disqus_manual_sync']));
|
148 |
-
update_option('disqus_disable_ssr', isset($_POST['disqus_disable_ssr']));
|
149 |
-
update_option('disqus_public_key', $_POST['disqus_public_key']);
|
150 |
-
update_option('disqus_secret_key', $_POST['disqus_secret_key']);
|
151 |
-
// Handle any SSO button and icon uploads
|
152 |
-
if ( version_compare($wp_version, '3.5', '>=') ) {
|
153 |
-
// Use WP 3.5's new, streamlined, much-improved built-in media uploader
|
154 |
-
|
155 |
-
// Only update if a value is actually POSTed, otherwise any time the form is saved the button and icon will be un-set
|
156 |
-
if ($_POST['disqus_sso_button']) { update_option('disqus_sso_button', $_POST['disqus_sso_button']); }
|
157 |
-
} else {
|
158 |
-
// WP is older than 3.5, use legacy, less-elegant media uploader
|
159 |
-
if(isset($_FILES['disqus_sso_button'])) {
|
160 |
-
dsq_image_upload_handler('disqus_sso_button');
|
161 |
-
}
|
162 |
-
}
|
163 |
-
dsq_manage_dialog(dsq_i('Your settings have been changed.'));
|
164 |
-
}
|
165 |
-
|
166 |
-
// handle disqus_active
|
167 |
-
if ( isset($_GET['active']) ) {
|
168 |
-
update_option('disqus_active', ($_GET['active'] == '1' ? '1' : '0'));
|
169 |
-
}
|
170 |
-
|
171 |
-
$dsq_user_api_key = isset($_POST['dsq_user_api_key']) ? $_POST['dsq_user_api_key'] : null;
|
172 |
-
|
173 |
-
// Get installation step process (or 0 if we're already installed).
|
174 |
-
$step = @intval($_GET['step']);
|
175 |
-
if ($step > 1 && $step != 3 && $dsq_user_api_key) $step = 1;
|
176 |
-
elseif ($step == 2 && !isset($_POST['dsq_username'])) $step = 1;
|
177 |
-
$step = (dsq_is_installed()) ? 0 : ($step ? $step : 1);
|
178 |
-
|
179 |
-
// Handle installation process.
|
180 |
-
if ( 3 == $step && isset($_POST['dsq_forum']) && isset($_POST['dsq_user_api_key']) ) {
|
181 |
-
list($dsq_forum_id, $dsq_forum_url) = explode(':', $_POST['dsq_forum']);
|
182 |
-
update_option('disqus_forum_url', $dsq_forum_url);
|
183 |
-
update_option('disqus_cc_fix', '1');
|
184 |
-
$api_key = $dsq_api->get_forum_api_key($_POST['dsq_user_api_key'], $dsq_forum_id);
|
185 |
-
if ( !$api_key || $api_key < 0 ) {
|
186 |
-
update_option('disqus_replace', 'replace');
|
187 |
-
dsq_manage_dialog(dsq_i('There was an error completing the installation of Disqus. If you are still having issues, refer to the <a href="https://help.disqus.com/customer/portal/articles/472005-wordpress-troubleshooting">WordPress help page</a>.'), true);
|
188 |
-
} else {
|
189 |
-
update_option('disqus_api_key', $api_key);
|
190 |
-
update_option('disqus_user_api_key', $_POST['dsq_user_api_key']);
|
191 |
-
update_option('disqus_replace', 'all');
|
192 |
-
}
|
193 |
-
|
194 |
-
if (!empty($_POST['disqus_partner_key'])) {
|
195 |
-
$partner_key = trim(stripslashes($_POST['disqus_partner_key']));
|
196 |
-
if (!empty($partner_key)) {
|
197 |
-
update_option('disqus_partner_key', $partner_key);
|
198 |
-
}
|
199 |
-
}
|
200 |
-
}
|
201 |
-
|
202 |
-
if ( 2 == $step && isset($_POST['dsq_username']) && isset($_POST['dsq_password']) ) {
|
203 |
-
$dsq_user_api_key = $dsq_api->get_user_api_key($_POST['dsq_username'], $_POST['dsq_password']);
|
204 |
-
if ( $dsq_user_api_key < 0 || !$dsq_user_api_key ) {
|
205 |
-
$step = 1;
|
206 |
-
dsq_manage_dialog($dsq_api->get_last_error(), true);
|
207 |
-
}
|
208 |
-
|
209 |
-
if ( $step == 2 ) {
|
210 |
-
$dsq_sites = $dsq_api->get_forum_list($dsq_user_api_key);
|
211 |
-
if ( $dsq_sites < 0 ) {
|
212 |
-
$step = 1;
|
213 |
-
dsq_manage_dialog($dsq_api->get_last_error(), true);
|
214 |
-
} else if ( !$dsq_sites ) {
|
215 |
-
$step = 1;
|
216 |
-
dsq_manage_dialog(dsq_i('There aren\'t any sites associated with this account. Maybe you want to <a href="%s">create a site</a>?', 'https://disqus.com/admin/register/'), true);
|
217 |
-
}
|
218 |
-
}
|
219 |
-
}
|
220 |
-
|
221 |
-
$show_advanced = (isset($_GET['t']) && $_GET['t'] == 'adv');
|
222 |
-
|
223 |
-
?>
|
224 |
-
<div class="wrap" id="dsq-wrap">
|
225 |
-
<ul id="dsq-tabs">
|
226 |
-
<li<?php if (!$show_advanced) echo ' class="selected"'; ?> id="dsq-tab-main" rel="dsq-main"><?php echo (dsq_is_installed() ? dsq_i('Moderate') : dsq_i('Install')); ?></li>
|
227 |
-
<li<?php if ($show_advanced) echo ' class="selected"'; ?> id="dsq-tab-advanced" rel="dsq-advanced"><?php echo dsq_i('Plugin Settings'); ?></li>
|
228 |
-
</ul>
|
229 |
-
|
230 |
-
<div id="dsq-main" class="dsq-content">
|
231 |
-
<?php
|
232 |
-
switch ( $step ) {
|
233 |
-
case 3:
|
234 |
-
?>
|
235 |
-
<div id="dsq-step-3" class="dsq-main"<?php if ($show_advanced) echo ' style="display:none;"'; ?>>
|
236 |
-
<h2><?php echo dsq_i('Install Disqus Comments'); ?></h2>
|
237 |
-
|
238 |
-
<p><?php echo dsq_i('Disqus has been installed on your blog.'); ?></p>
|
239 |
-
<p><?php echo dsq_i('If you have existing comments, you may wish to <a href="?page=disqus&t=adv#export">export them</a> now. Otherwise, you\'re all set, and the Disqus network is now powering comments on your blog.'); ?></p>
|
240 |
-
<p><a href="edit-comments.php?page=disqus"><?php echo dsq_i('Continue to the moderation dashboard'); ?></a></p>
|
241 |
-
</div>
|
242 |
-
<?php
|
243 |
-
break;
|
244 |
-
case 2:
|
245 |
-
?>
|
246 |
-
<div id="dsq-step-2" class="dsq-main"<?php if ($show_advanced) echo ' style="display:none;"'; ?>>
|
247 |
-
<h2><?php echo dsq_i('Install Disqus Comments'); ?></h2>
|
248 |
-
|
249 |
-
<form method="POST" action="?page=disqus&step=3">
|
250 |
-
<?php wp_nonce_field('dsq-wpnonce_install', 'dsq-form_nonce_install'); ?>
|
251 |
-
<table class="form-table">
|
252 |
-
<tr>
|
253 |
-
<th scope="row" valign="top"><?php echo dsq_i('Select a website'); ?></th>
|
254 |
-
<td>
|
255 |
-
<?php
|
256 |
-
foreach ( $dsq_sites as $counter => $dsq_site ):
|
257 |
-
?>
|
258 |
-
<input name="dsq_forum" type="radio" id="dsq-site-<?php echo $counter; ?>" value="<?php echo $dsq_site->id; ?>:<?php echo $dsq_site->shortname; ?>" />
|
259 |
-
<label for="dsq-site-<?php echo $counter; ?>"><strong><?php echo htmlspecialchars($dsq_site->name); ?></strong> (<u><?php echo $dsq_site->shortname; ?>.disqus.com</u>)</label>
|
260 |
-
<br />
|
261 |
-
<?php
|
262 |
-
endforeach;
|
263 |
-
?>
|
264 |
-
<hr />
|
265 |
-
<a href="<?php echo DISQUS_URL; ?>comments/register/"><?php echo dsq_i('Or register a new one on the Disqus website.'); ?></a>
|
266 |
-
</td>
|
267 |
-
</tr>
|
268 |
-
</table>
|
269 |
-
|
270 |
-
<p class="submit" style="text-align: left">
|
271 |
-
<input type="hidden" name="dsq_user_api_key" value="<?php echo htmlspecialchars($dsq_user_api_key); ?>"/>
|
272 |
-
<input name="submit" type="submit" value="Next »" />
|
273 |
-
</p>
|
274 |
-
</form>
|
275 |
-
</div>
|
276 |
-
<?php
|
277 |
-
break;
|
278 |
-
case 1:
|
279 |
-
?>
|
280 |
-
<div id="dsq-step-1" class="dsq-main"<?php if ($show_advanced) echo ' style="display:none;"'; ?>>
|
281 |
-
<h2><?php echo dsq_i('Install Disqus Comments'); ?></h2>
|
282 |
-
|
283 |
-
<form method="POST" action="?page=disqus&step=2">
|
284 |
-
<?php wp_nonce_field('dsq-wpnonce_install', 'dsq-form_nonce_install'); ?>
|
285 |
-
<table class="form-table">
|
286 |
-
<tr>
|
287 |
-
<th scope="row" valign="top"><?php echo dsq_i('Username'); ?></th>
|
288 |
-
<td>
|
289 |
-
<input id="dsq-username" name="dsq_username" tabindex="1" type="text" />
|
290 |
-
<a href="https://disqus.com/profile/signup/"><?php echo dsq_i('(don\'t have a Disqus Profile yet?)'); ?></a>
|
291 |
-
</td>
|
292 |
-
</tr>
|
293 |
-
<tr>
|
294 |
-
<th scope="row" valign="top"><?php echo dsq_i('Password'); ?></th>
|
295 |
-
<td>
|
296 |
-
<input type="password" id="dsq-password" name="dsq_password" tabindex="2">
|
297 |
-
<a href="https://disqus.com/forgot/"><?php echo dsq_i('(forgot your password?)'); ?></a>
|
298 |
-
</td>
|
299 |
-
</tr>
|
300 |
-
</table>
|
301 |
-
|
302 |
-
<p class="submit" style="text-align: left">
|
303 |
-
<input name="submit" type="submit" value="Next »" tabindex="3">
|
304 |
-
</p>
|
305 |
-
|
306 |
-
<script type="text/javascript"> document.getElementById('dsq-username').focus(); </script>
|
307 |
-
</form>
|
308 |
-
</div>
|
309 |
-
<?php
|
310 |
-
break;
|
311 |
-
case 0:
|
312 |
-
$base = is_ssl() ? 'https://' : 'http://';
|
313 |
-
$url = get_option('disqus_forum_url');
|
314 |
-
if ($url) { $mod_url = $base.$url.'.'.DISQUS_DOMAIN.'/admin/moderate/'; }
|
315 |
-
else { $mod_url = DISQUS_URL.'admin/moderate/'; }
|
316 |
-
|
317 |
-
?>
|
318 |
-
<div class="dsq-main"<?php if ($show_advanced) echo ' style="display:none;"'; ?>>
|
319 |
-
<h2><a href="<?php echo $mod_url ?>"><img src="<?php echo plugins_url( '/media/images/logo.png', __FILE__ ); ?>"></a></h2>
|
320 |
-
<iframe src="<?php echo $mod_url ?>?template=wordpress" style="width: 100%; height: 80%; min-height: 600px;"></iframe>
|
321 |
-
</div>
|
322 |
-
<?php } ?>
|
323 |
-
</div>
|
324 |
-
|
325 |
-
<?php
|
326 |
-
$dsq_replace = get_option('disqus_replace');
|
327 |
-
$dsq_forum_url = strtolower(get_option('disqus_forum_url'));
|
328 |
-
$dsq_api_key = get_option('disqus_api_key');
|
329 |
-
$dsq_user_api_key = get_option('disqus_user_api_key');
|
330 |
-
$dsq_partner_key = get_option('disqus_partner_key');
|
331 |
-
$dsq_cc_fix = get_option('disqus_cc_fix');
|
332 |
-
$dsq_manual_sync = get_option('disqus_manual_sync');
|
333 |
-
$dsq_disable_ssr = get_option('disqus_disable_ssr');
|
334 |
-
$dsq_public_key = get_option('disqus_public_key');
|
335 |
-
$dsq_secret_key = get_option('disqus_secret_key');
|
336 |
-
$dsq_sso_button = get_option('disqus_sso_button');
|
337 |
-
?>
|
338 |
-
<!-- Settings -->
|
339 |
-
<div id="dsq-advanced" class="dsq-content dsq-advanced"<?php if (!$show_advanced) echo ' style="display:none;"'; ?>>
|
340 |
-
<h2><?php echo dsq_i('Settings'); ?></h2>
|
341 |
-
<p><?php echo dsq_i('Version: %s', esc_html(DISQUS_VERSION)); ?></p>
|
342 |
-
<?php
|
343 |
-
if (get_option('disqus_active') === '0') {
|
344 |
-
// disqus is not active
|
345 |
-
echo dsq_i('<p class="status">Disqus comments are currently disabled. (<a href="?page=disqus&active=1">Enable</a>)</p>');
|
346 |
-
} else {
|
347 |
-
echo dsq_i('<p class="status">Disqus comments are currently enabled. (<a href="?page=disqus&active=0">Disable</a>)</p>');
|
348 |
-
}
|
349 |
-
?>
|
350 |
-
<form method="POST" enctype="multipart/form-data">
|
351 |
-
<?php wp_nonce_field('dsq-wpnonce_settings', 'dsq-form_nonce_settings'); ?>
|
352 |
-
<table class="form-table">
|
353 |
-
|
354 |
-
<tr>
|
355 |
-
<th scope="row" valign="top"><?php echo dsq_i('<h3>General</h3>'); ?></th>
|
356 |
-
</tr>
|
357 |
-
<tr>
|
358 |
-
<th scope="row" valign="top"><?php echo dsq_i('Forum Shortname'); ?></th>
|
359 |
-
<td>
|
360 |
-
<input type="hidden" name="disqus_forum_url" value="<?php echo esc_attr($dsq_forum_url); ?>"/>
|
361 |
-
<code><?php echo esc_attr($dsq_forum_url); ?></code>
|
362 |
-
<br />
|
363 |
-
<?php echo dsq_i('This is the unique identifier for your website in Disqus, automatically set during installation.'); ?>
|
364 |
-
</td>
|
365 |
-
</tr>
|
366 |
-
|
367 |
-
<tr>
|
368 |
-
<th scope="row" valign="top"><?php echo dsq_i('<h3>Appearance</h3>'); ?></th>
|
369 |
-
</tr>
|
370 |
-
<tr>
|
371 |
-
<th scope="row" valign="top"><?php echo dsq_i('Use Disqus Comments on'); ?></th>
|
372 |
-
<td>
|
373 |
-
<select name="disqus_replace" tabindex="1" class="disqus-replace">
|
374 |
-
<option value="all" <?php if($dsq_replace == 'all'){echo 'selected';}?>><?php echo dsq_i('All blog posts.'); ?></option>
|
375 |
-
<option value="closed" <?php if('closed'==$dsq_replace){echo 'selected';}?>><?php echo dsq_i('Blog posts with closed comments only.'); ?></option>
|
376 |
-
</select>
|
377 |
-
<br />
|
378 |
-
<?php
|
379 |
-
if ($dsq_replace == 'closed') echo '<p class="dsq-alert">'.dsq_i('You have selected to only enable Disqus on posts with closed comments. If you aren\'t seeing Disqus on new posts, change this option to <strong>All blog posts</strong>.').'</p>';
|
380 |
-
else echo dsq_i('Shows comments on either all blog posts, or ones with closed comments. Select the <strong>Blog posts with closed comments only</strong> option if you plan on disabling Disqus, but want to keep it on posts which already have comments.');
|
381 |
-
?>
|
382 |
-
</td>
|
383 |
-
</tr>
|
384 |
-
|
385 |
-
<tr>
|
386 |
-
<th scope="row" valign="top"><?php echo dsq_i('<h3>Sync</h3>'); ?></th>
|
387 |
-
</tr>
|
388 |
-
<tr>
|
389 |
-
<th scope="row" valign="top"><?php echo dsq_i('Comment Importing'); ?></th>
|
390 |
-
<td>
|
391 |
-
<input type="checkbox" id="disqus_manual_sync" name="disqus_manual_sync" <?php if($dsq_manual_sync){echo 'checked="checked"';}?> >
|
392 |
-
<label for="disqus_manual_sync"><?php echo dsq_i('Disable automated comment importing'); ?></label>
|
393 |
-
<br /><?php echo dsq_i('If you have problems with WP-Cron taking too long, or have a large number of comments, you may wish to disable automated sync. Comments will only be imported to your local Wordpress database if you do so manually.'); ?>
|
394 |
-
</td>
|
395 |
-
</tr>
|
396 |
-
<tr>
|
397 |
-
<th scope="row" valign="top"><?php echo dsq_i('Server-Side Rendering'); ?></th>
|
398 |
-
<td>
|
399 |
-
<input type="checkbox" id="disqus_disable_ssr" name="disqus_disable_ssr" <?php if($dsq_disable_ssr){echo 'checked="checked"';}?> >
|
400 |
-
<label for="disqus_disable_ssr"><?php echo dsq_i('Disable server-side rendering of comments'); ?></label>
|
401 |
-
<br /><?php echo dsq_i('Hides comments from nearly all search engines.'); ?>
|
402 |
-
</td>
|
403 |
-
</tr>
|
404 |
-
|
405 |
-
<tr>
|
406 |
-
<th scope="row" valign="top"><?php echo dsq_i('<h3>Patches</h3>'); ?></th>
|
407 |
-
</tr>
|
408 |
-
|
409 |
-
<tr>
|
410 |
-
<th scope="row" valign="top"><?php echo dsq_i('Template Conflicts'); ?></th>
|
411 |
-
<td>
|
412 |
-
<input type="checkbox" id="disqus_comment_count" name="disqus_cc_fix" <?php if($dsq_cc_fix == '1'){ echo 'checked="checked"'; } ?> >
|
413 |
-
<label for="disqus_comment_count"><?php echo dsq_i('Output JavaScript in footer'); ?></label>
|
414 |
-
<br /><?php echo dsq_i('Enable this if you have problems with comment counts or other irregularities. For example: missing counts, counts always at 0, Disqus code showing on the page, broken image carousels, or longer-than-usual home page load times (<a href="%s" onclick="window.open(this.href); return false">more info</a>).', 'https://help.disqus.com/customer/portal/articles/472005-wordpress-troubleshooting'); ?>
|
415 |
-
</td>
|
416 |
-
</tr>
|
417 |
-
|
418 |
-
<tr>
|
419 |
-
<th scope="row" valign="top" colspan="2"><?php echo dsq_i('<h3>Advanced</h3><h4>Single Sign-On</h4><p>Allows users to log in to Disqus via WordPress. (<a href="%s" onclick="window.open(this.href); return false">More info on SSO</a>)</p>', 'https://help.disqus.com/customer/portal/articles/684744'); ?></th>
|
420 |
-
</tr>
|
421 |
-
<?php if (!empty($dsq_partner_key)) {// this option only shows if it was already present ?>
|
422 |
-
<tr>
|
423 |
-
<th scope="row" valign="top"><?php echo dsq_i('Disqus Partner Key'); ?></th>
|
424 |
-
<td>
|
425 |
-
<input type="text" name="disqus_partner_key" value="<?php echo esc_attr($dsq_partner_key); ?>" tabindex="2">
|
426 |
-
</td>
|
427 |
-
</tr>
|
428 |
-
<?php } ?>
|
429 |
-
<tr>
|
430 |
-
<th scope="row" valign="top"><?php echo dsq_i('API Application Public Key'); ?></th>
|
431 |
-
<td>
|
432 |
-
<input type="text" name="disqus_public_key" value="<?php echo esc_attr($dsq_public_key); ?>" tabindex="2">
|
433 |
-
<br />
|
434 |
-
<?php echo dsq_i('Found at <a href="%s">Disqus API Applications</a>.','https://disqus.com/api/applications/'); ?>
|
435 |
-
</td>
|
436 |
-
</tr>
|
437 |
-
<tr>
|
438 |
-
<th scope="row" valign="top"><?php echo dsq_i('API Application Secret Key'); ?></th>
|
439 |
-
<td>
|
440 |
-
<input type="text" name="disqus_secret_key" value="<?php echo esc_attr($dsq_secret_key); ?>" tabindex="2">
|
441 |
-
<br />
|
442 |
-
<?php echo dsq_i('Found at <a href="%s">Disqus API Applications</a>.','https://disqus.com/api/applications/'); ?>
|
443 |
-
</td>
|
444 |
-
</tr>
|
445 |
-
<tr>
|
446 |
-
<th scope="row" valign="top"><?php echo dsq_i('Custom Log-in Button'); ?></th>
|
447 |
-
<td>
|
448 |
-
<?php if (!empty($dsq_sso_button)) { ?>
|
449 |
-
<img src="<?php echo esc_attr($dsq_sso_button); ?>" alt="<?php echo esc_attr($dsq_sso_button); ?>" />
|
450 |
-
<br />
|
451 |
-
<?php } ?>
|
452 |
-
|
453 |
-
<?php if ( version_compare($wp_version, '3.5', '>=') ) {
|
454 |
-
// HACK: Use WP's new (as of WP 3.5), streamlined, much-improved built-in media uploader
|
455 |
-
|
456 |
-
// Use WP 3.5's new consolidated call to get all necessary media uploader scripts and styles
|
457 |
-
wp_enqueue_media(); ?>
|
458 |
-
|
459 |
-
<script type="text/javascript">
|
460 |
-
// Uploading files
|
461 |
-
var file_frame;
|
462 |
-
|
463 |
-
jQuery('.upload_image_button').live('click', function( event ){
|
464 |
-
|
465 |
-
event.preventDefault();
|
466 |
-
|
467 |
-
// If the media frame already exists, reopen it.
|
468 |
-
if ( file_frame ) {
|
469 |
-
file_frame.open();
|
470 |
-
return;
|
471 |
-
}
|
472 |
-
|
473 |
-
// Create the media frame.
|
474 |
-
file_frame = wp.media.frames.file_frame = wp.media({
|
475 |
-
title: jQuery( this ).data( 'uploader_title' ),
|
476 |
-
button: {
|
477 |
-
text: jQuery( this ).data( 'uploader_button_text' ),
|
478 |
-
},
|
479 |
-
multiple: false // Set to true to allow multiple files to be selected
|
480 |
-
});
|
481 |
-
|
482 |
-
// When an image is selected, run a callback.
|
483 |
-
file_frame.on( 'select', function() {
|
484 |
-
// We set multiple to false so only get one image from the uploader
|
485 |
-
attachment = file_frame.state().get('selection').first().toJSON();
|
486 |
-
|
487 |
-
// Do something with attachment.id and/or attachment.url here
|
488 |
-
jQuery('#disqus_sso_button').val(attachment.url);
|
489 |
-
});
|
490 |
-
|
491 |
-
// Finally, open the modal
|
492 |
-
file_frame.open();
|
493 |
-
});
|
494 |
-
</script>
|
495 |
-
|
496 |
-
<input type="button" value="<?php echo ($dsq_sso_button ? dsq_i('Change') : dsq_i('Choose')).' '.dsq_i('button'); ?>" class="button upload_image_button" tabindex="2">
|
497 |
-
<input type="hidden" name="disqus_sso_button" id="disqus_sso_button" value=""/>
|
498 |
-
<?php } else { // use pre-WP 3.5 media upload functionality ?>
|
499 |
-
<input type="file" name="disqus_sso_button" value="<?php echo esc_attr($dsq_sso_button); ?>" tabindex="2">
|
500 |
-
<?php } ?>
|
501 |
-
<br />
|
502 |
-
<?php echo dsq_i('Adds a button to the Disqus log-in interface. (<a href="%s">Example screenshot</a>.)','https://d8v2sqslxfuhj.cloudfront.net/docs/sso-button.png'); ?>
|
503 |
-
<?php echo dsq_i('<br />See <a href="%s">our SSO button documentation</a> for a template to create your own button.','https://help.disqus.com/customer/portal/articles/236206#sso-login-button'); ?>
|
504 |
-
</td>
|
505 |
-
</tr>
|
506 |
-
|
507 |
-
</table>
|
508 |
-
|
509 |
-
<p class="submit" style="text-align: left">
|
510 |
-
<input type="hidden" name="disqus_api_key" value="<?php echo esc_attr($dsq_api_key); ?>"/>
|
511 |
-
<input type="hidden" name="disqus_user_api_key" value="<?php echo esc_attr($dsq_user_api_key); ?>"/>
|
512 |
-
<input name="submit" type="submit" value="Save" class="button-primary button" tabindex="4">
|
513 |
-
</p>
|
514 |
-
</form>
|
515 |
-
|
516 |
-
<h3>Import and Export</h3>
|
517 |
-
|
518 |
-
<table class="form-table">
|
519 |
-
<?php if (DISQUS_CAN_EXPORT): ?>
|
520 |
-
<tr id="export">
|
521 |
-
<th scope="row" valign="top"><?php echo dsq_i('Export comments to Disqus'); ?></th>
|
522 |
-
<td>
|
523 |
-
<div id="dsq_export">
|
524 |
-
<p class="status"><a href="#" class="button"><?php echo dsq_i('Export Comments'); ?></a> <?php echo dsq_i('This will export your existing WordPress comments to Disqus'); ?></p>
|
525 |
-
</div>
|
526 |
-
</td>
|
527 |
-
</tr>
|
528 |
-
<?php endif; ?>
|
529 |
-
<tr>
|
530 |
-
<th scope="row" valign="top"><?php echo dsq_i('Sync Disqus with WordPress'); ?></th>
|
531 |
-
<td>
|
532 |
-
<div id="dsq_import">
|
533 |
-
<div class="status">
|
534 |
-
<p><a href="#" class="button"><?php echo dsq_i('Sync Comments'); ?></a> <?php echo dsq_i('This will download your Disqus comments and store them locally in WordPress'); ?></p>
|
535 |
-
<label><input type="checkbox" id="dsq_import_wipe" name="dsq_import_wipe" value="1"/> <?php echo dsq_i('Remove all imported Disqus comments before syncing.'); ?></label><br/>
|
536 |
-
</div>
|
537 |
-
</div>
|
538 |
-
</td>
|
539 |
-
</tr>
|
540 |
-
</table>
|
541 |
-
|
542 |
-
<h3>Reset</h3>
|
543 |
-
|
544 |
-
<table class="form-table">
|
545 |
-
<tr>
|
546 |
-
<th scope="row" valign="top"><?php echo dsq_i('Reset Disqus'); ?></th>
|
547 |
-
<td>
|
548 |
-
<form action="?page=disqus" method="POST">
|
549 |
-
<?php wp_nonce_field('dsq-wpnonce_reset', 'dsq-form_nonce_reset'); ?>
|
550 |
-
<p><input type="submit" value="Reset" name="reset" onclick="return confirm('<?php echo dsq_i('Are you sure you want to reset the Disqus plugin?'); ?>')" class="button" /> <?php echo dsq_i('This removes all Disqus-specific settings. Comments will remain unaffected.') ?></p>
|
551 |
-
<?php echo dsq_i('If you have problems with resetting taking too long you may wish to first manually drop the <code>disqus_dupecheck</code> index from your <code>commentmeta</code> table.') ?>
|
552 |
-
</form>
|
553 |
-
</td>
|
554 |
-
</tr>
|
555 |
-
</table>
|
556 |
-
<br/>
|
557 |
-
|
558 |
-
<h3><?php echo dsq_i('Debug Information'); ?></h3>
|
559 |
-
<p><?php echo dsq_i('Having problems with the plugin? Check out our <a href="%s" onclick="window.open(this.href); return false">WordPress Troubleshooting</a> documentation. You can also <a href="%s">drop us a line</a> including the following details and we\'ll do what we can.', 'https://help.disqus.com/customer/portal/articles/472005-wordpress-troubleshooting', 'mailto:help+wp@disqus.com'); ?></p>
|
560 |
-
<textarea style="width:90%; height:200px;">
|
561 |
-
URL: <?php echo esc_attr(get_option('siteurl')); ?>
|
562 |
-
|
563 |
-
PHP Version: <?php echo phpversion(); ?>
|
564 |
-
|
565 |
-
Version: <?php echo $wp_version; ?>
|
566 |
-
|
567 |
-
Active Theme:
|
568 |
-
<?php
|
569 |
-
if ( !function_exists('wp_get_theme') ) {
|
570 |
-
$theme = get_theme(get_current_theme());
|
571 |
-
echo $theme['Name'] . ' ' . $theme['Version'];
|
572 |
-
} else {
|
573 |
-
$theme = wp_get_theme();
|
574 |
-
echo $theme->Name . ' ' . $theme->Version;
|
575 |
-
}
|
576 |
-
?>
|
577 |
-
|
578 |
-
URLOpen Method: <?php echo dsq_url_method(); ?>
|
579 |
-
|
580 |
-
Plugin Version: <?php echo DISQUS_VERSION; ?>
|
581 |
-
|
582 |
-
Settings:
|
583 |
-
dsq_is_installed: <?php echo dsq_is_installed(); ?>
|
584 |
-
<?php foreach (dsq_options() as $opt) {
|
585 |
-
echo $opt.': '.esc_attr(get_option($opt))."\n";
|
586 |
-
}
|
587 |
-
?>
|
588 |
-
|
589 |
-
Plugins:
|
590 |
-
<?php
|
591 |
-
foreach (get_plugins() as $key => $plugin) {
|
592 |
-
$isactive = "";
|
593 |
-
if (is_plugin_active($key)) {
|
594 |
-
$isactive = "(active)";
|
595 |
-
}
|
596 |
-
echo $plugin['Name'].' '.$plugin['Version'].' '.$isactive."\n";
|
597 |
-
}
|
598 |
-
?>
|
599 |
-
</textarea><br/>
|
600 |
-
</div>
|
601 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/media/images/logo.png
DELETED
Binary file
|
trunk/media/styles/manage-pre25.css
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
/* Selectors required for pre-WordPress 2.5 */
|
2 |
-
|
3 |
-
.form-table {
|
4 |
-
border-collapse: collapse;
|
5 |
-
margin-top: 1em;
|
6 |
-
width: 100%;
|
7 |
-
color: #333;
|
8 |
-
}
|
9 |
-
|
10 |
-
.form-table tr {
|
11 |
-
background-color: #eaf3fa;
|
12 |
-
}
|
13 |
-
|
14 |
-
.form-table td {
|
15 |
-
margin-bottom: 9px;
|
16 |
-
padding: 10px;
|
17 |
-
line-height: 20px;
|
18 |
-
font-size: 11px;
|
19 |
-
border-bottom-width: 8px;
|
20 |
-
border-bottom-style: solid;
|
21 |
-
border-color: #fff;
|
22 |
-
}
|
23 |
-
|
24 |
-
.form-table th {
|
25 |
-
vertical-align: top;
|
26 |
-
text-align: left;
|
27 |
-
padding: 10px;
|
28 |
-
width: 150px;
|
29 |
-
border-bottom-width: 8px;
|
30 |
-
border-bottom-style: solid;
|
31 |
-
border-color: #fff;
|
32 |
-
}
|
33 |
-
|
34 |
-
.form-table th.th-full {
|
35 |
-
width: auto;
|
36 |
-
}
|
37 |
-
|
38 |
-
.form-table input, .form-table textarea {
|
39 |
-
border-width: 1px;
|
40 |
-
border-style: solid;
|
41 |
-
}
|
42 |
-
|
43 |
-
.form-table div.color-option {
|
44 |
-
display: block;
|
45 |
-
clear: both;
|
46 |
-
}
|
47 |
-
|
48 |
-
.form-table input.tog {
|
49 |
-
margin-top: 2px;
|
50 |
-
margin-right: 2px;
|
51 |
-
float: left;
|
52 |
-
}
|
53 |
-
|
54 |
-
.form-table table.color-palette {
|
55 |
-
vertical-align: bottom;
|
56 |
-
float: left;
|
57 |
-
margin: -3px 3px 8px;
|
58 |
-
}
|
59 |
-
|
60 |
-
.form-table .color-palette td {
|
61 |
-
border-bottom: none;
|
62 |
-
border: 1px solid #fff;
|
63 |
-
font-size: 1px;
|
64 |
-
line-height: 1px;
|
65 |
-
}
|
66 |
-
|
67 |
-
#disqus_warning{ background-color:#ff0000; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/media/styles/manage.css
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
ul#dsq-tabs li:last-child {
|
2 |
-
width: 100px;
|
3 |
-
}
|
4 |
-
ul#dsq-tabs li.selected {
|
5 |
-
font-weight: bold;
|
6 |
-
}
|
7 |
-
ul#dsq-tabs li {
|
8 |
-
float: left;
|
9 |
-
color: #333;
|
10 |
-
padding: 0.25em;
|
11 |
-
height: 16px;
|
12 |
-
cursor: pointer;
|
13 |
-
margin-right: 8px;
|
14 |
-
text-align: right;
|
15 |
-
}
|
16 |
-
|
17 |
-
ul#dsq-tabs {
|
18 |
-
display: block;
|
19 |
-
height: 20px;
|
20 |
-
list-style: none;
|
21 |
-
margin: 15px 0;
|
22 |
-
padding: 0;
|
23 |
-
border: 0;
|
24 |
-
position: absolute;
|
25 |
-
right: 10px;
|
26 |
-
}
|
27 |
-
|
28 |
-
select.disqus-replace {
|
29 |
-
border-color: #C6D9E9;
|
30 |
-
}
|
31 |
-
|
32 |
-
.dsq-content h2 {
|
33 |
-
line-height: 41px;
|
34 |
-
margin: 15px 0 10px;
|
35 |
-
}
|
36 |
-
|
37 |
-
.dsq-alert {
|
38 |
-
color: #fff;
|
39 |
-
background: #e76c35;
|
40 |
-
border: 1px solid #8f3e1c;
|
41 |
-
padding: 5px;
|
42 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/readme.txt
DELETED
@@ -1,287 +0,0 @@
|
|
1 |
-
=== Disqus Comment System ===
|
2 |
-
Contributors: disqus, alexkingorg, crowdfavorite, zeeg, tail, thetylerhayes
|
3 |
-
Tags: comments, threaded, email, notification, spam, avatars, community, profile, widget, disqus
|
4 |
-
Requires at least: 2.8
|
5 |
-
Tested up to: 3.9.1
|
6 |
-
Stable tag: 2.76
|
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 |
-
|
17 |
-
The Disqus for WordPress plugin seamlessly integrates using the Disqus API and by syncing with WordPress comments.
|
18 |
-
|
19 |
-
= Disqus for WordPress =
|
20 |
-
|
21 |
-
* Uses the Disqus API
|
22 |
-
* Comments indexable by search engines (SEO-friendly)
|
23 |
-
* Support for importing existing comments
|
24 |
-
* Auto-sync (backup) of comments with Disqus and WordPress database
|
25 |
-
|
26 |
-
= Disqus Features =
|
27 |
-
|
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
|
37 |
-
|
38 |
-
== Installation ==
|
39 |
-
|
40 |
-
**NOTE: It is recommended that you [backup your database](http://codex.wordpress.org/Backing_Up_Your_Database) before installing the plugin.**
|
41 |
-
|
42 |
-
1. Unpack archive to this archive to the 'wp-content/plugins/' directory inside
|
43 |
-
of WordPress
|
44 |
-
|
45 |
-
* Maintain the directory structure of the archive (all extracted files
|
46 |
-
should exist in 'wp-content/plugins/disqus-comment-system/'
|
47 |
-
|
48 |
-
2. From your blog administration, click on Comments to change settings
|
49 |
-
(WordPress 2.0 users can find the settings under Options > Disqus.)
|
50 |
-
|
51 |
-
= More documentation =
|
52 |
-
|
53 |
-
Go to [http://disqus.com/help/wordpress](http://disqus.com/help/wordpress)
|
54 |
-
|
55 |
-
== Screenshots ==
|
56 |
-
|
57 |
-
1. Disqus Comments
|
58 |
-
2. Discovery Box (part of Disqus Comments)
|
59 |
-
3. Inline Moderation Interface
|
60 |
-
|
61 |
-
== Changes ==
|
62 |
-
|
63 |
-
2.76
|
64 |
-
|
65 |
-
* Security fixes (Thanks to Nik Cubrilovic, Alexander Concha and Marc-Alexandre Montpas)
|
66 |
-
* Bump tested Wordpress version to 3.9.1
|
67 |
-
* Remove obsolete SSO button uploader
|
68 |
-
* Enable 'Output javascript in footer' by default during installation
|
69 |
-
* Fix for 'Reset' function not completely working the first time
|
70 |
-
|
71 |
-
2.75
|
72 |
-
|
73 |
-
* Bump supported WordPress version to 3.8.
|
74 |
-
* Properly encode site name for SSO login button.
|
75 |
-
* Increased timeout for comment exporter to 60 seconds.
|
76 |
-
* Use https: for admin pages
|
77 |
-
* Miscellaneous bug fixes and improvements.
|
78 |
-
|
79 |
-
2.74
|
80 |
-
|
81 |
-
* Updated settings UI
|
82 |
-
* Add filter hook for setting custom Disqus language
|
83 |
-
* For WP >= 3.5, use new media uploader
|
84 |
-
* Disable internal Wordpress commenting if Disqus is enabled (thanks Artem Russakovskii)
|
85 |
-
* Cleaned up installation and configuration flow
|
86 |
-
* Added link to WP backup guide in README
|
87 |
-
* Fix admin bar comments link
|
88 |
-
* Added a check to avoid a missing key notice when WP_DEBUG=TRUE (thanks Jason Lengstorf)
|
89 |
-
* Prevent 404 errors for embed.js from being reported by Google Webmaster Tools (missed in 2.73 README)
|
90 |
-
|
91 |
-
2.73
|
92 |
-
|
93 |
-
* Apply CDATA patch from Wordpress 3.4 to dsq_export_wxr_cdata() (thanks Artem
|
94 |
-
Russakovskii for the patch).
|
95 |
-
* Added Single Sign-On log-in button and icon to options (only for sites using SSO)
|
96 |
-
* Output user website if set in SSO payload
|
97 |
-
* Added plugin activation statuses to debug info
|
98 |
-
* Bump supported WordPress version to 3.4.1
|
99 |
-
* Fixed issue where disqus_dupecheck won't properly uninstall
|
100 |
-
* Load second count.js (output-in-footer version) reference via SSL too
|
101 |
-
* Added screenshots
|
102 |
-
|
103 |
-
2.72
|
104 |
-
|
105 |
-
* Load count.js via SSL when page is accessed via HTTPS
|
106 |
-
* Fixed styling issue with Disqus admin.
|
107 |
-
|
108 |
-
2.71
|
109 |
-
|
110 |
-
* Fixed issue where embed wasn't using SSL if page was loaded via HTTPS
|
111 |
-
* Fixed issue with syncing where to user's without a display_name would
|
112 |
-
revert back to Anonymous (really this time).
|
113 |
-
* Fixed issue where Google Webmaster Tools would incorrectly report 404s.
|
114 |
-
* Fixed issue with Disqus admin display issues.
|
115 |
-
|
116 |
-
2.70
|
117 |
-
|
118 |
-
* Properly uninstall disqus_dupecheck index when uninstalling plugin.
|
119 |
-
* Fixed issue with syncing where to user's without a display_name would
|
120 |
-
revert back to Anonymous.
|
121 |
-
* Fixed issue where IP addresses weren't being synced properly.
|
122 |
-
* Allow non-Administrators (e.g., editors) to see Disqus Moderate panel
|
123 |
-
inline (fixes GH-3)
|
124 |
-
|
125 |
-
2.69
|
126 |
-
|
127 |
-
* Bumped version number.
|
128 |
-
|
129 |
-
2.68
|
130 |
-
|
131 |
-
* Removed debugging information from web requests in CLI scripts (thanks
|
132 |
-
Ryan Dewhurst for the report).
|
133 |
-
* Reduced sync lock time to 1 hour.
|
134 |
-
* Fixed an issue which was not allowing pending posts (for sync) to clear.
|
135 |
-
* Fixed an issue with CLI scripts when used with certain caching plugins.
|
136 |
-
|
137 |
-
2.67
|
138 |
-
|
139 |
-
* Bumped synchronization timer delays to 5 minutes.
|
140 |
-
* wp-cli.php now requires php_sapi_name to be set to 'cli' for execution.
|
141 |
-
* Fixed a bug with imported comments not storing the correct relative date.
|
142 |
-
* Added a lock for dsq_sync_forum, which can be overriden in the command line script
|
143 |
-
with the --force tag.
|
144 |
-
* dsq_sync_forum will now handle all pending post metadata updates (formerly a separate
|
145 |
-
cron task, dsq_sync_post).
|
146 |
-
|
147 |
-
2.66
|
148 |
-
|
149 |
-
* Fixed issue with jQuery usage which conflicted with updated jQuery version.
|
150 |
-
|
151 |
-
2.65
|
152 |
-
|
153 |
-
* Corrected a bug that was causing posts to not appear due to invalid references.
|
154 |
-
|
155 |
-
2.64
|
156 |
-
|
157 |
-
* Added an option to disable Disqus without deactivating the plugin.
|
158 |
-
* Added a second check for comment sync to prevent stampede race conditions in WP cron.
|
159 |
-
|
160 |
-
2.63
|
161 |
-
|
162 |
-
* Added command line script to import comments from DISQUS (scripts/import-comments.php).
|
163 |
-
* Added command line script to export comments to DISQUS (scripts/export-comments.php).
|
164 |
-
* The exporter will now only do one post at a time.
|
165 |
-
* The exporter now only sends required attributes to DISQUS.
|
166 |
-
* Moved media into its own directory.
|
167 |
-
|
168 |
-
2.62
|
169 |
-
|
170 |
-
* Changed legacy query to use = operator instead of LIKE so it can be indexed.
|
171 |
-
|
172 |
-
2.61
|
173 |
-
|
174 |
-
* Fixed an issue which was causing invalid information to be presented in RSS feeds.
|
175 |
-
|
176 |
-
2.60
|
177 |
-
|
178 |
-
* Added support for new Single Sign-On (API version 3.0).
|
179 |
-
* Improved support for legacy Single Sign-On.
|
180 |
-
|
181 |
-
2.55
|
182 |
-
|
183 |
-
* Added support for get_comments_number in templates.
|
184 |
-
|
185 |
-
2.54
|
186 |
-
|
187 |
-
* Updated URL to forum moderation.
|
188 |
-
|
189 |
-
2.53
|
190 |
-
|
191 |
-
* Fixed an issue with fsockopen and GET requests (only affects certain users).
|
192 |
-
|
193 |
-
2.52
|
194 |
-
|
195 |
-
* Fixed issue with Disqus-API package not getting updated (only affecting PHP4).
|
196 |
-
|
197 |
-
2.51
|
198 |
-
|
199 |
-
* Added CDATA comments for JavaScript.
|
200 |
-
* Syncing comments will now restore missing thread information from old imports.
|
201 |
-
* Install and uninstall processes have been improved.
|
202 |
-
* Fixed an issue in PHP4 with importing comments.
|
203 |
-
* Fixed an issue that could cause duplicate comments in some places.
|
204 |
-
* Added an option to remove existing imported comments when importing.
|
205 |
-
|
206 |
-
2.50
|
207 |
-
|
208 |
-
* Added missing file.
|
209 |
-
|
210 |
-
2.49
|
211 |
-
|
212 |
-
* Database usage has been optimized for storing comment meta data.
|
213 |
-
|
214 |
-
You can perform this migration automatically by visiting Comments -> Disqus, or if
|
215 |
-
you have a large database, you may do this by hand:
|
216 |
-
|
217 |
-
CREATE INDEX disqus_dupecheck ON `wp_commentmeta` (meta_key, meta_value(11));
|
218 |
-
INSERT INTO `wp_options` (blog_id, option_name, option_value, autoload) VALUES (0, 'disqus_version', '2.49', 'yes') ON DUPLICATE KEY UPDATE option_value = VALUES(option_value);
|
219 |
-
|
220 |
-
2.48
|
221 |
-
|
222 |
-
* Comment synchronization has been optimized to be a single call per-site.
|
223 |
-
* disqus.css will now only load when displaying comments
|
224 |
-
|
225 |
-
2.47
|
226 |
-
|
227 |
-
* Fixed a security hole with comment importing.
|
228 |
-
* Reverted ability to use default template comments design.
|
229 |
-
* Comments will now store which version they were imported under.
|
230 |
-
* Added an option to disable server side rendering.
|
231 |
-
|
232 |
-
2.46
|
233 |
-
|
234 |
-
* Better debugging information for export errors.
|
235 |
-
* Added the ability to manual import Disqus comments into Wordpress.
|
236 |
-
* Added thread_identifier support to exports.
|
237 |
-
* Cleaned up API error messages.
|
238 |
-
* Fixed a bug which was causing the import process to not grab only the latest set of comments.
|
239 |
-
* Added an option to disable automated synchronization with Disqus.
|
240 |
-
|
241 |
-
2.45
|
242 |
-
|
243 |
-
* Comments should now store thread information as well as certain other meta data.
|
244 |
-
* Optimize get_thread polling to only pull comments which aren't stored properly.
|
245 |
-
|
246 |
-
2.44
|
247 |
-
|
248 |
-
* Fixed JavaScript response for comments sync call.
|
249 |
-
* Comments are now marked as closed while showing the embed (fixes showing default respond form).
|
250 |
-
|
251 |
-
2.43
|
252 |
-
|
253 |
-
* Fixed a JavaScript syntax error which would cause linting to fail.
|
254 |
-
* Correct an issue that was causing comments.php to throw a syntax error under some configurations.
|
255 |
-
|
256 |
-
2.42
|
257 |
-
|
258 |
-
* Correct a bug with saving disqus_user_api_key (non-critical).
|
259 |
-
* Added settings to Debug Information.
|
260 |
-
* Adjusting all includes to use absolute paths.
|
261 |
-
* Adjusted JSON usage to solve a problem for some clients.
|
262 |
-
|
263 |
-
2.41
|
264 |
-
|
265 |
-
* Correct a bug with double urlencoding titles.
|
266 |
-
|
267 |
-
2.40
|
268 |
-
|
269 |
-
* Comments are now synced with Disqus as a delayed asynchronous cron event.
|
270 |
-
* Comment count code has been updated to use the new widget. (Comment counts
|
271 |
-
must be linked to get tracked within "the loop" now).
|
272 |
-
* API bindings have been migrated to the generic 1.1 Disqus API.
|
273 |
-
* Pages will now properly update their permalink with Disqus when it changes. This is
|
274 |
-
done within the sync event above.
|
275 |
-
* There is now a Debug Information pane under Advanced to assist with support requests.
|
276 |
-
* When Disqus is unreachable it will fallback to the theme's built-in comment display.
|
277 |
-
* Legacy mode is no longer available.
|
278 |
-
* The plugin management interface can now be localized.
|
279 |
-
* The plugin is now valid HTML5.
|
280 |
-
|
281 |
-
== Support ==
|
282 |
-
|
283 |
-
* Visit http://disqus.com/help/wordpress for help documentation.
|
284 |
-
|
285 |
-
* Visit http://help.disqus.com for help from our support team.
|
286 |
-
|
287 |
-
* Disqus also recommends the [WordPress HelpCenter](http://wphelpcenter.com/) for extended help. Disqus is not associated with the WordPress HelpCenter in any way.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/screenshot-1.png
DELETED
Binary file
|
trunk/screenshot-2.png
DELETED
Binary file
|
trunk/screenshot-3.png
DELETED
Binary file
|
trunk/scripts/export-comments.php
DELETED
@@ -1,106 +0,0 @@
|
|
1 |
-
#!/usr/bin/php
|
2 |
-
<?php
|
3 |
-
/**
|
4 |
-
* Incrementally (in chunks of EXPORT_CHUNK_SIZE) exports all comments to DISQUS.
|
5 |
-
*
|
6 |
-
* ``php export-comments.php``
|
7 |
-
*/
|
8 |
-
|
9 |
-
require_once(dirname(__FILE__) . '/../lib/wp-cli.php');
|
10 |
-
require_once(dirname(__FILE__) . '/../disqus.php');
|
11 |
-
require_once(dirname(__FILE__) . '/../export.php');
|
12 |
-
|
13 |
-
define('EXPORT_CHUNK_SIZE', 100);
|
14 |
-
|
15 |
-
$forum_url = get_option('disqus_forum_url');
|
16 |
-
|
17 |
-
if (empty($forum_url)) {
|
18 |
-
print_line("Disqus has not been configured on this installation!");
|
19 |
-
die();
|
20 |
-
}
|
21 |
-
|
22 |
-
print_line('---------------------------------------------------------');
|
23 |
-
print_line('Discovered DISQUS forum shortname as %s', $forum_url);
|
24 |
-
print_line('---------------------------------------------------------');
|
25 |
-
|
26 |
-
global $wpdb, $dsq_api;
|
27 |
-
|
28 |
-
$timestamp = 0;
|
29 |
-
$post_id = 0;
|
30 |
-
$total = 0;
|
31 |
-
$eof = 0;
|
32 |
-
$total_exported = 0;
|
33 |
-
$global_start = microtime();
|
34 |
-
|
35 |
-
$max_post_id = $wpdb->get_var($wpdb->prepare("
|
36 |
-
SELECT MAX(ID)
|
37 |
-
FROM $wpdb->posts
|
38 |
-
WHERE post_type != 'revision'
|
39 |
-
AND post_status = 'publish'
|
40 |
-
AND comment_count > 0
|
41 |
-
AND ID > %d
|
42 |
-
", $post_id));
|
43 |
-
|
44 |
-
print_line('Max post id is %d', $max_post_id);
|
45 |
-
|
46 |
-
while ($post_id < $max_post_id) {
|
47 |
-
$start = microtime();
|
48 |
-
|
49 |
-
$post = $wpdb->get_results($wpdb->prepare("
|
50 |
-
SELECT *
|
51 |
-
FROM $wpdb->posts
|
52 |
-
WHERE post_type != 'revision'
|
53 |
-
AND post_status = 'publish'
|
54 |
-
AND comment_count > 0
|
55 |
-
AND ID > %d
|
56 |
-
ORDER BY ID ASC
|
57 |
-
LIMIT 1
|
58 |
-
", $post_id));
|
59 |
-
$post = $post[0];
|
60 |
-
$post_id = $post->ID;
|
61 |
-
|
62 |
-
print_line(' Exporting comments for post id %d', $post_id);
|
63 |
-
|
64 |
-
$response = null;
|
65 |
-
$query = $wpdb->get_results( $wpdb->prepare("SELECT COUNT(*) as total FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_agent NOT LIKE 'Disqus/%%' LIMIT ".EXPORT_CHUNK_SIZE, $post_id) );
|
66 |
-
$total_comments = $query[0]->total;
|
67 |
-
|
68 |
-
$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_agent NOT LIKE 'Disqus/%%' LIMIT ".EXPORT_CHUNK_SIZE, $post_id) );
|
69 |
-
$group_id = null;
|
70 |
-
$at = 0;
|
71 |
-
|
72 |
-
// we need to send empty files to ensure EOF happens
|
73 |
-
while (($at === 0 && $post_id == $max_post_id) || $at < $total_comments) {
|
74 |
-
if ($post_id == $max_post_id && ($at + EXPORT_CHUNK_SIZE) >= $total_comments) {
|
75 |
-
$eof = 1;
|
76 |
-
}
|
77 |
-
$wxr = dsq_export_wp($post, $comments);
|
78 |
-
$response = $dsq_api->import_wordpress_comments($wxr, $timestamp, $eof);
|
79 |
-
if (!($response['group_id'] > 0)) {
|
80 |
-
print_line('---------------------------------------------------------');
|
81 |
-
print_line('There was an error communicating with DISQUS!');
|
82 |
-
print_line($dsq_api->get_last_error());
|
83 |
-
print_line('---------------------------------------------------------');
|
84 |
-
}
|
85 |
-
$group_id = $response['group_id'];
|
86 |
-
print_line(' %d comments exported', count($comments), $time);
|
87 |
-
$total_exported += count($comments);
|
88 |
-
$at += EXPORT_CHUNK_SIZE;
|
89 |
-
$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_agent NOT LIKE 'Disqus/%%' LIMIT ".EXPORT_CHUNK_SIZE." OFFSET {$at}", $post->ID) );
|
90 |
-
// assuming the cache is the internal, reset it's value to empty to avoid
|
91 |
-
// large memory consumption
|
92 |
-
$wp_object_cache->cache = array();
|
93 |
-
}
|
94 |
-
|
95 |
-
$time = abs(microtime() - $start);
|
96 |
-
print_line(' Done! (took %.2fs)', $time);
|
97 |
-
}
|
98 |
-
$total_time = abs(microtime() - $global_start);
|
99 |
-
print_line('---------------------------------------------------------');
|
100 |
-
print_line('Done (processing took %.2fs)! %d comments were sent to DISQUS', $total_time, $total_exported);
|
101 |
-
if ($group_id) {
|
102 |
-
print_line('');
|
103 |
-
print_line('Status available at http://import.disqus.com/group/%d/', $group_id);
|
104 |
-
}
|
105 |
-
print_line('---------------------------------------------------------');
|
106 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/scripts/import-comments.php
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
#!/usr/bin/php
|
2 |
-
<?php
|
3 |
-
/**
|
4 |
-
* Incrementally downloads all comments from DISQUS.
|
5 |
-
*
|
6 |
-
* ``php import-comments.php``
|
7 |
-
*/
|
8 |
-
|
9 |
-
require_once(dirname(__FILE__) . '/../lib/wp-cli.php');
|
10 |
-
require_once(dirname(__FILE__) . '/../disqus.php');
|
11 |
-
|
12 |
-
$forum_url = get_option('disqus_forum_url');
|
13 |
-
|
14 |
-
if (empty($forum_url)) {
|
15 |
-
print_line("Disqus has not been configured on this installation!");
|
16 |
-
die();
|
17 |
-
}
|
18 |
-
|
19 |
-
print_line('---------------------------------------------------------');
|
20 |
-
print_line('Discovered DISQUS forum shortname as %s', $forum_url);
|
21 |
-
print_line('---------------------------------------------------------');
|
22 |
-
|
23 |
-
$imported = true;
|
24 |
-
if (in_array('--reset', $argv)) {
|
25 |
-
$last_comment_id = 0;
|
26 |
-
} else {
|
27 |
-
$last_comment_id = get_option('disqus_last_comment_id');
|
28 |
-
}
|
29 |
-
$force = (in_array('--force', $argv));
|
30 |
-
$total = 0;
|
31 |
-
$global_start = microtime();
|
32 |
-
|
33 |
-
$memory_usage = memory_get_peak_usage();
|
34 |
-
while ($imported) {
|
35 |
-
print_line(' Importing chunk starting at comment id %d', $last_comment_id);
|
36 |
-
$start = microtime();
|
37 |
-
$result = dsq_sync_forum($last_comment_id, $force);
|
38 |
-
if ($result === false) {
|
39 |
-
print_line('---------------------------------------------------------');
|
40 |
-
print_line('There was an error communicating with DISQUS!');
|
41 |
-
print_line($dsq_api->get_last_error());
|
42 |
-
print_line('---------------------------------------------------------');
|
43 |
-
die();
|
44 |
-
break;
|
45 |
-
} else {
|
46 |
-
list($imported, $last_comment_id) = $result;
|
47 |
-
}
|
48 |
-
$total += $imported;
|
49 |
-
$time = abs(microtime() - $start);
|
50 |
-
|
51 |
-
// assuming the cache is the internal, reset it's value to empty to avoid
|
52 |
-
// large memory consump
|
53 |
-
$wp_object_cache->cache = array();
|
54 |
-
|
55 |
-
$new_memory_usage = memory_get_peak_usage();
|
56 |
-
print_line(' %d comments imported (took %.2fs, memory increased by %db)', $imported, $time, ($new_memory_usage - $memory_usage));
|
57 |
-
$memory_usage = $new_memory_usage;
|
58 |
-
}
|
59 |
-
$total_time = abs(microtime() - $global_start);
|
60 |
-
print_line('---------------------------------------------------------');
|
61 |
-
print_line('Done (took %.2fs)! %d comments imported from DISQUS', $total_time, $total);
|
62 |
-
print_line('---------------------------------------------------------');
|
63 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/upgrade.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
require(ABSPATH . 'wp-includes/version.php');
|
3 |
-
|
4 |
-
if ( !current_user_can('manage_options') ) {
|
5 |
-
die();
|
6 |
-
}
|
7 |
-
|
8 |
-
$step = (isset($_GET['step']) ? $_GET['step'] : null);
|
9 |
-
|
10 |
-
?>
|
11 |
-
<div class="wrap">
|
12 |
-
<h2><?php echo dsq_i('Upgrade Disqus Comments'); ?></h2>
|
13 |
-
<form method="POST" action="?page=disqus&step=<?php echo $step; ?>">
|
14 |
-
<?php wp_nonce_field('dsq-wpnonce_upgrade', 'dsq-form_nonce_upgrade'); ?>
|
15 |
-
<p><?php echo dsq_i('You need to upgrade your database to continue.'); ?></p>
|
16 |
-
|
17 |
-
<p class="submit" style="text-align: left">
|
18 |
-
<input type="submit" name="upgrade" value="Upgrade »" />
|
19 |
-
</p>
|
20 |
-
</form>
|
21 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/xd_receiver.htm
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <body> <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/XdCommReceiver.js" type="text/javascript"></script> </body> </html>
|
|
upgrade.php
CHANGED
@@ -10,7 +10,8 @@ $step = (isset($_GET['step']) ? $_GET['step'] : null);
|
|
10 |
?>
|
11 |
<div class="wrap">
|
12 |
<h2><?php echo dsq_i('Upgrade Disqus Comments'); ?></h2>
|
13 |
-
<form method="POST" action="?page=disqus&step=<?php echo $step; ?>">
|
|
|
14 |
<p><?php echo dsq_i('You need to upgrade your database to continue.'); ?></p>
|
15 |
|
16 |
<p class="submit" style="text-align: left">
|
10 |
?>
|
11 |
<div class="wrap">
|
12 |
<h2><?php echo dsq_i('Upgrade Disqus Comments'); ?></h2>
|
13 |
+
<form method="POST" action="?page=disqus&step=<?php echo esc_attr($step); ?>">
|
14 |
+
<?php wp_nonce_field('dsq-wpnonce_upgrade', 'dsq-form_nonce_upgrade'); ?>
|
15 |
<p><?php echo dsq_i('You need to upgrade your database to continue.'); ?></p>
|
16 |
|
17 |
<p class="submit" style="text-align: left">
|