-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_public.php
More file actions
88 lines (79 loc) · 3.17 KB
/
_public.php
File metadata and controls
88 lines (79 loc) · 3.17 KB
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
78
79
80
81
82
83
84
85
86
87
88
<?php
/***************************************************************
* WebmasterTools *
* Based on GoogleTools from Xave *
* *
* Copyright (c) 2013 *
* Régis FLORET *
* *
* This is 'Google Stuff', a plugin for Dotclear 2 *
* *
* Copyright (c) 2008 *
* xave and contributors. *
* *
* This is an open source software, distributed under the GNU *
* General Public License (version 2) terms and conditions. *
* *
* You should have received a copy of the GNU General Public *
* License along with 'My Favicon' (see COPYING.txt); *
* if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************/
if (!defined('DC_RC_PATH')) {return;}
$core->addBehavior('publicHeadContent', array('webmasterToolsPublicBehaviours','publicHeadContent'));
$core->addBehavior('publicFooterContent',array('webmasterToolsPublicBehaviours','publicFooterContent'));
class webmasterToolsPublicBehaviours
{
/*
* Add in the <head> tag meta tags or js
*/
public static function publicHeadContent($core)
{
$webmastertools = @$core->blog->settings->get('webmastertools') or false;
if ($webmastertools)
{
$res = '';
$verify = @$webmastertools->get('google_verify') or false;
if ($verify) {
$res .= '<meta name="google-site-verification" content="' . $verify . '" />' . "\n";
}
$uacct = @$webmastertools->get('google_uacct') or false;
if ($uacct) {
$res .= '<script type="text/javascript">' . "\n" .
'var _gaq = _gaq || [];' . "\n" .
'_gaq.push([\'_setAccount\', \'' . $uacct . '\']);' . "\n" .
'_gaq.push([\'_trackPageview\']);' . "\n" .
'</script>' . "\n";
}
$bing = @$webmastertools->get('bing_verify') or false;
if ($bing) {
$res .= '<meta name="msvalidate.01" content="' . $bing . '" />' . "\n";
}
echo $res;
}
}
/*
* Add in the footer the Google Analytics javascript
*/
public static function publicFooterContent($core)
{
$webmastertools = @$core->blog->settings->get('webmastertools') or false;
if ($webmastertools)
{
$uacct = $webmastertools->get('google_uacct') or false;
if ($uacct)
{
echo '<script type="text/javascript">'."\n".
'(function() {'."\n".
'var ga = document.createElement(\'script\');'."\n".
'ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' :'.
'\'http://www\') + \'.google-analytics.com/ga.js\';'."\n".
'ga.setAttribute(\'async\', \'true\');'."\n".
'document.documentElement.firstChild.appendChild(ga);'."\n".
'})();'."\n".
'</script>';
}
}
}
}
?>