Version Description
- Added SIDEKICK version check
- Fixes issues with saving autostart walkthroughs
- Fixes issues with disabling walkthroughs
Download this release
Release Info
Developer | raptor235 |
Plugin | Sidekick |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.1.1
- js/sidekick_admin.js +258 -0
- libs/admin_page.php +1 -1
- libs/licensing.php +68 -9
- libs/ms_admin_page.php +34 -6
- libs/sk_config_data.php +19 -27
- libs/walkthrough_config.php +4 -2
- readme.txt +7 -2
- sidekick.php +80 -57
js/sidekick_admin.js
ADDED
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Single Site
|
2 |
+
|
3 |
+
var currently_disabled_wts;
|
4 |
+
var currently_disabled_network_wts;
|
5 |
+
var lastTimeout;
|
6 |
+
|
7 |
+
function sk_populate(data){
|
8 |
+
|
9 |
+
jQuery('.sk_walkthrough_list').html('');
|
10 |
+
|
11 |
+
_.each(data.products,function(item,key){
|
12 |
+
|
13 |
+
if (!item.cacheId) {
|
14 |
+
return false;
|
15 |
+
}
|
16 |
+
|
17 |
+
jQuery('.sk_walkthrough_list').append('<div class="sk_product" id="' + item.cacheId + '"><b>' + item.name + '</b> (<span class="select_all">Toggle All</span>)</div>');
|
18 |
+
|
19 |
+
|
20 |
+
if (sk_config.disable_wts) {
|
21 |
+
currently_disabled_wts = sk_config.disable_wts;
|
22 |
+
sk_config.disable_wts = null;
|
23 |
+
}
|
24 |
+
|
25 |
+
if (sk_config.disable_network_wts) {
|
26 |
+
currently_disabled_network_wts = sk_config.disable_network_wts;
|
27 |
+
sk_config.disable_network_wts = null;
|
28 |
+
}
|
29 |
+
|
30 |
+
jQuery.ajax({
|
31 |
+
url:sk_config.library + 'products/cache?cacheId=' + item.cacheId,
|
32 |
+
cacheId: item.cacheId,
|
33 |
+
success: function(data,cacheId){
|
34 |
+
|
35 |
+
if (data.payload.buckets) {
|
36 |
+
|
37 |
+
// Clear out disabled wts so that compatibility doesn't screen out wts from this screen. Put it back after we're done.
|
38 |
+
|
39 |
+
console.groupCollapsed('Checking Compatibilities');
|
40 |
+
|
41 |
+
_.each(data.payload.buckets,function(bucket,key){
|
42 |
+
|
43 |
+
clearTimeout(lastTimeout);
|
44 |
+
lastTimeout = setTimeout(function(){setup_events();},1000);
|
45 |
+
|
46 |
+
if (typeof sk_config.disable_wts_in_root_bucket_ids !== 'undefined' && jQuery.inArray( bucket.id, sk_config.disable_wts_in_root_bucket_ids ) > -1) {
|
47 |
+
// Don't draw root bucket
|
48 |
+
return false;
|
49 |
+
}
|
50 |
+
|
51 |
+
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>");
|
52 |
+
|
53 |
+
var pass_data = {
|
54 |
+
bucket_id: bucket.id,
|
55 |
+
all_walkthroughs: data.payload.walkthroughs
|
56 |
+
};
|
57 |
+
|
58 |
+
_.each(bucket.walkthroughs,function(walkthrough,key){
|
59 |
+
|
60 |
+
var pass = false;
|
61 |
+
|
62 |
+
if (typeof sk_ms_admin === 'undefined' || !sk_ms_admin && jQuery.inArray(parseInt(key,10),currently_disabled_network_wts) > -1) {
|
63 |
+
// If single site and network disabled walkthroughs then don't even show it.
|
64 |
+
return;
|
65 |
+
}
|
66 |
+
|
67 |
+
if (sidekick.compatibilityModel.check_compatiblity_array(this.all_walkthroughs[key]) || (typeof sk_ms_admin !== 'undefined' && sk_ms_admin)){
|
68 |
+
// Only check compatibilities for single sites not network admin page
|
69 |
+
pass = true;
|
70 |
+
}
|
71 |
+
|
72 |
+
if (pass){
|
73 |
+
var checked = false;
|
74 |
+
var selected = false;
|
75 |
+
|
76 |
+
if (jQuery.inArray(parseInt(key,10),currently_disabled_wts) > -1 || jQuery.inArray(parseInt(key,10),currently_disabled_network_wts) > -1) {
|
77 |
+
checked = 'CHECKED';
|
78 |
+
}
|
79 |
+
|
80 |
+
if (sk_config.autostart_walkthrough_id !== 'undefined' && sk_config.autostart_walkthrough_id == parseInt(key,10)) {
|
81 |
+
selected = 'SELECTED';
|
82 |
+
}
|
83 |
+
|
84 |
+
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>");
|
85 |
+
jQuery('[name="sk_autostart_walkthrough_id"]').append('<option ' + selected + ' value="' + key + '">' + this.all_walkthroughs[key].title + '</option>');
|
86 |
+
|
87 |
+
}
|
88 |
+
clearTimeout(lastTimeout);
|
89 |
+
lastTimeout = setTimeout(function(){setup_events();},1000);
|
90 |
+
},pass_data);
|
91 |
+
|
92 |
+
}); //
|
93 |
+
|
94 |
+
jQuery('.configure').show(); //
|
95 |
+
|
96 |
+
console.groupEnd();//
|
97 |
+
|
98 |
+
} else { //
|
99 |
+
jQuery('#' + this.cacheId).remove();
|
100 |
+
}
|
101 |
+
|
102 |
+
}
|
103 |
+
});
|
104 |
+
}); //
|
105 |
+
} //
|
106 |
+
|
107 |
+
function setup_events(){
|
108 |
+
console.log('setup_events');
|
109 |
+
|
110 |
+
jQuery('.select_all').click(function(){
|
111 |
+
var checkBoxes = jQuery(this).parent().find('input[type="checkbox"]');
|
112 |
+
|
113 |
+
_.each(checkBoxes,function(item,key){
|
114 |
+
jQuery(item).attr("checked", !jQuery(item).attr("checked"));
|
115 |
+
});
|
116 |
+
});
|
117 |
+
|
118 |
+
jQuery('[name="disable_wts[]"]').click(function(e){
|
119 |
+
|
120 |
+
if (e.currentTarget.checked) {
|
121 |
+
jQuery('input[value="' + e.currentTarget.value + '"]').attr('checked',true);
|
122 |
+
} else {
|
123 |
+
jQuery('input[value="' + e.currentTarget.value + '"]').attr('checked',false);
|
124 |
+
}
|
125 |
+
|
126 |
+
});
|
127 |
+
|
128 |
+
jQuery('.activate_all').click(function(){
|
129 |
+
jQuery('.activate_sk').each(function(key,item){
|
130 |
+
setTimeout(function() {
|
131 |
+
jQuery(item).trigger('click');
|
132 |
+
}, key*1000);
|
133 |
+
});
|
134 |
+
});
|
135 |
+
|
136 |
+
jQuery('.sk_bucket').not(':has(li)').remove();
|
137 |
+
jQuery('.sk_product').not(':has(li)').remove();
|
138 |
+
|
139 |
+
// Set the disable_wts back to original state
|
140 |
+
sk_config.disable_wts = currently_disabled_wts;
|
141 |
+
sk_config.disable_network_wts = currently_disabled_network_wts;
|
142 |
+
}
|
143 |
+
|
144 |
+
function load_sk_library($key){
|
145 |
+
|
146 |
+
console.log('BBBB load_sk_library %o', $key);
|
147 |
+
var sk_url;
|
148 |
+
|
149 |
+
if ($key) {
|
150 |
+
sk_url = sk_config.library + 'domains/cache?domainKey=' + $key;
|
151 |
+
} else {
|
152 |
+
sk_url = sk_config.library + 'platform/cache?platformId=1';
|
153 |
+
}
|
154 |
+
|
155 |
+
console.log('sk_url %o', sk_url);
|
156 |
+
|
157 |
+
|
158 |
+
jQuery.ajax({
|
159 |
+
url: sk_url,
|
160 |
+
error: function(data){
|
161 |
+
jQuery('.sk_license_status span').html('Invalid Key').css({color: 'red'});
|
162 |
+
jQuery('.sk_upgrade').show();
|
163 |
+
load_sk_library();
|
164 |
+
},
|
165 |
+
success: function(data){
|
166 |
+
|
167 |
+
if (sk_config.library + 'domains/cache?domainKey=' + sk_config.activation_id == sk_url) {
|
168 |
+
if (!data.payload) {
|
169 |
+
jQuery('.sk_license_status').html('Invalid Key').css({color: 'red'});
|
170 |
+
} else {
|
171 |
+
jQuery('.sk_license_status').html('Valid').css({color: 'green'});
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
if (!data.payload) {
|
176 |
+
load_sk_library();
|
177 |
+
return false;
|
178 |
+
}
|
179 |
+
|
180 |
+
if (data.payload) {
|
181 |
+
sk_populate(data.payload);
|
182 |
+
}
|
183 |
+
}
|
184 |
+
});
|
185 |
+
}
|
186 |
+
|
187 |
+
jQuery(document).ready(function($) {
|
188 |
+
|
189 |
+
if (typeof sk_ms_admin !== 'undefined' && sk_ms_admin) {
|
190 |
+
|
191 |
+
// Multisite
|
192 |
+
|
193 |
+
var clicked_button;
|
194 |
+
|
195 |
+
if (typeof last_site_key !== 'undefined') {
|
196 |
+
load_sk_library(last_site_key);
|
197 |
+
} else {
|
198 |
+
jQuery('.sk_box.configure').html('Need to activate at least one site to configure walkthroughs').show();
|
199 |
+
}
|
200 |
+
|
201 |
+
jQuery('.activate_sk').click(function(){
|
202 |
+
|
203 |
+
clicked_button = this;
|
204 |
+
jQuery('.single_activation_error').html('');
|
205 |
+
|
206 |
+
var data = {
|
207 |
+
action: 'sk_activate_single',
|
208 |
+
blog_id: jQuery(this).data('blogid'),
|
209 |
+
user_id: jQuery(this).data('userid'),
|
210 |
+
domain: jQuery(this).data('domain'),
|
211 |
+
path: jQuery(this).data('path')
|
212 |
+
};
|
213 |
+
|
214 |
+
jQuery.post(ajaxurl, data, function(e){
|
215 |
+
|
216 |
+
if (!e.success) {
|
217 |
+
jQuery('.single_activation_error').html(e.message);
|
218 |
+
jQuery(clicked_button).parent().html('- <span class="not_active">Error Activating</span>');
|
219 |
+
} else if (e.success) {
|
220 |
+
jQuery(clicked_button).parent().html('- <span class="green">Activated</span>');
|
221 |
+
}
|
222 |
+
},'json');
|
223 |
+
|
224 |
+
});
|
225 |
+
|
226 |
+
if (jQuery('select[name="sk_selected_subscription"]').val().indexOf('roduct') > -1) {
|
227 |
+
jQuery('.walkthrough_group').show();
|
228 |
+
}
|
229 |
+
|
230 |
+
jQuery('select[name="sk_selected_subscription"]').on('change',function(){
|
231 |
+
if (jQuery('select[name="sk_selected_subscription"]').val().indexOf('roduct') > -1) {
|
232 |
+
jQuery('.walkthrough_group').show();
|
233 |
+
} else {
|
234 |
+
jQuery('.walkthrough_group').val(0);
|
235 |
+
jQuery('.walkthrough_group').hide();
|
236 |
+
}
|
237 |
+
});
|
238 |
+
|
239 |
+
} else {
|
240 |
+
jQuery(document).ready(function($) {
|
241 |
+
if (sk_config.activation_id) {
|
242 |
+
load_sk_library(sk_config.activation_id);
|
243 |
+
} else {
|
244 |
+
jQuery('.sk_upgrade').show();
|
245 |
+
}
|
246 |
+
|
247 |
+
jQuery('h3:contains(My Sidekick Account)').click(function(e){
|
248 |
+
if (e.shiftKey) {
|
249 |
+
jQuery('.advanced').show();
|
250 |
+
}
|
251 |
+
});
|
252 |
+
|
253 |
+
});
|
254 |
+
}
|
255 |
+
|
256 |
+
});
|
257 |
+
|
258 |
+
|
libs/admin_page.php
CHANGED
@@ -42,7 +42,7 @@
|
|
42 |
<tbody>
|
43 |
<tr valign="top">
|
44 |
<th scope="row" valign="top">Activation ID</th>
|
45 |
-
<?php if (defined('MULTISITE')): ?>
|
46 |
<?php if (isset($activation_id) && $activation_id): ?>
|
47 |
<td><input class='regular-text' style='color: gray;' type='text' name='activation_id' value='xxxxxxxx-xxxx-xxxx-xxxx-<?php echo substr($activation_id, 25,20) ?>'></input></td>
|
48 |
<?php else: ?>
|
42 |
<tbody>
|
43 |
<tr valign="top">
|
44 |
<th scope="row" valign="top">Activation ID</th>
|
45 |
+
<?php if (defined('MULTISITE') && MULTISITE): ?>
|
46 |
<?php if (isset($activation_id) && $activation_id): ?>
|
47 |
<td><input class='regular-text' style='color: gray;' type='text' name='activation_id' value='xxxxxxxx-xxxx-xxxx-xxxx-<?php echo substr($activation_id, 25,20) ?>'></input></td>
|
48 |
<?php else: ?>
|
libs/licensing.php
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
3 |
class sidekickMassActivator{
|
4 |
|
5 |
function activate($blog_id, $user_id, $domain, $path){
|
@@ -15,8 +17,16 @@ class sidekickMassActivator{
|
|
15 |
// TODO: Send Domain for good measure
|
16 |
|
17 |
$sk_selected_subscription = get_option("sk_selected_subscription");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
$result = $this->send_request('post','/domains'
|
20 |
|
21 |
if (isset($result->success) && $result->success == true && $result->payload->domainKey) {
|
22 |
|
@@ -151,14 +161,28 @@ class sidekickMassActivator{
|
|
151 |
|
152 |
function load_subscriptions(){
|
153 |
// var_dump('load_subscriptions');
|
154 |
-
$result
|
|
|
155 |
// var_dump($result);
|
156 |
if ($result->success) {
|
157 |
foreach ($result->payload as &$sub) {
|
158 |
-
if ($
|
159 |
-
//
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
}
|
163 |
// var_dump($sub->Domains);
|
164 |
if (count($sub->Domains) > 0) {
|
@@ -171,6 +195,16 @@ class sidekickMassActivator{
|
|
171 |
}
|
172 |
}
|
173 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
} else {
|
175 |
$sub->activeDomainCount = 0;
|
176 |
}
|
@@ -178,18 +212,34 @@ class sidekickMassActivator{
|
|
178 |
}
|
179 |
$data['subscriptions'] = $result->payload;
|
180 |
if (isset($current_subscription)) {
|
181 |
-
$data['current_subscription'] = $current_subscription;
|
182 |
} else {
|
183 |
-
delete_option('sk_auto_activations');
|
184 |
}
|
|
|
|
|
|
|
|
|
|
|
185 |
return $data;
|
186 |
}
|
187 |
return null;
|
188 |
}
|
189 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
function admin_page(){
|
191 |
if (isset($_POST['sk_account'])) {
|
192 |
|
|
|
|
|
193 |
if (isset($_POST['sk_password']) && $_POST['sk_password'] && isset($_POST['sk_account']) && $_POST['sk_account']) {
|
194 |
$key = 'hash';
|
195 |
$string = $_POST['sk_password'];
|
@@ -210,6 +260,13 @@ class sidekickMassActivator{
|
|
210 |
} else {
|
211 |
delete_option( 'sk_auto_activations');
|
212 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
}
|
214 |
|
215 |
$sk_token = get_transient('sk_token');
|
@@ -221,6 +278,7 @@ class sidekickMassActivator{
|
|
221 |
$sk_auto_activations = get_option( 'sk_auto_activations');
|
222 |
$sk_auto_activation_error = get_option('sk_auto_activation_error');
|
223 |
$sk_selected_subscription = get_option('sk_selected_subscription');
|
|
|
224 |
$is_ms_admin = true;
|
225 |
$curl = function_exists('curl_version') ? true : false;
|
226 |
$fgets = file_get_contents(__FILE__) ? true : false;
|
@@ -232,7 +290,8 @@ class sidekickMassActivator{
|
|
232 |
$error = "Sorry, SIDEKICK MultiSite activations require <b>CURL</b> or <b>file_get_contents</b> functions enabled in PHP.";
|
233 |
}
|
234 |
|
235 |
-
|
236 |
}
|
237 |
}
|
238 |
|
|
1 |
<?php
|
2 |
|
3 |
+
// licensing.php
|
4 |
+
|
5 |
class sidekickMassActivator{
|
6 |
|
7 |
function activate($blog_id, $user_id, $domain, $path){
|
17 |
// TODO: Send Domain for good measure
|
18 |
|
19 |
$sk_selected_subscription = get_option("sk_selected_subscription");
|
20 |
+
$sk_selected_product = get_option("sk_selected_product");
|
21 |
+
|
22 |
+
if (isset($sk_selected_product) && $sk_selected_product) {
|
23 |
+
$data = array('domainName' => $domain . $path, 'productId' => $sk_selected_product);
|
24 |
+
} else if (strpos($sk_selected_subscription,'subscription-') !== false) {
|
25 |
+
$sk_selected_subscription = explode('subscription-',$sk_selected_subscription);
|
26 |
+
$data = array('domainName' => $domain . $path, 'subscriptionId' => $sk_selected_subscription[1]);
|
27 |
+
}
|
28 |
|
29 |
+
$result = $this->send_request('post','/domains',$data);
|
30 |
|
31 |
if (isset($result->success) && $result->success == true && $result->payload->domainKey) {
|
32 |
|
161 |
|
162 |
function load_subscriptions(){
|
163 |
// var_dump('load_subscriptions');
|
164 |
+
$result = $this->send_request('get','/users/subscriptions');
|
165 |
+
$load_products = false;
|
166 |
// var_dump($result);
|
167 |
if ($result->success) {
|
168 |
foreach ($result->payload as &$sub) {
|
169 |
+
if (count($result->payload) === 1) {
|
170 |
+
// If there is only one result select it
|
171 |
+
if ($sub->Plan->CreatableProductType->name == 'Private') {
|
172 |
+
update_option( 'sk_selected_subscription', 'product-' . $sub->id );
|
173 |
+
} else {
|
174 |
+
update_option( 'sk_selected_subscription', 'subscription-' . $sub->id );
|
175 |
+
}
|
176 |
+
} else {
|
177 |
+
// If there is more then one result and there is no selected subscription then use basics
|
178 |
+
if ($sub->PlanId == 1 && !get_option('sk_selected_subscription')) {
|
179 |
+
// Basics or Enterprise can only be used right now
|
180 |
+
update_option( 'sk_selected_subscription', 'subscription-' . $sub->id );
|
181 |
+
// $current_subscription = $sub;
|
182 |
+
}
|
183 |
+
}
|
184 |
+
if (isset($sub->Plan->CreatableProductType->name) && $sub->Plan->CreatableProductType->name == 'Private') {
|
185 |
+
$load_products = true;
|
186 |
}
|
187 |
// var_dump($sub->Domains);
|
188 |
if (count($sub->Domains) > 0) {
|
195 |
}
|
196 |
}
|
197 |
}
|
198 |
+
} if (count($sub->PrivateProductSubscriptions) > 0) {
|
199 |
+
foreach ($sub->PrivateProductSubscriptions as &$domain) {
|
200 |
+
// if (!$domain->Domain->deletedAt) {
|
201 |
+
if (isset($sub->activeDomainCount)) {
|
202 |
+
$sub->activeDomainCount++;
|
203 |
+
} else {
|
204 |
+
$sub->activeDomainCount = 1;
|
205 |
+
}
|
206 |
+
// }
|
207 |
+
}
|
208 |
} else {
|
209 |
$sub->activeDomainCount = 0;
|
210 |
}
|
212 |
}
|
213 |
$data['subscriptions'] = $result->payload;
|
214 |
if (isset($current_subscription)) {
|
215 |
+
// $data['current_subscription'] = $current_subscription;
|
216 |
} else {
|
217 |
+
// delete_option('sk_auto_activations');
|
218 |
}
|
219 |
+
|
220 |
+
if ($load_products) {
|
221 |
+
$data['products'] = $this->load_products();
|
222 |
+
}
|
223 |
+
|
224 |
return $data;
|
225 |
}
|
226 |
return null;
|
227 |
}
|
228 |
|
229 |
+
function load_products(){
|
230 |
+
$result = $this->send_request('get','/products');
|
231 |
+
// var_dump($result);
|
232 |
+
if ($result->success) {
|
233 |
+
return $result->payload->products;
|
234 |
+
}
|
235 |
+
return null;
|
236 |
+
}
|
237 |
+
|
238 |
function admin_page(){
|
239 |
if (isset($_POST['sk_account'])) {
|
240 |
|
241 |
+
delete_option('sk_auto_activation_error');
|
242 |
+
|
243 |
if (isset($_POST['sk_password']) && $_POST['sk_password'] && isset($_POST['sk_account']) && $_POST['sk_account']) {
|
244 |
$key = 'hash';
|
245 |
$string = $_POST['sk_password'];
|
260 |
} else {
|
261 |
delete_option( 'sk_auto_activations');
|
262 |
}
|
263 |
+
|
264 |
+
if (isset($_POST['sk_selected_product']) && isset($_POST['sk_selected_subscription']) && strpos($_POST['sk_selected_subscription'], 'product') !== false) {
|
265 |
+
update_option( 'sk_selected_product', $_POST['sk_selected_product'] );
|
266 |
+
} else {
|
267 |
+
delete_option( 'sk_selected_product');
|
268 |
+
}
|
269 |
+
|
270 |
}
|
271 |
|
272 |
$sk_token = get_transient('sk_token');
|
278 |
$sk_auto_activations = get_option( 'sk_auto_activations');
|
279 |
$sk_auto_activation_error = get_option('sk_auto_activation_error');
|
280 |
$sk_selected_subscription = get_option('sk_selected_subscription');
|
281 |
+
$sk_selected_product = get_option('sk_selected_product');
|
282 |
$is_ms_admin = true;
|
283 |
$curl = function_exists('curl_version') ? true : false;
|
284 |
$fgets = file_get_contents(__FILE__) ? true : false;
|
290 |
$error = "Sorry, SIDEKICK MultiSite activations require <b>CURL</b> or <b>file_get_contents</b> functions enabled in PHP.";
|
291 |
}
|
292 |
|
293 |
+
require_once('ms_admin_page.php');
|
294 |
}
|
295 |
}
|
296 |
|
297 |
+
// //licensing.php
|
libs/ms_admin_page.php
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
<script type="text/javascript">
|
2 |
if (typeof ajax_url === 'undefined') {
|
3 |
ajax_url = '<?php echo admin_url() ?>admin-ajax.php';
|
@@ -40,8 +42,6 @@
|
|
40 |
</div>
|
41 |
<?php endif ?>
|
42 |
|
43 |
-
|
44 |
-
|
45 |
<div class="sidekick_admin">
|
46 |
|
47 |
<div class="sk_box left">
|
@@ -76,17 +76,25 @@
|
|
76 |
<?php if (isset($sk_subs['subscriptions']) && count($sk_subs['subscriptions']) > 0): ?>
|
77 |
<?php foreach ($sk_subs['subscriptions'] as $key => $sub): ?>
|
78 |
<?php
|
79 |
-
if ($sub->PlanId !== 1) {
|
80 |
continue;
|
81 |
}
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
$selected_sub = $sub;
|
84 |
$selected = 'SELECTED';
|
85 |
} else {
|
86 |
$selected = '';
|
87 |
}
|
88 |
?>
|
89 |
-
<option <?php echo $selected ?> value='<?php echo $sub->id ?>'><?php echo $sub->Plan->name . ' - ' . $sub->CurrentTier->name ?></option>
|
90 |
<?php endforeach ?>
|
91 |
<?php if (!isset($selected_sub)): ?>
|
92 |
<option value='0'>No Compatible Subscriptions</option>
|
@@ -97,6 +105,25 @@
|
|
97 |
</select>
|
98 |
</td>
|
99 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
<tr valign="top">
|
101 |
<th scope="row" valign="top">Enable Auto-Activations</th>
|
102 |
<td>
|
@@ -107,6 +134,7 @@
|
|
107 |
<?php endif ?>
|
108 |
</td>
|
109 |
</tr>
|
|
|
110 |
<?php if (isset($selected_sub)): ?>
|
111 |
<tr>
|
112 |
<th scope="row" valign="top">Active Domains</th>
|
@@ -212,6 +240,6 @@
|
|
212 |
|
213 |
</div>
|
214 |
|
215 |
-
|
216 |
|
217 |
|
1 |
+
<!-- ms_admin_page.php -->
|
2 |
+
|
3 |
<script type="text/javascript">
|
4 |
if (typeof ajax_url === 'undefined') {
|
5 |
ajax_url = '<?php echo admin_url() ?>admin-ajax.php';
|
42 |
</div>
|
43 |
<?php endif ?>
|
44 |
|
|
|
|
|
45 |
<div class="sidekick_admin">
|
46 |
|
47 |
<div class="sk_box left">
|
76 |
<?php if (isset($sk_subs['subscriptions']) && count($sk_subs['subscriptions']) > 0): ?>
|
77 |
<?php foreach ($sk_subs['subscriptions'] as $key => $sub): ?>
|
78 |
<?php
|
79 |
+
if ($sub->PlanId !== 1 && $sub->Plan->CreatableProductType->name !== 'Private') {
|
80 |
continue;
|
81 |
}
|
82 |
+
|
83 |
+
if (isset($sub->Plan->CreatableProductType->name) && $sub->Plan->CreatableProductType->name == 'Private') {
|
84 |
+
$type = 'product';
|
85 |
+
} else {
|
86 |
+
$type = 'subscription';
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
if ($sk_selected_subscription == ($type . '-' . $sub->id) || !isset($selected_sub)) {
|
91 |
$selected_sub = $sub;
|
92 |
$selected = 'SELECTED';
|
93 |
} else {
|
94 |
$selected = '';
|
95 |
}
|
96 |
?>
|
97 |
+
<option <?php echo $selected ?> value='<?php echo (isset($sub->Plan->CreatableProductType->name) && $sub->Plan->CreatableProductType->name == 'Private') ? "product-" : "subscription-"; echo $sub->id ?>'><?php echo $sub->Plan->name . ' - ' . $sub->CurrentTier->name ?></option>
|
98 |
<?php endforeach ?>
|
99 |
<?php if (!isset($selected_sub)): ?>
|
100 |
<option value='0'>No Compatible Subscriptions</option>
|
105 |
</select>
|
106 |
</td>
|
107 |
</tr>
|
108 |
+
<?php if (isset($sk_subs['products'])): ?>
|
109 |
+
|
110 |
+
<tr valign="top" style='display: none' class='walkthrough_group'>
|
111 |
+
<th scope="row" valign="top">Walkthrough Group</th>
|
112 |
+
<td>
|
113 |
+
<select name='sk_selected_product'>
|
114 |
+
<?php if (isset($sk_subs['products']) && count($sk_subs['products']) > 0): ?>
|
115 |
+
<?php foreach ($sk_subs['products'] as $key => $product): ?>
|
116 |
+
<option <?php echo ($sk_selected_product == $product->id) ? 'SELECTED' : '' ?> value='<?php echo $product->id ?>'><?php echo $product->name ?></option>
|
117 |
+
<?php endforeach ?>
|
118 |
+
<?php else: ?>
|
119 |
+
<option style='color: red'>You must build at least one walkthrough</option>
|
120 |
+
<?php endif ?>
|
121 |
+
</select>
|
122 |
+
</td>
|
123 |
+
</tr>
|
124 |
+
|
125 |
+
<?php endif ?>
|
126 |
+
|
127 |
<tr valign="top">
|
128 |
<th scope="row" valign="top">Enable Auto-Activations</th>
|
129 |
<td>
|
134 |
<?php endif ?>
|
135 |
</td>
|
136 |
</tr>
|
137 |
+
<?php //var_dump($selected_sub); ?>
|
138 |
<?php if (isset($selected_sub)): ?>
|
139 |
<tr>
|
140 |
<th scope="row" valign="top">Active Domains</th>
|
240 |
|
241 |
</div>
|
242 |
|
243 |
+
<!-- //ms_admin_page.php -->
|
244 |
|
245 |
|
libs/sk_config_data.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
class sk_config_data{
|
4 |
function get_domain(){
|
@@ -137,48 +138,37 @@ class sk_config_data{
|
|
137 |
}
|
138 |
|
139 |
function get_disabled_network_wts(){
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
|
|
144 |
}
|
145 |
return 'false';
|
146 |
}
|
147 |
|
148 |
function get_plugins(){
|
149 |
-
$active_plugins = wp_get_active_and_valid_plugins();
|
150 |
-
$mu_plugins = get_mu_plugins();
|
151 |
|
152 |
-
$
|
153 |
-
|
154 |
-
$output
|
155 |
-
$count = 0;
|
156 |
|
157 |
if (is_array($active_plugins)) {
|
158 |
foreach ($active_plugins as $plugins_key => $plugin) {
|
159 |
-
$data
|
160 |
-
|
161 |
-
$
|
162 |
-
|
163 |
-
$data['Name'] = addslashes($data['Name']);
|
164 |
-
$output .= "{'{$data['Name']}' : '{$data['Version']}'}";
|
165 |
-
$printed = true;
|
166 |
-
$count++;
|
167 |
}
|
168 |
}
|
169 |
|
170 |
if (is_array($mu_plugins)) {
|
171 |
foreach ($mu_plugins as $plugins_key => $plugin) {
|
172 |
-
$
|
173 |
-
|
174 |
-
$plugin['Name'] = addslashes($plugin['Name']);
|
175 |
-
$output .= "{'{$plugin['Name']}' : '{$plugin['Version']}'}";
|
176 |
-
$printed = true;
|
177 |
-
$count++;
|
178 |
}
|
179 |
}
|
180 |
-
$output
|
181 |
-
return array('plugins' => $output, 'count' => $count);
|
182 |
}
|
183 |
|
184 |
function get_user_role(){
|
@@ -202,4 +192,6 @@ class sk_config_data{
|
|
202 |
}
|
203 |
return $user_role;
|
204 |
}
|
205 |
-
}
|
|
|
|
1 |
<?php
|
2 |
+
// sk_config_data.php
|
3 |
|
4 |
class sk_config_data{
|
5 |
function get_domain(){
|
138 |
}
|
139 |
|
140 |
function get_disabled_network_wts(){
|
141 |
+
if (is_multisite()) {
|
142 |
+
$wts = str_replace('"', '', get_site_option('sk_disabled_wts'));
|
143 |
+
if ($wts) {
|
144 |
+
return $wts;
|
145 |
+
}
|
146 |
}
|
147 |
return 'false';
|
148 |
}
|
149 |
|
150 |
function get_plugins(){
|
|
|
|
|
151 |
|
152 |
+
$active_plugins = wp_get_active_and_valid_plugins();
|
153 |
+
$mu_plugins = get_mu_plugins();
|
154 |
+
$output = array();
|
|
|
155 |
|
156 |
if (is_array($active_plugins)) {
|
157 |
foreach ($active_plugins as $plugins_key => $plugin) {
|
158 |
+
$data = get_plugin_data( $plugin, false, false );
|
159 |
+
$slug = explode('/',plugin_basename($plugin));
|
160 |
+
$slug = str_replace('.php', '', $slug[1]);
|
161 |
+
$output[$slug] = $data['Version'];
|
|
|
|
|
|
|
|
|
162 |
}
|
163 |
}
|
164 |
|
165 |
if (is_array($mu_plugins)) {
|
166 |
foreach ($mu_plugins as $plugins_key => $plugin) {
|
167 |
+
$slug = str_replace('.php', '', $plugins_key);
|
168 |
+
$output[$slug] = $data['Version'];
|
|
|
|
|
|
|
|
|
169 |
}
|
170 |
}
|
171 |
+
return $output;
|
|
|
172 |
}
|
173 |
|
174 |
function get_user_role(){
|
192 |
}
|
193 |
return $user_role;
|
194 |
}
|
195 |
+
}
|
196 |
+
|
197 |
+
// //sk_config_data.php
|
libs/walkthrough_config.php
CHANGED
@@ -19,9 +19,11 @@
|
|
19 |
|
20 |
<div class="sk_box configure">
|
21 |
<div class="well">
|
22 |
-
<h3>Configure - Turn Off Walkthroughs</h3>
|
23 |
-
|
24 |
<form method='post'>
|
|
|
|
|
|
|
|
|
25 |
<p>Below you can turn off specific Walkthroughs for this website.</p>
|
26 |
<p>Please note, incompatible multisite walkthroughs will be disabled automatically on individual sites already. Here you're being show the raw unfiltered list of all available walkthroughs.</p>
|
27 |
<div class='sk_walkthrough_list wrapper_wts'>
|
19 |
|
20 |
<div class="sk_box configure">
|
21 |
<div class="well">
|
|
|
|
|
22 |
<form method='post'>
|
23 |
+
|
24 |
+
<input class='top-right button button-primary alignright' type='submit' value='Save'/>
|
25 |
+
<h3>Configure - Turn Off Walkthroughs</h3>
|
26 |
+
|
27 |
<p>Below you can turn off specific Walkthroughs for this website.</p>
|
28 |
<p>Please note, incompatible multisite walkthroughs will be disabled automatically on individual sites already. Here you're being show the raw unfiltered list of all available walkthroughs.</p>
|
29 |
<div class='sk_walkthrough_list wrapper_wts'>
|
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.1
|
7 |
-
Stable tag: 2.
|
8 |
License: GNU Version 2 or Any Later Version
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -130,7 +130,12 @@ Absolutely. In fact, we rely on users like you to tell us about things that nee
|
|
130 |
|
131 |
== Changelog ==
|
132 |
|
133 |
-
= 2.
|
|
|
|
|
|
|
|
|
|
|
134 |
* Multisite Walkthrough Management Support
|
135 |
* Multisite Auto Activations
|
136 |
* Multisite Mass Activations
|
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.1
|
7 |
+
Stable tag: 2.1.1
|
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 |
+
= 2.1.1 =
|
134 |
+
* Added SIDEKICK version check
|
135 |
+
* Fixes issues with saving autostart walkthroughs
|
136 |
+
* Fixes issues with disabling walkthroughs
|
137 |
+
|
138 |
+
= 2.1.0 =
|
139 |
* Multisite Walkthrough Management Support
|
140 |
* Multisite Auto Activations
|
141 |
* Multisite Mass Activations
|
sidekick.php
CHANGED
@@ -6,17 +6,19 @@ 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.8
|
8 |
Tested up to: 4.0
|
9 |
-
Version: 2.
|
10 |
Author: Sidekick.pro
|
11 |
Author URI: http://www.sidekick.pro
|
12 |
*/
|
13 |
|
14 |
|
15 |
-
if ( ! defined( '
|
16 |
-
if ( ! defined( '
|
17 |
-
if ( ! defined( '
|
18 |
-
if ( ! defined( '
|
19 |
-
if ( ! defined( '
|
|
|
|
|
20 |
if ( ! defined( 'SK_SL_PLUGIN_FILE' ) ) define( 'SK_SL_PLUGIN_FILE', __FILE__ );
|
21 |
if ( ! function_exists('mlog')) {
|
22 |
function mlog(){}
|
@@ -25,12 +27,12 @@ if ( ! function_exists('mlog')) {
|
|
25 |
class Sidekick{
|
26 |
|
27 |
function __construct(){
|
28 |
-
if (!defined('SK_TRACKING_API'))
|
29 |
-
if (!defined('SK_COMPOSER_API'))
|
30 |
-
if (!defined('SK_API'))
|
31 |
-
if (!defined('SK_LIBRARY'))
|
32 |
-
if (!defined('SK_ASSETS'))
|
33 |
-
if (!defined('SK_AUDIO'))
|
34 |
}
|
35 |
|
36 |
function enqueue_required(){
|
@@ -46,16 +48,8 @@ class Sidekick{
|
|
46 |
wp_enqueue_script('sidekick-admin' ,plugins_url( '/js/sidekick_admin.js' , __FILE__ ),array( 'jquery' ));
|
47 |
}
|
48 |
|
49 |
-
function is_https() {
|
50 |
-
if ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443 || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) {
|
51 |
-
return true;
|
52 |
-
} else {
|
53 |
-
return false;
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
function enqueue(){
|
58 |
-
wp_enqueue_script('sidekick' ,"//
|
59 |
wp_enqueue_style('wp-pointer');
|
60 |
wp_enqueue_script('wp-pointer');
|
61 |
}
|
@@ -99,11 +93,6 @@ class Sidekick{
|
|
99 |
die('<script>window.open("' . get_site_url() . '/wp-admin/options-general.php?page=sidekick","_self")</script>');
|
100 |
}
|
101 |
|
102 |
-
if (isset($_POST['sk_api'])) {
|
103 |
-
update_option( 'sk_api', $_POST['sk_api'] );
|
104 |
-
} else {
|
105 |
-
delete_option('sk_api');
|
106 |
-
}
|
107 |
}
|
108 |
|
109 |
$activation_id = (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : '');
|
@@ -151,20 +140,35 @@ class Sidekick{
|
|
151 |
function set_disabled_wts(){
|
152 |
if (isset($_POST['disable_wts']) && $_POST['disable_wts']) {
|
153 |
update_option('sk_disabled_wts',json_encode($_POST['disable_wts']));
|
154 |
-
|
|
|
|
|
155 |
} else {
|
156 |
delete_option('sk_disabled_wts');
|
157 |
-
|
|
|
|
|
158 |
}
|
159 |
}
|
160 |
|
161 |
function set_autostart_wt(){
|
162 |
if (isset($_POST['sk_autostart_walkthrough_id']) && intval($_POST['sk_autostart_walkthrough_id']) > 0){
|
|
|
|
|
|
|
163 |
update_option('sk_autostart_walkthrough_id',$_POST['sk_autostart_walkthrough_id']);
|
164 |
-
update_site_option('sk_autostart_walkthrough_id',$_POST['sk_autostart_walkthrough_id']);
|
165 |
} else {
|
166 |
delete_option('sk_autostart_walkthrough_id');
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
}
|
169 |
}
|
170 |
|
@@ -189,10 +193,11 @@ class Sidekick{
|
|
189 |
$user_email = $current_user->user_email;
|
190 |
}
|
191 |
|
|
|
192 |
$user_role = $sk_config_data->get_user_role();
|
193 |
$site_url = $sk_config_data->get_domain();
|
194 |
-
$
|
195 |
-
$
|
196 |
$disabled_network_wts = $sk_config_data->get_disabled_network_wts();
|
197 |
$current_url = $sk_config_data->get_current_url();
|
198 |
$post_types = $sk_config_data->get_post_types();
|
@@ -204,23 +209,18 @@ class Sidekick{
|
|
204 |
$number_of_themes = $sk_config_data->get_themes();
|
205 |
$frameworks = $sk_config_data->get_framework();
|
206 |
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
$installed_plugins = $plugin_data['plugins'];
|
211 |
-
$plugin_count = $plugin_data['count'];
|
212 |
-
|
213 |
-
// $sk_composer_button = true; // BETA
|
214 |
-
|
215 |
delete_option( 'sk_just_activated' );
|
216 |
if(preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])) $not_supported_ie = true;
|
217 |
|
218 |
?>
|
219 |
|
|
|
220 |
<?php if (!$not_supported_ie): ?>
|
221 |
|
222 |
<script type="text/javascript">
|
223 |
|
|
|
|
|
224 |
var sk_config = {
|
225 |
// Compatibility
|
226 |
|
@@ -232,8 +232,8 @@ class Sidekick{
|
|
232 |
<?php echo $post_statuses ?>
|
233 |
<?php echo $frameworks ?>
|
234 |
<?php echo $post_types_and_statuses ?>
|
235 |
-
installed_plugins: <?php echo $installed_plugins ?>,
|
236 |
-
plugin_count: <?php echo $plugin_count ?>,
|
237 |
is_multisite: <?php echo (is_multisite()) ? "true" : "false" ?>,
|
238 |
number_of_themes: <?php echo $number_of_themes ?>,
|
239 |
installed_theme: '<?php echo $theme->Name ?>',
|
@@ -275,7 +275,7 @@ class Sidekick{
|
|
275 |
// Generic Info
|
276 |
just_activated: <?php echo ($sk_just_activated) ? "true" : "false" ?>,
|
277 |
platform_version: null,
|
278 |
-
plugin_version: '2.
|
279 |
show_login: <?php echo ($sk_just_activated) ? "true" : "false" ?>,
|
280 |
|
281 |
// SIDEKICK URLS
|
@@ -289,24 +289,24 @@ class Sidekick{
|
|
289 |
// URLS
|
290 |
site_url: '<?php echo $site_url ?>',
|
291 |
domain: '<?php echo str_replace("http://","",$_SERVER["SERVER_NAME"]) ?>',
|
292 |
-
domain_used: '
|
293 |
plugin_url: '<?php echo admin_url("admin.php?page=sidekick") ?>',
|
294 |
base_url: '<?php echo site_url() ?>',
|
295 |
-
current_url: '<?php echo $current_url ?>'
|
296 |
// fallback_notfication_mp3: '//assets.sidekick.pro/fallback.mp3'
|
297 |
}
|
298 |
|
299 |
var skc_config = {
|
300 |
-
|
301 |
-
|
302 |
apiUrl: '<?php echo SK_COMPOSER_API ?>',
|
|
|
|
|
|
|
303 |
baseSiteUrl: sk_config.base_url,
|
304 |
platformId: 1,
|
305 |
compatibilities: sk_config.compatibilities,
|
306 |
-
|
307 |
-
audioPlaceholderUrl: '//assets.sidekick.pro/walkthrough-audio-placeholder.mp3',
|
308 |
-
siteAjaxUrl: window.ajaxurl || '',
|
309 |
-
trackingUrl: '//tracking.sidekick.pro/'
|
310 |
}
|
311 |
|
312 |
</script>
|
@@ -366,6 +366,29 @@ class Sidekick{
|
|
366 |
}
|
367 |
}
|
368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
function admin_notice() {
|
370 |
global $current_user ;
|
371 |
|
@@ -410,6 +433,12 @@ $sidekick = new Sidekick;
|
|
410 |
register_activation_hook( __FILE__, array($sidekick,'activate_plugin') );
|
411 |
register_deactivation_hook( __FILE__, array($sidekick,'deactivate_plugin') );
|
412 |
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
add_action('admin_menu', array($sidekick,'setup_menu'));
|
414 |
add_action('admin_init', array($sidekick,'redirect'));
|
415 |
add_action('wp_ajax_sk_activate', array($sidekick,'activate'));
|
@@ -417,12 +446,6 @@ add_action('wp_ajax_sk_save', array($sidekick,'ajax_save'));
|
|
417 |
add_action('admin_notices', array($sidekick,'admin_notice'));
|
418 |
add_action('admin_init', array($sidekick,'admin_notice_ignore'));
|
419 |
|
420 |
-
if (isset($_POST['sk_setting_disabled'])) {
|
421 |
-
$sidekick->set_disabled_wts();
|
422 |
-
}
|
423 |
-
if (isset($_POST['sk_setting_autostart'])) {
|
424 |
-
$sidekick->set_autostart_wt();
|
425 |
-
}
|
426 |
|
427 |
|
428 |
if (!defined('SK_PLUGIN_DEGBUG'))
|
6 |
Description: Adds a real-time WordPress training walkthroughs right in your Dashboard
|
7 |
Requires at least: 3.8
|
8 |
Tested up to: 4.0
|
9 |
+
Version: 2.1.1
|
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_SL_PLUGIN_DIR' ) ) define( 'SK_SL_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
21 |
+
if ( ! defined( 'SK_SL_PLUGIN_URL' ) ) define( 'SK_SL_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
22 |
if ( ! defined( 'SK_SL_PLUGIN_FILE' ) ) define( 'SK_SL_PLUGIN_FILE', __FILE__ );
|
23 |
if ( ! function_exists('mlog')) {
|
24 |
function mlog(){}
|
27 |
class Sidekick{
|
28 |
|
29 |
function __construct(){
|
30 |
+
if (!defined('SK_TRACKING_API')) define('SK_TRACKING_API','//tracking.sidekick.pro/');
|
31 |
+
if (!defined('SK_COMPOSER_API')) define('SK_COMPOSER_API','//apiv2.sidekick.pro');
|
32 |
+
if (!defined('SK_API')) define('SK_API','//apiv2.sidekick.pro/');
|
33 |
+
if (!defined('SK_LIBRARY')) define('SK_LIBRARY','//librarycache.sidekick.pro/');
|
34 |
+
if (!defined('SK_ASSETS')) define('SK_ASSETS','//assets.sidekick.pro/');
|
35 |
+
if (!defined('SK_AUDIO')) define('SK_AUDIO','//audio.sidekick.pro/');
|
36 |
}
|
37 |
|
38 |
function enqueue_required(){
|
48 |
wp_enqueue_script('sidekick-admin' ,plugins_url( '/js/sidekick_admin.js' , __FILE__ ),array( 'jquery' ));
|
49 |
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
function enqueue(){
|
52 |
+
wp_enqueue_script('sidekick' ,"//" . PLAYER_DOMAIN ."/" . PLAYER_PATH . "/" . PLAYER_FILE, array('backbone','jquery','underscore','jquery-effects-highlight'),null);
|
53 |
wp_enqueue_style('wp-pointer');
|
54 |
wp_enqueue_script('wp-pointer');
|
55 |
}
|
93 |
die('<script>window.open("' . get_site_url() . '/wp-admin/options-general.php?page=sidekick","_self")</script>');
|
94 |
}
|
95 |
|
|
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
|
98 |
$activation_id = (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : '');
|
140 |
function set_disabled_wts(){
|
141 |
if (isset($_POST['disable_wts']) && $_POST['disable_wts']) {
|
142 |
update_option('sk_disabled_wts',json_encode($_POST['disable_wts']));
|
143 |
+
if (is_network_admin()) {
|
144 |
+
update_site_option('sk_disabled_wts',json_encode($_POST['disable_wts']));
|
145 |
+
}
|
146 |
} else {
|
147 |
delete_option('sk_disabled_wts');
|
148 |
+
if (is_network_admin()) {
|
149 |
+
delete_site_option('sk_disabled_wts');
|
150 |
+
}
|
151 |
}
|
152 |
}
|
153 |
|
154 |
function set_autostart_wt(){
|
155 |
if (isset($_POST['sk_autostart_walkthrough_id']) && intval($_POST['sk_autostart_walkthrough_id']) > 0){
|
156 |
+
if (is_network_admin()) {
|
157 |
+
update_site_option('sk_autostart_walkthrough_id',$_POST['sk_autostart_walkthrough_id']);
|
158 |
+
}
|
159 |
update_option('sk_autostart_walkthrough_id',$_POST['sk_autostart_walkthrough_id']);
|
|
|
160 |
} else {
|
161 |
delete_option('sk_autostart_walkthrough_id');
|
162 |
+
if (is_network_admin()) {
|
163 |
+
delete_site_option('sk_autostart_walkthrough_id');
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
function set_api(){
|
169 |
+
if (isset($_POST['sk_api'])){
|
170 |
+
update_option('sk_api',$_POST['sk_api']);
|
171 |
+
update_site_option('sk_api',$_POST['sk_api']);
|
172 |
}
|
173 |
}
|
174 |
|
193 |
$user_email = $current_user->user_email;
|
194 |
}
|
195 |
|
196 |
+
$disabled_wts = (!is_network_admin()) ? $sk_config_data->get_disabled_wts() : '[]';
|
197 |
$user_role = $sk_config_data->get_user_role();
|
198 |
$site_url = $sk_config_data->get_domain();
|
199 |
+
$installed_plugins = $sk_config_data->get_plugins();
|
200 |
+
$plugin_count = (isset($plugins) && is_array($plugins)) ? count($plugins) : array();
|
201 |
$disabled_network_wts = $sk_config_data->get_disabled_network_wts();
|
202 |
$current_url = $sk_config_data->get_current_url();
|
203 |
$post_types = $sk_config_data->get_post_types();
|
209 |
$number_of_themes = $sk_config_data->get_themes();
|
210 |
$frameworks = $sk_config_data->get_framework();
|
211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
delete_option( 'sk_just_activated' );
|
213 |
if(preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])) $not_supported_ie = true;
|
214 |
|
215 |
?>
|
216 |
|
217 |
+
|
218 |
<?php if (!$not_supported_ie): ?>
|
219 |
|
220 |
<script type="text/javascript">
|
221 |
|
222 |
+
<?php if (is_network_admin()): ?>var is_network_admin = true; <?php endif ?>
|
223 |
+
|
224 |
var sk_config = {
|
225 |
// Compatibility
|
226 |
|
232 |
<?php echo $post_statuses ?>
|
233 |
<?php echo $frameworks ?>
|
234 |
<?php echo $post_types_and_statuses ?>
|
235 |
+
installed_plugins: <?php echo json_encode($installed_plugins) ?>,
|
236 |
+
plugin_count: <?php echo ($plugin_count) ? $plugin_count : 0 ?>,
|
237 |
is_multisite: <?php echo (is_multisite()) ? "true" : "false" ?>,
|
238 |
number_of_themes: <?php echo $number_of_themes ?>,
|
239 |
installed_theme: '<?php echo $theme->Name ?>',
|
275 |
// Generic Info
|
276 |
just_activated: <?php echo ($sk_just_activated) ? "true" : "false" ?>,
|
277 |
platform_version: null,
|
278 |
+
plugin_version: '2.1.1',
|
279 |
show_login: <?php echo ($sk_just_activated) ? "true" : "false" ?>,
|
280 |
|
281 |
// SIDEKICK URLS
|
289 |
// URLS
|
290 |
site_url: '<?php echo $site_url ?>',
|
291 |
domain: '<?php echo str_replace("http://","",$_SERVER["SERVER_NAME"]) ?>',
|
292 |
+
domain_used: '//<?php echo PLAYER_DOMAIN ?>/',
|
293 |
plugin_url: '<?php echo admin_url("admin.php?page=sidekick") ?>',
|
294 |
base_url: '<?php echo site_url() ?>',
|
295 |
+
current_url: '<?php echo $current_url ?>'
|
296 |
// fallback_notfication_mp3: '//assets.sidekick.pro/fallback.mp3'
|
297 |
}
|
298 |
|
299 |
var skc_config = {
|
300 |
+
audioPlaceholderUrl: '<?php echo SK_ASSETS ?>/walkthrough-audio-placeholder.mp3',
|
301 |
+
audioBaseUrl: '<?php echo SK_AUDIO ?>',
|
302 |
apiUrl: '<?php echo SK_COMPOSER_API ?>',
|
303 |
+
trackingUrl: '<?php echo SK_TRACKING_API ?>',
|
304 |
+
js: '//<?php echo COMPOSER_DOMAIN ?>/<?php echo COMPOSER_PATH ?>/sidekick-composer.js',
|
305 |
+
css: '//<?php echo COMPOSER_DOMAIN ?>/<?php echo COMPOSER_PATH ?>/sidekick-composer.css',
|
306 |
baseSiteUrl: sk_config.base_url,
|
307 |
platformId: 1,
|
308 |
compatibilities: sk_config.compatibilities,
|
309 |
+
siteAjaxUrl: window.ajaxurl || ''
|
|
|
|
|
|
|
310 |
}
|
311 |
|
312 |
</script>
|
366 |
}
|
367 |
}
|
368 |
|
369 |
+
function check_ver(){
|
370 |
+
|
371 |
+
$data = json_encode('2.1.1');
|
372 |
+
|
373 |
+
if(array_key_exists('callback', $_GET)){
|
374 |
+
|
375 |
+
header('Content-Type: text/javascript; charset=utf8');
|
376 |
+
header('Access-Control-Allow-Origin: http://www.example.com/');
|
377 |
+
header('Access-Control-Max-Age: 3628800');
|
378 |
+
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
|
379 |
+
|
380 |
+
$callback = $_GET['callback'];
|
381 |
+
echo $callback.'('.$data.');';
|
382 |
+
|
383 |
+
}else{
|
384 |
+
header('Content-Type: application/json; charset=utf8');
|
385 |
+
|
386 |
+
echo $data;
|
387 |
+
}
|
388 |
+
|
389 |
+
die();
|
390 |
+
}
|
391 |
+
|
392 |
function admin_notice() {
|
393 |
global $current_user ;
|
394 |
|
433 |
register_activation_hook( __FILE__, array($sidekick,'activate_plugin') );
|
434 |
register_deactivation_hook( __FILE__, array($sidekick,'deactivate_plugin') );
|
435 |
|
436 |
+
if (isset($_POST['sk_setting_disabled'])) $sidekick->set_disabled_wts();
|
437 |
+
if (isset($_POST['sk_setting_autostart'])) $sidekick->set_autostart_wt();
|
438 |
+
if (isset($_POST['sk_api'])) $sidekick->set_api();
|
439 |
+
if (isset($_GET['sk_ver_check'])) $sidekick->check_ver();
|
440 |
+
|
441 |
+
|
442 |
add_action('admin_menu', array($sidekick,'setup_menu'));
|
443 |
add_action('admin_init', array($sidekick,'redirect'));
|
444 |
add_action('wp_ajax_sk_activate', array($sidekick,'activate'));
|
446 |
add_action('admin_notices', array($sidekick,'admin_notice'));
|
447 |
add_action('admin_init', array($sidekick,'admin_notice_ignore'));
|
448 |
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
|
450 |
|
451 |
if (!defined('SK_PLUGIN_DEGBUG'))
|