Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
<?php// This file is part of Moodle - http://moodle.org///// Moodle is free software: you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation, either version 3 of the License, or// (at your option) any later version.//// Moodle is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with Moodle. If not, see <http://www.gnu.org/licenses/>./*** Mustache helper that will add JS to the end of the page.** @package core* @category output* @copyright 2015 Damyon Wiese* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later*/namespace core\output;/*** Lazy create a uniqid per instance of the class. The id is only generated* when this class it converted to a string.** @copyright 2015 Damyon Wiese* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later* @since 2.9*/class mustache_uniqid_helper {/** @var string $uniqid The unique id */private $uniqid = null;/*** Init the random variable and return it as a string.** @return string random id.*/public function __toString() {if ($this->uniqid === null) {$this->uniqid = \html_writer::random_id(uniqid());}return $this->uniqid;}}