Changeset 486
- Timestamp:
- Aug 18, 2014 10:20:21 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Utilities.inc.php
r485 r486 398 398 return str_pad($input, $pad_length + $diff, $pad_string, $pad_type); 399 399 } 400 } 401 402 /* 403 * Converts a string into a URL-safe slug, removing spaces and non word characters. 404 * 405 * @access public 406 * @param string $str String to convert. 407 * @return string URL-safe slug. 408 * @author Quinn Comendant <quinn@strangecode.com> 409 * @version 1.0 410 * @since 18 Aug 2014 12:54:29 411 */ 412 function URLSlug($str) 413 { 414 $slug = preg_replace(array('/[^\w]+/', '/^-+|-+$/'), array('-', ''), $str); 415 $slug = strtolower($slug); 416 return $slug; 400 417 } 401 418
Note: See TracChangeset
for help on using the changeset viewer.