diff --git a/app/inc/smarty.php b/app/inc/smarty.php index f67e7e7..338ba2f 100644 --- a/app/inc/smarty.php +++ b/app/inc/smarty.php @@ -45,7 +45,7 @@ if (defined('FAVICON')) { } // Dev Mode -if (isset($_SERVER['FRAMADATE_DEVMODE']) && $_SERVER['FRAMADATE_DEVMODE']) { +if (isset($_SERVER['FRAMADATE_DEVMODE']) && $_SERVER['FRAMADATE_DEVMODE'] || php_sapi_name() === 'cli-server') { $smarty->force_compile = true; $smarty->compile_check = true; } else { @@ -80,6 +80,21 @@ function smarty_modifier_html($html) { return Utils::htmlEscape($html); } +/** + * markdown_to_text + * Retrieves a markdown string and tries to make a plain text value + * + * @param array $options + * @return string + */ +function smarty_function_markdown_to_text($options, Smarty_Internal_Template $template) +{ + $locale = \o80\i18n\I18N::instance()->getLoadedLang(); + $text = strip_tags(Parsedown::instance()->text($options['markdown'])); + $number_letters = (new NumberFormatter($locale, NumberFormatter::ORDINAL))->format($options['id'] + 1); + return $text !== '' ? $text : __f('Poll results', '%s option', $number_letters); +} + function smarty_modifier_datepicker_path($lang) { $i = 0; while (!is_file(path_for_datepicker_locale($lang)) && $i < 3) { diff --git a/locale/en.json b/locale/en.json index 14f93d1..8a0093d 100644 --- a/locale/en.json +++ b/locale/en.json @@ -290,6 +290,7 @@ "You have to provide a password to access the poll.": "You have to provide a password to access the poll." }, "Poll results": { + "%s option": "%s option", "Addition": "Total", "Anyone will be able to access your email address after your vote": "Anyone will be able to see your email address after you voted", "Best choice": "Best choice", diff --git a/tpl/part/vote_table_classic.tpl b/tpl/part/vote_table_classic.tpl index 6ce6b38..b8b81f1 100644 --- a/tpl/part/vote_table_classic.tpl +++ b/tpl/part/vote_table_classic.tpl @@ -82,19 +82,19 @@