Esempio n. 1
0
 /**
  * Load the page model to the permalink.
  * @return {ae_PageModel} The loaded page model.
  */
 public static function getPageModel()
 {
     if (!self::isPage()) {
         $msg = sprintf('[%s] Permalink does not represent a page.', get_class());
         throw new Exception($msg);
     }
     $model = new ae_PageModel();
     if (isset($_GET[PERMALINK_GET_PAGE]) && ae_Validate::id($_GET[PERMALINK_GET_PAGE])) {
         if (!$model->load($_GET[PERMALINK_GET_PAGE])) {
             return FALSE;
         }
     } else {
         $permalink = mb_substr(self::$url, 1);
         $permalink = preg_replace(';^' . PERMALINK_BASE_PAGE . ';i', '', $permalink);
         if (!$model->loadFromPermalink($permalink)) {
             return FALSE;
         }
     }
     return $model;
 }