-
Notifications
You must be signed in to change notification settings - Fork 1
/
Disqus.php
32 lines (26 loc) · 890 Bytes
/
Disqus.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
defined('is_running') or die('Not an entry point...');
class Disqus{
function __construct(){
global $page, $addonPathData;
$config = \gpFiles::Get($addonPathData.'/config.php', 'config');
if(!$config || !in_array($page->gp_index, $config['pages_comments']))
return;
echo '<div id="disqus_thread"></div>';
echo '<script>
var disqus_config = function () {
this.page.title = "'.$page->label.'";
this.page.url = "'.\gp\tool::AbsoluteUrl($page->requested).'";
this.page.identifier = "'.$page->gp_index.'";
};
(function() {
var d = document, s = d.createElement(\'script\');
s.src = \'https://'.$config['disqus_forum_url'].'.disqus.com/embed.js\';
s.setAttribute(\'data-timestamp\', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>';
echo '<noscript>'.$config['noscriptmsg'].'</noscript>';
}
}
?>