| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
function phptemplate_body_class($sidebar_left, $sidebar_right) {
|
| 5 |
if ($sidebar_left != '' && $sidebar_right != '') {
|
| 6 |
$class = 'sidebars';
|
| 7 |
}
|
| 8 |
else {
|
| 9 |
if ($sidebar_left != '') {
|
| 10 |
$class = 'sidebar-left';
|
| 11 |
}
|
| 12 |
if ($sidebar_right != '') {
|
| 13 |
$class = 'sidebar-right';
|
| 14 |
}
|
| 15 |
}
|
| 16 |
|
| 17 |
if (isset($class)) {
|
| 18 |
print ' class="'. $class .'"';
|
| 19 |
}
|
| 20 |
}
|
| 21 |
|
| 22 |
if (is_null(theme_get_setting('litejazz_style'))) {
|
| 23 |
global $theme_key;
|
| 24 |
// Save default theme settings
|
| 25 |
$defaults = array(
|
| 26 |
'litejazz_style' => 0,
|
| 27 |
'litejazz_width' => 0,
|
| 28 |
'litejazz_fixedwidth' => '850',
|
| 29 |
'litejazz_breadcrumb' => 0,
|
| 30 |
'litejazz_iepngfix' => 0,
|
| 31 |
'litejazz_themelogo' => 0,
|
| 32 |
'litejazz_fontfamily' => 0,
|
| 33 |
'litejazz_customfont' => '',
|
| 34 |
'litejazz_uselocalcontent' => 0,
|
| 35 |
'litejazz_localcontentfile' => '',
|
| 36 |
'litejazz_leftsidebarwidth' => '210',
|
| 37 |
'litejazz_rightsidebarwidth' => '210',
|
| 38 |
'litejazz_suckerfish' => 0,
|
| 39 |
'litejazz_usecustomlogosize' => 0,
|
| 40 |
'litejazz_logowidth' => '100',
|
| 41 |
'litejazz_logoheight' => '100',
|
| 42 |
);
|
| 43 |
|
| 44 |
variable_set(
|
| 45 |
str_replace('/', '_', 'theme_'. $theme_key .'_settings'),
|
| 46 |
array_merge(theme_get_settings($theme_key), $defaults)
|
| 47 |
);
|
| 48 |
// Force refresh of Drupal internals
|
| 49 |
theme_get_setting('', TRUE);
|
| 50 |
}
|
| 51 |
|
| 52 |
function litejazz_regions() {
|
| 53 |
return array(
|
| 54 |
'sidebar_left' => t('left sidebar'),
|
| 55 |
'sidebar_right' => t('right sidebar'),
|
| 56 |
'content_top' => t('content top'),
|
| 57 |
'content_bottom' => t('content bottom'),
|
| 58 |
'header' => t('header'),
|
| 59 |
'suckerfish' => t('suckerfish menu'),
|
| 60 |
'user1' => t('user1'),
|
| 61 |
'user2' => t('user2'),
|
| 62 |
'user3' => t('user3'),
|
| 63 |
'user4' => t('user4'),
|
| 64 |
'user5' => t('user5'),
|
| 65 |
'user6' => t('user6'),
|
| 66 |
'footer_region' => t('footer')
|
| 67 |
);
|
| 68 |
}
|
| 69 |
|
| 70 |
function get_litejazz_style() {
|
| 71 |
$style = theme_get_setting('litejazz_style');
|
| 72 |
if (!$style) {
|
| 73 |
$style = 'blue';
|
| 74 |
}
|
| 75 |
if (isset($_COOKIE["litejazzstyle"])) {
|
| 76 |
$style = $_COOKIE["litejazzstyle"];
|
| 77 |
}
|
| 78 |
return $style;
|
| 79 |
}
|
| 80 |
|
| 81 |
$style = get_litejazz_style();
|
| 82 |
drupal_add_css(drupal_get_path('theme', 'litejazz') .'/css/'. $style .'.css', 'theme');
|
| 83 |
|
| 84 |
if (theme_get_setting('litejazz_iepngfix')) {
|
| 85 |
drupal_add_js(drupal_get_path('theme', 'litejazz') .'/js/jquery.pngFix.js', 'theme');
|
| 86 |
}
|
| 87 |
|
| 88 |
function _phptemplate_variables($hook, $vars) {
|
| 89 |
if (module_exists('advanced_profile')) {
|
| 90 |
$vars = advanced_profile_addvars($hook, $vars);
|
| 91 |
}
|
| 92 |
if (module_exists('advanced_forum')) {
|
| 93 |
$vars = advanced_forum_addvars($hook, $vars);
|
| 94 |
}
|
| 95 |
if (theme_get_setting('litejazz_themelogo')) {
|
| 96 |
$vars['logo'] = base_path() . path_to_theme() .'/images/'. theme_get_setting('litejazz_style') .'/logo.png';
|
| 97 |
}
|
| 98 |
if ($hook == 'page') {
|
| 99 |
if (module_exists('page_title')) {
|
| 100 |
$vars['head_title'] = page_title_page_get_title();
|
| 101 |
}
|
| 102 |
}
|
| 103 |
return $vars;
|
| 104 |
}
|
| 105 |
|
| 106 |
|
| 107 |
function litejazz_block($block) {
|
| 108 |
if (module_exists('blocktheme')) {
|
| 109 |
if ( $custom_theme = blocktheme_get_theme($block) ) {
|
| 110 |
return _phptemplate_callback($custom_theme, array('block' => $block));
|
| 111 |
}
|
| 112 |
}
|
| 113 |
return phptemplate_block($block);
|
| 114 |
}
|
| 115 |
|
| 116 |
if (theme_get_setting('litejazz_suckerfish')) {
|
| 117 |
drupal_add_css(drupal_get_path('theme', 'litejazz') .'/css/suckerfish_'. $style .'.css', 'theme');
|
| 118 |
}
|
| 119 |
|
| 120 |
if (theme_get_setting('litejazz_uselocalcontent')) {
|
| 121 |
$local_content = drupal_get_path('theme', 'litejazz') .'/'. theme_get_setting('litejazz_localcontentfile');
|
| 122 |
if (file_exists($local_content)) {
|
| 123 |
drupal_add_css($local_content, 'theme');
|
| 124 |
}
|
| 125 |
}
|
| 126 |
|
| 127 |
function phptemplate_menu_links($links, $attributes = array()) {
|
| 128 |
|
| 129 |
if (!count($links)) {
|
| 130 |
return '';
|
| 131 |
}
|
| 132 |
$level_tmp = explode('-', key($links));
|
| 133 |
$level = $level_tmp[0];
|
| 134 |
$output = "<ul class=\"links-$level ". $attributes['class'] ."\" id=\"". $attributes['id'] ."\">\n";
|
| 135 |
|
| 136 |
$num_links = count($links);
|
| 137 |
$i = 1;
|
| 138 |
|
| 139 |
foreach ($links as $index => $link) {
|
| 140 |
$output .= '<li';
|
| 141 |
$output .= ' class="';
|
| 142 |
if (stristr($index, 'active')) {
|
| 143 |
$output .= 'active';
|
| 144 |
}// frontpage AND current-link in menu is <front>
|
| 145 |
elseif ((drupal_is_front_page()) && ($link['href']=='<front>')) {
|
| 146 |
$link['attributes']['class'] = 'active';//add class active to <li
|
| 147 |
$output .= 'active';//add class active to <a
|
| 148 |
}
|
| 149 |
if ($i == 1) {
|
| 150 |
$output .= ' first'; }
|
| 151 |
if ($i == $num_links) {
|
| 152 |
$output .= ' last'; }
|
| 153 |
$output .= '"';
|
| 154 |
$output .= ">". l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']) ."</li>\n";
|
| 155 |
$i++;
|
| 156 |
}
|
| 157 |
$output .= '</ul>';
|
| 158 |
return $output;
|
| 159 |
}
|
| 160 |
|