Google Analytics for WordPress by MonsterInsights - Version 4.3

Version Description

  • Major refactor of plugin code, to only load necessary code on front and backend.
  • Made entire plugin i18n ready.
  • Fixed Google Authentication process (thanks to Jan Willem Eshuis).
Download this release

Release Info

Developer joostdevalk
Plugin Icon 128x128 Google Analytics for WordPress by MonsterInsights
Version 4.3
Comparing to
See all releases

Code changes from version 4.2.8 to 4.3

admin/ajax.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function yoast_ga_store_tracking_response() {
4
+ if ( !wp_verify_nonce( $_POST['nonce'], 'wpga_activate_tracking' ) )
5
+ die();
6
+
7
+ $options = get_option( 'Yoast_Google_Analytics' );
8
+
9
+ $options['tracking_popup'] = 'done';
10
+
11
+ if ( $_POST['allow_tracking'] == 'yes' )
12
+ $options['yoast_tracking'] = true;
13
+ else
14
+ $options['yoast_tracking'] = false;
15
+
16
+ update_option( 'Yoast_Google_Analytics', $options );
17
+ }
18
+
19
+ add_action( 'wp_ajax_wpga_tracking_data', 'yoast_ga_store_tracking_response' );
admin/class-admin.php ADDED
@@ -0,0 +1,808 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Admin User Interface
5
+ */
6
+
7
+ require_once plugin_dir_path( __FILE__ ) . 'yst_plugin_tools.php';
8
+ require_once plugin_dir_path( __FILE__ ) . '/wp-gdata/wp-gdata.php';
9
+
10
+ $options = get_option( 'Yoast_Google_Analytics' );
11
+
12
+ global $wp_version;
13
+ if ( version_compare( $wp_version, '3.3', '>=' ) && !isset( $options['tracking_popup'] ) )
14
+ require_once plugin_dir_path( __FILE__ ) . 'class-pointer.php';
15
+
16
+ class GA_Admin extends Yoast_GA_Plugin_Admin {
17
+
18
+ var $hook = 'google-analytics-for-wordpress';
19
+ var $longname = '';
20
+ var $shortname = '';
21
+ var $ozhicon = 'images/chart_curve.png';
22
+ var $optionname = 'Yoast_Google_Analytics';
23
+ var $homepage = 'http://yoast.com/wordpress/google-analytics/';
24
+ var $toc = '';
25
+
26
+ /**
27
+ * Constructur, load all required stuff.
28
+ */
29
+ function __construct() {
30
+ $this->longname = __( 'Google Analytics Configuration', 'gawp' );
31
+ $this->shortname = __( 'Google Analytics', 'gawp' );
32
+
33
+ $this->upgrade();
34
+
35
+ $this->plugin_url = plugins_url( '', __FILE__ ) . '/';
36
+
37
+ // Register the settings page
38
+ add_action( 'admin_menu', array( &$this, 'register_settings_page' ) );
39
+
40
+ // Register the contextual help for the settings page
41
+ // add_action( 'contextual_help', array(&$this, 'plugin_help'), 10, 3 );
42
+
43
+ // Give the plugin a settings link in the plugin overview
44
+ add_filter( 'plugin_action_links', array( &$this, 'add_action_link' ), 10, 2 );
45
+
46
+ // Print Scripts and Styles
47
+ add_action( 'admin_print_scripts', array( &$this, 'config_page_scripts' ) );
48
+ add_action( 'admin_print_styles', array( &$this, 'config_page_styles' ) );
49
+
50
+ // Print stuff in the settings page's head
51
+ add_action( 'admin_head', array( &$this, 'config_page_head' ) );
52
+
53
+ // Drop a warning on each page of the admin when Google Analytics hasn't been configured
54
+ add_action( 'admin_footer', array( &$this, 'warning' ) );
55
+
56
+ // Save settings
57
+ // TODO: replace with Options API
58
+ add_action( 'admin_init', array( &$this, 'save_settings' ) );
59
+
60
+ // Authenticate
61
+ add_action( 'admin_init', array( &$this, 'authenticate' ) );
62
+ }
63
+
64
+ function config_page_head() {
65
+
66
+ global $current_screen;
67
+ if ( 'settings_page_' . $this->hook == $current_screen->id ) {
68
+ ?>
69
+
70
+ <script type="text/javascript">
71
+ jQuery(document).ready(function () {
72
+ jQuery(".chzn-select").chosen({ allow_single_deselect:true });
73
+ jQuery('#position').change(function () {
74
+ if (jQuery('#position').val() == 'header') {
75
+ jQuery('#position_header').css("display", "block");
76
+ jQuery('#position_manual').css("display", "none");
77
+ } else {
78
+ jQuery('#position_header').css("display", "none");
79
+ jQuery('#position_manual').css("display", "block");
80
+ }
81
+ }).change();
82
+ jQuery('#switchtomanual').change(function () {
83
+ if (jQuery('#switchtomanual').is(':checked')) {
84
+ jQuery('#uastring_manual').css('display', 'block');
85
+ jQuery('#uastring_automatic').css('display', 'none');
86
+ } else {
87
+ jQuery('#uastring_manual').css('display', 'none');
88
+ jQuery('#uastring_automatic').css('display', 'block');
89
+ }
90
+ }).change();
91
+ jQuery('#trackoutbound').change(function () {
92
+ if (jQuery('#trackoutbound').is(':checked')) {
93
+ jQuery('#internallinktracking').css("display", "block");
94
+ jQuery('.internallinktracking').css("display", "list-item");
95
+ } else {
96
+ jQuery('#internallinktracking').css("display", "none");
97
+ jQuery('.internallinktracking').css("display", "none");
98
+ }
99
+ }).change();
100
+ jQuery('#advancedsettings').change(function () {
101
+ if (jQuery('#advancedsettings').is(':checked')) {
102
+ jQuery('#advancedgasettings').css("display", "block");
103
+ jQuery('#customvarsettings').css("display", "block");
104
+ jQuery('.advancedgasettings').css("display", "list-item");
105
+ jQuery('.customvarsettings').css("display", "list-item");
106
+ } else {
107
+ jQuery('#advancedgasettings').css("display", "none");
108
+ jQuery('#customvarsettings').css("display", "none");
109
+ jQuery('.advancedgasettings').css("display", "none");
110
+ jQuery('.customvarsettings').css("display", "none");
111
+ }
112
+ }).change();
113
+ jQuery('#extrase').change(function () {
114
+ if (jQuery('#extrase').is(':checked')) {
115
+ jQuery('#extrasebox').css("display", "block");
116
+ } else {
117
+ jQuery('#extrasebox').css("display", "none");
118
+ }
119
+ }).change();
120
+ jQuery('#gajslocalhosting').change(function () {
121
+ if (jQuery('#gajslocalhosting').is(':checked')) {
122
+ jQuery('#localhostingbox').css("display", "block");
123
+ } else {
124
+ jQuery('#localhostingbox').css("display", "none");
125
+ }
126
+ }).change();
127
+ jQuery('#customvarsettings :input').change(function () {
128
+ if (jQuery("#customvarsettings :input:checked").size() > 5) {
129
+ alert("<?php _e( 'The maximum number of allowed custom variables in Google Analytics is 5, please unselect one of the other custom variables before selecting this one.', 'gawp' ); ?>");
130
+ jQuery(this).attr('checked', false);
131
+ }
132
+ });
133
+ jQuery('#uastring').change(function () {
134
+ if (jQuery('#switchtomanual').is(':checked')) {
135
+ if (!jQuery(this).val().match(/^UA-[\d-]+$/)) {
136
+ alert("<?php _e( 'That\'s not a valid UA ID, please make sure it matches the expected pattern of: UA-XXXXXX-X, and that there are no spaces or other characters in the input field.', 'gawp' ); ?>");
137
+ jQuery(this).focus();
138
+ }
139
+ }
140
+ });
141
+ });
142
+ </script>
143
+ <link rel="shortcut icon" href="<?php echo GAWP_URL; ?>images/favicon.ico"/>
144
+ <?php
145
+ }
146
+ }
147
+
148
+ function plugin_help( $contextual_help, $screen_id, $screen ) {
149
+ if ( $screen_id == 'settings_page_' . $this->hook ) {
150
+
151
+ $contextual_help = '<h2>' . __( 'Having problems?', 'gawp' ) . '</h2>' .
152
+ '<p>' . sprintf( __( "If you're having problems with this plugin, please refer to its <a href='%s'>FAQ page</a>.", 'gawp' ), 'http://yoast.com/wordpress/google-analytics/ga-wp-faq/' ) . '</p>';
153
+ }
154
+ return $contextual_help;
155
+ }
156
+
157
+ function save_settings() {
158
+ $options = get_option( $this->optionname );
159
+
160
+ if ( isset( $_REQUEST['reset'] ) && $_REQUEST['reset'] == "true" && isset( $_REQUEST['plugin'] ) && $_REQUEST['plugin'] == 'google-analytics-for-wordpress' ) {
161
+ $options = $this->set_defaults();
162
+ $options['msg'] = "<div class=\"updated\"><p>" . __( 'Google Analytics settings reset.', 'gawp' ) . "</p></div>\n";
163
+ } elseif ( isset( $_POST['submit'] ) && isset( $_POST['plugin'] ) && $_POST['plugin'] == 'google-analytics-for-wordpress' ) {
164
+
165
+ if ( !current_user_can( 'manage_options' ) ) wp_die( __( 'You cannot edit the Google Analytics for WordPress options.', 'gawp' ) );
166
+ check_admin_referer( 'analyticspp-config' );
167
+
168
+ foreach ( array( 'uastring', 'dlextensions', 'domainorurl', 'position', 'domain', 'customcode', 'ga_token', 'extraseurl', 'gajsurl', 'gfsubmiteventpv', 'trackprefix', 'ignore_userlevel', 'internallink', 'internallinklabel', 'primarycrossdomain', 'othercrossdomains' ) as $option_name ) {
169
+ if ( isset( $_POST[$option_name] ) )
170
+ $options[$option_name] = $_POST[$option_name];
171
+ else
172
+ $options[$option_name] = '';
173
+ }
174
+
175
+ foreach ( array( 'extrase', 'trackoutbound', 'admintracking', 'trackadsense', 'allowanchor', 'allowlinker', 'allowhash', 'rsslinktagging', 'advancedsettings', 'trackregistration', 'theme_updated', 'cv_loggedin', 'cv_authorname', 'cv_category', 'cv_all_categories', 'cv_tags', 'cv_year', 'cv_post_type', 'outboundpageview', 'downloadspageview', 'trackcrossdomain', 'gajslocalhosting', 'manual_uastring', 'taggfsubmit', 'wpec_tracking', 'shopp_tracking', 'anonymizeip', 'trackcommentform', 'debug', 'firebuglite', 'yoast_tracking' ) as $option_name ) {
176
+ if ( isset( $_POST[$option_name] ) && $_POST[$option_name] == 'on' )
177
+ $options[$option_name] = true;
178
+ else
179
+ $options[$option_name] = false;
180
+ }
181
+
182
+ if ( isset( $_POST['manual_uastring'] ) && isset( $_POST['uastring_man'] ) ) {
183
+ $options['uastring'] = $_POST['uastring_man'];
184
+ }
185
+
186
+ if ( $options['trackcrossdomain'] ) {
187
+ if ( !$options['allowlinker'] )
188
+ $options['allowlinker'] = true;
189
+
190
+ if ( empty( $options['primarycrossdomain'] ) ) {
191
+ $origin = yoast_ga_get_domain( $_SERVER["HTTP_HOST"] );
192
+ $options['primarycrossdomain'] = $origin["domain"];
193
+ }
194
+ }
195
+
196
+ if ( function_exists( 'w3tc_pgcache_flush' ) )
197
+ w3tc_pgcache_flush();
198
+
199
+ if ( function_exists( 'w3tc_dbcache_flush' ) )
200
+ w3tc_dbcache_flush();
201
+
202
+ if ( function_exists( 'w3tc_minify_flush' ) )
203
+ w3tc_minify_flush();
204
+
205
+ if ( function_exists( 'w3tc_objectcache_flush' ) )
206
+ w3tc_objectcache_flush();
207
+
208
+ if ( function_exists( 'wp_cache_clear_cache' ) )
209
+ wp_cache_clear_cache();
210
+
211
+ $options['msg'] = "<div id=\"updatemessage\" class=\"updated fade\"><p>" . __( "Google Analytics settings updated.", "gawp" ) . "</p></div>\n";
212
+ $options['msg'] .= "<script type=\"text/javascript\">setTimeout(function(){jQuery('#updatemessage').hide('slow');}, 3000);</script>";
213
+ }
214
+ update_option( $this->optionname, $options );
215
+ }
216
+
217
+ function save_button() {
218
+ return '<div class="alignright"><input type="submit" class="button-primary" name="submit" value="' . __( 'Update Google Analytics Settings &raquo;', 'gawp' ) . '" /></div><br class="clear"/>';
219
+ }
220
+
221
+ function upgrade() {
222
+ $options = get_option( $this->optionname );
223
+ if ( isset( $options['version'] ) && $options['version'] < '4.04' ) {
224
+ if ( !isset( $options['ignore_userlevel'] ) || $options['ignore_userlevel'] == '' )
225
+ $options['ignore_userlevel'] = 11;
226
+ }
227
+ if ( !isset( $options['version'] ) || $options['version'] != GAWP_VERSION ) {
228
+ $options['version'] = GAWP_VERSION;
229
+ }
230
+ update_option( $this->optionname, $options );
231
+ }
232
+
233
+ function config_page() {
234
+ $options = get_option( $this->optionname );
235
+ if ( isset( $options['msg'] ) )
236
+ echo $options['msg'];
237
+ $options['msg'] = '';
238
+ update_option( $this->optionname, $options );
239
+
240
+ if ( !isset( $options['uastring'] ) )
241
+ $options = $this->set_defaults();
242
+ $modules = array();
243
+
244
+ if ( !isset( $options['manual_uastring'] ) )
245
+ $options['manual_uastring'] = '';
246
+ ?>
247
+ <div class="wrap">
248
+ <a href="http://yoast.com/">
249
+ <div id="yoast-icon"
250
+ style="background: url('<?php echo GAWP_URL; ?>images/ga-icon-32x32.png') no-repeat;"
251
+ class="icon32"><br/></div>
252
+ </a>
253
+
254
+ <h2><?php _e( "Google Analytics for WordPress Configuration", 'gawp' ) ?></h2>
255
+
256
+ <div class="postbox-container" style="width:60%;">
257
+ <div class="metabox-holder">
258
+ <div class="meta-box-sortables">
259
+ <form action="<?php echo $this->plugin_options_url(); ?>" method="post" id="analytics-conf">
260
+ <input type="hidden" name="plugin" value="google-analytics-for-wordpress"/>
261
+ <?php
262
+ wp_nonce_field( 'analyticspp-config' );
263
+
264
+ if ( empty( $options['uastring'] ) && empty( $options['ga_token'] ) ) {
265
+ $query = $this->plugin_options_url() . '&reauth=true';
266
+ $line = __( 'Please authenticate with Google Analytics to retrieve your tracking code:', 'gawp' ) . '<br/><br/> <a class="button-primary" href="' . $query . '">' . __( 'Click here to authenticate with Google', 'gawp' ) . '</a>';
267
+ } else if ( isset( $options['ga_token'] ) && !empty( $options['ga_token'] ) ) {
268
+ $token = $options['ga_token'];
269
+
270
+ require_once plugin_dir_path( __FILE__ ) . 'xmlparser.php';
271
+ if ( file_exists( ABSPATH . 'wp-includes/class-http.php' ) )
272
+ require_once( ABSPATH . 'wp-includes/class-http.php' );
273
+
274
+ if ( !isset( $options['ga_api_responses'][$token] ) ) {
275
+ $options['ga_api_responses'] = array();
276
+
277
+ if ( $oauth = $options['gawp_oauth'] ) {
278
+ if ( isset( $oauth['params']['oauth_token'], $oauth['params']['oauth_token_secret'] ) ) {
279
+ $options['gawp_oauth']['access_token'] = array(
280
+ 'oauth_token' => base64_decode( $oauth['params']['oauth_token'] ),
281
+ 'oauth_token_secret' => base64_decode( $oauth['params']['oauth_token_secret'] )
282
+ );
283
+ unset( $options['gawp_oauth']['params'] );
284
+ update_option( $this->optionname, $options );
285
+ }
286
+ }
287
+
288
+ $args = array(
289
+ 'scope' => 'https://www.google.com/analytics/feeds/',
290
+ 'xoauth_displayname' => 'Google Analytics for WordPress by Yoast'
291
+ );
292
+ $access_token = $options['gawp_oauth']['access_token'];
293
+ $gdata = new WP_Gdata( $args, $access_token['oauth_token'], $access_token['oauth_token_secret'] );
294
+
295
+
296
+ $response = $gdata->get( 'https://www.googleapis.com/analytics/v2.4/management/accounts/~all/webproperties/~all/profiles' );
297
+ $http_code = wp_remote_retrieve_response_code( $response );
298
+ $response = wp_remote_retrieve_body( $response );
299
+
300
+
301
+ if ( $http_code == 200 ) {
302
+ $options['ga_api_responses'][$token] = array(
303
+ 'response' => array( 'code' => $http_code ),
304
+ 'body' => $response
305
+ );
306
+ $options['ga_token'] = $token;
307
+ update_option( 'Yoast_Google_Analytics', $options );
308
+ }
309
+ }
310
+
311
+ if ( isset( $options['ga_api_responses'][$token] ) && is_array( $options['ga_api_responses'][$token] ) && $options['ga_api_responses'][$token]['response']['code'] == 200 ) {
312
+ $arr = yoast_xml2array( $options['ga_api_responses'][$token]['body'] );
313
+
314
+ $ga_accounts = array();
315
+
316
+ $currentua = '';
317
+ if ( !empty( $options['uastring'] ) )
318
+ $currentua = $options['uastring'];
319
+
320
+ // Check whether the feed output is the new one, first set, or the old one, second set.
321
+ if ( $arr['feed']['link_attr']['href'] == 'https://www.googleapis.com/analytics/v2.4/management/accounts/~all/webproperties/~all/profiles' ) {
322
+ foreach ( $arr['feed']['entry'] as $site ) {
323
+ if ( isset( $site['dxp:property']['1_attr']['value'] ) )
324
+ $ua = trim( $site['dxp:property']['1_attr']['value'] );
325
+ if ( isset( $site['dxp:property']['2_attr']['value'] ) )
326
+ $title = trim( $site['dxp:property']['2_attr']['value'] );
327
+ if ( !empty( $ua ) && !empty( $title ) )
328
+ $ga_accounts[$ua] = $title;
329
+ }
330
+ } else if ( $arr['feed']['link_attr']['href'] == 'https://www.google.com/analytics/feeds/accounts/default' ) {
331
+ foreach ( $arr['feed']['entry'] as $site ) {
332
+ if ( isset( $site['dxp:property']['3_attr']['value'] ) )
333
+ $ua = trim( $site['dxp:property']['3_attr']['value'] );
334
+ if ( isset( $site['dxp:property']['1_attr']['value'] ) )
335
+ $title = trim( $site['dxp:property']['1_attr']['value'] );
336
+ if ( !empty( $ua ) && !empty( $title ) )
337
+ $ga_accounts[$ua] = $title;
338
+ }
339
+ }
340
+ asort( $ga_accounts );
341
+
342
+ $select = '<select class="chzn-select" name="uastring" data-placeholder="' . __( 'Please select the correct Analytics Account', 'gawp' ) . '" id="ga_account">';
343
+ $select .= "\t<option></option>\n";
344
+ foreach ( $ga_accounts as $ua => $title ) {
345
+ $sel = selected( $ua, $currentua, false );
346
+ $select .= "\t" . '<option ' . $sel . ' value="' . $ua . '">' . $title . ' - ' . $ua . '</option>' . "\n";
347
+ }
348
+ $select .= '</select>';
349
+
350
+ $line = '<input type="hidden" name="ga_token" value="' . $token . '"/>';
351
+ $line .= __( 'Please select the correct Analytics account to track:', 'gawp' ) . '<br/>';
352
+ $line .= '<table class="form_table">';
353
+ $line .= '<tr><th>' . __( 'Profile', 'gawp' ) . ':</th><td>' . $select . '</td></tr>';
354
+ $line .= '</table>';
355
+
356
+ $try = 1;
357
+ if ( isset( $_GET['try'] ) )
358
+ $try = $_GET['try'] + 1;
359
+
360
+ if ( count( $ga_accounts ) == 0 && $try < 4 && isset( $_GET['token'] ) ) {
361
+ $line .= '<script type="text/javascript">
362
+ window.location="' . $this->plugin_options_url() . '&switchua=1&token=' . $token . '&try=' . $try . '";
363
+ </script>';
364
+ }
365
+ $line .= __( 'Please note that if you have several profiles of the same website, it doesn\'t matter which profile you select, and in fact another profile might show as selected later. You can check whether they\'re profiles for the same site by checking if they have the same UA code. If that\'s true, tracking will be correct.', 'gawp' );
366
+ $line .= '<br/><br/>';
367
+ $line .= __( 'Refresh this listing or switch to another account: ', 'gawp' );
368
+ } else {
369
+ $line = __( 'Unfortunately, an error occurred while connecting to Google, please try again:', 'gawp' );
370
+ }
371
+
372
+ $query = $this->plugin_options_url() . '&reauth=true';
373
+ $line .= '<a class="button" href="' . $query . '">' . __( 'Re-authenticate with Google', 'gawp' ) . '</a>';
374
+ } else {
375
+ $line = '<input id="uastring" name="uastring" type="text" size="20" maxlength="40" value="' . $options['uastring'] . '"/><br/><a href="' . $this->plugin_options_url() . '&amp;switchua=1">' . __( 'Select another Analytics Profile &raquo;', 'gawp' ) . '</a>';
376
+ }
377
+ $line = '<div id="uastring_automatic">' . $line . '</div><div style="display:none;" id="uastring_manual">' . __( 'Manually enter your UA code: ', 'gawp' ) . '<input id="uastring" name="uastring_man" type="text" size="20" maxlength="40" value="' . $options['uastring'] . '"/></div>';
378
+ $rows = array();
379
+ $content = '';
380
+ $rows[] = array(
381
+ 'id' => 'uastring',
382
+ 'label' => __( 'Analytics Profile', 'gawp' ),
383
+ 'desc' => '<input type="checkbox" name="manual_uastring" ' . checked( $options['manual_uastring'], true, false ) . ' id="switchtomanual"/> <label for="switchtomanual">' . __( 'Manually enter your UA code', 'gawp' ) . '</label>',
384
+ 'content' => $line
385
+ );
386
+ $temp_content = $this->select( 'position', array( 'header' => __( 'In the header (default)', 'gawp' ), 'manual' => __( 'Insert manually', 'gawp' ) ) );
387
+ if ( $options['theme_updated'] && $options['position'] == 'manual' ) {
388
+ $temp_content .= '<input type="hidden" name="theme_updated" value="off"/>';
389
+ echo '<div id="message" class="updated" style="background-color:lightgreen;border-color:green;"><p><strong>' . __( 'Notice', 'gawp' ), ':</strong> ' . __( 'You switched your theme, please make sure your Google Analytics tracking is still ok. Save your settings to make sure Google Analytics gets loaded properly.', 'gawp' ) . '</p></div>';
390
+ remove_action( 'admin_footer', array( &$this, 'theme_switch_warning' ) );
391
+ }
392
+ $desc = '<div id="position_header">' . sprintf( __( 'The header is by far the best spot to place the tracking code. If you\'d rather place the code manually, switch to manual placement. For more info %sread this page%s.' ), '<a href="http://yoast.com/wordpress/google-analytics/manual-placement/">', '</a>' ) . '</div>';
393
+ $desc .= '<div id="position_manual">' . sprintf( __( '%sFollow the instructions here%s to choose the location for your tracking code manually.', 'gawp' ), '<a href="http://yoast.com/wordpress/google-analytics/manual-placement/">', '</a>' ) . '</div>';
394
+
395
+ $rows[] = array(
396
+ 'id' => 'position',
397
+ 'label' => __( 'Where should the tracking code be placed', 'gawp' ),
398
+ 'desc' => $desc,
399
+ 'content' => $temp_content,
400
+ );
401
+ $rows[] = array(
402
+ 'id' => 'trackoutbound',
403
+ 'label' => __( 'Track outbound clicks &amp; downloads', 'gawp' ),
404
+ 'desc' => __( 'Clicks &amp; downloads will be tracked as events, you can find these under Content &raquo; Event Tracking in your Google Analytics reports.', 'gawp' ),
405
+ 'content' => $this->checkbox( 'trackoutbound' ),
406
+ );
407
+ $rows[] = array(
408
+ 'id' => 'advancedsettings',
409
+ 'label' => __( 'Show advanced settings', 'gawp' ),
410
+ 'desc' => __( 'Only adviced for advanced users who know their way around Google Analytics', 'gawp' ),
411
+ 'content' => $this->checkbox( 'advancedsettings' ),
412
+ );
413
+ $rows[] = array(
414
+ 'id' => 'yoast_tracking',
415
+ 'label' => __( 'Allow tracking of anonymous data', 'gawp' ),
416
+ 'desc' => __( 'By allowing us to track anonymous data we can better help you, because we know with which WordPress configurations, themes and plugins we should test. No personal data will be submitted.', 'gawp' ),
417
+ 'content' => $this->checkbox( 'yoast_tracking' ),
418
+ );
419
+ $this->postbox( 'gasettings', __( 'Google Analytics Settings', 'gawp' ), $this->form_table( $rows ) . $this->save_button() );
420
+
421
+ $rows = array();
422
+ $pre_content = '<p>' . __( 'Google Analytics allows you to save up to 5 custom variables on each page, and this plugin helps you make the most use of these! Check which custom variables you\'d like the plugin to save for you below. Please note that these will only be saved when they are actually available.', 'gawp' ) . '</p>';
423
+ $pre_content .= '<p>' . __( 'If you want to start using these custom variables, go to Visitors &raquo; Custom Variables in your Analytics reports.', 'gawp' ) . '</p>';
424
+ $rows[] = array(
425
+ 'id' => 'cv_loggedin',
426
+ 'label' => __( 'Logged in Users', 'gawp' ),
427
+ 'desc' => __( 'Allows you to easily remove logged in users from your reports, or to segment by different user roles. The users primary role will be logged.', 'gawp' ),
428
+ 'content' => $this->checkbox( 'cv_loggedin' ),
429
+ );
430
+ $rows[] = array(
431
+ 'id' => 'cv_post_type',
432
+ 'label' => __( 'Post type', 'gawp' ),
433
+ 'desc' => __( 'Allows you to see pageviews per post type, especially useful if you use multiple custom post types.', 'gawp' ),
434
+ 'content' => $this->checkbox( 'cv_post_type' ),
435
+ );
436
+ $rows[] = array(
437
+ 'id' => 'cv_authorname',
438
+ 'label' => __( 'Author Name', 'gawp' ),
439
+ 'desc' => __( 'Allows you to see pageviews per author.', 'gawp' ),
440
+ 'content' => $this->checkbox( 'cv_authorname' ),
441
+ );
442
+ $rows[] = array(
443
+ 'id' => 'cv_tags',
444
+ 'label' => __( 'Tags', 'gawp' ),
445
+ 'desc' => __( 'Allows you to see pageviews per tags using advanced segments.', 'gawp' ),
446
+ 'content' => $this->checkbox( 'cv_tags' ),
447
+ );
448
+ $rows[] = array(
449
+ 'id' => 'cv_year',
450
+ 'label' => __( 'Publication year', 'gawp' ),
451
+ 'desc' => __( 'Allows you to see pageviews per year of publication, showing you if your old posts still get traffic.', 'gawp' ),
452
+ 'content' => $this->checkbox( 'cv_year' ),
453
+ );
454
+ $rows[] = array(
455
+ 'id' => 'cv_category',
456
+ 'label' => __( 'Single Category', 'gawp' ),
457
+ 'desc' => __( 'Allows you to see pageviews per category, works best when each post is in only one category.', 'gawp' ),
458
+ 'content' => $this->checkbox( 'cv_category' ),
459
+ );
460
+ $rows[] = array(
461
+ 'id' => 'cv_all_categories',
462
+ 'label' => __( 'All Categories', 'gawp' ),
463
+ 'desc' => __( 'Allows you to see pageviews per category using advanced segments, should be used when you use multiple categories per post.', 'gawp' ),
464
+ 'content' => $this->checkbox( 'cv_all_categories' ),
465
+ );
466
+
467
+ $modules['Custom Variables'] = 'customvarsettings';
468
+ $this->postbox( 'customvarsettings', __( 'Custom Variables Settings', 'gawp' ), $pre_content . $this->form_table( $rows ) . $this->save_button() );
469
+
470
+ $rows = array();
471
+ $rows[] = array(
472
+ 'id' => 'ignore_userlevel',
473
+ 'label' => __( 'Ignore users', 'gawp' ),
474
+ 'desc' => __( 'Users of the role you select and higher will be ignored, so if you select Editor, all Editors and Administrators will be ignored.', 'gawp' ),
475
+ 'content' => $this->select( 'ignore_userlevel', array(
476
+ '11' => __( 'Ignore no-one', 'gawp' ),
477
+ '8' => __( 'Administrator', 'gawp' ),
478
+ '5' => __( 'Editor', 'gawp' ),
479
+ '2' => __( 'Author', 'gawp' ),
480
+ '1' => __( 'Contributor', 'gawp' ),
481
+ '0' => __( 'Subscriber (ignores all logged in users)', 'gawp' ),
482
+ ) ),
483
+ );
484
+ $rows[] = array(
485
+ 'id' => 'outboundpageview',
486
+ 'label' => __( 'Track outbound clicks as pageviews', 'gawp' ),
487
+ 'desc' => __( 'You do not need to enable this to enable outbound click tracking, this changes the default behavior of tracking clicks as events to tracking them as pageviews. This is therefore not recommended, as this would skew your statistics, but <em>is</em> sometimes necessary when you need to set outbound clicks as goals.', 'gawp' ),
488
+ 'content' => $this->checkbox( 'outboundpageview' ),
489
+ );
490
+ $rows[] = array(
491
+ 'id' => 'downloadspageview',
492
+ 'label' => __( 'Track downloads as pageviews', 'gawp' ),
493
+ 'desc' => __( 'Not recommended, as this would skew your statistics, but it does make it possible to track downloads as goals.', 'gawp' ),
494
+ 'content' => $this->checkbox( 'downloadspageview' ),
495
+ );
496
+ $rows[] = array(
497
+ 'id' => 'dlextensions',
498
+ 'label' => __( 'Extensions of files to track as downloads', 'gawp' ),
499
+ 'content' => $this->textinput( 'dlextensions' ),
500
+ );
501
+ if ( $options['outboundpageview'] ) {
502
+ $rows[] = array(
503
+ 'id' => 'trackprefix',
504
+ 'label' => __( 'Prefix to use in Analytics before the tracked pageviews', 'gawp' ),
505
+ 'desc' => __( 'This prefix is used before all pageviews, they are then segmented automatically after that. If nothing is entered here, <code>/yoast-ga/</code> is used.', 'gawp' ),
506
+ 'content' => $this->textinput( 'trackprefix' ),
507
+ );
508
+ }
509
+ $rows[] = array(
510
+ 'id' => 'domainorurl',
511
+ 'label' => __( 'Track full URL of outbound clicks or just the domain', 'gawp' ),
512
+ 'content' => $this->select( 'domainorurl', array(
513
+ 'domain' => __( 'Just the domain', 'gawp' ),
514
+ 'url' => __( 'Track the complete URL', 'gawp' ),
515
+ )
516
+ ),
517
+ );
518
+ $rows[] = array(
519
+ 'id' => 'domain',
520
+ 'label' => __( 'Subdomain Tracking', 'gawp' ),
521
+ 'desc' => sprintf( __( 'This allows you to set the domain that\'s set by %s<code>setDomainName</code>%s for tracking subdomains, if empty this will not be set.', 'gawp' ), '<a href="http://code.google.com/apis/analytics/docs/gaJS/gaJSApiDomainDirectory.html#_gat.GA_Tracker_._setDomainName">', '</a>' ),
522
+ 'content' => $this->textinput( 'domain' ),
523
+ );
524
+ $rows[] = array(
525
+ 'id' => 'trackcrossdomain',
526
+ 'label' => __( 'Enable Cross Domain Tracking', 'gawp' ),
527
+ 'desc' => sprintf( __( 'This allows you to enable %sCross-Domain Tracking%s for this site. When endabled <code>_setAllowLinker:</code> will be enabled if it is not already.', 'gawp' ), '<a href="http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html">', '</a>' ),
528
+ 'content' => $this->checkbox( 'trackcrossdomain' ),
529
+ );
530
+ $rows[] = array(
531
+ 'id' => 'primarycrossdomain',
532
+ 'label' => __( 'Cross-Domain Tracking, Primary Domain', 'gawp' ),
533
+ 'desc' => sprintf( __( 'Set the primary domain used in %s<code>setDomainName</code>%s for cross domain tracking (eg. <code>example-petstore.com</code> ), if empty this will default to your configured Home URL.', 'gawp' ), '<a href="http://code.google.com/apis/analytics/docs/gaJS/gaJSApiDomainDirectory.html#_gat.GA_Tracker_._setDomainName">', '</a>' ),
534
+ 'content' => $this->textinput( 'primarycrossdomain' ),
535
+ );
536
+ $rows[] = array(
537
+ 'id' => 'othercrossdomains',
538
+ 'label' => __( 'Cross-Domain Tracking, Other Domains', 'gawp' ),
539
+ 'desc' => __( 'All links to these domains will have the <a href="http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html#multipleDomains"><code>_link</code></a> code automatically attached. Separate domains/sub-domains with commas (eg. <code>dogs.example-petstore.com, cats.example-petstore.com</code>)', 'gawp' ),
540
+ 'content' => $this->textinput( 'othercrossdomains' ),
541
+ );
542
+ $rows[] = array(
543
+ 'id' => 'customcode',
544
+ 'label' => __( 'Custom Code', 'gawp' ),
545
+ 'desc' => __( 'Not for the average user: this allows you to add a line of code, to be added before the <code>trackPageview</code> call.', 'gawp' ),
546
+ 'content' => $this->textinput( 'customcode' ),
547
+ );
548
+ $rows[] = array(
549
+ 'id' => 'trackadsense',
550
+ 'label' => __( 'Track AdSense', 'gawp' ),
551
+ 'desc' => __( 'This requires integration of your Analytics and AdSense account, for help, <a href="http://google.com/support/analytics/bin/answer.py?answer=92625">look here</a>.', 'gawp' ),
552
+ 'content' => $this->checkbox( 'trackadsense' ),
553
+ );
554
+ $rows[] = array(
555
+ 'id' => 'gajslocalhosting',
556
+ 'label' => __( 'Host ga.js locally', 'gawp' ),
557
+ 'content' => $this->checkbox( 'gajslocalhosting' ) . '<div id="localhostingbox">
558
+ ' . __( 'You have to provide a URL to your ga.js file:', 'gawp' ) . '
559
+ <input type="text" name="gajsurl" size="30" value="' . $options['gajsurl'] . '"/>
560
+ </div>',
561
+ 'desc' => __( 'For some reasons you might want to use a locally hosted ga.js file, or another ga.js file, check the box and then please enter the full URL including http here.', 'gawp' )
562
+ );
563
+ $rows[] = array(
564
+ 'id' => 'extrase',
565
+ 'label' => __( 'Track extra Search Engines', 'gawp' ),
566
+ 'content' => $this->checkbox( 'extrase' ) . '<div id="extrasebox">
567
+ ' . __( 'You can provide a custom URL to the extra search engines file if you want:', 'gawp' ) . '
568
+ <input type="text" name="extraseurl" size="30" value="' . $options['extraseurl'] . '"/>
569
+ </div>',
570
+ );
571
+ $rows[] = array(
572
+ 'id' => 'rsslinktagging',
573
+ 'label' => __( 'Tag links in RSS feed with campaign variables', 'gawp' ),
574
+ 'desc' => __( 'Do not use this feature if you use FeedBurner, as FeedBurner can do this automatically, and better than this plugin can. Check <a href="http://www.google.com/support/feedburner/bin/answer.py?hl=en&amp;answer=165769">this help page</a> for info on how to enable this feature in FeedBurner.', 'gawp' ),
575
+ 'content' => $this->checkbox( 'rsslinktagging' ),
576
+ );
577
+ $rows[] = array(
578
+ 'id' => 'trackregistration',
579
+ 'label' => __( 'Add tracking to the login and registration forms', 'gawp' ),
580
+ 'content' => $this->checkbox( 'trackregistration' ),
581
+ );
582
+ $rows[] = array(
583
+ 'id' => 'trackcommentform',
584
+ 'label' => __( 'Add tracking to the comment forms', 'gawp' ),
585
+ 'content' => $this->checkbox( 'trackcommentform' ),
586
+ );
587
+ $rows[] = array(
588
+ 'id' => 'allowanchor',
589
+ 'label' => __( 'Use # instead of ? for Campaign tracking', 'gawp' ),
590
+ 'desc' => __( 'This adds a <code><a href="http://code.google.com/apis/analytics/docs/gaJSApiCampaignTracking.html#_gat.GA_Tracker_._setAllowAnchor">_setAllowAnchor</a></code> call to your tracking code, and makes RSS link tagging use a # as well.', 'gawp' ),
591
+ 'content' => $this->checkbox( 'allowanchor' ),
592
+ );
593
+ $rows[] = array(
594
+ 'id' => 'allowlinker',
595
+ 'label' => __( 'Add <code>_setAllowLinker</code>', 'gawp' ),
596
+ 'desc' => __( 'This adds a <code><a href="http://code.google.com/apis/analytics/docs/gaJS/gaJSApiDomainDirectory.html#_gat.GA_Tracker_._setAllowLinker">_setAllowLinker</a></code> call to your tracking code, allowing you to use <code>_link</code> and related functions.', 'gawp' ),
597
+ 'content' => $this->checkbox( 'allowlinker' ),
598
+ );
599
+ $rows[] = array(
600
+ 'id' => 'allowhash',
601
+ 'label' => __( 'Set <code>_setAllowHash</code> to false', 'gawp' ),
602
+ 'desc' => __( 'This sets <code><a href="http://code.google.com/apis/analytics/docs/gaJS/gaJSApiDomainDirectory.html#_gat.GA_Tracker_._setAllowHash">_setAllowHash</a></code> to false, allowing you to track subdomains etc.', 'gawp' ),
603
+ 'content' => $this->checkbox( 'allowhash' ),
604
+ );
605
+ $rows[] = array(
606
+ 'id' => 'anonymizeip',
607
+ 'label' => __( 'Anonymize IP\'s', 'gawp' ),
608
+ 'desc' => __( 'This adds <code><a href="http://code.google.com/apis/analytics/docs/gaJS/gaJSApi_gat.html#_gat._anonymizeIp">_anonymizeIp</a></code>, telling Google Analytics to anonymize the information sent by the tracker objects by removing the last octet of the IP address prior to its storage.', 'gawp' ),
609
+ 'content' => $this->checkbox( 'anonymizeip' ),
610
+ );
611
+ $modules['Advanced Settings'] = 'advancedgasettings';
612
+ $this->postbox( 'advancedgasettings', __( 'Advanced Settings', 'gawp' ), $this->form_table( $rows ) . $this->save_button() );
613
+
614
+ $rows = array();
615
+ $rows[] = array(
616
+ 'id' => 'internallink',
617
+ 'label' => __( 'Internal links to track as outbound', 'gawp' ),
618
+ 'desc' => __( 'If you want to track all internal links that begin with <code>/out/</code>, enter <code>/out/</code> in the box above. If you have multiple prefixes you can separate them with comma\'s: <code>/out/,/recommends/</code>', 'gawp' ),
619
+ 'content' => $this->textinput( 'internallink' ),
620
+ );
621
+ $rows[] = array(
622
+ 'id' => 'internallinklabel',
623
+ 'label' => __( 'Label to use', 'gawp' ),
624
+ 'desc' => __( 'The label to use for these links, this will be added to where the click came from, so if the label is "aff", the label for a click from the content of an article becomes "outbound-article-aff".', 'gawp' ),
625
+ 'content' => $this->textinput( 'internallinklabel' ),
626
+ );
627
+ $modules['Internal Link Tracking'] = 'internallinktracking';
628
+ $this->postbox( 'internallinktracking', __( 'Internal Links to Track as Outbound', 'gawp' ), $this->form_table( $rows ) . $this->save_button() );
629
+
630
+ if ( defined( 'WPSC_VERSION' ) ) {
631
+ $pre_content = __( 'The WordPress e-Commerce plugin has been detected. This plugin can automatically add transaction tracking for you. To do that, <a href="http://yoast.com/wordpress/google-analytics/enable-ecommerce/">enable e-commerce for your reports in Google Analytics</a> and then check the box below.', 'gawp' );
632
+ $rows = array();
633
+ $rows[] = array(
634
+ 'id' => 'wpec_tracking',
635
+ 'label' => __( 'Enable transaction tracking', 'gawp' ),
636
+ 'content' => $this->checkbox( 'wpec_tracking' ),
637
+ );
638
+ $this->postbox( 'wpecommerce', __( 'WordPress e-Commerce Settings', 'gawp' ), $pre_content . $this->form_table( $rows ) . $this->save_button() );
639
+ $modules['WordPress e-Commerce'] = 'wpecommerce';
640
+ }
641
+
642
+ global $Shopp;
643
+ if ( isset( $Shopp ) ) {
644
+ $pre_content = __( 'The Shopp e-Commerce plugin has been detected. This plugin can automatically add transaction tracking for you. To do that, <a href="http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&amp;answer=55528">enable e-commerce for your reports in Google Analytics</a> and then check the box below.', 'gawp' );
645
+ $rows = array();
646
+ $rows[] = array(
647
+ 'id' => 'shopp_tracking',
648
+ 'label' => __( 'Enable transaction tracking', 'gawp' ),
649
+ 'content' => $this->checkbox( 'shopp_tracking' ),
650
+ );
651
+ $this->postbox( 'shoppecommerce', __( 'Shopp e-Commerce Settings', 'gawp' ), $pre_content . $this->form_table( $rows ) . $this->save_button() );
652
+ $modules['Shopp'] = 'shoppecommerce';
653
+ }
654
+ $pre_content = '<p>' . sprintf( __( 'If you want to confirm that tracking on your blog is working as it should, enable this option and check the console in %sFirebug%s (for Firefox), %sFirebug Lite%s (for other browsers) or Chrome &amp; Safari\'s Web Inspector. Be absolutely sure to disable debugging afterwards, as it is slower than normal tracking.', 'gawp' ), '<a href="http://getfirebug.com/">', '</a>', '<a href="http://getfirebug.com/firebuglite">', '</a>' ) . '</p>';
655
+ $pre_content .= '<p><strong>' . __( 'Note', 'gawp' ) . '</strong>: ' . __( 'the debugging and firebug scripts are only loaded for admins.', 'gawp' ) . '</p>';
656
+ $rows = array();
657
+ $rows[] = array(
658
+ 'id' => 'debug',
659
+ 'label' => __( 'Enable debug mode', 'gawp' ),
660
+ 'content' => $this->checkbox( 'debug' ),
661
+ );
662
+ $rows[] = array(
663
+ 'id' => 'firebuglite',
664
+ 'label' => __( 'Enable Firebug Lite', 'gawp' ),
665
+ 'content' => $this->checkbox( 'firebuglite' ),
666
+ );
667
+ $this->postbox( 'debugmode', __( 'Debug Mode', 'gawp' ), $pre_content . $this->form_table( $rows ) . $this->save_button() );
668
+ $modules['Debug Mode'] = 'debugmode';
669
+ ?>
670
+ </form>
671
+ <form action="<?php echo $this->plugin_options_url(); ?>" method="post"
672
+ onsubmit="javascript:return(confirm('<?php _e( 'Do you really want to reset all settings?', 'gawp' ); ?>'));">
673
+ <input type="hidden" name="reset" value="true"/>
674
+ <input type="hidden" name="plugin" value="google-analytics-for-wordpress"/>
675
+
676
+ <div class="submit"><input type="submit" value="<?php _e( 'Reset All Settings &raquo;', 'gawp' ); ?>'"/></div>
677
+ </form>
678
+ </div>
679
+ </div>
680
+ </div>
681
+ <div class="postbox-container side" style="width:261px;">
682
+ <div class="metabox-holder">
683
+ <div class="meta-box-sortables">
684
+ <?php
685
+ $this->postbox( 'spread', '<strong>' . __( 'Help Spread the Word!', 'gawp' ) . '</strong>',
686
+ '<ul>'
687
+ . '<li><a href="http://wordpress.org/extend/plugins/google-analytics-for-wordpress/">' . __( 'Rate the plugin 5★ on WordPress.org', 'gawp' ) . '</a></li>'
688
+ . '<li><a href="http://wordpress.org/tags/google-analytics-for-wordpress">' . __( 'Help out other users in the forums', 'gawp' ) . '</a></li>'
689
+ . '<li>' . sprintf( __( 'Blog about it & link to the %1$splugin page%2$s' ), '<a href="http://yoast.com/wordpress/google-analytics/#utm_source=wpadmin&utm_medium=sidebanner&utm_term=link&utm_campaign=wpgaplugin">', '</a>' ) . '</li></ul>' );
690
+ ?>
691
+ <a target="_blank"
692
+ href="https://yoast.com/hire-us/website-review/#utm_source=gawp-config&utm_medium=banner&utm_campaign=website-review-banner"><img
693
+ src="<?php echo GAWP_URL; ?>images/banner-website-review.png" alt="Website Review banner"/></a>
694
+ </div>
695
+ <br/><br/><br/>
696
+ </div>
697
+ </div>
698
+ </div>
699
+ <?php
700
+ }
701
+
702
+ function set_defaults() {
703
+ $options = array(
704
+ 'advancedsettings' => false,
705
+ 'allowanchor' => false,
706
+ 'allowhash' => false,
707
+ 'allowlinker' => false,
708
+ 'anonymizeip' => false,
709
+ 'customcode' => '',
710
+ 'cv_loggedin' => false,
711
+ 'cv_authorname' => false,
712
+ 'cv_category' => false,
713
+ 'cv_all_categories' => false,
714
+ 'cv_tags' => false,
715
+ 'cv_year' => false,
716
+ 'cv_post_type' => false,
717
+ 'debug' => false,
718
+ 'dlextensions' => 'doc,exe,js,pdf,ppt,tgz,zip,xls',
719
+ 'domain' => '',
720
+ 'domainorurl' => 'domain',
721
+ 'extrase' => false,
722
+ 'extraseurl' => '',
723
+ 'firebuglite' => false,
724
+ 'ga_token' => '',
725
+ 'ga_api_responses' => array(),
726
+ 'gajslocalhosting' => false,
727
+ 'gajsurl' => '',
728
+ 'ignore_userlevel' => '11',
729
+ 'internallink' => false,
730
+ 'internallinklabel' => '',
731
+ 'outboundpageview' => false,
732
+ 'downloadspageview' => false,
733
+ 'othercrossdomains' => '',
734
+ 'position' => 'footer',
735
+ 'primarycrossdomain' => '',
736
+ 'theme_updated' => false,
737
+ 'trackcommentform' => true,
738
+ 'trackcrossdomain' => false,
739
+ 'trackadsense' => false,
740
+ 'trackoutbound' => true,
741
+ 'trackregistration' => false,
742
+ 'rsslinktagging' => true,
743
+ 'uastring' => '',
744
+ 'version' => GAWP_VERSION,
745
+ );
746
+ update_option( $this->optionname, $options );
747
+ return $options;
748
+ }
749
+
750
+ function warning() {
751
+ $options = get_option( $this->optionname );
752
+ if ( !isset( $options['uastring'] ) || empty( $options['uastring'] ) ) {
753
+ echo "<div id='message' class='error'><p><strong>" . __( "Google Analytics is not active.", 'gawp' ) . "</strong> " . sprintf( __( "You must %sselect which Analytics Profile to track%s before it can work.", 'gawp' ), "<a href='" . $this->plugin_options_url() . "'>", "</a>" ) . "</p></div>";
754
+ }
755
+ } // end warning()
756
+
757
+
758
+ function authenticate() {
759
+ if ( isset( $_REQUEST['ga_oauth_callback'] ) ) {
760
+ $o = get_option( $this->optionname );
761
+ if ( isset( $o['gawp_oauth']['oauth_token'] ) && $o['gawp_oauth']['oauth_token'] == $_REQUEST['oauth_token'] ) {
762
+ $gdata = new WP_GData(
763
+ array(
764
+ 'scope' => 'https://www.google.com/analytics/feeds/',
765
+ 'xoauth_displayname' => 'Google Analytics for WordPress by Yoast'
766
+ ),
767
+ $o['gawp_oauth']['oauth_token'],
768
+ $o['gawp_oauth']['oauth_token_secret']
769
+ );
770
+
771
+ $o['gawp_oauth']['access_token'] = $gdata->get_access_token( $_REQUEST['oauth_verifier'] );
772
+ unset( $o['gawp_oauth']['oauth_token'] );
773
+ unset( $o['gawp_oauth']['oauth_token_secret'] );
774
+ $o['ga_token'] = $o['gawp_oauth']['access_token']['oauth_token'];
775
+ }
776
+
777
+ update_option( $this->optionname, $o );
778
+
779
+ wp_redirect( menu_page_url( $this->hook, false ) );
780
+ exit;
781
+ }
782
+
783
+ if ( !empty( $_GET['reauth'] ) ) {
784
+ $gdata = new WP_GData(
785
+ array(
786
+ 'scope' => 'https://www.google.com/analytics/feeds/',
787
+ 'xoauth_displayname' => 'Google Analytics for WordPress by Yoast'
788
+ )
789
+ );
790
+
791
+ $oauth_callback = add_query_arg( array( 'ga_oauth_callback' => 1 ), menu_page_url( 'google-analytics-for-wordpress', false ) );
792
+ $request_token = $gdata->get_request_token( $oauth_callback );
793
+
794
+ $options = get_option( $this->optionname );
795
+ unset( $options['ga_token'] );
796
+ unset( $options['gawp_oauth']['access_token'] );
797
+ $options['gawp_oauth']['oauth_token'] = $request_token['oauth_token'];
798
+ $options['gawp_oauth']['oauth_token_secret'] = $request_token['oauth_token_secret'];
799
+ update_option( $this->optionname, $options );
800
+
801
+ wp_redirect( $gdata->get_authorize_url( $request_token ) );
802
+ exit;
803
+ }
804
+
805
+ } //end reauthenticate()
806
+ } // end class GA_Admin
807
+
808
+ $ga_admin = new GA_Admin();
class-pointer.php → admin/class-pointer.php RENAMED
@@ -41,10 +41,10 @@ class GA_Pointer {
41
  'position' => array( 'edge' => 'top', 'align' => 'center' )
42
  );
43
  $button2 = __( 'Allow tracking', 'gawp' );
44
- $nonce = wp_create_nonce( 'wpga_activate_presstrends' );
45
 
46
- $function2 = 'document.location="' . admin_url( 'options-general.php?page=google-analytics-for-wordpress&allow_tracking=yes&nonce=' . $nonce ) . '";';
47
- $function1 = 'document.location="' . admin_url( 'options-general.php?page=google-analytics-for-wordpress&allow_tracking=no&nonce=' . $nonce ) . '";';
48
 
49
  $this->print_scripts( $id, $opt_arr, __( 'Do not allow tracking', 'gawp' ), $button2, $function2, $function1 );
50
  }
@@ -76,7 +76,19 @@ class GA_Pointer {
76
  ?>
77
  <script type="text/javascript">
78
  //<![CDATA[
79
- (function ($) {
 
 
 
 
 
 
 
 
 
 
 
 
80
  var gawp_pointer_options = <?php echo json_encode( $options ); ?>, setup;
81
 
82
  gawp_pointer_options = $.extend(gawp_pointer_options, {
@@ -99,11 +111,7 @@ class GA_Pointer {
99
  <?php echo $button2_function; ?>
100
  });
101
  jQuery('#pointer-close').click(function () {
102
- <?php if ( $button1_function == '' ) { ?>
103
- wpseo_setIgnore("tour", "wp-pointer-0", "<?php echo wp_create_nonce( 'wpseo-ignore' ); ?>");
104
- <?php } else { ?>
105
  <?php echo $button1_function; ?>
106
- <?php } ?>
107
  });
108
  <?php } ?>
109
  };
41
  'position' => array( 'edge' => 'top', 'align' => 'center' )
42
  );
43
  $button2 = __( 'Allow tracking', 'gawp' );
44
+ $nonce = wp_create_nonce( 'wpga_activate_tracking' );
45
 
46
+ $function2 = 'wpga_store_answer("yes","'.$nonce.'");';
47
+ $function1 = 'wpga_store_answer("no","'.$nonce.'");';
48
 
49
  $this->print_scripts( $id, $opt_arr, __( 'Do not allow tracking', 'gawp' ), $button2, $function2, $function1 );
50
  }
76
  ?>
77
  <script type="text/javascript">
78
  //<![CDATA[
79
+ function wpga_store_answer( input, nonce ) {
80
+ var wpga_tracking_data = {
81
+ action : 'wpga_tracking_data',
82
+ allow_tracking : input,
83
+ nonce: nonce
84
+ }
85
+ jQuery.post( ajaxurl, wpga_tracking_data, function( response ) {
86
+ alert( 'done: ' + input + response );
87
+ jQuery('#wp-pointer-0').remove();
88
+ } );
89
+ }
90
+
91
+ (function ($) {
92
  var gawp_pointer_options = <?php echo json_encode( $options ); ?>, setup;
93
 
94
  gawp_pointer_options = $.extend(gawp_pointer_options, {
111
  <?php echo $button2_function; ?>
112
  });
113
  jQuery('#pointer-close').click(function () {
 
 
 
114
  <?php echo $button1_function; ?>
 
115
  });
116
  <?php } ?>
117
  };
{wp-gdata → admin/wp-gdata}/OAuth.php RENAMED
File without changes
{wp-gdata → admin/wp-gdata}/wp-gdata.php RENAMED
File without changes
xmlparser.php → admin/xmlparser.php RENAMED
File without changes
admin/yst_plugin_tools.css ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ td.yst_desc {
2
+ font-weight: normal;
3
+ font-size: 13px;
4
+ line-height: 14px;
5
+ color: #777;
6
+ }
7
+
8
+ tr.yst_row {
9
+ padding: 5px 0 0 0;
10
+ margin: 5px 0 0 0;
11
+ }
12
+
13
+ tr.yst_row.even {
14
+ background-color: #f6f6f6;
15
+ }
16
+
17
+ div.inside ul {
18
+ margin-left: 20px;
19
+ }
20
+
21
+ div.inside ul li {
22
+ list-style: square;
23
+ line-height: 16px;
24
+ }
25
+
26
+ div.inside a, div.inside a.rsswidget {
27
+ font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
28
+ text-decoration: none;
29
+ }
30
+
31
+ div.inside a:hover, div.inside a.rsswidget:hover {
32
+ text-decoration: underline;
33
+ }
34
+
35
+ .text, .select {
36
+ width: 250px;
37
+ }
38
+
39
+ .postbox p {
40
+ text-align: left;
41
+ margin: 0 10px 10px 10px;
42
+ font-size: 13px;
43
+ line-height: 150%;
44
+ }
45
+
46
+ .postbox pre {
47
+ margin: 5px 10px;
48
+ padding: 4px;
49
+ background: lightyellow;
50
+ }
51
+
52
+ div.inside .button:hover, div.inside .button-primary:hover {
53
+ text-decoration: none;
54
+ }
55
+
56
+ .postbox#spread {
57
+ border: green solid 2px;
58
+ }
59
+
60
+ .postbox#spread strong {
61
+ color: green;
62
+ font-weight: bold;
63
+ font-size: 105%;
64
+ }
65
+
66
+ .postbox {
67
+ margin: 0 10px 10px 0;
68
+ }
admin/yst_plugin_tools.php ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Backend Class for use in all Yoast plugins
5
+ * Version 0.2
6
+ */
7
+
8
+ if ( !class_exists( 'Yoast_GA_Plugin_Admin' ) ) {
9
+ class Yoast_GA_Plugin_Admin {
10
+
11
+ var $hook = '';
12
+ var $filename = '';
13
+ var $longname = '';
14
+ var $shortname = '';
15
+ var $optionname = '';
16
+ var $accesslvl = 'edit_users';
17
+
18
+ function Yoast_GA_Plugin_Admin() {
19
+ add_action( 'admin_menu', array( &$this, 'register_settings_page' ) );
20
+ add_filter( 'plugin_action_links', array( &$this, 'add_action_link' ), 10, 2 );
21
+
22
+ add_action( 'admin_print_scripts', array( &$this, 'config_page_scripts' ) );
23
+ add_action( 'admin_print_styles', array( &$this, 'config_page_styles' ) );
24
+
25
+ add_action( 'wp_dashboard_setup', array( &$this, 'widget_setup' ) );
26
+ }
27
+
28
+ function config_page_styles() {
29
+ if ( isset( $_GET['page'] ) && $_GET['page'] == $this->hook ) {
30
+ wp_enqueue_style( 'dashboard' );
31
+ wp_enqueue_style( 'thickbox' );
32
+ wp_enqueue_style( 'global' );
33
+ wp_enqueue_style( 'wp-admin' );
34
+ wp_enqueue_style( 'gawp-css', plugin_dir_url( __FILE__ ) . 'yst_plugin_tools.css' );
35
+ }
36
+ }
37
+
38
+ function register_settings_page() {
39
+ add_options_page( $this->longname, $this->shortname, $this->accesslvl, $this->hook, array( &$this, 'config_page' ) );
40
+ }
41
+
42
+ function plugin_options_url() {
43
+ return admin_url( 'options-general.php?page=' . $this->hook );
44
+ }
45
+
46
+ /**
47
+ * Add a link to the settings page to the plugins list
48
+ */
49
+ function add_action_link( $links, $file ) {
50
+ static $this_plugin;
51
+ if ( empty( $this_plugin ) )
52
+ $this_plugin = 'google-analytics-for-wordpress/googleanalytics.php';
53
+ if ( $file == $this_plugin ) {
54
+ $settings_link = '<a href="' . $this->plugin_options_url() . '">' . __( 'Settings', 'gawp' ) . '</a>';
55
+ array_unshift( $links, $settings_link );
56
+ }
57
+ return $links;
58
+ }
59
+
60
+ function config_page() {
61
+
62
+ }
63
+
64
+ function config_page_scripts() {
65
+ if ( isset( $_GET['page'] ) && $_GET['page'] == $this->hook ) {
66
+ wp_enqueue_script( 'postbox' );
67
+ wp_enqueue_script( 'dashboard' );
68
+ wp_enqueue_script( 'thickbox' );
69
+ wp_enqueue_script( 'media-upload' );
70
+ wp_enqueue_script( 'jquery-chosen', GAWP_URL . 'js/chosen.jquery.min.js', array( 'jquery' ) );
71
+ wp_enqueue_style( 'jquery-chosen-css', GAWP_URL . 'js/chosen.css' );
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Create a Checkbox input field
77
+ */
78
+ function checkbox( $id ) {
79
+ $options = get_option( $this->optionname );
80
+ $checked = false;
81
+ if ( isset( $options[$id] ) && $options[$id] == 1 )
82
+ $checked = true;
83
+ return '<input type="checkbox" id="' . $id . '" name="' . $id . '"' . checked( $checked, true, false ) . '/>';
84
+ }
85
+
86
+ /**
87
+ * Create a Text input field
88
+ */
89
+ function textinput( $id ) {
90
+ $options = get_option( $this->optionname );
91
+ $val = '';
92
+ if ( isset( $options[$id] ) )
93
+ $val = $options[$id];
94
+ return '<input class="text" type="text" id="' . $id . '" name="' . $id . '" size="30" value="' . $val . '"/>';
95
+ }
96
+
97
+ /**
98
+ * Create a dropdown field
99
+ */
100
+ function select( $id, $options, $multiple = false ) {
101
+ $opt = get_option( $this->optionname );
102
+ $output = '<select class="select" name="' . $id . '" id="' . $id . '">';
103
+ foreach ( $options as $val => $name ) {
104
+ $sel = '';
105
+ if ( $opt[$id] == $val )
106
+ $sel = ' selected="selected"';
107
+ if ( $name == '' )
108
+ $name = $val;
109
+ $output .= '<option value="' . $val . '"' . $sel . '>' . $name . '</option>';
110
+ }
111
+ $output .= '</select>';
112
+ return $output;
113
+ }
114
+
115
+ /**
116
+ * Create a potbox widget
117
+ */
118
+ function postbox( $id, $title, $content ) {
119
+ ?>
120
+ <div id="<?php echo $id; ?>" class="postbox">
121
+ <div class="handlediv" title="Click to toggle"><br/></div>
122
+ <h3 class="hndle"><span><?php echo $title; ?></span></h3>
123
+
124
+ <div class="inside">
125
+ <?php echo $content; ?>
126
+ </div>
127
+ </div>
128
+ <?php
129
+ }
130
+
131
+ /**
132
+ * Create a form table from an array of rows
133
+ */
134
+ function form_table( $rows ) {
135
+ $content = '<table class="form-table">';
136
+ $i = 1;
137
+ foreach ( $rows as $row ) {
138
+ $class = '';
139
+ if ( $i > 1 ) {
140
+ $class .= 'yst_row';
141
+ }
142
+ if ( $i % 2 == 0 ) {
143
+ $class .= ' even';
144
+ }
145
+ $content .= '<tr id="' . $row['id'] . '_row" class="' . $class . '"><th valign="top" scrope="row">';
146
+ if ( isset( $row['id'] ) && $row['id'] != '' )
147
+ $content .= '<label for="' . $row['id'] . '">' . $row['label'] . ':</label>';
148
+ else
149
+ $content .= $row['label'];
150
+ $content .= '</th><td valign="top">';
151
+ $content .= $row['content'];
152
+ $content .= '</td></tr>';
153
+ if ( isset( $row['desc'] ) && !empty( $row['desc'] ) ) {
154
+ $content .= '<tr class="' . $class . '"><td colspan="2" class="yst_desc"><small>' . $row['desc'] . '</small></td></tr>';
155
+ }
156
+
157
+ $i++;
158
+ }
159
+ $content .= '</table>';
160
+ return $content;
161
+ }
162
+
163
+ /**
164
+ * Create a "plugin like" box.
165
+ */
166
+ function plugin_like( $hook = '' ) {
167
+ if ( empty( $hook ) ) {
168
+ $hook = $this->hook;
169
+ }
170
+ $content = '<p>' . __( 'Why not do any or all of the following:', 'gawp' ) . '</p>';
171
+ $content .= '<ul>';
172
+ $content .= '<li><a href="' . $this->homepage . '">' . __( 'Link to it so other folks can find out about it.', 'gawp' ) . '</a></li>';
173
+ $content .= '<li><a href="http://wordpress.org/extend/plugins/' . $hook . '/">' . __( 'Give it a 5 star rating on WordPress.org.', 'gawp' ) . '</a></li>';
174
+ $content .= '<li><a href="http://wordpress.org/extend/plugins/' . $hook . '/">' . __( 'Let other people know that it works with your WordPress setup.', 'gawp' ) . '</a></li>';
175
+ $content .= '</ul>';
176
+ $this->postbox( $hook . 'like', __( 'Like this plugin?', 'gawp' ), $content );
177
+ }
178
+
179
+ function text_limit( $text, $limit, $finish = ' [&hellip;]' ) {
180
+ if ( strlen( $text ) > $limit ) {
181
+ $text = substr( $text, 0, $limit );
182
+ $text = substr( $text, 0, -( strlen( strrchr( $text, ' ' ) ) ) );
183
+ $text .= $finish;
184
+ }
185
+ return $text;
186
+ }
187
+
188
+ }
189
+ }
190
+
class-tracking.php DELETED
@@ -1,168 +0,0 @@
1
- <?php
2
- /**
3
- * @package Admin
4
- */
5
-
6
- /**
7
- * Class that creates the tracking functionality for WP SEO, as the core class might be used in more plugins, it's checked for existence first.
8
- */
9
- if ( !class_exists( 'Yoast_Tracking' ) ) {
10
- class Yoast_Tracking {
11
-
12
- /**
13
- * Class constructor
14
- */
15
- function __construct() {
16
- add_action( 'admin_footer', array( $this, 'tracking' ), 99 );
17
-
18
- // Invalidate the cache when changes are being made.
19
- add_action( 'switch_theme', array( $this, 'delete_cache' ) );
20
-
21
- add_action( 'admin_init', array( $this, 'check_active_plugins' ) );
22
- }
23
-
24
- /**
25
- * This is the only current way of doing something when a plugin is activated or updated...
26
- */
27
- function check_active_plugins() {
28
- $hash = md5( serialize( get_option( 'active_plugins' ) ) );
29
- $old_hash = get_transient( 'yoast_tracking_active_plugins_hash' );
30
- if ( $hash != $old_hash ) {
31
- add_action( 'admin_footer', array( $this, 'delete_cache' ) );
32
- set_transient( 'yoast_tracking_active_plugins_hash', $hash, 7 * 60 * 60 * 24 );
33
- }
34
- }
35
-
36
- /**
37
- * This deletes the tracking cache, effectively meaning the tracking will be done again.
38
- */
39
- function delete_cache() {
40
- delete_transient( 'yoast_tracking_cache' );
41
- }
42
-
43
- /**
44
- * Main tracking function.
45
- */
46
- function tracking() {
47
- global $pagenow;
48
- if ( in_array( $pagenow, array('index.php','plugins.php','update-core.php','themes.php') ) === false )
49
- return;
50
-
51
- // Start of Metrics
52
- global $wpdb;
53
-
54
- $options = get_option( 'wpseo' );
55
-
56
- if ( !isset( $options['hash'] ) || empty( $options['hash'] ) ) {
57
- $options['hash'] = md5( site_url() );
58
- update_option( 'wpseo', $options );
59
- }
60
-
61
- $data = get_transient( 'yoast_tracking_cache' );
62
- if ( !$data ) {
63
-
64
- $pts = array();
65
- foreach ( get_post_types( array( 'public' => true ) ) as $pt ) {
66
- $count = wp_count_posts( $pt );
67
- $pts[$pt] = $count->publish;
68
- }
69
-
70
- $comments_count = wp_count_comments();
71
-
72
- // wp_get_theme was introduced in 3.4, for compatibility with older versions, let's do a workaround for now.
73
- if ( function_exists( 'wp_get_theme' ) ) {
74
- $theme_data = wp_get_theme();
75
- $theme = array(
76
- 'name' => $theme_data->display( 'Name', false, false ),
77
- 'theme_uri' => $theme_data->display( 'ThemeURI', false, false ),
78
- 'version' => $theme_data->display( 'Version', false, false ),
79
- 'author' => $theme_data->display( 'Author', false, false ),
80
- 'author_uri'=> $theme_data->display( 'AuthorURI', false, false ),
81
- );
82
- if ( isset( $theme_data->template ) && !empty( $theme_data->template ) && $theme_data->parent() ) {
83
- $theme['template'] = array(
84
- 'version' => $theme_data->parent()->display( 'Version', false, false ),
85
- 'name' => $theme_data->parent()->display( 'Name', false, false ),
86
- 'theme_uri' => $theme_data->parent()->display( 'ThemeURI', false, false ),
87
- 'author' => $theme_data->parent()->display( 'Author', false, false ),
88
- 'author_uri'=> $theme_data->parent()->display( 'AuthorURI', false, false ),
89
- );
90
- } else {
91
- $theme['template'] = '';
92
- }
93
- } else {
94
- $theme_data = (object) get_theme_data( get_stylesheet_directory() . '/style.css' );
95
- $theme = array(
96
- 'version' => $theme_data->Version,
97
- 'name' => $theme_data->Name,
98
- 'author' => $theme_data->Author,
99
- 'template' => $theme_data->Template,
100
- );
101
- }
102
-
103
- $plugins = array();
104
- foreach ( get_option( 'active_plugins' ) as $plugin_path ) {
105
- $plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_path );
106
-
107
- $slug = str_replace( '/' . basename( $plugin_path ), '', $plugin_path );
108
- $plugins[$slug] = array(
109
- 'version' => $plugin_info['Version'],
110
- 'name' => $plugin_info['Name'],
111
- 'plugin_uri' => $plugin_info['PluginURI'],
112
- 'author' => $plugin_info['AuthorName'],
113
- 'author_uri' => $plugin_info['AuthorURI'],
114
- );
115
- }
116
-
117
- $data = array(
118
- 'site' => array(
119
- 'hash' => $options['hash'],
120
- 'url' => site_url(),
121
- 'name' => get_bloginfo( 'name' ),
122
- 'version' => get_bloginfo( 'version' ),
123
- 'multisite' => is_multisite(),
124
- 'users' => count( get_users() ),
125
- 'lang' => get_locale(),
126
- ),
127
- 'pts' => $pts,
128
- 'comments' => array(
129
- 'total' => $comments_count->total_comments,
130
- 'approved' => $comments_count->approved,
131
- 'spam' => $comments_count->spam,
132
- 'pings' => $wpdb->get_var( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_type = 'pingback'" ),
133
- ),
134
- 'options' => apply_filters( 'yoast_tracking_filters', array() ),
135
- 'theme' => $theme,
136
- 'plugins' => $plugins,
137
- );
138
-
139
- $args = array(
140
- 'body' => $data
141
- );
142
- wp_remote_post( 'https://tracking.yoast.com/', $args );
143
-
144
- // Store for a week, then push data again.
145
- set_transient( 'yoast_tracking_cache', $data, ( 7 * 60 * 60 * 24 ) );
146
- }
147
- }
148
- }
149
-
150
- $yoast_tracking = new Yoast_Tracking;
151
- }
152
-
153
- /**
154
- * Adds tracking parameters for Google Analytics settings. Outside of the main class as the class could also be in use in other plugins.
155
- *
156
- * @param array $options
157
- * @return array
158
- */
159
- function ystga_tracking_additions( $options ) {
160
- $opt = get_option('Yoast_Google_Analytics');
161
-
162
- $options['gawp'] = array(
163
- 'advanced_settigns' => isset( $opt['advancedsettings'] ) ? 1 : 0,
164
- );
165
- return $options;
166
- }
167
-
168
- add_filter( 'yoast_tracking_filters', 'ystga_tracking_additions' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/class-frontend.php ADDED
@@ -0,0 +1,663 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Code that actually inserts stuff into pages.
5
+ */
6
+ if ( !class_exists( 'GA_Filter' ) ) {
7
+ class GA_Filter {
8
+
9
+ var $options = array();
10
+
11
+ function __construct() {
12
+ $this->options = get_option( 'Yoast_Google_Analytics' );
13
+
14
+ if ( !is_array( $this->options ) ) {
15
+ $this->options = get_option( 'GoogleAnalyticsPP' );
16
+ if ( !is_array( $this->options ) )
17
+ return;
18
+ }
19
+
20
+ if ( !isset( $this->options['uastring'] ) || $this->options['uastring'] == '' ) {
21
+ add_action( 'wp_head', array( $this, 'not_shown_error' ) );
22
+ } else {
23
+ if ( isset( $this->options['allowanchor'] ) && $this->options['allowanchor'] ) {
24
+ add_action( 'init', array( $this, 'utm_hashtag_redirect' ), 1 );
25
+ }
26
+
27
+ if ( ( isset( $this->options['trackoutbound'] ) && $this->options['trackoutbound'] ) ||
28
+ ( isset( $this->options['trackcrossdomain'] ) && $this->options['trackcrossdomain'] )
29
+ ) {
30
+ // filters alter the existing content
31
+ add_filter( 'the_content', array( $this, 'the_content' ), 99 );
32
+ add_filter( 'widget_text', array( $this, 'widget_content' ), 99 );
33
+ add_filter( 'the_excerpt', array( $this, 'the_content' ), 99 );
34
+ add_filter( 'comment_text', array( $this, 'comment_text' ), 99 );
35
+ add_filter( 'get_bookmarks', array( $this, 'bookmarks' ), 99 );
36
+ add_filter( 'get_comment_author_link', array( $this, 'comment_author_link' ), 99 );
37
+ add_filter( 'wp_nav_menu', array( $this, 'nav_menu' ), 99 );
38
+ }
39
+
40
+ if ( $this->options["trackcommentform"] ) {
41
+ global $comment_form_id;
42
+ $comment_form_id = 'commentform';
43
+
44
+ add_action( 'comment_form_after', array( $this, 'track_comment_form' ) );
45
+ add_action( 'wp_print_scripts', array( $this, 'track_comment_form_head' ) );
46
+ add_filter( 'comment_form_defaults', array( $this, 'get_comment_form_id' ), 99, 1 );
47
+ }
48
+
49
+ if ( isset( $this->options['trackadsense'] ) && $this->options['trackadsense'] )
50
+ add_action( 'wp_head', array( $this, 'spool_adsense' ), 1 );
51
+
52
+ if ( !isset( $this->options['position'] ) )
53
+ $this->options['position'] = 'header';
54
+
55
+ switch ( $this->options['position'] ) {
56
+ case 'manual':
57
+ // No need to insert here, bail NOW.
58
+ break;
59
+ case 'header':
60
+ default:
61
+ add_action( 'wp_head', array( $this, 'spool_analytics' ), 2 );
62
+ break;
63
+ }
64
+
65
+ if ( isset( $this->options['trackregistration'] ) && $this->options['trackregistration'] )
66
+ add_action( 'login_head', array( $this, 'spool_analytics' ), 20 );
67
+
68
+ if ( isset( $this->options['rsslinktagging'] ) && $this->options['rsslinktagging'] )
69
+ add_filter( 'the_permalink_rss', array( $this, 'rsslinktagger' ), 99 );
70
+ }
71
+ }
72
+
73
+ function not_shown_error() {
74
+ if ( current_user_can( 'manage_options' ) )
75
+ echo "<!-- " . __( "Google Analytics tracking code not shown because you haven't setup Google Analytics for WordPress yet.", "gawp" ) . " -->\n";
76
+ }
77
+
78
+ function do_tracking() {
79
+ global $current_user;
80
+
81
+ get_currentuserinfo();
82
+
83
+ if ( 0 == $current_user->ID )
84
+ return true;
85
+
86
+ if ( ( $current_user->user_level >= $this->options["ignore_userlevel"] ) )
87
+ return false;
88
+ else
89
+ return true;
90
+ }
91
+
92
+ /**
93
+ * If setAllowAnchor is set to true, GA ignores all links tagged "normally", so we redirect all "normally" tagged URL's
94
+ * to one tagged with a hash.
95
+ */
96
+ function utm_hashtag_redirect() {
97
+ if ( isset( $_SERVER['REQUEST_URI'] ) ) {
98
+ if ( strpos( $_SERVER['REQUEST_URI'], "utm_" ) !== false ) {
99
+ $url = 'http://';
100
+ if ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] != "" ) {
101
+ $url = 'https://';
102
+ }
103
+ $url .= $_SERVER['SERVER_NAME'];
104
+ if ( strpos( $_SERVER['REQUEST_URI'], "?utm_" ) !== false ) {
105
+ $url .= str_replace( "?utm_", "#utm_", $_SERVER['REQUEST_URI'] );
106
+ } else if ( strpos( $_SERVER['REQUEST_URI'], "&utm_" ) !== false ) {
107
+ $url .= substr_replace( $_SERVER['REQUEST_URI'], "#utm_", strpos( $_SERVER['REQUEST_URI'], "&utm_" ), 5 );
108
+ }
109
+ wp_redirect( $url, 301 );
110
+ exit;
111
+ }
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Cleans the variable to make it ready for storing in Google Analytics
117
+ */
118
+ function str_clean( $val ) {
119
+ return remove_accents( str_replace( '---', '-', str_replace( ' ', '-', strtolower( html_entity_decode( $val ) ) ) ) );
120
+ }
121
+
122
+ /*
123
+ * Insert the tracking code into the page
124
+ */
125
+ function spool_analytics() {
126
+ global $wp_query, $current_user;
127
+
128
+ // Make sure $current_user is filled.
129
+ get_currentuserinfo();
130
+
131
+ /**
132
+ * The order of custom variables is very, very important: custom vars should always take up the same slot to make analysis easy.
133
+ */
134
+ $customvarslot = 1;
135
+ if ( $this->do_tracking() && !is_preview() ) {
136
+ $push = array();
137
+
138
+ if ( $this->options['allowanchor'] )
139
+ $push[] = "'_setAllowAnchor',true";
140
+
141
+ if ( $this->options['allowlinker'] )
142
+ $push[] = "'_setAllowLinker',true";
143
+
144
+ if ( $this->options['anonymizeip'] )
145
+ $push[] = "'_gat._anonymizeIp'";
146
+
147
+ if ( isset( $this->options['domain'] ) && $this->options['domain'] != "" )
148
+ $push[] = "'_setDomainName','" . $this->options['domain'] . "'";
149
+
150
+ if ( isset( $this->options['trackcrossdomain'] ) && $this->options['trackcrossdomain'] )
151
+ $push[] = "'_setDomainName','" . $this->options['primarycrossdomain'] . "'";
152
+
153
+ if ( isset( $this->options['allowhash'] ) && $this->options['allowhash'] )
154
+ $push[] = "'_setAllowHash',false";
155
+
156
+ if ( $this->options['cv_loggedin'] ) {
157
+ if ( $current_user && $current_user->ID != 0 )
158
+ $push[] = "'_setCustomVar',$customvarslot,'logged-in','" . $current_user->roles[0] . "',1";
159
+ // Customvar slot needs to be upped even when the user is not logged in, to make sure the variables below are always in the same slot.
160
+ $customvarslot++;
161
+ }
162
+
163
+ if ( function_exists( 'is_post_type_archive' ) && is_post_type_archive() ) {
164
+ if ( $this->options['cv_post_type'] ) {
165
+ $post_type = get_post_type();
166
+ if ( $post_type ) {
167
+ $push[] = "'_setCustomVar'," . $customvarslot . ",'post_type','" . $post_type . "',3";
168
+ $customvarslot++;
169
+ }
170
+ }
171
+ } else if ( is_singular() && !is_home() ) {
172
+ if ( $this->options['cv_post_type'] ) {
173
+ $post_type = get_post_type();
174
+ if ( $post_type ) {
175
+ $push[] = "'_setCustomVar'," . $customvarslot . ",'post_type','" . $post_type . "',3";
176
+ $customvarslot++;
177
+ }
178
+ }
179
+ if ( $this->options['cv_authorname'] ) {
180
+ $push[] = "'_setCustomVar',$customvarslot,'author','" . $this->str_clean( get_the_author_meta( 'display_name', $wp_query->post->post_author ) ) . "',3";
181
+ $customvarslot++;
182
+ }
183
+ if ( $this->options['cv_tags'] ) {
184
+ $i = 0;
185
+ if ( get_the_tags() ) {
186
+ $tagsstr = '';
187
+ foreach ( get_the_tags() as $tag ) {
188
+ if ( $i > 0 )
189
+ $tagsstr .= ' ';
190
+ $tagsstr .= $tag->slug;
191
+ $i++;
192
+ }
193
+ // Max 64 chars for value and label combined, hence 64 - 4
194
+ $tagsstr = substr( $tagsstr, 0, 60 );
195
+ $push[] = "'_setCustomVar',$customvarslot,'tags','" . $tagsstr . "',3";
196
+ }
197
+ $customvarslot++;
198
+ }
199
+ if ( is_singular() ) {
200
+ if ( $this->options['cv_year'] ) {
201
+ $push[] = "'_setCustomVar',$customvarslot,'year','" . get_the_time( 'Y' ) . "',3";
202
+ $customvarslot++;
203
+ }
204
+ if ( $this->options['cv_category'] && is_single() ) {
205
+ $cats = get_the_category();
206
+ if ( is_array( $cats ) && isset( $cats[0] ) )
207
+ $push[] = "'_setCustomVar',$customvarslot,'category','" . $cats[0]->slug . "',3";
208
+ $customvarslot++;
209
+ }
210
+ if ( $this->options['cv_all_categories'] && is_single() ) {
211
+ $i = 0;
212
+ $catsstr = '';
213
+ foreach ( (array) get_the_category() as $cat ) {
214
+ if ( $i > 0 )
215
+ $catsstr .= ' ';
216
+ $catsstr .= $cat->slug;
217
+ $i++;
218
+ }
219
+ // Max 64 chars for value and label combined, hence 64 - 10
220
+ $catsstr = substr( $catsstr, 0, 54 );
221
+ $push[] = "'_setCustomVar',$customvarslot,'categories','" . $catsstr . "',3";
222
+ $customvarslot++;
223
+ }
224
+ }
225
+ }
226
+
227
+ $push = apply_filters( 'yoast-ga-custom-vars', $push, $customvarslot );
228
+
229
+ $push = apply_filters( 'yoast-ga-push-before-pageview', $push );
230
+
231
+ if ( is_404() ) {
232
+ $push[] = "'_trackPageview','/404.html?page=' + document.location.pathname + document.location.search + '&from=' + document.referrer";
233
+ } else if ( $wp_query->is_search ) {
234
+ $pushstr = "'_trackPageview','" . get_bloginfo( 'url' ) . "/?s=";
235
+ if ( $wp_query->found_posts == 0 ) {
236
+ $push[] = $pushstr . "no-results:" . rawurlencode( $wp_query->query_vars['s'] ) . "&cat=no-results'";
237
+ } else if ( $wp_query->found_posts == 1 ) {
238
+ $push[] = $pushstr . rawurlencode( $wp_query->query_vars['s'] ) . "&cat=1-result'";
239
+ } else if ( $wp_query->found_posts > 1 && $wp_query->found_posts < 6 ) {
240
+ $push[] = $pushstr . rawurlencode( $wp_query->query_vars['s'] ) . "&cat=2-5-results'";
241
+ } else {
242
+ $push[] = $pushstr . rawurlencode( $wp_query->query_vars['s'] ) . "&cat=plus-5-results'";
243
+ }
244
+ } else {
245
+ $push[] = "'_trackPageview'";
246
+ }
247
+
248
+ $push = apply_filters( 'yoast-ga-push-after-pageview', $push );
249
+
250
+ if ( defined( 'WPSC_VERSION' ) && $this->options['wpec_tracking'] )
251
+ $push = $this->wpec_transaction_tracking( $push );
252
+
253
+ if ( $this->options['shopp_tracking'] ) {
254
+ global $Shopp;
255
+ if ( isset( $Shopp ) )
256
+ $push = $this->shopp_transaction_tracking( $push );
257
+ }
258
+
259
+ $pushstr = "";
260
+ foreach ( $push as $key ) {
261
+ if ( !empty( $pushstr ) )
262
+ $pushstr .= ",";
263
+
264
+ $pushstr .= "[" . $key . "]";
265
+ }
266
+
267
+ if ( current_user_can( 'manage_options' ) && $this->options['firebuglite'] && $this->options['debug'] )
268
+ echo '<script src="https://getfirebug.com/firebug-lite.js" type="text/javascript"></script>';
269
+ ?>
270
+
271
+ <script type="text/javascript">//<![CDATA[
272
+ // Google Analytics for WordPress by Yoast v<?php echo GAWP_VERSION; ?> | http://yoast.com/wordpress/google-analytics/
273
+ var _gaq = _gaq || [];
274
+ _gaq.push(['_setAccount', '<?php echo trim( $this->options["uastring"] ); ?>']);
275
+ <?php
276
+ if ( $this->options["extrase"] ) {
277
+ if ( !empty( $this->options["extraseurl"] ) ) {
278
+ $url = $this->options["extraseurl"];
279
+ } else {
280
+ $url = GAWP_URL . 'custom_se_async.js';
281
+ }
282
+ echo '</script><script src="' . $url . '" type="text/javascript"></script>' . "\n" . '<script type="text/javascript">';
283
+ }
284
+
285
+ if ( $this->options['customcode'] && trim( $this->options['customcode'] ) != '' )
286
+ echo "\t" . stripslashes( $this->options['customcode'] ) . "\n";
287
+ ?>
288
+ _gaq.push(<?php echo $pushstr; ?>);
289
+ (function () {
290
+ var ga = document.createElement('script');
291
+ ga.type = 'text/javascript';
292
+ ga.async = true;
293
+ ga.src = <?php
294
+ if ( $this->options['gajslocalhosting'] && !empty( $this->options['gajsurl'] ) ) {
295
+ echo "'" . $this->options['gajsurl'] . "';";
296
+ } else {
297
+ $script = 'ga.js';
298
+ if ( current_user_can( 'manage_options' ) && $this->options['debug'] )
299
+ $script = 'u/ga_debug.js';
300
+ echo "('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/" . $script . "'";
301
+ }
302
+ ?>;
303
+
304
+ var s = document.getElementsByTagName('script')[0];
305
+ s.parentNode.insertBefore(ga, s);
306
+ })();
307
+ //]]></script>
308
+ <?php
309
+ } else if ( $this->options["uastring"] != "" ) {
310
+ echo "<!-- " . sprintf( __( "Google Analytics tracking code not shown because users over level %s are ignored.", "gawp" ), $this->options["ignore_userlevel"] ) . " -->\n";
311
+ }
312
+ }
313
+
314
+ /*
315
+ * Insert the AdSense parameter code into the page. This'll go into the header per Google's instructions.
316
+ */
317
+ function spool_adsense() {
318
+ if ( $this->do_tracking() && !is_preview() ) {
319
+ echo '<script type="text/javascript">' . "\n";
320
+ echo "\t" . 'window.google_analytics_uacct = "' . $this->options["uastring"] . '";' . "\n";
321
+ echo '</script>' . "\n";
322
+ }
323
+ }
324
+
325
+ function get_tracking_prefix() {
326
+ return ( empty( $this->options['trackprefix'] ) ) ? '/yoast-ga/' : $this->options['trackprefix'];
327
+ }
328
+
329
+ function get_tracking_link( $prefix, $target, $jsprefix = 'javascript:' ) {
330
+ if (
331
+ ( $prefix == 'download' && $this->options['downloadspageview'] ) ||
332
+ ( $prefix != 'download' && $this->options['outboundpageview'] )
333
+ ) {
334
+ $prefix = $this->get_tracking_prefix() . $prefix;
335
+ $pushstr = "['_trackPageview','" . $prefix . "/" . esc_js( esc_url( $target ) ) . "']";
336
+ } else {
337
+ $pushstr = "['_trackEvent','" . $prefix . "','" . esc_js( esc_url( $target ) ) . "']";
338
+ }
339
+ return $jsprefix . "_gaq.push(" . $pushstr . ");";
340
+ }
341
+
342
+ function parse_link( $category, $matches ) {
343
+ $origin = yoast_ga_get_domain( $_SERVER["HTTP_HOST"] );
344
+
345
+ // Break out immediately if the link is not an http or https link.
346
+ if ( strpos( $matches[2], "http" ) !== 0 ) {
347
+ $target = false;
348
+ } else if ( ( strpos( $matches[2], "mailto" ) === 0 ) ) {
349
+ $target = 'email';
350
+ } else {
351
+ $target = yoast_ga_get_domain( $matches[3] );
352
+ }
353
+ $trackBit = "";
354
+ $extension = substr( strrchr( $matches[3], '.' ), 1 );
355
+ $dlextensions = explode( ",", str_replace( '.', '', $this->options['dlextensions'] ) );
356
+ if ( $target ) {
357
+ if ( $target == 'email' ) {
358
+ $trackBit = $this->get_tracking_link( 'mailto', str_replace( 'mailto:', '', $matches[3] ), '' );
359
+ } else if ( in_array( $extension, $dlextensions ) ) {
360
+ $trackBit = $this->get_tracking_link( 'download', $matches[3], '' );
361
+ } else if ( $target["domain"] != $origin["domain"] ) {
362
+ $crossdomains = array();
363
+ if ( isset( $this->options['othercrossdomains'] ) && !empty( $this->options['othercrossdomains'] ) )
364
+ $crossdomains = explode( ',', str_replace( ' ', '', $this->options['othercrossdomains'] ) );
365
+
366
+ if ( isset( $this->options['trackcrossdomain'] ) && $this->options['trackcrossdomain'] && in_array( $target["host"], $crossdomains ) ) {
367
+ $trackBit = '_gaq.push([\'_link\', \'' . $matches[2] . '//' . $matches[3] . '\']); return false;"';
368
+ } else if ( $this->options['trackoutbound'] && in_array( $this->options['domainorurl'], array( 'domain', 'url' ) ) ) {
369
+ $url = $this->options['domainorurl'] == 'domain' ? $target["host"] : $matches[3];
370
+ $trackBit = $this->get_tracking_link( $category, $url, '' );
371
+ }
372
+ } else if ( $target["domain"] == $origin["domain"] && isset( $this->options['internallink'] ) && $this->options['internallink'] != '' ) {
373
+ $url = preg_replace( '|' . $origin["host"] . '|', '', $matches[3] );
374
+ $extintlinks = explode( ',', $this->options['internallink'] );
375
+ foreach ( $extintlinks as $link ) {
376
+ if ( preg_match( '|^' . trim( $link ) . '|', $url, $match ) ) {
377
+ $label = $this->options['internallinklabel'];
378
+ if ( $label == '' )
379
+ $label = 'int';
380
+ $trackBit = $this->get_tracking_link( $category . '-' . $label, $url, '' );
381
+ }
382
+ }
383
+ }
384
+ }
385
+ if ( $trackBit != "" ) {
386
+ if ( preg_match( '/onclick=[\'\"](.*?)[\'\"]/i', $matches[4] ) > 0 ) {
387
+ // Check for manually tagged outbound clicks, and replace them with the tracking of choice.
388
+ if ( preg_match( '/.*_track(Pageview|Event).*/i', $matches[4] ) > 0 ) {
389
+ $matches[4] = preg_replace( '/onclick=[\'\"](javascript:)?(.*;)?[a-zA-Z0-9]+\._track(Pageview|Event)\([^\)]+\)(;)?(.*)?[\'\"]/i', 'onclick="javascript:' . $trackBit . '$2$5"', $matches[4] );
390
+ } else {
391
+ $matches[4] = preg_replace( '/onclick=[\'\"](javascript:)?(.*?)[\'\"]/i', 'onclick="javascript:' . $trackBit . '$2"', $matches[4] );
392
+ }
393
+ } else {
394
+ $matches[4] = 'onclick="javascript:' . $trackBit . '"' . $matches[4];
395
+ }
396
+ }
397
+ return '<a ' . $matches[1] . 'href="' . $matches[2] . '//' . $matches[3] . '"' . ' ' . $matches[4] . '>' . $matches[5] . '</a>';
398
+ }
399
+
400
+ function parse_article_link( $matches ) {
401
+ return $this->parse_link( 'outbound-article', $matches );
402
+ }
403
+
404
+ function parse_comment_link( $matches ) {
405
+ return $this->parse_link( 'outbound-comment', $matches );
406
+ }
407
+
408
+ function parse_widget_link( $matches ) {
409
+ return $this->parse_link( 'outbound-widget', $matches );
410
+ }
411
+
412
+ function parse_nav_menu( $matches ) {
413
+ return $this->parse_link( 'outbound-menu', $matches );
414
+ }
415
+
416
+ function widget_content( $text ) {
417
+ if ( !$this->do_tracking() )
418
+ return $text;
419
+ static $anchorPattern = '/<a (.*?)href=[\'\"](.*?)\/\/([^\'\"]+?)[\'\"](.*?)>(.*?)<\/a>/i';
420
+ $text = preg_replace_callback( $anchorPattern, array( $this, 'parse_widget_link' ), $text );
421
+ return $text;
422
+ }
423
+
424
+ function the_content( $text ) {
425
+ if ( !$this->do_tracking() )
426
+ return $text;
427
+
428
+ if ( !is_feed() ) {
429
+ static $anchorPattern = '/<a (.*?)href=[\'\"](.*?)\/\/([^\'\"]+?)[\'\"](.*?)>(.*?)<\/a>/i';
430
+ $text = preg_replace_callback( $anchorPattern, array( $this, 'parse_article_link' ), $text );
431
+ }
432
+ return $text;
433
+ }
434
+
435
+ function nav_menu( $text ) {
436
+ if ( !$this->do_tracking() )
437
+ return $text;
438
+
439
+ if ( !is_feed() ) {
440
+ static $anchorPattern = '/<a (.*?)href=[\'\"](.*?)\/\/([^\'\"]+?)[\'\"](.*?)>(.*?)<\/a>/i';
441
+ $text = preg_replace_callback( $anchorPattern, array( $this, 'parse_nav_menu' ), $text );
442
+ }
443
+ return $text;
444
+ }
445
+
446
+ function comment_text( $text ) {
447
+ if ( !$this->do_tracking() )
448
+ return $text;
449
+
450
+ if ( !is_feed() ) {
451
+ static $anchorPattern = '/<a (.*?)href="(.*?)\/\/(.*?)"(.*?)>(.*?)<\/a>/i';
452
+ $text = preg_replace_callback( $anchorPattern, array( $this, 'parse_comment_link' ), $text );
453
+ }
454
+ return $text;
455
+ }
456
+
457
+ function comment_author_link( $text ) {
458
+ if ( !$this->do_tracking() )
459
+ return $text;
460
+
461
+ static $anchorPattern = '/(.*\s+.*?href\s*=\s*)["\'](.*?)["\'](.*)/';
462
+ preg_match( $anchorPattern, $text, $matches );
463
+ if ( !isset( $matches[2] ) || $matches[2] == "" ) return $text;
464
+
465
+ $trackBit = '';
466
+ $target = yoast_ga_get_domain( $matches[2] );
467
+ $origin = yoast_ga_get_domain( $_SERVER["HTTP_HOST"] );
468
+ if ( $target["domain"] != $origin["domain"] ) {
469
+ if ( isset( $this->options['domainorurl'] ) && $this->options['domainorurl'] == "domain" )
470
+ $url = $target["host"];
471
+ else
472
+ $url = $matches[2];
473
+ $trackBit = 'onclick="' . $this->get_tracking_link( 'outbound-commentauthor', $url ) . '"';
474
+ }
475
+ return $matches[1] . "\"" . $matches[2] . "\" " . $trackBit . " " . $matches[3];
476
+ }
477
+
478
+ function bookmarks( $bookmarks ) {
479
+ if ( !$this->do_tracking() )
480
+ return $bookmarks;
481
+
482
+ $i = 0;
483
+ while ( $i < count( $bookmarks ) ) {
484
+ $target = yoast_ga_get_domain( $bookmarks[$i]->link_url );
485
+ $sitedomain = yoast_ga_get_domain( get_bloginfo( 'url' ) );
486
+ if ( $target['host'] == $sitedomain['host'] ) {
487
+ $i++;
488
+ continue;
489
+ }
490
+ if ( isset( $this->options['domainorurl'] ) && $this->options['domainorurl'] == "domain" )
491
+ $url = $target["host"];
492
+ else
493
+ $url = $bookmarks[$i]->link_url;
494
+ $trackBit = '" onclick="' . $this->get_tracking_link( 'outbound-blogroll', $url );
495
+ $bookmarks[$i]->link_target .= $trackBit;
496
+ $i++;
497
+ }
498
+ return $bookmarks;
499
+ }
500
+
501
+ function rsslinktagger( $guid ) {
502
+ global $post;
503
+ if ( is_feed() ) {
504
+ if ( $this->options['allowanchor'] ) {
505
+ $delimiter = '#';
506
+ } else {
507
+ $delimiter = '?';
508
+ if ( strpos( $guid, $delimiter ) > 0 )
509
+ $delimiter = '&amp;';
510
+ }
511
+ return $guid . $delimiter . 'utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=' . urlencode( $post->post_name );
512
+ }
513
+ return $guid;
514
+ }
515
+
516
+ function wpec_transaction_tracking( $push ) {
517
+ global $wpdb, $purchlogs, $cart_log_id;
518
+ if ( !isset( $cart_log_id ) || empty( $cart_log_id ) )
519
+ return $push;
520
+
521
+ $city = $wpdb->get_var( "SELECT tf.value
522
+ FROM " . WPSC_TABLE_SUBMITED_FORM_DATA . " tf
523
+ LEFT JOIN " . WPSC_TABLE_CHECKOUT_FORMS . " cf
524
+ ON cf.id = tf.form_id
525
+ WHERE cf.type = 'city'
526
+ AND log_id = " . $cart_log_id );
527
+
528
+ $country = $wpdb->get_var( "SELECT tf.value
529
+ FROM " . WPSC_TABLE_SUBMITED_FORM_DATA . " tf
530
+ LEFT JOIN " . WPSC_TABLE_CHECKOUT_FORMS . " cf
531
+ ON cf.id = tf.form_id
532
+ WHERE cf.type = 'country'
533
+ AND log_id = " . $cart_log_id );
534
+
535
+ $cart_items = $wpdb->get_results( "SELECT * FROM " . WPSC_TABLE_CART_CONTENTS . " WHERE purchaseid = " . $cart_log_id, ARRAY_A );
536
+
537
+ $total_shipping = $purchlogs->allpurchaselogs[0]->base_shipping;
538
+ $total_tax = 0;
539
+ foreach ( $cart_items as $item ) {
540
+ $total_shipping += $item['pnp'];
541
+ $total_tax += $item['tax_charged'];
542
+ }
543
+
544
+ $push[] = "'_addTrans','" . $cart_log_id . "'," // Order ID
545
+ . "'" . $this->str_clean( get_bloginfo( 'name' ) ) . "'," // Store name
546
+ . "'" . nzshpcrt_currency_display( $purchlogs->allpurchaselogs[0]->totalprice, 1, true, false, true ) . "'," // Total price
547
+ . "'" . nzshpcrt_currency_display( $total_tax, 1, true, false, true ) . "'," // Tax
548
+ . "'" . nzshpcrt_currency_display( $total_shipping, 1, true, false, true ) . "'," // Shipping
549
+ . "'" . $city . "'," // City
550
+ . "''," // State
551
+ . "'" . $country . "'"; // Country
552
+
553
+ foreach ( $cart_items as $item ) {
554
+ $item['sku'] = $wpdb->get_var( "SELECT meta_value FROM " . WPSC_TABLE_PRODUCTMETA . " WHERE meta_key = 'sku' AND product_id = '" . $item['prodid'] . "' LIMIT 1" );
555
+
556
+ $item['category'] = $wpdb->get_var( "SELECT pc.name FROM " . WPSC_TABLE_PRODUCT_CATEGORIES . " pc LEFT JOIN " . WPSC_TABLE_ITEM_CATEGORY_ASSOC . " ca ON pc.id = ca.category_id WHERE pc.group_id = '1' AND ca.product_id = '" . $item['prodid'] . "'" );
557
+ $push[] = "'_addItem',"
558
+ . "'" . $cart_log_id . "'," // Order ID
559
+ . "'" . $item['sku'] . "'," // Item SKU
560
+ . "'" . str_replace( "'", "", $item['name'] ) . "'," // Item Name
561
+ . "'" . $item['category'] . "'," // Item Category
562
+ . "'" . $item['price'] . "'," // Item Price
563
+ . "'" . $item['quantity'] . "'"; // Item Quantity
564
+ }
565
+ $push[] = "'_trackTrans'";
566
+
567
+ return $push;
568
+ }
569
+
570
+ function shopp_transaction_tracking( $push ) {
571
+ global $Shopp;
572
+
573
+ // Only process if we're in the checkout process (receipt page)
574
+ if ( version_compare( substr( SHOPP_VERSION, 0, 3 ), '1.1' ) >= 0 ) {
575
+ // Only process if we're in the checkout process (receipt page)
576
+ if ( function_exists( 'is_shopp_page' ) && !is_shopp_page( 'checkout' ) ) return $push;
577
+ if ( empty( $Shopp->Order->purchase ) ) return $push;
578
+
579
+ $Purchase = new Purchase( $Shopp->Order->purchase );
580
+ $Purchase->load_purchased();
581
+ } else {
582
+ // For 1.0.x
583
+ // Only process if we're in the checkout process (receipt page)
584
+ if ( function_exists( 'is_shopp_page' ) && !is_shopp_page( 'checkout' ) ) return $push;
585
+ // Only process if we have valid order data
586
+ if ( !isset( $Shopp->Cart->data->Purchase ) ) return $push;
587
+ if ( empty( $Shopp->Cart->data->Purchase->id ) ) return $push;
588
+
589
+ $Purchase = $Shopp->Cart->data->Purchase;
590
+ }
591
+
592
+ $push[] = "'_addTrans',"
593
+ . "'" . $Purchase->id . "'," // Order ID
594
+ . "'" . $this->str_clean( get_bloginfo( 'name' ) ) . "'," // Store
595
+ . "'" . number_format( $Purchase->total, 2 ) . "'," // Total price
596
+ . "'" . number_format( $Purchase->tax, 2 ) . "'," // Tax
597
+ . "'" . number_format( $Purchase->shipping, 2 ) . "'," // Shipping
598
+ . "'" . $Purchase->city . "'," // City
599
+ . "'" . $Purchase->state . "'," // State
600
+ . "'.$Purchase->country.'"; // Country
601
+
602
+ foreach ( $Purchase->purchased as $item ) {
603
+ $sku = empty( $item->sku ) ? 'PID-' . $item->product . str_pad( $item->price, 4, '0', STR_PAD_LEFT ) : $item->sku;
604
+ $push[] = "'_addItem',"
605
+ . "'" . $Purchase->id . "',"
606
+ . "'" . $sku . "',"
607
+ . "'" . str_replace( "'", "", $item->name ) . "',"
608
+ . "'" . $item->optionlabel . "',"
609
+ . "'" . number_format( $item->unitprice, 2 ) . "',"
610
+ . "'" . $item->quantity . "'";
611
+ }
612
+ $push[] = "'_trackTrans'";
613
+ return $push;
614
+ }
615
+
616
+ function track_comment_form() {
617
+ if ( !is_singular() )
618
+ return;
619
+
620
+ global $comment_form_id;
621
+ ?>
622
+ <script type="text/javascript">
623
+ jQuery(document).ready(function () {
624
+ jQuery('#<?php echo $comment_form_id; ?>').submit(function () {
625
+ _gaq.push(
626
+ ['_setAccount', '<?php echo $this->options["uastring"]; ?>'],
627
+ ['_trackEvent', 'comment', 'submit']
628
+ );
629
+ });
630
+ });
631
+ </script>
632
+ <?php
633
+ }
634
+
635
+ function track_comment_form_head() {
636
+ if ( !is_singular() )
637
+ return;
638
+
639
+ global $post;
640
+ if ( 'open' == $post->comment_status )
641
+ wp_enqueue_script( 'jquery' );
642
+ }
643
+
644
+ function get_comment_form_id( $args ) {
645
+ global $comment_form_id;
646
+ $comment_form_id = $args['id_form'];
647
+ return $args;
648
+ }
649
+
650
+ } // class GA_Filter
651
+ } // endif
652
+
653
+ $yoast_ga = new GA_Filter();
654
+
655
+ function yoast_analytics() {
656
+ global $yoast_ga;
657
+ $options = get_option( 'Yoast_Google_Analytics' );
658
+ if ( $options['position'] == 'manual' )
659
+ $yoast_ga->spool_analytics();
660
+ else
661
+ echo '<!-- ' . __( 'Please set Google Analytics position to "manual" in the settings, or remove this call to yoast_analytics();', 'gawp' ) . ' -->';
662
+ }
663
+
googleanalytics.php CHANGED
@@ -4,13 +4,13 @@ Plugin Name: Google Analytics for WordPress
4
  Plugin URI: http://yoast.com/wordpress/google-analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=wpgaplugin&utm_content=v420
5
  Description: This plugin makes it simple to add Google Analytics to your WordPress blog, adding lots of features, eg. custom variables and automatic clickout and download tracking.
6
  Author: Joost de Valk
7
- Version: 4.2.8
8
  Requires at least: 3.0
9
  Author URI: http://yoast.com/
10
  License: GPL v3
11
 
12
  Google Analytics for WordPress
13
- Copyright (C) 2008-2012, Joost de Valk - joost@yoast.com
14
 
15
  This program is free software: you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License as published by
@@ -26,1616 +26,32 @@ You should have received a copy of the GNU General Public License
26
  along with this program. If not, see <http://www.gnu.org/licenses/>.
27
  */
28
 
29
- // This plugin was originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics
30
 
31
- define( 'GAWP_VERSION', '4.2.8' );
32
 
33
- /*
34
- * Admin User Interface
35
- */
36
-
37
- if ( is_admin() && ( !defined( 'DOING_AJAX' ) || !DOING_AJAX ) && !class_exists( 'GA_Admin' ) ) {
38
-
39
- require_once plugin_dir_path( __FILE__ ) . 'yst_plugin_tools.php';
40
- require_once plugin_dir_path( __FILE__ ) . '/wp-gdata/wp-gdata.php';
41
-
42
- $options = get_option( 'Yoast_Google_Analytics' );
43
-
44
- global $wp_version;
45
- if ( version_compare( $wp_version, '3.3', '>=' ) && !isset( $options['tracking_popup'] ) )
46
- require_once plugin_dir_path( __FILE__ ) . 'class-pointer.php';
47
-
48
- if ( isset( $options['yoast_tracking'] ) && ( 'on' == $options['yoast_tracking'] || true === $options['yoast_tracking'] ) )
49
- require_once plugin_dir_path( __FILE__ ) . 'class-tracking.php';
50
-
51
- class GA_Admin extends Yoast_GA_Plugin_Admin {
52
-
53
- var $hook = 'google-analytics-for-wordpress';
54
- var $filename = 'google-analytics-for-wordpress/googleanalytics.php';
55
- var $longname = 'Google Analytics Configuration';
56
- var $shortname = 'Google Analytics';
57
- var $ozhicon = 'images/chart_curve.png';
58
- var $optionname = 'Yoast_Google_Analytics';
59
- var $homepage = 'http://yoast.com/wordpress/google-analytics/';
60
- var $toc = '';
61
-
62
- /**
63
- * PHP4 Constructor
64
- */
65
- function GA_Admin() {
66
- $this->__construct();
67
- }
68
-
69
- /**
70
- * Constructur, load all required stuff.
71
- */
72
- function __construct() {
73
- $this->upgrade();
74
-
75
- $this->plugin_url = plugins_url( '', __FILE__ ) . '/';
76
-
77
- // Register the settings page
78
- add_action( 'admin_menu', array( &$this, 'register_settings_page' ) );
79
-
80
- // Register the contextual help for the settings page
81
- // add_action( 'contextual_help', array(&$this, 'plugin_help'), 10, 3 );
82
-
83
- // Give the settings page a nice icon in Ozh's menu
84
- add_filter( 'ozh_adminmenu_icon', array( &$this, 'add_ozh_adminmenu_icon' ) );
85
-
86
- // Give the plugin a settings link in the plugin overview
87
- add_filter( 'plugin_action_links', array( &$this, 'add_action_link' ), 10, 2 );
88
-
89
- // Print Scripts and Styles
90
- add_action( 'admin_print_scripts', array( &$this, 'config_page_scripts' ) );
91
- add_action( 'admin_print_styles', array( &$this, 'config_page_styles' ) );
92
-
93
- // Print stuff in the settings page's head
94
- add_action( 'admin_head', array( &$this, 'config_page_head' ) );
95
-
96
- // Drop a warning on each page of the admin when Google Analytics hasn't been configured
97
- add_action( 'admin_footer', array( &$this, 'warning' ) );
98
-
99
- // Save settings
100
- // TODO: replace with Options API
101
- add_action( 'admin_init', array( &$this, 'save_settings' ) );
102
-
103
- // Authenticate
104
- add_action( 'admin_init', array( &$this, 'authenticate' ) );
105
- }
106
-
107
- function config_page_head() {
108
-
109
- if ( isset( $_GET['allow_tracking'] ) ) {
110
- $options = get_option( 'Yoast_Google_Analytics' );
111
-
112
- $options['tracking_popup'] = 'done';
113
- if ( $_GET['allow_tracking'] == 'yes' )
114
- $options['yoast_tracking'] = true;
115
- else
116
- $options['yoast_tracking'] = false;
117
- update_option( 'Yoast_Google_Analytics', $options );
118
- }
119
-
120
- global $current_screen;
121
- if ( 'settings_page_' . $this->hook == $current_screen->id ) {
122
- $options = get_option( $this->optionname );
123
- if ( !empty( $options['uastring'] ) ) {
124
- $uastring = $options['uastring'];
125
- } else {
126
- $uastring = '';
127
- }
128
-
129
- ?>
130
- <script type="text/javascript">
131
- function makeSublist(parent, child, childVal) {
132
- jQuery("body").append("<select style='display:none' id='" + parent + child + "'></select>");
133
- jQuery('#' + parent + child).html(jQuery("#" + child + " option"));
134
-
135
- var parentValue = jQuery('#' + parent).val();
136
- jQuery('#' + child).html(jQuery("#" + parent + child + " .sub_" + parentValue).clone());
137
-
138
- childVal = (typeof childVal == "undefined") ? "" : childVal;
139
- jQuery("#" + child).val(childVal).attr('selected', 'selected');
140
-
141
- jQuery('#' + parent).change(function () {
142
- var parentValue = jQuery('#' + parent).val();
143
- jQuery('#' + child).html(jQuery("#" + parent + child + " .sub_" + parentValue).clone());
144
- jQuery('#' + child).trigger("change");
145
- jQuery('#' + child).focus();
146
- });
147
- }
148
- jQuery(document).ready(function () {
149
- makeSublist('ga_account', 'uastring_sel', '<?php echo $uastring; ?>');
150
- jQuery('#position').change(function () {
151
- if (jQuery('#position').val() == 'header') {
152
- jQuery('#position_header').css("display", "block");
153
- jQuery('#position_manual').css("display", "none");
154
- } else {
155
- jQuery('#position_header').css("display", "none");
156
- jQuery('#position_manual').css("display", "block");
157
- }
158
- }).change();
159
- jQuery('#switchtomanual').change(function () {
160
- if (jQuery('#switchtomanual').is(':checked')) {
161
- jQuery('#uastring_manual').css('display', 'block');
162
- jQuery('#uastring_automatic').css('display', 'none');
163
- } else {
164
- jQuery('#uastring_manual').css('display', 'none');
165
- jQuery('#uastring_automatic').css('display', 'block');
166
- }
167
- }).change();
168
- jQuery('#trackoutbound').change(function () {
169
- if (jQuery('#trackoutbound').is(':checked')) {
170
- jQuery('#internallinktracking').css("display", "block");
171
- jQuery('.internallinktracking').css("display", "list-item");
172
- } else {
173
- jQuery('#internallinktracking').css("display", "none");
174
- jQuery('.internallinktracking').css("display", "none");
175
- }
176
- }).change();
177
- jQuery('#advancedsettings').change(function () {
178
- if (jQuery('#advancedsettings').is(':checked')) {
179
- jQuery('#advancedgasettings').css("display", "block");
180
- jQuery('#customvarsettings').css("display", "block");
181
- jQuery('.advancedgasettings').css("display", "list-item");
182
- jQuery('.customvarsettings').css("display", "list-item");
183
- } else {
184
- jQuery('#advancedgasettings').css("display", "none");
185
- jQuery('#customvarsettings').css("display", "none");
186
- jQuery('.advancedgasettings').css("display", "none");
187
- jQuery('.customvarsettings').css("display", "none");
188
- }
189
- }).change();
190
- jQuery('#extrase').change(function () {
191
- if (jQuery('#extrase').is(':checked')) {
192
- jQuery('#extrasebox').css("display", "block");
193
- } else {
194
- jQuery('#extrasebox').css("display", "none");
195
- }
196
- }).change();
197
- jQuery('#gajslocalhosting').change(function () {
198
- if (jQuery('#gajslocalhosting').is(':checked')) {
199
- jQuery('#localhostingbox').css("display", "block");
200
- } else {
201
- jQuery('#localhostingbox').css("display", "none");
202
- }
203
- }).change();
204
- jQuery('#customvarsettings :input').change(function () {
205
- if (jQuery("#customvarsettings :input:checked").size() > 5) {
206
- alert("<?php _e( 'The maximum number of allowed custom variables in Google Analytics is 5, please unselect one of the other custom variables before selecting this one.' ); ?>");
207
- jQuery(this).attr('checked', false);
208
- }
209
- ;
210
- });
211
- jQuery('#uastring').change(function () {
212
- if (jQuery('#switchtomanual').is(':checked')) {
213
- if (!jQuery(this).val().match(/^UA-[\d-]+$/)) {
214
- alert("<?php _e( 'That\'s not a valid UA ID, please make sure it matches the expected pattern of: UA-XXXXXX-X, and that there are no spaces or other characters in the input field.' ); ?>");
215
- jQuery(this).focus();
216
- }
217
- }
218
- });
219
- });
220
- </script>
221
- <link rel="shortcut icon" href="<?php echo $this->plugin_url; ?>images/favicon.ico"/>
222
- <?php
223
- }
224
- }
225
-
226
- function plugin_help( $contextual_help, $screen_id, $screen ) {
227
- if ( $screen_id == 'settings_page_' . $this->hook ) {
228
-
229
- $contextual_help = '<h2>' . __( 'Having problems?' ) . '</h2>' .
230
- '<p>' . sprintf( __( "If you're having problems with this plugin, please refer to its <a href='%s'>FAQ page</a>." ), 'http://yoast.com/wordpress/google-analytics/ga-wp-faq/' ) . '</p>';
231
- }
232
- return $contextual_help;
233
- }
234
-
235
- function toc( $modules ) {
236
- $output = '<ul>';
237
- foreach ( $modules as $module => $key ) {
238
- $output .= '<li class="' . $key . '"><a href="#' . $key . '">' . $module . '</a></li>';
239
- }
240
- $output .= '</ul>';
241
- return $output;
242
- }
243
-
244
- function save_settings() {
245
- $options = get_option( $this->optionname );
246
-
247
- if ( isset( $_REQUEST['reset'] ) && $_REQUEST['reset'] == "true" && isset( $_REQUEST['plugin'] ) && $_REQUEST['plugin'] == 'google-analytics-for-wordpress' ) {
248
- $options = $this->set_defaults();
249
- $options['msg'] = "<div class=\"updated\"><p>" . __( 'Google Analytics settings reset.' ) . "</p></div>\n";
250
- } elseif ( isset( $_POST['submit'] ) && isset( $_POST['plugin'] ) && $_POST['plugin'] == 'google-analytics-for-wordpress' ) {
251
-
252
- if ( !current_user_can( 'manage_options' ) ) die( __( 'You cannot edit the Google Analytics for WordPress options.' ) );
253
- check_admin_referer( 'analyticspp-config' );
254
-
255
- foreach ( array( 'uastring', 'dlextensions', 'domainorurl', 'position', 'domain', 'customcode', 'ga_token', 'extraseurl', 'gajsurl', 'gfsubmiteventpv', 'trackprefix', 'ignore_userlevel', 'internallink', 'internallinklabel', 'primarycrossdomain', 'othercrossdomains' ) as $option_name ) {
256
- if ( isset( $_POST[$option_name] ) )
257
- $options[$option_name] = $_POST[$option_name];
258
- else
259
- $options[$option_name] = '';
260
- }
261
-
262
- foreach ( array( 'extrase', 'trackoutbound', 'admintracking', 'trackadsense', 'allowanchor', 'allowlinker', 'allowhash', 'rsslinktagging', 'advancedsettings', 'trackregistration', 'theme_updated', 'cv_loggedin', 'cv_authorname', 'cv_category', 'cv_all_categories', 'cv_tags', 'cv_year', 'cv_post_type', 'outboundpageview', 'downloadspageview', 'trackcrossdomain', 'gajslocalhosting', 'manual_uastring', 'taggfsubmit', 'wpec_tracking', 'shopp_tracking', 'anonymizeip', 'trackcommentform', 'debug', 'firebuglite', 'yoast_tracking' ) as $option_name ) {
263
- if ( isset( $_POST[$option_name] ) && $_POST[$option_name] == 'on' )
264
- $options[$option_name] = true;
265
- else
266
- $options[$option_name] = false;
267
- }
268
-
269
- if ( isset( $_POST['manual_uastring'] ) && isset( $_POST['uastring_man'] ) ) {
270
- $options['uastring'] = $_POST['uastring_man'];
271
- }
272
-
273
- if ( $options['trackcrossdomain'] ) {
274
- if ( !$options['allowlinker'] )
275
- $options['allowlinker'] = true;
276
-
277
- if ( empty( $options['primarycrossdomain'] ) ) {
278
- $origin = GA_Filter::ga_get_domain( $_SERVER["HTTP_HOST"] );
279
- $options['primarycrossdomain'] = $origin["domain"];
280
- }
281
- }
282
-
283
- if ( function_exists( 'w3tc_pgcache_flush' ) )
284
- w3tc_pgcache_flush();
285
-
286
- if ( function_exists( 'w3tc_dbcache_flush' ) )
287
- w3tc_dbcache_flush();
288
-
289
- if ( function_exists( 'w3tc_minify_flush' ) )
290
- w3tc_minify_flush();
291
-
292
- if ( function_exists( 'w3tc_objectcache_flush' ) )
293
- w3tc_objectcache_flush();
294
-
295
- if ( function_exists( 'wp_cache_clear_cache' ) )
296
- wp_cache_clear_cache();
297
-
298
- $options['msg'] = "<div id=\"updatemessage\" class=\"updated fade\"><p>Google Analytics <strong>settings updated</strong>.</p></div>\n";
299
- $options['msg'] .= "<script type=\"text/javascript\">setTimeout(function(){jQuery('#updatemessage').hide('slow');}, 3000);</script>";
300
- }
301
- update_option( $this->optionname, $options );
302
- }
303
-
304
- function save_button() {
305
- return '<div class="alignright"><input type="submit" class="button-primary" name="submit" value="' . __( 'Update Google Analytics Settings &raquo;' ) . '" /></div><br class="clear"/>';
306
- }
307
-
308
- function upgrade() {
309
- $options = get_option( $this->optionname );
310
- if ( isset( $options['version'] ) && $options['version'] < '4.04' ) {
311
- if ( !isset( $options['ignore_userlevel'] ) || $options['ignore_userlevel'] == '' )
312
- $options['ignore_userlevel'] = 11;
313
- }
314
- if ( !isset( $options['version'] ) || $options['version'] != GAWP_VERSION ) {
315
- $options['version'] = GAWP_VERSION;
316
- }
317
- update_option( $this->optionname, $options );
318
- }
319
-
320
- function config_page() {
321
- $options = get_option( $this->optionname );
322
- if ( isset( $options['msg'] ) )
323
- echo $options['msg'];
324
- $options['msg'] = '';
325
- update_option( $this->optionname, $options );
326
-
327
- if ( !isset( $options['uastring'] ) )
328
- $options = $this->set_defaults();
329
- $modules = array();
330
-
331
- if ( !isset( $options['manual_uastring'] ) )
332
- $options['manual_uastring'] = '';
333
- ?>
334
- <div class="wrap">
335
- <a href="http://yoast.com/">
336
- <div id="yoast-icon"
337
- style="background: url(<?php echo $this->plugin_url; ?>images/ga-icon-32x32.png) no-repeat;"
338
- class="icon32"><br/></div>
339
- </a>
340
-
341
- <h2><?php _e( "Google Analytics for WordPress Configuration" ) ?></h2>
342
-
343
- <div class="postbox-container" style="width:65%;">
344
- <div class="metabox-holder">
345
- <div class="meta-box-sortables">
346
- <form action="<?php echo $this->plugin_options_url(); ?>" method="post" id="analytics-conf">
347
- <input type="hidden" name="plugin" value="google-analytics-for-wordpress"/>
348
- <?php
349
- wp_nonce_field( 'analyticspp-config' );
350
-
351
- if ( empty( $options['uastring'] ) && empty( $options['ga_token'] ) ) {
352
- $query = $this->plugin_options_url() . '&reauth=true';
353
- $line = 'Please authenticate with Google Analytics to retrieve your tracking code:<br/><br/> <a class="button-primary" href="' . $query . '">Click here to authenticate with Google</a><br/><br/><strong>Note</strong>: if you have multiple Google accounts, you\'ll want to switch to the right account first, since Google doesn\'t let you switch accounts on the authentication screen.';
354
- } else if ( isset( $options['ga_token'] ) && !empty( $options['ga_token'] ) ) {
355
- $token = $options['ga_token'];
356
-
357
- require_once plugin_dir_path( __FILE__ ) . 'xmlparser.php';
358
- if ( file_exists( ABSPATH . 'wp-includes/class-http.php' ) )
359
- require_once( ABSPATH . 'wp-includes/class-http.php' );
360
-
361
- if ( !isset( $options['ga_api_responses'][$token] ) ) {
362
- $options['ga_api_responses'] = array();
363
-
364
- if ( $oauth = $options['gawp_oauth'] ) {
365
- if ( isset( $oauth['params']['oauth_token'], $oauth['params']['oauth_token_secret'] ) ) {
366
- $options['gawp_oauth']['access_token'] = array(
367
- 'oauth_token' => base64_decode( $oauth['params']['oauth_token'] ),
368
- 'oauth_token_secret' => base64_decode( $oauth['params']['oauth_token_secret'] )
369
- );
370
- unset( $options['gawp_oauth']['params'] );
371
- update_option( $this->optionname, $options );
372
- }
373
- }
374
-
375
- $args = array(
376
- 'scope' => 'https://www.google.com/analytics/feeds/',
377
- 'xoauth_displayname' => 'Google Analytics for WordPress by Yoast'
378
- );
379
- $access_token = $options['gawp_oauth']['access_token'];
380
- $gdata = new WP_Gdata( $args, $access_token['oauth_token'], $access_token['oauth_token_secret'] );
381
-
382
-
383
- $response = $gdata->get( 'https://www.google.com/analytics/feeds/accounts/default' );
384
- $http_code = wp_remote_retrieve_response_code( $response );
385
- $response = wp_remote_retrieve_body( $response );
386
-
387
-
388
- if ( $http_code == 200 ) {
389
- $options['ga_api_responses'][$token] = array(
390
- 'response'=> array( 'code'=> $http_code ),
391
- 'body' => $response
392
- );
393
- $options['ga_token'] = $token;
394
- update_option( 'Yoast_Google_Analytics', $options );
395
- }
396
- }
397
-
398
- if ( isset( $options['ga_api_responses'][$token] ) && is_array( $options['ga_api_responses'][$token] ) && $options['ga_api_responses'][$token]['response']['code'] == 200 ) {
399
- $arr = yoast_xml2array( $options['ga_api_responses'][$token]['body'] );
400
-
401
- $ga_accounts = array();
402
- if ( isset( $arr['feed']['entry'][0] ) ) {
403
- foreach ( $arr['feed']['entry'] as $site ) {
404
- $ua = $site['dxp:property']['3_attr']['value'];
405
- $account = $site['dxp:property']['1_attr']['value'];
406
- if ( !isset( $ga_accounts[$account] ) || !is_array( $ga_accounts[$account] ) )
407
- $ga_accounts[$account] = array();
408
- $ga_accounts[$account][$site['title']] = $ua;
409
- }
410
- } else {
411
- $ua = $arr['feed']['entry']['dxp:property']['3_attr']['value'];
412
- $account = $arr['feed']['entry']['dxp:property']['1_attr']['value'];
413
- $title = $arr['feed']['entry']['title'];
414
- if ( !isset( $ga_accounts[$account] ) || !is_array( $ga_accounts[$account] ) )
415
- $ga_accounts[$account] = array();
416
- $ga_accounts[$account][$title] = $ua;
417
- }
418
-
419
- $select1 = '<select style="width:150px;" name="ga_account" id="ga_account">';
420
- $select1 .= "\t<option></option>\n";
421
- $select2 = '<select style="width:150px;" name="uastring" id="uastring_sel">';
422
- $i = 1;
423
- $currentua = '';
424
- if ( !empty( $options['uastring'] ) )
425
- $currentua = $options['uastring'];
426
-
427
- foreach ( $ga_accounts as $account => $val ) {
428
- $accountsel = false;
429
- foreach ( $val as $title => $ua ) {
430
- $sel = selected( $ua, $currentua, false );
431
- if ( !empty( $sel ) ) {
432
- $accountsel = true;
433
- }
434
- $select2 .= "\t" . '<option class="sub_' . $i . '" ' . $sel . ' value="' . $ua . '">' . $title . ' - ' . $ua . '</option>' . "\n";
435
- }
436
- $select1 .= "\t" . '<option ' . selected( $accountsel, true, false ) . ' value="' . $i . '">' . $account . '</option>' . "\n";
437
- $i++;
438
- }
439
- $select1 .= '</select>';
440
- $select2 .= '</select>';
441
-
442
- $line = '<input type="hidden" name="ga_token" value="' . $token . '"/>';
443
- $line .= 'Please select the correct Analytics profile to track:<br/>';
444
- $line .= '<table class="form_table">';
445
- $line .= '<tr><th width="15%">Account:</th><td width="85%">' . $select1 . '</td></tr>';
446
- $line .= '<tr><th>Profile:</th><td>' . $select2 . '</td></tr>';
447
- $line .= '</table>';
448
-
449
- $try = 1;
450
- if ( isset( $_GET['try'] ) )
451
- $try = $_GET['try'] + 1;
452
-
453
- if ( $i == 1 && $try < 4 && isset( $_GET['token'] ) ) {
454
- $line .= '<script type="text/javascript">
455
- window.location="' . $this->plugin_options_url() . '&switchua=1&token=' . $token . '&try=' . $try . '";
456
- </script>';
457
- }
458
- $line .= 'Please note that if you have several profiles of the same website, it doesn\'t matter which profile you select, and in fact another profile might show as selected later. You can check whether they\'re profiles for the same site by checking if they have the same UA code. If that\'s true, tracking will be correct.<br/>';
459
- $line .= '<br/>Refresh this listing or switch to another account: ';
460
- } else {
461
- $line = 'Unfortunately, an error occurred while connecting to Google, please try again:';
462
- }
463
-
464
- $query = $this->plugin_options_url() . '&reauth=true';
465
- $line .= '<a class="button" href="' . $query . '">Re-authenticate with Google</a>';
466
- } else {
467
- $line = '<input id="uastring" name="uastring" type="text" size="20" maxlength="40" value="' . $options['uastring'] . '"/><br/><a href="' . $this->plugin_options_url() . '&amp;switchua=1">Select another Analytics Profile &raquo;</a>';
468
- }
469
- $line = '<div id="uastring_automatic">' . $line . '</div><div style="display:none;" id="uastring_manual">Manually enter your UA code: <input id="uastring" name="uastring_man" type="text" size="20" maxlength="40" value="' . $options['uastring'] . '"/></div>';
470
- $rows = array();
471
- $content = '';
472
- $rows[] = array(
473
- 'id' => 'uastring',
474
- 'label' => 'Analytics Profile',
475
- 'desc' => '<input type="checkbox" name="manual_uastring" ' . checked( $options['manual_uastring'], true, false ) . ' id="switchtomanual"/> <label for="switchtomanual">Manually enter your UA code</label>',
476
- 'content' => $line
477
- );
478
- $temp_content = $this->select( 'position', array( 'header' => 'In the header (default)', 'manual' => 'Insert manually' ) );
479
- if ( $options['theme_updated'] && $options['position'] == 'manual' ) {
480
- $temp_content .= '<input type="hidden" name="theme_updated" value="off"/>';
481
- echo '<div id="message" class="updated" style="background-color:lightgreen;border-color:green;"><p><strong>Notice:</strong> You switched your theme, please make sure your Google Analytics tracking is still ok. Save your settings to make sure Google Analytics gets loaded properly.</p></div>';
482
- remove_action( 'admin_footer', array( &$this, 'theme_switch_warning' ) );
483
- }
484
- $desc = '<div id="position_header">The header is by far the best spot to place the tracking code. If you\'d rather place the code manually, switch to manual placement. For more info <a href="http://yoast.com/wordpress/google-analytics/manual-placement/">read this page</a>.</div>';
485
- $desc .= '<div id="position_manual"><a href="http://yoast.com/wordpress/google-analytics/manual-placement/">Follow the instructions here</a> to choose the location for your tracking code manually.</div>';
486
-
487
- $rows[] = array(
488
- 'id' => 'position',
489
- 'label' => 'Where should the tracking code be placed',
490
- 'desc' => $desc,
491
- 'content' => $temp_content,
492
- );
493
- $rows[] = array(
494
- 'id' => 'trackoutbound',
495
- 'label' => 'Track outbound clicks &amp; downloads',
496
- 'desc' => 'Clicks &amp; downloads will be tracked as events, you can find these under Content &raquo; Event Tracking in your Google Analytics reports.',
497
- 'content' => $this->checkbox( 'trackoutbound' ),
498
- );
499
- $rows[] = array(
500
- 'id' => 'advancedsettings',
501
- 'label' => 'Show advanced settings',
502
- 'desc' => 'Only adviced for advanced users who know their way around Google Analytics',
503
- 'content' => $this->checkbox( 'advancedsettings' ),
504
- );
505
- $rows[] = array(
506
- 'id' => 'yoast_tracking',
507
- 'label' => 'Allow tracking of anonymous data',
508
- 'desc' => 'By allowing us to track anonymous data we can better help you, because we know with which WordPress configurations, themes and plugins we should test. No personal data will be submitted.',
509
- 'content' => $this->checkbox( 'yoast_tracking' ),
510
- );
511
- $this->postbox( 'gasettings', 'Google Analytics Settings', $this->form_table( $rows ) . $this->save_button() );
512
-
513
- $rows = array();
514
- $pre_content = '<p>Google Analytics allows you to save up to 5 custom variables on each page, and this plugin helps you make the most use of these! Check which custom variables you\'d like the plugin to save for you below. Please note that these will only be saved when they are actually available.</p><p>If you want to start using these custom variables, go to Visitors &raquo; Custom Variables in your Analytics reports.</p>';
515
- $rows[] = array(
516
- 'id' => 'cv_loggedin',
517
- 'label' => 'Logged in Users',
518
- 'desc' => 'Allows you to easily remove logged in users from your reports, or to segment by different user roles. The users primary role will be logged.',
519
- 'content' => $this->checkbox( 'cv_loggedin' ),
520
- );
521
- $rows[] = array(
522
- 'id' => 'cv_post_type',
523
- 'label' => 'Post type',
524
- 'desc' => 'Allows you to see pageviews per post type, especially useful if you use multiple custom post types.',
525
- 'content' => $this->checkbox( 'cv_post_type' ),
526
- );
527
- $rows[] = array(
528
- 'id' => 'cv_authorname',
529
- 'label' => 'Author Name',
530
- 'desc' => 'Allows you to see pageviews per author.',
531
- 'content' => $this->checkbox( 'cv_authorname' ),
532
- );
533
- $rows[] = array(
534
- 'id' => 'cv_tags',
535
- 'label' => 'Tags',
536
- 'desc' => 'Allows you to see pageviews per tags using advanced segments.',
537
- 'content' => $this->checkbox( 'cv_tags' ),
538
- );
539
- $rows[] = array(
540
- 'id' => 'cv_year',
541
- 'label' => 'Publication year',
542
- 'desc' => 'Allows you to see pageviews per year of publication, showing you if your old posts still get traffic.',
543
- 'content' => $this->checkbox( 'cv_year' ),
544
- );
545
- $rows[] = array(
546
- 'id' => 'cv_category',
547
- 'label' => 'Single Category',
548
- 'desc' => 'Allows you to see pageviews per category, works best when each post is in only one category.',
549
- 'content' => $this->checkbox( 'cv_category' ),
550
- );
551
- $rows[] = array(
552
- 'id' => 'cv_all_categories',
553
- 'label' => 'All Categories',
554
- 'desc' => 'Allows you to see pageviews per category using advanced segments, should be used when you use multiple categories per post.',
555
- 'content' => $this->checkbox( 'cv_all_categories' ),
556
- );
557
-
558
- $modules['Custom Variables'] = 'customvarsettings';
559
- $this->postbox( 'customvarsettings', 'Custom Variables Settings', $pre_content . $this->form_table( $rows ) . $this->save_button() );
560
-
561
- $rows = array();
562
- $rows[] = array(
563
- 'id' => 'ignore_userlevel',
564
- 'label' => 'Ignore users',
565
- 'desc' => 'Users of the role you select and higher will be ignored, so if you select Editor, all Editors and Administrators will be ignored.',
566
- 'content' => $this->select( 'ignore_userlevel', array(
567
- '11' => 'Ignore no-one',
568
- '8' => 'Administrator',
569
- '5' => 'Editor',
570
- '2' => 'Author',
571
- '1' => 'Contributor',
572
- '0' => 'Subscriber (ignores all logged in users)',
573
- ) ),
574
- );
575
- $rows[] = array(
576
- 'id' => 'outboundpageview',
577
- 'label' => 'Track outbound clicks as pageviews',
578
- 'desc' => 'You do not need to enable this to enable outbound click tracking, this changes the default behavior of tracking clicks as events to tracking them as pageviews. This is therefore not recommended, as this would skew your statistics, but <em>is</em> sometimes necessary when you need to set outbound clicks as goals.',
579
- 'content' => $this->checkbox( 'outboundpageview' ),
580
- );
581
- $rows[] = array(
582
- 'id' => 'downloadspageview',
583
- 'label' => 'Track downloads as pageviews',
584
- 'desc' => 'Not recommended, as this would skew your statistics, but it does make it possible to track downloads as goals.',
585
- 'content' => $this->checkbox( 'downloadspageview' ),
586
- );
587
- $rows[] = array(
588
- 'id' => 'dlextensions',
589
- 'label' => 'Extensions of files to track as downloads',
590
- 'content' => $this->textinput( 'dlextensions' ),
591
- );
592
- if ( $options['outboundpageview'] ) {
593
- $rows[] = array(
594
- 'id' => 'trackprefix',
595
- 'label' => 'Prefix to use in Analytics before the tracked pageviews',
596
- 'desc' => 'This prefix is used before all pageviews, they are then segmented automatically after that. If nothing is entered here, <code>/yoast-ga/</code> is used.',
597
- 'content' => $this->textinput( 'trackprefix' ),
598
- );
599
- }
600
- $rows[] = array(
601
- 'id' => 'domainorurl',
602
- 'label' => 'Track full URL of outbound clicks or just the domain',
603
- 'content' => $this->select( 'domainorurl', array(
604
- 'domain' => 'Just the domain',
605
- 'url' => 'Track the complete URL',
606
- )
607
- ),
608
- );
609
- $rows[] = array(
610
- 'id' => 'domain',
611
- 'label' => 'Subdomain Tracking',
612
- 'desc' => 'This allows you to set the domain that\'s set by <a href="http://code.google.com/apis/analytics/docs/gaJS/gaJSApiDomainDirectory.html#_gat.GA_Tracker_._setDomainName"><code>setDomainName</code></a> for tracking subdomains, if empty this will not be set.',
613
- 'content' => $this->textinput( 'domain' ),
614
- );
615
- $rows[] = array(
616
- 'id' => 'trackcrossdomain',
617
- 'label' => 'Enable Cross Domain Tracking',
618
- 'desc' => 'This allows you to enable <a href="http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html">Cross-Domain Tracking</a> for this site. When endabled <code>_setAllowLinker:</code> will be enabled if it is not already.',
619
- 'content' => $this->checkbox( 'trackcrossdomain' ),
620
- );
621
- $rows[] = array(
622
- 'id' => 'primarycrossdomain',
623
- 'label' => 'Cross-Domain Tracking, Primary Domain',
624
- 'desc' => 'Set the primary domain used in <a href="http://code.google.com/apis/analytics/docs/gaJS/gaJSApiDomainDirectory.html#_gat.GA_Tracker_._setDomainName"><code>setDomainName</code></a> for cross domain tracking (eg. <code>example-petstore.com</code> ), if empty this will default to your configured Home URL.',
625
- 'content' => $this->textinput( 'primarycrossdomain' ),
626
- );
627
- $rows[] = array(
628
- 'id' => 'othercrossdomains',
629
- 'label' => 'Cross-Domain Tracking, Other Domains',
630
- 'desc' => 'All links to these domains will have the <a href="http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html#multipleDomains"><code>_link</code></a> code automatically attached. Separate domains/sub-domains with commas (eg. <code>dogs.example-petstore.com, cats.example-petstore.com</code>)',
631
- 'content' => $this->textinput( 'othercrossdomains' ),
632
- );
633
- $rows[] = array(
634
- 'id' => 'customcode',
635
- 'label' => 'Custom Code',
636
- 'desc' => 'Not for the average user: this allows you to add a line of code, to be added before the <code>trackPageview</code> call.',
637
- 'content' => $this->textinput( 'customcode' ),
638
- );
639
- $rows[] = array(
640
- 'id' => 'trackadsense',
641
- 'label' => 'Track AdSense',
642
- 'desc' => 'This requires integration of your Analytics and AdSense account, for help, <a href="http://google.com/support/analytics/bin/answer.py?answer=92625">look here</a>.',
643
- 'content' => $this->checkbox( 'trackadsense' ),
644
- );
645
- $rows[] = array(
646
- 'id' => 'gajslocalhosting',
647
- 'label' => 'Host ga.js locally',
648
- 'content' => $this->checkbox( 'gajslocalhosting' ) . '<div id="localhostingbox">
649
- You have to provide a URL to your ga.js file:
650
- <input type="text" name="gajsurl" size="30" value="' . $options['gajsurl'] . '"/>
651
- </div>',
652
- 'desc' => 'For some reasons you might want to use a locally hosted ga.js file, or another ga.js file, check the box and then please enter the full URL including http here.'
653
- );
654
- $rows[] = array(
655
- 'id' => 'extrase',
656
- 'label' => 'Track extra Search Engines',
657
- 'content' => $this->checkbox( 'extrase' ) . '<div id="extrasebox">
658
- You can provide a custom URL to the extra search engines file if you want:
659
- <input type="text" name="extraseurl" size="30" value="' . $options['extraseurl'] . '"/>
660
- </div>',
661
- );
662
- $rows[] = array(
663
- 'id' => 'rsslinktagging',
664
- 'label' => 'Tag links in RSS feed with campaign variables',
665
- 'desc' => 'Do not use this feature if you use FeedBurner, as FeedBurner can do this automatically, and better than this plugin can. Check <a href="http://www.google.com/support/feedburner/bin/answer.py?hl=en&amp;answer=165769">this help page</a> for info on how to enable this feature in FeedBurner.',
666
- 'content' => $this->checkbox( 'rsslinktagging' ),
667
- );
668
- $rows[] = array(
669
- 'id' => 'trackregistration',
670
- 'label' => 'Add tracking to the login and registration forms',
671
- 'content' => $this->checkbox( 'trackregistration' ),
672
- );
673
- $rows[] = array(
674
- 'id' => 'trackcommentform',
675
- 'label' => 'Add tracking to the comment forms',
676
- 'content' => $this->checkbox( 'trackcommentform' ),
677
- );
678
- $rows[] = array(
679
- 'id' => 'allowanchor',
680
- 'label' => 'Use # instead of ? for Campaign tracking',
681
- 'desc' => 'This adds a <code><a href="http://code.google.com/apis/analytics/docs/gaJSApiCampaignTracking.html#_gat.GA_Tracker_._setAllowAnchor">_setAllowAnchor</a></code> call to your tracking code, and makes RSS link tagging use a # as well.',
682
- 'content' => $this->checkbox( 'allowanchor' ),
683
- );
684
- $rows[] = array(
685
- 'id' => 'allowlinker',
686
- 'label' => 'Add <code>_setAllowLinker</code>',
687
- 'desc' => 'This adds a <code><a href="http://code.google.com/apis/analytics/docs/gaJS/gaJSApiDomainDirectory.html#_gat.GA_Tracker_._setAllowLinker">_setAllowLinker</a></code> call to your tracking code, allowing you to use <code>_link</code> and related functions.',
688
- 'content' => $this->checkbox( 'allowlinker' ),
689
- );
690
- $rows[] = array(
691
- 'id' => 'allowhash',
692
- 'label' => 'Set <code>_setAllowHash</code> to false',
693
- 'desc' => 'This sets <code><a href="http://code.google.com/apis/analytics/docs/gaJS/gaJSApiDomainDirectory.html#_gat.GA_Tracker_._setAllowHash">_setAllowHash</a></code> to false, allowing you to track subdomains etc.',
694
- 'content' => $this->checkbox( 'allowhash' ),
695
- );
696
- $rows[] = array(
697
- 'id' => 'anonymizeip',
698
- 'label' => 'Anonymize IP\'s',
699
- 'desc' => 'This adds <code><a href="http://code.google.com/apis/analytics/docs/gaJS/gaJSApi_gat.html#_gat._anonymizeIp">_anonymizeIp</a></code>, telling Google Analytics to anonymize the information sent by the tracker objects by removing the last octet of the IP address prior to its storage.',
700
- 'content' => $this->checkbox( 'anonymizeip' ),
701
- );
702
- $modules['Advanced Settings'] = 'advancedgasettings';
703
- $this->postbox( 'advancedgasettings', 'Advanced Settings', $this->form_table( $rows ) . $this->save_button() );
704
-
705
- $rows = array();
706
- $rows[] = array(
707
- 'id' => 'internallink',
708
- 'label' => 'Internal links to track as outbound',
709
- 'desc' => 'If you want to track all internal links that begin with <code>/out/</code>, enter <code>/out/</code> in the box above. If you have multiple prefixes you can separate them with comma\'s: <code>/out/,/recommends/</code>',
710
- 'content' => $this->textinput( 'internallink' ),
711
- );
712
- $rows[] = array(
713
- 'id' => 'internallinklabel',
714
- 'label' => 'Label to use',
715
- 'desc' => 'The label to use for these links, this will be added to where the click came from, so if the label is "aff", the label for a click from the content of an article becomes "outbound-article-aff".',
716
- 'content' => $this->textinput( 'internallinklabel' ),
717
- );
718
- $modules['Internal Link Tracking'] = 'internallinktracking';
719
- $this->postbox( 'internallinktracking', 'Internal Links to Track as Outbound', $this->form_table( $rows ) . $this->save_button() );
720
-
721
- /* if (class_exists('RGForms') && GFCommon::$version >= '1.3.11') {
722
- $pre_content = 'This plugin can automatically tag your Gravity Forms to track form submissions as either events or pageviews';
723
- $rows = array();
724
- $rows[] = array(
725
- 'id' => 'taggfsubmit',
726
- 'label' => 'Tag Gravity Forms',
727
- 'content' => $this->checkbox('taggfsubmit'),
728
- );
729
- $rows[] = array(
730
- 'id' => 'gfsubmiteventpv',
731
- 'label' => 'Tag Gravity Forms as',
732
- 'content' => '<select name="gfsubmiteventpv">
733
- <option value="events" '.selected($options['gfsubmiteventpv'],'events',false).'>Events</option>
734
- <option value="pageviews" '.selected($options['gfsubmiteventpv'],'pageviews',false).'>Pageviews</option>
735
- </select>',
736
- );
737
- $this->postbox('gravityforms','Gravity Forms Settings',$pre_content.$this->form_table($rows).$this->save_button());
738
- $modules['Gravity Forms'] = 'gravityforms';
739
- }
740
- */
741
- if ( defined( 'WPSC_VERSION' ) ) {
742
- $pre_content = 'The WordPress e-Commerce plugin has been detected. This plugin can automatically add transaction tracking for you. To do that, <a href="http://yoast.com/wordpress/google-analytics/enable-ecommerce/">enable e-commerce for your reports in Google Analytics</a> and then check the box below.';
743
- $rows = array();
744
- $rows[] = array(
745
- 'id' => 'wpec_tracking',
746
- 'label' => 'Enable transaction tracking',
747
- 'content' => $this->checkbox( 'wpec_tracking' ),
748
- );
749
- $this->postbox( 'wpecommerce', 'WordPress e-Commerce Settings', $pre_content . $this->form_table( $rows ) . $this->save_button() );
750
- $modules['WordPress e-Commerce'] = 'wpecommerce';
751
- }
752
-
753
- global $Shopp;
754
- if ( isset( $Shopp ) ) {
755
- $pre_content = 'The Shopp e-Commerce plugin has been detected. This plugin can automatically add transaction tracking for you. To do that, <a href="http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&amp;answer=55528">enable e-commerce for your reports in Google Analytics</a> and then check the box below.';
756
- $rows = array();
757
- $rows[] = array(
758
- 'id' => 'shopp_tracking',
759
- 'label' => 'Enable transaction tracking',
760
- 'content' => $this->checkbox( 'shopp_tracking' ),
761
- );
762
- $this->postbox( 'shoppecommerce', 'Shopp e-Commerce Settings', $pre_content . $this->form_table( $rows ) . $this->save_button() );
763
- $modules['Shopp'] = 'shoppecommerce';
764
- }
765
- $pre_content = '<p>If you want to confirm that tracking on your blog is working as it should, enable this option and check the console in <a href="http://getfirebug.com/">Firebug</a> (for Firefox), <a href="http://getfirebug.com/firebuglite">Firebug Lite</a> (for other browsers) or Chrome &amp; Safari\'s Web Inspector. Be absolutely sure to disable debugging afterwards, as it is slower than normal tracking.</p><p><strong>Note</strong>: the debugging and firebug scripts are only loaded for admins.</p>';
766
- $rows = array();
767
- $rows[] = array(
768
- 'id' => 'debug',
769
- 'label' => 'Enable debug mode',
770
- 'content' => $this->checkbox( 'debug' ),
771
- );
772
- $rows[] = array(
773
- 'id' => 'firebuglite',
774
- 'label' => 'Enable Firebug Lite',
775
- 'content' => $this->checkbox( 'firebuglite' ),
776
- );
777
- $this->postbox( 'debugmode', 'Debug Mode', $pre_content . $this->form_table( $rows ) . $this->save_button() );
778
- $modules['Debug Mode'] = 'debugmode';
779
- ?>
780
- </form>
781
- <form action="<?php echo $this->plugin_options_url(); ?>" method="post"
782
- onsubmit="javascript:return(confirm('Do you really want to reset all settings?'));">
783
- <input type="hidden" name="reset" value="true"/>
784
- <input type="hidden" name="plugin" value="google-analytics-for-wordpress"/>
785
-
786
- <div class="submit"><input type="submit" value="Reset All Settings &raquo;"/></div>
787
- </form>
788
- </div>
789
- </div>
790
- </div>
791
- <div class="postbox-container side" style="width:20%;">
792
- <div class="metabox-holder">
793
- <div class="meta-box-sortables">
794
- <?php
795
- if ( count( $modules ) > 0 )
796
- $this->postbox( 'toc', 'List of Available Modules', $this->toc( $modules ) );
797
- $this->postbox( 'donate', '<strong class="red">' . __( 'Help Spread the Word!' ) . '</strong>', '<p><strong>' . __( 'Want to help make this plugin even better? All donations are used to improve this plugin, so donate $20, $50 or $100 now!' ) . '</strong></p><form style="width:160px;margin:0 auto;" action="https://www.paypal.com/cgi-bin/webscr" method="post">
798
- <input type="hidden" name="cmd" value="_s-xclick">
799
- <input type="hidden" name="hosted_button_id" value="FW9FK4EBZ9FVJ">
800
- <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit">
801
- <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
802
- </form>'
803
- . '<p>' . __( 'Or you could:' ) . '</p>'
804
- . '<ul>'
805
- . '<li><a href="http://wordpress.org/extend/plugins/google-analytics-for-wordpress/">' . __( 'Rate the plugin 5★ on WordPress.org' ) . '</a></li>'
806
- . '<li><a href="http://wordpress.org/tags/google-analytics-for-wordpress">' . __( 'Help out other users in the forums' ) . '</a></li>'
807
- . '<li>' . sprintf( __( 'Blog about it & link to the %1$splugin page%2$s' ), '<a href="http://yoast.com/wordpress/google-analytics/#utm_source=wpadmin&utm_medium=sidebanner&utm_term=link&utm_campaign=wpgaplugin">', '</a>' ) . '</li>' );
808
- $this->postbox( 'sitereview', '<strong>' . __( 'Want to Improve your Site?' ) . '</strong>', '<p>' . sprintf( __( 'If you want to improve your site, but don\'t know where to start, you should order a %1$swebsite review%2$s from Yoast!' ), '<a href="http://yoast.com/hire-me/website-review/#utm_source=wpadmin&utm_medium=sidebanner&utm_term=link&utm_campaign=wpgaplugin">', '</a>' ) . '</p>' . '<p>' . __( 'The results of this review contain a full report of improvements for your site, encompassing my findings for improvements in different key areas such as SEO to Usability to Site Speed & more.' ) . '</p>' . '<p><a class="button-secondary" href="http://yoast.com/hire-me/website-review/#utm_source=wpadmin&utm_medium=sidebanner&utm_term=button&utm_campaign=wpgaplugin">' . __( 'Click here to read more &raquo;' ) . '</a></p>' );
809
-
810
- $this->plugin_support();
811
- $this->news();
812
- ?>
813
- </div>
814
- <br/><br/><br/>
815
- </div>
816
- </div>
817
- </div>
818
- <?php
819
- }
820
-
821
- function set_defaults() {
822
- $options = array(
823
- 'advancedsettings' => false,
824
- 'allowanchor' => false,
825
- 'allowhash' => false,
826
- 'allowlinker' => false,
827
- 'anonymizeip' => false,
828
- 'customcode' => '',
829
- 'cv_loggedin' => false,
830
- 'cv_authorname' => false,
831
- 'cv_category' => false,
832
- 'cv_all_categories' => false,
833
- 'cv_tags' => false,
834
- 'cv_year' => false,
835
- 'cv_post_type' => false,
836
- 'debug' => false,
837
- 'dlextensions' => 'doc,exe,js,pdf,ppt,tgz,zip,xls',
838
- 'domain' => '',
839
- 'domainorurl' => 'domain',
840
- 'extrase' => false,
841
- 'extraseurl' => '',
842
- 'firebuglite' => false,
843
- 'ga_token' => '',
844
- 'ga_api_responses' => array(),
845
- 'gajslocalhosting' => false,
846
- 'gajsurl' => '',
847
- 'ignore_userlevel' => '11',
848
- 'internallink' => false,
849
- 'internallinklabel' => '',
850
- 'outboundpageview' => false,
851
- 'downloadspageview' => false,
852
- 'othercrossdomains' => '',
853
- 'position' => 'footer',
854
- 'primarycrossdomain' => '',
855
- 'theme_updated' => false,
856
- 'trackcommentform' => true,
857
- 'trackcrossdomain' => false,
858
- 'trackadsense' => false,
859
- 'trackoutbound' => true,
860
- 'trackregistration' => false,
861
- 'rsslinktagging' => true,
862
- 'uastring' => '',
863
- 'version' => GAWP_VERSION,
864
- );
865
- update_option( $this->optionname, $options );
866
- return $options;
867
- }
868
-
869
- function warning() {
870
- $options = get_option( $this->optionname );
871
- if ( !isset( $options['uastring'] ) || empty( $options['uastring'] ) ) {
872
- echo "<div id='message' class='error'><p><strong>Google Analytics is not active.</strong> You must <a href='" . $this->plugin_options_url() . "'>select which Analytics Profile to track</a> before it can work.</p></div>";
873
- }
874
- } // end warning()
875
-
876
-
877
- function authenticate() {
878
- if ( isset( $_REQUEST['ga_oauth_callback'] ) ) {
879
- $o = get_option( $this->optionname );
880
- if ( isset( $o['gawp_oauth']['oauth_token'] ) && $o['gawp_oauth']['oauth_token'] == $_REQUEST['oauth_token'] ) {
881
- $gdata = new WP_GData(
882
- array(
883
- 'scope' => 'https://www.google.com/analytics/feeds/',
884
- 'xoauth_displayname' => 'Google Analytics for WordPress by Yoast'
885
- ),
886
- $o['gawp_oauth']['oauth_token'],
887
- $o['gawp_oauth']['oauth_token_secret']
888
- );
889
-
890
- $o['gawp_oauth']['access_token'] = $gdata->get_access_token( $_REQUEST['oauth_verifier'] );
891
- unset( $o['gawp_oauth']['oauth_token'] );
892
- unset( $o['gawp_oauth']['oauth_token_secret'] );
893
- $o['ga_token'] = $o['gawp_oauth']['access_token']['oauth_token'];
894
- }
895
-
896
- update_option( $this->optionname, $o );
897
-
898
- wp_redirect( menu_page_url( $this->hook, false ) );
899
- exit;
900
- }
901
-
902
- if ( !empty( $_GET['reauth'] ) ) {
903
- $gdata = new WP_GData(
904
- array(
905
- 'scope' => 'https://www.google.com/analytics/feeds/',
906
- 'xoauth_displayname' => 'Google Analytics for WordPress by Yoast'
907
- )
908
- );
909
-
910
- $oauth_callback = add_query_arg( array( 'ga_oauth_callback' => 1 ), menu_page_url( 'google-analytics-for-wordpress', false ) );
911
- $request_token = $gdata->get_request_token( $oauth_callback );
912
-
913
- $options = get_option( $this->optionname );
914
- unset( $options['ga_token'] );
915
- unset( $options['gawp_oauth']['access_token'] );
916
- $options['gawp_oauth']['oauth_token'] = $request_token['oauth_token'];
917
- $options['gawp_oauth']['oauth_token_secret'] = $request_token['oauth_token_secret'];
918
- update_option( $this->optionname, $options );
919
-
920
- wp_redirect( $gdata->get_authorize_url( $request_token ) );
921
- exit;
922
- }
923
-
924
- } //end reauthenticate()
925
- } // end class GA_Admin
926
-
927
- $ga_admin = new GA_Admin();
928
- } //endif
929
-
930
-
931
- /**
932
- * Code that actually inserts stuff into pages.
933
- */
934
- if ( !class_exists( 'GA_Filter' ) ) {
935
- class GA_Filter {
936
-
937
- /**
938
- * Cleans the variable to make it ready for storing in Google Analytics
939
- */
940
- function ga_str_clean( $val ) {
941
- return remove_accents( str_replace( '---', '-', str_replace( ' ', '-', strtolower( html_entity_decode( $val ) ) ) ) );
942
- }
943
-
944
- /*
945
- * Insert the tracking code into the page
946
- */
947
- function spool_analytics() {
948
- global $wp_query;
949
- // echo '<!--'.print_r($wp_query,1).'-->';
950
-
951
- $options = get_option( 'Yoast_Google_Analytics' );
952
-
953
- if ( !isset( $options['uastring'] ) || $options['uastring'] == '' ) {
954
- if ( current_user_can( 'manage_options' ) )
955
- echo "<!-- Google Analytics tracking code not shown because yo haven't chosen a Google Analytics account yet. -->\n";
956
- return;
957
- }
958
 
959
- /**
960
- * The order of custom variables is very, very important: custom vars should always take up the same slot to make analysis easy.
961
- */
962
- $customvarslot = 1;
963
- if ( yoast_ga_do_tracking() && !is_preview() ) {
964
- $push = array();
965
 
966
- if ( $options['allowanchor'] )
967
- $push[] = "'_setAllowAnchor',true";
968
 
969
- if ( $options['allowlinker'] )
970
- $push[] = "'_setAllowLinker',true";
971
 
972
- if ( $options['anonymizeip'] )
973
- $push[] = "'_gat._anonymizeIp'";
974
 
975
- if ( isset( $options['domain'] ) && $options['domain'] != "" )
976
- $push[] = "'_setDomainName','" . $options['domain'] . "'";
977
-
978
- if ( isset( $options['trackcrossdomain'] ) && $options['trackcrossdomain'] )
979
- $push[] = "'_setDomainName','" . $options['primarycrossdomain'] . "'";
980
-
981
- if ( isset( $options['allowhash'] ) && $options['allowhash'] )
982
- $push[] = "'_setAllowHash',false";
983
-
984
- if ( $options['cv_loggedin'] ) {
985
- $current_user = wp_get_current_user();
986
- if ( $current_user && $current_user->ID != 0 )
987
- $push[] = "'_setCustomVar',$customvarslot,'logged-in','" . $current_user->roles[0] . "',1";
988
- // Customvar slot needs to be upped even when the user is not logged in, to make sure the variables below are always in the same slot.
989
- $customvarslot++;
990
- }
991
-
992
- if ( function_exists( 'is_post_type_archive' ) && is_post_type_archive() ) {
993
- if ( $options['cv_post_type'] ) {
994
- $post_type = get_post_type();
995
- if ( $post_type ) {
996
- $push[] = "'_setCustomVar'," . $customvarslot . ",'post_type','" . $post_type . "',3";
997
- $customvarslot++;
998
- }
999
- }
1000
- } else if ( is_singular() && !is_home() ) {
1001
- if ( $options['cv_post_type'] ) {
1002
- $post_type = get_post_type();
1003
- if ( $post_type ) {
1004
- $push[] = "'_setCustomVar'," . $customvarslot . ",'post_type','" . $post_type . "',3";
1005
- $customvarslot++;
1006
- }
1007
- }
1008
- if ( $options['cv_authorname'] ) {
1009
- $push[] = "'_setCustomVar',$customvarslot,'author','" . GA_Filter::ga_str_clean( get_the_author_meta( 'display_name', $wp_query->post->post_author ) ) . "',3";
1010
- $customvarslot++;
1011
- }
1012
- if ( $options['cv_tags'] ) {
1013
- $i = 0;
1014
- if ( get_the_tags() ) {
1015
- $tagsstr = '';
1016
- foreach ( get_the_tags() as $tag ) {
1017
- if ( $i > 0 )
1018
- $tagsstr .= ' ';
1019
- $tagsstr .= $tag->slug;
1020
- $i++;
1021
- }
1022
- // Max 64 chars for value and label combined, hence 64 - 4
1023
- $tagsstr = substr( $tagsstr, 0, 60 );
1024
- $push[] = "'_setCustomVar',$customvarslot,'tags','" . $tagsstr . "',3";
1025
- }
1026
- $customvarslot++;
1027
- }
1028
- if ( is_singular() ) {
1029
- if ( $options['cv_year'] ) {
1030
- $push[] = "'_setCustomVar',$customvarslot,'year','" . get_the_time( 'Y' ) . "',3";
1031
- $customvarslot++;
1032
- }
1033
- if ( $options['cv_category'] && is_single() ) {
1034
- $cats = get_the_category();
1035
- if ( is_array( $cats ) && isset( $cats[0] ) )
1036
- $push[] = "'_setCustomVar',$customvarslot,'category','" . $cats[0]->slug . "',3";
1037
- $customvarslot++;
1038
- }
1039
- if ( $options['cv_all_categories'] && is_single() ) {
1040
- $i = 0;
1041
- $catsstr = '';
1042
- foreach ( (array) get_the_category() as $cat ) {
1043
- if ( $i > 0 )
1044
- $catsstr .= ' ';
1045
- $catsstr .= $cat->slug;
1046
- $i++;
1047
- }
1048
- // Max 64 chars for value and label combined, hence 64 - 10
1049
- $catsstr = substr( $catsstr, 0, 54 );
1050
- $push[] = "'_setCustomVar',$customvarslot,'categories','" . $catsstr . "',3";
1051
- $customvarslot++;
1052
- }
1053
- }
1054
- }
1055
-
1056
- $push = apply_filters( 'yoast-ga-custom-vars', $push, $customvarslot );
1057
-
1058
- $push = apply_filters( 'yoast-ga-push-before-pageview', $push );
1059
-
1060
- if ( is_404() ) {
1061
- $push[] = "'_trackPageview','/404.html?page=' + document.location.pathname + document.location.search + '&from=' + document.referrer";
1062
- } else if ( $wp_query->is_search ) {
1063
- $pushstr = "'_trackPageview','" . get_bloginfo( 'url' ) . "/?s=";
1064
- if ( $wp_query->found_posts == 0 ) {
1065
- $push[] = $pushstr . "no-results:" . rawurlencode( $wp_query->query_vars['s'] ) . "&cat=no-results'";
1066
- } else if ( $wp_query->found_posts == 1 ) {
1067
- $push[] = $pushstr . rawurlencode( $wp_query->query_vars['s'] ) . "&cat=1-result'";
1068
- } else if ( $wp_query->found_posts > 1 && $wp_query->found_posts < 6 ) {
1069
- $push[] = $pushstr . rawurlencode( $wp_query->query_vars['s'] ) . "&cat=2-5-results'";
1070
- } else {
1071
- $push[] = $pushstr . rawurlencode( $wp_query->query_vars['s'] ) . "&cat=plus-5-results'";
1072
- }
1073
- } else {
1074
- $push[] = "'_trackPageview'";
1075
- }
1076
-
1077
- $push = apply_filters( 'yoast-ga-push-after-pageview', $push );
1078
-
1079
- if ( defined( 'WPSC_VERSION' ) && $options['wpec_tracking'] )
1080
- $push = GA_Filter::wpec_transaction_tracking( $push );
1081
-
1082
- if ( $options['shopp_tracking'] ) {
1083
- global $Shopp;
1084
- if ( isset( $Shopp ) )
1085
- $push = GA_Filter::shopp_transaction_tracking( $push );
1086
- }
1087
-
1088
- $pushstr = "";
1089
- foreach ( $push as $key ) {
1090
- if ( !empty( $pushstr ) )
1091
- $pushstr .= ",";
1092
-
1093
- $pushstr .= "[" . $key . "]";
1094
- }
1095
-
1096
- if ( current_user_can( 'manage_options' ) && $options['firebuglite'] && $options['debug'] )
1097
- echo '<script src="https://getfirebug.com/firebug-lite.js" type="text/javascript"></script>';
1098
- ?>
1099
-
1100
- <script type="text/javascript">//<![CDATA[
1101
- // Google Analytics for WordPress by Yoast v<?php echo GAWP_VERSION; ?> | http://yoast.com/wordpress/google-analytics/
1102
- var _gaq = _gaq || [];
1103
- _gaq.push(['_setAccount', '<?php echo trim( $options["uastring"] ); ?>']);
1104
- <?php
1105
- if ( $options["extrase"] ) {
1106
- if ( !empty( $options["extraseurl"] ) ) {
1107
- $url = $options["extraseurl"];
1108
- } else {
1109
- $url = plugins_url( 'custom_se_async.js', __FILE__ );
1110
- }
1111
- echo '</script><script src="' . $url . '" type="text/javascript"></script>' . "\n" . '<script type="text/javascript">';
1112
- }
1113
-
1114
- if ( $options['customcode'] && trim( $options['customcode'] ) != '' )
1115
- echo "\t" . stripslashes( $options['customcode'] ) . "\n";
1116
- ?>
1117
- _gaq.push(<?php echo $pushstr; ?>);
1118
- (function () {
1119
- var ga = document.createElement('script');
1120
- ga.type = 'text/javascript';
1121
- ga.async = true;
1122
- ga.src = <?php
1123
- if ( $options['gajslocalhosting'] && !empty( $options['gajsurl'] ) ) {
1124
- echo "'" . $options['gajsurl'] . "';";
1125
- } else {
1126
- $script = 'ga.js';
1127
- if ( current_user_can( 'manage_options' ) && $options['debug'] )
1128
- $script = 'u/ga_debug.js';
1129
- echo "('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/" . $script . "';";
1130
- }
1131
- ?>
1132
-
1133
- var s = document.getElementsByTagName('script')[0];
1134
- s.parentNode.insertBefore(ga, s);
1135
- })();
1136
- //]]></script>
1137
- <?php
1138
- } else if ( $options["uastring"] != "" ) {
1139
- echo "<!-- Google Analytics tracking code not shown because users over level " . $options["ignore_userlevel"] . " are ignored -->\n";
1140
- }
1141
- }
1142
-
1143
- /*
1144
- * Insert the AdSense parameter code into the page. This'll go into the header per Google's instructions.
1145
- */
1146
- function spool_adsense() {
1147
- $options = get_option( 'Yoast_Google_Analytics' );
1148
- if ( $options["uastring"] != "" && yoast_ga_do_tracking() && !is_preview() ) {
1149
- echo '<script type="text/javascript">' . "\n";
1150
- echo "\t" . 'window.google_analytics_uacct = "' . $options["uastring"] . '";' . "\n";
1151
- echo '</script>' . "\n";
1152
- }
1153
- }
1154
-
1155
- function ga_get_tracking_prefix() {
1156
- $options = get_option( 'Yoast_Google_Analytics' );
1157
- return ( empty( $options['trackprefix'] ) ) ? '/yoast-ga/' : $options['trackprefix'];
1158
- }
1159
-
1160
- function ga_get_tracking_link( $prefix, $target, $jsprefix = 'javascript:' ) {
1161
- $options = get_option( 'Yoast_Google_Analytics' );
1162
- if (
1163
- ( $prefix != 'download' && $options['outboundpageview'] ) ||
1164
- ( $prefix == 'download' && $options['downloadspageview'] )
1165
- ) {
1166
- $prefix = GA_Filter::ga_get_tracking_prefix() . $prefix;
1167
- $pushstr = "['_trackPageview','" . $prefix . "/" . esc_js( esc_url( $target ) ) . "']";
1168
- } else {
1169
- $pushstr = "['_trackEvent','" . $prefix . "','" . esc_js( esc_url( $target ) ) . "']";
1170
- }
1171
- return $jsprefix . "_gaq.push(" . $pushstr . ");";
1172
- }
1173
-
1174
- function ga_get_domain( $uri ) {
1175
- $hostPattern = "/^(http:\/\/)?([^\/]+)/i";
1176
- $domainPatternUS = "/[^\.\/]+\.[^\.\/]+$/";
1177
- $domainPatternUK = "/[^\.\/]+\.[^\.\/]+\.[^\.\/]+$/";
1178
-
1179
- preg_match( $hostPattern, $uri, $matches );
1180
- $host = $matches[2];
1181
- if ( preg_match( "/.*\..*\..*\..*$/", $host ) )
1182
- preg_match( $domainPatternUK, $host, $matches );
1183
- else
1184
- preg_match( $domainPatternUS, $host, $matches );
1185
-
1186
- if ( isset($matches[0]) ) {
1187
- return array( "domain"=> $matches[0], "host"=> $host );
1188
- } else {
1189
- return false;
1190
- }
1191
- }
1192
-
1193
- function ga_parse_link( $category, $matches ) {
1194
- $origin = GA_Filter::ga_get_domain( $_SERVER["HTTP_HOST"] );
1195
- $options = get_option( 'Yoast_Google_Analytics' );
1196
-
1197
- // Break out immediately if the link is not an http or https link.
1198
- if ( strpos( $matches[2], "http" ) !== 0 ) {
1199
- $target = false;
1200
- } else if ( ( strpos( $matches[2], "mailto" ) === 0 ) ) {
1201
- $target = 'email';
1202
- } else {
1203
- $target = GA_Filter::ga_get_domain( $matches[3] );
1204
- }
1205
- $trackBit = "";
1206
- $extension = substr( strrchr( $matches[3], '.' ), 1 );
1207
- $dlextensions = explode( ",", str_replace( '.', '', $options['dlextensions'] ) );
1208
- if ( $target ) {
1209
- if ( $target == 'email' ) {
1210
- $trackBit = GA_Filter::ga_get_tracking_link( 'mailto', str_replace( 'mailto:', '', $matches[3] ), '' );
1211
- } else if ( in_array( $extension, $dlextensions ) ) {
1212
- $trackBit = GA_Filter::ga_get_tracking_link( 'download', $matches[3], '' );
1213
- } else if ( $target["domain"] != $origin["domain"] ) {
1214
- $crossdomains = array();
1215
- if ( isset( $options['othercrossdomains'] ) )
1216
- $crossdomains = explode( ',', str_replace( ' ', '', $options['othercrossdomains'] ) );
1217
- if ( isset( $options['trackcrossdomain'] ) && $options['trackcrossdomain'] && in_array( $target["host"], $crossdomains ) ) {
1218
- $trackBit = '_gaq.push([\'_link\', \'' . $matches[2] . '//' . $matches[3] . '\']); return false;"';
1219
- } else if ( $options['trackoutbound'] && in_array( $options['domainorurl'], array( 'domain', 'url' ) ) ) {
1220
- $url = $options['domainorurl'] == 'domain' ? $target["host"] : $matches[3];
1221
- $trackBit = GA_Filter::ga_get_tracking_link( $category, $url, '' );
1222
- }
1223
- $trackBit = GA_Filter::ga_get_tracking_link( $category, $url, '' );
1224
- } else if ( $target["domain"] == $origin["domain"] && isset( $options['internallink'] ) && $options['internallink'] != '' ) {
1225
- $url = preg_replace( '|' . $origin["host"] . '|', '', $matches[3] );
1226
- $extintlinks = explode( ',', $options['internallink'] );
1227
- foreach ( $extintlinks as $link ) {
1228
- if ( preg_match( '|^' . trim( $link ) . '|', $url, $match ) ) {
1229
- $label = $options['internallinklabel'];
1230
- if ( $label == '' )
1231
- $label = 'int';
1232
- $trackBit = GA_Filter::ga_get_tracking_link( $category . '-' . $label, $url, '' );
1233
- }
1234
- }
1235
- }
1236
- }
1237
- if ( $trackBit != "" ) {
1238
- if ( preg_match( '/onclick=[\'\"](.*?)[\'\"]/i', $matches[4] ) > 0 ) {
1239
- // Check for manually tagged outbound clicks, and replace them with the tracking of choice.
1240
- if ( preg_match( '/.*_track(Pageview|Event).*/i', $matches[4] ) > 0 ) {
1241
- $matches[4] = preg_replace( '/onclick=[\'\"](javascript:)?(.*;)?[a-zA-Z0-9]+\._track(Pageview|Event)\([^\)]+\)(;)?(.*)?[\'\"]/i', 'onclick="javascript:' . $trackBit . '$2$5"', $matches[4] );
1242
- } else {
1243
- $matches[4] = preg_replace( '/onclick=[\'\"](javascript:)?(.*?)[\'\"]/i', 'onclick="javascript:' . $trackBit . '$2"', $matches[4] );
1244
- }
1245
- } else {
1246
- $matches[4] = 'onclick="javascript:' . $trackBit . '"' . $matches[4];
1247
- }
1248
- }
1249
- return '<a ' . $matches[1] . 'href="' . $matches[2] . '//' . $matches[3] . '"' . ' ' . $matches[4] . '>' . $matches[5] . '</a>';
1250
- }
1251
-
1252
- function ga_parse_article_link( $matches ) {
1253
- return GA_Filter::ga_parse_link( 'outbound-article', $matches );
1254
- }
1255
-
1256
- function ga_parse_comment_link( $matches ) {
1257
- return GA_Filter::ga_parse_link( 'outbound-comment', $matches );
1258
- }
1259
-
1260
- function ga_parse_widget_link( $matches ) {
1261
- return GA_Filter::ga_parse_link( 'outbound-widget', $matches );
1262
- }
1263
-
1264
- function ga_parse_nav_menu( $matches ) {
1265
- return GA_Filter::ga_parse_link( 'outbound-menu', $matches );
1266
- }
1267
-
1268
- function widget_content( $text ) {
1269
- if ( !yoast_ga_do_tracking() )
1270
- return $text;
1271
- static $anchorPattern = '/<a (.*?)href=[\'\"](.*?)\/\/([^\'\"]+?)[\'\"](.*?)>(.*?)<\/a>/i';
1272
- $text = preg_replace_callback( $anchorPattern, array( 'GA_Filter', 'ga_parse_widget_link' ), $text );
1273
- return $text;
1274
- }
1275
-
1276
- function the_content( $text ) {
1277
- if ( !yoast_ga_do_tracking() )
1278
- return $text;
1279
-
1280
- if ( !is_feed() ) {
1281
- static $anchorPattern = '/<a (.*?)href=[\'\"](.*?)\/\/([^\'\"]+?)[\'\"](.*?)>(.*?)<\/a>/i';
1282
- $text = preg_replace_callback( $anchorPattern, array( 'GA_Filter', 'ga_parse_article_link' ), $text );
1283
- }
1284
- return $text;
1285
- }
1286
-
1287
- function nav_menu( $text ) {
1288
- if ( !yoast_ga_do_tracking() )
1289
- return $text;
1290
-
1291
- if ( !is_feed() ) {
1292
- static $anchorPattern = '/<a (.*?)href=[\'\"](.*?)\/\/([^\'\"]+?)[\'\"](.*?)>(.*?)<\/a>/i';
1293
- $text = preg_replace_callback( $anchorPattern, array( 'GA_Filter', 'ga_parse_nav_menu' ), $text );
1294
- }
1295
- return $text;
1296
- }
1297
-
1298
- function comment_text( $text ) {
1299
- if ( !yoast_ga_do_tracking() )
1300
- return $text;
1301
-
1302
- if ( !is_feed() ) {
1303
- static $anchorPattern = '/<a (.*?)href="(.*?)\/\/(.*?)"(.*?)>(.*?)<\/a>/i';
1304
- $text = preg_replace_callback( $anchorPattern, array( 'GA_Filter', 'ga_parse_comment_link' ), $text );
1305
- }
1306
- return $text;
1307
- }
1308
-
1309
- function comment_author_link( $text ) {
1310
- $options = get_option( 'Yoast_Google_Analytics' );
1311
-
1312
- if ( !yoast_ga_do_tracking() )
1313
- return $text;
1314
-
1315
- static $anchorPattern = '/(.*\s+.*?href\s*=\s*)["\'](.*?)["\'](.*)/';
1316
- preg_match( $anchorPattern, $text, $matches );
1317
- if ( !isset( $matches[2] ) || $matches[2] == "" ) return $text;
1318
-
1319
- $trackBit = '';
1320
- $target = GA_Filter::ga_get_domain( $matches[2] );
1321
- $origin = GA_Filter::ga_get_domain( $_SERVER["HTTP_HOST"] );
1322
- if ( $target["domain"] != $origin["domain"] ) {
1323
- if ( isset( $options['domainorurl'] ) && $options['domainorurl'] == "domain" )
1324
- $url = $target["host"];
1325
- else
1326
- $url = $matches[2];
1327
- $trackBit = 'onclick="' . GA_Filter::ga_get_tracking_link( 'outbound-commentauthor', $url ) . '"';
1328
- }
1329
- return $matches[1] . "\"" . $matches[2] . "\" " . $trackBit . " " . $matches[3];
1330
- }
1331
-
1332
- function bookmarks( $bookmarks ) {
1333
- if ( !yoast_ga_do_tracking() )
1334
- return $bookmarks;
1335
-
1336
- $i = 0;
1337
- while ( $i < count( $bookmarks ) ) {
1338
- $target = GA_Filter::ga_get_domain( $bookmarks[$i]->link_url );
1339
- $sitedomain = GA_Filter::ga_get_domain( get_bloginfo( 'url' ) );
1340
- if ( $target['host'] == $sitedomain['host'] ) {
1341
- $i++;
1342
- continue;
1343
- }
1344
- if ( isset( $options['domainorurl'] ) && $options['domainorurl'] == "domain" )
1345
- $url = $target["host"];
1346
- else
1347
- $url = $bookmarks[$i]->link_url;
1348
- $trackBit = '" onclick="' . GA_Filter::ga_get_tracking_link( 'outbound-blogroll', $url );
1349
- $bookmarks[$i]->link_target .= $trackBit;
1350
- $i++;
1351
- }
1352
- return $bookmarks;
1353
- }
1354
-
1355
- function rsslinktagger( $guid ) {
1356
- $options = get_option( 'Yoast_Google_Analytics' );
1357
- global $wp, $post;
1358
- if ( is_feed() ) {
1359
- if ( $options['allowanchor'] ) {
1360
- $delimiter = '#';
1361
- } else {
1362
- $delimiter = '?';
1363
- if ( strpos( $guid, $delimiter ) > 0 )
1364
- $delimiter = '&amp;';
1365
- }
1366
- return $guid . $delimiter . 'utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=' . urlencode( $post->post_name );
1367
- }
1368
- return $guid;
1369
- }
1370
-
1371
- function wpec_transaction_tracking( $push ) {
1372
- global $wpdb, $purchlogs, $cart_log_id;
1373
- if ( !isset( $cart_log_id ) || empty( $cart_log_id ) )
1374
- return $push;
1375
-
1376
- $city = $wpdb->get_var( "SELECT tf.value
1377
- FROM " . WPSC_TABLE_SUBMITED_FORM_DATA . " tf
1378
- LEFT JOIN " . WPSC_TABLE_CHECKOUT_FORMS . " cf
1379
- ON cf.id = tf.form_id
1380
- WHERE cf.type = 'city'
1381
- AND log_id = " . $cart_log_id );
1382
-
1383
- $country = $wpdb->get_var( "SELECT tf.value
1384
- FROM " . WPSC_TABLE_SUBMITED_FORM_DATA . " tf
1385
- LEFT JOIN " . WPSC_TABLE_CHECKOUT_FORMS . " cf
1386
- ON cf.id = tf.form_id
1387
- WHERE cf.type = 'country'
1388
- AND log_id = " . $cart_log_id );
1389
-
1390
- $cart_items = $wpdb->get_results( "SELECT * FROM " . WPSC_TABLE_CART_CONTENTS . " WHERE purchaseid = " . $cart_log_id, ARRAY_A );
1391
-
1392
- $total_shipping = $purchlogs->allpurchaselogs[0]->base_shipping;
1393
- $total_tax = 0;
1394
- foreach ( $cart_items as $item ) {
1395
- $total_shipping += $item['pnp'];
1396
- $total_tax += $item['tax_charged'];
1397
- }
1398
-
1399
- $push[] = "'_addTrans','" . $cart_log_id . "'," // Order ID
1400
- . "'" . GA_Filter::ga_str_clean( get_bloginfo( 'name' ) ) . "'," // Store name
1401
- . "'" . nzshpcrt_currency_display( $purchlogs->allpurchaselogs[0]->totalprice, 1, true, false, true ) . "'," // Total price
1402
- . "'" . nzshpcrt_currency_display( $total_tax, 1, true, false, true ) . "'," // Tax
1403
- . "'" . nzshpcrt_currency_display( $total_shipping, 1, true, false, true ) . "'," // Shipping
1404
- . "'" . $city . "'," // City
1405
- . "''," // State
1406
- . "'" . $country . "'"; // Country
1407
-
1408
- foreach ( $cart_items as $item ) {
1409
- $item['sku'] = $wpdb->get_var( "SELECT meta_value FROM " . WPSC_TABLE_PRODUCTMETA . " WHERE meta_key = 'sku' AND product_id = '" . $item['prodid'] . "' LIMIT 1" );
1410
-
1411
- $item['category'] = $wpdb->get_var( "SELECT pc.name FROM " . WPSC_TABLE_PRODUCT_CATEGORIES . " pc LEFT JOIN " . WPSC_TABLE_ITEM_CATEGORY_ASSOC . " ca ON pc.id = ca.category_id WHERE pc.group_id = '1' AND ca.product_id = '" . $item['prodid'] . "'" );
1412
- $push[] = "'_addItem',"
1413
- . "'" . $cart_log_id . "'," // Order ID
1414
- . "'" . $item['sku'] . "'," // Item SKU
1415
- . "'" . str_replace( "'", "", $item['name'] ) . "'," // Item Name
1416
- . "'" . $item['category'] . "'," // Item Category
1417
- . "'" . $item['price'] . "'," // Item Price
1418
- . "'" . $item['quantity'] . "'"; // Item Quantity
1419
- }
1420
- $push[] = "'_trackTrans'";
1421
-
1422
- return $push;
1423
- }
1424
-
1425
- function shopp_transaction_tracking( $push ) {
1426
- global $Shopp;
1427
-
1428
- // Only process if we're in the checkout process (receipt page)
1429
- if ( version_compare( substr( SHOPP_VERSION, 0, 3 ), '1.1' ) >= 0 ) {
1430
- // Only process if we're in the checkout process (receipt page)
1431
- if ( function_exists( 'is_shopp_page' ) && !is_shopp_page( 'checkout' ) ) return $push;
1432
- if ( empty( $Shopp->Order->purchase ) ) return $push;
1433
-
1434
- $Purchase = new Purchase( $Shopp->Order->purchase );
1435
- $Purchase->load_purchased();
1436
- } else {
1437
- // For 1.0.x
1438
- // Only process if we're in the checkout process (receipt page)
1439
- if ( function_exists( 'is_shopp_page' ) && !is_shopp_page( 'checkout' ) ) return $push;
1440
- // Only process if we have valid order data
1441
- if ( !isset( $Shopp->Cart->data->Purchase ) ) return $push;
1442
- if ( empty( $Shopp->Cart->data->Purchase->id ) ) return $push;
1443
-
1444
- $Purchase = $Shopp->Cart->data->Purchase;
1445
- }
1446
-
1447
- $push[] = "'_addTrans',"
1448
- . "'" . $Purchase->id . "'," // Order ID
1449
- . "'" . GA_Filter::ga_str_clean( get_bloginfo( 'name' ) ) . "'," // Store
1450
- . "'" . number_format( $Purchase->total, 2 ) . "'," // Total price
1451
- . "'" . number_format( $Purchase->tax, 2 ) . "'," // Tax
1452
- . "'" . number_format( $Purchase->shipping, 2 ) . "'," // Shipping
1453
- . "'" . $Purchase->city . "'," // City
1454
- . "'" . $Purchase->state . "'," // State
1455
- . "'.$Purchase->country.'"; // Country
1456
-
1457
- foreach ( $Purchase->purchased as $item ) {
1458
- $sku = empty( $item->sku ) ? 'PID-' . $item->product . str_pad( $item->price, 4, '0', STR_PAD_LEFT ) : $item->sku;
1459
- $push[] = "'_addItem',"
1460
- . "'" . $Purchase->id . "',"
1461
- . "'" . $sku . "',"
1462
- . "'" . str_replace( "'", "", $item->name ) . "',"
1463
- . "'" . $item->optionlabel . "',"
1464
- . "'" . number_format( $item->unitprice, 2 ) . "',"
1465
- . "'" . $item->quantity . "'";
1466
- }
1467
- $push[] = "'_trackTrans'";
1468
- return $push;
1469
- }
1470
-
1471
- } // class GA_Filter
1472
- } // endif
1473
-
1474
- /**
1475
- * If setAllowAnchor is set to true, GA ignores all links tagged "normally", so we redirect all "normally" tagged URL's
1476
- * to one tagged with a hash.
1477
- */
1478
- function ga_utm_hashtag_redirect() {
1479
- if ( isset( $_SERVER['REQUEST_URI'] ) ) {
1480
- if ( strpos( $_SERVER['REQUEST_URI'], "utm_" ) !== false ) {
1481
- $url = 'http://';
1482
- if ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] != "" ) {
1483
- $url = 'https://';
1484
- }
1485
- $url .= $_SERVER['SERVER_NAME'];
1486
- if ( strpos( $_SERVER['REQUEST_URI'], "?utm_" ) !== false ) {
1487
- $url .= str_replace( "?utm_", "#utm_", $_SERVER['REQUEST_URI'] );
1488
- } else if ( strpos( $_SERVER['REQUEST_URI'], "&utm_" ) !== false ) {
1489
- $url .= substr_replace( $_SERVER['REQUEST_URI'], "#utm_", strpos( $_SERVER['REQUEST_URI'], "&utm_" ), 5 );
1490
- }
1491
- wp_redirect( $url, 301 );
1492
- exit;
1493
- }
1494
- }
1495
- }
1496
-
1497
- function yoast_ga_do_tracking() {
1498
- $current_user = wp_get_current_user();
1499
-
1500
- if ( 0 == $current_user->ID )
1501
- return true;
1502
-
1503
- $yoast_ga_options = get_option( 'Yoast_Google_Analytics' );
1504
-
1505
- if ( ( $current_user->user_level >= $yoast_ga_options["ignore_userlevel"] ) )
1506
- return false;
1507
- else
1508
- return true;
1509
- }
1510
-
1511
- function track_comment_form_head() {
1512
- if ( is_singular() ) {
1513
- global $post;
1514
- $yoast_ga_options = get_option( 'Yoast_Google_Analytics' );
1515
- if ( yoast_ga_do_tracking()
1516
- && isset( $yoast_ga_options["trackcommentform"] )
1517
- && $yoast_ga_options["trackcommentform"]
1518
- && ( 'open' == $post->comment_status )
1519
- )
1520
- wp_enqueue_script( 'jquery' );
1521
- }
1522
- }
1523
-
1524
- add_action( 'wp_print_scripts', 'track_comment_form_head' );
1525
-
1526
- $comment_form_id = 'commentform';
1527
- function yoast_get_comment_form_id( $args ) {
1528
- global $comment_form_id;
1529
- $comment_form_id = $args['id_form'];
1530
- return $args;
1531
- }
1532
-
1533
- add_filter( 'comment_form_defaults', 'yoast_get_comment_form_id', 99, 1 );
1534
-
1535
- function yoast_track_comment_form() {
1536
- global $comment_form_id, $post;
1537
- $yoast_ga_options = get_option( 'Yoast_Google_Analytics' );
1538
- if ( yoast_ga_do_tracking() && $yoast_ga_options["trackcommentform"] ) {
1539
- ?>
1540
- <script type="text/javascript">
1541
- jQuery(document).ready(function () {
1542
- jQuery('#<?php echo $comment_form_id; ?>').submit(function () {
1543
- _gaq.push(
1544
- ['_setAccount', '<?php echo $yoast_ga_options["uastring"]; ?>'],
1545
- ['_trackEvent', 'comment', 'submit']
1546
- );
1547
- });
1548
- });
1549
- </script>
1550
- <?php
1551
- }
1552
- }
1553
-
1554
- add_action( 'comment_form_after', 'yoast_track_comment_form' );
1555
-
1556
- function yoast_sanitize_relative_links( $content ) {
1557
- preg_match( "|^http(s)?://([^/]+)|i", get_bloginfo( 'url' ), $match );
1558
- $content = preg_replace( "/<a([^>]*) href=('|\")\/([^\"']*)('|\")/", "<a\${1} href=\"" . $match[0] . "/" . "\${3}\"", $content );
1559
-
1560
- if ( is_singular() ) {
1561
- $content = preg_replace( "/<a([^>]*) href=('|\")#([^\"']*)('|\")/", "<a\${1} href=\"" . get_permalink() . "#" . "\${3}\"", $content );
1562
- }
1563
- return $content;
1564
- }
1565
-
1566
- add_filter( 'the_content', 'yoast_sanitize_relative_links', 98 );
1567
- add_filter( 'widget_text', 'yoast_sanitize_relative_links', 98 );
1568
-
1569
- function yoast_analytics() {
1570
  $options = get_option( 'Yoast_Google_Analytics' );
1571
- if ( $options['position'] == 'manual' )
1572
- GA_Filter::spool_analytics();
1573
- else
1574
- echo '<!-- Please set Google Analytics position to "manual" in the settings, or remove this call to yoast_analytics(); -->';
1575
- }
1576
-
1577
- $options = get_option( 'Yoast_Google_Analytics' );
1578
 
1579
- if ( !is_array( $options ) ) {
1580
- $options = get_option( 'GoogleAnalyticsPP' );
1581
- if ( !is_array( $options ) ) {
1582
- if ( !isset( $ga_admin ) )
1583
- $ga_admin = new GA_Admin();
1584
- $ga_admin->set_defaults();
1585
- } else {
1586
- delete_option( 'GoogleAnalyticsPP' );
1587
- if ( $options['admintracking'] ) {
1588
- $options["ignore_userlevel"] = '8';
1589
- unset( $options['admintracking'] );
1590
- } else {
1591
- $options["ignore_userlevel"] = '11';
1592
- }
1593
- update_option( 'Yoast_Google_Analytics', $options );
1594
- }
1595
  } else {
 
1596
 
1597
- if ( !isset( $options['uastring'] ) || $options['uastring'] == '' )
1598
- return;
1599
-
1600
- $gaf = new GA_Filter();
1601
-
1602
- if ( isset( $options['allowanchor'] ) && $options['allowanchor'] ) {
1603
- add_action( 'init', 'ga_utm_hashtag_redirect', 1 );
1604
- }
1605
-
1606
- if ( ( isset( $options['trackoutbound'] ) && $options['trackoutbound'] ) ||
1607
- ( isset( $options['trackcrossdomain'] ) && $options['trackcrossdomain'] )
1608
- ) {
1609
- // filters alter the existing content
1610
- add_filter( 'the_content', array( 'GA_Filter', 'the_content' ), 99 );
1611
- add_filter( 'widget_text', array( 'GA_Filter', 'widget_content' ), 99 );
1612
- add_filter( 'the_excerpt', array( 'GA_Filter', 'the_content' ), 99 );
1613
- add_filter( 'comment_text', array( 'GA_Filter', 'comment_text' ), 99 );
1614
- add_filter( 'get_bookmarks', array( 'GA_Filter', 'bookmarks' ), 99 );
1615
- add_filter( 'get_comment_author_link', array( 'GA_Filter', 'comment_author_link' ), 99 );
1616
- add_filter( 'wp_nav_menu', array( 'GA_Filter', 'nav_menu' ), 99 );
1617
- }
1618
-
1619
- if ( isset( $options['trackadsense'] ) && $options['trackadsense'] )
1620
- add_action( 'wp_head', array( 'GA_Filter', 'spool_adsense' ), 1 );
1621
-
1622
- if ( !isset( $options['position'] ) )
1623
- $options['position'] = 'header';
1624
 
1625
- switch ( $options['position'] ) {
1626
- case 'manual':
1627
- // No need to insert here, bail NOW.
1628
- break;
1629
- case 'header':
1630
- default:
1631
- add_action( 'wp_head', array( 'GA_Filter', 'spool_analytics' ), 2 );
1632
- break;
1633
  }
1634
-
1635
- if ( isset( $options['trackregistration'] ) && $options['trackregistration'] )
1636
- add_action( 'login_head', array( 'GA_Filter', 'spool_analytics' ), 20 );
1637
-
1638
- if ( isset( $options['rsslinktagging'] ) && $options['rsslinktagging'] )
1639
- add_filter( 'the_permalink_rss', array( 'GA_Filter', 'rsslinktagger' ), 99 );
1640
-
1641
  }
4
  Plugin URI: http://yoast.com/wordpress/google-analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=wpgaplugin&utm_content=v420
5
  Description: This plugin makes it simple to add Google Analytics to your WordPress blog, adding lots of features, eg. custom variables and automatic clickout and download tracking.
6
  Author: Joost de Valk
7
+ Version: 4.3
8
  Requires at least: 3.0
9
  Author URI: http://yoast.com/
10
  License: GPL v3
11
 
12
  Google Analytics for WordPress
13
+ Copyright (C) 2008-2013, Joost de Valk - joost@yoast.com
14
 
15
  This program is free software: you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License as published by
26
  along with this program. If not, see <http://www.gnu.org/licenses/>.
27
  */
28
 
29
+ // This plugin was originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics, but has since been rewritten and refactored multiple times.
30
 
31
+ define( "GAWP_VERSION", '4.3' );
32
 
33
+ define( "GAWP_URL", trailingslashit( plugin_dir_url( __FILE__ ) ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
+ define( "GAWP_PATH", plugin_dir_path( __FILE__ ) );
 
 
 
 
 
36
 
37
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
 
38
 
39
+ require_once plugin_dir_path( __FILE__ ) . 'admin/ajax.php';
 
40
 
41
+ } else if ( defined('DOING_CRON') && DOING_CRON ) {
 
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  $options = get_option( 'Yoast_Google_Analytics' );
44
+ if ( isset( $options['yoast_tracking'] ) && $options['yoast_tracking'] )
45
+ require_once GAWP_PATH . 'inc/class-tracking.php';
 
 
 
 
 
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  } else {
48
+ load_plugin_textdomain( 'gawp', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
49
 
50
+ require_once GAWP_PATH . 'inc/functions.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
+ if ( is_admin() ) {
53
+ require_once GAWP_PATH . 'admin/class-admin.php';
54
+ } else {
55
+ require_once GAWP_PATH . 'frontend/class-frontend.php';
 
 
 
 
56
  }
 
 
 
 
 
 
 
57
  }
images/banner-website-review.png ADDED
Binary file
images/chart_curve.png DELETED
Binary file
images/email_sub.png DELETED
Binary file
images/facebook-icon.png DELETED
Binary file
images/ga-icon-32x32.png DELETED
Binary file
images/google-plus-icon.png DELETED
Binary file
images/rss.png DELETED
Binary file
images/twitter-icon.png DELETED
Binary file
images/yoast-16x16.png DELETED
Binary file
images/yoast-logo-rss.png DELETED
Binary file
inc/class-tracking.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Admin
4
+ */
5
+
6
+ if ( !defined( 'GAWP_VERSION' ) ) {
7
+ header( 'HTTP/1.0 403 Forbidden' );
8
+ die;
9
+ }
10
+
11
+ /**
12
+ * Class that creates the tracking functionality for Yoast Plugins, as the core class might be used in more plugins, it's checked for existence first.
13
+ */
14
+ if ( !class_exists( 'Yoast_Tracking' ) ) {
15
+ class Yoast_Tracking {
16
+
17
+ /**
18
+ * Class constructor
19
+ */
20
+ function __construct() {
21
+ // The tracking checks daily, but only sends new data every 7 days.
22
+ if ( !wp_next_scheduled( 'yoast_tracking' ) ) {
23
+ wp_schedule_event( time(), 'daily', 'yoast_tracking' );
24
+ }
25
+
26
+ add_action( 'yoast_tracking', array( $this, 'tracking' ) );
27
+ }
28
+
29
+ /**
30
+ * Main tracking function.
31
+ */
32
+ function tracking() {
33
+ // Start of Metrics
34
+ global $wpdb;
35
+
36
+ $hash = get_option( 'Yoast_Tracking_Hash' );
37
+
38
+ if ( !isset( $hash ) || !$hash || empty( $hash ) ) {
39
+ $hash = md5( site_url() );
40
+ update_option( 'Yoast_Tracking_Hash', $hash );
41
+ }
42
+
43
+ $data = get_transient( 'yoast_tracking_cache' );
44
+ if ( !$data ) {
45
+
46
+ $pts = array();
47
+ foreach ( get_post_types( array( 'public' => true ) ) as $pt ) {
48
+ $count = wp_count_posts( $pt );
49
+ $pts[$pt] = $count->publish;
50
+ }
51
+
52
+ $comments_count = wp_count_comments();
53
+
54
+ // wp_get_theme was introduced in 3.4, for compatibility with older versions, let's do a workaround for now.
55
+ if ( function_exists( 'wp_get_theme' ) ) {
56
+ $theme_data = wp_get_theme();
57
+ $theme = array(
58
+ 'name' => $theme_data->display( 'Name', false, false ),
59
+ 'theme_uri' => $theme_data->display( 'ThemeURI', false, false ),
60
+ 'version' => $theme_data->display( 'Version', false, false ),
61
+ 'author' => $theme_data->display( 'Author', false, false ),
62
+ 'author_uri' => $theme_data->display( 'AuthorURI', false, false ),
63
+ );
64
+ $parent_theme = $theme_data->__get('parent_theme');
65
+ if ( isset( $parent_theme ) && !empty( $parent_theme ) && $theme_data->parent() ) {
66
+ $theme['template'] = array(
67
+ 'version' => $theme_data->parent()->display( 'Version', false, false ),
68
+ 'name' => $theme_data->parent()->display( 'Name', false, false ),
69
+ 'theme_uri' => $theme_data->parent()->display( 'ThemeURI', false, false ),
70
+ 'author' => $theme_data->parent()->display( 'Author', false, false ),
71
+ 'author_uri' => $theme_data->parent()->display( 'AuthorURI', false, false ),
72
+ );
73
+ } else {
74
+ $theme['template'] = '';
75
+ }
76
+ } else {
77
+ $theme_data = (object) get_theme_data( get_stylesheet_directory() . '/style.css' );
78
+ $theme = array(
79
+ 'version' => $theme_data->Version,
80
+ 'name' => $theme_data->Name,
81
+ 'author' => $theme_data->Author,
82
+ 'template' => $theme_data->Template,
83
+ );
84
+ }
85
+
86
+ $plugins = array();
87
+ foreach ( get_option( 'active_plugins' ) as $plugin_path ) {
88
+ $plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_path );
89
+
90
+ $slug = str_replace( '/' . basename( $plugin_path ), '', $plugin_path );
91
+ $plugins[$slug] = array(
92
+ 'version' => $plugin_info['Version'],
93
+ 'name' => $plugin_info['Name'],
94
+ 'plugin_uri' => $plugin_info['PluginURI'],
95
+ 'author' => $plugin_info['AuthorName'],
96
+ 'author_uri' => $plugin_info['AuthorURI'],
97
+ );
98
+ }
99
+
100
+ $data = array(
101
+ 'site' => array(
102
+ 'hash' => $hash,
103
+ 'url' => site_url(),
104
+ 'name' => get_bloginfo( 'name' ),
105
+ 'version' => get_bloginfo( 'version' ),
106
+ 'multisite' => is_multisite(),
107
+ 'users' => count( get_users() ),
108
+ 'lang' => get_locale(),
109
+ ),
110
+ 'pts' => $pts,
111
+ 'comments' => array(
112
+ 'total' => $comments_count->total_comments,
113
+ 'approved' => $comments_count->approved,
114
+ 'spam' => $comments_count->spam,
115
+ 'pings' => $wpdb->get_var( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_type = 'pingback'" ),
116
+ ),
117
+ 'options' => apply_filters( 'yoast_tracking_filters', array() ),
118
+ 'theme' => $theme,
119
+ 'plugins' => $plugins,
120
+ );
121
+
122
+ $args = array(
123
+ 'body' => $data
124
+ );
125
+ wp_remote_post( 'https://tracking.yoast.com/', $args );
126
+
127
+ // Store for a week, then push data again.
128
+ set_transient( 'yoast_tracking_cache', true, 7 * 60 * 60 * 24 );
129
+ }
130
+ }
131
+ }
132
+
133
+ $yoast_tracking = new Yoast_Tracking;
134
+ }
135
+
136
+ /**
137
+ * Adds tracking parameters for Google Analytics settings. Outside of the main class as the class could also be in use in other plugins.
138
+ *
139
+ * @param array $options
140
+ * @return array
141
+ */
142
+ function ystga_tracking_additions( $options ) {
143
+ $opt = get_option('Yoast_Google_Analytics');
144
+
145
+ $options['gawp'] = array(
146
+ 'advanced_settigns' => isset( $opt['advancedsettings'] ) ? 1 : 0,
147
+ );
148
+ return $options;
149
+ }
150
+
151
+ add_filter( 'yoast_tracking_filters', 'ystga_tracking_additions' );
inc/functions.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function yoast_ga_get_domain( $uri ) {
4
+ $hostPattern = "/^(http:\/\/)?([^\/]+)/i";
5
+ $domainPatternUS = "/[^\.\/]+\.[^\.\/]+$/";
6
+ $domainPatternUK = "/[^\.\/]+\.[^\.\/]+\.[^\.\/]+$/";
7
+
8
+ preg_match( $hostPattern, $uri, $matches );
9
+ $host = $matches[2];
10
+ if ( preg_match( "/.*\..*\..*\..*$/", $host ) )
11
+ preg_match( $domainPatternUK, $host, $matches );
12
+ else
13
+ preg_match( $domainPatternUS, $host, $matches );
14
+
15
+ if ( isset( $matches[0] ) ) {
16
+ return array( "domain" => $matches[0], "host" => $host );
17
+ } else {
18
+ return false;
19
+ }
20
+ }
js/chosen-sprite.png ADDED
Binary file
js/chosen-sprite@2x.png ADDED
Binary file
js/chosen.css ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* @group Base */
2
+ .chzn-container {
3
+ font-size: 13px;
4
+ position: relative;
5
+ display: inline-block;
6
+ zoom: 1;
7
+ *display: inline;
8
+ }
9
+ .chzn-container .chzn-drop {
10
+ background: #fff;
11
+ border: 1px solid #aaa;
12
+ border-top: 0;
13
+ position: absolute;
14
+ top: 29px;
15
+ left: 0;
16
+ -webkit-box-shadow: 0 4px 5px rgba(0,0,0,.15);
17
+ -moz-box-shadow : 0 4px 5px rgba(0,0,0,.15);
18
+ box-shadow : 0 4px 5px rgba(0,0,0,.15);
19
+ z-index: 1010;
20
+ }
21
+ /* @end */
22
+
23
+ /* @group Single Chosen */
24
+ .chzn-container-single .chzn-single {
25
+ background-color: #ffffff;
26
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0 );
27
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
28
+ background-image: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
29
+ background-image: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
30
+ background-image: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
31
+ background-image: linear-gradient(#ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
32
+ -webkit-border-radius: 5px;
33
+ -moz-border-radius : 5px;
34
+ border-radius : 5px;
35
+ -moz-background-clip : padding;
36
+ -webkit-background-clip: padding-box;
37
+ background-clip : padding-box;
38
+ border: 1px solid #aaaaaa;
39
+ -webkit-box-shadow: 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
40
+ -moz-box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
41
+ box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
42
+ display: block;
43
+ overflow: hidden;
44
+ white-space: nowrap;
45
+ position: relative;
46
+ height: 23px;
47
+ line-height: 24px;
48
+ padding: 0 0 0 8px;
49
+ color: #444444;
50
+ text-decoration: none;
51
+ }
52
+ .chzn-container-single .chzn-default {
53
+ color: #999;
54
+ }
55
+ .chzn-container-single .chzn-single span {
56
+ margin-right: 26px;
57
+ display: block;
58
+ overflow: hidden;
59
+ white-space: nowrap;
60
+ -o-text-overflow: ellipsis;
61
+ -ms-text-overflow: ellipsis;
62
+ text-overflow: ellipsis;
63
+ }
64
+ .chzn-container-single .chzn-single abbr {
65
+ display: block;
66
+ position: absolute;
67
+ right: 26px;
68
+ top: 6px;
69
+ width: 12px;
70
+ height: 12px;
71
+ font-size: 1px;
72
+ background: url('chosen-sprite.png') -42px 1px no-repeat;
73
+ }
74
+ .chzn-container-single .chzn-single abbr:hover {
75
+ background-position: -42px -10px;
76
+ }
77
+ .chzn-container-single.chzn-disabled .chzn-single abbr:hover {
78
+ background-position: -42px -10px;
79
+ }
80
+ .chzn-container-single .chzn-single div {
81
+ position: absolute;
82
+ right: 0;
83
+ top: 0;
84
+ display: block;
85
+ height: 100%;
86
+ width: 18px;
87
+ }
88
+ .chzn-container-single .chzn-single div b {
89
+ background: url('chosen-sprite.png') no-repeat 0px 2px;
90
+ display: block;
91
+ width: 100%;
92
+ height: 100%;
93
+ }
94
+ .chzn-container-single .chzn-search {
95
+ padding: 3px 4px;
96
+ position: relative;
97
+ margin: 0;
98
+ white-space: nowrap;
99
+ z-index: 1010;
100
+ }
101
+ .chzn-container-single .chzn-search input {
102
+ background: #fff url('chosen-sprite.png') no-repeat 100% -20px;
103
+ background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
104
+ background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
105
+ background: url('chosen-sprite.png') no-repeat 100% -20px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
106
+ background: url('chosen-sprite.png') no-repeat 100% -20px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
107
+ background: url('chosen-sprite.png') no-repeat 100% -20px, linear-gradient(#eeeeee 1%, #ffffff 15%);
108
+ margin: 1px 0;
109
+ padding: 4px 20px 4px 5px;
110
+ outline: 0;
111
+ border: 1px solid #aaa;
112
+ font-family: sans-serif;
113
+ font-size: 1em;
114
+ }
115
+ .chzn-container-single .chzn-drop {
116
+ -webkit-border-radius: 0 0 4px 4px;
117
+ -moz-border-radius : 0 0 4px 4px;
118
+ border-radius : 0 0 4px 4px;
119
+ -moz-background-clip : padding;
120
+ -webkit-background-clip: padding-box;
121
+ background-clip : padding-box;
122
+ }
123
+ /* @end */
124
+
125
+ .chzn-container-single-nosearch .chzn-search input {
126
+ position: absolute;
127
+ left: -9000px;
128
+ }
129
+
130
+ /* @group Multi Chosen */
131
+ .chzn-container-multi .chzn-choices {
132
+ background-color: #fff;
133
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
134
+ background-image: -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
135
+ background-image: -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
136
+ background-image: -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
137
+ background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
138
+ border: 1px solid #aaa;
139
+ margin: 0;
140
+ padding: 0;
141
+ cursor: text;
142
+ overflow: hidden;
143
+ height: auto !important;
144
+ height: 1%;
145
+ position: relative;
146
+ }
147
+ .chzn-container-multi .chzn-choices li {
148
+ float: left;
149
+ list-style: none;
150
+ }
151
+ .chzn-container-multi .chzn-choices .search-field {
152
+ white-space: nowrap;
153
+ margin: 0;
154
+ padding: 0;
155
+ }
156
+ .chzn-container-multi .chzn-choices .search-field input {
157
+ color: #666;
158
+ background: transparent !important;
159
+ border: 0 !important;
160
+ font-family: sans-serif;
161
+ font-size: 100%;
162
+ height: 15px;
163
+ padding: 5px;
164
+ margin: 1px 0;
165
+ outline: 0;
166
+ -webkit-box-shadow: none;
167
+ -moz-box-shadow : none;
168
+ box-shadow : none;
169
+ }
170
+ .chzn-container-multi .chzn-choices .search-field .default {
171
+ color: #999;
172
+ }
173
+ .chzn-container-multi .chzn-choices .search-choice {
174
+ -webkit-border-radius: 3px;
175
+ -moz-border-radius : 3px;
176
+ border-radius : 3px;
177
+ -moz-background-clip : padding;
178
+ -webkit-background-clip: padding-box;
179
+ background-clip : padding-box;
180
+ background-color: #e4e4e4;
181
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
182
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
183
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
184
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
185
+ background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
186
+ background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
187
+ -webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
188
+ -moz-box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
189
+ box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
190
+ color: #333;
191
+ border: 1px solid #aaaaaa;
192
+ line-height: 13px;
193
+ padding: 3px 20px 3px 5px;
194
+ margin: 3px 0 3px 5px;
195
+ position: relative;
196
+ cursor: default;
197
+ }
198
+ .chzn-container-multi .chzn-choices .search-choice.search-choice-disabled {
199
+ background-color: #e4e4e4;
200
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
201
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
202
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
203
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
204
+ background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
205
+ background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
206
+ background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
207
+ color: #666;
208
+ border: 1px solid #cccccc;
209
+ padding-right: 5px;
210
+ }
211
+ .chzn-container-multi .chzn-choices .search-choice-focus {
212
+ background: #d4d4d4;
213
+ }
214
+ .chzn-container-multi .chzn-choices .search-choice .search-choice-close {
215
+ display: block;
216
+ position: absolute;
217
+ right: 3px;
218
+ top: 4px;
219
+ width: 12px;
220
+ height: 12px;
221
+ font-size: 1px;
222
+ background: url('chosen-sprite.png') -42px 1px no-repeat;
223
+ }
224
+ .chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
225
+ background-position: -42px -10px;
226
+ }
227
+ .chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close {
228
+ background-position: -42px -10px;
229
+ }
230
+ /* @end */
231
+
232
+ /* @group Results */
233
+ .chzn-container .chzn-results {
234
+ margin: 0 4px 4px 0;
235
+ max-height: 240px;
236
+ padding: 0 0 0 4px;
237
+ position: relative;
238
+ overflow-x: hidden;
239
+ overflow-y: auto;
240
+ -webkit-overflow-scrolling: touch;
241
+ }
242
+ .chzn-container-multi .chzn-results {
243
+ margin: -1px 0 0;
244
+ padding: 0;
245
+ }
246
+ .chzn-container .chzn-results li {
247
+ display: none;
248
+ line-height: 15px;
249
+ padding: 5px 6px;
250
+ margin: 0;
251
+ list-style: none;
252
+ }
253
+ .chzn-container .chzn-results .active-result {
254
+ cursor: pointer;
255
+ display: list-item;
256
+ }
257
+ .chzn-container .chzn-results .highlighted {
258
+ background-color: #3875d7;
259
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3875d7', endColorstr='#2a62bc', GradientType=0 );
260
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
261
+ background-image: -webkit-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
262
+ background-image: -moz-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
263
+ background-image: -o-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
264
+ background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
265
+ color: #fff;
266
+ }
267
+ .chzn-container .chzn-results li em {
268
+ background: #feffde;
269
+ font-style: normal;
270
+ }
271
+ .chzn-container .chzn-results .highlighted em {
272
+ background: transparent;
273
+ }
274
+ .chzn-container .chzn-results .no-results {
275
+ background: #f4f4f4;
276
+ display: list-item;
277
+ }
278
+ .chzn-container .chzn-results .group-result {
279
+ cursor: default;
280
+ color: #999;
281
+ font-weight: bold;
282
+ }
283
+ .chzn-container .chzn-results .group-option {
284
+ padding-left: 15px;
285
+ }
286
+ .chzn-container-multi .chzn-drop .result-selected {
287
+ display: none;
288
+ }
289
+ .chzn-container .chzn-results-scroll {
290
+ background: white;
291
+ margin: 0 4px;
292
+ position: absolute;
293
+ text-align: center;
294
+ width: 321px; /* This should by dynamic with js */
295
+ z-index: 1;
296
+ }
297
+ .chzn-container .chzn-results-scroll span {
298
+ display: inline-block;
299
+ height: 17px;
300
+ text-indent: -5000px;
301
+ width: 9px;
302
+ }
303
+ .chzn-container .chzn-results-scroll-down {
304
+ bottom: 0;
305
+ }
306
+ .chzn-container .chzn-results-scroll-down span {
307
+ background: url('chosen-sprite.png') no-repeat -4px -3px;
308
+ }
309
+ .chzn-container .chzn-results-scroll-up span {
310
+ background: url('chosen-sprite.png') no-repeat -22px -3px;
311
+ }
312
+ /* @end */
313
+
314
+ /* @group Active */
315
+ .chzn-container-active .chzn-single {
316
+ -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
317
+ -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
318
+ box-shadow : 0 0 5px rgba(0,0,0,.3);
319
+ border: 1px solid #5897fb;
320
+ }
321
+ .chzn-container-active .chzn-single-with-drop {
322
+ border: 1px solid #aaa;
323
+ -webkit-box-shadow: 0 1px 0 #fff inset;
324
+ -moz-box-shadow : 0 1px 0 #fff inset;
325
+ box-shadow : 0 1px 0 #fff inset;
326
+ background-color: #eee;
327
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0 );
328
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
329
+ background-image: -webkit-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
330
+ background-image: -moz-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
331
+ background-image: -o-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
332
+ background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
333
+ -webkit-border-bottom-left-radius : 0;
334
+ -webkit-border-bottom-right-radius: 0;
335
+ -moz-border-radius-bottomleft : 0;
336
+ -moz-border-radius-bottomright: 0;
337
+ border-bottom-left-radius : 0;
338
+ border-bottom-right-radius: 0;
339
+ }
340
+ .chzn-container-active .chzn-single-with-drop div {
341
+ background: transparent;
342
+ border-left: none;
343
+ }
344
+ .chzn-container-active .chzn-single-with-drop div b {
345
+ background-position: -18px 2px;
346
+ }
347
+ .chzn-container-active .chzn-choices {
348
+ -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
349
+ -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
350
+ box-shadow : 0 0 5px rgba(0,0,0,.3);
351
+ border: 1px solid #5897fb;
352
+ }
353
+ .chzn-container-active .chzn-choices .search-field input {
354
+ color: #111 !important;
355
+ }
356
+ /* @end */
357
+
358
+ /* @group Disabled Support */
359
+ .chzn-disabled {
360
+ cursor: default;
361
+ opacity:0.5 !important;
362
+ }
363
+ .chzn-disabled .chzn-single {
364
+ cursor: default;
365
+ }
366
+ .chzn-disabled .chzn-choices .search-choice .search-choice-close {
367
+ cursor: default;
368
+ }
369
+
370
+ /* @group Right to Left */
371
+ .chzn-rtl { text-align: right; }
372
+ .chzn-rtl .chzn-single { padding: 0 8px 0 0; overflow: visible; }
373
+ .chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; direction: rtl; }
374
+
375
+ .chzn-rtl .chzn-single div { left: 3px; right: auto; }
376
+ .chzn-rtl .chzn-single abbr {
377
+ left: 26px;
378
+ right: auto;
379
+ }
380
+ .chzn-rtl .chzn-choices .search-field input { direction: rtl; }
381
+ .chzn-rtl .chzn-choices li { float: right; }
382
+ .chzn-rtl .chzn-choices .search-choice { padding: 3px 5px 3px 19px; margin: 3px 5px 3px 0; }
383
+ .chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 4px; right: auto; }
384
+ .chzn-rtl.chzn-container-single .chzn-results { margin: 0 0 4px 4px; padding: 0 4px 0 0; }
385
+ .chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 15px; }
386
+ .chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; }
387
+ .chzn-rtl .chzn-search input {
388
+ background: #fff url('chosen-sprite.png') no-repeat -30px -20px;
389
+ background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
390
+ background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
391
+ background: url('chosen-sprite.png') no-repeat -30px -20px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
392
+ background: url('chosen-sprite.png') no-repeat -30px -20px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
393
+ background: url('chosen-sprite.png') no-repeat -30px -20px, linear-gradient(#eeeeee 1%, #ffffff 15%);
394
+ padding: 4px 5px 4px 20px;
395
+ direction: rtl;
396
+ }
397
+ .chzn-container-single.chzn-rtl .chzn-single div b {
398
+ background-position: 6px 2px;
399
+ }
400
+ .chzn-container-single.chzn-rtl .chzn-single-with-drop div b {
401
+ background-position: -12px 2px;
402
+ }
403
+ /* @end */
404
+
405
+ /* @group Retina compatibility */
406
+ @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) {
407
+ .chzn-rtl .chzn-search input, .chzn-container-single .chzn-single abbr, .chzn-container-single .chzn-single div b, .chzn-container-single .chzn-search input, .chzn-container-multi .chzn-choices .search-choice .search-choice-close, .chzn-container .chzn-results-scroll-down span, .chzn-container .chzn-results-scroll-up span {
408
+ background-image: url('chosen-sprite@2x.png') !important;
409
+ background-repeat: no-repeat !important;
410
+ background-size: 52px 37px !important;
411
+ }
412
+ }
413
+ /* @end */
js/chosen.jquery.min.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ // Chosen, a Select Box Enhancer for jQuery and Protoype
2
+ // by Patrick Filler for Harvest, http://getharvest.com
3
+ //
4
+ // Version 0.9.11
5
+ // Full source at https://github.com/harvesthq/chosen
6
+ // Copyright (c) 2011 Harvest http://getharvest.com
7
+
8
+ // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
9
+ // This file is generated by `cake build`, do not edit it by hand.
10
+ (function(){var e;e=function(){function e(){this.options_index=0,this.parsed=[]}return e.prototype.add_node=function(e){return e.nodeName.toUpperCase()==="OPTGROUP"?this.add_group(e):this.add_option(e)},e.prototype.add_group=function(e){var t,n,r,i,s,o;t=this.parsed.length,this.parsed.push({array_index:t,group:!0,label:e.label,children:0,disabled:e.disabled}),s=e.childNodes,o=[];for(r=0,i=s.length;r<i;r++)n=s[r],o.push(this.add_option(n,t,e.disabled));return o},e.prototype.add_option=function(e,t,n){if(e.nodeName.toUpperCase()==="OPTION")return e.text!==""?(t!=null&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML,selected:e.selected,disabled:n===!0?n:e.disabled,group_array_index:t,classes:e.className,style:e.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},e}(),e.select_to_array=function(t){var n,r,i,s,o;r=new e,o=t.childNodes;for(i=0,s=o.length;i<s;i++)n=o[i],r.add_node(n);return r.parsed},this.SelectParser=e}).call(this),function(){var e,t;t=this,e=function(){function e(e,t){this.form_field=e,this.options=t!=null?t:{},this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return e.prototype.set_default_values=function(){var e=this;return this.click_test_action=function(t){return e.test_active_click(t)},this.activate_action=function(t){return e.activate_field(t)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=this.options.enable_split_word_search!=null?this.options.enable_split_word_search:!0,this.search_contains=this.options.search_contains||!1,this.choices=0,this.single_backstroke_delete=this.options.single_backstroke_delete||!1,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1},e.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||"Select Some Options":this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||"Select an Option",this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||"No results match"},e.prototype.mouse_enter=function(){return this.mouse_on_container=!0},e.prototype.mouse_leave=function(){return this.mouse_on_container=!1},e.prototype.input_focus=function(e){var t=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return t.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},e.prototype.input_blur=function(e){var t=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return t.blur_test()},100)},e.prototype.result_add_option=function(e){var t,n;return e.disabled?"":(e.dom_id=this.container_id+"_o_"+e.array_index,t=e.selected&&this.is_multiple?[]:["active-result"],e.selected&&t.push("result-selected"),e.group_array_index!=null&&t.push("group-option"),e.classes!==""&&t.push(e.classes),n=e.style.cssText!==""?' style="'+e.style+'"':"",'<li id="'+e.dom_id+'" class="'+t.join(" ")+'"'+n+">"+e.html+"</li>")},e.prototype.results_update_field=function(){return this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},e.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},e.prototype.results_search=function(e){return this.results_showing?this.winnow_results():this.results_show()},e.prototype.keyup_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale();switch(t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:e.preventDefault();if(this.results_showing)return this.result_select(e);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},e.prototype.generate_field_id=function(){var e;return e=this.generate_random_id(),this.form_field.id=e,e},e.prototype.generate_random_char=function(){var e,t,n;return e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",n=Math.floor(Math.random()*e.length),t=e.substring(n,n+1)},e}(),t.AbstractChosen=e}.call(this),function(){var e,t,n,r,i={}.hasOwnProperty,s=function(e,t){function r(){this.constructor=e}for(var n in t)i.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};r=this,e=jQuery,e.fn.extend({chosen:function(n){var r,i,s;return s=navigator.userAgent.toLowerCase(),i=/(msie) ([\w.]+)/.exec(s)||[],r={name:i[1]||"",version:i[2]||"0"},r.name==="msie"&&(r.version==="6.0"||r.version==="7.0"&&document.documentMode===7)?this:this.each(function(r){var i;i=e(this);if(!i.hasClass("chzn-done"))return i.data("chosen",new t(this,n))})}}),t=function(t){function i(){return i.__super__.constructor.apply(this,arguments)}return s(i,t),i.prototype.setup=function(){return this.form_field_jq=e(this.form_field),this.current_value=this.form_field_jq.val(),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},i.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},i.prototype.set_up_html=function(){var t,r,i,s,o,u;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/[^\w]/g,"_"):this.generate_field_id(),this.container_id+="_chzn",t=["chzn-container"],t.push("chzn-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&t.push(this.form_field.className),this.is_rtl&&t.push("chzn-rtl"),this.f_width=this.form_field_jq.outerWidth(),i={id:this.container_id,"class":t.join(" "),style:"width: "+this.f_width+"px;",title:this.form_field.title},r=e("<div />",i),this.is_multiple?r.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):r.html('<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(r),this.container=e("#"+this.container_id),this.dropdown=this.container.find("div.chzn-drop").first(),s=this.container.height(),o=this.f_width-n(this.dropdown),this.dropdown.css({width:o+"px",top:s+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),u=o-n(this.search_container)-n(this.search_field),this.search_field.css({width:u+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},i.prototype.register_observers=function(){var e=this;return this.container.mousedown(function(t){return e.container_mousedown(t)}),this.container.mouseup(function(t){return e.container_mouseup(t)}),this.container.mouseenter(function(t){return e.mouse_enter(t)}),this.container.mouseleave(function(t){return e.mouse_leave(t)}),this.search_results.mouseup(function(t){return e.search_results_mouseup(t)}),this.search_results.mouseover(function(t){return e.search_results_mouseover(t)}),this.search_results.mouseout(function(t){return e.search_results_mouseout(t)}),this.form_field_jq.bind("liszt:updated",function(t){return e.results_update_field(t)}),this.form_field_jq.bind("liszt:activate",function(t){return e.activate_field(t)}),this.form_field_jq.bind("liszt:open",function(t){return e.container_mousedown(t)}),this.search_field.blur(function(t){return e.input_blur(t)}),this.search_field.keyup(function(t){return e.keyup_checker(t)}),this.search_field.keydown(function(t){return e.keydown_checker(t)}),this.search_field.focus(function(t){return e.input_focus(t)}),this.is_multiple?this.search_choices.click(function(t){return e.choices_click(t)}):this.container.click(function(e){return e.preventDefault()})},i.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},i.prototype.container_mousedown=function(t){var n;if(!this.is_disabled)return n=t!=null?e(t.target).hasClass("search-choice-close"):!1,t&&t.type==="mousedown"&&!this.results_showing&&t.preventDefault(),!this.pending_destroy_click&&!n?(this.active_field?!this.is_multiple&&t&&(e(t.target)[0]===this.selected_item[0]||e(t.target).parents("a.chzn-single").length)&&(t.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),e(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},i.prototype.container_mouseup=function(e){if(e.target.nodeName==="ABBR"&&!this.is_disabled)return this.results_reset(e)},i.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},i.prototype.close_field=function(){return e(document).unbind("click",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},i.prototype.activate_field=function(){return this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},i.prototype.test_active_click=function(t){return e(t.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},i.prototype.results_build=function(){var e,t,n,i,s;this.parsing=!0,this.results_data=r.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.addClass("chzn-default").find("span").text(this.default_text),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),e="",s=this.results_data;for(n=0,i=s.length;n<i;n++)t=s[n],t.group?e+=this.result_add_group(t):t.empty||(e+=this.result_add_option(t),t.selected&&this.is_multiple?this.choice_build(t):t.selected&&!this.is_multiple&&(this.selected_item.removeClass("chzn-default").find("span").text(t.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(e),this.parsing=!1},i.prototype.result_add_group=function(t){return t.disabled?"":(t.dom_id=this.container_id+"_g_"+t.array_index,'<li id="'+t.dom_id+'" class="group-result">'+e("<div />").text(t.label).html()+"</li>")},i.prototype.result_do_highlight=function(e){var t,n,r,i,s;if(e.length){this.result_clear_highlight(),this.result_highlight=e,this.result_highlight.addClass("highlighted"),r=parseInt(this.search_results.css("maxHeight"),10),s=this.search_results.scrollTop(),i=r+s,n=this.result_highlight.position().top+this.search_results.scrollTop(),t=n+this.result_highlight.outerHeight();if(t>=i)return this.search_results.scrollTop(t-r>0?t-r:0);if(n<s)return this.search_results.scrollTop(n)}},i.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},i.prototype.results_show=function(){var e;if(!this.is_multiple)this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected);else if(this.max_selected_options<=this.choices)return this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1;return e=this.is_multiple?this.container.height():this.container.height()-1,this.form_field_jq.trigger("liszt:showing_dropdown",{chosen:this}),this.dropdown.css({top:e+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},i.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.form_field_jq.trigger("liszt:hiding_dropdown",{chosen:this}),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},i.prototype.set_tab_index=function(e){var t;if(this.form_field_jq.attr("tabindex"))return t=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.search_field.attr("tabindex",t)},i.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},i.prototype.search_results_mouseup=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n.length)return this.result_highlight=n,this.result_select(t),this.search_field.focus()},i.prototype.search_results_mouseover=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n)return this.result_do_highlight(n)},i.prototype.search_results_mouseout=function(t){if(e(t.target).hasClass("active-result"))return this.result_clear_highlight()},i.prototype.choices_click=function(t){t.preventDefault();if(this.active_field&&!e(t.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},i.prototype.choice_build=function(t){var n,r,i,s=this;return this.is_multiple&&this.max_selected_options<=this.choices?(this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1):(n=this.container_id+"_c_"+t.array_index,this.choices+=1,t.disabled?r='<li class="search-choice search-choice-disabled" id="'+n+'"><span>'+t.html+"</span></li>":r='<li class="search-choice" id="'+n+'"><span>'+t.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+t.array_index+'"></a></li>',this.search_container.before(r),i=e("#"+n).find("a").first(),i.click(function(e){return s.choice_destroy_link_click(e)}))},i.prototype.choice_destroy_link_click=function(t){return t.preventDefault(),this.is_disabled?t.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(e(t.target)))},i.prototype.choice_destroy=function(e){if(this.result_deselect(e.attr("rel")))return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),e.parents("li").first().remove(),this.search_field_scale()},i.prototype.results_reset=function(){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.is_multiple||this.selected_item.addClass("chzn-default"),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},i.prototype.results_reset_cleanup=function(){return this.current_value=this.form_field_jq.val(),this.selected_item.find("abbr").remove()},i.prototype.result_select=function(e){var t,n,r,i;if(this.result_highlight)return t=this.result_highlight,n=t.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(t):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=t,this.selected_item.removeClass("chzn-default")),t.addClass("result-selected"),i=n.substr(n.lastIndexOf("_")+1),r=this.results_data[i],r.selected=!0,this.form_field.options[r.options_index].selected=!0,this.is_multiple?this.choice_build(r):(this.selected_item.find("span").first().text(r.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!e.metaKey&&!e.ctrlKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field_jq.val()!==this.current_value)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[r.options_index].value}),this.current_value=this.form_field_jq.val(),this.search_field_scale()},i.prototype.result_activate=function(e){return e.addClass("active-result")},i.prototype.result_deactivate=function(e){return e.removeClass("active-result")},i.prototype.result_deselect=function(t){var n,r;return r=this.results_data[t],this.form_field.options[r.options_index].disabled?!1:(r.selected=!1,this.form_field.options[r.options_index].selected=!1,n=e("#"+this.container_id+"_o_"+t),n.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[r.options_index].value}),this.search_field_scale(),!0)},i.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},i.prototype.winnow_results=function(){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y;this.no_results_clear(),f=0,l=this.search_field.val()===this.default_text?"":e("<div/>").text(e.trim(this.search_field.val())).html(),o=this.search_contains?"":"^",s=new RegExp(o+l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),p=new RegExp(l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),y=this.results_data;for(d=0,m=y.length;d<m;d++){n=y[d];if(!n.disabled&&!n.empty)if(n.group)e("#"+n.dom_id).css("display","none");else if(!this.is_multiple||!n.selected){t=!1,a=n.dom_id,u=e("#"+a);if(s.test(n.html))t=!0,f+=1;else if(this.enable_split_word_search&&(n.html.indexOf(" ")>=0||n.html.indexOf("[")===0)){i=n.html.replace(/\[|\]/g,"").split(" ");if(i.length)for(v=0,g=i.length;v<g;v++)r=i[v],s.test(r)&&(t=!0,f+=1)}t?(l.length?(c=n.html.search(p),h=n.html.substr(0,c+l.length)+"</em>"+n.html.substr(c+l.length),h=h.substr(0,c)+"<em>"+h.substr(c)):h=n.html,u.html(h),this.result_activate(u),n.group_array_index!=null&&e("#"+this.results_data[n.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&a===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(u))}}return f<1&&l.length?this.no_results(l):this.winnow_results_set_highlight()},i.prototype.winnow_results_clear=function(){var t,n,r,i,s;this.search_field.val(""),n=this.search_results.find("li"),s=[];for(r=0,i=n.length;r<i;r++)t=n[r],t=e(t),t.hasClass("group-result")?s.push(t.css("display","auto")):!this.is_multiple||!t.hasClass("result-selected")?s.push(this.result_activate(t)):s.push(void 0);return s},i.prototype.winnow_results_set_highlight=function(){var e,t;if(!this.result_highlight){t=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),e=t.length?t.first():this.search_results.find(".active-result").first();if(e!=null)return this.result_do_highlight(e)}},i.prototype.no_results=function(t){var n;return n=e('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),n.find("span").first().html(t),this.search_results.append(n)},i.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},i.prototype.keydown_arrow=function(){var t,n;this.result_highlight?this.results_showing&&(n=this.result_highlight.nextAll("li.active-result").first(),n&&this.result_do_highlight(n)):(t=this.search_results.find("li.active-result").first(),t&&this.result_do_highlight(e(t)));if(!this.results_showing)return this.results_show()},i.prototype.keyup_arrow=function(){var e;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return e=this.result_highlight.prevAll("li.active-result"),e.length?this.result_do_highlight(e.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},i.prototype.keydown_backstroke=function(){var e;if(this.pending_backstroke)return this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke();e=this.search_container.siblings("li.search-choice").last();if(e.length&&!e.hasClass("search-choice-disabled"))return this.pending_backstroke=e,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")},i.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},i.prototype.keydown_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale(),t!==8&&this.pending_backstroke&&this.clear_backstroke();switch(t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e),this.mouse_on_container=!1;break;case 13:e.preventDefault();break;case 38:e.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},i.prototype.search_field_scale=function(){var t,n,r,i,s,o,u,a,f;if(this.is_multiple){r=0,u=0,s="position:absolute; left: -1000px; top: -1000px; display:none;",o=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(a=0,f=o.length;a<f;a++)i=o[a],s+=i+":"+this.search_field.css(i)+";";return n=e("<div />",{style:s}),n.text(this.search_field.val()),e("body").append(n),u=n.width()+25,n.remove(),u>this.f_width-10&&(u=this.f_width-10),this.search_field.css({width:u+"px"}),t=this.container.height(),this.dropdown.css({top:t+"px"})}},i.prototype.generate_random_id=function(){var t;t="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(e("#"+t).length>0)t+=this.generate_random_char();return t},i}(AbstractChosen),r.Chosen=t,n=function(e){var t;return t=e.outerWidth()-e.width()},r.get_side_border_padding=n}.call(this);
languages/google-analytics-for-wordpress.pot ADDED
@@ -0,0 +1,711 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2013
2
+ # This file is distributed under the same license as the package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: \n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/google-analytics-for-"
7
+ "wordpress\n"
8
+ "POT-Creation-Date: 2013-03-11 15:31:09+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+
16
+ #: admin/class-admin.php:30
17
+ msgid "Google Analytics Configuration"
18
+ msgstr ""
19
+
20
+ #: admin/class-admin.php:31
21
+ msgid "Google Analytics"
22
+ msgstr ""
23
+
24
+ #: admin/class-admin.php:129
25
+ msgid ""
26
+ "The maximum number of allowed custom variables in Google Analytics is 5, "
27
+ "please unselect one of the other custom variables before selecting this one."
28
+ msgstr ""
29
+
30
+ #: admin/class-admin.php:136
31
+ msgid ""
32
+ "That's not a valid UA ID, please make sure it matches the expected pattern "
33
+ "of: UA-XXXXXX-X, and that there are no spaces or other characters in the "
34
+ "input field."
35
+ msgstr ""
36
+
37
+ #: admin/class-admin.php:151
38
+ msgid "Having problems?"
39
+ msgstr ""
40
+
41
+ #: admin/class-admin.php:152
42
+ msgid ""
43
+ "If you're having problems with this plugin, please refer to its <a "
44
+ "href='%s'>FAQ page</a>."
45
+ msgstr ""
46
+
47
+ #: admin/class-admin.php:171
48
+ msgid "Google Analytics settings reset."
49
+ msgstr ""
50
+
51
+ #: admin/class-admin.php:174
52
+ msgid "You cannot edit the Google Analytics for WordPress options."
53
+ msgstr ""
54
+
55
+ #: admin/class-admin.php:220
56
+ msgid "Google Analytics settings updated."
57
+ msgstr ""
58
+
59
+ #: admin/class-admin.php:227
60
+ msgid "Update Google Analytics Settings &raquo;"
61
+ msgstr ""
62
+
63
+ #: admin/class-admin.php:263
64
+ msgid "Google Analytics for WordPress Configuration"
65
+ msgstr ""
66
+
67
+ #: admin/class-admin.php:275
68
+ msgid ""
69
+ "Please authenticate with Google Analytics to retrieve your tracking code:"
70
+ msgstr ""
71
+
72
+ #: admin/class-admin.php:275
73
+ msgid "Click here to authenticate with Google"
74
+ msgstr ""
75
+
76
+ #: admin/class-admin.php:340
77
+ msgid "Please select the correct Analytics Account"
78
+ msgstr ""
79
+
80
+ #: admin/class-admin.php:349
81
+ msgid "Please select the correct Analytics account to track:"
82
+ msgstr ""
83
+
84
+ #: admin/class-admin.php:351
85
+ msgid "Profile"
86
+ msgstr ""
87
+
88
+ #: admin/class-admin.php:363
89
+ msgid ""
90
+ "Please note that if you have several profiles of the same website, it "
91
+ "doesn't matter which profile you select, and in fact another profile might "
92
+ "show as selected later. You can check whether they're profiles for the same "
93
+ "site by checking if they have the same UA code. If that's true, tracking "
94
+ "will be correct."
95
+ msgstr ""
96
+
97
+ #: admin/class-admin.php:365
98
+ msgid "Refresh this listing or switch to another account: "
99
+ msgstr ""
100
+
101
+ #: admin/class-admin.php:367
102
+ msgid ""
103
+ "Unfortunately, an error occurred while connecting to Google, please try "
104
+ "again:"
105
+ msgstr ""
106
+
107
+ #: admin/class-admin.php:371
108
+ msgid "Re-authenticate with Google"
109
+ msgstr ""
110
+
111
+ #: admin/class-admin.php:373
112
+ msgid "Select another Analytics Profile &raquo;"
113
+ msgstr ""
114
+
115
+ #: admin/class-admin.php:375
116
+ msgid "Manually enter your UA code: "
117
+ msgstr ""
118
+
119
+ #: admin/class-admin.php:380
120
+ msgid "Analytics Profile"
121
+ msgstr ""
122
+
123
+ #: admin/class-admin.php:381
124
+ msgid "Manually enter your UA code"
125
+ msgstr ""
126
+
127
+ #: admin/class-admin.php:384
128
+ msgid "In the header (default)"
129
+ msgstr ""
130
+
131
+ #: admin/class-admin.php:384
132
+ msgid "Insert manually"
133
+ msgstr ""
134
+
135
+ #: admin/class-admin.php:387
136
+ msgid "Notice"
137
+ msgstr ""
138
+
139
+ #: admin/class-admin.php:387
140
+ msgid ""
141
+ "You switched your theme, please make sure your Google Analytics tracking is "
142
+ "still ok. Save your settings to make sure Google Analytics gets loaded "
143
+ "properly."
144
+ msgstr ""
145
+
146
+ #: admin/class-admin.php:390
147
+ msgid ""
148
+ "The header is by far the best spot to place the tracking code. If you'd "
149
+ "rather place the code manually, switch to manual placement. For more info "
150
+ "%sread this page%s."
151
+ msgstr ""
152
+
153
+ #: admin/class-admin.php:391
154
+ msgid ""
155
+ "%sFollow the instructions here%s to choose the location for your tracking "
156
+ "code manually."
157
+ msgstr ""
158
+
159
+ #: admin/class-admin.php:395
160
+ msgid "Where should the tracking code be placed"
161
+ msgstr ""
162
+
163
+ #: admin/class-admin.php:401
164
+ msgid "Track outbound clicks &amp; downloads"
165
+ msgstr ""
166
+
167
+ #: admin/class-admin.php:402
168
+ msgid ""
169
+ "Clicks &amp; downloads will be tracked as events, you can find these under "
170
+ "Content &raquo; Event Tracking in your Google Analytics reports."
171
+ msgstr ""
172
+
173
+ #: admin/class-admin.php:407
174
+ msgid "Show advanced settings"
175
+ msgstr ""
176
+
177
+ #: admin/class-admin.php:408
178
+ msgid ""
179
+ "Only adviced for advanced users who know their way around Google Analytics"
180
+ msgstr ""
181
+
182
+ #: admin/class-admin.php:413
183
+ msgid "Allow tracking of anonymous data"
184
+ msgstr ""
185
+
186
+ #: admin/class-admin.php:414
187
+ msgid ""
188
+ "By allowing us to track anonymous data we can better help you, because we "
189
+ "know with which WordPress configurations, themes and plugins we should test. "
190
+ "No personal data will be submitted."
191
+ msgstr ""
192
+
193
+ #: admin/class-admin.php:417
194
+ msgid "Google Analytics Settings"
195
+ msgstr ""
196
+
197
+ #: admin/class-admin.php:420
198
+ msgid ""
199
+ "Google Analytics allows you to save up to 5 custom variables on each page, "
200
+ "and this plugin helps you make the most use of these! Check which custom "
201
+ "variables you'd like the plugin to save for you below. Please note that "
202
+ "these will only be saved when they are actually available."
203
+ msgstr ""
204
+
205
+ #: admin/class-admin.php:421
206
+ msgid ""
207
+ "If you want to start using these custom variables, go to Visitors &raquo; "
208
+ "Custom Variables in your Analytics reports."
209
+ msgstr ""
210
+
211
+ #: admin/class-admin.php:424
212
+ msgid "Logged in Users"
213
+ msgstr ""
214
+
215
+ #: admin/class-admin.php:425
216
+ msgid ""
217
+ "Allows you to easily remove logged in users from your reports, or to segment "
218
+ "by different user roles. The users primary role will be logged."
219
+ msgstr ""
220
+
221
+ #: admin/class-admin.php:430
222
+ msgid "Post type"
223
+ msgstr ""
224
+
225
+ #: admin/class-admin.php:431
226
+ msgid ""
227
+ "Allows you to see pageviews per post type, especially useful if you use "
228
+ "multiple custom post types."
229
+ msgstr ""
230
+
231
+ #: admin/class-admin.php:436
232
+ msgid "Author Name"
233
+ msgstr ""
234
+
235
+ #: admin/class-admin.php:437
236
+ msgid "Allows you to see pageviews per author."
237
+ msgstr ""
238
+
239
+ #: admin/class-admin.php:442
240
+ msgid "Tags"
241
+ msgstr ""
242
+
243
+ #: admin/class-admin.php:443
244
+ msgid "Allows you to see pageviews per tags using advanced segments."
245
+ msgstr ""
246
+
247
+ #: admin/class-admin.php:448
248
+ msgid "Publication year"
249
+ msgstr ""
250
+
251
+ #: admin/class-admin.php:449
252
+ msgid ""
253
+ "Allows you to see pageviews per year of publication, showing you if your old "
254
+ "posts still get traffic."
255
+ msgstr ""
256
+
257
+ #: admin/class-admin.php:454
258
+ msgid "Single Category"
259
+ msgstr ""
260
+
261
+ #: admin/class-admin.php:455
262
+ msgid ""
263
+ "Allows you to see pageviews per category, works best when each post is in "
264
+ "only one category."
265
+ msgstr ""
266
+
267
+ #: admin/class-admin.php:460
268
+ msgid "All Categories"
269
+ msgstr ""
270
+
271
+ #: admin/class-admin.php:461
272
+ msgid ""
273
+ "Allows you to see pageviews per category using advanced segments, should be "
274
+ "used when you use multiple categories per post."
275
+ msgstr ""
276
+
277
+ #: admin/class-admin.php:466
278
+ msgid "Custom Variables Settings"
279
+ msgstr ""
280
+
281
+ #: admin/class-admin.php:471
282
+ msgid "Ignore users"
283
+ msgstr ""
284
+
285
+ #: admin/class-admin.php:472
286
+ msgid ""
287
+ "Users of the role you select and higher will be ignored, so if you select "
288
+ "Editor, all Editors and Administrators will be ignored."
289
+ msgstr ""
290
+
291
+ #: admin/class-admin.php:474
292
+ msgid "Ignore no-one"
293
+ msgstr ""
294
+
295
+ #: admin/class-admin.php:475
296
+ msgid "Administrator"
297
+ msgstr ""
298
+
299
+ #: admin/class-admin.php:476
300
+ msgid "Editor"
301
+ msgstr ""
302
+
303
+ #: admin/class-admin.php:477
304
+ msgid "Author"
305
+ msgstr ""
306
+
307
+ #: admin/class-admin.php:478
308
+ msgid "Contributor"
309
+ msgstr ""
310
+
311
+ #: admin/class-admin.php:479
312
+ msgid "Subscriber (ignores all logged in users)"
313
+ msgstr ""
314
+
315
+ #: admin/class-admin.php:484
316
+ msgid "Track outbound clicks as pageviews"
317
+ msgstr ""
318
+
319
+ #: admin/class-admin.php:485
320
+ msgid ""
321
+ "You do not need to enable this to enable outbound click tracking, this "
322
+ "changes the default behavior of tracking clicks as events to tracking them "
323
+ "as pageviews. This is therefore not recommended, as this would skew your "
324
+ "statistics, but <em>is</em> sometimes necessary when you need to set "
325
+ "outbound clicks as goals."
326
+ msgstr ""
327
+
328
+ #: admin/class-admin.php:490
329
+ msgid "Track downloads as pageviews"
330
+ msgstr ""
331
+
332
+ #: admin/class-admin.php:491
333
+ msgid ""
334
+ "Not recommended, as this would skew your statistics, but it does make it "
335
+ "possible to track downloads as goals."
336
+ msgstr ""
337
+
338
+ #: admin/class-admin.php:496
339
+ msgid "Extensions of files to track as downloads"
340
+ msgstr ""
341
+
342
+ #: admin/class-admin.php:502
343
+ msgid "Prefix to use in Analytics before the tracked pageviews"
344
+ msgstr ""
345
+
346
+ #: admin/class-admin.php:503
347
+ msgid ""
348
+ "This prefix is used before all pageviews, they are then segmented "
349
+ "automatically after that. If nothing is entered here, <code>/yoast-ga/</"
350
+ "code> is used."
351
+ msgstr ""
352
+
353
+ #: admin/class-admin.php:509
354
+ msgid "Track full URL of outbound clicks or just the domain"
355
+ msgstr ""
356
+
357
+ #: admin/class-admin.php:511
358
+ msgid "Just the domain"
359
+ msgstr ""
360
+
361
+ #: admin/class-admin.php:512
362
+ msgid "Track the complete URL"
363
+ msgstr ""
364
+
365
+ #: admin/class-admin.php:518
366
+ msgid "Subdomain Tracking"
367
+ msgstr ""
368
+
369
+ #: admin/class-admin.php:519
370
+ msgid ""
371
+ "This allows you to set the domain that's set by %s<code>setDomainName</code>"
372
+ "%s for tracking subdomains, if empty this will not be set."
373
+ msgstr ""
374
+
375
+ #: admin/class-admin.php:524
376
+ msgid "Enable Cross Domain Tracking"
377
+ msgstr ""
378
+
379
+ #: admin/class-admin.php:525
380
+ msgid ""
381
+ "This allows you to enable %sCross-Domain Tracking%s for this site. When "
382
+ "endabled <code>_setAllowLinker:</code> will be enabled if it is not already."
383
+ msgstr ""
384
+
385
+ #: admin/class-admin.php:530
386
+ msgid "Cross-Domain Tracking, Primary Domain"
387
+ msgstr ""
388
+
389
+ #: admin/class-admin.php:531
390
+ msgid ""
391
+ "Set the primary domain used in %s<code>setDomainName</code>%s for cross "
392
+ "domain tracking (eg. <code>example-petstore.com</code> ), if empty this will "
393
+ "default to your configured Home URL."
394
+ msgstr ""
395
+
396
+ #: admin/class-admin.php:536
397
+ msgid "Cross-Domain Tracking, Other Domains"
398
+ msgstr ""
399
+
400
+ #: admin/class-admin.php:537
401
+ msgid ""
402
+ "All links to these domains will have the <a href=\"http://code.google.com/"
403
+ "apis/analytics/docs/tracking/gaTrackingSite.html#multipleDomains"
404
+ "\"><code>_link</code></a> code automatically attached. Separate domains/sub-"
405
+ "domains with commas (eg. <code>dogs.example-petstore.com, cats.example-"
406
+ "petstore.com</code>)"
407
+ msgstr ""
408
+
409
+ #: admin/class-admin.php:542
410
+ msgid "Custom Code"
411
+ msgstr ""
412
+
413
+ #: admin/class-admin.php:543
414
+ msgid ""
415
+ "Not for the average user: this allows you to add a line of code, to be added "
416
+ "before the <code>trackPageview</code> call."
417
+ msgstr ""
418
+
419
+ #: admin/class-admin.php:548
420
+ msgid "Track AdSense"
421
+ msgstr ""
422
+
423
+ #: admin/class-admin.php:549
424
+ msgid ""
425
+ "This requires integration of your Analytics and AdSense account, for help, "
426
+ "<a href=\"http://google.com/support/analytics/bin/answer.py?"
427
+ "answer=92625\">look here</a>."
428
+ msgstr ""
429
+
430
+ #: admin/class-admin.php:554
431
+ msgid "Host ga.js locally"
432
+ msgstr ""
433
+
434
+ #: admin/class-admin.php:556
435
+ msgid "You have to provide a URL to your ga.js file:"
436
+ msgstr ""
437
+
438
+ #: admin/class-admin.php:559
439
+ msgid ""
440
+ "For some reasons you might want to use a locally hosted ga.js file, or "
441
+ "another ga.js file, check the box and then please enter the full URL "
442
+ "including http here."
443
+ msgstr ""
444
+
445
+ #: admin/class-admin.php:563
446
+ msgid "Track extra Search Engines"
447
+ msgstr ""
448
+
449
+ #: admin/class-admin.php:565
450
+ msgid ""
451
+ "You can provide a custom URL to the extra search engines file if you want:"
452
+ msgstr ""
453
+
454
+ #: admin/class-admin.php:571
455
+ msgid "Tag links in RSS feed with campaign variables"
456
+ msgstr ""
457
+
458
+ #: admin/class-admin.php:572
459
+ msgid ""
460
+ "Do not use this feature if you use FeedBurner, as FeedBurner can do this "
461
+ "automatically, and better than this plugin can. Check <a href=\"http://www."
462
+ "google.com/support/feedburner/bin/answer.py?hl=en&amp;answer=165769\">this "
463
+ "help page</a> for info on how to enable this feature in FeedBurner."
464
+ msgstr ""
465
+
466
+ #: admin/class-admin.php:577
467
+ msgid "Add tracking to the login and registration forms"
468
+ msgstr ""
469
+
470
+ #: admin/class-admin.php:582
471
+ msgid "Add tracking to the comment forms"
472
+ msgstr ""
473
+
474
+ #: admin/class-admin.php:587
475
+ msgid "Use # instead of ? for Campaign tracking"
476
+ msgstr ""
477
+
478
+ #: admin/class-admin.php:588
479
+ msgid ""
480
+ "This adds a <code><a href=\"http://code.google.com/apis/analytics/docs/"
481
+ "gaJSApiCampaignTracking.html#_gat.GA_Tracker_._setAllowAnchor"
482
+ "\">_setAllowAnchor</a></code> call to your tracking code, and makes RSS link "
483
+ "tagging use a # as well."
484
+ msgstr ""
485
+
486
+ #: admin/class-admin.php:593
487
+ msgid "Add <code>_setAllowLinker</code>"
488
+ msgstr ""
489
+
490
+ #: admin/class-admin.php:594
491
+ msgid ""
492
+ "This adds a <code><a href=\"http://code.google.com/apis/analytics/docs/gaJS/"
493
+ "gaJSApiDomainDirectory.html#_gat.GA_Tracker_._setAllowLinker"
494
+ "\">_setAllowLinker</a></code> call to your tracking code, allowing you to "
495
+ "use <code>_link</code> and related functions."
496
+ msgstr ""
497
+
498
+ #: admin/class-admin.php:599
499
+ msgid "Set <code>_setAllowHash</code> to false"
500
+ msgstr ""
501
+
502
+ #: admin/class-admin.php:600
503
+ msgid ""
504
+ "This sets <code><a href=\"http://code.google.com/apis/analytics/docs/gaJS/"
505
+ "gaJSApiDomainDirectory.html#_gat.GA_Tracker_._setAllowHash\">_setAllowHash</"
506
+ "a></code> to false, allowing you to track subdomains etc."
507
+ msgstr ""
508
+
509
+ #: admin/class-admin.php:605
510
+ msgid "Anonymize IP's"
511
+ msgstr ""
512
+
513
+ #: admin/class-admin.php:606
514
+ msgid ""
515
+ "This adds <code><a href=\"http://code.google.com/apis/analytics/docs/gaJS/"
516
+ "gaJSApi_gat.html#_gat._anonymizeIp\">_anonymizeIp</a></code>, telling Google "
517
+ "Analytics to anonymize the information sent by the tracker objects by "
518
+ "removing the last octet of the IP address prior to its storage."
519
+ msgstr ""
520
+
521
+ #: admin/class-admin.php:610
522
+ msgid "Advanced Settings"
523
+ msgstr ""
524
+
525
+ #: admin/class-admin.php:615
526
+ msgid "Internal links to track as outbound"
527
+ msgstr ""
528
+
529
+ #: admin/class-admin.php:616
530
+ msgid ""
531
+ "If you want to track all internal links that begin with <code>/out/</code>, "
532
+ "enter <code>/out/</code> in the box above. If you have multiple prefixes you "
533
+ "can separate them with comma's: <code>/out/,/recommends/</code>"
534
+ msgstr ""
535
+
536
+ #: admin/class-admin.php:621
537
+ msgid "Label to use"
538
+ msgstr ""
539
+
540
+ #: admin/class-admin.php:622
541
+ msgid ""
542
+ "The label to use for these links, this will be added to where the click came "
543
+ "from, so if the label is \"aff\", the label for a click from the content of "
544
+ "an article becomes \"outbound-article-aff\"."
545
+ msgstr ""
546
+
547
+ #: admin/class-admin.php:626
548
+ msgid "Internal Links to Track as Outbound"
549
+ msgstr ""
550
+
551
+ #: admin/class-admin.php:629
552
+ msgid ""
553
+ "The WordPress e-Commerce plugin has been detected. This plugin can "
554
+ "automatically add transaction tracking for you. To do that, <a href=\"http://"
555
+ "yoast.com/wordpress/google-analytics/enable-ecommerce/\">enable e-commerce "
556
+ "for your reports in Google Analytics</a> and then check the box below."
557
+ msgstr ""
558
+
559
+ #: admin/class-admin.php:633 admin/class-admin.php:646
560
+ msgid "Enable transaction tracking"
561
+ msgstr ""
562
+
563
+ #: admin/class-admin.php:636
564
+ msgid "WordPress e-Commerce Settings"
565
+ msgstr ""
566
+
567
+ #: admin/class-admin.php:642
568
+ msgid ""
569
+ "The Shopp e-Commerce plugin has been detected. This plugin can automatically "
570
+ "add transaction tracking for you. To do that, <a href=\"http://www.google."
571
+ "com/support/googleanalytics/bin/answer.py?hl=en&amp;answer=55528\">enable e-"
572
+ "commerce for your reports in Google Analytics</a> and then check the box "
573
+ "below."
574
+ msgstr ""
575
+
576
+ #: admin/class-admin.php:649
577
+ msgid "Shopp e-Commerce Settings"
578
+ msgstr ""
579
+
580
+ #: admin/class-admin.php:652
581
+ msgid ""
582
+ "If you want to confirm that tracking on your blog is working as it should, "
583
+ "enable this option and check the console in %sFirebug%s (for Firefox), "
584
+ "%sFirebug Lite%s (for other browsers) or Chrome &amp; Safari's Web "
585
+ "Inspector. Be absolutely sure to disable debugging afterwards, as it is "
586
+ "slower than normal tracking."
587
+ msgstr ""
588
+
589
+ #: admin/class-admin.php:653
590
+ msgid "Note"
591
+ msgstr ""
592
+
593
+ #: admin/class-admin.php:653
594
+ msgid "the debugging and firebug scripts are only loaded for admins."
595
+ msgstr ""
596
+
597
+ #: admin/class-admin.php:657
598
+ msgid "Enable debug mode"
599
+ msgstr ""
600
+
601
+ #: admin/class-admin.php:662
602
+ msgid "Enable Firebug Lite"
603
+ msgstr ""
604
+
605
+ #: admin/class-admin.php:665
606
+ msgid "Debug Mode"
607
+ msgstr ""
608
+
609
+ #: admin/class-admin.php:670
610
+ msgid "Do you really want to reset all settings?"
611
+ msgstr ""
612
+
613
+ #: admin/class-admin.php:674
614
+ msgid "Reset All Settings &raquo;"
615
+ msgstr ""
616
+
617
+ #: admin/class-admin.php:683
618
+ msgid "Help Spread the Word!"
619
+ msgstr ""
620
+
621
+ #: admin/class-admin.php:683
622
+ msgid ""
623
+ "Want to help make this plugin even better? All donations are used to improve "
624
+ "this plugin, so donate $20, $50 or $100 now!"
625
+ msgstr ""
626
+
627
+ #: admin/class-admin.php:689
628
+ msgid "Or you could:"
629
+ msgstr ""
630
+
631
+ #: admin/class-admin.php:691
632
+ msgid "Rate the plugin 5★ on WordPress.org"
633
+ msgstr ""
634
+
635
+ #: admin/class-admin.php:692
636
+ msgid "Help out other users in the forums"
637
+ msgstr ""
638
+
639
+ #: admin/class-admin.php:693
640
+ msgid "Blog about it & link to the %1$splugin page%2$s"
641
+ msgstr ""
642
+
643
+ #: admin/class-admin.php:755
644
+ msgid "Google Analytics is not active."
645
+ msgstr ""
646
+
647
+ #: admin/class-admin.php:755
648
+ msgid ""
649
+ "You must %sselect which Analytics Profile to track%s before it can work."
650
+ msgstr ""
651
+
652
+ #: admin/class-pointer.php:37
653
+ msgid "Help improve Google Analytics for WordPress"
654
+ msgstr ""
655
+
656
+ #: admin/class-pointer.php:38
657
+ msgid ""
658
+ "You've just installed Google Analytics for WordPress by Yoast. Please helps "
659
+ "us improve it by allowing us to gather anonymous usage stats so we know "
660
+ "which configurations, plugins and themes to test with."
661
+ msgstr ""
662
+
663
+ #: admin/class-pointer.php:43
664
+ msgid "Allow tracking"
665
+ msgstr ""
666
+
667
+ #: admin/class-pointer.php:49
668
+ msgid "Do not allow tracking"
669
+ msgstr ""
670
+
671
+ #: admin/yst_plugin_tools.php:54
672
+ msgid "Settings"
673
+ msgstr ""
674
+
675
+ #: admin/yst_plugin_tools.php:170
676
+ msgid "Why not do any or all of the following:"
677
+ msgstr ""
678
+
679
+ #: admin/yst_plugin_tools.php:172
680
+ msgid "Link to it so other folks can find out about it."
681
+ msgstr ""
682
+
683
+ #: admin/yst_plugin_tools.php:173
684
+ msgid "Give it a 5 star rating on WordPress.org."
685
+ msgstr ""
686
+
687
+ #: admin/yst_plugin_tools.php:174
688
+ msgid "Let other people know that it works with your WordPress setup."
689
+ msgstr ""
690
+
691
+ #: admin/yst_plugin_tools.php:176
692
+ msgid "Like this plugin?"
693
+ msgstr ""
694
+
695
+ #: frontend/class-frontend.php:75
696
+ msgid ""
697
+ "Google Analytics tracking code not shown because you haven't setup Google "
698
+ "Analytics for WordPress yet."
699
+ msgstr ""
700
+
701
+ #: frontend/class-frontend.php:310
702
+ msgid ""
703
+ "Google Analytics tracking code not shown because users over level %s are "
704
+ "ignored."
705
+ msgstr ""
706
+
707
+ #: frontend/class-frontend.php:661
708
+ msgid ""
709
+ "Please set Google Analytics position to \"manual\" in the settings, or "
710
+ "remove this call to yoast_analytics();"
711
+ msgstr ""
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: joostdevalk
3
  Donate link: http://yoast.com/donate/
4
  Tags: analytics, google analytics, statistics, tracking, stats, google
5
- Requires at least: 2.8
6
- Tested up to: 3.4
7
- Stable tag: 4.2.8
8
 
9
  Track your WordPress site easily and with lots of metadata: views per author & category, automatic tracking of outbound clicks and pageviews.
10
 
@@ -58,6 +58,12 @@ This section describes how to install the plugin and get it working.
58
 
59
  == Changelog ==
60
 
 
 
 
 
 
 
61
  = 4.2.8 =
62
 
63
  * Fix a small bug in tracking that could potentially slow down admin.
2
  Contributors: joostdevalk
3
  Donate link: http://yoast.com/donate/
4
  Tags: analytics, google analytics, statistics, tracking, stats, google
5
+ Requires at least: 3.3
6
+ Tested up to: 3.5
7
+ Stable tag: 4.3
8
 
9
  Track your WordPress site easily and with lots of metadata: views per author & category, automatic tracking of outbound clicks and pageviews.
10
 
58
 
59
  == Changelog ==
60
 
61
+ = 4.3 =
62
+
63
+ * Major refactor of plugin code, to only load necessary code on front and backend.
64
+ * Made entire plugin i18n ready.
65
+ * Fixed Google Authentication process (thanks to [Jan Willem Eshuis](http://www.janwillemeshuis.nl/)).
66
+
67
  = 4.2.8 =
68
 
69
  * Fix a small bug in tracking that could potentially slow down admin.
yst_plugin_tools.css DELETED
@@ -1,92 +0,0 @@
1
- td.yst_desc {
2
- font-weight: normal;
3
- font-size: 12px;
4
- line-height: 12px;
5
- color:#777;
6
- }
7
-
8
- tr.yst_row {
9
- padding: 5px 0 0 0;
10
- margin: 5px 0 0 0;
11
- }
12
- tr.yst_row.even {
13
- background-color: #f6f6f6;
14
- }
15
-
16
- div.inside ul {
17
- margin-left: 20px;
18
- }
19
-
20
- div.inside ul li {
21
- list-style: square;
22
- line-height:16px;
23
- }
24
-
25
- div.inside a, div.inside a.rsswidget {
26
- font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif;
27
- text-decoration: none;
28
- }
29
- div.inside a:hover, div.inside a.rsswidget:hover {
30
- text-decoration: underline;
31
- }
32
- div.inside ul li.rss {
33
- list-style-image: url(images/rss.png);
34
- }
35
-
36
- div.inside ul li.twitter {
37
- list-style-image: url(images/twitter-icon.png);
38
- }
39
-
40
- div.inside ul li.facebook {
41
- list-style-image: url(images/facebook-icon.png);
42
- }
43
-
44
- div.inside ul li.googleplus {
45
- list-style-image: url(images/google-plus-icon.png);
46
- }
47
-
48
- div.inside ul li.email {
49
- list-style-image: url(images/email_sub.png);
50
- }
51
-
52
- div.inside ul li.yoast {
53
- list-style-image: url(images/yoast-16x16.png);
54
- }
55
-
56
- .text, .select {
57
- width: 250px;
58
- }
59
-
60
- .postbox p {
61
- text-align:left;
62
- margin: 0 10px 10px 10px;
63
- font-size: 13px;
64
- line-height: 150%;
65
- }
66
-
67
- .postbox pre {
68
- margin: 5px 10px;
69
- padding:4px;
70
- background: lightyellow;
71
- }
72
-
73
- .side .postbox p, .side .postbox a, .side .postbox a.rsswidget {
74
- font-size: 13px;
75
- }
76
-
77
- div.inside .button:hover, div.inside .button-primary:hover {
78
- text-decoration: none;
79
- }
80
-
81
- .postbox#donate {
82
- border-color: green;
83
- border-width: 2px;
84
- }
85
- strong.red {
86
- color: green;
87
- font-weight: bold;
88
- font-size: 105%;
89
- }
90
- .postbox {
91
- margin: 0 10px 10px 0;
92
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
yst_plugin_tools.php DELETED
@@ -1,234 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Backend Class for use in all Yoast plugins
5
- * Version 0.2
6
- */
7
-
8
- if (!class_exists('Yoast_GA_Plugin_Admin')) {
9
- class Yoast_GA_Plugin_Admin {
10
-
11
- var $hook = '';
12
- var $filename = '';
13
- var $longname = '';
14
- var $shortname = '';
15
- var $ozhicon = '';
16
- var $optionname = '';
17
- var $homepage = '';
18
- var $accesslvl = 'edit_users';
19
-
20
- function Yoast_GA_Plugin_Admin() {
21
- add_action( 'admin_menu', array(&$this, 'register_settings_page') );
22
- add_filter( 'plugin_action_links', array(&$this, 'add_action_link'), 10, 2 );
23
- add_filter( 'ozh_adminmenu_icon', array(&$this, 'add_ozh_adminmenu_icon' ) );
24
-
25
- add_action('admin_print_scripts', array(&$this,'config_page_scripts'));
26
- add_action('admin_print_styles', array(&$this,'config_page_styles'));
27
-
28
- add_action('wp_dashboard_setup', array(&$this,'widget_setup'));
29
- }
30
-
31
- function add_ozh_adminmenu_icon( $hook ) {
32
- if ($hook == $this->hook)
33
- return plugin_dir_url( __FILE__ ).$this->ozhicon;
34
- return $hook;
35
- }
36
-
37
- function config_page_styles() {
38
- if (isset($_GET['page']) && $_GET['page'] == $this->hook) {
39
- wp_enqueue_style('dashboard');
40
- wp_enqueue_style('thickbox');
41
- wp_enqueue_style('global');
42
- wp_enqueue_style('wp-admin');
43
- wp_enqueue_style('gawp-css', plugin_dir_url( __FILE__ ). 'yst_plugin_tools.css');
44
- }
45
- }
46
-
47
- function register_settings_page() {
48
- add_options_page($this->longname, $this->shortname, $this->accesslvl, $this->hook, array(&$this,'config_page'));
49
- }
50
-
51
- function plugin_options_url() {
52
- return admin_url( 'options-general.php?page='.$this->hook );
53
- }
54
-
55
- /**
56
- * Add a link to the settings page to the plugins list
57
- */
58
- function add_action_link( $links, $file ) {
59
- static $this_plugin;
60
- if( empty($this_plugin) ) $this_plugin = $this->filename;
61
- if ( $file == $this_plugin ) {
62
- $settings_link = '<a href="' . $this->plugin_options_url() . '">' . __('Settings', 'gawp_yoast') . '</a>';
63
- array_unshift( $links, $settings_link );
64
- }
65
- return $links;
66
- }
67
-
68
- function config_page() {
69
-
70
- }
71
-
72
- function config_page_scripts() {
73
- if (isset($_GET['page']) && $_GET['page'] == $this->hook) {
74
- wp_enqueue_script('postbox');
75
- wp_enqueue_script('dashboard');
76
- wp_enqueue_script('thickbox');
77
- wp_enqueue_script('media-upload');
78
- }
79
- }
80
-
81
- /**
82
- * Create a Checkbox input field
83
- */
84
- function checkbox($id) {
85
- $options = get_option( $this->optionname );
86
- $checked = false;
87
- if ( isset($options[$id]) && $options[$id] == 1 )
88
- $checked = true;
89
- return '<input type="checkbox" id="'.$id.'" name="'.$id.'"'. checked($checked,true,false).'/>';
90
- }
91
-
92
- /**
93
- * Create a Text input field
94
- */
95
- function textinput($id) {
96
- $options = get_option( $this->optionname );
97
- $val = '';
98
- if ( isset( $options[$id] ) )
99
- $val = $options[$id];
100
- return '<input class="text" type="text" id="'.$id.'" name="'.$id.'" size="30" value="'.$val.'"/>';
101
- }
102
-
103
- /**
104
- * Create a dropdown field
105
- */
106
- function select($id, $options, $multiple = false) {
107
- $opt = get_option($this->optionname);
108
- $output = '<select class="select" name="'.$id.'" id="'.$id.'">';
109
- foreach ($options as $val => $name) {
110
- $sel = '';
111
- if ($opt[$id] == $val)
112
- $sel = ' selected="selected"';
113
- if ($name == '')
114
- $name = $val;
115
- $output .= '<option value="'.$val.'"'.$sel.'>'.$name.'</option>';
116
- }
117
- $output .= '</select>';
118
- return $output;
119
- }
120
-
121
- /**
122
- * Create a potbox widget
123
- */
124
- function postbox($id, $title, $content) {
125
- ?>
126
- <div id="<?php echo $id; ?>" class="postbox">
127
- <div class="handlediv" title="Click to toggle"><br /></div>
128
- <h3 class="hndle"><span><?php echo $title; ?></span></h3>
129
- <div class="inside">
130
- <?php echo $content; ?>
131
- </div>
132
- </div>
133
- <?php
134
- }
135
-
136
-
137
- /**
138
- * Create a form table from an array of rows
139
- */
140
- function form_table($rows) {
141
- $content = '<table class="form-table">';
142
- $i = 1;
143
- foreach ($rows as $row) {
144
- $class = '';
145
- if ($i > 1) {
146
- $class .= 'yst_row';
147
- }
148
- if ($i % 2 == 0) {
149
- $class .= ' even';
150
- }
151
- $content .= '<tr id="'.$row['id'].'_row" class="'.$class.'"><th valign="top" scrope="row">';
152
- if (isset($row['id']) && $row['id'] != '')
153
- $content .= '<label for="'.$row['id'].'">'.$row['label'].':</label>';
154
- else
155
- $content .= $row['label'];
156
- $content .= '</th><td valign="top">';
157
- $content .= $row['content'];
158
- $content .= '</td></tr>';
159
- if ( isset($row['desc']) && !empty($row['desc']) ) {
160
- $content .= '<tr class="'.$class.'"><td colspan="2" class="yst_desc"><small>'.$row['desc'].'</small></td></tr>';
161
- }
162
-
163
- $i++;
164
- }
165
- $content .= '</table>';
166
- return $content;
167
- }
168
-
169
- /**
170
- * Create a "plugin like" box.
171
- */
172
- function plugin_like($hook = '') {
173
- if (empty($hook)) {
174
- $hook = $this->hook;
175
- }
176
- $content = '<p>'.__('Why not do any or all of the following:', 'gawp_yoast' ).'</p>';
177
- $content .= '<ul>';
178
- $content .= '<li><a href="'.$this->homepage.'">'.__('Link to it so other folks can find out about it.', 'gawp_yoast' ).'</a></li>';
179
- $content .= '<li><a href="http://wordpress.org/extend/plugins/'.$hook.'/">'.__('Give it a 5 star rating on WordPress.org.', 'gawp_yoast' ).'</a></li>';
180
- $content .= '<li><a href="http://wordpress.org/extend/plugins/'.$hook.'/">'.__('Let other people know that it works with your WordPress setup.', 'gawp_yoast' ).'</a></li>';
181
- $content .= '</ul>';
182
- $this->postbox($hook.'like', __( 'Like this plugin?', 'gawp_yoast' ), $content);
183
- }
184
-
185
- /**
186
- * Info box with link to the bug tracker.
187
- */
188
- function plugin_support($hook = '') {
189
- if (empty($hook)) {
190
- $hook = $this->hook;
191
- }
192
- $content = '<p>'.sprintf( __( 'If you\'ve found a bug in this plugin, please submit it in the <a href="%s">Yoast Bug Tracker</a> with a clear description.', 'gawp_yoast' ), 'http://yoast.com/bugs/google-analytics/').'</p>';
193
- $this->postbox($this->hook.'support', __('Found a bug?', 'gawp_yoast' ), $content);
194
- }
195
-
196
- /**
197
- * Box with latest news from Yoast.com
198
- */
199
- function news() {
200
- include_once(ABSPATH . WPINC . '/feed.php');
201
- $rss = fetch_feed('http://feeds.feedburner.com/joostdevalk');
202
- $rss_items = $rss->get_items( 0, $rss->get_item_quantity(5) );
203
- $content = '<ul>';
204
- if ( !$rss_items ) {
205
- $content .= '<li class="yoast">'.__( 'No news items, feed might be broken...', 'gawp_yoast' ).'</li>';
206
- } else {
207
- foreach ( $rss_items as $item ) {
208
- $url = preg_replace( '/#.*/', '', esc_url( $item->get_permalink(), $protocolls=null, 'display' ) );
209
- $content .= '<li class="yoast">';
210
- $content .= '<a class="rsswidget" href="'.$url.'#utm_source=wpadmin&utm_medium=sidebarwidget&utm_term=newsitem&utm_campaign=wpgaplugin">'. esc_html( $item->get_title() ) .'</a> ';
211
- $content .= '</li>';
212
- }
213
- }
214
- $content .= '<li class="facebook"><a href="https://www.facebook.com/yoastcom">'.__( 'Like Yoast on Facebook', 'gawp_yoast' ).'</a></li>';
215
- $content .= '<li class="twitter"><a href="http://twitter.com/yoast">'.__( 'Follow Yoast on Twitter', 'gawp_yoast' ).'</a></li>';
216
- $content .= '<li class="googleplus"><a href="https://plus.google.com/115369062315673853712/posts">'.__( 'Circle Yoast on Google+', 'gawp_yoast' ).'</a></li>';
217
- $content .= '<li class="rss"><a href="http://yoast.com/feed/">'.__( 'Subscribe with RSS', 'gawp_yoast' ).'</a></li>';
218
- $content .= '<li class="email"><a href="http://yoast.com/email-blog-updates/#utm_source=wpadmin&utm_medium=sidebarwidget&utm_term=emailsubscribe&utm_campaign=wpgaplugin">'.__( 'Subscribe by email', 'gawp_yoast' ).'</a></li>';
219
- $content .= '</ul>';
220
- $this->postbox('yoastlatest', __( 'Latest news from Yoast', 'gawp_yoast' ), $content);
221
- }
222
-
223
- function text_limit( $text, $limit, $finish = ' [&hellip;]') {
224
- if( strlen( $text ) > $limit ) {
225
- $text = substr( $text, 0, $limit );
226
- $text = substr( $text, 0, - ( strlen( strrchr( $text,' ') ) ) );
227
- $text .= $finish;
228
- }
229
- return $text;
230
- }
231
-
232
- }
233
- }
234
-