wpCentral - Version 1.2

Version Description

  • Changes to the handling of connection key.
  • WPCentral plugin can now be installed to your website via https://panel.wpcentral.co using your website's admin credentials.
Download this release

Release Info

Developer softacpriya
Plugin Icon 128x128 wpCentral
Version 1.2
Comparing to
See all releases

Code changes from version 1.1 to 1.2

Files changed (4) hide show
  1. readme.txt +5 -1
  2. verify.php +4 -2
  3. wpc_functions.php +29 -2
  4. wpcentral.php +19 -16
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.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -40,6 +40,10 @@ Should you have any suggestions to improve wpcentral, want to see some related f
40
 
41
  == Changelog ==
42
 
 
 
 
 
43
  = 1.1 =
44
  * Hide Plugin Notice from website's dashboard on website connection/addition to https://panel.wpcentral.co
45
  * Hide Plugin Notice for users not having 'Administrator' role.
4
  Requires at least: 4.4
5
  Tested up to: 4.9.8
6
  Requires PHP: 5.3
7
+ Stable tag: 1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
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.
46
+
47
  = 1.1 =
48
  * Hide Plugin Notice from website's dashboard on website connection/addition to https://panel.wpcentral.co
49
  * Hide Plugin Notice for users not having 'Administrator' role.
verify.php CHANGED
@@ -4,7 +4,7 @@ if (!defined('ABSPATH')){
4
  exit;
5
  }
6
 
7
- function wpc_verify(){
8
  global $l, $wpdb, $wp_version, $wp_config, $error;
9
 
10
  $return = array();
@@ -20,6 +20,8 @@ function wpc_verify(){
20
  $site_settings['softdbpass'] = $wp_config['softdbpass'];
21
  $site_settings['dbprefix'] = $wp_config['dbprefix'];
22
  $site_settings['site_name'] = get_option('blogname');
 
 
23
 
24
  //Fetch all the table names
25
  $sql = "SHOW TABLES FROM ".$wp_config['softdb'];
@@ -32,7 +34,7 @@ function wpc_verify(){
32
  }
33
  }
34
 
35
- $site_settings['backup_directory'] = $wp_config['plugins_root_dir'].'/wp-central/'.wpc_srandstr(64);
36
 
37
  $return['data'] = $site_settings;
38
 
4
  exit;
5
  }
6
 
7
+ function wpc_verify($auth_key = ''){
8
  global $l, $wpdb, $wp_version, $wp_config, $error;
9
 
10
  $return = array();
20
  $site_settings['softdbpass'] = $wp_config['softdbpass'];
21
  $site_settings['dbprefix'] = $wp_config['dbprefix'];
22
  $site_settings['site_name'] = get_option('blogname');
23
+
24
+ $site_settings['auth_key'] = (!empty($auth_key) ? $auth_key : '');
25
 
26
  //Fetch all the table names
27
  $sql = "SHOW TABLES FROM ".$wp_config['softdb'];
34
  }
35
  }
36
 
37
+ $site_settings['wpc_backupdir'] = $wp_config['plugins_root_dir'].'/wp-central/'.wpc_srandstr(64);
38
 
39
  $return['data'] = $site_settings;
40
 
wpc_functions.php CHANGED
@@ -1894,7 +1894,7 @@ function wpc_get_connection_key($force = ''){
1894
 
1895
  $conn_key = wpc_get_option('wpcentral_auth_key');
1896
 
1897
- if(empty($conn_key) || $force){
1898
  $conn_key = wpc_srandstr(128);
1899
  update_option('wpcentral_auth_key', $conn_key, true);
1900
  }
@@ -1903,7 +1903,7 @@ function wpc_get_connection_key($force = ''){
1903
  }
1904
 
1905
  /**
1906
- * Calls to generate the connection key on plugin activation
1907
  *
1908
  * @returns string $conn_key
1909
  * @since 1.0
@@ -1912,6 +1912,33 @@ function wpc_activation_hook(){
1912
  return wpc_get_connection_key(1);
1913
  }
1914
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1915
  /**
1916
  * Deletes the connection key on plugin deactivation
1917
  *
1894
 
1895
  $conn_key = wpc_get_option('wpcentral_auth_key');
1896
 
1897
+ if(empty($conn_key) || (!empty($conn_key) && strlen($conn_key) != 128) || $force){
1898
  $conn_key = wpc_srandstr(128);
1899
  update_option('wpcentral_auth_key', $conn_key, true);
1900
  }
1903
  }
1904
 
1905
  /**
1906
+ * Generate the connection key on plugin activation
1907
  *
1908
  * @returns string $conn_key
1909
  * @since 1.0
1912
  return wpc_get_connection_key(1);
1913
  }
1914
 
1915
+ /**
1916
+ * Generate the connection key when the plugin loads after its activation.
1917
+ *
1918
+ * @returns string $conn_key
1919
+ * @since 1.2
1920
+ */
1921
+ function wpc_load_plugin(){
1922
+ return wpc_get_connection_key();
1923
+ }
1924
+
1925
+ /**
1926
+ * Fetch the connection key and the site details when the plugin is installed and activated from wpcentral panel.
1927
+ *
1928
+ * @since 1.2
1929
+ */
1930
+ function wpc_fetch_authkey(){
1931
+ global $l, $error, $wp_config, $wpdb;
1932
+
1933
+ //Fetch WP Configuration details
1934
+ $wp_config = wpc_fetch_wp_config();
1935
+
1936
+ $wpc_authkey = wpc_get_connection_key();
1937
+
1938
+ include_once('verify.php');
1939
+ wpc_verify($wpc_authkey);
1940
+ }
1941
+
1942
  /**
1943
  * Deletes the connection key on plugin deactivation
1944
  *
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.1
7
  Author: Softaculous Ltd.
8
  Author URI:
9
  License: GPL2
@@ -43,21 +43,24 @@ register_deactivation_hook(__FILE__, 'wpc_deactivation_hook');
43
 
44
  //Add link to show the Connection key once the plugin is activated
45
  if(is_plugin_active($wpc_slug)){
46
- add_action('admin_init', 'wpc_enqueue_script');
47
- add_action('admin_init', 'wpc_enqueue_styles');
48
- add_filter('plugin_row_meta', 'wpc_add_connection_link', 10, 2);
49
- add_action('admin_head', 'wpc_modal_open_script');
50
- add_action('admin_footer', 'wpc_modal_dialog');
 
 
51
 
52
- include_once(ABSPATH.'wp-includes/pluggable.php');
53
-
54
- add_action('admin_notices', 'wpc_admin_notice');
55
-
56
- add_action('wp_ajax_nopriv_my_wpc_actions', 'my_wpc_actions_init');
57
 
58
- if(is_user_logged_in()){
59
- add_action('wp_ajax_my_wpc_signon', 'my_wpc_signon');
60
- }else{
61
- add_action('wp_ajax_nopriv_my_wpc_signon', 'my_wpc_signon');
62
- }
 
63
  }
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.2
7
  Author: Softaculous Ltd.
8
  Author URI:
9
  License: GPL2
43
 
44
  //Add link to show the Connection key once the plugin is activated
45
  if(is_plugin_active($wpc_slug)){
46
+ add_action('admin_init', 'wpc_enqueue_script');
47
+ add_action('admin_init', 'wpc_enqueue_styles');
48
+ add_filter('plugin_row_meta', 'wpc_add_connection_link', 10, 2);
49
+ add_action('admin_head', 'wpc_modal_open_script');
50
+ add_action('admin_footer', 'wpc_modal_dialog');
51
+
52
+ add_action( 'plugins_loaded', 'wpc_load_plugin' );
53
 
54
+ include_once(ABSPATH.'wp-includes/pluggable.php');
55
+
56
+ add_action('admin_notices', 'wpc_admin_notice');
57
+
58
+ add_action('wp_ajax_nopriv_my_wpc_actions', 'my_wpc_actions_init');
59
 
60
+ if(is_user_logged_in()){
61
+ add_action('wp_ajax_my_wpc_signon', 'my_wpc_signon');
62
+ add_action('wp_ajax_my_wpc_fetch_authkey', 'wpc_fetch_authkey');
63
+ }else{
64
+ add_action('wp_ajax_nopriv_my_wpc_signon', 'my_wpc_signon');
65
+ }
66
  }