protected function assertUrlMatchesRoute($route, $url) { $request = new \Faid\Request\HttpRequest(); $request->url($url); $route = \Extasy\CMS::getInstance()->getDispatcher()->getNamed($route, $request); $this->assertTrue((bool) $route->test($request)); }
public function __construct() { $this->type = \Extasy\CMS::getInstance()->getDispatcher()->getRequest()->get('type'); if (!in_array($this->type, ['vkontakte', 'twitter', 'odnoklassniki'])) { throw new \InvalidArgumentException('Unknown social network'); } switch ($this->type) { case 'vkontakte': $this->api = VkontakteApiFactory::getInstance(); break; case 'twitter': $this->api = TwitterApiFactory::getInstance(); break; case 'odnoklassniki': $this->api = OdnoklassnikiApiFactory::getInstance(); break; } }
protected function searchSitemap() { try { ACLUser::checkCurrentUserGrants([SitemapModel::PermissionName]); $items = \Sitemap_Sample::search($this->searchPhrase, 0, 10); } catch (\Exception $e) { $items = []; } foreach ($items as $row) { $isScript = !empty($row['script_admin_url']); $add = new SearchResultModel(); $add->title = $row['name']; $add->icon = 'glyphicon glyphicon-user'; // if (!$isScript) { $route = CMS::getInstance()->getDispatcher()->getNamed('dashboard.sitemap.manage'); $add->link = $route->buildUrl() . '?id=' . $row['id']; } else { $add->link = sprintf('http://%s%s', CMS::getDashboardWWWRoot(), $row['script_admin_url']); } $this->results[] = $add; } }
protected function getLoginUrl() { $domain = \Faid\Configure\Configure::read('MainDomain'); $dashboardRoot = \Extasy\CMS::getInstance()->getDashboardWWWRoot(); return sprintf('http://%s%s', $domain, $dashboardRoot); }
protected static function getCurrentBaseUrl() { $request = \Extasy\CMS::getInstance()->getDispatcher()->getRequest(); $result = sprintf('//%s/', $request->domain()); return $result; }
protected function checkIfCMSStarted() { $cms = \Extasy\CMS::getInstance(); if (empty($cms)) { throw new \Exception('Error happened before CMS started'); } }