Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
   1  <?php
   2  
   3  /*
   4   * This file is part of Mustache.php.
   5   *
   6   * (c) 2010-2017 Justin Hileman
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  /**
  13   * Mustache Template string Loader implementation.
  14   *
  15   * A StringLoader instance is essentially a noop. It simply passes the 'name' argument straight through:
  16   *
  17   *     $loader = new StringLoader;
  18   *     $tpl = $loader->load('{{ foo }}'); // '{{ foo }}'
  19   *
  20   * This is the default Template Loader instance used by Mustache:
  21   *
  22   *     $m = new Mustache;
  23   *     $tpl = $m->loadTemplate('{{ foo }}');
  24   *     echo $tpl->render(array('foo' => 'bar')); // "bar"
  25   */
  26  class Mustache_Loader_StringLoader implements Mustache_Loader
  27  {
  28      /**
  29       * Load a Template by source.
  30       *
  31       * @param string $name Mustache Template source
  32       *
  33       * @return string Mustache Template source
  34       */
  35      public function load($name)
  36      {
  37          return $name;
  38      }
  39  }