-
-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathForm.php
More file actions
158 lines (131 loc) · 4.12 KB
/
Copy pathForm.php
File metadata and controls
158 lines (131 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
/*
* Textpattern Content Management System
* https://textpattern.com/
*
* Copyright (C) 2026 The Textpattern Development Team
*
* This file is part of Textpattern.
*
* Textpattern is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2.
*
* Textpattern is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Textpattern. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Form
*
* Manages Form.
*
* @since 4.7.0
* @package Skin
*/
namespace Textpattern\Skin;
class Form extends AssetBase implements FormInterface, \Textpattern\Container\FactorableInterface
{
/**
* {@inheritdoc}
*/
protected static $dir = TXP_THEME_TREE['forms'];
/**
* {@inheritdoc}
*/
protected static $subdirField = 'type';
/**
* The expected subdirs for this asset type.
*
* Note the order of the values is the order the blocks appear in the
* Presentation->Forms panel.
*
* @var array
*/
protected static $subdirValues = array('article', 'misc', 'category', 'comment', 'file', 'link', 'section');
/**
* {@inheritdoc}
*/
protected static $defaultSubdir = 'misc';
/**
* {@inheritdoc}
*/
protected static $fileContentsField = 'Form';
/**
* {@inheritdoc}
*/
protected static $essential = array(
array(
'name' => 'comments',
'type' => 'comment',
'Form' => '<!-- Contents of the \'comments\' comment form goes here. Refer to https://docs.textpattern.com/ for further information. -->',
),
array(
'name' => 'comments_display',
'type' => 'comment',
'Form' => '<!-- Contents of the \'comments_display\' comment form goes here. Refer to https://docs.textpattern.com/ for further information. -->',
),
array(
'name' => 'comment_form',
'type' => 'comment',
'Form' => '<!-- Contents of the \'comment_form\' comment form goes here. Refer to https://docs.textpattern.com/ for further information. -->',
),
array(
'name' => 'default',
'type' => 'article',
'Form' => '<!-- Contents of the \'default\' article form goes here. Refer to https://docs.textpattern.com/ for further information. -->',
),
array(
'name' => 'plainlinks',
'type' => 'link',
'Form' => '<!-- Contents of the \'plainlinks\' link form goes here. Refer to https://docs.textpattern.com/ for further information. -->',
),
array(
'name' => 'files',
'type' => 'file',
'Form' => '<!-- Contents of the \'files\' file form goes here. Refer to https://docs.textpattern.com/ for further information. -->',
),
);
/**
* Constructor
*/
public function getInstance()
{
$textarray = array();
if ($custom_types = parse_ini_string(get_pref('custom_form_types'), true)) {
static::$mimeTypes = get_mediatypes($textarray);
} else {
$custom_types = array();
}
\Txp::get('\Textpattern\L10n\Lang')->setPack($textarray, true);
static::$subdirValues = array_unique(array_merge(
static::$subdirValues,
array_keys($custom_types),
array_keys(static::$mimeTypes)
));
return $this;
}
/**
* {@inheritdoc}
*/
public function setInfos(
$name,
$type = null,
$Form = null
) {
$name = $this->setName($name)->getName();
$this->infos = compact('name', 'type', 'Form');
return $this;
}
/**
* $defaultSubdir property getter.
*/
public static function getTypes()
{
return static::$subdirValues;
}
}