mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT: Updated argument handling for sake
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63057 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
f47d5481ee
commit
13d55cdfc4
@ -15,8 +15,29 @@ if(isset($_SERVER['HTTP_HOST'])) {
|
||||
* @subpackage core
|
||||
*/
|
||||
|
||||
/**
|
||||
* Process arguments and load them into the $_GET and $_REQUEST arrays
|
||||
* For example,
|
||||
* sake my/url somearg otherarg key=val --otherkey=val third=val&fourth=val
|
||||
*
|
||||
* Will result int he following get data:
|
||||
* args => array('somearg', 'otherarg'),
|
||||
* key => val
|
||||
* otherkey => val
|
||||
* third => val
|
||||
* fourth => val
|
||||
*/
|
||||
if(isset($_SERVER['argv'][2])) {
|
||||
parse_str($_SERVER['argv'][2], $_GET);
|
||||
$args = array_slice($_SERVER['argv'],2);
|
||||
$_GET = array();
|
||||
foreach($args as $arg) {
|
||||
if(strpos($arg,'=') == false) {
|
||||
$_GET['args'][] = $arg;
|
||||
} else {
|
||||
$newItems = parse_str( (substr($arg,0,2) == '--') ? substr($arg,2) : $arg );
|
||||
$_GET = array_merge($_GET, $newItems);
|
||||
}
|
||||
}
|
||||
$_REQUEST = $_GET;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user