From 01d2f767b5d5c9468654f1f282880a4f94522901 Mon Sep 17 00:00:00 2001 From: real_nowhereman Date: Wed, 2 Jan 2008 17:21:21 +0000 Subject: [PATCH] added metatags to , if plugin archives is enabled; core.theme changes in the name of a function to a more general one might require flushing fp-content/cache/* :) --- fp-includes/core/core.theme.php | 6 +-- fp-plugins/archives/plugin.archives.php | 50 +++++++++++++++++++------ 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/fp-includes/core/core.theme.php b/fp-includes/core/core.theme.php index 2892c9c..df6830d 100644 --- a/fp-includes/core/core.theme.php +++ b/fp-includes/core/core.theme.php @@ -289,7 +289,7 @@ if (!isset($_GET['feed']) || empty($_GET['feed'])) { $smarty->register_modifier('date_format_daily', 'theme_smarty_modifier_date_format_daily'); - $smarty->register_modifier('date_format', 'theme_smarty_modifier_date_format'); + $smarty->register_modifier('date_format', 'theme_date_format'); } $smarty->register_modifier('date_rfc3339', 'theme_smarty_modifier_date_rfc3339'); @@ -327,7 +327,7 @@ } - function theme_smarty_modifier_date_format( $string, + function theme_date_format( $string, $format = null, $default_date = '' ) { @@ -404,7 +404,7 @@ if (is_null($format)) $format = $fp_config['locale']['dateformat']; - $current_day = theme_smarty_modifier_date_format($string, $format, $default_date); + $current_day = theme_date_format($string, $format, $default_date); if (!isset($THEME_CURRENT_DAY) || $THEME_CURRENT_DAY != $current_day) { $THEME_CURRENT_DAY = $current_day; diff --git a/fp-plugins/archives/plugin.archives.php b/fp-plugins/archives/plugin.archives.php index 727b634..80320f5 100644 --- a/fp-plugins/archives/plugin.archives.php +++ b/fp-plugins/archives/plugin.archives.php @@ -8,10 +8,11 @@ Author: NoWhereMan Author URI: http://flatpress.sf.net */ -class plugin_archive_monthlist extends fs_filelister { +class plugin_archives_monthlist extends fs_filelister { var $_directory = CONTENT_DIR; var $_list = array(); + var $_htmllist = array(); var $_months = array(); var $_year = ''; @@ -24,7 +25,7 @@ class plugin_archive_monthlist extends fs_filelister { // we may have nested elements) $this->_year = $file; $lnk = get_year_link($file); - $this->_list[$this->_year] = "
  • 20$file"; + $this->_htmllist[$this->_year] = "
  • 20$file"; return 1; } elseif (is_dir($f)) { $this->_months[] = $file; @@ -40,11 +41,14 @@ class plugin_archive_monthlist extends fs_filelister { if ($mos =& $this->_months) { sort($mos); $list = ''; + $linearlist = array(); foreach($mos as $mth) { $lnk = get_month_link($y, $mth); - $list = "
  • ". - strftime( '%B', mktime(0, 0, 0, $mth, 1, 0 )) - .'
  • ' . $list; + $the_month = theme_date_format( mktime(0, 0, 0, $mth, 1, 0 ), '%B'); + $list = "
  • ". + $the_month + .'
  • ' . $list; + $linearlist["$the_month 20{$this->_year}"] = $lnk; } $list = ''; } @@ -52,28 +56,50 @@ class plugin_archive_monthlist extends fs_filelister { $mos = array(); // we close year's li - $this->_list[$y] .= $list . ''; + $this->_list[$y] = $linearlist; + $this->_htmllist[$y] .= $list . ''; } - + function getList() { krsort($this->_list); - return implode($this->_list); + return $this->_list; + } + + function getHtmlList() { + krsort($this->_htmllist); + return implode($this->_htmllist); } } + +global $PLUGIN_ARCHIVES_MONTHLIST; +$PLUGIN_ARCHIVES_MONTHLIST = new plugin_archives_monthlist; + +function plugin_archives_head() { + + global $PLUGIN_ARCHIVES_MONTHLIST; + echo "\n\n"; + foreach($PLUGIN_ARCHIVES_MONTHLIST->getList() as $y => $months) { + foreach ($months as $ttl => $link) + echo "\n"; + } + + echo "\n\n"; +} +add_filter('wp_head', 'plugin_archives_head'); + function plugin_archives_widget() { lang_load('plugin:archives'); - global $lang; + global $lang, $PLUGIN_ARCHIVES_MONTHLIST; - $a =& new plugin_archive_monthlist; return array( 'subject' => $lang['plugin']['archives']['subject'], - 'content' => ($list = $a->getList()) ? + 'content' => ($list = $PLUGIN_ARCHIVES_MONTHLIST->getHtmlList()) ? '' : "

    {$lang['plugin']['archives']['no_posts']}

    " @@ -82,4 +108,4 @@ function plugin_archives_widget() { register_widget('archives', 'Archives', 'plugin_archives_widget'); -?> \ No newline at end of file +?>