update_key_value( 'mainwp_extensions_master_api_key', false ); $new_extensions = array(); $extensions = get_option( 'mainwp_extensions', array() ); if ( is_array( $extensions ) ) { foreach ( $extensions as $ext ) { if ( isset( $ext['api'] ) && isset( $ext['apiManager'] ) && ! empty( $ext['apiManager'] ) ) { if ( isset( $ext['api_key'] ) ) { $ext['api_key'] = ''; } if ( isset( $ext['activation_email'] ) ) { $ext['activation_email'] = ''; } if ( isset( $ext['activated_key'] ) ) { $ext['activated_key'] = 'Deactivated'; } $act_info = MainWP_Api_Manager::instance()->get_activation_info( $ext['api'] ); if ( isset( $act_info['api_key'] ) ) { $act_info['api_key'] = ''; } if ( isset( $act_info['activation_email'] ) ) { $act_info['activation_email'] = ''; } if ( isset( $act_info['activated_key'] ) ) { $act_info['activated_key'] = 'Deactivated'; } MainWP_Api_Manager::instance()->set_activation_info( $ext['api'], $act_info ); } $new_extensions[] = $ext; } } MainWP_Utility::update_option( 'mainwp_extensions', $new_extensions ); update_option( 'mainwp_extensions_all_activation_cached', '' ); wp_safe_redirect( esc_url( admin_url( 'admin.php?page=MainWPTools' ) ) ); die(); } } /** * Instantiate the Settings Menu. * * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item() */ public static function init_menu() { add_submenu_page( 'mainwp_tab', __( 'Settings Global options', 'mainwp' ), ' ' . esc_html__( 'Settings', 'mainwp' ) . '', 'read', 'Settings', array( static::get_class_name(), 'render', ) ); if ( ! MainWP_Menu::is_disable_menu_item( 3, 'MainWPTools' ) ) { add_submenu_page( 'mainwp_tab', __( 'Tools', 'mainwp' ), '
' . esc_html__( 'Tools', 'mainwp' ) . '
', 'read', 'MainWPTools', array( static::get_class_name(), 'render_mainwp_tools', ) ); } if ( ! MainWP_Menu::is_disable_menu_item( 3, 'CostTrackerSettings' ) ) { add_submenu_page( 'mainwp_tab', esc_html__( 'Cost Tracker', 'mainwp' ), '
' . esc_html__( 'Cost Tracker', 'mainwp' ) . '
', 'read', 'CostTrackerSettings', array( Cost_Tracker_Settings::get_instance(), 'render_settings_page', ) ); } if ( ! MainWP_Menu::is_disable_menu_item( 3, 'SettingsAdvanced' ) ) { add_submenu_page( 'mainwp_tab', __( 'Advanced Options', 'mainwp' ), '
' . esc_html__( 'Advanced Options', 'mainwp' ) . '
', 'read', 'SettingsAdvanced', array( static::get_class_name(), 'render_advanced', ) ); } if ( ! MainWP_Menu::is_disable_menu_item( 3, 'SettingsEmail' ) ) { add_submenu_page( 'mainwp_tab', __( 'Email Settings', 'mainwp' ), '
' . esc_html__( 'Email Settings', 'mainwp' ) . '
', 'read', 'SettingsEmail', array( static::get_class_name(), 'render_email_settings', ) ); } /** * Settings Subpages * * Filters subpages for the Settings page. * * @since Unknown */ $sub_pages = apply_filters_deprecated( 'mainwp-getsubpages-settings', array( array() ), '4.0.7.2', 'mainwp_getsubpages_settings' ); // @deprecated Use 'mainwp_getsubpages_settings' instead. NOSONAR - not IP. static::$subPages = apply_filters( 'mainwp_getsubpages_settings', $sub_pages ); if ( isset( static::$subPages ) && is_array( static::$subPages ) ) { foreach ( static::$subPages as $subPage ) { if ( MainWP_Menu::is_disable_menu_item( 3, 'Settings' . $subPage['slug'] ) ) { continue; } add_submenu_page( 'mainwp_tab', $subPage['title'], '
' . $subPage['title'] . '
', 'read', 'Settings' . $subPage['slug'], $subPage['callback'] ); } } } /** * Instantiate Settings SubPages Menu. * * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item() */ public static function init_subpages_menu() { ?> esc_html__( 'Settings', 'mainwp' ), 'parent_key' => 'mainwp_tab', 'slug' => 'Settings', 'href' => 'admin.php?page=Settings', 'icon' => '', ), 0 ); $init_sub_subleftmenu = array( array( 'title' => esc_html__( 'General Settings', 'mainwp' ), 'parent_key' => 'Settings', 'href' => 'admin.php?page=Settings', 'slug' => 'Settings', 'right' => '', ), array( 'title' => esc_html__( 'Advanced Settings', 'mainwp' ), 'parent_key' => 'Settings', 'href' => 'admin.php?page=SettingsAdvanced', 'slug' => 'SettingsAdvanced', 'right' => '', ), array( 'title' => esc_html__( 'Email Settings', 'mainwp' ), 'parent_key' => 'Settings', 'href' => 'admin.php?page=SettingsEmail', 'slug' => 'SettingsEmail', 'right' => '', ), array( 'title' => esc_html__( 'Tools', 'mainwp' ), 'parent_key' => 'Settings', 'href' => 'admin.php?page=MainWPTools', 'slug' => 'MainWPTools', 'right' => '', ), array( 'title' => esc_html__( 'Cost Tracker', 'mainwp' ), 'parent_key' => 'Settings', 'href' => 'admin.php?page=CostTrackerSettings', 'slug' => 'CostTrackerSettings', 'right' => '', ), ); MainWP_Menu::init_subpages_left_menu( $subPages, $init_sub_subleftmenu, 'Settings', 'Settings' ); foreach ( $init_sub_subleftmenu as $item ) { if ( MainWP_Menu::is_disable_menu_item( 3, $item['slug'] ) ) { continue; } MainWP_Menu::add_left_menu( $item, 2 ); } } /** * Render Page Header. * * @param string $shownPage The page slug shown at this moment. * * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item() * @uses \MainWP\Dashboard\MainWP_UI::render_top_header() * @uses \MainWP\Dashboard\MainWP_UI::render_page_navigation() */ public static function render_header( $shownPage = '' ) { // phpcs:ignore -- NOSONAR - complex. $params = array( 'title' => esc_html__( 'MainWP Settings', 'mainwp' ), ); MainWP_UI::render_top_header( $params ); $renderItems = array(); $renderItems[] = array( 'title' => esc_html__( 'General Settings', 'mainwp' ), 'href' => 'admin.php?page=Settings', 'active' => ( '' === $shownPage ) ? true : false, ); if ( ! MainWP_Menu::is_disable_menu_item( 3, 'SettingsAdvanced' ) ) { $renderItems[] = array( 'title' => esc_html__( 'Advanced Settings', 'mainwp' ), 'href' => 'admin.php?page=SettingsAdvanced', 'active' => ( 'Advanced' === $shownPage ) ? true : false, ); } if ( ! MainWP_Menu::is_disable_menu_item( 3, 'SettingsEmail' ) ) { $renderItems[] = array( 'title' => esc_html__( 'Email Settings', 'mainwp' ), 'href' => 'admin.php?page=SettingsEmail', 'active' => ( 'Emails' === $shownPage ) ? true : false, ); } if ( ! MainWP_Menu::is_disable_menu_item( 3, 'CostTrackerSettings' ) ) { $renderItems[] = array( 'title' => esc_html__( 'Cost Tracker', 'mainwp' ), 'href' => 'admin.php?page=CostTrackerSettings', 'active' => ( 'CostTrackerSettings' === $shownPage ) ? true : false, ); } if ( isset( static::$subPages ) && is_array( static::$subPages ) ) { foreach ( static::$subPages as $subPage ) { if ( MainWP_Menu::is_disable_menu_item( 3, 'Settings' . $subPage['slug'] ) ) { continue; } $item = array(); $item['title'] = $subPage['title']; $item['href'] = 'admin.php?page=Settings' . $subPage['slug']; $item['active'] = ( $subPage['slug'] === $shownPage ) ? true : false; if ( ! empty( $subPage['before_title'] ) ) { $item['before_title'] = $subPage['before_title']; } if ( isset( $subPage['class'] ) ) { $item['class'] = $subPage['class']; } $renderItems[] = $item; } } if ( ! MainWP_Menu::is_disable_menu_item( 3, 'MainWPTools' ) ) { $renderItems[] = array( 'title' => esc_html__( 'Tools', 'mainwp' ), 'href' => 'admin.php?page=MainWPTools', 'active' => ( 'MainWPTools' === $shownPage ) ? true : false, ); } MainWP_UI::render_page_navigation( $renderItems, 'nav_mainwp_settings' ); } /** * Close the HTML container. */ public static function render_footer() { echo ''; } /** * Method handle_settings_post(). * * This class handles the $_POST of Settings Options. * * @uses MainWP_DB::instance() * @uses MainWP_Utility::update_option() * * @return boolean True|False Posts On True. * * @uses \MainWP\Dashboard\MainWP_DB_Common::get_user_extension() * @uses \MainWP\Dashboard\MainWP_DB_Common::update_user_extension() * @uses \MainWP\Dashboard\MainWP_System_Utility::is_admin() * @uses \MainWP\Dashboard\MainWP_Utility::update_option() */ public static function handle_settings_post() { // phpcs:ignore -- NOSONAR - complex. if ( isset( $_POST['submit'] ) && isset( $_POST['wp_nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['wp_nonce'] ), 'Settings' ) ) { $userExtension = MainWP_DB_Common::instance()->get_user_extension(); $userExtension->pluginDir = ''; MainWP_DB_Common::instance()->update_user_extension( $userExtension ); if ( MainWP_System_Utility::is_admin() ) { /** * Action: mainwp_before_save_general_settings * * Fires before general settings save. * * @since 4.1 */ do_action( 'mainwp_before_save_general_settings', $_POST ); $val = ( ! isset( $_POST['mainwp_pluginAutomaticDailyUpdate'] ) ? 0 : intval( $_POST['mainwp_pluginAutomaticDailyUpdate'] ) ); MainWP_Utility::update_option( 'mainwp_pluginAutomaticDailyUpdate', $val ); $val = ( ! isset( $_POST['mainwp_themeAutomaticDailyUpdate'] ) ? 0 : intval( $_POST['mainwp_themeAutomaticDailyUpdate'] ) ); MainWP_Utility::update_option( 'mainwp_themeAutomaticDailyUpdate', $val ); $val = ( ! isset( $_POST['mainwp_transAutomaticDailyUpdate'] ) ? 0 : intval( $_POST['mainwp_transAutomaticDailyUpdate'] ) ); MainWP_Utility::update_option( 'mainwp_transAutomaticDailyUpdate', $val ); $val = ( ! isset( $_POST['mainwp_automaticDailyUpdate'] ) ? 0 : intval( $_POST['mainwp_automaticDailyUpdate'] ) ); MainWP_Utility::update_option( 'mainwp_automaticDailyUpdate', $val ); $val = ( ! isset( $_POST['mainwp_show_language_updates'] ) ? 0 : 1 ); MainWP_Utility::update_option( 'mainwp_show_language_updates', $val ); $val = ( ! isset( $_POST['mainwp_disable_update_confirmations'] ) ? 0 : intval( $_POST['mainwp_disable_update_confirmations'] ) ); MainWP_Utility::update_option( 'mainwp_disable_update_confirmations', $val ); $val = ( ! isset( $_POST['mainwp_backup_before_upgrade'] ) ? 0 : 1 ); MainWP_Utility::update_option( 'mainwp_backup_before_upgrade', $val ); $val = ( ! isset( $_POST['mainwp_backup_before_upgrade_days'] ) ? 7 : intval( $_POST['mainwp_backup_before_upgrade_days'] ) ); MainWP_Utility::update_option( 'mainwp_backup_before_upgrade_days', $val ); if ( is_plugin_active( 'mainwp-comments-extension/mainwp-comments-extension.php' ) ) { MainWP_Utility::update_option( 'mainwp_maximumComments', isset( $_POST['mainwp_maximumComments'] ) ? intval( $_POST['mainwp_maximumComments'] ) : 50 ); } $current_timeDailyUpdate = get_option( 'mainwp_timeDailyUpdate' ); $new_timeDailyUpdate = isset( $_POST['mainwp_timeDailyUpdate'] ) ? sanitize_text_field( wp_unslash( $_POST['mainwp_timeDailyUpdate'] ) ) : ''; if ( $current_timeDailyUpdate !== $new_timeDailyUpdate ) { MainWP_Utility::update_option( 'mainwp_timeDailyUpdate', $new_timeDailyUpdate ); } $old_freq = (int) get_option( 'mainwp_frequencyDailyUpdate', 2 ); $new_freq = ( isset( $_POST['mainwp_frequencyDailyUpdate'] ) ? intval( $_POST['mainwp_frequencyDailyUpdate'] ) : 2 ); if ( $old_freq !== $new_freq ) { MainWP_Utility::update_option( 'mainwp_frequencyDailyUpdate', $new_freq ); MainWP_Logger::instance()->log_update_check( 'New frequency daily :: ' . $new_freq ); } $curr_frequency_updates = get_option( 'mainwp_frequency_AutoUpdate', 'daily' ); $new_frequency_updates = isset( $_POST['mainwp_frequency_AutoUpdate'] ) ? sanitize_text_field( wp_unslash( $_POST['mainwp_frequency_AutoUpdate'] ) ) : 'daily'; if ( $new_frequency_updates !== $curr_frequency_updates ) { MainWP_Utility::update_option( 'mainwp_frequency_AutoUpdate', $new_frequency_updates ); } $curr_day_updates = (int) get_option( 'mainwp_dayinweek_AutoUpdate', 0 ); $new_day_updates = isset( $_POST['mainwp_dayinweek_AutoUpdate'] ) ? intval( wp_unslash( $_POST['mainwp_dayinweek_AutoUpdate'] ) ) : 0; if ( $new_day_updates !== $curr_day_updates ) { MainWP_Utility::update_option( 'mainwp_dayinweek_AutoUpdate', $new_day_updates ); } $curr_dayinmonth_updates = (int) get_option( 'mainwp_dayinmonth_AutoUpdate', 1 ); $new_dayinmonth_updates = isset( $_POST['mainwp_dayinmonth_AutoUpdate'] ) ? intval( wp_unslash( $_POST['mainwp_dayinmonth_AutoUpdate'] ) ) : 1; if ( $new_dayinmonth_updates !== $curr_dayinmonth_updates ) { MainWP_Utility::update_option( 'mainwp_dayinmonth_AutoUpdate', $new_dayinmonth_updates ); } $curr_time_updates = get_option( 'mainwp_time_AutoUpdate', '00:00' ); $new_time_updates = isset( $_POST['mainwp_time_AutoUpdate'] ) ? sanitize_text_field( wp_unslash( $_POST['mainwp_time_AutoUpdate'] ) ) : '00:00'; if ( $new_time_updates !== $curr_time_updates ) { MainWP_Utility::update_option( 'mainwp_time_AutoUpdate', $new_time_updates ); } MainWP_Cron_Jobs_Auto_Updates::set_next_auto_updates_time(); $new_delay = ( isset( $_POST['mainwp_delay_autoupdate'] ) ? intval( $_POST['mainwp_delay_autoupdate'] ) : 1 ); MainWP_Utility::update_option( 'mainwp_delay_autoupdate', $new_delay ); $val = ( isset( $_POST['mainwp_sidebarPosition'] ) ? intval( $_POST['mainwp_sidebarPosition'] ) : 1 ); $user = wp_get_current_user(); if ( $user ) { update_user_option( $user->ID, 'mainwp_sidebarPosition', $val, true ); } MainWP_Utility::update_option( 'mainwp_numberdays_Outdate_Plugin_Theme', ! empty( $_POST['mainwp_numberdays_Outdate_Plugin_Theme'] ) ? intval( $_POST['mainwp_numberdays_Outdate_Plugin_Theme'] ) : 365 ); $check_http_response = ( isset( $_POST['mainwp_check_http_response'] ) ? 1 : 0 ); MainWP_Utility::update_option( 'mainwp_check_http_response', $check_http_response ); $chk_http_method = isset( $_POST['mainwp_check_http_response_method'] ) ? sanitize_text_field( wp_unslash( $_POST['mainwp_check_http_response_method'] ) ) : 'head'; $chk_http_method = in_array( $chk_http_method, array( 'get', 'head' ) ) ? $chk_http_method : 'head'; MainWP_Utility::update_option( 'mainwp_check_http_response_method', $chk_http_method ); $actions_notification_enable = ( isset( $_POST['mainwp_site_actions_notification_enable'] ) ? 1 : 0 ); MainWP_Utility::update_option( 'mainwp_site_actions_notification_enable', $actions_notification_enable ); //phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized // Handle custom date/time formats. if ( ! empty( $_POST['date_format'] ) && isset( $_POST['date_format_custom'] ) && '\c\u\s\t\o\m' === wp_unslash( $_POST['date_format'] ) ) { $_POST['date_format'] = wp_unslash( $_POST['date_format_custom'] ); } if ( ! empty( $_POST['time_format'] ) && isset( $_POST['time_format_custom'] ) && '\c\u\s\t\o\m' === wp_unslash( $_POST['time_format'] ) ) { $_POST['time_format'] = wp_unslash( $_POST['time_format_custom'] ); } if ( isset( $_POST['timezone_string'] ) ) { // Map UTC+- timezones to gmt_offsets and set timezone_string to empty. if ( ! empty( $_POST['timezone_string'] ) && preg_match( '/^UTC[+-]/', wp_unslash( $_POST['timezone_string'] ) ) ) { $_POST['gmt_offset'] = wp_unslash( $_POST['timezone_string'] ); $_POST['gmt_offset'] = preg_replace( '/UTC\+?/', '', wp_unslash( $_POST['gmt_offset'] ) ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated $_POST['timezone_string'] = ''; } $options = array( 'gmt_offset', 'date_format', 'time_format', 'timezone_string', ); foreach ( $options as $option ) { $value = null; if ( isset( $_POST[ $option ] ) ) { $value = wp_unslash( $_POST[ $option ] ); if ( ! is_array( $value ) ) { $value = trim( $value ); } } update_option( $option, $value ); } } //phpcs:enable MainWP_Utility::update_option( 'mainwp_use_favicon', 1 ); /** * Action: mainwp_after_save_general_settings * * Fires after save general settings. * * @since 4.1 */ do_action( 'mainwp_after_save_general_settings', $_POST ); } return true; } return false; } /** * Render the MainWP Settings Page. * * @uses \MainWP\Dashboard\MainWP_Monitoring_View * @uses \MainWP\Dashboard\MainWP_Manage_Backups::render_settings() * @uses \MainWP\Dashboard\MainWP_Utility::get_http_codes() */ public static function render() { //phpcs:ignore -- NOSONAR - complex method. if ( ! \mainwp_current_user_can( 'dashboard', 'manage_dashboard_settings' ) ) { \mainwp_do_not_have_permissions( esc_html__( 'manage dashboard settings', 'mainwp' ) ); return; } static::render_header( '' ); ?>
', ' ' ); ?>

/>
/>
hide-element="http-respon-check">
" data-inverted="" data-position="top left">
/>
>
>
>
' . esc_html( date_i18n( $timezone_format, false, true ) ) . '' ); ?> ' . esc_html( date_i18n( $timezone_format ) ) . '' ); ?> format( 'I' ); if ( $dst ) { esc_html_e( 'This timezone is currently in daylight saving time.', 'mainwp' ); } else { esc_html_e( 'This timezone is currently in standard time.', 'mainwp' ); } ?> ' . wp_date( esc_html__( 'F j, Y' ) . ' ' . esc_html__( 'g:i a' ), esc_html( $transitions[1]['ts'] ) ) . '' ); // phpcs:ignore WordPress.Security.EscapeOutput } else { esc_html_e( 'This timezone does not observe daylight saving time.', 'mainwp' ); } } ?>
' . esc_html( date_i18n( $format ) ) . '' . esc_html( $format ) . "
\n"; } echo '' . '' . '' . '
' . '' . esc_html__( 'Preview:' ) . ' ' . esc_html( date_i18n( get_option( 'date_format' ) ) ) . '' . "\n" . ''; ?>
' . esc_html( date_i18n( $format ) ) . '' . esc_html( $format ) . "
\n"; } echo '' . '' . '' . '
' . '' . esc_html__( 'Preview:' ) . ' ' . esc_html( date_i18n( get_option( 'time_format' ) ) ) . '' . "\n" . ''; ?>
get_websites_last_automatic_sync(); $lasttimeAutomatic = get_option( 'mainwp_updatescheck_last_timestamp' ); $lasttimeStartAutomatic = get_option( 'mainwp_updatescheck_start_last_timestamp' ); $local_timestamp = MainWP_Utility::get_timestamp(); if ( empty( $lasttimeStartAutomatic ) && ! empty( $lasttimeAutomatic ) ) { $lasttimeStartAutomatic = $lasttimeAutomatic; } if ( empty( $lastAutomaticUpdate ) ) { $nextAutomaticUpdate = esc_html__( 'Any minute', 'mainwp' ); } elseif ( 0 < MainWP_Auto_Updates_DB::instance()->get_websites_check_updates_count( $lasttimeStartAutomatic ) ) { $nextAutomaticUpdate = esc_html__( 'Processing your websites.', 'mainwp' ); } else { $next_time = MainWP_System_Cron_Jobs::get_next_time_automatic_update_to_show(); if ( $next_time < $local_timestamp + 5 * MINUTE_IN_SECONDS ) { $nextAutomaticUpdate = esc_html__( 'Any minute', 'mainwp' ); } else { $nextAutomaticUpdate = MainWP_Utility::format_timestamp( $next_time ); } } if ( empty( $lastAutomaticUpdate ) ) { $lastAutomaticUpdate = esc_html__( 'Never', 'mainwp' ); } else { $lastAutomaticUpdate = MainWP_Utility::format_timestamp( $lastAutomaticUpdate ); } return array( 'last' => $lastAutomaticUpdate, 'next' => $nextAutomaticUpdate, ); } /** * Returns false or the location of the OpenSSL Lib File. * * @return mixed false|opensslLibLocation * * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_openssl_config_warning() */ public static function show_openssl_lib_config() { return MainWP_Server_Information_Handler::is_openssl_config_warning() ? true : false; } /** * Render Advanced Options Subpage. * * @uses \MainWP\Dashboard\MainWP_Utility::update_option() */ public static function render_advanced() { //phpcs:ignore -- NOSONAR - complex method. if ( ! \mainwp_current_user_can( 'dashboard', 'manage_dashboard_settings' ) ) { \mainwp_do_not_have_permissions( esc_html__( 'manage dashboard settings', 'mainwp' ) ); return; } if ( isset( $_POST['submit'] ) && isset( $_POST['wp_nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['wp_nonce'] ), 'SettingsAdvanced' ) ) { /** * Action: mainwp_before_save_advanced_settings * * Fires before save advanced settings. * * @since 4.1 */ do_action( 'mainwp_before_save_advanced_settings', $_POST ); MainWP_Utility::update_option( 'mainwp_maximumRequests', ! empty( $_POST['mainwp_maximumRequests'] ) ? intval( $_POST['mainwp_maximumRequests'] ) : 4 ); MainWP_Utility::update_option( 'mainwp_minimumDelay', ! empty( $_POST['mainwp_minimumDelay'] ) ? intval( $_POST['mainwp_minimumDelay'] ) : 200 ); MainWP_Utility::update_option( 'mainwp_maximumIPRequests', ! empty( $_POST['mainwp_maximumIPRequests'] ) ? intval( $_POST['mainwp_maximumIPRequests'] ) : 1 ); MainWP_Utility::update_option( 'mainwp_minimumIPDelay', ! empty( $_POST['mainwp_minimumIPDelay'] ) ? intval( $_POST['mainwp_minimumIPDelay'] ) : 1000 ); MainWP_Utility::update_option( 'mainwp_maximumSyncRequests', ! empty( $_POST['mainwp_maximumSyncRequests'] ) ? intval( $_POST['mainwp_maximumSyncRequests'] ) : 8 ); MainWP_Utility::update_option( 'mainwp_maximumInstallUpdateRequests', ! empty( $_POST['mainwp_maximumInstallUpdateRequests'] ) ? intval( $_POST['mainwp_maximumInstallUpdateRequests'] ) : 3 ); MainWP_Utility::update_option( 'mainwp_sslVerifyCertificate', isset( $_POST['mainwp_sslVerifyCertificate'] ) ? 1 : 0 ); MainWP_Utility::update_option( 'mainwp_connect_signature_algo', isset( $_POST['mainwp_settings_openssl_alg'] ) ? sanitize_text_field( wp_unslash( $_POST['mainwp_settings_openssl_alg'] ) ) : 0 ); MainWP_Utility::update_option( 'mainwp_verify_connection_method', isset( $_POST['mainwp_settings_verify_connection_method'] ) ? intval( $_POST['mainwp_settings_verify_connection_method'] ) : 0 ); MainWP_Utility::update_option( 'mainwp_forceUseIPv4', isset( $_POST['mainwp_forceUseIPv4'] ) ? 1 : 0 ); $use_wpcron = ! isset( $_POST['mainwp_options_wp_cron'] ) ? 0 : 1; MainWP_Utility::update_option( 'mainwp_wp_cron', $use_wpcron ); MainWP_Utility::update_option( 'mainwp_optimize', ( ! isset( $_POST['mainwp_optimize'] ) ? 0 : 1 ) ); MainWP_Utility::update_option( 'mainwp_maximum_uptime_monitoring_requests', ! empty( $_POST['mainwp_maximumUptimeMonitoringRequests'] ) ? intval( $_POST['mainwp_maximumUptimeMonitoringRequests'] ) : 10 ); MainWP_Utility::update_option( 'mainwp_chunksitesnumber', isset( $_POST['mainwp_chunksitesnumber'] ) ? intval( $_POST['mainwp_chunksitesnumber'] ) : 10 ); MainWP_Utility::update_option( 'mainwp_chunksleepinterval', isset( $_POST['mainwp_chunksleepinterval'] ) ? intval( $_POST['mainwp_chunksleepinterval'] ) : 5 ); $sync_data = array(); if ( isset( $_POST['mainwp_settings_sync_data'] ) && is_array( $_POST['mainwp_settings_sync_data'] ) ) { $selected_data = array_map( 'sanitize_text_field', wp_unslash( $_POST['mainwp_settings_sync_data'] ) ); foreach ( $selected_data as $name ) { $sync_data[ $name ] = 1; } } if ( isset( $_POST['mainwp_settings_sync_name'] ) && is_array( $_POST['mainwp_settings_sync_name'] ) ) { $name_data = array_map( 'sanitize_text_field', wp_unslash( $_POST['mainwp_settings_sync_name'] ) ); foreach ( $name_data as $name ) { if ( ! isset( $sync_data[ $name ] ) ) { $sync_data[ $name ] = 0; } } } MainWP_Utility::update_option( 'mainwp_settings_sync_data', wp_json_encode( $sync_data ) ); // required check. MainWP_Uptime_Monitoring_Schedule::instance()->check_to_disable_schedule_individual_uptime_monitoring(); // required a check to sync the settings. if ( isset( $_POST['mainwp_openssl_lib_location'] ) ) { $openssl_loc = ! empty( $_POST['mainwp_openssl_lib_location'] ) ? sanitize_text_field( wp_unslash( $_POST['mainwp_openssl_lib_location'] ) ) : ''; MainWP_Utility::update_option( 'mainwp_opensslLibLocation', $openssl_loc ); } /** * Action: mainwp_after_save_advanced_settings * * Fires after advanced settings save. * * @since 4.1 */ do_action( 'mainwp_after_save_advanced_settings', $_POST ); } static::render_header( 'Advanced' ); ?>

', ' ' ); ?>

/>
/>
/>
" data-inverted="" data-position="top left">
>
" data-inverted="" data-position="top left">
>
/>
data-inverted="" data-position="top left">
__( 'WordPress updates information', 'mainwp' ), 'plugin_updates' => __( 'Plugins updates information', 'mainwp' ), 'theme_updates' => __( 'Themes updates information', 'mainwp' ), 'translation_updates' => __( 'Translations updates information', 'mainwp' ), 'recent_comments' => __( 'Recent comments', 'mainwp' ), 'recent_posts' => __( 'Recent posts', 'mainwp' ), 'recent_pages' => __( 'Recent pages', 'mainwp' ), 'securityStats' => __( 'Site hardening information', 'mainwp' ), 'directories' => __( 'Site directory listing (needed for legacy backup feature)', 'mainwp' ), 'categories' => __( 'Posts catetegories', 'mainwp' ), 'totalsize' => __( 'Website size (needed for Clone and legacy backup features)', 'mainwp' ), 'dbsize' => __( 'Database size information', 'mainwp' ), 'plugins' => __( 'Installed plugins', 'mainwp' ), 'themes' => __( 'Installed Themes', 'mainwp' ), 'users' => __( 'Users information', 'mainwp' ), 'plugins_outdate_info' => __( 'Abandoned plugins information', 'mainwp' ), 'themes_outdate_info' => __( 'Abandoned themes information', 'mainwp' ), 'health_site_status' => __( 'Site health information', 'mainwp' ), 'child_site_actions_data' => __( 'Non-MainWP changes data', 'mainwp' ), 'othersData' => __( 'Other data (required by some extensions)', 'mainwp' ), ); } /** * Method get_data_list_to_sync(). * * @return array Data list to sync. */ public function get_data_list_to_sync() { $sync_data_settings = get_option( 'mainwp_settings_sync_data' ); if ( false === $sync_data_settings ) { $default_sync = static::get_data_sync_default(); $sync_lists = array_fill_keys( array_keys( $default_sync ), 1 ); MainWP_Utility::update_option( 'mainwp_settings_sync_data', wp_json_encode( $sync_lists ) ); return $sync_lists; } $sync_lists = ! empty( $sync_data_settings ) ? json_decode( $sync_data_settings, true ) : array(); if ( ! is_array( $sync_lists ) ) { $sync_lists = array(); } return $sync_lists; } /** * Render MainWP Tools SubPage. * * @uses \MainWP\Dashboard\MainWP_UI::render_screen_options() */ public static function render_mainwp_tools() { // phpcs:ignore -- NOSONAR - complex. if ( ! \mainwp_current_user_can( 'dashboard', 'manage_dashboard_settings' ) ) { \mainwp_do_not_have_permissions( esc_html__( 'manage dashboard settings', 'mainwp' ) ); return; } static::render_header( 'MainWPTools' ); $is_demo = MainWP_Demo_Handle::is_demo_mode(); ?>
', ' ' ); ?>

render_select_custom_themes(); ?>
render_demo_disable_button( '' ); } else { ?>
render_demo_disable_button( '' . esc_html__( 'Reset OpenSSL Key Pair', 'mainwp' ) . '' ); } else { ?>
render_demo_disable_button( '' . esc_html__( 'Disconnect Sites', 'mainwp' ) . '' ); } else { ?>

/>
/>
/>
get_current_user_theme(); if ( false === $custom_theme ) { // to compatible with Custom Dashboard extension settings. $compat_settings = get_option( 'mainwp_custom_dashboard_settings' ); if ( is_array( $compat_settings ) && isset( $compat_settings['theme'] ) ) { $compat_theme = $compat_settings['theme']; } if ( null !== $compat_theme ) { $custom_theme = $compat_theme; } } $themes_files = static::get_instance()->get_custom_themes_files(); if ( empty( $themes_files ) ) { $themes_files = array(); } ?>
get_custom_theme_folder(); $scan_dir = $dirs[0]; $handle = opendir( $scan_dir ); $themes = array(); if ( $handle ) { $filename = readdir( $handle ); while ( false !== $filename ) { $correct_file = true; if ( '.' === substr( $filename, 0, 1 ) || 'index.php' === $filename || '.css' !== substr( $filename, - 4 ) ) { $correct_file = false; } if ( $correct_file ) { $theme = basename( $filename, '.css' ); $theme = str_replace( '-theme', '', $theme ); $themes[ $filename ] = trim( $theme ); } $filename = readdir( $handle ); // to while loop. } closedir( $handle ); } return $themes; } /** * Get selected MainWP theme name. */ public function get_selected_theme() { $selected_theme = false; $custom_theme = $this->get_current_user_theme(); if ( false === $custom_theme ) { // to compatible with Custom Dashboard extension settings. $compat_settings = get_option( 'mainwp_custom_dashboard_settings' ); if ( is_array( $compat_settings ) && isset( $compat_settings['theme'] ) ) { $compat_theme = $compat_settings['theme']; } if ( null !== $compat_theme ) { $custom_theme = $compat_theme; } } if ( ! empty( $custom_theme ) ) { if ( 'default' === $custom_theme || 'default-2024' === $custom_theme || 'dark' === $custom_theme || 'wpadmin' === $custom_theme || 'minimalistic' === $custom_theme ) { return $custom_theme; } $dirs = $this->get_custom_theme_folder(); $theme_dir = $dirs[0]; $file = $theme_dir . $custom_theme; if ( file_exists( $file ) && '.css' === substr( $file, - 4 ) ) { $selected_theme = $custom_theme; } } return $selected_theme; } /** * Get custom MainWP theme folder. */ public function get_custom_theme_folder() { $dirs = MainWP_System_Utility::get_mainwp_dir(); global $wp_filesystem; if ( is_array( $dirs ) && ! $wp_filesystem->exists( $dirs[0] . 'themes' ) && $wp_filesystem->exists( $dirs[0] . 'custom-dashboard' ) ) { // re-name the custom-dashboard folder to compatible. $wp_filesystem->move( $dirs[0] . 'custom-dashboard', $dirs[0] . 'themes' ); } return MainWP_System_Utility::get_mainwp_dir_allow_access( 'themes' ); } /** * Get current user's selected theme. */ public function get_current_user_theme() { $custom_theme = get_user_option( 'mainwp_selected_theme' ); if ( empty( $custom_theme ) ) { $custom_theme = get_option( 'mainwp_selected_theme', 'default' ); } return $custom_theme; } /** * Export Child Sites and save as .csv file. * * @uses \MainWP\Dashboard\MainWP_DB::query() * @uses \MainWP\Dashboard\MainWP_DB::get_sql_websites_for_current_user() * @uses \MainWP\Dashboard\MainWP_DB::data_seek() * @uses \MainWP\Dashboard\MainWP_DB::fetch_object() * @uses \MainWP\Dashboard\MainWP_Utility::map_site() */ public static function export_sites() { if ( isset( $_GET['doExportSites'] ) && isset( $_GET['_wpnonce'] ) && wp_verify_nonce( sanitize_key( $_GET['_wpnonce'] ), 'export_sites' ) ) { $sql = MainWP_DB::instance()->get_sql_websites_for_current_user( true ); $websites = MainWP_DB::instance()->query( $sql ); if ( ! $websites ) { die( 'Not found sites' ); } $keys = array( 'name', 'url', 'adminname', 'adminpasswd', 'wpgroups', 'uniqueId', 'http_user', 'http_pass', 'verify_certificate', 'ssl_version' ); $allowedHeaders = array( 'site name', 'url', 'admin name', 'admin password', 'tag', 'security id', 'http username', 'http password', 'verify certificate', 'ssl version' ); $csv = "#\r"; $csv .= '# Your password is never stored by your Dashboard and never sent to MainWP.com. Once this initial connection is complete, your MainWP Dashboard generates a secure Public and Private key pair (2048 bits) using OpenSSL, allowing future connections without needing your password again. For added security, you can even change this admin password once connected, just be sure not to delete the admin account, as this would disrupt the connection.' . "\r"; $csv .= "#\r"; $csv .= implode( ',', $allowedHeaders ) . "\r"; MainWP_DB::data_seek( $websites, 0 ); while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) { if ( empty( $website ) ) { continue; } $row = MainWP_Utility::map_site( $website, $keys, false ); $csv .= '"' . implode( '","', $row ) . '"' . "\r"; } header( 'Content-Type: text/csv; charset=utf-8' ); header( 'Content-Disposition: attachment; filename=export-sites.csv' ); echo $csv; // phpcs:ignore WordPress.Security.EscapeOutput exit(); } } /** * Render MainWP Email Settings SubPage. * * @uses \MainWP\Dashboard\MainWP_Notification_Settings::get_notification_types() * @uses \MainWP\Dashboard\MainWP_Notification_Settings::render_edit_settings() * @uses \MainWP\Dashboard\MainWP_Notification_Settings::emails_general_settings_handle() * @uses \MainWP\Dashboard\MainWP_Notification_Settings::render_all_settings() * @uses \MainWP\Dashboard\MainWP_Notification_Template::handle_template_file_action() */ public static function render_email_settings() { $notification_emails = MainWP_Notification_Settings::get_notification_types(); static::render_header( 'Emails' ); $edit_email = isset( $_GET['edit-email'] ) ? sanitize_text_field( wp_unslash( $_GET['edit-email'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( ! empty( $edit_email ) && isset( $notification_emails[ $edit_email ] ) ) { $updated_templ = MainWP_Notification_Template::instance()->handle_template_file_action(); MainWP_Notification_Settings::instance()->render_edit_settings( $edit_email, $updated_templ ); } else { $updated = MainWP_Notification_Settings::emails_general_settings_handle(); MainWP_Notification_Settings::instance()->render_all_settings( $updated ); } static::render_footer( 'Emails' ); } /** * Method mainwp_help_content() * * Creates the MainWP Help Documentation List for the help component in the sidebar. */ public static function mainwp_help_content() { if ( isset( $_GET['page'] ) && ( 'Settings' === $_GET['page'] || 'SettingsAdvanced' === $_GET['page'] || 'MainWPTools' === $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized ?>

MainWP Dashboard Settings
Updates Settings
Uptime Monitoring Settings
Site Health Settings
Backup Settings
Advanced Settings
Email Settings
Tools
Your custom text * * @since 5.2 */ do_action( 'mainwp_settings_help_item' ); } } }