public static function init() { /** * If initialized, return initialized value without reprocessing. */ if (self::$_init !== null) { return self::$_init; } /** * Define name of the cookie set by asets/js/core/server.js. */ self::$_name = 'screen'; /** * Contents of cookie set by asets/js/core/server.js. */ self::$_cookie = Cookie::get(self::$_name); /** * If cookie is set, extract contents and parse the JSON into a PHP * object, then setting initialized value to true. Otherwise, set it * false, as initialization has failed since no cookie is defined. */ if (isset(self::$_cookie)) { self::$_screen = self::parse(self::$_cookie); self::$_init = true; } else { self::$_init = false; } /** * Return whether initialization succeeded or failed. */ return self::$_init; }