|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace GeminiLabs\BlackBar\Modules; |
|
4
|
|
|
|
|
5
|
|
|
use GeminiLabs\BlackBar\Application; |
|
6
|
|
|
|
|
7
|
|
|
class Templates implements Module |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* @var Application |
|
11
|
|
|
*/ |
|
12
|
|
|
protected $app; |
|
13
|
|
|
/** |
|
14
|
|
|
* @var array |
|
15
|
|
|
*/ |
|
16
|
|
|
protected $entries; |
|
17
|
|
|
|
|
18
|
|
|
public function __construct(Application $app) |
|
19
|
|
|
{ |
|
20
|
|
|
$this->app = $app; |
|
21
|
|
|
$this->entries = []; |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function entries(): array |
|
25
|
|
|
{ |
|
26
|
|
|
if (!empty($this->entries)) { |
|
27
|
|
|
return $this->entries; |
|
28
|
|
|
} |
|
29
|
|
|
if (class_exists('\GeminiLabs\Castor\Facades\Development') |
|
30
|
|
|
&& class_exists('\GeminiLabs\Castor\Helpers\Development') |
|
31
|
|
|
&& method_exists('\GeminiLabs\Castor\Helpers\Development', 'templatePaths')) { // @phpstan-ignore-line |
|
32
|
|
|
$this->entries = \GeminiLabs\Castor\Facades\Development::templatePaths(); |
|
|
|
|
|
|
33
|
|
|
} else { |
|
34
|
|
|
$files = array_values(array_filter(get_included_files(), function ($file) { |
|
35
|
|
|
$bool = false !== strpos($file, '/themes/') && false === strpos($file, '/functions.php'); |
|
36
|
|
|
return (bool) apply_filters('blackbar/templates/file', $bool, $file); |
|
37
|
|
|
})); |
|
38
|
|
|
$this->entries = array_map(function ($file) { |
|
39
|
|
|
return str_replace(trailingslashit(WP_CONTENT_DIR), '', $file); |
|
40
|
|
|
}, $files); |
|
41
|
|
|
} |
|
42
|
|
|
return $this->entries; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function hasEntries(): bool |
|
46
|
|
|
{ |
|
47
|
|
|
return !empty($this->entries()); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function id(): string |
|
51
|
|
|
{ |
|
52
|
|
|
return 'glbb-templates'; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function isVisible(): bool |
|
56
|
|
|
{ |
|
57
|
|
|
return !is_admin(); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function label(): string |
|
61
|
|
|
{ |
|
62
|
|
|
return __('Templates', 'blackbar'); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function render(): void |
|
66
|
|
|
{ |
|
67
|
|
|
$this->app->render('panels/templates', ['templates' => $this]); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths