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