Sidekick - Version 1.3.3

Version Description

  • Fixed an issue with custom prefixed databases
Download this release

Release Info

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

Code changes from version 1.3.2 to 1.3.3

Files changed (3) hide show
  1. js/sk.source.js +94 -28
  2. readme.txt +4 -1
  3. sidekick.php +29 -6
js/sk.source.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! sidekick - v1.3.2 - 2014-05-02 */(function(jQuery, window){
2
 
3
  jQuery.fn.center = function () {
4
  this.css("position","absolute");
@@ -2029,7 +2029,8 @@ jQuery.extend( jQuery.easing,
2029
  },
2030
 
2031
  filter_walkthroughs: function(){
2032
- console.groupCollapsed('%cFilter Walkthroughs','color: orange');
 
2033
  var library = this.get('full_library');
2034
  _.each(library.buckets,function(item,key){
2035
  this.filter_sub_bucket_recursive(item);
@@ -2071,40 +2072,38 @@ jQuery.extend( jQuery.easing,
2071
  console.group('%cfilter_sub_bucket_recursive - %c %s (%o)', 'color: #ff6f29','color: white;background-color: black',sub_bucket.post_title, sub_bucket);
2072
 
2073
  if (_.size(sub_bucket.sub_buckets) > 0) {
2074
- console.log('AAA sub_bucket.sub_buckets %o', sub_bucket.sub_buckets);
2075
  _.each(sub_bucket.sub_buckets,function(item,key){
2076
  return this.filter_sub_bucket_recursive(item);
2077
  },this);
2078
  } else if (_.size(sub_bucket.walkthroughs)) {
2079
- console.log('BBB Filter walkthrough %o', sub_bucket.walkthroughs);
2080
  // Filter walkthrough
2081
  sub_bucket.walkthroughs.reverse();
2082
  var key = sub_bucket.walkthroughs.length;
2083
  while (key--) {
2084
  var walkthrough = sub_bucket.walkthroughs[key];
2085
  if (!this.check_walkthrough_compatibility(walkthrough)) {
2086
- console.log('%cDELETE sub_bucket.walkthroughs[key] %o','color: red', sub_bucket.walkthroughs[key]);
2087
  sub_bucket.walkthroughs.splice(key, 1);
2088
  continue;
2089
  }
2090
 
2091
- // Check if Hotspot, if so move out
2092
- if (walkthrough.type == 'hotspot') {
2093
- _.each(walkthrough.hotspots,function(item){
2094
- console.info(' HOTSPOT %o', item);
2095
- var library_filtered_hotspots = this.get('library_filtered_hotspots');
2096
- library_filtered_hotspots.push({
2097
- url:item.url,selector:
2098
- item.selector,id:walkthrough.id
2099
- });
2100
- this.set('library_filtered_hotspots',library_filtered_hotspots);
2101
- },this);
2102
- console.log(' %cDELETE2 sub_bucket.walkthroughs[key] %o %o','color: red', key,sub_bucket.walkthroughs[key]);
2103
- sub_bucket.walkthroughs.splice(key, 1);
2104
- continue;
 
2105
  }
2106
- }
2107
- } else {
2108
  // Sub_bucket has no walkthroughs
2109
  console.log('CCC Sub_bucket has no walkthroughs');
2110
  }
@@ -2131,7 +2130,7 @@ jQuery.extend( jQuery.easing,
2131
 
2132
 
2133
  if (!pass_main_soft_version){
2134
- console.log('%cFAILED %o - SOFT_VER %o != %O','color: red',walkthrough.title, main_soft_version,walkthrough.main_soft_version);
2135
  return false;
2136
  }
2137
 
@@ -2150,7 +2149,7 @@ jQuery.extend( jQuery.easing,
2150
  }
2151
  }
2152
  if (!pass_theme || !pass_theme_version){
2153
- console.log('%cFAILED %o - THEME %s (%o) != %s (%o)','color: red',walkthrough.title,walkthrough.theme_version, walkthrough.theme, pass_theme, sk_config.theme_version);
2154
  return false;
2155
  }
2156
  }
@@ -2178,11 +2177,11 @@ jQuery.extend( jQuery.easing,
2178
  });
2179
 
2180
  if (!pass_plugin) {
2181
- console.log('%cFAILED %o (%o) - PLUGIN %s (%o)','color: red',walkthrough.title, walkthrough, walkthrough.plugin, sk_config.installed_plugins);
2182
  return false;
2183
  }
2184
  if (!pass_plugin_version){
2185
- console.log('%cFAILED %o (%o) - PLUGIN %s VER %s (%o)','color: red',walkthrough.title, walkthrough, walkthrough.plugin, walkthrough.plugin_version, sk_config.installed_plugins);
2186
  return false;
2187
  }
2188
  }
@@ -2200,18 +2199,85 @@ jQuery.extend( jQuery.easing,
2200
  }
2201
 
2202
  if (!pass_user_level){
2203
- console.log('%cFAILED %o - User Level %s != %s','color: red',walkthrough.title, sk_config.user_level, walkthrough.role);
2204
  return false;
2205
  }
2206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2207
  var passed_walkthroughs = this.get('passed_walkthroughs');
2208
  passed_walkthroughs.push(walkthrough.id);
2209
  this.set('passed_walkthroughs',passed_walkthroughs);
2210
 
2211
  if (walkthrough.plugin) {
2212
- console.log('%cPASSED! %o', 'color: #3ab00b',walkthrough.plugin + ': ' + walkthrough.title + '(' + walkthrough.id + ')');
2213
  } else {
2214
- console.log('%cPASSED! %o', 'color: #3ab00b',walkthrough.title + '(' + walkthrough.id + ')');
2215
  }
2216
 
2217
  return true;
1
+ /*! sidekick - v1.3.3 - 2014-05-08 */(function(jQuery, window){
2
 
3
  jQuery.fn.center = function () {
4
  this.css("position","absolute");
2029
  },
2030
 
2031
  filter_walkthroughs: function(){
2032
+ // console.group('%cFilter Walkthroughs','color: #8526ff');
2033
+ console.groupCollapsed('%cFilter Walkthroughs','color: #8526ff');
2034
  var library = this.get('full_library');
2035
  _.each(library.buckets,function(item,key){
2036
  this.filter_sub_bucket_recursive(item);
2072
  console.group('%cfilter_sub_bucket_recursive - %c %s (%o)', 'color: #ff6f29','color: white;background-color: black',sub_bucket.post_title, sub_bucket);
2073
 
2074
  if (_.size(sub_bucket.sub_buckets) > 0) {
 
2075
  _.each(sub_bucket.sub_buckets,function(item,key){
2076
  return this.filter_sub_bucket_recursive(item);
2077
  },this);
2078
  } else if (_.size(sub_bucket.walkthroughs)) {
 
2079
  // Filter walkthrough
2080
  sub_bucket.walkthroughs.reverse();
2081
  var key = sub_bucket.walkthroughs.length;
2082
  while (key--) {
2083
  var walkthrough = sub_bucket.walkthroughs[key];
2084
  if (!this.check_walkthrough_compatibility(walkthrough)) {
2085
+ // console.log(' %cDELETE %s %o','color: red', sub_bucket.walkthroughs[key].title, sub_bucket.walkthroughs[key]);
2086
  sub_bucket.walkthroughs.splice(key, 1);
2087
  continue;
2088
  }
2089
 
2090
+ // Check if Hotspot, if so move out
2091
+ if (walkthrough.type == 'hotspot') {
2092
+ _.each(walkthrough.hotspots,function(item){
2093
+ // console.info('HOTSPOT %o', walkthrough.title);
2094
+ var library_filtered_hotspots = this.get('library_filtered_hotspots');
2095
+ library_filtered_hotspots.push({
2096
+ url:item.url,selector:
2097
+ item.selector,id:walkthrough.id
2098
+ });
2099
+ this.set('library_filtered_hotspots',library_filtered_hotspots);
2100
+ },this);
2101
+ // console.log('%cDELETE2 sub_bucket.walkthroughs[key] %o %o','color: red', key,sub_bucket.walkthroughs[key]);
2102
+ sub_bucket.walkthroughs.splice(key, 1);
2103
+ continue;
2104
+ }
2105
  }
2106
+ } else {
 
2107
  // Sub_bucket has no walkthroughs
2108
  console.log('CCC Sub_bucket has no walkthroughs');
2109
  }
2130
 
2131
 
2132
  if (!pass_main_soft_version){
2133
+ console.log('%cFAILED %s - SOFT_VER %o != %O','color: red',walkthrough.title, main_soft_version,walkthrough.main_soft_version);
2134
  return false;
2135
  }
2136
 
2149
  }
2150
  }
2151
  if (!pass_theme || !pass_theme_version){
2152
+ console.log('%cFAILED %s - THEME %s (%o) != %s (%o)','color: red',walkthrough.title,walkthrough.theme_version, walkthrough.theme, pass_theme, sk_config.theme_version);
2153
  return false;
2154
  }
2155
  }
2177
  });
2178
 
2179
  if (!pass_plugin) {
2180
+ console.log('%cFAILED %s (%o) - PLUGIN %s (%o)','color: red',walkthrough.title, walkthrough, walkthrough.plugin, sk_config.installed_plugins);
2181
  return false;
2182
  }
2183
  if (!pass_plugin_version){
2184
+ console.log('%cFAILED %s (%o) - PLUGIN %s VER %s (%o)','color: red',walkthrough.title, walkthrough, walkthrough.plugin, walkthrough.plugin_version, sk_config.installed_plugins);
2185
  return false;
2186
  }
2187
  }
2199
  }
2200
 
2201
  if (!pass_user_level){
2202
+ console.log('%cFAILED %s - User Level %s != %s','color: red',walkthrough.title, sk_config.user_level, walkthrough.role);
2203
  return false;
2204
  }
2205
 
2206
+ // Check display rules
2207
+ if (walkthrough.display_rules) {
2208
+ console.log('walkthrough.display_rules %o', walkthrough.display_rules);
2209
+ for ( var rule in walkthrough.display_rules){
2210
+ var rule_data = walkthrough.display_rules[rule];
2211
+
2212
+ if (!isNaN(rule_data.value)) {
2213
+ rule_data.value = parseInt(rule_data.value,10);
2214
+ }
2215
+
2216
+ if (!isNaN(sk_config[rule_data.variable])) {
2217
+ sk_config[rule_data.variable] = parseInt(sk_config[rule_data.variable],10);
2218
+ }
2219
+
2220
+ if (rule_data.operator.toLowerCase() === 'equals') {
2221
+ if (!(sk_config[rule_data.variable] === rule_data.value)) {
2222
+ console.log('%cFAILED Custom Rule [%s] %s === %s','color: red',rule_data.operator.toLowerCase(),rule_data.variable, rule_data.value);
2223
+ console.log('sk_config[rule_data.variable] %o', sk_config[rule_data.variable]);
2224
+ console.log('rule_data.value %o', rule_data.value);
2225
+ console.log('sk_config[rule_data.variable] !== rule_data.value %o', sk_config[rule_data.variable] !== rule_data.value);
2226
+ console.groupEnd();
2227
+ return false;
2228
+ }
2229
+ } else if (rule_data.operator.toLowerCase() === 'not equal to') {
2230
+ if (!(sk_config[rule_data.variable] !== rule_data.value)) {
2231
+ console.log('%cFAILED Custom Rule [%s] %s !== %s','color: red',rule_data.operator.toLowerCase(),rule_data.variable, rule_data.value);
2232
+ console.log('sk_config[rule_data.variable] %o', sk_config[rule_data.variable]);
2233
+ console.log('rule_data.value %o', rule_data.value);
2234
+ console.log('sk_config[rule_data.variable] === rule_data.value %o', sk_config[rule_data.variable] === rule_data.value);
2235
+ console.groupEnd();
2236
+ return false;
2237
+ }
2238
+ } else if (rule_data.operator.toLowerCase() === 'greater then') {
2239
+ if (isNaN(sk_config[rule_data.variable]) || isNaN(rule_data.value)) {
2240
+ console.log('%cFAILED Custom Rule [%s] Can\'t compare non integers %s > %s','color: red',rule_data.operator.toLowerCase(),rule_data.variable, rule_data.value);
2241
+ return false;
2242
+ }
2243
+ if (!(sk_config[rule_data.variable] > rule_data.value)) {
2244
+ console.group('%cFAILED Custom Rule [%s] %s > %s','color: red',rule_data.operator.toLowerCase(),rule_data.variable, rule_data.value);
2245
+ console.log('sk_config[rule_data.variable] %o', sk_config[rule_data.variable]);
2246
+ console.log('rule_data.value %o', rule_data.value);
2247
+ console.log('sk_config[rule_data.variable] > rule_data.value %o', sk_config[rule_data.variable] > rule_data.value);
2248
+ console.groupEnd();
2249
+ return false;
2250
+ }
2251
+ } else if (rule_data.operator.toLowerCase() === 'less then') {
2252
+ if (isNaN(sk_config[rule_data.variable]) || isNaN(rule_data.value)) {
2253
+ console.log('%cFAILED Custom Rule [%s] Can\'t compare non integers %s > %s','color: red',rule_data.operator.toLowerCase(),rule_data.variable, rule_data.value);
2254
+ return false;
2255
+ }
2256
+ if (!(sk_config[rule_data.variable] < rule_data.value)) {
2257
+ console.log('%cFAILED Custom Rule [%s] %s < %s','color: red',rule_data.operator.toLowerCase(),rule_data.variable, rule_data.value);
2258
+ console.log('sk_config[rule_data.variable] %o', sk_config[rule_data.variable]);
2259
+ console.log('rule_data.value %o', rule_data.value);
2260
+ console.log('sk_config[rule_data.variable] < rule_data.value %o', sk_config[rule_data.variable] < rule_data.value);
2261
+ console.groupEnd();
2262
+ return false;
2263
+ }
2264
+ }
2265
+ console.group('%cPASSED Custom Rule %s %s %s','color: #3ab00b',rule_data.variable, sk_config[rule_data.variable], rule_data.operator.toLowerCase(), rule_data.value);
2266
+ console.log('sk_config[rule_data.variable] %o', sk_config[rule_data.variable]);
2267
+ console.log('rule_data.value %o', rule_data.value);
2268
+ console.log('sk_config[rule_data.variable] %s rule_data.value %o', rule_data.operator, sk_config[rule_data.variable] < rule_data.value);
2269
+ console.groupEnd();
2270
+ }
2271
+ }
2272
+
2273
  var passed_walkthroughs = this.get('passed_walkthroughs');
2274
  passed_walkthroughs.push(walkthrough.id);
2275
  this.set('passed_walkthroughs',passed_walkthroughs);
2276
 
2277
  if (walkthrough.plugin) {
2278
+ console.log('%cPASSED %s', 'color: #3ab00b',walkthrough.plugin + ': ' + walkthrough.title + '(' + walkthrough.id + ')');
2279
  } else {
2280
+ console.log('%cPASSED %s', 'color: #3ab00b',walkthrough.title + '(' + walkthrough.id + ')');
2281
  }
2282
 
2283
  return true;
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.5
6
  Tested up to: 3.9
7
- Stable tag: 1.3.2
8
  License: GNU Version 2 or Any Later Version
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -130,6 +130,9 @@ Absolutely. In fact, we rely on users like you to tell us about things that nee
130
 
131
  == Changelog ==
132
 
 
 
 
133
  = 1.3.2 =
134
  * HTTPs Protocol Adjustments
135
 
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.5
6
  Tested up to: 3.9
7
+ Stable tag: 1.3.3
8
  License: GNU Version 2 or Any Later Version
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
130
 
131
  == Changelog ==
132
 
133
+ = 1.3.3 =
134
+ * Fixed an issue with custom prefixed databases
135
+
136
  = 1.3.2 =
137
  * HTTPs Protocol Adjustments
138
 
sidekick.php CHANGED
@@ -6,12 +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: 3.7
8
  Tested up to: 3.9
9
- Version: 1.3.2
10
  Author: Sidekick.pro
11
  Author URI: http://www.sidekick.pro
12
  */
13
 
14
- define('SK_PLUGIN_VERSION','1.3.2');
15
  define('SK_LIBRARY_VERSION',5);
16
  define('SK_PLATFORM_VERSION',6);
17
 
@@ -138,7 +138,7 @@ class Sidekick{
138
  }
139
 
140
  if (!$activation_id) {
141
- $warn = "You're using the <b>Demo</b> version of Sidekick, to gain full access to the walkthrough library please fill out your name and email address below.";
142
  }
143
 
144
  if(preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])){
@@ -256,7 +256,7 @@ class Sidekick{
256
 
257
  function list_post_types(){
258
  global $wpdb;
259
- $query = "SELECT post_type, count(distinct ID) as count from wp_posts group by post_type";
260
  $counts = $wpdb->get_results($query);
261
  foreach ($counts as $key => $type) {
262
  $type->post_type = str_replace('-', '_', $type->post_type);
@@ -264,13 +264,33 @@ class Sidekick{
264
  }
265
  }
266
 
 
 
 
 
 
 
 
 
 
 
267
  function list_comments(){
268
  global $wpdb;
269
- $query = "SELECT count(distinct comment_ID) as count from wp_comments";
270
  $counts = $wpdb->get_var($query);
271
  echo "\n comment_count : $counts,";
272
  }
273
 
 
 
 
 
 
 
 
 
 
 
274
  function get_user_data(){
275
  global $current_user;
276
  $data = get_userdata($current_user->ID);
@@ -327,9 +347,12 @@ class Sidekick{
327
  user_level: '<?php echo $user_role ?>',
328
  user_email: '<?php echo $current_user->user_email ?>',
329
  <?php $this->list_post_types() ?>
 
330
  <?php $this->get_user_data() ?>
331
  <?php $this->list_comments() ?>
332
- use_native_controls: false,
 
 
333
  // open_bucket: 476
334
  }
335
  <?php if ($activation_id = get_option( "sk_activation_id" )){ ?>
6
  Description: Adds a real-time WordPress training walkthroughs right in your Dashboard
7
  Requires at least: 3.7
8
  Tested up to: 3.9
9
+ Version: 1.3.3
10
  Author: Sidekick.pro
11
  Author URI: http://www.sidekick.pro
12
  */
13
 
14
+ define('SK_PLUGIN_VERSION','1.3.3');
15
  define('SK_LIBRARY_VERSION',5);
16
  define('SK_PLATFORM_VERSION',6);
17
 
138
  }
139
 
140
  if (!$activation_id) {
141
+ $warn = "You're using the <b>free</b> version of Sidekick, to gain full access to the walkthrough library please <a target='_blank' href='http://www.sidekick.pro/wordpress/modules/'>upgrade</a> to the full module.";
142
  }
143
 
144
  if(preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])){
256
 
257
  function list_post_types(){
258
  global $wpdb;
259
+ $query = "SELECT post_type, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type";
260
  $counts = $wpdb->get_results($query);
261
  foreach ($counts as $key => $type) {
262
  $type->post_type = str_replace('-', '_', $type->post_type);
264
  }
265
  }
266
 
267
+ function list_taxonomies(){
268
+ global $wpdb;
269
+ $query = "SELECT count(distinct term_taxonomy_id) as count, taxonomy from {$wpdb->prefix}term_taxonomy group by taxonomy";
270
+ $counts = $wpdb->get_results($query);
271
+ foreach ($counts as $key => $taxonomy) {
272
+ $taxonomy->taxonomy = str_replace('-', '_', $taxonomy->taxonomy);
273
+ echo "\n taxonomy_{$taxonomy->taxonomy} : $taxonomy->count,";
274
+ }
275
+ }
276
+
277
  function list_comments(){
278
  global $wpdb;
279
+ $query = "SELECT count(distinct comment_ID) as count from {$wpdb->prefix}comments";
280
  $counts = $wpdb->get_var($query);
281
  echo "\n comment_count : $counts,";
282
  }
283
 
284
+ function list_post_statuses(){
285
+ global $wpdb;
286
+ $query = "SELECT post_status, count(ID) as count from {$wpdb->prefix}posts group by post_status";
287
+ $counts = $wpdb->get_results($query);
288
+ foreach ($counts as $key => $type) {
289
+ $type->post_status = str_replace('-', '_', $type->post_status);
290
+ echo "\n post_status_{$type->post_status} : $type->count,";
291
+ }
292
+ }
293
+
294
  function get_user_data(){
295
  global $current_user;
296
  $data = get_userdata($current_user->ID);
347
  user_level: '<?php echo $user_role ?>',
348
  user_email: '<?php echo $current_user->user_email ?>',
349
  <?php $this->list_post_types() ?>
350
+ <?php $this->list_taxonomies() ?>
351
  <?php $this->get_user_data() ?>
352
  <?php $this->list_comments() ?>
353
+ <?php $this->list_post_statuses() ?>
354
+ comment_count: 3,
355
+ use_native_controls: false
356
  // open_bucket: 476
357
  }
358
  <?php if ($activation_id = get_option( "sk_activation_id" )){ ?>