---
.../class-bp-xprofile-field-type-telephone.php | 49 ++++++++++++++--------
.../classes/class-bp-xprofile-field-type-url.php | 22 ++++++++--
2 files changed, 49 insertions(+), 22 deletions(-)
diff --git a/bp-xprofile/classes/class-bp-xprofile-field-type-telephone.php b/bp-xprofile/classes/class-bp-xprofile-field-type-telephone.php
index 275bb3ab..0951a28b 100644
a
|
b
|
class BP_XProfile_Field_Type_Telephone extends BP_XProfile_Field_Type { |
130 | 130 | * @return string URL converted to a link. |
131 | 131 | */ |
132 | 132 | public static function display_filter( $field_value, $field_id = '' ) { |
133 | | $url = wp_strip_all_tags( $field_value ); |
134 | | $parts = parse_url( $url ); |
135 | 133 | |
136 | | // Add the tel:// protocol to the field value. |
137 | | if ( isset( $parts['scheme'] ) ) { |
138 | | if ( strtolower( $parts['scheme'] ) !== 'tel' ) { |
139 | | $scheme = preg_quote( $parts['scheme'], '#' ); |
140 | | $url = preg_replace( '#^' . $scheme . '#i', 'tel', $url ); |
| 134 | $do_autolink = bp_xprofile_get_meta( $field_id, 'field', 'do_autolink' ); |
| 135 | |
| 136 | $url = wp_strip_all_tags( $field_value ); |
| 137 | |
| 138 | if ( 'off' != $do_autolink ) { |
| 139 | |
| 140 | $parts = parse_url( $url ); |
| 141 | |
| 142 | // Add the tel:// protocol to the field value. |
| 143 | if ( isset( $parts['scheme'] ) ) { |
| 144 | if ( strtolower( $parts['scheme'] ) !== 'tel' ) { |
| 145 | $scheme = preg_quote( $parts['scheme'], '#' ); |
| 146 | $url = preg_replace( '#^' . $scheme . '#i', 'tel', $url ); |
| 147 | } |
| 148 | |
| 149 | $url_text = preg_replace( '#^tel://#i', '', $url ); |
| 150 | |
| 151 | } else { |
| 152 | $url_text = $url; |
| 153 | $url = 'tel://' . $url; |
141 | 154 | } |
142 | | |
143 | | $url_text = preg_replace( '#^tel://#i', '', $url ); |
144 | | |
| 155 | |
| 156 | return sprintf( |
| 157 | '<a href="%1$s" rel="nofollow">%2$s</a>', |
| 158 | esc_url( $url, array( 'tel' ) ), |
| 159 | esc_html( $url_text ) |
| 160 | ); |
| 161 | |
145 | 162 | } else { |
146 | | $url_text = $url; |
147 | | $url = 'tel://' . $url; |
| 163 | |
| 164 | return esc_html( $url ); |
| 165 | |
148 | 166 | } |
149 | | |
150 | | return sprintf( |
151 | | '<a href="%1$s" rel="nofollow">%2$s</a>', |
152 | | esc_url( $url, array( 'tel' ) ), |
153 | | esc_html( $url_text ) |
154 | | ); |
| 167 | |
155 | 168 | } |
156 | 169 | } |
diff --git a/bp-xprofile/classes/class-bp-xprofile-field-type-url.php b/bp-xprofile/classes/class-bp-xprofile-field-type-url.php
index 226b4d1c..02d2be7d 100644
a
|
b
|
class BP_XProfile_Field_Type_URL extends BP_XProfile_Field_Type { |
170 | 170 | * @return string URL converted to a link. |
171 | 171 | */ |
172 | 172 | public static function display_filter( $field_value, $field_id = '' ) { |
173 | | $link = strip_tags( $field_value ); |
174 | | $no_scheme = preg_replace( '#^https?://#', '', rtrim( $link, '/' ) ); |
175 | | $url_text = str_replace( $link, $no_scheme, $field_value ); |
176 | | return '<a href="' . esc_url( $field_value ) . '" rel="nofollow">' . esc_html( $url_text ) . '</a>'; |
| 173 | |
| 174 | $do_autolink = bp_xprofile_get_meta( $field_id, 'field', 'do_autolink' ); |
| 175 | |
| 176 | $url = wp_strip_all_tags( $field_value ); |
| 177 | |
| 178 | $link = strip_tags( $field_value ); |
| 179 | |
| 180 | if ( 'off' != $do_autolink ) { |
| 181 | |
| 182 | $no_scheme = preg_replace( '#^https?://#', '', rtrim( $link, '/' ) ); |
| 183 | $url_text = str_replace( $link, $no_scheme, $field_value ); |
| 184 | return '<a href="' . esc_url( $field_value ) . '" rel="nofollow">' . esc_html( $url_text ) . '</a>'; |
| 185 | |
| 186 | } else { |
| 187 | |
| 188 | return $link; |
| 189 | |
| 190 | } |
177 | 191 | } |
178 | 192 | } |