ALNP_Sidebar::sidebar_top()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Auto Load Next Post - Sidebar.
4
 *
5
 * Displays a sidebar on the settings page.
6
 *
7
 * @since    1.6.0
8
 * @author   Sébastien Dumont
9
 * @category Admin
10
 * @package  Auto Load Next Post/Admin
11
 * @license  GPL-2.0+
12
 */
13
14
// Exit if accessed directly.
15
if ( ! defined( 'ABSPATH' ) ) {
16
	exit;
17
}
18
19
if ( ! class_exists( 'ALNP_Sidebar' ) ) {
20
21
	class ALNP_Sidebar {
22
23
		/**
24
		 * Constructor
25
		 *
26
		 * @access  public
27
		 */
28
		public function __construct() {
29
			add_action( 'auto_load_next_post_sidebar', array( $this, 'sidebar_top' ), 0 );
30
			add_action( 'auto_load_next_post_sidebar', array( $this, 'upgrade_details' ), 1 );
31
			add_action( 'auto_load_next_post_sidebar', array( $this, 'sidebar_bottom' ), 999 );
32
		} // END __construct()
33
34
		/**
35
		 * Displays the top of the sidebar.
36
		 * 
37
		 * @access public
38
		 */
39
		public function sidebar_top() {
40
			include_once( dirname( __FILE__ ) . '/views/html-admin-sidebar-logo.php' );
41
42
			do_action( 'auto_load_next_post_sidebar_top' );
43
		} // END sidebar_top()
44
45
		/**
46
		 * Checks if Auto Load Next Post Pro is installed before 
47
		 * displaying upgrade details in the sidebar.
48
		 *
49
		 * @access public
50
		 */
51
		public function upgrade_details() {
52
			if ( ! is_alnp_pro_version_installed() ) {
53
				include_once( dirname( __FILE__ ) . '/views/html-admin-sidebar.php' );
54
			}
55
		} // END upgrade_details()
56
57
		/**
58
		 * Displays plugin credits at the bottom of the sidebar.
59
		 * 
60
		 * @access public
61
		 */
62
		public function sidebar_bottom() {
63
			do_action( 'auto_load_next_post_sidebar_bottom' );
64
65
			include_once( dirname( __FILE__ ) . '/views/html-admin-sidebar-credits.php' );
66
		} // END sidebar_bottom()
67
68
	} // END class
69
70
} // END if class exists
71
72
return new ALNP_Sidebar();
73