Completed
Push — master ( 49679a...617b2a )
by Sudar
02:03
created

AddonListPage::enqueue_assets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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