Changeset 8653


Ignore:
Timestamp:
Jan 13, 2011, 11:37:05 PM (9 years ago)
Author:
rub
Message:

Fix Arabic language
Fix picture buttons without social plugin

Location:
extensions/FacebookPlug/Plugin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/FacebookPlug/Plugin/include/header.inc.php

    r8448 r8653  
    2929
    3030  // Array compute by plugins/FacebookPlug/tools/check_language.php script
    31   $valid_fb_locales = array ( 0 => 'ca_ES', 1 => 'cs_CZ', 2 => 'da_DK', 3 => 'de_DE', 4 => 'es_ES', 5 => 'fa_IR', 6 => 'fr_CA', 7 => 'fr_FR', 8 => 'he_IL', 9 => 'hr_HR', 10 => 'hu_HU', 11 => 'it_IT', 12 => 'ja_JP', 13 => 'ka_GE', 14 => 'lv_LV', 15 => 'mk_MK', 16 => 'nl_NL', 17 => 'pl_PL', 18 => 'pt_BR', 19 => 'pt_PT', 20 => 'ro_RO', 21 => 'ru_RU', 22 => 'sk_SK', 23 => 'sr_RS', 24 => 'sv_SE', 25 => 'tr_TR', 26 => 'vi_VN', 27 => 'zh_CN', );
     31  $valid_fb_locales = array ( 0 => 'ar_AR', 1 => 'ca_ES', 2 => 'cs_CZ', 3 => 'da_DK', 4 => 'de_DE', 5 => 'es_ES', 6 => 'fa_IR', 7 => 'fr_CA', 8 => 'fr_FR', 9 => 'he_IL', 10 => 'hr_HR', 11 => 'hu_HU', 12 => 'it_IT', 13 => 'ja_JP', 14 => 'ka_GE', 15 => 'lv_LV', 16 => 'mk_MK', 17 => 'nl_NL', 18 => 'pl_PL', 19 => 'pt_BR', 20 => 'pt_PT', 21 => 'ro_RO', 22 => 'ru_RU', 23 => 'sk_SK', 24 => 'sr_RS', 25 => 'sv_SE', 26 => 'tr_TR', 27 => 'vi_VN', 28 => 'zh_CN', );
    3232
    3333  // User language
    34   $language = $user['language'];
    35   if (! in_array($language, $valid_fb_locales))
    36   {
    37     $code_lang = substr($language, 0, 2);
    38     // Compose a language
    39     $language = $code_lang.'_'.strtoupper($code_lang);
    40     if (! in_array($language, $valid_fb_locales))
    41     {
    42       // Search a language
     34  $locale = $user['language'];
     35  if (! in_array($locale, $valid_fb_locales))
     36  {
     37    $code_lang = substr($locale, 0, 2);
     38    // Compose a locale
     39    $locale = $code_lang.'_'.strtoupper($code_lang);
     40    if (! in_array($locale, $valid_fb_locales))
     41    {
     42      // Search a locale
    4343      foreach ($valid_fb_locales as $valid_fb_locale)
    4444      {
     
    4848        }
    4949      }
    50       // default language
    51       $language = 'en_US';
    52     }
    53   }
    54 
    55   return $language;
     50      // default locale
     51      $locale = 'en_US';
     52    }
     53  }
     54
     55  return $locale;
    5656}
    5757
  • extensions/FacebookPlug/Plugin/include/picture.inc.php

    r8440 r8653  
    3030  if ($page['fbp']['do_facebook_init'])
    3131  {
    32     // Header for each page
    33     //~ $tpls[] = 'picture.header';
     32    // Init array
     33    $tpls = array();
    3434
    3535    // Specific
  • extensions/FacebookPlug/Plugin/tools/check_language.php

    r8435 r8653  
    3131  if (!is_link($path) and is_dir($path) and file_exists($path.'/iso.txt'))
    3232  {
    33     echo '<br />'.$file.'<br />'.'-------'.'<br />';
    34     $file_connect = 'http://connect.facebook.net/'.$file.'/all.js';
    35     echo $file_connect.'<br />';
     33    $locale = $file;
     34    $languages['list'][] = $locale;
    3635
    37     $content = @file_get_contents($file_connect);
    38     if ($content !== false and ! preg_match('/is not a valid locale/', $content))
    39     {
    40       echo 'ok'.'<br />';
    41       $languages['ok'][] = $file;
    42     }
    43     else
    44     {
    45       echo 'ko'.'<br />';
    46       $languages['ko'][] = $file;
    47     }
     36    $code_lang = substr($locale, 0, 2);
     37    // Compose a locale
     38    $locale = $code_lang.'_'.strtoupper($code_lang);
     39    $languages['list'][] = $locale;
    4840  }
    4941}
    5042closedir($dir);
     43
     44foreach (array_unique($languages['list']) as $locale)
     45{
     46  echo '<br />'.$locale.'<br />'.'-------'.'<br />';
     47  $locale_connect = 'http://connect.facebook.net/'.$locale.'/all.js';
     48  echo $locale_connect.'<br />';
     49
     50  $content = @file_get_contents($locale_connect);
     51  if ($content !== false and ! preg_match('/is not a valid locale/', $content))
     52  {
     53    echo 'ok'.'<br />';
     54    $languages['ok'][] = $locale;
     55  }
     56  else
     57  {
     58    echo 'ko'.'<br />';
     59    $languages['ko'][] = $locale;
     60  }
     61}
     62
    5163@asort($languages['ok']);
    5264@asort($languages['ko']);
Note: See TracChangeset for help on using the changeset viewer.