/
i18n.search.catlist.php
57 lines (52 loc) · 1.26 KB
/
i18n.search.catlist.php
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
54
55
56
57
<?php
/* ====================
[BEGIN_COT_EXT]
Hooks=search.page.catlist
[END_COT_EXT]
==================== */
/**
* Inserts translated categories into search category list
*
* @package i18n
* @version 0.7.0
* @author Cotonti Team
* @copyright Copyright (c) Cotonti Team 2010-2012
* @license BSD License
*/
defined('COT_CODE') or die('Wrong URL');
if (is_array($i18n_structure) && count($i18n_structure) > 0)
{
// Add translated categories into the multiselect
foreach ($i18n_structure as $cat => $row)
{
if (isset($pages_cat_list[$cat]))
{
// Permissions to main category already checked
foreach ($row as $lc => $x)
{
$pages_cat_list[$cat.':'.$lc] = cot_breadcrumbs(cot_i18n_build_catpath('page', $cat, $lc), false, true, true);
}
}
}
// Extract previously selected options, they are handled separately
$i18n_search_cats = array();
if (is_array($rsearch['pag']['sub']))
{
$subcnt = count($rsearch['pag']['sub']);
$tmp = array();
for ($i = 0; $i < $subcnt; $i++)
{
if (mb_strpos($rsearch['pag']['sub'][$i], ':') !== false)
{
list ($cat, $lc) = explode(':', $rsearch['pag']['sub'][$i]);
$i18n_search_cats[$lc][] = $cat;
}
else
{
$tmp[] = $rsearch['pag']['sub'][$i];
}
}
$rsearch['pag']['sub'] = $tmp;
}
}
?>