/** * Purge any link mappings that point back to the same page. * * @parameter <{PAGE_URL}> string * @parameter <{PAGE_ID}> integer */ public function regulateMappings($pageLink, $pageID) { LinkMapping::get()->filter(array('MappedLink' => MisdirectionService::unify_URL(Director::makeRelative($pageLink)), 'RedirectType' => 'Page', 'RedirectPageID' => $pageID))->removeAll(); }
/** * Retrieve the redirection URL for display purposes. * * @return string */ public function getLinkSummary() { return ($link = $this->getLink()) ? MisdirectionService::unify_URL($link) : '-'; }
/** * Unify any URLs that may have been defined. */ public function onBeforeWrite() { parent::onBeforeWrite(); $this->MappedLink = MisdirectionService::unify_URL($this->MappedLink); $this->RedirectLink = trim($this->RedirectLink, ' ?/'); $this->HostnameRestriction = MisdirectionService::unify_URL($this->HostnameRestriction); }