Commandr.

package commandr

 Methods

Constructor function. Starts command parsing on the supplied command.

__construct(string $inputted_command, \?array $prior_output = null, \?array $parameters = null

Parameters

$inputted_command

string

The inputted command, unparsed

$prior_output

\?array

An array of prior output to be prepended (null: none)

$parameters

\?array

An array of prior parameters (null: none)

Return the HTML rendering of the parsed command's output.

output_html(boolean $blank_ok = false) : \~Tempcode

Parameters

$blank_ok

boolean

Whether it is okay to have blank output

Returns

\~TempcodeThe HTML (false: error)

Output an XML-RPC packet (hopefully) to the AJAX in the frontend.

output_xml() : boolean

Returns

booleanSuccess?

Parses input setup in constructor, and creates a parse tree.

parse_input() 

Returns the output for the command just parsed.

return_output() : \~array

Returns

\~arrayThe output (false: failure)

Returns the parse tree for the command just parsed.

return_parse_tree() : \~array

Returns

\~arrayThe parse tree (false: failure)

Convert an array to Tempcode for display.

_array_to_html(array $array) : \Tempcode

Parameters

$array

array

Array to display

Returns

\TempcodeTempcode for array

Convert an array to text for display.

_array_to_text(array $array, integer $indentation = 0) : string

Parameters

$array

array

Array to display

$indentation

integer

Global indentation

Returns

stringText representation of array

Is the current block a valid redirection instruction?

_check_is_redirection() : boolean

Returns

booleanRedirection instruction?

Combine two streams regardless of their format.

_combine_streams(array $stream1, array $stream2) : array

Parameters

$stream1

array

Stream 1

$stream2

array

Stream 2

Returns

arrayCombined streams

Return a specified number of tabs.

_do_indentation(integer $indentation) : string

Parameters

$indentation

integer

Number of tabs to return

Returns

stringTabs

Extract the command name from the input.

_extract_command() 

Extract extra tokens from the input.

_extract_extras() 

Extract options (switches) from the input.

_extract_options() 

Extract parameters from the input.

_extract_parameters() 

Find a script file.

_find_script_file(string $script_name, \?string $dir = null) : \~string

Parameters

$script_name

string

Script name

$dir

\?string

Directory (null: Commandr module data dir)

Returns

\~stringPath or failure (false: failure)

Handle a PHP command by executing it, dealing with variables from the class.

_handle_php_command() 

 Properties

 

$current_input

$current_input 

Default

 

$fs

$fs 

Default

 

$input_parameters

$input_parameters 

Default

 

$output

$output 

Default

 

$parse_runtime

$parse_runtime 

Default

 

$parsed_input

$parsed_input 

Default