|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace XoopsModules\Publisher; |
|
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
|
|
|
* Publisher class |
|
17
|
|
|
* |
|
18
|
|
|
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ |
|
19
|
|
|
* @license GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
|
20
|
|
|
* @package Class |
|
21
|
|
|
* @subpackage Utils |
|
22
|
|
|
* @since 1.0 |
|
23
|
|
|
* @author trabis <[email protected]> |
|
24
|
|
|
* @version $Id$ |
|
25
|
|
|
*/ |
|
26
|
|
|
use Xoops\Module\Helper\HelperAbstract; |
|
27
|
|
|
use XoopsDatabaseFactory; |
|
28
|
|
|
use XoopsModules\Publisher; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Class Helper |
|
32
|
|
|
* @package XoopsModules\Publisher |
|
33
|
|
|
*/ |
|
34
|
|
|
class Helper extends HelperAbstract |
|
35
|
|
|
{ |
|
36
|
|
|
/** |
|
37
|
|
|
* Init the module |
|
38
|
|
|
* |
|
39
|
|
|
* @return null|void |
|
40
|
|
|
*/ |
|
41
|
|
|
public function init() |
|
42
|
|
|
{ |
|
43
|
|
|
$this->setDirname('publisher'); |
|
44
|
|
|
//$this->setDebug(true); |
|
45
|
|
|
$this->loadLanguage('modinfo'); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @return Helper |
|
50
|
|
|
*/ |
|
51
|
|
|
public static function getInstance() |
|
52
|
|
|
{ |
|
53
|
|
|
return parent::getInstance(); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @return \XoopsModules\Publisher\ItemHandler |
|
58
|
|
|
*/ |
|
59
|
|
|
public function getItemHandler(): ItemHandler |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->getHandler('Item'); |
|
|
|
|
|
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @return \XoopsModules\Publisher\CategoryHandler |
|
66
|
|
|
*/ |
|
67
|
|
|
public function getCategoryHandler(): CategoryHandler |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->getHandler('Category'); |
|
|
|
|
|
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @return \XoopsModules\Publisher\PermissionHandler |
|
74
|
|
|
*/ |
|
75
|
|
|
public function getPermissionHandler(): PermissionHandler |
|
76
|
|
|
{ |
|
77
|
|
|
return $this->getHandler('Permission'); |
|
|
|
|
|
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @return \XoopsModules\Publisher\FileHandler |
|
82
|
|
|
*/ |
|
83
|
|
|
public function getFileHandler(): FileHandler |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->getHandler('File'); |
|
|
|
|
|
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @return \XoopsModules\Publisher\MimetypeHandler |
|
90
|
|
|
*/ |
|
91
|
|
|
public function getMimetypeHandler(): MimetypeHandler |
|
92
|
|
|
{ |
|
93
|
|
|
return $this->getHandler('Mimetype'); |
|
|
|
|
|
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @return \XoopsModules\Publisher\RatingHandler |
|
98
|
|
|
*/ |
|
99
|
|
|
public function getRatingHandler(): RatingHandler |
|
100
|
|
|
{ |
|
101
|
|
|
return $this->getHandler('Rating'); |
|
|
|
|
|
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @return \XoopsModules\Publisher\GroupPermHandler |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getGrouppermHandler(): GroupPermHandler |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->getHandler('Groupperm'); |
|
|
|
|
|
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Get an Object Handler |
|
114
|
|
|
* |
|
115
|
|
|
* @param string $name name of handler to load |
|
116
|
|
|
* |
|
117
|
|
|
* @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler |
|
118
|
|
|
*/ |
|
119
|
|
|
public function getHandler($name) |
|
120
|
|
|
{ |
|
121
|
|
|
$ret = false; |
|
|
|
|
|
|
122
|
|
|
// /** @var Connection $db */ |
|
123
|
|
|
$db = XoopsDatabaseFactory::getConnection(); |
|
124
|
|
|
$class = '\\XoopsModules\\' . \ucfirst(mb_strtolower(\basename(\dirname(__DIR__)))) . '\\' . $name . 'Handler'; |
|
125
|
|
|
$ret = new $class($db); |
|
126
|
|
|
|
|
127
|
|
|
return $ret; |
|
128
|
|
|
} |
|
129
|
|
|
} |
|
130
|
|
|
|