<?php
class Page extends SiteTree {
public static $db = array(
);
public static $has_one = array(
);
public function Link($action = null) {
$URLLocale = Translatable::get_current_locale();
if(preg_match('/(^[a-z]{2})_([A-Z]{2})$/', $URLLocale, $matches)) {
$URLLocale = strtolower($matches[1])."-".strtolower($matches[2]);
}
$URLStage = Versioned::current_stage();
if($URLStage == "Stage") $stage = "/?stage=Stage";
else $stage = "";
if($action == "index") {
$action = "home";
}
if($this->URLSegment == 'home' && !$action) return $URLLocale.$stage;
else return $URLLocale."/".$this->URLSegment."/".$action.$stage;
}
}
class Page_Controller extends ContentController {
public function init() {
parent::init();
Requirements::themedCSS("layout");
Requirements::themedCSS("typography");
Requirements::themedCSS("form");
}
public function setLocale($locale) {
Translatable::set_current_locale($locale);
}
}
?>