Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass sizing attribute to determine if responsiveness should be enabled #249

Merged
merged 1 commit into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions includes/class-bc-playlist-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public static function bc_playlist( $atts ) {
'autoplay' => '',
'mute' => '',
'embed' => '',
'sizing' => 'responsive',
'padding_top' => '56.25%',
'min_width' => '0px',
'max_width' => '100%',
Expand Down
8 changes: 5 additions & 3 deletions includes/class-bc-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ public static function get_video_player( $atts ) {
$id = self::sanitize_id( $atts['video_id'] );
$height = sanitize_text_field( $atts['height'] );
$width = sanitize_text_field( $atts['width'] );
$sizing = sanitize_text_field( $atts['sizing'] );
$min_width = sanitize_text_field( $atts['min_width'] );
$max_width = sanitize_text_field( $atts['max_width'] );
$padding_top = sanitize_text_field( $atts['padding_top'] );
Expand Down Expand Up @@ -863,7 +864,7 @@ class="vjs-fluid"
data-usage="<?php echo esc_attr( self::get_usage_data() ); ?>javascript"
data-embed="default" class="video-js"
controls <?php echo esc_attr( $playsinline ); ?> <?php echo esc_attr( $autoplay ); ?> <?php echo esc_attr( $mute ); ?>
style="width: <?php echo esc_attr( $width ); ?>; height: <?php echo esc_attr( $height ); ?>; position: absolute; top: 0; bottom: 0; right: 0; left: 0;">
style="width: <?php echo 'responsive' !== $sizing ? esc_attr( $width ) : '100%'; ?>; height: <?php echo esc_attr( $height ); ?>; position: absolute; top: 0; bottom: 0; right: 0; left: 0;">
</video>

<script src="<?php echo esc_url( $js_src ); ?>"></script>
Expand Down Expand Up @@ -892,7 +893,7 @@ class="vjs-fluid"
allowfullscreen
webkitallowfullscreen
mozallowfullscreen
style="width: <?php echo esc_attr( $width ); ?>; height: <?php echo esc_attr( $height ); ?>; position: absolute; top: 0; bottom: 0; right: 0; left: 0;">
style="width: <?php echo 'responsive' !== $sizing ? esc_attr( $width ) : '100%'; ?>; height: <?php echo esc_attr( $height ); ?>; position: absolute; top: 0; bottom: 0; right: 0; left: 0;">
</iframe>
</div>
</div>
Expand Down Expand Up @@ -960,6 +961,7 @@ public static function get_playlist_player( $atts ) {
$id = self::sanitize_id( $atts['playlist_id'] );
$height = sanitize_text_field( $atts['height'] );
$width = sanitize_text_field( $atts['width'] );
$sizing = sanitize_text_field( $atts['sizing'] );
$min_width = sanitize_text_field( $atts['min_width'] );
$max_width = sanitize_text_field( $atts['max_width'] );
$padding_top = sanitize_text_field( $atts['padding_top'] );
Expand Down Expand Up @@ -1116,7 +1118,7 @@ class="video-js"
allowfullscreen
webkitallowfullscreen
mozallowfullscreen
style="width: <?php echo esc_attr( $width ); ?>; height: <?php echo esc_attr( $height ); ?>; position: absolute; top: 0; bottom: 0; right: 0; left: 0;">
style="width: <?php echo 'responsive' !== $sizing ? esc_attr( $width ) : '100%'; ?>; height: <?php echo esc_attr( $height ); ?>; position: absolute; top: 0; bottom: 0; right: 0; left: 0;">
</iframe>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions includes/class-bc-video-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static function bc_video( $atts ) {
'autoplay' => '',
'mute' => '',
'embed' => '',
'sizing' => 'responsive',
'padding_top' => '56.25%',
'min_width' => '0px',
'max_width' => '100%',
Expand Down