[bbDev] [636] trunk: themes overhaul.

Michael D Adams mikea at turbonet.com
Tue Feb 6 19:04:18 GMT 2007


Thanks for the reminder, Aditya :)  Sorry I didn't respond sooner.

The non-numeric keys in bb_load_template are the ones that were not  
global in the old way of doing things (like $h2).  Globalizing them  
in the new way *might* break backward compatibility for some highly  
specific cases.  More importantly, though, bbPress has enough stuff  
in the global namespace; we should try to keep things non-global as  
much as possible.

What do you think?

Michael


On Jan 25, 2007, at 4:21 PM, Aditya Naik wrote:

> reminder michael
>
> On 1/22/07, Aditya Naik <so1oonnet at gmail.com> wrote:
> instead of
>
> function bb_load_template( $file, $globals = false ) {
> .....
>             if ( !is_numeric($global) )
>                 $$global = $v;
>             else
>                 global $$v;
> .....
> }
>
> may be
> function bb_load_template( $file, $globals = false ) {
>  .....
>             if ( !is_numeric($global) )
>                 global $$global;
>                 $$global = $v;
>             else
>                 global $$v;
> .....
> }
>
> this is for custom variables like the one for post_form
> bb_load_template( 'post-form.php', array('h2' => $h2) );
>
>
> On 1/22/07, m at wordpress.org < m at wordpress.org> wrote:
> Revision
> 636
> Author
> mdawaffe
> Date
> 2007-01-22 08:40:51 +0000 (Mon, 22 Jan 2007)
> Log Message
>
> themes overhaul.  bb_load_template() probably breaks a lot of  
> things.  Re #527 Fixes #511
> Modified Paths
>
> trunk/bb-admin/admin-functions.php
> trunk/bb-includes/functions.php
> trunk/bb-includes/l10n.php
> trunk/bb-includes/template-functions.php
> trunk/bb-login.php
> trunk/bb-reset-password.php
> trunk/bb-settings.php
> trunk/edit.php
> trunk/favorites.php
> trunk/forum.php
> trunk/index.php
> trunk/profile-base.php
> trunk/profile-edit.php
> trunk/profile.php
> trunk/register.php
> trunk/rss.php
> trunk/search.php
> trunk/statistics.php
> trunk/tags.php
> trunk/topic.php
> trunk/view.php
> Added Paths
>
> trunk/bb-admin/themes.php
> Diff
>
> Modified: trunk/bb-admin/admin-functions.php (635 => 636)
>
> --- trunk/bb-admin/admin-functions.php	2007-01-22 07:34:33 UTC (rev  
> 635)
> +++ trunk/bb-admin/admin-functions.php	2007-01-22 08:40:51 UTC (rev  
> 636)
> @@ -17,6 +17,7 @@
>  	$bb_menu[0] = array(__('Dashboard'), 'moderate', '
>
> index.php');
>  	$bb_menu[5] = array(__('Users'), 'moderate', 'users.php');
>  	$bb_menu[10] = array(__('Content'), 'moderate', 'content.php');
>
>
> +	$bb_menu[13] = array(__('Presentation'), 'use_keys', 'themes.php');
>  	$bb_menu[15] = array(__('Site Management'), 'use_keys', 'site.php');
>
>
>
>  	$bb_submenu = array();
> @@ -28,6 +29,8 @@
>  	$bb_submenu['content.php'][10] = array(__('Posts'), 'moderate',  
> 'content-posts.php');
>
>
>  	$bb_submenu['content.php'][15] = array(__('Forums'), 'moderate',  
> 'content-forums.php');
>
> +	$bb_submenu['themes.php'][5] = array(__('Themes'), 'use_keys', '
>
> themes.php');
> +
>  	$bb_submenu['site.php'][5] = array(__('Recount'), 'recount',  
> 'site.php');
>
>  	do_action('bb_admin_menu_generator','');
>
>
> Added: trunk/bb-admin/themes.php (635 => 636)
>
> --- trunk/bb-admin/themes.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/bb-admin/themes.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -0,0 +1,35 @@
> +<?php require_once('admin.php
>
> '); require_once(BBPATH . BBINC . '/statistics-functions.php'); ?>
> +
> +<?php bb_get_admin_header(); ?>
> +<?php
> +
> +	if (isset($_POST['submit'])) {
> +		$activetheme = $_POST['active_theme'];
>
>
> +		bb_update_option('bb_active_theme',$activetheme);
> +	}
> +
> +	$activetheme = bb_get_option('bb_active_theme');
> +
> +	$themes = bb_get_themes();
> +
> +	if ( !in_array($activetheme, $themes)) {
>
>
> +		$activetheme = BBPATH . 'bb-templates/kakumei';
> +		bb_update_option('bb_active_theme',$activetheme);
> +	}
> +?>
> +<h2><?php _e('Presentation'); ?></h2>
> +
>
> +
>
> +<form method="post">
> +	<?php
> +	foreach ($themes as $theme) :
> +		if ($theme == $activetheme) $checked = "checked='checked' ";  
> else $checked = "";
> +		$base = basename($theme);
>
>
> +		echo "<p><input type='radio' name='active_theme' value ='$theme'  
> $checked/> $base</p>";
> +	endforeach;
> +	?>
> +	<p class="submit"><input type="submit" name="submit" value="Make  
> Default"></p>
>
>
> +</form>
> +
> +
> +<?php bb_get_admin_footer(); ?>
> Modified: trunk/bb-includes/functions.php (635 => 636)
>
> --- trunk/bb-includes/functions.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/bb-includes/functions.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -1863,6 +1863,28 @@
>  	return apply_filters( 'bb_trusted_roles', array('moderator',  
> 'administrator', 'keymaster') );
>
>
>  }
>
> +function bb_get_active_theme_folder() {
> +	$activetheme = bb_get_option( 'bb_active_theme' );
> +	if ( !$activetheme )
> +		$activetheme = BBPATH . 'bb-templates/kakumei';
>
>
> +
> +	return apply_filters( 'bb_get_active_theme_folder', $activetheme );
> +}
> +
> +function bb_get_themes() {
> +	$r = array();
> +
> +	$theme_roots = array(BBPATH . 'bb-templates/', BBTHEMEDIR);
>
>
> +	foreach ( $theme_roots as $theme_root )
> +		if ( $themes_dir = @dir($theme_root) )
> +			while( ( $theme_dir = $themes_dir->read() ) !== false )
> +				if ( is_dir($theme_root . $theme_dir) && is_readable 
> ($theme_root . $theme_dir) && '.' != $theme_dir{0} )
>
>
> +					$r[$theme_dir] = $theme_root . $theme_dir;
> +
> +	ksort($r);
> +	return $r;
> +}
> +
>  function bb_parse_args( $args, $defaults = '' ) {
>  	if ( is_array($args) )
>
>
>  		$r =& $args;
> Modified: trunk/bb-includes/l10n.php (635 => 636)
>
> --- trunk/bb-includes/l10n.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/bb-includes/l10n.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -86,7 +86,7 @@
>  function load_theme_textdomain($domain) {
>
>
>  	$locale = get_locale();
>
> -	$mofile = BBPATH . "my-templates/$locale.mo";
> +	$mofile = bb_get_template( "$locale.mo" );
>
>  	load_textdomain($domain, $mofile);
>
>  }
>
> Modified: trunk/bb-includes/template-functions.php (635 => 636)
>
> --- trunk/bb-includes/template-functions.php	2007-01-22 07:34:33  
> UTC (rev 635)
> +++ trunk/bb-includes/template-functions.php	2007-01-22 08:40:51  
> UTC (rev 636)
> @@ -1,14 +1,34 @@
>  <?php
>
>
>
> -function bb_get_header() {
> -	global $bb, $bbdb, $forum, $forum_id, $topic, $bb_current_user;
> -	if ( file_exists( BBPATH . 'my-templates/header.php') ) {
> -		include( BBPATH . 'my-templates/header.php');
>
>
> +function bb_load_template( $file, $globals = false ) {
> +	global $bb, $bbdb, $bb_current_user, $page, $bb_cache,
> +		$posts, $bb_post, $post_id, $topics, $topic, $topic_id,
> +		$forums, $forum, $forum_id, $tags, $tag, $tag_name, $user,  
> $user_id, $view;
>
>
> +
> +	if ( $globals )
> +		foreach ( $globals as $global => $v )
> +			if ( !is_numeric($global) )
> +				$$global = $v;
> +			else
> +				global $$v;
> +
> +	if ( file_exists( bb_get_active_theme_folder() .  "/$file") ) {
>
>
> +		include( bb_get_active_theme_folder() .  "/$file" );
>  	} else {
> -		include( BBPATH . 'bb-templates/header.php');
> +		include( BBPATH . "bb-templates/kakumei/$file" );
>
>
>  	}
>  }
>
> +function bb_get_template( $file ) {
> +	if ( file_exists( bb_get_active_theme_folder() .  "/$file") )
> +		return bb_get_active_theme_folder() .  "/$file";
>
>
> +	return BBPATH . "bb-templates/kakumei/$file";
> +}
> +
> +function bb_get_header() {
> +	bb_load_template( 'header.php' );
> +}
> +
>  function bb_language_attributes( $xhtml = 0 ) {
>
>
>  	$output = '';
>  	if ( $dir = bb_get_option('text_direction') )
> @@ -32,20 +52,18 @@
>  	else
>  		$css_file = 'style.css
> ';
>
>
> -	if ( file_exists( BBPATH . 'my-templates/style.css') )
> -		$r = bb_get_option('uri') . 'my-templates/' . $css_file;
> -	else
> -		$r = bb_get_option('uri') . 'bb-templates/' . $css_file;
>
>
> +	$active_theme = bb_get_active_theme_folder();
> +
> +	if ( file_exists( "$active_theme/style.css" ) ) {
> +		$path = substr($active_theme, strlen(BBPATH));
> +		$r = bb_get_option('uri') . "$path/$css_file";
>
>
> +	} else
> +		$r = bb_get_option('uri') . "bb-templates/default/$css_file";
>  	return apply_filters( 'bb_get_stylesheet_uri', $r, $stylesheet );
>  }
>
>
>
>  function bb_get_footer() {
> -	global $bb, $bbdb, $forum, $forum_id, $topic, $bb_current_user;
> -	if ( file_exists( BBPATH . 'my-templates/footer.php') ) {
> -		include( BBPATH . 'my-templates/footer.php');
>
>
> -	} else {
> -		include( BBPATH . 'bb-templates/footer.php');
> -	}
> +	bb_load_template( 'footer.php' );
>  }
>
>  function bb_head() {
>
>
> @@ -78,30 +96,16 @@
>  	if ( bb_current_user_can('moderate') )
>  		echo "<a href='" . bb_get_option( 'uri' ) . "bb-admin/'>Admin</ 
> a> | ";
>
>
>  	echo "<a href='" . bb_get_option( 'uri' ) . "bb-login.php? 
> logout'>". __('Log out') ."</a>)</small></p>";
>
> -	} else {
>
> -		if ( file_exists(BBPATH . '/my-templates/login-form.php') ) {
> -			include(BBPATH . '/my-templates/login-form.php');
> -		} else {
> -			include(BBPATH . '/bb-templates/login-form.php
> ');
>
> -		}
> -	}
> +	} else
> +		bb_load_template( 'login-form.php' );
>  }
>
>  function search_form( $q = '' ) {
> -	if ( file_exists(BBPATH . '/my-templates/search-
>
> form.php') ) {
> -		include(BBPATH . '/my-templates/search-form.php');
> -	} else {
> -		include(BBPATH . '/bb-templates/search-form.php');
> -	}
> +	bb_load_template( 'search-form.php
>
> ', array('q' => $q) );
>  }
>
>  function bb_post_template() {
> -	global $bb_current_user, $topic, $bb_post;
> -	if ( file_exists( BBPATH . 'my-templates/post.php' ) ) {
>
>
> -		include( BBPATH . 'my-templates/post.php' );
> -	} else	{
> -		include( BBPATH . 'bb-templates/post.php' );
> -	}
> +	bb_load_template( 'post.php' );
>  }
>
>
>
>  function post_form( $h2 = '' ) {
> @@ -122,11 +126,7 @@
>
>  	if ( ( is_topic() && bb_current_user_can( 'write_post', $topic- 
> >topic_id ) && $page == get_page_number( $topic->topic_posts +  
> $add ) ) || ( !is_topic() && bb_current_user_can( 'write_topic',  
> $forum->forum_id ) ) ) {
>
>
>  		echo "<form class='postform' name='postform' id='postform'  
> method='post' action='" . bb_get_option('uri') . "bb-post.php'>\n";
>
>
> -		if ( file_exists( BBPATH . 'my-templates/post-form.php' ) ) {
> -			include( BBPATH . 'my-templates/post-form.php' );
> -		} else {
> -			include( BBPATH . 'bb-templates/post-form.php
>
> ');
> -		}
> +		bb_load_template( 'post-form.php', array('h2' => $h2) );
>  		bb_nonce_field( is_topic() ? 'create-post_' . $topic->topic_id :  
> 'create-topic' );
>
>
>  		if ( is_forum() )
>  			echo "<input type='hidden' name='forum_id' value='$forum- 
> >forum_id' />\n";
> @@ -144,11 +144,7 @@
>
>
>  function edit_form() {
>  	global $bb_post, $topic_title;
>  	echo "<form name='post' id='post' method='post' action='" .  
> bb_get_option('uri')  . "
>
> bb-edit.php'>\n";
> -	if ( file_exists(BBPATH . '/my-templates/edit-form.php') ) {
> -		include(BBPATH . '/my-templates/edit-form.php');
> -	} else {
> -		include(BBPATH . '/bb-templates/edit-
>
> form.php');
> -	}
> +	bb_load_template( 'edit-form.php', array('topic_title') );
>  	bb_nonce_field( 'edit-post_' . $bb_post->post_id );
>  	echo "\n</form>";
>
>
>  }
> @@ -1098,13 +1094,8 @@
>  //TAGS
>  function topic_tags() {
>  	global $tags, $tag, $topic_tag_cache, $user_tags, $other_tags,  
> $bb_current_user, $topic;
>
>
> -	if ( is_array( $tags ) || bb_current_user_can( 'edit_tag_by_on',  
> $bb_current_user->ID, $topic->topic_id ) ) {
> -		if ( file_exists( BBPATH . '/my-templates/topic-tags.php' ) ) {
>
>
> -			include( BBPATH . '/my-templates/topic-tags.php' );
> -		} else {
> -			include( BBPATH . '/bb-templates/topic-tags.php');
> -		}
> -	}
> +	if ( is_array( $tags ) || bb_current_user_can( 'edit_tag_by_on',  
> $bb_current_user->ID, $topic->topic_id ) )
>
>
> +		bb_load_template( 'topic-tags.php', array('user_tags',  
> 'other_tags') );
>  }
>
>  function tag_page_link() {
> @@ -1184,11 +1175,7 @@
>
>
>  	if ( !bb_current_user_can( 'edit_tag_by_on', $bb_current_user- 
> >ID, $topic->topic_id ) )
>  		return false;
>  	echo "<form id='tag-form' method='post' action='" . bb_get_option 
> ('uri') . "
>
> tag-add.php'>\n";
> -	if ( file_exists(BBPATH . '/my-templates/tag-form.php') ) {
> -		include(BBPATH . '/my-templates/tag-form.php');
> -	} else {
> -		include(BBPATH . '/bb-templates/tag-
>
> form.php');
> -	}
> +	bb_load_template( 'tag-form.php' );
>  	bb_nonce_field( 'add-tag_' . $topic->topic_id );
>  	echo "</form>";
>
>
>  }
> Modified: trunk/bb-login.php (635 => 636)
>
> --- trunk/bb-login.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/bb-login.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -22,11 +22,7 @@
>  	$user_exists = bb_user_exists( @$_POST['user_login'] );
>
>
>  	$user_login  = user_sanitize ( @$_POST['user_login'] );
>  	$redirect_to = wp_specialchars( $re, 1 );
> -	if ( file_exists( BBPATH . 'my-templates/login.php' ) ) {
>
>
> -		include( BBPATH . 'my-templates/login.php' );
> -	} else {
> -		include( BBPATH . 'bb-templates/login.php' );
> -	}
> +	bb_load_template( 'login.php', array('re', 'user_exists',  
> 'user_login', 'redirect_to', 'ref') );
>
>
>  	exit;
>  }
>
> Modified: trunk/bb-reset-password.php (635 => 636)
>
> --- trunk/bb-reset-password.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/bb-reset-password.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -17,9 +17,5 @@
>  	$reset = true;
>
>
>  endif;
>
> -if ( file_exists( BBPATH . 'my-templates/password-reset.php') ) {
> -	require( BBPATH . 'my-templates/password-reset.php');
> -} else {
> -	require( BBPATH . 'bb-templates/password-
>
> reset.php');
> -}
> +bb_load_template( 'password-reset.php', array('reset',  
> 'user_login', 'reset') );
>  ?>
> Modified: trunk/bb-settings.php (635 => 636)
>
> --- trunk/bb-settings.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/bb-settings.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -52,7 +52,9 @@
>  if ( !defined('BBLANGDIR') )
>
>
>  	define('BBLANGDIR', BBINC . '/languages'); // no leading slash,  
> no trailing slash
>  if ( !defined('BBPLUGINDIR') )
> -	define('BBPLUGINDIR', BBPATH . 'my-plugins');       // no leading  
> slash, no trailing slash
>
>
> +	define('BBPLUGINDIR', BBPATH . 'my-plugins'); // no leading  
> slash, no trailing slash
> +if ( !defined('BBTHEMEDIR') )
> +	define('BBTHEMEDIR', BBPATH . 'my-templates'); // no leading  
> slash, no trailing slash
>
>
>
>  if ( extension_loaded('mysqli') ) {
>  	require( BBPATH . BBINC . '/db-mysqli.php');
> Modified: trunk/edit.php (635 => 636)
>
> --- trunk/edit.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/edit.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -23,10 +23,7 @@
>  else
>  	$topic_title = false;
>
>
>
> -if ( file_exists(BBPATH . 'my-templates/edit-post.php') ) {
> -	require( BBPATH . 'my-templates/edit-post.php' );
> -} else {
> -	require( BBPATH . 'bb-templates/edit-post.php
>
> ' );
> -}
>
> +bb_load_template( 'edit-post.php', array('topic_title') );
> +
>  ?>
> Modified: trunk/favorites.php (635 => 636)
>
> --- trunk/favorites.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/favorites.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -38,10 +38,5 @@
>  $topics = get_user_favorites( $user->ID, true );
>
>
>  $favorites_total = isset($user->favorites) ? count(explode(',',  
> $user->favorites)) : 0;
>
> -if ( file_exists(BBPATH . 'my-templates/favorites.php' ) ) {
>
>
> -	require( BBPATH . 'my-templates/favorites.php' );
> -} else {
> -	require( BBPATH . 'bb-templates/favorites.php' );
> -}
> -
> +bb_load_template( 'favorites.php', array('favorites_total') );
>
>
>  ?>
> Modified: trunk/forum.php (635 => 636)
>
> --- trunk/forum.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/forum.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -19,8 +19,6 @@
>
>  do_action( 'bb_forum.php', $forum_id );
>
>
>
> -if (file_exists( BBPATH . 'my-templates/forum.php' ))
> -	require( BBPATH . 'my-templates/forum.php' );
> -else	require( BBPATH . 'bb-templates/forum.php' );
>
>
> +bb_load_template( 'forum.php', array('bb_db_override', 'stickies') );
>
>  ?>
> Modified: trunk/index.php (635 => 636)
>
> --- trunk/index.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/index.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -15,8 +15,6 @@
>
>  do_action( 'bb_index.php', '' );
>
>
>
> -if (file_exists( BBPATH . 'my-templates/front-page.php' ))
> -	require( BBPATH . 'my-templates/front-page.php' );
> -else	require( BBPATH . 'bb-templates/front-
> page.php
> ' );
> +bb_load_template( 'front-page.php', array('bb_db_override',  
> 'super_stickies') );
>
>  ?>
> Modified: trunk/profile-base.php (635 => 636)
>
> --- trunk/profile-base.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/profile-base.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -8,12 +8,9 @@
>
>  do_action($self . '_pre_head', '');
>
>
>
> -if ( function_exists($self) ) {
> -	if ( file_exists(BBPATH . 'my-templates/profile-base.php') ) {
> -		require( BBPATH . 'my-templates/profile-base.php' );
> -	} else {
>
>
> -		require( BBPATH . 'bb-templates/profile-base.php' );
> -	}
> -}
> +
> +if ( function_exists($self) )
> +	bb_load_template( 'profile-base.php', array('self') );
> +
>
>
>  exit();
>  ?>
> Modified: trunk/profile-edit.php (635 => 636)
>
> --- trunk/profile-edit.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/profile-edit.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -111,9 +111,6 @@
>  	endif;
>  endif;
>
>
>
> -if ( file_exists(BBPATH . 'my-templates/profile-edit.php') ) {
> -	require( BBPATH . 'my-templates/profile-edit.php' );
> -} else {
> -	require( BBPATH . 'bb-templates/profile-
>
> edit.php' );
> -}
> +bb_load_template( 'profile-edit.php', array('profile_info_keys',  
> 'profile_admin_keys', 'assignable_caps', 'updated', 'user_email',  
> 'bb_roles') );
>
>
> +
>  ?>
> Modified: trunk/profile.php (635 => 636)
>
> --- trunk/profile.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/profile.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -42,9 +42,5 @@
>
>  do_action( 'bb_profile.php', $user_id );
>
>
>
> -if ( file_exists(BBPATH . 'my-templates/profile.php') ) {
> -	require( BBPATH . 'my-templates/profile.php' );
> -} else {
> -	require( BBPATH . 'bb-templates/profile.php' );
>
>
> -}
> +bb_load_template( 'profile.php', array('reg_time',  
> 'profile_info_keys', 'updated', 'threads') );
>  ?>
> Modified: trunk/register.php (635 => 636)
>
> --- trunk/register.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/register.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -33,10 +33,10 @@
>  			if ( strpos($key, 'user_') !== 0 && $$key !== '' )
>
>
>  				bb_update_usermeta( $user_id, $key, $$key );
>  		do_action('register_user', $user_id);
> -		if ( file_exists( BBPATH . 'my-templates/register- 
> success.php' ) ) {
>
>
> -			require( BBPATH . 'my-templates/register-success.php' );
> +		if ( file_exists( BBPATH . 'bb-templates/' .  
> get_bb_default_theme_folder() .  '/register-success.php' ) ) {
>
> +			require( BBPATH . 'bb-templates/' . get_bb_default_theme_folder 
> () .  '/register-
> success.php' );
>  		} else {
> -			require( BBPATH . 'bb-templates/register-success.php
> ' );
> +			require( BBPATH . 'bb-templates/default/register-success.php' );
>
>  		}
>  		exit();	
>  	endif;
> @@ -47,10 +47,9 @@
>
>  elseif ( isset( $_POST['user_login'] ) && !is_string($user_login) )
>
>  	$user_login = '';
>
> -if ( file_exists( BBPATH . 'my-templates/register.php' ) ) {
> -	require( BBPATH . 'my-templates/register.php' );
> -} else {
> -	require( BBPATH . 'bb-templates/register.php' );
>
>
> -}
> +$_globals = array('profile_info_keys', 'user_safe', 'user_login',  
> 'user_email', 'user_url', 'bad_input');
> +$_globals = array_merge($_globals, $profile_info_keys);
>
>
>
> +bb_load_template( 'register.php', $_globals );
> +
>  ?>
> Modified: trunk/rss.php (635 => 636)
>
> --- trunk/rss.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/rss.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -62,7 +62,6 @@
>  add_filter('post_link', 'wp_specialchars');
>
>
>  add_filter('post_text', 'htmlspecialchars');
>
> -if (file_exists( BBPATH . 'my-templates/rss2.php'))
> -	require( BBPATH . 'my-templates/rss2.php' );
>
>
> -else	require( BBPATH . 'bb-templates/rss2.php' );
> +bb_load_template( 'rss2.php', array('bb_db_override', 'title') );
> +
>  ?>
> Modified: trunk/search.php (635 => 636)
>
> --- trunk/search.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/search.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -51,8 +51,6 @@
>  add_filter('bb_get_post_time', 'strtotime');
>
>
>  add_filter('bb_get_post_time', 'bb_offset_time');
>
> -if (file_exists( BBPATH . 'my-templates/search.php' ))
> -	require( BBPATH . 'my-templates/search.php' );
>
>
> -else	require( BBPATH . 'bb-templates/search.php' );
> +bb_load_template( 'search.php', array('q', 'likeit', 'error',  
> 'titles', 'recent', 'relevant') );
>
>
>
>  ?>
> Modified: trunk/statistics.php (635 => 636)
>
> --- trunk/statistics.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/statistics.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -8,8 +8,6 @@
>
>  $bb->static_title = __('Statistics') . ' &laquo;';
>
>
>
> -if (file_exists( BBPATH . 'my-templates/stats.php' ))
> -	require( BBPATH . 'my-templates/stats.php' );
> -else	require( BBPATH . 'bb-templates/stats.php');
>
>
> +bb_load_template( 'stats.php', array('popular') );
>
>  ?>
> Modified: trunk/tags.php (635 => 636)
>
> --- trunk/tags.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/tags.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -12,16 +12,12 @@
>
>  	$topics = get_tagged_topics($tag->tag_id, $page);
>
>
>  	do_action( 'bb_tag-single.php', $tag->tag_id );
> -	if (file_exists( BBPATH . 'my-templates/tag-single.php' ))
> -		require( BBPATH . 'my-templates/tag-single.php
> ' );
>
> -	else	require( BBPATH . 'bb-templates/tag-single.php' );
>
> +	bb_load_template( 'tag-single.php', array('tag', 'tag_name',  
> 'topics') );
>
>
>  else :
>
>  	do_action( 'bb_tags.php', '' );
> -	if (file_exists( BBPATH . 'my-templates/tags.php' ))
> -		require( BBPATH . 'my-templates/tags.php' );
>
>
> -	else	require( BBPATH . 'bb-templates/tags.php' );
>
> +	bb_load_template( 'tags.php' );
>  endif;
>  ?>
> Modified: trunk/topic.php (635 => 636)
>
> --- trunk/topic.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/topic.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -40,7 +40,6 @@
>
>  do_action( 'bb_topic.php', $topic_id );
>
>
>
> -if (file_exists( BBPATH . 'my-templates/topic.php' ))
> -	require( BBPATH . 'my-templates/topic.php' );
> -else	require( BBPATH . 'bb-templates/topic.php' );
>
>
> +bb_load_template( 'topic.php', array('bb_db_override',  
> 'user_tags', 'other_tags', 'list_start') );
> +
>  ?>
> Modified: trunk/view.php (635 => 636)
>
> --- trunk/view.php	2007-01-22 07:34:33 UTC (rev 635)
> +++ trunk/view.php	2007-01-22 08:40:51 UTC (rev 636)
> @@ -22,7 +22,7 @@
>  endswitch;
>
>  do_action( 'bb_view.php', '' );
>
>
> -if (file_exists( BBPATH . 'my-templates/view.php' ))
> -	require( BBPATH . 'my-templates/view.php' );
> -else	require( BBPATH . 'bb-templates/view.php' );
> +
>
> +bb_load_template( '
> view.php', array('view_count', 'stickies') );
> +
>  ?>
>
> _______________________________________________
> bbDev mailing list
> bbDev at lists.bbpress.org
> http://lists.bbpress.org/mailman/listinfo/bbdev
>
>
>
>
>
> -- 
> drop by at http://www.adityanaik.com
>
>
>
> -- 
> drop by at http://www.adityanaik.com
> _______________________________________________
> bbDev mailing list
> bbDev at lists.bbpress.org
> http://lists.bbpress.org/mailman/listinfo/bbdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://comox.textdrive.com/pipermail/bbdev/attachments/20070206/4967794c/attachment-0001.htm


More information about the bbDev mailing list