Changeset 52309 for trunk/src/wp-includes/kses.php
- Timestamp:
- 12/03/2021 02:42:17 AM (5 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/kses.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/kses.php
r52304 r52309 2592 2592 * @return bool True if the URL is safe, false otherwise. 2593 2593 */ 2594 function _wp_kses_allow_pdf_objects( $ value) {2594 function _wp_kses_allow_pdf_objects( $url ) { 2595 2595 // We're not interested in URLs that contain query strings or fragments. 2596 if ( strpos( $ value, '?' ) !== false || strpos( $value, '#' ) !== false ) {2596 if ( strpos( $url, '?' ) !== false || strpos( $url, '#' ) !== false ) { 2597 2597 return false; 2598 2598 } 2599 2599 2600 2600 // If it doesn't have a PDF extension, it's not safe. 2601 if ( 0 !== substr_compare( $ value, '.pdf', -4, 4, true ) ) {2601 if ( 0 !== substr_compare( $url, '.pdf', -4, 4, true ) ) { 2602 2602 return false; 2603 2603 } … … 2605 2605 // If the URL host matches the current site's media URL, it's safe. 2606 2606 $upload_info = wp_upload_dir( null, false ); 2607 $upload_host = wp_parse_url( $upload_info['url'], PHP_URL_HOST ); 2608 if ( 0 === strpos( $value, "http://$upload_host/" ) || 0 === strpos( $value, "https://$upload_host/" ) ) { 2607 $parsed_url = wp_parse_url( $upload_info['url'] ); 2608 $upload_host = isset( $parsed_url['host'] ) ? $parsed_url['host'] : ''; 2609 $upload_port = isset( $parsed_url['port'] ) ? ':' . $parsed_url['port'] : ''; 2610 if ( 0 === strpos( $url, "http://$upload_host$upload_port/" ) || 0 === strpos( $url, "https://$upload_host$upload_port/" ) ) { 2609 2611 return true; 2610 2612 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)