PluginProbe
Easy Hotel – Powerful Hotel Booking / trunk
Easy Hotel – Powerful Hotel Booking vtrunk
2.0.8 2.0.7 2.0.6 2.0.5 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.9.9 1.9.8 1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 All 110 releases
easy-hotel / public / includes / dynamic-css.php

dynamic-css.php in Easy Hotel – Powerful Hotel Booking trunk, at public/includes/dynamic-css.php

127 lines 5.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3 $eshb_settings = get_option( 'eshb_settings' );
4 add_action( 'wp_enqueue_scripts', 'eshb_dynamic_css' );
5 function eshb_dynamic_css() {
6
7 $eshb_settings = get_option( 'eshb_settings' );
8 $theme_colors = is_array($eshb_settings['theme-colors']) && count($eshb_settings['theme-colors']) > 0 ? $eshb_settings['theme-colors'] : '';
9 $primary_color = !empty($theme_colors['primary-color']) ? $theme_colors['primary-color'] : '';
10 $secondary_color = !empty($theme_colors['secondary-color']) ? $theme_colors['secondary-color'] : '';
11 $territory_color = !empty($theme_colors['territory-color']) ? $theme_colors['territory-color'] : '';
12 $success_color = !empty($theme_colors['success-color']) ? $theme_colors['success-color'] : '';
13 $danger_color = !empty($theme_colors['danger-color']) ? $theme_colors['danger-color'] : '';
14 $dark_color = !empty($theme_colors['dark-color']) ? $theme_colors['dark-color'] : '';
15 $text_color = !empty($theme_colors['text-color']) ? $theme_colors['text-color'] : '';
16 $white_color = !empty($theme_colors['white-color']) ? $theme_colors['white-color'] : '';
17 $border_color = !empty($theme_colors['border-color']) ? $theme_colors['border-color'] : '';
18
19 $calendar_colors = !empty($eshb_settings['calendar-colors']) && is_array($eshb_settings['calendar-colors']) && count($eshb_settings['calendar-colors']) > 0 ? $eshb_settings['calendar-colors'] : '';
20 $booked_bg_color = !empty($calendar_colors['booked-bg-color']) ? $calendar_colors['booked-bg-color'] : '#bebcbb';
21 $active_bg_color = !empty($calendar_colors['active-bg-color']) ? $calendar_colors['active-bg-color'] : '#ab8965';
22 $inrange_bg_color = !empty($calendar_colors['inrange-bg-color']) ? $calendar_colors['inrange-bg-color'] : '#181818';
23
24 $booked_color = !empty($calendar_colors['booked-color']) ? $calendar_colors['booked-color'] : '#181818';
25 $active_color = !empty($calendar_colors['active-color']) ? $calendar_colors['active-color'] : '#fff';
26 $inrange_color = !empty($calendar_colors['inrange-color']) ? $calendar_colors['inrange-color'] : '#fff';
27
28 $reserved_bg_color = !empty($calendar_colors['reserved-bg-color']) ? $calendar_colors['reserved-bg-color'] : '#70533a';
29 $reserved_color = !empty($calendar_colors['reserved-color']) ? $calendar_colors['reserved-color'] : '#fff';
30
31 $page_padding = !empty($eshb_settings['page-spacing']) ? $eshb_settings['page-spacing'] : '';
32 $page_container_size = !empty($eshb_settings['page-container-size']) ? $eshb_settings['page-container-size'] : '';
33
34 $custom_css = "";
35
36 if (!empty($theme_colors)) {
37 $custom_css .= "
38 :root {
39 --eshb-primary-color: " . esc_attr($primary_color) . ";
40 --eshb-secondary-color: " . esc_attr($secondary_color) . ";
41 --eshb-territory-color: " . esc_attr($territory_color) . ";
42 --eshb-success-color: " . esc_attr($success_color) . ";
43 --eshb-danger-color: " . esc_attr($danger_color) . ";
44 --eshb-dark-color: " . esc_attr($dark_color) . ";
45 --eshb-text-color: " . esc_attr($text_color) . ";
46 --eshb-white-color: " . esc_attr($white_color) . ";
47 --eshb-border-color: " . esc_attr($border_color) . ";
48 }
49 ";
50 }
51
52 if (!empty($calendar_colors)) {
53 $custom_css .= "
54 :root {
55 --eshb-booked-bg-color: " . esc_attr($booked_bg_color) . ";
56 --eshb-active-bg-color: " . esc_attr($active_bg_color) . ";
57 --eshb-inrange-bg-color: " . esc_attr($inrange_bg_color) . ";
58 --eshb-booked-color: " . esc_attr($booked_color) . ";
59 --eshb-active-color: " . esc_attr($active_color) . ";
60 --eshb-inrange-color: " . esc_attr($inrange_color) . ";
61 --eshb-reserved-bg-color: " . esc_attr($reserved_bg_color) . ";
62 --eshb-reserved-color: " . esc_attr($reserved_color) . ";
63 }
64 ";
65 }
66
67 if(!empty($page_padding)) {
68 $custom_css .= "
69 .eshb-archive-wrapper.eshb-container, .eshb-details-page .eshb-container {";
70
71 if(!empty($page_padding['top'])) {
72 $custom_css .= "padding-top: " . esc_attr($page_padding['top']) . "px;";
73 }
74 if(!empty($page_padding['bottom'])) {
75 $custom_css .= "padding-bottom: " . esc_attr($page_padding['bottom']) . "px;";
76 }
77
78 $custom_css .= "
79 }
80 ";
81 }
82
83 if(!empty($page_container_size)) {
84 $custom_css .= "
85 .eshb-container {";
86
87 if(!empty($page_container_size['width'])) {
88 $custom_css .= "max-width: " . esc_attr($page_container_size['width']) . "px;";
89 }
90
91 $custom_css .= "
92 }
93 ";
94 }
95
96 if(defined('ELEMENTOR_VERSION')) {
97 $custom_css .= "
98 body.single .accomodation-gallery .swiper-button-prev svg {
99 rotate: 180deg;
100 }
101 ";
102 }
103
104 wp_add_inline_style('eshb-style', $custom_css);
105 }
106
107
108
109 add_action( 'elementor/editor/after_enqueue_scripts', function() {
110 ?>
111 <style>
112 .elementor-panel .easy-hotel-widget-icon {
113 background-image: url('<?php echo esc_url( ESHB_DIR_URL . 'public/assets/img/easy-hotel-icon.png' ); ?>');
114 background-size: cover;
115 background-position: center;
116 width: 20px;
117 height: 20px;
118 display: inline-block;
119 }
120
121 .elementor-panel .easy-hotel-widget-icon:before {
122 content: "";
123 display: none;
124 }
125 </style>
126 <?php
127 });