]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - includes/XmlJsCode.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / includes / XmlJsCode.php
1 <?php
2 /**
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16  * http://www.gnu.org/copyleft/gpl.html
17  *
18  * @file
19  */
20
21 /**
22  * A wrapper class which causes Xml::encodeJsVar() and Xml::encodeJsCall() to
23  * interpret a given string as being a JavaScript expression, instead of string
24  * data.
25  *
26  * @par Example:
27  * @code
28  *     Xml::encodeJsVar( new XmlJsCode( 'a + b' ) );
29  * @endcode
30  *
31  * This returns "a + b".
32  *
33  * @note As of 1.21, XmlJsCode objects cannot be nested inside objects or arrays. The sole
34  *       exception is the $args argument to Xml::encodeJsCall() because Xml::encodeJsVar() is
35  *       called for each individual element in that array.
36  *
37  * @since 1.17
38  */
39 class XmlJsCode {
40         public $value;
41
42         function __construct( $value ) {
43                 $this->value = $value;
44         }
45 }