コード例 #1
0
 public function __init($response_type = Mime::JSON)
 {
     $accept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
     if (!empty($accept) && $accept !== '*/*' && strpos($accept, ',') === false && Mime::isDefined($accept)) {
         $response_type = $accept;
     }
     parent::__init($response_type);
     if ($response_type === Mime::JSON) {
         $jsonp_callback_name = $this->request->get(static::JSONP_CALLBACK_PARAM_NAME);
         $this->_allow_jsonp = true;
         $this->_jsonp_callback = !empty($jsonp_callback_name) ? $jsonp_callback_name : null;
     }
 }