forked from satanasov/pmsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelper.php
More file actions
53 lines (45 loc) · 1.28 KB
/
Copy pathhelper.php
File metadata and controls
53 lines (45 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* Created by PhpStorm.
* User: lucifer
* Date: 13.2.2017 г.
* Time: 17:18
*/
namespace anavaro\pmsearch;
class helper
{
public function __construct(\phpbb\extension\manager $ext_manager, \phpbb\auth\auth $auth, \phpbb\config\config $config,
\phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\language\language $language, \phpbb\event\dispatcher $dispatcher,
$phpbb_root_path, $phpEx)
{
$this->ext_manager = $ext_manager;
$this->auth = $auth;
$this->config = $config;
$this->db = $db;
$this->user = $user;
$this->lang = $language;
$this->dispatcher = $dispatcher;
$this->root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
}
public function get_search_types()
{
$finder = $this->ext_manager->get_finder();
return $finder
->extension_suffix('_backend1')
->extension_directory('')
->core_path('ext/anavaro/pmsearch/search/')
->get_classes();
}
public function init_search($type, &$search, &$error)
{
if (!class_exists($type) || !method_exists($type, 'keyword_search'))
{
$error = $this->lang->lang('NO_SUCH_SEARCH_MODULE');
return $error;
}
$error = false;
$search = new $type($error, $this->root_path, $this->php_ext, $this->auth, $this->config, $this->db, $this->user, $this->dispatcher);
return $error;
}
}