PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 1.0.7
Adminify – White Label, Admin Menu Editor, Login Customizer v1.0.7
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
adminify / Inc / Classes / OutputCSS_Body.php

OutputCSS_Body.php in Adminify – White Label, Admin Menu Editor, Login Customizer 1.0.7, at Inc/Classes/OutputCSS_Body.php

50 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Classes;
4
5 use WPAdminify\Inc\Utils;
6 use WPAdminify\Inc\Admin\AdminSettings;
7 use WPAdminify\Inc\Admin\AdminSettingsModel;
8
9 // no direct access allowed
10 if (!defined('ABSPATH')) exit;
11 class OutputCSS_Body extends AdminSettingsModel
12 {
13 public $url;
14 public function __construct()
15 {
16 $this->options = (array) AdminSettings::get_instance()->get();
17 add_action('admin_enqueue_scripts', [$this, 'jltwp_adminify_output_body_styles'], 99);
18 }
19
20 public function jltwp_adminify_output_body_styles()
21 {
22 $jltwp_adminify_output_body_css = '';
23 $admin_bg_type = !empty($this->options['admin_general_bg']) ? $this->options['admin_general_bg'] : 'color';
24
25 // Background Types
26 $admin_bg_color = !empty($this->options['admin_general_bg_color']) ? $this->options['admin_general_bg_color'] : '';
27
28 // Background Types
29 if ($admin_bg_type) {
30 $jltwp_adminify_output_body_css .= 'html, body.wp-adminify{';
31
32 // Background Type: Color
33 if ($admin_bg_type == 'color') {
34 if (!empty($admin_bg_color)) {
35 $jltwp_adminify_output_body_css .= 'background-color: ' . esc_attr($admin_bg_color) . ';';
36 }
37 }
38
39 $jltwp_adminify_output_body_css .= '}';
40 }
41
42 // Combine the values from above and minifiy them.
43 $jltwp_adminify_output_body_css = preg_replace('#/\*.*?\*/#s', '', $jltwp_adminify_output_body_css);
44 $jltwp_adminify_output_body_css = preg_replace('/\s*([{}|:;,])\s+/', '$1', $jltwp_adminify_output_body_css);
45 $jltwp_adminify_output_body_css = preg_replace('/\s\s+(.*)/', '$1', $jltwp_adminify_output_body_css);
46
47 wp_add_inline_style('wp-adminify-admin', wp_strip_all_tags($jltwp_adminify_output_body_css));
48 }
49 }
50