| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id: username_highlighter.module,v 1.3 2008/06/26 07:57:40 soxofaan Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file Implementation of the User name highlighter module. |
* @file Implementation of the User name highlighter module. |
| 11 |
/** |
/** |
| 12 |
* Implementation of hook_menu(). |
* Implementation of hook_menu(). |
| 13 |
*/ |
*/ |
| 14 |
function username_highlighter_menu($may_cache) { |
function username_highlighter_menu() { |
| 15 |
$items = array(); |
$items = array(); |
| 16 |
if ($may_cache) { |
$items['admin/settings/username_highlighter'] = array( |
| 17 |
$items[] = array( |
'title' => 'User name highlighter', |
| 18 |
'path' => 'admin/settings/username_highlighter', |
'description' => 'Administer user name highlighting.', |
| 19 |
'title' => t('User name highlighter'), |
'page callback' => 'drupal_get_form', |
| 20 |
'description' => t('Administer user name highlighting.'), |
'page arguments' => array('username_highlighter_admin'), |
| 21 |
'callback' => 'drupal_get_form', |
'access arguments' => array('administer filters'), |
| 22 |
'callback arguments' => 'username_highlighter_admin', |
'type' => MENU_NORMAL_ITEM, |
| 23 |
'access' => user_access('administer filters'), |
); |
|
'type' => MENU_NORMAL_ITEM, |
|
|
); |
|
|
} |
|
| 24 |
return $items; |
return $items; |
| 25 |
} |
} |
| 26 |
|
|
| 57 |
/** |
/** |
| 58 |
* Implementation of hook_filter_tips(). |
* Implementation of hook_filter_tips(). |
| 59 |
*/ |
*/ |
| 60 |
function username_highlighter_filter_tips($delta, $format, $long = false) { |
function username_highlighter_filter_tips($delta, $format, $long = FALSE) { |
| 61 |
return t('User names will be highlighted.'); |
return t('User names will be highlighted.'); |
| 62 |
} |
} |
| 63 |
|
|
| 116 |
/** |
/** |
| 117 |
* Validation handler for username_highlighter_admin form. |
* Validation handler for username_highlighter_admin form. |
| 118 |
*/ |
*/ |
| 119 |
function username_highlighter_admin_validate($form_id, $form_values) { |
function username_highlighter_admin_validate($form, &$form_state) { |
| 120 |
$sat = $form_values['username_highlighter_color_saturation']; |
$sat = $form_state['values']['username_highlighter_color_saturation']; |
| 121 |
if (!is_numeric($sat) || $sat < 0.0 || $sat > 100.0) { |
if (!is_numeric($sat) || $sat < 0.0 || $sat > 100.0) { |
| 122 |
form_set_error('username_highlighter_color_saturation', t('Color saturation should be between 0% and 100%')); |
form_set_error('username_highlighter_color_saturation', t('Color saturation should be between 0% and 100%')); |
| 123 |
} |
} |
| 124 |
$val = $form_values['username_highlighter_color_value']; |
$val = $form_state['values']['username_highlighter_color_value']; |
| 125 |
if (!is_numeric($val) || $val < 0.0 || $val > 100.0) { |
if (!is_numeric($val) || $val < 0.0 || $val > 100.0) { |
| 126 |
form_set_error('username_highlighter_color_value', t('Color value should be between 0% and 100%')); |
form_set_error('username_highlighter_color_value', t('Color value should be between 0% and 100%')); |
| 127 |
} |
} |