2020-05-12 20:19:58 +07:00
< ? php
2020-06-02 20:33:53 +02:00
/**
* MainWP Callable Functions
*
* Manage functions that can be executed on the child site .
*
* @ package MainWP\Child
*/
2020-05-12 20:19:58 +07:00
namespace MainWP\Child ;
2020-05-21 20:10:15 +07:00
// phpcs:disable WordPress.WP.AlternativeFunctions -- to use external code, third party credit.
2020-05-15 01:04:08 +07:00
2020-06-02 20:33:53 +02:00
/**
* Class MainWP_Child_Callable
*
* Manage functions that can be executed on the child site .
*/
2020-05-12 20:19:58 +07:00
class MainWP_Child_Callable {
2020-06-02 20:33:53 +02:00
/**
* Public static variable to hold the single instance of the class .
*
* @ var mixed Default null
*/
2020-05-12 20:19:58 +07:00
protected static $instance = null ;
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Private variable to hold the array of all callable functions .
*
* @ var array Callable functions .
*/
2020-05-12 20:19:58 +07:00
private $callableFunctions = array (
'stats' => 'get_site_stats' ,
'upgrade' => 'upgrade_wp' ,
'newpost' => 'new_post' ,
'deactivate' => 'deactivate' ,
'newuser' => 'new_user' ,
'newadminpassword' => 'new_admin_password' ,
'installplugintheme' => 'install_plugin_theme' ,
'upgradeplugintheme' => 'upgrade_plugin_theme' ,
'upgradetranslation' => 'upgrade_translation' ,
'backup' => 'backup' ,
'backup_checkpid' => 'backup_checkpid' ,
'cloneinfo' => 'cloneinfo' ,
'security' => 'get_security_stats' ,
'securityFix' => 'do_security_fix' ,
'securityUnFix' => 'do_security_un_fix' ,
'post_action' => 'post_action' ,
'get_all_posts' => 'get_all_posts' ,
'comment_action' => 'comment_action' ,
'comment_bulk_action' => 'comment_bulk_action' ,
'get_all_comments' => 'get_all_comments' ,
'get_all_themes' => 'get_all_themes' ,
'theme_action' => 'theme_action' ,
'get_all_plugins' => 'get_all_plugins' ,
'plugin_action' => 'plugin_action' ,
'get_all_pages' => 'get_all_pages' ,
'get_all_users' => 'get_all_users' ,
'user_action' => 'user_action' ,
2020-05-21 18:10:24 +00:00
'search_users' => 'search_users' ,
2020-05-12 20:19:58 +07:00
'maintenance_site' => 'maintenance_site' ,
'branding_child_plugin' => 'branding_child_plugin' ,
'code_snippet' => 'code_snippet' ,
'uploader_action' => 'uploader_action' ,
'wordpress_seo' => 'wordpress_seo' ,
'client_report' => 'client_report' ,
'createBackupPoll' => 'backup_poll' ,
'page_speed' => 'page_speed' ,
'woo_com_status' => 'woo_com_status' ,
'links_checker' => 'links_checker' ,
'wordfence' => 'wordfence' ,
'delete_backup' => 'delete_backup' ,
'update_values' => 'update_child_values' ,
'ithemes' => 'ithemes' ,
'updraftplus' => 'updraftplus' ,
'backup_wp' => 'backup_wp' ,
'backwpup' => 'backwpup' ,
'wp_rocket' => 'wp_rocket' ,
'settings_tools' => 'settings_tools' ,
2020-05-30 01:13:29 +07:00
'skeleton_key' => 'bulk_settings_manager' , // deprecated.
2020-05-29 18:14:55 +00:00
'bulk_settings_manager' => 'bulk_settings_manager' ,
2020-05-12 20:19:58 +07:00
'custom_post_type' => 'custom_post_type' ,
'backup_buddy' => 'backup_buddy' ,
'get_site_icon' => 'get_site_icon' ,
'vulner_checker' => 'vulner_checker' ,
'wp_staging' => 'wp_staging' ,
'disconnect' => 'disconnect' ,
'time_capsule' => 'time_capsule' ,
'extra_excution' => 'extra_execution' , // deprecated!
'extra_execution' => 'extra_execution' ,
'wpvivid_backuprestore' => 'wpvivid_backuprestore' ,
);
2020-06-02 20:33:53 +02:00
/**
* Private variable to hold the array of all callable functions that don ' t require regularl authentication .
*
* @ var array Callable functions .
*/
2020-05-12 20:19:58 +07:00
private $callableFunctionsNoAuth = array (
'stats' => 'get_site_stats_no_auth' ,
);
2020-05-12 13:21:04 +00:00
2020-05-12 20:19:58 +07:00
/**
* Method get_class_name ()
*
2020-06-02 20:33:53 +02:00
* Get class name .
2020-05-12 20:19:58 +07:00
*
2020-06-02 20:33:53 +02:00
* @ return string __CLASS__ Class name .
2020-05-12 20:19:58 +07:00
*/
public static function get_class_name () {
return __CLASS__ ;
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method __construct ()
*
* Run any time MainWP_Child is called .
*/
2020-05-12 20:19:58 +07:00
public function __construct () {
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method instance ()
*
* Create a public static instance .
*
* @ return mixed Class instance .
*/
2020-05-12 20:19:58 +07:00
public static function get_instance () {
if ( null === self :: $instance ) {
self :: $instance = new self ();
}
return self :: $instance ;
}
2020-05-13 17:58:07 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method init_call_functions ()
*
* Initiate callable functions .
*
* @ param bool $auth If true , regular authentication is required .
*/
2020-05-15 01:04:08 +07:00
public function init_call_functions ( $auth = false ) {
2020-05-14 18:09:17 +00:00
$callable = false ;
2020-05-14 00:57:25 +07:00
$callable_no_auth = false ;
2020-05-14 18:09:17 +00:00
$call_func = false ;
2020-05-14 00:57:25 +07:00
2020-06-02 20:33:53 +02:00
// check if function is callable.
2020-05-14 18:09:17 +00:00
if ( isset ( $_POST [ 'function' ] ) ) {
$call_func = $_POST [ 'function' ];
$callable = $this -> is_callable_function ( $call_func ); // check callable func.
$callable_no_auth = $this -> is_callable_function_no_auth ( $call_func ); // check callable no auth func.
2020-05-14 00:57:25 +07:00
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
// Fire off the called function.
2020-05-14 00:57:25 +07:00
if ( $auth && isset ( $_POST [ 'function' ] ) && $callable ) {
define ( 'DOING_CRON' , true );
2020-05-15 01:04:08 +07:00
MainWP_Utility :: handle_fatal_error ();
2020-05-14 00:57:25 +07:00
MainWP_Utility :: fix_for_custom_themes ();
2020-05-15 01:04:08 +07:00
$this -> call_function ( $call_func );
2020-05-14 00:57:25 +07:00
} elseif ( isset ( $_POST [ 'function' ] ) && $callable_no_auth ) {
define ( 'DOING_CRON' , true );
MainWP_Utility :: fix_for_custom_themes ();
2020-05-15 01:04:08 +07:00
$this -> call_function_no_auth ( $call_func );
2020-05-14 00:57:25 +07:00
} elseif ( isset ( $_POST [ 'function' ] ) && isset ( $_POST [ 'mainwpsignature' ] ) && ! $callable && ! $callable_no_auth ) {
MainWP_Helper :: error ( __ ( 'Required version has not been detected. Please, make sure that you are using the latest version of the MainWP Child plugin on your site.' , 'mainwp-child' ) );
}
}
2020-05-13 17:58:07 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method is_callable_function ()
*
* Check if the function is the list of callable functions .
*
2020-06-02 20:35:24 +02:00
* @ param string $func Contains the name of the function to check .
2020-06-02 20:33:53 +02:00
*
* @ return bool If callable , return true , if not , return false .
*/
2020-05-12 20:19:58 +07:00
public function is_callable_function ( $func ) {
2020-05-12 13:21:04 +00:00
if ( isset ( $this -> callableFunctions [ $func ] ) ) {
2020-05-12 20:19:58 +07:00
return true ;
2020-05-12 13:21:04 +00:00
}
2020-05-12 20:19:58 +07:00
return false ;
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method is_callable_function_no_auth ()
*
* Check if the function is the list of callable functions that don ' t require regular authentication .
*
2020-06-02 20:35:24 +02:00
* @ param string $func Contains the name of the function to check .
2020-06-02 20:33:53 +02:00
*
* @ return bool If callable , return true , if not , return false .
*/
2020-05-12 20:19:58 +07:00
public function is_callable_function_no_auth ( $func ) {
2020-05-12 13:21:04 +00:00
if ( isset ( $this -> callableFunctionsNoAuth [ $func ] ) ) {
2020-05-12 20:19:58 +07:00
return true ;
2020-05-12 13:21:04 +00:00
}
2020-05-12 20:19:58 +07:00
return false ;
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method call_function ()
*
* Call ceratin function .
*
* @ param string $func Contains the name of the function to call .
*/
2020-05-12 20:19:58 +07:00
public function call_function ( $func ) {
2020-05-12 13:21:04 +00:00
if ( $this -> is_callable_function ( $func ) ) {
2020-05-12 20:19:58 +07:00
call_user_func ( array ( $this , $this -> callableFunctions [ $func ] ) );
2020-05-12 13:21:04 +00:00
}
2020-05-12 20:19:58 +07:00
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method call_function_no_auth ()
*
* Call ceratin function without regular authentication if the function is in the $callableFunctionsNoAuth list .
*
* @ param string $func Contains the name of the function to call .
*/
2020-05-12 20:19:58 +07:00
public function call_function_no_auth ( $func ) {
2020-05-12 13:21:04 +00:00
if ( $this -> is_callable_function_no_auth ( $func ) ) {
2020-05-12 20:19:58 +07:00
call_user_func ( array ( $this , $this -> callableFunctionsNoAuth [ $func ] ) );
2020-05-12 13:21:04 +00:00
}
2020-05-12 20:19:58 +07:00
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method get_site_stats ()
*
* Fire off the get_site_stats () function .
*/
2020-05-12 20:19:58 +07:00
public function get_site_stats () {
MainWP_Child_Stats :: get_instance () -> get_site_stats ();
}
2020-06-02 20:33:53 +02:00
/**
* Method get_site_stats_no_auth ()
*
* Fire off the get_site_stats_no_auth () function .
*/
2020-05-12 20:19:58 +07:00
public function get_site_stats_no_auth () {
MainWP_Child_Stats :: get_instance () -> get_site_stats_no_auth ();
}
/**
2020-06-02 20:33:53 +02:00
* Method install_plugin_theme ()
*
* Fire off the install_plugin_theme () function .
2020-05-12 20:19:58 +07:00
*/
public function install_plugin_theme () {
MainWP_Child_Install :: get_instance () -> install_plugin_theme ();
}
2020-06-02 20:33:53 +02:00
/**
* Method upgrade_wp ()
*
* Fire off the upgrade_wp () function .
*/
2020-05-12 20:19:58 +07:00
public function upgrade_wp () {
MainWP_Child_Updates :: get_instance () -> upgrade_wp ();
}
2020-06-02 20:33:53 +02:00
/**
* Method upgrade_translation ()
*
* Fire off the upgrade_translation () function .
*/
2020-05-12 20:19:58 +07:00
public function upgrade_translation () {
MainWP_Child_Updates :: get_instance () -> upgrade_translation ();
}
2020-06-02 20:33:53 +02:00
/**
* Method upgrade_plugin_theme ()
*
* Fire off the upgrade_plugin_theme () function .
*/
2020-05-12 20:19:58 +07:00
public function upgrade_plugin_theme () {
MainWP_Child_Updates :: get_instance () -> upgrade_plugin_theme ();
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method theme_action ()
*
* Fire off the theme_action () function .
*/
2020-05-12 13:21:04 +00:00
public function theme_action () {
2020-05-12 20:19:58 +07:00
MainWP_Child_Install :: get_instance () -> theme_action ();
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method plugin_action ()
*
* Fire off the plugin_action () function .
*/
2020-05-12 20:19:58 +07:00
public function plugin_action () {
MainWP_Child_Install :: get_instance () -> plugin_action ();
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method get_all_plugins ()
*
* Fire off the get_all_plugins () function .
*/
2020-05-12 20:19:58 +07:00
public function get_all_plugins () {
2020-05-14 17:26:44 +07:00
MainWP_Child_Stats :: get_instance () -> get_all_plugins ();
2020-05-12 20:19:58 +07:00
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method get_all_themes ()
*
* Fire off the get_all_themes () function .
*/
2020-05-12 20:19:58 +07:00
public function get_all_themes () {
2020-05-14 17:26:44 +07:00
MainWP_Child_Stats :: get_instance () -> get_all_themes ();
2020-05-12 20:19:58 +07:00
}
2020-06-02 20:33:53 +02:00
/**
* Method get_all_users ()
*
* Fire off the get_all_users () function .
*/
2020-05-12 20:19:58 +07:00
public function get_all_users () {
MainWP_Child_Users :: get_instance () -> get_all_users ();
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method user_action ()
*
* Fire off the user_action () function .
*/
2020-05-12 20:19:58 +07:00
public function user_action () {
MainWP_Child_Users :: get_instance () -> user_action ();
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method search_users ()
*
* Fire off the search_users () function .
*/
2020-05-12 20:19:58 +07:00
public function search_users () {
MainWP_Child_Users :: get_instance () -> search_users ();
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method get_all_posts ()
*
* Fire off the get_all_posts () function .
*/
2020-05-12 20:19:58 +07:00
public function get_all_posts () {
MainWP_Child_Posts :: get_instance () -> get_all_posts ();
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method get_all_pages ()
*
* Fire off the get_all_pages () function .
*/
2020-05-12 20:19:58 +07:00
public function get_all_pages () {
MainWP_Child_Posts :: get_instance () -> get_all_pages ();
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method comment_action ()
*
* Fire off the comment_action () function .
*/
2020-05-12 20:19:58 +07:00
public function comment_action () {
2020-05-22 01:09:56 +07:00
MainWP_Child_Comments :: get_instance () -> comment_action ();
2020-05-12 13:21:04 +00:00
}
2020-06-02 20:33:53 +02:00
/**
* Method get_all_comments ()
*
* Fire off the get_all_comments () function .
*/
2020-05-12 20:19:58 +07:00
public function get_all_comments () {
2020-05-22 01:09:56 +07:00
MainWP_Child_Comments :: get_instance () -> get_all_comments ();
2020-05-12 20:19:58 +07:00
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method comment_bulk_action ()
*
* Fire off the comment_bulk_action () function .
*/
2020-05-12 20:19:58 +07:00
public function comment_bulk_action () {
2020-05-22 01:09:56 +07:00
MainWP_Child_Comments :: get_instance () -> comment_bulk_action ();
2020-05-12 13:21:04 +00:00
}
2020-06-02 20:33:53 +02:00
/**
* Method maintenance_site ()
*
* Fire off the maintenance_site () function .
*/
2020-05-12 20:19:58 +07:00
public function maintenance_site () {
2020-05-22 01:09:56 +07:00
MainWP_Child_Maintenance :: get_instance () -> maintenance_site ();
2020-05-15 18:28:59 +07:00
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method new_post ()
*
* Fire off the new_post () function .
*/
2020-05-12 20:19:58 +07:00
public function new_post () {
MainWP_Child_Posts :: get_instance () -> new_post ();
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method post_action ()
*
* Fire off the post_action () function .
*/
2020-05-12 20:19:58 +07:00
public function post_action () {
MainWP_Child_Posts :: get_instance () -> post_action ();
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method new_admin_password ()
*
* Fire off the new_admin_password () function .
*/
2020-05-12 20:19:58 +07:00
public function new_admin_password () {
MainWP_Child_Users :: get_instance () -> new_admin_password ();
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method new_user ()
*
* Fire off the new_user () function .
*/
2020-05-12 20:19:58 +07:00
public function new_user () {
MainWP_Child_Users :: get_instance () -> new_user ();
2020-05-12 13:21:04 +00:00
}
2020-06-02 20:33:53 +02:00
/**
* Method cloneinfo ()
*
* Fire off the cloneinfo () function .
*/
2020-05-12 20:19:58 +07:00
public function cloneinfo () {
global $table_prefix ;
$information [ 'dbCharset' ] = DB_CHARSET ;
$information [ 'dbCollate' ] = DB_COLLATE ;
$information [ 'table_prefix' ] = $table_prefix ;
$information [ 'site_url' ] = get_option ( 'site_url' );
$information [ 'home' ] = get_option ( 'home' );
2020-05-20 20:15:29 +07:00
MainWP_Helper :: write ( $information );
2020-05-12 20:19:58 +07:00
}
2020-06-02 20:33:53 +02:00
/**
* Method backup_poll ()
*
* Fire off the backup_poll () function .
*/
2020-05-12 20:19:58 +07:00
public function backup_poll () {
2020-05-22 00:03:42 +07:00
MainWP_Backup :: get () -> backup_poll ();
2020-05-12 20:19:58 +07:00
}
2020-06-02 20:33:53 +02:00
/**
* Method backup_checkpid ()
*
* Fire off the backup_checkpid () function .
*/
2020-05-12 20:19:58 +07:00
public function backup_checkpid () {
2020-05-21 20:10:15 +07:00
MainWP_Backup :: get () -> backup_checkpid ();
2020-05-12 20:19:58 +07:00
}
2020-06-02 20:33:53 +02:00
/**
* Method backup ()
*
* Fire off the backup () function .
*
* @ param bool $write Whether or not to execute MainWP_Helper :: write (), Default : true .
*
* @ return array Action result .
*/
public function backup ( $write = true ) {
return MainWP_Backup :: get () -> backup ( $write );
2020-05-12 20:19:58 +07:00
}
2020-06-02 20:33:53 +02:00
/**
* Method backup_full ()
*
* Fire off the backup_full () function .
*
* @ param string $file_name Contains the backup file name .
*
* @ return array Action result .
*/
protected function backup_full ( $file_name ) {
return MainWP_Backup :: get () -> backup_full ( $file_name );
2020-05-15 23:53:53 +07:00
}
2020-05-15 16:54:45 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method backup_db ()
*
* Fire off the backup_db () function .
*
* @ param string $file_name Contains the backup file name .
* @ param string $file_extension Contains the backup file extension .
*
* @ return array Action result .
*/
protected function backup_db ( $file_name = '' , $file_extension = 'zip' ) {
return MainWP_Backup :: get () -> backup_db ( $file_name , $file_extension );
2020-05-12 20:19:58 +07:00
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method get_site_icon ()
*
* Fire off the get_site_icon () function .
*/
2020-05-12 20:19:58 +07:00
public function get_site_icon () {
2020-05-22 01:09:56 +07:00
MainWP_Child_Misc :: get_instance () -> get_site_icon ();
2020-05-15 18:28:59 +07:00
}
2020-05-15 11:30:53 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method get_security_stats ()
*
* Fire off the get_security_stats () function .
*/
2020-05-12 20:19:58 +07:00
public function get_security_stats () {
2020-05-22 01:09:56 +07:00
MainWP_Child_Misc :: get_instance () -> get_security_stats ();
2020-05-12 20:19:58 +07:00
}
2020-06-02 20:33:53 +02:00
/**
* Method do_security_fix ()
*
* Fire off the do_security_fix () function .
*/
2020-05-12 20:19:58 +07:00
public function do_security_fix () {
2020-05-22 01:09:56 +07:00
MainWP_Child_Misc :: get_instance () -> do_security_fix ();
2020-05-12 20:19:58 +07:00
}
2020-06-02 20:33:53 +02:00
/**
* Method do_security_un_fix ()
*
* Fire off the do_security_un_fix () function .
*/
2020-05-12 20:19:58 +07:00
public function do_security_un_fix () {
2020-05-22 01:09:56 +07:00
MainWP_Child_Misc :: get_instance () -> do_security_un_fix ();
2020-05-12 20:19:58 +07:00
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method settings_tools ()
*
* Fire off the settings_tools () function .
*/
2020-05-12 20:19:58 +07:00
public function settings_tools () {
2020-05-22 01:09:56 +07:00
MainWP_Child_Misc :: get_instance () -> do_security_un_fix ();
2020-05-12 20:19:58 +07:00
}
2020-06-02 20:33:53 +02:00
/**
* Method bulk_settings_manager ()
*
* Fire off the action () function .
*/
2020-05-30 01:13:29 +07:00
public function bulk_settings_manager () {
MainWP_Child_Bulk_Settings_Manager :: instance () -> action ();
2020-05-12 20:19:58 +07:00
}
2020-06-02 20:33:53 +02:00
/**
* Method custom_post_type ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function custom_post_type () {
MainWP_Custom_Post_Type :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method backup_buddy ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function backup_buddy () {
\MainWP_Child_Back_Up_Buddy :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method vulner_checker ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function vulner_checker () {
MainWP_Child_Vulnerability_Checker :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method time_capsule ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function time_capsule () {
\MainWP_Child_Timecapsule :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method wp_staging ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function wp_staging () {
2020-05-14 17:26:44 +07:00
\MainWP_Child_Staging :: instance () -> action ();
2020-05-12 20:19:58 +07:00
}
2020-06-02 20:33:53 +02:00
/**
* Method extra_execution ()
*
* Additional functions to execute .
*/
2020-05-12 20:19:58 +07:00
public function extra_execution () {
$post = $_POST ;
$information = array ();
2020-06-02 20:33:53 +02:00
/**
* Filter 'mainwp_child_extra_execution'
*
* Additional functions to execute through the filter .
*
* @ param array $information An array containing the synchronization information .
* @ param mixed $post Contains the POST request .
*
* @ since 4.0
*/
2020-05-12 20:19:58 +07:00
$information = apply_filters ( 'mainwp_child_extra_execution' , $information , $post );
2020-05-20 20:15:29 +07:00
MainWP_Helper :: write ( $information );
2020-05-12 20:19:58 +07:00
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method uploader_action ()
*
* Fire off the uploader_action () function .
*/
2020-05-12 20:19:58 +07:00
public function uploader_action () {
2020-05-22 01:09:56 +07:00
MainWP_Child_Misc :: get_instance () -> uploader_action ();
2020-05-14 00:57:25 +07:00
}
2020-05-13 17:58:07 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method wordpress_seo ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function wordpress_seo () {
\MainWP_WordPress_SEO :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method client_report ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function client_report () {
MainWP_Client_Report :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method page_speed ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function page_speed () {
\MainWP_Child_Pagespeed :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method woo_com_status ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function woo_com_status () {
\MainWP_Child_WooCommerce_Status :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method links_checker ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function links_checker () {
\MainWP_Child_Links_Checker :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method wordfence ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function wordfence () {
\MainWP_Child_Wordfence :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method ithemes ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function ithemes () {
\MainWP_Child_IThemes_Security :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method updraftplus ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function updraftplus () {
\MainWP_Child_Updraft_Plus_Backups :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method wpvivid_backuprestore ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function wpvivid_backuprestore () {
\MainWP_Child_WPvivid_BackupRestore :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method backup_wp ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function backup_wp () {
if ( ! version_compare ( phpversion (), '5.3' , '>=' ) ) {
$error = sprintf ( __ ( 'PHP Version %s is unsupported.' , 'mainwp-child' ), phpversion () );
2020-05-20 20:15:29 +07:00
MainWP_Helper :: write ( array ( 'error' => $error ) );
2020-05-12 20:19:58 +07:00
}
\MainWP_Child_Back_Up_WordPress :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method wp_rocket ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function wp_rocket () {
\MainWP_Child_WP_Rocket :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method backwpup ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function backwpup () {
\MainWP_Child_Back_WP_Up :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method delete_backup ()
*
* Delete backup .
*/
2020-05-12 20:19:58 +07:00
public function delete_backup () {
$dirs = MainWP_Helper :: get_mainwp_dir ( 'backup' );
$backupdir = $dirs [ 0 ];
$file = $_REQUEST [ 'del' ];
if ( file_exists ( $backupdir . $file ) ) {
unlink ( $backupdir . $file );
}
2020-05-20 20:15:29 +07:00
MainWP_Helper :: write ( array ( 'result' => 'ok' ) );
2020-05-12 20:19:58 +07:00
}
2020-06-02 20:33:53 +02:00
/**
* Method update_child_values ()
*
* Update the MainWP Child site options .
*/
2020-05-12 20:19:58 +07:00
public function update_child_values () {
2020-06-02 20:33:53 +02:00
$unique_id = isset ( $_POST [ 'uniqueId' ] ) ? $_POST [ 'uniqueId' ] : '' ;
MainWP_Helper :: update_option ( 'mainwp_child_uniqueId' , $unique_id );
2020-05-20 20:15:29 +07:00
MainWP_Helper :: write ( array ( 'result' => 'ok' ) );
2020-05-12 20:19:58 +07:00
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method branding_child_plugin ()
*
* Fire off the action () function .
*/
2020-05-12 20:19:58 +07:00
public function branding_child_plugin () {
MainWP_Child_Branding :: instance () -> action ();
}
2020-06-02 20:33:53 +02:00
/**
* Method code_snippet ()
*
* Fire off the code_snippet () function .
*/
2020-05-12 20:19:58 +07:00
public function code_snippet () {
2020-05-22 01:09:56 +07:00
MainWP_Child_Misc :: get_instance () -> code_snippet ();
2020-05-12 20:19:58 +07:00
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method disconnect ()
*
* Disconnect the child site from the current MainWP Dashboard .
*/
2020-05-12 20:19:58 +07:00
public function disconnect () {
global $mainWPChild ;
$mainWPChild -> deactivation ( false );
2020-05-20 20:15:29 +07:00
MainWP_Helper :: write ( array ( 'result' => 'success' ) );
2020-05-12 20:19:58 +07:00
}
2020-05-12 13:21:04 +00:00
2020-06-02 20:33:53 +02:00
/**
* Method deactivate ()
*
* Deactivate the MainWP Child plugin in the site .
*/
2020-05-12 20:19:58 +07:00
public function deactivate () {
global $mainWPChild ;
include_once ABSPATH . 'wp-admin/includes/plugin.php' ;
deactivate_plugins ( $mainWPChild -> plugin_slug , true );
$information = array ();
if ( is_plugin_active ( $mainWPChild -> plugin_slug ) ) {
MainWP_Helper :: error ( 'Plugin still active' );
}
$information [ 'deactivated' ] = true ;
2020-05-20 20:15:29 +07:00
MainWP_Helper :: write ( $information );
2020-05-12 20:19:58 +07:00
}
2020-05-12 13:21:04 +00:00
2020-05-12 20:19:58 +07:00
}