/[drupal]/contributions/modules/pathauto/pathauto.inc
ViewVC logotype

Diff of /contributions/modules/pathauto/pathauto.inc

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

revision 1.45.2.3, Tue Oct 20 17:52:12 2009 UTC revision 1.45.2.4, Thu Oct 22 00:13:20 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: pathauto.inc,v 1.45.2.2 2009/10/17 17:45:52 greggles Exp $  // $Id: pathauto.inc,v 1.45.2.3 2009/10/20 17:52:12 greggles Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 199  function pathauto_cleanstring($string, $ Line 199  function pathauto_cleanstring($string, $
199      else {      else {
200        $seppattern = '\\'. $separator;        $seppattern = '\\'. $separator;
201      }      }
202      // Trim any leading or trailing separators (note the need to      // Trim any leading or trailing separators.
203      $output = preg_replace("/^$seppattern+|$seppattern+$/", '', $output);      $output = preg_replace("/^$seppattern+|$seppattern+$/", '', $output);
204    
205      // Replace trailing separators around slashes.      // Replace trailing separators around slashes.
206      $output = preg_replace("/$seppattern\/|\/$seppattern/", "/", $output);      $output = preg_replace("/$seppattern\/|\/$seppattern/", "/", $output);
207    
208      // Replace multiple separators with a single one      // Replace multiple separators with a single one.
209      $output = preg_replace("/$seppattern+/", "$separator", $output);      $output = preg_replace("/$seppattern+/", "$separator", $output);
210    
211        // Optionally convert to lower case.
212        if (variable_get('pathauto_case', PATHAUTO_CASE_LOWER)) {
213          $output = drupal_strtolower($output);
214        }
215    }    }
216    
217    // Enforce the maximum component length    // Enforce the maximum component length
# Line 287  function pathauto_create_alias($module, Line 292  function pathauto_create_alias($module,
292      $old_alias = $update_data['old_alias'];      $old_alias = $update_data['old_alias'];
293    }    }
294    
295    // Replace the placeholders with the values provided by the module,    // Replace the placeholders with the values provided by the module.
   // and optionally lower-case the result  
296    $alias = str_replace($placeholders['tokens'], $placeholders['values'], $pattern);    $alias = str_replace($placeholders['tokens'], $placeholders['values'], $pattern);
297    
   if (variable_get('pathauto_case', 1)) {  
     $alias = drupal_strtolower($alias);  
   }  
   
298    // Two or more slashes should be collapsed into one    // Two or more slashes should be collapsed into one
299    $alias = preg_replace('/\/+/', '/', $alias);    $alias = preg_replace('/\/+/', '/', $alias);
300    

Legend:
Removed from v.1.45.2.3  
changed lines
  Added in v.1.45.2.4

  ViewVC Help
Powered by ViewVC 1.1.2