Ejemplo n.º 1
0
 /**
  * Expand links to entry aliases.
  * If a user embeds {entry} in a URL, it is automatically expanded to the URL for the
  * {$link ENTRY} object.
  * @param string $url
  * @param boolean $root_override Overrides {@link $resolve_to_root} if set to
  * {@link Force_root_on}.
  * @return string
  */
 public function resolve_file($url, $root_override = null)
 {
     $entry_key = '{entry}';
     if (strpos($url, $entry_key) !== false) {
         $id = substr($url, strlen($entry_key));
         if ($id && $id[0] == '/') {
             $id = substr($id, 1);
         }
         if (is_numeric($id)) {
             $entry_query = $this->entry_query();
             $entry = $entry_query->object_at_id($id);
             $url = $entry->home_page();
         } else {
             $url = "[ERROR]:entry for {$id} not found";
         }
     }
     return parent::resolve_file($url, $root_override);
 }