[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/editor/atto/plugins/equation/db/ -> upgradelib.php (source)

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * Atto equation upgrade helper functions.
  19   *
  20   * @package    atto_equation
  21   * @copyright  2015 Sam Chaffee <sam@moodlerooms.com>
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  defined('MOODLE_INTERNAL') || die();
  26  
  27  /**
  28   * Updates the librarygroup4 setting if has not been changed from the default.
  29   */
  30  function atto_equation_update_librarygroup4_setting() {
  31      // Original default setting for librarygroup4.
  32      $settingdefault = '
  33  \sum{a,b}
  34  \int_{a}^{b}{c}
  35  \iint_{a}^{b}{c}
  36  \iiint_{a}^{b}{c}
  37  \oint{a}
  38  (a)
  39  [a]
  40  \lbrace{a}\rbrace
  41  \left| \begin{matrix} a_1 & a_2 \\ a_3 & a_4 \end{matrix} \right|
  42  ';
  43      // Make a comparison string.
  44      $settingdefaultcmpr = trim(str_replace(array("\r", "\n"), '', $settingdefault));
  45  
  46      // Make the current librarygroup4 setting into a comparison string.
  47      $currentsetting = get_config('atto_equation', 'librarygroup4');
  48      $currentsettingcmpr = trim(str_replace(array("\r", "\n"), '', $currentsetting));
  49  
  50      if ($settingdefaultcmpr === $currentsettingcmpr) {
  51          // Only if the original defaults match the current setting do we set the new config.
  52          $newconfig = '
  53  \sum{a,b}
  54  \sqrt[a]{b+c}
  55  \int_{a}^{b}{c}
  56  \iint_{a}^{b}{c}
  57  \iiint_{a}^{b}{c}
  58  \oint{a}
  59  (a)
  60  [a]
  61  \lbrace{a}\rbrace
  62  \left| \begin{matrix} a_1 & a_2 \\ a_3 & a_4 \end{matrix} \right|
  63  \frac{a}{b+c}
  64  \vec{a}
  65  \binom {a} {b}
  66  {a \brack b}
  67  {a \brace b}
  68  ';
  69          set_config('librarygroup4', $newconfig, 'atto_equation');
  70      }
  71  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1