PHP 클래스 PMA\libraries\Message

simple usage examples: display simple error message 'Error' Message::error()->display(); get simple success message 'Success' $message = Message::success(); get special notice $message = Message::notice(__('This is a localized notice')); more advanced usage example: create another message, a hint, with a localized string which expects $hint = Message::notice('Read the %smanual%s'); replace placeholders with the following params $hint->addParam('[doc@cfg_Example]'); $hint->addParam('[/doc]'); add this hint as a tooltip $hint = showHint($hint); add the retrieved tooltip reference to the original message $message->addMessage($hint);
파일 보기 프로젝트 열기: phpmyadmin/phpmyadmin 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$level array message levels

보호된 프로퍼티들

프로퍼티 타입 설명
$addedMessages array holds additional messages
$hash string Unique id
$isDisplayed boolean Whether the message was already displayed
$message string The formatted message
$number integer The message number
$params array holds parameters
$string string The locale string identifier
$useBBCode boolean Whether to use BB code when displaying.

공개 메소드들

메소드 설명
__construct ( string $string = '', integer $number = Message::NOTICE, array $params = [], integer $sanitize = Message::SANITIZE_NONE ) Constructor
__toString ( ) : string magic method: return string representation for this object
addHtml ( string $message, string $separator = ' ' ) : void add another html message to be concatenated on displaying
addMessage ( Message $message, string $separator = ' ' ) : void add another raw message to be concatenated on displaying
addMessages ( Message[] $messages, string $separator = ' ' ) : void add a bunch of messages at once
addMessagesString ( string[] $messages, string $separator = ' ' ) : void add a bunch of messages at once
addParam ( mixed $param ) : void add string or Message parameter
addParamHtml ( string $param ) : void add parameter as raw HTML, usually in conjunction with strings
addText ( string $message, string $separator = ' ' ) : void add another raw message to be concatenated on displaying
decodeBB ( string $message ) : string decode $message, taking into account our special codes for formatting
display ( ) : void Displays the message in HTML
error ( string $string = '' ) : Message get Message of type error
format ( ) : string wrapper for sprintf()
getAddedMessages ( ) : array return all added messages
getDisplay ( ) : string returns HTML code for displaying this message
getHash ( ) : string returns unique Message::$hash, if not exists it will be created
getLevel ( ) : string returns level of message
getMessage ( ) : string returns compiled message
getMessageForAffectedRows ( integer $rows ) : Message get Message for number of affected rows
getMessageForDeletedRows ( integer $rows ) : Message get Message for number of deleted rows
getMessageForInsertedRows ( integer $rows ) : Message get Message for number of inserted rows
getMessageWithIcon ( string $message ) : string Returns the message with corresponding image icon
getNumber ( ) : integer returns Message::$number
getOnlyMessage ( ) : string Returns only message string without image & other HTML.
getParams ( ) : array return all parameters
getString ( ) : string returns Message::$string
isDisplayed ( boolean $isDisplayed = false ) : boolean sets and returns whether the message was displayed or not
isError ( boolean $set = false ) : boolean returns whether this message is an error message or not and optionally makes this message an error message
isNotice ( boolean $set = false ) : boolean returns whether this message is a notice message or not and optionally makes this message a notice message
isSuccess ( boolean $set = false ) : boolean returns whether this message is a success message or not and optionally makes this message a success message
notice ( string $string ) : Message get Message of type notice
raw ( string $message, integer $type = Message::NOTICE ) : Message get Message with customized content
rawError ( string $message ) : Message get Message of type error with custom content
rawNotice ( string $message ) : Message get Message of type notice with custom content
rawSuccess ( string $message ) : Message get Message of type success with custom content
sanitize ( mixed $message ) : mixed Sanitizes $message
setBBCode ( boolean $useBBCode ) : void Set whether we should use BB Code when rendering.
setMessage ( string $message, boolean $sanitize = false ) : void set raw message (overrides string)
setNumber ( integer $number ) : void set message type number
setParams ( array | string $params, boolean $sanitize = false ) : void set all params at once, usually used in conjunction with string
setString ( string $string, boolean $sanitize = true ) : void set string (does not take effect if raw message is set)
success ( string $string = '' ) : Message get Message of type success

비공개 메소드들

메소드 설명
_addMessage ( mixed $message, string $separator ) : void Real implementation of adding message

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( string $string = '', integer $number = Message::NOTICE, array $params = [], integer $sanitize = Message::SANITIZE_NONE )
$string string The message to be displayed
$number integer A numeric representation of the type of message
$params array An array of parameters to use in the message
$sanitize integer A flag to indicate what to sanitize, see constant definitions above

__toString() 공개 메소드

magic method: return string representation for this object
public __toString ( ) : string
리턴 string

addHtml() 공개 메소드

add another html message to be concatenated on displaying
public addHtml ( string $message, string $separator = ' ' ) : void
$message string to be added
$separator string to use between this and previous string/message
리턴 void

addMessage() 공개 메소드

add another raw message to be concatenated on displaying
public addMessage ( Message $message, string $separator = ' ' ) : void
$message Message to be added
$separator string to use between this and previous string/message
리턴 void

addMessages() 공개 메소드

add a bunch of messages at once
public addMessages ( Message[] $messages, string $separator = ' ' ) : void
$messages Message[] to be added
$separator string to use between this and previous string/message
리턴 void

addMessagesString() 공개 메소드

add a bunch of messages at once
public addMessagesString ( string[] $messages, string $separator = ' ' ) : void
$messages string[] to be added
$separator string to use between this and previous string/message
리턴 void

addParam() 공개 메소드

usage $message->addParam('[em]some string[/em]');
public addParam ( mixed $param ) : void
$param mixed parameter to add
리턴 void

addParamHtml() 공개 메소드

usage $message->addParamHtml('');
public addParamHtml ( string $param ) : void
$param string parameter to add
리턴 void

addText() 공개 메소드

add another raw message to be concatenated on displaying
public addText ( string $message, string $separator = ' ' ) : void
$message string to be added
$separator string to use between this and previous string/message
리턴 void

decodeBB() 공개 정적인 메소드

decode $message, taking into account our special codes for formatting
public static decodeBB ( string $message ) : string
$message string the message
리턴 string the decoded message

display() 공개 메소드

Displays the message in HTML
public display ( ) : void
리턴 void

error() 공개 정적인 메소드

shorthand for getting a simple error message
public static error ( string $string = '' ) : Message
$string string A localized string e.g. __('Error')
리턴 Message

format() 공개 정적인 메소드

wrapper for sprintf()
public static format ( ) : string
리턴 string formatted

getAddedMessages() 공개 메소드

return all added messages
public getAddedMessages ( ) : array
리턴 array

getDisplay() 공개 메소드

returns HTML code for displaying this message
public getDisplay ( ) : string
리턴 string whole message box

getHash() 공개 메소드

returns unique Message::$hash, if not exists it will be created
public getHash ( ) : string
리턴 string Message::$hash

getLevel() 공개 메소드

returns level of message
public getLevel ( ) : string
리턴 string level of message

getMessage() 공개 메소드

returns compiled message
public getMessage ( ) : string
리턴 string complete message

getMessageForAffectedRows() 공개 정적인 메소드

shorthand for getting a customized message
public static getMessageForAffectedRows ( integer $rows ) : Message
$rows integer Number of rows
리턴 Message

getMessageForDeletedRows() 공개 정적인 메소드

shorthand for getting a customized message
public static getMessageForDeletedRows ( integer $rows ) : Message
$rows integer Number of rows
리턴 Message

getMessageForInsertedRows() 공개 정적인 메소드

shorthand for getting a customized message
public static getMessageForInsertedRows ( integer $rows ) : Message
$rows integer Number of rows
리턴 Message

getMessageWithIcon() 공개 메소드

Returns the message with corresponding image icon
public getMessageWithIcon ( string $message ) : string
$message string the message(s)
리턴 string message with icon

getNumber() 공개 메소드

returns Message::$number
public getNumber ( ) : integer
리턴 integer Message::$number

getOnlyMessage() 공개 메소드

Returns only message string without image & other HTML.
public getOnlyMessage ( ) : string
리턴 string

getParams() 공개 메소드

return all parameters
public getParams ( ) : array
리턴 array

getString() 공개 메소드

returns Message::$string
public getString ( ) : string
리턴 string Message::$string

isDisplayed() 공개 메소드

sets and returns whether the message was displayed or not
public isDisplayed ( boolean $isDisplayed = false ) : boolean
$isDisplayed boolean whether to set displayed flag
리턴 boolean Message::$isDisplayed

isError() 공개 메소드

returns whether this message is an error message or not and optionally makes this message an error message
public isError ( boolean $set = false ) : boolean
$set boolean Whether to make this message of ERROR type
리턴 boolean Whether this is an error message or not

isNotice() 공개 메소드

returns whether this message is a notice message or not and optionally makes this message a notice message
public isNotice ( boolean $set = false ) : boolean
$set boolean Whether to make this message of NOTICE type
리턴 boolean whether this is a notice message or not

isSuccess() 공개 메소드

returns whether this message is a success message or not and optionally makes this message a success message
public isSuccess ( boolean $set = false ) : boolean
$set boolean Whether to make this message of SUCCESS type
리턴 boolean whether this is a success message or not

notice() 공개 정적인 메소드

shorthand for getting a simple notice message
public static notice ( string $string ) : Message
$string string A localized string e.g. __('The additional features for working with linked tables have been deactivated. To find out why click %shere%s.')
리턴 Message

raw() 공개 정적인 메소드

shorthand for getting a customized message
public static raw ( string $message, integer $type = Message::NOTICE ) : Message
$message string A localized string
$type integer A numeric representation of the type of message
리턴 Message

rawError() 공개 정적인 메소드

shorthand for getting a customized error message
public static rawError ( string $message ) : Message
$message string A localized string
리턴 Message

rawNotice() 공개 정적인 메소드

shorthand for getting a customized notice message
public static rawNotice ( string $message ) : Message
$message string A localized string
리턴 Message

rawSuccess() 공개 정적인 메소드

shorthand for getting a customized success message
public static rawSuccess ( string $message ) : Message
$message string A localized string
리턴 Message

sanitize() 공개 정적인 메소드

Sanitizes $message
public static sanitize ( mixed $message ) : mixed
$message mixed the message(s)
리턴 mixed the sanitized message(s)

setBBCode() 공개 메소드

Set whether we should use BB Code when rendering.
public setBBCode ( boolean $useBBCode ) : void
$useBBCode boolean Use BB Code?
리턴 void

setMessage() 공개 메소드

set raw message (overrides string)
public setMessage ( string $message, boolean $sanitize = false ) : void
$message string A localized string
$sanitize boolean Whether to sanitize $message or not
리턴 void

setNumber() 공개 메소드

set message type number
public setNumber ( integer $number ) : void
$number integer message type number to set
리턴 void

setParams() 공개 메소드

set all params at once, usually used in conjunction with string
public setParams ( array | string $params, boolean $sanitize = false ) : void
$params array | string parameters to set
$sanitize boolean whether to sanitize params
리턴 void

setString() 공개 메소드

set string (does not take effect if raw message is set)
public setString ( string $string, boolean $sanitize = true ) : void
$string string string to set
$sanitize boolean whether to sanitize $string or not
리턴 void

success() 공개 정적인 메소드

shorthand for getting a simple success message
public static success ( string $string = '' ) : Message
$string string A localized string e.g. __('Your SQL query has been executed successfully')
리턴 Message

프로퍼티 상세

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

holds additional messages
protected array $addedMessages
리턴 array

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

Unique id
protected string $hash
리턴 string

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

Whether the message was already displayed
protected bool $isDisplayed
리턴 boolean

$level 공개적으로 정적으로 프로퍼티

message levels
public static array $level
리턴 array

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

The formatted message
protected string $message
리턴 string

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

The message number
protected int $number
리턴 integer

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

holds parameters
protected array $params
리턴 array

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

The locale string identifier
protected string $string
리턴 string

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

Whether to use BB code when displaying.
protected bool $useBBCode
리턴 boolean