/[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.53, Tue Oct 20 17:52:41 2009 UTC revision 1.54, Thu Oct 22 00:11:35 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: pathauto.inc,v 1.52 2009/10/17 17:45:10 greggles Exp $  // $Id: pathauto.inc,v 1.53 2009/10/20 17:52:41 greggles Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 243  function pathauto_cleanstring($string, $ Line 243  function pathauto_cleanstring($string, $
243      else {      else {
244        $seppattern = '\\'. $separator;        $seppattern = '\\'. $separator;
245      }      }
246      // Trim any leading or trailing separators (note the need to      // Trim any leading or trailing separators.
247      $output = preg_replace("/^$seppattern+|$seppattern+$/", '', $output);      $output = preg_replace("/^$seppattern+|$seppattern+$/", '', $output);
248    
249      // Replace trailing separators around slashes.      // Replace trailing separators around slashes.
250      $output = preg_replace("/$seppattern\/|\/$seppattern/", "/", $output);      $output = preg_replace("/$seppattern\/|\/$seppattern/", "/", $output);
251    
252      // Replace multiple separators with a single one      // Replace multiple separators with a single one.
253      $output = preg_replace("/$seppattern+/", "$separator", $output);      $output = preg_replace("/$seppattern+/", "$separator", $output);
254    
255        // Optionally convert to lower case.
256        if (variable_get('pathauto_case', PATHAUTO_CASE_LOWER)) {
257          $output = drupal_strtolower($output);
258        }
259    }    }
260    
261    // Enforce the maximum component length    // Enforce the maximum component length
# Line 331  function pathauto_create_alias($module, Line 336  function pathauto_create_alias($module,
336      $old_alias = $update_data['old_alias'];      $old_alias = $update_data['old_alias'];
337    }    }
338    
339    // 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  
340    $alias = str_replace($placeholders['tokens'], $placeholders['values'], $pattern);    $alias = str_replace($placeholders['tokens'], $placeholders['values'], $pattern);
341    
   if (variable_get('pathauto_case', PATHAUTO_CASE_LOWER)) {  
     $alias = drupal_strtolower($alias);  
   }  
   
342    // Two or more slashes should be collapsed into one    // Two or more slashes should be collapsed into one
343    $alias = preg_replace('/\/+/', '/', $alias);    $alias = preg_replace('/\/+/', '/', $alias);
344    

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54

  ViewVC Help
Powered by ViewVC 1.1.2