| @@ -1,399 +1,313 @@ | ||
| 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 | -// no direct access allowed. | |
| 11 | -if (!defined('ABSPATH')) { | |
| 12 | - exit; | |
| 13 | -} | |
| 11 | +// no direct access allowed | |
| 12 | +if (!defined('ABSPATH')) exit; | |
| 14 | 13 | |
| 15 | 14 | /** |
| 16 | - * Admin footer text | |
| 17 | - * | |
| 18 | 15 | * @package WP Adminify |
| 19 | 16 | * @author: Jewel Theme<[email protected]> |
| 20 | 17 | */ |
| 18 | + | |
| 21 | 19 | class AdminFooterText extends AdminSettingsModel |
| 22 | 20 | { |
| 23 | - /** | |
| 24 | - * Server Info | |
| 25 | - * | |
| 26 | - * @var $server_info | |
| 27 | - */ | |
| 28 | - public $server_info; | |
| 21 | + public $server_info; | |
| 29 | 22 | |
| 30 | - /** | |
| 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 | - * Constructor | |
| 44 | - */ | |
| 45 | - public function __construct() | |
| 46 | - { | |
| 47 | - | |
| 23 | + public function __construct() | |
| 24 | + { | |
| 48 | 25 | $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 | 26 | |
| 51 | - // Remove Admin Footer Version Number | |
| 52 | - if (!empty($this->options) && in_array('wp_version', $this->options)) { | |
| 53 | - add_action('admin_menu', [$this, 'remove_admin_footer_version']); | |
| 54 | - } | |
| 27 | + $restrict_for = !empty($this->options['admin_footer_user_roles']) ? $this->options['admin_footer_user_roles'] : ''; | |
| 28 | + if ($restrict_for) { | |
| 29 | + add_filter('admin_footer_text', [$this, 'jltwp_adminify_change_admin_footer_text']); | |
| 30 | + return; | |
| 31 | + } | |
| 55 | 32 | |
| 56 | - add_action('admin_menu', [$this, 'footer_version_remove']); | |
| 57 | - add_action('network_admin_menu', [$this, 'footer_version_remove']); | |
| 58 | - /** Admin Footer */ | |
| 59 | - add_filter('update_footer', [$this, 'change_admin_footer'], 10, 3); | |
| 60 | 33 | |
| 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); | |
| 34 | + add_action('admin_menu', [$this, 'jltwp_adminify_footer_version_remove']); | |
| 35 | + add_action('network_admin_menu', [$this, 'jltwp_adminify_footer_version_remove']); | |
| 65 | 36 | |
| 66 | - add_filter( 'admin_footer_text', '__return_false', 999 ); | |
| 67 | - add_filter( 'update_footer', '__return_false', 999 ); | |
| 37 | + $this->adminify_footer_text_init(); | |
| 68 | 38 | |
| 69 | - $this->server_info = new ServerInfo(); | |
| 70 | - } | |
| 39 | + $this->server_info = new ServerInfo(); | |
| 40 | + } | |
| 71 | 41 | |
| 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 | - } | |
| 42 | + public function jltwp_adminify_footer_version_remove() | |
| 43 | + { | |
| 44 | + remove_filter('update_footer', 'core_update_footer'); | |
| 45 | + } | |
| 86 | 46 | |
| 47 | + public function adminify_footer_text_init() | |
| 48 | + { | |
| 49 | + /** Admin Footer Credits Text **/ | |
| 50 | + add_filter('update_footer', [$this, 'jltwp_adminify_change_admin_footer'], 10, 3); | |
| 87 | 51 | |
| 52 | + // Footer Right Info | |
| 53 | + add_filter('admin_footer_text', [$this, 'jltwp_adminify_change_admin_footer_text']); | |
| 54 | + } | |
| 88 | 55 | |
| 89 | - /** | |
| 90 | - * Remove WordPress version | |
| 91 | - * | |
| 92 | - * @return void | |
| 93 | - */ | |
| 94 | - public function remove_admin_footer_version() | |
| 95 | - { | |
| 96 | - // Remove WordPress Version except Admin | |
| 97 | - if (!current_user_can('manage_options')) { | |
| 98 | - remove_filter('update_footer', 'core_update_footer'); | |
| 99 | - } | |
| 100 | - } | |
| 56 | + /** Footer Credits */ | |
| 57 | + public function jltwp_adminify_footer_credits() | |
| 58 | + { ?> | |
| 59 | + <div class="wp-adminify adminify-first-child"> | |
| 60 | + <div class="wp-adminify--copyright"> | |
| 61 | + <?php | |
| 62 | + echo sprintf( | |
| 63 | + __('Developed by <a href="%s" target="_blank" title="WP Adminify by Jewel Theme" target="_blank">WP Adminify</a> <br> | |
| 64 | + Powered by <a target="_blank" href="%s">WordPress</a>', 'adminify'), | |
| 65 | + esc_url('https://wpadminify.com/'), | |
| 66 | + esc_url('https://wordpress.org/') | |
| 67 | + ); | |
| 68 | + ?> | |
| 69 | + </div> | |
| 70 | + </div> | |
| 71 | + <?php | |
| 72 | + } | |
| 101 | 73 | |
| 102 | 74 | |
| 103 | - // function footer_get_options() | |
| 104 | - // { | |
| 105 | - // $objects = isset($this->options) && is_array($this->options) ? $this->options : []; | |
| 106 | - // return $objects; | |
| 107 | - // } | |
| 75 | + public function jltwp_adminify_change_admin_footer_text() | |
| 76 | + { | |
| 77 | + $this->options = (array) AdminSettings::get_instance()->get(); | |
| 78 | + if (!empty($this->options['footer_text'])) { | |
| 79 | + echo $this->options['footer_text']; | |
| 80 | + return; | |
| 81 | + } | |
| 82 | + // Change the content of the left admin footer text. | |
| 83 | + apply_filters('jltwp_adminify_footer_credits', $this->jltwp_adminify_footer_credits()); | |
| 84 | + } | |
| 108 | 85 | |
| 109 | - public function footer_version_remove() | |
| 110 | - { | |
| 111 | - remove_filter('update_footer', 'core_update_footer'); | |
| 112 | - } | |
| 113 | 86 | |
| 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 | - } | |
| 87 | + /** | |
| 88 | + * IP Address | |
| 89 | + */ | |
| 90 | + public function adminify_ip_address() | |
| 91 | + { | |
| 92 | + if (!empty($this->options['admin_footer_ip_address'])) { | |
| 93 | + ?> | |
| 94 | + <div class="column has-text-right"> | |
| 95 | + <?php if (is_rtl()) { | |
| 96 | + echo sprintf( | |
| 97 | + '<span class="info-details">%2$s</span><span class="info-id is-uppercase">%1$s</span>', | |
| 98 | + esc_html__('IP: ', 'adminify'), | |
| 99 | + $this->server_info->get_ip_address() | |
| 100 | + ); | |
| 101 | + } else { | |
| 102 | + echo sprintf( | |
| 103 | + '<span class="info-id is-uppercase">%1$s</span><span class="info-details">%2$s</span>', | |
| 104 | + esc_html__('IP: ', 'adminify'), | |
| 105 | + $this->server_info->get_ip_address() | |
| 106 | + ); | |
| 107 | + } ?> | |
| 108 | + </div> | |
| 109 | + <?php | |
| 110 | + } | |
| 111 | + } | |
| 133 | 112 | |
| 134 | - /** Footer Credits */ | |
| 135 | - public function footer_credits() | |
| 136 | - { ?> | |
| 137 | - <div class="adminify-copyright"> | |
| 138 | - <?php echo wp_kses_post(self::get_default_footer_credit()); ?> | |
| 139 | - </div> | |
| 140 | - <?php | |
| 141 | - } | |
| 142 | 113 | |
| 114 | + /** | |
| 115 | + * PHP Version | |
| 116 | + */ | |
| 117 | + public function adminify_php_version() | |
| 118 | + { | |
| 119 | + if (!empty($this->options['admin_footer_php_version'])) { | |
| 120 | + ?> | |
| 121 | + <div class="column has-text-right"> | |
| 122 | + <?php if (is_rtl()) { | |
| 123 | + echo sprintf( | |
| 124 | + '<span class="info-details">%2$s</span><span class="info-id">%1$s</span>', | |
| 125 | + esc_html__('PHP: ', 'adminify'), | |
| 126 | + $this->server_info->get_php_version_lite() | |
| 127 | + ); | |
| 128 | + } else { | |
| 129 | + echo sprintf( | |
| 130 | + '<span class="info-id">%1$s</span><span class="info-details">%2$s</span>', | |
| 131 | + esc_html__('PHP: ', 'adminify'), | |
| 132 | + $this->server_info->get_php_version_lite() | |
| 133 | + ); | |
| 134 | + } ?> | |
| 135 | + </div> | |
| 136 | + <?php | |
| 137 | + } | |
| 138 | + } | |
| 143 | 139 | |
| 144 | - public function change_admin_footer_text() | |
| 145 | - { | |
| 146 | - $footer_text = (array) AdminSettings::get_instance()->get(); | |
| 140 | + /** | |
| 141 | + * WordPress Version | |
| 142 | + */ | |
| 143 | + public function adminify_wp_version() | |
| 144 | + { | |
| 145 | + if (!empty($this->options['admin_footer_wp_version'])) { | |
| 146 | + ?> | |
| 147 | + <div class="column has-text-right"> | |
| 148 | + <?php if (is_rtl()) { | |
| 149 | + echo sprintf( | |
| 150 | + '<span class="info-details">%2$s</span><span class="info-id">%1$s</span>', | |
| 151 | + esc_html__('WordPress: v', 'adminify'), | |
| 152 | + $this->server_info->get_wp_version() | |
| 153 | + ); | |
| 154 | + } else { | |
| 155 | + echo sprintf( | |
| 156 | + '<span class="info-id">%1$s</span><span class="info-details">%2$s</span>', | |
| 157 | + esc_html__('WordPress: v', 'adminify'), | |
| 158 | + $this->server_info->get_wp_version() | |
| 159 | + ); | |
| 160 | + } ?> | |
| 161 | + </div> | |
| 162 | + <?php | |
| 163 | + } | |
| 164 | + } | |
| 147 | 165 | |
| 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 | - } | |
| 166 | + /** | |
| 167 | + * Memory Usage | |
| 168 | + */ | |
| 169 | + public function adminify_memory_usage() | |
| 170 | + { | |
| 171 | + if (!empty($this->options['admin_footer_memory_usage'])) { | |
| 172 | + $memory_usage = $this->server_info->get_wp_memory_usage(); | |
| 173 | + $memory_limit = $memory_usage['MemLimitFormat']; | |
| 174 | + $memory_usage_format = $memory_usage['MemUsageFormat']; | |
| 175 | + // $memory_usage_percentage = $memory_usage['MemUsageCalc']; | |
| 176 | + $memory_usage_percentage = ServerInfo::wp_memory_usage_percentage(); | |
| 164 | 177 | |
| 165 | - if (!empty($footer_text['white_label']['wordpress']['footer_text'])) { ?> | |
| 166 | - <div class="adminify-footer-left"> | |
| 167 | - <?php echo wp_kses_post($footer_text['white_label']['wordpress']['footer_text']); ?> | |
| 168 | - </div> | |
| 169 | - <?php | |
| 170 | - return; | |
| 171 | - } | |
| 178 | + if ($memory_usage_percentage <= 65) { | |
| 179 | + $memory_status = '#00BA88'; | |
| 180 | + } elseif ($memory_usage_percentage > 65 && $memory_usage_percentage < 85) { | |
| 181 | + $memory_status = '#ffe08a'; | |
| 182 | + } elseif ($memory_usage_percentage > 85) { | |
| 183 | + $memory_status = '#f14668'; | |
| 184 | + } | |
| 185 | + ?> | |
| 186 | + <div class="column has-text-right"> | |
| 172 | 187 | |
| 173 | - // Change the content of the left admin footer text. | |
| 174 | - apply_filters('pxlbsadminify_footer_credits', $this->footer_credits()); | |
| 175 | - } | |
| 188 | + <?php if (is_rtl()) { | |
| 189 | + echo sprintf( | |
| 190 | + __('<span class="info-details">%2$s of %3$s <span class="percentage tag has-text-white is-rounded" style="background:%4$s">%5$s</span></span><span class="info-id">%1$s</span>', 'adminify'), | |
| 176 | 191 | |
| 192 | + esc_html__('WP Memory Usage: ', 'adminify'), | |
| 193 | + $memory_usage_format, | |
| 194 | + $memory_limit, | |
| 195 | + esc_html($memory_status), | |
| 196 | + $memory_usage_percentage . '%' | |
| 197 | + ); | |
| 198 | + } else { | |
| 199 | + echo sprintf( | |
| 200 | + __('<span class="info-id">%1$s</span><span class="info-details">%2$s of %3$s <span class="percentage tag has-text-white is-rounded" style="background:%4$s">%5$s</span></span>', 'adminify'), | |
| 201 | + esc_html__('WP Memory Usage: ', 'adminify'), | |
| 202 | + $memory_usage_format, | |
| 203 | + $memory_limit, | |
| 204 | + esc_html($memory_status), | |
| 205 | + $memory_usage_percentage . '%' | |
| 206 | + ); | |
| 207 | + } ?> | |
| 208 | + </span> | |
| 209 | + </div> | |
| 210 | + <?php | |
| 211 | + } | |
| 212 | + } | |
| 177 | 213 | |
| 214 | + /** | |
| 215 | + * Memory Limit | |
| 216 | + */ | |
| 217 | + public function adminify_memory_limit() | |
| 218 | + { | |
| 219 | + if (!empty($this->options['admin_footer_memory_limit'])) { | |
| 220 | + $memory_limit = $this->server_info->get_wp_memory_usage(); | |
| 221 | + $memory_limit = $memory_limit['MemLimitFormat']; | |
| 222 | + ?> | |
| 223 | + <div class="column has-text-right"> | |
| 224 | + <?php if (is_rtl()) { | |
| 225 | + echo sprintf( | |
| 226 | + '<span class="info-details">%2$s</span><span class="info-id">%1$s</span>', | |
| 227 | + esc_html__('WP Memory Limit: ', 'adminify'), | |
| 228 | + $memory_limit | |
| 229 | + ); | |
| 230 | + } else { | |
| 231 | + echo sprintf( | |
| 232 | + '<span class="info-id">%1$s</span><span class="info-details">%2$s</span>', | |
| 233 | + esc_html__('WP Memory Limit: ', 'adminify'), | |
| 234 | + $memory_limit | |
| 235 | + ); | |
| 236 | + } ?> | |
| 237 | + </div> | |
| 238 | + <?php | |
| 239 | + } | |
| 240 | + } | |
| 178 | 241 | |
| 179 | - /** | |
| 180 | - * IP Address | |
| 181 | - */ | |
| 182 | - public function ip_address() { ?> | |
| 183 | - <div class="adminify-system-info"> | |
| 184 | - <?php | |
| 185 | - if (is_rtl()) { | |
| 186 | - echo sprintf( | |
| 187 | - wp_kses_post('<span>%2$s</span><span>%1$s</span>'), | |
| 188 | - esc_html__('IP: ', 'adminify'), | |
| 189 | - esc_html($this->server_info->get_ip_address()) | |
| 190 | - ); | |
| 191 | - } else { | |
| 192 | - echo sprintf( | |
| 193 | - wp_kses_post('<span>%1$s</span><span>%2$s</span>'), | |
| 194 | - esc_html__('IP: ', 'adminify'), | |
| 195 | - esc_html($this->server_info->get_ip_address()) | |
| 196 | - ); | |
| 197 | - } | |
| 198 | - ?> | |
| 199 | - </div> | |
| 200 | - <?php | |
| 201 | - } | |
| 202 | 242 | |
| 243 | + /** | |
| 244 | + * Memory Limit | |
| 245 | + */ | |
| 246 | + public function adminify_memory_available() | |
| 247 | + { | |
| 248 | + if (!empty($this->options['admin_footer_memory_available'])) { | |
| 249 | + $memory_available = $this->server_info->get_wp_memory_usage(); | |
| 250 | + $memory_available = $memory_available['MemLimitGet']; | |
| 251 | + ?> | |
| 252 | + <div class="column has-text-right"> | |
| 253 | + <?php if (is_rtl()) { | |
| 254 | + echo sprintf( | |
| 255 | + '<span class="info-details is-uppercase">%2$s</span><span class="info-id">%1$s</span>', | |
| 256 | + esc_html__('WP Memory Available: ', 'adminify'), | |
| 257 | + $memory_available | |
| 258 | + ); | |
| 259 | + } else { | |
| 260 | + echo sprintf( | |
| 261 | + '<span class="info-id">%1$s</span><span class="info-details is-uppercase">%2$s</span>', | |
| 262 | + esc_html__('WP Memory Available: ', 'adminify'), | |
| 263 | + $memory_available | |
| 264 | + ); | |
| 265 | + } ?> | |
| 266 | + </div> | |
| 267 | + <?php | |
| 268 | + } | |
| 269 | + } | |
| 203 | 270 | |
| 204 | - /** | |
| 205 | - * PHP Version | |
| 206 | - */ | |
| 207 | - public function php_version() { ?> | |
| 208 | - <div class="adminify-system-info"> | |
| 209 | - <?php | |
| 210 | - if (is_rtl()) { | |
| 211 | - echo sprintf( | |
| 212 | - '<span>%2$s</span><span>%1$s</span>', | |
| 213 | - esc_html__('PHP: ', 'adminify'), | |
| 214 | - esc_html($this->server_info->get_php_version_lite()) | |
| 215 | - ); | |
| 216 | - } else { | |
| 217 | - echo sprintf( | |
| 218 | - '<span>%1$s</span><span>%2$s</span>', | |
| 219 | - esc_html__('PHP: ', 'adminify'), | |
| 220 | - esc_html($this->server_info->get_php_version_lite()) | |
| 221 | - ); | |
| 222 | - } | |
| 223 | - ?> | |
| 224 | - </div> | |
| 225 | - <?php | |
| 226 | - } | |
| 271 | + /** Admin Footer Text **/ | |
| 272 | + public function jltwp_adminify_change_admin_footer($footer_text) | |
| 273 | + { | |
| 274 | + if ( | |
| 275 | + !empty($this->options['admin_footer_memory_usage']) || | |
| 276 | + !empty($this->options['admin_footer_memory_limit']) || | |
| 277 | + !empty($this->options['admin_footer_memory_available']) || | |
| 278 | + !empty($this->options['admin_footer_ip_address']) || | |
| 279 | + !empty($this->options['admin_footer_php_version']) || | |
| 280 | + !empty($this->options['admin_footer_wp_version']) | |
| 281 | + ) { | |
| 282 | + ?> | |
| 283 | + <div class="wp-adminify adminify-last-child"> | |
| 227 | 284 | |
| 228 | - /** | |
| 229 | - * WordPress Version | |
| 230 | - */ | |
| 231 | - public function default_wp_version() { ?> | |
| 232 | - <div class="adminify-system-info"> | |
| 233 | - <?php | |
| 234 | - if (is_rtl()) { | |
| 235 | - echo sprintf( | |
| 236 | - '<span>%2$s</span><span>%1$s</span>', | |
| 237 | - esc_html__('WordPress: v', 'adminify'), | |
| 238 | - esc_html($this->server_info->get_wp_version()) | |
| 239 | - ); | |
| 240 | - } else { | |
| 241 | - echo sprintf( | |
| 242 | - '<span>%1$s</span><span>%2$s</span>', | |
| 243 | - esc_html__('WordPress: v', 'adminify'), | |
| 244 | - esc_html($this->server_info->get_wp_version()) | |
| 245 | - ); | |
| 246 | - } | |
| 247 | - ?> | |
| 248 | - </div> | |
| 249 | - <?php | |
| 250 | - } | |
| 285 | + <div class="system-info has-text-right"> | |
| 286 | + <div class="info-line-1"> | |
| 251 | 287 | |
| 252 | - /** | |
| 253 | - * Memory Usage | |
| 254 | - */ | |
| 255 | - public function memory_usage() { | |
| 256 | - $memory_usage = $this->server_info->get_wp_memory_usage(); | |
| 257 | - $memory_limit = $memory_usage['MemLimitFormat']; | |
| 258 | - $memory_usage_format = $memory_usage['MemUsageFormat']; | |
| 259 | - // $memory_usage_percentage = $memory_usage['MemUsageCalc']; | |
| 260 | - $memory_usage_percentage = ServerInfo::memory_usage_percentage(); | |
| 288 | + <?php | |
| 289 | + $this->adminify_ip_address(); | |
| 290 | + $this->adminify_php_version(); | |
| 291 | + $this->adminify_wp_version(); | |
| 292 | + ?> | |
| 293 | + </div> | |
| 261 | 294 | |
| 262 | - if ($memory_usage_percentage <= 65) { | |
| 263 | - $memory_status = '#00BA88'; | |
| 264 | - } elseif ($memory_usage_percentage > 65 && $memory_usage_percentage < 85) { | |
| 265 | - $memory_status = '#ffe08a'; | |
| 266 | - } elseif ($memory_usage_percentage > 85) { | |
| 267 | - $memory_status = '#f14668'; | |
| 268 | - } ?> | |
| 269 | - <div class="adminify-system-info"> | |
| 270 | - <?php | |
| 271 | - if (is_rtl()) { | |
| 272 | - echo sprintf( | |
| 273 | - wp_kses_post('<span>%2$s of %3$s <span class="adminify-info-status" style="background:%4$s">%5$s</span></span><span>%1$s</span>'), | |
| 274 | - esc_html__('WP Memory Usage: ', 'adminify'), | |
| 275 | - esc_html($memory_usage_format), | |
| 276 | - esc_html($memory_limit), | |
| 277 | - esc_html($memory_status), | |
| 278 | - esc_html($memory_usage_percentage) . '%' | |
| 279 | - ); | |
| 280 | - } else { | |
| 281 | - echo sprintf( | |
| 282 | - wp_kses_post('<span>%1$s</span><span>%2$s of %3$s <span class="adminify-info-status" style="background:%4$s">%5$s</span></span>'), | |
| 283 | - esc_html__('WP Memory Usage: ', 'adminify'), | |
| 284 | - esc_html($memory_usage_format), | |
| 285 | - esc_html($memory_limit), | |
| 286 | - esc_html($memory_status), | |
| 287 | - esc_html($memory_usage_percentage) . '%' | |
| 288 | - ); | |
| 289 | - } | |
| 290 | - ?> | |
| 291 | - </span> | |
| 292 | - </div> | |
| 293 | - <?php | |
| 294 | - } | |
| 295 | + <div class="info-line-2"> | |
| 296 | + <?php | |
| 297 | + $this->adminify_memory_usage(); | |
| 298 | + $this->adminify_memory_limit(); | |
| 299 | + $this->adminify_memory_available(); | |
| 300 | + ?> | |
| 295 | 301 | |
| 296 | - /** | |
| 297 | - * Memory Limit | |
| 298 | - */ | |
| 299 | - public function memory_limit() { | |
| 300 | - $memory_limit = $this->server_info->get_wp_memory_usage(); | |
| 302 | + </div> | |
| 303 | + </div> | |
| 301 | 304 | |
| 302 | - $memory_limit = $memory_limit['MemLimitFormat']; ?> | |
| 305 | + </div> | |
| 306 | +<?php | |
| 307 | + return $footer_text; | |
| 308 | + } | |
| 303 | 309 | |
| 304 | - <div class="adminify-system-info"> | |
| 305 | - <?php | |
| 306 | - if (is_rtl()) { | |
| 307 | - echo sprintf( | |
| 308 | - '<span>%2$s</span><span>%1$s</span>', | |
| 309 | - esc_html__('WP Memory Limit: ', 'adminify'), | |
| 310 | - esc_html($memory_limit) | |
| 311 | - ); | |
| 312 | - } else { | |
| 313 | - echo sprintf( | |
| 314 | - '<span>%1$s</span><span>%2$s</span>', | |
| 315 | - esc_html__('WP Memory Limit: ', 'adminify'), | |
| 316 | - esc_html($memory_limit) | |
| 317 | - ); | |
| 318 | - } | |
| 319 | - ?> | |
| 320 | - </div> | |
| 321 | - <?php | |
| 322 | - } | |
| 323 | - | |
| 324 | - | |
| 325 | - /** | |
| 326 | - * Memory Limit | |
| 327 | - */ | |
| 328 | - public function memory_available() { | |
| 329 | - $memory_available = $this->server_info->get_wp_memory_usage(); | |
| 330 | - $memory_available = rtrim($memory_available['MemLimitGet'], 'MB') - rtrim($memory_available['MemUsageFormat'], 'MB'); ?> | |
| 331 | - | |
| 332 | - <div class="adminify-system-info"> | |
| 333 | - <?php | |
| 334 | - if (is_rtl()) { | |
| 335 | - echo sprintf( | |
| 336 | - '<span>%2$s</span><span>%1$s</span>', | |
| 337 | - esc_html__('WP Memory Available: ', 'adminify'), | |
| 338 | - esc_html($memory_available) | |
| 339 | - ); | |
| 340 | - } else { | |
| 341 | - echo sprintf( | |
| 342 | - '<span>%1$s</span><span>%2$s</span>', | |
| 343 | - esc_html__('WP Memory Available: ', 'adminify'), | |
| 344 | - esc_html($memory_available) | |
| 345 | - ); | |
| 346 | - } | |
| 347 | - ?>MB | |
| 348 | - </div> | |
| 349 | - <?php | |
| 350 | - } | |
| 351 | - | |
| 352 | - | |
| 353 | - /** Admin Footer Text **/ | |
| 354 | - public function change_admin_footer($footer_text) { ?> | |
| 355 | - | |
| 356 | - <div class="adminify--footer"> | |
| 357 | - <?php $this->change_admin_footer_text(); | |
| 358 | - if ( !empty($this->options) ) { ?> | |
| 359 | - | |
| 360 | - <div class="adminify-footer-right"> | |
| 361 | - <div class="adminify-system-info-col"> | |
| 362 | - <?php | |
| 363 | - if ( in_array('ip_address', $this->options ) ) { | |
| 364 | - $this->ip_address(); | |
| 365 | - } | |
| 366 | - | |
| 367 | - if ( in_array('php_version', $this->options ) ) { | |
| 368 | - $this->php_version(); | |
| 369 | - } | |
| 370 | - | |
| 371 | - if ( in_array('wp_version', $this->options ) ) { | |
| 372 | - $this->default_wp_version(); | |
| 373 | - } | |
| 374 | - ?> | |
| 375 | - </div> | |
| 376 | - <div class="adminify-system-info-col"> | |
| 377 | - <?php | |
| 378 | - if ( in_array('memory_usage', $this->options ) ) { | |
| 379 | - $this->memory_usage(); | |
| 380 | - } | |
| 381 | - | |
| 382 | - if ( in_array('memory_limit', $this->options ) ) { | |
| 383 | - $this->memory_limit(); | |
| 384 | - } | |
| 385 | - | |
| 386 | - if ( in_array('memory_available', $this->options ) ) { | |
| 387 | - $this->memory_available(); | |
| 388 | - } | |
| 389 | - ?> | |
| 390 | - </div> | |
| 391 | - </div> | |
| 392 | - <?php return $footer_text; | |
| 393 | - } ?> | |
| 394 | - </div> | |
| 395 | - <?php | |
| 396 | - // Nothing, return blank | |
| 397 | - return ''; | |
| 398 | - } | |
| 310 | + // Nothing, return blank | |
| 311 | + return ''; | |
| 312 | + } | |
| 399 | 313 | } |