@@ -14,26 +14,26 @@ |
||
| 14 | 14 | * If the user is silly and enables Zen as the theme, manually add some stylesheets. |
| 15 | 15 | */ |
| 16 | 16 | function _zen_preprocess_page(&$vars, $hook) { |
| 17 | - $directory = _zen_path() . '/zen-internals/css'; |
|
| 17 | + $directory = _zen_path() . '/zen-internals/css'; |
|
| 18 | 18 | |
| 19 | - // Add default styles. |
|
| 20 | - if (theme_get_setting('zen_layout') == 'zen-columns-fixed') { |
|
| 19 | + // Add default styles. |
|
| 20 | + if (theme_get_setting('zen_layout') == 'zen-columns-fixed') { |
|
| 21 | 21 | drupal_add_css($directory . '/zen-fixed.css', 'theme', 'all'); |
| 22 | - } |
|
| 23 | - else { |
|
| 22 | + } |
|
| 23 | + else { |
|
| 24 | 24 | drupal_add_css($directory . '/zen-liquid.css', 'theme', 'all'); |
| 25 | - } |
|
| 26 | - // Add print styles. |
|
| 27 | - drupal_add_css($directory . '/print.css', 'theme', 'print'); |
|
| 25 | + } |
|
| 26 | + // Add print styles. |
|
| 27 | + drupal_add_css($directory . '/print.css', 'theme', 'print'); |
|
| 28 | 28 | |
| 29 | - // Regenerate the stylesheets. |
|
| 30 | - $vars['css'] = drupal_add_css(); |
|
| 31 | - $vars['styles'] = drupal_get_css(); |
|
| 29 | + // Regenerate the stylesheets. |
|
| 30 | + $vars['css'] = drupal_add_css(); |
|
| 31 | + $vars['styles'] = drupal_get_css(); |
|
| 32 | 32 | |
| 33 | - // Add IE styles. |
|
| 34 | - $query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1); |
|
| 35 | - $base_path = base_path() . $directory; |
|
| 36 | - $vars['styles'] .= <<< IE_STYLES |
|
| 33 | + // Add IE styles. |
|
| 34 | + $query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1); |
|
| 35 | + $base_path = base_path() . $directory; |
|
| 36 | + $vars['styles'] .= <<< IE_STYLES |
|
| 37 | 37 | <!--[if IE]><link type="text/css" rel="stylesheet" media="all" href="$base_path/ie.css$query_string" /><![endif]--> |
| 38 | 38 | <!--[if lte IE 6]><link type="text/css" rel="stylesheet" media="all" href="$base_path/ie6.css$query_string" /><![endif]--> |
| 39 | 39 | |
@@ -13,46 +13,46 @@ |
||
| 13 | 13 | * The name of the template being rendered ("comment" in this case.) |
| 14 | 14 | */ |
| 15 | 15 | function _zen_preprocess_comment(&$vars, $hook) { |
| 16 | - // In Drupal 7, $date has been renamed to $created. |
|
| 17 | - $vars['created'] = $vars['date']; |
|
| 16 | + // In Drupal 7, $date has been renamed to $created. |
|
| 17 | + $vars['created'] = $vars['date']; |
|
| 18 | 18 | |
| 19 | - // If comment subjects are disabled, don't display them. |
|
| 20 | - if (variable_get('comment_subject_field_' . $vars['node']->type, 1) == 0) { |
|
| 19 | + // If comment subjects are disabled, don't display them. |
|
| 20 | + if (variable_get('comment_subject_field_' . $vars['node']->type, 1) == 0) { |
|
| 21 | 21 | $vars['title'] = ''; |
| 22 | - } |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - // New comment. |
|
| 25 | - if ($vars['comment']->new) { |
|
| 24 | + // New comment. |
|
| 25 | + if ($vars['comment']->new) { |
|
| 26 | 26 | $vars['classes_array'][] = 'comment-new'; |
| 27 | - } |
|
| 28 | - // Add an "unpublished" flag. |
|
| 29 | - if ($vars['comment']->status == COMMENT_NOT_PUBLISHED) { |
|
| 27 | + } |
|
| 28 | + // Add an "unpublished" flag. |
|
| 29 | + if ($vars['comment']->status == COMMENT_NOT_PUBLISHED) { |
|
| 30 | 30 | $vars['unpublished'] = TRUE; |
| 31 | 31 | $vars['classes_array'][] = $vars['status']; |
| 32 | - } |
|
| 33 | - else { |
|
| 32 | + } |
|
| 33 | + else { |
|
| 34 | 34 | $vars['unpublished'] = FALSE; |
| 35 | - } |
|
| 36 | - // Zebra striping. |
|
| 37 | - if ($vars['id'] == 1) { |
|
| 35 | + } |
|
| 36 | + // Zebra striping. |
|
| 37 | + if ($vars['id'] == 1) { |
|
| 38 | 38 | $vars['classes_array'][] = 'first'; |
| 39 | - } |
|
| 40 | - if ($vars['id'] == $vars['node']->comment_count) { |
|
| 39 | + } |
|
| 40 | + if ($vars['id'] == $vars['node']->comment_count) { |
|
| 41 | 41 | $vars['classes_array'][] = 'last'; |
| 42 | - } |
|
| 43 | - $vars['classes_array'][] = $vars['zebra']; |
|
| 44 | - if ($vars['comment']->uid == 0) { |
|
| 42 | + } |
|
| 43 | + $vars['classes_array'][] = $vars['zebra']; |
|
| 44 | + if ($vars['comment']->uid == 0) { |
|
| 45 | 45 | // Comment is by an anonymous user. |
| 46 | 46 | $vars['classes_array'][] = 'comment-by-anonymous'; |
| 47 | - } |
|
| 48 | - else { |
|
| 47 | + } |
|
| 48 | + else { |
|
| 49 | 49 | if ($vars['comment']->uid == $vars['node']->uid) { |
| 50 | - // Comment is by the node author. |
|
| 51 | - $vars['classes_array'][] = 'comment-by-node-author'; |
|
| 50 | + // Comment is by the node author. |
|
| 51 | + $vars['classes_array'][] = 'comment-by-node-author'; |
|
| 52 | 52 | } |
| 53 | 53 | if ($vars['comment']->uid == $GLOBALS['user']->uid) { |
| 54 | - // Comment was posted by current user. |
|
| 55 | - $vars['classes_array'][] = 'comment-by-viewer'; |
|
| 54 | + // Comment was posted by current user. |
|
| 55 | + $vars['classes_array'][] = 'comment-by-viewer'; |
|
| 56 | + } |
|
| 56 | 57 | } |
| 57 | - } |
|
| 58 | 58 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | // Auto-rebuild the theme registry during theme development. |
| 15 | 15 | if (theme_get_setting('zen_rebuild_registry')) { |
| 16 | - drupal_rebuild_theme_registry(); |
|
| 16 | + drupal_rebuild_theme_registry(); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | * Implements HOOK_theme(). |
| 22 | 22 | */ |
| 23 | 23 | function zen_theme(&$existing, $type, $theme, $path) { |
| 24 | - // When #341140 is fixed, replace _zen_path() with drupal_get_path(). |
|
| 25 | - include_once './' . _zen_path() . '/zen-internals/template.theme-registry.inc'; |
|
| 26 | - return _zen_theme($existing, $type, $theme, $path); |
|
| 24 | + // When #341140 is fixed, replace _zen_path() with drupal_get_path(). |
|
| 25 | + include_once './' . _zen_path() . '/zen-internals/template.theme-registry.inc'; |
|
| 26 | + return _zen_theme($existing, $type, $theme, $path); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -35,33 +35,33 @@ discard block |
||
| 35 | 35 | * A string containing the breadcrumb output. |
| 36 | 36 | */ |
| 37 | 37 | function zen_breadcrumb($breadcrumb) { |
| 38 | - // Determine if we are to display the breadcrumb. |
|
| 39 | - $show_breadcrumb = theme_get_setting('zen_breadcrumb'); |
|
| 40 | - if ($show_breadcrumb == 'yes' || $show_breadcrumb == 'admin' && arg(0) == 'admin') { |
|
| 38 | + // Determine if we are to display the breadcrumb. |
|
| 39 | + $show_breadcrumb = theme_get_setting('zen_breadcrumb'); |
|
| 40 | + if ($show_breadcrumb == 'yes' || $show_breadcrumb == 'admin' && arg(0) == 'admin') { |
|
| 41 | 41 | |
| 42 | 42 | // Optionally get rid of the homepage link. |
| 43 | 43 | $show_breadcrumb_home = theme_get_setting('zen_breadcrumb_home'); |
| 44 | 44 | if (!$show_breadcrumb_home) { |
| 45 | - array_shift($breadcrumb); |
|
| 45 | + array_shift($breadcrumb); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | // Return the breadcrumb with separators. |
| 49 | 49 | if (!empty($breadcrumb)) { |
| 50 | - $breadcrumb_separator = theme_get_setting('zen_breadcrumb_separator'); |
|
| 51 | - $trailing_separator = $title = ''; |
|
| 52 | - if (theme_get_setting('zen_breadcrumb_title')) { |
|
| 50 | + $breadcrumb_separator = theme_get_setting('zen_breadcrumb_separator'); |
|
| 51 | + $trailing_separator = $title = ''; |
|
| 52 | + if (theme_get_setting('zen_breadcrumb_title')) { |
|
| 53 | 53 | if ($title = drupal_get_title()) { |
| 54 | - $trailing_separator = $breadcrumb_separator; |
|
| 54 | + $trailing_separator = $breadcrumb_separator; |
|
| 55 | 55 | } |
| 56 | - } |
|
| 57 | - elseif (theme_get_setting('zen_breadcrumb_trailing')) { |
|
| 56 | + } |
|
| 57 | + elseif (theme_get_setting('zen_breadcrumb_trailing')) { |
|
| 58 | 58 | $trailing_separator = $breadcrumb_separator; |
| 59 | - } |
|
| 60 | - return '<div class="breadcrumb">' . implode($breadcrumb_separator, $breadcrumb) . "$trailing_separator$title</div>"; |
|
| 59 | + } |
|
| 60 | + return '<div class="breadcrumb">' . implode($breadcrumb_separator, $breadcrumb) . "$trailing_separator$title</div>"; |
|
| 61 | 61 | } |
| 62 | - } |
|
| 63 | - // Otherwise, return an empty string. |
|
| 64 | - return ''; |
|
| 62 | + } |
|
| 63 | + // Otherwise, return an empty string. |
|
| 64 | + return ''; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -90,27 +90,27 @@ discard block |
||
| 90 | 90 | * A string containing an unordered list of links. |
| 91 | 91 | */ |
| 92 | 92 | function zen_links($links, $attributes = array('class' => 'links'), $heading = '') { |
| 93 | - global $language; |
|
| 94 | - $output = ''; |
|
| 93 | + global $language; |
|
| 94 | + $output = ''; |
|
| 95 | 95 | |
| 96 | - if (count($links) > 0) { |
|
| 96 | + if (count($links) > 0) { |
|
| 97 | 97 | // Treat the heading first if it is present to prepend it to the |
| 98 | 98 | // list of links. |
| 99 | 99 | if (!empty($heading)) { |
| 100 | - if (is_string($heading)) { |
|
| 100 | + if (is_string($heading)) { |
|
| 101 | 101 | // Prepare the array that will be used when the passed heading |
| 102 | 102 | // is a string. |
| 103 | 103 | $heading = array( |
| 104 | - 'text' => $heading, |
|
| 105 | - // Set the default level of the heading. |
|
| 106 | - 'level' => 'h2', |
|
| 104 | + 'text' => $heading, |
|
| 105 | + // Set the default level of the heading. |
|
| 106 | + 'level' => 'h2', |
|
| 107 | 107 | ); |
| 108 | - } |
|
| 109 | - $output .= '<' . $heading['level']; |
|
| 110 | - if (!empty($heading['class'])) { |
|
| 108 | + } |
|
| 109 | + $output .= '<' . $heading['level']; |
|
| 110 | + if (!empty($heading['class'])) { |
|
| 111 | 111 | $output .= drupal_attributes(array('class' => $heading['class'])); |
| 112 | - } |
|
| 113 | - $output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>'; |
|
| 112 | + } |
|
| 113 | + $output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>'; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $output .= '<ul'. drupal_attributes($attributes) .'>'; |
@@ -119,89 +119,89 @@ discard block |
||
| 119 | 119 | $i = 1; |
| 120 | 120 | |
| 121 | 121 | foreach ($links as $key => $link) { |
| 122 | - $class = $key; |
|
| 122 | + $class = $key; |
|
| 123 | 123 | |
| 124 | - // Add first, last and active classes to the list of links to help out themers. |
|
| 125 | - if ($i == 1) { |
|
| 124 | + // Add first, last and active classes to the list of links to help out themers. |
|
| 125 | + if ($i == 1) { |
|
| 126 | 126 | $class .= ' first'; |
| 127 | - } |
|
| 128 | - if ($i == $num_links) { |
|
| 127 | + } |
|
| 128 | + if ($i == $num_links) { |
|
| 129 | 129 | $class .= ' last'; |
| 130 | - } |
|
| 131 | - if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page())) |
|
| 130 | + } |
|
| 131 | + if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page())) |
|
| 132 | 132 | && (empty($link['language']) || $link['language']->language == $language->language)) { |
| 133 | 133 | $class .= ' active'; |
| 134 | - } |
|
| 135 | - $output .= '<li'. drupal_attributes(array('class' => $class)) .'>'; |
|
| 134 | + } |
|
| 135 | + $output .= '<li'. drupal_attributes(array('class' => $class)) .'>'; |
|
| 136 | 136 | |
| 137 | - if (isset($link['href'])) { |
|
| 137 | + if (isset($link['href'])) { |
|
| 138 | 138 | // Pass in $link as $options, they share the same keys. |
| 139 | 139 | $output .= l($link['title'], $link['href'], $link); |
| 140 | - } |
|
| 141 | - else if (!empty($link['title'])) { |
|
| 140 | + } |
|
| 141 | + else if (!empty($link['title'])) { |
|
| 142 | 142 | // Some links are actually not links, but we wrap these in <span> for adding title and class attributes |
| 143 | 143 | if (empty($link['html'])) { |
| 144 | - $link['title'] = check_plain($link['title']); |
|
| 144 | + $link['title'] = check_plain($link['title']); |
|
| 145 | 145 | } |
| 146 | 146 | $span_attributes = ''; |
| 147 | 147 | if (isset($link['attributes'])) { |
| 148 | - $span_attributes = drupal_attributes($link['attributes']); |
|
| 148 | + $span_attributes = drupal_attributes($link['attributes']); |
|
| 149 | 149 | } |
| 150 | 150 | $output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>'; |
| 151 | - } |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | - $i++; |
|
| 154 | - $output .= "</li>\n"; |
|
| 153 | + $i++; |
|
| 154 | + $output .= "</li>\n"; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $output .= '</ul>'; |
| 158 | - } |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | - return $output; |
|
| 160 | + return $output; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | 164 | * Implements theme_menu_item_link() |
| 165 | 165 | */ |
| 166 | 166 | function zen_menu_item_link($link) { |
| 167 | - if (empty($link['localized_options'])) { |
|
| 167 | + if (empty($link['localized_options'])) { |
|
| 168 | 168 | $link['localized_options'] = array(); |
| 169 | - } |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - // If an item is a LOCAL TASK, render it as a tab |
|
| 172 | - if ($link['type'] & MENU_IS_LOCAL_TASK) { |
|
| 171 | + // If an item is a LOCAL TASK, render it as a tab |
|
| 172 | + if ($link['type'] & MENU_IS_LOCAL_TASK) { |
|
| 173 | 173 | $link['title'] = '<span class="tab">' . check_plain($link['title']) . '</span>'; |
| 174 | 174 | $link['localized_options']['html'] = TRUE; |
| 175 | - } |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | - return l($link['title'], $link['href'], $link['localized_options']); |
|
| 177 | + return l($link['title'], $link['href'], $link['localized_options']); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
| 181 | 181 | * Duplicate of theme_menu_local_tasks() but adds clearfix to tabs. |
| 182 | 182 | */ |
| 183 | 183 | function zen_menu_local_tasks() { |
| 184 | - $output = ''; |
|
| 184 | + $output = ''; |
|
| 185 | 185 | |
| 186 | - // CTools requires a different set of local task functions. |
|
| 187 | - if (module_exists('ctools')) { |
|
| 186 | + // CTools requires a different set of local task functions. |
|
| 187 | + if (module_exists('ctools')) { |
|
| 188 | 188 | ctools_include('menu'); |
| 189 | 189 | $primary = ctools_menu_primary_local_tasks(); |
| 190 | 190 | $secondary = ctools_menu_secondary_local_tasks(); |
| 191 | - } |
|
| 192 | - else { |
|
| 191 | + } |
|
| 192 | + else { |
|
| 193 | 193 | $primary = menu_primary_local_tasks(); |
| 194 | 194 | $secondary = menu_secondary_local_tasks(); |
| 195 | - } |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | - if ($primary) { |
|
| 197 | + if ($primary) { |
|
| 198 | 198 | $output .= '<ul class="tabs primary clearfix">' . $primary . '</ul>'; |
| 199 | - } |
|
| 200 | - if ($secondary) { |
|
| 199 | + } |
|
| 200 | + if ($secondary) { |
|
| 201 | 201 | $output .= '<ul class="tabs secondary clearfix">' . $secondary . '</ul>'; |
| 202 | - } |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - return $output; |
|
| 204 | + return $output; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -218,32 +218,32 @@ discard block |
||
| 218 | 218 | * @see zen_show_blocks_discovery() |
| 219 | 219 | */ |
| 220 | 220 | function zen_blocks($region, $show_blocks = NULL) { |
| 221 | - // Since Drupal 6 doesn't pass $show_blocks to theme_blocks, we manually call |
|
| 222 | - // theme('blocks', NULL, $show_blocks) so that this function can remember the |
|
| 223 | - // value on later calls. |
|
| 224 | - static $render_sidebars = TRUE; |
|
| 225 | - if (!is_null($show_blocks)) { |
|
| 221 | + // Since Drupal 6 doesn't pass $show_blocks to theme_blocks, we manually call |
|
| 222 | + // theme('blocks', NULL, $show_blocks) so that this function can remember the |
|
| 223 | + // value on later calls. |
|
| 224 | + static $render_sidebars = TRUE; |
|
| 225 | + if (!is_null($show_blocks)) { |
|
| 226 | 226 | $render_sidebars = $show_blocks; |
| 227 | - } |
|
| 227 | + } |
|
| 228 | 228 | |
| 229 | - // If zen_blocks was called with a NULL region, its likely we were just |
|
| 230 | - // setting the $render_sidebars static variable. |
|
| 231 | - if ($region) { |
|
| 229 | + // If zen_blocks was called with a NULL region, its likely we were just |
|
| 230 | + // setting the $render_sidebars static variable. |
|
| 231 | + if ($region) { |
|
| 232 | 232 | $output = ''; |
| 233 | 233 | |
| 234 | 234 | // If $renders_sidebars is FALSE, don't render any region whose name begins |
| 235 | 235 | // with "sidebar_". |
| 236 | 236 | if ($render_sidebars || (strpos($region, 'sidebar_') !== 0)) { |
| 237 | - // Allow context module to set blocks. |
|
| 238 | - if (function_exists('context_blocks')) { |
|
| 237 | + // Allow context module to set blocks. |
|
| 238 | + if (function_exists('context_blocks')) { |
|
| 239 | 239 | $output = context_blocks($region); |
| 240 | - } |
|
| 241 | - else { |
|
| 240 | + } |
|
| 241 | + else { |
|
| 242 | 242 | foreach (block_list($region) as $key => $block) { |
| 243 | - // $key == module_delta |
|
| 244 | - $output .= theme('block', $block); |
|
| 243 | + // $key == module_delta |
|
| 244 | + $output .= theme('block', $block); |
|
| 245 | + } |
|
| 245 | 246 | } |
| 246 | - } |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | // Add any content assigned to this region through drupal_set_content() calls. |
@@ -255,11 +255,11 @@ discard block |
||
| 255 | 255 | // Set the theme hook suggestions. |
| 256 | 256 | $hook = array('region_' . $region); |
| 257 | 257 | if (strpos($region, 'sidebar_') === 0) { |
| 258 | - $hook[] = 'region_sidebar'; |
|
| 258 | + $hook[] = 'region_sidebar'; |
|
| 259 | 259 | } |
| 260 | 260 | $hook[] = 'region'; |
| 261 | 261 | return $output ? theme($hook, $elements) : ''; |
| 262 | - } |
|
| 262 | + } |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
@@ -271,11 +271,11 @@ discard block |
||
| 271 | 271 | * @see zen_blocks() |
| 272 | 272 | */ |
| 273 | 273 | function zen_show_blocks_discovery(&$vars) { |
| 274 | - if ($vars['show_blocks'] == FALSE) { |
|
| 274 | + if ($vars['show_blocks'] == FALSE) { |
|
| 275 | 275 | // Allow zen_blocks() to statically cache the $show_blocks variable. A TRUE |
| 276 | 276 | // value is assumed, so we only need to override when $show_blocks is FALSE. |
| 277 | 277 | theme('blocks', NULL, FALSE); |
| 278 | - } |
|
| 278 | + } |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -287,25 +287,25 @@ discard block |
||
| 287 | 287 | * The name of the template being rendered. |
| 288 | 288 | */ |
| 289 | 289 | function zen_preprocess(&$vars, $hook) { |
| 290 | - // In D6, the page.tpl uses a different variable name to hold the classes. |
|
| 291 | - $key = ($hook == 'page' || $hook == 'maintenance_page') ? 'body_classes' : 'classes'; |
|
| 290 | + // In D6, the page.tpl uses a different variable name to hold the classes. |
|
| 291 | + $key = ($hook == 'page' || $hook == 'maintenance_page') ? 'body_classes' : 'classes'; |
|
| 292 | 292 | |
| 293 | - // Create a D7-standard classes_array variable. |
|
| 294 | - if (array_key_exists($key, $vars)) { |
|
| 293 | + // Create a D7-standard classes_array variable. |
|
| 294 | + if (array_key_exists($key, $vars)) { |
|
| 295 | 295 | // Views (and possibly other modules) have templates with a $classes |
| 296 | 296 | // variable that isn't a string, so we leave those variables alone. |
| 297 | 297 | if (is_string($vars[$key])) { |
| 298 | - $vars['classes_array'] = explode(' ', $hook . ' ' . $vars[$key]); |
|
| 299 | - unset($vars[$key]); |
|
| 298 | + $vars['classes_array'] = explode(' ', $hook . ' ' . $vars[$key]); |
|
| 299 | + unset($vars[$key]); |
|
| 300 | + } |
|
| 300 | 301 | } |
| 301 | - } |
|
| 302 | - else { |
|
| 302 | + else { |
|
| 303 | 303 | $vars['classes_array'] = array($hook); |
| 304 | - } |
|
| 305 | - // Add support for Skinr |
|
| 306 | - if (!empty($vars['skinr']) && array_key_exists('classes_array', $vars)) { |
|
| 304 | + } |
|
| 305 | + // Add support for Skinr |
|
| 306 | + if (!empty($vars['skinr']) && array_key_exists('classes_array', $vars)) { |
|
| 307 | 307 | $vars['classes_array'][] = $vars['skinr']; |
| 308 | - } |
|
| 308 | + } |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | /** |
@@ -317,82 +317,82 @@ discard block |
||
| 317 | 317 | * The name of the template being rendered ("page" in this case.) |
| 318 | 318 | */ |
| 319 | 319 | function zen_preprocess_page(&$vars, $hook) { |
| 320 | - // If the user is silly and enables Zen as the theme, add some styles. |
|
| 321 | - if ($GLOBALS['theme'] == 'zen') { |
|
| 320 | + // If the user is silly and enables Zen as the theme, add some styles. |
|
| 321 | + if ($GLOBALS['theme'] == 'zen') { |
|
| 322 | 322 | include_once './' . _zen_path() . '/zen-internals/template.zen.inc'; |
| 323 | 323 | _zen_preprocess_page($vars, $hook); |
| 324 | - } |
|
| 325 | - // Add conditional stylesheets. |
|
| 326 | - elseif (!module_exists('conditional_styles')) { |
|
| 324 | + } |
|
| 325 | + // Add conditional stylesheets. |
|
| 326 | + elseif (!module_exists('conditional_styles')) { |
|
| 327 | 327 | $language = $GLOBALS['language']->direction == LANGUAGE_RTL ? '_rtl' : ''; |
| 328 | 328 | $vars['conditional_styles'] = variable_get('conditional_styles_' . $GLOBALS['theme'] . $language, ''); |
| 329 | 329 | $vars['styles'] .= $vars['conditional_styles']; |
| 330 | - } |
|
| 330 | + } |
|
| 331 | 331 | |
| 332 | - // Classes for body element. Allows advanced theming based on context |
|
| 333 | - // (home page, node of certain type, etc.) |
|
| 334 | - // Remove the mostly useless page-ARG0 class. |
|
| 335 | - if ($index = array_search(preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', 'page-'. drupal_strtolower(arg(0))), $vars['classes_array'])) { |
|
| 332 | + // Classes for body element. Allows advanced theming based on context |
|
| 333 | + // (home page, node of certain type, etc.) |
|
| 334 | + // Remove the mostly useless page-ARG0 class. |
|
| 335 | + if ($index = array_search(preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', 'page-'. drupal_strtolower(arg(0))), $vars['classes_array'])) { |
|
| 336 | 336 | unset($vars['classes_array'][$index]); |
| 337 | - } |
|
| 338 | - if (!$vars['is_front']) { |
|
| 337 | + } |
|
| 338 | + if (!$vars['is_front']) { |
|
| 339 | 339 | // Add unique class for each page. |
| 340 | 340 | $path = drupal_get_path_alias($_GET['q']); |
| 341 | 341 | $vars['classes_array'][] = drupal_html_class('page-' . $path); |
| 342 | 342 | // Add unique class for each website section. |
| 343 | 343 | list($section, ) = explode('/', $path, 2); |
| 344 | 344 | if (arg(0) == 'node') { |
| 345 | - if (arg(1) == 'add') { |
|
| 345 | + if (arg(1) == 'add') { |
|
| 346 | 346 | $section = 'node-add'; |
| 347 | - } |
|
| 348 | - elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) { |
|
| 347 | + } |
|
| 348 | + elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) { |
|
| 349 | 349 | $section = 'node-' . arg(2); |
| 350 | - } |
|
| 350 | + } |
|
| 351 | 351 | } |
| 352 | 352 | $vars['classes_array'][] = drupal_html_class('section-' . $section); |
| 353 | - } |
|
| 354 | - if (theme_get_setting('zen_wireframes')) { |
|
| 353 | + } |
|
| 354 | + if (theme_get_setting('zen_wireframes')) { |
|
| 355 | 355 | $vars['classes_array'][] = 'with-wireframes'; // Optionally add the wireframes style. |
| 356 | - } |
|
| 357 | - // We need to re-do the $layout and body classes because |
|
| 358 | - // template_preprocess_page() assumes sidebars are named 'left' and 'right'. |
|
| 359 | - $vars['layout'] = 'none'; |
|
| 360 | - if (!empty($vars['sidebar_first'])) { |
|
| 356 | + } |
|
| 357 | + // We need to re-do the $layout and body classes because |
|
| 358 | + // template_preprocess_page() assumes sidebars are named 'left' and 'right'. |
|
| 359 | + $vars['layout'] = 'none'; |
|
| 360 | + if (!empty($vars['sidebar_first'])) { |
|
| 361 | 361 | $vars['layout'] = 'first'; |
| 362 | - } |
|
| 363 | - if (!empty($vars['sidebar_second'])) { |
|
| 362 | + } |
|
| 363 | + if (!empty($vars['sidebar_second'])) { |
|
| 364 | 364 | $vars['layout'] = ($vars['layout'] == 'first') ? 'both' : 'second'; |
| 365 | - } |
|
| 366 | - // If the layout is 'none', then template_preprocess_page() will already have |
|
| 367 | - // set a 'no-sidebars' class since it won't find a 'left' or 'right' sidebar. |
|
| 368 | - if ($vars['layout'] != 'none') { |
|
| 365 | + } |
|
| 366 | + // If the layout is 'none', then template_preprocess_page() will already have |
|
| 367 | + // set a 'no-sidebars' class since it won't find a 'left' or 'right' sidebar. |
|
| 368 | + if ($vars['layout'] != 'none') { |
|
| 369 | 369 | // Remove the incorrect 'no-sidebars' class. |
| 370 | 370 | if ($index = array_search('no-sidebars', $vars['classes_array'])) { |
| 371 | - unset($vars['classes_array'][$index]); |
|
| 371 | + unset($vars['classes_array'][$index]); |
|
| 372 | 372 | } |
| 373 | 373 | // Set the proper layout body classes. |
| 374 | 374 | if ($vars['layout'] == 'both') { |
| 375 | - $vars['classes_array'][] = 'two-sidebars'; |
|
| 375 | + $vars['classes_array'][] = 'two-sidebars'; |
|
| 376 | 376 | } |
| 377 | 377 | else { |
| 378 | - $vars['classes_array'][] = 'one-sidebar'; |
|
| 379 | - $vars['classes_array'][] = 'sidebar-' . $vars['layout']; |
|
| 378 | + $vars['classes_array'][] = 'one-sidebar'; |
|
| 379 | + $vars['classes_array'][] = 'sidebar-' . $vars['layout']; |
|
| 380 | + } |
|
| 380 | 381 | } |
| 381 | - } |
|
| 382 | - // Store the menu item since it has some useful information. |
|
| 383 | - $vars['menu_item'] = menu_get_item(); |
|
| 384 | - switch ($vars['menu_item']['page_callback']) { |
|
| 382 | + // Store the menu item since it has some useful information. |
|
| 383 | + $vars['menu_item'] = menu_get_item(); |
|
| 384 | + switch ($vars['menu_item']['page_callback']) { |
|
| 385 | 385 | case 'views_page': |
| 386 | 386 | // Is this a Views page? |
| 387 | 387 | $vars['classes_array'][] = 'page-views'; |
| 388 | - break; |
|
| 388 | + break; |
|
| 389 | 389 | case 'page_manager_page_execute': |
| 390 | 390 | case 'page_manager_node_view': |
| 391 | 391 | case 'page_manager_contact_site': |
| 392 | 392 | // Is this a Panels page? |
| 393 | 393 | $vars['classes_array'][] = 'page-panels'; |
| 394 | - break; |
|
| 395 | - } |
|
| 394 | + break; |
|
| 395 | + } |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | /** |
@@ -404,17 +404,17 @@ discard block |
||
| 404 | 404 | * The name of the template being rendered ("maintenance_page" in this case.) |
| 405 | 405 | */ |
| 406 | 406 | function zen_preprocess_maintenance_page(&$vars, $hook) { |
| 407 | - // If Zen is the maintenance theme, add some styles. |
|
| 408 | - if ($GLOBALS['theme'] == 'zen') { |
|
| 407 | + // If Zen is the maintenance theme, add some styles. |
|
| 408 | + if ($GLOBALS['theme'] == 'zen') { |
|
| 409 | 409 | include_once './' . _zen_path() . '/zen-internals/template.zen.inc'; |
| 410 | 410 | _zen_preprocess_page($vars, $hook); |
| 411 | - } |
|
| 412 | - // Add conditional stylesheets. |
|
| 413 | - elseif (!module_exists('conditional_styles')) { |
|
| 411 | + } |
|
| 412 | + // Add conditional stylesheets. |
|
| 413 | + elseif (!module_exists('conditional_styles')) { |
|
| 414 | 414 | $language = $GLOBALS['language']->direction == LANGUAGE_RTL ? '_rtl' : ''; |
| 415 | 415 | $vars['conditional_styles'] = variable_get('conditional_styles_' . $GLOBALS['theme'] . $language, ''); |
| 416 | 416 | $vars['styles'] .= $vars['conditional_styles']; |
| 417 | - } |
|
| 417 | + } |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | /** |
@@ -426,67 +426,67 @@ discard block |
||
| 426 | 426 | * The name of the template being rendered ("node" in this case.) |
| 427 | 427 | */ |
| 428 | 428 | function zen_preprocess_node(&$vars, $hook) { |
| 429 | - // Create the build_mode variable. |
|
| 430 | - switch ($vars['node']->build_mode) { |
|
| 429 | + // Create the build_mode variable. |
|
| 430 | + switch ($vars['node']->build_mode) { |
|
| 431 | 431 | case NODE_BUILD_NORMAL: |
| 432 | 432 | if ($vars['node']->build_mode === NODE_BUILD_NORMAL) { |
| 433 | 433 | $vars['build_mode'] = $vars['teaser'] ? 'teaser' : 'full'; |
| 434 | - } |
|
| 435 | - else { |
|
| 434 | + } |
|
| 435 | + else { |
|
| 436 | 436 | $vars['build_mode'] = $vars['node']->build_mode; |
| 437 | - } |
|
| 438 | - break; |
|
| 437 | + } |
|
| 438 | + break; |
|
| 439 | 439 | case NODE_BUILD_PREVIEW: |
| 440 | 440 | $vars['build_mode'] = 'preview'; |
| 441 | - break; |
|
| 441 | + break; |
|
| 442 | 442 | case NODE_BUILD_SEARCH_INDEX: |
| 443 | 443 | $vars['build_mode'] = 'search_index'; |
| 444 | - break; |
|
| 444 | + break; |
|
| 445 | 445 | case NODE_BUILD_SEARCH_RESULT: |
| 446 | 446 | $vars['build_mode'] = 'search_result'; |
| 447 | - break; |
|
| 447 | + break; |
|
| 448 | 448 | case NODE_BUILD_RSS: |
| 449 | 449 | $vars['build_mode'] = 'rss'; |
| 450 | - break; |
|
| 450 | + break; |
|
| 451 | 451 | case NODE_BUILD_PRINT: |
| 452 | 452 | $vars['build_mode'] = 'print'; |
| 453 | - break; |
|
| 453 | + break; |
|
| 454 | 454 | default: |
| 455 | 455 | $vars['build_mode'] = $vars['node']->build_mode; |
| 456 | - } |
|
| 456 | + } |
|
| 457 | 457 | |
| 458 | - // Create the user_picture variable. |
|
| 459 | - $vars['user_picture'] = $vars['picture']; |
|
| 458 | + // Create the user_picture variable. |
|
| 459 | + $vars['user_picture'] = $vars['picture']; |
|
| 460 | 460 | |
| 461 | - // Create the Drupal 7 $display_submitted variable. |
|
| 462 | - $vars['display_submitted'] = theme_get_setting('toggle_node_info_' . $vars['node']->type); |
|
| 461 | + // Create the Drupal 7 $display_submitted variable. |
|
| 462 | + $vars['display_submitted'] = theme_get_setting('toggle_node_info_' . $vars['node']->type); |
|
| 463 | 463 | |
| 464 | - // Special classes for nodes. |
|
| 465 | - // Class for node type: "node-type-page", "node-type-story", "node-type-my-custom-type", etc. |
|
| 466 | - $vars['classes_array'][] = drupal_html_class('node-type-' . $vars['type']); |
|
| 467 | - if ($vars['promote']) { |
|
| 464 | + // Special classes for nodes. |
|
| 465 | + // Class for node type: "node-type-page", "node-type-story", "node-type-my-custom-type", etc. |
|
| 466 | + $vars['classes_array'][] = drupal_html_class('node-type-' . $vars['type']); |
|
| 467 | + if ($vars['promote']) { |
|
| 468 | 468 | $vars['classes_array'][] = 'node-promoted'; |
| 469 | - } |
|
| 470 | - if ($vars['sticky']) { |
|
| 469 | + } |
|
| 470 | + if ($vars['sticky']) { |
|
| 471 | 471 | $vars['classes_array'][] = 'node-sticky'; |
| 472 | - } |
|
| 473 | - if (!$vars['status']) { |
|
| 472 | + } |
|
| 473 | + if (!$vars['status']) { |
|
| 474 | 474 | $vars['classes_array'][] = 'node-unpublished'; |
| 475 | 475 | $vars['unpublished'] = TRUE; |
| 476 | - } |
|
| 477 | - else { |
|
| 476 | + } |
|
| 477 | + else { |
|
| 478 | 478 | $vars['unpublished'] = FALSE; |
| 479 | - } |
|
| 480 | - if ($vars['uid'] && $vars['uid'] == $GLOBALS['user']->uid) { |
|
| 479 | + } |
|
| 480 | + if ($vars['uid'] && $vars['uid'] == $GLOBALS['user']->uid) { |
|
| 481 | 481 | $vars['classes_array'][] = 'node-by-viewer'; // Node is authored by current user. |
| 482 | - } |
|
| 483 | - if ($vars['teaser']) { |
|
| 482 | + } |
|
| 483 | + if ($vars['teaser']) { |
|
| 484 | 484 | $vars['classes_array'][] = 'node-teaser'; // Node is displayed as teaser. |
| 485 | - } |
|
| 486 | - if (isset($vars['preview'])) { |
|
| 485 | + } |
|
| 486 | + if (isset($vars['preview'])) { |
|
| 487 | 487 | $vars['classes_array'][] = 'node-preview'; |
| 488 | - } |
|
| 489 | - $vars['classes_array'][] = 'build-mode-' . $vars['build_mode'] ; |
|
| 488 | + } |
|
| 489 | + $vars['classes_array'][] = 'build-mode-' . $vars['build_mode'] ; |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | /** |
@@ -498,8 +498,8 @@ discard block |
||
| 498 | 498 | * The name of the template being rendered ("comment" in this case.) |
| 499 | 499 | */ |
| 500 | 500 | function zen_preprocess_comment(&$vars, $hook) { |
| 501 | - include_once './' . _zen_path() . '/zen-internals/template.comment.inc'; |
|
| 502 | - _zen_preprocess_comment($vars, $hook); |
|
| 501 | + include_once './' . _zen_path() . '/zen-internals/template.comment.inc'; |
|
| 502 | + _zen_preprocess_comment($vars, $hook); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | /** |
@@ -511,18 +511,18 @@ discard block |
||
| 511 | 511 | * @see region.tpl.php |
| 512 | 512 | */ |
| 513 | 513 | function zen_preprocess_region(&$vars, $hook) { |
| 514 | - // Create the $content variable that templates expect. |
|
| 515 | - $vars['content'] = $vars['elements']['#children']; |
|
| 516 | - $vars['region'] = $vars['elements']['#region']; |
|
| 514 | + // Create the $content variable that templates expect. |
|
| 515 | + $vars['content'] = $vars['elements']['#children']; |
|
| 516 | + $vars['region'] = $vars['elements']['#region']; |
|
| 517 | 517 | |
| 518 | - // Setup the default classes. |
|
| 519 | - $vars['classes_array'] = array('region', 'region-' . str_replace('_', '-', $vars['region'])); |
|
| 518 | + // Setup the default classes. |
|
| 519 | + $vars['classes_array'] = array('region', 'region-' . str_replace('_', '-', $vars['region'])); |
|
| 520 | 520 | |
| 521 | - // Sidebar regions get a couple extra classes. |
|
| 522 | - if (strpos($vars['region'], 'sidebar_') === 0) { |
|
| 521 | + // Sidebar regions get a couple extra classes. |
|
| 522 | + if (strpos($vars['region'], 'sidebar_') === 0) { |
|
| 523 | 523 | $vars['classes_array'][] = 'column'; |
| 524 | 524 | $vars['classes_array'][] = 'sidebar'; |
| 525 | - } |
|
| 525 | + } |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | /** |
@@ -534,36 +534,36 @@ discard block |
||
| 534 | 534 | * The name of the template being rendered ("block" in this case.) |
| 535 | 535 | */ |
| 536 | 536 | function zen_preprocess_block(&$vars, $hook) { |
| 537 | - $block = $vars['block']; |
|
| 537 | + $block = $vars['block']; |
|
| 538 | 538 | |
| 539 | - // Drupal 7 uses a $content variable instead of $block->content. |
|
| 540 | - $vars['content'] = $block->content; |
|
| 541 | - // Drupal 7 should use a $title variable instead of $block->subject. |
|
| 542 | - $vars['title'] = $block->subject; |
|
| 539 | + // Drupal 7 uses a $content variable instead of $block->content. |
|
| 540 | + $vars['content'] = $block->content; |
|
| 541 | + // Drupal 7 should use a $title variable instead of $block->subject. |
|
| 542 | + $vars['title'] = $block->subject; |
|
| 543 | 543 | |
| 544 | - // Special classes for blocks. |
|
| 545 | - $vars['classes_array'][] = 'block-' . $block->module; |
|
| 546 | - // Classes describing the position of the block within the region. |
|
| 547 | - if ($vars['block_id'] == 1) { |
|
| 544 | + // Special classes for blocks. |
|
| 545 | + $vars['classes_array'][] = 'block-' . $block->module; |
|
| 546 | + // Classes describing the position of the block within the region. |
|
| 547 | + if ($vars['block_id'] == 1) { |
|
| 548 | 548 | $vars['classes_array'][] = 'first'; |
| 549 | - } |
|
| 550 | - if (!function_exists('context_blocks') && count(block_list($vars['block']->region)) == $vars['block_id']) { |
|
| 549 | + } |
|
| 550 | + if (!function_exists('context_blocks') && count(block_list($vars['block']->region)) == $vars['block_id']) { |
|
| 551 | 551 | $vars['classes_array'][] = 'last'; |
| 552 | - } |
|
| 553 | - $vars['classes_array'][] = 'region-' . $vars['block_zebra']; |
|
| 554 | - $vars['classes_array'][] = $vars['zebra']; |
|
| 555 | - $vars['classes_array'][] = 'region-count-' . $vars['block_id']; |
|
| 556 | - $vars['classes_array'][] = 'count-' . $vars['id']; |
|
| 552 | + } |
|
| 553 | + $vars['classes_array'][] = 'region-' . $vars['block_zebra']; |
|
| 554 | + $vars['classes_array'][] = $vars['zebra']; |
|
| 555 | + $vars['classes_array'][] = 'region-count-' . $vars['block_id']; |
|
| 556 | + $vars['classes_array'][] = 'count-' . $vars['id']; |
|
| 557 | 557 | |
| 558 | - // Create the block ID. |
|
| 559 | - $vars['block_html_id'] = 'block-' . $block->module . '-' . $block->delta; |
|
| 558 | + // Create the block ID. |
|
| 559 | + $vars['block_html_id'] = 'block-' . $block->module . '-' . $block->delta; |
|
| 560 | 560 | |
| 561 | - $vars['edit_links_array'] = array(); |
|
| 562 | - if (theme_get_setting('zen_block_editing') && user_access('administer blocks')) { |
|
| 561 | + $vars['edit_links_array'] = array(); |
|
| 562 | + if (theme_get_setting('zen_block_editing') && user_access('administer blocks')) { |
|
| 563 | 563 | include_once './' . _zen_path() . '/zen-internals/template.block-editing.inc'; |
| 564 | 564 | zen_preprocess_block_editing($vars, $hook); |
| 565 | 565 | $vars['classes_array'][] = 'with-block-editing'; |
| 566 | - } |
|
| 566 | + } |
|
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | /** |
@@ -575,10 +575,10 @@ discard block |
||
| 575 | 575 | * The name of the template being rendered. |
| 576 | 576 | */ |
| 577 | 577 | function zen_process(&$vars, $hook) { |
| 578 | - // Don't clobber Views 3 classes. |
|
| 579 | - if (array_key_exists('classes_array', $vars) && !array_key_exists('classes', $vars)) { |
|
| 578 | + // Don't clobber Views 3 classes. |
|
| 579 | + if (array_key_exists('classes_array', $vars) && !array_key_exists('classes', $vars)) { |
|
| 580 | 580 | $vars['classes'] = implode(' ', $vars['classes_array']); |
| 581 | - } |
|
| 581 | + } |
|
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | /** |
@@ -590,22 +590,22 @@ discard block |
||
| 590 | 590 | * The name of the template being rendered ("block" in this case.) |
| 591 | 591 | */ |
| 592 | 592 | function zen_process_block(&$vars, $hook) { |
| 593 | - $vars['edit_links'] = !empty($vars['edit_links_array']) ? '<div class="edit">' . implode(' ', $vars['edit_links_array']) . '</div>' : ''; |
|
| 593 | + $vars['edit_links'] = !empty($vars['edit_links_array']) ? '<div class="edit">' . implode(' ', $vars['edit_links_array']) . '</div>' : ''; |
|
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | if (!function_exists('drupal_html_class')) { |
| 597 | - /** |
|
| 598 | - * Prepare a string for use as a valid class name. |
|
| 599 | - * |
|
| 600 | - * Do not pass one string containing multiple classes as they will be |
|
| 601 | - * incorrectly concatenated with dashes, i.e. "one two" will become "one-two". |
|
| 602 | - * |
|
| 603 | - * @param $class |
|
| 604 | - * The class name to clean. |
|
| 605 | - * @return |
|
| 606 | - * The cleaned class name. |
|
| 607 | - */ |
|
| 608 | - function drupal_html_class($class) { |
|
| 597 | + /** |
|
| 598 | + * Prepare a string for use as a valid class name. |
|
| 599 | + * |
|
| 600 | + * Do not pass one string containing multiple classes as they will be |
|
| 601 | + * incorrectly concatenated with dashes, i.e. "one two" will become "one-two". |
|
| 602 | + * |
|
| 603 | + * @param $class |
|
| 604 | + * The class name to clean. |
|
| 605 | + * @return |
|
| 606 | + * The cleaned class name. |
|
| 607 | + */ |
|
| 608 | + function drupal_html_class($class) { |
|
| 609 | 609 | // By default, we filter using Drupal's coding standards. |
| 610 | 610 | $class = strtr(drupal_strtolower($class), array(' ' => '-', '_' => '-', '/' => '-', '[' => '-', ']' => '')); |
| 611 | 611 | |
@@ -623,19 +623,19 @@ discard block |
||
| 623 | 623 | $class = preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $class); |
| 624 | 624 | |
| 625 | 625 | return $class; |
| 626 | - } |
|
| 626 | + } |
|
| 627 | 627 | } /* End of drupal_html_class conditional definition. */ |
| 628 | 628 | |
| 629 | 629 | if (!function_exists('drupal_html_id')) { |
| 630 | - /** |
|
| 631 | - * Prepare a string for use as a valid HTML ID and guarantee uniqueness. |
|
| 632 | - * |
|
| 633 | - * @param $id |
|
| 634 | - * The ID to clean. |
|
| 635 | - * @return |
|
| 636 | - * The cleaned ID. |
|
| 637 | - */ |
|
| 638 | - function drupal_html_id($id) { |
|
| 630 | + /** |
|
| 631 | + * Prepare a string for use as a valid HTML ID and guarantee uniqueness. |
|
| 632 | + * |
|
| 633 | + * @param $id |
|
| 634 | + * The ID to clean. |
|
| 635 | + * @return |
|
| 636 | + * The cleaned ID. |
|
| 637 | + */ |
|
| 638 | + function drupal_html_id($id) { |
|
| 639 | 639 | $id = strtr(drupal_strtolower($id), array(' ' => '-', '_' => '-', '[' => '-', ']' => '')); |
| 640 | 640 | |
| 641 | 641 | // As defined in http://www.w3.org/TR/html4/types.html#type-name, HTML IDs can |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | $id = preg_replace('/[^A-Za-z0-9\-_]/', '', $id); |
| 648 | 648 | |
| 649 | 649 | return $id; |
| 650 | - } |
|
| 650 | + } |
|
| 651 | 651 | } /* End of drupal_html_id conditional definition. */ |
| 652 | 652 | |
| 653 | 653 | /** |
@@ -657,12 +657,12 @@ discard block |
||
| 657 | 657 | * replace _zen_path() with drupal_get_path('theme', 'zen'). |
| 658 | 658 | */ |
| 659 | 659 | function _zen_path() { |
| 660 | - static $path = FALSE; |
|
| 661 | - if (!$path) { |
|
| 660 | + static $path = FALSE; |
|
| 661 | + if (!$path) { |
|
| 662 | 662 | $matches = drupal_system_listing('zen\.info$', 'themes', 'name', 0); |
| 663 | 663 | if (!empty($matches['zen']->filename)) { |
| 664 | - $path = dirname($matches['zen']->filename); |
|
| 664 | + $path = dirname($matches['zen']->filename); |
|
| 665 | + } |
|
| 665 | 666 | } |
| 666 | - } |
|
| 667 | - return $path; |
|
| 667 | + return $path; |
|
| 668 | 668 | } |
@@ -15,51 +15,51 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | function zen_settings($saved_settings, $subtheme_defaults = array()) { |
| 17 | 17 | |
| 18 | - // Add the form's CSS |
|
| 19 | - drupal_add_css(drupal_get_path('theme', 'zen') . '/zen-internals/css/theme-settings.css', 'theme'); |
|
| 18 | + // Add the form's CSS |
|
| 19 | + drupal_add_css(drupal_get_path('theme', 'zen') . '/zen-internals/css/theme-settings.css', 'theme'); |
|
| 20 | 20 | |
| 21 | - // Add javascript to show/hide optional settings |
|
| 22 | - drupal_add_js(drupal_get_path('theme', 'zen') . '/zen-internals/js/theme-settings.js', 'theme'); |
|
| 21 | + // Add javascript to show/hide optional settings |
|
| 22 | + drupal_add_js(drupal_get_path('theme', 'zen') . '/zen-internals/js/theme-settings.js', 'theme'); |
|
| 23 | 23 | |
| 24 | - // Get the default values from the .info file. |
|
| 25 | - $defaults = zen_theme_get_default_settings('zen'); |
|
| 24 | + // Get the default values from the .info file. |
|
| 25 | + $defaults = zen_theme_get_default_settings('zen'); |
|
| 26 | 26 | |
| 27 | - // Allow a subtheme to override the default values. |
|
| 28 | - $defaults = array_merge($defaults, $subtheme_defaults); |
|
| 27 | + // Allow a subtheme to override the default values. |
|
| 28 | + $defaults = array_merge($defaults, $subtheme_defaults); |
|
| 29 | 29 | |
| 30 | - // Merge the saved variables and their default values. |
|
| 31 | - $settings = array_merge($defaults, $saved_settings); |
|
| 30 | + // Merge the saved variables and their default values. |
|
| 31 | + $settings = array_merge($defaults, $saved_settings); |
|
| 32 | 32 | |
| 33 | - /* |
|
| 33 | + /* |
|
| 34 | 34 | * Create the form using Forms API |
| 35 | 35 | */ |
| 36 | - $form['zen-div-opening'] = array( |
|
| 36 | + $form['zen-div-opening'] = array( |
|
| 37 | 37 | '#value' => '<div id="zen-settings">', |
| 38 | - ); |
|
| 38 | + ); |
|
| 39 | 39 | |
| 40 | - $form['zen_block_editing'] = array( |
|
| 40 | + $form['zen_block_editing'] = array( |
|
| 41 | 41 | '#type' => 'checkbox', |
| 42 | 42 | '#title' => t('Show block editing on hover'), |
| 43 | 43 | '#description' => t('When hovering over a block, privileged users will see block editing links.'), |
| 44 | 44 | '#default_value' => $settings['zen_block_editing'], |
| 45 | - ); |
|
| 45 | + ); |
|
| 46 | 46 | |
| 47 | - $form['breadcrumb'] = array( |
|
| 47 | + $form['breadcrumb'] = array( |
|
| 48 | 48 | '#type' => 'fieldset', |
| 49 | 49 | '#title' => t('Breadcrumb settings'), |
| 50 | 50 | '#attributes' => array('id' => 'zen-breadcrumb'), |
| 51 | - ); |
|
| 52 | - $form['breadcrumb']['zen_breadcrumb'] = array( |
|
| 51 | + ); |
|
| 52 | + $form['breadcrumb']['zen_breadcrumb'] = array( |
|
| 53 | 53 | '#type' => 'select', |
| 54 | 54 | '#title' => t('Display breadcrumb'), |
| 55 | 55 | '#default_value' => $settings['zen_breadcrumb'], |
| 56 | 56 | '#options' => array( |
| 57 | - 'yes' => t('Yes'), |
|
| 58 | - 'admin' => t('Only in admin section'), |
|
| 59 | - 'no' => t('No'), |
|
| 57 | + 'yes' => t('Yes'), |
|
| 58 | + 'admin' => t('Only in admin section'), |
|
| 59 | + 'no' => t('No'), |
|
| 60 | 60 | ), |
| 61 | - ); |
|
| 62 | - $form['breadcrumb']['zen_breadcrumb_separator'] = array( |
|
| 61 | + ); |
|
| 62 | + $form['breadcrumb']['zen_breadcrumb_separator'] = array( |
|
| 63 | 63 | '#type' => 'textfield', |
| 64 | 64 | '#title' => t('Breadcrumb separator'), |
| 65 | 65 | '#description' => t('Text only. Don’t forget to include spaces.'), |
@@ -67,61 +67,61 @@ discard block |
||
| 67 | 67 | '#size' => 5, |
| 68 | 68 | '#maxlength' => 10, |
| 69 | 69 | '#prefix' => '<div id="div-zen-breadcrumb-collapse">', // jquery hook to show/hide optional widgets |
| 70 | - ); |
|
| 71 | - $form['breadcrumb']['zen_breadcrumb_home'] = array( |
|
| 70 | + ); |
|
| 71 | + $form['breadcrumb']['zen_breadcrumb_home'] = array( |
|
| 72 | 72 | '#type' => 'checkbox', |
| 73 | 73 | '#title' => t('Show home page link in breadcrumb'), |
| 74 | 74 | '#default_value' => $settings['zen_breadcrumb_home'], |
| 75 | - ); |
|
| 76 | - $form['breadcrumb']['zen_breadcrumb_trailing'] = array( |
|
| 75 | + ); |
|
| 76 | + $form['breadcrumb']['zen_breadcrumb_trailing'] = array( |
|
| 77 | 77 | '#type' => 'checkbox', |
| 78 | 78 | '#title' => t('Append a separator to the end of the breadcrumb'), |
| 79 | 79 | '#default_value' => $settings['zen_breadcrumb_trailing'], |
| 80 | 80 | '#description' => t('Useful when the breadcrumb is placed just before the title.'), |
| 81 | - ); |
|
| 82 | - $form['breadcrumb']['zen_breadcrumb_title'] = array( |
|
| 81 | + ); |
|
| 82 | + $form['breadcrumb']['zen_breadcrumb_title'] = array( |
|
| 83 | 83 | '#type' => 'checkbox', |
| 84 | 84 | '#title' => t('Append the content title to the end of the breadcrumb'), |
| 85 | 85 | '#default_value' => $settings['zen_breadcrumb_title'], |
| 86 | 86 | '#description' => t('Useful when the breadcrumb is not placed just before the title.'), |
| 87 | 87 | '#suffix' => '</div>', // #div-zen-breadcrumb |
| 88 | - ); |
|
| 88 | + ); |
|
| 89 | 89 | |
| 90 | - $form['themedev'] = array( |
|
| 90 | + $form['themedev'] = array( |
|
| 91 | 91 | '#type' => 'fieldset', |
| 92 | 92 | '#title' => t('Theme development settings'), |
| 93 | 93 | '#attributes' => array('id' => 'zen-themedev'), |
| 94 | - ); |
|
| 95 | - $form['themedev']['zen_rebuild_registry'] = array( |
|
| 94 | + ); |
|
| 95 | + $form['themedev']['zen_rebuild_registry'] = array( |
|
| 96 | 96 | '#type' => 'checkbox', |
| 97 | 97 | '#title' => t('Rebuild theme registry on every page.'), |
| 98 | 98 | '#default_value' => $settings['zen_rebuild_registry'], |
| 99 | 99 | '#description' => t('During theme development, it can be very useful to continuously <a href="!link">rebuild the theme registry</a>. WARNING: this is a huge performance penalty and must be turned off on production websites.', array('!link' => 'http://drupal.org/node/173880#theme-registry')), |
| 100 | 100 | '#prefix' => '<div id="div-zen-registry"><strong>' . t('Theme registry:') . '</strong>', |
| 101 | 101 | '#suffix' => '</div>', |
| 102 | - ); |
|
| 103 | - $form['themedev']['zen_layout'] = array( |
|
| 102 | + ); |
|
| 103 | + $form['themedev']['zen_layout'] = array( |
|
| 104 | 104 | '#type' => 'radios', |
| 105 | 105 | '#title' => t('Layout method'), |
| 106 | 106 | '#options' => array( |
| 107 | - 'zen-columns-liquid' => t('Liquid layout') . ' <small>(layout-liquid.css)</small>', |
|
| 108 | - 'zen-columns-fixed' => t('Fixed layout') . ' <small>(layout-fixed.css)</small>', |
|
| 107 | + 'zen-columns-liquid' => t('Liquid layout') . ' <small>(layout-liquid.css)</small>', |
|
| 108 | + 'zen-columns-fixed' => t('Fixed layout') . ' <small>(layout-fixed.css)</small>', |
|
| 109 | 109 | ), |
| 110 | 110 | '#default_value' => $settings['zen_layout'], |
| 111 | - ); |
|
| 112 | - $form['themedev']['zen_wireframes'] = array( |
|
| 111 | + ); |
|
| 112 | + $form['themedev']['zen_wireframes'] = array( |
|
| 113 | 113 | '#type' => 'checkbox', |
| 114 | 114 | '#title' => t('Display borders around main layout elements'), |
| 115 | 115 | '#default_value' => $settings['zen_wireframes'], |
| 116 | 116 | '#description' => t('<a href="!link">Wireframes</a> are useful when prototyping a website.', array('!link' => 'http://www.boxesandarrows.com/view/html_wireframes_and_prototypes_all_gain_and_no_pain')), |
| 117 | 117 | '#prefix' => '<div id="div-zen-wireframes"><strong>' . t('Wireframes:') . '</strong>', |
| 118 | 118 | '#suffix' => '</div>', |
| 119 | - ); |
|
| 119 | + ); |
|
| 120 | 120 | |
| 121 | - $form['zen-div-closing'] = array( |
|
| 121 | + $form['zen-div-closing'] = array( |
|
| 122 | 122 | '#value' => '</div>', |
| 123 | - ); |
|
| 123 | + ); |
|
| 124 | 124 | |
| 125 | - // Return the form |
|
| 126 | - return $form; |
|
| 125 | + // Return the form |
|
| 126 | + return $form; |
|
| 127 | 127 | } |
@@ -65,13 +65,13 @@ |
||
| 65 | 65 | * Implementation of HOOK_theme(). |
| 66 | 66 | */ |
| 67 | 67 | function STARTERKIT_theme(&$existing, $type, $theme, $path) { |
| 68 | - $hooks = zen_theme($existing, $type, $theme, $path); |
|
| 69 | - // Add your theme hooks like this: |
|
| 70 | - /* |
|
| 68 | + $hooks = zen_theme($existing, $type, $theme, $path); |
|
| 69 | + // Add your theme hooks like this: |
|
| 70 | + /* |
|
| 71 | 71 | $hooks['hook_name_here'] = array( // Details go here ); |
| 72 | 72 | */ |
| 73 | - // @TODO: Needs detailed comments. Patches welcome! |
|
| 74 | - return $hooks; |
|
| 73 | + // @TODO: Needs detailed comments. Patches welcome! |
|
| 74 | + return $hooks; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -13,17 +13,17 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | function STARTERKIT_settings($saved_settings) { |
| 15 | 15 | |
| 16 | - // Get the default values from the .info file. |
|
| 17 | - $defaults = zen_theme_get_default_settings('STARTERKIT'); |
|
| 16 | + // Get the default values from the .info file. |
|
| 17 | + $defaults = zen_theme_get_default_settings('STARTERKIT'); |
|
| 18 | 18 | |
| 19 | - // Merge the saved variables and their default values. |
|
| 20 | - $settings = array_merge($defaults, $saved_settings); |
|
| 19 | + // Merge the saved variables and their default values. |
|
| 20 | + $settings = array_merge($defaults, $saved_settings); |
|
| 21 | 21 | |
| 22 | - /* |
|
| 22 | + /* |
|
| 23 | 23 | * Create the form using Forms API: http://api.drupal.org/api/6 |
| 24 | 24 | */ |
| 25 | - $form = array(); |
|
| 26 | - /* -- Delete this line if you want to use this setting |
|
| 25 | + $form = array(); |
|
| 26 | + /* -- Delete this line if you want to use this setting |
|
| 27 | 27 | $form['STARTERKIT_example'] = array( |
| 28 | 28 | '#type' => 'checkbox', |
| 29 | 29 | '#title' => t('Use this sample setting'), |
@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | ); |
| 33 | 33 | // */ |
| 34 | 34 | |
| 35 | - // Add the base theme's settings. |
|
| 36 | - $form += zen_settings($saved_settings, $defaults); |
|
| 35 | + // Add the base theme's settings. |
|
| 36 | + $form += zen_settings($saved_settings, $defaults); |
|
| 37 | 37 | |
| 38 | - // Remove some of the base theme's settings. |
|
| 39 | - unset($form['themedev']['zen_layout']); // We don't need to select the base stylesheet. |
|
| 38 | + // Remove some of the base theme's settings. |
|
| 39 | + unset($form['themedev']['zen_layout']); // We don't need to select the base stylesheet. |
|
| 40 | 40 | |
| 41 | - // Return the form |
|
| 42 | - return $form; |
|
| 41 | + // Return the form |
|
| 42 | + return $form; |
|
| 43 | 43 | } |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | $friend = BoincFriend::lookup($srcid, $user->id); |
| 139 | 139 | if (!$friend) error_page("Request not found"); |
| 140 | 140 | page_head(tra("Friend request")); |
| 141 | - echo time_str($friend->create_time)."<p>\n"; |
|
| 141 | + echo time_str($friend->create_time)."<p>\n"; |
|
| 142 | 142 | $x = user_links($srcuser, BADGE_HEIGHT_MEDIUM); |
| 143 | 143 | echo tra("%1 has requested friendship with you.", $x); |
| 144 | 144 | if (strlen($friend->message)) { |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | // See if "action" is provided - either through post or get |
| 39 | 39 | if (!post_str('action', true)) { |
| 40 | 40 | if (!get_str('action', true)){ |
| 41 | - error_page(tra("You must specify an action...")); |
|
| 41 | + error_page(tra("You must specify an action...")); |
|
| 42 | 42 | } else { |
| 43 | 43 | $action = get_str('action'); |
| 44 | 44 | } |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | class LightOpenID |
| 48 | 48 | { |
| 49 | 49 | public $returnUrl |
| 50 | - , $required = array() |
|
| 51 | - , $optional = array() |
|
| 52 | - , $verify_peer = null |
|
| 53 | - , $capath = null |
|
| 54 | - , $cainfo = null; |
|
| 50 | + , $required = array() |
|
| 51 | + , $optional = array() |
|
| 52 | + , $verify_peer = null |
|
| 53 | + , $capath = null |
|
| 54 | + , $cainfo = null; |
|
| 55 | 55 | private $identity, $claimed_id; |
| 56 | 56 | protected $server, $version, $trustRoot, $aliases, $identifier_select = false |
| 57 | 57 | , $ax = false, $sreg = false, $data, $setup_url = null; |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | $parsed_url = parse_url($this->claimed_id); |
| 262 | 262 | $this->identity = |
| 263 | 263 | $this->claimed_id = $parsed_url['scheme'] . '://' |
| 264 | - . $parsed_url['host'] |
|
| 265 | - . $headers[$name]; |
|
| 264 | + . $parsed_url['host'] |
|
| 265 | + . $headers[$name]; |
|
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | } |
@@ -301,14 +301,14 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | $url = $parts + $url; |
| 303 | 303 | $url = $url['scheme'] . '://' |
| 304 | - . (empty($url['username'])?'' |
|
| 304 | + . (empty($url['username'])?'' |
|
| 305 | 305 | :(empty($url['password'])? "{$url['username']}@" |
| 306 | 306 | :"{$url['username']}:{$url['password']}@")) |
| 307 | - . $url['host'] |
|
| 308 | - . (empty($url['port'])?'':":{$url['port']}") |
|
| 309 | - . (empty($url['path'])?'':$url['path']) |
|
| 310 | - . (empty($url['query'])?'':"?{$url['query']}") |
|
| 311 | - . (empty($url['fragment'])?'':"#{$url['fragment']}"); |
|
| 307 | + . $url['host'] |
|
| 308 | + . (empty($url['port'])?'':":{$url['port']}") |
|
| 309 | + . (empty($url['path'])?'':$url['path']) |
|
| 310 | + . (empty($url['query'])?'':"?{$url['query']}") |
|
| 311 | + . (empty($url['fragment'])?'':"#{$url['fragment']}"); |
|
| 312 | 312 | return $url; |
| 313 | 313 | } |
| 314 | 314 | |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | |
| 534 | 534 | protected function authUrl_v1($immediate) |
| 535 | 535 | { |
| 536 | - $returnUrl = $this->returnUrl; |
|
| 536 | + $returnUrl = $this->returnUrl; |
|
| 537 | 537 | # If we have an openid.delegate that is different from our claimed id, |
| 538 | 538 | # we need to somehow preserve the claimed id between requests. |
| 539 | 539 | # The simplest way is to just send it along with the return_to url. |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | ) + $this->sregParams(); |
| 550 | 550 | |
| 551 | 551 | return $this->build_url(parse_url($this->server) |
| 552 | - , array('query' => http_build_query($params, '', '&'))); |
|
| 552 | + , array('query' => http_build_query($params, '', '&'))); |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | protected function authUrl_v2($immediate) |
@@ -574,14 +574,14 @@ discard block |
||
| 574 | 574 | |
| 575 | 575 | if ($this->identifier_select) { |
| 576 | 576 | $params['openid.identity'] = $params['openid.claimed_id'] |
| 577 | - = 'http://specs.openid.net/auth/2.0/identifier_select'; |
|
| 577 | + = 'http://specs.openid.net/auth/2.0/identifier_select'; |
|
| 578 | 578 | } else { |
| 579 | 579 | $params['openid.identity'] = $this->identity; |
| 580 | 580 | $params['openid.claimed_id'] = $this->claimed_id; |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | return $this->build_url(parse_url($this->server) |
| 584 | - , array('query' => http_build_query($params, '', '&'))); |
|
| 584 | + , array('query' => http_build_query($params, '', '&'))); |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | /** |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | # If it's an OpenID 1 provider, and we've got claimed_id, |
| 639 | 639 | # we have to append it to the returnUrl, like authUrl_v1 does. |
| 640 | 640 | $this->returnUrl .= (strpos($this->returnUrl, '?') ? '&' : '?') |
| 641 | - . 'openid.claimed_id=' . $this->claimed_id; |
|
| 641 | + . 'openid.claimed_id=' . $this->claimed_id; |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | if ($this->data['openid_return_to'] != $this->returnUrl) { |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | continue; |
| 708 | 708 | } |
| 709 | 709 | $key = substr($this->data['openid_' . $alias . '_type_' . $key], |
| 710 | - strlen('http://axschema.org/')); |
|
| 710 | + strlen('http://axschema.org/')); |
|
| 711 | 711 | $attributes[$key] = $value; |
| 712 | 712 | } |
| 713 | 713 | return $attributes; |