/** * Get the user ID. * @return {int|boolean} The user ID or FALSE on failure. */ public static function getUserId() { if (!self::isUser()) { $msg = sprintf('[%s] Permalink does not represent a user.', get_class()); throw new Exception($msg); } $model = new ae_UserModel(); if (isset($_GET[PERMALINK_GET_USER])) { $permalink = $_GET[PERMALINK_GET_USER]; } else { $permalink = mb_substr(self::$url, 1); $permalink = preg_replace(';^' . PERMALINK_BASE_USER . ';i', '', $permalink); } if (!$model->loadFromPermalink($permalink)) { return FALSE; } return $model->getId(); }