예제 #1
0
 /**
  * Escapes the given string for use in JavaScript.
  *
  * Example:<pre>
  *   <script type="text/javascript>"
  *     var some_js_string = <?= html::js_string($php_string) ?>;
  *   </script>
  * </pre>
  */
 static function js_string($string)
 {
     return SafeString::of($string)->for_js();
 }
예제 #2
0
 public function of_fluid_api_test()
 {
     $escaped_string = SafeString::of("Foo's bar")->for_js();
     $this->assert_equal('"Foo\'s bar"', $escaped_string);
 }