diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewFrameController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewFrameController.php index 560d4203a0..2c5a43687c 100644 --- a/src/applications/phpast/controller/PhabricatorXHPASTViewFrameController.php +++ b/src/applications/phpast/controller/PhabricatorXHPASTViewFrameController.php @@ -1,32 +1,26 @@ id = $data['id']; - } - - public function processRequest() { - $id = $this->id; + public function handleRequest(AphrontRequest $request) { + $id = $request->getURIData('id'); return $this->buildStandardPageResponse( phutil_tag( 'iframe', array( 'src' => '/xhpast/frameset/'.$id.'/', 'frameborder' => '0', 'style' => 'width: 100%; height: 800px;', '', )), array( 'title' => pht('XHPAST View'), )); } } diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewFramesetController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewFramesetController.php index a21bb30b68..de446b5e44 100644 --- a/src/applications/phpast/controller/PhabricatorXHPASTViewFramesetController.php +++ b/src/applications/phpast/controller/PhabricatorXHPASTViewFramesetController.php @@ -1,32 +1,26 @@ id = $data['id']; - } - - public function processRequest() { - $id = $this->id; + public function handleRequest(AphrontRequest $request) { + $id = $request->getURIData('id'); $response = new AphrontWebpageResponse(); $response->setFrameable(true); $response->setContent(phutil_tag( 'frameset', array('cols' => '33%, 34%, 33%'), array( phutil_tag('frame', array('src' => "/xhpast/input/{$id}/")), phutil_tag('frame', array('src' => "/xhpast/tree/{$id}/")), phutil_tag('frame', array('src' => "/xhpast/stream/{$id}/")), ))); return $response; } } diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewInputController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewInputController.php index 48ba6afc33..6e1fd87db7 100644 --- a/src/applications/phpast/controller/PhabricatorXHPASTViewInputController.php +++ b/src/applications/phpast/controller/PhabricatorXHPASTViewInputController.php @@ -1,10 +1,10 @@ getStorageTree()->getInput(); return $this->buildXHPASTViewPanelResponse($input); } } diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewRunController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewRunController.php index f5a79a4b28..dd9cf85433 100644 --- a/src/applications/phpast/controller/PhabricatorXHPASTViewRunController.php +++ b/src/applications/phpast/controller/PhabricatorXHPASTViewRunController.php @@ -1,57 +1,55 @@ getRequest(); - $user = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $this->getViewer(); if ($request->isFormPost()) { $source = $request->getStr('source'); $future = PhutilXHPASTBinary::getParserFuture($source); $resolved = $future->resolve(); // This is just to let it throw exceptions if stuff is broken. $parse_tree = XHPASTTree::newFromDataAndResolvedExecFuture( $source, $resolved); list($err, $stdout, $stderr) = $resolved; $storage_tree = new PhabricatorXHPASTViewParseTree(); $storage_tree->setInput($source); $storage_tree->setStdout($stdout); - $storage_tree->setAuthorPHID($user->getPHID()); + $storage_tree->setAuthorPHID($viewer->getPHID()); $storage_tree->save(); return id(new AphrontRedirectResponse()) ->setURI('/xhpast/view/'.$storage_tree->getID().'/'); } $form = id(new AphrontFormView()) - ->setUser($user) + ->setUser($viewer) ->appendChild( id(new AphrontFormTextAreaControl()) ->setLabel(pht('Source')) ->setName('source') ->setValue("setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue(pht('Parse'))); $form_box = id(new PHUIObjectBoxView()) ->setHeaderText(pht('Generate XHP AST')) ->setForm($form); return $this->buildApplicationPage( $form_box, array( 'title' => pht('XHPAST View'), )); } } diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php index 4a098f1591..3fe1046f10 100644 --- a/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php +++ b/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php @@ -1,33 +1,33 @@ getStorageTree(); $input = $storage->getInput(); $stdout = $storage->getStdout(); $tree = XHPASTTree::newFromDataAndResolvedExecFuture( $input, array(0, $stdout, '')); $tokens = array(); foreach ($tree->getRawTokenStream() as $id => $token) { $seq = $id; $name = $token->getTypeName(); $title = pht('Token %s: %s', $seq, $name); $tokens[] = phutil_tag( 'span', array( 'title' => $title, 'class' => 'token', ), $token->getValue()); } return $this->buildXHPASTViewPanelResponse( phutil_implode_html('', $tokens)); } } diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewTreeController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewTreeController.php index 7da285f121..1b4eec6441 100644 --- a/src/applications/phpast/controller/PhabricatorXHPASTViewTreeController.php +++ b/src/applications/phpast/controller/PhabricatorXHPASTViewTreeController.php @@ -1,49 +1,49 @@ getStorageTree(); $input = $storage->getInput(); $stdout = $storage->getStdout(); $tree = XHPASTTree::newFromDataAndResolvedExecFuture( $input, array(0, $stdout, '')); $tree = phutil_tag('ul', array(), $this->buildTree($tree->getRootNode())); return $this->buildXHPASTViewPanelResponse($tree); } protected function buildTree($root) { try { $name = $root->getTypeName(); $title = $root->getDescription(); } catch (Exception $ex) { $name = '???'; $title = '???'; } $tree = array(); $tree[] = phutil_tag( 'li', array(), phutil_tag( 'span', array( 'title' => $title, ), $name)); foreach ($root->getChildren() as $child) { $tree[] = phutil_tag('ul', array(), $this->buildTree($child)); } return phutil_implode_html("\n", $tree); } }