Changeset 55495
- Timestamp:
- 03/09/2023 12:18:29 AM (22 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment-template.php
r55398 r55495 240 240 * @since 6.2.0 241 241 * 242 * @param string[] $rel_parts An array of strings representing the rel 243 * tags which will be joined into the anchor's 244 * rel attribute. 245 * @param WP_Comment $comment The comment object 242 * @param string[] $rel_parts An array of strings representing the rel tags 243 * which will be joined into the anchor's rel attribute. 244 * @param WP_Comment $comment The comment object. 246 245 */ 247 246 $rel_parts = apply_filters( 'comment_author_link_rel', $rel_parts, $comment ); … … 249 248 $rel = implode( ' ', $rel_parts ); 250 249 $rel = esc_attr( $rel ); 251 // empty space before rel necessary for later sprintf.250 // Empty space before 'rel' is necessary for later sprintf(). 252 251 $rel = ! empty( $rel ) ? sprintf( ' rel="%s"', $rel ) : ''; 253 252 -
trunk/src/wp-includes/formatting.php
r55414 r55495 2919 2919 2920 2920 $rel_attr = _make_clickable_rel_attr( $url ); 2921 return $matches[1] . "<a href=\"$url\"$rel_attr>$url</a>" . $suffix; 2922 2921 2922 return $matches[1] . "<a href=\"{$url}\"{$rel_attr}>{$url}</a>" . $suffix; 2923 2923 } 2924 2924 … … 2952 2952 2953 2953 $rel_attr = _make_clickable_rel_attr( $dest ); 2954 return $matches[1] . "<a href='{$dest}'{$rel_attr}>{$dest}</a>{$ret}"; 2954 2955 return $matches[1] . "<a href=\"{$dest}\"{$rel_attr}>{$dest}</a>{$ret}"; 2955 2956 } 2956 2957 … … 2968 2969 function _make_email_clickable_cb( $matches ) { 2969 2970 $email = $matches[2] . '@' . $matches[3]; 2970 return $matches[1] . "<a href=\"mailto:$email\">$email</a>"; 2971 2972 return $matches[1] . "<a href=\"mailto:{$email}\">{$email}</a>"; 2971 2973 } 2972 2974 … … 2980 2982 */ 2981 2983 function _make_clickable_rel_attr( $url ) { 2982 2983 2984 $rel_parts = array(); 2984 2985 $scheme = strtolower( wp_parse_url( $url, PHP_URL_SCHEME ) ); … … 3010 3011 3011 3012 return $rel_attr; 3012 3013 3013 } 3014 3014 -
trunk/tests/phpunit/tests/formatting/makeClickable.php
r55289 r55495 109 109 ); 110 110 $urls_expected = array( 111 "<a href='http://www.wordpress.org' rel=\"nofollow\">http://www.wordpress.org</a>",112 "There was a spoon named <a href='http://www.wordpress.org' rel=\"nofollow\">http://www.wordpress.org</a>. Alice!",113 "There was a spoon named <a href='http://www.wordpress.org' rel=\"nofollow\">http://www.wordpress.org</a>, said Alice.",114 "There was a spoon named <a href='http://www.wordpress.org' rel=\"nofollow\">http://www.wordpress.org</a>; said Alice.",115 "There was a spoon named <a href='http://www.wordpress.org' rel=\"nofollow\">http://www.wordpress.org</a>: said Alice.",116 "There was a spoon named <a href='http://www.wordpress.org' rel=\"nofollow\">http://www.wordpress.org</a>) said Alice.",111 '<a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>', 112 'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>. Alice!', 113 'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>, said Alice.', 114 'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>; said Alice.', 115 'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>: said Alice.', 116 'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>) said Alice.', 117 117 ); 118 118 … … 136 136 ); 137 137 $urls_expected = array( 138 "<a href='http://www.wordpress.org' rel=\"nofollow\">http://www.wordpress.org</a>",139 "There was a spoon named <a href='http://www.wordpress.org' rel=\"nofollow\">http://www.wordpress.org</a>.",140 "There was a spoon named <a href='http://www.wordpress.org' rel=\"nofollow\">http://www.wordpress.org</a>,",141 "There was a spoon named <a href='http://www.wordpress.org' rel=\"nofollow\">http://www.wordpress.org</a>;",142 "There was a spoon named <a href='http://www.wordpress.org' rel=\"nofollow\">http://www.wordpress.org</a>:",143 "There was a spoon named <a href='http://www.wordpress.org' rel=\"nofollow\">http://www.wordpress.org</a>)",138 '<a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>', 139 'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>.', 140 'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>,', 141 'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>;', 142 'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>:', 143 'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>)', 144 144 ); 145 145 … … 440 440 441 441 public function data_add_rel_ugc_in_comments() { 442 443 442 $home_url_http = set_url_scheme( home_url(), 'http' ); 444 443 $home_url_https = set_url_scheme( home_url(), 'https' ); … … 452 451 array( 453 452 'www.wordpress.org', 454 '<p><a href= \'http://www.wordpress.org\'rel="nofollow ugc">http://www.wordpress.org</a>',453 '<p><a href="http://www.wordpress.org" rel="nofollow ugc">http://www.wordpress.org</a>', 455 454 ), 456 455 // @ticket 56444 457 456 array( 458 457 'www.example.org', 459 '<p><a href= \'http://www.example.org\'rel="nofollow ugc">http://www.example.org</a>',458 '<p><a href="http://www.example.org" rel="nofollow ugc">http://www.example.org</a>', 460 459 ), 461 460 array(
Note: See TracChangeset
for help on using the changeset viewer.