From ab571e687f261d829470174f48e78f48fb39d1dd Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 20 Sep 2018 21:48:46 -0400 Subject: [PATCH] [mathjax] Move settings template to separate file --- mathjax/mathjax.php | 27 ++++++++------------------- mathjax/templates/settings.tpl | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 mathjax/templates/settings.tpl diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php index a4e8fe05e..9aa070272 100644 --- a/mathjax/mathjax.php +++ b/mathjax/mathjax.php @@ -34,11 +34,7 @@ function mathjax_uninstall() function mathjax_settings_post($a) { - if (!local_user()) { - return; - } - - if (empty($_POST['mathjax-submit'])) { + if (!local_user() || empty($_POST['mathjax-submit'])) { return; } @@ -52,21 +48,14 @@ function mathjax_settings(App $a, &$s) } $use = PConfig::get(local_user(), 'mathjax', 'use', false); - $usetext = $use ? ' checked="checked" ' : ''; - $s .= ''; - $s .= '

MathJax ' . L10n::t('Settings') . '

'; - $s .= '
'; - $s .= ''; + $tpl = get_markup_template('settings.tpl', __DIR__); + $s .= replace_macros($tpl, [ + '$title' => 'MathJax', + '$description' => L10n::t('The MathJax addon renders mathematical formulae written using the LaTeX syntax surrounded by the usual $$ or an eqnarray block in the postings of your wall,network tab and private mail.'), + '$mathjax_use' => ['mathjax_use', L10n::t('Use the MathJax renderer'), $use, ''], + '$savesettings' => L10n::t('Save Settings'), + ]); } function mathjax_footer(App $a, &$b) diff --git a/mathjax/templates/settings.tpl b/mathjax/templates/settings.tpl new file mode 100644 index 000000000..98bdb85ed --- /dev/null +++ b/mathjax/templates/settings.tpl @@ -0,0 +1,16 @@ + + +

{{$title}}

+
+ \ No newline at end of file