-
Notifications
You must be signed in to change notification settings - Fork 4
/
social.php
executable file
·54 lines (42 loc) · 1.87 KB
/
social.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/*
# News Show SP2 - News display/Slider module by JoomShaper.com
# Author JoomShaper http://www.joomshaper.com
# Copyright (C) 2010 - 2015 JoomShaper.com. All Rights Reserved.
# @license - GNU/GPL V2 or later
# Websites: http://www.joomshaper.com
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
class modNSSP2SocialHelper {
public static function icons($data, $params) {
$icons = array();
$url = urldecode(JRoute::_(strstr($data->link, 'index.php')));
$url = rtrim(JURI::base(),'/') . $url;
if ($params->get('btn_like')) { // Facebook Like
$icons[] = '<span class="ns2-share-icon"><div class="fb-like" data-href="' . $url . '" data-send="false" data-layout="button_count" data-width="80" data-show-faces="false"></div></span>';
if (defined('_NS2LIKE')) {
define ('_NS2LIKE', 1);
echo '<div id="fb-root"></div>';
JFactory::getDocument()->addScriptDeclaration('
(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&appId=354400064582736";
fjs.parentNode.insertBefore(js, fjs);
}(document, \'script\', \'facebook-jssdk\'));
');
}
}
if ($params->get('btn_twitter')) { //Twitter Button
$icons[] = '<span class="ns2-share-icon"><a href="https://twitter.com/share" class="twitter-share-button" data-text="' . $data->title . '" data-url="' . $url . '">Tweet</a></span>';
JFactory::getDocument()->addScript('http://platform.twitter.com/widgets.js');
}
if ($params->get('btn_gplus')) { // Goolge Plus Button
$icons[] = '<span class="ns2-share-icon"><g:plusone href="' . $url . '" size="medium"></g:plusone></span>';
JFactory::getDocument()->addScript('https://apis.google.com/js/plusone.js');
}
return $icons;
}
}