diff options
Diffstat (limited to 'plugins/jetpack/modules/shortcodes/youtube.php')
-rw-r--r-- | plugins/jetpack/modules/shortcodes/youtube.php | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/plugins/jetpack/modules/shortcodes/youtube.php b/plugins/jetpack/modules/shortcodes/youtube.php index d5db874d..d227fa14 100644 --- a/plugins/jetpack/modules/shortcodes/youtube.php +++ b/plugins/jetpack/modules/shortcodes/youtube.php @@ -177,14 +177,17 @@ function youtube_id( $url ) { $input_w = ( isset( $qargs['w'] ) && intval( $qargs['w'] ) ) ? intval( $qargs['w'] ) : 0; $input_h = ( isset( $qargs['h'] ) && intval( $qargs['h'] ) ) ? intval( $qargs['h'] ) : 0; - $default_width = get_option('embed_size_w'); + // If we have $content_width, use it. + if ( ! empty( $content_width ) ) { + $default_width = $content_width; + } else { + // Otherwise get default width from the old, now deprecated embed_size_w option. + $default_width = get_option('embed_size_w'); + } + // If we don't know those 2 values use a hardcoded width.h if ( empty( $default_width ) ) { - if ( ! empty( $content_width ) ) { - $default_width = $content_width; - } else { - $default_width = 640; - } + $default_width = 640; } if ( $input_w > 0 && $input_h > 0 ) { @@ -363,12 +366,10 @@ add_action( 'init', 'wpcom_youtube_embed_crazy_url_init' ); * * @param int get_option('embed_autourls') Option to automatically embed all plain text URLs. */ -if ( apply_filters( 'jetpack_comments_allow_oembed', get_option('embed_autourls') ) ) { +if ( ! is_admin() && apply_filters( 'jetpack_comments_allow_oembed', true ) ) { // We attach wp_kses_post to comment_text in default-filters.php with priority of 10 anyway, so the iframe gets filtered out. - if ( ! is_admin() ) { - // Higher priority because we need it before auto-link and autop get to it - add_filter( 'comment_text', 'youtube_link', 1 ); - } + // Higher priority because we need it before auto-link and autop get to it + add_filter( 'comment_text', 'youtube_link', 1 ); } /** |