/** * Executes the pre-send prepare hook action. * * This method applies the prepare filter method (this is a pre-send event hook) that * is applied before sending the encapsulated response, but after the main controller * method has been called. * * @param T_Response $response response object to apply filter to */ function prepareFilter(T_Response $response) { $this->doPrepareFilter($response); if ($this->filter) { $this->filter->prepareFilter($response); } }
/** * Accept the last modified time of resource. * * The constructor for this class accepts The (local) time at which the * data that is being served was last modified. * * @param int $last_modified local time at which resource was last modified * @param T_Response_Filter $filter The prior filter object */ function __construct($last_modified, T_Environment $env, T_Response_Filter $filter = null) { parent::__construct($filter); $this->lm = (int) $last_modified; $server = $env->input('SERVER'); $this->server = $server ? $server : new T_Cage_Array(array()); }
/** * Accept the length content can be cached, and public/private type. * * @param int $cache_time length to cache for (s), 0 for no cache * @param int $type type of caching to apply ('public' or 'private') * @param T_Response_Filter $filter The prior filter object */ function __construct($cache_time, $type = 'public', T_Response_Filter $filter = null) { parent::__construct($filter); $this->cache_time = (int) $cache_time; if (strcasecmp($type, 'public') !== 0 && strcasecmp($type, 'private') !== 0) { throw new InvalidArgumentException('Illegal cache type ' . $type); } $this->type = strtolower($type); }
/** * Create POST form filter. * * @param T_Form_Post $form form * @param string $lock_to a value that form can be locked to (e.g. User ID) * @param int $timeout form timeout (seconds), defaults to 15 minutes * @param T_Response_Filter $filter The prior filter object */ function __construct(T_Form_Post $form, T_Environment $env, T_Filter_RepeatableHash $hash, $lock_to = null, $timeout = 900, T_Response_Filter $filter = null) { parent::__construct($filter); $this->env = $env; $this->form = $form; $this->hash = $hash; if (strlen($lock_to) > 0) { $this->lock_to = md5($lock_to); // protect possibly sensitive user ids, etc. } $this->timeout = $timeout; $this->forward = $this->form->getForward(); if (!$this->forward) { $msg = 'Form ' . $this->form->getAlias() . ' has no forward set'; throw new InvalidArgumentException($msg); } }
/** * Store the form structure. * * @param T_Form_Get $form GET form * @param T_Environment Environment * @param T_Response_Filter $filter The prior filter object */ function __construct(T_Form_Get $form, T_Environment $env, T_Response_Filter $filter = null) { parent::__construct($filter); $this->form = $form; $this->env = $env; }
/** * Accept a callback parameter. * * The constructor for this class accepts an optional function callback * parameter as well as an optional piped filter object. * * @param string $callback output buffer handler * @param T_Response_Filter $filter The prior filter object */ function __construct($callback = null, T_Response_Filter $filter = null) { parent::__construct($filter); $this->callback = $callback; }
/** * Append a filter to the end of the current filter chain. * * @param T_Response_Filter $filter filter to apply * @param mixed $key optional filter access key */ function appendFilter(T_Response_Filter $filter, $key = null) { if (!is_null($key) && !array_key_exists($key, $this->filter)) { $this->filter[$key] = $filter; } elseif (is_null($key)) { $this->filter[] = $filter; } else { throw new InvalidArgumentException("existing key {$key}"); } /* filter is stored BEFORE pre-filtering in case a redirect is thrown in the prefilter process. */ $filter->preFilter($this); }