WordPress.org

Making WordPress.org

Changeset 3147


Ignore:
Timestamp:
05/14/2016 02:00:56 PM (6 years ago)
Author:
ocean90
Message:

Trac: Move wporg_sanitize_user_nicename() to site-ticket.html so it's available for ticket previews.

ticket_preview.html doesn't include site.html but site-ticket.html.

See [3140].

Location:
sites/trunk/trac.wordpress.org/templates
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/trac.wordpress.org/templates/site-ticket.html

    r3140 r3147  
    3131    for i in xrange(0, len(fields)):
    3232      fields_map[ fields[i]['name'] ] = i
     33
     34  import re
     35  def wporg_sanitize_user_nicename(str):
     36    str = str.lower()
     37    str = re.sub(r'[^%a-z0-9\x80-\xff _-]', '', str)
     38    str = str.strip()
     39    str = re.sub(r'\s+', '-', str)
     40    str = re.sub(r'-+', '-', str)
     41    str = re.sub(r'_+', '_', str)
     42    return str;
    3343?>
    3444
  • sites/trunk/trac.wordpress.org/templates/site.html

    r3144 r3147  
    3131    except (IndexError, KeyError):
    3232        pass
    33 
    34     import re
    35     def wporg_sanitize_user_nicename(str):
    36         str = str.lower()
    37         str = re.sub(r'[^%a-z0-9\x80-\xff _-]', '', str)
    38         str = str.strip()
    39         str = re.sub(r'\s+', '-', str)
    40         str = re.sub(r'-+', '-', str)
    41         str = re.sub(r'_+', '_', str)
    42         return str;
    43 
    4433?>
    4534
Note: See TracChangeset for help on using the changeset viewer.