Use preg_match more efficiently. props solarissmoke, fixes #17287.

git-svn-id: https://develop.svn.wordpress.org/trunk@18524 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2011-08-10 19:18:18 +00:00
parent 0c5290d9e3
commit 666b55d3c0
1 changed files with 1 additions and 4 deletions

View File

@ -646,13 +646,10 @@ function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') {
if (! is_subdomain_install() )
$illegal_names = array_merge($illegal_names, apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) ) );
if ( empty( $blogname ) )
$errors->add('blogname', __('Please enter a site name'));
$maybe = array();
preg_match( '/[a-z0-9]+/', $blogname, $maybe );
if ( $blogname != $maybe[0] )
if ( preg_match( '/[^a-z0-9]+/', $blogname ) )
$errors->add('blogname', __('Only lowercase letters and numbers allowed'));
if ( in_array( $blogname, $illegal_names ) == true )