@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly. |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | +if ( ! defined ( 'ABSPATH' ) ) { |
|
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | public function __construct() { |
| 27 | 27 | // Widget variable settings |
| 28 | 28 | $this->widget_cssclass = 'widget_podcast_playlist'; |
| 29 | - $this->widget_description = __( 'Display a playlist of episodes.', 'seriously-simple-podcasting' ); |
|
| 29 | + $this->widget_description = __ ( 'Display a playlist of episodes.', 'seriously-simple-podcasting' ); |
|
| 30 | 30 | $this->widget_idbase = 'ss_podcast'; |
| 31 | - $this->widget_title = __( 'Podcast: Playlist', 'seriously-simple-podcasting' ); |
|
| 31 | + $this->widget_title = __ ( 'Podcast: Playlist', 'seriously-simple-podcasting' ); |
|
| 32 | 32 | |
| 33 | 33 | // Widget settings |
| 34 | 34 | $widget_ops = array( |
@@ -37,109 +37,109 @@ discard block |
||
| 37 | 37 | 'customize_selective_refresh' => true, |
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | - parent::__construct('podcast-playlist', $this->widget_title, $widget_ops); |
|
| 40 | + parent::__construct ( 'podcast-playlist', $this->widget_title, $widget_ops ); |
|
| 41 | 41 | |
| 42 | 42 | $this->alt_option_name = 'widget_podcast_playlist'; |
| 43 | 43 | |
| 44 | - add_action( 'save_post', array( $this, 'flush_widget_cache' ) ); |
|
| 45 | - add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) ); |
|
| 46 | - add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) ); |
|
| 44 | + add_action ( 'save_post', array( $this, 'flush_widget_cache' ) ); |
|
| 45 | + add_action ( 'deleted_post', array( $this, 'flush_widget_cache' ) ); |
|
| 46 | + add_action ( 'switch_theme', array( $this, 'flush_widget_cache' ) ); |
|
| 47 | 47 | |
| 48 | 48 | } // End __construct() |
| 49 | 49 | |
| 50 | - public function widget($args, $instance) { |
|
| 50 | + public function widget( $args, $instance ) { |
|
| 51 | 51 | $cache = array(); |
| 52 | - if ( ! $this->is_preview() ) { |
|
| 53 | - $cache = wp_cache_get( 'widget_podcast_playlist', 'widget' ); |
|
| 52 | + if ( ! $this->is_preview () ) { |
|
| 53 | + $cache = wp_cache_get ( 'widget_podcast_playlist', 'widget' ); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if ( ! is_array( $cache ) ) { |
|
| 56 | + if ( ! is_array ( $cache ) ) { |
|
| 57 | 57 | $cache = array(); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if ( ! isset( $args['widget_id'] ) ) { |
|
| 61 | - $args['widget_id'] = $this->id; |
|
| 60 | + if ( ! isset( $args[ 'widget_id' ] ) ) { |
|
| 61 | + $args[ 'widget_id' ] = $this->id; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if ( isset( $cache[ $args['widget_id'] ] ) ) { |
|
| 65 | - echo $cache[ $args['widget_id'] ]; |
|
| 64 | + if ( isset( $cache[ $args[ 'widget_id' ] ] ) ) { |
|
| 65 | + echo $cache[ $args[ 'widget_id' ] ]; |
|
| 66 | 66 | return; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - ob_start(); |
|
| 69 | + ob_start (); |
|
| 70 | 70 | |
| 71 | - $episodes = ( $instance['episodes'] ) ? $instance['episodes'] : ''; |
|
| 72 | - $series_slug = ( $instance['series_slug'] ) ? $instance['series_slug'] : ''; |
|
| 71 | + $episodes = ( $instance[ 'episodes' ] ) ? $instance[ 'episodes' ] : ''; |
|
| 72 | + $series_slug = ( $instance[ 'series_slug' ] ) ? $instance[ 'series_slug' ] : ''; |
|
| 73 | 73 | |
| 74 | 74 | $shortcode = '[podcast_playlist'; |
| 75 | 75 | |
| 76 | - if( $episodes ) { |
|
| 77 | - $shortcode .= ' episodes=' . $episodes; |
|
| 76 | + if ( $episodes ) { |
|
| 77 | + $shortcode .= ' episodes='.$episodes; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if( $series_slug ) { |
|
| 81 | - $shortcode .= ' series=' . $series_slug; |
|
| 80 | + if ( $series_slug ) { |
|
| 81 | + $shortcode .= ' series='.$series_slug; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $shortcode .= ']'; |
| 85 | 85 | |
| 86 | - $title = $instance['title']; |
|
| 86 | + $title = $instance[ 'title' ]; |
|
| 87 | 87 | |
| 88 | 88 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 89 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
| 89 | + $title = apply_filters ( 'widget_title', $title, $instance, $this->id_base ); |
|
| 90 | 90 | |
| 91 | - echo $args['before_widget']; |
|
| 91 | + echo $args[ 'before_widget' ]; |
|
| 92 | 92 | |
| 93 | 93 | if ( $title ) { |
| 94 | - echo $args['before_title'] . $title . $args['after_title']; |
|
| 94 | + echo $args[ 'before_title' ].$title.$args[ 'after_title' ]; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - echo do_shortcode( $shortcode ); |
|
| 97 | + echo do_shortcode ( $shortcode ); |
|
| 98 | 98 | |
| 99 | - echo $args['after_widget']; |
|
| 99 | + echo $args[ 'after_widget' ]; |
|
| 100 | 100 | |
| 101 | - if ( ! $this->is_preview() ) { |
|
| 102 | - $cache[ $args['widget_id'] ] = ob_get_flush(); |
|
| 103 | - wp_cache_set( 'widget_podcast_series', $cache, 'widget' ); |
|
| 101 | + if ( ! $this->is_preview () ) { |
|
| 102 | + $cache[ $args[ 'widget_id' ] ] = ob_get_flush (); |
|
| 103 | + wp_cache_set ( 'widget_podcast_series', $cache, 'widget' ); |
|
| 104 | 104 | } else { |
| 105 | - ob_end_flush(); |
|
| 105 | + ob_end_flush (); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | public function update( $new_instance, $old_instance ) { |
| 110 | 110 | $instance = $old_instance; |
| 111 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
| 112 | - $instance['episodes'] = isset( $new_instance['episodes'] ) ? $new_instance['episodes'] : ''; |
|
| 113 | - $instance['series_slug'] = isset( $new_instance['series_slug'] ) ? $new_instance['series_slug'] : ''; |
|
| 114 | - $this->flush_widget_cache(); |
|
| 111 | + $instance[ 'title' ] = strip_tags ( $new_instance[ 'title' ] ); |
|
| 112 | + $instance[ 'episodes' ] = isset( $new_instance[ 'episodes' ] ) ? $new_instance[ 'episodes' ] : ''; |
|
| 113 | + $instance[ 'series_slug' ] = isset( $new_instance[ 'series_slug' ] ) ? $new_instance[ 'series_slug' ] : ''; |
|
| 114 | + $this->flush_widget_cache (); |
|
| 115 | 115 | |
| 116 | 116 | return $instance; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | public function flush_widget_cache() { |
| 120 | - wp_cache_delete('widget_podcast_playlist', 'widget'); |
|
| 120 | + wp_cache_delete ( 'widget_podcast_playlist', 'widget' ); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | public function form( $instance ) { |
| 124 | - $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; |
|
| 125 | - $episodes = isset( $instance['episodes'] ) ? esc_attr( $instance['episodes'] ) : ''; |
|
| 126 | - $series_slug = isset( $instance['series_slug'] ) ? $instance['series_slug'] : ''; |
|
| 124 | + $title = isset( $instance[ 'title' ] ) ? esc_attr ( $instance[ 'title' ] ) : ''; |
|
| 125 | + $episodes = isset( $instance[ 'episodes' ] ) ? esc_attr ( $instance[ 'episodes' ] ) : ''; |
|
| 126 | + $series_slug = isset( $instance[ 'series_slug' ] ) ? $instance[ 'series_slug' ] : ''; |
|
| 127 | 127 | |
| 128 | 128 | // Get all podcast series |
| 129 | - $series = get_terms( 'series' ); |
|
| 129 | + $series = get_terms ( 'series' ); |
|
| 130 | 130 | ?> |
| 131 | - <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title (optional):', 'seriously-simple-podcasting' ); ?></label> |
|
| 132 | - <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" placeholder="<?php _e( 'Widget title', 'seriously-simple-podcasting' ); ?>" value="<?php echo $title; ?>" /></p> |
|
| 131 | + <p><label for="<?php echo $this->get_field_id ( 'title' ); ?>"><?php _e ( 'Title (optional):', 'seriously-simple-podcasting' ); ?></label> |
|
| 132 | + <input class="widefat" id="<?php echo $this->get_field_id ( 'title' ); ?>" name="<?php echo $this->get_field_name ( 'title' ); ?>" type="text" placeholder="<?php _e ( 'Widget title', 'seriously-simple-podcasting' ); ?>" value="<?php echo $title; ?>" /></p> |
|
| 133 | 133 | |
| 134 | - <p><label for="<?php echo $this->get_field_id( 'episodes' ); ?>"><?php _e( 'Episodes (comma-separated IDs):', 'seriously-simple-podcasting' ); ?></label> |
|
| 135 | - <input class="widefat" id="<?php echo $this->get_field_id( 'episodes' ); ?>" name="<?php echo $this->get_field_name( 'episodes' ); ?>" type="text" placeholder="<?php _e( 'Display all episodes', 'seriously-simple-podcasting' ); ?>" value="<?php echo $episodes; ?>" /></p> |
|
| 134 | + <p><label for="<?php echo $this->get_field_id ( 'episodes' ); ?>"><?php _e ( 'Episodes (comma-separated IDs):', 'seriously-simple-podcasting' ); ?></label> |
|
| 135 | + <input class="widefat" id="<?php echo $this->get_field_id ( 'episodes' ); ?>" name="<?php echo $this->get_field_name ( 'episodes' ); ?>" type="text" placeholder="<?php _e ( 'Display all episodes', 'seriously-simple-podcasting' ); ?>" value="<?php echo $episodes; ?>" /></p> |
|
| 136 | 136 | |
| 137 | - <p><label for="<?php echo $this->get_field_id( 'series_slug' ); ?>"><?php _e( 'Series:', 'seriously-simple-podcasting' ); ?></label> |
|
| 138 | - <select id="<?php echo $this->get_field_id( 'series_slug' ); ?>" name="<?php echo $this->get_field_name( 'series_slug' ); ?>"> |
|
| 139 | - <option value=""><?php _e( 'Use episodes specified above', 'seriously-simple-podcasting' ); ?></option> |
|
| 137 | + <p><label for="<?php echo $this->get_field_id ( 'series_slug' ); ?>"><?php _e ( 'Series:', 'seriously-simple-podcasting' ); ?></label> |
|
| 138 | + <select id="<?php echo $this->get_field_id ( 'series_slug' ); ?>" name="<?php echo $this->get_field_name ( 'series_slug' ); ?>"> |
|
| 139 | + <option value=""><?php _e ( 'Use episodes specified above', 'seriously-simple-podcasting' ); ?></option> |
|
| 140 | 140 | <?php |
| 141 | 141 | foreach ( $series as $s ) { |
| 142 | - echo '<option value="' . esc_attr( $s->slug ) . '" ' . selected( $series_slug, $s->slug, false ) . '>' . $s->name . '</option>' . "\n"; |
|
| 142 | + echo '<option value="'.esc_attr ( $s->slug ).'" '.selected ( $series_slug, $s->slug, false ).'>'.$s->name.'</option>'."\n"; |
|
| 143 | 143 | } |
| 144 | 144 | ?> |
| 145 | 145 | </select> |
@@ -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 |