2007-09-14 12:17:58 +00:00
|
|
|
<?php
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* User page callbacks for the filter module.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Menu callback; show a page with long filter tips.
|
|
|
|
*/
|
|
|
|
function filter_tips_long() {
|
2009-10-13 15:39:41 +00:00
|
|
|
$format_id = arg(2);
|
|
|
|
if ($format_id) {
|
|
|
|
$output = theme('filter_tips', array('tips' => _filter_tips($format_id, TRUE), 'long' => TRUE));
|
2007-09-14 12:17:58 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-10-09 01:00:08 +00:00
|
|
|
$output = theme('filter_tips', array('tips' => _filter_tips(-1, TRUE), 'long' => TRUE));
|
2007-09-14 12:17:58 +00:00
|
|
|
}
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2008-12-03 19:43:21 +00:00
|
|
|
* Render HTML for a set of filter tips.
|
2007-09-14 12:17:58 +00:00
|
|
|
*
|
2009-10-09 01:00:08 +00:00
|
|
|
* @param $variables
|
|
|
|
* An associative array containing:
|
|
|
|
* - tips: An array containing descriptions and a CSS id in the form of
|
|
|
|
* 'module-name/filter-id' (only used when $long is TRUE) for each
|
|
|
|
* filter in one or more text formats. Example:
|
|
|
|
* @code
|
|
|
|
* array(
|
|
|
|
* 'Full HTML' => array(
|
|
|
|
* 0 => array(
|
|
|
|
* 'tip' => 'Web page addresses and e-mail addresses turn into links automatically.',
|
|
|
|
* 'id' => 'filter/2',
|
|
|
|
* ),
|
2008-12-03 19:43:21 +00:00
|
|
|
* ),
|
2009-10-09 01:00:08 +00:00
|
|
|
* );
|
|
|
|
* @endcode
|
|
|
|
* - long: (optional) Whether the passed in filter tips contain extended
|
|
|
|
* explanations, i.e. intended to be output on the path 'filter/tips'
|
|
|
|
* (TRUE), or are in a short format, i.e. suitable to be displayed below a
|
|
|
|
* form element. Defaults to FALSE.
|
2008-12-03 19:43:21 +00:00
|
|
|
*
|
|
|
|
* @see _filter_tips()
|
2007-09-14 12:17:58 +00:00
|
|
|
* @ingroup themeable
|
|
|
|
*/
|
2009-10-09 01:00:08 +00:00
|
|
|
function theme_filter_tips($variables) {
|
|
|
|
$tips = $variables['tips'];
|
|
|
|
$long = $variables['long'];
|
2007-09-14 12:17:58 +00:00
|
|
|
$output = '';
|
|
|
|
|
|
|
|
$multiple = count($tips) > 1;
|
|
|
|
if ($multiple) {
|
2009-01-21 16:58:42 +00:00
|
|
|
$output = t('Text formats') . ':';
|
2007-09-14 12:17:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (count($tips)) {
|
|
|
|
if ($multiple) {
|
|
|
|
$output .= '<ul>';
|
|
|
|
}
|
|
|
|
foreach ($tips as $name => $tiplist) {
|
|
|
|
if ($multiple) {
|
|
|
|
$output .= '<li>';
|
2008-04-14 17:48:46 +00:00
|
|
|
$output .= '<strong>' . $name . '</strong>:<br />';
|
2007-09-14 12:17:58 +00:00
|
|
|
}
|
|
|
|
|
2007-11-10 17:41:18 +00:00
|
|
|
if (count($tiplist) > 0) {
|
|
|
|
$output .= '<ul class="tips">';
|
|
|
|
foreach ($tiplist as $tip) {
|
2008-04-14 17:48:46 +00:00
|
|
|
$output .= '<li' . ($long ? ' id="filter-' . str_replace("/", "-", $tip['id']) . '">' : '>') . $tip['tip'] . '</li>';
|
2007-11-10 17:41:18 +00:00
|
|
|
}
|
|
|
|
$output .= '</ul>';
|
2007-09-14 12:17:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($multiple) {
|
|
|
|
$output .= '</li>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($multiple) {
|
|
|
|
$output .= '</ul>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $output;
|
|
|
|
}
|