/** * initialize the ship */ public function wake() { $uri = \CCServer::server('REQUEST_URI', '/'); // fix doubled slashes $uri_fixed = preg_replace('/(\\/+)/', '/', $uri); // redirect if not match if ($uri != $uri_fixed) { \CCRedirect::to($uri_fixed)->send(true); die; } }
/** * write the log down to disk * * @return void */ public static function write() { if (empty(static::$_data)) { return; } $buffer = date("H:i:s") . " - " . CCServer::method() . ' ' . CCServer::server('REQUEST_URI') . "\n"; $buffer .= implode("\n", static::$_data); CCFile::append(CCStorage::path('logs/' . date('Y-m') . '/' . date('d') . '.log'), $buffer . "\n"); // clear static::clear(); }