| 1 |
<?php |
<?php |
| 2 |
// $Id: jgrowl.module,v 1.1 2008/09/21 04:34:07 stevemckenzie Exp $ |
// $Id: jgrowl.module,v 1.2 2008/09/21 04:54:45 stevemckenzie Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* |
* |
| 100 |
} |
} |
| 101 |
} |
} |
| 102 |
|
|
| 103 |
return '$.jGrowl("'. str_replace("\n", "<br />", $message) .'", '. jgrowl_to_js($variables) .'); '; |
return '$.jGrowl("'. str_replace("\n", "<br />", addslashes($message)) .'", '. jgrowl_to_js($variables) .'); '; |
| 104 |
} |
} |
| 105 |
|
|
| 106 |
/** |
/** |
| 127 |
$form['variables'] = array('#title' => t('Configuration'), '#type' => 'fieldset', '#collapsible' => TRUE, '#description' => t('For more information on the variables available and what they do, visit the !site.', array('!site' => l(t('plugin\'s site'), 'http://stanlemon.net/projects/jgrowl.html')))); |
$form['variables'] = array('#title' => t('Configuration'), '#type' => 'fieldset', '#collapsible' => TRUE, '#description' => t('For more information on the variables available and what they do, visit the !site.', array('!site' => l(t('plugin\'s site'), 'http://stanlemon.net/projects/jgrowl.html')))); |
| 128 |
|
|
| 129 |
foreach (jgrowl_variables('settings') as $variable => $value) { |
foreach (jgrowl_variables('settings') as $variable => $value) { |
| 130 |
$form['variables']['jgrowl__'. $variable] = array( |
// Leave room for more custom fields. |
| 131 |
|
// TODO: make the settings $op of the hook able to control this? |
| 132 |
|
switch ($variable) { |
| 133 |
|
case 'position': |
| 134 |
|
$type = 'select'; |
| 135 |
|
$options = array('top-left' => t('Top left'), 'top-right' => t('Top right'), 'bottom-left' => t('Bottom left'), 'bottom-right' => t('Bottom right'), 'center' => t('Center')); |
| 136 |
|
$options = array('#options' => $options); |
| 137 |
|
break; |
| 138 |
|
|
| 139 |
|
default: |
| 140 |
|
$type = 'textfield'; |
| 141 |
|
$options = array(); |
| 142 |
|
break; |
| 143 |
|
} |
| 144 |
|
|
| 145 |
|
$form['variables']['jgrowl__'. $variable] = array_merge(array( |
| 146 |
'#title' => $variable, |
'#title' => $variable, |
| 147 |
'#type' => 'textfield', |
'#type' => $type, |
| 148 |
'#default_value' => $value, |
'#default_value' => $value, |
| 149 |
); |
), $options); |
| 150 |
} |
} |
| 151 |
|
|
| 152 |
return system_settings_form($form); |
return system_settings_form($form); |
| 198 |
// Handle custom JS functions. |
// Handle custom JS functions. |
| 199 |
case substr($var, 0, strlen('function')) == 'function': |
case substr($var, 0, strlen('function')) == 'function': |
| 200 |
return $var; |
return $var; |
| 201 |
|
|
| 202 |
case 'resource': |
case 'resource': |
| 203 |
case 'string': |
case 'string': |
| 204 |
return '"'. $var .'"'; |
return '"'. $var .'"'; |