Location: PHPKode > projects > Simple Way to Usenet > libs/core/themes/thm_helper.class.php
<?php
/**
 *  
 * @author  Benjamin Gillissen <hide@address.com>
 * 
 *	**************************************************************

	Copyright (C) 2009  Benjamin Gillissen
	
	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details at:
	http://www.gnu.org/copyleft/gpl.html

 *	**************************************************************
 */
class thm_helper {
	
	private $feats=Array();
	
	public function __construct($feats=Array(), $ajax=Array()){
		if (!is_array($ajax) ){ 
			errors::raise("Theme helper expect second parameter to be an Array of ajax callback !", CORE_LOG_WARNING, 'THM');
		} else {
			foreach($ajax as $cb){ ajax::RegisterFunction($cb); }	
		}
		if (!is_array($feats) ){ 
			errors::raise("Theme helper expect first parameter to be an Array of theme features !", CORE_LOG_WARNING, 'THM');
			return;
		}
		foreach($feats as $feat){
			$func = "tfeat_$feat::implent";
			if ( FALSE === call_user_func($func) ){ 
				errors::raise("Active Theme could not implent TFeat : ".$feat, CORE_LOG_NOTICE, 'THM');
			} else {
				$this->feats[] = $feat;
			}
		}
		
	}

	public function getfeats(){ return $this->feats; }
	
	protected function common_header_data(){
		$o['websitename'] = SITE_TITLE;
		$o['basedir'] = browsing::basedir();
		$o['charset'] = langs::charset();
		$o['lang'] = langs::lang();
		$o['langs'] = langs::getlangs();
		$o['theme'] = themes::get_active();
		$o['themes'] = themes::gethemes();
		$o['events'] = pagegen::getevents();
		$buf = str_replace(browsing::basedir(), '', browsing::activeurl());
		$buf = split('/', ereg_replace("^/", '', $buf));
		foreach($buf as $lvl => $page){
				$pid = pages::getby_namelvl($page, $lvl);
				$o['pagepath'][$pid] = $page;
		}
		return $o;
	}
	
	protected function common_footer_data(){ return Array(); }
	
	//a blockvis for auth engine loggedas, logout, register link stuff
	
	
	

}
return TRUE;
Return current item: Simple Way to Usenet