XCL Web Application Platform
2.5.0
The XoopsCube Legacy Project
📘
Loading...
Searching...
No Matches
cachetime.php
1
<?php
11
12
if
(!defined(
'XOOPS_ROOT_PATH'
)) {
13
exit();
14
}
15
16
class
XoopsCachetime
extends
XoopsObject
17
{
18
public
function
__construct
()
19
{
20
static
$initVars;
21
if
(isset($initVars)) {
22
$this->vars = $initVars;
23
return
;
24
}
25
$this->
initVar
(
'cachetime'
, XOBJ_DTYPE_OTHER,
null
,
false
);
26
$this->
initVar
(
'label'
, XOBJ_DTYPE_TXTBOX,
null
,
true
, 255);
27
$initVars = $this->vars;
28
}
29
public
function
XoopsCachetime
()
30
{
31
return
self::__construct
();
32
}
33
}
34
35
class
XoopsCachetimeHandler
extends
XoopsObjectHandler
36
{
37
public
$_mResult;
38
39
public
function
__construct
(&$db)
40
{
41
parent::__construct($db);
42
43
//
44
// This handler not connects to database.
45
//
46
$this->_mResult = [
47
'0'
=> _NOCACHE,
48
'30'
=> sprintf(_SECONDS, 30),
49
'60'
=> _MINUTE,
50
'300'
=> sprintf(_MINUTES, 5),
51
'1800'
=> sprintf(_MINUTES, 30),
52
'3600'
=> _HOUR,
53
'18000'
=> sprintf(_HOURS, 5),
54
'86400'
=> _DAY,
55
'259200'
=> sprintf(_DAYS, 3),
56
'604800'
=> _WEEK,
57
'2592000'
=> _MONTH
58
];
59
}
60
public
function
XoopsCachetimeHandler
(&$db)
61
{
62
return
self::__construct
($db);
63
}
64
65
public
function
&
create
()
66
{
67
$ret =
new
XoopsCachetime
();
68
return
$ret;
69
}
70
71
public
function
&
get
($cachetime)
72
{
73
if
(isset($this->_mResult[$cachetime])) {
74
$obj =
new
XoopsCachetime
();
75
$obj->setVar(
'cachetime'
, $cachetime);
76
$obj->setVar(
'label'
, $this->_mResult[$cachetime]);
77
78
return
$obj;
79
}
80
81
$ret =
null
;
82
return
$ret;
83
}
84
85
public
function
&getObjects($criteria =
null
, $key_as_id =
false
)
86
{
87
$ret = [];
88
89
foreach
($this->_mResult as $cachetime => $label) {
90
$obj =
new
XoopsCachetime
();
91
$obj->setVar(
'cachetime'
, $cachetime);
92
$obj->setVar(
'label'
, $label);
93
if
($key_as_id) {
94
$ret[$cachetime] =& $obj;
95
}
else
{
96
$ret[] =& $obj;
97
}
98
unset($obj);
99
}
100
101
return
$ret;
102
}
103
104
public
function
insert
(&$obj)
105
{
106
return
false
;
107
}
108
109
public
function
delete
(&$obj)
110
{
111
return
false
;
112
}
113
}
XoopsCachetimeHandler
Definition
cachetime.php:36
XoopsCachetimeHandler\create
& create()
Definition
cachetime.php:65
XoopsCachetimeHandler\__construct
__construct(&$db)
Definition
cachetime.php:39
XoopsCachetimeHandler\insert
insert(&$obj)
Definition
cachetime.php:104
XoopsCachetime
Definition
cachetime.php:17
XoopsCachetime\__construct
__construct()
Definition
cachetime.php:18
XoopsObjectHandler
Definition
object.php:673
XoopsObject
Definition
object.php:97
XoopsObject\initVar
initVar($key, $data_type, $value=null, $required=false, $maxlength=null, $options='')
Definition
object.php:206
html
kernel
cachetime.php
Generated by
1.13.2