cvs: pear /Translation2 Container.php /Translation2/Container dataobjectsimple.php db.php gettext.php mdb.php mdb2.php xml.php
| From: | Lorenzo Alberton | Date: | Tue, 14 Dec 2004 20:03:34 +0000 |
| Subject: | cvs: pear /Translation2 Container.php /Translation2/Container dataobjectsimple.php db.php gettext.php mdb.php mdb2.php xml.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-27397@lists.php.net to get a copy of this message | ||
quipo Tue Dec 14 15:03:34 2004 EDT
Modified files:
/pear/Translation2 Container.php
/pear/Translation2/Container dataobjectsimple.php db.php
gettext.php mdb.php mdb2.php xml.php
Log:
added _getLangID() method. Raise an error if no valid $langID was specified AND setLang() was
never called
http://cvs.php.net/diff.php/pear/Translation2/Container.php?r1=1.10&r2=1.11&ty=u Index: pear/Translation2/Container.php diff -u pear/Translation2/Container.php:1.10 pear/Translation2/Container.php:1.11 --- pear/Translation2/Container.php:1.10 Tue Nov 16 15:21:35 2004 +++ pear/Translation2/Container.php Tue Dec 14 15:03:31 2004 @@ -16,11 +16,11 @@ // | Authors: Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: Container.php,v 1.10 2004/11/16 20:21:35 quipo Exp $ +// $Id: Container.php,v 1.11 2004/12/14 20:03:31 quipo Exp $ // /** * @package Translation2 - * @version $Id: Container.php,v 1.10 2004/11/16 20:21:35 quipo Exp $ + * @version $Id: Container.php,v 1.11 2004/12/14 20:03:31 quipo Exp $ */ /** @@ -84,6 +84,27 @@ } // }}} + // {{{ _getLangID() + + /** + * Get a valid langID or raise an error when + * + * @access private + * @param string $langID + */ + function _getLangID($langID) + { + if (!empty($langID)) { + return $langID; + } + if (!empty($this->currentLang['id'])) { + return $this->currentLang['id']; + } + $msg = 'No valid language set. Use Translation2::setLang().'; + return $this->raiseError($msg, TRANSLATION2_ERROR_UNKNOWN_LANG); + } + + // }}} // {{{ setLang() /** http://cvs.php.net/diff.php/pear/Translation2/Container/dataobjectsimple.php?r1=1.8&r2=1.9&ty=u Index: pear/Translation2/Container/dataobjectsimple.php diff -u pear/Translation2/Container/dataobjectsimple.php:1.8 pear/Translation2/Container/dataobjectsimple.php:1.9 --- pear/Translation2/Container/dataobjectsimple.php:1.8 Wed Oct 20 10:51:18 2004 +++ pear/Translation2/Container/dataobjectsimple.php Tue Dec 14 15:03:33 2004 @@ -16,11 +16,11 @@ // | Author: Alan Knowles <alan@akbkhome.com> | // +----------------------------------------------------------------------+ // -// $Id: dataobjectsimple.php,v 1.8 2004/10/20 14:51:18 quipo Exp $ +// $Id: dataobjectsimple.php,v 1.9 2004/12/14 20:03:33 quipo Exp $ // /** * @package Translation2 -* @version $Id: dataobjectsimple.php,v 1.8 2004/10/20 14:51:18 quipo Exp $ +* @version $Id: dataobjectsimple.php,v 1.9 2004/12/14 20:03:33 quipo Exp $ */ /** @@ -54,7 +54,7 @@ * by the PEAR DB abstraction layer to fetch data. * * @package Translation2 - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ */ class Translation2_Container_dataobjectsimple extends Translation2_Container { @@ -129,15 +129,13 @@ * @param string $langID * @return array */ - function &getPage($page = null, $lang = null) + function &getPage($pageID = null, $langID = null) { - if (is_null($langID)) { - $lang= $this->currentLang['id']; - } + $langID = $this->_getLangID($langID); $do = DB_DataObject::factory($this->options['table']); - $do->lang = $lang; - $do->page = $page; + $do->lang = $langID; + $do->page = $pageID; $do->find(); $strings = array(); @@ -159,13 +157,13 @@ * @param string $langID * @return string */ - function getOne($string, $page = null, $lang = null) + function getOne($string, $pageID = null, $langID = null) { - $lang = $lang ? $lang : (isset($this->currentLang['id']) ? $this->currentLang['id'] : '-'); + $langID = $langID ? $langID : (isset($this->currentLang['id']) ? $this->currentLang['id'] : '-'); // get the string id $do = DB_DataObject::factory($this->options['table']); $do->lang = '-'; - $do->page = $page; + $do->page = $pageID; $do->translation = $string; // we dont have the base language translation.. if (!$do->find(true)) { @@ -174,8 +172,8 @@ $stringID = $do->string_id; $do = DB_DataObject::factory($this->options['table']); - $do->lang = $lang; - $do->page = $page; + $do->lang = $langID; + $do->page = $pageID; $do->string_id = $stringID; //print_r($do); $do->selectAdd(); @@ -197,13 +195,13 @@ * @param string $pageID * @return string */ - function getStringID($string, $page = null) + function getStringID($string, $pageID = null) { // get the english version... $do = DB_DataObject::factory($this->options['table']); $do->lang = $this->currentLang['id']; - $do->page = $page; + $do->page = $pageID; $do->translation = $string; if ($do->find(true)) { return ''; http://cvs.php.net/diff.php/pear/Translation2/Container/db.php?r1=1.21&r2=1.22&ty=u Index: pear/Translation2/Container/db.php diff -u pear/Translation2/Container/db.php:1.21 pear/Translation2/Container/db.php:1.22 --- pear/Translation2/Container/db.php:1.21 Thu Nov 4 21:42:59 2004 +++ pear/Translation2/Container/db.php Tue Dec 14 15:03:33 2004 @@ -16,11 +16,11 @@ // | Author: Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: db.php,v 1.21 2004/11/05 02:42:59 ieure Exp $ +// $Id: db.php,v 1.22 2004/12/14 20:03:33 quipo Exp $ // /** * @package Translation2 - * @version $Id: db.php,v 1.21 2004/11/05 02:42:59 ieure Exp $ + * @version $Id: db.php,v 1.22 2004/12/14 20:03:33 quipo Exp $ */ /** @@ -35,7 +35,7 @@ * by the PEAR DB abstraction layer to fetch data. * * @package Translation2 - * @version $Revision: 1.21 $ + * @version $Revision: 1.22 $ */ class Translation2_Container_db extends Translation2_Container { @@ -170,9 +170,9 @@ */ function &getPage($pageID = null, $langID = null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $lang_col = $this->_getLangCol($langID); - $table = $this->_getLangTable($langID); + $table = $this->_getLangTable($langID); $query = sprintf('SELECT %s, %s FROM %s WHERE %s ', $this->options['string_id_col'], @@ -212,9 +212,9 @@ */ function getOne($stringID, $pageID = null, $langID = null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $lang_col = $this->_getLangCol($langID); - $table = $this->_getLangTable($langID); + $table = $this->_getLangTable($langID); $query = sprintf('SELECT %s FROM %s WHERE %s.%s = %s AND %s', $lang_col, http://cvs.php.net/diff.php/pear/Translation2/Container/gettext.php?r1=1.20&r2=1.21&ty=u Index: pear/Translation2/Container/gettext.php diff -u pear/Translation2/Container/gettext.php:1.20 pear/Translation2/Container/gettext.php:1.21 --- pear/Translation2/Container/gettext.php:1.20 Mon Dec 6 08:57:42 2004 +++ pear/Translation2/Container/gettext.php Tue Dec 14 15:03:33 2004 @@ -16,11 +16,11 @@ // | Author: Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: gettext.php,v 1.20 2004/12/06 13:57:42 mike Exp $ +// $Id: gettext.php,v 1.21 2004/12/14 20:03:33 quipo Exp $ // /** * @package Translation2 - * @version $Id: gettext.php,v 1.20 2004/12/06 13:57:42 mike Exp $ + * @version $Id: gettext.php,v 1.21 2004/12/14 20:03:33 quipo Exp $ */ /** @@ -38,7 +38,7 @@ * * @see /docs/gettext_readme.txt for an usage example * @package Translation2 - * @version $Revision: 1.20 $ + * @version $Revision: 1.21 $ */ class Translation2_Container_gettext extends Translation2_Container { @@ -132,9 +132,7 @@ */ function _switchLang($langID) { - if (!isset($langID)) { - $langID = $this->currentLang['id']; - } + $langID = $this->_getLangID($langID); $oldLang = $this->currentLang['id']; $this->setLang($langID); return $oldLang; http://cvs.php.net/diff.php/pear/Translation2/Container/mdb.php?r1=1.15&r2=1.16&ty=u Index: pear/Translation2/Container/mdb.php diff -u pear/Translation2/Container/mdb.php:1.15 pear/Translation2/Container/mdb.php:1.16 --- pear/Translation2/Container/mdb.php:1.15 Sun Nov 7 12:48:39 2004 +++ pear/Translation2/Container/mdb.php Tue Dec 14 15:03:33 2004 @@ -16,11 +16,11 @@ // | Author: Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: mdb.php,v 1.15 2004/11/07 17:48:39 quipo Exp $ +// $Id: mdb.php,v 1.16 2004/12/14 20:03:33 quipo Exp $ // /** * @package Translation2 - * @version $Id: mdb.php,v 1.15 2004/11/07 17:48:39 quipo Exp $ + * @version $Id: mdb.php,v 1.16 2004/12/14 20:03:33 quipo Exp $ */ /** @@ -35,7 +35,7 @@ * by the PEAR MDB abstraction layer to fetch data. * * @package Translation2 - * @version $Revision: 1.15 $ + * @version $Revision: 1.16 $ */ class Translation2_Container_mdb extends Translation2_Container { @@ -169,9 +169,9 @@ */ function &getPage($pageID = null, $langID = null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $lang_col = $this->_getLangCol($langID); - $table = $this->_getLangTable($langID); + $table = $this->_getLangTable($langID); $query = sprintf('SELECT %s, %s FROM %s WHERE %s ', $this->options['string_id_col'], @@ -212,9 +212,9 @@ */ function getOne($stringID, $pageID=null, $langID=null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $lang_col = $this->_getLangCol($langID); - $table = $this->_getLangTable($langID); + $table = $this->_getLangTable($langID); $query = sprintf('SELECT %s FROM %s WHERE %s.%s = %s AND %s', $lang_col, http://cvs.php.net/diff.php/pear/Translation2/Container/mdb2.php?r1=1.13&r2=1.14&ty=u Index: pear/Translation2/Container/mdb2.php diff -u pear/Translation2/Container/mdb2.php:1.13 pear/Translation2/Container/mdb2.php:1.14 --- pear/Translation2/Container/mdb2.php:1.13 Tue Nov 2 11:20:40 2004 +++ pear/Translation2/Container/mdb2.php Tue Dec 14 15:03:33 2004 @@ -16,11 +16,11 @@ // | Author: Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: mdb2.php,v 1.13 2004/11/02 16:20:40 quipo Exp $ +// $Id: mdb2.php,v 1.14 2004/12/14 20:03:33 quipo Exp $ // /** * @package Translation2 - * @version $Id: mdb2.php,v 1.13 2004/11/02 16:20:40 quipo Exp $ + * @version $Id: mdb2.php,v 1.14 2004/12/14 20:03:33 quipo Exp $ */ /** @@ -35,7 +35,7 @@ * by the PEAR MDB2 abstraction layer to fetch data. * * @package Translation2 - * @version $Revision: 1.13 $ + * @version $Revision: 1.14 $ */ class Translation2_Container_mdb2 extends Translation2_Container { @@ -169,9 +169,9 @@ */ function &getPage($pageID = null, $langID = null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $lang_col = $this->_getLangCol($langID); - $table = $this->_getLangTable($langID); + $table = $this->_getLangTable($langID); $query = sprintf('SELECT %s, %s FROM %s WHERE %s ', $this->options['string_id_col'], @@ -212,9 +212,9 @@ */ function getOne($stringID, $pageID = null, $langID = null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $lang_col = $this->_getLangCol($langID); - $table = $this->_getLangTable($langID); + $table = $this->_getLangTable($langID); $query = sprintf('SELECT %s FROM %s WHERE %s.%s = %s AND %s', $lang_col, http://cvs.php.net/diff.php/pear/Translation2/Container/xml.php?r1=1.2&r2=1.3&ty=u Index: pear/Translation2/Container/xml.php diff -u pear/Translation2/Container/xml.php:1.2 pear/Translation2/Container/xml.php:1.3 --- pear/Translation2/Container/xml.php:1.2 Fri Nov 19 11:55:43 2004 +++ pear/Translation2/Container/xml.php Tue Dec 14 15:03:33 2004 @@ -16,7 +16,7 @@ // | Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: xml.php,v 1.2 2004/11/19 16:55:43 quipo Exp $ +// $Id: xml.php,v 1.3 2004/12/14 20:03:33 quipo Exp $ // /** * @package Translation2 @@ -290,7 +290,7 @@ */ function getPage($pageID = null, $langID = null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $pageID = (is_null($pageID)) ? '#NULL' : $pageID; $pageID = (empty($pageID)) ? '#EMPTY' : $pageID; @@ -317,7 +317,7 @@ */ function getOne($stringID, $pageID = null, $langID = null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $pageID = (is_null($pageID)) ? '#NULL' : $pageID; return isset($this->_data['pages'][$pageID][$stringID][$langID])
http://cvs.php.net/diff.php/pear/Translation2/Container.php?r1=1.10&r2=1.11&ty=u Index: pear/Translation2/Container.php diff -u pear/Translation2/Container.php:1.10 pear/Translation2/Container.php:1.11 --- pear/Translation2/Container.php:1.10 Tue Nov 16 15:21:35 2004 +++ pear/Translation2/Container.php Tue Dec 14 15:03:31 2004 @@ -16,11 +16,11 @@ // | Authors: Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: Container.php,v 1.10 2004/11/16 20:21:35 quipo Exp $ +// $Id: Container.php,v 1.11 2004/12/14 20:03:31 quipo Exp $ // /** * @package Translation2 - * @version $Id: Container.php,v 1.10 2004/11/16 20:21:35 quipo Exp $ + * @version $Id: Container.php,v 1.11 2004/12/14 20:03:31 quipo Exp $ */ /** @@ -84,6 +84,27 @@ } // }}} + // {{{ _getLangID() + + /** + * Get a valid langID or raise an error when + * + * @access private + * @param string $langID + */ + function _getLangID($langID) + { + if (!empty($langID)) { + return $langID; + } + if (!empty($this->currentLang['id'])) { + return $this->currentLang['id']; + } + $msg = 'No valid language set. Use Translation2::setLang().'; + return $this->raiseError($msg, TRANSLATION2_ERROR_UNKNOWN_LANG); + } + + // }}} // {{{ setLang() /** http://cvs.php.net/diff.php/pear/Translation2/Container/dataobjectsimple.php?r1=1.8&r2=1.9&ty=u Index: pear/Translation2/Container/dataobjectsimple.php diff -u pear/Translation2/Container/dataobjectsimple.php:1.8 pear/Translation2/Container/dataobjectsimple.php:1.9 --- pear/Translation2/Container/dataobjectsimple.php:1.8 Wed Oct 20 10:51:18 2004 +++ pear/Translation2/Container/dataobjectsimple.php Tue Dec 14 15:03:33 2004 @@ -16,11 +16,11 @@ // | Author: Alan Knowles <alan@akbkhome.com> | // +----------------------------------------------------------------------+ // -// $Id: dataobjectsimple.php,v 1.8 2004/10/20 14:51:18 quipo Exp $ +// $Id: dataobjectsimple.php,v 1.9 2004/12/14 20:03:33 quipo Exp $ // /** * @package Translation2 -* @version $Id: dataobjectsimple.php,v 1.8 2004/10/20 14:51:18 quipo Exp $ +* @version $Id: dataobjectsimple.php,v 1.9 2004/12/14 20:03:33 quipo Exp $ */ /** @@ -54,7 +54,7 @@ * by the PEAR DB abstraction layer to fetch data. * * @package Translation2 - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ */ class Translation2_Container_dataobjectsimple extends Translation2_Container { @@ -129,15 +129,13 @@ * @param string $langID * @return array */ - function &getPage($page = null, $lang = null) + function &getPage($pageID = null, $langID = null) { - if (is_null($langID)) { - $lang= $this->currentLang['id']; - } + $langID = $this->_getLangID($langID); $do = DB_DataObject::factory($this->options['table']); - $do->lang = $lang; - $do->page = $page; + $do->lang = $langID; + $do->page = $pageID; $do->find(); $strings = array(); @@ -159,13 +157,13 @@ * @param string $langID * @return string */ - function getOne($string, $page = null, $lang = null) + function getOne($string, $pageID = null, $langID = null) { - $lang = $lang ? $lang : (isset($this->currentLang['id']) ? $this->currentLang['id'] : '-'); + $langID = $langID ? $langID : (isset($this->currentLang['id']) ? $this->currentLang['id'] : '-'); // get the string id $do = DB_DataObject::factory($this->options['table']); $do->lang = '-'; - $do->page = $page; + $do->page = $pageID; $do->translation = $string; // we dont have the base language translation.. if (!$do->find(true)) { @@ -174,8 +172,8 @@ $stringID = $do->string_id; $do = DB_DataObject::factory($this->options['table']); - $do->lang = $lang; - $do->page = $page; + $do->lang = $langID; + $do->page = $pageID; $do->string_id = $stringID; //print_r($do); $do->selectAdd(); @@ -197,13 +195,13 @@ * @param string $pageID * @return string */ - function getStringID($string, $page = null) + function getStringID($string, $pageID = null) { // get the english version... $do = DB_DataObject::factory($this->options['table']); $do->lang = $this->currentLang['id']; - $do->page = $page; + $do->page = $pageID; $do->translation = $string; if ($do->find(true)) { return ''; http://cvs.php.net/diff.php/pear/Translation2/Container/db.php?r1=1.21&r2=1.22&ty=u Index: pear/Translation2/Container/db.php diff -u pear/Translation2/Container/db.php:1.21 pear/Translation2/Container/db.php:1.22 --- pear/Translation2/Container/db.php:1.21 Thu Nov 4 21:42:59 2004 +++ pear/Translation2/Container/db.php Tue Dec 14 15:03:33 2004 @@ -16,11 +16,11 @@ // | Author: Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: db.php,v 1.21 2004/11/05 02:42:59 ieure Exp $ +// $Id: db.php,v 1.22 2004/12/14 20:03:33 quipo Exp $ // /** * @package Translation2 - * @version $Id: db.php,v 1.21 2004/11/05 02:42:59 ieure Exp $ + * @version $Id: db.php,v 1.22 2004/12/14 20:03:33 quipo Exp $ */ /** @@ -35,7 +35,7 @@ * by the PEAR DB abstraction layer to fetch data. * * @package Translation2 - * @version $Revision: 1.21 $ + * @version $Revision: 1.22 $ */ class Translation2_Container_db extends Translation2_Container { @@ -170,9 +170,9 @@ */ function &getPage($pageID = null, $langID = null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $lang_col = $this->_getLangCol($langID); - $table = $this->_getLangTable($langID); + $table = $this->_getLangTable($langID); $query = sprintf('SELECT %s, %s FROM %s WHERE %s ', $this->options['string_id_col'], @@ -212,9 +212,9 @@ */ function getOne($stringID, $pageID = null, $langID = null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $lang_col = $this->_getLangCol($langID); - $table = $this->_getLangTable($langID); + $table = $this->_getLangTable($langID); $query = sprintf('SELECT %s FROM %s WHERE %s.%s = %s AND %s', $lang_col, http://cvs.php.net/diff.php/pear/Translation2/Container/gettext.php?r1=1.20&r2=1.21&ty=u Index: pear/Translation2/Container/gettext.php diff -u pear/Translation2/Container/gettext.php:1.20 pear/Translation2/Container/gettext.php:1.21 --- pear/Translation2/Container/gettext.php:1.20 Mon Dec 6 08:57:42 2004 +++ pear/Translation2/Container/gettext.php Tue Dec 14 15:03:33 2004 @@ -16,11 +16,11 @@ // | Author: Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: gettext.php,v 1.20 2004/12/06 13:57:42 mike Exp $ +// $Id: gettext.php,v 1.21 2004/12/14 20:03:33 quipo Exp $ // /** * @package Translation2 - * @version $Id: gettext.php,v 1.20 2004/12/06 13:57:42 mike Exp $ + * @version $Id: gettext.php,v 1.21 2004/12/14 20:03:33 quipo Exp $ */ /** @@ -38,7 +38,7 @@ * * @see /docs/gettext_readme.txt for an usage example * @package Translation2 - * @version $Revision: 1.20 $ + * @version $Revision: 1.21 $ */ class Translation2_Container_gettext extends Translation2_Container { @@ -132,9 +132,7 @@ */ function _switchLang($langID) { - if (!isset($langID)) { - $langID = $this->currentLang['id']; - } + $langID = $this->_getLangID($langID); $oldLang = $this->currentLang['id']; $this->setLang($langID); return $oldLang; http://cvs.php.net/diff.php/pear/Translation2/Container/mdb.php?r1=1.15&r2=1.16&ty=u Index: pear/Translation2/Container/mdb.php diff -u pear/Translation2/Container/mdb.php:1.15 pear/Translation2/Container/mdb.php:1.16 --- pear/Translation2/Container/mdb.php:1.15 Sun Nov 7 12:48:39 2004 +++ pear/Translation2/Container/mdb.php Tue Dec 14 15:03:33 2004 @@ -16,11 +16,11 @@ // | Author: Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: mdb.php,v 1.15 2004/11/07 17:48:39 quipo Exp $ +// $Id: mdb.php,v 1.16 2004/12/14 20:03:33 quipo Exp $ // /** * @package Translation2 - * @version $Id: mdb.php,v 1.15 2004/11/07 17:48:39 quipo Exp $ + * @version $Id: mdb.php,v 1.16 2004/12/14 20:03:33 quipo Exp $ */ /** @@ -35,7 +35,7 @@ * by the PEAR MDB abstraction layer to fetch data. * * @package Translation2 - * @version $Revision: 1.15 $ + * @version $Revision: 1.16 $ */ class Translation2_Container_mdb extends Translation2_Container { @@ -169,9 +169,9 @@ */ function &getPage($pageID = null, $langID = null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $lang_col = $this->_getLangCol($langID); - $table = $this->_getLangTable($langID); + $table = $this->_getLangTable($langID); $query = sprintf('SELECT %s, %s FROM %s WHERE %s ', $this->options['string_id_col'], @@ -212,9 +212,9 @@ */ function getOne($stringID, $pageID=null, $langID=null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $lang_col = $this->_getLangCol($langID); - $table = $this->_getLangTable($langID); + $table = $this->_getLangTable($langID); $query = sprintf('SELECT %s FROM %s WHERE %s.%s = %s AND %s', $lang_col, http://cvs.php.net/diff.php/pear/Translation2/Container/mdb2.php?r1=1.13&r2=1.14&ty=u Index: pear/Translation2/Container/mdb2.php diff -u pear/Translation2/Container/mdb2.php:1.13 pear/Translation2/Container/mdb2.php:1.14 --- pear/Translation2/Container/mdb2.php:1.13 Tue Nov 2 11:20:40 2004 +++ pear/Translation2/Container/mdb2.php Tue Dec 14 15:03:33 2004 @@ -16,11 +16,11 @@ // | Author: Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: mdb2.php,v 1.13 2004/11/02 16:20:40 quipo Exp $ +// $Id: mdb2.php,v 1.14 2004/12/14 20:03:33 quipo Exp $ // /** * @package Translation2 - * @version $Id: mdb2.php,v 1.13 2004/11/02 16:20:40 quipo Exp $ + * @version $Id: mdb2.php,v 1.14 2004/12/14 20:03:33 quipo Exp $ */ /** @@ -35,7 +35,7 @@ * by the PEAR MDB2 abstraction layer to fetch data. * * @package Translation2 - * @version $Revision: 1.13 $ + * @version $Revision: 1.14 $ */ class Translation2_Container_mdb2 extends Translation2_Container { @@ -169,9 +169,9 @@ */ function &getPage($pageID = null, $langID = null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $lang_col = $this->_getLangCol($langID); - $table = $this->_getLangTable($langID); + $table = $this->_getLangTable($langID); $query = sprintf('SELECT %s, %s FROM %s WHERE %s ', $this->options['string_id_col'], @@ -212,9 +212,9 @@ */ function getOne($stringID, $pageID = null, $langID = null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $lang_col = $this->_getLangCol($langID); - $table = $this->_getLangTable($langID); + $table = $this->_getLangTable($langID); $query = sprintf('SELECT %s FROM %s WHERE %s.%s = %s AND %s', $lang_col, http://cvs.php.net/diff.php/pear/Translation2/Container/xml.php?r1=1.2&r2=1.3&ty=u Index: pear/Translation2/Container/xml.php diff -u pear/Translation2/Container/xml.php:1.2 pear/Translation2/Container/xml.php:1.3 --- pear/Translation2/Container/xml.php:1.2 Fri Nov 19 11:55:43 2004 +++ pear/Translation2/Container/xml.php Tue Dec 14 15:03:33 2004 @@ -16,7 +16,7 @@ // | Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: xml.php,v 1.2 2004/11/19 16:55:43 quipo Exp $ +// $Id: xml.php,v 1.3 2004/12/14 20:03:33 quipo Exp $ // /** * @package Translation2 @@ -290,7 +290,7 @@ */ function getPage($pageID = null, $langID = null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $pageID = (is_null($pageID)) ? '#NULL' : $pageID; $pageID = (empty($pageID)) ? '#EMPTY' : $pageID; @@ -317,7 +317,7 @@ */ function getOne($stringID, $pageID = null, $langID = null) { - $langID = is_null($langID) ? $this->currentLang['id'] : $langID; + $langID = $this->_getLangID($langID); $pageID = (is_null($pageID)) ? '#NULL' : $pageID; return isset($this->_data['pages'][$pageID][$stringID][$langID])