| @@ -6,8 +6,13 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace MainWP\Dashboard; |
| 9 | 9 | |
| 10 | +// Exit if accessed directly. | |
| 11 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 12 | + exit; | |
| 13 | +} | |
| 14 | + | |
| 10 | 15 | /** |
| 11 | 16 | * Class MainWP_Settings_Indicator |
| 12 | 17 | * |
| 13 | 18 | * @package MainWP\Dashboard |
| @@ -45,11 +50,11 @@ | ||
| 45 | 50 | |
| 46 | 51 | /** |
| 47 | 52 | * Method render_indicator(). |
| 48 | 53 | * |
| 49 | - * @param bool $indi_type Indicator type. | |
| 50 | - * @param bool $wrapper_cls field wrapper class. | |
| 51 | - * @param bool $visible Current indicator status. | |
| 54 | + * @param string $indi_type Indicator type. | |
| 55 | + * @param string $wrapper_cls field wrapper class. | |
| 56 | + * @param bool $visible Current indicator status. | |
| 52 | 57 | */ |
| 53 | 58 | public static function render_indicator( $indi_type = 'field', $wrapper_cls = '', $visible = true ) { |
| 54 | 59 | echo static::get_indicator( $indi_type, $wrapper_cls, $visible ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 55 | 60 | } |
| @@ -64,9 +69,9 @@ | ||
| 64 | 69 | $cls = $visible ? 'visible-indicator' : ''; |
| 65 | 70 | if ( 'header' === $indi_type ) { |
| 66 | 71 | return '<i style="display:none;" field-indicator-wrapper-class="' . esc_html( $wrapper_cls ) . '" class="ui circle icon tiny yellow settings-field-header-indicator ' . $cls . ' "></i>'; |
| 67 | 72 | } else { |
| 68 | - return '<i class="ui circle icon tiny yellow settings-field-icon-indicator ' . $cls . '"></i>'; | |
| 73 | + return '<span data-tooltip="' . esc_attr__( 'Changed from default', 'mainwp' ) . '" data-variation="mini" data-position="top center" data-inverted=""><i class="ui circle icon tiny yellow settings-field-icon-indicator ' . $cls . '"></i></span>'; | |
| 69 | 74 | } |
| 70 | 75 | } |
| 71 | 76 | |
| 72 | 77 | /** |
| @@ -74,18 +79,23 @@ | ||
| 74 | 79 | * |
| 75 | 80 | * @param string $field setting field to check. |
| 76 | 81 | * @param mixed $current_value setting current value. |
| 77 | 82 | * @param bool $render_indi to render indication. |
| 83 | + * @param mixed $default_val default value directly. | |
| 78 | 84 | */ |
| 79 | - public static function render_not_default_indicator( $field, $current_value, $render_indi = true ) { | |
| 80 | - $def = static::get_defaults_value( $field ); | |
| 85 | + public static function render_not_default_indicator( $field, $current_value, $render_indi = true, $default_val = null ) { | |
| 86 | + $indi_value = static::get_defaults_value( $field ); | |
| 81 | 87 | |
| 88 | + if ( null !== $default_val ) { | |
| 89 | + $indi_value = $default_val; | |
| 90 | + } | |
| 91 | + | |
| 82 | 92 | $visible = false; |
| 83 | - if ( ( 'none_preset_value' !== $field && $current_value !== $def ) || ( 'none_preset_value' === $field && ! empty( $current_value ) ) ) { | |
| 93 | + if ( ( 'none_preset_value' !== $field && $current_value !== $indi_value ) || ( 'none_preset_value' === $field && ! empty( $current_value ) ) ) { | |
| 84 | 94 | $visible = true; |
| 85 | 95 | } |
| 86 | 96 | $indi = static::get_indicator( 'field', '', $visible ); |
| 87 | - $indi = apply_filters( 'mainwp_default_settings_indicator', $indi, $field, $def, $current_value, $render_indi ); | |
| 97 | + $indi = apply_filters( 'mainwp_default_settings_indicator', $indi, $field, $indi_value, $current_value, $render_indi, $default_val ); | |
| 88 | 98 | if ( $render_indi ) { |
| 89 | 99 | echo $indi; //phpcs:ignore -- ok. |
| 90 | 100 | } |
| 91 | 101 | return $indi; |
| @@ -135,13 +145,11 @@ | ||
| 135 | 145 | 'mainwp_delay_autoupdate' => 1, |
| 136 | 146 | 'mainwp_disable_update_confirmations' => 0, |
| 137 | 147 | 'mainwp_show_language_updates' => 1, |
| 138 | 148 | 'mainwp_check_http_response' => 0, |
| 139 | - 'mainwp_ignore_HTTP_response_status' => '', | |
| 140 | 149 | 'mainwp_backup_before_upgrade' => 0, |
| 141 | 150 | 'mainwp_backup_before_upgrade_days' => 7, |
| 142 | 151 | 'mainwp_numberdays_Outdate_Plugin_Theme' => 365, |
| 143 | - 'mainwp_disableSitesChecking' => 1, // default disable. | |
| 144 | 152 | 'mainwp_disableSitesHealthMonitoring' => 1, |
| 145 | 153 | 'mainwp_sitehealthThreshold' => 80, |
| 146 | 154 | 'mainwp_enableLegacyBackupFeature' => 0, |
| 147 | 155 | 'mainwp_backupsOnServer' => 1, |
| @@ -158,8 +166,9 @@ | ||
| 158 | 166 | 'mainwp_maximumIPRequests' => 1, |
| 159 | 167 | 'mainwp_minimumIPDelay' => 1000, |
| 160 | 168 | 'mainwp_maximumSyncRequests' => 8, |
| 161 | 169 | 'mainwp_maximumInstallUpdateRequests' => 3, |
| 170 | + 'mainwp_maximum_uptime_monitoring_requests' => 10, | |
| 162 | 171 | 'mainwp_optimize' => 1, |
| 163 | 172 | 'mainwp_wp_cron' => 1, |
| 164 | 173 | 'mainwp_sslVerifyCertificate' => 1, |
| 165 | 174 | 'mainwp_verify_connection_method' => 1, |
| @@ -167,8 +176,10 @@ | ||
| 167 | 176 | 'mainwp_forceUseIPv4' => 0, |
| 168 | 177 | 'mainwp_module_log_enabled' => 1, |
| 169 | 178 | 'mainwp_selected_theme' => 'default', |
| 170 | 179 | 'mainwp_enable_guided_tours' => 0, |
| 180 | + 'mainwp_enable_guided_video' => 0, | |
| 181 | + 'mainwp_enable_guided_chatbase' => 0, | |
| 171 | 182 | 'mainwp_site_backup_before_upgrade' => 2, |
| 172 | 183 | 'mainwp_site_suspended_site' => 0, |
| 173 | 184 | 'mainwp_site_automatic_update' => 0, |
| 174 | 185 | 'mainwp_site_is_ignoreCoreUpdates' => 0, |
| @@ -173,12 +184,12 @@ | ||
| 173 | 184 | 'mainwp_site_automatic_update' => 0, |
| 174 | 185 | 'mainwp_site_is_ignoreCoreUpdates' => 0, |
| 175 | 186 | 'mainwp_site_is_ignorePluginUpdates' => 0, |
| 176 | 187 | 'mainwp_site_is_ignoreThemeUpdates' => 0, |
| 177 | - 'mainwp_site_status_check_interval' => 0, // Use global setting. | |
| 188 | + 'mainwp_site_is_ignore_trans_updates' => 0, | |
| 178 | 189 | 'mainwp_site_monitoring_notification_emails' => '', |
| 179 | 190 | 'mainwp_site_disable_health_check' => 0, |
| 180 | - 'mainwp_site_verify_certificate' => 1, | |
| 191 | + 'mainwp_site_verify_certificate' => 2, | |
| 181 | 192 | 'mainwp_site_ssl_version' => 0, |
| 182 | 193 | 'mainwp_site_verify_method' => 3, |
| 183 | 194 | 'mainwp_site_signature_algo' => 9999, // Use global setting. |
| 184 | 195 | 'mainwp_site_force_use_ipv4' => 2, // Use global setting. |
| @@ -190,9 +201,19 @@ | ||
| 190 | 201 | 'cost_tracker_currency_position' => is_array( $defauls_currency_settings ) && isset( $defauls_currency_settings['currency_position'] ) ? $defauls_currency_settings['currency_position'] : null, |
| 191 | 202 | 'cost_tracker_thousand_separator' => is_array( $defauls_currency_settings ) && isset( $defauls_currency_settings['thousand_separator'] ) ? $defauls_currency_settings['thousand_separator'] : null, |
| 192 | 203 | 'cost_tracker_decimal_separator' => is_array( $defauls_currency_settings ) && isset( $defauls_currency_settings['decimal_separator'] ) ? $defauls_currency_settings['decimal_separator'] : null, |
| 193 | 204 | 'cost_tracker_decimals' => is_array( $defauls_currency_settings ) && isset( $defauls_currency_settings['decimals'] ) ? (int) $defauls_currency_settings['decimals'] : null, |
| 194 | - 'mainwp_frequencySitesChecking' => 60, | |
| 205 | + 'mainwp_frequency_AutoUpdate' => 'daily', | |
| 206 | + 'mainwp_dayinweek_AutoUpdate' => 0, | |
| 207 | + 'mainwp_dayinmonth_AutoUpdate' => 1, | |
| 208 | + 'mainwp_time_AutoUpdate' => '00:00', | |
| 209 | + 'mainwp_edit_monitor_up_status_codes' => 'useglobal', | |
| 210 | + 'mainwp_edit_monitor_maxretries' => -1, // use global. | |
| 211 | + 'mainwp_edit_monitor_maxretries_global' => 1, | |
| 212 | + 'mainwp_edit_monitor_monitoring_emails' => '', | |
| 213 | + 'mainwp_check_http_response_method' => 'head', | |
| 214 | + 'mainwp_warm_cache_pages_ttl' => 10, | |
| 215 | + 'mainwp_module_log_child_activities_ttl' => 7, | |
| 195 | 216 | ); |
| 196 | 217 | |
| 197 | 218 | if ( 'all' === $field ) { |
| 198 | 219 | return $defaults; |
| @@ -215,9 +236,9 @@ | ||
| 215 | 236 | $defaults = array( |
| 216 | 237 | 'daily_digest' => array( |
| 217 | 238 | 'disable' => $disable, |
| 218 | 239 | 'recipients' => $recipients, |
| 219 | - 'subject' => $general ? 'Daily Digest' : '[site.name] Daily Digest', | |
| 240 | + 'subject' => $general ? 'Daily Digest from Your MainWP Dashboard' : '[site.name] Daily Digest from Your MainWP Dashboard', | |
| 220 | 241 | 'heading' => $general ? 'Daily Digest' : '[site.name] Daily Digest', |
| 221 | 242 | 'overrided' => 0, |
| 222 | 243 | ), |
| 223 | 244 | 'uptime' => array( |
| @@ -222,9 +243,9 @@ | ||
| 222 | 243 | ), |
| 223 | 244 | 'uptime' => array( |
| 224 | 245 | 'disable' => $disable, |
| 225 | 246 | 'recipients' => $recipients, |
| 226 | - 'subject' => $general ? 'Uptime Monitoring' : '[site.name] Uptime Monitoring', | |
| 247 | + 'subject' => $general ? 'Uptime Monitoring Alert from your MainWP Dashboard' : '[site.name] Uptime Monitoring Alert from your MainWP Dashboard', | |
| 227 | 248 | 'heading' => $general ? 'Uptime Monitoring' : '[site.name] Uptime Monitoring', |
| 228 | 249 | 'overrided' => 0, |
| 229 | 250 | ), |
| 230 | 251 | 'site_health' => array( |
| @@ -229,9 +250,9 @@ | ||
| 229 | 250 | ), |
| 230 | 251 | 'site_health' => array( |
| 231 | 252 | 'disable' => $disable, |
| 232 | 253 | 'recipients' => $recipients, |
| 233 | - 'subject' => $general ? 'Site Health Monitoring' : '[site.name] Site Health Monitoring', | |
| 254 | + 'subject' => $general ? 'Site Health Monitoring Alert from Your MainWP Dashboard' : '[site.name] Site Health Monitoring Alert from Your MainWP Dashboard', | |
| 234 | 255 | 'heading' => $general ? 'Site Health Monitoring' : '[site.name] Site Health Monitoring', |
| 235 | 256 | 'overrided' => 0, |
| 236 | 257 | ), |
| 237 | 258 | 'http_check' => array( |
| @@ -243,9 +264,9 @@ | ||
| 243 | 264 | ), |
| 244 | 265 | 'deactivated_license_alert' => array( |
| 245 | 266 | 'disable' => $disable, |
| 246 | 267 | 'recipients' => $recipients, |
| 247 | - 'subject' => 'Extension License Deactivation Notification', | |
| 268 | + 'subject' => 'Extension License Deactivation Notification from Your MainWP Dashboard', | |
| 248 | 269 | 'heading' => 'Extension License Deactivation Notification', |
| 249 | 270 | 'overrided' => 0, |
| 250 | 271 | ), |
| 251 | 272 | ); |
| @@ -259,24 +280,6 @@ | ||
| 259 | 280 | return 0; // for additions. |
| 260 | 281 | } |
| 261 | 282 | |
| 262 | 283 | return isset( $defaults[ $type ] ) && isset( $defaults[ $type ][ $field ] ) ? $defaults[ $type ][ $field ] : null; |
| 263 | - } | |
| 264 | - | |
| 265 | - | |
| 266 | - /** | |
| 267 | - * Method get_saved_indicator_status(). | |
| 268 | - */ | |
| 269 | - public function get_saved_indicator_status() { | |
| 270 | - | |
| 271 | - if ( null === static::$saved_indicator_status ) { | |
| 272 | - $values = get_option( 'mainwp_status_saved_values' ); | |
| 273 | - $current_values = is_array( $values ) && isset( $values['save_indicator_values'] ) && ! empty( $values['save_indicator_values'] ) ? json_decode( $values['save_indicator_values'], true ) : array(); | |
| 274 | - if ( ! is_array( $current_values ) ) { | |
| 275 | - $current_values = array(); | |
| 276 | - } | |
| 277 | - static::$saved_indicator_status = $current_values; | |
| 278 | - } | |
| 279 | - | |
| 280 | - return static::$saved_indicator_status; | |
| 281 | 284 | } |
| 282 | 285 | } |