The Core is the console object that controls input from the user and prints output back to the screen. Core methods and attributes starting with an underscore are private and should not be called from outside the TinyShell object itself. All methods described on this page are members of the TinyShell.shell class object, and should be called from the TinyShell instance object.
Shortcuts:
Object: TinyShell
The namespace, everything related to TinyShell is contained in this object.
Properties
- version – (string) Current TinyShell version number.
- plugins – (object) Contains all native TinyShell plugins. See JS Plugin API for more information on how to create plugins.
- shell – (object) The console class object.
Object: TinyShell.shell
The terminal instance that emulates the console by handling events, input and output. This is a MooTools Class instance, and is initiated from an inline script in the body HTML. It requires the div elements #terminal-cl, #terminal-input, #terminal-protocol, #terminal-history and #terminal-window, to function correctly and interact with the user. The object constructor function takes no arguments.
Properties
- home – (string) Path to default server side directory.
- dir – (string) Current server side working directory.
- user – (string) Current username.
- server – (string) Server name.
- proc – (object) Reference to current process, if a native plugin is running, otherwise null.
- onkeypress – (array) Array of keypress events. An event is called with only the corresponding native MooTools Event object as argument. If a function returns false, the default event is prevented.
- onkeydown – (array) Similar to onkypress, but handles onkeydown events the same way. Notice that some keys can only be detected by a keydown event, while others can only be detected by a keypress event, therefore both events are important to interact with the keyboard correctly.
Example
- var myShell = new TinyShell.shell();
Method: TinyShell.shell.run
Acts like a constructor, since this call initiates the shell. Thus the TinyShell is instance is not ready before this method has been executed on the object.
Syntax
- myShell.run(home, server, login)
Arguments
- home – (string) Home directory on server.
- server – (string) Server name.
- login – (string) Username of current user if a session is already open. If empty string, the login plugin will be automatically executed in order to let the user authorize a new session.
Example
Notice that all arguments are automatically retrieved from the server by PHP.
- myShell.run("/var/www/", "5p.dk", false)
Method: TinyShell.shell.ticket_hash
Hashes a message with a given salt using SHA1 (160-bit digest).
Syntax
- myShell.ticket_hash(ticket, message)
Arguments
- ticket – (string) Any string used to salt a hashed message.
- message – (string) A message to hash.
Returns
- (string) Lowercase hexadecimal hash value.
Method: TinyShell.shell.get_process_name
Returns the name of the current process running
Syntax
- myShell.get_process_name()
Returns
- (string) Current process name, or empty string if no process is running.
Method:
Syntax
Arguments
- home – (string)
Returns
- (void) Return value is not expected.