1
|
|
|
<?php namespace EmailLog\Core\UI\Page; |
2
|
|
|
|
3
|
|
|
defined( 'ABSPATH' ) || exit; // Exit if accessed directly. |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Addon List Page. |
7
|
|
|
* |
8
|
|
|
* @since 2.0 |
9
|
|
|
*/ |
10
|
|
|
class AddonListPage extends BasePage { |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Page slug. |
14
|
|
|
*/ |
15
|
|
|
const PAGE_SLUG = 'email-log-addons'; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Register page. |
19
|
|
|
*/ |
20
|
|
|
public function register_page() { |
21
|
|
|
$this->page = add_submenu_page( |
|
|
|
|
22
|
|
|
LogListPage::PAGE_SLUG, |
23
|
|
|
__( 'Add-ons', 'email-log' ), |
24
|
|
|
__( 'Add-ons', 'email-log' ), |
25
|
|
|
'manage_options', |
26
|
|
|
self::PAGE_SLUG, |
27
|
|
|
array( $this, 'render_page' ) |
28
|
|
|
); |
29
|
|
|
|
30
|
|
|
add_action( "load-{$this->page}", array( $this, 'render_help_tab' ) ); |
31
|
|
|
add_action( "load-{$this->page}", array( $this, 'enqueue_assets' ) ); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Render the list of add-on in the page. |
36
|
|
|
*/ |
37
|
|
|
public function render_page() { |
38
|
|
|
?> |
39
|
|
|
<div class="wrap"> |
40
|
|
|
<h1><?php _e( 'Email Log Add-ons', 'email-log' ); ?></h1> |
41
|
|
|
<?php settings_errors(); ?> |
42
|
|
|
|
43
|
|
|
<p> |
44
|
|
|
<?php _e( 'These add-ons provide additional functionality to Email Log plugin and are available for purchase.', 'email-log' ); ?> |
45
|
|
|
<?php _e( 'If your license includes the add-ons below, you will be able to install them from here with one-click.', 'email-log' ); ?> |
46
|
|
|
</p> |
47
|
|
|
|
48
|
|
|
<?php |
49
|
|
|
/** |
50
|
|
|
* Before add-ons are listed in the add-on list page. |
51
|
|
|
* |
52
|
|
|
* @since 2.0.0 |
53
|
|
|
*/ |
54
|
|
|
do_action( 'el_before_addon_list' ); |
55
|
|
|
|
56
|
|
|
$email_log = email_log(); |
57
|
|
|
$licenser = $email_log->get_licenser(); |
58
|
|
|
if ( ! is_null( $licenser ) ) { |
59
|
|
|
$licenser->get_addon_list()->render(); |
60
|
|
|
} |
61
|
|
|
?> |
62
|
|
|
</div> |
63
|
|
|
<?php |
64
|
|
|
|
65
|
|
|
$this->render_page_footer(); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Enqueue static assets needed for this page. |
70
|
|
|
*/ |
71
|
|
|
public function enqueue_assets() { |
72
|
|
|
$email_log = email_log(); |
73
|
|
|
|
74
|
|
|
wp_enqueue_style( 'el_addon_list', plugins_url( 'assets/css/admin/addon-list.css', $email_log->get_plugin_file() ), array(), $email_log->get_version() ); |
75
|
|
|
wp_enqueue_script( 'el_addon_list', plugins_url( 'assets/js/admin/addon-list.js', $email_log->get_plugin_file() ), array( 'jquery' ), $email_log->get_version(), true ); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
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.