Customize: Remove Vimeo validation for external videos.

Following [39128], this removes the validation logic for Vimeo URLs from
`_validate_external_header_video()` since WP does not support the
display of videos from Vimeo by default.

This also includes a change to using `esc_url_raw()` instead of `esc_url()`
on the URL value to avoid unexpected behavior from the inclusion of HTML
entities.

Props peterwilsoncc, westonruter.
Fixes #38544.

git-svn-id: https://develop.svn.wordpress.org/trunk@39148 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe McGill 2016-11-05 18:31:06 +00:00
parent 8a6fa93b84
commit 8e7ab859fd

View File

@ -3768,11 +3768,10 @@ final class WP_Customize_Manager {
* @return mixed
*/
public function _validate_external_header_video( $validity, $value ) {
$video = esc_url( $value );
$video = esc_url_raw( $value );
if ( $video ) {
if ( ! preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video )
&& ! preg_match( '#^https?://(.+\.)?vimeo\.com/.*#', $video ) ) {
$validity->add( 'invalid_url', __( 'Please enter a valid YouTube or Vimeo video URL.' ) );
if ( ! preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video ) ) {
$validity->add( 'invalid_url', __( 'Please enter a valid YouTube URL.' ) );
}
}
return $validity;