Version Description
- Resolved the bug in plugin activation after installation using Plugin Sets.
Download this release
Release Info
Developer | softacpriya |
Plugin | wpCentral |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.3
- actions.php +7 -14
- readme.txt +4 -1
- wpc_functions.php +117 -0
- wpcentral.php +1 -1
actions.php
CHANGED
@@ -107,6 +107,8 @@ function wpc_site_actions(){
|
|
107 |
$sources = urldecode($_REQUEST['sources']);
|
108 |
$arr_sources = explode(',', $sources);
|
109 |
|
|
|
|
|
110 |
foreach($arr_plugins as $plk => $plval){
|
111 |
|
112 |
//Skip if the plugin is already installed
|
@@ -127,21 +129,12 @@ function wpc_site_actions(){
|
|
127 |
|
128 |
@wpc_sunlink($download_dest);
|
129 |
|
130 |
-
//Activate the installed plugin
|
131 |
-
$all_installed_plugins =
|
132 |
-
$slugs = array_keys($all_installed_plugins);
|
133 |
-
|
134 |
-
$plugin_slug = '';
|
135 |
-
//Fetch slug of the installed plugin
|
136 |
-
foreach($slugs as $val){
|
137 |
-
if(strpos($val, $plval) !== false){
|
138 |
-
$plugin_slug = $val;
|
139 |
-
break;
|
140 |
-
}
|
141 |
-
}
|
142 |
-
|
143 |
-
wpc_activate_plugin(array($plugin_slug));
|
144 |
}
|
|
|
|
|
|
|
145 |
|
146 |
if(!empty($error)){
|
147 |
$return['error'] = $error;
|
107 |
$sources = urldecode($_REQUEST['sources']);
|
108 |
$arr_sources = explode(',', $sources);
|
109 |
|
110 |
+
$all_installed_plugins = array();
|
111 |
+
|
112 |
foreach($arr_plugins as $plk => $plval){
|
113 |
|
114 |
//Skip if the plugin is already installed
|
129 |
|
130 |
@wpc_sunlink($download_dest);
|
131 |
|
132 |
+
//Activate the installed plugin(s)
|
133 |
+
$all_installed_plugins[] = wpc_get_plugin_path(ABSPATH.'wp-content/plugins/'.$plval, $plval);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
135 |
+
|
136 |
+
//Activate the installed plugins
|
137 |
+
wpc_activate_plugin($all_installed_plugins);
|
138 |
|
139 |
if(!empty($error)){
|
140 |
$return['error'] = $error;
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: wpcentral, softaculous, sites, manage sites, backup, plugins, themes, mana
|
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 4.9.8
|
6 |
Requires PHP: 5.3
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -40,6 +40,9 @@ Should you have any suggestions to improve wpcentral, want to see some related f
|
|
40 |
|
41 |
== Changelog ==
|
42 |
|
|
|
|
|
|
|
43 |
= 1.2 =
|
44 |
* Changes to the handling of connection key.
|
45 |
* WPCentral plugin can now be installed to your website via https://panel.wpcentral.co using your website's admin credentials.
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 4.9.8
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 1.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.3 =
|
44 |
+
* Resolved the bug in plugin activation after installation using Plugin Sets.
|
45 |
+
|
46 |
= 1.2 =
|
47 |
* Changes to the handling of connection key.
|
48 |
* WPCentral plugin can now be installed to your website via https://panel.wpcentral.co using your website's admin credentials.
|
wpc_functions.php
CHANGED
@@ -133,6 +133,123 @@ function wpc_activate_plugin($plugin_slug = array()){
|
|
133 |
return $res;
|
134 |
}
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
/**
|
137 |
* De-activates the plugins on the website
|
138 |
*
|
133 |
return $res;
|
134 |
}
|
135 |
|
136 |
+
/**
|
137 |
+
* Fetch the plugin's main file to generate the plugin slug
|
138 |
+
*
|
139 |
+
* @param string $path path of the plugin directory
|
140 |
+
* @param string $slug directory name of the plugin
|
141 |
+
* @since 1.3
|
142 |
+
*/
|
143 |
+
function wpc_get_plugin_path($path, $slug){
|
144 |
+
global $__settings;
|
145 |
+
|
146 |
+
$path = wpc_cleanpath($path);
|
147 |
+
|
148 |
+
if(wpc_sfile_exists($__settings['softpath'].'/wp-content/plugins/'.$slug.'/'.$slug.'.php')){
|
149 |
+
return $plugin_path = $slug.'/'.$slug.'.php';
|
150 |
+
}
|
151 |
+
|
152 |
+
$list = wpc_filelist($path, 0);
|
153 |
+
$plugin_files = array();
|
154 |
+
|
155 |
+
foreach($list as $lk => $lv){
|
156 |
+
if(!is_dir($lk)){
|
157 |
+
$plugin_files[basename($lk)] = $lk;
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
foreach($plugin_files as $pk => $pv){
|
162 |
+
$data = wpc_sfile($pv);
|
163 |
+
if(preg_match('/\n(\s*?)(\*?)(\s*?)Plugin(\s*?)Name:(.*?)\n/is',$data)){
|
164 |
+
return $plugin_path = $slug.'/'.$pk;
|
165 |
+
break;
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
return $plugin_path = $slug.'/'.$slug.'.php';
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Replaces '\\' with '/' and Truncates / at the end.
|
174 |
+
* e.g. E:\\path is converted to E:/path
|
175 |
+
*
|
176 |
+
* @param string $path
|
177 |
+
* @returns string The new path which works everywhere !
|
178 |
+
* @since 1.3
|
179 |
+
*/
|
180 |
+
function wpc_cleanpath($path){
|
181 |
+
|
182 |
+
$path = str_replace('\\\\', '/', $path);
|
183 |
+
$path = str_replace('\\', '/', $path);
|
184 |
+
return rtrim($path, '/');
|
185 |
+
}
|
186 |
+
|
187 |
+
/* The below function will list all folders and files within a directory
|
188 |
+
*
|
189 |
+
* @param string $startdir specify the directory to start from; format: must end in a "/"
|
190 |
+
* @param bool $searchSubdirs True if you want to search subdirectories
|
191 |
+
* @param bool $directoriesonly True if you want to only return directories
|
192 |
+
* @param $maxlevel "all" or a number; specifies the number of directories down that you want to search
|
193 |
+
* @param integer $level directory level that the function is currently searching
|
194 |
+
* @since 1.3
|
195 |
+
*/
|
196 |
+
function wpc_filelist($startdir="./", $searchSubdirs=1, $directoriesonly=0, $maxlevel="all", $level=1, $reset = 1) {
|
197 |
+
//list the directory/file names that you want to ignore
|
198 |
+
$ignoredDirectory = array();
|
199 |
+
$ignoredDirectory[] = ".";
|
200 |
+
$ignoredDirectory[] = "..";
|
201 |
+
$ignoredDirectory[] = "_vti_cnf";
|
202 |
+
global $directorylist; //initialize global array
|
203 |
+
|
204 |
+
if(substr($startdir, -1) != '/'){
|
205 |
+
$startdir = $startdir.'/';
|
206 |
+
}
|
207 |
+
|
208 |
+
if (is_dir($startdir)) {
|
209 |
+
if ($dh = opendir($startdir)) {
|
210 |
+
while (($file = readdir($dh)) !== false) {
|
211 |
+
if (!(array_search($file,$ignoredDirectory) > -1)) {
|
212 |
+
if (@filetype($startdir . $file) == "dir") {
|
213 |
+
|
214 |
+
//build your directory array however you choose;
|
215 |
+
//add other file details that you want.
|
216 |
+
|
217 |
+
$directorylist[$startdir . $file]['level'] = $level;
|
218 |
+
$directorylist[$startdir . $file]['dir'] = 1;
|
219 |
+
$directorylist[$startdir . $file]['name'] = $file;
|
220 |
+
$directorylist[$startdir . $file]['path'] = $startdir;
|
221 |
+
if ($searchSubdirs) {
|
222 |
+
if ((($maxlevel) == "all") or ($maxlevel > $level)) {
|
223 |
+
filelist_fn($startdir . $file . "/", $searchSubdirs, $directoriesonly, $maxlevel, ($level + 1), 0);
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
|
228 |
+
} else {
|
229 |
+
if (!$directoriesonly) {
|
230 |
+
|
231 |
+
// echo substr(strrchr($file, "."), 1);
|
232 |
+
//if you want to include files; build your file array
|
233 |
+
//however you choose; add other file details that you want.
|
234 |
+
$directorylist[$startdir . $file]['level'] = $level;
|
235 |
+
$directorylist[$startdir . $file]['dir'] = 0;
|
236 |
+
$directorylist[$startdir . $file]['name'] = $file;
|
237 |
+
$directorylist[$startdir . $file]['path'] = $startdir;
|
238 |
+
}
|
239 |
+
}
|
240 |
+
}
|
241 |
+
}
|
242 |
+
closedir($dh);
|
243 |
+
}
|
244 |
+
}
|
245 |
+
|
246 |
+
if(!empty($reset)){
|
247 |
+
$r = $directorylist;
|
248 |
+
$directorylist = array();
|
249 |
+
return($r);
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
/**
|
254 |
* De-activates the plugins on the website
|
255 |
*
|
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.
|
7 |
Author: Softaculous Ltd.
|
8 |
Author URI:
|
9 |
License: GPL2
|
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.3
|
7 |
Author: Softaculous Ltd.
|
8 |
Author URI:
|
9 |
License: GPL2
|