-
Notifications
You must be signed in to change notification settings - Fork 4
/
e_shortcode.php
73 lines (50 loc) · 1.33 KB
/
e_shortcode.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
<?php
/*
* Copyright (C) 2008-2013 e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
*
* Siteinfo shortcode batch
*/
if (!defined('e107_INIT')) { exit; }
class multilan_shortcodes extends e_shortcode // must match the folder name of the plugin.
{
function sc_multilan_nav($parm=null)
{
if(empty($parm))
{
$parm = 'main';
}
$lng = e107::getLanguage();
$activeLangs = e107::pref('multilan','language_navigation');
$languageList = $lng->installed('native');
if(count($languageList) < 2)
{
return '';
}
$ret = array();
foreach($languageList as $languageFolder=>$natName)
{
$name = $natName;
$class = ($languageFolder == e_LANGUAGE) ? ' class="disabled"' : '';
if(!isset($activeLangs[$languageFolder]) || empty($activeLangs[$languageFolder]))
{
if(!ADMIN)
{
continue;
}
else
{
$class = ' class="multilan-hidden"';
}
}
$code = $lng->convert($languageFolder);
$link = deftrue("MULTILANG_SUBDOMAIN") ? $lng->subdomainUrl($languageFolder) : e_SELF."?elan=".$code;
$ret[] = "<li role='presentation' {$class}><a href='{$link}'>{$name}</a></li>";
}
if(!empty($ret))
{
$class = "multilan-nav-".$parm;
return '<ul class="multilan-nav '.$class.' nav nav-justified" >'.implode("\n", $ret).'</ul>';
}
return '';
}
}