Pastoid

theme.php

The page you are looking at now is at this URL: http://pastoid.com/brz

This paste was last updated on July 23, 2009 at 11:44 am.

Pasted Coderaw

<?php
 
// Tell Habari which class to be use as the custom theme class:
define( 'THEME_CLASS', 'FwcV1' );
 
class FwcV1 extends Theme
{
	/**
	 * Execute on theme init to apply these filters to output
	 */
	public function action_init_theme()
	{
		// Apply Format::autop() to post content...
		Format::apply( 'autop', 'post_content_out' );
 
		// Apply Format::autop() to comment content...
		Format::apply( 'autop', 'comment_content_out' );
 
		Format::apply( 'autop', 'post_content_excerpt' );
 
		// Apply Format::nice_date() to post date...
		Format::apply( 'nice_date', 'post_pubdate_out', 'l, F jS, Y \a\t g:ia' );
		// Apply Format::nice_date() to post date...
		Format::apply( 'nice_date', 'post_pubdate_excerpt', 'l, F jS, Y' );
 
		// Apply Format::nice_date() to comment date...
		Format::apply( 'nice_date', 'comment_date', 'l, F jS, Y \a\t g:ia' );
 
		// Truncate content excerpt at "more" or 56 characters...
		Format::apply_with_hook_params( 'more', 'post_content_excerpt', 'Continue reading...',512, 1 );
	}
 
	/**
	 * Add some variables to the template output
	 */
	public function add_template_vars()
	{
		$this->assign( 'latest', Post::get(array ( 'status' => 'published','content_type' => 'entry', 'offset' => 0, 'limit' => 1) ) );
 
		$action = Controller::get_action();
		$this->assign('controller_action', $action);
 
		$offset = 0;
		if ( $action == 'display_home' ) {
			$offset = 1;
		}
		$this->assign( 'recent', Posts::get(array ( 'status' => 'published','content_type' => 'entry', 'offset' => $offset, 'limit' => 5) ) );
		parent::add_template_vars();
	}
 
	public function theme_search_form( $theme )
	{
		return $theme->fetch('searchform');
	}
 
		public function theme_search_prompt( $theme, $criteria, $has_results )
	{
		$out=array();
		$keywords=explode(' ',trim($criteria));
		foreach ($keywords as $keyword) {
			$out[]= '<a href="' . Site::get_url( 'habari', true ) .'search?criteria=' . $keyword . '" title="' . _t( 'Search for ' ) . $keyword . '">' . $keyword . '</a>';
		}
 
		if ( sizeof( $keywords ) > 1 ) {
			if ( $has_results ) {
				return sprintf( _t( 'Your search for "<b>%s</b>".' ), implode(' ',$out) );
				exit;
			}
			return sprintf( _t('No results found for your search \'%1$s\'') . '<br>'. _t('You can try searching for \'%2$s\''), $criteria, implode('\' or \'',$out) );
		}
		else {
			return sprintf( _t( 'Search results for "<b>%s</b>".' ), $criteria );
			exit;
		}
		return sprintf( _t( 'Your search for "<b>%s</b>".' ), $criteria );
 
	}
 
	public function filter_comment_date_out( $content, $post)
	{
		list($date,) = explode('|', $content);
		return $date;
	}
 
	public function filter_comment_date_excerpt( $content, $post )
	{
		list(,$time) = explode('|', $content);
		return $time;
	}
 
	public function filter_comment_content_out( $content, $post)
	{
		return strip_tags( $content, '<a><p><br><img><b><i><u><strong><em><blockquote><code><strike>' );
	}
 
	/**
	 * Convert a post's tags array into a usable list of links
	 *
	 * @param array $array The tags array from a Post object
	 * @return string The HTML of the linked tags
	 */
	public function filter_post_tags_out($array)
	{
		if ( ! is_array( $array ) ) {
			$array = array ( $array );
		}
		$fn = create_function('$a,$b', 'return "<li><a href=\\"" . URL::get("display_entries_by_tag", array( "tag" => $b) ) . "\\" rel=\\"tag\\">" . $a . "</a></li>\n";');
		$array = array_map($fn, $array, array_keys($array));
		$out = '<ul>' . implode('', $array) . '</ul>';
		return $out;
	}
}

Toggle wordwrap

Referring DomainHits
Unknown Referer 115
www.google.hu 3
Is this paste spam?
<Hide