コード例 #1
0
ファイル: PostHandler.php プロジェクト: robtuley/knotwerk
 /**
  * Prepare-filter forwards to get if form was present and valid.
  *
  * At this point, the request has not been sent, but has been created and is about to be.
  * If the request is valid, we want to skip out *before* the form is sent and simply
  * redirect.
  *
  * @param T_Response $response  encapsulated response to filter
  */
 protected function doPrepareFilter(T_Response $response)
 {
     if ($this->form->isPresent() && $this->form->isValid() && $this->forward) {
         // POST request is successful, therefore redirect to GET so the
         // back button cannot be used to repeat the request.
         $response->abort();
         throw new T_Response_Redirect($this->forward->getUrl());
     }
 }
コード例 #2
0
ファイル: Text.php プロジェクト: robtuley/knotwerk
 /**
  * Render an embedded resource.
  *
  * At the moment, this renderer is setup to assume that all embedded resources are
  * images. However, this could be easily extended to handle video, and so on.
  *
  * @param T_Text_EmbeddedLink $element
  */
 function visitTextResource(T_Text_Resource $node)
 {
     $escape = new T_Filter_Xhtml();
     if ($node->isInternal()) {
         $url = $this->root_url->getUrl($escape) . $node->getUrl($escape);
     } else {
         $url = $node->getUrl($escape);
     }
     $this->xhtml .= '<img src="' . $url . '" alt="' . $node->getContent($this->filter) . '" />' . EOL;
 }