[pLog-svn] r2020 - plog/branches/plog-1.0.1/class/view

oscar at devel.plogworld.net oscar at devel.plogworld.net
Thu May 19 11:05:51 GMT 2005


Author: oscar
Date: 2005-05-19 11:05:51 +0000 (Thu, 19 May 2005)
New Revision: 2020

Modified:
   plog/branches/plog-1.0.1/class/view/blogview.class.php
Log:
fixed issue 519 (http://bugs.plogworld.net/view.php?id=519) and now archive 
dates format is not hardcoded anymore but defaults to the current one if no
date is specified in the locale file in the 'archive_date_format' key. Default
value is now '%B %Y'.



Modified: plog/branches/plog-1.0.1/class/view/blogview.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/view/blogview.class.php	2005-05-19 11:05:23 UTC (rev 2019)
+++ plog/branches/plog-1.0.1/class/view/blogview.class.php	2005-05-19 11:05:51 UTC (rev 2020)
@@ -12,6 +12,11 @@
     include_once( PLOG_CLASS_PATH.'class/dao/mylinkscategories.class.php' ); 
     include_once( PLOG_CLASS_PATH.'class/plugin/pluginmanager.class.php' );
     include_once( PLOG_CLASS_PATH.'class/xml/rssparser/rssparser.class.php' );    
+    
+    /**
+     * default date format used for the archive links
+     */
+    define( "ARCHIVE_DEFAULT_DATE_FORMAT", '%B %Y' );
 
     /**
      * \ingroup View
@@ -88,6 +93,13 @@
             $links = Array();
             $locale = $this->_blogInfo->getLocale();
             $urls = $this->_blogInfo->getBlogRequestGenerator();
+            
+            // format of dates used in the archive, but it defaults to '%B %Y' if none specified
+            $archiveDateFormat = $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
+            // returning an empty string      
+            if( $archiveDateFormat == "archive_date_format" ) $archiveDateFormat = ARCHIVE_DEFAULT_DATE_FORMAT;
+            
             foreach( $archiveStats as $yearName => $year) {
             	foreach( $year as $monthName => $month ) {
                 	// we can use the Timestamp class to help us with this...
@@ -95,7 +107,7 @@
                     $t->setYear( $yearName );
                     $t->setMonth( $monthName );
                     $archiveUrl = $urls->getArchiveLink( $t->getYear().$t->getMonth());
-                    $linkName = $locale->formatDate( $t, '%B %Y' );
+                    $linkName = $locale->formatDate( $t, $archiveDateFormat );
                 	$link = new ArchiveLink( $linkName, '', $archiveUrl, $this->_blogInfo->getId(), 0, $month, 0);
                     $links[] = $link;
                 }




More information about the pLog-svn mailing list