summaryrefslogtreecommitdiff
path: root/framework/3rdParty/PhpShell/PHP/Shell/Extensions/LoadScript.php
diff options
context:
space:
mode:
authorwei <>2006-09-18 22:57:16 +0000
committerwei <>2006-09-18 22:57:16 +0000
commit1e5f13b21b33b0d7ce86fe97ca145a3561433a7a (patch)
tree0d578ace6150cf69478696737cf0e1156a309661 /framework/3rdParty/PhpShell/PHP/Shell/Extensions/LoadScript.php
parent8e3f638109ebdb4bedc3e9ed7360b9d2467bc311 (diff)
Add an interactive php shell that loads Prado classes.
Diffstat (limited to 'framework/3rdParty/PhpShell/PHP/Shell/Extensions/LoadScript.php')
-rw-r--r--framework/3rdParty/PhpShell/PHP/Shell/Extensions/LoadScript.php32
1 files changed, 32 insertions, 0 deletions
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 @@
+<?php
+
+class PHP_Shell_Extensions_LoadScript implements PHP_Shell_Extension {
+ public function register() {
+ $cmd = PHP_Shell_Commands::getInstance();
+
+ $cmd->registerCommand('#^r #', $this, 'cmdLoadScript', 'r <filename>',
+ '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 "";
+ }
+}