/** * @return \Illuminate\View\View */ public function homepage() { $page = $this->news->homepage(); $this->throw404IfNotFound($page); $template = $this->getTemplateForPage($page); return view('frontend', compact('page')); }
protected function setup() { $pageTypeRepository = new PageTypeRepository(TRUE); $pageType = $pageTypeRepository->getOneByAlias(Utils::get('action')); $pageRepository = new PageRepository(TRUE); $page = $pageRepository->getOneByPageType($pageType['id']); MySmarty::assign('page', $page); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); $data = ['id' => 1, 'iso_code_2' => 'EG', 'iso_code_3' => 'EGY', 'en' => ['title' => 'Egypt'], 'ar' => ['title' => 'مصر']]; $this->country->create($data); $data = ['country_id' => 1, 'en' => ['title' => 'Luxor'], 'ar' => ['title' => 'الأقصر']]; $this->zone->create($data); }
protected function addSeo() { $action = Utils::get('action'); $pageRepository = new PageRepository(TRUE); $page = $pageRepository->getOneByAlias($action); if (self::$seoAdded === FALSE) { BangSeo::addTitlePart($page['title']); BangSeo::setDescription($page['meta_description']); BangSeo::addContentForKeywords($page['meta_keywords'], BangSeo::MEDIUM_PRIORITY); self::$seoAdded = TRUE; } }
public static function getPageByTypeAndLanguage($type, $lang = NULL) { $language = Utils::getLanguage($lang); if ($language) { $pageTypeRepository = new PageTypeRepository(TRUE); $pageType = $pageTypeRepository->getOneByAlias($type); $pageRepository = new PageRepository(TRUE); $page = $pageRepository->getOneByLanguageAndPageType($language['id'], $pageType['id']); if ($page) { return $page; } else { throw new Exception('Page with type ' . $pageType['title'] . ' and language ' . $language['title'] . ' doesn\'t exist', 1326403622); } } else { throw new Exception('Language ' . $lang . ' not found', 1326403989); } }
public function getCorrespondingUrl() { $action = Utils::get('action'); if ($action) { $pageRepository = new PageRepository(TRUE); $actualPage = $pageRepository->getOneByAlias($action); $aliases = array(); if ($actualPage) { $pageTypeRepository = new PageTypeRepository(TRUE); $pageType = $pageTypeRepository->getOneById($actualPage['page_type']); $page = PageActionMap::getPageByTypeAndLanguage($pageType['alias'], $this['shortcut']); $aliases[] = $page['alias']; } else { $aliases[] = $action; } if (Utils::get('identifier')) { $aliases[] = Utils::get('identifier'); } return PageActionMap::createUrl($aliases, $this['shortcut']); } else { return $this->getUrl(); } }
/** * @expectedException NotFoundException */ public function testFindByIndexNotFound() { PageRepository::find(99); }
<?php require_once 'function.php'; require 'classes.php'; require 'repo.php'; $link = getDbConnect(); $title = "Общая статистика"; $pids = []; $ranks = []; $error = false; $all_sites = SiteRepository::loadAll($link); $all_persons = PersonRepository::loadAll($link); if (isset($_POST['submit'])) { $site_id = $_POST['sites']; if ($site_id != 0) { $site_page = PageRepository::selectAllBySiteID($link, $site_id); //массив объектов страниц foreach ($site_page as $ids) { $pid = $ids->getId(); $pids[] = $pid; } $site = SiteRepository::load($link, $site_id); $site_name = $site->getName(); } else { $error = true; } } include 'view/header.php'; include 'view/v_static-all.php'; include 'view/footer.php';
<?php require_once 'config.php'; require_once 'auto.php'; require_once 'init.php'; try { BangSeo::addTitlePart('Bang!'); $language = Utils::get('language'); if (!$language) { // TODO check user and country, then default en $url = PageActionMap::createUrl(array(), 'sk'); Utils::redirect($url); } $actionAlias = Utils::get('action'); $pageRepository = new PageRepository(TRUE); $page = $pageRepository->getOneByAlias($actionAlias); $pageTypeRepository = new PageTypeRepository(TRUE); $pageType = $pageTypeRepository->getOneById($page['page_type']); $action = PageActionMap::getActionByPageAndLanguage(Utils::get('action')); $actionClassName = ucfirst($action) . 'Action'; // TODO caching if (LoggedUser::whoIsLogged() === NULL && $pageType['needs_login'] == 1) { if ($pageType['action'] != 'logout') { setcookie('ref_url', Utils::getActualUrl(), NULL, '/'); } $page = PageActionMap::getPageByTypeAndLanguage('login', $language); $url = PageActionMap::createUrl($page['alias']); Utils::redirect($url); } $actionClass = new $actionClassName(); MySmarty::assign('content', $actionClass->getContent());
public function testLoaded() { $this->assertGreaterThan(0, PostRepository::count()); $this->assertGreaterThan(0, PageRepository::count()); $this->assertGreaterThan(0, PluginRepository::count()); }