1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Description action plugin. |
||
5 | * |
||
6 | * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) |
||
7 | * @author Ikuo Obataya <[email protected]> |
||
8 | * @author Matthias Schulte <[email protected]>. |
||
9 | * @author Mark C. Prins <[email protected]> |
||
10 | * |
||
11 | * @phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps |
||
12 | * @noinspection AutoloadingIssuesInspection |
||
13 | */ |
||
14 | |||
15 | use dokuwiki\Extension\ActionPlugin; |
||
1 ignored issue
–
show
|
|||
16 | use dokuwiki\Extension\Event; |
||
1 ignored issue
–
show
The type
dokuwiki\Extension\Event was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() This use statement conflicts with another class in this namespace,
Event . Consider defining an alias.
Let?s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let?s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
![]() |
|||
17 | use dokuwiki\Extension\EventHandler; |
||
1 ignored issue
–
show
The type
dokuwiki\Extension\EventHandler was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
18 | |||
19 | const KEYWORD_SOURCE_ABSTRACT = 'abstract'; |
||
20 | const KEYWORD_SOURCE_GLOBAL = 'global'; |
||
21 | const KEYWORD_SOURCE_SYNTAX = 'syntax'; |
||
22 | |||
23 | class action_plugin_description extends ActionPlugin |
||
24 | { |
||
25 | final public function register(EventHandler $controller): void |
||
26 | { |
||
27 | $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'description', []); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Add an abstract, global value or a specified string to meta header |
||
32 | */ |
||
33 | final public function description(Event $event): void |
||
34 | { |
||
35 | if (empty($event->data) || empty($event->data['meta'])) { |
||
36 | return; |
||
37 | } |
||
38 | |||
39 | global $ID; |
||
40 | $source = $this->getConf('keyword_source'); |
||
41 | if (empty($source)) { |
||
42 | $source = 'abstract'; |
||
43 | } |
||
44 | |||
45 | $metaContent = ''; |
||
46 | switch ($source) { |
||
47 | case KEYWORD_SOURCE_ABSTRACT: |
||
48 | if (auth_quickaclcheck($ID) < AUTH_READ) { |
||
0 ignored issues
–
show
|
|||
49 | // don't add meta header when user has no read permissions |
||
50 | return; |
||
51 | } |
||
52 | $d = p_get_metadata($ID, 'description'); |
||
53 | if (empty($d)) { |
||
54 | return; |
||
55 | } |
||
56 | $metaContent = str_replace("\n", " ", $d['abstract']); |
||
57 | if (empty($metaContent)) { |
||
58 | return; |
||
59 | } |
||
60 | break; |
||
61 | case KEYWORD_SOURCE_GLOBAL: |
||
62 | $metaContent = $this->getConf('global_description'); |
||
63 | if (empty($metaContent)) { |
||
64 | return; |
||
65 | } |
||
66 | break; |
||
67 | case KEYWORD_SOURCE_SYNTAX: |
||
68 | if (auth_quickaclcheck($ID) < AUTH_READ) { |
||
69 | // don't add meta header when user has no read permissions |
||
70 | return; |
||
71 | } |
||
72 | $metadata = p_get_metadata($ID); |
||
73 | $metaContent = $metadata['plugin_description']['keywords']; |
||
74 | if (empty($metaContent)) { |
||
75 | return; |
||
76 | } |
||
77 | break; |
||
78 | |||
79 | } |
||
80 | |||
81 | $event->data['meta'][] = ["name" => "description", "content" => $metaContent]; |
||
82 | } |
||
83 | } |
||
84 |
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