# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
+if (defined('S9Y_FRAMEWORK_PLUGIN_INTERNAL')) {
+ return;
+}
+@define('S9Y_FRAMEWORK_PLUGIN_INTERNAL', true);
+
class serendipity_calendar_plugin extends serendipity_plugin {
var $title = CALENDAR;
break;
- case 'jalali-utf8':
+ case 'persian-utf8':
require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
list(,$jy, $jm, $jd) = $serendipity['uriArguments'];
if( isset($jd) && $jd ){
- list ( $gy, $gm, $gd ) = j2g ($jy, $jm, $jd);
+ list ( $gy, $gm, $gd ) = p2g ($jy, $jm, $jd);
}elseif( isset($jm) && $jm ){
- list ( $gy, $gm, $gd ) = j2g ( $jy, $jm, 1);
+ list ( $gy, $gm, $gd ) = p2g ( $jy, $jm, 1);
}else{
$gy = $year;
$gm = $month;
$gd = (int) date('d');
}
- list ( $year, $month, $day ) = g2j ($gy, $gm, $gd);
+ list ( $year, $month, $day ) = g2p ($gy, $gm, $gd);
// How many days does the month have?
$ts = strtotime($gy . '-' . sprintf('%02d', $gm) . '-' . sprintf('%02d', $gd));
$now = serendipity_serverOffsetHour(time());
- $nrOfDays = jalali_strftime_utf('%m', $ts);
+ $nrOfDays = persian_strftime_utf('%m', $ts);
$j_days_in_month = array(0, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
if ($year%4 == 3 && $nrOfDays == 12) $nrOfDays = $j_days_in_month[(int)$nrOfDays]+1;
else $nrOfDays = $j_days_in_month[(int)$nrOfDays];
// Calculate first timestamp of the month
- list ($firstgy, $firstgm, $firstgd ) = j2g ( $year, $month, 1);
+ list ($firstgy, $firstgm, $firstgd ) = p2g ( $year, $month, 1);
$firstts = mktime (0, 0, 0, $firstgm, $firstgd, $firstgy);
- // Calculate first Jalali day, week day name
+ // Calculate first persian day, week day name
$firstDayWeekDay = date('w', $firstts);
// Calculate end timestamp of the month
- list ( $end_year, $end_month, $end_day ) = j2g ($year, $month+1, 1);
+ list ( $end_year, $end_month, $end_day ) = p2g ($year, $month+1, 1);
$endts = mktime(0, 0, 0, $end_month, $end_day, $end_year);
break;
} // end switch
$today_year = date('Y', $now);
break;
- case 'jalali-utf8':
+ case 'persian-utf8':
$activeDays = array();
if (is_array($rows)) {
foreach ($rows as $row) {
$row['timestamp'] = serendipity_serverOffsetHour($row['timestamp']);
- $activeDays[(int) jalali_date_utf('j', $row['timestamp'])] = $row['timestamp'];
+ $activeDays[(int) persian_date_utf('j', $row['timestamp'])] = $row['timestamp'];
}
}
- $today_day = jalali_date_utf('j', $now);
- $today_month = jalali_date_utf('m', $now);
- $today_year = jalali_date_utf('Y', $now);
+ $today_day = persian_date_utf('j', $now);
+ $today_month = persian_date_utf('m', $now);
+ $today_year = persian_date_utf('Y', $now);
break;
} // end switch
} // end for
} // end for
- $serendipity['smarty']->assign('plugin_calendar_weeks', $smartyRows);
+ $serendipity['smarty']->assign_by_ref('plugin_calendar_weeks', $smartyRows);
$dow = array();
for ($i = 1; $i <= 7; $i++) {
$dow[] = array('date' => mktime(0, 0, 0, 3, $bow + $i - 1, 2004));
}
- $serendipity['smarty']->assign('plugin_calendar_dow', $dow);
+ $serendipity['smarty']->assign_by_ref('plugin_calendar_dow', $dow);
- $serendipity['smarty']->assign('plugin_calendar_head', array('month_date' => $ts,
+ $plugin_calendar_data = array('month_date' => $ts,
'uri_previous' => serendipity_archiveDateUrl(sprintf('%04d/%02d', $previousYear, $previousMonth). $add_query),
'uri_month' => serendipity_archiveDateUrl(sprintf('%04d/%02d', $year, $month) . $add_query),
'uri_next' => serendipity_archiveDateUrl(sprintf('%04d/%02d',$nextYear, $nextMonth) . $add_query),
'minScroll' => $minmax[0]['min'],
- 'maxScroll' => $minmax[0]['max']));
+ 'maxScroll' => $minmax[0]['max']);
+ $serendipity['smarty']->assign_by_ref('plugin_calendar_head', $plugin_calendar_data);
echo serendipity_smarty_fetch('CALENDAR', 'plugin_calendar.tpl');
} // end function
$ts_title = serendipity_formatTime("%B %Y", $ts, false);
$ts = mktime(0, 0, 0, date('m', $ts)-1, 1, date('Y', $ts)); // Must be last in 'case' statement
break;
- case 'jalali-utf8':
+ case 'persian-utf8':
require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
- $linkStamp = jalali_date_utf('Y/m', $ts);
+ $linkStamp = persian_date_utf('Y/m', $ts);
$ts_title = serendipity_formatTime("%B %Y", $ts, false);
- $ts = jalali_mktime(0, 0, 0, jalali_date_utf('m', $ts)-1, 1, jalali_date_utf('Y', $ts)); // Must be last in 'case' statement
+ $ts = persian_mktime(0, 0, 0, persian_date_utf('m', $ts)-1, 1, persian_date_utf('Y', $ts)); // Must be last in 'case' statement
break;
}
break;
$ts_title = WEEK . ' '. date('W, Y', $ts);
$ts = mktime(0, 0, 0, date('m', $ts), date('d', $ts)-7, date('Y', $ts));
break;
- case 'jalali-utf8':
+ case 'persian-utf8':
require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
- $linkStamp = jalali_date_utf('Y/\WW', $ts);
- $ts_title = WEEK . ' '. jalali_date_utf('W، Y', $ts);
- $ts = jalali_mktime(0, 0, 0, jalali_date_utf('m', $ts), jalali_date_utf('d', $ts)-7, jalali_date_utf('Y', $ts));
+ $linkStamp = persian_date_utf('Y/\WW', $ts);
+ $ts_title = WEEK . ' '. persian_date_utf('W، Y', $ts);
+ $ts = persian_mktime(0, 0, 0, persian_date_utf('m', $ts), persian_date_utf('d', $ts)-7, persian_date_utf('Y', $ts));
break;
}
break;
$ts_title = serendipity_formatTime("%B %e. %Y", $ts, false);
$ts = mktime(0, 0, 0, date('m', $ts), date('d', $ts)-1, date('Y', $ts)); // Must be last in 'case' statement
break;
- case 'jalali-utf8':
+ case 'persian-utf8':
require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
- $linkStamp = jalali_date_utf('Y/m/d', $ts);
+ $linkStamp = persian_date_utf('Y/m/d', $ts);
$ts_title = serendipity_formatTime("%e %B %Y", $ts, false);
- $ts = jalali_mktime(0, 0, 0, jalali_date_utf('m', $ts), jalali_date_utf('d', $ts)-1, jalali_date_utf('Y', $ts)); // Must be last in 'case' statement
+ $ts = persian_mktime(0, 0, 0, persian_date_utf('m', $ts), persian_date_utf('d', $ts)-1, persian_date_utf('Y', $ts)); // Must be last in 'case' statement
break;
}
break;
$propbag->add('description', SHOWS_RSS_BLAHBLAH);
$propbag->add('stackable', true);
$propbag->add('author', 'Serendipity Team');
- $propbag->add('version', '1.1');
+ $propbag->add('version', '1.2');
$propbag->add('configuration', array(
'fullfeed',
'show_0.91',
{
switch($name) {
case 'fullfeed':
- $propbag->add('type', 'boolean');
+ $radio['value'][] = 'false';
+ $radio['desc'][] = NO;
+
+ $radio['value'][] = 'true';
+ $radio['desc'][] = YES;
+
+ $radio['value'][] = 'client';
+ $radio['desc'][] = 'Client';
+
+ $propbag->add('type', 'radio');
$propbag->add('name', SYNDICATION_PLUGIN_FULLFEED);
$propbag->add('description', '');
$propbag->add('default', false);
+ $propbag->add('radio_per_row', '3');
+ $propbag->add('radio', $radio);
break;
case 'show_0.91':
?>
<div style="padding-bottom: 2px;">
<a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/comments.rss2', 'serendipityHTTPPath') ?>"><img src="<?php echo serendipity_getTemplateFile('img/xml.gif'); ?>" alt="XML" style="border: 0px" /></a>
- <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/comments.rss2', 'serendipityHTTPPath') ?>"><?php echo ($serendipity['XHTML11'] ? '<span style="white-space: nowrap">' : '<nobr>'); ?>RSS 2.0 <?php echo COMMENTS; ?><?php echo ($serendipity['XHTML11'] ? '</span>' : '</nobr>'); ?></a>
+ <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/comments.rss2', 'serendipityHTTPPath') ?>"><span style="white-space: nowrap">RSS 2.0 <?php echo COMMENTS; ?></span></a>
</div>
<?php
}
$img = $this->get_config('fb_img');
if (strlen($img) == 0) {
$img = 'http://feeds.feedburner.com/~fc/'.$this->get_config('fb_id').'?bg=99CCFF&fg=444444&anim=0';
- } else {
- $img = 'http://www.feedburner.com/fb/images/pub/'.$img;
}
?>
<div style="padding-bottom: 2px;">
$propbag->add('description', CATEGORY_PLUGIN_DESC);
$propbag->add('stackable', true);
$propbag->add('author', 'Serendipity Team');
- $propbag->add('version', '2.0');
+ $propbag->add('version', '2.01');
$propbag->add('configuration', array('title', 'authorid', 'parent_base', 'hide_parent', 'image', 'sort_order', 'sort_method', 'allow_select', 'hide_parallel', 'show_count', 'smarty'));
$propbag->add('groups', array('FRONTEND_VIEWS'));
}
case 'authorid':
$row_authors = serendipity_db_query("SELECT realname, authorid FROM {$serendipity['dbPrefix']}authors");
- $authors = array('all' => ALL_AUTHORS);
+ $authors = array('all' => ALL_AUTHORS, 'login' => CURRENT_AUTHOR);
if (is_array($row_authors)) {
foreach($row_authors as $row) {
$authors[$row['authorid']] = $row['realname'];
$sort .= ' ' . $this->get_config('sort_method');
}
$is_form = serendipity_db_bool($this->get_config('allow_select'));
- $categories = serendipity_fetchCategories(empty($which_category) ? 'all' : $which_category, '', $sort);
+ if ($which_category === "login") {
+ $which_category = (int)$serendipity['authorid'];
+ if ($which_category === 0) {
+ $which_category = -1; // Set to -1 for anonymous authors to get a proper match.
+ }
+ }
+
+ $categories = serendipity_fetchCategories(empty($which_category) ? 'all' : $which_category, '', $sort, 'read');
$cat_count = array();
if (serendipity_db_bool($this->get_config('show_count'))) {
$html .= sprintf(
'<div class="category_link_all"><br /><a href="%s" title="%s">%s</a></div>',
- $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'],
+ $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?frontpage',
ALL_CATEGORIES,
ALL_CATEGORIES
);
if (!$smarty) {
echo $html;
} else {
- $serendipity['smarty']->assign(array(
+ $plugin_categories_data = array(
'is_form' => $is_form,
'category_image' => $image,
'form_url' => $serendipity['baseURL'] . $serendipity['indexFile'],
'categories' => is_array($categories) ? $categories : array()
- ));
+ );
+ $serendipity['smarty']->assign($plugin_categories_data);
echo serendipity_smarty_fetch('CATEGORIES', 'plugin_categories.tpl');
}
}
}
/* vim: set sts=4 ts=4 expandtab : */
-?>