-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStaticPages.config.php
More file actions
139 lines (122 loc) · 4.14 KB
/
Copy pathStaticPages.config.php
File metadata and controls
139 lines (122 loc) · 4.14 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
<?php
/*
Static pages module config
AT
28.07.26
*/
namespace ProcessWire;
//looking for webroot
$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
if(PHP_SAPI === 'cli'){
$dir = str_replace( '\\', '/', __DIR__ );
$parts = explode( '/', $dir );
while( $part = array_pop($parts) ){
$DOCUMENT_ROOT = implode('/',$parts);
if( !is_file( "$DOCUMENT_ROOT/index.php") ) continue;
break;
}
}
foreach( wire('templates') as $template ){
$nonStaticTemplatesOptions[$template->id] = $template->name;
if( $template->name == 'admin' ) $nonStaticTemplatesValue[] = $template->id;
}
foreach (new \DirectoryIterator($DOCUMENT_ROOT) as $fileInfo) {
if($fileInfo->isDot()) continue;
if($fileInfo->isFile()) continue;
$nonStaticDirsValue[] = $fileInfo->getFilename();
}
$nonStaticDirsValue = implode("\n", $nonStaticDirsValue);
////
$config = [
[
'name' => 'priority',
'type' => 'text',
'label' => $this->_('Priority'),
//'description' => $this->_('one name per line'),
'notes' => $this->_('Should be higher than other modules have to transform their output.'),
'required' => true,
'columnWidth' => 33,
'value' => 1000,
],
[
'name' => 'nonStaticDirs',
'type' => 'textarea',
'label' => $this->_('Non-static directories'),
'description' => $this->_('one name per line'),
'notes' => $this->_('These directories will be protected from deletion when static files and dirs are deleted.'),
'required' => true,
'columnWidth' => 33,
'value' => $nonStaticDirsValue,
],
[
'name' => 'nonStaticTemplates',
'type' => 'AsmSelect',
'label' => $this->_('Non-static page templates'),
//'description' => $this->_('one name per line'),
'notes' => $this->_('Pages having these templates will have no static representation.'),
'required' => true,
'columnWidth' => 33,
'options' => $nonStaticTemplatesOptions,
'value' => $nonStaticTemplatesValue,
],
[
'name' => 'newDirPermissions',
'type' => 'text',
'label' => $this->_('Permissions for every new static dir'),
'description' => $this->_('UNIX string like 0755'),
//'notes' => $this->_('Path relative to website root directory.'),
'required' => true,
'columnWidth' => 33,
'value' => '0755',
],
[
'name' => 'staticFile',
'type' => 'text',
'label' => $this->_('Static file name'),
//'description' => $this->_('normally index.html'),
//'notes' => $this->_('Path relative to website root directory.'),
'required' => true,
'columnWidth' => 33,
'value' => 'index.html',
],
[
'name' => 'useShell',
'type' => 'checkbox',
'label' => $this->_('Use shell commands'),
//'description' => $this->_('UNIX string like 0755'),
'notes' => $this->_('Faster than php but can be unavailable on certain systems.'),
//'required' => true,
'columnWidth' => 33,
//'value' => 1,
],
[
'name' => 'rmDirPasses',
'type' => 'text',
'label' => $this->_('Dir removal passes'),
//'description' => $this->_('one name per line'),
'notes' => $this->_('When shell is used, recursive removal of empty dirs may require several passes if the directory structure is deeply nested. Normally, 10 passes is enough.'),
'required' => true,
'columnWidth' => 33,
'value' => 10,
],
[
'name' => 'forceWipeOnModuleSave',
'type' => 'checkbox',
'label' => $this->_('Force static pages deletion on module save'),
//'description' => $this->_('UNIX string like 0755'),
//'notes' => $this->_('Path relative to website root directory.'),
//'required' => true,
'columnWidth' => 33,
//'value' => 1,
],
[
'name' => 'isEnabled',
'type' => 'checkbox',
'label' => $this->_('Enable this module'),
//'description' => $this->_('UNIX string like 0755'),
//'notes' => $this->_('Path relative to website root directory.'),
//'required' => true,
'columnWidth' => 33,
'value' => 1,
],
];