-
Notifications
You must be signed in to change notification settings - Fork 4
/
e_sitelink.php
105 lines (72 loc) · 1.77 KB
/
e_sitelink.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/*
* e107 website system
* Multiple Languages Plugin for e107.
* Copyright (C) 2015 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*/
if (!defined('e107_INIT')) { exit; }
if(!e107::isInstalled('multilan'))
{
return;
}
class multilan_sitelink // include plugin-folder in the name.
{
function config()
{
$links = array();
$links[] = array(
'name' => "Language Links",
'function' => "language"
);
return $links;
}
function language()
{
$tp = e107::getParser();
$sublinks = array();
$lng = e107::getLanguage();
$data = $lng->installed('native');
$activeLangs = e107::pref('multilan','language_navigation');
$flags = e107::pref('multilan','language_nav_dropflag', false);
foreach($data as $ln=>$name)
{
if($lng->isValid($ln))
{
$redirect = deftrue("MULTILANG_SUBDOMAIN") ? $lng->subdomainUrl($ln) : e_SELF."?elan=".$ln;
// $name = $lng->toNative($ln);
$iso = $lng->convert($ln);
if(!isset($activeLangs[$ln]) || empty($activeLangs[$ln]))
{
if(!ADMIN)
{
continue;
}
else
{
$name .= " (hidden)";
}
}
$sublinks[] = array(
'link_name' => $tp->toHTML($name,'','TITLE'),
'link_url' => $redirect,
'link_description' => $ln,
'link_button' => ($flags) ? $this->getFlag($iso, $ln) : '',
'link_category' => '',
'link_order' => '',
'link_parent' => '',
'link_open' => '',
'link_class' => e_UC_PUBLIC,
'link_active' => (e_LANGUAGE == $ln) ? 1 : 0,
);
// break;
}
}
return $sublinks;
}
private function getFlag($lan, $language)
{
return "<i class='multilan flag-".$lan."'></i>";
}
}