@@ -83,19 +83,19 @@ discard block |
||
83 | 83 | |
84 | 84 | // Series list table |
85 | 85 | add_filter( 'manage_edit-series_columns' , array( $this, 'edit_series_columns' ) ); |
86 | - add_filter( 'manage_series_custom_column' , array( $this, 'add_series_columns' ), 1, 3 ); |
|
86 | + add_filter( 'manage_series_custom_column' , array( $this, 'add_series_columns' ), 1, 3 ); |
|
87 | 87 | |
88 | - // Dashboard widgets |
|
89 | - add_filter( 'dashboard_glance_items', array( $this, 'glance_items' ), 10, 1 ); |
|
88 | + // Dashboard widgets |
|
89 | + add_filter( 'dashboard_glance_items', array( $this, 'glance_items' ), 10, 1 ); |
|
90 | 90 | |
91 | - // Appreciation links |
|
92 | - add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 ); |
|
91 | + // Appreciation links |
|
92 | + add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 ); |
|
93 | 93 | |
94 | - // Add footer text to dashboard |
|
95 | - add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 ); |
|
94 | + // Add footer text to dashboard |
|
95 | + add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 ); |
|
96 | 96 | |
97 | - // Clear the cache on post save. |
|
98 | - add_action( 'save_post', array( $this, 'invalidate_cache' ), 10, 2 ); |
|
97 | + // Clear the cache on post save. |
|
98 | + add_action( 'save_post', array( $this, 'invalidate_cache' ), 10, 2 ); |
|
99 | 99 | |
100 | 100 | } |
101 | 101 | |
@@ -194,47 +194,47 @@ discard block |
||
194 | 194 | |
195 | 195 | $podcast_post_types = ssp_post_types( true ); |
196 | 196 | |
197 | - $series_labels = array( |
|
198 | - 'name' => __( 'Podcast Series' , 'seriously-simple-podcasting' ), |
|
199 | - 'singular_name' => __( 'Series', 'seriously-simple-podcasting' ), |
|
200 | - 'search_items' => __( 'Search Series' , 'seriously-simple-podcasting' ), |
|
201 | - 'all_items' => __( 'All Series' , 'seriously-simple-podcasting' ), |
|
202 | - 'parent_item' => __( 'Parent Series' , 'seriously-simple-podcasting' ), |
|
203 | - 'parent_item_colon' => __( 'Parent Series:' , 'seriously-simple-podcasting' ), |
|
204 | - 'edit_item' => __( 'Edit Series' , 'seriously-simple-podcasting' ), |
|
205 | - 'update_item' => __( 'Update Series' , 'seriously-simple-podcasting' ), |
|
206 | - 'add_new_item' => __( 'Add New Series' , 'seriously-simple-podcasting' ), |
|
207 | - 'new_item_name' => __( 'New Series Name' , 'seriously-simple-podcasting' ), |
|
208 | - 'menu_name' => __( 'Series' , 'seriously-simple-podcasting' ), |
|
209 | - 'view_item' => __( 'View Series' , 'seriously-simple-podcasting' ), |
|
210 | - 'popular_items' => __( 'Popular Series' , 'seriously-simple-podcasting' ), |
|
211 | - 'separate_items_with_commas' => __( 'Separate series with commas' , 'seriously-simple-podcasting' ), |
|
212 | - 'add_or_remove_items' => __( 'Add or remove Series' , 'seriously-simple-podcasting' ), |
|
213 | - 'choose_from_most_used' => __( 'Choose from the most used Series' , 'seriously-simple-podcasting' ), |
|
214 | - 'not_found' => __( 'No Series Found' , 'seriously-simple-podcasting' ), |
|
215 | - 'items_list_navigation' => __( 'Series list navigation' , 'seriously-simple-podcasting' ), |
|
216 | - 'items_list' => __( 'Series list' , 'seriously-simple-podcasting' ), |
|
217 | - ); |
|
218 | - |
|
219 | - $series_args = array( |
|
220 | - 'public' => true, |
|
221 | - 'hierarchical' => true, |
|
222 | - 'rewrite' => array( 'slug' => apply_filters( 'ssp_series_slug', 'series' ) ), |
|
223 | - 'labels' => $series_labels, |
|
224 | - 'show_in_rest' => true, |
|
225 | - ); |
|
226 | - |
|
227 | - $series_args = apply_filters( 'ssp_register_taxonomy_args', $series_args, 'series' ); |
|
228 | - |
|
229 | - register_taxonomy( 'series', $podcast_post_types, $series_args ); |
|
230 | - |
|
231 | - // Add Tags to podcast post type |
|
232 | - if ( apply_filters( 'ssp_use_post_tags', true ) ) { |
|
233 | - register_taxonomy_for_object_type( 'post_tag', $this->token ); |
|
234 | - } |
|
235 | - } |
|
236 | - |
|
237 | - /** |
|
197 | + $series_labels = array( |
|
198 | + 'name' => __( 'Podcast Series' , 'seriously-simple-podcasting' ), |
|
199 | + 'singular_name' => __( 'Series', 'seriously-simple-podcasting' ), |
|
200 | + 'search_items' => __( 'Search Series' , 'seriously-simple-podcasting' ), |
|
201 | + 'all_items' => __( 'All Series' , 'seriously-simple-podcasting' ), |
|
202 | + 'parent_item' => __( 'Parent Series' , 'seriously-simple-podcasting' ), |
|
203 | + 'parent_item_colon' => __( 'Parent Series:' , 'seriously-simple-podcasting' ), |
|
204 | + 'edit_item' => __( 'Edit Series' , 'seriously-simple-podcasting' ), |
|
205 | + 'update_item' => __( 'Update Series' , 'seriously-simple-podcasting' ), |
|
206 | + 'add_new_item' => __( 'Add New Series' , 'seriously-simple-podcasting' ), |
|
207 | + 'new_item_name' => __( 'New Series Name' , 'seriously-simple-podcasting' ), |
|
208 | + 'menu_name' => __( 'Series' , 'seriously-simple-podcasting' ), |
|
209 | + 'view_item' => __( 'View Series' , 'seriously-simple-podcasting' ), |
|
210 | + 'popular_items' => __( 'Popular Series' , 'seriously-simple-podcasting' ), |
|
211 | + 'separate_items_with_commas' => __( 'Separate series with commas' , 'seriously-simple-podcasting' ), |
|
212 | + 'add_or_remove_items' => __( 'Add or remove Series' , 'seriously-simple-podcasting' ), |
|
213 | + 'choose_from_most_used' => __( 'Choose from the most used Series' , 'seriously-simple-podcasting' ), |
|
214 | + 'not_found' => __( 'No Series Found' , 'seriously-simple-podcasting' ), |
|
215 | + 'items_list_navigation' => __( 'Series list navigation' , 'seriously-simple-podcasting' ), |
|
216 | + 'items_list' => __( 'Series list' , 'seriously-simple-podcasting' ), |
|
217 | + ); |
|
218 | + |
|
219 | + $series_args = array( |
|
220 | + 'public' => true, |
|
221 | + 'hierarchical' => true, |
|
222 | + 'rewrite' => array( 'slug' => apply_filters( 'ssp_series_slug', 'series' ) ), |
|
223 | + 'labels' => $series_labels, |
|
224 | + 'show_in_rest' => true, |
|
225 | + ); |
|
226 | + |
|
227 | + $series_args = apply_filters( 'ssp_register_taxonomy_args', $series_args, 'series' ); |
|
228 | + |
|
229 | + register_taxonomy( 'series', $podcast_post_types, $series_args ); |
|
230 | + |
|
231 | + // Add Tags to podcast post type |
|
232 | + if ( apply_filters( 'ssp_use_post_tags', true ) ) { |
|
233 | + register_taxonomy_for_object_type( 'post_tag', $this->token ); |
|
234 | + } |
|
235 | + } |
|
236 | + |
|
237 | + /** |
|
238 | 238 | * Register columns for podcast list table |
239 | 239 | * @param array $defaults Default columns |
240 | 240 | * @return array Modified columns |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | return $columns; |
252 | 252 | } |
253 | 253 | |
254 | - /** |
|
255 | - * Display column data in podcast list table |
|
256 | - * @param string $column_name Name of current column |
|
257 | - * @param integer $id ID of episode |
|
258 | - * @return void |
|
259 | - */ |
|
254 | + /** |
|
255 | + * Display column data in podcast list table |
|
256 | + * @param string $column_name Name of current column |
|
257 | + * @param integer $id ID of episode |
|
258 | + * @return void |
|
259 | + */ |
|
260 | 260 | public function register_custom_columns( $column_name, $id ) { |
261 | 261 | global $ss_podcasting; |
262 | 262 | |
@@ -286,34 +286,34 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function edit_series_columns( $columns ) { |
288 | 288 | |
289 | - unset( $columns['description'] ); |
|
290 | - unset( $columns['posts'] ); |
|
289 | + unset( $columns['description'] ); |
|
290 | + unset( $columns['posts'] ); |
|
291 | 291 | |
292 | - $columns['series_feed_url'] = __( 'Series feed URL' , 'seriously-simple-podcasting' ); |
|
293 | - $columns['posts'] = __( 'Episodes' , 'seriously-simple-podcasting' ); |
|
292 | + $columns['series_feed_url'] = __( 'Series feed URL' , 'seriously-simple-podcasting' ); |
|
293 | + $columns['posts'] = __( 'Episodes' , 'seriously-simple-podcasting' ); |
|
294 | 294 | |
295 | - $columns = apply_filters( 'ssp_admin_columns_series', $columns ); |
|
295 | + $columns = apply_filters( 'ssp_admin_columns_series', $columns ); |
|
296 | 296 | |
297 | - return $columns; |
|
298 | - } |
|
297 | + return $columns; |
|
298 | + } |
|
299 | 299 | |
300 | - /** |
|
301 | - * Display column data in series list table |
|
302 | - * |
|
303 | - * @param string $column_data Default column content |
|
304 | - * @param string $column_name Name of current column |
|
305 | - * @param integer $term_id ID of term |
|
306 | - * |
|
307 | - * @return string |
|
308 | - */ |
|
309 | - public function add_series_columns( $column_data , $column_name , $term_id ) { |
|
300 | + /** |
|
301 | + * Display column data in series list table |
|
302 | + * |
|
303 | + * @param string $column_data Default column content |
|
304 | + * @param string $column_name Name of current column |
|
305 | + * @param integer $term_id ID of term |
|
306 | + * |
|
307 | + * @return string |
|
308 | + */ |
|
309 | + public function add_series_columns( $column_data , $column_name , $term_id ) { |
|
310 | 310 | |
311 | - switch ( $column_name ) { |
|
312 | - case 'series_feed_url': |
|
313 | - $series = get_term( $term_id, 'series' ); |
|
314 | - $series_slug = $series->slug; |
|
311 | + switch ( $column_name ) { |
|
312 | + case 'series_feed_url': |
|
313 | + $series = get_term( $term_id, 'series' ); |
|
314 | + $series_slug = $series->slug; |
|
315 | 315 | |
316 | - if ( get_option( 'permalink_structure' ) ) { |
|
316 | + if ( get_option( 'permalink_structure' ) ) { |
|
317 | 317 | $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
318 | 318 | $feed_url = $this->home_url . 'feed/' . $feed_slug . '/' . $series_slug; |
319 | 319 | } else { |
@@ -326,33 +326,33 @@ discard block |
||
326 | 326 | ); |
327 | 327 | } |
328 | 328 | |
329 | - $column_data = '<a href="' . esc_attr( $feed_url ) . '" target="_blank">' . esc_html( $feed_url ) . '</a>'; |
|
330 | - break; |
|
331 | - } |
|
329 | + $column_data = '<a href="' . esc_attr( $feed_url ) . '" target="_blank">' . esc_html( $feed_url ) . '</a>'; |
|
330 | + break; |
|
331 | + } |
|
332 | 332 | |
333 | - return $column_data; |
|
334 | - } |
|
333 | + return $column_data; |
|
334 | + } |
|
335 | 335 | |
336 | - /** |
|
337 | - * Create custom dashboard message |
|
338 | - * @param array $messages Default messages |
|
339 | - * @return array Modified messages |
|
340 | - */ |
|
336 | + /** |
|
337 | + * Create custom dashboard message |
|
338 | + * @param array $messages Default messages |
|
339 | + * @return array Modified messages |
|
340 | + */ |
|
341 | 341 | public function updated_messages( $messages ) { |
342 | 342 | global $post, $post_ID; |
343 | 343 | |
344 | 344 | $messages[ $this->token ] = array( |
345 | - 0 => '', |
|
346 | - 1 => sprintf( __( 'Episode updated. %sView episode%s.' , 'seriously-simple-podcasting' ), '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), |
|
347 | - 2 => __( 'Custom field updated.' , 'seriously-simple-podcasting' ), |
|
348 | - 3 => __( 'Custom field deleted.' , 'seriously-simple-podcasting' ), |
|
349 | - 4 => __( 'Episode updated.' , 'seriously-simple-podcasting' ), |
|
350 | - 5 => isset($_GET['revision']) ? sprintf( __( 'Episode restored to revision from %s.' , 'seriously-simple-podcasting' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
351 | - 6 => sprintf( __( 'Episode published. %sView episode%s.' , 'seriously-simple-podcasting' ), '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), |
|
352 | - 7 => __( 'Episode saved.' , 'seriously-simple-podcasting' ), |
|
353 | - 8 => sprintf( __( 'Episode submitted. %sPreview episode%s.' , 'seriously-simple-podcasting' ), '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) . '">', '</a>' ), |
|
354 | - 9 => sprintf( __( 'Episode scheduled for: %1$s. %2$sPreview episode%3$s.' , 'seriously-simple-podcasting' ), '<strong>' . date_i18n( __( 'M j, Y @ G:i' , 'seriously-simple-podcasting' ), strtotime( $post->post_date ) ) . '</strong>', '<a target="_blank" href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), |
|
355 | - 10 => sprintf( __( 'Episode draft updated. %sPreview episode%s.' , 'seriously-simple-podcasting' ), '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) . '">', '</a>' ), |
|
345 | + 0 => '', |
|
346 | + 1 => sprintf( __( 'Episode updated. %sView episode%s.' , 'seriously-simple-podcasting' ), '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), |
|
347 | + 2 => __( 'Custom field updated.' , 'seriously-simple-podcasting' ), |
|
348 | + 3 => __( 'Custom field deleted.' , 'seriously-simple-podcasting' ), |
|
349 | + 4 => __( 'Episode updated.' , 'seriously-simple-podcasting' ), |
|
350 | + 5 => isset($_GET['revision']) ? sprintf( __( 'Episode restored to revision from %s.' , 'seriously-simple-podcasting' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
351 | + 6 => sprintf( __( 'Episode published. %sView episode%s.' , 'seriously-simple-podcasting' ), '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), |
|
352 | + 7 => __( 'Episode saved.' , 'seriously-simple-podcasting' ), |
|
353 | + 8 => sprintf( __( 'Episode submitted. %sPreview episode%s.' , 'seriously-simple-podcasting' ), '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) . '">', '</a>' ), |
|
354 | + 9 => sprintf( __( 'Episode scheduled for: %1$s. %2$sPreview episode%3$s.' , 'seriously-simple-podcasting' ), '<strong>' . date_i18n( __( 'M j, Y @ G:i' , 'seriously-simple-podcasting' ), strtotime( $post->post_date ) ) . '</strong>', '<a target="_blank" href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), |
|
355 | + 10 => sprintf( __( 'Episode draft updated. %sPreview episode%s.' , 'seriously-simple-podcasting' ), '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) . '">', '</a>' ), |
|
356 | 356 | ); |
357 | 357 | |
358 | 358 | return $messages; |
@@ -611,60 +611,60 @@ discard block |
||
611 | 611 | |
612 | 612 | $fields['episode_type'] = array( |
613 | 613 | 'name' => __( 'Episode type:' , 'seriously-simple-podcasting' ), |
614 | - 'description' => '', |
|
615 | - 'type' => 'radio', |
|
616 | - 'default' => 'audio', |
|
617 | - 'options' => array( 'audio' => __( 'Audio', 'seriously-simple-podcasting' ), 'video' => __( 'Video', 'seriously-simple-podcasting' ) ), |
|
618 | - 'section' => 'info', |
|
614 | + 'description' => '', |
|
615 | + 'type' => 'radio', |
|
616 | + 'default' => 'audio', |
|
617 | + 'options' => array( 'audio' => __( 'Audio', 'seriously-simple-podcasting' ), 'video' => __( 'Video', 'seriously-simple-podcasting' ) ), |
|
618 | + 'section' => 'info', |
|
619 | 619 | ); |
620 | 620 | |
621 | 621 | // In v1.14+ the `audio_file` field can actually be either audio or video, but we're keeping the field name here for backwards compatibility |
622 | 622 | $fields['audio_file'] = array( |
623 | - 'name' => __( 'Podcast file:' , 'seriously-simple-podcasting' ), |
|
624 | - 'description' => __( 'Upload the primary podcast file or paste the file URL here.' , 'seriously-simple-podcasting' ), |
|
625 | - 'type' => 'file', |
|
626 | - 'default' => '', |
|
627 | - 'section' => 'info', |
|
623 | + 'name' => __( 'Podcast file:' , 'seriously-simple-podcasting' ), |
|
624 | + 'description' => __( 'Upload the primary podcast file or paste the file URL here.' , 'seriously-simple-podcasting' ), |
|
625 | + 'type' => 'file', |
|
626 | + 'default' => '', |
|
627 | + 'section' => 'info', |
|
628 | 628 | ); |
629 | 629 | |
630 | 630 | $fields['duration'] = array( |
631 | - 'name' => __( 'Duration:' , 'seriously-simple-podcasting' ), |
|
632 | - 'description' => __( 'Duration of podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ), |
|
633 | - 'type' => 'text', |
|
634 | - 'default' => '', |
|
635 | - 'section' => 'info', |
|
631 | + 'name' => __( 'Duration:' , 'seriously-simple-podcasting' ), |
|
632 | + 'description' => __( 'Duration of podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ), |
|
633 | + 'type' => 'text', |
|
634 | + 'default' => '', |
|
635 | + 'section' => 'info', |
|
636 | 636 | ); |
637 | 637 | |
638 | 638 | $fields['filesize'] = array( |
639 | - 'name' => __( 'File size:' , 'seriously-simple-podcasting' ), |
|
640 | - 'description' => __( 'Size of the podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ), |
|
641 | - 'type' => 'text', |
|
642 | - 'default' => '', |
|
643 | - 'section' => 'info', |
|
639 | + 'name' => __( 'File size:' , 'seriously-simple-podcasting' ), |
|
640 | + 'description' => __( 'Size of the podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ), |
|
641 | + 'type' => 'text', |
|
642 | + 'default' => '', |
|
643 | + 'section' => 'info', |
|
644 | 644 | ); |
645 | 645 | |
646 | 646 | $fields['date_recorded'] = array( |
647 | - 'name' => __( 'Date recorded:' , 'seriously-simple-podcasting' ), |
|
648 | - 'description' => __( 'The date on which this episode was recorded.' , 'seriously-simple-podcasting' ), |
|
649 | - 'type' => 'datepicker', |
|
650 | - 'default' => '', |
|
651 | - 'section' => 'info', |
|
647 | + 'name' => __( 'Date recorded:' , 'seriously-simple-podcasting' ), |
|
648 | + 'description' => __( 'The date on which this episode was recorded.' , 'seriously-simple-podcasting' ), |
|
649 | + 'type' => 'datepicker', |
|
650 | + 'default' => '', |
|
651 | + 'section' => 'info', |
|
652 | 652 | ); |
653 | 653 | |
654 | 654 | $fields['explicit'] = array( |
655 | - 'name' => __( 'Explicit:' , 'seriously-simple-podcasting' ), |
|
656 | - 'description' => __( 'Mark this episode as explicit.' , 'seriously-simple-podcasting' ), |
|
657 | - 'type' => 'checkbox', |
|
658 | - 'default' => '', |
|
659 | - 'section' => 'info', |
|
655 | + 'name' => __( 'Explicit:' , 'seriously-simple-podcasting' ), |
|
656 | + 'description' => __( 'Mark this episode as explicit.' , 'seriously-simple-podcasting' ), |
|
657 | + 'type' => 'checkbox', |
|
658 | + 'default' => '', |
|
659 | + 'section' => 'info', |
|
660 | 660 | ); |
661 | 661 | |
662 | 662 | $fields['block'] = array( |
663 | - 'name' => __( 'Block:' , 'seriously-simple-podcasting' ), |
|
664 | - 'description' => __( 'Block this episode from appearing in the iTunes & Google Play podcast libraries.' , 'seriously-simple-podcasting' ), |
|
665 | - 'type' => 'checkbox', |
|
666 | - 'default' => '', |
|
667 | - 'section' => 'info', |
|
663 | + 'name' => __( 'Block:' , 'seriously-simple-podcasting' ), |
|
664 | + 'description' => __( 'Block this episode from appearing in the iTunes & Google Play podcast libraries.' , 'seriously-simple-podcasting' ), |
|
665 | + 'type' => 'checkbox', |
|
666 | + 'default' => '', |
|
667 | + 'section' => 'info', |
|
668 | 668 | ); |
669 | 669 | |
670 | 670 | return apply_filters( 'ssp_episode_fields', $fields ); |
@@ -770,20 +770,20 @@ discard block |
||
770 | 770 | * @return void |
771 | 771 | */ |
772 | 772 | public function load_plugin_textdomain() { |
773 | - $domain = 'seriously-simple-podcasting'; |
|
774 | - // The "plugin_locale" filter is also used in load_plugin_textdomain() |
|
775 | - $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); |
|
773 | + $domain = 'seriously-simple-podcasting'; |
|
774 | + // The "plugin_locale" filter is also used in load_plugin_textdomain() |
|
775 | + $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); |
|
776 | 776 | |
777 | - load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' ); |
|
778 | - load_plugin_textdomain( $domain, false, dirname( plugin_basename( $this->file ) ) . '/lang/' ); |
|
777 | + load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' ); |
|
778 | + load_plugin_textdomain( $domain, false, dirname( plugin_basename( $this->file ) ) . '/lang/' ); |
|
779 | 779 | } |
780 | 780 | |
781 | - /** |
|
782 | - * Register podcast feed |
|
783 | - * @return void |
|
784 | - */ |
|
785 | - public function add_feed() { |
|
786 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
781 | + /** |
|
782 | + * Register podcast feed |
|
783 | + * @return void |
|
784 | + */ |
|
785 | + public function add_feed() { |
|
786 | + $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
787 | 787 | add_feed( $feed_slug, array( $this, 'feed_template' ) ); |
788 | 788 | } |
789 | 789 | |
@@ -805,31 +805,31 @@ discard block |
||
805 | 805 | * Load feed template |
806 | 806 | * @return void |
807 | 807 | */ |
808 | - public function feed_template() { |
|
809 | - global $wp_query; |
|
808 | + public function feed_template() { |
|
809 | + global $wp_query; |
|
810 | 810 | |
811 | - // Prevent 404 on feed |
|
812 | - $wp_query->is_404 = false; |
|
813 | - status_header( 200 ); |
|
811 | + // Prevent 404 on feed |
|
812 | + $wp_query->is_404 = false; |
|
813 | + status_header( 200 ); |
|
814 | 814 | |
815 | - $file_name = 'feed-podcast.php'; |
|
815 | + $file_name = 'feed-podcast.php'; |
|
816 | 816 | |
817 | - $user_template_file = apply_filters( 'ssp_feed_template_file', trailingslashit( get_stylesheet_directory() ) . $file_name ); |
|
817 | + $user_template_file = apply_filters( 'ssp_feed_template_file', trailingslashit( get_stylesheet_directory() ) . $file_name ); |
|
818 | 818 | |
819 | 819 | // Any functions hooked in here must NOT output any data or else feed will break |
820 | 820 | do_action( 'ssp_before_feed' ); |
821 | 821 | |
822 | - // Load user feed template if it exists, otherwise use plugin template |
|
823 | - if ( file_exists( $user_template_file ) ) { |
|
824 | - require( $user_template_file ); |
|
825 | - } else { |
|
826 | - require( $this->template_path . $file_name ); |
|
827 | - } |
|
822 | + // Load user feed template if it exists, otherwise use plugin template |
|
823 | + if ( file_exists( $user_template_file ) ) { |
|
824 | + require( $user_template_file ); |
|
825 | + } else { |
|
826 | + require( $this->template_path . $file_name ); |
|
827 | + } |
|
828 | 828 | |
829 | - // Any functions hooked in here must NOT output any data or else feed will break |
|
830 | - do_action( 'ssp_after_feed' ); |
|
829 | + // Any functions hooked in here must NOT output any data or else feed will break |
|
830 | + do_action( 'ssp_after_feed' ); |
|
831 | 831 | |
832 | - exit; |
|
832 | + exit; |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | /** |
@@ -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 | |
@@ -32,84 +32,84 @@ discard block |
||
32 | 32 | |
33 | 33 | $this->version = $version; |
34 | 34 | |
35 | - $this->dir = dirname( $file ); |
|
35 | + $this->dir = dirname ( $file ); |
|
36 | 36 | $this->file = $file; |
37 | - $this->assets_dir = trailingslashit( $this->dir ) . 'assets'; |
|
38 | - $this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $file ) ) ); |
|
39 | - $this->template_path = trailingslashit( $this->dir ) . 'templates/'; |
|
40 | - $this->home_url = trailingslashit( home_url() ); |
|
37 | + $this->assets_dir = trailingslashit ( $this->dir ).'assets'; |
|
38 | + $this->assets_url = esc_url ( trailingslashit ( plugins_url ( '/assets/', $file ) ) ); |
|
39 | + $this->template_path = trailingslashit ( $this->dir ).'templates/'; |
|
40 | + $this->home_url = trailingslashit ( home_url () ); |
|
41 | 41 | $this->token = 'podcast'; |
42 | 42 | |
43 | - $this->script_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
43 | + $this->script_suffix = defined ( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
44 | 44 | |
45 | 45 | // Handle localisation |
46 | - $this->load_plugin_textdomain(); |
|
47 | - add_action( 'init', array( $this, 'load_localisation' ), 0 ); |
|
46 | + $this->load_plugin_textdomain (); |
|
47 | + add_action ( 'init', array( $this, 'load_localisation' ), 0 ); |
|
48 | 48 | |
49 | 49 | // Regsiter podcast post type and taxonomies |
50 | - add_action( 'init', array( $this, 'register_post_type' ), 1 ); |
|
50 | + add_action ( 'init', array( $this, 'register_post_type' ), 1 ); |
|
51 | 51 | |
52 | 52 | // Register podcast feed |
53 | - add_action( 'init', array( $this, 'add_feed' ), 1 ); |
|
53 | + add_action ( 'init', array( $this, 'add_feed' ), 1 ); |
|
54 | 54 | |
55 | 55 | // Hide WP SEO footer text for podcast RSS feed |
56 | - add_filter( 'wpseo_include_rss_footer', array( $this, 'hide_wp_seo_rss_footer' ) ); |
|
56 | + add_filter ( 'wpseo_include_rss_footer', array( $this, 'hide_wp_seo_rss_footer' ) ); |
|
57 | 57 | |
58 | 58 | // Handle v1.x feed URL as well as feed URLs for default permalinks |
59 | - add_action( 'init', array( $this, 'redirect_old_feed' ) ); |
|
59 | + add_action ( 'init', array( $this, 'redirect_old_feed' ) ); |
|
60 | 60 | |
61 | 61 | // Setup custom permalink structures |
62 | - add_action( 'init', array( $this, 'setup_permastruct' ), 10 ); |
|
62 | + add_action ( 'init', array( $this, 'setup_permastruct' ), 10 ); |
|
63 | 63 | |
64 | - if ( is_admin() ) { |
|
64 | + if ( is_admin () ) { |
|
65 | 65 | |
66 | - add_action( 'admin_init', array( $this, 'update_enclosures' ) ); |
|
66 | + add_action ( 'admin_init', array( $this, 'update_enclosures' ) ); |
|
67 | 67 | |
68 | 68 | // Episode meta box |
69 | - add_action( 'admin_init', array( $this, 'register_meta_boxes' ) ); |
|
70 | - add_action( 'save_post', array( $this, 'meta_box_save' ), 10, 1 ); |
|
69 | + add_action ( 'admin_init', array( $this, 'register_meta_boxes' ) ); |
|
70 | + add_action ( 'save_post', array( $this, 'meta_box_save' ), 10, 1 ); |
|
71 | 71 | |
72 | 72 | // Episode edit screen |
73 | - add_filter( 'enter_title_here', array( $this, 'enter_title_here' ) ); |
|
74 | - add_filter( 'post_updated_messages', array( $this, 'updated_messages' ) ); |
|
73 | + add_filter ( 'enter_title_here', array( $this, 'enter_title_here' ) ); |
|
74 | + add_filter ( 'post_updated_messages', array( $this, 'updated_messages' ) ); |
|
75 | 75 | |
76 | 76 | // Admin JS & CSS |
77 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ), 10 ); |
|
78 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 10 ); |
|
77 | + add_action ( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ), 10 ); |
|
78 | + add_action ( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 10 ); |
|
79 | 79 | |
80 | 80 | // Episodes list table |
81 | - add_filter( 'manage_edit-' . $this->token . '_columns', array( $this, 'register_custom_column_headings' ), 10, 1 ); |
|
82 | - add_action( 'manage_posts_custom_column', array( $this, 'register_custom_columns' ), 10, 2 ); |
|
81 | + add_filter ( 'manage_edit-'.$this->token.'_columns', array( $this, 'register_custom_column_headings' ), 10, 1 ); |
|
82 | + add_action ( 'manage_posts_custom_column', array( $this, 'register_custom_columns' ), 10, 2 ); |
|
83 | 83 | |
84 | 84 | // Series list table |
85 | - add_filter( 'manage_edit-series_columns' , array( $this, 'edit_series_columns' ) ); |
|
86 | - add_filter( 'manage_series_custom_column' , array( $this, 'add_series_columns' ), 1, 3 ); |
|
85 | + add_filter ( 'manage_edit-series_columns', array( $this, 'edit_series_columns' ) ); |
|
86 | + add_filter ( 'manage_series_custom_column', array( $this, 'add_series_columns' ), 1, 3 ); |
|
87 | 87 | |
88 | 88 | // Dashboard widgets |
89 | - add_filter( 'dashboard_glance_items', array( $this, 'glance_items' ), 10, 1 ); |
|
89 | + add_filter ( 'dashboard_glance_items', array( $this, 'glance_items' ), 10, 1 ); |
|
90 | 90 | |
91 | 91 | // Appreciation links |
92 | - add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 ); |
|
92 | + add_filter ( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 ); |
|
93 | 93 | |
94 | 94 | // Add footer text to dashboard |
95 | - add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 ); |
|
95 | + add_filter ( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 ); |
|
96 | 96 | |
97 | 97 | // Clear the cache on post save. |
98 | - add_action( 'save_post', array( $this, 'invalidate_cache' ), 10, 2 ); |
|
98 | + add_action ( 'save_post', array( $this, 'invalidate_cache' ), 10, 2 ); |
|
99 | 99 | |
100 | 100 | } |
101 | 101 | |
102 | 102 | // Add ajax action for plugin rating |
103 | - add_action( 'wp_ajax_ssp_rated', array( $this, 'rated' ) ); |
|
103 | + add_action ( 'wp_ajax_ssp_rated', array( $this, 'rated' ) ); |
|
104 | 104 | |
105 | 105 | // Add ajax action for customising episode embed code |
106 | - add_action( 'wp_ajax_update_episode_embed_code', array( $this, 'update_episode_embed_code' ) ); |
|
106 | + add_action ( 'wp_ajax_update_episode_embed_code', array( $this, 'update_episode_embed_code' ) ); |
|
107 | 107 | |
108 | 108 | // Setup activation and deactivation hooks |
109 | - register_activation_hook( $file, array( $this, 'activate' ) ); |
|
110 | - register_deactivation_hook( $file, array( $this, 'deactivate' ) ); |
|
109 | + register_activation_hook ( $file, array( $this, 'activate' ) ); |
|
110 | + register_deactivation_hook ( $file, array( $this, 'deactivate' ) ); |
|
111 | 111 | |
112 | - add_action( 'init', array( $this, 'update' ), 11 ); |
|
112 | + add_action ( 'init', array( $this, 'update' ), 11 ); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -119,17 +119,17 @@ discard block |
||
119 | 119 | public function setup_permastruct() { |
120 | 120 | |
121 | 121 | // Episode download & player URLs |
122 | - add_rewrite_rule( '^podcast-download/([^/]*)/([^/]*)/?', 'index.php?podcast_episode=$matches[1]', 'top' ); |
|
123 | - add_rewrite_rule( '^podcast-player/([^/]*)/([^/]*)/?', 'index.php?podcast_episode=$matches[1]&podcast_ref=player', 'top' ); |
|
122 | + add_rewrite_rule ( '^podcast-download/([^/]*)/([^/]*)/?', 'index.php?podcast_episode=$matches[1]', 'top' ); |
|
123 | + add_rewrite_rule ( '^podcast-player/([^/]*)/([^/]*)/?', 'index.php?podcast_episode=$matches[1]&podcast_ref=player', 'top' ); |
|
124 | 124 | |
125 | 125 | // Custom query variables |
126 | - add_rewrite_tag( '%podcast_episode%', '([^&]+)' ); |
|
127 | - add_rewrite_tag( '%podcast_ref%', '([^&]+)' ); |
|
126 | + add_rewrite_tag ( '%podcast_episode%', '([^&]+)' ); |
|
127 | + add_rewrite_tag ( '%podcast_ref%', '([^&]+)' ); |
|
128 | 128 | |
129 | 129 | // Series feed URLs |
130 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
131 | - add_rewrite_rule( '^feed/' . $feed_slug . '/([^/]*)/?', 'index.php?feed=podcast&podcast_series=$matches[1]', 'top' ); |
|
132 | - add_rewrite_tag( '%podcast_series%', '([^&]+)' ); |
|
130 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
131 | + add_rewrite_rule ( '^feed/'.$feed_slug.'/([^/]*)/?', 'index.php?feed=podcast&podcast_series=$matches[1]', 'top' ); |
|
132 | + add_rewrite_tag ( '%podcast_series%', '([^&]+)' ); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -139,25 +139,25 @@ discard block |
||
139 | 139 | public function register_post_type() { |
140 | 140 | |
141 | 141 | $labels = array( |
142 | - 'name' => _x( 'Podcast', 'post type general name' , 'seriously-simple-podcasting' ), |
|
143 | - 'singular_name' => _x( 'Podcast', 'post type singular name' , 'seriously-simple-podcasting' ), |
|
144 | - 'add_new' => _x( 'Add New', 'podcast' , 'seriously-simple-podcasting' ), |
|
145 | - 'add_new_item' => sprintf( __( 'Add New %s' , 'seriously-simple-podcasting' ), __( 'Episode' , 'seriously-simple-podcasting' ) ), |
|
146 | - 'edit_item' => sprintf( __( 'Edit %s' , 'seriously-simple-podcasting' ), __( 'Episode' , 'seriously-simple-podcasting' ) ), |
|
147 | - 'new_item' => sprintf( __( 'New %s' , 'seriously-simple-podcasting' ), __( 'Episode' , 'seriously-simple-podcasting' ) ), |
|
148 | - 'all_items' => sprintf( __( 'All %s' , 'seriously-simple-podcasting' ), __( 'Episodes' , 'seriously-simple-podcasting' ) ), |
|
149 | - 'view_item' => sprintf( __( 'View %s' , 'seriously-simple-podcasting' ), __( 'Episode' , 'seriously-simple-podcasting' ) ), |
|
150 | - 'search_items' => sprintf( __( 'Search %a' , 'seriously-simple-podcasting' ), __( 'Episodes' , 'seriously-simple-podcasting' ) ), |
|
151 | - 'not_found' => sprintf( __( 'No %s Found' , 'seriously-simple-podcasting' ), __( 'Episodes' , 'seriously-simple-podcasting' ) ), |
|
152 | - 'not_found_in_trash' => sprintf( __( 'No %s Found In Trash' , 'seriously-simple-podcasting' ), __( 'Episodes' , 'seriously-simple-podcasting' ) ), |
|
142 | + 'name' => _x ( 'Podcast', 'post type general name', 'seriously-simple-podcasting' ), |
|
143 | + 'singular_name' => _x ( 'Podcast', 'post type singular name', 'seriously-simple-podcasting' ), |
|
144 | + 'add_new' => _x ( 'Add New', 'podcast', 'seriously-simple-podcasting' ), |
|
145 | + 'add_new_item' => sprintf ( __ ( 'Add New %s', 'seriously-simple-podcasting' ), __ ( 'Episode', 'seriously-simple-podcasting' ) ), |
|
146 | + 'edit_item' => sprintf ( __ ( 'Edit %s', 'seriously-simple-podcasting' ), __ ( 'Episode', 'seriously-simple-podcasting' ) ), |
|
147 | + 'new_item' => sprintf ( __ ( 'New %s', 'seriously-simple-podcasting' ), __ ( 'Episode', 'seriously-simple-podcasting' ) ), |
|
148 | + 'all_items' => sprintf ( __ ( 'All %s', 'seriously-simple-podcasting' ), __ ( 'Episodes', 'seriously-simple-podcasting' ) ), |
|
149 | + 'view_item' => sprintf ( __ ( 'View %s', 'seriously-simple-podcasting' ), __ ( 'Episode', 'seriously-simple-podcasting' ) ), |
|
150 | + 'search_items' => sprintf ( __ ( 'Search %a', 'seriously-simple-podcasting' ), __ ( 'Episodes', 'seriously-simple-podcasting' ) ), |
|
151 | + 'not_found' => sprintf ( __ ( 'No %s Found', 'seriously-simple-podcasting' ), __ ( 'Episodes', 'seriously-simple-podcasting' ) ), |
|
152 | + 'not_found_in_trash' => sprintf ( __ ( 'No %s Found In Trash', 'seriously-simple-podcasting' ), __ ( 'Episodes', 'seriously-simple-podcasting' ) ), |
|
153 | 153 | 'parent_item_colon' => '', |
154 | - 'menu_name' => __( 'Podcast' , 'seriously-simple-podcasting' ), |
|
155 | - 'filter_items_list' => sprintf( __( 'Filter %s list' , 'seriously-simple-podcasting' ), __( 'Episode' , 'seriously-simple-podcasting' ) ), |
|
156 | - 'items_list_navigation' => sprintf( __( '%s list navigation' , 'seriously-simple-podcasting' ), __( 'Episode' , 'seriously-simple-podcasting' ) ), |
|
157 | - 'items_list' => sprintf( __( '%s list' , 'seriously-simple-podcasting' ), __( 'Episode' , 'seriously-simple-podcasting' ) ), |
|
154 | + 'menu_name' => __ ( 'Podcast', 'seriously-simple-podcasting' ), |
|
155 | + 'filter_items_list' => sprintf ( __ ( 'Filter %s list', 'seriously-simple-podcasting' ), __ ( 'Episode', 'seriously-simple-podcasting' ) ), |
|
156 | + 'items_list_navigation' => sprintf ( __ ( '%s list navigation', 'seriously-simple-podcasting' ), __ ( 'Episode', 'seriously-simple-podcasting' ) ), |
|
157 | + 'items_list' => sprintf ( __ ( '%s list', 'seriously-simple-podcasting' ), __ ( 'Episode', 'seriously-simple-podcasting' ) ), |
|
158 | 158 | ); |
159 | 159 | |
160 | - $slug = apply_filters( 'ssp_archive_slug', __( 'podcast' , 'seriously-simple-podcasting' ) ); |
|
160 | + $slug = apply_filters ( 'ssp_archive_slug', __ ( 'podcast', 'seriously-simple-podcasting' ) ); |
|
161 | 161 | |
162 | 162 | $args = array( |
163 | 163 | 'labels' => $labels, |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | 'show_in_rest' => true, |
180 | 180 | ); |
181 | 181 | |
182 | - $args = apply_filters( 'ssp_register_post_type_args', $args ); |
|
182 | + $args = apply_filters ( 'ssp_register_post_type_args', $args ); |
|
183 | 183 | |
184 | - register_post_type( $this->token, $args ); |
|
184 | + register_post_type ( $this->token, $args ); |
|
185 | 185 | |
186 | - $this->register_taxonomies(); |
|
186 | + $this->register_taxonomies (); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -192,45 +192,45 @@ discard block |
||
192 | 192 | */ |
193 | 193 | private function register_taxonomies() { |
194 | 194 | |
195 | - $podcast_post_types = ssp_post_types( true ); |
|
195 | + $podcast_post_types = ssp_post_types ( true ); |
|
196 | 196 | |
197 | 197 | $series_labels = array( |
198 | - 'name' => __( 'Podcast Series' , 'seriously-simple-podcasting' ), |
|
199 | - 'singular_name' => __( 'Series', 'seriously-simple-podcasting' ), |
|
200 | - 'search_items' => __( 'Search Series' , 'seriously-simple-podcasting' ), |
|
201 | - 'all_items' => __( 'All Series' , 'seriously-simple-podcasting' ), |
|
202 | - 'parent_item' => __( 'Parent Series' , 'seriously-simple-podcasting' ), |
|
203 | - 'parent_item_colon' => __( 'Parent Series:' , 'seriously-simple-podcasting' ), |
|
204 | - 'edit_item' => __( 'Edit Series' , 'seriously-simple-podcasting' ), |
|
205 | - 'update_item' => __( 'Update Series' , 'seriously-simple-podcasting' ), |
|
206 | - 'add_new_item' => __( 'Add New Series' , 'seriously-simple-podcasting' ), |
|
207 | - 'new_item_name' => __( 'New Series Name' , 'seriously-simple-podcasting' ), |
|
208 | - 'menu_name' => __( 'Series' , 'seriously-simple-podcasting' ), |
|
209 | - 'view_item' => __( 'View Series' , 'seriously-simple-podcasting' ), |
|
210 | - 'popular_items' => __( 'Popular Series' , 'seriously-simple-podcasting' ), |
|
211 | - 'separate_items_with_commas' => __( 'Separate series with commas' , 'seriously-simple-podcasting' ), |
|
212 | - 'add_or_remove_items' => __( 'Add or remove Series' , 'seriously-simple-podcasting' ), |
|
213 | - 'choose_from_most_used' => __( 'Choose from the most used Series' , 'seriously-simple-podcasting' ), |
|
214 | - 'not_found' => __( 'No Series Found' , 'seriously-simple-podcasting' ), |
|
215 | - 'items_list_navigation' => __( 'Series list navigation' , 'seriously-simple-podcasting' ), |
|
216 | - 'items_list' => __( 'Series list' , 'seriously-simple-podcasting' ), |
|
198 | + 'name' => __ ( 'Podcast Series', 'seriously-simple-podcasting' ), |
|
199 | + 'singular_name' => __ ( 'Series', 'seriously-simple-podcasting' ), |
|
200 | + 'search_items' => __ ( 'Search Series', 'seriously-simple-podcasting' ), |
|
201 | + 'all_items' => __ ( 'All Series', 'seriously-simple-podcasting' ), |
|
202 | + 'parent_item' => __ ( 'Parent Series', 'seriously-simple-podcasting' ), |
|
203 | + 'parent_item_colon' => __ ( 'Parent Series:', 'seriously-simple-podcasting' ), |
|
204 | + 'edit_item' => __ ( 'Edit Series', 'seriously-simple-podcasting' ), |
|
205 | + 'update_item' => __ ( 'Update Series', 'seriously-simple-podcasting' ), |
|
206 | + 'add_new_item' => __ ( 'Add New Series', 'seriously-simple-podcasting' ), |
|
207 | + 'new_item_name' => __ ( 'New Series Name', 'seriously-simple-podcasting' ), |
|
208 | + 'menu_name' => __ ( 'Series', 'seriously-simple-podcasting' ), |
|
209 | + 'view_item' => __ ( 'View Series', 'seriously-simple-podcasting' ), |
|
210 | + 'popular_items' => __ ( 'Popular Series', 'seriously-simple-podcasting' ), |
|
211 | + 'separate_items_with_commas' => __ ( 'Separate series with commas', 'seriously-simple-podcasting' ), |
|
212 | + 'add_or_remove_items' => __ ( 'Add or remove Series', 'seriously-simple-podcasting' ), |
|
213 | + 'choose_from_most_used' => __ ( 'Choose from the most used Series', 'seriously-simple-podcasting' ), |
|
214 | + 'not_found' => __ ( 'No Series Found', 'seriously-simple-podcasting' ), |
|
215 | + 'items_list_navigation' => __ ( 'Series list navigation', 'seriously-simple-podcasting' ), |
|
216 | + 'items_list' => __ ( 'Series list', 'seriously-simple-podcasting' ), |
|
217 | 217 | ); |
218 | 218 | |
219 | 219 | $series_args = array( |
220 | 220 | 'public' => true, |
221 | 221 | 'hierarchical' => true, |
222 | - 'rewrite' => array( 'slug' => apply_filters( 'ssp_series_slug', 'series' ) ), |
|
222 | + 'rewrite' => array( 'slug' => apply_filters ( 'ssp_series_slug', 'series' ) ), |
|
223 | 223 | 'labels' => $series_labels, |
224 | 224 | 'show_in_rest' => true, |
225 | 225 | ); |
226 | 226 | |
227 | - $series_args = apply_filters( 'ssp_register_taxonomy_args', $series_args, 'series' ); |
|
227 | + $series_args = apply_filters ( 'ssp_register_taxonomy_args', $series_args, 'series' ); |
|
228 | 228 | |
229 | - register_taxonomy( 'series', $podcast_post_types, $series_args ); |
|
229 | + register_taxonomy ( 'series', $podcast_post_types, $series_args ); |
|
230 | 230 | |
231 | 231 | // Add Tags to podcast post type |
232 | - if ( apply_filters( 'ssp_use_post_tags', true ) ) { |
|
233 | - register_taxonomy_for_object_type( 'post_tag', $this->token ); |
|
232 | + if ( apply_filters ( 'ssp_use_post_tags', true ) ) { |
|
233 | + register_taxonomy_for_object_type ( 'post_tag', $this->token ); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
@@ -240,13 +240,13 @@ discard block |
||
240 | 240 | * @return array Modified columns |
241 | 241 | */ |
242 | 242 | public function register_custom_column_headings( $defaults ) { |
243 | - $new_columns = apply_filters( 'ssp_admin_columns_episodes', array( 'series' => __( 'Series' , 'seriously-simple-podcasting' ) , 'image' => __( 'Image' , 'seriously-simple-podcasting' ) ) ); |
|
243 | + $new_columns = apply_filters ( 'ssp_admin_columns_episodes', array( 'series' => __ ( 'Series', 'seriously-simple-podcasting' ), 'image' => __ ( 'Image', 'seriously-simple-podcasting' ) ) ); |
|
244 | 244 | |
245 | 245 | // remove date column |
246 | - unset( $defaults['date'] ); |
|
246 | + unset( $defaults[ 'date' ] ); |
|
247 | 247 | |
248 | 248 | // add new columns before last default one |
249 | - $columns = array_slice( $defaults, 0, -1 ) + $new_columns + array_slice( $defaults, -1 ); |
|
249 | + $columns = array_slice ( $defaults, 0, -1 ) + $new_columns + array_slice ( $defaults, -1 ); |
|
250 | 250 | |
251 | 251 | return $columns; |
252 | 252 | } |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | switch ( $column_name ) { |
264 | 264 | |
265 | 265 | case 'series': |
266 | - $terms = wp_get_post_terms( $id , 'series' ); |
|
267 | - $term_names = wp_list_pluck( $terms, 'name' ); |
|
268 | - echo join( ', ', $term_names ); |
|
266 | + $terms = wp_get_post_terms ( $id, 'series' ); |
|
267 | + $term_names = wp_list_pluck ( $terms, 'name' ); |
|
268 | + echo join ( ', ', $term_names ); |
|
269 | 269 | break; |
270 | 270 | |
271 | 271 | case 'image': |
272 | - $value = $ss_podcasting->get_image( $id, 40 ); |
|
272 | + $value = $ss_podcasting->get_image ( $id, 40 ); |
|
273 | 273 | echo $value; |
274 | 274 | break; |
275 | 275 | |
@@ -286,13 +286,13 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function edit_series_columns( $columns ) { |
288 | 288 | |
289 | - unset( $columns['description'] ); |
|
290 | - unset( $columns['posts'] ); |
|
289 | + unset( $columns[ 'description' ] ); |
|
290 | + unset( $columns[ 'posts' ] ); |
|
291 | 291 | |
292 | - $columns['series_feed_url'] = __( 'Series feed URL' , 'seriously-simple-podcasting' ); |
|
293 | - $columns['posts'] = __( 'Episodes' , 'seriously-simple-podcasting' ); |
|
292 | + $columns[ 'series_feed_url' ] = __ ( 'Series feed URL', 'seriously-simple-podcasting' ); |
|
293 | + $columns[ 'posts' ] = __ ( 'Episodes', 'seriously-simple-podcasting' ); |
|
294 | 294 | |
295 | - $columns = apply_filters( 'ssp_admin_columns_series', $columns ); |
|
295 | + $columns = apply_filters ( 'ssp_admin_columns_series', $columns ); |
|
296 | 296 | |
297 | 297 | return $columns; |
298 | 298 | } |
@@ -306,18 +306,18 @@ discard block |
||
306 | 306 | * |
307 | 307 | * @return string |
308 | 308 | */ |
309 | - public function add_series_columns( $column_data , $column_name , $term_id ) { |
|
309 | + public function add_series_columns( $column_data, $column_name, $term_id ) { |
|
310 | 310 | |
311 | 311 | switch ( $column_name ) { |
312 | 312 | case 'series_feed_url': |
313 | - $series = get_term( $term_id, 'series' ); |
|
313 | + $series = get_term ( $term_id, 'series' ); |
|
314 | 314 | $series_slug = $series->slug; |
315 | 315 | |
316 | - if ( get_option( 'permalink_structure' ) ) { |
|
317 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
318 | - $feed_url = $this->home_url . 'feed/' . $feed_slug . '/' . $series_slug; |
|
316 | + if ( get_option ( 'permalink_structure' ) ) { |
|
317 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
318 | + $feed_url = $this->home_url.'feed/'.$feed_slug.'/'.$series_slug; |
|
319 | 319 | } else { |
320 | - $feed_url = add_query_arg( |
|
320 | + $feed_url = add_query_arg ( |
|
321 | 321 | array( |
322 | 322 | 'feed' => $this->token, |
323 | 323 | 'podcast_series' => $series_slug |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | ); |
327 | 327 | } |
328 | 328 | |
329 | - $column_data = '<a href="' . esc_attr( $feed_url ) . '" target="_blank">' . esc_html( $feed_url ) . '</a>'; |
|
329 | + $column_data = '<a href="'.esc_attr ( $feed_url ).'" target="_blank">'.esc_html ( $feed_url ).'</a>'; |
|
330 | 330 | break; |
331 | 331 | } |
332 | 332 | |
@@ -343,16 +343,16 @@ discard block |
||
343 | 343 | |
344 | 344 | $messages[ $this->token ] = array( |
345 | 345 | 0 => '', |
346 | - 1 => sprintf( __( 'Episode updated. %sView episode%s.' , 'seriously-simple-podcasting' ), '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), |
|
347 | - 2 => __( 'Custom field updated.' , 'seriously-simple-podcasting' ), |
|
348 | - 3 => __( 'Custom field deleted.' , 'seriously-simple-podcasting' ), |
|
349 | - 4 => __( 'Episode updated.' , 'seriously-simple-podcasting' ), |
|
350 | - 5 => isset($_GET['revision']) ? sprintf( __( 'Episode restored to revision from %s.' , 'seriously-simple-podcasting' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
351 | - 6 => sprintf( __( 'Episode published. %sView episode%s.' , 'seriously-simple-podcasting' ), '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), |
|
352 | - 7 => __( 'Episode saved.' , 'seriously-simple-podcasting' ), |
|
353 | - 8 => sprintf( __( 'Episode submitted. %sPreview episode%s.' , 'seriously-simple-podcasting' ), '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) . '">', '</a>' ), |
|
354 | - 9 => sprintf( __( 'Episode scheduled for: %1$s. %2$sPreview episode%3$s.' , 'seriously-simple-podcasting' ), '<strong>' . date_i18n( __( 'M j, Y @ G:i' , 'seriously-simple-podcasting' ), strtotime( $post->post_date ) ) . '</strong>', '<a target="_blank" href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), |
|
355 | - 10 => sprintf( __( 'Episode draft updated. %sPreview episode%s.' , 'seriously-simple-podcasting' ), '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) . '">', '</a>' ), |
|
346 | + 1 => sprintf ( __ ( 'Episode updated. %sView episode%s.', 'seriously-simple-podcasting' ), '<a href="'.esc_url ( get_permalink ( $post_ID ) ).'">', '</a>' ), |
|
347 | + 2 => __ ( 'Custom field updated.', 'seriously-simple-podcasting' ), |
|
348 | + 3 => __ ( 'Custom field deleted.', 'seriously-simple-podcasting' ), |
|
349 | + 4 => __ ( 'Episode updated.', 'seriously-simple-podcasting' ), |
|
350 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf ( __ ( 'Episode restored to revision from %s.', 'seriously-simple-podcasting' ), wp_post_revision_title ( (int) $_GET[ 'revision' ], false ) ) : false, |
|
351 | + 6 => sprintf ( __ ( 'Episode published. %sView episode%s.', 'seriously-simple-podcasting' ), '<a href="'.esc_url ( get_permalink ( $post_ID ) ).'">', '</a>' ), |
|
352 | + 7 => __ ( 'Episode saved.', 'seriously-simple-podcasting' ), |
|
353 | + 8 => sprintf ( __ ( 'Episode submitted. %sPreview episode%s.', 'seriously-simple-podcasting' ), '<a target="_blank" href="'.esc_url ( add_query_arg ( 'preview', 'true', get_permalink ( $post_ID ) ) ).'">', '</a>' ), |
|
354 | + 9 => sprintf ( __ ( 'Episode scheduled for: %1$s. %2$sPreview episode%3$s.', 'seriously-simple-podcasting' ), '<strong>'.date_i18n ( __ ( 'M j, Y @ G:i', 'seriously-simple-podcasting' ), strtotime ( $post->post_date ) ).'</strong>', '<a target="_blank" href="'.esc_url ( get_permalink ( $post_ID ) ).'">', '</a>' ), |
|
355 | + 10 => sprintf ( __ ( 'Episode draft updated. %sPreview episode%s.', 'seriously-simple-podcasting' ), '<a target="_blank" href="'.esc_url ( add_query_arg ( 'preview', 'true', get_permalink ( $post_ID ) ) ).'">', '</a>' ), |
|
356 | 356 | ); |
357 | 357 | |
358 | 358 | return $messages; |
@@ -362,14 +362,14 @@ discard block |
||
362 | 362 | * Register podcast episode details meta boxes |
363 | 363 | * @return void |
364 | 364 | */ |
365 | - public function register_meta_boxes () { |
|
365 | + public function register_meta_boxes() { |
|
366 | 366 | |
367 | 367 | // Get all podcast post types |
368 | - $podcast_post_types = ssp_post_types( true ); |
|
368 | + $podcast_post_types = ssp_post_types ( true ); |
|
369 | 369 | |
370 | 370 | // Add meta box to each post type |
371 | 371 | foreach ( (array) $podcast_post_types as $post_type ) { |
372 | - add_action( 'add_meta_boxes_' . $post_type, array( $this, 'meta_box_setup' ), 10, 1 ); |
|
372 | + add_action ( 'add_meta_boxes_'.$post_type, array( $this, 'meta_box_setup' ), 10, 1 ); |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | |
@@ -377,17 +377,17 @@ discard block |
||
377 | 377 | * Create meta box on episode edit screen |
378 | 378 | * @return void |
379 | 379 | */ |
380 | - public function meta_box_setup ( $post ) { |
|
380 | + public function meta_box_setup( $post ) { |
|
381 | 381 | global $pagenow; |
382 | 382 | |
383 | - add_meta_box( 'podcast-episode-data', __( 'Podcast Episode Details' , 'seriously-simple-podcasting' ), array( $this, 'meta_box_content' ), $post->post_type, 'normal', 'high' ); |
|
383 | + add_meta_box ( 'podcast-episode-data', __ ( 'Podcast Episode Details', 'seriously-simple-podcasting' ), array( $this, 'meta_box_content' ), $post->post_type, 'normal', 'high' ); |
|
384 | 384 | |
385 | - if( 'post.php' == $pagenow && 'publish' == $post->post_status && function_exists( 'get_post_embed_html' ) ) { |
|
386 | - add_meta_box( 'episode-embed-code', __( 'Episode Embed Code' , 'seriously-simple-podcasting' ), array( $this, 'embed_code_meta_box_content' ), $post->post_type, 'side', 'low' ); |
|
385 | + if ( 'post.php' == $pagenow && 'publish' == $post->post_status && function_exists ( 'get_post_embed_html' ) ) { |
|
386 | + add_meta_box ( 'episode-embed-code', __ ( 'Episode Embed Code', 'seriously-simple-podcasting' ), array( $this, 'embed_code_meta_box_content' ), $post->post_type, 'side', 'low' ); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | // Allow more metaboxes to be added |
390 | - do_action( 'ssp_meta_boxes', $post ); |
|
390 | + do_action ( 'ssp_meta_boxes', $post ); |
|
391 | 391 | |
392 | 392 | } |
393 | 393 | |
@@ -396,15 +396,15 @@ discard block |
||
396 | 396 | * @param object $post Current post object |
397 | 397 | * @return void |
398 | 398 | */ |
399 | - public function embed_code_meta_box_content ( $post ) { |
|
399 | + public function embed_code_meta_box_content( $post ) { |
|
400 | 400 | |
401 | 401 | // Get post embed code |
402 | - $embed_code = get_post_embed_html( 500, 350, $post ); |
|
402 | + $embed_code = get_post_embed_html ( 500, 350, $post ); |
|
403 | 403 | |
404 | 404 | // Generate markup for meta box |
405 | - $html = '<p><em>' . __( 'Customise the size of your episode embed below, then copy the HTML to your clipboard.', 'seriously-simple-podcasting' ) . '</em></p>'; |
|
406 | - $html .= '<p><label for="episode_embed_code_width">' . __( 'Width:', 'seriously-simple-podcasting' ) . '</label> <input id="episode_embed_code_width" class="episode_embed_code_size_option" type="number" value="500" length="3" min="0" step="1" /> <label for="episode_embed_code_height">' . __( 'Height:', 'seriously-simple-podcasting' ) . '</label> <input id="episode_embed_code_height" class="episode_embed_code_size_option" type="number" value="350" length="3" min="0" step="1" /></p>'; |
|
407 | - $html .= '<p><textarea readonly id="episode_embed_code">' . esc_textarea( $embed_code ) . '</textarea></p>'; |
|
405 | + $html = '<p><em>'.__ ( 'Customise the size of your episode embed below, then copy the HTML to your clipboard.', 'seriously-simple-podcasting' ).'</em></p>'; |
|
406 | + $html .= '<p><label for="episode_embed_code_width">'.__ ( 'Width:', 'seriously-simple-podcasting' ).'</label> <input id="episode_embed_code_width" class="episode_embed_code_size_option" type="number" value="500" length="3" min="0" step="1" /> <label for="episode_embed_code_height">'.__ ( 'Height:', 'seriously-simple-podcasting' ).'</label> <input id="episode_embed_code_height" class="episode_embed_code_size_option" type="number" value="350" length="3" min="0" step="1" /></p>'; |
|
407 | + $html .= '<p><textarea readonly id="episode_embed_code">'.esc_textarea ( $embed_code ).'</textarea></p>'; |
|
408 | 408 | |
409 | 409 | echo $html; |
410 | 410 | } |
@@ -413,20 +413,20 @@ discard block |
||
413 | 413 | * Update the epiaode embed code via ajax |
414 | 414 | * @return void |
415 | 415 | */ |
416 | - public function update_episode_embed_code () { |
|
416 | + public function update_episode_embed_code() { |
|
417 | 417 | |
418 | 418 | // Make sure we have a valid post ID |
419 | - if( empty( $_POST['post_id'] ) ) { |
|
419 | + if ( empty( $_POST[ 'post_id' ] ) ) { |
|
420 | 420 | return; |
421 | 421 | } |
422 | 422 | |
423 | 423 | // Get info for embed code |
424 | - $post_id = (int) $_POST['post_id']; |
|
425 | - $width = (int) $_POST['width']; |
|
426 | - $height = (int) $_POST['height']; |
|
424 | + $post_id = (int) $_POST[ 'post_id' ]; |
|
425 | + $width = (int) $_POST[ 'width' ]; |
|
426 | + $height = (int) $_POST[ 'height' ]; |
|
427 | 427 | |
428 | 428 | // Generate embed code |
429 | - echo get_post_embed_html( $width, $height, $post_id ); |
|
429 | + echo get_post_embed_html ( $width, $height, $post_id ); |
|
430 | 430 | |
431 | 431 | // Exit after ajax request |
432 | 432 | exit; |
@@ -439,78 +439,78 @@ discard block |
||
439 | 439 | public function meta_box_content() { |
440 | 440 | global $post_id; |
441 | 441 | |
442 | - $field_data = $this->custom_fields(); |
|
442 | + $field_data = $this->custom_fields (); |
|
443 | 443 | |
444 | 444 | $html = ''; |
445 | 445 | |
446 | - $html .= '<input type="hidden" name="seriouslysimple_' . $this->token . '_nonce" id="seriouslysimple_' . $this->token . '_nonce" value="' . wp_create_nonce( plugin_basename( $this->dir ) ) . '" />'; |
|
446 | + $html .= '<input type="hidden" name="seriouslysimple_'.$this->token.'_nonce" id="seriouslysimple_'.$this->token.'_nonce" value="'.wp_create_nonce ( plugin_basename ( $this->dir ) ).'" />'; |
|
447 | 447 | |
448 | - if ( 0 < count( $field_data ) ) { |
|
449 | - $html .= '<table class="form-table">' . "\n"; |
|
450 | - $html .= '<tbody>' . "\n"; |
|
448 | + if ( 0 < count ( $field_data ) ) { |
|
449 | + $html .= '<table class="form-table">'."\n"; |
|
450 | + $html .= '<tbody>'."\n"; |
|
451 | 451 | |
452 | - $html .= '<input id="seriouslysimple_post_id" type="hidden" value="'. $post_id . '" />'; |
|
452 | + $html .= '<input id="seriouslysimple_post_id" type="hidden" value="'.$post_id.'" />'; |
|
453 | 453 | |
454 | 454 | foreach ( $field_data as $k => $v ) { |
455 | - $data = $v['default']; |
|
456 | - $saved = get_post_meta( $post_id, $k, true ); |
|
455 | + $data = $v[ 'default' ]; |
|
456 | + $saved = get_post_meta ( $post_id, $k, true ); |
|
457 | 457 | if ( $saved ) { |
458 | 458 | $data = $saved; |
459 | 459 | } |
460 | 460 | |
461 | 461 | $class = ''; |
462 | - if ( isset( $v['class'] ) ) { |
|
463 | - $class = $v['class']; |
|
462 | + if ( isset( $v[ 'class' ] ) ) { |
|
463 | + $class = $v[ 'class' ]; |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | $disabled = false; |
467 | - if ( isset( $v['disabled'] ) && $v['disabled'] ) { |
|
467 | + if ( isset( $v[ 'disabled' ] ) && $v[ 'disabled' ] ) { |
|
468 | 468 | $disabled = true; |
469 | 469 | } |
470 | 470 | |
471 | - switch( $v['type'] ) { |
|
471 | + switch ( $v[ 'type' ] ) { |
|
472 | 472 | case 'file': |
473 | - $html .= '<tr valign="top"><th scope="row"><label for="' . esc_attr( $k ) . '">' . $v['name'] . '</label></th><td><input name="' . esc_attr( $k ) . '" type="text" id="upload_' . esc_attr( $k ) . '" class="regular-text" value="' . esc_attr( $data ) . '" /> <input type="button" class="button" id="upload_' . esc_attr( $k ) . '_button" value="' . __( 'Upload File' , 'seriously-simple-podcasting' ) . '" data-uploader_title="' . __( 'Choose a file', 'seriously-simple-podcasting' ) . '" data-uploader_button_text="' . __( 'Insert podcast file', 'seriously-simple-podcasting' ) . '" />' . "\n"; |
|
474 | - $html .= '<p class="description">' . $v['description'] . '</p>' . "\n"; |
|
475 | - $html .= '</td><tr/>' . "\n"; |
|
473 | + $html .= '<tr valign="top"><th scope="row"><label for="'.esc_attr ( $k ).'">'.$v[ 'name' ].'</label></th><td><input name="'.esc_attr ( $k ).'" type="text" id="upload_'.esc_attr ( $k ).'" class="regular-text" value="'.esc_attr ( $data ).'" /> <input type="button" class="button" id="upload_'.esc_attr ( $k ).'_button" value="'.__ ( 'Upload File', 'seriously-simple-podcasting' ).'" data-uploader_title="'.__ ( 'Choose a file', 'seriously-simple-podcasting' ).'" data-uploader_button_text="'.__ ( 'Insert podcast file', 'seriously-simple-podcasting' ).'" />'."\n"; |
|
474 | + $html .= '<p class="description">'.$v[ 'description' ].'</p>'."\n"; |
|
475 | + $html .= '</td><tr/>'."\n"; |
|
476 | 476 | break; |
477 | 477 | |
478 | 478 | case 'checkbox': |
479 | - $html .= '<tr valign="top"><th scope="row">' . $v['name'] . '</th><td><input name="' . esc_attr( $k ) . '" type="checkbox" class="' . esc_attr( $class ) . '" id="' . esc_attr( $k ) . '" ' . checked( 'on' , $data , false ) . ' /> <label for="' . esc_attr( $k ) . '"><span class="description">' . $v['description'] . '</span></label>' . "\n"; |
|
480 | - $html .= '</td><tr/>' . "\n"; |
|
479 | + $html .= '<tr valign="top"><th scope="row">'.$v[ 'name' ].'</th><td><input name="'.esc_attr ( $k ).'" type="checkbox" class="'.esc_attr ( $class ).'" id="'.esc_attr ( $k ).'" '.checked ( 'on', $data, false ).' /> <label for="'.esc_attr ( $k ).'"><span class="description">'.$v[ 'description' ].'</span></label>'."\n"; |
|
480 | + $html .= '</td><tr/>'."\n"; |
|
481 | 481 | break; |
482 | 482 | |
483 | 483 | case 'radio': |
484 | - $html .= '<tr valign="top"><th scope="row">' . $v['name'] . '</th><td>' ."\n"; |
|
485 | - foreach( $v['options'] as $option => $label ) { |
|
486 | - $html .= '<input style="vertical-align: bottom;" name="' . esc_attr( $k ) . '" type="radio" class="' . esc_attr( $class ) . '" id="' . esc_attr( $k ) . '_' . esc_attr( $option ) . '" ' . checked( $option , $data , false ) . ' value="' . esc_attr( $option ) . '" /> <label style="margin-right:10px;" for="' . esc_attr( $k ) . '_' . esc_attr( $option ) . '">' . esc_html( $label ) . '</label>' . "\n"; |
|
484 | + $html .= '<tr valign="top"><th scope="row">'.$v[ 'name' ].'</th><td>'."\n"; |
|
485 | + foreach ( $v[ 'options' ] as $option => $label ) { |
|
486 | + $html .= '<input style="vertical-align: bottom;" name="'.esc_attr ( $k ).'" type="radio" class="'.esc_attr ( $class ).'" id="'.esc_attr ( $k ).'_'.esc_attr ( $option ).'" '.checked ( $option, $data, false ).' value="'.esc_attr ( $option ).'" /> <label style="margin-right:10px;" for="'.esc_attr ( $k ).'_'.esc_attr ( $option ).'">'.esc_html ( $label ).'</label>'."\n"; |
|
487 | 487 | } |
488 | - $html .= '<p class="description">' . $v['description'] . '</p>' . "\n"; |
|
489 | - $html .= '</td><tr/>' . "\n"; |
|
488 | + $html .= '<p class="description">'.$v[ 'description' ].'</p>'."\n"; |
|
489 | + $html .= '</td><tr/>'."\n"; |
|
490 | 490 | break; |
491 | 491 | |
492 | 492 | case 'datepicker': |
493 | 493 | $display_date = ''; |
494 | - if( $data ) { |
|
495 | - $display_date = date( 'j F, Y', strtotime( $data ) ); |
|
494 | + if ( $data ) { |
|
495 | + $display_date = date ( 'j F, Y', strtotime ( $data ) ); |
|
496 | 496 | } |
497 | - $html .= '<tr valign="top"><th scope="row"><label for="' . esc_attr( $k ) . '_display">' . $v['name'] . '</label></th><td class="hasDatepicker"><input type="text" id="' . esc_attr( $k ) . '_display" class="ssp-datepicker ' . esc_attr( $class ) . '" value="' . esc_attr( $display_date ) . '" />' . "\n"; |
|
498 | - $html .= '<input name="' . esc_attr( $k ) . '" id="' . esc_attr( $k ) . '" type="hidden" value="' . esc_attr( $data ) . '" />' . "\n"; |
|
499 | - $html .= '<p class="description">' . $v['description'] . '</p>' . "\n"; |
|
500 | - $html .= '</td><tr/>' . "\n"; |
|
497 | + $html .= '<tr valign="top"><th scope="row"><label for="'.esc_attr ( $k ).'_display">'.$v[ 'name' ].'</label></th><td class="hasDatepicker"><input type="text" id="'.esc_attr ( $k ).'_display" class="ssp-datepicker '.esc_attr ( $class ).'" value="'.esc_attr ( $display_date ).'" />'."\n"; |
|
498 | + $html .= '<input name="'.esc_attr ( $k ).'" id="'.esc_attr ( $k ).'" type="hidden" value="'.esc_attr ( $data ).'" />'."\n"; |
|
499 | + $html .= '<p class="description">'.$v[ 'description' ].'</p>'."\n"; |
|
500 | + $html .= '</td><tr/>'."\n"; |
|
501 | 501 | break; |
502 | 502 | |
503 | 503 | default: |
504 | - $html .= '<tr valign="top"><th scope="row"><label for="' . esc_attr( $k ) . '">' . $v['name'] . '</label></th><td><input name="' . esc_attr( $k ) . '" type="text" id="' . esc_attr( $k ) . '" class="' . esc_attr( $class ) . '" value="' . esc_attr( $data ) . '" />' . "\n"; |
|
505 | - $html .= '<p class="description">' . $v['description'] . '</p>' . "\n"; |
|
506 | - $html .= '</td><tr/>' . "\n"; |
|
504 | + $html .= '<tr valign="top"><th scope="row"><label for="'.esc_attr ( $k ).'">'.$v[ 'name' ].'</label></th><td><input name="'.esc_attr ( $k ).'" type="text" id="'.esc_attr ( $k ).'" class="'.esc_attr ( $class ).'" value="'.esc_attr ( $data ).'" />'."\n"; |
|
505 | + $html .= '<p class="description">'.$v[ 'description' ].'</p>'."\n"; |
|
506 | + $html .= '</td><tr/>'."\n"; |
|
507 | 507 | break; |
508 | 508 | } |
509 | 509 | |
510 | 510 | } |
511 | 511 | |
512 | - $html .= '</tbody>' . "\n"; |
|
513 | - $html .= '</table>' . "\n"; |
|
512 | + $html .= '</tbody>'."\n"; |
|
513 | + $html .= '</table>'."\n"; |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | echo $html; |
@@ -524,78 +524,78 @@ discard block |
||
524 | 524 | public function meta_box_save( $post_id ) { |
525 | 525 | global $ss_podcasting; |
526 | 526 | |
527 | - $podcast_post_types = ssp_post_types( true ); |
|
527 | + $podcast_post_types = ssp_post_types ( true ); |
|
528 | 528 | |
529 | 529 | // Post type check |
530 | - if ( ! in_array( get_post_type(), $podcast_post_types ) ) { |
|
530 | + if ( ! in_array ( get_post_type (), $podcast_post_types ) ) { |
|
531 | 531 | return false; |
532 | 532 | } |
533 | 533 | |
534 | 534 | // Security check |
535 | - if ( ! isset( $_POST['seriouslysimple_' . $this->token . '_nonce'] ) || ! ( isset( $_POST['seriouslysimple_' . $this->token . '_nonce'] ) && wp_verify_nonce( $_POST['seriouslysimple_' . $this->token . '_nonce'], plugin_basename( $this->dir ) ) ) ) { |
|
535 | + if ( ! isset( $_POST[ 'seriouslysimple_'.$this->token.'_nonce' ] ) || ! ( isset( $_POST[ 'seriouslysimple_'.$this->token.'_nonce' ] ) && wp_verify_nonce ( $_POST[ 'seriouslysimple_'.$this->token.'_nonce' ], plugin_basename ( $this->dir ) ) ) ) { |
|
536 | 536 | return $post_id; |
537 | 537 | } |
538 | 538 | |
539 | 539 | // User capability check |
540 | - if ( 'page' == $_POST['post_type'] ) { |
|
541 | - if ( ! current_user_can( 'edit_page', $post_id ) ) { |
|
540 | + if ( 'page' == $_POST[ 'post_type' ] ) { |
|
541 | + if ( ! current_user_can ( 'edit_page', $post_id ) ) { |
|
542 | 542 | return $post_id; |
543 | 543 | } |
544 | 544 | } else { |
545 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
545 | + if ( ! current_user_can ( 'edit_post', $post_id ) ) { |
|
546 | 546 | return $post_id; |
547 | 547 | } |
548 | 548 | } |
549 | 549 | |
550 | - $field_data = $this->custom_fields(); |
|
550 | + $field_data = $this->custom_fields (); |
|
551 | 551 | $enclosure = ''; |
552 | 552 | |
553 | 553 | foreach ( $field_data as $k => $field ) { |
554 | 554 | |
555 | - if( 'embed_code' == $k ) { |
|
555 | + if ( 'embed_code' == $k ) { |
|
556 | 556 | continue; |
557 | 557 | } |
558 | 558 | |
559 | 559 | $val = ''; |
560 | 560 | if ( isset( $_POST[ $k ] ) ) { |
561 | - $val = strip_tags( trim( $_POST[ $k ] ) ); |
|
561 | + $val = strip_tags ( trim ( $_POST[ $k ] ) ); |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | if ( $k == 'audio_file' ) { |
565 | 565 | $enclosure = $val; |
566 | 566 | } |
567 | 567 | |
568 | - update_post_meta( $post_id, $k, $val ); |
|
568 | + update_post_meta ( $post_id, $k, $val ); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | if ( $enclosure ) { |
572 | 572 | |
573 | 573 | // Get file duration |
574 | - if ( get_post_meta( $post_id, 'duration', true ) == '' ) { |
|
575 | - $duration = $ss_podcasting->get_file_duration( $enclosure ); |
|
574 | + if ( get_post_meta ( $post_id, 'duration', true ) == '' ) { |
|
575 | + $duration = $ss_podcasting->get_file_duration ( $enclosure ); |
|
576 | 576 | if ( $duration ) { |
577 | - update_post_meta( $post_id , 'duration' , $duration ); |
|
577 | + update_post_meta ( $post_id, 'duration', $duration ); |
|
578 | 578 | } |
579 | 579 | } |
580 | 580 | |
581 | 581 | // Get file size |
582 | - if ( get_post_meta( $post_id, 'filesize', true ) == '' ) { |
|
583 | - $filesize = $ss_podcasting->get_file_size( $enclosure ); |
|
582 | + if ( get_post_meta ( $post_id, 'filesize', true ) == '' ) { |
|
583 | + $filesize = $ss_podcasting->get_file_size ( $enclosure ); |
|
584 | 584 | if ( $filesize ) { |
585 | 585 | |
586 | - if ( isset( $filesize['formatted'] ) ) { |
|
587 | - update_post_meta( $post_id, 'filesize', $filesize['formatted'] ); |
|
586 | + if ( isset( $filesize[ 'formatted' ] ) ) { |
|
587 | + update_post_meta ( $post_id, 'filesize', $filesize[ 'formatted' ] ); |
|
588 | 588 | } |
589 | 589 | |
590 | - if ( isset( $filesize['raw'] ) ) { |
|
591 | - update_post_meta( $post_id, 'filesize_raw', $filesize['raw'] ); |
|
590 | + if ( isset( $filesize[ 'raw' ] ) ) { |
|
591 | + update_post_meta ( $post_id, 'filesize_raw', $filesize[ 'raw' ] ); |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | } |
595 | 595 | } |
596 | 596 | |
597 | 597 | // Save podcast file to 'enclosure' meta field for standards-sake |
598 | - update_post_meta( $post_id, 'enclosure', $enclosure ); |
|
598 | + update_post_meta ( $post_id, 'enclosure', $enclosure ); |
|
599 | 599 | |
600 | 600 | } |
601 | 601 | |
@@ -609,65 +609,65 @@ discard block |
||
609 | 609 | global $pagenow; |
610 | 610 | $fields = array(); |
611 | 611 | |
612 | - $fields['episode_type'] = array( |
|
613 | - 'name' => __( 'Episode type:' , 'seriously-simple-podcasting' ), |
|
612 | + $fields[ 'episode_type' ] = array( |
|
613 | + 'name' => __ ( 'Episode type:', 'seriously-simple-podcasting' ), |
|
614 | 614 | 'description' => '', |
615 | 615 | 'type' => 'radio', |
616 | 616 | 'default' => 'audio', |
617 | - 'options' => array( 'audio' => __( 'Audio', 'seriously-simple-podcasting' ), 'video' => __( 'Video', 'seriously-simple-podcasting' ) ), |
|
617 | + 'options' => array( 'audio' => __ ( 'Audio', 'seriously-simple-podcasting' ), 'video' => __ ( 'Video', 'seriously-simple-podcasting' ) ), |
|
618 | 618 | 'section' => 'info', |
619 | 619 | ); |
620 | 620 | |
621 | 621 | // In v1.14+ the `audio_file` field can actually be either audio or video, but we're keeping the field name here for backwards compatibility |
622 | - $fields['audio_file'] = array( |
|
623 | - 'name' => __( 'Podcast file:' , 'seriously-simple-podcasting' ), |
|
624 | - 'description' => __( 'Upload the primary podcast file or paste the file URL here.' , 'seriously-simple-podcasting' ), |
|
622 | + $fields[ 'audio_file' ] = array( |
|
623 | + 'name' => __ ( 'Podcast file:', 'seriously-simple-podcasting' ), |
|
624 | + 'description' => __ ( 'Upload the primary podcast file or paste the file URL here.', 'seriously-simple-podcasting' ), |
|
625 | 625 | 'type' => 'file', |
626 | 626 | 'default' => '', |
627 | 627 | 'section' => 'info', |
628 | 628 | ); |
629 | 629 | |
630 | - $fields['duration'] = array( |
|
631 | - 'name' => __( 'Duration:' , 'seriously-simple-podcasting' ), |
|
632 | - 'description' => __( 'Duration of podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ), |
|
630 | + $fields[ 'duration' ] = array( |
|
631 | + 'name' => __ ( 'Duration:', 'seriously-simple-podcasting' ), |
|
632 | + 'description' => __ ( 'Duration of podcast file for display (calculated automatically if possible).', 'seriously-simple-podcasting' ), |
|
633 | 633 | 'type' => 'text', |
634 | 634 | 'default' => '', |
635 | 635 | 'section' => 'info', |
636 | 636 | ); |
637 | 637 | |
638 | - $fields['filesize'] = array( |
|
639 | - 'name' => __( 'File size:' , 'seriously-simple-podcasting' ), |
|
640 | - 'description' => __( 'Size of the podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ), |
|
638 | + $fields[ 'filesize' ] = array( |
|
639 | + 'name' => __ ( 'File size:', 'seriously-simple-podcasting' ), |
|
640 | + 'description' => __ ( 'Size of the podcast file for display (calculated automatically if possible).', 'seriously-simple-podcasting' ), |
|
641 | 641 | 'type' => 'text', |
642 | 642 | 'default' => '', |
643 | 643 | 'section' => 'info', |
644 | 644 | ); |
645 | 645 | |
646 | - $fields['date_recorded'] = array( |
|
647 | - 'name' => __( 'Date recorded:' , 'seriously-simple-podcasting' ), |
|
648 | - 'description' => __( 'The date on which this episode was recorded.' , 'seriously-simple-podcasting' ), |
|
646 | + $fields[ 'date_recorded' ] = array( |
|
647 | + 'name' => __ ( 'Date recorded:', 'seriously-simple-podcasting' ), |
|
648 | + 'description' => __ ( 'The date on which this episode was recorded.', 'seriously-simple-podcasting' ), |
|
649 | 649 | 'type' => 'datepicker', |
650 | 650 | 'default' => '', |
651 | 651 | 'section' => 'info', |
652 | 652 | ); |
653 | 653 | |
654 | - $fields['explicit'] = array( |
|
655 | - 'name' => __( 'Explicit:' , 'seriously-simple-podcasting' ), |
|
656 | - 'description' => __( 'Mark this episode as explicit.' , 'seriously-simple-podcasting' ), |
|
654 | + $fields[ 'explicit' ] = array( |
|
655 | + 'name' => __ ( 'Explicit:', 'seriously-simple-podcasting' ), |
|
656 | + 'description' => __ ( 'Mark this episode as explicit.', 'seriously-simple-podcasting' ), |
|
657 | 657 | 'type' => 'checkbox', |
658 | 658 | 'default' => '', |
659 | 659 | 'section' => 'info', |
660 | 660 | ); |
661 | 661 | |
662 | - $fields['block'] = array( |
|
663 | - 'name' => __( 'Block:' , 'seriously-simple-podcasting' ), |
|
664 | - 'description' => __( 'Block this episode from appearing in the iTunes & Google Play podcast libraries.' , 'seriously-simple-podcasting' ), |
|
662 | + $fields[ 'block' ] = array( |
|
663 | + 'name' => __ ( 'Block:', 'seriously-simple-podcasting' ), |
|
664 | + 'description' => __ ( 'Block this episode from appearing in the iTunes & Google Play podcast libraries.', 'seriously-simple-podcasting' ), |
|
665 | 665 | 'type' => 'checkbox', |
666 | 666 | 'default' => '', |
667 | 667 | 'section' => 'info', |
668 | 668 | ); |
669 | 669 | |
670 | - return apply_filters( 'ssp_episode_fields', $fields ); |
|
670 | + return apply_filters ( 'ssp_episode_fields', $fields ); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | /** |
@@ -677,17 +677,17 @@ discard block |
||
677 | 677 | */ |
678 | 678 | public function glance_items( $items = array() ) { |
679 | 679 | |
680 | - $num_posts = count( ssp_episodes( -1, '', false, 'glance' ) ); |
|
680 | + $num_posts = count ( ssp_episodes ( -1, '', false, 'glance' ) ); |
|
681 | 681 | |
682 | - $post_type_object = get_post_type_object( $this->token ); |
|
682 | + $post_type_object = get_post_type_object ( $this->token ); |
|
683 | 683 | |
684 | - $text = _n( '%s Episode', '%s Episodes', $num_posts, 'seriously-simple-podcasting' ); |
|
685 | - $text = sprintf( $text, number_format_i18n( $num_posts ) ); |
|
684 | + $text = _n ( '%s Episode', '%s Episodes', $num_posts, 'seriously-simple-podcasting' ); |
|
685 | + $text = sprintf ( $text, number_format_i18n ( $num_posts ) ); |
|
686 | 686 | |
687 | - if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) { |
|
688 | - $items[] = sprintf( '<a class="%1$s-count" href="edit.php?post_type=%1$s">%2$s</a>', $this->token, $text ) . "\n"; |
|
687 | + if ( $post_type_object && current_user_can ( $post_type_object->cap->edit_posts ) ) { |
|
688 | + $items[ ] = sprintf ( '<a class="%1$s-count" href="edit.php?post_type=%1$s">%2$s</a>', $this->token, $text )."\n"; |
|
689 | 689 | } else { |
690 | - $items[] = sprintf( '<span class="%1$s-count">%2$s</span>', $this->token, $text ) . "\n"; |
|
690 | + $items[ ] = sprintf ( '<span class="%1$s-count">%2$s</span>', $this->token, $text )."\n"; |
|
691 | 691 | } |
692 | 692 | |
693 | 693 | return $items; |
@@ -701,15 +701,15 @@ discard block |
||
701 | 701 | * @param string $status Plugin status |
702 | 702 | * @return array Modified plugin meta links |
703 | 703 | */ |
704 | - public function plugin_row_meta ( $plugin_meta = array(), $plugin_file = '', $plugin_data = array(), $status = '' ) { |
|
704 | + public function plugin_row_meta( $plugin_meta = array(), $plugin_file = '', $plugin_data = array(), $status = '' ) { |
|
705 | 705 | |
706 | - if ( ! isset( $plugin_data['slug'] ) || 'seriously-simple-podcasting' != $plugin_data['slug'] ) { |
|
706 | + if ( ! isset( $plugin_data[ 'slug' ] ) || 'seriously-simple-podcasting' != $plugin_data[ 'slug' ] ) { |
|
707 | 707 | return $plugin_meta; |
708 | 708 | } |
709 | 709 | |
710 | - $plugin_meta['docs'] = '<a href="http://www.seriouslysimplepodcasting.com/documentation/" target="_blank">' . __( 'Documentation', 'seriously-simple-podcasting' ) . '</a>'; |
|
711 | - $plugin_meta['addons'] = '<a href="http://www.seriouslysimplepodcasting.com/add-ons/" target="_blank">' . __( 'Add-ons', 'seriously-simple-podcasting' ) . '</a>'; |
|
712 | - $plugin_meta['review'] = '<a href="https://wordpress.org/support/view/plugin-reviews/' . $plugin_data['slug'] . '?rate=5#postform" target="_blank">' . __( 'Write a review', 'seriously-simple-podcasting' ) . '</a>'; |
|
710 | + $plugin_meta[ 'docs' ] = '<a href="http://www.seriouslysimplepodcasting.com/documentation/" target="_blank">'.__ ( 'Documentation', 'seriously-simple-podcasting' ).'</a>'; |
|
711 | + $plugin_meta[ 'addons' ] = '<a href="http://www.seriouslysimplepodcasting.com/add-ons/" target="_blank">'.__ ( 'Add-ons', 'seriously-simple-podcasting' ).'</a>'; |
|
712 | + $plugin_meta[ 'review' ] = '<a href="https://wordpress.org/support/view/plugin-reviews/'.$plugin_data[ 'slug' ].'?rate=5#postform" target="_blank">'.__ ( 'Write a review', 'seriously-simple-podcasting' ).'</a>'; |
|
713 | 713 | |
714 | 714 | return $plugin_meta; |
715 | 715 | } |
@@ -720,8 +720,8 @@ discard block |
||
720 | 720 | * @return string Modified text |
721 | 721 | */ |
722 | 722 | public function enter_title_here( $title ) { |
723 | - if ( get_post_type() == $this->token ) { |
|
724 | - $title = __( 'Enter episode title here', 'seriously-simple-podcasting' ); |
|
723 | + if ( get_post_type () == $this->token ) { |
|
724 | + $title = __ ( 'Enter episode title here', 'seriously-simple-podcasting' ); |
|
725 | 725 | } |
726 | 726 | return $title; |
727 | 727 | } |
@@ -731,11 +731,11 @@ discard block |
||
731 | 731 | * @return void |
732 | 732 | */ |
733 | 733 | public function enqueue_admin_styles() { |
734 | - wp_register_style( 'ssp-admin', esc_url( $this->assets_url . 'css/admin.css' ), array(), $this->version ); |
|
735 | - wp_enqueue_style( 'ssp-admin' ); |
|
734 | + wp_register_style ( 'ssp-admin', esc_url ( $this->assets_url.'css/admin.css' ), array(), $this->version ); |
|
735 | + wp_enqueue_style ( 'ssp-admin' ); |
|
736 | 736 | |
737 | 737 | // Datepicker |
738 | - wp_enqueue_style( 'jquery-ui-datepicker', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css' ); |
|
738 | + wp_enqueue_style ( 'jquery-ui-datepicker', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css' ); |
|
739 | 739 | } |
740 | 740 | |
741 | 741 | /** |
@@ -743,8 +743,8 @@ discard block |
||
743 | 743 | * @return void |
744 | 744 | */ |
745 | 745 | public function enqueue_admin_scripts() { |
746 | - wp_register_script( 'ssp-admin', esc_url( $this->assets_url . 'js/admin' . $this->script_suffix . '.js' ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker' ), $this->version ); |
|
747 | - wp_enqueue_script( 'ssp-admin' ); |
|
746 | + wp_register_script ( 'ssp-admin', esc_url ( $this->assets_url.'js/admin'.$this->script_suffix.'.js' ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker' ), $this->version ); |
|
747 | + wp_enqueue_script ( 'ssp-admin' ); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | /** |
@@ -752,8 +752,8 @@ discard block |
||
752 | 752 | * @return void |
753 | 753 | */ |
754 | 754 | public function ensure_post_thumbnails_support() { |
755 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
756 | - add_theme_support( 'post-thumbnails' ); |
|
755 | + if ( ! current_theme_supports ( 'post-thumbnails' ) ) { |
|
756 | + add_theme_support ( 'post-thumbnails' ); |
|
757 | 757 | } |
758 | 758 | } |
759 | 759 | |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | * @return void |
763 | 763 | */ |
764 | 764 | public function load_localisation() { |
765 | - load_plugin_textdomain( 'seriously-simple-podcasting', false, dirname( plugin_basename( $this->file ) ) . '/lang/' ); |
|
765 | + load_plugin_textdomain ( 'seriously-simple-podcasting', false, dirname ( plugin_basename ( $this->file ) ).'/lang/' ); |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | /** |
@@ -772,10 +772,10 @@ discard block |
||
772 | 772 | public function load_plugin_textdomain() { |
773 | 773 | $domain = 'seriously-simple-podcasting'; |
774 | 774 | // The "plugin_locale" filter is also used in load_plugin_textdomain() |
775 | - $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); |
|
775 | + $locale = apply_filters ( 'plugin_locale', get_locale (), $domain ); |
|
776 | 776 | |
777 | - load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' ); |
|
778 | - load_plugin_textdomain( $domain, false, dirname( plugin_basename( $this->file ) ) . '/lang/' ); |
|
777 | + load_textdomain ( $domain, WP_LANG_DIR.'/'.$domain.'/'.$domain.'-'.$locale.'.mo' ); |
|
778 | + load_plugin_textdomain ( $domain, false, dirname ( plugin_basename ( $this->file ) ).'/lang/' ); |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | /** |
@@ -783,8 +783,8 @@ discard block |
||
783 | 783 | * @return void |
784 | 784 | */ |
785 | 785 | public function add_feed() { |
786 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
787 | - add_feed( $feed_slug, array( $this, 'feed_template' ) ); |
|
786 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
787 | + add_feed ( $feed_slug, array( $this, 'feed_template' ) ); |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | /** |
@@ -792,9 +792,9 @@ discard block |
||
792 | 792 | * @param boolean $include_footer Default inclusion value |
793 | 793 | * @return boolean Modified inclusion value |
794 | 794 | */ |
795 | - public function hide_wp_seo_rss_footer ( $include_footer = true ) { |
|
795 | + public function hide_wp_seo_rss_footer( $include_footer = true ) { |
|
796 | 796 | |
797 | - if ( is_feed( 'podcast' ) ) { |
|
797 | + if ( is_feed ( 'podcast' ) ) { |
|
798 | 798 | $include_footer = false; |
799 | 799 | } |
800 | 800 | |
@@ -810,24 +810,24 @@ discard block |
||
810 | 810 | |
811 | 811 | // Prevent 404 on feed |
812 | 812 | $wp_query->is_404 = false; |
813 | - status_header( 200 ); |
|
813 | + status_header ( 200 ); |
|
814 | 814 | |
815 | 815 | $file_name = 'feed-podcast.php'; |
816 | 816 | |
817 | - $user_template_file = apply_filters( 'ssp_feed_template_file', trailingslashit( get_stylesheet_directory() ) . $file_name ); |
|
817 | + $user_template_file = apply_filters ( 'ssp_feed_template_file', trailingslashit ( get_stylesheet_directory () ).$file_name ); |
|
818 | 818 | |
819 | 819 | // Any functions hooked in here must NOT output any data or else feed will break |
820 | - do_action( 'ssp_before_feed' ); |
|
820 | + do_action ( 'ssp_before_feed' ); |
|
821 | 821 | |
822 | 822 | // Load user feed template if it exists, otherwise use plugin template |
823 | - if ( file_exists( $user_template_file ) ) { |
|
823 | + if ( file_exists ( $user_template_file ) ) { |
|
824 | 824 | require( $user_template_file ); |
825 | 825 | } else { |
826 | - require( $this->template_path . $file_name ); |
|
826 | + require( $this->template_path.$file_name ); |
|
827 | 827 | } |
828 | 828 | |
829 | 829 | // Any functions hooked in here must NOT output any data or else feed will break |
830 | - do_action( 'ssp_after_feed' ); |
|
830 | + do_action ( 'ssp_after_feed' ); |
|
831 | 831 | |
832 | 832 | exit; |
833 | 833 | } |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | * @return void |
838 | 838 | */ |
839 | 839 | public function redirect_old_feed() { |
840 | - if ( isset( $_GET['feed'] ) && in_array( $_GET['feed'], array( 'podcast', 'itunes' ) ) ) { |
|
841 | - $this->feed_template(); |
|
840 | + if ( isset( $_GET[ 'feed' ] ) && in_array ( $_GET[ 'feed' ], array( 'podcast', 'itunes' ) ) ) { |
|
841 | + $this->feed_template (); |
|
842 | 842 | exit; |
843 | 843 | } |
844 | 844 | } |
@@ -850,12 +850,12 @@ discard block |
||
850 | 850 | public function activate() { |
851 | 851 | |
852 | 852 | // Setup all custom URL rules |
853 | - $this->register_post_type(); |
|
854 | - $this->add_feed(); |
|
855 | - $this->setup_permastruct(); |
|
853 | + $this->register_post_type (); |
|
854 | + $this->add_feed (); |
|
855 | + $this->setup_permastruct (); |
|
856 | 856 | |
857 | 857 | // Flush permalinks |
858 | - flush_rewrite_rules( true ); |
|
858 | + flush_rewrite_rules ( true ); |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | /** |
@@ -863,37 +863,37 @@ discard block |
||
863 | 863 | * @return void |
864 | 864 | */ |
865 | 865 | public function deactivate() { |
866 | - flush_rewrite_rules(); |
|
866 | + flush_rewrite_rules (); |
|
867 | 867 | } |
868 | 868 | |
869 | 869 | /** |
870 | 870 | * Run functions on plugin update/activation |
871 | 871 | * @return void |
872 | 872 | */ |
873 | - public function update () { |
|
873 | + public function update() { |
|
874 | 874 | |
875 | - $previous_version = get_option( 'ssp_version', '1.0' ); |
|
875 | + $previous_version = get_option ( 'ssp_version', '1.0' ); |
|
876 | 876 | |
877 | - if ( version_compare( $previous_version, '1.13.1', '<' ) ) { |
|
878 | - flush_rewrite_rules(); |
|
877 | + if ( version_compare ( $previous_version, '1.13.1', '<' ) ) { |
|
878 | + flush_rewrite_rules (); |
|
879 | 879 | } |
880 | 880 | |
881 | - update_option( 'ssp_version', $this->version ); |
|
881 | + update_option ( 'ssp_version', $this->version ); |
|
882 | 882 | } |
883 | 883 | |
884 | 884 | /** |
885 | 885 | * Update 'enclosure' meta field to 'audio_file' meta field |
886 | 886 | * @return void |
887 | 887 | */ |
888 | - public function update_enclosures () { |
|
888 | + public function update_enclosures() { |
|
889 | 889 | |
890 | 890 | // Allow forced re-run of update if necessary |
891 | - if ( isset( $_GET['ssp_update_enclosures'] ) ) { |
|
892 | - delete_option( 'ssp_update_enclosures' ); |
|
891 | + if ( isset( $_GET[ 'ssp_update_enclosures' ] ) ) { |
|
892 | + delete_option ( 'ssp_update_enclosures' ); |
|
893 | 893 | } |
894 | 894 | |
895 | 895 | // Check if update has been run |
896 | - $update_run = get_option( 'ssp_update_enclosures', false ); |
|
896 | + $update_run = get_option ( 'ssp_update_enclosures', false ); |
|
897 | 897 | |
898 | 898 | if ( $update_run ) { |
899 | 899 | return; |
@@ -914,9 +914,9 @@ discard block |
||
914 | 914 | 'fields' => 'ids', |
915 | 915 | ); |
916 | 916 | |
917 | - $posts_with_enclosures = get_posts( $args ); |
|
917 | + $posts_with_enclosures = get_posts ( $args ); |
|
918 | 918 | |
919 | - if ( 0 == count( $posts_with_enclosures ) ) { |
|
919 | + if ( 0 == count ( $posts_with_enclosures ) ) { |
|
920 | 920 | return; |
921 | 921 | } |
922 | 922 | |
@@ -924,17 +924,17 @@ discard block |
||
924 | 924 | foreach ( (array) $posts_with_enclosures as $post_id ) { |
925 | 925 | |
926 | 926 | // Get existing enclosure |
927 | - $enclosure = get_post_meta( $post_id, 'enclosure', true ); |
|
927 | + $enclosure = get_post_meta ( $post_id, 'enclosure', true ); |
|
928 | 928 | |
929 | 929 | // Add audio_file field |
930 | 930 | if ( $enclosure ) { |
931 | - update_post_meta( $post_id, 'audio_file', $enclosure ); |
|
931 | + update_post_meta ( $post_id, 'audio_file', $enclosure ); |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | } |
935 | 935 | |
936 | 936 | // Mark update as having been run |
937 | - update_option( 'ssp_update_enclosures', 'run' ); |
|
937 | + update_option ( 'ssp_update_enclosures', 'run' ); |
|
938 | 938 | } |
939 | 939 | |
940 | 940 | /** |
@@ -945,19 +945,19 @@ discard block |
||
945 | 945 | public function admin_footer_text( $footer_text ) { |
946 | 946 | |
947 | 947 | // Check to make sure we're on a SSP settings page |
948 | - if ( ( isset( $_GET['page'] ) && 'podcast_settings' == esc_attr( $_GET['page'] ) ) && apply_filters( 'ssp_display_admin_footer_text', true ) ) { |
|
948 | + if ( ( isset( $_GET[ 'page' ] ) && 'podcast_settings' == esc_attr ( $_GET[ 'page' ] ) ) && apply_filters ( 'ssp_display_admin_footer_text', true ) ) { |
|
949 | 949 | |
950 | 950 | // Change the footer text |
951 | - if ( ! get_option( 'ssp_admin_footer_text_rated' ) ) { |
|
952 | - $footer_text = sprintf( __( 'If you like %1$sSeriously Simple Podcasting%2$s please leave a %3$s★★★★★%4$s rating. A huge thank you in advance!', 'seriously-simple-podcasting' ), '<strong>', '</strong>', '<a href="https://wordpress.org/support/view/plugin-reviews/seriously-simple-podcasting?filter=5#postform" target="_blank" class="ssp-rating-link" data-rated="' . __( 'Thanks!', 'seriously-simple-podcasting' ) . '">', '</a>' ); |
|
951 | + if ( ! get_option ( 'ssp_admin_footer_text_rated' ) ) { |
|
952 | + $footer_text = sprintf ( __ ( 'If you like %1$sSeriously Simple Podcasting%2$s please leave a %3$s★★★★★%4$s rating. A huge thank you in advance!', 'seriously-simple-podcasting' ), '<strong>', '</strong>', '<a href="https://wordpress.org/support/view/plugin-reviews/seriously-simple-podcasting?filter=5#postform" target="_blank" class="ssp-rating-link" data-rated="'.__ ( 'Thanks!', 'seriously-simple-podcasting' ).'">', '</a>' ); |
|
953 | 953 | $footer_text .= "<script type='text/javascript'> |
954 | 954 | jQuery('a.ssp-rating-link').click(function() { |
955 | - jQuery.post( '" . admin_url( 'admin-ajax.php' ) . "', { action: 'ssp_rated' } ); |
|
955 | + jQuery.post( '" . admin_url ( 'admin-ajax.php' )."', { action: 'ssp_rated' } ); |
|
956 | 956 | jQuery(this).parent().text( jQuery(this).data( 'rated' ) ); |
957 | 957 | }); |
958 | 958 | </script>"; |
959 | 959 | } else { |
960 | - $footer_text = sprintf( __( '%1$sThank you for publishing with %2$sSeriously Simple Podcasting%3$s.%4$s', 'seriously-simple-podcasting' ), '<span id="footer-thankyou">', '<a href="http://www.seriouslysimplepodcasting.com/" target="_blank">', '</a>', '</span>' ); |
|
960 | + $footer_text = sprintf ( __ ( '%1$sThank you for publishing with %2$sSeriously Simple Podcasting%3$s.%4$s', 'seriously-simple-podcasting' ), '<span id="footer-thankyou">', '<a href="http://www.seriouslysimplepodcasting.com/" target="_blank">', '</a>', '</span>' ); |
|
961 | 961 | } |
962 | 962 | |
963 | 963 | } |
@@ -970,7 +970,7 @@ discard block |
||
970 | 970 | * @return void |
971 | 971 | */ |
972 | 972 | public function rated() { |
973 | - update_option( 'ssp_admin_footer_text_rated', 1 ); |
|
973 | + update_option ( 'ssp_admin_footer_text_rated', 1 ); |
|
974 | 974 | die(); |
975 | 975 | } |
976 | 976 | |
@@ -980,11 +980,11 @@ discard block |
||
980 | 980 | * @param object $post WordPress Post Object |
981 | 981 | * @return void |
982 | 982 | */ |
983 | - public function invalidate_cache( $id, $post ){ |
|
983 | + public function invalidate_cache( $id, $post ) { |
|
984 | 984 | |
985 | - if ( in_array( $post->post_type, ssp_post_types( true ) ) ){ |
|
986 | - wp_cache_delete( 'episodes', 'ssp' ); |
|
987 | - wp_cache_delete( 'episode_ids', 'ssp' ); |
|
985 | + if ( in_array ( $post->post_type, ssp_post_types ( true ) ) ) { |
|
986 | + wp_cache_delete ( 'episodes', 'ssp' ); |
|
987 | + wp_cache_delete ( 'episode_ids', 'ssp' ); |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | } |
@@ -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,58 +33,58 @@ 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 | // Add shortcodes |
78 | - add_shortcode( 'ss_podcast', 'ss_podcast_shortcode' ); |
|
79 | - add_shortcode( 'podcast_episode', array( $this, 'podcast_episode_shortcode' ) ); |
|
78 | + add_shortcode ( 'ss_podcast', 'ss_podcast_shortcode' ); |
|
79 | + add_shortcode ( 'podcast_episode', array( $this, 'podcast_episode_shortcode' ) ); |
|
80 | 80 | |
81 | 81 | // Register widgets |
82 | - add_action( 'widgets_init', array( $this, 'register_widgets' ), 1 ); |
|
82 | + add_action ( 'widgets_init', array( $this, 'register_widgets' ), 1 ); |
|
83 | 83 | |
84 | - add_filter( 'feed_content_type', array( $this, 'feed_content_type' ), 10, 2 ); |
|
84 | + add_filter ( 'feed_content_type', array( $this, 'feed_content_type' ), 10, 2 ); |
|
85 | 85 | |
86 | 86 | // Handle localisation |
87 | - add_action( 'plugins_loaded', array( $this, 'load_localisation' ) ); |
|
87 | + add_action ( 'plugins_loaded', array( $this, 'load_localisation' ) ); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -95,36 +95,36 @@ discard block |
||
95 | 95 | public function get_episode_download_link( $episode_id, $referrer = '' ) { |
96 | 96 | |
97 | 97 | // Get file URL |
98 | - $file = $this->get_enclosure( $episode_id ); |
|
98 | + $file = $this->get_enclosure ( $episode_id ); |
|
99 | 99 | |
100 | 100 | if ( ! $file ) { |
101 | 101 | return; |
102 | 102 | } |
103 | 103 | |
104 | 104 | // Get download link based on permalink structure |
105 | - if ( get_option( 'permalink_structure' ) ) { |
|
106 | - $episode = get_post( $episode_id ); |
|
105 | + if ( get_option ( 'permalink_structure' ) ) { |
|
106 | + $episode = get_post ( $episode_id ); |
|
107 | 107 | |
108 | 108 | // Get file extension - default to MP3 to prevent empty extension strings |
109 | - $ext = pathinfo( $file, PATHINFO_EXTENSION ); |
|
110 | - if( ! $ext ) { |
|
109 | + $ext = pathinfo ( $file, PATHINFO_EXTENSION ); |
|
110 | + if ( ! $ext ) { |
|
111 | 111 | $ext = 'mp3'; |
112 | 112 | } |
113 | 113 | |
114 | - $link = $this->home_url . 'podcast-download/' . $episode_id . '/' . $episode->post_name . '.' . $ext; |
|
114 | + $link = $this->home_url.'podcast-download/'.$episode_id.'/'.$episode->post_name.'.'.$ext; |
|
115 | 115 | } else { |
116 | - $link = add_query_arg( array( 'podcast_episode' => $episode_id ), $this->home_url ); |
|
116 | + $link = add_query_arg ( array( 'podcast_episode' => $episode_id ), $this->home_url ); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // Allow for dyamic referrer |
120 | - $referrer = apply_filters( 'ssp_download_referrer', $referrer, $episode_id ); |
|
120 | + $referrer = apply_filters ( 'ssp_download_referrer', $referrer, $episode_id ); |
|
121 | 121 | |
122 | 122 | // Add referrer flag if supplied |
123 | 123 | if ( $referrer ) { |
124 | - $link = add_query_arg( array( 'ref' => $referrer ), $link ); |
|
124 | + $link = add_query_arg ( array( 'ref' => $referrer ), $link ); |
|
125 | 125 | } |
126 | 126 | |
127 | - return apply_filters( 'ssp_episode_download_link', esc_url( $link ), $episode_id, $file ); |
|
127 | + return apply_filters ( 'ssp_episode_download_link', esc_url ( $link ), $episode_id, $file ); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function get_episode_type( $episode_id = 0 ) { |
136 | 136 | |
137 | - if( ! $episode_id ) { |
|
137 | + if ( ! $episode_id ) { |
|
138 | 138 | return false; |
139 | 139 | } |
140 | 140 | |
141 | - $type = get_post_meta( $episode_id , 'episode_type' , true ); |
|
141 | + $type = get_post_meta ( $episode_id, 'episode_type', true ); |
|
142 | 142 | |
143 | - if( ! $type ) { |
|
143 | + if ( ! $type ) { |
|
144 | 144 | $type = 'audio'; |
145 | 145 | } |
146 | 146 | |
@@ -156,32 +156,32 @@ discard block |
||
156 | 156 | global $post, $wp_current_filter, $episode_context; |
157 | 157 | |
158 | 158 | // Don't output unformatted data on excerpts |
159 | - if ( in_array( 'get_the_excerpt', (array) $wp_current_filter ) ) { |
|
159 | + if ( in_array ( 'get_the_excerpt', (array) $wp_current_filter ) ) { |
|
160 | 160 | return $content; |
161 | 161 | } |
162 | 162 | |
163 | 163 | // Don't output episode meta in shortcode or widget |
164 | - if ( isset( $episode_context ) && in_array( $episode_context, array( 'shortcode', 'widget' ) ) ) { |
|
164 | + if ( isset( $episode_context ) && in_array ( $episode_context, array( 'shortcode', 'widget' ) ) ) { |
|
165 | 165 | return $content; |
166 | 166 | } |
167 | 167 | |
168 | - if( post_password_required( $post->ID ) ) { |
|
168 | + if ( post_password_required ( $post->ID ) ) { |
|
169 | 169 | return $content; |
170 | 170 | } |
171 | 171 | |
172 | - $podcast_post_types = ssp_post_types( true ); |
|
172 | + $podcast_post_types = ssp_post_types ( true ); |
|
173 | 173 | |
174 | - if ( in_array( $post->post_type, $podcast_post_types ) && ! is_feed() && ! isset( $_GET['feed'] ) ) { |
|
174 | + if ( in_array ( $post->post_type, $podcast_post_types ) && ! is_feed () && ! isset( $_GET[ 'feed' ] ) ) { |
|
175 | 175 | |
176 | 176 | // Get episode meta data |
177 | - $meta = $this->episode_meta( $post->ID, 'content' ); |
|
177 | + $meta = $this->episode_meta ( $post->ID, 'content' ); |
|
178 | 178 | |
179 | 179 | // Get specified player position |
180 | - $player_position = get_option( 'ss_podcasting_player_content_location', 'above' ); |
|
180 | + $player_position = get_option ( 'ss_podcasting_player_content_location', 'above' ); |
|
181 | 181 | |
182 | - switch( $player_position ) { |
|
183 | - case 'above': $content = $meta . $content; break; |
|
184 | - case 'below': $content = $content . $meta; break; |
|
182 | + switch ( $player_position ) { |
|
183 | + case 'above': $content = $meta.$content; break; |
|
184 | + case 'below': $content = $content.$meta; break; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @return string Modified excerpt |
196 | 196 | */ |
197 | 197 | public function get_excerpt_meta_data( $excerpt = '' ) { |
198 | - return $this->excerpt_meta_data( $excerpt, 'excerpt' ); |
|
198 | + return $this->excerpt_meta_data ( $excerpt, 'excerpt' ); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @return string Modified excerpt |
205 | 205 | */ |
206 | 206 | public function get_embed_meta_data( $excerpt = '' ) { |
207 | - return $this->excerpt_meta_data( $excerpt, 'embed' ); |
|
207 | + return $this->excerpt_meta_data ( $excerpt, 'embed' ); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -215,17 +215,17 @@ discard block |
||
215 | 215 | public function excerpt_meta_data( $excerpt = '', $content = 'excerpt' ) { |
216 | 216 | global $post; |
217 | 217 | |
218 | - if( post_password_required( $post->ID ) ) { |
|
218 | + if ( post_password_required ( $post->ID ) ) { |
|
219 | 219 | return $excerpt; |
220 | 220 | } |
221 | 221 | |
222 | - $podcast_post_types = ssp_post_types( true ); |
|
222 | + $podcast_post_types = ssp_post_types ( true ); |
|
223 | 223 | |
224 | - if ( ( in_array( $post->post_type, $podcast_post_types ) ) && ! is_feed() ) { |
|
224 | + if ( ( in_array ( $post->post_type, $podcast_post_types ) ) && ! is_feed () ) { |
|
225 | 225 | |
226 | - $meta = $this->episode_meta( $post->ID, $content ); |
|
226 | + $meta = $this->episode_meta ( $post->ID, $content ); |
|
227 | 227 | |
228 | - $excerpt = $meta . $excerpt; |
|
228 | + $excerpt = $meta.$excerpt; |
|
229 | 229 | |
230 | 230 | } |
231 | 231 | |
@@ -246,34 +246,34 @@ discard block |
||
246 | 246 | return $meta; |
247 | 247 | } |
248 | 248 | |
249 | - $file = $this->get_enclosure( $episode_id ); |
|
249 | + $file = $this->get_enclosure ( $episode_id ); |
|
250 | 250 | |
251 | 251 | if ( $file ) { |
252 | 252 | |
253 | - if ( get_option( 'permalink_structure' ) ) { |
|
254 | - $file = $this->get_episode_download_link( $episode_id ); |
|
253 | + if ( get_option ( 'permalink_structure' ) ) { |
|
254 | + $file = $this->get_episode_download_link ( $episode_id ); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | // Hide audio player in `ss_podcast` shortcode by default |
258 | 258 | $show_player = true; |
259 | - if( 'shortcode' == $context ) { |
|
259 | + if ( 'shortcode' == $context ) { |
|
260 | 260 | $show_player = false; |
261 | 261 | } |
262 | 262 | |
263 | 263 | // Allow media player to be dynamically hidden/displayed |
264 | - $show_player = apply_filters( 'ssp_show_media_player', $show_player, $context ); |
|
264 | + $show_player = apply_filters ( 'ssp_show_media_player', $show_player, $context ); |
|
265 | 265 | |
266 | 266 | // Show audio player if requested |
267 | - if( $show_player ) { |
|
268 | - $meta .= '<div class="podcast_player">' . $this->media_player( $file, $episode_id ) . '</div>'; |
|
267 | + if ( $show_player ) { |
|
268 | + $meta .= '<div class="podcast_player">'.$this->media_player ( $file, $episode_id ).'</div>'; |
|
269 | 269 | } |
270 | 270 | |
271 | - if ( apply_filters( 'ssp_show_episode_details', true, $episode_id, $context ) ) { |
|
272 | - $meta .= $this->episode_meta_details( $episode_id, $context ); |
|
271 | + if ( apply_filters ( 'ssp_show_episode_details', true, $episode_id, $context ) ) { |
|
272 | + $meta .= $this->episode_meta_details ( $episode_id, $context ); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
276 | - $meta = apply_filters( 'ssp_episode_meta', $meta, $episode_id, $context ); |
|
276 | + $meta = apply_filters ( 'ssp_episode_meta', $meta, $episode_id, $context ); |
|
277 | 277 | |
278 | 278 | return $meta; |
279 | 279 | } |
@@ -284,36 +284,36 @@ discard block |
||
284 | 284 | * @param string $context Context for display |
285 | 285 | * @return string Episode meta details |
286 | 286 | */ |
287 | - public function episode_meta_details ( $episode_id = 0, $context = 'content' ) { |
|
287 | + public function episode_meta_details( $episode_id = 0, $context = 'content' ) { |
|
288 | 288 | |
289 | 289 | if ( ! $episode_id ) { |
290 | 290 | return; |
291 | 291 | } |
292 | 292 | |
293 | - $file = $this->get_enclosure( $episode_id ); |
|
293 | + $file = $this->get_enclosure ( $episode_id ); |
|
294 | 294 | |
295 | 295 | if ( ! $file ) { |
296 | 296 | return; |
297 | 297 | } |
298 | 298 | |
299 | - $link = $this->get_episode_download_link( $episode_id, 'download' ); |
|
300 | - $duration = get_post_meta( $episode_id , 'duration' , true ); |
|
301 | - $size = get_post_meta( $episode_id , 'filesize' , true ); |
|
299 | + $link = $this->get_episode_download_link ( $episode_id, 'download' ); |
|
300 | + $duration = get_post_meta ( $episode_id, 'duration', true ); |
|
301 | + $size = get_post_meta ( $episode_id, 'filesize', true ); |
|
302 | 302 | if ( ! $size ) { |
303 | - $size_data = $this->get_file_size( $file ); |
|
304 | - $size = $size_data['formatted']; |
|
303 | + $size_data = $this->get_file_size ( $file ); |
|
304 | + $size = $size_data[ 'formatted' ]; |
|
305 | 305 | if ( $size ) { |
306 | - if ( isset( $size_data['formatted'] ) ) { |
|
307 | - update_post_meta( $episode_id, 'filesize', $size_data['formatted'] ); |
|
306 | + if ( isset( $size_data[ 'formatted' ] ) ) { |
|
307 | + update_post_meta ( $episode_id, 'filesize', $size_data[ 'formatted' ] ); |
|
308 | 308 | } |
309 | 309 | |
310 | - if ( isset( $size_data['raw'] ) ) { |
|
311 | - update_post_meta( $episode_id, 'filesize_raw', $size_data['raw'] ); |
|
310 | + if ( isset( $size_data[ 'raw' ] ) ) { |
|
311 | + update_post_meta ( $episode_id, 'filesize_raw', $size_data[ 'raw' ] ); |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | } |
315 | 315 | |
316 | - $date_recorded = get_post_meta( $episode_id, 'date_recorded', true ); |
|
316 | + $date_recorded = get_post_meta ( $episode_id, 'date_recorded', true ); |
|
317 | 317 | |
318 | 318 | // Build up meta data array with default values |
319 | 319 | $meta = array( |
@@ -324,62 +324,62 @@ discard block |
||
324 | 324 | 'date_recorded' => '', |
325 | 325 | ); |
326 | 326 | |
327 | - if( $link ) { |
|
328 | - $meta['link'] = $link; |
|
327 | + if ( $link ) { |
|
328 | + $meta[ 'link' ] = $link; |
|
329 | 329 | } |
330 | 330 | |
331 | - if( $link && apply_filters( 'ssp_show_new_window_link', true, $context ) ) { |
|
332 | - $meta['new_window'] = true; |
|
331 | + if ( $link && apply_filters ( 'ssp_show_new_window_link', true, $context ) ) { |
|
332 | + $meta[ 'new_window' ] = true; |
|
333 | 333 | } |
334 | 334 | |
335 | - if( $link ) { |
|
336 | - $meta['duration'] = $duration; |
|
335 | + if ( $link ) { |
|
336 | + $meta[ 'duration' ] = $duration; |
|
337 | 337 | } |
338 | 338 | |
339 | - if( $size ) { |
|
340 | - $meta['size'] = $size; |
|
339 | + if ( $size ) { |
|
340 | + $meta[ 'size' ] = $size; |
|
341 | 341 | } |
342 | 342 | |
343 | - if( $date_recorded ) { |
|
344 | - $meta['date_recorded'] = $date_recorded; |
|
343 | + if ( $date_recorded ) { |
|
344 | + $meta[ 'date_recorded' ] = $date_recorded; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | // Allow dynamic filtering of meta data - to remove, add or reorder meta items |
348 | - $meta = apply_filters( 'ssp_episode_meta_details', $meta, $episode_id, $context ); |
|
348 | + $meta = apply_filters ( 'ssp_episode_meta_details', $meta, $episode_id, $context ); |
|
349 | 349 | |
350 | 350 | $meta_display = ''; |
351 | - $meta_sep = apply_filters( 'ssp_episode_meta_separator', ' | ' ); |
|
351 | + $meta_sep = apply_filters ( 'ssp_episode_meta_separator', ' | ' ); |
|
352 | 352 | foreach ( $meta as $key => $data ) { |
353 | 353 | |
354 | - if( ! $data ) { |
|
354 | + if ( ! $data ) { |
|
355 | 355 | continue; |
356 | 356 | } |
357 | 357 | |
358 | - if( $meta_display ) { |
|
358 | + if ( $meta_display ) { |
|
359 | 359 | $meta_display .= $meta_sep; |
360 | 360 | } |
361 | 361 | |
362 | - switch( $key ) { |
|
362 | + switch ( $key ) { |
|
363 | 363 | |
364 | 364 | case 'link': |
365 | - $meta_display .= '<a href="' . esc_url( $data ) . '" title="' . get_the_title() . ' ">' . __( 'Download file' , 'seriously-simple-podcasting' ) . '</a>'; |
|
365 | + $meta_display .= '<a href="'.esc_url ( $data ).'" title="'.get_the_title ().' ">'.__ ( 'Download file', 'seriously-simple-podcasting' ).'</a>'; |
|
366 | 366 | break; |
367 | 367 | |
368 | 368 | case 'new_window': |
369 | - $play_link = add_query_arg( 'ref', 'new_window', $link ); |
|
370 | - $meta_display .= '<a href="' . esc_url( $play_link ) . '" target="_blank" title="' . get_the_title() . ' ">' . __( 'Play in new window' , 'seriously-simple-podcasting' ) . '</a>'; |
|
369 | + $play_link = add_query_arg ( 'ref', 'new_window', $link ); |
|
370 | + $meta_display .= '<a href="'.esc_url ( $play_link ).'" target="_blank" title="'.get_the_title ().' ">'.__ ( 'Play in new window', 'seriously-simple-podcasting' ).'</a>'; |
|
371 | 371 | break; |
372 | 372 | |
373 | 373 | case 'duration': |
374 | - $meta_display .= __( 'Duration' , 'seriously-simple-podcasting' ) . ': ' . $data; |
|
374 | + $meta_display .= __ ( 'Duration', 'seriously-simple-podcasting' ).': '.$data; |
|
375 | 375 | break; |
376 | 376 | |
377 | 377 | case 'size': |
378 | - $meta_display .= __( 'Size' , 'seriously-simple-podcasting' ) . ': ' . $data; |
|
378 | + $meta_display .= __ ( 'Size', 'seriously-simple-podcasting' ).': '.$data; |
|
379 | 379 | break; |
380 | 380 | |
381 | 381 | case 'date_recorded': |
382 | - $meta_display .= __( 'Recorded on' , 'seriously-simple-podcasting' ) . ' ' . date_i18n( get_option( 'date_format' ), strtotime( $data ) ); |
|
382 | + $meta_display .= __ ( 'Recorded on', 'seriously-simple-podcasting' ).' '.date_i18n ( get_option ( 'date_format' ), strtotime ( $data ) ); |
|
383 | 383 | break; |
384 | 384 | |
385 | 385 | // Allow for custom items to be added, but only allow a small amount of HTML tags |
@@ -395,13 +395,13 @@ discard block |
||
395 | 395 | 'target' => array(), |
396 | 396 | ), |
397 | 397 | ); |
398 | - $meta_display .= wp_kses( $data, $allowed_tags ); |
|
398 | + $meta_display .= wp_kses ( $data, $allowed_tags ); |
|
399 | 399 | break; |
400 | 400 | |
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
404 | - $meta_display = '<div class="podcast_meta"><aside>' . $meta_display . '</aside></div>'; |
|
404 | + $meta_display = '<div class="podcast_meta"><aside>'.$meta_display.'</aside></div>'; |
|
405 | 405 | |
406 | 406 | return $meta_display; |
407 | 407 | |
@@ -413,43 +413,43 @@ discard block |
||
413 | 413 | */ |
414 | 414 | public function add_to_home_query( $query ) { |
415 | 415 | |
416 | - if ( is_admin() ) { |
|
416 | + if ( is_admin () ) { |
|
417 | 417 | return; |
418 | 418 | } |
419 | 419 | |
420 | - $include_in_main_query = get_option('ss_podcasting_include_in_main_query'); |
|
420 | + $include_in_main_query = get_option ( 'ss_podcasting_include_in_main_query' ); |
|
421 | 421 | if ( $include_in_main_query && $include_in_main_query == 'on' ) { |
422 | - if ( $query->is_home() && $query->is_main_query() ) { |
|
423 | - $query->set( 'post_type', array( 'post', 'podcast' ) ); |
|
422 | + if ( $query->is_home () && $query->is_main_query () ) { |
|
423 | + $query->set ( 'post_type', array( 'post', 'podcast' ) ); |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 | } |
427 | 427 | |
428 | - public function add_all_post_types ( $query ) { |
|
428 | + public function add_all_post_types( $query ) { |
|
429 | 429 | |
430 | - if ( is_admin() ) { |
|
430 | + if ( is_admin () ) { |
|
431 | 431 | return; |
432 | 432 | } |
433 | 433 | |
434 | - if ( ! $query->is_main_query() ) { |
|
434 | + if ( ! $query->is_main_query () ) { |
|
435 | 435 | return; |
436 | 436 | } |
437 | 437 | |
438 | - if ( is_post_type_archive( 'podcast' ) || is_tax( 'series' ) ) { |
|
438 | + if ( is_post_type_archive ( 'podcast' ) || is_tax ( 'series' ) ) { |
|
439 | 439 | |
440 | - $podcast_post_types = ssp_post_types( false ); |
|
440 | + $podcast_post_types = ssp_post_types ( false ); |
|
441 | 441 | |
442 | 442 | if ( empty( $podcast_post_types ) ) { |
443 | 443 | return; |
444 | 444 | } |
445 | 445 | |
446 | - $episode_ids = ssp_episode_ids(); |
|
446 | + $episode_ids = ssp_episode_ids (); |
|
447 | 447 | if ( ! empty( $episode_ids ) ) { |
448 | 448 | |
449 | - $query->set( 'post__in', $episode_ids ); |
|
449 | + $query->set ( 'post__in', $episode_ids ); |
|
450 | 450 | |
451 | - $podcast_post_types[] = 'podcast'; |
|
452 | - $query->set( 'post_type', $podcast_post_types ); |
|
451 | + $podcast_post_types[ ] = 'podcast'; |
|
452 | + $query->set ( 'post_type', $podcast_post_types ); |
|
453 | 453 | |
454 | 454 | } |
455 | 455 | |
@@ -467,29 +467,29 @@ discard block |
||
467 | 467 | if ( $file ) { |
468 | 468 | |
469 | 469 | // Include media functions if necessary |
470 | - if ( ! function_exists( 'wp_read_audio_metadata' ) ) { |
|
471 | - require_once( ABSPATH . 'wp-admin/includes/media.php' ); |
|
470 | + if ( ! function_exists ( 'wp_read_audio_metadata' ) ) { |
|
471 | + require_once( ABSPATH.'wp-admin/includes/media.php' ); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | // translate file URL to local file path if possible |
475 | - $file = $this->get_local_file_path( $file ); |
|
475 | + $file = $this->get_local_file_path ( $file ); |
|
476 | 476 | |
477 | 477 | // Get file data (for local file) |
478 | - $data = wp_read_audio_metadata( $file ); |
|
478 | + $data = wp_read_audio_metadata ( $file ); |
|
479 | 479 | |
480 | 480 | $raw = $formatted = ''; |
481 | 481 | |
482 | 482 | if ( $data ) { |
483 | - $raw = $data['filesize']; |
|
484 | - $formatted = $this->format_bytes( $raw ); |
|
483 | + $raw = $data[ 'filesize' ]; |
|
484 | + $formatted = $this->format_bytes ( $raw ); |
|
485 | 485 | } else { |
486 | 486 | |
487 | 487 | // get file data (for remote file) |
488 | - $data = wp_remote_head( $file, array( 'timeout' => 10, 'redirection' => 5 ) ); |
|
488 | + $data = wp_remote_head ( $file, array( 'timeout' => 10, 'redirection' => 5 ) ); |
|
489 | 489 | |
490 | - if ( ! is_wp_error( $data ) && is_array( $data ) && isset( $data['headers']['content-length'] ) ) { |
|
491 | - $raw = $data['headers']['content-length']; |
|
492 | - $formatted = $this->format_bytes( $raw ); |
|
490 | + if ( ! is_wp_error ( $data ) && is_array ( $data ) && isset( $data[ 'headers' ][ 'content-length' ] ) ) { |
|
491 | + $raw = $data[ 'headers' ][ 'content-length' ]; |
|
492 | + $formatted = $this->format_bytes ( $raw ); |
|
493 | 493 | } |
494 | 494 | } |
495 | 495 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | 'formatted' => $formatted |
501 | 501 | ); |
502 | 502 | |
503 | - return apply_filters( 'ssp_file_size', $size, $file ); |
|
503 | + return apply_filters ( 'ssp_file_size', $size, $file ); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | } |
@@ -518,30 +518,30 @@ discard block |
||
518 | 518 | if ( $file ) { |
519 | 519 | |
520 | 520 | // Include media functions if necessary |
521 | - if ( ! function_exists( 'wp_read_audio_metadata' ) ) { |
|
522 | - require_once( ABSPATH . 'wp-admin/includes/media.php' ); |
|
521 | + if ( ! function_exists ( 'wp_read_audio_metadata' ) ) { |
|
522 | + require_once( ABSPATH.'wp-admin/includes/media.php' ); |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | // translate file URL to local file path if possible |
526 | - $file = $this->get_local_file_path( $file ); |
|
526 | + $file = $this->get_local_file_path ( $file ); |
|
527 | 527 | |
528 | 528 | // Get file data (will only work for local files) |
529 | - $data = wp_read_audio_metadata( $file ); |
|
529 | + $data = wp_read_audio_metadata ( $file ); |
|
530 | 530 | |
531 | 531 | $duration = false; |
532 | 532 | |
533 | 533 | if ( $data ) { |
534 | - if ( isset( $data['length_formatted'] ) && strlen( $data['length_formatted'] ) > 0 ) { |
|
535 | - $duration = $data['length_formatted']; |
|
534 | + if ( isset( $data[ 'length_formatted' ] ) && strlen ( $data[ 'length_formatted' ] ) > 0 ) { |
|
535 | + $duration = $data[ 'length_formatted' ]; |
|
536 | 536 | } else { |
537 | - if ( isset( $data['length'] ) && strlen( $data['length'] ) > 0 ) { |
|
538 | - $duration = gmdate( 'H:i:s', $data['length'] ); |
|
537 | + if ( isset( $data[ 'length' ] ) && strlen ( $data[ 'length' ] ) > 0 ) { |
|
538 | + $duration = gmdate ( 'H:i:s', $data[ 'length' ] ); |
|
539 | 539 | } |
540 | 540 | } |
541 | 541 | } |
542 | 542 | |
543 | 543 | if ( $data ) { |
544 | - return apply_filters( 'ssp_file_duration', $duration, $file ); |
|
544 | + return apply_filters ( 'ssp_file_duration', $duration, $file ); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | } |
@@ -555,15 +555,15 @@ discard block |
||
555 | 555 | * @param integer $precision Level of precision for formatting |
556 | 556 | * @return mixed Formatted file size on success, false on failure |
557 | 557 | */ |
558 | - protected function format_bytes( $size , $precision = 2 ) { |
|
558 | + protected function format_bytes( $size, $precision = 2 ) { |
|
559 | 559 | |
560 | 560 | if ( $size ) { |
561 | 561 | |
562 | - $base = log ( $size ) / log( 1024 ); |
|
563 | - $suffixes = array( '' , 'k' , 'M' , 'G' , 'T' ); |
|
564 | - $formatted_size = round( pow( 1024 , $base - floor( $base ) ) , $precision ) . $suffixes[ floor( $base ) ]; |
|
562 | + $base = log ( $size ) / log ( 1024 ); |
|
563 | + $suffixes = array( '', 'k', 'M', 'G', 'T' ); |
|
564 | + $formatted_size = round ( pow ( 1024, $base - floor ( $base ) ), $precision ).$suffixes[ floor ( $base ) ]; |
|
565 | 565 | |
566 | - return apply_filters( 'ssp_file_size_formatted', $formatted_size, $size ); |
|
566 | + return apply_filters ( 'ssp_file_size_formatted', $formatted_size, $size ); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | return false; |
@@ -579,10 +579,10 @@ discard block |
||
579 | 579 | |
580 | 580 | // Let's hash the URL to ensure that we don't get |
581 | 581 | // any illegal chars that might break the cache. |
582 | - $key = md5( $url ); |
|
582 | + $key = md5 ( $url ); |
|
583 | 583 | |
584 | 584 | // Do we have anything in the cache for this URL? |
585 | - $attachment_id = wp_cache_get( $key, 'attachment_id' ); |
|
585 | + $attachment_id = wp_cache_get ( $key, 'attachment_id' ); |
|
586 | 586 | |
587 | 587 | if ( $attachment_id === false ) { |
588 | 588 | |
@@ -599,39 +599,39 @@ discard block |
||
599 | 599 | |
600 | 600 | |
601 | 601 | // Function introduced in 4.0, let's try this first. |
602 | - if ( function_exists( 'attachment_url_to_postid' ) ) { |
|
603 | - $attachment_id = absint( attachment_url_to_postid( $url ) ); |
|
602 | + if ( function_exists ( 'attachment_url_to_postid' ) ) { |
|
603 | + $attachment_id = absint ( attachment_url_to_postid ( $url ) ); |
|
604 | 604 | if ( 0 !== $attachment_id ) { |
605 | - wp_cache_set( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
605 | + wp_cache_set ( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
606 | 606 | return $attachment_id; |
607 | 607 | } |
608 | 608 | } |
609 | 609 | |
610 | 610 | // Then this. |
611 | - if ( preg_match( '#\.[a-zA-Z0-9]+$#', $url ) ) { |
|
612 | - $sql = $wpdb->prepare( |
|
611 | + if ( preg_match ( '#\.[a-zA-Z0-9]+$#', $url ) ) { |
|
612 | + $sql = $wpdb->prepare ( |
|
613 | 613 | "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND guid = %s", |
614 | - esc_url_raw( $url ) |
|
614 | + esc_url_raw ( $url ) |
|
615 | 615 | ); |
616 | - $attachment_id = absint( $wpdb->get_var( $sql ) ); |
|
616 | + $attachment_id = absint ( $wpdb->get_var ( $sql ) ); |
|
617 | 617 | if ( 0 !== $attachment_id ) { |
618 | - wp_cache_set( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
618 | + wp_cache_set ( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
619 | 619 | return $attachment_id; |
620 | 620 | } |
621 | 621 | } |
622 | 622 | |
623 | 623 | // And then try this |
624 | - $upload_dir_paths = wp_upload_dir(); |
|
625 | - if ( false !== strpos( $url, $upload_dir_paths['baseurl'] ) ) { |
|
624 | + $upload_dir_paths = wp_upload_dir (); |
|
625 | + if ( false !== strpos ( $url, $upload_dir_paths[ 'baseurl' ] ) ) { |
|
626 | 626 | // Ensure that we have file extension that matches iTunes. |
627 | - $url = preg_replace( '/(?=\.(m4a|mp3|mov|mp4)$)/i', '', $url ); |
|
627 | + $url = preg_replace ( '/(?=\.(m4a|mp3|mov|mp4)$)/i', '', $url ); |
|
628 | 628 | // Remove the upload path base directory from the attachment URL |
629 | - $url = str_replace( $upload_dir_paths['baseurl'] . '/', '', $url ); |
|
629 | + $url = str_replace ( $upload_dir_paths[ 'baseurl' ].'/', '', $url ); |
|
630 | 630 | // Finally, run a custom database query to get the attachment ID from the modified attachment URL |
631 | - $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 ); |
|
632 | - $attachment_id = absint( $wpdb->get_var( $sql ) ); |
|
631 | + $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 ); |
|
632 | + $attachment_id = absint ( $wpdb->get_var ( $sql ) ); |
|
633 | 633 | if ( 0 !== $attachment_id ) { |
634 | - wp_cache_set( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
634 | + wp_cache_set ( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
635 | 635 | return $attachment_id; |
636 | 636 | } |
637 | 637 | } |
@@ -649,20 +649,20 @@ discard block |
||
649 | 649 | public function get_attachment_mimetype( $attachment = '' ) { |
650 | 650 | |
651 | 651 | // Let's hash the URL to ensure that we don't get any illegal chars that might break the cache. |
652 | - $key = md5( $attachment ); |
|
652 | + $key = md5 ( $attachment ); |
|
653 | 653 | |
654 | 654 | if ( $attachment ) { |
655 | 655 | // Do we have anything in the cache for this? |
656 | - $mime = wp_cache_get( $key, 'mime-type' ); |
|
656 | + $mime = wp_cache_get ( $key, 'mime-type' ); |
|
657 | 657 | if ( $mime === false ) { |
658 | 658 | |
659 | 659 | // Get the ID |
660 | - $id = $this->get_attachment_id_from_url( $attachment ); |
|
660 | + $id = $this->get_attachment_id_from_url ( $attachment ); |
|
661 | 661 | |
662 | 662 | // Get the MIME type |
663 | - $mime = get_post_mime_type( $id ); |
|
663 | + $mime = get_post_mime_type ( $id ); |
|
664 | 664 | // Set the cache |
665 | - wp_cache_set( $key, $mime, 'mime-type', DAY_IN_SECONDS ); |
|
665 | + wp_cache_set ( $key, $mime, 'mime-type', DAY_IN_SECONDS ); |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | return $mime; |
@@ -679,8 +679,8 @@ discard block |
||
679 | 679 | * @return string Audio player HTML on success, false on failure |
680 | 680 | */ |
681 | 681 | public function audio_player( $src = '', $episode_id = 0 ) { |
682 | - $player = $this->media_player( $src, $episode_id ); |
|
683 | - return apply_filters( 'ssp_audio_player', $player, $src, $episode_id ); |
|
682 | + $player = $this->media_player ( $src, $episode_id ); |
|
683 | + return apply_filters ( 'ssp_audio_player', $player, $src, $episode_id ); |
|
684 | 684 | } |
685 | 685 | |
686 | 686 | /** |
@@ -689,40 +689,40 @@ discard block |
||
689 | 689 | * @param integer $episode_id Episode ID for audio file |
690 | 690 | * @return string Media player HTML on success, empty string on failure |
691 | 691 | */ |
692 | - public function media_player ( $src = '', $episode_id = 0 ) { |
|
692 | + public function media_player( $src = '', $episode_id = 0 ) { |
|
693 | 693 | $player = ''; |
694 | 694 | |
695 | 695 | if ( $src ) { |
696 | 696 | |
697 | 697 | // Get episode type and default to audio |
698 | - $type = $this->get_episode_type( $episode_id ); |
|
699 | - if( ! $type ) { |
|
698 | + $type = $this->get_episode_type ( $episode_id ); |
|
699 | + if ( ! $type ) { |
|
700 | 700 | $type = 'audio'; |
701 | 701 | } |
702 | 702 | |
703 | 703 | // Switch to podcast player URL |
704 | - $src = str_replace( 'podcast-download', 'podcast-player', $src ); |
|
704 | + $src = str_replace ( 'podcast-download', 'podcast-player', $src ); |
|
705 | 705 | |
706 | 706 | // Set up paramters for media player |
707 | 707 | $params = array( 'src' => $src, 'preload' => 'none' ); |
708 | 708 | |
709 | 709 | // Use built-in WordPress media player |
710 | - switch( $type ) { |
|
711 | - case 'audio': $player = wp_audio_shortcode( $params ); break; |
|
710 | + switch ( $type ) { |
|
711 | + case 'audio': $player = wp_audio_shortcode ( $params ); break; |
|
712 | 712 | case 'video': |
713 | 713 | // Use featured image as video poster |
714 | - if( $episode_id && has_post_thumbnail( $episode_id ) ) { |
|
715 | - $poster = wp_get_attachment_url( get_post_thumbnail_id( $episode_id ) ); |
|
716 | - if( $poster ) { |
|
717 | - $params['poster'] = $poster; |
|
714 | + if ( $episode_id && has_post_thumbnail ( $episode_id ) ) { |
|
715 | + $poster = wp_get_attachment_url ( get_post_thumbnail_id ( $episode_id ) ); |
|
716 | + if ( $poster ) { |
|
717 | + $params[ 'poster' ] = $poster; |
|
718 | 718 | } |
719 | 719 | } |
720 | - $player = wp_video_shortcode( $params ); |
|
720 | + $player = wp_video_shortcode ( $params ); |
|
721 | 721 | break; |
722 | 722 | } |
723 | 723 | |
724 | 724 | // Allow filtering so that alternative players can be used |
725 | - $player = apply_filters( 'ssp_media_player', $player, $src, $episode_id ); |
|
725 | + $player = apply_filters ( 'ssp_media_player', $player, $src, $episode_id ); |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | return $player; |
@@ -737,17 +737,17 @@ discard block |
||
737 | 737 | public function get_image( $id = 0, $size = 'full' ) { |
738 | 738 | $image = ''; |
739 | 739 | |
740 | - if ( has_post_thumbnail( $id ) ) { |
|
740 | + if ( has_post_thumbnail ( $id ) ) { |
|
741 | 741 | // If not a string or an array, and not an integer, default to 200x9999. |
742 | - if ( is_int( $size ) || ( 0 < intval( $size ) ) ) { |
|
743 | - $size = array( intval( $size ), intval( $size ) ); |
|
744 | - } elseif ( ! is_string( $size ) && ! is_array( $size ) ) { |
|
742 | + if ( is_int ( $size ) || ( 0 < intval ( $size ) ) ) { |
|
743 | + $size = array( intval ( $size ), intval ( $size ) ); |
|
744 | + } elseif ( ! is_string ( $size ) && ! is_array ( $size ) ) { |
|
745 | 745 | $size = array( 200, 9999 ); |
746 | 746 | } |
747 | - $image = get_the_post_thumbnail( intval( $id ), $size ); |
|
747 | + $image = get_the_post_thumbnail ( intval ( $id ), $size ); |
|
748 | 748 | } |
749 | 749 | |
750 | - return apply_filters( 'ssp_episode_image', $image, $id ); |
|
750 | + return apply_filters ( 'ssp_episode_image', $image, $id ); |
|
751 | 751 | } |
752 | 752 | |
753 | 753 | /** |
@@ -762,29 +762,29 @@ discard block |
||
762 | 762 | 'series' => '' |
763 | 763 | ); |
764 | 764 | |
765 | - $args = apply_filters( 'ssp_get_podcast_args', wp_parse_args( $args, $defaults ) ); |
|
765 | + $args = apply_filters ( 'ssp_get_podcast_args', wp_parse_args ( $args, $defaults ) ); |
|
766 | 766 | |
767 | 767 | $query = array(); |
768 | 768 | |
769 | - if ( 'episodes' == $args['content'] ) { |
|
769 | + if ( 'episodes' == $args[ 'content' ] ) { |
|
770 | 770 | |
771 | 771 | // Get selected series |
772 | 772 | $podcast_series = ''; |
773 | - if ( isset( $args['series'] ) && $args['series'] ) { |
|
774 | - $podcast_series = $args['series']; |
|
773 | + if ( isset( $args[ 'series' ] ) && $args[ 'series' ] ) { |
|
774 | + $podcast_series = $args[ 'series' ]; |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | // Get query args |
778 | - $query_args = apply_filters( 'ssp_get_podcast_query_args', ssp_episodes( -1, $podcast_series, true, '' ) ); |
|
778 | + $query_args = apply_filters ( 'ssp_get_podcast_query_args', ssp_episodes ( -1, $podcast_series, true, '' ) ); |
|
779 | 779 | |
780 | 780 | // The Query |
781 | - $query = get_posts( $query_args ); |
|
781 | + $query = get_posts ( $query_args ); |
|
782 | 782 | |
783 | 783 | // The Display |
784 | - if ( ! is_wp_error( $query ) && is_array( $query ) && count( $query ) > 0 ) { |
|
784 | + if ( ! is_wp_error ( $query ) && is_array ( $query ) && count ( $query ) > 0 ) { |
|
785 | 785 | foreach ( $query as $k => $v ) { |
786 | 786 | // Get the URL |
787 | - $query[$k]->url = get_permalink( $v->ID ); |
|
787 | + $query[ $k ]->url = get_permalink ( $v->ID ); |
|
788 | 788 | } |
789 | 789 | } else { |
790 | 790 | $query = false; |
@@ -792,27 +792,27 @@ discard block |
||
792 | 792 | |
793 | 793 | } else { |
794 | 794 | |
795 | - $terms = get_terms( 'series' ); |
|
795 | + $terms = get_terms ( 'series' ); |
|
796 | 796 | |
797 | - if ( count( $terms ) > 0) { |
|
797 | + if ( count ( $terms ) > 0 ) { |
|
798 | 798 | |
799 | 799 | foreach ( $terms as $term ) { |
800 | - $query[ $term->term_id ] = new stdClass(); |
|
800 | + $query[ $term->term_id ] = new stdClass (); |
|
801 | 801 | $query[ $term->term_id ]->title = $term->name; |
802 | - $query[ $term->term_id ]->url = get_term_link( $term ); |
|
802 | + $query[ $term->term_id ]->url = get_term_link ( $term ); |
|
803 | 803 | |
804 | - $query_args = apply_filters( 'ssp_get_podcast_series_query_args', ssp_episodes( -1, $term->slug, true, '' ) ); |
|
804 | + $query_args = apply_filters ( 'ssp_get_podcast_series_query_args', ssp_episodes ( -1, $term->slug, true, '' ) ); |
|
805 | 805 | |
806 | - $posts = get_posts( $query_args ); |
|
806 | + $posts = get_posts ( $query_args ); |
|
807 | 807 | |
808 | - $count = count( $posts ); |
|
808 | + $count = count ( $posts ); |
|
809 | 809 | $query[ $term->term_id ]->count = $count; |
810 | 810 | } |
811 | 811 | } |
812 | 812 | |
813 | 813 | } |
814 | 814 | |
815 | - $query['content'] = $args['content']; |
|
815 | + $query[ 'content' ] = $args[ 'content' ]; |
|
816 | 816 | |
817 | 817 | return $query; |
818 | 818 | } |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | public function get_enclosure( $episode_id = 0 ) { |
826 | 826 | |
827 | 827 | if ( $episode_id ) { |
828 | - return apply_filters( 'ssp_episode_enclosure', get_post_meta( $episode_id, 'audio_file', true ), $episode_id ); |
|
828 | + return apply_filters ( 'ssp_episode_enclosure', get_post_meta ( $episode_id, 'audio_file', true ), $episode_id ); |
|
829 | 829 | } |
830 | 830 | |
831 | 831 | return ''; |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | |
844 | 844 | if ( $file != '' ) { |
845 | 845 | |
846 | - $post_types = ssp_post_types( true ); |
|
846 | + $post_types = ssp_post_types ( true ); |
|
847 | 847 | |
848 | 848 | $args = array( |
849 | 849 | 'post_type' => $post_types, |
@@ -853,17 +853,17 @@ discard block |
||
853 | 853 | 'meta_value' => $file |
854 | 854 | ); |
855 | 855 | |
856 | - $qry = new WP_Query( $args ); |
|
856 | + $qry = new WP_Query ( $args ); |
|
857 | 857 | |
858 | - if ( $qry->have_posts() ) { |
|
859 | - while ( $qry->have_posts() ) { $qry->the_post(); |
|
858 | + if ( $qry->have_posts () ) { |
|
859 | + while ( $qry->have_posts () ) { $qry->the_post (); |
|
860 | 860 | $episode = $post; |
861 | 861 | break; |
862 | 862 | } |
863 | 863 | } |
864 | 864 | } |
865 | 865 | |
866 | - return apply_filters( 'ssp_episode_from_file', $episode, $file ); |
|
866 | + return apply_filters ( 'ssp_episode_from_file', $episode, $file ); |
|
867 | 867 | |
868 | 868 | } |
869 | 869 | |
@@ -873,33 +873,33 @@ discard block |
||
873 | 873 | */ |
874 | 874 | public function download_file() { |
875 | 875 | |
876 | - if ( is_podcast_download() ) { |
|
876 | + if ( is_podcast_download () ) { |
|
877 | 877 | global $wp_query; |
878 | 878 | |
879 | 879 | // Get requested episode ID |
880 | - $episode_id = intval( $wp_query->query_vars['podcast_episode'] ); |
|
880 | + $episode_id = intval ( $wp_query->query_vars[ 'podcast_episode' ] ); |
|
881 | 881 | |
882 | 882 | if ( isset( $episode_id ) && $episode_id ) { |
883 | 883 | |
884 | 884 | // Get episode post object |
885 | - $episode = get_post( $episode_id ); |
|
885 | + $episode = get_post ( $episode_id ); |
|
886 | 886 | |
887 | 887 | // Make sure we have a valid episode post object |
888 | - if ( ! $episode || ! is_object( $episode ) || is_wp_error( $episode ) || ! isset( $episode->ID ) ) { |
|
888 | + if ( ! $episode || ! is_object ( $episode ) || is_wp_error ( $episode ) || ! isset( $episode->ID ) ) { |
|
889 | 889 | return; |
890 | 890 | } |
891 | 891 | |
892 | 892 | // Do we have newlines? |
893 | 893 | $parts = false; |
894 | - if( is_string( $episode ) ) { |
|
895 | - $parts = explode( "\n", $episode ); |
|
894 | + if ( is_string ( $episode ) ) { |
|
895 | + $parts = explode ( "\n", $episode ); |
|
896 | 896 | } |
897 | 897 | |
898 | - if ( $parts && is_array( $parts ) && count( $parts ) > 1 ) { |
|
899 | - $file = $parts[0]; |
|
898 | + if ( $parts && is_array ( $parts ) && count ( $parts ) > 1 ) { |
|
899 | + $file = $parts[ 0 ]; |
|
900 | 900 | } else { |
901 | 901 | // Get audio file for download |
902 | - $file = $this->get_enclosure( $episode_id ); |
|
902 | + $file = $this->get_enclosure ( $episode_id ); |
|
903 | 903 | } |
904 | 904 | |
905 | 905 | // Exit if no file is found |
@@ -909,77 +909,77 @@ discard block |
||
909 | 909 | |
910 | 910 | // Get file referrer |
911 | 911 | $referrer = ''; |
912 | - if( isset( $wp_query->query_vars['podcast_ref'] ) && $wp_query->query_vars['podcast_ref'] ) { |
|
913 | - $referrer = $wp_query->query_vars['podcast_ref']; |
|
912 | + if ( isset( $wp_query->query_vars[ 'podcast_ref' ] ) && $wp_query->query_vars[ 'podcast_ref' ] ) { |
|
913 | + $referrer = $wp_query->query_vars[ 'podcast_ref' ]; |
|
914 | 914 | } else { |
915 | - if( isset( $_GET['ref'] ) ) { |
|
916 | - $referrer = esc_attr( $_GET['ref'] ); |
|
915 | + if ( isset( $_GET[ 'ref' ] ) ) { |
|
916 | + $referrer = esc_attr ( $_GET[ 'ref' ] ); |
|
917 | 917 | } |
918 | 918 | } |
919 | 919 | |
920 | 920 | // Allow other actions - functions hooked on here must not output any data |
921 | - do_action( 'ssp_file_download', $file, $episode, $referrer ); |
|
921 | + do_action ( 'ssp_file_download', $file, $episode, $referrer ); |
|
922 | 922 | |
923 | 923 | // Set necessary headers |
924 | - header( "Pragma: no-cache" ); |
|
925 | - header( "Expires: 0" ); |
|
926 | - header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); |
|
927 | - header( "Robots: none" ); |
|
924 | + header ( "Pragma: no-cache" ); |
|
925 | + header ( "Expires: 0" ); |
|
926 | + header ( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); |
|
927 | + header ( "Robots: none" ); |
|
928 | 928 | |
929 | 929 | // Check file referrer |
930 | - if( 'download' == $referrer ) { |
|
930 | + if ( 'download' == $referrer ) { |
|
931 | 931 | |
932 | 932 | // Set size of file |
933 | 933 | // Do we have anything in Cache/DB? |
934 | - $size = wp_cache_get( $episode_id, 'filesize_raw' ); |
|
934 | + $size = wp_cache_get ( $episode_id, 'filesize_raw' ); |
|
935 | 935 | |
936 | 936 | // Nothing in the cache, let's see if we can figure it out. |
937 | 937 | if ( false === $size ) { |
938 | 938 | |
939 | 939 | // Do we have anything in post_meta? |
940 | - $size = get_post_meta( $episode_id, 'filesize_raw', true ); |
|
940 | + $size = get_post_meta ( $episode_id, 'filesize_raw', true ); |
|
941 | 941 | |
942 | 942 | if ( empty( $size ) ) { |
943 | 943 | |
944 | 944 | // Let's see if we can figure out the path... |
945 | - $attachment_id = $this->get_attachment_id_from_url( $file ); |
|
945 | + $attachment_id = $this->get_attachment_id_from_url ( $file ); |
|
946 | 946 | |
947 | - if ( ! empty( $attachment_id ) ) { |
|
948 | - $size = filesize( get_attached_file( $attachment_id ) ); |
|
949 | - update_post_meta( $episode_id, 'filesize_raw', $size ); |
|
947 | + if ( ! empty( $attachment_id ) ) { |
|
948 | + $size = filesize ( get_attached_file ( $attachment_id ) ); |
|
949 | + update_post_meta ( $episode_id, 'filesize_raw', $size ); |
|
950 | 950 | } |
951 | 951 | |
952 | 952 | } |
953 | 953 | |
954 | 954 | // Update the cache |
955 | - wp_cache_set( $episode_id, $size, 'filesize_raw' ); |
|
955 | + wp_cache_set ( $episode_id, $size, 'filesize_raw' ); |
|
956 | 956 | } |
957 | 957 | |
958 | 958 | // Send Content-Length header |
959 | 959 | if ( ! empty( $size ) ) { |
960 | - header( "Content-Length: " . $size ); |
|
960 | + header ( "Content-Length: ".$size ); |
|
961 | 961 | } |
962 | 962 | |
963 | 963 | // Force file download |
964 | - header( "Content-Type: application/force-download" ); |
|
964 | + header ( "Content-Type: application/force-download" ); |
|
965 | 965 | |
966 | 966 | // Set other relevant headers |
967 | - header( "Content-Description: File Transfer" ); |
|
968 | - header( "Content-Disposition: attachment; filename=\"" . basename( $file ) . "\";" ); |
|
969 | - header( "Content-Transfer-Encoding: binary" ); |
|
967 | + header ( "Content-Description: File Transfer" ); |
|
968 | + header ( "Content-Disposition: attachment; filename=\"".basename ( $file )."\";" ); |
|
969 | + header ( "Content-Transfer-Encoding: binary" ); |
|
970 | 970 | |
971 | 971 | // Encode spaces in file names until this is fixed in core (https://core.trac.wordpress.org/ticket/36998) |
972 | - $file = str_replace( ' ', '%20', $file ); |
|
972 | + $file = str_replace ( ' ', '%20', $file ); |
|
973 | 973 | |
974 | 974 | // Use ssp_readfile_chunked() if allowed on the server or simply access file directly |
975 | - @ssp_readfile_chunked( $file ) or header( 'Location: ' . $file ); |
|
975 | + @ssp_readfile_chunked ( $file ) or header ( 'Location: '.$file ); |
|
976 | 976 | } else { |
977 | 977 | |
978 | 978 | // Encode spaces in file names until this is fixed in core (https://core.trac.wordpress.org/ticket/36998) |
979 | - $file = str_replace( ' ', '%20', $file ); |
|
979 | + $file = str_replace ( ' ', '%20', $file ); |
|
980 | 980 | |
981 | 981 | // For all other referrers redirect to the raw file |
982 | - wp_redirect( $file, 302 ); |
|
982 | + wp_redirect ( $file, 302 ); |
|
983 | 983 | } |
984 | 984 | |
985 | 985 | // Exit to prevent other processes running later on |
@@ -996,16 +996,16 @@ discard block |
||
996 | 996 | public function generator_tag( $gen, $type ) { |
997 | 997 | |
998 | 998 | // Allow generator tags to be hidden if necessary |
999 | - if ( apply_filters( 'ssp_show_generator_tag', true, $type ) ) { |
|
999 | + if ( apply_filters ( 'ssp_show_generator_tag', true, $type ) ) { |
|
1000 | 1000 | |
1001 | - $generator = 'Seriously Simple Podcasting ' . esc_attr( $this->version ); |
|
1001 | + $generator = 'Seriously Simple Podcasting '.esc_attr ( $this->version ); |
|
1002 | 1002 | |
1003 | 1003 | switch ( $type ) { |
1004 | 1004 | case 'html': |
1005 | - $gen .= "\n" . '<meta name="generator" content="' . $generator . '">'; |
|
1005 | + $gen .= "\n".'<meta name="generator" content="'.$generator.'">'; |
|
1006 | 1006 | break; |
1007 | 1007 | case 'xhtml': |
1008 | - $gen .= "\n" . '<meta name="generator" content="' . $generator . '" />'; |
|
1008 | + $gen .= "\n".'<meta name="generator" content="'.$generator.'" />'; |
|
1009 | 1009 | break; |
1010 | 1010 | } |
1011 | 1011 | |
@@ -1021,53 +1021,53 @@ discard block |
||
1021 | 1021 | public function rss_meta_tag() { |
1022 | 1022 | |
1023 | 1023 | // Get feed slug |
1024 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
1024 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
1025 | 1025 | |
1026 | - if ( get_option( 'permalink_structure' ) ) { |
|
1027 | - $feed_url = $this->home_url . 'feed/' . $feed_slug; |
|
1026 | + if ( get_option ( 'permalink_structure' ) ) { |
|
1027 | + $feed_url = $this->home_url.'feed/'.$feed_slug; |
|
1028 | 1028 | } else { |
1029 | - $feed_url = $this->home_url . '?feed=' . $feed_slug; |
|
1029 | + $feed_url = $this->home_url.'?feed='.$feed_slug; |
|
1030 | 1030 | } |
1031 | 1031 | |
1032 | - $custom_feed_url = get_option( 'ss_podcasting_feed_url' ); |
|
1032 | + $custom_feed_url = get_option ( 'ss_podcasting_feed_url' ); |
|
1033 | 1033 | if ( $custom_feed_url ) { |
1034 | 1034 | $feed_url = $custom_feed_url; |
1035 | 1035 | } |
1036 | 1036 | |
1037 | - $feed_url = apply_filters( 'ssp_feed_url', $feed_url ); |
|
1037 | + $feed_url = apply_filters ( 'ssp_feed_url', $feed_url ); |
|
1038 | 1038 | |
1039 | 1039 | $html = ''; |
1040 | 1040 | |
1041 | - if( apply_filters( 'ssp_show_global_feed_tag', true ) ) { |
|
1042 | - $html = '<link rel="alternate" type="application/rss+xml" title="' . __( 'Podcast RSS feed', 'seriously-simple-podcasting' ) . '" href="' . esc_url( $feed_url ) . '" />'; |
|
1041 | + if ( apply_filters ( 'ssp_show_global_feed_tag', true ) ) { |
|
1042 | + $html = '<link rel="alternate" type="application/rss+xml" title="'.__ ( 'Podcast RSS feed', 'seriously-simple-podcasting' ).'" href="'.esc_url ( $feed_url ).'" />'; |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | 1045 | // Check if this is a series taxonomy archive and display series-specific RSS feed tag |
1046 | - $current_obj = get_queried_object(); |
|
1047 | - if( isset( $current_obj->taxonomy ) && 'series' == $current_obj->taxonomy && isset( $current_obj->slug ) && $current_obj->slug ) { |
|
1046 | + $current_obj = get_queried_object (); |
|
1047 | + if ( isset( $current_obj->taxonomy ) && 'series' == $current_obj->taxonomy && isset( $current_obj->slug ) && $current_obj->slug ) { |
|
1048 | 1048 | |
1049 | - if( apply_filters( 'ssp_show_series_feed_tag', true, $current_obj->slug ) ) { |
|
1049 | + if ( apply_filters ( 'ssp_show_series_feed_tag', true, $current_obj->slug ) ) { |
|
1050 | 1050 | |
1051 | - if ( get_option( 'permalink_structure' ) ) { |
|
1052 | - $series_feed_url = $feed_url . '/' . $current_obj->slug; |
|
1051 | + if ( get_option ( 'permalink_structure' ) ) { |
|
1052 | + $series_feed_url = $feed_url.'/'.$current_obj->slug; |
|
1053 | 1053 | } else { |
1054 | - $series_feed_url = $feed_url . '&podcast_series=' . $current_obj->slug; |
|
1054 | + $series_feed_url = $feed_url.'&podcast_series='.$current_obj->slug; |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | - $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 | + $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 ).'" />'; |
|
1058 | 1058 | |
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | } |
1062 | 1062 | |
1063 | - echo "\n" . apply_filters( 'ssp_rss_meta_tag', $html ) . "\n\n"; |
|
1063 | + echo "\n".apply_filters ( 'ssp_rss_meta_tag', $html )."\n\n"; |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | /** |
1067 | 1067 | * Register plugin widgets |
1068 | 1068 | * @return void |
1069 | 1069 | */ |
1070 | - public function register_widgets () { |
|
1070 | + public function register_widgets() { |
|
1071 | 1071 | |
1072 | 1072 | $widgets = array( |
1073 | 1073 | 'recent-episodes' => 'Recent_Episodes', |
@@ -1076,8 +1076,8 @@ discard block |
||
1076 | 1076 | ); |
1077 | 1077 | |
1078 | 1078 | foreach ( $widgets as $id => $name ) { |
1079 | - require_once( $this->dir . '/includes/widgets/class-ssp-widget-' . $id . '.php' ); |
|
1080 | - register_widget( 'SSP_Widget_' . $name ); |
|
1079 | + require_once( $this->dir.'/includes/widgets/class-ssp-widget-'.$id.'.php' ); |
|
1080 | + register_widget ( 'SSP_Widget_'.$name ); |
|
1081 | 1081 | } |
1082 | 1082 | |
1083 | 1083 | } |
@@ -1087,25 +1087,25 @@ discard block |
||
1087 | 1087 | * @param array $params Shortcode paramaters |
1088 | 1088 | * @return string HTML output |
1089 | 1089 | */ |
1090 | - public function podcast_episode_shortcode ( $params ) { |
|
1090 | + public function podcast_episode_shortcode( $params ) { |
|
1091 | 1091 | |
1092 | - $atts = shortcode_atts( array( |
|
1092 | + $atts = shortcode_atts ( array( |
|
1093 | 1093 | 'episode' => 0, |
1094 | 1094 | 'content' => 'title,player,details', |
1095 | 1095 | ), $params ); |
1096 | 1096 | |
1097 | - extract( $atts ); |
|
1097 | + extract ( $atts ); |
|
1098 | 1098 | |
1099 | 1099 | if ( ! $episode ) { |
1100 | 1100 | return; |
1101 | 1101 | } |
1102 | 1102 | |
1103 | 1103 | // Setup array of content items and trim whitespace |
1104 | - $content_items = explode( ',', $content ); |
|
1105 | - $content_items = array_map( 'trim', $content_items ); |
|
1104 | + $content_items = explode ( ',', $content ); |
|
1105 | + $content_items = array_map ( 'trim', $content_items ); |
|
1106 | 1106 | |
1107 | 1107 | // Get episode for display |
1108 | - $html = $this->podcast_episode( $episode, $content_items, 'shortcode' ); |
|
1108 | + $html = $this->podcast_episode ( $episode, $content_items, 'shortcode' ); |
|
1109 | 1109 | |
1110 | 1110 | return $html; |
1111 | 1111 | |
@@ -1117,64 +1117,64 @@ discard block |
||
1117 | 1117 | * @param array $content_items Orderd array of content items to display |
1118 | 1118 | * @return string HTML of episode with specified content items |
1119 | 1119 | */ |
1120 | - public function podcast_episode ( $episode_id = 0, $content_items = array( 'title', 'player', 'details' ), $context = '' ) { |
|
1120 | + public function podcast_episode( $episode_id = 0, $content_items = array( 'title', 'player', 'details' ), $context = '' ) { |
|
1121 | 1121 | global $post, $episode_context; |
1122 | 1122 | |
1123 | - if ( ! $episode_id || ! is_array( $content_items ) || empty( $content_items ) ) { |
|
1123 | + if ( ! $episode_id || ! is_array ( $content_items ) || empty( $content_items ) ) { |
|
1124 | 1124 | return; |
1125 | 1125 | } |
1126 | 1126 | |
1127 | 1127 | // Get episode object |
1128 | - $episode = get_post( $episode_id ); |
|
1128 | + $episode = get_post ( $episode_id ); |
|
1129 | 1129 | |
1130 | - if ( ! $episode || is_wp_error( $episode ) ) { |
|
1130 | + if ( ! $episode || is_wp_error ( $episode ) ) { |
|
1131 | 1131 | return; |
1132 | 1132 | } |
1133 | 1133 | |
1134 | - $html = '<div class="podcast-episode episode-' . esc_attr( $episode_id ) . '">' . "\n"; |
|
1134 | + $html = '<div class="podcast-episode episode-'.esc_attr ( $episode_id ).'">'."\n"; |
|
1135 | 1135 | |
1136 | 1136 | // Setup post data for episode post object |
1137 | 1137 | $post = $episode; |
1138 | - setup_postdata( $post ); |
|
1138 | + setup_postdata ( $post ); |
|
1139 | 1139 | |
1140 | 1140 | $episode_context = $context; |
1141 | 1141 | |
1142 | 1142 | // Display specified content items in the order supplied |
1143 | 1143 | foreach ( $content_items as $item ) { |
1144 | 1144 | |
1145 | - switch( $item ) { |
|
1145 | + switch ( $item ) { |
|
1146 | 1146 | |
1147 | 1147 | case 'title': |
1148 | - $html .= '<h3 class="episode-title">' . get_the_title() . '</h3>' . "\n"; |
|
1148 | + $html .= '<h3 class="episode-title">'.get_the_title ().'</h3>'."\n"; |
|
1149 | 1149 | break; |
1150 | 1150 | |
1151 | 1151 | case 'excerpt': |
1152 | - $html .= '<p class="episode-excerpt">' . get_the_excerpt() . '</p>' . "\n"; |
|
1152 | + $html .= '<p class="episode-excerpt">'.get_the_excerpt ().'</p>'."\n"; |
|
1153 | 1153 | break; |
1154 | 1154 | |
1155 | 1155 | case 'content': |
1156 | - $html .= '<div class="episode-content">' . apply_filters( 'the_content', get_the_content() ) . '</div>' . "\n"; |
|
1156 | + $html .= '<div class="episode-content">'.apply_filters ( 'the_content', get_the_content () ).'</div>'."\n"; |
|
1157 | 1157 | break; |
1158 | 1158 | |
1159 | 1159 | case 'player': |
1160 | - $file = $this->get_enclosure( $episode_id ); |
|
1161 | - if ( get_option( 'permalink_structure' ) ) { |
|
1162 | - $file = $this->get_episode_download_link( $episode_id ); |
|
1160 | + $file = $this->get_enclosure ( $episode_id ); |
|
1161 | + if ( get_option ( 'permalink_structure' ) ) { |
|
1162 | + $file = $this->get_episode_download_link ( $episode_id ); |
|
1163 | 1163 | } |
1164 | - $html .= '<div class="podcast_player">' . $this->media_player( $file, $episode_id ) . '</div>' . "\n"; |
|
1164 | + $html .= '<div class="podcast_player">'.$this->media_player ( $file, $episode_id ).'</div>'."\n"; |
|
1165 | 1165 | break; |
1166 | 1166 | |
1167 | 1167 | case 'details': |
1168 | - $html .= $this->episode_meta_details( $episode_id, $episode_context ); |
|
1168 | + $html .= $this->episode_meta_details ( $episode_id, $episode_context ); |
|
1169 | 1169 | break; |
1170 | 1170 | |
1171 | 1171 | } |
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | // Reset post data after fetching episode details |
1175 | - wp_reset_postdata(); |
|
1175 | + wp_reset_postdata (); |
|
1176 | 1176 | |
1177 | - $html .= '</div>' . "\n"; |
|
1177 | + $html .= '</div>'."\n"; |
|
1178 | 1178 | |
1179 | 1179 | return $html; |
1180 | 1180 | } |
@@ -1189,26 +1189,26 @@ discard block |
||
1189 | 1189 | function get_local_file_path( $file ) { |
1190 | 1190 | |
1191 | 1191 | // Identify file by root path and not URL (required for getID3 class) |
1192 | - $site_root = trailingslashit( ABSPATH ); |
|
1192 | + $site_root = trailingslashit ( ABSPATH ); |
|
1193 | 1193 | |
1194 | 1194 | // Remove common dirs from the ends of site_url and site_root, so that file can be outside of the WordPress installation |
1195 | - $root_chunks = explode( '/', $site_root ); |
|
1196 | - $url_chunks = explode( '/', $this->site_url ); |
|
1195 | + $root_chunks = explode ( '/', $site_root ); |
|
1196 | + $url_chunks = explode ( '/', $this->site_url ); |
|
1197 | 1197 | |
1198 | - end( $root_chunks ); |
|
1199 | - end( $url_chunks ); |
|
1198 | + end ( $root_chunks ); |
|
1199 | + end ( $url_chunks ); |
|
1200 | 1200 | |
1201 | - while ( ! is_null( key( $root_chunks ) ) && ! is_null( key( $url_chunks ) ) && ( current( $root_chunks ) == current( $url_chunks ) ) ) { |
|
1202 | - array_pop( $root_chunks ); |
|
1203 | - array_pop( $url_chunks ); |
|
1204 | - end( $root_chunks ); |
|
1205 | - end( $url_chunks ); |
|
1201 | + while ( ! is_null ( key ( $root_chunks ) ) && ! is_null ( key ( $url_chunks ) ) && ( current ( $root_chunks ) == current ( $url_chunks ) ) ) { |
|
1202 | + array_pop ( $root_chunks ); |
|
1203 | + array_pop ( $url_chunks ); |
|
1204 | + end ( $root_chunks ); |
|
1205 | + end ( $url_chunks ); |
|
1206 | 1206 | } |
1207 | 1207 | |
1208 | - $site_root = implode('/', $root_chunks); |
|
1209 | - $site_url = implode('/', $url_chunks); |
|
1208 | + $site_root = implode ( '/', $root_chunks ); |
|
1209 | + $site_url = implode ( '/', $url_chunks ); |
|
1210 | 1210 | |
1211 | - $file = str_replace( $site_url, $site_root, $file ); |
|
1211 | + $file = str_replace ( $site_url, $site_root, $file ); |
|
1212 | 1212 | |
1213 | 1213 | return $file; |
1214 | 1214 | } |
@@ -1220,16 +1220,16 @@ discard block |
||
1220 | 1220 | * @param string $type Type of feed |
1221 | 1221 | * @return string Updated content type |
1222 | 1222 | */ |
1223 | - public function feed_content_type ( $content_type = '', $type = '' ) { |
|
1223 | + public function feed_content_type( $content_type = '', $type = '' ) { |
|
1224 | 1224 | |
1225 | - if( 'podcast' == $type ) { |
|
1225 | + if ( 'podcast' == $type ) { |
|
1226 | 1226 | $content_type = 'text/xml'; |
1227 | 1227 | } |
1228 | 1228 | |
1229 | 1229 | return $content_type; |
1230 | 1230 | } |
1231 | 1231 | |
1232 | - public function load_localisation () { |
|
1233 | - load_plugin_textdomain( 'seriously-simple-podcasting', false, basename( dirname( $this->file ) ) . '/languages/' ); |
|
1232 | + public function load_localisation() { |
|
1233 | + load_plugin_textdomain ( 'seriously-simple-podcasting', false, basename ( dirname ( $this->file ) ).'/languages/' ); |
|
1234 | 1234 | } |
1235 | 1235 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if accessed directly. |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined ( 'ABSPATH' ) ) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | require_once( 'includes/class-ssp-frontend.php' ); |
23 | 23 | |
24 | 24 | global $ssp_admin, $ss_podcasting; |
25 | -$ssp_admin = new SSP_Admin( __FILE__, '1.14.8' ); |
|
26 | -$ss_podcasting = new SSP_Frontend( __FILE__, '1.14.8' ); |
|
25 | +$ssp_admin = new SSP_Admin ( __FILE__, '1.14.8' ); |
|
26 | +$ss_podcasting = new SSP_Frontend ( __FILE__, '1.14.8' ); |
|
27 | 27 | |
28 | -if ( is_admin() ) { |
|
28 | +if ( is_admin () ) { |
|
29 | 29 | global $ssp_settings; |
30 | 30 | require_once( 'includes/class-ssp-settings.php' ); |
31 | - $ssp_settings = new SSP_Settings( __FILE__ ); |
|
31 | + $ssp_settings = new SSP_Settings ( __FILE__ ); |
|
32 | 32 | } |
33 | 33 | \ No newline at end of file |