|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* |
|
4
|
|
|
* Precise Similar Topics |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright (c) 2013 Matt Friedman |
|
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
|
8
|
|
|
* |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace vse\similartopics\event; |
|
12
|
|
|
|
|
13
|
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
|
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Event listener |
|
17
|
|
|
*/ |
|
18
|
|
|
class listener implements EventSubscriberInterface |
|
19
|
|
|
{ |
|
20
|
|
|
/** @var \vse\similartopics\core\similar_topics */ |
|
21
|
|
|
protected $similar_topics; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Constructor |
|
25
|
|
|
* |
|
26
|
|
|
* @access public |
|
27
|
|
|
* @param \vse\similartopics\core\similar_topics $similar_topics |
|
28
|
|
|
*/ |
|
29
|
|
|
public function __construct(\vse\similartopics\core\similar_topics $similar_topics) |
|
30
|
|
|
{ |
|
31
|
|
|
$this->similar_topics = $similar_topics; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Assign functions defined in this class to event listeners in the core |
|
36
|
|
|
* |
|
37
|
|
|
* @static |
|
38
|
|
|
* @access public |
|
39
|
|
|
* @return array |
|
40
|
|
|
*/ |
|
41
|
|
|
public static function getSubscribedEvents() |
|
42
|
|
|
{ |
|
43
|
|
|
return [ |
|
44
|
|
|
'core.viewtopic_modify_page_title' => 'display_similar_topics', |
|
45
|
|
|
'core.permissions' => 'add_permissions', |
|
46
|
|
|
]; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Display similar topics |
|
51
|
|
|
* |
|
52
|
|
|
* @access public |
|
53
|
|
|
* @param \phpbb\event\data $event The event object |
|
|
|
|
|
|
54
|
|
|
*/ |
|
55
|
|
|
public function display_similar_topics($event) |
|
56
|
|
|
{ |
|
57
|
|
|
// Return early if similar topics is disabled |
|
58
|
|
|
if (!$this->similar_topics->is_available()) |
|
59
|
|
|
{ |
|
60
|
|
|
return; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
$this->similar_topics->display_similar_topics($event['topic_data']); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Add custom permissions language variables |
|
68
|
|
|
* |
|
69
|
|
|
* @access public |
|
70
|
|
|
* @param \phpbb\event\data $event The event object |
|
71
|
|
|
*/ |
|
72
|
|
|
public function add_permissions($event) |
|
73
|
|
|
{ |
|
74
|
|
|
$event->update_subarray('permissions', 'u_similar_topics', [ |
|
75
|
|
|
'lang' => 'ACL_U_SIMILARTOPICS', |
|
76
|
|
|
'cat' => 'misc' |
|
77
|
|
|
]); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|
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