PluginProbe ʕ •ᴥ•ʔ
Admin Columns / 3.0.5
Admin Columns v3.0.5
7.1.4 7.0.19 2.3.5 2.4 2.4.1 2.4.10 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.6.1 2.5.6.2 2.5.6.3 2.5.6.4 3.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.7 3.1 3.1.1 3.1.10 3.1.2 3.1.3 3.1.5 3.2.3 3.2.7 3.3.1 3.4.1 3.4.6 3.4.8 4.0.1 4.0.3 4.1.6 4.2.2 4.2.5 4.3 4.3.2 4.4.1 4.4.4 4.4.5 4.5.5 4.6.1 4.7.18 4.7.19 4.7.20 4.7.7 7.0.13 7.0.14 7.0.16 trunk 1.0 1.1 1.1.3 1.2 1.2.1 1.3 1.3.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.5.1 1.4.6 1.4.6.1 1.4.6.2 1.4.6.3 1.4.6.4 1.4.7 1.4.8 1.4.9 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.1.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.5.1 2.2.6 2.2.6.1 2.2.6.2 2.2.6.3 2.2.6.4 2.2.7 2.2.8 2.2.8.1 2.2.9 2.3.1 2.3.2 2.3.3
codepress-admin-columns / classes / Admin / Page.php
codepress-admin-columns / classes / Admin Last commit date
Help 8 years ago Page 8 years ago Promo 8 years ago Help.php 8 years ago Page.php 8 years ago Pages.php 8 years ago Promo.php 8 years ago
Page.php
133 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 abstract class AC_Admin_Page {
8
9 /**
10 * Should this page be displayed when no page is selected
11 *
12 * @var bool
13 */
14 private $default;
15
16 /**
17 * @var string
18 */
19 private $slug;
20
21 /**
22 * @var string
23 */
24 private $label;
25
26 /**
27 * @var bool False when menu page is hidden in menu
28 */
29 private $show_in_menu = true;
30
31 /**
32 * Display pages
33 *
34 * @return void
35 */
36 public abstract function display();
37
38 /**
39 * Is this the default to to display when no active page is present
40 *
41 * @return bool
42 */
43 public function is_default() {
44 return (bool) $this->default;
45 }
46
47 public function set_default( $default ) {
48 $this->default = (bool) $default;
49
50 return $this;
51 }
52
53 public function get_slug() {
54 return $this->slug;
55 }
56
57 public function set_slug( $slug ) {
58 $this->slug = sanitize_key( $slug );
59
60 return $this;
61 }
62
63 public function show_in_menu() {
64 return $this->show_in_menu;
65 }
66
67 public function set_show_in_menu( $show ) {
68 $this->show_in_menu = (bool) $show;
69
70 return $this;
71 }
72
73 public function get_label() {
74 return $this->label;
75 }
76
77 public function set_label( $label ) {
78 $this->label = $label;
79
80 return $this;
81 }
82
83 /**
84 * @return string URL
85 */
86 public function get_link() {
87 return add_query_arg( array( 'tab' => $this->slug ), AC()->admin()->get_settings_url() );
88 }
89
90 public function is_current_screen() {
91 return AC()->admin()->is_current_page( $this->get_slug() );
92 }
93
94 /**
95 * Cast page to an array
96 *
97 * @return array
98 */
99 public function to_array() {
100 return array(
101 'slug' => $this->get_slug(),
102 'label' => $this->get_label(),
103 'default' => $this->is_default(),
104 );
105 }
106
107 /**
108 * Show the label of the page
109 *
110 * @return string
111 */
112 public function __toString() {
113 return $this->get_label();
114 }
115
116 /**
117 * @param string $action
118 *
119 * @return bool
120 */
121 public function verify_nonce( $action ) {
122 return wp_verify_nonce( filter_input( INPUT_POST, '_ac_nonce' ), $action );
123 }
124
125 /**
126 * Nonce Field
127 */
128 public function nonce_field( $action ) {
129 wp_nonce_field( $action, '_ac_nonce', false );
130 }
131
132 }
133