forked from mambax7/tad_web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
51 lines (42 loc) · 1.62 KB
/
Copy pathsearch.php
File metadata and controls
51 lines (42 loc) · 1.62 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
<?php
use Xmf\Request;
use XoopsModules\Tadtools\Utility;
/*-----------引入檔案區--------------*/
require_once __DIR__ . '/header.php';
$GLOBALS['xoopsOption']['template_main'] = 'tad_web_search.tpl';
require_once XOOPS_ROOT_PATH . '/header.php';
/*-----------執行動作判斷區----------*/
$op = Request::getString('op');
$WebID = Request::getInt('WebID');
$search_keyword = Request::getString('search_keyword');
common_template($WebID, $web_all_config);
switch ($op) {
//預設動作
default:
search_web($WebID, $search_keyword);
break;
}
/*-----------秀出結果區--------------*/
require_once __DIR__ . '/footer.php';
require_once XOOPS_ROOT_PATH . '/footer.php';
/*-----------function區--------------*/
//搜尋
function search_web($WebID = '', $search_keyword = '')
{
global $xoopsTpl, $plugin_menu_var, $web_all_config;
$web_plugin_enable_arr = $web_all_config['web_plugin_enable_arr'];
$web_plugin_arr = explode(',', $web_plugin_enable_arr);
$keyword_arr = explode(' ', $search_keyword);
$all_result = [];
foreach ($web_plugin_arr as $plugin) {
$plugin_name = $plugin_menu_var[$plugin]['title'];
if (file_exists(XOOPS_ROOT_PATH . "/modules/tad_web/plugins/{$plugin}/search.php")) {
require XOOPS_ROOT_PATH . "/modules/tad_web/plugins/{$plugin}/search.php";
$all_result[$plugin_name] = call_user_func("{$plugin}_search", $WebID, $keyword_arr, '10');
}
}
// Utility::dd($menu_var);
$xoopsTpl->assign('all_result', $all_result);
$xoopsTpl->assign('WebID', $WebID);
$xoopsTpl->assign('search_keyword', $search_keyword);
}