From a5467e842316daf6a8a4345740f05a9731167ce1 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 23 Sep 2006 01:51:57 +0000 Subject: merge from 3.0 branch till 1435. --- .../PhpShell/PHP/Shell/Extensions/LoadScript.php | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 framework/3rdParty/PhpShell/PHP/Shell/Extensions/LoadScript.php (limited to 'framework/3rdParty/PhpShell/PHP/Shell/Extensions/LoadScript.php') diff --git a/framework/3rdParty/PhpShell/PHP/Shell/Extensions/LoadScript.php b/framework/3rdParty/PhpShell/PHP/Shell/Extensions/LoadScript.php new file mode 100644 index 00000000..a8c4697d --- /dev/null +++ b/framework/3rdParty/PhpShell/PHP/Shell/Extensions/LoadScript.php @@ -0,0 +1,32 @@ +registerCommand('#^r #', $this, 'cmdLoadScript', 'r ', + 'load a php-script and execute each line'); + + } + + public function cmdLoadScript($l) { + $l = substr($l, 2); + + if (file_exists($l)) { + $content = file($l); + + $source = array(); + + foreach ($content as $line) { + $line = chop($line); + + if (preg_match('#^<\?php#', $line)) continue; + + $source[] = $line; + } + + return $source; + } + return ""; + } +} -- cgit v1.2.3