homeonly == 1 && $core->url->type != 'default') || ($w->homeonly == 2 && $core->url->type == 'default')) { return; } $value = isset($GLOBALS['_search']) ? html::escapeHTML($GLOBALS['_search']) : ''; return $w->renderDiv($w->content_only,$w->class,'id="search"', ($w->title ? $w->renderTitle('') : ''). '
'. '
'. '

'. '

'. '
'. '
'); } public static function navigation($w) { global $core; if (($w->homeonly == 1 && $core->url->type != 'default') || ($w->homeonly == 2 && $core->url->type == 'default')) { return; } $res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : ''). ''; return $w->renderDiv($w->content_only,$w->class,'id="topnav"',$res); } public static function categories($w) { global $core, $_ctx; if (($w->homeonly == 1 && $core->url->type != 'default') || ($w->homeonly == 2 && $core->url->type == 'default')) { return; } $rs = $core->blog->getCategories(array('post_type'=>'post','without_empty'=> !$w->with_empty)); if ($rs->isEmpty()) { return; } $res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : ''); $ref_level = $level = $rs->level-1; while ($rs->fetch()) { $class = ''; if (($core->url->type == 'category' && $_ctx->categories instanceof record && $_ctx->categories->cat_id == $rs->cat_id) || ($core->url->type == 'post' && $_ctx->posts instanceof record && $_ctx->posts->cat_id == $rs->cat_id)) { $class = ' class="category-current"'; } if ($rs->level > $level) { $res .= str_repeat('',-($rs->level - $level)); } if ($rs->level <= $level) { $res .= ''; } $res .= ''. html::escapeHTML($rs->cat_title).''. ($w->postcount ? ' ('.($w->subcatscount ? $rs->nb_total : $rs->nb_post).')' : ''); $level = $rs->level; } if ($ref_level - $level < 0) { $res .= str_repeat('',-($ref_level - $level)); } return $w->renderDiv($w->content_only,'categories '.$w->class,'',$res); } public static function bestof($w) { global $core, $_ctx; if (($w->homeonly == 1 && $core->url->type != 'default') || ($w->homeonly == 2 && $core->url->type == 'default')) { return; } $params = array( 'post_selected' => true, 'no_content' => true, 'order' => 'post_dt '.strtoupper($w->orderby) ); $rs = $core->blog->getPosts($params); if ($rs->isEmpty()) { return; } $res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : ''). ''; return $w->renderDiv($w->content_only,'selected '.$w->class,'',$res); } public static function langs($w) { global $core, $_ctx; if (($w->homeonly == 1 && $core->url->type != 'default' && $core->url->type != 'lang') || ($w->homeonly == 2 && ($core->url->type == 'default' || $core->url->type == 'lang'))) { return; } $rs = $core->blog->getLangs(); if ($rs->count() <= 1) { return; } $langs = l10n::getISOcodes(); $res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : ''). ''; return $w->renderDiv($w->content_only,'langs '.$w->class,'',$res); } public static function subscribe($w) { global $core; if (($w->homeonly == 1 && $core->url->type != 'default') || ($w->homeonly == 2 && $core->url->type == 'default')) { return; } $type = ($w->type == 'atom' || $w->type == 'rss2') ? $w->type : 'rss2'; $mime = $type == 'rss2' ? 'application/rss+xml' : 'application/atom+xml'; $p_title = __('This blog\'s entries %s feed'); $c_title = __('This blog\'s comments %s feed'); $res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : ''). ''; return $w->renderDiv($w->content_only,'syndicate '.$w->class,'',$res); } public static function feed($w) { if (!$w->url) { return; } global $core; if (($w->homeonly == 1 && $core->url->type != 'default') || ($w->homeonly == 2 && $core->url->type == 'default')) { return; } $limit = abs((integer) $w->limit); try { $feed = feedReader::quickParse($w->url,DC_TPL_CACHE); if ($feed == false || count($feed->items) == 0) { return; } } catch (Exception $e) { return; } $res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : ''). ''; return $w->renderDiv($w->content_only,'feed '.$w->class,'',$res); } public static function text($w) { global $core; if (($w->homeonly == 1 && $core->url->type != 'default') || ($w->homeonly == 2 && $core->url->type == 'default')) { return; } $res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').$w->text; return $w->renderDiv($w->content_only,'text '.$w->class,'',$res); } public static function lastposts($w) { global $core, $_ctx; if (($w->homeonly == 1 && $core->url->type != 'default') || ($w->homeonly == 2 && $core->url->type == 'default')) { return; } $params['limit'] = abs((integer) $w->limit); $params['order'] = 'post_dt desc'; $params['no_content'] = true; if ($w->category) { if ($w->category == 'null') { $params['sql'] = ' AND P.cat_id IS NULL '; } elseif (is_numeric($w->category)) { $params['cat_id'] = (integer) $w->category; } else { $params['cat_url'] = $w->category; } } if ($w->tag) { $params['meta_id'] = $w->tag; $rs = $core->meta->getPostsByMeta($params); } else { $rs = $core->blog->getPosts($params); } if ($rs->isEmpty()) { return; } $res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : ''). ''; return $w->renderDiv($w->content_only,'lastposts '.$w->class,'',$res); } public static function lastcomments($w) { global $core; if (($w->homeonly == 1 && $core->url->type != 'default') || ($w->homeonly == 2 && $core->url->type == 'default')) { return; } $params['limit'] = abs((integer) $w->limit); $params['order'] = 'comment_dt desc'; $rs = $core->blog->getComments($params); if ($rs->isEmpty()) { return; } $res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').''; return $w->renderDiv($w->content_only,'lastcomments '.$w->class,'',$res); } }