| | |
| | | { |
| | | $out = ''; |
| | | if (!$this->framed && !empty($this->js_env)) { |
| | | $out .= JS_OBJECT_NAME . '.set_env('.json_encode($this->js_env).");\n"; |
| | | $out .= JS_OBJECT_NAME . '.set_env('.json_serialize($this->js_env).");\n"; |
| | | } |
| | | foreach ($this->js_commands as $i => $args) { |
| | | $method = array_shift($args); |
| | | foreach ($args as $i => $arg) { |
| | | $args[$i] = json_encode($arg); |
| | | $args[$i] = json_serialize($arg); |
| | | } |
| | | $parent = $this->framed || preg_match('/^parent\./', $method); |
| | | $out .= sprintf( |
| | |
| | | { |
| | | $GLOBALS['__version'] = Q(RCMAIL_VERSION); |
| | | $GLOBALS['__comm_path'] = Q($this->app->comm_path); |
| | | return preg_replace('/\$(__[a-z0-9_\-]+)/e', '$GLOBALS["\\1"]', $input); |
| | | return preg_replace_callback('/\$(__[a-z0-9_\-]+)/', |
| | | array($this, 'globals_callback'), $input); |
| | | } |
| | | |
| | | /** |
| | | * Callback funtion for preg_replace_callback() in parse_with_globals() |
| | | */ |
| | | private function globals_callback($matches) |
| | | { |
| | | return $GLOBALS[$matches[1]]; |
| | | } |
| | | |
| | | /** |