PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.1
6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 5.2.2 5.3 All 153 releases
mainwp / pages / page-mainwp-server-information.php

page-mainwp-server-information.php in MainWP Dashboard: Self-hosted WordPress Management for Agencies 6.1, at pages/page-mainwp-server-information.php

2,221 lines 108.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * MainWP Info Page.
4 *
5 * @package MainWP/Dashboard
6 */
7
8 namespace MainWP\Dashboard;
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
18 // phpcs:disable Generic.Metrics.CyclomaticComplexity -- complexity.
19 /**
20 * Class MainWP_Server_Information
21 */
22 class MainWP_Server_Information { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR.
23
24 const WARNING = 1;
25 const ERROR = 2;
26
27 /**
28 * The Info page sub-pages.
29 *
30 * @static
31 * @var array Sub pages.
32 */
33 public static $subPages;
34
35 /**
36 * Get Class Name
37 *
38 * @return string __CLASS__
39 */
40 public static function get_class_name() {
41 return __CLASS__;
42 }
43
44 /**
45 * Method init_menu()
46 *
47 * Initiate Info subPage menu.
48 *
49 * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item()
50 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_apache_server_software()
51 */
52 public static function init_menu() { // phpcs:ignore -- NOSONAR - complex.
53
54 add_action( 'mainwp_pageheader_infor', array( static::get_class_name(), 'render_header' ) );
55 add_action( 'mainwp_pagefooter_infor', array( static::get_class_name(), 'render_footer' ) );
56
57 add_submenu_page(
58 'mainwp_tab',
59 __( 'Info', 'mainwp' ),
60 ' <span id="mainwp-ServerInformation">' . esc_html__( 'Info', 'mainwp' ) . '</span>',
61 'read',
62 'ServerInformation',
63 array(
64 static::get_class_name(),
65 'render',
66 )
67 );
68 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ServerInformationCron' ) ) {
69 add_submenu_page(
70 'mainwp_tab',
71 __( 'Cron Schedules', 'mainwp' ),
72 '<div class="mainwp-hidden">' . esc_html__( 'Cron Schedules', 'mainwp' ) . '</div>',
73 'read',
74 'ServerInformationCron',
75 array(
76 static::get_class_name(),
77 'render_cron',
78 )
79 );
80 }
81
82 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ErrorLog' ) ) {
83 add_submenu_page(
84 'mainwp_tab',
85 __( 'Error Log', 'mainwp' ),
86 '<div class="mainwp-hidden">' . esc_html__( 'Error Log', 'mainwp' ) . '</div>',
87 'read',
88 'ErrorLog',
89 array(
90 static::get_class_name(),
91 'render_error_log_page',
92 )
93 );
94 }
95 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'WPConfig' ) ) {
96 add_submenu_page(
97 'mainwp_tab',
98 __( 'WP-Config File', 'mainwp' ),
99 '<div class="mainwp-hidden">' . esc_html__( 'WP-Config File', 'mainwp' ) . '</div>',
100 'read',
101 'WPConfig',
102 array(
103 static::get_class_name(),
104 'render_wp_config',
105 )
106 );
107 }
108 if ( ! MainWP_Menu::is_disable_menu_item( 3, '.htaccess' ) && MainWP_Server_Information_Handler::is_apache_server_software() ) {
109 add_submenu_page(
110 'mainwp_tab',
111 __( '.htaccess File', 'mainwp' ),
112 '<div class="mainwp-hidden">' . esc_html__( '.htaccess File', 'mainwp' ) . '</div>',
113 'read',
114 '.htaccess',
115 array(
116 static::get_class_name(),
117 'render_htaccess',
118 )
119 );
120 }
121 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ActionLogs' ) ) {
122 add_submenu_page(
123 'mainwp_tab',
124 __( 'Custom Event Monitor', 'mainwp' ),
125 '<div class="mainwp-hidden">' . esc_html__( 'Custom Event Monitor', 'mainwp' ) . '</div>',
126 'read',
127 'ActionLogs',
128 array(
129 static::get_class_name(),
130 'render_action_logs',
131 )
132 );
133 }
134
135 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'PluginPrivacy' ) ) {
136 add_submenu_page(
137 'mainwp_tab',
138 __( 'Plugin Privacy', 'mainwp' ),
139 '<div class="mainwp-hidden">' . esc_html__( 'Plugin Privacy', 'mainwp' ) . '</div>',
140 'read',
141 'PluginPrivacy',
142 array(
143 static::get_class_name(),
144 'render_plugin_privacy_page',
145 )
146 );
147 }
148
149 /**
150 * Filter mainwp_getsubpages_server
151 *
152 * Filters subpages for the Info page.
153 *
154 * @since Unknown
155 */
156 $sub_pages = apply_filters_deprecated( 'mainwp-getsubpages-server', array( array() ), '4.0.7.2', 'mainwp_getsubpages_server' ); // NOSONAR - not IP.
157 static::$subPages = apply_filters( 'mainwp_getsubpages_server', $sub_pages );
158
159 if ( isset( static::$subPages ) && is_array( static::$subPages ) ) {
160 foreach ( static::$subPages as $subPage ) {
161 if ( ! isset( $subPage['slug'] ) ) {
162 continue;
163 }
164 if ( MainWP_Menu::is_disable_menu_item( 3, 'Server' . $subPage['slug'] ) ) {
165 continue;
166 }
167 add_submenu_page( 'mainwp_tab', $subPage['title'], '<div class="mainwp-hidden">' . $subPage['title'] . '</div>', 'read', 'Server' . $subPage['slug'], $subPage['callback'] );
168 }
169 }
170 }
171
172 /**
173 * Renders Sub Pages Menu.
174 *
175 * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item()
176 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_apache_server_software()
177 */
178 public static function init_subpages_menu() { // phpcs:ignore -- NOSONAR - complex.
179 ?>
180 <div id="menu-mainwp-ServerInformation" class="mainwp-submenu-wrapper">
181 <div class="wp-submenu sub-open">
182 <div class="mainwp_boxout">
183 <div class="mainwp_boxoutin"></div>
184 <a href="<?php echo esc_url( admin_url( 'admin.php?page=ServerInformation' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Server', 'mainwp' ); ?></a>
185 <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ServerInformationCron' ) ) { ?>
186 <a href="<?php echo esc_url( admin_url( 'admin.php?page=ServerInformationCron' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Cron Schedules', 'mainwp' ); ?></a>
187 <?php } ?>
188 <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ErrorLog' ) ) { ?>
189 <a href="<?php echo esc_url( admin_url( 'admin.php?page=ErrorLog' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Error Log', 'mainwp' ); ?></a>
190 <?php } ?>
191 <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'WPConfig' ) ) { ?>
192 <a href="<?php echo esc_url( admin_url( 'admin.php?page=WPConfig' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'WP-Config File', 'mainwp' ); ?></a>
193 <?php } ?>
194 <?php
195 if ( ! MainWP_Menu::is_disable_menu_item( 3, '.htaccess' ) && MainWP_Server_Information_Handler::is_apache_server_software() ) {
196 ?>
197 <a href="<?php echo esc_url( admin_url( 'admin.php?page=.htaccess' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( '.htaccess File', 'mainwp' ); ?></a>
198 <?php
199 }
200 ?>
201 <?php
202 if ( isset( static::$subPages ) && is_array( static::$subPages ) ) {
203 foreach ( static::$subPages as $subPage ) {
204 if ( ! isset( $subPage['menu_hidden'] ) || ( isset( $subPage['menu_hidden'] ) && true !== $subPage['menu_hidden'] ) ) {
205 if ( MainWP_Menu::is_disable_menu_item( 3, 'Server' . $subPage['slug'] ) ) {
206 continue;
207 }
208 ?>
209 <a href="<?php echo esc_url( admin_url( 'admin.php?page=Server' . $subPage['slug'] ) ); ?>" class="mainwp-submenu"><?php echo esc_html( $subPage['title'] ); ?></a>
210 <?php
211 }
212 }
213 }
214 ?>
215 </div>
216 </div>
217 </div>
218 <?php
219 }
220
221 /**
222 * Initiates Server Information left menu.
223 *
224 * @param array $subPages array of subpages.
225 *
226 * @uses \MainWP\Dashboard\MainWP_Menu::add_left_menu()
227 * @uses \MainWP\Dashboard\MainWP_Menu::init_subpages_left_menu()
228 * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item()
229 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_apache_server_software()
230 */
231 public static function init_left_menu( $subPages = array() ) {
232 MainWP_Menu::add_left_menu(
233 array(
234 'title' => esc_html__( 'Info', 'mainwp' ),
235 'parent_key' => 'mainwp_tab',
236 'slug' => 'ServerInformation',
237 'href' => 'admin.php?page=ServerInformation',
238 'icon' => '<i class="info circle icon"></i>',
239 ),
240 0
241 );
242
243 /**
244 * MainWP active menu slugs array.
245 *
246 * @global object
247 */
248 global $_mainwp_menu_active_slugs;
249
250 $_mainwp_menu_active_slugs['ActionLogs'] = 'ServerInformation';
251
252 $init_sub_subleftmenu = array(
253 array(
254 'title' => esc_html__( 'Server', 'mainwp' ),
255 'parent_key' => 'ServerInformation',
256 'href' => 'admin.php?page=ServerInformation',
257 'slug' => 'ServerInformation',
258 'right' => '',
259 ),
260 array(
261 'title' => esc_html__( 'Cron Schedules', 'mainwp' ),
262 'parent_key' => 'ServerInformation',
263 'href' => 'admin.php?page=ServerInformationCron',
264 'slug' => 'ServerInformationCron',
265 'right' => '',
266 ),
267 array(
268 'title' => esc_html__( 'Error Log', 'mainwp' ),
269 'parent_key' => 'ServerInformation',
270 'href' => 'admin.php?page=ErrorLog',
271 'slug' => 'ErrorLog',
272 'right' => '',
273 ),
274 array(
275 'title' => esc_html__( 'Custom Event Monitor', 'mainwp' ),
276 'parent_key' => 'ServerInformation',
277 'href' => 'admin.php?page=ActionLogs',
278 'slug' => 'ActionLogs',
279 'right' => '',
280 ),
281 array(
282 'title' => esc_html__( 'Plugin Privacy', 'mainwp' ),
283 'parent_key' => 'mainwp_tab',
284 'href' => 'admin.php?page=PluginPrivacy',
285 'slug' => 'PluginPrivacy',
286 'right' => '',
287 ),
288 );
289
290 MainWP_Menu::init_subpages_left_menu( $subPages, $init_sub_subleftmenu, 'ServerInformation', 'Server' );
291 foreach ( $init_sub_subleftmenu as $item ) {
292 if ( MainWP_Menu::is_disable_menu_item( 3, $item['slug'] ) ) {
293 continue;
294 }
295 MainWP_Menu::add_left_menu( $item, 2 );
296 }
297 }
298
299 /**
300 * Renders Info header.
301 *
302 * @param string $shownPage Current page.
303 *
304 * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item()
305 * @uses \MainWP\Dashboard\MainWP_UI::render_top_header()
306 * @uses \MainWP\Dashboard\MainWP_UI::render_page_navigation()
307 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_apache_server_software()
308 */
309 public static function render_header( $shownPage = '' ) {
310 $params = array(
311 'title' => esc_html__( 'Info', 'mainwp' ),
312 );
313
314 MainWP_UI::render_top_header( $params );
315
316 $renderItems = array();
317
318 $renderItems[] = array(
319 'title' => esc_html__( 'Server', 'mainwp' ),
320 'href' => 'admin.php?page=ServerInformation',
321 'active' => ( '' === $shownPage ) ? true : false,
322 );
323
324 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ServerInformationCron' ) ) {
325 $renderItems[] = array(
326 'title' => esc_html__( 'Cron Schedules', 'mainwp' ),
327 'href' => 'admin.php?page=ServerInformationCron',
328 'active' => ( 'ServerInformationCron' === $shownPage ) ? true : false,
329 );
330 }
331
332 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ErrorLog' ) ) {
333 $renderItems[] = array(
334 'title' => esc_html__( 'Error Log', 'mainwp' ),
335 'href' => 'admin.php?page=ErrorLog',
336 'active' => ( 'ErrorLog' === $shownPage ) ? true : false,
337 );
338 }
339
340 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ActionLogs' ) ) {
341 $renderItems[] = array(
342 'title' => esc_html__( 'Custom Event Monitor', 'mainwp' ),
343 'href' => 'admin.php?page=ActionLogs',
344 'active' => ( 'ActionLogs' === $shownPage ) ? true : false,
345 );
346 }
347
348 if ( isset( $_GET['page'] ) && 'PluginPrivacy' !== $_GET['page'] ) { //phpcs:ignore -- monce safe.
349 MainWP_UI::render_page_navigation( $renderItems );
350 }
351
352 static::render_actions_bar();
353
354 echo '<div>';
355 }
356
357 /**
358 * Renders Server Information footer.
359 */
360 public static function render_footer() {
361 echo '</div>';
362 }
363
364 /**
365 * Renders Server Information action bar element.
366 */
367 public static function render_actions_bar() {
368 if ( isset( $_GET['page'] ) && 'ServerInformation' === $_GET['page'] ) : // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
369 ?>
370 <div class="mainwp-actions-bar">
371 <div class="ui stackable middle aligned two column grid">
372 <div class="column">
373 <a href="#" class="ui mini green button" id="mainwp-download-system-report"><?php esc_html_e( 'Download Full System Report', 'mainwp' ); ?></a>
374 <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>
375 </div>
376 <div class="right aligned column">
377 <div class="ui icon input">
378 <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' ); ?>">
379 <i class="search icon"></i>
380 </div>
381 </div>
382 </div>
383 </div>
384 <?php
385 endif;
386 }
387
388 /**
389 * Renders Server Information page.
390 *
391 * @return void
392 *
393 * @uses \MainWP\Dashboard\MainWP_Extensions_View::get_available_extensions()
394 * @uses \MainWP\Dashboard\MainWP_Extensions_Handler::get_extensions()
395 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_mainwp_version()
396 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_current_version()
397 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_file_system_method()
398 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_php_allow_url_fopen()
399 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_php_exif()
400 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_php_iptc()
401 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_php_xml()
402 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_loaded_php_extensions()
403 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_sql_mode()
404 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_wp_root()
405 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_name()
406 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_software()
407 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_os()
408 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_architecture()
409 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_ip()
410 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_protocol()
411 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_http_host()
412 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_https()
413 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::server_self_connect()
414 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_user_agent()
415 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_port()
416 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_gateway_interface()
417 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::memory_usage()
418 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_complete_url()
419 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_request_time()
420 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_http_accept()
421 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_accept_charset()
422 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_script_file_name()
423 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_current_page_uri()
424 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_remote_address()
425 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_remote_host()
426 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_remote_port()
427 */
428 public static function render() {
429 if ( ! \mainwp_current_user_can( 'dashboard', 'see_server_information' ) ) {
430 \mainwp_do_not_have_permissions( 'server information', 'mainwp' );
431 return;
432 }
433 static::render_header( '' );
434
435 /**
436 * Action: mainwp_before_server_info_table
437 *
438 * Fires on the top of the Info page, before the Server Info table.
439 *
440 * @since 4.0
441 */
442 do_action( 'mainwp_before_server_info_table' );
443 ?>
444 <div id="mainwp-system-report-page" class="ui padded segment">
445 <?php
446 if ( function_exists( 'curl_version' ) && ! MainWP_Server_Information_Handler::curlssl_compare( 'OpenSSL/1.1.0', '>=' ) ) {
447 /* translators: 1: line break tag, 2: opening anchor tag, 3: closing anchor tag */
448 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>';
449 }
450 static::render_detected_issues_summary();
451 ?>
452 <style type="text/css">
453 #mainwp-system-report-page {
454 padding-top: 1rem !important;
455 }
456
457 #mainwp-system-report-page .mainwp-system-report-table {
458 table-layout: fixed;
459 width: 100%;
460 }
461
462 #mainwp-system-report-page .mainwp-system-report-issues-message {
463 margin: 0 0 1rem 0;
464 border-radius: var(--area-radius, 0.28571429rem) !important;
465 }
466
467 #mainwp-system-report-page .mainwp-system-info-table {
468 margin: 0 0 1rem 0 !important;
469 }
470
471 #mainwp-system-report-page .dt-container,
472 #mainwp-system-report-page .dataTables_wrapper {
473 margin: 0 0 1rem 0;
474 }
475
476 #mainwp-system-report-page .dt-container .mainwp-system-info-table,
477 #mainwp-system-report-page .dataTables_wrapper .mainwp-system-info-table {
478 margin-bottom: 0 !important;
479 }
480 </style>
481 <table id="mainwp-system-report-wordpress-table" class="ui unstackable table single line mainwp-system-report-table mainwp-system-info-table">
482 <thead>
483 <tr>
484 <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>
485 <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>
486 <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>
487 <th scope="col" class="four wide right aligned"></th>
488 </tr>
489 </thead>
490 <tbody>
491 <?php static::render_wordpress_check_tbody(); ?>
492 </tbody>
493 </table>
494
495 <table id="mainwp-system-report-php-table" class="ui unstackable table fixed mainwp-system-report-table mainwp-system-info-table">
496 <thead>
497 <tr>
498 <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>
499 <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>
500 <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>
501 <th scope="col" class="four wide right aligned"></th>
502 </tr>
503 </thead>
504 <tbody>
505 <?php static::render_php_check_tbody(); ?>
506 </tbody>
507 </table>
508
509 <table id="mainwp-system-report-mysql-table" class="ui unstackable table mainwp-system-report-table mainwp-system-info-table">
510 <thead>
511 <tr>
512 <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>
513 <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>
514 <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>
515 <th scope="col" class="four wide right aligned"></th>
516 </tr>
517 </thead>
518 <tbody>
519 <?php static::render_mysql_check_tbody(); ?>
520 </tbody>
521 </table>
522
523 <?php self::render_report_section_table( 'mainwp-system-report-connectivity-table', __( 'Connectivity & Authentication', 'mainwp' ), MainWP_Server_Information_Handler::get_connectivity_report_rows(), 'Connectivity & Authentication' ); ?>
524
525 <?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' ); ?>
526
527 <table id="mainwp-system-report-server-table" class="ui unstackable table mainwp-system-report-table mainwp-system-info-table">
528 <thead>
529 <tr>
530 <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>
531 <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>
532 </tr>
533 </thead>
534 <tbody>
535 <?php static::render_server_check_tbody(); ?>
536 </tbody>
537 </table>
538
539 <?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' ); ?>
540
541 <?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' ); ?>
542
543 <?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' ); ?>
544
545 <?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' ); ?>
546
547 <?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' ); ?>
548
549 <?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' ); ?>
550
551 <?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' ); ?>
552
553 <?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' ); ?>
554
555 <?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' ); ?>
556
557 <?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' ); ?>
558
559 <?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' ); ?>
560
561 <table id="mainwp-system-report-extensions-table" class="ui unstackable table single line mainwp-system-report-table mainwp-system-info-table">
562 <thead>
563 <tr>
564 <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>
565 <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>
566 <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>
567 <th scope="col" class="four wide right aligned"></th>
568 </tr>
569 </thead>
570 <tbody>
571 <?php static::render_extensions_license_check_tbody(); ?>
572 </tbody>
573 </table>
574
575 <table id="mainwp-system-report-plugins-table" class="ui single line table unstackable mainwp-system-report-table mainwp-system-info-table">
576 <thead>
577 <tr>
578 <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>
579 <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>
580 <th scope="col" class="four wide right aligned"></th>
581 </tr>
582 </thead>
583 <tbody>
584 <?php static::render_plugins_check_tbody(); ?>
585 </tbody>
586 </table>
587
588 <div id="download-server-information" style="opacity:0">
589 <textarea readonly="readonly" contenteditable="true" wrap="off"></textarea>
590 </div>
591
592 <script type="text/javascript">
593 let responsive = true;
594 if( jQuery( window ).width() > 1140 ) {
595 responsive = false;
596 }
597 jQuery( document ).ready( function() {
598 const mainwpSystemReportTables = [];
599 jQuery( '.mainwp-system-info-table:not(#mainwp-system-report-extensions-table)' ).each( function() {
600 mainwpSystemReportTables.push( jQuery( this ).DataTable( {
601 responsive: responsive,
602 colReorder: true,
603 paging: false,
604 info: false,
605 autoWidth: false,
606 dom: 't',
607 } ) );
608 } );
609 mainwpSystemReportTables.push( jQuery( '#mainwp-system-report-extensions-table' ).DataTable( {
610 responsive: responsive,
611 colReorder: true,
612 paging: false,
613 info: false,
614 autoWidth: false,
615 dom: 't',
616 "language": {
617 "emptyTable": "<?php esc_html_e( 'No installed extensions', 'mainwp' ); ?>"
618 },
619 } ) );
620
621 jQuery( '#mainwp-system-report-global-search' ).on( 'input', function() {
622 const searchValue = jQuery( this ).val();
623 mainwpSystemReportTables.forEach( function( table ) {
624 table.search( searchValue ).draw();
625 } );
626 } );
627 } );
628 </script>
629 </div>
630
631 <?php
632
633 /**
634 * Action: mainwp_after_server_info_table
635 *
636 * Fires on the bottom of the Info page, after the Server Info table.
637 *
638 * @since 4.0
639 */
640 do_action( 'mainwp_after_server_info_table' );
641
642 static::render_footer( '' );
643 }
644
645 /**
646 * Renders WordPress checks table body.
647 *
648 * @return void
649 */
650 public static function render_wordpress_check_tbody() {
651 static::render_row( 'WordPress Version', '>=', '6.2', 'get_wordpress_version', '', '', null, null, static::ERROR );
652 static::render_row( 'WordPress Memory Limit', '>=', '64M', 'get_wordpress_memory_limit', '', '', null );
653 static::render_row( 'MultiSite Disabled', '=', true, 'check_if_multisite', '', '', null );
654 ?>
655 <tr>
656 <td<?php echo self::get_export_text_attr( 'FileSystem Method' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'FileSystem Method', 'mainwp' ); ?></td>
657 <td><?php echo esc_html( '= direct' ); ?></td>
658 <td><?php echo MainWP_Server_Information_Handler::get_file_system_method(); // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
659 <td class="right aligned"><?php echo static::get_file_system_method_check(); // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
660 </tr>
661 <?php
662 }
663
664 /**
665 * Renders PHP checks table body.
666 *
667 * @return void
668 */
669 public static function render_php_check_tbody() {
670 static::render_row( 'PHP Version', '>=', '7.4', 'get_php_version', '', '', null, null, static::ERROR );
671 static::render_row( 'PHP Max Execution Time', '>=', '30', 'get_max_execution_time', 'seconds', '=', '0' );
672 static::render_row( 'PHP Max Input Time', '>=', '30', 'get_max_input_time', 'seconds', '=', '0' );
673 static::render_row( 'PHP Memory Limit', '>=', '256M', 'get_php_memory_limit', '', '', null, 'filesize' );
674 static::render_row( 'PCRE Backtracking Limit', '>=', '10000', 'get_output_buffer_size', '', '', null );
675 static::render_row( 'PHP Upload Max Filesize', '>=', '2M', 'get_upload_max_filesize', '', '', null, 'filesize' );
676 static::render_row( 'PHP Post Max Size', '>=', '2M', 'get_post_max_size', '', '', null, 'filesize' );
677 static::render_row( 'SSL Extension Enabled', '=', true, 'get_ssl_support', '', '', null );
678 static::render_row( 'SSL Warnings', '=', '', 'get_ssl_warning', 'empty', '', null );
679 static::render_row( 'cURL Extension Enabled', '=', true, 'get_curl_support', '', '', null, null, static::ERROR );
680 static::render_row( 'cURL Timeout', '>=', '300', 'get_curl_timeout', 'seconds', '=', '0' );
681 if ( function_exists( 'curl_version' ) ) {
682 $reuire_curl = '7.18.1';
683 if ( version_compare( MainWP_Server_Information_Handler::get_php_version(), '8.0.0' ) >= 0 ) {
684 $reuire_curl = '7.29.0';
685 }
686 static::render_row( 'cURL Version', '>=', $reuire_curl, 'get_curl_version', '', '', null );
687 $openssl_version = 'OpenSSL/1.1.0';
688 static::render_row(
689 'OpenSSL Version',
690 '>=',
691 $openssl_version,
692 'get_curl_ssl_version',
693 '',
694 '',
695 null,
696 'curlssl'
697 );
698
699 $wk = MainWP_Server_Information_Handler::get_openssl_working_status();
700 ?>
701 <tr>
702 <td>OpenSSL Working Status</td>
703 <td>Yes</td>
704 <td><?php echo $wk ? 'Yes' : 'No'; ?></td>
705 <td class="right aligned"><?php $wk ? static::get_pass_html( true ) : static::get_warning_html( self::WARNING, true ); ?></td>
706 </tr>
707 <?php
708
709 }
710 ?>
711 <tr>
712 <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>
713 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
714 <td><?php MainWP_Server_Information_Handler::get_php_allow_url_fopen(); ?></td>
715 <td></td>
716 </tr>
717 <tr>
718 <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>
719 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
720 <td><?php MainWP_Server_Information_Handler::get_php_exif(); ?></td>
721 <td></td>
722 </tr>
723 <tr>
724 <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>
725 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
726 <td><?php MainWP_Server_Information_Handler::get_php_iptc(); ?></td>
727 <td></td>
728 </tr>
729 <tr>
730 <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>
731 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
732 <td><?php MainWP_Server_Information_Handler::get_php_xml(); ?></td>
733 <td></td>
734 </tr>
735 <tr>
736 <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>
737 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
738 <td>
739 <?php
740 $tmpfile_enabled = MainWP_System_View::is_tmpfile_enable();
741 echo $tmpfile_enabled ? esc_html__( 'Enabled', 'mainwp' ) : esc_html__( 'Disabled', 'mainwp' );
742 ?>
743 </td>
744 <td class="right aligned"><?php $tmpfile_enabled ? static::get_pass_html( true ) : static::get_warning_html( self::WARNING, true ); ?></td>
745 </tr>
746 <tr>
747 <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>
748 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
749 <td>
750 <?php
751 $session_disable = MainWP_Cache::is_session_disable();
752 echo $session_disable ? esc_html__( 'Disabled', 'mainwp' ) : esc_html__( 'Enabled', 'mainwp' );
753 ?>
754 </td>
755 <td class="right aligned"><?php echo ! $session_disable ? static::get_pass_html() : static::get_warning_html(); //phpcs:ignore -- ok. ?></td>
756 </tr>
757 <tr>
758 <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>
759 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
760 <td><?php static::php_disabled_functions(); ?></td>
761 <td></td>
762 </tr>
763 <tr>
764 <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>
765 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
766 <td><?php MainWP_Server_Information_Handler::get_loaded_php_extensions(); ?></td>
767 <td></td>
768 </tr>
769 <?php
770 }
771
772 /**
773 * Renders MySQL checks table body.
774 *
775 * @return void
776 */
777 public static function render_mysql_check_tbody() {
778 static::render_row( 'MySQL Version', '>=', '5.0', 'get_mysql_version', '', '', null, null, static::ERROR );
779 ?>
780 <tr>
781 <td<?php echo self::get_export_text_attr( 'MySQL Mode' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'MySQL Mode', 'mainwp' ); ?></td>
782 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
783 <td><?php MainWP_Server_Information_Handler::get_sql_mode(); ?></td>
784 <td></td>
785 </tr>
786 <tr>
787 <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>
788 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
789 <td><?php echo defined( 'DB_CHARSET' ) ? esc_html( DB_CHARSET ) : ''; ?></td>
790 <td></td>
791 </tr>
792 <?php
793 }
794
795 /**
796 * Renders Server checks table body.
797 *
798 * @return void
799 */
800 public static function render_server_check_tbody() {
801 ?>
802 <tr class="mwp-not-generate-row">
803 <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>
804 <td><?php MainWP_Server_Information_Handler::get_wp_root(); ?></td>
805 </tr>
806 <tr class="mwp-not-generate-row">
807 <td<?php echo self::get_export_text_attr( 'Server Name' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Server Name', 'mainwp' ); ?></td>
808 <td><?php MainWP_Server_Information_Handler::get_server_name(); ?></td>
809 </tr>
810 <tr>
811 <td<?php echo self::get_export_text_attr( 'Server Software' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Server Software', 'mainwp' ); ?></td>
812 <td><?php MainWP_Server_Information_Handler::get_server_software(); ?></td>
813 </tr>
814 <tr>
815 <td<?php echo self::get_export_text_attr( 'Operating System' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Operating System', 'mainwp' ); ?></td>
816 <td><?php MainWP_Server_Information_Handler::get_os(); ?></td>
817 </tr>
818 <tr>
819 <td<?php echo self::get_export_text_attr( 'Architecture' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Architecture', 'mainwp' ); ?></td>
820 <td><?php MainWP_Server_Information_Handler::get_architecture(); ?></td>
821 </tr>
822 <tr class="mwp-not-generate-row">
823 <td<?php echo self::get_export_text_attr( 'Server IP' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Server IP', 'mainwp' ); ?></td>
824 <td><?php MainWP_Server_Information_Handler::get_server_ip(); ?></td>
825 </tr>
826 <tr>
827 <td<?php echo self::get_export_text_attr( 'Server Protocol' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Server Protocol', 'mainwp' ); ?></td>
828 <td><?php MainWP_Server_Information_Handler::get_server_protocol(); ?></td>
829 </tr>
830 <tr class="mwp-not-generate-row">
831 <td<?php echo self::get_export_text_attr( 'HTTP Host' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'HTTP Host', 'mainwp' ); ?></td>
832 <td><?php MainWP_Server_Information_Handler::get_http_host(); ?></td>
833 </tr>
834 <tr>
835 <td<?php echo self::get_export_text_attr( 'User Agent' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'User Agent', 'mainwp' ); ?></td>
836 <td><?php MainWP_Server_Information_Handler::get_user_agent(); ?></td>
837 </tr>
838 <tr class="mwp-not-generate-row">
839 <td<?php echo self::get_export_text_attr( 'Server Port' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Server Port', 'mainwp' ); ?></td>
840 <td><?php MainWP_Server_Information_Handler::get_server_port(); ?></td>
841 </tr>
842 <tr>
843 <td<?php echo self::get_export_text_attr( 'Gateway Interface' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Gateway Interface', 'mainwp' ); ?></td>
844 <td><?php MainWP_Server_Information_Handler::get_server_gateway_interface(); ?></td>
845 </tr>
846 <tr>
847 <td<?php echo self::get_export_text_attr( 'Memory Usage' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Memory Usage', 'mainwp' ); ?></td>
848 <td><?php MainWP_Server_Information_Handler::memory_usage(); ?></td>
849 </tr>
850 <tr class="mwp-not-generate-row">
851 <td<?php echo self::get_export_text_attr( 'Referrer URL' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Referrer URL', 'mainwp' ); ?></td>
852 <td><?php MainWP_Server_Information_Handler::get_complete_url(); ?></td>
853 </tr>
854 <tr>
855 <td<?php echo self::get_export_text_attr( 'Request Time' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Request Time', 'mainwp' ); ?></td>
856 <td><?php MainWP_Server_Information_Handler::get_server_request_time(); ?></td>
857 </tr>
858 <tr>
859 <td<?php echo self::get_export_text_attr( 'Accept Content' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Accept Content', 'mainwp' ); ?></td>
860 <td><?php MainWP_Server_Information_Handler::get_server_http_accept(); ?></td>
861 </tr>
862 <tr>
863 <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>
864 <td><?php MainWP_Server_Information_Handler::get_server_accept_charset(); ?></td>
865 </tr>
866 <tr class="mwp-not-generate-row">
867 <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>
868 <td><?php MainWP_Server_Information_Handler::get_script_file_name(); ?></td>
869 </tr>
870 <tr class="mwp-not-generate-row">
871 <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>
872 <td><?php MainWP_Server_Information_Handler::get_current_page_uri(); ?></td>
873 </tr>
874 <tr class="mwp-not-generate-row">
875 <td<?php echo self::get_export_text_attr( 'Remote Address' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Remote Address', 'mainwp' ); ?></td>
876 <td><?php MainWP_Server_Information_Handler::get_remote_address(); ?></td>
877 </tr>
878 <tr class="mwp-not-generate-row">
879 <td<?php echo self::get_export_text_attr( 'Remote Host' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Remote Host', 'mainwp' ); ?></td>
880 <td><?php MainWP_Server_Information_Handler::get_remote_host(); ?></td>
881 </tr>
882 <tr class="mwp-not-generate-row">
883 <td<?php echo self::get_export_text_attr( 'Remote Port' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>><?php esc_html_e( 'Remote Port', 'mainwp' ); ?></td>
884 <td><?php MainWP_Server_Information_Handler::get_remote_port(); ?></td>
885 </tr>
886 <?php
887 }
888
889 /**
890 * Renders MainWP Dashboard checks table body.
891 *
892 * @return void
893 */
894 public static function render_dashboard_check_tbody() {
895 ?>
896 <tr>
897 <td><?php esc_html_e( 'MainWP Dashboard Version', 'mainwp' ); ?></td>
898 <td><?php echo 'Latest: ' . MainWP_Server_Information_Handler::get_mainwp_version(); ?> | <?php echo 'Detected: ' . MainWP_Server_Information_Handler::get_current_version(); ?> <?php echo static::get_mainwp_version_check(); // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
899 </tr>
900 <?php
901 static::check_directory_mainwp_directory();
902 static::display_mainwp_options();
903 }
904
905 /**
906 * Renders extensions API License status table body.
907 *
908 * @return void
909 */
910 public static function render_extensions_license_check_tbody() {
911 $extensions = MainWP_Extensions_Handler::get_extensions();
912 $extensions_slugs = array();
913 if ( empty( $extensions ) ) {
914 return;
915 }
916 foreach ( $extensions as $extension ) {
917 $extensions_slugs[] = $extension['slug'];
918 ?>
919 <tr>
920 <td><?php echo esc_html( $extension['name'] ); ?></td>
921 <td><?php echo esc_html( $extension['version'] ); ?></td>
922 <?php
923 if ( isset( $extension['mainwp'] ) && $extension['mainwp'] ) {
924 ?>
925 <td><?php echo isset( $extension['activated_key'] ) && 'Activated' === $extension['activated_key'] ? esc_html__( 'Active', 'mainwp' ) : esc_html__( 'Inactive', 'mainwp' ); ?></td>
926 <td class="right aligned"><?php echo isset( $extension['activated_key'] ) && 'Activated' === $extension['activated_key'] ? static::get_pass_html() : static::get_warning_html( static::WARNING ); // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
927 <?php
928 } else {
929 ?>
930 <td></td>
931 <td></td>
932 <?php
933 }
934 ?>
935 </tr>
936 <?php
937 }
938 }
939
940 /**
941 * Renders plugins check table body.
942 *
943 * @return void
944 */
945 public static function render_plugins_check_tbody() {
946 $all_extensions = MainWP_Extensions_View::get_available_extensions();
947 $all_plugins = get_plugins();
948 foreach ( $all_plugins as $slug => $plugin ) {
949 if ( isset( $all_extensions[ dirname( $slug ) ] ) ) {
950 continue;
951 }
952 ?>
953 <tr>
954 <td><?php echo esc_html( $plugin['Name'] ); ?></td>
955 <td><?php echo esc_html( $plugin['Version'] ); ?></td>
956 <td class="right aligned"><?php echo is_plugin_active( $slug ) ? esc_html__( 'Active', 'mainwp' ) : esc_html__( 'Inactive', 'mainwp' ); ?></td>
957 </tr>
958 <?php
959 }
960 }
961
962 /**
963 * Renders MainWP system requirements check.
964 *
965 * @return void
966 */
967 public static function render_quick_setup_system_check() {
968 /**
969 * Action: mainwp_before_system_requirements_check
970 *
971 * Fires on the bottom of the System Requirements page, in Quick Setup Wizard.
972 *
973 * @since 4.1
974 */
975 do_action( 'mainwp_before_system_requirements_check' );
976 ?>
977 <table id="mainwp-quick-system-requirements-check" class="ui single line table">
978 <thead>
979 <tr>
980 <th scope="col" ><?php esc_html_e( 'Check', 'mainwp' ); ?></th>
981 <th scope="col" ><?php esc_html_e( 'Required Value', 'mainwp' ); ?></th>
982 <th scope="col" ><?php esc_html_e( 'Detected Value', 'mainwp' ); ?></th>
983 <th scope="col" class="collapsing"><?php esc_html_e( 'Status', 'mainwp' ); ?></th>
984 </tr>
985 </thead>
986 <tbody>
987 <?php
988 static::render_row_with_description( esc_html__( 'PHP Version', 'mainwp' ), '>=', '7.4', 'get_php_version', '', '', null );
989 static::render_row_with_description( esc_html__( 'SSL Extension Enabled', 'mainwp' ), '=', true, 'get_ssl_support', '', '', null );
990 static::render_row_with_description( esc_html__( 'cURL Extension Enabled', 'mainwp' ), '=', true, 'get_curl_support', '', '', null );
991
992 $ssl_version = MainWP_Server_Information_Handler::get_curl_ssl_version();
993 $openssl_version = 'OpenSSL/1.1.0';
994 if ( false !== strpos( $ssl_version, 'LibreSSL' ) ) {
995 $openssl_version = 'LibreSSL/2.5.0';
996 }
997
998 static::render_row_with_description(
999 'cURL SSL Version',
1000 '>=',
1001 $openssl_version,
1002 'get_curl_ssl_version',
1003 '',
1004 '',
1005 null,
1006 'curlssl'
1007 );
1008
1009 if ( ! MainWP_Server_Information_Handler::curlssl_compare( $openssl_version, '>=' ) ) {
1010 ?>
1011 <tr class='warning'>
1012 <td colspan='4'>
1013 <i class='attention icon'></i>
1014 <?php
1015 if ( false !== strpos( $ssl_version, 'LibreSSL' ) ) {
1016 /* translators: 1: line break tag, 2: opening anchor tag, 3: closing anchor tag */
1017 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>' );
1018 } else {
1019 /* translators: 1: line break tag, 2: opening anchor tag, 3: closing anchor tag */
1020 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>' );
1021 }
1022 ?>
1023 </td>
1024 </tr>
1025 <?php
1026 }
1027 static::render_row_with_description( esc_html__( 'MySQL Version', 'mainwp' ), '>=', '5.0', 'get_mysql_version', '', '', null );
1028 ?>
1029 </tbody>
1030 </table>
1031 <?php
1032 /**
1033 * Action: mainwp_after_system_requirements_check
1034 *
1035 * Fires on the bottom of the System Requirements page, in Quick Setup Wizard.
1036 *
1037 * @since 4.1
1038 */
1039 do_action( 'mainwp_after_system_requirements_check' );
1040 }
1041
1042 /**
1043 * Compares the detected MainWP Dashboard version agains the verion in WP.org.
1044 *
1045 * @return mixed Pass|static::get_warning_html().
1046 *
1047 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_mainwp_version()
1048 */
1049 public static function get_mainwp_version_check() {
1050 $current = get_option( 'mainwp_plugin_version' );
1051 $latest = MainWP_Server_Information_Handler::get_mainwp_version();
1052 if ( $current === $latest ) {
1053 return static::get_pass_html();
1054 } else {
1055 return static::get_warning_html();
1056 }
1057 }
1058
1059 /**
1060 * Renders the Cron Schedule page.
1061 *
1062 * @return void
1063 *
1064 * @uses \MainWP\Dashboard\MainWP_Utility::format_timestamp()
1065 * @uses \MainWP\Dashboard\MainWP_Utility::get_timestamp()
1066 */
1067 public static function render_cron() { // phpcs:ignore -- NOSONAR - complex.
1068 if ( ! \mainwp_current_user_can( 'dashboard', 'see_server_information' ) ) {
1069 \mainwp_do_not_have_permissions( 'cron schedules', 'mainwp' );
1070 return;
1071 }
1072
1073 static::render_header( 'ServerInformationCron' );
1074
1075 $local_timestamp = MainWP_Utility::get_timestamp();
1076
1077 $freq = (int) get_option( 'mainwp_frequencyDailyUpdate', 2 );
1078 if ( $freq <= 0 ) {
1079 $freq = 1;
1080 }
1081 $auto_update_text = static::get_schedule_auto_update_label( $freq );
1082
1083 $cron_jobs = array(
1084 'Check for available updates' => array( 'mainwp_updatescheck_start_last_timestamp', 'mainwp_cronupdatescheck_action', $auto_update_text ),
1085 'Check for reconnect sites' => array( 'mainwp_cron_last_stats', 'mainwp_cronreconnect_action', esc_html__( 'Once hourly', 'mainwp' ), 'hourly' ),
1086 'Ping childs sites' => array( 'mainwp_cron_last_ping', 'mainwp_cronpingchilds_action', esc_html__( 'Once daily', 'mainwp' ), 'daily' ),
1087 );
1088
1089 $cron_jobs['Child site uptime monitoring'] = array( 'mainwp_uptimecheck_auto_main_counter_lasttime_started', 'mainwp_cronuptimemonitoringcheck_action', esc_html__( 'Once every minute', 'mainwp' ), 'minutely' );
1090
1091 $disableHealthChecking = get_option( 'mainwp_disableSitesHealthMonitoring', 1 ); // disabled by default.
1092 if ( ! $disableHealthChecking ) {
1093 $cron_jobs['Site Health monitoring'] = array( 'mainwp_cron_checksiteshealth_last_timestamp', 'mainwp_cronsitehealthcheck_action', esc_html__( 'Once hourly', 'mainwp' ), 'hourly' );
1094 }
1095
1096 if ( get_option( 'mainwp_enableLegacyBackupFeature' ) ) {
1097 $cron_jobs['Start backups (Legacy)'] = array( 'mainwp_cron_last_backups', 'mainwp_cronbackups_action', esc_html__( 'Once hourly', 'mainwp' ), 'hourly' );
1098 $cron_jobs['Continue backups (Legacy)'] = array( 'mainwp_cron_last_backups_continue', 'mainwp_cronbackups_continue_action', esc_html__( 'Once every five minutes', 'mainwp' ), '5minutely' );
1099 }
1100
1101 $cron_jobs = apply_filters( 'mainwp_info_schedules_cron_listing', $cron_jobs );
1102
1103 /**
1104 * Action: mainwp_before_cron_jobs_table
1105 *
1106 * Renders on the top of the Cron Jobs page, before the Schedules table.
1107 *
1108 * @since 4.0
1109 */
1110 do_action( 'mainwp_before_cron_jobs_table' );
1111 ?>
1112 <div class="ui padded segment">
1113 <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-cron-info-message' ) ) : ?>
1114 <div class="ui info message">
1115 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-cron-info-message"></i>
1116 <?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>' ); ?>
1117 </div>
1118 <?php endif; ?>
1119 <table class="ui single line unstackable table" id="mainwp-cron-jobs-table">
1120 <thead>
1121 <tr>
1122 <th scope="col" ><?php esc_html_e( 'Cron Job', 'mainwp' ); ?></th>
1123 <th scope="col" ><?php esc_html_e( 'Hook', 'mainwp' ); ?></th>
1124 <th scope="col" ><?php esc_html_e( 'Schedule', 'mainwp' ); ?></th>
1125 <th scope="col" ><?php esc_html_e( 'Last Run', 'mainwp' ); ?></th>
1126 <th scope="col" ><?php esc_html_e( 'Next Run', 'mainwp' ); ?></th>
1127 </tr>
1128 </thead>
1129 <tbody>
1130 <?php
1131 $useWPCron = ( false === get_option( 'mainwp_wp_cron' ) ) || ( 1 === (int) get_option( 'mainwp_wp_cron' ) );
1132
1133 foreach ( $cron_jobs as $cron_job => $hook ) {
1134
1135 if ( is_array( $hook ) && isset( $hook['title'] ) && isset( $hook['action'] ) ) {
1136 $job_title = $hook['title'];
1137 $job_action = $hook['action'];
1138 $job_freq = isset( $hook['frequency'] ) ? $hook['frequency'] : '';
1139 $job_last_run = isset( $hook['last_run'] ) ? $hook['last_run'] : '';
1140 $job_next_run = isset( $hook['next_run'] ) ? $hook['next_run'] : '';
1141 } else {
1142
1143 $is_auto_update_job = false;
1144 $lasttime_run = 0;
1145 $next_run = 0;
1146
1147 if ( 'mainwp_updatescheck_start_last_timestamp' === $hook[0] ) {
1148 $update_time = MainWP_Settings::get_websites_automatic_update_time();
1149 $last_run = $update_time['last'];
1150 $next_run = $update_time['next'];
1151 $is_auto_update_job = true;
1152 } elseif ( false === get_option( $hook[0] ) ) {
1153 $last_run = esc_html__( 'Never', 'mainwp' );
1154 } else {
1155 $lasttime_run = get_option( $hook[0] );
1156 if ( $lasttime_run ) {
1157 if ( 'mainwp_uptimecheck_auto_main_counter_lasttime_started' === $hook[0] ) {
1158 $last_run = MainWP_Utility::format_timestamp( $lasttime_run );
1159 } else {
1160 $last_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $lasttime_run ) );
1161 }
1162 } else {
1163 $last_run = esc_html__( 'Never', 'mainwp' );
1164 }
1165 }
1166
1167 if ( $useWPCron && 'mainwp_updatescheck_start_last_timestamp' !== $hook[0] ) {
1168 $next_run = wp_next_scheduled( $hook[1] );
1169 if ( ! empty( $next_run ) ) {
1170 $next_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $next_run ) );
1171 }
1172 }
1173
1174 if ( empty( $next_run ) || ( ! $useWPCron && ! $is_auto_update_job && isset( $hook[3] ) ) ) {
1175 $nexttime_run = static::get_schedule_next_time_to_show( $hook[3], $lasttime_run, $local_timestamp );
1176 if ( $nexttime_run < $local_timestamp + 3 * MINUTE_IN_SECONDS ) {
1177 $next_run = esc_html__( 'Any minute', 'mainwp' );
1178 } else {
1179 $next_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $nexttime_run ) );
1180 }
1181 }
1182
1183 $job_title = $cron_job;
1184 $job_action = $hook[1];
1185 $job_freq = $hook[2];
1186 $job_last_run = $last_run;
1187 $job_next_run = $next_run;
1188 }
1189
1190 // phpcs:disable WordPress.Security.EscapeOutput
1191 ?>
1192 <tr>
1193 <td><?php echo esc_html( $job_title ); ?></td>
1194 <td><?php echo esc_html( $job_action ); ?></td>
1195 <td><?php echo esc_html( $job_freq ); ?></td>
1196 <td><?php echo esc_html( $job_last_run ); ?></td>
1197 <td><?php echo ! empty( $job_next_run ) ? esc_html( $job_next_run ) : ''; ?></td>
1198 </tr>
1199 <?php
1200 // phpcs:enable
1201 }
1202 /**
1203 * Action: mainwp_cron_jobs_list
1204 *
1205 * Renders as the last row of the Schedules table.
1206 *
1207 * @since 4.0
1208 */
1209 do_action( 'mainwp_cron_jobs_list' );
1210 ?>
1211 </tbody>
1212 </table>
1213 <?php
1214 $table_features = array(
1215 'searching' => 'true',
1216 'paging' => 'false',
1217 'info' => 'false',
1218 'responsive' => 'true',
1219 );
1220 /**
1221 * Filter: mainwp_cron_jobs_table_features
1222 *
1223 * Filters the Cron Schedules table features.
1224 *
1225 * @since 4.1
1226 */
1227 $table_features = apply_filters( 'mainwp_cron_jobs_table_features', $table_features );
1228 ?>
1229 <script type="text/javascript">
1230 jQuery( document ).ready( function() {
1231 let responsive = <?php echo esc_html( $table_features['responsive'] ); ?>;
1232 if( jQuery( window ).width() > 1140 ) {
1233 responsive = false;
1234 }
1235 jQuery( '#mainwp-cron-jobs-table' ).DataTable( {
1236 "searching": <?php echo esc_html( $table_features['searching'] ); ?>,
1237 "paging": <?php echo esc_html( $table_features['paging'] ); ?>,
1238 "info": <?php echo esc_html( $table_features['info'] ); ?>,
1239 "responsive": responsive,
1240 });
1241 } );
1242 </script>
1243 </div>
1244 <?php
1245
1246 /**
1247 * Action: mainwp_after_cron_jobs_table
1248 *
1249 * Renders on the bottom of the Cron Jobs page, after the Schedules table.
1250 *
1251 * @since 4.0
1252 */
1253 do_action( 'mainwp_after_cron_jobs_table' );
1254
1255 static::render_footer( 'ServerInformationCron' );
1256 }
1257
1258 /**
1259 * Get frequency auto update to show.
1260 *
1261 * @param int $freq frequency of auto update.
1262 *
1263 * @return string label of frequency.
1264 */
1265 public static function get_schedule_auto_update_label( $freq ) {
1266 $freq = intval( $freq );
1267 $text = '';
1268 switch ( $freq ) {
1269 case 1:
1270 $text = esc_html__( 'Once per day', 'mainwp' );
1271 break;
1272 case 2:
1273 $text = esc_html__( 'Twice per day', 'mainwp' );
1274 break;
1275 case 3:
1276 $text = esc_html__( 'Three times per day', 'mainwp' );
1277 break;
1278 case 4:
1279 $text = esc_html__( 'Four times per day', 'mainwp' );
1280 break;
1281 case 5:
1282 $text = esc_html__( 'Five times per day', 'mainwp' );
1283 break;
1284 case 6:
1285 $text = esc_html__( 'Six times per day', 'mainwp' );
1286 break;
1287 case 7:
1288 $text = esc_html__( 'Seven times per day', 'mainwp' );
1289 break;
1290 case 8:
1291 $text = esc_html__( 'Eight times per day', 'mainwp' );
1292 break;
1293 case 9:
1294 $text = esc_html__( 'Nine times per day', 'mainwp' );
1295 break;
1296 case 10:
1297 $text = esc_html__( 'Ten times per day', 'mainwp' );
1298 break;
1299 case 11:
1300 $text = esc_html__( 'Eleven times per day', 'mainwp' );
1301 break;
1302 case 12:
1303 $text = esc_html__( 'Twelve times per day', 'mainwp' );
1304 break;
1305 default:
1306 break;
1307 }
1308 return $text;
1309 }
1310
1311 /**
1312 * Get next time of schedule job to show.
1313 *
1314 * @param string $job_freq frequency of schedule job.
1315 * @param int $lasttime_run Lasttime to run.
1316 * @param int $local_timestamp current local time.
1317 *
1318 * @return int next run time of schedule job.
1319 */
1320 public static function get_schedule_next_time_to_show( $job_freq, $lasttime_run, $local_timestamp ) {
1321 $next_time = $local_timestamp;
1322 $lasttime_run = is_numeric( $lasttime_run ) ? intval( $lasttime_run ) : false;
1323 switch ( $job_freq ) {
1324 case 'daily':
1325 $next_time = $lasttime_run ? $lasttime_run + DAY_IN_SECONDS : $local_timestamp + DAY_IN_SECONDS;
1326 break;
1327 case 'hourly':
1328 $next_time = $lasttime_run ? $lasttime_run + HOUR_IN_SECONDS : $local_timestamp + HOUR_IN_SECONDS;
1329 break;
1330 case '5minutely':
1331 $next_time = $lasttime_run ? $lasttime_run + 5 * MINUTE_IN_SECONDS : $local_timestamp + 5 * MINUTE_IN_SECONDS;
1332 break;
1333 case 'minutely':
1334 $next_time = $lasttime_run ? $lasttime_run + MINUTE_IN_SECONDS : $local_timestamp + MINUTE_IN_SECONDS;
1335 break;
1336 default:
1337 break;
1338 }
1339
1340 if ( $next_time < $local_timestamp ) { // to fix next time in past.
1341 $next_time = $local_timestamp;
1342 }
1343
1344 return $next_time;
1345 }
1346
1347 /**
1348 * Checks if the ../wp-content/uploads/mainwp/ directory is writable.
1349 *
1350 * @return bool True if writable, false if not.
1351 *
1352 * @uses \MainWP\Dashboard\MainWP_System_Utility::get_mainwp_dir()
1353 * @uses \MainWP\Dashboard\MainWP_System_Utility::get_wp_file_system()
1354 */
1355 public static function check_directory_mainwp_directory() {
1356 $dirs = MainWP_System_Utility::get_mainwp_dir();
1357 $path = $dirs[0];
1358
1359 $mess = 'Writable';
1360
1361 if ( ! is_dir( dirname( $path ) ) ) {
1362 $mess = 'Not Found';
1363 }
1364
1365 $is_writable = MainWP_System_Utility::is_writable( $path );
1366
1367 if ( $is_writable ) {
1368 $mess = 'Not Writable';
1369 }
1370
1371 return '<tr><td>MainWP Upload Directory</td><td>' . $mess . '</td></tr>';
1372 }
1373
1374 /**
1375 * Renders the directory check row.
1376 *
1377 * @param string $name check name.
1378 * @param string $check desired result.
1379 * @param string $result detected result.
1380 * @param bool $passed true|false check result.
1381 *
1382 * @return bool true.
1383 */
1384 public static function render_directory_row( $name, $check, $result, $passed ) {
1385 // phpcs:disable WordPress.Security.EscapeOutput
1386 ?>
1387 <tr>
1388 <td><?php echo esc_html( $name ); ?></td>
1389 <td><?php echo esc_html( $check ); ?></td>
1390 <td><?php echo esc_html( $result ); ?></td>
1391 <td class="right aligned"><?php echo $passed ? static::get_pass_html() : static::get_warning_html( static::ERROR ); ?></td>
1392 </tr>
1393 <?php
1394 // phpcs:enable
1395 return true;
1396 }
1397
1398 /**
1399 * Renders server information table row.
1400 *
1401 * @param string $config configuraion check.
1402 * @param string $compare comparison operator.
1403 * @param mixed $version reqiored minium version number.
1404 * @param mixed $getter detected version number.
1405 * @param string $extraText additionl text.
1406 * @param null $extraCompare extra compare.
1407 * @param null $extraVersion extra version.
1408 * @param null $whatType comparison type.
1409 * @param int $errorType global variable static::WARNING = 1.
1410 *
1411 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::filesize_compare()
1412 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::curlssl_compare()
1413 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_class_name()
1414 */
1415 public static function render_row( $config, $compare, $version, $getter, $extraText = '', $extraCompare = null, $extraVersion = null, $whatType = null, $errorType = self::WARNING ) { //phpcs:ignore -- NOSONAR - complex.
1416 $currentVersion = call_user_func( array( MainWP_Server_Information_Handler::get_class_name(), $getter ) );
1417 // phpcs:disable WordPress.Security.EscapeOutput
1418 $ver = is_array( $version ) && isset( $version['version'] ) ? esc_html( $version['version'] ) : esc_html( $version );
1419 ?>
1420 <tr>
1421 <td><?php echo esc_html( $config ); ?></td>
1422 <td><?php echo esc_html( $compare ); ?><?php echo ( true === $version ? 'true' : $ver ) . ' ' . $extraText; ?></td>
1423 <td><?php echo true === $currentVersion ? 'true' : $currentVersion; ?></td>
1424 <?php if ( 'filesize' === $whatType ) { ?>
1425 <td class="right aligned"><?php echo MainWP_Server_Information_Handler::filesize_compare( $currentVersion, $version, $compare ) ? static::get_pass_html() : static::get_warning_html( $errorType ); ?></td>
1426 <?php } elseif ( 'get_curl_ssl_version' === $getter ) { ?>
1427 <td class="right aligned"><?php echo MainWP_Server_Information_Handler::curlssl_compare( $version, $compare ) ? static::get_pass_html() : static::get_warning_html( $errorType ); ?></td>
1428 <?php } elseif ( ( 'get_max_input_time' === $getter || 'get_max_execution_time' === $getter ) && -1 === (int) $currentVersion ) { ?>
1429 <td class="right aligned"><?php echo static::get_pass_html(); ?></td>
1430 <?php } else { ?>
1431 <td class="right aligned"><?php echo version_compare( $currentVersion, $version, $compare ) || ( ! empty( $extraCompare ) && version_compare( $currentVersion, $extraVersion, $extraCompare ) ) ? static::get_pass_html() : static::get_warning_html( $errorType ); ?></td>
1432 <?php } ?>
1433 </tr>
1434 <?php
1435 // phpcs:enable
1436 }
1437
1438 /**
1439 * Renders server information table row with description.
1440 *
1441 * @param string $config configuraion check.
1442 * @param string $compare comparison operator.
1443 * @param mixed $version reqiored minium version number.
1444 * @param mixed $getter detected version number.
1445 * @param string $extraText additionl text.
1446 * @param null $extraCompare extra compare.
1447 * @param null $extraVersion extra version.
1448 * @param null $whatType comparison type.
1449 * @param int $errorType global variable static::WARNING = 1.
1450 *
1451 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_class_name()
1452 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::filesize_compare()
1453 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::curlssl_compare()
1454 */
1455 public static function render_row_with_description( $config, $compare, $version, $getter, $extraText = '', $extraCompare = null, $extraVersion = null, $whatType = null, $errorType = self::WARNING ) { // phpcs:ignore -- NOSONAR - complex.
1456 $currentVersion = call_user_func( array( MainWP_Server_Information_Handler::get_class_name(), $getter ) );
1457 // phpcs:disable WordPress.Security.EscapeOutput
1458 $ver = is_array( $version ) && isset( $version['version'] ) ? esc_html( $version['version'] ) : esc_html( $version );
1459 ?>
1460 <tr>
1461 <td><?php echo esc_html( $config ); ?></td>
1462 <td><?php echo esc_html( $compare ); ?> <?php echo ( true === $version ? 'true' : $ver ) . ' ' . $extraText; ?></td>
1463 <td><?php echo true === $currentVersion ? 'true' : $currentVersion; ?></td>
1464 <?php if ( 'filesize' === $whatType ) { ?>
1465 <td class="right aligned"><?php echo MainWP_Server_Information_Handler::filesize_compare( $currentVersion, $version, $compare ) ? static::get_pass_html() : static::get_warning_html( $errorType ); ?></td>
1466 <?php } elseif ( 'get_curl_ssl_version' === $getter ) { ?>
1467 <td class="right aligned"><?php echo MainWP_Server_Information_Handler::curlssl_compare( $version, $compare ) ? static::get_pass_html() : static::get_warning_html( $errorType ); ?></td>
1468 <?php } elseif ( 'get_max_input_time' === $getter && -1 === (int) $currentVersion ) { ?>
1469 <td class="right aligned"><?php echo static::get_pass_html(); ?></td>
1470 <?php } else { ?>
1471 <td class="right aligned"><?php echo version_compare( $currentVersion, $version, $compare ) || ( ! empty( $extraCompare ) && version_compare( $currentVersion, $extraVersion, $extraCompare ) ) ? static::get_pass_html() : static::get_warning_html( $errorType ); ?></td>
1472 <?php } ?>
1473 </tr>
1474 <?php
1475 // phpcs:enable
1476 }
1477
1478 /**
1479 * Checks if file system method is direct.
1480 *
1481 * @return mixed html|static::get_warning_html().
1482 *
1483 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_file_system_method()
1484 */
1485 public static function get_file_system_method_check() {
1486 $fsmethod = MainWP_Server_Information_Handler::get_file_system_method();
1487 if ( 'direct' === $fsmethod ) {
1488 return static::get_pass_html();
1489 } else {
1490 return static::get_warning_html();
1491 }
1492 }
1493
1494 /**
1495 * Renders Error Log page.
1496 *
1497 * Plugin-Name: Error Log Dashboard Widget
1498 * Plugin URI: http://wordpress.org/extend/plugins/error-log-dashboard-widget/
1499 * Description: Robust zero-configuration and low-memory way to keep an eye on error log.
1500 * Author: Andrey "Rarst" Savchenko
1501 * Author URI: http://www.rarst.net/
1502 * Version: 1.0.2
1503 * License: GPLv2 or later
1504
1505 * Includes last_lines() function by phant0m, licensed under cc-wiki and GPLv2+
1506 */
1507 public static function render_error_log_page() {
1508 if ( ! \mainwp_current_user_can( 'dashboard', 'see_server_information' ) ) {
1509 \mainwp_do_not_have_permissions( 'error log', 'mainwp' );
1510 return;
1511 }
1512 static::render_header( 'ErrorLog' );
1513
1514 /**
1515 * Action: mainwp_before_error_log_table
1516 *
1517 * Fires before the Error Log table.
1518 *
1519 * @since 4.1
1520 */
1521 do_action( 'mainwp_before_error_log_table' );
1522 ?>
1523 <div class="ui padded segment">
1524 <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-error-log-info-message' ) ) : ?>
1525 <div class="ui info message">
1526 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-error-log-info-message"></i>
1527 <?php echo esc_html__( 'See the WordPress error log to fix problems that arise on your MainWP Dashboard site.', 'mainwp' ); ?>
1528 </div>
1529 <?php endif; ?>
1530 <table class="ui unstackable table" id="mainwp-error-log-table">
1531 <thead>
1532 <tr>
1533 <th scope="col" ><?php esc_html_e( 'Time', 'mainwp' ); ?></th>
1534 <th scope="col" ><?php esc_html_e( 'Error', 'mainwp' ); ?></th>
1535 </tr>
1536 </thead>
1537 <tbody>
1538 <?php static::render_error_log(); ?>
1539 </tbody>
1540 </table>
1541 <script type="text/javascript">
1542 let responsive = true;
1543 if( jQuery( window ).width() > 1140 ) {
1544 responsive = false;
1545 }
1546
1547 jQuery( document ).ready( function() {
1548 jQuery( '#mainwp-error-log-table' ).DataTable( {
1549 "responsive": responsive,
1550 "ordering": false,
1551 "stateSave": true,
1552 "stateDuration": 0,
1553 "lengthMenu": [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] ],
1554 "language": {
1555 "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>' ); ?>'
1556 },
1557 columnDefs: [{
1558 "defaultContent": "-",
1559 "targets": "_all"
1560 }]
1561 } );
1562 } );
1563 </script>
1564 </div>
1565 <?php
1566 /**
1567 * Action: mainwp_after_error_log_table
1568 *
1569 * Fires after the Error Log table.
1570 *
1571 * @since 4.1
1572 */
1573 do_action( 'mainwp_after_error_log_table' );
1574
1575 static::render_footer( 'ErrorLog' );
1576 }
1577
1578 /**
1579 * Renders error log page.
1580 *
1581 * @return void
1582 *
1583 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::last_lines()
1584 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_class_name()
1585 */
1586 public static function render_error_log() {
1587 $log_errors = ini_get( 'log_errors' );
1588 if ( ! $log_errors ) {
1589 return;
1590 }
1591
1592 $error_log = ini_get( 'error_log' );
1593 /**
1594 * Filter: error_log_mainwp_logs
1595 *
1596 * Filters the error log files to show.
1597 *
1598 * @since Unknown
1599 */
1600 $logs = apply_filters( 'error_log_mainwp_logs', array( $error_log ) );
1601
1602 /**
1603 * Filter: error_log_mainwp_lines
1604 *
1605 * Limits the number of error log records to be displayed. Default value, 50.
1606 *
1607 * @since Unknown
1608 */
1609 $count = apply_filters( 'error_log_mainwp_lines', 100 );
1610 $lines = array();
1611
1612 foreach ( $logs as $log ) {
1613 if ( is_readable( $log ) ) {
1614 $lines = array_merge( $lines, MainWP_Server_Information_Handler::last_lines( $log, $count ) );
1615 }
1616 }
1617
1618 $lines = array_map( 'trim', $lines );
1619 $lines = array_filter( $lines );
1620
1621 if ( empty( $lines ) ) {
1622 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>';
1623 return;
1624 }
1625
1626 foreach ( $lines as $key => $line ) {
1627 if ( false !== strpos( $line, ']' ) ) {
1628 list( $time, $error ) = explode( ']', $line, 2 );
1629 } else {
1630 list( $time, $error ) = array( '', $line );
1631 }
1632 $time = trim( $time, '[]' );
1633 $error = trim( $error );
1634 $lines[ $key ] = compact( 'time', 'error' );
1635 }
1636
1637 if ( 1 < count( $lines ) ) {
1638 // phpcs:ignore -- ok.
1639 //uasort( $lines, array( MainWP_Server_Information_Handler::get_class_name(), 'time_compare' ) );
1640 $lines = array_slice( $lines, 0, $count );
1641 }
1642
1643 // phpcs:disable WordPress.Security.EscapeOutput
1644 foreach ( $lines as $line ) {
1645 $error = esc_html( $line['error'] );
1646 $time = esc_html( $line['time'] );
1647 if ( ! empty( $error ) ) {
1648 echo '<tr><td>' . $time . '</td><td>' . $error . '</td></tr>';
1649 }
1650 }
1651 // phpcs:enable
1652 }
1653
1654 /**
1655 * Renders the WP Config page.
1656 *
1657 * @return void
1658 */
1659 public static function render_wp_config() {
1660 if ( ! \mainwp_current_user_can( 'dashboard', 'see_server_information' ) ) {
1661 \mainwp_do_not_have_permissions( 'WP-Config.php', 'mainwp' );
1662 return;
1663 }
1664
1665 static::render_header( 'WPConfig' );
1666 /**
1667 * Action: mainwp_before_wp_config_section
1668 *
1669 * Fires before the WP Config section.
1670 *
1671 * @since 4.1
1672 */
1673 do_action( 'mainwp_before_wp_config_section' );
1674 ?>
1675 <div id="mainwp-show-wp-config">
1676 <?php
1677 if ( false !== strpos( ini_get( 'disable_functions' ), 'show_source' ) ) {
1678 esc_html_e( 'File content could not be displayed.', 'mainwp' );
1679 echo '<br />';
1680 esc_html_e( 'It appears that the show_source() PHP function has been disabled on the servre.', 'mainwp' );
1681 echo '<br />';
1682 esc_html_e( 'Please, contact your host support and have them enable the show_source() function for the proper functioning of this feature.', 'mainwp' );
1683 } elseif ( file_exists( ABSPATH . 'wp-config.php' ) ) {
1684 show_source( ABSPATH . 'wp-config.php' );
1685 } else {
1686 $files = get_included_files();
1687 $configFound = false;
1688 if ( is_array( $files ) ) {
1689 foreach ( $files as $file ) {
1690 if ( stristr( $file, 'wp-config.php' ) ) {
1691 $configFound = true;
1692 show_source( $file );
1693 break;
1694 }
1695 }
1696 }
1697 if ( ! $configFound ) {
1698 esc_html_e( 'wp-config.php not found', 'mainwp' );
1699 }
1700 }
1701 ?>
1702 </div>
1703 <?php
1704 /**
1705 * Action: mainwp_after_wp_config_section
1706 *
1707 * Fires after the WP Config section.
1708 *
1709 * @since 4.1
1710 */
1711 do_action( 'mainwp_after_wp_config_section' );
1712
1713 static::render_footer( 'WPConfig' );
1714 }
1715
1716 /**
1717 * Renders action logs page.
1718 *
1719 * @uses \MainWP\Dashboard\MainWP_Logger
1720 * @uses \MainWP\Dashboard\MainWP_Logger::clear_log()
1721 * @uses \MainWP\Dashboard\MainWP_Utility::update_option()
1722 */
1723 public static function render_action_logs() { // phpcs:ignore -- NOSONAR -Current complexity is the only way to achieve desired results, pull request solutions appreciated.
1724 static::render_header( 'ActionLogs' );
1725
1726 if ( isset( $_REQUEST['actionlogs_status'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1727 $act_log = isset( $_REQUEST['actionlogs_status'] ) ? wp_unslash( $_REQUEST['actionlogs_status'] ) : MainWP_Logger::DISABLED; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1728 $spec_log = 0;
1729 if ( is_string( $act_log ) && false !== strpos( $act_log, 'specific_' ) ) {
1730 $act_log = str_replace( 'specific_', '', $act_log );
1731 $spec_log = 1;
1732 }
1733
1734 $act_log = intval( $act_log );
1735
1736 MainWP_Utility::update_option( 'mainwp_specific_logs', $spec_log );
1737
1738 MainWP_Logger::instance()->log_action( 'Action logs set to: ' . MainWP_Logger::instance()->get_log_text( $act_log ), ( $spec_log ? $act_log : MainWP_Logger::LOG ), 2, true );
1739
1740 if ( MainWP_Logger::DISABLED === $act_log ) {
1741 MainWP_Logger::instance()->set_log_priority( $act_log, $spec_log );
1742 }
1743
1744 MainWP_Utility::update_option( 'mainwp_actionlogs', $act_log );
1745 MainWP_Utility::update_option( 'mainwp_actionlogs_enabled_timestamp', time() );
1746 }
1747
1748 if ( isset( $_REQUEST['actionlogs_clear'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1749 $log_to_db = apply_filters( 'mainwp_logger_to_db', true );
1750 if ( $log_to_db ) {
1751 MainWP_Logger::instance()->clear_log_db();
1752 } else {
1753 MainWP_Logger::instance()->clear_log();
1754 }
1755 }
1756
1757 $enabled = (int) MainWP_Logger::instance()->get_log_status();
1758 $specific_default = array(
1759 MainWP_Logger::UPDATE_CHECK_LOG_PRIORITY => esc_html__( 'Update Checking', 'mainwp' ),
1760 MainWP_Logger::UPTIME_CHECK_LOG_PRIORITY => esc_html__( 'Uptime monitoring', 'mainwp' ),
1761 MainWP_Logger::UPTIME_NOTICE_LOG_PRIORITY => esc_html__( 'Uptime notification', 'mainwp' ),
1762 MainWP_Logger::LOGS_REGULAR_SCHEDULE => esc_html__( 'Regular Schedule', 'mainwp' ),
1763 MainWP_Logger::DEBUG_UPDATES_SCHEDULE => esc_html__( 'Debug updates crons', 'mainwp' ),
1764 MainWP_Logger::EXECUTION_TIME_LOG_PRIORITY => esc_html__( 'Execution time', 'mainwp' ),
1765 MainWP_Logger::EXECUTION_SYNC_LOG_PRIORITY => esc_html__( 'Execution Sync', 'mainwp' ),
1766 MainWP_Logger::EXECUTION_SYNC_DETAILS_LOG_PRIORITY => esc_html__( 'Execution Sync Details', 'mainwp' ),
1767 MainWP_Logger::LOGS_AUTO_PURGE_LOG_PRIORITY => esc_html__( 'Auto Archive Network Activity', 'mainwp' ),
1768 MainWP_Logger::CONNECT_LOG_PRIORITY => esc_html__( 'Dashboard Connect', 'mainwp' ),
1769 MainWP_Logger::SITES_CHANGES_LOG_PRIORITY => esc_html__( 'Network Activity', 'mainwp' ),
1770 MainWP_Logger::UNHOOKS_LOG_PRIORITY => esc_html__( 'Unhooks Info', 'mainwp' ),
1771 MainWP_Logger::CACHE_METRICS_LOG_PRIORITY => esc_html__( 'Cache Metrics', 'mainwp' ),
1772 MainWP_Logger::DB_QUERIES_LOG_PRIORITY => esc_html__( 'DB Queries', 'mainwp' ),
1773 MainWP_Logger::WARM_CACHE_LOG_PRIORITY => esc_html__( 'Warm Cache', 'mainwp' ),
1774 MainWP_Logger::EXTENSION_UPDATES_CHECK_LOG_PRIORITY => esc_html__( 'Extension Updates Check', 'mainwp' ),
1775 );
1776 $specific_logs = apply_filters( 'mainwp_specific_action_logs', $specific_default ); // deprecated since 4.3.1, use 'mainwp_log_specific_actions' instead.
1777 $specific_logs = apply_filters( 'mainwp_log_specific_actions', $specific_logs );
1778
1779 ?>
1780 <div class="mainwp-actions-bar">
1781 <div class="ui mini form two column stackable grid">
1782 <div class="column">
1783 <form method="POST" action="">
1784 <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?>
1785 <?php // phpcs:disable WordPress.Security.EscapeOutput ?>
1786 <select name="actionlogs_status" class="ui mini dropdown">
1787 <option value="<?php echo MainWP_Logger::DISABLED; ?>" <?php echo MainWP_Logger::DISABLED === $enabled ? 'selected' : ''; ?>>
1788 <?php esc_html_e( 'Disabled', 'mainwp' ); ?>
1789 </option>
1790 <option value="<?php echo MainWP_Logger::INFO; ?>" <?php echo MainWP_Logger::INFO === $enabled ? 'selected' : ''; ?>>
1791 <?php esc_html_e( 'Info', 'mainwp' ); ?>
1792 </option>
1793 <option value="<?php echo MainWP_Logger::WARNING; ?>" <?php echo MainWP_Logger::WARNING === $enabled ? 'selected' : ''; ?>>
1794 <?php esc_html_e( 'Warning', 'mainwp' ); ?>
1795 </option>
1796 <option value="<?php echo MainWP_Logger::DEBUG; ?>" <?php echo MainWP_Logger::DEBUG === $enabled ? 'selected' : ''; ?>>
1797 <?php esc_html_e( 'Debug', 'mainwp' ); ?>
1798 </option>
1799 <?php
1800 // phpcs:enable
1801 if ( is_array( $specific_logs ) && ! empty( $specific_logs ) ) {
1802 asort( $specific_logs );
1803 foreach ( $specific_logs as $spec_log => $spec_title ) {
1804 ?>
1805 <option value="specific_<?php echo intval( $spec_log ); ?>" <?php echo (int) $spec_log === (int) $enabled ? 'selected' : ''; ?>>
1806 <?php echo esc_html( $spec_title ); ?>
1807 </option>
1808 <?php
1809 }
1810 }
1811 ?>
1812 </select>
1813 <input type="submit" class="ui green mini button" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>" />
1814 <input type="submit" class="ui mini button" name="actionlogs_clear" value="<?php esc_attr_e( 'Delete Log', 'mainwp' ); ?>" />
1815 </form>
1816 </div>
1817 <div class="column">
1818
1819 </div>
1820 </div>
1821 </div>
1822 <div class="ui padded segment">
1823 <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-action-logs-info-message' ) ) : ?>
1824 <div class="ui info message">
1825 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-action-logs-info-message"></i>
1826 <div class="header"><?php echo esc_html__( 'Enable a specific logging system.', 'mainwp' ); ?></div>
1827 <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>
1828 <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>
1829 </div>
1830 <?php endif; ?>
1831 <?php
1832 static::pre_load_logs_page();
1833
1834 $log_to_db = apply_filters( 'mainwp_logger_to_db', true );
1835 if ( $log_to_db ) {
1836 return MainWP_Logger::instance()->show_log_db();
1837 } else {
1838 MainWP_Logger::instance()->show_log_file();
1839 }
1840 ?>
1841 </div>
1842 <?php
1843 static::render_footer( 'ActionLogs' );
1844 }
1845
1846 /**
1847 * Method pre_load_logs_page().
1848 *
1849 * @return void
1850 */
1851 public static function pre_load_logs_page() {
1852 if ( MainWP_Logger::instance()->enabled_log_priority( MainWP_Logger::SITES_CHANGES_LOG_PRIORITY ) ) {
1853 $stats = Log_DB_Helper::instance()->get_logs_db_stats();
1854 MainWP_Logger::instance()->log_events( 'sites-changes', 'DB Info :: ' . print_r( $stats, true ) ); //phpcs:ignore --ok.
1855 }
1856 }
1857
1858 /**
1859 * Renders the Plugin Privacy page.
1860 *
1861 * @return void
1862 */
1863 public static function render_plugin_privacy_page() {
1864
1865 static::render_header( 'PluginPrivacy' );
1866 /**
1867 * Action: mainwp_before_plugin_privacy_section
1868 *
1869 * Fires before the Plugin Privacy section.
1870 *
1871 * @since 4.2
1872 */
1873 do_action( 'mainwp_before_plugin_privacy_section' );
1874 ?>
1875 <div class="ui padded segment">
1876 <div id="mainwp-plugin-privacy">
1877 <h2 class="ui header">
1878 <?php echo esc_html__( 'MainWP Dashboard Plugin Privacy Policy', 'mainwp' ); ?>
1879 <div class="sub header"><em><?php echo esc_html__( 'Last updated: April 14, 2022', 'mainwp' ); ?></em></div>
1880 </h2>
1881 <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>
1882 <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>
1883 <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>
1884 <h3 class="ui header"><?php echo esc_html__( 'What personal data we collect', 'mainwp' ); ?></h3>
1885 <p><?php echo esc_html__( 'We do not collect, store, nor process any personal data through this Plugin.', 'mainwp' ); ?></p>
1886 <h3 class="ui header"><?php echo esc_html__( 'Third-party extensions and integrations', 'mainwp' ); ?></h3>
1887 <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>
1888 <div class="ui hidden divider"></div>
1889 <div class="ui two columns stackable grid">
1890 <div class="column">
1891 <h3 class="ui header"><?php echo esc_html__( 'Our contact information', 'mainwp' ); ?></h3>
1892 <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>
1893 <div class="ui list">
1894 <div class="item"><?php echo esc_html__( 'Sick Marketing, LLC d/b/a MainWP', 'mainwp' ); ?></div>
1895 <div class="item"><?php echo esc_html__( 'support@mainwp.com', 'mainwp' ); ?></div>
1896 <div class="item"><?php echo esc_html__( '4730 S. Fort Apache Road', 'mainwp' ); ?></div>
1897 <div class="item"><?php echo esc_html__( 'Suite 300', 'mainwp' ); ?></div>
1898 <div class="item"><?php echo esc_html__( 'PO Box 27740', 'mainwp' ); ?></div>
1899 <div class="item"><?php echo esc_html__( 'Las Vegas, NV 89126', 'mainwp' ); ?></div>
1900 <div class="item"><?php echo esc_html__( 'United States', 'mainwp' ); ?></div>
1901 </div>
1902 </div>
1903 <div class="column">
1904 <h3 class="ui header"><?php echo esc_html__( 'Our representative\'s contact information', 'mainwp' ); ?></h3>
1905 <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>
1906 <div class="item"><?php echo esc_html__( 'Ametros Ltd', 'mainwp' ); ?></div>
1907 <div class="item"><?php echo esc_html__( 'Unit 3D', 'mainwp' ); ?></div>
1908 <div class="item"><?php echo esc_html__( 'North Point House', 'mainwp' ); ?></div>
1909 <div class="item"><?php echo esc_html__( 'North Point Business Park', 'mainwp' ); ?></div>
1910 <div class="item"><?php echo esc_html__( 'New Mallow Road', 'mainwp' ); ?></div>
1911 <div class="item"><?php echo esc_html__( 'Cork', 'mainwp' ); ?></div>
1912 <div class="item"><?php echo esc_html__( 'Ireland', 'mainwp' ); ?></div>
1913 <div class="ui hidden divider"></div>
1914 <p><?php echo esc_html__( 'If you are a resident of the United Kingdom, you may contact our representative at the following:', 'mainwp' ); ?></p>
1915 <div class="item"><?php echo esc_html__( 'Ametros Group Ltd', 'mainwp' ); ?></div>
1916 <div class="item"><?php echo esc_html__( 'Lakeside Offices', 'mainwp' ); ?></div>
1917 <div class="item"><?php echo esc_html__( 'Thorn Business Park', 'mainwp' ); ?></div>
1918 <div class="item"><?php echo esc_html__( 'Hereford', 'mainwp' ); ?></div>
1919 <div class="item"><?php echo esc_html__( 'Herefordshire', 'mainwp' ); ?></div>
1920 <div class="item"><?php echo esc_html__( 'HR2 6JT', 'mainwp' ); ?></div>
1921 <div class="item"><?php echo esc_html__( 'England', 'mainwp' ); ?></div>
1922 </div>
1923 </div>
1924 <div class="ui divider"></div>
1925 </div>
1926 <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>
1927 </div>
1928
1929 <?php
1930 /**
1931 * Action: mainwp_after_plugin_privacy_section
1932 *
1933 * Fires after the Plugin Privacy section.
1934 *
1935 * @since 4.2
1936 */
1937 do_action( 'mainwp_after_plugin_privacy_section' );
1938
1939 static::render_footer( 'PluginPrivacy' );
1940 }
1941
1942 /**
1943 * Renders .htaccess File page.
1944 *
1945 * @return void
1946 */
1947 public static function render_htaccess() {
1948 if ( ! \mainwp_current_user_can( 'dashboard', 'see_server_information' ) ) {
1949 \mainwp_do_not_have_permissions( '.htaccess', 'mainwp' );
1950 return;
1951 }
1952 static::render_header( '.htaccess' );
1953 /**
1954 * Action: mainwp_before_htaccess_section
1955 *
1956 * Fires before the .htaccess file section.
1957 *
1958 * @since 4.1
1959 */
1960 do_action( 'mainwp_before_htaccess_section' );
1961 ?>
1962 <div id="mainwp-show-htaccess">
1963 <?php
1964 if ( false !== strpos( ini_get( 'disable_functions' ), 'show_source' ) ) {
1965 esc_html_e( 'File content could not be displayed.', 'mainwp' );
1966 echo '<br />';
1967 esc_html_e( 'It appears that the show_source() PHP function has been disabled on the servre.', 'mainwp' );
1968 echo '<br />';
1969 esc_html_e( 'Please, contact your host support and have them enable the show_source() function for the proper functioning of this feature.', 'mainwp' );
1970 } else {
1971 show_source( ABSPATH . '.htaccess' );
1972 }
1973 ?>
1974 </div>
1975 <?php
1976 /**
1977 * Action: mainwp_after_htaccess_section
1978 *
1979 * Fires after the .htaccess file section.
1980 *
1981 * @since 4.1
1982 */
1983 do_action( 'mainwp_after_htaccess_section' );
1984 static::render_footer( '.htaccess' );
1985 }
1986
1987 /**
1988 * Checks for disable PHP Functions.
1989 *
1990 * @return void
1991 */
1992 public static function php_disabled_functions() {
1993 $disabled_functions = ini_get( 'disable_functions' );
1994 if ( '' !== $disabled_functions ) {
1995 $arr = explode( ',', $disabled_functions );
1996 sort( $arr );
1997 $_count = count( $arr );
1998 for ( $i = 0; $i < $_count; $i++ ) {
1999 echo esc_html( $arr[ $i ] ) . ', ';
2000 }
2001 } else {
2002 esc_html_e( 'No functions disabled.', 'mainwp' );
2003 }
2004 }
2005
2006 /**
2007 * Renders MainWP Settings 'Options'.
2008 *
2009 * @return void
2010 *
2011 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::mainwp_options()
2012 */
2013 public static function display_mainwp_options() {
2014 $options = MainWP_Server_Information_Handler::mainwp_options();
2015
2016 $enable_individual_uptime_monitoring = false;
2017 if ( get_option( 'mainwp_individual_uptime_monitoring_schedule_enabled' ) ) {
2018 $enable_individual_uptime_monitoring = true;
2019 }
2020
2021 // phpcs:disable WordPress.Security.EscapeOutput
2022 foreach ( $options as $option ) {
2023 $addition_info = '';
2024 if ( 'is_enable_automatic_check_uptime_monitoring' === $option['name'] && empty( $option['save_value'] ) && $enable_individual_uptime_monitoring ) { // global monitoring disabled.
2025 $addition_info = '<br><em>' . esc_html__( 'Individual uptime monitoring is running', 'mainwp' ) . '</em>';
2026 }
2027 echo '<tr><td>' . $option['label'] . '</td><td>' . $option['value'] . $addition_info . '</td></tr>';
2028 }
2029 // phpcs:enable
2030 }
2031
2032 /**
2033 * Render detected issues summary.
2034 *
2035 * @return void
2036 */
2037 private static function render_detected_issues_summary() {
2038 $issues = MainWP_Server_Information_Handler::get_primary_issues();
2039
2040 if ( empty( $issues ) ) {
2041 ?>
2042 <div class="ui positive message mainwp-system-report-issues-message">
2043 <div class="header"><?php esc_html_e( 'No high-priority issues detected', 'mainwp' ); ?></div>
2044 <p><?php esc_html_e( 'This summary only highlights the most common problems. Review the tables below for full context.', 'mainwp' ); ?></p>
2045 </div>
2046 <?php
2047 return;
2048 }
2049
2050 $has_error = false;
2051 foreach ( $issues as $issue ) {
2052 if ( isset( $issue['severity'] ) && 'error' === $issue['severity'] ) {
2053 $has_error = true;
2054 break;
2055 }
2056 }
2057 ?>
2058 <div class="ui <?php echo $has_error ? 'negative' : 'warning'; ?> message mainwp-system-report-issues-message">
2059 <div class="header"><?php esc_html_e( 'Detected Issues', 'mainwp' ); ?></div>
2060 <div class="ui list">
2061 <?php foreach ( $issues as $issue ) : ?>
2062 <div class="item">
2063 <div class="content">
2064 <div style="display:flex;align-items:center;gap:0.5rem;flex-wrap:wrap;">
2065 <?php echo static::get_report_status_html( isset( $issue['severity'] ) ? $issue['severity'] : '' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>
2066 <?php if ( ! empty( $issue['anchor'] ) ) : ?>
2067 <a href="#<?php echo esc_attr( $issue['anchor'] ); ?>"><span style="font-weight:600;"><?php echo esc_html( $issue['title'] ); ?></span></a>
2068 <?php else : ?>
2069 <span style="font-weight:600;"><?php echo esc_html( $issue['title'] ); ?></span>
2070 <?php endif; ?>
2071 <?php if ( ! empty( $issue['detail_html'] ) ) : ?>
2072 <span><?php echo wp_kses_post( $issue['detail_html'] ); ?></span>
2073 <?php elseif ( ! empty( $issue['detail'] ) ) : ?>
2074 <span><?php echo esc_html( $issue['detail'] ); ?></span>
2075 <?php endif; ?>
2076 <?php if ( ! empty( $issue['kb_url'] ) ) : ?>
2077 <a href="<?php echo esc_url( $issue['kb_url'] ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Help document', 'mainwp' ); ?></a>
2078 <i class="external alternate icon"></i>
2079 <?php endif; ?>
2080 </div>
2081 </div>
2082 </div>
2083 <?php endforeach; ?>
2084 </div>
2085 </div>
2086 <?php
2087 }
2088
2089 /**
2090 * Get export text attribute HTML.
2091 *
2092 * @param string $text English export text.
2093 *
2094 * @return string
2095 */
2096 private static function get_export_text_attr( $text ) {
2097 return '' !== (string) $text ? ' data-export-text="' . esc_attr( $text ) . '"' : '';
2098 }
2099
2100 /**
2101 * Render generic report table.
2102 *
2103 * @param string $table_id Table id.
2104 * @param string $title Table title.
2105 * @param array $rows Table rows.
2106 * @param string $export_title English export title.
2107 *
2108 * @return void
2109 */
2110 private static function render_report_section_table( $table_id, $title, $rows, $export_title = '' ) {
2111 if ( empty( $rows ) || ! is_array( $rows ) ) {
2112 return;
2113 }
2114 ?>
2115 <table id="<?php echo esc_attr( $table_id ); ?>" class="ui unstackable table mainwp-system-report-table mainwp-system-info-table">
2116 <thead>
2117 <tr>
2118 <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>
2119 <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>
2120 <th scope="col" class="two wide right aligned"></th>
2121 </tr>
2122 </thead>
2123 <tbody>
2124 <?php foreach ( $rows as $row ) : ?>
2125 <?php static::render_report_row( $row ); ?>
2126 <?php endforeach; ?>
2127 </tbody>
2128 </table>
2129 <?php
2130 }
2131
2132 /**
2133 * Render a generic report row.
2134 *
2135 * @param array $row Row data.
2136 *
2137 * @return void
2138 */
2139 private static function render_report_row( $row ) {
2140 $visibility = isset( $row['visibility'] ) ? $row['visibility'] : 'community_safe';
2141 $community_value = isset( $row['community_value'] ) ? $row['community_value'] : null;
2142 $export_label = isset( $row['export_label'] ) ? $row['export_label'] : '';
2143 $row_classes = array();
2144
2145 if ( 'full_only' === $visibility ) {
2146 $row_classes[] = 'mwp-not-generate-row';
2147 }
2148
2149 $value_attr = '';
2150 if ( 'community_masked' === $visibility && null !== $community_value ) {
2151 $value_attr = ' data-community-value="' . esc_attr( $community_value ) . '"';
2152 }
2153 ?>
2154 <tr class="<?php echo esc_attr( implode( ' ', $row_classes ) ); ?>">
2155 <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>
2156 <td<?php echo $value_attr; //phpcs:ignore -- escaped. ?>><?php echo esc_html( isset( $row['value'] ) ? $row['value'] : '' ); ?></td>
2157 <td class="right aligned"><?php echo static::get_report_status_html( isset( $row['status'] ) ? $row['status'] : '' ); // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
2158 </tr>
2159 <?php
2160 }
2161
2162 /**
2163 * Get report status html.
2164 *
2165 * @param string $status Status.
2166 *
2167 * @return string
2168 */
2169 private static function get_report_status_html( $status ) {
2170 switch ( $status ) {
2171 case 'pass':
2172 return static::get_pass_html();
2173 case 'error':
2174 return static::get_warning_html( static::ERROR );
2175 case 'warning':
2176 return static::get_warning_html( static::WARNING );
2177 default:
2178 return '';
2179 }
2180 }
2181
2182 /**
2183 * Renders PHP Warning HTML.
2184 *
2185 * @param int $errorType Global variable static::WARNING = 1.
2186 * @param bool $ech echo or return.
2187 *
2188 * @return string PHP Warning html.
2189 */
2190 private static function get_warning_html( $errorType = self::WARNING, $ech = false ) {
2191 $msg = '';
2192 if ( static::WARNING === $errorType ) {
2193 $msg = '<i class="large yellow exclamation icon"></i><span style="display:none" data-export-text="Warning">' . esc_html__( 'Warning', 'mainwp' ) . '</span>';
2194 } else {
2195 $msg = '<i class="large red times icon"></i><span style="display:none" data-export-text="Fail">' . esc_html__( 'Fail', 'mainwp' ) . '</span>';
2196 }
2197
2198 if ( $ech ) {
2199 echo $msg; //phpcs:ignore -- escaped.
2200 } else {
2201 return $msg;
2202 }
2203 }
2204
2205 /**
2206 * Renders PHP Pass HTML.
2207 *
2208 * @param bool $ech echo or return.
2209 *
2210 * @return string PHP Pass html.
2211 */
2212 private static function get_pass_html( $ech = false ) {
2213 $msg = '<i class="large green check icon"></i><span style="display:none" data-export-text="Pass">' . esc_html__( 'Pass', 'mainwp' ) . '</span>';
2214 if ( $ech ) {
2215 echo $msg; //phpcs:ignore -- escaped.
2216 } else {
2217 return $msg;
2218 }
2219 }
2220 }
2221