@@ 1223-1256 (lines=34) @@ | ||
1220 | * |
|
1221 | * @return array |
|
1222 | */ |
|
1223 | public function get_included_files() { |
|
1224 | ||
1225 | if ( ! empty( $this->included_files ) ) { |
|
1226 | return $this->included_files; |
|
1227 | } |
|
1228 | ||
1229 | $this->included_files = array(); |
|
1230 | ||
1231 | $excludes = $this->exclude_string( 'regex' ); |
|
1232 | ||
1233 | foreach ( $this->get_files( true ) as $file ) { |
|
1234 | ||
1235 | // Skip dot files, they should only exist on versions of PHP between 5.2.11 -> 5.3 |
|
1236 | if ( method_exists( $file, 'isDot' ) && $file->isDot() ) { |
|
1237 | continue; |
|
1238 | } |
|
1239 | ||
1240 | // Skip unreadable files |
|
1241 | if ( ! @realpath( $file->getPathname() ) || ! $file->isReadable() ) { |
|
1242 | continue; |
|
1243 | } |
|
1244 | ||
1245 | // Excludes |
|
1246 | if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '', wp_normalize_path( $file->getPathname() ) ) ) ) { |
|
1247 | continue; |
|
1248 | } |
|
1249 | ||
1250 | $this->included_files[] = $file; |
|
1251 | ||
1252 | } |
|
1253 | ||
1254 | return $this->included_files; |
|
1255 | ||
1256 | } |
|
1257 | ||
1258 | /** |
|
1259 | * Returns an array of files that match the exclude rules. |
|
@@ 1263-1294 (lines=32) @@ | ||
1260 | * |
|
1261 | * @return array |
|
1262 | */ |
|
1263 | public function get_excluded_files() { |
|
1264 | ||
1265 | if ( ! empty( $this->excluded_files ) ) { |
|
1266 | return $this->excluded_files; |
|
1267 | } |
|
1268 | ||
1269 | $this->excluded_files = array(); |
|
1270 | ||
1271 | $excludes = $this->exclude_string( 'regex' ); |
|
1272 | ||
1273 | foreach ( $this->get_files( true ) as $file ) { |
|
1274 | ||
1275 | // Skip dot files, they should only exist on versions of PHP between 5.2.11 -> 5.3 |
|
1276 | if ( method_exists( $file, 'isDot' ) && $file->isDot() ) { |
|
1277 | continue; |
|
1278 | } |
|
1279 | ||
1280 | // Skip unreadable files |
|
1281 | if ( ! @realpath( $file->getPathname() ) || ! $file->isReadable() ) { |
|
1282 | continue; |
|
1283 | } |
|
1284 | ||
1285 | // Excludes |
|
1286 | if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '', wp_normalize_path( $file->getPathname() ) ) ) ) { |
|
1287 | $this->excluded_files[] = $file; |
|
1288 | } |
|
1289 | ||
1290 | } |
|
1291 | ||
1292 | return $this->excluded_files; |
|
1293 | ||
1294 | } |
|
1295 | ||
1296 | /** |
|
1297 | * Returns an array of unreadable files. |