| 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 |
| 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 |
| 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 |
|
|