Sidekick - Version 2.5.2

Version Description

  • Adjust disabled walkthroughs settings
  • Filter out non compatible products from settings screen
  • Add domain to walkthrough compatibility filter
Download this release

Release Info

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

Code changes from version 2.4.0 to 2.5.2

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;
@@ -214,6 +216,13 @@ function sk_populate(data){
214
 
215
  jQuery('.sk_walkthrough_list').append('<div class="sk_product" id="' + item.cacheId + '"><b>' + item.name + '</b> (<span class="select_all">Toggle All</span>)</div>');
216
 
 
 
 
 
 
 
 
217
 
218
  if (sk_config.disable_wts) {
219
  currently_disabled_wts = sk_config.disable_wts;
@@ -352,7 +361,7 @@ function sk_populate(data){
352
  var sk_url;
353
 
354
  if (loadCount > 5) {
355
- console.warn('Something is wrong...');
356
  return false;
357
  }
358
 
@@ -373,6 +382,8 @@ function sk_populate(data){
373
  },
374
  success: function(data){
375
 
 
 
376
  if (sk_config.library + 'domains/cache?domainKey=' + sk_config.activation_id == sk_url) {
377
  if (!data.payload) {
378
  jQuery('.sk_license_status').html('Invalid Key').css({color: 'red'});
@@ -387,7 +398,13 @@ function sk_populate(data){
387
  }
388
 
389
  if (data.payload) {
390
- sk_populate(data.payload);
 
 
 
 
 
 
391
  }
392
  }
393
  });
@@ -442,36 +459,19 @@ function sk_populate(data){
442
 
443
  });
444
 
445
-
446
-
447
- // if (jQuery('select[name="sk_selected_subscription"]').val().indexOf('roduct') > -1) {
448
- // jQuery('.walkthrough_library').show();
449
- // }
450
-
451
- // jQuery('select[name="sk_selected_subscription"]').on('change',function(){
452
- // if (jQuery('select[name="sk_selected_subscription"]').val().indexOf('roduct') > -1) {
453
- // jQuery('.walkthrough_library').show();
454
- // } else {
455
- // jQuery('.walkthrough_library').val(0);
456
- // jQuery('.walkthrough_library').hide();
457
- // }
458
- // });
459
-
460
  } else {
461
- jQuery(document).ready(function($) {
462
- if (sk_config.activation_id) {
463
- load_sk_library(sk_config.activation_id);
464
- } else {
465
- jQuery('.sk_upgrade').show();
466
- }
467
-
468
- jQuery('h3:contains(My Sidekick Account)').click(function(e){
469
- if (e.shiftKey) {
470
- jQuery('.advanced').show();
471
- }
472
- });
473
 
474
- });
 
 
 
 
475
  }
476
 
477
  });
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;
216
 
217
  jQuery('.sk_walkthrough_list').append('<div class="sk_product" id="' + item.cacheId + '"><b>' + item.name + '</b> (<span class="select_all">Toggle All</span>)</div>');
218
 
219
+ if (typeof sk_config.disable_wts === "string" && sk_config.disable_wts.indexOf(']') > -1) {
220
+ sk_config.disable_wts = JSON.parse(sk_config.disable_wts);
221
+ };
222
+
223
+ if (typeof sk_config.disable_network_wts === "string" && sk_config.disable_network_wts.indexOf(']') > -1) {
224
+ sk_config.disable_network_wts = JSON.parse(sk_config.disable_network_wts);
225
+ };
226
 
227
  if (sk_config.disable_wts) {
228
  currently_disabled_wts = sk_config.disable_wts;
361
  var sk_url;
362
 
363
  if (loadCount > 5) {
364
+ // console.warn('Something is wrong...');
365
  return false;
366
  }
367
 
382
  },
383
  success: function(data){
384
 
385
+ // console.log('success');
386
+
387
  if (sk_config.library + 'domains/cache?domainKey=' + sk_config.activation_id == sk_url) {
388
  if (!data.payload) {
389
  jQuery('.sk_license_status').html('Invalid Key').css({color: 'red'});
398
  }
399
 
400
  if (data.payload) {
401
+
402
+ // console.log('data.payload %o', data.payload);
403
+
404
+
405
+ sidekick.compatibilityModel.filter_products(data.payload.products);
406
+
407
+ sk_populate(sidekick.compatibilityModel.get('passed_products'));
408
  }
409
  }
410
  });
459
 
460
  });
461
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
  } else {
463
+
464
+ if (sk_config.activation_id) {
465
+ load_sk_library(sk_config.activation_id);
466
+ } else {
467
+ jQuery('.sk_upgrade').show();
468
+ }
 
 
 
 
 
 
469
 
470
+ jQuery('h3:contains(My Sidekick Account)').click(function(e){
471
+ if (e.shiftKey) {
472
+ jQuery('.advanced').show();
473
+ }
474
+ });
475
  }
476
 
477
  });
libs/admin_page.php CHANGED
@@ -5,10 +5,6 @@
5
  var last_site_key = null;
6
  var sk_ms_admin = false;
7
 
8
- jQuery(document).ready(function($) {
9
- mixpanel.track('Settings Page Visit - Plugin');
10
- });
11
-
12
  </script>
13
 
14
  <div class="page-header"><h2><a id="pluginlogo_32" class="header-icon32" href="http://www.sidekick.pro/modules/wordpress-core-module-premium/?utm_source=plugin&utm_medium=settings&utm_campaign=header" target="_blank"></a>Sidekick Dashboard</h2></div>
@@ -79,7 +75,7 @@
79
  Enable Composer Mode
80
  </th>
81
  <td>
82
- <button class='open_composer'>Open Composer</button>
83
  </td>
84
  </tr>
85
  </tbody>
@@ -163,7 +159,7 @@
163
  <li><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://sidekick.pro" data-text="I use @sidekickhelps for the fastest and easiest way to learn WordPress." data-via="sidekickhelps" data-size="large">Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></li>
164
  <li>Like SIDEKICK? Please leave us a 5 star rating on <a href='http://WordPress.org' target='_blank'>WordPress.org</a></li>
165
  <li><a href="http://www.sidekick.pro/plans/wordpress-basics/">Sign up for a full WordPress Basics package</a></li>
166
- <li><a href="http://support.sidekick.pro/category/85-getting-started" target="_blank"><strong>Visit the SIDEKICK Quick Start guides</strong></a>.</li>
167
  </ul>
168
  </div>
169
  </div>
5
  var last_site_key = null;
6
  var sk_ms_admin = false;
7
 
 
 
 
 
8
  </script>
9
 
10
  <div class="page-header"><h2><a id="pluginlogo_32" class="header-icon32" href="http://www.sidekick.pro/modules/wordpress-core-module-premium/?utm_source=plugin&utm_medium=settings&utm_campaign=header" target="_blank"></a>Sidekick Dashboard</h2></div>
75
  Enable Composer Mode
76
  </th>
77
  <td>
78
+ <button type='button' class='open_composer'>Open Composer</button>
79
  </td>
80
  </tr>
81
  </tbody>
159
  <li><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://sidekick.pro" data-text="I use @sidekickhelps for the fastest and easiest way to learn WordPress." data-via="sidekickhelps" data-size="large">Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></li>
160
  <li>Like SIDEKICK? Please leave us a 5 star rating on <a href='http://WordPress.org' target='_blank'>WordPress.org</a></li>
161
  <li><a href="http://www.sidekick.pro/plans/wordpress-basics/">Sign up for a full WordPress Basics package</a></li>
162
+ <li><a href="http://support.sidekick.pro/collection/50-quick-start-guides" target="_blank"><strong>Visit the SIDEKICK Quick Start guides</strong></a>.</li>
163
  </ul>
164
  </div>
165
  </div>
libs/licensing.php CHANGED
@@ -475,6 +475,8 @@ if (!class_exists('sidekickMassActivator')) {
475
  $sk_hide_composer_upgrade_button = get_option('sk_hide_composer_upgrade_button');
476
  $is_ms_admin = true;
477
 
 
 
478
  require_once('ms_admin_page.php');
479
  }
480
  }
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
+
480
  require_once('ms_admin_page.php');
481
  }
482
  }
libs/ms_admin_page.php CHANGED
@@ -7,12 +7,6 @@
7
  var last_site_key = null;
8
  var sk_ms_admin = true;
9
 
10
- jQuery(document).ready(function($) {
11
- if (typeof mixpanel !== 'undefined') {
12
- mixpanel.track('Network Settings Page Visit - Plugin');
13
- };
14
- });
15
-
16
  </script>
17
 
18
  <div class="page-header"><h2><a id="pluginlogo_32" class="header-icon32" href="http://www.sidekick.pro" target="_blank"></a>Sidekick Licensing</h2></div>
7
  var last_site_key = null;
8
  var sk_ms_admin = true;
9
 
 
 
 
 
 
 
10
  </script>
11
 
12
  <div class="page-header"><h2><a id="pluginlogo_32" class="header-icon32" href="http://www.sidekick.pro" target="_blank"></a>Sidekick Licensing</h2></div>
libs/sk_config_data.php CHANGED
@@ -22,17 +22,17 @@ if (!class_exists('sk_config_data')) {
22
  function get_post_types(){
23
  global $wpdb;
24
 
25
- if ( false === ( $result = get_transient( 'sk_get_post_types' ) ) ) {
26
 
27
  $query = "SELECT post_type, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type";
28
  $counts = $wpdb->get_results($query);
29
- $result = '';
30
 
31
  foreach ($counts as $key => $type) {
32
  $type->post_type = str_replace('-', '_', $type->post_type);
33
- $result .= "\n post_type_{$type->post_type} : $type->count,";
34
  }
35
- set_transient( 'sk_get_post_types', $result, $this->cache_time );
36
  }
37
 
38
  return $result;
@@ -52,9 +52,9 @@ if (!class_exists('sk_config_data')) {
52
  }
53
 
54
  function get_themes(){
55
- if ( false === ( $result = get_transient( 'sk_get_themes' ) ) ) {
56
  $result = wp_get_themes( array( 'allowed' => true ) );
57
- set_transient( 'sk_get_themes', $result, $this->cache_time );
58
  }
59
 
60
  return count($result);
@@ -64,18 +64,18 @@ if (!class_exists('sk_config_data')) {
64
  global $wpdb;
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_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 = '';
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 .= "\n post_type_{$type->post_type}_{$type->post_status} : $type->count,";
77
  }
78
- set_transient( 'sk_get_post_types_and_statuses', $result, $this->cache_time );
79
  // }
80
 
81
  return $result;
@@ -84,16 +84,15 @@ if (!class_exists('sk_config_data')) {
84
  function get_taxonomies(){
85
  global $wpdb;
86
 
87
- // if ( false === ( $result = get_transient( 'sk_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
- $result = '';
91
 
92
  foreach ($counts as $key => $taxonomy) {
93
  $taxonomy->taxonomy = str_replace('-', '_', $taxonomy->taxonomy);
94
- $result .= "\n taxonomy_{$taxonomy->taxonomy} : $taxonomy->count,";
95
  }
96
- set_transient( 'sk_get_taxonomies', $result, $this->cache_time );
97
  // }
98
 
99
  return $result;
@@ -102,30 +101,29 @@ if (!class_exists('sk_config_data')) {
102
  function get_comments(){
103
  global $wpdb;
104
 
105
- if ( false === ( $result = get_transient( 'sk_get_comments' ) ) ) {
106
  $query = "SELECT count(distinct comment_ID) as count from {$wpdb->prefix}comments";
107
  $counts = $wpdb->get_var($query);
108
  if (!$counts) $counts = 0;
109
- $result = "\n comment_count : $counts,";
110
- set_transient( 'sk_get_comments', $result, $this->cache_time );
111
  }
112
 
113
- return $result;
114
  }
115
 
116
  function get_post_statuses(){
117
  global $wpdb;
118
 
119
- if ( false === ( $result = get_transient( 'sk_post_statuses' ) ) ) {
120
  $query = "SELECT post_status, count(ID) as count from {$wpdb->prefix}posts group by post_status";
121
  $counts = $wpdb->get_results($query);
122
- $result = '';
123
 
124
  foreach ($counts as $key => $type) {
125
  $type->post_status = str_replace('-', '_', $type->post_status);
126
- $result .= "\n post_status_{$type->post_status} : $type->count,";
127
  }
128
- set_transient( 'sk_post_statuses', $result, $this->cache_time );
129
  }
130
 
131
  return $result;
@@ -134,17 +132,17 @@ if (!class_exists('sk_config_data')) {
134
  function get_user_data(){
135
  global $current_user;
136
 
137
- if ( false === ( $result = get_transient( 'sk_get_user_data' ) ) ) {
138
  $data = get_userdata($current_user->ID);
139
- $result = "\n user_id : $current_user->ID,";
140
 
141
  foreach ($data->allcaps as $cap => $val) {
142
  $cap = sanitize_title($cap);
143
  $cap = str_replace('-', '_', $cap);
144
  if (!$val) $val = 0;
145
- $result .= "\n cap_{$cap} : $val,";
146
  }
147
- set_transient( 'sk_get_user_data', $result, $this->cache_time );
148
  }
149
 
150
  return $result;
@@ -155,20 +153,23 @@ if (!class_exists('sk_config_data')) {
155
 
156
  $frameworks = array('genesis');
157
 
158
- $output = "\n theme_framework : false,";
159
 
160
  foreach ($frameworks as $framework) {
161
  switch ($framework) {
162
  case 'genesis':
163
  if (function_exists( 'genesis' ) ) {
164
  if (defined('PARENT_THEME_VERSION')) {
165
- $output = "\n theme_framework : {name: '" . $framework . "', version: '" . PARENT_THEME_VERSION . "'},";
 
 
 
166
  }
167
  }
168
  break;
169
  }
170
  }
171
- return $output;
172
  }
173
 
174
  function get_current_url() {
@@ -188,6 +189,7 @@ if (!class_exists('sk_config_data')) {
188
 
189
  function get_disabled_wts(){
190
  $wts = str_replace('"', '', get_option('sk_disabled_wts'));
 
191
  if ($wts) {
192
  return $wts;
193
  }
@@ -197,6 +199,7 @@ if (!class_exists('sk_config_data')) {
197
  function get_disabled_network_wts(){
198
  if (is_multisite()) {
199
  $wts = str_replace('"', '', get_site_option('sk_disabled_wts'));
 
200
  if ($wts) {
201
  return $wts;
202
  }
@@ -206,7 +209,7 @@ if (!class_exists('sk_config_data')) {
206
 
207
  function get_plugins(){
208
 
209
- if ( false === ( $result = get_transient( 'sk_get_plugins' ) ) ) {
210
  $active_plugins = wp_get_active_and_valid_plugins();
211
  $mu_plugins = get_mu_plugins();
212
  $result = array();
@@ -226,7 +229,7 @@ if (!class_exists('sk_config_data')) {
226
  $result[$slug] = '1.0.0';
227
  }
228
  }
229
- set_transient( 'sk_get_plugins', $result, $this->cache_time );
230
  }
231
 
232
  return $result;
22
  function get_post_types(){
23
  global $wpdb;
24
 
25
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types' ) ) ) {
26
 
27
  $query = "SELECT post_type, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type";
28
  $counts = $wpdb->get_results($query);
29
+ $result = array();
30
 
31
  foreach ($counts as $key => $type) {
32
  $type->post_type = str_replace('-', '_', $type->post_type);
33
+ $result["post_type_{$type->post_type}"] = intval($type->count);
34
  }
35
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types', $result, $this->cache_time );
36
  }
37
 
38
  return $result;
52
  }
53
 
54
  function get_themes(){
55
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_themes' ) ) ) {
56
  $result = wp_get_themes( array( 'allowed' => true ) );
57
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_themes', $result, $this->cache_time );
58
  }
59
 
60
  return count($result);
64
  global $wpdb;
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;
84
  function get_taxonomies(){
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;
101
  function get_comments(){
102
  global $wpdb;
103
 
104
+ if ( false === ( $counts = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_comments' ) ) ) {
105
  $query = "SELECT count(distinct comment_ID) as count from {$wpdb->prefix}comments";
106
  $counts = $wpdb->get_var($query);
107
  if (!$counts) $counts = 0;
108
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_comments', $counts, $this->cache_time );
 
109
  }
110
 
111
+ return intval($counts);
112
  }
113
 
114
  function get_post_statuses(){
115
  global $wpdb;
116
 
117
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_post_statuses' ) ) ) {
118
  $query = "SELECT post_status, count(ID) as count from {$wpdb->prefix}posts group by post_status";
119
  $counts = $wpdb->get_results($query);
120
+ $result = array();
121
 
122
  foreach ($counts as $key => $type) {
123
  $type->post_status = str_replace('-', '_', $type->post_status);
124
+ $result["post_status_{$type->post_status}"] = intval($type->count);
125
  }
126
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_post_statuses', $result, $this->cache_time );
127
  }
128
 
129
  return $result;
132
  function get_user_data(){
133
  global $current_user;
134
 
135
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_user_data' ) ) ) {
136
  $data = get_userdata($current_user->ID);
137
+ $result = array("user_id" => $current_user->ID);
138
 
139
  foreach ($data->allcaps as $cap => $val) {
140
  $cap = sanitize_title($cap);
141
  $cap = str_replace('-', '_', $cap);
142
  if (!$val) $val = 0;
143
+ $result["cap_{$cap}"] = $val;
144
  }
145
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_user_data', $result, $this->cache_time );
146
  }
147
 
148
  return $result;
153
 
154
  $frameworks = array('genesis');
155
 
156
+ $result = array("theme_framework" => false);
157
 
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;
170
  }
171
  }
172
+ return $result;
173
  }
174
 
175
  function get_current_url() {
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
  }
209
 
210
  function get_plugins(){
211
 
212
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_plugins' ) ) ) {
213
  $active_plugins = wp_get_active_and_valid_plugins();
214
  $mu_plugins = get_mu_plugins();
215
  $result = array();
229
  $result[$slug] = '1.0.0';
230
  }
231
  }
232
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_plugins', $result, $this->cache_time );
233
  }
234
 
235
  return $result;
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.4.0
8
  License: GNU Version 2 or Any Later Version
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -145,6 +145,19 @@ We read and respond to every piece of feedback we get.
145
 
146
  == Changelog ==
147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  = 2.4.0 =
149
  * WordPress Customizer support
150
  * Platform fixes
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.2
8
  License: GNU Version 2 or Any Later Version
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
145
 
146
  == Changelog ==
147
 
148
+ = 2.5.2 =
149
+ * Adjust disabled walkthroughs settings
150
+ * Filter out non compatible products from settings screen
151
+ * Add domain to walkthrough compatibility filter
152
+
153
+ = 2.5.0 =
154
+ * Sidekick platform major refactoring
155
+ * Fixes issues with toggles for taskbar buttons not working
156
+
157
+ = 2.4.1 =
158
+ * Added new compatibility checking for front page static vs blog listing
159
+ * Readines for Sidekick intro walkthrough
160
+
161
  = 2.4.0 =
162
  * WordPress Customizer support
163
  * Platform fixes
sidekick.php CHANGED
@@ -6,17 +6,12 @@ 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.4.0
10
  Author: Sidekick.pro
11
  Author URI: http://www.sidekick.pro
12
  */
13
 
14
 
15
- if ( ! defined( 'PLAYER_DOMAIN' ) ) define( 'PLAYER_DOMAIN', 'player.sidekick.pro' );
16
- if ( ! defined( 'PLAYER_PATH' ) ) define( 'PLAYER_PATH', 'tag/latest' );
17
- if ( ! defined( 'PLAYER_FILE' ) ) define( 'PLAYER_FILE', 'sidekick.min.js' );
18
- if ( ! defined( 'COMPOSER_DOMAIN' ) ) define( 'COMPOSER_DOMAIN', 'composer.sidekick.pro' );
19
- if ( ! defined( 'COMPOSER_PATH' ) ) define( 'COMPOSER_PATH', 'tag/latest' );
20
  if ( ! defined( 'SK_EMBEDDED_PARTNER' ) ) define( 'SK_EMBEDDED_PARTNER', '' );
21
 
22
  if ( ! function_exists('mlog')) {
@@ -28,36 +23,27 @@ if (!class_exists('Sidekick')){
28
  class Sidekick{
29
 
30
  function __construct(){
31
- if (!defined('SK_TRACKING_API')) define('SK_TRACKING_API','//tracking.sidekick.pro/');
32
- if (!defined('SK_COMPOSER_API')) define('SK_COMPOSER_API','//apiv2.sidekick.pro');
33
  if (!defined('SK_API')) define('SK_API','//apiv2.sidekick.pro/');
34
- if (!defined('SK_LIBRARY')) define('SK_LIBRARY','//librarycache.sidekick.pro/');
35
- if (!defined('SK_ASSETS')) define('SK_ASSETS','//assets.sidekick.pro/');
36
- if (!defined('SK_AUDIO')) define('SK_AUDIO','//audio.sidekick.pro/');
37
  }
38
 
39
  function enqueue_required(){
40
- wp_enqueue_script('jquery' , null );
41
- wp_enqueue_script('underscore' , null, array('underscore'));
42
- wp_enqueue_script('backbone' , null, array('jquery','underscore'));
43
- wp_enqueue_script('jquery-ui-core' , null, array('jquery') );
44
- wp_enqueue_script('jquery-ui-position' , null, array('jquery-ui-core') );
45
- wp_enqueue_script('jquery-ui-draggable' , null, array('jquery-ui-core') );
46
- wp_enqueue_script('jquery-ui-droppable' , null, array('jquery-ui-core') );
47
- wp_enqueue_script('jquery-effects-scale' , null, array('jquery-ui-core') );
48
- wp_enqueue_script('jquery-effects-highlight' , null, array('jquery-ui-core') );
49
- wp_enqueue_script('sidekick-admin' , '//assets.sidekick.pro/plugin/tag/latest/js/sidekick_admin.js',array( 'jquery' ), null);
50
- }
 
 
 
 
51
 
52
- function enqueue(){
53
- $prod_build = apply_filters( 'sk_build', true );
54
- if ($prod_build) {
55
- wp_enqueue_script('sidekick' ,"//" . PLAYER_DOMAIN ."/" . PLAYER_PATH . "/" . PLAYER_FILE, array('backbone','jquery','underscore','jquery-effects-highlight'),null);
56
- wp_enqueue_style('wp-pointer');
57
- wp_enqueue_script('wp-pointer');
58
- } else {
59
- do_action( 'sk_enqueue' );
60
- }
61
  }
62
 
63
  function setup_menu(){
@@ -100,9 +86,11 @@ if (!class_exists('Sidekick')){
100
 
101
  $activation_id = (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : '');
102
  $sk_track_data = get_option( 'sk_track_data' );
 
103
  $sk_hide_composer_taskbar_button = get_option('sk_hide_composer_taskbar_button');
104
  $sk_hide_config_taskbar_button = get_option('sk_hide_config_taskbar_button');
105
  $sk_hide_composer_upgrade_button = get_option('sk_hide_composer_upgrade_button');
 
106
  $current_user = wp_get_current_user();
107
  $status = 'Free';
108
  $error = null;
@@ -113,6 +101,8 @@ if (!class_exists('Sidekick')){
113
  $status = 'Checking...';
114
  }
115
 
 
 
116
  global $wp_version;
117
  if (version_compare($wp_version, '3.9', '<=')) {
118
  $error = "Sorry, Sidekick requires WordPress 3.9 or higher to function.";
@@ -145,7 +135,6 @@ if (!class_exists('Sidekick')){
145
 
146
  function set_disabled_wts(){
147
 
148
-
149
  if (isset($_POST['sk_setting_disabled'])){
150
 
151
  if (!check_admin_referer('update_sk_settings')) {
@@ -226,149 +215,88 @@ if (!class_exists('Sidekick')){
226
  function footer(){
227
  global $current_user;
228
 
 
 
229
  require_once('libs/sk_config_data.php');
230
 
231
  $sk_config_data = new sk_config_data;
232
- $current_user = wp_get_current_user();
233
- $sk_just_activated = get_option( 'sk_just_activated' );
234
- $sk_track_data = get_option( 'sk_track_data' );
235
- $sk_hide_composer_taskbar_button = get_option( 'sk_hide_composer_taskbar_button' );
236
- $sk_hide_config_taskbar_button = get_option( 'sk_hide_config_taskbar_button' );
237
- $sk_hide_composer_upgrade_button = get_option( 'sk_hide_composer_upgrade_button' );
238
- $activation_id = (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : '');
239
- $autostart_network_walkthrough_id = (get_site_option('sk_autostart_walkthrough_id') ? get_site_option('sk_autostart_walkthrough_id') : 'null' );
240
  $autostart_walkthrough_id = (get_option('sk_autostart_walkthrough_id') ? get_option('sk_autostart_walkthrough_id') : $autostart_network_walkthrough_id );
241
- $custom_class = (get_option( "sk_custom_class" ) ? get_option( "sk_custom_class" ) : '');
242
  $theme = wp_get_theme();
243
- $not_supported_ie = false;
244
- $user_email = ($sk_track_data) ? $current_user->user_email : '';
245
- $disabled_wts = (!is_network_admin()) ? $sk_config_data->get_disabled_wts() : '[]';
246
- $user_role = $sk_config_data->get_user_role();
247
- $site_url = $sk_config_data->get_domain();
248
  $installed_plugins = $sk_config_data->get_plugins();
249
- $plugin_count = (isset($plugins) && is_array($plugins)) ? count($plugins) : array();
250
- $disabled_network_wts = $sk_config_data->get_disabled_network_wts();
251
- $current_url = $sk_config_data->get_current_url();
252
- $post_types = $sk_config_data->get_post_types();
253
- $taxonomies = $sk_config_data->get_taxonomies();
254
- $user_data = $sk_config_data->get_user_data();
255
- $comments = $sk_config_data->get_comments();
256
- $post_statuses = $sk_config_data->get_post_statuses();
257
- $post_types_and_statuses = $sk_config_data->get_post_types_and_statuses();
258
- $number_of_themes = $sk_config_data->get_themes();
259
- $frameworks = $sk_config_data->get_framework();
260
  $file_editor_enabled = $sk_config_data->get_file_editor_enabled();
261
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
 
 
 
 
 
 
 
263
 
264
- delete_option( 'sk_just_activated' );
265
- if(preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])) $not_supported_ie = true;
266
 
267
  ?>
268
 
269
- <?php if (!$not_supported_ie): ?>
270
-
271
- <script type="text/javascript">
272
-
273
- <?php if (is_network_admin()): ?>var is_network_admin = true; <?php endif ?>
274
-
275
- var sk_config = {
276
- // Compatibility
277
-
278
- compatibilities: {
279
- <?php echo $post_types ?>
280
- <?php echo $taxonomies ?>
281
- <?php echo $user_data ?>
282
- <?php echo $comments ?>
283
- <?php echo $post_statuses ?>
284
- <?php echo $frameworks ?>
285
- <?php echo $post_types_and_statuses ?>
286
- installed_plugins: <?php echo json_encode($installed_plugins) ?>,
287
- plugin_count: <?php echo ($plugin_count) ? $plugin_count : 0 ?>,
288
- is_multisite: <?php echo (is_multisite()) ? "true" : "false" ?>,
289
- number_of_themes: <?php echo $number_of_themes ?>,
290
- installed_theme: '<?php echo sanitize_title($theme->Name) ?>',
291
- theme_version: '<?php echo $theme->Version ?>',
292
- main_soft_version: '<?php echo get_bloginfo("version") ?>',
293
- // main_soft_version: '4.5.1',
294
- user_level: '<?php echo $user_role ?>',
295
- main_soft_name: 'WordPress',
296
- file_editor_enabled: <?php echo ($file_editor_enabled) ? $file_editor_enabled: 'null' ?>,
297
- role: '<?php echo $user_role ?>'
298
- },
299
-
300
- disable_wts: <?php echo $disabled_wts ?>,
301
- disable_network_wts: <?php echo $disabled_network_wts ?>,
302
- main_soft_name: 'WordPress',
303
- embedded: false,
304
-
305
- // User Settings
306
- activation_id: '<?php echo $activation_id ?>',
307
- auto_open_root_bucket_id: 79,
308
- auto_open_product: 'default',
309
- disable_wts_in_root_bucket_ids: [5,87],
310
- autostart_walkthrough_id: <?php echo $autostart_walkthrough_id ?>,
311
- track_data: '<?php echo $sk_track_data ?>',
312
- user_email: '<?php echo $user_email ?>',
313
- custom_class: '<?php echo $custom_class ?>',
314
-
315
- // Toggles
316
- path_not_found_continue: true,
317
- show_powered_by: true,
318
- show_powered_by_link: true,
319
- sk_autostart_only_once: true,
320
- use_native_controls: false,
321
- basics_upgrade: true,
322
- composer_upgrade_off: <?php echo ($sk_hide_composer_upgrade_button ? "true" : "false") ?>,
323
- hide_taskbar_composer_button: <?php echo ($sk_hide_composer_taskbar_button ? "true" : "false") ?>,
324
- hide_taskbar_config_button: <?php echo ($sk_hide_config_taskbar_button ? "true" : "false") ?>,
325
-
326
- // Platform Info
327
- library_version: 2,
328
- platform_id: 1,
329
- embedded_partner: '<?php echo SK_EMBEDDED_PARTNER ?>', // Track the emb
330
-
331
- // Generic Info
332
- just_activated: <?php echo ($sk_just_activated) ? "true" : "false" ?>,
333
- show_login: <?php echo ($sk_just_activated) ? "true" : "false" ?>,
334
- platform_version: null,
335
- plugin_version: '2.4.0',
336
-
337
- // SIDEKICK URLS
338
- assets: '<?php echo SK_ASSETS ?>',
339
- api: '<?php echo SK_API ?>',
340
- tracking_api: '<?php echo SK_TRACKING_API ?>',
341
- sk_path: '<?php echo PLAYER_PATH ?>',
342
- audio: '<?php echo SK_AUDIO ?>',
343
- library: '<?php echo SK_LIBRARY ?>',
344
-
345
- // URLS
346
- site_url: '<?php echo $site_url ?>',
347
- domain: '<?php echo str_replace("http://","",$_SERVER["SERVER_NAME"]) ?>',
348
- domain_used: '//<?php echo PLAYER_DOMAIN ?>/',
349
- plugin_url: '<?php echo admin_url("admin.php?page=sidekick") ?>',
350
- base_url: '<?php echo site_url() ?>',
351
- current_url: '<?php echo $current_url ?>'
352
- }
353
-
354
- sk_config.onBeforePlay = [
355
- {path: 'a.customize-controls-close,a.media-modal-close', event: 'click'}
356
- ];
357
-
358
- var skc_config = {
359
- audioPlaceholderUrl: '<?php echo SK_ASSETS ?>walkthrough-audio-placeholder.mp3',
360
- audioBaseUrl: '<?php echo SK_AUDIO ?>',
361
- apiUrl: '<?php echo SK_COMPOSER_API ?>',
362
- trackingUrl: '<?php echo SK_TRACKING_API ?>',
363
- js: '//<?php echo COMPOSER_DOMAIN ?>/<?php echo COMPOSER_PATH ?>/sidekick-composer.js',
364
- css: '//<?php echo COMPOSER_DOMAIN ?>/<?php echo COMPOSER_PATH ?>/sidekick-composer.css',
365
- baseSiteUrl: sk_config.base_url,
366
- platformId: 1,
367
- compatibilities: sk_config.compatibilities,
368
- siteAjaxUrl: window.ajaxurl || ''
369
- }
370
 
 
 
371
  </script>
 
372
  <?php endif ?>
373
 
374
  <?php
@@ -384,11 +312,11 @@ if (!class_exists('Sidekick')){
384
 
385
  switch ($data['type']) {
386
  case 'activate':
387
- $mp->track("Activate - Plugin", array("domain" => $domain));
388
  break;
389
 
390
  case 'deactivate':
391
- $mp->track("Deactivate - Plugin", array("domain" => $domain));
392
  break;
393
 
394
  default:
@@ -410,6 +338,7 @@ if (!class_exists('Sidekick')){
410
  'cookies' => array()
411
  )
412
  );
 
413
  }
414
 
415
  function activate($return = false){
@@ -435,7 +364,7 @@ if (!class_exists('Sidekick')){
435
  function check_ver(){
436
 
437
  if (isset($_GET['sk_ver_check'])){
438
- $data = json_encode('2.4.0');
439
 
440
  if(array_key_exists('callback', $_GET)){
441
 
@@ -460,7 +389,6 @@ if (!class_exists('Sidekick')){
460
 
461
  function admin_notice() {
462
  global $current_user ;
463
-
464
  if ( ! get_user_meta($current_user->ID, 'sk_ignore_notice') ) {
465
  printf ('<div class="updated"><p>Need help with WordPress? Click HELP ME in the bottom left corner to get started! <a href="%1$s">Hide</a></p></div>','?sk_ignore_notice=1');
466
  }
@@ -477,23 +405,23 @@ if (!class_exists('Sidekick')){
477
 
478
  function delete_sk_get_comments(){
479
  mlog("delete_sk_get_comments");
480
- delete_transient('sk_get_comments');
481
  }
482
 
483
  function delete_sk_get_post_types(){
484
  mlog('delete sk_get_post_types');
485
- delete_transient('sk_get_post_types');
486
- delete_transient('sk_post_statuses');
487
  }
488
 
489
  function delete_sk_get_user_data(){
490
  mlog('delete sk_get_user_data');
491
- delete_transient('sk_get_user_data');
492
  }
493
 
494
  function delete_sk_get_plugins(){
495
  mlog('delete sk_get_plugins');
496
- delete_transient('sk_get_plugins');
497
  }
498
 
499
  }
@@ -515,15 +443,11 @@ if (!class_exists('Sidekick')){
515
  if (!(isset($_GET['tab']) && $_GET['tab'] == 'plugin-information')) {
516
  add_action('admin_footer', array($sidekick,'footer'));
517
  add_action('customize_controls_print_footer_scripts', array($sidekick,'footer'));
518
- add_action('admin_enqueue_scripts', array($sidekick,'enqueue'));
519
  add_action('admin_enqueue_scripts', array($sidekick,'enqueue_required'));
520
- add_action('customize_controls_enqueue_scripts', array($sidekick,'enqueue'),1000);
521
  add_action('customize_controls_enqueue_scripts', array($sidekick,'enqueue_required'),1000);
522
  }
523
-
524
- // Not working right now
525
- // add_action('transition_post_status',array($sidekick,'delete_sk_get_post_types_and_statuses'));
526
- // add_action('clean_post_cache',array($sidekick,'delete_sk_get_post_types_and_statuses'));
527
 
528
  add_action('wp_update_comment_count',array($sidekick,'delete_sk_get_comments'));
529
 
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.2
10
  Author: Sidekick.pro
11
  Author URI: http://www.sidekick.pro
12
  */
13
 
14
 
 
 
 
 
 
15
  if ( ! defined( 'SK_EMBEDDED_PARTNER' ) ) define( 'SK_EMBEDDED_PARTNER', '' );
16
 
17
  if ( ! function_exists('mlog')) {
23
  class 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.2'));
 
 
28
  }
29
 
30
  function enqueue_required(){
31
+ wp_enqueue_script('jquery' , null );
32
+ wp_enqueue_script('underscore' , null, array('underscore'));
33
+ wp_enqueue_script('backbone' , null, array('jquery','underscore'));
34
+ wp_enqueue_script('jquery-ui-core' , null, array('jquery') );
35
+ wp_enqueue_script('jquery-ui-position' , null, array('jquery-ui-core') );
36
+ wp_enqueue_script('jquery-ui-draggable' , null, array('jquery-ui-core') );
37
+ wp_enqueue_script('jquery-ui-droppable' , null, array('jquery-ui-core') );
38
+ wp_enqueue_script('jquery-effects-scale' , null, array('jquery-ui-core') );
39
+ wp_enqueue_script('jquery-effects-highlight' , null, array('jquery-ui-core') );
40
+ wp_enqueue_script('sidekick-admin' , '//assets.sidekick.pro/plugin/tag/latest/js/sidekick_admin.js',array( 'jquery' ), null);
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
+ do_action('post_enqueue_required');
46
 
 
 
 
 
 
 
 
 
 
47
  }
48
 
49
  function setup_menu(){
86
 
87
  $activation_id = (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : '');
88
  $sk_track_data = get_option( 'sk_track_data' );
89
+
90
  $sk_hide_composer_taskbar_button = get_option('sk_hide_composer_taskbar_button');
91
  $sk_hide_config_taskbar_button = get_option('sk_hide_config_taskbar_button');
92
  $sk_hide_composer_upgrade_button = get_option('sk_hide_composer_upgrade_button');
93
+
94
  $current_user = wp_get_current_user();
95
  $status = 'Free';
96
  $error = null;
101
  $status = 'Checking...';
102
  }
103
 
104
+ $this->track(array('what' => 'Settings Page', 'where' => 'plugin'));
105
+
106
  global $wp_version;
107
  if (version_compare($wp_version, '3.9', '<=')) {
108
  $error = "Sorry, Sidekick requires WordPress 3.9 or higher to function.";
135
 
136
  function set_disabled_wts(){
137
 
 
138
  if (isset($_POST['sk_setting_disabled'])){
139
 
140
  if (!check_admin_referer('update_sk_settings')) {
215
  function footer(){
216
  global $current_user;
217
 
218
+ delete_option( 'sk_just_activated' );
219
+
220
  require_once('libs/sk_config_data.php');
221
 
222
  $sk_config_data = new sk_config_data;
223
+
224
+ $current_user = (get_option( 'sk_track_data' )) ? wp_get_current_user() : null;
225
+
226
+ $autostart_network_walkthrough_id = (get_site_option('sk_autostart_walkthrough_id') ? get_site_option('sk_autostart_walkthrough_id') : null );
 
 
 
 
227
  $autostart_walkthrough_id = (get_option('sk_autostart_walkthrough_id') ? get_option('sk_autostart_walkthrough_id') : $autostart_network_walkthrough_id );
 
228
  $theme = wp_get_theme();
229
+
 
 
 
 
230
  $installed_plugins = $sk_config_data->get_plugins();
 
 
 
 
 
 
 
 
 
 
 
231
  $file_editor_enabled = $sk_config_data->get_file_editor_enabled();
232
 
233
+ $sk_config = array(
234
+ "compatibilities" => array(
235
+ "comment_count" => $sk_config_data->get_comments(),
236
+ "domain" => str_replace("http://","",$_SERVER["SERVER_NAME"]),
237
+ "installed_plugins" => (isset($installed_plugins)) ? $installed_plugins : array(),
238
+ "installed_theme" => sanitize_title($theme->Name),
239
+ "is_multisite" => (is_multisite()) ? true : false,
240
+ "main_soft_version" => get_bloginfo("version"),
241
+ "number_of_themes" => $sk_config_data->get_themes(),
242
+ "page_for_posts" => intval(get_option('page_for_posts')),
243
+ "page_on_front" => intval(get_option('page_on_front')),
244
+ "plugin_count" => (isset($installed_plugins) && is_array($installed_plugins)) ? count($installed_plugins) : 0,
245
+ "role" => $sk_config_data->get_user_role(),
246
+ "show_on_front" => get_option('show_on_front'),
247
+ "theme_version" => $theme->Version
248
+ ),
249
+
250
+ // Platform
251
+ "baseClientUrl" => site_url(),
252
+ "base_url" => site_url(),
253
+
254
+ // User Settings
255
+ "activation_id" => (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : ''),
256
+ "custom_class" => (get_option( "sk_custom_class" ) ? get_option( "sk_custom_class" ) : ''),
257
+ "distributor_id" => (get_option( "sk_distributor_id" ) ? intval(get_option( "sk_distributor_id" )) : ''),
258
+ "user_email" => ($current_user) ? $current_user->user_email : '',
259
+ "autostart_walkthrough_id" => ($autostart_walkthrough_id) ? $autostart_walkthrough_id : '',
260
+ "disable_wts" => (!is_network_admin()) ? $sk_config_data->get_disabled_wts() : array(), // Copying these to compatibilities, have to update this over time
261
+ "disable_network_wts" => $sk_config_data->get_disabled_network_wts(), // Copying these to compatibilities, have to update this over time
262
+
263
+ // Toggles
264
+ "hide_taskbar_composer_button" => (get_option( 'sk_hide_composer_taskbar_button' ) ? true : false), // hide composer button on the taskbar
265
+ "hide_taskbar_config_button" => (get_option( 'sk_hide_config_taskbar_button' ) ? true : false), // hide settings button on taskbar
266
+ "show_login" => (get_option( 'sk_just_activated' )) ? true : false, // open drawer automatically, same as just_activated
267
+
268
+ // WordPress
269
+ "embedded" => false,
270
+ "embedPartner" => SK_EMBEDDED_PARTNER, // for tracking purposes if sidekick has been embeded in another WordPress plugin or theme
271
+ "plugin_version" => '2.5.2', // WordPress plugin version
272
+ "site_url" => $sk_config_data->get_domain(),
273
+ "domain" => str_replace("http://","",$_SERVER["SERVER_NAME"]),
274
+ "plugin_url" => admin_url("admin.php?page=sidekick"),
275
+
276
+ );
277
+
278
+ if ($file_editor_enabled) { //
279
+ $sk_config["compatibilities"]["file_editor_enabled"] = $file_editor_enabled;
280
+ }
281
 
282
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_post_types());
283
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_taxonomies());
284
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_user_data());
285
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_post_statuses());
286
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_post_types_and_statuses());
287
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_framework());
288
 
289
+ $sk_config = apply_filters('sk_config',$sk_config);
 
290
 
291
  ?>
292
 
293
+ <!-- Old IE Not Supported -->
294
+ <?php if (!preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])): ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
 
296
+ <script type="text/preloaded" data-provider="sidekick">
297
+ <?php echo json_encode($sk_config) ?>
298
  </script>
299
+
300
  <?php endif ?>
301
 
302
  <?php
312
 
313
  switch ($data['type']) {
314
  case 'activate':
315
+ $mp->track("Activate - Plugin", array("domain" => $domain));
316
  break;
317
 
318
  case 'deactivate':
319
+ $mp->track("Deactivate - Plugin", array("domain" => $domain));
320
  break;
321
 
322
  default:
338
  'cookies' => array()
339
  )
340
  );
341
+ mlog('$response',$response);
342
  }
343
 
344
  function activate($return = false){
364
  function check_ver(){
365
 
366
  if (isset($_GET['sk_ver_check'])){
367
+ $data = json_encode('2.5.2');
368
 
369
  if(array_key_exists('callback', $_GET)){
370
 
389
 
390
  function admin_notice() {
391
  global $current_user ;
 
392
  if ( ! get_user_meta($current_user->ID, 'sk_ignore_notice') ) {
393
  printf ('<div class="updated"><p>Need help with WordPress? Click HELP ME in the bottom left corner to get started! <a href="%1$s">Hide</a></p></div>','?sk_ignore_notice=1');
394
  }
405
 
406
  function delete_sk_get_comments(){
407
  mlog("delete_sk_get_comments");
408
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_comments');
409
  }
410
 
411
  function delete_sk_get_post_types(){
412
  mlog('delete sk_get_post_types');
413
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_post_types');
414
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_post_statuses');
415
  }
416
 
417
  function delete_sk_get_user_data(){
418
  mlog('delete sk_get_user_data');
419
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_user_data');
420
  }
421
 
422
  function delete_sk_get_plugins(){
423
  mlog('delete sk_get_plugins');
424
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_plugins');
425
  }
426
 
427
  }
443
  if (!(isset($_GET['tab']) && $_GET['tab'] == 'plugin-information')) {
444
  add_action('admin_footer', array($sidekick,'footer'));
445
  add_action('customize_controls_print_footer_scripts', array($sidekick,'footer'));
 
446
  add_action('admin_enqueue_scripts', array($sidekick,'enqueue_required'));
 
447
  add_action('customize_controls_enqueue_scripts', array($sidekick,'enqueue_required'),1000);
448
  }
449
+
450
+ // Reset Transient Cache
 
 
451
 
452
  add_action('wp_update_comment_count',array($sidekick,'delete_sk_get_comments'));
453
 
sidekick_embed.php CHANGED
@@ -8,17 +8,12 @@ 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.4.0
12
  Author: Sidekick.pro
13
  Author URI: http://www.sidekick.pro
14
  */
15
 
16
 
17
- if ( ! defined( 'PLAYER_DOMAIN' ) ) define( 'PLAYER_DOMAIN', 'player.sidekick.pro' );
18
- if ( ! defined( 'PLAYER_PATH' ) ) define( 'PLAYER_PATH', 'tag/latest' );
19
- if ( ! defined( 'PLAYER_FILE' ) ) define( 'PLAYER_FILE', 'sidekick.min.js' );
20
- if ( ! defined( 'COMPOSER_DOMAIN' ) ) define( 'COMPOSER_DOMAIN', 'composer.sidekick.pro' );
21
- if ( ! defined( 'COMPOSER_PATH' ) ) define( 'COMPOSER_PATH', 'tag/latest' );
22
  if ( ! defined( 'SK_EMBEDDED_PARTNER' ) ) define( 'SK_EMBEDDED_PARTNER', '' );
23
 
24
  if ( ! function_exists('mlog')) {
@@ -33,36 +28,27 @@ if (!$sidekick_active && !class_exists('Sidekick')){
33
  class Sidekick{
34
 
35
  function __construct(){
36
- if (!defined('SK_TRACKING_API')) define('SK_TRACKING_API','//tracking.sidekick.pro/');
37
- if (!defined('SK_COMPOSER_API')) define('SK_COMPOSER_API','//apiv2.sidekick.pro');
38
  if (!defined('SK_API')) define('SK_API','//apiv2.sidekick.pro/');
39
- if (!defined('SK_LIBRARY')) define('SK_LIBRARY','//librarycache.sidekick.pro/');
40
- if (!defined('SK_ASSETS')) define('SK_ASSETS','//assets.sidekick.pro/');
41
- if (!defined('SK_AUDIO')) define('SK_AUDIO','//audio.sidekick.pro/');
42
  }
43
 
44
  function enqueue_required(){
45
- wp_enqueue_script('jquery' , null );
46
- wp_enqueue_script('underscore' , null, array('underscore'));
47
- wp_enqueue_script('backbone' , null, array('jquery','underscore'));
48
- wp_enqueue_script('jquery-ui-core' , null, array('jquery') );
49
- wp_enqueue_script('jquery-ui-position' , null, array('jquery-ui-core') );
50
- wp_enqueue_script('jquery-ui-draggable' , null, array('jquery-ui-core') );
51
- wp_enqueue_script('jquery-ui-droppable' , null, array('jquery-ui-core') );
52
- wp_enqueue_script('jquery-effects-scale' , null, array('jquery-ui-core') );
53
- wp_enqueue_script('jquery-effects-highlight' , null, array('jquery-ui-core') );
54
- wp_enqueue_script('sidekick-admin' , '//assets.sidekick.pro/plugin/tag/latest/js/sidekick_admin.js',array( 'jquery' ), null);
55
- }
 
 
 
 
56
 
57
- function enqueue(){
58
- $prod_build = apply_filters( 'sk_build', true );
59
- if ($prod_build) {
60
- wp_enqueue_script('sidekick' ,"//" . PLAYER_DOMAIN ."/" . PLAYER_PATH . "/" . PLAYER_FILE, array('backbone','jquery','underscore','jquery-effects-highlight'),null);
61
- wp_enqueue_style('wp-pointer');
62
- wp_enqueue_script('wp-pointer');
63
- } else {
64
- do_action( 'sk_enqueue' );
65
- }
66
  }
67
 
68
  function setup_menu(){
@@ -105,9 +91,11 @@ if (!$sidekick_active && !class_exists('Sidekick')){
105
 
106
  $activation_id = (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : '');
107
  $sk_track_data = get_option( 'sk_track_data' );
 
108
  $sk_hide_composer_taskbar_button = get_option('sk_hide_composer_taskbar_button');
109
  $sk_hide_config_taskbar_button = get_option('sk_hide_config_taskbar_button');
110
  $sk_hide_composer_upgrade_button = get_option('sk_hide_composer_upgrade_button');
 
111
  $current_user = wp_get_current_user();
112
  $status = 'Free';
113
  $error = null;
@@ -118,6 +106,8 @@ if (!$sidekick_active && !class_exists('Sidekick')){
118
  $status = 'Checking...';
119
  }
120
 
 
 
121
  global $wp_version;
122
  if (version_compare($wp_version, '3.9', '<=')) {
123
  $error = "Sorry, Sidekick requires WordPress 3.9 or higher to function.";
@@ -151,10 +141,6 @@ if (!$sidekick_active && !class_exists('Sidekick')){
151
  var last_site_key = null;
152
  var sk_ms_admin = false;
153
 
154
- jQuery(document).ready(function($) {
155
- mixpanel.track('Settings Page Visit - Plugin');
156
- });
157
-
158
  </script>
159
 
160
  <div class="page-header"><h2><a id="pluginlogo_32" class="header-icon32" href="http://www.sidekick.pro/modules/wordpress-core-module-premium/?utm_source=plugin&utm_medium=settings&utm_campaign=header" target="_blank"></a>Sidekick Dashboard</h2></div>
@@ -225,7 +211,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
225
  Enable Composer Mode
226
  </th>
227
  <td>
228
- <button class='open_composer'>Open Composer</button>
229
  </td>
230
  </tr>
231
  </tbody>
@@ -391,7 +377,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
391
  <li><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://sidekick.pro" data-text="I use @sidekickhelps for the fastest and easiest way to learn WordPress." data-via="sidekickhelps" data-size="large">Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></li>
392
  <li>Like SIDEKICK? Please leave us a 5 star rating on <a href='http://WordPress.org' target='_blank'>WordPress.org</a></li>
393
  <li><a href="http://www.sidekick.pro/plans/wordpress-basics/">Sign up for a full WordPress Basics package</a></li>
394
- <li><a href="http://support.sidekick.pro/category/85-getting-started" target="_blank"><strong>Visit the SIDEKICK Quick Start guides</strong></a>.</li>
395
  </ul>
396
  </div>
397
  </div>
@@ -408,7 +394,6 @@ if (!$sidekick_active && !class_exists('Sidekick')){
408
 
409
  function set_disabled_wts(){
410
 
411
-
412
  if (isset($_POST['sk_setting_disabled'])){
413
 
414
  if (!check_admin_referer('update_sk_settings')) {
@@ -489,149 +474,88 @@ if (!$sidekick_active && !class_exists('Sidekick')){
489
  function footer(){
490
  global $current_user;
491
 
 
 
492
 
493
 
494
  $sk_config_data = new sk_config_data;
495
- $current_user = wp_get_current_user();
496
- $sk_just_activated = get_option( 'sk_just_activated' );
497
- $sk_track_data = get_option( 'sk_track_data' );
498
- $sk_hide_composer_taskbar_button = get_option( 'sk_hide_composer_taskbar_button' );
499
- $sk_hide_config_taskbar_button = get_option( 'sk_hide_config_taskbar_button' );
500
- $sk_hide_composer_upgrade_button = get_option( 'sk_hide_composer_upgrade_button' );
501
- $activation_id = (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : '');
502
- $autostart_network_walkthrough_id = (get_site_option('sk_autostart_walkthrough_id') ? get_site_option('sk_autostart_walkthrough_id') : 'null' );
503
  $autostart_walkthrough_id = (get_option('sk_autostart_walkthrough_id') ? get_option('sk_autostart_walkthrough_id') : $autostart_network_walkthrough_id );
504
- $custom_class = (get_option( "sk_custom_class" ) ? get_option( "sk_custom_class" ) : '');
505
  $theme = wp_get_theme();
506
- $not_supported_ie = false;
507
- $user_email = ($sk_track_data) ? $current_user->user_email : '';
508
- $disabled_wts = (!is_network_admin()) ? $sk_config_data->get_disabled_wts() : '[]';
509
- $user_role = $sk_config_data->get_user_role();
510
- $site_url = $sk_config_data->get_domain();
511
  $installed_plugins = $sk_config_data->get_plugins();
512
- $plugin_count = (isset($plugins) && is_array($plugins)) ? count($plugins) : array();
513
- $disabled_network_wts = $sk_config_data->get_disabled_network_wts();
514
- $current_url = $sk_config_data->get_current_url();
515
- $post_types = $sk_config_data->get_post_types();
516
- $taxonomies = $sk_config_data->get_taxonomies();
517
- $user_data = $sk_config_data->get_user_data();
518
- $comments = $sk_config_data->get_comments();
519
- $post_statuses = $sk_config_data->get_post_statuses();
520
- $post_types_and_statuses = $sk_config_data->get_post_types_and_statuses();
521
- $number_of_themes = $sk_config_data->get_themes();
522
- $frameworks = $sk_config_data->get_framework();
523
  $file_editor_enabled = $sk_config_data->get_file_editor_enabled();
524
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
525
 
 
 
 
 
 
 
526
 
527
- delete_option( 'sk_just_activated' );
528
- if(preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])) $not_supported_ie = true;
529
 
530
  ?>
531
 
532
- <?php if (!$not_supported_ie): ?>
533
-
534
- <script type="text/javascript">
535
-
536
- <?php if (is_network_admin()): ?>var is_network_admin = true; <?php endif ?>
537
-
538
- var sk_config = {
539
- // Compatibility
540
-
541
- compatibilities: {
542
- <?php echo $post_types ?>
543
- <?php echo $taxonomies ?>
544
- <?php echo $user_data ?>
545
- <?php echo $comments ?>
546
- <?php echo $post_statuses ?>
547
- <?php echo $frameworks ?>
548
- <?php echo $post_types_and_statuses ?>
549
- installed_plugins: <?php echo json_encode($installed_plugins) ?>,
550
- plugin_count: <?php echo ($plugin_count) ? $plugin_count : 0 ?>,
551
- is_multisite: <?php echo (is_multisite()) ? "true" : "false" ?>,
552
- number_of_themes: <?php echo $number_of_themes ?>,
553
- installed_theme: '<?php echo sanitize_title($theme->Name) ?>',
554
- theme_version: '<?php echo $theme->Version ?>',
555
- main_soft_version: '<?php echo get_bloginfo("version") ?>',
556
- // main_soft_version: '4.5.1',
557
- user_level: '<?php echo $user_role ?>',
558
- main_soft_name: 'WordPress',
559
- file_editor_enabled: <?php echo ($file_editor_enabled) ? $file_editor_enabled: 'null' ?>,
560
- role: '<?php echo $user_role ?>'
561
- },
562
-
563
- disable_wts: <?php echo $disabled_wts ?>,
564
- disable_network_wts: <?php echo $disabled_network_wts ?>,
565
- main_soft_name: 'WordPress',
566
- embedded: false,
567
-
568
- // User Settings
569
- activation_id: '<?php echo $activation_id ?>',
570
- auto_open_root_bucket_id: 79,
571
- auto_open_product: 'default',
572
- disable_wts_in_root_bucket_ids: [5,87],
573
- autostart_walkthrough_id: <?php echo $autostart_walkthrough_id ?>,
574
- track_data: '<?php echo $sk_track_data ?>',
575
- user_email: '<?php echo $user_email ?>',
576
- custom_class: '<?php echo $custom_class ?>',
577
-
578
- // Toggles
579
- path_not_found_continue: true,
580
- show_powered_by: true,
581
- show_powered_by_link: true,
582
- sk_autostart_only_once: true,
583
- use_native_controls: false,
584
- basics_upgrade: true,
585
- composer_upgrade_off: <?php echo ($sk_hide_composer_upgrade_button ? "true" : "false") ?>,
586
- hide_taskbar_composer_button: <?php echo ($sk_hide_composer_taskbar_button ? "true" : "false") ?>,
587
- hide_taskbar_config_button: <?php echo ($sk_hide_config_taskbar_button ? "true" : "false") ?>,
588
-
589
- // Platform Info
590
- library_version: 2,
591
- platform_id: 1,
592
- embedded_partner: '<?php echo SK_EMBEDDED_PARTNER ?>', // Track the emb
593
-
594
- // Generic Info
595
- just_activated: <?php echo ($sk_just_activated) ? "true" : "false" ?>,
596
- show_login: <?php echo ($sk_just_activated) ? "true" : "false" ?>,
597
- platform_version: null,
598
- plugin_version: '2.4.0',
599
-
600
- // SIDEKICK URLS
601
- assets: '<?php echo SK_ASSETS ?>',
602
- api: '<?php echo SK_API ?>',
603
- tracking_api: '<?php echo SK_TRACKING_API ?>',
604
- sk_path: '<?php echo PLAYER_PATH ?>',
605
- audio: '<?php echo SK_AUDIO ?>',
606
- library: '<?php echo SK_LIBRARY ?>',
607
-
608
- // URLS
609
- site_url: '<?php echo $site_url ?>',
610
- domain: '<?php echo str_replace("http://","",$_SERVER["SERVER_NAME"]) ?>',
611
- domain_used: '//<?php echo PLAYER_DOMAIN ?>/',
612
- plugin_url: '<?php echo admin_url("admin.php?page=sidekick") ?>',
613
- base_url: '<?php echo site_url() ?>',
614
- current_url: '<?php echo $current_url ?>'
615
- }
616
-
617
- sk_config.onBeforePlay = [
618
- {path: 'a.customize-controls-close,a.media-modal-close', event: 'click'}
619
- ];
620
-
621
- var skc_config = {
622
- audioPlaceholderUrl: '<?php echo SK_ASSETS ?>walkthrough-audio-placeholder.mp3',
623
- audioBaseUrl: '<?php echo SK_AUDIO ?>',
624
- apiUrl: '<?php echo SK_COMPOSER_API ?>',
625
- trackingUrl: '<?php echo SK_TRACKING_API ?>',
626
- js: '//<?php echo COMPOSER_DOMAIN ?>/<?php echo COMPOSER_PATH ?>/sidekick-composer.js',
627
- css: '//<?php echo COMPOSER_DOMAIN ?>/<?php echo COMPOSER_PATH ?>/sidekick-composer.css',
628
- baseSiteUrl: sk_config.base_url,
629
- platformId: 1,
630
- compatibilities: sk_config.compatibilities,
631
- siteAjaxUrl: window.ajaxurl || ''
632
- }
633
 
 
 
634
  </script>
 
635
  <?php endif ?>
636
 
637
  <?php
@@ -647,11 +571,11 @@ if (!$sidekick_active && !class_exists('Sidekick')){
647
 
648
  switch ($data['type']) {
649
  case 'activate':
650
- $mp->track("Activate - Plugin", array("domain" => $domain));
651
  break;
652
 
653
  case 'deactivate':
654
- $mp->track("Deactivate - Plugin", array("domain" => $domain));
655
  break;
656
 
657
  default:
@@ -673,6 +597,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
673
  'cookies' => array()
674
  )
675
  );
 
676
  }
677
 
678
  function activate($return = false){
@@ -698,7 +623,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
698
  function check_ver(){
699
 
700
  if (isset($_GET['sk_ver_check'])){
701
- $data = json_encode('2.4.0');
702
 
703
  if(array_key_exists('callback', $_GET)){
704
 
@@ -723,7 +648,6 @@ if (!$sidekick_active && !class_exists('Sidekick')){
723
 
724
  function admin_notice() {
725
  global $current_user ;
726
-
727
  if ( ! get_user_meta($current_user->ID, 'sk_ignore_notice') ) {
728
  printf ('<div class="updated"><p>Need help with WordPress? Click HELP ME in the bottom left corner to get started! <a href="%1$s">Hide</a></p></div>','?sk_ignore_notice=1');
729
  }
@@ -740,23 +664,23 @@ if (!$sidekick_active && !class_exists('Sidekick')){
740
 
741
  function delete_sk_get_comments(){
742
  mlog("delete_sk_get_comments");
743
- delete_transient('sk_get_comments');
744
  }
745
 
746
  function delete_sk_get_post_types(){
747
  mlog('delete sk_get_post_types');
748
- delete_transient('sk_get_post_types');
749
- delete_transient('sk_post_statuses');
750
  }
751
 
752
  function delete_sk_get_user_data(){
753
  mlog('delete sk_get_user_data');
754
- delete_transient('sk_get_user_data');
755
  }
756
 
757
  function delete_sk_get_plugins(){
758
  mlog('delete sk_get_plugins');
759
- delete_transient('sk_get_plugins');
760
  }
761
 
762
  }
@@ -778,15 +702,11 @@ if (!$sidekick_active && !class_exists('Sidekick')){
778
  if (!(isset($_GET['tab']) && $_GET['tab'] == 'plugin-information')) {
779
  add_action('admin_footer', array($sidekick,'footer'));
780
  add_action('customize_controls_print_footer_scripts', array($sidekick,'footer'));
781
- add_action('admin_enqueue_scripts', array($sidekick,'enqueue'));
782
  add_action('admin_enqueue_scripts', array($sidekick,'enqueue_required'));
783
- add_action('customize_controls_enqueue_scripts', array($sidekick,'enqueue'),1000);
784
  add_action('customize_controls_enqueue_scripts', array($sidekick,'enqueue_required'),1000);
785
  }
786
-
787
- // Not working right now
788
- // add_action('transition_post_status',array($sidekick,'delete_sk_get_post_types_and_statuses'));
789
- // add_action('clean_post_cache',array($sidekick,'delete_sk_get_post_types_and_statuses'));
790
 
791
  add_action('wp_update_comment_count',array($sidekick,'delete_sk_get_comments'));
792
 
@@ -1276,6 +1196,8 @@ if (!$sidekick_active && !class_exists('sidekickMassActivator')) {
1276
  $sk_hide_composer_upgrade_button = get_option('sk_hide_composer_upgrade_button');
1277
  $is_ms_admin = true;
1278
 
 
 
1279
  ?>
1280
  ?> <!-- ms_admin_page.php -->
1281
 
@@ -1286,12 +1208,6 @@ if (!$sidekick_active && !class_exists('sidekickMassActivator')) {
1286
  var last_site_key = null;
1287
  var sk_ms_admin = true;
1288
 
1289
- jQuery(document).ready(function($) {
1290
- if (typeof mixpanel !== 'undefined') {
1291
- mixpanel.track('Network Settings Page Visit - Plugin');
1292
- };
1293
- });
1294
-
1295
  </script>
1296
 
1297
  <div class="page-header"><h2><a id="pluginlogo_32" class="header-icon32" href="http://www.sidekick.pro" target="_blank"></a>Sidekick Licensing</h2></div>
@@ -1616,17 +1532,17 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1616
  function get_post_types(){
1617
  global $wpdb;
1618
 
1619
- if ( false === ( $result = get_transient( 'sk_get_post_types' ) ) ) {
1620
 
1621
  $query = "SELECT post_type, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type";
1622
  $counts = $wpdb->get_results($query);
1623
- $result = '';
1624
 
1625
  foreach ($counts as $key => $type) {
1626
  $type->post_type = str_replace('-', '_', $type->post_type);
1627
- $result .= "\n post_type_{$type->post_type} : $type->count,";
1628
  }
1629
- set_transient( 'sk_get_post_types', $result, $this->cache_time );
1630
  }
1631
 
1632
  return $result;
@@ -1646,9 +1562,9 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1646
  }
1647
 
1648
  function get_themes(){
1649
- if ( false === ( $result = get_transient( 'sk_get_themes' ) ) ) {
1650
  $result = wp_get_themes( array( 'allowed' => true ) );
1651
- set_transient( 'sk_get_themes', $result, $this->cache_time );
1652
  }
1653
 
1654
  return count($result);
@@ -1658,18 +1574,18 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1658
  global $wpdb;
1659
 
1660
  // Can't find a good method to clear cache for newly registered post types that fires once
1661
- // if ( false === ( $result = get_transient( 'sk_get_post_types_and_statuses' ) ) ) {
1662
  $query = "SELECT post_type, post_status, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type, post_status";
1663
  $counts = $wpdb->get_results($query);
1664
- $result = '';
1665
 
1666
  foreach ($counts as $key => $type) {
1667
  $type->post_type = str_replace('-', '_', $type->post_type);
1668
  $type->post_status = str_replace('-', '_', $type->post_status);
1669
 
1670
- $result .= "\n post_type_{$type->post_type}_{$type->post_status} : $type->count,";
1671
  }
1672
- set_transient( 'sk_get_post_types_and_statuses', $result, $this->cache_time );
1673
  // }
1674
 
1675
  return $result;
@@ -1678,16 +1594,15 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1678
  function get_taxonomies(){
1679
  global $wpdb;
1680
 
1681
- // if ( false === ( $result = get_transient( 'sk_get_taxonomies' ) ) ) {
1682
  $query = "SELECT count(distinct term_taxonomy_id) as count, taxonomy from {$wpdb->prefix}term_taxonomy group by taxonomy";
1683
  $counts = $wpdb->get_results($query);
1684
- $result = '';
1685
 
1686
  foreach ($counts as $key => $taxonomy) {
1687
  $taxonomy->taxonomy = str_replace('-', '_', $taxonomy->taxonomy);
1688
- $result .= "\n taxonomy_{$taxonomy->taxonomy} : $taxonomy->count,";
1689
  }
1690
- set_transient( 'sk_get_taxonomies', $result, $this->cache_time );
1691
  // }
1692
 
1693
  return $result;
@@ -1696,30 +1611,29 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1696
  function get_comments(){
1697
  global $wpdb;
1698
 
1699
- if ( false === ( $result = get_transient( 'sk_get_comments' ) ) ) {
1700
  $query = "SELECT count(distinct comment_ID) as count from {$wpdb->prefix}comments";
1701
  $counts = $wpdb->get_var($query);
1702
  if (!$counts) $counts = 0;
1703
- $result = "\n comment_count : $counts,";
1704
- set_transient( 'sk_get_comments', $result, $this->cache_time );
1705
  }
1706
 
1707
- return $result;
1708
  }
1709
 
1710
  function get_post_statuses(){
1711
  global $wpdb;
1712
 
1713
- if ( false === ( $result = get_transient( 'sk_post_statuses' ) ) ) {
1714
  $query = "SELECT post_status, count(ID) as count from {$wpdb->prefix}posts group by post_status";
1715
  $counts = $wpdb->get_results($query);
1716
- $result = '';
1717
 
1718
  foreach ($counts as $key => $type) {
1719
  $type->post_status = str_replace('-', '_', $type->post_status);
1720
- $result .= "\n post_status_{$type->post_status} : $type->count,";
1721
  }
1722
- set_transient( 'sk_post_statuses', $result, $this->cache_time );
1723
  }
1724
 
1725
  return $result;
@@ -1728,17 +1642,17 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1728
  function get_user_data(){
1729
  global $current_user;
1730
 
1731
- if ( false === ( $result = get_transient( 'sk_get_user_data' ) ) ) {
1732
  $data = get_userdata($current_user->ID);
1733
- $result = "\n user_id : $current_user->ID,";
1734
 
1735
  foreach ($data->allcaps as $cap => $val) {
1736
  $cap = sanitize_title($cap);
1737
  $cap = str_replace('-', '_', $cap);
1738
  if (!$val) $val = 0;
1739
- $result .= "\n cap_{$cap} : $val,";
1740
  }
1741
- set_transient( 'sk_get_user_data', $result, $this->cache_time );
1742
  }
1743
 
1744
  return $result;
@@ -1749,20 +1663,23 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1749
 
1750
  $frameworks = array('genesis');
1751
 
1752
- $output = "\n theme_framework : false,";
1753
 
1754
  foreach ($frameworks as $framework) {
1755
  switch ($framework) {
1756
  case 'genesis':
1757
  if (function_exists( 'genesis' ) ) {
1758
  if (defined('PARENT_THEME_VERSION')) {
1759
- $output = "\n theme_framework : {name: '" . $framework . "', version: '" . PARENT_THEME_VERSION . "'},";
 
 
 
1760
  }
1761
  }
1762
  break;
1763
  }
1764
  }
1765
- return $output;
1766
  }
1767
 
1768
  function get_current_url() {
@@ -1782,6 +1699,7 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1782
 
1783
  function get_disabled_wts(){
1784
  $wts = str_replace('"', '', get_option('sk_disabled_wts'));
 
1785
  if ($wts) {
1786
  return $wts;
1787
  }
@@ -1791,6 +1709,7 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1791
  function get_disabled_network_wts(){
1792
  if (is_multisite()) {
1793
  $wts = str_replace('"', '', get_site_option('sk_disabled_wts'));
 
1794
  if ($wts) {
1795
  return $wts;
1796
  }
@@ -1800,7 +1719,7 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1800
 
1801
  function get_plugins(){
1802
 
1803
- if ( false === ( $result = get_transient( 'sk_get_plugins' ) ) ) {
1804
  $active_plugins = wp_get_active_and_valid_plugins();
1805
  $mu_plugins = get_mu_plugins();
1806
  $result = array();
@@ -1820,7 +1739,7 @@ if (!$sidekick_active && !class_exists('sk_config_data')) {
1820
  $result[$slug] = '1.0.0';
1821
  }
1822
  }
1823
- set_transient( 'sk_get_plugins', $result, $this->cache_time );
1824
  }
1825
 
1826
  return $result;
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.2
12
  Author: Sidekick.pro
13
  Author URI: http://www.sidekick.pro
14
  */
15
 
16
 
 
 
 
 
 
17
  if ( ! defined( 'SK_EMBEDDED_PARTNER' ) ) define( 'SK_EMBEDDED_PARTNER', '' );
18
 
19
  if ( ! function_exists('mlog')) {
28
  class 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.2'));
 
 
33
  }
34
 
35
  function enqueue_required(){
36
+ wp_enqueue_script('jquery' , null );
37
+ wp_enqueue_script('underscore' , null, array('underscore'));
38
+ wp_enqueue_script('backbone' , null, array('jquery','underscore'));
39
+ wp_enqueue_script('jquery-ui-core' , null, array('jquery') );
40
+ wp_enqueue_script('jquery-ui-position' , null, array('jquery-ui-core') );
41
+ wp_enqueue_script('jquery-ui-draggable' , null, array('jquery-ui-core') );
42
+ wp_enqueue_script('jquery-ui-droppable' , null, array('jquery-ui-core') );
43
+ wp_enqueue_script('jquery-effects-scale' , null, array('jquery-ui-core') );
44
+ wp_enqueue_script('jquery-effects-highlight' , null, array('jquery-ui-core') );
45
+ wp_enqueue_script('sidekick-admin' , '//assets.sidekick.pro/plugin/tag/latest/js/sidekick_admin.js',array( 'jquery' ), null);
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
+ do_action('post_enqueue_required');
51
 
 
 
 
 
 
 
 
 
 
52
  }
53
 
54
  function setup_menu(){
91
 
92
  $activation_id = (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : '');
93
  $sk_track_data = get_option( 'sk_track_data' );
94
+
95
  $sk_hide_composer_taskbar_button = get_option('sk_hide_composer_taskbar_button');
96
  $sk_hide_config_taskbar_button = get_option('sk_hide_config_taskbar_button');
97
  $sk_hide_composer_upgrade_button = get_option('sk_hide_composer_upgrade_button');
98
+
99
  $current_user = wp_get_current_user();
100
  $status = 'Free';
101
  $error = null;
106
  $status = 'Checking...';
107
  }
108
 
109
+ $this->track(array('what' => 'Settings Page', 'where' => 'plugin'));
110
+
111
  global $wp_version;
112
  if (version_compare($wp_version, '3.9', '<=')) {
113
  $error = "Sorry, Sidekick requires WordPress 3.9 or higher to function.";
141
  var last_site_key = null;
142
  var sk_ms_admin = false;
143
 
 
 
 
 
144
  </script>
145
 
146
  <div class="page-header"><h2><a id="pluginlogo_32" class="header-icon32" href="http://www.sidekick.pro/modules/wordpress-core-module-premium/?utm_source=plugin&utm_medium=settings&utm_campaign=header" target="_blank"></a>Sidekick Dashboard</h2></div>
211
  Enable Composer Mode
212
  </th>
213
  <td>
214
+ <button type='button' class='open_composer'>Open Composer</button>
215
  </td>
216
  </tr>
217
  </tbody>
377
  <li><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://sidekick.pro" data-text="I use @sidekickhelps for the fastest and easiest way to learn WordPress." data-via="sidekickhelps" data-size="large">Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></li>
378
  <li>Like SIDEKICK? Please leave us a 5 star rating on <a href='http://WordPress.org' target='_blank'>WordPress.org</a></li>
379
  <li><a href="http://www.sidekick.pro/plans/wordpress-basics/">Sign up for a full WordPress Basics package</a></li>
380
+ <li><a href="http://support.sidekick.pro/collection/50-quick-start-guides" target="_blank"><strong>Visit the SIDEKICK Quick Start guides</strong></a>.</li>
381
  </ul>
382
  </div>
383
  </div>
394
 
395
  function set_disabled_wts(){
396
 
 
397
  if (isset($_POST['sk_setting_disabled'])){
398
 
399
  if (!check_admin_referer('update_sk_settings')) {
474
  function footer(){
475
  global $current_user;
476
 
477
+ delete_option( 'sk_just_activated' );
478
+
479
 
480
 
481
  $sk_config_data = new sk_config_data;
482
+
483
+ $current_user = (get_option( 'sk_track_data' )) ? wp_get_current_user() : null;
484
+
485
+ $autostart_network_walkthrough_id = (get_site_option('sk_autostart_walkthrough_id') ? get_site_option('sk_autostart_walkthrough_id') : null );
 
 
 
 
486
  $autostart_walkthrough_id = (get_option('sk_autostart_walkthrough_id') ? get_option('sk_autostart_walkthrough_id') : $autostart_network_walkthrough_id );
 
487
  $theme = wp_get_theme();
488
+
 
 
 
 
489
  $installed_plugins = $sk_config_data->get_plugins();
 
 
 
 
 
 
 
 
 
 
 
490
  $file_editor_enabled = $sk_config_data->get_file_editor_enabled();
491
 
492
+ $sk_config = array(
493
+ "compatibilities" => array(
494
+ "comment_count" => $sk_config_data->get_comments(),
495
+ "domain" => str_replace("http://","",$_SERVER["SERVER_NAME"]),
496
+ "installed_plugins" => (isset($installed_plugins)) ? $installed_plugins : array(),
497
+ "installed_theme" => sanitize_title($theme->Name),
498
+ "is_multisite" => (is_multisite()) ? true : false,
499
+ "main_soft_version" => get_bloginfo("version"),
500
+ "number_of_themes" => $sk_config_data->get_themes(),
501
+ "page_for_posts" => intval(get_option('page_for_posts')),
502
+ "page_on_front" => intval(get_option('page_on_front')),
503
+ "plugin_count" => (isset($installed_plugins) && is_array($installed_plugins)) ? count($installed_plugins) : 0,
504
+ "role" => $sk_config_data->get_user_role(),
505
+ "show_on_front" => get_option('show_on_front'),
506
+ "theme_version" => $theme->Version
507
+ ),
508
+
509
+ // Platform
510
+ "baseClientUrl" => site_url(),
511
+ "base_url" => site_url(),
512
+
513
+ // User Settings
514
+ "activation_id" => (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : ''),
515
+ "custom_class" => (get_option( "sk_custom_class" ) ? get_option( "sk_custom_class" ) : ''),
516
+ "distributor_id" => (get_option( "sk_distributor_id" ) ? intval(get_option( "sk_distributor_id" )) : ''),
517
+ "user_email" => ($current_user) ? $current_user->user_email : '',
518
+ "autostart_walkthrough_id" => ($autostart_walkthrough_id) ? $autostart_walkthrough_id : '',
519
+ "disable_wts" => (!is_network_admin()) ? $sk_config_data->get_disabled_wts() : array(), // Copying these to compatibilities, have to update this over time
520
+ "disable_network_wts" => $sk_config_data->get_disabled_network_wts(), // Copying these to compatibilities, have to update this over time
521
+
522
+ // Toggles
523
+ "hide_taskbar_composer_button" => (get_option( 'sk_hide_composer_taskbar_button' ) ? true : false), // hide composer button on the taskbar
524
+ "hide_taskbar_config_button" => (get_option( 'sk_hide_config_taskbar_button' ) ? true : false), // hide settings button on taskbar
525
+ "show_login" => (get_option( 'sk_just_activated' )) ? true : false, // open drawer automatically, same as just_activated
526
+
527
+ // WordPress
528
+ "embedded" => false,
529
+ "embedPartner" => SK_EMBEDDED_PARTNER, // for tracking purposes if sidekick has been embeded in another WordPress plugin or theme
530
+ "plugin_version" => '2.5.2', // WordPress plugin version
531
+ "site_url" => $sk_config_data->get_domain(),
532
+ "domain" => str_replace("http://","",$_SERVER["SERVER_NAME"]),
533
+ "plugin_url" => admin_url("admin.php?page=sidekick"),
534
+
535
+ );
536
+
537
+ if ($file_editor_enabled) { //
538
+ $sk_config["compatibilities"]["file_editor_enabled"] = $file_editor_enabled;
539
+ }
540
 
541
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_post_types());
542
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_taxonomies());
543
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_user_data());
544
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_post_statuses());
545
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_post_types_and_statuses());
546
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_framework());
547
 
548
+ $sk_config = apply_filters('sk_config',$sk_config);
 
549
 
550
  ?>
551
 
552
+ <!-- Old IE Not Supported -->
553
+ <?php if (!preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])): ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
554
 
555
+ <script type="text/preloaded" data-provider="sidekick">
556
+ <?php echo json_encode($sk_config) ?>
557
  </script>
558
+
559
  <?php endif ?>
560
 
561
  <?php
571
 
572
  switch ($data['type']) {
573
  case 'activate':
574
+ $mp->track("Activate - Plugin", array("domain" => $domain));
575
  break;
576
 
577
  case 'deactivate':
578
+ $mp->track("Deactivate - Plugin", array("domain" => $domain));
579
  break;
580
 
581
  default:
597
  'cookies' => array()
598
  )
599
  );
600
+ mlog('$response',$response);
601
  }
602
 
603
  function activate($return = false){
623
  function check_ver(){
624
 
625
  if (isset($_GET['sk_ver_check'])){
626
+ $data = json_encode('2.5.2');
627
 
628
  if(array_key_exists('callback', $_GET)){
629
 
648
 
649
  function admin_notice() {
650
  global $current_user ;
 
651
  if ( ! get_user_meta($current_user->ID, 'sk_ignore_notice') ) {
652
  printf ('<div class="updated"><p>Need help with WordPress? Click HELP ME in the bottom left corner to get started! <a href="%1$s">Hide</a></p></div>','?sk_ignore_notice=1');
653
  }
664
 
665
  function delete_sk_get_comments(){
666
  mlog("delete_sk_get_comments");
667
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_comments');
668
  }
669
 
670
  function delete_sk_get_post_types(){
671
  mlog('delete sk_get_post_types');
672
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_post_types');
673
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_post_statuses');
674
  }
675
 
676
  function delete_sk_get_user_data(){
677
  mlog('delete sk_get_user_data');
678
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_user_data');
679
  }
680
 
681
  function delete_sk_get_plugins(){
682
  mlog('delete sk_get_plugins');
683
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_plugins');
684
  }
685
 
686
  }
702
  if (!(isset($_GET['tab']) && $_GET['tab'] == 'plugin-information')) {
703
  add_action('admin_footer', array($sidekick,'footer'));
704
  add_action('customize_controls_print_footer_scripts', array($sidekick,'footer'));
 
705
  add_action('admin_enqueue_scripts', array($sidekick,'enqueue_required'));
 
706
  add_action('customize_controls_enqueue_scripts', array($sidekick,'enqueue_required'),1000);
707
  }
708
+
709
+ // Reset Transient Cache
 
 
710
 
711
  add_action('wp_update_comment_count',array($sidekick,'delete_sk_get_comments'));
712
 
1196
  $sk_hide_composer_upgrade_button = get_option('sk_hide_composer_upgrade_button');
1197
  $is_ms_admin = true;
1198
 
1199
+ $this->track(array('what' => 'Network Settings Page', 'where' => 'plugin'));
1200
+
1201
  ?>
1202
  ?> <!-- ms_admin_page.php -->
1203
 
1208
  var last_site_key = null;
1209
  var sk_ms_admin = true;
1210
 
 
 
 
 
 
 
1211
  </script>
1212
 
1213
  <div class="page-header"><h2><a id="pluginlogo_32" class="header-icon32" href="http://www.sidekick.pro" target="_blank"></a>Sidekick Licensing</h2></div>
1532
  function get_post_types(){
1533
  global $wpdb;
1534
 
1535
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types' ) ) ) {
1536
 
1537
  $query = "SELECT post_type, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type";
1538
  $counts = $wpdb->get_results($query);
1539
+ $result = array();
1540
 
1541
  foreach ($counts as $key => $type) {
1542
  $type->post_type = str_replace('-', '_', $type->post_type);
1543
+ $result["post_type_{$type->post_type}"] = intval($type->count);
1544
  }
1545
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types', $result, $this->cache_time );
1546
  }
1547
 
1548
  return $result;
1562
  }
1563
 
1564
  function get_themes(){
1565
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_themes' ) ) ) {
1566
  $result = wp_get_themes( array( 'allowed' => true ) );
1567
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_themes', $result, $this->cache_time );
1568
  }
1569
 
1570
  return count($result);
1574
  global $wpdb;
1575
 
1576
  // Can't find a good method to clear cache for newly registered post types that fires once
1577
+ // if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types_and_statuses' ) ) ) {
1578
  $query = "SELECT post_type, post_status, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type, post_status";
1579
  $counts = $wpdb->get_results($query);
1580
+ $result = array();
1581
 
1582
  foreach ($counts as $key => $type) {
1583
  $type->post_type = str_replace('-', '_', $type->post_type);
1584
  $type->post_status = str_replace('-', '_', $type->post_status);
1585
 
1586
+ $result["post_type_{$type->post_type}_{$type->post_status}"] = intval($type->count);
1587
  }
1588
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types_and_statuses', $result, $this->cache_time );
1589
  // }
1590
 
1591
  return $result;
1594
  function get_taxonomies(){
1595
  global $wpdb;
1596
 
1597
+ // if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_taxonomies' ) ) ) {
1598
  $query = "SELECT count(distinct term_taxonomy_id) as count, taxonomy from {$wpdb->prefix}term_taxonomy group by taxonomy";
1599
  $counts = $wpdb->get_results($query);
 
1600
 
1601
  foreach ($counts as $key => $taxonomy) {
1602
  $taxonomy->taxonomy = str_replace('-', '_', $taxonomy->taxonomy);
1603
+ $result["taxonomy_{$taxonomy->taxonomy}"] = intval($taxonomy->count);
1604
  }
1605
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_taxonomies', $result, $this->cache_time );
1606
  // }
1607
 
1608
  return $result;
1611
  function get_comments(){
1612
  global $wpdb;
1613
 
1614
+ if ( false === ( $counts = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_comments' ) ) ) {
1615
  $query = "SELECT count(distinct comment_ID) as count from {$wpdb->prefix}comments";
1616
  $counts = $wpdb->get_var($query);
1617
  if (!$counts) $counts = 0;
1618
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_comments', $counts, $this->cache_time );
 
1619
  }
1620
 
1621
+ return intval($counts);
1622
  }
1623
 
1624
  function get_post_statuses(){
1625
  global $wpdb;
1626
 
1627
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_post_statuses' ) ) ) {
1628
  $query = "SELECT post_status, count(ID) as count from {$wpdb->prefix}posts group by post_status";
1629
  $counts = $wpdb->get_results($query);
1630
+ $result = array();
1631
 
1632
  foreach ($counts as $key => $type) {
1633
  $type->post_status = str_replace('-', '_', $type->post_status);
1634
+ $result["post_status_{$type->post_status}"] = intval($type->count);
1635
  }
1636
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_post_statuses', $result, $this->cache_time );
1637
  }
1638
 
1639
  return $result;
1642
  function get_user_data(){
1643
  global $current_user;
1644
 
1645
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_user_data' ) ) ) {
1646
  $data = get_userdata($current_user->ID);
1647
+ $result = array("user_id" => $current_user->ID);
1648
 
1649
  foreach ($data->allcaps as $cap => $val) {
1650
  $cap = sanitize_title($cap);
1651
  $cap = str_replace('-', '_', $cap);
1652
  if (!$val) $val = 0;
1653
+ $result["cap_{$cap}"] = $val;
1654
  }
1655
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_user_data', $result, $this->cache_time );
1656
  }
1657
 
1658
  return $result;
1663
 
1664
  $frameworks = array('genesis');
1665
 
1666
+ $result = array("theme_framework" => false);
1667
 
1668
  foreach ($frameworks as $framework) {
1669
  switch ($framework) {
1670
  case 'genesis':
1671
  if (function_exists( 'genesis' ) ) {
1672
  if (defined('PARENT_THEME_VERSION')) {
1673
+ $result["theme_framework"] = array(
1674
+ "name" => $framework,
1675
+ "version" => PARENT_THEME_VERSION
1676
+ );
1677
  }
1678
  }
1679
  break;
1680
  }
1681
  }
1682
+ return $result;
1683
  }
1684
 
1685
  function get_current_url() {
1699
 
1700
  function get_disabled_wts(){
1701
  $wts = str_replace('"', '', get_option('sk_disabled_wts'));
1702
+ $wts = json_decode($wts);
1703
  if ($wts) {
1704
  return $wts;
1705
  }
1709
  function get_disabled_network_wts(){
1710
  if (is_multisite()) {
1711
  $wts = str_replace('"', '', get_site_option('sk_disabled_wts'));
1712
+ $wts = json_decode($wts);
1713
  if ($wts) {
1714
  return $wts;
1715
  }
1719
 
1720
  function get_plugins(){
1721
 
1722
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_plugins' ) ) ) {
1723
  $active_plugins = wp_get_active_and_valid_plugins();
1724
  $mu_plugins = get_mu_plugins();
1725
  $result = array();
1739
  $result[$slug] = '1.0.0';
1740
  }
1741
  }
1742
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_plugins', $result, $this->cache_time );
1743
  }
1744
 
1745
  return $result;