1
|
|
|
<?php namespace EmailLog\Core\UI\Page; |
2
|
|
|
|
3
|
|
|
use EmailLog\Core\UI\Component\EmailLogSystemInfo; |
4
|
|
|
|
5
|
|
|
defined( 'ABSPATH' ) || exit; // Exit if accessed directly. |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* System Info Page. |
9
|
|
|
* |
10
|
|
|
* This page displays information about the current WordPress install that can be used in support requests. |
11
|
|
|
* |
12
|
|
|
* @since 2.3.0 |
13
|
|
|
*/ |
14
|
|
|
class SystemInfoPage extends BasePage { |
15
|
|
|
const PAGE_SLUG = 'email-log-system-info'; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Capability to Manage system info. |
19
|
|
|
*/ |
20
|
|
|
const CAPABILITY = 'manage_email_logs'; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* SystemInfo class. |
24
|
|
|
* |
25
|
|
|
* @var EmailLogSystemInfo |
26
|
|
|
*/ |
27
|
|
|
protected $system_info; |
28
|
|
|
|
29
|
|
|
public function load() { |
30
|
|
|
parent::load(); |
31
|
|
|
|
32
|
|
|
add_action( 'el-download-system-info', array( $this, 'download_system_info' ) ); |
33
|
|
|
|
34
|
|
|
$this->system_info = new EmailLogSystemInfo( 'email-log' ); |
35
|
|
|
$this->system_info->load(); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function register_page() { |
39
|
|
|
$this->page = add_submenu_page( |
|
|
|
|
40
|
|
|
LogListPage::PAGE_SLUG, |
41
|
|
|
__( 'System Info', 'email-log' ), |
42
|
|
|
__( 'System Info', 'email-log' ), |
43
|
|
|
self::CAPABILITY, |
44
|
|
|
self::PAGE_SLUG, |
45
|
|
|
array( $this, 'render_page' ) |
46
|
|
|
); |
47
|
|
|
|
48
|
|
|
add_action( "load-{$this->page}", array( $this, 'render_help_tab' ) ); |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Fires before loading Sytem Info page. |
52
|
|
|
* |
53
|
|
|
* @since 2.3.0 |
54
|
|
|
* |
55
|
|
|
* @param string $page Page slug. |
56
|
|
|
*/ |
57
|
|
|
do_action( 'el_load_system_info_page', $this->page ); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Render the page. |
62
|
|
|
*/ |
63
|
|
|
public function render_page() { |
64
|
|
|
?> |
65
|
|
|
|
66
|
|
|
<form method="post"> |
67
|
|
|
<div class="updated"> |
68
|
|
|
<p> |
69
|
|
|
<strong> |
70
|
|
|
<?php _e( 'Please include this information when posting support requests.', 'email-log' ); ?> |
71
|
|
|
</strong> |
72
|
|
|
</p> |
73
|
|
|
</div> |
74
|
|
|
|
75
|
|
|
<?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?> |
76
|
|
|
<div class="notice notice-warning"> |
77
|
|
|
<p><strong> |
78
|
|
|
<?php printf( __( 'DISABLE_WP_CRON is <a href="%s" rel="noopener" target="_blank">enabled</a>. This prevents scheduler from running.', 'email-log' ), 'https://codex.wordpress.org/Editing_wp-config.php#Disable_Cron_and_Cron_Timeout' ); ?> |
79
|
|
|
</strong></p> |
80
|
|
|
</div> |
81
|
|
|
<?php endif; ?> |
82
|
|
|
|
83
|
|
|
<div class="wrap"> |
84
|
|
|
<h1><?php _e( 'Email Log - System Info', 'email-log' ); ?></h1> |
85
|
|
|
|
86
|
|
|
<?php |
87
|
|
|
$this->system_info->render(); |
88
|
|
|
?> |
89
|
|
|
|
90
|
|
|
<p class="submit"> |
91
|
|
|
<input type="hidden" name="el-action" value="el-download-system-info"> |
92
|
|
|
<?php |
93
|
|
|
wp_nonce_field( 'el-download-system-info', 'el-download-system-info_nonce', false ); |
94
|
|
|
submit_button( __( 'Download System Info File', 'email-log' ), 'primary', 'el-download-system-info', false ); |
95
|
|
|
?> |
96
|
|
|
</p> |
97
|
|
|
</div> |
98
|
|
|
</form> |
99
|
|
|
|
100
|
|
|
<?php |
101
|
|
|
$this->render_page_footer(); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Download System info file. |
106
|
|
|
*/ |
107
|
|
|
public function download_system_info() { |
108
|
|
|
$this->system_info->download_as_file(); |
109
|
|
|
} |
110
|
|
|
} |
111
|
|
|
|
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.