@@ -658,7 +658,7 @@ |
||
658 | 658 | /** |
659 | 659 | * Adding podcast episodes to 'At a glance' dashboard widget |
660 | 660 | * @param array $items Existing items |
661 | - * @return array Updated items |
|
661 | + * @return string[] Updated items |
|
662 | 662 | */ |
663 | 663 | public function glance_items( $items = array() ) { |
664 | 664 |
@@ -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,82 +439,82 @@ 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 ) ) { |
|
448 | + if ( 0 < count ( $field_data ) ) { |
|
449 | 449 | |
450 | - $html .= '<input id="seriouslysimple_post_id" type="hidden" value="'. $post_id . '" />'; |
|
450 | + $html .= '<input id="seriouslysimple_post_id" type="hidden" value="'.$post_id.'" />'; |
|
451 | 451 | |
452 | 452 | foreach ( $field_data as $k => $v ) { |
453 | - $data = $v['default']; |
|
454 | - $saved = get_post_meta( $post_id, $k, true ); |
|
453 | + $data = $v[ 'default' ]; |
|
454 | + $saved = get_post_meta ( $post_id, $k, true ); |
|
455 | 455 | if ( $saved ) { |
456 | 456 | $data = $saved; |
457 | 457 | } |
458 | 458 | |
459 | 459 | $class = ''; |
460 | - if ( isset( $v['class'] ) ) { |
|
461 | - $class = $v['class']; |
|
460 | + if ( isset( $v[ 'class' ] ) ) { |
|
461 | + $class = $v[ 'class' ]; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | $disabled = false; |
465 | - if ( isset( $v['disabled'] ) && $v['disabled'] ) { |
|
465 | + if ( isset( $v[ 'disabled' ] ) && $v[ 'disabled' ] ) { |
|
466 | 466 | $disabled = true; |
467 | 467 | } |
468 | 468 | |
469 | - switch( $v['type'] ) { |
|
469 | + switch ( $v[ 'type' ] ) { |
|
470 | 470 | case 'file': |
471 | 471 | $html .= '<p> |
472 | - <label class="ssp-episode-details-label" for="' . esc_attr( $k ) . '">' . $v['name'] . '</label> |
|
472 | + <label class="ssp-episode-details-label" for="' . esc_attr ( $k ).'">'.$v[ 'name' ].'</label> |
|
473 | 473 | <br/> |
474 | - <input name="' . esc_attr( $k ) . '" type="text" id="upload_' . esc_attr( $k ) . '" value="' . esc_attr( $data ) . '" /> |
|
475 | - <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' ) . '" /> |
|
474 | + <input name="' . esc_attr ( $k ).'" type="text" id="upload_'.esc_attr ( $k ).'" value="'.esc_attr ( $data ).'" /> |
|
475 | + <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' ).'" /> |
|
476 | 476 | <br/> |
477 | - <span class="description">' . $v['description'] . '</span> |
|
477 | + <span class="description">' . $v[ 'description' ].'</span> |
|
478 | 478 | </p>' . "\n"; |
479 | 479 | break; |
480 | 480 | |
481 | 481 | case 'checkbox': |
482 | - $html .= '<p><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>' . $v['description'] . '</span></label></p>' . "\n"; |
|
482 | + $html .= '<p><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>'.$v[ 'description' ].'</span></label></p>'."\n"; |
|
483 | 483 | break; |
484 | 484 | |
485 | 485 | case 'radio': |
486 | 486 | $html .= '<p> |
487 | - <span class="ssp-episode-details-label">' . $v['name'] . '</span><br/>'; |
|
488 | - foreach( $v['options'] as $option => $label ) { |
|
489 | - $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 ) . '" /> |
|
490 | - <label style="margin-right:10px;" for="' . esc_attr( $k ) . '_' . esc_attr( $option ) . '">' . esc_html( $label ) . '</label>' . "\n"; |
|
487 | + <span class="ssp-episode-details-label">' . $v[ 'name' ].'</span><br/>'; |
|
488 | + foreach ( $v[ 'options' ] as $option => $label ) { |
|
489 | + $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 ).'" /> |
|
490 | + <label style="margin-right:10px;" for="' . esc_attr ( $k ).'_'.esc_attr ( $option ).'">'.esc_html ( $label ).'</label>'."\n"; |
|
491 | 491 | } |
492 | - $html .= '<span class="description">' . $v['description'] . '</span> |
|
492 | + $html .= '<span class="description">'.$v[ 'description' ].'</span> |
|
493 | 493 | </p>' . "\n"; |
494 | 494 | break; |
495 | 495 | |
496 | 496 | case 'datepicker': |
497 | 497 | $display_date = ''; |
498 | - if( $data ) { |
|
499 | - $display_date = date( 'j F, Y', strtotime( $data ) ); |
|
498 | + if ( $data ) { |
|
499 | + $display_date = date ( 'j F, Y', strtotime ( $data ) ); |
|
500 | 500 | } |
501 | 501 | $html .= '<p class="hasDatepicker"> |
502 | - <label class="ssp-episode-details-label" for="' . esc_attr( $k ) . '_display">' . $v['name'] . '</label> |
|
502 | + <label class="ssp-episode-details-label" for="' . esc_attr ( $k ).'_display">'.$v[ 'name' ].'</label> |
|
503 | 503 | <br/> |
504 | - <input type="text" id="' . esc_attr( $k ) . '_display" class="ssp-datepicker ' . esc_attr( $class ) . '" value="' . esc_attr( $display_date ) . '" /> |
|
505 | - <input name="' . esc_attr( $k ) . '" id="' . esc_attr( $k ) . '" type="hidden" value="' . esc_attr( $data ) . '" /> |
|
504 | + <input type="text" id="' . esc_attr ( $k ).'_display" class="ssp-datepicker '.esc_attr ( $class ).'" value="'.esc_attr ( $display_date ).'" /> |
|
505 | + <input name="' . esc_attr ( $k ).'" id="'.esc_attr ( $k ).'" type="hidden" value="'.esc_attr ( $data ).'" /> |
|
506 | 506 | <br/> |
507 | - <span class="description">' . $v['description'] . '</span> |
|
507 | + <span class="description">' . $v[ 'description' ].'</span> |
|
508 | 508 | </p>' . "\n"; |
509 | 509 | break; |
510 | 510 | |
511 | 511 | default: |
512 | 512 | $html .= '<p> |
513 | - <label class="ssp-episode-details-label" for="' . esc_attr( $k ) . '">' . $v['name'] . '</label> |
|
513 | + <label class="ssp-episode-details-label" for="' . esc_attr ( $k ).'">'.$v[ 'name' ].'</label> |
|
514 | 514 | <br/> |
515 | - <input name="' . esc_attr( $k ) . '" type="text" id="' . esc_attr( $k ) . '" class="' . esc_attr( $class ) . '" value="' . esc_attr( $data ) . '" /> |
|
515 | + <input name="' . esc_attr ( $k ).'" type="text" id="'.esc_attr ( $k ).'" class="'.esc_attr ( $class ).'" value="'.esc_attr ( $data ).'" /> |
|
516 | 516 | <br/> |
517 | - <span class="description">' . $v['description'] . '</span> |
|
517 | + <span class="description">' . $v[ 'description' ].'</span> |
|
518 | 518 | </p>' . "\n"; |
519 | 519 | break; |
520 | 520 | } |
@@ -533,78 +533,78 @@ discard block |
||
533 | 533 | public function meta_box_save( $post_id ) { |
534 | 534 | global $ss_podcasting; |
535 | 535 | |
536 | - $podcast_post_types = ssp_post_types( true ); |
|
536 | + $podcast_post_types = ssp_post_types ( true ); |
|
537 | 537 | |
538 | 538 | // Post type check |
539 | - if ( ! in_array( get_post_type(), $podcast_post_types ) ) { |
|
539 | + if ( ! in_array ( get_post_type (), $podcast_post_types ) ) { |
|
540 | 540 | return false; |
541 | 541 | } |
542 | 542 | |
543 | 543 | // Security check |
544 | - 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 ) ) ) ) { |
|
544 | + 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 ) ) ) ) { |
|
545 | 545 | return $post_id; |
546 | 546 | } |
547 | 547 | |
548 | 548 | // User capability check |
549 | - if ( 'page' == $_POST['post_type'] ) { |
|
550 | - if ( ! current_user_can( 'edit_page', $post_id ) ) { |
|
549 | + if ( 'page' == $_POST[ 'post_type' ] ) { |
|
550 | + if ( ! current_user_can ( 'edit_page', $post_id ) ) { |
|
551 | 551 | return $post_id; |
552 | 552 | } |
553 | 553 | } else { |
554 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
554 | + if ( ! current_user_can ( 'edit_post', $post_id ) ) { |
|
555 | 555 | return $post_id; |
556 | 556 | } |
557 | 557 | } |
558 | 558 | |
559 | - $field_data = $this->custom_fields(); |
|
559 | + $field_data = $this->custom_fields (); |
|
560 | 560 | $enclosure = ''; |
561 | 561 | |
562 | 562 | foreach ( $field_data as $k => $field ) { |
563 | 563 | |
564 | - if( 'embed_code' == $k ) { |
|
564 | + if ( 'embed_code' == $k ) { |
|
565 | 565 | continue; |
566 | 566 | } |
567 | 567 | |
568 | 568 | $val = ''; |
569 | 569 | if ( isset( $_POST[ $k ] ) ) { |
570 | - $val = strip_tags( trim( $_POST[ $k ] ) ); |
|
570 | + $val = strip_tags ( trim ( $_POST[ $k ] ) ); |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | if ( $k == 'audio_file' ) { |
574 | 574 | $enclosure = $val; |
575 | 575 | } |
576 | 576 | |
577 | - update_post_meta( $post_id, $k, $val ); |
|
577 | + update_post_meta ( $post_id, $k, $val ); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | if ( $enclosure ) { |
581 | 581 | |
582 | 582 | // Get file duration |
583 | - if ( get_post_meta( $post_id, 'duration', true ) == '' ) { |
|
584 | - $duration = $ss_podcasting->get_file_duration( $enclosure ); |
|
583 | + if ( get_post_meta ( $post_id, 'duration', true ) == '' ) { |
|
584 | + $duration = $ss_podcasting->get_file_duration ( $enclosure ); |
|
585 | 585 | if ( $duration ) { |
586 | - update_post_meta( $post_id , 'duration' , $duration ); |
|
586 | + update_post_meta ( $post_id, 'duration', $duration ); |
|
587 | 587 | } |
588 | 588 | } |
589 | 589 | |
590 | 590 | // Get file size |
591 | - if ( get_post_meta( $post_id, 'filesize', true ) == '' ) { |
|
592 | - $filesize = $ss_podcasting->get_file_size( $enclosure ); |
|
591 | + if ( get_post_meta ( $post_id, 'filesize', true ) == '' ) { |
|
592 | + $filesize = $ss_podcasting->get_file_size ( $enclosure ); |
|
593 | 593 | if ( $filesize ) { |
594 | 594 | |
595 | - if ( isset( $filesize['formatted'] ) ) { |
|
596 | - update_post_meta( $post_id, 'filesize', $filesize['formatted'] ); |
|
595 | + if ( isset( $filesize[ 'formatted' ] ) ) { |
|
596 | + update_post_meta ( $post_id, 'filesize', $filesize[ 'formatted' ] ); |
|
597 | 597 | } |
598 | 598 | |
599 | - if ( isset( $filesize['raw'] ) ) { |
|
600 | - update_post_meta( $post_id, 'filesize_raw', $filesize['raw'] ); |
|
599 | + if ( isset( $filesize[ 'raw' ] ) ) { |
|
600 | + update_post_meta ( $post_id, 'filesize_raw', $filesize[ 'raw' ] ); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | } |
604 | 604 | } |
605 | 605 | |
606 | 606 | // Save podcast file to 'enclosure' meta field for standards-sake |
607 | - update_post_meta( $post_id, 'enclosure', $enclosure ); |
|
607 | + update_post_meta ( $post_id, 'enclosure', $enclosure ); |
|
608 | 608 | |
609 | 609 | } |
610 | 610 | |
@@ -618,65 +618,65 @@ discard block |
||
618 | 618 | global $pagenow; |
619 | 619 | $fields = array(); |
620 | 620 | |
621 | - $fields['episode_type'] = array( |
|
622 | - 'name' => __( 'Episode type:' , 'seriously-simple-podcasting' ), |
|
621 | + $fields[ 'episode_type' ] = array( |
|
622 | + 'name' => __ ( 'Episode type:', 'seriously-simple-podcasting' ), |
|
623 | 623 | 'description' => '', |
624 | 624 | 'type' => 'radio', |
625 | 625 | 'default' => 'audio', |
626 | - 'options' => array( 'audio' => __( 'Audio', 'seriously-simple-podcasting' ), 'video' => __( 'Video', 'seriously-simple-podcasting' ) ), |
|
626 | + 'options' => array( 'audio' => __ ( 'Audio', 'seriously-simple-podcasting' ), 'video' => __ ( 'Video', 'seriously-simple-podcasting' ) ), |
|
627 | 627 | 'section' => 'info', |
628 | 628 | ); |
629 | 629 | |
630 | 630 | // 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 |
631 | - $fields['audio_file'] = array( |
|
632 | - 'name' => __( 'Podcast file:' , 'seriously-simple-podcasting' ), |
|
633 | - 'description' => __( 'Upload the primary podcast file or paste the file URL here.' , 'seriously-simple-podcasting' ), |
|
631 | + $fields[ 'audio_file' ] = array( |
|
632 | + 'name' => __ ( 'Podcast file:', 'seriously-simple-podcasting' ), |
|
633 | + 'description' => __ ( 'Upload the primary podcast file or paste the file URL here.', 'seriously-simple-podcasting' ), |
|
634 | 634 | 'type' => 'file', |
635 | 635 | 'default' => '', |
636 | 636 | 'section' => 'info', |
637 | 637 | ); |
638 | 638 | |
639 | - $fields['duration'] = array( |
|
640 | - 'name' => __( 'Duration:' , 'seriously-simple-podcasting' ), |
|
641 | - 'description' => __( 'Duration of podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ), |
|
639 | + $fields[ 'duration' ] = array( |
|
640 | + 'name' => __ ( 'Duration:', 'seriously-simple-podcasting' ), |
|
641 | + 'description' => __ ( 'Duration of podcast file for display (calculated automatically if possible).', 'seriously-simple-podcasting' ), |
|
642 | 642 | 'type' => 'text', |
643 | 643 | 'default' => '', |
644 | 644 | 'section' => 'info', |
645 | 645 | ); |
646 | 646 | |
647 | - $fields['filesize'] = array( |
|
648 | - 'name' => __( 'File size:' , 'seriously-simple-podcasting' ), |
|
649 | - 'description' => __( 'Size of the podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ), |
|
647 | + $fields[ 'filesize' ] = array( |
|
648 | + 'name' => __ ( 'File size:', 'seriously-simple-podcasting' ), |
|
649 | + 'description' => __ ( 'Size of the podcast file for display (calculated automatically if possible).', 'seriously-simple-podcasting' ), |
|
650 | 650 | 'type' => 'text', |
651 | 651 | 'default' => '', |
652 | 652 | 'section' => 'info', |
653 | 653 | ); |
654 | 654 | |
655 | - $fields['date_recorded'] = array( |
|
656 | - 'name' => __( 'Date recorded:' , 'seriously-simple-podcasting' ), |
|
657 | - 'description' => __( 'The date on which this episode was recorded.' , 'seriously-simple-podcasting' ), |
|
655 | + $fields[ 'date_recorded' ] = array( |
|
656 | + 'name' => __ ( 'Date recorded:', 'seriously-simple-podcasting' ), |
|
657 | + 'description' => __ ( 'The date on which this episode was recorded.', 'seriously-simple-podcasting' ), |
|
658 | 658 | 'type' => 'datepicker', |
659 | 659 | 'default' => '', |
660 | 660 | 'section' => 'info', |
661 | 661 | ); |
662 | 662 | |
663 | - $fields['explicit'] = array( |
|
664 | - 'name' => __( 'Explicit:' , 'seriously-simple-podcasting' ), |
|
665 | - 'description' => __( 'Mark this episode as explicit.' , 'seriously-simple-podcasting' ), |
|
663 | + $fields[ 'explicit' ] = array( |
|
664 | + 'name' => __ ( 'Explicit:', 'seriously-simple-podcasting' ), |
|
665 | + 'description' => __ ( 'Mark this episode as explicit.', 'seriously-simple-podcasting' ), |
|
666 | 666 | 'type' => 'checkbox', |
667 | 667 | 'default' => '', |
668 | 668 | 'section' => 'info', |
669 | 669 | ); |
670 | 670 | |
671 | - $fields['block'] = array( |
|
672 | - 'name' => __( 'Block:' , 'seriously-simple-podcasting' ), |
|
673 | - 'description' => __( 'Block this episode from appearing in the iTunes & Google Play podcast libraries.' , 'seriously-simple-podcasting' ), |
|
671 | + $fields[ 'block' ] = array( |
|
672 | + 'name' => __ ( 'Block:', 'seriously-simple-podcasting' ), |
|
673 | + 'description' => __ ( 'Block this episode from appearing in the iTunes & Google Play podcast libraries.', 'seriously-simple-podcasting' ), |
|
674 | 674 | 'type' => 'checkbox', |
675 | 675 | 'default' => '', |
676 | 676 | 'section' => 'info', |
677 | 677 | ); |
678 | 678 | |
679 | - return apply_filters( 'ssp_episode_fields', $fields ); |
|
679 | + return apply_filters ( 'ssp_episode_fields', $fields ); |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | /** |
@@ -686,17 +686,17 @@ discard block |
||
686 | 686 | */ |
687 | 687 | public function glance_items( $items = array() ) { |
688 | 688 | |
689 | - $num_posts = count( ssp_episodes( -1, '', false, 'glance' ) ); |
|
689 | + $num_posts = count ( ssp_episodes ( -1, '', false, 'glance' ) ); |
|
690 | 690 | |
691 | - $post_type_object = get_post_type_object( $this->token ); |
|
691 | + $post_type_object = get_post_type_object ( $this->token ); |
|
692 | 692 | |
693 | - $text = _n( '%s Episode', '%s Episodes', $num_posts, 'seriously-simple-podcasting' ); |
|
694 | - $text = sprintf( $text, number_format_i18n( $num_posts ) ); |
|
693 | + $text = _n ( '%s Episode', '%s Episodes', $num_posts, 'seriously-simple-podcasting' ); |
|
694 | + $text = sprintf ( $text, number_format_i18n ( $num_posts ) ); |
|
695 | 695 | |
696 | - if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) { |
|
697 | - $items[] = sprintf( '<a class="%1$s-count" href="edit.php?post_type=%1$s">%2$s</a>', $this->token, $text ) . "\n"; |
|
696 | + if ( $post_type_object && current_user_can ( $post_type_object->cap->edit_posts ) ) { |
|
697 | + $items[ ] = sprintf ( '<a class="%1$s-count" href="edit.php?post_type=%1$s">%2$s</a>', $this->token, $text )."\n"; |
|
698 | 698 | } else { |
699 | - $items[] = sprintf( '<span class="%1$s-count">%2$s</span>', $this->token, $text ) . "\n"; |
|
699 | + $items[ ] = sprintf ( '<span class="%1$s-count">%2$s</span>', $this->token, $text )."\n"; |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | return $items; |
@@ -710,15 +710,15 @@ discard block |
||
710 | 710 | * @param string $status Plugin status |
711 | 711 | * @return array Modified plugin meta links |
712 | 712 | */ |
713 | - public function plugin_row_meta ( $plugin_meta = array(), $plugin_file = '', $plugin_data = array(), $status = '' ) { |
|
713 | + public function plugin_row_meta( $plugin_meta = array(), $plugin_file = '', $plugin_data = array(), $status = '' ) { |
|
714 | 714 | |
715 | - if ( ! isset( $plugin_data['slug'] ) || 'seriously-simple-podcasting' != $plugin_data['slug'] ) { |
|
715 | + if ( ! isset( $plugin_data[ 'slug' ] ) || 'seriously-simple-podcasting' != $plugin_data[ 'slug' ] ) { |
|
716 | 716 | return $plugin_meta; |
717 | 717 | } |
718 | 718 | |
719 | - $plugin_meta['docs'] = '<a href="http://www.seriouslysimplepodcasting.com/documentation/" target="_blank">' . __( 'Documentation', 'seriously-simple-podcasting' ) . '</a>'; |
|
720 | - $plugin_meta['addons'] = '<a href="http://www.seriouslysimplepodcasting.com/add-ons/" target="_blank">' . __( 'Add-ons', 'seriously-simple-podcasting' ) . '</a>'; |
|
721 | - $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>'; |
|
719 | + $plugin_meta[ 'docs' ] = '<a href="http://www.seriouslysimplepodcasting.com/documentation/" target="_blank">'.__ ( 'Documentation', 'seriously-simple-podcasting' ).'</a>'; |
|
720 | + $plugin_meta[ 'addons' ] = '<a href="http://www.seriouslysimplepodcasting.com/add-ons/" target="_blank">'.__ ( 'Add-ons', 'seriously-simple-podcasting' ).'</a>'; |
|
721 | + $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>'; |
|
722 | 722 | |
723 | 723 | return $plugin_meta; |
724 | 724 | } |
@@ -729,8 +729,8 @@ discard block |
||
729 | 729 | * @return string Modified text |
730 | 730 | */ |
731 | 731 | public function enter_title_here( $title ) { |
732 | - if ( get_post_type() == $this->token ) { |
|
733 | - $title = __( 'Enter episode title here', 'seriously-simple-podcasting' ); |
|
732 | + if ( get_post_type () == $this->token ) { |
|
733 | + $title = __ ( 'Enter episode title here', 'seriously-simple-podcasting' ); |
|
734 | 734 | } |
735 | 735 | return $title; |
736 | 736 | } |
@@ -740,11 +740,11 @@ discard block |
||
740 | 740 | * @return void |
741 | 741 | */ |
742 | 742 | public function enqueue_admin_styles() { |
743 | - wp_register_style( 'ssp-admin', esc_url( $this->assets_url . 'css/admin.css' ), array(), $this->version ); |
|
744 | - wp_enqueue_style( 'ssp-admin' ); |
|
743 | + wp_register_style ( 'ssp-admin', esc_url ( $this->assets_url.'css/admin.css' ), array(), $this->version ); |
|
744 | + wp_enqueue_style ( 'ssp-admin' ); |
|
745 | 745 | |
746 | 746 | // Datepicker |
747 | - wp_enqueue_style( 'jquery-ui-datepicker', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css' ); |
|
747 | + wp_enqueue_style ( 'jquery-ui-datepicker', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css' ); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | /** |
@@ -752,8 +752,8 @@ discard block |
||
752 | 752 | * @return void |
753 | 753 | */ |
754 | 754 | public function enqueue_admin_scripts() { |
755 | - 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 ); |
|
756 | - wp_enqueue_script( 'ssp-admin' ); |
|
755 | + 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 ); |
|
756 | + wp_enqueue_script ( 'ssp-admin' ); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | /** |
@@ -761,8 +761,8 @@ discard block |
||
761 | 761 | * @return void |
762 | 762 | */ |
763 | 763 | public function ensure_post_thumbnails_support() { |
764 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
765 | - add_theme_support( 'post-thumbnails' ); |
|
764 | + if ( ! current_theme_supports ( 'post-thumbnails' ) ) { |
|
765 | + add_theme_support ( 'post-thumbnails' ); |
|
766 | 766 | } |
767 | 767 | } |
768 | 768 | |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | * @return void |
772 | 772 | */ |
773 | 773 | public function load_localisation() { |
774 | - load_plugin_textdomain( 'seriously-simple-podcasting', false, dirname( plugin_basename( $this->file ) ) . '/lang/' ); |
|
774 | + load_plugin_textdomain ( 'seriously-simple-podcasting', false, dirname ( plugin_basename ( $this->file ) ).'/lang/' ); |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | /** |
@@ -781,10 +781,10 @@ discard block |
||
781 | 781 | public function load_plugin_textdomain() { |
782 | 782 | $domain = 'seriously-simple-podcasting'; |
783 | 783 | // The "plugin_locale" filter is also used in load_plugin_textdomain() |
784 | - $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); |
|
784 | + $locale = apply_filters ( 'plugin_locale', get_locale (), $domain ); |
|
785 | 785 | |
786 | - load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' ); |
|
787 | - load_plugin_textdomain( $domain, false, dirname( plugin_basename( $this->file ) ) . '/lang/' ); |
|
786 | + load_textdomain ( $domain, WP_LANG_DIR.'/'.$domain.'/'.$domain.'-'.$locale.'.mo' ); |
|
787 | + load_plugin_textdomain ( $domain, false, dirname ( plugin_basename ( $this->file ) ).'/lang/' ); |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | /** |
@@ -792,8 +792,8 @@ discard block |
||
792 | 792 | * @return void |
793 | 793 | */ |
794 | 794 | public function add_feed() { |
795 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
796 | - add_feed( $feed_slug, array( $this, 'feed_template' ) ); |
|
795 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
796 | + add_feed ( $feed_slug, array( $this, 'feed_template' ) ); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | /** |
@@ -801,9 +801,9 @@ discard block |
||
801 | 801 | * @param boolean $include_footer Default inclusion value |
802 | 802 | * @return boolean Modified inclusion value |
803 | 803 | */ |
804 | - public function hide_wp_seo_rss_footer ( $include_footer = true ) { |
|
804 | + public function hide_wp_seo_rss_footer( $include_footer = true ) { |
|
805 | 805 | |
806 | - if ( is_feed( 'podcast' ) ) { |
|
806 | + if ( is_feed ( 'podcast' ) ) { |
|
807 | 807 | $include_footer = false; |
808 | 808 | } |
809 | 809 | |
@@ -819,24 +819,24 @@ discard block |
||
819 | 819 | |
820 | 820 | // Prevent 404 on feed |
821 | 821 | $wp_query->is_404 = false; |
822 | - status_header( 200 ); |
|
822 | + status_header ( 200 ); |
|
823 | 823 | |
824 | 824 | $file_name = 'feed-podcast.php'; |
825 | 825 | |
826 | - $user_template_file = apply_filters( 'ssp_feed_template_file', trailingslashit( get_stylesheet_directory() ) . $file_name ); |
|
826 | + $user_template_file = apply_filters ( 'ssp_feed_template_file', trailingslashit ( get_stylesheet_directory () ).$file_name ); |
|
827 | 827 | |
828 | 828 | // Any functions hooked in here must NOT output any data or else feed will break |
829 | - do_action( 'ssp_before_feed' ); |
|
829 | + do_action ( 'ssp_before_feed' ); |
|
830 | 830 | |
831 | 831 | // Load user feed template if it exists, otherwise use plugin template |
832 | - if ( file_exists( $user_template_file ) ) { |
|
832 | + if ( file_exists ( $user_template_file ) ) { |
|
833 | 833 | require( $user_template_file ); |
834 | 834 | } else { |
835 | - require( $this->template_path . $file_name ); |
|
835 | + require( $this->template_path.$file_name ); |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | // Any functions hooked in here must NOT output any data or else feed will break |
839 | - do_action( 'ssp_after_feed' ); |
|
839 | + do_action ( 'ssp_after_feed' ); |
|
840 | 840 | |
841 | 841 | exit; |
842 | 842 | } |
@@ -846,8 +846,8 @@ discard block |
||
846 | 846 | * @return void |
847 | 847 | */ |
848 | 848 | public function redirect_old_feed() { |
849 | - if ( isset( $_GET['feed'] ) && in_array( $_GET['feed'], array( 'podcast', 'itunes' ) ) ) { |
|
850 | - $this->feed_template(); |
|
849 | + if ( isset( $_GET[ 'feed' ] ) && in_array ( $_GET[ 'feed' ], array( 'podcast', 'itunes' ) ) ) { |
|
850 | + $this->feed_template (); |
|
851 | 851 | exit; |
852 | 852 | } |
853 | 853 | } |
@@ -859,12 +859,12 @@ discard block |
||
859 | 859 | public function activate() { |
860 | 860 | |
861 | 861 | // Setup all custom URL rules |
862 | - $this->register_post_type(); |
|
863 | - $this->add_feed(); |
|
864 | - $this->setup_permastruct(); |
|
862 | + $this->register_post_type (); |
|
863 | + $this->add_feed (); |
|
864 | + $this->setup_permastruct (); |
|
865 | 865 | |
866 | 866 | // Flush permalinks |
867 | - flush_rewrite_rules( true ); |
|
867 | + flush_rewrite_rules ( true ); |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | /** |
@@ -872,37 +872,37 @@ discard block |
||
872 | 872 | * @return void |
873 | 873 | */ |
874 | 874 | public function deactivate() { |
875 | - flush_rewrite_rules(); |
|
875 | + flush_rewrite_rules (); |
|
876 | 876 | } |
877 | 877 | |
878 | 878 | /** |
879 | 879 | * Run functions on plugin update/activation |
880 | 880 | * @return void |
881 | 881 | */ |
882 | - public function update () { |
|
882 | + public function update() { |
|
883 | 883 | |
884 | - $previous_version = get_option( 'ssp_version', '1.0' ); |
|
884 | + $previous_version = get_option ( 'ssp_version', '1.0' ); |
|
885 | 885 | |
886 | - if ( version_compare( $previous_version, '1.13.1', '<' ) ) { |
|
887 | - flush_rewrite_rules(); |
|
886 | + if ( version_compare ( $previous_version, '1.13.1', '<' ) ) { |
|
887 | + flush_rewrite_rules (); |
|
888 | 888 | } |
889 | 889 | |
890 | - update_option( 'ssp_version', $this->version ); |
|
890 | + update_option ( 'ssp_version', $this->version ); |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | /** |
894 | 894 | * Update 'enclosure' meta field to 'audio_file' meta field |
895 | 895 | * @return void |
896 | 896 | */ |
897 | - public function update_enclosures () { |
|
897 | + public function update_enclosures() { |
|
898 | 898 | |
899 | 899 | // Allow forced re-run of update if necessary |
900 | - if ( isset( $_GET['ssp_update_enclosures'] ) ) { |
|
901 | - delete_option( 'ssp_update_enclosures' ); |
|
900 | + if ( isset( $_GET[ 'ssp_update_enclosures' ] ) ) { |
|
901 | + delete_option ( 'ssp_update_enclosures' ); |
|
902 | 902 | } |
903 | 903 | |
904 | 904 | // Check if update has been run |
905 | - $update_run = get_option( 'ssp_update_enclosures', false ); |
|
905 | + $update_run = get_option ( 'ssp_update_enclosures', false ); |
|
906 | 906 | |
907 | 907 | if ( $update_run ) { |
908 | 908 | return; |
@@ -923,9 +923,9 @@ discard block |
||
923 | 923 | 'fields' => 'ids', |
924 | 924 | ); |
925 | 925 | |
926 | - $posts_with_enclosures = get_posts( $args ); |
|
926 | + $posts_with_enclosures = get_posts ( $args ); |
|
927 | 927 | |
928 | - if ( 0 == count( $posts_with_enclosures ) ) { |
|
928 | + if ( 0 == count ( $posts_with_enclosures ) ) { |
|
929 | 929 | return; |
930 | 930 | } |
931 | 931 | |
@@ -933,17 +933,17 @@ discard block |
||
933 | 933 | foreach ( (array) $posts_with_enclosures as $post_id ) { |
934 | 934 | |
935 | 935 | // Get existing enclosure |
936 | - $enclosure = get_post_meta( $post_id, 'enclosure', true ); |
|
936 | + $enclosure = get_post_meta ( $post_id, 'enclosure', true ); |
|
937 | 937 | |
938 | 938 | // Add audio_file field |
939 | 939 | if ( $enclosure ) { |
940 | - update_post_meta( $post_id, 'audio_file', $enclosure ); |
|
940 | + update_post_meta ( $post_id, 'audio_file', $enclosure ); |
|
941 | 941 | } |
942 | 942 | |
943 | 943 | } |
944 | 944 | |
945 | 945 | // Mark update as having been run |
946 | - update_option( 'ssp_update_enclosures', 'run' ); |
|
946 | + update_option ( 'ssp_update_enclosures', 'run' ); |
|
947 | 947 | } |
948 | 948 | |
949 | 949 | /** |
@@ -954,19 +954,19 @@ discard block |
||
954 | 954 | public function admin_footer_text( $footer_text ) { |
955 | 955 | |
956 | 956 | // Check to make sure we're on a SSP settings page |
957 | - if ( ( isset( $_GET['page'] ) && 'podcast_settings' == esc_attr( $_GET['page'] ) ) && apply_filters( 'ssp_display_admin_footer_text', true ) ) { |
|
957 | + if ( ( isset( $_GET[ 'page' ] ) && 'podcast_settings' == esc_attr ( $_GET[ 'page' ] ) ) && apply_filters ( 'ssp_display_admin_footer_text', true ) ) { |
|
958 | 958 | |
959 | 959 | // Change the footer text |
960 | - if ( ! get_option( 'ssp_admin_footer_text_rated' ) ) { |
|
961 | - $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>' ); |
|
960 | + if ( ! get_option ( 'ssp_admin_footer_text_rated' ) ) { |
|
961 | + $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>' ); |
|
962 | 962 | $footer_text .= "<script type='text/javascript'> |
963 | 963 | jQuery('a.ssp-rating-link').click(function() { |
964 | - jQuery.post( '" . admin_url( 'admin-ajax.php' ) . "', { action: 'ssp_rated' } ); |
|
964 | + jQuery.post( '" . admin_url ( 'admin-ajax.php' )."', { action: 'ssp_rated' } ); |
|
965 | 965 | jQuery(this).parent().text( jQuery(this).data( 'rated' ) ); |
966 | 966 | }); |
967 | 967 | </script>"; |
968 | 968 | } else { |
969 | - $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>' ); |
|
969 | + $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>' ); |
|
970 | 970 | } |
971 | 971 | |
972 | 972 | } |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | * @return void |
980 | 980 | */ |
981 | 981 | public function rated() { |
982 | - update_option( 'ssp_admin_footer_text_rated', 1 ); |
|
982 | + update_option ( 'ssp_admin_footer_text_rated', 1 ); |
|
983 | 983 | die(); |
984 | 984 | } |
985 | 985 | |
@@ -989,11 +989,11 @@ discard block |
||
989 | 989 | * @param object $post WordPress Post Object |
990 | 990 | * @return void |
991 | 991 | */ |
992 | - public function invalidate_cache( $id, $post ){ |
|
992 | + public function invalidate_cache( $id, $post ) { |
|
993 | 993 | |
994 | - if ( in_array( $post->post_type, ssp_post_types( true ) ) ){ |
|
995 | - wp_cache_delete( 'episodes', 'ssp' ); |
|
996 | - wp_cache_delete( 'episode_ids', 'ssp' ); |
|
994 | + if ( in_array ( $post->post_type, ssp_post_types ( true ) ) ) { |
|
995 | + wp_cache_delete ( 'episodes', 'ssp' ); |
|
996 | + wp_cache_delete ( 'episode_ids', 'ssp' ); |
|
997 | 997 | } |
998 | 998 | |
999 | 999 | } |
@@ -928,15 +928,15 @@ discard block |
||
928 | 928 | if ( $message ) { |
929 | 929 | |
930 | 930 | $allowed = array( |
931 | - 'a' => array( |
|
932 | - 'href' => array(), |
|
933 | - 'title' => array(), |
|
934 | - 'target' => array() |
|
935 | - ), |
|
936 | - 'br' => array(), |
|
937 | - 'em' => array(), |
|
938 | - 'strong' => array(), |
|
939 | - 'p' => array() |
|
931 | + 'a' => array( |
|
932 | + 'href' => array(), |
|
933 | + 'title' => array(), |
|
934 | + 'target' => array() |
|
935 | + ), |
|
936 | + 'br' => array(), |
|
937 | + 'em' => array(), |
|
938 | + 'strong' => array(), |
|
939 | + 'p' => array() |
|
940 | 940 | ); |
941 | 941 | |
942 | 942 | $message = wp_kses( $message, $allowed ); |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | if( function_exists( 'php_sapi_name') && 'security' == $tab ) { |
1027 | 1027 | $sapi_type = php_sapi_name(); |
1028 | 1028 | if ( strpos( $sapi_type, 'fcgi' ) !== false ) { |
1029 | - $html .= '<br/><div class="update-nag"> |
|
1029 | + $html .= '<br/><div class="update-nag"> |
|
1030 | 1030 | <p>' . sprintf( __( 'It looks like your server has FastCGI enabled, which will prevent the feed password protection feature from working. You can fix this by following %1$sthis quick guide%2$s.', 'seriously-simple-podcasting' ), '<a href="http://www.seriouslysimplepodcasting.com/documentation/why-does-the-feed-password-protection-feature-not-work/" target="_blank">', '</a>' ) . '</p> |
1031 | 1031 | </div>'; |
1032 | 1032 | } |
@@ -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 | |
@@ -31,37 +31,37 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function __construct( $file ) { |
33 | 33 | $this->file = $file; |
34 | - $this->dir = dirname( $this->file ); |
|
35 | - $this->assets_dir = trailingslashit( $this->dir ) . 'assets'; |
|
36 | - $this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $this->file ) ) ); |
|
37 | - $this->home_url = trailingslashit( home_url() ); |
|
34 | + $this->dir = dirname ( $this->file ); |
|
35 | + $this->assets_dir = trailingslashit ( $this->dir ).'assets'; |
|
36 | + $this->assets_url = esc_url ( trailingslashit ( plugins_url ( '/assets/', $this->file ) ) ); |
|
37 | + $this->home_url = trailingslashit ( home_url () ); |
|
38 | 38 | $this->token = 'podcast'; |
39 | 39 | $this->settings_base = 'ss_podcasting_'; |
40 | 40 | |
41 | - add_action( 'init', array( $this, 'load_settings' ), 11 ); |
|
41 | + add_action ( 'init', array( $this, 'load_settings' ), 11 ); |
|
42 | 42 | |
43 | 43 | // Register podcast settings |
44 | - add_action( 'admin_init' , array( $this, 'register_settings' ) ); |
|
44 | + add_action ( 'admin_init', array( $this, 'register_settings' ) ); |
|
45 | 45 | |
46 | 46 | // Add settings page to menu |
47 | - add_action( 'admin_menu', array( $this , 'add_menu_item' ) ); |
|
47 | + add_action ( 'admin_menu', array( $this, 'add_menu_item' ) ); |
|
48 | 48 | |
49 | 49 | // Add settings link to plugins page |
50 | - add_filter( 'plugin_action_links_' . plugin_basename( $this->file ), array( $this , 'add_plugin_links' ) ); |
|
50 | + add_filter ( 'plugin_action_links_'.plugin_basename ( $this->file ), array( $this, 'add_plugin_links' ) ); |
|
51 | 51 | |
52 | 52 | // Load scripts for settings page |
53 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) , 10 ); |
|
53 | + add_action ( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 10 ); |
|
54 | 54 | |
55 | 55 | // Mark date on which feed redirection was activated |
56 | - add_action( 'update_option', array( $this, 'mark_feed_redirect_date' ) , 10 , 3 ); |
|
56 | + add_action ( 'update_option', array( $this, 'mark_feed_redirect_date' ), 10, 3 ); |
|
57 | 57 | |
58 | 58 | // New caps for editors and above. |
59 | - add_action( 'admin_init', array( $this, 'add_caps' ), 1 ); |
|
59 | + add_action ( 'admin_init', array( $this, 'add_caps' ), 1 ); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | 63 | public function load_settings() { |
64 | - $this->settings = $this->settings_fields(); |
|
64 | + $this->settings = $this->settings_fields (); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return void |
70 | 70 | */ |
71 | 71 | public function add_menu_item() { |
72 | - add_submenu_page( 'edit.php?post_type=podcast' , __( 'Podcast Settings', 'seriously-simple-podcasting' ) , __( 'Settings', 'seriously-simple-podcasting' ), 'manage_podcast' , 'podcast_settings' , array( $this , 'settings_page' ) ); |
|
72 | + add_submenu_page ( 'edit.php?post_type=podcast', __ ( 'Podcast Settings', 'seriously-simple-podcasting' ), __ ( 'Settings', 'seriously-simple-podcasting' ), 'manage_podcast', 'podcast_settings', array( $this, 'settings_page' ) ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | |
80 | 80 | // Roles you'd like to have administer the podcast settings page. |
81 | 81 | // Admin and Editor, as default. |
82 | - $roles = apply_filters( 'ssp_manage_podcast', array( 'administrator', 'editor' ) ); |
|
82 | + $roles = apply_filters ( 'ssp_manage_podcast', array( 'administrator', 'editor' ) ); |
|
83 | 83 | |
84 | 84 | // Loop through each role and assign capabilities |
85 | - foreach( $roles as $the_role ) { |
|
85 | + foreach ( $roles as $the_role ) { |
|
86 | 86 | |
87 | - $role = get_role( $the_role ); |
|
87 | + $role = get_role ( $the_role ); |
|
88 | 88 | $caps = array( |
89 | 89 | 'manage_podcast', |
90 | 90 | ); |
91 | 91 | |
92 | 92 | // Add the caps. |
93 | 93 | foreach ( $caps as $cap ) { |
94 | - $this->maybe_add_cap( $role, $cap ); |
|
94 | + $this->maybe_add_cap ( $role, $cap ); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | } |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function maybe_add_cap( $role, $cap ) { |
107 | 107 | // Update the roles, if needed. |
108 | - if ( ! $role->has_cap( $cap ) ) { |
|
109 | - $role->add_cap( $cap ); |
|
108 | + if ( ! $role->has_cap ( $cap ) ) { |
|
109 | + $role->add_cap ( $cap ); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @return array $links Modified links |
117 | 117 | */ |
118 | 118 | public function add_plugin_links( $links ) { |
119 | - $settings_link = '<a href="edit.php?post_type=podcast&page=podcast_settings">' . __( 'Settings', 'seriously-simple-podcasting' ) . '</a>'; |
|
120 | - array_push( $links, $settings_link ); |
|
119 | + $settings_link = '<a href="edit.php?post_type=podcast&page=podcast_settings">'.__ ( 'Settings', 'seriously-simple-podcasting' ).'</a>'; |
|
120 | + array_push ( $links, $settings_link ); |
|
121 | 121 | return $links; |
122 | 122 | } |
123 | 123 | |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function enqueue_scripts() { |
129 | 129 | global $pagenow; |
130 | - if ( in_array( $pagenow, array( 'post-new.php', 'post.php' ) ) || ( isset( $_GET['page'] ) && 'podcast_settings' == $_GET['page'] ) ) { |
|
131 | - wp_enqueue_media(); |
|
130 | + if ( in_array ( $pagenow, array( 'post-new.php', 'post.php' ) ) || ( isset( $_GET[ 'page' ] ) && 'podcast_settings' == $_GET[ 'page' ] ) ) { |
|
131 | + wp_enqueue_media (); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // Set options for post type selection |
145 | 145 | foreach ( $wp_post_types as $post_type => $data ) { |
146 | 146 | |
147 | - if ( in_array( $post_type, array( 'page', 'attachment', 'revision', 'nav_menu_item', 'wooframework', 'podcast' ) ) ){ |
|
147 | + if ( in_array ( $post_type, array( 'page', 'attachment', 'revision', 'nav_menu_item', 'wooframework', 'podcast' ) ) ) { |
|
148 | 148 | continue; |
149 | 149 | } |
150 | 150 | |
@@ -153,173 +153,173 @@ discard block |
||
153 | 153 | |
154 | 154 | // Set up available category options |
155 | 155 | $category_options = array( |
156 | - '' => __( '-- None --', 'seriously-simple-podcasting' ), |
|
157 | - 'Arts' => __( 'Arts', 'seriously-simple-podcasting' ), |
|
158 | - 'Business' => __( 'Business', 'seriously-simple-podcasting' ), |
|
159 | - 'Comedy' => __( 'Comedy', 'seriously-simple-podcasting' ), |
|
160 | - 'Education' => __( 'Education', 'seriously-simple-podcasting' ), |
|
161 | - 'Games & Hobbies' => __( 'Games & Hobbies', 'seriously-simple-podcasting' ), |
|
162 | - 'Government & Organizations' => __( 'Government & Organizations', 'seriously-simple-podcasting' ), |
|
163 | - 'Health' => __( 'Health', 'seriously-simple-podcasting' ), |
|
164 | - 'Kids & Family' => __( 'Kids & Family', 'seriously-simple-podcasting' ), |
|
165 | - 'Music' => __( 'Music', 'seriously-simple-podcasting' ), |
|
166 | - 'News & Politics' => __( 'News & Politics', 'seriously-simple-podcasting' ), |
|
167 | - 'Religion & Spirituality' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ), |
|
168 | - 'Science & Medicine' => __( 'Science & Medicine', 'seriously-simple-podcasting' ), |
|
169 | - 'Society & Culture' => __( 'Society & Culture', 'seriously-simple-podcasting' ), |
|
170 | - 'Sports & Recreation' => __( 'Sports & Recreation', 'seriously-simple-podcasting' ), |
|
171 | - 'Technology' => __( 'Technology', 'seriously-simple-podcasting' ), |
|
172 | - 'TV & Film' => __( 'TV & Film', 'seriously-simple-podcasting' ), |
|
156 | + '' => __ ( '-- None --', 'seriously-simple-podcasting' ), |
|
157 | + 'Arts' => __ ( 'Arts', 'seriously-simple-podcasting' ), |
|
158 | + 'Business' => __ ( 'Business', 'seriously-simple-podcasting' ), |
|
159 | + 'Comedy' => __ ( 'Comedy', 'seriously-simple-podcasting' ), |
|
160 | + 'Education' => __ ( 'Education', 'seriously-simple-podcasting' ), |
|
161 | + 'Games & Hobbies' => __ ( 'Games & Hobbies', 'seriously-simple-podcasting' ), |
|
162 | + 'Government & Organizations' => __ ( 'Government & Organizations', 'seriously-simple-podcasting' ), |
|
163 | + 'Health' => __ ( 'Health', 'seriously-simple-podcasting' ), |
|
164 | + 'Kids & Family' => __ ( 'Kids & Family', 'seriously-simple-podcasting' ), |
|
165 | + 'Music' => __ ( 'Music', 'seriously-simple-podcasting' ), |
|
166 | + 'News & Politics' => __ ( 'News & Politics', 'seriously-simple-podcasting' ), |
|
167 | + 'Religion & Spirituality' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ), |
|
168 | + 'Science & Medicine' => __ ( 'Science & Medicine', 'seriously-simple-podcasting' ), |
|
169 | + 'Society & Culture' => __ ( 'Society & Culture', 'seriously-simple-podcasting' ), |
|
170 | + 'Sports & Recreation' => __ ( 'Sports & Recreation', 'seriously-simple-podcasting' ), |
|
171 | + 'Technology' => __ ( 'Technology', 'seriously-simple-podcasting' ), |
|
172 | + 'TV & Film' => __ ( 'TV & Film', 'seriously-simple-podcasting' ), |
|
173 | 173 | ); |
174 | 174 | |
175 | 175 | // Set up available sub-category options |
176 | 176 | $subcategory_options = array( |
177 | 177 | |
178 | - '' => __( '-- None --', 'seriously-simple-podcasting' ), |
|
179 | - |
|
180 | - 'Design' => array( 'label' => __( 'Design', 'seriously-simple-podcasting' ), 'group' => __( 'Arts', 'seriously-simple-podcasting' ) ), |
|
181 | - 'Fashion & Beauty' => array( 'label' => __( 'Fashion & Beauty', 'seriously-simple-podcasting' ), 'group' => __( 'Arts', 'seriously-simple-podcasting' ) ), |
|
182 | - 'Food' => array( 'label' => __( 'Food', 'seriously-simple-podcasting' ), 'group' => __( 'Arts', 'seriously-simple-podcasting' ) ), |
|
183 | - 'Literature' => array( 'label' => __( 'Literature', 'seriously-simple-podcasting' ), 'group' => __( 'Arts', 'seriously-simple-podcasting' ) ), |
|
184 | - 'Performing Arts' => array( 'label' => __( 'Performing Arts', 'seriously-simple-podcasting' ), 'group' => __( 'Arts', 'seriously-simple-podcasting' ) ), |
|
185 | - 'Visual Arts' => array( 'label' => __( 'Visual Arts', 'seriously-simple-podcasting' ), 'group' => __( 'Arts', 'seriously-simple-podcasting' ) ), |
|
186 | - |
|
187 | - 'Business News' => array( 'label' => __( 'Business News', 'seriously-simple-podcasting' ), 'group' => __( 'Business', 'seriously-simple-podcasting' ) ), |
|
188 | - 'Careers' => array( 'label' => __( 'Careers', 'seriously-simple-podcasting' ), 'group' => __( 'Business', 'seriously-simple-podcasting' ) ), |
|
189 | - 'Investing' => array( 'label' => __( 'Investing', 'seriously-simple-podcasting' ), 'group' => __( 'Business', 'seriously-simple-podcasting' ) ), |
|
190 | - 'Management & Marketing' => array( 'label' => __( 'Management & Marketing', 'seriously-simple-podcasting' ), 'group' => __( 'Business', 'seriously-simple-podcasting' ) ), |
|
191 | - 'Shopping' => array( 'label' => __( 'Shopping', 'seriously-simple-podcasting' ), 'group' => __( 'Business', 'seriously-simple-podcasting' ) ), |
|
192 | - |
|
193 | - 'Education' => array( 'label' => __( 'Education', 'seriously-simple-podcasting' ), 'group' => __( 'Education', 'seriously-simple-podcasting' ) ), |
|
194 | - 'Education Technology' => array( 'label' => __( 'Education Technology', 'seriously-simple-podcasting' ), 'group' => __( 'Education', 'seriously-simple-podcasting' ) ), |
|
195 | - 'Higher Education' => array( 'label' => __( 'Higher Education', 'seriously-simple-podcasting' ), 'group' => __( 'Education', 'seriously-simple-podcasting' ) ), |
|
196 | - 'K-12' => array( 'label' => __( 'K-12', 'seriously-simple-podcasting' ), 'group' => __( 'Education', 'seriously-simple-podcasting' ) ), |
|
197 | - 'Language Courses' => array( 'label' => __( 'Language Courses', 'seriously-simple-podcasting' ), 'group' => __( 'Education', 'seriously-simple-podcasting' ) ), |
|
198 | - 'Training' => array( 'label' => __( 'Training', 'seriously-simple-podcasting' ), 'group' => __( 'Education', 'seriously-simple-podcasting' ) ), |
|
199 | - |
|
200 | - 'Automotive' => array( 'label' => __( 'Automotive', 'seriously-simple-podcasting' ), 'group' => __( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
201 | - 'Aviation' => array( 'label' => __( 'Aviation', 'seriously-simple-podcasting' ), 'group' => __( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
202 | - 'Hobbies' => array( 'label' => __( 'Hobbies', 'seriously-simple-podcasting' ), 'group' => __( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
203 | - 'Other Games' => array( 'label' => __( 'Other Games', 'seriously-simple-podcasting' ), 'group' => __( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
204 | - 'Video Games' => array( 'label' => __( 'Video Games', 'seriously-simple-podcasting' ), 'group' => __( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
205 | - |
|
206 | - 'Local' => array( 'label' => __( 'Local', 'seriously-simple-podcasting' ), 'group' => __( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
207 | - 'National' => array( 'label' => __( 'National', 'seriously-simple-podcasting' ), 'group' => __( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
208 | - 'Non-Profit' => array( 'label' => __( 'Non-Profit', 'seriously-simple-podcasting' ), 'group' => __( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
209 | - 'Regional' => array( 'label' => __( 'Regional', 'seriously-simple-podcasting' ), 'group' => __( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
210 | - |
|
211 | - 'Alternative Health' => array( 'label' => __( 'Alternative Health', 'seriously-simple-podcasting' ), 'group' => __( 'Health', 'seriously-simple-podcasting' ) ), |
|
212 | - 'Fitness & Nutrition' => array( 'label' => __( 'Fitness & Nutrition', 'seriously-simple-podcasting' ), 'group' => __( 'Health', 'seriously-simple-podcasting' ) ), |
|
213 | - 'Self-Help' => array( 'label' => __( 'Self-Help', 'seriously-simple-podcasting' ), 'group' => __( 'Health', 'seriously-simple-podcasting' ) ), |
|
214 | - 'Sexuality' => array( 'label' => __( 'Sexuality', 'seriously-simple-podcasting' ), 'group' => __( 'Health', 'seriously-simple-podcasting' ) ), |
|
215 | - |
|
216 | - 'Buddhism' => array( 'label' => __( 'Buddhism', 'seriously-simple-podcasting' ), 'group' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
217 | - 'Christianity' => array( 'label' => __( 'Christianity', 'seriously-simple-podcasting' ), 'group' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
218 | - 'Hinduism' => array( 'label' => __( 'Hinduism', 'seriously-simple-podcasting' ), 'group' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
219 | - 'Islam' => array( 'label' => __( 'Islam', 'seriously-simple-podcasting' ), 'group' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
220 | - 'Judaism' => array( 'label' => __( 'Judaism', 'seriously-simple-podcasting' ), 'group' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
221 | - 'Other' => array( 'label' => __( 'Other', 'seriously-simple-podcasting' ), 'group' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
222 | - 'Spirituality' => array( 'label' => __( 'Spirituality', 'seriously-simple-podcasting' ), 'group' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
223 | - |
|
224 | - 'Medicine' => array( 'label' => __( 'Medicine', 'seriously-simple-podcasting' ), 'group' => __( 'Science & Medicine', 'seriously-simple-podcasting' ) ), |
|
225 | - 'Natural Sciences' => array( 'label' => __( 'Natural Sciences', 'seriously-simple-podcasting' ), 'group' => __( 'Science & Medicine', 'seriously-simple-podcasting' ) ), |
|
226 | - 'Social Sciences' => array( 'label' => __( 'Social Sciences', 'seriously-simple-podcasting' ), 'group' => __( 'Science & Medicine', 'seriously-simple-podcasting' ) ), |
|
227 | - |
|
228 | - 'History' => array( 'label' => __( 'History', 'seriously-simple-podcasting' ), 'group' => __( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
229 | - 'Personal Journals' => array( 'label' => __( 'Personal Journals', 'seriously-simple-podcasting' ), 'group' => __( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
230 | - 'Philosophy' => array( 'label' => __( 'Philosophy', 'seriously-simple-podcasting' ), 'group' => __( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
231 | - 'Places & Travel' => array( 'label' => __( 'Places & Travel', 'seriously-simple-podcasting' ), 'group' => __( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
232 | - |
|
233 | - 'Amateur' => array( 'label' => __( 'Amateur', 'seriously-simple-podcasting' ), 'group' => __( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
234 | - 'College & High School' => array( 'label' => __( 'College & High School', 'seriously-simple-podcasting' ), 'group' => __( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
235 | - 'Outdoor' => array( 'label' => __( 'Outdoor', 'seriously-simple-podcasting' ), 'group' => __( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
236 | - 'Professional' => array( 'label' => __( 'Professional', 'seriously-simple-podcasting' ), 'group' => __( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
237 | - |
|
238 | - 'Gadgets' => array( 'label' => __( 'Gadgets', 'seriously-simple-podcasting' ), 'group' => __( 'Technology', 'seriously-simple-podcasting' ) ), |
|
239 | - 'Tech News' => array( 'label' => __( 'Tech News', 'seriously-simple-podcasting' ), 'group' => __( 'Technology', 'seriously-simple-podcasting' ) ), |
|
240 | - 'Podcasting' => array( 'label' => __( 'Podcasting', 'seriously-simple-podcasting' ), 'group' => __( 'Technology', 'seriously-simple-podcasting' ) ), |
|
241 | - 'Software How-To' => array( 'label' => __( 'Software How-To', 'seriously-simple-podcasting' ), 'group' => __( 'Technology', 'seriously-simple-podcasting' ) ), |
|
178 | + '' => __ ( '-- None --', 'seriously-simple-podcasting' ), |
|
179 | + |
|
180 | + 'Design' => array( 'label' => __ ( 'Design', 'seriously-simple-podcasting' ), 'group' => __ ( 'Arts', 'seriously-simple-podcasting' ) ), |
|
181 | + 'Fashion & Beauty' => array( 'label' => __ ( 'Fashion & Beauty', 'seriously-simple-podcasting' ), 'group' => __ ( 'Arts', 'seriously-simple-podcasting' ) ), |
|
182 | + 'Food' => array( 'label' => __ ( 'Food', 'seriously-simple-podcasting' ), 'group' => __ ( 'Arts', 'seriously-simple-podcasting' ) ), |
|
183 | + 'Literature' => array( 'label' => __ ( 'Literature', 'seriously-simple-podcasting' ), 'group' => __ ( 'Arts', 'seriously-simple-podcasting' ) ), |
|
184 | + 'Performing Arts' => array( 'label' => __ ( 'Performing Arts', 'seriously-simple-podcasting' ), 'group' => __ ( 'Arts', 'seriously-simple-podcasting' ) ), |
|
185 | + 'Visual Arts' => array( 'label' => __ ( 'Visual Arts', 'seriously-simple-podcasting' ), 'group' => __ ( 'Arts', 'seriously-simple-podcasting' ) ), |
|
186 | + |
|
187 | + 'Business News' => array( 'label' => __ ( 'Business News', 'seriously-simple-podcasting' ), 'group' => __ ( 'Business', 'seriously-simple-podcasting' ) ), |
|
188 | + 'Careers' => array( 'label' => __ ( 'Careers', 'seriously-simple-podcasting' ), 'group' => __ ( 'Business', 'seriously-simple-podcasting' ) ), |
|
189 | + 'Investing' => array( 'label' => __ ( 'Investing', 'seriously-simple-podcasting' ), 'group' => __ ( 'Business', 'seriously-simple-podcasting' ) ), |
|
190 | + 'Management & Marketing' => array( 'label' => __ ( 'Management & Marketing', 'seriously-simple-podcasting' ), 'group' => __ ( 'Business', 'seriously-simple-podcasting' ) ), |
|
191 | + 'Shopping' => array( 'label' => __ ( 'Shopping', 'seriously-simple-podcasting' ), 'group' => __ ( 'Business', 'seriously-simple-podcasting' ) ), |
|
192 | + |
|
193 | + 'Education' => array( 'label' => __ ( 'Education', 'seriously-simple-podcasting' ), 'group' => __ ( 'Education', 'seriously-simple-podcasting' ) ), |
|
194 | + 'Education Technology' => array( 'label' => __ ( 'Education Technology', 'seriously-simple-podcasting' ), 'group' => __ ( 'Education', 'seriously-simple-podcasting' ) ), |
|
195 | + 'Higher Education' => array( 'label' => __ ( 'Higher Education', 'seriously-simple-podcasting' ), 'group' => __ ( 'Education', 'seriously-simple-podcasting' ) ), |
|
196 | + 'K-12' => array( 'label' => __ ( 'K-12', 'seriously-simple-podcasting' ), 'group' => __ ( 'Education', 'seriously-simple-podcasting' ) ), |
|
197 | + 'Language Courses' => array( 'label' => __ ( 'Language Courses', 'seriously-simple-podcasting' ), 'group' => __ ( 'Education', 'seriously-simple-podcasting' ) ), |
|
198 | + 'Training' => array( 'label' => __ ( 'Training', 'seriously-simple-podcasting' ), 'group' => __ ( 'Education', 'seriously-simple-podcasting' ) ), |
|
199 | + |
|
200 | + 'Automotive' => array( 'label' => __ ( 'Automotive', 'seriously-simple-podcasting' ), 'group' => __ ( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
201 | + 'Aviation' => array( 'label' => __ ( 'Aviation', 'seriously-simple-podcasting' ), 'group' => __ ( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
202 | + 'Hobbies' => array( 'label' => __ ( 'Hobbies', 'seriously-simple-podcasting' ), 'group' => __ ( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
203 | + 'Other Games' => array( 'label' => __ ( 'Other Games', 'seriously-simple-podcasting' ), 'group' => __ ( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
204 | + 'Video Games' => array( 'label' => __ ( 'Video Games', 'seriously-simple-podcasting' ), 'group' => __ ( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
205 | + |
|
206 | + 'Local' => array( 'label' => __ ( 'Local', 'seriously-simple-podcasting' ), 'group' => __ ( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
207 | + 'National' => array( 'label' => __ ( 'National', 'seriously-simple-podcasting' ), 'group' => __ ( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
208 | + 'Non-Profit' => array( 'label' => __ ( 'Non-Profit', 'seriously-simple-podcasting' ), 'group' => __ ( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
209 | + 'Regional' => array( 'label' => __ ( 'Regional', 'seriously-simple-podcasting' ), 'group' => __ ( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
210 | + |
|
211 | + 'Alternative Health' => array( 'label' => __ ( 'Alternative Health', 'seriously-simple-podcasting' ), 'group' => __ ( 'Health', 'seriously-simple-podcasting' ) ), |
|
212 | + 'Fitness & Nutrition' => array( 'label' => __ ( 'Fitness & Nutrition', 'seriously-simple-podcasting' ), 'group' => __ ( 'Health', 'seriously-simple-podcasting' ) ), |
|
213 | + 'Self-Help' => array( 'label' => __ ( 'Self-Help', 'seriously-simple-podcasting' ), 'group' => __ ( 'Health', 'seriously-simple-podcasting' ) ), |
|
214 | + 'Sexuality' => array( 'label' => __ ( 'Sexuality', 'seriously-simple-podcasting' ), 'group' => __ ( 'Health', 'seriously-simple-podcasting' ) ), |
|
215 | + |
|
216 | + 'Buddhism' => array( 'label' => __ ( 'Buddhism', 'seriously-simple-podcasting' ), 'group' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
217 | + 'Christianity' => array( 'label' => __ ( 'Christianity', 'seriously-simple-podcasting' ), 'group' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
218 | + 'Hinduism' => array( 'label' => __ ( 'Hinduism', 'seriously-simple-podcasting' ), 'group' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
219 | + 'Islam' => array( 'label' => __ ( 'Islam', 'seriously-simple-podcasting' ), 'group' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
220 | + 'Judaism' => array( 'label' => __ ( 'Judaism', 'seriously-simple-podcasting' ), 'group' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
221 | + 'Other' => array( 'label' => __ ( 'Other', 'seriously-simple-podcasting' ), 'group' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
222 | + 'Spirituality' => array( 'label' => __ ( 'Spirituality', 'seriously-simple-podcasting' ), 'group' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
223 | + |
|
224 | + 'Medicine' => array( 'label' => __ ( 'Medicine', 'seriously-simple-podcasting' ), 'group' => __ ( 'Science & Medicine', 'seriously-simple-podcasting' ) ), |
|
225 | + 'Natural Sciences' => array( 'label' => __ ( 'Natural Sciences', 'seriously-simple-podcasting' ), 'group' => __ ( 'Science & Medicine', 'seriously-simple-podcasting' ) ), |
|
226 | + 'Social Sciences' => array( 'label' => __ ( 'Social Sciences', 'seriously-simple-podcasting' ), 'group' => __ ( 'Science & Medicine', 'seriously-simple-podcasting' ) ), |
|
227 | + |
|
228 | + 'History' => array( 'label' => __ ( 'History', 'seriously-simple-podcasting' ), 'group' => __ ( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
229 | + 'Personal Journals' => array( 'label' => __ ( 'Personal Journals', 'seriously-simple-podcasting' ), 'group' => __ ( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
230 | + 'Philosophy' => array( 'label' => __ ( 'Philosophy', 'seriously-simple-podcasting' ), 'group' => __ ( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
231 | + 'Places & Travel' => array( 'label' => __ ( 'Places & Travel', 'seriously-simple-podcasting' ), 'group' => __ ( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
232 | + |
|
233 | + 'Amateur' => array( 'label' => __ ( 'Amateur', 'seriously-simple-podcasting' ), 'group' => __ ( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
234 | + 'College & High School' => array( 'label' => __ ( 'College & High School', 'seriously-simple-podcasting' ), 'group' => __ ( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
235 | + 'Outdoor' => array( 'label' => __ ( 'Outdoor', 'seriously-simple-podcasting' ), 'group' => __ ( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
236 | + 'Professional' => array( 'label' => __ ( 'Professional', 'seriously-simple-podcasting' ), 'group' => __ ( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
237 | + |
|
238 | + 'Gadgets' => array( 'label' => __ ( 'Gadgets', 'seriously-simple-podcasting' ), 'group' => __ ( 'Technology', 'seriously-simple-podcasting' ) ), |
|
239 | + 'Tech News' => array( 'label' => __ ( 'Tech News', 'seriously-simple-podcasting' ), 'group' => __ ( 'Technology', 'seriously-simple-podcasting' ) ), |
|
240 | + 'Podcasting' => array( 'label' => __ ( 'Podcasting', 'seriously-simple-podcasting' ), 'group' => __ ( 'Technology', 'seriously-simple-podcasting' ) ), |
|
241 | + 'Software How-To' => array( 'label' => __ ( 'Software How-To', 'seriously-simple-podcasting' ), 'group' => __ ( 'Technology', 'seriously-simple-podcasting' ) ), |
|
242 | 242 | |
243 | 243 | ); |
244 | 244 | |
245 | 245 | $settings = array(); |
246 | 246 | |
247 | - $settings['general'] = array( |
|
248 | - 'title' => __( 'General', 'seriously-simple-podcasting' ), |
|
249 | - 'description' => __( '', 'seriously-simple-podcasting' ), |
|
247 | + $settings[ 'general' ] = array( |
|
248 | + 'title' => __ ( 'General', 'seriously-simple-podcasting' ), |
|
249 | + 'description' => __ ( '', 'seriously-simple-podcasting' ), |
|
250 | 250 | 'fields' => array( |
251 | 251 | array( |
252 | 252 | 'id' => 'use_post_types', |
253 | - 'label' => __( 'Podcast post types', 'seriously-simple-podcasting' ), |
|
254 | - 'description' => __( 'Use this setting to enable podcast functions on any post type - this will add all podcast posts from the specified types to your podcast feed.', 'seriously-simple-podcasting' ), |
|
253 | + 'label' => __ ( 'Podcast post types', 'seriously-simple-podcasting' ), |
|
254 | + 'description' => __ ( 'Use this setting to enable podcast functions on any post type - this will add all podcast posts from the specified types to your podcast feed.', 'seriously-simple-podcasting' ), |
|
255 | 255 | 'type' => 'checkbox_multi', |
256 | 256 | 'options' => $post_type_options, |
257 | 257 | 'default' => array(), |
258 | 258 | ), |
259 | 259 | array( |
260 | 260 | 'id' => 'include_in_main_query', |
261 | - 'label' => __( 'Include podcast in main blog', 'seriously-simple-podcasting' ), |
|
262 | - 'description' => __( 'This setting may behave differently in each theme, so test it carefully after activation - it will add the \'podcast\' post type to your site\'s main query so that your podcast episodes appear on your home page along with your blog posts.', 'seriously-simple-podcasting' ), |
|
261 | + 'label' => __ ( 'Include podcast in main blog', 'seriously-simple-podcasting' ), |
|
262 | + 'description' => __ ( 'This setting may behave differently in each theme, so test it carefully after activation - it will add the \'podcast\' post type to your site\'s main query so that your podcast episodes appear on your home page along with your blog posts.', 'seriously-simple-podcasting' ), |
|
263 | 263 | 'type' => 'checkbox', |
264 | 264 | 'default' => '', |
265 | 265 | ), |
266 | 266 | array( |
267 | 267 | 'id' => 'player_locations', |
268 | - 'label' => __( 'Media player locations', 'seriously-simple-podcasting' ), |
|
269 | - 'description' => __( 'Select where to show the podcast media player along with the episode data (download link, duration and file size)', 'seriously-simple-podcasting' ), |
|
268 | + 'label' => __ ( 'Media player locations', 'seriously-simple-podcasting' ), |
|
269 | + 'description' => __ ( 'Select where to show the podcast media player along with the episode data (download link, duration and file size)', 'seriously-simple-podcasting' ), |
|
270 | 270 | 'type' => 'checkbox_multi', |
271 | - 'options' => array( 'content' => __( 'Full content', 'seriously-simple-podcasting' ), 'excerpt' => __( 'Excerpt', 'seriously-simple-podcasting' ), 'excerpt_embed' => __( 'oEmbed Excerpt', 'seriously-simple-podcasting' ) ), |
|
271 | + 'options' => array( 'content' => __ ( 'Full content', 'seriously-simple-podcasting' ), 'excerpt' => __ ( 'Excerpt', 'seriously-simple-podcasting' ), 'excerpt_embed' => __ ( 'oEmbed Excerpt', 'seriously-simple-podcasting' ) ), |
|
272 | 272 | 'default' => array(), |
273 | 273 | ), |
274 | 274 | array( |
275 | 275 | 'id' => 'player_content_location', |
276 | - 'label' => __( 'Media player position', 'seriously-simple-podcasting' ), |
|
277 | - 'description' => __( 'Select whether to display the media player above or below the full post content.', 'seriously-simple-podcasting' ), |
|
276 | + 'label' => __ ( 'Media player position', 'seriously-simple-podcasting' ), |
|
277 | + 'description' => __ ( 'Select whether to display the media player above or below the full post content.', 'seriously-simple-podcasting' ), |
|
278 | 278 | 'type' => 'radio', |
279 | - 'options' => array( 'above' => __( 'Above content', 'seriously-simple-podcasting' ), 'below' => __( 'Below content', 'seriously-simple-podcasting' ) ), |
|
279 | + 'options' => array( 'above' => __ ( 'Above content', 'seriously-simple-podcasting' ), 'below' => __ ( 'Below content', 'seriously-simple-podcasting' ) ), |
|
280 | 280 | 'default' => 'above', |
281 | 281 | ), |
282 | 282 | ), |
283 | 283 | ); |
284 | 284 | |
285 | - $settings['feed-details'] = array( |
|
286 | - 'title' => __( 'Feed details', 'seriously-simple-podcasting' ), |
|
287 | - 'description' => sprintf( __( 'This data will be used in the feed for your podcast so your listeners will know more about it before they subscribe.%1$sAll of these fields are optional, but it is recommended that you fill in as many of them as possible. Blank fields will use the assigned defaults in the feed.%2$s', 'seriously-simple-podcasting' ), '<br/><em>', '</em>' ), |
|
285 | + $settings[ 'feed-details' ] = array( |
|
286 | + 'title' => __ ( 'Feed details', 'seriously-simple-podcasting' ), |
|
287 | + 'description' => sprintf ( __ ( 'This data will be used in the feed for your podcast so your listeners will know more about it before they subscribe.%1$sAll of these fields are optional, but it is recommended that you fill in as many of them as possible. Blank fields will use the assigned defaults in the feed.%2$s', 'seriously-simple-podcasting' ), '<br/><em>', '</em>' ), |
|
288 | 288 | 'fields' => array( |
289 | 289 | array( |
290 | 290 | 'id' => 'data_title', |
291 | - 'label' => __( 'Title' , 'seriously-simple-podcasting' ), |
|
292 | - 'description' => __( 'Your podcast title.', 'seriously-simple-podcasting' ), |
|
291 | + 'label' => __ ( 'Title', 'seriously-simple-podcasting' ), |
|
292 | + 'description' => __ ( 'Your podcast title.', 'seriously-simple-podcasting' ), |
|
293 | 293 | 'type' => 'text', |
294 | - 'default' => get_bloginfo( 'name' ), |
|
295 | - 'placeholder' => get_bloginfo( 'name' ), |
|
294 | + 'default' => get_bloginfo ( 'name' ), |
|
295 | + 'placeholder' => get_bloginfo ( 'name' ), |
|
296 | 296 | 'class' => 'large-text', |
297 | 297 | 'callback' => 'wp_strip_all_tags', |
298 | 298 | ), |
299 | 299 | array( |
300 | 300 | 'id' => 'data_subtitle', |
301 | - 'label' => __( 'Subtitle' , 'seriously-simple-podcasting' ), |
|
302 | - 'description' => __( 'Your podcast subtitle.', 'seriously-simple-podcasting' ), |
|
301 | + 'label' => __ ( 'Subtitle', 'seriously-simple-podcasting' ), |
|
302 | + 'description' => __ ( 'Your podcast subtitle.', 'seriously-simple-podcasting' ), |
|
303 | 303 | 'type' => 'text', |
304 | - 'default' => get_bloginfo( 'description' ), |
|
305 | - 'placeholder' => get_bloginfo( 'description' ), |
|
304 | + 'default' => get_bloginfo ( 'description' ), |
|
305 | + 'placeholder' => get_bloginfo ( 'description' ), |
|
306 | 306 | 'class' => 'large-text', |
307 | 307 | 'callback' => 'wp_strip_all_tags', |
308 | 308 | ), |
309 | 309 | array( |
310 | 310 | 'id' => 'data_author', |
311 | - 'label' => __( 'Author' , 'seriously-simple-podcasting' ), |
|
312 | - 'description' => __( 'Your podcast author.', 'seriously-simple-podcasting' ), |
|
311 | + 'label' => __ ( 'Author', 'seriously-simple-podcasting' ), |
|
312 | + 'description' => __ ( 'Your podcast author.', 'seriously-simple-podcasting' ), |
|
313 | 313 | 'type' => 'text', |
314 | - 'default' => get_bloginfo( 'name' ), |
|
315 | - 'placeholder' => get_bloginfo( 'name' ), |
|
314 | + 'default' => get_bloginfo ( 'name' ), |
|
315 | + 'placeholder' => get_bloginfo ( 'name' ), |
|
316 | 316 | 'class' => 'large-text', |
317 | 317 | 'callback' => 'wp_strip_all_tags', |
318 | 318 | ), |
319 | 319 | array( |
320 | 320 | 'id' => 'data_category', |
321 | - 'label' => __( 'Primary Category' , 'seriously-simple-podcasting' ), |
|
322 | - 'description' => __( 'Your podcast\'s primary category.', 'seriously-simple-podcasting' ), |
|
321 | + 'label' => __ ( 'Primary Category', 'seriously-simple-podcasting' ), |
|
322 | + 'description' => __ ( 'Your podcast\'s primary category.', 'seriously-simple-podcasting' ), |
|
323 | 323 | 'type' => 'select', |
324 | 324 | 'options' => $category_options, |
325 | 325 | 'default' => '', |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | ), |
328 | 328 | array( |
329 | 329 | 'id' => 'data_subcategory', |
330 | - 'label' => __( 'Primary Sub-Category' , 'seriously-simple-podcasting' ), |
|
331 | - 'description' => __( 'Your podcast\'s primary sub-category (if available) - must be a sub-category of the primary category selected above.', 'seriously-simple-podcasting' ), |
|
330 | + 'label' => __ ( 'Primary Sub-Category', 'seriously-simple-podcasting' ), |
|
331 | + 'description' => __ ( 'Your podcast\'s primary sub-category (if available) - must be a sub-category of the primary category selected above.', 'seriously-simple-podcasting' ), |
|
332 | 332 | 'type' => 'select', |
333 | 333 | 'options' => $subcategory_options, |
334 | 334 | 'default' => '', |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | ), |
337 | 337 | array( |
338 | 338 | 'id' => 'data_category2', |
339 | - 'label' => __( 'Secondary Category' , 'seriously-simple-podcasting' ), |
|
340 | - 'description' => __( 'Your podcast\'s secondary category.', 'seriously-simple-podcasting' ), |
|
339 | + 'label' => __ ( 'Secondary Category', 'seriously-simple-podcasting' ), |
|
340 | + 'description' => __ ( 'Your podcast\'s secondary category.', 'seriously-simple-podcasting' ), |
|
341 | 341 | 'type' => 'select', |
342 | 342 | 'options' => $category_options, |
343 | 343 | 'default' => '', |
@@ -345,8 +345,8 @@ discard block |
||
345 | 345 | ), |
346 | 346 | array( |
347 | 347 | 'id' => 'data_subcategory2', |
348 | - 'label' => __( 'Secondary Sub-Category' , 'seriously-simple-podcasting' ), |
|
349 | - 'description' => __( 'Your podcast\'s secondary sub-category (if available) - must be a sub-category of the secondary category selected above.', 'seriously-simple-podcasting' ), |
|
348 | + 'label' => __ ( 'Secondary Sub-Category', 'seriously-simple-podcasting' ), |
|
349 | + 'description' => __ ( 'Your podcast\'s secondary sub-category (if available) - must be a sub-category of the secondary category selected above.', 'seriously-simple-podcasting' ), |
|
350 | 350 | 'type' => 'select', |
351 | 351 | 'options' => $subcategory_options, |
352 | 352 | 'default' => '', |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | ), |
355 | 355 | array( |
356 | 356 | 'id' => 'data_category3', |
357 | - 'label' => __( 'Tertiary Category' , 'seriously-simple-podcasting' ), |
|
358 | - 'description' => __( 'Your podcast\'s tertiary category.', 'seriously-simple-podcasting' ), |
|
357 | + 'label' => __ ( 'Tertiary Category', 'seriously-simple-podcasting' ), |
|
358 | + 'description' => __ ( 'Your podcast\'s tertiary category.', 'seriously-simple-podcasting' ), |
|
359 | 359 | 'type' => 'select', |
360 | 360 | 'options' => $category_options, |
361 | 361 | 'default' => '', |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | ), |
364 | 364 | array( |
365 | 365 | 'id' => 'data_subcategory3', |
366 | - 'label' => __( 'Tertiary Sub-Category' , 'seriously-simple-podcasting' ), |
|
367 | - 'description' => __( 'Your podcast\'s tertiary sub-category (if available) - must be a sub-category of the tertiary category selected above.', 'seriously-simple-podcasting' ), |
|
366 | + 'label' => __ ( 'Tertiary Sub-Category', 'seriously-simple-podcasting' ), |
|
367 | + 'description' => __ ( 'Your podcast\'s tertiary sub-category (if available) - must be a sub-category of the tertiary category selected above.', 'seriously-simple-podcasting' ), |
|
368 | 368 | 'type' => 'select', |
369 | 369 | 'options' => $subcategory_options, |
370 | 370 | 'default' => '', |
@@ -372,18 +372,18 @@ discard block |
||
372 | 372 | ), |
373 | 373 | array( |
374 | 374 | 'id' => 'data_description', |
375 | - 'label' => __( 'Description/Summary' , 'seriously-simple-podcasting' ), |
|
376 | - 'description' => __( 'A description/summary of your podcast - no HTML allowed.', 'seriously-simple-podcasting' ), |
|
375 | + 'label' => __ ( 'Description/Summary', 'seriously-simple-podcasting' ), |
|
376 | + 'description' => __ ( 'A description/summary of your podcast - no HTML allowed.', 'seriously-simple-podcasting' ), |
|
377 | 377 | 'type' => 'textarea', |
378 | - 'default' => get_bloginfo( 'description' ), |
|
379 | - 'placeholder' => get_bloginfo( 'description' ), |
|
378 | + 'default' => get_bloginfo ( 'description' ), |
|
379 | + 'placeholder' => get_bloginfo ( 'description' ), |
|
380 | 380 | 'callback' => 'wp_strip_all_tags', |
381 | 381 | 'class' => 'large-text', |
382 | 382 | ), |
383 | 383 | array( |
384 | 384 | 'id' => 'data_image', |
385 | - 'label' => __( 'Cover Image' , 'seriously-simple-podcasting' ), |
|
386 | - 'description' => __( 'Your podcast cover image - must have a minimum size of 1400x1400 px.', 'seriously-simple-podcasting' ), |
|
385 | + 'label' => __ ( 'Cover Image', 'seriously-simple-podcasting' ), |
|
386 | + 'description' => __ ( 'Your podcast cover image - must have a minimum size of 1400x1400 px.', 'seriously-simple-podcasting' ), |
|
387 | 387 | 'type' => 'image', |
388 | 388 | 'default' => '', |
389 | 389 | 'placeholder' => '', |
@@ -391,182 +391,182 @@ discard block |
||
391 | 391 | ), |
392 | 392 | array( |
393 | 393 | 'id' => 'data_owner_name', |
394 | - 'label' => __( 'Owner name' , 'seriously-simple-podcasting' ), |
|
395 | - 'description' => __( 'Podcast owner\'s name.', 'seriously-simple-podcasting' ), |
|
394 | + 'label' => __ ( 'Owner name', 'seriously-simple-podcasting' ), |
|
395 | + 'description' => __ ( 'Podcast owner\'s name.', 'seriously-simple-podcasting' ), |
|
396 | 396 | 'type' => 'text', |
397 | - 'default' => get_bloginfo( 'name' ), |
|
398 | - 'placeholder' => get_bloginfo( 'name' ), |
|
397 | + 'default' => get_bloginfo ( 'name' ), |
|
398 | + 'placeholder' => get_bloginfo ( 'name' ), |
|
399 | 399 | 'class' => 'large-text', |
400 | 400 | 'callback' => 'wp_strip_all_tags', |
401 | 401 | ), |
402 | 402 | array( |
403 | 403 | 'id' => 'data_owner_email', |
404 | - 'label' => __( 'Owner email address' , 'seriously-simple-podcasting' ), |
|
405 | - 'description' => __( 'Podcast owner\'s email address.', 'seriously-simple-podcasting' ), |
|
404 | + 'label' => __ ( 'Owner email address', 'seriously-simple-podcasting' ), |
|
405 | + 'description' => __ ( 'Podcast owner\'s email address.', 'seriously-simple-podcasting' ), |
|
406 | 406 | 'type' => 'text', |
407 | - 'default' => get_bloginfo( 'admin_email' ), |
|
408 | - 'placeholder' => get_bloginfo( 'admin_email' ), |
|
407 | + 'default' => get_bloginfo ( 'admin_email' ), |
|
408 | + 'placeholder' => get_bloginfo ( 'admin_email' ), |
|
409 | 409 | 'class' => 'large-text', |
410 | 410 | 'callback' => 'wp_strip_all_tags', |
411 | 411 | ), |
412 | 412 | array( |
413 | 413 | 'id' => 'data_language', |
414 | - 'label' => __( 'Language' , 'seriously-simple-podcasting' ), |
|
415 | - 'description' => sprintf( __( 'Your podcast\'s language in %1$sISO-639-1 format%2$s.', 'seriously-simple-podcasting' ), '<a href="' . esc_url( 'http://www.loc.gov/standards/iso639-2/php/code_list.php' ) . '" target="' . wp_strip_all_tags( '_blank' ) . '">', '</a>' ), |
|
414 | + 'label' => __ ( 'Language', 'seriously-simple-podcasting' ), |
|
415 | + 'description' => sprintf ( __ ( 'Your podcast\'s language in %1$sISO-639-1 format%2$s.', 'seriously-simple-podcasting' ), '<a href="'.esc_url ( 'http://www.loc.gov/standards/iso639-2/php/code_list.php' ).'" target="'.wp_strip_all_tags ( '_blank' ).'">', '</a>' ), |
|
416 | 416 | 'type' => 'text', |
417 | - 'default' => get_bloginfo( 'language' ), |
|
418 | - 'placeholder' => get_bloginfo( 'language' ), |
|
417 | + 'default' => get_bloginfo ( 'language' ), |
|
418 | + 'placeholder' => get_bloginfo ( 'language' ), |
|
419 | 419 | 'class' => 'all-options', |
420 | 420 | 'callback' => 'wp_strip_all_tags', |
421 | 421 | ), |
422 | 422 | array( |
423 | 423 | 'id' => 'data_copyright', |
424 | - 'label' => __( 'Copyright' , 'seriously-simple-podcasting' ), |
|
425 | - 'description' => __( 'Copyright line for your podcast.', 'seriously-simple-podcasting' ), |
|
424 | + 'label' => __ ( 'Copyright', 'seriously-simple-podcasting' ), |
|
425 | + 'description' => __ ( 'Copyright line for your podcast.', 'seriously-simple-podcasting' ), |
|
426 | 426 | 'type' => 'text', |
427 | - 'default' => '© ' . date( 'Y' ) . ' ' . get_bloginfo( 'name' ), |
|
428 | - 'placeholder' => '© ' . date( 'Y' ) . ' ' . get_bloginfo( 'name' ), |
|
427 | + 'default' => '© '.date ( 'Y' ).' '.get_bloginfo ( 'name' ), |
|
428 | + 'placeholder' => '© '.date ( 'Y' ).' '.get_bloginfo ( 'name' ), |
|
429 | 429 | 'class' => 'large-text', |
430 | 430 | 'callback' => 'wp_strip_all_tags', |
431 | 431 | ), |
432 | 432 | array( |
433 | 433 | 'id' => 'explicit', |
434 | - 'label' => __( 'Explicit', 'seriously-simple-podcasting' ), |
|
435 | - 'description' => __( 'Mark if your podcast is explicit or not.', 'seriously-simple-podcasting' ), |
|
434 | + 'label' => __ ( 'Explicit', 'seriously-simple-podcasting' ), |
|
435 | + 'description' => __ ( 'Mark if your podcast is explicit or not.', 'seriously-simple-podcasting' ), |
|
436 | 436 | 'type' => 'checkbox', |
437 | 437 | 'default' => '', |
438 | 438 | 'callback' => 'wp_strip_all_tags', |
439 | 439 | ), |
440 | 440 | array( |
441 | 441 | 'id' => 'complete', |
442 | - 'label' => __( 'Complete', 'seriously-simple-podcasting' ), |
|
443 | - 'description' => __( 'Mark if this podcast is complete or not. Only do this if no more episodes are going to be added to this feed.', 'seriously-simple-podcasting' ), |
|
442 | + 'label' => __ ( 'Complete', 'seriously-simple-podcasting' ), |
|
443 | + 'description' => __ ( 'Mark if this podcast is complete or not. Only do this if no more episodes are going to be added to this feed.', 'seriously-simple-podcasting' ), |
|
444 | 444 | 'type' => 'checkbox', |
445 | 445 | 'default' => '', |
446 | 446 | 'callback' => 'wp_strip_all_tags', |
447 | 447 | ), |
448 | 448 | array( |
449 | 449 | 'id' => 'redirect_feed', |
450 | - 'label' => __( 'Redirect this feed to new URL', 'seriously-simple-podcasting' ), |
|
451 | - 'description' => sprintf( __( 'Redirect your feed to a new URL (specified below).', 'seriously-simple-podcasting' ) , '<br/>' ), |
|
450 | + 'label' => __ ( 'Redirect this feed to new URL', 'seriously-simple-podcasting' ), |
|
451 | + 'description' => sprintf ( __ ( 'Redirect your feed to a new URL (specified below).', 'seriously-simple-podcasting' ), '<br/>' ), |
|
452 | 452 | 'type' => 'checkbox', |
453 | 453 | 'default' => '', |
454 | 454 | 'callback' => 'wp_strip_all_tags', |
455 | 455 | ), |
456 | 456 | array( |
457 | 457 | 'id' => 'new_feed_url', |
458 | - 'label' => __( 'New podcast feed URL', 'seriously-simple-podcasting' ), |
|
459 | - 'description' => __( 'Your podcast feed\'s new URL.', 'seriously-simple-podcasting' ), |
|
458 | + 'label' => __ ( 'New podcast feed URL', 'seriously-simple-podcasting' ), |
|
459 | + 'description' => __ ( 'Your podcast feed\'s new URL.', 'seriously-simple-podcasting' ), |
|
460 | 460 | 'type' => 'text', |
461 | 461 | 'default' => '', |
462 | - 'placeholder' => __( 'New feed URL', 'seriously-simple-podcasting' ), |
|
462 | + 'placeholder' => __ ( 'New feed URL', 'seriously-simple-podcasting' ), |
|
463 | 463 | 'callback' => 'esc_url_raw', |
464 | 464 | 'class' => 'regular-text', |
465 | 465 | ), |
466 | 466 | ) |
467 | 467 | ); |
468 | 468 | |
469 | - $settings['security'] = array( |
|
470 | - 'title' => __( 'Security', 'seriously-simple-podcasting' ), |
|
471 | - 'description' => __( 'Change these settings to ensure that your podcast feed remains private. This will block feed readers (including iTunes) from accessing your feed.', 'seriously-simple-podcasting' ), |
|
469 | + $settings[ 'security' ] = array( |
|
470 | + 'title' => __ ( 'Security', 'seriously-simple-podcasting' ), |
|
471 | + 'description' => __ ( 'Change these settings to ensure that your podcast feed remains private. This will block feed readers (including iTunes) from accessing your feed.', 'seriously-simple-podcasting' ), |
|
472 | 472 | 'fields' => array( |
473 | 473 | array( |
474 | 474 | 'id' => 'protect', |
475 | - 'label' => __( 'Password protect your podcast feed', 'seriously-simple-podcasting' ), |
|
476 | - 'description' => __( 'Mark if you would like to password protect your podcast feed - you can set the username and password below. This will block all feed readers (including iTunes) from accessing your feed.', 'seriously-simple-podcasting' ), |
|
475 | + 'label' => __ ( 'Password protect your podcast feed', 'seriously-simple-podcasting' ), |
|
476 | + 'description' => __ ( 'Mark if you would like to password protect your podcast feed - you can set the username and password below. This will block all feed readers (including iTunes) from accessing your feed.', 'seriously-simple-podcasting' ), |
|
477 | 477 | 'type' => 'checkbox', |
478 | 478 | 'default' => '', |
479 | 479 | 'callback' => 'wp_strip_all_tags', |
480 | 480 | ), |
481 | 481 | array( |
482 | 482 | 'id' => 'protection_username', |
483 | - 'label' => __( 'Username' , 'seriously-simple-podcasting' ), |
|
484 | - 'description' => __( 'Username for your podcast feed.', 'seriously-simple-podcasting' ), |
|
483 | + 'label' => __ ( 'Username', 'seriously-simple-podcasting' ), |
|
484 | + 'description' => __ ( 'Username for your podcast feed.', 'seriously-simple-podcasting' ), |
|
485 | 485 | 'type' => 'text', |
486 | 486 | 'default' => '', |
487 | - 'placeholder' => __( 'Feed username', 'seriously-simple-podcasting' ), |
|
487 | + 'placeholder' => __ ( 'Feed username', 'seriously-simple-podcasting' ), |
|
488 | 488 | 'class' => 'regular-text', |
489 | 489 | 'callback' => 'wp_strip_all_tags', |
490 | 490 | ), |
491 | 491 | array( |
492 | 492 | 'id' => 'protection_password', |
493 | - 'label' => __( 'Password' , 'seriously-simple-podcasting' ), |
|
494 | - 'description' => __( 'Password for your podcast feed. Once saved, the password is encoded and secured so it will not be visible on this page again.', 'seriously-simple-podcasting' ), |
|
493 | + 'label' => __ ( 'Password', 'seriously-simple-podcasting' ), |
|
494 | + 'description' => __ ( 'Password for your podcast feed. Once saved, the password is encoded and secured so it will not be visible on this page again.', 'seriously-simple-podcasting' ), |
|
495 | 495 | 'type' => 'text_secret', |
496 | 496 | 'default' => '', |
497 | - 'placeholder' => __( 'Feed password', 'seriously-simple-podcasting' ), |
|
497 | + 'placeholder' => __ ( 'Feed password', 'seriously-simple-podcasting' ), |
|
498 | 498 | 'callback' => array( $this, 'encode_password' ), |
499 | 499 | 'class' => 'regular-text', |
500 | 500 | ), |
501 | 501 | array( |
502 | 502 | 'id' => 'protection_no_access_message', |
503 | - 'label' => __( 'No access message' , 'seriously-simple-podcasting' ), |
|
504 | - 'description' => __( 'This message will be displayed to people who are not allowed access to your podcast feed. Limited HTML allowed.', 'seriously-simple-podcasting' ), |
|
503 | + 'label' => __ ( 'No access message', 'seriously-simple-podcasting' ), |
|
504 | + 'description' => __ ( 'This message will be displayed to people who are not allowed access to your podcast feed. Limited HTML allowed.', 'seriously-simple-podcasting' ), |
|
505 | 505 | 'type' => 'textarea', |
506 | - 'default' => __( 'You are not permitted to view this podcast feed.', 'seriously-simple-podcasting' ), |
|
507 | - 'placeholder' => __( 'Message displayed to users who do not have access to the podcast feed', 'seriously-simple-podcasting' ), |
|
506 | + 'default' => __ ( 'You are not permitted to view this podcast feed.', 'seriously-simple-podcasting' ), |
|
507 | + 'placeholder' => __ ( 'Message displayed to users who do not have access to the podcast feed', 'seriously-simple-podcasting' ), |
|
508 | 508 | 'callback' => array( $this, 'validate_message' ), |
509 | 509 | 'class' => 'large-text', |
510 | 510 | ), |
511 | 511 | ) |
512 | 512 | ); |
513 | 513 | |
514 | - $settings['redirection'] = array( |
|
515 | - 'title' => __( 'Redirection', 'seriously-simple-podcasting' ), |
|
516 | - 'description' => __( 'Use these settings to safely move your podcast to a different location. Only do this once your new podcast is setup and active.', 'seriously-simple-podcasting' ), |
|
514 | + $settings[ 'redirection' ] = array( |
|
515 | + 'title' => __ ( 'Redirection', 'seriously-simple-podcasting' ), |
|
516 | + 'description' => __ ( 'Use these settings to safely move your podcast to a different location. Only do this once your new podcast is setup and active.', 'seriously-simple-podcasting' ), |
|
517 | 517 | 'fields' => array( |
518 | 518 | array( |
519 | 519 | 'id' => 'redirect_feed', |
520 | - 'label' => __( 'Redirect podcast feed to new URL', 'seriously-simple-podcasting' ), |
|
521 | - 'description' => sprintf( __( 'Redirect your feed to a new URL (specified below).%1$sThis will inform all podcasting services that your podcast has moved and 48 hours after you have saved this option it will permanently redirect your feed to the new URL.', 'seriously-simple-podcasting' ) , '<br/>' ), |
|
520 | + 'label' => __ ( 'Redirect podcast feed to new URL', 'seriously-simple-podcasting' ), |
|
521 | + 'description' => sprintf ( __ ( 'Redirect your feed to a new URL (specified below).%1$sThis will inform all podcasting services that your podcast has moved and 48 hours after you have saved this option it will permanently redirect your feed to the new URL.', 'seriously-simple-podcasting' ), '<br/>' ), |
|
522 | 522 | 'type' => 'checkbox', |
523 | 523 | 'default' => '', |
524 | 524 | 'callback' => 'wp_strip_all_tags', |
525 | 525 | ), |
526 | 526 | array( |
527 | 527 | 'id' => 'new_feed_url', |
528 | - 'label' => __( 'New podcast feed URL', 'seriously-simple-podcasting' ), |
|
529 | - 'description' => __( 'Your podcast feed\'s new URL.', 'seriously-simple-podcasting' ), |
|
528 | + 'label' => __ ( 'New podcast feed URL', 'seriously-simple-podcasting' ), |
|
529 | + 'description' => __ ( 'Your podcast feed\'s new URL.', 'seriously-simple-podcasting' ), |
|
530 | 530 | 'type' => 'text', |
531 | 531 | 'default' => '', |
532 | - 'placeholder' => __( 'New feed URL', 'seriously-simple-podcasting' ), |
|
532 | + 'placeholder' => __ ( 'New feed URL', 'seriously-simple-podcasting' ), |
|
533 | 533 | 'callback' => 'esc_url_raw', |
534 | 534 | 'class' => 'regular-text', |
535 | 535 | ), |
536 | 536 | ) |
537 | 537 | ); |
538 | 538 | |
539 | - $settings['publishing'] = array( |
|
540 | - 'title' => __( 'Publishing' , 'seriously-simple-podcasting' ), |
|
541 | - 'description' => __( 'Use these URLs to share and publish your podcast feed. These URLs will work with any podcasting service (including iTunes).' , 'seriously-simple-podcasting' ), |
|
539 | + $settings[ 'publishing' ] = array( |
|
540 | + 'title' => __ ( 'Publishing', 'seriously-simple-podcasting' ), |
|
541 | + 'description' => __ ( 'Use these URLs to share and publish your podcast feed. These URLs will work with any podcasting service (including iTunes).', 'seriously-simple-podcasting' ), |
|
542 | 542 | 'fields' => array( |
543 | 543 | array( |
544 | 544 | 'id' => 'feed_url', |
545 | - 'label' => __( 'External feed URL', 'seriously-simple-podcasting' ), |
|
546 | - 'description' => __( 'If you are syndicating your podcast using a third-party service (like Feedburner) you can insert the URL here, otherwise this must be left blank.' , 'seriously-simple-podcasting' ), |
|
545 | + 'label' => __ ( 'External feed URL', 'seriously-simple-podcasting' ), |
|
546 | + 'description' => __ ( 'If you are syndicating your podcast using a third-party service (like Feedburner) you can insert the URL here, otherwise this must be left blank.', 'seriously-simple-podcasting' ), |
|
547 | 547 | 'type' => 'text', |
548 | 548 | 'default' => '', |
549 | - 'placeholder' => __( 'External feed URL', 'seriously-simple-podcasting' ), |
|
549 | + 'placeholder' => __ ( 'External feed URL', 'seriously-simple-podcasting' ), |
|
550 | 550 | 'callback' => 'esc_url_raw', |
551 | 551 | 'class' => 'regular-text', |
552 | 552 | ), |
553 | 553 | array( |
554 | 554 | 'id' => 'feed_link', |
555 | - 'label' => __( 'Complete feed', 'seriously-simple-podcasting' ), |
|
555 | + 'label' => __ ( 'Complete feed', 'seriously-simple-podcasting' ), |
|
556 | 556 | 'description' => '', |
557 | 557 | 'type' => 'feed_link', |
558 | 558 | 'callback' => 'esc_url_raw', |
559 | 559 | ), |
560 | 560 | array( |
561 | 561 | 'id' => 'feed_link_series', |
562 | - 'label' => __( 'Feed for a specific series', 'seriously-simple-podcasting' ), |
|
562 | + 'label' => __ ( 'Feed for a specific series', 'seriously-simple-podcasting' ), |
|
563 | 563 | 'description' => '', |
564 | 564 | 'type' => 'feed_link_series', |
565 | 565 | 'callback' => 'esc_url_raw', |
566 | 566 | ), |
567 | 567 | array( |
568 | 568 | 'id' => 'podcast_url', |
569 | - 'label' => __( 'Podcast page', 'seriously-simple-podcasting' ), |
|
569 | + 'label' => __ ( 'Podcast page', 'seriously-simple-podcasting' ), |
|
570 | 570 | 'description' => '', |
571 | 571 | 'type' => 'podcast_url', |
572 | 572 | 'callback' => 'esc_url_raw', |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | ) |
575 | 575 | ); |
576 | 576 | |
577 | - $settings = apply_filters( 'ssp_settings_fields', $settings ); |
|
577 | + $settings = apply_filters ( 'ssp_settings_fields', $settings ); |
|
578 | 578 | |
579 | 579 | return $settings; |
580 | 580 | } |
@@ -584,15 +584,15 @@ discard block |
||
584 | 584 | * @return void |
585 | 585 | */ |
586 | 586 | public function register_settings() { |
587 | - if ( is_array( $this->settings ) ) { |
|
587 | + if ( is_array ( $this->settings ) ) { |
|
588 | 588 | |
589 | 589 | // Check posted/selected tab |
590 | 590 | $current_section = 'general'; |
591 | - if ( isset( $_POST['tab'] ) && $_POST['tab'] ) { |
|
592 | - $current_section = $_POST['tab']; |
|
591 | + if ( isset( $_POST[ 'tab' ] ) && $_POST[ 'tab' ] ) { |
|
592 | + $current_section = $_POST[ 'tab' ]; |
|
593 | 593 | } else { |
594 | - if ( isset( $_GET['tab'] ) && $_GET['tab'] ) { |
|
595 | - $current_section = $_GET['tab']; |
|
594 | + if ( isset( $_GET[ 'tab' ] ) && $_GET[ 'tab' ] ) { |
|
595 | + $current_section = $_GET[ 'tab' ]; |
|
596 | 596 | } |
597 | 597 | } |
598 | 598 | |
@@ -607,81 +607,81 @@ discard block |
||
607 | 607 | $series_id = 0; |
608 | 608 | if ( 'feed-details' == $section ) { |
609 | 609 | |
610 | - if ( isset( $_REQUEST['feed-series'] ) && $_REQUEST['feed-series'] && 'default' != $_REQUEST['feed-series'] ) { |
|
610 | + if ( isset( $_REQUEST[ 'feed-series' ] ) && $_REQUEST[ 'feed-series' ] && 'default' != $_REQUEST[ 'feed-series' ] ) { |
|
611 | 611 | |
612 | 612 | // Get selected series |
613 | - $series = get_term_by( 'slug', esc_attr( $_REQUEST['feed-series'] ), 'series' ); |
|
613 | + $series = get_term_by ( 'slug', esc_attr ( $_REQUEST[ 'feed-series' ] ), 'series' ); |
|
614 | 614 | |
615 | 615 | // Store series ID for later use |
616 | 616 | $series_id = $series->term_id; |
617 | 617 | |
618 | 618 | // Append series name to section title |
619 | 619 | if ( $series ) { |
620 | - $title_tail = ': ' . $series->name; |
|
620 | + $title_tail = ': '.$series->name; |
|
621 | 621 | } |
622 | 622 | } |
623 | 623 | } |
624 | 624 | |
625 | - $section_title = $data['title'] . $title_tail; |
|
625 | + $section_title = $data[ 'title' ].$title_tail; |
|
626 | 626 | |
627 | 627 | // Add section to page |
628 | - add_settings_section( $section, $section_title, array( $this, 'settings_section' ), 'ss_podcasting' ); |
|
628 | + add_settings_section ( $section, $section_title, array( $this, 'settings_section' ), 'ss_podcasting' ); |
|
629 | 629 | |
630 | - foreach ( $data['fields'] as $field ) { |
|
630 | + foreach ( $data[ 'fields' ] as $field ) { |
|
631 | 631 | |
632 | 632 | // Validation callback for field |
633 | 633 | $validation = ''; |
634 | - if ( isset( $field['callback'] ) ) { |
|
635 | - $validation = $field['callback']; |
|
634 | + if ( isset( $field[ 'callback' ] ) ) { |
|
635 | + $validation = $field[ 'callback' ]; |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | // Get field option name |
639 | - $option_name = $this->settings_base . $field['id']; |
|
639 | + $option_name = $this->settings_base.$field[ 'id' ]; |
|
640 | 640 | |
641 | 641 | // Append series ID if selected |
642 | 642 | if ( $series_id ) { |
643 | - $option_name .= '_' . $series_id; |
|
643 | + $option_name .= '_'.$series_id; |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | // Register setting |
647 | - register_setting( 'ss_podcasting', $option_name, $validation ); |
|
647 | + register_setting ( 'ss_podcasting', $option_name, $validation ); |
|
648 | 648 | |
649 | 649 | // Add field to page |
650 | - add_settings_field( $field['id'], $field['label'], array( $this, 'display_field' ), 'ss_podcasting', $section, array( 'field' => $field, 'prefix' => $this->settings_base, 'feed-series' => $series_id ) ); |
|
650 | + add_settings_field ( $field[ 'id' ], $field[ 'label' ], array( $this, 'display_field' ), 'ss_podcasting', $section, array( 'field' => $field, 'prefix' => $this->settings_base, 'feed-series' => $series_id ) ); |
|
651 | 651 | } |
652 | 652 | } |
653 | 653 | } |
654 | 654 | } |
655 | 655 | |
656 | 656 | public function settings_section( $section ) { |
657 | - $html = '<p>' . $this->settings[ $section['id'] ]['description'] . '</p>' . "\n"; |
|
657 | + $html = '<p>'.$this->settings[ $section[ 'id' ] ][ 'description' ].'</p>'."\n"; |
|
658 | 658 | |
659 | - if( 'feed-details' == $section['id'] ) { |
|
659 | + if ( 'feed-details' == $section[ 'id' ] ) { |
|
660 | 660 | |
661 | 661 | $feed_series = 'default'; |
662 | - if( isset( $_GET['feed-series'] ) ) { |
|
663 | - $feed_series = esc_attr( $_GET['feed-series'] ); |
|
662 | + if ( isset( $_GET[ 'feed-series' ] ) ) { |
|
663 | + $feed_series = esc_attr ( $_GET[ 'feed-series' ] ); |
|
664 | 664 | } |
665 | 665 | |
666 | - $permalink_structure = get_option( 'permalink_structure' ); |
|
666 | + $permalink_structure = get_option ( 'permalink_structure' ); |
|
667 | 667 | |
668 | 668 | if ( $permalink_structure ) { |
669 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
670 | - $feed_url = $this->home_url . 'feed/' . $feed_slug; |
|
669 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
670 | + $feed_url = $this->home_url.'feed/'.$feed_slug; |
|
671 | 671 | } else { |
672 | - $feed_url = $this->home_url . '?feed=' . $this->token; |
|
672 | + $feed_url = $this->home_url.'?feed='.$this->token; |
|
673 | 673 | } |
674 | 674 | |
675 | - if( $feed_series && $feed_series != 'default' ) { |
|
675 | + if ( $feed_series && $feed_series != 'default' ) { |
|
676 | 676 | if ( $permalink_structure ) { |
677 | - $feed_url .= '/' . $feed_series; |
|
677 | + $feed_url .= '/'.$feed_series; |
|
678 | 678 | } else { |
679 | - $feed_url .= '&podcast_series=' . $feed_series; |
|
679 | + $feed_url .= '&podcast_series='.$feed_series; |
|
680 | 680 | } |
681 | 681 | } |
682 | 682 | |
683 | - if( $feed_url ) { |
|
684 | - $html .= '<p><a class="view-feed-link" href="' . esc_url( $feed_url ) . '" target="_blank"><span class="dashicons dashicons-rss"></span>' . __( 'View feed', 'seriously-simple-podcasting' ) . '</a></p>' . "\n"; |
|
683 | + if ( $feed_url ) { |
|
684 | + $html .= '<p><a class="view-feed-link" href="'.esc_url ( $feed_url ).'" target="_blank"><span class="dashicons dashicons-rss"></span>'.__ ( 'View feed', 'seriously-simple-podcasting' ).'</a></p>'."\n"; |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | } |
@@ -696,116 +696,116 @@ discard block |
||
696 | 696 | */ |
697 | 697 | public function display_field( $args ) { |
698 | 698 | |
699 | - $field = $args['field']; |
|
699 | + $field = $args[ 'field' ]; |
|
700 | 700 | |
701 | 701 | $html = ''; |
702 | 702 | |
703 | 703 | // Get option name |
704 | - $option_name = $this->settings_base . $field['id']; |
|
704 | + $option_name = $this->settings_base.$field[ 'id' ]; |
|
705 | 705 | $default_option_name = $option_name; |
706 | 706 | |
707 | 707 | // Get field default |
708 | 708 | $default = ''; |
709 | - if ( isset( $field['default'] ) ) { |
|
710 | - $default = $field['default']; |
|
709 | + if ( isset( $field[ 'default' ] ) ) { |
|
710 | + $default = $field[ 'default' ]; |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | // Get option value |
714 | - $data = get_option( $option_name, $default ); |
|
714 | + $data = get_option ( $option_name, $default ); |
|
715 | 715 | |
716 | 716 | // Get specific series data if applicable |
717 | - if ( isset( $args['feed-series'] ) && $args['feed-series'] ) { |
|
717 | + if ( isset( $args[ 'feed-series' ] ) && $args[ 'feed-series' ] ) { |
|
718 | 718 | |
719 | 719 | $option_default = ''; |
720 | 720 | |
721 | 721 | // Set placeholder to default feed option with specified default fallback |
722 | 722 | if ( $data ) { |
723 | - $field['placeholder'] = $data; |
|
723 | + $field[ 'placeholder' ] = $data; |
|
724 | 724 | |
725 | - if ( in_array( $field['type'], array( 'checkbox', 'select', 'image' ) ) ) { |
|
725 | + if ( in_array ( $field[ 'type' ], array( 'checkbox', 'select', 'image' ) ) ) { |
|
726 | 726 | $option_default = $data; |
727 | 727 | } |
728 | 728 | } |
729 | 729 | |
730 | 730 | // Append series ID to option name |
731 | - $option_name .= '_' . $args['feed-series']; |
|
731 | + $option_name .= '_'.$args[ 'feed-series' ]; |
|
732 | 732 | |
733 | 733 | // Get series-sepcific option |
734 | - $data = get_option( $option_name, $option_default ); |
|
734 | + $data = get_option ( $option_name, $option_default ); |
|
735 | 735 | |
736 | 736 | } |
737 | 737 | |
738 | 738 | // Get field class if supplied |
739 | 739 | $class = ''; |
740 | - if ( isset( $field['class'] ) ) { |
|
741 | - $class = $field['class']; |
|
740 | + if ( isset( $field[ 'class' ] ) ) { |
|
741 | + $class = $field[ 'class' ]; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | // Get parent class if supplied |
745 | 745 | $parent_class = ''; |
746 | - if ( isset( $field['parent_class'] ) ) { |
|
747 | - $parent_class = $field['parent_class']; |
|
746 | + if ( isset( $field[ 'parent_class' ] ) ) { |
|
747 | + $parent_class = $field[ 'parent_class' ]; |
|
748 | 748 | } |
749 | 749 | |
750 | - switch( $field['type'] ) { |
|
750 | + switch ( $field[ 'type' ] ) { |
|
751 | 751 | case 'text': |
752 | 752 | case 'password': |
753 | 753 | case 'number': |
754 | - $html .= '<input id="' . esc_attr( $field['id'] ) . '" type="' . $field['type'] . '" name="' . esc_attr( $option_name ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" value="' . esc_attr( $data ) . '" class="' . $class . '"/>' . "\n"; |
|
754 | + $html .= '<input id="'.esc_attr ( $field[ 'id' ] ).'" type="'.$field[ 'type' ].'" name="'.esc_attr ( $option_name ).'" placeholder="'.esc_attr ( $field[ 'placeholder' ] ).'" value="'.esc_attr ( $data ).'" class="'.$class.'"/>'."\n"; |
|
755 | 755 | break; |
756 | 756 | |
757 | 757 | case 'text_secret': |
758 | - $placeholder = $field['placeholder']; |
|
758 | + $placeholder = $field[ 'placeholder' ]; |
|
759 | 759 | if ( $data ) { |
760 | - $placeholder = __( 'Password stored securely', 'seriously-simple-podcasting' ); |
|
760 | + $placeholder = __ ( 'Password stored securely', 'seriously-simple-podcasting' ); |
|
761 | 761 | } |
762 | - $html .= '<input id="' . esc_attr( $field['id'] ) . '" type="text" name="' . esc_attr( $option_name ) . '" placeholder="' . esc_attr( $placeholder ) . '" value="" class="' . $class . '"/>' . "\n"; |
|
762 | + $html .= '<input id="'.esc_attr ( $field[ 'id' ] ).'" type="text" name="'.esc_attr ( $option_name ).'" placeholder="'.esc_attr ( $placeholder ).'" value="" class="'.$class.'"/>'."\n"; |
|
763 | 763 | break; |
764 | 764 | |
765 | 765 | case 'textarea': |
766 | - $html .= '<textarea id="' . esc_attr( $field['id'] ) . '" rows="5" cols="50" name="' . esc_attr( $option_name ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" class="' . $class . '">' . $data . '</textarea><br/>'. "\n"; |
|
766 | + $html .= '<textarea id="'.esc_attr ( $field[ 'id' ] ).'" rows="5" cols="50" name="'.esc_attr ( $option_name ).'" placeholder="'.esc_attr ( $field[ 'placeholder' ] ).'" class="'.$class.'">'.$data.'</textarea><br/>'."\n"; |
|
767 | 767 | break; |
768 | 768 | |
769 | 769 | case 'checkbox': |
770 | 770 | $checked = ''; |
771 | - if ( $data && 'on' == $data ){ |
|
771 | + if ( $data && 'on' == $data ) { |
|
772 | 772 | $checked = 'checked="checked"'; |
773 | 773 | } |
774 | - $html .= '<input id="' . esc_attr( $field['id'] ) . '" type="' . $field['type'] . '" name="' . esc_attr( $option_name ) . '" ' . $checked . ' class="' . $class . '"/>' . "\n"; |
|
774 | + $html .= '<input id="'.esc_attr ( $field[ 'id' ] ).'" type="'.$field[ 'type' ].'" name="'.esc_attr ( $option_name ).'" '.$checked.' class="'.$class.'"/>'."\n"; |
|
775 | 775 | break; |
776 | 776 | |
777 | 777 | case 'checkbox_multi': |
778 | - foreach ( $field['options'] as $k => $v ) { |
|
778 | + foreach ( $field[ 'options' ] as $k => $v ) { |
|
779 | 779 | $checked = false; |
780 | - if ( in_array( $k, (array) $data ) ) { |
|
780 | + if ( in_array ( $k, (array) $data ) ) { |
|
781 | 781 | $checked = true; |
782 | 782 | } |
783 | - $html .= '<label for="' . esc_attr( $field['id'] . '_' . $k ) . '"><input type="checkbox" ' . checked( $checked, true, false ) . ' name="' . esc_attr( $option_name ) . '[]" value="' . esc_attr( $k ) . '" id="' . esc_attr( $field['id'] . '_' . $k ) . '" class="' . $class . '" /> ' . $v . '</label><br/>'; |
|
783 | + $html .= '<label for="'.esc_attr ( $field[ 'id' ].'_'.$k ).'"><input type="checkbox" '.checked ( $checked, true, false ).' name="'.esc_attr ( $option_name ).'[]" value="'.esc_attr ( $k ).'" id="'.esc_attr ( $field[ 'id' ].'_'.$k ).'" class="'.$class.'" /> '.$v.'</label><br/>'; |
|
784 | 784 | } |
785 | 785 | break; |
786 | 786 | |
787 | 787 | case 'radio': |
788 | - foreach ( $field['options'] as $k => $v ) { |
|
788 | + foreach ( $field[ 'options' ] as $k => $v ) { |
|
789 | 789 | $checked = false; |
790 | 790 | if ( $k == $data ) { |
791 | 791 | $checked = true; |
792 | 792 | } |
793 | - $html .= '<label for="' . esc_attr( $field['id'] . '_' . $k ) . '"><input type="radio" ' . checked( $checked, true, false ) . ' name="' . esc_attr( $option_name ) . '" value="' . esc_attr( $k ) . '" id="' . esc_attr( $field['id'] . '_' . $k ) . '" class="' . $class . '" /> ' . $v . '</label><br/>'; |
|
793 | + $html .= '<label for="'.esc_attr ( $field[ 'id' ].'_'.$k ).'"><input type="radio" '.checked ( $checked, true, false ).' name="'.esc_attr ( $option_name ).'" value="'.esc_attr ( $k ).'" id="'.esc_attr ( $field[ 'id' ].'_'.$k ).'" class="'.$class.'" /> '.$v.'</label><br/>'; |
|
794 | 794 | } |
795 | 795 | break; |
796 | 796 | |
797 | 797 | case 'select': |
798 | 798 | |
799 | - $html .= '<select name="' . esc_attr( $option_name ) . '" id="' . esc_attr( $field['id'] ) . '" class="' . $class . '">'; |
|
799 | + $html .= '<select name="'.esc_attr ( $option_name ).'" id="'.esc_attr ( $field[ 'id' ] ).'" class="'.$class.'">'; |
|
800 | 800 | $prev_group = ''; |
801 | - foreach ( $field['options'] as $k => $v ) { |
|
801 | + foreach ( $field[ 'options' ] as $k => $v ) { |
|
802 | 802 | |
803 | 803 | $group = ''; |
804 | - if ( is_array( $v ) ) { |
|
805 | - if ( isset( $v['group'] ) ) { |
|
806 | - $group = $v['group']; |
|
804 | + if ( is_array ( $v ) ) { |
|
805 | + if ( isset( $v[ 'group' ] ) ) { |
|
806 | + $group = $v[ 'group' ]; |
|
807 | 807 | } |
808 | - $v = $v['label']; |
|
808 | + $v = $v[ 'label' ]; |
|
809 | 809 | } |
810 | 810 | |
811 | 811 | if ( $prev_group && $group != $prev_group ) { |
@@ -818,10 +818,10 @@ discard block |
||
818 | 818 | } |
819 | 819 | |
820 | 820 | if ( $group && $group != $prev_group ) { |
821 | - $html .= '<optgroup label="' . esc_attr( $group ) . '">'; |
|
821 | + $html .= '<optgroup label="'.esc_attr ( $group ).'">'; |
|
822 | 822 | } |
823 | 823 | |
824 | - $html .= '<option ' . selected( $selected, true, false ) . ' value="' . esc_attr( $k ) . '">' . esc_html( $v ) . '</option>'; |
|
824 | + $html .= '<option '.selected ( $selected, true, false ).' value="'.esc_attr ( $k ).'">'.esc_html ( $v ).'</option>'; |
|
825 | 825 | |
826 | 826 | $prev_group = $group; |
827 | 827 | } |
@@ -829,65 +829,65 @@ discard block |
||
829 | 829 | break; |
830 | 830 | |
831 | 831 | case 'image': |
832 | - $html .= '<img id="' . esc_attr( $default_option_name ) . '_preview" src="' . esc_attr( $data ) . '" style="max-width:400px;height:auto;" /><br/>' . "\n"; |
|
833 | - $html .= '<input id="' . esc_attr( $default_option_name ) . '_button" type="button" class="button" value="'. __( 'Upload new image' , 'seriously-simple-podcasting' ) . '" />' . "\n"; |
|
834 | - $html .= '<input id="' . esc_attr( $default_option_name ) . '_delete" type="button" class="button" value="'. __( 'Remove image' , 'seriously-simple-podcasting' ) . '" />' . "\n"; |
|
835 | - $html .= '<input id="' . esc_attr( $default_option_name ) . '" type="hidden" name="' . esc_attr( $option_name ) . '" value="' . esc_attr( $data ) . '"/><br/>' . "\n"; |
|
832 | + $html .= '<img id="'.esc_attr ( $default_option_name ).'_preview" src="'.esc_attr ( $data ).'" style="max-width:400px;height:auto;" /><br/>'."\n"; |
|
833 | + $html .= '<input id="'.esc_attr ( $default_option_name ).'_button" type="button" class="button" value="'.__ ( 'Upload new image', 'seriously-simple-podcasting' ).'" />'."\n"; |
|
834 | + $html .= '<input id="'.esc_attr ( $default_option_name ).'_delete" type="button" class="button" value="'.__ ( 'Remove image', 'seriously-simple-podcasting' ).'" />'."\n"; |
|
835 | + $html .= '<input id="'.esc_attr ( $default_option_name ).'" type="hidden" name="'.esc_attr ( $option_name ).'" value="'.esc_attr ( $data ).'"/><br/>'."\n"; |
|
836 | 836 | break; |
837 | 837 | |
838 | 838 | case 'feed_link': |
839 | 839 | |
840 | 840 | // Set feed URL based on site's permalink structure |
841 | - if ( get_option( 'permalink_structure' ) ) { |
|
842 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
843 | - $url = $this->home_url . 'feed/' . $feed_slug; |
|
841 | + if ( get_option ( 'permalink_structure' ) ) { |
|
842 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
843 | + $url = $this->home_url.'feed/'.$feed_slug; |
|
844 | 844 | } else { |
845 | - $url = $this->home_url . '?feed=' . $this->token; |
|
845 | + $url = $this->home_url.'?feed='.$this->token; |
|
846 | 846 | } |
847 | 847 | |
848 | - $html .= '<a href="' . esc_url( $url ) . '" target="_blank">' . $url . '</a>'; |
|
848 | + $html .= '<a href="'.esc_url ( $url ).'" target="_blank">'.$url.'</a>'; |
|
849 | 849 | break; |
850 | 850 | |
851 | 851 | case 'feed_link_series': |
852 | 852 | |
853 | 853 | // Set feed URL based on site's permalink structure |
854 | - if ( get_option( 'permalink_structure' ) ) { |
|
855 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
856 | - $url = $this->home_url . 'feed/' . $feed_slug . '/series-slug'; |
|
854 | + if ( get_option ( 'permalink_structure' ) ) { |
|
855 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
856 | + $url = $this->home_url.'feed/'.$feed_slug.'/series-slug'; |
|
857 | 857 | } else { |
858 | - $url = $this->home_url . '?feed=' . $this->token . '&podcast_series=series-slug'; |
|
858 | + $url = $this->home_url.'?feed='.$this->token.'&podcast_series=series-slug'; |
|
859 | 859 | } |
860 | 860 | |
861 | - $html .= esc_url( $url ) . "\n"; |
|
861 | + $html .= esc_url ( $url )."\n"; |
|
862 | 862 | break; |
863 | 863 | |
864 | 864 | case 'podcast_url'; |
865 | 865 | |
866 | - $slug = apply_filters( 'ssp_archive_slug', __( 'podcast' , 'seriously-simple-podcasting' ) ); |
|
867 | - $podcast_url = $this->home_url . $slug; |
|
866 | + $slug = apply_filters ( 'ssp_archive_slug', __ ( 'podcast', 'seriously-simple-podcasting' ) ); |
|
867 | + $podcast_url = $this->home_url.$slug; |
|
868 | 868 | |
869 | - $html .= '<a href="' . esc_url( $podcast_url ) . '" target="_blank">' . $podcast_url . '</a>'; |
|
869 | + $html .= '<a href="'.esc_url ( $podcast_url ).'" target="_blank">'.$podcast_url.'</a>'; |
|
870 | 870 | break; |
871 | 871 | |
872 | 872 | } |
873 | 873 | |
874 | - if ( ! in_array( $field['type'], array( 'feed_link', 'feed_link_series', 'podcast_url' ) ) ) { |
|
875 | - switch( $field['type'] ) { |
|
874 | + if ( ! in_array ( $field[ 'type' ], array( 'feed_link', 'feed_link_series', 'podcast_url' ) ) ) { |
|
875 | + switch ( $field[ 'type' ] ) { |
|
876 | 876 | |
877 | 877 | case 'checkbox_multi': |
878 | 878 | case 'radio': |
879 | 879 | case 'select_multi': |
880 | - $html .= '<br/><span class="description">' . esc_attr( $field['description'] ) . '</span>'; |
|
880 | + $html .= '<br/><span class="description">'.esc_attr ( $field[ 'description' ] ).'</span>'; |
|
881 | 881 | break; |
882 | 882 | |
883 | 883 | default: |
884 | - $html .= '<label for="' . esc_attr( $field['id'] ) . '"><span class="description">' . wp_kses_post( $field['description'] ) . '</span></label>' . "\n"; |
|
884 | + $html .= '<label for="'.esc_attr ( $field[ 'id' ] ).'"><span class="description">'.wp_kses_post ( $field[ 'description' ] ).'</span></label>'."\n"; |
|
885 | 885 | break; |
886 | 886 | } |
887 | 887 | } |
888 | 888 | |
889 | - if( $parent_class ) { |
|
890 | - $html = '<div class="' . $parent_class . '">' . $html . '</div>'; |
|
889 | + if ( $parent_class ) { |
|
890 | + $html = '<div class="'.$parent_class.'">'.$html.'</div>'; |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | echo $html; |
@@ -899,8 +899,8 @@ discard block |
||
899 | 899 | * @return string Validated string |
900 | 900 | */ |
901 | 901 | public function validate_slug( $slug ) { |
902 | - if ( $slug && strlen( $slug ) > 0 && $slug != '' ) { |
|
903 | - $slug = urlencode( strtolower( str_replace( ' ' , '-' , $slug ) ) ); |
|
902 | + if ( $slug && strlen ( $slug ) > 0 && $slug != '' ) { |
|
903 | + $slug = urlencode ( strtolower ( str_replace ( ' ', '-', $slug ) ) ); |
|
904 | 904 | } |
905 | 905 | return $slug; |
906 | 906 | } |
@@ -912,10 +912,10 @@ discard block |
||
912 | 912 | */ |
913 | 913 | public function encode_password( $password ) { |
914 | 914 | |
915 | - if ( $password && strlen( $password ) > 0 && $password != '' ) { |
|
916 | - $password = md5( $password ); |
|
915 | + if ( $password && strlen ( $password ) > 0 && $password != '' ) { |
|
916 | + $password = md5 ( $password ); |
|
917 | 917 | } else { |
918 | - $option = get_option( 'ss_podcasting_protection_password' ); |
|
918 | + $option = get_option ( 'ss_podcasting_protection_password' ); |
|
919 | 919 | $password = $option; |
920 | 920 | } |
921 | 921 | |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | 'p' => array() |
944 | 944 | ); |
945 | 945 | |
946 | - $message = wp_kses( $message, $allowed ); |
|
946 | + $message = wp_kses ( $message, $allowed ); |
|
947 | 947 | } |
948 | 948 | |
949 | 949 | return $message; |
@@ -960,8 +960,8 @@ discard block |
||
960 | 960 | |
961 | 961 | if ( $option == 'ss_podcasting_redirect_feed' ) { |
962 | 962 | if ( ( $new_value != $old_value ) && $new_value == 'on' ) { |
963 | - $date = time(); |
|
964 | - update_option( 'ss_podcasting_redirect_feed_date', $date ); |
|
963 | + $date = time (); |
|
964 | + update_option ( 'ss_podcasting_redirect_feed_date', $date ); |
|
965 | 965 | } |
966 | 966 | } |
967 | 967 | |
@@ -974,64 +974,64 @@ discard block |
||
974 | 974 | public function settings_page() { |
975 | 975 | |
976 | 976 | // Build page HTML |
977 | - $html = '<div class="wrap" id="podcast_settings">' . "\n"; |
|
978 | - $html .= '<h1>' . __( 'Podcast Settings' , 'seriously-simple-podcasting' ) . '</h1>' . "\n"; |
|
977 | + $html = '<div class="wrap" id="podcast_settings">'."\n"; |
|
978 | + $html .= '<h1>'.__ ( 'Podcast Settings', 'seriously-simple-podcasting' ).'</h1>'."\n"; |
|
979 | 979 | |
980 | 980 | $tab = 'general'; |
981 | - if ( isset( $_GET['tab'] ) && $_GET['tab'] ) { |
|
982 | - $tab = $_GET['tab']; |
|
981 | + if ( isset( $_GET[ 'tab' ] ) && $_GET[ 'tab' ] ) { |
|
982 | + $tab = $_GET[ 'tab' ]; |
|
983 | 983 | } |
984 | 984 | |
985 | 985 | // Show page tabs |
986 | - if ( is_array( $this->settings ) && 1 < count( $this->settings ) ) { |
|
986 | + if ( is_array ( $this->settings ) && 1 < count ( $this->settings ) ) { |
|
987 | 987 | |
988 | - $html .= '<h2 class="nav-tab-wrapper">' . "\n"; |
|
988 | + $html .= '<h2 class="nav-tab-wrapper">'."\n"; |
|
989 | 989 | |
990 | 990 | $c = 0; |
991 | 991 | foreach ( $this->settings as $section => $data ) { |
992 | 992 | |
993 | 993 | // Set tab class |
994 | 994 | $class = 'nav-tab'; |
995 | - if ( ! isset( $_GET['tab'] ) ) { |
|
995 | + if ( ! isset( $_GET[ 'tab' ] ) ) { |
|
996 | 996 | if ( 0 == $c ) { |
997 | 997 | $class .= ' nav-tab-active'; |
998 | 998 | } |
999 | 999 | } else { |
1000 | - if ( isset( $_GET['tab'] ) && $section == $_GET['tab'] ) { |
|
1000 | + if ( isset( $_GET[ 'tab' ] ) && $section == $_GET[ 'tab' ] ) { |
|
1001 | 1001 | $class .= ' nav-tab-active'; |
1002 | 1002 | } |
1003 | 1003 | } |
1004 | 1004 | |
1005 | 1005 | // Set tab link |
1006 | - $tab_link = add_query_arg( array( 'tab' => $section ) ); |
|
1007 | - if ( isset( $_GET['settings-updated'] ) ) { |
|
1008 | - $tab_link = remove_query_arg( 'settings-updated', $tab_link ); |
|
1006 | + $tab_link = add_query_arg ( array( 'tab' => $section ) ); |
|
1007 | + if ( isset( $_GET[ 'settings-updated' ] ) ) { |
|
1008 | + $tab_link = remove_query_arg ( 'settings-updated', $tab_link ); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | - if ( isset( $_GET['feed-series'] ) ) { |
|
1012 | - $tab_link = remove_query_arg( 'feed-series', $tab_link ); |
|
1011 | + if ( isset( $_GET[ 'feed-series' ] ) ) { |
|
1012 | + $tab_link = remove_query_arg ( 'feed-series', $tab_link ); |
|
1013 | 1013 | } |
1014 | 1014 | |
1015 | 1015 | // Output tab |
1016 | - $html .= '<a href="' . esc_url( $tab_link ) . '" class="' . esc_attr( $class ) . '">' . esc_html( $data['title'] ) . '</a>' . "\n"; |
|
1016 | + $html .= '<a href="'.esc_url ( $tab_link ).'" class="'.esc_attr ( $class ).'">'.esc_html ( $data[ 'title' ] ).'</a>'."\n"; |
|
1017 | 1017 | |
1018 | 1018 | ++$c; |
1019 | 1019 | } |
1020 | 1020 | |
1021 | - $html .= '</h2>' . "\n"; |
|
1021 | + $html .= '</h2>'."\n"; |
|
1022 | 1022 | } |
1023 | 1023 | |
1024 | - if ( isset( $_GET['settings-updated'] ) ) { |
|
1024 | + if ( isset( $_GET[ 'settings-updated' ] ) ) { |
|
1025 | 1025 | $html .= '<br/><div class="updated notice notice-success is-dismissible"> |
1026 | - <p>' . sprintf( __( '%1$s settings updated.', 'seriously-simple-podcasting' ), '<b>' . str_replace( '-', ' ', ucfirst( $tab ) ) . '</b>' ) . '</p> |
|
1026 | + <p>' . sprintf ( __ ( '%1$s settings updated.', 'seriously-simple-podcasting' ), '<b>'.str_replace ( '-', ' ', ucfirst ( $tab ) ).'</b>' ).'</p> |
|
1027 | 1027 | </div>'; |
1028 | 1028 | } |
1029 | 1029 | |
1030 | - if( function_exists( 'php_sapi_name') && 'security' == $tab ) { |
|
1031 | - $sapi_type = php_sapi_name(); |
|
1032 | - if ( strpos( $sapi_type, 'fcgi' ) !== false ) { |
|
1030 | + if ( function_exists ( 'php_sapi_name' ) && 'security' == $tab ) { |
|
1031 | + $sapi_type = php_sapi_name (); |
|
1032 | + if ( strpos ( $sapi_type, 'fcgi' ) !== false ) { |
|
1033 | 1033 | $html .= '<br/><div class="update-nag"> |
1034 | - <p>' . sprintf( __( 'It looks like your server has FastCGI enabled, which will prevent the feed password protection feature from working. You can fix this by following %1$sthis quick guide%2$s.', 'seriously-simple-podcasting' ), '<a href="http://www.seriouslysimplepodcasting.com/documentation/why-does-the-feed-password-protection-feature-not-work/" target="_blank">', '</a>' ) . '</p> |
|
1034 | + <p>' . sprintf ( __ ( 'It looks like your server has FastCGI enabled, which will prevent the feed password protection feature from working. You can fix this by following %1$sthis quick guide%2$s.', 'seriously-simple-podcasting' ), '<a href="http://www.seriouslysimplepodcasting.com/documentation/why-does-the-feed-password-protection-feature-not-work/" target="_blank">', '</a>' ).'</p> |
|
1035 | 1035 | </div>'; |
1036 | 1036 | } |
1037 | 1037 | } |
@@ -1040,23 +1040,23 @@ discard block |
||
1040 | 1040 | |
1041 | 1041 | // Series submenu for feed details |
1042 | 1042 | if ( 'feed-details' == $tab ) { |
1043 | - $series = get_terms( 'series', array( 'hide_empty' => false ) ); |
|
1043 | + $series = get_terms ( 'series', array( 'hide_empty' => false ) ); |
|
1044 | 1044 | |
1045 | 1045 | if ( ! empty( $series ) ) { |
1046 | 1046 | |
1047 | - if ( isset( $_GET['feed-series'] ) && $_GET['feed-series'] && 'default' != $_GET['feed-series'] ) { |
|
1048 | - $current_series = esc_attr( $_GET['feed-series'] ); |
|
1047 | + if ( isset( $_GET[ 'feed-series' ] ) && $_GET[ 'feed-series' ] && 'default' != $_GET[ 'feed-series' ] ) { |
|
1048 | + $current_series = esc_attr ( $_GET[ 'feed-series' ] ); |
|
1049 | 1049 | $series_class = ''; |
1050 | 1050 | } else { |
1051 | 1051 | $current_series = 'default'; |
1052 | 1052 | $series_class = 'current'; |
1053 | 1053 | } |
1054 | 1054 | |
1055 | - $html .= '<div class="feed-series-list-container">' . "\n"; |
|
1056 | - $html .= '<span id="feed-series-toggle" class="series-open" title="' . __( 'Toggle series list display', 'seriously-simple-podcasting' ) . '"></span>' . "\n"; |
|
1055 | + $html .= '<div class="feed-series-list-container">'."\n"; |
|
1056 | + $html .= '<span id="feed-series-toggle" class="series-open" title="'.__ ( 'Toggle series list display', 'seriously-simple-podcasting' ).'"></span>'."\n"; |
|
1057 | 1057 | |
1058 | - $html .= '<ul id="feed-series-list" class="subsubsub series-open">' . "\n"; |
|
1059 | - $html .= '<li><a href="' . add_query_arg( array( 'feed-series' => 'default', 'settings-updated' => false ) ) . '" class="' . $series_class . '">' . __( 'Default feed', 'seriously-simple-podcasting' ) . '</a></li>'; |
|
1058 | + $html .= '<ul id="feed-series-list" class="subsubsub series-open">'."\n"; |
|
1059 | + $html .= '<li><a href="'.add_query_arg ( array( 'feed-series' => 'default', 'settings-updated' => false ) ).'" class="'.$series_class.'">'.__ ( 'Default feed', 'seriously-simple-podcasting' ).'</a></li>'; |
|
1060 | 1060 | |
1061 | 1061 | foreach ( $series as $s ) { |
1062 | 1062 | |
@@ -1066,39 +1066,39 @@ discard block |
||
1066 | 1066 | $series_class = ''; |
1067 | 1067 | } |
1068 | 1068 | |
1069 | - $html .= '<li>' . "\n"; |
|
1070 | - $html .= ' | <a href="' . esc_url( add_query_arg( array( 'feed-series' => $s->slug, 'settings-updated' => false ) ) ) . '" class="' . $series_class . '">' . $s->name . '</a>' . "\n"; |
|
1071 | - $html .= '</li>' . "\n"; |
|
1069 | + $html .= '<li>'."\n"; |
|
1070 | + $html .= ' | <a href="'.esc_url ( add_query_arg ( array( 'feed-series' => $s->slug, 'settings-updated' => false ) ) ).'" class="'.$series_class.'">'.$s->name.'</a>'."\n"; |
|
1071 | + $html .= '</li>'."\n"; |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | - $html .= '</ul>' . "\n"; |
|
1075 | - $html .= '<br class="clear" />' . "\n"; |
|
1076 | - $html .= '</div>' . "\n"; |
|
1074 | + $html .= '</ul>'."\n"; |
|
1075 | + $html .= '<br class="clear" />'."\n"; |
|
1076 | + $html .= '</div>'."\n"; |
|
1077 | 1077 | |
1078 | 1078 | } |
1079 | 1079 | } |
1080 | 1080 | |
1081 | - $html .= '<form method="post" action="options.php" enctype="multipart/form-data">' . "\n"; |
|
1081 | + $html .= '<form method="post" action="options.php" enctype="multipart/form-data">'."\n"; |
|
1082 | 1082 | |
1083 | 1083 | // Add current series to posted data |
1084 | 1084 | if ( $current_series ) { |
1085 | - $html .= '<input type="hidden" name="feed-series" value="' . esc_attr( $current_series ) . '" />' . "\n"; |
|
1085 | + $html .= '<input type="hidden" name="feed-series" value="'.esc_attr ( $current_series ).'" />'."\n"; |
|
1086 | 1086 | } |
1087 | 1087 | |
1088 | 1088 | // Get settings fields |
1089 | - ob_start(); |
|
1090 | - settings_fields( 'ss_podcasting' ); |
|
1091 | - do_settings_sections( 'ss_podcasting' ); |
|
1092 | - $html .= ob_get_clean(); |
|
1089 | + ob_start (); |
|
1090 | + settings_fields ( 'ss_podcasting' ); |
|
1091 | + do_settings_sections ( 'ss_podcasting' ); |
|
1092 | + $html .= ob_get_clean (); |
|
1093 | 1093 | |
1094 | 1094 | // Submit button |
1095 | - $html .= '<p class="submit">' . "\n"; |
|
1096 | - $html .= '<input type="hidden" name="tab" value="' . esc_attr( $tab ) . '" />' . "\n"; |
|
1097 | - $html .= '<input name="Submit" type="submit" class="button-primary" value="' . esc_attr( __( 'Save Settings' , 'seriously-simple-podcasting' ) ) . '" />' . "\n"; |
|
1098 | - $html .= '</p>' . "\n"; |
|
1095 | + $html .= '<p class="submit">'."\n"; |
|
1096 | + $html .= '<input type="hidden" name="tab" value="'.esc_attr ( $tab ).'" />'."\n"; |
|
1097 | + $html .= '<input name="Submit" type="submit" class="button-primary" value="'.esc_attr ( __ ( 'Save Settings', 'seriously-simple-podcasting' ) ).'" />'."\n"; |
|
1098 | + $html .= '</p>'."\n"; |
|
1099 | 1099 | |
1100 | - $html .= '</form>' . "\n"; |
|
1101 | - $html .= '</div>' . "\n"; |
|
1100 | + $html .= '</form>'."\n"; |
|
1101 | + $html .= '</div>'."\n"; |
|
1102 | 1102 | |
1103 | 1103 | echo $html; |
1104 | 1104 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | * @since 1.0.0 |
407 | 407 | * @return mixed |
408 | 408 | */ |
409 | - function ssp_readfile_chunked( $file, $retbytes = true ) { |
|
409 | + function ssp_readfile_chunked( $file, $retbytes = true ) { |
|
410 | 410 | |
411 | 411 | $chunksize = 1 * ( 1024 * 1024 ); |
412 | 412 | $cnt = 0; |
@@ -434,5 +434,5 @@ discard block |
||
434 | 434 | } |
435 | 435 | |
436 | 436 | return $status; |
437 | - } |
|
437 | + } |
|
438 | 438 | } |
439 | 439 | \ No newline at end of file |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly. |
4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined ( 'ABSPATH' ) ) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
8 | -if ( ! function_exists( 'is_podcast_download' ) ) { |
|
8 | +if ( ! function_exists ( 'is_podcast_download' ) ) { |
|
9 | 9 | /** |
10 | 10 | * Check if podcast file is being downloaded |
11 | 11 | * @since 1.5 |
@@ -16,16 +16,16 @@ discard block |
||
16 | 16 | |
17 | 17 | $download = $episode = false; |
18 | 18 | |
19 | - if ( isset( $wp_query->query_vars['podcast_episode'] ) && $wp_query->query_vars['podcast_episode'] ) { |
|
19 | + if ( isset( $wp_query->query_vars[ 'podcast_episode' ] ) && $wp_query->query_vars[ 'podcast_episode' ] ) { |
|
20 | 20 | $download = true; |
21 | - $episode = intval( $wp_query->query_vars['podcast_episode'] ); |
|
21 | + $episode = intval ( $wp_query->query_vars[ 'podcast_episode' ] ); |
|
22 | 22 | } |
23 | 23 | |
24 | - return apply_filters( 'ssp_is_podcast_download', $download, $episode ); |
|
24 | + return apply_filters ( 'ssp_is_podcast_download', $download, $episode ); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
28 | -if ( ! function_exists( 'ss_get_podcast' ) ) { |
|
28 | +if ( ! function_exists ( 'ss_get_podcast' ) ) { |
|
29 | 29 | /** |
30 | 30 | * Wrapper function to get the podcast episodes from the SeriouslySimplePodcasting class. |
31 | 31 | * @param mixed $args Arguments |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function ss_get_podcast( $args = '' ) { |
36 | 36 | global $ss_podcasting; |
37 | - return $ss_podcasting->get_podcast( $args ); |
|
37 | + return $ss_podcasting->get_podcast ( $args ); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * Enable the usage of do_action( 'get_podcast' ) to display podcast within a theme/plugin. |
43 | 43 | * @since 1.0.0 |
44 | 44 | */ |
45 | -add_action( 'get_podcast', 'ss_podcast' ); |
|
45 | +add_action ( 'get_podcast', 'ss_podcast' ); |
|
46 | 46 | |
47 | -if ( ! function_exists( 'ss_podcast' ) ) { |
|
47 | +if ( ! function_exists ( 'ss_podcast' ) ) { |
|
48 | 48 | /** |
49 | 49 | * Display or return HTML-formatted podcast data. |
50 | 50 | * @param mixed $args Arguments |
@@ -66,57 +66,57 @@ discard block |
||
66 | 66 | 'after_title' => '</h3>' |
67 | 67 | ); |
68 | 68 | |
69 | - $args = wp_parse_args( $args, $defaults ); |
|
69 | + $args = wp_parse_args ( $args, $defaults ); |
|
70 | 70 | |
71 | 71 | // Allow child themes/plugins to filter here |
72 | - $args = apply_filters( 'ssp_podcast_args', $args ); |
|
72 | + $args = apply_filters ( 'ssp_podcast_args', $args ); |
|
73 | 73 | $html = ''; |
74 | 74 | |
75 | - do_action( 'ssp_podcast_before', $args ); |
|
75 | + do_action ( 'ssp_podcast_before', $args ); |
|
76 | 76 | |
77 | 77 | // The Query |
78 | - $query = ss_get_podcast( $args ); |
|
78 | + $query = ss_get_podcast ( $args ); |
|
79 | 79 | |
80 | 80 | // The Display |
81 | - if ( ! is_wp_error( $query ) && is_array( $query ) && count( $query ) > 0 ) { |
|
82 | - $html .= $args['before'] . "\n"; |
|
81 | + if ( ! is_wp_error ( $query ) && is_array ( $query ) && count ( $query ) > 0 ) { |
|
82 | + $html .= $args[ 'before' ]."\n"; |
|
83 | 83 | |
84 | - if ( '' != $args['title'] ) { |
|
85 | - $html .= $args['before_title'] . esc_html( $args['title'] ) . $args['after_title'] . "\n"; |
|
84 | + if ( '' != $args[ 'title' ] ) { |
|
85 | + $html .= $args[ 'before_title' ].esc_html ( $args[ 'title' ] ).$args[ 'after_title' ]."\n"; |
|
86 | 86 | } |
87 | 87 | |
88 | - $html .= '<div class="ss_podcast">' . "\n"; |
|
88 | + $html .= '<div class="ss_podcast">'."\n"; |
|
89 | 89 | |
90 | 90 | // Begin templating logic. |
91 | 91 | $tpl = '<div class="%%CLASS%%"><h4 class="podcast-title">%%TITLE%%</h4><aside class="meta">%%META%%</aside></div>'; |
92 | - $tpl = apply_filters( 'ssp_podcast_item_template', $tpl, $args ); |
|
92 | + $tpl = apply_filters ( 'ssp_podcast_item_template', $tpl, $args ); |
|
93 | 93 | |
94 | - if ( $query['content'] == 'episodes' ) { |
|
94 | + if ( $query[ 'content' ] == 'episodes' ) { |
|
95 | 95 | |
96 | 96 | $i = 0; |
97 | 97 | foreach ( $query as $post ) { |
98 | 98 | |
99 | - if ( ! is_object( $post ) ) { |
|
99 | + if ( ! is_object ( $post ) ) { |
|
100 | 100 | continue; |
101 | 101 | } |
102 | 102 | |
103 | 103 | $template = $tpl; |
104 | 104 | $i++; |
105 | 105 | |
106 | - setup_postdata( $post ); |
|
106 | + setup_postdata ( $post ); |
|
107 | 107 | |
108 | 108 | $class = 'podcast'; |
109 | 109 | |
110 | - $title = get_the_title(); |
|
111 | - if ( true == $args['link_title'] ) { |
|
112 | - $title = '<a href="' . esc_url( $post->url ) . '" title="' . esc_attr( $title ) . '">' . $title . '</a>'; |
|
110 | + $title = get_the_title (); |
|
111 | + if ( true == $args[ 'link_title' ] ) { |
|
112 | + $title = '<a href="'.esc_url ( $post->url ).'" title="'.esc_attr ( $title ).'">'.$title.'</a>'; |
|
113 | 113 | } |
114 | 114 | |
115 | - $meta = $ss_podcasting->episode_meta( $post->ID, 'shortcode' ); |
|
115 | + $meta = $ss_podcasting->episode_meta ( $post->ID, 'shortcode' ); |
|
116 | 116 | |
117 | - $template = str_replace( '%%CLASS%%', $class, $template ); |
|
118 | - $template = str_replace( '%%TITLE%%', $title, $template ); |
|
119 | - $template = str_replace( '%%META%%', $meta, $template ); |
|
117 | + $template = str_replace ( '%%CLASS%%', $class, $template ); |
|
118 | + $template = str_replace ( '%%TITLE%%', $title, $template ); |
|
119 | + $template = str_replace ( '%%META%%', $meta, $template ); |
|
120 | 120 | |
121 | 121 | $html .= $template; |
122 | 122 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $i = 0; |
128 | 128 | foreach ( $query as $series ) { |
129 | 129 | |
130 | - if ( ! is_object( $series ) ) continue; |
|
130 | + if ( ! is_object ( $series ) ) continue; |
|
131 | 131 | |
132 | 132 | $template = $tpl; |
133 | 133 | $i++; |
@@ -135,15 +135,15 @@ discard block |
||
135 | 135 | $class = 'podcast'; |
136 | 136 | |
137 | 137 | $title = $series->title; |
138 | - if ( true == $args['link_title'] ) { |
|
139 | - $title = '<a href="' . esc_url( $series->url ) . '" title="' . esc_attr( $title ) . '">' . $title . '</a>'; |
|
138 | + if ( true == $args[ 'link_title' ] ) { |
|
139 | + $title = '<a href="'.esc_url ( $series->url ).'" title="'.esc_attr ( $title ).'">'.$title.'</a>'; |
|
140 | 140 | } |
141 | 141 | |
142 | - $template = str_replace( '%%CLASS%%', $class, $template ); |
|
143 | - $template = str_replace( '%%TITLE%%', $title, $template ); |
|
142 | + $template = str_replace ( '%%CLASS%%', $class, $template ); |
|
143 | + $template = str_replace ( '%%TITLE%%', $title, $template ); |
|
144 | 144 | |
145 | - $meta = $series->count . __( ' episodes' , 'seriously-simple-podcasting' ); |
|
146 | - $template = str_replace( '%%META%%' , $meta , $template ); |
|
145 | + $meta = $series->count.__ ( ' episodes', 'seriously-simple-podcasting' ); |
|
146 | + $template = str_replace ( '%%META%%', $meta, $template ); |
|
147 | 147 | |
148 | 148 | $html .= $template; |
149 | 149 | |
@@ -151,36 +151,36 @@ discard block |
||
151 | 151 | |
152 | 152 | } |
153 | 153 | |
154 | - $html .= '<div class="fix"></div>' . "\n"; |
|
154 | + $html .= '<div class="fix"></div>'."\n"; |
|
155 | 155 | |
156 | - $html .= '</div><!--/.ss_podcast-->' . "\n"; |
|
157 | - $html .= $args['after'] . "\n"; |
|
156 | + $html .= '</div><!--/.ss_podcast-->'."\n"; |
|
157 | + $html .= $args[ 'after' ]."\n"; |
|
158 | 158 | |
159 | - wp_reset_postdata(); |
|
159 | + wp_reset_postdata (); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | // Allow themes/plugins to filter here |
163 | - $html = apply_filters( 'ssp_podcast_html', $html, $query, $args ); |
|
163 | + $html = apply_filters ( 'ssp_podcast_html', $html, $query, $args ); |
|
164 | 164 | |
165 | - if ( ! $args['echo'] ) { |
|
165 | + if ( ! $args[ 'echo' ] ) { |
|
166 | 166 | return $html; |
167 | 167 | } |
168 | 168 | |
169 | 169 | // Should only run if "echo" is set to true |
170 | 170 | echo $html; |
171 | 171 | |
172 | - do_action( 'ssp_podcast_after', $args ); |
|
172 | + do_action ( 'ssp_podcast_after', $args ); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | -if ( ! function_exists( 'ss_podcast_shortcode' ) ) { |
|
176 | +if ( ! function_exists ( 'ss_podcast_shortcode' ) ) { |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Load podcast shortcode |
180 | 180 | * @param array $atts Shortcode attributes |
181 | 181 | * @return string HTML output |
182 | 182 | */ |
183 | - function ss_podcast_shortcode ( $atts ) { |
|
183 | + function ss_podcast_shortcode( $atts ) { |
|
184 | 184 | |
185 | 185 | $defaults = array( |
186 | 186 | 'title' => '', |
@@ -191,27 +191,27 @@ discard block |
||
191 | 191 | 'link_title' => true |
192 | 192 | ); |
193 | 193 | |
194 | - $args = shortcode_atts( $defaults, $atts ); |
|
194 | + $args = shortcode_atts ( $defaults, $atts ); |
|
195 | 195 | |
196 | 196 | // Make sure we return and don't echo. |
197 | - $args['echo'] = false; |
|
197 | + $args[ 'echo' ] = false; |
|
198 | 198 | |
199 | - return ss_podcast( $args ); |
|
199 | + return ss_podcast ( $args ); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | -if ( ! function_exists( 'ssp_episode_ids' ) ) { |
|
203 | +if ( ! function_exists ( 'ssp_episode_ids' ) ) { |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Get post IDs of all podcast episodes for all post types |
207 | 207 | * @since 1.8.2 |
208 | 208 | * @return array |
209 | 209 | */ |
210 | - function ssp_episode_ids () { |
|
210 | + function ssp_episode_ids() { |
|
211 | 211 | global $ss_podcasting; |
212 | 212 | |
213 | 213 | // Remove action to prevent infinite loop |
214 | - remove_action( 'pre_get_posts', array( $ss_podcasting, 'add_all_post_types' ) ); |
|
214 | + remove_action ( 'pre_get_posts', array( $ss_podcasting, 'add_all_post_types' ) ); |
|
215 | 215 | |
216 | 216 | // Setup the default args |
217 | 217 | $args = array( |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | ); |
223 | 223 | |
224 | 224 | // Do we have any additional post types to add? |
225 | - $podcast_post_types = ssp_post_types( false ); |
|
225 | + $podcast_post_types = ssp_post_types ( false ); |
|
226 | 226 | |
227 | 227 | if ( ! empty( $podcast_post_types ) ) { |
228 | - $args['post_type'] = ssp_post_types(); |
|
229 | - $args['meta_query'] = array( |
|
228 | + $args[ 'post_type' ] = ssp_post_types (); |
|
229 | + $args[ 'meta_query' ] = array( |
|
230 | 230 | array( |
231 | 231 | 'key' => 'audio_file', |
232 | 232 | 'compare' => '!=', |
@@ -238,23 +238,23 @@ discard block |
||
238 | 238 | // Do we have this stored in the cache? |
239 | 239 | $key = 'episode_ids'; |
240 | 240 | $group = 'ssp'; |
241 | - $podcast_episodes = wp_cache_get( $key, $group ); |
|
241 | + $podcast_episodes = wp_cache_get ( $key, $group ); |
|
242 | 242 | |
243 | 243 | // If nothing in cache then fetch episodes again and store in cache |
244 | 244 | if ( $podcast_episodes === false ) { |
245 | - $podcast_episodes = get_posts( $args ); |
|
246 | - wp_cache_set( $key, $podcast_episodes, $group, HOUR_IN_SECONDS * 12 ); |
|
245 | + $podcast_episodes = get_posts ( $args ); |
|
246 | + wp_cache_set ( $key, $podcast_episodes, $group, HOUR_IN_SECONDS * 12 ); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | // Reinstate action for future queries |
250 | - add_action( 'pre_get_posts', array( $ss_podcasting, 'add_all_post_types' ) ); |
|
250 | + add_action ( 'pre_get_posts', array( $ss_podcasting, 'add_all_post_types' ) ); |
|
251 | 251 | |
252 | 252 | return $podcast_episodes; |
253 | 253 | } |
254 | 254 | |
255 | 255 | } |
256 | 256 | |
257 | -if ( ! function_exists( 'ssp_episodes' ) ) { |
|
257 | +if ( ! function_exists ( 'ssp_episodes' ) ) { |
|
258 | 258 | |
259 | 259 | /** |
260 | 260 | * Fetch all podcast episodes |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | * @since 1.8.2 |
266 | 266 | * @return array Array of posts or array of query args |
267 | 267 | */ |
268 | - function ssp_episodes ( $n = 10, $series = '', $return_args = false, $context = '' ) { |
|
268 | + function ssp_episodes( $n = 10, $series = '', $return_args = false, $context = '' ) { |
|
269 | 269 | |
270 | 270 | // Get all podcast episodes IDs |
271 | - $episode_ids = (array) ssp_episode_ids(); |
|
271 | + $episode_ids = (array) ssp_episode_ids (); |
|
272 | 272 | |
273 | 273 | if ( $context === 'glance' ) { |
274 | 274 | return $episode_ids; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | // Get all valid podcast post types |
282 | - $podcast_post_types = ssp_post_types( true ); |
|
282 | + $podcast_post_types = ssp_post_types ( true ); |
|
283 | 283 | |
284 | 284 | if ( empty ( $podcast_post_types ) ) { |
285 | 285 | return array(); |
@@ -295,24 +295,24 @@ discard block |
||
295 | 295 | ); |
296 | 296 | |
297 | 297 | if ( $series ) { |
298 | - $args['series'] = esc_attr( $series ); |
|
298 | + $args[ 'series' ] = esc_attr ( $series ); |
|
299 | 299 | } |
300 | 300 | |
301 | - $args = apply_filters( 'ssp_episode_query_args', $args, $context ); |
|
301 | + $args = apply_filters ( 'ssp_episode_query_args', $args, $context ); |
|
302 | 302 | |
303 | 303 | if ( $return_args ) { |
304 | 304 | return $args; |
305 | 305 | } |
306 | 306 | |
307 | 307 | // Do we have anything in the cache here? |
308 | - $key = 'episodes_' . $series; |
|
308 | + $key = 'episodes_'.$series; |
|
309 | 309 | $group = 'ssp'; |
310 | - $posts = wp_cache_get( $key, $group ); |
|
310 | + $posts = wp_cache_get ( $key, $group ); |
|
311 | 311 | |
312 | 312 | // If nothing in cache then fetch episodes again and store in cache |
313 | 313 | if ( $posts === false ) { |
314 | - $posts = get_posts( $args ); |
|
315 | - wp_cache_add( $key, $posts, $group, HOUR_IN_SECONDS * 12 ); |
|
314 | + $posts = get_posts ( $args ); |
|
315 | + wp_cache_add ( $key, $posts, $group, HOUR_IN_SECONDS * 12 ); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | return $posts; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | } |
322 | 322 | |
323 | -if ( ! function_exists( 'ssp_post_types' ) ) { |
|
323 | +if ( ! function_exists ( 'ssp_post_types' ) ) { |
|
324 | 324 | |
325 | 325 | /** |
326 | 326 | * Fetch all valid podcast post types |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | * @since 1.8.7 |
329 | 329 | * @return array Array of podcast post types |
330 | 330 | */ |
331 | - function ssp_post_types ( $include_podcast = true ) { |
|
331 | + function ssp_post_types( $include_podcast = true ) { |
|
332 | 332 | |
333 | 333 | // Get saved podcast post type option |
334 | - $podcast_post_types = get_option( 'ss_podcasting_use_post_types', array() ); |
|
334 | + $podcast_post_types = get_option ( 'ss_podcasting_use_post_types', array() ); |
|
335 | 335 | |
336 | 336 | // Add `podcast` post type to array if required |
337 | 337 | if ( $include_podcast ) { |
338 | - $podcast_post_types[] = 'podcast'; |
|
338 | + $podcast_post_types[ ] = 'podcast'; |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | $valid_podcast_post_types = array(); |
@@ -344,36 +344,36 @@ discard block |
||
344 | 344 | if ( ! empty( $podcast_post_types ) ) { |
345 | 345 | |
346 | 346 | foreach ( $podcast_post_types as $type ) { |
347 | - if ( post_type_exists( $type ) ) { |
|
348 | - $valid_podcast_post_types[] = $type; |
|
347 | + if ( post_type_exists ( $type ) ) { |
|
348 | + $valid_podcast_post_types[ ] = $type; |
|
349 | 349 | } |
350 | 350 | } |
351 | 351 | |
352 | 352 | } |
353 | 353 | |
354 | 354 | // Return only the valid podcast post types |
355 | - return apply_filters( 'ssp_podcast_post_types', $valid_podcast_post_types, $include_podcast ); |
|
355 | + return apply_filters ( 'ssp_podcast_post_types', $valid_podcast_post_types, $include_podcast ); |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | |
359 | -if( ! function_exists( 'ssp_get_feed_category_output' ) ) { |
|
359 | +if ( ! function_exists ( 'ssp_get_feed_category_output' ) ) { |
|
360 | 360 | |
361 | 361 | /** |
362 | 362 | * Get the XML markup for the feed category st the specified level |
363 | 363 | * @param int $level Category level |
364 | 364 | * @return string XML output for feed vategory |
365 | 365 | */ |
366 | - function ssp_get_feed_category_output ( $level = 1, $series_id ) { |
|
366 | + function ssp_get_feed_category_output( $level = 1, $series_id ) { |
|
367 | 367 | |
368 | 368 | $level = (int) $level; |
369 | 369 | |
370 | - if( 1 == $level ) { |
|
370 | + if ( 1 == $level ) { |
|
371 | 371 | $level = ''; |
372 | 372 | } |
373 | 373 | |
374 | - $category = get_option( 'ss_podcasting_data_category' . $level, '' ); |
|
374 | + $category = get_option ( 'ss_podcasting_data_category'.$level, '' ); |
|
375 | 375 | if ( $series_id ) { |
376 | - $series_category = get_option( 'ss_podcasting_data_category' . $level . '_' . $series_id, 'no-category' ); |
|
376 | + $series_category = get_option ( 'ss_podcasting_data_category'.$level.'_'.$series_id, 'no-category' ); |
|
377 | 377 | if ( 'no-category' != $series_category ) { |
378 | 378 | $category = $series_category; |
379 | 379 | } |
@@ -382,21 +382,21 @@ discard block |
||
382 | 382 | $category = ''; |
383 | 383 | $subcategory = ''; |
384 | 384 | } else { |
385 | - $subcategory = get_option( 'ss_podcasting_data_subcategory' . $level, '' ); |
|
385 | + $subcategory = get_option ( 'ss_podcasting_data_subcategory'.$level, '' ); |
|
386 | 386 | if ( $series_id ) { |
387 | - $series_subcategory = get_option( 'ss_podcasting_data_subcategory' . $level . '_' . $series_id, 'no-subcategory' ); |
|
387 | + $series_subcategory = get_option ( 'ss_podcasting_data_subcategory'.$level.'_'.$series_id, 'no-subcategory' ); |
|
388 | 388 | if ( 'no-subcategory' != $series_subcategory ) { |
389 | 389 | $subcategory = $series_subcategory; |
390 | 390 | } |
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
394 | - return apply_filters( 'ssp_feed_category_output', array( 'category' => $category, 'subcategory' => $subcategory ), $level, $series_id ); |
|
394 | + return apply_filters ( 'ssp_feed_category_output', array( 'category' => $category, 'subcategory' => $subcategory ), $level, $series_id ); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | } |
398 | 398 | |
399 | -if ( ! function_exists( 'ssp_readfile_chunked' ) ) { |
|
399 | +if ( ! function_exists ( 'ssp_readfile_chunked' ) ) { |
|
400 | 400 | |
401 | 401 | /** |
402 | 402 | * Reads file in chunks so big downloads are possible without changing PHP.INI - http://codeigniter.com/wiki/Download_helper_for_large_files/ |
@@ -411,23 +411,23 @@ discard block |
||
411 | 411 | $chunksize = 1 * ( 1024 * 1024 ); |
412 | 412 | $cnt = 0; |
413 | 413 | |
414 | - $handle = fopen( $file, 'r' ); |
|
414 | + $handle = fopen ( $file, 'r' ); |
|
415 | 415 | if ( $handle === false ) { |
416 | 416 | return false; |
417 | 417 | } |
418 | 418 | |
419 | - while ( ! feof( $handle ) ) { |
|
420 | - $buffer = fread( $handle, $chunksize ); |
|
419 | + while ( ! feof ( $handle ) ) { |
|
420 | + $buffer = fread ( $handle, $chunksize ); |
|
421 | 421 | echo $buffer; |
422 | - ob_flush(); |
|
423 | - flush(); |
|
422 | + ob_flush (); |
|
423 | + flush (); |
|
424 | 424 | |
425 | 425 | if ( $retbytes ) { |
426 | - $cnt += strlen( $buffer ); |
|
426 | + $cnt += strlen ( $buffer ); |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 | |
430 | - $status = fclose( $handle ); |
|
430 | + $status = fclose ( $handle ); |
|
431 | 431 | |
432 | 432 | if ( $retbytes && $status ) { |
433 | 433 | return $cnt; |
@@ -127,7 +127,9 @@ |
||
127 | 127 | $i = 0; |
128 | 128 | foreach ( $query as $series ) { |
129 | 129 | |
130 | - if ( ! is_object( $series ) ) continue; |
|
130 | + if ( ! is_object( $series ) ) { |
|
131 | + continue; |
|
132 | + } |
|
131 | 133 | |
132 | 134 | $template = $tpl; |
133 | 135 | $i++; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly. |
4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined ( 'ABSPATH' ) ) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
@@ -26,118 +26,118 @@ discard block |
||
26 | 26 | public function __construct() { |
27 | 27 | /* Widget variable settings. */ |
28 | 28 | $this->widget_cssclass = 'widget_recent_entries widget_recent_episodes'; |
29 | - $this->widget_description = __( 'Display a list of your most recent podcast episodes.', 'seriously-simple-podcasting' ); |
|
29 | + $this->widget_description = __ ( 'Display a list of your most recent podcast episodes.', 'seriously-simple-podcasting' ); |
|
30 | 30 | $this->widget_idbase = 'ss_podcast'; |
31 | - $this->widget_title = __( 'Podcast: Recent Episodes', 'seriously-simple-podcasting' ); |
|
31 | + $this->widget_title = __ ( 'Podcast: Recent Episodes', 'seriously-simple-podcasting' ); |
|
32 | 32 | |
33 | 33 | /* Widget settings. */ |
34 | 34 | $widget_ops = array( 'classname' => $this->widget_cssclass, 'description' => $this->widget_description ); |
35 | 35 | |
36 | - parent::__construct('recent-podcast-episodes', $this->widget_title, $widget_ops); |
|
36 | + parent::__construct ( 'recent-podcast-episodes', $this->widget_title, $widget_ops ); |
|
37 | 37 | |
38 | 38 | $this->alt_option_name = 'widget_recent_episodes'; |
39 | 39 | |
40 | - add_action( 'save_post', array( $this, 'flush_widget_cache' ) ); |
|
41 | - add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) ); |
|
42 | - add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) ); |
|
40 | + add_action ( 'save_post', array( $this, 'flush_widget_cache' ) ); |
|
41 | + add_action ( 'deleted_post', array( $this, 'flush_widget_cache' ) ); |
|
42 | + add_action ( 'switch_theme', array( $this, 'flush_widget_cache' ) ); |
|
43 | 43 | |
44 | 44 | } // End __construct() |
45 | 45 | |
46 | - public function widget($args, $instance) { |
|
46 | + public function widget( $args, $instance ) { |
|
47 | 47 | $cache = array(); |
48 | - if ( ! $this->is_preview() ) { |
|
49 | - $cache = wp_cache_get( 'widget_recent_episodes', 'widget' ); |
|
48 | + if ( ! $this->is_preview () ) { |
|
49 | + $cache = wp_cache_get ( 'widget_recent_episodes', 'widget' ); |
|
50 | 50 | } |
51 | 51 | |
52 | - if ( ! is_array( $cache ) ) { |
|
52 | + if ( ! is_array ( $cache ) ) { |
|
53 | 53 | $cache = array(); |
54 | 54 | } |
55 | 55 | |
56 | - if ( ! isset( $args['widget_id'] ) ) { |
|
57 | - $args['widget_id'] = $this->id; |
|
56 | + if ( ! isset( $args[ 'widget_id' ] ) ) { |
|
57 | + $args[ 'widget_id' ] = $this->id; |
|
58 | 58 | } |
59 | 59 | |
60 | - if ( isset( $cache[ $args['widget_id'] ] ) ) { |
|
61 | - echo $cache[ $args['widget_id'] ]; |
|
60 | + if ( isset( $cache[ $args[ 'widget_id' ] ] ) ) { |
|
61 | + echo $cache[ $args[ 'widget_id' ] ]; |
|
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
65 | - ob_start(); |
|
65 | + ob_start (); |
|
66 | 66 | |
67 | - $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Episodes', 'seriously-simple-podcasting' ); |
|
67 | + $title = ( ! empty( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : __ ( 'Recent Episodes', 'seriously-simple-podcasting' ); |
|
68 | 68 | |
69 | 69 | /** This filter is documented in wp-includes/default-widgets.php */ |
70 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
70 | + $title = apply_filters ( 'widget_title', $title, $instance, $this->id_base ); |
|
71 | 71 | |
72 | - $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; |
|
72 | + $number = ( ! empty( $instance[ 'number' ] ) ) ? absint ( $instance[ 'number' ] ) : 5; |
|
73 | 73 | if ( ! $number ) { |
74 | 74 | $number = 5; |
75 | 75 | } |
76 | 76 | |
77 | - $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false; |
|
77 | + $show_date = isset( $instance[ 'show_date' ] ) ? $instance[ 'show_date' ] : false; |
|
78 | 78 | |
79 | - $query_args = ssp_episodes( $number, '', true, 'widget' ); |
|
79 | + $query_args = ssp_episodes ( $number, '', true, 'widget' ); |
|
80 | 80 | |
81 | - $qry = new WP_Query( apply_filters( 'ssp_widget_recent_episodes_args', $query_args ) ); |
|
81 | + $qry = new WP_Query ( apply_filters ( 'ssp_widget_recent_episodes_args', $query_args ) ); |
|
82 | 82 | |
83 | - if ($qry->have_posts()) : |
|
83 | + if ( $qry->have_posts () ) : |
|
84 | 84 | ?> |
85 | - <?php echo $args['before_widget']; ?> |
|
85 | + <?php echo $args[ 'before_widget' ]; ?> |
|
86 | 86 | <?php if ( $title ) { |
87 | - echo $args['before_title'] . $title . $args['after_title']; |
|
87 | + echo $args[ 'before_title' ].$title.$args[ 'after_title' ]; |
|
88 | 88 | } ?> |
89 | 89 | <ul> |
90 | - <?php while ( $qry->have_posts() ) : $qry->the_post(); ?> |
|
90 | + <?php while ( $qry->have_posts () ) : $qry->the_post (); ?> |
|
91 | 91 | <li> |
92 | - <a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?></a> |
|
92 | + <a href="<?php the_permalink (); ?>"><?php get_the_title () ? the_title () : the_ID (); ?></a> |
|
93 | 93 | <?php if ( $show_date ) : ?> |
94 | - <span class="post-date"><?php echo get_the_date(); ?></span> |
|
94 | + <span class="post-date"><?php echo get_the_date (); ?></span> |
|
95 | 95 | <?php endif; ?> |
96 | 96 | </li> |
97 | 97 | <?php endwhile; ?> |
98 | 98 | </ul> |
99 | - <?php echo $args['after_widget']; ?> |
|
99 | + <?php echo $args[ 'after_widget' ]; ?> |
|
100 | 100 | <?php |
101 | 101 | // Reset the global $the_post as this query will have stomped on it |
102 | - wp_reset_postdata(); |
|
102 | + wp_reset_postdata (); |
|
103 | 103 | |
104 | 104 | endif; |
105 | 105 | |
106 | - if ( ! $this->is_preview() ) { |
|
107 | - $cache[ $args['widget_id'] ] = ob_get_flush(); |
|
108 | - wp_cache_set( 'widget_recent_episodes', $cache, 'widget' ); |
|
106 | + if ( ! $this->is_preview () ) { |
|
107 | + $cache[ $args[ 'widget_id' ] ] = ob_get_flush (); |
|
108 | + wp_cache_set ( 'widget_recent_episodes', $cache, 'widget' ); |
|
109 | 109 | } else { |
110 | - ob_end_flush(); |
|
110 | + ob_end_flush (); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | 114 | public function update( $new_instance, $old_instance ) { |
115 | 115 | $instance = $old_instance; |
116 | - $instance['title'] = strip_tags($new_instance['title']); |
|
117 | - $instance['number'] = (int) $new_instance['number']; |
|
118 | - $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false; |
|
119 | - $this->flush_widget_cache(); |
|
116 | + $instance[ 'title' ] = strip_tags ( $new_instance[ 'title' ] ); |
|
117 | + $instance[ 'number' ] = (int) $new_instance[ 'number' ]; |
|
118 | + $instance[ 'show_date' ] = isset( $new_instance[ 'show_date' ] ) ? (bool) $new_instance[ 'show_date' ] : false; |
|
119 | + $this->flush_widget_cache (); |
|
120 | 120 | |
121 | 121 | return $instance; |
122 | 122 | } |
123 | 123 | |
124 | 124 | public function flush_widget_cache() { |
125 | - wp_cache_delete('widget_recent_episodes', 'widget'); |
|
125 | + wp_cache_delete ( 'widget_recent_episodes', 'widget' ); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | public function form( $instance ) { |
129 | - $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; |
|
130 | - $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; |
|
131 | - $show_date = isset( $instance['show_date'] ) ? (bool) $instance['show_date'] : false; |
|
129 | + $title = isset( $instance[ 'title' ] ) ? esc_attr ( $instance[ 'title' ] ) : ''; |
|
130 | + $number = isset( $instance[ 'number' ] ) ? absint ( $instance[ 'number' ] ) : 5; |
|
131 | + $show_date = isset( $instance[ 'show_date' ] ) ? (bool) $instance[ 'show_date' ] : false; |
|
132 | 132 | ?> |
133 | - <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'seriously-simple-podcasting' ); ?></label> |
|
134 | - <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p> |
|
133 | + <p><label for="<?php echo $this->get_field_id ( 'title' ); ?>"><?php _e ( 'Title:', 'seriously-simple-podcasting' ); ?></label> |
|
134 | + <input class="widefat" id="<?php echo $this->get_field_id ( 'title' ); ?>" name="<?php echo $this->get_field_name ( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p> |
|
135 | 135 | |
136 | - <p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of episodes to show:', 'seriously-simple-podcasting' ); ?></label> |
|
137 | - <input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p> |
|
136 | + <p><label for="<?php echo $this->get_field_id ( 'number' ); ?>"><?php _e ( 'Number of episodes to show:', 'seriously-simple-podcasting' ); ?></label> |
|
137 | + <input id="<?php echo $this->get_field_id ( 'number' ); ?>" name="<?php echo $this->get_field_name ( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p> |
|
138 | 138 | |
139 | - <p><input class="checkbox" type="checkbox" <?php checked( $show_date ); ?> id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" /> |
|
140 | - <label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Display episode date?', 'seriously-simple-podcasting' ); ?></label></p> |
|
139 | + <p><input class="checkbox" type="checkbox" <?php checked ( $show_date ); ?> id="<?php echo $this->get_field_id ( 'show_date' ); ?>" name="<?php echo $this->get_field_name ( 'show_date' ); ?>" /> |
|
140 | + <label for="<?php echo $this->get_field_id ( 'show_date' ); ?>"><?php _e ( 'Display episode date?', 'seriously-simple-podcasting' ); ?></label></p> |
|
141 | 141 | <?php |
142 | 142 | } |
143 | 143 | } // End Class |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly. |
4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined ( 'ABSPATH' ) ) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
@@ -26,74 +26,74 @@ discard block |
||
26 | 26 | public function __construct() { |
27 | 27 | /* Widget variable settings. */ |
28 | 28 | $this->widget_cssclass = 'widget_podcast_series'; |
29 | - $this->widget_description = __( 'Display a list of episodes from a single series.', 'seriously-simple-podcasting' ); |
|
29 | + $this->widget_description = __ ( 'Display a list of episodes from a single series.', 'seriously-simple-podcasting' ); |
|
30 | 30 | $this->widget_idbase = 'ss_podcast'; |
31 | - $this->widget_title = __( 'Podcast: Series', 'seriously-simple-podcasting' ); |
|
31 | + $this->widget_title = __ ( 'Podcast: Series', 'seriously-simple-podcasting' ); |
|
32 | 32 | |
33 | 33 | /* Widget settings. */ |
34 | 34 | $widget_ops = array( 'classname' => $this->widget_cssclass, 'description' => $this->widget_description ); |
35 | 35 | |
36 | - parent::__construct('podcast-series', $this->widget_title, $widget_ops); |
|
36 | + parent::__construct ( 'podcast-series', $this->widget_title, $widget_ops ); |
|
37 | 37 | |
38 | 38 | $this->alt_option_name = 'widget_podcast_series'; |
39 | 39 | |
40 | - add_action( 'save_post', array( $this, 'flush_widget_cache' ) ); |
|
41 | - add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) ); |
|
42 | - add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) ); |
|
40 | + add_action ( 'save_post', array( $this, 'flush_widget_cache' ) ); |
|
41 | + add_action ( 'deleted_post', array( $this, 'flush_widget_cache' ) ); |
|
42 | + add_action ( 'switch_theme', array( $this, 'flush_widget_cache' ) ); |
|
43 | 43 | |
44 | 44 | } // End __construct() |
45 | 45 | |
46 | - public function widget($args, $instance) { |
|
46 | + public function widget( $args, $instance ) { |
|
47 | 47 | $cache = array(); |
48 | - if ( ! $this->is_preview() ) { |
|
49 | - $cache = wp_cache_get( 'widget_podcast_series', 'widget' ); |
|
48 | + if ( ! $this->is_preview () ) { |
|
49 | + $cache = wp_cache_get ( 'widget_podcast_series', 'widget' ); |
|
50 | 50 | } |
51 | 51 | |
52 | - if ( ! is_array( $cache ) ) { |
|
52 | + if ( ! is_array ( $cache ) ) { |
|
53 | 53 | $cache = array(); |
54 | 54 | } |
55 | 55 | |
56 | - if ( ! isset( $args['widget_id'] ) ) { |
|
57 | - $args['widget_id'] = $this->id; |
|
56 | + if ( ! isset( $args[ 'widget_id' ] ) ) { |
|
57 | + $args[ 'widget_id' ] = $this->id; |
|
58 | 58 | } |
59 | 59 | |
60 | - if ( isset( $cache[ $args['widget_id'] ] ) ) { |
|
61 | - echo $cache[ $args['widget_id'] ]; |
|
60 | + if ( isset( $cache[ $args[ 'widget_id' ] ] ) ) { |
|
61 | + echo $cache[ $args[ 'widget_id' ] ]; |
|
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
65 | - ob_start(); |
|
65 | + ob_start (); |
|
66 | 66 | |
67 | - $series_id = $instance['series_id']; |
|
67 | + $series_id = $instance[ 'series_id' ]; |
|
68 | 68 | |
69 | 69 | if ( ! $series_id ) { |
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | - $series = get_term( $series_id, 'series' ); |
|
73 | + $series = get_term ( $series_id, 'series' ); |
|
74 | 74 | |
75 | - if ( ! $series || is_wp_error( $series ) ) { |
|
75 | + if ( ! $series || is_wp_error ( $series ) ) { |
|
76 | 76 | return; |
77 | 77 | } |
78 | 78 | |
79 | - $title = ( $instance['title'] ) ? $instance['title'] : $series->name; |
|
79 | + $title = ( $instance[ 'title' ] ) ? $instance[ 'title' ] : $series->name; |
|
80 | 80 | |
81 | 81 | /** This filter is documented in wp-includes/default-widgets.php */ |
82 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
82 | + $title = apply_filters ( 'widget_title', $title, $instance, $this->id_base ); |
|
83 | 83 | |
84 | - $show_title = isset( $instance['show_title'] ) ? $instance['show_title'] : false; |
|
85 | - $show_desc = isset( $instance['show_desc'] ) ? $instance['show_desc'] : false; |
|
86 | - $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false; |
|
84 | + $show_title = isset( $instance[ 'show_title' ] ) ? $instance[ 'show_title' ] : false; |
|
85 | + $show_desc = isset( $instance[ 'show_desc' ] ) ? $instance[ 'show_desc' ] : false; |
|
86 | + $show_date = isset( $instance[ 'show_date' ] ) ? $instance[ 'show_date' ] : false; |
|
87 | 87 | |
88 | - $query_args = ssp_episodes( 999, $series->slug, true, 'widget' ); |
|
88 | + $query_args = ssp_episodes ( 999, $series->slug, true, 'widget' ); |
|
89 | 89 | |
90 | - $qry = new WP_Query( apply_filters( 'ssp_widget_series_episodes_args', $query_args ) ); |
|
90 | + $qry = new WP_Query ( apply_filters ( 'ssp_widget_series_episodes_args', $query_args ) ); |
|
91 | 91 | |
92 | - if ( $qry->have_posts() ) : |
|
92 | + if ( $qry->have_posts () ) : |
|
93 | 93 | ?> |
94 | - <?php echo $args['before_widget']; ?> |
|
94 | + <?php echo $args[ 'before_widget' ]; ?> |
|
95 | 95 | <?php if ( $title ) { |
96 | - echo $args['before_title'] . $title . $args['after_title']; |
|
96 | + echo $args[ 'before_title' ].$title.$args[ 'after_title' ]; |
|
97 | 97 | } ?> |
98 | 98 | |
99 | 99 | <?php if ( $show_title ) { ?> |
@@ -105,77 +105,77 @@ discard block |
||
105 | 105 | <?php } ?> |
106 | 106 | |
107 | 107 | <ul> |
108 | - <?php while ( $qry->have_posts() ) : $qry->the_post(); ?> |
|
108 | + <?php while ( $qry->have_posts () ) : $qry->the_post (); ?> |
|
109 | 109 | <li> |
110 | - <a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?></a> |
|
110 | + <a href="<?php the_permalink (); ?>"><?php get_the_title () ? the_title () : the_ID (); ?></a> |
|
111 | 111 | <?php if ( $show_date ) : ?> |
112 | - <span class="post-date"><?php echo get_the_date(); ?></span> |
|
112 | + <span class="post-date"><?php echo get_the_date (); ?></span> |
|
113 | 113 | <?php endif; ?> |
114 | 114 | </li> |
115 | 115 | <?php endwhile; ?> |
116 | 116 | </ul> |
117 | - <?php echo $args['after_widget']; ?> |
|
117 | + <?php echo $args[ 'after_widget' ]; ?> |
|
118 | 118 | <?php |
119 | 119 | // Reset the global $the_post as this query will have stomped on it |
120 | - wp_reset_postdata(); |
|
120 | + wp_reset_postdata (); |
|
121 | 121 | |
122 | 122 | endif; |
123 | 123 | |
124 | - if ( ! $this->is_preview() ) { |
|
125 | - $cache[ $args['widget_id'] ] = ob_get_flush(); |
|
126 | - wp_cache_set( 'widget_podcast_series', $cache, 'widget' ); |
|
124 | + if ( ! $this->is_preview () ) { |
|
125 | + $cache[ $args[ 'widget_id' ] ] = ob_get_flush (); |
|
126 | + wp_cache_set ( 'widget_podcast_series', $cache, 'widget' ); |
|
127 | 127 | } else { |
128 | - ob_end_flush(); |
|
128 | + ob_end_flush (); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
132 | 132 | public function update( $new_instance, $old_instance ) { |
133 | 133 | $instance = $old_instance; |
134 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
135 | - $instance['series_id'] = isset( $new_instance['series_id'] ) ? (int) $new_instance['series_id'] : 0; |
|
136 | - $instance['show_title'] = isset( $new_instance['show_title'] ) ? (bool) $new_instance['show_title'] : false; |
|
137 | - $instance['show_desc'] = isset( $new_instance['show_desc'] ) ? (bool) $new_instance['show_desc'] : false; |
|
138 | - $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false; |
|
139 | - $this->flush_widget_cache(); |
|
134 | + $instance[ 'title' ] = strip_tags ( $new_instance[ 'title' ] ); |
|
135 | + $instance[ 'series_id' ] = isset( $new_instance[ 'series_id' ] ) ? (int) $new_instance[ 'series_id' ] : 0; |
|
136 | + $instance[ 'show_title' ] = isset( $new_instance[ 'show_title' ] ) ? (bool) $new_instance[ 'show_title' ] : false; |
|
137 | + $instance[ 'show_desc' ] = isset( $new_instance[ 'show_desc' ] ) ? (bool) $new_instance[ 'show_desc' ] : false; |
|
138 | + $instance[ 'show_date' ] = isset( $new_instance[ 'show_date' ] ) ? (bool) $new_instance[ 'show_date' ] : false; |
|
139 | + $this->flush_widget_cache (); |
|
140 | 140 | |
141 | 141 | return $instance; |
142 | 142 | } |
143 | 143 | |
144 | 144 | public function flush_widget_cache() { |
145 | - wp_cache_delete('widget_podcast_series', 'widget'); |
|
145 | + wp_cache_delete ( 'widget_podcast_series', 'widget' ); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | public function form( $instance ) { |
149 | - $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; |
|
150 | - $series_id = isset( $instance['series_id'] ) ? $instance['series_id'] : 0; |
|
151 | - $show_title = isset( $instance['show_title'] ) ? (bool) $instance['show_title'] : false; |
|
152 | - $show_desc = isset( $instance['show_desc'] ) ? (bool) $instance['show_desc'] : false; |
|
153 | - $show_date = isset( $instance['show_date'] ) ? (bool) $instance['show_date'] : false; |
|
149 | + $title = isset( $instance[ 'title' ] ) ? esc_attr ( $instance[ 'title' ] ) : ''; |
|
150 | + $series_id = isset( $instance[ 'series_id' ] ) ? $instance[ 'series_id' ] : 0; |
|
151 | + $show_title = isset( $instance[ 'show_title' ] ) ? (bool) $instance[ 'show_title' ] : false; |
|
152 | + $show_desc = isset( $instance[ 'show_desc' ] ) ? (bool) $instance[ 'show_desc' ] : false; |
|
153 | + $show_date = isset( $instance[ 'show_date' ] ) ? (bool) $instance[ 'show_date' ] : false; |
|
154 | 154 | |
155 | 155 | // Get all podcast series |
156 | - $series = get_terms( 'series' ); |
|
156 | + $series = get_terms ( 'series' ); |
|
157 | 157 | ?> |
158 | - <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'seriously-simple-podcasting' ); ?></label> |
|
159 | - <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" placeholder="<?php _e( 'Use series title', 'seriously-simple-podcasting' ); ?>" value="<?php echo $title; ?>" /></p> |
|
158 | + <p><label for="<?php echo $this->get_field_id ( 'title' ); ?>"><?php _e ( 'Title:', 'seriously-simple-podcasting' ); ?></label> |
|
159 | + <input class="widefat" id="<?php echo $this->get_field_id ( 'title' ); ?>" name="<?php echo $this->get_field_name ( 'title' ); ?>" type="text" placeholder="<?php _e ( 'Use series title', 'seriously-simple-podcasting' ); ?>" value="<?php echo $title; ?>" /></p> |
|
160 | 160 | |
161 | - <p><label for="<?php echo $this->get_field_id( 'series_id' ); ?>"><?php _e( 'Series:', 'seriously-simple-podcasting' ); ?></label> |
|
162 | - <select id="<?php echo $this->get_field_id( 'series_id' ); ?>" name="<?php echo $this->get_field_name( 'series_id' ); ?>"> |
|
161 | + <p><label for="<?php echo $this->get_field_id ( 'series_id' ); ?>"><?php _e ( 'Series:', 'seriously-simple-podcasting' ); ?></label> |
|
162 | + <select id="<?php echo $this->get_field_id ( 'series_id' ); ?>" name="<?php echo $this->get_field_name ( 'series_id' ); ?>"> |
|
163 | 163 | <?php |
164 | 164 | foreach ( $series as $s ) { |
165 | - echo '<option value="' . esc_attr( $s->term_id ) . '" ' . selected( $series_id, $s->term_id, false ) . '>' . $s->name . '</option>' . "\n"; |
|
165 | + echo '<option value="'.esc_attr ( $s->term_id ).'" '.selected ( $series_id, $s->term_id, false ).'>'.$s->name.'</option>'."\n"; |
|
166 | 166 | } |
167 | 167 | ?> |
168 | 168 | </select> |
169 | 169 | </p> |
170 | 170 | |
171 | - <p><input class="checkbox" type="checkbox" <?php checked( $show_title ); ?> id="<?php echo $this->get_field_id( 'show_title' ); ?>" name="<?php echo $this->get_field_name( 'show_title' ); ?>" /> |
|
172 | - <label for="<?php echo $this->get_field_id( 'show_title' ); ?>"><?php _e( 'Display series title inside widget?', 'seriously-simple-podcasting' ); ?></label></p> |
|
171 | + <p><input class="checkbox" type="checkbox" <?php checked ( $show_title ); ?> id="<?php echo $this->get_field_id ( 'show_title' ); ?>" name="<?php echo $this->get_field_name ( 'show_title' ); ?>" /> |
|
172 | + <label for="<?php echo $this->get_field_id ( 'show_title' ); ?>"><?php _e ( 'Display series title inside widget?', 'seriously-simple-podcasting' ); ?></label></p> |
|
173 | 173 | |
174 | - <p><input class="checkbox" type="checkbox" <?php checked( $show_desc ); ?> id="<?php echo $this->get_field_id( 'show_desc' ); ?>" name="<?php echo $this->get_field_name( 'show_desc' ); ?>" /> |
|
175 | - <label for="<?php echo $this->get_field_id( 'show_desc' ); ?>"><?php _e( 'Display series description?', 'seriously-simple-podcasting' ); ?></label></p> |
|
174 | + <p><input class="checkbox" type="checkbox" <?php checked ( $show_desc ); ?> id="<?php echo $this->get_field_id ( 'show_desc' ); ?>" name="<?php echo $this->get_field_name ( 'show_desc' ); ?>" /> |
|
175 | + <label for="<?php echo $this->get_field_id ( 'show_desc' ); ?>"><?php _e ( 'Display series description?', 'seriously-simple-podcasting' ); ?></label></p> |
|
176 | 176 | |
177 | - <p><input class="checkbox" type="checkbox" <?php checked( $show_date ); ?> id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" /> |
|
178 | - <label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Display episode date?', 'seriously-simple-podcasting' ); ?></label></p> |
|
177 | + <p><input class="checkbox" type="checkbox" <?php checked ( $show_date ); ?> id="<?php echo $this->get_field_id ( 'show_date' ); ?>" name="<?php echo $this->get_field_name ( 'show_date' ); ?>" /> |
|
178 | + <label for="<?php echo $this->get_field_id ( 'show_date' ); ?>"><?php _e ( 'Display episode date?', 'seriously-simple-podcasting' ); ?></label></p> |
|
179 | 179 | <?php |
180 | 180 | } |
181 | 181 | } // End Class |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly. |
4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined ( 'ABSPATH' ) ) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
@@ -26,20 +26,20 @@ discard block |
||
26 | 26 | public function __construct() { |
27 | 27 | /* Widget variable settings. */ |
28 | 28 | $this->widget_cssclass = 'widget_podcast_episode'; |
29 | - $this->widget_description = __( 'Display a single podcast episode.', 'seriously-simple-podcasting' ); |
|
29 | + $this->widget_description = __ ( 'Display a single podcast episode.', 'seriously-simple-podcasting' ); |
|
30 | 30 | $this->widget_idbase = 'ss_podcast'; |
31 | - $this->widget_title = __( 'Podcast: Single Episode', 'seriously-simple-podcasting' ); |
|
31 | + $this->widget_title = __ ( 'Podcast: Single Episode', 'seriously-simple-podcasting' ); |
|
32 | 32 | |
33 | 33 | /* Widget settings. */ |
34 | 34 | $widget_ops = array( 'classname' => $this->widget_cssclass, 'description' => $this->widget_description ); |
35 | 35 | |
36 | - parent::__construct('single-podcast-episode', $this->widget_title, $widget_ops); |
|
36 | + parent::__construct ( 'single-podcast-episode', $this->widget_title, $widget_ops ); |
|
37 | 37 | |
38 | 38 | $this->alt_option_name = 'widget_single_episode'; |
39 | 39 | |
40 | - add_action( 'save_post', array( $this, 'flush_widget_cache' ) ); |
|
41 | - add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) ); |
|
42 | - add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) ); |
|
40 | + add_action ( 'save_post', array( $this, 'flush_widget_cache' ) ); |
|
41 | + add_action ( 'deleted_post', array( $this, 'flush_widget_cache' ) ); |
|
42 | + add_action ( 'switch_theme', array( $this, 'flush_widget_cache' ) ); |
|
43 | 43 | |
44 | 44 | } // End __construct() |
45 | 45 | |
@@ -47,157 +47,157 @@ discard block |
||
47 | 47 | global $ss_podcasting; |
48 | 48 | |
49 | 49 | $cache = array(); |
50 | - if ( ! $this->is_preview() ) { |
|
51 | - $cache = wp_cache_get( 'widget_single_episode', 'widget' ); |
|
50 | + if ( ! $this->is_preview () ) { |
|
51 | + $cache = wp_cache_get ( 'widget_single_episode', 'widget' ); |
|
52 | 52 | } |
53 | 53 | |
54 | - if ( ! is_array( $cache ) ) { |
|
54 | + if ( ! is_array ( $cache ) ) { |
|
55 | 55 | $cache = array(); |
56 | 56 | } |
57 | 57 | |
58 | - if ( ! isset( $args['widget_id'] ) ) { |
|
59 | - $args['widget_id'] = $this->id; |
|
58 | + if ( ! isset( $args[ 'widget_id' ] ) ) { |
|
59 | + $args[ 'widget_id' ] = $this->id; |
|
60 | 60 | } |
61 | 61 | |
62 | - if ( isset( $cache[ $args['widget_id'] ] ) ) { |
|
63 | - echo $cache[ $args['widget_id'] ]; |
|
62 | + if ( isset( $cache[ $args[ 'widget_id' ] ] ) ) { |
|
63 | + echo $cache[ $args[ 'widget_id' ] ]; |
|
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
67 | - ob_start(); |
|
67 | + ob_start (); |
|
68 | 68 | |
69 | - $episode_id = $instance['episode_id']; |
|
69 | + $episode_id = $instance[ 'episode_id' ]; |
|
70 | 70 | |
71 | - if( 0 == $episode_id ) { |
|
72 | - $ssp_episodes = ssp_episodes( 1 ); |
|
73 | - if( 0 < count( $ssp_episodes ) ) { |
|
74 | - foreach( $ssp_episodes as $episode ) { |
|
71 | + if ( 0 == $episode_id ) { |
|
72 | + $ssp_episodes = ssp_episodes ( 1 ); |
|
73 | + if ( 0 < count ( $ssp_episodes ) ) { |
|
74 | + foreach ( $ssp_episodes as $episode ) { |
|
75 | 75 | $episode_id = $episode->ID; |
76 | 76 | break; |
77 | 77 | } |
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - if( ! $episode_id ) { |
|
81 | + if ( ! $episode_id ) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
85 | - $title = ( $instance['title'] ) ? $instance['title'] : get_the_title( $episode_id ); |
|
85 | + $title = ( $instance[ 'title' ] ) ? $instance[ 'title' ] : get_the_title ( $episode_id ); |
|
86 | 86 | |
87 | 87 | /** This filter is documented in wp-includes/default-widgets.php */ |
88 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
88 | + $title = apply_filters ( 'widget_title', $title, $instance, $this->id_base ); |
|
89 | 89 | |
90 | - $show_title = isset( $instance['show_title'] ) ? $instance['show_title'] : false; |
|
91 | - $show_excerpt = isset( $instance['show_excerpt'] ) ? $instance['show_excerpt'] : false; |
|
92 | - $show_content = isset( $instance['show_content'] ) ? $instance['show_content'] : false; |
|
93 | - $show_player = isset( $instance['show_player'] ) ? $instance['show_player'] : false; |
|
94 | - $show_details = isset( $instance['show_details'] ) ? $instance['show_details'] : false; |
|
90 | + $show_title = isset( $instance[ 'show_title' ] ) ? $instance[ 'show_title' ] : false; |
|
91 | + $show_excerpt = isset( $instance[ 'show_excerpt' ] ) ? $instance[ 'show_excerpt' ] : false; |
|
92 | + $show_content = isset( $instance[ 'show_content' ] ) ? $instance[ 'show_content' ] : false; |
|
93 | + $show_player = isset( $instance[ 'show_player' ] ) ? $instance[ 'show_player' ] : false; |
|
94 | + $show_details = isset( $instance[ 'show_details' ] ) ? $instance[ 'show_details' ] : false; |
|
95 | 95 | |
96 | 96 | $content_items = array(); |
97 | 97 | |
98 | 98 | if ( $show_title ) { |
99 | - $content_items[] = 'title'; |
|
99 | + $content_items[ ] = 'title'; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | if ( $show_excerpt ) { |
103 | - $content_items[] = 'excerpt'; |
|
103 | + $content_items[ ] = 'excerpt'; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | if ( $show_content ) { |
107 | - $content_items[] = 'content'; |
|
107 | + $content_items[ ] = 'content'; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | if ( $show_player ) { |
111 | - $content_items[] = 'player'; |
|
111 | + $content_items[ ] = 'player'; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | if ( $show_details ) { |
115 | - $content_items[] = 'details'; |
|
115 | + $content_items[ ] = 'details'; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | // Get episode markup |
119 | - $html = $ss_podcasting->podcast_episode( $episode_id, $content_items, 'widget' ); |
|
119 | + $html = $ss_podcasting->podcast_episode ( $episode_id, $content_items, 'widget' ); |
|
120 | 120 | |
121 | 121 | if ( ! $html ) { |
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
125 | - echo $args['before_widget']; |
|
125 | + echo $args[ 'before_widget' ]; |
|
126 | 126 | |
127 | 127 | if ( $title ) { |
128 | - echo $args['before_title'] . $title . $args['after_title']; |
|
128 | + echo $args[ 'before_title' ].$title.$args[ 'after_title' ]; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | echo $html; |
132 | 132 | |
133 | - echo $args['after_widget']; |
|
133 | + echo $args[ 'after_widget' ]; |
|
134 | 134 | |
135 | - if ( ! $this->is_preview() ) { |
|
136 | - $cache[ $args['widget_id'] ] = ob_get_flush(); |
|
137 | - wp_cache_set( 'widget_single_episode', $cache, 'widget' ); |
|
135 | + if ( ! $this->is_preview () ) { |
|
136 | + $cache[ $args[ 'widget_id' ] ] = ob_get_flush (); |
|
137 | + wp_cache_set ( 'widget_single_episode', $cache, 'widget' ); |
|
138 | 138 | } else { |
139 | - ob_end_flush(); |
|
139 | + ob_end_flush (); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | 143 | public function update( $new_instance, $old_instance ) { |
144 | 144 | $instance = $old_instance; |
145 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
146 | - $instance['episode_id'] = isset( $new_instance['episode_id'] ) ? (int) $new_instance['episode_id'] : 0; |
|
147 | - $instance['show_title'] = isset( $new_instance['show_title'] ) ? (bool) $new_instance['show_title'] : false; |
|
148 | - $instance['show_excerpt'] = isset( $new_instance['show_excerpt'] ) ? (bool) $new_instance['show_excerpt'] : false; |
|
149 | - $instance['show_content'] = isset( $new_instance['show_content'] ) ? (bool) $new_instance['show_content'] : false; |
|
150 | - $instance['show_player'] = isset( $new_instance['show_player'] ) ? (bool) $new_instance['show_player'] : false; |
|
151 | - $instance['show_details'] = isset( $new_instance['show_details'] ) ? (bool) $new_instance['show_details'] : false; |
|
152 | - $this->flush_widget_cache(); |
|
145 | + $instance[ 'title' ] = strip_tags ( $new_instance[ 'title' ] ); |
|
146 | + $instance[ 'episode_id' ] = isset( $new_instance[ 'episode_id' ] ) ? (int) $new_instance[ 'episode_id' ] : 0; |
|
147 | + $instance[ 'show_title' ] = isset( $new_instance[ 'show_title' ] ) ? (bool) $new_instance[ 'show_title' ] : false; |
|
148 | + $instance[ 'show_excerpt' ] = isset( $new_instance[ 'show_excerpt' ] ) ? (bool) $new_instance[ 'show_excerpt' ] : false; |
|
149 | + $instance[ 'show_content' ] = isset( $new_instance[ 'show_content' ] ) ? (bool) $new_instance[ 'show_content' ] : false; |
|
150 | + $instance[ 'show_player' ] = isset( $new_instance[ 'show_player' ] ) ? (bool) $new_instance[ 'show_player' ] : false; |
|
151 | + $instance[ 'show_details' ] = isset( $new_instance[ 'show_details' ] ) ? (bool) $new_instance[ 'show_details' ] : false; |
|
152 | + $this->flush_widget_cache (); |
|
153 | 153 | |
154 | 154 | return $instance; |
155 | 155 | } |
156 | 156 | |
157 | 157 | public function flush_widget_cache() { |
158 | - wp_cache_delete('widget_single_episode', 'widget'); |
|
158 | + wp_cache_delete ( 'widget_single_episode', 'widget' ); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | public function form( $instance ) { |
162 | - $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; |
|
163 | - $episode_id = isset( $instance['episode_id'] ) ? $instance['episode_id'] : 0; |
|
164 | - $show_title = isset( $instance['show_title'] ) ? (bool) $instance['show_title'] : false; |
|
165 | - $show_excerpt = isset( $instance['show_excerpt'] ) ? (bool) $instance['show_excerpt'] : false; |
|
166 | - $show_content = isset( $instance['show_content'] ) ? (bool) $instance['show_content'] : false; |
|
167 | - $show_player = isset( $instance['show_player'] ) ? (bool) $instance['show_player'] : false; |
|
168 | - $show_details = isset( $instance['show_details'] ) ? (bool) $instance['show_details'] : false; |
|
162 | + $title = isset( $instance[ 'title' ] ) ? esc_attr ( $instance[ 'title' ] ) : ''; |
|
163 | + $episode_id = isset( $instance[ 'episode_id' ] ) ? $instance[ 'episode_id' ] : 0; |
|
164 | + $show_title = isset( $instance[ 'show_title' ] ) ? (bool) $instance[ 'show_title' ] : false; |
|
165 | + $show_excerpt = isset( $instance[ 'show_excerpt' ] ) ? (bool) $instance[ 'show_excerpt' ] : false; |
|
166 | + $show_content = isset( $instance[ 'show_content' ] ) ? (bool) $instance[ 'show_content' ] : false; |
|
167 | + $show_player = isset( $instance[ 'show_player' ] ) ? (bool) $instance[ 'show_player' ] : false; |
|
168 | + $show_details = isset( $instance[ 'show_details' ] ) ? (bool) $instance[ 'show_details' ] : false; |
|
169 | 169 | |
170 | 170 | // Get all podcast episodes |
171 | - $episode_ids = (array) ssp_episode_ids(); |
|
171 | + $episode_ids = (array) ssp_episode_ids (); |
|
172 | 172 | ?> |
173 | - <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'seriously-simple-podcasting' ); ?></label> |
|
174 | - <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" placeholder="<?php _e( 'Use episode title', 'seriously-simple-podcasting' ); ?>" value="<?php echo $title; ?>" /></p> |
|
173 | + <p><label for="<?php echo $this->get_field_id ( 'title' ); ?>"><?php _e ( 'Title:', 'seriously-simple-podcasting' ); ?></label> |
|
174 | + <input class="widefat" id="<?php echo $this->get_field_id ( 'title' ); ?>" name="<?php echo $this->get_field_name ( 'title' ); ?>" type="text" placeholder="<?php _e ( 'Use episode title', 'seriously-simple-podcasting' ); ?>" value="<?php echo $title; ?>" /></p> |
|
175 | 175 | |
176 | - <p><label for="<?php echo $this->get_field_id( 'episode_id' ); ?>"><?php _e( 'Episode:', 'seriously-simple-podcasting' ); ?></label> |
|
177 | - <select id="<?php echo $this->get_field_id( 'episode_id' ); ?>" name="<?php echo $this->get_field_name( 'episode_id' ); ?>"> |
|
178 | - <option value="0"><?php _e( '- Latest episode -', 'seriously-simple-podcasting' ); ?></option> |
|
176 | + <p><label for="<?php echo $this->get_field_id ( 'episode_id' ); ?>"><?php _e ( 'Episode:', 'seriously-simple-podcasting' ); ?></label> |
|
177 | + <select id="<?php echo $this->get_field_id ( 'episode_id' ); ?>" name="<?php echo $this->get_field_name ( 'episode_id' ); ?>"> |
|
178 | + <option value="0"><?php _e ( '- Latest episode -', 'seriously-simple-podcasting' ); ?></option> |
|
179 | 179 | <?php |
180 | 180 | foreach ( $episode_ids as $id ) { |
181 | - echo '<option value="' . esc_attr( $id ) . '" ' . selected( $episode_id, $id, false ) . '>' . get_the_title( $id ) . '</option>' . "\n"; |
|
181 | + echo '<option value="'.esc_attr ( $id ).'" '.selected ( $episode_id, $id, false ).'>'.get_the_title ( $id ).'</option>'."\n"; |
|
182 | 182 | } |
183 | 183 | ?> |
184 | 184 | </select> |
185 | 185 | </p> |
186 | 186 | |
187 | - <p><input class="checkbox" type="checkbox" <?php checked( $show_title ); ?> id="<?php echo $this->get_field_id( 'show_title' ); ?>" name="<?php echo $this->get_field_name( 'show_title' ); ?>" /> |
|
188 | - <label for="<?php echo $this->get_field_id( 'show_title' ); ?>"><?php _e( 'Display episode title inside widget?', 'seriously-simple-podcasting' ); ?></label></p> |
|
187 | + <p><input class="checkbox" type="checkbox" <?php checked ( $show_title ); ?> id="<?php echo $this->get_field_id ( 'show_title' ); ?>" name="<?php echo $this->get_field_name ( 'show_title' ); ?>" /> |
|
188 | + <label for="<?php echo $this->get_field_id ( 'show_title' ); ?>"><?php _e ( 'Display episode title inside widget?', 'seriously-simple-podcasting' ); ?></label></p> |
|
189 | 189 | |
190 | - <p><input class="checkbox" type="checkbox" <?php checked( $show_excerpt ); ?> id="<?php echo $this->get_field_id( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" /> |
|
191 | - <label for="<?php echo $this->get_field_id( 'show_excerpt' ); ?>"><?php _e( 'Display episode excerpt?', 'seriously-simple-podcasting' ); ?></label></p> |
|
190 | + <p><input class="checkbox" type="checkbox" <?php checked ( $show_excerpt ); ?> id="<?php echo $this->get_field_id ( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name ( 'show_excerpt' ); ?>" /> |
|
191 | + <label for="<?php echo $this->get_field_id ( 'show_excerpt' ); ?>"><?php _e ( 'Display episode excerpt?', 'seriously-simple-podcasting' ); ?></label></p> |
|
192 | 192 | |
193 | - <p><input class="checkbox" type="checkbox" <?php checked( $show_content ); ?> id="<?php echo $this->get_field_id( 'show_content' ); ?>" name="<?php echo $this->get_field_name( 'show_content' ); ?>" /> |
|
194 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>"><?php _e( 'Display full episode content?', 'seriously-simple-podcasting' ); ?></label></p> |
|
193 | + <p><input class="checkbox" type="checkbox" <?php checked ( $show_content ); ?> id="<?php echo $this->get_field_id ( 'show_content' ); ?>" name="<?php echo $this->get_field_name ( 'show_content' ); ?>" /> |
|
194 | + <label for="<?php echo $this->get_field_id ( 'show_content' ); ?>"><?php _e ( 'Display full episode content?', 'seriously-simple-podcasting' ); ?></label></p> |
|
195 | 195 | |
196 | - <p><input class="checkbox" type="checkbox" <?php checked( $show_player ); ?> id="<?php echo $this->get_field_id( 'show_player' ); ?>" name="<?php echo $this->get_field_name( 'show_player' ); ?>" /> |
|
197 | - <label for="<?php echo $this->get_field_id( 'show_player' ); ?>"><?php _e( 'Display episode audio player?', 'seriously-simple-podcasting' ); ?></label></p> |
|
196 | + <p><input class="checkbox" type="checkbox" <?php checked ( $show_player ); ?> id="<?php echo $this->get_field_id ( 'show_player' ); ?>" name="<?php echo $this->get_field_name ( 'show_player' ); ?>" /> |
|
197 | + <label for="<?php echo $this->get_field_id ( 'show_player' ); ?>"><?php _e ( 'Display episode audio player?', 'seriously-simple-podcasting' ); ?></label></p> |
|
198 | 198 | |
199 | - <p><input class="checkbox" type="checkbox" <?php checked( $show_details ); ?> id="<?php echo $this->get_field_id( 'show_details' ); ?>" name="<?php echo $this->get_field_name( 'show_details' ); ?>" /> |
|
200 | - <label for="<?php echo $this->get_field_id( 'show_details' ); ?>"><?php _e( 'Display episode details?', 'seriously-simple-podcasting' ); ?></label></p> |
|
199 | + <p><input class="checkbox" type="checkbox" <?php checked ( $show_details ); ?> id="<?php echo $this->get_field_id ( 'show_details' ); ?>" name="<?php echo $this->get_field_name ( 'show_details' ); ?>" /> |
|
200 | + <label for="<?php echo $this->get_field_id ( 'show_details' ); ?>"><?php _e ( 'Display episode details?', 'seriously-simple-podcasting' ); ?></label></p> |
|
201 | 201 | <?php |
202 | 202 | } |
203 | 203 | } // End Class |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | // Request password and give access if correct |
34 | 34 | if ( ! isset( $_SERVER['PHP_AUTH_USER'] ) && ! isset( $_SERVER['PHP_AUTH_PW'] ) ) { |
35 | - $give_access = false; |
|
35 | + $give_access = false; |
|
36 | 36 | } else { |
37 | 37 | $username = get_option( 'ss_podcasting_protection_username' ); |
38 | 38 | $password = get_option( 'ss_podcasting_protection_password' ); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $no_access_message = '<div style="text-align:center;font-family:sans-serif;border:1px solid red;background:pink;padding:20px 0;color:red;">' . $message . '</div>'; |
51 | 51 | |
52 | 52 | header('WWW-Authenticate: Basic realm="Podcast Feed"'); |
53 | - header('HTTP/1.0 401 Unauthorized'); |
|
53 | + header('HTTP/1.0 401 Unauthorized'); |
|
54 | 54 | |
55 | 55 | die( $no_access_message ); |
56 | 56 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // Exit if accessed directly. |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if ( ! defined ( 'ABSPATH' ) ) { |
|
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
@@ -15,30 +15,30 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | // Hide all errors |
18 | -error_reporting( 0 ); |
|
18 | +error_reporting ( 0 ); |
|
19 | 19 | |
20 | 20 | // Check if feed is password protected |
21 | -$protection = get_option( 'ss_podcasting_protect', '' ); |
|
21 | +$protection = get_option ( 'ss_podcasting_protect', '' ); |
|
22 | 22 | |
23 | 23 | if ( $protection && $protection == 'on' ) { |
24 | 24 | |
25 | 25 | $give_access = false; |
26 | 26 | |
27 | - $message_option = get_option('ss_podcasting_protection_no_access_message'); |
|
28 | - $message = __( 'You are not permitted to view this podcast feed.' , 'seriously-simple-podcasting' ); |
|
29 | - if ( $message_option && strlen( $message_option ) > 0 && $message_option != '' ) { |
|
27 | + $message_option = get_option ( 'ss_podcasting_protection_no_access_message' ); |
|
28 | + $message = __ ( 'You are not permitted to view this podcast feed.', 'seriously-simple-podcasting' ); |
|
29 | + if ( $message_option && strlen ( $message_option ) > 0 && $message_option != '' ) { |
|
30 | 30 | $message = $message_option; |
31 | 31 | } |
32 | 32 | |
33 | 33 | // Request password and give access if correct |
34 | - if ( ! isset( $_SERVER['PHP_AUTH_USER'] ) && ! isset( $_SERVER['PHP_AUTH_PW'] ) ) { |
|
34 | + if ( ! isset( $_SERVER[ 'PHP_AUTH_USER' ] ) && ! isset( $_SERVER[ 'PHP_AUTH_PW' ] ) ) { |
|
35 | 35 | $give_access = false; |
36 | 36 | } else { |
37 | - $username = get_option( 'ss_podcasting_protection_username' ); |
|
38 | - $password = get_option( 'ss_podcasting_protection_password' ); |
|
37 | + $username = get_option ( 'ss_podcasting_protection_username' ); |
|
38 | + $password = get_option ( 'ss_podcasting_protection_password' ); |
|
39 | 39 | |
40 | - if ( $_SERVER['PHP_AUTH_USER'] == $username ) { |
|
41 | - if ( md5( $_SERVER['PHP_AUTH_PW'] ) == $password ) { |
|
40 | + if ( $_SERVER[ 'PHP_AUTH_USER' ] == $username ) { |
|
41 | + if ( md5 ( $_SERVER[ 'PHP_AUTH_PW' ] ) == $password ) { |
|
42 | 42 | $give_access = true; |
43 | 43 | } |
44 | 44 | } |
@@ -47,31 +47,31 @@ discard block |
||
47 | 47 | // Send 401 status and display no access message |
48 | 48 | if ( ! $give_access ) { |
49 | 49 | |
50 | - $no_access_message = '<div style="text-align:center;font-family:sans-serif;border:1px solid red;background:pink;padding:20px 0;color:red;">' . $message . '</div>'; |
|
50 | + $no_access_message = '<div style="text-align:center;font-family:sans-serif;border:1px solid red;background:pink;padding:20px 0;color:red;">'.$message.'</div>'; |
|
51 | 51 | |
52 | - header('WWW-Authenticate: Basic realm="Podcast Feed"'); |
|
53 | - header('HTTP/1.0 401 Unauthorized'); |
|
52 | + header ( 'WWW-Authenticate: Basic realm="Podcast Feed"' ); |
|
53 | + header ( 'HTTP/1.0 401 Unauthorized' ); |
|
54 | 54 | |
55 | 55 | die( $no_access_message ); |
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | 59 | // If redirect is on, get new feed URL and redirect if setting was changed more than 48 hours ago |
60 | -$redirect = get_option( 'ss_podcasting_redirect_feed' ); |
|
60 | +$redirect = get_option ( 'ss_podcasting_redirect_feed' ); |
|
61 | 61 | $new_feed_url = false; |
62 | 62 | if ( $redirect && $redirect == 'on' ) { |
63 | 63 | |
64 | - $new_feed_url = get_option( 'ss_podcasting_new_feed_url' ); |
|
65 | - $update_date = get_option( 'ss_podcasting_redirect_feed_date' ); |
|
64 | + $new_feed_url = get_option ( 'ss_podcasting_new_feed_url' ); |
|
65 | + $update_date = get_option ( 'ss_podcasting_redirect_feed_date' ); |
|
66 | 66 | |
67 | 67 | if ( $new_feed_url && $update_date ) { |
68 | - $redirect_date = strtotime( '+2 days' , $update_date ); |
|
69 | - $current_date = time(); |
|
68 | + $redirect_date = strtotime ( '+2 days', $update_date ); |
|
69 | + $current_date = time (); |
|
70 | 70 | |
71 | 71 | // Redirect with 301 if it is more than 2 days since redirect was saved |
72 | 72 | if ( $current_date > $redirect_date ) { |
73 | 73 | header ( 'HTTP/1.1 301 Moved Permanently' ); |
74 | - header ( 'Location: ' . $new_feed_url ); |
|
74 | + header ( 'Location: '.$new_feed_url ); |
|
75 | 75 | exit; |
76 | 76 | } |
77 | 77 | } |
@@ -79,107 +79,107 @@ discard block |
||
79 | 79 | |
80 | 80 | // Get specified podcast series |
81 | 81 | $podcast_series = ''; |
82 | -if ( isset( $_GET['podcast_series'] ) && $_GET['podcast_series'] ) { |
|
83 | - $podcast_series = esc_attr( $_GET['podcast_series'] ); |
|
84 | -} elseif ( isset( $wp_query->query_vars['podcast_series'] ) && $wp_query->query_vars['podcast_series'] ) { |
|
85 | - $podcast_series = esc_attr( $wp_query->query_vars['podcast_series'] ); |
|
82 | +if ( isset( $_GET[ 'podcast_series' ] ) && $_GET[ 'podcast_series' ] ) { |
|
83 | + $podcast_series = esc_attr ( $_GET[ 'podcast_series' ] ); |
|
84 | +} elseif ( isset( $wp_query->query_vars[ 'podcast_series' ] ) && $wp_query->query_vars[ 'podcast_series' ] ) { |
|
85 | + $podcast_series = esc_attr ( $wp_query->query_vars[ 'podcast_series' ] ); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $series_id = 0; |
89 | 89 | if ( $podcast_series ) { |
90 | - $series = get_term_by( 'slug', $podcast_series, 'series' ); |
|
90 | + $series = get_term_by ( 'slug', $podcast_series, 'series' ); |
|
91 | 91 | $series_id = $series->term_id; |
92 | 92 | |
93 | 93 | // Do we need to redirect a single feed? |
94 | - $redirect = get_option( 'ss_podcasting_redirect_feed_' . $series_id ); |
|
94 | + $redirect = get_option ( 'ss_podcasting_redirect_feed_'.$series_id ); |
|
95 | 95 | $new_feed_url = false; |
96 | 96 | if ( $redirect && $redirect == 'on' ) { |
97 | - $new_feed_url = get_option( 'ss_podcasting_new_feed_url_' . $series_id ); |
|
97 | + $new_feed_url = get_option ( 'ss_podcasting_new_feed_url_'.$series_id ); |
|
98 | 98 | if ( $new_feed_url ) { |
99 | 99 | header ( 'HTTP/1.1 301 Moved Permanently' ); |
100 | - header ( 'Location: ' . $new_feed_url ); |
|
100 | + header ( 'Location: '.$new_feed_url ); |
|
101 | 101 | exit; |
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | 106 | // Podcast title |
107 | -$title = get_option( 'ss_podcasting_data_title', get_bloginfo( 'name' ) ); |
|
107 | +$title = get_option ( 'ss_podcasting_data_title', get_bloginfo ( 'name' ) ); |
|
108 | 108 | if ( $podcast_series ) { |
109 | - $series_title = get_option( 'ss_podcasting_data_title_' . $series_id, '' ); |
|
109 | + $series_title = get_option ( 'ss_podcasting_data_title_'.$series_id, '' ); |
|
110 | 110 | if ( $series_title ) { |
111 | 111 | $title = $series_title; |
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | 115 | // Podcast description |
116 | -$description = get_option( 'ss_podcasting_data_description', get_bloginfo( 'description' ) ); |
|
116 | +$description = get_option ( 'ss_podcasting_data_description', get_bloginfo ( 'description' ) ); |
|
117 | 117 | if ( $podcast_series ) { |
118 | - $series_description = get_option( 'ss_podcasting_data_description_' . $series_id, '' ); |
|
118 | + $series_description = get_option ( 'ss_podcasting_data_description_'.$series_id, '' ); |
|
119 | 119 | if ( $series_description ) { |
120 | 120 | $description = $series_description; |
121 | 121 | } |
122 | 122 | } |
123 | -$podcast_description = mb_substr( strip_tags( $description ), 0, 3999 ); |
|
123 | +$podcast_description = mb_substr ( strip_tags ( $description ), 0, 3999 ); |
|
124 | 124 | |
125 | 125 | // Podcast language |
126 | -$language = get_option( 'ss_podcasting_data_language', get_bloginfo( 'language' ) ); |
|
126 | +$language = get_option ( 'ss_podcasting_data_language', get_bloginfo ( 'language' ) ); |
|
127 | 127 | if ( $podcast_series ) { |
128 | - $series_language = get_option( 'ss_podcasting_data_language_' . $series_id, '' ); |
|
128 | + $series_language = get_option ( 'ss_podcasting_data_language_'.$series_id, '' ); |
|
129 | 129 | if ( $series_language ) { |
130 | 130 | $language = $series_language; |
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | 134 | // Podcast copyright string |
135 | -$copyright = get_option( 'ss_podcasting_data_copyright', '© ' . date( 'Y' ) . ' ' . get_bloginfo( 'name' ) ); |
|
135 | +$copyright = get_option ( 'ss_podcasting_data_copyright', '© '.date ( 'Y' ).' '.get_bloginfo ( 'name' ) ); |
|
136 | 136 | if ( $podcast_series ) { |
137 | - $series_copyright = get_option( 'ss_podcasting_data_copyright_' . $series_id, '' ); |
|
137 | + $series_copyright = get_option ( 'ss_podcasting_data_copyright_'.$series_id, '' ); |
|
138 | 138 | if ( $series_copyright ) { |
139 | 139 | $copyright = $series_copyright; |
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | 143 | // Podcast subtitle |
144 | -$subtitle = get_option( 'ss_podcasting_data_subtitle', get_bloginfo( 'description' ) ); |
|
144 | +$subtitle = get_option ( 'ss_podcasting_data_subtitle', get_bloginfo ( 'description' ) ); |
|
145 | 145 | if ( $podcast_series ) { |
146 | - $series_subtitle = get_option( 'ss_podcasting_data_subtitle_' . $series_id, '' ); |
|
146 | + $series_subtitle = get_option ( 'ss_podcasting_data_subtitle_'.$series_id, '' ); |
|
147 | 147 | if ( $series_subtitle ) { |
148 | 148 | $subtitle = $series_subtitle; |
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | 152 | // Podcast author |
153 | -$author = get_option( 'ss_podcasting_data_author', get_bloginfo( 'name' ) ); |
|
153 | +$author = get_option ( 'ss_podcasting_data_author', get_bloginfo ( 'name' ) ); |
|
154 | 154 | if ( $podcast_series ) { |
155 | - $series_author = get_option( 'ss_podcasting_data_author_' . $series_id, '' ); |
|
155 | + $series_author = get_option ( 'ss_podcasting_data_author_'.$series_id, '' ); |
|
156 | 156 | if ( $series_author ) { |
157 | 157 | $author = $series_author; |
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | 161 | // Podcast owner name |
162 | -$owner_name = get_option( 'ss_podcasting_data_owner_name', get_bloginfo( 'name' ) ); |
|
162 | +$owner_name = get_option ( 'ss_podcasting_data_owner_name', get_bloginfo ( 'name' ) ); |
|
163 | 163 | if ( $podcast_series ) { |
164 | - $series_owner_name = get_option( 'ss_podcasting_data_owner_name_' . $series_id, '' ); |
|
164 | + $series_owner_name = get_option ( 'ss_podcasting_data_owner_name_'.$series_id, '' ); |
|
165 | 165 | if ( $series_owner_name ) { |
166 | 166 | $owner_name = $series_owner_name; |
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | 170 | // Podcast owner email address |
171 | -$owner_email = get_option( 'ss_podcasting_data_owner_email', get_bloginfo( 'admin_email' ) ); |
|
171 | +$owner_email = get_option ( 'ss_podcasting_data_owner_email', get_bloginfo ( 'admin_email' ) ); |
|
172 | 172 | if ( $podcast_series ) { |
173 | - $series_owner_email = get_option( 'ss_podcasting_data_owner_email_' . $series_id, '' ); |
|
173 | + $series_owner_email = get_option ( 'ss_podcasting_data_owner_email_'.$series_id, '' ); |
|
174 | 174 | if ( $series_owner_email ) { |
175 | 175 | $owner_email = $series_owner_email; |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | 179 | // Podcast explicit setting |
180 | -$explicit_option = get_option( 'ss_podcasting_explicit', '' ); |
|
180 | +$explicit_option = get_option ( 'ss_podcasting_explicit', '' ); |
|
181 | 181 | if ( $podcast_series ) { |
182 | - $series_explicit_option = get_option( 'ss_podcasting_explicit_' . $series_id, '' ); |
|
182 | + $series_explicit_option = get_option ( 'ss_podcasting_explicit_'.$series_id, '' ); |
|
183 | 183 | $explicit_option = $series_explicit_option; |
184 | 184 | } |
185 | 185 | if ( $explicit_option && 'on' == $explicit_option ) { |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | // Podcast complete setting |
194 | -$complete_option = get_option( 'ss_podcasting_complete', '' ); |
|
194 | +$complete_option = get_option ( 'ss_podcasting_complete', '' ); |
|
195 | 195 | if ( $podcast_series ) { |
196 | - $series_complete_option = get_option( 'ss_podcasting_complete_' . $series_id, '' ); |
|
196 | + $series_complete_option = get_option ( 'ss_podcasting_complete_'.$series_id, '' ); |
|
197 | 197 | $complete_option = $series_complete_option; |
198 | 198 | } |
199 | 199 | if ( $complete_option && 'on' == $complete_option ) { |
@@ -203,34 +203,34 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | // Podcast cover image |
206 | -$image = get_option( 'ss_podcasting_data_image', '' ); |
|
206 | +$image = get_option ( 'ss_podcasting_data_image', '' ); |
|
207 | 207 | if ( $podcast_series ) { |
208 | - $series_image = get_option( 'ss_podcasting_data_image_' . $series_id, 'no-image' ); |
|
208 | + $series_image = get_option ( 'ss_podcasting_data_image_'.$series_id, 'no-image' ); |
|
209 | 209 | if ( 'no-image' != $series_image ) { |
210 | 210 | $image = $series_image; |
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
214 | 214 | // Image URL (filterable to allow custom images) |
215 | -$image = apply_filters( 'ssp_feed_image', $image, $series_id ); |
|
215 | +$image = apply_filters ( 'ssp_feed_image', $image, $series_id ); |
|
216 | 216 | |
217 | 217 | // Podcast category and subcategory (all levels) |
218 | -$category1 = ssp_get_feed_category_output( 1, $series_id ); |
|
219 | -$category2 = ssp_get_feed_category_output( 2, $series_id ); |
|
220 | -$category3 = ssp_get_feed_category_output( 3, $series_id ); |
|
218 | +$category1 = ssp_get_feed_category_output ( 1, $series_id ); |
|
219 | +$category2 = ssp_get_feed_category_output ( 2, $series_id ); |
|
220 | +$category3 = ssp_get_feed_category_output ( 3, $series_id ); |
|
221 | 221 | |
222 | 222 | // Get stylehseet URL (filterable to allow custom RSS stylesheets) |
223 | -$stylehseet_url = apply_filters( 'ssp_rss_stylesheet', $ss_podcasting->template_url . 'feed-stylesheet.xsl' ); |
|
223 | +$stylehseet_url = apply_filters ( 'ssp_rss_stylesheet', $ss_podcasting->template_url.'feed-stylesheet.xsl' ); |
|
224 | 224 | |
225 | 225 | // Set RSS content type and charset headers |
226 | -header( 'Content-Type: ' . feed_content_type( 'podcast' ) . '; charset=' . get_option( 'blog_charset' ), true ); |
|
226 | +header ( 'Content-Type: '.feed_content_type ( 'podcast' ).'; charset='.get_option ( 'blog_charset' ), true ); |
|
227 | 227 | |
228 | 228 | // Use `echo` for first line to prevent any extra characters at start of document |
229 | -echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?>' . "\n"; |
|
229 | +echo '<?xml version="1.0" encoding="'.get_option ( 'blog_charset' ).'"?>'."\n"; |
|
230 | 230 | |
231 | 231 | // Include RSS stylesheet |
232 | -if( $stylehseet_url ) { |
|
233 | - echo '<?xml-stylesheet type="text/xsl" href="' . esc_url( $stylehseet_url ) . '"?>'; |
|
232 | +if ( $stylehseet_url ) { |
|
233 | + echo '<?xml-stylesheet type="text/xsl" href="'.esc_url ( $stylehseet_url ).'"?>'; |
|
234 | 234 | } ?> |
235 | 235 | |
236 | 236 | <rss version="2.0" |
@@ -242,88 +242,88 @@ discard block |
||
242 | 242 | xmlns:slash="http://purl.org/rss/1.0/modules/slash/" |
243 | 243 | xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" |
244 | 244 | xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" |
245 | - <?php do_action( 'rss2_ns' ); ?> |
|
245 | + <?php do_action ( 'rss2_ns' ); ?> |
|
246 | 246 | > |
247 | 247 | |
248 | 248 | <channel> |
249 | - <title><?php echo esc_html( $title ); ?></title> |
|
250 | - <atom:link href="<?php esc_url( self_link() ); ?>" rel="self" type="application/rss+xml" /> |
|
251 | - <link><?php echo esc_url( apply_filters( 'ssp_feed_channel_link_tag', $ss_podcasting->home_url, $podcast_series ) ) ?></link> |
|
252 | - <description><?php echo esc_html( $description ); ?></description> |
|
253 | - <lastBuildDate><?php echo esc_html( mysql2date( 'D, d M Y H:i:s +0000', get_lastpostmodified( 'GMT' ), false ) ); ?></lastBuildDate> |
|
254 | - <language><?php echo esc_html( $language ); ?></language> |
|
255 | - <copyright><?php echo esc_html( $copyright ); ?></copyright> |
|
256 | - <itunes:subtitle><?php echo esc_html( $subtitle ); ?></itunes:subtitle> |
|
257 | - <itunes:author><?php echo esc_html( $author ); ?></itunes:author> |
|
258 | - <googleplay:author><?php echo esc_html( $author ); ?></googleplay:author> |
|
259 | - <googleplay:email><?php echo esc_html( $owner_email ); ?></googleplay:email> |
|
260 | - <itunes:summary><?php echo esc_html( $podcast_description ); ?></itunes:summary> |
|
261 | - <googleplay:description><?php echo esc_html( $podcast_description ); ?></googleplay:description> |
|
249 | + <title><?php echo esc_html ( $title ); ?></title> |
|
250 | + <atom:link href="<?php esc_url ( self_link () ); ?>" rel="self" type="application/rss+xml" /> |
|
251 | + <link><?php echo esc_url ( apply_filters ( 'ssp_feed_channel_link_tag', $ss_podcasting->home_url, $podcast_series ) ) ?></link> |
|
252 | + <description><?php echo esc_html ( $description ); ?></description> |
|
253 | + <lastBuildDate><?php echo esc_html ( mysql2date ( 'D, d M Y H:i:s +0000', get_lastpostmodified ( 'GMT' ), false ) ); ?></lastBuildDate> |
|
254 | + <language><?php echo esc_html ( $language ); ?></language> |
|
255 | + <copyright><?php echo esc_html ( $copyright ); ?></copyright> |
|
256 | + <itunes:subtitle><?php echo esc_html ( $subtitle ); ?></itunes:subtitle> |
|
257 | + <itunes:author><?php echo esc_html ( $author ); ?></itunes:author> |
|
258 | + <googleplay:author><?php echo esc_html ( $author ); ?></googleplay:author> |
|
259 | + <googleplay:email><?php echo esc_html ( $owner_email ); ?></googleplay:email> |
|
260 | + <itunes:summary><?php echo esc_html ( $podcast_description ); ?></itunes:summary> |
|
261 | + <googleplay:description><?php echo esc_html ( $podcast_description ); ?></googleplay:description> |
|
262 | 262 | <itunes:owner> |
263 | - <itunes:name><?php echo esc_html( $owner_name ); ?></itunes:name> |
|
264 | - <itunes:email><?php echo esc_html( $owner_email ); ?></itunes:email> |
|
263 | + <itunes:name><?php echo esc_html ( $owner_name ); ?></itunes:name> |
|
264 | + <itunes:email><?php echo esc_html ( $owner_email ); ?></itunes:email> |
|
265 | 265 | </itunes:owner> |
266 | - <itunes:explicit><?php echo esc_html( $itunes_explicit ); ?></itunes:explicit> |
|
267 | - <googleplay:explicit><?php echo esc_html( $googleplay_explicit ); ?></googleplay:explicit> |
|
268 | - <?php if( $complete ) { ?><itunes:complete><?php echo esc_html( $complete ); ?></itunes:complete><?php } |
|
266 | + <itunes:explicit><?php echo esc_html ( $itunes_explicit ); ?></itunes:explicit> |
|
267 | + <googleplay:explicit><?php echo esc_html ( $googleplay_explicit ); ?></googleplay:explicit> |
|
268 | + <?php if ( $complete ) { ?><itunes:complete><?php echo esc_html ( $complete ); ?></itunes:complete><?php } |
|
269 | 269 | if ( $image ) { |
270 | - ?><itunes:image href="<?php echo esc_url( $image ); ?>"></itunes:image> |
|
271 | - <googleplay:image href="<?php echo esc_url( $image ); ?>"></googleplay:image> |
|
270 | + ?><itunes:image href="<?php echo esc_url ( $image ); ?>"></itunes:image> |
|
271 | + <googleplay:image href="<?php echo esc_url ( $image ); ?>"></googleplay:image> |
|
272 | 272 | <image> |
273 | - <url><?php echo esc_url( $image ); ?></url> |
|
274 | - <title><?php echo esc_html( $title ); ?></title> |
|
275 | - <link><?php echo esc_url( apply_filters( 'ssp_feed_channel_link_tag', $ss_podcasting->home_url, $podcast_series ) ) ?></link> |
|
273 | + <url><?php echo esc_url ( $image ); ?></url> |
|
274 | + <title><?php echo esc_html ( $title ); ?></title> |
|
275 | + <link><?php echo esc_url ( apply_filters ( 'ssp_feed_channel_link_tag', $ss_podcasting->home_url, $podcast_series ) ) ?></link> |
|
276 | 276 | </image> |
277 | 277 | <?php } |
278 | -if ( isset( $category1['category'] ) && $category1['category'] ) { ?> |
|
279 | - <itunes:category text="<?php echo esc_attr( $category1['category'] ); ?>"> |
|
280 | -<?php if ( isset( $category1['subcategory'] ) && $category1['subcategory'] ) { ?> |
|
281 | - <itunes:category text="<?php echo esc_attr( $category1['subcategory'] ); ?>"></itunes:category> |
|
278 | +if ( isset( $category1[ 'category' ] ) && $category1[ 'category' ] ) { ?> |
|
279 | + <itunes:category text="<?php echo esc_attr ( $category1[ 'category' ] ); ?>"> |
|
280 | +<?php if ( isset( $category1[ 'subcategory' ] ) && $category1[ 'subcategory' ] ) { ?> |
|
281 | + <itunes:category text="<?php echo esc_attr ( $category1[ 'subcategory' ] ); ?>"></itunes:category> |
|
282 | 282 | <?php } ?> |
283 | 283 | </itunes:category> |
284 | 284 | <?php } ?> |
285 | -<?php if ( isset( $category2['category'] ) && $category2['category'] ) { ?> |
|
286 | - <itunes:category text="<?php echo esc_attr( $category2['category'] ); ?>"> |
|
287 | -<?php if ( isset( $category2['subcategory'] ) && $category2['subcategory'] ) { ?> |
|
288 | - <itunes:category text="<?php echo esc_attr( $category2['subcategory'] ); ?>"></itunes:category> |
|
285 | +<?php if ( isset( $category2[ 'category' ] ) && $category2[ 'category' ] ) { ?> |
|
286 | + <itunes:category text="<?php echo esc_attr ( $category2[ 'category' ] ); ?>"> |
|
287 | +<?php if ( isset( $category2[ 'subcategory' ] ) && $category2[ 'subcategory' ] ) { ?> |
|
288 | + <itunes:category text="<?php echo esc_attr ( $category2[ 'subcategory' ] ); ?>"></itunes:category> |
|
289 | 289 | <?php } ?> |
290 | 290 | </itunes:category> |
291 | 291 | <?php } ?> |
292 | -<?php if ( isset( $category3['category'] ) && $category3['category'] ) { ?> |
|
293 | - <itunes:category text="<?php echo esc_attr( $category3['category'] ); ?>"> |
|
294 | -<?php if ( isset( $category3['subcategory'] ) && $category3['subcategory'] ) { ?> |
|
295 | - <itunes:category text="<?php echo esc_attr( $category3['subcategory'] ); ?>"></itunes:category> |
|
292 | +<?php if ( isset( $category3[ 'category' ] ) && $category3[ 'category' ] ) { ?> |
|
293 | + <itunes:category text="<?php echo esc_attr ( $category3[ 'category' ] ); ?>"> |
|
294 | +<?php if ( isset( $category3[ 'subcategory' ] ) && $category3[ 'subcategory' ] ) { ?> |
|
295 | + <itunes:category text="<?php echo esc_attr ( $category3[ 'subcategory' ] ); ?>"></itunes:category> |
|
296 | 296 | <?php } ?> |
297 | 297 | </itunes:category> |
298 | 298 | <?php } ?> |
299 | 299 | <?php if ( $new_feed_url ) { ?> |
300 | - <itunes:new-feed-url><?php echo esc_url( $new_feed_url ); ?></itunes:new-feed-url> |
|
300 | + <itunes:new-feed-url><?php echo esc_url ( $new_feed_url ); ?></itunes:new-feed-url> |
|
301 | 301 | <?php } |
302 | 302 | |
303 | 303 | // Prevent WP core from outputting an <image> element |
304 | - remove_action( 'rss2_head', 'rss2_site_icon' ); |
|
304 | + remove_action ( 'rss2_head', 'rss2_site_icon' ); |
|
305 | 305 | |
306 | 306 | // Add RSS2 headers |
307 | - do_action( 'rss2_head' ); |
|
307 | + do_action ( 'rss2_head' ); |
|
308 | 308 | |
309 | 309 | // Get post IDs of all podcast episodes |
310 | - $num_posts = intval( apply_filters( 'ssp_feed_number_of_posts', get_option( 'posts_per_rss', 10 ) ) ); |
|
310 | + $num_posts = intval ( apply_filters ( 'ssp_feed_number_of_posts', get_option ( 'posts_per_rss', 10 ) ) ); |
|
311 | 311 | |
312 | - $args = ssp_episodes( $num_posts, $podcast_series, true, 'feed' ); |
|
312 | + $args = ssp_episodes ( $num_posts, $podcast_series, true, 'feed' ); |
|
313 | 313 | |
314 | - $qry = new WP_Query( $args ); |
|
314 | + $qry = new WP_Query ( $args ); |
|
315 | 315 | |
316 | - if ( $qry->have_posts() ) { |
|
317 | - while ( $qry->have_posts()) { |
|
318 | - $qry->the_post(); |
|
316 | + if ( $qry->have_posts () ) { |
|
317 | + while ( $qry->have_posts () ) { |
|
318 | + $qry->the_post (); |
|
319 | 319 | |
320 | 320 | // Get the episode type (audio or video) |
321 | - $episode_type = $ss_podcasting->get_episode_type( get_the_ID() ); |
|
321 | + $episode_type = $ss_podcasting->get_episode_type ( get_the_ID () ); |
|
322 | 322 | |
323 | 323 | // Audio file |
324 | - $audio_file = $ss_podcasting->get_enclosure( get_the_ID() ); |
|
325 | - if ( get_option( 'permalink_structure' ) ) { |
|
326 | - $enclosure = $ss_podcasting->get_episode_download_link( get_the_ID() ); |
|
324 | + $audio_file = $ss_podcasting->get_enclosure ( get_the_ID () ); |
|
325 | + if ( get_option ( 'permalink_structure' ) ) { |
|
326 | + $enclosure = $ss_podcasting->get_episode_download_link ( get_the_ID () ); |
|
327 | 327 | } else { |
328 | 328 | $enclosure = $audio_file; |
329 | 329 | } |
@@ -335,37 +335,37 @@ discard block |
||
335 | 335 | |
336 | 336 | // Get episode image from post featured image |
337 | 337 | $episode_image = ''; |
338 | - $image_id = get_post_thumbnail_id( get_the_ID() ); |
|
338 | + $image_id = get_post_thumbnail_id ( get_the_ID () ); |
|
339 | 339 | if ( $image_id ) { |
340 | - $image_att = wp_get_attachment_image_src( $image_id, 'full' ); |
|
340 | + $image_att = wp_get_attachment_image_src ( $image_id, 'full' ); |
|
341 | 341 | if ( $image_att ) { |
342 | - $episode_image = $image_att[0]; |
|
342 | + $episode_image = $image_att[ 0 ]; |
|
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
346 | 346 | // Episode duration (default to 0:00 to ensure there is always a value for this) |
347 | - $duration = get_post_meta( get_the_ID(), 'duration', true ); |
|
347 | + $duration = get_post_meta ( get_the_ID (), 'duration', true ); |
|
348 | 348 | if ( ! $duration ) { |
349 | 349 | $duration = '0:00'; |
350 | 350 | } |
351 | 351 | |
352 | 352 | // File size |
353 | - $size = get_post_meta( get_the_ID(), 'filesize_raw', true ); |
|
353 | + $size = get_post_meta ( get_the_ID (), 'filesize_raw', true ); |
|
354 | 354 | if ( ! $size ) { |
355 | 355 | $size = 1; |
356 | 356 | } |
357 | 357 | |
358 | 358 | // File MIME type (default to MP3/MP4 to ensure there is always a value for this) |
359 | - $mime_type = $ss_podcasting->get_attachment_mimetype( $audio_file ); |
|
359 | + $mime_type = $ss_podcasting->get_attachment_mimetype ( $audio_file ); |
|
360 | 360 | if ( ! $mime_type ) { |
361 | - switch( $episode_type ) { |
|
361 | + switch ( $episode_type ) { |
|
362 | 362 | case 'audio': $mime_type = 'audio/mpeg'; break; |
363 | 363 | case 'video': $mime_type = 'video/mp4'; break; |
364 | 364 | } |
365 | 365 | } |
366 | 366 | |
367 | 367 | // Episode explicit flag |
368 | - $ep_explicit = get_post_meta( get_the_ID(), 'explicit', true ); |
|
368 | + $ep_explicit = get_post_meta ( get_the_ID (), 'explicit', true ); |
|
369 | 369 | if ( $ep_explicit && $ep_explicit == 'on' ) { |
370 | 370 | $itunes_explicit_flag = 'yes'; |
371 | 371 | $googleplay_explicit_flag = 'Yes'; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | } |
376 | 376 | |
377 | 377 | // Episode block flag |
378 | - $ep_block = get_post_meta( get_the_ID(), 'block', true ); |
|
378 | + $ep_block = get_post_meta ( get_the_ID (), 'block', true ); |
|
379 | 379 | if ( $ep_block && $ep_block == 'on' ) { |
380 | 380 | $block_flag = 'yes'; |
381 | 381 | } else { |
@@ -383,52 +383,52 @@ discard block |
||
383 | 383 | } |
384 | 384 | |
385 | 385 | // Episode author |
386 | - $author = esc_html( get_the_author() ); |
|
386 | + $author = esc_html ( get_the_author () ); |
|
387 | 387 | |
388 | 388 | // Episode content (with iframes removed) |
389 | - $content = get_the_content_feed( 'rss2' ); |
|
390 | - $content = preg_replace( '/<\/?iframe(.|\s)*?>/', '', $content ); |
|
391 | - $content = apply_filters( 'ssp_feed_item_content', $content, get_the_ID() ); |
|
389 | + $content = get_the_content_feed ( 'rss2' ); |
|
390 | + $content = preg_replace ( '/<\/?iframe(.|\s)*?>/', '', $content ); |
|
391 | + $content = apply_filters ( 'ssp_feed_item_content', $content, get_the_ID () ); |
|
392 | 392 | |
393 | 393 | // iTunes summary is the full episode content, but must be shorter than 4000 characters |
394 | - $itunes_summary = mb_substr( $content, 0, 3999 ); |
|
395 | - $itunes_summary = apply_filters( 'ssp_feed_item_itunes_summary', $itunes_summary, get_the_ID() ); |
|
396 | - $gp_description = apply_filters( 'ssp_feed_item_gp_description', $itunes_summary, get_the_ID() ); |
|
394 | + $itunes_summary = mb_substr ( $content, 0, 3999 ); |
|
395 | + $itunes_summary = apply_filters ( 'ssp_feed_item_itunes_summary', $itunes_summary, get_the_ID () ); |
|
396 | + $gp_description = apply_filters ( 'ssp_feed_item_gp_description', $itunes_summary, get_the_ID () ); |
|
397 | 397 | |
398 | 398 | // Episode description |
399 | - ob_start(); |
|
400 | - the_excerpt_rss(); |
|
401 | - $description = ob_get_clean(); |
|
402 | - $description = apply_filters( 'ssp_feed_item_description', $description, get_the_ID() ); |
|
399 | + ob_start (); |
|
400 | + the_excerpt_rss (); |
|
401 | + $description = ob_get_clean (); |
|
402 | + $description = apply_filters ( 'ssp_feed_item_description', $description, get_the_ID () ); |
|
403 | 403 | |
404 | 404 | // iTunes subtitle does not allow any HTML and must be shorter than 255 characters |
405 | - $itunes_subtitle = strip_tags( strip_shortcodes( $description ) ); |
|
406 | - $itunes_subtitle = str_replace( array( '>', '<', '\'', '"', '`', '[andhellip;]', '[…]', '[…]' ), array( '', '', '', '', '', '', '', '' ), $itunes_subtitle ); |
|
407 | - $itunes_subtitle = mb_substr( $itunes_subtitle, 0, 254 ); |
|
408 | - $itunes_subtitle = apply_filters( 'ssp_feed_item_itunes_subtitle', $itunes_subtitle, get_the_ID() ); |
|
405 | + $itunes_subtitle = strip_tags ( strip_shortcodes ( $description ) ); |
|
406 | + $itunes_subtitle = str_replace ( array( '>', '<', '\'', '"', '`', '[andhellip;]', '[…]', '[…]' ), array( '', '', '', '', '', '', '', '' ), $itunes_subtitle ); |
|
407 | + $itunes_subtitle = mb_substr ( $itunes_subtitle, 0, 254 ); |
|
408 | + $itunes_subtitle = apply_filters ( 'ssp_feed_item_itunes_subtitle', $itunes_subtitle, get_the_ID () ); |
|
409 | 409 | |
410 | 410 | ?> |
411 | 411 | <item> |
412 | - <title><?php esc_html( the_title_rss() ); ?></title> |
|
413 | - <link><?php esc_url( the_permalink_rss() ); ?></link> |
|
414 | - <pubDate><?php echo esc_html( mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ) ); ?></pubDate> |
|
412 | + <title><?php esc_html ( the_title_rss () ); ?></title> |
|
413 | + <link><?php esc_url ( the_permalink_rss () ); ?></link> |
|
414 | + <pubDate><?php echo esc_html ( mysql2date ( 'D, d M Y H:i:s +0000', get_post_time ( 'Y-m-d H:i:s', true ), false ) ); ?></pubDate> |
|
415 | 415 | <dc:creator><?php echo $author; ?></dc:creator> |
416 | - <guid isPermaLink="false"><?php esc_html( the_guid() ); ?></guid> |
|
416 | + <guid isPermaLink="false"><?php esc_html ( the_guid () ); ?></guid> |
|
417 | 417 | <description><![CDATA[<?php echo $description; ?>]]></description> |
418 | 418 | <itunes:subtitle><![CDATA[<?php echo $itunes_subtitle; ?>]]></itunes:subtitle> |
419 | 419 | <content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded> |
420 | 420 | <itunes:summary><![CDATA[<?php echo $itunes_summary; ?>]]></itunes:summary> |
421 | 421 | <googleplay:description><![CDATA[<?php echo $gp_description; ?>]]></googleplay:description> |
422 | 422 | <?php if ( $episode_image ) { ?> |
423 | - <itunes:image href="<?php echo esc_url( $episode_image ); ?>"></itunes:image> |
|
424 | - <googleplay:image href="<?php echo esc_url( $episode_image ); ?>"></googleplay:image> |
|
423 | + <itunes:image href="<?php echo esc_url ( $episode_image ); ?>"></itunes:image> |
|
424 | + <googleplay:image href="<?php echo esc_url ( $episode_image ); ?>"></googleplay:image> |
|
425 | 425 | <?php } ?> |
426 | - <enclosure url="<?php echo esc_url( $enclosure ); ?>" length="<?php echo esc_attr( $size ); ?>" type="<?php echo esc_attr( $mime_type ); ?>"></enclosure> |
|
427 | - <itunes:explicit><?php echo esc_html( $itunes_explicit_flag ); ?></itunes:explicit> |
|
428 | - <googleplay:explicit><?php echo esc_html( $googleplay_explicit_flag ); ?></googleplay:explicit> |
|
429 | - <itunes:block><?php echo esc_html( $block_flag ); ?></itunes:block> |
|
430 | - <googleplay:block><?php echo esc_html( $block_flag ); ?></googleplay:block> |
|
431 | - <itunes:duration><?php echo esc_html( $duration ); ?></itunes:duration> |
|
426 | + <enclosure url="<?php echo esc_url ( $enclosure ); ?>" length="<?php echo esc_attr ( $size ); ?>" type="<?php echo esc_attr ( $mime_type ); ?>"></enclosure> |
|
427 | + <itunes:explicit><?php echo esc_html ( $itunes_explicit_flag ); ?></itunes:explicit> |
|
428 | + <googleplay:explicit><?php echo esc_html ( $googleplay_explicit_flag ); ?></googleplay:explicit> |
|
429 | + <itunes:block><?php echo esc_html ( $block_flag ); ?></itunes:block> |
|
430 | + <googleplay:block><?php echo esc_html ( $block_flag ); ?></googleplay:block> |
|
431 | + <itunes:duration><?php echo esc_html ( $duration ); ?></itunes:duration> |
|
432 | 432 | <itunes:author><?php echo $author; ?></itunes:author> |
433 | 433 | </item> |
434 | 434 | <?php } |
@@ -1134,6 +1134,7 @@ |
||
1134 | 1134 | * returns the original URL |
1135 | 1135 | * |
1136 | 1136 | * @param string file |
1137 | + * @param string $file |
|
1137 | 1138 | * @return string file or local file path |
1138 | 1139 | */ |
1139 | 1140 | function get_local_file_path( $file ) { |
@@ -556,11 +556,11 @@ discard block |
||
556 | 556 | |
557 | 557 | if ( $size ) { |
558 | 558 | |
559 | - $base = log ( $size ) / log( 1024 ); |
|
560 | - $suffixes = array( '' , 'k' , 'M' , 'G' , 'T' ); |
|
561 | - $formatted_size = round( pow( 1024 , $base - floor( $base ) ) , $precision ) . $suffixes[ floor( $base ) ]; |
|
559 | + $base = log ( $size ) / log( 1024 ); |
|
560 | + $suffixes = array( '' , 'k' , 'M' , 'G' , 'T' ); |
|
561 | + $formatted_size = round( pow( 1024 , $base - floor( $base ) ) , $precision ) . $suffixes[ floor( $base ) ]; |
|
562 | 562 | |
563 | - return apply_filters( 'ssp_file_size_formatted', $formatted_size, $size ); |
|
563 | + return apply_filters( 'ssp_file_size_formatted', $formatted_size, $size ); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | return false; |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | wp_cache_set( $key, $mime, 'mime-type', DAY_IN_SECONDS ); |
663 | 663 | } |
664 | 664 | |
665 | - return $mime; |
|
665 | + return $mime; |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | return false; |
@@ -796,15 +796,15 @@ discard block |
||
796 | 796 | foreach ( $terms as $term ) { |
797 | 797 | $query[ $term->term_id ] = new stdClass(); |
798 | 798 | $query[ $term->term_id ]->title = $term->name; |
799 | - $query[ $term->term_id ]->url = get_term_link( $term ); |
|
799 | + $query[ $term->term_id ]->url = get_term_link( $term ); |
|
800 | 800 | |
801 | - $query_args = apply_filters( 'ssp_get_podcast_series_query_args', ssp_episodes( -1, $term->slug, true, '' ) ); |
|
801 | + $query_args = apply_filters( 'ssp_get_podcast_series_query_args', ssp_episodes( -1, $term->slug, true, '' ) ); |
|
802 | 802 | |
803 | - $posts = get_posts( $query_args ); |
|
803 | + $posts = get_posts( $query_args ); |
|
804 | 804 | |
805 | - $count = count( $posts ); |
|
806 | - $query[ $term->term_id ]->count = $count; |
|
807 | - } |
|
805 | + $count = count( $posts ); |
|
806 | + $query[ $term->term_id ]->count = $count; |
|
807 | + } |
|
808 | 808 | } |
809 | 809 | |
810 | 810 | } |
@@ -914,18 +914,18 @@ discard block |
||
914 | 914 | } |
915 | 915 | |
916 | 916 | // Allow other actions - functions hooked on here must not output any data |
917 | - do_action( 'ssp_file_download', $file, $episode, $referrer ); |
|
917 | + do_action( 'ssp_file_download', $file, $episode, $referrer ); |
|
918 | 918 | |
919 | - // Set necessary headers |
|
919 | + // Set necessary headers |
|
920 | 920 | header( "Pragma: no-cache" ); |
921 | 921 | header( "Expires: 0" ); |
922 | 922 | header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); |
923 | 923 | header( "Robots: none" ); |
924 | 924 | |
925 | - // Check file referrer |
|
926 | - if( 'download' == $referrer ) { |
|
925 | + // Check file referrer |
|
926 | + if( 'download' == $referrer ) { |
|
927 | 927 | |
928 | - // Set size of file |
|
928 | + // Set size of file |
|
929 | 929 | // Do we have anything in Cache/DB? |
930 | 930 | $size = wp_cache_get( $episode_id, 'filesize_raw' ); |
931 | 931 | |
@@ -952,22 +952,22 @@ discard block |
||
952 | 952 | } |
953 | 953 | |
954 | 954 | // Send Content-Length header |
955 | - if ( ! empty( $size ) ) { |
|
955 | + if ( ! empty( $size ) ) { |
|
956 | 956 | header( "Content-Length: " . $size ); |
957 | 957 | } |
958 | 958 | |
959 | - // Force file download |
|
960 | - header( "Content-Type: application/force-download" ); |
|
959 | + // Force file download |
|
960 | + header( "Content-Type: application/force-download" ); |
|
961 | 961 | |
962 | - // Set other relevant headers |
|
963 | - header( "Content-Description: File Transfer" ); |
|
964 | - header( "Content-Disposition: attachment; filename=\"" . basename( $file ) . "\";" ); |
|
965 | - header( "Content-Transfer-Encoding: binary" ); |
|
962 | + // Set other relevant headers |
|
963 | + header( "Content-Description: File Transfer" ); |
|
964 | + header( "Content-Disposition: attachment; filename=\"" . basename( $file ) . "\";" ); |
|
965 | + header( "Content-Transfer-Encoding: binary" ); |
|
966 | 966 | |
967 | - // Encode spaces in file names until this is fixed in core (https://core.trac.wordpress.org/ticket/36998) |
|
967 | + // Encode spaces in file names until this is fixed in core (https://core.trac.wordpress.org/ticket/36998) |
|
968 | 968 | $file = str_replace( ' ', '%20', $file ); |
969 | 969 | |
970 | - // Use ssp_readfile_chunked() if allowed on the server or simply access file directly |
|
970 | + // Use ssp_readfile_chunked() if allowed on the server or simply access file directly |
|
971 | 971 | @ssp_readfile_chunked( $file ) or header( 'Location: ' . $file ); |
972 | 972 | } else { |
973 | 973 | |
@@ -1086,24 +1086,24 @@ discard block |
||
1086 | 1086 | public function podcast_episode_shortcode ( $params ) { |
1087 | 1087 | |
1088 | 1088 | $atts = shortcode_atts( array( |
1089 | - 'episode' => 0, |
|
1090 | - 'content' => 'title,player,details', |
|
1091 | - ), $params ); |
|
1089 | + 'episode' => 0, |
|
1090 | + 'content' => 'title,player,details', |
|
1091 | + ), $params ); |
|
1092 | 1092 | |
1093 | 1093 | extract( $atts ); |
1094 | 1094 | |
1095 | - if ( ! $episode ) { |
|
1096 | - return; |
|
1097 | - } |
|
1095 | + if ( ! $episode ) { |
|
1096 | + return; |
|
1097 | + } |
|
1098 | 1098 | |
1099 | - // Setup array of content items and trim whitespace |
|
1100 | - $content_items = explode( ',', $content ); |
|
1101 | - $content_items = array_map( 'trim', $content_items ); |
|
1099 | + // Setup array of content items and trim whitespace |
|
1100 | + $content_items = explode( ',', $content ); |
|
1101 | + $content_items = array_map( 'trim', $content_items ); |
|
1102 | 1102 | |
1103 | - // Get episode for display |
|
1104 | - $html = $this->podcast_episode( $episode, $content_items, 'shortcode' ); |
|
1103 | + // Get episode for display |
|
1104 | + $html = $this->podcast_episode( $episode, $content_items, 'shortcode' ); |
|
1105 | 1105 | |
1106 | - return $html; |
|
1106 | + return $html; |
|
1107 | 1107 | |
1108 | 1108 | } |
1109 | 1109 | |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | if ( get_option( 'permalink_structure' ) ) { |
1158 | 1158 | $file = $this->get_episode_download_link( $episode_id ); |
1159 | 1159 | } |
1160 | - $html .= '<div class="podcast_player">' . $this->media_player( $file, $episode_id ) . '</div>' . "\n"; |
|
1160 | + $html .= '<div class="podcast_player">' . $this->media_player( $file, $episode_id ) . '</div>' . "\n"; |
|
1161 | 1161 | break; |
1162 | 1162 | |
1163 | 1163 | case 'details': |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | |
1173 | 1173 | $html .= '</div>' . "\n"; |
1174 | 1174 | |
1175 | - return $html; |
|
1175 | + return $html; |
|
1176 | 1176 | } |
1177 | 1177 | |
1178 | 1178 | /** |
@@ -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() . ' " class="podcast-meta-download" download>' . __( 'Download file' , 'seriously-simple-podcasting' ) . '</a>'; |
|
365 | + $meta_display .= '<a href="'.esc_url ( $data ).'" title="'.get_the_title ().' " class="podcast-meta-download" download>'.__ ( '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() . ' " class="podcast-meta-new-window">' . __( '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 ().' " class="podcast-meta-new-window">'.__ ( 'Play in new window', 'seriously-simple-podcasting' ).'</a>'; |
|
371 | 371 | break; |
372 | 372 | |
373 | 373 | case 'duration': |
374 | - $meta_display .= '<span class="podcast-meta-duration">' . __( 'Duration' , 'seriously-simple-podcasting' ) . ': ' . $data . '</span>'; |
|
374 | + $meta_display .= '<span class="podcast-meta-duration">'.__ ( 'Duration', 'seriously-simple-podcasting' ).': '.$data.'</span>'; |
|
375 | 375 | break; |
376 | 376 | |
377 | 377 | case 'size': |
378 | - $meta_display .= '<span class="podcast-meta-size">' . __( 'Size' , 'seriously-simple-podcasting' ) . ': ' . $data . '</span>'; |
|
378 | + $meta_display .= '<span class="podcast-meta-size">'.__ ( 'Size', 'seriously-simple-podcasting' ).': '.$data.'</span>'; |
|
379 | 379 | break; |
380 | 380 | |
381 | 381 | case 'date_recorded': |
382 | - $meta_display .= '<span class="podcast-meta-date">' . __( 'Recorded on' , 'seriously-simple-podcasting' ) . ' ' . date_i18n( get_option( 'date_format' ), strtotime( $data ) ) . '</span>'; |
|
382 | + $meta_display .= '<span class="podcast-meta-date">'.__ ( 'Recorded on', 'seriously-simple-podcasting' ).' '.date_i18n ( get_option ( 'date_format' ), strtotime ( $data ) ).'</span>'; |
|
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.9' ); |
|
26 | -$ss_podcasting = new SSP_Frontend( __FILE__, '1.14.9' ); |
|
25 | +$ssp_admin = new SSP_Admin ( __FILE__, '1.14.9' ); |
|
26 | +$ss_podcasting = new SSP_Frontend ( __FILE__, '1.14.9' ); |
|
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 |