PluginProbe
My WP Customize Admin/Frontend / 1.5
My WP Customize Admin/Frontend v1.5
1.27.4 1.27.3 trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.10 1.10.1 1.10.2 1.11 1.12 1.12.1 1.12.2 1.13 1.13.1 1.13.2 1.14 1.15.0 1.16 1.17.0 All 76 releases
my-wp / controller / modules / mywp.controller.module.frontend.general.php

mywp.controller.module.frontend.general.php in My WP Customize Admin/Frontend 1.5, at controller/modules/mywp.controller.module.frontend.general.php

244 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 if( ! class_exists( 'MywpControllerAbstractModule' ) ) {
8 return false;
9 }
10
11 if ( ! class_exists( 'MywpControllerModuleFrontendGeneral' ) ) :
12
13 final class MywpControllerModuleFrontendGeneral extends MywpControllerAbstractModule {
14
15 static protected $id = 'frontend_general';
16
17 public static function mywp_controller_initial_data( $initial_data ) {
18
19 $initial_data['admin_bar'] = '';
20 $initial_data['hide_wp_generator'] = '';
21 $initial_data['hide_wlwmanifest_link'] = '';
22 $initial_data['hide_rsd_link'] = '';
23 $initial_data['hide_feed_links'] = '';
24 $initial_data['hide_feed_links_extra'] = '';
25 $initial_data['custom_header_meta'] = '';
26
27 return $initial_data;
28
29 }
30
31 public static function mywp_controller_default_data( $default_data ) {
32
33 $default_data['admin_bar'] = '';
34 $default_data['hide_wp_generator'] = false;
35 $default_data['hide_wlwmanifest_link'] = false;
36 $default_data['hide_rsd_link'] = false;
37 $default_data['hide_feed_links'] = false;
38 $default_data['hide_feed_links_extra'] = false;
39 $default_data['custom_header_meta'] = '';
40
41 return $default_data;
42
43 }
44
45 public static function mywp_wp_loaded() {
46
47 if( is_admin() ) {
48
49 return false;
50
51 }
52
53 if( ! self::is_do_controller() ) {
54
55 return false;
56
57 }
58
59 add_action( 'wp' , array( __CLASS__ , 'show_admin_bar' ) );
60
61 add_action( 'wp' , array( __CLASS__ , 'hide_wp_generator' ) );
62
63 add_action( 'wp' , array( __CLASS__ , 'hide_wlwmanifest_link' ) );
64
65 add_action( 'wp' , array( __CLASS__ , 'hide_rsd_link' ) );
66
67 add_action( 'wp' , array( __CLASS__ , 'hide_feed_links' ) );
68
69 add_action( 'wp' , array( __CLASS__ , 'hide_feed_links_extra' ) );
70
71 add_action( 'wp_head' , array( __CLASS__ , 'wp_head' ) );
72
73 }
74
75 public static function show_admin_bar() {
76
77 if( ! self::is_do_function( __FUNCTION__ ) ) {
78
79 return false;
80
81 }
82
83 $setting_data = self::get_setting_data();
84
85 if( empty( $setting_data['admin_bar'] ) ) {
86
87 return false;
88
89 }
90
91 if( $setting_data['admin_bar'] === 'hide' ) {
92
93 show_admin_bar( false );
94
95 } elseif( $setting_data['admin_bar'] === 'show' ) {
96
97 show_admin_bar( true );
98
99 }
100
101 self::after_do_function( __FUNCTION__ );
102
103 }
104
105 public static function hide_wp_generator() {
106
107 if( ! self::is_do_function( __FUNCTION__ ) ) {
108
109 return false;
110
111 }
112
113 $setting_data = self::get_setting_data();
114
115 if( empty( $setting_data['hide_wp_generator'] ) ) {
116
117 return false;
118
119 }
120
121 remove_action( 'wp_head' , 'wp_generator' );
122
123 self::after_do_function( __FUNCTION__ );
124
125 }
126
127 public static function hide_wlwmanifest_link() {
128
129 if( ! self::is_do_function( __FUNCTION__ ) ) {
130
131 return false;
132
133 }
134
135 $setting_data = self::get_setting_data();
136
137 if( empty( $setting_data['hide_wlwmanifest_link'] ) ) {
138
139 return false;
140
141 }
142
143 remove_action( 'wp_head' , 'wlwmanifest_link' );
144
145 self::after_do_function( __FUNCTION__ );
146
147 }
148
149 public static function hide_rsd_link() {
150
151 if( ! self::is_do_function( __FUNCTION__ ) ) {
152
153 return false;
154
155 }
156
157 $setting_data = self::get_setting_data();
158
159 if( empty( $setting_data['hide_rsd_link'] ) ) {
160
161 return false;
162
163 }
164
165 remove_action( 'wp_head' , 'rsd_link' );
166
167 self::after_do_function( __FUNCTION__ );
168
169 }
170
171 public static function hide_feed_links() {
172
173 if( ! self::is_do_function( __FUNCTION__ ) ) {
174
175 return false;
176
177 }
178
179 $setting_data = self::get_setting_data();
180
181 if( empty( $setting_data['hide_feed_links'] ) ) {
182
183 return false;
184
185 }
186
187 remove_action( 'wp_head' , 'feed_links' , 2 );
188
189 self::after_do_function( __FUNCTION__ );
190
191 }
192
193 public static function hide_feed_links_extra() {
194
195 if( ! self::is_do_function( __FUNCTION__ ) ) {
196
197 return false;
198
199 }
200
201 $setting_data = self::get_setting_data();
202
203 if( empty( $setting_data['hide_feed_links_extra'] ) ) {
204
205 return false;
206
207 }
208
209 remove_action( 'wp_head' , 'feed_links_extra' , 3 );
210
211 self::after_do_function( __FUNCTION__ );
212
213 }
214
215 public static function wp_head() {
216
217 if( ! self::is_do_function( __FUNCTION__ ) ) {
218
219 return false;
220
221 }
222
223 $setting_data = self::get_setting_data();
224
225 if( empty( $setting_data['custom_header_meta'] ) ) {
226
227 return false;
228
229 }
230
231 $custom_header_meta = do_shortcode( $setting_data['custom_header_meta'] );
232
233 echo $custom_header_meta;
234
235 self::after_do_function( __FUNCTION__ );
236
237 }
238
239 }
240
241 MywpControllerModuleFrontendGeneral::init();
242
243 endif;
244