Functions

Put something non-Commandr in a standard box so it looks OK.

commandr_make_normal_html_visible(mixed $html) : \Tempcode
package commandr

Parameters

$html

mixed

HTML (string or Tempcode)

Returns

\TempcodeBoxed HTML

Commandr entry script.

commandr_script() 
package commandr

Template for a command's help.

do_command_help(string $command, array $options, array $parameters) : \Tempcode
package commandr

Parameters

$command

string

Command name

$options

array

Options

$parameters

array

Parameters (keys are the parameters, values are always set to true, i.e. it is an array of as many trues as there are parameters)

Returns

\TempcodeHelp template

Generate, and save, a resource-fs moniker.

expunge_resourcefs_moniker(\ID_TEXT $resource_type, \ID_TEXT $resource_id) 
package commandr

Parameters

$resource_type

\ID_TEXT

The resource type

$resource_id

\ID_TEXT

The resource ID

Find the Commandr-fs (repository) filename from the resource ID.

find_commandrfs_filename_via_id(\ID_TEXT $resource_type, \ID_TEXT $resource_id, boolean $include_subpath = false) : \?ID_TEXT
package commandr

Parameters

$resource_type

\ID_TEXT

The resource type

$resource_id

\ID_TEXT

The resource ID

$include_subpath

boolean

Whether to include the subpath

Returns

\?ID_TEXTThe filename (null: no match)

Find the resource GUID from the resource ID.

find_guid_via_id(\ID_TEXT $resource_type, \ID_TEXT $resource_id) : \?ID_TEXT
package commandr

Parameters

$resource_type

\ID_TEXT

The resource type

$resource_id

\ID_TEXT

The resource ID

Returns

\?ID_TEXTThe GUID (null: no match)

Find the resource ID from the Commandr-fs (repository) filename.

find_id_via_commandrfs_filename(\ID_TEXT $resource_type, \ID_TEXT $filename) : \?ID_TEXT
package commandr

Parameters

$resource_type

\ID_TEXT

The resource type

$filename

\ID_TEXT

The filename

Returns

\?ID_TEXTThe ID (null: no match)

Find the resource ID from the resource GUID. It is assumed you as the programmer already know the resource-type.

find_id_via_guid(\ID_TEXT $resource_guid) : \?ID_TEXT
package commandr

Parameters

$resource_guid

\ID_TEXT

The GUID

Returns

\?ID_TEXTThe ID (null: no match)

Find the resource ID from the resource label.

find_id_via_label(\ID_TEXT $resource_type, \LONG_TEXT $_resource_label, \?string $subpath = null) : \?ID_TEXT
package commandr

Parameters

$resource_type

\ID_TEXT

The resource type

$_resource_label

\LONG_TEXT

The label

$subpath

\?string

The subpath (null: don't care). It may end in "/*" if you want to look for a match under a certain directory

Returns

\?ID_TEXTThe ID (null: no match)

Find the resource ID from the resource moniker.

find_id_via_moniker(\ID_TEXT $resource_type, \ID_TEXT $resource_moniker) : \?ID_TEXT
package commandr

Parameters

$resource_type

\ID_TEXT

The resource type

$resource_moniker

\ID_TEXT

The moniker

Returns

\?ID_TEXTThe ID (null: no match)

Find the resource IDs from the resource GUIDs. This is useful if you need to resolve many GUIDs at once during performant-critical code.

find_ids_via_guids(array $guids) : array
package commandr

Parameters

$guids

array

The GUIDs

Returns

arrayMapping between GUIDs and IDs (anything where there's no match will result in no array entry being present for that GUID)

Find the resource label from the resource ID.

find_label_via_id(\ID_TEXT $resource_type, \ID_TEXT $resource_id) : \?SHORT_TEXT
package commandr

Parameters

$resource_type

\ID_TEXT

The resource type

$resource_id

\ID_TEXT

The resource ID

Returns

\?SHORT_TEXTThe label (null: no match)

Find the resource moniker from the resource ID.

find_moniker_via_id(\ID_TEXT $resource_type, \ID_TEXT $resource_id) : \?ID_TEXT
package commandr

Parameters

$resource_type

\ID_TEXT

The resource type

$resource_id

\ID_TEXT

The resource ID

Returns

\?ID_TEXTThe moniker (null: no match)

Generate, and save, a resource-fs moniker.

generate_resourcefs_moniker(\ID_TEXT $resource_type, \ID_TEXT $resource_id, \?LONG_TEXT $label = null, \?ID_TEXT $new_guid = null, boolean $definitely_new = false) : array
package commandr

Parameters

$resource_type

\ID_TEXT

The resource type

$resource_id

\ID_TEXT

The resource ID

$label

\?LONG_TEXT

The (new) label (null: lookup for specified resource)

$new_guid

\?ID_TEXT

GUID to forcibly assign (null: don't force)

$definitely_new

boolean

If we know this is new, i.e. has no existing moniker

Returns

arrayA triple: The moniker (may be new, or the prior one if the moniker did not need to change), the GUID, the label

Returns a string containing the XML for any messages queued to be sent to the client.

get_queued_messages(boolean $xml = true) : string
package commandr

Parameters

$xml

boolean

Output as XML or Tempcode?

Returns

stringThe queued message XML

Get the Commandr-fs object for a resource type.

get_resource_commandrfs_object(\ID_TEXT $resource_type) : \?object
package commandr

Parameters

$resource_type

\ID_TEXT

The resource type

Returns

\?objectThe object (null: could not get one)

Convert a portable ID to something local.

remap_portable_as_resource_id(\ID_TEXT $resource_type, array $portable) : \ID_TEXT
package commandr

Parameters

$resource_type

\ID_TEXT

The resource type

$portable

array

Portable ID details

Returns

\ID_TEXTThe resource ID

Convert a local ID to something portable.

remap_resource_id_as_portable(\ID_TEXT $resource_type, \ID_TEXT $resource_id) : array
package commandr

Parameters

$resource_type

\ID_TEXT

The resource type

$resource_id

\ID_TEXT

The resource ID

Returns

arrayPortable ID details

Log a message.

resourcefs_logging(string $message, \ID_TEXT $type = 'warn'
package commandr
set inform notice warn

Parameters

$message

string

The message

$type

\ID_TEXT

The template to use

Disengage logging.

resourcefs_logging__end() 
package commandr

Disengage logging.

resourcefs_logging__start(string $level = 'notice'
package commandr
set inform notice warn

Parameters

$level

string

The minimum logging level

Classes, interfaces, and traits

Commandr_fs

Virtual filesystems.

« More »

Resource_fs_base

Resource-fs base class.

« More »

Virtual_shell

Commandr.

« More »

Constants

 

ASSIGNMENT

ASSIGNMENT = 1 
package commandr
 

COMMANDRFS_DIR

COMMANDRFS_DIR = 1 
package commandr
 

COMMANDRFS_FILE

COMMANDRFS_FILE = 0 
package commandr
 

COMMAND_LONE

COMMAND_LONE = 1 
package commandr
 

COMMAND_NATIVE

COMMAND_NATIVE = 0 
package commandr
 

COMMAND_PHP

COMMAND_PHP = 3 
package commandr
 

COMMAND_SCRIPT

COMMAND_SCRIPT = 2 
package commandr
 

COMMAND_SQL

COMMAND_SQL = 4 
package commandr
 

IN_EXTRA_SYNTAX_ASSIGNMENT

IN_EXTRA_SYNTAX_ASSIGNMENT = 1 
package commandr
 

IN_EXTRA_SYNTAX_STREAM

IN_EXTRA_SYNTAX_STREAM = 0 
package commandr
 

IN_EXTRA_VALUE

IN_EXTRA_VALUE = 2 
package commandr
 

IN_OPTION

IN_OPTION = 0 
package commandr
 

IN_OPTION_SYNTAX

IN_OPTION_SYNTAX = 1 
package commandr
 

IN_OPTION_VALUE

IN_OPTION_VALUE = 2 
package commandr
 

IN_PARAMETER

IN_PARAMETER = 0 
package commandr
 

MODE_NORMAL

MODE_NORMAL = 0 
package commandr
 

MODE_QUOTES

MODE_QUOTES = 1 
package commandr
 

OUT_EXTRA

OUT_EXTRA = -1 
package commandr
 

OUT_OPTION

OUT_OPTION = -1 
package commandr
 

OUT_PARAMETER

OUT_PARAMETER = -1 
package commandr
 

REDIRECT_APPEND

REDIRECT_APPEND = 1 
package commandr
 

REDIRECT_IDENTIFIER

REDIRECT_IDENTIFIER = 2 
package commandr
 

REDIRECT_INPUT

REDIRECT_INPUT = 2 
package commandr
 

REDIRECT_OVERWRITE

REDIRECT_OVERWRITE = 0 
package commandr
 

REDIRECT_PIPE

REDIRECT_PIPE = 3 
package commandr
 

RESOURCEFS_DEFAULT_EXTENSION

RESOURCEFS_DEFAULT_EXTENSION = 'cms' 
package commandr
 

SECTION_COMMAND

SECTION_COMMAND = 0 
package commandr
 

SECTION_EXTRAS

SECTION_EXTRAS = 3 
package commandr
 

SECTION_OPTIONS

SECTION_OPTIONS = 1 
package commandr
 

SECTION_PARAMETERS

SECTION_PARAMETERS = 2 
package commandr
 

STREAM_IDENTIFIER

STREAM_IDENTIFIER = 0 
package commandr
 

STREAM_STDCOMMAND

STREAM_STDCOMMAND = 0 
package commandr
 

STREAM_STDERR

STREAM_STDERR = 3 
package commandr
 

STREAM_STDHTML

STREAM_STDHTML = 1 
package commandr
 

STREAM_STDOUT

STREAM_STDOUT = 2 
package commandr