/b2evolution/corporatemag/_skin.class.php

http://laibcomsthemes.googlecode.com/ · PHP · 153 lines · 108 code · 9 blank · 36 comment · 7 complexity · 2e224e660cf3c634182278858e6ae02b 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 corporatemag_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 'corporatemag';
  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. 'featuredCat' => array(
  86. 'label' => T_('featuredCat'),
  87. 'defaultvalue' => '1',
  88. 'note' => 'featured Category',
  89. 'type' => 'checkbox'
  90. ),
  91. 'featuredNum' => array(
  92. 'label' => T_('featuredNum'),
  93. 'defaultvalue' => '5',
  94. 'note' => 'number of featured articles',
  95. 'type' => 'checkbox'
  96. ),
  97. ), parent::get_param_definitions( $params ) );
  98. return $r;
  99. }
  100. /**
  101. * Get ready for displaying the skin.
  102. *
  103. * This may register some CSS or JS...
  104. */
  105. function display_init()
  106. {
  107. // call parent:
  108. parent::display_init();
  109. // Add custom CSS:
  110. $custom_css = '';
  111. $skincolor = $this->get_setting('skin_color');
  112. $widthstyle = '';
  113. $html5support = '';
  114. $featuredCat = '';
  115. $featuredNum = '';
  116. if( $this->get_setting('width_style') == 'fixed' )
  117. { // Fixed Layout
  118. $widthstyle .= 'width: 950px !important; /* fixed */';
  119. }
  120. if( $this->get_setting('width_style') == 'fluid' )
  121. { // Fluid Layout
  122. $widthstyle .= 'width: 90% !important; /* fluid */';
  123. }
  124. if( $this->get_setting('html5_support') == '1' )
  125. { // HTML5 Support
  126. $html5support .= '
  127. <!--[if IE]>
  128. <script src="rsc/js/html5.js"></script>
  129. <![endif]-->
  130. <link rel="stylesheet" href="rsc/css/html5.css" type="text/css" />
  131. ';
  132. }
  133. $custom_css = ''.$html5support.'
  134. <link rel="stylesheet" href="rsc/css/'.$skincolor.'.css" type="text/css" title="'.$skincolor.'" />
  135. <style type="text/css">
  136. div.widthstyle {
  137. '.$widthstyle.'
  138. }
  139. </style>
  140. ';
  141. add_headline( $custom_css );
  142. }
  143. }
  144. ?>