public static function run() { if (!static::$route_found) { $sammy = Sammy::instance(); Map::pre_dispatch($sammy->get_uri(false)); } ob_end_flush(); }
$uri = substr($uri, 2); } $parts = preg_split('#\\?#i', $uri, 2); $uri = $parts[0]; if (isset($parts[1])) { $_SERVER['QUERY_STRING'] = $parts[1]; parse_str($_SERVER['QUERY_STRING'], $_GET); } else { $_SERVER['QUERY_STRING'] = ''; $_GET = array(); } $uri = parse_url($uri, PHP_URL_PATH); } else { // Couldn't determine the URI, so just return false return false; } // Do some final cleaning of the URI and return it return ($prefix_slash ? '/' : '') . str_replace(array('//', '../'), '/', trim($uri, '/')); } public function format($name, $callback) { $sammy = static::instance(); if (!empty($sammy->format) && $name == $sammy->format) { echo $callback($sammy); } else { return false; } } } $sammy = Sammy::instance();
function ajax($route, $callback) { Sammy::process($route, $callback, 'XMLHttpRequest'); }
public static function ajax($route, $path) { self::$path = $path; Sammy::process($route, 'XMLHttpRequest'); }