1 | <?php |
||
2 | /* |
||
3 | * @phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps |
||
4 | * @noinspection AutoloadingIssuesInspection |
||
5 | */ |
||
6 | |||
7 | /** |
||
8 | * Description action plugin. |
||
9 | * |
||
10 | * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) |
||
11 | * @author Ikuo Obataya <[email protected]> |
||
12 | * @author Matthias Schulte <[email protected]>. |
||
13 | * @author Mark C. Prins <[email protected]> |
||
14 | * |
||
15 | */ |
||
16 | |||
17 | use dokuwiki\Extension\ActionPlugin; |
||
1 ignored issue
–
show
|
|||
18 | use dokuwiki\Extension\Event; |
||
1 ignored issue
–
show
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.
![]() 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 ![]() |
|||
19 | 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 ![]() |
|||
20 | |||
21 | const KEYWORD_SOURCE_ABSTRACT = 'abstract'; |
||
22 | const KEYWORD_SOURCE_GLOBAL = 'global'; |
||
23 | const KEYWORD_SOURCE_SYNTAX = 'syntax'; |
||
24 | |||
25 | class action_plugin_description extends ActionPlugin |
||
26 | { |
||
27 | |||
28 | final public function register(EventHandler $controller): void |
||
29 | { |
||
30 | $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'description', array()); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * Add an abstract, global value or a specified string to meta header |
||
35 | */ |
||
36 | final public function description(Event $event, $param): void |
||
37 | { |
||
38 | if (empty($event->data) || empty($event->data['meta'])) { |
||
39 | return; |
||
40 | } |
||
41 | |||
42 | global $ID; |
||
43 | $source = $this->getConf('keyword_source'); |
||
44 | if (empty($source)) { |
||
45 | $source = 'abstract'; |
||
46 | } |
||
47 | |||
48 | if ($source === KEYWORD_SOURCE_ABSTRACT) { |
||
49 | if (auth_quickaclcheck($ID) < AUTH_READ) { |
||
50 | // don't add meta header when user has no read permissions |
||
51 | return; |
||
52 | } |
||
53 | |||
54 | $d = p_get_metadata($ID, 'description'); |
||
55 | if (empty($d)) { |
||
56 | return; |
||
57 | } |
||
58 | |||
59 | $a = str_replace("\n", " ", $d['abstract']); |
||
60 | if (empty($a)) { |
||
61 | return; |
||
62 | } |
||
63 | } |
||
64 | |||
65 | if ($source === KEYWORD_SOURCE_GLOBAL) { |
||
66 | $a = $this->getConf('global_description'); |
||
67 | if (empty($a)) { |
||
68 | return; |
||
69 | } |
||
70 | } |
||
71 | |||
72 | if ($source === KEYWORD_SOURCE_SYNTAX) { |
||
73 | if (auth_quickaclcheck($ID) < AUTH_READ) { |
||
74 | // don't add meta header when user has no read permissions |
||
75 | return; |
||
76 | } |
||
77 | $metadata = p_get_metadata($ID); |
||
78 | $a = $metadata['plugin_description']['keywords']; |
||
79 | if (empty($a)) { |
||
80 | return; |
||
81 | } |
||
82 | } |
||
83 | |||
84 | $m = array("name" => "description", "content" => $a); |
||
85 | $event->data['meta'][] = $m; |
||
86 | } |
||
87 | } |
||
88 |
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