| 1097 | * Adds blank string to all HTML A empty elements in content. |
| 1098 | * |
| 1099 | * @since 3.0.0 |
| 1100 | * |
| 1101 | * @param string $text Content that may contain HTML A elements. |
| 1102 | * @return string Converted content. |
| 1103 | */ |
| 1104 | function fill_empty_links( $text ) |
| 1105 | { |
| 1106 | return preg_replace_callback( "#<a\s[^>]*href=(\"?)([^\" >]*?)\\1[^>]*>[\s|\ ]*<\/a>#i", 'fill_empty_links_callback', $text); |
| 1107 | } |
| 1108 | //[\s|\ ]* |
| 1109 | /** |
| 1110 | * Callback to add a visual placeholder in comments having empty anchor text |
| 1111 | * |
| 1112 | * @since 3.0.0 |
| 1113 | * |
| 1114 | * @param string $matches Single match |
| 1115 | * @return string Returns a formatted anchor tag with the URL of the link as the anchor text on success. Returns false on failure |
| 1116 | */ |
| 1117 | function fill_empty_links_callback( $matches ) |
| 1118 | { |
| 1119 | if( !$matches[2] ) |
| 1120 | return false; |
| 1121 | |
| 1122 | return sprintf( '<a href="%1$s">%1$s</a>', esc_url( $matches[2] ) ); |
| 1123 | } |
| 1124 | |
| 1125 | /** |