Sidekick - Version 2.5.6

Version Description

Download this release

Release Info

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

Code changes from version 2.5.5 to 2.5.6

Files changed (4) hide show
  1. js/sidekick_admin.js +166 -157
  2. readme.txt +4 -1
  3. sidekick.php +10 -6
  4. sidekick_embed.php +10 -6
js/sidekick_admin.js CHANGED
@@ -1,15 +1,32 @@
1
  // Single Site
2
 
 
 
3
  var currently_disabled_wts;
4
  var currently_disabled_network_wts;
5
  var lastTimeout;
6
  var loadCount = 0;
7
  var lastLoadedStatus = null;
8
  var loadOffset = 0;
9
- var maxLoadOffset = null;
10
  var activated = 0;
11
  var unactivated_count = 0;
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  function load_sites_by_status(status,target){
14
 
15
  activated = 0;
@@ -25,7 +42,7 @@ function load_sites_by_status(status,target){
25
  jQuery('.sites h2 span').html(status + ' site list');
26
 
27
  if (parseInt(jQuery(target).find('h3').html(),10) === 0) {
28
- jQuery('.site_list').html('<div class="site">No Sites</div>');
29
  jQuery('.sites .action').hide();
30
  return false;
31
  } else {
@@ -38,28 +55,15 @@ function load_sites_by_status(status,target){
38
  offset: (loadOffset) ? loadOffset : 0
39
  };
40
 
41
- // console.log('data %o', data);
42
  jQuery('.site_list .site').fadeTo('fast',0.5);
43
 
44
-
45
  jQuery.post(ajaxurl, data, function(e,msg){
46
 
47
- // console.log('back %o', e);
48
-
49
- jQuery('.site_list').html('');
50
-
51
-
52
-
53
- jQuery('.pagination .start').html(loadOffset+1);
54
- jQuery('.pagination .end').html(e.pages);
55
-
56
- jQuery('.stats .unactivated h3').html(e.counts.unactivated);
57
- jQuery('.stats .active h3').html(e.counts.active);
58
- jQuery('.stats .deactivated h3').html(e.counts.deactivated);
59
 
60
  var button = '<button class="activate">Activate</button></div>';
61
 
62
- if (lastLoadedStatus == 'active') {
63
  button = '<button class="deactivate">Deactivate</button></div>';
64
  }
65
 
@@ -71,30 +75,14 @@ function load_sites_by_status(status,target){
71
  jQuery('.site_list').append('<div class="site">No Sites</div>');
72
  }
73
 
74
-
75
  setup_buttons();
76
 
77
  },'json');
78
  }
79
 
80
- function setup_buttons(){
81
- // console.log('setup_buttons');
82
- setup_buttons_next_prev();
83
- setup_buttons_activate();
84
- setup_buttons_deactivate();
85
- setup_buttons_activate_batch();
86
- }
87
-
88
- function setup_buttons_deactivate(){
89
- jQuery('.site button.deactivate').off('click').click(function(){
90
- window.open('https://www.sidekick.pro/profile/#/overview','_blank');
91
- });
92
- }
93
-
94
  function setup_buttons_next_prev(){
95
 
96
  jQuery('.pagination .next').off('click').click(function(){
97
- // jQuery('.site_list').html('Loading...');
98
  jQuery('.pagination .prev').show();
99
 
100
  loadOffset = loadOffset + 1;
@@ -103,11 +91,9 @@ function setup_buttons_next_prev(){
103
  if (loadOffset === parseInt(jQuery('.pagination .end').html(),10)-1) {
104
  jQuery('.pagination .next').hide();
105
  }
106
-
107
  });
108
 
109
  jQuery('.pagination .prev').off('click').click(function(){
110
- // jQuery('.site_list').html('Loading...');
111
  jQuery('.pagination .next').show();
112
 
113
  loadOffset = loadOffset - 1;
@@ -119,6 +105,17 @@ function setup_buttons_next_prev(){
119
  });
120
  }
121
 
 
 
 
 
 
 
 
 
 
 
 
122
  function setup_buttons_activate_batch(){
123
  jQuery('.activate_all').off('click').click(function(){
124
 
@@ -150,10 +147,23 @@ function setup_buttons_activate_batch(){
150
  });
151
  }
152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  function setup_buttons_activate(){
154
  jQuery('.site button.activate').off('click').click(function(){
155
- // console.log('activate');
156
-
157
  var data = {
158
  action: 'sk_activate_single',
159
  blog_id: jQuery(this).parent().data('blogid'),
@@ -164,166 +174,170 @@ function setup_buttons_activate(){
164
 
165
  jQuery(this).html('Activating...');
166
  jQuery('.single_activation_error').html('').hide();
 
 
 
 
 
 
 
 
 
 
167
 
168
- // console.log('data %o', data);
169
 
 
170
 
171
- jQuery.post(ajaxurl, data, activateCallback(this),'json');
 
172
 
173
- });
174
- }
175
 
176
- var activateCallback = function(button){
177
- return function(e){
178
 
179
- // console.log('activateCallback back e %o', e);
180
 
181
- if (!e.success) {
182
- jQuery(button).html('Error').addClass('red');
183
- if (e.payload.message == 'Already Activated') {
184
- updateStatCounts();
185
- }
186
- jQuery('.single_activation_error').html(e.payload.message).show();
187
- } else if (e.success) {
188
- updateStatCounts();
189
- jQuery(button).html('Success').addClass('green');
190
- }
191
- };
192
- };
193
 
194
- function updateStatCounts(increment){
 
195
 
196
- var default_increment = 1;
197
- if (increment) {
198
- default_increment = increment;
199
- }
200
 
201
- jQuery('h3','div.' + lastLoadedStatus).html(parseInt(jQuery('h3','div.' + lastLoadedStatus).html(),10)-default_increment);
202
- jQuery('h3','div.active').html(parseInt(jQuery('h3','div.active').html(),10)+default_increment);
 
 
 
 
 
203
  }
204
 
205
- function sk_populate(data){
206
 
207
- console.log('sk_populate %o',data);
208
 
209
  jQuery('.sk_walkthrough_list').html('');
210
 
211
- _.each(data,function(item,key){
212
 
213
- if (!item.cacheId) {
214
- return false;
215
- }
216
 
217
- jQuery('.sk_walkthrough_list').append('<div class="sk_product" id="' + item.cacheId + '"><b>' + item.name + '</b> (<span class="select_all">Toggle All</span>)</div>');
 
 
218
 
219
- if (typeof sk_config.disable_wts === "string" && sk_config.disable_wts.indexOf(']') > -1) {
220
- sk_config.disable_wts = JSON.parse(sk_config.disable_wts);
221
- };
 
222
 
223
- if (typeof sk_config.disable_network_wts === "string" && sk_config.disable_network_wts.indexOf(']') > -1) {
224
- sk_config.disable_network_wts = JSON.parse(sk_config.disable_network_wts);
225
- };
 
226
 
 
227
 
228
- if (sk_config.disable_wts) {
229
- currently_disabled_wts = sk_config.disable_wts;
230
- sk_config.disable_wts = null;
231
- }
232
 
233
- if (sk_config.disable_network_wts) {
234
- currently_disabled_network_wts = sk_config.disable_network_wts;
235
- sk_config.disable_network_wts = null;
236
  }
237
 
238
- jQuery.ajax({
239
- url:sk_config.library + 'products/cache?cacheId=' + item.cacheId,
240
- cacheId: item.cacheId,
241
- success: function(data,cacheId){
242
-
243
- // console.log('SUCCESS %o',arguments);
244
- loadCount++;
245
 
246
- if (data.payload && data.payload.buckets) {
247
 
248
- // Clear out disabled wts so that compatibility doesn't screen out wts from this screen. Put it back after we're done.
 
 
 
 
 
 
249
 
250
- console.groupCollapsed('Checking Compatibilities');
251
 
252
- _.each(data.payload.buckets,function(bucket,key){
253
 
254
- clearTimeout(lastTimeout);
255
- lastTimeout = setTimeout(function(){setup_events();},1000);
256
 
257
- if (typeof sk_config.disable_wts_in_root_bucket_ids !== 'undefined' && jQuery.inArray( bucket.id, sk_config.disable_wts_in_root_bucket_ids ) > -1) {
258
- // Don't draw root bucket
259
- return false;
260
- }
261
 
262
- jQuery('#' + item.cacheId).append("<li class='sk_bucket' id='sk_bucket_" + bucket.id + "'>" + bucket.name + " (<span class=\"select_all\">Toggle All</span>)<ul></ul></li>");
 
263
 
264
- var pass_data = {
265
- bucket_id: bucket.id,
266
- all_walkthroughs: data.payload.walkthroughs
267
- };
268
 
269
- _.each(bucket.walkthroughs,function(walkthrough,key){
270
 
271
- var pass = false;
 
 
 
272
 
273
- if (typeof sk_ms_admin === 'undefined' || !sk_ms_admin && jQuery.inArray(parseInt(key,10),currently_disabled_network_wts) > -1) {
274
- // If single site and network disabled walkthroughs then don't even show it.
275
- return;
276
- }
277
 
278
- if (typeof sidekick !== 'undefined' && sidekick.compatibilityModel.check_compatiblity_array(this.all_walkthroughs[key]) || (typeof sk_ms_admin !== 'undefined' && sk_ms_admin)){
279
- // Only check compatibilities for single sites not network admin page
280
- pass = true;
281
- }
 
 
282
 
283
- if (pass){
284
- var checked = false;
285
- var selected = false;
 
286
 
287
- if (jQuery.inArray(parseInt(key,10),currently_disabled_wts) > -1 || jQuery.inArray(parseInt(key,10),currently_disabled_network_wts) > -1) {
288
- checked = 'CHECKED';
289
- }
290
 
291
- if (sk_config.autostart_walkthrough_id !== 'undefined' && sk_config.autostart_walkthrough_id == parseInt(key,10)) {
292
- selected = 'SELECTED';
293
- }
294
 
295
- jQuery('#sk_bucket_' + this.bucket_id).find('ul').append("<li class=\" sk_walkthrough\"><span><input type=\"checkbox\" " + checked + " value='" + key + "' name=\"disable_wts[]\"></span><span class='title'>" + this.all_walkthroughs[key].title + "</span></li>");
296
- jQuery('[name="sk_autostart_walkthrough_id"]').append('<option ' + selected + ' value="' + key + '">' + this.all_walkthroughs[key].title + '</option>');
297
 
298
- }
299
- clearTimeout(lastTimeout);
300
- lastTimeout = setTimeout(function(){setup_events();},1000);
301
- },pass_data);
302
 
303
- }); //
 
 
 
304
 
305
- jQuery('.configure').show(); //
 
 
 
306
 
307
- console.groupEnd();//
 
 
308
 
309
- } else { //
310
- jQuery('#' + this.cacheId).remove();
311
- }
312
 
313
- }
314
- });
315
- });
316
- }
317
 
 
 
318
 
 
 
 
 
319
 
320
  function setup_events(){
321
 
322
  jQuery('.select_all').click(function(){
323
  var checkBoxes = jQuery(this).parent().find('input[type="checkbox"]');
324
 
325
- _.each(checkBoxes,function(item,key){
326
- jQuery(item).attr("checked", !jQuery(item).attr("checked"));
327
  });
328
  });
329
 
@@ -375,16 +389,16 @@ function load_sk_library($key){
375
 
376
  jQuery.ajax({
377
  url: sk_url,
378
- error: function(data){
379
  jQuery('.sk_license_status span').html('Invalid Key').css({color: 'red'});
380
  jQuery('.sk_upgrade').show();
381
  load_sk_library();
382
  },
383
  success: function(data){
384
 
385
- console.log('%csuccess %o','color: green',data);
386
 
387
- if (sk_config.library + 'domains/cache?domainKey=' + sk_config.activation_id == sk_url) {
388
  if (!data.payload) {
389
  jQuery('.sk_license_status').html('Invalid Key').css({color: 'red'});
390
  } else {
@@ -393,23 +407,23 @@ function load_sk_library($key){
393
  }
394
 
395
  if (!data.payload) {
396
- console.log('loading again');
397
  load_sk_library();
398
  return false;
399
  }
400
 
401
  if (data.payload) {
402
 
403
- sidekick.compatibilityModel.filter_products(data.payload.products);
404
 
405
- sk_populate(sidekick.compatibilityModel.get('passed_products'));
406
  }
407
  }
408
  });
409
  }
410
 
411
  function setup_sk_admin(){
412
- console.log('setup_sk_admin');
413
  if (jQuery('.sidekick_admin').length === 0) {
414
  return;
415
  }
@@ -419,15 +433,15 @@ function setup_sk_admin(){
419
  jQuery('#toggle_composer').trigger('click');
420
  });
421
 
422
- if (typeof sk_ms_admin !== 'undefined' && sk_ms_admin) {
423
 
424
  // Multisite
425
  load_sites_by_status('unactivated');
426
 
427
  var clicked_button;
428
 
429
- if (typeof last_site_key !== 'undefined') {
430
- load_sk_library(last_site_key);
431
  } else {
432
  jQuery('.sk_box.configure').html('Need to activate at least one site to configure walkthroughs').show();
433
  }
@@ -472,8 +486,3 @@ function setup_sk_admin(){
472
  });
473
  }
474
  }
475
-
476
- // window.onload = function(){
477
- // console.log('init setup_sk_admin');
478
- // setup_sk_admin();
479
- // }
1
  // Single Site
2
 
3
+ 'use strict';
4
+
5
  var currently_disabled_wts;
6
  var currently_disabled_network_wts;
7
  var lastTimeout;
8
  var loadCount = 0;
9
  var lastLoadedStatus = null;
10
  var loadOffset = 0;
 
11
  var activated = 0;
12
  var unactivated_count = 0;
13
 
14
+
15
+ function updateCounts(e){
16
+ jQuery('.site_list').html('');
17
+ jQuery('.pagination .start').html(loadOffset+1);
18
+ jQuery('.pagination .end').html(e.pages);
19
+ jQuery('.stats .unactivated h3').html(e.counts.unactivated);
20
+ jQuery('.stats .active h3').html(e.counts.active);
21
+ jQuery('.stats .deactivated h3').html(e.counts.deactivated);
22
+ }
23
+
24
+ function setup_buttons_deactivate(){
25
+ jQuery('.site button.deactivate').off('click').click(function(){
26
+ window.open('https://www.sidekick.pro/profile/#/overview','_blank');
27
+ });
28
+ }
29
+
30
  function load_sites_by_status(status,target){
31
 
32
  activated = 0;
42
  jQuery('.sites h2 span').html(status + ' site list');
43
 
44
  if (parseInt(jQuery(target).find('h3').html(),10) === 0) {
45
+ jQuery('.site_list').html('<div class=\'site\'>No Sites</div>');
46
  jQuery('.sites .action').hide();
47
  return false;
48
  } else {
55
  offset: (loadOffset) ? loadOffset : 0
56
  };
57
 
 
58
  jQuery('.site_list .site').fadeTo('fast',0.5);
59
 
 
60
  jQuery.post(ajaxurl, data, function(e,msg){
61
 
62
+ updateCounts(e);
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  var button = '<button class="activate">Activate</button></div>';
65
 
66
+ if (lastLoadedStatus === 'active') {
67
  button = '<button class="deactivate">Deactivate</button></div>';
68
  }
69
 
75
  jQuery('.site_list').append('<div class="site">No Sites</div>');
76
  }
77
 
 
78
  setup_buttons();
79
 
80
  },'json');
81
  }
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  function setup_buttons_next_prev(){
84
 
85
  jQuery('.pagination .next').off('click').click(function(){
 
86
  jQuery('.pagination .prev').show();
87
 
88
  loadOffset = loadOffset + 1;
91
  if (loadOffset === parseInt(jQuery('.pagination .end').html(),10)-1) {
92
  jQuery('.pagination .next').hide();
93
  }
 
94
  });
95
 
96
  jQuery('.pagination .prev').off('click').click(function(){
 
97
  jQuery('.pagination .next').show();
98
 
99
  loadOffset = loadOffset - 1;
105
  });
106
  }
107
 
108
+ function updateStatCounts(increment){
109
+
110
+ var default_increment = 1;
111
+ if (increment) {
112
+ default_increment = increment;
113
+ }
114
+
115
+ jQuery('h3','div.' + lastLoadedStatus).html(parseInt(jQuery('h3','div.' + lastLoadedStatus).html(),10)-default_increment);
116
+ jQuery('h3','div.active').html(parseInt(jQuery('h3','div.active').html(),10)+default_increment);
117
+ }
118
+
119
  function setup_buttons_activate_batch(){
120
  jQuery('.activate_all').off('click').click(function(){
121
 
147
  });
148
  }
149
 
150
+ var activateCallback = function(button){
151
+ return function(e){
152
+ if (!e.success) {
153
+ jQuery(button).html('Error').addClass('red');
154
+ if (e.payload.message === 'Already Activated') {
155
+ updateStatCounts();
156
+ }
157
+ jQuery('.single_activation_error').html(e.payload.message).show();
158
+ } else if (e.success) {
159
+ updateStatCounts();
160
+ jQuery(button).html('Success').addClass('green');
161
+ }
162
+ };
163
+ };
164
+
165
  function setup_buttons_activate(){
166
  jQuery('.site button.activate').off('click').click(function(){
 
 
167
  var data = {
168
  action: 'sk_activate_single',
169
  blog_id: jQuery(this).parent().data('blogid'),
174
 
175
  jQuery(this).html('Activating...');
176
  jQuery('.single_activation_error').html('').hide();
177
+ jQuery.post(ajaxurl, data, activateCallback(this),'json');
178
+ });
179
+ }
180
+
181
+ function setup_buttons(){
182
+ setup_buttons_next_prev();
183
+ setup_buttons_activate();
184
+ setup_buttons_deactivate();
185
+ setup_buttons_activate_batch();
186
+ }
187
 
 
188
 
189
+ function drawProduct(product){
190
 
191
+ // console.log('drawProduct %o',product);
192
+ // console.log('this %o', this);
193
 
194
+ loadCount++;
 
195
 
196
+ if (product.payload && product.payload.buckets) {
 
197
 
198
+ // Clear out disabled wts so that compatibility doesn't screen out wts from this screen. Put it back after we're done.
199
 
200
+ console.groupCollapsed('Checking Compatibilities');
 
 
 
 
 
 
 
 
 
 
 
201
 
202
+ _.each(product.payload.buckets,function(bucket,key){
203
+ // console.log('this.cacheId %o', this.cacheId);
204
 
205
+ drawBuckets(this.cacheId,product,bucket,key,product.payload.walkthroughs);
206
+ },this);
 
 
207
 
208
+ jQuery('.configure').show();
209
+
210
+ console.groupEnd();
211
+
212
+ } else {
213
+ jQuery('#' + this.cacheId).remove();
214
+ }
215
  }
216
 
217
+ function sk_populate(products){
218
 
219
+ // console.log('sk_populate %o',products);
220
 
221
  jQuery('.sk_walkthrough_list').html('');
222
 
 
223
 
224
+ if (typeof sk_config.disable_wts === 'string' && sk_config.disable_wts.indexOf(']') > -1) {
225
+ sk_config.disable_wts = JSON.parse(sk_config.disable_wts);
226
+ }
227
 
228
+ if (typeof sk_config.disable_network_wts === 'string' && sk_config.disable_network_wts.indexOf(']') > -1) {
229
+ sk_config.disable_network_wts = JSON.parse(sk_config.disable_network_wts);
230
+ }
231
 
232
+ if (sk_config.disable_wts) {
233
+ currently_disabled_wts = sk_config.disable_wts;
234
+ sk_config.disable_wts = null;
235
+ }
236
 
237
+ if (sk_config.disable_network_wts) {
238
+ currently_disabled_network_wts = sk_config.disable_network_wts;
239
+ sk_config.disable_network_wts = null;
240
+ }
241
 
242
+ _.each(products,function(product){
243
 
244
+ // Looping over products
 
 
 
245
 
246
+ if (!product.cacheId) {
247
+ return false;
 
248
  }
249
 
250
+ // console.log('LOAD PRODUCT -> %s', product.name);
 
 
 
 
 
 
251
 
252
+ jQuery('.sk_walkthrough_list').append('<div class="sk_product" id="' + product.cacheId + '"><b>' + product.name + '</b> (<span class="select_all">Toggle All</span>)</div>');
253
 
254
+ jQuery.ajax({
255
+ url:sk_config.library + 'products/cache?cacheId=' + product.cacheId,
256
+ cacheId: product.cacheId,
257
+ success: drawProduct
258
+ });
259
+ });
260
+ }
261
 
 
262
 
263
+ function drawBuckets(cacheId,data,bucket,key,productWalkthroughs){
264
 
265
+ // console.log('drawBuckets %o', arguments);
 
266
 
 
 
 
 
267
 
268
+ clearTimeout(lastTimeout);
269
+ lastTimeout = setTimeout(function(){setup_events();},1000);
270
 
271
+ if (typeof sk_config.disable_wts_in_root_bucket_ids !== 'undefined' && jQuery.inArray( bucket.id, sk_config.disable_wts_in_root_bucket_ids ) > -1) {
272
+ // Don't draw root bucket
273
+ return false;
274
+ }
275
 
276
+ jQuery('#' + cacheId).append('<li class=\'sk_bucket\' id=\'sk_bucket_' + bucket.id + '\'>' + bucket.name + ' (<span class=\'select_all\'>Toggle All</span>)<ul></ul></li>');
277
 
278
+ var pass_data = {
279
+ bucket_id: bucket.id,
280
+ productWalkthroughs: productWalkthroughs
281
+ };
282
 
283
+ _.each(bucket.walkthroughs,function(walkthrough){
 
 
 
284
 
285
+ // This is temporary for new walkthrough ordering
286
+ if (typeof walkthrough === 'object') {
287
+ walkthrough = productWalkthroughs[walkthrough.id];
288
+ } else {
289
+ walkthrough = productWalkthroughs[walkthrough];
290
+ }
291
 
292
+ drawWalkthrough(walkthrough,this.bucket_id);
293
+
294
+ },pass_data);
295
+ }
296
 
297
+ function drawWalkthrough(walkthrough,bucket_id){
 
 
298
 
299
+ // console.log('drawWalkthrough %o', arguments);
 
 
300
 
 
 
301
 
302
+ var pass = false;
 
 
 
303
 
304
+ if (typeof window.sk_ms_admin === 'undefined' || !window.sk_ms_admin && jQuery.inArray(parseInt(walkthrough.id,10),currently_disabled_network_wts) > -1) {
305
+ // If single site and network disabled walkthroughs then don't even show it.
306
+ return;
307
+ }
308
 
309
+ if (typeof window.sidekick !== 'undefined' && window.sidekick.compatibilityModel.check_compatiblity_array(walkthrough) || (typeof window.sk_ms_admin !== 'undefined' && window.sk_ms_admin)){
310
+ // Only check compatibilities for single sites not network admin page
311
+ pass = true;
312
+ }
313
 
314
+ if (pass){
315
+ var checked = false;
316
+ var selected = false;
317
 
318
+ if (jQuery.inArray(parseInt(walkthrough.id,10),currently_disabled_wts) > -1 || jQuery.inArray(parseInt(walkthrough.id,10),currently_disabled_network_wts) > -1) {
319
+ checked = 'CHECKED';
320
+ }
321
 
322
+ if (sk_config.autostart_walkthrough_id !== 'undefined' && sk_config.autostart_walkthrough_id === parseInt(walkthrough.id,10)) {
323
+ selected = 'SELECTED';
324
+ }
 
325
 
326
+ jQuery('#sk_bucket_' + bucket_id).find('ul').append('<li class="sk_walkthrough"><span><input type="checkbox" ' + checked + ' value=\'' + walkthrough.id + '\' name=\'disable_wts[]\'></span><span class=\'title\'>' + walkthrough.title + '</span></li>');
327
+ jQuery('[name="sk_autostart_walkthrough_id"]').append('<option ' + selected + ' value="' + walkthrough.id + '">' + walkthrough.title + '</option>');
328
 
329
+ }
330
+ clearTimeout(lastTimeout);
331
+ lastTimeout = setTimeout(function(){setup_events();},1000);
332
+ }
333
 
334
  function setup_events(){
335
 
336
  jQuery('.select_all').click(function(){
337
  var checkBoxes = jQuery(this).parent().find('input[type="checkbox"]');
338
 
339
+ _.each(checkBoxes,function(item){
340
+ jQuery(item).attr('checked', !jQuery(item).attr('checked'));
341
  });
342
  });
343
 
389
 
390
  jQuery.ajax({
391
  url: sk_url,
392
+ error: function(){
393
  jQuery('.sk_license_status span').html('Invalid Key').css({color: 'red'});
394
  jQuery('.sk_upgrade').show();
395
  load_sk_library();
396
  },
397
  success: function(data){
398
 
399
+ // console.log('%cload_sk_library success %o','color: green',data);
400
 
401
+ if (sk_config.library + 'domains/cache?domainKey=' + sk_config.activation_id === sk_url) {
402
  if (!data.payload) {
403
  jQuery('.sk_license_status').html('Invalid Key').css({color: 'red'});
404
  } else {
407
  }
408
 
409
  if (!data.payload) {
410
+ // console.log('loading again');
411
  load_sk_library();
412
  return false;
413
  }
414
 
415
  if (data.payload) {
416
 
417
+ window.sidekick.compatibilityModel.filter_products(data.payload.products);
418
 
419
+ sk_populate(window.sidekick.compatibilityModel.get('passed_products'));
420
  }
421
  }
422
  });
423
  }
424
 
425
  function setup_sk_admin(){
426
+ // console.log('setup_sk_admin');
427
  if (jQuery('.sidekick_admin').length === 0) {
428
  return;
429
  }
433
  jQuery('#toggle_composer').trigger('click');
434
  });
435
 
436
+ if (typeof window.sk_ms_admin !== 'undefined' && window.sk_ms_admin) {
437
 
438
  // Multisite
439
  load_sites_by_status('unactivated');
440
 
441
  var clicked_button;
442
 
443
+ if (typeof window.last_site_key !== 'undefined') {
444
+ load_sk_library(window.last_site_key);
445
  } else {
446
  jQuery('.sk_box.configure').html('Need to activate at least one site to configure walkthroughs').show();
447
  }
486
  });
487
  }
488
  }
 
 
 
 
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.sidekick.pro
4
  Tags: help, tutorial, tutorials,screencast, self-help, training, learn, learning, sidekick, guide, teach, video, manual, videos, wphelp, support, instructions, question, questions, answers, answer, clippy, q&a, wpuniversity, helper, walkthrough
5
  Requires at least: 3.7
6
  Tested up to: 4.2
7
- Stable tag: 2.5.5
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,9 @@ We read and respond to every piece of feedback we get.
145
 
146
  == Changelog ==
147
 
 
 
 
148
  = 2.5.5 =
149
  * Clean up of tracking routines
150
  * Additional security around preference saving (Thank You Joost - @yoast)
4
  Tags: help, tutorial, tutorials,screencast, self-help, training, learn, learning, sidekick, guide, teach, video, manual, videos, wphelp, support, instructions, question, questions, answers, answer, clippy, q&a, wpuniversity, helper, walkthrough
5
  Requires at least: 3.7
6
  Tested up to: 4.2
7
+ Stable tag: 2.5.6
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.5 =
149
+ * Fixes an issue with activation
150
+
151
  = 2.5.5 =
152
  * Clean up of tracking routines
153
  * Additional security around preference saving (Thank You Joost - @yoast)
sidekick.php CHANGED
@@ -6,7 +6,7 @@ Plugin URL: http://wordpress.org/plugins/sidekick/
6
  Description: Adds a real-time WordPress training walkthroughs right in your Dashboard
7
  Requires at least: 4.0
8
  Tested up to: 4.1.1
9
- Version: 2.5.5
10
  Author: Sidekick.pro
11
  Author URI: http://www.sidekick.pro
12
  */
@@ -25,7 +25,7 @@ if (!class_exists('Sidekick')){
25
  function __construct(){
26
  if (!defined('SK_API')) define('SK_API','//apiv2.sidekick.pro/');
27
  if (!defined('SK_TRACKING_API')) define('SK_TRACKING_API','//tracking.sidekick.pro/');
28
- if (!defined('SK_CACHE_PREFIX')) define('SK_CACHE_PREFIX',str_replace('.', '_', '2.5.5'));
29
  }
30
 
31
  function enqueue_required(){
@@ -51,6 +51,12 @@ if (!class_exists('Sidekick')){
51
  add_submenu_page( 'options-general.php', 'Sidekick', 'Sidekick', 'activate_plugins','sidekick', array(&$this,'admin_page'));
52
  }
53
 
 
 
 
 
 
 
54
  function admin_page(){
55
 
56
  if ( empty( $_POST ) || check_admin_referer( 'update_sk_settings' ) ) {
@@ -132,8 +138,6 @@ if (!class_exists('Sidekick')){
132
  exit;
133
  }
134
 
135
- $_POST['disable_wts'] = array_map("mysql_real_escape_string",$_POST['disable_wts']);
136
-
137
  if (isset($_POST['disable_wts']) && $_POST['disable_wts']) {
138
  update_option('sk_disabled_wts',json_encode($_POST['disable_wts']));
139
  if (isset($_POST['is_ms_admin']) && $_POST['is_ms_admin']) {
@@ -276,7 +280,7 @@ if (!class_exists('Sidekick')){
276
 
277
  // WordPress
278
  "embed_partner_id" => SK_EMBEDDED_PARTNER, // for tracking purposes if sidekick has been embeded in another WordPress plugin or theme
279
- "plugin_version" => '2.5.5', // WordPress plugin version
280
  "site_url" => $sk_config_data->get_domain(),
281
  "domain" => str_replace("http://","",$_SERVER["SERVER_NAME"]),
282
  "plugin_url" => admin_url("admin.php?page=sidekick"),
@@ -328,7 +332,7 @@ if (!class_exists('Sidekick')){
328
  function check_ver(){
329
 
330
  if (isset($_GET['sk_ver_check'])){
331
- $data = json_encode('2.5.5');
332
 
333
  if(array_key_exists('callback', $_GET)){
334
 
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.6
10
  Author: Sidekick.pro
11
  Author URI: http://www.sidekick.pro
12
  */
25
  function __construct(){
26
  if (!defined('SK_API')) define('SK_API','//apiv2.sidekick.pro/');
27
  if (!defined('SK_TRACKING_API')) define('SK_TRACKING_API','//tracking.sidekick.pro/');
28
+ if (!defined('SK_CACHE_PREFIX')) define('SK_CACHE_PREFIX',str_replace('.', '_', '2.5.6'));
29
  }
30
 
31
  function enqueue_required(){
51
  add_submenu_page( 'options-general.php', 'Sidekick', 'Sidekick', 'activate_plugins','sidekick', array(&$this,'admin_page'));
52
  }
53
 
54
+ function activate($return = false){
55
+ if (isset($_POST['activation_id']) && current_user_can('install_plugins')) {
56
+ update_option('sk_activation_id',$_POST['activation_id']);
57
+ }
58
+ }
59
+
60
  function admin_page(){
61
 
62
  if ( empty( $_POST ) || check_admin_referer( 'update_sk_settings' ) ) {
138
  exit;
139
  }
140
 
 
 
141
  if (isset($_POST['disable_wts']) && $_POST['disable_wts']) {
142
  update_option('sk_disabled_wts',json_encode($_POST['disable_wts']));
143
  if (isset($_POST['is_ms_admin']) && $_POST['is_ms_admin']) {
280
 
281
  // WordPress
282
  "embed_partner_id" => SK_EMBEDDED_PARTNER, // for tracking purposes if sidekick has been embeded in another WordPress plugin or theme
283
+ "plugin_version" => '2.5.6', // WordPress plugin version
284
  "site_url" => $sk_config_data->get_domain(),
285
  "domain" => str_replace("http://","",$_SERVER["SERVER_NAME"]),
286
  "plugin_url" => admin_url("admin.php?page=sidekick"),
332
  function check_ver(){
333
 
334
  if (isset($_GET['sk_ver_check'])){
335
+ $data = json_encode('2.5.6');
336
 
337
  if(array_key_exists('callback', $_GET)){
338
 
sidekick_embed.php CHANGED
@@ -8,7 +8,7 @@ Description: Adds a real-time WordPress training walkthroughs right in your Dash
8
  We recommend not activating SIDEKICK automatically for people but via an Opt-In process when they configure your own theme or plugin.
9
  Requires at least: 4.0
10
  Tested up to: 4.1.1
11
- Version: 2.5.5
12
  Author: Sidekick.pro
13
  Author URI: http://www.sidekick.pro
14
  */
@@ -30,7 +30,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
30
  function __construct(){
31
  if (!defined('SK_API')) define('SK_API','//apiv2.sidekick.pro/');
32
  if (!defined('SK_TRACKING_API')) define('SK_TRACKING_API','//tracking.sidekick.pro/');
33
- if (!defined('SK_CACHE_PREFIX')) define('SK_CACHE_PREFIX',str_replace('.', '_', '2.5.5'));
34
  }
35
 
36
  function enqueue_required(){
@@ -56,6 +56,12 @@ if (!$sidekick_active && !class_exists('Sidekick')){
56
  add_submenu_page( 'options-general.php', 'Sidekick', 'Sidekick', 'activate_plugins','sidekick', array(&$this,'admin_page'));
57
  }
58
 
 
 
 
 
 
 
59
  function admin_page(){
60
 
61
  if ( empty( $_POST ) || check_admin_referer( 'update_sk_settings' ) ) {
@@ -391,8 +397,6 @@ if (!$sidekick_active && !class_exists('Sidekick')){
391
  exit;
392
  }
393
 
394
- $_POST['disable_wts'] = array_map("mysql_real_escape_string",$_POST['disable_wts']);
395
-
396
  if (isset($_POST['disable_wts']) && $_POST['disable_wts']) {
397
  update_option('sk_disabled_wts',json_encode($_POST['disable_wts']));
398
  if (isset($_POST['is_ms_admin']) && $_POST['is_ms_admin']) {
@@ -535,7 +539,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
535
 
536
  // WordPress
537
  "embed_partner_id" => SK_EMBEDDED_PARTNER, // for tracking purposes if sidekick has been embeded in another WordPress plugin or theme
538
- "plugin_version" => '2.5.5', // WordPress plugin version
539
  "site_url" => $sk_config_data->get_domain(),
540
  "domain" => str_replace("http://","",$_SERVER["SERVER_NAME"]),
541
  "plugin_url" => admin_url("admin.php?page=sidekick"),
@@ -587,7 +591,7 @@ if (!$sidekick_active && !class_exists('Sidekick')){
587
  function check_ver(){
588
 
589
  if (isset($_GET['sk_ver_check'])){
590
- $data = json_encode('2.5.5');
591
 
592
  if(array_key_exists('callback', $_GET)){
593
 
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.6
12
  Author: Sidekick.pro
13
  Author URI: http://www.sidekick.pro
14
  */
30
  function __construct(){
31
  if (!defined('SK_API')) define('SK_API','//apiv2.sidekick.pro/');
32
  if (!defined('SK_TRACKING_API')) define('SK_TRACKING_API','//tracking.sidekick.pro/');
33
+ if (!defined('SK_CACHE_PREFIX')) define('SK_CACHE_PREFIX',str_replace('.', '_', '2.5.6'));
34
  }
35
 
36
  function enqueue_required(){
56
  add_submenu_page( 'options-general.php', 'Sidekick', 'Sidekick', 'activate_plugins','sidekick', array(&$this,'admin_page'));
57
  }
58
 
59
+ function activate($return = false){
60
+ if (isset($_POST['activation_id']) && current_user_can('install_plugins')) {
61
+ update_option('sk_activation_id',$_POST['activation_id']);
62
+ }
63
+ }
64
+
65
  function admin_page(){
66
 
67
  if ( empty( $_POST ) || check_admin_referer( 'update_sk_settings' ) ) {
397
  exit;
398
  }
399
 
 
 
400
  if (isset($_POST['disable_wts']) && $_POST['disable_wts']) {
401
  update_option('sk_disabled_wts',json_encode($_POST['disable_wts']));
402
  if (isset($_POST['is_ms_admin']) && $_POST['is_ms_admin']) {
539
 
540
  // WordPress
541
  "embed_partner_id" => SK_EMBEDDED_PARTNER, // for tracking purposes if sidekick has been embeded in another WordPress plugin or theme
542
+ "plugin_version" => '2.5.6', // WordPress plugin version
543
  "site_url" => $sk_config_data->get_domain(),
544
  "domain" => str_replace("http://","",$_SERVER["SERVER_NAME"]),
545
  "plugin_url" => admin_url("admin.php?page=sidekick"),
591
  function check_ver(){
592
 
593
  if (isset($_GET['sk_ver_check'])){
594
+ $data = json_encode('2.5.6');
595
 
596
  if(array_key_exists('callback', $_GET)){
597