cvs: pear /I18Nv2 Country.php I18Nv2.php Language.php Locale.php Negotiator.php

From: Date: Sun, 14 Mar 2004 15:00:28 +0000
Subject: cvs: pear /I18Nv2 Country.php I18Nv2.php Language.php Locale.php Negotiator.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-17399@lists.php.net to get a copy of this message
mike Sun Mar 14 10:00:28 2004 EDT Modified files: /pear/I18Nv2 Country.php I18Nv2.php Language.php Locale.php Negotiator.php Log: * removed parenthesis from iclude/require_once statements * phpdoc * made I18Nv2::createNegotiator() behave like a creator instead of a singleton

http://cvs.php.net/diff.php/pear/I18Nv2/Country.php?r1=1.2&r2=1.3&ty=u Index: pear/I18Nv2/Country.php diff -u pear/I18Nv2/Country.php:1.2 pear/I18Nv2/Country.php:1.3 --- pear/I18Nv2/Country.php:1.2 Mon Mar 8 14:56:34 2004 +++ pear/I18Nv2/Country.php Sun Mar 14 10:00:27 2004 @@ -16,26 +16,33 @@ // | Michael Wallner <mike@iworks.at> | // +----------------------------------------------------------------------+ // -// $Id: Country.php,v 1.2 2004/03/08 19:56:34 mike Exp $ +// $Id: Country.php,v 1.3 2004/03/14 15:00:27 mike Exp $ /** -* I18Nv2_Country +* I18Nv2::Country * * Save list of ISO-3166 two letter country code to * country name mapping. * -* @author Naoki Shima <murahachibu@php.net> -* @author Wolfram Kriesing <wk@visionp.de> -* @author Michael Wallner <mike@php.net> -* * @package I18Nv2 * @category Internationalisation +*/ + +/** +* I18Nv2_Country * -* @version $Revision: 1.2 $ +* @author Naoki Shima <murahachibu@php.net> +* @author Wolfram Kriesing <wk@visionp.de> +* @author Michael Wallner <mike@php.net> +* @version $Revision: 1.3 $ * @access public +* @package I18Nv2 */ class I18Nv2_Country { + /** + * @access private + */ var $_codes = array( 'AF' => 'AFGHANISTAN', 'AL' => 'ALBANIA', @@ -292,6 +299,7 @@ /** * @access public + * @ignore */ function __construct() { http://cvs.php.net/diff.php/pear/I18Nv2/I18Nv2.php?r1=1.2&r2=1.3&ty=u Index: pear/I18Nv2/I18Nv2.php diff -u pear/I18Nv2/I18Nv2.php:1.2 pear/I18Nv2/I18Nv2.php:1.3 --- pear/I18Nv2/I18Nv2.php:1.2 Mon Mar 8 14:57:30 2004 +++ pear/I18Nv2/I18Nv2.php Sun Mar 14 10:00:27 2004 @@ -16,16 +16,27 @@ // | Michael Wallner <mike@iworks.at> | // +----------------------------------------------------------------------+ // -// $Id: I18Nv2.php,v 1.2 2004/03/08 19:57:30 mike Exp $ +// $Id: I18Nv2.php,v 1.3 2004/03/14 15:00:27 mike Exp $ -require_once('PEAR.php'); +/** +* I18Nv2 +* +* @package I18Nv2 +* @category Internationalisation +*/ + +/** +* Requires PEAR +*/ +require_once 'PEAR.php'; /** * I18Nv2 - Internationalization v2 * * @author Michael Wallner <mike@php.net> -* @version $Revision: 1.2 $ +* @version $Revision: 1.3 $ * @access public +* @package I18Nv2 */ class I18Nv2 { @@ -72,7 +83,7 @@ /** * Get current/prior Locale * - * This only works, if you I18Nv2::setLocale() has already been called + * This only works, if I18Nv2::setLocale() has already been called * * @static * @access public @@ -119,7 +130,7 @@ */ function &createLocale($locale = null) { - require_once('I18Nv2/Locale.php'); + require_once 'I18Nv2/Locale.php'; return new I18Nv2_Locale($locale); } @@ -134,12 +145,8 @@ */ function &createNegotiator($defLang = 'en', $defCharset = 'iso-8859-1') { - static $negotiator; - if (!isset($negotiator)) { - require_once('I18Nv2/Negotiator.php'); - $negotiator = &new I18Nv2_Negotiator($defLang, $defCharset); - } - return $negotiator; + require_once 'I18Nv2/Negotiator.php'; + return new I18Nv2_Negotiator($defLang, $defCharset); } /** @@ -185,12 +192,12 @@ } /** - * Mimics PEAR::getStaticProperty() + * Get access to static property * * @static * @access public - * @return mixed reference to static property - * @param string $property property + * @return mixed Returns a reference to a static property + * @param string $property the static property */ function &getStaticProperty($property) { @@ -201,7 +208,10 @@ /** * This one gets called automatically * - * @access internal + * @ignore + * @static + * @internal + * @access private * @return void */ function _main() @@ -212,10 +222,10 @@ if (OS_WINDOWS) { // include Win32 locales map - include_once('I18Nv2/Locale/MapWindows.php'); + include_once 'I18Nv2/Locale/MapWindows.php'; } else { // or some standard mappings for other systems (?) - include_once('I18Nv2/Locale/Map.php'); + include_once 'I18Nv2/Locale/Map.php'; } } } http://cvs.php.net/diff.php/pear/I18Nv2/Language.php?r1=1.1&r2=1.2&ty=u Index: pear/I18Nv2/Language.php diff -u pear/I18Nv2/Language.php:1.1 pear/I18Nv2/Language.php:1.2 --- pear/I18Nv2/Language.php:1.1 Sat Mar 6 12:07:47 2004 +++ pear/I18Nv2/Language.php Sun Mar 14 10:00:27 2004 @@ -16,9 +16,16 @@ // | Michael Wallner <mike@iworks.at> | // +----------------------------------------------------------------------+ // -// $Id: Language.php,v 1.1 2004/03/06 17:07:47 mike Exp $ +// $Id: Language.php,v 1.2 2004/03/14 15:00:27 mike Exp $ /** +* I18Nv2::Language +* +* @package I18Nv2 +* @category Internationalisation +*/ + +/** * I18Nv2_Language * * Save list of ISO-639-1 two letter resp. ISO-639-2 three letter @@ -26,12 +33,9 @@ * * @author Wolfram Kriesing <wk@visionp.de> * @author Michael Wallner <mike@php.net> -* -* @package I18Nv2 -* @category Internationalisation -* -* @version $Revision: 1.1 $ +* @version $Revision: 1.2 $ * @access public +* @package I18Nv2 */ class I18Nv2_Language { @@ -52,13 +56,17 @@ { $this->__construct($threeLetters); } - // + + /** + * ZE2 Constructor + * @ignore + */ function __construct($threeLetters = false) { if ($threeLetters) { - include('I18Nv2/Language/ISO-639-2.php'); + include 'I18Nv2/Language/ISO-639-2.php'; } else { - include('I18Nv2/Language/ISO-639-1.php'); + include 'I18Nv2/Language/ISO-639-1.php'; } } http://cvs.php.net/diff.php/pear/I18Nv2/Locale.php?r1=1.4&r2=1.5&ty=u Index: pear/I18Nv2/Locale.php diff -u pear/I18Nv2/Locale.php:1.4 pear/I18Nv2/Locale.php:1.5 --- pear/I18Nv2/Locale.php:1.4 Tue Mar 9 04:42:40 2004 +++ pear/I18Nv2/Locale.php Sun Mar 14 10:00:27 2004 @@ -11,10 +11,16 @@ // | Copyright (c) 2003 Michael Wallner <mike@iworks.at> | // +----------------------------------------------------------------------+ // -// $Id: Locale.php,v 1.4 2004/03/09 09:42:40 mike Exp $ +// $Id: Locale.php,v 1.5 2004/03/14 15:00:27 mike Exp $ -require_once('I18Nv2.php'); +/** +* I18Nv2::Locale +* +* @package I18Nv2 +* @category Internationalisation +*/ +/**#@+ Constants **/ define('I18Nv2_NUMBER', 10); define('I18Nv2_CURRENCY', 20); define('I18Nv2_DATETIME', 30); @@ -30,19 +36,26 @@ define('I18Nv2_DATETIME_MEDIUM', 33); define('I18Nv2_DATETIME_LONG', 34); define('I18Nv2_DATETIME_FULL', 35); +/**#@-*/ + +/** +* Requires I18Nv2 +*/ +require_once 'I18Nv2.php'; /** * I18Nv2_Locale * -* @package I18Nv2 -* @category Internationalisation -* * @author Michael Wallner <mike@php.net> -* @version $Revision: 1.4 $ +* @version $Revision: 1.5 $ * @access public +* @package I18Nv2 */ class I18Nv2_Locale { + /**#@+ + * @access private + */ var $_locale = 'en_US'; var $_days; @@ -61,7 +74,8 @@ var $_currentCurrencyFormat; var $_customFormats; - + /**#@-*/ + /** * Constructor * @@ -75,6 +89,8 @@ } /** + * ZE2 Constructor + * @ignore * @access public * @return object * @param string $locale @@ -226,7 +242,7 @@ $locale = I18Nv2::lastLocale(0, true); if (isset($locale)) { foreach ($locale as $lc) { - if (@include('I18Nv2/Locale/'. $lc .'.php')) { + if (@include 'I18Nv2/Locale/'. $lc .'.php') { return true; } } http://cvs.php.net/diff.php/pear/I18Nv2/Negotiator.php?r1=1.1&r2=1.2&ty=u Index: pear/I18Nv2/Negotiator.php diff -u pear/I18Nv2/Negotiator.php:1.1 pear/I18Nv2/Negotiator.php:1.2 --- pear/I18Nv2/Negotiator.php:1.1 Sat Mar 6 12:07:47 2004 +++ pear/I18Nv2/Negotiator.php Sun Mar 14 10:00:27 2004 @@ -16,43 +16,24 @@ // | Michael Wallner <mike@iworks.at> | // +----------------------------------------------------------------------+ // -// $Id: Negotiator.php,v 1.1 2004/03/06 17:07:47 mike Exp $ +// $Id: Negotiator.php,v 1.2 2004/03/14 15:00:27 mike Exp $ /** -* I18Nv2_Negotiator -* -* <code> -* //instantiate I18Nv2_Negotiator -* $negotiator = & new I18Nv2_Negotiator(); -* -* //define which language[s] your site supports optional -* $supportLangs = array('fr','jp'); -* -* //find first matched language -* $lang = $negotiator->getLanguageMatch($supportLangs); -* -* //define which countries your site supports optional -* $supportCountries = array('gb','us'); +* I18Nv2::Negotiator * -* //find first matched Country -* $countryCode = $negotiator->getCountryMatch($lang, $supportCountries); -* -* echo ' -* Language Code: ' . $lang.' -* Language Name: ' . $negotiator->getLanguageName($lang).' -* Country Code: ' . $countryCode.' -* Country Name: ' . $negotiator->getCountryName($countryCode); -* </code> +* @package I18Nv2 +* @category Internationalisation +*/ + +/** +* I18Nv2_Negotiator * * @author Naoki Shima <murahachibu@php.net> * @author Wolfram Kriesing <wk@visionp.de> * @author Michael Wallner <mike@php.net> -* -* @package I18Nv2 -* @category Internationalisation -* -* @version $Revision: 1.1 $ +* @version $Revision: 1.2 $ * @access public +* @package I18Nv2 */ class I18Nv2_Negotiator { @@ -144,7 +125,11 @@ { $this->__construct($defaultLanguage, $defaultCharset, $defaultCountry); } - // + + /** + * ZE2 Constructor + * @ignore + */ function __construct($defaultLanguage = 'en', $defaultCharset = 'iso-8859-1', $defaultCountry = '') { $this->_defaultCountry = $defaultCountry;
« previous php.pear.cvs (#17399) next »