Version Description
Download this release
Release Info
Developer | Disqus |
Plugin | Disqus Comment System |
Version | 2.02.2812 |
Comparing to | |
See all releases |
Version 2.02.2812
- comments-legacy.php +13 -0
- comments.php +325 -0
- disqus.php +355 -0
- export.php +302 -0
- images/logo.png +0 -0
- lib/api.php +157 -0
- lib/url.php +260 -0
- manage.php +320 -0
- readme.txt +66 -0
- scripts/manage.js +38 -0
- styles/manage-pre25.css +67 -0
- styles/manage.css +28 -0
comments-legacy.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$permalink = get_permalink();
|
3 |
+
$title = get_the_title();
|
4 |
+
$excerpt = get_the_excerpt();
|
5 |
+
?>
|
6 |
+
<div id="disqus_thread"></div>
|
7 |
+
<script type="text/javascript">
|
8 |
+
var disqus_url = '<?php echo $permalink; ?> ';
|
9 |
+
var disqus_title = '<?php echo $title; ?>';
|
10 |
+
var disqus_message = '<?php echo $excerpt; ?>';
|
11 |
+
</script>
|
12 |
+
<script type="text/javascript" src="<?php echo DISQUS_URL; ?>/forums/<?php echo get_option('disqus_forum_url'); ?>/embed.js"></script>
|
13 |
+
<noscript><a href="<?php echo 'http://' . get_option('disqus_forum_url') . '.' . DISQUS_DOMAIN . '/?url=' . $the_permalink; ?>">View the entire comment thread.</a></noscript>
|
comments.php
ADDED
@@ -0,0 +1,325 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<?php
|
3 |
+
global $dsq_response, $dsq_sort;
|
4 |
+
$site_url = get_option('siteurl');
|
5 |
+
?>
|
6 |
+
<link rel="stylesheet" href="<?php echo DISQUS_API_URL; ?>/stylesheets/<?php echo strtolower(get_option('disqus_forum_url')); ?>/disqus.css" type="text/css" media="screen" />
|
7 |
+
|
8 |
+
<div id="disqus_thread">
|
9 |
+
<div id="dsq-content">
|
10 |
+
<div id="dsq-post-top" style="display: none">
|
11 |
+
<?php if ( !$dsq_response['thread_locked'] ) : ?>
|
12 |
+
<div id="dsq-auth">
|
13 |
+
<div class="dsq-by"><a href="http://disqus.com/" target="_blank"><img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/dsq-button-120x19.png" alt="discussion by DISQUS" /></a></div>
|
14 |
+
<div class="dsq-auth-header">
|
15 |
+
<h3 id="dsq-add-new-comment">Add New Comment</h3>
|
16 |
+
<span id="dsq-auth-as"><noscript><br />You must have JavaScript enabled to comment.</noscript></span>
|
17 |
+
</div>
|
18 |
+
</div>
|
19 |
+
<?php else : ?>
|
20 |
+
<span id="dsq-msg-closed">Comments for this post are closed.</span>
|
21 |
+
<?php endif ; ?>
|
22 |
+
</div>
|
23 |
+
<div style="margin:10px 0">
|
24 |
+
<a id="dsq-options-toggle" href="#" onclick="Dsq.Thread.toggleOptions(); return false"><img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/dsq-options-plus.png" /></a>
|
25 |
+
</div>
|
26 |
+
|
27 |
+
<div id="dsq-options" style="display:none">
|
28 |
+
<span id="dsq-auth-wrap"></span>
|
29 |
+
<div id="dsq-extra-links">
|
30 |
+
<li>
|
31 |
+
<img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/bullet-feed.png" /><strong>Subscribe</strong>:
|
32 |
+
<a href="http://<?php echo strtolower(get_option('disqus_forum_url')) . '.' . DISQUS_DOMAIN . '/' . $dsq_response['thread_slug'] . '/latest.rss'; ?>">This Thread</a>
|
33 |
+
</li>
|
34 |
+
<li>
|
35 |
+
<img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/bullet-go.png" /><strong>Go to</strong>:
|
36 |
+
<a href="<?php echo DISQUS_URL . '/track/'; ?>">My Comments</a> ·
|
37 |
+
<a href="http://<?php echo strtolower(get_option('disqus_forum_url')) . '.' . DISQUS_DOMAIN . '/' . $dsq_response['thread_slug'] . '/'; ?>">Community Page</a>
|
38 |
+
</li>
|
39 |
+
</div>
|
40 |
+
<div class="dsq-extra-meta">
|
41 |
+
<?php if ( $dsq_response['num_posts'] ) : ?>
|
42 |
+
Sort thread by:
|
43 |
+
<select onchange="Dsq.Thread.sortBy(this.value);">
|
44 |
+
<option value="hot" <?php if(4==$dsq_sort){echo 'selected="selected"';}?>>Hot comments</option>
|
45 |
+
<option value="best" <?php if(3==$dsq_sort){echo 'selected="selected"';}?>>Best comments</option>
|
46 |
+
<option value="newest" <?php if(2==$dsq_sort){echo 'selected="selected"';}?>>Newest first</option>
|
47 |
+
<option value="oldest" <?php if(1==$dsq_sort){echo 'selected="selected"';}?>>Oldest first</option>
|
48 |
+
</select>
|
49 |
+
<?php endif ; ?>
|
50 |
+
</div>
|
51 |
+
</div>
|
52 |
+
|
53 |
+
<h3 id="dsq-comments-count">
|
54 |
+
<?php if ( $dsq_response['num_posts'] ) : ?>
|
55 |
+
Viewing <?php echo $dsq_response['num_posts']; ?> Comment<?php if($dsq_response['num_posts'] != 1) { echo 's'; }; ?>
|
56 |
+
<?php endif ; ?>
|
57 |
+
</h3>
|
58 |
+
|
59 |
+
<div id="dsq-alerts">
|
60 |
+
<p id="dsq-alerts-approve" style="display: none">Thanks. Your comment is awaiting approval by a moderator.</p>
|
61 |
+
<p id="dsq-alerts-claim" style="display: none">Do you already have an account? <a href="<?php echo DISQUS_URL; ?>/claim/">Log in and claim this comment</a>.</p>
|
62 |
+
</div>
|
63 |
+
|
64 |
+
<ul id="dsq-comments">
|
65 |
+
<?php foreach ( $dsq_response['posts'] as $comment ) : ?>
|
66 |
+
<?php
|
67 |
+
$dsq_profile_url = DISQUS_URL . '/people/' . $comment['user']['profile'] . '/';
|
68 |
+
?>
|
69 |
+
<?php if ( $comment['killed'] ) : ?>
|
70 |
+
<li style="margin-left:<?php echo $comment['depth'] * 30; ?>px" class="disqus_commentset"><em>Comment removed.</em></li>
|
71 |
+
<?php else : ?>
|
72 |
+
<div id="comment-<?php echo $comment['id']; ?>"></div>
|
73 |
+
<li id="dsq-comment-<?php echo $comment['id']; ?>" style="margin-left:<?php echo $comment['depth'] * 30; ?>px" class="dsq-comment <?php if($comment['user']['is_creator']) echo 'special'; ?>">
|
74 |
+
<ul class="dsq-comment-rate" id="dsq-rate-loading-<?php echo $comment['id']; ?>" style="display: none"><img src="<?php echo DISQUS_MEDIA_URL; ?>/images/loading-small.gif" /></ul>
|
75 |
+
<ul class="dsq-comment-rate" id="dsq-rate-<?php echo $comment['id']; ?>">
|
76 |
+
<li id="dsq-rate-up-<?php echo $comment['id']; ?>"><a id="dsq-rate-up-a-<?php echo $comment['id']; ?>" class="dsq-arrows" href="#" title="Rate Up"><img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/arrow2-up.png" alt="^" /></a></li>
|
77 |
+
<li id="dsq-rate-down-<?php echo $comment['id']; ?>"><a id="dsq-rate-down-a-<?php echo $comment['id']; ?>" class="dsq-arrows" href="#" title="Rate Down"><img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/arrow2-down.png" alt="v" /></a></li>
|
78 |
+
</ul>
|
79 |
+
<div id="dsq-comment-header-<?php echo $comment['id']; ?>" class="dsq-comment-header">
|
80 |
+
<div class="dsq-header-avatar" id="dsq-header-avatar-<?php echo $comment['id']; ?>">
|
81 |
+
<a id="dsq-avatar-<?php echo $comment['id']; ?>" href="<?php echo $dsq_profile_url; ?>" title="Profile">
|
82 |
+
<img src="<?php echo $comment['user']['avatar_url']; ?>" />
|
83 |
+
</a>
|
84 |
+
<ul id="dsq-menu-<?php echo $comment['id']; ?>" class="dsq-menu" style="display:none">
|
85 |
+
<?php if ( $comment['parent_id'] ) : ?>
|
86 |
+
<li><a href="#comment-<?php echo $comment['parent_id']; ?>">Parent</a></li>
|
87 |
+
<?php endif ; ?>
|
88 |
+
<li><a href="#comment-<?php echo $comment['id']; ?>">Permalink</a></li>
|
89 |
+
<li style="display: none">
|
90 |
+
<a id="dsq-admin-toggle-<?php echo $comment['id']; ?>" class="dsq-admin-toggle" href="#">
|
91 |
+
Admin<img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/pointer-right.png" />
|
92 |
+
</a>
|
93 |
+
</li>
|
94 |
+
<li id="dsq-admin-panel-<?php echo $comment['id']; ?>" class="dsq-admin-panel" style="display: none">
|
95 |
+
<ul>
|
96 |
+
<li id="dsq-admin-email-<?php echo $comment['id']; ?>" class="dsq-admin-email"></li>
|
97 |
+
<li id="dsq-admin-ip-<?php echo $comment['id']; ?>" class="dsq-admin-ip"></li>
|
98 |
+
<li><a id="dsq-remove-<?php echo $comment['id']; ?>" href="#">Remove Post</a></li>
|
99 |
+
<?php if($comment['user']['id']) : ?>
|
100 |
+
<li><a id="dsq-block-username-<?php echo $comment['id']; ?>" href="#">Block username</a></li>
|
101 |
+
<?php endif; ?>
|
102 |
+
<li><a id="dsq-block-email-<?php echo $comment['id']; ?>" href="#">Block email</a></li>
|
103 |
+
<li><a id="dsq-block-ip-<?php echo $comment['id']; ?>" href="#">Block IP address</a></li>
|
104 |
+
</ul>
|
105 |
+
</li>
|
106 |
+
</ul>
|
107 |
+
</div>
|
108 |
+
|
109 |
+
<cite id="dsq-cite-<?php echo $comment['id']; ?>">
|
110 |
+
<?php if($comment['user']['url']) : ?>
|
111 |
+
<a id="dsq-author-user-<?php echo $comment['id']; ?>" href="<?php echo $comment['user']['url']; ?>">
|
112 |
+
<?php echo $comment['user']['display_name']; ?>
|
113 |
+
</a>
|
114 |
+
<?php else: ?>
|
115 |
+
<span id="dsq-author-user-<?php echo $comment['id']; ?>">
|
116 |
+
<?php echo $comment['user']['display_name']; ?>
|
117 |
+
</span>
|
118 |
+
<?php endif; ?>
|
119 |
+
</cite>
|
120 |
+
|
121 |
+
<span class="dsq-header-meta">
|
122 |
+
<a id="dsq-time-<?php echo $comment['id']; ?>" class="dsq-header-time" href="#comment-<?php echo $comment['id']; ?>" title="Permalink"><?php echo $comment['date_fmt']; ?></a>
|
123 |
+
<span id="dsq-points-<?php echo $comment['id']; ?>" class="dsq-header-points" style="display: none"><?php echo $comment['points']; ?> point<?php if($comment['points'] != 1) { echo 's'; } ?></span>
|
124 |
+
</span>
|
125 |
+
</div>
|
126 |
+
|
127 |
+
<div class="dsq-comment-body">
|
128 |
+
<p id="dsq-login-<?php echo $comment['id']; ?>" style="display:none">Please <a href="<?php echo DISQUS_URL . '/login/?next=article:' . $dsq_response['thread_id']; ?>">login</a> to rate.</p>
|
129 |
+
<p id="dsq-comment-alert-<?php echo $comment['id']; ?>" class="dsq-comment-alert" style="display: none">
|
130 |
+
Do you already have an account? <a href="<?php echo DISQUS_URL . '/claim/';?>">Log in and claim this comment</a>.
|
131 |
+
</p>
|
132 |
+
<div id="dsq-comment-message-<?php echo $comment['id']; ?>" class="dsq-comment-message"><?php echo $comment['message']; ?></div>
|
133 |
+
|
134 |
+
<?php if($dsq_response['seesmic_enabled'] && $comment['seesmic']['id']) : ?>
|
135 |
+
|
136 |
+
<div id='<?php echo $comment['seesmic']['id'][0]; ?>_preview'><a href="http://www.seesmic.com/video/<?php echo $comment['seesmic']['id'][0]; ?>" target='_blank' class='see_link'> </a>
|
137 |
+
<div style='display:block;width:160px; height:120px; border:none; background-image:url(<?php echo $comment['seesmic']['metadata'][0]; ?>)'>
|
138 |
+
<div id='<?php echo $comment['seesmic']['id'][0]; ?>_hide' class='seePlayOverlay' style='display:none;'>
|
139 |
+
<img onclick="see_play_video('<?php echo $comment['seesmic']['id'][0]; ?>',false)" src='<?php echo DISQUS_MEDIA_URL; ?>/images/seesmic/stopOverlay.png' width='50' height='50' style='cursor:pointer; cursor:hand; padding-top: 30px; padding-left: 50px' />
|
140 |
+
</div>
|
141 |
+
<div id='<?php echo $comment['seesmic']['id'][0]; ?>_show' class='seePlayOverlay'>
|
142 |
+
<img onclick="see_play_video('<?php echo $comment['seesmic']['id'][0]; ?>',true)" src='<?php echo DISQUS_MEDIA_URL; ?>/images/seesmic/playOverlay.png' width='50' height='50' style='cursor:pointer; cursor:hand; border:none; padding-top: 30px; padding-left: 50px' />
|
143 |
+
</div>
|
144 |
+
</div>
|
145 |
+
</div>
|
146 |
+
<div id='<?php echo $comment['seesmic']['id'][0]; ?>_content' style='display:block; width:100%; padding-top:5px'></div>
|
147 |
+
<?php endif ; ?>
|
148 |
+
</div>
|
149 |
+
|
150 |
+
<div class="dsq-comment-footer" id="dsq-comment-footer-<?php echo $comment['id']; ?>">
|
151 |
+
<?php if ( !$dsq_response['thread_locked'] ) : ?>
|
152 |
+
<a href="#" id="dsq-reply-link-<?php echo $comment['id'] ?>">reply</a>
|
153 |
+
<span id="dsq-edit-wrap-<?php echo $comment['id'] ?>" style="display: none">
|
154 |
+
<a href="#" id="dsq-edit-<?php echo $comment['id'] ?>" style="display: none">edit</a>
|
155 |
+
</span>
|
156 |
+
<span id="dsq-reblog-wrap-<?php echo $comment['id'] ?>" style="display: none">
|
157 |
+
<a href="#" id="dsq-reblog-<?php echo $comment['id'] ?>" class="dsq-reblog">reblog</a>
|
158 |
+
</span>
|
159 |
+
<span id="dsq-post-report-<?php echo $comment['id'] ?>" style="display: none">
|
160 |
+
<a id="dsq-post-report-a-<?php echo $comment['id'] ?>" href="#" class="dsq-post-report">flag</a>
|
161 |
+
</span>
|
162 |
+
<?php if ( $dsq_response['seesmic_enabled'] ) : ?>
|
163 |
+
<a id="dsq-post-video-<?php echo $comment['id']; ?>" href="#" style="display: none"><img src="<?php echo DISQUS_MEDIA_URL; ?>/images/seesmic/record.png" class="dsq-record-img" /> record video comment</a>
|
164 |
+
<?php endif ; ?>
|
165 |
+
|
166 |
+
<div id="dsq-reply-<?php echo $comment['id']; ?>"><!-- iframe .dsq-post-reply injected here --></div>
|
167 |
+
<?php endif ; ?>
|
168 |
+
</div>
|
169 |
+
|
170 |
+
<div id="dsq-hidden-data-<?php echo $comment['id']; ?>" style="display:none">
|
171 |
+
<?php if($comment['user']['id']) : ?>
|
172 |
+
<span style="display: none" id="dsq-hidden-clout-<?php echo $comment['id']; ?>"><?php echo $comment['user']['points']; ?></span>
|
173 |
+
<span style="display: none" id="dsq-hidden-userurl-<?php echo $comment['id']; ?>">/people/<?php echo $comment['user']['profile']; ?>/</span>
|
174 |
+
<span style="display: none" id="dsq-hidden-follow-<?php echo $comment['id']; ?>">/people/<?php echo $comment['user']['profile']; ?>/following/</span>
|
175 |
+
|
176 |
+
<span style="display: none" id="dsq-hidden-blog-<?php echo $comment['id']; ?>"><?php echo $comment['user']['url']; ?></span>
|
177 |
+
<span style="display: none" id="dsq-hidden-facebook-<?php echo $comment['id']; ?>"><?php echo $comment['user']['service_facebook']; ?></span>
|
178 |
+
<span style="display: none" id="dsq-hidden-linkedin-<?php echo $comment['id']; ?>"><?php echo $comment['user']['service_linkedin']; ?></span>
|
179 |
+
<span style="display: none" id="dsq-hidden-twitter-<?php echo $comment['id']; ?>"><?php echo $comment['user']['service_twitter']; ?></span>
|
180 |
+
<span style="display: none" id="dsq-hidden-delicious-<?php echo $comment['id']; ?>"><?php echo $comment['user']['service_delicious']; ?></span>
|
181 |
+
<span style="display: none" id="dsq-hidden-flickr-<?php echo $comment['id']; ?>"><?php echo $comment['user']['service_flickr']; ?></span>
|
182 |
+
<span style="display: none" id="dsq-hidden-tumblr-<?php echo $comment['id']; ?>"><?php echo $comment['user']['service_tumblr']; ?></span>
|
183 |
+
<?php else : ?>
|
184 |
+
<span style="display: none" id="dsq-hidden-blog-<?php echo $comment['id']; ?>"><?php echo $comment['user']['url']; ?></span>
|
185 |
+
<span style="display: none" id="dsq-hidden-userurl-<?php echo $comment['id']; ?>">/people/<?php echo $comment['user']['profile']; ?>/</span>
|
186 |
+
<span style="display: none" id="dsq-hidden-facebook-<?php echo $comment['id']; ?>"></span>
|
187 |
+
<span style="display: none" id="dsq-hidden-linkedin-<?php echo $comment['id']; ?>"></span>
|
188 |
+
<span style="display: none" id="dsq-hidden-twitter-<?php echo $comment['id']; ?>"></span>
|
189 |
+
<span style="display: none" id="dsq-hidden-delicious-<?php echo $comment['id']; ?>"></span>
|
190 |
+
<span style="display: none" id="dsq-hidden-flickr-<?php echo $comment['id']; ?>"></span>
|
191 |
+
<span style="display: none" id="dsq-hidden-tumblr-<?php echo $comment['id']; ?>"></span>
|
192 |
+
<?php endif; ?>
|
193 |
+
<span style="display: none" id="dsq-hidden-avatar-<?php echo $comment['id']; ?>"><img src="<?php echo $comment['user']['avatar_url']; ?>" /></span>
|
194 |
+
</div>
|
195 |
+
</li>
|
196 |
+
<?php endif ; ?>
|
197 |
+
<?php endforeach; ?>
|
198 |
+
</ul>
|
199 |
+
<div id="dsq-pagination"></div>
|
200 |
+
<div id="dsq-post-bottom" style="display: none">
|
201 |
+
<?php if ( !$dsq_response['thread_locked'] ) : ?>
|
202 |
+
<div id="dsq-auth">
|
203 |
+
<div class="dsq-by"><a href="http://disqus.com/" target="_blank"><img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/dsq-button-120x19.png" alt="discussion by DISQUS" /></a></div>
|
204 |
+
<div class="dsq-auth-header">
|
205 |
+
<h3 id="dsq-add-new-comment">Add New Comment</h3>
|
206 |
+
<span id="dsq-auth-as"><noscript><br />You must have JavaScript enabled to comment.</noscript></span>
|
207 |
+
</div>
|
208 |
+
</div>
|
209 |
+
<?php else : ?>
|
210 |
+
<span id="dsq-msg-closed">Comments for this post are closed.</span>
|
211 |
+
<?php endif ; ?>
|
212 |
+
</div>
|
213 |
+
<?php if ($dsq_response['linkbacks_enabled'] ) : ?>
|
214 |
+
<h3>Trackbacks</h3>
|
215 |
+
<ul id="dsq-references">
|
216 |
+
</ul>
|
217 |
+
<? endif ; ?>
|
218 |
+
</div>
|
219 |
+
</div>
|
220 |
+
|
221 |
+
|
222 |
+
<!-- embed_thread_profile.html -->
|
223 |
+
|
224 |
+
<!-- profile -->
|
225 |
+
<div id="dsq-template-profile" class="dsq-popupdiv" style="display:none">
|
226 |
+
<div id="dsq-popup-profile">
|
227 |
+
<div id="dsq-popup-top">
|
228 |
+
</div>
|
229 |
+
<div id="dsq-popup-body" class="clearfix">
|
230 |
+
<div id="dsq-popup-body-padding">
|
231 |
+
<div id="dsq-popup-header">
|
232 |
+
<a class="dsq-close-link" href="#" onclick="Dsq.Popup.hidePopup(); return false">close</a>
|
233 |
+
<span id="dsq-profile-avatar"></span>
|
234 |
+
<cite>
|
235 |
+
<span id="dsq-profile-cite"></span>(<a id="dsq-profile-userurl" href="#"></a>)
|
236 |
+
</cite>
|
237 |
+
</div>
|
238 |
+
<div id="dsq-profile-services">
|
239 |
+
<a id="dsq-profile-clout" class="dsq-profile-badge" href="#"></a>
|
240 |
+
<ul>
|
241 |
+
<li style="display:none">
|
242 |
+
<a id="dsq-service-blog" href="#" target="_blank">
|
243 |
+
<img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/services/blog.png" />
|
244 |
+
</a>
|
245 |
+
</li>
|
246 |
+
<li style="display:none">
|
247 |
+
<a id="dsq-service-facebook" href="#" target="_blank">
|
248 |
+
<img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/services/facebook.png" />
|
249 |
+
</a>
|
250 |
+
</li>
|
251 |
+
<li style="display:none">
|
252 |
+
<a id="dsq-service-linkedin" href="#" target="_blank">
|
253 |
+
<img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/services/linkedin.png" />
|
254 |
+
</a>
|
255 |
+
</li>
|
256 |
+
<li style="display:none">
|
257 |
+
<a id="dsq-service-twitter" href="#" target="_blank">
|
258 |
+
<img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/services/twitter.png" />
|
259 |
+
</a>
|
260 |
+
</li>
|
261 |
+
<li style="display:none">
|
262 |
+
<a id="dsq-service-delicious" href="#" target="_blank">
|
263 |
+
<img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/services/delicious.png" />
|
264 |
+
</a>
|
265 |
+
</li>
|
266 |
+
<li style="display:none">
|
267 |
+
<a id="dsq-service-flickr" href="#" target="_blank">
|
268 |
+
<img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/services/flickr.png" />
|
269 |
+
</a>
|
270 |
+
</li>
|
271 |
+
<li style="display:none">
|
272 |
+
<a id="dsq-service-tumblr" href="#" target="_blank">
|
273 |
+
<img src="<?php echo DISQUS_MEDIA_URL; ?>/images/embed/services/tumblr.png" />
|
274 |
+
</a>
|
275 |
+
</li>
|
276 |
+
</ul>
|
277 |
+
</div>
|
278 |
+
<div id="dsq-profile-status">
|
279 |
+
<p class="dsq-profile-label">status via twitter</p>
|
280 |
+
<p></p>
|
281 |
+
</div>
|
282 |
+
<div id="dsq-profile-recentcomments">
|
283 |
+
<p class="dsq-profile-label">recent comments <span>(<a href="#" id="dsq-profile-follow">follow comments</a>)</span></p>
|
284 |
+
<ul id="dsq-profile-commentlist"></ul>
|
285 |
+
</div>
|
286 |
+
<div class="show-more"><a href="#" id="dsq-profile-showmore">View Profile »</a></div>
|
287 |
+
<div class="powered-by"><a href="<?php echo DISQUS_URL; ?>">Powered by <span class="disqus">Disqus</span></a> · <a href="<?php echo DISQUS_URL; ?>">Learn more</a></div>
|
288 |
+
</div> <!-- padding -->
|
289 |
+
</div> <!-- body -->
|
290 |
+
<div id="dsq-popup-bottom"></div>
|
291 |
+
</div>
|
292 |
+
</div>
|
293 |
+
|
294 |
+
<!-- reblog -->
|
295 |
+
<div id="dsq-template-reblog" class="dsq-reblogdiv">
|
296 |
+
<div id="dsq-popup-profile">
|
297 |
+
<div id="dsq-popup-top">
|
298 |
+
</div>
|
299 |
+
<div id="dsq-popup-body" class="clearfix">
|
300 |
+
<div id="dsq-popup-body-padding">
|
301 |
+
<div id="dsq-popup-header">
|
302 |
+
<a class="dsq-close-link" id="dsq-close-reblog" href="#" onclick="Dsq.Popup.hidePopup(); return false">close</a>
|
303 |
+
<cite>Reblog this comment</cite>
|
304 |
+
</div>
|
305 |
+
<div id="dsq-reblog-form">
|
306 |
+
</div>
|
307 |
+
<div class="powered-by"><a href="<?php echo DISQUS_URL; ?>">Powered by <span class="disqus">Disqus</span></a> · <a href="{{ disqus_url }}">Learn more</a></div>
|
308 |
+
</div> <!-- padding -->
|
309 |
+
</div> <!-- body -->
|
310 |
+
<div id="dsq-popup-bottom"></div>
|
311 |
+
</div>
|
312 |
+
</div>
|
313 |
+
|
314 |
+
<!-- /embed_thread_profile.html -->
|
315 |
+
|
316 |
+
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
|
317 |
+
<script type="text/javascript">
|
318 |
+
</script>
|
319 |
+
<script type="text/javascript" charset="utf-8">
|
320 |
+
var disqusMediaUrl = "<?php echo DISQUS_MEDIA_URL; ?>";
|
321 |
+
var threadEl = document.getElementById('dsq-content');
|
322 |
+
var disqus_url = '<?php echo get_permalink(); ?> ';
|
323 |
+
</script>
|
324 |
+
<script type="text/javascript" src="<?php echo DISQUS_API_URL; ?>/scripts/<?php echo strtolower(get_option('disqus_forum_url')); ?>/disqus.js?t=<?php echo $dsq_response['thread_slug']; ?>"></script>
|
325 |
+
<script type="text/javascript" src="<?php echo DISQUS_API_URL; ?>/api/v1/embed_reply.js?forum_url=<?php echo $dsq_response['forum_url']; ?>&thread_id=<?php echo $dsq_response['thread_id']; ?>"></script>
|
disqus.php
ADDED
@@ -0,0 +1,355 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.com <team@disqus.com>
|
7 |
+
Version: 2.02-2812
|
8 |
+
Author URI: http://disqus.com/
|
9 |
+
|
10 |
+
*/
|
11 |
+
|
12 |
+
define('DISQUS_URL', 'http://disqus.com');
|
13 |
+
define('DISQUS_API_URL', DISQUS_URL);
|
14 |
+
define('DISQUS_DOMAIN', 'disqus.com');
|
15 |
+
define('DISQUS_IMPORTER_URL', 'http://import.disqus.net');
|
16 |
+
define('DISQUS_MEDIA_URL', 'http://media.disqus.com');
|
17 |
+
define('DISQUS_RSS_PATH', '/latest.rss');
|
18 |
+
|
19 |
+
require_once('lib/api.php');
|
20 |
+
|
21 |
+
/**
|
22 |
+
* DISQUS WordPress plugin version.
|
23 |
+
*
|
24 |
+
* @global string $dsq_version
|
25 |
+
* @since 1.0
|
26 |
+
*/
|
27 |
+
$dsq_version = '2.01';
|
28 |
+
/**
|
29 |
+
* Response from DISQUS get_thread API call for comments template.
|
30 |
+
*
|
31 |
+
* @global string $dsq_response
|
32 |
+
* @since 1.0
|
33 |
+
*/
|
34 |
+
$dsq_response = '';
|
35 |
+
/**
|
36 |
+
* Comment sort option.
|
37 |
+
*
|
38 |
+
* @global string $dsq_sort
|
39 |
+
* @since 1.0
|
40 |
+
*/
|
41 |
+
$dsq_sort = 1;
|
42 |
+
/**
|
43 |
+
* Flag to determine whether or not the comment count script has been embedded.
|
44 |
+
*
|
45 |
+
* @global string $dsq_cc_script_embedded
|
46 |
+
* @since 1.0
|
47 |
+
*/
|
48 |
+
$dsq_cc_script_embedded = false;
|
49 |
+
/**
|
50 |
+
* DISQUS API instance.
|
51 |
+
*
|
52 |
+
* @global string $dsq_api
|
53 |
+
* @since 1.0
|
54 |
+
*/
|
55 |
+
$dsq_api = new DisqusAPI(get_option('disqus_forum_url'), get_option('disqus_api_key'));
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Template tags
|
59 |
+
*/
|
60 |
+
// TODO: Add widget template tags.
|
61 |
+
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Helper functions.
|
65 |
+
*/
|
66 |
+
|
67 |
+
function dsq_legacy_mode() {
|
68 |
+
return get_option('disqus_forum_url') && !get_option('disqus_api_key');
|
69 |
+
}
|
70 |
+
|
71 |
+
function dsq_is_installed() {
|
72 |
+
return get_option('disqus_forum_url') && get_option('disqus_api_key');
|
73 |
+
}
|
74 |
+
|
75 |
+
function dsq_can_replace() {
|
76 |
+
global $id, $post;
|
77 |
+
$replace = get_option('disqus_replace');
|
78 |
+
|
79 |
+
if ( 'draft' == $post->post_status ) { return false; }
|
80 |
+
if ( !get_option('disqus_forum_url') ) { return false; }
|
81 |
+
else if ( 'all' == $replace ) { return true; }
|
82 |
+
|
83 |
+
if ( !isset($post->comment_count) ) {
|
84 |
+
$num_comments = 0;
|
85 |
+
} else {
|
86 |
+
if ( 'empty' == $replace ) {
|
87 |
+
// Only get count of comments, not including pings.
|
88 |
+
|
89 |
+
// If there are comments, make sure there are comments (that are not track/pingbacks)
|
90 |
+
if ( $post->comment_count > 0 ) {
|
91 |
+
// Yuck, this causes a DB query for each post. This can be
|
92 |
+
// replaced with a lighter query, but this is still not optimal.
|
93 |
+
$comments = get_approved_comments($post->ID);
|
94 |
+
foreach ( $comments as $comment ) {
|
95 |
+
if ( $comment->comment_type != 'trackback' && $comment->comment_type != 'pingback' ) {
|
96 |
+
$num_comments++;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
} else {
|
100 |
+
$num_comments = 0;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
else {
|
104 |
+
$num_comments = $post->comment_count;
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
return ( ('empty' == $replace && 0 == $num_comments)
|
109 |
+
|| ('closed' == $replace && 'closed' == $post->comment_status) );
|
110 |
+
}
|
111 |
+
|
112 |
+
function dsq_manage_dialog($message, $error = false) {
|
113 |
+
global $wp_version;
|
114 |
+
|
115 |
+
echo '<div '
|
116 |
+
. ( $error ? 'id="disqus_warning" ' : '')
|
117 |
+
. 'class="updated fade'
|
118 |
+
. ( ($wp_version < 2.5 && $error) ? '-ff0000' : '' )
|
119 |
+
. '"><p><strong>'
|
120 |
+
. $message
|
121 |
+
. '</strong></p></div>';
|
122 |
+
}
|
123 |
+
|
124 |
+
function dsq_sync_comments($post, $comments) {
|
125 |
+
global $wpdb;
|
126 |
+
|
127 |
+
// Get last_comment_date id for $post with Disqus metadata
|
128 |
+
// (This is the date that is stored in the Disqus DB.)
|
129 |
+
$last_comment_date = $wpdb->get_var('SELECT max(comment_date) FROM ' . $wpdb->prefix . 'comments WHERE comment_post_ID=' . intval($post->ID) . " AND comment_agent LIKE 'Disqus/%';");
|
130 |
+
if ( $last_comment_date ) {
|
131 |
+
$last_comment_date = strtotime($last_comment_date);
|
132 |
+
}
|
133 |
+
|
134 |
+
if ( !$last_comment_date ) {
|
135 |
+
$last_comment_date = 0;
|
136 |
+
}
|
137 |
+
|
138 |
+
foreach ( $comments as $comment ) {
|
139 |
+
if ( $comment['imported'] ) {
|
140 |
+
continue;
|
141 |
+
} else if ( $comment['date'] <= $last_comment_date ) {
|
142 |
+
// If comment date of comment is <= last_comment_date, skip comment.
|
143 |
+
continue;
|
144 |
+
} else {
|
145 |
+
// Else, insert_comment
|
146 |
+
$commentdata = array(
|
147 |
+
'comment_post_ID' => $post->ID,
|
148 |
+
'comment_author' => $comment['user']['display_name'],
|
149 |
+
'comment_author_email' => $comment['user']['email'],
|
150 |
+
'comment_author_url' => $comment['user']['url'],
|
151 |
+
'comment_author_IP' => $comment['user']['ip_address'],
|
152 |
+
'comment_date' => date('Y-m-d H:i:s', $comment['date']),
|
153 |
+
'comment_date_gmt' => date('Y-m-d H:i:s', $comment['date_gmt']),
|
154 |
+
'comment_content' => $comment['message'],
|
155 |
+
'comment_approved' => 1,
|
156 |
+
'comment_agent' => 'Disqus/1.0:' . intval($comment['id']),
|
157 |
+
'comment_type' => '',
|
158 |
+
);
|
159 |
+
wp_insert_comment($commentdata);
|
160 |
+
}
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Filters/Actions
|
166 |
+
*/
|
167 |
+
|
168 |
+
function dsq_comments_template($value) {
|
169 |
+
global $dsq_response;
|
170 |
+
global $dsq_sort;
|
171 |
+
global $dsq_api;
|
172 |
+
global $post;
|
173 |
+
|
174 |
+
if ( ! (is_single() || is_page() || $withcomments) ) {
|
175 |
+
return;
|
176 |
+
}
|
177 |
+
|
178 |
+
if ( !dsq_can_replace() ) {
|
179 |
+
return $value;
|
180 |
+
}
|
181 |
+
|
182 |
+
if ( dsq_legacy_mode() ) {
|
183 |
+
return dirname(__FILE__) . '/comments-legacy.php';
|
184 |
+
}
|
185 |
+
|
186 |
+
$permalink = get_permalink();
|
187 |
+
$title = get_the_title();
|
188 |
+
$excerpt = get_the_excerpt();
|
189 |
+
|
190 |
+
$dsq_sort = get_option('disqus_sort');
|
191 |
+
if ( is_numeric($_COOKIE['disqus_sort']) ) {
|
192 |
+
$dsq_sort = $_COOKIE['disqus_sort'];
|
193 |
+
}
|
194 |
+
|
195 |
+
if ( is_numeric($_GET['dsq_sort']) ) {
|
196 |
+
setcookie('disqus_sort', $_GET['dsq_sort']);
|
197 |
+
$dsq_sort = $_GET['dsq_sort'];
|
198 |
+
}
|
199 |
+
|
200 |
+
// Call "get_thread" API method.
|
201 |
+
$dsq_response = $dsq_api->get_thread($post, $permalink, $title, $excerpt);
|
202 |
+
if( $dsq_response < 0 ) {
|
203 |
+
return false;
|
204 |
+
}
|
205 |
+
// Sync comments with database.
|
206 |
+
dsq_sync_comments($post, $dsq_response['posts']);
|
207 |
+
|
208 |
+
// TODO: If a disqus-comments.php is found in the current template's
|
209 |
+
// path, use that instead of the default bundled comments.php
|
210 |
+
//return TEMPLATEPATH . '/disqus-comments.php';
|
211 |
+
|
212 |
+
return dirname(__FILE__) . '/comments.php';
|
213 |
+
}
|
214 |
+
|
215 |
+
function dsq_comment_count() {
|
216 |
+
global $dsq_cc_script_embedded;
|
217 |
+
|
218 |
+
if ( $dsq_cc_script_embedded ) {
|
219 |
+
return;
|
220 |
+
} else if ( (is_single() || is_page() || $withcomments || is_feed()) ) {
|
221 |
+
return;
|
222 |
+
}
|
223 |
+
|
224 |
+
?>
|
225 |
+
|
226 |
+
<script type="text/javascript">
|
227 |
+
(function() {
|
228 |
+
var links = document.getElementsByTagName('a');
|
229 |
+
var query = '?';
|
230 |
+
for(var i = 0; i < links.length; i++) {
|
231 |
+
if(links[i].href.indexOf('#disqus_thread') >= 0) {
|
232 |
+
links[i].innerHTML = 'View Comments';
|
233 |
+
query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
|
234 |
+
}
|
235 |
+
}
|
236 |
+
document.write('<script type="text/javascript" src="<?php echo DISQUS_URL ?>/forums/<?php echo strtolower(get_option('disqus_forum_url')); ?>/get_num_replies.js' + query + '"><' + '/script>');
|
237 |
+
})();
|
238 |
+
</script>
|
239 |
+
|
240 |
+
<?php
|
241 |
+
|
242 |
+
$dsq_cc_script_embedded = true;
|
243 |
+
}
|
244 |
+
|
245 |
+
function dsq_get_comments_number($num_comments) {
|
246 |
+
$replace = get_option('disqus_replace');
|
247 |
+
|
248 |
+
// HACK: Don't allow $num_comments to be 0. If we're only replacing
|
249 |
+
// closed comments, we don't care about the value. For
|
250 |
+
// comments_popup_link();
|
251 |
+
if ( $replace != 'closed' && 0 == $num_comments ) {
|
252 |
+
return -1;
|
253 |
+
} else {
|
254 |
+
return $num_comments;
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
// Mark entries in index to replace comments link.
|
259 |
+
function dsq_comments_number($comment_text) {
|
260 |
+
if ( dsq_can_replace() ) {
|
261 |
+
ob_start();
|
262 |
+
the_permalink();
|
263 |
+
$the_permalink = ob_get_contents();
|
264 |
+
ob_end_clean();
|
265 |
+
|
266 |
+
return '</a><noscript><a href="http://' . strtolower(get_option('disqus_forum_url')) . '.' . DISQUS_DOMAIN . '/?url=' . $the_permalink .'">View comments</a></noscript><a href="' . $the_permalink . '#disqus_thread">Comments</a>';
|
267 |
+
} else {
|
268 |
+
return $comment_text;
|
269 |
+
}
|
270 |
+
}
|
271 |
+
|
272 |
+
function dsq_bloginfo_url($url) {
|
273 |
+
if ( get_feed_link('comments_rss2') == $url ) {
|
274 |
+
return 'http://' . strtolower(get_option('disqus_forum_url')) . '.' . DISQUS_DOMAIN . DISQUS_RSS_PATH;
|
275 |
+
} else {
|
276 |
+
return $url;
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
// For WordPress 2.0.x
|
281 |
+
function dsq_loop_start() {
|
282 |
+
global $comment_count_cache;
|
283 |
+
|
284 |
+
if ( isset($comment_count_cache) ) {
|
285 |
+
foreach ( $comment_count_cache as $key => $value ) {
|
286 |
+
if ( 0 == $value ) {
|
287 |
+
$comment_count_cache[$key] = -1;
|
288 |
+
}
|
289 |
+
}
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
function dsq_add_pages() {
|
294 |
+
global $menu, $submenu;
|
295 |
+
|
296 |
+
add_submenu_page('edit-comments.php', 'DISQUS', 'DISQUS', 8, 'disqus', dsq_manage);
|
297 |
+
|
298 |
+
// TODO: This does not work in WP2.0.
|
299 |
+
|
300 |
+
// Replace Comments top-level menu link with link to our page
|
301 |
+
foreach ( $menu as $key => $value ) {
|
302 |
+
if ( 'edit-comments.php' == $menu[$key][2] ) {
|
303 |
+
$menu[$key][2] = 'edit-comments.php?page=disqus';
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
+
add_options_page('DISQUS', 'DISQUS', 8, 'disqus', dsq_manage);
|
308 |
+
}
|
309 |
+
|
310 |
+
function dsq_manage() {
|
311 |
+
require_once('admin-header.php');
|
312 |
+
include_once('manage.php');
|
313 |
+
}
|
314 |
+
|
315 |
+
// Always add Disqus management page to the admin menu
|
316 |
+
add_action('admin_menu', 'dsq_add_pages');
|
317 |
+
|
318 |
+
function dsq_warning() {
|
319 |
+
global $wp_version;
|
320 |
+
|
321 |
+
if ( !get_option('disqus_forum_url') && !isset($_POST['forum_url']) && $_GET['page'] != 'disqus' ) {
|
322 |
+
dsq_manage_dialog('You must <a href="edit-comments.php?page=disqus">configure the plugin</a> to enable the DISQUS comment system.', true);
|
323 |
+
}
|
324 |
+
|
325 |
+
if ( dsq_legacy_mode() && $_GET['page'] == 'disqus' ) {
|
326 |
+
dsq_manage_dialog('DISQUS is running in legacy mode. (<a href="edit-comments.php?page=disqus">Click here to configure</a>)');
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
+
function dsq_check_version() {
|
331 |
+
global $dsq_api;
|
332 |
+
|
333 |
+
$latest_version = $dsq_api->wp_check_version();
|
334 |
+
if ( $latest_version ) {
|
335 |
+
dsq_manage_dialog('You are running an old version of the DISQUS plugin. Please <a href="http://blog.disqus.net">check the blog</a> for updates.');
|
336 |
+
}
|
337 |
+
}
|
338 |
+
|
339 |
+
add_action('admin_notices', 'dsq_warning');
|
340 |
+
add_action('admin_notices', 'dsq_check_version');
|
341 |
+
|
342 |
+
// Only replace comments if the disqus_forum_url option is set.
|
343 |
+
add_filter('comments_template', 'dsq_comments_template');
|
344 |
+
add_filter('comments_number', 'dsq_comments_number');
|
345 |
+
add_filter('get_comments_number', 'dsq_get_comments_number');
|
346 |
+
add_filter('bloginfo_url', 'dsq_bloginfo_url');
|
347 |
+
add_action('loop_start', 'dsq_loop_start');
|
348 |
+
|
349 |
+
// For comment count script.
|
350 |
+
if ( !get_option('disqus_cc_fix') ) {
|
351 |
+
add_action('loop_end', 'dsq_comment_count');
|
352 |
+
}
|
353 |
+
add_action('wp_footer', 'dsq_comment_count');
|
354 |
+
|
355 |
+
?>
|
export.php
ADDED
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Adapted from WordPress 2.2
|
4 |
+
*/
|
5 |
+
set_time_limit(0);
|
6 |
+
ini_set('memory_limit', '256M');
|
7 |
+
define('WXR_VERSION', '1.0');
|
8 |
+
|
9 |
+
// TODO: WordPress >= 2.1 renamed functions-formatting.php to formatting.php.
|
10 |
+
if ( $wp_version < 2.1) {
|
11 |
+
require_once(ABSPATH . WPINC . '/functions-formatting.php');
|
12 |
+
} else {
|
13 |
+
require_once(ABSPATH . WPINC . '/formatting.php');
|
14 |
+
}
|
15 |
+
|
16 |
+
function dsq_get_temp_dir() {
|
17 |
+
if ( defined('WP_TEMP_DIR') ) {
|
18 |
+
if ( is_writable(WP_TEMP_DIR) ) {
|
19 |
+
return trailingslashit(WP_TEMP_DIR);
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
if ( function_exists('sys_get_temp_dir') ) {
|
24 |
+
$temp_dir = sys_get_temp_dir();
|
25 |
+
if ( is_writable($temp_dir) ) {
|
26 |
+
return trailingslashit($temp_dir);
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
$temp_dir = ABSPATH . 'wp-content/';
|
31 |
+
if ( is_dir($temp_dir) && is_writable($temp_dir) ) {
|
32 |
+
return $temp_dir;
|
33 |
+
}
|
34 |
+
|
35 |
+
// Try to get from environment variable
|
36 |
+
if ( !empty($_ENV['TMP']) ) {
|
37 |
+
if ( is_writable($_ENV['TMP']) ) {
|
38 |
+
return realpath(trailingslashit($_ENV['TMP']));
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
if ( !empty($_ENV['TMPDIR']) ) {
|
43 |
+
if ( is_writable($_ENV['TMPDIR']) ) {
|
44 |
+
return realpath(trailingslashit($_ENV['TMPDIR']));
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
if ( !empty($_ENV['TEMP']) ) {
|
49 |
+
if ( is_writable($_ENV['TEMP']) ) {
|
50 |
+
return realpath(trailingslashit($_ENV['TEMP']));
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
// Last ditch effort.
|
55 |
+
return '/tmp/';
|
56 |
+
}
|
57 |
+
|
58 |
+
function dsq_export_wp() {
|
59 |
+
global $wpdb, $posts, $post, $wp_version;
|
60 |
+
global $dsq_api;
|
61 |
+
|
62 |
+
$filename = dsq_get_temp_dir() . 'disqus-wordpress.' . date('Y-m-d') . '.xml';
|
63 |
+
$fp = fopen($filename, 'w');
|
64 |
+
|
65 |
+
ob_start();
|
66 |
+
|
67 |
+
$where = '';
|
68 |
+
if ( isset( $_GET['author'] ) && $_GET['author'] != 'all' ) {
|
69 |
+
$author_id = (int) $_GET['author'];
|
70 |
+
$where = " WHERE post_author = '$author_id' ";
|
71 |
+
}
|
72 |
+
|
73 |
+
$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
|
74 |
+
|
75 |
+
if ( $wp_version < 2.1 ) {
|
76 |
+
$categories = (array) $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent FROM $wpdb->categories LEFT JOIN $wpdb->post2cat ON (category_id = cat_id) LEFT JOIN $wpdb->posts ON (post_id <=> id) $where GROUP BY cat_id");
|
77 |
+
} else {
|
78 |
+
$categories = (array) $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, posts_private, links_private FROM $wpdb->categories LEFT JOIN $wpdb->post2cat ON (category_id = cat_id) LEFT JOIN $wpdb->posts ON (post_id <=> id) $where GROUP BY cat_id");
|
79 |
+
}
|
80 |
+
|
81 |
+
function wxr_site_url() {
|
82 |
+
global $current_site;
|
83 |
+
|
84 |
+
// mu: the base url
|
85 |
+
if ( isset($current_site->domain) ) {
|
86 |
+
return 'http://'.$current_site->domain.$current_site->path;
|
87 |
+
}
|
88 |
+
// wp: the blog url
|
89 |
+
else {
|
90 |
+
return get_bloginfo_rss('url');
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
function wxr_missing_parents($categories) {
|
95 |
+
if ( !is_array($categories) || empty($categories) )
|
96 |
+
return array();
|
97 |
+
|
98 |
+
foreach ( $categories as $category )
|
99 |
+
$parents[$category->cat_ID] = $category->category_parent;
|
100 |
+
|
101 |
+
$parents = array_unique(array_diff($parents, array_keys($parents)));
|
102 |
+
|
103 |
+
if ( $zero = array_search('0', $parents) )
|
104 |
+
unset($parents[$zero]);
|
105 |
+
|
106 |
+
return $parents;
|
107 |
+
}
|
108 |
+
|
109 |
+
while ( $parents = wxr_missing_parents($categories) ) {
|
110 |
+
if ( $wp_version < 2.1 ) {
|
111 |
+
$found_parents = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent FROM $wpdb->categories WHERE cat_ID IN (" . join(', ', $parents) . ")");
|
112 |
+
} else {
|
113 |
+
$found_parents = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, posts_private, links_private FROM $wpdb->categories WHERE cat_ID IN (" . join(', ', $parents) . ")");
|
114 |
+
}
|
115 |
+
if ( is_array($found_parents) && count($found_parents) )
|
116 |
+
$categories = array_merge($categories, $found_parents);
|
117 |
+
else
|
118 |
+
break;
|
119 |
+
}
|
120 |
+
|
121 |
+
// Put them in order to be inserted with no child going before its parent
|
122 |
+
$pass = 0;
|
123 |
+
$passes = 1000 + count($categories);
|
124 |
+
while ( ( $cat = array_shift($categories) ) && ++$pass < $passes ) {
|
125 |
+
if ( $cat->category_parent == 0 || isset($cats[$cat->category_parent]) ) {
|
126 |
+
$cats[$cat->cat_ID] = $cat;
|
127 |
+
} else {
|
128 |
+
$categories[] = $cat;
|
129 |
+
}
|
130 |
+
}
|
131 |
+
unset($categories);
|
132 |
+
|
133 |
+
function wxr_cdata($str) {
|
134 |
+
if ( seems_utf8($str) == false )
|
135 |
+
$str = utf8_encode($str);
|
136 |
+
|
137 |
+
// $str = ent2ncr(wp_specialchars($str));
|
138 |
+
|
139 |
+
$str = "<![CDATA[$str" . ( ( substr($str, -1) == ']' ) ? ' ' : '') . "]]>";
|
140 |
+
|
141 |
+
return $str;
|
142 |
+
}
|
143 |
+
|
144 |
+
function wxr_cat_name($c) {
|
145 |
+
if ( empty($c->cat_name) )
|
146 |
+
return;
|
147 |
+
|
148 |
+
echo '<wp:cat_name>' . wxr_cdata($c->cat_name) . '</wp:cat_name>';
|
149 |
+
}
|
150 |
+
|
151 |
+
function wxr_category_description($c) {
|
152 |
+
if ( empty($c->category_description) )
|
153 |
+
return;
|
154 |
+
|
155 |
+
echo '<wp:category_description>' . wxr_cdata($c->category_description) . '</wp:category_description>';
|
156 |
+
}
|
157 |
+
|
158 |
+
print '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
|
159 |
+
|
160 |
+
?>
|
161 |
+
|
162 |
+
<!--
|
163 |
+
This is a WordPress eXtended RSS file generated by WordPress as an export of
|
164 |
+
your blog. It contains information about your blog's posts, comments, and
|
165 |
+
categories. You may use this file to transfer that content from one site to
|
166 |
+
another. This file is not intended to serve as a complete backup of your
|
167 |
+
blog.
|
168 |
+
|
169 |
+
To import this information into a WordPress blog follow these steps:
|
170 |
+
|
171 |
+
1. Log into that blog as an administrator.
|
172 |
+
2. Go to Manage > Import in the blog's admin.
|
173 |
+
3. Choose "WordPress" from the list of importers.
|
174 |
+
4. Upload this file using the form provided on that page.
|
175 |
+
5. You will first be asked to map the authors in this export file to users
|
176 |
+
on the blog. For each author, you may choose to map an existing user on
|
177 |
+
the blog or to create a new user.
|
178 |
+
6. WordPress will then import each of the posts, comments, and categories
|
179 |
+
contained in this file onto your blog.
|
180 |
+
-->
|
181 |
+
|
182 |
+
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:i'); ?>"-->
|
183 |
+
<rss version="2.0"
|
184 |
+
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
185 |
+
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
186 |
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
187 |
+
xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/"
|
188 |
+
>
|
189 |
+
|
190 |
+
<channel>
|
191 |
+
<title><?php bloginfo_rss('name'); ?></title>
|
192 |
+
<link><?php bloginfo_rss('url') ?></link>
|
193 |
+
<description><?php bloginfo_rss("description") ?></description>
|
194 |
+
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
|
195 |
+
<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
|
196 |
+
<language><?php echo get_option('rss_language'); ?></language>
|
197 |
+
<wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
|
198 |
+
<wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
|
199 |
+
<wp:base_blog_url><?php bloginfo_rss('url'); ?></wp:base_blog_url>
|
200 |
+
|
201 |
+
<?php
|
202 |
+
$contents = ob_get_clean();
|
203 |
+
fwrite($fp, $contents);
|
204 |
+
?>
|
205 |
+
|
206 |
+
<?php if ( $cats ) : foreach ( $cats as $c ) : ?>
|
207 |
+
<?php
|
208 |
+
ob_start();
|
209 |
+
?>
|
210 |
+
<wp:category><wp:category_nicename><?php echo $c->category_nicename; ?></wp:category_nicename><wp:category_parent><?php echo $c->category_parent ? $cats[$c->category_parent]->cat_name : ''; ?></wp:category_parent><wp:posts_private><?php echo $c->posts_private ? '1' : '0'; ?></wp:posts_private><wp:links_private><?php echo $c->links_private ? '1' : '0'; ?></wp:links_private><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
|
211 |
+
<?php
|
212 |
+
$contents = ob_get_clean();
|
213 |
+
fwrite($fp, $contents);
|
214 |
+
?>
|
215 |
+
<?php endforeach; endif; ?>
|
216 |
+
<?php do_action('rss2_head'); ?>
|
217 |
+
<?php
|
218 |
+
if ($posts) {
|
219 |
+
foreach ($posts as $post) {
|
220 |
+
ob_start();
|
221 |
+
start_wp();
|
222 |
+
?>
|
223 |
+
<item>
|
224 |
+
<title><?php the_title_rss() ?></title>
|
225 |
+
<link><?php permalink_single_rss() ?></link>
|
226 |
+
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
|
227 |
+
<dc:creator><?php the_author() ?></dc:creator>
|
228 |
+
<?php the_category_rss() ?>
|
229 |
+
|
230 |
+
<guid isPermaLink="false"><?php the_guid(); ?></guid>
|
231 |
+
<description></description>
|
232 |
+
<content:encoded><![CDATA[<?php echo $post->post_content ?>]]></content:encoded>
|
233 |
+
<wp:post_id><?php echo $post->ID; ?></wp:post_id>
|
234 |
+
<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
|
235 |
+
<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
|
236 |
+
<wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
|
237 |
+
<wp:ping_status><?php echo $post->ping_status; ?></wp:ping_status>
|
238 |
+
<wp:post_name><?php echo $post->post_name; ?></wp:post_name>
|
239 |
+
<wp:status><?php echo $post->post_status; ?></wp:status>
|
240 |
+
<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
|
241 |
+
<wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
|
242 |
+
<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
|
243 |
+
<?php
|
244 |
+
$postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
|
245 |
+
if ( $postmeta ) {
|
246 |
+
?>
|
247 |
+
<?php foreach( $postmeta as $meta ) { ?>
|
248 |
+
<wp:postmeta>
|
249 |
+
<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
|
250 |
+
<wp:meta_value><?Php echo $meta->meta_value; ?></wp:meta_value>
|
251 |
+
</wp:postmeta>
|
252 |
+
<?php } ?>
|
253 |
+
<?php } ?>
|
254 |
+
<?php
|
255 |
+
$contents = ob_get_clean();
|
256 |
+
fwrite($fp, $contents);
|
257 |
+
?>
|
258 |
+
<?php
|
259 |
+
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID AND comment_agent NOT LIKE 'Disqus/%'");
|
260 |
+
ob_start();
|
261 |
+
if ( $comments ) { foreach ( $comments as $c ) { ?>
|
262 |
+
<wp:comment>
|
263 |
+
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
|
264 |
+
<wp:comment_author><?php echo $c->comment_author; ?></wp:comment_author>
|
265 |
+
<wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
|
266 |
+
<wp:comment_author_url><?php echo $c->comment_author_url; ?></wp:comment_author_url>
|
267 |
+
<wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
|
268 |
+
<wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
|
269 |
+
<wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
|
270 |
+
<wp:comment_content><?php echo $c->comment_content; ?></wp:comment_content>
|
271 |
+
<wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
|
272 |
+
<wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
|
273 |
+
<wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
|
274 |
+
</wp:comment>
|
275 |
+
<?php } } ?>
|
276 |
+
</item>
|
277 |
+
<?php
|
278 |
+
$contents = ob_get_clean();
|
279 |
+
fwrite($fp, $contents);
|
280 |
+
?>
|
281 |
+
<?php } } ?>
|
282 |
+
<?php ob_start(); ?>
|
283 |
+
</channel>
|
284 |
+
</rss>
|
285 |
+
<?php
|
286 |
+
$contents = ob_get_clean();
|
287 |
+
fwrite($fp, $contents);
|
288 |
+
|
289 |
+
$response = $dsq_api->import_wordpress_comments($filename);
|
290 |
+
$import_id = $response;
|
291 |
+
|
292 |
+
unlink($filename);
|
293 |
+
|
294 |
+
if ( $response < 0 ) {
|
295 |
+
dsq_manage_dialog("There was an error exporting your comments. If your forum API key has changed, you may need to reinstall DISQUS. If you are still having issues, please contact <a href='mailto:help@disqus.com'>help@disqus.com</a>.", true);
|
296 |
+
} else {
|
297 |
+
update_option('disqus_last_import_id', $import_id);
|
298 |
+
dsq_manage_dialog('Your comments have been queued for importing to DISQUS. You may check the advanced options tab for a status update.');
|
299 |
+
}
|
300 |
+
}
|
301 |
+
|
302 |
+
?>
|
images/logo.png
ADDED
Binary file
|
lib/api.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Implementation of the DISQUS v2 API.
|
4 |
+
*
|
5 |
+
* @author DISQUS.com <team@disqus.com>
|
6 |
+
* @copyright 2007-2008 Big Head Labs
|
7 |
+
* @link http://disqus.com/
|
8 |
+
* @package Disqus
|
9 |
+
* @subpackage lib
|
10 |
+
* @version 2.0
|
11 |
+
*/
|
12 |
+
|
13 |
+
require_once('url.php');
|
14 |
+
|
15 |
+
/** @#+
|
16 |
+
* Constants
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* Base URL for DISQUS.
|
20 |
+
*/
|
21 |
+
define('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 |
+
* @author DISQUS.com <team@disqus.com>
|
28 |
+
* @copyright 2007-2008 Big Head Labs
|
29 |
+
* @version 2.0
|
30 |
+
*/
|
31 |
+
class DisqusAPI {
|
32 |
+
var $short_name;
|
33 |
+
var $forum_api_key;
|
34 |
+
|
35 |
+
function DisqusAPI($short_name=NULL, $forum_api_key=NULL) {
|
36 |
+
$this->short_name = $short_name;
|
37 |
+
$this->forum_api_key = $forum_api_key;
|
38 |
+
}
|
39 |
+
|
40 |
+
function get_forum_list($username, $password) {
|
41 |
+
$credentials = base64_encode($username . ':' . $password);
|
42 |
+
$response = urlopen(DISQUS_API_URL . '/api/v2/get_forum_list/', array(
|
43 |
+
'credentials' => $credentials,
|
44 |
+
'response_type' => 'php'
|
45 |
+
));
|
46 |
+
$data = unserialize($response['data']);
|
47 |
+
if(!$data || $data['stat'] == 'fail') {
|
48 |
+
if($data['err']['code'] == 'bad-credentials') {
|
49 |
+
return -2;
|
50 |
+
} else {
|
51 |
+
return -1;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
return $data['forums'];
|
55 |
+
}
|
56 |
+
|
57 |
+
function get_forum_api_key($username, $password, $short_name) {
|
58 |
+
$credentials = base64_encode($username . ':' . $password);
|
59 |
+
$response = urlopen(DISQUS_API_URL . '/api/v2/get_forum_api_key/', array(
|
60 |
+
'credentials' => $credentials,
|
61 |
+
'short_name' => $short_name,
|
62 |
+
'response_type' => 'php'
|
63 |
+
));
|
64 |
+
$data = unserialize($response['data']);
|
65 |
+
if(!$data || $data['stat'] == 'fail') {
|
66 |
+
if($data['err']['code'] == 'bad-credentials') {
|
67 |
+
return -2;
|
68 |
+
} else {
|
69 |
+
return -1;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
return $data['forum_api_key'];
|
74 |
+
}
|
75 |
+
|
76 |
+
function get_thread($post, $permalink, $title, $excerpt) {
|
77 |
+
$title = strip_tags($title, ALLOWED_HTML);
|
78 |
+
$title = urlencode($title);
|
79 |
+
|
80 |
+
$excerpt = strip_tags($excerpt, ALLOWED_HTML);
|
81 |
+
$excerpt = urlencode($excerpt);
|
82 |
+
$excerpt = substr($excerpt, 0, 300);
|
83 |
+
|
84 |
+
$thread_meta = $post->ID . ' ' . $post->guid;
|
85 |
+
|
86 |
+
$response = @urlopen(DISQUS_API_URL . '/api/v2/get_thread/', array(
|
87 |
+
'short_name' => $this->short_name,
|
88 |
+
'thread_url' => $permalink,
|
89 |
+
'thread_meta' => $thread_meta,
|
90 |
+
'response_type' => 'php',
|
91 |
+
'title' => $title,
|
92 |
+
'message' => $excerpt,
|
93 |
+
'api_key' => $this->forum_api_key,
|
94 |
+
'source' => 'DsqWordPress20'
|
95 |
+
));
|
96 |
+
|
97 |
+
$data = unserialize($response['data']);
|
98 |
+
if(!$data || $data['stat'] == 'fail') {
|
99 |
+
if($data['err']['code'] == 'bad-key') {
|
100 |
+
return -2;
|
101 |
+
} else {
|
102 |
+
return -1;
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
return $data;
|
107 |
+
}
|
108 |
+
|
109 |
+
function import_wordpress_comments($file) {
|
110 |
+
$response = urlopen(DISQUS_IMPORTER_URL . '/api/import-wordpress-comments/',
|
111 |
+
array(
|
112 |
+
'forum_url' => $this->short_name,
|
113 |
+
'forum_api_key' => $this->forum_api_key,
|
114 |
+
'response_type' => 'php'
|
115 |
+
), array(
|
116 |
+
'name' => $file,
|
117 |
+
'field' => 'file'
|
118 |
+
)
|
119 |
+
);
|
120 |
+
|
121 |
+
$data = unserialize($response['data']);
|
122 |
+
if(!$data || $data['stat'] == 'fail') {
|
123 |
+
return -1;
|
124 |
+
}
|
125 |
+
return $data['import_id'];
|
126 |
+
}
|
127 |
+
|
128 |
+
function get_import_status($import_id) {
|
129 |
+
$response = @urlopen(DISQUS_IMPORTER_URL . '/api/get-import-status/', array(
|
130 |
+
'forum_url' => $this->short_name,
|
131 |
+
'forum_api_key' => $this->forum_api_key,
|
132 |
+
'import_id' => $import_id,
|
133 |
+
'response_type' => 'php'
|
134 |
+
));
|
135 |
+
|
136 |
+
$data = unserialize($response['data']);
|
137 |
+
if(!$data || $data['stat'] == 'fail') {
|
138 |
+
return -1;
|
139 |
+
}
|
140 |
+
return $data;
|
141 |
+
}
|
142 |
+
|
143 |
+
function wp_check_version() {
|
144 |
+
global $dsq_version;
|
145 |
+
|
146 |
+
$response = @urlopen(DISQUS_MEDIA_URL . '/wp/LATEST_VERSION');
|
147 |
+
$latest_version = floatval($response['data']);
|
148 |
+
if($dsq_version < $latest_version) {
|
149 |
+
return $latest_version;
|
150 |
+
}
|
151 |
+
|
152 |
+
return false;
|
153 |
+
}
|
154 |
+
|
155 |
+
}
|
156 |
+
|
157 |
+
?>
|
lib/url.php
ADDED
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
define('USER_AGENT', 'Disqus-WPPlugin/2.0-dev');
|
3 |
+
|
4 |
+
function get_query_string($postdata) {
|
5 |
+
$postdata_str = '';
|
6 |
+
|
7 |
+
if($postdata) {
|
8 |
+
foreach($postdata as $key=>$value) {
|
9 |
+
$postdata_str .= urlencode($key) . '=' . urlencode($value) . '&';
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
return $postdata_str;
|
14 |
+
}
|
15 |
+
|
16 |
+
|
17 |
+
function get_post_content($boundary, $postdata, $file_name, $file_field) {
|
18 |
+
if(!$file_name || !$file_field) {
|
19 |
+
return get_query_string($postdata);
|
20 |
+
}
|
21 |
+
|
22 |
+
$content = array();
|
23 |
+
$content[] = '--' . $boundary;
|
24 |
+
foreach($postdata as $key=>$value) {
|
25 |
+
$content[] = 'Content-Disposition: form-data; name="' . $key . '"' . "\r\n\r\n" . $value;
|
26 |
+
$content[] = '--' . $boundary;
|
27 |
+
}
|
28 |
+
$content[] = 'Content-Disposition: form-data; name="' . $file_field . '"; filename="' . $file_name . '"';
|
29 |
+
// HACK: We only need to handle text/plain files right now.
|
30 |
+
$content[] = "Content-Type: text/plain\r\n";
|
31 |
+
$content[] = file_get_contents($file_name);
|
32 |
+
$content[] = '--' . $boundary . '--';
|
33 |
+
$content = implode("\r\n", $content);
|
34 |
+
return $content;
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
function get_http_headers_for_request($boundary, $content, $file_name, $file_field) {
|
39 |
+
$headers = array();
|
40 |
+
$headers[] = 'User-Agent: ' . USER_AGENT;
|
41 |
+
$headers[] = 'Connection: close';
|
42 |
+
if($content) {
|
43 |
+
$headers[] = 'Content-Length: ' . strlen($content);
|
44 |
+
if($file_name && $file_field) {
|
45 |
+
$headers[] = 'Content-Type: multipart/form-data; boundary=' . $boundary;
|
46 |
+
} else {
|
47 |
+
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
|
48 |
+
}
|
49 |
+
}
|
50 |
+
return implode("\r\n", $headers);
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
function _curl_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
55 |
+
$c = curl_init($url);
|
56 |
+
$postdata_str = get_query_string($postdata);
|
57 |
+
|
58 |
+
$c_options = array(
|
59 |
+
CURLOPT_USERAGENT => USER_AGENT,
|
60 |
+
CURLOPT_RETURNTRANSFER => true,
|
61 |
+
CURLOPT_POST => ($postdata_str ? 1 : 0),
|
62 |
+
);
|
63 |
+
if($postdata) {
|
64 |
+
$c_options[CURLOPT_POSTFIELDS] = $postdata_str;
|
65 |
+
}
|
66 |
+
if($file_name && $file_field) {
|
67 |
+
$postdata[$file_field] = '@' . $file_name;
|
68 |
+
$c_options[CURLOPT_POSTFIELDS] = $postdata;
|
69 |
+
$c_options[CURLOPT_RETURNTRANSFER] = 1;
|
70 |
+
}
|
71 |
+
curl_setopt_array($c, $c_options);
|
72 |
+
|
73 |
+
$response['data'] = curl_exec($c);
|
74 |
+
$response['code'] = curl_getinfo($c, CURLINFO_HTTP_CODE);
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
function _fsockopen_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
79 |
+
$buf = '';
|
80 |
+
$req = '';
|
81 |
+
$length = 0;
|
82 |
+
$boundary = '----------' . md5(time());
|
83 |
+
$postdata_str = get_post_content($boundary, $postdata, $file_name, $file_field);
|
84 |
+
$url_pieces = parse_url($url);
|
85 |
+
|
86 |
+
// Set default port for supported schemes if none is provided.
|
87 |
+
if(!isset($url_pieces['port'])) {
|
88 |
+
switch($url_pieces['scheme']) {
|
89 |
+
case 'http':
|
90 |
+
$url_pieces['port'] = 80;
|
91 |
+
break;
|
92 |
+
case 'https':
|
93 |
+
$url_pieces['port'] = 443;
|
94 |
+
$url_pieces['host'] = 'ssl://' . $url_pieces['host'];
|
95 |
+
break;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
// Set default path if trailing slash is not provided.
|
100 |
+
if(!isset($url_pieces['path'])) { $url_pieces['path'] = '/'; }
|
101 |
+
|
102 |
+
// Determine if we need to include the port in the Host header or not.
|
103 |
+
if(($url_pieces['port'] == 80 && $url_pieces['scheme'] == 'http') ||
|
104 |
+
($url_pieces['port'] == 443 && $url_pieces['scheme'] == 'https')) {
|
105 |
+
$host = $url_pieces['host'];
|
106 |
+
} else {
|
107 |
+
$host = $url_pieces['host'] . ':' . $url_pieces['port'];
|
108 |
+
}
|
109 |
+
|
110 |
+
$fp = @fsockopen($url_pieces['host'], $url_pieces['port']);
|
111 |
+
if(!$fp) { return false; }
|
112 |
+
$req .= ($postdata_str ? 'POST' : 'GET') . ' ' . $url_pieces['path'] . " HTTP/1.1\r\n";
|
113 |
+
$req .= 'Host: ' . $host . "\r\n";
|
114 |
+
$req .= get_http_headers_for_request($boundary, $postdata_str, $file_name, $file_field);
|
115 |
+
if($postdata_str) {
|
116 |
+
$req .= "\r\n\r\n" . $postdata_str;
|
117 |
+
}
|
118 |
+
$req .= "\r\n\r\n";
|
119 |
+
|
120 |
+
fwrite($fp, $req);
|
121 |
+
while(!feof($fp)) {
|
122 |
+
$buf .= fgets($fp, 4096);
|
123 |
+
}
|
124 |
+
|
125 |
+
// Parse headers from the response buffers.
|
126 |
+
list($headers, $response['data']) = explode("\r\n\r\n", $buf, 2);
|
127 |
+
|
128 |
+
// Get status code from headers.
|
129 |
+
$headers = explode("\r\n", $headers);
|
130 |
+
list($unused, $response['code'], $unused) = explode(' ', $headers[0], 3);
|
131 |
+
$headers = array_slice($headers, 1);
|
132 |
+
|
133 |
+
// Convert headers into associative array.
|
134 |
+
foreach($headers as $unused=>$header) {
|
135 |
+
$header = explode(':', $header);
|
136 |
+
$header[0] = trim($header[0]);
|
137 |
+
$header[1] = trim($header[1]);
|
138 |
+
$headers[strtolower($header[0])] = strtolower($header[1]);
|
139 |
+
}
|
140 |
+
|
141 |
+
// If transfer-coding is set to chunked, we need to join the message body
|
142 |
+
// together.
|
143 |
+
if(isset($headers['transfer-encoding']) && 'chunked' == $headers['transfer-encoding']) {
|
144 |
+
$chunk_data = $response['data'];
|
145 |
+
$joined_data = '';
|
146 |
+
while(true) {
|
147 |
+
// Strip length from body.
|
148 |
+
list($chunk_length, $chunk_data) = explode("\r\n", $chunk_data, 2);
|
149 |
+
$chunk_length = hexdec($chunk_length);
|
150 |
+
if(!$chunk_length || !strlen($chunk_data)) { break; }
|
151 |
+
|
152 |
+
$joined_data .= substr($chunk_data, 0, $chunk_length);
|
153 |
+
$chunk_data = substr($chunk_data, $chunk_length + 1);
|
154 |
+
$length += $chunk_length;
|
155 |
+
}
|
156 |
+
$response['data'] = $joined_data;
|
157 |
+
} else {
|
158 |
+
$length = $headers['content-length'];
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
|
163 |
+
function _fopen_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
164 |
+
$params = array();
|
165 |
+
if($file_name && $file_field) {
|
166 |
+
$boundary = '----------' . md5(time());
|
167 |
+
$content = get_post_content($boundary, $postdata, $file_name, $file_field);
|
168 |
+
$header = get_http_headers_for_request($boundary, $content, $file_name, $file_field);
|
169 |
+
|
170 |
+
$params = array('http' => array(
|
171 |
+
'method' => 'POST',
|
172 |
+
'header' => $header,
|
173 |
+
'content' => $content,
|
174 |
+
));
|
175 |
+
} else {
|
176 |
+
if($postdata) {
|
177 |
+
$params = array('http' => array(
|
178 |
+
'method' => 'POST',
|
179 |
+
'header' => 'Content-Type: application/x-www-form-urlencoded',
|
180 |
+
'content' => get_query_string($postdata)
|
181 |
+
));
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
ini_set('user_agent', USER_AGENT);
|
186 |
+
$ctx = stream_context_create($params);
|
187 |
+
$fp = fopen($url, 'rb', false, $ctx);
|
188 |
+
if(!$fp) {
|
189 |
+
return false;
|
190 |
+
}
|
191 |
+
|
192 |
+
// Get status code from headers.
|
193 |
+
list($unused, $response['code'], $unused) = explode(' ', $http_response_header[0], 3);
|
194 |
+
$headers = array_slice($http_response_header, 1);
|
195 |
+
|
196 |
+
// Convert headers into associative array.
|
197 |
+
foreach($headers as $unused=>$header) {
|
198 |
+
$header = explode(':', $header);
|
199 |
+
$header[0] = trim($header[0]);
|
200 |
+
$header[1] = trim($header[1]);
|
201 |
+
$headers[strtolower($header[0])] = strtolower($header[1]);
|
202 |
+
}
|
203 |
+
|
204 |
+
$response['data'] = stream_get_contents($fp);
|
205 |
+
}
|
206 |
+
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Wrapper to provide a single interface for making an HTTP request.
|
210 |
+
*
|
211 |
+
* Attempts to use cURL, fopen(), or fsockopen(), whichever is available
|
212 |
+
* first.
|
213 |
+
*
|
214 |
+
* @param string $url URL to make request to.
|
215 |
+
* @param array $postdata (optional) If postdata is provided, the request
|
216 |
+
* method is POST with the key/value pairs as
|
217 |
+
* the data.
|
218 |
+
* @param array $file (optional) Should provide associative array
|
219 |
+
* with two keys: name and field. Name should
|
220 |
+
* be the name of the file and field is the name
|
221 |
+
* of the field to POST.
|
222 |
+
*/
|
223 |
+
function urlopen($url, $postdata=false, $file=false) {
|
224 |
+
$response = array(
|
225 |
+
'data' => '',
|
226 |
+
'code' => 0
|
227 |
+
);
|
228 |
+
|
229 |
+
if($file) {
|
230 |
+
extract($file, EXTR_PREFIX_ALL, 'file');
|
231 |
+
}
|
232 |
+
if(!$file_name || !$file_field) {
|
233 |
+
$file_name = false;
|
234 |
+
$file_field = false;
|
235 |
+
}
|
236 |
+
|
237 |
+
// Try curl, fsockopen, fopen + stream (PHP5 only), exec wget
|
238 |
+
if(function_exists('curl_init')) {
|
239 |
+
if (!function_exists('curl_setopt_array')) {
|
240 |
+
function curl_setopt_array(&$ch, $curl_options)
|
241 |
+
{
|
242 |
+
foreach ($curl_options as $option => $value) {
|
243 |
+
if (!curl_setopt($ch, $option, $value)) {
|
244 |
+
return false;
|
245 |
+
}
|
246 |
+
}
|
247 |
+
return true;
|
248 |
+
}
|
249 |
+
}
|
250 |
+
_curl_urlopen($url, $postdata, $response, $file_name, $file_field);
|
251 |
+
} else if(ini_get('allow_url_fopen') && function_exists('stream_get_contents')) {
|
252 |
+
_fopen_urlopen($url, $postdata, $response, $file_name, $file_field);
|
253 |
+
} else {
|
254 |
+
// TODO: Find the failure condition for fsockopen() (sockets?)
|
255 |
+
_fsockopen_urlopen($url, $postdata, $response, $file_name, $file_field);
|
256 |
+
}
|
257 |
+
|
258 |
+
return $response;
|
259 |
+
}
|
260 |
+
?>
|
manage.php
ADDED
@@ -0,0 +1,320 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( !defined('WP_CONTENT_URL') ) {
|
3 |
+
define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
|
4 |
+
}
|
5 |
+
if ( !defined('PLUGINDIR') ) {
|
6 |
+
define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
|
7 |
+
}
|
8 |
+
|
9 |
+
|
10 |
+
function dsq_plugin_basename($file) {
|
11 |
+
$file = dirname($file);
|
12 |
+
|
13 |
+
// From WP2.5 wp-includes/plugin.php:plugin_basename()
|
14 |
+
$file = str_replace('\\','/',$file); // sanitize for Win32 installs
|
15 |
+
$file = preg_replace('|/+|','/', $file); // remove any duplicate slash
|
16 |
+
$file = preg_replace('|^.*/' . PLUGINDIR . '/|','',$file); // get relative path from plugins dir
|
17 |
+
|
18 |
+
if ( strstr($file, '/') === false ) {
|
19 |
+
return $file;
|
20 |
+
}
|
21 |
+
|
22 |
+
$pieces = explode('/', $file);
|
23 |
+
return !empty($pieces[count($pieces)-1]) ? $pieces[count($pieces)-1] : $pieces[count($pieces)-2];
|
24 |
+
}
|
25 |
+
|
26 |
+
define('DSQ_PLUGIN_URL', WP_CONTENT_URL . '/plugins/' . dsq_plugin_basename(__FILE__));
|
27 |
+
|
28 |
+
global $wp_version;
|
29 |
+
global $dsq_version;
|
30 |
+
global $dsq_api;
|
31 |
+
|
32 |
+
if ( !current_user_can('manage_options') ) {
|
33 |
+
die();
|
34 |
+
}
|
35 |
+
|
36 |
+
// HACK: For old versions of WordPress
|
37 |
+
if ( !function_exists('wp_nonce_field') ) {
|
38 |
+
function wp_nonce_field() {}
|
39 |
+
}
|
40 |
+
|
41 |
+
// Handle export function.
|
42 |
+
if( isset($_POST['export']) ) {
|
43 |
+
require_once(dirname(__FILE__) . '/export.php');
|
44 |
+
dsq_export_wp();
|
45 |
+
}
|
46 |
+
|
47 |
+
// Handle uninstallation.
|
48 |
+
if ( isset($_POST['uninstall']) ) {
|
49 |
+
update_option('disqus_forum_url', '');
|
50 |
+
update_option('disqus_api_key', '');
|
51 |
+
}
|
52 |
+
|
53 |
+
// Clean-up POST parameters.
|
54 |
+
foreach ( array('dsq_forum_url', 'dsq_username', 'dsq_password') as $key ) {
|
55 |
+
if ( isset($_POST[$key]) ) { $_POST[$key] = strip_tags($_POST[$key]); }
|
56 |
+
}
|
57 |
+
|
58 |
+
// Handle installation process.
|
59 |
+
if ( isset($_POST['dsq_forum_url']) && isset($_POST['dsq_username']) && isset($_POST['dsq_password']) ) {
|
60 |
+
$api_key = $dsq_api->get_forum_api_key($_POST['dsq_username'], $_POST['dsq_password'], $_POST['dsq_forum_url']);
|
61 |
+
update_option('disqus_forum_url', $_POST['dsq_forum_url']);
|
62 |
+
|
63 |
+
if ( $api_key < 0 ) {
|
64 |
+
update_option('disqus_replace', 'replace');
|
65 |
+
dsq_manage_dialog('There was an error completing the installation of DISQUS. If you are still having issues, please contact <a href="mailto:help@disqus.com">help@disqus.com</a>.', true);
|
66 |
+
} else {
|
67 |
+
update_option('disqus_api_key', $api_key);
|
68 |
+
update_option('disqus_replace', 'all');
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
// Handle advanced options.
|
73 |
+
if ( isset($_POST['disqus_forum_url']) && isset($_POST['disqus_replace']) ) {
|
74 |
+
$disqus_forum_url = $_POST['disqus_forum_url'];
|
75 |
+
if ( $dot_pos = strpos($disqus_forum_url, '.') ) {
|
76 |
+
$disqus_forum_url = substr($disqus_forum_url, 0, $dot_pos);
|
77 |
+
}
|
78 |
+
update_option('disqus_forum_url', $disqus_forum_url);
|
79 |
+
update_option('disqus_replace', $_POST['disqus_replace']);
|
80 |
+
|
81 |
+
if(isset($_POST['disqus_cc_fix'])) {
|
82 |
+
update_option('disqus_cc_fix', true);
|
83 |
+
} else {
|
84 |
+
update_option('disqus_cc_fix', false);
|
85 |
+
}
|
86 |
+
|
87 |
+
dsq_manage_dialog('Your settings have been changed.');
|
88 |
+
}
|
89 |
+
|
90 |
+
// Get installation step process (or 0 if we're already installed).
|
91 |
+
$step = intval($_GET['step']);
|
92 |
+
$step = ($step > 0 && isset($_POST['dsq_username'])) ? $step : 1;
|
93 |
+
$step = (dsq_is_installed()) ? 0 : $step;
|
94 |
+
|
95 |
+
if ( 2 == $step && isset($_POST['dsq_username']) && isset($_POST['dsq_password']) ) {
|
96 |
+
$dsq_sites = $dsq_api->get_forum_list($_POST['dsq_username'], $_POST['dsq_password']);
|
97 |
+
if ( $dsq_sites < 0 ) {
|
98 |
+
$step = 1;
|
99 |
+
if ( -2 == $dsq_sites ) {
|
100 |
+
dsq_manage_dialog('Invalid password.', true);
|
101 |
+
} else {
|
102 |
+
dsq_manage_dialog('Unexpected error.', true);
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
// HACK: Our own styles for older versions of WordPress.
|
108 |
+
if ( $wp_version < 2.5 ) {
|
109 |
+
echo "<link rel='stylesheet' href='" . DSQ_PLUGIN_URL . "/styles/manage-pre25.css' type='text/css' />";
|
110 |
+
}
|
111 |
+
|
112 |
+
?>
|
113 |
+
<!-- Header -->
|
114 |
+
<link rel='stylesheet' href='<?php echo DSQ_PLUGIN_URL; ?>/styles/manage.css' type='text/css' />
|
115 |
+
<script type="text/javascript" src='<?php echo DSQ_PLUGIN_URL; ?>/scripts/manage.js'></script>
|
116 |
+
|
117 |
+
<div class="wrap" id="dsq-wrap">
|
118 |
+
<img src="<?php echo DSQ_PLUGIN_URL; ?>/images/logo.png">
|
119 |
+
|
120 |
+
<ul id="dsq-tabs">
|
121 |
+
<li class="selected" id="dsq-tab-main"><?php echo (dsq_is_installed() ? 'Manage' : 'Install'); ?></li>
|
122 |
+
<li id="dsq-tab-advanced">Advanced Options</li>
|
123 |
+
</ul>
|
124 |
+
<!-- /Header -->
|
125 |
+
|
126 |
+
<div id="dsq-main" class="dsq-content">
|
127 |
+
<?php
|
128 |
+
switch ( $step ) {
|
129 |
+
case 2:
|
130 |
+
?>
|
131 |
+
<div id="dsq-step-2" class="dsq-main">
|
132 |
+
<h2>Install DISQUS</h2>
|
133 |
+
|
134 |
+
<form method="POST" action="?page=disqus">
|
135 |
+
<?php wp_nonce_field('dsq-install-2'); ?>
|
136 |
+
<table class="form-table">
|
137 |
+
<tr>
|
138 |
+
<th scope="row" valign="top">Select a website</th>
|
139 |
+
<td>
|
140 |
+
<?php
|
141 |
+
foreach ( $dsq_sites as $counter => $dsq_site ):
|
142 |
+
?>
|
143 |
+
<input name="dsq_forum_url" type="radio" id="dsq-site-<?php echo $counter; ?>" value="<?php echo $dsq_site['short_name']; ?>" />
|
144 |
+
<label for="dsq-site-<?php echo $counter; ?>"><strong><?php echo $dsq_site['name']; ?></strong> (<u><?php echo $dsq_site['short_name']; ?>.disqus.com</u>)</label>
|
145 |
+
<br />
|
146 |
+
<?php
|
147 |
+
endforeach;
|
148 |
+
?>
|
149 |
+
<hr />
|
150 |
+
Or add a new one at <a href="http://disqus.com/add/">DISQUS.com</a>.
|
151 |
+
</td>
|
152 |
+
</tr>
|
153 |
+
</table>
|
154 |
+
|
155 |
+
<p class="submit" style="text-align: left">
|
156 |
+
<input type="hidden" name="dsq_username" value="<?php echo $_POST['dsq_username']; ?>">
|
157 |
+
<input type="hidden" name="dsq_password" value="<?php echo $_POST['dsq_password']; ?>">
|
158 |
+
<input name="submit" type="submit" value="Next »" />
|
159 |
+
</p>
|
160 |
+
</form>
|
161 |
+
</div>
|
162 |
+
<?php
|
163 |
+
break;
|
164 |
+
case 1:
|
165 |
+
?>
|
166 |
+
<div id="dsq-step-1" class="dsq-main">
|
167 |
+
<h2>Install DISQUS</h2>
|
168 |
+
|
169 |
+
<form method="POST" action="?page=disqus&step=2">
|
170 |
+
<?php wp_nonce_field('dsq-install-1'); ?>
|
171 |
+
<table class="form-table">
|
172 |
+
<tr>
|
173 |
+
<th scope="row" valign="top">Username</th>
|
174 |
+
<td>
|
175 |
+
<input id="dsq-username" name="dsq_username" tabindex="1">
|
176 |
+
<a href="http://disqus.com/signup/">(don't have a DISQUS account yet?)</a>
|
177 |
+
</td>
|
178 |
+
</tr>
|
179 |
+
<tr>
|
180 |
+
<th scope="row" valign="top">Password</th>
|
181 |
+
<td>
|
182 |
+
<input type="password" id="dsq-password" name="dsq_password" tabindex="2">
|
183 |
+
<a href="http://disqus.com/forgot/">(forgot your password?)</a>
|
184 |
+
</td>
|
185 |
+
</tr>
|
186 |
+
</table>
|
187 |
+
|
188 |
+
<p class="submit" style="text-align: left">
|
189 |
+
<input name="submit" type="submit" value="Next »" tabindex="3">
|
190 |
+
</p>
|
191 |
+
|
192 |
+
<script type="text/javascript"> document.getElementById('dsq-username').focus(); </script>
|
193 |
+
</form>
|
194 |
+
</div>
|
195 |
+
<?php
|
196 |
+
break;
|
197 |
+
case 0:
|
198 |
+
?>
|
199 |
+
<div class="dsq-main">
|
200 |
+
<h2>DISQUS Comment System</h2>
|
201 |
+
<hr />
|
202 |
+
<iframe src="<?php echo DISQUS_API_URL; ?>/admin/moderate/<?php echo get_option('disqus_forum_url'); ?>/?template=wordpress" style="width: 100%; height: 800px"></iframe>
|
203 |
+
</div>
|
204 |
+
<?php } ?>
|
205 |
+
</div>
|
206 |
+
|
207 |
+
<?php
|
208 |
+
$dsq_replace = get_option('disqus_replace');
|
209 |
+
$dsq_forum_url = strtolower(get_option('disqus_forum_url'));
|
210 |
+
$dsq_api_key = get_option('disqus_api_key');
|
211 |
+
$dsq_cc_fix = get_option('disqus_cc_fix');
|
212 |
+
|
213 |
+
if(dsq_is_installed()) {
|
214 |
+
$dsq_last_import_id = get_option('disqus_last_import_id');
|
215 |
+
$dsq_import_status = $dsq_api->get_import_status($dsq_last_import_id);
|
216 |
+
}
|
217 |
+
?>
|
218 |
+
<!-- Advanced options -->
|
219 |
+
<div id="dsq-advanced" class="dsq-content" style="display:none;">
|
220 |
+
<h2>Advanced Options</h2>
|
221 |
+
Version: <?php echo $dsq_version; ?>
|
222 |
+
<?php
|
223 |
+
if(function_exists('curl_init')) {
|
224 |
+
echo ' (Using cURL libraries.)';
|
225 |
+
} else if(ini_get('allow_url_fopen') && function_exists('stream_get_contents')) {
|
226 |
+
echo ' (Using fopen.)';
|
227 |
+
} else {
|
228 |
+
echo ' (Using fsockopen.)';
|
229 |
+
}
|
230 |
+
?>
|
231 |
+
<form method="POST">
|
232 |
+
<?php wp_nonce_field('dsq-advanced'); ?>
|
233 |
+
<table class="form-table">
|
234 |
+
<tr>
|
235 |
+
<th scope="row" valign="top">DISQUS Short Name</th>
|
236 |
+
<td>
|
237 |
+
<input name="disqus_forum_url" value="<?php echo $dsq_forum_url; ?>" tabindex="1">
|
238 |
+
<br />
|
239 |
+
This is the unique identifier for your website on DISQUS.
|
240 |
+
</td>
|
241 |
+
</tr>
|
242 |
+
|
243 |
+
<tr>
|
244 |
+
<th scope="row" valign="top">DISQUS API Key</th>
|
245 |
+
<td>
|
246 |
+
<input type="text" name="disqus_api_key" value="<?php echo $dsq_api_key; ?>" tabindex="2">
|
247 |
+
<br />
|
248 |
+
This is set for you when going through the installation steps. Without it, the plugin runs in <a href="http://disqus.com/docs/wordpress/#legacy-mode" target="_blank">legacy mode</a>.
|
249 |
+
</td>
|
250 |
+
</tr>
|
251 |
+
|
252 |
+
<tr>
|
253 |
+
<th scope="row" valign="top">Use DISQUS on</th>
|
254 |
+
<td>
|
255 |
+
<select name="disqus_replace" tabindex="3" class="disqus-replace">
|
256 |
+
<?php if ( dsq_legacy_mode() ) : ?>
|
257 |
+
<option value="empty" <?php if('empty'==$dsq_replace){echo 'selected';}?>>Only future blog posts and existing posts without WordPress comments.</option>
|
258 |
+
<? endif ; ?>
|
259 |
+
<option value="all" <?php if('all'==$dsq_replace){echo 'selected';}?>>On all existing and future blog posts.</option>
|
260 |
+
<option value="closed" <?php if('closed'==$dsq_replace){echo 'selected';}?>>Only on blog posts with closed comments.</option>
|
261 |
+
</select>
|
262 |
+
<br />
|
263 |
+
NOTE: Your WordPress comments will never be lost.
|
264 |
+
</td>
|
265 |
+
</tr>
|
266 |
+
|
267 |
+
<tr>
|
268 |
+
<th scope="row" valign="top">Comment Count</th>
|
269 |
+
<td>
|
270 |
+
<input type="checkbox" id="disqus_comment_count" name="disqus_cc_fix" <?php if($dsq_cc_fix){echo 'checked="checked"';}?> >
|
271 |
+
<label for="disqus_comment_count">Check this if you have a problem with comment counts not showing on permalinks</label> (<a href="http://disqus.com/docs/wordpress/#comment-count" target="_blank">more info</a>).
|
272 |
+
</td>
|
273 |
+
</tr>
|
274 |
+
|
275 |
+
</table>
|
276 |
+
|
277 |
+
<p class="submit" style="text-align: left">
|
278 |
+
<input name="submit" type="submit" value="Save" tabindex="4">
|
279 |
+
</p>
|
280 |
+
</form>
|
281 |
+
|
282 |
+
<table class="form-table">
|
283 |
+
<tr>
|
284 |
+
<th scope="row" valign="top">Import comments into DISQUS</th>
|
285 |
+
<td>
|
286 |
+
<form action="?page=disqus" method="POST">
|
287 |
+
<?php wp_nonce_field('dsq-export'); ?>
|
288 |
+
<input type="submit" value="Import" name="export"
|
289 |
+
<?php if($dsq_last_import_id) : ?>
|
290 |
+
onclick="return confirm('You\'ve already imported your comments. Are you sure you want to do this again?');"
|
291 |
+
<?php endif; ?>
|
292 |
+
> This will sync your WordPress comments with DISQUS
|
293 |
+
<br />
|
294 |
+
<span style="font-size: 14px;">
|
295 |
+
<?php if($dsq_last_import_id) : ?>
|
296 |
+
<strong>Import status:</strong> <?php echo $dsq_import_status['status_name']; ?><br />
|
297 |
+
<?php if($dsq_import_status['finished_at']) : ?>
|
298 |
+
<strong>Finished:</strong> <?php echo $dsq_import_status['finished_at']; ?><br />
|
299 |
+
<?php elseif($dsq_import_status['started_at']) : ?>
|
300 |
+
<strong>Started:</strong> <?php echo $dsq_import_status['started_at']; ?><br />
|
301 |
+
<?php endif; ?>
|
302 |
+
<br /><br />
|
303 |
+
<?php endif; ?>
|
304 |
+
</span>
|
305 |
+
</form>
|
306 |
+
</td>
|
307 |
+
</tr>
|
308 |
+
|
309 |
+
<tr>
|
310 |
+
<th scope="row" valign="top">Uninstall DISQUS</th>
|
311 |
+
<td>
|
312 |
+
<form action="?page=disqus" method="POST">
|
313 |
+
<?php wp_nonce_field('dsq-uninstall'); ?>
|
314 |
+
<input type="submit" value="Uninstall" name="uninstall" onclick="return confirm('Are you sure you want to uninstall DISQUS?')">
|
315 |
+
</form>
|
316 |
+
</td>
|
317 |
+
</tr>
|
318 |
+
</table>
|
319 |
+
</div>
|
320 |
+
</div>
|
readme.txt
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== DISQUS Comment System ===
|
2 |
+
Contributors: DISQUS.com <team@disqus.com>
|
3 |
+
Tags: comments, threaded, email, notification, spam, avatars, community, profile, widget
|
4 |
+
Requires at least: 2.0
|
5 |
+
Tested up to: 2.6.1
|
6 |
+
Stable tag: 2.02.2812
|
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. The Disqus comment system can be plugged into any website,
|
14 |
+
blog, or application. Disqus makes commenting easier and more interactive,
|
15 |
+
while connecting websites and commenters across a thriving discussion
|
16 |
+
community.
|
17 |
+
|
18 |
+
The Disqus for WordPress plugin seamlessly integrates using the Disqus API and by syncing with WordPress comments.
|
19 |
+
|
20 |
+
= Disqus for WordPress =
|
21 |
+
|
22 |
+
* Uses the Disqus API
|
23 |
+
* Comments indexable by search engines (SEO-friendly)
|
24 |
+
* Support for importing existing comments
|
25 |
+
* Auto-sync (backup) of comments with Disqus and WordPress database
|
26 |
+
|
27 |
+
= Disqus Features =
|
28 |
+
|
29 |
+
* Threaded comments and replies
|
30 |
+
* Notifications and reply by email
|
31 |
+
* Subscribe and RSS options
|
32 |
+
* Powerful moderation and admin tools
|
33 |
+
* Full spam filtering
|
34 |
+
* Support for Disqus community widgets
|
35 |
+
* Connected with a large discussion community
|
36 |
+
* Increased exposure and readership
|
37 |
+
|
38 |
+
== Installation ==
|
39 |
+
|
40 |
+
**NOTE: It is recommended that you backup 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/'
|
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/docs/wordpress
|
54 |
+
|
55 |
+
== Upgrading ==
|
56 |
+
|
57 |
+
1. Replace the old plugin with the new plugin (the plugin must stay in
|
58 |
+
the disqus directory).
|
59 |
+
|
60 |
+
2. Your blog will be in legacy mode until you complete the configuration.
|
61 |
+
This just means that it is using JavaScript to pull the comments instead
|
62 |
+
of the API.
|
63 |
+
|
64 |
+
== Support ==
|
65 |
+
|
66 |
+
* Visit our forum at http://disqus.disqus.com/ for help.
|
scripts/manage.js
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var dsq_old_onload = window.onload;
|
2 |
+
|
3 |
+
function dsq_tab_func(clicked_tab) {
|
4 |
+
function _dsq_tab_func(e) {
|
5 |
+
var tabs = document.getElementById('dsq-tabs').getElementsByTagName('li');
|
6 |
+
var contents = document.getElementById('dsq-wrap').getElementsByTagName('div');
|
7 |
+
|
8 |
+
for(var i = 0; i < tabs.length; i++) {
|
9 |
+
tabs[i].className = '';
|
10 |
+
}
|
11 |
+
|
12 |
+
for(var i = 0; i < contents.length; i++) {
|
13 |
+
if(contents[i].className == 'dsq-content') {
|
14 |
+
contents[i].style.display = 'none';
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
document.getElementById('dsq-tab-' + clicked_tab).className = 'selected';
|
19 |
+
document.getElementById('dsq-' + clicked_tab).style.display = 'block';
|
20 |
+
|
21 |
+
}
|
22 |
+
|
23 |
+
return _dsq_tab_func;
|
24 |
+
}
|
25 |
+
|
26 |
+
window.onload = function(e) {
|
27 |
+
// Tabs have an ID prefixed with "dsq-tab-".
|
28 |
+
// Content containers have an ID prefixed with "dsq-" and a class name of "dsq-content".
|
29 |
+
var tabs = document.getElementById('dsq-tabs').getElementsByTagName('li');
|
30 |
+
|
31 |
+
for(var i = 0; i < tabs.length; i++) {
|
32 |
+
tabs[i].onclick = dsq_tab_func(tabs[i].id.substr(tabs[i].id.lastIndexOf('-') + 1));
|
33 |
+
}
|
34 |
+
|
35 |
+
if(dsq_old_onload) {
|
36 |
+
dsq_old_onload(e);
|
37 |
+
}
|
38 |
+
}
|
styles/manage-pre25.css
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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; }
|
styles/manage.css
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ul#dsq-tabs li.selected, ul.dsq-tabs li:hover {
|
2 |
+
background: url( ../images/fade-butt.png );
|
3 |
+
border: 3px double #999;
|
4 |
+
}
|
5 |
+
ul#dsq-tabs li {
|
6 |
+
float: left;
|
7 |
+
border: 3px solid #999;
|
8 |
+
border-left-color: #ccc;
|
9 |
+
border-top-color: #ccc;
|
10 |
+
color: #333;
|
11 |
+
padding: 0.25em;
|
12 |
+
height: 20px;
|
13 |
+
cursor: pointer;
|
14 |
+
margin-right: 5px;
|
15 |
+
}
|
16 |
+
|
17 |
+
ul#dsq-tabs {
|
18 |
+
display: block;
|
19 |
+
height: 45px;
|
20 |
+
list-style: none;
|
21 |
+
margin: 15px 0;
|
22 |
+
padding: 0;
|
23 |
+
border: 0;
|
24 |
+
}
|
25 |
+
|
26 |
+
select.disqus-replace {
|
27 |
+
border-color: #C6D9E9;
|
28 |
+
}
|