', $message);
}
return $message;
}
static public function format()
{
$params = func_get_args();
if (is_array($params[1])) {
array_unshift($params[1], $params[0]);
$params = $params[1];
}
return call_user_func_array('sprintf', $params);
}
/**
* returns unique PMA_Message::$_hash, if not exists it will be created
*
* @uses PMA_Message::$_hash as return value and to set it if required
* @uses PMA_Message::getNumber()
* @uses PMA_Message::$_string
* @uses PMA_Message::$_message
* @uses md5()
* @param string $file
* @return string PMA_Message::$_hash
*/
public function getHash()
{
if (null === $this->_hash) {
$this->_hash = md5(
$this->getNumber() .
$this->_string .
$this->_message
);
}
return $this->_hash;
}
/**
* returns PMA_Message::$_message
*
* @uses PMA_Message::$_message as return value
* @return string PMA_Message::$_message
*/
public function getMessage()
{
$message = $this->_message;
if (0 === strlen($message)) {
$message = $GLOBALS[$this->getString()];
}
if (count($this->getParams()) > 0) {
$message = PMA_Message::format($message, $this->getParams());
}
return PMA_Message::decodeBB($message);
}
/**
* returns PMA_Message::$_string
*
* @uses PMA_Message::$_string as return value
* @return string PMA_Message::$_string
*/
public function getString()
{
return $this->_string;
}
/**
* returns PMA_Message::$_number
*
* @uses PMA_Message::$_number as return value
* @return integer PMA_Message::$_number
*/
public function getNumber()
{
return $this->_number;
}
/**
* returns level of message
*
* @uses PMA_Message::$level
* @uses PMA_Message::getNumber()
* @return string level of message
*/
public function getLevel()
{
return PMA_Message::$level[$this->getNumber()];
}
/**
* Displays the message in HTML
*
* @uses PMA_Message::getLevel()
* @uses PMA_Message::getMessage()
* @uses PMA_Message::isDisplayed()
*/
public function display()
{
echo '';
echo $this->getMessage();
echo '
';
$this->isDisplayed(true);
}
/**
* displays a message
*
* @param string $string
* @param integer $number
* @param boolean $sanitize
* @param scalare $parameter, ...
*/
static function sDisplay()
{
$args = func_get_args();
$defaults = array(
'',
PMA_Message::NOTICE,
true,
);
if (! isset($args[0])) {
trigger_error(__METHOD__ . ' called without arguments.', E_WARNING);
return false;
} else {
foreach ($args as $key => $val) {
$defaults[$key] = $val;
}
}
$message = new PMA_Message();
}
/**
* sets and returns PMA_Message::$_is_displayed
*
* @uses PMA_Message::$_is_displayed
* @param boolean $is_displayed
* @return boolean PMA_Message::$_is_displayed
*/
public function isDisplayed($is_displayed = false)
{
if ($is_displayed){
$this->_is_displayed = $is_displayed;
}
return $this->_is_displayed;
}
}
?>