public function purge(PerchContent_Page $Page) { $Settings = $this->api->get('Settings'); $siteURL = $Settings->get('siteURL')->val(); $url = parse_url($siteURL); if (!isset($url['protocol'])) { $siteURL = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . $_SERVER['HTTP_HOST']; } $siteURL = rtrim($siteURL, '/'); $this->issue_purge_request($siteURL . $Page->pagePath()); $Routes = new PerchPageRoutes(); $routes = $Routes->get_routes_for_page($Page->id()); if (PerchUtil::count($routes)) { $Router = new PerchRouter(); foreach ($routes as $Route) { if (substr($Route->routeRegExp(), 0, 1) != '^') { $this->issue_purge_request($siteURL . '/' . $Route->routePattern()); } else { $posix = $Router->pattern_to_regexp($Route->routePattern(), true); $this->issue_ban_request($siteURL, $posix); } } } }
<?php $Pages = new PerchContent_Pages(); $Regions = new PerchContent_Regions(); $Page = false; $NavGroups = new PerchContent_NavGroups(); $PageTemplates = new PerchContent_PageTemplates(); if (PERCH_RUNWAY) { $PageRoutes = new PerchPageRoutes(); $Collections = new PerchContent_Collections(); } // Find the page if (isset($_GET['id']) && is_numeric($_GET['id'])) { $id = (int) $_GET['id']; $Page = $Pages->find($id); } // Check we have a page if (!$Page || !is_object($Page)) { PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/content/'); } // Check permissions if (!$CurrentUser->has_priv('content.pages.edit')) { PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/content/'); } $ParentPage = $Pages->find($Page->pageParentID()); $Form = new PerchForm('editpage'); $req = array(); $req['pagePath'] = "Required"; $Form->set_required($req); if ($Form->posted() && $Form->validate()) { $postvars = array('pagePath', 'pageSubpagePath', 'pageHidden', 'pageAccessTags', 'pageAttributeTemplate');