-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsocialButtons.php
77 lines (72 loc) · 2.92 KB
/
socialButtons.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/*
* JavaScript Redstone Simulator
* Copyright (C) 2012 Jonathan Lydall (Email: [email protected])
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
$runningOnLive = (!(strpos($_SERVER['HTTP_HOST'], 'mordritch.com') === false));
function facebookScriptTag() {
//1. Include the JavaScript SDK on your page once, ideally right after the opening <body> tag.
global $runningOnLive;
if ($runningOnLive) {
echo
'<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_GB/all.js#xfbml=1";' .
'fjs.parentNode.insertBefore(js, fjs);' .
'}(document, \'script\', \'facebook-jssdk\'));</script>';
}
}
function facebookButton() {
// 2. Place the code for your plugin wherever you want the plugin to appear on your page.
global $runningOnLive;
if ($runningOnLive) {
echo
'<span class="facebookButton">' .
'<div class="fb-like" data-href="http://mordritch.com/mc_rss/" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false" data-font="arial"></div>' .
'</span>';
}
}
function twitterButton() {
global $runningOnLive;
if ($runningOnLive) {
echo
'<span class="twitterButton">' .
'<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://mordritch.com/mc_rss/" data-text="JavaScript Minecraft Redstone Simulator" data-dnt="true">Tweet</a>' .
'<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>' .
'</span>';
}
}
function redditButton() {
global $runningOnLive;
if ($runningOnLive) {
echo
'<span class="redditButton">' .
'<script type="text/javascript">' .
'var reddit_url = "http://mordritch.com/mc_rss/"; ' .
'var reddit_target = "redstone"; ' .
'var reddit_title = "JavaScript Minecraft Redstone Simulator"; ' .
'var reddit_newwindow="1"; ' .
'</script>' .
'<script type="text/javascript" src="http://www.reddit.com/static/button/button1.js"></script>' .
'</span>';
}
}
?>