Skip to content

Commit 9514a24

Browse files
committed
PHPCS checks.
1 parent 5440d57 commit 9514a24

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

src/ableplayer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,8 @@ function ableplayer_shortcode( $atts, $content = null ) {
427427
return false;
428428
} else {
429429
if ( $all_atts['media-id'] ) {
430-
// If Video ID is set but is not a valid URL,
431-
$media_id = ( is_numeric($all_atts['media-id'] ) ) ? wp_get_attachment_url( $all_atts['media-id'] ) : $all_atts['media-id'];
430+
// If Video ID is set but is not a valid URL, return.
431+
$media_id = ( is_numeric( $all_atts['media-id'] ) ) ? wp_get_attachment_url( $all_atts['media-id'] ) : $all_atts['media-id'];
432432
if ( ! $media_id ) {
433433
return false;
434434
} else {
@@ -450,12 +450,12 @@ function ableplayer_shortcode( $atts, $content = null ) {
450450
foreach ( $kinds as $kind => $default_label ) {
451451
$track = '';
452452
if ( ! empty( $all_atts[ $kind ] ) ) {
453-
$data = explode( '|', $all_atts[ $kind ] );
453+
$data = explode( '|', $all_atts[ $kind ] );
454454
if ( empty( $data[0] ) ) {
455455
continue;
456456
}
457457
// Optional lang and language.
458-
$srclang = ( isset( $data[1] ) && ! empty( $data[1] ) ) ? $data[1] : $default_lang;
458+
$srclang = ( isset( $data[1] ) && ! empty( $data[1] ) ) ? $data[1] : $default_lang;
459459
$srclabel = ( isset( $data[2] ) && ! empty( $data[2] ) ) ? $data[2] : $default_label;
460460
$src = ( is_numeric( $data[0] ) ) ? wp_get_attachment_url( $data[0] ) : $data[0];
461461
$track = '<track kind="' . $kind . '" srclang="' . esc_attr( $srclang ) . '" srclabel="' . esc_attr( $srclabel ) . '" src="' . esc_url( $src ) . '">';

src/inc/generator.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ function ableplayer_generate( $format = 'shortcode' ) {
2424
if ( ! wp_verify_nonce( $nonce, 'ableplayer-nonce' ) ) {
2525
wp_die( 'Invalid nonce' );
2626
}
27-
$string = '';
28-
$array = array();
27+
$string = '';
28+
$array = array();
2929
$shortcode = 'ableplayer';
3030
$keys = array( 'youtube-id', 'vimeo-id', 'media-id', 'poster', 'captions', 'subtitles', 'descriptions', 'chapters', 'autoplay', 'loop', 'playsinline', 'hidecontrols', 'heading', 'speed', 'start', 'volume', 'seekinterval' );
3131
$post = map_deep( $_POST, 'sanitize_text_field' );
@@ -73,7 +73,6 @@ function ableplayer_generate( $format = 'shortcode' ) {
7373
/**
7474
* Form to create a shortcode
7575
*
76-
* @param string $type Type of shortcode to reproduce.
7776
* @param array $data Data submitted from shortcode generator.
7877
*/
7978
function ableplayer_generator( $data = array() ) {
@@ -99,7 +98,7 @@ function ableplayer_generator_fields( $data ) {
9998
}
10099
$message = isset( $params['message'] ) ? $params['message'] : __( 'Generate an <code>[ableplayer]</code> shortcode.', 'ableplayer' );
101100
$message_type = isset( $params['type'] ) ? $params['type'] : 'success';
102-
$shortcode = isset( $params['shortcode'] ) ? $params['shortcode'] : "[ableplayer]";
101+
$shortcode = isset( $params['shortcode'] ) ? $params['shortcode'] : '[ableplayer]';
103102
$last_shortcode = ableplayer_get_settings( 'last_shortcode' );
104103
$shortcode = ( ! isset( $params['shortcode'] ) && $last_shortcode ) ? "[$last_shortcode]" : $shortcode;
105104
?>
@@ -111,7 +110,7 @@ function ableplayer_generator_fields( $data ) {
111110
array(
112111
'type' => $message_type,
113112
)
114-
);
113+
);
115114
?>
116115
<div><input type="hidden" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( 'ableplayer-nonce' ) ); ?>"/></div>
117116
<?php
@@ -131,9 +130,9 @@ function ableplayer_generator_fields( $data ) {
131130
<?php
132131
ableplayer_settings_field(
133132
array(
134-
'name' => 'source_type',
135-
'label' => __( 'Video Source Type', 'ableplayer' ),
136-
'type' => 'select',
133+
'name' => 'source_type',
134+
'label' => __( 'Video Source Type', 'ableplayer' ),
135+
'type' => 'select',
137136
'default' => array(
138137
'youtube' => 'YouTube',
139138
'vimeo' => 'Vimeo',
@@ -350,9 +349,9 @@ function ableplayer_generator_fields( $data ) {
350349
<?php
351350
ableplayer_settings_field(
352351
array(
353-
'name' => 'heading',
354-
'label' => __( 'Hidden heading level', 'ableplayer' ),
355-
'type' => 'select',
352+
'name' => 'heading',
353+
'label' => __( 'Hidden heading level', 'ableplayer' ),
354+
'type' => 'select',
356355
'default' => array(
357356
'auto' => __( 'Automatically assigned', 'ableplayer' ),
358357
'0' => __( 'No heading', 'ableplayer' ),
@@ -369,12 +368,12 @@ function ableplayer_generator_fields( $data ) {
369368
<?php
370369
ableplayer_settings_field(
371370
array(
372-
'name' => 'speed',
373-
'label' => __( 'Speed selection control', 'ableplayer' ),
374-
'type' => 'select',
371+
'name' => 'speed',
372+
'label' => __( 'Speed selection control', 'ableplayer' ),
373+
'type' => 'select',
375374
'default' => array(
376375
'animals' => __( 'Animals: Tortoise and Hare', 'ableplayer' ),
377-
'arrows' => __( 'Arrows', 'ableplayer' ),
376+
'arrows' => __( 'Arrows', 'ableplayer' ),
378377
),
379378
),
380379
'generator'

src/inc/settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function ableplayer_update_setting( $key, $value = '' ) {
5050
/**
5151
* Generate input & field for an AblePlayer setting.
5252
*
53-
* @param array $args {
53+
* @param array $args {
5454
* Array of settings arguments.
5555
*
5656
* @type string $name Name of the option used in name attribute. Required.

0 commit comments

Comments
 (0)