Skip to content

Instantly share code, notes, and snippets.

@garethredfern
Created January 11, 2013 13:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save garethredfern/4510758 to your computer and use it in GitHub Desktop.
Save garethredfern/4510758 to your computer and use it in GitHub Desktop.
Disqus Plugin Working Code
<?php
class Plugin_disqus extends Plugin {
var $meta = array(
'name' => 'Disqus',
'version' => '0.9',
'author' => 'Mubashar Iqbal',
'author_url' => 'http://mubashariqbal.com'
);
public function comments()
{
$account = $this->fetch_param('account', null);
$developer_mode = $this->fetch_param('dev', false, false, true);
$developer_mode = $developer_mode ? '1' : '0';
if ($account) {
$output = '
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = "'.$account.'"; // required: replace example with your forum shortname
var disqus_developer = '.$developer_mode.';
/* * * DON\'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";
(document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
';
return $output;
}
return '';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment