-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinclude.php
80 lines (64 loc) · 2.67 KB
/
include.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
<?php
//no direct file access
if(count(get_included_files()) ==1){$z="HTTP/1.0 404 Not Found";header($z);die($z);}
// this is by far the worst Hack i ever done
// This complete idiotic piece of code needs $admin but is a frontend module !!!
// Who ever programmed this piece of shit in first place must be completely braindead !!!
// UNBELIEVABLE!!!!
$admin=&$wb;
function language_menu($ext='txt') {
// Work-out we should check for existing page_code
if (defined('PAGE_LANGUAGES') && (PAGE_LANGUAGES==true)) {
global $database;
if (!preg_match("/jpg|png|gif|txt|TXT/", $ext)) $ext='txt';
include_once __DIR__.'/lang.functions.php';
include_once(get_module_language_file(basename(dirname(__FILE__))));
$langIcons = array();
echo '<div id="langmenu">'.PHP_EOL;
$langIcons = set_language_icon(PAGE_ID, $ext);
if( sizeof($langIcons) > 1 ) {
foreach( $langIcons as $key=>$value ) {
print $value;
}
}
print "\t".'</div>'.PHP_EOL;
}
return true;
}
function language_array() {
// Work-out we should check for existing page_code
if (defined('PAGE_LANGUAGES') && (PAGE_LANGUAGES==true)) {
global $database;
include_once __DIR__.'/lang.functions.php';
include_once(get_module_language_file(basename(dirname(__FILE__))));
$aList = set_language_array(PAGE_ID);
}
return $aList;
}
/**
@brief Display googles hreflang links
@param bool $output Echo content on true , return content on false
@param bool $show_recent Show recent Page [true|false]
@param bool $show_x_default Show x-default [true|false]
@return string Returns generated lines only on $output===true
*/
function language_hreflang ($output=true, $show_recent=true, $show_x_default=true){
// Used for prefered Render type HTML5 or XHTML ...
$end_tag=" /";
if (defined('WB_RENDER')) $Render=WB_RENDER;
if ($this->Render!="xhtml") $end_tag=" ";
// output var
$out="\n";
if ($show_x_default==true) {
$out.="\t\t".'<link rel="alternate" hreflang="x-default" href="'.WB_URL.'" '.$end_tag.'>'.PHP_EOL;
}
// Lets walk the language array
$aLangLinks = language_array();
foreach($aLangLinks as $key=>$link){
// If recent Language schould not be linked
if($show_recent!==true AND LANGUAGE == $key ) continue;
$out.="\t\t".'<link rel="alternate" hreflang="'.strtolower($key).'" href="'.$link['url'].'" '.$end_tag.'>'.PHP_EOL;
}
if ($output===true) echo $out;
else return $out;
}