function init() { parent::init(); $bt = defined('DB::USE_ANSI_SQL') ? "\"" : "`"; $page = null; //NOTE: this function (Director::urlParam) is depreciated, but should actuall be kept $URLSegment = Director::urlParam("URLSegment"); $Action = Director::urlParam("Action"); foreach (self::$old_to_new_array as $oldURL => $newURL) { if ($URLSegment == $oldURL) { $page = DataObject::get_one("SiteTree", "URLSegment = '{$newURL}'"); Director::redirect($page->Link(), 301); } elseif ($URLSegment . "/" . $Action == $oldURL) { $page = DataObject::get_one("SiteTree", "URLSegment = '{$newURL}'"); Director::redirect($page->Link(), 301); } } }
public function init() { parent::init(); }