diff --git a/libraries/Error.class.php b/libraries/Error.class.php index cd99bb1c71..06498917a3 100644 --- a/libraries/Error.class.php +++ b/libraries/Error.class.php @@ -67,28 +67,28 @@ class PMA_Error extends PMA_Message * * @var string */ - protected $_file = ''; + protected $file = ''; /** * The line in which the error occured * * @var integer */ - protected $_line = 0; + protected $line = 0; /** * Holds the backtrace for this error * * @var array */ - protected $_backtrace = array(); + protected $backtrace = array(); /** * Unique id * * @var string */ - protected $_hash = null; + protected $hash = null; /** * Constructor @@ -122,7 +122,7 @@ class PMA_Error extends PMA_Message */ public function setBacktrace($backtrace) { - $this->_backtrace = $backtrace; + $this->backtrace = $backtrace; } /** @@ -134,7 +134,7 @@ class PMA_Error extends PMA_Message */ public function setLine($line) { - $this->_line = $line; + $this->line = $line; } /** @@ -146,14 +146,14 @@ class PMA_Error extends PMA_Message */ public function setFile($file) { - $this->_file = PMA_Error::relPath($file); + $this->file = PMA_Error::relPath($file); } /** - * returns unique PMA_Error::$_hash, if not exists it will be created + * returns unique PMA_Error::$hash, if not exists it will be created * - * @return string PMA_Error::$_hash + * @return string PMA_Error::$hash */ public function getHash() { @@ -162,8 +162,8 @@ class PMA_Error extends PMA_Message } catch(Exception $e){ $backtrace = ''; } - if ($this->_hash === null) { - $this->_hash = md5( + if ($this->hash === null) { + $this->hash = md5( $this->getNumber() . $this->getMessage() . $this->getFile() . @@ -172,7 +172,7 @@ class PMA_Error extends PMA_Message ); } - return $this->_hash; + return $this->hash; } /** @@ -182,27 +182,27 @@ class PMA_Error extends PMA_Message */ public function getBacktrace() { - return $this->_backtrace; + return $this->backtrace; } /** - * returns PMA_Error::$_file + * returns PMA_Error::$file * - * @return string PMA_Error::$_file + * @return string PMA_Error::$file */ public function getFile() { - return $this->_file; + return $this->file; } /** - * returns PMA_Error::$_line + * returns PMA_Error::$line * - * @return integer PMA_Error::$_line + * @return integer PMA_Error::$line */ public function getLine() { - return $this->_line; + return $this->line; } /** @@ -313,7 +313,7 @@ class PMA_Error extends PMA_Message /** * Gets the error as string of HTML * - * return string + * @return string */ public function getDisplay() { @@ -367,7 +367,10 @@ class PMA_Error extends PMA_Message $path_separator = '/'; } - $Ahere = explode($path_separator, realpath(dirname(__FILE__) . $path_separator . '..')); + $Ahere = explode( + $path_separator, + realpath(dirname(__FILE__) . $path_separator . '..') + ); $Adest = explode($path_separator, $dest); $result = '.'; @@ -381,7 +384,11 @@ class PMA_Error extends PMA_Message } } $path = $result . str_replace(implode($path_separator, $Adest), '', $dest); - return str_replace($path_separator . $path_separator, $path_separator, $path); + return str_replace( + $path_separator . $path_separator, + $path_separator, + $path + ); } } ?> diff --git a/libraries/Message.class.php b/libraries/Message.class.php index a79b794b57..b17ec31b95 100644 --- a/libraries/Message.class.php +++ b/libraries/Message.class.php @@ -54,6 +54,7 @@ * // strSomeLocaleMessage 1 strSomeMoreLocale
* // strSomeEvenMoreLocale - some final words * + * * @package PhpMyAdmin */ class PMA_Message @@ -116,7 +117,7 @@ class PMA_Message * @access protected * @var string */ - protected $_hash = null; + protected $hash = null; /** * holds parameters @@ -137,10 +138,11 @@ class PMA_Message /** * Constructor * - * @param string $string - * @param integer $number - * @param array $params - * @param integer $sanitize + * @param string $string The message to be displayed + * @param integer $number A numeric representation of the type of message + * @param array $params An array of parameters to use in the message + * @param integer $sanitize A flag to indicate what to sanitize, see + * constant definitions above */ public function __construct($string = '', $number = PMA_Message::NOTICE, $params = array(), $sanitize = PMA_Message::SANITIZE_NONE @@ -165,8 +167,9 @@ class PMA_Message * * shorthand for getting a simple success message * - * @param string $string a localized string - * e.g. __('Your SQL query has been executed successfully') + * @param string $string A localized string + * e.g. __('Your SQL query has been + * executed successfully') * * @return PMA_Message * @static @@ -185,7 +188,7 @@ class PMA_Message * * shorthand for getting a simple error message * - * @param string $string a localized string e.g. __('Error') + * @param string $string A localized string e.g. __('Error') * * @return PMA_Message * @static @@ -204,9 +207,10 @@ class PMA_Message * * shorthand for getting a simple notice message * - * @param 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.') + * @param 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.') * * @return PMA_Message * @static @@ -221,8 +225,8 @@ class PMA_Message * * shorthand for getting a customized message * - * @param string $message - * @param integer $type + * @param string $message A localized string + * @param integer $type A numeric representation of the type of message * * @return PMA_Message * @static @@ -246,7 +250,9 @@ class PMA_Message */ static public function affected_rows($rows) { - $message = PMA_Message::success(_ngettext('%1$d row affected.', '%1$d rows affected.', $rows)); + $message = PMA_Message::success( + _ngettext('%1$d row affected.', '%1$d rows affected.', $rows) + ); $message->addParam($rows); return $message; } @@ -263,7 +269,9 @@ class PMA_Message */ static public function deleted_rows($rows) { - $message = PMA_Message::success(_ngettext('%1$d row deleted.', '%1$d rows deleted.', $rows)); + $message = PMA_Message::success( + _ngettext('%1$d row deleted.', '%1$d rows deleted.', $rows) + ); $message->addParam($rows); return $message; } @@ -280,7 +288,9 @@ class PMA_Message */ static public function inserted_rows($rows) { - $message = PMA_Message::success(_ngettext('%1$d row inserted.', '%1$d rows inserted.', $rows)); + $message = PMA_Message::success( + _ngettext('%1$d row inserted.', '%1$d rows inserted.', $rows) + ); $message->addParam($rows); return $message; } @@ -290,7 +300,7 @@ class PMA_Message * * shorthand for getting a customized error message * - * @param string $message + * @param string $message A localized string * * @return PMA_Message * @static @@ -305,7 +315,7 @@ class PMA_Message * * shorthand for getting a customized notice message * - * @param string $message + * @param string $message A localized string * * @return PMA_Message * @static @@ -320,7 +330,7 @@ class PMA_Message * * shorthand for getting a customized success message * - * @param string $message + * @param string $message A localized string * * @return PMA_Message * @static @@ -334,7 +344,7 @@ class PMA_Message * returns whether this message is a success message or not * and optionaly makes this message a success message * - * @param boolean $set + * @param boolean $set Whether to make this message of SUCCESS type * * @return boolean whether this is a success message or not */ @@ -351,7 +361,7 @@ class PMA_Message * returns whether this message is a notice message or not * and optionally makes this message a notice message * - * @param boolean $set + * @param boolean $set Whether to make this message of NOTICE type * * @return boolean whether this is a notice message or not */ @@ -368,9 +378,9 @@ class PMA_Message * returns whether this message is an error message or not * and optionally makes this message an error message * - * @param boolean $set + * @param boolean $set Whether to make this message of ERROR type * - * @return boolean whether this is an error message or not + * @return boolean Whether this is an error message or not */ public function isError($set = false) { @@ -384,8 +394,10 @@ class PMA_Message /** * set raw message (overrides string) * - * @param string $message - * @param boolean $sanitize whether to sanitize $message or not + * @param string $message A localized string + * @param boolean $sanitize Whether to sanitize $message or not + * + * @return void */ public function setMessage($message, $sanitize = false) { @@ -398,9 +410,11 @@ class PMA_Message /** * set string (does not take effect if raw message is set) * - * @param string $_string + * @param string $_string * * @param boolean $sanitize whether to sanitize $string or not + * + * @return void */ public function setString($_string, $sanitize = true) { @@ -588,21 +602,21 @@ class PMA_Message } /** - * returns unique PMA_Message::$_hash, if not exists it will be created + * returns unique PMA_Message::$hash, if not exists it will be created * - * @return string PMA_Message::$_hash + * @return string PMA_Message::$hash */ public function getHash() { - if (null === $this->_hash) { - $this->_hash = md5( + if (null === $this->hash) { + $this->hash = md5( $this->getNumber() . $this->_string . $this->_message ); } - return $this->_hash; + return $this->hash; } /** @@ -671,6 +685,7 @@ class PMA_Message /** * Displays the message in HTML * + * @return void */ public function display() {