Changeset 946 for plugins/dayMode/_prepend.php
- Timestamp:
- 03/26/09 19:33:57 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/dayMode/_prepend.php
r944 r946 14 14 $GLOBALS['__autoload']['dcCalendar'] = dirname(__FILE__).'/class.dc.calendar.php'; 15 15 $GLOBALS['__autoload']['dcDayTools'] = dirname(__FILE__).'/class.dc.calendar.php'; 16 17 class dayModeBehaviors 18 { 19 // Public behaviors 20 public static function block() 21 { 22 $args = func_get_args(); 23 array_shift($args); 24 25 if ($args[0] == 'Entries') { 26 $attrs = $args[1]; 27 28 if (!empty($attrs['today'])) { 29 $p = 30 '<?php $today = dcDayTools::getEarlierDate(array("ts_type" => "day")); '. 31 "\$params['post_year'] = \$today->year(); ". 32 "\$params['post_month'] = \$today->month(); ". 33 "\$params['post_day'] = \$today->day(); ". 34 "unset(\$params['limit']); ". 35 "unset(\$today); ". 36 " ?>\n"; 37 } 38 else { 39 $p = 40 '<?php if ($_ctx->exists("day")) { '. 41 "\$params['post_year'] = \$_ctx->day->year(); ". 42 "\$params['post_month'] = \$_ctx->day->month(); ". 43 "\$params['post_day'] = \$_ctx->day->day(); ". 44 "unset(\$params['limit']); ". 45 "} ?>\n"; 46 } 47 return $p; 48 } 49 } 50 51 public static function addTplPath(&$core) 52 { 53 $core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates'); 54 } 55 56 // Admin behaviors 57 public static function adminBlogPreferencesForm(&$core,&$settings) 58 { 59 if ($core->auth->check('admin')) 60 { 61 echo 62 '<fieldset><legend>'.__('Daily Archives').'</legend>'. 63 '<p><label class="classic">'. 64 form::checkbox('daymode_active','1',$settings->daymode_active). 65 __('Enable daily archives and calendar').'</label></p>'. 66 '</fieldset>'; 67 } 68 } 69 70 public static function adminBeforeBlogSettingsUpdate(&$settings) 71 { 72 if ($GLOBALS['core']->auth->check('admin')) 73 { 74 $settings->setNameSpace('daymode'); 75 try { 76 $settings->put('daymode_active',!empty($_POST['daymode_active']),'boolean'); 77 } catch (Exception $e) { 78 $settings->drop('daymode_active'); 79 $settings->put('daymode_active',!empty($_POST['daymode_active']),'boolean'); 80 } 81 $settings->setNameSpace('system'); 82 } 83 } 84 } 16 85 ?>
Note: See TracChangeset
for help on using the changeset viewer.