Download the PHP package rah/rah_terminal without Composer
On this page you can find all versions of the php package rah/rah_terminal. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rah/rah_terminal
More information about rah/rah_terminal
Files in rah/rah_terminal
Package rah_terminal
Short Description Web terminal plugin for Textpattern
License GPL-2.0
Homepage https://github.com/gocom/rah_terminal
Informations about the package rah_terminal
h1. rah_terminal
p. "Twitter":http://twitter.com/gocom | "GitHub":https://github.com/gocom/rah_terminal | "Donate":http://rahforum.biz/donate/rah_terminal
p. Rah_terminal is a plugin for "Textpattern CMS.":http:://textpattern.com It provides a terminal emulator interface for executing external applications, commands and evaluating PHP code, right from Textpattern's admin-panel.
h2. Installing
p. Using "Composer":http://getcomposer.org:
bc. $ composer.phar require rah/rah_terminal
h2. Toolshed notice
p. This is a toolshed project. Experimental and not part of the main supported product line of Rah. Not yet at least. Please use at your own risk.
h2. Requirements
- Textpattern 4.5.0 or newer.
h2. Modules
p. Modules can be used to extend rah_terminal's functionality, adding additional terminal types. Modules are like any other Textpattern plugin, and can be installed the same way. The following modules are available.
- "Markdown":https://github.com/gocom/rah_terminal_markdown
- "Textile":https://github.com/gocom/rah_terminal_textile
- "Texpattern template language":https://github.com/gocom/rah_terminal_txpmarkup
h2. Extending
p. The plugin comes small API which can be used to add additional terminal types to plugin. By default the plugin comes with options PHP, SQL and Shell, but that can be extended to include a Textile Generator among other things. These added terminal types act same as the built in ones do. A callback function is registered, and everything that the callback functions prints or returns to global scope, will be shown to the user. Thrown exceptions and errors are captured too.
h3. API
h4. rah_terminal::get() - Gets an instance of rah_terminal class
bc. object rah_terminal::get();
p. @get()@ is your standard factory method, following a loose singleton pattern. It returns an instance of the rah_terminal class. When creating an object, always use @get()@ instead of creating new instance yourself.
h4. rah_terminal::add_terminal() - Adds a new terminal option
bc. object rah_terminal::add_terminal( string $name, string|null $label, callback $callback );
p. @add_terminal()@ adds and registers a new terminal option. The first parameter @$name@ is a unique name for the terminal option, @$label@ is the label shown to users and @$callback@ is the callback function.
p. When registering new labels, please use prefixes in the @$name@ and the @$callback@ function to avoid conflicts with other codebases, including Textpattern core and rah_terminal itself. For more information about prefixing please see Textpattern's "Plugin Development Guidelines.":http://textpattern.net/wiki/index.php?title=Plugin_Development_Guidelines
p. To use @add_terminal()@ you would first get an instance of rah_terminal using the static method @get()@.
bc. rah_terminal::get() ->add_terminal('abc_example', gTxt('abc_example_label'), 'abc_example_function');
h4. add_privs() - Grants user-groups privileges to a terminal option
bc. mixed add_privs(string $event, string $groups);
p. @add_privs()@ is a standard Textpattern function. In Textpattern it's used to grant permission. Rah_terminal uses it for same thing, to grant users access to terminal options. This is to allow and limit from certain groups access to some terminals, while allowing access to others.
p. @$event@ is the name of the "event" which the access is allowed, and @$groups@ is comma-separated list of user-group numbers. Note that neither allow any whitespace.
p. Rah_terminal's events are prefixed with @rah_terminal.@. And terminal event name would consist of the prefix, followed by the terminal options name, given with the @add_terminal()@ methods first parameter. For terminal option named as @abc_example@, add_privs line would look like following:
bc. add_privs('rah_terminal.abc_example', '1,2,3,4');
h2. Changelog
h3. Version 0.1.1 - 2013/05/07
- Composer package uses "textpattern/installer":https://packagist.org/packages/textpattern/installer and "textpattern/lock":https://packagist.org/packages/textpattern/lock
h3. Version 0.1.0 - 2013/04/24
- Initial release.