Sidekick - Version 2.5.3

Version Description

  • Add network activated plugins to compatibilities list
  • MU Plugins now have versions available for compatibility filtering
  • Optimize the multisite admin loading screen
  • Fixes just activated setting
Download this release

Release Info

Developer raptor235
Plugin Icon 128x128 Sidekick
Version 2.5.3
Comparing to
See all releases

Code changes from version 2.5.0 to 2.5.3

js/sidekick_admin.js CHANGED
@@ -204,9 +204,11 @@ function updateStatCounts(increment){
204
 
205
  function sk_populate(data){
206
 
 
 
207
  jQuery('.sk_walkthrough_list').html('');
208
 
209
- _.each(data.products,function(item,key){
210
 
211
  if (!item.cacheId) {
212
  return false;
@@ -222,6 +224,7 @@ function sk_populate(data){
222
  sk_config.disable_network_wts = JSON.parse(sk_config.disable_network_wts);
223
  };
224
 
 
225
  if (sk_config.disable_wts) {
226
  currently_disabled_wts = sk_config.disable_wts;
227
  sk_config.disable_wts = null;
@@ -309,178 +312,163 @@ function sk_populate(data){
309
 
310
  }
311
  });
312
- }); //
313
- } //
314
 
315
 
316
 
317
- function setup_events(){
318
- // console.log('setup_events');
319
 
320
- jQuery('.select_all').click(function(){
321
- var checkBoxes = jQuery(this).parent().find('input[type="checkbox"]');
322
 
323
- _.each(checkBoxes,function(item,key){
324
- jQuery(item).attr("checked", !jQuery(item).attr("checked"));
325
- });
326
  });
 
327
 
328
- jQuery('[name="disable_wts[]"]').click(function(e){
329
 
330
- if (e.currentTarget.checked) {
331
- jQuery('input[value="' + e.currentTarget.value + '"]').attr('checked',true);
332
- } else {
333
- jQuery('input[value="' + e.currentTarget.value + '"]').attr('checked',false);
334
- }
335
 
336
- });
337
 
338
- jQuery('.activate_all').click(function(){
339
- jQuery('.activate_sk').each(function(key,item){
340
- setTimeout(function() {
341
- jQuery(item).trigger('click');
342
- }, key*1000);
343
- });
344
  });
 
345
 
346
- jQuery('.sk_bucket').not(':has(li)').remove();
347
- jQuery('.sk_product').not(':has(li)').remove();
348
 
349
- // Set the disable_wts back to original state
350
- sk_config.disable_wts = currently_disabled_wts;
351
- sk_config.disable_network_wts = currently_disabled_network_wts;
352
- }
353
 
354
- function load_sk_library($key){
355
 
356
- // TODO we need to switch based on library to distribute and load the right library
357
 
358
- // console.log('BBBB load_sk_library %o', $key);
359
- var sk_url;
360
 
361
- if (loadCount > 5) {
362
- console.warn('Something is wrong...');
363
- return false;
364
- }
365
 
366
- if ($key) {
367
- sk_url = sk_config.library + 'domains/cache?domainKey=' + $key;
368
- } else {
369
- sk_url = sk_config.library + 'platform/cache?platformId=1';
370
- }
371
 
372
- loadCount++;
373
 
374
- jQuery.ajax({
375
- url: sk_url,
376
- error: function(data){
377
- jQuery('.sk_license_status span').html('Invalid Key').css({color: 'red'});
378
- jQuery('.sk_upgrade').show();
379
- load_sk_library();
380
- },
381
- success: function(data){
382
-
383
- if (sk_config.library + 'domains/cache?domainKey=' + sk_config.activation_id == sk_url) {
384
- if (!data.payload) {
385
- jQuery('.sk_license_status').html('Invalid Key').css({color: 'red'});
386
- } else {
387
- jQuery('.sk_license_status').html('Valid').css({color: 'green'});
388
- }
389
- }
390
 
 
391
  if (!data.payload) {
392
- load_sk_library();
393
- return false;
394
- }
395
-
396
- if (data.payload) {
397
- sk_populate(data.payload);
398
  }
399
  }
400
- });
401
- }
402
 
403
- jQuery(document).ready(function($) {
404
-
405
- if (jQuery('.sidekick_admin').length === 0) {
406
- return;
407
- }
408
-
409
- jQuery('.open_composer').click(function(e){
410
- e.preventDefault();
411
- jQuery('#toggle_composer').trigger('click');
412
- });
413
-
414
- if (typeof sk_ms_admin !== 'undefined' && sk_ms_admin) {
415
 
416
- // Multisite
417
- load_sites_by_status('unactivated');
418
 
419
- var clicked_button;
420
 
421
- if (typeof last_site_key !== 'undefined') {
422
- load_sk_library(last_site_key);
423
- } else {
424
- jQuery('.sk_box.configure').html('Need to activate at least one site to configure walkthroughs').show();
425
  }
 
 
 
426
 
427
- jQuery('.activate_sk').click(function(){
 
 
 
428
 
429
- clicked_button = this;
430
- jQuery('.single_activation_error').html('').hide();
 
 
431
 
432
- var data = {
433
- action: 'sk_activate_single',
434
- blog_id: jQuery(this).parent().data('blogid'),
435
- user_id: jQuery(this).parent().data('userid'),
436
- domain: jQuery(this).parent().data('domain'),
437
- path: jQuery(this).parent().data('path')
438
- };
439
 
440
- jQuery.post(ajaxurl, data, function(e){
 
441
 
442
- if (!e.success) {
443
- jQuery('.single_activation_error').html(e.message).show();
444
- jQuery(clicked_button).parent().html('- <span class="not_active">Error Activating</span>');
445
- } else if (e.success) {
446
- jQuery(clicked_button).parent().html('- <span class="green">Activated</span>');
447
- }
448
- },'json');
449
 
450
- });
 
 
 
 
451
 
 
452
 
 
 
453
 
454
- // if (jQuery('select[name="sk_selected_subscription"]').val().indexOf('roduct') > -1) {
455
- // jQuery('.walkthrough_library').show();
456
- // }
 
 
 
 
457
 
458
- // jQuery('select[name="sk_selected_subscription"]').on('change',function(){
459
- // if (jQuery('select[name="sk_selected_subscription"]').val().indexOf('roduct') > -1) {
460
- // jQuery('.walkthrough_library').show();
461
- // } else {
462
- // jQuery('.walkthrough_library').val(0);
463
- // jQuery('.walkthrough_library').hide();
464
- // }
465
- // });
466
 
467
- } else {
468
- jQuery(document).ready(function($) {
469
- if (sk_config.activation_id) {
470
- load_sk_library(sk_config.activation_id);
471
- } else {
472
- jQuery('.sk_upgrade').show();
473
  }
 
474
 
475
- jQuery('h3:contains(My Sidekick Account)').click(function(e){
476
- if (e.shiftKey) {
477
- jQuery('.advanced').show();
478
- }
479
- });
480
 
481
- });
482
- }
483
 
484
- });
 
 
 
 
485
 
 
 
 
 
 
 
 
486
 
 
 
 
204
 
205
  function sk_populate(data){
206
 
207
+ // console.log('sk_populate %o',data);
208
+
209
  jQuery('.sk_walkthrough_list').html('');
210
 
211
+ _.each(data,function(item,key){
212
 
213
  if (!item.cacheId) {
214
  return false;
224
  sk_config.disable_network_wts = JSON.parse(sk_config.disable_network_wts);
225
  };
226
 
227
+
228
  if (sk_config.disable_wts) {
229
  currently_disabled_wts = sk_config.disable_wts;
230
  sk_config.disable_wts = null;
312
 
313
  }
314
  });
315
+ });
316
+ }
317
 
318
 
319
 
320
+ function setup_events(){
 
321
 
322
+ jQuery('.select_all').click(function(){
323
+ var checkBoxes = jQuery(this).parent().find('input[type="checkbox"]');
324
 
325
+ _.each(checkBoxes,function(item,key){
326
+ jQuery(item).attr("checked", !jQuery(item).attr("checked"));
 
327
  });
328
+ });
329
 
330
+ jQuery('[name="disable_wts[]"]').click(function(e){
331
 
332
+ if (e.currentTarget.checked) {
333
+ jQuery('input[value="' + e.currentTarget.value + '"]').attr('checked',true);
334
+ } else {
335
+ jQuery('input[value="' + e.currentTarget.value + '"]').attr('checked',false);
336
+ }
337
 
338
+ });
339
 
340
+ jQuery('.activate_all').click(function(){
341
+ jQuery('.activate_sk').each(function(key,item){
342
+ setTimeout(function() {
343
+ jQuery(item).trigger('click');
344
+ }, key*1000);
 
345
  });
346
+ });
347
 
348
+ jQuery('.sk_bucket').not(':has(li)').remove();
349
+ jQuery('.sk_product').not(':has(li)').remove();
350
 
351
+ // Set the disable_wts back to original state
352
+ sk_config.disable_wts = currently_disabled_wts;
353
+ sk_config.disable_network_wts = currently_disabled_network_wts;
354
+ }
355
 
356
+ function load_sk_library($key){
357
 
358
+ // TODO we need to switch based on library to distribute and load the right library
359
 
360
+ // console.log('BBBB load_sk_library %o', $key);
361
+ var sk_url;
362
 
363
+ if (loadCount > 5) {
364
+ // console.warn('Something is wrong...');
365
+ return false;
366
+ }
367
 
368
+ if ($key) {
369
+ sk_url = sk_config.library + 'domains/cache?domainKey=' + $key;
370
+ } else {
371
+ sk_url = sk_config.library + 'platform/cache?platformId=1';
372
+ }
373
 
374
+ loadCount++;
375
 
376
+ jQuery.ajax({
377
+ url: sk_url,
378
+ error: function(data){
379
+ jQuery('.sk_license_status span').html('Invalid Key').css({color: 'red'});
380
+ jQuery('.sk_upgrade').show();
381
+ load_sk_library();
382
+ },
383
+ success: function(data){
 
 
 
 
 
 
 
 
384
 
385
+ if (sk_config.library + 'domains/cache?domainKey=' + sk_config.activation_id == sk_url) {
386
  if (!data.payload) {
387
+ jQuery('.sk_license_status').html('Invalid Key').css({color: 'red'});
388
+ } else {
389
+ jQuery('.sk_license_status').html('Valid').css({color: 'green'});
 
 
 
390
  }
391
  }
 
 
392
 
393
+ if (!data.payload) {
394
+ load_sk_library();
395
+ return false;
396
+ }
 
 
 
 
 
 
 
 
397
 
398
+ if (data.payload) {
 
399
 
400
+ sidekick.compatibilityModel.filter_products(data.payload.products);
401
 
402
+ sk_populate(sidekick.compatibilityModel.get('passed_products'));
 
 
 
403
  }
404
+ }
405
+ });
406
+ }
407
 
408
+ function setup_sk_admin(){
409
+ if (jQuery('.sidekick_admin').length === 0) {
410
+ return;
411
+ }
412
 
413
+ jQuery('.open_composer').click(function(e){
414
+ e.preventDefault();
415
+ jQuery('#toggle_composer').trigger('click');
416
+ });
417
 
418
+ if (typeof sk_ms_admin !== 'undefined' && sk_ms_admin) {
 
 
 
 
 
 
419
 
420
+ // Multisite
421
+ load_sites_by_status('unactivated');
422
 
423
+ var clicked_button;
 
 
 
 
 
 
424
 
425
+ if (typeof last_site_key !== 'undefined') {
426
+ load_sk_library(last_site_key);
427
+ } else {
428
+ jQuery('.sk_box.configure').html('Need to activate at least one site to configure walkthroughs').show();
429
+ }
430
 
431
+ jQuery('.activate_sk').click(function(){
432
 
433
+ clicked_button = this;
434
+ jQuery('.single_activation_error').html('').hide();
435
 
436
+ var data = {
437
+ action: 'sk_activate_single',
438
+ blog_id: jQuery(this).parent().data('blogid'),
439
+ user_id: jQuery(this).parent().data('userid'),
440
+ domain: jQuery(this).parent().data('domain'),
441
+ path: jQuery(this).parent().data('path')
442
+ };
443
 
444
+ jQuery.post(ajaxurl, data, function(e){
 
 
 
 
 
 
 
445
 
446
+ if (!e.success) {
447
+ jQuery('.single_activation_error').html(e.message).show();
448
+ jQuery(clicked_button).parent().html('- <span class="not_active">Error Activating</span>');
449
+ } else if (e.success) {
450
+ jQuery(clicked_button).parent().html('- <span class="green">Activated</span>');
 
451
  }
452
+ },'json');
453
 
454
+ });
 
 
 
 
455
 
456
+ } else {
 
457
 
458
+ if (sk_config.activation_id) {
459
+ load_sk_library(sk_config.activation_id);
460
+ } else {
461
+ jQuery('.sk_upgrade').show();
462
+ }
463
 
464
+ jQuery('h3:contains(My Sidekick Account)').click(function(e){
465
+ if (e.shiftKey) {
466
+ jQuery('.advanced').show();
467
+ }
468
+ });
469
+ }
470
+ }
471
 
472
+ window.onload = function(){
473
+ setup_sk_admin();
474
+ }
libs/admin_page.php CHANGED
@@ -56,7 +56,7 @@
56
 
57
  <tr valign="top">
58
  <th scope="row" valign="top">Status</th>
59
- <td><span style='color: blue' class='sk_license_status'><span><?php echo ucfirst($status) ?></span> <a style='display: none' class='sk_upgrade' href='http://www.sidekick.pro/modules/wordpress-core-module-premium/?utm_source=plugin&utm_medium=settings&utm_campaign=upgrade' target="_blank"> Upgrade Now!</a> </span></td>
60
  </tr>
61
 
62
  <tr valign="top">
@@ -90,9 +90,9 @@
90
  <div class="sk_box composer" style='display: none'>
91
  <div class="well">
92
  <h3>Build Your Own Walkthroughs</h3>
93
- <a href='http://www.sidekick.pro/plans/create_wp_walkthroughs/?utm_source=plugin&utm_medium=settings&utm_campaign=composer' target='_blank'><div class='composer_beta_button'>Build Your Own<br/>Walkthroughs</div></a>
94
  <ul>
95
- <li>Get more info about <a href='http://www.sidekick.pro/how-it-works/?utm_source=plugin&utm_medium=settings&utm_campaign=composer' target='_blank'>Custom Walkthroughs</a> now!</li>
96
  <li><a href="http://www.sidekick.pro/plans/create_wp_walkthroughs/?utm_source=plugin&utm_medium=settings&utm_campaign=composer" target="_blank">Check out our custom walkthroughs plans</a></li>
97
  </ul>
98
  </div>
@@ -107,7 +107,7 @@
107
  <li>Your Activation ID is unique and limited to your production, staging, and development urls.</li>
108
  <li>The Sidekick team adheres strictly to CANSPAM. From time to time we may send critical updates (such as security notices) to the email address setup as the Administrator on this site.</li>
109
  <li>If you have any questions, bug reports or feedback, please send them to <a target="_blank" href="mailto:support@sidekick.pro">us</a> </li>
110
- <li>You can find our terms of use <a target="_blank" href="http://www.sidekick.pro/terms-of-use/">here</a></li>
111
  </ul>
112
  </div>
113
  </div>
56
 
57
  <tr valign="top">
58
  <th scope="row" valign="top">Status</th>
59
+ <td><span style='color: blue' class='sk_license_status'><span><?php echo ucfirst($status) ?></span> <a style='display: none' class='sk_upgrade' href='http://www.sidekick.pro/modules/wordpress-core-module-premium/?utm_source=plugin&utm_medium=settings&utm_campaign=upgrade<?php echo ($affiliate_id) ? '&ref=' . $affiliate_id : '' ?>' target="_blank"> Upgrade Now!</a> </span></td>
60
  </tr>
61
 
62
  <tr valign="top">
90
  <div class="sk_box composer" style='display: none'>
91
  <div class="well">
92
  <h3>Build Your Own Walkthroughs</h3>
93
+ <a href='http://www.sidekick.pro/plans/create_wp_walkthroughs/?utm_source=plugin&utm_medium=settings&utm_campaign=composer<?php echo ($affiliate_id) ? '&ref=' . $affiliate_id : '' ?>' target='_blank'><div class='composer_beta_button'>Build Your Own<br/>Walkthroughs</div></a>
94
  <ul>
95
+ <li>Get more info about <a href='http://www.sidekick.pro/how-it-works/?utm_source=plugin&utm_medium=settings&utm_campaign=composer<?php echo ($affiliate_id) ? '&ref=' . $affiliate_id : '' ?>' target='_blank'>Custom Walkthroughs</a> now!</li>
96
  <li><a href="http://www.sidekick.pro/plans/create_wp_walkthroughs/?utm_source=plugin&utm_medium=settings&utm_campaign=composer" target="_blank">Check out our custom walkthroughs plans</a></li>
97
  </ul>
98
  </div>
107
  <li>Your Activation ID is unique and limited to your production, staging, and development urls.</li>
108
  <li>The Sidekick team adheres strictly to CANSPAM. From time to time we may send critical updates (such as security notices) to the email address setup as the Administrator on this site.</li>
109
  <li>If you have any questions, bug reports or feedback, please send them to <a target="_blank" href="mailto:support@sidekick.pro">us</a> </li>
110
+ <li>You can find our terms of use <a target="_blank" href="http://www.sidekick.pro/terms-of-use/<?php echo ($affiliate_id) ? '&ref=' . $affiliate_id : '' ?>">here</a></li>
111
  </ul>
112
  </div>
113
  </div>
libs/licensing.php CHANGED
@@ -95,7 +95,7 @@ if (!class_exists('sidekickMassActivator')) {
95
  }
96
  }
97
 
98
- function track($event, $data) {
99
  if (file_exists(realpath(dirname(__FILE__)) . '/mixpanel/Mixpanel.php')) {
100
  require_once(realpath(dirname(__FILE__)) . '/mixpanel/Mixpanel.php');
101
  $mp = Mixpanel::getInstance("965556434c5ae652a44f24b85b442263");
@@ -474,6 +474,7 @@ if (!class_exists('sidekickMassActivator')) {
474
  $sk_hide_config_taskbar_button = get_option('sk_hide_config_taskbar_button');
475
  $sk_hide_composer_upgrade_button = get_option('sk_hide_composer_upgrade_button');
476
  $is_ms_admin = true;
 
477
 
478
  $this->track(array('what' => 'Network Settings Page', 'where' => 'plugin'));
479
 
95
  }
96
  }
97
 
98
+ function track($event, $data = array()) {
99
  if (file_exists(realpath(dirname(__FILE__)) . '/mixpanel/Mixpanel.php')) {
100
  require_once(realpath(dirname(__FILE__)) . '/mixpanel/Mixpanel.php');
101
  $mp = Mixpanel::getInstance("965556434c5ae652a44f24b85b442263");
474
  $sk_hide_config_taskbar_button = get_option('sk_hide_config_taskbar_button');
475
  $sk_hide_composer_upgrade_button = get_option('sk_hide_composer_upgrade_button');
476
  $is_ms_admin = true;
477
+ $affiliate_id = $this->getAffiliateId();
478
 
479
  $this->track(array('what' => 'Network Settings Page', 'where' => 'plugin'));
480
 
libs/sk_config_data.php CHANGED
@@ -65,17 +65,17 @@ if (!class_exists('sk_config_data')) {
65
 
66
  // Can't find a good method to clear cache for newly registered post types that fires once
67
  // if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types_and_statuses' ) ) ) {
68
- $query = "SELECT post_type, post_status, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type, post_status";
69
- $counts = $wpdb->get_results($query);
70
- $result = array();
71
 
72
- foreach ($counts as $key => $type) {
73
- $type->post_type = str_replace('-', '_', $type->post_type);
74
- $type->post_status = str_replace('-', '_', $type->post_status);
75
 
76
- $result["post_type_{$type->post_type}_{$type->post_status}"] = intval($type->count);
77
- }
78
- set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types_and_statuses', $result, $this->cache_time );
79
  // }
80
 
81
  return $result;
@@ -85,14 +85,14 @@ if (!class_exists('sk_config_data')) {
85
  global $wpdb;
86
 
87
  // if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_taxonomies' ) ) ) {
88
- $query = "SELECT count(distinct term_taxonomy_id) as count, taxonomy from {$wpdb->prefix}term_taxonomy group by taxonomy";
89
- $counts = $wpdb->get_results($query);
90
 
91
- foreach ($counts as $key => $taxonomy) {
92
- $taxonomy->taxonomy = str_replace('-', '_', $taxonomy->taxonomy);
93
- $result["taxonomy_{$taxonomy->taxonomy}"] = intval($taxonomy->count);
94
- }
95
- set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_taxonomies', $result, $this->cache_time );
96
  // }
97
 
98
  return $result;
@@ -158,12 +158,12 @@ if (!class_exists('sk_config_data')) {
158
  foreach ($frameworks as $framework) {
159
  switch ($framework) {
160
  case 'genesis':
161
- if (function_exists( 'genesis' ) ) {
162
  if (defined('PARENT_THEME_VERSION')) {
163
  $result["theme_framework"] = array(
164
  "name" => $framework,
165
  "version" => PARENT_THEME_VERSION
166
- );
167
  }
168
  }
169
  break;
@@ -189,6 +189,7 @@ if (!class_exists('sk_config_data')) {
189
 
190
  function get_disabled_wts(){
191
  $wts = str_replace('"', '', get_option('sk_disabled_wts'));
 
192
  if ($wts) {
193
  return $wts;
194
  }
@@ -198,6 +199,7 @@ if (!class_exists('sk_config_data')) {
198
  function get_disabled_network_wts(){
199
  if (is_multisite()) {
200
  $wts = str_replace('"', '', get_site_option('sk_disabled_wts'));
 
201
  if ($wts) {
202
  return $wts;
203
  }
@@ -217,16 +219,42 @@ if (!class_exists('sk_config_data')) {
217
  $data = get_plugin_data( $plugin, false, false );
218
  $slug = explode('/',plugin_basename($plugin));
219
  $slug = str_replace('.php', '', $slug[1]);
220
- $result[$slug] = $data['Version'];
 
 
 
 
221
  }
222
  }
223
 
224
  if (is_array($mu_plugins)) {
225
  foreach ($mu_plugins as $plugins_key => $plugin) {
226
- $slug = str_replace('.php', '', $plugins_key);
227
- $result[$slug] = '1.0.0';
 
 
 
 
 
 
228
  }
229
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_plugins', $result, $this->cache_time );
231
  }
232
 
@@ -234,7 +262,9 @@ if (!class_exists('sk_config_data')) {
234
  }
235
 
236
  function get_user_role(){
237
- global $current_user, $wp_roles;
 
 
238
 
239
  if (is_super_admin($current_user->ID)) {
240
  return 'administrator';
65
 
66
  // Can't find a good method to clear cache for newly registered post types that fires once
67
  // if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types_and_statuses' ) ) ) {
68
+ $query = "SELECT post_type, post_status, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type, post_status";
69
+ $counts = $wpdb->get_results($query);
70
+ $result = array();
71
 
72
+ foreach ($counts as $key => $type) {
73
+ $type->post_type = str_replace('-', '_', $type->post_type);
74
+ $type->post_status = str_replace('-', '_', $type->post_status);
75
 
76
+ $result["post_type_{$type->post_type}_{$type->post_status}"] = intval($type->count);
77
+ }
78
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types_and_statuses', $result, $this->cache_time );
79
  // }
80
 
81
  return $result;
85
  global $wpdb;
86
 
87
  // if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_taxonomies' ) ) ) {
88
+ $query = "SELECT count(distinct term_taxonomy_id) as count, taxonomy from {$wpdb->prefix}term_taxonomy group by taxonomy";
89
+ $counts = $wpdb->get_results($query);
90
 
91
+ foreach ($counts as $key => $taxonomy) {
92
+ $taxonomy->taxonomy = str_replace('-', '_', $taxonomy->taxonomy);
93
+ $result["taxonomy_{$taxonomy->taxonomy}"] = intval($taxonomy->count);
94
+ }
95
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_taxonomies', $result, $this->cache_time );
96
  // }
97
 
98
  return $result;
158
  foreach ($frameworks as $framework) {
159
  switch ($framework) {
160
  case 'genesis':
161
+ if (function_exists( 'genesis' ) ) { //
162
  if (defined('PARENT_THEME_VERSION')) {
163
  $result["theme_framework"] = array(
164
  "name" => $framework,
165
  "version" => PARENT_THEME_VERSION
166
+ );
167
  }
168
  }
169
  break;
189
 
190
  function get_disabled_wts(){
191
  $wts = str_replace('"', '', get_option('sk_disabled_wts'));
192
+ $wts = json_decode($wts);
193
  if ($wts) {
194
  return $wts;
195
  }
199
  function get_disabled_network_wts(){
200
  if (is_multisite()) {
201
  $wts = str_replace('"', '', get_site_option('sk_disabled_wts'));
202
+ $wts = json_decode($wts);
203
  if ($wts) {
204
  return $wts;
205
  }
219
  $data = get_plugin_data( $plugin, false, false );
220
  $slug = explode('/',plugin_basename($plugin));
221
  $slug = str_replace('.php', '', $slug[1]);
222
+ if ($data['Version']) {
223
+ $result[$slug] = $data['Version'];
224
+ } else {
225
+ $result[$slug] = '1.0.0';
226
+ }
227
  }
228
  }
229
 
230
  if (is_array($mu_plugins)) {
231
  foreach ($mu_plugins as $plugins_key => $plugin) {
232
+ $data = get_plugin_data( WPMU_PLUGIN_DIR . '/' . $plugins_key, false, false );
233
+ $slug = explode('/',plugin_basename($plugins_key));
234
+ $slug = str_replace('.php', '', $slug[0]);
235
+ if ($data['Version']) {
236
+ $result[$slug] = $data['Version'];
237
+ } else {
238
+ $result[$slug] = '1.0.0';
239
+ }
240
  }
241
  }
242
+
243
+
244
+ if ( is_multisite() ){
245
+ $plugins = get_site_option( 'active_sitewide_plugins');
246
+ foreach ($plugins as $plugins_key => $plugin) {
247
+ $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugins_key, false, false );
248
+ $slug = explode('/',plugin_basename($plugins_key));
249
+ $slug = str_replace('.php', '', $slug[1]);
250
+ if ($data['Version']) {
251
+ $result[$slug] = $data['Version'];
252
+ } else {
253
+ $result[$slug] = '1.0.0';
254
+ }
255
+ }
256
+ }
257
+
258
  set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_plugins', $result, $this->cache_time );
259
  }
260
 
262
  }
263
 
264
  function get_user_role(){
265
+ $wp_roles;
266
+
267
+ $current_user = wp_get_current_user();
268
 
269
  if (is_super_admin($current_user->ID)) {
270
  return 'administrator';
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Sidekick ===
2
  Contributors: raptor235,benfox,bitwit,riavalon
3
  Donate link: http://www.sidekick.pro
4
- Tags: help, tutorial, training, learn, learning, sidekick, guide, teach, video, manual, videos, wphelp, support, instructions, question, questions, answers, answer, clippy, q&a, wpuniversity, helper, walkthrough
5
  Requires at least: 3.7
6
  Tested up to: 4.2
7
- Stable tag: 2.5.0
8
  License: GNU Version 2 or Any Later Version
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -18,7 +18,7 @@ Sidekick puts interactive, real-time tutorials (**Walkthroughs**) right inside y
18
 
19
  No more reading documentation or watching videos. **Just Click. Do. Learn.**
20
 
21
- SIDEKICK for WordPress comes with 55+ Walkthroughs with no signup required (including 30 for the Genesis Framework). You can also choose to [upgrade](http://sidekick.pro/plans/wordpress?utm_source=wordpress.org&utm_medium=plugin_page_description) to over 200 starting at just $3.50/month. Here’s a complete list of what’s in our [library](http://support.sidekick.pro/article/167-which-walkthroughs-are-included-with-wordpress-basics?utm_source=wordpress.org&utm_medium=plugin_page_description).
22
 
23
  **Pro Tip:** If you host with any of our [awesome partners](http://www.sidekick.pro/sidekick-partners?utm_source=wordpress.org&utm_medium=plugin_page_description), you get a the full library for FREE!
24
 
@@ -145,6 +145,17 @@ We read and respond to every piece of feedback we get.
145
 
146
  == Changelog ==
147
 
 
 
 
 
 
 
 
 
 
 
 
148
  = 2.5.0 =
149
  * Sidekick platform major refactoring
150
  * Fixes issues with toggles for taskbar buttons not working
1
  === Sidekick ===
2
  Contributors: raptor235,benfox,bitwit,riavalon
3
  Donate link: http://www.sidekick.pro
4
+ Tags: help, tutorial, tutorials,screencast, self-help, training, learn, learning, sidekick, guide, teach, video, manual, videos, wphelp, support, instructions, question, questions, answers, answer, clippy, q&a, wpuniversity, helper, walkthrough
5
  Requires at least: 3.7
6
  Tested up to: 4.2
7
+ Stable tag: 2.5.3
8
  License: GNU Version 2 or Any Later Version
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
18
 
19
  No more reading documentation or watching videos. **Just Click. Do. Learn.**
20
 
21
+ SIDEKICK for WordPress comes with 55+ Walkthroughs with no signup required (including 30 for the Genesis Framework). You can also choose to [upgrade](http://sidekick.pro/plans/wordpress?utm_source=wordpress.org&utm_medium=plugin_page_description) to over 200 starting at just $3/month. Here’s a complete list of what’s in our [library](http://support.sidekick.pro/article/167-which-walkthroughs-are-included-with-wordpress-basics?utm_source=wordpress.org&utm_medium=plugin_page_description).
22
 
23
  **Pro Tip:** If you host with any of our [awesome partners](http://www.sidekick.pro/sidekick-partners?utm_source=wordpress.org&utm_medium=plugin_page_description), you get a the full library for FREE!
24
 
145
 
146
  == Changelog ==
147
 
148
+ = 2.5.3 =
149
+ * Add network activated plugins to compatibilities list
150
+ * MU Plugins now have versions available for compatibility filtering
151
+ * Optimize the multisite admin loading screen
152
+ * Fixes just activated setting
153
+
154
+ = 2.5.2 =
155
+ * Adjust disabled walkthroughs settings
156
+ * Filter out non compatible products from settings screen
157
+ * Add domain to walkthrough compatibility filter
158
+
159
  = 2.5.0 =
160
  * Sidekick platform major refactoring
161
  * Fixes issues with toggles for taskbar buttons not working
sidekick.php CHANGED
@@ -6,7 +6,7 @@ Plugin URL: http://wordpress.org/plugins/sidekick/
6
  Description: Adds a real-time WordPress training walkthroughs right in your Dashboard
7
  Requires at least: 4.0
8
  Tested up to: 4.1.1
9
- Version: 2.5.0
10
  Author: Sidekick.pro
11
  Author URI: http://www.sidekick.pro
12
  */
@@ -24,7 +24,8 @@ if (!class_exists('Sidekick')){
24
 
25
  function __construct(){
26
  if (!defined('SK_API')) define('SK_API','//apiv2.sidekick.pro/');
27
- if (!defined('SK_CACHE_PREFIX')) define('SK_CACHE_PREFIX',str_replace('.', '_', '2.5.0'));
 
28
  }
29
 
30
  function enqueue_required(){
@@ -41,6 +42,9 @@ if (!class_exists('Sidekick')){
41
  wp_enqueue_script('sidekick' ,"//loader.sidekick.pro/platforms/d9993157-d972-4c49-93be-a0c684096961.js", array('backbone','jquery','underscore','jquery-effects-highlight'),null,true);
42
  wp_enqueue_style('wp-pointer');
43
  wp_enqueue_script('wp-pointer');
 
 
 
44
  }
45
 
46
  function setup_menu(){
@@ -91,6 +95,7 @@ if (!class_exists('Sidekick')){
91
  $current_user = wp_get_current_user();
92
  $status = 'Free';
93
  $error = null;
 
94
 
95
  if (isset($SK_PAID_LIBRARY_FILE) && $activation_id) {
96
  $_POST['activation_id'] = $activation_id;
@@ -98,7 +103,7 @@ if (!class_exists('Sidekick')){
98
  $status = 'Checking...';
99
  }
100
 
101
- $this->track(array('what' => 'Settings Page', 'where' => 'plugin'));
102
 
103
  global $wp_version;
104
  if (version_compare($wp_version, '3.9', '<=')) {
@@ -209,38 +214,46 @@ if (!class_exists('Sidekick')){
209
 
210
  }
211
 
 
 
 
 
 
 
 
 
 
 
 
212
  function footer(){
213
  global $current_user;
214
 
215
- delete_option( 'sk_just_activated' );
216
-
217
  require_once('libs/sk_config_data.php');
218
 
219
  $sk_config_data = new sk_config_data;
220
-
221
  $current_user = (get_option( 'sk_track_data' )) ? wp_get_current_user() : null;
222
-
223
  $autostart_network_walkthrough_id = (get_site_option('sk_autostart_walkthrough_id') ? get_site_option('sk_autostart_walkthrough_id') : null );
224
  $autostart_walkthrough_id = (get_option('sk_autostart_walkthrough_id') ? get_option('sk_autostart_walkthrough_id') : $autostart_network_walkthrough_id );
225
  $theme = wp_get_theme();
226
-
227
  $installed_plugins = $sk_config_data->get_plugins();
228
  $file_editor_enabled = $sk_config_data->get_file_editor_enabled();
 
229
 
230
  $sk_config = array(
231
  "compatibilities" => array(
232
- "theme_version" => $theme->Version,
 
 
233
  "installed_theme" => sanitize_title($theme->Name),
234
- "main_soft_version" => get_bloginfo("version"),
235
  "is_multisite" => (is_multisite()) ? true : false,
236
- "comment_count" => $sk_config_data->get_comments(),
237
- "role" => $sk_config_data->get_user_role(),
238
  "number_of_themes" => $sk_config_data->get_themes(),
239
- "show_on_front" => get_option('show_on_front'),
240
- "page_on_front" => intval(get_option('page_on_front')),
241
  "page_for_posts" => intval(get_option('page_for_posts')),
 
242
  "plugin_count" => (isset($installed_plugins) && is_array($installed_plugins)) ? count($installed_plugins) : 0,
243
- "installed_plugins" => (isset($installed_plugins)) ? $installed_plugins : array()
 
 
244
  ),
245
 
246
  // Platform
@@ -250,7 +263,7 @@ if (!class_exists('Sidekick')){
250
  // User Settings
251
  "activation_id" => (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : ''),
252
  "custom_class" => (get_option( "sk_custom_class" ) ? get_option( "sk_custom_class" ) : ''),
253
- "distributor_id" => (get_option( "sk_distributor_id" ) ? intval(get_option( "sk_distributor_id" )) : ''),
254
  "user_email" => ($current_user) ? $current_user->user_email : '',
255
  "autostart_walkthrough_id" => ($autostart_walkthrough_id) ? $autostart_walkthrough_id : '',
256
  "disable_wts" => (!is_network_admin()) ? $sk_config_data->get_disabled_wts() : array(), // Copying these to compatibilities, have to update this over time
@@ -264,7 +277,7 @@ if (!class_exists('Sidekick')){
264
  // WordPress
265
  "embedded" => false,
266
  "embedPartner" => SK_EMBEDDED_PARTNER, // for tracking purposes if sidekick has been embeded in another WordPress plugin or theme
267
- "plugin_version" => '2.5.0', // WordPress plugin version
268
  "site_url" => $sk_config_data->get_domain(),
269
  "domain" => str_replace("http://","",$_SERVER["SERVER_NAME"]),
270
  "plugin_url" => admin_url("admin.php?page=sidekick"),
@@ -284,6 +297,8 @@ if (!class_exists('Sidekick')){
284
 
285
  $sk_config = apply_filters('sk_config',$sk_config);
286
 
 
 
287
  ?>
288
 
289
  <!-- Old IE Not Supported -->
@@ -306,21 +321,29 @@ if (!class_exists('Sidekick')){
306
  $mp = Mixpanel::getInstance("965556434c5ae652a44f24b85b442263");
307
  $domain = str_replace("http://","",$_SERVER["SERVER_NAME"]);
308
 
309
- switch ($data['type']) {
310
- case 'activate':
311
- $mp->track("Activate - Plugin", array("domain" => $domain));
312
- break;
 
313
 
314
- case 'deactivate':
315
- $mp->track("Deactivate - Plugin", array("domain" => $domain));
316
- break;
317
 
318
- default:
 
 
 
 
 
 
319
  if (isset($data['event'])) {
320
  $mp->track($data['event'], array("domain" => $domain));
321
  }
322
- break;
323
  }
 
 
324
  }
325
 
326
  $response = wp_remote_post( SK_TRACKING_API . 'event', array(
@@ -360,7 +383,7 @@ if (!class_exists('Sidekick')){
360
  function check_ver(){
361
 
362
  if (isset($_GET['sk_ver_check'])){
363
- $data = json_encode('2.5.0');
364
 
365
  if(array_key_exists('callback', $_GET)){
366
 
6
  Description: Adds a real-time WordPress training walkthroughs right in your Dashboard
7
  Requires at least: 4.0
8
  Tested up to: 4.1.1
9
+ Version: 2.5.3
10
  Author: Sidekick.pro
11
  Author URI: http://www.sidekick.pro
12
  */
24
 
25
  function __construct(){
26
  if (!defined('SK_API')) define('SK_API','//apiv2.sidekick.pro/');
27
+ if (!defined('SK_TRACKING_API')) define('SK_TRACKING_API','//tracking.sidekick.pro/');
28
+ if (!defined('SK_CACHE_PREFIX')) define('SK_CACHE_PREFIX',str_replace('.', '_', '2.5.3'));
29
  }
30
 
31
  function enqueue_required(){
42
  wp_enqueue_script('sidekick' ,"//loader.sidekick.pro/platforms/d9993157-d972-4c49-93be-a0c684096961.js", array('backbone','jquery','underscore','jquery-effects-highlight'),null,true);
43
  wp_enqueue_style('wp-pointer');
44
  wp_enqueue_script('wp-pointer');
45
+
46
+ do_action('post_enqueue_required');
47
+
48
  }
49
 
50
  function setup_menu(){
95
  $current_user = wp_get_current_user();
96
  $status = 'Free';
97
  $error = null;
98
+ $affiliate_id = $this->getAffiliateId();
99
 
100
  if (isset($SK_PAID_LIBRARY_FILE) && $activation_id) {
101
  $_POST['activation_id'] = $activation_id;
103
  $status = 'Checking...';
104
  }
105
 
106
+ $this->track(array('event' => 'Settings Page', 'what' => 'Settings Page', 'where' => 'plugin'));
107
 
108
  global $wp_version;
109
  if (version_compare($wp_version, '3.9', '<=')) {
214
 
215
  }
216
 
217
+ function getAffiliateId(){
218
+ if (defined('SK_AFFILIATE_ID')) {
219
+ $affiliate_id = intval(SK_AFFILIATE_ID);
220
+ } else if (get_option( "sk_affiliate_id")){
221
+ $affiliate_id = intval(get_option( "sk_affiliate_id"));
222
+ } else {
223
+ $affiliate_id = '';
224
+ }
225
+ return $affiliate_id;
226
+ }
227
+
228
  function footer(){
229
  global $current_user;
230
 
 
 
231
  require_once('libs/sk_config_data.php');
232
 
233
  $sk_config_data = new sk_config_data;
 
234
  $current_user = (get_option( 'sk_track_data' )) ? wp_get_current_user() : null;
 
235
  $autostart_network_walkthrough_id = (get_site_option('sk_autostart_walkthrough_id') ? get_site_option('sk_autostart_walkthrough_id') : null );
236
  $autostart_walkthrough_id = (get_option('sk_autostart_walkthrough_id') ? get_option('sk_autostart_walkthrough_id') : $autostart_network_walkthrough_id );
237
  $theme = wp_get_theme();
 
238
  $installed_plugins = $sk_config_data->get_plugins();
239
  $file_editor_enabled = $sk_config_data->get_file_editor_enabled();
240
+ $affiliate_id = $this->getAffiliateId();
241
 
242
  $sk_config = array(
243
  "compatibilities" => array(
244
+ "comment_count" => $sk_config_data->get_comments(),
245
+ "domain" => str_replace("http://","",$_SERVER["SERVER_NAME"]),
246
+ "installed_plugins" => (isset($installed_plugins)) ? $installed_plugins : array(),
247
  "installed_theme" => sanitize_title($theme->Name),
 
248
  "is_multisite" => (is_multisite()) ? true : false,
249
+ "main_soft_version" => get_bloginfo("version"),
 
250
  "number_of_themes" => $sk_config_data->get_themes(),
 
 
251
  "page_for_posts" => intval(get_option('page_for_posts')),
252
+ "page_on_front" => intval(get_option('page_on_front')),
253
  "plugin_count" => (isset($installed_plugins) && is_array($installed_plugins)) ? count($installed_plugins) : 0,
254
+ "role" => $sk_config_data->get_user_role(),
255
+ "show_on_front" => get_option('show_on_front'),
256
+ "theme_version" => $theme->Version
257
  ),
258
 
259
  // Platform
263
  // User Settings
264
  "activation_id" => (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : ''),
265
  "custom_class" => (get_option( "sk_custom_class" ) ? get_option( "sk_custom_class" ) : ''),
266
+ "affiliate_id" => $affiliate_id,
267
  "user_email" => ($current_user) ? $current_user->user_email : '',
268
  "autostart_walkthrough_id" => ($autostart_walkthrough_id) ? $autostart_walkthrough_id : '',
269
  "disable_wts" => (!is_network_admin()) ? $sk_config_data->get_disabled_wts() : array(), // Copying these to compatibilities, have to update this over time
277
  // WordPress
278
  "embedded" => false,
279
  "embedPartner" => SK_EMBEDDED_PARTNER, // for tracking purposes if sidekick has been embeded in another WordPress plugin or theme
280
+ "plugin_version" => '2.5.3', // WordPress plugin version
281
  "site_url" => $sk_config_data->get_domain(),
282
  "domain" => str_replace("http://","",$_SERVER["SERVER_NAME"]),
283
  "plugin_url" => admin_url("admin.php?page=sidekick"),
297
 
298
  $sk_config = apply_filters('sk_config',$sk_config);
299
 
300
+ delete_option( 'sk_just_activated' );
301
+
302
  ?>
303
 
304
  <!-- Old IE Not Supported -->
321
  $mp = Mixpanel::getInstance("965556434c5ae652a44f24b85b442263");
322
  $domain = str_replace("http://","",$_SERVER["SERVER_NAME"]);
323
 
324
+ if (isset($data['type'])) {
325
+ switch ($data['type']) {
326
+ case 'activate':
327
+ $mp->track("Activate - Plugin", array("domain" => $domain));
328
+ break;
329
 
330
+ case 'deactivate':
331
+ $mp->track("Deactivate - Plugin", array("domain" => $domain));
332
+ break;
333
 
334
+ default:
335
+ if (isset($data['event'])) {
336
+ $mp->track($data['event'], array("domain" => $domain));
337
+ }
338
+ break;
339
+ }
340
+ } else {
341
  if (isset($data['event'])) {
342
  $mp->track($data['event'], array("domain" => $domain));
343
  }
 
344
  }
345
+
346
+
347
  }
348
 
349
  $response = wp_remote_post( SK_TRACKING_API . 'event', array(
383
  function check_ver(){
384
 
385
  if (isset($_GET['sk_ver_check'])){
386
+ $data = json_encode('2.5.3');
387
 
388
  if(array_key_exists('callback', $_GET)){
389
 
sidekick_embed.php CHANGED
@@ -8,7 +8,7 @@ Description: Adds a real-time WordPress training walkthroughs right in your Dash
8
  We recommend not activating SIDEKICK automatically for people but via an Opt-In process when they configure your own theme or plugin.
9
  Requires at least: 4.0
10
  Tested up to: 4.1.1
11
- Version: 2.5.0
12
  Author: Sidekick.pro
13
  Author URI: http://www.sidekick.pro
14
  */
@@ -29,7 +29,8 @@ if (!$sidekick_active && !class_exists('Sidekick')){
29
 
30
  function __construct(){
31
  if (!defined('SK_API')) define('SK_API','//apiv2.sidekick.pro/');
32
- if (!defined('SK_CACHE_PREFIX')) define('SK_CACHE_PREFIX',str_replace('.', '_', '2.5.0'));
 
33
  }
34
 
35
  function enqueue_required(){
@@ -46,6 +47,9 @@ if (!$sidekick_active && !class_exists('Sidekick')){
46
  wp_enqueue_script('sidekick' ,"//loader.sidekick.pro/platforms/d9993157-d972-4c49-93be-a0c684096961.js", array('backbone','jquery','underscore','jquery-effects-highlight'),null,true);
47
  wp_enqueue_style('wp-pointer');
48
  wp_enqueue_script('wp-pointer');
 
 
 
49
  }
50
 
51
  function setup_menu(){
@@ -96,6 +100,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
96
  $current_user = wp_get_current_user();
97
  $status = 'Free';
98
  $error = null;
 
99
 
100
  if (isset($SK_PAID_LIBRARY_FILE) && $activation_id) {
101
  $_POST['activation_id'] = $activation_id;
@@ -103,7 +108,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
103
  $status = 'Checking...';
104
  }
105
 
106
- $this->track(array('what' => 'Settings Page', 'where' => 'plugin'));
107
 
108
  global $wp_version;
109
  if (version_compare($wp_version, '3.9', '<=')) {
@@ -189,7 +194,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
189
 
190
  <tr valign="top">
191
  <th scope="row" valign="top">Status</th>
192
- <td><span style='color: blue' class='sk_license_status'><span><?php echo ucfirst($status) ?></span> <a style='display: none' class='sk_upgrade' href='http://www.sidekick.pro/modules/wordpress-core-module-premium/?utm_source=plugin&utm_medium=settings&utm_campaign=upgrade' target="_blank"> Upgrade Now!</a> </span></td>
193
  </tr>
194
 
195
  <tr valign="top">
@@ -223,9 +228,9 @@ if (!$sidekick_active && !class_exists('Sidekick')){
223
  <div class="sk_box composer" style='display: none'>
224
  <div class="well">
225
  <h3>Build Your Own Walkthroughs</h3>
226
- <a href='http://www.sidekick.pro/plans/create_wp_walkthroughs/?utm_source=plugin&utm_medium=settings&utm_campaign=composer' target='_blank'><div class='composer_beta_button'>Build Your Own<br/>Walkthroughs</div></a>
227
  <ul>
228
- <li>Get more info about <a href='http://www.sidekick.pro/how-it-works/?utm_source=plugin&utm_medium=settings&utm_campaign=composer' target='_blank'>Custom Walkthroughs</a> now!</li>
229
  <li><a href="http://www.sidekick.pro/plans/create_wp_walkthroughs/?utm_source=plugin&utm_medium=settings&utm_campaign=composer" target="_blank">Check out our custom walkthroughs plans</a></li>
230
  </ul>
231
  </div>
@@ -240,7 +245,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
240
  <li>Your Activation ID is unique and limited to your production, staging, and development urls.</li>
241
  <li>The Sidekick team adheres strictly to CANSPAM. From time to time we may send critical updates (such as security notices) to the email address setup as the Administrator on this site.</li>
242
  <li>If you have any questions, bug reports or feedback, please send them to <a target="_blank" href="mailto:support@sidekick.pro">us</a> </li>
243
- <li>You can find our terms of use <a target="_blank" href="http://www.sidekick.pro/terms-of-use/">here</a></li>
244
  </ul>
245
  </div>
246
  </div>
@@ -468,38 +473,46 @@ if (!$sidekick_active && !class_exists('Sidekick')){
468
 
469
  }
470
 
 
 
 
 
 
 
 
 
 
 
 
471
  function footer(){
472
  global $current_user;
473
 
474
- delete_option( 'sk_just_activated' );
475
-
476
 
477
 
478
  $sk_config_data = new sk_config_data;
479
-
480
  $current_user = (get_option( 'sk_track_data' )) ? wp_get_current_user() : null;
481
-
482
  $autostart_network_walkthrough_id = (get_site_option('sk_autostart_walkthrough_id') ? get_site_option('sk_autostart_walkthrough_id') : null );
483
  $autostart_walkthrough_id = (get_option('sk_autostart_walkthrough_id') ? get_option('sk_autostart_walkthrough_id') : $autostart_network_walkthrough_id );
484
  $theme = wp_get_theme();
485
-
486
  $installed_plugins = $sk_config_data->get_plugins();
487
  $file_editor_enabled = $sk_config_data->get_file_editor_enabled();
 
488
 
489
  $sk_config = array(
490
  "compatibilities" => array(
491
- "theme_version" => $theme->Version,
 
 
492
  "installed_theme" => sanitize_title($theme->Name),
493
- "main_soft_version" => get_bloginfo("version"),
494
  "is_multisite" => (is_multisite()) ? true : false,
495
- "comment_count" => $sk_config_data->get_comments(),
496
- "role" => $sk_config_data->get_user_role(),
497
  "number_of_themes" => $sk_config_data->get_themes(),
498
- "show_on_front" => get_option('show_on_front'),
499
- "page_on_front" => intval(get_option('page_on_front')),
500
  "page_for_posts" => intval(get_option('page_for_posts')),
 
501
  "plugin_count" => (isset($installed_plugins) && is_array($installed_plugins)) ? count($installed_plugins) : 0,
502
- "installed_plugins" => (isset($installed_plugins)) ? $installed_plugins : array()
 
 
503
  ),
504
 
505
  // Platform
@@ -509,7 +522,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
509
  // User Settings
510
  "activation_id" => (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : ''),
511
  "custom_class" => (get_option( "sk_custom_class" ) ? get_option( "sk_custom_class" ) : ''),
512
- "distributor_id" => (get_option( "sk_distributor_id" ) ? intval(get_option( "sk_distributor_id" )) : ''),
513
  "user_email" => ($current_user) ? $current_user->user_email : '',
514
  "autostart_walkthrough_id" => ($autostart_walkthrough_id) ? $autostart_walkthrough_id : '',
515
  "disable_wts" => (!is_network_admin()) ? $sk_config_data->get_disabled_wts() : array(), // Copying these to compatibilities, have to update this over time
@@ -523,7 +536,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
523
  // WordPress
524
  "embedded" => false,
525
  "embedPartner" => SK_EMBEDDED_PARTNER, // for tracking purposes if sidekick has been embeded in another WordPress plugin or theme
526
- "plugin_version" => '2.5.0', // WordPress plugin version
527
  "site_url" => $sk_config_data->get_domain(),
528
  "domain" => str_replace("http://","",$_SERVER["SERVER_NAME"]),
529
  "plugin_url" => admin_url("admin.php?page=sidekick"),
@@ -543,6 +556,8 @@ if (!$sidekick_active && !class_exists('Sidekick')){
543
 
544
  $sk_config = apply_filters('sk_config',$sk_config);
545
 
 
 
546
  ?>
547
 
548
  <!-- Old IE Not Supported -->
@@ -565,21 +580,29 @@ if (!$sidekick_active && !class_exists('Sidekick')){
565
  $mp = Mixpanel::getInstance("965556434c5ae652a44f24b85b442263");
566
  $domain = str_replace("http://","",$_SERVER["SERVER_NAME"]);
567
 
568
- switch ($data['type']) {
569
- case 'activate':
570
- $mp->track("Activate - Plugin", array("domain" => $domain));
571
- break;
 
572
 
573
- case 'deactivate':
574
- $mp->track("Deactivate - Plugin", array("domain" => $domain));
575
- break;
576
 
577
- default:
 
 
 
 
 
 
578
  if (isset($data['event'])) {
579
  $mp->track($data['event'], array("domain" => $domain));
580
  }
581
- break;
582
  }
 
 
583
  }
584
 
585
  $response = wp_remote_post( SK_TRACKING_API . 'event', array(
@@ -619,7 +642,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
619
  function check_ver(){
620
 
621
  if (isset($_GET['sk_ver_check'])){
622
- $data = json_encode('2.5.0');
623
 
624
  if(array_key_exists('callback', $_GET)){
625
 
@@ -812,7 +835,7 @@ if (!$sidekick_active && !class_exists('sidekickMassActivator')) {
812
  }
813
  }
814
 
815
- function track($event, $data) {
816
  if (file_exists(realpath(dirname(__FILE__)) . '/mixpanel/Mixpanel.php')) {
817
  require_once(realpath(dirname(__FILE__)) . '/mixpanel/Mixpanel.php');
818
  $mp = Mixpanel::getInstance("965556434c5ae652a44f24b85b442263");
@@ -1191,6 +1214,7 @@ if (!$sidekick_active && !class_exists('sidekickMassActivator')) {
1191
  $sk_hide_config_taskbar_button = get_option('sk_hide_config_taskbar_button');
1192
  $sk_hide_composer_upgrade_button = get_option('sk_hide_composer_upgrade_button');
1193
  $is_ms_admin = true;
 
1194
 
1195
  $this->track(array('what' => 'Network Settings Page', 'where' => 'plugin'));
1196
 
@@ -1571,17 +1595,17 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1571
 
1572
  // Can't find a good method to clear cache for newly registered post types that fires once
1573
  // if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types_and_statuses' ) ) ) {
1574
- $query = "SELECT post_type, post_status, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type, post_status";
1575
- $counts = $wpdb->get_results($query);
1576
- $result = array();
1577
 
1578
- foreach ($counts as $key => $type) {
1579
- $type->post_type = str_replace('-', '_', $type->post_type);
1580
- $type->post_status = str_replace('-', '_', $type->post_status);
1581
 
1582
- $result["post_type_{$type->post_type}_{$type->post_status}"] = intval($type->count);
1583
- }
1584
- set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types_and_statuses', $result, $this->cache_time );
1585
  // }
1586
 
1587
  return $result;
@@ -1591,14 +1615,14 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1591
  global $wpdb;
1592
 
1593
  // if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_taxonomies' ) ) ) {
1594
- $query = "SELECT count(distinct term_taxonomy_id) as count, taxonomy from {$wpdb->prefix}term_taxonomy group by taxonomy";
1595
- $counts = $wpdb->get_results($query);
1596
 
1597
- foreach ($counts as $key => $taxonomy) {
1598
- $taxonomy->taxonomy = str_replace('-', '_', $taxonomy->taxonomy);
1599
- $result["taxonomy_{$taxonomy->taxonomy}"] = intval($taxonomy->count);
1600
- }
1601
- set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_taxonomies', $result, $this->cache_time );
1602
  // }
1603
 
1604
  return $result;
@@ -1664,12 +1688,12 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1664
  foreach ($frameworks as $framework) {
1665
  switch ($framework) {
1666
  case 'genesis':
1667
- if (function_exists( 'genesis' ) ) {
1668
  if (defined('PARENT_THEME_VERSION')) {
1669
  $result["theme_framework"] = array(
1670
  "name" => $framework,
1671
  "version" => PARENT_THEME_VERSION
1672
- );
1673
  }
1674
  }
1675
  break;
@@ -1695,6 +1719,7 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1695
 
1696
  function get_disabled_wts(){
1697
  $wts = str_replace('"', '', get_option('sk_disabled_wts'));
 
1698
  if ($wts) {
1699
  return $wts;
1700
  }
@@ -1704,6 +1729,7 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1704
  function get_disabled_network_wts(){
1705
  if (is_multisite()) {
1706
  $wts = str_replace('"', '', get_site_option('sk_disabled_wts'));
 
1707
  if ($wts) {
1708
  return $wts;
1709
  }
@@ -1723,16 +1749,42 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1723
  $data = get_plugin_data( $plugin, false, false );
1724
  $slug = explode('/',plugin_basename($plugin));
1725
  $slug = str_replace('.php', '', $slug[1]);
1726
- $result[$slug] = $data['Version'];
 
 
 
 
1727
  }
1728
  }
1729
 
1730
  if (is_array($mu_plugins)) {
1731
  foreach ($mu_plugins as $plugins_key => $plugin) {
1732
- $slug = str_replace('.php', '', $plugins_key);
1733
- $result[$slug] = '1.0.0';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1734
  }
1735
  }
 
1736
  set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_plugins', $result, $this->cache_time );
1737
  }
1738
 
@@ -1740,7 +1792,9 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1740
  }
1741
 
1742
  function get_user_role(){
1743
- global $current_user, $wp_roles;
 
 
1744
 
1745
  if (is_super_admin($current_user->ID)) {
1746
  return 'administrator';
8
  We recommend not activating SIDEKICK automatically for people but via an Opt-In process when they configure your own theme or plugin.
9
  Requires at least: 4.0
10
  Tested up to: 4.1.1
11
+ Version: 2.5.3
12
  Author: Sidekick.pro
13
  Author URI: http://www.sidekick.pro
14
  */
29
 
30
  function __construct(){
31
  if (!defined('SK_API')) define('SK_API','//apiv2.sidekick.pro/');
32
+ if (!defined('SK_TRACKING_API')) define('SK_TRACKING_API','//tracking.sidekick.pro/');
33
+ if (!defined('SK_CACHE_PREFIX')) define('SK_CACHE_PREFIX',str_replace('.', '_', '2.5.3'));
34
  }
35
 
36
  function enqueue_required(){
47
  wp_enqueue_script('sidekick' ,"//loader.sidekick.pro/platforms/d9993157-d972-4c49-93be-a0c684096961.js", array('backbone','jquery','underscore','jquery-effects-highlight'),null,true);
48
  wp_enqueue_style('wp-pointer');
49
  wp_enqueue_script('wp-pointer');
50
+
51
+ do_action('post_enqueue_required');
52
+
53
  }
54
 
55
  function setup_menu(){
100
  $current_user = wp_get_current_user();
101
  $status = 'Free';
102
  $error = null;
103
+ $affiliate_id = $this->getAffiliateId();
104
 
105
  if (isset($SK_PAID_LIBRARY_FILE) && $activation_id) {
106
  $_POST['activation_id'] = $activation_id;
108
  $status = 'Checking...';
109
  }
110
 
111
+ $this->track(array('event' => 'Settings Page', 'what' => 'Settings Page', 'where' => 'plugin'));
112
 
113
  global $wp_version;
114
  if (version_compare($wp_version, '3.9', '<=')) {
194
 
195
  <tr valign="top">
196
  <th scope="row" valign="top">Status</th>
197
+ <td><span style='color: blue' class='sk_license_status'><span><?php echo ucfirst($status) ?></span> <a style='display: none' class='sk_upgrade' href='http://www.sidekick.pro/modules/wordpress-core-module-premium/?utm_source=plugin&utm_medium=settings&utm_campaign=upgrade<?php echo ($affiliate_id) ? '&ref=' . $affiliate_id : '' ?>' target="_blank"> Upgrade Now!</a> </span></td>
198
  </tr>
199
 
200
  <tr valign="top">
228
  <div class="sk_box composer" style='display: none'>
229
  <div class="well">
230
  <h3>Build Your Own Walkthroughs</h3>
231
+ <a href='http://www.sidekick.pro/plans/create_wp_walkthroughs/?utm_source=plugin&utm_medium=settings&utm_campaign=composer<?php echo ($affiliate_id) ? '&ref=' . $affiliate_id : '' ?>' target='_blank'><div class='composer_beta_button'>Build Your Own<br/>Walkthroughs</div></a>
232
  <ul>
233
+ <li>Get more info about <a href='http://www.sidekick.pro/how-it-works/?utm_source=plugin&utm_medium=settings&utm_campaign=composer<?php echo ($affiliate_id) ? '&ref=' . $affiliate_id : '' ?>' target='_blank'>Custom Walkthroughs</a> now!</li>
234
  <li><a href="http://www.sidekick.pro/plans/create_wp_walkthroughs/?utm_source=plugin&utm_medium=settings&utm_campaign=composer" target="_blank">Check out our custom walkthroughs plans</a></li>
235
  </ul>
236
  </div>
245
  <li>Your Activation ID is unique and limited to your production, staging, and development urls.</li>
246
  <li>The Sidekick team adheres strictly to CANSPAM. From time to time we may send critical updates (such as security notices) to the email address setup as the Administrator on this site.</li>
247
  <li>If you have any questions, bug reports or feedback, please send them to <a target="_blank" href="mailto:support@sidekick.pro">us</a> </li>
248
+ <li>You can find our terms of use <a target="_blank" href="http://www.sidekick.pro/terms-of-use/<?php echo ($affiliate_id) ? '&ref=' . $affiliate_id : '' ?>">here</a></li>
249
  </ul>
250
  </div>
251
  </div>
473
 
474
  }
475
 
476
+ function getAffiliateId(){
477
+ if (defined('SK_AFFILIATE_ID')) {
478
+ $affiliate_id = intval(SK_AFFILIATE_ID);
479
+ } else if (get_option( "sk_affiliate_id")){
480
+ $affiliate_id = intval(get_option( "sk_affiliate_id"));
481
+ } else {
482
+ $affiliate_id = '';
483
+ }
484
+ return $affiliate_id;
485
+ }
486
+
487
  function footer(){
488
  global $current_user;
489
 
 
 
490
 
491
 
492
  $sk_config_data = new sk_config_data;
 
493
  $current_user = (get_option( 'sk_track_data' )) ? wp_get_current_user() : null;
 
494
  $autostart_network_walkthrough_id = (get_site_option('sk_autostart_walkthrough_id') ? get_site_option('sk_autostart_walkthrough_id') : null );
495
  $autostart_walkthrough_id = (get_option('sk_autostart_walkthrough_id') ? get_option('sk_autostart_walkthrough_id') : $autostart_network_walkthrough_id );
496
  $theme = wp_get_theme();
 
497
  $installed_plugins = $sk_config_data->get_plugins();
498
  $file_editor_enabled = $sk_config_data->get_file_editor_enabled();
499
+ $affiliate_id = $this->getAffiliateId();
500
 
501
  $sk_config = array(
502
  "compatibilities" => array(
503
+ "comment_count" => $sk_config_data->get_comments(),
504
+ "domain" => str_replace("http://","",$_SERVER["SERVER_NAME"]),
505
+ "installed_plugins" => (isset($installed_plugins)) ? $installed_plugins : array(),
506
  "installed_theme" => sanitize_title($theme->Name),
 
507
  "is_multisite" => (is_multisite()) ? true : false,
508
+ "main_soft_version" => get_bloginfo("version"),
 
509
  "number_of_themes" => $sk_config_data->get_themes(),
 
 
510
  "page_for_posts" => intval(get_option('page_for_posts')),
511
+ "page_on_front" => intval(get_option('page_on_front')),
512
  "plugin_count" => (isset($installed_plugins) && is_array($installed_plugins)) ? count($installed_plugins) : 0,
513
+ "role" => $sk_config_data->get_user_role(),
514
+ "show_on_front" => get_option('show_on_front'),
515
+ "theme_version" => $theme->Version
516
  ),
517
 
518
  // Platform
522
  // User Settings
523
  "activation_id" => (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : ''),
524
  "custom_class" => (get_option( "sk_custom_class" ) ? get_option( "sk_custom_class" ) : ''),
525
+ "affiliate_id" => $affiliate_id,
526
  "user_email" => ($current_user) ? $current_user->user_email : '',
527
  "autostart_walkthrough_id" => ($autostart_walkthrough_id) ? $autostart_walkthrough_id : '',
528
  "disable_wts" => (!is_network_admin()) ? $sk_config_data->get_disabled_wts() : array(), // Copying these to compatibilities, have to update this over time
536
  // WordPress
537
  "embedded" => false,
538
  "embedPartner" => SK_EMBEDDED_PARTNER, // for tracking purposes if sidekick has been embeded in another WordPress plugin or theme
539
+ "plugin_version" => '2.5.3', // WordPress plugin version
540
  "site_url" => $sk_config_data->get_domain(),
541
  "domain" => str_replace("http://","",$_SERVER["SERVER_NAME"]),
542
  "plugin_url" => admin_url("admin.php?page=sidekick"),
556
 
557
  $sk_config = apply_filters('sk_config',$sk_config);
558
 
559
+ delete_option( 'sk_just_activated' );
560
+
561
  ?>
562
 
563
  <!-- Old IE Not Supported -->
580
  $mp = Mixpanel::getInstance("965556434c5ae652a44f24b85b442263");
581
  $domain = str_replace("http://","",$_SERVER["SERVER_NAME"]);
582
 
583
+ if (isset($data['type'])) {
584
+ switch ($data['type']) {
585
+ case 'activate':
586
+ $mp->track("Activate - Plugin", array("domain" => $domain));
587
+ break;
588
 
589
+ case 'deactivate':
590
+ $mp->track("Deactivate - Plugin", array("domain" => $domain));
591
+ break;
592
 
593
+ default:
594
+ if (isset($data['event'])) {
595
+ $mp->track($data['event'], array("domain" => $domain));
596
+ }
597
+ break;
598
+ }
599
+ } else {
600
  if (isset($data['event'])) {
601
  $mp->track($data['event'], array("domain" => $domain));
602
  }
 
603
  }
604
+
605
+
606
  }
607
 
608
  $response = wp_remote_post( SK_TRACKING_API . 'event', array(
642
  function check_ver(){
643
 
644
  if (isset($_GET['sk_ver_check'])){
645
+ $data = json_encode('2.5.3');
646
 
647
  if(array_key_exists('callback', $_GET)){
648
 
835
  }
836
  }
837
 
838
+ function track($event, $data = array()) {
839
  if (file_exists(realpath(dirname(__FILE__)) . '/mixpanel/Mixpanel.php')) {
840
  require_once(realpath(dirname(__FILE__)) . '/mixpanel/Mixpanel.php');
841
  $mp = Mixpanel::getInstance("965556434c5ae652a44f24b85b442263");
1214
  $sk_hide_config_taskbar_button = get_option('sk_hide_config_taskbar_button');
1215
  $sk_hide_composer_upgrade_button = get_option('sk_hide_composer_upgrade_button');
1216
  $is_ms_admin = true;
1217
+ $affiliate_id = $this->getAffiliateId();
1218
 
1219
  $this->track(array('what' => 'Network Settings Page', 'where' => 'plugin'));
1220
 
1595
 
1596
  // Can't find a good method to clear cache for newly registered post types that fires once
1597
  // if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types_and_statuses' ) ) ) {
1598
+ $query = "SELECT post_type, post_status, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type, post_status";
1599
+ $counts = $wpdb->get_results($query);
1600
+ $result = array();
1601
 
1602
+ foreach ($counts as $key => $type) {
1603
+ $type->post_type = str_replace('-', '_', $type->post_type);
1604
+ $type->post_status = str_replace('-', '_', $type->post_status);
1605
 
1606
+ $result["post_type_{$type->post_type}_{$type->post_status}"] = intval($type->count);
1607
+ }
1608
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types_and_statuses', $result, $this->cache_time );
1609
  // }
1610
 
1611
  return $result;
1615
  global $wpdb;
1616
 
1617
  // if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_taxonomies' ) ) ) {
1618
+ $query = "SELECT count(distinct term_taxonomy_id) as count, taxonomy from {$wpdb->prefix}term_taxonomy group by taxonomy";
1619
+ $counts = $wpdb->get_results($query);
1620
 
1621
+ foreach ($counts as $key => $taxonomy) {
1622
+ $taxonomy->taxonomy = str_replace('-', '_', $taxonomy->taxonomy);
1623
+ $result["taxonomy_{$taxonomy->taxonomy}"] = intval($taxonomy->count);
1624
+ }
1625
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_taxonomies', $result, $this->cache_time );
1626
  // }
1627
 
1628
  return $result;
1688
  foreach ($frameworks as $framework) {
1689
  switch ($framework) {
1690
  case 'genesis':
1691
+ if (function_exists( 'genesis' ) ) { //
1692
  if (defined('PARENT_THEME_VERSION')) {
1693
  $result["theme_framework"] = array(
1694
  "name" => $framework,
1695
  "version" => PARENT_THEME_VERSION
1696
+ );
1697
  }
1698
  }
1699
  break;
1719
 
1720
  function get_disabled_wts(){
1721
  $wts = str_replace('"', '', get_option('sk_disabled_wts'));
1722
+ $wts = json_decode($wts);
1723
  if ($wts) {
1724
  return $wts;
1725
  }
1729
  function get_disabled_network_wts(){
1730
  if (is_multisite()) {
1731
  $wts = str_replace('"', '', get_site_option('sk_disabled_wts'));
1732
+ $wts = json_decode($wts);
1733
  if ($wts) {
1734
  return $wts;
1735
  }
1749
  $data = get_plugin_data( $plugin, false, false );
1750
  $slug = explode('/',plugin_basename($plugin));
1751
  $slug = str_replace('.php', '', $slug[1]);
1752
+ if ($data['Version']) {
1753
+ $result[$slug] = $data['Version'];
1754
+ } else {
1755
+ $result[$slug] = '1.0.0';
1756
+ }
1757
  }
1758
  }
1759
 
1760
  if (is_array($mu_plugins)) {
1761
  foreach ($mu_plugins as $plugins_key => $plugin) {
1762
+ $data = get_plugin_data( WPMU_PLUGIN_DIR . '/' . $plugins_key, false, false );
1763
+ $slug = explode('/',plugin_basename($plugins_key));
1764
+ $slug = str_replace('.php', '', $slug[0]);
1765
+ if ($data['Version']) {
1766
+ $result[$slug] = $data['Version'];
1767
+ } else {
1768
+ $result[$slug] = '1.0.0';
1769
+ }
1770
+ }
1771
+ }
1772
+
1773
+
1774
+ if ( is_multisite() ){
1775
+ $plugins = get_site_option( 'active_sitewide_plugins');
1776
+ foreach ($plugins as $plugins_key => $plugin) {
1777
+ $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugins_key, false, false );
1778
+ $slug = explode('/',plugin_basename($plugins_key));
1779
+ $slug = str_replace('.php', '', $slug[1]);
1780
+ if ($data['Version']) {
1781
+ $result[$slug] = $data['Version'];
1782
+ } else {
1783
+ $result[$slug] = '1.0.0';
1784
+ }
1785
  }
1786
  }
1787
+
1788
  set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_plugins', $result, $this->cache_time );
1789
  }
1790
 
1792
  }
1793
 
1794
  function get_user_role(){
1795
+ $wp_roles;
1796
+
1797
+ $current_user = wp_get_current_user();
1798
 
1799
  if (is_super_admin($current_user->ID)) {
1800
  return 'administrator';