All pastes #948066 Raw Edit

PHP JS Script

public php v1 · immutable
·published 2008-03-18 21:40 UTC
rendered paste body
<?phpclass xhtmlCore {private $options;private $tpl;	public function __construct($options_array)	{		global $tpl;				$this->tpl = $tpl;		$this->options = array();		$this->options['path'] = $options_array[0]; // (STRING), se termine toujours par un /		$this->options['meta'] = $options_array[1]; // (ARRAY) (titre, sous-titre);		$this->options['css_int'] = $options_array[2]; // (ARRAY) array(1,3,8);		$this->options['js_int'] = $options_array[3]; // (ARRAY) array(1,3,8);						$this->CSS();		$this->JS();		$this->meta();				$this->foot();			}			private function CSS ()	{		$css_array = array (		array('base','screen'),		array('bbcode', 'all'),		array('forms', 'screen'),		array('messages', 'screen'),		array('msg', 'screen'),		array('pagination', 'screen'),		array('table', 'screen')		);				$css = '';		foreach($this->options['css_int'] as $v)		{			$css .= 			'<link rel="stylesheet" href="'.$this->options['path'].'css/'.$css_array[$v][0].'.css"  type="text/css" media="'.$css_array[$v][1].'" />'."\n";		}				$this->tpl->assign('css_include', $css);		return true;			}			private function JS()	{		$js_array = array(		'mootools','scroll','textarea', 'windoo'		);				$js = '';		foreach($this->options['js_int'] as $v)		{			$js .= 			'<script type="text/javascript" src="'.$this->options['path'].'js/'.$js_array[$v].'.js"></script>'."\n";		}				$this->tpl->assign('url_directory_tpl', $this->options['path']);						$this->tpl->assign('js_include', $js);			return true;			}	private function meta()	{			$keywords = strtr(strtolower($this->options['meta'][0]), 			'áàâäãåçéèêëíìîïñóòôöõúùûüýÿ','aaaaaaceeeeiiiinooooouuuuyy');			$carsforbidden = array('~', '`',  '!', '@',			'#', '\$', '%', '^', '&', '*', '(', 			')', '+', '{', '}', '-', '_', '[', 			']', '|', '\\',  '\'', ':' ,'"', ';',			'<', '>', ',', '.', '/', '?', '+', '=' );			$keywords = str_replace($carsforbidden, '', $keywords);		$arr = explode(' ', $keywords);		rsort($arr);		$i = 0;		$c =count($arr);		while($i < $c){			if($arr[$i] == NULL)			{				unset($arr[$i]); 			}			$i++;			}				$this->tpl->assign('title', implode(' - ', $this->options['meta']));						$this->tpl->assign('meta_include',		'<meta name="keywords" content="'.$keywords.'" />'."\n".'		<meta name="description" content="'.str_replace('"', '', $this->options['meta'][0]).'" />');						return true;	}			private function foot()	{		global $sql, $bench;					$objetxml = new XMLStats(); 									if($_SESSION['connect'] === true)			{				$objetxml->AddMember(				$_SESSION['context']['pseudo'], 				$_SESSION['context']['ID'], 				'http://'.htmlspecialchars($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'])				); 			}			else			{				$objetxml->AddGuest(				'http://'.htmlspecialchars($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'])				); 			}												$objetxml->RefreshList(); 								$nbu = $objetxml->UsersCount();		$nbq = $sql->nbQuery;				$foot = 		$nbu.' connect&eacute;		'.(($nbu > 1) ? 's' : '').'		- 		'.$nbq.' requ&ecirc;te		'.(($nbq > 1) ? 's' : '').'		- '; 						$bench->end_bench();		$foot .= $bench->return_simple_result();			$this->tpl->assign('footer', $foot);			return true;		}}?>