Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
Tz Tools
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
0cdf8634
authored
2014-10-17 12:13:53 -0400
by
Marty Penner
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Format Analytics.php
1 parent
ef4a1033
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
23 deletions
com/Analytics/Analytics.php
com/Analytics/Analytics.php
View file @
0cdf863
...
...
@@ -9,54 +9,70 @@ const OPTION_NAME = 'tz_analytics';
const
OPTION_GROUP
=
'reading'
;
const
OPTION_SECTION
=
'tz_analytics_main'
;
call_user_func
(
function
()
{
call_user_func
(
function
()
{
Vars
::
$options
=
new
Tools\WP_Option
(
OPTION_NAME
);
Tools\add_actions
(
__NAMESPACE__
.
'\Actions'
);
});
Tools\add_actions
(
__NAMESPACE__
.
'\Actions'
);
}
);
function
validate
(
$data
)
{
function
validate
(
$data
)
{
return
$data
;
}
class
Actions
{
public
static
function
admin_init
()
{
register_setting
(
OPTION_GROUP
,
OPTION_NAME
,
__NAMESPACE__
.
'\validate'
);
add_settings_section
(
OPTION_SECTION
,
'Google Analytics'
,
function
()
{},
OPTION_GROUP
);
class
Actions
{
public
static
function
admin_init
()
{
register_setting
(
OPTION_GROUP
,
OPTION_NAME
,
__NAMESPACE__
.
'\validate'
);
add_settings_section
(
OPTION_SECTION
,
'Google Analytics'
,
function
()
{
},
OPTION_GROUP
);
Tools\add_settings_fields
(
__NAMESPACE__
.
'\Fields'
,
OPTION_GROUP
,
OPTION_SECTION
);
Tools\add_settings_fields
(
__NAMESPACE__
.
'\Fields'
,
OPTION_GROUP
,
OPTION_SECTION
);
}
public
static
function
wp_print_scripts
()
{
public
static
function
wp_print_scripts
()
{
if
(
Tz\LIVE
!==
1
||
empty
(
Vars
::
$options
[
'api_key'
]))
{
return
;
}
?>
<script
type=
"text/javascript"
>
?>
<script
>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '
<?php
echo
Vars
::
$options
[
'api_key'
];
?>
']);
_gaq.push(['
_trackPageview
']);
// _gaq.push(['
_trackEvent
', '
download
', '
Membership
', '
sub
category
?
']);
// _gaq.push(['
_trackEvent
', '
download
', '
Membership
', '
sub
category
?
']);
(function() {
var ga = document.createElement('
script
'); ga.type = '
text
/
javascript
';
(function () {
var ga = document.createElement('
script
');
ga.type = '
text
/
javascript
';
ga.async = true;
ga.src = ('
https
:
' == document.location.protocol ? '
https
:
//ssl' : 'http://www') + '.google-analytics.com/ga.js';
var
s
=
document
.
getElementsByTagName
(
'script'
)[
0
];
s
.
parentNode
.
insertBefore
(
ga
,
s
);
var
s
=
document
.
getElementsByTagName
(
'script'
)[
0
];
s
.
parentNode
.
insertBefore
(
ga
,
s
);
})();
</script>
<?php
</script>
<?php
}
}
class
Fields
{
public
static
function
api_key
()
{
echo
'<input type="text" name="'
.
OPTION_NAME
.
'['
.
__FUNCTION__
.
']" id="'
.
__FUNCTION__
.
'" value="'
.
Vars
::
$options
[
__FUNCTION__
]
.
'" />'
;
class
Fields
{
public
static
function
api_key
()
{
echo
'<input type="text" name="'
.
OPTION_NAME
.
'['
.
__FUNCTION__
.
']" id="'
.
__FUNCTION__
.
'" value="'
.
Vars
::
$options
[
__FUNCTION__
]
.
'" />'
;
}
}
class
Vars
{
class
Vars
{
public
static
$options
;
}
?>
\ No newline at end of file
...
...
Please
register
or
sign in
to post a comment