added metatags to <head>, 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/* :)
This commit is contained in:
parent
fbe0b42e25
commit
01d2f767b5
@ -289,7 +289,7 @@
|
|||||||
|
|
||||||
if (!isset($_GET['feed']) || empty($_GET['feed'])) {
|
if (!isset($_GET['feed']) || empty($_GET['feed'])) {
|
||||||
$smarty->register_modifier('date_format_daily', 'theme_smarty_modifier_date_format_daily');
|
$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');
|
$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,
|
$format = null,
|
||||||
$default_date = ''
|
$default_date = ''
|
||||||
) {
|
) {
|
||||||
@ -404,7 +404,7 @@
|
|||||||
if (is_null($format))
|
if (is_null($format))
|
||||||
$format = $fp_config['locale']['dateformat'];
|
$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) {
|
if (!isset($THEME_CURRENT_DAY) || $THEME_CURRENT_DAY != $current_day) {
|
||||||
$THEME_CURRENT_DAY = $current_day;
|
$THEME_CURRENT_DAY = $current_day;
|
||||||
|
@ -8,10 +8,11 @@ Author: NoWhereMan
|
|||||||
Author URI: http://flatpress.sf.net
|
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 $_directory = CONTENT_DIR;
|
||||||
var $_list = array();
|
var $_list = array();
|
||||||
|
var $_htmllist = array();
|
||||||
var $_months = array();
|
var $_months = array();
|
||||||
var $_year = '';
|
var $_year = '';
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ class plugin_archive_monthlist extends fs_filelister {
|
|||||||
// we may have nested elements)
|
// we may have nested elements)
|
||||||
$this->_year = $file;
|
$this->_year = $file;
|
||||||
$lnk = get_year_link($file);
|
$lnk = get_year_link($file);
|
||||||
$this->_list[$this->_year] = "<li class=\"archive-year\"> <a href=\"$lnk\">20$file</a>";
|
$this->_htmllist[$this->_year] = "<li class=\"archive-year archive-y20$file\"> <a href=\"$lnk\">20$file</a>";
|
||||||
return 1;
|
return 1;
|
||||||
} elseif (is_dir($f)) {
|
} elseif (is_dir($f)) {
|
||||||
$this->_months[] = $file;
|
$this->_months[] = $file;
|
||||||
@ -40,11 +41,14 @@ class plugin_archive_monthlist extends fs_filelister {
|
|||||||
if ($mos =& $this->_months) {
|
if ($mos =& $this->_months) {
|
||||||
sort($mos);
|
sort($mos);
|
||||||
$list = '';
|
$list = '';
|
||||||
|
$linearlist = array();
|
||||||
foreach($mos as $mth) {
|
foreach($mos as $mth) {
|
||||||
$lnk = get_month_link($y, $mth);
|
$lnk = get_month_link($y, $mth);
|
||||||
$list = "<li class=\"archive-month\"><a href=\"$lnk\">".
|
$the_month = theme_date_format( mktime(0, 0, 0, $mth, 1, 0 ), '%B');
|
||||||
strftime( '%B', mktime(0, 0, 0, $mth, 1, 0 ))
|
$list = "<li class=\"archive-month archive-m$mth\"><a href=\"$lnk\">".
|
||||||
|
$the_month
|
||||||
.' </a></li>' . $list;
|
.' </a></li>' . $list;
|
||||||
|
$linearlist["$the_month 20{$this->_year}"] = $lnk;
|
||||||
}
|
}
|
||||||
$list = '<ul>' . $list . '</ul>';
|
$list = '<ul>' . $list . '</ul>';
|
||||||
}
|
}
|
||||||
@ -52,28 +56,50 @@ class plugin_archive_monthlist extends fs_filelister {
|
|||||||
$mos = array();
|
$mos = array();
|
||||||
|
|
||||||
// we close year's li
|
// we close year's li
|
||||||
$this->_list[$y] .= $list . '</li>';
|
$this->_list[$y] = $linearlist;
|
||||||
|
$this->_htmllist[$y] .= $list . '</li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getList() {
|
function getList() {
|
||||||
krsort($this->_list);
|
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<!-- archives -->\n";
|
||||||
|
foreach($PLUGIN_ARCHIVES_MONTHLIST->getList() as $y => $months) {
|
||||||
|
foreach ($months as $ttl => $link)
|
||||||
|
echo "<link rel=\"archives\" title=\"{$ttl}\" href=\"{$link}\" />\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "\n<!-- end of archives -->\n";
|
||||||
|
}
|
||||||
|
add_filter('wp_head', 'plugin_archives_head');
|
||||||
|
|
||||||
function plugin_archives_widget() {
|
function plugin_archives_widget() {
|
||||||
|
|
||||||
lang_load('plugin:archives');
|
lang_load('plugin:archives');
|
||||||
global $lang;
|
global $lang, $PLUGIN_ARCHIVES_MONTHLIST;
|
||||||
|
|
||||||
$a =& new plugin_archive_monthlist;
|
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'subject' => $lang['plugin']['archives']['subject'],
|
'subject' => $lang['plugin']['archives']['subject'],
|
||||||
|
|
||||||
'content' => ($list = $a->getList()) ?
|
'content' => ($list = $PLUGIN_ARCHIVES_MONTHLIST->getHtmlList()) ?
|
||||||
'<ul>' . $list . '</ul>'
|
'<ul>' . $list . '</ul>'
|
||||||
:
|
:
|
||||||
"<p>{$lang['plugin']['archives']['no_posts']}</p>"
|
"<p>{$lang['plugin']['archives']['no_posts']}</p>"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user