XoopsModules25x /
tdmdownloads
| 1 | <?php |
||
| 2 | |||
| 3 | namespace XoopsModules\Tdmdownloads; |
||
| 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 | /** |
||
| 16 | * @copyright XOOPS Project https://xoops.org/ |
||
| 17 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
| 18 | * @package |
||
| 19 | * @since |
||
| 20 | * @author XOOPS Development Team |
||
| 21 | */ |
||
| 22 | //defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Class Helper |
||
| 26 | */ |
||
| 27 | class Helper extends \Xmf\Module\Helper |
||
| 28 | { |
||
| 29 | public $debug; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Constructor |
||
| 33 | * |
||
| 34 | * @param bool $debug |
||
| 35 | */ |
||
| 36 | public function __construct($debug = false) |
||
| 37 | { |
||
| 38 | $this->debug = $debug; |
||
| 39 | $moduleDirName = basename(dirname(__DIR__)); |
||
| 40 | parent::__construct($moduleDirName); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Get instance |
||
| 45 | * @param bool $debug |
||
| 46 | * @return \XoopsModules\Tdmdownloads\Helper |
||
| 47 | */ |
||
| 48 | public static function getInstance($debug = false) |
||
| 49 | { |
||
| 50 | static $instance; |
||
| 51 | if (null === $instance) { |
||
| 52 | $instance = new static($debug); |
||
| 53 | } |
||
| 54 | |||
| 55 | return $instance; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @return string |
||
| 60 | */ |
||
| 61 | public function getDirname() |
||
| 62 | { |
||
| 63 | return $this->dirname; |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Get an Object Handler |
||
| 68 | * |
||
| 69 | * @param string $name name of handler to load |
||
| 70 | * |
||
| 71 | * @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler |
||
| 72 | */ |
||
| 73 | public function getHandler($name) |
||
| 74 | { |
||
| 75 | $ret = false; |
||
|
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
| 76 | $db = \XoopsDatabaseFactory::getDatabaseConnection(); |
||
| 77 | $class = '\\XoopsModules\\' . ucfirst(mb_strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler'; |
||
| 78 | $ret = new $class($db); |
||
| 79 | |||
| 80 | return $ret; |
||
| 81 | } |
||
| 82 | } |
||
| 83 | |||
| 84 |