Skip to:
Content

BuddyPress.org

Changeset 8638


Ignore:
Timestamp:
07/17/2014 02:31:55 AM (7 years ago)
Author:
johnjamesjacoby
Message:

Add the URL profile field type to bp-xprofile-functions.php. See #5501.

File:
1 edited

Legend:

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

    r8634 r8638  
    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
    326341    // Check the value is in an accepted format for this form field.
    327342    if ( ! $field_type_obj->is_valid( $value ) ) {
Note: See TracChangeset for help on using the changeset viewer.