1
|
<?php
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11
|
function mayo_build_columns($columns) {
|
12
|
$styles = array();
|
13
|
$num_columns = 0;
|
14
|
$first = -1;
|
15
|
|
16
|
for ($i = 0 ; $i < 4 ; $i++) {
|
17
|
if ($columns[$i]) {
|
18
|
if ($first == -1) $first = $i;
|
19
|
$last = $i;
|
20
|
$num_columns++;
|
21
|
}
|
22
|
}
|
23
|
if (!$num_columns) return '';
|
24
|
|
25
|
$out = '';
|
26
|
$out .= '<div class="column-blocks clearfix">';
|
27
|
|
28
|
$column_width = round(100 / $num_columns, 2) . '%';
|
29
|
|
30
|
for ($i = 0 ; $i < 4 ; $i++) {
|
31
|
if ($columns[$i]) {
|
32
|
if ($i == $first) {
|
33
|
$margin_left_style = 'margin-left: 0px;';
|
34
|
}
|
35
|
else {
|
36
|
$margin_left_style = 'margin-left: 5px;';
|
37
|
}
|
38
|
if ($i == $last) {
|
39
|
$margin_right_style = 'margin-right: 0px;';
|
40
|
}
|
41
|
else {
|
42
|
$margin_right_style = 'margin-right: 5px;';
|
43
|
}
|
44
|
$style = $margin_left_style . $margin_right_style;
|
45
|
|
46
|
$out .= '<div class="column-block-wrapper" style="width: ' . $column_width . ';">';
|
47
|
$out .= '<div class="column-block" style="' . $style . '">';
|
48
|
$out .= render($columns[$i]);
|
49
|
$out .= '</div></div> <!--/.column-block --><!--/.column-block-wrapper-->';
|
50
|
}
|
51
|
}
|
52
|
$out .= '</div> <!--/.column-blocks-->';
|
53
|
$out .= '<div class="spacer clearfix cfie"></div>';
|
54
|
return $out;
|
55
|
}
|
56
|
|
57
|
|
58
|
|
59
|
|
60
|
function mayo_get_margins($content, $sb_first, $sb_second) {
|
61
|
$sb_layout_style = theme_get_setting('sidebar_layout_style');
|
62
|
|
63
|
$c_margin_l = $sf_margin_l = $ss_margin_l = 5;
|
64
|
$c_margin_r = $sf_margin_r = $ss_margin_r = 5;
|
65
|
|
66
|
switch($sb_layout_style) {
|
67
|
case 1:
|
68
|
if ($sb_first) {
|
69
|
$sf_margin_l = 0;
|
70
|
}
|
71
|
else {
|
72
|
$c_margin_l = 0;
|
73
|
}
|
74
|
if ($sb_second) {
|
75
|
$ss_margin_r = 0;
|
76
|
}
|
77
|
else {
|
78
|
$c_margin_r = 0;
|
79
|
}
|
80
|
break;
|
81
|
case 2:
|
82
|
if ($sb_first) {
|
83
|
$sf_margin_l = 0;
|
84
|
}
|
85
|
else if ($sb_second) {
|
86
|
$ss_margin_l = 0;
|
87
|
}
|
88
|
else {
|
89
|
$c_margin_l = 0;
|
90
|
}
|
91
|
$c_margin_r = 0;
|
92
|
break;
|
93
|
case 3:
|
94
|
if ($sb_second) {
|
95
|
$ss_margin_r = 0;
|
96
|
}
|
97
|
else if ($sb_first) {
|
98
|
$sf_margin_r = 0;
|
99
|
}
|
100
|
else {
|
101
|
$c_margin_r = 0;
|
102
|
}
|
103
|
$c_margin_l = 0;
|
104
|
break;
|
105
|
}
|
106
|
$c_margin_style = 'margin-left: ' . $c_margin_l . 'px; margin-right: ' . $c_margin_r . 'px;';
|
107
|
$sf_margin_style = 'margin-left: ' . $sf_margin_l . 'px; margin-right: ' . $sf_margin_r . 'px;';
|
108
|
$ss_margin_style = 'margin-left: ' . $ss_margin_l . 'px; margin-right: ' . $ss_margin_r . 'px;';
|
109
|
|
110
|
return array(
|
111
|
'content' => $c_margin_style,
|
112
|
'sb_first' => $sf_margin_style,
|
113
|
'sb_second' => $ss_margin_style,
|
114
|
);
|
115
|
}
|
116
|
|
117
|
|
118
|
|
119
|
|
120
|
|
121
|
|
122
|
|
123
|
|
124
|
|
125
|
function mayo_breadcrumb($variables) {
|
126
|
$breadcrumb = $variables['breadcrumb'];
|
127
|
|
128
|
|
129
|
if (is_array($breadcrumb)) {
|
130
|
array_shift($breadcrumb);
|
131
|
}
|
132
|
if (!empty($breadcrumb)) {
|
133
|
$breadcrumb_separator = ' > ';
|
134
|
$breadcrumb_str = implode($breadcrumb_separator, $breadcrumb);
|
135
|
$breadcrumb_str .= $breadcrumb_separator;
|
136
|
$out = '<div class="breadcrumb">' . $breadcrumb_str . '</div>';
|
137
|
return $out;
|
138
|
}
|
139
|
return '';
|
140
|
}
|
141
|
|
142
|
|
143
|
|
144
|
|
145
|
|
146
|
|
147
|
function mayo_preprocess_search_block_form(&$variables) {
|
148
|
$prompt = t('search this site');
|
149
|
$variables['search'] = array();
|
150
|
$hidden = array();
|
151
|
|
152
|
unset($variables['form']['actions']['submit']);
|
153
|
unset($variables['form']['actions']['#children']);
|
154
|
|
155
|
$variables['form']['search_block_form']['#value'] = $prompt;
|
156
|
$variables['form']['search_block_form']['#size'] = theme_get_setting('searchbox_size');
|
157
|
$variables['form']['search_block_form']['#attributes'] = array(
|
158
|
'onblur' => "if (this.value == '') { this.value = '$prompt'; }",
|
159
|
'onfocus' => "if (this.value == '$prompt') { this.value = ''; }" );
|
160
|
|
161
|
|
162
|
foreach (element_children($variables['form']) as $key) {
|
163
|
$type = $variables['form'][$key]['#type'];
|
164
|
if ($type == 'hidden' || $type == 'token') {
|
165
|
$hidden[] = render($variables['form'][$key]);
|
166
|
}
|
167
|
else {
|
168
|
$variables['search'][$key] = render($variables['form'][$key]);
|
169
|
}
|
170
|
}
|
171
|
$variables['search']['hidden'] = implode($hidden);
|
172
|
$variables['search_form'] = implode($variables['search']);
|
173
|
}
|
174
|
|
175
|
|
176
|
|
177
|
|
178
|
function mayo_process_page(&$variables) {
|
179
|
|
180
|
if (module_exists('color')) {
|
181
|
_color_page_alter($variables);
|
182
|
}
|
183
|
}
|
184
|
|
185
|
|
186
|
|
187
|
|
188
|
function mayo_preprocess_maintenance_page(&$variables) {
|
189
|
drupal_add_css(drupal_get_path('theme', 'mayo') . '/css/maintenance-page.css');
|
190
|
}
|
191
|
|
192
|
|
193
|
|
194
|
|
195
|
function mayo_preprocess_html(&$variables) {
|
196
|
|
197
|
|
198
|
drupal_add_css(path_to_theme() . '/css/ie8.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
|
199
|
drupal_add_css(path_to_theme() . '/css/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => ' IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
|
200
|
drupal_add_css(path_to_theme() . '/css/ie6.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 6', '!IE' => FALSE), 'preprocess' => FALSE));
|
201
|
|
202
|
$options = array(
|
203
|
'type' => 'file',
|
204
|
'group' => CSS_THEME,
|
205
|
'weight' => 10,
|
206
|
);
|
207
|
|
208
|
|
209
|
|
210
|
if (theme_get_setting('dark_messages')) {
|
211
|
|
212
|
drupal_add_css(drupal_get_path('theme', 'mayo') . '/css/dark.css', $options);
|
213
|
}
|
214
|
|
215
|
$round_corners = theme_get_setting('round_corners');
|
216
|
if ($round_corners == 1 || $round_corners == 3) {
|
217
|
drupal_add_css(drupal_get_path('theme', 'mayo') . '/css/round-sidebar.css', $options);
|
218
|
}
|
219
|
if ($round_corners == 2 || $round_corners == 3) {
|
220
|
drupal_add_css(drupal_get_path('theme', 'mayo') . '/css/round-node.css', $options);
|
221
|
}
|
222
|
|
223
|
if (theme_get_setting('menubar_style') == 2) {
|
224
|
drupal_add_css(drupal_get_path('theme', 'mayo') . '/css/black-menu.css', $options);
|
225
|
}
|
226
|
|
227
|
$options = array(
|
228
|
'type' => 'inline',
|
229
|
'group' => CSS_THEME,
|
230
|
'weight' => 10,
|
231
|
);
|
232
|
|
233
|
|
234
|
|
235
|
|
236
|
|
237
|
|
238
|
|
239
|
$font_family = array(
|
240
|
|
241
|
0 => "font-family: Georgia, 'Palatino Linotype', 'Book Antiqua', 'URW Palladio L', Baskerville, Meiryo, 'Hiragino Mincho Pro', 'MS PMincho', serif; ",
|
242
|
1 => "font-family: Verdana, Geneva, Arial, 'Bitstream Vera Sans', 'DejaVu Sans', Meiryo, 'Hiragino Kaku Gothic Pro', 'MS PGothic', Osaka, sans-serif; ",
|
243
|
);
|
244
|
|
245
|
|
246
|
$base_font_size = theme_get_setting('base_font_size');
|
247
|
$style = 'font-size: ' . $base_font_size . '; ';
|
248
|
$base_font_family = theme_get_setting('base_font_family');
|
249
|
if ($base_font_family == 2) {
|
250
|
$style .= 'font-family: ' . theme_get_setting('base_custom_font_family') . ';';
|
251
|
}
|
252
|
else {
|
253
|
$style .= $font_family[$base_font_family];
|
254
|
}
|
255
|
drupal_add_css("body {" . $style . "}", $options);
|
256
|
|
257
|
$heading_font_family = theme_get_setting('heading_font_family');
|
258
|
if ($heading_font_family == 2) {
|
259
|
$style .= 'font-family: ' . theme_get_setting('heading_custom_font_family') . ';';
|
260
|
}
|
261
|
else {
|
262
|
$style = $font_family[$heading_font_family];
|
263
|
}
|
264
|
drupal_add_css("h1,h2,h3,h4,h5 {" . $style . "}", $options);
|
265
|
|
266
|
if ($heading_font_family == 1) {
|
267
|
|
268
|
drupal_add_css(".sidebar h2 { font-size: 1.2em; }", $options);
|
269
|
drupal_add_css("#content .node h2 { font-size: 1.4em; }", $options);
|
270
|
}
|
271
|
}
|
272
|
|
273
|
|
274
|
|
275
|
|
276
|
function mayo_process_html(&$variables) {
|
277
|
|
278
|
if (module_exists('color')) {
|
279
|
_color_html_alter($variables);
|
280
|
}
|
281
|
}
|