@@ -47,22 +47,32 @@ public function accept()
47
47
}
48
48
49
49
if ($ this ->disallowedFiles === null ) {
50
- $ this ->disallowedFiles = $ this ->getblacklist ();
50
+ $ this ->disallowedFiles = $ this ->getDisallowedFiles ();
51
+
52
+ // BC-layer.
53
+ if ($ this ->disallowedFiles === null ) {
54
+ $ this ->disallowedFiles = $ this ->getBlacklist ();
55
+ }
51
56
}
52
57
53
58
if ($ this ->allowedFiles === null ) {
54
- $ this ->allowedFiles = $ this ->getwhitelist ();
59
+ $ this ->allowedFiles = $ this ->getAllowedFiles ();
60
+
61
+ // BC-layer.
62
+ if ($ this ->allowedFiles === null ) {
63
+ $ this ->allowedFiles = $ this ->getWhitelist ();
64
+ }
55
65
}
56
66
57
67
$ filePath = Util \Common::realpath ($ this ->current ());
58
68
59
- // If file is both disallowed and allowed, the disallowed files list takes precedence.
69
+ // If a file is both disallowed and allowed, the disallowed files list takes precedence.
60
70
if (isset ($ this ->disallowedFiles [$ filePath ]) === true ) {
61
71
return false ;
62
72
}
63
73
64
74
if (empty ($ this ->allowedFiles ) === true && empty ($ this ->disallowedFiles ) === false ) {
65
- // We are only checking a disallowed files list, so everything else should be allowed.
75
+ // We are only checking the disallowed files list, so everything else should be allowed.
66
76
return true ;
67
77
}
68
78
@@ -92,6 +102,11 @@ public function getChildren()
92
102
/**
93
103
* Get a list of file paths to exclude.
94
104
*
105
+ * @deprecated 3.9.0 Overload the `getDisallowedFiles()` method instead.
106
+ * The `getDisallowedFiles()` method will be made abstract and therefore required
107
+ * in v4.0 and this method will be removed.
108
+ * If both methods are implemented, the new `getDisallowedFiles()` method will take precedence.
109
+ *
95
110
* @return array
96
111
*/
97
112
abstract protected function getBlacklist ();
@@ -100,9 +115,42 @@ abstract protected function getBlacklist();
100
115
/**
101
116
* Get a list of file paths to include.
102
117
*
118
+ * @deprecated 3.9.0 Overload the `getAllowedFiles()` method instead.
119
+ * The `getAllowedFiles()` method will be made abstract and therefore required
120
+ * in v4.0 and this method will be removed.
121
+ * If both methods are implemented, the new `getAllowedFiles()` method will take precedence.
122
+ *
103
123
* @return array
104
124
*/
105
125
abstract protected function getWhitelist ();
106
126
107
127
128
+ /**
129
+ * Get a list of file paths to exclude.
130
+ *
131
+ * @since 3.9.0 Replaces the deprecated `getBlacklist()` method.
132
+ *
133
+ * @return array|null
134
+ */
135
+ protected function getDisallowedFiles ()
136
+ {
137
+ return null ;
138
+
139
+ }//end getDisallowedFiles()
140
+
141
+
142
+ /**
143
+ * Get a list of file paths to include.
144
+ *
145
+ * @since 3.9.0 Replaces the deprecated `getWhitelist()` method.
146
+ *
147
+ * @return array|null
148
+ */
149
+ protected function getAllowedFiles ()
150
+ {
151
+ return null ;
152
+
153
+ }//end getAllowedFiles()
154
+
155
+
108
156
}//end class
0 commit comments