Advertisement
Guest User

Untitled

a guest
Apr 1st, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.95 KB | None | 0 0
  1. <?php
  2. // Sky by Adaptivethemes.com
  3.  
  4.  
  5. /**
  6. * Override or insert variables into the html template.
  7. */
  8. function sky_preprocess_html(&$vars) {
  9. global $theme_key;
  10.  
  11. $theme_name = 'sky';
  12.  
  13. // Load the media queries styles
  14. $media_queries_css = array(
  15. $theme_name . '.responsive.style.css',
  16. $theme_name . '.responsive.gpanels.css'
  17. );
  18. load_subtheme_media_queries($media_queries_css, $theme_name);
  19.  
  20. // Add a class for the active color scheme
  21. if (module_exists('color')) {
  22. $class = check_plain(get_color_scheme_name($theme_key));
  23. $vars['classes_array'][] = 'color-scheme-' . drupal_html_class($class);
  24. }
  25.  
  26. // Add class for the active theme
  27. $vars['classes_array'][] = drupal_html_class($theme_key);
  28.  
  29. // Browser sniff and add a class, unreliable but quite useful
  30. $vars['classes_array'][] = css_browser_selector();
  31.  
  32. // Add theme settings classes
  33. $settings_array = array(
  34. 'font_size',
  35. 'box_shadows',
  36. 'body_background',
  37. 'menu_bullets',
  38. 'content_corner_radius',
  39. 'tabs_corner_radius',
  40. 'image_alignment',
  41. );
  42. foreach ($settings_array as $setting) {
  43. $vars['classes_array'][] = theme_get_setting($setting);
  44. }
  45.  
  46. // Fonts
  47. $fonts = array(
  48. 'bf' => 'base_font',
  49. 'snf' => 'site_name_font',
  50. 'ssf' => 'site_slogan_font',
  51. 'ptf' => 'page_title_font',
  52. 'ntf' => 'node_title_font',
  53. 'ctf' => 'comment_title_font',
  54. 'btf' => 'block_title_font'
  55. );
  56. $families = get_font_families($fonts, $theme_key);
  57. if (!empty($families)) {
  58. foreach ($families as $family) {
  59. $vars['classes_array'][] = $family;
  60. }
  61. }
  62.  
  63. // Headings styles
  64. if (theme_get_setting('headings_styles_caps') == 1) {
  65. $vars['classes_array'][] = 'hs-caps';
  66. }
  67. if (theme_get_setting('headings_styles_weight') == 1) {
  68. $vars['classes_array'][] = 'hs-fwn';
  69. }
  70. if (theme_get_setting('headings_styles_shadow') == 1) {
  71. $vars['classes_array'][] = 'hs-ts';
  72. }
  73. }
  74.  
  75. /**
  76. * Hook into the color module.
  77. */
  78. function sky_process_html(&$vars) {
  79. if (module_exists('color')) {
  80. _color_html_alter($vars);
  81. }
  82. }
  83. function sky_process_page(&$vars) {
  84. if (module_exists('color')) {
  85. _color_page_alter($vars);
  86. }
  87. }
  88.  
  89. /**
  90. * Override or insert variables into the block template.
  91. */
  92. function sky_preprocess_block(&$vars) {
  93. if ($vars['block']->module == 'superfish' || $vars['block']->module == 'nice_menu') {
  94. $vars['content_attributes_array']['class'][] = 'clearfix';
  95. }
  96. if (!$vars['block']->subject) {
  97. $vars['content_attributes_array']['class'][] = 'no-title';
  98. }
  99. if ($vars['block']->region == 'menu_bar' || $vars['block']->region == 'top_menu') {
  100. $vars['title_attributes_array']['class'][] = 'element-invisible';
  101. }
  102. }
  103.  
  104. /**
  105. * Override or insert variables into the field template.
  106. */
  107. function sky_preprocess_field(&$vars) {
  108. $element = $vars['element'];
  109. $vars['classes_array'][] = 'view-mode-' . $element['#view_mode'];
  110. $vars['image_caption_teaser'] = FALSE;
  111. $vars['image_caption_full'] = FALSE;
  112. if (theme_get_setting('image_caption_teaser') == 1) {
  113. $vars['image_caption_teaser'] = TRUE;
  114. }
  115. if (theme_get_setting('image_caption_full') == 1) {
  116. $vars['image_caption_full'] = TRUE;
  117. }
  118. $vars['field_view_mode'] = '';
  119. $vars['field_view_mode'] = $element['#view_mode'];
  120. }
  121.  
  122.  
  123. function sky_html_head_alter(&$head_elements) {
  124. foreach ($head_elements as $key => $element) {
  125. if (isset($element['#attributes']['rel']) && $element['#attributes']['rel'] == 'shortlink') {
  126. unset($head_elements[$key]);
  127. }
  128. }
  129.  
  130. foreach ($head_elements as $key => $element) {
  131. if (isset($element['#attributes']['name']) && $element['#attributes']['name'] == 'generator') {
  132. unset($head_elements[$key]);
  133. }
  134. }
  135.  
  136. foreach ($head_elements as $key => $element) {
  137. if (isset($element['#attributes']['rel']) && $element['#attributes']['rel'] == 'canonical') {
  138. unset($head_elements[$key]);
  139. }
  140. }
  141.  
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement