Version Description
- Multisite Walkthrough Management Support
- Multisite Auto Activations
- Multisite Mass Activations
- Genesis Framework Support
- Fixes issues with composer mode and auto play of walkthroughs
- Fixes issues with select all walkthroughs in settings screen
- Fixes issues with download of file would resume a walkthrough on click event
- Fixes issues playing back hotspots in certain cases
Download this release
Release Info
Developer | raptor235 |
Plugin | Sidekick |
Version | 2.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.6.18 to 2.0.1
- assets/banner-772x250.png +0 -0
- assets/icon-128x128.png +0 -0
- assets/screenshot-1.png +0 -0
- assets/screenshot-2.png +0 -0
- assets/screenshot-3.png +0 -0
- assets/screenshot-4.png +0 -0
- libs/admin_page.php +170 -0
- libs/licensing.php +238 -0
- libs/ms_admin_page.php +217 -0
- libs/sk_config_data.php +205 -0
- libs/walkthrough_config.php +36 -0
- readme.txt +280 -0
- sidekick.php +446 -0
assets/banner-772x250.png
ADDED
Binary file
|
assets/icon-128x128.png
ADDED
Binary file
|
assets/screenshot-1.png
ADDED
Binary file
|
assets/screenshot-2.png
ADDED
Binary file
|
assets/screenshot-3.png
ADDED
Binary file
|
assets/screenshot-4.png
ADDED
Binary file
|
libs/admin_page.php
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script type="text/javascript">
|
2 |
+
if (typeof ajax_url === 'undefined') {
|
3 |
+
ajax_url = '<?php echo admin_url() ?>admin-ajax.php';
|
4 |
+
}
|
5 |
+
var last_site_key = null;
|
6 |
+
var sk_ms_admin = false;
|
7 |
+
</script>
|
8 |
+
|
9 |
+
<div class="page-header"><h2><a id="pluginlogo_32" class="header-icon32" href="http://www.sidekick.pro/modules/wordpress-core-module-premium/?utm_source=plugin&utm_medium=settings&utm_campaign=header" target="_blank"></a>Sidekick Dashboard</h2></div>
|
10 |
+
|
11 |
+
<h3>Welcome to the fastest and easiest way to learn WordPress</h3>
|
12 |
+
|
13 |
+
<?php if (isset($error_message) && $error_message): ?>
|
14 |
+
<div class="error" id="sk_dashboard_message">
|
15 |
+
<p>There was a problem activating your license. The following error occured <?php echo $error_message ?></p>
|
16 |
+
</div>
|
17 |
+
<?php elseif (isset($error) && $error): ?>
|
18 |
+
<div class="error" id="sk_dashboard_message">
|
19 |
+
<p><?php echo $error ?></p>
|
20 |
+
</div>
|
21 |
+
<?php elseif (isset($warn) && $warn): ?>
|
22 |
+
<div class="updated" id="sk_dashboard_message">
|
23 |
+
<p><?php echo $warn ?></p>
|
24 |
+
</div>
|
25 |
+
<?php elseif (isset($success) && $success): ?>
|
26 |
+
<div class="updated" id="sk_dashboard_message">
|
27 |
+
<p><?php echo $success ?></p>
|
28 |
+
</div>
|
29 |
+
<?php endif ?>
|
30 |
+
|
31 |
+
<div class="sidekick_admin">
|
32 |
+
|
33 |
+
<div class="sk_box left">
|
34 |
+
<div class="wrapper_left">
|
35 |
+
<div class="sk_box license">
|
36 |
+
<div class="well">
|
37 |
+
<?php if (!$error): ?>
|
38 |
+
<h3>My Sidekick Account</h3>
|
39 |
+
<form method="post">
|
40 |
+
<?php settings_fields('sk_license'); ?>
|
41 |
+
<table class="form-table">
|
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: ?>
|
49 |
+
<td><input class='regular-text' style='color: gray;' type='text' name='activation_id' ></input></td>
|
50 |
+
<?php endif ?>
|
51 |
+
<?php else: ?>
|
52 |
+
<td><input class='regular-text' type='text' name='activation_id' value='<?php echo $activation_id ?>'></input></td>
|
53 |
+
<?php endif ?>
|
54 |
+
</tr>
|
55 |
+
|
56 |
+
<tr valign="top">
|
57 |
+
<th scope="row" valign="top">Status</th>
|
58 |
+
<td><span style='color: blue' class='sk_license_status'><span><?php echo ucfirst($status) ?></span> <a style='display: none' class='sk_upgrade' href='http://www.sidekick.pro/modules/wordpress-core-module-premium/?utm_source=plugin&utm_medium=settings&utm_campaign=upgrade' target="_blank"> Upgrade Now!</a> </span></td>
|
59 |
+
</tr>
|
60 |
+
|
61 |
+
<tr valign="top">
|
62 |
+
<th scope="row" valign="top">
|
63 |
+
Data Tracking
|
64 |
+
</th>
|
65 |
+
<td>
|
66 |
+
<input name="sk_track_data" type="checkbox" <?php if ($sk_track_data): ?>CHECKED<?php endif ?> />
|
67 |
+
<input type='hidden' name='status' value='<?php echo $status ?>'/>
|
68 |
+
<label class="description" for="track_data">Help Sidekick by providing tracking data which will help us build better help tools.</label>
|
69 |
+
</td>
|
70 |
+
</tr>
|
71 |
+
|
72 |
+
<tr valign="top" style='display: none'>
|
73 |
+
<th scope="row" valign="top">
|
74 |
+
Enable Composer Mode
|
75 |
+
</th>
|
76 |
+
<td>
|
77 |
+
<input name="sk_composer_button" type="checkbox" <?php if (get_option('sk_composer_button')): ?>CHECKED<?php endif ?> />
|
78 |
+
<label class="description" for="track_data">Enable Walkthrough creation.</label>
|
79 |
+
</td>
|
80 |
+
</tr>
|
81 |
+
</tbody>
|
82 |
+
</table>
|
83 |
+
<?php submit_button('Update'); ?>
|
84 |
+
<?php wp_nonce_field( 'update_sk_settings' ); ?>
|
85 |
+
</form>
|
86 |
+
<?php endif ?>
|
87 |
+
</div>
|
88 |
+
</div>
|
89 |
+
|
90 |
+
<div class="sk_box composer">
|
91 |
+
<div class="well">
|
92 |
+
<h3>Build Your Own Walkthroughs</h3>
|
93 |
+
<a href='http://www.sidekick.pro/plans/create_wp_walkthroughs/?utm_source=plugin&utm_medium=settings&utm_campaign=composer' target='_blank'><div class='composer_beta_button'>Build Your Own<br/>Walkthroughs</div></a>
|
94 |
+
<ul>
|
95 |
+
<li>Get more info about <a href='http://www.sidekick.pro/how-it-works/?utm_source=plugin&utm_medium=settings&utm_campaign=composer' target='_blank'>Custom Walkthroughs</a> now!</li>
|
96 |
+
<li><a href="http://www.sidekick.pro/plans/create_wp_walkthroughs/?utm_source=plugin&utm_medium=settings&utm_campaign=composer" target="_blank">Check out our custom walkthroughs plans</a></li>
|
97 |
+
</ul>
|
98 |
+
</div>
|
99 |
+
</div>
|
100 |
+
|
101 |
+
<div class="sk_box you_should_know">
|
102 |
+
<div class="well">
|
103 |
+
<h3>Few Things you should know:</h3>
|
104 |
+
<div class="">
|
105 |
+
<ul>
|
106 |
+
<li>Clicking the check-box above will allow us to link your email address to the stats we collect so we can contact you if we have a question or notice an issue. It’s not mandatory, but it would help us out.</li>
|
107 |
+
<li>Your Activation ID is unique and limited to your production, staging, and development urls.</li>
|
108 |
+
<li>The Sidekick team adheres strictly to CANSPAM. From time to time we may send critical updates (such as security notices) to the email address setup as the Administrator on this site.</li>
|
109 |
+
<li>If you have any questions, bug reports or feedback, please send them to <a target="_blank" href="mailto:support@sidekick.pro">us</a> </li>
|
110 |
+
<li>You can find our terms of use <a target="_blank" href="http://www.sidekick.pro/terms-of-use/">here</a></li>
|
111 |
+
</ul>
|
112 |
+
</div>
|
113 |
+
</div>
|
114 |
+
</div>
|
115 |
+
|
116 |
+
<div class="sk_box advanced">
|
117 |
+
<div class="well">
|
118 |
+
<h3>Advanced</h3>
|
119 |
+
<form method="post">
|
120 |
+
<table class="form-table">
|
121 |
+
<tbody>
|
122 |
+
<tr valign="top">
|
123 |
+
<th scope="row" valign="top">API</th>
|
124 |
+
<td>
|
125 |
+
<select name='sk_api'>
|
126 |
+
<?php if (get_option('sk_api') == 'production'): ?>
|
127 |
+
<option value='production' SELECTED>Production</option>
|
128 |
+
<option value='staging'>Staging</option>
|
129 |
+
<?php else: ?>
|
130 |
+
<option value='production' >Production</option>
|
131 |
+
<option value='staging' SELECTED>Staging</option>
|
132 |
+
<?php endif ?>
|
133 |
+
</select>
|
134 |
+
</td>
|
135 |
+
</tr>
|
136 |
+
</tbody>
|
137 |
+
</table>
|
138 |
+
|
139 |
+
<?php wp_nonce_field( 'update_sk_settings' ); ?>
|
140 |
+
<input class='button button-primary' type='submit' value='Save'/>
|
141 |
+
</form>
|
142 |
+
|
143 |
+
</div>
|
144 |
+
</div>
|
145 |
+
|
146 |
+
</div>
|
147 |
+
</div>
|
148 |
+
|
149 |
+
<div class="sk_box right">
|
150 |
+
<div class="wrapper_right">
|
151 |
+
|
152 |
+
<?php require_once('walkthrough_config.php') ?>
|
153 |
+
|
154 |
+
<div class="sk_box love">
|
155 |
+
<div class="well">
|
156 |
+
<h3>Love the Sidekick plugin?</h3>
|
157 |
+
<ul>
|
158 |
+
<li>Please help spread the word!</li>
|
159 |
+
<li><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://sidekick.pro" data-text="I use @sidekickhelps for the fastest and easiest way to learn WordPress." data-via="sidekickhelps" data-size="large">Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></li>
|
160 |
+
<li>Like SIDEKICK? Please leave us a 5 star rating on <a href='http://WordPress.org' target='_blank'>WordPress.org</a></li>
|
161 |
+
<li><a href="http://www.sidekick.pro/plans/wordpress-basics/">Sign up for a full WordPress Basics package</a></li>
|
162 |
+
<li><a href="http://support.sidekick.pro/category/85-getting-started" target="_blank"><strong>Visit the SIDEKICK Quick Start guides</strong></a>.</li>
|
163 |
+
</ul>
|
164 |
+
</div>
|
165 |
+
</div>
|
166 |
+
</div>
|
167 |
+
</div>
|
168 |
+
|
169 |
+
|
170 |
+
|
libs/licensing.php
ADDED
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class sidekickMassActivator{
|
4 |
+
|
5 |
+
function activate($blog_id, $user_id, $domain, $path){
|
6 |
+
// mlog('FUNCTION: activate');
|
7 |
+
|
8 |
+
$sk_auto_activations = get_option( 'sk_auto_activations');
|
9 |
+
|
10 |
+
if ($sk_auto_activations) {
|
11 |
+
|
12 |
+
$user = get_user_by('id',$user_id);
|
13 |
+
$email = ($user) ? $user->user_email : 'unknown';
|
14 |
+
|
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',array('domainName' => $domain . $path, 'subscriptionId' => $sk_selected_subscription));
|
20 |
+
|
21 |
+
if (isset($result->success) && $result->success == true && $result->payload->domainKey) {
|
22 |
+
|
23 |
+
if (!get_option('sk_activation_id')) {
|
24 |
+
// Use the first site's activation key for the network key
|
25 |
+
update_option('sk_activation_id',$result->payload->domainKey);
|
26 |
+
}
|
27 |
+
|
28 |
+
switch_to_blog($blog_id);
|
29 |
+
update_option('sk_activation_id',$result->payload->domainKey);
|
30 |
+
update_option('sk_email',$email);
|
31 |
+
restore_current_blog();
|
32 |
+
|
33 |
+
delete_option('sk_auto_activation_error');
|
34 |
+
} else {
|
35 |
+
update_option('sk_auto_activation_error',$result->message);
|
36 |
+
wp_mail( 'support@sidekick.pro', 'Failed Mass Domain Add', json_encode($result));
|
37 |
+
}
|
38 |
+
return $result;
|
39 |
+
}
|
40 |
+
return false;
|
41 |
+
}
|
42 |
+
|
43 |
+
function activate_single(){
|
44 |
+
die(json_encode($this->activate($_POST['blog_id'], $_POST['user_id'], $_POST['domain'], $_POST['path'])));
|
45 |
+
}
|
46 |
+
|
47 |
+
function send_request_curl($url, $post){
|
48 |
+
$ch = curl_init($url);
|
49 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
50 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
51 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
|
52 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($post));
|
53 |
+
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
54 |
+
$result = curl_exec($ch);
|
55 |
+
curl_close($ch);
|
56 |
+
return $result;
|
57 |
+
}
|
58 |
+
|
59 |
+
function send_request($type,$end_point, $data = null,$second_attempt = null){
|
60 |
+
// var_dump('send_request');
|
61 |
+
//var_dump("FUNCTION: send_request");
|
62 |
+
|
63 |
+
if (strpos($_SERVER['SERVER_PROTOCOL'], 'https') === false) {
|
64 |
+
$protocol = 'http:';
|
65 |
+
} else {
|
66 |
+
$protocol = 'https:';
|
67 |
+
}
|
68 |
+
|
69 |
+
$url = $protocol . SK_API . $end_point;
|
70 |
+
$sk_token = get_transient('sk_token');
|
71 |
+
|
72 |
+
if (!$sk_token && $end_point !== '/login') {
|
73 |
+
$this->login();
|
74 |
+
$sk_token = get_transient('sk_token');
|
75 |
+
}
|
76 |
+
|
77 |
+
$headers = array('Content-Type:application/json');
|
78 |
+
|
79 |
+
if ($sk_token && $end_point !== '/login') {
|
80 |
+
$headers[] = "Authorization: $sk_token";
|
81 |
+
}
|
82 |
+
|
83 |
+
$ch = curl_init($url);
|
84 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($type));
|
85 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
86 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
87 |
+
if ($data) {
|
88 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($data));
|
89 |
+
}
|
90 |
+
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
91 |
+
$result = curl_exec($ch);
|
92 |
+
curl_close($ch);
|
93 |
+
|
94 |
+
// echo $result;
|
95 |
+
// var_dump($url);
|
96 |
+
// var_dump($headers);
|
97 |
+
// var_dump($data);
|
98 |
+
// var_dump($result);
|
99 |
+
// die();
|
100 |
+
|
101 |
+
if ($result == 'HTTP/1.1 401 Unauthorized' && !$second_attempt) {
|
102 |
+
// var_dump('Getting rid of token and trying again');
|
103 |
+
$this->login();
|
104 |
+
delete_transient('sk_token');
|
105 |
+
$this->send_request('post',$type,$data,true);
|
106 |
+
}
|
107 |
+
|
108 |
+
return json_decode($result);
|
109 |
+
}
|
110 |
+
|
111 |
+
function setup_menu(){
|
112 |
+
add_submenu_page( 'settings.php', 'Sidekick - Licensing', 'Sidekick - Licensing', 'activate_plugins','sidekick-licensing', array(&$this,'admin_page'));
|
113 |
+
}
|
114 |
+
|
115 |
+
function login(){
|
116 |
+
global $login_error;
|
117 |
+
//var_dump("FUNCTION: login");
|
118 |
+
$email = get_option('sk_account');
|
119 |
+
$password = get_option('sk_password');
|
120 |
+
|
121 |
+
if (!$password || !$email) {
|
122 |
+
return false;
|
123 |
+
}
|
124 |
+
|
125 |
+
// mlog('$email',$email);
|
126 |
+
// mlog('$password',$password);
|
127 |
+
|
128 |
+
// $password = $e->decrypt($password, 'key');
|
129 |
+
|
130 |
+
$string = $password;
|
131 |
+
$key = 'hash';
|
132 |
+
$decrypted_password = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($password), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
|
133 |
+
|
134 |
+
$result = $this->send_request('post','/login',array('email' => $email, 'password' => $decrypted_password));
|
135 |
+
|
136 |
+
// var_dump($result);
|
137 |
+
|
138 |
+
if (!isset($result) || !$result->success) {
|
139 |
+
delete_option( 'sk_token' );
|
140 |
+
return array('error' => $result->message);
|
141 |
+
} else {
|
142 |
+
set_transient( 'sk_token', $result->payload->token->value, 24 * HOUR_IN_SECONDS );
|
143 |
+
$this->load_subscriptions($result->payload->token->value);
|
144 |
+
return array('success' => true);
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
function load_user_data(){
|
149 |
+
return $this->send_request('get','/users/');
|
150 |
+
}
|
151 |
+
|
152 |
+
function load_subscriptions(){
|
153 |
+
// var_dump('load_subscriptions');
|
154 |
+
$result = $this->send_request('get','/users/subscriptions');
|
155 |
+
// var_dump($result);
|
156 |
+
if ($result->success) {
|
157 |
+
foreach ($result->payload as &$sub) {
|
158 |
+
if ($sub->PlanId == 1) {
|
159 |
+
// Basics or Enterprise can only be used right now
|
160 |
+
update_option( 'sk_selected_subscription', $sub->id );
|
161 |
+
$current_subscription = $sub;
|
162 |
+
}
|
163 |
+
// var_dump($sub->Domains);
|
164 |
+
if (count($sub->Domains) > 0) {
|
165 |
+
foreach ($sub->Domains as &$domain) {
|
166 |
+
if (!$domain->DomainSubscription->end) {
|
167 |
+
if (isset($sub->activeDomainCount)) {
|
168 |
+
$sub->activeDomainCount++;
|
169 |
+
} else {
|
170 |
+
$sub->activeDomainCount = 1;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
}
|
174 |
+
} else {
|
175 |
+
$sub->activeDomainCount = 0;
|
176 |
+
}
|
177 |
+
|
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'];
|
196 |
+
|
197 |
+
$encrypted_password = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));
|
198 |
+
$decrypted_password = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($encrypted_password), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
|
199 |
+
|
200 |
+
update_option( 'sk_account', $_POST['sk_account'] );
|
201 |
+
update_option( 'sk_password', $encrypted_password );
|
202 |
+
$login_status = $this->login();
|
203 |
+
delete_option('sk_auto_activation_error');
|
204 |
+
} else {
|
205 |
+
update_option( 'sk_selected_subscription', $_POST['sk_selected_subscription'] );
|
206 |
+
}
|
207 |
+
|
208 |
+
if (isset($_POST['sk_auto_activations'])) {
|
209 |
+
update_option( 'sk_auto_activations', true );
|
210 |
+
} else {
|
211 |
+
delete_option( 'sk_auto_activations');
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
$sk_token = get_transient('sk_token');
|
216 |
+
if (!$sk_token) {
|
217 |
+
$login_status = $this->login();
|
218 |
+
}
|
219 |
+
$sk_subs = $this->load_subscriptions();
|
220 |
+
$user_data = $this->load_user_data();
|
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;
|
227 |
+
$fgets_url = ini_get('allow_url_fopen') ? true : false;
|
228 |
+
|
229 |
+
// var_dump($sk_subs);
|
230 |
+
|
231 |
+
if ($curl && (!$fgets || !$fgets_url)) {
|
232 |
+
$error = "Sorry, SIDEKICK MultiSite activations require <b>CURL</b> or <b>file_get_contents</b> functions enabled in PHP.";
|
233 |
+
}
|
234 |
+
|
235 |
+
include('ms_admin_page.php');
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
libs/ms_admin_page.php
ADDED
@@ -0,0 +1,217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script type="text/javascript">
|
2 |
+
if (typeof ajax_url === 'undefined') {
|
3 |
+
ajax_url = '<?php echo admin_url() ?>admin-ajax.php';
|
4 |
+
}
|
5 |
+
var last_site_key = null;
|
6 |
+
var sk_ms_admin = true;
|
7 |
+
</script>
|
8 |
+
|
9 |
+
<div class="page-header"><h2><a id="pluginlogo_32" class="header-icon32" href="http://www.sidekick.pro" target="_blank"></a>Sidekick Licensing</h2></div>
|
10 |
+
|
11 |
+
<h3>Welcome to the fastest and easiest way to learn WordPress</h3>
|
12 |
+
|
13 |
+
<?php if (isset($error_message) && $error_message): ?>
|
14 |
+
<div class="error" id="sk_dashboard_message">
|
15 |
+
<p>There was a problem activating your license. The following error occured <?php echo $error_message ?></p>
|
16 |
+
</div>
|
17 |
+
<?php elseif (isset($error) && $error): ?>
|
18 |
+
<div class="error" id="sk_dashboard_message">
|
19 |
+
<p><?php echo $error ?></p>
|
20 |
+
</div>
|
21 |
+
<?php elseif (isset($sk_auto_activation_error) && $sk_auto_activation_error): ?>
|
22 |
+
<div class="error" id="sk_dashboard_message">
|
23 |
+
<p><?php echo $sk_auto_activation_error ?></p>
|
24 |
+
</div>
|
25 |
+
<?php elseif (isset($login_status['error']) && $login_status['error']): ?>
|
26 |
+
<div class="error" id="sk_dashboard_message">
|
27 |
+
<p><?php echo $login_status['error'] ?></p>
|
28 |
+
</div>
|
29 |
+
<?php elseif (isset($warn) && $warn): ?>
|
30 |
+
<div class="updated" id="sk_dashboard_message">
|
31 |
+
<p><?php echo $warn ?></p>
|
32 |
+
</div>
|
33 |
+
<?php elseif (isset($success) && $success): ?>
|
34 |
+
<div class="updated" id="sk_dashboard_message">
|
35 |
+
<p><?php echo $success ?></p>
|
36 |
+
</div>
|
37 |
+
<?php elseif (isset($login_status['success']) && $login_status['success']): ?>
|
38 |
+
<div class="updated" id="sk_dashboard_message">
|
39 |
+
<p>Successful Login!</p>
|
40 |
+
</div>
|
41 |
+
<?php endif ?>
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
<div class="sidekick_admin">
|
46 |
+
|
47 |
+
<div class="sk_box left">
|
48 |
+
<div class="wrapper_left">
|
49 |
+
<div class="sk_box license">
|
50 |
+
<div class="well">
|
51 |
+
<h3>Activate Sidekick Account</h3>
|
52 |
+
<p>Please keep this information <b>private</b>.</p>
|
53 |
+
<p>Once active every site create on this multisite installation will have Sidekick automatically activted.</p>
|
54 |
+
<p><b>Important - </b>Only WordPress basics and Enterprise plans are currently supported. <b>Custom Walkthrough</b> plans will be supported in the near future.</p>
|
55 |
+
|
56 |
+
<form method="post">
|
57 |
+
<?php settings_fields('sk_license'); ?>
|
58 |
+
<table class="form-table">
|
59 |
+
<tbody>
|
60 |
+
<tr valign="top">
|
61 |
+
<th scope="row" valign="top">Account (E-mail)</th>
|
62 |
+
<td>
|
63 |
+
<input id='<?php echo time() ?>' class='regular-text' type='text' name='sk_account' placeholder='<?php echo get_option('sk_account') ?>'></input>
|
64 |
+
</td>
|
65 |
+
</tr>
|
66 |
+
<tr valign="top">
|
67 |
+
<th scope="row" valign="top">Password</th>
|
68 |
+
<td>
|
69 |
+
<input class='regular-text' type='password' name='sk_password' placeholder='********'></input>
|
70 |
+
</td>
|
71 |
+
</tr>
|
72 |
+
<tr valign="top">
|
73 |
+
<th scope="row" valign="top">Subscription</th>
|
74 |
+
<td>
|
75 |
+
<select name='sk_selected_subscription'>
|
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 |
+
if ($sk_selected_subscription == $sub->id) {
|
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>
|
93 |
+
<?php endif ?>
|
94 |
+
<?php else: ?>
|
95 |
+
<option>No Subscriptions</option>
|
96 |
+
<?php endif ?>
|
97 |
+
</select>
|
98 |
+
</td>
|
99 |
+
</tr>
|
100 |
+
<tr valign="top">
|
101 |
+
<th scope="row" valign="top">Enable Auto-Activations</th>
|
102 |
+
<td>
|
103 |
+
<?php if (!isset($selected_sub)): ?>
|
104 |
+
<input class='checkbox' type='checkbox' name='sk_auto_activations' DISABLED>
|
105 |
+
<?php else: ?>
|
106 |
+
<input class='checkbox' type='checkbox' name='sk_auto_activations' <?php echo ($sk_auto_activations) ? 'CHECKED' : '' ?>>
|
107 |
+
<?php endif ?>
|
108 |
+
</td>
|
109 |
+
</tr>
|
110 |
+
<?php if (isset($selected_sub)): ?>
|
111 |
+
<tr>
|
112 |
+
<th scope="row" valign="top">Active Domains</th>
|
113 |
+
<td><?php echo $selected_sub->activeDomainCount ?>/ <?php echo ($selected_sub->CurrentTier->numberOfDomains == -1) ? 'Unlimited' : $selected_sub->CurrentTier->numberOfDomains ?> (<a href='https://www.sidekick.pro/profile/#/overview' target='_blank'>Manage</a>)
|
114 |
+
</td>
|
115 |
+
</tr>
|
116 |
+
<?php endif ?>
|
117 |
+
<?php if (isset($login_status['error']) && $login_status['error']): ?>
|
118 |
+
<tr>
|
119 |
+
<th colspan='2'>
|
120 |
+
<span class='red'><?php echo $login_status['error'] ?></span>
|
121 |
+
</th>
|
122 |
+
</tr>
|
123 |
+
<?php endif ?>
|
124 |
+
<?php if (isset($sk_auto_activation_error) && $sk_auto_activation_error): ?>
|
125 |
+
<tr>
|
126 |
+
<th scope="row" valign="top">Auto Activation Error</th>
|
127 |
+
<td>
|
128 |
+
<span class='red'><?php echo $sk_auto_activation_error ?></span>
|
129 |
+
</td>
|
130 |
+
</tr>
|
131 |
+
<?php endif ?>
|
132 |
+
|
133 |
+
<?php if (isset($login_status['success']) && $login_status['success']): ?>
|
134 |
+
<tr>
|
135 |
+
<th colspan='2'>
|
136 |
+
<span class='green'>Successful! </span>
|
137 |
+
</th>
|
138 |
+
</tr>
|
139 |
+
<?php endif ?>
|
140 |
+
<tr>
|
141 |
+
<th></th>
|
142 |
+
<td><?php submit_button('Update'); ?></td>
|
143 |
+
</tr>
|
144 |
+
</tbody>
|
145 |
+
</table>
|
146 |
+
</form>
|
147 |
+
</div>
|
148 |
+
</div>
|
149 |
+
|
150 |
+
<!-- Sites -->
|
151 |
+
|
152 |
+
<div class="sk_box sites">
|
153 |
+
<div class="well">
|
154 |
+
<h3>Sidekick Network Activations - (<a class='activate_all' href='#'>Activate All</a>)</h3>
|
155 |
+
|
156 |
+
<p>To manage your complete list of domains please login to your <a href='https://www.sidekick.pro/profile/#' target='_blank'>account center</a>.</p>
|
157 |
+
|
158 |
+
<?php $blogs = wp_get_sites(array('limit' => 10000)) ?>
|
159 |
+
<ul>
|
160 |
+
<?php foreach ($blogs as $key => $blog): ?>
|
161 |
+
<?php
|
162 |
+
|
163 |
+
switch_to_blog($blog['blog_id']);
|
164 |
+
|
165 |
+
if ($user = get_user_by('email', get_option('admin_email'))) {
|
166 |
+
$user_id = $user->ID;
|
167 |
+
} else {
|
168 |
+
$user_id = null;
|
169 |
+
}
|
170 |
+
|
171 |
+
$key = get_option('sk_activation_id');
|
172 |
+
if ($key) $last_key = $key;
|
173 |
+
|
174 |
+
$turn_on_button = '';
|
175 |
+
|
176 |
+
if (isset($selected_sub)) {
|
177 |
+
$turn_on_button = "<button class=\"activate_sk\" data-blogid=\"{$blog["blog_id"]}\" data-userid=\"{$user_id}\" data-domain=\"{$blog["domain"]}\" data-path=\"{$blog["path"]}\">Turn On</button>";
|
178 |
+
}
|
179 |
+
|
180 |
+
?>
|
181 |
+
|
182 |
+
<li>
|
183 |
+
<div class='bold'>
|
184 |
+
<h3><?php echo ucfirst(str_replace('/', '', $blog['path'])) ?></h3>
|
185 |
+
<?php echo $blog['domain'] . $blog['path'] ?>
|
186 |
+
<span><?php echo ($key) ? ' - <span class="green">Active</span>' : " - <span class=\"not_active\">Not Activated</span> $turn_on_button" ?></span>
|
187 |
+
</div>
|
188 |
+
</li>
|
189 |
+
<?php endforeach ?>
|
190 |
+
</ul>
|
191 |
+
|
192 |
+
<div class="single_activation_error red"></div>
|
193 |
+
|
194 |
+
|
195 |
+
</div>
|
196 |
+
</div>
|
197 |
+
|
198 |
+
</div>
|
199 |
+
</div>
|
200 |
+
|
201 |
+
<script type="text/javascript">
|
202 |
+
last_site_key = '<?php echo (isset($last_key) && $last_key) ? $last_key : '' ?>';
|
203 |
+
</script>
|
204 |
+
|
205 |
+
|
206 |
+
<div class="sk_box left">
|
207 |
+
<div class="wrapper_left">
|
208 |
+
<?php require_once('walkthrough_config.php') ?>
|
209 |
+
</div>
|
210 |
+
</div>
|
211 |
+
|
212 |
+
|
213 |
+
</div>
|
214 |
+
|
215 |
+
|
216 |
+
|
217 |
+
|
libs/sk_config_data.php
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class sk_config_data{
|
4 |
+
function get_domain(){
|
5 |
+
$site_url = get_site_url();
|
6 |
+
if(substr($site_url, -1) == '/') {
|
7 |
+
$site_url = substr($site_url, 0, -1);
|
8 |
+
}
|
9 |
+
$site_url = str_replace(array("http://","https://"),array(""),$site_url);
|
10 |
+
return $site_url;
|
11 |
+
}
|
12 |
+
|
13 |
+
function get_post_types(){
|
14 |
+
global $wpdb;
|
15 |
+
$query = "SELECT post_type, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type";
|
16 |
+
$counts = $wpdb->get_results($query);
|
17 |
+
$output = '';
|
18 |
+
|
19 |
+
foreach ($counts as $key => $type) {
|
20 |
+
$type->post_type = str_replace('-', '_', $type->post_type);
|
21 |
+
$output .= "\n post_type_{$type->post_type} : $type->count,";
|
22 |
+
}
|
23 |
+
return $output;
|
24 |
+
}
|
25 |
+
|
26 |
+
function get_themes(){
|
27 |
+
$themes = wp_get_themes( array( 'allowed' => true ) );
|
28 |
+
return count($themes);
|
29 |
+
}
|
30 |
+
|
31 |
+
function get_post_types_and_statuses(){
|
32 |
+
global $wpdb;
|
33 |
+
$query = "SELECT post_type, post_status, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type, post_status";
|
34 |
+
$counts = $wpdb->get_results($query);
|
35 |
+
$output = '';
|
36 |
+
|
37 |
+
foreach ($counts as $key => $type) {
|
38 |
+
$type->post_type = str_replace('-', '_', $type->post_type);
|
39 |
+
$type->post_status = str_replace('-', '_', $type->post_status);
|
40 |
+
|
41 |
+
$output .= "\n post_type_{$type->post_type}_{$type->post_status} : $type->count,";
|
42 |
+
}
|
43 |
+
return $output;
|
44 |
+
}
|
45 |
+
|
46 |
+
function get_taxonomies(){
|
47 |
+
global $wpdb;
|
48 |
+
$query = "SELECT count(distinct term_taxonomy_id) as count, taxonomy from {$wpdb->prefix}term_taxonomy group by taxonomy";
|
49 |
+
$counts = $wpdb->get_results($query);
|
50 |
+
$output = '';
|
51 |
+
|
52 |
+
foreach ($counts as $key => $taxonomy) {
|
53 |
+
$taxonomy->taxonomy = str_replace('-', '_', $taxonomy->taxonomy);
|
54 |
+
$output .= "\n taxonomy_{$taxonomy->taxonomy} : $taxonomy->count,";
|
55 |
+
}
|
56 |
+
return $output;
|
57 |
+
}
|
58 |
+
|
59 |
+
function get_comments(){
|
60 |
+
global $wpdb;
|
61 |
+
$query = "SELECT count(distinct comment_ID) as count from {$wpdb->prefix}comments";
|
62 |
+
$counts = $wpdb->get_var($query);
|
63 |
+
if (!$counts) $counts = 0;
|
64 |
+
return "\n comment_count : $counts,";
|
65 |
+
}
|
66 |
+
|
67 |
+
function get_post_statuses(){
|
68 |
+
global $wpdb;
|
69 |
+
$query = "SELECT post_status, count(ID) as count from {$wpdb->prefix}posts group by post_status";
|
70 |
+
$counts = $wpdb->get_results($query);
|
71 |
+
$output = '';
|
72 |
+
|
73 |
+
foreach ($counts as $key => $type) {
|
74 |
+
$type->post_status = str_replace('-', '_', $type->post_status);
|
75 |
+
$output .= "\n post_status_{$type->post_status} : $type->count,";
|
76 |
+
}
|
77 |
+
return $output;
|
78 |
+
}
|
79 |
+
|
80 |
+
function get_user_data(){
|
81 |
+
global $current_user;
|
82 |
+
|
83 |
+
$data = get_userdata($current_user->ID);
|
84 |
+
$output = "\n user_id : $current_user->ID,";
|
85 |
+
|
86 |
+
foreach ($data->allcaps as $cap => $val) {
|
87 |
+
$cap = sanitize_title($cap);
|
88 |
+
$cap = str_replace('-', '_', $cap);
|
89 |
+
if (!$val) $val = 0;
|
90 |
+
$output .= "\n cap_{$cap} : $val,";
|
91 |
+
}
|
92 |
+
return $output;
|
93 |
+
}
|
94 |
+
|
95 |
+
function get_framework(){
|
96 |
+
global $current_user;
|
97 |
+
|
98 |
+
$frameworks = array('genesis');
|
99 |
+
|
100 |
+
$output = "\n theme_framework : false,";
|
101 |
+
|
102 |
+
foreach ($frameworks as $framework) {
|
103 |
+
switch ($framework) {
|
104 |
+
case 'genesis':
|
105 |
+
if (function_exists( 'genesis' ) ) {
|
106 |
+
if (defined('PARENT_THEME_VERSION')) {
|
107 |
+
$output = "\n theme_framework : {name: '" . $framework . "', version: '" . PARENT_THEME_VERSION . "'},";
|
108 |
+
}
|
109 |
+
}
|
110 |
+
break;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
return $output;
|
114 |
+
}
|
115 |
+
|
116 |
+
function get_current_url() {
|
117 |
+
if (isset($_SERVER['REQUEST_URI'])) {
|
118 |
+
return 'http'.(empty($_SERVER['HTTPS'])?'':'s').'://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
|
119 |
+
} else if (isset($_SERVER['PATH_INFO'])) {
|
120 |
+
return $_SERVER['PATH_INFO'];
|
121 |
+
} else {
|
122 |
+
$host = $_SERVER['HTTP_HOST'];
|
123 |
+
$port = $_SERVER['SERVER_PORT'];
|
124 |
+
$request = $_SERVER['PHP_SELF'];
|
125 |
+
$query = isset($_SERVER['argv']) ? substr($_SERVER['argv'][0], strpos($_SERVER['argv'][0], ';') + 1) : '';
|
126 |
+
$toret = $protocol . '://' . $host . ($port == $protocol_port ? '' : ':' . $port) . $request . (empty($query) ? '' : '?' . $query);
|
127 |
+
return $toret;
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
function get_disabled_wts(){
|
132 |
+
$wts = str_replace('"', '', get_option('sk_disabled_wts'));
|
133 |
+
if ($wts) {
|
134 |
+
return $wts;
|
135 |
+
}
|
136 |
+
return 'false';
|
137 |
+
}
|
138 |
+
|
139 |
+
function get_disabled_network_wts(){
|
140 |
+
$wts = str_replace('"', '', get_site_option('sk_disabled_wts'));
|
141 |
+
|
142 |
+
if ($wts) {
|
143 |
+
return $wts;
|
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 |
+
$printed = false;
|
153 |
+
|
154 |
+
$output = '[';
|
155 |
+
$count = 0;
|
156 |
+
|
157 |
+
if (is_array($active_plugins)) {
|
158 |
+
foreach ($active_plugins as $plugins_key => $plugin) {
|
159 |
+
$data = get_plugin_data( $plugin, false, false );
|
160 |
+
|
161 |
+
$plugins[addslashes($data['Name'])] = $data['Version'];
|
162 |
+
if ($plugins_key > 0) $output .= ',';
|
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 |
+
$plugins[addslashes($plugin['Name'])] = $plugin['Version'];
|
173 |
+
if ($printed) $output .= ',';
|
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(){
|
185 |
+
global $current_user, $wp_roles;
|
186 |
+
|
187 |
+
if (is_super_admin($current_user->ID)) {
|
188 |
+
return 'administrator';
|
189 |
+
}
|
190 |
+
|
191 |
+
if(!isset($current_user->caps) || count($current_user->caps) < 1){
|
192 |
+
// In MS in some specific pages current user is returning empty caps so this is a work around for that case.
|
193 |
+
if (current_user_can('activate_plugins')){
|
194 |
+
return 'administrator';
|
195 |
+
}
|
196 |
+
}
|
197 |
+
foreach($wp_roles->role_names as $role => $Role) {
|
198 |
+
if (array_key_exists($role, $current_user->caps)){
|
199 |
+
$user_role = $role;
|
200 |
+
break;
|
201 |
+
}
|
202 |
+
}
|
203 |
+
return $user_role;
|
204 |
+
}
|
205 |
+
}
|
libs/walkthrough_config.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="sk_box configure">
|
2 |
+
<div class="well">
|
3 |
+
<h3>Configure - Auto Start</h3>
|
4 |
+
|
5 |
+
<form method='post'>
|
6 |
+
|
7 |
+
<p>This Walkthrough will be played once for every user that logs into the backend of WordPress.</p>
|
8 |
+
<select name='sk_autostart_walkthrough_id'>
|
9 |
+
<option value='0'>No Auto Start</option>
|
10 |
+
</select>
|
11 |
+
<input class='button button-primary' type='submit' value='Save'/>
|
12 |
+
<input type='hidden' name='is_ms_admin' value='<?php echo (isset($is_ms_admin)) ? $is_ms_admin : false ?>'/>
|
13 |
+
<input type='hidden' name='sk_setting_autostart' value='true'/>
|
14 |
+
|
15 |
+
<?php wp_nonce_field( 'update_sk_settings' ); ?>
|
16 |
+
</form>
|
17 |
+
</div>
|
18 |
+
</div>
|
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'>
|
28 |
+
Loading...
|
29 |
+
</div>
|
30 |
+
<input class='button button-primary' type='submit' value='Save'/>
|
31 |
+
<input type='hidden' name='sk_setting_disabled' value='true'/>
|
32 |
+
<input type='hidden' name='is_ms_admin' value='<?php echo (isset($is_ms_admin)) ? $is_ms_admin : false ?>'/>
|
33 |
+
<?php wp_nonce_field( 'update_sk_settings' ); ?>
|
34 |
+
</form>
|
35 |
+
</div>
|
36 |
+
</div>
|
readme.txt
ADDED
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Sidekick ===
|
2 |
+
Contributors: raptor235,benfox,kyle_white,bitwit,riavalon,JeffLam
|
3 |
+
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.0.1
|
8 |
+
License: GNU Version 2 or Any Later Version
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
Real-time, voice-guided WordPress training and support straight from your dashboard.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
[youtube https://www.youtube.com/watch?v=5BHSqdU1Ssk]
|
16 |
+
|
17 |
+
**SIDEKICK is the fastest and easiest way to learn WordPress, Themes & Plugins!**
|
18 |
+
|
19 |
+
Sidekick provides interactive, real-time, narrated guides through the WordPress administration area. These guides (called Walkthroughs) come in three flavours:
|
20 |
+
|
21 |
+
- **Overviews**: Guided tours through admin screens and their features.
|
22 |
+
- **How-Tos**: Step-by-step instructions to help you complete a task.
|
23 |
+
- **Hotspots**: Useful reminders for on-screen elements, features and functions.
|
24 |
+
|
25 |
+
**Walkthroughs for other plugins and themes? You bet!**
|
26 |
+
|
27 |
+
If you're running a plugin or theme that’s supported by Sidekick, we’ll automatically serve up those Walkthroughs, as long as the Walkthroughs are active for your Sidekick account.
|
28 |
+
|
29 |
+
**A modern browser is all you need.**
|
30 |
+
|
31 |
+
Sidekick is built with JavaScript, so you don’t need to download any additional browser extensions or add-ons. Just install the SIDEKICK plugin for WordPress.
|
32 |
+
|
33 |
+
**SIDEKICK is perfect for you, if...**
|
34 |
+
|
35 |
+
*You're new to WordPress.* Instead of jumping back-and-forth between documentation, videos, and your own WordPress site, just follow the step-by-step SIDEKICK walkthroughs. Simple!
|
36 |
+
|
37 |
+
*You're helping someone learn WordPress.* Instead of repeatedly showing them the basics, let SIDEKICK do it for you - just install the plugin and tell them which walkthroughs to follow.
|
38 |
+
|
39 |
+
*You build WordPress sites for a living.* Reduce your training and support costs by installing Sidekick on client websites.
|
40 |
+
|
41 |
+
**Powered by the SIDEKICK platform.**
|
42 |
+
|
43 |
+
WordPress is just the tip of the iceberg! Sidekick can work with any web application, requiring no app or browser extension downloads for the user.
|
44 |
+
|
45 |
+
Walkthroughs are served directly from our servers, so you don't need to download or install additional files as new or updated walkthroughs are released.
|
46 |
+
|
47 |
+
With the user’s permission, Sidekick will collect anonymous data to track walkthrough and platform performance. This helps us improve the product and provide more useful support.
|
48 |
+
|
49 |
+
== Installation ==
|
50 |
+
|
51 |
+
**Plugin Search (Recommended)**
|
52 |
+
|
53 |
+
1. In /wp-admin/, go to Plugins > Add New.
|
54 |
+
2. Search for "Sidekick".
|
55 |
+
3. Look for "Sidekick” (should be the only result) .
|
56 |
+
4. Click Install Now.
|
57 |
+
5. After installation has completed, click Activate Plugin.
|
58 |
+
|
59 |
+
**Manual Upload**
|
60 |
+
|
61 |
+
1. Download the plugin .zip file from wordpress.org/plugins/sidekick/
|
62 |
+
2. In /wp-admin/, go to Plugins > Add New. Click Upload.
|
63 |
+
3. Locate the .zip file on your computer. Click Install Now.
|
64 |
+
4. After installation has completed, click Activate Plugin.
|
65 |
+
|
66 |
+
**Manual FTP**
|
67 |
+
|
68 |
+
1. Download the plugin .zip file from wordpress.org/plugins/sidekick/
|
69 |
+
2. Extract the plugin folder contained in the .zip file.
|
70 |
+
3. Upload the plugin folder, via FTP, to your /wp-content/plugins/ directory.
|
71 |
+
4. On your Plugins screen, under Sidekick, click Activate.
|
72 |
+
|
73 |
+
== Upgrade Notice ==
|
74 |
+
|
75 |
+
Upgrade Notice
|
76 |
+
|
77 |
+
== Activation ==
|
78 |
+
|
79 |
+
After installation you’ll have access to at least 5 Core WordPress Walkthroughs. Activating Sidekick will unlock 30+ free WordPress Core Walkthroughs.
|
80 |
+
|
81 |
+
**Why Upgrade?**
|
82 |
+
|
83 |
+
Purchase a Premium WordPress Core subscription to unlock access to
|
84 |
+
|
85 |
+
== Frequently Asked Questions ==
|
86 |
+
|
87 |
+
= What is Sidekick for WordPress? =
|
88 |
+
|
89 |
+
The Sidekick platform provides real-time, guided support and learning from within any html or PHP based web application or CMS. Support is provided through modules called “Walkthroughs” that guide users through everything from understanding simple aspects of an application to completing complicated tasks.
|
90 |
+
|
91 |
+
The Sidekick plugin for WordPress connects the Sidekick platform with any WordPress Dashboard allowing real-time guided walkthroughs of core and 3rd party WordPress features and functions.
|
92 |
+
|
93 |
+
If you’d like to learn more about Sidekick, go to [Sidekick.pro](http://Sidekick.pro/ "Sidekick")
|
94 |
+
|
95 |
+
= What is a Sidekick Walkthrough? =
|
96 |
+
|
97 |
+
A Sidekick for WordPress Walkthrough is a real-time, guided tutorial that walks you step by step through completing a task inside your WordPress Dashboard. It’s as if your site-builder or theme developer were standing right there with you, helping you get it done.
|
98 |
+
|
99 |
+
= What are Core and 3rd Party WordPress Walkthroughs? =
|
100 |
+
|
101 |
+
When we say “Core Walkthroughs” for WordPress, we are referring to any support and learning that has to do with features and functions provided by a fresh, default install of WordPress, downloaded from WordPress.org. Basically, if a walkthrough is helpng you complete a standard WordPress function like creating a post, it’s a Core Walkthrough and SIDEKICK created it.
|
102 |
+
|
103 |
+
Plugin and theme specific Walkthroughs are called Third Party Walkthroughs and are created and maintained by the plugin or theme creator, unless otherwise mentioned.
|
104 |
+
|
105 |
+
= How do I create Walkthroughs for my Plugin(s) or Theme(s)? =
|
106 |
+
|
107 |
+
At the moment Sidekick Composer, the tool we use to create Walkthroughs, is for in-house use only but we plan for that to change by the end of July 2014. If you’re interested in getting a head start, fill out the form [on this page](http://www.sidekick.pro/developer-program/) and we will send you details on how to join us a little earlier.
|
108 |
+
|
109 |
+
= What does Sidekick for WordPress cost? =
|
110 |
+
|
111 |
+
The Sidekick plugin for WordPress is and always will be free to download and use. Installing the plugin gives you instant and unlimited access to 30 Core WordPress How-To and Overview Walkthroughs.
|
112 |
+
|
113 |
+
If you would like access to the full library of [Core WordPress Walkthroughs (Over 150)](http://www.sidekick.pro/wordpress/modules/wordpress-core-module-premium/) including Hotspots, the cost is $10 a month per URL.
|
114 |
+
|
115 |
+
= Ok, the plugin is installed and activated. How do I use it? =
|
116 |
+
|
117 |
+
Click on the “Help Me” bottom left of your screen to open the Walkthrough menu.
|
118 |
+
You will be presented with the Walkthrough menu. Select your bucket then your walkthrough and away you go.
|
119 |
+
|
120 |
+
= Can I suggest a Walkthrough that I’d like to see or give you feedback on the Sidekick WordPress Plugin? =
|
121 |
+
|
122 |
+
Absolutely. In fact, we rely on users like you to tell us about things that need to be improved or that you’d like to see added to the plugin. Send your email to info@wpuniversity.com. We read and respond to every piece of feedback we get.
|
123 |
+
|
124 |
+
== Screenshots ==
|
125 |
+
|
126 |
+
1. Sidekick in action, shows of the typical screen you will see while a Sidekick walkthrough is playing.
|
127 |
+
2. This widget shows the library of walkthroughs currently available.
|
128 |
+
3. User interaction demonstrated while a user is prompted to perform an action.
|
129 |
+
4. Yet another action requirement by the user is previewed here.
|
130 |
+
|
131 |
+
== Changelog ==
|
132 |
+
|
133 |
+
= 2.0.1 =
|
134 |
+
* Multisite Walkthrough Management Support
|
135 |
+
* Multisite Auto Activations
|
136 |
+
* Multisite Mass Activations
|
137 |
+
* Genesis Framework Support
|
138 |
+
* Fixes issues with composer mode and auto play of walkthroughs
|
139 |
+
* Fixes issues with select all walkthroughs in settings screen
|
140 |
+
* Fixes issues with download of file would resume a walkthrough on click event
|
141 |
+
* Fixes issues playing back hotspots in certain cases
|
142 |
+
|
143 |
+
= 2.0.1 =
|
144 |
+
* Fix walkthrough autostart feature
|
145 |
+
* Update copy
|
146 |
+
|
147 |
+
= 2.0.0 =
|
148 |
+
* Major Composer Release
|
149 |
+
|
150 |
+
= 1.6.17 =
|
151 |
+
* Fixed PHP warning on plugin version
|
152 |
+
|
153 |
+
= 1.6.16 =
|
154 |
+
* Changed deactivation flow so user gets to keep their activation id
|
155 |
+
|
156 |
+
= 1.6.15 =
|
157 |
+
* Fixes hotspots not showing up in certain cases
|
158 |
+
* Fixes harcoded issue with db table prefix
|
159 |
+
* Style fixes on audio only mode
|
160 |
+
* Fixes issue with returning back to regular playback mode from audio only mode
|
161 |
+
* Fixes issue with audio player being muted in certain situations
|
162 |
+
|
163 |
+
= 1.6.5 =
|
164 |
+
* Fixed issue with Hotspot playback
|
165 |
+
|
166 |
+
= 1.6.4 =
|
167 |
+
* Fixed Composer Preview Bug
|
168 |
+
* Prefixed All Class Names
|
169 |
+
|
170 |
+
= 1.6.2 =
|
171 |
+
* Made the move target step optional
|
172 |
+
|
173 |
+
= 1.6.1 =
|
174 |
+
* Audio Fallback Mode added
|
175 |
+
* Sidekick won't show when no compatible walkthroughs are found
|
176 |
+
* Console messages turned off while not in debug mode
|
177 |
+
* Much improved cache invalidation
|
178 |
+
* Fixed a bug that on certain pages Sidekick wouldn't properly stop
|
179 |
+
* Fixed a bug with Sidekick blocking clicks after it's been stopped
|
180 |
+
|
181 |
+
= 1.5.5 =
|
182 |
+
* 4.0 Readiness
|
183 |
+
* Fixed conflict with caused by jquery-show
|
184 |
+
|
185 |
+
= 1.5.4 =
|
186 |
+
* Fixed incompatibility with iThemes Builder and For Loop JS Loops
|
187 |
+
* Added security nonces
|
188 |
+
* Added banner to let users know of Sidekick's existence
|
189 |
+
|
190 |
+
= 1.5.3 =
|
191 |
+
* Super Admin detection added
|
192 |
+
|
193 |
+
= 1.5.2 =
|
194 |
+
* Fixed Multisite issue with role detection on certain pages
|
195 |
+
|
196 |
+
= 1.5.1 =
|
197 |
+
* Added more parameters to tag Walkthroughs againts
|
198 |
+
|
199 |
+
= 1.5.0 =
|
200 |
+
* Paid vs Free Walkthrough Seperation
|
201 |
+
* Clean Up of Logs
|
202 |
+
|
203 |
+
= 1.4.2 =
|
204 |
+
* New Administration Screen
|
205 |
+
* Auto Start of a Walkthrough for each user
|
206 |
+
* Disable Specific Walkthroughs
|
207 |
+
|
208 |
+
= 1.4.1 =
|
209 |
+
* Fixed issue with hotspot button not showing
|
210 |
+
* Added ability to auto start a Walkthrough
|
211 |
+
* Added ability to disable specific Walkthroughs
|
212 |
+
|
213 |
+
= 1.4 =
|
214 |
+
* Switch over to new platform version
|
215 |
+
* Sidekick Activation Bug Fixed
|
216 |
+
* CSS Fixes
|
217 |
+
* Autostart on specific pages
|
218 |
+
* Added Wait_For Event
|
219 |
+
* Changed error messaging
|
220 |
+
* Fixed underscore template conflict with other backbone themes / apps
|
221 |
+
* Added LABjs file loading
|
222 |
+
* Added library load doublecheck
|
223 |
+
* Optimized Tracking
|
224 |
+
* Fixes to display rules boolean operations
|
225 |
+
* Added handlers for open a specific bucket
|
226 |
+
* Added handlers to auto open a specific bucket
|
227 |
+
* Fixed a bug when there were no comments in the blog
|
228 |
+
|
229 |
+
= 1.3.4 =
|
230 |
+
* Updated Modal UI
|
231 |
+
* Dropped www. from domain checking
|
232 |
+
* Walkthroughs now pause when user double clicks on another element
|
233 |
+
* Paid Walkthroughs now show in the free library
|
234 |
+
* Fixed a bug where capabilities have spaces
|
235 |
+
|
236 |
+
= 1.3.3 =
|
237 |
+
* Fixed an issue with custom prefixed databases
|
238 |
+
|
239 |
+
= 1.3.2 =
|
240 |
+
* HTTPs Protocol Adjustments
|
241 |
+
|
242 |
+
= 1.3.1 =
|
243 |
+
* Library loading bug fixed
|
244 |
+
|
245 |
+
= 1.2.2 =
|
246 |
+
* Activation Bug Fix
|
247 |
+
* UI Enchancements
|
248 |
+
|
249 |
+
= 1.2 =
|
250 |
+
* 3.9 Support Added
|
251 |
+
* Suppport for Module Marketplace
|
252 |
+
* HTTPs Support Added
|
253 |
+
* Fixes to "safety layer"
|
254 |
+
* Fix issue with hotspots showing while playing a walkthrough
|
255 |
+
|
256 |
+
= 1.10 =
|
257 |
+
* Brand New User Interface
|
258 |
+
* Hotspot Support Added
|
259 |
+
* 3.8 Support Added
|
260 |
+
* Deeper sub-category support
|
261 |
+
* Sidekick Platform Upgraded
|
262 |
+
* Known bug exists with HTTPs protocols
|
263 |
+
|
264 |
+
= 1.00 =
|
265 |
+
* Added support for buckets
|
266 |
+
|
267 |
+
= 0.78 =
|
268 |
+
* plugin Compatibility issues resolved
|
269 |
+
|
270 |
+
= 0.76 =
|
271 |
+
* Fixed sizing issues when more walkthroughs were added
|
272 |
+
|
273 |
+
= 0.74 =
|
274 |
+
* Fixed loop function bug
|
275 |
+
|
276 |
+
= 0.73 =
|
277 |
+
* Fixed Activation Bug
|
278 |
+
|
279 |
+
= 0.70 =
|
280 |
+
* Initial Beta Release
|
sidekick.php
ADDED
@@ -0,0 +1,446 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Plugin Name: Sidekick
|
5 |
+
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.0.1
|
10 |
+
Author: Sidekick.pro
|
11 |
+
Author URI: http://www.sidekick.pro
|
12 |
+
*/
|
13 |
+
|
14 |
+
|
15 |
+
if ( ! defined( 'PLAYER_PATH' ) ) define( 'PLAYER_PATH', 'tag/latest' );
|
16 |
+
if ( ! defined( 'PLAYER_FILE' ) ) define( 'PLAYER_FILE', 'sidekick.min.js' );
|
17 |
+
if ( ! defined( 'COMPOSER_PATH' ) ) define( 'COMPOSER_PATH', 'tag/latest' );
|
18 |
+
if ( ! defined( 'SK_SL_PLUGIN_DIR' ) ) define( 'SK_SL_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
19 |
+
if ( ! defined( 'SK_SL_PLUGIN_URL' ) ) define( 'SK_SL_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
20 |
+
if ( ! defined( 'SK_SL_PLUGIN_FILE' ) ) define( 'SK_SL_PLUGIN_FILE', __FILE__ );
|
21 |
+
if ( ! function_exists('mlog')) {
|
22 |
+
function mlog(){}
|
23 |
+
}
|
24 |
+
|
25 |
+
class Sidekick{
|
26 |
+
|
27 |
+
function __construct(){
|
28 |
+
if (!defined('SK_TRACKING_API')) define('SK_TRACKING_API','//tracking.sidekick.pro/');
|
29 |
+
if (!defined('SK_COMPOSER_API')) define('SK_COMPOSER_API','//apiv2.sidekick.pro');
|
30 |
+
if (!defined('SK_API')) define('SK_API','//apiv2.sidekick.pro/');
|
31 |
+
if (!defined('SK_LIBRARY')) define('SK_LIBRARY','//librarycache.sidekick.pro/');
|
32 |
+
if (!defined('SK_ASSETS')) define('SK_ASSETS','//assets.sidekick.pro/');
|
33 |
+
if (!defined('SK_AUDIO')) define('SK_AUDIO','//audio.sidekick.pro/');
|
34 |
+
}
|
35 |
+
|
36 |
+
function enqueue_required(){
|
37 |
+
wp_enqueue_script('jquery' , null );
|
38 |
+
wp_enqueue_script('underscore' , null, array('underscore'));
|
39 |
+
wp_enqueue_script('backbone' , null, array('jquery','underscore'));
|
40 |
+
wp_enqueue_script('jquery-ui-core' , null, array('jquery') );
|
41 |
+
wp_enqueue_script('jquery-ui-position' , null, array('jquery-ui-core') );
|
42 |
+
wp_enqueue_script('jquery-ui-draggable' , null, array('jquery-ui-core') );
|
43 |
+
wp_enqueue_script('jquery-ui-droppable' , null, array('jquery-ui-core') );
|
44 |
+
wp_enqueue_script('jquery-effects-scale' , null, array('jquery-ui-core') );
|
45 |
+
wp_enqueue_script('jquery-effects-highlight' , null, array('jquery-ui-core') );
|
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' ,"//player.sidekick.pro/" . PLAYER_PATH . "/" . PLAYER_FILE, array('backbone','jquery','underscore','jquery-effects-highlight'),null);
|
59 |
+
wp_enqueue_style('wp-pointer');
|
60 |
+
wp_enqueue_script('wp-pointer');
|
61 |
+
}
|
62 |
+
|
63 |
+
function setup_menu(){
|
64 |
+
add_submenu_page( 'options-general.php', 'Sidekick', 'Sidekick', 'activate_plugins','sidekick', array(&$this,'admin_page'));
|
65 |
+
}
|
66 |
+
|
67 |
+
function ajax_save(){
|
68 |
+
if (isset($_POST['sk_composer_button']) && $_POST['sk_composer_button'] == "true") {
|
69 |
+
update_option( 'sk_composer_button', true );
|
70 |
+
} elseif (isset($_POST['sk_composer_button']) && $_POST['sk_composer_button'] == "false") {
|
71 |
+
delete_option('sk_composer_button');
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
function admin_page(){
|
76 |
+
if ( empty( $_POST ) || check_admin_referer( 'update_sk_settings' ) ) {
|
77 |
+
|
78 |
+
if (isset($_POST['option_page']) && $_POST['option_page'] == 'sk_license') {
|
79 |
+
|
80 |
+
if (isset($_POST['activation_id']) && $_POST['activation_id'] && strpos($_POST['activation_id'], '-xxxx-xxxx') === false){
|
81 |
+
$result = $this->activate(true);
|
82 |
+
} else if (isset($_POST['activation_id']) && strpos($_POST['activation_id'], '-xxxx-xxxx') === false) {
|
83 |
+
delete_option('sk_activation_id');
|
84 |
+
}
|
85 |
+
|
86 |
+
if (isset($_POST['sk_composer_button'])) {
|
87 |
+
update_option( 'sk_composer_button', true );
|
88 |
+
} else {
|
89 |
+
delete_option('sk_composer_button');
|
90 |
+
}
|
91 |
+
|
92 |
+
if (isset($_POST['sk_track_data'])) {
|
93 |
+
update_option( 'sk_track_data', true );
|
94 |
+
} else {
|
95 |
+
delete_option('sk_track_data');
|
96 |
+
}
|
97 |
+
|
98 |
+
update_option( 'sk_activated', true );
|
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" ) : '');
|
110 |
+
$sk_track_data = get_option( 'sk_track_data' );
|
111 |
+
$current_user = wp_get_current_user();
|
112 |
+
$status = 'Free';
|
113 |
+
$error = null;
|
114 |
+
|
115 |
+
if (isset($SK_PAID_LIBRARY_FILE) && $activation_id) {
|
116 |
+
$_POST['activation_id'] = $activation_id;
|
117 |
+
$check_activation = $this->activate(true);
|
118 |
+
$status = 'Checking...';
|
119 |
+
}
|
120 |
+
|
121 |
+
global $wp_version;
|
122 |
+
if (version_compare($wp_version, '3.9', '<=')) {
|
123 |
+
$error = "Sorry, Sidekick requires WordPress 3.9 or higher to function.";
|
124 |
+
}
|
125 |
+
|
126 |
+
if (!$activation_id) {
|
127 |
+
$warn = "You're using the <b>free</b> version of Sidekick, to upgrade or get your license key, visit your <a target='_blank' href='http://www.sidekick.pro/plans/#/login?utm_source=plugin&utm_medium=settings&utm_campaign=upgrade_nag'>account page</a> or <a target='_blank' href='http://www.sidekick.pro/plans/?utm_source=plugin&utm_medium=settings&utm_campaign=upgrade_nag'>sign-up</a> for a paid plan.";
|
128 |
+
}
|
129 |
+
|
130 |
+
if(preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])){
|
131 |
+
$error = "Sorry, Sidekick requires Internet Explorer 9 or higher to function.";
|
132 |
+
}
|
133 |
+
|
134 |
+
?>
|
135 |
+
|
136 |
+
<?php if (get_option('sk_firstuse') == true): ?>
|
137 |
+
<?php delete_option('sk_firstuse') ?>
|
138 |
+
<script type="text/javascript">
|
139 |
+
jQuery(document).ready(function($) {
|
140 |
+
jQuery('#sidekick #logo').trigger('click');
|
141 |
+
});
|
142 |
+
</script>
|
143 |
+
<?php endif ?>
|
144 |
+
|
145 |
+
<div class="wrap">
|
146 |
+
<?php include('libs/admin_page.php') ?>
|
147 |
+
</div>
|
148 |
+
<?php
|
149 |
+
}
|
150 |
+
|
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 |
+
update_site_option('sk_disabled_wts',json_encode($_POST['disable_wts']));
|
155 |
+
} else {
|
156 |
+
delete_option('sk_disabled_wts');
|
157 |
+
delete_site_option('sk_disabled_wts');
|
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 |
+
delete_site_option('sk_autostart_walkthrough_id');
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
function footer(){
|
172 |
+
global $current_user;
|
173 |
+
|
174 |
+
require_once('libs/sk_config_data.php');
|
175 |
+
|
176 |
+
$sk_config_data = new sk_config_data;
|
177 |
+
$current_user = wp_get_current_user();
|
178 |
+
$sk_just_activated = get_option( 'sk_just_activated' );
|
179 |
+
$sk_track_data = get_option( 'sk_track_data' );
|
180 |
+
$sk_composer_button = get_option( 'sk_composer_button' );
|
181 |
+
$activation_id = (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : '');
|
182 |
+
$autostart_network_walkthrough_id = (get_site_option('sk_autostart_walkthrough_id') ? get_site_option('sk_autostart_walkthrough_id') : 'null' );
|
183 |
+
$autostart_walkthrough_id = (get_option('sk_autostart_walkthrough_id') ? get_option('sk_autostart_walkthrough_id') : $autostart_network_walkthrough_id );
|
184 |
+
$custom_class = (get_option( "sk_custom_class" ) ? get_option( "sk_custom_class" ) : '');
|
185 |
+
$theme = wp_get_theme();
|
186 |
+
$not_supported_ie = false;
|
187 |
+
$user_email = '';
|
188 |
+
if ($sk_track_data) {
|
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 |
+
$plugin_data = $sk_config_data->get_plugins();
|
195 |
+
$disabled_wts = $sk_config_data->get_disabled_wts();
|
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();
|
199 |
+
$taxonomies = $sk_config_data->get_taxonomies();
|
200 |
+
$user_data = $sk_config_data->get_user_data();
|
201 |
+
$comments = $sk_config_data->get_comments();
|
202 |
+
$post_statuses = $sk_config_data->get_post_statuses();
|
203 |
+
$post_types_and_statuses = $sk_config_data->get_post_types_and_statuses();
|
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 |
+
|
227 |
+
compatibilities: {
|
228 |
+
<?php echo $post_types ?>
|
229 |
+
<?php echo $taxonomies ?>
|
230 |
+
<?php echo $user_data ?>
|
231 |
+
<?php echo $comments ?>
|
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 ?>',
|
240 |
+
main_soft_version: '<?php echo get_bloginfo("version") ?>',
|
241 |
+
theme_version: '<?php echo $theme->Version ?>',
|
242 |
+
user_level: '<?php echo $user_role ?>',
|
243 |
+
main_soft_name: 'WordPress',
|
244 |
+
role: '<?php echo $user_role ?>'
|
245 |
+
},
|
246 |
+
|
247 |
+
disable_wts: <?php echo $disabled_wts ?>,
|
248 |
+
disable_network_wts: <?php echo $disabled_network_wts ?>,
|
249 |
+
main_soft_name: 'WordPress',
|
250 |
+
|
251 |
+
// User Settings
|
252 |
+
activation_id: '<?php echo $activation_id ?>',
|
253 |
+
auto_open_root_bucket_id: 79,
|
254 |
+
auto_open_product: 'default',
|
255 |
+
disable_wts_in_root_bucket_ids: [5,87],
|
256 |
+
autostart_walkthrough_id: <?php echo $autostart_walkthrough_id ?>,
|
257 |
+
sk_composer_button: <?php echo ($sk_composer_button ? "true" : "false") ?>,
|
258 |
+
track_data: '<?php echo $sk_track_data ?>',
|
259 |
+
user_email: '<?php echo $user_email ?>',
|
260 |
+
custom_class: '<?php echo $custom_class ?>',
|
261 |
+
|
262 |
+
// Toggles
|
263 |
+
path_not_found_continue: true,
|
264 |
+
show_powered_by: true,
|
265 |
+
show_powered_by_link: true,
|
266 |
+
sk_autostart_only_once: true,
|
267 |
+
use_native_controls: false,
|
268 |
+
composer_upgrade_off: false,
|
269 |
+
basics_upgrade: true,
|
270 |
+
|
271 |
+
// Platform Info
|
272 |
+
library_version: 2,
|
273 |
+
platform_id: 1,
|
274 |
+
|
275 |
+
// Generic Info
|
276 |
+
just_activated: <?php echo ($sk_just_activated) ? "true" : "false" ?>,
|
277 |
+
platform_version: null,
|
278 |
+
plugin_version: '2.0.1',
|
279 |
+
show_login: <?php echo ($sk_just_activated) ? "true" : "false" ?>,
|
280 |
+
|
281 |
+
// SIDEKICK URLS
|
282 |
+
assets: '<?php echo SK_ASSETS ?>',
|
283 |
+
api: '<?php echo SK_API ?>',
|
284 |
+
tracking_api: '<?php echo SK_TRACKING_API ?>',
|
285 |
+
sk_path: '<?php echo PLAYER_PATH ?>',
|
286 |
+
audio: '<?php echo SK_AUDIO ?>',
|
287 |
+
library: '<?php echo SK_LIBRARY ?>',
|
288 |
+
|
289 |
+
// URLS
|
290 |
+
site_url: '<?php echo $site_url ?>',
|
291 |
+
domain: '<?php echo str_replace("http://","",$_SERVER["SERVER_NAME"]) ?>',
|
292 |
+
domain_used: '//player.sidekick.pro/',
|
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 |
+
js: '//composer.sidekick.pro/<?php echo COMPOSER_PATH ?>/sidekick-composer.js',
|
301 |
+
css: '//composer.sidekick.pro/<?php echo COMPOSER_PATH ?>/sidekick-composer.css',
|
302 |
+
apiUrl: '<?php echo SK_COMPOSER_API ?>',
|
303 |
+
baseSiteUrl: sk_config.base_url,
|
304 |
+
platformId: 1,
|
305 |
+
compatibilities: sk_config.compatibilities,
|
306 |
+
audioBaseUrl: '<?php echo SK_AUDIO ?>',
|
307 |
+
audioPlaceholderUrl: '//assets.sidekick.pro/walkthrough-audio-placeholder.mp3',
|
308 |
+
siteAjaxUrl: window.ajaxurl || '',
|
309 |
+
trackingUrl: '//tracking.sidekick.pro/'
|
310 |
+
}
|
311 |
+
|
312 |
+
</script>
|
313 |
+
<?php endif ?>
|
314 |
+
|
315 |
+
<?php
|
316 |
+
}
|
317 |
+
|
318 |
+
function track($data){
|
319 |
+
$response = wp_remote_post( SK_TRACKING_API . 'event', array(
|
320 |
+
'method' => 'POST',
|
321 |
+
'timeout' => 45,
|
322 |
+
'redirection' => 5,
|
323 |
+
'httpversion' => '1.0',
|
324 |
+
'blocking' => true,
|
325 |
+
'headers' => array(),
|
326 |
+
'body' => $data,
|
327 |
+
'cookies' => array()
|
328 |
+
)
|
329 |
+
);
|
330 |
+
}
|
331 |
+
|
332 |
+
function activate($return = false){
|
333 |
+
if (isset($_POST['activation_id'])) {
|
334 |
+
update_option('sk_activation_id',$_POST['activation_id']);
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
function activate_plugin(){
|
339 |
+
update_option( 'sk_firstuse', true );
|
340 |
+
update_option( 'sk_do_activation_redirect', true );
|
341 |
+
$data = array(
|
342 |
+
'source' => 'plugin',
|
343 |
+
'action' => 'track',
|
344 |
+
'type' => 'activate'
|
345 |
+
);
|
346 |
+
$this->track($data);
|
347 |
+
}
|
348 |
+
|
349 |
+
function curl_get_data($url){
|
350 |
+
$ch = curl_init();
|
351 |
+
$timeout = 5;
|
352 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
353 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
354 |
+
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
|
355 |
+
$data = curl_exec($ch);
|
356 |
+
curl_close($ch);
|
357 |
+
return $data;
|
358 |
+
}
|
359 |
+
|
360 |
+
function redirect(){
|
361 |
+
if (get_option('sk_do_activation_redirect', false)) {
|
362 |
+
delete_option('sk_do_activation_redirect');
|
363 |
+
$siteurl = get_site_url();
|
364 |
+
wp_redirect($siteurl . "/wp-admin/options-general.php?page=sidekick");
|
365 |
+
die();
|
366 |
+
}
|
367 |
+
}
|
368 |
+
|
369 |
+
function admin_notice() {
|
370 |
+
global $current_user ;
|
371 |
+
|
372 |
+
if ( ! get_user_meta($current_user->ID, 'sk_ignore_notice') ) {
|
373 |
+
printf ('<div class="updated"><p>Need help with WordPress? Click HELP ME in the bottom left corner to get started! <a href="%1$s">Hide</a></p></div>','?sk_ignore_notice=1');
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
function admin_notice_ignore() {
|
378 |
+
global $current_user;
|
379 |
+
if ( isset($_GET['sk_ignore_notice'])) {
|
380 |
+
add_user_meta($current_user->ID, 'sk_ignore_notice', true);
|
381 |
+
}
|
382 |
+
}
|
383 |
+
|
384 |
+
function deactivate_plugin(){
|
385 |
+
$data = array(
|
386 |
+
'source' => 'plugin',
|
387 |
+
'action' => 'track',
|
388 |
+
'type' => 'deactivate',
|
389 |
+
'user' => get_option( "activation_id" )
|
390 |
+
);
|
391 |
+
$this->track($data);
|
392 |
+
?>
|
393 |
+
<script type="text/javascript">
|
394 |
+
window._gaq = window._gaq || [];
|
395 |
+
window._gaq.push(['sk._setAccount', 'UA-39283622-1']);
|
396 |
+
|
397 |
+
(function() {
|
398 |
+
var ga_wpu = document.createElement('script'); ga_sk.type = 'text/javascript'; ga_sk.async = true;
|
399 |
+
ga_sk.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
400 |
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga_wpu, s);
|
401 |
+
})();
|
402 |
+
window._gaq.push(['sk._trackEvent', 'Plugin - Deactivate', '', <?php echo plugin_version ?>, 0,true]);
|
403 |
+
</script>
|
404 |
+
<?php
|
405 |
+
delete_option( 'sk_activated' );
|
406 |
+
}
|
407 |
+
}
|
408 |
+
|
409 |
+
$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'));
|
416 |
+
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'))
|
429 |
+
require_once('sk_init.php');
|
430 |
+
|
431 |
+
if (!(isset($_GET['tab']) && $_GET['tab'] == 'plugin-information') && !defined('IFRAME_REQUEST')) {
|
432 |
+
add_action('admin_footer', array($sidekick,'footer'));
|
433 |
+
add_action('customize_controls_print_footer_scripts', array($sidekick,'footer'));
|
434 |
+
}
|
435 |
+
|
436 |
+
|
437 |
+
// Multisite Licensing
|
438 |
+
|
439 |
+
if (defined('MULTISITE')) {
|
440 |
+
require_once('libs/licensing.php');
|
441 |
+
$sidekickMassActivator = new sidekickMassActivator;
|
442 |
+
add_action('wpmu_new_blog',array($sidekickMassActivator,'activate'),10,6);
|
443 |
+
add_action('network_admin_menu', array($sidekickMassActivator,'setup_menu'));
|
444 |
+
add_action('wp_ajax_sk_activate_single', array($sidekickMassActivator,'activate_single'));
|
445 |
+
}
|
446 |
+
|