forked from e107inc/multilan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
e_footer.php
86 lines (59 loc) · 2.6 KB
/
e_footer.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
<?php
// https://msdn.microsoft.com/en-us/library/dn735968.aspx
// https://msdn.microsoft.com/en-us/library/dn341982.aspx
$sitelanguage = e107::getPref('sitelanguage');
$mpref = e107::pref('multilan');
if(USER_AREA === true && ($sitelanguage == e_LANGUAGE) && !empty($mpref['bing_translator']))
{
if(!empty($mpref['bing_exclude_installed']))
{
$lng = e107::getLanguage();
$installedLanguages = $lng->installed();
$iso = array();
foreach($installedLanguages as $lang)
{
$iso[] = $lng->convert($lang);
}
$hidden = implode(",",$iso); // exclude installed languages.
}
else
{
$hidden = '';
}
$from = e_LAN;
$loc = deftrue("MULTILAN_BING_LANGUAGE", '');
// $loc = '';
$setting = $mpref['bing_translator'];
//<div id='MicrosoftTranslatorWidget' class='Dark' style='color:white;background-color:#555555'></div>
if(!empty($mpref['bing_map_to_subdomain']) || e_SUBDOMAIN == 'fr')
{
e107::js('footer', 'http://www.microsoftTranslator.com/ajax/v3/WidgetV3.ashx?siteData=ueOIGRSKkd965FeEGM5JtQ**');
e107::js('footer-inline', "
document.onreadystatechange = function () {
if (document.readyState == 'complete') {
Microsoft.Translator.Widget.Translate('".e_LAN."', '".e_SUBDOMAIN."', onProgress, onError, onComplete, onRestoreOriginal);
}
}
//You can use Microsoft.Translator.Widget.GetLanguagesForTranslate to map the language code with the language name
function onProgress(value) {
document.getElementById('counter').innerHTML = Math.round(value);
}
function onError(error) {
alert('Translation Error: ' + error);
}
function onComplete() {
}
//fires when the user clicks on the exit box of the floating widget
function onRestoreOriginal() {
alert('The page was reverted to the original language. This message is not part of the widget.');
}
");
}
else
{
$auto = "setTimeout(function(){{var s=document.createElement('script');s.type='text/javascript';s.charset='UTF-8';s.src=((location && location.href && location.href.indexOf('https') == 0)?'https://ssl.microsofttranslator.com':'http://www.microsofttranslator.com')+'/ajax/v3/WidgetV3.ashx?siteData=ueOIGRSKkd965FeEGM5JtQ**&ctf=False&ui=false&settings=".$setting."&loc=".$loc."&from=".$from."&hidelanguages=".$hidden."';var p=document.getElementsByTagName('head')[0]||document.documentElement;p.insertBefore(s,p.firstChild); }},0);";
e107::js('footer-inline', $auto);
unset($auto);
}
}
// http://www.spherebeingalliance.com/?__mstto=th