関数 _make_url_clickable_cb()
2014/12/11
関数 _make_url_clickable_cb()
定義ファイル :/blog/wp-includes/formatting.php 4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | function _make_url_clickable_cb($matches) { $url = $matches[2]; if ( ')' == $matches[3] && strpos( $url, '(' ) ) { // If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, add the closing parenthesis to the URL. // Then we can let the parenthesis balancer do its thing below. $url .= $matches[3]; $suffix = ''; } else { $suffix = $matches[3]; } // Include parentheses in the URL only if paired while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) { $suffix = strrchr( $url, ')' ) . $suffix; $url = substr( $url, 0, strrpos( $url, ')' ) ); } $url = esc_url($url); if ( empty($url) ) return $matches[0]; return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix; } |