1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
//namespace Xoopsmodules\Newbb; |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
You may not change or alter any portion of this comment or credits |
7
|
|
|
of supporting developers from this source code or any supporting source code |
8
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
9
|
|
|
|
10
|
|
|
This program is distributed in the hope that it will be useful, |
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
*/ |
14
|
|
|
/** |
15
|
|
|
* NewBB module for xoops |
16
|
|
|
* |
17
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
18
|
|
|
* @license GPL 2.0 or later |
19
|
|
|
* @package newbb |
20
|
|
|
* @since 5.0.0 |
21
|
|
|
* @author XOOPS Development Team <[email protected]> - <https://xoops.org> |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
//defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
|
|
|
|
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Class Helper |
28
|
|
|
*/ |
29
|
|
|
class Newbb extends \Xmf\Module\Helper |
|
|
|
|
30
|
|
|
{ |
31
|
|
|
public $debugArray = []; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @internal param $debug |
35
|
|
|
*/ |
36
|
|
|
protected function __construct() |
37
|
|
|
{ |
38
|
|
|
// $this->debug = $debug; |
|
|
|
|
39
|
|
|
$this->dirname = basename(dirname(__DIR__)); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param bool $debug |
44
|
|
|
* |
45
|
|
|
* @return Newbb |
46
|
|
|
*/ |
47
|
|
|
public static function getInstance($debug = false) |
48
|
|
|
{ |
49
|
|
|
static $instance; |
50
|
|
|
if (null === $instance) { |
51
|
|
|
$instance = new static($debug); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
return $instance; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @param null|string $name |
60
|
|
|
* @param null|string $value |
61
|
|
|
* |
62
|
|
|
* @return mixed |
63
|
|
|
*/ |
64
|
|
|
// public function setConfig($name = null, $value = null) |
|
|
|
|
65
|
|
|
// { |
66
|
|
|
// if (null === $this->configs) { |
67
|
|
|
// $this->initConfig(); |
68
|
|
|
// } |
69
|
|
|
// $this->configs[$name] = $value; |
70
|
|
|
// $this->addLog("Setting config '{$name}' : " . $this->configs[$name]); |
71
|
|
|
// |
72
|
|
|
// return $this->configs[$name]; |
73
|
|
|
// } |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return string |
77
|
|
|
*/ |
78
|
|
|
public function getDirname() |
79
|
|
|
{ |
80
|
|
|
return $this->dirname; |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.