/** * Get the current URL and feed the URL infos * */ public static function get_url_infos() { self::$ci =& get_instance(); $uri = preg_replace("|/*(.+?)/*\$|", "\\1", self::$ci->uri->uri_string); self::$uri_segments = explode('/', $uri); // Returned data $infos = array('type' => 'page', 'page' => self::$uri_segments[0], 'article' => ''); // Get the special URI config array (see /config/ionize.php) $uri_config = self::$ci->config->item('special_uri'); // Get the potential special URI $special_uri = isset(self::$uri_segments[1]) && array_key_exists(self::$uri_segments[1], $uri_config) ? self::$uri_segments[1] : FALSE; // If a special URI exists, get the articles from it. if ($special_uri !== FALSE) { $infos['type'] = 'special'; $infos['page'] = self::$uri_segments[0]; } else { if (isset(self::$uri_segments[1])) { $infos['type'] = 'article'; $infos['page'] = $uri_segments[0]; $infos['article'] = self::$uri_segments[1]; } } return $infos; }