| | |
| | | { |
| | | $this->source = $source; |
| | | $this->cache = Cache::for('icons_' . $source, WEEK_IN_SECONDS); |
| | | $this->style = (array_key_exists('icons', JVB_SITE) && in_array(JVB_SITE['icons'], $this->styles)) |
| | | ? JVB_SITE['icons'] |
| | | : 'regular'; |
| | | $this->style = Site::icon(); |
| | | |
| | | $this->addMap(); |
| | | |
| | |
| | | */ |
| | | public function get(string $name, array $options = []): string |
| | | { |
| | | if ($name === '') { |
| | | if (empty($name)) { |
| | | //No icon requested |
| | | return ''; |
| | | } |
| | |
| | | if (!$style) { |
| | | $style = $this->style; |
| | | } |
| | | |
| | | $icon = $this->map[$icon] ?? $icon; |
| | | |
| | | // Validate icon exists |
| | | if (!$this->iconExists($icon, $style)) { |
| | | error_log('[IconsManager] Icon not found: ' . $icon); |
| | | return ''; |
| | | } |
| | | $svg = $this->getEncodedSVG($icon, $style); |
| | | if ($svg !== '') { |
| | | return "data:image/svg+xml;base64,{$svg}"; |