slug = $data['slug']; } public function processRequest() { $slug = PhrictionDocument::normalizeSlug($this->slug); if ($slug != $this->slug) { $uri = PhrictionDocument::getSlugURI($slug); // Canonicalize pages to their one true URI. return id(new AphrontRedirectResponse())->setURI($uri); } require_celerity_resource('phriction-document-css'); $document = id(new PhrictionDocument())->loadOneWhere( 'slug = %s', $slug); if (!$document) { $page_content = 'No content here!'; $page_title = 'Page Not Found'; $button = phutil_render_tag( 'a', array( 'href' => '/phriction/edit/?slug='.$slug, 'class' => 'green button', ), 'Create Page'); } else { $content = id(new PhrictionContent())->load($document->getContentID()); $page_content = phutil_escape_html($content->getContent()); $page_title = $content->getTitle(); $button = phutil_render_tag( 'a', array( 'href' => '/phriction/edit/'.$document->getID().'/', 'class' => 'button', ), 'Edit Page'); } $page = '
'. $button. '

'.phutil_escape_html($page_title).'

'. '
'. $page_content; return $this->buildStandardPageResponse( $page, array( 'title' => 'Phriction - '.$page_title, )); } }