Sidekick - Version 2.5.1

Version Description

Download this release

Release Info

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

Code changes from version 2.4.0 to 2.5.1

js/sidekick_admin.js CHANGED
@@ -214,6 +214,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;
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
+ if (typeof sk_config.disable_wts === "string" && sk_config.disable_wts.indexOf(']') > -1) {
218
+ sk_config.disable_wts = JSON.parse(sk_config.disable_wts);
219
+ };
220
+
221
+ if (typeof sk_config.disable_network_wts === "string" && sk_config.disable_network_wts.indexOf(']') > -1) {
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;
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() {
@@ -206,7 +207,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 +227,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() {
207
 
208
  function get_plugins(){
209
 
210
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_plugins' ) ) ) {
211
  $active_plugins = wp_get_active_and_valid_plugins();
212
  $mu_plugins = get_mu_plugins();
213
  $result = array();
227
  $result[$slug] = '1.0.0';
228
  }
229
  }
230
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_plugins', $result, $this->cache_time );
231
  }
232
 
233
  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,14 @@ 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.1
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.0 =
149
+ * Sidekick platform major refactoring
150
+ * Fixes issues with toggles for taskbar buttons not working
151
+
152
+ = 2.4.1 =
153
+ * Added new compatibility checking for front page static vs blog listing
154
+ * Readines for Sidekick intro walkthrough
155
+
156
  = 2.4.0 =
157
  * WordPress Customizer support
158
  * 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,24 @@ 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 +83,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 +98,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 +132,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 +212,87 @@ 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 +308,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 +334,7 @@ if (!class_exists('Sidekick')){
410
  'cookies' => array()
411
  )
412
  );
 
413
  }
414
 
415
  function activate($return = false){
@@ -435,7 +360,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 +385,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 +401,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 +439,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.1
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.1'));
 
 
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
 
46
  function setup_menu(){
83
 
84
  $activation_id = (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : '');
85
  $sk_track_data = get_option( 'sk_track_data' );
86
+
87
  $sk_hide_composer_taskbar_button = get_option('sk_hide_composer_taskbar_button');
88
  $sk_hide_config_taskbar_button = get_option('sk_hide_config_taskbar_button');
89
  $sk_hide_composer_upgrade_button = get_option('sk_hide_composer_upgrade_button');
90
+
91
  $current_user = wp_get_current_user();
92
  $status = 'Free';
93
  $error = null;
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', '<=')) {
105
  $error = "Sorry, Sidekick requires WordPress 3.9 or higher to function.";
132
 
133
  function set_disabled_wts(){
134
 
 
135
  if (isset($_POST['sk_setting_disabled'])){
136
 
137
  if (!check_admin_referer('update_sk_settings')) {
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
247
+ "baseClientUrl" => site_url(),
248
+ "base_url" => site_url(),
249
+
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
257
+ "disable_network_wts" => $sk_config_data->get_disabled_network_wts(), // Copying these to compatibilities, have to update this over time
258
+
259
+ // Toggles
260
+ "hide_taskbar_composer_button" => (get_option( 'sk_hide_composer_taskbar_button' ) ? true : false), // hide composer button on the taskbar
261
+ "hide_taskbar_config_button" => (get_option( 'sk_hide_config_taskbar_button' ) ? true : false), // hide settings button on taskbar
262
+ "show_login" => (get_option( 'sk_just_activated' )) ? true : false, // open drawer automatically, same as just_activated
263
+
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.1', // 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"),
271
+
272
+ );
273
+
274
+ if ($file_editor_enabled) { //
275
+ $sk_config["compatibilities"]["file_editor_enabled"] = $file_editor_enabled;
276
+ }
277
 
278
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_post_types());
279
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_taxonomies());
280
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_user_data());
281
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_post_statuses());
282
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_post_types_and_statuses());
283
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_framework());
284
 
285
+ $sk_config = apply_filters('sk_config',$sk_config);
 
286
 
287
  ?>
288
 
289
+ <!-- Old IE Not Supported -->
290
+ <?php if (!preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])): ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
 
292
+ <script type="text/preloaded" data-provider="sidekick">
293
+ <?php echo json_encode($sk_config) ?>
294
  </script>
295
+
296
  <?php endif ?>
297
 
298
  <?php
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:
334
  'cookies' => array()
335
  )
336
  );
337
+ mlog('$response',$response);
338
  }
339
 
340
  function activate($return = false){
360
  function check_ver(){
361
 
362
  if (isset($_GET['sk_ver_check'])){
363
+ $data = json_encode('2.5.1');
364
 
365
  if(array_key_exists('callback', $_GET)){
366
 
385
 
386
  function admin_notice() {
387
  global $current_user ;
 
388
  if ( ! get_user_meta($current_user->ID, 'sk_ignore_notice') ) {
389
  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');
390
  }
401
 
402
  function delete_sk_get_comments(){
403
  mlog("delete_sk_get_comments");
404
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_comments');
405
  }
406
 
407
  function delete_sk_get_post_types(){
408
  mlog('delete sk_get_post_types');
409
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_post_types');
410
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_post_statuses');
411
  }
412
 
413
  function delete_sk_get_user_data(){
414
  mlog('delete sk_get_user_data');
415
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_user_data');
416
  }
417
 
418
  function delete_sk_get_plugins(){
419
  mlog('delete sk_get_plugins');
420
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_plugins');
421
  }
422
 
423
  }
439
  if (!(isset($_GET['tab']) && $_GET['tab'] == 'plugin-information')) {
440
  add_action('admin_footer', array($sidekick,'footer'));
441
  add_action('customize_controls_print_footer_scripts', array($sidekick,'footer'));
 
442
  add_action('admin_enqueue_scripts', array($sidekick,'enqueue_required'));
 
443
  add_action('customize_controls_enqueue_scripts', array($sidekick,'enqueue_required'),1000);
444
  }
445
+
446
+ // Reset Transient Cache
 
 
447
 
448
  add_action('wp_update_comment_count',array($sidekick,'delete_sk_get_comments'));
449
 
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,24 @@ 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 +88,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 +103,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 +138,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 +208,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 +374,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 +391,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 +471,87 @@ 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 +567,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 +593,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
673
  'cookies' => array()
674
  )
675
  );
 
676
  }
677
 
678
  function activate($return = false){
@@ -698,7 +619,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 +644,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 +660,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 +698,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 +1192,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 +1204,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 +1528,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 +1558,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 +1570,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 +1590,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 +1607,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 +1638,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 +1659,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() {
@@ -1800,7 +1713,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 +1733,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.1
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.1'));
 
 
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
 
51
  function setup_menu(){
88
 
89
  $activation_id = (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : '');
90
  $sk_track_data = get_option( 'sk_track_data' );
91
+
92
  $sk_hide_composer_taskbar_button = get_option('sk_hide_composer_taskbar_button');
93
  $sk_hide_config_taskbar_button = get_option('sk_hide_config_taskbar_button');
94
  $sk_hide_composer_upgrade_button = get_option('sk_hide_composer_upgrade_button');
95
+
96
  $current_user = wp_get_current_user();
97
  $status = 'Free';
98
  $error = null;
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', '<=')) {
110
  $error = "Sorry, Sidekick requires WordPress 3.9 or higher to function.";
138
  var last_site_key = null;
139
  var sk_ms_admin = false;
140
 
 
 
 
 
141
  </script>
142
 
143
  <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>
208
  Enable Composer Mode
209
  </th>
210
  <td>
211
+ <button type='button' class='open_composer'>Open Composer</button>
212
  </td>
213
  </tr>
214
  </tbody>
374
  <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>
375
  <li>Like SIDEKICK? Please leave us a 5 star rating on <a href='http://WordPress.org' target='_blank'>WordPress.org</a></li>
376
  <li><a href="http://www.sidekick.pro/plans/wordpress-basics/">Sign up for a full WordPress Basics package</a></li>
377
+ <li><a href="http://support.sidekick.pro/collection/50-quick-start-guides" target="_blank"><strong>Visit the SIDEKICK Quick Start guides</strong></a>.</li>
378
  </ul>
379
  </div>
380
  </div>
391
 
392
  function set_disabled_wts(){
393
 
 
394
  if (isset($_POST['sk_setting_disabled'])){
395
 
396
  if (!check_admin_referer('update_sk_settings')) {
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
506
+ "baseClientUrl" => site_url(),
507
+ "base_url" => site_url(),
508
+
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
516
+ "disable_network_wts" => $sk_config_data->get_disabled_network_wts(), // Copying these to compatibilities, have to update this over time
517
+
518
+ // Toggles
519
+ "hide_taskbar_composer_button" => (get_option( 'sk_hide_composer_taskbar_button' ) ? true : false), // hide composer button on the taskbar
520
+ "hide_taskbar_config_button" => (get_option( 'sk_hide_config_taskbar_button' ) ? true : false), // hide settings button on taskbar
521
+ "show_login" => (get_option( 'sk_just_activated' )) ? true : false, // open drawer automatically, same as just_activated
522
+
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.1', // 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"),
530
+
531
+ );
532
+
533
+ if ($file_editor_enabled) { //
534
+ $sk_config["compatibilities"]["file_editor_enabled"] = $file_editor_enabled;
535
+ }
536
 
537
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_post_types());
538
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_taxonomies());
539
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_user_data());
540
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_post_statuses());
541
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_post_types_and_statuses());
542
+ $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'],$sk_config_data->get_framework());
543
 
544
+ $sk_config = apply_filters('sk_config',$sk_config);
 
545
 
546
  ?>
547
 
548
+ <!-- Old IE Not Supported -->
549
+ <?php if (!preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])): ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
550
 
551
+ <script type="text/preloaded" data-provider="sidekick">
552
+ <?php echo json_encode($sk_config) ?>
553
  </script>
554
+
555
  <?php endif ?>
556
 
557
  <?php
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:
593
  'cookies' => array()
594
  )
595
  );
596
+ mlog('$response',$response);
597
  }
598
 
599
  function activate($return = false){
619
  function check_ver(){
620
 
621
  if (isset($_GET['sk_ver_check'])){
622
+ $data = json_encode('2.5.1');
623
 
624
  if(array_key_exists('callback', $_GET)){
625
 
644
 
645
  function admin_notice() {
646
  global $current_user ;
 
647
  if ( ! get_user_meta($current_user->ID, 'sk_ignore_notice') ) {
648
  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');
649
  }
660
 
661
  function delete_sk_get_comments(){
662
  mlog("delete_sk_get_comments");
663
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_comments');
664
  }
665
 
666
  function delete_sk_get_post_types(){
667
  mlog('delete sk_get_post_types');
668
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_post_types');
669
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_post_statuses');
670
  }
671
 
672
  function delete_sk_get_user_data(){
673
  mlog('delete sk_get_user_data');
674
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_user_data');
675
  }
676
 
677
  function delete_sk_get_plugins(){
678
  mlog('delete sk_get_plugins');
679
+ delete_transient('sk_' . SK_CACHE_PREFIX . '_get_plugins');
680
  }
681
 
682
  }
698
  if (!(isset($_GET['tab']) && $_GET['tab'] == 'plugin-information')) {
699
  add_action('admin_footer', array($sidekick,'footer'));
700
  add_action('customize_controls_print_footer_scripts', array($sidekick,'footer'));
 
701
  add_action('admin_enqueue_scripts', array($sidekick,'enqueue_required'));
 
702
  add_action('customize_controls_enqueue_scripts', array($sidekick,'enqueue_required'),1000);
703
  }
704
+
705
+ // Reset Transient Cache
 
 
706
 
707
  add_action('wp_update_comment_count',array($sidekick,'delete_sk_get_comments'));
708
 
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
+
1197
  ?>
1198
  ?> <!-- ms_admin_page.php -->
1199
 
1204
  var last_site_key = null;
1205
  var sk_ms_admin = true;
1206
 
 
 
 
 
 
 
1207
  </script>
1208
 
1209
  <div class="page-header"><h2><a id="pluginlogo_32" class="header-icon32" href="http://www.sidekick.pro" target="_blank"></a>Sidekick Licensing</h2></div>
1528
  function get_post_types(){
1529
  global $wpdb;
1530
 
1531
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types' ) ) ) {
1532
 
1533
  $query = "SELECT post_type, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type";
1534
  $counts = $wpdb->get_results($query);
1535
+ $result = array();
1536
 
1537
  foreach ($counts as $key => $type) {
1538
  $type->post_type = str_replace('-', '_', $type->post_type);
1539
+ $result["post_type_{$type->post_type}"] = intval($type->count);
1540
  }
1541
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_post_types', $result, $this->cache_time );
1542
  }
1543
 
1544
  return $result;
1558
  }
1559
 
1560
  function get_themes(){
1561
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_themes' ) ) ) {
1562
  $result = wp_get_themes( array( 'allowed' => true ) );
1563
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_themes', $result, $this->cache_time );
1564
  }
1565
 
1566
  return count($result);
1570
  global $wpdb;
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;
1590
  function get_taxonomies(){
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;
1607
  function get_comments(){
1608
  global $wpdb;
1609
 
1610
+ if ( false === ( $counts = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_comments' ) ) ) {
1611
  $query = "SELECT count(distinct comment_ID) as count from {$wpdb->prefix}comments";
1612
  $counts = $wpdb->get_var($query);
1613
  if (!$counts) $counts = 0;
1614
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_comments', $counts, $this->cache_time );
 
1615
  }
1616
 
1617
+ return intval($counts);
1618
  }
1619
 
1620
  function get_post_statuses(){
1621
  global $wpdb;
1622
 
1623
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_post_statuses' ) ) ) {
1624
  $query = "SELECT post_status, count(ID) as count from {$wpdb->prefix}posts group by post_status";
1625
  $counts = $wpdb->get_results($query);
1626
+ $result = array();
1627
 
1628
  foreach ($counts as $key => $type) {
1629
  $type->post_status = str_replace('-', '_', $type->post_status);
1630
+ $result["post_status_{$type->post_status}"] = intval($type->count);
1631
  }
1632
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_post_statuses', $result, $this->cache_time );
1633
  }
1634
 
1635
  return $result;
1638
  function get_user_data(){
1639
  global $current_user;
1640
 
1641
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_user_data' ) ) ) {
1642
  $data = get_userdata($current_user->ID);
1643
+ $result = array("user_id" => $current_user->ID);
1644
 
1645
  foreach ($data->allcaps as $cap => $val) {
1646
  $cap = sanitize_title($cap);
1647
  $cap = str_replace('-', '_', $cap);
1648
  if (!$val) $val = 0;
1649
+ $result["cap_{$cap}"] = $val;
1650
  }
1651
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_user_data', $result, $this->cache_time );
1652
  }
1653
 
1654
  return $result;
1659
 
1660
  $frameworks = array('genesis');
1661
 
1662
+ $result = array("theme_framework" => false);
1663
 
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;
1676
  }
1677
  }
1678
+ return $result;
1679
  }
1680
 
1681
  function get_current_url() {
1713
 
1714
  function get_plugins(){
1715
 
1716
+ if ( false === ( $result = get_transient( 'sk_' . SK_CACHE_PREFIX . '_get_plugins' ) ) ) {
1717
  $active_plugins = wp_get_active_and_valid_plugins();
1718
  $mu_plugins = get_mu_plugins();
1719
  $result = array();
1733
  $result[$slug] = '1.0.0';
1734
  }
1735
  }
1736
+ set_transient( 'sk_' . SK_CACHE_PREFIX . '_get_plugins', $result, $this->cache_time );
1737
  }
1738
 
1739
  return $result;