Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

383
 
410
 
410
 
language.php
_> 11 <?php
  22 /*
<> 3 -  $Id: language.php 383 2006-01-09 16:35:46Z hpdl $
   3+  $Id: language.php 410 2006-01-26 09:17:09Z hpdl $
44 
  55   osCommerce, Open Source E-Commerce Solutions
  66   http://www.oscommerce.com
     
 !
1414 
  1515 /* Private variables */
  1616     var $_code,
<> 17 -        $_languages = array();
   17+        $_languages = array(),
   18+        $_definitions = array();
1819 
  1920 /* Class constructor */
  2021 
     
 !
2930       while ($Qlanguages->next()) {
  3031         $this->_languages[$Qlanguages->value('code')] = array('id' => $Qlanguages->valueInt('languages_id'),
  3132                                                               'name' => $Qlanguages->value('name'),
<>  33+                                                              'locale' => $Qlanguages->value('locale'),
   34+                                                              'charset' => $Qlanguages->value('charset'),
   35+                                                              'date_format_short' => $Qlanguages->value('date_format_short'),
   36+                                                              'date_format_long' => $Qlanguages->value('date_format_long'),
   37+                                                              'time_format' => $Qlanguages->value('time_format'),
   38+                                                              'text_direction' => $Qlanguages->value('text_direction'),
3239                                                               'image' => $Qlanguages->value('image'),
<> 33 -                                                              'directory' => $Qlanguages->value('directory'));
   40+                                                              'currencies_id' => $Qlanguages->valueInt('currencies_id'),
   41+                                                              'numeric_separator_decimal' => $Qlanguages->value('numeric_separator_decimal'),
   42+                                                              'numeric_separator_thousands' => $Qlanguages->value('numeric_separator_thousands'));
3443       }
  3544 
  3645       $Qlanguages->freeResult();
     
 !
4049 
  4150 /* Public methods */
  4251 
<>  52+    function load($key) {
   53+      global $osC_Database;
   54+
   55+      $Qdef = $osC_Database->query('select * from :table_languages_definitions where languages_id = :languages_id and content_group = :content_group');
   56+      $Qdef->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
   57+      $Qdef->bindInt(':languages_id', $this->getID());
   58+      $Qdef->bindValue(':content_group', $key);
   59+      $Qdef->setCache('languages-' . $this->_code . '-' . $key);
   60+      $Qdef->execute();
   61+
   62+      while ($Qdef->next()) {
   63+        $this->_definitions[$Qdef->value('definition_key')] = $Qdef->value('definition_value');
   64+      }
   65+
   66+      $Qdef->freeResult();
   67+    }
   68+
   69+    function get($key) {
   70+      if (isset($this->_definitions[$key])) {
   71+        return $this->_definitions[$key];
   72+      }
   73+
   74+      return $key;
   75+    }
   76+
4377     function set($code = '') {
  4478       $this->_code = $code;
  4579 
     
 !
128162       return $this->_languages;
  129163     }
  130164 
<>  165+    function getData($key, $language = '') {
   166+      if (empty($language)) {
   167+        $language = $this->_code;
   168+      }
   169+
   170+      return $this->_languages[$language][$key];
   171+    }
   172+
   173+    function getCodeFromID($id) {
   174+      foreach ($this->_languages as $code => $lang) {
   175+        if ($lang['id'] == $id) {
   176+          return $code;
   177+        }
   178+      }
   179+    }
   180+
131181     function getID() {
  132182       return $this->_languages[$this->_code]['id'];
  133183     }
     
 !
140190       return $this->_code;
  141191     }
  142192 
<>  193+    function getLocale() {
   194+      return $this->_languages[$this->_code]['locale'];
   195+    }
   196+
   197+    function getCharacterSet() {
   198+      return $this->_languages[$this->_code]['charset'];
   199+    }
   200+
   201+    function getDateFormatShort() {
   202+      return $this->_languages[$this->_code]['date_format_short'];
   203+    }
   204+
   205+    function getDateFormatLong() {
   206+      return $this->_languages[$this->_code]['date_format_long'];
   207+    }
   208+
   209+    function getTimeFormat() {
   210+      return $this->_languages[$this->_code]['time_format'];
   211+    }
   212+
   213+    function getTextDirection() {
   214+      return $this->_languages[$this->_code]['text_direction'];
   215+    }
   216+
143217     function getImage() {
  144218       return $this->_languages[$this->_code]['image'];
  145219     }
  146220 
<> 147 -    function getDirectory() {
  148 -      return $this->_languages[$this->_code]['directory'];
   221+    function getCurrencyID() {
   222+      return $this->_languages[$this->_code]['currencies_id'];
149223     }
  150224 
<> 151 -    function load($definition = false) {
  152 -      if (is_string($definition)) {
  153 -        include('includes/languages/' . $this->getDirectory() . '/' . $definition);
  154 -      } else {
  155 -        include('includes/languages/' . $this->getDirectory() . '.php');
  156 -      }
   225+    function getNumericDecimalSeparator() {
   226+      return $this->_languages[$this->_code]['numeric_separator_decimal'];
157227     }
<>  228+
   229+    function getNumericThousandsSeparator() {
   230+      return $this->_languages[$this->_code]['numeric_separator_thousands'];
   231+    }
<_ 158232   }
  159233 ?>