All pastes #910604 Raw Edit

Charcoal diff so far

public diff v1 · immutable
·published 2008-02-20 01:36 UTC
rendered paste body
Index: footer.php===================================================================--- footer.php	(revision 121)+++ footer.php	(working copy)@@ -1,8 +1,21 @@ <div id="footer">-<p><?php Options::out('title'); _e(' is powered by'); ?> <a-	href="http://www.habariproject.org/" title="Habari">Habari</a><?php _e(' and '); ?>-<a href="http://" title="Charcoal theme for Habari">Charcoal theme</a><?php _e(' - ') ?><a-	href="<?php URL::out( 'atom_feed', array( 'index' => '1' ) ); ?>">Atom-Entries</a> and <a href="<?php URL::out( 'atom_feed_comments' ); ?>">Atom-Comments</a></p>-<?php $theme->footer(); ?></div>+	<p>+		<?php Options::out('title'); _e(' is powered by'); ?> <a+		href="http://www.habariproject.org/" title="Habari">Habari</a><?php _e(' and '); ?>+		<a href="http://" title="Charcoal theme for Habari">Charcoal theme</a><?php _e(' - ') ?><a+		href="<?php URL::out( 'atom_feed', array( 'index' => '1' ) ); ?>">Atom+		Entries</a> and <a href="<?php URL::out( 'atom_feed_comments' ); ?>">Atom+		Comments</a>+	</p>+	<?php $theme->footer(); ?>+</div>+	</div>+	<div id="bottom-secondary">+		<div id="tags"><?php if (Plugins::is_loaded('tagcloud')) echo $tag_cloud; ?></div>+	</div>+	<div class="clear"></div>+</div>+</div>+</body>+</html>+Index: header.php===================================================================--- header.php	(revision 121)+++ header.php	(working copy)@@ -1,57 +1,56 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>-<title><?php Options::out( 'title' ) ?><?php if($request->display_entry && isset($post)) { echo " :: {$post->title}"; } ?></title>-<meta http-equiv="Content-Type" content="text/html">- <meta http-equiv="Content-Type" content="text/html">- <meta name="generator" content="Habari">- <link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="<?php $theme->feed_alternate(); ?>">- <link rel="edit" type="application/atom+xml" title="Atom Publishing Protocol" href="<?php URL::out( 'atompub_servicedocument' ); ?>">- <link rel="EditURI" type="application/rsd+xml" title="RSD" href="<?php URL::out( 'rsd' ); ?>">- <link rel="stylesheet" type="text/css" media="screen" href="<?php Site::out_url( 'theme' ); ?>/style.css">-<?php $theme->header(); ?>-<?php Stack::out('template_header_javascript', '<script type="text/javascript" src="%s"></script>'); ?>-<!--[if lte IE 6]>-<link rel="stylesheet" href="<?php Site::out_url( 'theme' ); ?>/ie.css" type="text/css" media="screen" />-<![endif]-->+	<title><?php Options::out( 'title' ) ?><?php if($request->display_entry && isset($post)) { echo " :: {$post->title}"; } ?></title>+	<meta http-equiv="Content-Type" content="text/html">+	<meta name="generator" content="Habari">+	<link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="<?php $theme->feed_alternate(); ?>">+	<link rel="edit" type="application/atom+xml" title="Atom Publishing Protocol" href="<?php URL::out( 'atompub_servicedocument' ); ?>">+	<link rel="EditURI" type="application/rsd+xml" title="RSD" href="<?php URL::out( 'rsd' ); ?>">+	<link rel="stylesheet" type="text/css" media="screen" href="<?php Site::out_url( 'theme' ); ?>/style.css">+	<!--[if lte IE 6]>+	<link rel="stylesheet" href="<?php Site::out_url( 'theme' ); ?>/ie.css" type="text/css" media="screen" />+	<![endif]-->+	<?php $theme->header(); ?>+	<?php Stack::out('template_header_javascript', '<script type="text/javascript" src="%s"></script>'); ?> </head> <body> <div id="page-top">-<div id="wrapper-top">-<div id="top-primary">-<div id="header">-<div id="title"><?php if ( $show_title_image ) { ?>-<img src="<?php Site::out_url( 'theme' ); ?>/images/title.png" rel="<?php Options::out( 'title' ); ?>" /> <span class="hidden"><h1><a href="<?php Site::out_url( 'habari' ); ?>"><?php Options::out( 'title' ); ?></a></h1></span>-<?php } else { ?>-<h1><a href="<?php Site::out_url( 'habari' ); ?>"><?php Options::out( 'title' ); ?></a></h1>-<?php } ?><p class="tagline"><?php Options::out( 'tagline' ); ?></p></div>+	<div id="wrapper-top">+		<div id="top-primary">+			<div id="header">+				<div id="title">+					<?php if ( $show_title_image ) : ?>+						<img src="<?php Site::out_url( 'theme' ); ?>/images/title.png" rel="<?php Options::out( 'title' ); ?>" /> <span class="hidden"><h1><a href="<?php Site::out_url( 'habari' ); ?>"><?php Options::out( 'title' ); ?></a></h1></span>+					<?php else : ?>+						<h1><a href="<?php Site::out_url( 'habari' ); ?>"><?php Options::out( 'title' ); ?></a></h1>+					<?php endif; ?>+						<p class="tagline"><?php Options::out( 'tagline' ); ?></p>+				</div>  -<div id="navbar">-<?php $current_page='';-$postid='';-if (isset($post)){-	if ($request->display_home || $request->display_entries_by_tag || $post->content_type==1) $current_page=' class="current-page"';-	$postid=$post->id;-}-?>-<div id="nav">-<ul>-<li<?php echo $current_page; ?>><a href="<?php Site::out_url( 'habari' ); ?>"><?php echo $home_label; ?></a></li>-<?php foreach ( $pages as $pagelink) { ?>-<li<?php if ($pagelink->content_type==2 && $pagelink->id==$postid) echo ' class="current-page"'; ?>><a href="<?php echo $pagelink->permalink; ?>" title="<?php echo $pagelink->title; ?>"><?php echo $pagelink->title; ?></a></li>-<?php } ?>-</ul>-</div>-<div id="utils">-<ul>-<?php if ( isset( $user ) && is_object( $user ) ) { ?>-<li class="login"><a href="<?php Site::out_url( 'habari' ); ?>/user/logout">Logout</a></li>-<?php } else { ?>-<li class="login"><a href="<?php Site::out_url( 'habari' ); ?>/user/login">Login</a></li>-<?php } ?>-</ul>-</div>-<div class="clear"></div>-</div>-</div>\ No newline at end of file+				<div id="navbar">+					<div id="nav">+						<ul>+							<li<?php if ($post_id == 0) echo ' class="current-page"'; ?>>+								<a href="<?php Site::out_url( 'habari' ); ?>"><?php echo $home_label; ?></a>+							</li>+							<?php foreach ( $pages as $pagelink ) : ?>+							<li<?php if ($pagelink->id == $post_id) echo ' class="current-page"'; ?>>+								<a href="<?php echo $pagelink->permalink; ?>" title="<?php echo $pagelink->title; ?>"><?php echo $pagelink->title; ?></a>+							</li>+							<?php endforeach; ?>+						</ul>+					</div>+					<div id="utils">+						<ul>+							<?php if ( isset( $user ) && is_object( $user ) ) : ?>+							<li class="login"><a href="<?php Site::out_url( 'habari' ); ?>/user/logout">Logout</a></li>+							<?php else : ?>+							<li class="login"><a href="<?php Site::out_url( 'habari' ); ?>/user/login">Login</a></li>+							<?php endif; ?>+						</ul>+					</div>+					<div class="clear"></div>+				</div>+			</div>\ No newline at end of fileIndex: home.php===================================================================--- home.php	(revision 121)+++ home.php	(working copy)@@ -1,57 +1,53 @@-<?php include 'header.php'; ?>-<div id="main-posts"><?php $post=reset($posts); ?>-<?php $post_class='post'; ?>-<?php if (!$show_entry_paperclip) $post_class.='-alt'; ?>-<div class="<?php echo $post_class?>">-<?php if ( is_array( $post->tags ) ) {;?>-<div class="post-tags">-<?php echo $post->tags_out;?>+<?php+/* Include page header */+include 'header.php';+?>+				<div id="main-posts">+					<?php $post=reset($posts); ?>+					<div class="<?php echo $post_class; ?>">+						<?php if ( is_array( $post->tags ) ): ?>+						<div class="post-tags"><?php echo $post->tags_out;?></div>+						<?php endif; ?>+						<div class="post-title">+						<h2><a href="<?php echo $post->permalink; ?>" title="<?php echo $post->title; ?>"><?php echo $post->title_out; ?></a></h2>+					</div>+					<div class="post-sup">+						<span class="post-date"><?php echo $post->pubdate_out; ?></span>+						<span class="post-comments-link"><a href="<?php echo $post->permalink.'#comment-form'; ?>" title="Comments on this post"><?php+							$theme->post_comments_link( $post, 'No Comments', '%s Comment', '%s Comments' );+						?></a></span>+						<span class="clear"></span>+					</div>+					<div class="post-entry"><?php echo $post->content_out; ?></div>+					<div class="post-footer"><?php if ( $user ) : ?>+						<span class="post-edit"><a href="<?php URL::out( 'admin', 'page=publish&slug=' . $post->slug); ?>"	title="Edit post">Edit</a></span>+					<?php endif; ?></div>+				</div>+			</div>+		</div>+		<div id="top-secondary"><?php include'sidebar.php' ?></div>+		<div class="clear"></div>+	</div> </div>-<?php } ?>-<div class="post-title">-<h2><a href="<?php echo $post->permalink; ?>"-	title="<?php echo $post->title; ?>"><?php echo $post->title_out; ?></a></h2>-</div>-<div class="post-sup"><span class="post-date"><?php echo $post->pubdate_out; ?></span>-<span class="post-comments-link"><a-	href="<?php echo $post->permalink.'#comment-form'; ?>" title="Comments on this post"><?php $theme->post_comments_link( $post, 'No Comments', '%s Comment', '%s Comments' ); ?>-</a></span>-<span class="clear"></span></div>-<div class="post-entry"><?php echo $post->content_out; ?></div>-<div class="post-footer"><?php if ( $user ) { ?> <span class="post-edit"><a-	href="<?php URL::out( 'admin', 'page=publish&slug=' . $post->slug); ?>"-	title="Edit post">Edit</a></span> <?php } ?></div>-</div>-</div>-</div>-<div id="top-secondary"><?php include'sidebar.php' ?></div>-<div class="clear"></div>-</div>-</div> <div id="page-bottom">-<div id="wrapper-bottom">-<div id="bottom-primary">-<div id="prev-posts"><?php while($post=next($posts)) { ?>-<div class="prev-post">-<div class="prev-post-title">-<h3><a href="<?php echo $post->permalink; ?>"-	title="<?php echo $post->title; ?>"><?php echo $post->title_out; ?></a></h3>-</div>-<div class="prev-post-excerpt">-<p><?php echo $post->content_excerpt; ?><a href="<?php echo $post->permalink; ?>" title="Continue reading <?php echo $post->title; ?>"><img src="<?php Site::out_url( 'theme' ); ?>/images/arrow.png" alt="more"></a></p>-</div>-</div>-<?php } ?>-<div id="prev-posts-footer"><?php $theme->prevnext($page, Utils::archive_pages($posts->count_all())); ?></div>-</div>+	<div id="wrapper-bottom">+		<div id="bottom-primary">+			<div id="prev-posts">+				<?php while($post=next($posts)) : ?>+				<div class="prev-post">+					<div class="prev-post-title">+						<h3><a href="<?php echo $post->permalink; ?>"	title="<?php echo $post->title; ?>"><?php echo $post->title_out; ?></a></h3>+					</div>+					<div class="prev-post-excerpt">+						<p><?php echo $post->content_excerpt; ?><a href="<?php echo $post->permalink; ?>" title="Continue reading <?php echo $post->title; ?>"><img src="<?php Site::out_url( 'theme' ); ?>/images/arrow.png" alt="more"></a></p>+					</div>+				</div>+				<?php endwhile; ?>+			<div id="prev-posts-footer"><?php $theme->prevnext($page, Utils::archive_pages($posts->count_all())); ?></div>+		</div> -<div id="archives"><?php if (Plugins::is_loaded("extendedmonthlyarchives")) echo $extended_monthly_archives;?></div>-<?php include 'footer.php'; ?></div>-<div id="bottom-secondary">-<div id="tags"><?php if (Plugins::is_loaded('tagcloud')) echo $tag_cloud; ?></div>-</div>-<div class="clear"></div>-</div>-</div>-</body>-</html>+		<div id="archives"><?php if (Plugins::is_loaded("extendedmonthlyarchives")) echo $extended_monthly_archives;?></div>+<?php+/* Include page footer */+include 'footer.php';+?>\ No newline at end of fileIndex: page.single.php===================================================================--- page.single.php	(revision 121)+++ page.single.php	(working copy)@@ -28,7 +28,7 @@ <div id="wrapper-bottom"> <div id="bottom-primary"> <div id="post-comments">-<?php +<?php if ( $post->comments->moderated->count ) { 	foreach ( $post->comments->moderated as $comment ) { 	$class= '"post-comment';@@ -52,12 +52,4 @@ <!-- comment form starts here --> <?php include 'commentform.php'; ?> <!-- comment form ends here -->-<?php include 'footer.php'; ?></div>-<div id="bottom-secondary">-<div id="tags"><?php if (!empty($tag_cloud)) echo $tag_cloud; ?></div>-</div>-<div class="clear"></div>-</div>-</div>-</body>-</html>+<?php include 'footer.php'; ?>Index: style.css===================================================================--- style.css	(revision 121)+++ style.css	(working copy)@@ -81,7 +81,8 @@ }  p {-	margin: 0px;+	margin: 0px 0px 10px;+	line-height: 130%; }  /*-------------------------------------The upper part of the page----------------*/@@ -144,7 +145,7 @@ 	height:48px; } -	+ #navbar ul li { 	padding: 3px 0px 0px 0px; 	float: left;@@ -162,7 +163,7 @@ 	font-weight: normal; 	border: none; 	display: block;-	+ }  #navbar ul li a:hover {@@ -204,10 +205,7 @@ 	background: url(images/paperclip.png) top left no-repeat; } -.post-alt {-	min-height: 153px;-	padding-left: 100px;-	padding-top: 60px;+.post.alt { 	background: none; } .post-tags {@@ -229,7 +227,7 @@ }  .post-title {-	+ }  .post-sup {@@ -304,7 +302,7 @@ 	width: 200px; 	height: 20px; 	text-align: center;-	+ }  #search #search-btn {@@ -319,20 +317,20 @@ #feeds { 	height: 92px; 	padding: 0px 80px 5px 35px;-		+ }  #feeds img { 	border: none; 	margin-right: 10px; 	vertical-align: top;-	+ }  #feeds a { 	text-decoration: none; 	padding-bottom: 2px;-	+ }  #feeds span {@@ -428,11 +426,11 @@ }  .prev-post {-	+ }  .prev-post-title {-	+ }  .prev-post-excerpt {@@ -515,7 +513,7 @@ }  .post-comment-commentor {-	+ }  .post-comment-body {@@ -558,7 +556,7 @@  #comment-form p{ 		margin-bottom:5px;-				+ 	} #comment-form p input{ 	color: #666666;}Index: theme.php===================================================================--- theme.php	(revision 121)+++ theme.php	(working copy)@@ -1,34 +1,57 @@-<?php +<?php -// Apply Format::autop() to post content... -Format::apply( 'autop', 'post_content_out' );-// Apply Format::autop() to comment content...-Format::apply( 'autop', 'comment_content_out' );-// Apply Format::tag_and_list() to post tags... -Format::apply( 'tag_and_list', 'post_tags_out' );-// Apply Format::nice_date() to post date...-Format::apply( 'nice_date', 'post_pubdate_out', 'F j, Y g:ia' );--Format::apply( 'nice_date', 'comment_date', 'F j, Y g:ia' );--Format::apply_with_hook_params( 'more', 'post_content_excerpt', '',56, 1 );-  define( 'THEME_CLASS', 'charcoal' );   class charcoal extends Theme {-	 	 	-	public function add_template_vars() -	{	-		//Theme options-		$this->assign('show_title_image',true); //Set to true to show the title image, false to display the title text.-		$this->assign('home_label','Blog'); //Set to whatever you want your fist tab text to be.-		$this->assign('show_entry_paperclip', true); //Set to true to show the paperclip graphic in posts, false to hide it.-		$this->assign('show_page_paperclip', false); //Set to true to show the paperclip graphic in pages, false to hide it.-		$this->assign('show_powered', true); //Set to true to show the "powered by Habari" graphic in the sidebar, false to hide it.-		-		+	//Set to true to show the title image, false to display the title text.+	const SHOW_TITLE_IMAGE = true;++	//Set to whatever you want your fist tab text to be.+	const HOME_LABEL = 'Blog';++	//Set to true to show the paperclip graphic in posts, false to hide it.+	const SHOW_ENTRY_PAPERCLIP = true;++	//Set to true to show the paperclip graphic in pages, false to hide it.+	const SHOW_PAGE_PAPERCLIP = false;++	//Set to true to show the "powered by Habari" graphic in the sidebar, false to hide it.+	const SHOW_POWERED = true;++	/**+	 * 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' );+		// Apply Format::nice_date() to post date...+		Format::apply( 'nice_date', 'post_pubdate_out', 'F j, Y g:ia' );+		// Apply Format::nice_date() to comment date...+		Format::apply( 'nice_date', 'comment_date', 'F j, Y g:ia' );+		// Truncate content excerpt at "more" or 56 characters...+		Format::apply_with_hook_params( 'more', 'post_content_excerpt', '',56, 1 );+	}++	/**+	 * Add some variables to the template output+	 */+	public function add_template_vars()+	{+		// Use theme options to set values that can be used directly in the templates+		// Don't check for constant values in the template code itself+		$this->assign('show_title_image', self::SHOW_TITLE_IMAGE);+		$this->assign('home_label', self::HOME_LABEL);+		$this->assign('show_entry_paperclip', self::SHOW_ENTRY_PAPERCLIP);+		$this->assign('show_page_paperclip', self::SHOW_PAGE_PAPERCLIP);+		$this->assign('show_powered', self::SHOW_POWERED);++		$this->assign('post_class', 'post' . ( ! self::SHOW_ENTRY_PAPERCLIP ? ' alt' : '' ) );+ 		if( !$this->template_engine->assigned( 'pages' ) ) { 			$this->assign('pages', Posts::get( array( 'content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1 ) ) ); 		}@@ -38,46 +61,60 @@ 		if( !$this->template_engine->assigned( 'page' ) ) { 			$this->assign('page', isset( $page ) ? $page : 1 ); 		}-		++		$this->assign( 'post_id', ( isset($this->post) && $this->post->content_type == Post::type('page') ) ? $this->post->id : 0 );+ 		parent::add_template_vars(); 	} -	public function filter_theme_call_header( $return,$theme )+	/**+	 * Provide links to the next and previous pages if they exist+	 *+	 * @param Theme $theme This object+	 * @param integer $currentpage The number of the current page+	 * @param integer $totalpages The total number of pages in this set+	 * @return string HTML with links to the next and previous pages+	 */+	public function theme_prevnext($theme, $currentpage, $totalpages) 	{-		if ( User::identify() != FALSE ) {-			Stack::add( 'template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery' );-		}-		return $return;-	}--	-	public function theme_prevnext($theme,$currentpage, $totalpages){-		 		$out='';-			if ( $currentpage > $totalpages ) {+		if ( $currentpage > $totalpages ) { 			$currentpage= $totalpages; 		} 		else if ( $currentpage < 1 ) { 			$currentpage= 1; 		}-		-		if ($currentpage < $totalpages){-			$out.='<span class="nav-prev"><a href="'.Site::get_url( 'habari', true ).'page/'.($currentpage+1).'">Older Posts</a></span>';}-		if ($currentpage > 1){-			$out.='<span class="nav-next"><a href="'.Site::get_url( 'habari', true ).'page/'.($currentpage-1).'">Newer Posts</a></span>';}++		if ($currentpage < $totalpages) {+			$out.='<span class="nav-prev"><a href="'.Site::get_url( 'habari', true ).'page/'.($currentpage+1).'">Older Posts</a></span>';+		}+		if ($currentpage > 1) {+			$out.='<span class="nav-next"><a href="'.Site::get_url( 'habari', true ).'page/'.($currentpage-1).'">Newer Posts</a></span>';+		} 		echo $out;-		 	}-	-	public function filter_post_tags_out($return){-		// removes the 'and' and the commas from the tag list-		return str_replace('and',null,str_replace(',',null,$return));-		++	/**+	 * 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 "<a href=\\"" . URL::get("display_entries_by_tag", array( "tag" => $b) ) . "\\" rel=\\"tag\\">" . $a . "</a>";');+		$array = array_map($fn, $array, array_keys($array));+		$out = implode(' ', $array);+		return $out; 	}-	-	public function theme_post_comments_link($theme, $post,$zero,$one,$more){++	public function theme_post_comments_link($theme, $post, $zero, $one, $more)+	{ 		$c=$post->comments->approved->count;-		switch ($c){+		switch ($c) { 			case '0': 				return $zero; 				break;@@ -87,13 +124,12 @@ 			default : 				return str_replace('%s',$c,$more); 		}-		+ 	}-		-	public function filter_post_content_excerpt($return){++	public function filter_post_content_excerpt($return)+	{ 		return strip_tags($return); 	}--	 } ?>