- LSerror : Transformation des méthodes en mode statique

This commit is contained in:
Benjamin Renard 2009-01-21 17:12:29 +00:00
parent 6f52489a59
commit 2a86edcae4

View file

@ -42,7 +42,7 @@ class LSerror {
* *
* @retval void * @retval void
*/ */
function addErrorCode($code=-1,$msg='') { static function addErrorCode($code=-1,$msg='') {
$_SESSION['LSerror'][] = array($code,$msg); $_SESSION['LSerror'][] = array($code,$msg);
} }
@ -55,8 +55,8 @@ class LSerror {
* *
* @retval void * @retval void
*/ */
function display($return=False) { static function display($return=False) {
$errors = $this -> getErrors(); $errors = self::getErrors();
if ($errors) { if ($errors) {
if ($return) { if ($return) {
return $errors; return $errors;
@ -75,13 +75,13 @@ class LSerror {
* *
* @retval void * @retval void
*/ */
function stop($code=-1,$msg='') { static function stop($code=-1,$msg='') {
if(!empty($_SESSION['LSerror'])) { if(!empty($_SESSION['LSerror'])) {
print "<h1>"._('Errors')."</h1>\n"; print "<h1>"._('Errors')."</h1>\n";
print $this -> display(true); print self::display(true);
} }
print "<h1>"._('Stop')."</h1>\n"; print "<h1>"._('Stop')."</h1>\n";
exit ($this -> getError(array($code,$msg))); exit (self::getError(array($code,$msg)));
} }
/** /**
@ -91,12 +91,12 @@ class LSerror {
* *
* @retvat string Le texte des erreurs * @retvat string Le texte des erreurs
*/ */
function getErrors() { static function getErrors() {
if(!empty($_SESSION['LSerror'])) { if(!empty($_SESSION['LSerror'])) {
foreach ($_SESSION['LSerror'] as $error) { foreach ($_SESSION['LSerror'] as $error) {
$txt.=$this -> getError($error); $txt.=self::getError($error);
} }
$this -> resetError(); self::resetError();
return $txt; return $txt;
} }
return; return;
@ -109,7 +109,7 @@ class LSerror {
* *
* @retvat string Le texte des erreurs * @retvat string Le texte des erreurs
*/ */
function getError($error) { static function getError($error) {
return "(Code ".$error[0].") ".getFData($GLOBALS['LSerror_code'][$error[0]]['msg'],$error[1])."<br />\n"; return "(Code ".$error[0].") ".getFData($GLOBALS['LSerror_code'][$error[0]]['msg'],$error[1])."<br />\n";
} }
@ -120,7 +120,7 @@ class LSerror {
* *
* @retvat boolean * @retvat boolean
*/ */
function errorsDefined() { static function errorsDefined() {
return !empty($_SESSION['LSerror']); return !empty($_SESSION['LSerror']);
} }
@ -131,8 +131,7 @@ class LSerror {
* *
* @retvat void * @retvat void
*/ */
function resetError() { static function resetError() {
LSlog('reset');
unset ($_SESSION['LSerror']); unset ($_SESSION['LSerror']);
} }
} }