protected function _beforeControllerGet(AnCommandContext $context)
    {
        if ($this->cid) {
            $context->response->content = $this->getCommentController()->id($this->cid)->display();

            return false;
        } elseif ($this->permalink && !$context->request->isAjax()) {
            $cid = (int) preg_replace_callback('/[^\d]+/', function($matches) { return ''; }, $this->permalink);
            $offset = $this->getItem()->getCommentOffset($cid);
            $start = (int) ($offset / $this->limit) * $this->limit;
            $url = AnRequest::url();
            $query = $url->getQuery(true);

            if ($this->start != $start) {
                $query = array_merge($query, array('start' => $start));
            }

            unset($query['permalink']);

            $url->setQuery($query);

            $context->response->setRedirect($url.'#scroll='.$this->permalink);

            return false;
        }
    }
protected function _beforeControllerGet(AnCommandContext $context)
    {
        if ($this->cid) {
            $context->response->content = $this->getCommentController()->id($this->cid)->display();

            return false;
        } elseif ($this->permalink && !$context->request->isAjax()) {
            $cid = (int) preg_replace_callback('/[^\d]+/', function($matches) { return ''; }, $this->permalink);
            $offset = $this->getItem()->getCommentOffset($cid);
            $start = (int) ($offset / $this->limit) * $this->limit;
            $url = AnRequest::url();
            $query = $url->getQuery(true);

            if ($this->start != $start) {
                $query = array_merge($query, array('start' => $start));
            }

            unset($query['permalink']);

            $url->setQuery($query);

            $context->response->setRedirect($url.'#scroll='.$this->permalink);

            return false;
        }
    }
protected function _beforeControllerGet ( AnCommandContext $ context ) { if ( $ this -> cid ) { $ context -> response -> content = $ this -> getCommentController ( ) -> id ( $ this -> cid ) -> display ( ) ; return false ; } elseif ( $ this -> permalink && ! $ context -> request -> isAjax ( ) ) { $ cid = ( int ) preg_replace_callback ( '/[^\d]+/' , function ( $ matches ) { return '' ; } , $ this -> permalink ) ; $ offset = $ this -> getItem ( ) -> getCommentOffset ( $ cid ) ; $ start = ( int ) ( $ offset / $ this -> limit ) * $ this -> limit ; $ url = AnRequest :: url ( ) ; $ query = $ url -> getQuery ( true ) ; if ( $ this -> start != $ start ) { $ query = array_merge ( $ query , array ( 'start' => $ start ) ) ; } unset ( $ query [ 'permalink' ] ) ; $ url -> setQuery ( $ query ) ; $ context -> response -> setRedirect ( $ url . '#scroll=' . $ this -> permalink ) ; return false ; } }
Intercept a get method to check whether to show the comments only or not.

@param AnCommandContext $context

@return bool
Intercept a get method to check whether to show the comments only or not .