57 $sTempQuery = (defined(
"PAGE_ID"))
58 ?
"SELECT * FROM ".TABLE_PREFIX.
"pages WHERE `page_id` = ". PAGE_ID.
" "
59 :
"SELECT * FROM ".TABLE_PREFIX.
"pages WHERE `page_code` = 'home' "
71 $lang = $aPage[
"language" ];
72 $code = $aPage[
"page_code" ];
73 $langarr[ $lang ] =
"";
74 $classarr[ $lang ] =
"easymultilang_current";
76 elseif ( isset( $_SESSION[
'LANGUAGE' ] ) && strlen( $_SESSION[
'LANGUAGE' ] ) == 2 )
90 if ( $code ==
"none" )
98 "SELECT * FROM ".TABLE_PREFIX.
"pages WHERE page_code = 'home' and language = '".$lang.
"' ",
104 if (!empty($aPageHome))
106 foreach ($aPageHome as $cp)
108 $l = $cp[
"language" ];
109 $langarr[ $l ] = $cp[
"link" ];
110 if($classarr[ $l ] !=
"easymultilang_current")
112 $classarr[ $l ] =
"easymultilang";
119 "SELECT * FROM ".TABLE_PREFIX.
"pages WHERE page_code = '".$code.
"' and language != '".$lang.
"' AND visibility != 'none' ",
125 if (!empty($aCurrentPage))
127 foreach ($aCurrentPage as $cp)
129 $l = $cp[
"language" ];
130 $langarr[ $l ] = $cp[
"link" ];
131 $classarr[ $l ] =
"easymultilang";
142 foreach ( $langarr as $key => $value )
144 $real_language =
$database->get_one(
"SELECT name FROM " . TABLE_PREFIX .
"addons where type = 'language' and directory = '".$key.
"' ");
145 $return_array[$key] = array(
147 'language'=>$real_language
150 return $return_array;
155 foreach ( $langarr as $key => $value )
159 "SELECT * FROM ".TABLE_PREFIX.
"addons WHERE type = 'language' and directory = '".$key.
"' ",
165 if (!empty($aResult))
167 $txt = $aResult[
"name" ];
168 $link = LEPTON_URL . PAGES_DIRECTORY . $value .
".php?lang=$key";
169 if (file_exists(LEPTON_PATH .
"/modules/lib_lepton/flags/custom/" . strtolower( $key ) .
".png"))
171 $flag = LEPTON_URL .
"/modules/lib_lepton/flags/custom/" . strtolower( $key ) .
".png";
175 $flag = LEPTON_URL .
"/modules/lib_lepton/flags/" . strtolower( $key ) .
".png";
179 'CLASS' => $classarr[ $key ],
184 if ( $classarr[ $key ] ==
"easymultilang_current" )
186 $values[
'ASTART' ] =
'';
187 $values[
'AEND' ] =
'';
191 $values[
'ASTART' ] =
"<a href='$link' title='$txt'>";
192 $values[
'AEND' ] =
'</a>';
194 $aMenuValues[] = $values;
200 $sMenuTemplateFile = LEPTON_PATH.
"/templates/".DEFAULT_TEMPLATE.
"/frontend/easymultilang/menu.lte";
201 if(file_exists( $sMenuTemplateFile ))
204 $oTWIG = lib_twig_box::getInstance();
205 $oTWIG->registerPath( LEPTON_PATH.
"/templates/".DEFAULT_TEMPLATE.
"/frontend/easymultilang/",
"easymultilang");
206 $html = $oTWIG->render(
207 "@easymultilang/menu.lte",
209 "allMenuItems" => $aMenuValues
217 $html_template_str =
"\n<span class='{{ CLASS }}'>{{ ASTART }}<img src='{{ IMG }}' alt='{{ TXT }}' /> {{ TXT }}{{ AEND }}</span>";
219 foreach($aMenuValues as &$ref)
221 $sTempLine = $html_template_str;
222 foreach($ref as $key=>$value)
224 $sTempLine = str_replace(
"{{ ".$key.
" }}", $value, $sTempLine);