Version Description
- Ability to hide Google UID dropdown
- Bug fix: rename stats_init to ganalyticator_stats_init
- Bug fix: Moved analyticsSnippet from line 1110 to line 1111
- Bug fix: added condition for empty href reported by @Jesin A http://wordpress.org/support/topic/bug-external-trackingjs-interferes-with-some-themes?replies=1
- Added Polish Translation from @mleczakm http://wordpress.org/support/topic/localization-translation
Download this release
Release Info
Developer | VideoUserManuals |
Plugin | ![]() |
Version | 6.4.7.2 |
Comparing to | |
See all releases |
Code changes from version 6.4.5 to 6.4.7.2
- class.analytics.stats.php +7 -3
- external-tracking.js +25 -6
- external-tracking.min.js +1 -1
- gapro-plugin-advert-sidebar.png +0 -0
- google-analyticator.php +552 -366
- google-analytics-summary-widget.php +4 -4
- google-api-php-client/LICENSE +203 -0
- google-api-php-client/NOTICE +4 -0
- google-api-php-client/README +40 -0
- google-api-php-client/src/Google_Client.php +471 -0
- google-api-php-client/src/auth/Google_AssertionCredentials.php +103 -0
- google-api-php-client/src/auth/Google_Auth.php +36 -0
- google-api-php-client/src/auth/Google_AuthNone.php +48 -0
- google-api-php-client/src/auth/Google_LoginTicket.php +63 -0
- google-api-php-client/src/auth/Google_OAuth2.php +453 -0
- google-api-php-client/src/auth/Google_P12Signer.php +70 -0
- google-api-php-client/src/auth/Google_PemVerifier.php +66 -0
- google-api-php-client/src/auth/Google_Signer.php +30 -0
- google-api-php-client/src/auth/Google_Verifier.php +31 -0
- google-api-php-client/src/cache/Google_ApcCache.php +98 -0
- google-api-php-client/src/cache/Google_Cache.php +55 -0
- google-api-php-client/src/cache/Google_FileCache.php +137 -0
- google-api-php-client/src/cache/Google_MemcacheCache.php +130 -0
- google-api-php-client/src/config.php +81 -0
- google-api-php-client/src/contrib/Google_AdExchangeSellerService.php +1262 -0
- google-api-php-client/src/contrib/Google_AdexchangebuyerService.php +705 -0
- google-api-php-client/src/contrib/Google_AdsensehostService.php +1376 -0
- google-api-php-client/src/contrib/Google_AnalyticsService.php +4336 -0
- google-api-php-client/src/contrib/Google_AndroidpublisherService.php +198 -0
- google-api-php-client/src/contrib/Google_AppstateService.php +253 -0
- google-api-php-client/src/contrib/Google_AuditService.php +274 -0
- google-api-php-client/src/contrib/Google_BigqueryService.php +2011 -0
- google-api-php-client/src/contrib/Google_BloggerService.php +1389 -0
- google-api-php-client/src/contrib/Google_BooksService.php +3491 -0
- google-api-php-client/src/contrib/Google_CalendarService.php +1971 -0
- google-api-php-client/src/contrib/Google_CivicInfoService.php +778 -0
- google-api-php-client/src/contrib/Google_ComputeService.php +4403 -0
- google-api-php-client/src/contrib/Google_CoordinateService.php +842 -0
- google-api-php-client/src/contrib/Google_CustomsearchService.php +837 -0
- google-api-php-client/src/contrib/Google_DatastoreService.php +998 -0
- google-api-php-client/src/contrib/Google_DfareportingService.php +1986 -0
- google-api-php-client/src/contrib/Google_DirectoryService.php +2263 -0
- google-api-php-client/src/contrib/Google_DriveService.php +3381 -0
- google-api-php-client/src/contrib/Google_FreebaseService.php +388 -0
- google-api-php-client/src/contrib/Google_FusiontablesService.php +1388 -0
- google-api-php-client/src/contrib/Google_GamesManagementService.php +384 -0
- google-api-php-client/src/contrib/Google_GamesService.php +2467 -0
- google-api-php-client/src/contrib/Google_GanService.php +1827 -0
- google-api-php-client/src/contrib/Google_GroupssettingsService.php +299 -0
- google-api-php-client/src/contrib/Google_LatitudeService.php +283 -0
- google-api-php-client/src/contrib/Google_LicensingService.php +286 -0
- google-api-php-client/src/contrib/Google_MirrorService.php +1203 -0
- google-api-php-client/src/contrib/Google_ModeratorService.php +1888 -0
- google-api-php-client/src/contrib/Google_Oauth2Service.php +272 -0
- google-api-php-client/src/contrib/Google_OrkutService.php +2540 -0
- google-api-php-client/src/contrib/Google_PagespeedonlineService.php +516 -0
- google-api-php-client/src/contrib/Google_PlusDomainsService.php +2508 -0
- google-api-php-client/src/contrib/Google_PlusMomentsService.php +567 -0
- google-api-php-client/src/contrib/Google_PlusService.php +2429 -0
- google-api-php-client/src/contrib/Google_PredictionService.php +836 -0
- google-api-php-client/src/contrib/Google_ReportsService.php +545 -0
- google-api-php-client/src/contrib/Google_ResellerService.php +700 -0
- google-api-php-client/src/contrib/Google_SQLAdminService.php +1081 -0
- google-api-php-client/src/contrib/Google_ShoppingService.php +1408 -0
- google-api-php-client/src/contrib/Google_SiteVerificationService.php +288 -0
- google-api-php-client/src/contrib/Google_StorageService.php +1718 -0
- google-api-php-client/src/contrib/Google_TaskqueueService.php +430 -0
- google-api-php-client/src/contrib/Google_TasksService.php +580 -0
- google-api-php-client/src/contrib/Google_TranslateService.php +243 -0
- google-api-php-client/src/contrib/Google_UrlshortenerService.php +326 -0
- google-api-php-client/src/contrib/Google_WebfontsService.php +153 -0
- google-api-php-client/src/contrib/Google_YouTubeAnalyticsService.php +141 -0
- google-api-php-client/src/external/URITemplateParser.php +212 -0
- google-api-php-client/src/io/Google_CacheParser.php +173 -0
- google-api-php-client/src/io/Google_CurlIO.php +198 -0
- google-api-php-client/src/io/Google_HttpRequest.php +304 -0
- google-api-php-client/src/io/Google_HttpStreamIO.php +170 -0
- google-api-php-client/src/io/Google_IO.php +161 -0
- google-api-php-client/src/io/Google_REST.php +128 -0
- google-api-php-client/src/io/cacerts.pem +738 -0
- google-api-php-client/src/local_config.php +81 -0
- google-api-php-client/src/service/Google_BatchRequest.php +110 -0
- google-api-php-client/src/service/Google_MediaFileUpload.php +262 -0
- google-api-php-client/src/service/Google_Model.php +115 -0
- google-api-php-client/src/service/Google_Service.php +22 -0
- google-api-php-client/src/service/Google_ServiceResource.php +205 -0
- google-api-php-client/src/service/Google_Utils.php +117 -0
- google-api-php-client/static/Credentials.png +0 -0
- jquery.sparkline.min.js +84 -84
- localizations/google-analyticator-pl_PL.mo +0 -0
- localizations/google-analyticator-pl_PL.po +623 -0
- readme.txt +24 -4
class.analytics.stats.php
CHANGED
@@ -5,8 +5,12 @@ if ( !class_exists('SimplePie') ) {
|
|
5 |
require_once (ABSPATH . WPINC . '/class-feed.php');
|
6 |
}
|
7 |
|
8 |
-
|
9 |
-
require_once 'google-api-php-client/src/
|
|
|
|
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
* Handles interactions with Google Analytics' Stat API
|
@@ -35,7 +39,7 @@ class GoogleAnalyticsStats
|
|
35 |
$this->client->setClientSecret(GOOGLE_ANALYTICATOR_CLIENTSECRET);
|
36 |
$this->client->setRedirectUri(GOOGLE_ANALYTICATOR_REDIRECT);
|
37 |
|
38 |
-
$this->client->setScopes(array
|
39 |
|
40 |
// Magic. Returns objects from the Analytics Service instead of associative arrays.
|
41 |
$this->client->setUseObjects(true);
|
5 |
require_once (ABSPATH . WPINC . '/class-feed.php');
|
6 |
}
|
7 |
|
8 |
+
if ( !class_exists('Google_Client') ) {
|
9 |
+
require_once 'google-api-php-client/src/Google_Client.php';
|
10 |
+
}
|
11 |
+
if ( !class_exists('Google_AnalyticsService') ) {
|
12 |
+
require_once 'google-api-php-client/src/contrib/Google_AnalyticsService.php';
|
13 |
+
}
|
14 |
|
15 |
/**
|
16 |
* Handles interactions with Google Analytics' Stat API
|
39 |
$this->client->setClientSecret(GOOGLE_ANALYTICATOR_CLIENTSECRET);
|
40 |
$this->client->setRedirectUri(GOOGLE_ANALYTICATOR_REDIRECT);
|
41 |
|
42 |
+
$this->client->setScopes(array("https://www.googleapis.com/auth/analytics"));
|
43 |
|
44 |
// Magic. Returns objects from the Analytics Service instead of associative arrays.
|
45 |
$this->client->setUseObjects(true);
|
external-tracking.js
CHANGED
@@ -5,7 +5,7 @@ jQuery(document).ready(function() {
|
|
5 |
var href = a.attr('href');
|
6 |
|
7 |
// Check if the a tag has a href, if not, stop for the current link
|
8 |
-
if ( href == undefined
|
9 |
return;
|
10 |
|
11 |
var url = href.replace('http://','').replace('https://','');
|
@@ -24,9 +24,18 @@ jQuery(document).ready(function() {
|
|
24 |
// Add the tracking code
|
25 |
a.click(function() {
|
26 |
if ( analyticsEventTracking == 'enabled' ) {
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
});
|
31 |
}
|
32 |
}
|
@@ -35,9 +44,19 @@ jQuery(document).ready(function() {
|
|
35 |
// Add the tracking code
|
36 |
a.click(function() {
|
37 |
if ( analyticsEventTracking == 'enabled' ) {
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
39 |
} else
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
41 |
});
|
42 |
}
|
43 |
});
|
5 |
var href = a.attr('href');
|
6 |
|
7 |
// Check if the a tag has a href, if not, stop for the current link
|
8 |
+
if ( href == undefined || href =="")
|
9 |
return;
|
10 |
|
11 |
var url = href.replace('http://','').replace('https://','');
|
24 |
// Add the tracking code
|
25 |
a.click(function() {
|
26 |
if ( analyticsEventTracking == 'enabled' ) {
|
27 |
+
if(analyticsSnippet == 'enabled'){
|
28 |
+
_gaq.push(['_trackEvent', 'Downloads', extension.toUpperCase(), href]);
|
29 |
+
}else{
|
30 |
+
ga('send', 'event', 'Downloads', extension.toUpperCase(), href);
|
31 |
+
}
|
32 |
+
} else{
|
33 |
+
if(analyticsSnippet == 'enabled'){
|
34 |
+
_gaq.push(['_trackPageview', analyticsDownloadsPrefix + url]);
|
35 |
+
}else{
|
36 |
+
ga('send', 'pageview', analyticsDownloadsPrefix + url);
|
37 |
+
}
|
38 |
+
}
|
39 |
});
|
40 |
}
|
41 |
}
|
44 |
// Add the tracking code
|
45 |
a.click(function() {
|
46 |
if ( analyticsEventTracking == 'enabled' ) {
|
47 |
+
if(analyticsSnippet == 'enabled'){
|
48 |
+
_gaq.push(['_trackEvent', 'Outbound Traffic', href.match(/:\/\/(.[^/]+)/)[1], href]);
|
49 |
+
}else{
|
50 |
+
ga('send', 'event', 'Outbound Traffic', href.match(/:\/\/(.[^/]+)/)[1], href);
|
51 |
+
|
52 |
+
}
|
53 |
} else
|
54 |
+
if(analyticsSnippet == 'enabled'){
|
55 |
+
_gaq.push(['_trackPageview', analyticsOutboundPrefix + url]);
|
56 |
+
}else{
|
57 |
+
ga('send', 'pageview', analyticsOutboundPrefix + url);
|
58 |
+
|
59 |
+
}
|
60 |
});
|
61 |
}
|
62 |
});
|
external-tracking.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(){jQuery("a").each(function(){var e=jQuery(this);var t=e.attr("href");if(t==undefined
|
1 |
+
jQuery(document).ready(function(){jQuery("a").each(function(){var e=jQuery(this);var t=e.attr("href");if(t==undefined||t=="")return;var n=t.replace("http://","").replace("https://","");var r=t.split(".").reverse();var i=r[0].toLowerCase();var r=t.split("/").reverse();var s=r[2];var o=false;if(typeof analyticsFileTypes!="undefined"){if(jQuery.inArray(i,analyticsFileTypes)!=-1){o=true;e.click(function(){if(analyticsEventTracking=="enabled"){if(analyticsSnippet=="enabled"){_gaq.push(["_trackEvent","Downloads",i.toUpperCase(),t])}else{ga("send","event","Downloads",i.toUpperCase(),t)}}else{if(analyticsSnippet=="enabled"){_gaq.push(["_trackPageview",analyticsDownloadsPrefix+n])}else{ga("send","pageview",analyticsDownloadsPrefix+n)}}})}}if(t.match(/^http/)&&!t.match(document.domain)&&o==false){e.click(function(){if(analyticsEventTracking=="enabled"){if(analyticsSnippet=="enabled"){_gaq.push(["_trackEvent","Outbound Traffic",t.match(/:\/\/(.[^/]+)/)[1],t])}else{ga("send","event","Outbound Traffic",t.match(/:\/\/(.[^/]+)/)[1],t)}}else if(analyticsSnippet=="enabled"){_gaq.push(["_trackPageview",analyticsOutboundPrefix+n])}else{ga("send","pageview",analyticsOutboundPrefix+n)}})}})})
|
gapro-plugin-advert-sidebar.png
CHANGED
Binary file
|
google-analyticator.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
* Plugin Name: Google Analyticator
|
4 |
-
* Version: 6.4.
|
5 |
* Plugin URI: http://www.videousermanuals.com/google-analyticator/?utm_campaign=analyticator&utm_medium=plugin&utm_source=readme-txt
|
6 |
* Description: Adds the necessary JavaScript code to enable <a href="http://www.google.com/analytics/">Google's Analytics</a>. After enabling this plugin you need to authenticate with Google, then select your domain and you're set.
|
7 |
* Author: Video User Manuals Pty Ltd
|
@@ -9,12 +9,12 @@
|
|
9 |
* Text Domain: google-analyticator
|
10 |
*/
|
11 |
|
12 |
-
define('GOOGLE_ANALYTICATOR_VERSION', '6.4.
|
13 |
|
14 |
define('GOOGLE_ANALYTICATOR_CLIENTID', '1007949979410.apps.googleusercontent.com');
|
15 |
define('GOOGLE_ANALYTICATOR_CLIENTSECRET', 'q06U41XDXtzaXD14E-KO1hti'); //don't worry - this don't need to be secret in our case
|
16 |
define('GOOGLE_ANALYTICATOR_REDIRECT', 'urn:ietf:wg:oauth:2.0:oob');
|
17 |
-
define('GOOGLE_ANALYTICATOR_SCOPE', 'https://www.googleapis.com/auth/analytics
|
18 |
|
19 |
// Constants for enabled/disabled state
|
20 |
define("ga_enabled", "enabled", true);
|
@@ -23,8 +23,11 @@ define("ga_disabled", "disabled", true);
|
|
23 |
// Defaults, etc.
|
24 |
define("key_ga_uid", "ga_uid", true);
|
25 |
define("key_ga_status", "ga_status", true);
|
|
|
|
|
26 |
define("key_ga_admin", "ga_admin_status", true);
|
27 |
define("key_ga_admin_disable", "ga_admin_disable", true);
|
|
|
28 |
define("key_ga_remarketing", 'ga_enable_remarketing', true );
|
29 |
define("key_ga_track_login", "key_ga_track_login", true );
|
30 |
define("key_ga_show_ad", "key_ga_show_ad", true );
|
@@ -36,6 +39,7 @@ define("key_ga_extra_after", "ga_extra_after", true);
|
|
36 |
define("key_ga_event", "ga_event", true);
|
37 |
define("key_ga_outbound", "ga_outbound", true);
|
38 |
define("key_ga_outbound_prefix", "ga_outbound_prefix", true);
|
|
|
39 |
define("key_ga_downloads", "ga_downloads", true);
|
40 |
define("key_ga_downloads_prefix", "ga_downloads_prefix", true);
|
41 |
define("key_ga_widgets", "ga_widgets", true);
|
@@ -43,8 +47,11 @@ define("key_ga_annon", "ga_annon", true);
|
|
43 |
|
44 |
define("ga_uid_default", "UA-XXXXXXXX-X", true);
|
45 |
define("ga_google_token_default", "", true);
|
|
|
|
|
46 |
define("ga_status_default", ga_disabled, true);
|
47 |
define("ga_admin_default", ga_enabled, true);
|
|
|
48 |
define("ga_admin_disable_default", 'remove', true);
|
49 |
define("ga_adsense_default", "", true);
|
50 |
define("ga_extra_default", "", true);
|
@@ -52,6 +59,7 @@ define("ga_extra_after_default", "", true);
|
|
52 |
define("ga_event_default", ga_enabled, true);
|
53 |
define("ga_outbound_default", ga_enabled, true);
|
54 |
define("ga_outbound_prefix_default", 'outgoing', true);
|
|
|
55 |
define("ga_downloads_default", "", true);
|
56 |
define("ga_downloads_prefix_default", "download", true);
|
57 |
define("ga_widgets_default", ga_enabled, true);
|
@@ -59,8 +67,11 @@ define("ga_widgets_default", ga_enabled, true);
|
|
59 |
// Create the default key and status
|
60 |
add_option( 'ga_version', GOOGLE_ANALYTICATOR_VERSION );
|
61 |
add_option(key_ga_status, ga_status_default, '');
|
|
|
|
|
62 |
add_option(key_ga_uid, ga_uid_default, '');
|
63 |
add_option(key_ga_admin, ga_admin_default, '');
|
|
|
64 |
add_option(key_ga_admin_disable, ga_admin_disable_default, '');
|
65 |
add_option(key_ga_admin_role, array('administrator'), '');
|
66 |
add_option(key_ga_dashboard_role, array('administrator'), '');
|
@@ -71,6 +82,7 @@ add_option(key_ga_extra_after, ga_extra_after_default, '');
|
|
71 |
add_option(key_ga_event, ga_event_default, '');
|
72 |
add_option(key_ga_outbound, ga_outbound_default, '');
|
73 |
add_option(key_ga_outbound_prefix, ga_outbound_prefix_default, '');
|
|
|
74 |
add_option(key_ga_downloads, ga_downloads_default, '');
|
75 |
add_option(key_ga_downloads_prefix, ga_downloads_prefix_default, '');
|
76 |
add_option(key_ga_widgets, ga_widgets_default, '');
|
@@ -79,8 +91,8 @@ add_option('ga_defaults', 'yes' );
|
|
79 |
add_option('ga_google_token', '', '');
|
80 |
|
81 |
$useAuth = ( get_option( 'ga_google_token' ) == '' ? false : true );
|
82 |
-
|
83 |
-
|
84 |
# Check if we have a version of WordPress greater than 2.8
|
85 |
if ( function_exists('register_widget') ) {
|
86 |
|
@@ -100,13 +112,23 @@ if ( function_exists('register_widget') ) {
|
|
100 |
|
101 |
// Create a option page for settings
|
102 |
add_action('admin_init', 'ga_admin_init');
|
|
|
|
|
103 |
add_action('admin_menu', 'add_ga_option_page');
|
104 |
|
|
|
|
|
|
|
|
|
105 |
// Initialize the options
|
106 |
function ga_admin_init() {
|
|
|
|
|
|
|
107 |
# Load the localization information
|
108 |
$plugin_dir = basename(dirname(__FILE__));
|
109 |
load_plugin_textdomain('google-analyticator', 'wp-content/plugins/' . $plugin_dir . '/localizations', $plugin_dir . '/localizations');
|
|
|
110 |
}
|
111 |
|
112 |
# Add the core Google Analytics script, with a high priority to ensure last script for async tracking
|
@@ -118,17 +140,19 @@ if( get_option( key_ga_track_login ) )
|
|
118 |
|
119 |
# Initialize outbound link tracking
|
120 |
add_action('init', 'ga_outgoing_links');
|
|
|
|
|
121 |
|
122 |
// Hook in the options page function
|
123 |
function add_ga_option_page() {
|
124 |
|
125 |
-
$plugin_page = add_options_page(__('Google Analyticator Settings', 'google-analyticator'), 'Google Analytics', 'manage_options', basename(__FILE__), 'ga_options_page');
|
126 |
-
add_action('load-'.$plugin_page, 'ga_pre_load' );
|
127 |
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
132 |
add_action('load-'.$reset_page, 'ga_do_reset' );
|
133 |
|
134 |
}
|
@@ -138,6 +162,8 @@ add_action('plugin_action_links_' . plugin_basename(__FILE__), 'ga_filter_plugin
|
|
138 |
function ga_pre_load()
|
139 |
{
|
140 |
|
|
|
|
|
141 |
if( isset( $_POST['key_ga_google_token'] ) ):
|
142 |
|
143 |
check_admin_referer('google-analyticator-update_settings');
|
@@ -176,9 +202,8 @@ if (! function_exists('http_build_query')) {
|
|
176 |
print('Google PHP API Client requires http_build_query()');
|
177 |
return;
|
178 |
}
|
179 |
-
|
180 |
$url = http_build_query( array(
|
181 |
-
'next' =>
|
182 |
'scope' => GOOGLE_ANALYTICATOR_SCOPE,
|
183 |
'response_type'=>'code',
|
184 |
'redirect_uri'=>GOOGLE_ANALYTICATOR_REDIRECT,
|
@@ -187,56 +212,44 @@ $url = http_build_query( array(
|
|
187 |
);
|
188 |
|
189 |
?>
|
190 |
-
<div class="wrap">
|
191 |
-
|
192 |
-
<h2>Activate Google Analyticator</h2>
|
193 |
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
<p>
|
199 |
-
<a
|
200 |
onclick="window.open('https://accounts.google.com/o/oauth2/auth?<?php echo $url ?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"
|
201 |
target="_blank"
|
202 |
-
href="javascript:void(0);"> Click Here </a> - <small> Or <a target="_blank" href="https://accounts.google.com/o/oauth2/auth?<?php echo $url ?>">here</a> if you have popups blocked</small>
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
<input type="submit" value="Continue Without Authentication" />
|
227 |
-
</form>
|
228 |
-
|
229 |
-
|
230 |
-
</div>
|
231 |
-
|
232 |
-
<?php
|
233 |
}
|
234 |
|
235 |
// Add settings option
|
236 |
function ga_filter_plugin_actions($links) {
|
237 |
$new_links = array();
|
238 |
|
239 |
-
$new_links[] = '<a href="' .
|
240 |
$new_links[] = '<a href="' . admin_url('options-general.php?page=ga_reset">') . __('Reset', 'google-analyticator') . '</a>';
|
241 |
|
242 |
return array_merge($new_links, $links);
|
@@ -248,6 +261,8 @@ function ga_do_reset()
|
|
248 |
|
249 |
// Delete all GA options.
|
250 |
delete_option(key_ga_status);
|
|
|
|
|
251 |
delete_option(key_ga_uid);
|
252 |
delete_option(key_ga_admin);
|
253 |
delete_option(key_ga_admin_disable);
|
@@ -259,6 +274,7 @@ function ga_do_reset()
|
|
259 |
delete_option(key_ga_event);
|
260 |
delete_option(key_ga_outbound);
|
261 |
delete_option(key_ga_outbound_prefix);
|
|
|
262 |
delete_option(key_ga_downloads);
|
263 |
delete_option(key_ga_downloads_prefix);
|
264 |
delete_option(key_ga_widgets);
|
@@ -278,7 +294,9 @@ function ga_do_reset()
|
|
278 |
|
279 |
function ga_reset(){ /* Wont ever run. */ }
|
280 |
|
281 |
-
|
|
|
|
|
282 |
function ga_options_page() {
|
283 |
|
284 |
// If we are a postback, store the options
|
@@ -295,6 +313,21 @@ function ga_options_page() {
|
|
295 |
$ga_status = ga_status_default;
|
296 |
update_option(key_ga_status, $ga_status);
|
297 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
// Update the UID
|
299 |
$ga_uid = wp_filter_kses( $_POST[key_ga_uid] );
|
300 |
if ($ga_uid == '')
|
@@ -307,6 +340,13 @@ function ga_options_page() {
|
|
307 |
$ga_admin = ga_admin_default;
|
308 |
update_option(key_ga_admin, wp_filter_kses( $ga_admin ) );
|
309 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
// Update the admin disable setting
|
311 |
$ga_admin_disable = wp_filter_kses( $_POST[key_ga_admin_disable] );
|
312 |
if ( $ga_admin_disable == '' )
|
@@ -327,6 +367,7 @@ function ga_options_page() {
|
|
327 |
} else {
|
328 |
$ga_dashboard_role = "";
|
329 |
}
|
|
|
330 |
update_option(key_ga_dashboard_role, $ga_dashboard_role );
|
331 |
|
332 |
// Update the extra tracking code
|
@@ -345,101 +386,98 @@ function ga_options_page() {
|
|
345 |
$ga_event = $_POST[key_ga_event];
|
346 |
if (($ga_event != ga_enabled) && ($ga_event != ga_disabled))
|
347 |
$ga_event = ga_event_default;
|
348 |
-
|
349 |
|
350 |
// Update the outbound tracking
|
351 |
$ga_outbound = $_POST[key_ga_outbound];
|
352 |
if (($ga_outbound != ga_enabled) && ($ga_outbound != ga_disabled))
|
353 |
$ga_outbound = ga_outbound_default;
|
354 |
-
|
355 |
|
356 |
// Update the outbound prefix
|
357 |
$ga_outbound_prefix = $_POST[key_ga_outbound_prefix];
|
358 |
if ($ga_outbound_prefix == '')
|
359 |
$ga_outbound_prefix = ga_outbound_prefix_default;
|
360 |
-
|
361 |
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
// Update the download prefix
|
367 |
$ga_downloads_prefix = $_POST[key_ga_downloads_prefix];
|
368 |
if ($ga_downloads_prefix == '')
|
369 |
$ga_downloads_prefix = ga_downloads_prefix_default;
|
370 |
-
|
371 |
|
372 |
// Update the widgets option
|
373 |
$ga_widgets = $_POST[key_ga_widgets];
|
374 |
if (($ga_widgets != ga_enabled) && ($ga_widgets != ga_disabled))
|
375 |
-
$ga_widgets = ga_widgets_default;
|
376 |
-
update_option(key_ga_widgets, wp_filter_kses( $ga_widgets ) );
|
377 |
|
378 |
-
|
379 |
-
|
|
|
|
|
|
|
380 |
|
381 |
// Update enable remarketing
|
382 |
update_option(key_ga_remarketing, wp_filter_kses( $_POST[key_ga_remarketing] ) );
|
383 |
|
384 |
// Update key_ga_hide_ad
|
385 |
update_option(key_ga_show_ad, wp_filter_kses( $_POST[key_ga_show_ad] ) );
|
386 |
-
|
387 |
// Update enable tracking login
|
388 |
-
update_option(key_ga_track_login, wp_filter_kses( $_POST[key_ga_track_login] ) );
|
389 |
-
|
390 |
-
|
391 |
// Give an updated message
|
392 |
echo "<div class='updated fade'><p><strong>" . __('Google Analyticator settings saved.', 'google-analyticator') . "</strong></p></div>";
|
393 |
}
|
394 |
-
|
395 |
-
|
396 |
// Are we using the auth system?
|
397 |
$useAuth = ( get_option( 'ga_google_token' ) == '' ? false : true );
|
398 |
-
|
399 |
-
|
400 |
-
// Output the options page
|
401 |
?>
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
<h2><?php _e('Google Analyticator Settings', 'google-analyticator'); ?></h2>
|
406 |
-
<form method="post" action="<?php echo admin_url('options-general.php?page=google-analyticator.php');?>">
|
407 |
-
<?php
|
408 |
# Add a nonce
|
409 |
wp_nonce_field('google-analyticator-update_settings');
|
410 |
?>
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
<?php
|
443 |
echo "<select name='".key_ga_status."' id='".key_ga_status."'>\n";
|
444 |
|
445 |
echo "<option value='".ga_enabled."'";
|
@@ -454,55 +492,91 @@ function ga_options_page() {
|
|
454 |
|
455 |
echo "</select>\n";
|
456 |
?>
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
|
474 |
-
|
|
|
|
|
|
|
475 |
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
elseif( ( $_SERVER['HTTP_HOST'] == $domain ) && ( ! $hasSelected ) ) { $hasSelected=true; echo ' selected="selected"'; }
|
481 |
-
echo '>'.$domain.'</option>';
|
482 |
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
<label for="<?php echo key_ga_admin ?>"><?php _e('Track all logged in WordPress users', 'google-analyticator'); ?>:</label>
|
503 |
-
</th>
|
504 |
-
<td>
|
505 |
-
<?php
|
506 |
echo "<select name='".key_ga_admin."' id='".key_ga_admin."'>\n";
|
507 |
|
508 |
echo "<option value='".ga_enabled."'";
|
@@ -518,15 +592,16 @@ function ga_options_page() {
|
|
518 |
echo "</select>\n";
|
519 |
|
520 |
?>
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
|
|
530 |
echo "<select name='".key_ga_annon."' id='".key_ga_annon."'>\n";
|
531 |
|
532 |
echo "<option value='0'";
|
@@ -542,15 +617,16 @@ function ga_options_page() {
|
|
542 |
echo "</select>\n";
|
543 |
|
544 |
?>
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
|
|
554 |
global $wp_roles;
|
555 |
$roles = $wp_roles->get_names();
|
556 |
$selected_roles = get_option(key_ga_admin_role);
|
@@ -566,15 +642,16 @@ function ga_options_page() {
|
|
566 |
echo ' /> ' . _x($name, 'User role') . '<br />';
|
567 |
}
|
568 |
?>
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
|
|
578 |
echo "<select name='".key_ga_admin_disable."' id='".key_ga_admin_disable."'>\n";
|
579 |
|
580 |
echo "<option value='remove'";
|
@@ -589,15 +666,19 @@ function ga_options_page() {
|
|
589 |
|
590 |
echo "</select>\n";
|
591 |
?>
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
|
|
|
|
|
|
|
|
601 |
echo "<select name='".key_ga_remarketing."' id='".key_ga_remarketing."'>\n";
|
602 |
|
603 |
echo "<option value='0'";
|
@@ -615,15 +696,20 @@ function ga_options_page() {
|
|
615 |
echo "</select>\n";
|
616 |
|
617 |
?>
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
|
|
|
|
|
|
|
|
|
|
627 |
echo "<select name='".key_ga_track_login."' id='".key_ga_track_login."'>\n";
|
628 |
|
629 |
echo "<option value='1'";
|
@@ -639,20 +725,19 @@ function ga_options_page() {
|
|
639 |
echo "</select>\n";
|
640 |
|
641 |
?>
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
<?php
|
656 |
echo "<select name='".key_ga_outbound."' id='".key_ga_outbound."'>\n";
|
657 |
|
658 |
echo "<option value='".ga_enabled."'";
|
@@ -667,15 +752,16 @@ function ga_options_page() {
|
|
667 |
|
668 |
echo "</select>\n";
|
669 |
?>
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
|
|
679 |
echo "<select name='".key_ga_event."' id='".key_ga_event."'>\n";
|
680 |
|
681 |
echo "<option value='".ga_enabled."'";
|
@@ -690,114 +776,146 @@ function ga_options_page() {
|
|
690 |
|
691 |
echo "</select>\n";
|
692 |
?>
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
702 |
echo "<input type='text' size='50' ";
|
703 |
echo "name='".key_ga_downloads."' ";
|
704 |
echo "id='".key_ga_downloads."' ";
|
705 |
echo "value='".wp_filter_kses(get_option(key_ga_downloads))."' />\n";
|
706 |
?>
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
|
|
716 |
echo "<input type='text' size='50' ";
|
717 |
echo "name='".key_ga_outbound_prefix."' ";
|
718 |
echo "id='".key_ga_outbound_prefix."' ";
|
719 |
echo "value='". stripslashes( wp_filter_kses(get_option(key_ga_outbound_prefix)))."' />\n";
|
720 |
?>
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
|
|
730 |
echo "<input type='text' size='50' ";
|
731 |
echo "name='".key_ga_downloads_prefix."' ";
|
732 |
echo "id='".key_ga_downloads_prefix."' ";
|
733 |
echo "value='".stripslashes(wp_filter_kses ( get_option(key_ga_downloads_prefix) ))."' />\n";
|
734 |
?>
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
|
|
744 |
echo "<input type='text' size='50' ";
|
745 |
echo "name='".key_ga_adsense."' ";
|
746 |
echo "id='".key_ga_adsense."' ";
|
747 |
echo "value='".get_option(key_ga_adsense)."' />\n";
|
748 |
?>
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
|
|
|
|
763 |
echo "<textarea cols='50' rows='8' ";
|
764 |
echo "name='".key_ga_extra."' ";
|
765 |
echo "id='".key_ga_extra."'>";
|
766 |
echo stripslashes(get_option(key_ga_extra))."</textarea>\n";
|
767 |
?>
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
|
|
|
|
|
|
|
|
777 |
echo "<textarea cols='50' rows='8' ";
|
778 |
echo "name='".key_ga_extra_after."' ";
|
779 |
echo "id='".key_ga_extra_after."'>";
|
780 |
echo stripslashes(get_option(key_ga_extra_after))."</textarea>\n";
|
781 |
?>
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
<td>
|
800 |
-
<?php
|
801 |
echo "<select name='".key_ga_widgets."' id='".key_ga_widgets."'>\n";
|
802 |
|
803 |
echo "<option value='".ga_enabled."'";
|
@@ -812,16 +930,16 @@ function ga_options_page() {
|
|
812 |
|
813 |
echo "</select>\n";
|
814 |
?>
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
echo "<select name='".key_ga_show_ad."' id='".key_ga_show_ad."'>\n";
|
826 |
|
827 |
echo "<option value='1'";
|
@@ -836,17 +954,16 @@ function ga_options_page() {
|
|
836 |
|
837 |
echo "</select>\n";
|
838 |
?>
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
<?php
|
850 |
global $wp_roles;
|
851 |
$roles = $wp_roles->get_names();
|
852 |
$selected_roles = get_option(key_ga_dashboard_role);
|
@@ -862,22 +979,23 @@ function ga_options_page() {
|
|
862 |
echo ' /> ' . _x($name, 'User role') . '<br />';
|
863 |
}
|
864 |
?>
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
|
|
881 |
|
882 |
<?php
|
883 |
}
|
@@ -895,8 +1013,6 @@ function ga_get_analytics_accounts()
|
|
895 |
{
|
896 |
$accounts = array();
|
897 |
|
898 |
-
# Get the class for interacting with the Google Analytics
|
899 |
-
require_once('class.analytics.stats.php');
|
900 |
|
901 |
# Create a new Gdata call
|
902 |
if ( isset($_POST['token']) && $_POST['token'] != '' )
|
@@ -978,36 +1094,36 @@ function add_google_analytics()
|
|
978 |
$ext = "";
|
979 |
foreach ( $extensions AS $extension )
|
980 |
$ext .= "'$extension',";
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
$need_to_annon = get_option(key_ga_annon);
|
990 |
-
|
991 |
-
|
992 |
?>
|
993 |
<script type="text/javascript">
|
994 |
-
|
995 |
-
<?php if ( $event_tracking != 'enabled' ) { ?>
|
996 |
-
|
997 |
-
|
998 |
-
<?php } ?>
|
999 |
-
|
1000 |
-
|
|
|
1001 |
<?php
|
1002 |
# Add the first part of the core tracking code
|
1003 |
?>
|
1004 |
<script type="text/javascript">
|
|
|
1005 |
var _gaq = _gaq || [];
|
|
|
|
|
|
|
|
|
1006 |
_gaq.push(['_setAccount', '<?php echo $uid; ?>']);
|
1007 |
-
|
1008 |
-
<?php if ($need_to_annon == '1' ): ?>
|
1009 |
-
_gaq.push(['_gat._anonymizeIp']);
|
1010 |
-
<?php endif; ?>
|
1011 |
<?php
|
1012 |
|
1013 |
# Add any tracking code before the trackPageview
|
@@ -1039,6 +1155,36 @@ function add_google_analytics()
|
|
1039 |
<?php endif; ?>
|
1040 |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
1041 |
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1042 |
</script>
|
1043 |
<?php
|
1044 |
}
|
@@ -1107,3 +1253,43 @@ function ga_current_user_is($roles)
|
|
1107 |
|
1108 |
return false;
|
1109 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
/*
|
3 |
* Plugin Name: Google Analyticator
|
4 |
+
* Version: 6.4.7.2
|
5 |
* Plugin URI: http://www.videousermanuals.com/google-analyticator/?utm_campaign=analyticator&utm_medium=plugin&utm_source=readme-txt
|
6 |
* Description: Adds the necessary JavaScript code to enable <a href="http://www.google.com/analytics/">Google's Analytics</a>. After enabling this plugin you need to authenticate with Google, then select your domain and you're set.
|
7 |
* Author: Video User Manuals Pty Ltd
|
9 |
* Text Domain: google-analyticator
|
10 |
*/
|
11 |
|
12 |
+
define('GOOGLE_ANALYTICATOR_VERSION', '6.4.7.2');
|
13 |
|
14 |
define('GOOGLE_ANALYTICATOR_CLIENTID', '1007949979410.apps.googleusercontent.com');
|
15 |
define('GOOGLE_ANALYTICATOR_CLIENTSECRET', 'q06U41XDXtzaXD14E-KO1hti'); //don't worry - this don't need to be secret in our case
|
16 |
define('GOOGLE_ANALYTICATOR_REDIRECT', 'urn:ietf:wg:oauth:2.0:oob');
|
17 |
+
define('GOOGLE_ANALYTICATOR_SCOPE', 'https://www.googleapis.com/auth/analytics');//.readonly
|
18 |
|
19 |
// Constants for enabled/disabled state
|
20 |
define("ga_enabled", "enabled", true);
|
23 |
// Defaults, etc.
|
24 |
define("key_ga_uid", "ga_uid", true);
|
25 |
define("key_ga_status", "ga_status", true);
|
26 |
+
define("key_ga_disable_gasites", "ga_disable_gasites", true);
|
27 |
+
define("key_ga_analytic_snippet", "ga_analytic_snippet", true);
|
28 |
define("key_ga_admin", "ga_admin_status", true);
|
29 |
define("key_ga_admin_disable", "ga_admin_disable", true);
|
30 |
+
define("key_ga_admin_disable_DimentionIndex", "ga_admin_disable_DimentionIndex", true);
|
31 |
define("key_ga_remarketing", 'ga_enable_remarketing', true );
|
32 |
define("key_ga_track_login", "key_ga_track_login", true );
|
33 |
define("key_ga_show_ad", "key_ga_show_ad", true );
|
39 |
define("key_ga_event", "ga_event", true);
|
40 |
define("key_ga_outbound", "ga_outbound", true);
|
41 |
define("key_ga_outbound_prefix", "ga_outbound_prefix", true);
|
42 |
+
define("key_ga_enhanced_link_attr", "ga_enhanced_link_attr", true);
|
43 |
define("key_ga_downloads", "ga_downloads", true);
|
44 |
define("key_ga_downloads_prefix", "ga_downloads_prefix", true);
|
45 |
define("key_ga_widgets", "ga_widgets", true);
|
47 |
|
48 |
define("ga_uid_default", "UA-XXXXXXXX-X", true);
|
49 |
define("ga_google_token_default", "", true);
|
50 |
+
define("ga_disable_gasites_default", ga_disabled, true);
|
51 |
+
define("ga_analytic_snippet_default", ga_enabled, true);
|
52 |
define("ga_status_default", ga_disabled, true);
|
53 |
define("ga_admin_default", ga_enabled, true);
|
54 |
+
define("ga_admin_disable_DimentionIndex_default", "", true);
|
55 |
define("ga_admin_disable_default", 'remove', true);
|
56 |
define("ga_adsense_default", "", true);
|
57 |
define("ga_extra_default", "", true);
|
59 |
define("ga_event_default", ga_enabled, true);
|
60 |
define("ga_outbound_default", ga_enabled, true);
|
61 |
define("ga_outbound_prefix_default", 'outgoing', true);
|
62 |
+
define("ga_enhanced_link_attr_default", ga_disabled, true);
|
63 |
define("ga_downloads_default", "", true);
|
64 |
define("ga_downloads_prefix_default", "download", true);
|
65 |
define("ga_widgets_default", ga_enabled, true);
|
67 |
// Create the default key and status
|
68 |
add_option( 'ga_version', GOOGLE_ANALYTICATOR_VERSION );
|
69 |
add_option(key_ga_status, ga_status_default, '');
|
70 |
+
add_option(key_ga_disable_gasites, ga_disable_gasites_default, '');
|
71 |
+
add_option(key_ga_analytic_snippet, ga_analytic_snippet_default, '');
|
72 |
add_option(key_ga_uid, ga_uid_default, '');
|
73 |
add_option(key_ga_admin, ga_admin_default, '');
|
74 |
+
add_option(key_ga_admin_disable_DimentionIndex, ga_admin_disable_DimentionIndex_default, '');
|
75 |
add_option(key_ga_admin_disable, ga_admin_disable_default, '');
|
76 |
add_option(key_ga_admin_role, array('administrator'), '');
|
77 |
add_option(key_ga_dashboard_role, array('administrator'), '');
|
82 |
add_option(key_ga_event, ga_event_default, '');
|
83 |
add_option(key_ga_outbound, ga_outbound_default, '');
|
84 |
add_option(key_ga_outbound_prefix, ga_outbound_prefix_default, '');
|
85 |
+
add_option(key_ga_enhanced_link_attr, ga_enhanced_link_attr_default, '');
|
86 |
add_option(key_ga_downloads, ga_downloads_default, '');
|
87 |
add_option(key_ga_downloads_prefix, ga_downloads_prefix_default, '');
|
88 |
add_option(key_ga_widgets, ga_widgets_default, '');
|
91 |
add_option('ga_google_token', '', '');
|
92 |
|
93 |
$useAuth = ( get_option( 'ga_google_token' ) == '' ? false : true );
|
94 |
+
|
95 |
+
|
96 |
# Check if we have a version of WordPress greater than 2.8
|
97 |
if ( function_exists('register_widget') ) {
|
98 |
|
112 |
|
113 |
// Create a option page for settings
|
114 |
add_action('admin_init', 'ga_admin_init');
|
115 |
+
|
116 |
+
add_action('init', "ganalyticator_stats_init");
|
117 |
add_action('admin_menu', 'add_ga_option_page');
|
118 |
|
119 |
+
function ganalyticator_stats_init(){
|
120 |
+
require_once('class.analytics.stats.php');
|
121 |
+
do_action("gapro_init");
|
122 |
+
}
|
123 |
// Initialize the options
|
124 |
function ga_admin_init() {
|
125 |
+
|
126 |
+
ga_get_active_addons();
|
127 |
+
|
128 |
# Load the localization information
|
129 |
$plugin_dir = basename(dirname(__FILE__));
|
130 |
load_plugin_textdomain('google-analyticator', 'wp-content/plugins/' . $plugin_dir . '/localizations', $plugin_dir . '/localizations');
|
131 |
+
|
132 |
}
|
133 |
|
134 |
# Add the core Google Analytics script, with a high priority to ensure last script for async tracking
|
140 |
|
141 |
# Initialize outbound link tracking
|
142 |
add_action('init', 'ga_outgoing_links');
|
143 |
+
// Include the Google Experiment page
|
144 |
+
|
145 |
|
146 |
// Hook in the options page function
|
147 |
function add_ga_option_page() {
|
148 |
|
|
|
|
|
149 |
|
150 |
+
if(ga_get_active_addons() == false){
|
151 |
+
$plugin_page = add_options_page(__('Google Analyticator Settings', 'google-analyticator'), 'Google Analytics', 'manage_options', basename(__FILE__), 'ga_settings_page');
|
152 |
+
add_action('load-'.$plugin_page, 'ga_pre_load' );
|
153 |
+
}
|
154 |
+
$activate_page = add_submenu_page( null, 'Activation', 'Google Analytics', 'manage_options', 'ga_activate' , 'ga_activate');
|
155 |
+
$reset_page = add_submenu_page(null, 'Reset', 'Reset', 'activate_plugins', 'ga_reset', 'ga_reset' );
|
156 |
add_action('load-'.$reset_page, 'ga_do_reset' );
|
157 |
|
158 |
}
|
162 |
function ga_pre_load()
|
163 |
{
|
164 |
|
165 |
+
add_action('admin_footer', 'add_ga_admin_footer');
|
166 |
+
|
167 |
if( isset( $_POST['key_ga_google_token'] ) ):
|
168 |
|
169 |
check_admin_referer('google-analyticator-update_settings');
|
202 |
print('Google PHP API Client requires http_build_query()');
|
203 |
return;
|
204 |
}
|
|
|
205 |
$url = http_build_query( array(
|
206 |
+
'next' =>ga_analyticator_setting_url(),
|
207 |
'scope' => GOOGLE_ANALYTICATOR_SCOPE,
|
208 |
'response_type'=>'code',
|
209 |
'redirect_uri'=>GOOGLE_ANALYTICATOR_REDIRECT,
|
212 |
);
|
213 |
|
214 |
?>
|
|
|
|
|
|
|
215 |
|
216 |
+
<div class="wrap">
|
217 |
+
<p><strong>Google Authentication Code </strong> </p>
|
218 |
+
<p>You need to sign in to Google and grant this plugin access to your Google Analytics account</p>
|
219 |
+
<p> <a
|
|
|
|
|
220 |
onclick="window.open('https://accounts.google.com/o/oauth2/auth?<?php echo $url ?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"
|
221 |
target="_blank"
|
222 |
+
href="javascript:void(0);"> Click Here </a> - <small> Or <a target="_blank" href="https://accounts.google.com/o/oauth2/auth?<?php echo $url ?>">here</a> if you have popups blocked</small> </p>
|
223 |
+
<div id="key">
|
224 |
+
<p>Enter your Google Authentication Code in this box. This code will be used to get an Authentication Token so you can access your website stats.</p>
|
225 |
+
<form method="post" action="<?php echo ga_analyticator_setting_url();?>">
|
226 |
+
<?php wp_nonce_field('google-analyticator-update_settings'); ?>
|
227 |
+
<input type="text" name="key_ga_google_token" value="" style="width:450px;"/>
|
228 |
+
<input type="submit" value="Save & Continue" />
|
229 |
+
</form>
|
230 |
+
</div>
|
231 |
+
<br />
|
232 |
+
<br />
|
233 |
+
<br />
|
234 |
+
<hr />
|
235 |
+
<br />
|
236 |
+
<p><strong>I Don't Want To Authenticate Through Google </strong> </p>
|
237 |
+
<p>If you don't want to authenticate through Google and only use the tracking capability of the plugin (<strong><u>not the dashboard functionality</u></strong>), you can do this by clicking the button below. </p>
|
238 |
+
<p>You will be asked on the next page to manually enter your Google Analytics UID.</p>
|
239 |
+
<form method="post" action="<?php echo ga_analyticator_setting_url();?>">
|
240 |
+
<input type="hidden" name="key_ga_google_token" value="" />
|
241 |
+
<?php wp_nonce_field('google-analyticator-update_settings'); ?>
|
242 |
+
<input type="submit" value="Continue Without Authentication" />
|
243 |
+
</form>
|
244 |
+
</div>
|
245 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
}
|
247 |
|
248 |
// Add settings option
|
249 |
function ga_filter_plugin_actions($links) {
|
250 |
$new_links = array();
|
251 |
|
252 |
+
$new_links[] = '<a href="' . ga_analyticator_setting_url() .'">' . __('Settings', 'google-analyticator') . '</a>';
|
253 |
$new_links[] = '<a href="' . admin_url('options-general.php?page=ga_reset">') . __('Reset', 'google-analyticator') . '</a>';
|
254 |
|
255 |
return array_merge($new_links, $links);
|
261 |
|
262 |
// Delete all GA options.
|
263 |
delete_option(key_ga_status);
|
264 |
+
delete_option(key_ga_disable_gasites);
|
265 |
+
delete_option(key_ga_analytic_snippet);
|
266 |
delete_option(key_ga_uid);
|
267 |
delete_option(key_ga_admin);
|
268 |
delete_option(key_ga_admin_disable);
|
274 |
delete_option(key_ga_event);
|
275 |
delete_option(key_ga_outbound);
|
276 |
delete_option(key_ga_outbound_prefix);
|
277 |
+
delete_option(key_ga_enhanced_link_attr);
|
278 |
delete_option(key_ga_downloads);
|
279 |
delete_option(key_ga_downloads_prefix);
|
280 |
delete_option(key_ga_widgets);
|
294 |
|
295 |
function ga_reset(){ /* Wont ever run. */ }
|
296 |
|
297 |
+
function ga_settings_page(){
|
298 |
+
ga_options_page();
|
299 |
+
}
|
300 |
function ga_options_page() {
|
301 |
|
302 |
// If we are a postback, store the options
|
313 |
$ga_status = ga_status_default;
|
314 |
update_option(key_ga_status, $ga_status);
|
315 |
|
316 |
+
// Update Hiding UID
|
317 |
+
$ga_disable_gasites = wp_filter_kses( $_POST[key_ga_disable_gasites] );
|
318 |
+
|
319 |
+
if (!$ga_disable_gasites)
|
320 |
+
$ga_disable_gasites = ga_disable_gasites_default;
|
321 |
+
|
322 |
+
update_option(key_ga_disable_gasites, $ga_disable_gasites);
|
323 |
+
|
324 |
+
// Update the Analytic Snippet
|
325 |
+
//define("key_ga_analytic_snippet", "ga_analytic_snippet", true);
|
326 |
+
$ga_analytic_snippet = wp_filter_kses( $_POST[key_ga_analytic_snippet] );
|
327 |
+
if (($ga_analytic_snippet != ga_enabled) && ($ga_analytic_snippet != ga_disabled))
|
328 |
+
$ga_analytic_snippet = ga_analytic_snippet;
|
329 |
+
update_option(key_ga_analytic_snippet, $ga_analytic_snippet);
|
330 |
+
|
331 |
// Update the UID
|
332 |
$ga_uid = wp_filter_kses( $_POST[key_ga_uid] );
|
333 |
if ($ga_uid == '')
|
340 |
$ga_admin = ga_admin_default;
|
341 |
update_option(key_ga_admin, wp_filter_kses( $ga_admin ) );
|
342 |
|
343 |
+
// Update the Dimension Index
|
344 |
+
$ga_admin_disable_DimentionIndex = $_POST[key_ga_admin_disable_DimentionIndex];
|
345 |
+
if ($ga_admin_disable_DimentionIndex == '')
|
346 |
+
$ga_admin_disable_DimentionIndex = ga_admin_disable_DimentionIndex_default;
|
347 |
+
|
348 |
+
update_option(key_ga_admin_disable_DimentionIndex, wp_filter_kses( $ga_admin_disable_DimentionIndex ) );
|
349 |
+
|
350 |
// Update the admin disable setting
|
351 |
$ga_admin_disable = wp_filter_kses( $_POST[key_ga_admin_disable] );
|
352 |
if ( $ga_admin_disable == '' )
|
367 |
} else {
|
368 |
$ga_dashboard_role = "";
|
369 |
}
|
370 |
+
|
371 |
update_option(key_ga_dashboard_role, $ga_dashboard_role );
|
372 |
|
373 |
// Update the extra tracking code
|
386 |
$ga_event = $_POST[key_ga_event];
|
387 |
if (($ga_event != ga_enabled) && ($ga_event != ga_disabled))
|
388 |
$ga_event = ga_event_default;
|
389 |
+
update_option(key_ga_event, wp_filter_kses ( $ga_event ) );
|
390 |
|
391 |
// Update the outbound tracking
|
392 |
$ga_outbound = $_POST[key_ga_outbound];
|
393 |
if (($ga_outbound != ga_enabled) && ($ga_outbound != ga_disabled))
|
394 |
$ga_outbound = ga_outbound_default;
|
395 |
+
update_option(key_ga_outbound, wp_filter_kses( $ga_outbound ) );
|
396 |
|
397 |
// Update the outbound prefix
|
398 |
$ga_outbound_prefix = $_POST[key_ga_outbound_prefix];
|
399 |
if ($ga_outbound_prefix == '')
|
400 |
$ga_outbound_prefix = ga_outbound_prefix_default;
|
401 |
+
update_option(key_ga_outbound_prefix, wp_filter_kses( $ga_outbound_prefix) );
|
402 |
|
403 |
+
// Update the download tracking code
|
404 |
+
$ga_downloads = $_POST[key_ga_downloads];
|
405 |
+
update_option(key_ga_downloads, wp_filter_kses( $ga_downloads ) );
|
406 |
|
407 |
+
// Update the Enhanced Link Attribution
|
408 |
+
$ga_enhanced_link_attr = $_POST[key_ga_enhanced_link_attr];
|
409 |
+
if ($ga_enhanced_link_attr == '')
|
410 |
+
$ga_enhanced_link_attr = ga_enhanced_link_attr_default;
|
411 |
+
update_option(key_ga_enhanced_link_attr, wp_filter_kses( $ga_enhanced_link_attr) );
|
412 |
+
|
413 |
// Update the download prefix
|
414 |
$ga_downloads_prefix = $_POST[key_ga_downloads_prefix];
|
415 |
if ($ga_downloads_prefix == '')
|
416 |
$ga_downloads_prefix = ga_downloads_prefix_default;
|
417 |
+
update_option(key_ga_downloads_prefix, wp_filter_kses( $ga_downloads_prefix) );
|
418 |
|
419 |
// Update the widgets option
|
420 |
$ga_widgets = $_POST[key_ga_widgets];
|
421 |
if (($ga_widgets != ga_enabled) && ($ga_widgets != ga_disabled))
|
|
|
|
|
422 |
|
423 |
+
$ga_widgets = ga_widgets_default;
|
424 |
+
update_option(key_ga_widgets, wp_filter_kses( $ga_widgets ) );
|
425 |
+
|
426 |
+
// Update the widgets option
|
427 |
+
update_option(key_ga_annon, wp_filter_kses( $_POST[key_ga_annon] ) );
|
428 |
|
429 |
// Update enable remarketing
|
430 |
update_option(key_ga_remarketing, wp_filter_kses( $_POST[key_ga_remarketing] ) );
|
431 |
|
432 |
// Update key_ga_hide_ad
|
433 |
update_option(key_ga_show_ad, wp_filter_kses( $_POST[key_ga_show_ad] ) );
|
|
|
434 |
// Update enable tracking login
|
435 |
+
update_option(key_ga_track_login, wp_filter_kses( $_POST[key_ga_track_login] ) );
|
|
|
|
|
436 |
// Give an updated message
|
437 |
echo "<div class='updated fade'><p><strong>" . __('Google Analyticator settings saved.', 'google-analyticator') . "</strong></p></div>";
|
438 |
}
|
|
|
|
|
439 |
// Are we using the auth system?
|
440 |
$useAuth = ( get_option( 'ga_google_token' ) == '' ? false : true );
|
441 |
+
// Output the options page
|
442 |
+
|
|
|
443 |
?>
|
444 |
+
<div class="wrap">
|
445 |
+
<form method="post" action="<?php echo ga_analyticator_setting_url();?>">
|
446 |
+
<?php
|
|
|
|
|
|
|
447 |
# Add a nonce
|
448 |
wp_nonce_field('google-analyticator-update_settings');
|
449 |
?>
|
450 |
+
<?php if (get_option(key_ga_status) == ga_disabled) { ?>
|
451 |
+
<div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
|
452 |
+
<?php _e('Google Analytics integration is currently <strong>DISABLED</strong>.', 'google-analyticator'); ?>
|
453 |
+
</div>
|
454 |
+
<?php } ?>
|
455 |
+
<?php if ((get_option(key_ga_uid) == "XX-XXXXX-X") && (get_option(key_ga_status) != ga_disabled)) { ?>
|
456 |
+
<div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
|
457 |
+
<?php _e('Google Analytics integration is currently enabled, but you did not enter a UID. Tracking will not occur.', 'google-analyticator'); ?>
|
458 |
+
</div>
|
459 |
+
<?php } ?>
|
460 |
+
<div id="vumga-container" style="position:relative;">
|
461 |
+
<?php
|
462 |
+
$addons = get_option("gapro_addons");
|
463 |
+
if(!$addons){?>
|
464 |
+
<div id="vumga-sidebar" style="position: absolute; top: 0; right: 0; width: 250px; border: 1px solid #ccc; padding: 20px; background:#FFFFFF"> <a href="http://get.videousermanuals.com/ga-pro/?utm_campaign=analyticatorpro&utm_medium=plugin&utm_source=settings" target="_blank"><img src="<?php echo plugins_url('gapro-plugin-advert-sidebar.png', __FILE__ ); ?>" alt="Learn More" title="Learn More" /></a> </div>
|
465 |
+
<?php }?>
|
466 |
+
<div style="margin-right: 320px;">
|
467 |
+
<table class="form-table" cellspacing="2" cellpadding="5" width="100%">
|
468 |
+
<tr>
|
469 |
+
<td colspan="2"><h3>
|
470 |
+
<?php _e('Basic Settings', 'google-analyticator'); ?>
|
471 |
+
</h3></td>
|
472 |
+
</tr>
|
473 |
+
|
474 |
+
<tr>
|
475 |
+
<th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_status ?>">
|
476 |
+
<?php _e('Google Analytics logging is', 'google-analyticator'); ?>
|
477 |
+
:</label>
|
478 |
+
</th>
|
479 |
+
<td>
|
480 |
+
<?php
|
|
|
481 |
echo "<select name='".key_ga_status."' id='".key_ga_status."'>\n";
|
482 |
|
483 |
echo "<option value='".ga_enabled."'";
|
492 |
|
493 |
echo "</select>\n";
|
494 |
?>
|
495 |
+
|
496 |
+
</td>
|
497 |
+
</tr>
|
498 |
+
<tr id="ga_ajax_accounts">
|
499 |
+
<th valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_uid; ?>">
|
500 |
+
<?php _e('Google Analytics UID', 'google-analyticator'); ?>
|
501 |
+
:</label>
|
502 |
+
</th>
|
503 |
+
<td>
|
504 |
+
|
505 |
+
<?php if (get_option(key_ga_disable_gasites) == ga_disabled){?>
|
506 |
+
<?php
|
507 |
+
|
508 |
+
if( $useAuth ):
|
509 |
+
|
510 |
+
$uids = ga_get_analytics_accounts();
|
511 |
+
|
512 |
+
echo "<select name='".key_ga_uid."'> ";
|
513 |
+
|
514 |
+
$hasSelected = false; // Will be set to true once a match is found. Cant echo selected twice.
|
515 |
+
|
516 |
+
foreach($uids as $id=>$domain):
|
517 |
+
|
518 |
+
echo '<option value="'.$id.'"';
|
519 |
+
// If set in DB.
|
520 |
+
if( get_option(key_ga_uid) == $id ) { $hasSelected=true; echo ' selected="selected"'; }
|
521 |
+
// Else if the domain matches the current domain & nothing set in DB.
|
522 |
+
elseif( ( $_SERVER['HTTP_HOST'] == $domain ) && ( ! $hasSelected ) ) { $hasSelected=true; echo ' selected="selected"'; }
|
523 |
+
echo '>'.$domain.'</option>';
|
524 |
+
|
525 |
+
endforeach;
|
526 |
+
|
527 |
+
echo '</select>';
|
528 |
+
|
529 |
+
else:
|
530 |
+
|
531 |
+
echo '<input type="text" name="'.key_ga_uid.'" value="'. get_option( key_ga_uid ) .'" />';
|
532 |
+
|
533 |
+
endif;
|
534 |
+
?><br />
|
535 |
+
<input type="checkbox" name="<?php echo key_ga_disable_gasites?>" id="<?php echo key_ga_disable_gasites?>"<?php if(get_option(key_ga_disable_gasites) == ga_enabled){?> checked="checked"<?php }?> /> <?php _e('Hide Google Analytics UID after saving', 'google-analyticator'); ?>
|
536 |
+
<?php }else{
|
537 |
+
?>Video User Manuals - To change this, you must <a href="<?php echo admin_url('/options-general.php?page=ga_reset'); ?>">deauthorize and reset the plugin</a>
|
538 |
+
<input type="hidden" name="<?php echo key_ga_disable_gasites?>" value="<?php echo ga_enabled?>" /><input type="hidden" name="<?php echo key_ga_uid?>" value="<?php echo get_option(key_ga_uid)?>" />
|
539 |
+
<?php
|
540 |
+
}?>
|
541 |
+
</td>
|
542 |
+
</tr>
|
543 |
+
<tr>
|
544 |
+
<th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_analytic_snippet ?>">
|
545 |
+
<?php _e('Tracking Code', 'google-analyticator'); ?>
|
546 |
+
:</label>
|
547 |
+
</th>
|
548 |
+
<td><?php
|
549 |
+
echo "<select name='".key_ga_analytic_snippet."' id='".key_ga_analytic_snippet."'>\n";
|
550 |
|
551 |
+
echo "<option value='".ga_enabled."'";
|
552 |
+
if(get_option(key_ga_analytic_snippet) == ga_enabled)
|
553 |
+
echo " selected='selected'";
|
554 |
+
echo ">" . __('Traditional (ga.js)', 'google-analyticator') . "</option>\n";
|
555 |
|
556 |
+
echo "<option value='".ga_disabled."'";
|
557 |
+
if(get_option(key_ga_analytic_snippet) == ga_disabled)
|
558 |
+
echo" selected='selected'";
|
559 |
+
echo ">" . __('Universal (analytics.js)', 'google-analyticator') . "</option>\n";
|
|
|
|
|
560 |
|
561 |
+
echo "</select>\n";
|
562 |
+
?>
|
563 |
+
<p class="setting-description">
|
564 |
+
<?php _e('If you are using Universal Analytics make sure you have changed your account to a Universal Analytics property in Google Analytics. Read more about Universal Analytics <a href="https://support.google.com/analytics/answer/2817075?hl=en" target="_blank">here</a>.', 'google-analyticator'); ?>
|
565 |
+
</p>
|
566 |
+
|
567 |
+
</td>
|
568 |
+
</tr>
|
569 |
+
<tr>
|
570 |
+
<td colspan="2"><h3>
|
571 |
+
<?php _e('Tracking Settings', 'google-analyticator'); ?>
|
572 |
+
</h3></td>
|
573 |
+
</tr>
|
574 |
+
<tr>
|
575 |
+
<th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_admin ?>">
|
576 |
+
<?php _e('Track all logged in WordPress users', 'google-analyticator'); ?>
|
577 |
+
:</label>
|
578 |
+
</th>
|
579 |
+
<td><?php
|
|
|
|
|
|
|
|
|
580 |
echo "<select name='".key_ga_admin."' id='".key_ga_admin."'>\n";
|
581 |
|
582 |
echo "<option value='".ga_enabled."'";
|
592 |
echo "</select>\n";
|
593 |
|
594 |
?>
|
595 |
+
<p class="setting-description">
|
596 |
+
<?php _e('Selecting "no" to this option will prevent logged in WordPress users from showing up on your Google Analytics reports. This setting will prevent yourself or other users from showing up in your Analytics reports. Use the next setting to determine what user groups to exclude.', 'google-analyticator'); ?>
|
597 |
+
</p></td>
|
598 |
+
</tr>
|
599 |
+
<tr>
|
600 |
+
<th width="30%" valign="top" style="padding-top: 10px;"> <label>
|
601 |
+
<?php _e('Anonymize IP Addresses', 'google-analyticator'); ?>
|
602 |
+
:</label>
|
603 |
+
</th>
|
604 |
+
<td><?php
|
605 |
echo "<select name='".key_ga_annon."' id='".key_ga_annon."'>\n";
|
606 |
|
607 |
echo "<option value='0'";
|
617 |
echo "</select>\n";
|
618 |
|
619 |
?>
|
620 |
+
<p class="setting-description">
|
621 |
+
<?php _e('By selecting "Yes", This tells Google Analytics to anonymize the information sent by the tracker objects by removing the last octet of the IP address prior to its storage. Note that this will slightly reduce the accuracy of geographic reporting.', 'google-analyticator'); ?>
|
622 |
+
</p></td>
|
623 |
+
</tr>
|
624 |
+
<tr>
|
625 |
+
<th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_admin_role ?>">
|
626 |
+
<?php _e('User roles to not track', 'google-analyticator'); ?>
|
627 |
+
:</label>
|
628 |
+
</th>
|
629 |
+
<td><?php
|
630 |
global $wp_roles;
|
631 |
$roles = $wp_roles->get_names();
|
632 |
$selected_roles = get_option(key_ga_admin_role);
|
642 |
echo ' /> ' . _x($name, 'User role') . '<br />';
|
643 |
}
|
644 |
?>
|
645 |
+
<p class="setting-description">
|
646 |
+
<?php _e('Specifies the user roles to not include in your WordPress Analytics report. If a user is logged into WordPress with one of these roles, they will not show up in your Analytics report.', 'google-analyticator'); ?>
|
647 |
+
</p></td>
|
648 |
+
</tr>
|
649 |
+
<tr>
|
650 |
+
<th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_admin_disable ?>">
|
651 |
+
<?php _e('Method to prevent tracking', 'google-analyticator'); ?>
|
652 |
+
:</label>
|
653 |
+
</th>
|
654 |
+
<td><?php
|
655 |
echo "<select name='".key_ga_admin_disable."' id='".key_ga_admin_disable."'>\n";
|
656 |
|
657 |
echo "<option value='remove'";
|
666 |
|
667 |
echo "</select>\n";
|
668 |
?>
|
669 |
+
<span class="ga_admin_disable_DimentionIndex_span"> Dimension Index :
|
670 |
+
<input type="text" name="<?php echo key_ga_admin_disable_DimentionIndex?>" style="width:50px;" value="<?php echo get_option(key_ga_admin_disable_DimentionIndex)?>" class="<?php echo key_ga_admin_disable_DimentionIndex?>" id="<?php echo key_ga_admin_disable_DimentionIndex?>" />
|
671 |
+
</span>
|
672 |
+
<p class="setting-description">
|
673 |
+
<?php _e('Selecting the "Remove" option will physically remove the tracking code from logged in users. Selecting the "Use \'admin\' variable" option will assign a variable called \'admin\' to logged in users. This option will allow Google Analytics\' site overlay feature to work, but you will have to manually configure Google Analytics to exclude tracking from pageviews with the \'admin\' variable.', 'google-analyticator'); ?>
|
674 |
+
</p></td>
|
675 |
+
</tr>
|
676 |
+
<tr>
|
677 |
+
<th width="30%" valign="top" style="padding-top: 10px;"> <label>
|
678 |
+
<?php _e('Enable Remarketing, Demographics and Interests reports', 'google-analyticator'); ?>
|
679 |
+
:</label>
|
680 |
+
</th>
|
681 |
+
<td><?php
|
682 |
echo "<select name='".key_ga_remarketing."' id='".key_ga_remarketing."'>\n";
|
683 |
|
684 |
echo "<option value='0'";
|
696 |
echo "</select>\n";
|
697 |
|
698 |
?>
|
699 |
+
<p class="setting-description">
|
700 |
+
<?php _e( 'In order to use remarketing, <a href="https://support.google.com/analytics/answer/2611270" target="_blank">please make sure you complete this checklist from Google</a>', 'google-analyticator'); ?>
|
701 |
+
</p>
|
702 |
+
<p class="setting-description">
|
703 |
+
<?php _e( 'To use remarketing, <a href="https://support.google.com/analytics/answer/2884495" target="_blank">Edit permission</a> is required', 'google-analyticator'); ?>
|
704 |
+
</p>
|
705 |
+
<p style="color:#FF5B5B" class="newtrackingnote">Universal Analytics (analytics.js) does not currently support this feature <a href="https://developers.google.com/analytics/devguides/collection/upgrade/" target="_blank">learn more</a></p></td>
|
706 |
+
</tr>
|
707 |
+
<tr>
|
708 |
+
<th width="30%" valign="top" style="padding-top: 10px;"> <label>
|
709 |
+
<?php _e('Track WordPress Login Page', 'google-analyticator'); ?>
|
710 |
+
:</label>
|
711 |
+
</th>
|
712 |
+
<td><?php
|
713 |
echo "<select name='".key_ga_track_login."' id='".key_ga_track_login."'>\n";
|
714 |
|
715 |
echo "<option value='1'";
|
725 |
echo "</select>\n";
|
726 |
|
727 |
?>
|
728 |
+
<p class="setting-description">
|
729 |
+
<?php _e( 'This will track all access to wp-login.php', 'google-analyticator'); ?>
|
730 |
+
</p></td>
|
731 |
+
</tr>
|
732 |
+
<tr>
|
733 |
+
<td colspan="2"><h3>Link Tracking Settings</h3></td>
|
734 |
+
</tr>
|
735 |
+
<tr>
|
736 |
+
<th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_outbound ?>">
|
737 |
+
<?php _e('Outbound link tracking', 'google-analyticator'); ?>
|
738 |
+
:</label>
|
739 |
+
</th>
|
740 |
+
<td><?php
|
|
|
741 |
echo "<select name='".key_ga_outbound."' id='".key_ga_outbound."'>\n";
|
742 |
|
743 |
echo "<option value='".ga_enabled."'";
|
752 |
|
753 |
echo "</select>\n";
|
754 |
?>
|
755 |
+
<p class="setting-description">
|
756 |
+
<?php _e('Disabling this option will turn off the tracking of outbound links. It\'s recommended not to disable this option unless you\'re a privacy advocate (now why would you be using Google Analytics in the first place?) or it\'s causing some kind of weird issue.', 'google-analyticator'); ?>
|
757 |
+
</p></td>
|
758 |
+
</tr>
|
759 |
+
<tr>
|
760 |
+
<th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_event ?>">
|
761 |
+
<?php _e('Event tracking', 'google-analyticator'); ?>
|
762 |
+
:</label>
|
763 |
+
</th>
|
764 |
+
<td><?php
|
765 |
echo "<select name='".key_ga_event."' id='".key_ga_event."'>\n";
|
766 |
|
767 |
echo "<option value='".ga_enabled."'";
|
776 |
|
777 |
echo "</select>\n";
|
778 |
?>
|
779 |
+
<p class="setting-description">
|
780 |
+
<?php _e('Enabling this option will treat outbound links and downloads as events instead of pageviews. Since the introduction of <a href="https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide">event tracking in Analytics</a>, this is the recommended way to track these types of actions. Only disable this option if you must use the old pageview tracking method.', 'google-analyticator'); ?>
|
781 |
+
</p></td>
|
782 |
+
</tr>
|
783 |
+
<tr>
|
784 |
+
<th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_enhanced_link_attr ?>">
|
785 |
+
<?php _e('Enhanced Link Attribution', 'google-analyticator'); ?>
|
786 |
+
:</label>
|
787 |
+
</th>
|
788 |
+
<td><?php
|
789 |
+
echo "<select name='".key_ga_enhanced_link_attr."' id='".key_ga_enhanced_link_attr."'>\n";
|
790 |
+
|
791 |
+
echo "<option value='".ga_enabled."'";
|
792 |
+
if(get_option(key_ga_enhanced_link_attr) == ga_enabled)
|
793 |
+
echo " selected='selected'";
|
794 |
+
echo ">" . __('Enabled', 'google-analyticator') . "</option>\n";
|
795 |
+
|
796 |
+
echo "<option value='".ga_disabled."'";
|
797 |
+
if(get_option(key_ga_enhanced_link_attr) || get_option(key_ga_enhanced_link_attr) == ga_disabled )
|
798 |
+
echo " selected='selected'";
|
799 |
+
echo ">" . __('Disabled', 'google-analyticator') . "</option>\n";
|
800 |
+
|
801 |
+
echo "</select>\n";
|
802 |
+
?>
|
803 |
+
<p class="setting-description">
|
804 |
+
<?php _e('You can tag your pages to implement an enhanced link-tracking functionality by enabling this option. <a href="https://support.google.com/analytics/answer/2558867?hl=en" target="_blank">learn more</a>', 'google-analyticator'); ?>
|
805 |
+
</p></td>
|
806 |
+
</tr>
|
807 |
+
<tr>
|
808 |
+
<th valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_downloads; ?>">
|
809 |
+
<?php _e('Download extensions to track', 'google-analyticator'); ?>
|
810 |
+
:</label>
|
811 |
+
</th>
|
812 |
+
<td><?php
|
813 |
echo "<input type='text' size='50' ";
|
814 |
echo "name='".key_ga_downloads."' ";
|
815 |
echo "id='".key_ga_downloads."' ";
|
816 |
echo "value='".wp_filter_kses(get_option(key_ga_downloads))."' />\n";
|
817 |
?>
|
818 |
+
<p class="setting-description">
|
819 |
+
<?php _e('Enter any extensions of files you would like to be tracked as a download. For example to track all MP3s and PDFs enter <strong>mp3,pdf</strong>. <em>Outbound link tracking must be enabled for downloads to be tracked.</em>', 'google-analyticator'); ?>
|
820 |
+
</p></td>
|
821 |
+
</tr>
|
822 |
+
<tr>
|
823 |
+
<th valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_outbound_prefix; ?>">
|
824 |
+
<?php _e('Prefix external links with', 'google-analyticator'); ?>
|
825 |
+
:</label>
|
826 |
+
</th>
|
827 |
+
<td><?php
|
828 |
echo "<input type='text' size='50' ";
|
829 |
echo "name='".key_ga_outbound_prefix."' ";
|
830 |
echo "id='".key_ga_outbound_prefix."' ";
|
831 |
echo "value='". stripslashes( wp_filter_kses(get_option(key_ga_outbound_prefix)))."' />\n";
|
832 |
?>
|
833 |
+
<p class="setting-description">
|
834 |
+
<?php _e('Enter a name for the section tracked external links will appear under. This option has no effect if event tracking is enabled.', 'google-analyticator'); ?>
|
835 |
+
</em></p></td>
|
836 |
+
</tr>
|
837 |
+
<tr>
|
838 |
+
<th valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_downloads_prefix; ?>">
|
839 |
+
<?php _e('Prefix download links with', 'google-analyticator'); ?>
|
840 |
+
:</label>
|
841 |
+
</th>
|
842 |
+
<td><?php
|
843 |
echo "<input type='text' size='50' ";
|
844 |
echo "name='".key_ga_downloads_prefix."' ";
|
845 |
echo "id='".key_ga_downloads_prefix."' ";
|
846 |
echo "value='".stripslashes(wp_filter_kses ( get_option(key_ga_downloads_prefix) ))."' />\n";
|
847 |
?>
|
848 |
+
<p class="setting-description">
|
849 |
+
<?php _e('Enter a name for the section tracked download links will appear under. This option has no effect if event tracking is enabled.', 'google-analyticator'); ?>
|
850 |
+
</em></p></td>
|
851 |
+
</tr>
|
852 |
+
<tr>
|
853 |
+
<th valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_adsense; ?>">
|
854 |
+
<?php _e('Google Adsense ID', 'google-analyticator'); ?>
|
855 |
+
:</label>
|
856 |
+
</th>
|
857 |
+
<td><?php
|
858 |
echo "<input type='text' size='50' ";
|
859 |
echo "name='".key_ga_adsense."' ";
|
860 |
echo "id='".key_ga_adsense."' ";
|
861 |
echo "value='".get_option(key_ga_adsense)."' />\n";
|
862 |
?>
|
863 |
+
<p class="setting-description">
|
864 |
+
<?php _e('Enter your Google Adsense ID assigned by Google Analytics in this box. This enables Analytics tracking of Adsense information if your Adsense and Analytics accounts are linked.', 'google-analyticator'); ?>
|
865 |
+
</p></td>
|
866 |
+
</tr>
|
867 |
+
<tr>
|
868 |
+
<td colspan="2"><h3>Additional Tracking Code </h3></td>
|
869 |
+
</tr>
|
870 |
+
<tr>
|
871 |
+
<th valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_extra; ?>">
|
872 |
+
<?php _e('Additional tracking code', 'google-analyticator'); ?>
|
873 |
+
<br />
|
874 |
+
(
|
875 |
+
<?php _e('before tracker initialization', 'google-analyticator'); ?>
|
876 |
+
):</label>
|
877 |
+
</th>
|
878 |
+
<td><?php
|
879 |
echo "<textarea cols='50' rows='8' ";
|
880 |
echo "name='".key_ga_extra."' ";
|
881 |
echo "id='".key_ga_extra."'>";
|
882 |
echo stripslashes(get_option(key_ga_extra))."</textarea>\n";
|
883 |
?>
|
884 |
+
<p class="setting-description">
|
885 |
+
<?php _e('Enter any additional lines of tracking code that you would like to include in the Google Analytics tracking script. The code in this section will be displayed <strong>before</strong> the Google Analytics tracker is initialized.', 'google-analyticator'); ?>
|
886 |
+
</p></td>
|
887 |
+
</tr>
|
888 |
+
<tr>
|
889 |
+
<th valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_extra_after; ?>">
|
890 |
+
<?php _e('Additional tracking code', 'google-analyticator'); ?>
|
891 |
+
<br />
|
892 |
+
(
|
893 |
+
<?php _e('after tracker initialization', 'google-analyticator'); ?>
|
894 |
+
):</label>
|
895 |
+
</th>
|
896 |
+
<td><?php
|
897 |
echo "<textarea cols='50' rows='8' ";
|
898 |
echo "name='".key_ga_extra_after."' ";
|
899 |
echo "id='".key_ga_extra_after."'>";
|
900 |
echo stripslashes(get_option(key_ga_extra_after))."</textarea>\n";
|
901 |
?>
|
902 |
+
<p class="setting-description">
|
903 |
+
<?php _e('Enter any additional lines of tracking code that you would like to include in the Google Analytics tracking script. The code in this section will be displayed <strong>after</strong> the Google Analytics tracker is initialized.', 'google-analyticator'); ?>
|
904 |
+
</p></td>
|
905 |
+
</tr>
|
906 |
+
<tr>
|
907 |
+
<td colspan="2"><h3>Admin Dashboard Widgets</h3>
|
908 |
+
<?php if(!$useAuth): ?>
|
909 |
+
<div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
|
910 |
+
<?php _e('You have not authenticated with Google - you cannot use dashboard widgets! Reset the plugin to authenticate..', 'google-analyticator'); ?>
|
911 |
+
</div>
|
912 |
+
<?php endif;?></td>
|
913 |
+
</tr>
|
914 |
+
<tr<?php if(!$useAuth){echo ' style="display:none"';}?>>
|
915 |
+
<th width="30%" valign="top" style="padding-top: 10px;"><label for="<?php echo key_ga_widgets; ?>">
|
916 |
+
<?php _e('Include widgets', 'google-analyticator'); ?>
|
917 |
+
:</label></th>
|
918 |
+
<td><?php
|
|
|
|
|
919 |
echo "<select name='".key_ga_widgets."' id='".key_ga_widgets."'>\n";
|
920 |
|
921 |
echo "<option value='".ga_enabled."'";
|
930 |
|
931 |
echo "</select>\n";
|
932 |
?>
|
933 |
+
<p class="setting-description">
|
934 |
+
<?php _e('Disabling this option will completely remove the Dashboard Summary widget and the theme Stats widget. Use this option if you would prefer to not see the widgets.', 'google-analyticator'); ?>
|
935 |
+
</p></td>
|
936 |
+
</tr>
|
937 |
+
<tr>
|
938 |
+
<th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_widgets; ?>">
|
939 |
+
<?php _e('Display Ad', 'google-analyticator'); ?>
|
940 |
+
:</label>
|
941 |
+
</th>
|
942 |
+
<td><?php
|
943 |
echo "<select name='".key_ga_show_ad."' id='".key_ga_show_ad."'>\n";
|
944 |
|
945 |
echo "<option value='1'";
|
954 |
|
955 |
echo "</select>\n";
|
956 |
?>
|
957 |
+
<p class="setting-description">
|
958 |
+
<?php _e('You can disable the ad on the admin dashboard.', 'google-analyticator'); ?>
|
959 |
+
</p></td>
|
960 |
+
</tr>
|
961 |
+
<tr<?php if(!$useAuth){echo ' style="display:none"';}?>>
|
962 |
+
<th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php echo key_ga_dashboard_role ?>">
|
963 |
+
<?php _e('User roles that can see the dashboard widget', 'google-analyticator'); ?>
|
964 |
+
:</label>
|
965 |
+
</th>
|
966 |
+
<td><?php
|
|
|
967 |
global $wp_roles;
|
968 |
$roles = $wp_roles->get_names();
|
969 |
$selected_roles = get_option(key_ga_dashboard_role);
|
979 |
echo ' /> ' . _x($name, 'User role') . '<br />';
|
980 |
}
|
981 |
?>
|
982 |
+
<p class="setting-description">
|
983 |
+
<?php _e('Specifies the user roles that can see the dashboard widget. If a user is not in one of these role groups, they will not see the dashboard widget.', 'google-analyticator'); ?>
|
984 |
+
</p></td>
|
985 |
+
</tr>
|
986 |
+
</table>
|
987 |
+
<p class="submit">
|
988 |
+
<input type="submit" class="button button-primary" name="info_update" value="<?php _e('Save Changes', 'google-analyticator'); ?>" />
|
989 |
+
</p>
|
990 |
+
<a href="<?php echo admin_url('/options-general.php?page=ga_reset'); ?>">
|
991 |
+
<?php _e('Deauthorize & Reset Google Analyticator.', 'google-analyticator'); ?>
|
992 |
+
</a>
|
993 |
+
</form>
|
994 |
+
</div>
|
995 |
+
</div>
|
996 |
+
<!-- end wrap -->
|
997 |
+
</div>
|
998 |
+
<!-- end vumga-container -->
|
999 |
|
1000 |
<?php
|
1001 |
}
|
1013 |
{
|
1014 |
$accounts = array();
|
1015 |
|
|
|
|
|
1016 |
|
1017 |
# Create a new Gdata call
|
1018 |
if ( isset($_POST['token']) && $_POST['token'] != '' )
|
1094 |
$ext = "";
|
1095 |
foreach ( $extensions AS $extension )
|
1096 |
$ext .= "'$extension',";
|
1097 |
+
$ext = substr($ext, 0, -1);
|
1098 |
+
|
1099 |
+
# Include the link tracking prefixes
|
1100 |
+
$outbound_prefix = stripslashes(get_option(key_ga_outbound_prefix));
|
1101 |
+
$downloads_prefix = stripslashes(get_option(key_ga_downloads_prefix));
|
1102 |
+
$event_tracking = get_option(key_ga_event);
|
1103 |
+
$need_to_annon = get_option(key_ga_annon);
|
1104 |
+
$jsanalytic_snippet = get_option(key_ga_analytic_snippet);
|
|
|
|
|
|
|
1105 |
?>
|
1106 |
<script type="text/javascript">
|
1107 |
+
var analyticsFileTypes = [<?php echo strtolower($ext); ?>];
|
1108 |
+
<?php if ( $event_tracking != 'enabled' ) { ?>
|
1109 |
+
var analyticsOutboundPrefix = '/<?php echo $outbound_prefix; ?>/';
|
1110 |
+
var analyticsDownloadsPrefix = '/<?php echo $downloads_prefix; ?>/';
|
1111 |
+
<?php } ?>
|
1112 |
+
var analyticsSnippet = '<?php echo $jsanalytic_snippet; ?>';
|
1113 |
+
var analyticsEventTracking = '<?php echo $event_tracking; ?>';
|
1114 |
+
</script>
|
1115 |
<?php
|
1116 |
# Add the first part of the core tracking code
|
1117 |
?>
|
1118 |
<script type="text/javascript">
|
1119 |
+
<?php if($jsanalytic_snippet == ga_enabled){?>
|
1120 |
var _gaq = _gaq || [];
|
1121 |
+
<?php if(get_option(key_ga_enhanced_link_attr) == ga_enabled): ?>
|
1122 |
+
var pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js';
|
1123 |
+
_gaq.push(['_require', 'inpage_linkid', pluginUrl]);
|
1124 |
+
<?php endif; ?>
|
1125 |
_gaq.push(['_setAccount', '<?php echo $uid; ?>']);
|
1126 |
+
_gaq.push(['_addDevId', 'i9k95']); // Google Analyticator App ID with Google
|
|
|
|
|
|
|
1127 |
<?php
|
1128 |
|
1129 |
# Add any tracking code before the trackPageview
|
1155 |
<?php endif; ?>
|
1156 |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
1157 |
})();
|
1158 |
+
<?php
|
1159 |
+
}else{
|
1160 |
+
# Add any tracking code before the trackPageview
|
1161 |
+
do_action('google_analyticator_extra_js_before');
|
1162 |
+
if ( '' != $extra )
|
1163 |
+
echo " $extra\n";
|
1164 |
+
?>
|
1165 |
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
1166 |
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
1167 |
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
1168 |
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
1169 |
+
|
1170 |
+
ga('create', '<?php echo $uid; ?>', 'auto');
|
1171 |
+
<?php if(get_option(key_ga_enhanced_link_attr) == ga_enabled): ?>
|
1172 |
+
ga('require', 'linkid', 'linkid.js');
|
1173 |
+
<?php endif; ?>
|
1174 |
+
ga('send', 'pageview');
|
1175 |
+
<?php if ($need_to_annon == '1' ): ?>
|
1176 |
+
ga('set', 'anonymizeIp', true);
|
1177 |
+
<?php endif; ?>
|
1178 |
+
<?php
|
1179 |
+
$dimentionKeyVal = get_option(key_ga_admin_disable_DimentionIndex);
|
1180 |
+
if ( ( get_option(key_ga_admin) == "admin" ) && ( ga_current_user_is(get_option(key_ga_admin_role)) ) && $dimentionKeyVal )
|
1181 |
+
echo " ga('set', 'dimension". $dimentionKeyVal ."', 'admin');\n";
|
1182 |
+
|
1183 |
+
# Add any tracking code after the trackPageview
|
1184 |
+
do_action('google_analyticator_extra_js_after');
|
1185 |
+
if ( '' != $extra_after )
|
1186 |
+
echo " $extra_after\n";
|
1187 |
+
}?>
|
1188 |
</script>
|
1189 |
<?php
|
1190 |
}
|
1253 |
|
1254 |
return false;
|
1255 |
}
|
1256 |
+
|
1257 |
+
function ga_analyticator_setting_url(){
|
1258 |
+
return ( ga_get_active_addons() == false) ? admin_url("options-general.php?page=google-analyticator.php") : admin_url("admin.php?page=ga-pro-experiment.php");
|
1259 |
+
}
|
1260 |
+
|
1261 |
+
function ga_get_active_addons(){
|
1262 |
+
|
1263 |
+
$gapro_addons = get_option("gapro_addons");
|
1264 |
+
if($gapro_addons && is_array($gapro_addons)){
|
1265 |
+
return $gapro_addons;
|
1266 |
+
}else{
|
1267 |
+
return false;
|
1268 |
+
}
|
1269 |
+
}
|
1270 |
+
function add_ga_admin_footer(){
|
1271 |
+
echo '<script type="text/javascript">';
|
1272 |
+
echo 'jQuery(document).ready(function(){
|
1273 |
+
jQuery("#ga_analytic_snippet").change(function(){
|
1274 |
+
if(jQuery("#ga_analytic_snippet option:selected").val() == "disabled")
|
1275 |
+
jQuery(".newtrackingnote").show();
|
1276 |
+
else
|
1277 |
+
jQuery(".newtrackingnote").hide();
|
1278 |
+
|
1279 |
+
jQuery("#ga_admin_disable").trigger("change");
|
1280 |
+
});
|
1281 |
+
|
1282 |
+
jQuery("#ga_admin_disable").change(function(){
|
1283 |
+
if((jQuery("#ga_analytic_snippet option:selected").val() == "disabled") && (jQuery("#ga_admin_disable option:selected").val() == "admin")){
|
1284 |
+
jQuery(".ga_admin_disable_DimentionIndex_span").show();
|
1285 |
+
}else
|
1286 |
+
{
|
1287 |
+
jQuery(".ga_admin_disable_DimentionIndex_span").hide();
|
1288 |
+
}
|
1289 |
+
});
|
1290 |
+
|
1291 |
+
jQuery( "#ga_analytic_snippet" ).trigger("change");
|
1292 |
+
jQuery("#ga_admin_disable").trigger("change");
|
1293 |
+
})';
|
1294 |
+
echo '</script>';
|
1295 |
+
}
|
google-analytics-summary-widget.php
CHANGED
@@ -195,7 +195,7 @@ class GoogleAnalyticsSummary
|
|
195 |
|
196 |
jQuery.plot(placeholder, [
|
197 |
{
|
198 |
-
label:
|
199 |
data: d1,
|
200 |
lines: {fillColor: "#f2f7f9"},
|
201 |
points: {fillColor: "#88bbc8"}
|
@@ -221,9 +221,9 @@ class GoogleAnalyticsSummary
|
|
221 |
{
|
222 |
# Attempt to login and get the current account
|
223 |
echo '<p align="right"><span id="analyticsloading"></span> <select id="qa_selecteddate" name="qa_selecteddate">
|
224 |
-
<option selected="selected" value="30
|
225 |
-
<option value="60
|
226 |
-
<option value="1
|
227 |
</select></p>';
|
228 |
echo '<div class="flotcontainer" style="height: 230px;width:100%;"> </div>';
|
229 |
echo '<div class="target" style="display: none;"></div>';
|
195 |
|
196 |
jQuery.plot(placeholder, [
|
197 |
{
|
198 |
+
label: "<?php _e('Visits', 'google-analyticator')?>",
|
199 |
data: d1,
|
200 |
lines: {fillColor: "#f2f7f9"},
|
201 |
points: {fillColor: "#88bbc8"}
|
221 |
{
|
222 |
# Attempt to login and get the current account
|
223 |
echo '<p align="right"><span id="analyticsloading"></span> <select id="qa_selecteddate" name="qa_selecteddate">
|
224 |
+
<option selected="selected" value="30">'. __("Past 30 days", 'google-analyticator'). '</option>
|
225 |
+
<option value="60">'. __("Past 60 days", 'google-analyticator'). '</option>
|
226 |
+
<option value="1">'. __("Yesterday", 'google-analyticator'). '</option>
|
227 |
</select></p>';
|
228 |
echo '<div class="flotcontainer" style="height: 230px;width:100%;"> </div>';
|
229 |
echo '<div class="target" style="display: none;"></div>';
|
google-api-php-client/LICENSE
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Apache License
|
2 |
+
Version 2.0, January 2004
|
3 |
+
http://www.apache.org/licenses/
|
4 |
+
|
5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6 |
+
|
7 |
+
1. Definitions.
|
8 |
+
|
9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
11 |
+
|
12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13 |
+
the copyright owner that is granting the License.
|
14 |
+
|
15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
16 |
+
other entities that control, are controlled by, or are under common
|
17 |
+
control with that entity. For the purposes of this definition,
|
18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
19 |
+
direction or management of such entity, whether by contract or
|
20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22 |
+
|
23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24 |
+
exercising permissions granted by this License.
|
25 |
+
|
26 |
+
"Source" form shall mean the preferred form for making modifications,
|
27 |
+
including but not limited to software source code, documentation
|
28 |
+
source, and configuration files.
|
29 |
+
|
30 |
+
"Object" form shall mean any form resulting from mechanical
|
31 |
+
transformation or translation of a Source form, including but
|
32 |
+
not limited to compiled object code, generated documentation,
|
33 |
+
and conversions to other media types.
|
34 |
+
|
35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
36 |
+
Object form, made available under the License, as indicated by a
|
37 |
+
copyright notice that is included in or attached to the work
|
38 |
+
(an example is provided in the Appendix below).
|
39 |
+
|
40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41 |
+
form, that is based on (or derived from) the Work and for which the
|
42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
44 |
+
of this License, Derivative Works shall not include works that remain
|
45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46 |
+
the Work and Derivative Works thereof.
|
47 |
+
|
48 |
+
"Contribution" shall mean any work of authorship, including
|
49 |
+
the original version of the Work and any modifications or additions
|
50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
54 |
+
means any form of electronic, verbal, or written communication sent
|
55 |
+
to the Licensor or its representatives, including but not limited to
|
56 |
+
communication on electronic mailing lists, source code control systems,
|
57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
59 |
+
excluding communication that is conspicuously marked or otherwise
|
60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
61 |
+
|
62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
64 |
+
subsequently incorporated within the Work.
|
65 |
+
|
66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
71 |
+
Work and such Derivative Works in Source or Object form.
|
72 |
+
|
73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76 |
+
(except as stated in this section) patent license to make, have made,
|
77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78 |
+
where such license applies only to those patent claims licensable
|
79 |
+
by such Contributor that are necessarily infringed by their
|
80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
82 |
+
institute patent litigation against any entity (including a
|
83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84 |
+
or a Contribution incorporated within the Work constitutes direct
|
85 |
+
or contributory patent infringement, then any patent licenses
|
86 |
+
granted to You under this License for that Work shall terminate
|
87 |
+
as of the date such litigation is filed.
|
88 |
+
|
89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
90 |
+
Work or Derivative Works thereof in any medium, with or without
|
91 |
+
modifications, and in Source or Object form, provided that You
|
92 |
+
meet the following conditions:
|
93 |
+
|
94 |
+
(a) You must give any other recipients of the Work or
|
95 |
+
Derivative Works a copy of this License; and
|
96 |
+
|
97 |
+
(b) You must cause any modified files to carry prominent notices
|
98 |
+
stating that You changed the files; and
|
99 |
+
|
100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
101 |
+
that You distribute, all copyright, patent, trademark, and
|
102 |
+
attribution notices from the Source form of the Work,
|
103 |
+
excluding those notices that do not pertain to any part of
|
104 |
+
the Derivative Works; and
|
105 |
+
|
106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107 |
+
distribution, then any Derivative Works that You distribute must
|
108 |
+
include a readable copy of the attribution notices contained
|
109 |
+
within such NOTICE file, excluding those notices that do not
|
110 |
+
pertain to any part of the Derivative Works, in at least one
|
111 |
+
of the following places: within a NOTICE text file distributed
|
112 |
+
as part of the Derivative Works; within the Source form or
|
113 |
+
documentation, if provided along with the Derivative Works; or,
|
114 |
+
within a display generated by the Derivative Works, if and
|
115 |
+
wherever such third-party notices normally appear. The contents
|
116 |
+
of the NOTICE file are for informational purposes only and
|
117 |
+
do not modify the License. You may add Your own attribution
|
118 |
+
notices within Derivative Works that You distribute, alongside
|
119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
120 |
+
that such additional attribution notices cannot be construed
|
121 |
+
as modifying the License.
|
122 |
+
|
123 |
+
You may add Your own copyright statement to Your modifications and
|
124 |
+
may provide additional or different license terms and conditions
|
125 |
+
for use, reproduction, or distribution of Your modifications, or
|
126 |
+
for any such Derivative Works as a whole, provided Your use,
|
127 |
+
reproduction, and distribution of the Work otherwise complies with
|
128 |
+
the conditions stated in this License.
|
129 |
+
|
130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
132 |
+
by You to the Licensor shall be under the terms and conditions of
|
133 |
+
this License, without any additional terms or conditions.
|
134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135 |
+
the terms of any separate license agreement you may have executed
|
136 |
+
with Licensor regarding such Contributions.
|
137 |
+
|
138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
140 |
+
except as required for reasonable and customary use in describing the
|
141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
142 |
+
|
143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144 |
+
agreed to in writing, Licensor provides the Work (and each
|
145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147 |
+
implied, including, without limitation, any warranties or conditions
|
148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150 |
+
appropriateness of using or redistributing the Work and assume any
|
151 |
+
risks associated with Your exercise of permissions under this License.
|
152 |
+
|
153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
154 |
+
whether in tort (including negligence), contract, or otherwise,
|
155 |
+
unless required by applicable law (such as deliberate and grossly
|
156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157 |
+
liable to You for damages, including any direct, indirect, special,
|
158 |
+
incidental, or consequential damages of any character arising as a
|
159 |
+
result of this License or out of the use or inability to use the
|
160 |
+
Work (including but not limited to damages for loss of goodwill,
|
161 |
+
work stoppage, computer failure or malfunction, or any and all
|
162 |
+
other commercial damages or losses), even if such Contributor
|
163 |
+
has been advised of the possibility of such damages.
|
164 |
+
|
165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168 |
+
or other liability obligations and/or rights consistent with this
|
169 |
+
License. However, in accepting such obligations, You may act only
|
170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171 |
+
of any other Contributor, and only if You agree to indemnify,
|
172 |
+
defend, and hold each Contributor harmless for any liability
|
173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
174 |
+
of your accepting any such warranty or additional liability.
|
175 |
+
|
176 |
+
END OF TERMS AND CONDITIONS
|
177 |
+
|
178 |
+
APPENDIX: How to apply the Apache License to your work.
|
179 |
+
|
180 |
+
To apply the Apache License to your work, attach the following
|
181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182 |
+
replaced with your own identifying information. (Don't include
|
183 |
+
the brackets!) The text should be enclosed in the appropriate
|
184 |
+
comment syntax for the file format. We also recommend that a
|
185 |
+
file or class name and description of purpose be included on the
|
186 |
+
same "printed page" as the copyright notice for easier
|
187 |
+
identification within third-party archives.
|
188 |
+
|
189 |
+
Copyright [yyyy] [name of copyright owner]
|
190 |
+
|
191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192 |
+
you may not use this file except in compliance with the License.
|
193 |
+
You may obtain a copy of the License at
|
194 |
+
|
195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
196 |
+
|
197 |
+
Unless required by applicable law or agreed to in writing, software
|
198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200 |
+
See the License for the specific language governing permissions and
|
201 |
+
limitations under the License.
|
202 |
+
|
203 |
+
|
google-api-php-client/NOTICE
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
This product contains the following libraries:
|
2 |
+
|
3 |
+
XRDS-Simple library from http://code.google.com/p/diso/
|
4 |
+
Apache License 2.0
|
google-api-php-client/README
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Google APIs Client Library for PHP
|
2 |
+
=====================================
|
3 |
+
|
4 |
+
== Description
|
5 |
+
The Google API Client Library enables you to work with Google APIs such as Google+, Drive, Tasks, or Latitude on your server.
|
6 |
+
|
7 |
+
Requirements:
|
8 |
+
PHP 5.2.x or higher [http://www.php.net/]
|
9 |
+
PHP Curl extension [http://www.php.net/manual/en/intro.curl.php]
|
10 |
+
PHP JSON extension [http://php.net/manual/en/book.json.php]
|
11 |
+
|
12 |
+
Project page:
|
13 |
+
http://code.google.com/p/google-api-php-client
|
14 |
+
|
15 |
+
OAuth 2 instructions:
|
16 |
+
http://code.google.com/p/google-api-php-client/wiki/OAuth2
|
17 |
+
|
18 |
+
Report a defect or feature request here:
|
19 |
+
http://code.google.com/p/google-api-php-client/issues/entry
|
20 |
+
|
21 |
+
Subscribe to project updates in your feed reader:
|
22 |
+
http://code.google.com/feeds/p/google-api-php-client/updates/basic
|
23 |
+
|
24 |
+
Supported sample applications:
|
25 |
+
http://code.google.com/p/google-api-php-client/wiki/Samples
|
26 |
+
|
27 |
+
== Basic Example
|
28 |
+
<?php
|
29 |
+
require_once 'path/to/src/Google_Client.php';
|
30 |
+
require_once 'path/to/src/contrib/apiBooksService.php';
|
31 |
+
|
32 |
+
$client = new Google_Client();
|
33 |
+
$service = new Google_BooksService($client);
|
34 |
+
|
35 |
+
$optParams = array('filter' => 'free-ebooks');
|
36 |
+
$results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);
|
37 |
+
|
38 |
+
foreach ($results['items'] as $item) {
|
39 |
+
print($item['volumeInfo']['title'] . '<br>');
|
40 |
+
}
|
google-api-php-client/src/Google_Client.php
ADDED
@@ -0,0 +1,471 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright 2010 Google Inc.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
// Check for the json extension, the Google APIs PHP Client won't function
|
19 |
+
// without it.
|
20 |
+
if (! function_exists('json_decode')) {
|
21 |
+
throw new Exception('Google PHP API Client requires the JSON PHP extension');
|
22 |
+
}
|
23 |
+
|
24 |
+
if (! function_exists('http_build_query')) {
|
25 |
+
throw new Exception('Google PHP API Client requires http_build_query()');
|
26 |
+
}
|
27 |
+
|
28 |
+
if (! ini_get('date.timezone') && function_exists('date_default_timezone_set')) {
|
29 |
+
date_default_timezone_set('UTC');
|
30 |
+
}
|
31 |
+
|
32 |
+
// hack around with the include paths a bit so the library 'just works'
|
33 |
+
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
|
34 |
+
|
35 |
+
require_once "config.php";
|
36 |
+
// If a local configuration file is found, merge it's values with the default configuration
|
37 |
+
if (file_exists(dirname(__FILE__) . '/local_config.php')) {
|
38 |
+
$defaultConfig = $apiConfig;
|
39 |
+
require_once (dirname(__FILE__) . '/local_config.php');
|
40 |
+
$apiConfig = array_merge($defaultConfig, $apiConfig);
|
41 |
+
}
|
42 |
+
|
43 |
+
// Include the top level classes, they each include their own dependencies
|
44 |
+
require_once 'service/Google_Model.php';
|
45 |
+
require_once 'service/Google_Service.php';
|
46 |
+
require_once 'service/Google_ServiceResource.php';
|
47 |
+
require_once 'auth/Google_AssertionCredentials.php';
|
48 |
+
require_once 'auth/Google_Signer.php';
|
49 |
+
require_once 'auth/Google_P12Signer.php';
|
50 |
+
require_once 'service/Google_BatchRequest.php';
|
51 |
+
require_once 'external/URITemplateParser.php';
|
52 |
+
require_once 'auth/Google_Auth.php';
|
53 |
+
require_once 'cache/Google_Cache.php';
|
54 |
+
require_once 'io/Google_IO.php';
|
55 |
+
require_once('service/Google_MediaFileUpload.php');
|
56 |
+
|
57 |
+
/**
|
58 |
+
* The Google API Client
|
59 |
+
* http://code.google.com/p/google-api-php-client/
|
60 |
+
*
|
61 |
+
* @author Chris Chabot <chabotc@google.com>
|
62 |
+
* @author Chirag Shah <chirags@google.com>
|
63 |
+
*/
|
64 |
+
class Google_Client {
|
65 |
+
/**
|
66 |
+
* @static
|
67 |
+
* @var Google_Auth $auth
|
68 |
+
*/
|
69 |
+
static $auth;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @static
|
73 |
+
* @var Google_IO $io
|
74 |
+
*/
|
75 |
+
static $io;
|
76 |
+
|
77 |
+
/**
|
78 |
+
* @static
|
79 |
+
* @var Google_Cache $cache
|
80 |
+
*/
|
81 |
+
static $cache;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* @static
|
85 |
+
* @var boolean $useBatch
|
86 |
+
*/
|
87 |
+
static $useBatch = false;
|
88 |
+
|
89 |
+
/** @var array $scopes */
|
90 |
+
protected $scopes = array();
|
91 |
+
|
92 |
+
/** @var bool $useObjects */
|
93 |
+
protected $useObjects = false;
|
94 |
+
|
95 |
+
// definitions of services that are discovered.
|
96 |
+
protected $services = array();
|
97 |
+
|
98 |
+
// Used to track authenticated state, can't discover services after doing authenticate()
|
99 |
+
private $authenticated = false;
|
100 |
+
|
101 |
+
public function __construct($config = array()) {
|
102 |
+
global $apiConfig;
|
103 |
+
$apiConfig = array_merge($apiConfig, $config);
|
104 |
+
self::$cache = new $apiConfig['cacheClass']();
|
105 |
+
self::$auth = new $apiConfig['authClass']();
|
106 |
+
self::$io = new $apiConfig['ioClass']();
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Add a service
|
111 |
+
*/
|
112 |
+
public function addService($service, $version = false) {
|
113 |
+
global $apiConfig;
|
114 |
+
if ($this->authenticated) {
|
115 |
+
throw new Google_Exception('Cant add services after having authenticated');
|
116 |
+
}
|
117 |
+
$this->services[$service] = array();
|
118 |
+
if (isset($apiConfig['services'][$service])) {
|
119 |
+
// Merge the service descriptor with the default values
|
120 |
+
$this->services[$service] = array_merge($this->services[$service], $apiConfig['services'][$service]);
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
public function authenticate($code = null) {
|
125 |
+
$service = $this->prepareService();
|
126 |
+
$this->authenticated = true;
|
127 |
+
return self::$auth->authenticate($service, $code);
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @return array
|
132 |
+
* @visible For Testing
|
133 |
+
*/
|
134 |
+
public function prepareService() {
|
135 |
+
$service = array();
|
136 |
+
$scopes = array();
|
137 |
+
if ($this->scopes) {
|
138 |
+
$scopes = $this->scopes;
|
139 |
+
} else {
|
140 |
+
foreach ($this->services as $key => $val) {
|
141 |
+
if (isset($val['scope'])) {
|
142 |
+
if (is_array($val['scope'])) {
|
143 |
+
$scopes = array_merge($val['scope'], $scopes);
|
144 |
+
} else {
|
145 |
+
$scopes[] = $val['scope'];
|
146 |
+
}
|
147 |
+
} else {
|
148 |
+
$scopes[] = 'https://www.googleapis.com/auth/' . $key;
|
149 |
+
}
|
150 |
+
unset($val['discoveryURI']);
|
151 |
+
unset($val['scope']);
|
152 |
+
$service = array_merge($service, $val);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
$service['scope'] = implode(' ', $scopes);
|
156 |
+
return $service;
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Set the OAuth 2.0 access token using the string that resulted from calling authenticate()
|
161 |
+
* or Google_Client#getAccessToken().
|
162 |
+
* @param string $accessToken JSON encoded string containing in the following format:
|
163 |
+
* {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
|
164 |
+
* "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
|
165 |
+
*/
|
166 |
+
public function setAccessToken($accessToken) {
|
167 |
+
if ($accessToken == null || 'null' == $accessToken) {
|
168 |
+
$accessToken = null;
|
169 |
+
}
|
170 |
+
self::$auth->setAccessToken($accessToken);
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Set the type of Auth class the client should use.
|
175 |
+
* @param string $authClassName
|
176 |
+
*/
|
177 |
+
public function setAuthClass($authClassName) {
|
178 |
|