sfWebResponse::initialize PHP Method

initialize() public method

Available options: * charset: The charset to use (utf-8 by default) * content_type: The content type (text/html by default) * send_http_headers: Whether to send HTTP headers or not (true by default) * http_protocol: The HTTP protocol to use for the response (HTTP/1.0 by default)
See also: sfResponse
public initialize ( sfEventDispatcher $dispatcher, array $options = [] ) : boolean
$dispatcher sfEventDispatcher An sfEventDispatcher instance
$options array An array of options
return boolean true, if initialization completes successfully, otherwise false
    public function initialize(sfEventDispatcher $dispatcher, $options = array())
    {
        parent::initialize($dispatcher, $options);
        $this->javascripts = array_combine($this->positions, array_fill(0, count($this->positions), array()));
        $this->stylesheets = array_combine($this->positions, array_fill(0, count($this->positions), array()));
        if (!isset($this->options['charset'])) {
            $this->options['charset'] = 'utf-8';
        }
        if (!isset($this->options['send_http_headers'])) {
            $this->options['send_http_headers'] = true;
        }
        if (!isset($this->options['http_protocol'])) {
            $this->options['http_protocol'] = 'HTTP/1.0';
        }
        $this->options['content_type'] = $this->fixContentType(isset($this->options['content_type']) ? $this->options['content_type'] : 'text/html');
    }

Usage Example

Example #1
0
 public function initialize(sfEventDispatcher $dispatcher, $options = array())
 {
     parent::initialize($dispatcher, $options);
     $this->javascriptConfig = array();
     $this->dispatcher->connect('user.change_culture', array($this, 'listenToChangeCultureEvent'));
     $this->dispatcher->connect('user.change_theme', array($this, 'listenToChangeThemeEvent'));
     $this->dispatcher->connect('user.remember_me', array($this, 'listenToRememberMeEvent'));
     $this->dispatcher->connect('user.sign_out', array($this, 'listenToSignOutEvent'));
 }
All Usage Examples Of sfWebResponse::initialize