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

Diff of /contributions/modules/pirate/pirate.module

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

revision 1.4.2.2, Tue Mar 25 21:40:46 2008 UTC revision 1.4.2.3, Tue Mar 25 23:27:41 2008 UTC
# Line 3  Line 3 
3  /**  /**
4   * Implementation of hook_help().   * Implementation of hook_help().
5   */   */
6  function pirate_help($section) {  function pirate_help($path, $arg) {
7    switch ($section) {    switch ($path) {
8      case 'admin/modules#description':      case 'admin/help#pirate':
9        return t("Avast ye scurvy dogs!");        return t("Avast ye scurvy dogs!");
10    }    }
11  }  }
# Line 119  function pirate_filter($op, $delta = 0, Line 119  function pirate_filter($op, $delta = 0,
119          '%\bdied\b%' => 'snuffed it',          '%\bdied\b%' => 'snuffed it',
120          '/ing\b/' => "in'",          '/ing\b/' => "in'",
121          '/ings\b/' => "in's",          '/ings\b/' => "in's",
122          // These next two do cool random substitutions          // These next two do cool random substitutions.
123          '/(\.\s)/e' => 'avast("$0",3)',          '/(\.\s)/e' => 'avast("$0",3)',
124          '/([!\?]\s)/e' => 'avast("$0",2)', // Greater chance after exclamation          '/([!\?]\s)/e' => 'avast("$0",2)', // Greater chance after exclamation.
125          );          );
126        foreach ($patterns as $pattern_search => $pattern_replace) {        foreach ($patterns as $pattern_search => $pattern_replace) {
127          $text = preg_replace($pattern_search, $pattern_replace, $text);          $text = preg_replace($pattern_search, $pattern_replace, $text);
# Line 136  function pirate_filter($op, $delta = 0, Line 136  function pirate_filter($op, $delta = 0,
136   * Implementation of hook_filter_tips().   * Implementation of hook_filter_tips().
137   */   */
138  function pirate_filter_tips($delta, $format, $long = FALSE) {  function pirate_filter_tips($delta, $format, $long = FALSE) {
139    return "Avast!  This website be taken over by pirates on September 19th.  Yarr!";    return "Avast! This website be taken over by pirates on September 19th. Yarr!";
140  }  }
141    
142  // Support function for pirate()  // Support function for pirate().
143  // this could probably be refactored to make it more generic, allowing  // this could probably be refactored to make it more generic, allowing
144  // different filters to pass their own patterns in.  // different filters to pass their own patterns in.
145  function avast($stub = '',$chance = 5) {  function avast($stub = '',$chance = 5) {
# Line 185  function avast($stub = '',$chance = 5) { Line 185  function avast($stub = '',$chance = 5) {
185      ", Dance the Hempen Jig",      ", Dance the Hempen Jig",
186      ", Hornswaggle",      ", Hornswaggle",
187      ", Ya lily livered swabbie!",      ", Ya lily livered swabbie!",
188      );    );
189    
190    shuffle($shouts);    shuffle($shouts);
191    return (((1 == rand(1,$chance))?array_shift($shouts):$stub) . ' ');    return (((1 == rand(1,$chance))?array_shift($shouts):$stub) . ' ');

Legend:
Removed from v.1.4.2.2  
changed lines
  Added in v.1.4.2.3

  ViewVC Help
Powered by ViewVC 1.1.2