public function actionTitle() { $url = $this->getQuery('url'); if (empty($url)) { throw BadRequestHttpException('common', 'parameters_missing'); } $url = urldecode($url); $page = Page::getByShortUrl($url); if (!empty($page->title)) { return ['title' => $page->title]; } $article = Article::getByUrl($url); return ['title' => empty($article->name) ? '' : $article->name]; }