public static function current_url() { // rebuild the current url. $config = cmsms()->GetConfig(); $uri_parts = explode('/', $_SERVER['REQUEST_URI']); $uri_parts = cge_array::remove_by_value($uri_parts); $tmp = parse_url($config['root_url']); $root_parts = array(); if (isset($tmp['path'])) { $root_parts = explode('/', $tmp['path']); $root_parts = cge_array::remove_by_value($root_parts); } $newdata = array(); for ($i = 0; $i < max(count($uri_parts), count($root_parts)); $i++) { if ($i < count($uri_parts) && $i < count($root_parts) && $root_parts[$i] == $uri_parts[$i]) { continue; } $newdata[] = $uri_parts[$i]; } $url = $config['root_url'] . '/' . implode('/', $newdata); return $url; }