Skip to:
Content

BuddyPress.org

Changeset 8670


Ignore:
Timestamp:
07/23/2014 01:05:39 PM (12 years ago)
Author:
boonebgorges
Message:

Remove URL-specific pre-validation from xprofile_set_field_data()

This validation is intended to catch URL submissions that do not have a scheme
(​http://) attached, and to add it preemptively. However, we want to add this
validation in a more centralized location than here.

See #5501

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-functions.php

    r8638 r8670  
    324324        }
    325325
    326         /**
    327          * If the field type is a URL and doesn't appear to contain a scheme,
    328          * we presume it needs http:// appended (unless a relative link starting
    329          * with / or a php file).
    330          */
    331         if ( 'url' === $field_type ) {
    332                 if (   ( strpos( $value, ':'  ) === false )
    333                         && ( substr( $value, 0, 1 ) !== '/' )
    334                         && ( substr( $value, 0, 1 ) !== '#' )
    335                         && ! preg_match( '/^[a-z0-9-]+?\.php/i', $value )
    336                 ) {
    337                         $value = 'http://' . $value;
    338                 }
    339         }
    340 
    341326        // Check the value is in an accepted format for this form field.
    342327        if ( ! $field_type_obj->is_valid( $value ) ) {
Note: See TracChangeset for help on using the changeset viewer.