mirror of
https://github.com/danpros/htmly.git
synced 2026-04-18 03:26:20 +05:30
Add Facebook comments
Add Facebook comments as comment system options.
This commit is contained in:
parent
def856716a
commit
a6bfc5a7ce
14 changed files with 57 additions and 16 deletions
|
|
@ -19,7 +19,14 @@ blog.menu = ""
|
|||
; Breadcrumb home text. Useful when installed on subfolder.
|
||||
breadcrumb.home = "Home"
|
||||
|
||||
; Disqus
|
||||
; Comment system. Choose "facebook" or "disqus".
|
||||
comment.system = "facebook"
|
||||
|
||||
;Facebook comments
|
||||
fb.num = "5"
|
||||
fb.color = "light"
|
||||
|
||||
; Disqus comments
|
||||
disqus.shortname = ""
|
||||
|
||||
; Google+ publisher
|
||||
|
|
|
|||
|
|
@ -820,6 +820,7 @@ function copyright(){
|
|||
|
||||
// Disqus on post.
|
||||
function disqus($title=null, $url=null){
|
||||
$comment = config('comment.system');
|
||||
$disqus = config('disqus.shortname');
|
||||
$script = <<<EOF
|
||||
<script type="text/javascript">
|
||||
|
|
@ -833,13 +834,14 @@ function disqus($title=null, $url=null){
|
|||
})();
|
||||
</script>
|
||||
EOF;
|
||||
if (!empty($disqus)) {
|
||||
if (!empty($disqus) && $comment == 'disqus') {
|
||||
return $script;
|
||||
}
|
||||
}
|
||||
|
||||
// Disqus comment count on teaser
|
||||
function disqus_count(){
|
||||
$comment = config('comment.system');
|
||||
$disqus = config('disqus.shortname');
|
||||
$script = <<<EOF
|
||||
<script type="text/javascript">
|
||||
|
|
@ -851,7 +853,7 @@ function disqus_count(){
|
|||
})();
|
||||
</script>
|
||||
EOF;
|
||||
if (!empty($disqus)) {
|
||||
if (!empty($disqus) && $comment == 'disqus') {
|
||||
return $script;
|
||||
}
|
||||
}
|
||||
|
|
@ -899,11 +901,31 @@ function recent_comments(){
|
|||
}
|
||||
</style>
|
||||
EOF;
|
||||
if (!empty($disqus)) {
|
||||
if (!empty($disqus) && $comment == 'disqus') {
|
||||
return $script;
|
||||
}
|
||||
}
|
||||
|
||||
function facebook() {
|
||||
$comment = config('comment.system');
|
||||
$script = <<<EOF
|
||||
<div id="fb-root"></div>
|
||||
<script>(function(d, s, id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) return;
|
||||
js = d.createElement(s); js.id = id;
|
||||
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));</script>
|
||||
<style>.fb-comments, .fb_iframe_widget span, .fb-comments iframe {width: 100%!important;}</style>
|
||||
EOF;
|
||||
|
||||
if($comment == 'facebook') {
|
||||
return $script;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Google Publisher (Google+ page).
|
||||
function publisher(){
|
||||
$publisher = config('google.publisher');
|
||||
|
|
@ -1396,7 +1418,7 @@ function head_contents($title, $description, $canonical) {
|
|||
$output .= $title ."\n". $favicon ."\n". $charset ."\n". $generator ."\n". $xua ."\n". $viewport ."\n". $description ."\n". $sitemap ."\n". $canonical ."\n". $feed ."\n". $lightboxcss ."\n". $jquery ."\n". $lightbox ."\n" .$corejs ."\n";
|
||||
}
|
||||
else {
|
||||
$output .= $title ."\n". $favicon ."\n". $charset ."\n". $generator ."\n". $xua ."\n". $viewport ."\n". $description ."\n". $sitemap ."\n". $canonical ."\n". $feed ."\n";
|
||||
$output .= $title ."\n". $favicon ."\n". $charset ."\n". $generator ."\n". $xua ."\n". $viewport ."\n". $description ."\n". $sitemap ."\n". $canonical ."\n". $feed ."\n". $jquery ."\n";
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
|
|
|||
|
|
@ -270,8 +270,8 @@ pre code {
|
|||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.border #disqus_thread {
|
||||
padding-top: 1.2em;
|
||||
.border .fb-comments, .border #disqus_thread {
|
||||
padding-top: 1.2em;
|
||||
}
|
||||
|
||||
#disqus_thread {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
<meta content="<?php echo blog_title() ?>" itemprop="name"/>
|
||||
<meta content="<?php echo blog_description() ?>" itemprop="description"/>
|
||||
</div>
|
||||
<?php if(facebook()) { echo facebook();} ?>
|
||||
<?php if(login()) { toolbar();} ?>
|
||||
<aside>
|
||||
<h1 class="blog-title"><a href="<?php echo site_url() ?>"><?php echo blog_title() ?></a></h1>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<div class="<?php echo $class ?>" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
|
||||
<div class="main">
|
||||
<h2 class="title-index" itemprop="name"><a href="<?php echo $p->url?>"><?php echo $p->title ?></a></h2>
|
||||
<div class="date"><span itemprop="datePublished"><?php echo date('d F Y', $p->date)?></span> - Posted in <span itemprop="articleSection"><?php echo $p->tag ?></span> by <span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span><?php if (disqus_count() == true):?> - <span><a href="<?php echo $p->url?>#disqus_thread">Comments</a></span><?php endif;?></div>
|
||||
<div class="date"><span itemprop="datePublished"><?php echo date('d F Y', $p->date)?></span> - Posted in <span itemprop="articleSection"><?php echo $p->tag ?></span> by <span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span><?php if (disqus_count()) {?> - <span><a href="<?php echo $p->url?>#disqus_thread">Comments</a></span><?php } else {?> - <a href="<?php echo $p->url ?>#comments"><span><fb:comments-count href=<?php echo $p->url ?>></fb:comments-count> Comments</span></a> <?php } ?></div>
|
||||
<div class="teaser-body" itemprop="articleBody">
|
||||
<?php echo get_thumbnail($p->body)?>
|
||||
<?php echo get_teaser($p->body, $p->url)?>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<?php echo get_related($p->tag)?>
|
||||
<div class="comments border">
|
||||
<div id="comments" class="comments border">
|
||||
<?php if (facebook()):?>
|
||||
<div class="fb-comments" data-href="<?php echo $p->url ?>" data-numposts="<?php echo config('fb.num') ?>" data-colorscheme="<?php echo config('fb.color') ?>"></div>
|
||||
<?php endif;?>
|
||||
<?php if (disqus()):?>
|
||||
<div id="disqus_thread"></div>
|
||||
<?php endif;?>
|
||||
|
|
|
|||
|
|
@ -586,8 +586,8 @@ h1.title-post a:hover, h2.title-index a:hover {
|
|||
float:left;
|
||||
}
|
||||
|
||||
.border #disqus_thread {
|
||||
padding-top: 1.2em;
|
||||
.border .fb-comments, .border #disqus_thread {
|
||||
padding-top: 1.2em;
|
||||
}
|
||||
|
||||
#disqus_thread {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
<meta content="<?php echo blog_title() ?>" itemprop="name"/>
|
||||
<meta content="<?php echo blog_description() ?>" itemprop="description"/>
|
||||
</div>
|
||||
<?php if(facebook()) { echo facebook();} ?>
|
||||
<?php if(login()) { toolbar();} ?>
|
||||
<div id="outer-wrapper">
|
||||
<div id="menu-wrapper">
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<div class="<?php echo $class ?>" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
|
||||
<div class="main">
|
||||
<h2 class="title-index" itemprop="name"><a href="<?php echo $p->url?>"><?php echo $p->title ?></a></h2>
|
||||
<div class="date"><span itemprop="datePublished"><?php echo date('d F Y', $p->date)?></span> - Posted in <span itemprop="articleSection"><?php echo $p->tag ?></span> by <span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span><?php if (disqus_count() == true):?> - <span><a href="<?php echo $p->url?>#disqus_thread">Comments</a></span><?php endif;?></div>
|
||||
<div class="date"><span itemprop="datePublished"><?php echo date('d F Y', $p->date)?></span> - Posted in <span itemprop="articleSection"><?php echo $p->tag ?></span> by <span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span><?php if (disqus_count()) {?> - <span><a href="<?php echo $p->url?>#disqus_thread">Comments</a></span><?php } else {?> - <a href="<?php echo $p->url ?>#comments"><span><fb:comments-count href=<?php echo $p->url ?>></fb:comments-count> Comments</span></a> <?php } ?></div>
|
||||
<div class="teaser-body" itemprop="articleBody">
|
||||
<?php echo get_thumbnail($p->body)?>
|
||||
<?php echo get_teaser($p->body, $p->url)?>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<?php echo get_related($p->tag)?>
|
||||
<div class="comments border">
|
||||
<div id="comments" class="comments border">
|
||||
<?php if (facebook()):?>
|
||||
<div class="fb-comments" data-href="<?php echo $p->url ?>" data-numposts="<?php echo config('fb.num') ?>" data-colorscheme="<?php echo config('fb.color') ?>"></div>
|
||||
<?php endif;?>
|
||||
<?php if (disqus()):?>
|
||||
<div id="disqus_thread"></div>
|
||||
<?php endif;?>
|
||||
|
|
|
|||
|
|
@ -540,7 +540,7 @@ ul li, ol li{
|
|||
float:right;
|
||||
}
|
||||
|
||||
.border #disqus_thread {
|
||||
.border .fb-comments, .border #disqus_thread {
|
||||
padding-top: 1.2em;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
<meta content="<?php echo blog_title() ?>" itemprop="name"/>
|
||||
<meta content="<?php echo blog_description() ?>" itemprop="description"/>
|
||||
</div>
|
||||
<?php if(facebook()) { echo facebook();} ?>
|
||||
<?php if(login()) { toolbar();} ?>
|
||||
<div id="cover">
|
||||
<div id="header-wrapper">
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<div class="<?php echo $class ?>" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
|
||||
<div class="main">
|
||||
<h2 class="title-index" itemprop="name"><a href="<?php echo $p->url?>"><?php echo $p->title ?></a></h2>
|
||||
<div class="date"><span itemprop="datePublished"><?php echo date('d F Y', $p->date)?></span> - Posted in <span itemprop="articleSection"><?php echo $p->tag ?></span> by <span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span><?php if (disqus_count() == true):?> - <span><a href="<?php echo $p->url?>#disqus_thread">Comments</a></span><?php endif;?></div>
|
||||
<div class="date"><span itemprop="datePublished"><?php echo date('d F Y', $p->date)?></span> - Posted in <span itemprop="articleSection"><?php echo $p->tag ?></span> by <span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span><?php if (disqus_count()) {?> - <span><a href="<?php echo $p->url?>#disqus_thread">Comments</a></span><?php } else {?> - <a href="<?php echo $p->url ?>#comments"><span><fb:comments-count href=<?php echo $p->url ?>></fb:comments-count> Comments</span></a> <?php } ?></div>
|
||||
<div class="teaser-body" itemprop="articleBody">
|
||||
<?php echo get_thumbnail($p->body)?>
|
||||
<?php echo get_teaser($p->body, $p->url)?>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<?php echo get_related($p->tag)?>
|
||||
<div class="comments border">
|
||||
<div id="comments" class="comments border">
|
||||
<?php if (facebook()):?>
|
||||
<div class="fb-comments" data-href="<?php echo $p->url ?>" data-numposts="<?php echo config('fb.num') ?>" data-colorscheme="<?php echo config('fb.color') ?>"></div>
|
||||
<?php endif;?>
|
||||
<?php if (disqus()):?>
|
||||
<div id="disqus_thread"></div>
|
||||
<?php endif;?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue