- probably fixed: #1084;

This commit is contained in:
Nikita Sinelnikov
2022-12-13 23:39:42 +02:00
parent 8b2770b12e
commit 172e681714
2 changed files with 16 additions and 9 deletions
+6 -1
View File
@@ -87,7 +87,12 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
foreach ( $social as $k => $arr ) {
if ( um_profile( $k ) ) {
$match = is_array( $arr['match'] ) ? $arr['match'][0] : $arr['match']; ?>
if ( array_key_exists( 'match' , $arr ) ) {
$match = is_array( $arr['match'] ) ? $arr['match'][0] : $arr['match'];
} else {
$match = null;
}
?>
<a href="<?php echo esc_url( um_filtered_social_link( $k, $match ) ); ?>"
style="background: <?php echo esc_attr( $arr['color'] ); ?>;" target="_blank" class="um-tip-n"
+10 -8
View File
@@ -915,18 +915,20 @@ function um_user_submited_display( $k, $title, $data = array(), $style = true )
* Show filtered social link
*
* @param string $key
* @param string $match
* @param null|string $match
*
* @return string
*/
function um_filtered_social_link( $key, $match ) {
function um_filtered_social_link( $key, $match = null ) {
$value = um_profile( $key );
$submatch = str_replace( 'https://', '', $match );
$submatch = str_replace( 'http://', '', $submatch );
if ( strstr( $value, $submatch ) ) {
$value = 'https://' . $value;
} elseif ( strpos( $value, 'http' ) !== 0 ) {
$value = $match . $value;
if ( ! empty( $match ) ) {
$submatch = str_replace( 'https://', '', $match );
$submatch = str_replace( 'http://', '', $submatch );
if ( strstr( $value, $submatch ) ) {
$value = 'https://' . $value;
} elseif ( strpos( $value, 'http' ) !== 0 ) {
$value = $match . $value;
}
}
$value = str_replace( 'https://https://', 'https://', $value );
$value = str_replace( 'http://https://', 'https://', $value );