diff --git a/core/control/ContentController.php b/core/control/ContentController.php index 69c046871..f2757c396 100644 --- a/core/control/ContentController.php +++ b/core/control/ContentController.php @@ -98,8 +98,6 @@ class ContentController extends Controller { else singleton('SiteTree')->extend('contentcontrollerInit', $this); if(Director::redirected_to()) return; - - Director::set_site_mode('site'); // Check page permissions if($this->dataRecord && $this->URLSegment != 'Security' && !$this->dataRecord->can('View')) { diff --git a/core/control/Director.php b/core/control/Director.php index 14563ccfd..99a48f990 100644 --- a/core/control/Director.php +++ b/core/control/Director.php @@ -19,6 +19,9 @@ class Director { static private $rules = array(); + /** + * @deprecated 2.4 + */ static $siteMode; static $alternateBaseFolder; @@ -35,8 +38,7 @@ class Director { static protected $environment_type; /** - * Sets the site mode (if it is the public site or the cms), - * and runs registered modules. + * @deprecated 2.4 */ static protected $callbacks; @@ -638,11 +640,13 @@ class Director { //////////////////////////////////////////////////////////////////////////////////////////// /** - * Sets the site mode (if it is the public site or the cms), and runs registered modules. - * - * @param string $mode 'site' or 'cms' + * @deprecated 2.4 */ static function set_site_mode($mode) { + user_error ( + 'Director::set_site_mode() is deprecated as the functionality is no longer neccesary.', E_USER_NOTICE + ); + Director::$siteMode = $mode; if(isset(self::$callbacks[$mode])) { @@ -653,23 +657,24 @@ class Director { } /** - * @return string 'site' or 'cms' + * @deprecated 2.4 */ static function get_site_mode() { + user_error ( + 'Director::set_site_mode() is deprecated as the functionality is no longer neccesary.', E_USER_NOTICE + ); + return Director::$siteMode; } /** - * Allows a module to register with the director to be run once - * the controller is instantiated. The optional 'mode' parameter - * can be either 'site' or 'cms', as those are the two values currently - * set by controllers. The callback function will be run at the - * initialization of the relevant controller. - * - * @param $function string PHP-function array based on http://php.net/call_user_func - * @param $mode string + * @deprecated 2.4 Use a custom extension on your controller. */ static function add_callback($function, $mode = 'site') { + user_error ( + 'Director::add_callback() is deprecated, please use a custom extension on your controller', E_USER_NOTICE + ); + self::$callbacks[$mode][] = $function; } diff --git a/core/control/ModelAsController.php b/core/control/ModelAsController.php index 8eec8b152..919a07efb 100644 --- a/core/control/ModelAsController.php +++ b/core/control/ModelAsController.php @@ -35,8 +35,6 @@ class ModelAsController extends Controller implements NestedController { public function init() { singleton('SiteTree')->extend('modelascontrollerInit', $this); - - Director::set_site_mode('site'); } public function getNestedController() { diff --git a/core/control/RootURLController.php b/core/control/RootURLController.php index 640d85e69..3f3a6271e 100755 --- a/core/control/RootURLController.php +++ b/core/control/RootURLController.php @@ -19,11 +19,6 @@ class RootURLController extends Controller { */ protected static $default_homepage_urlsegment = 'home'; - public function init() { - Director::set_site_mode('site'); - parent::init(); - } - public function handleRequest($request) { self::$is_at_root = true; $this->pushCurrent(); @@ -116,4 +111,4 @@ class RootURLController extends Controller { } } -?> \ No newline at end of file +?> diff --git a/core/model/Translatable.php b/core/model/Translatable.php index 5614ecc71..4b22ac5c1 100755 --- a/core/model/Translatable.php +++ b/core/model/Translatable.php @@ -154,9 +154,7 @@ class Translatable extends DataObjectDecorator { /** * The language in which we are reading dataobjects. - * Usually stored in session, specific to the "site mode": - * either 'site' or 'cms'. - * @see Director::get_site_mode() + * * @var string */ protected static $current_locale = null; @@ -198,19 +196,16 @@ class Translatable extends DataObjectDecorator { /** * Choose the language the site is currently on. - * If $_GET['locale'] is set, then it will use that language, and store it in the session. - * Otherwise it checks the session for a possible stored language, either from namespace to the site_mode - * ('site' or 'cms'), or for a 'global' language setting. - * The final option is the member preference. + * + * If $_GET['locale'] is currently set, then that locale will be used. Otherwise the member preference (if logged + * in) or default locale will be used. * * @todo Re-implement cookie and member option * - * @uses Director::get_site_mode() * @param $langsAvailable array A numerical array of languages which are valid choices (optional) * @return string Selected language (also saved in $current_locale). */ static function choose_site_locale($langsAvailable = array()) { - $siteMode = Director::get_site_mode(); // either 'cms' or 'site' if(self::$current_locale) { return self::$current_locale; }