MetaSlider - Version 3.18.8

Version Description

  • 2020/Nov/2 =

  • TWEAK: Pass callback function to Appsero instead of relying on caching.

  • TWEAK: Switches Appsero integration to only collected info on the user that logged in.

  • FIX: Adds PHP5.3 compatibility by removing array shorthand syntax

Download this release

Release Info

Developer metaslider
Plugin Icon 128x128 MetaSlider
Version 3.18.8
Comparing to
See all releases

Code changes from version 3.18.7 to 3.18.8

Files changed (3) hide show
  1. admin/support/Analytics.php +28 -14
  2. ml-slider.php +2 -2
  3. readme.txt +7 -1
admin/support/Analytics.php CHANGED
@@ -18,7 +18,7 @@ class MetaSlider_Analytics
18
  /**
19
  * @var array $whereToShow
20
  */
21
- public $whereToShow = ['plugins', 'dashboard'];
22
 
23
  /**
24
  * Start various analytics systems
@@ -142,6 +142,7 @@ class MetaSlider_Analytics
142
  if (!class_exists('MSAppsero/Client')) {
143
  require_once(METASLIDER_PATH . 'lib/appsero/src/Client.php');
144
  }
 
145
  $client = new MSAppsero\Client($key, $name, $path);
146
  $this->appsero = $client->insights();
147
  return $this;
@@ -158,11 +159,10 @@ class MetaSlider_Analytics
158
  return;
159
  }
160
 
161
- $extra = $this->extraDataToCollect();
162
  if (self::siteIsOptin()) {
163
  // If the user has opted in to sharing data with MetaSlider, we can skip the Appsero opt in
164
  // $this->appsero->hide_notice()->init()->optinIfNotAlready(); <-- would be nice
165
- $this->appsero->hide_notice()->add_extra($extra)->init();
166
  if (get_option('ml-slider_allow_tracking') === 'no') {
167
  $this->appsero->optin();
168
  }
@@ -170,7 +170,7 @@ class MetaSlider_Analytics
170
  // Here we are hiding the notice for users that aren't opted in, because we are serving our own notices
171
  // We will make sure they are opted out from appsero too. Note, this initializes, but that's just for
172
  // showing the notice and doesn't do any actual tracking unless the user approves.
173
- $this->appsero->hide_notice()->add_extra($extra)->init();
174
  if (get_option('ml-slider_allow_tracking') === 'yes') {
175
  $this->appsero->optout();
176
  }
@@ -178,15 +178,33 @@ class MetaSlider_Analytics
178
  }
179
 
180
  /**
181
- * Add some extra fields
 
182
  *
183
- * @return void
 
 
184
  */
185
- private function extraDataToCollect()
186
  {
187
- if ($cache = get_transient('metaslider_extra_analytics_data')) {
188
- return $cache;
189
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  try {
191
  $sliders_count = new WP_Query(array(
192
  'post_type' => 'ml-slider',
@@ -201,8 +219,6 @@ class MetaSlider_Analytics
201
  'optin_via' => get_option('metaslider_optin_via'),
202
  'slider_count' => $sliders_count ? $sliders_count->found_posts : 0
203
  );
204
- // Cache one day
205
- set_transient('metaslider_extra_analytics_data', $data, 86400);
206
  return $data;
207
  } catch (\Throwable $th) {
208
  return array();
@@ -253,7 +269,6 @@ class MetaSlider_Analytics
253
  */
254
  public function optin()
255
  {
256
- delete_transient('metaslider_extra_analytics_data');
257
  $current_user = wp_get_current_user();
258
  update_option('metaslider_optin_user_extras', array(
259
  'id' => $current_user->ID,
@@ -263,8 +278,7 @@ class MetaSlider_Analytics
263
  ));
264
 
265
  if ($this->appsero) {
266
- $extra = $this->extraDataToCollect();
267
- $this->appsero->hide_notice()->add_extra($extra)->init();
268
  $this->appsero->optin();
269
  }
270
 
18
  /**
19
  * @var array $whereToShow
20
  */
21
+ public $whereToShow = array('plugins', 'dashboard');
22
 
23
  /**
24
  * Start various analytics systems
142
  if (!class_exists('MSAppsero/Client')) {
143
  require_once(METASLIDER_PATH . 'lib/appsero/src/Client.php');
144
  }
145
+ add_filter('ml-slider_tracker_data', array($this, 'filterTrackingData'));
146
  $client = new MSAppsero\Client($key, $name, $path);
147
  $this->appsero = $client->insights();
148
  return $this;
159
  return;
160
  }
161
 
 
162
  if (self::siteIsOptin()) {
163
  // If the user has opted in to sharing data with MetaSlider, we can skip the Appsero opt in
164
  // $this->appsero->hide_notice()->init()->optinIfNotAlready(); <-- would be nice
165
+ $this->appsero->hide_notice()->add_extra(array($this, 'extraDataToCollect'))->init();
166
  if (get_option('ml-slider_allow_tracking') === 'no') {
167
  $this->appsero->optin();
168
  }
170
  // Here we are hiding the notice for users that aren't opted in, because we are serving our own notices
171
  // We will make sure they are opted out from appsero too. Note, this initializes, but that's just for
172
  // showing the notice and doesn't do any actual tracking unless the user approves.
173
+ $this->appsero->hide_notice()->add_extra(array($this, 'extraDataToCollect'))->init();
174
  if (get_option('ml-slider_allow_tracking') === 'yes') {
175
  $this->appsero->optout();
176
  }
178
  }
179
 
180
  /**
181
+ * Filter Appsero's data
182
+ * - We want the user that opts in, not the first admin user
183
  *
184
+ * @var array $data - The data from Appsero
185
+ *
186
+ * @return array
187
  */
188
+ public function filterTrackingData($data)
189
  {
190
+ if (!$extras = get_option('metaslider_optin_user_extras')) {
191
+ return $data;
192
  }
193
+ if ($admin_user = get_userdata($extras['id'])) {
194
+ $data['admin_email'] = $admin_user->user_email;
195
+ $data['first_name'] = $admin_user->first_name ? $admin_user->first_name : $admin_user->display_name;
196
+ $data['last_name'] = $admin_user->last_name;
197
+ }
198
+ return $data;
199
+ }
200
+
201
+ /**
202
+ * Add some extra fields - This is called async now so no need to cache it.
203
+ *
204
+ * @return void
205
+ */
206
+ public function extraDataToCollect()
207
+ {
208
  try {
209
  $sliders_count = new WP_Query(array(
210
  'post_type' => 'ml-slider',
219
  'optin_via' => get_option('metaslider_optin_via'),
220
  'slider_count' => $sliders_count ? $sliders_count->found_posts : 0
221
  );
 
 
222
  return $data;
223
  } catch (\Throwable $th) {
224
  return array();
269
  */
270
  public function optin()
271
  {
 
272
  $current_user = wp_get_current_user();
273
  update_option('metaslider_optin_user_extras', array(
274
  'id' => $current_user->ID,
278
  ));
279
 
280
  if ($this->appsero) {
281
+ $this->appsero->hide_notice()->add_extra(array($this, 'extraDataToCollect'))->init();
 
282
  $this->appsero->optin();
283
  }
284
 
ml-slider.php CHANGED
@@ -6,7 +6,7 @@
6
  * Plugin Name: MetaSlider
7
  * Plugin URI: https://www.metaslider.com
8
  * Description: Easy to use slideshow plugin. Create SEO optimised responsive slideshows with Nivo Slider, Flex Slider, Coin Slider and Responsive Slides.
9
- * Version: 3.18.7
10
  * Author: MetaSlider
11
  * Author URI: https://www.metaslider.com
12
  * License: GPL-2.0+
@@ -35,7 +35,7 @@ class MetaSliderPlugin
35
  *
36
  * @var string
37
  */
38
- public $version = '3.18.7';
39
 
40
  /**
41
  * Pro installed version number
6
  * Plugin Name: MetaSlider
7
  * Plugin URI: https://www.metaslider.com
8
  * Description: Easy to use slideshow plugin. Create SEO optimised responsive slideshows with Nivo Slider, Flex Slider, Coin Slider and Responsive Slides.
9
+ * Version: 3.18.8
10
  * Author: MetaSlider
11
  * Author URI: https://www.metaslider.com
12
  * License: GPL-2.0+
35
  *
36
  * @var string
37
  */
38
+ public $version = '3.18.8';
39
 
40
  /**
41
  * Pro installed version number
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: matchalabs, DavidAnderson, dnutbourne, kbat82
3
  Tags: slideshow, slider, image slider, carousel, gallery, flexslider, wordpress slider, nivoslider, rotating banner, responsive slideshow, seo slideshow, unsplash
4
  Requires at least: 3.5
5
- Stable tag: 3.18.7
6
  Requires PHP: 5.2
7
  Tested up to: 5.5
8
  License: GPLv2 or later
@@ -173,6 +173,12 @@ See https://www.metaslider.com/documentation/image-cropping/
173
 
174
  == Changelog ==
175
 
 
 
 
 
 
 
176
  = 3.18.7 - 2020/Oct/27 =
177
 
178
  * TWEAK: Clean up some of the Analytic specific items and reporting bugs. Note: no bugs related to improper handling.
2
  Contributors: matchalabs, DavidAnderson, dnutbourne, kbat82
3
  Tags: slideshow, slider, image slider, carousel, gallery, flexslider, wordpress slider, nivoslider, rotating banner, responsive slideshow, seo slideshow, unsplash
4
  Requires at least: 3.5
5
+ Stable tag: 3.18.8
6
  Requires PHP: 5.2
7
  Tested up to: 5.5
8
  License: GPLv2 or later
173
 
174
  == Changelog ==
175
 
176
+ = 3.18.8 - 2020/Nov/2 =
177
+
178
+ * TWEAK: Pass callback function to Appsero instead of relying on caching.
179
+ * TWEAK: Switches Appsero integration to only collected info on the user that logged in.
180
+ * FIX: Adds PHP5.3 compatibility by removing array shorthand syntax
181
+
182
  = 3.18.7 - 2020/Oct/27 =
183
 
184
  * TWEAK: Clean up some of the Analytic specific items and reporting bugs. Note: no bugs related to improper handling.