Version Description
- wpCentral notice on admin panel can now be dismissed manually.
- Added remove directory file function.
- Improved plugins/themes update code.
- Function to fetch wpCentral installed plugin version.
Download this release
Release Info
Developer | softacpriya |
Plugin | wpCentral |
Version | 1.4.3 |
Comparing to | |
See all releases |
Code changes from version 1.4.2 to 1.4.3
- actions.php +65 -34
- file_actions.php +1 -1
- readme.txt +8 -2
- verify.php +2 -0
- wpc_functions.php +166 -10
- wpcentral.php +6 -4
actions.php
CHANGED
@@ -71,6 +71,8 @@ function wpc_site_actions(){
|
|
71 |
if(!empty($upgrade_error)){
|
72 |
$return['error'] = 'error: '.implode("\n", $upgrade_error);
|
73 |
}
|
|
|
|
|
74 |
}
|
75 |
|
76 |
if(wpc_optGET('plugins') || wpc_optGET('plugin')){
|
@@ -152,20 +154,33 @@ function wpc_site_actions(){
|
|
152 |
|
153 |
$plugin_name = urldecode(wpc_optREQ('plugin'));
|
154 |
$download_link = urldecode(wpc_optREQ('source'));
|
155 |
-
$site_url = urldecode(wpc_optREQ('siteurl'));
|
156 |
|
157 |
-
|
|
|
|
|
158 |
|
159 |
-
$
|
160 |
-
$
|
161 |
|
162 |
-
|
|
|
163 |
|
164 |
-
|
165 |
-
$res = wpc_unzip($download_dest, $unzip_dest);
|
166 |
-
}
|
167 |
|
168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
// Lets visit the installation once to make the changes in the database
|
171 |
$resp = wp_remote_get($site_url);
|
@@ -179,27 +194,30 @@ function wpc_site_actions(){
|
|
179 |
$themes = urldecode(wpc_optREQ('themes'));
|
180 |
$arr_themes = explode(',', $themes);
|
181 |
|
182 |
-
$active_theme = array_keys(wpc_get_active_theme());
|
183 |
-
|
184 |
-
//Do not activate/delete the theme if it is active
|
185 |
-
foreach($arr_themes as $tk => $tv){
|
186 |
-
if($active_theme[0] == $tv){
|
187 |
-
unset($arr_themes[$tk]);
|
188 |
-
}
|
189 |
-
}
|
190 |
|
191 |
if($request == 'activate' && count($arr_themes) == 1){//Activate
|
192 |
|
193 |
-
|
194 |
-
if(
|
195 |
-
$
|
196 |
-
|
197 |
-
|
198 |
-
|
|
|
|
|
|
|
199 |
}
|
200 |
|
201 |
}elseif($request == 'delete'){//Delete
|
202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
$res = wpc_delete_theme($arr_themes);
|
204 |
if(!empty($error)){
|
205 |
$return['error'] = $error;
|
@@ -238,23 +256,36 @@ function wpc_site_actions(){
|
|
238 |
$return['error'] = $error;
|
239 |
}
|
240 |
}elseif($request == 'update'){//Update Theme
|
241 |
-
|
242 |
$theme_name = urldecode(wpc_optREQ('theme'));
|
243 |
$download_link = urldecode(wpc_optREQ('source'));
|
244 |
-
$site_url = urldecode(wpc_optREQ('siteurl'));
|
245 |
|
246 |
-
|
|
|
|
|
247 |
|
248 |
-
$
|
249 |
-
$
|
250 |
|
251 |
-
|
|
|
252 |
|
253 |
-
|
254 |
-
$res = wpc_unzip($download_dest, $unzip_dest);
|
255 |
-
}
|
256 |
|
257 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
// Lets visit the installation once to make the changes in the database
|
260 |
$resp = wp_remote_get($site_url);
|
71 |
if(!empty($upgrade_error)){
|
72 |
$return['error'] = 'error: '.implode("\n", $upgrade_error);
|
73 |
}
|
74 |
+
|
75 |
+
$return['updatedto'] = wpc_version_wp();
|
76 |
}
|
77 |
|
78 |
if(wpc_optGET('plugins') || wpc_optGET('plugin')){
|
154 |
|
155 |
$plugin_name = urldecode(wpc_optREQ('plugin'));
|
156 |
$download_link = urldecode(wpc_optREQ('source'));
|
|
|
157 |
|
158 |
+
//For backward compatibility
|
159 |
+
if(!is_array($plugin_name)) $plugin_name = array($plugin_name);
|
160 |
+
if(!is_array($download_link)) $download_link = array($download_link);
|
161 |
|
162 |
+
$sources = urldecode(wpc_optREQ('sources'));
|
163 |
+
$arr_sources = explode(',', $sources);
|
164 |
|
165 |
+
$arr_plugins = array_merge($plugin_name, $arr_plugins);
|
166 |
+
$arr_sources = array_merge($download_link, $arr_sources);
|
167 |
|
168 |
+
$site_url = urldecode(wpc_optREQ('siteurl'));
|
|
|
|
|
169 |
|
170 |
+
foreach($arr_plugins as $plk => $plval){
|
171 |
+
$filename = basename(parse_url($arr_sources[$plk], PHP_URL_PATH));
|
172 |
+
|
173 |
+
$download_dest = $wp_config['uploads_dir'].'/'.$filename;
|
174 |
+
$unzip_dest = $wp_config['plugins_root_dir'];
|
175 |
+
|
176 |
+
wpc_get_web_file($arr_sources[$plk], $download_dest);
|
177 |
+
|
178 |
+
if(wpc_sfile_exists($download_dest)){
|
179 |
+
$res = wpc_unzip($download_dest, $unzip_dest);
|
180 |
+
}
|
181 |
+
|
182 |
+
@wpc_sunlink($download_dest);
|
183 |
+
}
|
184 |
|
185 |
// Lets visit the installation once to make the changes in the database
|
186 |
$resp = wp_remote_get($site_url);
|
194 |
$themes = urldecode(wpc_optREQ('themes'));
|
195 |
$arr_themes = explode(',', $themes);
|
196 |
|
197 |
+
$active_theme = array_keys(wpc_get_active_theme());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
|
199 |
if($request == 'activate' && count($arr_themes) == 1){//Activate
|
200 |
|
201 |
+
//Do not activate/delete the theme if it is active
|
202 |
+
if($active_theme[0] != $arr_themes[0]){
|
203 |
+
$res = wpc_activate_theme($arr_themes);
|
204 |
+
if(!empty($error)){
|
205 |
+
$return['error'] = $error;
|
206 |
+
}
|
207 |
+
if(!$res){
|
208 |
+
$return['error'] = $l['err_activating_theme'];
|
209 |
+
}
|
210 |
}
|
211 |
|
212 |
}elseif($request == 'delete'){//Delete
|
213 |
+
|
214 |
+
//Do not delete the theme if it is active
|
215 |
+
foreach($arr_themes as $tk => $tv){
|
216 |
+
if($active_theme[0] == $tv){
|
217 |
+
unset($arr_themes[$tk]);
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
$res = wpc_delete_theme($arr_themes);
|
222 |
if(!empty($error)){
|
223 |
$return['error'] = $error;
|
256 |
$return['error'] = $error;
|
257 |
}
|
258 |
}elseif($request == 'update'){//Update Theme
|
259 |
+
|
260 |
$theme_name = urldecode(wpc_optREQ('theme'));
|
261 |
$download_link = urldecode(wpc_optREQ('source'));
|
|
|
262 |
|
263 |
+
//For backward compatibility
|
264 |
+
if(!is_array($theme_name)) $theme_name = array($theme_name);
|
265 |
+
if(!is_array($download_link)) $download_link = array($download_link);
|
266 |
|
267 |
+
$sources = urldecode(wpc_optREQ('sources'));
|
268 |
+
$arr_sources = explode(',', $sources);
|
269 |
|
270 |
+
$arr_themes = array_merge($theme_name, $arr_themes);
|
271 |
+
$arr_sources = array_merge($download_link, $arr_sources);
|
272 |
|
273 |
+
$site_url = urldecode(wpc_optREQ('siteurl'));
|
|
|
|
|
274 |
|
275 |
+
foreach($arr_themes as $thk => $thval){
|
276 |
+
$filename = basename(parse_url($arr_sources[$thk], PHP_URL_PATH));
|
277 |
+
|
278 |
+
$download_dest = $wp_config['uploads_dir'].'/'.$filename;
|
279 |
+
$unzip_dest = $wp_config['themes_root_dir'];
|
280 |
+
|
281 |
+
wpc_get_web_file($arr_sources[$thk], $download_dest);
|
282 |
+
|
283 |
+
if(wpc_sfile_exists($download_dest)){
|
284 |
+
$res = wpc_unzip($download_dest, $unzip_dest);
|
285 |
+
}
|
286 |
+
|
287 |
+
@wpc_sunlink($download_dest);
|
288 |
+
}
|
289 |
|
290 |
// Lets visit the installation once to make the changes in the database
|
291 |
$resp = wp_remote_get($site_url);
|
file_actions.php
CHANGED
@@ -46,7 +46,7 @@ function wpc_file_actions(){
|
|
46 |
}else{
|
47 |
$func_response = call_user_func('wpc_'.$action);
|
48 |
}
|
49 |
-
|
50 |
|
51 |
if($func_response){
|
52 |
$return['done'] = $l['done'];
|
46 |
}else{
|
47 |
$func_response = call_user_func('wpc_'.$action);
|
48 |
}
|
49 |
+
$return['func_response'] = $func_response;
|
50 |
|
51 |
if($func_response){
|
52 |
$return['done'] = $l['done'];
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: softaculous
|
3 |
Tags: wpcentral, softaculous, sites, manage sites, backup, plugins, themes, manage wordpress,
|
4 |
Requires at least: 4.4
|
5 |
-
Tested up to: 5.
|
6 |
Requires PHP: 5.3
|
7 |
-
Stable tag: 1.4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -40,6 +40,12 @@ Should you have any suggestions to improve wpcentral, want to see some related f
|
|
40 |
|
41 |
== Changelog ==
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
= 1.4.2 =
|
44 |
* Added 1-click website connection utility.
|
45 |
* Added rename file function.
|
2 |
Contributors: softaculous
|
3 |
Tags: wpcentral, softaculous, sites, manage sites, backup, plugins, themes, manage wordpress,
|
4 |
Requires at least: 4.4
|
5 |
+
Tested up to: 5.2
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 1.4.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
40 |
|
41 |
== Changelog ==
|
42 |
|
43 |
+
= 1.4.3 =
|
44 |
+
* wpCentral notice on admin panel can now be dismissed manually.
|
45 |
+
* Added remove directory file function.
|
46 |
+
* Improved plugins/themes update code.
|
47 |
+
* Function to fetch wpCentral installed plugin version.
|
48 |
+
|
49 |
= 1.4.2 =
|
50 |
* Added 1-click website connection utility.
|
51 |
* Added rename file function.
|
verify.php
CHANGED
@@ -37,6 +37,8 @@ function wpc_verify($auth_key = ''){
|
|
37 |
$site_settings['wpc_backupdir'] = $wp_config['plugins_root_dir'].'/wp-central/'.(!empty($auth_key) ? $auth_key : wpc_optREQ('auth_key'));
|
38 |
|
39 |
$site_settings['createdir'] = wpc_can_createdir($site_settings['wpc_backupdir']);
|
|
|
|
|
40 |
|
41 |
$return['data'] = $site_settings;
|
42 |
|
37 |
$site_settings['wpc_backupdir'] = $wp_config['plugins_root_dir'].'/wp-central/'.(!empty($auth_key) ? $auth_key : wpc_optREQ('auth_key'));
|
38 |
|
39 |
$site_settings['createdir'] = wpc_can_createdir($site_settings['wpc_backupdir']);
|
40 |
+
|
41 |
+
$site_settings['wpc_ver'] = wpc_fetch_version();
|
42 |
|
43 |
$return['data'] = $site_settings;
|
44 |
|
wpc_functions.php
CHANGED
@@ -220,7 +220,7 @@ function wpc_filelist($startdir="./", $searchSubdirs=1, $directoriesonly=0, $max
|
|
220 |
$directorylist[$startdir . $file]['path'] = $startdir;
|
221 |
if ($searchSubdirs) {
|
222 |
if ((($maxlevel) == "all") or ($maxlevel > $level)) {
|
223 |
-
|
224 |
}
|
225 |
}
|
226 |
|
@@ -1947,6 +1947,22 @@ function wpc_delete($filename){
|
|
1947 |
return wpc_sunlink($filename);
|
1948 |
}
|
1949 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1950 |
/**
|
1951 |
* Used in file_functions to perform backup
|
1952 |
*
|
@@ -2046,7 +2062,7 @@ function wpc_fetch_authkey(){
|
|
2046 |
function wpc_deactivation_hook(){
|
2047 |
delete_option('wpcentral_auth_key');
|
2048 |
delete_option('wpcentral_connected');
|
2049 |
-
|
2050 |
return true;
|
2051 |
}
|
2052 |
|
@@ -2284,6 +2300,7 @@ function wpc_parse_update_plugins($updates){
|
|
2284 |
function wpc_deactivate(){
|
2285 |
delete_option('wpcentral_auth_key');
|
2286 |
delete_option('wpcentral_connected');
|
|
|
2287 |
}
|
2288 |
|
2289 |
/**
|
@@ -2294,18 +2311,20 @@ function wpc_deactivate(){
|
|
2294 |
*/
|
2295 |
function wpc_authorize(){
|
2296 |
global $l, $error;
|
|
|
|
|
2297 |
|
2298 |
$auth_key = wpc_optREQ('auth_key');
|
2299 |
if(empty($auth_key)){
|
2300 |
-
$error = 'Unauthorized Access!!';
|
2301 |
-
echo json_encode($
|
2302 |
die();
|
2303 |
}
|
2304 |
|
2305 |
$verify_authkey = wpc_get_option('wpcentral_auth_key');
|
2306 |
if($auth_key != $verify_authkey){
|
2307 |
-
$error = $l['invalid_auth_key'];
|
2308 |
-
echo json_encode($
|
2309 |
die();
|
2310 |
}
|
2311 |
}
|
@@ -2413,6 +2432,10 @@ function my_wpc_actions_init(){
|
|
2413 |
case 'can_createdir':
|
2414 |
wpc_can_createdir();
|
2415 |
break;
|
|
|
|
|
|
|
|
|
2416 |
}
|
2417 |
}
|
2418 |
|
@@ -2446,6 +2469,29 @@ function wpc_can_createdir($path = ''){
|
|
2446 |
return $resp;
|
2447 |
}
|
2448 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2449 |
/**
|
2450 |
* Provides access to the website's admin panel
|
2451 |
*
|
@@ -2486,6 +2532,46 @@ function wpc_get_curr_user_role(){
|
|
2486 |
return wp_get_current_user()->roles[0];
|
2487 |
}
|
2488 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2489 |
/**
|
2490 |
* Display wpCentral notice in dashboard
|
2491 |
*
|
@@ -2498,6 +2584,18 @@ function wpc_admin_notice(){
|
|
2498 |
if($role == 'administrator' && !wpc_get_option('wpcentral_connected')){
|
2499 |
|
2500 |
echo '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2501 |
<style>
|
2502 |
.wpc_sub_head{
|
2503 |
font-size: 20px !important;
|
@@ -2581,15 +2679,15 @@ function wpc_admin_notice(){
|
|
2581 |
}
|
2582 |
</style>
|
2583 |
|
2584 |
-
<div class="updated wpc_notice">
|
2585 |
<div style="width:100%; padding-top:10px;">
|
2586 |
<div class="wpc_main_head">
|
2587 |
-
<img src="
|
2588 |
-
<img src="
|
2589 |
</div><br />
|
2590 |
<div class="wpc_row">
|
2591 |
<div class="wpc_head wpc_col-sm-3"><b>Website URL:</b></div>
|
2592 |
-
<div class="wpc_col-sm-8">'.get_option('siteurl').'</div>
|
2593 |
</div><br /><br />
|
2594 |
<div class="wpc_row">
|
2595 |
<div class="wpc_head wpc_col-sm-3"><b>wpCentral Connection Key:</b></div>
|
@@ -2614,4 +2712,62 @@ function wpc_admin_notice(){
|
|
2614 |
</div>
|
2615 |
</div>';
|
2616 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2617 |
}
|
220 |
$directorylist[$startdir . $file]['path'] = $startdir;
|
221 |
if ($searchSubdirs) {
|
222 |
if ((($maxlevel) == "all") or ($maxlevel > $level)) {
|
223 |
+
wpc_filelist($startdir . $file . "/", $searchSubdirs, $directoriesonly, $maxlevel, ($level + 1), 0);
|
224 |
}
|
225 |
}
|
226 |
|
1947 |
return wpc_sunlink($filename);
|
1948 |
}
|
1949 |
|
1950 |
+
/**
|
1951 |
+
* Removes a directory
|
1952 |
+
*
|
1953 |
+
* @param string $directory path
|
1954 |
+
* @returns bool
|
1955 |
+
* @since 1.4.3
|
1956 |
+
*/
|
1957 |
+
function wpc_srm($path){
|
1958 |
+
|
1959 |
+
if(is_dir($path)){
|
1960 |
+
return wpc_rmdir_recursive($path);
|
1961 |
+
}
|
1962 |
+
// So its a file !
|
1963 |
+
return wpc_sunlink($path);
|
1964 |
+
}
|
1965 |
+
|
1966 |
/**
|
1967 |
* Used in file_functions to perform backup
|
1968 |
*
|
2062 |
function wpc_deactivation_hook(){
|
2063 |
delete_option('wpcentral_auth_key');
|
2064 |
delete_option('wpcentral_connected');
|
2065 |
+
delete_option('wpc_dismiss_notice_date');
|
2066 |
return true;
|
2067 |
}
|
2068 |
|
2300 |
function wpc_deactivate(){
|
2301 |
delete_option('wpcentral_auth_key');
|
2302 |
delete_option('wpcentral_connected');
|
2303 |
+
delete_option('wpc_dismiss_notice_date');
|
2304 |
}
|
2305 |
|
2306 |
/**
|
2311 |
*/
|
2312 |
function wpc_authorize(){
|
2313 |
global $l, $error;
|
2314 |
+
|
2315 |
+
$return = array();
|
2316 |
|
2317 |
$auth_key = wpc_optREQ('auth_key');
|
2318 |
if(empty($auth_key)){
|
2319 |
+
$return['error'] = 'Unauthorized Access!!';
|
2320 |
+
echo json_encode($return);
|
2321 |
die();
|
2322 |
}
|
2323 |
|
2324 |
$verify_authkey = wpc_get_option('wpcentral_auth_key');
|
2325 |
if($auth_key != $verify_authkey){
|
2326 |
+
$return['error'] = $l['invalid_auth_key'];
|
2327 |
+
echo json_encode($return);
|
2328 |
die();
|
2329 |
}
|
2330 |
}
|
2432 |
case 'can_createdir':
|
2433 |
wpc_can_createdir();
|
2434 |
break;
|
2435 |
+
|
2436 |
+
case 'wpcentral_version':
|
2437 |
+
wpc_fetch_version();
|
2438 |
+
break;
|
2439 |
}
|
2440 |
}
|
2441 |
|
2469 |
return $resp;
|
2470 |
}
|
2471 |
|
2472 |
+
/**
|
2473 |
+
* Fetch the installed version of wpcentral plugin in the website
|
2474 |
+
*
|
2475 |
+
* @returns string wpcentral version number
|
2476 |
+
* @since 1.4.3
|
2477 |
+
*/
|
2478 |
+
function wpc_fetch_version(){
|
2479 |
+
global $wp_config;
|
2480 |
+
|
2481 |
+
$plugin_data = wpc_get_plugin_data($wp_config['plugins_root_dir'].'/wp-central/wpcentral.php');
|
2482 |
+
|
2483 |
+
$wpc_version = $plugin_data['Version'];
|
2484 |
+
|
2485 |
+
if(isset($_GET['callfetch'])){
|
2486 |
+
$return = array();
|
2487 |
+
$return['wpc_ver'] = $wpc_version;
|
2488 |
+
|
2489 |
+
echo json_encode($return);
|
2490 |
+
}
|
2491 |
+
|
2492 |
+
return $wpc_version;
|
2493 |
+
}
|
2494 |
+
|
2495 |
/**
|
2496 |
* Provides access to the website's admin panel
|
2497 |
*
|
2532 |
return wp_get_current_user()->roles[0];
|
2533 |
}
|
2534 |
|
2535 |
+
/**
|
2536 |
+
* Dismiss wpCentral notice and save the dismiss date.
|
2537 |
+
*
|
2538 |
+
* @since 1.4.3
|
2539 |
+
*/
|
2540 |
+
function wpc_dismiss_notice(){
|
2541 |
+
|
2542 |
+
$wpc_dismissable_notice_date = get_option('wpc_dismiss_notice_date');
|
2543 |
+
|
2544 |
+
if(empty($wpc_dismissable_notice_date)){
|
2545 |
+
add_option('wpc_dismiss_notice_date', date('Y-m-d'));
|
2546 |
+
}else{
|
2547 |
+
update_option('wpc_dismiss_notice_date', date('Y-m-d'));
|
2548 |
+
}
|
2549 |
+
}
|
2550 |
+
|
2551 |
+
/**
|
2552 |
+
* Display wpCentral notice on the basis of last dismiss date. When user manually dismisses the notice, it remains for 1 month
|
2553 |
+
*
|
2554 |
+
* @since 1.4.3
|
2555 |
+
*/
|
2556 |
+
function wpc_is_display_notice(){
|
2557 |
+
|
2558 |
+
$wpc_dismissable_notice_date = get_option('wpc_dismiss_notice_date');
|
2559 |
+
|
2560 |
+
if(empty($wpc_dismissable_notice_date)){
|
2561 |
+
return true;
|
2562 |
+
}
|
2563 |
+
|
2564 |
+
$wpc_dismissable_notice_date2 = new DateTime($wpc_dismissable_notice_date);
|
2565 |
+
$current_date = new DateTime(date('Y-m-d'));
|
2566 |
+
$date_diff_month = $wpc_dismissable_notice_date2->diff($current_date);
|
2567 |
+
|
2568 |
+
//Do not display notice again for a month
|
2569 |
+
if($date_diff_month->m < 1){
|
2570 |
+
return false;
|
2571 |
+
}
|
2572 |
+
|
2573 |
+
return true;
|
2574 |
+
}
|
2575 |
/**
|
2576 |
* Display wpCentral notice in dashboard
|
2577 |
*
|
2584 |
if($role == 'administrator' && !wpc_get_option('wpcentral_connected')){
|
2585 |
|
2586 |
echo '
|
2587 |
+
<script type="text/javascript">
|
2588 |
+
jQuery(document).ready(function(){
|
2589 |
+
jQuery(document).on("click", ".my-wpc-dismiss-notice .notice-dismiss", function(){
|
2590 |
+
var data = {
|
2591 |
+
action: "wpc_dismissnotice"
|
2592 |
+
};
|
2593 |
+
var site_url = jQuery(".wpc_siteurl").text()+"/wp-admin/admin-ajax.php";
|
2594 |
+
jQuery.post(site_url, data, function(response){
|
2595 |
+
});
|
2596 |
+
});
|
2597 |
+
});
|
2598 |
+
</script>
|
2599 |
<style>
|
2600 |
.wpc_sub_head{
|
2601 |
font-size: 20px !important;
|
2679 |
}
|
2680 |
</style>
|
2681 |
|
2682 |
+
<div class="updated wpc_notice notice notice-success my-wpc-dismiss-notice is-dismissible">
|
2683 |
<div style="width:100%; padding-top:10px;">
|
2684 |
<div class="wpc_main_head">
|
2685 |
+
<img src="https://wpcentral.co/images/icon_dark.png" style="height:40px; padding:5px 0;">
|
2686 |
+
<img src="https://wpcentral.co/images/logo_dark.png" alt="wpcentral" title="wpcentral" style="height:40px; padding:5px 0;">
|
2687 |
</div><br />
|
2688 |
<div class="wpc_row">
|
2689 |
<div class="wpc_head wpc_col-sm-3"><b>Website URL:</b></div>
|
2690 |
+
<div class="wpc_col-sm-8 wpc_siteurl">'.get_option('siteurl').'</div>
|
2691 |
</div><br /><br />
|
2692 |
<div class="wpc_row">
|
2693 |
<div class="wpc_head wpc_col-sm-3"><b>wpCentral Connection Key:</b></div>
|
2712 |
</div>
|
2713 |
</div>';
|
2714 |
}
|
2715 |
+
}
|
2716 |
+
|
2717 |
+
/* Removes a Directory Recursively
|
2718 |
+
*
|
2719 |
+
* @param string $path The path of the folder to be removed
|
2720 |
+
* @return boolean
|
2721 |
+
* @since 1.4.3
|
2722 |
+
*/
|
2723 |
+
function wpc_rmdir_recursive($path){
|
2724 |
+
if(!wpc_is_safe_file($path)) return false;
|
2725 |
+
|
2726 |
+
$path = (substr($path, -1) == '/' || substr($path, -1) == '\\' ? $path : $path.'/');
|
2727 |
+
|
2728 |
+
wpc_resetfilelist();
|
2729 |
+
|
2730 |
+
$files = wpc_filelist($path, 1, 0, 'all');
|
2731 |
+
$files = (!is_array($files) ? array() : $files);
|
2732 |
+
|
2733 |
+
//First delete the files only
|
2734 |
+
foreach($files as $k => $v){
|
2735 |
+
if(wpc_is_safe_file($k)){
|
2736 |
+
@chmod($k, 0777);
|
2737 |
+
}
|
2738 |
+
if(file_exists($k) && is_file($k) && @filetype($k) == "file"){
|
2739 |
+
@unlink($k);
|
2740 |
+
}
|
2741 |
+
}
|
2742 |
+
|
2743 |
+
@clearstatcache();
|
2744 |
+
|
2745 |
+
$folders = wpc_filelist($path, 1, 1, 'all');
|
2746 |
+
$folders = (!is_array($folders) ? array() : $folders);
|
2747 |
+
@krsort($folders);
|
2748 |
+
|
2749 |
+
//Now Delete the FOLDERS
|
2750 |
+
foreach($folders as $k => $v){
|
2751 |
+
if(wpc_is_safe_file($k)){
|
2752 |
+
@chmod($k, 0777);
|
2753 |
+
}
|
2754 |
+
if(is_dir($k)){
|
2755 |
+
@rmdir($k);
|
2756 |
+
}
|
2757 |
+
}
|
2758 |
+
|
2759 |
+
@rmdir($path);
|
2760 |
+
|
2761 |
+
@clearstatcache();
|
2762 |
+
|
2763 |
+
return true;
|
2764 |
+
}
|
2765 |
+
|
2766 |
+
/* A Function that reset lists files
|
2767 |
+
*
|
2768 |
+
* @since 1.4.3
|
2769 |
+
*/
|
2770 |
+
function wpc_resetfilelist(){
|
2771 |
+
global $directorylist;
|
2772 |
+
$directorylist = array();
|
2773 |
}
|
wpcentral.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: wpCentral
|
4 |
Plugin URI: https://wpcentral.co
|
5 |
Description: wpCentral provides a centralized area where you can manage all your WordPress websites singularly, unitedly as well as efficiently.
|
6 |
-
Version: 1.4.
|
7 |
Author: Softaculous Ltd.
|
8 |
Author URI: https://wpcentral.co
|
9 |
License: GPL2
|
@@ -49,9 +49,11 @@ if(is_plugin_active($wpc_slug)){
|
|
49 |
add_action( 'plugins_loaded', 'wpc_load_plugin' );
|
50 |
|
51 |
include_once(ABSPATH.'wp-includes/pluggable.php');
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
55 |
add_action('wp_ajax_nopriv_my_wpc_actions', 'my_wpc_actions_init');
|
56 |
|
57 |
if(is_user_logged_in()){
|
3 |
Plugin Name: wpCentral
|
4 |
Plugin URI: https://wpcentral.co
|
5 |
Description: wpCentral provides a centralized area where you can manage all your WordPress websites singularly, unitedly as well as efficiently.
|
6 |
+
Version: 1.4.3
|
7 |
Author: Softaculous Ltd.
|
8 |
Author URI: https://wpcentral.co
|
9 |
License: GPL2
|
49 |
add_action( 'plugins_loaded', 'wpc_load_plugin' );
|
50 |
|
51 |
include_once(ABSPATH.'wp-includes/pluggable.php');
|
52 |
+
|
53 |
+
if(wpc_is_display_notice()){
|
54 |
+
add_action('admin_notices', 'wpc_admin_notice');
|
55 |
+
}
|
56 |
+
add_action('wp_ajax_wpc_dismissnotice', 'wpc_dismiss_notice');
|
57 |
add_action('wp_ajax_nopriv_my_wpc_actions', 'my_wpc_actions_init');
|
58 |
|
59 |
if(is_user_logged_in()){
|