Code coverage for /20080809/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
 */
112027
function garland_breadcrumb($breadcrumb) {
121489
  if (!empty($breadcrumb)) {
131233
    return '<div class="breadcrumb">' . implode(' › ', $breadcrumb) .
'</div>';
140
  }
15256
}
16
17
/**
18
 * Allow themable wrapping of all comments.
19
 */
202027
function garland_comment_wrapper($content, $node) {
21140
  if (!$content || $node->type == 'forum') {
22120
    return '<div id="comments">' . $content . '</div>';
230
  }
24
  else {
2520
    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
 */
322027
function garland_preprocess_page(&$vars) {
331489
  $vars['tabs2'] = menu_secondary_local_tasks();
341489
  $vars['primary_nav'] = isset($vars['main_menu']) ? theme('links',
$vars['main_menu'], array('class' => 'links main-menu')) : FALSE;
351489
  $vars['secondary_nav'] = isset($vars['secondary_menu']) ? theme('links',
$vars['secondary_menu'], array('class' => 'links secondary-menu')) : FALSE;
361489
  $vars['ie_styles'] = garland_get_ie_styles();
37
38
  // Prepare header
391489
  $site_fields = array();
401489
  if (!empty($vars['site_name'])) {
411489
    $site_fields[] = check_plain($vars['site_name']);
421489
  }
431489
  if (!empty($vars['site_slogan'])) {
440
    $site_fields[] = check_plain($vars['site_slogan']);
450
  }
461489
  $vars['site_title'] = implode(' ', $site_fields);
471489
  if (!empty($site_fields)) {
481489
    $site_fields[0] = '<span>'. $site_fields[0] .'</span>';
491489
  }
501489
  $vars['site_html'] = implode(' ', $site_fields);
51
52
  // Hook into color.module
531489
  if (module_exists('color')) {
541489
    _color_page_alter($vars);
551489
  }
561489
}
57
58
/**
59
 * Returns the rendered local tasks. The default implementation renders
60
 * them as tabs. Overridden to split the secondary tasks.
61
 */
622027
function garland_menu_local_tasks() {
631489
  return menu_primary_local_tasks();
640
}
65
66
/**
67
 * Format the "Submitted by username on date/time" for each comment.
68
 */
692027
function phptemplate_comment_submitted($comment) {
7032
  return t('!datetime — !username',
71
    array(
7232
      '!username' => theme('username', $comment),
7332
      '!datetime' => format_date($comment->timestamp)
7432
    ));
750
}
76
77
/**
78
 * Format the "Submitted by username on date/time" for each node.
79
 */
802027
function garland_node_submitted($node) {
81170
  return t('!datetime — !username',
82
    array(
83170
      '!username' => theme('username', $node),
84170
      '!datetime' => format_date($node->created),
85170
    ));
860
}
87
88
/**
89
 * Generates IE CSS links for LTR and RTL languages.
90
 */
912027
function garland_get_ie_styles() {
921489
  global $language;
93
941489
  $ie_styles = '<link type="text/css" rel="stylesheet" media="all" href="'
. base_path() . path_to_theme() . '/fix-ie.css" />'. "\n";
951489
  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
991489
  return $ie_styles;
1000
}
1012027