function smarty_modifier_markup($text) { static $parsers = array(); static $cacheKey = 'smarty_modifier_markup'; $stripTags = false; $args = func_get_args(); array_shift($args); foreach ($args as $arg) { if ($arg == 'strip') { $stripTags = true; } else { $markupType = $arg; } } if (!isset($markupType)) { if (!GalleryDataCache::containsKey($cacheKey)) { list($ret, $defaultMarkupType) = GalleryCoreApi::getPluginParameter('module', 'core', 'misc.markup'); if ($ret) { /* This code is used by the UI -- we can't return an error. Choose something safe */ $defaultMarkupType = 'none'; } GalleryDataCache::put($cacheKey, $defaultMarkupType); } $markupType = GalleryDataCache::get($cacheKey); } if (!isset($parsers[$markupType])) { switch ($markupType) { case 'bbcode': $parsers[$markupType] = new GalleryBbcodeMarkupParser(); break; case 'html': $parsers[$markupType] = new GalleryHtmlMarkupParser(); break; case 'none': default: $parsers[$markupType] = new GalleryNoMarkupParser(); } } $text = $parsers[$markupType]->parse($text); return $stripTags ? strip_tags($text) : $text; }
/** * Check if Gallery is in embedded mode * * @return boolean true if Gallery is in embedded mode, false otherwise */ function isEmbedded() { return GalleryDataCache::containsKey('G2_EMBED') && GalleryDataCache::get('G2_EMBED'); }