Version Description
Release Date: July 15th, 2015
-
Enhancements:
- Improved form labels for remarketing / demographics and interests reports.
- Improved the notice that is shown in the head to non-admin users when their usergroup has been excluded from tracking or debug mode is enabled.
- Adds 4 translations: ca, en_AU, ja, pt_PT
-
Bugfixes:
- Fixes a bug where the plugin would fetch a refresh token from Google on every page request.
- Fixes an undefined index notice which was triggered when running WordPress using WP CLI.
Download this release
Release Info
Developer | omarreiss |
Plugin | Google Analytics for WordPress by MonsterInsights |
Version | 5.4.3 |
Comparing to | |
See all releases |
Code changes from version 5.4.2 to 5.4.3
- admin/class-admin-form.php +4 -4
- admin/class-admin.php +69 -23
- admin/class-google-analytics.php +5 -2
- {vendor/yoast/api-libs/googleanalytics → admin}/class-googleanalytics-reporting.php +22 -17
- admin/dashboards/class-admin-dashboards-collector.php +0 -7
- admin/pages/settings.php +22 -1
- assets/css/yoast_ga_styles.css +6 -1
- assets/css/yoast_ga_styles.min.css +1 -1
- assets/js/yoast_ga_admin.min.js +1 -1
- frontend/abstract-class-tracking.php +45 -1
- frontend/class-ga-js.php +2 -5
- frontend/class-universal.php +11 -5
- frontend/views/tracking-usergroup.php +0 -9
- googleanalytics.php +2 -2
- languages/google-analytics-for-wordpress-ca.mo +0 -0
- languages/google-analytics-for-wordpress-da_DK.mo +0 -0
- languages/google-analytics-for-wordpress-de_DE.mo +0 -0
- languages/google-analytics-for-wordpress-en_AU.mo +0 -0
- languages/google-analytics-for-wordpress-en_GB.mo +0 -0
- languages/google-analytics-for-wordpress-es_ES.mo +0 -0
- languages/google-analytics-for-wordpress-es_MX.mo +0 -0
- languages/google-analytics-for-wordpress-fr_FR.mo +0 -0
- languages/google-analytics-for-wordpress-he_IL.mo +0 -0
- languages/google-analytics-for-wordpress-it_IT.mo +0 -0
- languages/google-analytics-for-wordpress-ja.mo +0 -0
- languages/google-analytics-for-wordpress-nb_NO.mo +0 -0
- languages/google-analytics-for-wordpress-nl_NL.mo +0 -0
- languages/google-analytics-for-wordpress-pl_PL.mo +0 -0
- languages/google-analytics-for-wordpress-pt_BR.mo +0 -0
- languages/google-analytics-for-wordpress-pt_PT.mo +0 -0
- languages/google-analytics-for-wordpress-ru_RU.mo +0 -0
- languages/google-analytics-for-wordpress-sv_SE.mo +0 -0
- languages/google-analytics-for-wordpress-tr_TR.mo +0 -0
- languages/google-analytics-for-wordpress.pot +107 -58
- readme.txt +14 -1
- vendor/autoload.php +1 -1
- vendor/autoload_52.php +1 -1
- vendor/composer/ClassLoader.php +4 -4
- vendor/composer/autoload_classmap.php +1 -0
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_real_52.php +3 -3
- vendor/composer/installed.json +23 -23
- vendor/composer/installers/README.md +0 -2
- vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php +0 -9
- vendor/composer/installers/src/Composer/Installers/Installer.php +1 -3
- vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php +0 -10
- vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php +1 -1
- vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php +0 -6
- vendor/xrstf/composer-php52/.hg_archival.txt +2 -3
- vendor/xrstf/composer-php52/.hgtags +0 -1
- vendor/yoast/api-libs/README.md +2 -3
- vendor/yoast/api-libs/class-api-google-client.php +269 -0
- vendor/yoast/api-libs/class-api-google.php +64 -0
- vendor/yoast/api-libs/class-api-libs.php +16 -103
- vendor/yoast/api-libs/google/cache/Google_ApcCache.php +0 -98
- vendor/yoast/api-libs/google/cache/Google_FileCache.php +0 -137
- vendor/yoast/api-libs/google/cache/Google_MemcacheCache.php +0 -130
- vendor/yoast/api-libs/google/class-api-google.php +0 -80
- vendor/yoast/api-libs/google/io/Google_HttpStreamIO.php +0 -168
- vendor/yoast/api-libs/google/io/Google_WPIO.php +11 -6
- vendor/yoast/api-libs/googleanalytics/class-api-googleanalytics.php +0 -41
- vendor/yoast/api-libs/googleanalytics/class-google-analytics-client.php +0 -182
- vendor/yoast/api-libs/tests/google/text-class-api-google.php +0 -19
- vendor/yoast/api-libs/tests/googleanalytics/test-class-api-googleanalytics.php +0 -12
- vendor/yoast/api-libs/tests/test-class-api-libs.php +0 -28
admin/class-admin-form.php
CHANGED
@@ -102,15 +102,15 @@ class Yoast_GA_Admin_Form {
|
|
102 |
|
103 |
$input .= '<input ' . self::parse_attributes( $attributes ) . ' />';
|
104 |
|
105 |
-
if ( ! is_null( $text_label ) ) {
|
106 |
-
$input .= '<label class="ga-form ga-form-' . $type . '-label" id="yoast-ga-form-label-' . $type . '-textlabel-' . self::$form_namespace . '-' . $id . '" for="yoast-ga-form-' . $type . '-' . self::$form_namespace . '-' . $id . '">' . $text_label . '</label>';
|
107 |
-
}
|
108 |
-
|
109 |
// If we get a description, append it to this select field in a new row
|
110 |
if ( ! is_null( $description ) ) {
|
111 |
$input .= self::show_help( $id, $description );
|
112 |
}
|
113 |
|
|
|
|
|
|
|
|
|
114 |
$input .= '</div>';
|
115 |
|
116 |
return $input;
|
102 |
|
103 |
$input .= '<input ' . self::parse_attributes( $attributes ) . ' />';
|
104 |
|
|
|
|
|
|
|
|
|
105 |
// If we get a description, append it to this select field in a new row
|
106 |
if ( ! is_null( $description ) ) {
|
107 |
$input .= self::show_help( $id, $description );
|
108 |
}
|
109 |
|
110 |
+
if ( ! is_null( $text_label ) ) {
|
111 |
+
$input .= '<label class="ga-form ga-form-' . $type . '-label" id="yoast-ga-form-label-' . $type . '-textlabel-' . self::$form_namespace . '-' . $id . '" for="yoast-ga-form-' . $type . '-' . self::$form_namespace . '-' . $id . '">' . $text_label . '</label>';
|
112 |
+
}
|
113 |
+
|
114 |
$input .= '</div>';
|
115 |
|
116 |
return $input;
|
admin/class-admin.php
CHANGED
@@ -8,11 +8,6 @@
|
|
8 |
*/
|
9 |
class Yoast_GA_Admin extends Yoast_GA_Options {
|
10 |
|
11 |
-
/**
|
12 |
-
* @var boolean $api Store the API instance
|
13 |
-
*/
|
14 |
-
public $api;
|
15 |
-
|
16 |
/**
|
17 |
* Constructor
|
18 |
*/
|
@@ -39,8 +34,18 @@ class Yoast_GA_Admin extends Yoast_GA_Options {
|
|
39 |
*/
|
40 |
public function init_settings() {
|
41 |
$this->options = $this->get_options();
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
// Listener for reconnecting with google analytics
|
46 |
$this->google_analytics_listener();
|
@@ -69,6 +74,13 @@ class Yoast_GA_Admin extends Yoast_GA_Options {
|
|
69 |
$dashboards->init_dashboards( $this->get_current_profile() );
|
70 |
}
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
/**
|
73 |
* This function saves the settings in the option field and returns a wp success message on success
|
74 |
*
|
@@ -97,22 +109,7 @@ class Yoast_GA_Admin extends Yoast_GA_Options {
|
|
97 |
$this->options['analytics_profile_code'] = $this->get_ua_code_from_profile( $this->options['analytics_profile'] );
|
98 |
}
|
99 |
|
100 |
-
|
101 |
-
$this->options['manual_ua_code_field'] = trim( $this->options['manual_ua_code_field'] );
|
102 |
-
// en dash to minus, prevents issue with code copied from web with "fancy" dash
|
103 |
-
$this->options['manual_ua_code_field'] = str_replace( '–', '-', $this->options['manual_ua_code_field'] );
|
104 |
-
|
105 |
-
if ( ! preg_match( '|^UA-\d{4,}-\d+$|', $this->options['manual_ua_code_field'] ) ) {
|
106 |
-
|
107 |
-
$this->add_notification( 'ga_notifications', array(
|
108 |
-
'type' => 'error',
|
109 |
-
'description' => __( 'The UA code needs to follow UA-XXXXXXXX-X format.', 'google-analytics-for-wordpress' ),
|
110 |
-
) );
|
111 |
-
|
112 |
-
wp_redirect( admin_url( 'admin.php' ) . '?page=yst_ga_settings#top#' . $data['return_tab'], 301 );
|
113 |
-
exit;
|
114 |
-
}
|
115 |
-
}
|
116 |
|
117 |
if ( $this->update_option( $this->options ) ) {
|
118 |
// Success, add a new notification
|
@@ -134,6 +131,55 @@ class Yoast_GA_Admin extends Yoast_GA_Options {
|
|
134 |
exit;
|
135 |
}
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
/**
|
138 |
* Run a this deactivation hook on deactivation of GA. When this happens we'll
|
139 |
* remove the options for the profiles and the refresh token.
|
8 |
*/
|
9 |
class Yoast_GA_Admin extends Yoast_GA_Options {
|
10 |
|
|
|
|
|
|
|
|
|
|
|
11 |
/**
|
12 |
* Constructor
|
13 |
*/
|
34 |
*/
|
35 |
public function init_settings() {
|
36 |
$this->options = $this->get_options();
|
37 |
+
|
38 |
+
try {
|
39 |
+
// Loading Google Api Libs with minimal version 2.0.
|
40 |
+
new Yoast_Api_Libs( '2.0' );
|
41 |
+
}
|
42 |
+
catch( Exception $exception ) {
|
43 |
+
if ( $exception->getMessage() === 'required_version' ) {
|
44 |
+
add_action( 'admin_notices', array( $this, 'set_api_libs_error' ) );
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
$dashboards = Yoast_GA_Dashboards::get_instance();
|
49 |
|
50 |
// Listener for reconnecting with google analytics
|
51 |
$this->google_analytics_listener();
|
74 |
$dashboards->init_dashboards( $this->get_current_profile() );
|
75 |
}
|
76 |
|
77 |
+
/**
|
78 |
+
* There is an error with the API libs. So show a notice.
|
79 |
+
*/
|
80 |
+
public function set_api_libs_error() {
|
81 |
+
echo '<div class="error notice"><p>' . __( 'Yoast plugins share some code between them to make your site faster. As a result of that, we need all Yoast plugins to be up to date. We\'ve detected this isn\'t the case, so please update the Yoast plugins that aren\'t up to date yet.', 'google-analytics-for-wordpress' ) . '</p></div>';
|
82 |
+
}
|
83 |
+
|
84 |
/**
|
85 |
* This function saves the settings in the option field and returns a wp success message on success
|
86 |
*
|
109 |
$this->options['analytics_profile_code'] = $this->get_ua_code_from_profile( $this->options['analytics_profile'] );
|
110 |
}
|
111 |
|
112 |
+
$this->do_validation( $data['return_tab'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
if ( $this->update_option( $this->options ) ) {
|
115 |
// Success, add a new notification
|
131 |
exit;
|
132 |
}
|
133 |
|
134 |
+
/**
|
135 |
+
* Redirect to settings with a validation error if there are validation errors
|
136 |
+
*
|
137 |
+
* @param string $return_tab The tab to return to when there is a validation error.
|
138 |
+
*/
|
139 |
+
protected function do_validation( $return_tab ) {
|
140 |
+
$validation = $this->validate_settings();
|
141 |
+
if ( is_wp_error( $validation ) ) {
|
142 |
+
$this->add_notification( 'ga_notifications', array(
|
143 |
+
'type' => 'error',
|
144 |
+
'description' => $validation->get_error_message(),
|
145 |
+
) );
|
146 |
+
|
147 |
+
wp_redirect( admin_url( 'admin.php' ) . '?page=yst_ga_settings#top#' . $return_tab, 301 );
|
148 |
+
exit;
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Validates the settings in the `options` attribute, returns an WP_Error object on error
|
154 |
+
*
|
155 |
+
* @return true|WP_Error true or an error object.
|
156 |
+
*/
|
157 |
+
protected function validate_settings() {
|
158 |
+
|
159 |
+
if ( ! empty( $this->options['manual_ua_code_field'] ) ) {
|
160 |
+
$this->options['manual_ua_code_field'] = trim( $this->options['manual_ua_code_field'] );
|
161 |
+
// en dash to minus, prevents issue with code copied from web with "fancy" dash
|
162 |
+
$this->options['manual_ua_code_field'] = str_replace( '–', '-', $this->options['manual_ua_code_field'] );
|
163 |
+
|
164 |
+
// Regex to tests if a valid UA code has been set. Valid codes follow: "UA-[4 digits]-[at least 1 digit]".
|
165 |
+
if ( ! preg_match( '|^UA-\d{4,}-\d+$|', $this->options['manual_ua_code_field'] ) ) {
|
166 |
+
|
167 |
+
return new WP_Error(
|
168 |
+
'ua-code-format',
|
169 |
+
__( 'The UA code needs to follow UA-XXXXXXXX-X format.', 'google-analytics-for-wordpress' )
|
170 |
+
);
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Filters the validation for the admin options
|
176 |
+
*
|
177 |
+
* @param true|WP_Error true if the validation is successful, WP_Error on error.
|
178 |
+
* @param array $this->options The options that are being saved.
|
179 |
+
*/
|
180 |
+
return apply_filters( 'yst_ga_admin_validate_settings', true, $this->options );
|
181 |
+
}
|
182 |
+
|
183 |
/**
|
184 |
* Run a this deactivation hook on deactivation of GA. When this happens we'll
|
185 |
* remove the options for the profiles and the refresh token.
|
admin/class-google-analytics.php
CHANGED
@@ -147,7 +147,7 @@ class Yoast_Google_Analytics {
|
|
147 |
* @return bool
|
148 |
*/
|
149 |
public function has_refresh_token() {
|
150 |
-
return
|
151 |
}
|
152 |
|
153 |
/**
|
@@ -197,15 +197,18 @@ class Yoast_Google_Analytics {
|
|
197 |
* The filter is a hook to override the configuration/
|
198 |
*/
|
199 |
protected function set_client() {
|
|
|
200 |
$config = array(
|
201 |
'application_name' => 'Google Analytics by Yoast',
|
202 |
'client_id' => '346753076522-21smrc6aq0hq8oij8001s57dfoo8igf5.apps.googleusercontent.com',
|
203 |
'client_secret' => '5oWaEGFgp-bSrY6vWBmdPfIF',
|
|
|
|
|
204 |
);
|
205 |
|
206 |
$config = apply_filters( 'yst-ga-filter-ga-config', $config );
|
207 |
|
208 |
-
$this->client = new
|
209 |
}
|
210 |
|
211 |
/**
|
147 |
* @return bool
|
148 |
*/
|
149 |
public function has_refresh_token() {
|
150 |
+
return $this->client->is_authenticated();
|
151 |
}
|
152 |
|
153 |
/**
|
197 |
* The filter is a hook to override the configuration/
|
198 |
*/
|
199 |
protected function set_client() {
|
200 |
+
// See https://developers.google.com/identity/protocols/OAuth2InstalledApp#formingtheurl for more details about these fields.
|
201 |
$config = array(
|
202 |
'application_name' => 'Google Analytics by Yoast',
|
203 |
'client_id' => '346753076522-21smrc6aq0hq8oij8001s57dfoo8igf5.apps.googleusercontent.com',
|
204 |
'client_secret' => '5oWaEGFgp-bSrY6vWBmdPfIF',
|
205 |
+
'redirect_uri' => 'urn:ietf:wg:oauth:2.0:oob',
|
206 |
+
'scopes' => array( 'https://www.googleapis.com/auth/analytics.readonly' ),
|
207 |
);
|
208 |
|
209 |
$config = apply_filters( 'yst-ga-filter-ga-config', $config );
|
210 |
|
211 |
+
$this->client = new Yoast_Api_Google_Client( $config, 'yoast-ga', '' );
|
212 |
}
|
213 |
|
214 |
/**
|
{vendor/yoast/api-libs/googleanalytics → admin}/class-googleanalytics-reporting.php
RENAMED
@@ -1,5 +1,11 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
2 |
|
|
|
|
|
|
|
3 |
class Yoast_Googleanalytics_Reporting {
|
4 |
|
5 |
/**
|
@@ -28,10 +34,10 @@ class Yoast_Googleanalytics_Reporting {
|
|
28 |
/**
|
29 |
* Format a response
|
30 |
*
|
31 |
-
* @param $raw_data
|
32 |
-
* @param $store_as
|
33 |
-
* @param $start_date
|
34 |
-
* @param $end_date
|
35 |
*
|
36 |
* @return array
|
37 |
*/
|
@@ -46,8 +52,9 @@ class Yoast_Googleanalytics_Reporting {
|
|
46 |
if ( isset( $raw_data['body']['rows'] ) && is_array( $raw_data['body']['rows'] ) ) {
|
47 |
foreach ( $raw_data['body']['rows'] as $key => $item ) {
|
48 |
if ( $store_as == 'datelist' ) {
|
49 |
-
$data[(int) $this->format_ga_date( $item[0] )] = $this->parse_row( $item );
|
50 |
-
}
|
|
|
51 |
$data[] = $this->parse_data_row( $item );
|
52 |
}
|
53 |
}
|
@@ -70,7 +77,7 @@ class Yoast_Googleanalytics_Reporting {
|
|
70 |
private function check_validity_data( $data = array() ) {
|
71 |
foreach ( $data as $key => $value ) {
|
72 |
if ( strlen( $key ) <= 5 ) {
|
73 |
-
unset( $data[$key] );
|
74 |
}
|
75 |
}
|
76 |
|
@@ -80,7 +87,7 @@ class Yoast_Googleanalytics_Reporting {
|
|
80 |
/**
|
81 |
* Format the GA date value
|
82 |
*
|
83 |
-
* @param $date
|
84 |
*
|
85 |
* @return int
|
86 |
*/
|
@@ -95,7 +102,7 @@ class Yoast_Googleanalytics_Reporting {
|
|
95 |
/**
|
96 |
* Parse a row and return an array with the correct data rows
|
97 |
*
|
98 |
-
* @param $item
|
99 |
*
|
100 |
* @return array
|
101 |
*/
|
@@ -106,15 +113,15 @@ class Yoast_Googleanalytics_Reporting {
|
|
106 |
'value' => (string) $item[1],
|
107 |
'total' => (int) $item[2],
|
108 |
);
|
109 |
-
} else {
|
110 |
-
return (int) $item[1];
|
111 |
}
|
|
|
|
|
112 |
}
|
113 |
|
114 |
/**
|
115 |
* Parse a row for the list storage type
|
116 |
*
|
117 |
-
* @param $item
|
118 |
*
|
119 |
* @return array
|
120 |
*/
|
@@ -128,17 +135,15 @@ class Yoast_Googleanalytics_Reporting {
|
|
128 |
/**
|
129 |
* Calculate the date range between 2 dates
|
130 |
*
|
131 |
-
* @param
|
132 |
-
* @param
|
133 |
* @param string $step
|
134 |
* @param string $format
|
135 |
*
|
136 |
* @return array
|
137 |
*/
|
138 |
-
private function date_range( $
|
139 |
$dates = array();
|
140 |
-
$current = $first;
|
141 |
-
$last = $last;
|
142 |
|
143 |
while ( $current <= $last ) {
|
144 |
$dates[] = date( $format, $current );
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package GoogleAnalytics\Admin
|
4 |
+
*/
|
5 |
|
6 |
+
/**
|
7 |
+
* Class Yoast_Googleanalytics_Reporting
|
8 |
+
*/
|
9 |
class Yoast_Googleanalytics_Reporting {
|
10 |
|
11 |
/**
|
34 |
/**
|
35 |
* Format a response
|
36 |
*
|
37 |
+
* @param array $raw_data
|
38 |
+
* @param string $store_as
|
39 |
+
* @param string $start_date
|
40 |
+
* @param string $end_date
|
41 |
*
|
42 |
* @return array
|
43 |
*/
|
52 |
if ( isset( $raw_data['body']['rows'] ) && is_array( $raw_data['body']['rows'] ) ) {
|
53 |
foreach ( $raw_data['body']['rows'] as $key => $item ) {
|
54 |
if ( $store_as == 'datelist' ) {
|
55 |
+
$data[ (int) $this->format_ga_date( $item[0] ) ] = $this->parse_row( $item );
|
56 |
+
}
|
57 |
+
else {
|
58 |
$data[] = $this->parse_data_row( $item );
|
59 |
}
|
60 |
}
|
77 |
private function check_validity_data( $data = array() ) {
|
78 |
foreach ( $data as $key => $value ) {
|
79 |
if ( strlen( $key ) <= 5 ) {
|
80 |
+
unset( $data[ $key ] );
|
81 |
}
|
82 |
}
|
83 |
|
87 |
/**
|
88 |
* Format the GA date value
|
89 |
*
|
90 |
+
* @param string $date
|
91 |
*
|
92 |
* @return int
|
93 |
*/
|
102 |
/**
|
103 |
* Parse a row and return an array with the correct data rows
|
104 |
*
|
105 |
+
* @param array $item
|
106 |
*
|
107 |
* @return array
|
108 |
*/
|
113 |
'value' => (string) $item[1],
|
114 |
'total' => (int) $item[2],
|
115 |
);
|
|
|
|
|
116 |
}
|
117 |
+
|
118 |
+
return (int) $item[1];
|
119 |
}
|
120 |
|
121 |
/**
|
122 |
* Parse a row for the list storage type
|
123 |
*
|
124 |
+
* @param array $item
|
125 |
*
|
126 |
* @return array
|
127 |
*/
|
135 |
/**
|
136 |
* Calculate the date range between 2 dates
|
137 |
*
|
138 |
+
* @param string $current
|
139 |
+
* @param string $last
|
140 |
* @param string $step
|
141 |
* @param string $format
|
142 |
*
|
143 |
* @return array
|
144 |
*/
|
145 |
+
private function date_range( $current, $last, $step = '+1 day', $format = 'Y-m-d' ) {
|
146 |
$dates = array();
|
|
|
|
|
147 |
|
148 |
while ( $current <= $last ) {
|
149 |
$dates[] = date( $format, $current );
|
admin/dashboards/class-admin-dashboards-collector.php
CHANGED
@@ -8,11 +8,6 @@
|
|
8 |
*/
|
9 |
class Yoast_GA_Dashboards_Collector {
|
10 |
|
11 |
-
/**
|
12 |
-
* @var boolean $api API storage
|
13 |
-
*/
|
14 |
-
public $api;
|
15 |
-
|
16 |
/**
|
17 |
* @var array $active_metrics Store the active metrics
|
18 |
*/
|
@@ -87,8 +82,6 @@ class Yoast_GA_Dashboards_Collector {
|
|
87 |
* This hook runs on the shutdown to fetch data from GA
|
88 |
*/
|
89 |
private function init_shutdown_hook() {
|
90 |
-
$this->api = Yoast_Api_Libs::load_api_libraries( array( 'oauth', 'googleanalytics' ) );
|
91 |
-
|
92 |
// Hook the WP cron event
|
93 |
add_action( 'wp', array( $this, 'setup_wp_cron_aggregate' ) );
|
94 |
|
8 |
*/
|
9 |
class Yoast_GA_Dashboards_Collector {
|
10 |
|
|
|
|
|
|
|
|
|
|
|
11 |
/**
|
12 |
* @var array $active_metrics Store the active metrics
|
13 |
*/
|
82 |
* This hook runs on the shutdown to fetch data from GA
|
83 |
*/
|
84 |
private function init_shutdown_hook() {
|
|
|
|
|
85 |
// Hook the WP cron event
|
86 |
add_action( 'wp', array( $this, 'setup_wp_cron_aggregate' ) );
|
87 |
|
admin/pages/settings.php
CHANGED
@@ -101,14 +101,32 @@ echo Yoast_GA_Admin_Form::create_form( 'settings' );
|
|
101 |
echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Anonymize IPs', 'google-analytics-for-wordpress' ), 'anonymize_ips', null, sprintf( __( 'This adds %1$s, 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.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApi_gat?csw=1#_gat._anonymizeIp" target="_blank"><code>_anonymizeIp</code></a>' ) );
|
102 |
echo Yoast_GA_Admin_Form::select( __( 'Ignore users', 'google-analytics-for-wordpress' ), 'ignore_users', $yoast_ga_admin->get_userroles(), __( 'Users of the role you select will be ignored, so if you select Editor, all Editors will be ignored.', 'google-analytics-for-wordpress' ), true );
|
103 |
echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Disable analytics dashboard', 'google-analytics-for-wordpress' ), 'dashboards_disabled', null, __( 'This will completely disable the dashboard and stop the plugin from fetching the latest analytics data.', 'google-analytics-for-wordpress' ) );
|
|
|
104 |
?>
|
105 |
</div>
|
106 |
<div id="universal" class="gatab">
|
107 |
<?php
|
108 |
echo '<h2>' . __( 'Universal settings', 'google-analytics-for-wordpress' ) . '</h2>';
|
109 |
echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Enable Universal tracking', 'google-analytics-for-wordpress' ), 'enable_universal', null, sprintf( __( 'First enable Universal tracking in your Google Analytics account. Please read %1$sthis guide%2$s to learn how to do that.', 'google-analytics-for-wordpress' ), '<a href="http://kb.yoast.com/article/125-universal-analytics#utm_medium=kb-link&utm_source=gawp-config&utm_campaign=wpgaplugin" target="_blank">', '</a>' ) );
|
110 |
-
echo Yoast_GA_Admin_Form::input(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Enhanced Link Attribution', 'google-analytics-for-wordpress' ), 'enhanced_link_attribution', null, sprintf( __( 'Add %1$sEnhanced Link Attribution%2$s to your tracking code.', 'google-analytics-for-wordpress' ), '<a href="https://support.google.com/analytics/answer/2558867" target="_blank">', ' </a>' ) );
|
|
|
|
|
|
|
|
|
|
|
112 |
?>
|
113 |
</div>
|
114 |
<div id="advanced" class="gatab">
|
@@ -127,6 +145,9 @@ echo Yoast_GA_Admin_Form::create_form( 'settings' );
|
|
127 |
echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Add <code>_setAllowLinker</code>', 'google-analytics-for-wordpress' ), 'add_allow_linker', null, sprintf( __( 'This adds a %1$s call to your tracking code, allowing you to use %2$s and related functions.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory?csw=1#_gat.GA_Tracker_._setAllowLinker" target="_blank"><code>_setAllowLinker</code></a>', ' <code>_link</code>' ) );
|
128 |
echo Yoast_GA_Admin_Form::textarea( __( 'Custom code', 'google-analytics-for-wordpress' ), 'custom_code', sprintf( __( 'Not for the average user: this allows you to add a line of code, to be added before the %1$s call.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration#_gat.GA_Tracker_._trackPageview" target="_blank"><code>_trackPageview</code></a>' ) );
|
129 |
|
|
|
|
|
|
|
130 |
do_action( 'yst_ga_advanced-tab' );
|
131 |
?>
|
132 |
</div>
|
101 |
echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Anonymize IPs', 'google-analytics-for-wordpress' ), 'anonymize_ips', null, sprintf( __( 'This adds %1$s, 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.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApi_gat?csw=1#_gat._anonymizeIp" target="_blank"><code>_anonymizeIp</code></a>' ) );
|
102 |
echo Yoast_GA_Admin_Form::select( __( 'Ignore users', 'google-analytics-for-wordpress' ), 'ignore_users', $yoast_ga_admin->get_userroles(), __( 'Users of the role you select will be ignored, so if you select Editor, all Editors will be ignored.', 'google-analytics-for-wordpress' ), true );
|
103 |
echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Disable analytics dashboard', 'google-analytics-for-wordpress' ), 'dashboards_disabled', null, __( 'This will completely disable the dashboard and stop the plugin from fetching the latest analytics data.', 'google-analytics-for-wordpress' ) );
|
104 |
+
|
105 |
?>
|
106 |
</div>
|
107 |
<div id="universal" class="gatab">
|
108 |
<?php
|
109 |
echo '<h2>' . __( 'Universal settings', 'google-analytics-for-wordpress' ) . '</h2>';
|
110 |
echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Enable Universal tracking', 'google-analytics-for-wordpress' ), 'enable_universal', null, sprintf( __( 'First enable Universal tracking in your Google Analytics account. Please read %1$sthis guide%2$s to learn how to do that.', 'google-analytics-for-wordpress' ), '<a href="http://kb.yoast.com/article/125-universal-analytics#utm_medium=kb-link&utm_source=gawp-config&utm_campaign=wpgaplugin" target="_blank">', '</a>' ) );
|
111 |
+
echo Yoast_GA_Admin_Form::input(
|
112 |
+
'checkbox',
|
113 |
+
__( 'Enable Demographics and Interests Reports for Remarketing and Advertising', 'google-analytics-for-wordpress' ),
|
114 |
+
'demographics',
|
115 |
+
'<span id="yoast-ga-displayfeatures-warning">' . __( 'Note that usage of this function is affected by privacy and cookie laws around the world. Be sure to follow the laws that affect your target audience.', 'google-analytics-for-wordpress' ) . '</span>',
|
116 |
+
/* Transators: %1$s contains the link to a knowledge base article, %2$s contains the the closing tag for both links, %3$s contains a link to Google documentation about remarketing. */
|
117 |
+
sprintf(
|
118 |
+
__( 'Check this setting to add the Demographics and Remarketing features to your Google Analytics tracking code. We\'ve written an article in our %1$sknowledge base%2$s about Demographics and Interest reports. For more information about Remarketing, we refer you to %3$sGoogle\'s documentation%2$s.', 'google-analytics-for-wordpress' ),
|
119 |
+
'<a href="http://kb.yoast.com/article/154-enable-demographics-and-interests-report-in-google-analytics/#utm_medium=kb-link&utm_source=gawp-config&utm_campaign=wpgaplugin" target="_blank">',
|
120 |
+
'</a>',
|
121 |
+
'<a href="https://support.google.com/analytics/answer/2444872?hl=' . get_locale() . '" target="_blank">'
|
122 |
+
)
|
123 |
+
);
|
124 |
echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Enhanced Link Attribution', 'google-analytics-for-wordpress' ), 'enhanced_link_attribution', null, sprintf( __( 'Add %1$sEnhanced Link Attribution%2$s to your tracking code.', 'google-analytics-for-wordpress' ), '<a href="https://support.google.com/analytics/answer/2558867" target="_blank">', ' </a>' ) );
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Action: 'yst_ga_universal_tab' - Allow adding to the universal tab of the settings
|
128 |
+
*/
|
129 |
+
do_action( 'yst_ga_universal_tab' );
|
130 |
?>
|
131 |
</div>
|
132 |
<div id="advanced" class="gatab">
|
145 |
echo Yoast_GA_Admin_Form::input( 'checkbox', __( 'Add <code>_setAllowLinker</code>', 'google-analytics-for-wordpress' ), 'add_allow_linker', null, sprintf( __( 'This adds a %1$s call to your tracking code, allowing you to use %2$s and related functions.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory?csw=1#_gat.GA_Tracker_._setAllowLinker" target="_blank"><code>_setAllowLinker</code></a>', ' <code>_link</code>' ) );
|
146 |
echo Yoast_GA_Admin_Form::textarea( __( 'Custom code', 'google-analytics-for-wordpress' ), 'custom_code', sprintf( __( 'Not for the average user: this allows you to add a line of code, to be added before the %1$s call.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration#_gat.GA_Tracker_._trackPageview" target="_blank"><code>_trackPageview</code></a>' ) );
|
147 |
|
148 |
+
/**
|
149 |
+
* Action: 'yst_ga_advanced-tab' - Allow adding to the advanced tab of the settings
|
150 |
+
*/
|
151 |
do_action( 'yst_ga_advanced-tab' );
|
152 |
?>
|
153 |
</div>
|
assets/css/yoast_ga_styles.css
CHANGED
@@ -43,7 +43,12 @@ h2#yoast_ga_title {
|
|
43 |
margin: 0 0 0 5px;
|
44 |
font-size: 14px;
|
45 |
font-weight: bold;
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
|
49 |
.ga-form-input {
|
43 |
margin: 0 0 0 5px;
|
44 |
font-size: 14px;
|
45 |
font-weight: bold;
|
46 |
+
}
|
47 |
+
|
48 |
+
#yoast-ga-displayfeatures-warning {
|
49 |
+
float: right;
|
50 |
+
width: 63%;
|
51 |
+
color: red;
|
52 |
}
|
53 |
|
54 |
.ga-form-input {
|
assets/css/yoast_ga_styles.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
h2#yoast_ga_title{padding:9px 15px 4px 0;font-size:23px;font-weight:400;line-height:29px}.nav-tab-wrapper{margin-bottom:20px}.gatab{display:none}.gatab.active{display:block;padding:.5em .9em;border:1px solid #ddd;border-radius:0 3px 3px;background-color:#fff}.tabwrapper .gatab{padding:0;border:none;background:0 0}.tabwrapper .gatab h2{padding:9px 15px 4px 0;font-size:23px;font-weight:400}.ga-form-submit{margin-top:20px}.ga-form-label-left{float:left;width:250px;margin:0 0 0 5px;font-size:14px;font-weight:700;
|
1 |
+
h2#yoast_ga_title{padding:9px 15px 4px 0;font-size:23px;font-weight:400;line-height:29px}.nav-tab-wrapper{margin-bottom:20px}.gatab{display:none}.gatab.active{display:block;padding:.5em .9em;border:1px solid #ddd;border-radius:0 3px 3px;background-color:#fff}.tabwrapper .gatab{padding:0;border:none;background:0 0}.tabwrapper .gatab h2{padding:9px 15px 4px 0;font-size:23px;font-weight:400}.ga-form-submit{margin-top:20px}.ga-form-label-left{float:left;width:250px;margin:0 0 0 5px;font-size:14px;font-weight:700}#yoast-ga-displayfeatures-warning{float:right;width:63%;color:red}.ga-form-input{margin-top:10px}#yoast-ga-wrapper{display:table;width:auto;max-width:1150px}.yoast-ga-content{display:table-cell;min-width:850px;height:500px;margin:0;padding:0;vertical-align:top}.yoast-ga-banners{display:table-cell;width:261px;height:500px;margin:0;padding:20px;vertical-align:top}.ga-form-input{display:table;margin-bottom:20px}.ga-form-table{display:table-cell}.ga-form-description{display:block;float:right;max-width:325px;color:#999}p.ga-topdescription{max-width:600px}#ga-promote,.ga-promote{max-width:600px;padding-left:10px;border:1px solid #ccc;background-color:#fff}.ga-promote{margin-bottom:10px}#ga-promote p,.ga-promote p{margin:0;padding:1em 1em 1em 0}#yoast-ga-form-settings input[type=text]{width:325px}#yoast-ga-form-settings #oauth_code{padding:20px}#yoast-ga-form-settings #oauth_code div{margin:0 0 0 5px}#yoast-ga-form-settings #oauth_code input[type=text]{width:275px}.ga-form .chosen-search input[type=text]{width:100%!important}.yoast-ga-content .chosen-container{width:325px!important}#enter_ua{display:none;margin-top:10px;padding-top:10px}#yoast-ga-form-text-settings-ga_general-manual_ua_code_field{margin-top:-30px}select.ga-multiple{width:300px;height:150px!important}.wpseotab .extension{float:left;box-sizing:border-box;width:350px;height:230px;margin:10px 20px 10px 0;border:1px solid #ccc}.wpseotab .extension p{margin:0;padding:10px}.wpseotab .extension h3{box-sizing:border-box;height:110px;margin:0;padding:20px 10px 0 120px;border-bottom:1px solid #ccc;background:left 10px/130px 100px no-repeat #fff}.wpseotab .extension button.installed{border-color:#00a000;background-color:#00a000;cursor:default}.wpseotab .extension .button-primary.activate-link{border-color:#f06000;background-color:#f18500}.extension a{text-decoration:none}.ecommerce h3{background-image:url(../img/eComm_130x100.png)!important}.ga_premium h3{background-image:url(../img/ga-premium-banner.png)!important}#ga-debug-info h3{height:30px;margin-top:10px;padding-left:16px;font-size:14px}.yoast_help{margin:2px 5px 0}#enter_ua div{display:inline-block;margin:0}
|
assets/js/yoast_ga_admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function yst_popupwindow(
|
1 |
+
function yst_popupwindow(a,b,c){"use strict";var d=screen.width/2-b/2,e=screen.height/8;authwindow=window.open(a,"yst_ga_auth_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+b+", height="+c+", top="+e+", left="+d)}function yst_closepopupwindow(){authwindow.close()}function yst_ga_switch_manual(){if(jQuery("#yoast-ga-form-checkbox-settings-manual_ua_code").is(":checked")){var a=!0;jQuery("#enter_ua").show(),jQuery("#oauth_code").hide()}else{var a=!1;jQuery("#enter_ua").hide(),jQuery("#yoast-ga-form-text-settings-manual_ua_code_field").attr("value",""),jQuery("#oauth_code").hide()}jQuery("#yoast-ga-form-select-settings-analytics_profile").prop("disabled",a).trigger("chosen:updated"),jQuery("#yst_ga_authenticate").attr("disabled",a)}var authwindow;jQuery(document).ready(function(){"use strict";jQuery("#ga-tabs").find("a").click(function(){jQuery("#ga-tabs").find("a").removeClass("nav-tab-active"),jQuery(".gatab").removeClass("active");var a=jQuery(this).attr("id").replace("-tab","");jQuery("#"+a).addClass("active"),jQuery(this).addClass("nav-tab-active"),jQuery("#return_tab").val(a)}),jQuery("a.activate-link").click(function(){jQuery("#extensions.wpseotab").removeClass("active"),jQuery("#extensions-tab").removeClass("nav-tab-active"),jQuery("#licenses.wpseotab").addClass("active"),jQuery("#licenses-tab").addClass("nav-tab-active")});var a=window.location.hash.replace("#top#","");(""===a||"#_=_"===a)&&(a=jQuery(".gatab").attr("id")),jQuery("#"+a).addClass("active"),jQuery("#"+a+"-tab").addClass("nav-tab-active"),jQuery("#yoast-ga-form-checkbox-settings-manual_ua_code").click(yst_ga_switch_manual),yst_ga_switch_manual(),jQuery("#oauth_code").hide(),jQuery("#yst_ga_authenticate").click(function(){jQuery("#oauth_code").show(),Focusable.setFocus(jQuery("#oauth_code"),{hideOnESC:!0}),jQuery("#oauth_code input").focus()}),jQuery(".nav-tab-active").click(),jQuery(".yoast_help").qtip({position:{corner:{target:"topMiddle",tooltip:"bottomLeft"}},show:{when:{event:"mouseover"}},hide:{fixed:!0,when:{event:"mouseout"}},style:{tip:"bottomLeft",name:"blue"}})});
|
frontend/abstract-class-tracking.php
CHANGED
@@ -339,7 +339,8 @@ abstract class Yoast_GA_Tracking {
|
|
339 |
$protocol = $matches[3];
|
340 |
$original_url = $matches[4];
|
341 |
$domain = $this->yoast_ga_get_domain( $matches[4] );
|
342 |
-
$
|
|
|
343 |
$extension = substr( strrchr( $original_url, '.' ), 1 );
|
344 |
$type = $this->get_target_type( $extension, $domain, $origin, $matches );
|
345 |
|
@@ -449,4 +450,47 @@ abstract class Yoast_GA_Tracking {
|
|
449 |
return $label;
|
450 |
}
|
451 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
452 |
}
|
339 |
$protocol = $matches[3];
|
340 |
$original_url = $matches[4];
|
341 |
$domain = $this->yoast_ga_get_domain( $matches[4] );
|
342 |
+
$http_host = empty( $_SERVER['HTTP_HOST'] ) ? '' : $_SERVER['HTTP_HOST'];
|
343 |
+
$origin = $this->yoast_ga_get_domain( $http_host );
|
344 |
$extension = substr( strrchr( $original_url, '.' ), 1 );
|
345 |
$type = $this->get_target_type( $extension, $domain, $origin, $matches );
|
346 |
|
450 |
return $label;
|
451 |
}
|
452 |
|
453 |
+
/**
|
454 |
+
* When a usergroup is disabled, show a message in the source to notify the user they are in a disabled user group.
|
455 |
+
*/
|
456 |
+
protected function disabled_usergroup() {
|
457 |
+
/* translators %1$s is the product name 'Google Analytics by Yoast'. %2$s displays the plugin version the website uses and a link to the plugin on Yoast.com */
|
458 |
+
echo '<!-- ' . sprintf( __( 'This site uses the %1$s plugin version %2$s', 'google-analytics-for-wordpress' ), 'Google Analytics by Yoast', GAWP_VERSION . ' - https://yoast.com/wordpress/plugins/google-analytics/' ) . ' -->';
|
459 |
+
|
460 |
+
if ( current_user_can( 'manage_options' ) ) {
|
461 |
+
echo '<!-- ' . __( '@Webmaster, normally you will find the Google Analytics tracking code here, but you are in the disabled user groups. To change this, navigate to Analytics -> Settings (Ignore usergroups)', 'google-analytics-for-wordpress' ) . ' -->';
|
462 |
+
}
|
463 |
+
else {
|
464 |
+
echo '<!-- ' . __( 'Normally you will find the Google Analytics tracking code here, but the webmaster disabled your user group.', 'google-analytics-for-wordpress' ) . ' -->';
|
465 |
+
}
|
466 |
+
|
467 |
+
// Do not make this translatable, as this is the product name.
|
468 |
+
echo '<!-- / Google Analytics by Yoast -->';
|
469 |
+
}
|
470 |
+
|
471 |
+
/**
|
472 |
+
* When the debug mode is enabled, display a message in the source.
|
473 |
+
*
|
474 |
+
* @return bool
|
475 |
+
*/
|
476 |
+
protected function debug_mode() {
|
477 |
+
if ( $this->options['debug_mode'] === 1 ) {
|
478 |
+
/* translators %1$s is the product name 'Google Analytics by Yoast'. %2$s displays the plugin version the website uses and a link to the plugin on Yoast.com */
|
479 |
+
echo '<!-- ' . sprintf( __( 'This site uses the %1$s plugin version %2$s', 'google-analytics-for-wordpress' ), 'Google Analytics by Yoast', GAWP_VERSION . ' - https://yoast.com/wordpress/plugins/google-analytics/' ) . ' -->';
|
480 |
+
|
481 |
+
if ( current_user_can( 'manage_options' ) ) {
|
482 |
+
echo '<!-- ' . __( '@Webmaster, normally you will find the Google Analytics tracking code here, but the Debug Mode is enabled. To change this, navigate to Analytics -> Settings -> (Tab) Debug Mode and disable Debug Mode to enable tracking of your site.', 'google-analytics-for-wordpress' ) . ' -->';
|
483 |
+
}
|
484 |
+
else {
|
485 |
+
echo '<!-- ' . __( 'Normally you will find the Google Analytics tracking code here, but the webmaster has enabled the Debug Mode.', 'google-analytics-for-wordpress' ) . ' -->';
|
486 |
+
}
|
487 |
+
|
488 |
+
// Do not make this translatable, as this is the product name.
|
489 |
+
echo '<!-- / Google Analytics by Yoast -->';
|
490 |
+
|
491 |
+
return true;
|
492 |
+
}
|
493 |
+
return false;
|
494 |
+
}
|
495 |
+
|
496 |
}
|
frontend/class-ga-js.php
CHANGED
@@ -119,15 +119,12 @@ class Yoast_GA_JS extends Yoast_GA_Tracking {
|
|
119 |
|
120 |
|
121 |
// Include the tracking view
|
122 |
-
if ( $this->
|
123 |
-
require( 'views/tracking-debug.php' );
|
124 |
-
}
|
125 |
-
else {
|
126 |
require( 'views/tracking-ga-js.php' );
|
127 |
}
|
128 |
}
|
129 |
else {
|
130 |
-
|
131 |
}
|
132 |
}
|
133 |
|
119 |
|
120 |
|
121 |
// Include the tracking view
|
122 |
+
if ( ! $this->debug_mode() ) {
|
|
|
|
|
|
|
123 |
require( 'views/tracking-ga-js.php' );
|
124 |
}
|
125 |
}
|
126 |
else {
|
127 |
+
$this->disabled_usergroup();
|
128 |
}
|
129 |
}
|
130 |
|
frontend/class-universal.php
CHANGED
@@ -82,6 +82,15 @@ class Yoast_GA_Universal extends Yoast_GA_Tracking {
|
|
82 |
$gaq_push[] = "'set', 'anonymizeIp', true";
|
83 |
}
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
// add demographics
|
86 |
if ( $this->options['demographics'] ) {
|
87 |
$gaq_push[] = "'require', 'displayfeatures'";
|
@@ -134,15 +143,12 @@ class Yoast_GA_Universal extends Yoast_GA_Tracking {
|
|
134 |
$ga_settings = $this->options; // Assign the settings to the javascript include view
|
135 |
|
136 |
// Include the tracking view
|
137 |
-
if ( $this->
|
138 |
-
require( 'views/tracking-debug.php' );
|
139 |
-
}
|
140 |
-
else {
|
141 |
require( 'views/tracking-universal.php' );
|
142 |
}
|
143 |
}
|
144 |
else {
|
145 |
-
|
146 |
}
|
147 |
}
|
148 |
|
82 |
$gaq_push[] = "'set', 'anonymizeIp', true";
|
83 |
}
|
84 |
|
85 |
+
/**
|
86 |
+
* Filter: 'yst_ga_filter_push_vars' - Allow changing the $gaq_push variables before scripts are required.
|
87 |
+
*
|
88 |
+
* @api array
|
89 |
+
*/
|
90 |
+
if ( has_filter( 'yst_ga_filter_push_vars' ) && $value_to_push = apply_filters( 'yst_ga_filter_push_vars', $gaq_push ) ) {
|
91 |
+
$gaq_push[] = $value_to_push;
|
92 |
+
}
|
93 |
+
|
94 |
// add demographics
|
95 |
if ( $this->options['demographics'] ) {
|
96 |
$gaq_push[] = "'require', 'displayfeatures'";
|
143 |
$ga_settings = $this->options; // Assign the settings to the javascript include view
|
144 |
|
145 |
// Include the tracking view
|
146 |
+
if ( ! $this->debug_mode() ) {
|
|
|
|
|
|
|
147 |
require( 'views/tracking-universal.php' );
|
148 |
}
|
149 |
}
|
150 |
else {
|
151 |
+
$this->disabled_usergroup();
|
152 |
}
|
153 |
}
|
154 |
|
frontend/views/tracking-usergroup.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package GoogleAnalytics\Frontend
|
4 |
-
*/
|
5 |
-
|
6 |
-
?>
|
7 |
-
<!-- This site uses the Google Analytics by Yoast plugin v<?php echo GAWP_VERSION; ?> - https://yoast.com/wordpress/plugins/google-analytics/ -->
|
8 |
-
<!-- @Webmaster, normally you will find the Google Analytics tracking code here, but you are in the disabled user groups. Change that in Analytics -> Settings (Ignore usergroups) -->
|
9 |
-
<!-- / Google Analytics by Yoast -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
googleanalytics.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* Plugin URI: https://yoast.com/wordpress/plugins/google-analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=wpgaplugin&utm_content=v504
|
10 |
* Description: This plugin makes it simple to add Google Analytics to your WordPress site, adding lots of features, e.g. error page, search result and automatic outgoing links and download tracking.
|
11 |
* Author: Team Yoast
|
12 |
-
* Version: 5.4.
|
13 |
* Requires at least: 3.8
|
14 |
* Author URI: https://yoast.com/
|
15 |
* License: GPL v3
|
@@ -35,7 +35,7 @@
|
|
35 |
|
36 |
// This plugin was originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics, but has since been rewritten and refactored multiple times.
|
37 |
|
38 |
-
define( 'GAWP_VERSION', '5.4.
|
39 |
|
40 |
define( 'GAWP_FILE', __FILE__ );
|
41 |
|
9 |
* Plugin URI: https://yoast.com/wordpress/plugins/google-analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=wpgaplugin&utm_content=v504
|
10 |
* Description: This plugin makes it simple to add Google Analytics to your WordPress site, adding lots of features, e.g. error page, search result and automatic outgoing links and download tracking.
|
11 |
* Author: Team Yoast
|
12 |
+
* Version: 5.4.3
|
13 |
* Requires at least: 3.8
|
14 |
* Author URI: https://yoast.com/
|
15 |
* License: GPL v3
|
35 |
|
36 |
// This plugin was originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics, but has since been rewritten and refactored multiple times.
|
37 |
|
38 |
+
define( 'GAWP_VERSION', '5.4.3' );
|
39 |
|
40 |
define( 'GAWP_FILE', __FILE__ );
|
41 |
|
languages/google-analytics-for-wordpress-ca.mo
ADDED
Binary file
|
languages/google-analytics-for-wordpress-da_DK.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress-de_DE.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress-en_AU.mo
ADDED
Binary file
|
languages/google-analytics-for-wordpress-en_GB.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress-es_ES.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress-es_MX.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress-fr_FR.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress-he_IL.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress-it_IT.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress-ja.mo
ADDED
Binary file
|
languages/google-analytics-for-wordpress-nb_NO.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress-nl_NL.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress-pl_PL.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress-pt_BR.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress-pt_PT.mo
ADDED
Binary file
|
languages/google-analytics-for-wordpress-ru_RU.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress-sv_SE.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress-tr_TR.mo
CHANGED
Binary file
|
languages/google-analytics-for-wordpress.pot
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
# This file is distributed under the GPL v3.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Google Analytics by Yoast 5.4.
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://github.com/yoast/google-analytics-for-wordpress/issues\n"
|
8 |
-
"POT-Creation-Date: 2015-
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -25,7 +25,7 @@ msgstr ""
|
|
25 |
"X-Poedit-Bookmarks: \n"
|
26 |
"X-Textdomain-Support: yes\n"
|
27 |
|
28 |
-
#: admin/class-admin-form.php:46 admin/pages/settings.php:
|
29 |
msgid "Save changes"
|
30 |
msgstr ""
|
31 |
|
@@ -45,7 +45,7 @@ msgstr ""
|
|
45 |
msgid "Dashboard"
|
46 |
msgstr ""
|
47 |
|
48 |
-
#: admin/class-admin-menu.php:242 admin/class-admin.php:
|
49 |
#: admin/pages/settings.php:10
|
50 |
msgid "Settings"
|
51 |
msgstr ""
|
@@ -55,60 +55,68 @@ msgstr ""
|
|
55 |
msgid "Extensions"
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: admin/class-admin.php:
|
59 |
-
msgid "
|
|
|
|
|
|
|
|
|
60 |
msgstr ""
|
61 |
|
62 |
-
#: admin/class-admin.php:
|
63 |
msgid "Settings saved."
|
64 |
msgstr ""
|
65 |
|
66 |
-
#: admin/class-admin.php:
|
67 |
msgid "There were no changes to save, please try again."
|
68 |
msgstr ""
|
69 |
|
70 |
-
#: admin/class-admin.php:
|
|
|
|
|
|
|
|
|
71 |
msgid "FAQ"
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: admin/class-admin.php:
|
75 |
msgid ""
|
76 |
"If you want to track custom dimensions like page views per author or post "
|
77 |
"type, you should upgrade to the %1$spremium version of Google Analytics by "
|
78 |
"Yoast%2$s."
|
79 |
msgstr ""
|
80 |
|
81 |
-
#: admin/class-admin.php:
|
82 |
msgid ""
|
83 |
"This will also give you email access to the support team at Yoast, who will "
|
84 |
"provide support on the plugin 24/7."
|
85 |
msgstr ""
|
86 |
|
87 |
-
#: admin/class-admin.php:
|
88 |
msgid "Event"
|
89 |
msgstr ""
|
90 |
|
91 |
-
#: admin/class-admin.php:
|
92 |
msgid "Pageview"
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: admin/class-admin.php:
|
96 |
msgid "Just the domain"
|
97 |
msgstr ""
|
98 |
|
99 |
-
#: admin/class-admin.php:
|
100 |
msgid "Full links"
|
101 |
msgstr ""
|
102 |
|
103 |
-
#: admin/class-admin.php:
|
104 |
msgid "Debug information"
|
105 |
msgstr ""
|
106 |
|
107 |
-
#: admin/class-admin.php:
|
108 |
msgid "Google Analytics by Yoast Premium"
|
109 |
msgstr ""
|
110 |
|
111 |
-
#: admin/class-admin.php:
|
112 |
msgid ""
|
113 |
"The premium version of Google Analytics by Yoast with more features and "
|
114 |
"support."
|
@@ -118,27 +126,27 @@ msgstr ""
|
|
118 |
msgid "Google Analytics by Yoast"
|
119 |
msgstr ""
|
120 |
|
121 |
-
#: admin/class-admin.php:
|
122 |
msgid "eCommerce tracking"
|
123 |
msgstr ""
|
124 |
|
125 |
-
#: admin/class-admin.php:
|
126 |
msgid ""
|
127 |
"Track your eCommerce data and transactions with this eCommerce extension "
|
128 |
"for Google Analytics."
|
129 |
msgstr ""
|
130 |
|
131 |
-
#: admin/class-google-analytics.php:
|
132 |
msgid "Please configure your %sGoogle Analytics settings%s!"
|
133 |
msgstr ""
|
134 |
|
135 |
-
#: admin/class-google-analytics.php:
|
136 |
msgid ""
|
137 |
"It seems the authentication for the plugin has expired, please "
|
138 |
"%sre-authenticate%s with Google Analytics to allow the plugin to fetch data."
|
139 |
msgstr ""
|
140 |
|
141 |
-
#: admin/class-google-analytics.php:
|
142 |
msgid ""
|
143 |
"Data is not up-to-date, there was an error in retrieving the data from "
|
144 |
"Google Analytics. This error could be caused by several issues. If the "
|
@@ -462,91 +470,100 @@ msgid ""
|
|
462 |
"fetching the latest analytics data."
|
463 |
msgstr ""
|
464 |
|
465 |
-
#: admin/pages/settings.php:
|
466 |
msgid "Universal settings"
|
467 |
msgstr ""
|
468 |
|
469 |
-
#: admin/pages/settings.php:
|
470 |
msgid "Enable Universal tracking"
|
471 |
msgstr ""
|
472 |
|
473 |
-
#: admin/pages/settings.php:
|
474 |
msgid ""
|
475 |
"First enable Universal tracking in your Google Analytics account. Please "
|
476 |
"read %1$sthis guide%2$s to learn how to do that."
|
477 |
msgstr ""
|
478 |
|
479 |
-
#: admin/pages/settings.php:
|
480 |
-
msgid "Enable Demographics and
|
481 |
msgstr ""
|
482 |
|
483 |
-
#: admin/pages/settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
msgid ""
|
485 |
-
"
|
486 |
-
"
|
487 |
-
"base%2$s about
|
|
|
|
|
488 |
msgstr ""
|
489 |
|
490 |
-
#: admin/pages/settings.php:
|
491 |
msgid "Enhanced Link Attribution"
|
492 |
msgstr ""
|
493 |
|
494 |
-
#: admin/pages/settings.php:
|
495 |
msgid "Add %1$sEnhanced Link Attribution%2$s to your tracking code."
|
496 |
msgstr ""
|
497 |
|
498 |
-
#: admin/pages/settings.php:
|
499 |
msgid "Advanced settings"
|
500 |
msgstr ""
|
501 |
|
502 |
-
#: admin/pages/settings.php:
|
503 |
msgid "Track downloads as"
|
504 |
msgstr ""
|
505 |
|
506 |
-
#: admin/pages/settings.php:
|
507 |
msgid ""
|
508 |
"Not recommended, as this would skew your statistics, but it does make it "
|
509 |
"possible to track downloads as goals."
|
510 |
msgstr ""
|
511 |
|
512 |
-
#: admin/pages/settings.php:
|
513 |
msgid "Extensions of files to track as downloads"
|
514 |
msgstr ""
|
515 |
|
516 |
-
#: admin/pages/settings.php:
|
517 |
msgid "Track full URL of outbound clicks or just the domain"
|
518 |
msgstr ""
|
519 |
|
520 |
-
#: admin/pages/settings.php:
|
521 |
msgid "Subdomain tracking"
|
522 |
msgstr ""
|
523 |
|
524 |
-
#: admin/pages/settings.php:
|
525 |
msgid ""
|
526 |
"This allows you to set the domain that's set by %1$s for tracking "
|
527 |
"subdomains.<br/>If empty, this will not be set."
|
528 |
msgstr ""
|
529 |
|
530 |
-
#: admin/pages/settings.php:
|
531 |
msgid "Set path for internal links to track as outbound links"
|
532 |
msgstr ""
|
533 |
|
534 |
-
#: admin/pages/settings.php:
|
535 |
msgid ""
|
536 |
"If you want to track all internal links that begin with %1$s, enter %1$s in "
|
537 |
"the box above. If you have multiple prefixes you can separate them with "
|
538 |
"comma's: %2$s"
|
539 |
msgstr ""
|
540 |
|
541 |
-
#: admin/pages/settings.php:
|
542 |
msgid "Label for those links"
|
543 |
msgstr ""
|
544 |
|
545 |
-
#: admin/pages/settings.php:
|
546 |
msgid "Tag links in RSS feed with campaign variables"
|
547 |
msgstr ""
|
548 |
|
549 |
-
#: admin/pages/settings.php:
|
550 |
msgid ""
|
551 |
"Do not use this feature if you use FeedBurner, as FeedBurner can do this "
|
552 |
"automatically and better than this plugin can. Check <a "
|
@@ -555,60 +572,60 @@ msgid ""
|
|
555 |
"enable this feature in FeedBurner."
|
556 |
msgstr ""
|
557 |
|
558 |
-
#: admin/pages/settings.php:
|
559 |
msgid "Allow anchor"
|
560 |
msgstr ""
|
561 |
|
562 |
-
#: admin/pages/settings.php:
|
563 |
msgid ""
|
564 |
"This adds a %1$s call to your tracking code, and makes RSS link tagging use "
|
565 |
"a %2$s as well."
|
566 |
msgstr ""
|
567 |
|
568 |
-
#: admin/pages/settings.php:
|
569 |
msgid "Add <code>_setAllowLinker</code>"
|
570 |
msgstr ""
|
571 |
|
572 |
-
#: admin/pages/settings.php:
|
573 |
msgid ""
|
574 |
"This adds a %1$s call to your tracking code, allowing you to use %2$s and "
|
575 |
"related functions."
|
576 |
msgstr ""
|
577 |
|
578 |
-
#: admin/pages/settings.php:
|
579 |
msgid "Custom code"
|
580 |
msgstr ""
|
581 |
|
582 |
-
#: admin/pages/settings.php:
|
583 |
msgid ""
|
584 |
"Not for the average user: this allows you to add a line of code, to be "
|
585 |
"added before the %1$s call."
|
586 |
msgstr ""
|
587 |
|
588 |
-
#: admin/pages/settings.php:
|
589 |
msgid "Custom dimensions"
|
590 |
msgstr ""
|
591 |
|
592 |
-
#: admin/pages/settings.php:
|
593 |
msgid "Debug"
|
594 |
msgstr ""
|
595 |
|
596 |
-
#: admin/pages/settings.php:
|
597 |
msgid ""
|
598 |
"If you want to confirm that tracking on your blog is working as it should, "
|
599 |
"enable this option and check the console of your browser. Be absolutely "
|
600 |
"sure to disable debugging afterwards, as it is slower than normal tracking."
|
601 |
msgstr ""
|
602 |
|
603 |
-
#: admin/pages/settings.php:
|
604 |
msgid "<strong>Note</strong> the debugging is only loaded for administrators."
|
605 |
msgstr ""
|
606 |
|
607 |
-
#: admin/pages/settings.php:
|
608 |
msgid "Enable debug mode"
|
609 |
msgstr ""
|
610 |
|
611 |
-
#: admin/pages/settings.php:
|
612 |
msgid "Select the users to ignore"
|
613 |
msgstr ""
|
614 |
|
@@ -620,6 +637,38 @@ msgstr ""
|
|
620 |
msgid "Upgrade to Google Analytics By Yoast Premium »"
|
621 |
msgstr ""
|
622 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
623 |
#: googleanalytics.php:79
|
624 |
msgid ""
|
625 |
"The Standard PHP Library (SPL) extension seem to be unavailable. Please ask "
|
2 |
# This file is distributed under the GPL v3.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Google Analytics by Yoast 5.4.3\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://github.com/yoast/google-analytics-for-wordpress/issues\n"
|
8 |
+
"POT-Creation-Date: 2015-07-15 13:53:50+00:00\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
25 |
"X-Poedit-Bookmarks: \n"
|
26 |
"X-Textdomain-Support: yes\n"
|
27 |
|
28 |
+
#: admin/class-admin-form.php:46 admin/pages/settings.php:174
|
29 |
msgid "Save changes"
|
30 |
msgstr ""
|
31 |
|
45 |
msgid "Dashboard"
|
46 |
msgstr ""
|
47 |
|
48 |
+
#: admin/class-admin-menu.php:242 admin/class-admin.php:310
|
49 |
#: admin/pages/settings.php:10
|
50 |
msgid "Settings"
|
51 |
msgstr ""
|
55 |
msgid "Extensions"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: admin/class-admin.php:81
|
59 |
+
msgid ""
|
60 |
+
"Yoast plugins share some code between them to make your site faster. As a "
|
61 |
+
"result of that, we need all Yoast plugins to be up to date. We've detected "
|
62 |
+
"this isn't the case, so please update the Yoast plugins that aren't up to "
|
63 |
+
"date yet."
|
64 |
msgstr ""
|
65 |
|
66 |
+
#: admin/class-admin.php:118
|
67 |
msgid "Settings saved."
|
68 |
msgstr ""
|
69 |
|
70 |
+
#: admin/class-admin.php:125
|
71 |
msgid "There were no changes to save, please try again."
|
72 |
msgstr ""
|
73 |
|
74 |
+
#: admin/class-admin.php:169
|
75 |
+
msgid "The UA code needs to follow UA-XXXXXXXX-X format."
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#: admin/class-admin.php:307
|
79 |
msgid "FAQ"
|
80 |
msgstr ""
|
81 |
|
82 |
+
#: admin/class-admin.php:322
|
83 |
msgid ""
|
84 |
"If you want to track custom dimensions like page views per author or post "
|
85 |
"type, you should upgrade to the %1$spremium version of Google Analytics by "
|
86 |
"Yoast%2$s."
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: admin/class-admin.php:324
|
90 |
msgid ""
|
91 |
"This will also give you email access to the support team at Yoast, who will "
|
92 |
"provide support on the plugin 24/7."
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: admin/class-admin.php:462
|
96 |
msgid "Event"
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: admin/class-admin.php:463
|
100 |
msgid "Pageview"
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: admin/class-admin.php:474
|
104 |
msgid "Just the domain"
|
105 |
msgstr ""
|
106 |
|
107 |
+
#: admin/class-admin.php:475
|
108 |
msgid "Full links"
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: admin/class-admin.php:495
|
112 |
msgid "Debug information"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: admin/class-admin.php:544
|
116 |
msgid "Google Analytics by Yoast Premium"
|
117 |
msgstr ""
|
118 |
|
119 |
+
#: admin/class-admin.php:545
|
120 |
msgid ""
|
121 |
"The premium version of Google Analytics by Yoast with more features and "
|
122 |
"support."
|
126 |
msgid "Google Analytics by Yoast"
|
127 |
msgstr ""
|
128 |
|
129 |
+
#: admin/class-admin.php:550
|
130 |
msgid "eCommerce tracking"
|
131 |
msgstr ""
|
132 |
|
133 |
+
#: admin/class-admin.php:551
|
134 |
msgid ""
|
135 |
"Track your eCommerce data and transactions with this eCommerce extension "
|
136 |
"for Google Analytics."
|
137 |
msgstr ""
|
138 |
|
139 |
+
#: admin/class-google-analytics.php:323
|
140 |
msgid "Please configure your %sGoogle Analytics settings%s!"
|
141 |
msgstr ""
|
142 |
|
143 |
+
#: admin/class-google-analytics.php:336
|
144 |
msgid ""
|
145 |
"It seems the authentication for the plugin has expired, please "
|
146 |
"%sre-authenticate%s with Google Analytics to allow the plugin to fetch data."
|
147 |
msgstr ""
|
148 |
|
149 |
+
#: admin/class-google-analytics.php:349
|
150 |
msgid ""
|
151 |
"Data is not up-to-date, there was an error in retrieving the data from "
|
152 |
"Google Analytics. This error could be caused by several issues. If the "
|
470 |
"fetching the latest analytics data."
|
471 |
msgstr ""
|
472 |
|
473 |
+
#: admin/pages/settings.php:109
|
474 |
msgid "Universal settings"
|
475 |
msgstr ""
|
476 |
|
477 |
+
#: admin/pages/settings.php:110
|
478 |
msgid "Enable Universal tracking"
|
479 |
msgstr ""
|
480 |
|
481 |
+
#: admin/pages/settings.php:110
|
482 |
msgid ""
|
483 |
"First enable Universal tracking in your Google Analytics account. Please "
|
484 |
"read %1$sthis guide%2$s to learn how to do that."
|
485 |
msgstr ""
|
486 |
|
487 |
+
#: admin/pages/settings.php:113
|
488 |
+
msgid "Enable Demographics and Interests Reports for Remarketing and Advertising"
|
489 |
msgstr ""
|
490 |
|
491 |
+
#: admin/pages/settings.php:115
|
492 |
+
msgid ""
|
493 |
+
"Note that usage of this function is affected by privacy and cookie laws "
|
494 |
+
"around the world. Be sure to follow the laws that affect your target "
|
495 |
+
"audience."
|
496 |
+
msgstr ""
|
497 |
+
|
498 |
+
#: admin/pages/settings.php:118
|
499 |
msgid ""
|
500 |
+
"Check this setting to add the Demographics and Remarketing features to your "
|
501 |
+
"Google Analytics tracking code. We've written an article in our "
|
502 |
+
"%1$sknowledge base%2$s about Demographics and Interest reports. For more "
|
503 |
+
"information about Remarketing, we refer you to %3$sGoogle's "
|
504 |
+
"documentation%2$s."
|
505 |
msgstr ""
|
506 |
|
507 |
+
#: admin/pages/settings.php:124
|
508 |
msgid "Enhanced Link Attribution"
|
509 |
msgstr ""
|
510 |
|
511 |
+
#: admin/pages/settings.php:124
|
512 |
msgid "Add %1$sEnhanced Link Attribution%2$s to your tracking code."
|
513 |
msgstr ""
|
514 |
|
515 |
+
#: admin/pages/settings.php:134
|
516 |
msgid "Advanced settings"
|
517 |
msgstr ""
|
518 |
|
519 |
+
#: admin/pages/settings.php:135
|
520 |
msgid "Track downloads as"
|
521 |
msgstr ""
|
522 |
|
523 |
+
#: admin/pages/settings.php:135
|
524 |
msgid ""
|
525 |
"Not recommended, as this would skew your statistics, but it does make it "
|
526 |
"possible to track downloads as goals."
|
527 |
msgstr ""
|
528 |
|
529 |
+
#: admin/pages/settings.php:136
|
530 |
msgid "Extensions of files to track as downloads"
|
531 |
msgstr ""
|
532 |
|
533 |
+
#: admin/pages/settings.php:137
|
534 |
msgid "Track full URL of outbound clicks or just the domain"
|
535 |
msgstr ""
|
536 |
|
537 |
+
#: admin/pages/settings.php:138
|
538 |
msgid "Subdomain tracking"
|
539 |
msgstr ""
|
540 |
|
541 |
+
#: admin/pages/settings.php:138
|
542 |
msgid ""
|
543 |
"This allows you to set the domain that's set by %1$s for tracking "
|
544 |
"subdomains.<br/>If empty, this will not be set."
|
545 |
msgstr ""
|
546 |
|
547 |
+
#: admin/pages/settings.php:140
|
548 |
msgid "Set path for internal links to track as outbound links"
|
549 |
msgstr ""
|
550 |
|
551 |
+
#: admin/pages/settings.php:140
|
552 |
msgid ""
|
553 |
"If you want to track all internal links that begin with %1$s, enter %1$s in "
|
554 |
"the box above. If you have multiple prefixes you can separate them with "
|
555 |
"comma's: %2$s"
|
556 |
msgstr ""
|
557 |
|
558 |
+
#: admin/pages/settings.php:141
|
559 |
msgid "Label for those links"
|
560 |
msgstr ""
|
561 |
|
562 |
+
#: admin/pages/settings.php:143
|
563 |
msgid "Tag links in RSS feed with campaign variables"
|
564 |
msgstr ""
|
565 |
|
566 |
+
#: admin/pages/settings.php:143
|
567 |
msgid ""
|
568 |
"Do not use this feature if you use FeedBurner, as FeedBurner can do this "
|
569 |
"automatically and better than this plugin can. Check <a "
|
572 |
"enable this feature in FeedBurner."
|
573 |
msgstr ""
|
574 |
|
575 |
+
#: admin/pages/settings.php:144
|
576 |
msgid "Allow anchor"
|
577 |
msgstr ""
|
578 |
|
579 |
+
#: admin/pages/settings.php:144
|
580 |
msgid ""
|
581 |
"This adds a %1$s call to your tracking code, and makes RSS link tagging use "
|
582 |
"a %2$s as well."
|
583 |
msgstr ""
|
584 |
|
585 |
+
#: admin/pages/settings.php:145
|
586 |
msgid "Add <code>_setAllowLinker</code>"
|
587 |
msgstr ""
|
588 |
|
589 |
+
#: admin/pages/settings.php:145
|
590 |
msgid ""
|
591 |
"This adds a %1$s call to your tracking code, allowing you to use %2$s and "
|
592 |
"related functions."
|
593 |
msgstr ""
|
594 |
|
595 |
+
#: admin/pages/settings.php:146
|
596 |
msgid "Custom code"
|
597 |
msgstr ""
|
598 |
|
599 |
+
#: admin/pages/settings.php:146
|
600 |
msgid ""
|
601 |
"Not for the average user: this allows you to add a line of code, to be "
|
602 |
"added before the %1$s call."
|
603 |
msgstr ""
|
604 |
|
605 |
+
#: admin/pages/settings.php:156
|
606 |
msgid "Custom dimensions"
|
607 |
msgstr ""
|
608 |
|
609 |
+
#: admin/pages/settings.php:163
|
610 |
msgid "Debug"
|
611 |
msgstr ""
|
612 |
|
613 |
+
#: admin/pages/settings.php:166
|
614 |
msgid ""
|
615 |
"If you want to confirm that tracking on your blog is working as it should, "
|
616 |
"enable this option and check the console of your browser. Be absolutely "
|
617 |
"sure to disable debugging afterwards, as it is slower than normal tracking."
|
618 |
msgstr ""
|
619 |
|
620 |
+
#: admin/pages/settings.php:167
|
621 |
msgid "<strong>Note</strong> the debugging is only loaded for administrators."
|
622 |
msgstr ""
|
623 |
|
624 |
+
#: admin/pages/settings.php:169
|
625 |
msgid "Enable debug mode"
|
626 |
msgstr ""
|
627 |
|
628 |
+
#: admin/pages/settings.php:183
|
629 |
msgid "Select the users to ignore"
|
630 |
msgstr ""
|
631 |
|
637 |
msgid "Upgrade to Google Analytics By Yoast Premium »"
|
638 |
msgstr ""
|
639 |
|
640 |
+
#: frontend/abstract-class-tracking.php:458
|
641 |
+
#: frontend/abstract-class-tracking.php:479
|
642 |
+
msgid "This site uses the %1$s plugin version %2$s"
|
643 |
+
msgstr ""
|
644 |
+
|
645 |
+
#: frontend/abstract-class-tracking.php:461
|
646 |
+
msgid ""
|
647 |
+
"@Webmaster, normally you will find the Google Analytics tracking code here, "
|
648 |
+
"but you are in the disabled user groups. To change this, navigate to "
|
649 |
+
"Analytics -> Settings (Ignore usergroups)"
|
650 |
+
msgstr ""
|
651 |
+
|
652 |
+
#: frontend/abstract-class-tracking.php:464
|
653 |
+
msgid ""
|
654 |
+
"Normally you will find the Google Analytics tracking code here, but the "
|
655 |
+
"webmaster disabled your user group."
|
656 |
+
msgstr ""
|
657 |
+
|
658 |
+
#: frontend/abstract-class-tracking.php:482
|
659 |
+
msgid ""
|
660 |
+
"@Webmaster, normally you will find the Google Analytics tracking code here, "
|
661 |
+
"but the Debug Mode is enabled. To change this, navigate to Analytics -> "
|
662 |
+
"Settings -> (Tab) Debug Mode and disable Debug Mode to enable tracking of "
|
663 |
+
"your site."
|
664 |
+
msgstr ""
|
665 |
+
|
666 |
+
#: frontend/abstract-class-tracking.php:485
|
667 |
+
msgid ""
|
668 |
+
"Normally you will find the Google Analytics tracking code here, but the "
|
669 |
+
"webmaster has enabled the Debug Mode."
|
670 |
+
msgstr ""
|
671 |
+
|
672 |
#: googleanalytics.php:79
|
673 |
msgid ""
|
674 |
"The Standard PHP Library (SPL) extension seem to be unavailable. Please ask "
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://yoast.com/donate/
|
|
4 |
Tags: analytics, google analytics, statistics, tracking, stats, google, yoast
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.2
|
7 |
-
Stable tag: 5.4.
|
8 |
License: GPL v3
|
9 |
|
10 |
Track your WordPress site easily with the latest tracking codes and lots added data for search result pages and error pages.
|
@@ -51,6 +51,19 @@ This section describes how to install the plugin and get it working.
|
|
51 |
|
52 |
== Changelog ==
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
= 5.4.2 =
|
55 |
|
56 |
Release Date: April 21th, 2015
|
4 |
Tags: analytics, google analytics, statistics, tracking, stats, google, yoast
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.2
|
7 |
+
Stable tag: 5.4.3
|
8 |
License: GPL v3
|
9 |
|
10 |
Track your WordPress site easily with the latest tracking codes and lots added data for search result pages and error pages.
|
51 |
|
52 |
== Changelog ==
|
53 |
|
54 |
+
= 5.4.3 =
|
55 |
+
|
56 |
+
Release Date: July 15th, 2015
|
57 |
+
|
58 |
+
* Enhancements:
|
59 |
+
* Improved form labels for remarketing / demographics and interests reports.
|
60 |
+
* Improved the notice that is shown in the head to non-admin users when their usergroup has been excluded from tracking or debug mode is enabled.
|
61 |
+
* Adds 4 translations: ca, en_AU, ja, pt_PT
|
62 |
+
|
63 |
+
* Bugfixes:
|
64 |
+
* Fixes a bug where the plugin would fetch a refresh token from Google on every page request.
|
65 |
+
* Fixes an undefined index notice which was triggered when running WordPress using WP CLI.
|
66 |
+
|
67 |
= 5.4.2 =
|
68 |
|
69 |
Release Date: April 21th, 2015
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit189ed1846ee2aec45332df80bf6cc5f0::getLoader();
|
vendor/autoload_52.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInitfb02493b76c5d07da72bd2ffb8842c1b::getLoader();
|
vendor/composer/ClassLoader.php
CHANGED
@@ -351,7 +351,7 @@ class ClassLoader
|
|
351 |
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
352 |
if (0 === strpos($class, $prefix)) {
|
353 |
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
354 |
-
if (
|
355 |
return $file;
|
356 |
}
|
357 |
}
|
@@ -361,7 +361,7 @@ class ClassLoader
|
|
361 |
|
362 |
// PSR-4 fallback dirs
|
363 |
foreach ($this->fallbackDirsPsr4 as $dir) {
|
364 |
-
if (
|
365 |
return $file;
|
366 |
}
|
367 |
}
|
@@ -380,7 +380,7 @@ class ClassLoader
|
|
380 |
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
381 |
if (0 === strpos($class, $prefix)) {
|
382 |
foreach ($dirs as $dir) {
|
383 |
-
if (
|
384 |
return $file;
|
385 |
}
|
386 |
}
|
@@ -390,7 +390,7 @@ class ClassLoader
|
|
390 |
|
391 |
// PSR-0 fallback dirs
|
392 |
foreach ($this->fallbackDirsPsr0 as $dir) {
|
393 |
-
if (
|
394 |
return $file;
|
395 |
}
|
396 |
}
|
351 |
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
352 |
if (0 === strpos($class, $prefix)) {
|
353 |
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
354 |
+
if (is_file($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
355 |
return $file;
|
356 |
}
|
357 |
}
|
361 |
|
362 |
// PSR-4 fallback dirs
|
363 |
foreach ($this->fallbackDirsPsr4 as $dir) {
|
364 |
+
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
365 |
return $file;
|
366 |
}
|
367 |
}
|
380 |
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
381 |
if (0 === strpos($class, $prefix)) {
|
382 |
foreach ($dirs as $dir) {
|
383 |
+
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
384 |
return $file;
|
385 |
}
|
386 |
}
|
390 |
|
391 |
// PSR-0 fallback dirs
|
392 |
foreach ($this->fallbackDirsPsr0 as $dir) {
|
393 |
+
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
394 |
return $file;
|
395 |
}
|
396 |
}
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -32,6 +32,7 @@ return array(
|
|
32 |
'Yoast_GA_Utils' => $baseDir . '/includes/class-utils.php',
|
33 |
'Yoast_Google_Analytics' => $baseDir . '/admin/class-google-analytics.php',
|
34 |
'Yoast_Google_Analytics_Notice' => $baseDir . '/admin/class-google-analytics.php',
|
|
|
35 |
'Yoast_License_Manager' => $vendorDir . '/yoast/license-manager/class-license-manager.php',
|
36 |
'Yoast_Plugin_License_Manager' => $vendorDir . '/yoast/license-manager/class-plugin-license-manager.php',
|
37 |
'Yoast_Plugin_Update_Manager' => $vendorDir . '/yoast/license-manager/class-plugin-update-manager.php',
|
32 |
'Yoast_GA_Utils' => $baseDir . '/includes/class-utils.php',
|
33 |
'Yoast_Google_Analytics' => $baseDir . '/admin/class-google-analytics.php',
|
34 |
'Yoast_Google_Analytics_Notice' => $baseDir . '/admin/class-google-analytics.php',
|
35 |
+
'Yoast_Googleanalytics_Reporting' => $baseDir . '/admin/class-googleanalytics-reporting.php',
|
36 |
'Yoast_License_Manager' => $vendorDir . '/yoast/license-manager/class-license-manager.php',
|
37 |
'Yoast_Plugin_License_Manager' => $vendorDir . '/yoast/license-manager/class-plugin-license-manager.php',
|
38 |
'Yoast_Plugin_Update_Manager' => $vendorDir . '/yoast/license-manager/class-plugin-update-manager.php',
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit0fe7c22694e734007efb95f4d7c175e6
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|
@@ -44,7 +44,7 @@ class ComposerAutoloaderInit0fe7c22694e734007efb95f4d7c175e6
|
|
44 |
}
|
45 |
}
|
46 |
|
47 |
-
function
|
48 |
{
|
49 |
require $file;
|
50 |
}
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit189ed1846ee2aec45332df80bf6cc5f0
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit189ed1846ee2aec45332df80bf6cc5f0', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit189ed1846ee2aec45332df80bf6cc5f0', 'loadClassLoader'));
|
25 |
|
26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|
44 |
}
|
45 |
}
|
46 |
|
47 |
+
function composerRequire189ed1846ee2aec45332df80bf6cc5f0($file)
|
48 |
{
|
49 |
require $file;
|
50 |
}
|
vendor/composer/autoload_real_52.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real_52.php generated by xrstf/composer-php52
|
4 |
|
5 |
-
class
|
6 |
private static $loader;
|
7 |
|
8 |
public static function loadClassLoader($class) {
|
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit3861ffcabcc3803294300fa066c879df {
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$vendorDir = dirname(dirname(__FILE__));
|
27 |
$baseDir = dirname($vendorDir);
|
2 |
|
3 |
// autoload_real_52.php generated by xrstf/composer-php52
|
4 |
|
5 |
+
class ComposerAutoloaderInitfb02493b76c5d07da72bd2ffb8842c1b {
|
6 |
private static $loader;
|
7 |
|
8 |
public static function loadClassLoader($class) {
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitfb02493b76c5d07da72bd2ffb8842c1b', 'loadClassLoader'), true /*, true */);
|
23 |
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitfb02493b76c5d07da72bd2ffb8842c1b', 'loadClassLoader'));
|
25 |
|
26 |
$vendorDir = dirname(dirname(__FILE__));
|
27 |
$baseDir = dirname($vendorDir);
|
vendor/composer/installed.json
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
[
|
2 |
{
|
3 |
"name": "composer/installers",
|
4 |
-
"version": "
|
5 |
-
"version_normalized": "
|
6 |
"source": {
|
7 |
"type": "git",
|
8 |
"url": "https://github.com/composer/installers.git",
|
9 |
-
"reference": "
|
10 |
},
|
11 |
"dist": {
|
12 |
"type": "zip",
|
13 |
-
"url": "https://api.github.com/repos/composer/installers/zipball/
|
14 |
-
"reference": "
|
15 |
"shasum": ""
|
16 |
},
|
17 |
"replace": {
|
@@ -22,7 +22,7 @@
|
|
22 |
"composer/composer": "1.0.*@dev",
|
23 |
"phpunit/phpunit": "4.1.*"
|
24 |
},
|
25 |
-
"time": "2015-
|
26 |
"type": "composer-installer",
|
27 |
"extra": {
|
28 |
"class": "Composer\\Installers\\Installer",
|
@@ -98,20 +98,20 @@
|
|
98 |
},
|
99 |
{
|
100 |
"name": "xrstf/composer-php52",
|
101 |
-
"version": "
|
102 |
-
"version_normalized": "
|
103 |
"source": {
|
104 |
"type": "hg",
|
105 |
"url": "https://bitbucket.org/xrstf/composer-php52",
|
106 |
-
"reference": "
|
107 |
},
|
108 |
"dist": {
|
109 |
"type": "zip",
|
110 |
-
"url": "https://bitbucket.org/xrstf/composer-php52/get/
|
111 |
-
"reference": "
|
112 |
"shasum": ""
|
113 |
},
|
114 |
-
"time": "2015-02-01
|
115 |
"type": "library",
|
116 |
"extra": {
|
117 |
"branch-alias": {
|
@@ -132,20 +132,20 @@
|
|
132 |
},
|
133 |
{
|
134 |
"name": "yoast/api-libs",
|
135 |
-
"version": "
|
136 |
-
"version_normalized": "
|
137 |
"source": {
|
138 |
"type": "git",
|
139 |
"url": "https://github.com/Yoast/api-libs.git",
|
140 |
-
"reference": "
|
141 |
},
|
142 |
"dist": {
|
143 |
"type": "zip",
|
144 |
-
"url": "https://api.github.com/repos/Yoast/api-libs/zipball/
|
145 |
-
"reference": "
|
146 |
"shasum": ""
|
147 |
},
|
148 |
-
"time": "2015-
|
149 |
"type": "library",
|
150 |
"installation-source": "dist",
|
151 |
"autoload": {
|
@@ -172,8 +172,8 @@
|
|
172 |
},
|
173 |
{
|
174 |
"name": "yoast/i18n-module",
|
175 |
-
"version": "
|
176 |
-
"version_normalized": "
|
177 |
"source": {
|
178 |
"type": "git",
|
179 |
"url": "https://github.com/Yoast/i18n-module.git",
|
@@ -185,7 +185,7 @@
|
|
185 |
"reference": "4648918ccf8bc6da12eadf57e4bece4829af29b3",
|
186 |
"shasum": ""
|
187 |
},
|
188 |
-
"time": "2015-04-
|
189 |
"type": "library",
|
190 |
"installation-source": "dist",
|
191 |
"autoload": {
|
@@ -212,8 +212,8 @@
|
|
212 |
},
|
213 |
{
|
214 |
"name": "yoast/license-manager",
|
215 |
-
"version": "
|
216 |
-
"version_normalized": "
|
217 |
"source": {
|
218 |
"type": "git",
|
219 |
"url": "https://github.com/Yoast/License-Manager.git",
|
1 |
[
|
2 |
{
|
3 |
"name": "composer/installers",
|
4 |
+
"version": "v1.0.21",
|
5 |
+
"version_normalized": "1.0.21.0",
|
6 |
"source": {
|
7 |
"type": "git",
|
8 |
"url": "https://github.com/composer/installers.git",
|
9 |
+
"reference": "d64e23fce42a4063d63262b19b8e7c0f3b5e4c45"
|
10 |
},
|
11 |
"dist": {
|
12 |
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/composer/installers/zipball/d64e23fce42a4063d63262b19b8e7c0f3b5e4c45",
|
14 |
+
"reference": "d64e23fce42a4063d63262b19b8e7c0f3b5e4c45",
|
15 |
"shasum": ""
|
16 |
},
|
17 |
"replace": {
|
22 |
"composer/composer": "1.0.*@dev",
|
23 |
"phpunit/phpunit": "4.1.*"
|
24 |
},
|
25 |
+
"time": "2015-02-18 17:17:01",
|
26 |
"type": "composer-installer",
|
27 |
"extra": {
|
28 |
"class": "Composer\\Installers\\Installer",
|
98 |
},
|
99 |
{
|
100 |
"name": "xrstf/composer-php52",
|
101 |
+
"version": "v1.0.17",
|
102 |
+
"version_normalized": "1.0.17.0",
|
103 |
"source": {
|
104 |
"type": "hg",
|
105 |
"url": "https://bitbucket.org/xrstf/composer-php52",
|
106 |
+
"reference": "70b853668d6c3f97b63dafcfaeebb622bf08fd30"
|
107 |
},
|
108 |
"dist": {
|
109 |
"type": "zip",
|
110 |
+
"url": "https://bitbucket.org/xrstf/composer-php52/get/70b853668d6c3f97b63dafcfaeebb622bf08fd30.zip",
|
111 |
+
"reference": "70b853668d6c3f97b63dafcfaeebb622bf08fd30",
|
112 |
"shasum": ""
|
113 |
},
|
114 |
+
"time": "2015-02-01 14:28:15",
|
115 |
"type": "library",
|
116 |
"extra": {
|
117 |
"branch-alias": {
|
132 |
},
|
133 |
{
|
134 |
"name": "yoast/api-libs",
|
135 |
+
"version": "2.0",
|
136 |
+
"version_normalized": "2.0.0.0",
|
137 |
"source": {
|
138 |
"type": "git",
|
139 |
"url": "https://github.com/Yoast/api-libs.git",
|
140 |
+
"reference": "e7361081a1d6ae79c0b96c8363379435ea736ef8"
|
141 |
},
|
142 |
"dist": {
|
143 |
"type": "zip",
|
144 |
+
"url": "https://api.github.com/repos/Yoast/api-libs/zipball/e7361081a1d6ae79c0b96c8363379435ea736ef8",
|
145 |
+
"reference": "e7361081a1d6ae79c0b96c8363379435ea736ef8",
|
146 |
"shasum": ""
|
147 |
},
|
148 |
+
"time": "2015-07-14 10:25:59",
|
149 |
"type": "library",
|
150 |
"installation-source": "dist",
|
151 |
"autoload": {
|
172 |
},
|
173 |
{
|
174 |
"name": "yoast/i18n-module",
|
175 |
+
"version": "1.0",
|
176 |
+
"version_normalized": "1.0.0.0",
|
177 |
"source": {
|
178 |
"type": "git",
|
179 |
"url": "https://github.com/Yoast/i18n-module.git",
|
185 |
"reference": "4648918ccf8bc6da12eadf57e4bece4829af29b3",
|
186 |
"shasum": ""
|
187 |
},
|
188 |
+
"time": "2015-04-22 12:48:39",
|
189 |
"type": "library",
|
190 |
"installation-source": "dist",
|
191 |
"autoload": {
|
212 |
},
|
213 |
{
|
214 |
"name": "yoast/license-manager",
|
215 |
+
"version": "1.2",
|
216 |
+
"version_normalized": "1.2.0.0",
|
217 |
"source": {
|
218 |
"type": "git",
|
219 |
"url": "https://github.com/Yoast/License-Manager.git",
|
vendor/composer/installers/README.md
CHANGED
@@ -36,7 +36,6 @@ is not needed to install packages with these frameworks:
|
|
36 |
| Aimeos | `aimeos-extension`
|
37 |
| Asgard | `asgard-module`<br>`asgard-theme`
|
38 |
| AGL | `agl-module`
|
39 |
-
| Bonefish | `bonefish-package`
|
40 |
| AnnotateCms | `annotatecms-module`<br>`annotatecms-component`<br>`annotatecms-service`
|
41 |
| Bitrix | `bitrix-module`<br>`bitrix-component`<br>`bitrix-theme`
|
42 |
| CakePHP 2+ | **`cakephp-plugin`**
|
@@ -56,7 +55,6 @@ is not needed to install packages with these frameworks:
|
|
56 |
| Hurad | `hurad-plugin`<br>`hurad-theme`
|
57 |
| Joomla | `joomla-component`<br>`joomla-module`<br>`joomla-template`<br>`joomla-plugin`<br>`joomla-library`
|
58 |
| Kirby | **`kirby-plugin`**
|
59 |
-
| KodiCMS | `kodicms-plugin`<br>`kodicms-media`
|
60 |
| Kohana | **`kohana-module`**
|
61 |
| Laravel | `laravel-library`
|
62 |
| Lithium | **`lithium-library`<br>`lithium-source`**
|
36 |
| Aimeos | `aimeos-extension`
|
37 |
| Asgard | `asgard-module`<br>`asgard-theme`
|
38 |
| AGL | `agl-module`
|
|
|
39 |
| AnnotateCms | `annotatecms-module`<br>`annotatecms-component`<br>`annotatecms-service`
|
40 |
| Bitrix | `bitrix-module`<br>`bitrix-component`<br>`bitrix-theme`
|
41 |
| CakePHP 2+ | **`cakephp-plugin`**
|
55 |
| Hurad | `hurad-plugin`<br>`hurad-theme`
|
56 |
| Joomla | `joomla-component`<br>`joomla-module`<br>`joomla-template`<br>`joomla-plugin`<br>`joomla-library`
|
57 |
| Kirby | **`kirby-plugin`**
|
|
|
58 |
| Kohana | **`kohana-module`**
|
59 |
| Laravel | `laravel-library`
|
60 |
| Lithium | **`lithium-library`<br>`lithium-source`**
|
vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Composer\Installers;
|
3 |
-
|
4 |
-
class BonefishInstaller extends BaseInstaller
|
5 |
-
{
|
6 |
-
protected $locations = array(
|
7 |
-
'package' => 'Packages/{$vendor}/{$name}/'
|
8 |
-
);
|
9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/composer/installers/src/Composer/Installers/Installer.php
CHANGED
@@ -18,7 +18,6 @@ class Installer extends LibraryInstaller
|
|
18 |
'agl' => 'AglInstaller',
|
19 |
'annotatecms' => 'AnnotateCmsInstaller',
|
20 |
'bitrix' => 'BitrixInstaller',
|
21 |
-
'bonefish' => 'BonefishInstaller',
|
22 |
'cakephp' => 'CakePHPInstaller',
|
23 |
'chef' => 'ChefInstaller',
|
24 |
'ccframework' => 'ClanCatsFrameworkInstaller',
|
@@ -36,7 +35,6 @@ class Installer extends LibraryInstaller
|
|
36 |
'hurad' => 'HuradInstaller',
|
37 |
'joomla' => 'JoomlaInstaller',
|
38 |
'kirby' => 'KirbyInstaller',
|
39 |
-
'kodicms' => 'KodiCMSInstaller',
|
40 |
'kohana' => 'KohanaInstaller',
|
41 |
'laravel' => 'LaravelInstaller',
|
42 |
'lithium' => 'LithiumInstaller',
|
@@ -69,7 +67,7 @@ class Installer extends LibraryInstaller
|
|
69 |
'wordpress' => 'WordPressInstaller',
|
70 |
'zend' => 'ZendInstaller',
|
71 |
'zikula' => 'ZikulaInstaller',
|
72 |
-
'prestashop' => 'PrestashopInstaller'
|
73 |
);
|
74 |
|
75 |
/**
|
18 |
'agl' => 'AglInstaller',
|
19 |
'annotatecms' => 'AnnotateCmsInstaller',
|
20 |
'bitrix' => 'BitrixInstaller',
|
|
|
21 |
'cakephp' => 'CakePHPInstaller',
|
22 |
'chef' => 'ChefInstaller',
|
23 |
'ccframework' => 'ClanCatsFrameworkInstaller',
|
35 |
'hurad' => 'HuradInstaller',
|
36 |
'joomla' => 'JoomlaInstaller',
|
37 |
'kirby' => 'KirbyInstaller',
|
|
|
38 |
'kohana' => 'KohanaInstaller',
|
39 |
'laravel' => 'LaravelInstaller',
|
40 |
'lithium' => 'LithiumInstaller',
|
67 |
'wordpress' => 'WordPressInstaller',
|
68 |
'zend' => 'ZendInstaller',
|
69 |
'zikula' => 'ZikulaInstaller',
|
70 |
+
'prestashop' => 'PrestashopInstaller',
|
71 |
);
|
72 |
|
73 |
/**
|
vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Composer\Installers;
|
3 |
-
|
4 |
-
class KodiCMSInstaller extends BaseInstaller
|
5 |
-
{
|
6 |
-
protected $locations = array(
|
7 |
-
'plugin' => 'cms/plugins/{$name}/',
|
8 |
-
'media' => 'cms/media/vendor/{$name}/'
|
9 |
-
);
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php
CHANGED
@@ -100,7 +100,7 @@ class CakePHPInstallerTest extends TestCase
|
|
100 |
|
101 |
$this->setCakephpVersion($rm, '~8.8');
|
102 |
$result = $installer->getLocations();
|
103 |
-
$this->
|
104 |
}
|
105 |
|
106 |
protected function setCakephpVersion($rm, $version) {
|
100 |
|
101 |
$this->setCakephpVersion($rm, '~8.8');
|
102 |
$result = $installer->getLocations();
|
103 |
+
$this->assertEquals('vendor/{$vendor}/{$name}/', $result['plugin']);
|
104 |
}
|
105 |
|
106 |
protected function setCakephpVersion($rm, $version) {
|
vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php
CHANGED
@@ -92,7 +92,6 @@ class InstallerTest extends TestCase
|
|
92 |
array('bitrix-module', true),
|
93 |
array('bitrix-component', true),
|
94 |
array('bitrix-theme', true),
|
95 |
-
array('bonefish-package', true),
|
96 |
array('cakephp', false),
|
97 |
array('cakephp-', false),
|
98 |
array('cakephp-app', false),
|
@@ -174,8 +173,6 @@ class InstallerTest extends TestCase
|
|
174 |
array('zend-library', true),
|
175 |
array('zikula-module', true),
|
176 |
array('zikula-theme', true),
|
177 |
-
array('kodicms-plugin', true),
|
178 |
-
array('kodicms-media', true),
|
179 |
);
|
180 |
}
|
181 |
|
@@ -208,7 +205,6 @@ class InstallerTest extends TestCase
|
|
208 |
array('bitrix-module', 'local/modules/my_module/', 'author/my_module'),
|
209 |
array('bitrix-component', 'local/components/my_component/', 'author/my_component'),
|
210 |
array('bitrix-theme', 'local/templates/my_theme/', 'author/my_theme'),
|
211 |
-
array('bonefish-package', 'Packages/bonefish/package/', 'bonefish/package'),
|
212 |
array('cakephp-plugin', 'Plugin/Ftp/', 'shama/ftp'),
|
213 |
array('chef-cookbook', 'Chef/mre/my_cookbook/', 'mre/my_cookbook'),
|
214 |
array('chef-role', 'Chef/roles/my_role/', 'mre/my_role'),
|
@@ -301,8 +297,6 @@ class InstallerTest extends TestCase
|
|
301 |
array('zend-extra', 'extras/library/zend_test/', 'shama/zend_test'),
|
302 |
array('zikula-module', 'modules/my-test_module/', 'my/test_module'),
|
303 |
array('zikula-theme', 'themes/my-test_theme/', 'my/test_theme'),
|
304 |
-
array('kodicms-media', 'cms/media/vendor/my_media/', 'shama/my_media'),
|
305 |
-
array('kodicms-plugin', 'cms/plugins/my_plugin/', 'shama/my_plugin'),
|
306 |
);
|
307 |
}
|
308 |
|
92 |
array('bitrix-module', true),
|
93 |
array('bitrix-component', true),
|
94 |
array('bitrix-theme', true),
|
|
|
95 |
array('cakephp', false),
|
96 |
array('cakephp-', false),
|
97 |
array('cakephp-app', false),
|
173 |
array('zend-library', true),
|
174 |
array('zikula-module', true),
|
175 |
array('zikula-theme', true),
|
|
|
|
|
176 |
);
|
177 |
}
|
178 |
|
205 |
array('bitrix-module', 'local/modules/my_module/', 'author/my_module'),
|
206 |
array('bitrix-component', 'local/components/my_component/', 'author/my_component'),
|
207 |
array('bitrix-theme', 'local/templates/my_theme/', 'author/my_theme'),
|
|
|
208 |
array('cakephp-plugin', 'Plugin/Ftp/', 'shama/ftp'),
|
209 |
array('chef-cookbook', 'Chef/mre/my_cookbook/', 'mre/my_cookbook'),
|
210 |
array('chef-role', 'Chef/roles/my_role/', 'mre/my_role'),
|
297 |
array('zend-extra', 'extras/library/zend_test/', 'shama/zend_test'),
|
298 |
array('zikula-module', 'modules/my-test_module/', 'my/test_module'),
|
299 |
array('zikula-theme', 'themes/my-test_theme/', 'my/test_theme'),
|
|
|
|
|
300 |
);
|
301 |
}
|
302 |
|
vendor/xrstf/composer-php52/.hg_archival.txt
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
repo: 0d0ceaca3a0500b3f45b41b79c6ac4f396dc4b13
|
2 |
-
node:
|
3 |
branch: default
|
4 |
-
|
5 |
-
latesttagdistance: 1
|
1 |
repo: 0d0ceaca3a0500b3f45b41b79c6ac4f396dc4b13
|
2 |
+
node: 70b853668d6c3f97b63dafcfaeebb622bf08fd30
|
3 |
branch: default
|
4 |
+
tag: v1.0.17
|
|
vendor/xrstf/composer-php52/.hgtags
CHANGED
@@ -15,4 +15,3 @@ eabb654da4d9200180037805cf348c20caf775c2 v1.0.13
|
|
15 |
8cc8f6ceddf527eafd0cd7b4cb274bef39d27a92 v1.0.14
|
16 |
b69d211ed4885e3c16282b01b7548226c7b50657 v1.0.15
|
17 |
b80de08b940ea59789646fa20d841fbdd72d72f0 v1.0.16
|
18 |
-
70b853668d6c3f97b63dafcfaeebb622bf08fd30 v1.0.17
|
15 |
8cc8f6ceddf527eafd0cd7b4cb274bef39d27a92 v1.0.14
|
16 |
b69d211ed4885e3c16282b01b7548226c7b50657 v1.0.15
|
17 |
b80de08b940ea59789646fa20d841fbdd72d72f0 v1.0.16
|
|
vendor/yoast/api-libs/README.md
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
Yoast API libraries
|
2 |
==========================
|
3 |
-
This repository
|
4 |
-
* Google Analytics
|
1 |
+
Yoast Google API libraries
|
2 |
==========================
|
3 |
+
This repository contains the Google API client libraries which are used in Yoast plugins.
|
|
vendor/yoast/api-libs/class-api-google-client.php
ADDED
@@ -0,0 +1,269 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class Yoast_Api_Google_Client
|
4 |
+
*/
|
5 |
+
class Yoast_Api_Google_Client extends Yoast_Google_Client {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* @var string
|
9 |
+
*/
|
10 |
+
protected $option_refresh_token;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @var string
|
14 |
+
*/
|
15 |
+
protected $option_access_token;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var string
|
19 |
+
*/
|
20 |
+
protected $api_url;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var string
|
24 |
+
*/
|
25 |
+
protected $http_response_code;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Initialize the config and refresh the token
|
29 |
+
*
|
30 |
+
* @param array $config
|
31 |
+
* @param string $option_prefix
|
32 |
+
* @param string $api_url
|
33 |
+
*/
|
34 |
+
public function __construct( $config, $option_prefix, $api_url = '' ) {
|
35 |
+
|
36 |
+
parent::__construct();
|
37 |
+
|
38 |
+
$this->option_refresh_token = $option_prefix . '-refresh_token';
|
39 |
+
$this->option_access_token = $option_prefix . '-access_token';
|
40 |
+
|
41 |
+
$this->api_url = $api_url;
|
42 |
+
|
43 |
+
// Initialize the config to set all properties properly.
|
44 |
+
$this->init_config( $config );
|
45 |
+
|
46 |
+
// Let's get an access token if we've got a refresh token.
|
47 |
+
$this->refresh_tokens();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Authenticate the client. If $authorization_code is empty it will lead the user through the validation process of
|
52 |
+
* Google. If set it will be get the access token for current session and save the refresh_token for future use
|
53 |
+
*
|
54 |
+
* @param mixed $authorization_code
|
55 |
+
*
|
56 |
+
* @return bool
|
57 |
+
*/
|
58 |
+
public function authenticate_client( $authorization_code = null ) {
|
59 |
+
static $has_retried;
|
60 |
+
|
61 |
+
// Authenticate client.
|
62 |
+
try {
|
63 |
+
$this->authenticate( $authorization_code );
|
64 |
+
|
65 |
+
// Get access response.
|
66 |
+
$response = $this->getAccessToken();
|
67 |
+
|
68 |
+
// Check if there is a response body.
|
69 |
+
if ( ! empty( $response ) ) {
|
70 |
+
$response = json_decode( $response );
|
71 |
+
|
72 |
+
if ( is_object( $response ) ) {
|
73 |
+
// Save the refresh token.
|
74 |
+
$this->save_refresh_token( $response->refresh_token );
|
75 |
+
|
76 |
+
return true;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
} catch ( Yoast_Google_AuthException $exception ) {
|
80 |
+
// If there aren't any attempts before, try again and set attempts on true, to prevent further attempts.
|
81 |
+
if ( empty( $has_retried ) ) {
|
82 |
+
$has_retried = true;
|
83 |
+
|
84 |
+
return $this->authenticate_client( $authorization_code );
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
return false;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Doing a request to the API
|
93 |
+
*
|
94 |
+
* @param string $target_request_url
|
95 |
+
* @param bool $decode_response
|
96 |
+
* @param string $request_method
|
97 |
+
*
|
98 |
+
* @return array
|
99 |
+
*/
|
100 |
+
public function do_request( $target_request_url, $decode_response = false, $request_method = 'GET' ) {
|
101 |
+
// Get response.
|
102 |
+
$response = $this->getIo()->authenticatedRequest(
|
103 |
+
new Yoast_Google_HttpRequest( $this->api_url . $target_request_url, $request_method )
|
104 |
+
);
|
105 |
+
|
106 |
+
// Storing the response code.
|
107 |
+
$this->http_response_code = $response->getResponseHttpCode();
|
108 |
+
|
109 |
+
if ( $decode_response ) {
|
110 |
+
return $this->decode_response( $response );
|
111 |
+
}
|
112 |
+
|
113 |
+
return $response;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Decode the JSON response
|
118 |
+
*
|
119 |
+
* @param object $response
|
120 |
+
* @param int $accepted_response_code
|
121 |
+
*
|
122 |
+
* @return mixed
|
123 |
+
*/
|
124 |
+
public function decode_response( $response, $accepted_response_code = 200 ) {
|
125 |
+
if ( $accepted_response_code === $response->getResponseHttpCode() ) {
|
126 |
+
return json_decode( $response->getResponseBody() );
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Getting the response code, saved from latest request to Google
|
132 |
+
*
|
133 |
+
* @return mixed
|
134 |
+
*/
|
135 |
+
public function get_http_response_code() {
|
136 |
+
return $this->http_response_code;
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Clears the options and revokes the token
|
141 |
+
*/
|
142 |
+
public function clear_data() {
|
143 |
+
$this->revokeToken();
|
144 |
+
|
145 |
+
delete_option( $this->option_access_token );
|
146 |
+
delete_option( $this->option_refresh_token );
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Check if user is authenticated
|
151 |
+
*
|
152 |
+
* @return bool
|
153 |
+
*/
|
154 |
+
public function is_authenticated() {
|
155 |
+
$has_refresh_token = ( $this->get_refresh_token() !== '' );
|
156 |
+
$access_token_expired = $this->access_token_expired();
|
157 |
+
|
158 |
+
return $has_refresh_token && ! $access_token_expired;
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Initialize the config, will merge given config with default config to be sure all settings are available
|
163 |
+
*
|
164 |
+
* @param array $config
|
165 |
+
*/
|
166 |
+
protected function init_config( array $config ) {
|
167 |
+
if ( ! empty( $config['application_name'] ) ) {
|
168 |
+
$this->setApplicationName( $config['application_name'] );
|
169 |
+
}
|
170 |
+
|
171 |
+
if ( ! empty( $config['client_id'] ) ) {
|
172 |
+
$this->setClientId( $config['client_id'] );
|
173 |
+
}
|
174 |
+
|
175 |
+
if ( ! empty( $config['client_secret'] ) ) {
|
176 |
+
$this->setClientSecret( $config['client_secret'] );
|
177 |
+
}
|
178 |
+
|
179 |
+
// Set our settings.
|
180 |
+
$this->setRedirectUri( $config['redirect_uri'] );
|
181 |
+
$this->setScopes( $config['scopes'] );
|
182 |
+
$this->setAccessType( 'offline' );
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Refreshing the tokens
|
187 |
+
*/
|
188 |
+
protected function refresh_tokens() {
|
189 |
+
if ( ( $refresh_token = $this->get_refresh_token() ) !== '' && $this->access_token_expired() ) {
|
190 |
+
try {
|
191 |
+
// Refresh the token.
|
192 |
+
$this->refreshToken( $refresh_token );
|
193 |
+
|
194 |
+
$response = $this->getAuth()->token;
|
195 |
+
|
196 |
+
// Check response and if there is an access_token.
|
197 |
+
if ( ! empty( $response ) && ! empty ( $response['access_token'] ) ) {
|
198 |
+
$this->save_access_token( $response );
|
199 |
+
}
|
200 |
+
}
|
201 |
+
catch ( Exception $e ) {
|
202 |
+
return false;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Save the refresh token
|
209 |
+
*
|
210 |
+
* @param string $refresh_token
|
211 |
+
*/
|
212 |
+
protected function save_refresh_token( $refresh_token ) {
|
213 |
+
update_option( $this->option_refresh_token, trim( $refresh_token ) );
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Return refresh token
|
218 |
+
*
|
219 |
+
* @return string
|
220 |
+
*/
|
221 |
+
protected function get_refresh_token() {
|
222 |
+
return get_option( $this->option_refresh_token, '' );
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Saving the access token as an option for further use till it expires.
|
227 |
+
*
|
228 |
+
* @param array $response
|
229 |
+
*/
|
230 |
+
protected function save_access_token( $response ) {
|
231 |
+
update_option(
|
232 |
+
$this->option_access_token,
|
233 |
+
array(
|
234 |
+
'refresh_token' => $this->get_refresh_token(),
|
235 |
+
'access_token' => $response['access_token'],
|
236 |
+
'expires' => current_time( 'timestamp' ) + $response['expires_in'],
|
237 |
+
'expires_in' => $response['expires_in'],
|
238 |
+
'created' => $response['created'],
|
239 |
+
)
|
240 |
+
);
|
241 |
+
|
242 |
+
$this->setAccessToken( json_encode( $response ) );
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Check if current access token is expired.
|
247 |
+
*
|
248 |
+
* @return bool
|
249 |
+
*/
|
250 |
+
private function access_token_expired() {
|
251 |
+
$access_token = $this->get_access_token();
|
252 |
+
|
253 |
+
if ( current_time( 'timestamp' ) >= $access_token['expires'] ) {
|
254 |
+
return true;
|
255 |
+
}
|
256 |
+
|
257 |
+
$this->setAccessToken( json_encode( $access_token ) );
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Getting the current access token from the options
|
262 |
+
*
|
263 |
+
* @return mixed
|
264 |
+
*/
|
265 |
+
private function get_access_token() {
|
266 |
+
return get_option( $this->option_access_token, array( 'access_token' => false, 'expires' => 0 ) );
|
267 |
+
}
|
268 |
+
|
269 |
+
}
|
vendor/yoast/api-libs/class-api-google.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Yoast_Api_Google {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* This class will be loaded when someone calls the API library with the Google analytics module
|
7 |
+
*/
|
8 |
+
public function __construct() {
|
9 |
+
spl_autoload_register( array( $this, 'autoload_api_google_files' ) );
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Autoload the API Google class
|
14 |
+
*
|
15 |
+
* @param string $class_name - The class that should be loaded
|
16 |
+
*/
|
17 |
+
private function autoload_api_google_files( $class_name ) {
|
18 |
+
$path = dirname( __FILE__ );
|
19 |
+
$class_name = strtolower( $class_name );
|
20 |
+
$oauth_files = array(
|
21 |
+
// Main requires
|
22 |
+
'yoast_google_client' => 'google/Google_Client',
|
23 |
+
'yoast_api_google_client' => 'class-api-google-client',
|
24 |
+
|
25 |
+
// Requires in classes
|
26 |
+
'yoast_google_auth' => 'google/auth/Google_Auth',
|
27 |
+
'yoast_google_assertion' => 'google/auth/Google_AssertionCredentials',
|
28 |
+
'yoast_google_signer' => 'google/auth/Google_Signer',
|
29 |
+
'yoast_google_p12signer' => 'google/auth/Google_P12Signer',
|
30 |
+
'yoast_google_authnone' => 'google/auth/Google_AuthNone',
|
31 |
+
'yoast_google_oauth2' => 'google/auth/Google_OAuth2',
|
32 |
+
'yoast_google_verifier' => 'google/auth/Google_Verifier',
|
33 |
+
'yoast_google_loginticket' => 'google/auth/Google_LoginTicket',
|
34 |
+
'yoast_google_pemverifier' => 'google/auth/Google_PemVerifier',
|
35 |
+
'yoast_google_model' => 'google/service/Google_Model',
|
36 |
+
'yoast_google_service' => 'google/service/Google_Service',
|
37 |
+
'yoast_google_serviceresource' => 'google/service/Google_ServiceResource',
|
38 |
+
'yoast_google_utils' => 'google/service/Google_Utils',
|
39 |
+
'yoast_google_batchrequest' => 'google/service/Google_BatchRequest',
|
40 |
+
'yoast_google_mediafileupload' => 'google/service/Google_MediaFileUpload',
|
41 |
+
'yoast_google_uritemplate' => 'google/external/URITemplateParser',
|
42 |
+
'yoast_google_cache' => 'google/cache/Google_Cache',
|
43 |
+
|
44 |
+
// Requests
|
45 |
+
'yoast_google_cacheparser' => 'google/io/Google_CacheParser',
|
46 |
+
'yoast_google_io' => 'google/io/Google_IO',
|
47 |
+
'yoast_google_httprequest' => 'google/io/Google_HttpRequest',
|
48 |
+
'yoast_google_rest' => 'google/io/Google_REST',
|
49 |
+
|
50 |
+
// Wordpress
|
51 |
+
'yoast_google_wpio' => 'google/io/Google_WPIO',
|
52 |
+
'yoast_google_wpcache' => 'google/cache/Google_WPCache',
|
53 |
+
);
|
54 |
+
|
55 |
+
if ( ! empty( $oauth_files[$class_name] ) ) {
|
56 |
+
if ( file_exists( $path . '/' . $oauth_files[$class_name] . '.php' ) ) {
|
57 |
+
require_once( $path . '/' . $oauth_files[$class_name] . '.php' );
|
58 |
+
}
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
vendor/yoast/api-libs/class-api-libs.php
CHANGED
@@ -14,123 +14,36 @@
|
|
14 |
class Yoast_Api_Libs {
|
15 |
|
16 |
/**
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* @var array
|
20 |
-
*/
|
21 |
-
private static $api_libs = array();
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Store the instances of the API class
|
25 |
-
*
|
26 |
-
* @var array
|
27 |
*/
|
28 |
-
|
29 |
|
30 |
/**
|
31 |
-
*
|
32 |
*
|
33 |
-
* @param
|
34 |
*
|
35 |
-
* @
|
36 |
*/
|
37 |
-
public
|
38 |
-
$
|
39 |
-
$failed = 0;
|
40 |
|
41 |
-
if (
|
42 |
-
|
43 |
-
if ( self::register_api_library( $lib ) ) {
|
44 |
-
$succeeded ++;
|
45 |
-
} else {
|
46 |
-
$failed ++;
|
47 |
-
}
|
48 |
-
}
|
49 |
}
|
50 |
-
|
51 |
-
if ( $succeeded >= 1 && $failed == 0 ) {
|
52 |
-
return true;
|
53 |
-
} else {
|
54 |
-
return false;
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Get the registered API libraries
|
60 |
-
*
|
61 |
-
* @return array
|
62 |
-
*/
|
63 |
-
public static function get_api_libs() {
|
64 |
-
return self::$api_libs;
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
-
*
|
69 |
-
*
|
70 |
-
* @param $name
|
71 |
-
*
|
72 |
-
* @return bool
|
73 |
*/
|
74 |
-
private
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
$path_to_require = dirname( __FILE__ ) . '/' . $name . '/' . $classpath;
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
return true;
|
83 |
}
|
84 |
-
|
85 |
-
self::$api_libs[$name] = array(
|
86 |
-
'name' => $name,
|
87 |
-
'classname' => $classname,
|
88 |
-
'classpath' => $classpath,
|
89 |
-
'path_to_require' => $path_to_require,
|
90 |
-
);
|
91 |
-
|
92 |
-
if ( file_exists( $path_to_require ) ) {
|
93 |
-
include( $path_to_require );
|
94 |
-
|
95 |
-
if ( class_exists( $classname ) ) {
|
96 |
-
$instance = new $classname;
|
97 |
-
|
98 |
-
self::$instances[$name] = $instance;
|
99 |
-
|
100 |
-
return true;
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
return false;
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Get instance
|
109 |
-
*
|
110 |
-
* @param $name
|
111 |
-
*
|
112 |
-
* @return bool
|
113 |
-
*/
|
114 |
-
public function get_instance( $name ) {
|
115 |
-
if ( isset( self::$instances[$name] ) ) {
|
116 |
-
return self::$instances[$name];
|
117 |
-
}
|
118 |
-
|
119 |
-
return false;
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Execute a call with this method
|
124 |
-
*
|
125 |
-
* @param $instance
|
126 |
-
* @param $method
|
127 |
-
* @param array $params
|
128 |
-
*/
|
129 |
-
public static function do_call( $instance, $method, $params = array() ) {
|
130 |
-
$class = self::$instances[$instance];
|
131 |
-
|
132 |
-
$class->$method( $params );
|
133 |
-
// Call user func?
|
134 |
}
|
135 |
|
136 |
}
|
14 |
class Yoast_Api_Libs {
|
15 |
|
16 |
/**
|
17 |
+
* Current version number of the API-libs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
*/
|
19 |
+
const version = '2.0';
|
20 |
|
21 |
/**
|
22 |
+
* Check if minimal required version is met.
|
23 |
*
|
24 |
+
* @param string $minimal_required_version
|
25 |
*
|
26 |
+
* @throws Exception
|
27 |
*/
|
28 |
+
public function __construct( $minimal_required_version ) {
|
29 |
+
$this->load_google();
|
|
|
30 |
|
31 |
+
if ( ! version_compare( self::version, $minimal_required_version, '>=' )) {
|
32 |
+
throw new Exception( 'required_version' );
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
|
36 |
/**
|
37 |
+
* Loading the google api library which will set the autoloader
|
|
|
|
|
|
|
|
|
38 |
*/
|
39 |
+
private function load_google() {
|
40 |
+
if ( ! class_exists('Yoast_Api_Google', false) ) {
|
41 |
+
// Require the file
|
42 |
+
require_once dirname( __FILE__ ) . '/' . 'class-api-google.php';
|
|
|
43 |
|
44 |
+
// Initialize the Google API Class to set the autoloader
|
45 |
+
new Yoast_Api_Google();
|
|
|
46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
|
49 |
}
|
vendor/yoast/api-libs/google/cache/Google_ApcCache.php
DELETED
@@ -1,98 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2010 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
/**
|
19 |
-
* A persistent storage class based on the APC cache, which is not
|
20 |
-
* really very persistent, as soon as you restart your web server
|
21 |
-
* the storage will be wiped, however for debugging and/or speed
|
22 |
-
* it can be useful, kinda, and cache is a lot cheaper then storage.
|
23 |
-
*
|
24 |
-
* @author Chris Chabot <chabotc@google.com>
|
25 |
-
*/
|
26 |
-
class Yoast_Google_APCCache extends Yoast_Google_Cache {
|
27 |
-
|
28 |
-
public function __construct() {
|
29 |
-
if (! function_exists('apc_add')) {
|
30 |
-
throw new Yoast_Google_CacheException("Apc functions not available");
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
private function isLocked($key) {
|
35 |
-
if ((@apc_fetch($key . '.lock')) === false) {
|
36 |
-
return false;
|
37 |
-
}
|
38 |
-
return true;
|
39 |
-
}
|
40 |
-
|
41 |
-
private function createLock($key) {
|
42 |
-
// the interesting thing is that this could fail if the lock was created in the meantime..
|
43 |
-
// but we'll ignore that out of convenience
|
44 |
-
@apc_add($key . '.lock', '', 5);
|
45 |
-
}
|
46 |
-
|
47 |
-
private function removeLock($key) {
|
48 |
-
// suppress all warnings, if some other process removed it that's ok too
|
49 |
-
@apc_delete($key . '.lock');
|
50 |
-
}
|
51 |
-
|
52 |
-
private function waitForLock($key) {
|
53 |
-
// 20 x 250 = 5 seconds
|
54 |
-
$tries = 20;
|
55 |
-
$cnt = 0;
|
56 |
-
do {
|
57 |
-
// 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
|
58 |
-
usleep(250);
|
59 |
-
$cnt ++;
|
60 |
-
} while ($cnt <= $tries && $this->isLocked($key));
|
61 |
-
if ($this->isLocked($key)) {
|
62 |
-
// 5 seconds passed, assume the owning process died off and remove it
|
63 |
-
$this->removeLock($key);
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* @inheritDoc
|
69 |
-
*/
|
70 |
-
public function get($key, $expiration = false) {
|
71 |
-
|
72 |
-
if (($ret = @apc_fetch($key)) === false) {
|
73 |
-
return false;
|
74 |
-
}
|
75 |
-
if (!$expiration || (time() - $ret['time'] > $expiration)) {
|
76 |
-
$this->delete($key);
|
77 |
-
return false;
|
78 |
-
}
|
79 |
-
return unserialize($ret['data']);
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* @inheritDoc
|
84 |
-
*/
|
85 |
-
public function set($key, $value) {
|
86 |
-
if (@apc_store($key, array('time' => time(), 'data' => serialize($value))) == false) {
|
87 |
-
throw new Yoast_Google_CacheException("Couldn't store data");
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* @inheritDoc
|
93 |
-
* @param String $key
|
94 |
-
*/
|
95 |
-
public function delete($key) {
|
96 |
-
@apc_delete($key);
|
97 |
-
}
|
98 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/yoast/api-libs/google/cache/Google_FileCache.php
DELETED
@@ -1,137 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2008 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
/*
|
19 |
-
* This class implements a basic on disk storage. While that does
|
20 |
-
* work quite well it's not the most elegant and scalable solution.
|
21 |
-
* It will also get you into a heap of trouble when you try to run
|
22 |
-
* this in a clustered environment. In those cases please use the
|
23 |
-
* MySql back-end
|
24 |
-
*
|
25 |
-
* @author Chris Chabot <chabotc@google.com>
|
26 |
-
*/
|
27 |
-
class Yoast_Google_FileCache extends Yoast_Google_Cache {
|
28 |
-
private $path;
|
29 |
-
|
30 |
-
public function __construct() {
|
31 |
-
global $apiConfig;
|
32 |
-
$this->path = $apiConfig['ioFileCache_directory'];
|
33 |
-
}
|
34 |
-
|
35 |
-
private function isLocked($storageFile) {
|
36 |
-
// our lock file convention is simple: /the/file/path.lock
|
37 |
-
return file_exists($storageFile . '.lock');
|
38 |
-
}
|
39 |
-
|
40 |
-
private function createLock($storageFile) {
|
41 |
-
$storageDir = dirname($storageFile);
|
42 |
-
if (! is_dir($storageDir)) {
|
43 |
-
// @codeCoverageIgnoreStart
|
44 |
-
if (! @mkdir($storageDir, 0755, true)) {
|
45 |
-
// make sure the failure isn't because of a concurrency issue
|
46 |
-
if (! is_dir($storageDir)) {
|
47 |
-
throw new Yoast_Google_CacheException("Could not create storage directory: $storageDir");
|
48 |
-
}
|
49 |
-
}
|
50 |
-
// @codeCoverageIgnoreEnd
|
51 |
-
}
|
52 |
-
@touch($storageFile . '.lock');
|
53 |
-
}
|
54 |
-
|
55 |
-
private function removeLock($storageFile) {
|
56 |
-
// suppress all warnings, if some other process removed it that's ok too
|
57 |
-
@unlink($storageFile . '.lock');
|
58 |
-
}
|
59 |
-
|
60 |
-
private function waitForLock($storageFile) {
|
61 |
-
// 20 x 250 = 5 seconds
|
62 |
-
$tries = 20;
|
63 |
-
$cnt = 0;
|
64 |
-
do {
|
65 |
-
// make sure PHP picks up on file changes. This is an expensive action but really can't be avoided
|
66 |
-
clearstatcache();
|
67 |
-
// 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
|
68 |
-
usleep(250);
|
69 |
-
$cnt ++;
|
70 |
-
} while ($cnt <= $tries && $this->isLocked($storageFile));
|
71 |
-
if ($this->isLocked($storageFile)) {
|
72 |
-
// 5 seconds passed, assume the owning process died off and remove it
|
73 |
-
$this->removeLock($storageFile);
|
74 |
-
}
|
75 |
-
}
|
76 |
-
|
77 |
-
private function getCacheDir($hash) {
|
78 |
-
// use the first 2 characters of the hash as a directory prefix
|
79 |
-
// this should prevent slowdowns due to huge directory listings
|
80 |
-
// and thus give some basic amount of scalability
|
81 |
-
return $this->path . '/' . substr($hash, 0, 2);
|
82 |
-
}
|
83 |
-
|
84 |
-
private function getCacheFile($hash) {
|
85 |
-
return $this->getCacheDir($hash) . '/' . $hash;
|
86 |
-
}
|
87 |
-
|
88 |
-
public function get($key, $expiration = false) {
|
89 |
-
$storageFile = $this->getCacheFile(md5($key));
|
90 |
-
// See if this storage file is locked, if so we wait up to 5 seconds for the lock owning process to
|
91 |
-
// complete it's work. If the lock is not released within that time frame, it's cleaned up.
|
92 |
-
// This should give us a fair amount of 'Cache Stampeding' protection
|
93 |
-
if ($this->isLocked($storageFile)) {
|
94 |
-
$this->waitForLock($storageFile);
|
95 |
-
}
|
96 |
-
if (file_exists($storageFile) && is_readable($storageFile)) {
|
97 |
-
$now = time();
|
98 |
-
if (! $expiration || (($mtime = @filemtime($storageFile)) !== false && ($now - $mtime) < $expiration)) {
|
99 |
-
if (($data = @file_get_contents($storageFile)) !== false) {
|
100 |
-
$data = unserialize($data);
|
101 |
-
return $data;
|
102 |
-
}
|
103 |
-
}
|
104 |
-
}
|
105 |
-
return false;
|
106 |
-
}
|
107 |
-
|
108 |
-
public function set($key, $value) {
|
109 |
-
$storageDir = $this->getCacheDir(md5($key));
|
110 |
-
$storageFile = $this->getCacheFile(md5($key));
|
111 |
-
if ($this->isLocked($storageFile)) {
|
112 |
-
// some other process is writing to this file too, wait until it's done to prevent hiccups
|
113 |
-
$this->waitForLock($storageFile);
|
114 |
-
}
|
115 |
-
if (! is_dir($storageDir)) {
|
116 |
-
if (! @mkdir($storageDir, 0755, true)) {
|
117 |
-
throw new Yoast_Google_CacheException("Could not create storage directory: $storageDir");
|
118 |
-
}
|
119 |
-
}
|
120 |
-
// we serialize the whole request object, since we don't only want the
|
121 |
-
// responseContent but also the postBody used, headers, size, etc
|
122 |
-
$data = serialize($value);
|
123 |
-
$this->createLock($storageFile);
|
124 |
-
if (! @file_put_contents($storageFile, $data)) {
|
125 |
-
$this->removeLock($storageFile);
|
126 |
-
throw new Yoast_Google_CacheException("Could not store data in the file");
|
127 |
-
}
|
128 |
-
$this->removeLock($storageFile);
|
129 |
-
}
|
130 |
-
|
131 |
-
public function delete($key) {
|
132 |
-
$file = $this->getCacheFile(md5($key));
|
133 |
-
if (! @unlink($file)) {
|
134 |
-
throw new Yoast_Google_CacheException("Cache file could not be deleted");
|
135 |
-
}
|
136 |
-
}
|
137 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/yoast/api-libs/google/cache/Google_MemcacheCache.php
DELETED
@@ -1,130 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2008 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
/**
|
19 |
-
* A persistent storage class based on the memcache, which is not
|
20 |
-
* really very persistent, as soon as you restart your memcache daemon
|
21 |
-
* the storage will be wiped, however for debugging and/or speed
|
22 |
-
* it can be useful, kinda, and cache is a lot cheaper then storage.
|
23 |
-
*
|
24 |
-
* @author Chris Chabot <chabotc@google.com>
|
25 |
-
*/
|
26 |
-
class Yoast_Google_MemcacheCache extends Yoast_Google_Cache {
|
27 |
-
private $connection = false;
|
28 |
-
|
29 |
-
public function __construct() {
|
30 |
-
global $apiConfig;
|
31 |
-
if (! function_exists('memcache_connect')) {
|
32 |
-
throw new Yoast_Google_CacheException("Memcache functions not available");
|
33 |
-
}
|
34 |
-
$this->host = $apiConfig['ioMemCacheCache_host'];
|
35 |
-
$this->port = $apiConfig['ioMemCacheCache_port'];
|
36 |
-
if (empty($this->host) || empty($this->port)) {
|
37 |
-
throw new Yoast_Google_CacheException("You need to supply a valid memcache host and port");
|
38 |
-
}
|
39 |
-
}
|
40 |
-
|
41 |
-
private function isLocked($key) {
|
42 |
-
$this->check();
|
43 |
-
if ((@memcache_get($this->connection, $key . '.lock')) === false) {
|
44 |
-
return false;
|
45 |
-
}
|
46 |
-
return true;
|
47 |
-
}
|
48 |
-
|
49 |
-
private function createLock($key) {
|
50 |
-
$this->check();
|
51 |
-
// the interesting thing is that this could fail if the lock was created in the meantime..
|
52 |
-
// but we'll ignore that out of convenience
|
53 |
-
@memcache_add($this->connection, $key . '.lock', '', 0, 5);
|
54 |
-
}
|
55 |
-
|
56 |
-
private function removeLock($key) {
|
57 |
-
$this->check();
|
58 |
-
// suppress all warnings, if some other process removed it that's ok too
|
59 |
-
@memcache_delete($this->connection, $key . '.lock');
|
60 |
-
}
|
61 |
-
|
62 |
-
private function waitForLock($key) {
|
63 |
-
$this->check();
|
64 |
-
// 20 x 250 = 5 seconds
|
65 |
-
$tries = 20;
|
66 |
-
$cnt = 0;
|
67 |
-
do {
|
68 |
-
// 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
|
69 |
-
usleep(250);
|
70 |
-
$cnt ++;
|
71 |
-
} while ($cnt <= $tries && $this->isLocked($key));
|
72 |
-
if ($this->isLocked($key)) {
|
73 |
-
// 5 seconds passed, assume the owning process died off and remove it
|
74 |
-
$this->removeLock($key);
|
75 |
-
}
|
76 |
-
}
|
77 |
-
|
78 |
-
// I prefer lazy initialization since the cache isn't used every request
|
79 |
-
// so this potentially saves a lot of overhead
|
80 |
-
private function connect() {
|
81 |
-
if (! $this->connection = @memcache_pconnect($this->host, $this->port)) {
|
82 |
-
throw new Yoast_Google_CacheException("Couldn't connect to memcache server");
|
83 |
-
}
|
84 |
-
}
|
85 |
-
|
86 |
-
private function check() {
|
87 |
-
if (! $this->connection) {
|
88 |
-
$this->connect();
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* @inheritDoc
|
94 |
-
*/
|
95 |
-
public function get($key, $expiration = false) {
|
96 |
-
$this->check();
|
97 |
-
if (($ret = @memcache_get($this->connection, $key)) === false) {
|
98 |
-
return false;
|
99 |
-
}
|
100 |
-
if (is_numeric($expiration) && (time() - $ret['time'] > $expiration)) {
|
101 |
-
$this->delete($key);
|
102 |
-
return false;
|
103 |
-
}
|
104 |
-
return $ret['data'];
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* @inheritDoc
|
109 |
-
* @param string $key
|
110 |
-
* @param string $value
|
111 |
-
* @throws Yoast_Google_CacheException
|
112 |
-
*/
|
113 |
-
public function set($key, $value) {
|
114 |
-
$this->check();
|
115 |
-
// we store it with the cache_time default expiration so objects will at least get cleaned eventually.
|
116 |
-
if (@memcache_set($this->connection, $key, array('time' => time(),
|
117 |
-
'data' => $value), false) == false) {
|
118 |
-
throw new Yoast_Google_CacheException("Couldn't store data in cache");
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* @inheritDoc
|
124 |
-
* @param String $key
|
125 |
-
*/
|
126 |
-
public function delete($key) {
|
127 |
-
$this->check();
|
128 |
-
@memcache_delete($this->connection, $key);
|
129 |
-
}
|
130 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/yoast/api-libs/google/class-api-google.php
DELETED
@@ -1,80 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Yoast_Api_Google {
|
4 |
-
|
5 |
-
public $options;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* This class will be loaded when someone calls the API library with the Google analytics module
|
9 |
-
*/
|
10 |
-
public function __construct() {
|
11 |
-
$this->load_api_google_files();
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Register the Autoload the Google class
|
16 |
-
*/
|
17 |
-
private function load_api_google_files() {
|
18 |
-
spl_autoload_register( array( $this, 'autoload_api_google_files' ) );
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Autoload the API Google class
|
23 |
-
*
|
24 |
-
* @param string $class_name - The class that should be loaded
|
25 |
-
*/
|
26 |
-
private function autoload_api_google_files( $class_name ) {
|
27 |
-
$path = dirname( __FILE__ );
|
28 |
-
$class_name = strtolower( $class_name );
|
29 |
-
$oauth_files = array(
|
30 |
-
// Main requires
|
31 |
-
'yoast_google_client' => 'Google_Client',
|
32 |
-
|
33 |
-
// Requires in classes
|
34 |
-
'yoast_google_model' => 'service/Google_Model',
|
35 |
-
'yoast_google_service' => 'service/Google_Service',
|
36 |
-
'yoast_google_serviceresource' => 'service/Google_ServiceResource',
|
37 |
-
'yoast_google_assertion' => 'auth/Google_AssertionCredentials',
|
38 |
-
'yoast_google_signer' => 'auth/Google_Signer',
|
39 |
-
'yoast_google_p12signer' => 'auth/Google_P12Signer',
|
40 |
-
'yoast_google_batchrequest' => 'service/Google_BatchRequest',
|
41 |
-
'yoast_google_uritemplate' => 'external/URITemplateParser',
|
42 |
-
'yoast_google_auth' => 'auth/Google_Auth',
|
43 |
-
'yoast_google_cache' => 'cache/Google_Cache',
|
44 |
-
'yoast_google_io' => 'io/Google_IO',
|
45 |
-
'yoast_google_mediafileupload' => 'service/Google_MediaFileUpload',
|
46 |
-
'yoast_google_authnone' => 'auth/Google_AuthNone',
|
47 |
-
'yoast_google_oauth2' => 'auth/Google_OAuth2',
|
48 |
-
'yoast_google_verifier' => 'auth/Google_Verifier',
|
49 |
-
'yoast_google_loginticket' => 'auth/Google_LoginTicket',
|
50 |
-
'yoast_google_utils' => 'service/Google_Utils',
|
51 |
-
'yoast_google_pemverifier' => 'auth/Google_PemVerifier',
|
52 |
-
|
53 |
-
// Caching
|
54 |
-
'yoast_google_filecache' => 'cache/Google_FileCache',
|
55 |
-
'yoast_google_memcachecache' => 'cache/Google_MemcacheCache',
|
56 |
-
'yoast_google_cacheparser' => 'io/Google_CacheParser',
|
57 |
-
|
58 |
-
// Requests
|
59 |
-
'yoast_google_httprequest' => 'io/Google_HttpRequest',
|
60 |
-
'yoast_google_httpstream_io' => 'io/Google_HttpStreamIO',
|
61 |
-
'yoast_google_rest' => 'io/Google_REST',
|
62 |
-
|
63 |
-
// Wordpress
|
64 |
-
'yoast_google_wpio' => 'io/Google_WPIO',
|
65 |
-
'yoast_google_wpcache' => 'cache/Google_WPCache',
|
66 |
-
|
67 |
-
// REPLACE ME!
|
68 |
-
'yoast_google_curlio' => 'io/Google_CurlIO',
|
69 |
-
);
|
70 |
-
|
71 |
-
if ( ! empty( $oauth_files[$class_name] ) ) {
|
72 |
-
if ( file_exists( $path . '/' . $oauth_files[$class_name] . '.php' ) ) {
|
73 |
-
require_once( $path . '/' . $oauth_files[$class_name] . '.php' );
|
74 |
-
}
|
75 |
-
|
76 |
-
}
|
77 |
-
|
78 |
-
}
|
79 |
-
|
80 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/yoast/api-libs/google/io/Google_HttpStreamIO.php
DELETED
@@ -1,168 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2013 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Http Streams based implementation of Yoast_Google_IO.
|
20 |
-
*
|
21 |
-
* @author Stuart Langley <slangley@google.com>
|
22 |
-
*/
|
23 |
-
|
24 |
-
class Yoast_Google_HttpStreamIO extends Yoast_Google_IO {
|
25 |
-
|
26 |
-
private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null);
|
27 |
-
|
28 |
-
private static $DEFAULT_HTTP_CONTEXT = array(
|
29 |
-
"follow_location" => 0,
|
30 |
-
"ignore_errors" => 1,
|
31 |
-
);
|
32 |
-
|
33 |
-
private static $DEFAULT_SSL_CONTEXT = array(
|
34 |
-
"verify_peer" => true,
|
35 |
-
);
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Perform an authenticated / signed apiHttpRequest.
|
39 |
-
* This function takes the apiHttpRequest, calls apiAuth->sign on it
|
40 |
-
* (which can modify the request in what ever way fits the auth mechanism)
|
41 |
-
* and then calls Yoast_Google_HttpStreamIO::makeRequest on the signed request
|
42 |
-
*
|
43 |
-
* @param Yoast_Google_HttpRequest $request
|
44 |
-
* @return Yoast_Google_HttpRequest The resulting HTTP response including the
|
45 |
-
* responseHttpCode, responseHeaders and responseBody.
|
46 |
-
*/
|
47 |
-
public function authenticatedRequest(Yoast_Google_HttpRequest $request) {
|
48 |
-
$request = Yoast_Google_Client::$auth->sign($request);
|
49 |
-
return $this->makeRequest($request);
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Execute a apiHttpRequest
|
54 |
-
*
|
55 |
-
* @param Yoast_Google_HttpRequest $request the http request to be executed
|
56 |
-
* @return Yoast_Google_HttpRequest http request with the response http code,
|
57 |
-
* response headers and response body filled in
|
58 |
-
* @throws Yoast_Google_IOException on curl or IO error
|
59 |
-
*/
|
60 |
-
public function makeRequest(Yoast_Google_HttpRequest $request) {
|
61 |
-
// First, check to see if we have a valid cached version.
|
62 |
-
$cached = $this->getCachedRequest($request);
|
63 |
-
if ($cached !== false) {
|
64 |
-
if (!$this->checkMustRevaliadateCachedRequest($cached, $request)) {
|
65 |
-
return $cached;
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
$default_options = stream_context_get_options(stream_context_get_default());
|
70 |
-
|
71 |
-
$requestHttpContext = array_key_exists('http', $default_options) ?
|
72 |
-
$default_options['http'] : array();
|
73 |
-
if (array_key_exists($request->getRequestMethod(),
|
74 |
-
self::$ENTITY_HTTP_METHODS)) {
|
75 |
-
$request = $this->processEntityRequest($request);
|
76 |
-
}
|
77 |
-
|
78 |
-
if ($request->getPostBody()) {
|
79 |
-
$requestHttpContext["content"] = $request->getPostBody();
|
80 |
-
}
|
81 |
-
|
82 |
-
$requestHeaders = $request->getRequestHeaders();
|
83 |
-
if ($requestHeaders && is_array($requestHeaders)) {
|
84 |
-
$headers = "";
|
85 |
-
foreach($requestHeaders as $k => $v) {
|
86 |
-
$headers .= "$k: $v\n";
|
87 |
-
}
|
88 |
-
$requestHttpContext["header"] = $headers;
|
89 |
-
}
|
90 |
-
|
91 |
-
$requestHttpContext["method"] = $request->getRequestMethod();
|
92 |
-
$requestHttpContext["user_agent"] = $request->getUserAgent();
|
93 |
-
|
94 |
-
$requestSslContext = array_key_exists('ssl', $default_options) ?
|
95 |
-
$default_options['ssl'] : array();
|
96 |
-
|
97 |
-
if (!array_key_exists("cafile", $requestSslContext)) {
|
98 |
-
$requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
|
99 |
-
}
|
100 |
-
|
101 |
-
$options = array("http" => array_merge(self::$DEFAULT_HTTP_CONTEXT,
|
102 |
-
$requestHttpContext),
|
103 |
-
"ssl" => array_merge(self::$DEFAULT_SSL_CONTEXT,
|
104 |
-
$requestSslContext));
|
105 |
-
|
106 |
-
$context = stream_context_create($options);
|
107 |
-
|
108 |
-
$response_data = file_get_contents($request->getUrl(),
|
109 |
-
false,
|
110 |
-
$context);
|
111 |
-
|
112 |
-
if (false === $response_data) {
|
113 |
-
throw new Yoast_Google_IOException("HTTP Error: Unable to connect");
|
114 |
-
}
|
115 |
-
|
116 |
-
$respHttpCode = $this->getHttpResponseCode($http_response_header);
|
117 |
-
$responseHeaders = $this->getHttpResponseHeaders($http_response_header);
|
118 |
-
|
119 |
-
if ($respHttpCode == 304 && $cached) {
|
120 |
-
// If the server responded NOT_MODIFIED, return the cached request.
|
121 |
-
$this->updateCachedRequest($cached, $responseHeaders);
|
122 |
-
return $cached;
|
123 |
-
}
|
124 |
-
|
125 |
-
$request->setResponseHttpCode($respHttpCode);
|
126 |
-
$request->setResponseHeaders($responseHeaders);
|
127 |
-
$request->setResponseBody($response_data);
|
128 |
-
// Store the request in cache (the function checks to see if the request
|
129 |
-
// can actually be cached)
|
130 |
-
$this->setCachedRequest($request);
|
131 |
-
return $request;
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Set options that update the transport implementation's behavior.
|
136 |
-
* @param $options
|
137 |
-
*/
|
138 |
-
public function setOptions($options) {
|
139 |
-
}
|
140 |
-
|
141 |
-
private function getHttpResponseCode($response_headers) {
|
142 |
-
$header_count = count($response_headers);
|
143 |
-
|
144 |
-
for ($i = 0; $i < $header_count; $i++) {
|
145 |
-
$header = $response_headers[$i];
|
146 |
-
if (strncasecmp("HTTP", $header, strlen("HTTP")) == 0) {
|
147 |
-
$response = explode(' ', $header);
|
148 |
-
return $response[1];
|
149 |
-
}
|
150 |
-
}
|
151 |
-
return 'UNKNOWN';
|
152 |
-
}
|
153 |
-
|
154 |
-
private function getHttpResponseHeaders($response_headers) {
|
155 |
-
$header_count = count($response_headers);
|
156 |
-
$headers = array();
|
157 |
-
|
158 |
-
for ($i = 0; $i < $header_count; $i++) {
|
159 |
-
$header = $response_headers[$i];
|
160 |
-
$header_parts = explode(':', $header);
|
161 |
-
if (count($header_parts) == 2) {
|
162 |
-
$headers[$header_parts[0]] = $header_parts[1];
|
163 |
-
}
|
164 |
-
}
|
165 |
-
|
166 |
-
return $headers;
|
167 |
-
}
|
168 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/yoast/api-libs/google/io/Google_WPIO.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
*
|
21 |
*/
|
22 |
class Yoast_Google_WPIO extends Yoast_Google_IO {
|
23 |
-
private static $ENTITY_HTTP_METHODS = array( "POST" => null, "PUT" => null );
|
24 |
private static $HOP_BY_HOP = array(
|
25 |
'connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization',
|
26 |
'te', 'trailers', 'transfer-encoding', 'upgrade' );
|
@@ -60,8 +60,7 @@ class Yoast_Google_WPIO extends Yoast_Google_IO {
|
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
if ( array_key_exists( $request->getRequestMethod(),
|
64 |
-
self::$ENTITY_HTTP_METHODS ) ) {
|
65 |
$request = $this->processEntityRequest( $request );
|
66 |
}
|
67 |
|
@@ -72,7 +71,7 @@ class Yoast_Google_WPIO extends Yoast_Google_IO {
|
|
72 |
);
|
73 |
|
74 |
$curl_version = $this->get_curl_version();
|
75 |
-
if( $curl_version !== false ) {
|
76 |
if ( version_compare( $curl_version, '7.19.0', '<=' ) && version_compare( $curl_version, '7.19.8', '>' ) ) {
|
77 |
add_filter( 'http_api_transports', array( $this, 'filter_curl_from_transports' ) );
|
78 |
}
|
@@ -87,6 +86,9 @@ class Yoast_Google_WPIO extends Yoast_Google_IO {
|
|
87 |
$params['headers'] = $requestHeaders;
|
88 |
}
|
89 |
|
|
|
|
|
|
|
90 |
|
91 |
switch ( $request->getRequestMethod() ) {
|
92 |
case 'POST' :
|
@@ -96,6 +98,10 @@ class Yoast_Google_WPIO extends Yoast_Google_IO {
|
|
96 |
case 'GET' :
|
97 |
$response = wp_remote_get( $request->getUrl(), $params );
|
98 |
break;
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
|
101 |
$responseBody = wp_remote_retrieve_body( $response );
|
@@ -119,7 +125,6 @@ class Yoast_Google_WPIO extends Yoast_Google_IO {
|
|
119 |
$this->setCachedRequest( $request );
|
120 |
|
121 |
// And finally return it
|
122 |
-
|
123 |
return $request;
|
124 |
}
|
125 |
|
@@ -162,4 +167,4 @@ class Yoast_Google_WPIO extends Yoast_Google_IO {
|
|
162 |
return false;
|
163 |
}
|
164 |
|
165 |
-
}
|
20 |
*
|
21 |
*/
|
22 |
class Yoast_Google_WPIO extends Yoast_Google_IO {
|
23 |
+
private static $ENTITY_HTTP_METHODS = array( "POST" => null, "PUT" => null, "DELETE" => null );
|
24 |
private static $HOP_BY_HOP = array(
|
25 |
'connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization',
|
26 |
'te', 'trailers', 'transfer-encoding', 'upgrade' );
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
if ( array_key_exists( $request->getRequestMethod(), self::$ENTITY_HTTP_METHODS ) ) {
|
|
|
64 |
$request = $this->processEntityRequest( $request );
|
65 |
}
|
66 |
|
71 |
);
|
72 |
|
73 |
$curl_version = $this->get_curl_version();
|
74 |
+
if ( $curl_version !== false ) {
|
75 |
if ( version_compare( $curl_version, '7.19.0', '<=' ) && version_compare( $curl_version, '7.19.8', '>' ) ) {
|
76 |
add_filter( 'http_api_transports', array( $this, 'filter_curl_from_transports' ) );
|
77 |
}
|
86 |
$params['headers'] = $requestHeaders;
|
87 |
}
|
88 |
|
89 |
+
// There might be some problems with decompressing, so we prevent this by setting the param to false
|
90 |
+
$params['decompress'] = false;
|
91 |
+
|
92 |
|
93 |
switch ( $request->getRequestMethod() ) {
|
94 |
case 'POST' :
|
98 |
case 'GET' :
|
99 |
$response = wp_remote_get( $request->getUrl(), $params );
|
100 |
break;
|
101 |
+
case 'DELETE' :
|
102 |
+
$params['method'] = 'DELETE';
|
103 |
+
$response = wp_remote_get( $request->getUrl(), $params );
|
104 |
+
break;
|
105 |
}
|
106 |
|
107 |
$responseBody = wp_remote_retrieve_body( $response );
|
125 |
$this->setCachedRequest( $request );
|
126 |
|
127 |
// And finally return it
|
|
|
128 |
return $request;
|
129 |
}
|
130 |
|
167 |
return false;
|
168 |
}
|
169 |
|
170 |
+
}
|
vendor/yoast/api-libs/googleanalytics/class-api-googleanalytics.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Yoast_Api_Googleanalytics {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* This class will be loaded when someone calls the API library with the Google analytics module
|
7 |
-
*/
|
8 |
-
public function __construct() {
|
9 |
-
$this->load_api_oauth_files();
|
10 |
-
}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Register the Autoload the Oauth classes
|
14 |
-
*/
|
15 |
-
private function load_api_oauth_files() {
|
16 |
-
spl_autoload_register( array( $this, 'autoload_api_oauth_files' ) );
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Autoload the API Oauth classes
|
21 |
-
*
|
22 |
-
* @param string $class_name - The class that should be loaded
|
23 |
-
*/
|
24 |
-
private function autoload_api_oauth_files( $class_name ) {
|
25 |
-
$path = dirname( __FILE__ );
|
26 |
-
$class_name = strtolower( $class_name );
|
27 |
-
$oauth_files = array(
|
28 |
-
'yoast_googleanalytics_reporting' => 'class-googleanalytics-reporting',
|
29 |
-
'yoast_google_analytics_client' => 'class-google-analytics-client',
|
30 |
-
);
|
31 |
-
|
32 |
-
if ( ! empty( $oauth_files[$class_name] ) ) {
|
33 |
-
if ( file_exists( $path . '/' . $oauth_files[$class_name] . '.php' ) ) {
|
34 |
-
require_once( $path . '/' . $oauth_files[$class_name] . '.php' );
|
35 |
-
}
|
36 |
-
|
37 |
-
}
|
38 |
-
|
39 |
-
}
|
40 |
-
|
41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/yoast/api-libs/googleanalytics/class-google-analytics-client.php
DELETED
@@ -1,182 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Yoast_Google_Analytics_Client extends Yoast_Google_Client {
|
4 |
-
|
5 |
-
protected $http_response_code;
|
6 |
-
|
7 |
-
const OPTION_REFRESH_TOKEN = 'yoast-ga-refresh_token';
|
8 |
-
|
9 |
-
protected $default_config = array(
|
10 |
-
'redirect_uri' => 'urn:ietf:wg:oauth:2.0:oob',
|
11 |
-
'scopes' => array( 'https://www.googleapis.com/auth/analytics.readonly' ),
|
12 |
-
);
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Initialize the config and refresh the token
|
16 |
-
*
|
17 |
-
* @param array $config
|
18 |
-
*/
|
19 |
-
public function __construct( $config ) {
|
20 |
-
|
21 |
-
parent::__construct();
|
22 |
-
|
23 |
-
// Initialize the config to set all properties properly
|
24 |
-
$this->init_config( $config );
|
25 |
-
|
26 |
-
// Let's get an access token if we've got a refresh token
|
27 |
-
$this->refresh_tokens();
|
28 |
-
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Initialize the config, will merge given config with default config to be sure all settings are available
|
33 |
-
*
|
34 |
-
* @param $config
|
35 |
-
*/
|
36 |
-
protected function init_config( $config ) {
|
37 |
-
$config = array_merge( $config, $this->default_config );
|
38 |
-
|
39 |
-
if ( ! empty( $config['application_name'] ) ) {
|
40 |
-
$this->setApplicationName( $config['application_name'] );
|
41 |
-
} else {
|
42 |
-
// @todo: throw new error
|
43 |
-
|
44 |
-
}
|
45 |
-
|
46 |
-
if ( ! empty( $config['client_id'] ) ) {
|
47 |
-
$this->setClientId( $config['client_id'] );
|
48 |
-
} else {
|
49 |
-
// @todo: throw new error
|
50 |
-
|
51 |
-
}
|
52 |
-
|
53 |
-
if ( ! empty( $config['client_secret'] ) ) {
|
54 |
-
$this->setClientSecret( $config['client_secret'] );
|
55 |
-
} else {
|
56 |
-
// @todo: throw new error
|
57 |
-
}
|
58 |
-
|
59 |
-
// Set our settings
|
60 |
-
$this->setRedirectUri( $config['redirect_uri'] );
|
61 |
-
$this->setScopes( $config['scopes'] );
|
62 |
-
$this->setAccessType( 'offline' );
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Refeshing the tokens
|
67 |
-
*/
|
68 |
-
protected function refresh_tokens() {
|
69 |
-
$refresh_token = $this->get_refresh_token();
|
70 |
-
|
71 |
-
if ( '' != $refresh_token ) {
|
72 |
-
try {
|
73 |
-
// Refresh the token
|
74 |
-
$response = $this->refreshToken( $refresh_token );
|
75 |
-
|
76 |
-
|
77 |
-
// Check response
|
78 |
-
if ( ! empty( $response ) ) {
|
79 |
-
$response = json_decode( $response );
|
80 |
-
|
81 |
-
// Check if there is an access_token
|
82 |
-
if ( isset( $response->access_token ) ) {
|
83 |
-
// Set access_token
|
84 |
-
$this->setAccessToken( $response->access_token );
|
85 |
-
}
|
86 |
-
}
|
87 |
-
} catch ( Exception $e ) {
|
88 |
-
|
89 |
-
}
|
90 |
-
}
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Authenticate the client. If $authorization_code is empty it will lead the user through the validation process of
|
95 |
-
* Google. If set it will be get the access token for current session and save the refresh_token for future use
|
96 |
-
*
|
97 |
-
* @param mixed $authorization_code
|
98 |
-
*
|
99 |
-
* @return bool
|
100 |
-
*/
|
101 |
-
public function authenticate_client( $authorization_code = null ) {
|
102 |
-
static $has_retried;
|
103 |
-
|
104 |
-
// Authenticate client
|
105 |
-
try {
|
106 |
-
$this->authenticate( $authorization_code );
|
107 |
-
|
108 |
-
// Get access response
|
109 |
-
$response = $this->getAccessToken();
|
110 |
-
|
111 |
-
// Check if there is a response body
|
112 |
-
if ( ! empty( $response ) ) {
|
113 |
-
$response = json_decode( $response );
|
114 |
-
|
115 |
-
if ( is_object( $response ) ) {
|
116 |
-
// Save the refresh token
|
117 |
-
$this->save_refresh_token( $response->refresh_token );
|
118 |
-
|
119 |
-
return true;
|
120 |
-
}
|
121 |
-
|
122 |
-
}
|
123 |
-
} catch ( Yoast_Google_AuthException $exception ) {
|
124 |
-
// If there aren't any attempts before, try again and set attempts on true, to prevent further attempts
|
125 |
-
if ( empty( $has_retried ) ) {
|
126 |
-
$has_retried = true;
|
127 |
-
|
128 |
-
return $this->authenticate_client( $authorization_code );
|
129 |
-
}
|
130 |
-
}
|
131 |
-
|
132 |
-
return false;
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* Doing a request to the API
|
137 |
-
*
|
138 |
-
* @param string $target_request_url
|
139 |
-
*
|
140 |
-
* @return Google_HttpRequest
|
141 |
-
*/
|
142 |
-
|
143 |
-
public function do_request( $target_request_url ) {
|
144 |
-
// Do list sites request
|
145 |
-
$request = new Yoast_Google_HttpRequest( $target_request_url );
|
146 |
-
|
147 |
-
// Get list sites response
|
148 |
-
$response = $this->getIo()->authenticatedRequest( $request );
|
149 |
-
|
150 |
-
$this->http_response_code = $response->getResponseHttpCode();
|
151 |
-
|
152 |
-
return $response;
|
153 |
-
}
|
154 |
-
|
155 |
-
/**
|
156 |
-
* Getting the response code, saved from latest request to Google
|
157 |
-
* @return mixed
|
158 |
-
*/
|
159 |
-
public function get_http_response_code() {
|
160 |
-
return $this->http_response_code;
|
161 |
-
}
|
162 |
-
|
163 |
-
|
164 |
-
/**
|
165 |
-
* Save the refresh token
|
166 |
-
*
|
167 |
-
* @param $refresh_token
|
168 |
-
*/
|
169 |
-
public function save_refresh_token( $refresh_token ) {
|
170 |
-
update_option( self::OPTION_REFRESH_TOKEN, trim( $refresh_token ) );
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Return refresh token
|
175 |
-
*
|
176 |
-
* @return string
|
177 |
-
*/
|
178 |
-
public function get_refresh_token() {
|
179 |
-
return get_option( self::OPTION_REFRESH_TOKEN, '' );
|
180 |
-
}
|
181 |
-
|
182 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/yoast/api-libs/tests/google/text-class-api-google.php
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Yoast_Api_Google_Test extends GA_UnitTestCase {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Test the autoload functionality
|
7 |
-
*/
|
8 |
-
public function test_autoload(){
|
9 |
-
$classes = array(
|
10 |
-
'Yoast_Google_Client',
|
11 |
-
'Yoast_Google_Model',
|
12 |
-
);
|
13 |
-
|
14 |
-
foreach( $classes as $class_name ) {
|
15 |
-
$this->assertTrue( class_exists( $class_name ) );
|
16 |
-
}
|
17 |
-
}
|
18 |
-
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/yoast/api-libs/tests/googleanalytics/test-class-api-googleanalytics.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Yoast_Api_Googleanalytics_Test extends GA_UnitTestCase {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Test the autoload functionality
|
7 |
-
*/
|
8 |
-
public function test_autoload(){
|
9 |
-
$this->assertTrue( class_exists( 'Yoast_Googleanalytics_Reporting' ) );
|
10 |
-
}
|
11 |
-
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/yoast/api-libs/tests/test-class-api-libs.php
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Yoast_Api_Libs_Test extends GA_UnitTestCase {
|
4 |
-
|
5 |
-
private $loaded_api_libs = 0;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Register API libs in the construct, so we don't need to do that every time
|
9 |
-
*/
|
10 |
-
public function __construct() {
|
11 |
-
$load_libraries = array( 'googleanalytics' );
|
12 |
-
$this->loaded_api_libs = count( $load_libraries );
|
13 |
-
|
14 |
-
Yoast_Api_Libs::load_api_libraries( $load_libraries );
|
15 |
-
|
16 |
-
parent::__construct();
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Count the result of activated API libs
|
21 |
-
*/
|
22 |
-
public function test_get_api_libs() {
|
23 |
-
$total_active = count( Yoast_Api_Libs::get_api_libs() );
|
24 |
-
|
25 |
-
$this->assertEquals( $this->loaded_api_libs, 1 );
|
26 |
-
}
|
27 |
-
|
28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|