. /** * Atto equation upgrade helper functions. * * @package atto_equation * @copyright 2015 Sam Chaffee * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); /** * Updates the librarygroup4 setting if has not been changed from the default. */ function atto_equation_update_librarygroup4_setting() { // Original default setting for librarygroup4. $settingdefault = ' \sum{a,b} \int_{a}^{b}{c} \iint_{a}^{b}{c} \iiint_{a}^{b}{c} \oint{a} (a) [a] \lbrace{a}\rbrace \left| \begin{matrix} a_1 & a_2 \\ a_3 & a_4 \end{matrix} \right| '; // Make a comparison string. $settingdefaultcmpr = trim(str_replace(array("\r", "\n"), '', $settingdefault)); // Make the current librarygroup4 setting into a comparison string. $currentsetting = get_config('atto_equation', 'librarygroup4'); $currentsettingcmpr = trim(str_replace(array("\r", "\n"), '', $currentsetting)); if ($settingdefaultcmpr === $currentsettingcmpr) { // Only if the original defaults match the current setting do we set the new config. $newconfig = ' \sum{a,b} \sqrt[a]{b+c} \int_{a}^{b}{c} \iint_{a}^{b}{c} \iiint_{a}^{b}{c} \oint{a} (a) [a] \lbrace{a}\rbrace \left| \begin{matrix} a_1 & a_2 \\ a_3 & a_4 \end{matrix} \right| \frac{a}{b+c} \vec{a} \binom {a} {b} {a \brack b} {a \brace b} '; set_config('librarygroup4', $newconfig, 'atto_equation'); } }