pages ) ) {
$this->assign('pages', Posts::get( array( 'content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1 ) ) );
}
if( !isset( $this->user ) ) {
$this->assign('user', User::identify() );
}
if( !isset( $this->page ) ) {
$this->assign('page', isset( $page ) ? $page : 1 );
}
if( !isset( $this->tags ) ) {
//- $tags= DB::get_results( 'SELECT * FROM ' . DB::table('tags') );
$tags= Tags::get();
$tags= array_filter($tags, create_function('$tag', 'return (Posts::count_by_tag($tag->tag_slug, "published") > 0);'));
$this->assign('tags', $tags);
}
/*
if( !isset( $this->recent_comments ) ) {
$this->assign('recent_comments', Comments::get( array('limit'=>5, 'status'=>Comment::STATUS_APPROVED, 'orderby'=>'date DESC' ) ) );
}
*/
if( !isset( $this->feed_alternate ) ) {
$matched_rule= URL::get_matched_rule();
switch ( $matched_rule->name ) {
case 'display_entry':
case 'display_page':
$feed_alternate= URL::get( 'atom_entry', array( 'slug' => Controller::get_var('slug') ) );
break;
case 'display_entries_by_tag':
$feed_alternate= URL::get( 'atom_feed_tag', array( 'tag' => Controller::get_var('tag') ) );
break;
case 'display_home':
default:
$feed_alternate= URL::get( 'atom_feed', array( 'index' => '1' ) );
}
$this->assign('feed_alternate', $feed_alternate);
}
// DO NOT COMMENT OUT OR DELETE THIS LINE
parent::add_template_vars();
}
public function theme_monthly_archive_options( $theme, $full_names = TRUE, $type = 'entry', $status = 'published' )
{
$results = Posts::get( array( 'content_type' => $type, 'status' => $status, 'month_cts' => 1) );
foreach ( $results as $result ) {
// add leading zeros
$result->month= str_pad( $result->month, 2, 0, STR_PAD_LEFT );
// what format do we want to show the month in?
if( $full_names ) {
$display_month = HabariDateTime::date_create()->set_date( $result->year, $result->month, 1)->get( 'F' );
}
else {
$display_month = HabariDateTime::date_create()->set_date( $result->year, $result->month, 1)->get( 'M' );
}
// do we want to show the count of posts?
$archives[] = '';
}
return implode( "\n", array_reverse( $archives ) );
}
public function theme_tag_options( $theme ) {
if ( count( $theme->tags ) != 0 ) {
foreach ( $theme->tags as $tag ) {
$tagarray[] = "";
}
sort( $tagarray );
}
return implode( "\n", $tagarray );
}
public function action_form_comment( $form ) {
$form->append( 'fieldset','cf_commenterinfo', _t( 'your contact information' ) );
$form->move_before( $form->cf_commenterinfo, $form->cf_commenter );
$form->cf_commenter->move_into( $form->cf_commenterinfo );
$form->cf_commenter->caption = 'name';
$form->cf_commenter->size = 22;
$form->cf_email->move_into( $form->cf_commenterinfo );
$form->cf_email->caption = 'email';
$form->cf_email->size = 22;
$form->cf_url->move_into( $form->cf_commenterinfo );
$form->cf_url->caption = 'URI';
$form->cf_url->size = 22;
$form->append( 'fieldset','cf_contentbox', _t( 'your comment' ) );
$form->move_before( $form->cf_contentbox, $form->cf_content );
$form->cf_content->move_into( $form->cf_contentbox );
$form->cf_content->caption = '';
$form->cf_submit->move_into( $form->cf_contentbox );
$form->cf_submit->caption = 'submit comment';
}
}
?>