PageRenderTime 287ms CodeModel.GetById 190ms app.highlight 5ms RepoModel.GetById 89ms app.codeStats 0ms

/b2evolution/nonzero/_skin.class.php

http://laibcomsthemes.googlecode.com/
PHP | 139 lines | 94 code | 9 blank | 36 comment | 7 complexity | 07c346da26f6bfe2515cfa1c3416540d MD5 | raw file
  1<?php
  2/**
  3 * This file implements a class derived of the generic Skin class in order to provide custom code for
  4 * the skin in this folder.
  5 *
  6 * This file is part of the b2evolution project - {@link http://b2evolution.net/}
  7 *
  8 * @package skins
  9 * @subpackage nonzero
 10 *
 11 * @version $Id: _skin.class.php,v 1.3 2009/05/24 21:14:38 fplanque Exp $
 12 */
 13if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
 14
 15/**
 16 * Specific code for this skin.
 17 *
 18 * ATTENTION: if you make a new skin you have to change the class name below accordingly
 19 */
 20class nonzero_Skin extends Skin
 21{
 22	/**
 23	* Get default name for the skin.
 24	* Note: the admin can customize it.
 25	*/
 26	function get_default_name()
 27	{
 28		return 'nonzero';
 29	}
 30
 31	/**
 32	* Get default type for the skin.
 33	*/
 34	function get_default_type()
 35	{
 36		return 'normal';
 37	}
 38
 39	/**
 40	* Get definitions for editable params
 41	*
 42	* @see Plugin::GetDefaultSettings()
 43	* @param local params like 'for_editing' => true
 44	*/
 45	function get_param_definitions( $params )
 46	{
 47		$r = array_merge( array(
 48			'skin_color'	=>	array(
 49				'label'		=>	T_('Skin Color'),
 50				'defaultvalue'	=>	'red',
 51				'note'		=>	'',
 52				'type'		=>	'select',
 53				'options'	=>	array(
 54					'blue'		=>	'blue',
 55					'brown'		=>	'brown',
 56					'green'		=>	'green',
 57					'magenta'	=>	'magenta',
 58					'red'		=>	'red',
 59				),
 60			),
 61			'width_style'	=>	array(
 62				'label'		=>	T_('Width Style'),
 63				'defaultvalue'	=>	'fluid',
 64				'note'		=>	'',
 65				'type'		=>	'select',
 66				'options'	=>	array(
 67					'fixed'		=>	'fixed',
 68					'fluid'		=>	'fluid',
 69				),
 70			),
 71			'column_count'	=>	array(
 72				'label'		=>	T_('No. of Columns'),
 73				'defaultvalue'	=>	'3',
 74				'note'		=>	'',
 75				'type'		=>	'select',
 76				'options'	=>	array(
 77					'3'		=>	'3',
 78					'2'		=>	'2',
 79					'1'		=>	'1',
 80				),
 81			),
 82			'html5_support'	=>	array(
 83				'label'		=>	T_('HTML5'),
 84				'defaultvalue'	=>	'1',
 85				'note'		=>	'activate HTML5 support across all browsers (as of 08/08/2009)',
 86				'type'		=>	'checkbox'
 87			),
 88		), parent::get_param_definitions( $params ) );
 89		return $r;
 90	}
 91
 92	/**
 93	* Get ready for displaying the skin.
 94	*
 95	* This may register some CSS or JS...
 96	*/
 97	function display_init()
 98	{
 99		// call parent:
100		parent::display_init();
101
102		// Add custom CSS:
103		$custom_css	=	'';
104		$skincolor	=	$this->get_setting('skin_color');
105		$widthstyle	=	'';
106		$html5support	=	'';
107
108		if( $this->get_setting('width_style') == 'fixed' )
109		{	// Fixed Layout
110			$widthstyle .= 'width: 950px !important; /* fixed */';
111		}
112
113		if( $this->get_setting('width_style') == 'fluid' )
114		{	// Fluid Layout
115			$widthstyle .= 'width: 90% !important; /* fluid */';
116		}
117
118		if( $this->get_setting('html5_support') == '1' )
119		{	// HTML5 Support
120			$html5support .= '
121	<!--[if IE]>
122		<script src="rsc/js/html5.js"></script>
123	<![endif]-->
124	<link rel="stylesheet" href="rsc/css/html5.css" type="text/css" />
125			';
126		}
127
128		$custom_css = ''.$html5support.'
129		<link rel="stylesheet" href="rsc/css/'.$skincolor.'.css" type="text/css" title="'.$skincolor.'" />
130		<style type="text/css">
131		div.widthstyle {
132			'.$widthstyle.'
133		}
134		</style>
135		';
136		add_headline( $custom_css );
137	}
138}
139?>