@@ -23,34 +23,34 @@ |
||
23 | 23 | global $ss_podcasting; |
24 | 24 | |
25 | 25 | $atts = shortcode_atts( array( |
26 | - 'episode' => 0, |
|
27 | - 'content' => 'title,player,details', |
|
28 | - ), $params ); |
|
26 | + 'episode' => 0, |
|
27 | + 'content' => 'title,player,details', |
|
28 | + ), $params ); |
|
29 | 29 | |
30 | 30 | extract( $atts ); |
31 | 31 | |
32 | 32 | // If no episode ID is specified then use the current post's ID |
33 | - if ( ! $episode ) { |
|
33 | + if ( ! $episode ) { |
|
34 | 34 | |
35 | - global $post; |
|
36 | - if( isset( $post->ID ) ) { |
|
37 | - $episode = intval( $post->ID ); |
|
38 | - } |
|
35 | + global $post; |
|
36 | + if( isset( $post->ID ) ) { |
|
37 | + $episode = intval( $post->ID ); |
|
38 | + } |
|
39 | 39 | |
40 | - if ( ! $episode ) { |
|
41 | - return; |
|
42 | - } |
|
40 | + if ( ! $episode ) { |
|
41 | + return; |
|
42 | + } |
|
43 | 43 | |
44 | - } |
|
44 | + } |
|
45 | 45 | |
46 | - // Setup array of content items and trim whitespace |
|
47 | - $content_items = explode( ',', $content ); |
|
48 | - $content_items = array_map( 'trim', $content_items ); |
|
46 | + // Setup array of content items and trim whitespace |
|
47 | + $content_items = explode( ',', $content ); |
|
48 | + $content_items = array_map( 'trim', $content_items ); |
|
49 | 49 | |
50 | - // Get episode for display |
|
51 | - $html = $ss_podcasting->podcast_episode( $episode, $content_items, 'shortcode' ); |
|
50 | + // Get episode for display |
|
51 | + $html = $ss_podcasting->podcast_episode( $episode, $content_items, 'shortcode' ); |
|
52 | 52 | |
53 | - return $html; |
|
53 | + return $html; |
|
54 | 54 | |
55 | 55 | } |
56 | 56 |
@@ -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 | |
@@ -19,22 +19,22 @@ discard block |
||
19 | 19 | * @param array $params Shortcode paramaters |
20 | 20 | * @return string HTML output |
21 | 21 | */ |
22 | - public function shortcode ( $params ) { |
|
22 | + public function shortcode( $params ) { |
|
23 | 23 | global $ss_podcasting; |
24 | 24 | |
25 | - $atts = shortcode_atts( array( |
|
25 | + $atts = shortcode_atts ( array( |
|
26 | 26 | 'episode' => 0, |
27 | 27 | 'content' => 'title,player,details', |
28 | 28 | ), $params ); |
29 | 29 | |
30 | - extract( $atts ); |
|
30 | + extract ( $atts ); |
|
31 | 31 | |
32 | 32 | // If no episode ID is specified then use the current post's ID |
33 | 33 | if ( ! $episode ) { |
34 | 34 | |
35 | 35 | global $post; |
36 | - if( isset( $post->ID ) ) { |
|
37 | - $episode = intval( $post->ID ); |
|
36 | + if ( isset( $post->ID ) ) { |
|
37 | + $episode = intval ( $post->ID ); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | if ( ! $episode ) { |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | // Setup array of content items and trim whitespace |
47 | - $content_items = explode( ',', $content ); |
|
48 | - $content_items = array_map( 'trim', $content_items ); |
|
47 | + $content_items = explode ( ',', $content ); |
|
48 | + $content_items = array_map ( 'trim', $content_items ); |
|
49 | 49 | |
50 | 50 | // Get episode for display |
51 | - $html = $ss_podcasting->podcast_episode( $episode, $content_items, 'shortcode' ); |
|
51 | + $html = $ss_podcasting->podcast_episode ( $episode, $content_items, 'shortcode' ); |
|
52 | 52 | |
53 | 53 | return $html; |
54 | 54 | |
@@ -56,4 +56,4 @@ discard block |
||
56 | 56 | |
57 | 57 | } |
58 | 58 | |
59 | -$GLOBALS['ssp_shortcodes']['podcast_episode'] = new SSP_Shortcode_Podcast_Episode(); |
|
60 | 59 | \ No newline at end of file |
60 | +$GLOBALS[ 'ssp_shortcodes' ][ 'podcast_episode' ] = new SSP_Shortcode_Podcast_Episode (); |
|
61 | 61 | \ 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 | |
@@ -21,17 +21,17 @@ discard block |
||
21 | 21 | */ |
22 | 22 | function shortcode( $attr ) { |
23 | 23 | global $content_width; |
24 | - $post = get_post(); |
|
24 | + $post = get_post (); |
|
25 | 25 | |
26 | 26 | static $instance = 0; |
27 | 27 | $instance++; |
28 | 28 | |
29 | - if ( ! empty( $attr['ids'] ) ) { |
|
29 | + if ( ! empty( $attr[ 'ids' ] ) ) { |
|
30 | 30 | // 'ids' is explicitly ordered, unless you specify otherwise. |
31 | - if ( empty( $attr['orderby'] ) ) { |
|
32 | - $attr['orderby'] = 'post__in'; |
|
31 | + if ( empty( $attr[ 'orderby' ] ) ) { |
|
32 | + $attr[ 'orderby' ] = 'post__in'; |
|
33 | 33 | } |
34 | - $attr['include'] = $attr['ids']; |
|
34 | + $attr[ 'include' ] = $attr[ 'ids' ]; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | * @param array $attr An array of shortcode attributes. |
48 | 48 | * @param int $instance Unique numeric ID of this playlist shortcode instance. |
49 | 49 | */ |
50 | - $output = apply_filters( 'post_playlist', '', $attr, $instance ); |
|
50 | + $output = apply_filters ( 'post_playlist', '', $attr, $instance ); |
|
51 | 51 | if ( $output != '' ) { |
52 | 52 | return $output; |
53 | 53 | } |
54 | 54 | |
55 | - $atts = shortcode_atts( array( |
|
55 | + $atts = shortcode_atts ( array( |
|
56 | 56 | 'type' => 'audio', |
57 | 57 | 'order' => 'ASC', |
58 | 58 | 'orderby' => 'menu_order ID', |
@@ -66,45 +66,45 @@ discard block |
||
66 | 66 | 'artists' => true |
67 | 67 | ), $attr, 'playlist' ); |
68 | 68 | |
69 | - $id = intval( $atts['id'] ); |
|
69 | + $id = intval ( $atts[ 'id' ] ); |
|
70 | 70 | |
71 | - if ( $atts['type'] !== 'audio' ) { |
|
72 | - $atts['type'] = 'video'; |
|
71 | + if ( $atts[ 'type' ] !== 'audio' ) { |
|
72 | + $atts[ 'type' ] = 'video'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | $args = array( |
76 | 76 | 'post_status' => 'inherit', |
77 | 77 | 'post_type' => 'attachment', |
78 | - 'post_mime_type' => $atts['type'], |
|
79 | - 'order' => $atts['order'], |
|
80 | - 'orderby' => $atts['orderby'] |
|
78 | + 'post_mime_type' => $atts[ 'type' ], |
|
79 | + 'order' => $atts[ 'order' ], |
|
80 | + 'orderby' => $atts[ 'orderby' ] |
|
81 | 81 | ); |
82 | 82 | |
83 | - if ( ! empty( $atts['include'] ) ) { |
|
84 | - $args['include'] = $atts['include']; |
|
85 | - $_attachments = get_posts( $args ); |
|
83 | + if ( ! empty( $atts[ 'include' ] ) ) { |
|
84 | + $args[ 'include' ] = $atts[ 'include' ]; |
|
85 | + $_attachments = get_posts ( $args ); |
|
86 | 86 | |
87 | 87 | $attachments = array(); |
88 | 88 | foreach ( $_attachments as $key => $val ) { |
89 | - $attachments[$val->ID] = $_attachments[$key]; |
|
89 | + $attachments[ $val->ID ] = $_attachments[ $key ]; |
|
90 | 90 | } |
91 | - } elseif ( ! empty( $atts['exclude'] ) ) { |
|
92 | - $args['post_parent'] = $id; |
|
93 | - $args['exclude'] = $atts['exclude']; |
|
94 | - $attachments = get_children( $args ); |
|
91 | + } elseif ( ! empty( $atts[ 'exclude' ] ) ) { |
|
92 | + $args[ 'post_parent' ] = $id; |
|
93 | + $args[ 'exclude' ] = $atts[ 'exclude' ]; |
|
94 | + $attachments = get_children ( $args ); |
|
95 | 95 | } else { |
96 | - $args['post_parent'] = $id; |
|
97 | - $attachments = get_children( $args ); |
|
96 | + $args[ 'post_parent' ] = $id; |
|
97 | + $attachments = get_children ( $args ); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | if ( empty( $attachments ) ) { |
101 | 101 | return ''; |
102 | 102 | } |
103 | 103 | |
104 | - if ( is_feed() ) { |
|
104 | + if ( is_feed () ) { |
|
105 | 105 | $output = "\n"; |
106 | 106 | foreach ( $attachments as $att_id => $attachment ) { |
107 | - $output .= wp_get_attachment_link( $att_id ) . "\n"; |
|
107 | + $output .= wp_get_attachment_link ( $att_id )."\n"; |
|
108 | 108 | } |
109 | 109 | return $output; |
110 | 110 | } |
@@ -115,51 +115,51 @@ discard block |
||
115 | 115 | $default_height = 360; |
116 | 116 | |
117 | 117 | $theme_width = empty( $content_width ) ? $default_width : ( $content_width - $outer ); |
118 | - $theme_height = empty( $content_width ) ? $default_height : round( ( $default_height * $theme_width ) / $default_width ); |
|
118 | + $theme_height = empty( $content_width ) ? $default_height : round ( ( $default_height * $theme_width ) / $default_width ); |
|
119 | 119 | |
120 | 120 | $data = array( |
121 | - 'type' => $atts['type'], |
|
121 | + 'type' => $atts[ 'type' ], |
|
122 | 122 | // don't pass strings to JSON, will be truthy in JS |
123 | - 'tracklist' => wp_validate_boolean( $atts['tracklist'] ), |
|
124 | - 'tracknumbers' => wp_validate_boolean( $atts['tracknumbers'] ), |
|
125 | - 'images' => wp_validate_boolean( $atts['images'] ), |
|
126 | - 'artists' => wp_validate_boolean( $atts['artists'] ), |
|
123 | + 'tracklist' => wp_validate_boolean ( $atts[ 'tracklist' ] ), |
|
124 | + 'tracknumbers' => wp_validate_boolean ( $atts[ 'tracknumbers' ] ), |
|
125 | + 'images' => wp_validate_boolean ( $atts[ 'images' ] ), |
|
126 | + 'artists' => wp_validate_boolean ( $atts[ 'artists' ] ), |
|
127 | 127 | ); |
128 | 128 | |
129 | 129 | $tracks = array(); |
130 | 130 | foreach ( $attachments as $attachment ) { |
131 | - $url = wp_get_attachment_url( $attachment->ID ); |
|
132 | - $ftype = wp_check_filetype( $url, wp_get_mime_types() ); |
|
131 | + $url = wp_get_attachment_url ( $attachment->ID ); |
|
132 | + $ftype = wp_check_filetype ( $url, wp_get_mime_types () ); |
|
133 | 133 | $track = array( |
134 | 134 | 'src' => $url, |
135 | - 'type' => $ftype['type'], |
|
135 | + 'type' => $ftype[ 'type' ], |
|
136 | 136 | 'title' => $attachment->post_title, |
137 | 137 | 'caption' => $attachment->post_excerpt, |
138 | 138 | 'description' => $attachment->post_content |
139 | 139 | ); |
140 | 140 | |
141 | - $track['meta'] = array(); |
|
142 | - $meta = wp_get_attachment_metadata( $attachment->ID ); |
|
141 | + $track[ 'meta' ] = array(); |
|
142 | + $meta = wp_get_attachment_metadata ( $attachment->ID ); |
|
143 | 143 | if ( ! empty( $meta ) ) { |
144 | 144 | |
145 | - foreach ( wp_get_attachment_id3_keys( $attachment ) as $key => $label ) { |
|
145 | + foreach ( wp_get_attachment_id3_keys ( $attachment ) as $key => $label ) { |
|
146 | 146 | if ( ! empty( $meta[ $key ] ) ) { |
147 | - $track['meta'][ $key ] = $meta[ $key ]; |
|
147 | + $track[ 'meta' ][ $key ] = $meta[ $key ]; |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | - if ( 'video' === $atts['type'] ) { |
|
152 | - if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) { |
|
153 | - $width = $meta['width']; |
|
154 | - $height = $meta['height']; |
|
155 | - $theme_height = round( ( $height * $theme_width ) / $width ); |
|
151 | + if ( 'video' === $atts[ 'type' ] ) { |
|
152 | + if ( ! empty( $meta[ 'width' ] ) && ! empty( $meta[ 'height' ] ) ) { |
|
153 | + $width = $meta[ 'width' ]; |
|
154 | + $height = $meta[ 'height' ]; |
|
155 | + $theme_height = round ( ( $height * $theme_width ) / $width ); |
|
156 | 156 | } else { |
157 | 157 | $width = $default_width; |
158 | 158 | $height = $default_height; |
159 | 159 | } |
160 | 160 | |
161 | - $track['dimensions'] = array( |
|
162 | - 'original' => compact( 'width', 'height' ), |
|
161 | + $track[ 'dimensions' ] = array( |
|
162 | + 'original' => compact ( 'width', 'height' ), |
|
163 | 163 | 'resized' => array( |
164 | 164 | 'width' => $theme_width, |
165 | 165 | 'height' => $theme_height |
@@ -168,30 +168,30 @@ discard block |
||
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | - if ( $atts['images'] ) { |
|
172 | - $thumb_id = get_post_thumbnail_id( $attachment->ID ); |
|
171 | + if ( $atts[ 'images' ] ) { |
|
172 | + $thumb_id = get_post_thumbnail_id ( $attachment->ID ); |
|
173 | 173 | if ( ! empty( $thumb_id ) ) { |
174 | - list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'full' ); |
|
175 | - $track['image'] = compact( 'src', 'width', 'height' ); |
|
176 | - list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'thumbnail' ); |
|
177 | - $track['thumb'] = compact( 'src', 'width', 'height' ); |
|
174 | + list( $src, $width, $height ) = wp_get_attachment_image_src ( $thumb_id, 'full' ); |
|
175 | + $track[ 'image' ] = compact ( 'src', 'width', 'height' ); |
|
176 | + list( $src, $width, $height ) = wp_get_attachment_image_src ( $thumb_id, 'thumbnail' ); |
|
177 | + $track[ 'thumb' ] = compact ( 'src', 'width', 'height' ); |
|
178 | 178 | } else { |
179 | - $src = wp_mime_type_icon( $attachment->ID ); |
|
179 | + $src = wp_mime_type_icon ( $attachment->ID ); |
|
180 | 180 | $width = 48; |
181 | 181 | $height = 64; |
182 | - $track['image'] = compact( 'src', 'width', 'height' ); |
|
183 | - $track['thumb'] = compact( 'src', 'width', 'height' ); |
|
182 | + $track[ 'image' ] = compact ( 'src', 'width', 'height' ); |
|
183 | + $track[ 'thumb' ] = compact ( 'src', 'width', 'height' ); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | - $tracks[] = $track; |
|
187 | + $tracks[ ] = $track; |
|
188 | 188 | } |
189 | - $data['tracks'] = $tracks; |
|
189 | + $data[ 'tracks' ] = $tracks; |
|
190 | 190 | |
191 | - $safe_type = esc_attr( $atts['type'] ); |
|
192 | - $safe_style = esc_attr( $atts['style'] ); |
|
191 | + $safe_type = esc_attr ( $atts[ 'type' ] ); |
|
192 | + $safe_style = esc_attr ( $atts[ 'style' ] ); |
|
193 | 193 | |
194 | - ob_start(); |
|
194 | + ob_start (); |
|
195 | 195 | |
196 | 196 | if ( 1 === $instance ) { |
197 | 197 | /** |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | * @param string $type Type of playlist. Possible values are 'audio' or 'video'. |
203 | 203 | * @param string $style The 'theme' for the playlist. Core provides 'light' and 'dark'. |
204 | 204 | */ |
205 | - do_action( 'wp_playlist_scripts', $atts['type'], $atts['style'] ); |
|
205 | + do_action ( 'wp_playlist_scripts', $atts[ 'type' ], $atts[ 'style' ] ); |
|
206 | 206 | } ?> |
207 | 207 | <div class="wp-playlist wp-<?php echo $safe_type ?>-playlist wp-playlist-<?php echo $safe_style ?>"> |
208 | - <?php if ( 'audio' === $atts['type'] ): ?> |
|
208 | + <?php if ( 'audio' === $atts[ 'type' ] ): ?> |
|
209 | 209 | <div class="wp-playlist-current-item"></div> |
210 | 210 | <?php endif ?> |
211 | 211 | <<?php echo $safe_type ?> controls="controls" preload="none" width="<?php |
@@ -218,16 +218,16 @@ discard block |
||
218 | 218 | <noscript> |
219 | 219 | <ol><?php |
220 | 220 | foreach ( $attachments as $att_id => $attachment ) { |
221 | - printf( '<li>%s</li>', wp_get_attachment_link( $att_id ) ); |
|
221 | + printf ( '<li>%s</li>', wp_get_attachment_link ( $att_id ) ); |
|
222 | 222 | } |
223 | 223 | ?></ol> |
224 | 224 | </noscript> |
225 | - <script type="application/json" class="wp-playlist-script"><?php echo wp_json_encode( $data ) ?></script> |
|
225 | + <script type="application/json" class="wp-playlist-script"><?php echo wp_json_encode ( $data ) ?></script> |
|
226 | 226 | </div> |
227 | 227 | <?php |
228 | - return ob_get_clean(); |
|
228 | + return ob_get_clean (); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | } |
232 | 232 | |
233 | -$GLOBALS['ssp_shortcodes']['podcast_playlist'] = new SSP_Shortcode_Podcast_Playlist(); |
|
234 | 233 | \ No newline at end of file |
234 | +$GLOBALS[ 'ssp_shortcodes' ][ 'podcast_playlist' ] = new SSP_Shortcode_Podcast_Playlist (); |
|
235 | 235 | \ 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 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param array $atts Shortcode attributes |
20 | 20 | * @return string HTML output |
21 | 21 | */ |
22 | - function shortcode ( $atts ) { |
|
22 | + function shortcode( $atts ) { |
|
23 | 23 | |
24 | 24 | $defaults = array( |
25 | 25 | 'title' => '', |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | 'link_title' => true |
31 | 31 | ); |
32 | 32 | |
33 | - $args = shortcode_atts( $defaults, $atts ); |
|
33 | + $args = shortcode_atts ( $defaults, $atts ); |
|
34 | 34 | |
35 | 35 | // Make sure we return and don't echo. |
36 | - $args['echo'] = false; |
|
36 | + $args[ 'echo' ] = false; |
|
37 | 37 | |
38 | - return ss_podcast( $args ); |
|
38 | + return ss_podcast ( $args ); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | } |
42 | 42 | |
43 | -$GLOBALS['ssp_shortcodes']['ss_podcast'] = new SSP_Shortcode_SS_Podcast(); |
|
44 | 43 | \ No newline at end of file |
44 | +$GLOBALS[ 'ssp_shortcodes' ][ 'ss_podcast' ] = new SSP_Shortcode_SS_Podcast (); |
|
45 | 45 | \ No newline at end of file |
@@ -558,11 +558,11 @@ discard block |
||
558 | 558 | |
559 | 559 | if ( $size ) { |
560 | 560 | |
561 | - $base = log ( $size ) / log( 1024 ); |
|
562 | - $suffixes = array( '' , 'k' , 'M' , 'G' , 'T' ); |
|
563 | - $formatted_size = round( pow( 1024 , $base - floor( $base ) ) , $precision ) . $suffixes[ floor( $base ) ]; |
|
561 | + $base = log ( $size ) / log( 1024 ); |
|
562 | + $suffixes = array( '' , 'k' , 'M' , 'G' , 'T' ); |
|
563 | + $formatted_size = round( pow( 1024 , $base - floor( $base ) ) , $precision ) . $suffixes[ floor( $base ) ]; |
|
564 | 564 | |
565 | - return apply_filters( 'ssp_file_size_formatted', $formatted_size, $size ); |
|
565 | + return apply_filters( 'ssp_file_size_formatted', $formatted_size, $size ); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | return false; |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | wp_cache_set( $key, $mime, 'mime-type', DAY_IN_SECONDS ); |
665 | 665 | } |
666 | 666 | |
667 | - return $mime; |
|
667 | + return $mime; |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | return false; |
@@ -798,15 +798,15 @@ discard block |
||
798 | 798 | foreach ( $terms as $term ) { |
799 | 799 | $query[ $term->term_id ] = new stdClass(); |
800 | 800 | $query[ $term->term_id ]->title = $term->name; |
801 | - $query[ $term->term_id ]->url = get_term_link( $term ); |
|
801 | + $query[ $term->term_id ]->url = get_term_link( $term ); |
|
802 | 802 | |
803 | - $query_args = apply_filters( 'ssp_get_podcast_series_query_args', ssp_episodes( -1, $term->slug, true, '' ) ); |
|
803 | + $query_args = apply_filters( 'ssp_get_podcast_series_query_args', ssp_episodes( -1, $term->slug, true, '' ) ); |
|
804 | 804 | |
805 | - $posts = get_posts( $query_args ); |
|
805 | + $posts = get_posts( $query_args ); |
|
806 | 806 | |
807 | - $count = count( $posts ); |
|
808 | - $query[ $term->term_id ]->count = $count; |
|
809 | - } |
|
807 | + $count = count( $posts ); |
|
808 | + $query[ $term->term_id ]->count = $count; |
|
809 | + } |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | } |
@@ -917,18 +917,18 @@ discard block |
||
917 | 917 | } |
918 | 918 | |
919 | 919 | // Allow other actions - functions hooked on here must not output any data |
920 | - do_action( 'ssp_file_download', $file, $episode, $referrer ); |
|
920 | + do_action( 'ssp_file_download', $file, $episode, $referrer ); |
|
921 | 921 | |
922 | - // Set necessary headers |
|
922 | + // Set necessary headers |
|
923 | 923 | header( "Pragma: no-cache" ); |
924 | 924 | header( "Expires: 0" ); |
925 | 925 | header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); |
926 | 926 | header( "Robots: none" ); |
927 | 927 | |
928 | - // Check file referrer |
|
929 | - if( 'download' == $referrer ) { |
|
928 | + // Check file referrer |
|
929 | + if( 'download' == $referrer ) { |
|
930 | 930 | |
931 | - // Set size of file |
|
931 | + // Set size of file |
|
932 | 932 | // Do we have anything in Cache/DB? |
933 | 933 | $size = wp_cache_get( $episode_id, 'filesize_raw' ); |
934 | 934 | |
@@ -955,22 +955,22 @@ discard block |
||
955 | 955 | } |
956 | 956 | |
957 | 957 | // Send Content-Length header |
958 | - if ( ! empty( $size ) ) { |
|
958 | + if ( ! empty( $size ) ) { |
|
959 | 959 | header( "Content-Length: " . $size ); |
960 | 960 | } |
961 | 961 | |
962 | - // Force file download |
|
963 | - header( "Content-Type: application/force-download" ); |
|
962 | + // Force file download |
|
963 | + header( "Content-Type: application/force-download" ); |
|
964 | 964 | |
965 | - // Set other relevant headers |
|
966 | - header( "Content-Description: File Transfer" ); |
|
967 | - header( "Content-Disposition: attachment; filename=\"" . basename( $file ) . "\";" ); |
|
968 | - header( "Content-Transfer-Encoding: binary" ); |
|
965 | + // Set other relevant headers |
|
966 | + header( "Content-Description: File Transfer" ); |
|
967 | + header( "Content-Disposition: attachment; filename=\"" . basename( $file ) . "\";" ); |
|
968 | + header( "Content-Transfer-Encoding: binary" ); |
|
969 | 969 | |
970 | - // Encode spaces in file names until this is fixed in core (https://core.trac.wordpress.org/ticket/36998) |
|
970 | + // Encode spaces in file names until this is fixed in core (https://core.trac.wordpress.org/ticket/36998) |
|
971 | 971 | $file = str_replace( ' ', '%20', $file ); |
972 | 972 | |
973 | - // Use ssp_readfile_chunked() if allowed on the server or simply access file directly |
|
973 | + // Use ssp_readfile_chunked() if allowed on the server or simply access file directly |
|
974 | 974 | @ssp_readfile_chunked( $file ) or header( 'Location: ' . $file ); |
975 | 975 | } else { |
976 | 976 | |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | if ( get_option( 'permalink_structure' ) ) { |
1151 | 1151 | $file = $this->get_episode_download_link( $episode_id ); |
1152 | 1152 | } |
1153 | - $html .= '<div class="podcast_player">' . $this->media_player( $file, $episode_id ) . '</div>' . "\n"; |
|
1153 | + $html .= '<div class="podcast_player">' . $this->media_player( $file, $episode_id ) . '</div>' . "\n"; |
|
1154 | 1154 | break; |
1155 | 1155 | |
1156 | 1156 | case 'details': |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | |
1166 | 1166 | $html .= '</div>' . "\n"; |
1167 | 1167 | |
1168 | - return $html; |
|
1168 | + return $html; |
|
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | /** |
@@ -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 | |
@@ -33,57 +33,57 @@ discard block |
||
33 | 33 | |
34 | 34 | $this->version = $version; |
35 | 35 | |
36 | - $this->dir = dirname( $file ); |
|
36 | + $this->dir = dirname ( $file ); |
|
37 | 37 | $this->file = $file; |
38 | - $this->assets_dir = trailingslashit( $this->dir ) . 'assets'; |
|
39 | - $this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $file ) ) ); |
|
40 | - $this->template_path = trailingslashit( $this->dir ) . 'templates/'; |
|
41 | - $this->template_url = esc_url( trailingslashit( plugins_url( '/templates/', $file ) ) ); |
|
42 | - $this->home_url = trailingslashit( home_url() ); |
|
43 | - $this->site_url = trailingslashit( site_url() ); |
|
38 | + $this->assets_dir = trailingslashit ( $this->dir ).'assets'; |
|
39 | + $this->assets_url = esc_url ( trailingslashit ( plugins_url ( '/assets/', $file ) ) ); |
|
40 | + $this->template_path = trailingslashit ( $this->dir ).'templates/'; |
|
41 | + $this->template_url = esc_url ( trailingslashit ( plugins_url ( '/templates/', $file ) ) ); |
|
42 | + $this->home_url = trailingslashit ( home_url () ); |
|
43 | + $this->site_url = trailingslashit ( site_url () ); |
|
44 | 44 | $this->token = 'podcast'; |
45 | 45 | |
46 | 46 | // Add meta data to start of podcast content |
47 | - $locations = get_option( 'ss_podcasting_player_locations', array() ); |
|
47 | + $locations = get_option ( 'ss_podcasting_player_locations', array() ); |
|
48 | 48 | |
49 | - if ( in_array( 'content', (array) $locations ) ) { |
|
50 | - add_filter( 'the_content', array( $this, 'content_meta_data' ), 10, 1 ); |
|
49 | + if ( in_array ( 'content', (array) $locations ) ) { |
|
50 | + add_filter ( 'the_content', array( $this, 'content_meta_data' ), 10, 1 ); |
|
51 | 51 | } |
52 | 52 | |
53 | - if ( in_array( 'excerpt', (array) $locations ) ) { |
|
54 | - add_filter( 'the_excerpt', array( $this, 'get_excerpt_meta_data' ), 10, 1 ); |
|
53 | + if ( in_array ( 'excerpt', (array) $locations ) ) { |
|
54 | + add_filter ( 'the_excerpt', array( $this, 'get_excerpt_meta_data' ), 10, 1 ); |
|
55 | 55 | } |
56 | 56 | |
57 | - if ( in_array( 'excerpt_embed', (array) $locations ) ) { |
|
58 | - add_filter( 'the_excerpt_embed', array( $this, 'get_embed_meta_data' ), 10, 1 ); |
|
57 | + if ( in_array ( 'excerpt_embed', (array) $locations ) ) { |
|
58 | + add_filter ( 'the_excerpt_embed', array( $this, 'get_embed_meta_data' ), 10, 1 ); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | // Add SSP label and version to generator tags |
62 | - add_action( 'get_the_generator_html', array( $this, 'generator_tag' ), 10, 2 ); |
|
63 | - add_action( 'get_the_generator_xhtml', array( $this, 'generator_tag' ), 10, 2 ); |
|
62 | + add_action ( 'get_the_generator_html', array( $this, 'generator_tag' ), 10, 2 ); |
|
63 | + add_action ( 'get_the_generator_xhtml', array( $this, 'generator_tag' ), 10, 2 ); |
|
64 | 64 | |
65 | 65 | // Add RSS meta tag to site header |
66 | - add_action( 'wp_head' , array( $this, 'rss_meta_tag' ) ); |
|
66 | + add_action ( 'wp_head', array( $this, 'rss_meta_tag' ) ); |
|
67 | 67 | |
68 | 68 | // Add podcast episode to main query loop if setting is activated |
69 | - add_action( 'pre_get_posts' , array( $this, 'add_to_home_query' ) ); |
|
69 | + add_action ( 'pre_get_posts', array( $this, 'add_to_home_query' ) ); |
|
70 | 70 | |
71 | 71 | // Make sure to fetch all relevant post types when viewing series archive |
72 | - add_action( 'pre_get_posts' , array( $this, 'add_all_post_types' ) ); |
|
72 | + add_action ( 'pre_get_posts', array( $this, 'add_all_post_types' ) ); |
|
73 | 73 | |
74 | 74 | // Download podcast episode |
75 | - add_action( 'wp', array( $this, 'download_file' ), 1 ); |
|
75 | + add_action ( 'wp', array( $this, 'download_file' ), 1 ); |
|
76 | 76 | |
77 | 77 | // Register widgets |
78 | - add_action( 'widgets_init', array( $this, 'register_widgets' ), 1 ); |
|
78 | + add_action ( 'widgets_init', array( $this, 'register_widgets' ), 1 ); |
|
79 | 79 | |
80 | 80 | // Add shortcodes |
81 | - add_action( 'init', array( $this, 'register_shortcodes' ), 1 ); |
|
81 | + add_action ( 'init', array( $this, 'register_shortcodes' ), 1 ); |
|
82 | 82 | |
83 | - add_filter( 'feed_content_type', array( $this, 'feed_content_type' ), 10, 2 ); |
|
83 | + add_filter ( 'feed_content_type', array( $this, 'feed_content_type' ), 10, 2 ); |
|
84 | 84 | |
85 | 85 | // Handle localisation |
86 | - add_action( 'plugins_loaded', array( $this, 'load_localisation' ) ); |
|
86 | + add_action ( 'plugins_loaded', array( $this, 'load_localisation' ) ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -94,36 +94,36 @@ discard block |
||
94 | 94 | public function get_episode_download_link( $episode_id, $referrer = '' ) { |
95 | 95 | |
96 | 96 | // Get file URL |
97 | - $file = $this->get_enclosure( $episode_id ); |
|
97 | + $file = $this->get_enclosure ( $episode_id ); |
|
98 | 98 | |
99 | 99 | if ( ! $file ) { |
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
103 | 103 | // Get download link based on permalink structure |
104 | - if ( get_option( 'permalink_structure' ) ) { |
|
105 | - $episode = get_post( $episode_id ); |
|
104 | + if ( get_option ( 'permalink_structure' ) ) { |
|
105 | + $episode = get_post ( $episode_id ); |
|
106 | 106 | |
107 | 107 | // Get file extension - default to MP3 to prevent empty extension strings |
108 | - $ext = pathinfo( $file, PATHINFO_EXTENSION ); |
|
109 | - if( ! $ext ) { |
|
108 | + $ext = pathinfo ( $file, PATHINFO_EXTENSION ); |
|
109 | + if ( ! $ext ) { |
|
110 | 110 | $ext = 'mp3'; |
111 | 111 | } |
112 | 112 | |
113 | - $link = $this->home_url . 'podcast-download/' . $episode_id . '/' . $episode->post_name . '.' . $ext; |
|
113 | + $link = $this->home_url.'podcast-download/'.$episode_id.'/'.$episode->post_name.'.'.$ext; |
|
114 | 114 | } else { |
115 | - $link = add_query_arg( array( 'podcast_episode' => $episode_id ), $this->home_url ); |
|
115 | + $link = add_query_arg ( array( 'podcast_episode' => $episode_id ), $this->home_url ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | // Allow for dyamic referrer |
119 | - $referrer = apply_filters( 'ssp_download_referrer', $referrer, $episode_id ); |
|
119 | + $referrer = apply_filters ( 'ssp_download_referrer', $referrer, $episode_id ); |
|
120 | 120 | |
121 | 121 | // Add referrer flag if supplied |
122 | 122 | if ( $referrer ) { |
123 | - $link = add_query_arg( array( 'ref' => $referrer ), $link ); |
|
123 | + $link = add_query_arg ( array( 'ref' => $referrer ), $link ); |
|
124 | 124 | } |
125 | 125 | |
126 | - return apply_filters( 'ssp_episode_download_link', esc_url( $link ), $episode_id, $file ); |
|
126 | + return apply_filters ( 'ssp_episode_download_link', esc_url ( $link ), $episode_id, $file ); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function get_episode_type( $episode_id = 0 ) { |
135 | 135 | |
136 | - if( ! $episode_id ) { |
|
136 | + if ( ! $episode_id ) { |
|
137 | 137 | return false; |
138 | 138 | } |
139 | 139 | |
140 | - $type = get_post_meta( $episode_id , 'episode_type' , true ); |
|
140 | + $type = get_post_meta ( $episode_id, 'episode_type', true ); |
|
141 | 141 | |
142 | - if( ! $type ) { |
|
142 | + if ( ! $type ) { |
|
143 | 143 | $type = 'audio'; |
144 | 144 | } |
145 | 145 | |
@@ -155,32 +155,32 @@ discard block |
||
155 | 155 | global $post, $wp_current_filter, $episode_context; |
156 | 156 | |
157 | 157 | // Don't output unformatted data on excerpts |
158 | - if ( in_array( 'get_the_excerpt', (array) $wp_current_filter ) ) { |
|
158 | + if ( in_array ( 'get_the_excerpt', (array) $wp_current_filter ) ) { |
|
159 | 159 | return $content; |
160 | 160 | } |
161 | 161 | |
162 | 162 | // Don't output episode meta in shortcode or widget |
163 | - if ( isset( $episode_context ) && in_array( $episode_context, array( 'shortcode', 'widget' ) ) ) { |
|
163 | + if ( isset( $episode_context ) && in_array ( $episode_context, array( 'shortcode', 'widget' ) ) ) { |
|
164 | 164 | return $content; |
165 | 165 | } |
166 | 166 | |
167 | - if( post_password_required( $post->ID ) ) { |
|
167 | + if ( post_password_required ( $post->ID ) ) { |
|
168 | 168 | return $content; |
169 | 169 | } |
170 | 170 | |
171 | - $podcast_post_types = ssp_post_types( true ); |
|
171 | + $podcast_post_types = ssp_post_types ( true ); |
|
172 | 172 | |
173 | - if ( in_array( $post->post_type, $podcast_post_types ) && ! is_feed() && ! isset( $_GET['feed'] ) ) { |
|
173 | + if ( in_array ( $post->post_type, $podcast_post_types ) && ! is_feed () && ! isset( $_GET[ 'feed' ] ) ) { |
|
174 | 174 | |
175 | 175 | // Get episode meta data |
176 | - $meta = $this->episode_meta( $post->ID, 'content' ); |
|
176 | + $meta = $this->episode_meta ( $post->ID, 'content' ); |
|
177 | 177 | |
178 | 178 | // Get specified player position |
179 | - $player_position = get_option( 'ss_podcasting_player_content_location', 'above' ); |
|
179 | + $player_position = get_option ( 'ss_podcasting_player_content_location', 'above' ); |
|
180 | 180 | |
181 | - switch( $player_position ) { |
|
182 | - case 'above': $content = $meta . $content; break; |
|
183 | - case 'below': $content = $content . $meta; break; |
|
181 | + switch ( $player_position ) { |
|
182 | + case 'above': $content = $meta.$content; break; |
|
183 | + case 'below': $content = $content.$meta; break; |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @return string Modified excerpt |
195 | 195 | */ |
196 | 196 | public function get_excerpt_meta_data( $excerpt = '' ) { |
197 | - return $this->excerpt_meta_data( $excerpt, 'excerpt' ); |
|
197 | + return $this->excerpt_meta_data ( $excerpt, 'excerpt' ); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return string Modified excerpt |
204 | 204 | */ |
205 | 205 | public function get_embed_meta_data( $excerpt = '' ) { |
206 | - return $this->excerpt_meta_data( $excerpt, 'embed' ); |
|
206 | + return $this->excerpt_meta_data ( $excerpt, 'embed' ); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -214,17 +214,17 @@ discard block |
||
214 | 214 | public function excerpt_meta_data( $excerpt = '', $content = 'excerpt' ) { |
215 | 215 | global $post; |
216 | 216 | |
217 | - if( post_password_required( $post->ID ) ) { |
|
217 | + if ( post_password_required ( $post->ID ) ) { |
|
218 | 218 | return $excerpt; |
219 | 219 | } |
220 | 220 | |
221 | - $podcast_post_types = ssp_post_types( true ); |
|
221 | + $podcast_post_types = ssp_post_types ( true ); |
|
222 | 222 | |
223 | - if ( ( in_array( $post->post_type, $podcast_post_types ) ) && ! is_feed() ) { |
|
223 | + if ( ( in_array ( $post->post_type, $podcast_post_types ) ) && ! is_feed () ) { |
|
224 | 224 | |
225 | - $meta = $this->episode_meta( $post->ID, $content ); |
|
225 | + $meta = $this->episode_meta ( $post->ID, $content ); |
|
226 | 226 | |
227 | - $excerpt = $meta . $excerpt; |
|
227 | + $excerpt = $meta.$excerpt; |
|
228 | 228 | |
229 | 229 | } |
230 | 230 | |
@@ -245,34 +245,34 @@ discard block |
||
245 | 245 | return $meta; |
246 | 246 | } |
247 | 247 | |
248 | - $file = $this->get_enclosure( $episode_id ); |
|
248 | + $file = $this->get_enclosure ( $episode_id ); |
|
249 | 249 | |
250 | 250 | if ( $file ) { |
251 | 251 | |
252 | - if ( get_option( 'permalink_structure' ) ) { |
|
253 | - $file = $this->get_episode_download_link( $episode_id ); |
|
252 | + if ( get_option ( 'permalink_structure' ) ) { |
|
253 | + $file = $this->get_episode_download_link ( $episode_id ); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | // Hide audio player in `ss_podcast` shortcode by default |
257 | 257 | $show_player = true; |
258 | - if( 'shortcode' == $context ) { |
|
258 | + if ( 'shortcode' == $context ) { |
|
259 | 259 | $show_player = false; |
260 | 260 | } |
261 | 261 | |
262 | 262 | // Allow media player to be dynamically hidden/displayed |
263 | - $show_player = apply_filters( 'ssp_show_media_player', $show_player, $context ); |
|
263 | + $show_player = apply_filters ( 'ssp_show_media_player', $show_player, $context ); |
|
264 | 264 | |
265 | 265 | // Show audio player if requested |
266 | - if( $show_player ) { |
|
267 | - $meta .= '<div class="podcast_player">' . $this->media_player( $file, $episode_id ) . '</div>'; |
|
266 | + if ( $show_player ) { |
|
267 | + $meta .= '<div class="podcast_player">'.$this->media_player ( $file, $episode_id ).'</div>'; |
|
268 | 268 | } |
269 | 269 | |
270 | - if ( apply_filters( 'ssp_show_episode_details', true, $episode_id, $context ) ) { |
|
271 | - $meta .= $this->episode_meta_details( $episode_id, $context ); |
|
270 | + if ( apply_filters ( 'ssp_show_episode_details', true, $episode_id, $context ) ) { |
|
271 | + $meta .= $this->episode_meta_details ( $episode_id, $context ); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
275 | - $meta = apply_filters( 'ssp_episode_meta', $meta, $episode_id, $context ); |
|
275 | + $meta = apply_filters ( 'ssp_episode_meta', $meta, $episode_id, $context ); |
|
276 | 276 | |
277 | 277 | return $meta; |
278 | 278 | } |
@@ -283,36 +283,36 @@ discard block |
||
283 | 283 | * @param string $context Context for display |
284 | 284 | * @return string Episode meta details |
285 | 285 | */ |
286 | - public function episode_meta_details ( $episode_id = 0, $context = 'content' ) { |
|
286 | + public function episode_meta_details( $episode_id = 0, $context = 'content' ) { |
|
287 | 287 | |
288 | 288 | if ( ! $episode_id ) { |
289 | 289 | return; |
290 | 290 | } |
291 | 291 | |
292 | - $file = $this->get_enclosure( $episode_id ); |
|
292 | + $file = $this->get_enclosure ( $episode_id ); |
|
293 | 293 | |
294 | 294 | if ( ! $file ) { |
295 | 295 | return; |
296 | 296 | } |
297 | 297 | |
298 | - $link = $this->get_episode_download_link( $episode_id, 'download' ); |
|
299 | - $duration = get_post_meta( $episode_id , 'duration' , true ); |
|
300 | - $size = get_post_meta( $episode_id , 'filesize' , true ); |
|
298 | + $link = $this->get_episode_download_link ( $episode_id, 'download' ); |
|
299 | + $duration = get_post_meta ( $episode_id, 'duration', true ); |
|
300 | + $size = get_post_meta ( $episode_id, 'filesize', true ); |
|
301 | 301 | if ( ! $size ) { |
302 | - $size_data = $this->get_file_size( $file ); |
|
303 | - $size = $size_data['formatted']; |
|
302 | + $size_data = $this->get_file_size ( $file ); |
|
303 | + $size = $size_data[ 'formatted' ]; |
|
304 | 304 | if ( $size ) { |
305 | - if ( isset( $size_data['formatted'] ) ) { |
|
306 | - update_post_meta( $episode_id, 'filesize', $size_data['formatted'] ); |
|
305 | + if ( isset( $size_data[ 'formatted' ] ) ) { |
|
306 | + update_post_meta ( $episode_id, 'filesize', $size_data[ 'formatted' ] ); |
|
307 | 307 | } |
308 | 308 | |
309 | - if ( isset( $size_data['raw'] ) ) { |
|
310 | - update_post_meta( $episode_id, 'filesize_raw', $size_data['raw'] ); |
|
309 | + if ( isset( $size_data[ 'raw' ] ) ) { |
|
310 | + update_post_meta ( $episode_id, 'filesize_raw', $size_data[ 'raw' ] ); |
|
311 | 311 | } |
312 | 312 | } |
313 | 313 | } |
314 | 314 | |
315 | - $date_recorded = get_post_meta( $episode_id, 'date_recorded', true ); |
|
315 | + $date_recorded = get_post_meta ( $episode_id, 'date_recorded', true ); |
|
316 | 316 | |
317 | 317 | // Build up meta data array with default values |
318 | 318 | $meta = array( |
@@ -323,62 +323,62 @@ discard block |
||
323 | 323 | 'date_recorded' => '', |
324 | 324 | ); |
325 | 325 | |
326 | - if( $link ) { |
|
327 | - $meta['link'] = $link; |
|
326 | + if ( $link ) { |
|
327 | + $meta[ 'link' ] = $link; |
|
328 | 328 | } |
329 | 329 | |
330 | - if( $link && apply_filters( 'ssp_show_new_window_link', true, $context ) ) { |
|
331 | - $meta['new_window'] = true; |
|
330 | + if ( $link && apply_filters ( 'ssp_show_new_window_link', true, $context ) ) { |
|
331 | + $meta[ 'new_window' ] = true; |
|
332 | 332 | } |
333 | 333 | |
334 | - if( $link ) { |
|
335 | - $meta['duration'] = $duration; |
|
334 | + if ( $link ) { |
|
335 | + $meta[ 'duration' ] = $duration; |
|
336 | 336 | } |
337 | 337 | |
338 | - if( $size ) { |
|
339 | - $meta['size'] = $size; |
|
338 | + if ( $size ) { |
|
339 | + $meta[ 'size' ] = $size; |
|
340 | 340 | } |
341 | 341 | |
342 | - if( $date_recorded ) { |
|
343 | - $meta['date_recorded'] = $date_recorded; |
|
342 | + if ( $date_recorded ) { |
|
343 | + $meta[ 'date_recorded' ] = $date_recorded; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | // Allow dynamic filtering of meta data - to remove, add or reorder meta items |
347 | - $meta = apply_filters( 'ssp_episode_meta_details', $meta, $episode_id, $context ); |
|
347 | + $meta = apply_filters ( 'ssp_episode_meta_details', $meta, $episode_id, $context ); |
|
348 | 348 | |
349 | 349 | $meta_display = ''; |
350 | - $meta_sep = apply_filters( 'ssp_episode_meta_separator', ' | ' ); |
|
350 | + $meta_sep = apply_filters ( 'ssp_episode_meta_separator', ' | ' ); |
|
351 | 351 | foreach ( $meta as $key => $data ) { |
352 | 352 | |
353 | - if( ! $data ) { |
|
353 | + if ( ! $data ) { |
|
354 | 354 | continue; |
355 | 355 | } |
356 | 356 | |
357 | - if( $meta_display ) { |
|
357 | + if ( $meta_display ) { |
|
358 | 358 | $meta_display .= $meta_sep; |
359 | 359 | } |
360 | 360 | |
361 | - switch( $key ) { |
|
361 | + switch ( $key ) { |
|
362 | 362 | |
363 | 363 | case 'link': |
364 | - $meta_display .= '<a href="' . esc_url( $data ) . '" title="' . get_the_title() . ' " class="podcast-meta-download" download>' . __( 'Download file' , 'seriously-simple-podcasting' ) . '</a>'; |
|
364 | + $meta_display .= '<a href="'.esc_url ( $data ).'" title="'.get_the_title ().' " class="podcast-meta-download" download>'.__ ( 'Download file', 'seriously-simple-podcasting' ).'</a>'; |
|
365 | 365 | break; |
366 | 366 | |
367 | 367 | case 'new_window': |
368 | - $play_link = add_query_arg( 'ref', 'new_window', $link ); |
|
369 | - $meta_display .= '<a href="' . esc_url( $play_link ) . '" target="_blank" title="' . get_the_title() . ' " class="podcast-meta-new-window">' . __( 'Play in new window' , 'seriously-simple-podcasting' ) . '</a>'; |
|
368 | + $play_link = add_query_arg ( 'ref', 'new_window', $link ); |
|
369 | + $meta_display .= '<a href="'.esc_url ( $play_link ).'" target="_blank" title="'.get_the_title ().' " class="podcast-meta-new-window">'.__ ( 'Play in new window', 'seriously-simple-podcasting' ).'</a>'; |
|
370 | 370 | break; |
371 | 371 | |
372 | 372 | case 'duration': |
373 | - $meta_display .= '<span class="podcast-meta-duration">' . __( 'Duration' , 'seriously-simple-podcasting' ) . ': ' . $data . '</span>'; |
|
373 | + $meta_display .= '<span class="podcast-meta-duration">'.__ ( 'Duration', 'seriously-simple-podcasting' ).': '.$data.'</span>'; |
|
374 | 374 | break; |
375 | 375 | |
376 | 376 | case 'size': |
377 | - $meta_display .= '<span class="podcast-meta-size">' . __( 'Size' , 'seriously-simple-podcasting' ) . ': ' . $data . '</span>'; |
|
377 | + $meta_display .= '<span class="podcast-meta-size">'.__ ( 'Size', 'seriously-simple-podcasting' ).': '.$data.'</span>'; |
|
378 | 378 | break; |
379 | 379 | |
380 | 380 | case 'date_recorded': |
381 | - $meta_display .= '<span class="podcast-meta-date">' . __( 'Recorded on' , 'seriously-simple-podcasting' ) . ' ' . date_i18n( get_option( 'date_format' ), strtotime( $data ) ) . '</span>'; |
|
381 | + $meta_display .= '<span class="podcast-meta-date">'.__ ( 'Recorded on', 'seriously-simple-podcasting' ).' '.date_i18n ( get_option ( 'date_format' ), strtotime ( $data ) ).'</span>'; |
|
382 | 382 | break; |
383 | 383 | |
384 | 384 | // Allow for custom items to be added, but only allow a small amount of HTML tags |
@@ -394,13 +394,13 @@ discard block |
||
394 | 394 | 'target' => array(), |
395 | 395 | ), |
396 | 396 | ); |
397 | - $meta_display .= wp_kses( $data, $allowed_tags ); |
|
397 | + $meta_display .= wp_kses ( $data, $allowed_tags ); |
|
398 | 398 | break; |
399 | 399 | |
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
403 | - $meta_display = '<div class="podcast_meta"><aside>' . $meta_display . '</aside></div>'; |
|
403 | + $meta_display = '<div class="podcast_meta"><aside>'.$meta_display.'</aside></div>'; |
|
404 | 404 | |
405 | 405 | return $meta_display; |
406 | 406 | |
@@ -412,43 +412,43 @@ discard block |
||
412 | 412 | */ |
413 | 413 | public function add_to_home_query( $query ) { |
414 | 414 | |
415 | - if ( is_admin() ) { |
|
415 | + if ( is_admin () ) { |
|
416 | 416 | return; |
417 | 417 | } |
418 | 418 | |
419 | - $include_in_main_query = get_option('ss_podcasting_include_in_main_query'); |
|
419 | + $include_in_main_query = get_option ( 'ss_podcasting_include_in_main_query' ); |
|
420 | 420 | if ( $include_in_main_query && $include_in_main_query == 'on' ) { |
421 | - if ( $query->is_home() && $query->is_main_query() ) { |
|
422 | - $query->set( 'post_type', array( 'post', 'podcast' ) ); |
|
421 | + if ( $query->is_home () && $query->is_main_query () ) { |
|
422 | + $query->set ( 'post_type', array( 'post', 'podcast' ) ); |
|
423 | 423 | } |
424 | 424 | } |
425 | 425 | } |
426 | 426 | |
427 | - public function add_all_post_types ( $query ) { |
|
427 | + public function add_all_post_types( $query ) { |
|
428 | 428 | |
429 | - if ( is_admin() ) { |
|
429 | + if ( is_admin () ) { |
|
430 | 430 | return; |
431 | 431 | } |
432 | 432 | |
433 | - if ( ! $query->is_main_query() ) { |
|
433 | + if ( ! $query->is_main_query () ) { |
|
434 | 434 | return; |
435 | 435 | } |
436 | 436 | |
437 | - if ( is_post_type_archive( 'podcast' ) || is_tax( 'series' ) ) { |
|
437 | + if ( is_post_type_archive ( 'podcast' ) || is_tax ( 'series' ) ) { |
|
438 | 438 | |
439 | - $podcast_post_types = ssp_post_types( false ); |
|
439 | + $podcast_post_types = ssp_post_types ( false ); |
|
440 | 440 | |
441 | 441 | if ( empty( $podcast_post_types ) ) { |
442 | 442 | return; |
443 | 443 | } |
444 | 444 | |
445 | - $episode_ids = ssp_episode_ids(); |
|
445 | + $episode_ids = ssp_episode_ids (); |
|
446 | 446 | if ( ! empty( $episode_ids ) ) { |
447 | 447 | |
448 | - $query->set( 'post__in', $episode_ids ); |
|
448 | + $query->set ( 'post__in', $episode_ids ); |
|
449 | 449 | |
450 | - $podcast_post_types[] = 'podcast'; |
|
451 | - $query->set( 'post_type', $podcast_post_types ); |
|
450 | + $podcast_post_types[ ] = 'podcast'; |
|
451 | + $query->set ( 'post_type', $podcast_post_types ); |
|
452 | 452 | |
453 | 453 | } |
454 | 454 | |
@@ -466,29 +466,29 @@ discard block |
||
466 | 466 | if ( $file ) { |
467 | 467 | |
468 | 468 | // Include media functions if necessary |
469 | - if ( ! function_exists( 'wp_read_audio_metadata' ) ) { |
|
470 | - require_once( ABSPATH . 'wp-admin/includes/media.php' ); |
|
469 | + if ( ! function_exists ( 'wp_read_audio_metadata' ) ) { |
|
470 | + require_once( ABSPATH.'wp-admin/includes/media.php' ); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | // translate file URL to local file path if possible |
474 | - $file = $this->get_local_file_path( $file ); |
|
474 | + $file = $this->get_local_file_path ( $file ); |
|
475 | 475 | |
476 | 476 | // Get file data (for local file) |
477 | - $data = wp_read_audio_metadata( $file ); |
|
477 | + $data = wp_read_audio_metadata ( $file ); |
|
478 | 478 | |
479 | 479 | $raw = $formatted = ''; |
480 | 480 | |
481 | 481 | if ( $data ) { |
482 | - $raw = $data['filesize']; |
|
483 | - $formatted = $this->format_bytes( $raw ); |
|
482 | + $raw = $data[ 'filesize' ]; |
|
483 | + $formatted = $this->format_bytes ( $raw ); |
|
484 | 484 | } else { |
485 | 485 | |
486 | 486 | // get file data (for remote file) |
487 | - $data = wp_remote_head( $file, array( 'timeout' => 10, 'redirection' => 5 ) ); |
|
487 | + $data = wp_remote_head ( $file, array( 'timeout' => 10, 'redirection' => 5 ) ); |
|
488 | 488 | |
489 | - if ( ! is_wp_error( $data ) && is_array( $data ) && isset( $data['headers']['content-length'] ) ) { |
|
490 | - $raw = $data['headers']['content-length']; |
|
491 | - $formatted = $this->format_bytes( $raw ); |
|
489 | + if ( ! is_wp_error ( $data ) && is_array ( $data ) && isset( $data[ 'headers' ][ 'content-length' ] ) ) { |
|
490 | + $raw = $data[ 'headers' ][ 'content-length' ]; |
|
491 | + $formatted = $this->format_bytes ( $raw ); |
|
492 | 492 | } |
493 | 493 | } |
494 | 494 | |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | 'formatted' => $formatted |
500 | 500 | ); |
501 | 501 | |
502 | - return apply_filters( 'ssp_file_size', $size, $file ); |
|
502 | + return apply_filters ( 'ssp_file_size', $size, $file ); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | } |
@@ -517,30 +517,30 @@ discard block |
||
517 | 517 | if ( $file ) { |
518 | 518 | |
519 | 519 | // Include media functions if necessary |
520 | - if ( ! function_exists( 'wp_read_audio_metadata' ) ) { |
|
521 | - require_once( ABSPATH . 'wp-admin/includes/media.php' ); |
|
520 | + if ( ! function_exists ( 'wp_read_audio_metadata' ) ) { |
|
521 | + require_once( ABSPATH.'wp-admin/includes/media.php' ); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | // translate file URL to local file path if possible |
525 | - $file = $this->get_local_file_path( $file ); |
|
525 | + $file = $this->get_local_file_path ( $file ); |
|
526 | 526 | |
527 | 527 | // Get file data (will only work for local files) |
528 | - $data = wp_read_audio_metadata( $file ); |
|
528 | + $data = wp_read_audio_metadata ( $file ); |
|
529 | 529 | |
530 | 530 | $duration = false; |
531 | 531 | |
532 | 532 | if ( $data ) { |
533 | - if ( isset( $data['length_formatted'] ) && strlen( $data['length_formatted'] ) > 0 ) { |
|
534 | - $duration = $data['length_formatted']; |
|
533 | + if ( isset( $data[ 'length_formatted' ] ) && strlen ( $data[ 'length_formatted' ] ) > 0 ) { |
|
534 | + $duration = $data[ 'length_formatted' ]; |
|
535 | 535 | } else { |
536 | - if ( isset( $data['length'] ) && strlen( $data['length'] ) > 0 ) { |
|
537 | - $duration = gmdate( 'H:i:s', $data['length'] ); |
|
536 | + if ( isset( $data[ 'length' ] ) && strlen ( $data[ 'length' ] ) > 0 ) { |
|
537 | + $duration = gmdate ( 'H:i:s', $data[ 'length' ] ); |
|
538 | 538 | } |
539 | 539 | } |
540 | 540 | } |
541 | 541 | |
542 | 542 | if ( $data ) { |
543 | - return apply_filters( 'ssp_file_duration', $duration, $file ); |
|
543 | + return apply_filters ( 'ssp_file_duration', $duration, $file ); |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | } |
@@ -554,15 +554,15 @@ discard block |
||
554 | 554 | * @param integer $precision Level of precision for formatting |
555 | 555 | * @return mixed Formatted file size on success, false on failure |
556 | 556 | */ |
557 | - protected function format_bytes( $size , $precision = 2 ) { |
|
557 | + protected function format_bytes( $size, $precision = 2 ) { |
|
558 | 558 | |
559 | 559 | if ( $size ) { |
560 | 560 | |
561 | - $base = log ( $size ) / log( 1024 ); |
|
562 | - $suffixes = array( '' , 'k' , 'M' , 'G' , 'T' ); |
|
563 | - $formatted_size = round( pow( 1024 , $base - floor( $base ) ) , $precision ) . $suffixes[ floor( $base ) ]; |
|
561 | + $base = log ( $size ) / log ( 1024 ); |
|
562 | + $suffixes = array( '', 'k', 'M', 'G', 'T' ); |
|
563 | + $formatted_size = round ( pow ( 1024, $base - floor ( $base ) ), $precision ).$suffixes[ floor ( $base ) ]; |
|
564 | 564 | |
565 | - return apply_filters( 'ssp_file_size_formatted', $formatted_size, $size ); |
|
565 | + return apply_filters ( 'ssp_file_size_formatted', $formatted_size, $size ); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | return false; |
@@ -578,10 +578,10 @@ discard block |
||
578 | 578 | |
579 | 579 | // Let's hash the URL to ensure that we don't get |
580 | 580 | // any illegal chars that might break the cache. |
581 | - $key = md5( $url ); |
|
581 | + $key = md5 ( $url ); |
|
582 | 582 | |
583 | 583 | // Do we have anything in the cache for this URL? |
584 | - $attachment_id = wp_cache_get( $key, 'attachment_id' ); |
|
584 | + $attachment_id = wp_cache_get ( $key, 'attachment_id' ); |
|
585 | 585 | |
586 | 586 | if ( $attachment_id === false ) { |
587 | 587 | |
@@ -598,39 +598,39 @@ discard block |
||
598 | 598 | |
599 | 599 | |
600 | 600 | // Function introduced in 4.0, let's try this first. |
601 | - if ( function_exists( 'attachment_url_to_postid' ) ) { |
|
602 | - $attachment_id = absint( attachment_url_to_postid( $url ) ); |
|
601 | + if ( function_exists ( 'attachment_url_to_postid' ) ) { |
|
602 | + $attachment_id = absint ( attachment_url_to_postid ( $url ) ); |
|
603 | 603 | if ( 0 !== $attachment_id ) { |
604 | - wp_cache_set( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
604 | + wp_cache_set ( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
605 | 605 | return $attachment_id; |
606 | 606 | } |
607 | 607 | } |
608 | 608 | |
609 | 609 | // Then this. |
610 | - if ( preg_match( '#\.[a-zA-Z0-9]+$#', $url ) ) { |
|
611 | - $sql = $wpdb->prepare( |
|
610 | + if ( preg_match ( '#\.[a-zA-Z0-9]+$#', $url ) ) { |
|
611 | + $sql = $wpdb->prepare ( |
|
612 | 612 | "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND guid = %s", |
613 | - esc_url_raw( $url ) |
|
613 | + esc_url_raw ( $url ) |
|
614 | 614 | ); |
615 | - $attachment_id = absint( $wpdb->get_var( $sql ) ); |
|
615 | + $attachment_id = absint ( $wpdb->get_var ( $sql ) ); |
|
616 | 616 | if ( 0 !== $attachment_id ) { |
617 | - wp_cache_set( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
617 | + wp_cache_set ( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
618 | 618 | return $attachment_id; |
619 | 619 | } |
620 | 620 | } |
621 | 621 | |
622 | 622 | // And then try this |
623 | - $upload_dir_paths = wp_upload_dir(); |
|
624 | - if ( false !== strpos( $url, $upload_dir_paths['baseurl'] ) ) { |
|
623 | + $upload_dir_paths = wp_upload_dir (); |
|
624 | + if ( false !== strpos ( $url, $upload_dir_paths[ 'baseurl' ] ) ) { |
|
625 | 625 | // Ensure that we have file extension that matches iTunes. |
626 | - $url = preg_replace( '/(?=\.(m4a|mp3|mov|mp4)$)/i', '', $url ); |
|
626 | + $url = preg_replace ( '/(?=\.(m4a|mp3|mov|mp4)$)/i', '', $url ); |
|
627 | 627 | // Remove the upload path base directory from the attachment URL |
628 | - $url = str_replace( $upload_dir_paths['baseurl'] . '/', '', $url ); |
|
628 | + $url = str_replace ( $upload_dir_paths[ 'baseurl' ].'/', '', $url ); |
|
629 | 629 | // Finally, run a custom database query to get the attachment ID from the modified attachment URL |
630 | - $sql = $wpdb->prepare( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $url ); |
|
631 | - $attachment_id = absint( $wpdb->get_var( $sql ) ); |
|
630 | + $sql = $wpdb->prepare ( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $url ); |
|
631 | + $attachment_id = absint ( $wpdb->get_var ( $sql ) ); |
|
632 | 632 | if ( 0 !== $attachment_id ) { |
633 | - wp_cache_set( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
633 | + wp_cache_set ( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
634 | 634 | return $attachment_id; |
635 | 635 | } |
636 | 636 | } |
@@ -648,20 +648,20 @@ discard block |
||
648 | 648 | public function get_attachment_mimetype( $attachment = '' ) { |
649 | 649 | |
650 | 650 | // Let's hash the URL to ensure that we don't get any illegal chars that might break the cache. |
651 | - $key = md5( $attachment ); |
|
651 | + $key = md5 ( $attachment ); |
|
652 | 652 | |
653 | 653 | if ( $attachment ) { |
654 | 654 | // Do we have anything in the cache for this? |
655 | - $mime = wp_cache_get( $key, 'mime-type' ); |
|
655 | + $mime = wp_cache_get ( $key, 'mime-type' ); |
|
656 | 656 | if ( $mime === false ) { |
657 | 657 | |
658 | 658 | // Get the ID |
659 | - $id = $this->get_attachment_id_from_url( $attachment ); |
|
659 | + $id = $this->get_attachment_id_from_url ( $attachment ); |
|
660 | 660 | |
661 | 661 | // Get the MIME type |
662 | - $mime = get_post_mime_type( $id ); |
|
662 | + $mime = get_post_mime_type ( $id ); |
|
663 | 663 | // Set the cache |
664 | - wp_cache_set( $key, $mime, 'mime-type', DAY_IN_SECONDS ); |
|
664 | + wp_cache_set ( $key, $mime, 'mime-type', DAY_IN_SECONDS ); |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | return $mime; |
@@ -678,8 +678,8 @@ discard block |
||
678 | 678 | * @return string Audio player HTML on success, false on failure |
679 | 679 | */ |
680 | 680 | public function audio_player( $src = '', $episode_id = 0 ) { |
681 | - $player = $this->media_player( $src, $episode_id ); |
|
682 | - return apply_filters( 'ssp_audio_player', $player, $src, $episode_id ); |
|
681 | + $player = $this->media_player ( $src, $episode_id ); |
|
682 | + return apply_filters ( 'ssp_audio_player', $player, $src, $episode_id ); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | /** |
@@ -688,40 +688,40 @@ discard block |
||
688 | 688 | * @param integer $episode_id Episode ID for audio file |
689 | 689 | * @return string Media player HTML on success, empty string on failure |
690 | 690 | */ |
691 | - public function media_player ( $src = '', $episode_id = 0 ) { |
|
691 | + public function media_player( $src = '', $episode_id = 0 ) { |
|
692 | 692 | $player = ''; |
693 | 693 | |
694 | 694 | if ( $src ) { |
695 | 695 | |
696 | 696 | // Get episode type and default to audio |
697 | - $type = $this->get_episode_type( $episode_id ); |
|
698 | - if( ! $type ) { |
|
697 | + $type = $this->get_episode_type ( $episode_id ); |
|
698 | + if ( ! $type ) { |
|
699 | 699 | $type = 'audio'; |
700 | 700 | } |
701 | 701 | |
702 | 702 | // Switch to podcast player URL |
703 | - $src = str_replace( 'podcast-download', 'podcast-player', $src ); |
|
703 | + $src = str_replace ( 'podcast-download', 'podcast-player', $src ); |
|
704 | 704 | |
705 | 705 | // Set up paramters for media player |
706 | 706 | $params = array( 'src' => $src, 'preload' => 'none' ); |
707 | 707 | |
708 | 708 | // Use built-in WordPress media player |
709 | - switch( $type ) { |
|
710 | - case 'audio': $player = wp_audio_shortcode( $params ); break; |
|
709 | + switch ( $type ) { |
|
710 | + case 'audio': $player = wp_audio_shortcode ( $params ); break; |
|
711 | 711 | case 'video': |
712 | 712 | // Use featured image as video poster |
713 | - if( $episode_id && has_post_thumbnail( $episode_id ) ) { |
|
714 | - $poster = wp_get_attachment_url( get_post_thumbnail_id( $episode_id ) ); |
|
715 | - if( $poster ) { |
|
716 | - $params['poster'] = $poster; |
|
713 | + if ( $episode_id && has_post_thumbnail ( $episode_id ) ) { |
|
714 | + $poster = wp_get_attachment_url ( get_post_thumbnail_id ( $episode_id ) ); |
|
715 | + if ( $poster ) { |
|
716 | + $params[ 'poster' ] = $poster; |
|
717 | 717 | } |
718 | 718 | } |
719 | - $player = wp_video_shortcode( $params ); |
|
719 | + $player = wp_video_shortcode ( $params ); |
|
720 | 720 | break; |
721 | 721 | } |
722 | 722 | |
723 | 723 | // Allow filtering so that alternative players can be used |
724 | - $player = apply_filters( 'ssp_media_player', $player, $src, $episode_id ); |
|
724 | + $player = apply_filters ( 'ssp_media_player', $player, $src, $episode_id ); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | return $player; |
@@ -736,17 +736,17 @@ discard block |
||
736 | 736 | public function get_image( $id = 0, $size = 'full' ) { |
737 | 737 | $image = ''; |
738 | 738 | |
739 | - if ( has_post_thumbnail( $id ) ) { |
|
739 | + if ( has_post_thumbnail ( $id ) ) { |
|
740 | 740 | // If not a string or an array, and not an integer, default to 200x9999. |
741 | - if ( is_int( $size ) || ( 0 < intval( $size ) ) ) { |
|
742 | - $size = array( intval( $size ), intval( $size ) ); |
|
743 | - } elseif ( ! is_string( $size ) && ! is_array( $size ) ) { |
|
741 | + if ( is_int ( $size ) || ( 0 < intval ( $size ) ) ) { |
|
742 | + $size = array( intval ( $size ), intval ( $size ) ); |
|
743 | + } elseif ( ! is_string ( $size ) && ! is_array ( $size ) ) { |
|
744 | 744 | $size = array( 200, 9999 ); |
745 | 745 | } |
746 | - $image = get_the_post_thumbnail( intval( $id ), $size ); |
|
746 | + $image = get_the_post_thumbnail ( intval ( $id ), $size ); |
|
747 | 747 | } |
748 | 748 | |
749 | - return apply_filters( 'ssp_episode_image', $image, $id ); |
|
749 | + return apply_filters ( 'ssp_episode_image', $image, $id ); |
|
750 | 750 | } |
751 | 751 | |
752 | 752 | /** |
@@ -761,29 +761,29 @@ discard block |
||
761 | 761 | 'series' => '' |
762 | 762 | ); |
763 | 763 | |
764 | - $args = apply_filters( 'ssp_get_podcast_args', wp_parse_args( $args, $defaults ) ); |
|
764 | + $args = apply_filters ( 'ssp_get_podcast_args', wp_parse_args ( $args, $defaults ) ); |
|
765 | 765 | |
766 | 766 | $query = array(); |
767 | 767 | |
768 | - if ( 'episodes' == $args['content'] ) { |
|
768 | + if ( 'episodes' == $args[ 'content' ] ) { |
|
769 | 769 | |
770 | 770 | // Get selected series |
771 | 771 | $podcast_series = ''; |
772 | - if ( isset( $args['series'] ) && $args['series'] ) { |
|
773 | - $podcast_series = $args['series']; |
|
772 | + if ( isset( $args[ 'series' ] ) && $args[ 'series' ] ) { |
|
773 | + $podcast_series = $args[ 'series' ]; |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | // Get query args |
777 | - $query_args = apply_filters( 'ssp_get_podcast_query_args', ssp_episodes( -1, $podcast_series, true, '' ) ); |
|
777 | + $query_args = apply_filters ( 'ssp_get_podcast_query_args', ssp_episodes ( -1, $podcast_series, true, '' ) ); |
|
778 | 778 | |
779 | 779 | // The Query |
780 | - $query = get_posts( $query_args ); |
|
780 | + $query = get_posts ( $query_args ); |
|
781 | 781 | |
782 | 782 | // The Display |
783 | - if ( ! is_wp_error( $query ) && is_array( $query ) && count( $query ) > 0 ) { |
|
783 | + if ( ! is_wp_error ( $query ) && is_array ( $query ) && count ( $query ) > 0 ) { |
|
784 | 784 | foreach ( $query as $k => $v ) { |
785 | 785 | // Get the URL |
786 | - $query[$k]->url = get_permalink( $v->ID ); |
|
786 | + $query[ $k ]->url = get_permalink ( $v->ID ); |
|
787 | 787 | } |
788 | 788 | } else { |
789 | 789 | $query = false; |
@@ -791,27 +791,27 @@ discard block |
||
791 | 791 | |
792 | 792 | } else { |
793 | 793 | |
794 | - $terms = get_terms( 'series' ); |
|
794 | + $terms = get_terms ( 'series' ); |
|
795 | 795 | |
796 | - if ( count( $terms ) > 0) { |
|
796 | + if ( count ( $terms ) > 0 ) { |
|
797 | 797 | |
798 | 798 | foreach ( $terms as $term ) { |
799 | - $query[ $term->term_id ] = new stdClass(); |
|
799 | + $query[ $term->term_id ] = new stdClass (); |
|
800 | 800 | $query[ $term->term_id ]->title = $term->name; |
801 | - $query[ $term->term_id ]->url = get_term_link( $term ); |
|
801 | + $query[ $term->term_id ]->url = get_term_link ( $term ); |
|
802 | 802 | |
803 | - $query_args = apply_filters( 'ssp_get_podcast_series_query_args', ssp_episodes( -1, $term->slug, true, '' ) ); |
|
803 | + $query_args = apply_filters ( 'ssp_get_podcast_series_query_args', ssp_episodes ( -1, $term->slug, true, '' ) ); |
|
804 | 804 | |
805 | - $posts = get_posts( $query_args ); |
|
805 | + $posts = get_posts ( $query_args ); |
|
806 | 806 | |
807 | - $count = count( $posts ); |
|
807 | + $count = count ( $posts ); |
|
808 | 808 | $query[ $term->term_id ]->count = $count; |
809 | 809 | } |
810 | 810 | } |
811 | 811 | |
812 | 812 | } |
813 | 813 | |
814 | - $query['content'] = $args['content']; |
|
814 | + $query[ 'content' ] = $args[ 'content' ]; |
|
815 | 815 | |
816 | 816 | return $query; |
817 | 817 | } |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | public function get_enclosure( $episode_id = 0 ) { |
825 | 825 | |
826 | 826 | if ( $episode_id ) { |
827 | - return apply_filters( 'ssp_episode_enclosure', get_post_meta( $episode_id, 'audio_file', true ), $episode_id ); |
|
827 | + return apply_filters ( 'ssp_episode_enclosure', get_post_meta ( $episode_id, 'audio_file', true ), $episode_id ); |
|
828 | 828 | } |
829 | 829 | |
830 | 830 | return ''; |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | |
843 | 843 | if ( $file != '' ) { |
844 | 844 | |
845 | - $post_types = ssp_post_types( true ); |
|
845 | + $post_types = ssp_post_types ( true ); |
|
846 | 846 | |
847 | 847 | $args = array( |
848 | 848 | 'post_type' => $post_types, |
@@ -852,17 +852,17 @@ discard block |
||
852 | 852 | 'meta_value' => $file |
853 | 853 | ); |
854 | 854 | |
855 | - $qry = new WP_Query( $args ); |
|
855 | + $qry = new WP_Query ( $args ); |
|
856 | 856 | |
857 | - if ( $qry->have_posts() ) { |
|
858 | - while ( $qry->have_posts() ) { $qry->the_post(); |
|
857 | + if ( $qry->have_posts () ) { |
|
858 | + while ( $qry->have_posts () ) { $qry->the_post (); |
|
859 | 859 | $episode = $post; |
860 | 860 | break; |
861 | 861 | } |
862 | 862 | } |
863 | 863 | } |
864 | 864 | |
865 | - return apply_filters( 'ssp_episode_from_file', $episode, $file ); |
|
865 | + return apply_filters ( 'ssp_episode_from_file', $episode, $file ); |
|
866 | 866 | |
867 | 867 | } |
868 | 868 | |
@@ -872,33 +872,33 @@ discard block |
||
872 | 872 | */ |
873 | 873 | public function download_file() { |
874 | 874 | |
875 | - if ( is_podcast_download() ) { |
|
875 | + if ( is_podcast_download () ) { |
|
876 | 876 | global $wp_query; |
877 | 877 | |
878 | 878 | // Get requested episode ID |
879 | - $episode_id = intval( $wp_query->query_vars['podcast_episode'] ); |
|
879 | + $episode_id = intval ( $wp_query->query_vars[ 'podcast_episode' ] ); |
|
880 | 880 | |
881 | 881 | if ( isset( $episode_id ) && $episode_id ) { |
882 | 882 | |
883 | 883 | // Get episode post object |
884 | - $episode = get_post( $episode_id ); |
|
884 | + $episode = get_post ( $episode_id ); |
|
885 | 885 | |
886 | 886 | // Make sure we have a valid episode post object |
887 | - if ( ! $episode || ! is_object( $episode ) || is_wp_error( $episode ) || ! isset( $episode->ID ) ) { |
|
887 | + if ( ! $episode || ! is_object ( $episode ) || is_wp_error ( $episode ) || ! isset( $episode->ID ) ) { |
|
888 | 888 | return; |
889 | 889 | } |
890 | 890 | |
891 | 891 | // Do we have newlines? |
892 | 892 | $parts = false; |
893 | - if( is_string( $episode ) ) { |
|
894 | - $parts = explode( "\n", $episode ); |
|
893 | + if ( is_string ( $episode ) ) { |
|
894 | + $parts = explode ( "\n", $episode ); |
|
895 | 895 | } |
896 | 896 | |
897 | - if ( $parts && is_array( $parts ) && count( $parts ) > 1 ) { |
|
898 | - $file = $parts[0]; |
|
897 | + if ( $parts && is_array ( $parts ) && count ( $parts ) > 1 ) { |
|
898 | + $file = $parts[ 0 ]; |
|
899 | 899 | } else { |
900 | 900 | // Get audio file for download |
901 | - $file = $this->get_enclosure( $episode_id ); |
|
901 | + $file = $this->get_enclosure ( $episode_id ); |
|
902 | 902 | } |
903 | 903 | |
904 | 904 | // Exit if no file is found |
@@ -908,77 +908,77 @@ discard block |
||
908 | 908 | |
909 | 909 | // Get file referrer |
910 | 910 | $referrer = ''; |
911 | - if( isset( $wp_query->query_vars['podcast_ref'] ) && $wp_query->query_vars['podcast_ref'] ) { |
|
912 | - $referrer = $wp_query->query_vars['podcast_ref']; |
|
911 | + if ( isset( $wp_query->query_vars[ 'podcast_ref' ] ) && $wp_query->query_vars[ 'podcast_ref' ] ) { |
|
912 | + $referrer = $wp_query->query_vars[ 'podcast_ref' ]; |
|
913 | 913 | } else { |
914 | - if( isset( $_GET['ref'] ) ) { |
|
915 | - $referrer = esc_attr( $_GET['ref'] ); |
|
914 | + if ( isset( $_GET[ 'ref' ] ) ) { |
|
915 | + $referrer = esc_attr ( $_GET[ 'ref' ] ); |
|
916 | 916 | } |
917 | 917 | } |
918 | 918 | |
919 | 919 | // Allow other actions - functions hooked on here must not output any data |
920 | - do_action( 'ssp_file_download', $file, $episode, $referrer ); |
|
920 | + do_action ( 'ssp_file_download', $file, $episode, $referrer ); |
|
921 | 921 | |
922 | 922 | // Set necessary headers |
923 | - header( "Pragma: no-cache" ); |
|
924 | - header( "Expires: 0" ); |
|
925 | - header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); |
|
926 | - header( "Robots: none" ); |
|
923 | + header ( "Pragma: no-cache" ); |
|
924 | + header ( "Expires: 0" ); |
|
925 | + header ( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); |
|
926 | + header ( "Robots: none" ); |
|
927 | 927 | |
928 | 928 | // Check file referrer |
929 | - if( 'download' == $referrer ) { |
|
929 | + if ( 'download' == $referrer ) { |
|
930 | 930 | |
931 | 931 | // Set size of file |
932 | 932 | // Do we have anything in Cache/DB? |
933 | - $size = wp_cache_get( $episode_id, 'filesize_raw' ); |
|
933 | + $size = wp_cache_get ( $episode_id, 'filesize_raw' ); |
|
934 | 934 | |
935 | 935 | // Nothing in the cache, let's see if we can figure it out. |
936 | 936 | if ( false === $size ) { |
937 | 937 | |
938 | 938 | // Do we have anything in post_meta? |
939 | - $size = get_post_meta( $episode_id, 'filesize_raw', true ); |
|
939 | + $size = get_post_meta ( $episode_id, 'filesize_raw', true ); |
|
940 | 940 | |
941 | 941 | if ( empty( $size ) ) { |
942 | 942 | |
943 | 943 | // Let's see if we can figure out the path... |
944 | - $attachment_id = $this->get_attachment_id_from_url( $file ); |
|
944 | + $attachment_id = $this->get_attachment_id_from_url ( $file ); |
|
945 | 945 | |
946 | - if ( ! empty( $attachment_id ) ) { |
|
947 | - $size = filesize( get_attached_file( $attachment_id ) ); |
|
948 | - update_post_meta( $episode_id, 'filesize_raw', $size ); |
|
946 | + if ( ! empty( $attachment_id ) ) { |
|
947 | + $size = filesize ( get_attached_file ( $attachment_id ) ); |
|
948 | + update_post_meta ( $episode_id, 'filesize_raw', $size ); |
|
949 | 949 | } |
950 | 950 | |
951 | 951 | } |
952 | 952 | |
953 | 953 | // Update the cache |
954 | - wp_cache_set( $episode_id, $size, 'filesize_raw' ); |
|
954 | + wp_cache_set ( $episode_id, $size, 'filesize_raw' ); |
|
955 | 955 | } |
956 | 956 | |
957 | 957 | // Send Content-Length header |
958 | 958 | if ( ! empty( $size ) ) { |
959 | - header( "Content-Length: " . $size ); |
|
959 | + header ( "Content-Length: ".$size ); |
|
960 | 960 | } |
961 | 961 | |
962 | 962 | // Force file download |
963 | - header( "Content-Type: application/force-download" ); |
|
963 | + header ( "Content-Type: application/force-download" ); |
|
964 | 964 | |
965 | 965 | // Set other relevant headers |
966 | - header( "Content-Description: File Transfer" ); |
|
967 | - header( "Content-Disposition: attachment; filename=\"" . basename( $file ) . "\";" ); |
|
968 | - header( "Content-Transfer-Encoding: binary" ); |
|
966 | + header ( "Content-Description: File Transfer" ); |
|
967 | + header ( "Content-Disposition: attachment; filename=\"".basename ( $file )."\";" ); |
|
968 | + header ( "Content-Transfer-Encoding: binary" ); |
|
969 | 969 | |
970 | 970 | // Encode spaces in file names until this is fixed in core (https://core.trac.wordpress.org/ticket/36998) |
971 | - $file = str_replace( ' ', '%20', $file ); |
|
971 | + $file = str_replace ( ' ', '%20', $file ); |
|
972 | 972 | |
973 | 973 | // Use ssp_readfile_chunked() if allowed on the server or simply access file directly |
974 | - @ssp_readfile_chunked( $file ) or header( 'Location: ' . $file ); |
|
974 | + @ssp_readfile_chunked ( $file ) or header ( 'Location: '.$file ); |
|
975 | 975 | } else { |
976 | 976 | |
977 | 977 | // Encode spaces in file names until this is fixed in core (https://core.trac.wordpress.org/ticket/36998) |
978 | - $file = str_replace( ' ', '%20', $file ); |
|
978 | + $file = str_replace ( ' ', '%20', $file ); |
|
979 | 979 | |
980 | 980 | // For all other referrers redirect to the raw file |
981 | - wp_redirect( $file, 302 ); |
|
981 | + wp_redirect ( $file, 302 ); |
|
982 | 982 | } |
983 | 983 | |
984 | 984 | // Exit to prevent other processes running later on |
@@ -995,16 +995,16 @@ discard block |
||
995 | 995 | public function generator_tag( $gen, $type ) { |
996 | 996 | |
997 | 997 | // Allow generator tags to be hidden if necessary |
998 | - if ( apply_filters( 'ssp_show_generator_tag', true, $type ) ) { |
|
998 | + if ( apply_filters ( 'ssp_show_generator_tag', true, $type ) ) { |
|
999 | 999 | |
1000 | - $generator = 'Seriously Simple Podcasting ' . esc_attr( $this->version ); |
|
1000 | + $generator = 'Seriously Simple Podcasting '.esc_attr ( $this->version ); |
|
1001 | 1001 | |
1002 | 1002 | switch ( $type ) { |
1003 | 1003 | case 'html': |
1004 | - $gen .= "\n" . '<meta name="generator" content="' . $generator . '">'; |
|
1004 | + $gen .= "\n".'<meta name="generator" content="'.$generator.'">'; |
|
1005 | 1005 | break; |
1006 | 1006 | case 'xhtml': |
1007 | - $gen .= "\n" . '<meta name="generator" content="' . $generator . '" />'; |
|
1007 | + $gen .= "\n".'<meta name="generator" content="'.$generator.'" />'; |
|
1008 | 1008 | break; |
1009 | 1009 | } |
1010 | 1010 | |
@@ -1020,53 +1020,53 @@ discard block |
||
1020 | 1020 | public function rss_meta_tag() { |
1021 | 1021 | |
1022 | 1022 | // Get feed slug |
1023 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
1023 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
1024 | 1024 | |
1025 | - if ( get_option( 'permalink_structure' ) ) { |
|
1026 | - $feed_url = $this->home_url . 'feed/' . $feed_slug; |
|
1025 | + if ( get_option ( 'permalink_structure' ) ) { |
|
1026 | + $feed_url = $this->home_url.'feed/'.$feed_slug; |
|
1027 | 1027 | } else { |
1028 | - $feed_url = $this->home_url . '?feed=' . $feed_slug; |
|
1028 | + $feed_url = $this->home_url.'?feed='.$feed_slug; |
|
1029 | 1029 | } |
1030 | 1030 | |
1031 | - $custom_feed_url = get_option( 'ss_podcasting_feed_url' ); |
|
1031 | + $custom_feed_url = get_option ( 'ss_podcasting_feed_url' ); |
|
1032 | 1032 | if ( $custom_feed_url ) { |
1033 | 1033 | $feed_url = $custom_feed_url; |
1034 | 1034 | } |
1035 | 1035 | |
1036 | - $feed_url = apply_filters( 'ssp_feed_url', $feed_url ); |
|
1036 | + $feed_url = apply_filters ( 'ssp_feed_url', $feed_url ); |
|
1037 | 1037 | |
1038 | 1038 | $html = ''; |
1039 | 1039 | |
1040 | - if( apply_filters( 'ssp_show_global_feed_tag', true ) ) { |
|
1041 | - $html = '<link rel="alternate" type="application/rss+xml" title="' . __( 'Podcast RSS feed', 'seriously-simple-podcasting' ) . '" href="' . esc_url( $feed_url ) . '" />'; |
|
1040 | + if ( apply_filters ( 'ssp_show_global_feed_tag', true ) ) { |
|
1041 | + $html = '<link rel="alternate" type="application/rss+xml" title="'.__ ( 'Podcast RSS feed', 'seriously-simple-podcasting' ).'" href="'.esc_url ( $feed_url ).'" />'; |
|
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | // Check if this is a series taxonomy archive and display series-specific RSS feed tag |
1045 | - $current_obj = get_queried_object(); |
|
1046 | - if( isset( $current_obj->taxonomy ) && 'series' == $current_obj->taxonomy && isset( $current_obj->slug ) && $current_obj->slug ) { |
|
1045 | + $current_obj = get_queried_object (); |
|
1046 | + if ( isset( $current_obj->taxonomy ) && 'series' == $current_obj->taxonomy && isset( $current_obj->slug ) && $current_obj->slug ) { |
|
1047 | 1047 | |
1048 | - if( apply_filters( 'ssp_show_series_feed_tag', true, $current_obj->slug ) ) { |
|
1048 | + if ( apply_filters ( 'ssp_show_series_feed_tag', true, $current_obj->slug ) ) { |
|
1049 | 1049 | |
1050 | - if ( get_option( 'permalink_structure' ) ) { |
|
1051 | - $series_feed_url = $feed_url . '/' . $current_obj->slug; |
|
1050 | + if ( get_option ( 'permalink_structure' ) ) { |
|
1051 | + $series_feed_url = $feed_url.'/'.$current_obj->slug; |
|
1052 | 1052 | } else { |
1053 | - $series_feed_url = $feed_url . '&podcast_series=' . $current_obj->slug; |
|
1053 | + $series_feed_url = $feed_url.'&podcast_series='.$current_obj->slug; |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | - $html .= "\n" . '<link rel="alternate" type="application/rss+xml" title="' . sprintf( __( '%s RSS feed', 'seriously-simple-podcasting' ), $current_obj->name ) . '" href="' . esc_url( $series_feed_url ) . '" />'; |
|
1056 | + $html .= "\n".'<link rel="alternate" type="application/rss+xml" title="'.sprintf ( __ ( '%s RSS feed', 'seriously-simple-podcasting' ), $current_obj->name ).'" href="'.esc_url ( $series_feed_url ).'" />'; |
|
1057 | 1057 | |
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | } |
1061 | 1061 | |
1062 | - echo "\n" . apply_filters( 'ssp_rss_meta_tag', $html ) . "\n\n"; |
|
1062 | + echo "\n".apply_filters ( 'ssp_rss_meta_tag', $html )."\n\n"; |
|
1063 | 1063 | } |
1064 | 1064 | |
1065 | 1065 | /** |
1066 | 1066 | * Register plugin widgets |
1067 | 1067 | * @return void |
1068 | 1068 | */ |
1069 | - public function register_widgets () { |
|
1069 | + public function register_widgets() { |
|
1070 | 1070 | |
1071 | 1071 | $widgets = array( |
1072 | 1072 | 'recent-episodes' => 'Recent_Episodes', |
@@ -1075,8 +1075,8 @@ discard block |
||
1075 | 1075 | ); |
1076 | 1076 | |
1077 | 1077 | foreach ( $widgets as $id => $name ) { |
1078 | - require_once( $this->dir . '/includes/widgets/class-ssp-widget-' . $id . '.php' ); |
|
1079 | - register_widget( 'SSP_Widget_' . $name ); |
|
1078 | + require_once( $this->dir.'/includes/widgets/class-ssp-widget-'.$id.'.php' ); |
|
1079 | + register_widget ( 'SSP_Widget_'.$name ); |
|
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | } |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | * Register plugin shortcodes |
1086 | 1086 | * @return void |
1087 | 1087 | */ |
1088 | - public function register_shortcodes () { |
|
1088 | + public function register_shortcodes() { |
|
1089 | 1089 | |
1090 | 1090 | $shortcodes = array( |
1091 | 1091 | 'podcast_episode', |
@@ -1094,8 +1094,8 @@ discard block |
||
1094 | 1094 | ); |
1095 | 1095 | |
1096 | 1096 | foreach ( $shortcodes as $shortcode ) { |
1097 | - require_once( $this->dir . '/includes/shortcodes/class-ssp-shortcode-' . $shortcode . '.php' ); |
|
1098 | - add_shortcode( $shortcode, array( $GLOBALS['ssp_shortcodes'][ $shortcode ], 'shortcode' ) ); |
|
1097 | + require_once( $this->dir.'/includes/shortcodes/class-ssp-shortcode-'.$shortcode.'.php' ); |
|
1098 | + add_shortcode ( $shortcode, array( $GLOBALS[ 'ssp_shortcodes' ][ $shortcode ], 'shortcode' ) ); |
|
1099 | 1099 | } |
1100 | 1100 | |
1101 | 1101 | } |
@@ -1106,64 +1106,64 @@ discard block |
||
1106 | 1106 | * @param array $content_items Orderd array of content items to display |
1107 | 1107 | * @return string HTML of episode with specified content items |
1108 | 1108 | */ |
1109 | - public function podcast_episode ( $episode_id = 0, $content_items = array( 'title', 'player', 'details' ), $context = '' ) { |
|
1109 | + public function podcast_episode( $episode_id = 0, $content_items = array( 'title', 'player', 'details' ), $context = '' ) { |
|
1110 | 1110 | global $post, $episode_context; |
1111 | 1111 | |
1112 | - if ( ! $episode_id || ! is_array( $content_items ) || empty( $content_items ) ) { |
|
1112 | + if ( ! $episode_id || ! is_array ( $content_items ) || empty( $content_items ) ) { |
|
1113 | 1113 | return; |
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | // Get episode object |
1117 | - $episode = get_post( $episode_id ); |
|
1117 | + $episode = get_post ( $episode_id ); |
|
1118 | 1118 | |
1119 | - if ( ! $episode || is_wp_error( $episode ) ) { |
|
1119 | + if ( ! $episode || is_wp_error ( $episode ) ) { |
|
1120 | 1120 | return; |
1121 | 1121 | } |
1122 | 1122 | |
1123 | - $html = '<div class="podcast-episode episode-' . esc_attr( $episode_id ) . '">' . "\n"; |
|
1123 | + $html = '<div class="podcast-episode episode-'.esc_attr ( $episode_id ).'">'."\n"; |
|
1124 | 1124 | |
1125 | 1125 | // Setup post data for episode post object |
1126 | 1126 | $post = $episode; |
1127 | - setup_postdata( $post ); |
|
1127 | + setup_postdata ( $post ); |
|
1128 | 1128 | |
1129 | 1129 | $episode_context = $context; |
1130 | 1130 | |
1131 | 1131 | // Display specified content items in the order supplied |
1132 | 1132 | foreach ( $content_items as $item ) { |
1133 | 1133 | |
1134 | - switch( $item ) { |
|
1134 | + switch ( $item ) { |
|
1135 | 1135 | |
1136 | 1136 | case 'title': |
1137 | - $html .= '<h3 class="episode-title">' . get_the_title() . '</h3>' . "\n"; |
|
1137 | + $html .= '<h3 class="episode-title">'.get_the_title ().'</h3>'."\n"; |
|
1138 | 1138 | break; |
1139 | 1139 | |
1140 | 1140 | case 'excerpt': |
1141 | - $html .= '<p class="episode-excerpt">' . get_the_excerpt() . '</p>' . "\n"; |
|
1141 | + $html .= '<p class="episode-excerpt">'.get_the_excerpt ().'</p>'."\n"; |
|
1142 | 1142 | break; |
1143 | 1143 | |
1144 | 1144 | case 'content': |
1145 | - $html .= '<div class="episode-content">' . apply_filters( 'the_content', get_the_content() ) . '</div>' . "\n"; |
|
1145 | + $html .= '<div class="episode-content">'.apply_filters ( 'the_content', get_the_content () ).'</div>'."\n"; |
|
1146 | 1146 | break; |
1147 | 1147 | |
1148 | 1148 | case 'player': |
1149 | - $file = $this->get_enclosure( $episode_id ); |
|
1150 | - if ( get_option( 'permalink_structure' ) ) { |
|
1151 | - $file = $this->get_episode_download_link( $episode_id ); |
|
1149 | + $file = $this->get_enclosure ( $episode_id ); |
|
1150 | + if ( get_option ( 'permalink_structure' ) ) { |
|
1151 | + $file = $this->get_episode_download_link ( $episode_id ); |
|
1152 | 1152 | } |
1153 | - $html .= '<div class="podcast_player">' . $this->media_player( $file, $episode_id ) . '</div>' . "\n"; |
|
1153 | + $html .= '<div class="podcast_player">'.$this->media_player ( $file, $episode_id ).'</div>'."\n"; |
|
1154 | 1154 | break; |
1155 | 1155 | |
1156 | 1156 | case 'details': |
1157 | - $html .= $this->episode_meta_details( $episode_id, $episode_context ); |
|
1157 | + $html .= $this->episode_meta_details ( $episode_id, $episode_context ); |
|
1158 | 1158 | break; |
1159 | 1159 | |
1160 | 1160 | } |
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | // Reset post data after fetching episode details |
1164 | - wp_reset_postdata(); |
|
1164 | + wp_reset_postdata (); |
|
1165 | 1165 | |
1166 | - $html .= '</div>' . "\n"; |
|
1166 | + $html .= '</div>'."\n"; |
|
1167 | 1167 | |
1168 | 1168 | return $html; |
1169 | 1169 | } |
@@ -1178,26 +1178,26 @@ discard block |
||
1178 | 1178 | function get_local_file_path( $file ) { |
1179 | 1179 | |
1180 | 1180 | // Identify file by root path and not URL (required for getID3 class) |
1181 | - $site_root = trailingslashit( ABSPATH ); |
|
1181 | + $site_root = trailingslashit ( ABSPATH ); |
|
1182 | 1182 | |
1183 | 1183 | // Remove common dirs from the ends of site_url and site_root, so that file can be outside of the WordPress installation |
1184 | - $root_chunks = explode( '/', $site_root ); |
|
1185 | - $url_chunks = explode( '/', $this->site_url ); |
|
1184 | + $root_chunks = explode ( '/', $site_root ); |
|
1185 | + $url_chunks = explode ( '/', $this->site_url ); |
|
1186 | 1186 | |
1187 | - end( $root_chunks ); |
|
1188 | - end( $url_chunks ); |
|
1187 | + end ( $root_chunks ); |
|
1188 | + end ( $url_chunks ); |
|
1189 | 1189 | |
1190 | - while ( ! is_null( key( $root_chunks ) ) && ! is_null( key( $url_chunks ) ) && ( current( $root_chunks ) == current( $url_chunks ) ) ) { |
|
1191 | - array_pop( $root_chunks ); |
|
1192 | - array_pop( $url_chunks ); |
|
1193 | - end( $root_chunks ); |
|
1194 | - end( $url_chunks ); |
|
1190 | + while ( ! is_null ( key ( $root_chunks ) ) && ! is_null ( key ( $url_chunks ) ) && ( current ( $root_chunks ) == current ( $url_chunks ) ) ) { |
|
1191 | + array_pop ( $root_chunks ); |
|
1192 | + array_pop ( $url_chunks ); |
|
1193 | + end ( $root_chunks ); |
|
1194 | + end ( $url_chunks ); |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | - $site_root = implode('/', $root_chunks); |
|
1198 | - $site_url = implode('/', $url_chunks); |
|
1197 | + $site_root = implode ( '/', $root_chunks ); |
|
1198 | + $site_url = implode ( '/', $url_chunks ); |
|
1199 | 1199 | |
1200 | - $file = str_replace( $site_url, $site_root, $file ); |
|
1200 | + $file = str_replace ( $site_url, $site_root, $file ); |
|
1201 | 1201 | |
1202 | 1202 | return $file; |
1203 | 1203 | } |
@@ -1209,16 +1209,16 @@ discard block |
||
1209 | 1209 | * @param string $type Type of feed |
1210 | 1210 | * @return string Updated content type |
1211 | 1211 | */ |
1212 | - public function feed_content_type ( $content_type = '', $type = '' ) { |
|
1212 | + public function feed_content_type( $content_type = '', $type = '' ) { |
|
1213 | 1213 | |
1214 | - if( 'podcast' == $type ) { |
|
1214 | + if ( 'podcast' == $type ) { |
|
1215 | 1215 | $content_type = 'text/xml'; |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | return $content_type; |
1219 | 1219 | } |
1220 | 1220 | |
1221 | - public function load_localisation () { |
|
1222 | - load_plugin_textdomain( 'seriously-simple-podcasting', false, basename( dirname( $this->file ) ) . '/languages/' ); |
|
1221 | + public function load_localisation() { |
|
1222 | + load_plugin_textdomain ( 'seriously-simple-podcasting', false, basename ( dirname ( $this->file ) ).'/languages/' ); |
|
1223 | 1223 | } |
1224 | 1224 | } |
@@ -1,11 +1,11 @@ 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 | |
8 | -if ( ! function_exists( 'is_podcast_download' ) ) { |
|
8 | +if ( ! function_exists ( 'is_podcast_download' ) ) { |
|
9 | 9 | /** |
10 | 10 | * Check if podcast file is being downloaded |
11 | 11 | * @since 1.5 |
@@ -16,16 +16,16 @@ discard block |
||
16 | 16 | |
17 | 17 | $download = $episode = false; |
18 | 18 | |
19 | - if ( isset( $wp_query->query_vars['podcast_episode'] ) && $wp_query->query_vars['podcast_episode'] ) { |
|
19 | + if ( isset( $wp_query->query_vars[ 'podcast_episode' ] ) && $wp_query->query_vars[ 'podcast_episode' ] ) { |
|
20 | 20 | $download = true; |
21 | - $episode = intval( $wp_query->query_vars['podcast_episode'] ); |
|
21 | + $episode = intval ( $wp_query->query_vars[ 'podcast_episode' ] ); |
|
22 | 22 | } |
23 | 23 | |
24 | - return apply_filters( 'ssp_is_podcast_download', $download, $episode ); |
|
24 | + return apply_filters ( 'ssp_is_podcast_download', $download, $episode ); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
28 | -if ( ! function_exists( 'ss_get_podcast' ) ) { |
|
28 | +if ( ! function_exists ( 'ss_get_podcast' ) ) { |
|
29 | 29 | /** |
30 | 30 | * Wrapper function to get the podcast episodes from the SeriouslySimplePodcasting class. |
31 | 31 | * @param mixed $args Arguments |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function ss_get_podcast( $args = '' ) { |
36 | 36 | global $ss_podcasting; |
37 | - return $ss_podcasting->get_podcast( $args ); |
|
37 | + return $ss_podcasting->get_podcast ( $args ); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * Enable the usage of do_action( 'get_podcast' ) to display podcast within a theme/plugin. |
43 | 43 | * @since 1.0.0 |
44 | 44 | */ |
45 | -add_action( 'get_podcast', 'ss_podcast' ); |
|
45 | +add_action ( 'get_podcast', 'ss_podcast' ); |
|
46 | 46 | |
47 | -if ( ! function_exists( 'ss_podcast' ) ) { |
|
47 | +if ( ! function_exists ( 'ss_podcast' ) ) { |
|
48 | 48 | /** |
49 | 49 | * Display or return HTML-formatted podcast data. |
50 | 50 | * @param mixed $args Arguments |
@@ -66,57 +66,57 @@ discard block |
||
66 | 66 | 'after_title' => '</h3>' |
67 | 67 | ); |
68 | 68 | |
69 | - $args = wp_parse_args( $args, $defaults ); |
|
69 | + $args = wp_parse_args ( $args, $defaults ); |
|
70 | 70 | |
71 | 71 | // Allow child themes/plugins to filter here |
72 | - $args = apply_filters( 'ssp_podcast_args', $args ); |
|
72 | + $args = apply_filters ( 'ssp_podcast_args', $args ); |
|
73 | 73 | $html = ''; |
74 | 74 | |
75 | - do_action( 'ssp_podcast_before', $args ); |
|
75 | + do_action ( 'ssp_podcast_before', $args ); |
|
76 | 76 | |
77 | 77 | // The Query |
78 | - $query = ss_get_podcast( $args ); |
|
78 | + $query = ss_get_podcast ( $args ); |
|
79 | 79 | |
80 | 80 | // The Display |
81 | - if ( ! is_wp_error( $query ) && is_array( $query ) && count( $query ) > 0 ) { |
|
82 | - $html .= $args['before'] . "\n"; |
|
81 | + if ( ! is_wp_error ( $query ) && is_array ( $query ) && count ( $query ) > 0 ) { |
|
82 | + $html .= $args[ 'before' ]."\n"; |
|
83 | 83 | |
84 | - if ( '' != $args['title'] ) { |
|
85 | - $html .= $args['before_title'] . esc_html( $args['title'] ) . $args['after_title'] . "\n"; |
|
84 | + if ( '' != $args[ 'title' ] ) { |
|
85 | + $html .= $args[ 'before_title' ].esc_html ( $args[ 'title' ] ).$args[ 'after_title' ]."\n"; |
|
86 | 86 | } |
87 | 87 | |
88 | - $html .= '<div class="ss_podcast">' . "\n"; |
|
88 | + $html .= '<div class="ss_podcast">'."\n"; |
|
89 | 89 | |
90 | 90 | // Begin templating logic. |
91 | 91 | $tpl = '<div class="%%CLASS%%"><h4 class="podcast-title">%%TITLE%%</h4><aside class="meta">%%META%%</aside></div>'; |
92 | - $tpl = apply_filters( 'ssp_podcast_item_template', $tpl, $args ); |
|
92 | + $tpl = apply_filters ( 'ssp_podcast_item_template', $tpl, $args ); |
|
93 | 93 | |
94 | - if ( $query['content'] == 'episodes' ) { |
|
94 | + if ( $query[ 'content' ] == 'episodes' ) { |
|
95 | 95 | |
96 | 96 | $i = 0; |
97 | 97 | foreach ( $query as $post ) { |
98 | 98 | |
99 | - if ( ! is_object( $post ) ) { |
|
99 | + if ( ! is_object ( $post ) ) { |
|
100 | 100 | continue; |
101 | 101 | } |
102 | 102 | |
103 | 103 | $template = $tpl; |
104 | 104 | $i++; |
105 | 105 | |
106 | - setup_postdata( $post ); |
|
106 | + setup_postdata ( $post ); |
|
107 | 107 | |
108 | 108 | $class = 'podcast'; |
109 | 109 | |
110 | - $title = get_the_title(); |
|
111 | - if ( true == $args['link_title'] ) { |
|
112 | - $title = '<a href="' . esc_url( $post->url ) . '" title="' . esc_attr( $title ) . '">' . $title . '</a>'; |
|
110 | + $title = get_the_title (); |
|
111 | + if ( true == $args[ 'link_title' ] ) { |
|
112 | + $title = '<a href="'.esc_url ( $post->url ).'" title="'.esc_attr ( $title ).'">'.$title.'</a>'; |
|
113 | 113 | } |
114 | 114 | |
115 | - $meta = $ss_podcasting->episode_meta( $post->ID, 'shortcode' ); |
|
115 | + $meta = $ss_podcasting->episode_meta ( $post->ID, 'shortcode' ); |
|
116 | 116 | |
117 | - $template = str_replace( '%%CLASS%%', $class, $template ); |
|
118 | - $template = str_replace( '%%TITLE%%', $title, $template ); |
|
119 | - $template = str_replace( '%%META%%', $meta, $template ); |
|
117 | + $template = str_replace ( '%%CLASS%%', $class, $template ); |
|
118 | + $template = str_replace ( '%%TITLE%%', $title, $template ); |
|
119 | + $template = str_replace ( '%%META%%', $meta, $template ); |
|
120 | 120 | |
121 | 121 | $html .= $template; |
122 | 122 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $i = 0; |
128 | 128 | foreach ( $query as $series ) { |
129 | 129 | |
130 | - if ( ! is_object( $series ) ) continue; |
|
130 | + if ( ! is_object ( $series ) ) continue; |
|
131 | 131 | |
132 | 132 | $template = $tpl; |
133 | 133 | $i++; |
@@ -135,15 +135,15 @@ discard block |
||
135 | 135 | $class = 'podcast'; |
136 | 136 | |
137 | 137 | $title = $series->title; |
138 | - if ( true == $args['link_title'] ) { |
|
139 | - $title = '<a href="' . esc_url( $series->url ) . '" title="' . esc_attr( $title ) . '">' . $title . '</a>'; |
|
138 | + if ( true == $args[ 'link_title' ] ) { |
|
139 | + $title = '<a href="'.esc_url ( $series->url ).'" title="'.esc_attr ( $title ).'">'.$title.'</a>'; |
|
140 | 140 | } |
141 | 141 | |
142 | - $template = str_replace( '%%CLASS%%', $class, $template ); |
|
143 | - $template = str_replace( '%%TITLE%%', $title, $template ); |
|
142 | + $template = str_replace ( '%%CLASS%%', $class, $template ); |
|
143 | + $template = str_replace ( '%%TITLE%%', $title, $template ); |
|
144 | 144 | |
145 | - $meta = $series->count . __( ' episodes' , 'seriously-simple-podcasting' ); |
|
146 | - $template = str_replace( '%%META%%' , $meta , $template ); |
|
145 | + $meta = $series->count.__ ( ' episodes', 'seriously-simple-podcasting' ); |
|
146 | + $template = str_replace ( '%%META%%', $meta, $template ); |
|
147 | 147 | |
148 | 148 | $html .= $template; |
149 | 149 | |
@@ -151,40 +151,40 @@ discard block |
||
151 | 151 | |
152 | 152 | } |
153 | 153 | |
154 | - $html .= '<div class="fix"></div>' . "\n"; |
|
154 | + $html .= '<div class="fix"></div>'."\n"; |
|
155 | 155 | |
156 | - $html .= '</div><!--/.ss_podcast-->' . "\n"; |
|
157 | - $html .= $args['after'] . "\n"; |
|
156 | + $html .= '</div><!--/.ss_podcast-->'."\n"; |
|
157 | + $html .= $args[ 'after' ]."\n"; |
|
158 | 158 | |
159 | - wp_reset_postdata(); |
|
159 | + wp_reset_postdata (); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | // Allow themes/plugins to filter here |
163 | - $html = apply_filters( 'ssp_podcast_html', $html, $query, $args ); |
|
163 | + $html = apply_filters ( 'ssp_podcast_html', $html, $query, $args ); |
|
164 | 164 | |
165 | - if ( ! $args['echo'] ) { |
|
165 | + if ( ! $args[ 'echo' ] ) { |
|
166 | 166 | return $html; |
167 | 167 | } |
168 | 168 | |
169 | 169 | // Should only run if "echo" is set to true |
170 | 170 | echo $html; |
171 | 171 | |
172 | - do_action( 'ssp_podcast_after', $args ); |
|
172 | + do_action ( 'ssp_podcast_after', $args ); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | -if ( ! function_exists( 'ssp_episode_ids' ) ) { |
|
176 | +if ( ! function_exists ( 'ssp_episode_ids' ) ) { |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Get post IDs of all podcast episodes for all post types |
180 | 180 | * @since 1.8.2 |
181 | 181 | * @return array |
182 | 182 | */ |
183 | - function ssp_episode_ids () { |
|
183 | + function ssp_episode_ids() { |
|
184 | 184 | global $ss_podcasting; |
185 | 185 | |
186 | 186 | // Remove action to prevent infinite loop |
187 | - remove_action( 'pre_get_posts', array( $ss_podcasting, 'add_all_post_types' ) ); |
|
187 | + remove_action ( 'pre_get_posts', array( $ss_podcasting, 'add_all_post_types' ) ); |
|
188 | 188 | |
189 | 189 | // Setup the default args |
190 | 190 | $args = array( |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | ); |
196 | 196 | |
197 | 197 | // Do we have any additional post types to add? |
198 | - $podcast_post_types = ssp_post_types( false ); |
|
198 | + $podcast_post_types = ssp_post_types ( false ); |
|
199 | 199 | |
200 | 200 | if ( ! empty( $podcast_post_types ) ) { |
201 | - $args['post_type'] = ssp_post_types(); |
|
202 | - $args['meta_query'] = array( |
|
201 | + $args[ 'post_type' ] = ssp_post_types (); |
|
202 | + $args[ 'meta_query' ] = array( |
|
203 | 203 | array( |
204 | 204 | 'key' => 'audio_file', |
205 | 205 | 'compare' => '!=', |
@@ -211,23 +211,23 @@ discard block |
||
211 | 211 | // Do we have this stored in the cache? |
212 | 212 | $key = 'episode_ids'; |
213 | 213 | $group = 'ssp'; |
214 | - $podcast_episodes = wp_cache_get( $key, $group ); |
|
214 | + $podcast_episodes = wp_cache_get ( $key, $group ); |
|
215 | 215 | |
216 | 216 | // If nothing in cache then fetch episodes again and store in cache |
217 | 217 | if ( $podcast_episodes === false ) { |
218 | - $podcast_episodes = get_posts( $args ); |
|
219 | - wp_cache_set( $key, $podcast_episodes, $group, HOUR_IN_SECONDS * 12 ); |
|
218 | + $podcast_episodes = get_posts ( $args ); |
|
219 | + wp_cache_set ( $key, $podcast_episodes, $group, HOUR_IN_SECONDS * 12 ); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | // Reinstate action for future queries |
223 | - add_action( 'pre_get_posts', array( $ss_podcasting, 'add_all_post_types' ) ); |
|
223 | + add_action ( 'pre_get_posts', array( $ss_podcasting, 'add_all_post_types' ) ); |
|
224 | 224 | |
225 | 225 | return $podcast_episodes; |
226 | 226 | } |
227 | 227 | |
228 | 228 | } |
229 | 229 | |
230 | -if ( ! function_exists( 'ssp_episodes' ) ) { |
|
230 | +if ( ! function_exists ( 'ssp_episodes' ) ) { |
|
231 | 231 | |
232 | 232 | /** |
233 | 233 | * Fetch all podcast episodes |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | * @since 1.8.2 |
239 | 239 | * @return array Array of posts or array of query args |
240 | 240 | */ |
241 | - function ssp_episodes ( $n = 10, $series = '', $return_args = false, $context = '' ) { |
|
241 | + function ssp_episodes( $n = 10, $series = '', $return_args = false, $context = '' ) { |
|
242 | 242 | |
243 | 243 | // Get all podcast episodes IDs |
244 | - $episode_ids = (array) ssp_episode_ids(); |
|
244 | + $episode_ids = (array) ssp_episode_ids (); |
|
245 | 245 | |
246 | 246 | if ( $context === 'glance' ) { |
247 | 247 | return $episode_ids; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | // Get all valid podcast post types |
255 | - $podcast_post_types = ssp_post_types( true ); |
|
255 | + $podcast_post_types = ssp_post_types ( true ); |
|
256 | 256 | |
257 | 257 | if ( empty ( $podcast_post_types ) ) { |
258 | 258 | return array(); |
@@ -268,24 +268,24 @@ discard block |
||
268 | 268 | ); |
269 | 269 | |
270 | 270 | if ( $series ) { |
271 | - $args['series'] = esc_attr( $series ); |
|
271 | + $args[ 'series' ] = esc_attr ( $series ); |
|
272 | 272 | } |
273 | 273 | |
274 | - $args = apply_filters( 'ssp_episode_query_args', $args, $context ); |
|
274 | + $args = apply_filters ( 'ssp_episode_query_args', $args, $context ); |
|
275 | 275 | |
276 | 276 | if ( $return_args ) { |
277 | 277 | return $args; |
278 | 278 | } |
279 | 279 | |
280 | 280 | // Do we have anything in the cache here? |
281 | - $key = 'episodes_' . $series; |
|
281 | + $key = 'episodes_'.$series; |
|
282 | 282 | $group = 'ssp'; |
283 | - $posts = wp_cache_get( $key, $group ); |
|
283 | + $posts = wp_cache_get ( $key, $group ); |
|
284 | 284 | |
285 | 285 | // If nothing in cache then fetch episodes again and store in cache |
286 | 286 | if ( $posts === false ) { |
287 | - $posts = get_posts( $args ); |
|
288 | - wp_cache_add( $key, $posts, $group, HOUR_IN_SECONDS * 12 ); |
|
287 | + $posts = get_posts ( $args ); |
|
288 | + wp_cache_add ( $key, $posts, $group, HOUR_IN_SECONDS * 12 ); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | return $posts; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | |
294 | 294 | } |
295 | 295 | |
296 | -if ( ! function_exists( 'ssp_post_types' ) ) { |
|
296 | +if ( ! function_exists ( 'ssp_post_types' ) ) { |
|
297 | 297 | |
298 | 298 | /** |
299 | 299 | * Fetch all valid podcast post types |
@@ -301,14 +301,14 @@ discard block |
||
301 | 301 | * @since 1.8.7 |
302 | 302 | * @return array Array of podcast post types |
303 | 303 | */ |
304 | - function ssp_post_types ( $include_podcast = true ) { |
|
304 | + function ssp_post_types( $include_podcast = true ) { |
|
305 | 305 | |
306 | 306 | // Get saved podcast post type option |
307 | - $podcast_post_types = get_option( 'ss_podcasting_use_post_types', array() ); |
|
307 | + $podcast_post_types = get_option ( 'ss_podcasting_use_post_types', array() ); |
|
308 | 308 | |
309 | 309 | // Add `podcast` post type to array if required |
310 | 310 | if ( $include_podcast ) { |
311 | - $podcast_post_types[] = 'podcast'; |
|
311 | + $podcast_post_types[ ] = 'podcast'; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | $valid_podcast_post_types = array(); |
@@ -317,36 +317,36 @@ discard block |
||
317 | 317 | if ( ! empty( $podcast_post_types ) ) { |
318 | 318 | |
319 | 319 | foreach ( $podcast_post_types as $type ) { |
320 | - if ( post_type_exists( $type ) ) { |
|
321 | - $valid_podcast_post_types[] = $type; |
|
320 | + if ( post_type_exists ( $type ) ) { |
|
321 | + $valid_podcast_post_types[ ] = $type; |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
325 | 325 | } |
326 | 326 | |
327 | 327 | // Return only the valid podcast post types |
328 | - return apply_filters( 'ssp_podcast_post_types', $valid_podcast_post_types, $include_podcast ); |
|
328 | + return apply_filters ( 'ssp_podcast_post_types', $valid_podcast_post_types, $include_podcast ); |
|
329 | 329 | } |
330 | 330 | } |
331 | 331 | |
332 | -if( ! function_exists( 'ssp_get_feed_category_output' ) ) { |
|
332 | +if ( ! function_exists ( 'ssp_get_feed_category_output' ) ) { |
|
333 | 333 | |
334 | 334 | /** |
335 | 335 | * Get the XML markup for the feed category at the specified level |
336 | 336 | * @param int $level Category level |
337 | 337 | * @return string XML output for feed vategory |
338 | 338 | */ |
339 | - function ssp_get_feed_category_output ( $level = 1, $series_id ) { |
|
339 | + function ssp_get_feed_category_output( $level = 1, $series_id ) { |
|
340 | 340 | |
341 | 341 | $level = (int) $level; |
342 | 342 | |
343 | - if( 1 == $level ) { |
|
343 | + if ( 1 == $level ) { |
|
344 | 344 | $level = ''; |
345 | 345 | } |
346 | 346 | |
347 | - $category = get_option( 'ss_podcasting_data_category' . $level, '' ); |
|
347 | + $category = get_option ( 'ss_podcasting_data_category'.$level, '' ); |
|
348 | 348 | if ( $series_id ) { |
349 | - $series_category = get_option( 'ss_podcasting_data_category' . $level . '_' . $series_id, 'no-category' ); |
|
349 | + $series_category = get_option ( 'ss_podcasting_data_category'.$level.'_'.$series_id, 'no-category' ); |
|
350 | 350 | if ( 'no-category' != $series_category ) { |
351 | 351 | $category = $series_category; |
352 | 352 | } |
@@ -355,21 +355,21 @@ discard block |
||
355 | 355 | $category = ''; |
356 | 356 | $subcategory = ''; |
357 | 357 | } else { |
358 | - $subcategory = get_option( 'ss_podcasting_data_subcategory' . $level, '' ); |
|
358 | + $subcategory = get_option ( 'ss_podcasting_data_subcategory'.$level, '' ); |
|
359 | 359 | if ( $series_id ) { |
360 | - $series_subcategory = get_option( 'ss_podcasting_data_subcategory' . $level . '_' . $series_id, 'no-subcategory' ); |
|
360 | + $series_subcategory = get_option ( 'ss_podcasting_data_subcategory'.$level.'_'.$series_id, 'no-subcategory' ); |
|
361 | 361 | if ( 'no-subcategory' != $series_subcategory ) { |
362 | 362 | $subcategory = $series_subcategory; |
363 | 363 | } |
364 | 364 | } |
365 | 365 | } |
366 | 366 | |
367 | - return apply_filters( 'ssp_feed_category_output', array( 'category' => $category, 'subcategory' => $subcategory ), $level, $series_id ); |
|
367 | + return apply_filters ( 'ssp_feed_category_output', array( 'category' => $category, 'subcategory' => $subcategory ), $level, $series_id ); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | } |
371 | 371 | |
372 | -if ( ! function_exists( 'ssp_readfile_chunked' ) ) { |
|
372 | +if ( ! function_exists ( 'ssp_readfile_chunked' ) ) { |
|
373 | 373 | |
374 | 374 | /** |
375 | 375 | * Reads file in chunks so big downloads are possible without changing PHP.INI - http://codeigniter.com/wiki/Download_helper_for_large_files/ |
@@ -384,23 +384,23 @@ discard block |
||
384 | 384 | $chunksize = 1 * ( 1024 * 1024 ); |
385 | 385 | $cnt = 0; |
386 | 386 | |
387 | - $handle = fopen( $file, 'r' ); |
|
387 | + $handle = fopen ( $file, 'r' ); |
|
388 | 388 | if ( $handle === false ) { |
389 | 389 | return false; |
390 | 390 | } |
391 | 391 | |
392 | - while ( ! feof( $handle ) ) { |
|
393 | - $buffer = fread( $handle, $chunksize ); |
|
392 | + while ( ! feof ( $handle ) ) { |
|
393 | + $buffer = fread ( $handle, $chunksize ); |
|
394 | 394 | echo $buffer; |
395 | - ob_flush(); |
|
396 | - flush(); |
|
395 | + ob_flush (); |
|
396 | + flush (); |
|
397 | 397 | |
398 | 398 | if ( $retbytes ) { |
399 | - $cnt += strlen( $buffer ); |
|
399 | + $cnt += strlen ( $buffer ); |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
403 | - $status = fclose( $handle ); |
|
403 | + $status = fclose ( $handle ); |
|
404 | 404 | |
405 | 405 | if ( $retbytes && $status ) { |
406 | 406 | return $cnt; |