@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | // Exit if accessed directly. |
| 16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 16 | +if ( ! defined ( 'ABSPATH' ) ) { |
|
| 17 | 17 | exit; |
| 18 | 18 | } |
| 19 | 19 | |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | require_once( 'includes/class-ssp-frontend.php' ); |
| 23 | 23 | |
| 24 | 24 | global $ssp_admin, $ss_podcasting; |
| 25 | -$ssp_admin = new SSP_Admin( __FILE__, '1.15.1' ); |
|
| 26 | -$ss_podcasting = new SSP_Frontend( __FILE__, '1.15.1' ); |
|
| 25 | +$ssp_admin = new SSP_Admin ( __FILE__, '1.15.1' ); |
|
| 26 | +$ss_podcasting = new SSP_Frontend ( __FILE__, '1.15.1' ); |
|
| 27 | 27 | |
| 28 | -if ( is_admin() ) { |
|
| 28 | +if ( is_admin () ) { |
|
| 29 | 29 | global $ssp_settings; |
| 30 | 30 | require_once( 'includes/class-ssp-settings.php' ); |
| 31 | - $ssp_settings = new SSP_Settings( __FILE__ ); |
|
| 31 | + $ssp_settings = new SSP_Settings ( __FILE__ ); |
|
| 32 | 32 | } |
| 33 | 33 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // Exit if accessed directly. |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if ( ! defined ( 'ABSPATH' ) ) { |
|
| 4 | 4 | exit; |
| 5 | 5 | } |
| 6 | 6 | |
@@ -23,16 +23,16 @@ discard block |
||
| 23 | 23 | global $content_width, $ss_podcasting; |
| 24 | 24 | |
| 25 | 25 | // Get list of episode IDs for display from `episodes` parameter |
| 26 | - if ( ! empty( $params['episodes'] ) ) { |
|
| 26 | + if ( ! empty( $params[ 'episodes' ] ) ) { |
|
| 27 | 27 | // 'episodes' is explicitly ordered, unless you specify otherwise. |
| 28 | - if ( empty( $params['orderby'] ) ) { |
|
| 29 | - $params['orderby'] = 'post__in'; |
|
| 28 | + if ( empty( $params[ 'orderby' ] ) ) { |
|
| 29 | + $params[ 'orderby' ] = 'post__in'; |
|
| 30 | 30 | } |
| 31 | - $params['include'] = $params['episodes']; |
|
| 31 | + $params[ 'include' ] = $params[ 'episodes' ]; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // Parse shortcode attributes |
| 35 | - $atts = shortcode_atts( array( |
|
| 35 | + $atts = shortcode_atts ( array( |
|
| 36 | 36 | 'type' => 'audio', |
| 37 | 37 | 'series' => '', |
| 38 | 38 | 'order' => 'ASC', |
@@ -46,32 +46,32 @@ discard block |
||
| 46 | 46 | ), $params, 'podcast_playlist' ); |
| 47 | 47 | |
| 48 | 48 | // Included posts must be passed as an array |
| 49 | - if( $atts['include'] ) { |
|
| 50 | - $atts['include'] = explode( ',', $atts['include'] ); |
|
| 49 | + if ( $atts[ 'include' ] ) { |
|
| 50 | + $atts[ 'include' ] = explode ( ',', $atts[ 'include' ] ); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // Excluded posts must be passed as an array |
| 54 | - if( $atts['exclude'] ) { |
|
| 55 | - $atts['exclude'] = explode( ',', $atts['exclude'] ); |
|
| 54 | + if ( $atts[ 'exclude' ] ) { |
|
| 55 | + $atts[ 'exclude' ] = explode ( ',', $atts[ 'exclude' ] ); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Get all podcast post types |
| 59 | - $podcast_post_types = ssp_post_types( true ); |
|
| 59 | + $podcast_post_types = ssp_post_types ( true ); |
|
| 60 | 60 | |
| 61 | 61 | // Set up query arguments for fetching podcast episodes |
| 62 | 62 | $query_args = array( |
| 63 | 63 | 'post_status' => 'publish', |
| 64 | 64 | 'post_type' => $podcast_post_types, |
| 65 | 65 | 'posts_per_page' => -1, |
| 66 | - 'order' => $atts['order'], |
|
| 67 | - 'orderby' => $atts['orderby'], |
|
| 66 | + 'order' => $atts[ 'order' ], |
|
| 67 | + 'orderby' => $atts[ 'orderby' ], |
|
| 68 | 68 | 'ignore_sticky_posts' => true, |
| 69 | - 'post__in' => $atts['include'], |
|
| 70 | - 'post__not_in' => $atts['exclude'], |
|
| 69 | + 'post__in' => $atts[ 'include' ], |
|
| 70 | + 'post__not_in' => $atts[ 'exclude' ], |
|
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | 73 | // Make sure to only fetch episodes that have a media file |
| 74 | - $query_args['meta_query'] = array( |
|
| 74 | + $query_args[ 'meta_query' ] = array( |
|
| 75 | 75 | array( |
| 76 | 76 | 'key' => 'audio_file', |
| 77 | 77 | 'compare' => '!=', |
@@ -80,25 +80,25 @@ discard block |
||
| 80 | 80 | ); |
| 81 | 81 | |
| 82 | 82 | // Limit query to episodes in defined series only |
| 83 | - if ( $atts['series'] ) { |
|
| 83 | + if ( $atts[ 'series' ] ) { |
|
| 84 | 84 | |
| 85 | - $query_args['tax_query'] = array( |
|
| 85 | + $query_args[ 'tax_query' ] = array( |
|
| 86 | 86 | array( |
| 87 | 87 | 'taxonomy' => 'series', |
| 88 | 88 | 'field' => 'slug', |
| 89 | - 'terms' => $atts['series'], |
|
| 89 | + 'terms' => $atts[ 'series' ], |
|
| 90 | 90 | ), |
| 91 | 91 | ); |
| 92 | 92 | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Allow dynamic filtering of query args |
| 96 | - $query_args = apply_filters( 'ssp_podcast_playlist_query_args', $query_args ); |
|
| 96 | + $query_args = apply_filters ( 'ssp_podcast_playlist_query_args', $query_args ); |
|
| 97 | 97 | |
| 98 | 98 | // Fetch all episodes for display |
| 99 | - $episodes = get_posts( $query_args ); |
|
| 99 | + $episodes = get_posts ( $query_args ); |
|
| 100 | 100 | |
| 101 | - if( empty ( $episodes ) ) { |
|
| 101 | + if ( empty ( $episodes ) ) { |
|
| 102 | 102 | return; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -108,30 +108,30 @@ discard block |
||
| 108 | 108 | $default_height = 360; |
| 109 | 109 | |
| 110 | 110 | $theme_width = empty( $content_width ) ? $default_width : ( $content_width - $outer ); |
| 111 | - $theme_height = empty( $content_width ) ? $default_height : round( ( $default_height * $theme_width ) / $default_width ); |
|
| 111 | + $theme_height = empty( $content_width ) ? $default_height : round ( ( $default_height * $theme_width ) / $default_width ); |
|
| 112 | 112 | |
| 113 | 113 | $data = array( |
| 114 | - 'type' => $atts['type'], |
|
| 114 | + 'type' => $atts[ 'type' ], |
|
| 115 | 115 | // don't pass strings to JSON, will be truthy in JS |
| 116 | - 'tracklist' => wp_validate_boolean( $atts['tracklist'] ), |
|
| 117 | - 'tracknumbers' => wp_validate_boolean( $atts['tracknumbers'] ), |
|
| 118 | - 'images' => wp_validate_boolean( $atts['images'] ), |
|
| 116 | + 'tracklist' => wp_validate_boolean ( $atts[ 'tracklist' ] ), |
|
| 117 | + 'tracknumbers' => wp_validate_boolean ( $atts[ 'tracknumbers' ] ), |
|
| 118 | + 'images' => wp_validate_boolean ( $atts[ 'images' ] ), |
|
| 119 | 119 | 'artists' => false, |
| 120 | 120 | ); |
| 121 | 121 | |
| 122 | 122 | $tracks = array(); |
| 123 | 123 | foreach ( $episodes as $episode ) { |
| 124 | 124 | |
| 125 | - $url = $ss_podcasting->get_enclosure( $episode->ID ); |
|
| 126 | - if ( get_option( 'permalink_structure' ) ) { |
|
| 127 | - $url = $ss_podcasting->get_episode_download_link( $episode->ID ); |
|
| 128 | - $url = str_replace( 'podcast-download', 'podcast-player', $url ); |
|
| 125 | + $url = $ss_podcasting->get_enclosure ( $episode->ID ); |
|
| 126 | + if ( get_option ( 'permalink_structure' ) ) { |
|
| 127 | + $url = $ss_podcasting->get_episode_download_link ( $episode->ID ); |
|
| 128 | + $url = str_replace ( 'podcast-download', 'podcast-player', $url ); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // Get episode file type |
| 132 | - $ftype = wp_check_filetype( $url, wp_get_mime_types() ); |
|
| 132 | + $ftype = wp_check_filetype ( $url, wp_get_mime_types () ); |
|
| 133 | 133 | |
| 134 | - if( $episode->post_excerpt ) { |
|
| 134 | + if ( $episode->post_excerpt ) { |
|
| 135 | 135 | $episode_excerpt = $episode->post_excerpt; |
| 136 | 136 | } else { |
| 137 | 137 | $episode_excerpt = $episode->post_title; |
@@ -140,19 +140,19 @@ discard block |
||
| 140 | 140 | // Setup episode data for media player |
| 141 | 141 | $track = array( |
| 142 | 142 | 'src' => $url, |
| 143 | - 'type' => $ftype['type'], |
|
| 143 | + 'type' => $ftype[ 'type' ], |
|
| 144 | 144 | 'caption' => $episode->post_title, |
| 145 | 145 | 'title' => $episode_excerpt, |
| 146 | 146 | 'description' => $episode->post_content, |
| 147 | 147 | ); |
| 148 | 148 | |
| 149 | 149 | // We don't need the ID3 meta data here, but still need to set an empty array |
| 150 | - $track['meta'] = array(); |
|
| 150 | + $track[ 'meta' ] = array(); |
|
| 151 | 151 | |
| 152 | 152 | // Set video dimensions for player |
| 153 | - if ( 'video' === $atts['type'] ) { |
|
| 154 | - $track['dimensions'] = array( |
|
| 155 | - 'original' => compact( $default_width, $default_height ), |
|
| 153 | + if ( 'video' === $atts[ 'type' ] ) { |
|
| 154 | + $track[ 'dimensions' ] = array( |
|
| 155 | + 'original' => compact ( $default_width, $default_height ), |
|
| 156 | 156 | 'resized' => array( |
| 157 | 157 | 'width' => $theme_width, |
| 158 | 158 | 'height' => $theme_height |
@@ -161,37 +161,37 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | // Get episode image |
| 164 | - if ( $atts['images'] ) { |
|
| 165 | - $thumb_id = get_post_thumbnail_id( $episode->ID ); |
|
| 164 | + if ( $atts[ 'images' ] ) { |
|
| 165 | + $thumb_id = get_post_thumbnail_id ( $episode->ID ); |
|
| 166 | 166 | if ( ! empty( $thumb_id ) ) { |
| 167 | - list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'full' ); |
|
| 168 | - $track['image'] = compact( 'src', 'width', 'height' ); |
|
| 169 | - list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'thumbnail' ); |
|
| 170 | - $track['thumb'] = compact( 'src', 'width', 'height' ); |
|
| 167 | + list( $src, $width, $height ) = wp_get_attachment_image_src ( $thumb_id, 'full' ); |
|
| 168 | + $track[ 'image' ] = compact ( 'src', 'width', 'height' ); |
|
| 169 | + list( $src, $width, $height ) = wp_get_attachment_image_src ( $thumb_id, 'thumbnail' ); |
|
| 170 | + $track[ 'thumb' ] = compact ( 'src', 'width', 'height' ); |
|
| 171 | 171 | } else { |
| 172 | - $track['image'] = ''; |
|
| 173 | - $track['thumb'] = ''; |
|
| 172 | + $track[ 'image' ] = ''; |
|
| 173 | + $track[ 'thumb' ] = ''; |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - $tracks[] = $track; |
|
| 177 | + $tracks[ ] = $track; |
|
| 178 | 178 | } |
| 179 | - $data['tracks'] = $tracks; |
|
| 179 | + $data[ 'tracks' ] = $tracks; |
|
| 180 | 180 | |
| 181 | - $safe_type = esc_attr( $atts['type'] ); |
|
| 182 | - $safe_style = esc_attr( $atts['style'] ); |
|
| 181 | + $safe_type = esc_attr ( $atts[ 'type' ] ); |
|
| 182 | + $safe_style = esc_attr ( $atts[ 'style' ] ); |
|
| 183 | 183 | |
| 184 | 184 | static $instance = 0; |
| 185 | 185 | $instance++; |
| 186 | 186 | |
| 187 | - ob_start(); |
|
| 187 | + ob_start (); |
|
| 188 | 188 | |
| 189 | 189 | if ( 1 === $instance ) { |
| 190 | 190 | /* This hook is defined in wp-includes/media.php */ |
| 191 | - do_action( 'wp_playlist_scripts', $atts['type'], $atts['style'] ); |
|
| 191 | + do_action ( 'wp_playlist_scripts', $atts[ 'type' ], $atts[ 'style' ] ); |
|
| 192 | 192 | } ?> |
| 193 | 193 | <div class="wp-playlist wp-<?php echo $safe_type ?>-playlist wp-playlist-<?php echo $safe_style ?>"> |
| 194 | - <?php if ( 'audio' === $atts['type'] ): ?> |
|
| 194 | + <?php if ( 'audio' === $atts[ 'type' ] ): ?> |
|
| 195 | 195 | <div class="wp-playlist-current-item"></div> |
| 196 | 196 | <?php endif ?> |
| 197 | 197 | <<?php echo $safe_type ?> controls="controls" preload="none" width="<?php |
@@ -204,21 +204,21 @@ discard block |
||
| 204 | 204 | <noscript> |
| 205 | 205 | <ol><?php |
| 206 | 206 | foreach ( $episodes as $episode ) { |
| 207 | - $url = $ss_podcasting->get_enclosure( $episode->ID ); |
|
| 208 | - if ( get_option( 'permalink_structure' ) ) { |
|
| 209 | - $url = $ss_podcasting->get_episode_download_link( $episode->ID ); |
|
| 210 | - $url = str_replace( 'podcast-download', 'podcast-player', $url ); |
|
| 207 | + $url = $ss_podcasting->get_enclosure ( $episode->ID ); |
|
| 208 | + if ( get_option ( 'permalink_structure' ) ) { |
|
| 209 | + $url = $ss_podcasting->get_episode_download_link ( $episode->ID ); |
|
| 210 | + $url = str_replace ( 'podcast-download', 'podcast-player', $url ); |
|
| 211 | 211 | } |
| 212 | - printf( '<li>%s</li>', $url ); |
|
| 212 | + printf ( '<li>%s</li>', $url ); |
|
| 213 | 213 | } |
| 214 | 214 | ?></ol> |
| 215 | 215 | </noscript> |
| 216 | - <script type="application/json" class="wp-playlist-script"><?php echo wp_json_encode( $data ) ?></script> |
|
| 216 | + <script type="application/json" class="wp-playlist-script"><?php echo wp_json_encode ( $data ) ?></script> |
|
| 217 | 217 | </div> |
| 218 | 218 | <?php |
| 219 | - return ob_get_clean(); |
|
| 219 | + return ob_get_clean (); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | -$GLOBALS['ssp_shortcodes']['podcast_playlist'] = new SSP_Shortcode_Podcast_Playlist(); |
|
| 225 | 224 | \ No newline at end of file |
| 225 | +$GLOBALS[ 'ssp_shortcodes' ][ 'podcast_playlist' ] = new SSP_Shortcode_Podcast_Playlist (); |
|
| 226 | 226 | \ No newline at end of file |