Exemplo n.º 1
0
 /**
  * Find the page with the given title
  *
  * @param string $title Title
  * @param array $options Options
  * @return array Page data
  */
 public function find_page($title, $options = array())
 {
     $param = array();
     if ($title === "") {
         $title = $this->field('start_page');
     }
     $title = Wiki::titleize($title);
     $page = $this->WikiPage->find('first', array('conditions' => array('WikiPage.wiki_id' => $this->id, 'WikiPage.title' => $title)));
     if (isset($page['WikiPage']['id'])) {
         $this->WikiPage->id = $page['WikiPage']['id'];
     }
     //    if !page && !(options[:with_redirect] == false)
     //      # search for a redirect
     //      redirect = redirects.find_by_title(title)
     //      page = find_page(redirect.redirects_to, :with_redirect => false) if redirect
     //    end
     return $page;
 }