quoteJsLiteral() public static method

public static quoteJsLiteral ( $js ) : Marks
return Marks a string as a javascript function. Once marke, the string is considered as a raw javascript function that is not supposed to be encoded by {@link encode}
Ejemplo n.º 1
0
 /**
  * Adds on client-side event handler by wrapping the code within a
  * javascript function block. If the code begins with "javascript:", the
  * code is assumed to be a javascript function block rather than arbiturary
  * javascript statements.
  * @param string option name
  * @param string javascript statements.
  */
 protected function setFunction($name, $code)
 {
     if (!TJavaScript::isJsLiteral($code)) {
         $code = TJavaScript::quoteJsLiteral($this->ensureFunction($code));
     }
     $this->setOption($name, $code);
 }
Ejemplo n.º 2
0
 public function setOnSlide($javascript)
 {
     $code = TJavaScript::quoteJsLiteral("function (value) { {$javascript} }");
     $this->setFunction('onSlide', $code);
 }