Changeset 10832
- Timestamp:
- 03/18/2021 08:33:16 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-markdown/inc/class-importer.php
r10820 r10832 480 480 $html = apply_filters( 'wporg_markdown_after_transform', $html, $this->get_post_type() ); 481 481 482 add_filter( 'wp_kses_allowed_html', [ $this, 'wp_kses_allow_links' ], 10, 2 ); 483 482 484 $post_data = array( 483 485 'ID' => $post_id, … … 486 488 ); 487 489 490 remove_filter( 'wp_kses_allowed_html', [ $this, 'wp_kses_allow_links' ], 10 ); 491 488 492 $fields_from_manifest = $this->update_post_from_manifest( $post_id, $title, false ); 489 493 if ( $fields_from_manifest ) { … … 497 501 498 502 return true; 503 } 504 505 /** 506 * Ensures that the 'a' tag and certain of its attributes are allowed in 507 * posts if not already. 508 * 509 * Supported 'a' attributes are those defined for `$allowedposttags` by default. 510 * 511 * This is necessary since the 'a' tag is being removed somewhere along the way. 512 * 513 * @param array[]|string $allowed_tags Allowed HTML tags and their attributes 514 * or the context to judge allowed tags by. 515 * @param string $context Context name. 516 * @return array[]|string 517 */ 518 public function wp_kses_allow_links( $allowed_tags, $context ) { 519 if ( 'post' === $context && is_array( $allowed_tags ) && empty( $allowed_tags[ 'a' ] ) ) { 520 $allowed_tags['a'] = [ 521 'href' => true, 522 'rel' => true, 523 'rev' => true, 524 'name' => true, 525 'target' => true, 526 'download' => [ 527 'valueless' => 'y', 528 ], 529 ]; 530 } 531 532 return $allowed_tags; 499 533 } 500 534
Note: See TracChangeset
for help on using the changeset viewer.