Permalink
Browse files

Added ability to run pages from command line

  • Loading branch information...
AliasIO committed Apr 14, 2013
1 parent 74cabf3 commit 156ea9f7af0abf5d6452609a47dbdcf0654a8378
Showing with 11 additions and 4 deletions.
  1. +1 −1 COPYING
  2. +10 −3 Swiftlet/App.php
View
@@ -1,4 +1,4 @@
Copyright (c) 2009 ElbertF http://swiftlet.org
Copyright (c) 2009 Elbert F http://swiftlet.org
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
View
@@ -24,10 +24,17 @@ public function run()
// Determine the client-side path to root
if ( !empty($_SERVER['REQUEST_URI']) ) {
$this->rootPath = preg_replace('/(index\.php)?(\?.*)?$/', '', $_SERVER['REQUEST_URI']);
}
if ( !empty($_GET['q']) ) {
$this->rootPath = preg_replace('/' . preg_quote(rawurlencode($_GET['q']), '/') . '$/', '', $this->rootPath);
}
// Run from command line, e.g. "php index.php -q index"
$opt = getopt('q:');
if ( isset($opt['q']) ) {
$_GET['q'] = $opt['q'];
}
if ( !empty($_GET['q']) ) {
$this->rootPath = preg_replace('/' . preg_quote(rawurlencode($_GET['q']), '/') . '$/', '', $this->rootPath);
}
// Extract controller name, view name, action name and arguments from URL

0 comments on commit 156ea9f

Please sign in to comment.