Skip to content

Commit 80e7235

Browse files
committed
Add setting to control loading of Vimeo
1 parent bd15fc7 commit 80e7235

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/inc/settings.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ function ableplayer_settings_field( $args = array(), $context = 'settings' ) {
156156
case 'checkbox-single':
157157
$checked = checked( 'true', ableplayer_get_settings( $name ), false );
158158
if ( $note ) {
159-
$note = "<div id='$id-note' class='ableplayer-input-description'><i class='dashicons dashicons-editor-help' aria-hidden='true'></i>" . sprintf( $note, "<code>$value</code>" ) . '</div>';
159+
$note = "<span id='$id-note' class='ableplayer-input-description'><i class='dashicons dashicons-editor-help' aria-hidden='true'></i>" . sprintf( $note, "<code>$value</code>" ) . '</span>';
160160
$aria = " aria-describedby='$id-note'";
161161
} else {
162162
$note = '';
@@ -261,6 +261,7 @@ function ableplayer_update_settings( $post ) {
261261
$default_speed = ( isset( $post['default_speed'] ) ) ? $post['default_speed'] : 'animals';
262262
$seek_interval = ( isset( $post['seek_interval'] ) && $post['seek_interval'] > 5 ) ? absint( $post['seek_interval'] ) : '';
263263
$default_heading = ( isset( $post['default_heading'] ) && 'auto' !== $post['default_heading'] ) ? absint( $post['default_heading'] ) : 'auto';
264+
$vimeo = ( ! empty( $post['vimeo'] ) && 'on' === $post['vimeo'] ) ? 'true' : 'false';
264265

265266
$settings['replace_video'] = $replace_video;
266267
$settings['replace_audio'] = $replace_audio;
@@ -274,6 +275,7 @@ function ableplayer_update_settings( $post ) {
274275
$settings['hide_controls'] = $hide_controls;
275276
$settings['default_speed'] = $default_speed;
276277
$settings['default_heading'] = $default_heading;
278+
$settings['vimeo'] = $vimeo;
277279

278280
ableplayer_update_options( $settings );
279281
}
@@ -317,11 +319,24 @@ function ableplayer_settings_form() {
317319
<input type="hidden" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( 'ableplayer-nonce' ) ); ?>" />
318320
<p>
319321
<?php
322+
ableplayer_settings_field(
323+
array(
324+
'name' => 'vimeo',
325+
'label' => __( 'Load the Vimeo player scripts globally.', 'ableplayer' ),
326+
'type' => 'checkbox-single',
327+
'note' => __( 'Required to play media from Vimeo outside of the AblePlayer shortcode.', 'ableplayer' ),
328+
)
329+
);
330+
?>
331+
</p>
332+
<p>
333+
<?php
320334
ableplayer_settings_field(
321335
array(
322336
'name' => 'replace_video',
323337
'label' => __( 'Use Able Player for all <code>video</code> elements.', 'ableplayer' ),
324338
'type' => 'checkbox-single',
339+
'note' => __( 'Does not replace Vimeo or YouTube Embed blocks', 'ableplayer' )
325340
)
326341
);
327342
?>
@@ -367,6 +382,7 @@ function ableplayer_settings_form() {
367382
'name' => 'disable_elements',
368383
'label' => __( 'Disable MediaElement JS.', 'ableplayer' ),
369384
'type' => 'checkbox-single',
385+
'note' => __( 'Recommended if using any of the replacement options.', 'ableplayer' )
370386
)
371387
);
372388
?>
@@ -573,6 +589,7 @@ function ableplayer_default_settings() {
573589
'hide_controls' => 'false',
574590
'default_heading' => 'auto',
575591
'last_shortcode' => '',
592+
'vimeo' => 'false',
576593
);
577594

578595
return $settings;

0 commit comments

Comments
 (0)