consistent plugin usage - calendar
this and followup commits touches: class method parenthesis "\n{\n <code>\n}\n", case break switches, consistent boolean usage, append css to eventData and other cleanups
This commit is contained in:
parent
004a597837
commit
3f6ac66970
@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class serendipity_plugin_calendar extends serendipity_plugin {
|
if (IN_serendipity !== true) {
|
||||||
|
die ("Don't hack!");
|
||||||
|
}
|
||||||
|
|
||||||
|
class serendipity_plugin_calendar extends serendipity_plugin
|
||||||
|
{
|
||||||
var $title = CALENDAR;
|
var $title = CALENDAR;
|
||||||
|
|
||||||
function introspect(&$propbag)
|
function introspect(&$propbag)
|
||||||
@ -10,13 +15,14 @@ class serendipity_plugin_calendar extends serendipity_plugin {
|
|||||||
$propbag->add('configuration', array('beginningOfWeek', 'enableExtEvents', 'category'));
|
$propbag->add('configuration', array('beginningOfWeek', 'enableExtEvents', 'category'));
|
||||||
$propbag->add('stackable', false);
|
$propbag->add('stackable', false);
|
||||||
$propbag->add('author', 'Serendipity Team');
|
$propbag->add('author', 'Serendipity Team');
|
||||||
$propbag->add('version', '1.1');
|
$propbag->add('version', '1.2');
|
||||||
$propbag->add('groups', array('FRONTEND_VIEWS'));
|
$propbag->add('groups', array('FRONTEND_VIEWS'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function introspect_config_item($name, &$propbag)
|
function introspect_config_item($name, &$propbag)
|
||||||
{
|
{
|
||||||
switch($name) {
|
switch($name) {
|
||||||
|
|
||||||
case 'beginningOfWeek':
|
case 'beginningOfWeek':
|
||||||
$options = array();
|
$options = array();
|
||||||
for ( $i = 1; $i <= 7; $i++ ) {
|
for ( $i = 1; $i <= 7; $i++ ) {
|
||||||
@ -138,7 +144,7 @@ class serendipity_plugin_calendar extends serendipity_plugin {
|
|||||||
|
|
||||||
// Calculate first timestamp of the month
|
// Calculate first timestamp of the month
|
||||||
list ($firstgy, $firstgm, $firstgd ) = p2g ( $year, $month, 1);
|
list ($firstgy, $firstgm, $firstgd ) = p2g ( $year, $month, 1);
|
||||||
$firstts = mktime (0, 0, 0, $firstgm, $firstgd, $firstgy);
|
$firstts = mktime(0, 0, 0, $firstgm, $firstgd, $firstgy);
|
||||||
|
|
||||||
// Calculate first persian day, week day name
|
// Calculate first persian day, week day name
|
||||||
$firstDayWeekDay = date('w', $firstts);
|
$firstDayWeekDay = date('w', $firstts);
|
||||||
@ -207,7 +213,7 @@ class serendipity_plugin_calendar extends serendipity_plugin {
|
|||||||
} else {
|
} else {
|
||||||
$catid = false;
|
$catid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($catid) {
|
if ($catid) {
|
||||||
$base_query = 'C' . $catid;
|
$base_query = 'C' . $catid;
|
||||||
$add_query = '/' . $base_query;
|
$add_query = '/' . $base_query;
|
||||||
@ -262,7 +268,7 @@ class serendipity_plugin_calendar extends serendipity_plugin {
|
|||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
$externalevents = array();
|
$externalevents = array();
|
||||||
if (serendipity_db_bool($this->get_config('enableExtEvents', false))) {
|
if (serendipity_db_bool($this->get_config('enableExtEvents', 'false'))) {
|
||||||
serendipity_plugin_api::hook_event('frontend_calendar', $externalevents, array('Month' => $month, 'Year' => $year,
|
serendipity_plugin_api::hook_event('frontend_calendar', $externalevents, array('Month' => $month, 'Year' => $year,
|
||||||
'TS' => $ts, 'EndTS' => $endts));
|
'TS' => $ts, 'EndTS' => $endts));
|
||||||
}
|
}
|
||||||
@ -346,6 +352,7 @@ class serendipity_plugin_calendar extends serendipity_plugin {
|
|||||||
echo serendipity_smarty_fetch('CALENDAR', 'plugin_calendar.tpl');
|
echo serendipity_smarty_fetch('CALENDAR', 'plugin_calendar.tpl');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
x
Reference in New Issue
Block a user