| @@ -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 | |
| @@ -195,77 +195,77 @@ discard block | ||
| 195 | 195 | |
| 196 | 196 | $podcast_post_types = ssp_post_types( true ); | 
| 197 | 197 | |
| 198 | - $series_labels = array( | |
| 199 | - 'name' => __( 'Podcast Series' , 'seriously-simple-podcasting' ), | |
| 200 | - 'singular_name' => __( 'Series', 'seriously-simple-podcasting' ), | |
| 201 | - 'search_items' => __( 'Search Series' , 'seriously-simple-podcasting' ), | |
| 202 | - 'all_items' => __( 'All Series' , 'seriously-simple-podcasting' ), | |
| 203 | - 'parent_item' => __( 'Parent Series' , 'seriously-simple-podcasting' ), | |
| 204 | - 'parent_item_colon' => __( 'Parent Series:' , 'seriously-simple-podcasting' ), | |
| 205 | - 'edit_item' => __( 'Edit Series' , 'seriously-simple-podcasting' ), | |
| 206 | - 'update_item' => __( 'Update Series' , 'seriously-simple-podcasting' ), | |
| 207 | - 'add_new_item' => __( 'Add New Series' , 'seriously-simple-podcasting' ), | |
| 208 | - 'new_item_name' => __( 'New Series Name' , 'seriously-simple-podcasting' ), | |
| 209 | - 'menu_name' => __( 'Series' , 'seriously-simple-podcasting' ), | |
| 210 | - 'view_item' => __( 'View Series' , 'seriously-simple-podcasting' ), | |
| 211 | - 'popular_items' => __( 'Popular Series' , 'seriously-simple-podcasting' ), | |
| 212 | - 'separate_items_with_commas' => __( 'Separate series with commas' , 'seriously-simple-podcasting' ), | |
| 213 | - 'add_or_remove_items' => __( 'Add or remove Series' , 'seriously-simple-podcasting' ), | |
| 214 | - 'choose_from_most_used' => __( 'Choose from the most used Series' , 'seriously-simple-podcasting' ), | |
| 215 | - 'not_found' => __( 'No Series Found' , 'seriously-simple-podcasting' ), | |
| 216 | - 'items_list_navigation' => __( 'Series list navigation' , 'seriously-simple-podcasting' ), | |
| 217 | - 'items_list' => __( 'Series list' , 'seriously-simple-podcasting' ), | |
| 218 | - ); | |
| 219 | - | |
| 220 | - $series_args = array( | |
| 221 | - 'public' => true, | |
| 222 | - 'hierarchical' => true, | |
| 223 | - 'rewrite' => array( 'slug' => apply_filters( 'ssp_series_slug', 'series' ) ), | |
| 224 | - 'labels' => $series_labels, | |
| 225 | - 'show_in_rest' => true, | |
| 226 | - ); | |
| 227 | - | |
| 228 | - $series_args = apply_filters( 'ssp_register_taxonomy_args', $series_args, 'series' ); | |
| 229 | - | |
| 230 | - register_taxonomy( 'series', $podcast_post_types, $series_args ); | |
| 231 | - | |
| 232 | - // Add Tags to podcast post type | |
| 233 | -        if ( apply_filters( 'ssp_use_post_tags', true ) ) { | |
| 234 | - register_taxonomy_for_object_type( 'post_tag', $this->token ); | |
| 235 | - } | |
| 236 | - } | |
| 237 | - | |
| 238 | -    public function register_meta() { | |
| 239 | - global $wp_version; | |
| 240 | - | |
| 241 | - // The enhanced register_meta function is only available for WordPress 4.6+ | |
| 242 | -    	if( version_compare( $wp_version, '4.6', '<' ) ) { | |
| 243 | - return; | |
| 244 | - } | |
| 245 | - | |
| 246 | - // Get all displayed custom fields | |
| 247 | - $fields = $this->custom_fields(); | |
| 248 | - | |
| 249 | - // Add 'filesize_raw' as this is not included in the displayed field options | |
| 250 | - $fields['filesize_raw'] = array( | |
| 251 | - 'meta_description' => __( 'The raw file size of the podcast episode media file in bytes.', 'seriously-simple-podcasting' ), | |
| 198 | + $series_labels = array( | |
| 199 | + 'name' => __( 'Podcast Series' , 'seriously-simple-podcasting' ), | |
| 200 | + 'singular_name' => __( 'Series', 'seriously-simple-podcasting' ), | |
| 201 | + 'search_items' => __( 'Search Series' , 'seriously-simple-podcasting' ), | |
| 202 | + 'all_items' => __( 'All Series' , 'seriously-simple-podcasting' ), | |
| 203 | + 'parent_item' => __( 'Parent Series' , 'seriously-simple-podcasting' ), | |
| 204 | + 'parent_item_colon' => __( 'Parent Series:' , 'seriously-simple-podcasting' ), | |
| 205 | + 'edit_item' => __( 'Edit Series' , 'seriously-simple-podcasting' ), | |
| 206 | + 'update_item' => __( 'Update Series' , 'seriously-simple-podcasting' ), | |
| 207 | + 'add_new_item' => __( 'Add New Series' , 'seriously-simple-podcasting' ), | |
| 208 | + 'new_item_name' => __( 'New Series Name' , 'seriously-simple-podcasting' ), | |
| 209 | + 'menu_name' => __( 'Series' , 'seriously-simple-podcasting' ), | |
| 210 | + 'view_item' => __( 'View Series' , 'seriously-simple-podcasting' ), | |
| 211 | + 'popular_items' => __( 'Popular Series' , 'seriously-simple-podcasting' ), | |
| 212 | + 'separate_items_with_commas' => __( 'Separate series with commas' , 'seriously-simple-podcasting' ), | |
| 213 | + 'add_or_remove_items' => __( 'Add or remove Series' , 'seriously-simple-podcasting' ), | |
| 214 | + 'choose_from_most_used' => __( 'Choose from the most used Series' , 'seriously-simple-podcasting' ), | |
| 215 | + 'not_found' => __( 'No Series Found' , 'seriously-simple-podcasting' ), | |
| 216 | + 'items_list_navigation' => __( 'Series list navigation' , 'seriously-simple-podcasting' ), | |
| 217 | + 'items_list' => __( 'Series list' , 'seriously-simple-podcasting' ), | |
| 252 | 218 | ); | 
| 253 | 219 | |
| 254 | -    	foreach( $fields as $key => $data ) { | |
| 220 | + $series_args = array( | |
| 221 | + 'public' => true, | |
| 222 | + 'hierarchical' => true, | |
| 223 | + 'rewrite' => array( 'slug' => apply_filters( 'ssp_series_slug', 'series' ) ), | |
| 224 | + 'labels' => $series_labels, | |
| 225 | + 'show_in_rest' => true, | |
| 226 | + ); | |
| 227 | + | |
| 228 | + $series_args = apply_filters( 'ssp_register_taxonomy_args', $series_args, 'series' ); | |
| 229 | + | |
| 230 | + register_taxonomy( 'series', $podcast_post_types, $series_args ); | |
| 231 | + | |
| 232 | + // Add Tags to podcast post type | |
| 233 | +		if ( apply_filters( 'ssp_use_post_tags', true ) ) { | |
| 234 | + register_taxonomy_for_object_type( 'post_tag', $this->token ); | |
| 235 | + } | |
| 236 | + } | |
| 237 | + | |
| 238 | +	public function register_meta() { | |
| 239 | + global $wp_version; | |
| 240 | + | |
| 241 | + // The enhanced register_meta function is only available for WordPress 4.6+ | |
| 242 | +		if( version_compare( $wp_version, '4.6', '<' ) ) { | |
| 243 | + return; | |
| 244 | + } | |
| 245 | + | |
| 246 | + // Get all displayed custom fields | |
| 247 | + $fields = $this->custom_fields(); | |
| 248 | + | |
| 249 | + // Add 'filesize_raw' as this is not included in the displayed field options | |
| 250 | + $fields['filesize_raw'] = array( | |
| 251 | + 'meta_description' => __( 'The raw file size of the podcast episode media file in bytes.', 'seriously-simple-podcasting' ), | |
| 252 | + ); | |
| 255 | 253 | |
| 256 | - $args = array( | |
| 254 | +		foreach( $fields as $key => $data ) { | |
| 255 | + | |
| 256 | + $args = array( | |
| 257 | 257 | 'type' => 'string', | 
| 258 | 258 | 'description' => $data->meta_description, | 
| 259 | 259 | 'single' => true, | 
| 260 | 260 | 'show_in_rest' => true, | 
| 261 | 261 | ); | 
| 262 | 262 | |
| 263 | - register_meta( 'post', $key, $args ); | |
| 264 | - } | |
| 263 | + register_meta( 'post', $key, $args ); | |
| 264 | + } | |
| 265 | 265 | |
| 266 | - } | |
| 266 | + } | |
| 267 | 267 | |
| 268 | - /** | |
| 268 | + /** | |
| 269 | 269 | * Register columns for podcast list table | 
| 270 | 270 | * @param array $defaults Default columns | 
| 271 | 271 | * @return array Modified columns | 
| @@ -282,12 +282,12 @@ discard block | ||
| 282 | 282 | return $columns; | 
| 283 | 283 | } | 
| 284 | 284 | |
| 285 | - /** | |
| 286 | - * Display column data in podcast list table | |
| 287 | - * @param string $column_name Name of current column | |
| 288 | - * @param integer $id ID of episode | |
| 289 | - * @return void | |
| 290 | - */ | |
| 285 | + /** | |
| 286 | + * Display column data in podcast list table | |
| 287 | + * @param string $column_name Name of current column | |
| 288 | + * @param integer $id ID of episode | |
| 289 | + * @return void | |
| 290 | + */ | |
| 291 | 291 |  	public function register_custom_columns( $column_name, $id ) { | 
| 292 | 292 | global $ss_podcasting; | 
| 293 | 293 | |
| @@ -317,34 +317,34 @@ discard block | ||
| 317 | 317 | */ | 
| 318 | 318 |  	public function edit_series_columns( $columns ) { | 
| 319 | 319 | |
| 320 | - unset( $columns['description'] ); | |
| 321 | - unset( $columns['posts'] ); | |
| 320 | + unset( $columns['description'] ); | |
| 321 | + unset( $columns['posts'] ); | |
| 322 | 322 | |
| 323 | - $columns['series_feed_url'] = __( 'Series feed URL' , 'seriously-simple-podcasting' ); | |
| 324 | - $columns['posts'] = __( 'Episodes' , 'seriously-simple-podcasting' ); | |
| 323 | + $columns['series_feed_url'] = __( 'Series feed URL' , 'seriously-simple-podcasting' ); | |
| 324 | + $columns['posts'] = __( 'Episodes' , 'seriously-simple-podcasting' ); | |
| 325 | 325 | |
| 326 | - $columns = apply_filters( 'ssp_admin_columns_series', $columns ); | |
| 326 | + $columns = apply_filters( 'ssp_admin_columns_series', $columns ); | |
| 327 | 327 | |
| 328 | - return $columns; | |
| 329 | - } | |
| 328 | + return $columns; | |
| 329 | + } | |
| 330 | 330 | |
| 331 | - /** | |
| 332 | - * Display column data in series list table | |
| 333 | - * | |
| 334 | - * @param string $column_data Default column content | |
| 335 | - * @param string $column_name Name of current column | |
| 336 | - * @param integer $term_id ID of term | |
| 337 | - * | |
| 338 | - * @return string | |
| 339 | - */ | |
| 340 | -    public function add_series_columns( $column_data , $column_name , $term_id ) { | |
| 331 | + /** | |
| 332 | + * Display column data in series list table | |
| 333 | + * | |
| 334 | + * @param string $column_data Default column content | |
| 335 | + * @param string $column_name Name of current column | |
| 336 | + * @param integer $term_id ID of term | |
| 337 | + * | |
| 338 | + * @return string | |
| 339 | + */ | |
| 340 | +	public function add_series_columns( $column_data , $column_name , $term_id ) { | |
| 341 | 341 | |
| 342 | -        switch ( $column_name ) { | |
| 343 | - case 'series_feed_url': | |
| 344 | - $series = get_term( $term_id, 'series' ); | |
| 345 | - $series_slug = $series->slug; | |
| 342 | +		switch ( $column_name ) { | |
| 343 | + case 'series_feed_url': | |
| 344 | + $series = get_term( $term_id, 'series' ); | |
| 345 | + $series_slug = $series->slug; | |
| 346 | 346 | |
| 347 | -            	if ( get_option( 'permalink_structure' ) ) { | |
| 347 | +				if ( get_option( 'permalink_structure' ) ) { | |
| 348 | 348 | $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); | 
| 349 | 349 | $feed_url = $this->home_url . 'feed/' . $feed_slug . '/' . $series_slug; | 
| 350 | 350 |  				} else { | 
| @@ -357,33 +357,33 @@ discard block | ||
| 357 | 357 | ); | 
| 358 | 358 | } | 
| 359 | 359 | |
| 360 | - $column_data = '<a href="' . esc_attr( $feed_url ) . '" target="_blank">' . esc_html( $feed_url ) . '</a>'; | |
| 361 | - break; | |
| 362 | - } | |
| 360 | + $column_data = '<a href="' . esc_attr( $feed_url ) . '" target="_blank">' . esc_html( $feed_url ) . '</a>'; | |
| 361 | + break; | |
| 362 | + } | |
| 363 | 363 | |
| 364 | - return $column_data; | |
| 365 | - } | |
| 364 | + return $column_data; | |
| 365 | + } | |
| 366 | 366 | |
| 367 | - /** | |
| 368 | - * Create custom dashboard message | |
| 369 | - * @param array $messages Default messages | |
| 370 | - * @return array Modified messages | |
| 371 | - */ | |
| 367 | + /** | |
| 368 | + * Create custom dashboard message | |
| 369 | + * @param array $messages Default messages | |
| 370 | + * @return array Modified messages | |
| 371 | + */ | |
| 372 | 372 |  	public function updated_messages( $messages ) { | 
| 373 | 373 | global $post, $post_ID; | 
| 374 | 374 | |
| 375 | 375 | $messages[ $this->token ] = array( | 
| 376 | - 0 => '', | |
| 377 | - 1 => sprintf( __( 'Episode updated. %sView episode%s.' , 'seriously-simple-podcasting' ), '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), | |
| 378 | - 2 => __( 'Custom field updated.' , 'seriously-simple-podcasting' ), | |
| 379 | - 3 => __( 'Custom field deleted.' , 'seriously-simple-podcasting' ), | |
| 380 | - 4 => __( 'Episode updated.' , 'seriously-simple-podcasting' ), | |
| 381 | - 5 => isset($_GET['revision']) ? sprintf( __( 'Episode restored to revision from %s.' , 'seriously-simple-podcasting' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, | |
| 382 | - 6 => sprintf( __( 'Episode published. %sView episode%s.' , 'seriously-simple-podcasting' ), '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), | |
| 383 | - 7 => __( 'Episode saved.' , 'seriously-simple-podcasting' ), | |
| 384 | - 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>' ), | |
| 385 | - 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>' ), | |
| 386 | - 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>' ), | |
| 376 | + 0 => '', | |
| 377 | + 1 => sprintf( __( 'Episode updated. %sView episode%s.' , 'seriously-simple-podcasting' ), '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), | |
| 378 | + 2 => __( 'Custom field updated.' , 'seriously-simple-podcasting' ), | |
| 379 | + 3 => __( 'Custom field deleted.' , 'seriously-simple-podcasting' ), | |
| 380 | + 4 => __( 'Episode updated.' , 'seriously-simple-podcasting' ), | |
| 381 | + 5 => isset($_GET['revision']) ? sprintf( __( 'Episode restored to revision from %s.' , 'seriously-simple-podcasting' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, | |
| 382 | + 6 => sprintf( __( 'Episode published. %sView episode%s.' , 'seriously-simple-podcasting' ), '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), | |
| 383 | + 7 => __( 'Episode saved.' , 'seriously-simple-podcasting' ), | |
| 384 | + 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>' ), | |
| 385 | + 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>' ), | |
| 386 | + 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>' ), | |
| 387 | 387 | ); | 
| 388 | 388 | |
| 389 | 389 | return $messages; | 
| @@ -651,67 +651,67 @@ discard block | ||
| 651 | 651 | |
| 652 | 652 | $fields['episode_type'] = array( | 
| 653 | 653 | 'name' => __( 'Episode type:' , 'seriously-simple-podcasting' ), | 
| 654 | - 'description' => '', | |
| 655 | - 'type' => 'radio', | |
| 656 | - 'default' => 'audio', | |
| 657 | - 'options' => array( 'audio' => __( 'Audio', 'seriously-simple-podcasting' ), 'video' => __( 'Video', 'seriously-simple-podcasting' ) ), | |
| 658 | - 'section' => 'info', | |
| 659 | - 'meta_description' => __( 'The type of podcast episode - either Audio or Video', 'seriously-simple-podcasting' ), | |
| 654 | + 'description' => '', | |
| 655 | + 'type' => 'radio', | |
| 656 | + 'default' => 'audio', | |
| 657 | + 'options' => array( 'audio' => __( 'Audio', 'seriously-simple-podcasting' ), 'video' => __( 'Video', 'seriously-simple-podcasting' ) ), | |
| 658 | + 'section' => 'info', | |
| 659 | + 'meta_description' => __( 'The type of podcast episode - either Audio or Video', 'seriously-simple-podcasting' ), | |
| 660 | 660 | ); | 
| 661 | 661 | |
| 662 | 662 | // 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 | 
| 663 | 663 | $fields['audio_file'] = array( | 
| 664 | - 'name' => __( 'Podcast file:' , 'seriously-simple-podcasting' ), | |
| 665 | - 'description' => __( 'Upload the primary podcast file or paste the file URL here.' , 'seriously-simple-podcasting' ), | |
| 666 | - 'type' => 'file', | |
| 667 | - 'default' => '', | |
| 668 | - 'section' => 'info', | |
| 669 | - 'meta_description' => __( 'The full URL for the podcast episode media file.', 'seriously-simple-podcasting' ), | |
| 664 | + 'name' => __( 'Podcast file:' , 'seriously-simple-podcasting' ), | |
| 665 | + 'description' => __( 'Upload the primary podcast file or paste the file URL here.' , 'seriously-simple-podcasting' ), | |
| 666 | + 'type' => 'file', | |
| 667 | + 'default' => '', | |
| 668 | + 'section' => 'info', | |
| 669 | + 'meta_description' => __( 'The full URL for the podcast episode media file.', 'seriously-simple-podcasting' ), | |
| 670 | 670 | ); | 
| 671 | 671 | |
| 672 | 672 | $fields['duration'] = array( | 
| 673 | - 'name' => __( 'Duration:' , 'seriously-simple-podcasting' ), | |
| 674 | - 'description' => __( 'Duration of podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ), | |
| 675 | - 'type' => 'text', | |
| 676 | - 'default' => '', | |
| 677 | - 'section' => 'info', | |
| 678 | - 'meta_description' => __( 'The duration of the file for display purposes.', 'seriously-simple-podcasting' ), | |
| 673 | + 'name' => __( 'Duration:' , 'seriously-simple-podcasting' ), | |
| 674 | + 'description' => __( 'Duration of podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ), | |
| 675 | + 'type' => 'text', | |
| 676 | + 'default' => '', | |
| 677 | + 'section' => 'info', | |
| 678 | + 'meta_description' => __( 'The duration of the file for display purposes.', 'seriously-simple-podcasting' ), | |
| 679 | 679 | ); | 
| 680 | 680 | |
| 681 | 681 | $fields['filesize'] = array( | 
| 682 | - 'name' => __( 'File size:' , 'seriously-simple-podcasting' ), | |
| 683 | - 'description' => __( 'Size of the podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ), | |
| 684 | - 'type' => 'text', | |
| 685 | - 'default' => '', | |
| 686 | - 'section' => 'info', | |
| 687 | - 'meta_description' => __( 'The size of the podcast episode for display purposes.', 'seriously-simple-podcasting' ), | |
| 682 | + 'name' => __( 'File size:' , 'seriously-simple-podcasting' ), | |
| 683 | + 'description' => __( 'Size of the podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ), | |
| 684 | + 'type' => 'text', | |
| 685 | + 'default' => '', | |
| 686 | + 'section' => 'info', | |
| 687 | + 'meta_description' => __( 'The size of the podcast episode for display purposes.', 'seriously-simple-podcasting' ), | |
| 688 | 688 | ); | 
| 689 | 689 | |
| 690 | 690 | $fields['date_recorded'] = array( | 
| 691 | - 'name' => __( 'Date recorded:' , 'seriously-simple-podcasting' ), | |
| 692 | - 'description' => __( 'The date on which this episode was recorded.' , 'seriously-simple-podcasting' ), | |
| 693 | - 'type' => 'datepicker', | |
| 694 | - 'default' => '', | |
| 695 | - 'section' => 'info', | |
| 696 | - 'meta_description' => __( 'The date on which the podcast episode was recorded.', 'seriously-simple-podcasting' ), | |
| 691 | + 'name' => __( 'Date recorded:' , 'seriously-simple-podcasting' ), | |
| 692 | + 'description' => __( 'The date on which this episode was recorded.' , 'seriously-simple-podcasting' ), | |
| 693 | + 'type' => 'datepicker', | |
| 694 | + 'default' => '', | |
| 695 | + 'section' => 'info', | |
| 696 | + 'meta_description' => __( 'The date on which the podcast episode was recorded.', 'seriously-simple-podcasting' ), | |
| 697 | 697 | ); | 
| 698 | 698 | |
| 699 | 699 | $fields['explicit'] = array( | 
| 700 | - 'name' => __( 'Explicit:' , 'seriously-simple-podcasting' ), | |
| 701 | - 'description' => __( 'Mark this episode as explicit.' , 'seriously-simple-podcasting' ), | |
| 702 | - 'type' => 'checkbox', | |
| 703 | - 'default' => '', | |
| 704 | - 'section' => 'info', | |
| 705 | - 'meta_description' => __( 'Indicates whether the episode is explicit or not.', 'seriously-simple-podcasting' ), | |
| 700 | + 'name' => __( 'Explicit:' , 'seriously-simple-podcasting' ), | |
| 701 | + 'description' => __( 'Mark this episode as explicit.' , 'seriously-simple-podcasting' ), | |
| 702 | + 'type' => 'checkbox', | |
| 703 | + 'default' => '', | |
| 704 | + 'section' => 'info', | |
| 705 | + 'meta_description' => __( 'Indicates whether the episode is explicit or not.', 'seriously-simple-podcasting' ), | |
| 706 | 706 | ); | 
| 707 | 707 | |
| 708 | 708 | $fields['block'] = array( | 
| 709 | - 'name' => __( 'Block:' , 'seriously-simple-podcasting' ), | |
| 710 | - 'description' => __( 'Block this episode from appearing in the iTunes & Google Play podcast libraries.' , 'seriously-simple-podcasting' ), | |
| 711 | - 'type' => 'checkbox', | |
| 712 | - 'default' => '', | |
| 713 | - 'section' => 'info', | |
| 714 | - 'meta_description' => __( 'Indicates whether this specific episode should be blocked from the iTunes and Google Play Podcast libraries.', 'seriously-simple-podcasting' ), | |
| 709 | + 'name' => __( 'Block:' , 'seriously-simple-podcasting' ), | |
| 710 | + 'description' => __( 'Block this episode from appearing in the iTunes & Google Play podcast libraries.' , 'seriously-simple-podcasting' ), | |
| 711 | + 'type' => 'checkbox', | |
| 712 | + 'default' => '', | |
| 713 | + 'section' => 'info', | |
| 714 | + 'meta_description' => __( 'Indicates whether this specific episode should be blocked from the iTunes and Google Play Podcast libraries.', 'seriously-simple-podcasting' ), | |
| 715 | 715 | ); | 
| 716 | 716 | |
| 717 | 717 | return apply_filters( 'ssp_episode_fields', $fields ); | 
| @@ -817,20 +817,20 @@ discard block | ||
| 817 | 817 | * @return void | 
| 818 | 818 | */ | 
| 819 | 819 |  	public function load_plugin_textdomain() { | 
| 820 | - $domain = 'seriously-simple-podcasting'; | |
| 821 | - // The "plugin_locale" filter is also used in load_plugin_textdomain() | |
| 822 | - $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); | |
| 820 | + $domain = 'seriously-simple-podcasting'; | |
| 821 | + // The "plugin_locale" filter is also used in load_plugin_textdomain() | |
| 822 | + $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); | |
| 823 | 823 | |
| 824 | - load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' ); | |
| 825 | - load_plugin_textdomain( $domain, false, dirname( plugin_basename( $this->file ) ) . '/lang/' ); | |
| 824 | + load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' ); | |
| 825 | + load_plugin_textdomain( $domain, false, dirname( plugin_basename( $this->file ) ) . '/lang/' ); | |
| 826 | 826 | } | 
| 827 | 827 | |
| 828 | - /** | |
| 829 | - * Register podcast feed | |
| 830 | - * @return void | |
| 831 | - */ | |
| 832 | -    public function add_feed() { | |
| 833 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); | |
| 828 | + /** | |
| 829 | + * Register podcast feed | |
| 830 | + * @return void | |
| 831 | + */ | |
| 832 | +	public function add_feed() { | |
| 833 | + $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); | |
| 834 | 834 | add_feed( $feed_slug, array( $this, 'feed_template' ) ); | 
| 835 | 835 | } | 
| 836 | 836 | |
| @@ -852,31 +852,31 @@ discard block | ||
| 852 | 852 | * Load feed template | 
| 853 | 853 | * @return void | 
| 854 | 854 | */ | 
| 855 | -    public function feed_template() { | |
| 856 | - global $wp_query; | |
| 855 | +	public function feed_template() { | |
| 856 | + global $wp_query; | |
| 857 | 857 | |
| 858 | - // Prevent 404 on feed | |
| 859 | - $wp_query->is_404 = false; | |
| 860 | - status_header( 200 ); | |
| 858 | + // Prevent 404 on feed | |
| 859 | + $wp_query->is_404 = false; | |
| 860 | + status_header( 200 ); | |
| 861 | 861 | |
| 862 | - $file_name = 'feed-podcast.php'; | |
| 862 | + $file_name = 'feed-podcast.php'; | |
| 863 | 863 | |
| 864 | - $user_template_file = apply_filters( 'ssp_feed_template_file', trailingslashit( get_stylesheet_directory() ) . $file_name ); | |
| 864 | + $user_template_file = apply_filters( 'ssp_feed_template_file', trailingslashit( get_stylesheet_directory() ) . $file_name ); | |
| 865 | 865 | |
| 866 | 866 | // Any functions hooked in here must NOT output any data or else feed will break | 
| 867 | 867 | do_action( 'ssp_before_feed' ); | 
| 868 | 868 | |
| 869 | - // Load user feed template if it exists, otherwise use plugin template | |
| 870 | -    	if ( file_exists( $user_template_file ) ) { | |
| 871 | - require( $user_template_file ); | |
| 872 | -    	} else { | |
| 873 | - require( $this->template_path . $file_name ); | |
| 874 | - } | |
| 869 | + // Load user feed template if it exists, otherwise use plugin template | |
| 870 | +		if ( file_exists( $user_template_file ) ) { | |
| 871 | + require( $user_template_file ); | |
| 872 | +		} else { | |
| 873 | + require( $this->template_path . $file_name ); | |
| 874 | + } | |
| 875 | 875 | |
| 876 | - // Any functions hooked in here must NOT output any data or else feed will break | |
| 877 | - do_action( 'ssp_after_feed' ); | |
| 876 | + // Any functions hooked in here must NOT output any data or else feed will break | |
| 877 | + do_action( 'ssp_after_feed' ); | |
| 878 | 878 | |
| 879 | - exit; | |
| 879 | + exit; | |
| 880 | 880 | } | 
| 881 | 881 | |
| 882 | 882 | /** | 
| @@ -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 | } | 
| @@ -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 | 
| @@ -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 | } | 
| @@ -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 | /** |