| @@ -6,8 +6,16 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace MainWP\Dashboard; |
| 9 | 9 | |
| 10 | +use MainWP\Dashboard\Module\Log\Log_DB_Helper; | |
| 11 | + | |
| 12 | +// Exit if accessed directly. | |
| 13 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | + exit; | |
| 15 | +} | |
| 16 | + | |
| 17 | + | |
| 10 | 18 | // phpcs:disable Generic.Metrics.CyclomaticComplexity -- complexity. |
| 11 | 19 | /** |
| 12 | 20 | * Class MainWP_Server_Information |
| 13 | 21 | */ |
| @@ -33,132 +41,368 @@ | ||
| 33 | 41 | return __CLASS__; |
| 34 | 42 | } |
| 35 | 43 | |
| 36 | 44 | /** |
| 37 | - * Method init_menu() | |
| 45 | + * Get the registered Info subpages. | |
| 38 | 46 | * |
| 39 | - * Initiate Info subPage menu. | |
| 40 | - * | |
| 41 | - * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item() | |
| 42 | - * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_apache_server_software() | |
| 47 | + * @return array<int, array<string, mixed>> Info subpages. | |
| 43 | 48 | */ |
| 44 | - public static function init_menu() { // phpcs:ignore -- NOSONAR - complex. | |
| 49 | + private static function get_subpages() { | |
| 50 | + if ( isset( static::$subPages ) && is_array( static::$subPages ) ) { | |
| 51 | + return static::$subPages; | |
| 52 | + } | |
| 45 | 53 | |
| 46 | - add_action( 'mainwp_pageheader_infor', array( static::get_class_name(), 'render_header' ) ); | |
| 47 | - add_action( 'mainwp_pagefooter_infor', array( static::get_class_name(), 'render_footer' ) ); | |
| 54 | + /** | |
| 55 | + * Filter mainwp_getsubpages_server | |
| 56 | + * | |
| 57 | + * Filters subpages for the Info page. | |
| 58 | + * | |
| 59 | + * @since Unknown | |
| 60 | + */ | |
| 61 | + $sub_pages = apply_filters_deprecated( 'mainwp-getsubpages-server', array( array() ), '4.0.7.2', 'mainwp_getsubpages_server' ); // NOSONAR - not IP. | |
| 62 | + static::$subPages = apply_filters( 'mainwp_getsubpages_server', $sub_pages ); | |
| 48 | 63 | |
| 49 | - add_submenu_page( | |
| 50 | - 'mainwp_tab', | |
| 51 | - __( 'Info', 'mainwp' ), | |
| 52 | - ' <span id="mainwp-ServerInformation">' . esc_html__( 'Info', 'mainwp' ) . '</span>', | |
| 53 | - 'read', | |
| 54 | - 'ServerInformation', | |
| 64 | + return is_array( static::$subPages ) ? static::$subPages : array(); | |
| 65 | + } | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * Get the built-in Info pages used across menu registration and navigation rendering. | |
| 69 | + * | |
| 70 | + * @return array<int, array<string, mixed>> Info page definitions. | |
| 71 | + */ | |
| 72 | + private static function get_core_pages() { | |
| 73 | + $pages = array( | |
| 55 | 74 | array( |
| 56 | - static::get_class_name(), | |
| 57 | - 'render', | |
| 58 | - ) | |
| 75 | + 'slug' => 'ServerInformation', | |
| 76 | + 'page_title' => __( 'Info', 'mainwp' ), | |
| 77 | + 'menu_title' => ' <span id="mainwp-ServerInformation">' . esc_html__( 'Info', 'mainwp' ) . '</span>', | |
| 78 | + 'nav_title' => esc_html__( 'Server', 'mainwp' ), | |
| 79 | + 'callback' => array( static::get_class_name(), 'render' ), | |
| 80 | + 'active_keys' => array( '', 'ServerInformation' ), | |
| 81 | + 'show_in_header_nav' => true, | |
| 82 | + 'show_in_subpages_menu' => true, | |
| 83 | + 'show_in_left_menu' => true, | |
| 84 | + 'show_in_palette' => true, | |
| 85 | + 'left_menu_parent' => 'ServerInformation', | |
| 86 | + 'palette_titles' => array( esc_html__( 'System Info', 'mainwp' ) ), | |
| 87 | + ), | |
| 88 | + array( | |
| 89 | + 'slug' => 'ServerInformationCron', | |
| 90 | + 'page_title' => __( 'Cron Schedules', 'mainwp' ), | |
| 91 | + 'menu_title' => '<div class="mainwp-hidden">' . esc_html__( 'Cron Schedules', 'mainwp' ) . '</div>', | |
| 92 | + 'nav_title' => esc_html__( 'Cron Schedules', 'mainwp' ), | |
| 93 | + 'callback' => array( static::get_class_name(), 'render_cron' ), | |
| 94 | + 'active_keys' => array( 'ServerInformationCron' ), | |
| 95 | + 'show_in_header_nav' => true, | |
| 96 | + 'show_in_subpages_menu' => true, | |
| 97 | + 'show_in_left_menu' => true, | |
| 98 | + 'show_in_palette' => true, | |
| 99 | + 'left_menu_parent' => 'ServerInformation', | |
| 100 | + 'palette_titles' => array( esc_html__( 'System Info', 'mainwp' ), esc_html__( 'Cron Schedules', 'mainwp' ) ), | |
| 101 | + ), | |
| 102 | + array( | |
| 103 | + 'slug' => 'ErrorLog', | |
| 104 | + 'page_title' => __( 'Error Log', 'mainwp' ), | |
| 105 | + 'menu_title' => '<div class="mainwp-hidden">' . esc_html__( 'Error Log', 'mainwp' ) . '</div>', | |
| 106 | + 'nav_title' => esc_html__( 'Error Log', 'mainwp' ), | |
| 107 | + 'callback' => array( static::get_class_name(), 'render_error_log_page' ), | |
| 108 | + 'active_keys' => array( 'ErrorLog' ), | |
| 109 | + 'show_in_header_nav' => true, | |
| 110 | + 'show_in_subpages_menu' => true, | |
| 111 | + 'show_in_left_menu' => true, | |
| 112 | + 'show_in_palette' => true, | |
| 113 | + 'left_menu_parent' => 'ServerInformation', | |
| 114 | + 'palette_titles' => array( esc_html__( 'System Info', 'mainwp' ), esc_html__( 'Error Log', 'mainwp' ) ), | |
| 115 | + ), | |
| 116 | + array( | |
| 117 | + 'slug' => 'WPConfig', | |
| 118 | + 'page_title' => __( 'WP-Config File', 'mainwp' ), | |
| 119 | + 'menu_title' => '<div class="mainwp-hidden">' . esc_html__( 'WP-Config File', 'mainwp' ) . '</div>', | |
| 120 | + 'nav_title' => esc_html__( 'WP-Config File', 'mainwp' ), | |
| 121 | + 'callback' => array( static::get_class_name(), 'render_wp_config' ), | |
| 122 | + 'active_keys' => array( 'WPConfig' ), | |
| 123 | + 'show_in_header_nav' => false, | |
| 124 | + 'show_in_subpages_menu' => true, | |
| 125 | + 'show_in_left_menu' => false, | |
| 126 | + 'show_in_palette' => true, | |
| 127 | + 'left_menu_parent' => 'ServerInformation', | |
| 128 | + 'palette_titles' => array( esc_html__( 'System Info', 'mainwp' ), esc_html__( 'WP-Config File', 'mainwp' ) ), | |
| 129 | + ), | |
| 130 | + array( | |
| 131 | + 'slug' => '.htaccess', | |
| 132 | + 'page_title' => __( '.htaccess File', 'mainwp' ), | |
| 133 | + 'menu_title' => '<div class="mainwp-hidden">' . esc_html__( '.htaccess File', 'mainwp' ) . '</div>', | |
| 134 | + 'nav_title' => esc_html__( '.htaccess File', 'mainwp' ), | |
| 135 | + 'callback' => array( static::get_class_name(), 'render_htaccess' ), | |
| 136 | + 'active_keys' => array( '.htaccess' ), | |
| 137 | + 'show_in_header_nav' => false, | |
| 138 | + 'show_in_subpages_menu' => true, | |
| 139 | + 'show_in_left_menu' => false, | |
| 140 | + 'show_in_palette' => true, | |
| 141 | + 'left_menu_parent' => 'ServerInformation', | |
| 142 | + 'palette_titles' => array( esc_html__( 'System Info', 'mainwp' ), esc_html__( '.htaccess File', 'mainwp' ) ), | |
| 143 | + 'condition' => static function() { | |
| 144 | + return MainWP_Server_Information_Handler::is_apache_server_software(); | |
| 145 | + }, | |
| 146 | + ), | |
| 147 | + array( | |
| 148 | + 'slug' => 'ActionLogs', | |
| 149 | + 'page_title' => __( 'Custom Event Monitor', 'mainwp' ), | |
| 150 | + 'menu_title' => '<div class="mainwp-hidden">' . esc_html__( 'Custom Event Monitor', 'mainwp' ) . '</div>', | |
| 151 | + 'nav_title' => esc_html__( 'Custom Event Monitor', 'mainwp' ), | |
| 152 | + 'callback' => array( static::get_class_name(), 'render_action_logs' ), | |
| 153 | + 'active_keys' => array( 'ActionLogs' ), | |
| 154 | + 'show_in_header_nav' => true, | |
| 155 | + 'show_in_subpages_menu' => false, | |
| 156 | + 'show_in_left_menu' => true, | |
| 157 | + 'show_in_palette' => true, | |
| 158 | + 'left_menu_parent' => 'ServerInformation', | |
| 159 | + 'palette_titles' => array( esc_html__( 'System Info', 'mainwp' ), esc_html__( 'Custom Event Monitor', 'mainwp' ) ), | |
| 160 | + ), | |
| 161 | + array( | |
| 162 | + 'slug' => 'PluginPrivacy', | |
| 163 | + 'page_title' => __( 'Plugin Privacy', 'mainwp' ), | |
| 164 | + 'menu_title' => '<div class="mainwp-hidden">' . esc_html__( 'Plugin Privacy', 'mainwp' ) . '</div>', | |
| 165 | + 'nav_title' => esc_html__( 'Plugin Privacy', 'mainwp' ), | |
| 166 | + 'callback' => array( static::get_class_name(), 'render_plugin_privacy_page' ), | |
| 167 | + 'active_keys' => array( 'PluginPrivacy' ), | |
| 168 | + 'show_in_header_nav' => false, | |
| 169 | + 'show_in_subpages_menu' => false, | |
| 170 | + 'show_in_left_menu' => true, | |
| 171 | + 'show_in_palette' => true, | |
| 172 | + 'left_menu_parent' => 'mainwp_tab', | |
| 173 | + 'palette_titles' => array( esc_html__( 'Privacy Policy', 'mainwp' ) ), | |
| 174 | + ), | |
| 59 | 175 | ); |
| 60 | - if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ServerInformationCron' ) ) { | |
| 61 | - add_submenu_page( | |
| 62 | - 'mainwp_tab', | |
| 63 | - __( 'Cron Schedules', 'mainwp' ), | |
| 64 | - '<div class="mainwp-hidden">' . esc_html__( 'Cron Schedules', 'mainwp' ) . '</div>', | |
| 65 | - 'read', | |
| 66 | - 'ServerInformationCron', | |
| 67 | - array( | |
| 68 | - static::get_class_name(), | |
| 69 | - 'render_cron', | |
| 70 | - ) | |
| 176 | + | |
| 177 | + $visible_pages = array(); | |
| 178 | + | |
| 179 | + foreach ( $pages as $page ) { | |
| 180 | + if ( 'ServerInformation' !== $page['slug'] && MainWP_Menu::is_disable_menu_item( 3, $page['slug'] ) ) { | |
| 181 | + continue; | |
| 182 | + } | |
| 183 | + | |
| 184 | + if ( isset( $page['condition'] ) && is_callable( $page['condition'] ) && ! call_user_func( $page['condition'] ) ) { | |
| 185 | + continue; | |
| 186 | + } | |
| 187 | + | |
| 188 | + $visible_pages[] = $page; | |
| 189 | + } | |
| 190 | + | |
| 191 | + return $visible_pages; | |
| 192 | + } | |
| 193 | + | |
| 194 | + /** | |
| 195 | + * Convert a navigation href into a usable URL. | |
| 196 | + * | |
| 197 | + * @param string $href Navigation href. | |
| 198 | + * | |
| 199 | + * @return string Navigation URL. | |
| 200 | + */ | |
| 201 | + private static function get_navigation_item_url( $href ) { | |
| 202 | + $href = trim( wp_specialchars_decode( (string) $href, ENT_QUOTES ) ); | |
| 203 | + | |
| 204 | + if ( empty( $href ) ) { | |
| 205 | + return ''; | |
| 206 | + } | |
| 207 | + | |
| 208 | + if ( preg_match( '/^https?:\/\//i', $href ) ) { | |
| 209 | + return $href; | |
| 210 | + } | |
| 211 | + | |
| 212 | + return admin_url( ltrim( $href, '/' ) ); | |
| 213 | + } | |
| 214 | + | |
| 215 | + /** | |
| 216 | + * Get dynamic Info subpage items using the legacy left-menu normalization path. | |
| 217 | + * | |
| 218 | + * @return array<int, array<string, mixed>> Info navigation items. | |
| 219 | + */ | |
| 220 | + private static function get_filtered_subpage_navigation_items() { | |
| 221 | + $menu_items = array(); | |
| 222 | + $core_slugs = array(); | |
| 223 | + | |
| 224 | + foreach ( static::get_navigation_items( 'left_menu_core' ) as $item ) { | |
| 225 | + if ( empty( $item['show_in_left_menu'] ) ) { | |
| 226 | + continue; | |
| 227 | + } | |
| 228 | + | |
| 229 | + $core_slugs[ $item['slug'] ] = true; | |
| 230 | + $menu_items[] = array( | |
| 231 | + 'title' => $item['title'], | |
| 232 | + 'parent_key' => $item['left_menu_parent'], | |
| 233 | + 'href' => $item['href'], | |
| 234 | + 'slug' => $item['slug'], | |
| 235 | + 'right' => '', | |
| 71 | 236 | ); |
| 72 | 237 | } |
| 73 | 238 | |
| 74 | - if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ErrorLog' ) ) { | |
| 75 | - add_submenu_page( | |
| 76 | - 'mainwp_tab', | |
| 77 | - __( 'Error Log', 'mainwp' ), | |
| 78 | - '<div class="mainwp-hidden">' . esc_html__( 'Error Log', 'mainwp' ) . '</div>', | |
| 79 | - 'read', | |
| 80 | - 'ErrorLog', | |
| 81 | - array( | |
| 82 | - static::get_class_name(), | |
| 83 | - 'render_error_log_page', | |
| 84 | - ) | |
| 239 | + MainWP_Menu::init_subpages_left_menu( static::get_subpages(), $menu_items, 'ServerInformation', 'Server' ); | |
| 240 | + | |
| 241 | + $items = array(); | |
| 242 | + | |
| 243 | + foreach ( $menu_items as $menu_item ) { | |
| 244 | + if ( empty( $menu_item['slug'] ) || empty( $menu_item['title'] ) || empty( $menu_item['href'] ) ) { | |
| 245 | + continue; | |
| 246 | + } | |
| 247 | + | |
| 248 | + if ( isset( $core_slugs[ $menu_item['slug'] ] ) ) { | |
| 249 | + continue; | |
| 250 | + } | |
| 251 | + | |
| 252 | + if ( isset( $menu_item['item_slug'] ) ) { | |
| 253 | + if ( MainWP_Menu::is_disable_menu_item( 3, $menu_item['item_slug'] ) ) { | |
| 254 | + continue; | |
| 255 | + } | |
| 256 | + } elseif ( MainWP_Menu::is_disable_menu_item( 3, $menu_item['slug'] ) ) { | |
| 257 | + continue; | |
| 258 | + } | |
| 259 | + | |
| 260 | + $active_slug = 0 === strpos( $menu_item['slug'], 'Server' ) ? substr( $menu_item['slug'], strlen( 'Server' ) ) : $menu_item['slug']; | |
| 261 | + | |
| 262 | + $item = array( | |
| 263 | + 'slug' => $menu_item['slug'], | |
| 264 | + 'title' => $menu_item['title'], | |
| 265 | + 'href' => $menu_item['href'], | |
| 266 | + 'active_keys' => array( $active_slug, $menu_item['slug'] ), | |
| 267 | + 'show_in_header_nav' => false, | |
| 268 | + 'show_in_subpages_menu' => true, | |
| 269 | + 'show_in_left_menu' => true, | |
| 270 | + 'show_in_palette' => true, | |
| 271 | + 'left_menu_parent' => isset( $menu_item['parent_key'] ) ? $menu_item['parent_key'] : 'ServerInformation', | |
| 272 | + 'palette_titles' => array( esc_html__( 'System Info', 'mainwp' ), $menu_item['title'] ), | |
| 273 | + 'menu_hidden' => false, | |
| 85 | 274 | ); |
| 275 | + | |
| 276 | + if ( isset( $menu_item['item_slug'] ) ) { | |
| 277 | + $item['item_slug'] = $menu_item['item_slug']; | |
| 278 | + } | |
| 279 | + | |
| 280 | + if ( ! empty( $menu_item['before_title'] ) ) { | |
| 281 | + $item['before_title'] = $menu_item['before_title']; | |
| 282 | + $item['palette_titles'][1] = trim( wp_strip_all_tags( $menu_item['before_title'] ) . ' ' . $menu_item['title'] ); | |
| 283 | + } | |
| 284 | + | |
| 285 | + $items[] = $item; | |
| 86 | 286 | } |
| 87 | - if ( ! MainWP_Menu::is_disable_menu_item( 3, 'WPConfig' ) ) { | |
| 88 | - add_submenu_page( | |
| 89 | - 'mainwp_tab', | |
| 90 | - __( 'WP-Config File', 'mainwp' ), | |
| 91 | - '<div class="mainwp-hidden">' . esc_html__( 'WP-Config File', 'mainwp' ) . '</div>', | |
| 92 | - 'read', | |
| 93 | - 'WPConfig', | |
| 94 | - array( | |
| 95 | - static::get_class_name(), | |
| 96 | - 'render_wp_config', | |
| 97 | - ) | |
| 287 | + | |
| 288 | + return $items; | |
| 289 | + } | |
| 290 | + | |
| 291 | + /** | |
| 292 | + * Get the Info navigation items. | |
| 293 | + * | |
| 294 | + * @return array<int, array<string, mixed>> Info navigation items. | |
| 295 | + */ | |
| 296 | + public static function get_navigation_items( $context = 'default' ) { | |
| 297 | + $items = array(); | |
| 298 | + | |
| 299 | + foreach ( static::get_core_pages() as $page ) { | |
| 300 | + $items[] = array( | |
| 301 | + 'slug' => $page['slug'], | |
| 302 | + 'title' => $page['nav_title'], | |
| 303 | + 'href' => 'admin.php?page=' . $page['slug'], | |
| 304 | + 'active_keys' => $page['active_keys'], | |
| 305 | + 'show_in_header_nav' => $page['show_in_header_nav'], | |
| 306 | + 'show_in_subpages_menu' => $page['show_in_subpages_menu'], | |
| 307 | + 'show_in_left_menu' => $page['show_in_left_menu'], | |
| 308 | + 'show_in_palette' => $page['show_in_palette'], | |
| 309 | + 'left_menu_parent' => $page['left_menu_parent'], | |
| 310 | + 'palette_titles' => $page['palette_titles'], | |
| 311 | + 'menu_hidden' => false, | |
| 98 | 312 | ); |
| 99 | 313 | } |
| 100 | - if ( ! MainWP_Menu::is_disable_menu_item( 3, '.htaccess' ) && MainWP_Server_Information_Handler::is_apache_server_software() ) { | |
| 101 | - add_submenu_page( | |
| 102 | - 'mainwp_tab', | |
| 103 | - __( '.htaccess File', 'mainwp' ), | |
| 104 | - '<div class="mainwp-hidden">' . esc_html__( '.htaccess File', 'mainwp' ) . '</div>', | |
| 105 | - 'read', | |
| 106 | - '.htaccess', | |
| 107 | - array( | |
| 108 | - static::get_class_name(), | |
| 109 | - 'render_htaccess', | |
| 110 | - ) | |
| 314 | + | |
| 315 | + if ( 'left_menu_core' === $context ) { | |
| 316 | + return $items; | |
| 317 | + } | |
| 318 | + | |
| 319 | + if ( 'command_palette' === $context ) { | |
| 320 | + return array_merge( $items, static::get_filtered_subpage_navigation_items() ); | |
| 321 | + } | |
| 322 | + | |
| 323 | + foreach ( static::get_subpages() as $subPage ) { | |
| 324 | + if ( empty( $subPage['slug'] ) || MainWP_Menu::is_disable_menu_item( 3, 'Server' . $subPage['slug'] ) ) { | |
| 325 | + continue; | |
| 326 | + } | |
| 327 | + | |
| 328 | + $item = array( | |
| 329 | + 'slug' => 'Server' . $subPage['slug'], | |
| 330 | + 'title' => $subPage['title'], | |
| 331 | + 'href' => ! empty( $subPage['href'] ) ? $subPage['href'] : 'admin.php?page=Server' . $subPage['slug'], | |
| 332 | + 'active_keys' => array( $subPage['slug'], 'Server' . $subPage['slug'] ), | |
| 333 | + 'show_in_header_nav' => false, | |
| 334 | + 'show_in_subpages_menu' => empty( $subPage['menu_hidden'] ), | |
| 335 | + 'show_in_left_menu' => empty( $subPage['menu_hidden'] ), | |
| 336 | + 'show_in_palette' => empty( $subPage['menu_hidden'] ), | |
| 337 | + 'left_menu_parent' => 'ServerInformation', | |
| 338 | + 'palette_titles' => array( esc_html__( 'System Info', 'mainwp' ), $subPage['title'] ), | |
| 339 | + 'menu_hidden' => ! empty( $subPage['menu_hidden'] ), | |
| 111 | 340 | ); |
| 341 | + | |
| 342 | + if ( isset( $subPage['item_slug'] ) ) { | |
| 343 | + $item['item_slug'] = $subPage['item_slug']; | |
| 344 | + } | |
| 345 | + | |
| 346 | + $items[] = $item; | |
| 112 | 347 | } |
| 113 | - if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ActionLogs' ) ) { | |
| 114 | - add_submenu_page( | |
| 115 | - 'mainwp_tab', | |
| 116 | - __( 'Custom Event Monitor', 'mainwp' ), | |
| 117 | - '<div class="mainwp-hidden">' . esc_html__( 'Custom Event Monitor', 'mainwp' ) . '</div>', | |
| 118 | - 'read', | |
| 119 | - 'ActionLogs', | |
| 120 | - array( | |
| 121 | - static::get_class_name(), | |
| 122 | - 'render_action_logs', | |
| 123 | - ) | |
| 348 | + | |
| 349 | + return $items; | |
| 350 | + } | |
| 351 | + | |
| 352 | + /** | |
| 353 | + * Get the Info command palette items. | |
| 354 | + * | |
| 355 | + * @return array<int, array<string, mixed>> Command palette item definitions. | |
| 356 | + */ | |
| 357 | + public static function get_command_palette_items() { | |
| 358 | + $items = array(); | |
| 359 | + | |
| 360 | + foreach ( static::get_navigation_items( 'command_palette' ) as $item ) { | |
| 361 | + if ( empty( $item['show_in_palette'] ) ) { | |
| 362 | + continue; | |
| 363 | + } | |
| 364 | + | |
| 365 | + $items[] = array( | |
| 366 | + 'slug' => $item['slug'], | |
| 367 | + 'href' => $item['href'], | |
| 368 | + 'path_titles' => $item['palette_titles'], | |
| 124 | 369 | ); |
| 125 | 370 | } |
| 126 | 371 | |
| 127 | - if ( ! MainWP_Menu::is_disable_menu_item( 3, 'PluginPrivacy' ) ) { | |
| 372 | + return $items; | |
| 373 | + } | |
| 374 | + | |
| 375 | + /** | |
| 376 | + * Method init_menu() | |
| 377 | + * | |
| 378 | + * Initiate Info subPage menu. | |
| 379 | + * | |
| 380 | + * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item() | |
| 381 | + * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_apache_server_software() | |
| 382 | + */ | |
| 383 | + public static function init_menu() { // phpcs:ignore -- NOSONAR - complex. | |
| 384 | + | |
| 385 | + add_action( 'mainwp_pageheader_infor', array( static::get_class_name(), 'render_header' ) ); | |
| 386 | + add_action( 'mainwp_pagefooter_infor', array( static::get_class_name(), 'render_footer' ) ); | |
| 387 | + | |
| 388 | + foreach ( static::get_core_pages() as $page ) { | |
| 128 | 389 | add_submenu_page( |
| 129 | 390 | 'mainwp_tab', |
| 130 | - __( 'Plugin Privacy', 'mainwp' ), | |
| 131 | - '<div class="mainwp-hidden">' . esc_html__( 'Plugin Privacy', 'mainwp' ) . '</div>', | |
| 391 | + $page['page_title'], | |
| 392 | + $page['menu_title'], | |
| 132 | 393 | 'read', |
| 133 | - 'PluginPrivacy', | |
| 134 | - array( | |
| 135 | - static::get_class_name(), | |
| 136 | - 'render_plugin_privacy_page', | |
| 137 | - ) | |
| 394 | + $page['slug'], | |
| 395 | + $page['callback'] | |
| 138 | 396 | ); |
| 139 | 397 | } |
| 140 | 398 | |
| 141 | - /** | |
| 142 | - * Filter mainwp_getsubpages_server | |
| 143 | - * | |
| 144 | - * Filters subpages for the Info page. | |
| 145 | - * | |
| 146 | - * @since Unknown | |
| 147 | - */ | |
| 148 | - $sub_pages = apply_filters_deprecated( 'mainwp-getsubpages-server', array( array() ), '4.0.7.2', 'mainwp_getsubpages_server' ); // NOSONAR - not IP. | |
| 149 | - static::$subPages = apply_filters( 'mainwp_getsubpages_server', $sub_pages ); | |
| 399 | + foreach ( static::get_subpages() as $subPage ) { | |
| 400 | + if ( empty( $subPage['slug'] ) || MainWP_Menu::is_disable_menu_item( 3, 'Server' . $subPage['slug'] ) ) { | |
| 401 | + continue; | |
| 402 | + } | |
| 150 | 403 | |
| 151 | - if ( isset( static::$subPages ) && is_array( static::$subPages ) ) { | |
| 152 | - foreach ( static::$subPages as $subPage ) { | |
| 153 | - if ( ! isset( $subPage['slug'] ) ) { | |
| 154 | - continue; | |
| 155 | - } | |
| 156 | - if ( MainWP_Menu::is_disable_menu_item( 3, 'Server' . $subPage['slug'] ) ) { | |
| 157 | - continue; | |
| 158 | - } | |
| 159 | - add_submenu_page( 'mainwp_tab', $subPage['title'], '<div class="mainwp-hidden">' . $subPage['title'] . '</div>', 'read', 'Server' . $subPage['slug'], $subPage['callback'] ); | |
| 160 | - } | |
| 404 | + add_submenu_page( 'mainwp_tab', $subPage['title'], '<div class="mainwp-hidden">' . $subPage['title'] . '</div>', 'read', 'Server' . $subPage['slug'], $subPage['callback'] ); | |
| 161 | 405 | } |
| 162 | 406 | } |
| 163 | 407 | |
| 164 | 408 | /** |
| @@ -172,39 +416,12 @@ | ||
| 172 | 416 | <div id="menu-mainwp-ServerInformation" class="mainwp-submenu-wrapper"> |
| 173 | 417 | <div class="wp-submenu sub-open"> |
| 174 | 418 | <div class="mainwp_boxout"> |
| 175 | 419 | <div class="mainwp_boxoutin"></div> |
| 176 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=ServerInformation' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Server', 'mainwp' ); ?></a> | |
| 177 | - <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ServerInformationCron' ) ) { ?> | |
| 178 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=ServerInformationCron' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Cron Schedules', 'mainwp' ); ?></a> | |
| 420 | + <?php foreach ( static::get_navigation_items() as $item ) { ?> | |
| 421 | + <?php if ( empty( $item['show_in_subpages_menu'] ) ) { continue; } ?> | |
| 422 | + <a href="<?php echo esc_url( static::get_navigation_item_url( $item['href'] ) ); ?>" class="mainwp-submenu"><?php echo esc_html( $item['title'] ); ?></a> | |
| 179 | 423 | <?php } ?> |
| 180 | - <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ErrorLog' ) ) { ?> | |
| 181 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=ErrorLog' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Error Log', 'mainwp' ); ?></a> | |
| 182 | - <?php } ?> | |
| 183 | - <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'WPConfig' ) ) { ?> | |
| 184 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=WPConfig' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'WP-Config File', 'mainwp' ); ?></a> | |
| 185 | - <?php } ?> | |
| 186 | - <?php | |
| 187 | - if ( ! MainWP_Menu::is_disable_menu_item( 3, '.htaccess' ) && MainWP_Server_Information_Handler::is_apache_server_software() ) { | |
| 188 | - ?> | |
| 189 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=.htaccess' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( '.htaccess File', 'mainwp' ); ?></a> | |
| 190 | - <?php | |
| 191 | - } | |
| 192 | - ?> | |
| 193 | - <?php | |
| 194 | - if ( isset( static::$subPages ) && is_array( static::$subPages ) ) { | |
| 195 | - foreach ( static::$subPages as $subPage ) { | |
| 196 | - if ( ! isset( $subPage['menu_hidden'] ) || ( isset( $subPage['menu_hidden'] ) && true !== $subPage['menu_hidden'] ) ) { | |
| 197 | - if ( MainWP_Menu::is_disable_menu_item( 3, 'Server' . $subPage['slug'] ) ) { | |
| 198 | - continue; | |
| 199 | - } | |
| 200 | - ?> | |
| 201 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=Server' . $subPage['slug'] ) ); ?>" class="mainwp-submenu"><?php echo esc_html( $subPage['title'] ); ?></a> | |
| 202 | - <?php | |
| 203 | - } | |
| 204 | - } | |
| 205 | - } | |
| 206 | - ?> | |
| 207 | 424 | </div> |
| 208 | 425 | </div> |
| 209 | 426 | </div> |
| 210 | 427 | <?php |
| @@ -231,60 +448,39 @@ | ||
| 231 | 448 | ), |
| 232 | 449 | 0 |
| 233 | 450 | ); |
| 234 | 451 | |
| 235 | - /** | |
| 236 | - * MainWP active menu slugs array. | |
| 237 | - * | |
| 238 | - * @global object | |
| 239 | - */ | |
| 240 | - global $_mainwp_menu_active_slugs; | |
| 452 | + $init_sub_subleftmenu = array(); | |
| 241 | 453 | |
| 242 | - $_mainwp_menu_active_slugs['ActionLogs'] = 'ServerInformation'; | |
| 454 | + foreach ( static::get_navigation_items( 'left_menu_core' ) as $item ) { | |
| 455 | + if ( empty( $item['show_in_left_menu'] ) ) { | |
| 456 | + continue; | |
| 457 | + } | |
| 243 | 458 | |
| 244 | - $init_sub_subleftmenu = array( | |
| 245 | - array( | |
| 246 | - 'title' => esc_html__( 'Server', 'mainwp' ), | |
| 247 | - 'parent_key' => 'ServerInformation', | |
| 248 | - 'href' => 'admin.php?page=ServerInformation', | |
| 249 | - 'slug' => 'ServerInformation', | |
| 459 | + $init_sub_subleftmenu[] = array( | |
| 460 | + 'title' => $item['title'], | |
| 461 | + 'parent_key' => $item['left_menu_parent'], | |
| 462 | + 'href' => $item['href'], | |
| 463 | + 'slug' => $item['slug'], | |
| 250 | 464 | 'right' => '', |
| 251 | - ), | |
| 252 | - array( | |
| 253 | - 'title' => esc_html__( 'Cron Schedules', 'mainwp' ), | |
| 254 | - 'parent_key' => 'ServerInformation', | |
| 255 | - 'href' => 'admin.php?page=ServerInformationCron', | |
| 256 | - 'slug' => 'ServerInformationCron', | |
| 257 | - 'right' => '', | |
| 258 | - ), | |
| 259 | - array( | |
| 260 | - 'title' => esc_html__( 'Error Log', 'mainwp' ), | |
| 261 | - 'parent_key' => 'ServerInformation', | |
| 262 | - 'href' => 'admin.php?page=ErrorLog', | |
| 263 | - 'slug' => 'ErrorLog', | |
| 264 | - 'right' => '', | |
| 265 | - ), | |
| 266 | - array( | |
| 267 | - 'title' => esc_html__( 'Custom Event Monitor', 'mainwp' ), | |
| 268 | - 'parent_key' => 'ServerInformation', | |
| 269 | - 'href' => 'admin.php?page=ActionLogs', | |
| 270 | - 'slug' => 'ActionLogs', | |
| 271 | - 'right' => '', | |
| 272 | - ), | |
| 273 | - array( | |
| 274 | - 'title' => esc_html__( 'Plugin Privacy', 'mainwp' ), | |
| 275 | - 'parent_key' => 'ServerInformation', | |
| 276 | - 'href' => 'admin.php?page=PluginPrivacy', | |
| 277 | - 'slug' => 'PluginPrivacy', | |
| 278 | - 'right' => '', | |
| 279 | - ), | |
| 280 | - ); | |
| 465 | + ); | |
| 466 | + } | |
| 281 | 467 | |
| 468 | + if ( empty( $subPages ) ) { | |
| 469 | + $subPages = static::get_subpages(); | |
| 470 | + } | |
| 471 | + | |
| 282 | 472 | MainWP_Menu::init_subpages_left_menu( $subPages, $init_sub_subleftmenu, 'ServerInformation', 'Server' ); |
| 473 | + | |
| 283 | 474 | foreach ( $init_sub_subleftmenu as $item ) { |
| 284 | - if ( MainWP_Menu::is_disable_menu_item( 3, $item['slug'] ) ) { | |
| 475 | + if ( isset( $item['item_slug'] ) ) { | |
| 476 | + if ( MainWP_Menu::is_disable_menu_item( 3, $item['item_slug'] ) ) { | |
| 477 | + continue; | |
| 478 | + } | |
| 479 | + } elseif ( MainWP_Menu::is_disable_menu_item( 3, $item['slug'] ) ) { | |
| 285 | 480 | continue; |
| 286 | 481 | } |
| 482 | + | |
| 287 | 483 | MainWP_Menu::add_left_menu( $item, 2 ); |
| 288 | 484 | } |
| 289 | 485 | } |
| 290 | 486 | |
| @@ -306,48 +502,24 @@ | ||
| 306 | 502 | MainWP_UI::render_top_header( $params ); |
| 307 | 503 | |
| 308 | 504 | $renderItems = array(); |
| 309 | 505 | |
| 310 | - $renderItems[] = array( | |
| 311 | - 'title' => esc_html__( 'Server', 'mainwp' ), | |
| 312 | - 'href' => 'admin.php?page=ServerInformation', | |
| 313 | - 'active' => ( '' === $shownPage ) ? true : false, | |
| 314 | - ); | |
| 506 | + foreach ( static::get_navigation_items() as $item ) { | |
| 507 | + if ( empty( $item['show_in_header_nav'] ) ) { | |
| 508 | + continue; | |
| 509 | + } | |
| 315 | 510 | |
| 316 | - if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ServerInformationCron' ) ) { | |
| 317 | 511 | $renderItems[] = array( |
| 318 | - 'title' => esc_html__( 'Cron Schedules', 'mainwp' ), | |
| 319 | - 'href' => 'admin.php?page=ServerInformationCron', | |
| 320 | - 'active' => ( 'ServerInformationCron' === $shownPage ) ? true : false, | |
| 512 | + 'title' => $item['title'], | |
| 513 | + 'href' => $item['href'], | |
| 514 | + 'active' => in_array( $shownPage, $item['active_keys'], true ), | |
| 321 | 515 | ); |
| 322 | 516 | } |
| 323 | 517 | |
| 324 | - if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ErrorLog' ) ) { | |
| 325 | - $renderItems[] = array( | |
| 326 | - 'title' => esc_html__( 'Error Log', 'mainwp' ), | |
| 327 | - 'href' => 'admin.php?page=ErrorLog', | |
| 328 | - 'active' => ( 'ErrorLog' === $shownPage ) ? true : false, | |
| 329 | - ); | |
| 518 | + if ( isset( $_GET['page'] ) && 'PluginPrivacy' !== $_GET['page'] ) { //phpcs:ignore -- monce safe. | |
| 519 | + MainWP_UI::render_page_navigation( $renderItems ); | |
| 330 | 520 | } |
| 331 | 521 | |
| 332 | - if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ActionLogs' ) ) { | |
| 333 | - $renderItems[] = array( | |
| 334 | - 'title' => esc_html__( 'Custom Event Monitor', 'mainwp' ), | |
| 335 | - 'href' => 'admin.php?page=ActionLogs', | |
| 336 | - 'active' => ( 'ActionLogs' === $shownPage ) ? true : false, | |
| 337 | - ); | |
| 338 | - } | |
| 339 | - | |
| 340 | - if ( ! MainWP_Menu::is_disable_menu_item( 3, 'PluginPrivacy' ) ) { | |
| 341 | - $renderItems[] = array( | |
| 342 | - 'title' => esc_html__( 'Plugin Privacy', 'mainwp' ), | |
| 343 | - 'href' => 'admin.php?page=PluginPrivacy', | |
| 344 | - 'active' => ( 'PluginPrivacy' === $shownPage ) ? true : false, | |
| 345 | - ); | |
| 346 | - } | |
| 347 | - | |
| 348 | - MainWP_UI::render_page_navigation( $renderItems ); | |
| 349 | - | |
| 350 | 522 | static::render_actions_bar(); |
| 351 | 523 | |
| 352 | 524 | echo '<div>'; |
| 353 | 525 | } |
| @@ -365,13 +537,18 @@ | ||
| 365 | 537 | public static function render_actions_bar() { |
| 366 | 538 | if ( isset( $_GET['page'] ) && 'ServerInformation' === $_GET['page'] ) : // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 367 | 539 | ?> |
| 368 | 540 | <div class="mainwp-actions-bar"> |
| 369 | - <div class="ui two column grid"> | |
| 370 | - <div class="column"></div> | |
| 541 | + <div class="ui stackable middle aligned two column grid"> | |
| 542 | + <div class="column"> | |
| 543 | + <a href="#" class="ui mini green button" id="mainwp-download-system-report"><?php esc_html_e( 'Download Full System Report', 'mainwp' ); ?></a> | |
| 544 | + <a href="#" style="margin-left:5px" class="ui mini basic green button" id="mainwp-download-community-system-report"><?php esc_html_e( 'Download Community System Report', 'mainwp' ); ?></a> | |
| 545 | + </div> | |
| 371 | 546 | <div class="right aligned column"> |
| 372 | - <a href="#" style="margin-left:5px" class="ui mini basic green button" id="mainwp-copy-meta-system-report" data-inverted="" data-position="left center" data-tooltip="<?php esc_attr_e( 'Copy the system report to paste it to the MainWP Community.', 'mainwp' ); ?>"><?php esc_html_e( 'Copy System Report for the MainWP Community', 'mainwp' ); ?></a> | |
| 373 | - <a href="#" class="ui mini green button" id="mainwp-download-system-report"><?php esc_html_e( 'Download System Report', 'mainwp' ); ?></a> | |
| 547 | + <div class="ui icon input"> | |
| 548 | + <input type="search" id="mainwp-system-report-global-search" placeholder="<?php esc_attr_e( 'Search system report', 'mainwp' ); ?>" aria-label="<?php esc_attr_e( 'Search system report', 'mainwp' ); ?>"> | |
| 549 | + <i class="search icon"></i> | |
| 550 | + </div> | |
| 374 | 551 | </div> |
| 375 | 552 | </div> |
| 376 | 553 | </div> |
| 377 | 554 | <?php |
| @@ -418,10 +595,10 @@ | ||
| 418 | 595 | * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_remote_host() |
| 419 | 596 | * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_remote_port() |
| 420 | 597 | */ |
| 421 | 598 | public static function render() { |
| 422 | - if ( ! mainwp_current_user_have_right( 'dashboard', 'see_server_information' ) ) { | |
| 423 | - mainwp_do_not_have_permissions( 'server information', 'mainwp' ); | |
| 599 | + if ( ! \mainwp_current_user_can( 'dashboard', 'see_server_information' ) ) { | |
| 600 | + \mainwp_do_not_have_permissions( 'server information', 'mainwp' ); | |
| 424 | 601 | return; |
| 425 | 602 | } |
| 426 | 603 | static::render_header( '' ); |
| 427 | 604 | |
| @@ -433,41 +610,70 @@ | ||
| 433 | 610 | * @since 4.0 |
| 434 | 611 | */ |
| 435 | 612 | do_action( 'mainwp_before_server_info_table' ); |
| 436 | 613 | ?> |
| 437 | - <div class="ui segment"> | |
| 438 | - <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-server-info-info-message' ) ) : ?> | |
| 439 | - <div class="ui info message"> | |
| 440 | - <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-server-info-info-message"></i> | |
| 441 | - <?php printf( esc_html__( 'Check your system configuration and make sure your MainWP Dashboard passes all system requirements. If you need help with resolving specific errors, please review this %1$shelp document%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/resolving-system-requirement-issues/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?> | |
| 442 | - </div> | |
| 443 | - <?php endif; ?> | |
| 614 | + <div id="mainwp-system-report-page" class="ui padded segment"> | |
| 444 | 615 | <?php |
| 445 | 616 | if ( function_exists( 'curl_version' ) && ! MainWP_Server_Information_Handler::curlssl_compare( 'OpenSSL/1.1.0', '>=' ) ) { |
| 617 | + /* translators: 1: line break tag, 2: opening anchor tag, 3: closing anchor tag */ | |
| 446 | 618 | echo "<div class='ui yellow message'>" . sprintf( esc_html__( 'Your host needs to update OpenSSL to at least version 1.1.0 which is already over 4 years old and contains patches for over 60 vulnerabilities.%1$sThese range from Denial of Service to Remote Code Execution. %2$sClick here for more information.%3$s', 'mainwp' ), '<br/>', '<a href="https://community.letsencrypt.org/t/openssl-client-compatibility-changes-for-let-s-encrypt-certificates/143816" target="_blank">', '</a>' ) . '</div>'; |
| 447 | 619 | } |
| 620 | + | |
| 621 | + // Detect issues before rendering. | |
| 622 | + $datatable_rows = MainWP_Server_Information_Handler::get_database_report_rows(); | |
| 623 | + | |
| 624 | + static::render_detected_issues_summary(); | |
| 448 | 625 | ?> |
| 626 | + <style type="text/css"> | |
| 627 | + #mainwp-system-report-page { | |
| 628 | + padding-top: 1rem !important; | |
| 629 | + } | |
| 630 | + | |
| 631 | + #mainwp-system-report-page .mainwp-system-report-table { | |
| 632 | + table-layout: fixed; | |
| 633 | + width: 100%; | |
| 634 | + } | |
| 635 | + | |
| 636 | + #mainwp-system-report-page .mainwp-system-report-issues-message { | |
| 637 | + margin: 0 0 1rem 0; | |
| 638 | + border-radius: var(--area-radius, 0.28571429rem) !important; | |
| 639 | + } | |
| 640 | + | |
| 641 | + #mainwp-system-report-page .mainwp-system-info-table { | |
| 642 | + margin: 0 0 1rem 0 !important; | |
| 643 | + } | |
| 644 | + | |
| 645 | + #mainwp-system-report-page .dt-container, | |
| 646 | + #mainwp-system-report-page .dataTables_wrapper { | |
| 647 | + margin: 0 0 1rem 0; | |
| 648 | + } | |
| 649 | + | |
| 650 | + #mainwp-system-report-page .dt-container .mainwp-system-info-table, | |
| 651 | + #mainwp-system-report-page .dataTables_wrapper .mainwp-system-info-table { | |
| 652 | + margin-bottom: 0 !important; | |
| 653 | + } | |
| 654 | + </style> | |
| 449 | 655 | <table id="mainwp-system-report-wordpress-table" class="ui unstackable table single line mainwp-system-report-table mainwp-system-info-table"> |
| 450 | 656 | <thead> |
| 451 | 657 | <tr> |
| 452 | - <th scope="col" ><?php esc_html_e( 'WordPress Check', 'mainwp' ); ?></th> | |
| 453 | - <th scope="col" ><?php esc_html_e( 'Required', 'mainwp' ); ?></th> | |
| 454 | - <th scope="col" ><?php esc_html_e( 'Detected', 'mainwp' ); ?></th> | |
| 455 | - <th scope="col" class="right aligned"><?php esc_html_e( 'Status', 'mainwp' ); ?></th> | |
| 658 | + <th scope="col" class="four wide"<?php echo self::get_export_text_attr( 'WordPress Check' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'WordPress Check', 'mainwp' ); ?></th> | |
| 659 | + <th scope="col" class="four wide"<?php echo self::get_export_text_attr( 'Required' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Required', 'mainwp' ); ?></th> | |
| 660 | + <th scope="col" class="four wide"<?php echo self::get_export_text_attr( 'Detected' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Detected', 'mainwp' ); ?></th> | |
| 661 | + <th scope="col" class="four wide right aligned"></th> | |
| 456 | 662 | </tr> |
| 457 | 663 | </thead> |
| 458 | 664 | <tbody> |
| 459 | - <?php static::render_wordpress_check_tbody(); ?> | |
| 460 | - </tbody> | |
| 665 | + <?php static::render_wordpress_check_tbody(); ?> | |
| 666 | + </tbody> | |
| 461 | 667 | </table> |
| 462 | 668 | |
| 463 | 669 | <table id="mainwp-system-report-php-table" class="ui unstackable table fixed mainwp-system-report-table mainwp-system-info-table"> |
| 464 | 670 | <thead> |
| 465 | 671 | <tr> |
| 466 | - <th scope="col" ><?php esc_html_e( 'PHP', 'mainwp' ); ?></th> | |
| 467 | - <th scope="col" ><?php esc_html_e( 'Required', 'mainwp' ); ?></th> | |
| 468 | - <th scope="col" ><?php esc_html_e( 'Detected', 'mainwp' ); ?></th> | |
| 469 | - <th scope="col" class="right aligned"><?php esc_html_e( 'Status', 'mainwp' ); ?></th> | |
| 672 | + <th scope="col" class="four wide"<?php echo self::get_export_text_attr( 'PHP' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'PHP', 'mainwp' ); ?></th> | |
| 673 | + <th scope="col" class="four wide"<?php echo self::get_export_text_attr( 'Required' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Required', 'mainwp' ); ?></th> | |
| 674 | + <th scope="col" class="four wide"<?php echo self::get_export_text_attr( 'Detected' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Detected', 'mainwp' ); ?></th> | |
| 675 | + <th scope="col" class="four wide right aligned"></th> | |
| 470 | 676 | </tr> |
| 471 | 677 | </thead> |
| 472 | 678 | <tbody> |
| 473 | 679 | <?php static::render_php_check_tbody(); ?> |
| @@ -476,24 +682,30 @@ | ||
| 476 | 682 | |
| 477 | 683 | <table id="mainwp-system-report-mysql-table" class="ui unstackable table mainwp-system-report-table mainwp-system-info-table"> |
| 478 | 684 | <thead> |
| 479 | 685 | <tr> |
| 480 | - <th scope="col" ><?php esc_html_e( 'MySQL', 'mainwp' ); ?></th> | |
| 481 | - <th scope="col" ><?php esc_html_e( 'Required', 'mainwp' ); ?></th> | |
| 482 | - <th scope="col" ><?php esc_html_e( 'Detected', 'mainwp' ); ?></th> | |
| 483 | - <th scope="col" class="right aligned"><?php esc_html_e( 'Status', 'mainwp' ); ?></th> | |
| 686 | + <th scope="col" class="four wide"<?php echo self::get_export_text_attr( 'MySQL' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'MySQL', 'mainwp' ); ?></th> | |
| 687 | + <th scope="col" class="four wide"<?php echo self::get_export_text_attr( 'Required' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Required', 'mainwp' ); ?></th> | |
| 688 | + <th scope="col" class="four wide"<?php echo self::get_export_text_attr( 'Detected' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Detected', 'mainwp' ); ?></th> | |
| 689 | + <th scope="col" class="four wide right aligned"></th> | |
| 484 | 690 | </tr> |
| 485 | 691 | </thead> |
| 486 | - <tbody> | |
| 487 | - <?php static::render_mysql_check_tbody(); ?> | |
| 488 | - </tbody> | |
| 692 | + <tbody> | |
| 693 | + <?php static::render_mysql_check_tbody(); ?> | |
| 694 | + </tbody> | |
| 489 | 695 | </table> |
| 490 | 696 | |
| 697 | + <?php self::render_report_section_table( 'mainwp-system-report-mainwp-database-table', __( 'Database', 'mainwp' ), $datatable_rows, 'Database' ); ?> | |
| 698 | + | |
| 699 | + <?php self::render_report_section_table( 'mainwp-system-report-connectivity-table', __( 'Connectivity & Authentication', 'mainwp' ), MainWP_Server_Information_Handler::get_connectivity_report_rows(), 'Connectivity & Authentication' ); ?> | |
| 700 | + | |
| 701 | + <?php self::render_report_section_table( 'mainwp-system-report-scheduler-table', __( 'Scheduler & Background Jobs', 'mainwp' ), MainWP_Server_Information_Handler::get_scheduler_report_rows(), 'Scheduler & Background Jobs' ); ?> | |
| 702 | + | |
| 491 | 703 | <table id="mainwp-system-report-server-table" class="ui unstackable table mainwp-system-report-table mainwp-system-info-table"> |
| 492 | 704 | <thead> |
| 493 | 705 | <tr> |
| 494 | - <th scope="col" ><?php esc_html_e( 'Server Configuration', 'mainwp' ); ?></th> | |
| 495 | - <th scope="col" ><?php esc_html_e( 'Detected Value', 'mainwp' ); ?></th> | |
| 706 | + <th scope="col" class="seven wide"<?php echo self::get_export_text_attr( 'Server Configuration' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Server Configuration', 'mainwp' ); ?></th> | |
| 707 | + <th scope="col" class="nine wide"<?php echo self::get_export_text_attr( 'Detected Value' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Detected Value', 'mainwp' ); ?></th> | |
| 496 | 708 | </tr> |
| 497 | 709 | </thead> |
| 498 | 710 | <tbody> |
| 499 | 711 | <?php static::render_server_check_tbody(); ?> |
| @@ -499,28 +711,38 @@ | ||
| 499 | 711 | <?php static::render_server_check_tbody(); ?> |
| 500 | 712 | </tbody> |
| 501 | 713 | </table> |
| 502 | 714 | |
| 503 | - <table id="mainwp-system-report-dashboard-table" class="ui unstackable table mainwp-system-report-table mainwp-system-info-table"> | |
| 504 | - <thead> | |
| 505 | - <tr> | |
| 506 | - <th scope="col" ><?php esc_html_e( 'MainWP Dashboard Settings', 'mainwp' ); ?></th> | |
| 507 | - <th scope="col" ><?php esc_html_e( 'Detected Value', 'mainwp' ); ?></th> | |
| 508 | - </tr> | |
| 509 | - </thead> | |
| 510 | - <tbody> | |
| 511 | - <?php static::render_dashboard_check_tbody(); ?> | |
| 512 | - </tbody> | |
| 513 | - </table> | |
| 715 | + <?php self::render_report_section_table( 'mainwp-system-report-overview-table', __( 'MainWP Overview', 'mainwp' ), MainWP_Server_Information_Handler::get_mainwp_overview_report_rows(), 'MainWP Overview' ); ?> | |
| 514 | 716 | |
| 717 | + <?php self::render_report_section_table( 'mainwp-system-report-general-settings-table', __( 'MainWP General Settings', 'mainwp' ), MainWP_Server_Information_Handler::get_general_settings_report_rows(), 'MainWP General Settings' ); ?> | |
| 718 | + | |
| 719 | + <?php self::render_report_section_table( 'mainwp-system-report-advanced-settings-table', __( 'MainWP Advanced Settings', 'mainwp' ), MainWP_Server_Information_Handler::get_advanced_settings_report_rows(), 'MainWP Advanced Settings' ); ?> | |
| 720 | + | |
| 721 | + <?php self::render_report_section_table( 'mainwp-system-report-monitoring-settings-table', __( 'MainWP Monitoring Settings', 'mainwp' ), MainWP_Server_Information_Handler::get_monitoring_settings_report_rows(), 'MainWP Monitoring Settings' ); ?> | |
| 722 | + | |
| 723 | + <?php self::render_report_section_table( 'mainwp-system-report-email-settings-table', __( 'MainWP Email Settings', 'mainwp' ), MainWP_Server_Information_Handler::get_email_settings_report_rows(), 'MainWP Email Settings' ); ?> | |
| 724 | + | |
| 725 | + <?php self::render_report_section_table( 'mainwp-system-report-cost-tracker-settings-table', __( 'MainWP Cost Tracker Settings', 'mainwp' ), MainWP_Server_Information_Handler::get_cost_tracker_report_rows(), 'MainWP Cost Tracker Settings' ); ?> | |
| 726 | + | |
| 727 | + <?php self::render_report_section_table( 'mainwp-system-report-network-activity-settings-table', __( 'MainWP Network Activity Settings', 'mainwp' ), MainWP_Server_Information_Handler::get_insights_report_rows(), 'MainWP Network Activity Settings' ); ?> | |
| 728 | + | |
| 729 | + <?php self::render_report_section_table( 'mainwp-system-report-api-backups-settings-table', __( 'MainWP API Backups Settings', 'mainwp' ), MainWP_Server_Information_Handler::get_api_backups_report_rows(), 'MainWP API Backups Settings' ); ?> | |
| 730 | + | |
| 731 | + <?php self::render_report_section_table( 'mainwp-system-report-tools-settings-table', __( 'MainWP Tools Settings', 'mainwp' ), MainWP_Server_Information_Handler::get_tools_report_rows(), 'MainWP Tools Settings' ); ?> | |
| 732 | + | |
| 733 | + <?php self::render_report_section_table( 'mainwp-system-report-debug-settings-table', __( 'Debug & Logs', 'mainwp' ), MainWP_Server_Information_Handler::get_debug_report_rows(), 'Debug & Logs' ); ?> | |
| 734 | + | |
| 735 | + <?php self::render_report_section_table( 'mainwp-system-report-conflict-signals-table', __( 'Potential Conflicts', 'mainwp' ), MainWP_Server_Information_Handler::get_conflict_signal_report_rows(), 'Potential Conflicts' ); ?> | |
| 736 | + | |
| 515 | 737 | <table id="mainwp-system-report-extensions-table" class="ui unstackable table single line mainwp-system-report-table mainwp-system-info-table"> |
| 516 | 738 | <thead> |
| 517 | - <tr> | |
| 518 | - <th scope="col" ><?php esc_html_e( 'Extensions', 'mainwp' ); ?></th> | |
| 519 | - <th scope="col" ><?php esc_html_e( 'Version', 'mainwp' ); ?></th> | |
| 520 | - <th scope="col" ><?php esc_html_e( 'License', 'mainwp' ); ?></th> | |
| 521 | - <th scope="col" class="right aligned"><?php esc_html_e( 'Status', 'mainwp' ); ?></th> | |
| 522 | - </tr> | |
| 739 | + <tr> | |
| 740 | + <th scope="col" class="four wide"<?php echo self::get_export_text_attr( 'Extensions' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Extensions', 'mainwp' ); ?></th> | |
| 741 | + <th scope="col" class="four wide"<?php echo self::get_export_text_attr( 'Version' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Version', 'mainwp' ); ?></th> | |
| 742 | + <th scope="col" class="four wide"<?php echo self::get_export_text_attr( 'License' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'License', 'mainwp' ); ?></th> | |
| 743 | + <th scope="col" class="four wide right aligned"></th> | |
| 744 | + </tr> | |
| 523 | 745 | </thead> |
| 524 | 746 | <tbody> |
| 525 | 747 | <?php static::render_extensions_license_check_tbody(); ?> |
| 526 | 748 | </tbody> |
| @@ -528,11 +750,11 @@ | ||
| 528 | 750 | |
| 529 | 751 | <table id="mainwp-system-report-plugins-table" class="ui single line table unstackable mainwp-system-report-table mainwp-system-info-table"> |
| 530 | 752 | <thead> |
| 531 | 753 | <tr> |
| 532 | - <th scope="col" ><?php esc_html_e( 'Plugin', 'mainwp' ); ?></th> | |
| 533 | - <th scope="col" ><?php esc_html_e( 'Version', 'mainwp' ); ?></th> | |
| 534 | - <th scope="col" ><?php esc_html_e( 'Status', 'mainwp' ); ?></th> | |
| 754 | + <th scope="col" class="eight wide"<?php echo self::get_export_text_attr( 'Plugin' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Plugin', 'mainwp' ); ?></th> | |
| 755 | + <th scope="col" class="four wide"<?php echo self::get_export_text_attr( 'Version' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Version', 'mainwp' ); ?></th> | |
| 756 | + <th scope="col" class="four wide right aligned"></th> | |
| 535 | 757 | </tr> |
| 536 | 758 | </thead> |
| 537 | 759 | <tbody> |
| 538 | 760 | <?php static::render_plugins_check_tbody(); ?> |
| @@ -548,22 +770,36 @@ | ||
| 548 | 770 | if( jQuery( window ).width() > 1140 ) { |
| 549 | 771 | responsive = false; |
| 550 | 772 | } |
| 551 | 773 | jQuery( document ).ready( function() { |
| 552 | - jQuery( '.mainwp-system-info-table:not(#mainwp-system-report-extensions-table)' ).DataTable( { | |
| 553 | - responsive: responsive, | |
| 554 | - colreorder: true, | |
| 555 | - paging: false, | |
| 556 | - info: false, | |
| 774 | + const mainwpSystemReportTables = []; | |
| 775 | + jQuery( '.mainwp-system-info-table:not(#mainwp-system-report-extensions-table)' ).each( function() { | |
| 776 | + mainwpSystemReportTables.push( jQuery( this ).DataTable( { | |
| 777 | + responsive: responsive, | |
| 778 | + colReorder: true, | |
| 779 | + paging: false, | |
| 780 | + info: false, | |
| 781 | + autoWidth: false, | |
| 782 | + dom: 't', | |
| 783 | + } ) ); | |
| 557 | 784 | } ); |
| 558 | - jQuery( '#mainwp-system-report-extensions-table' ).DataTable( { | |
| 785 | + mainwpSystemReportTables.push( jQuery( '#mainwp-system-report-extensions-table' ).DataTable( { | |
| 559 | 786 | responsive: responsive, |
| 560 | - colreorder: true, | |
| 787 | + colReorder: true, | |
| 561 | 788 | paging: false, |
| 562 | 789 | info: false, |
| 790 | + autoWidth: false, | |
| 791 | + dom: 't', | |
| 563 | 792 | "language": { |
| 564 | 793 | "emptyTable": "<?php esc_html_e( 'No installed extensions', 'mainwp' ); ?>" |
| 565 | 794 | }, |
| 795 | + } ) ); | |
| 796 | + | |
| 797 | + jQuery( '#mainwp-system-report-global-search' ).on( 'input', function() { | |
| 798 | + const searchValue = jQuery( this ).val(); | |
| 799 | + mainwpSystemReportTables.forEach( function( table ) { | |
| 800 | + table.search( searchValue ).draw(); | |
| 801 | + } ); | |
| 566 | 802 | } ); |
| 567 | 803 | } ); |
| 568 | 804 | </script> |
| 569 | 805 | </div> |
| @@ -592,9 +828,9 @@ | ||
| 592 | 828 | static::render_row( 'WordPress Memory Limit', '>=', '64M', 'get_wordpress_memory_limit', '', '', null ); |
| 593 | 829 | static::render_row( 'MultiSite Disabled', '=', true, 'check_if_multisite', '', '', null ); |
| 594 | 830 | ?> |
| 595 | 831 | <tr> |
| 596 | - <td><?php esc_html_e( 'FileSystem Method', 'mainwp' ); ?></td> | |
| 832 | + <td<?php echo self::get_export_text_attr( 'FileSystem Method' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'FileSystem Method', 'mainwp' ); ?></td> | |
| 597 | 833 | <td><?php echo esc_html( '= direct' ); ?></td> |
| 598 | 834 | <td><?php echo MainWP_Server_Information_Handler::get_file_system_method(); // phpcs:ignore WordPress.Security.EscapeOutput ?></td> |
| 599 | 835 | <td class="right aligned"><?php echo static::get_file_system_method_check(); // phpcs:ignore WordPress.Security.EscapeOutput ?></td> |
| 600 | 836 | </tr> |
| @@ -607,9 +843,8 @@ | ||
| 607 | 843 | * @return void |
| 608 | 844 | */ |
| 609 | 845 | public static function render_php_check_tbody() { |
| 610 | 846 | static::render_row( 'PHP Version', '>=', '7.4', 'get_php_version', '', '', null, null, static::ERROR ); |
| 611 | - static::render_row( 'PHP Safe Mode Disabled', '=', true, 'get_php_safe_mode', '', '', null ); | |
| 612 | 847 | static::render_row( 'PHP Max Execution Time', '>=', '30', 'get_max_execution_time', 'seconds', '=', '0' ); |
| 613 | 848 | static::render_row( 'PHP Max Input Time', '>=', '30', 'get_max_input_time', 'seconds', '=', '0' ); |
| 614 | 849 | static::render_row( 'PHP Memory Limit', '>=', '256M', 'get_php_memory_limit', '', '', null, 'filesize' ); |
| 615 | 850 | static::render_row( 'PCRE Backtracking Limit', '>=', '10000', 'get_output_buffer_size', '', '', null ); |
| @@ -642,9 +877,9 @@ | ||
| 642 | 877 | <tr> |
| 643 | 878 | <td>OpenSSL Working Status</td> |
| 644 | 879 | <td>Yes</td> |
| 645 | 880 | <td><?php echo $wk ? 'Yes' : 'No'; ?></td> |
| 646 | - <td class="right aligned"><?php echo $wk ? static::get_pass_html() : static::get_warning_html(); // phpcs:ignore WordPress.Security.EscapeOutput ?></td> | |
| 881 | + <td class="right aligned"><?php $wk ? static::get_pass_html( true ) : static::get_warning_html( self::WARNING, true ); ?></td> | |
| 647 | 882 | </tr> |
| 648 | 883 | <?php |
| 649 | 884 | |
| 650 | 885 | } |
| @@ -649,39 +884,61 @@ | ||
| 649 | 884 | |
| 650 | 885 | } |
| 651 | 886 | ?> |
| 652 | 887 | <tr> |
| 653 | - <td><?php esc_html_e( 'PHP Allow URL fopen', 'mainwp' ); ?></td> | |
| 888 | + <td<?php echo self::get_export_text_attr( 'PHP Allow URL fopen' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'PHP Allow URL fopen', 'mainwp' ); ?></td> | |
| 654 | 889 | <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td> |
| 655 | 890 | <td><?php MainWP_Server_Information_Handler::get_php_allow_url_fopen(); ?></td> |
| 656 | 891 | <td></td> |
| 657 | 892 | </tr> |
| 658 | 893 | <tr> |
| 659 | - <td><?php esc_html_e( 'PHP Exif Support', 'mainwp' ); ?></td> | |
| 894 | + <td<?php echo self::get_export_text_attr( 'PHP Exif Support' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'PHP Exif Support', 'mainwp' ); ?></td> | |
| 660 | 895 | <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td> |
| 661 | 896 | <td><?php MainWP_Server_Information_Handler::get_php_exif(); ?></td> |
| 662 | 897 | <td></td> |
| 663 | 898 | </tr> |
| 664 | 899 | <tr> |
| 665 | - <td><?php esc_html_e( 'PHP IPTC Support', 'mainwp' ); ?></td> | |
| 900 | + <td<?php echo self::get_export_text_attr( 'PHP IPTC Support' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'PHP IPTC Support', 'mainwp' ); ?></td> | |
| 666 | 901 | <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td> |
| 667 | 902 | <td><?php MainWP_Server_Information_Handler::get_php_iptc(); ?></td> |
| 668 | 903 | <td></td> |
| 669 | 904 | </tr> |
| 670 | 905 | <tr> |
| 671 | - <td><?php esc_html_e( 'PHP XML Support', 'mainwp' ); ?></td> | |
| 906 | + <td<?php echo self::get_export_text_attr( 'PHP XML Support' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'PHP XML Support', 'mainwp' ); ?></td> | |
| 672 | 907 | <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td> |
| 673 | 908 | <td><?php MainWP_Server_Information_Handler::get_php_xml(); ?></td> |
| 674 | 909 | <td></td> |
| 675 | 910 | </tr> |
| 676 | 911 | <tr> |
| 677 | - <td><?php esc_html_e( 'PHP Disabled Functions', 'mainwp' ); ?></td> | |
| 912 | + <td<?php echo self::get_export_text_attr( 'Function `tmpfile` enabled' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Function `tmpfile` enabled', 'mainwp' ); ?></td> | |
| 678 | 913 | <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td> |
| 914 | + <td> | |
| 915 | + <?php | |
| 916 | + $tmpfile_enabled = MainWP_System_View::is_tmpfile_enable(); | |
| 917 | + echo $tmpfile_enabled ? esc_html__( 'Enabled', 'mainwp' ) : esc_html__( 'Disabled', 'mainwp' ); | |
| 918 | + ?> | |
| 919 | + </td> | |
| 920 | + <td class="right aligned"><?php $tmpfile_enabled ? static::get_pass_html( true ) : static::get_warning_html( self::WARNING, true ); ?></td> | |
| 921 | + </tr> | |
| 922 | + <tr> | |
| 923 | + <td<?php echo self::get_export_text_attr( 'PHP Session enabled' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'PHP Session enabled', 'mainwp' ); ?></td> | |
| 924 | + <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td> | |
| 925 | + <td> | |
| 926 | + <?php | |
| 927 | + $session_disable = MainWP_Cache::is_session_disable(); | |
| 928 | + echo $session_disable ? esc_html__( 'Disabled', 'mainwp' ) : esc_html__( 'Enabled', 'mainwp' ); | |
| 929 | + ?> | |
| 930 | + </td> | |
| 931 | + <td class="right aligned"><?php echo ! $session_disable ? static::get_pass_html() : static::get_warning_html(); //phpcs:ignore -- ok. ?></td> | |
| 932 | + </tr> | |
| 933 | + <tr> | |
| 934 | + <td<?php echo self::get_export_text_attr( 'PHP Disabled Functions' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'PHP Disabled Functions', 'mainwp' ); ?></td> | |
| 935 | + <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td> | |
| 679 | 936 | <td><?php static::php_disabled_functions(); ?></td> |
| 680 | 937 | <td></td> |
| 681 | 938 | </tr> |
| 682 | 939 | <tr> |
| 683 | - <td><?php esc_html_e( 'PHP Loaded Extensions', 'mainwp' ); ?></td> | |
| 940 | + <td<?php echo self::get_export_text_attr( 'PHP Loaded Extensions' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'PHP Loaded Extensions', 'mainwp' ); ?></td> | |
| 684 | 941 | <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td> |
| 685 | 942 | <td><?php MainWP_Server_Information_Handler::get_loaded_php_extensions(); ?></td> |
| 686 | 943 | <td></td> |
| 687 | 944 | </tr> |
| @@ -696,15 +953,15 @@ | ||
| 696 | 953 | public static function render_mysql_check_tbody() { |
| 697 | 954 | static::render_row( 'MySQL Version', '>=', '5.0', 'get_mysql_version', '', '', null, null, static::ERROR ); |
| 698 | 955 | ?> |
| 699 | 956 | <tr> |
| 700 | - <td><?php esc_html_e( 'MySQL Mode', 'mainwp' ); ?></td> | |
| 957 | + <td<?php echo self::get_export_text_attr( 'MySQL Mode' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'MySQL Mode', 'mainwp' ); ?></td> | |
| 701 | 958 | <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td> |
| 702 | 959 | <td><?php MainWP_Server_Information_Handler::get_sql_mode(); ?></td> |
| 703 | 960 | <td></td> |
| 704 | 961 | </tr> |
| 705 | 962 | <tr> |
| 706 | - <td><?php esc_html_e( 'MySQL Client Encoding', 'mainwp' ); ?></td> | |
| 963 | + <td<?php echo self::get_export_text_attr( 'MySQL Client Encoding' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'MySQL Client Encoding', 'mainwp' ); ?></td> | |
| 707 | 964 | <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td> |
| 708 | 965 | <td><?php echo defined( 'DB_CHARSET' ) ? esc_html( DB_CHARSET ) : ''; ?></td> |
| 709 | 966 | <td></td> |
| 710 | 967 | </tr> |
| @@ -718,97 +975,89 @@ | ||
| 718 | 975 | */ |
| 719 | 976 | public static function render_server_check_tbody() { |
| 720 | 977 | ?> |
| 721 | 978 | <tr class="mwp-not-generate-row"> |
| 722 | - <td><?php esc_html_e( 'WordPress Root Directory', 'mainwp' ); ?></td> | |
| 979 | + <td<?php echo self::get_export_text_attr( 'WordPress Root Directory' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'WordPress Root Directory', 'mainwp' ); ?></td> | |
| 723 | 980 | <td><?php MainWP_Server_Information_Handler::get_wp_root(); ?></td> |
| 724 | 981 | </tr> |
| 725 | 982 | <tr class="mwp-not-generate-row"> |
| 726 | - <td><?php esc_html_e( 'Server Name', 'mainwp' ); ?></td> | |
| 983 | + <td<?php echo self::get_export_text_attr( 'Server Name' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Server Name', 'mainwp' ); ?></td> | |
| 727 | 984 | <td><?php MainWP_Server_Information_Handler::get_server_name(); ?></td> |
| 728 | 985 | </tr> |
| 729 | 986 | <tr> |
| 730 | - <td><?php esc_html_e( 'Server Software', 'mainwp' ); ?></td> | |
| 987 | + <td<?php echo self::get_export_text_attr( 'Server Software' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Server Software', 'mainwp' ); ?></td> | |
| 731 | 988 | <td><?php MainWP_Server_Information_Handler::get_server_software(); ?></td> |
| 732 | 989 | </tr> |
| 733 | 990 | <tr> |
| 734 | - <td><?php esc_html_e( 'Operating System', 'mainwp' ); ?></td> | |
| 991 | + <td<?php echo self::get_export_text_attr( 'Operating System' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Operating System', 'mainwp' ); ?></td> | |
| 735 | 992 | <td><?php MainWP_Server_Information_Handler::get_os(); ?></td> |
| 736 | 993 | </tr> |
| 737 | 994 | <tr> |
| 738 | - <td><?php esc_html_e( 'Architecture', 'mainwp' ); ?></td> | |
| 995 | + <td<?php echo self::get_export_text_attr( 'Architecture' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Architecture', 'mainwp' ); ?></td> | |
| 739 | 996 | <td><?php MainWP_Server_Information_Handler::get_architecture(); ?></td> |
| 740 | 997 | </tr> |
| 741 | 998 | <tr class="mwp-not-generate-row"> |
| 742 | - <td><?php esc_html_e( 'Server IP', 'mainwp' ); ?></td> | |
| 999 | + <td<?php echo self::get_export_text_attr( 'Server IP' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Server IP', 'mainwp' ); ?></td> | |
| 743 | 1000 | <td><?php MainWP_Server_Information_Handler::get_server_ip(); ?></td> |
| 744 | 1001 | </tr> |
| 745 | 1002 | <tr> |
| 746 | - <td><?php esc_html_e( 'Server Protocol', 'mainwp' ); ?></td> | |
| 1003 | + <td<?php echo self::get_export_text_attr( 'Server Protocol' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Server Protocol', 'mainwp' ); ?></td> | |
| 747 | 1004 | <td><?php MainWP_Server_Information_Handler::get_server_protocol(); ?></td> |
| 748 | 1005 | </tr> |
| 749 | 1006 | <tr class="mwp-not-generate-row"> |
| 750 | - <td><?php esc_html_e( 'HTTP Host', 'mainwp' ); ?></td> | |
| 1007 | + <td<?php echo self::get_export_text_attr( 'HTTP Host' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'HTTP Host', 'mainwp' ); ?></td> | |
| 751 | 1008 | <td><?php MainWP_Server_Information_Handler::get_http_host(); ?></td> |
| 752 | 1009 | </tr> |
| 753 | 1010 | <tr> |
| 754 | - <td><?php esc_html_e( 'HTTPS', 'mainwp' ); ?></td> | |
| 755 | - <td><?php MainWP_Server_Information_Handler::get_https(); ?></td> | |
| 756 | - </tr> | |
| 757 | - <tr> | |
| 758 | - <td><?php esc_html_e( 'Server self connect', 'mainwp' ); ?></td> | |
| 759 | - <td><?php MainWP_Server_Information_Handler::server_self_connect(); ?></td> | |
| 760 | - </tr> | |
| 761 | - <tr> | |
| 762 | - <td><?php esc_html_e( 'User Agent', 'mainwp' ); ?></td> | |
| 1011 | + <td<?php echo self::get_export_text_attr( 'User Agent' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'User Agent', 'mainwp' ); ?></td> | |
| 763 | 1012 | <td><?php MainWP_Server_Information_Handler::get_user_agent(); ?></td> |
| 764 | 1013 | </tr> |
| 765 | 1014 | <tr class="mwp-not-generate-row"> |
| 766 | - <td><?php esc_html_e( 'Server Port', 'mainwp' ); ?></td> | |
| 1015 | + <td<?php echo self::get_export_text_attr( 'Server Port' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Server Port', 'mainwp' ); ?></td> | |
| 767 | 1016 | <td><?php MainWP_Server_Information_Handler::get_server_port(); ?></td> |
| 768 | 1017 | </tr> |
| 769 | 1018 | <tr> |
| 770 | - <td><?php esc_html_e( 'Gateway Interface', 'mainwp' ); ?></td> | |
| 1019 | + <td<?php echo self::get_export_text_attr( 'Gateway Interface' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Gateway Interface', 'mainwp' ); ?></td> | |
| 771 | 1020 | <td><?php MainWP_Server_Information_Handler::get_server_gateway_interface(); ?></td> |
| 772 | 1021 | </tr> |
| 773 | 1022 | <tr> |
| 774 | - <td><?php esc_html_e( 'Memory Usage', 'mainwp' ); ?></td> | |
| 1023 | + <td<?php echo self::get_export_text_attr( 'Memory Usage' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Memory Usage', 'mainwp' ); ?></td> | |
| 775 | 1024 | <td><?php MainWP_Server_Information_Handler::memory_usage(); ?></td> |
| 776 | 1025 | </tr> |
| 777 | 1026 | <tr class="mwp-not-generate-row"> |
| 778 | - <td><?php esc_html_e( 'Complete URL', 'mainwp' ); ?></td> | |
| 1027 | + <td<?php echo self::get_export_text_attr( 'Referrer URL' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Referrer URL', 'mainwp' ); ?></td> | |
| 779 | 1028 | <td><?php MainWP_Server_Information_Handler::get_complete_url(); ?></td> |
| 780 | 1029 | </tr> |
| 781 | 1030 | <tr> |
| 782 | - <td><?php esc_html_e( 'Request Time', 'mainwp' ); ?></td> | |
| 1031 | + <td<?php echo self::get_export_text_attr( 'Request Time' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Request Time', 'mainwp' ); ?></td> | |
| 783 | 1032 | <td><?php MainWP_Server_Information_Handler::get_server_request_time(); ?></td> |
| 784 | 1033 | </tr> |
| 785 | 1034 | <tr> |
| 786 | - <td><?php esc_html_e( 'Accept Content', 'mainwp' ); ?></td> | |
| 1035 | + <td<?php echo self::get_export_text_attr( 'Accept Content' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Accept Content', 'mainwp' ); ?></td> | |
| 787 | 1036 | <td><?php MainWP_Server_Information_Handler::get_server_http_accept(); ?></td> |
| 788 | 1037 | </tr> |
| 789 | 1038 | <tr> |
| 790 | - <td><?php esc_html_e( 'Accept-Charset Content', 'mainwp' ); ?></td> | |
| 1039 | + <td<?php echo self::get_export_text_attr( 'Accept-Charset Content' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Accept-Charset Content', 'mainwp' ); ?></td> | |
| 791 | 1040 | <td><?php MainWP_Server_Information_Handler::get_server_accept_charset(); ?></td> |
| 792 | 1041 | </tr> |
| 793 | 1042 | <tr class="mwp-not-generate-row"> |
| 794 | - <td><?php esc_html_e( 'Currently Executing Script Pathname', 'mainwp' ); ?></td> | |
| 1043 | + <td<?php echo self::get_export_text_attr( 'Currently Executing Script Pathname' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Currently Executing Script Pathname', 'mainwp' ); ?></td> | |
| 795 | 1044 | <td><?php MainWP_Server_Information_Handler::get_script_file_name(); ?></td> |
| 796 | 1045 | </tr> |
| 797 | 1046 | <tr class="mwp-not-generate-row"> |
| 798 | - <td><?php esc_html_e( 'Current Page URI', 'mainwp' ); ?></td> | |
| 1047 | + <td<?php echo self::get_export_text_attr( 'Current Page URI' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Current Page URI', 'mainwp' ); ?></td> | |
| 799 | 1048 | <td><?php MainWP_Server_Information_Handler::get_current_page_uri(); ?></td> |
| 800 | 1049 | </tr> |
| 801 | 1050 | <tr class="mwp-not-generate-row"> |
| 802 | - <td><?php esc_html_e( 'Remote Address', 'mainwp' ); ?></td> | |
| 1051 | + <td<?php echo self::get_export_text_attr( 'Remote Address' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Remote Address', 'mainwp' ); ?></td> | |
| 803 | 1052 | <td><?php MainWP_Server_Information_Handler::get_remote_address(); ?></td> |
| 804 | 1053 | </tr> |
| 805 | 1054 | <tr class="mwp-not-generate-row"> |
| 806 | - <td><?php esc_html_e( 'Remote Host', 'mainwp' ); ?></td> | |
| 1055 | + <td<?php echo self::get_export_text_attr( 'Remote Host' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Remote Host', 'mainwp' ); ?></td> | |
| 807 | 1056 | <td><?php MainWP_Server_Information_Handler::get_remote_host(); ?></td> |
| 808 | 1057 | </tr> |
| 809 | 1058 | <tr class="mwp-not-generate-row"> |
| 810 | - <td><?php esc_html_e( 'Remote Port', 'mainwp' ); ?></td> | |
| 1059 | + <td<?php echo self::get_export_text_attr( 'Remote Port' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Remote Port', 'mainwp' ); ?></td> | |
| 811 | 1060 | <td><?php MainWP_Server_Information_Handler::get_remote_port(); ?></td> |
| 812 | 1061 | </tr> |
| 813 | 1062 | <?php |
| 814 | 1063 | } |
| @@ -914,9 +1163,15 @@ | ||
| 914 | 1163 | <?php |
| 915 | 1164 | static::render_row_with_description( esc_html__( 'PHP Version', 'mainwp' ), '>=', '7.4', 'get_php_version', '', '', null ); |
| 916 | 1165 | static::render_row_with_description( esc_html__( 'SSL Extension Enabled', 'mainwp' ), '=', true, 'get_ssl_support', '', '', null ); |
| 917 | 1166 | static::render_row_with_description( esc_html__( 'cURL Extension Enabled', 'mainwp' ), '=', true, 'get_curl_support', '', '', null ); |
| 1167 | + | |
| 1168 | + $ssl_version = MainWP_Server_Information_Handler::get_curl_ssl_version(); | |
| 918 | 1169 | $openssl_version = 'OpenSSL/1.1.0'; |
| 1170 | + if ( false !== strpos( $ssl_version, 'LibreSSL' ) ) { | |
| 1171 | + $openssl_version = 'LibreSSL/2.5.0'; | |
| 1172 | + } | |
| 1173 | + | |
| 919 | 1174 | static::render_row_with_description( |
| 920 | 1175 | 'cURL SSL Version', |
| 921 | 1176 | '>=', |
| 922 | 1177 | $openssl_version, |
| @@ -927,9 +1182,24 @@ | ||
| 927 | 1182 | 'curlssl' |
| 928 | 1183 | ); |
| 929 | 1184 | |
| 930 | 1185 | if ( ! MainWP_Server_Information_Handler::curlssl_compare( $openssl_version, '>=' ) ) { |
| 931 | - echo "<tr class='warning'><td colspan='4'><i class='attention icon'></i>" . sprintf( esc_html__( 'Your host needs to update OpenSSL to at least version 1.1.0 which is already over 4 years old and contains patches for over 60 vulnerabilities.%1$sThese range from Denial of Service to Remote Code Execution. %2$sClick here for more information.%3$s', 'mainwp' ), '<br/>', '<a href="https://community.letsencrypt.org/t/openssl-client-compatibility-changes-for-let-s-encrypt-certificates/143816" target="_blank">', '</a>' ) . '</td></tr>'; | |
| 1186 | + ?> | |
| 1187 | + <tr class='warning'> | |
| 1188 | + <td colspan='4'> | |
| 1189 | + <i class='attention icon'></i> | |
| 1190 | + <?php | |
| 1191 | + if ( false !== strpos( $ssl_version, 'LibreSSL' ) ) { | |
| 1192 | + /* translators: 1: line break tag, 2: opening anchor tag, 3: closing anchor tag */ | |
| 1193 | + printf( esc_html__( 'Your host needs to update LibreSSL to at least version 2.5.0 which is already over 4 years old and contains patches for over 60 vulnerabilities.%1$sThese range from Denial of Service to Remote Code Execution. %2$sClick here for more information.%3$s', 'mainwp' ), '<br/>', '<a href="https://www.libressl.org/" target="_blank">', '</a>' ); | |
| 1194 | + } else { | |
| 1195 | + /* translators: 1: line break tag, 2: opening anchor tag, 3: closing anchor tag */ | |
| 1196 | + printf( esc_html__( 'Your host needs to update OpenSSL to at least version 1.1.0 which is already over 4 years old and contains patches for over 60 vulnerabilities.%1$sThese range from Denial of Service to Remote Code Execution. %2$sClick here for more information.%3$s', 'mainwp' ), '<br/>', '<a href="https://community.letsencrypt.org/t/openssl-client-compatibility-changes-for-let-s-encrypt-certificates/143816" target="_blank">', '</a>' ); | |
| 1197 | + } | |
| 1198 | + ?> | |
| 1199 | + </td> | |
| 1200 | + </tr> | |
| 1201 | + <?php | |
| 932 | 1202 | } |
| 933 | 1203 | static::render_row_with_description( esc_html__( 'MySQL Version', 'mainwp' ), '>=', '5.0', 'get_mysql_version', '', '', null ); |
| 934 | 1204 | ?> |
| 935 | 1205 | </tbody> |
| @@ -970,10 +1240,10 @@ | ||
| 970 | 1240 | * @uses \MainWP\Dashboard\MainWP_Utility::format_timestamp() |
| 971 | 1241 | * @uses \MainWP\Dashboard\MainWP_Utility::get_timestamp() |
| 972 | 1242 | */ |
| 973 | 1243 | public static function render_cron() { // phpcs:ignore -- NOSONAR - complex. |
| 974 | - if ( ! mainwp_current_user_have_right( 'dashboard', 'see_server_information' ) ) { | |
| 975 | - mainwp_do_not_have_permissions( 'cron schedules', 'mainwp' ); | |
| 1244 | + if ( ! \mainwp_current_user_can( 'dashboard', 'see_server_information' ) ) { | |
| 1245 | + \mainwp_do_not_have_permissions( 'cron schedules', 'mainwp' ); | |
| 976 | 1246 | return; |
| 977 | 1247 | } |
| 978 | 1248 | |
| 979 | 1249 | static::render_header( 'ServerInformationCron' ); |
| @@ -991,12 +1261,9 @@ | ||
| 991 | 1261 | 'Check for reconnect sites' => array( 'mainwp_cron_last_stats', 'mainwp_cronreconnect_action', esc_html__( 'Once hourly', 'mainwp' ), 'hourly' ), |
| 992 | 1262 | 'Ping childs sites' => array( 'mainwp_cron_last_ping', 'mainwp_cronpingchilds_action', esc_html__( 'Once daily', 'mainwp' ), 'daily' ), |
| 993 | 1263 | ); |
| 994 | 1264 | |
| 995 | - $disableSitesMonitoring = get_option( 'mainwp_disableSitesChecking', 1 ); | |
| 996 | - if ( ! $disableSitesMonitoring ) { | |
| 997 | - $cron_jobs['Child site uptime monitoring'] = array( 'mainwp_cron_checksites_last_timestamp', 'mainwp_croncheckstatus_action', esc_html__( 'Once every minute', 'mainwp' ), 'minutely' ); | |
| 998 | - } | |
| 1265 | + $cron_jobs['Child site uptime monitoring'] = array( 'mainwp_uptime_lasttime_check', 'mainwp_cronuptimemonitoringcheck_action', esc_html__( 'Once every minute', 'mainwp' ), 'minutely' ); | |
| 999 | 1266 | |
| 1000 | 1267 | $disableHealthChecking = get_option( 'mainwp_disableSitesHealthMonitoring', 1 ); // disabled by default. |
| 1001 | 1268 | if ( ! $disableHealthChecking ) { |
| 1002 | 1269 | $cron_jobs['Site Health monitoring'] = array( 'mainwp_cron_checksiteshealth_last_timestamp', 'mainwp_cronsitehealthcheck_action', esc_html__( 'Once hourly', 'mainwp' ), 'hourly' ); |
| @@ -1006,8 +1273,10 @@ | ||
| 1006 | 1273 | $cron_jobs['Start backups (Legacy)'] = array( 'mainwp_cron_last_backups', 'mainwp_cronbackups_action', esc_html__( 'Once hourly', 'mainwp' ), 'hourly' ); |
| 1007 | 1274 | $cron_jobs['Continue backups (Legacy)'] = array( 'mainwp_cron_last_backups_continue', 'mainwp_cronbackups_continue_action', esc_html__( 'Once every five minutes', 'mainwp' ), '5minutely' ); |
| 1008 | 1275 | } |
| 1009 | 1276 | |
| 1277 | + $cron_jobs = apply_filters( 'mainwp_info_schedules_cron_listing', $cron_jobs ); | |
| 1278 | + | |
| 1010 | 1279 | /** |
| 1011 | 1280 | * Action: mainwp_before_cron_jobs_table |
| 1012 | 1281 | * |
| 1013 | 1282 | * Renders on the top of the Cron Jobs page, before the Schedules table. |
| @@ -1015,13 +1284,13 @@ | ||
| 1015 | 1284 | * @since 4.0 |
| 1016 | 1285 | */ |
| 1017 | 1286 | do_action( 'mainwp_before_cron_jobs_table' ); |
| 1018 | 1287 | ?> |
| 1019 | - <div class="ui segment"> | |
| 1288 | + <div class="ui padded segment"> | |
| 1020 | 1289 | <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-cron-info-message' ) ) : ?> |
| 1021 | 1290 | <div class="ui info message"> |
| 1022 | 1291 | <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-cron-info-message"></i> |
| 1023 | - <?php printf( esc_html__( 'Make sure scheduled actions are working correctly. If scheduled actions do not run normally, please review this %1$shelp document%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/scheduled-events-not-occurring/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?> | |
| 1292 | + <?php /* translators: 1: opening anchor tag, 2: closing anchor tag */ printf( esc_html__( 'Make sure scheduled actions are working correctly. If scheduled actions do not run normally, please review this %1$shelp document%2$s.', 'mainwp' ), '<a href="https://docs.mainwp.com/customization/disable-wp-cron" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?> | |
| 1024 | 1293 | </div> |
| 1025 | 1294 | <?php endif; ?> |
| 1026 | 1295 | <table class="ui single line unstackable table" id="mainwp-cron-jobs-table"> |
| 1027 | 1296 | <thead> |
| @@ -1038,50 +1307,71 @@ | ||
| 1038 | 1307 | $useWPCron = ( false === get_option( 'mainwp_wp_cron' ) ) || ( 1 === (int) get_option( 'mainwp_wp_cron' ) ); |
| 1039 | 1308 | |
| 1040 | 1309 | foreach ( $cron_jobs as $cron_job => $hook ) { |
| 1041 | 1310 | |
| 1042 | - $is_auto_update_job = false; | |
| 1043 | - $lasttime_run = 0; | |
| 1044 | - if ( 'mainwp_updatescheck_start_last_timestamp' === $hook[0] ) { | |
| 1045 | - $update_time = MainWP_Settings::get_websites_automatic_update_time(); | |
| 1046 | - $last_run = $update_time['last']; | |
| 1047 | - $next_run = $update_time['next']; | |
| 1048 | - $is_auto_update_job = true; | |
| 1049 | - } elseif ( false === get_option( $hook[0] ) ) { | |
| 1050 | - $last_run = esc_html__( 'Never', 'mainwp' ); | |
| 1311 | + if ( is_array( $hook ) && isset( $hook['title'] ) && isset( $hook['action'] ) ) { | |
| 1312 | + $job_title = $hook['title']; | |
| 1313 | + $job_action = $hook['action']; | |
| 1314 | + $job_freq = isset( $hook['frequency'] ) ? $hook['frequency'] : ''; | |
| 1315 | + $job_last_run = isset( $hook['last_run'] ) ? $hook['last_run'] : ''; | |
| 1316 | + $job_next_run = isset( $hook['next_run'] ) ? $hook['next_run'] : ''; | |
| 1051 | 1317 | } else { |
| 1052 | - $lasttime_run = get_option( $hook[0] ); | |
| 1053 | - if ( $lasttime_run ) { | |
| 1054 | - $last_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $lasttime_run ) ); | |
| 1318 | + | |
| 1319 | + $is_auto_update_job = false; | |
| 1320 | + $lasttime_run = 0; | |
| 1321 | + $next_run = 0; | |
| 1322 | + | |
| 1323 | + if ( 'mainwp_updatescheck_start_last_timestamp' === $hook[0] ) { | |
| 1324 | + $update_time = MainWP_Settings::get_websites_automatic_update_time(); | |
| 1325 | + $last_run = $update_time['last']; | |
| 1326 | + $next_run = $update_time['next']; | |
| 1327 | + $is_auto_update_job = true; | |
| 1328 | + } elseif ( false === get_option( $hook[0] ) ) { | |
| 1329 | + $last_run = esc_html__( 'Never', 'mainwp' ); | |
| 1055 | 1330 | } else { |
| 1056 | - $last_run = esc_html__( 'Never', 'mainwp' ); | |
| 1331 | + $lasttime_run = get_option( $hook[0] ); | |
| 1332 | + if ( $lasttime_run ) { | |
| 1333 | + if ( 'mainwp_uptime_lasttime_check' === $hook[0] ) { | |
| 1334 | + $last_run = MainWP_Utility::format_timestamp( $lasttime_run ); | |
| 1335 | + } else { | |
| 1336 | + $last_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $lasttime_run ) ); | |
| 1337 | + } | |
| 1338 | + } else { | |
| 1339 | + $last_run = esc_html__( 'Never', 'mainwp' ); | |
| 1340 | + } | |
| 1057 | 1341 | } |
| 1058 | - } | |
| 1059 | 1342 | |
| 1060 | - if ( $useWPCron && 'mainwp_updatescheck_start_last_timestamp' !== $hook[0] ) { | |
| 1061 | - $next_run = wp_next_scheduled( $hook[1] ); | |
| 1062 | - if ( ! empty( $next_run ) ) { | |
| 1063 | - $next_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $next_run ) ); | |
| 1343 | + if ( $useWPCron && 'mainwp_updatescheck_start_last_timestamp' !== $hook[0] ) { | |
| 1344 | + $next_run = wp_next_scheduled( $hook[1] ); | |
| 1345 | + if ( ! empty( $next_run ) ) { | |
| 1346 | + $next_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $next_run ) ); | |
| 1347 | + } | |
| 1064 | 1348 | } |
| 1065 | - } | |
| 1066 | 1349 | |
| 1067 | - if ( empty( $next_run ) || ( ! $useWPCron && ! $is_auto_update_job && isset( $hook[3] ) ) ) { | |
| 1068 | - $nexttime_run = static::get_schedule_next_time_to_show( $hook[3], $lasttime_run, $local_timestamp ); | |
| 1069 | - if ( $nexttime_run < $local_timestamp + 3 * MINUTE_IN_SECONDS ) { | |
| 1070 | - $next_run = esc_html__( 'Any minute', 'mainwp' ); | |
| 1071 | - } else { | |
| 1072 | - $next_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $nexttime_run ) ); | |
| 1350 | + if ( empty( $next_run ) || ( ! $useWPCron && ! $is_auto_update_job && isset( $hook[3] ) ) ) { | |
| 1351 | + $nexttime_run = static::get_schedule_next_time_to_show( $hook[3], $lasttime_run, $local_timestamp ); | |
| 1352 | + if ( $nexttime_run < $local_timestamp + 3 * MINUTE_IN_SECONDS ) { | |
| 1353 | + $next_run = esc_html__( 'Any minute', 'mainwp' ); | |
| 1354 | + } else { | |
| 1355 | + $next_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $nexttime_run ) ); | |
| 1356 | + } | |
| 1073 | 1357 | } |
| 1358 | + | |
| 1359 | + $job_title = $cron_job; | |
| 1360 | + $job_action = $hook[1]; | |
| 1361 | + $job_freq = $hook[2]; | |
| 1362 | + $job_last_run = $last_run; | |
| 1363 | + $job_next_run = $next_run; | |
| 1074 | 1364 | } |
| 1075 | 1365 | |
| 1076 | 1366 | // phpcs:disable WordPress.Security.EscapeOutput |
| 1077 | 1367 | ?> |
| 1078 | 1368 | <tr> |
| 1079 | - <td><?php echo $cron_job; ?></td> | |
| 1080 | - <td><?php echo $hook[1]; ?></td> | |
| 1081 | - <td><?php echo $hook[2]; ?></td> | |
| 1082 | - <td><?php echo esc_html( $last_run ); ?></td> | |
| 1083 | - <td><?php echo ! empty( $next_run ) ? esc_html( $next_run ) : ''; ?></td> | |
| 1369 | + <td><?php echo esc_html( $job_title ); ?></td> | |
| 1370 | + <td><?php echo esc_html( $job_action ); ?></td> | |
| 1371 | + <td><?php echo esc_html( $job_freq ); ?></td> | |
| 1372 | + <td><?php echo esc_html( $job_last_run ); ?></td> | |
| 1373 | + <td><?php echo ! empty( $job_next_run ) ? esc_html( $job_next_run ) : ''; ?></td> | |
| 1084 | 1374 | </tr> |
| 1085 | 1375 | <?php |
| 1086 | 1376 | // phpcs:enable |
| 1087 | 1377 | } |
| @@ -1390,10 +1680,10 @@ | ||
| 1390 | 1680 | |
| 1391 | 1681 | * Includes last_lines() function by phant0m, licensed under cc-wiki and GPLv2+ |
| 1392 | 1682 | */ |
| 1393 | 1683 | public static function render_error_log_page() { |
| 1394 | - if ( ! mainwp_current_user_have_right( 'dashboard', 'see_server_information' ) ) { | |
| 1395 | - mainwp_do_not_have_permissions( 'error log', 'mainwp' ); | |
| 1684 | + if ( ! \mainwp_current_user_can( 'dashboard', 'see_server_information' ) ) { | |
| 1685 | + \mainwp_do_not_have_permissions( 'error log', 'mainwp' ); | |
| 1396 | 1686 | return; |
| 1397 | 1687 | } |
| 1398 | 1688 | static::render_header( 'ErrorLog' ); |
| 1399 | 1689 | |
| @@ -1405,9 +1695,9 @@ | ||
| 1405 | 1695 | * @since 4.1 |
| 1406 | 1696 | */ |
| 1407 | 1697 | do_action( 'mainwp_before_error_log_table' ); |
| 1408 | 1698 | ?> |
| 1409 | - <div class="ui segment"> | |
| 1699 | + <div class="ui padded segment"> | |
| 1410 | 1700 | <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-error-log-info-message' ) ) : ?> |
| 1411 | 1701 | <div class="ui info message"> |
| 1412 | 1702 | <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-error-log-info-message"></i> |
| 1413 | 1703 | <?php echo esc_html__( 'See the WordPress error log to fix problems that arise on your MainWP Dashboard site.', 'mainwp' ); ?> |
| @@ -1437,10 +1727,14 @@ | ||
| 1437 | 1727 | "stateSave": true, |
| 1438 | 1728 | "stateDuration": 0, |
| 1439 | 1729 | "lengthMenu": [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] ], |
| 1440 | 1730 | "language": { |
| 1441 | - "emptyTable": '<?php esc_html_e( 'Error logging disabled.', 'mainwp' ); ?><?php echo '<br/>' . sprintf( esc_html__( 'To enable error logging, please check this %1$shelp document%2$s.', 'mainwp' ), '<a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">', '</a>' ); ?>' | |
| 1731 | + "emptyTable": '<?php esc_html_e( 'Error logging disabled.', 'mainwp' ); ?><?php /* translators: 1: opening anchor tag, 2: closing anchor tag */ echo '<br/>' . sprintf( esc_html__( 'To enable error logging, please check this %1$shelp document%2$s.', 'mainwp' ), '<a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">', '</a>' ); ?>' | |
| 1442 | 1732 | }, |
| 1733 | + columnDefs: [{ | |
| 1734 | + "defaultContent": "-", | |
| 1735 | + "targets": "_all" | |
| 1736 | + }] | |
| 1443 | 1737 | } ); |
| 1444 | 1738 | } ); |
| 1445 | 1739 | </script> |
| 1446 | 1740 | </div> |
| @@ -1500,11 +1794,9 @@ | ||
| 1500 | 1794 | $lines = array_map( 'trim', $lines ); |
| 1501 | 1795 | $lines = array_filter( $lines ); |
| 1502 | 1796 | |
| 1503 | 1797 | if ( empty( $lines ) ) { |
| 1504 | - | |
| 1505 | - echo '<tr><td>' . esc_html__( 'MainWP is unable to find your error logs, please contact your host for server error logs.', 'mainwp' ) . '</td></tr>'; | |
| 1506 | - | |
| 1798 | + echo '<tr><td colspan="2">' . esc_html__( 'MainWP is unable to find your error logs, please contact your host for server error logs.', 'mainwp' ) . '</td></tr>'; | |
| 1507 | 1799 | return; |
| 1508 | 1800 | } |
| 1509 | 1801 | |
| 1510 | 1802 | foreach ( $lines as $key => $line ) { |
| @@ -1540,10 +1832,10 @@ | ||
| 1540 | 1832 | * |
| 1541 | 1833 | * @return void |
| 1542 | 1834 | */ |
| 1543 | 1835 | public static function render_wp_config() { |
| 1544 | - if ( ! mainwp_current_user_have_right( 'dashboard', 'see_server_information' ) ) { | |
| 1545 | - mainwp_do_not_have_permissions( 'WP-Config.php', 'mainwp' ); | |
| 1836 | + if ( ! \mainwp_current_user_can( 'dashboard', 'see_server_information' ) ) { | |
| 1837 | + \mainwp_do_not_have_permissions( 'WP-Config.php', 'mainwp' ); | |
| 1546 | 1838 | return; |
| 1547 | 1839 | } |
| 1548 | 1840 | |
| 1549 | 1841 | static::render_header( 'WPConfig' ); |
| @@ -1640,20 +1932,34 @@ | ||
| 1640 | 1932 | |
| 1641 | 1933 | $enabled = (int) MainWP_Logger::instance()->get_log_status(); |
| 1642 | 1934 | $specific_default = array( |
| 1643 | 1935 | MainWP_Logger::UPDATE_CHECK_LOG_PRIORITY => esc_html__( 'Update Checking', 'mainwp' ), |
| 1936 | + MainWP_Logger::UPTIME_CHECK_LOG_PRIORITY => esc_html__( 'Uptime monitoring', 'mainwp' ), | |
| 1937 | + MainWP_Logger::UPTIME_NOTICE_LOG_PRIORITY => esc_html__( 'Uptime notification', 'mainwp' ), | |
| 1938 | + MainWP_Logger::LOGS_REGULAR_SCHEDULE => esc_html__( 'Regular Schedule', 'mainwp' ), | |
| 1939 | + MainWP_Logger::DEBUG_UPDATES_SCHEDULE => esc_html__( 'Debug updates crons', 'mainwp' ), | |
| 1644 | 1940 | MainWP_Logger::EXECUTION_TIME_LOG_PRIORITY => esc_html__( 'Execution time', 'mainwp' ), |
| 1645 | - MainWP_Logger::LOGS_AUTO_PURGE_LOG_PRIORITY => esc_html__( 'Logs Auto Purge', 'mainwp' ), | |
| 1941 | + MainWP_Logger::EXECUTION_SYNC_LOG_PRIORITY => esc_html__( 'Execution Sync', 'mainwp' ), | |
| 1942 | + MainWP_Logger::EXECUTION_SYNC_DETAILS_LOG_PRIORITY => esc_html__( 'Execution Sync Details', 'mainwp' ), | |
| 1943 | + MainWP_Logger::LOGS_AUTO_PURGE_LOG_PRIORITY => esc_html__( 'Auto Archive Network Activity', 'mainwp' ), | |
| 1944 | + MainWP_Logger::CONNECT_LOG_PRIORITY => esc_html__( 'Dashboard Connect', 'mainwp' ), | |
| 1945 | + MainWP_Logger::SITES_CHANGES_LOG_PRIORITY => esc_html__( 'Network Activity', 'mainwp' ), | |
| 1946 | + MainWP_Logger::UNHOOKS_LOG_PRIORITY => esc_html__( 'Unhooks Info', 'mainwp' ), | |
| 1947 | + MainWP_Logger::CACHE_METRICS_LOG_PRIORITY => esc_html__( 'Cache Metrics', 'mainwp' ), | |
| 1948 | + MainWP_Logger::DB_QUERIES_LOG_PRIORITY => esc_html__( 'DB Queries', 'mainwp' ), | |
| 1949 | + MainWP_Logger::WARM_CACHE_LOG_PRIORITY => esc_html__( 'Warm Cache', 'mainwp' ), | |
| 1950 | + MainWP_Logger::EXTENSION_UPDATES_CHECK_LOG_PRIORITY => esc_html__( 'Extension Updates Check', 'mainwp' ), | |
| 1951 | + MainWP_Logger::AUTO_UPDATES_LOG_PRIORITY => esc_html__( 'Auto Updates', 'mainwp' ), | |
| 1646 | 1952 | ); |
| 1647 | 1953 | $specific_logs = apply_filters( 'mainwp_specific_action_logs', $specific_default ); // deprecated since 4.3.1, use 'mainwp_log_specific_actions' instead. |
| 1648 | 1954 | $specific_logs = apply_filters( 'mainwp_log_specific_actions', $specific_logs ); |
| 1649 | 1955 | |
| 1650 | 1956 | ?> |
| 1651 | - <div class="mainwp-sub-header"> | |
| 1957 | + <div class="mainwp-actions-bar"> | |
| 1652 | 1958 | <div class="ui mini form two column stackable grid"> |
| 1653 | 1959 | <div class="column"> |
| 1654 | 1960 | <form method="POST" action=""> |
| 1655 | - <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?> | |
| 1961 | + <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?> | |
| 1656 | 1962 | <?php // phpcs:disable WordPress.Security.EscapeOutput ?> |
| 1657 | 1963 | <select name="actionlogs_status" class="ui mini dropdown"> |
| 1658 | 1964 | <option value="<?php echo MainWP_Logger::DISABLED; ?>" <?php echo MainWP_Logger::DISABLED === $enabled ? 'selected' : ''; ?>> |
| 1659 | 1965 | <?php esc_html_e( 'Disabled', 'mainwp' ); ?> |
| @@ -1669,8 +1975,9 @@ | ||
| 1669 | 1975 | </option> |
| 1670 | 1976 | <?php |
| 1671 | 1977 | // phpcs:enable |
| 1672 | 1978 | if ( is_array( $specific_logs ) && ! empty( $specific_logs ) ) { |
| 1979 | + asort( $specific_logs ); | |
| 1673 | 1980 | foreach ( $specific_logs as $spec_log => $spec_title ) { |
| 1674 | 1981 | ?> |
| 1675 | 1982 | <option value="specific_<?php echo intval( $spec_log ); ?>" <?php echo (int) $spec_log === (int) $enabled ? 'selected' : ''; ?>> |
| 1676 | 1983 | <?php echo esc_html( $spec_title ); ?> |
| @@ -1688,19 +1995,20 @@ | ||
| 1688 | 1995 | |
| 1689 | 1996 | </div> |
| 1690 | 1997 | </div> |
| 1691 | 1998 | </div> |
| 1692 | - <div class="ui segment"> | |
| 1999 | + <div class="ui padded segment"> | |
| 1693 | 2000 | <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-action-logs-info-message' ) ) : ?> |
| 1694 | 2001 | <div class="ui info message"> |
| 1695 | 2002 | <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-action-logs-info-message"></i> |
| 1696 | - <div><?php echo esc_html__( 'Enable a specific logging system.', 'mainwp' ); ?></div> | |
| 2003 | + <div class="header"><?php echo esc_html__( 'Enable a specific logging system.', 'mainwp' ); ?></div> | |
| 1697 | 2004 | <p><?php echo esc_html__( 'Each specific log type changes only the type of information logged. It does not change the log view.', 'mainwp' ); ?></p> |
| 1698 | 2005 | <p><?php echo esc_html__( 'After disabling the Action Log, logs will still be visible. To remove records, click the Delete Logs button.', 'mainwp' ); ?></p> |
| 1699 | - <p><?php printf( esc_html__( 'For additional help, please review this %1$shelp document%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/action-logs/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?></p> | |
| 1700 | 2006 | </div> |
| 1701 | 2007 | <?php endif; ?> |
| 1702 | 2008 | <?php |
| 2009 | + static::pre_load_logs_page(); | |
| 2010 | + | |
| 1703 | 2011 | $log_to_db = apply_filters( 'mainwp_logger_to_db', true ); |
| 1704 | 2012 | if ( $log_to_db ) { |
| 1705 | 2013 | return MainWP_Logger::instance()->show_log_db(); |
| 1706 | 2014 | } else { |
| @@ -1712,8 +2020,20 @@ | ||
| 1712 | 2020 | static::render_footer( 'ActionLogs' ); |
| 1713 | 2021 | } |
| 1714 | 2022 | |
| 1715 | 2023 | /** |
| 2024 | + * Method pre_load_logs_page(). | |
| 2025 | + * | |
| 2026 | + * @return void | |
| 2027 | + */ | |
| 2028 | + public static function pre_load_logs_page() { | |
| 2029 | + if ( MainWP_Logger::instance()->enabled_log_priority( MainWP_Logger::SITES_CHANGES_LOG_PRIORITY ) ) { | |
| 2030 | + $stats = Log_DB_Helper::instance()->get_logs_db_stats(); | |
| 2031 | + MainWP_Logger::instance()->log_events( 'sites-changes', 'DB Info :: ' . print_r( $stats, true ) ); //phpcs:ignore --ok. | |
| 2032 | + } | |
| 2033 | + } | |
| 2034 | + | |
| 2035 | + /** | |
| 1716 | 2036 | * Renders the Plugin Privacy page. |
| 1717 | 2037 | * |
| 1718 | 2038 | * @return void |
| 1719 | 2039 | */ |
| @@ -1728,61 +2048,60 @@ | ||
| 1728 | 2048 | * @since 4.2 |
| 1729 | 2049 | */ |
| 1730 | 2050 | do_action( 'mainwp_before_plugin_privacy_section' ); |
| 1731 | 2051 | ?> |
| 1732 | - <div class="ui segment"> | |
| 1733 | - <div id="mainwp-plugin-privacy"> | |
| 1734 | - <h2 class="ui header"> | |
| 1735 | - <?php echo esc_html__( 'MainWP Dashboard Plugin Privacy Policy', 'mainwp' ); ?> | |
| 1736 | - <div class="sub header"><em><?php echo esc_html__( 'Last updated: April 14, 2022', 'mainwp' ); ?></em></div> | |
| 1737 | - </h2> | |
| 1738 | - <p><?php echo esc_html__( 'We value your privacy very highly. Please read this Privacy Policy carefully before using the MainWP Dashboard Plugin ("Plugin") operated by Sick Marketing, LLC d/b/a MainWP, a Limited Liability Company formed in Nevada, United States ("us","we","our") as this Privacy Policy contains important information regarding your privacy.', 'mainwp' ); ?></p> | |
| 1739 | - <p><?php echo esc_html__( 'Your access to and use of the Plugin is conditional upon your acceptance of and compliance with this Privacy Policy. This Privacy Policy applies to everyone accessing or using the Plugin.', 'mainwp' ); ?></p> | |
| 1740 | - <p><?php echo esc_html__( 'By accessing or using the Plugin, you agree to be bound by this Privacy Policy. If you disagree with any part of this Privacy Policy, then you do not have our permission to access or use the Plugin.', 'mainwp' ); ?></p> | |
| 1741 | - <h3 class="ui header"><?php echo esc_html__( 'What personal data we collect', 'mainwp' ); ?></h3> | |
| 1742 | - <p><?php echo esc_html__( 'We do not collect, store, nor process any personal data through this Plugin.', 'mainwp' ); ?></p> | |
| 1743 | - <h3 class="ui header"><?php echo esc_html__( 'Third-party extensions and integrations', 'mainwp' ); ?></h3> | |
| 1744 | - <p><?php echo esc_html__( 'This Plugin may be used with extensions that are operated by parties other than us. We may also provide extensions that have integrations with third party services. We do not control such extensions and integrations and are not responsible for their contents or the privacy or other practices of such extensions or integrations. Further, it is up to you to take precautions to ensure that whatever extensions or integrations you use adequately protect your privacy. Please review the Privacy Policies of such extensions or integrations before using them.', 'mainwp' ); ?></p> | |
| 2052 | + <div class="ui padded segment"> | |
| 2053 | + <div id="mainwp-plugin-privacy"> | |
| 2054 | + <h2 class="ui header"> | |
| 2055 | + <?php echo esc_html__( 'MainWP Dashboard Plugin Privacy Policy', 'mainwp' ); ?> | |
| 2056 | + <div class="sub header"><em><?php echo esc_html__( 'Last updated: April 14, 2022', 'mainwp' ); ?></em></div> | |
| 2057 | + </h2> | |
| 2058 | + <p><?php echo esc_html__( 'We value your privacy very highly. Please read this Privacy Policy carefully before using the MainWP Dashboard Plugin ("Plugin") operated by Sick Marketing, LLC d/b/a MainWP, a Limited Liability Company formed in Nevada, United States ("us","we","our") as this Privacy Policy contains important information regarding your privacy.', 'mainwp' ); ?></p> | |
| 2059 | + <p><?php echo esc_html__( 'Your access to and use of the Plugin is conditional upon your acceptance of and compliance with this Privacy Policy. This Privacy Policy applies to everyone accessing or using the Plugin.', 'mainwp' ); ?></p> | |
| 2060 | + <p><?php echo esc_html__( 'By accessing or using the Plugin, you agree to be bound by this Privacy Policy. If you disagree with any part of this Privacy Policy, then you do not have our permission to access or use the Plugin.', 'mainwp' ); ?></p> | |
| 2061 | + <h3 class="ui header"><?php echo esc_html__( 'What personal data we collect', 'mainwp' ); ?></h3> | |
| 2062 | + <p><?php echo esc_html__( 'We do not collect, store, nor process any personal data through this Plugin.', 'mainwp' ); ?></p> | |
| 2063 | + <h3 class="ui header"><?php echo esc_html__( 'Third-party extensions and integrations', 'mainwp' ); ?></h3> | |
| 2064 | + <p><?php echo esc_html__( 'This Plugin may be used with extensions that are operated by parties other than us. We may also provide extensions that have integrations with third party services. We do not control such extensions and integrations and are not responsible for their contents or the privacy or other practices of such extensions or integrations. Further, it is up to you to take precautions to ensure that whatever extensions or integrations you use adequately protect your privacy. Please review the Privacy Policies of such extensions or integrations before using them.', 'mainwp' ); ?></p> | |
| 2065 | + <div class="ui hidden divider"></div> | |
| 2066 | + <div class="ui two columns stackable grid"> | |
| 2067 | + <div class="column"> | |
| 2068 | + <h3 class="ui header"><?php echo esc_html__( 'Our contact information', 'mainwp' ); ?></h3> | |
| 2069 | + <p><?php echo esc_html__( 'If you have any questions regarding our privacy practices, please do not hesitate to contact us at the following:', 'mainwp' ); ?></p> | |
| 2070 | + <div class="ui list"> | |
| 2071 | + <div class="item"><?php echo esc_html__( 'Sick Marketing, LLC d/b/a MainWP', 'mainwp' ); ?></div> | |
| 2072 | + <div class="item"><?php echo esc_html__( '[email protected]', 'mainwp' ); ?></div> | |
| 2073 | + <div class="item"><?php echo esc_html__( '4730 S. Fort Apache Road', 'mainwp' ); ?></div> | |
| 2074 | + <div class="item"><?php echo esc_html__( 'Suite 300', 'mainwp' ); ?></div> | |
| 2075 | + <div class="item"><?php echo esc_html__( 'PO Box 27740', 'mainwp' ); ?></div> | |
| 2076 | + <div class="item"><?php echo esc_html__( 'Las Vegas, NV 89147-7947', 'mainwp' ); ?></div> | |
| 2077 | + <div class="item"><?php echo esc_html__( 'United States', 'mainwp' ); ?></div> | |
| 2078 | + </div> | |
| 2079 | + </div> | |
| 2080 | + <div class="column"> | |
| 2081 | + <h3 class="ui header"><?php echo esc_html__( 'Our representative\'s contact information', 'mainwp' ); ?></h3> | |
| 2082 | + <p><?php echo esc_html__( 'If you are a resident of the European Union or the European Economic Area, you may also contact our representative at the following:', 'mainwp' ); ?></p> | |
| 2083 | + <div class="item"><?php echo esc_html__( 'Ametros Ltd', 'mainwp' ); ?></div> | |
| 2084 | + <div class="item"><?php echo esc_html__( 'Unit 3D', 'mainwp' ); ?></div> | |
| 2085 | + <div class="item"><?php echo esc_html__( 'North Point House', 'mainwp' ); ?></div> | |
| 2086 | + <div class="item"><?php echo esc_html__( 'North Point Business Park', 'mainwp' ); ?></div> | |
| 2087 | + <div class="item"><?php echo esc_html__( 'New Mallow Road', 'mainwp' ); ?></div> | |
| 2088 | + <div class="item"><?php echo esc_html__( 'Cork', 'mainwp' ); ?></div> | |
| 2089 | + <div class="item"><?php echo esc_html__( 'Ireland', 'mainwp' ); ?></div> | |
| 1745 | 2090 | <div class="ui hidden divider"></div> |
| 1746 | - <div class="ui two columns stackable grid"> | |
| 1747 | - <div class="column"> | |
| 1748 | - <h3 class="ui header"><?php echo esc_html__( 'Our contact information', 'mainwp' ); ?></h3> | |
| 1749 | - <p><?php echo esc_html__( 'If you have any questions regarding our privacy practices, please do not hesitate to contact us at the following:', 'mainwp' ); ?></p> | |
| 1750 | - <div class="ui list"> | |
| 1751 | - <div class="item"><?php echo esc_html__( 'Sick Marketing, LLC d/b/a MainWP', 'mainwp' ); ?></div> | |
| 1752 | - <div class="item"><?php echo esc_html__( '[email protected]', 'mainwp' ); ?></div> | |
| 1753 | - <div class="item"><?php echo esc_html__( '4730 S. Fort Apache Road', 'mainwp' ); ?></div> | |
| 1754 | - <div class="item"><?php echo esc_html__( 'Suite 300', 'mainwp' ); ?></div> | |
| 1755 | - <div class="item"><?php echo esc_html__( 'PO Box 27740', 'mainwp' ); ?></div> | |
| 1756 | - <div class="item"><?php echo esc_html__( 'Las Vegas, NV 89126', 'mainwp' ); ?></div> | |
| 1757 | - <div class="item"><?php echo esc_html__( 'United States', 'mainwp' ); ?></div> | |
| 1758 | - </div> | |
| 1759 | - </div> | |
| 1760 | - <div class="column"> | |
| 1761 | - <h3 class="ui header"><?php echo esc_html__( 'Our representative\'s contact information', 'mainwp' ); ?></h3> | |
| 1762 | - <p><?php echo esc_html__( 'If you are a resident of the European Union or the European Economic Area, you may also contact our representative at the following:', 'mainwp' ); ?></p> | |
| 1763 | - <div class="item"><?php echo esc_html__( 'Ametros Ltd', 'mainwp' ); ?></div> | |
| 1764 | - <div class="item"><?php echo esc_html__( 'Unit 3D', 'mainwp' ); ?></div> | |
| 1765 | - <div class="item"><?php echo esc_html__( 'North Point House', 'mainwp' ); ?></div> | |
| 1766 | - <div class="item"><?php echo esc_html__( 'North Point Business Park', 'mainwp' ); ?></div> | |
| 1767 | - <div class="item"><?php echo esc_html__( 'New Mallow Road', 'mainwp' ); ?></div> | |
| 1768 | - <div class="item"><?php echo esc_html__( 'Cork', 'mainwp' ); ?></div> | |
| 1769 | - <div class="item"><?php echo esc_html__( 'Ireland', 'mainwp' ); ?></div> | |
| 1770 | - <div class="ui hidden divider"></div> | |
| 1771 | - <p><?php echo esc_html__( 'If you are a resident of the United Kingdom, you may contact our representative at the following:', 'mainwp' ); ?></p> | |
| 1772 | - <div class="item"><?php echo esc_html__( 'Ametros Group Ltd', 'mainwp' ); ?></div> | |
| 1773 | - <div class="item"><?php echo esc_html__( 'Lakeside Offices', 'mainwp' ); ?></div> | |
| 1774 | - <div class="item"><?php echo esc_html__( 'Thorn Business Park', 'mainwp' ); ?></div> | |
| 1775 | - <div class="item"><?php echo esc_html__( 'Hereford', 'mainwp' ); ?></div> | |
| 1776 | - <div class="item"><?php echo esc_html__( 'Herefordshire', 'mainwp' ); ?></div> | |
| 1777 | - <div class="item"><?php echo esc_html__( 'HR2 6JT', 'mainwp' ); ?></div> | |
| 1778 | - <div class="item"><?php echo esc_html__( 'England', 'mainwp' ); ?></div> | |
| 1779 | - </div> | |
| 1780 | - </div> | |
| 1781 | - <div class="ui divider"></div> | |
| 2091 | + <p><?php echo esc_html__( 'If you are a resident of the United Kingdom, you may contact our representative at the following:', 'mainwp' ); ?></p> | |
| 2092 | + <div class="item"><?php echo esc_html__( 'Ametros Group Ltd', 'mainwp' ); ?></div> | |
| 2093 | + <div class="item"><?php echo esc_html__( 'Lakeside Offices', 'mainwp' ); ?></div> | |
| 2094 | + <div class="item"><?php echo esc_html__( 'Thorn Business Park', 'mainwp' ); ?></div> | |
| 2095 | + <div class="item"><?php echo esc_html__( 'Hereford', 'mainwp' ); ?></div> | |
| 2096 | + <div class="item"><?php echo esc_html__( 'Herefordshire', 'mainwp' ); ?></div> | |
| 2097 | + <div class="item"><?php echo esc_html__( 'HR2 6JT', 'mainwp' ); ?></div> | |
| 2098 | + <div class="item"><?php echo esc_html__( 'England', 'mainwp' ); ?></div> | |
| 1782 | 2099 | </div> |
| 1783 | - | |
| 1784 | - <a href="<?php echo esc_url( get_site_url() ) . '/wp-content/plugins/mainwp/privacy-policy.txt'; ?>" class="ui green basic button" target="_blank"><?php echo esc_html__( 'Download MainWP Dashboard Privacy Policy', 'mainwp' ); ?></a> <a href="<?php echo esc_url( get_site_url() ) . '/wp-content/plugins/mainwp/mainwp-child-privacy-policy.txt'; ?>" class="ui green basic button" target="_blank"><?php echo esc_html__( 'Download MainWP Child Privacy Policy', 'mainwp' ); ?></a> | |
| 2100 | + </div> | |
| 2101 | + <div class="ui divider"></div> | |
| 2102 | + </div> | |
| 2103 | + <a href="<?php echo esc_url( get_site_url() ) . '/wp-content/plugins/mainwp/privacy-policy.txt'; ?>" class="ui green basic button" target="_blank"><?php echo esc_html__( 'Download MainWP Dashboard Privacy Policy', 'mainwp' ); ?></a> <a href="<?php echo esc_url( get_site_url() ) . '/wp-content/plugins/mainwp/mainwp-child-privacy-policy.txt'; ?>" class="ui green basic button" target="_blank"><?php echo esc_html__( 'Download MainWP Child Privacy Policy', 'mainwp' ); ?></a> | |
| 1785 | 2104 | </div> |
| 1786 | 2105 | |
| 1787 | 2106 | <?php |
| 1788 | 2107 | /** |
| @@ -1802,10 +2121,10 @@ | ||
| 1802 | 2121 | * |
| 1803 | 2122 | * @return void |
| 1804 | 2123 | */ |
| 1805 | 2124 | public static function render_htaccess() { |
| 1806 | - if ( ! mainwp_current_user_have_right( 'dashboard', 'see_server_information' ) ) { | |
| 1807 | - mainwp_do_not_have_permissions( '.htaccess', 'mainwp' ); | |
| 2125 | + if ( ! \mainwp_current_user_can( 'dashboard', 'see_server_information' ) ) { | |
| 2126 | + \mainwp_do_not_have_permissions( '.htaccess', 'mainwp' ); | |
| 1808 | 2127 | return; |
| 1809 | 2128 | } |
| 1810 | 2129 | static::render_header( '.htaccess' ); |
| 1811 | 2130 | /** |
| @@ -1869,34 +2188,210 @@ | ||
| 1869 | 2188 | * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::mainwp_options() |
| 1870 | 2189 | */ |
| 1871 | 2190 | public static function display_mainwp_options() { |
| 1872 | 2191 | $options = MainWP_Server_Information_Handler::mainwp_options(); |
| 2192 | + | |
| 2193 | + $enable_individual_uptime_monitoring = false; | |
| 2194 | + if ( get_option( 'mainwp_individual_uptime_monitoring_schedule_enabled' ) ) { | |
| 2195 | + $enable_individual_uptime_monitoring = true; | |
| 2196 | + } | |
| 2197 | + | |
| 1873 | 2198 | // phpcs:disable WordPress.Security.EscapeOutput |
| 1874 | 2199 | foreach ( $options as $option ) { |
| 1875 | - echo '<tr><td>' . $option['label'] . '</td><td>' . $option['value'] . '</td></tr>'; | |
| 2200 | + $addition_info = ''; | |
| 2201 | + if ( 'is_enable_automatic_check_uptime_monitoring' === $option['name'] && empty( $option['save_value'] ) && $enable_individual_uptime_monitoring ) { // global monitoring disabled. | |
| 2202 | + $addition_info = '<br><em>' . esc_html__( 'Individual uptime monitoring is running', 'mainwp' ) . '</em>'; | |
| 2203 | + } | |
| 2204 | + echo '<tr><td>' . $option['label'] . '</td><td>' . $option['value'] . $addition_info . '</td></tr>'; | |
| 1876 | 2205 | } |
| 1877 | 2206 | // phpcs:enable |
| 1878 | 2207 | } |
| 1879 | 2208 | |
| 1880 | 2209 | /** |
| 2210 | + * Render detected issues summary. | |
| 2211 | + * | |
| 2212 | + * @return void | |
| 2213 | + */ | |
| 2214 | + private static function render_detected_issues_summary() { | |
| 2215 | + $issues = MainWP_Server_Information_Handler::get_primary_issues(); | |
| 2216 | + | |
| 2217 | + if ( empty( $issues ) ) { | |
| 2218 | + ?> | |
| 2219 | + <div class="ui positive message mainwp-system-report-issues-message"> | |
| 2220 | + <div class="header"><?php esc_html_e( 'No high-priority issues detected', 'mainwp' ); ?></div> | |
| 2221 | + <p><?php esc_html_e( 'This summary only highlights the most common problems. Review the tables below for full context.', 'mainwp' ); ?></p> | |
| 2222 | + </div> | |
| 2223 | + <?php | |
| 2224 | + return; | |
| 2225 | + } | |
| 2226 | + | |
| 2227 | + $has_error = false; | |
| 2228 | + foreach ( $issues as $issue ) { | |
| 2229 | + if ( isset( $issue['severity'] ) && 'error' === $issue['severity'] ) { | |
| 2230 | + $has_error = true; | |
| 2231 | + break; | |
| 2232 | + } | |
| 2233 | + } | |
| 2234 | + ?> | |
| 2235 | + <div class="ui <?php echo $has_error ? 'negative' : 'warning'; ?> message mainwp-system-report-issues-message"> | |
| 2236 | + <div class="header"><?php esc_html_e( 'Detected Issues', 'mainwp' ); ?></div> | |
| 2237 | + <div class="ui list"> | |
| 2238 | + <?php foreach ( $issues as $issue ) : ?> | |
| 2239 | + <div class="item"> | |
| 2240 | + <div class="content"> | |
| 2241 | + <div style="display:flex;align-items:center;gap:0.5rem;flex-wrap:wrap;"> | |
| 2242 | + <?php echo static::get_report_status_html( isset( $issue['severity'] ) ? $issue['severity'] : '' ); // phpcs:ignore WordPress.Security.EscapeOutput ?> | |
| 2243 | + <?php if ( ! empty( $issue['anchor'] ) ) : ?> | |
| 2244 | + <a href="#<?php echo esc_attr( $issue['anchor'] ); ?>"><span style="font-weight:600;"><?php echo esc_html( $issue['title'] ); ?></span></a> | |
| 2245 | + <?php else : ?> | |
| 2246 | + <span style="font-weight:600;"><?php echo esc_html( $issue['title'] ); ?></span> | |
| 2247 | + <?php endif; ?> | |
| 2248 | + <?php if ( ! empty( $issue['detail_html'] ) ) : ?> | |
| 2249 | + <span><?php echo wp_kses_post( $issue['detail_html'] ); ?></span> | |
| 2250 | + <?php elseif ( ! empty( $issue['detail'] ) ) : ?> | |
| 2251 | + <span><?php echo esc_html( $issue['detail'] ); ?></span> | |
| 2252 | + <?php endif; ?> | |
| 2253 | + <?php if ( ! empty( $issue['kb_url'] ) ) : ?> | |
| 2254 | + <a href="<?php echo esc_url( $issue['kb_url'] ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Help document', 'mainwp' ); ?></a> | |
| 2255 | + <i class="external alternate icon"></i> | |
| 2256 | + <?php endif; ?> | |
| 2257 | + </div> | |
| 2258 | + </div> | |
| 2259 | + </div> | |
| 2260 | + <?php endforeach; ?> | |
| 2261 | + </div> | |
| 2262 | + </div> | |
| 2263 | + <?php | |
| 2264 | + } | |
| 2265 | + | |
| 2266 | + /** | |
| 2267 | + * Get export text attribute HTML. | |
| 2268 | + * | |
| 2269 | + * @param string $text English export text. | |
| 2270 | + * | |
| 2271 | + * @return string | |
| 2272 | + */ | |
| 2273 | + private static function get_export_text_attr( $text ) { | |
| 2274 | + return '' !== (string) $text ? ' data-export-text="' . esc_attr( $text ) . '"' : ''; | |
| 2275 | + } | |
| 2276 | + | |
| 2277 | + /** | |
| 2278 | + * Render generic report table. | |
| 2279 | + * | |
| 2280 | + * @param string $table_id Table id. | |
| 2281 | + * @param string $title Table title. | |
| 2282 | + * @param array $rows Table rows. | |
| 2283 | + * @param string $export_title English export title. | |
| 2284 | + * | |
| 2285 | + * @return void | |
| 2286 | + */ | |
| 2287 | + private static function render_report_section_table( $table_id, $title, $rows, $export_title = '' ) { | |
| 2288 | + if ( empty( $rows ) || ! is_array( $rows ) ) { | |
| 2289 | + return; | |
| 2290 | + } | |
| 2291 | + ?> | |
| 2292 | + <table id="<?php echo esc_attr( $table_id ); ?>" class="ui unstackable table mainwp-system-report-table mainwp-system-info-table"> | |
| 2293 | + <thead> | |
| 2294 | + <tr> | |
| 2295 | + <th scope="col" class="seven wide"<?php echo self::get_export_text_attr( $export_title ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php echo esc_html( $title ); ?></th> | |
| 2296 | + <th scope="col" class="seven wide"<?php echo self::get_export_text_attr( 'Detected Value' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Detected Value', 'mainwp' ); ?></th> | |
| 2297 | + <th scope="col" class="two wide right aligned"></th> | |
| 2298 | + </tr> | |
| 2299 | + </thead> | |
| 2300 | + <tbody> | |
| 2301 | + <?php foreach ( $rows as $row ) : ?> | |
| 2302 | + <?php static::render_report_row( $row ); ?> | |
| 2303 | + <?php endforeach; ?> | |
| 2304 | + </tbody> | |
| 2305 | + </table> | |
| 2306 | + <?php | |
| 2307 | + } | |
| 2308 | + | |
| 2309 | + /** | |
| 2310 | + * Render a generic report row. | |
| 2311 | + * | |
| 2312 | + * @param array $row Row data. | |
| 2313 | + * | |
| 2314 | + * @return void | |
| 2315 | + */ | |
| 2316 | + private static function render_report_row( $row ) { | |
| 2317 | + $visibility = isset( $row['visibility'] ) ? $row['visibility'] : 'community_safe'; | |
| 2318 | + $community_value = isset( $row['community_value'] ) ? $row['community_value'] : null; | |
| 2319 | + $export_label = isset( $row['export_label'] ) ? $row['export_label'] : ''; | |
| 2320 | + $row_classes = array(); | |
| 2321 | + | |
| 2322 | + if ( 'full_only' === $visibility ) { | |
| 2323 | + $row_classes[] = 'mwp-not-generate-row'; | |
| 2324 | + } | |
| 2325 | + | |
| 2326 | + $value_attr = ''; | |
| 2327 | + if ( 'community_masked' === $visibility && null !== $community_value ) { | |
| 2328 | + $value_attr = ' data-community-value="' . esc_attr( $community_value ) . '"'; | |
| 2329 | + } | |
| 2330 | + ?> | |
| 2331 | + <tr class="<?php echo esc_attr( implode( ' ', $row_classes ) ); ?>"> | |
| 2332 | + <td<?php echo self::get_export_text_attr( $export_label ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php echo esc_html( isset( $row['label'] ) ? $row['label'] : '' ); ?></td> | |
| 2333 | + <td<?php echo $value_attr; //phpcs:ignore -- escaped. ?>><?php echo esc_html( isset( $row['value'] ) ? $row['value'] : '' ); ?></td> | |
| 2334 | + <td class="right aligned"><?php echo static::get_report_status_html( isset( $row['status'] ) ? $row['status'] : '' ); // phpcs:ignore WordPress.Security.EscapeOutput ?></td> | |
| 2335 | + </tr> | |
| 2336 | + <?php | |
| 2337 | + } | |
| 2338 | + | |
| 2339 | + /** | |
| 2340 | + * Get report status html. | |
| 2341 | + * | |
| 2342 | + * @param string $status Status. | |
| 2343 | + * | |
| 2344 | + * @return string | |
| 2345 | + */ | |
| 2346 | + private static function get_report_status_html( $status ) { | |
| 2347 | + switch ( $status ) { | |
| 2348 | + case 'pass': | |
| 2349 | + return static::get_pass_html(); | |
| 2350 | + case 'error': | |
| 2351 | + return static::get_warning_html( static::ERROR ); | |
| 2352 | + case 'warning': | |
| 2353 | + return static::get_warning_html( static::WARNING ); | |
| 2354 | + default: | |
| 2355 | + return ''; | |
| 2356 | + } | |
| 2357 | + } | |
| 2358 | + | |
| 2359 | + /** | |
| 1881 | 2360 | * Renders PHP Warning HTML. |
| 1882 | 2361 | * |
| 1883 | - * @param int $errorType Global variable static::WARNING = 1. | |
| 2362 | + * @param int $errorType Global variable static::WARNING = 1. | |
| 2363 | + * @param bool $ech echo or return. | |
| 1884 | 2364 | * |
| 1885 | 2365 | * @return string PHP Warning html. |
| 1886 | 2366 | */ |
| 1887 | - private static function get_warning_html( $errorType = self::WARNING ) { | |
| 2367 | + private static function get_warning_html( $errorType = self::WARNING, $ech = false ) { | |
| 2368 | + $msg = ''; | |
| 1888 | 2369 | if ( static::WARNING === $errorType ) { |
| 1889 | - return '<i class="large yellow exclamation icon"></i><span style="display:none">' . esc_html__( 'Warning', 'mainwp' ) . '</span>'; | |
| 2370 | + $msg = '<i class="large yellow exclamation icon"></i><span style="display:none" data-export-text="Warning">' . esc_html__( 'Warning', 'mainwp' ) . '</span>'; | |
| 2371 | + } else { | |
| 2372 | + $msg = '<i class="large red times icon"></i><span style="display:none" data-export-text="Fail">' . esc_html__( 'Fail', 'mainwp' ) . '</span>'; | |
| 1890 | 2373 | } |
| 1891 | - return '<i class="large red times icon"></i><span style="display:none">' . esc_html__( 'Fail', 'mainwp' ) . '</span>'; | |
| 2374 | + | |
| 2375 | + if ( $ech ) { | |
| 2376 | + echo $msg; //phpcs:ignore -- escaped. | |
| 2377 | + } else { | |
| 2378 | + return $msg; | |
| 2379 | + } | |
| 1892 | 2380 | } |
| 1893 | 2381 | |
| 1894 | 2382 | /** |
| 1895 | 2383 | * Renders PHP Pass HTML. |
| 1896 | 2384 | * |
| 2385 | + * @param bool $ech echo or return. | |
| 2386 | + * | |
| 1897 | 2387 | * @return string PHP Pass html. |
| 1898 | 2388 | */ |
| 1899 | - private static function get_pass_html() { | |
| 1900 | - return '<i class="large green check icon"></i><span style="display:none">' . esc_html__( 'Pass', 'mainwp' ) . '</span>'; | |
| 2389 | + private static function get_pass_html( $ech = false ) { | |
| 2390 | + $msg = '<i class="large green check icon"></i><span style="display:none" data-export-text="Pass">' . esc_html__( 'Pass', 'mainwp' ) . '</span>'; | |
| 2391 | + if ( $ech ) { | |
| 2392 | + echo $msg; //phpcs:ignore -- escaped. | |
| 2393 | + } else { | |
| 2394 | + return $msg; | |
| 2395 | + } | |
| 1901 | 2396 | } |
| 1902 | 2397 | } |