alecpl
2009-12-14 9898fe315a142451f4004d4eb4972fb19322be98
program/include/rcube_json_output.php
@@ -29,10 +29,11 @@
class rcube_json_output
{
    private $config;
    private $charset = 'UTF-8';
    private $charset = RCMAIL_CHARSET;
    private $env = array();
    private $texts = array();
    private $commands = array();
    private $callbacks = array();
    private $message = null;
    public $type = 'js';
@@ -67,7 +68,7 @@
    public function set_pagetitle($title)
    {
        $name = $this->config->get('product_name');
        $this->command('set_pagetitle', JQ(empty($name) ? $title : $name.' :: '.$title));
        $this->command('set_pagetitle', empty($name) ? $title : $name.' :: '.$title);
    }
    /**
@@ -122,7 +123,12 @@
     */
    public function command()
    {
        $this->commands[] = func_get_args();
        $cmd = func_get_args();
        if (strpos($cmd[0], 'plugin.') === 0)
          $this->callbacks[] = $cmd;
        else
          $this->commands[] = $cmd;
    }
    
    
@@ -227,8 +233,11 @@
        if (!empty($this->texts))
          $response['texts'] = $this->texts;
        // send response code
        // send function calls
        $response['exec'] = $this->get_js_commands() . $add;
        if (!empty($this->callbacks))
          $response['callbacks'] = $this->callbacks;
        echo json_serialize($response);
    }
@@ -242,7 +251,7 @@
    private function get_js_commands()
    {
        $out = '';
        foreach ($this->commands as $i => $args) {
            $method = array_shift($args);
            foreach ($args as $i => $arg) {