Example #1
0
 /**
  * The function returns link for current controller.
  * 
  * @access public
  * @return string The link.
  */
 public function getLink()
 {
     if (($link = Route::getLink($this)) !== null) {
         return $link;
     }
     $link = null;
     $args = array();
     $parents = $this->getParents('Controller_Base', true);
     array_unshift($parents, $this);
     foreach ($parents as $class) {
         $link = Route::getLink($class);
         if ($link) {
             break;
         }
     }
     $suffix = str_replace(get_class($class), '', get_class($this));
     if ($suffix) {
         $link .= '/' . ltrim(strtolower(str_replace('_', '/', $suffix)), '/');
     }
     Route::set($this, $link);
     return $link;
 }