Version Description
Release Date: November 26th, 2014
- Security fix: fixed a very minor cross site scripting issue with the manual UA code in de admin settings. The manual UA code is now sanitized before it is saved.
Download this release
Release Info
Developer | joostdevalk |
Plugin | Google Analytics for WordPress by MonsterInsights |
Version | 5.1.3 |
Comparing to | |
See all releases |
Code changes from version 5.1.2 to 5.1.3
- admin/api-libs/class-api-libs.php +8 -0
- admin/api-libs/googleanalytics/class-api-googleanalytics.php +50 -1
- admin/api-libs/googleanalytics/class-googleanalytics-reporting.php +0 -0
- admin/class-admin.php +4 -0
- admin/i18n-module/i18n-module.php +12 -7
- admin/license-manager/class-license-manager.php +4 -2
- googleanalytics.php +2 -2
- readme.txt +7 -1
admin/api-libs/class-api-libs.php
CHANGED
@@ -102,6 +102,14 @@ if ( ! class_exists( 'Yoast_Api_Libs' ) ) {
|
|
102 |
return false;
|
103 |
}
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
/**
|
106 |
* Execute a call with this method
|
107 |
*
|
102 |
return false;
|
103 |
}
|
104 |
|
105 |
+
public function get_instance( $name ) {
|
106 |
+
if ( isset( self::$instances[$name] ) ) {
|
107 |
+
return self::$instances[$name];
|
108 |
+
}
|
109 |
+
|
110 |
+
return false;
|
111 |
+
}
|
112 |
+
|
113 |
/**
|
114 |
* Execute a call with this method
|
115 |
*
|
admin/api-libs/googleanalytics/class-api-googleanalytics.php
CHANGED
@@ -10,7 +10,7 @@ if ( ! class_exists( 'Yoast_Api_Googleanalytics' ) ) {
|
|
10 |
* This class will be loaded when someone calls the API library with the Google analytics module
|
11 |
*/
|
12 |
public function __construct() {
|
13 |
-
|
14 |
}
|
15 |
|
16 |
/**
|
@@ -18,6 +18,7 @@ if ( ! class_exists( 'Yoast_Api_Googleanalytics' ) ) {
|
|
18 |
*/
|
19 |
private function load_api_oauth_files() {
|
20 |
$oauth_files = array(
|
|
|
21 |
);
|
22 |
|
23 |
foreach ( $oauth_files as $key => $name ) {
|
@@ -27,6 +28,54 @@ if ( ! class_exists( 'Yoast_Api_Googleanalytics' ) ) {
|
|
27 |
}
|
28 |
}
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
|
32 |
}
|
10 |
* This class will be loaded when someone calls the API library with the Google analytics module
|
11 |
*/
|
12 |
public function __construct() {
|
13 |
+
|
14 |
}
|
15 |
|
16 |
/**
|
18 |
*/
|
19 |
private function load_api_oauth_files() {
|
20 |
$oauth_files = array(
|
21 |
+
'yoast_api_googleanalytics_reporting' => 'class-googleanalytics-reporting',
|
22 |
);
|
23 |
|
24 |
foreach ( $oauth_files as $key => $name ) {
|
28 |
}
|
29 |
}
|
30 |
|
31 |
+
/**
|
32 |
+
* Doing request to Google Analytics
|
33 |
+
*
|
34 |
+
* This method will do a request to google and get the response code and body from content
|
35 |
+
*
|
36 |
+
* @param string $target_url
|
37 |
+
* @param string $scope
|
38 |
+
* @param string $access_token
|
39 |
+
* @param string secret
|
40 |
+
*
|
41 |
+
* @return array|null
|
42 |
+
*/
|
43 |
+
public function do_request( $target_url, $scope, $access_token, $secret ) {
|
44 |
+
$gdata = $this->get_gdata( $scope, $access_token, $secret );
|
45 |
+
$response = $gdata->get( $target_url );
|
46 |
+
$http_code = wp_remote_retrieve_response_code( $response );
|
47 |
+
$response = wp_remote_retrieve_body( $response );
|
48 |
+
|
49 |
+
if ( $http_code == 200 ) {
|
50 |
+
return array(
|
51 |
+
'response' => array( 'code' => $http_code ),
|
52 |
+
'body' => $response,
|
53 |
+
);
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Getting WP_GData object
|
59 |
+
*
|
60 |
+
* If not available include class file and create an instance of WP_GDAta
|
61 |
+
*
|
62 |
+
* @param string $scope
|
63 |
+
* @param null $token
|
64 |
+
* @param null $secret
|
65 |
+
*
|
66 |
+
* @return WP_GData
|
67 |
+
*/
|
68 |
+
protected function get_gdata( $scope, $token = null, $secret = null ) {
|
69 |
+
$args = array(
|
70 |
+
'scope' => $scope,
|
71 |
+
'xoauth_displayname' => 'Google Analytics by Yoast',
|
72 |
+
);
|
73 |
+
|
74 |
+
$gdata = new WP_GData( $args, $token, $secret );
|
75 |
+
|
76 |
+
return $gdata;
|
77 |
+
}
|
78 |
+
|
79 |
}
|
80 |
|
81 |
}
|
admin/api-libs/googleanalytics/class-googleanalytics-reporting.php
ADDED
File without changes
|
admin/class-admin.php
CHANGED
@@ -84,6 +84,9 @@ if ( ! class_exists( 'Yoast_GA_Admin' ) ) {
|
|
84 |
public function save_settings( $data ) {
|
85 |
foreach ( $data as $key => $value ) {
|
86 |
if ( $key != 'return_tab' ) {
|
|
|
|
|
|
|
87 |
$this->options[$key] = $value;
|
88 |
}
|
89 |
}
|
@@ -206,6 +209,7 @@ if ( ! class_exists( 'Yoast_GA_Admin' ) ) {
|
|
206 |
'register_url ' => 'http://translate.yoast.com/projects#utm_source=plugin&utm_medium=promo-box&utm_campaign=yoast-ga-i18n-promo',
|
207 |
)
|
208 |
);
|
|
|
209 |
return $yoast_ga_i18n;
|
210 |
}
|
211 |
|
84 |
public function save_settings( $data ) {
|
85 |
foreach ( $data as $key => $value ) {
|
86 |
if ( $key != 'return_tab' ) {
|
87 |
+
if ( $key != 'custom_code' ) {
|
88 |
+
$value = strip_tags( $value );
|
89 |
+
}
|
90 |
$this->options[$key] = $value;
|
91 |
}
|
92 |
}
|
209 |
'register_url ' => 'http://translate.yoast.com/projects#utm_source=plugin&utm_medium=promo-box&utm_campaign=yoast-ga-i18n-promo',
|
210 |
)
|
211 |
);
|
212 |
+
|
213 |
return $yoast_ga_i18n;
|
214 |
}
|
215 |
|
admin/i18n-module/i18n-module.php
CHANGED
@@ -167,11 +167,11 @@ class yoast_i18n {
|
|
167 |
$message = false;
|
168 |
|
169 |
if ( $this->translation_loaded && $this->percent_translated < 90 ) {
|
170 |
-
$message = __( 'As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help complete the translation to %1$s!',
|
171 |
} else if ( ! $this->translation_loaded && $this->translation_exists ) {
|
172 |
-
$message = __( 'You\'re using WordPress in %1$s. While %2$s has been translated to %1$s for %3$d%%, it\'s not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!',
|
173 |
} else if ( ! $this->translation_loaded && ! $this->translation_exists ) {
|
174 |
-
$message = __( 'You\'re using WordPress in
|
175 |
}
|
176 |
|
177 |
$registration_link = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $this->register_url ), esc_html( $this->glotpress_name ) );
|
@@ -191,12 +191,12 @@ class yoast_i18n {
|
|
191 |
if ( $message ) {
|
192 |
echo '<div id="i18n_promo_box" style="border:1px solid #ccc;background-color:#fff;padding:10px;max-width:650px;">';
|
193 |
echo '<a href="' . add_query_arg( array( 'remove_i18n_promo' => '1' ) ) . '" style="color:#333;text-decoration:none;font-weight:bold;font-size:16px;border:1px solid #ccc;padding:1px 4px;" class="alignright">X</a>';
|
194 |
-
echo '<h2>' . sprintf( __( 'Translation of %s',
|
195 |
if ( isset( $this->glotpress_logo ) && '' != $this->glotpress_logo ) {
|
196 |
echo '<a href="' . $this->register_url . '"><img class="alignright" style="margin:15px 5px 5px 5px;width:200px;" src="' . $this->glotpress_logo . '" alt="' . $this->glotpress_name . '"/></a>';
|
197 |
}
|
198 |
echo '<p>' . $message . '</p>';
|
199 |
-
echo '<p><a href="' . $this->register_url . '">' . __( 'Register now »',
|
200 |
echo '</div>';
|
201 |
}
|
202 |
}
|
@@ -267,7 +267,12 @@ class yoast_i18n {
|
|
267 |
* @access private
|
268 |
*/
|
269 |
private function parse_translation_set( $set ) {
|
270 |
-
$this->
|
271 |
-
|
|
|
|
|
|
|
|
|
|
|
272 |
}
|
273 |
}
|
167 |
$message = false;
|
168 |
|
169 |
if ( $this->translation_loaded && $this->percent_translated < 90 ) {
|
170 |
+
$message = __( 'As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help complete the translation to %1$s!', $this->textdomain );
|
171 |
} else if ( ! $this->translation_loaded && $this->translation_exists ) {
|
172 |
+
$message = __( 'You\'re using WordPress in %1$s. While %2$s has been translated to %1$s for %3$d%%, it\'s not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', $this->textdomain );
|
173 |
} else if ( ! $this->translation_loaded && ! $this->translation_exists ) {
|
174 |
+
$message = __( 'You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', $this->textdomain );
|
175 |
}
|
176 |
|
177 |
$registration_link = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $this->register_url ), esc_html( $this->glotpress_name ) );
|
191 |
if ( $message ) {
|
192 |
echo '<div id="i18n_promo_box" style="border:1px solid #ccc;background-color:#fff;padding:10px;max-width:650px;">';
|
193 |
echo '<a href="' . add_query_arg( array( 'remove_i18n_promo' => '1' ) ) . '" style="color:#333;text-decoration:none;font-weight:bold;font-size:16px;border:1px solid #ccc;padding:1px 4px;" class="alignright">X</a>';
|
194 |
+
echo '<h2>' . sprintf( __( 'Translation of %s', $this->textdomain ), $this->plugin_name ) . '</h2>';
|
195 |
if ( isset( $this->glotpress_logo ) && '' != $this->glotpress_logo ) {
|
196 |
echo '<a href="' . $this->register_url . '"><img class="alignright" style="margin:15px 5px 5px 5px;width:200px;" src="' . $this->glotpress_logo . '" alt="' . $this->glotpress_name . '"/></a>';
|
197 |
}
|
198 |
echo '<p>' . $message . '</p>';
|
199 |
+
echo '<p><a href="' . $this->register_url . '">' . __( 'Register now »', $this->textdomain ) . '</a></p>';
|
200 |
echo '</div>';
|
201 |
}
|
202 |
}
|
267 |
* @access private
|
268 |
*/
|
269 |
private function parse_translation_set( $set ) {
|
270 |
+
if ( $this->translation_exists ) {
|
271 |
+
$this->locale_name = $set->name;
|
272 |
+
$this->percent_translated = $set->percent_translated;
|
273 |
+
} else {
|
274 |
+
$this->locale_name = '';
|
275 |
+
$this->percent_translated = '';
|
276 |
+
}
|
277 |
}
|
278 |
}
|
admin/license-manager/class-license-manager.php
CHANGED
@@ -175,11 +175,13 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
|
|
175 |
// show success notice if license is valid
|
176 |
if($result->license === 'valid') {
|
177 |
|
|
|
|
|
178 |
// show a custom notice if users have an unlimited license
|
179 |
if( $result->license_limit == 0 ) {
|
180 |
-
$message
|
181 |
} else {
|
182 |
-
$message
|
183 |
}
|
184 |
|
185 |
// add upgrade notice if user has less than 3 activations left
|
175 |
// show success notice if license is valid
|
176 |
if($result->license === 'valid') {
|
177 |
|
178 |
+
$message = sprintf( __( "Your %s license has been activated. ", $this->product->get_text_domain() ), $this->product->get_item_name() );
|
179 |
+
|
180 |
// show a custom notice if users have an unlimited license
|
181 |
if( $result->license_limit == 0 ) {
|
182 |
+
$message .= __( "You have an unlimited license. ", $this->product->get_text_domain() );
|
183 |
} else {
|
184 |
+
$message .= sprintf( __( "You have used %d/%d activations. ", $this->product->get_text_domain() ), $result->site_count, $result->license_limit );
|
185 |
}
|
186 |
|
187 |
// add upgrade notice if user has less than 3 activations left
|
googleanalytics.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Google Analytics by Yoast
|
|
4 |
Plugin URI: https://yoast.com/wordpress/plugins/google-analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=wpgaplugin&utm_content=v504
|
5 |
Description: This plugin makes it simple to add Google Analytics to your WordPress blog, adding lots of features, eg. error page, search result and automatic clickout and download tracking.
|
6 |
Author: Team Yoast
|
7 |
-
Version: 5.1.
|
8 |
Requires at least: 3.8
|
9 |
Author URI: https://yoast.com/
|
10 |
License: GPL v3
|
@@ -30,7 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
30 |
|
31 |
// This plugin was originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics, but has since been rewritten and refactored multiple times.
|
32 |
|
33 |
-
define( 'GAWP_VERSION', '5.1.
|
34 |
|
35 |
define( 'GAWP_FILE', __FILE__ );
|
36 |
|
4 |
Plugin URI: https://yoast.com/wordpress/plugins/google-analytics/#utm_source=wordpress&utm_medium=plugin&utm_campaign=wpgaplugin&utm_content=v504
|
5 |
Description: This plugin makes it simple to add Google Analytics to your WordPress blog, adding lots of features, eg. error page, search result and automatic clickout and download tracking.
|
6 |
Author: Team Yoast
|
7 |
+
Version: 5.1.3
|
8 |
Requires at least: 3.8
|
9 |
Author URI: https://yoast.com/
|
10 |
License: GPL v3
|
30 |
|
31 |
// This plugin was originally based on Rich Boakes' Analytics plugin: http://boakes.org/analytics, but has since been rewritten and refactored multiple times.
|
32 |
|
33 |
+
define( 'GAWP_VERSION', '5.1.3' );
|
34 |
|
35 |
define( 'GAWP_FILE', __FILE__ );
|
36 |
|
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.0
|
7 |
-
Stable tag: 5.1.
|
8 |
|
9 |
Track your WordPress site easily with the latest tracking codes and lots added data for search result pages and error pages.
|
10 |
|
@@ -49,6 +49,12 @@ This section describes how to install the plugin and get it working.
|
|
49 |
|
50 |
== Changelog ==
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
= 5.1.2 =
|
53 |
|
54 |
Release Date: November 19th, 2014
|
4 |
Tags: analytics, google analytics, statistics, tracking, stats, google, yoast
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.0
|
7 |
+
Stable tag: 5.1.3
|
8 |
|
9 |
Track your WordPress site easily with the latest tracking codes and lots added data for search result pages and error pages.
|
10 |
|
49 |
|
50 |
== Changelog ==
|
51 |
|
52 |
+
= 5.1.3 =
|
53 |
+
|
54 |
+
Release Date: November 26th, 2014
|
55 |
+
|
56 |
+
* Security fix: fixed a very minor cross site scripting issue with the manual UA code in de admin settings. The manual UA code is now sanitized before it is saved.
|
57 |
+
|
58 |
= 5.1.2 =
|
59 |
|
60 |
Release Date: November 19th, 2014
|