protected function setFunction($name, $code) { if (!TJavaScript::isJsLiteral($code)) { $code = TJavaScript::quoteJsLiteral($this->ensureFunction($code)); } $this->setOption($name, $code); }
/** * Converts a value to string type. * Note, a boolean value will be converted to 'true' if it is true * and 'false' if it is false. * @param mixed the value to be converted. * @return string */ public static function ensureString($value) { if (TJavaScript::isJsLiteral($value)) { return $value; } if (is_bool($value)) { return $value ? 'true' : 'false'; } else { return (string) $value; } }