示例#1
0
 /**
  * After controller method has run output the template
  *
  * @param  Response  $response
  */
 public function after($response)
 {
     if (!\Input::is_ajax()) {
         // If nothing was returned default to the template
         if (empty($response)) {
             $response = $this->template;
         }
         // If the response isn't a Response object, embed in the available one for BC
         // @deprecated  can be removed when $this->response is removed
         if (!$response instanceof Response) {
             $this->response->body = $response;
             $response = $this->response;
         }
     }
     return parent::after($response);
 }
 /**
  * This method gets called after the action is called
  */
 public function after($response)
 {
     if ($response instanceof \View) {
         $response->set('user_id', self::$_logined_user_id);
         $response->set('logined', self::$_logined);
         if (isset(static::$_current_page)) {
             $response->set('current_page', static::$_current_page);
         }
         foreach (self::$_config as $k => $v) {
             $response->set($k, $v);
         }
         foreach (\Config::load('original_image', true) as $k => $v) {
             $response->set($k, $v);
         }
     }
     $response = parent::after($response);
     return $response;
 }
 /**
  * After controller method has run output the template
  *
  * @param  Response  $response
  */
 public function after($response)
 {
     // return the template if no response is present and this isn't a RESTful call
     if (!$this->is_restful()) {
         // do we have a response passed?
         if (empty($response)) {
             // maybe one in the rest body?
             $response = $this->response->body;
             if (empty($response)) {
                 // fall back to the defined template
                 $response = $this->template;
             }
         }
         if (!$response instanceof Response) {
             $response = \Response::forge($response);
         }
     }
     return parent::after($response);
 }
示例#4
0
 /**
  * After controller method has run output the template
  *
  * @param  Response  $response
  */
 public function after($response)
 {
     // return the template if no response is present and this isn't a RESTful call
     if (!$this->is_restful()) {
         // do we have a response passed?
         if ($response === null) {
             // maybe one in the rest body?
             $response = $this->response->body;
             if ($response === null) {
                 // fall back to the defined template
                 $response = $this->template;
             }
         } elseif (is_array($response)) {
             $response = \Format::forge()->to_json($response, true);
         }
         // and make sure we have a valid Response object
         if (!$response instanceof Response) {
             $response = \Response::forge($response, $this->response_status);
         }
     }
     return parent::after($response);
 }