| 1 |
<?php
|
| 2 |
// $Id: template.php,v 1.6 2008/09/30 17:51:43 lut4rp Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* template.php for the vote_up_down.module
|
| 7 |
*/
|
| 8 |
|
| 9 |
/* TODO FormAPI image buttons are now supported.
|
| 10 |
FormAPI now offers the 'image_button' element type, allowing developers to
|
| 11 |
use icons or other custom images in place of traditional HTML submit buttons.
|
| 12 |
|
| 13 |
$form['my_image_button'] = array(
|
| 14 |
'#type' => 'image_button',
|
| 15 |
'#title' => t('My button'),
|
| 16 |
'#return_value' => 'my_data',
|
| 17 |
'#src' => 'my/image/path.jpg',
|
| 18 |
); */
|
| 19 |
|
| 20 |
/* TODO New user_mail_tokens() method may be useful.
|
| 21 |
user.module now provides a user_mail_tokens() function to return an array
|
| 22 |
of the tokens available for the email notification messages it sends when
|
| 23 |
accounts are created, activated, blocked, etc. Contributed modules that
|
| 24 |
wish to make use of the same tokens for their own needs are encouraged
|
| 25 |
to use this function. */
|
| 26 |
|
| 27 |
/* TODO
|
| 28 |
There is a new hook_watchdog in core. This means that contributed modules
|
| 29 |
can implement hook_watchdog to log Drupal events to custom destinations.
|
| 30 |
Two core modules are included, dblog.module (formerly known as watchdog.module),
|
| 31 |
and syslog.module. Other modules in contrib include an emaillog.module,
|
| 32 |
included in the logging_alerts module. See syslog or emaillog for an
|
| 33 |
example on how to implement hook_watchdog.
|
| 34 |
function example_watchdog($log = array()) {
|
| 35 |
if ($log['severity'] == WATCHDOG_ALERT) {
|
| 36 |
mysms_send($log['user']->uid,
|
| 37 |
$log['type'],
|
| 38 |
$log['message'],
|
| 39 |
$log['variables'],
|
| 40 |
$log['severity'],
|
| 41 |
$log['referer'],
|
| 42 |
$log['ip'],
|
| 43 |
format_date($log['timestamp']));
|
| 44 |
}
|
| 45 |
} */
|
| 46 |
|
| 47 |
/* TODO Implement the hook_theme registry. Combine all theme registry entries
|
| 48 |
into one hook_theme function in each corresponding module file.
|
| 49 |
function template_theme() {
|
| 50 |
return array(
|
| 51 |
);
|
| 52 |
} */
|
| 53 |
|
| 54 |
function _phptemplate_variables($hook, $vars) {
|
| 55 |
switch ($hook) {
|
| 56 |
case 'node':
|
| 57 |
$vars['storylink_url'] = check_url($vars['node']->vote_storylink_url);
|
| 58 |
if (arg(1) != 'add' && arg(2) != 'edit') {
|
| 59 |
$style = variable_get('vote_up_down_widget_style_node', 0) == 1 ? '_alt' : '';
|
| 60 |
$vars['vote_up_down_widget'] = theme("vote_up_down_widget$style", $vars['node']->nid, 'node');
|
| 61 |
$vars['vote_up_down_points'] = theme("vote_up_down_points$style", $vars['node']->nid, 'node');
|
| 62 |
}
|
| 63 |
$vars['vote_storylink_via'] = theme('vote_storylink_via', $vars['node']->vote_storylink_url);
|
| 64 |
if (arg(1) == 'top') {
|
| 65 |
static $count;
|
| 66 |
$count = is_array($count) ? $count : array();
|
| 67 |
$count[$hook] = is_int($count[$hook]) ? $count[$hook] : 1;
|
| 68 |
$vars['seqid'] = $count[$hook]++;
|
| 69 |
}
|
| 70 |
break;
|
| 71 |
}
|
| 72 |
return $vars;
|
| 73 |
}
|