-
-
Save dimaslanjaka/1793796abc188155c9f3c4d3f563afe0 to your computer and use it in GitHub Desktop.
Disqus Plugin Working Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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