[pLog-svn] r7133 - in plog/branches/lifetype-1.2: . class/action class/action/admin class/dao class/dao/customfields class/dao/userdata class/data class/locale class/plugin class/summary/action class/summary/data class/summary/mail class/summary/view class/template/menu class/template/smarty/plugins class/test/tests/locale class/test/tests/net/xmlrpc class/view class/view/admin locale locale/unported
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Tue Sep 13 14:55:06 EDT 2011
Author: jondaley
Date: 2011-09-13 14:55:05 -0400 (Tue, 13 Sep 2011)
New Revision: 7133
Added:
plog/branches/lifetype-1.2/class/locale/ltlocale.class.php
plog/branches/lifetype-1.2/class/locale/ltlocalefinder.class.php
plog/branches/lifetype-1.2/class/locale/ltlocales.class.php
plog/branches/lifetype-1.2/class/test/tests/locale/ltlocale_test.class.php
Removed:
plog/branches/lifetype-1.2/class/locale/locale.class.php
plog/branches/lifetype-1.2/class/locale/localefinder.class.php
plog/branches/lifetype-1.2/class/locale/locales.class.php
plog/branches/lifetype-1.2/class/test/tests/locale/locale_test.class.php
Modified:
plog/branches/lifetype-1.2/class/action/admin/adminaction.class.php
plog/branches/lifetype-1.2/class/action/admin/adminaddblogaction.class.php
plog/branches/lifetype-1.2/class/action/admin/adminaddblogtemplateaction.class.php
plog/branches/lifetype-1.2/class/action/admin/adminaddlocaleaction.class.php
plog/branches/lifetype-1.2/class/action/admin/admindeletelocalesaction.class.php
plog/branches/lifetype-1.2/class/action/admin/admindoregisterblogaction.class.php
plog/branches/lifetype-1.2/class/action/admin/adminloginaction.class.php
plog/branches/lifetype-1.2/class/action/admin/adminlogoutaction.class.php
plog/branches/lifetype-1.2/class/action/admin/adminnewblogtemplateaction.class.php
plog/branches/lifetype-1.2/class/action/admin/adminnewtemplateaction.class.php
plog/branches/lifetype-1.2/class/action/admin/adminupdateblogsettingsaction.class.php
plog/branches/lifetype-1.2/class/action/rssaction.class.php
plog/branches/lifetype-1.2/class/dao/bloginfo.class.php
plog/branches/lifetype-1.2/class/dao/customfields/customfielddatevalue.class.php
plog/branches/lifetype-1.2/class/dao/userdata/joomlauserdataprovider.class.php
plog/branches/lifetype-1.2/class/dao/userdata/ldapuserdataprovider.class.php
plog/branches/lifetype-1.2/class/dao/userdata/phpbb2userdataprovider.class.php
plog/branches/lifetype-1.2/class/dao/userdata/simplepostnukeuserdataprovider.class.php
plog/branches/lifetype-1.2/class/dao/userdata/vbb3userdataprovider.class.php
plog/branches/lifetype-1.2/class/dao/userdata/wbbuserdataprovider.class.php
plog/branches/lifetype-1.2/class/data/plogcalendar.class.php
plog/branches/lifetype-1.2/class/data/timestamp.class.php
plog/branches/lifetype-1.2/class/locale/bloglocale.class.php
plog/branches/lifetype-1.2/class/locale/pluginlocale.class.php
plog/branches/lifetype-1.2/class/plugin/pluginmanager.class.php
plog/branches/lifetype-1.2/class/summary/action/doblogregistration.class.php
plog/branches/lifetype-1.2/class/summary/action/dofinishregister.class.php
plog/branches/lifetype-1.2/class/summary/action/summaryaction.class.php
plog/branches/lifetype-1.2/class/summary/data/summarytools.class.php
plog/branches/lifetype-1.2/class/summary/mail/confirmemailmessage.class.php
plog/branches/lifetype-1.2/class/summary/mail/summarymailer.class.php
plog/branches/lifetype-1.2/class/summary/view/doblogregistrationview.class.php
plog/branches/lifetype-1.2/class/summary/view/summarycachedview.class.php
plog/branches/lifetype-1.2/class/summary/view/summarymessageview.class.php
plog/branches/lifetype-1.2/class/summary/view/summaryrssview.class.php
plog/branches/lifetype-1.2/class/summary/view/summaryview.class.php
plog/branches/lifetype-1.2/class/template/menu/menurenderer.class.php
plog/branches/lifetype-1.2/class/template/smarty/plugins/function.pager.php
plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.round.php
plog/branches/lifetype-1.2/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php
plog/branches/lifetype-1.2/class/view/admin/adminarticlecommentslistview.class.php
plog/branches/lifetype-1.2/class/view/admin/adminblogsettingsview.class.php
plog/branches/lifetype-1.2/class/view/admin/admindashboardview.class.php
plog/branches/lifetype-1.2/class/view/admin/admindefaultview.class.php
plog/branches/lifetype-1.2/class/view/admin/admineditsiteblogview.class.php
plog/branches/lifetype-1.2/class/view/admin/adminloginview.class.php
plog/branches/lifetype-1.2/class/view/admin/adminpostslistview.class.php
plog/branches/lifetype-1.2/class/view/admin/adminregisterblogview.class.php
plog/branches/lifetype-1.2/class/view/admin/adminsimpleerrorview.class.php
plog/branches/lifetype-1.2/class/view/admin/adminsimplemessageview.class.php
plog/branches/lifetype-1.2/class/view/admin/adminsitelocaleslistview.class.php
plog/branches/lifetype-1.2/class/view/blogview.class.php
plog/branches/lifetype-1.2/locale/locale_ca_ES.php
plog/branches/lifetype-1.2/locale/locale_de_DE.php
plog/branches/lifetype-1.2/locale/locale_en_UK.php
plog/branches/lifetype-1.2/locale/locale_es_ES.php
plog/branches/lifetype-1.2/locale/locale_fr_FR.php
plog/branches/lifetype-1.2/locale/locale_gl_ES.php
plog/branches/lifetype-1.2/locale/locale_hu_HU.php
plog/branches/lifetype-1.2/locale/locale_id_ID.php
plog/branches/lifetype-1.2/locale/locale_it_IT.php
plog/branches/lifetype-1.2/locale/locale_ja_JP.php
plog/branches/lifetype-1.2/locale/locale_nl_NL.php
plog/branches/lifetype-1.2/locale/locale_pl_PL.php
plog/branches/lifetype-1.2/locale/locale_pt_BR.php
plog/branches/lifetype-1.2/locale/locale_vi_VN.php
plog/branches/lifetype-1.2/locale/locale_zh_CN.php
plog/branches/lifetype-1.2/locale/locale_zh_TW.php
plog/branches/lifetype-1.2/locale/unported/locale_el_GR.php
plog/branches/lifetype-1.2/locale/unported/locale_eu_ES.php
plog/branches/lifetype-1.2/locale/unported/locale_fa_IR.php
plog/branches/lifetype-1.2/locale/unported/locale_fi_FI.php
plog/branches/lifetype-1.2/locale/unported/locale_gz_ES.php
plog/branches/lifetype-1.2/locale/unported/locale_ja_JP.php
plog/branches/lifetype-1.2/locale/unported/locale_ja_JP_utf8.php
plog/branches/lifetype-1.2/locale/unported/locale_ko_KR.php
plog/branches/lifetype-1.2/locale/unported/locale_nb_NO.php
plog/branches/lifetype-1.2/locale/unported/locale_sv_SE.php
plog/branches/lifetype-1.2/locale/unported/locale_tr_TR.php
plog/branches/lifetype-1.2/wizard
Log:
renamed Locale class to LTLocale so it doesn't conflict with PHP 5.3's internationalization library, which isn't installed by default, but lots of webhosts include it, and that breaks LifeType
Modified: plog/branches/lifetype-1.2/class/action/admin/adminaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminaction.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/action/admin/adminaction.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,7 +1,7 @@
<?php
lt_include( PLOG_CLASS_PATH."class/action/action.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/net/http/httpvars.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/templateservice.class.php" );
lt_include( PLOG_CLASS_PATH."class/misc/version.class.php" );
@@ -172,11 +172,11 @@
// don't like this so much...
if( !empty( $this->_blogInfo ) ) {
$this->_blogSettings = $this->_blogInfo->getSettings();
- //$locale =& Locales::getLocale( $this->_blogSettings->getValue("locale"));
+ //$locale =& LTLocales::getLocale( $this->_blogSettings->getValue("locale"));
$locale =& $this->_blogInfo->getLocale();
}
else {
- $locale =& Locales::getLocale( $this->_config->getValue("default_locale"));
+ $locale =& LTLocales::getLocale( $this->_config->getValue("default_locale"));
}
return $locale;
Modified: plog/branches/lifetype-1.2/class/action/admin/adminaddblogaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminaddblogaction.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/action/admin/adminaddblogaction.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -125,7 +125,7 @@
// Get the defaul locale object
$config =& Config::getConfig();
- $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+ $locale =& LTLocales::getLocale( $config->getValue( "default_locale" ));
// add a default category and a default post
$articleCategories = new ArticleCategories();
Modified: plog/branches/lifetype-1.2/class/action/admin/adminaddblogtemplateaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminaddblogtemplateaction.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/action/admin/adminaddblogtemplateaction.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -13,7 +13,7 @@
* \ingroup Action
* @private
*
- * Shows a form to add a new locale file
+ * Shows a form to add a new blog template file
*/
class AdminAddBlogTemplateAction extends AdminAction
{
Modified: plog/branches/lifetype-1.2/class/action/admin/adminaddlocaleaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminaddlocaleaction.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/action/admin/adminaddlocaleaction.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,11 +1,11 @@
<?php
lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/view/admin/adminsitelocaleslistview.class.php" );
lt_include( PLOG_CLASS_PATH."class/file/fileupload.class.php" );
lt_include( PLOG_CLASS_PATH."class/file/fileuploads.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/localefinder.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocalefinder.class.php" );
/**
* \ingroup Action
@@ -37,7 +37,7 @@
$upload = new FileUpload( $files["localeFile"] );
- if( !Locales::isValidLocaleFileName( $upload->getFileName())) {
+ if( !LTLocales::isValidLocaleFileName( $upload->getFileName())) {
$this->_view = new AdminTemplatedView( $this->_blogInfo, "newlocale" );
$this->_view->setErrorMessage( $this->_locale->tr("error_invalid_locale_file"));
$this->setCommonData();
@@ -56,10 +56,10 @@
*/
function _performScanLocales()
{
- $locales = new Locales();
+ $locales = new LTLocales();
// find all the new locales that we have not yet stored
- $f = new LocaleFinder();
+ $f = new LTLocaleFinder();
$newLocaleCodes = $f->find();
// success message
@@ -111,7 +111,7 @@
$localeCode = $matches[1];
// add the file to the list of locales
- $locales = new Locales();
+ $locales = new LTLocales();
$locales->addLocale( $localeCode );
$this->_view->setSuccessMessage( $this->_locale->pr( "locale_added_ok", $localeCode ));
Modified: plog/branches/lifetype-1.2/class/action/admin/admindeletelocalesaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/admindeletelocalesaction.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/action/admin/admindeletelocalesaction.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,7 +2,7 @@
lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
lt_include( PLOG_CLASS_PATH."class/view/admin/adminsitelocaleslistview.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/filter/htmlfilter.class.php" );
@@ -53,7 +53,7 @@
function _deleteLocales()
{
- $locales = new Locales();
+ $locales = new LTLocales();
// if there is only one locale available in the system, we should
// not allow to remove it either
Modified: plog/branches/lifetype-1.2/class/action/admin/admindoregisterblogaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/admindoregisterblogaction.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/action/admin/admindoregisterblogaction.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -108,7 +108,7 @@
// set the template
$blog->setTemplate( $template );
// set the locale
- $locale =& Locales::getLocale( $localeCode );
+ $locale =& LTLocales::getLocale( $localeCode );
$blog->setLocale( $locale );
// and set the status to ready
$blog->setStatus( BLOG_STATUS_ACTIVE );
Modified: plog/branches/lifetype-1.2/class/action/admin/adminloginaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminloginaction.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/action/admin/adminloginaction.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -8,7 +8,7 @@
lt_include( PLOG_CLASS_PATH."class/net/http/session/sessioninfo.class.php" );
lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
lt_include( PLOG_CLASS_PATH."class/misc/version.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/usernamevalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/view/admin/adminnewpostview.class.php" );
@@ -37,7 +37,7 @@
$this->Action( $actionInfo, $request );
$this->_config =& Config::getConfig();
- $this->_locale =& Locales::getLocale( $this->_config->getValue( "default_locale" ));
+ $this->_locale =& LTLocales::getLocale( $this->_config->getValue( "default_locale" ));
// data validation
$this->registerFieldValidator( "userName", new UsernameValidator());
Modified: plog/branches/lifetype-1.2/class/action/admin/adminlogoutaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminlogoutaction.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/action/admin/adminlogoutaction.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -44,7 +44,7 @@
if( $destinationUrl == "" ) {
// and pass the locale to the template
$this->_view = new AdminDefaultView();
- $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+ $locale =& LTLocales::getLocale( $config->getValue( "default_locale" ));
$url = $this->_blogInfo->getBlogRequestGenerator();
$blogTitle = $this->_blogInfo->getBlog();
$logoutMessage = $this->_locale->tr("logout_message")."<br/>".$locale->pr("logout_message_2", $url->blogLink(), $blogTitle);
Modified: plog/branches/lifetype-1.2/class/action/admin/adminnewblogtemplateaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminnewblogtemplateaction.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/action/admin/adminnewblogtemplateaction.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -9,7 +9,7 @@
* \ingroup Action
* @private
*
- * Shows a form to add a new locale file
+ * Shows a form to add a new blog template file
*/
class AdminNewBlogTemplateAction extends AdminAction
{
Modified: plog/branches/lifetype-1.2/class/action/admin/adminnewtemplateaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminnewtemplateaction.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/action/admin/adminnewtemplateaction.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -8,7 +8,7 @@
* \ingroup Action
* @private
*
- * Shows a form to add a new locale file
+ * Shows a form to add a new template file
*/
class AdminNewTemplateAction extends AdminAction
{
Modified: plog/branches/lifetype-1.2/class/action/admin/adminupdateblogsettingsaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminupdateblogsettingsaction.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/action/admin/adminupdateblogsettingsaction.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -196,7 +196,7 @@
$this->notifyEvent( EVENT_POST_BLOG_UPDATE, Array( "blog" => &$this->_blogInfo ));
$this->_view = new AdminBlogSettingsView( $this->_blogInfo );
- $this->_locale =& Locales::getLocale( $blogSettings->getValue( "locale" ));
+ $this->_locale =& LTLocales::getLocale( $blogSettings->getValue( "locale" ));
$this->_view->setSuccessMessage( $this->_locale->pr("blog_settings_updated_ok", $this->_blogInfo->getBlog()));
$this->setCommonData();
Modified: plog/branches/lifetype-1.2/class/action/rssaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/rssaction.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/action/rssaction.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -92,7 +92,7 @@
}
lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
lt_include( PLOG_CLASS_PATH."class/config/siteconfig.class.php" );
Modified: plog/branches/lifetype-1.2/class/dao/bloginfo.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/bloginfo.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/dao/bloginfo.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -32,7 +32,7 @@
// the TemplateSet representing the template set used by the blog
var $_templateSet;
- // the Locale object
+ // the LTLocale object
var $_locale;
var $_blogLocale;
@@ -495,13 +495,13 @@
/**
* returns the right locale object for the blog
*
- * @param a Locale object
+ * @param a LTLocale object
*/
function &getLocale()
{
if( $this->_locale === null ) {
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
- $this->_locale =& Locales::getLocale( $this->getSetting( "locale" ), "en_UK" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
+ $this->_locale =& LTLocales::getLocale( $this->getSetting( "locale" ), "en_UK" );
}
return $this->_locale;
@@ -510,8 +510,8 @@
function &getBlogLocale()
{
if( $this->_blogLocale === null ) {
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
- $this->_blogLocale =& Locales::getBlogLocale( $this->getSetting( "locale" ), "en_UK" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
+ $this->_blogLocale =& LTLocales::getBlogLocale( $this->getSetting( "locale" ), "en_UK" );
}
return $this->_blogLocale;
@@ -521,7 +521,7 @@
/**
* sets the new locale for the blog
*
- * @param a valid Locale object
+ * @param a valid LTLocale object
* @return Always true
*/
function setLocale( $locale )
Modified: plog/branches/lifetype-1.2/class/dao/customfields/customfielddatevalue.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/customfields/customfielddatevalue.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/dao/customfields/customfielddatevalue.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -66,8 +66,8 @@
*/
function getDateFormatted()
{
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
- $locale = Locales::getLocale( "en_UK" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
+ $locale = LTLocales::getLocale( "en_UK" );
$dateFormatted = $locale->formatDate( $this->getDateObject(), "%d/%m/%Y %H:%M" );
Modified: plog/branches/lifetype-1.2/class/dao/userdata/joomlauserdataprovider.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/userdata/joomlauserdataprovider.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/dao/userdata/joomlauserdataprovider.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -226,7 +226,7 @@
$articleCategory = new ArticleCategory( "General", "", $newBlogId, true );
$catId = $articleCategories->addArticleCategory( $articleCategory );
$config =& Config::getConfig();
- $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+ $locale =& LTLocales::getLocale( $config->getValue( "default_locale" ));
$articleTopic = $locale->tr( "register_default_article_topic" );
$articleText = $locale->tr( "register_default_article_text" );
$article = new Article( $articleTopic,
Modified: plog/branches/lifetype-1.2/class/dao/userdata/ldapuserdataprovider.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/userdata/ldapuserdataprovider.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/dao/userdata/ldapuserdataprovider.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -95,7 +95,7 @@
$articleCategory = new ArticleCategory( "General", "", $newBlogId, true );
$catId = $articleCategories->addArticleCategory( $articleCategory );
$config =& Config::getConfig();
- $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+ $locale =& LTLocales::getLocale( $config->getValue( "default_locale" ));
$articleTopic = $locale->tr( "register_default_article_topic" );
$articleText = $locale->tr( "register_default_article_text" );
$article = new Article( $articleTopic,
Modified: plog/branches/lifetype-1.2/class/dao/userdata/phpbb2userdataprovider.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/userdata/phpbb2userdataprovider.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/dao/userdata/phpbb2userdataprovider.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -151,7 +151,7 @@
$articleCategory = new ArticleCategory( "General", "", $newBlogId, true );
$catId = $articleCategories->addArticleCategory( $articleCategory );
$config =& Config::getConfig();
- $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+ $locale =& LTLocales::getLocale( $config->getValue( "default_locale" ));
$articleTopic = $locale->tr( "register_default_article_topic" );
$articleText = $locale->tr( "register_default_article_text" );
$article = new Article( $articleTopic,
Modified: plog/branches/lifetype-1.2/class/dao/userdata/simplepostnukeuserdataprovider.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/userdata/simplepostnukeuserdataprovider.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/dao/userdata/simplepostnukeuserdataprovider.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -140,7 +140,7 @@
lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
$config =& Config::getConfig();
- $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+ $locale =& LTLocales::getLocale( $config->getValue( "default_locale" ));
// create a new blog
$blogs = new Blogs();
Modified: plog/branches/lifetype-1.2/class/dao/userdata/vbb3userdataprovider.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/userdata/vbb3userdataprovider.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/dao/userdata/vbb3userdataprovider.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -241,7 +241,7 @@
$articleCategory = new ArticleCategory( "General", "", $newBlogId, true );
$catId = $articleCategories->addArticleCategory( $articleCategory );
$config =& Config::getConfig();
- $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+ $locale =& LTLocales::getLocale( $config->getValue( "default_locale" ));
$articleTopic = $locale->tr( "register_default_article_topic" );
$articleText = $locale->tr( "register_default_article_text" );
$article = new Article( $articleTopic,
Modified: plog/branches/lifetype-1.2/class/dao/userdata/wbbuserdataprovider.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/userdata/wbbuserdataprovider.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/dao/userdata/wbbuserdataprovider.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -149,7 +149,7 @@
lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
$config =& Config::getConfig();
- $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+ $locale =& LTLocales::getLocale( $config->getValue( "default_locale" ));
$blogs = new Blogs();
$blog = new BlogInfo( $row["user"].$this->_blogtitle_postfix, // name of the new blog
Modified: plog/branches/lifetype-1.2/class/data/plogcalendar.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/data/plogcalendar.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/data/plogcalendar.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -4,8 +4,8 @@
lt_include( PLOG_CLASS_PATH."class/data/Date.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/htmlcalendar.class.php" );
lt_include( PLOG_CLASS_PATH.'class/data/timestamp.class.php' );
- lt_include( PLOG_CLASS_PATH."class/locale/locale.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocale.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/net/requestgenerator.class.php" );
// artificially define min and maximum years - maybe it'd be better to query
@@ -46,8 +46,7 @@
if( $locale == null ) {
$config = Config::getConfig();
- //$locale = new Locale( $config->getValue( "default_locale" ));
- $locale = Locales::getLocale( $config->getValue( "default_locale" ));
+ $locale = LTLocales::getLocale( $config->getValue( "default_locale" ));
}
$this->_dayPosts = $dayPosts;
Modified: plog/branches/lifetype-1.2/class/data/timestamp.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/data/timestamp.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/data/timestamp.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,7 +2,7 @@
lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/Date.class.php" );
/**
@@ -102,7 +102,7 @@
*/
function getMonthString()
{
- throw( new Exception("Timestamp::getMonthString not implemented. Use Locale::formatDate instead!"));
+ throw( new Exception("Timestamp::getMonthString not implemented. Use LTLocale::formatDate instead!"));
die();
}
Modified: plog/branches/lifetype-1.2/class/locale/bloglocale.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/locale/bloglocale.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/locale/bloglocale.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,15 +1,15 @@
<?php
/**
- * \ingroup Locale
+ * \ingroup LTLocale
*
- * @see Locale
- * @see Locales
+ * @see LTLocale
+ * @see LTLocales
*/
- lt_include( PLOG_CLASS_PATH."class/locale/locale.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocale.class.php" );
- class BlogLocale extends Locale
+ class BlogLocale extends LTLocale
{
var $_defaultFolder;
@@ -34,7 +34,7 @@
*/
function BlogLocale( $code )
{
- $this->Locale( $code );
+ $this->LTLocale( $code );
}
/**
Deleted: plog/branches/lifetype-1.2/class/locale/locale.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/locale/locale.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/locale/locale.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,853 +0,0 @@
-<?php
-
- /**
- * \defgroup Locale
- *
- * The Locale module is used for localization purposes. Its main class is the Locale class
- * that is capable of loading very simple php files containing a big array of string identifiers
- * and their translations. The main method of the class is the Locale::tr() that given a string
- * identifier, will return the translated version.
- *
- * Locale files can also specify default encodings and very basic date and time formats (this will
- * be improved in next version) At the moment it is also possible to use right-to-left languages
- * even though there is none available yet.
- *
- * The Locales class is the preferred way to load translations from disk since it has
- * caching mechanisms so that we don't have to load the data everytime from disk.
- *
- * Please see http://wiki.lifetype.net/index.php/Translating_LifeType for more information regading
- * how to work with locale files in LifeType.
- *
- * @see Locale
- * @see Locales
- */
-
-
- lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
-
- define( "DEFAULT_LOCALE_FOLDER", PLOG_CLASS_PATH . "locale" );
-
- /**
- * default locale format that will be used if none available
- */
- define( "DEFAULT_LOCALE_FORMAT", "%d/%m/%Y %H:%M" );
-
- /**
- * default encoding if the locale does not specify one
- */
- define( "DEFAULT_ENCODING", "iso-8859-1" );
-
- /**
- * default direction for texts, if the locale does not specify one
- */
- define( "DEFAULT_DIRECTION", "ltr" );
-
- /**
- * default first day fot calendar
- */
- define( "DEFAULT_FIRST_DAY_OF_WEEK", 1 );
-
- /**
- * \ingroup Locale
- *
- * Class used to localize messages and things such as dates and numbers.
- *
- * To use this class, we will have to provide a file containing an array
- * of the form:
- *
- * <pre>
- * $messages["identifier"] = "Translated text"
- * </pre>
- *
- * The file will be loaded when creating this object and must be called following
- * the same scheme: locale_lang_COUNTRY (see constructor on locales namig schemes)
- *
- * When we want to translate a string, we will have to use its identifier, that will
- * be looked up in the array containing all the messages. If there is a message for that
- * identifier, it will be returned or a empty string otherwise.
- *
- * This class is extensively used throughout the templates to localize texts, dates
- * and numbers, being the formatDate function one of the most importants of this class.
- *
- * <b>IMPORTANT:</b> For performance reasons, it is recommended to use the Locales::getLocale
- * method instead of creating new Locale objects every time we need one. The getLocale methods
- * offers caching capabilities so that the file with the messages will not need to be fetched
- * every time from disk.
- * @see Locales::getLocale()
- */
- class Locale
- {
-
- var $_defaultFolder;
- var $_code; // our ISO locale code, eg. es_ES, en_UK, etc
- var $_cache;
- var $_messages;
- var $_charset;
- var $_description;
- var $_dateFormat;
- var $_firstDayOfWeek;
- var $_dataLoaded;
-
- /**
- * Constructor.
- *
- * @param $code Code follows the Java naming scheme: language_COUNTRY, so
- * for example if we want to have the texts translated in the English spoken
- * in the UK, we'd have to use en_UK as the code. The two digits country
- * code and language code are ISO standards and can be found in
- * http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html (country codes) and
- * http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_639.html (language codes)
- */
- function Locale( $code )
- {
- $this->_code = $code;
-
- $this->_loadLocaleInfo();
-
- if( $this->_charset == "" )
- $this->_charset = DEFAULT_ENCODING;
-
- $this->_dataLoaded = false;
- }
-
- /**
- * @private
- */
- function _loadLocaleFile()
- {
- $this->_defaultFolder = $this->getLocaleFolder();
-
- // load the blog locale
- $fileName = $this->_defaultFolder."/locale_".$this->_code.".php";
- if( File::isReadable( $fileName )){
- // TODO: this function is only called once, right?
- include( $fileName );
- }
- if ( !isset($messages) || !is_array( $messages ) ) {
- $messages = array();
- }
- $this->_messages = $messages;
-
- // load the admin locale
- $fileName = $this->_defaultFolder."/admin/locale_".$this->_code.".php";
- if( File::isReadable( $fileName )){
- // TODO: this function is only called once, right?
- include( $fileName );
- }
- if ( !isset($messages) || !is_array( $messages ) ) {
- $messages = array();
- }
- $this->_messages = array_merge( $this->_messages, $messages );
-
- $this->_dataLoaded = true;
-
- unset($messages);
- }
-
- /**
- * @private
- * Loads the locale file, extracts the information needed and frees the used memory
- */
- function _loadLocaleInfo()
- {
-
- if( !is_array($this->_messages) ) {
- // load the locale into $this->_messages
- $this->_loadLocaleFile();
- }
-
- // get the info that we need
- $this->_description = isset($this->_messages["locale_description"]) ? $this->_messages["locale_description"] : "no description for " . $this->_code;
- $this->_charset = isset($this->_messages["encoding"]) ? $this->_messages["encoding"] : DEFAULT_ENCODING;
- $this->_direction = isset($this->_messages["direction"]) ? $this->_messages["direction"] : DEFAULT_DIRECTION;
- $this->_dateFormat = isset($this->_messages["date_format"]) ? $this->_messages["date_format"] : DEFAULT_LOCALE_FORMAT;
- $this->_firstDayOfWeek = isset($this->_messages["first_day_of_week"]) ? $this->_messages["first_day_of_week"] : DEFAULT_FIRST_DAY_OF_WEEK;
-
- unset( $this->_messages );
-
- $this->_messages = NULL;
-
- return( true );
- }
-
- /**
- * Returns the character encoding method used by the current locale file. It has to be a valid
- * character encoding, since it will be used in the header of the html file to tell the browser
- * which is the most suitable encoding that should be used.
- *
- * @return A valid character encoding method.
- */
- function getCharset()
- {
- return $this->_charset;
- }
-
- /**
- * returns the direction in which this language is written.
- * Possible values are, as with the html standard, "rtl" or "ltr"
- *
- */
- function getDirection()
- {
- $direction = $this->_direction;
- if( $direction != "rtl" )
- $direction = "ltr";
-
- return $direction;
- }
-
- /**
- * Returns an optional locale description string that can be included in the
- * locale file with the other texts.
- *
- * @return A string describing the locale file.
- */
- function getDescription()
- {
- return( $this->_description );
- }
-
- /**
- * @static
- */
- function getLocaleFolder()
- {
- $config =& Config::getConfig();
-
- $localeFolder = $config->getValue( "locale_folder" );
- if( $localeFolder == "" || $localeFolder == "./locale")
- $localeFolder = DEFAULT_LOCALE_FOLDER;
-
- return $localeFolder;
- }
-
- /**
- * Changes the locale to something else than what we chose in the first place when
- * creating the object.
- *
- * @param code follows the same format as in the constructor.
- */
- function setLocale( $code )
- {
- $this->_code = $code;
-
- $this->_loadLocaleFile();
- }
-
- /**
- * returns all the strings
- *
- * @return An array containing all the strings that this locale supports
- */
- function getStrings()
- {
- // load the file if it hadn't been loaded yet
- if( !is_array($this->_messages))
- $this->_loadLocaleFile();
-
- return $this->_messages;
- }
-
- /**
- * Translates a string
- *
- * @param id Identifier of the message we would like to translate
- */
- function tr( $id )
- {
- // load the file if it hasn't been loaded yet
- if( !$this->_dataLoaded ) {
- $this->_loadLocaleFile();
- }
-
- isset( $this->_messages[$id] ) ? $string = $this->_messages[$id] : $string = $id;
- if( $string == "" ) $string = $id;
-
- return $string;
- }
-
- /**
- * Alias for getString
- * @see getString
- */
- function i18n( $id )
- {
- return $this->getString( $id );
- }
-
- /**
- * calls printf on the translated string.
- *
- * Crappy Crappy! Since it only accepts three arguments... ;) Well, if we
- * ever need more than three, I'll change it!
- * @private
- */
- function pr( $id, $arg1 = null, $arg2 = null, $arg3 = null )
- {
- // first of all, we translate the string
- $str = $this->tr( $id );
- if( $arg1 == null )
- $result = $str;
- else if( $arg2 == null )
- $result = sprintf( $str, $arg1 );
- else if( $arg3 == null )
- $result = sprintf( $str, $arg1, $arg2 );
- else
- $result = sprintf( $str, $arg1, $arg2, $arg3 );
-
- return $result;
- }
-
- /**
- * Returns the complete code
- *
- * @return The Locale code
- */
- function getLocaleCode()
- {
- return $this->_code;
- }
-
- /**
- * Returns the two-character language code
- *
- * @return The two-character language code
- */
- function getLanguageId()
- {
- $countryId = substr( $this->_code, 3, 5 );
- if ( strcmp( $countryId, "TW" ) == 0 || strcmp( $countryId, "CN") ==0 ) {
- $langId = substr( $this->_code, 0, 2 );
- return $langId."-".$countryId;
- }
- else {
- return substr( $this->_code, 0, 2 );
- }
- }
-
- /**
- * Returns the two-character country code
- *
- * @return The two-character country code.
- */
- function getCountryId()
- {
- return substr( $this->_code, 3, 5 );
- }
-
- /**
- * Returns the first day of the week, which also depends on the country
- *
- * @return Returns 0 for Sunday, 1 for Monday and so on...
- */
- function firstDayOfWeek()
- {
- return $this->_firstDayOfWeek;
- }
-
- /**
- * Returns all the months of the year
- *
- * @return Returns an array containing the names of the months, where the
- * first one is January.
- */
- function getMonthNames()
- {
- // load the file if it hadn't been loaded yet
- if( !is_array($this->_messages))
- $this->_loadLocaleFile();
-
- return $this->_messages["months"];
- }
-
- /**
- * Returns the days of the week
- *
- * @return Returns the names of the days of the week, where the first one is
- * Sunday.
- */
- function getDayNames()
- {
- // load the file if it hadn't been loaded yet
- if( !is_array($this->_messages))
- $this->_loadLocaleFile();
-
- return $this->_messages["days"];
- }
-
- /**
- * Returns the shorter version of the days of the week
- *
- * @return Returns an array with the days of the week abbreviated, where the first
- * one is Sunday.
- */
- function getDayNamesShort()
- {
- // load the file if it hadn't been loaded yet
- if( !is_array($this->_messages))
- $this->_loadLocaleFile();
-
- return $this->_messages["daysshort"];
- }
-
- function _getOrdinal( $num )
- {
- // first we check the last two digits
- $last_two_digits = substr( $num, -2 );
- if( $last_two_digits == "11" )
- $value = $num."th";
- elseif( $last_two_digits == "12" )
- $value = $num."th";
- elseif( $last_two_digits == "13" )
- $value = $num."th";
- else {
- // we get the last digit
- $last_digit = substr( $num, -1 );
-
- if( $num < 10 )
- $num = $last_digit;
-
- if( $last_digit == "1" )
- $value = $num."st";
- elseif( $last_digit == "2" )
- $value = $num."nd";
- elseif( $last_digit == "3" )
- $value = $num."rd";
- else
- $value = $num."th";
- }
-
- return $value;
- }
-
- /**
- * Returns the day in an ordinal format, i.e. 1st, 2nd, 3rd, etc (in English)
- *
- * @return A string with the ordinal representation of the day.
- */
- function getDateOrdinal( $date )
- {
- $dayOrdinal = $date;
- $last_digit = substr( $dayOrdinal, -1 );
- if( $dayOrdinal < 10 )
- $dayOrdinal = $last_digit;
-
- switch( $this->getLanguageId()) {
- case "es":
- case "ca":
- break;
- case "de":
- case "fi":
- $dayOrdinal .= "."; break;
- case "en":
- default:
- $dayOrdinal = $this->_getOrdinal( $date); break;
- }
-
- return $dayOrdinal;
- }
-
- function getDayOrdinal( $t )
- {
- $dayOrdinal = $t->getDay();
- return $this->getDateOrdinal( $dayOrdinal );
- }
-
-
- /**
- * Formats the date of a Timestamp object according to the given format:
- *
- * (compatible with PHP):<ul>
- * <li>%a abbreviated weekday</li>
- * <li>%A complete weekday</li>
- * <li>%b abbreviated month</li>
- * <li>%B long month</li>
- * <li>%d day of the month, 2 digits with leading zero</li>
- * <li>%j day of the month, numeric (without leading zero)</li>
- * <li>%H hours, in 24-h format</li>
- * <li>%I hours, in 12-h format (without leading zero)</li>
- * <li>%p returns 'am' or 'pm'</li>
- * <li>%P returns 'AM' or 'PM'</li>
- * <li>%M minutes</li>
- * <li>%m month number, from 00 to 12</li>
- * <li>%S seconds</li>
- * <li>%y 2-digit year representation</li>
- * <li>%Y 4-digit year representation</li>
- * <li>%O Difference to Greenwich time (GMT) in hours, format will be +0000</li>
- * <li>%G Difference to Greenwich time (GMT) in hours, format will be +00:00</li>
- * <li>%% the '%' character
- * </ul>
- * (these have been added by myself and are therefore incompatible with php)<ul>
- * <li>%T "_day_ of _month_", where the day is in ordinal form and 'month' is the name of the month</li>
- * <li>%D cardinal representation of the day</li>
- * </ul>
- */
- function formatDate( $timeStamp, $format = null, $blog = null )
- {
- // load the file if it hadn't been loaded yet
- if( !is_array($this->_messages))
- $this->_loadLocaleFile();
-
- // if the user did not specify a format, let's use the default one
- if( $format == null )
- $format = $this->_dateFormat;
-
- // Get the unix time stamp
- if( strtolower(get_class( $timeStamp )) == "timestamp") {
- $time = $timeStamp->getTimestamp(DATE_FORMAT_UNIXTIME);
- }
- else {
- // we can assume it's a unix timestamp
- $time = $timeStamp;
- $timeStamp = new Timestamp( $time );
- }
-
- $timeZoneSec = date("Z", $time);
- if ( $blog ) {
- //
- // The blog was specified. Use it to get the time offset
- //
- $timeDiff = 0;
- $blogSettings = $blog->getSettings();
- $timeDiff = $blogSettings->getValue( 'time_offset' );
-
- // The following line relies on the fact that the result will
- // be an int.
- $timeZoneSec += ( $timeDiff * 3600 );
- }
-
- $text = $format;
-
- if( strpos( $text, "%a" ) !== FALSE ) {
- $weekdayId = $timeStamp->getWeekdayId();
- $weekday = $this->_messages["days"][$weekdayId];
- if( !empty( $this->_messages["weekdaysshort"] ) )
- $shortWeekday = $this->_messages["weekdaysshort"][$weekdayId];
- else
- $shortWeekday = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($weekday), 0, 3 )) : substr($weekday, 0, 3);
- $text = str_replace( "%a", $shortWeekday, $text );
- }
- if( strpos( $text, "%A" ) !== FALSE ) {
- $weekdayId = $timeStamp->getWeekdayId();
- $text = str_replace( "%A", $this->_messages["days"][$weekdayId], $text );
- }
- if( strpos( $text, "%b" ) !== FALSE ) {
- $monthId = (int)$timeStamp->getMonth();
- $monthStr = $this->_messages["months"][$monthId-1];
- if( !empty( $this->_messages["monthsshort"] ) )
- $shortMonthStr = $this->_messages["monthsshort"][$monthId-1];
- else
- $shortMonthStr = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($monthStr), 0, 3 )) : substr($monthStr, 0, 3);
-
- $text = str_replace( "%b", $shortMonthStr, $text );
- }
- if( strpos( $text, "%B" ) !== FALSE ) {
- $monthId = (int)$timeStamp->getMonth();
- $text = str_replace( "%B", $this->_messages["months"][$monthId-1], $text );
- }
- if( strpos( $text, "%d" ) !== FALSE ) {
- $text = str_replace( "%d", ($timeStamp->getDay() < 10) ? "0".$timeStamp->getDay() : $timeStamp->getDay(), $text );
- }
- if( strpos( $text, "%e" ) !== FALSE ) {
- $text = str_replace( "%e", intval($timeStamp->getDay()), $text );
- }
- if( strpos( $text, "%j" ) !== FALSE ) {
- $text = str_replace( "%j", $timeStamp->getDay(), $text );
- }
- if( strpos( $text, "%H" ) !== FALSE ) {
- $text = str_replace( "%H", $timeStamp->getHour(), $text );
- }
- if( strpos( $text, "%I" ) !== FALSE ) {
- $text = str_replace( "%I", ($timeStamp->getHour() != 0) ? ($timeStamp->getHour() > 12) ? $timeStamp->getHour()-12 : $timeStamp->getHour()+0 : 12, $text );
- }
- if( strpos( $text, "%p" ) !== FALSE ) {
- $text = str_replace( "%p", $timeStamp->getHour() >= 12 ? "pm" : "am", $text );
- }
- if( strpos( $text, "%P" ) !== FALSE ) {
- $text = str_replace( "%P", $timeStamp->getHour() >= 12 ? "PM" : "AM", $text );
- }
- if( strpos( $text, "%M" ) !== FALSE ) {
- $text = str_replace( "%M", $timeStamp->getMinutes(), $text );
- }
- if( strpos( $text, "%m" ) !== FALSE ) {
- $text = str_replace( "%m", $timeStamp->getMonth(), $text );
- }
- if( strpos( $text, "%S" ) !== FALSE ) {
- $text = str_replace( "%S", $timeStamp->getSeconds(), $text );
- }
- if( strpos( $text, "%y" ) !== FALSE ) {
- $text = str_replace( "%y", substr($timeStamp->getYear(), 2, 4 ), $text );
- }
- if( strpos( $text, "%Y" ) !== FALSE ) {
- $text = str_replace( "%Y", $timeStamp->getYear(), $text );
- }
- if( strpos( $text, "%O" ) !== FALSE ) {
- // Now convert the time zone seconds to hours and minutes
- $timeZoneHours = intval( abs($timeZoneSec) / 3600 );
- $timeZoneMins = intval(( abs($timeZoneSec) % 3600 ) / 60 );
- $timeZoneDirection = ($timeZoneSec < 0 ) ? "-" : "+";
-
- $text = str_replace( "%O", sprintf( "%s%02d%02d", $timeZoneDirection, $timeZoneHours, $timeZoneMins ), $text );
- }
- if( strpos( $text, "%G" ) !== FALSE ) {
- // Now convert the time zone seconds to hours and minutes
- $timeZoneHours = intval( abs($timeZoneSec) / 3600 );
- $timeZoneMins = intval(( abs($timeZoneSec) % 3600 ) / 60 );
- $timeZoneDirection = ($timeZoneSec < 0 ) ? "-" : "+";
-
- $text = str_replace( "%G", sprintf( "%s%02d:%02d", $timeZoneDirection, $timeZoneHours, $timeZoneMins ), $text );
- }
- if( strpos( $text, "%%" ) !== FALSE ) {
- $text = str_replace( "%%", "%", $text );
- }
- if( strpos( $text, "%T" ) !== FALSE ) {
- $monthId = (int)$timeStamp->getMonth();
- $monthStr = $this->_messages["months"][$monthId-1];
-
- $text = str_replace( "%T", $this->getDayOrdinal( $timeStamp )." ".$this->tr("of")." ".$monthStr, $text );
- }
- if( strpos( $text, "%D" ) !== FALSE ) {
- $text = str_replace( "%D", $this->getDayOrdinal( $timeStamp ), $text );
- }
-
- if ( $this->_code == 'fa_IR' )
- {
- lt_include( PLOG_CLASS_PATH."class/data/jalalicalendar.class.php" );
- list( $jyear, $jmonth, $jday ) = JalaliCalendar::gregorian_to_jalali(gmdate( "Y", $time ), gmdate( "m", $time ), gmdate( "d", $time ));
-
- if( strpos( $text, "%q" ) !== FALSE ) {
- $text = str_replace( "%q", JalaliCalendar::Convertnumber2farsi($jyear), $text );
- }
- if( strpos( $text, "%w" ) !== FALSE ) {
- $text = str_replace( "%w", JalaliCalendar::Convertnumber2farsi($jmonth), $text );
- }
- if( strpos( $text, "%o" ) !== FALSE ) {
- $text = str_replace( "%o", JalaliCalendar::Convertnumber2farsi($jday), $text );
- }
- if( strpos( $text, "%R" ) !== FALSE ) {
- $text = str_replace( "%R", JalaliCalendar::monthname($jmonth), $text );
- }
- if( strpos( $text, "%T" ) !== FALSE ) {
- $text = str_replace( "%T", JalaliCalendar::Convertnumber2farsi($timeStamp->getHour()), $text );
- }
- if( strpos( $text, "%U" ) !== FALSE ) {
- $text = str_replace( "%U", JalaliCalendar::Convertnumber2farsi($timeStamp->getMinutes()), $text );
- }
- }
-
- return $text;
- }
-
- /**
- * Formats the date of a Timestamp object according to the given format:
- * This function assumes that the timestamp is local and it converts it
- * to GMT before formatting.
- *
- * (compatible with PHP):<ul>
- * <li>%a abbreviated weekday</li>
- * <li>%A complete weekday</li>
- * <li>%b abbreviated month</li>
- * <li>%B long month</li>
- * <li>%d day of the month, 2 digits with leading zero</li>
- * <li>%j day of the month, numeric (without leading zero)</li>
- * <li>%H hours, in 24-h format</li>
- * <li>%I hours, in 12-h format (without leading zero)</li>
- * <li>%p returns 'am' or 'pm'</li>
- * <li>%P returns 'AM' or 'PM'</li>
- * <li>%M minutes</li>
- * <li>%m month number, from 00 to 12</li>
- * <li>%S seconds</li>
- * <li>%y 2-digit year representation</li>
- * <li>%Y 4-digit year representation</li>
- * <li>%O Difference to Greenwich time (GMT) in hours (Will always be +0000)</li>
- * <li>%G Difference to Greenwich time (GMT) in hours (Will always be +00:00)</li>
- * <li>%% the '%' character
- * </ul>
- * (these have been added by myself and are therefore incompatible with php)<ul>
- * <li>%T "_day_ of _month_", where the day is in ordinal form and 'month' is the name of the month</li>
- * <li>%D cardinal representation of the day</li>
- * </ul>
- */
- function formatDateGMT( $timeStamp, $format = null, $blog = null )
- {
-
-
- // load the file if it hadn't been loaded yet
- if( !is_array($this->_messages))
- $this->_loadLocaleFile();
-
- // if the user did not specify a format, let's use the default one
- if( $format == null )
- $format = $this->_dateFormat;
-
- // Get the unix time stamp
- if( strtolower(get_class( $timeStamp )) == "timestamp") {
- $time = $timeStamp->getTimestamp(DATE_FORMAT_UNIXTIME);
- }
- else {
- // we can assume it's a unix timestamp
- $time = $timeStamp;
- $timeStamp = new Timestamp( $time );
- }
- $timeZoneSec = date("Z", $time);
- if ( $blog ) {
- //
- // The blog was specified. Use it to get the time offset
- //
- $timeDiff = 0;
- $blogSettings = $blog->getSettings();
- $timeDiff = $blogSettings->getValue( 'time_offset' );
- $timeDiff *= -1;
-
- if( $timeDiff > 0 )
- $timeStamp->addSeconds( $timeDiff * 3600 );
- else
- $timeStamp->subtractSeconds( $timeDiff * (-3600));
- }
-
- $text = $format;
-
- if( strpos( $text, "%a" ) !== FALSE ) {
- $weekdayId = gmdate( "w", $time );
- $weekday = $this->_messages["days"][$weekdayId];
- if( !empty( $this->_messages["weekdaysshort"] ) )
- $shortWeekday = $this->_messages["weekdaysshort"][$weekdayId];
- else
- $shortWeekday = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($weekday), 0, 3 )) : substr($weekday, 0, 3);
-
- $text = str_replace( "%a", $shortWeekday, $text );
- }
- if( strpos( $text, "%A" ) !== FALSE ) {
- $weekdayId = gmdate( "w", $time );
- $text = str_replace( "%A", $this->_messages["days"][$weekdayId], $text );
- }
- if( strpos( $text, "%b" ) !== FALSE ) {
- $monthId = gmdate( "n", $time );
- $monthStr = $this->_messages["months"][$monthId-1];
- if( !empty( $this->_messages["monthsshort"] ) )
- $shortMonthStr = $this->_messages["monthsshort"][$monthId-1];
- else
- $shortMonthStr = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($monthStr), 0, 3 )) : substr($monthStr, 0, 3);
-
- $text = str_replace( "%b", $shortMonthStr, $text );
- }
- if( strpos( $text, "%B" ) !== FALSE ) {
- $monthId = gmdate( "n", $time );
- $text = str_replace( "%B", $this->_messages["months"][$monthId-1], $text );
- }
- if( strpos( $text, "%d" ) !== FALSE ) {
- $text = str_replace( "%d", gmdate( "d", $time ), $text );
- }
- if( strpos( $text, "%e" ) !== FALSE ) {
- $text = str_replace( "%e", intval(gmdate( "d", $time )), $text );
- }
- if( strpos( $text, "%j" ) !== FALSE ) {
- $text = str_replace( "%j", gmdate( "j", $time ), $text );
- }
- if( strpos( $text, "%H" ) !== FALSE ) {
- $text = str_replace( "%H", gmdate( "H", $time ), $text );
- }
- if( strpos( $text, "%I" ) !== FALSE ) {
- $text = str_replace( "%I", gmdate( "g", $time ), $text );
- }
- if( strpos( $text, "%p" ) !== FALSE ) {
- $text = str_replace( "%p", gmdate( "a", $time ), $text );
- }
- if( strpos( $text, "%P" ) !== FALSE ) {
- $text = str_replace( "%P", gmdate( "A", $time ), $text );
- }
- if( strpos( $text, "%M" ) !== FALSE ) {
- $text = str_replace( "%M", gmdate( "i", $time ), $text );
- }
- if( strpos( $text, "%m") !== FALSE ) {
- $text = str_replace( "%m", gmdate( "m", $time ), $text );
- }
- if( strpos( $text, "%S" ) !== FALSE ) {
- $text = str_replace( "%S", gmdate( "s", $time ), $text );
- }
- if( strpos( $text, "%y" ) !== FALSE ) {
- $text = str_replace( "%y", gmdate( "y", $time ), $text );
- }
- if( strpos( $text, "%Y" ) !== FALSE ) {
- $text = str_replace( "%Y", gmdate( "Y", $time ), $text );
- }
- if( strpos( $text, "%O" ) !== FALSE ) {
- $text = str_replace( "%O", "+0000", $text );
- }
- if( strpos( $text, "%G" ) !== FALSE ) {
- $text = str_replace( "%G", "+00:00", $text );
- }
- if( strpos( $text, "%%" ) !== FALSE ) {
- $text = str_replace( "%%", "%", $text );
- }
- if( strpos( $text, "%T" ) !== FALSE ) {
- $monthId = (int)$timeStamp->getMonth();
- $monthStr = $this->_messages["months"][$monthId-1];
-
- $text = str_replace( "%T", $this->getDateOrdinal( gmdate( "d", $time ))." ".$this->tr("of")." ".$monthStr, $text );
- }
- if( strpos( $text, "%D" ) !== FALSE ) {
- $text = str_replace( "%D", $this->getDateOrdinal( gmdate( "d", $time )), $text );
- }
-
- if ( $this->_code == 'fa_IR' )
- {
- lt_include( PLOG_CLASS_PATH."class/data/jalalicalendar.class.php" );
- list( $jyear, $jmonth, $jday ) = JalaliCalendar::gregorian_to_jalali(gmdate( "Y", $time ), gmdate( "m", $time ), gmdate( "d", $time ));
-
- if( strpos( $text, "%q" ) !== FALSE ) {
- $text = str_replace( "%q", JalaliCalendar::Convertnumber2farsi($jyear), $text );
- }
- if( strpos( $text, "%w" ) !== FALSE ) {
- $text = str_replace( "%w", JalaliCalendar::Convertnumber2farsi($jmonth), $text );
- }
- if( strpos( $text, "%o" ) !== FALSE ) {
- $text = str_replace( "%o", JalaliCalendar::Convertnumber2farsi($jday), $text );
- }
- if( strpos( $text, "%R" ) !== FALSE ) {
- $text = str_replace( "%R", JalaliCalendar::monthname($jmonth), $text );
- }
- if( strpos( $text, "%T" ) !== FALSE ) {
- $text = str_replace( "%T", JalaliCalendar::Convertnumber2farsi(gmdate( "H", $time )), $text );
- }
- if( strpos( $text, "%U" ) !== FALSE ) {
- $text = str_replace( "%U", JalaliCalendar::Convertnumber2farsi(gmdate( "i", $time )), $text );
- }
- }
-
- return $text;
- }
-
- /**
- * Formats a date as an RFC 822 date timestamp.
- * @see formatDate
- */
- function formatDateAsRFC822( $timestamp, $blog = null )
- {
- $locale = $this->getLocaleCode();
- $this->setLocale( "en_UK" );
- $rfc822Date = $this->formatDate( $timestamp, "%a, %d %b %Y %H:%M:%S %O", $blog );
- $this->setLocale( $locale );
-
- return( $rfc822Date );
- }
-
- /**
- * merges two locales
- */
- function mergeLocale( $locale )
- {
- if(isset($locale)){
- // load the file if it hadn't been loaded yet
- if( !is_array($this->_messages))
- $this->_loadLocaleFile();
-
- $this->_messages = array_merge( $this->_messages, $locale->getStrings());
- return true;
- }
- else{
- return false;
- }
- }
- }
-?>
\ No newline at end of file
Deleted: plog/branches/lifetype-1.2/class/locale/localefinder.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/locale/localefinder.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/locale/localefinder.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,63 +0,0 @@
-<?php
-
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
- lt_include( PLOG_CLASS_PATH."class/file/finder/filefinder.class.php" );
-
- /**
- * \ingroup Locale
- *
- * updates the list of locales based on what we can find on disk. It will add new ones
- * and remove old ones.
- *
- * @see FileFinder
- */
- class LocaleFinder extends FileFinder
- {
- function LocaleFinder( $localeFolder = null )
- {
- if( $localeFolder == null )
- $localeFolder = Locale::getLocaleFolder();
-
- $this->_localeFolder = $localeFolder;
-
- $this->FileFinder( $this->_localeFolder );
- }
-
- /**
- * reimplemented from FileFinder::getKeyForFile so that we can adapt locale filenames
- * to look like keys from our array
- *
- * @see FileFinder::getKeyForFile()
- */
- function getKeyForFile( $fileName )
- {
- // this regexp allows for more permissive locale names so that people can
- // at least have things like locale_xx_YY_utf-8.php
- $result = preg_match( REGEXP_VALID_LOCALE, $fileName, $matches );
-
- // in case there is some crap in the locale/ folder, then ignore
- // it (that is, if the file name does not match our regexp!
- if( !$result )
- $fileKey = null;
- else
- $fileKey = $matches[1];
-
- return( $fileKey );
- }
-
- /**
- * provides default parameters for the FileFinder::find() method
- *
- * @see FileFinder::find()
- * @return An array with the new locales found in the disk
- */
- function find()
- {
- // first find the new ones
- parent::find( Locales::getAvailableLocales(), "locale_*.php" );
-
- // and then return them, if any
- return( $this->getNew());
- }
- }
-?>
\ No newline at end of file
Deleted: plog/branches/lifetype-1.2/class/locale/locales.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/locale/locales.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/locale/locales.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,383 +0,0 @@
-<?php
-
-
- lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locale.class.php" );
- lt_include( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
- lt_include( PLOG_CLASS_PATH.'class/dao/daocacheconstants.properties.php' );
-
- define("DEFAULT_LOCALE", "en_UK");
- define( "REGEXP_VALID_LOCALE", "/.*locale_([a-z]{2}_[A-Z]{2}_?([a-zA-Z0-9\-]*)+)\.php$/" );
-
- /**
- * \ingroup Locale
- *
- * Class that supports methods such as getAvailableLocales, addLocale
- * removeLocale and so on, basically to deal with locale files.
- *
- * It also provides a singleton-like method called Locales::getLocale to load and cache locale
- * files from disk, so that we don't have to fetch the same file as many times
- * as we ask for it but else, we keep a cached copy of it for later use. It is advised to
- * use this method instead of creating a new Locale object every time we need a Locale.
- *
- * @see Locales::getLocale
- * @see Locale
- */
- class Locales
- {
-
- function Locales()
- {
-
- }
-
- /**
- * @static
- * Static method that offers some kind of locale factory. Since the Locale object
- * better not use a Singleton (otherwise we couldn't use more than one locale file
- * at a time) this function has been included here to provide a system similar to
- * a singleton: we keep an static array inside the function, that contains all the
- * locale files that have been loaded so far. Whenever somebody requests a locale
- * to be fetched from disk, we will first check that we have not loaded it before. If
- * we have, then we only have to return the same object we were keeping.
- * If the locale wasn't there, we will then load it from disk and store/cache the
- * resulting object for future use.
- * It is recommended to use this method over creating new Locale objects every time
- * we need one.
- *
- * @param localeCode The code (eg. en_UK, es_ES) of the locale we want to get.
- * @return Returns a Locale object corresponding to the requested locale.
- * @see Locale
- */
- function &getBlogLocale( $localeCode = null )
- {
- lt_include( PLOG_CLASS_PATH."class/locale/bloglocale.class.php" );
-
- // array to keep track of the locales that we have already loaded, so that
- // we don't have to fetch them from disk
- static $loadedLocales;
-
- // if there is no locale parameter, we use the default one
- if( $localeCode == null ) {
- $config =& Config::getConfig();
- $localeCode = $config->getValue( "default_locale" );
- }
-
- // check if we have already loaded that locale or else, load it from
- // disk and keep it for later, just in case anybody asks again
- if( isset($loadedLocales[$localeCode]) ) {
- $locale = $loadedLocales[$localeCode];
- }
- else {
- lt_include( PLOG_CLASS_PATH . "class/cache/cachemanager.class.php" );
- $cache =& CacheManager::getCache();
- $locale = $cache->getData( $localeCode, CACHE_BLOG_LOCALES );
- if ( !$locale ) {
- $locale = new BlogLocale( $localeCode );
- $cache->setData( $localeCode, CACHE_BLOG_LOCALES, $locale );
- }
-
- Locales::_loadPluginLocales( $locale );
- }
-
- $loadedLocales[$localeCode] = $locale;
-
- return $locale;
- }
-
- function _loadPluginLocales( &$locale )
- {
- $localeCode = $locale->getLocaleCode();
-
- $pm =& PluginManager::getPluginManager();
- foreach( $pm->_pluginList as $pluginId ) {
- if( $pm->pluginHasLocale( $pluginId, $localeCode )) {
- // if the plugin provides the locale that we need, continue
- $pluginLocale = Locales::getPluginLocale( $pluginId, $localeCode );
- }
- else {
- // if not, try to load en_UK by default
- if( $pm->pluginHasLocale( $pluginId, "en_UK" )) {
- $pluginLocale = Locales::getPluginLocale( $pluginId, "en_UK" );
- }
- // if not en_UK locale available, forget about it...
- }
-
- // merge the plugin locale with the big locale
- if ( isset( $pluginLocale ) ) {
- $locale->mergeLocale( $pluginLocale );
- }
- }
-
- return( true );
- }
-
- /**
- * @static
- * Static method that offers some kind of locale factory. Since the Locale object
- * better not use a Singleton (otherwise we couldn't use more than one locale file
- * at a time) this function has been included here to provide a system similar to
- * a singleton: we keep an static array inside the function, that contains all the
- * locale files that have been loaded so far. Whenever somebody requests a locale
- * to be fetched from disk, we will first check that we have not loaded it before. If
- * we have, then we only have to return the same object we were keeping.
- * If the locale wasn't there, we will then load it from disk and store/cache the
- * resulting object for future use.
- * It is recommended to use this method over creating new Locale objects every time
- * we need one.
- *
- * @param localeCode The code (eg. en_UK, es_ES) of the locale we want to get.
- * @return Returns a Locale object corresponding to the requested locale.
- * @see Locale
- */
- function &getLocale( $localeCode = null )
- {
- // array to keep track of the locales that we have already loaded, so that
- // we don't have to fetch them from disk
- static $loadedLocales;
-
- // if there is no locale parameter, we use the default one
- if( $localeCode == null ) {
- $config =& Config::getConfig();
- $localeCode = $config->getValue( "default_locale" );
- }
-
- // check if we have already loaded that locale or else, load it from
- // disk and keep it for later, just in case anybody asks again
- if( isset($loadedLocales[$localeCode]) ) {
- $locale = $loadedLocales[$localeCode];
- }
- else {
- lt_include( PLOG_CLASS_PATH . "class/cache/cachemanager.class.php" );
- $cache =& CacheManager::getCache();
- $locale = $cache->getData( $localeCode, CACHE_LOCALES );
- if ( !$locale ) {
- $locale = new Locale( $localeCode );
- $cache->setData( $localeCode, CACHE_LOCALES, $locale );
- }
-
- Locales::_loadPluginLocales( $locale );
- }
-
- $loadedLocales[$localeCode] = $locale;
-
- return $locale;
- }
-
- /**
- * loads the locale file provided by a plugin. First it will try to load the locale specified in
- * the $pluginId parameter and if not available, it will load the current default locale.
- *
- * @param localeCode The locale code we would like to load
- * @return A PluginLocale object with the translated strings loaded from the plugin's own folder
- */
- function getPluginLocale( $pluginId, $localeCode = null )
- {
- global $_plugins_loadedLocales;
-
- if( $localeCode == null ) {
- $config =& Config::getConfig();
- $localeCode = $config->getValue( "default_locale" );
- }
-
- //$pluginLocaleKey = "plugin_".$pluginId."_".$localeCode;
- $pluginLocaleKey = $pluginId;
-
- // check if we have already loaded that locale or else, load it from
- // disk and keep it for later, just in case anybody asks again
- if( isset($_plugins_loadedLocales[$pluginLocaleKey][$localeCode] )) {
- $locale = $_plugins_loadedLocales[$pluginLocaleKey][$localeCode];
- }
- else {
- lt_include( PLOG_CLASS_PATH."class/locale/pluginlocale.class.php" );
-
- $locale = new PluginLocale( $pluginId, $localeCode );
- $_plugins_loadedLocales[$pluginLocaleKey][$localeCode] = $locale;
- }
-
- return $locale;
- }
-
- /**
- * Returns an array with the codes of the locale files available.
- *
- * @return An array containing all the locale codes available in the system.
- * @static
- */
- function getAvailableLocales()
- {
- $config =& Config::getConfig();
-
- $locales = $config->getValue( "locales" );
-
- // in order to prevent some ugly error messages
- if( !is_array( $locales ))
- $locales = Array();
-
- return( $locales );
- }
-
- /**
- * Returns default locale code
- *
- * @return default locale code
- */
-
- function getDefaultLocale()
- {
- return DEFAULT_LOCALE;
- }
-
- /**
- * Returns true if the given locale code is a valid one (i.e. if it is amongst
- * the available ones
- *
- * @param localeCode The code of the locale we'd like to check
- * @return Returns 'true' if the locale file is already available in the system
- * or false otherwise.
- * @static
- */
- function isValidLocale( $localeCode )
- {
- $availableLocales = Locales::getAvailableLocales();
-
- return in_array( $localeCode, $availableLocales );
- }
-
- /**
- * returns whether a file has the corect name format
- *
- * @param fileName
- * @return true if format is correct or false otherwise
- */
- function isValidLocaleFileName( $fileName )
- {
- return( preg_match( REGEXP_VALID_LOCALE, $fileName ));
- }
-
- /**
- * Returns an array with all the locales available in the system.
- *
- * This is quite memory and disk-intensive since we are loading a lot of lines
- * from possibly a lot of files!!!
- *
- * @return Returns an array of Locale objects, which represent *all* the locales
- * that have been installed in this system.
- * @static
- */
- function getLocales()
- {
- $localeCodes = Locales::getAvailableLocales();
-
- $locales = Array();
- foreach( $localeCodes as $code ) {
- array_push( $locales, Locales::getLocale( $code ));
- }
-
- return $locales;
- }
-
- /**
- * Given a locale code, returns the path to the file that contains it.
- *
- * @param localeCode The code representing the locale
- * @return A string containing the path (may be absolute or relative, it depends)
- * to the file containing the given locale. It does *not* check if the file exists
- * or not, simply returns its path.
- */
- function getLocaleFilename( $localeCode )
- {
- return (Locale::getLocaleFolder()."/locale_".$localeCode.".php");
- }
-
- /**
- * Given a locale code, returns the path to the file that contains its admin version.
- *
- * @param localeCode The code representing the locale
- * @return A string containing the path (may be absolute or relative, it depends)
- * to the file containing the given locale. It does *not* check if the file exists
- * or not, simply returns its path.
- */
- function getAdminLocaleFilename( $localeCode )
- {
- return (Locale::getLocaleFolder()."/admin/locale_".$localeCode.".php");
- }
-
- /**
- * Removes a locale from the system. First the file containing it is deleted
- * and then we also remove its entry from the configuration.
- *
- * @param localeCode The code of the locale that we would like to delete.
- * @return Returns true if the locale was removed succesfully or false otherwise.
- */
- function removeLocale( $localeCode )
- {
- $config =& Config::getConfig();
-
- // if we don't have permissions on the folder where the locale files
- // are stored, we don't even have to bother about it...
- if(!File::isWritable(Locale::getLocaleFolder()))
- return false;
-
- // does the locale really exist?
- if( !$this->isValidLocale( $localeCode ))
- return false;
-
- // remove the blog locale
- $fileName = $this->getLocaleFilename( $localeCode );
- if( File::exists( $fileName )) {
- if( !unlink( $fileName ))
- return false;
- }
- // and the admin locale
- $fileName = $this->getAdminLocaleFilename( $localeCode );
- if( File::exists( $fileName )) {
- if( !unlink( $fileName ))
- return false;
- }
-
- $availableLocales = $config->getValue( "locales" );
-
- $newLocaleList = Array();
- foreach( $availableLocales as $locale ) {
- if( $locale != $localeCode )
- array_push( $newLocaleList, $locale );
- }
-
- $config->saveValue( "locales", $newLocaleList );
-
- return true;
- }
-
- /**
- * Adds a new locale to the list of available/supported locale. It checks to make
- * sure that the file exists and that has proper access permissions.
- *
- * @param localeCode the code of the locale we'd like to add.
- * @return Returns true if the file was successfully added or false otherwise.
- */
- function addLocale( $localeCode )
- {
- $config =& Config::getConfig();
-
- // if the locale is already there, there is no need to add it,
- // since the user is *maybe* just updating the file.
- if( $this->isValidLocale( $localeCode ))
- return true;
-
- $fileName = $this->getLocaleFilename( $localeCode );
-
- // make sure that the file exists and can be read and
- // give up if not so
- if( !File::isReadable( $fileName ))
- return false;
-
- // otherwise, we can happily add it to the list of supported locales
- $availableLocales = $this->getAvailableLocales();
- array_push( $availableLocales, $localeCode );
- $config->saveValue( "locales", $availableLocales );
-
- return true;
- }
- }
-?>
Copied: plog/branches/lifetype-1.2/class/locale/ltlocale.class.php (from rev 7132, plog/branches/lifetype-1.2/class/locale/locale.class.php)
===================================================================
--- plog/branches/lifetype-1.2/class/locale/ltlocale.class.php (rev 0)
+++ plog/branches/lifetype-1.2/class/locale/ltlocale.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -0,0 +1,853 @@
+<?php
+
+ /**
+ * \defgroup LTLocale
+ *
+ * The LTLocale module is used for localization purposes. Its main class is the LTLocale class
+ * that is capable of loading very simple php files containing a big array of string identifiers
+ * and their translations. The main method of the class is the LTLocale::tr() that given a string
+ * identifier, will return the translated version.
+ *
+ * Locale files can also specify default encodings and very basic date and time formats (this will
+ * be improved in next version) At the moment it is also possible to use right-to-left languages
+ * even though there is none available yet.
+ *
+ * The LTLocales class is the preferred way to load translations from disk since it has
+ * caching mechanisms so that we don't have to load the data everytime from disk.
+ *
+ * Please see http://wiki.lifetype.net/index.php/Translating_LifeType for more information regading
+ * how to work with locale files in LifeType.
+ *
+ * @see LTLocale
+ * @see LTLocales
+ */
+
+
+ lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
+
+ define( "DEFAULT_LOCALE_FOLDER", PLOG_CLASS_PATH . "locale" );
+
+ /**
+ * default locale format that will be used if none available
+ */
+ define( "DEFAULT_LOCALE_FORMAT", "%d/%m/%Y %H:%M" );
+
+ /**
+ * default encoding if the locale does not specify one
+ */
+ define( "DEFAULT_ENCODING", "iso-8859-1" );
+
+ /**
+ * default direction for texts, if the locale does not specify one
+ */
+ define( "DEFAULT_DIRECTION", "ltr" );
+
+ /**
+ * default first day fot calendar
+ */
+ define( "DEFAULT_FIRST_DAY_OF_WEEK", 1 );
+
+ /**
+ * \ingroup LTLocale
+ *
+ * Class used to localize messages and things such as dates and numbers.
+ *
+ * To use this class, we will have to provide a file containing an array
+ * of the form:
+ *
+ * <pre>
+ * $messages["identifier"] = "Translated text"
+ * </pre>
+ *
+ * The file will be loaded when creating this object and must be called following
+ * the same scheme: locale_lang_COUNTRY (see constructor on locales namig schemes)
+ *
+ * When we want to translate a string, we will have to use its identifier, that will
+ * be looked up in the array containing all the messages. If there is a message for that
+ * identifier, it will be returned or a empty string otherwise.
+ *
+ * This class is extensively used throughout the templates to localize texts, dates
+ * and numbers, being the formatDate function one of the most importants of this class.
+ *
+ * <b>IMPORTANT:</b> For performance reasons, it is recommended to use the LTLocales::getLocale
+ * method instead of creating new LTLocale objects every time we need one. The getLocale methods
+ * offers caching capabilities so that the file with the messages will not need to be fetched
+ * every time from disk.
+ * @see LTLocales::getLocale()
+ */
+ class LTLocale
+ {
+
+ var $_defaultFolder;
+ var $_code; // our ISO locale code, eg. es_ES, en_UK, etc
+ var $_cache;
+ var $_messages;
+ var $_charset;
+ var $_description;
+ var $_dateFormat;
+ var $_firstDayOfWeek;
+ var $_dataLoaded;
+
+ /**
+ * Constructor.
+ *
+ * @param $code Code follows the Java naming scheme: language_COUNTRY, so
+ * for example if we want to have the texts translated in the English spoken
+ * in the UK, we'd have to use en_UK as the code. The two digits country
+ * code and language code are ISO standards and can be found in
+ * http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html (country codes) and
+ * http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_639.html (language codes)
+ */
+ function LTLocale( $code )
+ {
+ $this->_code = $code;
+
+ $this->_loadLocaleInfo();
+
+ if( $this->_charset == "" )
+ $this->_charset = DEFAULT_ENCODING;
+
+ $this->_dataLoaded = false;
+ }
+
+ /**
+ * @private
+ */
+ function _loadLocaleFile()
+ {
+ $this->_defaultFolder = $this->getLocaleFolder();
+
+ // load the blog locale
+ $fileName = $this->_defaultFolder."/locale_".$this->_code.".php";
+ if( File::isReadable( $fileName )){
+ // TODO: this function is only called once, right?
+ include( $fileName );
+ }
+ if ( !isset($messages) || !is_array( $messages ) ) {
+ $messages = array();
+ }
+ $this->_messages = $messages;
+
+ // load the admin locale
+ $fileName = $this->_defaultFolder."/admin/locale_".$this->_code.".php";
+ if( File::isReadable( $fileName )){
+ // TODO: this function is only called once, right?
+ include( $fileName );
+ }
+ if ( !isset($messages) || !is_array( $messages ) ) {
+ $messages = array();
+ }
+ $this->_messages = array_merge( $this->_messages, $messages );
+
+ $this->_dataLoaded = true;
+
+ unset($messages);
+ }
+
+ /**
+ * @private
+ * Loads the locale file, extracts the information needed and frees the used memory
+ */
+ function _loadLocaleInfo()
+ {
+
+ if( !is_array($this->_messages) ) {
+ // load the locale into $this->_messages
+ $this->_loadLocaleFile();
+ }
+
+ // get the info that we need
+ $this->_description = isset($this->_messages["locale_description"]) ? $this->_messages["locale_description"] : "no description for " . $this->_code;
+ $this->_charset = isset($this->_messages["encoding"]) ? $this->_messages["encoding"] : DEFAULT_ENCODING;
+ $this->_direction = isset($this->_messages["direction"]) ? $this->_messages["direction"] : DEFAULT_DIRECTION;
+ $this->_dateFormat = isset($this->_messages["date_format"]) ? $this->_messages["date_format"] : DEFAULT_LOCALE_FORMAT;
+ $this->_firstDayOfWeek = isset($this->_messages["first_day_of_week"]) ? $this->_messages["first_day_of_week"] : DEFAULT_FIRST_DAY_OF_WEEK;
+
+ unset( $this->_messages );
+
+ $this->_messages = NULL;
+
+ return( true );
+ }
+
+ /**
+ * Returns the character encoding method used by the current locale file. It has to be a valid
+ * character encoding, since it will be used in the header of the html file to tell the browser
+ * which is the most suitable encoding that should be used.
+ *
+ * @return A valid character encoding method.
+ */
+ function getCharset()
+ {
+ return $this->_charset;
+ }
+
+ /**
+ * returns the direction in which this language is written.
+ * Possible values are, as with the html standard, "rtl" or "ltr"
+ *
+ */
+ function getDirection()
+ {
+ $direction = $this->_direction;
+ if( $direction != "rtl" )
+ $direction = "ltr";
+
+ return $direction;
+ }
+
+ /**
+ * Returns an optional locale description string that can be included in the
+ * locale file with the other texts.
+ *
+ * @return A string describing the locale file.
+ */
+ function getDescription()
+ {
+ return( $this->_description );
+ }
+
+ /**
+ * @static
+ */
+ function getLocaleFolder()
+ {
+ $config =& Config::getConfig();
+
+ $localeFolder = $config->getValue( "locale_folder" );
+ if( $localeFolder == "" || $localeFolder == "./locale")
+ $localeFolder = DEFAULT_LOCALE_FOLDER;
+
+ return $localeFolder;
+ }
+
+ /**
+ * Changes the locale to something else than what we chose in the first place when
+ * creating the object.
+ *
+ * @param code follows the same format as in the constructor.
+ */
+ function setLocale( $code )
+ {
+ $this->_code = $code;
+
+ $this->_loadLocaleFile();
+ }
+
+ /**
+ * returns all the strings
+ *
+ * @return An array containing all the strings that this locale supports
+ */
+ function getStrings()
+ {
+ // load the file if it hadn't been loaded yet
+ if( !is_array($this->_messages))
+ $this->_loadLocaleFile();
+
+ return $this->_messages;
+ }
+
+ /**
+ * Translates a string
+ *
+ * @param id Identifier of the message we would like to translate
+ */
+ function tr( $id )
+ {
+ // load the file if it hasn't been loaded yet
+ if( !$this->_dataLoaded ) {
+ $this->_loadLocaleFile();
+ }
+
+ isset( $this->_messages[$id] ) ? $string = $this->_messages[$id] : $string = $id;
+ if( $string == "" ) $string = $id;
+
+ return $string;
+ }
+
+ /**
+ * Alias for getString
+ * @see getString
+ */
+ function i18n( $id )
+ {
+ return $this->getString( $id );
+ }
+
+ /**
+ * calls printf on the translated string.
+ *
+ * Crappy Crappy! Since it only accepts three arguments... ;) Well, if we
+ * ever need more than three, I'll change it!
+ * @private
+ */
+ function pr( $id, $arg1 = null, $arg2 = null, $arg3 = null )
+ {
+ // first of all, we translate the string
+ $str = $this->tr( $id );
+ if( $arg1 == null )
+ $result = $str;
+ else if( $arg2 == null )
+ $result = sprintf( $str, $arg1 );
+ else if( $arg3 == null )
+ $result = sprintf( $str, $arg1, $arg2 );
+ else
+ $result = sprintf( $str, $arg1, $arg2, $arg3 );
+
+ return $result;
+ }
+
+ /**
+ * Returns the complete code
+ *
+ * @return The Locale code
+ */
+ function getLocaleCode()
+ {
+ return $this->_code;
+ }
+
+ /**
+ * Returns the two-character language code
+ *
+ * @return The two-character language code
+ */
+ function getLanguageId()
+ {
+ $countryId = substr( $this->_code, 3, 5 );
+ if ( strcmp( $countryId, "TW" ) == 0 || strcmp( $countryId, "CN") ==0 ) {
+ $langId = substr( $this->_code, 0, 2 );
+ return $langId."-".$countryId;
+ }
+ else {
+ return substr( $this->_code, 0, 2 );
+ }
+ }
+
+ /**
+ * Returns the two-character country code
+ *
+ * @return The two-character country code.
+ */
+ function getCountryId()
+ {
+ return substr( $this->_code, 3, 5 );
+ }
+
+ /**
+ * Returns the first day of the week, which also depends on the country
+ *
+ * @return Returns 0 for Sunday, 1 for Monday and so on...
+ */
+ function firstDayOfWeek()
+ {
+ return $this->_firstDayOfWeek;
+ }
+
+ /**
+ * Returns all the months of the year
+ *
+ * @return Returns an array containing the names of the months, where the
+ * first one is January.
+ */
+ function getMonthNames()
+ {
+ // load the file if it hadn't been loaded yet
+ if( !is_array($this->_messages))
+ $this->_loadLocaleFile();
+
+ return $this->_messages["months"];
+ }
+
+ /**
+ * Returns the days of the week
+ *
+ * @return Returns the names of the days of the week, where the first one is
+ * Sunday.
+ */
+ function getDayNames()
+ {
+ // load the file if it hadn't been loaded yet
+ if( !is_array($this->_messages))
+ $this->_loadLocaleFile();
+
+ return $this->_messages["days"];
+ }
+
+ /**
+ * Returns the shorter version of the days of the week
+ *
+ * @return Returns an array with the days of the week abbreviated, where the first
+ * one is Sunday.
+ */
+ function getDayNamesShort()
+ {
+ // load the file if it hadn't been loaded yet
+ if( !is_array($this->_messages))
+ $this->_loadLocaleFile();
+
+ return $this->_messages["daysshort"];
+ }
+
+ function _getOrdinal( $num )
+ {
+ // first we check the last two digits
+ $last_two_digits = substr( $num, -2 );
+ if( $last_two_digits == "11" )
+ $value = $num."th";
+ elseif( $last_two_digits == "12" )
+ $value = $num."th";
+ elseif( $last_two_digits == "13" )
+ $value = $num."th";
+ else {
+ // we get the last digit
+ $last_digit = substr( $num, -1 );
+
+ if( $num < 10 )
+ $num = $last_digit;
+
+ if( $last_digit == "1" )
+ $value = $num."st";
+ elseif( $last_digit == "2" )
+ $value = $num."nd";
+ elseif( $last_digit == "3" )
+ $value = $num."rd";
+ else
+ $value = $num."th";
+ }
+
+ return $value;
+ }
+
+ /**
+ * Returns the day in an ordinal format, i.e. 1st, 2nd, 3rd, etc (in English)
+ *
+ * @return A string with the ordinal representation of the day.
+ */
+ function getDateOrdinal( $date )
+ {
+ $dayOrdinal = $date;
+ $last_digit = substr( $dayOrdinal, -1 );
+ if( $dayOrdinal < 10 )
+ $dayOrdinal = $last_digit;
+
+ switch( $this->getLanguageId()) {
+ case "es":
+ case "ca":
+ break;
+ case "de":
+ case "fi":
+ $dayOrdinal .= "."; break;
+ case "en":
+ default:
+ $dayOrdinal = $this->_getOrdinal( $date); break;
+ }
+
+ return $dayOrdinal;
+ }
+
+ function getDayOrdinal( $t )
+ {
+ $dayOrdinal = $t->getDay();
+ return $this->getDateOrdinal( $dayOrdinal );
+ }
+
+
+ /**
+ * Formats the date of a Timestamp object according to the given format:
+ *
+ * (compatible with PHP):<ul>
+ * <li>%a abbreviated weekday</li>
+ * <li>%A complete weekday</li>
+ * <li>%b abbreviated month</li>
+ * <li>%B long month</li>
+ * <li>%d day of the month, 2 digits with leading zero</li>
+ * <li>%j day of the month, numeric (without leading zero)</li>
+ * <li>%H hours, in 24-h format</li>
+ * <li>%I hours, in 12-h format (without leading zero)</li>
+ * <li>%p returns 'am' or 'pm'</li>
+ * <li>%P returns 'AM' or 'PM'</li>
+ * <li>%M minutes</li>
+ * <li>%m month number, from 00 to 12</li>
+ * <li>%S seconds</li>
+ * <li>%y 2-digit year representation</li>
+ * <li>%Y 4-digit year representation</li>
+ * <li>%O Difference to Greenwich time (GMT) in hours, format will be +0000</li>
+ * <li>%G Difference to Greenwich time (GMT) in hours, format will be +00:00</li>
+ * <li>%% the '%' character
+ * </ul>
+ * (these have been added by myself and are therefore incompatible with php)<ul>
+ * <li>%T "_day_ of _month_", where the day is in ordinal form and 'month' is the name of the month</li>
+ * <li>%D cardinal representation of the day</li>
+ * </ul>
+ */
+ function formatDate( $timeStamp, $format = null, $blog = null )
+ {
+ // load the file if it hadn't been loaded yet
+ if( !is_array($this->_messages))
+ $this->_loadLocaleFile();
+
+ // if the user did not specify a format, let's use the default one
+ if( $format == null )
+ $format = $this->_dateFormat;
+
+ // Get the unix time stamp
+ if( strtolower(get_class( $timeStamp )) == "timestamp") {
+ $time = $timeStamp->getTimestamp(DATE_FORMAT_UNIXTIME);
+ }
+ else {
+ // we can assume it's a unix timestamp
+ $time = $timeStamp;
+ $timeStamp = new Timestamp( $time );
+ }
+
+ $timeZoneSec = date("Z", $time);
+ if ( $blog ) {
+ //
+ // The blog was specified. Use it to get the time offset
+ //
+ $timeDiff = 0;
+ $blogSettings = $blog->getSettings();
+ $timeDiff = $blogSettings->getValue( 'time_offset' );
+
+ // The following line relies on the fact that the result will
+ // be an int.
+ $timeZoneSec += ( $timeDiff * 3600 );
+ }
+
+ $text = $format;
+
+ if( strpos( $text, "%a" ) !== FALSE ) {
+ $weekdayId = $timeStamp->getWeekdayId();
+ $weekday = $this->_messages["days"][$weekdayId];
+ if( !empty( $this->_messages["weekdaysshort"] ) )
+ $shortWeekday = $this->_messages["weekdaysshort"][$weekdayId];
+ else
+ $shortWeekday = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($weekday), 0, 3 )) : substr($weekday, 0, 3);
+ $text = str_replace( "%a", $shortWeekday, $text );
+ }
+ if( strpos( $text, "%A" ) !== FALSE ) {
+ $weekdayId = $timeStamp->getWeekdayId();
+ $text = str_replace( "%A", $this->_messages["days"][$weekdayId], $text );
+ }
+ if( strpos( $text, "%b" ) !== FALSE ) {
+ $monthId = (int)$timeStamp->getMonth();
+ $monthStr = $this->_messages["months"][$monthId-1];
+ if( !empty( $this->_messages["monthsshort"] ) )
+ $shortMonthStr = $this->_messages["monthsshort"][$monthId-1];
+ else
+ $shortMonthStr = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($monthStr), 0, 3 )) : substr($monthStr, 0, 3);
+
+ $text = str_replace( "%b", $shortMonthStr, $text );
+ }
+ if( strpos( $text, "%B" ) !== FALSE ) {
+ $monthId = (int)$timeStamp->getMonth();
+ $text = str_replace( "%B", $this->_messages["months"][$monthId-1], $text );
+ }
+ if( strpos( $text, "%d" ) !== FALSE ) {
+ $text = str_replace( "%d", ($timeStamp->getDay() < 10) ? "0".$timeStamp->getDay() : $timeStamp->getDay(), $text );
+ }
+ if( strpos( $text, "%e" ) !== FALSE ) {
+ $text = str_replace( "%e", intval($timeStamp->getDay()), $text );
+ }
+ if( strpos( $text, "%j" ) !== FALSE ) {
+ $text = str_replace( "%j", $timeStamp->getDay(), $text );
+ }
+ if( strpos( $text, "%H" ) !== FALSE ) {
+ $text = str_replace( "%H", $timeStamp->getHour(), $text );
+ }
+ if( strpos( $text, "%I" ) !== FALSE ) {
+ $text = str_replace( "%I", ($timeStamp->getHour() != 0) ? ($timeStamp->getHour() > 12) ? $timeStamp->getHour()-12 : $timeStamp->getHour()+0 : 12, $text );
+ }
+ if( strpos( $text, "%p" ) !== FALSE ) {
+ $text = str_replace( "%p", $timeStamp->getHour() >= 12 ? "pm" : "am", $text );
+ }
+ if( strpos( $text, "%P" ) !== FALSE ) {
+ $text = str_replace( "%P", $timeStamp->getHour() >= 12 ? "PM" : "AM", $text );
+ }
+ if( strpos( $text, "%M" ) !== FALSE ) {
+ $text = str_replace( "%M", $timeStamp->getMinutes(), $text );
+ }
+ if( strpos( $text, "%m" ) !== FALSE ) {
+ $text = str_replace( "%m", $timeStamp->getMonth(), $text );
+ }
+ if( strpos( $text, "%S" ) !== FALSE ) {
+ $text = str_replace( "%S", $timeStamp->getSeconds(), $text );
+ }
+ if( strpos( $text, "%y" ) !== FALSE ) {
+ $text = str_replace( "%y", substr($timeStamp->getYear(), 2, 4 ), $text );
+ }
+ if( strpos( $text, "%Y" ) !== FALSE ) {
+ $text = str_replace( "%Y", $timeStamp->getYear(), $text );
+ }
+ if( strpos( $text, "%O" ) !== FALSE ) {
+ // Now convert the time zone seconds to hours and minutes
+ $timeZoneHours = intval( abs($timeZoneSec) / 3600 );
+ $timeZoneMins = intval(( abs($timeZoneSec) % 3600 ) / 60 );
+ $timeZoneDirection = ($timeZoneSec < 0 ) ? "-" : "+";
+
+ $text = str_replace( "%O", sprintf( "%s%02d%02d", $timeZoneDirection, $timeZoneHours, $timeZoneMins ), $text );
+ }
+ if( strpos( $text, "%G" ) !== FALSE ) {
+ // Now convert the time zone seconds to hours and minutes
+ $timeZoneHours = intval( abs($timeZoneSec) / 3600 );
+ $timeZoneMins = intval(( abs($timeZoneSec) % 3600 ) / 60 );
+ $timeZoneDirection = ($timeZoneSec < 0 ) ? "-" : "+";
+
+ $text = str_replace( "%G", sprintf( "%s%02d:%02d", $timeZoneDirection, $timeZoneHours, $timeZoneMins ), $text );
+ }
+ if( strpos( $text, "%%" ) !== FALSE ) {
+ $text = str_replace( "%%", "%", $text );
+ }
+ if( strpos( $text, "%T" ) !== FALSE ) {
+ $monthId = (int)$timeStamp->getMonth();
+ $monthStr = $this->_messages["months"][$monthId-1];
+
+ $text = str_replace( "%T", $this->getDayOrdinal( $timeStamp )." ".$this->tr("of")." ".$monthStr, $text );
+ }
+ if( strpos( $text, "%D" ) !== FALSE ) {
+ $text = str_replace( "%D", $this->getDayOrdinal( $timeStamp ), $text );
+ }
+
+ if ( $this->_code == 'fa_IR' )
+ {
+ lt_include( PLOG_CLASS_PATH."class/data/jalalicalendar.class.php" );
+ list( $jyear, $jmonth, $jday ) = JalaliCalendar::gregorian_to_jalali(gmdate( "Y", $time ), gmdate( "m", $time ), gmdate( "d", $time ));
+
+ if( strpos( $text, "%q" ) !== FALSE ) {
+ $text = str_replace( "%q", JalaliCalendar::Convertnumber2farsi($jyear), $text );
+ }
+ if( strpos( $text, "%w" ) !== FALSE ) {
+ $text = str_replace( "%w", JalaliCalendar::Convertnumber2farsi($jmonth), $text );
+ }
+ if( strpos( $text, "%o" ) !== FALSE ) {
+ $text = str_replace( "%o", JalaliCalendar::Convertnumber2farsi($jday), $text );
+ }
+ if( strpos( $text, "%R" ) !== FALSE ) {
+ $text = str_replace( "%R", JalaliCalendar::monthname($jmonth), $text );
+ }
+ if( strpos( $text, "%T" ) !== FALSE ) {
+ $text = str_replace( "%T", JalaliCalendar::Convertnumber2farsi($timeStamp->getHour()), $text );
+ }
+ if( strpos( $text, "%U" ) !== FALSE ) {
+ $text = str_replace( "%U", JalaliCalendar::Convertnumber2farsi($timeStamp->getMinutes()), $text );
+ }
+ }
+
+ return $text;
+ }
+
+ /**
+ * Formats the date of a Timestamp object according to the given format:
+ * This function assumes that the timestamp is local and it converts it
+ * to GMT before formatting.
+ *
+ * (compatible with PHP):<ul>
+ * <li>%a abbreviated weekday</li>
+ * <li>%A complete weekday</li>
+ * <li>%b abbreviated month</li>
+ * <li>%B long month</li>
+ * <li>%d day of the month, 2 digits with leading zero</li>
+ * <li>%j day of the month, numeric (without leading zero)</li>
+ * <li>%H hours, in 24-h format</li>
+ * <li>%I hours, in 12-h format (without leading zero)</li>
+ * <li>%p returns 'am' or 'pm'</li>
+ * <li>%P returns 'AM' or 'PM'</li>
+ * <li>%M minutes</li>
+ * <li>%m month number, from 00 to 12</li>
+ * <li>%S seconds</li>
+ * <li>%y 2-digit year representation</li>
+ * <li>%Y 4-digit year representation</li>
+ * <li>%O Difference to Greenwich time (GMT) in hours (Will always be +0000)</li>
+ * <li>%G Difference to Greenwich time (GMT) in hours (Will always be +00:00)</li>
+ * <li>%% the '%' character
+ * </ul>
+ * (these have been added by myself and are therefore incompatible with php)<ul>
+ * <li>%T "_day_ of _month_", where the day is in ordinal form and 'month' is the name of the month</li>
+ * <li>%D cardinal representation of the day</li>
+ * </ul>
+ */
+ function formatDateGMT( $timeStamp, $format = null, $blog = null )
+ {
+
+
+ // load the file if it hadn't been loaded yet
+ if( !is_array($this->_messages))
+ $this->_loadLocaleFile();
+
+ // if the user did not specify a format, let's use the default one
+ if( $format == null )
+ $format = $this->_dateFormat;
+
+ // Get the unix time stamp
+ if( strtolower(get_class( $timeStamp )) == "timestamp") {
+ $time = $timeStamp->getTimestamp(DATE_FORMAT_UNIXTIME);
+ }
+ else {
+ // we can assume it's a unix timestamp
+ $time = $timeStamp;
+ $timeStamp = new Timestamp( $time );
+ }
+ $timeZoneSec = date("Z", $time);
+ if ( $blog ) {
+ //
+ // The blog was specified. Use it to get the time offset
+ //
+ $timeDiff = 0;
+ $blogSettings = $blog->getSettings();
+ $timeDiff = $blogSettings->getValue( 'time_offset' );
+ $timeDiff *= -1;
+
+ if( $timeDiff > 0 )
+ $timeStamp->addSeconds( $timeDiff * 3600 );
+ else
+ $timeStamp->subtractSeconds( $timeDiff * (-3600));
+ }
+
+ $text = $format;
+
+ if( strpos( $text, "%a" ) !== FALSE ) {
+ $weekdayId = gmdate( "w", $time );
+ $weekday = $this->_messages["days"][$weekdayId];
+ if( !empty( $this->_messages["weekdaysshort"] ) )
+ $shortWeekday = $this->_messages["weekdaysshort"][$weekdayId];
+ else
+ $shortWeekday = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($weekday), 0, 3 )) : substr($weekday, 0, 3);
+
+ $text = str_replace( "%a", $shortWeekday, $text );
+ }
+ if( strpos( $text, "%A" ) !== FALSE ) {
+ $weekdayId = gmdate( "w", $time );
+ $text = str_replace( "%A", $this->_messages["days"][$weekdayId], $text );
+ }
+ if( strpos( $text, "%b" ) !== FALSE ) {
+ $monthId = gmdate( "n", $time );
+ $monthStr = $this->_messages["months"][$monthId-1];
+ if( !empty( $this->_messages["monthsshort"] ) )
+ $shortMonthStr = $this->_messages["monthsshort"][$monthId-1];
+ else
+ $shortMonthStr = function_exists('html_entity_decode') ? htmlentities(substr(html_entity_decode($monthStr), 0, 3 )) : substr($monthStr, 0, 3);
+
+ $text = str_replace( "%b", $shortMonthStr, $text );
+ }
+ if( strpos( $text, "%B" ) !== FALSE ) {
+ $monthId = gmdate( "n", $time );
+ $text = str_replace( "%B", $this->_messages["months"][$monthId-1], $text );
+ }
+ if( strpos( $text, "%d" ) !== FALSE ) {
+ $text = str_replace( "%d", gmdate( "d", $time ), $text );
+ }
+ if( strpos( $text, "%e" ) !== FALSE ) {
+ $text = str_replace( "%e", intval(gmdate( "d", $time )), $text );
+ }
+ if( strpos( $text, "%j" ) !== FALSE ) {
+ $text = str_replace( "%j", gmdate( "j", $time ), $text );
+ }
+ if( strpos( $text, "%H" ) !== FALSE ) {
+ $text = str_replace( "%H", gmdate( "H", $time ), $text );
+ }
+ if( strpos( $text, "%I" ) !== FALSE ) {
+ $text = str_replace( "%I", gmdate( "g", $time ), $text );
+ }
+ if( strpos( $text, "%p" ) !== FALSE ) {
+ $text = str_replace( "%p", gmdate( "a", $time ), $text );
+ }
+ if( strpos( $text, "%P" ) !== FALSE ) {
+ $text = str_replace( "%P", gmdate( "A", $time ), $text );
+ }
+ if( strpos( $text, "%M" ) !== FALSE ) {
+ $text = str_replace( "%M", gmdate( "i", $time ), $text );
+ }
+ if( strpos( $text, "%m") !== FALSE ) {
+ $text = str_replace( "%m", gmdate( "m", $time ), $text );
+ }
+ if( strpos( $text, "%S" ) !== FALSE ) {
+ $text = str_replace( "%S", gmdate( "s", $time ), $text );
+ }
+ if( strpos( $text, "%y" ) !== FALSE ) {
+ $text = str_replace( "%y", gmdate( "y", $time ), $text );
+ }
+ if( strpos( $text, "%Y" ) !== FALSE ) {
+ $text = str_replace( "%Y", gmdate( "Y", $time ), $text );
+ }
+ if( strpos( $text, "%O" ) !== FALSE ) {
+ $text = str_replace( "%O", "+0000", $text );
+ }
+ if( strpos( $text, "%G" ) !== FALSE ) {
+ $text = str_replace( "%G", "+00:00", $text );
+ }
+ if( strpos( $text, "%%" ) !== FALSE ) {
+ $text = str_replace( "%%", "%", $text );
+ }
+ if( strpos( $text, "%T" ) !== FALSE ) {
+ $monthId = (int)$timeStamp->getMonth();
+ $monthStr = $this->_messages["months"][$monthId-1];
+
+ $text = str_replace( "%T", $this->getDateOrdinal( gmdate( "d", $time ))." ".$this->tr("of")." ".$monthStr, $text );
+ }
+ if( strpos( $text, "%D" ) !== FALSE ) {
+ $text = str_replace( "%D", $this->getDateOrdinal( gmdate( "d", $time )), $text );
+ }
+
+ if ( $this->_code == 'fa_IR' )
+ {
+ lt_include( PLOG_CLASS_PATH."class/data/jalalicalendar.class.php" );
+ list( $jyear, $jmonth, $jday ) = JalaliCalendar::gregorian_to_jalali(gmdate( "Y", $time ), gmdate( "m", $time ), gmdate( "d", $time ));
+
+ if( strpos( $text, "%q" ) !== FALSE ) {
+ $text = str_replace( "%q", JalaliCalendar::Convertnumber2farsi($jyear), $text );
+ }
+ if( strpos( $text, "%w" ) !== FALSE ) {
+ $text = str_replace( "%w", JalaliCalendar::Convertnumber2farsi($jmonth), $text );
+ }
+ if( strpos( $text, "%o" ) !== FALSE ) {
+ $text = str_replace( "%o", JalaliCalendar::Convertnumber2farsi($jday), $text );
+ }
+ if( strpos( $text, "%R" ) !== FALSE ) {
+ $text = str_replace( "%R", JalaliCalendar::monthname($jmonth), $text );
+ }
+ if( strpos( $text, "%T" ) !== FALSE ) {
+ $text = str_replace( "%T", JalaliCalendar::Convertnumber2farsi(gmdate( "H", $time )), $text );
+ }
+ if( strpos( $text, "%U" ) !== FALSE ) {
+ $text = str_replace( "%U", JalaliCalendar::Convertnumber2farsi(gmdate( "i", $time )), $text );
+ }
+ }
+
+ return $text;
+ }
+
+ /**
+ * Formats a date as an RFC 822 date timestamp.
+ * @see formatDate
+ */
+ function formatDateAsRFC822( $timestamp, $blog = null )
+ {
+ $locale = $this->getLocaleCode();
+ $this->setLocale( "en_UK" );
+ $rfc822Date = $this->formatDate( $timestamp, "%a, %d %b %Y %H:%M:%S %O", $blog );
+ $this->setLocale( $locale );
+
+ return( $rfc822Date );
+ }
+
+ /**
+ * merges two locales
+ */
+ function mergeLocale( $locale )
+ {
+ if(isset($locale)){
+ // load the file if it hadn't been loaded yet
+ if( !is_array($this->_messages))
+ $this->_loadLocaleFile();
+
+ $this->_messages = array_merge( $this->_messages, $locale->getStrings());
+ return true;
+ }
+ else{
+ return false;
+ }
+ }
+ }
+?>
\ No newline at end of file
Copied: plog/branches/lifetype-1.2/class/locale/ltlocalefinder.class.php (from rev 7132, plog/branches/lifetype-1.2/class/locale/localefinder.class.php)
===================================================================
--- plog/branches/lifetype-1.2/class/locale/ltlocalefinder.class.php (rev 0)
+++ plog/branches/lifetype-1.2/class/locale/ltlocalefinder.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -0,0 +1,63 @@
+<?php
+
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/file/finder/filefinder.class.php" );
+
+ /**
+ * \ingroup LTLocale
+ *
+ * updates the list of locales based on what we can find on disk. It will add new ones
+ * and remove old ones.
+ *
+ * @see FileFinder
+ */
+ class LTLocaleFinder extends FileFinder
+ {
+ function LTLocaleFinder( $localeFolder = null )
+ {
+ if( $localeFolder == null )
+ $localeFolder = LTLocale::getLocaleFolder();
+
+ $this->_localeFolder = $localeFolder;
+
+ $this->FileFinder( $this->_localeFolder );
+ }
+
+ /**
+ * reimplemented from FileFinder::getKeyForFile so that we can adapt locale filenames
+ * to look like keys from our array
+ *
+ * @see FileFinder::getKeyForFile()
+ */
+ function getKeyForFile( $fileName )
+ {
+ // this regexp allows for more permissive locale names so that people can
+ // at least have things like locale_xx_YY_utf-8.php
+ $result = preg_match( REGEXP_VALID_LOCALE, $fileName, $matches );
+
+ // in case there is some crap in the locale/ folder, then ignore
+ // it (that is, if the file name does not match our regexp!
+ if( !$result )
+ $fileKey = null;
+ else
+ $fileKey = $matches[1];
+
+ return( $fileKey );
+ }
+
+ /**
+ * provides default parameters for the FileFinder::find() method
+ *
+ * @see FileFinder::find()
+ * @return An array with the new locales found in the disk
+ */
+ function find()
+ {
+ // first find the new ones
+ parent::find( LTLocales::getAvailableLocales(), "locale_*.php" );
+
+ // and then return them, if any
+ return( $this->getNew());
+ }
+ }
+?>
\ No newline at end of file
Copied: plog/branches/lifetype-1.2/class/locale/ltlocales.class.php (from rev 7132, plog/branches/lifetype-1.2/class/locale/locales.class.php)
===================================================================
--- plog/branches/lifetype-1.2/class/locale/ltlocales.class.php (rev 0)
+++ plog/branches/lifetype-1.2/class/locale/ltlocales.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -0,0 +1,383 @@
+<?php
+
+
+ lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocale.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
+ lt_include( PLOG_CLASS_PATH.'class/dao/daocacheconstants.properties.php' );
+
+ define("DEFAULT_LOCALE", "en_UK");
+ define( "REGEXP_VALID_LOCALE", "/.*locale_([a-z]{2}_[A-Z]{2}_?([a-zA-Z0-9\-]*)+)\.php$/" );
+
+ /**
+ * \ingroup LTLocale
+ *
+ * Class that supports methods such as getAvailableLocales, addLocale
+ * removeLocale and so on, basically to deal with locale files.
+ *
+ * It also provides a singleton-like method called LTLocales::getLocale to load and cache locale
+ * files from disk, so that we don't have to fetch the same file as many times
+ * as we ask for it but else, we keep a cached copy of it for later use. It is advised to
+ * use this method instead of creating a new LTLocale object every time we need a LTLocale.
+ *
+ * @see LTLocales::getLocale
+ * @see LTLocale
+ */
+ class LTLocales
+ {
+
+ function LTLocales()
+ {
+
+ }
+
+ /**
+ * @static
+ * Static method that offers some kind of locale factory. Since the Locale object
+ * better not use a Singleton (otherwise we couldn't use more than one locale file
+ * at a time) this function has been included here to provide a system similar to
+ * a singleton: we keep an static array inside the function, that contains all the
+ * locale files that have been loaded so far. Whenever somebody requests a locale
+ * to be fetched from disk, we will first check that we have not loaded it before. If
+ * we have, then we only have to return the same object we were keeping.
+ * If the locale wasn't there, we will then load it from disk and store/cache the
+ * resulting object for future use.
+ * It is recommended to use this method over creating new LTLocale objects every time
+ * we need one.
+ *
+ * @param localeCode The code (eg. en_UK, es_ES) of the locale we want to get.
+ * @return Returns a LTLocale object corresponding to the requested locale.
+ * @see LTLocale
+ */
+ function &getBlogLocale( $localeCode = null )
+ {
+ lt_include( PLOG_CLASS_PATH."class/locale/bloglocale.class.php" );
+
+ // array to keep track of the locales that we have already loaded, so that
+ // we don't have to fetch them from disk
+ static $loadedLocales;
+
+ // if there is no locale parameter, we use the default one
+ if( $localeCode == null ) {
+ $config =& Config::getConfig();
+ $localeCode = $config->getValue( "default_locale" );
+ }
+
+ // check if we have already loaded that locale or else, load it from
+ // disk and keep it for later, just in case anybody asks again
+ if( isset($loadedLocales[$localeCode]) ) {
+ $locale = $loadedLocales[$localeCode];
+ }
+ else {
+ lt_include( PLOG_CLASS_PATH . "class/cache/cachemanager.class.php" );
+ $cache =& CacheManager::getCache();
+ $locale = $cache->getData( $localeCode, CACHE_BLOG_LOCALES );
+ if ( !$locale ) {
+ $locale = new BlogLocale( $localeCode );
+ $cache->setData( $localeCode, CACHE_BLOG_LOCALES, $locale );
+ }
+
+ LTLocales::_loadPluginLocales( $locale );
+ }
+
+ $loadedLocales[$localeCode] = $locale;
+
+ return $locale;
+ }
+
+ function _loadPluginLocales( &$locale )
+ {
+ $localeCode = $locale->getLocaleCode();
+
+ $pm =& PluginManager::getPluginManager();
+ foreach( $pm->_pluginList as $pluginId ) {
+ if( $pm->pluginHasLocale( $pluginId, $localeCode )) {
+ // if the plugin provides the locale that we need, continue
+ $pluginLocale = LTLocales::getPluginLocale( $pluginId, $localeCode );
+ }
+ else {
+ // if not, try to load en_UK by default
+ if( $pm->pluginHasLocale( $pluginId, "en_UK" )) {
+ $pluginLocale = LTLocales::getPluginLocale( $pluginId, "en_UK" );
+ }
+ // if not en_UK locale available, forget about it...
+ }
+
+ // merge the plugin locale with the big locale
+ if ( isset( $pluginLocale ) ) {
+ $locale->mergeLocale( $pluginLocale );
+ }
+ }
+
+ return( true );
+ }
+
+ /**
+ * @static
+ * Static method that offers some kind of locale factory. Since the LTLocale object
+ * better not use a Singleton (otherwise we couldn't use more than one locale file
+ * at a time) this function has been included here to provide a system similar to
+ * a singleton: we keep an static array inside the function, that contains all the
+ * locale files that have been loaded so far. Whenever somebody requests a locale
+ * to be fetched from disk, we will first check that we have not loaded it before. If
+ * we have, then we only have to return the same object we were keeping.
+ * If the locale wasn't there, we will then load it from disk and store/cache the
+ * resulting object for future use.
+ * It is recommended to use this method over creating new LTLocale objects every time
+ * we need one.
+ *
+ * @param localeCode The code (eg. en_UK, es_ES) of the locale we want to get.
+ * @return Returns a LTLocale object corresponding to the requested locale.
+ * @see LTLocale
+ */
+ function &getLocale( $localeCode = null )
+ {
+ // array to keep track of the locales that we have already loaded, so that
+ // we don't have to fetch them from disk
+ static $loadedLocales;
+
+ // if there is no locale parameter, we use the default one
+ if( $localeCode == null ) {
+ $config =& Config::getConfig();
+ $localeCode = $config->getValue( "default_locale" );
+ }
+
+ // check if we have already loaded that locale or else, load it from
+ // disk and keep it for later, just in case anybody asks again
+ if( isset($loadedLocales[$localeCode]) ) {
+ $locale = $loadedLocales[$localeCode];
+ }
+ else {
+ lt_include( PLOG_CLASS_PATH . "class/cache/cachemanager.class.php" );
+ $cache =& CacheManager::getCache();
+ $locale = $cache->getData( $localeCode, CACHE_LOCALES );
+ if ( !$locale ) {
+ $locale = new LTLocale( $localeCode );
+ $cache->setData( $localeCode, CACHE_LOCALES, $locale );
+ }
+
+ LTLocales::_loadPluginLocales( $locale );
+ }
+
+ $loadedLocales[$localeCode] = $locale;
+
+ return $locale;
+ }
+
+ /**
+ * loads the locale file provided by a plugin. First it will try to load the locale specified in
+ * the $pluginId parameter and if not available, it will load the current default locale.
+ *
+ * @param localeCode The locale code we would like to load
+ * @return A PluginLocale object with the translated strings loaded from the plugin's own folder
+ */
+ function getPluginLocale( $pluginId, $localeCode = null )
+ {
+ global $_plugins_loadedLocales;
+
+ if( $localeCode == null ) {
+ $config =& Config::getConfig();
+ $localeCode = $config->getValue( "default_locale" );
+ }
+
+ //$pluginLocaleKey = "plugin_".$pluginId."_".$localeCode;
+ $pluginLocaleKey = $pluginId;
+
+ // check if we have already loaded that locale or else, load it from
+ // disk and keep it for later, just in case anybody asks again
+ if( isset($_plugins_loadedLocales[$pluginLocaleKey][$localeCode] )) {
+ $locale = $_plugins_loadedLocales[$pluginLocaleKey][$localeCode];
+ }
+ else {
+ lt_include( PLOG_CLASS_PATH."class/locale/pluginlocale.class.php" );
+
+ $locale = new PluginLocale( $pluginId, $localeCode );
+ $_plugins_loadedLocales[$pluginLocaleKey][$localeCode] = $locale;
+ }
+
+ return $locale;
+ }
+
+ /**
+ * Returns an array with the codes of the locale files available.
+ *
+ * @return An array containing all the locale codes available in the system.
+ * @static
+ */
+ function getAvailableLocales()
+ {
+ $config =& Config::getConfig();
+
+ $locales = $config->getValue( "locales" );
+
+ // in order to prevent some ugly error messages
+ if( !is_array( $locales ))
+ $locales = Array();
+
+ return( $locales );
+ }
+
+ /**
+ * Returns default locale code
+ *
+ * @return default locale code
+ */
+
+ function getDefaultLocale()
+ {
+ return DEFAULT_LOCALE;
+ }
+
+ /**
+ * Returns true if the given locale code is a valid one (i.e. if it is amongst
+ * the available ones
+ *
+ * @param localeCode The code of the locale we'd like to check
+ * @return Returns 'true' if the locale file is already available in the system
+ * or false otherwise.
+ * @static
+ */
+ function isValidLocale( $localeCode )
+ {
+ $availableLocales = LTLocales::getAvailableLocales();
+
+ return in_array( $localeCode, $availableLocales );
+ }
+
+ /**
+ * returns whether a file has the corect name format
+ *
+ * @param fileName
+ * @return true if format is correct or false otherwise
+ */
+ function isValidLocaleFileName( $fileName )
+ {
+ return( preg_match( REGEXP_VALID_LOCALE, $fileName ));
+ }
+
+ /**
+ * Returns an array with all the locales available in the system.
+ *
+ * This is quite memory and disk-intensive since we are loading a lot of lines
+ * from possibly a lot of files!!!
+ *
+ * @return Returns an array of LTLocale objects, which represent *all* the locales
+ * that have been installed in this system.
+ * @static
+ */
+ function getLocales()
+ {
+ $localeCodes = LTLocales::getAvailableLocales();
+
+ $locales = Array();
+ foreach( $localeCodes as $code ) {
+ array_push( $locales, LTLocales::getLocale( $code ));
+ }
+
+ return $locales;
+ }
+
+ /**
+ * Given a locale code, returns the path to the file that contains it.
+ *
+ * @param localeCode The code representing the locale
+ * @return A string containing the path (may be absolute or relative, it depends)
+ * to the file containing the given locale. It does *not* check if the file exists
+ * or not, simply returns its path.
+ */
+ function getLocaleFilename( $localeCode )
+ {
+ return (LTLocale::getLocaleFolder()."/locale_".$localeCode.".php");
+ }
+
+ /**
+ * Given a locale code, returns the path to the file that contains its admin version.
+ *
+ * @param localeCode The code representing the locale
+ * @return A string containing the path (may be absolute or relative, it depends)
+ * to the file containing the given locale. It does *not* check if the file exists
+ * or not, simply returns its path.
+ */
+ function getAdminLocaleFilename( $localeCode )
+ {
+ return (LTLocale::getLocaleFolder()."/admin/locale_".$localeCode.".php");
+ }
+
+ /**
+ * Removes a locale from the system. First the file containing it is deleted
+ * and then we also remove its entry from the configuration.
+ *
+ * @param localeCode The code of the locale that we would like to delete.
+ * @return Returns true if the locale was removed succesfully or false otherwise.
+ */
+ function removeLocale( $localeCode )
+ {
+ $config =& Config::getConfig();
+
+ // if we don't have permissions on the folder where the locale files
+ // are stored, we don't even have to bother about it...
+ if(!File::isWritable(LTLocale::getLocaleFolder()))
+ return false;
+
+ // does the locale really exist?
+ if( !$this->isValidLocale( $localeCode ))
+ return false;
+
+ // remove the blog locale
+ $fileName = $this->getLocaleFilename( $localeCode );
+ if( File::exists( $fileName )) {
+ if( !unlink( $fileName ))
+ return false;
+ }
+ // and the admin locale
+ $fileName = $this->getAdminLocaleFilename( $localeCode );
+ if( File::exists( $fileName )) {
+ if( !unlink( $fileName ))
+ return false;
+ }
+
+ $availableLocales = $config->getValue( "locales" );
+
+ $newLocaleList = Array();
+ foreach( $availableLocales as $locale ) {
+ if( $locale != $localeCode )
+ array_push( $newLocaleList, $locale );
+ }
+
+ $config->saveValue( "locales", $newLocaleList );
+
+ return true;
+ }
+
+ /**
+ * Adds a new locale to the list of available/supported locale. It checks to make
+ * sure that the file exists and that has proper access permissions.
+ *
+ * @param localeCode the code of the locale we'd like to add.
+ * @return Returns true if the file was successfully added or false otherwise.
+ */
+ function addLocale( $localeCode )
+ {
+ $config =& Config::getConfig();
+
+ // if the locale is already there, there is no need to add it,
+ // since the user is *maybe* just updating the file.
+ if( $this->isValidLocale( $localeCode ))
+ return true;
+
+ $fileName = $this->getLocaleFilename( $localeCode );
+
+ // make sure that the file exists and can be read and
+ // give up if not so
+ if( !File::isReadable( $fileName ))
+ return false;
+
+ // otherwise, we can happily add it to the list of supported locales
+ $availableLocales = $this->getAvailableLocales();
+ array_push( $availableLocales, $localeCode );
+ $config->saveValue( "locales", $availableLocales );
+
+ return true;
+ }
+ }
+?>
Modified: plog/branches/lifetype-1.2/class/locale/pluginlocale.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/locale/pluginlocale.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/locale/pluginlocale.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,9 +1,9 @@
<?php
- lt_include( PLOG_CLASS_PATH."class/locale/locale.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocale.class.php" );
/**
- * \ingroup Locale
+ * \ingroup LTLocale
*
* Allows plugins to provide their custom locale files, in addition to the blog-wide
* ones located under the locale/ folder.
@@ -12,21 +12,21 @@
* parameter that represents the plugin identifier, so that we know where the plugin files
* are stored.
*
- * @see Locales
- * @see Locale
+ * @see LTLocales
+ * @see LTLocale
*/
- class PluginLocale extends Locale
+ class PluginLocale extends LTLocale
{
var $_pluginId;
/**
- * New constructor. Works exactly as Locale::Locale() but takes an additional parameter
+ * New constructor. Works exactly as LTLocale::LTLocale() but takes an additional parameter
* the plugin identifier
*
* @param pluginId The plugin identifier
* @param code The locale code
- * @see Locale
+ * @see LTLocale
*/
function PluginLocale( $pluginId, $code )
{
@@ -34,7 +34,7 @@
$this->_pluginId = $pluginId;
// and initialize the parent class
- $this->Locale( $code );
+ $this->LTLocale( $code );
}
/**
Modified: plog/branches/lifetype-1.2/class/plugin/pluginmanager.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/plugin/pluginmanager.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/plugin/pluginmanager.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -288,9 +288,9 @@
*/
function _loadPluginLocale( $pluginId, $locale )
{
- lt_include( PLOG_CLASS_PATH . "class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH . "class/locale/ltlocales.class.php" );
- return( Locales::getPluginLocale( $pluginId, $locale ));
+ return( LTLocales::getPluginLocale( $pluginId, $locale ));
}
/**
Modified: plog/branches/lifetype-1.2/class/summary/action/doblogregistration.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/summary/action/doblogregistration.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/summary/action/doblogregistration.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -7,7 +7,7 @@
lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
lt_include( PLOG_CLASS_PATH."class/summary/view/doblogregistrationview.class.php" );
lt_include( PLOG_CLASS_PATH."class/summary/view/blogtemplatechooserview.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/domainvalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/net/http/subdomains.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/filter/htmlfilter.class.php" );
Modified: plog/branches/lifetype-1.2/class/summary/action/dofinishregister.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/summary/action/dofinishregister.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/summary/action/dofinishregister.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -145,7 +145,7 @@
$blogInfo->setStatus( BLOG_STATUS_ACTIVE );
}
- $locale = Locales::getLocale( $this->blogLocale );
+ $locale = LTLocales::getLocale( $this->blogLocale );
$blogInfo->setLocale( $locale );
$blogInfo->setTemplate( $this->templateId );
$blogInfo->setBlogCategoryId( $this->blogCategoryId );
@@ -248,7 +248,7 @@
$users = $userPerms->getUsersWithPermissionByName( "update_site_blog" );
// laod the default locale
- $locale =& Locales::getLocale();
+ $locale =& LTLocales::getLocale();
// build up the message, as much as we can
$config =& Config::getConfig();
Modified: plog/branches/lifetype-1.2/class/summary/action/summaryaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/summary/action/summaryaction.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/summary/action/summaryaction.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -34,7 +34,7 @@
* languages we have to use the value of "default_locale" and display the default language.
*
* @private
- * @return Returns a reference to a Locale object
+ * @return Returns a reference to a LTLocale object
*/
function &_loadLocale()
{
@@ -47,7 +47,7 @@
// guess the apropriate language from the http_accept_language string
if( $requestLocale ) {
// check if it's a valid one
- if( Locales::isValidLocale( $requestLocale )) {
+ if( LTLocales::isValidLocale( $requestLocale )) {
$localeCode = $requestLocale;
}
}
@@ -64,7 +64,7 @@
// check if the locale code is correct
// and as a valid resort, use the default one if the locale ist not valid or 'false'
- if( $localeCode === false || !Locales::isValidLocale( $localeCode ) ) {
+ if( $localeCode === false || !LTLocales::isValidLocale( $localeCode ) ) {
$localeCode = $this->_config->getValue( "default_locale" );
}
@@ -72,7 +72,7 @@
SessionManager::setSessionValue( "summaryLang", $localeCode );
// load the correct locale
- $locale =& Locales::getLocale( $localeCode );
+ $locale =& LTLocales::getLocale( $localeCode );
return( $locale );
}
@@ -99,7 +99,7 @@
function _matchHttpAcceptLanguages(&$httpAcceptLanguage)
{
$acceptedLanguages = explode( ',', $httpAcceptLanguage );
- $availableLanguages = Locales::getAvailableLocales();
+ $availableLanguages = LTLocales::getAvailableLocales();
$primaryLanguageMatch = '';
// we iterate through the array of languages sent by the UA and test every single
Modified: plog/branches/lifetype-1.2/class/summary/data/summarytools.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/summary/data/summarytools.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/summary/data/summarytools.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -41,7 +41,7 @@
$message->setFrom( $config->getValue( "post_notification_source_address" ));
$message->addTo( $userInfo->getEmail());
// get the default locale
- $locale =& Locales::getLocale();
+ $locale =& LTLocales::getLocale();
$message->setSubject( $locale->tr("password_reset_subject"));
$message->setBody( $emailBody );
Modified: plog/branches/lifetype-1.2/class/summary/mail/confirmemailmessage.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/summary/mail/confirmemailmessage.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/summary/mail/confirmemailmessage.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,7 +1,7 @@
<?php
lt_include(PLOG_CLASS_PATH.'class/mail/emailmessage.class.php');
-lt_include(PLOG_CLASS_PATH.'class/locale/locales.class.php');
+lt_include(PLOG_CLASS_PATH.'class/locale/ltlocales.class.php');
lt_include(PLOG_CLASS_PATH.'class/template/templateservice.class.php');
define( "CONFIRM_MAIL_TEMPLATE", "email_confirm" );
@@ -50,7 +50,7 @@
$messageTemplate->assign("activeLink",$this->activeLink);
// FIXME: use which locale?
- $locale = &Locales::getLocale();
+ $locale = <Locales::getLocale();
$messageTemplate->assign("locale",$locale);
// render and return the contents
return $messageTemplate->fetch();
Modified: plog/branches/lifetype-1.2/class/summary/mail/summarymailer.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/summary/mail/summarymailer.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/summary/mail/summarymailer.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -13,7 +13,7 @@
lt_include( PLOG_CLASS_PATH."class/summary/mail/confirmemailmessage.class.php" );
lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
lt_include( PLOG_CLASS_PATH."class/mail/emailservice.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
$activeCode = SummaryMailer::generateActiveCode();
@@ -28,7 +28,7 @@
$message = new ConfirmEmailMessage();
$message->setFrom( $config->getValue( "post_notification_source_address" ));
$message->addTo( $userInfo->getEmail());
- $locale =& Locales::getLocale();
+ $locale =& LTLocales::getLocale();
$message->setSubject( $locale->tr( "registration_default_subject" ));
$message->setUsername($userName);
$message->setActiveCode($activeCode);
Modified: plog/branches/lifetype-1.2/class/summary/view/doblogregistrationview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/summary/view/doblogregistrationview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/summary/view/doblogregistrationview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,7 +1,7 @@
<?php
lt_include( PLOG_CLASS_PATH."class/summary/view/summaryview.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/blogcategories.class.php" );
lt_include( PLOG_CLASS_PATH."class/net/http/subdomains.class.php" );
@@ -19,7 +19,7 @@
function render()
{
// get the list of languages available, so that users can choose
- $locales = Locales::getLocales();
+ $locales = LTLocales::getLocales();
$this->setValue( "locales", $locales );
$config =& Config::getConfig();
Modified: plog/branches/lifetype-1.2/class/summary/view/summarycachedview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/summary/view/summarycachedview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/summary/view/summarycachedview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -74,13 +74,13 @@
*/
function _getLocale()
{
- // load the Locale object from the view context or initialize it now
+ // load the LTLocale object from the view context or initialize it now
if( $this->_params->keyExists( "locale" )) {
$this->_locale = $this->_params->getValue( "locale" );
}
else {
$config =& Config::getConfig();
- $this->_locale =& Locales::getLocale( $config->getValue("default_locale" ));
+ $this->_locale =& LTLocales::getLocale( $config->getValue("default_locale" ));
}
}
@@ -124,7 +124,7 @@
function render()
{
lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
// set the view character set based on the default locale
$this->_getLocale();
Modified: plog/branches/lifetype-1.2/class/summary/view/summarymessageview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/summary/view/summarymessageview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/summary/view/summarymessageview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,7 +1,7 @@
<?php
lt_include( PLOG_CLASS_PATH."class/summary/view/summaryview.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
/**
* shows a feedback (or error) message
Modified: plog/branches/lifetype-1.2/class/summary/view/summaryrssview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/summary/view/summaryrssview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/summary/view/summaryrssview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,7 +2,7 @@
lt_include( PLOG_CLASS_PATH."class/summary/view/summarycachedview.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/templateservice.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
class SummaryRssView extends SummaryCachedView
@@ -52,7 +52,7 @@
//$template = $templateService->Template( $this->_profile, "summary/rss" );
$config =& Config::getConfig();
- $this->_locale =& Locales::getLocale( $config->getValue("default_locale" ));
+ $this->_locale =& LTLocales::getLocale( $config->getValue("default_locale" ));
$this->_params->setValue( "version", Version::getVersion());
$this->_params->setValue( "locale", $this->_locale );
$this->_params->setValue( "serviceName", $config->getValue( "summary_service_name" ));
Modified: plog/branches/lifetype-1.2/class/summary/view/summaryview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/summary/view/summaryview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/summary/view/summaryview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,7 +2,7 @@
lt_include( PLOG_CLASS_PATH."class/view/view.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/templateservice.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
class SummaryView extends View
@@ -23,13 +23,13 @@
*/
function _getLocale()
{
- // load the Locale object from the view context or initialize it now
+ // load the LTLocale object from the view context or initialize it now
if( $this->_params->keyExists( "locale" )) {
$this->_locale = $this->_params->getValue( "locale" );
}
else {
$config =& Config::getConfig();
- $this->_locale =& Locales::getLocale( $config->getValue("default_locale" ));
+ $this->_locale =& LTLocales::getLocale( $config->getValue("default_locale" ));
}
}
Modified: plog/branches/lifetype-1.2/class/template/menu/menurenderer.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/menu/menurenderer.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/template/menu/menurenderer.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,11 +1,11 @@
<?php
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/templateservice.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/menu/menu.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/menu/menuentry.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
/**
* \ingroup Template
@@ -50,7 +50,7 @@
}
else {
$localeCode = $config->getValue( "default_locale" );
- $this->_locale =& Locales::getLocale( $localeCode );
+ $this->_locale =& LTLocales::getLocale( $localeCode );
}
}
Modified: plog/branches/lifetype-1.2/class/template/smarty/plugins/function.pager.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/plugins/function.pager.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/template/smarty/plugins/function.pager.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -48,8 +48,8 @@
$locale = $smarty->_tpl_vars["locale"];
}
else {
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
- $locale =& Locales::getLocale();
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
+ $locale =& LTLocales::getLocale();
}
$nextText = $locale->tr( "next_post" )."»";
}
@@ -64,8 +64,8 @@
$locale = $smarty->_tpl_vars["locale"];
}
else {
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
- $locale =& Locales::getLocale();
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
+ $locale =& LTLocales::getLocale();
}
$prevText = "«".$locale->tr( "previous_post" );
}
Modified: plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.round.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.round.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.round.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,15 +2,15 @@
/**
* Smarty Modifier round
* $round The number we're trying to round (don't try this with strings!!)
- * $locale An optional Locale object that will be used to localize the strings to be displayed.
+ * $locale An optional LTLocale object that will be used to localize the strings to be displayed.
* If none is specified, the default locale will be used.
*/
function smarty_modifier_round($size,$locale = null)
{
// load the default locale if none provided
if( $locale == null ) {
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
- $locale =& Locales::getLocale();
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
+ $locale =& LTLocales::getLocale();
}
if ($size < pow(2,10)) return( $size." ".$locale->tr("bytes"));
Deleted: plog/branches/lifetype-1.2/class/test/tests/locale/locale_test.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/tests/locale/locale_test.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/test/tests/locale/locale_test.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,154 +0,0 @@
-<?php
-
- lt_include( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locale.class.php" );
- lt_include( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
-
- /**
- * \ingroup Test
- *
- * Test cases for the Locale class.
- */
- class Locale_Test extends LifeTypeTestCase
- {
- var $l;
-
- function setUp()
- {
- // let's use the English locale as the base one
- $this->l = new Locale( "en_UK" );
- }
-
- /**
- * test all the modifiers from the Locale::formatDate() method:
- *
- * <li>%a abbreviated weekday</li>
- * <li>%A complete weekday</li>
- * <li>%b abbreviated month</li>
- * <li>%B long month</li>
- * <li>%d day of the month, 2 digits with leading zero</li>
- * <li>%j day of the month, numeric (without leading zero)</li>
- * <li>%H hours, in 24-h format</li>
- * <li>%I hours, in 12-h format (without leading zero)</li>
- * <li>%p returns 'am' or 'pm'</li>
- * <li>%P returns 'AM' or 'PM'</li>
- * <li>%M minutes</li>
- * <li>%m month number, from 00 to 12</li>
- * <li>%S seconds</li>
- * <li>%y 2-digit year representation</li>
- * <li>%Y 4-digit year representation</li>
- * <li>%O Difference to Greenwich time (GMT) in hours</li>
- * <li>%% the '%' character
- * </ul>
- * (these have been added by myself and are therefore incompatible with php)<ul>
- * <li>%T "_day_ of _month_", where the day is in ordinal form and 'month' is the name of the month</li>
- * <li>%D cardinal representation of the day</li>
- */
- function testFormatDate()
- {
- $d = new Timestamp( "20070205230000" );
-
- $this->assertEquals( "Mon", $this->l->formatDate( $d, "%a" ));
- $this->assertEquals( "Monday", $this->l->formatDate( $d, "%A" ));
- $this->assertEquals( "Feb", $this->l->formatDate( $d, "%b" ));
- $this->assertEquals( "February", $this->l->formatDate( $d, "%B" ));
- $this->assertEquals( "05", $this->l->formatDate( $d, "%d" ));
- $this->assertEquals( "5", $this->l->formatDate( $d, "%j" ));
- $this->assertEquals( "23", $this->l->formatDate( $d, "%H" ));
- $this->assertEquals( "11", $this->l->formatDate( $d, "%I" ));
- $this->assertEquals( "pm", $this->l->formatDate( $d, "%p" ));
- $this->assertEquals( "PM", $this->l->formatDate( $d, "%P" ));
- $this->assertEquals( "00", $this->l->formatDate( $d, "%M" ));
- $this->assertEquals( "02", $this->l->formatDate( $d, "%m" ));
- $this->assertEquals( "00", $this->l->formatDate( $d, "%S" ));
- $this->assertEquals( "07", $this->l->formatDate( $d, "%y" ));
- $this->assertEquals( "2007", $this->l->formatDate( $d, "%Y" ));
- $this->assertEquals( "%", $this->l->formatDate( $d, "%%" ));
- $this->assertEquals( "5th of February", $this->l->formatDate( $d, "%T" ));
- $this->assertEquals( "5th", $this->l->formatDate( $d, "%D" ));
-
- // a longer format test
- $this->assertEquals( "Feb ", $this->l->formatDate( $d, "%b " ));
- $this->assertEquals( "Feb 5", $this->l->formatDate( $d, "%b %j" ));
- $this->assertEquals( "05/02/2007", $this->l->formatDate( $d, "%d/%m/%Y" ));
- $this->assertEquals( "05 February, 2007 23:00", $this->l->formatDate( $d, "%d %B, %Y %H:%M" ));
- }
-
- /**
- * Tests that the Locale::testFormatDateGMT() method also behaves
- * as expected during daylight savings time
- */
- function testFormatDateGMT_DST()
- {
- $d = new Timestamp( "20070605180000" );
-
- $diff = $this->l->formatDate( $d, "%O" );
- $diff = $diff / 100;
-
- $this->assertEquals( "Tue", $this->l->formatDateGMT( $d, "%a" ));
- $this->assertEquals( "Tuesday", $this->l->formatDateGMT( $d, "%A" ));
- $this->assertEquals( "Jun", $this->l->formatDateGMT( $d, "%b" ));
- $this->assertEquals( "June", $this->l->formatDateGMT( $d, "%B" ));
- $this->assertEquals( "05", $this->l->formatDateGMT( $d, "%d" ));
- $this->assertEquals( "5", $this->l->formatDateGMT( $d, "%j" ));
- $this->assertEquals( 18-$diff, $this->l->formatDateGMT( $d, "%H" ));
- $this->assertEquals( (18-$diff)%12, $this->l->formatDateGMT( $d, "%I" ));
- $this->assertEquals( "pm", $this->l->formatDateGMT( $d, "%p" ));
- $this->assertEquals( "PM", $this->l->formatDateGMT( $d, "%P" ));
- $this->assertEquals( "00", $this->l->formatDateGMT( $d, "%M" ));
- $this->assertEquals( "06", $this->l->formatDateGMT( $d, "%m" ));
- $this->assertEquals( "00", $this->l->formatDateGMT( $d, "%S" ));
- $this->assertEquals( "07", $this->l->formatDateGMT( $d, "%y" ));
- $this->assertEquals( "2007", $this->l->formatDateGMT( $d, "%Y" ));
- $this->assertEquals( "%", $this->l->formatDateGMT( $d, "%%" ));
- $this->assertEquals( "5th of June", $this->l->formatDateGMT( $d, "%T" ));
- $this->assertEquals( "5th", $this->l->formatDateGMT( $d, "%D" ));
-
- // a longer format test
- $this->assertEquals( "Jun ", $this->l->formatDateGMT( $d, "%b " ));
- $this->assertEquals( "Jun 5", $this->l->formatDateGMT( $d, "%b %j" ));
- $this->assertEquals( "05/06/2007", $this->l->formatDateGMT( $d, "%d/%m/%Y" ));
- $this->assertEquals( "05 June, 2007 ".(18-$diff).":00", $this->l->formatDateGMT( $d, "%d %B, %Y %H:%M" ));
- }
-
-
- /**
- * Tests that the Locale::testFormatDateGMT() method also behaves
- * as expected
- */
- function testFormatDateGMT()
- {
- $d = new Timestamp( "20070205120000" );
-
- $diff = $this->l->formatDate( $d, "%O" );
- $diff = $diff / 100;
-
- $this->assertEquals( "Mon", $this->l->formatDateGMT( $d, "%a" ));
- $this->assertEquals( "Monday", $this->l->formatDateGMT( $d, "%A" ));
- $this->assertEquals( "Feb", $this->l->formatDateGMT( $d, "%b" ));
- $this->assertEquals( "February", $this->l->formatDateGMT( $d, "%B" ));
- $this->assertEquals( "05", $this->l->formatDateGMT( $d, "%d" ));
- $this->assertEquals( "5", $this->l->formatDateGMT( $d, "%j" ));
- $this->assertEquals( 12-$diff, $this->l->formatDateGMT( $d, "%H" ));
- $this->assertEquals( (12-$diff)%12, $this->l->formatDateGMT( $d, "%I" ));
- $this->assertEquals( "pm", $this->l->formatDateGMT( $d, "%p" ));
- $this->assertEquals( "PM", $this->l->formatDateGMT( $d, "%P" ));
- $this->assertEquals( "00", $this->l->formatDateGMT( $d, "%M" ));
- $this->assertEquals( "02", $this->l->formatDateGMT( $d, "%m" ));
- $this->assertEquals( "00", $this->l->formatDateGMT( $d, "%S" ));
- $this->assertEquals( "07", $this->l->formatDateGMT( $d, "%y" ));
- $this->assertEquals( "2007", $this->l->formatDateGMT( $d, "%Y" ));
- $this->assertEquals( "%", $this->l->formatDateGMT( $d, "%%" ));
- $this->assertEquals( "5th of February", $this->l->formatDateGMT( $d, "%T" ));
- $this->assertEquals( "5th", $this->l->formatDateGMT( $d, "%D" ));
-
- // a longer format test
- $this->assertEquals( "Feb ", $this->l->formatDateGMT( $d, "%b " ));
- $this->assertEquals( "Feb 5", $this->l->formatDateGMT( $d, "%b %j" ));
- $this->assertEquals( "05/02/2007", $this->l->formatDateGMT( $d, "%d/%m/%Y" ));
- $this->assertEquals( "05 February, 2007 ".(12-$diff).":00", $this->l->formatDateGMT( $d, "%d %B, %Y %H:%M" ));
- }
-
- }
-?>
\ No newline at end of file
Copied: plog/branches/lifetype-1.2/class/test/tests/locale/ltlocale_test.class.php (from rev 7132, plog/branches/lifetype-1.2/class/test/tests/locale/locale_test.class.php)
===================================================================
--- plog/branches/lifetype-1.2/class/test/tests/locale/ltlocale_test.class.php (rev 0)
+++ plog/branches/lifetype-1.2/class/test/tests/locale/ltlocale_test.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -0,0 +1,154 @@
+<?php
+
+ lt_include( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocale.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
+
+ /**
+ * \ingroup Test
+ *
+ * Test cases for the LTLocale class.
+ */
+ class LTLocale_Test extends LifeTypeTestCase
+ {
+ var $l;
+
+ function setUp()
+ {
+ // let's use the English locale as the base one
+ $this->l = new LTLocale( "en_UK" );
+ }
+
+ /**
+ * test all the modifiers from the LTLocale::formatDate() method:
+ *
+ * <li>%a abbreviated weekday</li>
+ * <li>%A complete weekday</li>
+ * <li>%b abbreviated month</li>
+ * <li>%B long month</li>
+ * <li>%d day of the month, 2 digits with leading zero</li>
+ * <li>%j day of the month, numeric (without leading zero)</li>
+ * <li>%H hours, in 24-h format</li>
+ * <li>%I hours, in 12-h format (without leading zero)</li>
+ * <li>%p returns 'am' or 'pm'</li>
+ * <li>%P returns 'AM' or 'PM'</li>
+ * <li>%M minutes</li>
+ * <li>%m month number, from 00 to 12</li>
+ * <li>%S seconds</li>
+ * <li>%y 2-digit year representation</li>
+ * <li>%Y 4-digit year representation</li>
+ * <li>%O Difference to Greenwich time (GMT) in hours</li>
+ * <li>%% the '%' character
+ * </ul>
+ * (these have been added by myself and are therefore incompatible with php)<ul>
+ * <li>%T "_day_ of _month_", where the day is in ordinal form and 'month' is the name of the month</li>
+ * <li>%D cardinal representation of the day</li>
+ */
+ function testFormatDate()
+ {
+ $d = new Timestamp( "20070205230000" );
+
+ $this->assertEquals( "Mon", $this->l->formatDate( $d, "%a" ));
+ $this->assertEquals( "Monday", $this->l->formatDate( $d, "%A" ));
+ $this->assertEquals( "Feb", $this->l->formatDate( $d, "%b" ));
+ $this->assertEquals( "February", $this->l->formatDate( $d, "%B" ));
+ $this->assertEquals( "05", $this->l->formatDate( $d, "%d" ));
+ $this->assertEquals( "5", $this->l->formatDate( $d, "%j" ));
+ $this->assertEquals( "23", $this->l->formatDate( $d, "%H" ));
+ $this->assertEquals( "11", $this->l->formatDate( $d, "%I" ));
+ $this->assertEquals( "pm", $this->l->formatDate( $d, "%p" ));
+ $this->assertEquals( "PM", $this->l->formatDate( $d, "%P" ));
+ $this->assertEquals( "00", $this->l->formatDate( $d, "%M" ));
+ $this->assertEquals( "02", $this->l->formatDate( $d, "%m" ));
+ $this->assertEquals( "00", $this->l->formatDate( $d, "%S" ));
+ $this->assertEquals( "07", $this->l->formatDate( $d, "%y" ));
+ $this->assertEquals( "2007", $this->l->formatDate( $d, "%Y" ));
+ $this->assertEquals( "%", $this->l->formatDate( $d, "%%" ));
+ $this->assertEquals( "5th of February", $this->l->formatDate( $d, "%T" ));
+ $this->assertEquals( "5th", $this->l->formatDate( $d, "%D" ));
+
+ // a longer format test
+ $this->assertEquals( "Feb ", $this->l->formatDate( $d, "%b " ));
+ $this->assertEquals( "Feb 5", $this->l->formatDate( $d, "%b %j" ));
+ $this->assertEquals( "05/02/2007", $this->l->formatDate( $d, "%d/%m/%Y" ));
+ $this->assertEquals( "05 February, 2007 23:00", $this->l->formatDate( $d, "%d %B, %Y %H:%M" ));
+ }
+
+ /**
+ * Tests that the LTLocale::testFormatDateGMT() method also behaves
+ * as expected during daylight savings time
+ */
+ function testFormatDateGMT_DST()
+ {
+ $d = new Timestamp( "20070605180000" );
+
+ $diff = $this->l->formatDate( $d, "%O" );
+ $diff = $diff / 100;
+
+ $this->assertEquals( "Tue", $this->l->formatDateGMT( $d, "%a" ));
+ $this->assertEquals( "Tuesday", $this->l->formatDateGMT( $d, "%A" ));
+ $this->assertEquals( "Jun", $this->l->formatDateGMT( $d, "%b" ));
+ $this->assertEquals( "June", $this->l->formatDateGMT( $d, "%B" ));
+ $this->assertEquals( "05", $this->l->formatDateGMT( $d, "%d" ));
+ $this->assertEquals( "5", $this->l->formatDateGMT( $d, "%j" ));
+ $this->assertEquals( 18-$diff, $this->l->formatDateGMT( $d, "%H" ));
+ $this->assertEquals( (18-$diff)%12, $this->l->formatDateGMT( $d, "%I" ));
+ $this->assertEquals( "pm", $this->l->formatDateGMT( $d, "%p" ));
+ $this->assertEquals( "PM", $this->l->formatDateGMT( $d, "%P" ));
+ $this->assertEquals( "00", $this->l->formatDateGMT( $d, "%M" ));
+ $this->assertEquals( "06", $this->l->formatDateGMT( $d, "%m" ));
+ $this->assertEquals( "00", $this->l->formatDateGMT( $d, "%S" ));
+ $this->assertEquals( "07", $this->l->formatDateGMT( $d, "%y" ));
+ $this->assertEquals( "2007", $this->l->formatDateGMT( $d, "%Y" ));
+ $this->assertEquals( "%", $this->l->formatDateGMT( $d, "%%" ));
+ $this->assertEquals( "5th of June", $this->l->formatDateGMT( $d, "%T" ));
+ $this->assertEquals( "5th", $this->l->formatDateGMT( $d, "%D" ));
+
+ // a longer format test
+ $this->assertEquals( "Jun ", $this->l->formatDateGMT( $d, "%b " ));
+ $this->assertEquals( "Jun 5", $this->l->formatDateGMT( $d, "%b %j" ));
+ $this->assertEquals( "05/06/2007", $this->l->formatDateGMT( $d, "%d/%m/%Y" ));
+ $this->assertEquals( "05 June, 2007 ".(18-$diff).":00", $this->l->formatDateGMT( $d, "%d %B, %Y %H:%M" ));
+ }
+
+
+ /**
+ * Tests that the LTLocale::testFormatDateGMT() method also behaves
+ * as expected
+ */
+ function testFormatDateGMT()
+ {
+ $d = new Timestamp( "20070205120000" );
+
+ $diff = $this->l->formatDate( $d, "%O" );
+ $diff = $diff / 100;
+
+ $this->assertEquals( "Mon", $this->l->formatDateGMT( $d, "%a" ));
+ $this->assertEquals( "Monday", $this->l->formatDateGMT( $d, "%A" ));
+ $this->assertEquals( "Feb", $this->l->formatDateGMT( $d, "%b" ));
+ $this->assertEquals( "February", $this->l->formatDateGMT( $d, "%B" ));
+ $this->assertEquals( "05", $this->l->formatDateGMT( $d, "%d" ));
+ $this->assertEquals( "5", $this->l->formatDateGMT( $d, "%j" ));
+ $this->assertEquals( 12-$diff, $this->l->formatDateGMT( $d, "%H" ));
+ $this->assertEquals( (12-$diff)%12, $this->l->formatDateGMT( $d, "%I" ));
+ $this->assertEquals( "pm", $this->l->formatDateGMT( $d, "%p" ));
+ $this->assertEquals( "PM", $this->l->formatDateGMT( $d, "%P" ));
+ $this->assertEquals( "00", $this->l->formatDateGMT( $d, "%M" ));
+ $this->assertEquals( "02", $this->l->formatDateGMT( $d, "%m" ));
+ $this->assertEquals( "00", $this->l->formatDateGMT( $d, "%S" ));
+ $this->assertEquals( "07", $this->l->formatDateGMT( $d, "%y" ));
+ $this->assertEquals( "2007", $this->l->formatDateGMT( $d, "%Y" ));
+ $this->assertEquals( "%", $this->l->formatDateGMT( $d, "%%" ));
+ $this->assertEquals( "5th of February", $this->l->formatDateGMT( $d, "%T" ));
+ $this->assertEquals( "5th", $this->l->formatDateGMT( $d, "%D" ));
+
+ // a longer format test
+ $this->assertEquals( "Feb ", $this->l->formatDateGMT( $d, "%b " ));
+ $this->assertEquals( "Feb 5", $this->l->formatDateGMT( $d, "%b %j" ));
+ $this->assertEquals( "05/02/2007", $this->l->formatDateGMT( $d, "%d/%m/%Y" ));
+ $this->assertEquals( "05 February, 2007 ".(12-$diff).":00", $this->l->formatDateGMT( $d, "%d %B, %Y %H:%M" ));
+ }
+
+ }
+?>
\ No newline at end of file
Modified: plog/branches/lifetype-1.2/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -9,7 +9,7 @@
lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
lt_include( PLOG_CLASS_PATH."class/net/xmlrpc/IXR_Library.lib.php" );
lt_include( PLOG_CLASS_PATH."class/net/url.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
/**
* Unit test cases for xmlrpc.php
@@ -30,7 +30,7 @@
$this->cat = $arr[0];
// load a UTF-8 locale
- $zhLocale =& Locales::getLocale( "zh_CN" );
+ $zhLocale =& LTLocales::getLocale( "zh_CN" );
$blogs = new Blogs();
$this->blog->setLocale( $zhLocale );
Modified: plog/branches/lifetype-1.2/class/view/admin/adminarticlecommentslistview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/adminarticlecommentslistview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/view/admin/adminarticlecommentslistview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -26,7 +26,7 @@
$this->AdminTemplatedView( $blogInfo, "edittrackbacks" );
$blogSettings = $blogInfo->getSettings();
- $this->_locale =& Locales::getLocale( $blogSettings->getValue( "locale" ), "en_UK" );
+ $this->_locale =& LTLocales::getLocale( $blogSettings->getValue( "locale" ), "en_UK" );
$this->_setParameters( $params );
Modified: plog/branches/lifetype-1.2/class/view/admin/adminblogsettingsview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/adminblogsettingsview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/view/admin/adminblogsettingsview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,7 +2,7 @@
lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/templatesets/templatesets.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/blogcategories.class.php" );
lt_include( PLOG_CLASS_PATH."class/net/http/subdomains.class.php" );
@@ -36,7 +36,7 @@
$this->setValue( "blogEnablePullDownMenu", $blogSettings->getValue( "pull_down_menu_enabled" ));
$this->setValue( "blogCommentsEnabled", $blogSettings->getValue( "comments_enabled" ));
$this->setValue( "blogShowFuturePosts", $blogSettings->getValue( "show_future_posts_in_calendar" ));
- $locale =& Locales::getLocale( $blogSettings->getValue( "locale" ) );
+ $locale =& LTLocales::getLocale( $blogSettings->getValue( "locale" ) );
$this->setValue( "blogFirstDayOfWeek", $blogSettings->getValue( "first_day_of_week", $locale->firstDayOfWeek() ));
$this->setValue( "blogEnableAutosaveDrafts", $blogSettings->getValue( "new_drafts_autosave_enabled" ));
$this->setValue( "blogCommentsOrder", $blogSettings->getValue( "comments_order" ));
@@ -87,9 +87,9 @@
$templates = $ts->getBlogTemplateSets( $this->_blogInfo->getId(), true );
$this->setValue( "templates", $templates);
// loading all the locales from disk is a pretty heavy task but doing so, we'll get
- // nice Locale object with things like the encoding, the description, etc... which looks
+ // nice LTLocale object with things like the encoding, the description, etc... which looks
// waaaay nicer than just showing the locale code
- $this->setValue( "locales", Locales::getLocales());
+ $this->setValue( "locales", LTLocales::getLocales());
// set the blog categories
$categories = new BlogCategories();
Modified: plog/branches/lifetype-1.2/class/view/admin/admindashboardview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/admindashboardview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/view/admin/admindashboardview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -120,7 +120,7 @@
{
// set the view character set based on the default locale
if( empty( $this->_userBlogs ))
- $locale =& Locales::getLocale( $this->_config->getValue( "default_locale" ));
+ $locale =& LTLocales::getLocale( $this->_config->getValue( "default_locale" ));
else
$locale = $this->_userBlogs[0]->getLocale();
Modified: plog/branches/lifetype-1.2/class/view/admin/admindefaultview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/admindefaultview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/view/admin/admindefaultview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -8,7 +8,7 @@
lt_include( PLOG_CLASS_PATH."class/view/view.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/templateservice.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/template.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/misc/version.class.php" );
// name of the template we are going to use for this view
@@ -40,7 +40,7 @@
{
// set the view character set based on the default locale
$config =& Config::getConfig();
- $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+ $locale =& LTLocales::getLocale( $config->getValue( "default_locale" ));
$this->setValue( 'version', Version::getVersion());
$this->setCharset( $locale->getCharset());
Modified: plog/branches/lifetype-1.2/class/view/admin/admineditsiteblogview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/admineditsiteblogview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/view/admin/admineditsiteblogview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,7 +1,7 @@
<?php
lt_include( PLOG_CLASS_PATH.'class/view/admin/admintemplatedview.class.php' );
- lt_include( PLOG_CLASS_PATH.'class/locale/locales.class.php' );
+ lt_include( PLOG_CLASS_PATH.'class/locale/ltlocales.class.php' );
lt_include( PLOG_CLASS_PATH.'class/template/templatesets/templatesets.class.php' );
lt_include( PLOG_CLASS_PATH.'class/dao/blogstatus.class.php' );
lt_include( PLOG_CLASS_PATH."class/net/http/subdomains.class.php" );
@@ -42,7 +42,7 @@
// get the blog template sets
$this->setValue( 'templates', $ts->getBlogTemplateSets( $this->_editBlogInfo->getId(), true ));
// and the list of locale availables
- $this->setValue( 'locales', Locales::getLocales());
+ $this->setValue( 'locales', LTLocales::getLocales());
$this->setValue( 'blogStatus', $this->_editBlogInfo->getStatus());
$this->setValue( 'blogStatusList', BlogStatus::getStatusList());
$blogSettings = $this->_editBlogInfo->getSettings();
Modified: plog/branches/lifetype-1.2/class/view/admin/adminloginview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/adminloginview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/view/admin/adminloginview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -3,7 +3,7 @@
lt_include( PLOG_CLASS_PATH."class/view/view.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/templateservice.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/template.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
define( "ADMINLOGIN_TEMPLATE", "chooseblog" );
@@ -46,7 +46,7 @@
$template = $ts->AdminTemplate( ADMINLOGIN_TEMPLATE );
// load the default locale
$config =& Config::getConfig();
- $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+ $locale =& LTLocales::getLocale( $config->getValue( "default_locale" ));
$this->setValue( "locale", $locale );
// assign all the values
$template->assign( $this->_params->getAsArray());
Modified: plog/branches/lifetype-1.2/class/view/admin/adminpostslistview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/adminpostslistview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/view/admin/adminpostslistview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,7 +1,7 @@
<?php
lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/articlestatus.class.php" );
Modified: plog/branches/lifetype-1.2/class/view/admin/adminregisterblogview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/adminregisterblogview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/view/admin/adminregisterblogview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,7 +2,7 @@
lt_include( PLOG_CLASS_PATH."class/view/view.class.php" );
lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/templatesets/templatesets.class.php" );
lt_include( PLOG_CLASS_PATH."class/net/http/subdomains.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/blogcategories.class.php" );
@@ -27,7 +27,7 @@
{
// set the view character set based on the default locale
$config =& Config::getConfig();
- $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+ $locale =& LTLocales::getLocale( $config->getValue( "default_locale" ));
$this->setCharset( $locale->getCharset());
parent::render();
@@ -38,7 +38,7 @@
$config->getValue( "default_locale" ));
$this->setValue( "locale", $locale );
$this->setValue( "user", $this->_userInfo );
- $this->setValue( "locales", Locales::getLocales());
+ $this->setValue( "locales", LTLocales::getLocales());
// only do blog_domain stuff if subdomains are enabled
// Don't waste time here, as well as be less confusing by
Modified: plog/branches/lifetype-1.2/class/view/admin/adminsimpleerrorview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/adminsimpleerrorview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/view/admin/adminsimpleerrorview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,7 +1,7 @@
<?php
lt_include( PLOG_CLASS_PATH."class/view/view.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
define( "ADMINSIMPLEERROR_TEMPLATE", "simpleerror" );
@@ -23,7 +23,7 @@
{
// set the view character set based on the default locale
$config =& Config::getConfig();
- $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+ $locale =& LTLocales::getLocale( $config->getValue( "default_locale" ));
$this->setValue( 'version', Version::getVersion());
$this->setCharset( $locale->getCharset());
Modified: plog/branches/lifetype-1.2/class/view/admin/adminsimplemessageview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/adminsimplemessageview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/view/admin/adminsimplemessageview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,7 +1,7 @@
<?php
lt_include( PLOG_CLASS_PATH."class/view/view.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
define( "ADMINSIMPLEMESSAGE_TEMPLATE", "simplemessage" );
@@ -24,7 +24,7 @@
{
// set the view character set based on the default locale
$config =& Config::getConfig();
- $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+ $locale =& LTLocales::getLocale( $config->getValue( "default_locale" ));
$this->setValue( 'version', Version::getVersion());
$this->setCharset( $locale->getCharset());
Modified: plog/branches/lifetype-1.2/class/view/admin/adminsitelocaleslistview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/adminsitelocaleslistview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/view/admin/adminsitelocaleslistview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -1,7 +1,7 @@
<?php
lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
/**
* \ingroup View
@@ -18,7 +18,7 @@
function render()
{
// load all the locale files
- $locales = new Locales();
+ $locales = new LTLocales();
$siteLocales = $locales->getLocales();
$this->setValue( "locales", $siteLocales );
Modified: plog/branches/lifetype-1.2/class/view/blogview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/blogview.class.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/class/view/blogview.class.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -94,7 +94,7 @@
// format of dates used in the archive, but it defaults to '%B %Y' if none specified
$archiveDateFormat = $this->_locale->tr( 'archive_date_format' );
- // need to check whether we got the same thing back, since that's the way Locale::tr() works instead of
+ // need to check whether we got the same thing back, since that's the way LTLocale::tr() works instead of
// returning an empty string
if( $archiveDateFormat == "archive_date_format" ) $archiveDateFormat = ARCHIVE_DEFAULT_DATE_FORMAT;
Modified: plog/branches/lifetype-1.2/locale/locale_ca_ES.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_ca_ES.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_ca_ES.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,7 +2,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'iso-8859-1';
$messages['locale_description'] = 'Traducció de LifeType al català';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/locale_de_DE.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_de_DE.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_de_DE.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -3,7 +3,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'iso-8859-1';
$messages['locale_description'] = 'Deutsche Sprachdatei für LifeType';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/locale_en_UK.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_en_UK.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_en_UK.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -3,7 +3,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'iso-8859-1';
$messages['locale_description'] = 'English locale file for LifeType';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/locale_es_ES.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_es_ES.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_es_ES.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,7 +2,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'iso-8859-1';
$messages['locale_description'] = 'Traducción al español de LifeType';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/locale_fr_FR.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_fr_FR.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_fr_FR.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -20,7 +20,7 @@
$messages["encoding"] = 'UTF-8';
$messages['locale_description'] = 'Traduction française de LifeType'; // must use HTML entities to be ok with any charset
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
$messages['days'] = Array( "dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi" );
Modified: plog/branches/lifetype-1.2/locale/locale_gl_ES.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_gl_ES.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_gl_ES.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -4,7 +4,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'iso-8859-1';
$messages['locale_description'] = 'Traducción o galego de LifeType';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/locale_hu_HU.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_hu_HU.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_hu_HU.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -6,7 +6,7 @@
$messages["encoding"] = 'UTF-8';
$messages['locale_description'] = 'Magyar fordítás a LifeType-hoz'; // must use HTML entities to be ok with any charset
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%Y.%m.%d %H:%M';
$messages['days'] = Array( "vasárnap", "hétfÅ", "kedd", "szerda", "csütörtök", "péntek", "szombat" );
Modified: plog/branches/lifetype-1.2/locale/locale_id_ID.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_id_ID.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_id_ID.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -3,7 +3,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'iso-8859-1';
$messages['locale_description'] = 'Indonesian locale file for LifeType';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d-%m-%Y %H.%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/locale_it_IT.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_it_IT.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_it_IT.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,7 +2,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'iso-8859-15';
$messages['locale_description'] = 'File di localizzazione italiano per LifeType';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/locale_ja_JP.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_ja_JP.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_ja_JP.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -3,7 +3,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'UTF-8';
$messages['locale_description'] = 'Japanese locale file for LifeType';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%Y/%m/%d %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/locale_nl_NL.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_nl_NL.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_nl_NL.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -3,7 +3,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'iso-8859-1';
$messages['locale_description'] = 'Nederlands locale bestand voor LifeType';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/locale_pl_PL.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_pl_PL.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_pl_PL.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -3,7 +3,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'utf-8';
$messages['locale_description'] = 'Polskie tÅumaczenie dla LifeType';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/locale_pt_BR.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_pt_BR.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_pt_BR.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -3,7 +3,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'iso-8859-1';
$messages['locale_description'] = 'Portuguese-Brazilian locale file for LifeType';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/locale_vi_VN.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_vi_VN.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_vi_VN.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -3,7 +3,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'utf-8';
$messages['locale_description'] = 'Vietnamese locale file for LifeType';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/locale_zh_CN.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_zh_CN.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_zh_CN.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -3,7 +3,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'utf-8';
$messages['locale_description'] = 'Simplified Chinese translation (UTF-8)';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/locale_zh_TW.php
===================================================================
--- plog/branches/lifetype-1.2/locale/locale_zh_TW.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/locale_zh_TW.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -3,7 +3,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'utf-8';
$messages['locale_description'] = 'Traditional Chinese translation (UTF-8)';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/unported/locale_el_GR.php
===================================================================
--- plog/branches/lifetype-1.2/locale/unported/locale_el_GR.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/unported/locale_el_GR.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,7 +2,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'UTF-8';
$messages['locale_description'] = 'ÎÎ»Î»Î·Î½Î¹ÎºÏ Î±ÏÏείο locale για Ïο Lifetype';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/unported/locale_eu_ES.php
===================================================================
--- plog/branches/lifetype-1.2/locale/unported/locale_eu_ES.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/unported/locale_eu_ES.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,7 +2,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'iso-8859-1';
$messages['locale_description'] = 'Euskara';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%Y/%m/%d %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/unported/locale_fa_IR.php
===================================================================
--- plog/branches/lifetype-1.2/locale/unported/locale_fa_IR.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/unported/locale_fa_IR.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -7,7 +7,7 @@
$messages['encoding'] = 'UTF-8';
$messages['locale_description'] = 'Persian Locale for LifeType';
$messages['direction']='rtl';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%T:%U %e/%w/%q';
$messages['archive_date_format'] = '%B %Y';
Modified: plog/branches/lifetype-1.2/locale/unported/locale_fi_FI.php
===================================================================
--- plog/branches/lifetype-1.2/locale/unported/locale_fi_FI.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/unported/locale_fi_FI.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -3,7 +3,7 @@
// aseta tämä koodaustyypiksi, jotta sivut näkyvät oikein
$messages['encoding'] = 'iso-8859-1';
$messages['locale_description'] = 'Suomen kieli LifeTypeiin';
-// aikaformaatti, katso Locale::formatDate lisätietoa varten
+// aikaformaatti, katso LTLocale::formatDate lisätietoa varten
$messages['date_format'] = '%d/%m/%Y %H:%M';
// viikonpäivät
Modified: plog/branches/lifetype-1.2/locale/unported/locale_gz_ES.php
===================================================================
--- plog/branches/lifetype-1.2/locale/unported/locale_gz_ES.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/unported/locale_gz_ES.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -3,7 +3,7 @@
// Traducción o galego de lifetype 102, realizada por Víctor Julio Quesada Varela, 2006. egalego at gmail.com, www.egalego.com
$messages['encoding'] = 'iso-8859-1';
$messages['locale_description'] = 'Traducción o galego de LifeType';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/unported/locale_ja_JP.php
===================================================================
--- plog/branches/lifetype-1.2/locale/unported/locale_ja_JP.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/unported/locale_ja_JP.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -8,7 +8,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'EUC-JP';
$messages['locale_description'] = 'Japanese locale for LifeType 1.x (EUC-JP)';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/unported/locale_ja_JP_utf8.php
===================================================================
--- plog/branches/lifetype-1.2/locale/unported/locale_ja_JP_utf8.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/unported/locale_ja_JP_utf8.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -15,7 +15,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'UTF-8';
$messages['locale_description'] = 'Japanese locale for LifeType 1.x (UTF-8)';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/unported/locale_ko_KR.php
===================================================================
--- plog/branches/lifetype-1.2/locale/unported/locale_ko_KR.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/unported/locale_ko_KR.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,7 +2,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'utf-8';
$messages['locale_description'] = 'Korean locale file for LifeType';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%Y/%m/%d %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/unported/locale_nb_NO.php
===================================================================
--- plog/branches/lifetype-1.2/locale/unported/locale_nb_NO.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/unported/locale_nb_NO.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -19,7 +19,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'iso-8859-1';
$messages['locale_description'] = 'Norsk oversettelse (locale fil) for LifeType 1.x';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/unported/locale_sv_SE.php
===================================================================
--- plog/branches/lifetype-1.2/locale/unported/locale_sv_SE.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/unported/locale_sv_SE.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,7 +2,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'iso-8859-1';
$messages['locale_description'] = 'Swedish locale file for pLog';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/locale/unported/locale_tr_TR.php
===================================================================
--- plog/branches/lifetype-1.2/locale/unported/locale_tr_TR.php 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/locale/unported/locale_tr_TR.php 2011-09-13 18:55:05 UTC (rev 7133)
@@ -2,7 +2,7 @@
// set this to the encoding that should be used to display the pages correctly
$messages['encoding'] = 'windows-1254';
$messages['locale_description'] = 'LifeType için Türkçe Dil Dosyasý';
-// locale format, see Locale::formatDate for more information
+// locale format, see LTLocale::formatDate for more information
$messages['date_format'] = '%d/%m/%Y %H:%M';
// days of the week
Modified: plog/branches/lifetype-1.2/wizard
===================================================================
--- plog/branches/lifetype-1.2/wizard 2011-09-01 14:03:26 UTC (rev 7132)
+++ plog/branches/lifetype-1.2/wizard 2011-09-13 18:55:05 UTC (rev 7133)
@@ -52,8 +52,8 @@
lt_include( PLOG_CLASS_PATH."class/gallery/resizers/gddetector.class.php" );
lt_include( PLOG_CLASS_PATH."class/config/configfilestorage.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );
- lt_include( PLOG_CLASS_PATH."class/locale/localefinder.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocales.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/locale/ltlocalefinder.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/templatesets/templatesets.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/bloginfo.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" );
@@ -1047,9 +1047,9 @@
$message .= "The helper tool 'convert' (from the ImageMagick package) was found in $pathToConvert<br/>";
// Scan for locales
- $locales = new Locales();
+ $locales = new LTLocales();
// find all the new locales that we have not yet stored
- $f = new LocaleFinder();
+ $f = new LTLocaleFinder();
$newLocaleCodes = $f->find();
foreach( $newLocaleCodes as $newLocaleCode ) {
$res = $locales->addLocale( $newLocaleCode );
@@ -1195,8 +1195,8 @@
$this->_view = new Wizardview( "step4" );
$this->_view->setValue( "ownerid", $userId );
- $this->_view->setValue( "siteLocales", Locales::getLocales());
- $this->_view->setValue( "defaultLocale", Locales::getDefaultLocale());
+ $this->_view->setValue( "siteLocales", LTLocales::getLocales());
+ $this->_view->setValue( "defaultLocale", LTLocales::getDefaultLocale());
$ts = new TemplateSets();
$this->_view->setValue( "siteTemplates", $ts->getGlobalTemplateSets());
$this->setCommonData();
@@ -1222,8 +1222,8 @@
$this->registerFieldValidator( "blogLocale", new StringValidator());
$view = new WizardView( "step4" );
$view->setErrorMessage( "Some data is missing or incorrect" );
- $view->setValue( "siteLocales", Locales::getLocales());
- $view->setValue( "defaultLocale", Locales::getDefaultLocale());
+ $view->setValue( "siteLocales", LTLocales::getLocales());
+ $view->setValue( "defaultLocale", LTLocales::getDefaultLocale());
$ts = new TemplateSets();
$view->setValue( "siteTemplates", $ts->getGlobalTemplateSets());
$this->setValidationErrorView( $view );
@@ -1265,7 +1265,7 @@
$newblogId = $blogs->addBlog( $blog );
if( !$newblogId ) {
$this->_view = new WizardView( "step4" );
- $this->_view->setValue( "siteLocales", Locales::getLocales());
+ $this->_view->setValue( "siteLocales", LTLocales::getLocales());
$ts = new TemplateSets();
$this->_view->setValue( "siteTemplates", $ts->getGlobalTemplateSets());
$this->_view->setErrorMessage( "There was an error creating the new blog" );
@@ -1280,7 +1280,7 @@
$catId = $articleCategories->addArticleCategory( $articleCategory );
// load the right locale
- $locale =& Locales::getLocale( $this->_blogLocale );
+ $locale =& LTLocales::getLocale( $this->_blogLocale );
// and load the right text
$articleTopic = $locale->tr( "register_default_article_topic" );
$articleText = $locale->tr( "register_default_article_text" );
More information about the pLog-svn
mailing list