* @license PHP License * @package WB * @subpackage content */ /** * Load base class */ WBClass::load('WBContent' , 'WBString'); /** * Content component: Redirect * * @version 1.0.0 * @package WB * @subpackage content */ class WBContent_Redirect extends WBContent { /** * my parameter list * @var array */ protected $config = array( 'url' => '[[SELF]]', 'status' => 301, 'withpath' => 1, 'withget' => 1 ); /** * Redirect * * Redirect to other page * * @return array parameter list * @cation this method does not return */ public function run() { $res = WBClass::create('WBResponse'); $rUrl = WBString::replaceSuperPlaceholders($this->config['url']); $status = $this->config['status']; if (0 < intval($this->config['withpath']) && !empty($this->config['__path'])) { $rUrl .= implode('/', $this->config['__path']); } $get = $this->req->export(); if (0 < intval($this->config['withget']) && !empty($get)) { $get = http_build_query($get); $rUrl .= '?' . $get; } $res->addHeader('Location', $rUrl); $data = str_replace('{URL}', $rUrl, 'Please continue at {URL}. Thank you.'); $res->add($data); $res->setStatus($status); $res->send($this->req); exit(0); return $this->config; } }