/[drupal]/contributions/modules/jgrowl/jgrowl.module
ViewVC logotype

Diff of /contributions/modules/jgrowl/jgrowl.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2, Sun Sep 21 04:54:45 2008 UTC revision 1.3, Sun Sep 28 01:20:11 2008 UTC
# Line 1  Line 1 
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   *   *
# Line 100  function theme_jgrowl_message($message, Line 100  function theme_jgrowl_message($message,
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  /**  /**
# Line 127  function jgrowl_settings_form() { Line 127  function jgrowl_settings_form() {
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);
# Line 183  function jgrowl_to_js($var) { Line 198  function jgrowl_to_js($var) {
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 .'"';

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.2