public function routing() { /* * You can echo HTML and other information directly from models or controllers * however it is usually better to create views for displaying model data. */ // Session tracking io::library('session'); // HTML Header echo '<h2>Routing Information</h2>'; // Explain a little bit echo '<p>This method may be useful during development or even within your application. It provides easy access to important information related to routing, like which controller and action were routed. It also conveniently provides access to $_GET, $_POST, $_SESSION, $_COOKIE and parameters passed to Ornithopter during normal routing... </p>'; echo '<blockquote>Accessible by calling <strong class="io">io::route()</strong> within Ornithopter.io</blockquote>'; // Access the internals of Ornithopter.io easily var_dump(io::route()); }
/** * Returns a string if controller / action is matched. * * @return mixed */ public static function nav($path, $str) { // Check if the path is an alternative route if (\io::route()['controller'] == $path) { // Return the provided string return $str; } // Check if the path equals the controller action if ($path == \io::route()['controller'] . '/' . \io::route()['action']) { // Return the provided string return $str; } // Check if the path is equal to the REQUEST_URI if ($_SERVER['REQUEST_URI'] == $path) { // Return the provided string return $str; } // Does not match return false; }
/** * Checks if a $_GET variable exists. * * @param string * * @return bool */ public static function has($var) { // Return $var existance as boolean return isset(io::route()['get'][$var]); }
/** * Get the query string. * * @return string */ public static function querystring() { // Return the Query String return \io::route()['query']; }