Simpletest Coverage - modules/filter/filter.pages.inc

1 <?php
2 // $Id: filter.pages.inc,v 1.7 2009/03/08 21:25:18 dries Exp $
3
4 /**
5 * @file
6 * User page callbacks for the filter module.
7 */
8
9
10 /**
11 * Menu callback; show a page with long filter tips.
12 */
13 function filter_tips_long() {
14 $format = arg(2);
15 if ($format) {
16 $output = theme('filter_tips', _filter_tips($format, TRUE), TRUE);
17 }
18 else {
19 $output = theme('filter_tips', _filter_tips(-1, TRUE), TRUE);
20 }
21 return $output;
22 }
23
24
25 /**
26 * Render HTML for a set of filter tips.
27 *
28 * @param $tips
29 * An array containing descriptions and a CSS id in the form of
30 * 'module-name/filter-id' (only used when $long is TRUE) for each
31 * filter in one or more text formats. Example:
32 * @code
33 * array(
34 * 'Full HTML' => array(
35 * 0 => array(
36 * 'tip' => 'Web page addresses and e-mail addresses turn into links automatically.',
37 * 'id' => 'filter/2',
38 * ),
39 * ),
40 * );
41 * @endcode
42 * @param $long
43 * (optional) Whether the passed in filter tips contain extended explanations,
44 * i.e. intended to be output on the path 'filter/tips' (TRUE), or are in a
45 * short format, i.e. suitable to be displayed below a form element. Defaults
46 * to FALSE.
47 *
48 * @see _filter_tips()
49 * @ingroup themeable
50 */
51 function theme_filter_tips($tips, $long = FALSE) {
52 $output = '';
53
54 $multiple = count($tips) > 1;
55 if ($multiple) {
56 $output = t('Text formats') . ':';
57 }
58
59 if (count($tips)) {
60 if ($multiple) {
61 $output .= '<ul>';
62 }
63 foreach ($tips as $name => $tiplist) {
64 if ($multiple) {
65 $output .= '<li>';
66 $output .= '<strong>' . $name . '</strong>:<br />';
67 }
68
69 if (count($tiplist) > 0) {
70 $output .= '<ul class="tips">';
71 foreach ($tiplist as $tip) {
72 $output .= '<li' . ($long ? ' id="filter-' . str_replace("/", "-", $tip['id']) . '">' : '>') . $tip['tip'] . '</li>';
73 }
74 $output .= '</ul>';
75 }
76
77 if ($multiple) {
78 $output .= '</li>';
79 }
80 }
81 if ($multiple) {
82 $output .= '</ul>';
83 }
84 }
85
86 return $output;
87 }
88

Legend

Missed
lines code that were not excersized during program execution.
Covered
lines code were excersized during program execution.
Comment/non executable
Comment or non-executable line of code.
Dead
lines of code that according to xdebug could not be executed. This is counted as coverage code because in almost all cases it is code that runnable.