Completed
Push — master ( af52c3...5ee026 )
by Hugh
02:46
created
includes/class-ssp-admin.php 1 patch
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -83,19 +83,19 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	/**
Please login to merge, or discard this patch.