Here is the site:
http://www.2upon2wheels.com/serendipity/
Any help is appreciated. Thank you!
Code: Select all
if ($ver == 8)
Code: Select all
<?php
// A plug-in for the Serendipity PHP blog (http://www.s9y.org) by Matthew Maude <matthew@risingdawn.org>
// This is a variation of the archives plug-in, and a copy of the navigation used by the blogs at
// http://www.richardherring.com/warmingup and http://www.emmakennedy.net/blog/
// so thanks to whoever designed that
class serendipity_plugin_datelist extends serendipity_plugin {
var $title = 'Date List';
function introspect(&$propbag)
{
$propbag->add('name','Date List');
$propbag->add('description', 'Rip-off of the blog style at www.richardherring.com/warmingup');
$propbag->add('configuration', array('maxmonths'));
}
function introspect_config_item($name, &$propbag) {
switch($name) {
case 'maxmonths':
$propbag->add('type', 'string');
$propbag->add('name', 'Maximum Months');
$propbag->add('description', 'Months to display in list (0 = all)');
$propbag->add('default', 0);
break;
default:
return false;
}
return true;
}
function generate_content(&$title) {
$title = $this->title;
global $serendipity;
$this->writeStyles();
$this->writeJavascript();
$this->drawDateList();
}
function writeStyles(){
?>
<style type="text/css">
<!--
#datelist_list {
}
#datelist_recent{
padding-top: 5px;
}
#datelist_month {
font-size: 11px;
}
#datelist_recent a:link,
#datelist_recent a:visited,
#datelist_list a:link,
#datelist_list a:visited {
}
#datelist_recent a:hover,
#datelist_list a:hover {
}
#datelist_days {
padding-left: 2em;
padding-top: 5px;
padding-bottom: 5px;
border-style: none;
font-size: 10px;
}
#datelist_days a:visited {
text-decoration: none;
border: 0;
color: #444444;
}
#datelist_days a:link {
text-decoration: none;
border: 0;
color: #000000;
}
#datelist_days a:hover {
color: #c0c0c0;
}
.open {
display: block;
}
.closed {
display: none;
}
-->
</style>
<?php
}
function writeJavascript(){
global $serendipity;
$imgPath = $serendipity['baseURL'] . 'plugins/serendipity_plugin_datelist/';
?>
<script type="text/javascript">
<!--
function toggle(id){
//closedimg = "<?php echo $imgPath; ?>plus.gif";
//openimg = "<?php echo $imgPath; ?>minus.gif";
closedimg = "<?php echo serendipity_getTemplateFile('img/plus.png') ?>";
openimg = "<?php echo serendipity_getTemplateFile('img/minus.png') ?>";
ul = "days" + id;
img = "month_img" + id;
ulElement = document.getElementById(ul);
imgElement = document.getElementById(img);
if (ulElement){
if (ulElement.className == 'closed'){
ulElement.className = "open";
imgElement.src = openimg;
} else {
ulElement.className = "closed";
imgElement.src = closedimg;
}
}
}
//-->
</script>
<?php
}
function drawDateList(){
global $serendipity;
$MaxMonths = $this->get_config('maxmonths');
if (!isset($serendipity['GET']['calendarZoom'])) {
if (!isset($serendipity['range'])) {
$serendipity['GET']['calendarZoom'] = serendipity_serverOffsetHour(time());
} else {
$serendipity['GET']['calendarZoom'] = serendipity_serverOffsetHour($serendipity['range'][0]);
}
}
$month = date('m', serendipity_serverOffsetHour($serendipity['GET']['calendarZoom'], true));
$year = date('Y', serendipity_serverOffsetHour($serendipity['GET']['calendarZoom'], true));
$pageTime = mktime(0, 0, 0, $month, 1, $year);
$pageMonth = date('F Y',$pageTime);
// Get first and last entry
$minmax = serendipity_db_query("SELECT MAX(timestamp) AS max, MIN(timestamp) AS min FROM {$serendipity['dbPrefix']}entries");
if (!is_array($minmax) || !is_array($minmax[0]) || $minmax[0]['min'] < 1 || $minmax[0]['max'] < 1){
echo '(no entries)<br>';
return false;
}
// Find out about diary entries
$querystring = "SELECT timestamp
FROM {$serendipity['dbPrefix']}entries e
WHERE e.isdraft = 'false'
ORDER BY timestamp DESC";
$imgPath = $serendipity['baseURL'] . 'plugins/serendipity_plugin_datelist/';
$rows = serendipity_db_query($querystring);
if (is_array($rows)) {
$monthCount = 0;
echo '<div id="datelist_list">';
foreach ($rows as $row){
$thisMonth = date('F Y',$row['timestamp']);
$thisDay = date('D jS',$row['timestamp']);
$date = getdate($row['timestamp']);
if ($thisMonth != $currentMonth){
if ($monthCount > 0) echo '</div></div>';
$monthCount++;
$currentMonth = $thisMonth;
$open = ((isset($pageMonth) && $pageMonth == $currentMonth) || (!isset($pageMonth) && $currentMonth == 1));
$monthTime = mktime(0, 0, 0, $date['mon'], 1, $date['year']);
$monthLink = serendipity_archiveDateUrl(sprintf('%04d/%02d', $date['year'], $date['mon']));
?>
<div id="datelist_month"><a href="javascript:toggle(<?php echo $monthCount; ?>);">
<img src="<?php echo ($open ? serendipity_getTemplateFile('img/minus.png') : serendipity_getTemplateFile('img/plus.png')); ?>" alt="+" id="month_img<?php echo $monthCount; ?>" border="0"></a> <a href="<?php echo $monthLink; ?>"><?php echo $currentMonth; ?></a>
</div>
<div id="days<?php echo $monthCount; ?>" class="<?php echo ($open ? 'open' : 'closed'); ?>"><div id="datelist_days">
<?php
}
if ($thisDay != $currentDay){
$currentDay = $thisDay;
?>
<a href="<?php echo serendipity_archiveDateUrl(sprintf('%4d/%02d/%02d', $date['year'], $date['mon'], $date['mday'])); ?>"><?php echo $currentDay; ?></a><br>
<?php
}
if ($MaxMonths > 0 && $monthCount >= $MaxMonths) break;
}
echo '</div></div></div>';
echo "<div id='datelist_recent'><a href='{$serendipity['serendipityHTTPPath']}'>" . RECENT . "</a></div>\n";
}
}
}