Code coverage for /20081101/themes/garland/template.php

Line #Times calledCode
1
<?php
2
// $Id: template.php,v 1.19 2008/06/25 09:12:25 dries Exp $
3
4
/**
5
 * Return a themed breadcrumb trail.
6
 *
7
 * @param $breadcrumb
8
 *   An array containing the breadcrumb links.
9
 * @return a string containing the breadcrumb output.
10
 */
112157
function garland_breadcrumb($breadcrumb) {
121739
  if (!empty($breadcrumb)) {
131433
    return '<div class="breadcrumb">' . implode(' › ', $breadcrumb) .
'</div>';
140
  }
15306
}
16
17
/**
18
 * Allow themable wrapping of all comments.
19
 */
202157
function garland_comment_wrapper($content, $node) {
21145
  if (!$content || $node->type == 'forum') {
22122
    return '<div id="comments">' . $content . '</div>';
230
  }
24
  else {
2523
    return '<div id="comments"><h2 class="comments">' . t('Comments') .
'</h2>' . $content . '</div>';
26
  }
270
}
28
29
/**
30
 * Override or insert variables into the page template.
31
 */
322157
function garland_preprocess_page(&$vars) {
331739
  $vars['tabs2'] = menu_secondary_local_tasks();
341739
  $vars['primary_nav'] = isset($vars['main_menu']) ? theme('links',
$vars['main_menu'], array('class' => 'links main-menu')) : FALSE;
351739
  $vars['secondary_nav'] = isset($vars['secondary_menu']) ? theme('links',
$vars['secondary_menu'], array('class' => 'links secondary-menu')) : FALSE;
361739
  $vars['ie_styles'] = garland_get_ie_styles();
37
38
  // Prepare header
391739
  $site_fields = array();
401739
  if (!empty($vars['site_name'])) {
411739
    $site_fields[] = check_plain($vars['site_name']);
421739
  }
431739
  if (!empty($vars['site_slogan'])) {
440
    $site_fields[] = check_plain($vars['site_slogan']);
450
  }
461739
  $vars['site_title'] = implode(' ', $site_fields);
471739
  if (!empty($site_fields)) {
481739
    $site_fields[0] = '<span>'. $site_fields[0] .'</span>';
491739
  }
501739
  $vars['site_html'] = implode(' ', $site_fields);
51
52
  // Hook into color.module
531739
  if (module_exists('color')) {
541737
    _color_page_alter($vars);
551737
  }
561739
}
57
58
/**
59
 * Returns the rendered local tasks. The default implementation renders
60
 * them as tabs. Overridden to split the secondary tasks.
61
 */
622157
function garland_menu_local_tasks() {
631739
  return menu_primary_local_tasks();
640
}
65
66
/**
67
 * Format the "Submitted by username on date/time" for each comment.
68
 */
692157
function phptemplate_comment_submitted($comment) {
7038
  return t('!datetime — !username',
71
    array(
7238
      '!username' => theme('username', $comment),
7338
      '!datetime' => format_date($comment->timestamp)
7438
    ));
750
}
76
77
/**
78
 * Format the "Submitted by username on date/time" for each node.
79
 */
802157
function garland_node_submitted($node) {
81180
  return t('!datetime — !username',
82
    array(
83180
      '!username' => theme('username', $node),
84180
      '!datetime' => format_date($node->created),
85180
    ));
860
}
87
88
/**
89
 * Generates IE CSS links for LTR and RTL languages.
90
 */
912157
function garland_get_ie_styles() {
921741
  global $language;
93
941741
  $ie_styles = '<link type="text/css" rel="stylesheet" media="all" href="'
. base_path() . path_to_theme() . '/fix-ie.css" />'. "\n";
951741
  if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) {
960
    $ie_styles .= '      <style type="text/css" media="all">@import "' .
base_path() . path_to_theme() . '/fix-ie-rtl.css";</style>'. "\n";
970
  }
98
991741
  return $ie_styles;
1000
}
1012157