XOOPS
2.6.0
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
AbstractHelper.php
Go to the documentation of this file.
1
<?php
2
/*
3
You may not change or alter any portion of this comment or credits
4
of supporting developers from this source code or any supporting source code
5
which is considered copyrighted (c) material of the original comment or credit authors.
6
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
namespace
Xmf\Module\Helper
;
13
14
use
Xmf\Module\Helper
;
15
31
abstract
class
AbstractHelper
32
{
36
protected
$module
;
37
41
protected
$debug
;
42
52
public
function
__construct
(
$module
= null)
53
{
54
$this->
module
= null;
55
56
if
(empty(
$module
)) {
57
// nothing specified, use current module
58
// check if we are running in 2.6
59
if
(class_exists(
'Xoops'
,
false
)) {
60
$xoops
=
\Xoops::getInstance
();
61
if
(
$xoops
->isModule()) {
62
$this->
module
=
$xoops
->module;
63
}
64
}
else
{
65
$this->
module
=
$GLOBALS
[
'xoopsModule'
];
66
}
67
} elseif (is_scalar(
$module
)) {
68
// dirname specified, get a module object
69
$helper
=
Helper::getHelper
(
$module
);
70
if
(
$helper
) {
71
$this->
module
=
$helper
->getModule();
72
}
73
}
else
{
74
// assume a passed object is appropriate
75
if
(is_object(
$module
)) {
76
$this->
module
=
$module
;
77
}
78
}
79
if
(is_object($this->
module
)) {
80
$this->
init
();
81
}
82
}
83
91
abstract
public
function
init
();
92
100
public
function
setDebug
($bool =
true
)
101
{
102
$this->debug = (bool) $bool;
103
}
104
112
public
function
addLog
($log)
113
{
114
if
($this->debug) {
115
\Xoops::getInstance
()->logger()->debug($log, array(
'channel'
=>
'Extra'
));
116
}
117
}
118
}
Xmf\Module\Helper\AbstractHelper\$debug
$debug
Definition:
AbstractHelper.php:41
Xmf\Module\Helper\getHelper
static getHelper($dirname= 'system')
Definition:
Helper.php:41
Xoops\getInstance
static getInstance()
Definition:
Xoops.php:160
Xmf\Module\Helper\AbstractHelper\init
init()
module
Xmf\Module\Helper\AbstractHelper\setDebug
setDebug($bool=true)
Definition:
AbstractHelper.php:100
Xmf\Module\Helper\AbstractHelper
Definition:
AbstractHelper.php:31
Xmf\Module\Helper\AbstractHelper\__construct
__construct($module=null)
Definition:
AbstractHelper.php:52
$xoops
$xoops
Definition:
admin.php:25
Xmf\Module\Helper\AbstractHelper\addLog
addLog($log)
Definition:
AbstractHelper.php:112
Xmf\Module\Helper
Definition:
AbstractHelper.php:12
$helper
$helper
Definition:
xoops_images.php:16
$GLOBALS
$GLOBALS['xoops']
Definition:
common.php:33
Xmf\Module\Helper\AbstractHelper\$module
$module
Definition:
AbstractHelper.php:36
usr64
htdocs
xoops_lib
Xmf
Module
Helper
AbstractHelper.php
Generated on Fri May 22 2015 03:07:05 for XOOPS by
1.8.9.1