Completed
Branch master (136588)
by
unknown
02:26
created

ALNP_Admin_Site_Health   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 96
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
B add_debug_info() 0 76 1
1
<?php
2
/**
3
 * Auto Load Next Post - Site Health.
4
 *
5
 * Adds Auto Load Next Post settings to WordPress Site Health.
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_Admin_Site_Health' ) ) {
20
21
	class ALNP_Admin_Site_Health {
22
23
		/**
24
		 * Constructor
25
		 *
26
		 * @access public
27
		 */
28
		public function __construct() {
29
			add_filter( 'debug_information', array( $this, 'add_debug_info' ) );
30
		} // END __construct()
31
32
		/**
33
		 * Adds Auto Load Next Post for debugging purposes.
34
		 *
35
		 * @access public
36
		 * @param  array $debug_info
37
		 * @return array $debug_info
38
		 */
39
		public function add_debug_info( $debug_info ) {
40
			$debug_info['auto-load-next-post'] = array(
41
				'label'    => esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ),
42
				'fields'   => array(
43
					// Theme Selectors
44
					'content_container' => array(
45
						'label'   => esc_html__( 'Content Container', 'auto-load-next-post' ),
46
						'value'   => get_option( 'auto_load_next_post_content_container', 'main.site-main' ),
47
						'private' => false,
48
					),
49
					'post_title_selector' => array(
50
						'label'   => esc_html__( 'Post Title', 'auto-load-next-post' ),
51
						'value'   => get_option( 'auto_load_next_post_title_selector', 'h1.entry-title' ),
52
						'private' => false,
53
					),
54
					'navigation_container' => array(
55
						'label'   => esc_html__( 'Post Navigation', 'auto-load-next-post' ),
56
						'value'   => get_option( 'auto_load_next_post_navigation_container', 'nav.post-navigation' ),
57
						'private' => false,
58
					),
59
					'comments_container' => array(
60
						'label'   => esc_html__( 'Comments Container', 'auto-load-next-post' ),
61
						'value'   => get_option( 'auto_load_next_post_comments_container', 'div#comments' ),
62
						'private' => false,
63
					),
64
65
					// Templates
66
					'use_fallback' => array(
67
						'label'   => esc_html__( 'Use Fallback?', 'auto-load-next-post' ),
68
						'value'   => get_option( 'auto_load_next_post_use_fallback', 'no' ),
69
						'private' => false,
70
					),
71
72
					// Misc
73
					'remove_comments' => array(
74
						'label'   => esc_html__( 'Remove Comments', 'auto-load-next-post' ),
75
						'value'   => get_option( 'auto_load_next_post_remove_comments', 'yes' ),
76
						'private' => false,
77
					),
78
					'google_analytics' => array(
79
						'label'   => esc_html__( 'Update Google Analytics', 'auto-load-next-post' ),
80
						'value'   => get_option( 'auto_load_next_post_google_analytics', 'no' ),
81
						'private' => false,
82
					),
83
					'load_js_in_footer' => array(
84
						'label'   => esc_html__( 'JavaScript in Footer?', 'auto-load-next-post' ),
85
						'value'   => get_option( 'auto_load_next_post_load_js_in_footer', 'no' ),
86
						'private' => false,
87
					),
88
					'disable_on_mobile' => array(
89
						'label'   => esc_html__( 'Disable for Mobile?', 'auto-load-next-post' ),
90
						'value'   => get_option( 'auto_load_next_post_disable_on_mobile', 'no' ),
91
						'private' => false,
92
					),
93
					'uninstall' => array(
94
						'label'   => esc_html__( 'Remove all data on uninstall?', 'auto-load-next-post' ),
95
						'value'   => get_option( 'auto_load_next_post_uninstall_data', 'no' ),
96
						'private' => false,
97
					),
98
99
					// Events
100
					'on_load_event' => array(
101
						'label'   => esc_html__( 'Post loaded', 'auto-load-next-post' ),
102
						'value'   => get_option( 'auto_load_next_post_on_load_event', '' ),
103
						'private' => false,
104
					),
105
					'on_entering_event' => array(
106
						'label'   => esc_html__( 'Entering a Post', 'auto-load-next-post' ),
107
						'value'   => get_option( 'auto_load_next_post_on_entering_event', '' ),
108
						'private' => false,
109
					),
110
				),
111
			);
112
113
			return $debug_info;
114
		} // END add_debug_info()
115
116
	} // END class
117
118
} // END if class exists
119
120
return new ALNP_Admin_Site_Health();
121