1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
function busy_process_html(&$vars) {
|
8 |
|
|
|
9 |
|
|
if (module_exists('color')) {
|
10 |
|
|
_color_html_alter($vars);
|
11 |
|
|
}
|
12 |
|
|
}
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
function busy_preprocess_html(&$variables) {
|
17 |
|
|
|
18 |
|
|
drupal_add_css(path_to_theme() . '/css/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
|
19 |
|
|
}
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
function busy_process_page(&$vars) {
|
25 |
|
|
|
26 |
|
|
if (module_exists('color')) {
|
27 |
|
|
_color_page_alter($vars);
|
28 |
|
|
}
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
function busy_preprocess_page(&$vars) {
|
35 |
|
|
|
36 |
|
|
$site_fields = array();
|
37 |
|
|
if (!empty($vars['site_name'])) {
|
38 |
|
|
$site_fields[] = check_plain($vars['site_name']);
|
39 |
|
|
}
|
40 |
|
|
if (!empty($vars['site_slogan'])) {
|
41 |
|
|
$site_fields[] = check_plain($vars['site_slogan']);
|
42 |
|
|
}
|
43 |
|
|
$vars['site_title'] = implode(' ', $site_fields);
|
44 |
|
|
if (!empty($site_fields)) {
|
45 |
|
|
$site_fields[0] = '<span>' . $site_fields[0] . '</span>';
|
46 |
|
|
}
|
47 |
|
|
$vars['site_html'] = implode(' ', $site_fields);
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
$slogan_text = filter_xss_admin(variable_get('site_slogan', ''));
|
51 |
|
|
$site_name_text = filter_xss_admin(variable_get('site_name', 'Drupal'));
|
52 |
|
|
$vars['site_name_and_slogan'] = $site_name_text . ' ' . $slogan_text;
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
function busy_preprocess_node(&$vars) {
|
59 |
|
|
if ($vars['page'] && isset($vars['content']['links']['comment']) && ($vars['comment_count'] > 0)) {
|
60 |
|
|
if (isset($vars['content']['links']['comment']['#links']['comment_add'])) {
|
61 |
|
|
$vars['content']['links']['comment']['#links']['comments_count'] = $vars['content']['links']['comment']['#links']['comment_add'];
|
62 |
|
|
}
|
63 |
|
|
$vars['content']['links']['comment']['#links']['comments_count']['title'] = t('@num_comments', array('@num_comments' => format_plural($vars['comment_count'], '1 comment', '@count comments')));
|
64 |
|
|
$vars['content']['links']['comment']['#links']['comments_count']['attributes'] = array();
|
65 |
|
|
}
|
66 |
|
|
if (theme_get_setting('toggle_node_user_picture', 'busy') && $vars['picture']) {
|
67 |
|
|
$vars['classes_array'][] = 'has-author-picture';
|
68 |
|
|
}
|
69 |
|
|
}
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
function busy_preprocess_comment(&$vars) {
|
77 |
|
|
if (theme_get_setting('toggle_comment_user_picture', 'busy') && $vars['picture']) {
|
78 |
|
|
$vars['classes_array'][] = 'has-author-picture';
|
79 |
|
|
}
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
function busy_menu_local_task($variables) {
|
86 |
|
|
$link = $variables['element']['#link'];
|
87 |
|
|
$link_text = $link['title'];
|
88 |
|
|
|
89 |
|
|
if (!empty($variables['element']['#active'])) {
|
90 |
|
|
|
91 |
|
|
$active = '<span class="element-invisible">' . t('(active tab)') . '</span>';
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
if (empty($link['localized_options']['html'])) {
|
96 |
|
|
$link['title'] = check_plain($link['title']);
|
97 |
|
|
}
|
98 |
|
|
$link['localized_options']['html'] = TRUE;
|
99 |
|
|
$link_text = t('!local-task-title !active', array('!local-task-title' => $link['title'], '!active' => $active));
|
100 |
|
|
}
|
101 |
|
|
|
102 |
|
|
$link_classes = array();
|
103 |
|
|
if (!empty($variables['element']['#active'])) {
|
104 |
|
|
$link_classes[] = 'active';
|
105 |
|
|
}
|
106 |
|
|
if (!empty($variables['element']['#last'])) {
|
107 |
|
|
$link_classes[] = 'last';
|
108 |
|
|
}
|
109 |
|
|
return '<li' . ($link_classes ? ' class="' . implode(' ', $link_classes) . '"' : '') . '>' . l($link_text, $link['href'], $link['localized_options']) . "</li>\n";
|
110 |
|
|
}
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
function busy_pager($variables) {
|
134 |
|
|
$tags = $variables['tags'];
|
135 |
|
|
$element = $variables['element'];
|
136 |
|
|
$parameters = array();
|
137 |
|
|
if (isset($variables['parameters']) && !is_array($variables['parameters'])) {
|
138 |
|
|
$parameters = array($variables['parameters']);
|
139 |
|
|
}
|
140 |
|
|
$quantity = $variables['quantity'];
|
141 |
|
|
global $pager_page_array, $pager_total;
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
$pager_middle = ceil($quantity / 2);
|
146 |
|
|
|
147 |
|
|
$pager_current = $pager_page_array[$element] + 1;
|
148 |
|
|
|
149 |
|
|
$pager_first = $pager_current - $pager_middle + 1;
|
150 |
|
|
|
151 |
|
|
$pager_last = $pager_current + $quantity - $pager_middle;
|
152 |
|
|
|
153 |
|
|
$pager_max = $pager_total[$element];
|
154 |
|
|
|
155 |
|
|
|
156 |
|
|
|
157 |
|
|
$i = $pager_first;
|
158 |
|
|
if ($pager_last > $pager_max) {
|
159 |
|
|
|
160 |
|
|
$i = $i + ($pager_max - $pager_last);
|
161 |
|
|
$pager_last = $pager_max;
|
162 |
|
|
}
|
163 |
|
|
if ($i <= 0) {
|
164 |
|
|
|
165 |
|
|
$pager_last = $pager_last + (1 - $i);
|
166 |
|
|
$i = 1;
|
167 |
|
|
}
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
$parameters_wrap = array_merge($parameters, array('wrap' => TRUE));
|
171 |
|
|
$li_first = theme('pager_first', array('text' => (isset($tags[0]) ? $tags[0] : t('« first')), 'element' => $element, 'parameters' => $parameters_wrap));
|
172 |
|
|
$li_previous = theme('pager_previous', array('text' => (isset($tags[1]) ? $tags[1] : t('previous')), 'element' => $element, 'interval' => 1, 'parameters' => $parameters_wrap));
|
173 |
|
|
$li_next = theme('pager_next', array('text' => (isset($tags[3]) ? $tags[3] : t('next')), 'element' => $element, 'interval' => 1, 'parameters' => $parameters_wrap));
|
174 |
|
|
$li_last = theme('pager_last', array('text' => (isset($tags[4]) ? $tags[4] : t('last »')), 'element' => $element, 'parameters' => $parameters_wrap));
|
175 |
|
|
|
176 |
|
|
if ($pager_total[$element] > 1) {
|
177 |
|
|
|
178 |
|
|
if ($i != $pager_max) {
|
179 |
|
|
|
180 |
|
|
for (; $i <= $pager_last && $i <= $pager_max; $i++) {
|
181 |
|
|
if ($i < $pager_current) {
|
182 |
|
|
$items[] = array(
|
183 |
|
|
'class' => array('pager-item'),
|
184 |
|
|
'data' => theme('pager_previous', array('text' => $i, 'element' => $element, 'interval' => ($pager_current - $i), 'parameters' => $parameters)),
|
185 |
|
|
);
|
186 |
|
|
}
|
187 |
|
|
if ($i == $pager_current) {
|
188 |
|
|
$items[] = array(
|
189 |
|
|
'class' => array('pager-current'),
|
190 |
|
|
'data' => $i,
|
191 |
|
|
);
|
192 |
|
|
}
|
193 |
|
|
if ($i > $pager_current) {
|
194 |
|
|
$items[] = array(
|
195 |
|
|
'class' => array('pager-item'),
|
196 |
|
|
'data' => theme('pager_next', array('text' => $i, 'element' => $element, 'interval' => ($i - $pager_current), 'parameters' => $parameters)),
|
197 |
|
|
);
|
198 |
|
|
}
|
199 |
|
|
}
|
200 |
|
|
}
|
201 |
|
|
if ($li_first) {
|
202 |
|
|
$items[] = array(
|
203 |
|
|
'class' => array('pager-first'),
|
204 |
|
|
'data' => $li_first,
|
205 |
|
|
);
|
206 |
|
|
}
|
207 |
|
|
if ($li_previous) {
|
208 |
|
|
$items[] = array(
|
209 |
|
|
'class' => array('pager-previous'),
|
210 |
|
|
'data' => $li_previous,
|
211 |
|
|
);
|
212 |
|
|
}
|
213 |
|
|
|
214 |
|
|
if ($li_next) {
|
215 |
|
|
$items[] = array(
|
216 |
|
|
'class' => array('pager-next'),
|
217 |
|
|
'data' => $li_next,
|
218 |
|
|
);
|
219 |
|
|
}
|
220 |
|
|
if ($li_last) {
|
221 |
|
|
$items[] = array(
|
222 |
|
|
'class' => array('pager-last'),
|
223 |
|
|
'data' => $li_last,
|
224 |
|
|
);
|
225 |
|
|
}
|
226 |
|
|
return '<h2 class="element-invisible">' . t('Pages') . '</h2>' . theme('item_list', array('items' => $items, 'title' => NULL, 'type' => 'ul', 'attributes' => array('class' => array('pager', 'clearfix'))));
|
227 |
|
|
}
|
228 |
|
|
}
|
229 |
|
|
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
|
233 |
|
|
function busy_pager_link($variables) {
|
234 |
|
|
$text = $variables['text'];
|
235 |
|
|
$page_new = $variables['page_new'];
|
236 |
|
|
$element = $variables['element'];
|
237 |
|
|
$parameters = $variables['parameters'];
|
238 |
|
|
$wrap_title = isset($parameters['wrap']) ? $parameters['wrap'] : FALSE;
|
239 |
|
|
$attributes = $variables['attributes'];
|
240 |
|
|
unset($parameters['wrap']);
|
241 |
|
|
|
242 |
|
|
$page = isset($_GET['page']) ? $_GET['page'] : '';
|
243 |
|
|
if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) {
|
244 |
|
|
$parameters['page'] = $new_page;
|
245 |
|
|
}
|
246 |
|
|
|
247 |
|
|
$query = array();
|
248 |
|
|
if (count($parameters)) {
|
249 |
|
|
$query = drupal_get_query_parameters($parameters, array());
|
250 |
|
|
}
|
251 |
|
|
if ($query_pager = pager_get_query_parameters()) {
|
252 |
|
|
$query = array_merge($query, $query_pager);
|
253 |
|
|
}
|
254 |
|
|
|
255 |
|
|
|
256 |
|
|
if (!isset($attributes['title'])) {
|
257 |
|
|
static $titles = NULL;
|
258 |
|
|
if (!isset($titles)) {
|
259 |
|
|
$titles = array(
|
260 |
|
|
t('« first') => t('Go to first page'),
|
261 |
|
|
t('‹ previous') => t('Go to previous page'),
|
262 |
|
|
t('next ›') => t('Go to next page'),
|
263 |
|
|
t('last »') => t('Go to last page'),
|
264 |
|
|
);
|
265 |
|
|
}
|
266 |
|
|
if (isset($titles[$text])) {
|
267 |
|
|
$attributes['title'] = $titles[$text];
|
268 |
|
|
}
|
269 |
|
|
elseif (is_numeric($text)) {
|
270 |
|
|
$attributes['title'] = t('Go to page @number', array('@number' => $text));
|
271 |
|
|
}
|
272 |
|
|
}
|
273 |
|
|
if ($wrap_title) {
|
274 |
|
|
$text = '<span>' . $text . '</span>';
|
275 |
|
|
}
|
276 |
|
|
|
277 |
|
|
return l($text, $_GET['q'], array('attributes' => $attributes, 'query' => $query, 'html' => $wrap_title));
|
278 |
|
|
}
|
279 |
|
|
|
280 |
|
|
|
281 |
|
|
|
282 |
|
|
|
283 |
|
|
|
284 |
|
|
|
285 |
|
|
function busy_fieldset($variables) {
|
286 |
|
|
$element = $variables['element'];
|
287 |
|
|
element_set_attributes($element, array('id'));
|
288 |
|
|
_form_set_class($element, array('form-wrapper'));
|
289 |
|
|
|
290 |
|
|
$output = '<fieldset' . drupal_attributes($element['#attributes']) . '>';
|
291 |
|
|
if (!empty($element['#title'])) {
|
292 |
|
|
|
293 |
|
|
$output .= '<legend><span class="fieldset-legend">' . $element['#title'] . '</span></legend>';
|
294 |
|
|
}
|
295 |
|
|
$output .= '<div class="fieldset-wrapper clearfix">';
|
296 |
|
|
if (!empty($element['#description'])) {
|
297 |
|
|
$output .= '<div class="fieldset-description">' . $element['#description'] . '</div>';
|
298 |
|
|
}
|
299 |
|
|
$output .= $element['#children'];
|
300 |
|
|
if (isset($element['#value'])) {
|
301 |
|
|
$output .= $element['#value'];
|
302 |
|
|
}
|
303 |
|
|
$output .= '</div>';
|
304 |
|
|
$output .= "</fieldset>\n";
|
305 |
|
|
return $output;
|
306 |
|
|
} |