XmlJsCode.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. * A wrapper class which causes Xml::encodeJsVar() and Xml::encodeJsCall() to
  22. * interpret a given string as being a JavaScript expression, instead of string
  23. * data.
  24. *
  25. * @par Example:
  26. * @code
  27. * Xml::encodeJsVar( new XmlJsCode( 'a + b' ) );
  28. * @endcode
  29. *
  30. * This returns "a + b".
  31. *
  32. * @note As of 1.21, XmlJsCode objects cannot be nested inside objects or arrays. The sole
  33. * exception is the $args argument to Xml::encodeJsCall() because Xml::encodeJsVar() is
  34. * called for each individual element in that array.
  35. *
  36. * @since 1.17
  37. */
  38. class XmlJsCode {
  39. public $value;
  40. function __construct( $value ) {
  41. $this->value = $value;
  42. }
  43. }