Ejemplo n.º 1
0
 public function preview_page()
 {
     $page = Page::getByID(intval($_REQUEST['cID'], 10), 'RECENT');
     if (!is_object($page) || $page->isError()) {
         throw new \InvalidArgumentException('Invalid collection ID');
     }
     $permissions = new Permissions($page);
     if ($permissions->canPreviewPageAsUser() && $permissions->canRead() && Config::get('concrete.permissions.model') == 'advanced') {
         /** @var Request $request */
         $request = Request::getInstance();
         $request->setCustomRequestUser(false);
         $request->setCurrentPage($page);
         if ($request->request('customUser')) {
             $user_info = UserInfo::getByUserName($request->request('customUser'));
             if ($user_info && is_object($user_info) && !$user_info->isError()) {
                 $request->setCustomRequestUser($user_info);
             }
         }
         $request->setCustomRequestDateTime(Core::make('helper/form/date_time')->translate('preview_as_user_datetime', $request->request()));
         $controller = $page->getPageController();
         $view = $controller->getViewObject();
         if ($request->request('emulateMobile') == 1) {
             $mobileTheme = Theme::getByID(Config::get('concrete.misc.mobile_theme_id'));
             if ($mobileTheme instanceof Theme) {
                 $view->setViewTheme($mobileTheme);
             }
         }
         $response = new \Response();
         $response->setContent($view->render());
         $response->send();
     }
 }
 public function registerEvents()
 {
     $app = $this->app;
     $events = $this->app->make('director');
     // Add the sitemap icons listener
     $events->addListener('on_before_render', function ($event) use($app) {
         $c = Page::getCurrentPage();
         $view = $event->getArgument('view');
         $assets = $app->make('asset_pipeline/helper/assets');
         $theme = null;
         if (is_object($c)) {
             $theme = $c->getCollectionThemeObject();
         } else {
             $theme = Theme::getSiteTheme();
         }
         // TODO: If there are page-specific styles set, should we use
         //       this one instead:
         //$style = $c->getCustomStyleObject();
         $style = $theme->getThemeCustomStyleObject();
         if (is_object($style)) {
             $valueList = $style->getValueList();
             if ($valueList instanceof \Concrete\Core\StyleCustomizer\Style\ValueList) {
                 $variables = array();
                 foreach ($valueList->getValues() as $value) {
                     $variables = array_merge($value->toLessVariablesArray(), $variables);
                 }
                 $assets->setStylesheetVariables('theme', $variables);
             }
         }
         $view->addScopeItems(array('assets' => $assets));
     });
 }
Ejemplo n.º 3
0
 public function getTheme()
 {
     if ($this->pThemeID > 0) {
         $theme = Theme::getByID($this->pThemeID);
         return $theme;
     }
 }
Ejemplo n.º 4
0
 public function testThemeGridAreaLayoutContainer()
 {
     $layout = \Concrete\Core\Area\Layout\ThemeGridLayout::add();
     $layout->addLayoutColumn()->setAreaLayoutColumnSpan(4);
     $column = $layout->addLayoutColumn();
     $column->setAreaLayoutColumnSpan(2);
     $column->setAreaLayoutColumnOffset(2);
     $layout->addLayoutColumn()->setAreaLayoutColumnSpan(6);
     $elemental = \Concrete\Core\Page\Theme\Theme::add('elemental');
     Page::addHomePage();
     Core::make('cache/request')->disable();
     $c = Page::getByID(1);
     $c->setTheme($elemental);
     $c = Page::getByID(1);
     $req = Request::getInstance();
     $req->setCurrentPage($c);
     $layout = \Concrete\Core\Area\Layout\Layout::getByID(1);
     $this->assertInstanceOf('\\Concrete\\Core\\Area\\Layout\\ThemeGridLayout', $layout);
     $columns = $layout->getAreaLayoutColumns();
     $this->assertEquals(3, count($columns));
     $formatter = $layout->getFormatter();
     $this->assertInstanceOf('\\Concrete\\Core\\Area\\Layout\\Formatter\\ThemeGridFormatter', $formatter);
     $this->assertEquals('<div class="row"></div>', (string) $formatter->getLayoutContainerHtmlObject());
     $req->clearCurrentPage();
 }
Ejemplo n.º 5
0
 public function install()
 {
     // Run default install process
     $pkg = parent::install();
     //theme install
     Theme::add('base_theme', $pkg);
     $db = Database::getActiveConnection();
     //add and refresh single page
     $this->addSinglePage('/dashboard/system/basics/name', 'Name', 'test');
 }
Ejemplo n.º 6
0
 public function registerAssets()
 {
     parent::registerAssets();
     $this->requireAsset('javascript', 'jquery');
     $this->requireAsset('javascript', 'jquery-ui');
     $this->requireAsset('css', 'jquery-ui');
     $this->providesAsset('css', 'bootstrap');
     $this->providesAsset('css', 'bootstrap-theme');
     $this->providesAsset('javascript', 'bootstrap');
 }
Ejemplo n.º 7
0
 public function renderSearchField()
 {
     $html = '<select name="pThemeID" class="form-control">';
     $themes = Theme::getList();
     foreach ($themes as $pt) {
         $html .= '<option value="' . $pt->getThemeID() . '" ' . ($pt->getThemeID() == $this->data['pThemeID'] ? ' selected' : '') . '>' . $pt->getThemeName() . '</option>';
     }
     $html .= '</select>';
     return $html;
 }
Ejemplo n.º 8
0
 public function getResults(Request $request)
 {
     $list = \Concrete\Core\Page\Theme\Theme::getList();
     $items = array();
     foreach ($list as $t) {
         $item = new \PortlandLabs\Concrete5\MigrationTool\Entity\Export\Theme();
         $item->setItemId($t->getThemeID());
         $items[] = $item;
     }
     return $items;
 }
Ejemplo n.º 9
0
 public function add(Type $type, Theme $theme, $handle, $name, $locale, $default = false)
 {
     $factory = new Factory($this->config);
     $site = $factory->createEntity();
     $site->setSiteHandle($handle);
     $site->setIsDefault($default);
     $site->setType($type);
     $site->setThemeID($theme->getThemeID());
     $site->getConfigRepository()->save('name', $name);
     $this->entityManager->persist($site);
     $this->entityManager->flush();
     $data = explode('_', $locale);
     $locale = new Locale();
     $locale->setSite($site);
     $locale->setIsDefault(true);
     $locale->setLanguage($data[0]);
     $locale->setCountry($data[1]);
     $this->entityManager->persist($locale);
     $this->entityManager->flush();
     $this->entityManager->refresh($site);
     return $site;
 }
 public function import(\SimpleXMLElement $sx)
 {
     if (isset($sx->themes)) {
         foreach ($sx->themes->theme as $th) {
             $pkg = static::getPackageObject($th['package']);
             $pThemeHandle = (string) $th['handle'];
             $pt = Theme::getByHandle($pThemeHandle);
             if (!is_object($pt)) {
                 $pt = Theme::add($pThemeHandle, $pkg);
             }
             if ($th['activated'] == '1') {
                 $pt->applyToSite();
             }
         }
     }
 }
 public function execute(Batch $batch)
 {
     $themes = $batch->getObjectCollection('theme');
     if (!$themes) {
         return;
     }
     foreach ($themes->getThemes() as $theme) {
         if (!$theme->getPublisherValidator()->skipItem()) {
             $pkg = null;
             if ($theme->getPackage()) {
                 $pkg = \Package::getByHandle($theme->getPackage());
             }
             $t = Theme::add($theme->getHandle(), $pkg);
             if ($theme->getIsActivated()) {
                 $t->applyToSite();
             }
         }
     }
 }
Ejemplo n.º 12
0
 public function setCustomStyleObject(\Concrete\Core\Page\Theme\Theme $pt, \Concrete\Core\StyleCustomizer\Style\ValueList $valueList, $selectedPreset = false, $customCssRecord = false)
 {
     $db = Database::get();
     $db->delete('CollectionVersionThemeCustomStyles', array('cID' => $this->getCollectionID(), 'cvID' => $this->getVersionID()));
     $sccRecordID = 0;
     if ($customCssRecord instanceof CustomCssRecord) {
         $sccRecordID = $customCssRecord->getRecordID();
     }
     $preset = false;
     if ($selectedPreset) {
         $preset = $selectedPreset->getPresetHandle();
     }
     if ($customCssRecord instanceof CustomCssRecord) {
         $sccRecordID = $customCssRecord->getRecordID();
     }
     $db->insert('CollectionVersionThemeCustomStyles', array('cID' => $this->getCollectionID(), 'cvID' => $this->getVersionID(), 'pThemeID' => $pt->getThemeID(), 'sccRecordID' => $sccRecordID, 'preset' => $preset, 'scvlID' => $valueList->getValueListID()));
     $scc = new \Concrete\Core\Page\CustomStyle();
     $scc->setThemeID($pt->getThemeID());
     $scc->setValueListID($valueList->getValueListID());
     $scc->setPresetHandle($preset);
     $scc->setCustomCssRecordID($sccRecordID);
     return $scc;
 }
Ejemplo n.º 13
0
 /**
  * Returns an asset path relative to the theme directory.
  * If the second argument is given, it is used as the
  * theme handle for which the path is returned. If the
  * theme handle is not defined, the current theme is
  * used instead.
  *
  * @param \Less_Tree $urlTree
  * @param \Less_Tree|null $themeTree
  *
  * @return \Less_Tree
  */
 public function themeAssetPath($urlTree, $themeTree = null)
 {
     $url = $urlTree->value;
     $theme = is_object($themeTree) ? $themeTree->value : null;
     if ($url[0] != '/') {
         $url = '/' . $url;
     }
     if (empty($theme)) {
         $theme = $this->getCurrentTheme();
     } else {
         $to = Theme::getByHandle($theme);
         if (!is_object($to)) {
             throw new \Exception(t("Invalid theme-asset-url: %s, %s. A theme does not exist with handle: %s.", $url, $theme, $theme));
         }
         $theme = $to;
     }
     // Default to theme URL
     $env = Environment::get();
     $themeUrl = $env->getURL(DIRNAME_THEMES . '/' . $theme->getThemeHandle(), $theme->getPackageHandle());
     $urlTree->value = $themeUrl . $url;
     return $urlTree;
 }
Ejemplo n.º 14
0
 public function install()
 {
     $pkg = parent::install();
     Theme::add('sakan', $pkg);
     BlockType::installBlockTypeFromPackage('manual_nav', $pkg);
 }
Ejemplo n.º 15
0
 public function getFullPath($path, $dirName = null)
 {
     if ($path[0] == '@') {
         if (($pos = strpos($path, '/')) !== false) {
             $location = substr($path, 1, $pos);
             $subpath = substr($path, $pos + 1);
             $locationPath = '';
             if ($location == 'core') {
                 $locationPath = DIR_BASE_CORE;
             } elseif ($location == 'app') {
                 $locationPath = DIR_APPLICATION;
             } elseif ($location == 'package') {
                 if (($pos = strpos($subpath, '/')) !== false) {
                     $pkgHandle = substr($subpath, 0, $pos);
                     $subpath = substr($subpath, $pos + 1);
                     $locationPath = DIR_PACKAGES . '/' . $pkgHandle;
                 } else {
                     throw new Exception(t("Invalid path: %s. Package not defined.", $path));
                 }
             } elseif ($location == 'theme') {
                 if (($pos = strpos($subpath, '/')) !== false) {
                     $themeHandle = substr($subpath, 0, $pos);
                     $subpath = substr($subpath, $pos + 1);
                     if (is_object($th = Theme::getByHandle($themeHandle))) {
                         $env = Environment::get();
                         $locationPath = $env->getPath(DIRNAME_THEMES . '/' . $themeHandle, $th->getPackageHandle());
                     } else {
                         throw new Exception(t("Invalid theme in path: %s. Theme '%s' does not exist."));
                     }
                 } else {
                     throw new Exception(t("Invalid path: %s. Theme not defined.", $path));
                 }
             } else {
                 throw new Exception(t("Invalid path: %s. Unknown location: %s.", $path, $location));
             }
             if (!empty($locationPath)) {
                 return $locationPath . '/' . $dirName . '/' . $subpath;
             }
         } else {
             // This is an assetic alias, e.g. "@jquery".
             return $path;
         }
     } elseif ($path[0] == '/' || preg_match('#[a-z]:[/\\\\]#i', $path)) {
         return $path;
     }
     // Theme specific CSS (default)
     return $this->themeBasePath . '/' . $dirName . '/' . $path;
 }
 public function install()
 {
     $pkg = parent::install();
     Theme::add('foundation', $pkg);
 }
Ejemplo n.º 17
0
 public function setPropertiesFromArray($arr)
 {
     return parent::setPropertiesFromArray($arr);
 }
Ejemplo n.º 18
0
 /**
  * Returns an asset path relative to the theme directory.
  * The given arguments array needs to contain 1-2 values
  * in it as follows:
  *
  * 1. The first item in the array needs to be the relative
  *    URL for which we want the full path for.
  * 2. The second item in the array can either be left out
  *    or when defined, represent the theme handle.
  *
  * If the second argument is given, it is used as the
  * theme handle for which the path is returned. If the
  * theme handle is not defined, the current theme is
  * used instead.
  *
  * @param array $args
  *
  * @return string
  */
 public function themeAssetPath(array $args)
 {
     list($url, $theme) = $args;
     $url = $this->extractStringFromArgument($url);
     $theme = $this->extractStringFromArgument($theme);
     if ($url[0] != '/') {
         $url = '/' . $url;
     }
     if (empty($theme)) {
         $theme = $this->getCurrentTheme();
     } else {
         $to = Theme::getByHandle($theme);
         if (!is_object($to)) {
             throw new \Exception(t("Invalid theme-asset-url: %s, %s. A theme does not exist with handle: %s.", $url, $theme, $theme));
         }
         $theme = $to;
     }
     // Default to theme URL
     $env = Environment::get();
     $themeUrl = $env->getURL(DIRNAME_THEMES . '/' . $theme->getThemeHandle(), $theme->getPackageHandle());
     return $themeUrl . $url;
 }
Ejemplo n.º 19
0
 public function getPackageItems(Package $package)
 {
     return \Concrete\Core\Page\Theme\Theme::getListByPackage($package);
 }
 public function install()
 {
     $pkg = parent::install();
     Theme::add('semantic_ui', $pkg);
 }
Ejemplo n.º 21
0
 public function reset_site_customizations($pThemeID)
 {
     if ($this->validateAction()) {
         Page::resetAllCustomStyles();
         $pt = PageTheme::getByID($pThemeID);
         $pt->resetThemeCustomStyles();
         $r = new PageEditResponse();
         $r->setPage($this->page);
         $r->setRedirectURL(URL::to($this->page));
         $r->outputJSON();
     }
 }
Ejemplo n.º 22
0
 /**
  * @return bool|int[] true on success, array of error codes on failure
  */
 public function testForUninstall()
 {
     $errors = array();
     $manager = new Manager($this->app);
     /**
      * @var $driver ItemInterface
      */
     $driver = $manager->driver('theme');
     $themes = $driver->getItems($this->getPackageEntity());
     /** @var Theme[] $themes */
     // Step 1, check for active themes
     $active_theme = Theme::getSiteTheme();
     foreach ($themes as $theme) {
         if ($active_theme->getThemeID() == $theme->getThemeID()) {
             $errors[] = self::E_PACKAGE_THEME_ACTIVE;
             break;
         }
     }
     if (count($errors) > 0) {
         $e = $this->app->make('error');
         foreach ($errors as $error) {
             $e->add($this->getErrorText($error));
         }
         return $e;
     } else {
         return true;
     }
 }
 public function configurePackage($pkg)
 {
     $theme = Theme::getByHandle('worldskills');
     if (!is_object($theme)) {
         $theme = Theme::add('worldskills', $pkg);
     }
     // add skill ID attribute
     $attributeKey = CollectionAttributeKey::getByHandle('worldskills_skill_id');
     if (!is_object($attributeKey)) {
         $type = AttributeType::getByHandle('text');
         $args = array('akHandle' => 'worldskills_skill_id', 'akName' => t('Skill ID'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1);
         CollectionAttributeKey::add($type, $args, $pkg);
     }
     // add skill page type
     $pageType = \PageType::getByHandle('worldskills_skill');
     if (!is_object($pageType)) {
         $template = \PageTemplate::getByHandle('full');
         \PageType::add(array('handle' => 'worldskills_skill', 'name' => 'Skill', 'defaultTemplate' => $template, 'allowedTemplates' => 'C', 'templates' => array($template), 'ptLaunchInComposer' => 0, 'ptIsFrequentlyAdded' => 0), $pkg)->setConfiguredPageTypePublishTargetObject(new PageTypePublishTargetAllConfiguration(PageTypePublishTargetAllType::getByHandle('all')));
     }
     // add member ID attribute
     $attributeKey = CollectionAttributeKey::getByHandle('worldskills_member_id');
     if (!is_object($attributeKey)) {
         $type = AttributeType::getByHandle('text');
         $args = array('akHandle' => 'worldskills_member_id', 'akName' => t('Member ID'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1);
         CollectionAttributeKey::add($type, $args, $pkg);
     }
     // add member page type
     $pageType = \PageType::getByHandle('worldskills_member');
     if (!is_object($pageType)) {
         $template = \PageTemplate::getByHandle('full');
         \PageType::add(array('handle' => 'worldskills_member', 'name' => 'Member', 'defaultTemplate' => $template, 'allowedTemplates' => 'C', 'templates' => array($template), 'ptLaunchInComposer' => 0, 'ptIsFrequentlyAdded' => 0), $pkg)->setConfiguredPageTypePublishTargetObject(new PageTypePublishTargetAllConfiguration(PageTypePublishTargetAllType::getByHandle('all')));
     }
     // add skill block
     $blockType = \BlockType::getByHandle('worldskills_skill');
     if (!is_object($blockType)) {
         \BlockType::installBlockTypeFromPackage('worldskills_skill', $pkg);
     }
     // add skill list block
     $blockType = \BlockType::getByHandle('worldskills_skill_list');
     if (!is_object($blockType)) {
         \BlockType::installBlockTypeFromPackage('worldskills_skill_list', $pkg);
     }
     // add people block
     $blockType = \BlockType::getByHandle('worldskills_people');
     if (!is_object($blockType)) {
         \BlockType::installBlockTypeFromPackage('worldskills_people', $pkg);
     }
     // add member block
     $blockType = \BlockType::getByHandle('worldskills_member');
     if (!is_object($blockType)) {
         \BlockType::installBlockTypeFromPackage('worldskills_member', $pkg);
     }
     // add member list block
     $blockType = \BlockType::getByHandle('worldskills_member_list');
     if (!is_object($blockType)) {
         \BlockType::installBlockTypeFromPackage('worldskills_member_list', $pkg);
     }
     try {
         $authenticationType = AuthenticationType::getByHandle('worldskills');
     } catch (\Exception $e) {
         $authenticationType = AuthenticationType::add('worldskills', 'WorldSkills Auth', 0, $pkg);
         $authenticationType->disable();
     }
     $page = \SinglePage::add('/dashboard/system/basics/worldskills', $pkg);
     if (is_object($pag)) {
         $page->updateCollectionName('WorldSkills');
     }
     \Config::save('worldskills.api_url', \Config::get('worldskills.api_url', 'https://api.worldskills.org'));
     \Config::save('worldskills.authorize_url', \Config::get('worldskills.authorize_url', 'https://auth.worldskills.org'));
 }
Ejemplo n.º 24
0
 public function install()
 {
     $pkg = parent::install();
     Theme::add('scooptherapy', $pkg);
 }
Ejemplo n.º 25
0
?>
</title>
<?php 
$canonical_link = $c->getCollectionLink(true);
echo new \Concrete\Core\Html\Object\HeadLink($canonical_link, 'canonical');
?>
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<script type="application/ld+json">
<?php 
if (is_object($c)) {
    /** @var \Concrete\Core\Localization\Service\Date $date */
    $date = Core::make('helper/date');
    /** @var \Concrete\Core\Utility\Service\Text $text */
    $text = Core::make('helper/text');
    /** @var \Concrete\Core\Page\Theme\Theme $theme */
    $theme = \Concrete\Core\Page\Theme\Theme::getByHandle('amp');
    $theme_url = Core::getApplicationURL() . $theme->getThemeURL();
    $theme_path = DIR_BASE . $theme->getThemeURL();
    // We can set a headline 3 ways:
    // 1. It comes through programmatically as $pageDescription.
    // 2. It comes from meta description
    // 3. It comes from getCollectionDescription()
    if (!isset($pageDescription) || !$pageDescription) {
        // we aren't getting it dynamically.
        $pageDescription = $c->getCollectionAttributeValue('meta_description');
        if (!$pageDescription) {
            $pageDescription = $c->getCollectionDescription();
        }
    }
    /** @var \Concrete\Core\User\UserInfo $author */
    $author = Core::make('Concrete\\Core\\User\\UserInfoFactory')->getByID($c->getCollectionUserID());
Ejemplo n.º 26
0
 public function testElementalThemePresetsPageWithTheme()
 {
     $elemental = \Concrete\Core\Page\Theme\Theme::add('elemental');
     Core::make('cache/request')->disable();
     $c = Page::getByID(1);
     $c->setTheme($elemental);
     $c = Page::getByID(1);
     $req = Request::getInstance();
     $req->setCurrentPage($c);
     $manager = Core::make('manager/area_layout_preset_provider');
     $manager->register(new \Concrete\Core\Area\Layout\Preset\Provider\ActiveThemeProvider());
     $presets = $manager->getPresets();
     $this->assertEquals(2, count($presets));
     $preset = $presets[0];
     $formatter = $preset->getFormatter();
     $this->assertInstanceOf('\\Concrete\\Core\\Area\\Layout\\Preset\\Formatter\\ThemeFormatter', $formatter);
     $this->assertEquals('<div class="row"></div>', (string) $formatter->getPresetContainerHtmlObject());
     $this->assertEquals('Left Sidebar', $preset->getName());
     $columns = $preset->getColumns();
     $this->assertEquals(2, count($columns));
     $this->assertEquals('theme_elemental_left_sidebar', $preset->getIdentifier());
     $this->assertEquals('<div class="col-sm-4"></div>', (string) $columns[0]->getColumnHtmlObject());
     $this->assertEquals('<div class="col-sm-8"></div>', (string) $columns[1]->getColumnHtmlObject());
     $req->clearCurrentPage();
 }
Ejemplo n.º 27
0
 public function install()
 {
     $pkg = parent::install();
     Theme::add('juiced', $pkg);
 }
 public function execute(Request $request, \Concrete\Core\Routing\Route $route = null, $parameters = array())
 {
     // figure out where we need to go
     $c = Page::getFromRequest($request);
     if ($c->isError() && $c->getError() == COLLECTION_NOT_FOUND) {
         // if we don't have a path and we're doing cID, then this automatically fires a 404.
         if (!$request->getPath() && $request->get('cID')) {
             return $this->sendPageNotFound($request);
         }
         // let's test to see if this is, in fact, the home page,
         // and we're routing arguments onto it (which is screwing up the path.)
         $home = Page::getByID(HOME_CID);
         $request->setCurrentPage($home);
         $homeController = $home->getPageController();
         $homeController->setupRequestActionAndParameters($request);
         if (!$homeController->validateRequest()) {
             return $this->sendPageNotFound($request);
         } else {
             $c = $home;
             $c->cPathFetchIsCanonical = true;
         }
     }
     if (!$c->cPathFetchIsCanonical) {
         // Handle redirect URL (additional page paths)
         /** @var Url $url */
         $url = \Core::make('url/manager')->resolve(array($c));
         $query = $url->getQuery();
         $query->modify($request->getQueryString());
         $url = $url->setQuery($query);
         $response = Redirect::to($url);
         $response->setStatusCode(301);
         return $response;
     }
     // maintenance mode
     if ($c->getCollectionPath() != '/login') {
         $smm = Config::get('concrete.maintenance_mode');
         if ($smm == 1 && !PermissionKey::getByHandle('view_in_maintenance_mode')->validate() && ($_SERVER['REQUEST_METHOD'] != 'POST' || Loader::helper('validation/token')->validate() == false)) {
             $v = new View('/frontend/maintenance_mode');
             $v->setViewTheme(VIEW_CORE_THEME);
             return $this->sendResponse($v);
         }
     }
     if ($c->getCollectionPointerExternalLink() != '') {
         return Redirect::url($c->getCollectionPointerExternalLink(), 301);
     }
     $cp = new Permissions($c);
     if ($cp->isError() && $cp->getError() == COLLECTION_FORBIDDEN) {
         return $this->sendPageForbidden($request, $c);
     }
     if (!$c->isActive() && !$cp->canViewPageVersions()) {
         return $this->sendPageNotFound($request);
     }
     if ($cp->canEditPageContents() || $cp->canEditPageProperties() || $cp->canViewPageVersions()) {
         $c->loadVersionObject('RECENT');
     }
     $vp = new Permissions($c->getVersionObject());
     // returns the $vp object, which we then check
     if (is_object($vp) && $vp->isError()) {
         switch ($vp->getError()) {
             case COLLECTION_NOT_FOUND:
                 return $this->sendPageNotFound($request);
                 break;
             case COLLECTION_FORBIDDEN:
                 return $this->sendPageForbidden($request, $c);
                 break;
         }
     }
     // Now that we've passed all permissions checks, and we have a page, we check to see if we
     // ought to redirect based on base url or trailing slash settings
     $cms = \Core::make("app");
     $response = $cms->handleCanonicalURLRedirection($request);
     if (!$response) {
         $response = $cms->handleURLSlashes($request);
     }
     if (isset($response)) {
         $response->send();
         exit;
     }
     // Now we check to see if we're on the home page, and if it multilingual is enabled,
     // and if so, whether we should redirect to the default language page.
     if (\Core::make('multilingual/detector')->isEnabled()) {
         $dl = Core::make('multilingual/detector');
         if ($c->getCollectionID() == HOME_CID && Config::get('concrete.multilingual.redirect_home_to_default_locale')) {
             // Let's retrieve the default language
             $ms = $dl->getPreferredSection();
             if (is_object($ms) && $ms->getCollectionID() != HOME_CID) {
                 Redirect::page($ms)->send();
                 exit;
             }
         }
         $dl->setupSiteInterfaceLocalization($c);
     }
     $request->setCurrentPage($c);
     require DIR_BASE_CORE . '/bootstrap/process.php';
     $u = new User();
     // On page view event.
     $pe = new PageEvent($c);
     $pe->setUser($u);
     $pe->setRequest($request);
     Events::dispatch('on_page_view', $pe);
     $controller = $c->getPageController();
     $controller->on_start();
     $controller->setupRequestActionAndParameters($request);
     $response = $controller->validateRequest();
     if ($response instanceof \Symfony\Component\HttpFoundation\Response) {
         return $response;
     } else {
         if ($response == false) {
             return $this->sendPageNotFound($request);
         }
     }
     $requestTask = $controller->getRequestAction();
     $requestParameters = $controller->getRequestActionParameters();
     $response = $controller->runAction($requestTask, $requestParameters);
     if ($response instanceof \Symfony\Component\HttpFoundation\Response) {
         return $response;
     }
     $c->setController($controller);
     $view = $controller->getViewObject();
     // Mobile theme
     if (Config::get('concrete.misc.mobile_theme_id') > 0) {
         $md = new \Mobile_Detect();
         if ($md->isMobile()) {
             $mobileTheme = Theme::getByID(Config::get('concrete.misc.mobile_theme_id'));
             if ($mobileTheme instanceof Theme) {
                 $view->setViewTheme($mobileTheme);
                 $controller->setTheme($mobileTheme);
             }
         }
     }
     // we update the current page with the one bound to this controller.
     $request->setCurrentPage($c);
     return $this->sendResponse($view);
 }
 public function skipItem()
 {
     $theme = Theme::getByHandle($this->object->getHandle());
     return is_object($theme);
 }