PHP 클래스 Horde_Cli, horde

Copyright 2003-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
저자: Chuck Hagenbuch ([email protected])
저자: Jan Schneider ([email protected])
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_blue_end
$_blue_start
$_bold_end string The string to mark the end of bold text.
$_bold_start string The string to mark the beginning of bold text.
$_clearscreen string The string to use for clearing the screen.
$_console boolean Are we running on a console?
$_green_end
$_green_start
$_indent string The indent string to use.
$_newline string The newline string to use.
$_red_end string The strings to mark the end of coloured text.
$_red_start string The strings to mark the beginning of coloured text.
$_terminalBackgrounds array Terminal background color codes. Not used yet.
$_terminalForegrounds array Terminal foreground color codes. Not used yet.
$_yellow_end
$_yellow_start

공개 메소드들

메소드 설명
__construct ( ) Detect the current environment (web server or console) and sets internal values accordingly.
blue ( string $text ) : string Returns a blue version of $text.
bold ( string $text ) : string Returns a bold version of $text.
clearScreen ( ) Clears the entire screen, if possible.
fatal ( mixed $error ) Displays a fatal error message.
green ( string $text ) : string Returns a green version of $text.
indent ( string $text ) : string Returns the indented string.
init ( ) : Horde_Cli CLI scripts shouldn't timeout, so try to set the time limit to none. Also initialize a few variables in $_SERVER that aren't present from the CLI.
message ( $message, string $type = 'cli.message' ) Displays a message.
passwordPrompt ( string $prompt ) : string Interactively prompts for input without echoing to the terminal.
prompt ( string $prompt, array $choices = null, string $default = null ) : mixed Prompts for a user response.
readStdin ( ) : string Reads everything that is sent through standard input and returns it as a single string.
red ( string $text ) : string Returns a red version of $text.
runningFromCLI ( ) : boolean Make sure we're being called from the command line, and not via the web.
shutdown ( ) Destroys any session on script end.
writeln ( string $text = '', boolean $pre = false ) Prints $text on a single line.
yellow ( string $text ) : string Returns a yellow version of $text.

메소드 상세

__construct() 공개 메소드

Use init() if you also want to set environment variables that may be missing in a CLI environment.
public __construct ( )

blue() 공개 메소드

Returns a blue version of $text.
public blue ( string $text ) : string
$text string The text to print in blue.
리턴 string The blue text.

bold() 공개 메소드

Returns a bold version of $text.
public bold ( string $text ) : string
$text string The text to bold.
리턴 string The bolded text.

clearScreen() 공개 메소드

Clears the entire screen, if possible.
public clearScreen ( )

fatal() 공개 메소드

Displays a fatal error message.
public fatal ( mixed $error )
$error mixed The error text to display, an exception or an object with a getMessage() method.

green() 공개 메소드

Returns a green version of $text.
public green ( string $text ) : string
$text string The text to print in green.
리턴 string The green text.

indent() 공개 메소드

Returns the indented string.
public indent ( string $text ) : string
$text string The text to indent.
리턴 string The indented text.

init() 공개 정적인 메소드

CLI scripts shouldn't timeout, so try to set the time limit to none. Also initialize a few variables in $_SERVER that aren't present from the CLI.
public static init ( ) : Horde_Cli
리턴 Horde_Cli A Horde_Cli instance.

message() 공개 메소드

Displays a message.
public message ( $message, string $type = 'cli.message' )
$type string The type of message: 'cli.error', 'cli.warning', 'cli.success', or 'cli.message'.

passwordPrompt() 공개 메소드

Requires a bash shell or Windows and won't work with safe_mode settings (uses shell_exec). From: http://www.sitepoint.com/blogs/2009/05/01/interactive-cli-password-prompt-in-php/
public passwordPrompt ( string $prompt ) : string
$prompt string The message to display when prompting the user.
리턴 string The user's response to the prompt.

prompt() 공개 메소드

Prompts for a user response.
public prompt ( string $prompt, array $choices = null, string $default = null ) : mixed
$prompt string The message to display when prompting the user.
$choices array The choices available to the user or null for a text input.
$default string The default value if no value specified.
리턴 mixed The user's response to the prompt.

readStdin() 공개 메소드

Reads everything that is sent through standard input and returns it as a single string.
public readStdin ( ) : string
리턴 string The contents of the standard input.

red() 공개 메소드

Returns a red version of $text.
public red ( string $text ) : string
$text string The text to print in red.
리턴 string The red text.

runningFromCLI() 공개 정적인 메소드

Make sure we're being called from the command line, and not via the web.
public static runningFromCLI ( ) : boolean
리턴 boolean True if we are, false otherwise.

shutdown() 공개 메소드

Destroys any session on script end.
public shutdown ( )

writeln() 공개 메소드

Prints $text on a single line.
public writeln ( string $text = '', boolean $pre = false )
$text string The text to print.
$pre boolean If true the linebreak is printed before the text instead of after it.

yellow() 공개 메소드

Returns a yellow version of $text.
public yellow ( string $text ) : string
$text string The text to print in yellow.
리턴 string The yellow text.

프로퍼티 상세

$_blue_end 보호되어 있는 프로퍼티

protected $_blue_end

$_blue_start 보호되어 있는 프로퍼티

protected $_blue_start

$_bold_end 보호되어 있는 프로퍼티

The string to mark the end of bold text.
protected string $_bold_end
리턴 string

$_bold_start 보호되어 있는 프로퍼티

The string to mark the beginning of bold text.
protected string $_bold_start
리턴 string

$_clearscreen 보호되어 있는 프로퍼티

The string to use for clearing the screen.
protected string $_clearscreen
리턴 string

$_console 보호되어 있는 프로퍼티

Are we running on a console?
protected bool $_console
리턴 boolean

$_green_end 보호되어 있는 프로퍼티

protected $_green_end

$_green_start 보호되어 있는 프로퍼티

protected $_green_start

$_indent 보호되어 있는 프로퍼티

The indent string to use.
protected string $_indent
리턴 string

$_newline 보호되어 있는 프로퍼티

The newline string to use.
protected string $_newline
리턴 string

$_red_end 보호되어 있는 프로퍼티

The strings to mark the end of coloured text.
protected string $_red_end
리턴 string

$_red_start 보호되어 있는 프로퍼티

The strings to mark the beginning of coloured text.
protected string $_red_start
리턴 string

$_terminalBackgrounds 보호되어 있는 프로퍼티

Terminal background color codes. Not used yet.
protected array $_terminalBackgrounds
리턴 array

$_terminalForegrounds 보호되어 있는 프로퍼티

Terminal foreground color codes. Not used yet.
protected array $_terminalForegrounds
리턴 array

$_yellow_end 보호되어 있는 프로퍼티

protected $_yellow_end

$_yellow_start 보호되어 있는 프로퍼티

protected $_yellow_start