コード例 #1
0
ファイル: Redirection.php プロジェクト: eix/core
 public function issue()
 {
     if ($this->nextUrl) {
         Logger::get()->debug("Redirecting to {$this->nextUrl}...");
         $this->addHeader('Location', $this->nextUrl);
     } else {
         throw new \InvalidArgumentException('No redirection URL has been set.');
     }
     parent::issue();
 }
コード例 #2
0
ファイル: Json.php プロジェクト: eix/core
 public function issue()
 {
     parent::issue();
     $data = $this->getData();
     // If there is only one element, don't output the key, just the value.
     if (count($data) == 1) {
         $data = current($data);
     }
     // Output the JSON.
     echo json_encode($data);
 }
コード例 #3
0
ファイル: Xml.php プロジェクト: eix/core
 public function issue()
 {
     $continue = parent::issue();
     if ($continue) {
         $xmlOutput = new \SimpleXMLElement('<response source="eix"/>');
         array_walk_recursive($this->getData(), function ($value, $key) use(&$xmlOutput) {
             $xmlOutput->addChild($key, $value);
         });
         echo $xmlOutput->asXML();
     }
     return $continue;
 }
コード例 #4
0
ファイル: Image.php プロジェクト: eix/core
 public function issue()
 {
     // Make the image last in the cache for at least a day.
     $this->addHeader('Cache-Control', '3600');
     // Output headers.
     parent::issue();
     // Check whether the image needs to be resized.
     $this->checkForResize();
     if ($this->image instanceof \Imagick) {
         echo $this->image;
     } elseif ($this->fileName) {
         if (is_readable($this->fileName)) {
             readfile($this->fileName);
         } else {
             throw new NotFoundException("Image not found in {$this->fileName}");
         }
     } else {
         throw new BadRequestException('No image has been set.');
     }
 }
コード例 #5
0
ファイル: Html.php プロジェクト: eix/core
 public function issue()
 {
     // Output headers.
     parent::issue();
     $this->setData('page', array('title' => @implode(' — ', $this->titleParts), 'template' => str_replace(array('.', '/'), '_', $this->templateId), 'contentType' => $this->getContentType(), 'url' => $this->getRequest() ? $this->getRequest()->getCurrentUrl() : ''));
     // If there are status messages left in the session by a Redirection
     // response, fetch them...
     $statusMessages = @$_SESSION['messages']['status'];
     // ... remove them from the session...
     // ... and add them to the page status.
     if (is_array($statusMessages)) {
         unset($_SESSION['messages']['status']);
         $this->addData('status', $statusMessages);
     }
     // Provide a hook for any custom data to be added to the response before
     // the latter being issued.
     $this->setCustomData();
     // Now output the page.
     $medium = new Media\XslPage($this->templateId, $this->getData());
     $medium->render();
 }