mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-05 09:19:53 +08:00
commit
e51bdc58de
9 changed files with 351 additions and 40 deletions
17
.idea/dictionaries/keith.xml
generated
Normal file
17
.idea/dictionaries/keith.xml
generated
Normal file
|
@ -0,0 +1,17 @@
|
|||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="keith">
|
||||
<words>
|
||||
<w>backupbuddy</w>
|
||||
<w>backupwordpress</w>
|
||||
<w>backwpup</w>
|
||||
<w>creport</w>
|
||||
<w>firsttime</w>
|
||||
<w>mainwp</w>
|
||||
<w>mainwpsignature</w>
|
||||
<w>showhide</w>
|
||||
<w>sucuri</w>
|
||||
<w>wordfence</w>
|
||||
<w>wptimecapsule</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
|
@ -1,10 +1,28 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* MainWP Render Branding
|
||||
*
|
||||
* This file handles rendering the Child Branding settings.
|
||||
*/
|
||||
namespace MainWP\Child;
|
||||
|
||||
/**
|
||||
* Class MainWP_Child_Branding_Render
|
||||
*
|
||||
* @package MainWP\Child
|
||||
*/
|
||||
class MainWP_Child_Branding_Render {
|
||||
/**
|
||||
* @static
|
||||
* @var null Holds the Public static instance MainWP_Child_Branding_Render.
|
||||
*/
|
||||
public static $instance = null;
|
||||
|
||||
/**
|
||||
* Create a public static instance of MainWP_Child_Branding_Render.
|
||||
*
|
||||
* @return MainWP_Child_Branding_Render|null
|
||||
*/
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new self();
|
||||
|
@ -13,19 +31,25 @@ class MainWP_Child_Branding_Render {
|
|||
}
|
||||
|
||||
/**
|
||||
* Method get_class_name()
|
||||
*
|
||||
* Get Class Name.
|
||||
*
|
||||
* @return object
|
||||
* @return string
|
||||
*/
|
||||
public static function get_class_name() {
|
||||
return __CLASS__;
|
||||
}
|
||||
|
||||
/**
|
||||
* MainWP_Child_Branding_Render constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Method admin_head_hide_elements().
|
||||
*
|
||||
* @deprecated Unused Element.
|
||||
*/
|
||||
public function admin_head_hide_elements() {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
@ -42,6 +66,13 @@ class MainWP_Child_Branding_Render {
|
|||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Contact Support.
|
||||
*
|
||||
* @return string Contact Support form html.
|
||||
*
|
||||
* @deprecated Unused Element.
|
||||
*/
|
||||
public function contact_support() {
|
||||
global $current_user;
|
||||
?>
|
||||
|
@ -128,6 +159,12 @@ class MainWP_Child_Branding_Render {
|
|||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Render contact support submit message.
|
||||
*
|
||||
* @param $opts Message options.
|
||||
* @return string Submitted message.
|
||||
*/
|
||||
private function render_submit_message( $opts ) {
|
||||
|
||||
$from_page = $_POST['mainwp_branding_send_from_page'];
|
||||
|
@ -150,6 +187,11 @@ class MainWP_Child_Branding_Render {
|
|||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Send support email.
|
||||
*
|
||||
* @return bool Return TRUE on success FALSE on failure.
|
||||
*/
|
||||
public function send_support_mail() {
|
||||
$opts = MainWP_Child_Branding::instance()->get_branding_options();
|
||||
$email = $opts['support_email'];
|
||||
|
@ -178,6 +220,11 @@ class MainWP_Child_Branding_Render {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* After admin bar render.
|
||||
*
|
||||
* @deprecated Unused Element.
|
||||
*/
|
||||
public function after_admin_bar_render() {
|
||||
$hide_slugs = apply_filters( 'mainwp_child_hide_update_notice', array() );
|
||||
|
||||
|
@ -229,6 +276,11 @@ class MainWP_Child_Branding_Render {
|
|||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin footer text.
|
||||
*
|
||||
* @deprecated Unused Element.
|
||||
*/
|
||||
public function in_admin_footer() {
|
||||
$hide_slugs = apply_filters( 'mainwp_child_hide_update_notice', array() );
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@ class MainWP_Child_Comments {
|
|||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @var string Used by MainWP_Child_Comments::comments_clauses & MainWP_Child_comments::__constructor.
|
||||
* @deprecate Unused element.
|
||||
*/
|
||||
private $comments_and_clauses;
|
||||
|
||||
|
@ -116,12 +117,13 @@ class MainWP_Child_Comments {
|
|||
MainWP_Helper::write( $information );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Comment WHERE Clauses.
|
||||
*
|
||||
* @param $clauses MySQL WHERE Clause.
|
||||
* @return array $clauses, Array of MySQL WHERE Clauses.
|
||||
*
|
||||
* @deprecated Unused Element.
|
||||
*/
|
||||
public function comments_clauses( $clauses ) {
|
||||
if ( $this->comments_and_clauses ) {
|
||||
|
|
|
@ -216,7 +216,7 @@ class MainWP_Child_Install {
|
|||
/**
|
||||
* Plugin & Theme Installation functions.
|
||||
*
|
||||
* @return array $information
|
||||
* @return array $information Installation results.
|
||||
*/
|
||||
public function install_plugin_theme() {
|
||||
|
||||
|
|
|
@ -1,27 +1,46 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* MainWP Child Maintenance.
|
||||
*
|
||||
* This file handles all of the Child Site maintenance functions.
|
||||
*/
|
||||
namespace MainWP\Child;
|
||||
|
||||
// phpcs:disable WordPress.WP.AlternativeFunctions -- to use external code, third party credit.
|
||||
|
||||
/**
|
||||
* Class MainWP_Child_Maintenance
|
||||
*
|
||||
* @package MainWP\Child
|
||||
*/
|
||||
class MainWP_Child_Maintenance {
|
||||
|
||||
/**
|
||||
* @static
|
||||
* @var null Holds the Public static instance of MainWP_Child_Maintenance.
|
||||
*/
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* Method get_class_name()
|
||||
*
|
||||
* Get Class Name.
|
||||
*
|
||||
* @return object
|
||||
* @return string
|
||||
*/
|
||||
public static function get_class_name() {
|
||||
return __CLASS__;
|
||||
}
|
||||
|
||||
/**
|
||||
* MainWP_Child_Maintenance constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a public static instance of MainWP_Child_Maintenance.
|
||||
*
|
||||
* @return MainWP_Child_Maintenance|null
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new self();
|
||||
|
@ -29,6 +48,9 @@ class MainWP_Child_Maintenance {
|
|||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire off Child Site maintenance.
|
||||
*/
|
||||
public function maintenance_site() {
|
||||
|
||||
if ( isset( $_POST['action'] ) ) {
|
||||
|
@ -45,6 +67,14 @@ class MainWP_Child_Maintenance {
|
|||
MainWP_Helper::write( $information );
|
||||
}
|
||||
|
||||
/**
|
||||
* Child Site DB maintenance.
|
||||
*
|
||||
* @param $maint_options Maintenance options.
|
||||
* @param $max_revisions Maximum revisions to keep.
|
||||
*
|
||||
* @return string[] Return SUCCESS.
|
||||
*/
|
||||
private function maintenance_db( $maint_options, $max_revisions ) {
|
||||
global $wpdb;
|
||||
|
||||
|
@ -117,11 +147,24 @@ class MainWP_Child_Maintenance {
|
|||
return array( 'status' => 'SUCCESS' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Child post revisions.
|
||||
*
|
||||
* @param $max_revisions Maximum revisions to keep.
|
||||
* @return array|object|null Database query results.
|
||||
*/
|
||||
protected function maintenance_get_revisions( $max_revisions ) {
|
||||
global $wpdb;
|
||||
return $wpdb->get_results( $wpdb->prepare( " SELECT `post_parent`, COUNT(*) cnt FROM $wpdb->posts WHERE `post_type` = 'revision' GROUP BY `post_parent` HAVING COUNT(*) > %d ", $max_revisions ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Child revisions.
|
||||
*
|
||||
* @param $results Query results.
|
||||
* @param $max_revisions Maximum revisions to keep.
|
||||
* @return int|void Return number of revisions deleted.
|
||||
*/
|
||||
private function maintenance_delete_revisions( $results, $max_revisions ) {
|
||||
global $wpdb;
|
||||
|
||||
|
@ -150,6 +193,9 @@ class MainWP_Child_Maintenance {
|
|||
return $count_deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimise Child database.
|
||||
*/
|
||||
private function maintenance_optimize() {
|
||||
global $wpdb, $table_prefix;
|
||||
$sql = 'SHOW TABLE STATUS FROM `' . DB_NAME . '`';
|
||||
|
@ -164,6 +210,11 @@ class MainWP_Child_Maintenance {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maintenance Action.
|
||||
*
|
||||
* @param $action Action to perform: save_settings, enable_alert, clear_settings.
|
||||
*/
|
||||
private function maintenance_action( $action ) {
|
||||
$information = array();
|
||||
if ( 'save_settings' === $action ) {
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
<?php
|
||||
/**
|
||||
* MainWP Abandoned Plugin Check
|
||||
*
|
||||
* This file checks if pugins have been abandoned.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Credits
|
||||
*
|
||||
|
@ -18,29 +24,22 @@ namespace MainWP\Child;
|
|||
*/
|
||||
class MainWP_Child_Plugins_Check {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
/** @var string Cron: Plugin health check watcher. */
|
||||
private $cron_name_watcher = 'mainwp_child_cron_plugin_health_check_watcher';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
||||
/** @var string Cron: Plugin health check daily. */
|
||||
private $cron_name_daily = 'mainwp_child_cron_plugin_health_check_daily';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
||||
/** @var string Cron: Plugin health check batching. */
|
||||
private $cron_name_batching = 'mainwp_child_cron_plugin_health_check_batching';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
||||
/** @var string Transient: Plugin timestamps. */
|
||||
private $tran_name_plugin_timestamps = 'mainwp_child_tran_name_plugin_timestamps';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
||||
/** @var string Transient: Plugins to batch. */
|
||||
private $tran_name_plugins_to_batch = 'mainwp_child_tran_name_plugins_to_batch';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
||||
/** @var string Transient: Plugin last daily run. */
|
||||
private $option_name_last_daily_run = 'mainwp_child_plugin_last_daily_run';
|
||||
|
||||
/**
|
||||
|
@ -90,7 +89,6 @@ class MainWP_Child_Plugins_Check {
|
|||
delete_transient( $this->tran_name_plugins_to_batch );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Un-schedules all events attached to the hook with the specified arguments.
|
||||
*
|
||||
|
@ -114,6 +112,8 @@ class MainWP_Child_Plugins_Check {
|
|||
* @param object $args Query arguments.
|
||||
* @param string $action Action to perform: query_plugins.
|
||||
* @return \stdClass $args Modified Search Query.
|
||||
*
|
||||
* @deprecated Unused Element.
|
||||
*/
|
||||
public function modify_plugin_api_search_query( $args, $action ) {
|
||||
if ( isset( $action ) && 'query_plugins' === $action ) {
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
<?php
|
||||
/**
|
||||
* MainWP Abandoned Themes Check
|
||||
*
|
||||
* This file checks for abandoned themes.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Credits
|
||||
*
|
||||
|
@ -11,15 +17,43 @@
|
|||
|
||||
namespace MainWP\Child;
|
||||
|
||||
/**
|
||||
* Class MainWP_Child_Themes_Check
|
||||
*
|
||||
* @package MainWP\Child
|
||||
*/
|
||||
class MainWP_Child_Themes_Check {
|
||||
public static $instance = null;
|
||||
private $cron_name_watcher = 'mainwp_child_cron_theme_health_check_watcher';
|
||||
private $cron_name_daily = 'mainwp_child_cron_theme_health_check_daily';
|
||||
private $cron_name_batching = 'mainwp_child_cron_theme_health_check_batching';
|
||||
|
||||
/** @var string Cron: Theme health check watcher. */
|
||||
private $cron_name_watcher = 'mainwp_child_cron_theme_health_check_watcher';
|
||||
|
||||
/** @var string Cron: Theme health check daily. */
|
||||
private $cron_name_daily = 'mainwp_child_cron_theme_health_check_daily';
|
||||
|
||||
/** @var string Cron: Theme health check batching. */
|
||||
private $cron_name_batching = 'mainwp_child_cron_theme_health_check_batching';
|
||||
|
||||
/** @var string Transient: Theme timestamps. */
|
||||
private $tran_name_theme_timestamps = 'mainwp_child_tran_name_theme_timestamps';
|
||||
private $tran_name_themes_to_batch = 'mainwp_child_tran_name_themes_to_batch';
|
||||
|
||||
/** @var string Transient: Themes to batch. */
|
||||
private $tran_name_themes_to_batch = 'mainwp_child_tran_name_themes_to_batch';
|
||||
/**
|
||||
* @var string Options: Theme check last daily run.
|
||||
*/
|
||||
private $option_name_last_daily_run = 'mainwp_child_theme_last_daily_run';
|
||||
|
||||
/**
|
||||
* @static
|
||||
* @var null Holds the Public static instance of MainWP_Child_Themes_Check.
|
||||
*/
|
||||
public static $instance = null;
|
||||
|
||||
/**
|
||||
* Create a public static instance of MainWP_Child_Themes_Check.
|
||||
*
|
||||
* @return MainWP_Child_Themes_Check|null
|
||||
*/
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new self();
|
||||
|
@ -28,6 +62,9 @@ class MainWP_Child_Themes_Check {
|
|||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* MainWP_Child_Themes_Check constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
if ( get_option( 'mainwp_child_plugintheme_days_outdate' ) ) {
|
||||
|
@ -40,12 +77,20 @@ class MainWP_Child_Themes_Check {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear crons & transients.
|
||||
*/
|
||||
private function cleanup_basic() {
|
||||
wp_clear_scheduled_hook( $this->cron_name_daily );
|
||||
wp_clear_scheduled_hook( $this->cron_name_batching );
|
||||
delete_transient( $this->tran_name_themes_to_batch );
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after deactivation.
|
||||
*
|
||||
* @param bool $del Whether or not to delete transient. Default: true.
|
||||
*/
|
||||
public function cleanup_deactivation( $del = true ) {
|
||||
$this->cleanup_basic();
|
||||
wp_clear_scheduled_hook( $this->cron_name_watcher );
|
||||
|
@ -55,7 +100,15 @@ class MainWP_Child_Themes_Check {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Modify theme api search query.
|
||||
*
|
||||
* @param $args Query arguments.
|
||||
* @param $action Actions to perform
|
||||
* @return \stdClass Return instance of \stdClass.
|
||||
*
|
||||
* @deprecated Unused Element.
|
||||
*/
|
||||
public function modify_theme_api_search_query( $args, $action ) {
|
||||
if ( isset( $action ) && 'query_themes' === $action ) {
|
||||
if ( ! is_object( $args ) ) {
|
||||
|
@ -70,6 +123,13 @@ class MainWP_Child_Themes_Check {
|
|||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform Watchdog.
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @deprecated Unused Element.
|
||||
*/
|
||||
public function perform_watchdog() {
|
||||
if ( false === wp_next_scheduled( $this->cron_name_daily ) && false === wp_next_scheduled( $this->cron_name_batching ) ) {
|
||||
$last_run = get_option( $this->option_name_last_daily_run );
|
||||
|
@ -89,13 +149,20 @@ class MainWP_Child_Themes_Check {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule a global watching cron just in case both other crons get killed.
|
||||
*/
|
||||
public function schedule_watchdog() {
|
||||
// Schedule a global watching cron just in case both other crons get killed.
|
||||
if ( ! wp_next_scheduled( $this->cron_name_watcher ) ) {
|
||||
wp_schedule_event( time(), 'hourly', $this->cron_name_watcher );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get how long themes have been outdated.
|
||||
*
|
||||
* @return array $themes_outdate Array of themes & how long they have been outdated.
|
||||
*/
|
||||
public function get_themes_outdate_info() {
|
||||
$themes_outdate = get_transient( $this->tran_name_theme_timestamps );
|
||||
if ( ! is_array( $themes_outdate ) ) {
|
||||
|
@ -119,6 +186,13 @@ class MainWP_Child_Themes_Check {
|
|||
return $themes_outdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run Check.
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @deprecated Unused Element.
|
||||
*/
|
||||
public function run_check() {
|
||||
if ( ! function_exists( '\wp_get_themes' ) ) {
|
||||
require_once ABSPATH . '/wp-admin/includes/theme.php';
|
||||
|
@ -203,7 +277,14 @@ class MainWP_Child_Themes_Check {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Try to get response body.
|
||||
*
|
||||
* @param $theme Theme slug.
|
||||
* @return string|bool Return response $body or FALSE on failure.
|
||||
*/
|
||||
private function try_get_response_body( $theme ) {
|
||||
|
||||
// Get the WordPress current version to be polite in the API call.
|
||||
include ABSPATH . WPINC . '/version.php';
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* This file handles all of the task that deal with the
|
||||
* MainWP Child Plugin itself.
|
||||
*/
|
||||
|
||||
namespace MainWP\Child;
|
||||
|
||||
// phpcs:disable
|
||||
|
@ -210,7 +211,9 @@ class MainWP_Child {
|
|||
}
|
||||
|
||||
/**
|
||||
* Parse init.
|
||||
*
|
||||
* @deprecated Unused Element.
|
||||
*/
|
||||
public function parse_init() {
|
||||
|
||||
|
@ -288,6 +291,8 @@ class MainWP_Child {
|
|||
|
||||
/**
|
||||
* Check login.
|
||||
*
|
||||
* @deprecated Unused Element.
|
||||
*/
|
||||
public function init_check_login() {
|
||||
MainWP_Connect::instance()->check_login();
|
||||
|
@ -295,6 +300,8 @@ class MainWP_Child {
|
|||
|
||||
/**
|
||||
* If user is administrator initiate the admin ajax.
|
||||
*
|
||||
* @deprecated Unused Element.
|
||||
*/
|
||||
public function admin_init() {
|
||||
if ( MainWP_Helper::is_admin() && is_admin() ) {
|
||||
|
@ -360,6 +367,8 @@ class MainWP_Child {
|
|||
|
||||
/**
|
||||
* Hook to deactivate Child Plugin.
|
||||
*
|
||||
* @deprecated Unused Element.
|
||||
*/
|
||||
public function activation() {
|
||||
$mu_plugin_enabled = apply_filters( 'mainwp_child_mu_plugin_enabled', false );
|
||||
|
|
|
@ -1,9 +1,20 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* MainWP Client Report
|
||||
*/
|
||||
namespace MainWP\Child;
|
||||
|
||||
/**
|
||||
* Class MainWP_Client_Report
|
||||
*
|
||||
* @package MainWP\Child
|
||||
*/
|
||||
class MainWP_Client_Report extends MainWP_Client_Report_Base {
|
||||
|
||||
/**
|
||||
* @static
|
||||
* @var null Holds the Public static instance of MainWP_Client_Report.
|
||||
*/
|
||||
public static $instance = null;
|
||||
|
||||
/**
|
||||
|
@ -15,6 +26,11 @@ class MainWP_Client_Report extends MainWP_Client_Report_Base {
|
|||
return __CLASS__;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a public static instance of MainWP_Client_Report|MainWP_Client_Report_Base|null.
|
||||
*
|
||||
* @return MainWP_Client_Report|MainWP_Client_Report_Base|null
|
||||
*/
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new self();
|
||||
|
@ -23,15 +39,29 @@ class MainWP_Client_Report extends MainWP_Client_Report_Base {
|
|||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* MainWP_Client_Report constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_filter( 'wp_mainwp_stream_current_agent', array( $this, 'current_agent' ), 10, 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate Client report
|
||||
*/
|
||||
public function init() {
|
||||
add_filter( 'mainwp_site_sync_others_data', array( $this, 'sync_others_data' ), 10, 2 );
|
||||
add_action( 'mainwp_child_log', array( self::get_class_name(), 'do_reports_log' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current user agent.
|
||||
*
|
||||
* @param string $agent User agent.
|
||||
* @return string $agent Current user agent.
|
||||
*
|
||||
* @deprecated Unused element.
|
||||
*/
|
||||
public function current_agent( $agent ) {
|
||||
if ( isset( $_POST['function'] ) && isset( $_POST['mainwpsignature'] ) ) {
|
||||
$agent = '';
|
||||
|
@ -39,6 +69,13 @@ class MainWP_Client_Report extends MainWP_Client_Report_Base {
|
|||
return $agent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync others data.
|
||||
*
|
||||
* @param array $information Holder for returned data.
|
||||
* @param array $data Data to sync.
|
||||
* @return array $information Synced data.
|
||||
*/
|
||||
public function sync_others_data( $information, $data = array() ) {
|
||||
if ( isset( $data['syncClientReportData'] ) && $data['syncClientReportData'] ) {
|
||||
$creport_sync_data = array();
|
||||
|
@ -53,6 +90,13 @@ class MainWP_Client_Report extends MainWP_Client_Report_Base {
|
|||
return $information;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create reports log file.
|
||||
*
|
||||
* @param string $ext File extension.
|
||||
*
|
||||
* @deprecated Unused element.
|
||||
*/
|
||||
public static function do_reports_log( $ext = '' ) {
|
||||
switch ( $ext ) {
|
||||
case 'backupbuddy':
|
||||
|
@ -73,6 +117,9 @@ class MainWP_Client_Report extends MainWP_Client_Report_Base {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Actions: save_sucuri_stream, save_backup_stream, get_stream, set_showhide.
|
||||
*/
|
||||
public function action() {
|
||||
|
||||
$information = array();
|
||||
|
@ -101,18 +148,32 @@ class MainWP_Client_Report extends MainWP_Client_Report_Base {
|
|||
MainWP_Helper::write( $information );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save sucuri stream.
|
||||
*
|
||||
* @return bool true|false.
|
||||
*/
|
||||
public function save_sucuri_stream() {
|
||||
$scan_data = isset( $_POST['scan_data'] ) ? $_POST['scan_data'] : '';
|
||||
do_action( 'mainwp_reports_sucuri_scan', $_POST['result'], $_POST['scan_status'], $scan_data, isset( $_POST['scan_time'] ) ? $_POST['scan_time'] : 0 );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save backup stream.
|
||||
*
|
||||
* @return bool true|false.
|
||||
*/
|
||||
public function save_backup_stream() {
|
||||
do_action( 'mainwp_backup', $_POST['destination'], $_POST['message'], $_POST['size'], $_POST['status'], $_POST['type'] );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get stream.
|
||||
*
|
||||
* @return array $information Stream array.
|
||||
*/
|
||||
public function get_stream() {
|
||||
|
||||
$sections = isset( $_POST['sections'] ) ? maybe_unserialize( base64_decode( $_POST['sections'] ) ) : array(); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for http encode compatible..
|
||||
|
@ -154,6 +215,11 @@ class MainWP_Client_Report extends MainWP_Client_Report_Base {
|
|||
return $information;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Branding Show/Hide.
|
||||
*
|
||||
* @return array $information Results array.
|
||||
*/
|
||||
public function set_showhide() {
|
||||
$hide = isset( $_POST['showhide'] ) && ( 'hide' === $_POST['showhide'] ) ? 'hide' : '';
|
||||
MainWP_Child_Branding::instance()->save_branding_options( 'hide_child_reports', $hide );
|
||||
|
@ -162,6 +228,9 @@ class MainWP_Client_Report extends MainWP_Client_Report_Base {
|
|||
return $information;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate Client Reports.
|
||||
*/
|
||||
public function creport_init() {
|
||||
|
||||
$branding_opts = MainWP_Child_Branding::instance()->get_branding_options();
|
||||
|
@ -186,12 +255,30 @@ class MainWP_Client_Report extends MainWP_Client_Report_Base {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide update notice.
|
||||
*
|
||||
* @param $slugs Slugs to hide.
|
||||
* @return array Slugs array.
|
||||
*
|
||||
* @deprecated Unused element.
|
||||
*/
|
||||
public function hide_update_notice( $slugs ) {
|
||||
|
||||
$slugs[] = 'mainwp-child-reports/mainwp-child-reports.php';
|
||||
return $slugs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove update nag.
|
||||
*
|
||||
* @param string $value Value to remove.
|
||||
* @return string Response.
|
||||
*
|
||||
* @deprecated Unused element.
|
||||
*/
|
||||
public function remove_update_nag( $value ) {
|
||||
|
||||
if ( isset( $_POST['mainwpsignature'] ) ) {
|
||||
return $value;
|
||||
}
|
||||
|
@ -207,7 +294,14 @@ class MainWP_Client_Report extends MainWP_Client_Report_Base {
|
|||
return $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Client Reports Branding plugin.
|
||||
*
|
||||
* @param array $plugins Plugins array.
|
||||
* @return array Plugins array.
|
||||
*
|
||||
* @deprecated Unused element.
|
||||
*/
|
||||
public function creport_branding_plugin( $plugins ) {
|
||||
foreach ( $plugins as $key => $value ) {
|
||||
$plugin_slug = basename( $key, '.php' );
|
||||
|
@ -218,6 +312,11 @@ class MainWP_Client_Report extends MainWP_Client_Report_Base {
|
|||
return $plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Client Remove Menu.
|
||||
*
|
||||
* @deprecated Unused element.
|
||||
*/
|
||||
public function creport_remove_menu() {
|
||||
remove_menu_page( 'mainwp_wp_stream' );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue