make lng, version, dbversion and branding protected variables of ApiCommand to avoid the need of 'global' statement

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2018-02-23 18:18:31 +01:00
parent 6409fb2dbe
commit 831ee221f6
6 changed files with 79 additions and 43 deletions

View File

@@ -60,6 +60,34 @@ abstract class ApiCommand
*/
private $cmd_params = null;
/**
* language strings array
*
* @var array
*/
protected $lng = null;
/**
* froxlor version
*
* @var string
*/
protected $version = null;
/**
* froxlor dbversion
*
* @var int
*/
protected $dbversion = null;
/**
* froxlor version-branding
*
* @var string
*/
protected $branding = null;
/**
*
* @param array $header
@@ -73,8 +101,11 @@ abstract class ApiCommand
*/
public function __construct($header = null, $params = null, $userinfo = null)
{
global $lng;
global $lng, $version, $dbversion, $branding;
$this->version = $version;
$this->dbversion = $dbversion;
$this->branding = $branding;
$this->cmd_params = $params;
if (! empty($header)) {
$this->readUserData($header);
@@ -93,6 +124,7 @@ abstract class ApiCommand
}
$this->initLang();
$this->lng = $lng;
$this->initMail();
if ($this->debug) {