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