ajayver

Untitled

Jul 2nd, 2014
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.20 KB | None | 0 0
  1. <?php
  2. global $smof_data;
  3. if ($smof_data['header_language_type'] == 'WPML language switcher' AND function_exists('icl_get_languages'))
  4. {
  5.     $languages = icl_get_languages('skip_missing=0');
  6.     if(1 < count($languages)){
  7. ?>
  8.     <div class="w-lang layout_dropdown show_onclick has_title">
  9.         <div class="w-lang-list">
  10.             <?php foreach ($languages as $language) {
  11.                 if ($language['active'])
  12.                 {
  13.                     $current_language = $language;
  14.                     continue;
  15.                 }
  16.             ?>
  17.             <a class="w-lang-item lang_<?php echo $language['language_code'] ?>" href="<?php echo $language['url'] ?>">
  18.                 <span class="w-lang-item-icon"><img src="<?php echo $language['country_flag_url'] ?>" alt=""></span>
  19.                 <span class="w-lang-item-title"><?php echo ($language['native_name']) ?></span>
  20.             </a>
  21.             <?php } ?>
  22.         </div>
  23.         <div class="w-lang-current">
  24.             <span class="w-lang-item">
  25.                 <span class="w-lang-item-icon"><img src="<?php echo $current_language['country_flag_url'] ?>" alt=""></span>
  26.                 <span class="w-lang-item-title"><?php echo ($current_language['native_name']) ?></span>
  27.             </span>
  28.         </div>
  29.     </div>
  30.     <style>
  31.         .w-lang.has_title .w-lang-item-icon {
  32.             display: inline-block;
  33.         }
  34.         .w-lang-item-icon {
  35.             height: 22px;
  36.             margin-right: 5px;
  37.         }
  38.         .w-lang-current .w-lang-item-icon {
  39.             height: 26px;
  40.         }
  41.     </style>
  42. <?php //print_r($current_language);
  43.     }
  44. }
  45. elseif ($smof_data['header_language_type'] == 'Your own links')
  46. {
  47. ?>
  48.     <div class="w-lang layout_dropdown show_onclick has_title">
  49.         <div class="w-lang-list">
  50.             <?php for ($i = 2; $i <= $smof_data['header_language_amount']; $i++) {
  51.                 ?>
  52.                 <a class="w-lang-item lang_en" href="<?php echo (substr($smof_data['header_language_'.$i.'_url'], 0, 4) == 'http')?$smof_data['header_language_'.$i.'_url']:'//'.$smof_data['header_language_'.$i.'_url']; ?>">
  53.                     <span class="w-lang-item-icon"></span>
  54.                     <span class="w-lang-item-title"><?php echo $smof_data['header_language_'.$i.'_name'] ?></span>
  55.                 </a>
  56.             <?php } ?>
  57.         </div>
  58.         <div class="w-lang-current">
  59.             <span class="w-lang-item">
  60.                 <span class="w-lang-item-icon"></span>
  61.                 <span class="w-lang-item-title"><?php echo $smof_data['header_language_1_name'] ?></span>
  62.             </span>
  63.         </div>
  64.     </div>
  65. <?php
  66. }
Advertisement
Add Comment
Please, Sign In to add comment