BP_XProfile_Field_Type_URL::display_filter( string $field_value, string|int $field_id = '' )

Format URL values for display.


Parameters Parameters

$field_value

(string) (Required) The URL value, as saved in the database.

$field_id

(string|int) (Optional) ID of the field.

Default value: ''


Top ↑

Return Return

(string) URL converted to a link.


Source Source

File: bp-xprofile/classes/class-bp-xprofile-field-type-url.php

	public static function display_filter( $field_value, $field_id = '' ) {
		$link      = strip_tags( $field_value );
		$no_scheme = preg_replace( '#^https?://#', '', rtrim( $link, '/' ) );
		$url_text  = str_replace( $link, $no_scheme, $field_value );
		return '<a href="' . esc_url( $field_value ) . '" rel="nofollow">' . esc_html( $url_text ) . '</a>';
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.4.0 Added the $field_id parameter.
2.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.