| | |
| | | foreach ($this->icons as $style => $names) { |
| | | $styleClass = ($style !== $this->style) ? '-'.substr($style, 0, 2) : ''; |
| | | foreach ($names as $icon) { |
| | | $svg = $this->getEncodedSVG($icon, $style); |
| | | if ($svg !== '') { |
| | | if ($icon === 'caret-down') { |
| | | $css .= 'details summary::after,'; |
| | | } elseif ($icon === 'faders-horizontal') { |
| | | $css .= 'details.all-filters summary::after,'; |
| | | } elseif ($icon === 'link') { |
| | | $css .= 'input[type=url],'; |
| | | } elseif ($icon === apply_filters('jvbSeparatorLogo', 'logo')) { |
| | | $css .= 'hr.logo::before,'; |
| | | } |
| | | $css .= ".icon-{$icon}{$styleClass}{"; |
| | | $css .= "--icon:url('data:image/svg+xml;base64,{$svg}');"; |
| | | $css .= "}"; |
| | | } |
| | | $css .= $this->generateSingleIconCss($icon, $style, $styleClass); |
| | | } |
| | | } |
| | | update_option($this->timestampKey, time()); |
| | | return $this->minifyCss($css); |
| | | } |
| | | |
| | | public function generateSingleIconCss(string $icon, ?string $style = null, ?string $styleClass = null):string |
| | | { |
| | | $style = $style??$this->style; |
| | | $styleClass = $styleClass??($style !== $this->style) ? '-'.substr($style, 0, 2) : ''; |
| | | $css = ''; |
| | | $svg = $this->getEncodedSVG($icon, $style); |
| | | if ($svg !== '') { |
| | | if ($icon === 'caret-down') { |
| | | $css .= 'details summary::after,'; |
| | | } elseif ($icon === 'faders-horizontal') { |
| | | $css .= 'details.all-filters summary::after,'; |
| | | } elseif ($icon === 'link') { |
| | | $css .= 'input[type=url],'; |
| | | } elseif ($icon === apply_filters('jvbSeparatorLogo', 'logo')) { |
| | | $css .= 'hr.logo::before,'; |
| | | } |
| | | $css .= ".icon-{$icon}{$styleClass}{"; |
| | | $css .= "--icon:url('data:image/svg+xml;base64,{$svg}');"; |
| | | $css .= "}"; |
| | | } |
| | | return $css; |
| | | } |
| | | |
| | | protected function minifyCSS(string $css): string |
| | | { |
| | | // Remove comments |