| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.13 Free | |
| 4 | + * @version 2.1.23 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2026 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2024 FirePlugins All Rights Reserved | |
| 9 | 9 | * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | namespace FireBox\Core\FB\Styling; |
| @@ -57,9 +57,8 @@ | ||
| 57 | 57 | |
| 58 | 58 | $this->setInstanceCSS(); |
| 59 | 59 | $this->setDialogCSS(); |
| 60 | 60 | $this->setCloseButtonCSS(); |
| 61 | - $this->setFloatingButtonCSS(); | |
| 62 | 61 | } |
| 63 | 62 | |
| 64 | 63 | /** |
| 65 | 64 | * Returns all popup CSS. |
| @@ -74,10 +73,10 @@ | ||
| 74 | 73 | { |
| 75 | 74 | $finalcss = $this->getBreakpointCSS($breakpoint); |
| 76 | 75 | |
| 77 | 76 | // Update $responsive_css with final CSS |
| 78 | - $this->responsive_css[$breakpoint] = $finalcss; | |
| 79 | - | |
| 77 | + $this->responsive_css[$breakpoint] = $finalcss; | |
| 78 | + | |
| 80 | 79 | $css .= $finalcss; |
| 81 | 80 | } |
| 82 | 81 | |
| 83 | 82 | return $css; |
| @@ -89,10 +88,14 @@ | ||
| 89 | 88 | * @return void |
| 90 | 89 | */ |
| 91 | 90 | private function setInstanceCSS() |
| 92 | 91 | { |
| 93 | - $style = []; | |
| 92 | + $animation_duration = $this->box->params->get('duration') ? (float) $this->box->params->get('duration') : 0; | |
| 94 | 93 | |
| 94 | + $style = [ | |
| 95 | + 'animation-duration' => (float) $animation_duration . 's' | |
| 96 | + ]; | |
| 97 | + | |
| 95 | 98 | // Z-index |
| 96 | 99 | $zindex = $this->box->params->get('zindex', 99999) != 99999 ? $this->box->params->get('zindex') : null; |
| 97 | 100 | if (intval($zindex)) |
| 98 | 101 | { |
| @@ -102,8 +105,15 @@ | ||
| 102 | 105 | // Overlay blur |
| 103 | 106 | $overlay_enabled = (bool) $this->box->params->get('overlay'); |
| 104 | 107 | if ($overlay_enabled && $radius = $this->box->params->get('overlayblurradius', 0)) |
| 105 | 108 | { |
| 109 | + $radius = intval($radius) * 0.25; | |
| 110 | + // Limit blur | |
| 111 | + if ($radius > 60) | |
| 112 | + { | |
| 113 | + $radius = 60; | |
| 114 | + } | |
| 115 | + | |
| 106 | 116 | $style['backdrop-filter'] = 'blur(' . $radius . 'px)'; |
| 107 | 117 | $style['-webkit-backdrop-filter'] = 'blur(' . $radius . 'px)'; |
| 108 | 118 | } |
| 109 | 119 | |
| @@ -126,26 +136,20 @@ | ||
| 126 | 136 | private function setDialogCSS() |
| 127 | 137 | { |
| 128 | 138 | // Dialog CSS |
| 129 | 139 | $style = [ |
| 130 | - 'color' => $this->box->params->get('textcolor'), | |
| 140 | + 'color' => $this->box->params->get('textcolor'), | |
| 131 | 141 | ]; |
| 132 | 142 | |
| 133 | - $animation_duration = $this->box->params->get('animation_duration') ? (float) $this->box->params->get('animation_duration') : 0; | |
| 134 | - $style['animation-duration'] = (float) $animation_duration . 's'; | |
| 135 | - | |
| 136 | 143 | // Border |
| 137 | - // A truthy but non-scalar width (a Dimensions/ResponsiveControl value is an array) | |
| 138 | - // would reach trim(), which is a TypeError since PHP 8.0. Numeric widths must keep | |
| 139 | - // working, so this checks for scalars rather than only for strings. | |
| 140 | - $border_width_raw = $this->box->params->get('border.width', 0); | |
| 141 | - $border_width = is_scalar($border_width_raw) && $border_width_raw ? trim((string) $border_width_raw) : 0; | |
| 142 | - $border_style = is_string($this->box->params->get('border.style', 0)) ? trim($this->box->params->get('border.style', 0)) : ''; | |
| 143 | - $border_color = is_string($this->box->params->get('border.color')) ? trim($this->box->params->get('border.color')) : ''; | |
| 144 | + $border = is_string($this->box->params->get('bordertype', 'none')) ? trim($this->box->params->get('bordertype', 'none')) : 'none'; | |
| 145 | + $border_width = $this->box->params->get('borderwidth.value', 0) ? trim($this->box->params->get('borderwidth.value', 0)) : 0; | |
| 146 | + $border_unit = is_string($this->box->params->get('borderwidth.unit', 'px')) ? trim($this->box->params->get('borderwidth.unit', 'px')) : ''; | |
| 147 | + $border_color = is_string($this->box->params->get('bordercolor')) ? trim($this->box->params->get('bordercolor')) : ''; | |
| 144 | 148 | |
| 145 | - if (!empty($border_width) && !empty($border_style) && !empty($border_color)) | |
| 149 | + if (!($border === 'none' || empty($border_width) || empty($border_unit) || empty($border_color))) | |
| 146 | 150 | { |
| 147 | - $style['border'] = implode(' ' , [$border_width, $border_style, $border_color]); | |
| 151 | + $style['border'] = $border . ' ' . $border_width . $border_unit . ' ' . $border_color; | |
| 148 | 152 | } |
| 149 | 153 | |
| 150 | 154 | // Background |
| 151 | 155 | $background = $this->box->params->get('backgroundcolor'); |
| @@ -168,10 +172,17 @@ | ||
| 168 | 172 | } |
| 169 | 173 | |
| 170 | 174 | // Add CSS (non-responsive) to desktop breakpoint |
| 171 | 175 | $this->addCSS(CSSHelper::arrayToCSS($style), 'desktop', ' .fb-dialog'); |
| 172 | - | |
| 176 | + | |
| 177 | + /** | |
| 178 | + * Calculate Responsive CSS | |
| 179 | + * and add them to each breakpoint. | |
| 180 | + */ | |
| 173 | 181 | $css_properties = [ |
| 182 | + 'fontsize' => [ | |
| 183 | + 'prefix' => 'font-size' | |
| 184 | + ], | |
| 174 | 185 | 'width' => [], |
| 175 | 186 | 'height' => [], |
| 176 | 187 | 'padding' => [], |
| 177 | 188 | 'borderradius' => [ |
| @@ -176,14 +187,9 @@ | ||
| 176 | 187 | 'padding' => [], |
| 177 | 188 | 'borderradius' => [ |
| 178 | 189 | 'prefix' => 'border-radius', |
| 179 | 190 | 'parser' => 'parseDimensionsBorderRadiusData' |
| 180 | - ], | |
| 181 | - | |
| 182 | - // Deprecated | |
| 183 | - 'fontsize' => [ | |
| 184 | - 'prefix' => 'font-size' | |
| 185 | - ], | |
| 191 | + ] | |
| 186 | 192 | ]; |
| 187 | 193 | $this->parseCSSProperties($css_properties, ' .fb-dialog'); |
| 188 | 194 | } |
| 189 | 195 | |
| @@ -230,23 +236,13 @@ | ||
| 230 | 236 | $this->addCSS(CSSHelper::arrayToCSS($style), 'desktop', ' .fb-close:hover'); |
| 231 | 237 | } |
| 232 | 238 | } |
| 233 | 239 | |
| 234 | - private function setFloatingButtonCSS() | |
| 235 | - { | |
| 236 | - $css_properties = [ | |
| 237 | - 'margin' => [ | |
| 238 | - 'prefix' => 'padding' | |
| 239 | - ], | |
| 240 | - ]; | |
| 241 | - $this->parseCSSProperties($css_properties, '.fb-floating-button'); | |
| 242 | - } | |
| 243 | - | |
| 244 | 240 | /** |
| 245 | 241 | * Parses the given CSS properties and adds the CSS to the list. |
| 246 | 242 | * |
| 247 | - * @param array $props | |
| 248 | - * @param string $selector | |
| 243 | + * @param array $props | |
| 244 | + * @param string $selector | |
| 249 | 245 | * |
| 250 | 246 | * @return void |
| 251 | 247 | */ |
| 252 | 248 | private function parseCSSProperties($props = [], $selector = '') |
| @@ -252,9 +248,9 @@ | ||
| 252 | 248 | private function parseCSSProperties($props = [], $selector = '') |
| 253 | 249 | { |
| 254 | 250 | foreach ($props as $prop => $prop_data) |
| 255 | 251 | { |
| 256 | - $value = (array) $this->box->params->get($prop, []); | |
| 252 | + $value = (array) $this->box->params->get($prop . '_control.' . $prop, []); | |
| 257 | 253 | |
| 258 | 254 | foreach ($this->breakpoints as $breakpoint) |
| 259 | 255 | { |
| 260 | 256 | if (!isset($value[$breakpoint])) |