PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.0
Adminify – White Label, Admin Menu Editor, Login Customizer v4.0
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
← All changes | Inc/Classes/AdminFooterText.php +40 -105 4.3.04.0 View file →
@@ -1,11 +1,12 @@
1 1 <?php
2 2
3 -namespace PXLBSAdminify\Inc\Classes;
3 +namespace WPAdminify\Inc\Classes;
4 4
5 -use PXLBSAdminify\Inc\Classes\ServerInfo;
6 -use PXLBSAdminify\Inc\Admin\AdminSettings;
7 -use PXLBSAdminify\Inc\Admin\AdminSettingsModel;
5 +use WPAdminify\Inc\Utils;
6 +use WPAdminify\Inc\Classes\ServerInfo;
7 +use WPAdminify\Inc\Admin\AdminSettings;
8 +use WPAdminify\Inc\Admin\AdminSettingsModel;
8 9
9 10
10 11 // no direct access allowed.
11 12 if (!defined('ABSPATH')) {
@@ -27,66 +28,33 @@
27 28 */
28 29 public $server_info;
29 30
30 31 /**
31 - * Default admin_footer_text value supplied by WordPress core.
32 - *
33 - * Captured via the admin_footer_text filter at an early priority before
34 - * the plugin overrides it, so the standard "Thank you for creating with
35 - * WordPress." string can be rendered when the credit option is disabled
36 - * without hardcoding a copy of that string in the plugin.
37 - *
38 - * @var string
39 - */
40 - protected static $wp_default_footer_text = '';
41 -
42 - /**
43 32 * Constructor
44 33 */
45 34 public function __construct()
46 35 {
36 + if(!empty(AdminSettings::get_instance()->get('white_label')['wordpress']['admin_footer'])){
37 + $this->options = (array) AdminSettings::get_instance()->get('white_label')['wordpress']['admin_footer'];
38 + }
47 39
48 - $this->options = (array) AdminSettings::get_instance()->get();
49 - $this->options = !empty($this->options['white_label']['wordpress']['admin_footer']) ? $this->options['white_label']['wordpress']['admin_footer'] : '';
50 -
51 40 // Remove Admin Footer Version Number
52 41 if (!empty($this->options) && in_array('wp_version', $this->options)) {
53 42 add_action('admin_menu', [$this, 'remove_admin_footer_version']);
54 43 }
55 44
56 - add_action('admin_menu', [$this, 'footer_version_remove']);
57 - add_action('network_admin_menu', [$this, 'footer_version_remove']);
45 + add_action('admin_menu', [$this, 'jltwp_adminify_footer_version_remove']);
46 + add_action('network_admin_menu', [$this, 'jltwp_adminify_footer_version_remove']);
58 47 /** Admin Footer */
59 - add_filter('update_footer', [$this, 'change_admin_footer'], 10, 3);
48 + add_filter('update_footer', [$this, 'jltwp_adminify_change_admin_footer'], 10, 3);
60 49
61 - // Capture WordPress core's default admin_footer_text before
62 - // suppressing it, so we can re-render it when the plugin's
63 - // "Show Footer Credit" option is disabled.
64 - add_filter('admin_footer_text', [$this, 'capture_wp_default_footer_text'], 1);
50 + add_filter( 'admin_footer_text', '__return_false' );
65 51
66 - add_filter( 'admin_footer_text', '__return_false', 999 );
67 - add_filter( 'update_footer', '__return_false', 999 );
68 -
69 52 $this->server_info = new ServerInfo();
70 53 }
71 54
72 - /**
73 - * Capture the default admin footer text WordPress passes into the
74 - * admin_footer_text filter, then return it unchanged.
75 - *
76 - * @param string $text
77 - * @return string
78 - */
79 - public function capture_wp_default_footer_text($text)
80 - {
81 - if (is_string($text) && $text !== '') {
82 - self::$wp_default_footer_text = $text;
83 - }
84 - return $text;
85 - }
86 55
87 56
88 -
89 57 /**
90 58 * Remove WordPress version
91 59 *
92 60 * @return void
@@ -99,44 +67,30 @@
99 67 }
100 68 }
101 69
102 70
103 - // function footer_get_options()
71 + // function jltwp_adminify_footer_get_options()
104 72 // {
105 73 // $objects = isset($this->options) && is_array($this->options) ? $this->options : [];
106 74 // return $objects;
107 75 // }
108 76
109 - public function footer_version_remove()
77 + public function jltwp_adminify_footer_version_remove()
110 78 {
111 79 remove_filter('update_footer', 'core_update_footer');
112 80 }
113 81
114 - /**
115 - * Default footer credit markup.
116 - *
117 - * Single source of truth for the "Developed by / Powered by" string,
118 - * used both as the default value of the white-label footer text option
119 - * and as the rendered fallback when the option is empty.
120 - *
121 - * @return string
122 - */
123 - public static function get_default_footer_credit()
124 - {
125 - return sprintf(
126 - /* translators: 1: WP Adminify website URL, 2: Plugin label, 3: WordPress.org URL */
127 - __('<p>Developed by <a href="%1$s" target="_blank" title="Adminify by Jewel Theme">%2$s</a></p> <p>Powered by <a target="_blank" href="%3$s">WordPress</a></p>', 'adminify'),
128 - esc_url('https://wpadminify.com/'),
129 - AdminSettings::get_pro_label(),
130 - esc_url('https://wordpress.org/')
131 - );
132 - }
133 -
134 82 /** Footer Credits */
135 - public function footer_credits()
136 - { ?>
83 + public function jltwp_adminify_footer_credits()
84 + { ?>
137 85 <div class="adminify-copyright">
138 - <?php echo wp_kses_post(self::get_default_footer_credit()); ?>
86 + <?php
87 + echo sprintf( __('<p>Developed by <a href="%1$s" target="_blank" title="WP Adminify by Jewel Theme" target="_blank">%2$s</a></p> <p>Powered by <a target="_blank" href="%3$s">WordPress</a></p>', 'adminify'),
88 + esc_url('https://wpadminify.com/'),
89 + __('WP Adminify', 'adminify'),
90 + esc_url( 'https://wordpress.org/' )
91 + );
92 + ?>
139 93 </div>
140 94 <?php
141 95 }
142 96
@@ -144,25 +98,8 @@
144 98 public function change_admin_footer_text()
145 99 {
146 100 $footer_text = (array) AdminSettings::get_instance()->get();
147 101
148 - // Attribution is opt-in only. When the site admin has not enabled
149 - // the "Show Footer Credit" option, fall back to the standard
150 - // WordPress admin footer text instead of plugin credits.
151 - $show_credit = !empty($footer_text['white_label']['wordpress']['show_footer_credit']);
152 - if (!$show_credit) {
153 - $wp_default = self::$wp_default_footer_text;
154 - if ($wp_default === '') {
155 - return;
156 - }
157 - ?>
158 - <div class="adminify-footer-left">
159 - <?php echo wp_kses_post($wp_default); ?>
160 - </div>
161 - <?php
162 - return;
163 - }
164 -
165 102 if (!empty($footer_text['white_label']['wordpress']['footer_text'])) { ?>
166 103 <div class="adminify-footer-left">
167 104 <?php echo wp_kses_post($footer_text['white_label']['wordpress']['footer_text']); ?>
168 105 </div>
@@ -168,19 +105,17 @@
168 105 </div>
169 106 <?php
170 107 return;
171 108 }
172 -
173 109 // Change the content of the left admin footer text.
174 - apply_filters('pxlbsadminify_footer_credits', $this->footer_credits());
110 + apply_filters('jltwp_adminify_footer_credits', $this->jltwp_adminify_footer_credits());
175 111 }
176 112
177 113
178 -
179 114 /**
180 115 * IP Address
181 116 */
182 - public function ip_address() { ?>
117 + public function adminify_ip_address() { ?>
183 118 <div class="adminify-system-info">
184 119 <?php
185 120 if (is_rtl()) {
186 121 echo sprintf(
@@ -203,9 +138,9 @@
203 138
204 139 /**
205 140 * PHP Version
206 141 */
207 - public function php_version() { ?>
142 + public function adminify_php_version() { ?>
208 143 <div class="adminify-system-info">
209 144 <?php
210 145 if (is_rtl()) {
211 146 echo sprintf(
@@ -227,9 +162,9 @@
227 162
228 163 /**
229 164 * WordPress Version
230 165 */
231 - public function default_wp_version() { ?>
166 + public function adminify_wp_version() { ?>
232 167 <div class="adminify-system-info">
233 168 <?php
234 169 if (is_rtl()) {
235 170 echo sprintf(
@@ -251,14 +186,14 @@
251 186
252 187 /**
253 188 * Memory Usage
254 189 */
255 - public function memory_usage() {
190 + public function adminify_memory_usage() {
256 191 $memory_usage = $this->server_info->get_wp_memory_usage();
257 192 $memory_limit = $memory_usage['MemLimitFormat'];
258 193 $memory_usage_format = $memory_usage['MemUsageFormat'];
259 194 // $memory_usage_percentage = $memory_usage['MemUsageCalc'];
260 - $memory_usage_percentage = ServerInfo::memory_usage_percentage();
195 + $memory_usage_percentage = ServerInfo::wp_memory_usage_percentage();
261 196
262 197 if ($memory_usage_percentage <= 65) {
263 198 $memory_status = '#00BA88';
264 199 } elseif ($memory_usage_percentage > 65 && $memory_usage_percentage < 85) {
@@ -295,11 +230,10 @@
295 230
296 231 /**
297 232 * Memory Limit
298 233 */
299 - public function memory_limit() {
234 + public function adminify_memory_limit() {
300 235 $memory_limit = $this->server_info->get_wp_memory_usage();
301 -
302 236 $memory_limit = $memory_limit['MemLimitFormat']; ?>
303 237
304 238 <div class="adminify-system-info">
305 239 <?php
@@ -324,9 +258,9 @@
324 258
325 259 /**
326 260 * Memory Limit
327 261 */
328 - public function memory_available() {
262 + public function adminify_memory_available() {
329 263 $memory_available = $this->server_info->get_wp_memory_usage();
330 264 $memory_available = rtrim($memory_available['MemLimitGet'], 'MB') - rtrim($memory_available['MemUsageFormat'], 'MB'); ?>
331 265
332 266 <div class="adminify-system-info">
@@ -350,12 +284,12 @@
350 284 }
351 285
352 286
353 287 /** Admin Footer Text **/
354 - public function change_admin_footer($footer_text) { ?>
288 + public function jltwp_adminify_change_admin_footer($footer_text) { ?>
355 289
356 290 <div class="adminify--footer">
357 - <?php $this->change_admin_footer_text();
291 + <?php echo $this->change_admin_footer_text();
358 292 if ( !empty($this->options) ) { ?>
359 293
360 294 <div class="adminify-footer-right">
361 295 <div class="adminify-system-info-col">
@@ -360,17 +294,17 @@
360 294 <div class="adminify-footer-right">
361 295 <div class="adminify-system-info-col">
362 296 <?php
363 297 if ( in_array('ip_address', $this->options ) ) {
364 - $this->ip_address();
298 + $this->adminify_ip_address();
365 299 }
366 300
367 301 if ( in_array('php_version', $this->options ) ) {
368 - $this->php_version();
302 + $this->adminify_php_version();
369 303 }
370 304
371 305 if ( in_array('wp_version', $this->options ) ) {
372 - $this->default_wp_version();
306 + $this->adminify_wp_version();
373 307 }
374 308 ?>
375 309 </div>
376 310 <div class="adminify-system-info-col">
@@ -375,21 +309,22 @@
375 309 </div>
376 310 <div class="adminify-system-info-col">
377 311 <?php
378 312 if ( in_array('memory_usage', $this->options ) ) {
379 - $this->memory_usage();
313 + $this->adminify_memory_usage();
380 314 }
381 315
382 316 if ( in_array('memory_limit', $this->options ) ) {
383 - $this->memory_limit();
317 + $this->adminify_memory_limit();
384 318 }
385 319
386 320 if ( in_array('memory_available', $this->options ) ) {
387 - $this->memory_available();
321 + $this->adminify_memory_available();
388 322 }
389 323 ?>
390 324 </div>
391 325 </div>
326 +
392 327 <?php return $footer_text;
393 328 } ?>
394 329 </div>
395 330 <?php