1 | <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ |
---|
2 | /***************************************************************\ |
---|
3 | * This is 'Google Stuff', a plugin for Dotclear 2 * |
---|
4 | * * |
---|
5 | * Copyright (c) 2008 * |
---|
6 | * xave and contributors. * |
---|
7 | * * |
---|
8 | * This is an open source software, distributed under the GNU * |
---|
9 | * General Public License (version 2) terms and conditions. * |
---|
10 | * * |
---|
11 | * You should have received a copy of the GNU General Public * |
---|
12 | * License along with 'My Favicon' (see COPYING.txt); * |
---|
13 | * if not, write to the Free Software Foundation, Inc., * |
---|
14 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
---|
15 | \***************************************************************/ |
---|
16 | |
---|
17 | $core->addBehavior('publicHeadContent',array('googlestuffPublicBehaviours','publicHeadContent')); |
---|
18 | $core->addBehavior('publicFooterContent',array('googlestuffPublicBehaviours','publicFooterContent')); |
---|
19 | |
---|
20 | |
---|
21 | class googlestuffPublicBehaviours |
---|
22 | { |
---|
23 | public static function publicHeadContent(&$core) |
---|
24 | { |
---|
25 | if ($core->blog->settings->googlestuff_verify != "") { |
---|
26 | $res = '<meta name="verify-v1" content="'.$core->blog->settings->googlestuff_verify.'" />'."\n"; |
---|
27 | echo $res; |
---|
28 | } |
---|
29 | } |
---|
30 | |
---|
31 | public static function publicFooterContent(&$core) |
---|
32 | { |
---|
33 | if ($core->blog->settings->googlestuff_uacct != "") { |
---|
34 | $res = '<script type="text/javascript">'."\n". |
---|
35 | 'var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");'."\n". |
---|
36 | 'document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));'."\n". |
---|
37 | '</script>'."\n". |
---|
38 | '<script type="text/javascript">'."\n". |
---|
39 | 'if (typeof(_gat) != "undefined") {'."\n". |
---|
40 | ' var pageTracker = _gat._getTracker("'. |
---|
41 | $core->blog->settings->googlestuff_uacct. |
---|
42 | '");'."\n". |
---|
43 | ' pageTracker._initData();'."\n". |
---|
44 | ' pageTracker._trackPageview();'."\n". |
---|
45 | '}'."\n". |
---|
46 | '</script>'."\n"; |
---|
47 | echo $res; |
---|
48 | } |
---|
49 | } |
---|
50 | |
---|
51 | } |
---|
52 | ?> |
---|