protected function onShortcode($content, $code, \Drone\HTML &$html) { $content = preg_replace('/ *(\\[(vector|image)_icon[^\\]]*\\]) */', '</span>\\1<span>', trim($content)); $content = preg_replace('#^<span></span>|<span></span>$#', '', "<span>{$content}</span>"); $html = HTML::a()->addClass('button', $this->so('size'), $this->so('advanced/class'))->style($this->so('advanced/style')); $html->add(Func::wpShortcodeContent($content)); if ($this->so('href')) { $html->href = $this->so('href'); if ($this->so('new_window')) { $html->target = '_blank'; } } if ($this->so('color')) { $html->style .= sprintf('border-color: %1$s; color: %1$s;', $this->so('color')); } if ($this->so('background/opacity') == 0) { $html->style .= 'background-color: transparent;'; } else { if ($this->so('background/color')) { $html->style .= 'background-color: ' . Func::cssHexToRGBA($this->so('background/color'), $this->so('background/opacity') / 100) . ';'; } } if ($this->so('caption')) { $html = HTML::p()->class('horizontal-align text-right')->add($html, '<br />', HTML::small()->class('caption')->add($this->so('caption'))); } }