addBehavior('publicHeadContent',array('publicShortArchives','publicHeadContent')); class publicShortArchives { public static function publicHeadContent($core) { $url = $core->blog->getQmarkURL().'pf='.basename(dirname(__FILE__)); echo ''."\n"; echo '\n"; } } class tplShortArchives { public static function shortArchivesWidgets($w) { global $core; if ($w->offline) return; if (($w->homeonly == 1 && $core->url->type != 'default') || ($w->homeonly == 2 && $core->url->type == 'default')) { return; } $params = array(); $params['type'] = 'month'; $rs = $core->blog->getDates($params); unset($params); if ($rs->isEmpty()) { return; } $active_year = null; if (($core->url->type == 'archive') && preg_match('`^/([0-9]{4})/([0-9]{2})$`',$core->url->args,$matches)) { $active_year = $matches[1]; } $posts = array(); while ($rs->fetch()) { $posts[dt::dt2str(__('%Y'),$rs->dt)][] = array('url' => $rs->url($core), 'date' => html::escapeHTML(dt::dt2str(__('%B'),$rs->dt)), 'nbpost' => $rs->nb_post); } $res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : ''). ''; return $w->renderDiv($w->content_only,'shortArchives '.$w->class,'',$res); } }