fix some PHP Deprecated and typos in comments

This commit is contained in:
ralf 2023-04-18 09:11:16 +02:00
parent 5358bb5f6f
commit c7c2ab9118
2 changed files with 12 additions and 12 deletions

View File

@ -29,7 +29,7 @@ class Template
/** /**
* @var $debug mixed False for no debug, string or array of strings with: * @var $debug mixed False for no debug, string or array of strings with:
* - function-name like set_var to get eg. all assignments or * - function-name like set_var to get e.g. all assignments or
* - handle- / variable-names - if you are only interested in some variables ;-) * - handle- / variable-names - if you are only interested in some variables ;-)
*/ */
var $debug = False; // array('cat_list','cat_list_t'); var $debug = False; // array('cat_list','cat_list_t');
@ -153,7 +153,7 @@ class Template
/** /**
* Extract the template $handle from $parent and place variable {$name} instead * Extract the template $handle from $parent and place variable {$name} instead
* *
* @param string $parent name of tempalte containing $handle * @param string $parent name of template containing $handle
* @param string $handle name of part * @param string $handle name of part
* @param string $name name of variable/placeholder * @param string $name name of variable/placeholder
* @return boolean * @return boolean
@ -179,7 +179,7 @@ class Template
$match = null; $match = null;
if (!preg_match($reg,$str,$match)) if (!preg_match($reg,$str,$match))
{ {
// unfortunaly some apps set non-existing blocks, therefor I have to disable this diagnostics again for now // unfortunately some apps set non-existing blocks, therefor I have to disable this diagnostics again for now
$this->halt("set_block: unable to find block '$handle' in '$parent'=<pre>".htmlspecialchars($str)."</pre> this->root=$this->root"); $this->halt("set_block: unable to find block '$handle' in '$parent'=<pre>".htmlspecialchars($str)."</pre> this->root=$this->root");
// return False; // return False;
} }
@ -223,7 +223,7 @@ class Template
} }
/** /**
* Substitue variables/placeholders and return result * Substitute variables/placeholders and return result
* *
* @param string $handle handle of template where variables are to be substituted * @param string $handle handle of template where variables are to be substituted
* @return string * @return string
@ -243,13 +243,13 @@ class Template
$str = $this->get_var($handle); $str = $this->get_var($handle);
foreach($this->varkeys as $k => $v) foreach($this->varkeys as $k => $v)
{ {
$str = str_replace($v, $this->varvals[$k], $str); $str = str_replace($v, $this->varvals[$k] ?? '', $str);
} }
return $str; return $str;
} }
/** /**
* Substitue variables/placeholders and print result * Substitute variables/placeholders and print result
* *
* @param string $handle handle of template where variables are to be substituted * @param string $handle handle of template where variables are to be substituted
* @return boolean false * @return boolean false
@ -318,7 +318,7 @@ class Template
} }
/** /**
* This is a short cut for print finish parse * This is a shortcut for print finish parse
*/ */
function pfp($target, $handle, $append = False) function pfp($target, $handle, $append = False)
{ {
@ -534,7 +534,7 @@ class Template
switch ($this->halt_on_error) switch ($this->halt_on_error)
{ {
case 'no': case 'no':
// ignore error quitely // ignore error quietly
break; break;
case 'report': case 'report':
printf("<b>Template Error:</b> %s<br>\n", $msg); printf("<b>Template Error:</b> %s<br>\n", $msg);
@ -563,7 +563,7 @@ class Template
/** /**
* get template dir of an application * get template dir of an application
* *
* @param $appname appication name optional can be derived from $GLOBALS['egw_info']['flags']['currentapp']; * @param string $appname application name optional can be derived from $GLOBALS['egw_info']['flags']['currentapp'];
* @return string template directory * @return string template directory
* @throws Api\Exception\WrongParameter if no directory is found * @throws Api\Exception\WrongParameter if no directory is found
*/ */

View File

@ -919,8 +919,8 @@ class setup
echo'<br>Input values: ' echo'<br>Input values: '
. 'A="'.$a.'", B="'.$b.'"'; . 'A="'.$a.'", B="'.$b.'"';
} }
$newa = str_replace('pre','.',$a); $newa = str_replace('pre', '.', $a ?? '');
$newb = str_replace('pre','.',$b); $newb = str_replace('pre', '.', $b ?? '');
$testa = explode('.',$newa); $testa = explode('.',$newa);
if($testa[3] == '') if($testa[3] == '')
{ {