/** * Output the given JSON and set the renderer and rendersurface * @param mixed The object to output as JSON */ protected function renderJSON($json) { $renderer = new \System\Output\Renderer\JSONRenderer(); $renderer->render($json, 0); $renderSurface = \System\Output\RenderSurface::getSurface('\\System\\Output\\GZIPBufferSurface'); $renderSurface->setRenderer($renderer); $this->setRenderSurface($renderSurface); }
/** * Generates the SWF file */ public function swf() { $swfFile = new \System\IO\File(PATH_MODULES . self::SWF_FILE); $renderer = new \System\Output\Renderer\DataRenderer(); $renderer->render($swfFile->getContents()); $surface = \System\Output\RenderSurface::getSurface('\\System\\Output\\BufferSurface'); $surface->addHeader('Content-Type: application/x-shockwave-flash'); $surface->setRenderer($renderer); $this->setRenderSurface($surface); }
/** * Handles the transferring of the request to the service. */ public final function interact() { $reply = new \System\Collection\Vector(); if ($this->hasServiceResult('\\System\\System\\Interaction\\Service\\InteractionRcv::interact')) { $serviceResult = $this->getServiceResult('\\System\\System\\Interaction\\Service\\InteractionRcv::interact'); $reply = $serviceResult->reply; } $renderer = new \System\Output\Renderer\DataRenderer(); $renderer->render(\System\System\Interaction\Interaction::encode($reply)); $renderSurface = \System\Output\RenderSurface::getSurface('\\System\\Output\\GZIPBufferSurface'); $renderSurface->setRenderer($renderer); $this->setRenderSurface($renderSurface); }
/** * Generates the captcha image. It is based on the src get parameter in the html. * This src parameter is used to uniquely identify the captcha. */ public function generate() { $get = new \System\HTTP\Request\Get(); $captchaLength = SpecialElement\Captcha::CAPTCHA_DEFAULT_LENGTH; if (defined('CAPTCHA_DEFAULT_LENGTH')) { $captchaLength = constant('CAPTCHA_DEFAULT_LENGTH'); } $image = SpecialElement\Captcha::getCaptcha($get->src, $captchaLength); $renderer = new \System\Output\Renderer\JPEGRenderer(); $renderer->render($image, 75); $surface = \System\Output\RenderSurface::getSurface('\\System\\Output\\BufferSurface'); $surface->setRenderer($renderer); $this->setRenderSurface($surface); }