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

BasePage::add_footer_links()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 9
ccs 0
cts 6
cp 0
crap 2
rs 9.6666
c 0
b 0
f 0
1
<?php namespace EmailLog\Core\UI\Page;
2
3
use EmailLog\Core\Loadie;
4
5
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
6
7
/**
8
 * Base class for all Email Log admin pages.
9
 *
10
 * @since 2.0.0
11
 */
12
abstract class BasePage implements Loadie {
13
14
	/**
15
	 * Current page.
16
	 *
17
	 * @var string
18
	 */
19
	protected $page;
20
21
	/**
22
	 * Current screen.
23
	 *
24
	 * @var \WP_Screen
25
	 */
26
	protected $screen;
27
28
	/**
29
	 * Register page.
30
	 *
31
	 * @abstract
32
	 */
33
	abstract public function register_page();
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
34
35
	/**
36 2
	 * Setup hooks related to pages.
37 2
	 *
38 2
	 * @inheritdoc
39
	 */
40
	public function load() {
41
		add_action( 'admin_menu', array( $this, 'register_page' ) );
42
	}
43 2
44 2
	/**
45 2
	 * Render help tab.
46
	 *
47
	 * TODO: Change links used in this function.
48
	 */
49
	public function render_help_tab() {
50
		/**
51
		 * Content specified inline
52
		 */
53
		$this->get_screen()->add_help_tab(
54
			array(
55
				'title'    => __( 'About Plugin', 'email-log' ),
56
				'id'       => 'about_tab',
57
				'content'  => '<p>' . __( 'Email Log WordPress Plugin, allows you to log all emails that are sent through WordPress.', 'email-log' ) . '</p>',
58
				'callback' => false,
59
			)
60
		);
61
62
		// Add help sidebar.
63
		// TODO: Change the links.
64
		$this->get_screen()->set_help_sidebar(
65
			'<p><strong>' . __( 'More information', 'email-log' ) . '</strong></p>' .
66
			'<p><a href = "http://sudarmuthu.com/wordpress/email-log">' . __( 'Plugin Homepage/support', 'email-log' ) . '</a></p>' .
67
			'<p><a href = "http://sudarmuthu.com/blog">' . __( "Plugin author's blog", 'email-log' ) . '</a></p>' .
68
			'<p><a href = "http://sudarmuthu.com/wordpress/">' . __( "Other Plugin's by Author", 'email-log' ) . '</a></p>'
69
		);
70
	}
71
72
	/**
73
	 * Render admin page footer.
74
	 */
75
	protected function render_page_footer() {
76
		/**
77
		 * Action to add additional content to email log admin footer.
78
		 *
79
		 * @since 1.8
80
		 */
81
		do_action( 'el_admin_footer' );
82
	}
83
84
	/**
85
	 * Return the WP_Screen object for the current page's handle.
86
	 *
87
	 * @return \WP_Screen Screen object.
88
	 */
89
	public function get_screen() {
90
		if ( ! isset( $this->screen ) ) {
91
			$this->screen = \WP_Screen::get( $this->page );
92
		}
93
94
		return $this->screen;
95
	}
96
}
97