Changeset 678 for branches/1.1dev/lib


Ignore:
Timestamp:
May 5, 2019 7:03:40 PM (5 years ago)
Author:
anonymous
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1dev/lib/Utilities.inc.php

    r651 r678  
    361361}
    362362
     363/*
     364* Converts a string into a URL-safe slug, removing spaces and non word characters.
     365*
     366* @access   public
     367* @param    string  $str    String to convert.
     368* @return   string          URL-safe slug.
     369* @author   Quinn Comendant <quinn@strangecode.com>
     370* @version  1.0
     371* @since    18 Aug 2014 12:54:29
     372*/
     373function URLSlug($str)
     374{
     375    $slug = preg_replace(array('/\W+/u', '/^-+|-+$/'), array('-', ''), $str);
     376    $slug = strtolower($slug);
     377    return $slug;
     378}
     379
    363380/**
    364381 * Return a human readable filesize.
Note: See TracChangeset for help on using the changeset viewer.