| 1 | | <?php |
| 2 | | // $Id: filter.pages.inc,v 1.3 2008/04/14 17:48:37 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 | 384 | function filter_tips_long() { |
| 14 | 0 | $format = arg(2); |
| 15 | 0 | if ($format) { |
| 16 | 0 | $output = theme('filter_tips', _filter_tips($format, TRUE), TRUE); |
| 17 | 0 | } |
| 18 | | else { |
| 19 | 0 | $output = theme('filter_tips', _filter_tips(-1, TRUE), TRUE); |
| 20 | | } |
| 21 | 0 | return $output; |
| 22 | 0 | } |
| 23 | | |
| 24 | | |
| 25 | | /** |
| 26 | | * Format a set of filter tips. |
| 27 | | * |
| 28 | | * @ingroup themeable |
| 29 | | */ |
| 30 | 384 | function theme_filter_tips($tips, $long = FALSE, $extra = '') { |
| 31 | 206 | $output = ''; |
| 32 | | |
| 33 | 206 | $multiple = count($tips) > 1; |
| 34 | 206 | if ($multiple) { |
| 35 | 0 | $output = t('input formats') . ':'; |
| 36 | 0 | } |
| 37 | | |
| 38 | 206 | if (count($tips)) { |
| 39 | 206 | if ($multiple) { |
| 40 | 0 | $output .= '<ul>'; |
| 41 | 0 | } |
| 42 | 206 | foreach ($tips as $name => $tiplist) { |
| 43 | 206 | if ($multiple) { |
| 44 | 0 | $output .= '<li>'; |
| 45 | 0 | $output .= '<strong>' . $name . '</strong>:<br />'; |
| 46 | 0 | } |
| 47 | | |
| 48 | 206 | if (count($tiplist) > 0) { |
| 49 | 206 | $output .= '<ul class="tips">'; |
| 50 | 206 | foreach ($tiplist as $tip) { |
| 51 | 206 | $output .= '<li' . ($long ? ' id="filter-' . str_replace("/",
"-", $tip['id']) . '">' : '>') . $tip['tip'] . '</li>'; |
| 52 | 206 | } |
| 53 | 206 | $output .= '</ul>'; |
| 54 | 206 | } |
| 55 | | |
| 56 | 206 | if ($multiple) { |
| 57 | 0 | $output .= '</li>'; |
| 58 | 0 | } |
| 59 | 206 | } |
| 60 | 206 | if ($multiple) { |
| 61 | 0 | $output .= '</ul>'; |
| 62 | 0 | } |
| 63 | 206 | } |
| 64 | | |
| 65 | 206 | return $output; |
| 66 | 0 | } |
| 67 | 384 | |