CMSimple_XH 開発者ドキュメント
PageDataView.php
1
<?php
15
namespace
XH
;
16
27
class
PageDataView
28
{
34
private
$page;
35
41
private
$tabs;
42
49
public
function
__construct
(array $page, array $tabs = null)
50
{
51
$this->page = $page;
52
$this->tabs = $tabs;
53
}
54
64
public
function
tab
(
$title
, $filename, $cssClass)
65
{
66
$parts = explode(
'.'
, basename($filename), 2);
67
$function
= $parts[0];
68
// TODO: use something more appropriate than an anchor
69
return
"\n\t"
.
'<a class="xh_inactive_tab" id="xh_tab_'
.
$function
70
.
'"><span class="'
71
. $cssClass .
'">'
.
$title
.
'</span></a>'
;
72
}
73
79
public
function
tabs
()
80
{
81
$o
=
"\n"
.
'<div id="xh_pdtabs">'
;
82
foreach
($this->tabs as
$title
=> $array) {
83
list(
$file
, $cssClass) = $array;
84
$o
.= $this->tab(
$title
,
$file
, $cssClass);
85
}
86
$o
.=
"\n</div>"
;
87
return
$o
;
88
}
89
100
public
function
view
($filename)
101
{
102
global
$pth
,
$_XH_csrfProtection
;
103
104
$parts = explode(
'.'
, basename($filename), 2);
105
$function
= $parts[0];
106
// TODO: use something more appropriate than an anchor
107
$o
=
"\n"
.
'<div id="xh_view_'
.
$function
108
.
'" class="xh_inactive_view">'
109
.
"\n\t"
.
'<a class="xh_view_toggle"> </a>'
;
110
if
(file_exists($filename)) {
111
include_once $filename;
112
$o
.= preg_replace(
113
'/<(?:input|button)[^>]+name\s*=\s*([\'"])save_page_data\1/'
,
114
$_XH_csrfProtection->tokenInput() .
'$0'
,
115
$function
($this->page)
116
);
117
}
else
{
118
// TODO: i18n; or probably better: use $e/e()
119
$o
.=
"Could not find "
. $filename;
120
}
121
$o
.=
'<div class="xh_view_status">'
122
.
'<img src="'
. $pth[
'folder'
][
'corestyle'
]
123
.
'ajax-loader-bar.gif" style="display:none" alt="loading">'
124
.
'<div></div>'
125
.
'</div>'
;
126
$o
.=
"\n"
.
"</div>\n"
;
127
return
$o
;
128
}
129
135
public
function
views
()
136
{
137
$o
=
"\n"
.
'<div id="xh_pdviews">'
;
138
foreach
($this->tabs as $array) {
139
$file
= $array[0];
140
$o
.= $this->view(
$file
);
141
}
142
$o
.=
"\n"
.
'</div>'
;
143
return
$o
;
144
}
145
}
XH\PageDataView\tab
tab($title, $filename, $cssClass)
Definition:
PageDataView.php:64
$function
$function
Definition:
cms.php:473
XH\PageDataView\view
view($filename)
Definition:
PageDataView.php:100
XH
XH\PageDataView\tabs
tabs()
Definition:
PageDataView.php:79
$title
$title
Definition:
cms.php:100
XH\PageDataView
Definition:
PageDataView.php:27
$file
$file
Definition:
cms.php:640
$o
$o
Definition:
cms.php:113
$_XH_csrfProtection
foreach(XH_plugins() as $plugin) $_XH_csrfProtection
Definition:
cms.php:879
$pth
$pth
Definition:
cms.php:230
XH\PageDataView\views
views()
Definition:
PageDataView.php:135
XH\PageDataView\__construct
__construct(array $page, array $tabs=null)
Definition:
PageDataView.php:49
CMSimple_XH-1.7.0
cmsimplexh
cmsimple
classes
PageDataView.php
構築:
1.8.13