Completed
Branch dev (58959f)
by
unknown
02:02
created

Auto_Load_Next_Post_Settings_Page   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 6
Bugs 2 Features 0
Metric Value
c 6
b 2
f 0
dl 0
loc 71
rs 10
wmc 5
lcom 1
cbo 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A add_settings_page() 0 4 1
A add_menu_page() 0 4 1
A get_settings() 0 3 1
A output() 0 5 1
A save() 0 7 1
1
<?php
2
/**
3
 * Auto Load Next Post Settings Page
4
 *
5
 * @since    1.0.0
6
 * @author   Sébastien Dumont
7
 * @category Admin
8
 * @package  Auto Load Next Post
9
 * @license  GPL-2.0+
10
 */
11
12
if ( ! defined('ABSPATH')) {
13
	exit;
14
}
15
// Exit if accessed directly
16
17
if ( ! class_exists('Auto_Load_Next_Post_Settings_Page')) {
18
19
/**
20
 * Class - Auto_Load_Next_Post_Settings_Page
21
 *
22
 * @since 1.0.0
23
 */
24
class Auto_Load_Next_Post_Settings_Page {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
25
26
	protected $id    = '';
27
	protected $label = '';
28
29
	/**
30
	 * Add this page to settings.
31
	 *
32
	 * @since  1.0.0
33
	 * @access public
34
	 * @param  array $pages
35
	 * @return array $pages
36
	 */
37
	public function add_settings_page($pages) {
38
		$pages[$this->id] = $this->label;
39
		return $pages;
40
	} // END add_settings_page()
41
42
	/**
43
	 * Add this settings page to plugin menu.
44
	 *
45
	 * @since  1.0.0
46
	 * @access public
47
	 * @param  array $pages
48
	 * @return array $pages
49
	 */
50
	public function add_menu_page($pages) {
51
		$pages[$this->id] = $this->label;
52
		return $pages;
53
	} // END add_menu_page()
54
55
	/**
56
	 * Get settings array
57
	 *
58
	 * @since  1.0.0
59
	 * @access public
60
	 * @return array
61
	 */
62
	public function get_settings() {
63
		return array();
64
	} // END get_settings()
65
66
	/**
67
	 * Output the settings.
68
	 *
69
	 * @since  1.0.0
70
	 * @access public
71
	 */
72
	public function output() {
73
		$settings = $this->get_settings();
74
75
		Auto_Load_Next_Post_Admin_Settings::output_fields($settings);
76
	} // END output()
77
78
	/**
79
	 * Save settings.
80
	 *
81
	 * @since  1.0.0
82
	 * @access public
83
	 * @global $current_tab
84
	 * @global $current_section
85
	 */
86
	public function save() {
87
		global $current_tab;
88
89
		$settings = $this->get_settings();
90
91
		Auto_Load_Next_Post_Admin_Settings::save_fields($settings, $current_tab);
92
	} // END save()
93
94
} // END class
95
96
} // END if class exists.
97