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

git-svn-id: http://svn.automattic.com/wordpress/trunk@18524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-08-10 19:18:18 +00:00
parent 5372572b3d
commit 90f6899dd1

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 )