/** * @param DoxterShortcodeModel $code * * @return string */ public function audio(DoxterShortcodeModel $code) { $src = $code->getParam('src'); if (!empty($src)) { $vars = array('src' => $src, 'size' => $code->getParam('size', 'large'), 'color' => $code->getParam('color', '00aabb')); if (craft()->templates->doesTemplateExist('_doxter/shortcodes/audio')) { return craft()->templates->render('_doxter/shortcodes/audio', $vars); } return doxter()->renderPluginTemplate('shortcodes/_audio', $vars); } }
/** * Renders the current called shortcode * * @param array $matches * * @return mixed */ public function render($matches) { $shortcode = DoxterShortcodeModel::create(); $shortcode->name = $matches[2]; $shortcode->params = $this->getParameters($matches); $shortcode->content = $matches[5]; if (isset($shortcode->params['raw'])) { return str_replace(' raw', '', $matches[0]); } return call_user_func_array($this->getCallback($matches[2]), array($shortcode)); }