Completed
Push — master ( d02293...3f461d )
by Hugh
13s
created
includes/class-ssp-admin.php 1 patch
Spacing   +293 added lines, -293 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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, taxonomies and meta fields
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
 block discarded – undo
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
 block discarded – undo
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,12 +179,12 @@  discard block
 block discarded – undo
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();
187
-		$this->register_meta();
186
+		$this->register_taxonomies ();
187
+		$this->register_meta ();
188 188
 	}
189 189
 
190 190
 	/**
@@ -193,45 +193,45 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	private function register_taxonomies() {
195 195
 
196
-		$podcast_post_types = ssp_post_types( true );
196
+		$podcast_post_types = ssp_post_types ( true );
197 197
 
198 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' ),
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 218
         );
219 219
 
220 220
         $series_args = array(
221 221
             'public' => true,
222 222
             'hierarchical' => true,
223
-            'rewrite' => array( 'slug' => apply_filters( 'ssp_series_slug', 'series' ) ),
223
+            'rewrite' => array( 'slug' => apply_filters ( 'ssp_series_slug', 'series' ) ),
224 224
             'labels' => $series_labels,
225 225
             'show_in_rest' => true,
226 226
         );
227 227
 
228
-        $series_args = apply_filters( 'ssp_register_taxonomy_args', $series_args, 'series' );
228
+        $series_args = apply_filters ( 'ssp_register_taxonomy_args', $series_args, 'series' );
229 229
 
230
-        register_taxonomy( 'series', $podcast_post_types, $series_args );
230
+        register_taxonomy ( 'series', $podcast_post_types, $series_args );
231 231
 
232 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 );
233
+        if ( apply_filters ( 'ssp_use_post_tags', true ) ) {
234
+        	register_taxonomy_for_object_type ( 'post_tag', $this->token );
235 235
         }
236 236
     }
237 237
 
@@ -239,28 +239,28 @@  discard block
 block discarded – undo
239 239
     	global $wp_version;
240 240
 
241 241
     	// The enhanced register_meta function is only available for WordPress 4.6+
242
-    	if( version_compare( $wp_version, '4.6', '<' ) ) {
242
+    	if ( version_compare ( $wp_version, '4.6', '<' ) ) {
243 243
     		return;
244 244
     	}
245 245
 
246 246
     	// Get all displayed custom fields
247
-    	$fields = $this->custom_fields();
247
+    	$fields = $this->custom_fields ();
248 248
 
249 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' ),
250
+    	$fields[ 'filesize_raw' ] = array(
251
+    		'meta_description' => __ ( 'The raw file size of the podcast episode media file in bytes.', 'seriously-simple-podcasting' ),
252 252
 		);
253 253
 
254
-    	foreach( $fields as $key => $data ) {
254
+    	foreach ( $fields as $key => $data ) {
255 255
 
256 256
     		$args = array(
257 257
 				'type' => 'string',
258
-				'description' => $data['meta_description'],
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 );
263
+    		register_meta ( 'post', $key, $args );
264 264
     	}
265 265
 
266 266
     }
@@ -271,13 +271,13 @@  discard block
 block discarded – undo
271 271
 	 * @return array           Modified columns
272 272
 	 */
273 273
 	public function register_custom_column_headings( $defaults ) {
274
-		$new_columns = apply_filters( 'ssp_admin_columns_episodes', array( 'series' => __( 'Series' , 'seriously-simple-podcasting' ) , 'image' => __( 'Image' , 'seriously-simple-podcasting' ) ) );
274
+		$new_columns = apply_filters ( 'ssp_admin_columns_episodes', array( 'series' => __ ( 'Series', 'seriously-simple-podcasting' ), 'image' => __ ( 'Image', 'seriously-simple-podcasting' ) ) );
275 275
 
276 276
 		// remove date column
277
-		unset( $defaults['date'] );
277
+		unset( $defaults[ 'date' ] );
278 278
 
279 279
 		// add new columns before last default one
280
-		$columns = array_slice( $defaults, 0, -1 ) + $new_columns + array_slice( $defaults, -1 );
280
+		$columns = array_slice ( $defaults, 0, -1 ) + $new_columns + array_slice ( $defaults, -1 );
281 281
 
282 282
 		return $columns;
283 283
 	}
@@ -294,13 +294,13 @@  discard block
 block discarded – undo
294 294
 		switch ( $column_name ) {
295 295
 
296 296
 			case 'series':
297
-				$terms = wp_get_post_terms( $id , 'series' );
298
-				$term_names = wp_list_pluck( $terms, 'name' );
299
-				echo join( ', ', $term_names );
297
+				$terms = wp_get_post_terms ( $id, 'series' );
298
+				$term_names = wp_list_pluck ( $terms, 'name' );
299
+				echo join ( ', ', $term_names );
300 300
 			break;
301 301
 
302 302
 			case 'image':
303
-				$value = $ss_podcasting->get_image( $id, 40 );
303
+				$value = $ss_podcasting->get_image ( $id, 40 );
304 304
 				echo $value;
305 305
 			break;
306 306
 
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
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 328
         return $columns;
329 329
     }
@@ -337,18 +337,18 @@  discard block
 block discarded – undo
337 337
      *
338 338
      * @return string
339 339
      */
340
-    public function add_series_columns( $column_data , $column_name , $term_id ) {
340
+    public function add_series_columns( $column_data, $column_name, $term_id ) {
341 341
 
342 342
         switch ( $column_name ) {
343 343
             case 'series_feed_url':
344
-            	$series = get_term( $term_id, 'series' );
344
+            	$series = get_term ( $term_id, 'series' );
345 345
             	$series_slug = $series->slug;
346 346
 
347
-            	if ( get_option( 'permalink_structure' ) ) {
348
-					$feed_slug = apply_filters( 'ssp_feed_slug', $this->token );
349
-					$feed_url = $this->home_url . 'feed/' . $feed_slug . '/' . $series_slug;
347
+            	if ( get_option ( 'permalink_structure' ) ) {
348
+					$feed_slug = apply_filters ( 'ssp_feed_slug', $this->token );
349
+					$feed_url = $this->home_url.'feed/'.$feed_slug.'/'.$series_slug;
350 350
 				} else {
351
-					$feed_url = add_query_arg(
351
+					$feed_url = add_query_arg (
352 352
 						array(
353 353
 							'feed' => $this->token,
354 354
 							'podcast_series' => $series_slug
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 					);
358 358
 				}
359 359
 
360
-                $column_data = '<a href="' . esc_attr( $feed_url ) . '" target="_blank">' . esc_html( $feed_url ) . '</a>';
360
+                $column_data = '<a href="'.esc_attr ( $feed_url ).'" target="_blank">'.esc_html ( $feed_url ).'</a>';
361 361
             break;
362 362
         }
363 363
 
@@ -374,16 +374,16 @@  discard block
 block discarded – undo
374 374
 
375 375
 	  $messages[ $this->token ] = array(
376 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>' ),
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;
@@ -393,14 +393,14 @@  discard block
 block discarded – undo
393 393
 	 * Register podcast episode details meta boxes
394 394
 	 * @return void
395 395
 	 */
396
-	public function register_meta_boxes () {
396
+	public function register_meta_boxes() {
397 397
 
398 398
 		// Get all podcast post types
399
-		$podcast_post_types = ssp_post_types( true );
399
+		$podcast_post_types = ssp_post_types ( true );
400 400
 
401 401
 		// Add meta box to each post type
402 402
 		foreach ( (array) $podcast_post_types as $post_type ) {
403
-			add_action( 'add_meta_boxes_' . $post_type, array( $this, 'meta_box_setup' ), 10, 1 );
403
+			add_action ( 'add_meta_boxes_'.$post_type, array( $this, 'meta_box_setup' ), 10, 1 );
404 404
 		}
405 405
 	}
406 406
 
@@ -408,17 +408,17 @@  discard block
 block discarded – undo
408 408
 	 * Create meta box on episode edit screen
409 409
 	 * @return void
410 410
 	 */
411
-	public function meta_box_setup ( $post ) {
411
+	public function meta_box_setup( $post ) {
412 412
 		global $pagenow;
413 413
 
414
-		add_meta_box( 'podcast-episode-data', __( 'Podcast Episode Details' , 'seriously-simple-podcasting' ), array( $this, 'meta_box_content' ), $post->post_type, 'normal', 'high' );
414
+		add_meta_box ( 'podcast-episode-data', __ ( 'Podcast Episode Details', 'seriously-simple-podcasting' ), array( $this, 'meta_box_content' ), $post->post_type, 'normal', 'high' );
415 415
 
416
-		if( 'post.php' == $pagenow && 'publish' == $post->post_status && function_exists( 'get_post_embed_html' ) ) {
417
-			add_meta_box( 'episode-embed-code', __( 'Episode Embed Code' , 'seriously-simple-podcasting' ), array( $this, 'embed_code_meta_box_content' ), $post->post_type, 'side', 'low' );
416
+		if ( 'post.php' == $pagenow && 'publish' == $post->post_status && function_exists ( 'get_post_embed_html' ) ) {
417
+			add_meta_box ( 'episode-embed-code', __ ( 'Episode Embed Code', 'seriously-simple-podcasting' ), array( $this, 'embed_code_meta_box_content' ), $post->post_type, 'side', 'low' );
418 418
 		}
419 419
 
420 420
 		// Allow more metaboxes to be added
421
-		do_action( 'ssp_meta_boxes', $post );
421
+		do_action ( 'ssp_meta_boxes', $post );
422 422
 
423 423
 	}
424 424
 
@@ -427,15 +427,15 @@  discard block
 block discarded – undo
427 427
 	 * @param  object $post Current post object
428 428
 	 * @return void
429 429
 	 */
430
-	public function embed_code_meta_box_content ( $post ) {
430
+	public function embed_code_meta_box_content( $post ) {
431 431
 
432 432
 		// Get post embed code
433
-		$embed_code = get_post_embed_html( 500, 350, $post );
433
+		$embed_code = get_post_embed_html ( 500, 350, $post );
434 434
 
435 435
 		// Generate markup for meta box
436
-		$html = '<p><em>' . __( 'Customise the size of your episode embed below, then copy the HTML to your clipboard.', 'seriously-simple-podcasting' ) . '</em></p>';
437
-		$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" /> &nbsp;&nbsp;&nbsp;&nbsp;<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>';
438
-		$html .= '<p><textarea readonly id="episode_embed_code">' . esc_textarea( $embed_code ) . '</textarea></p>';
436
+		$html = '<p><em>'.__ ( 'Customise the size of your episode embed below, then copy the HTML to your clipboard.', 'seriously-simple-podcasting' ).'</em></p>';
437
+		$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" /> &nbsp;&nbsp;&nbsp;&nbsp;<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>';
438
+		$html .= '<p><textarea readonly id="episode_embed_code">'.esc_textarea ( $embed_code ).'</textarea></p>';
439 439
 
440 440
 		echo $html;
441 441
 	}
@@ -444,20 +444,20 @@  discard block
 block discarded – undo
444 444
 	 * Update the epiaode embed code via ajax
445 445
 	 * @return void
446 446
 	 */
447
-	public function update_episode_embed_code () {
447
+	public function update_episode_embed_code() {
448 448
 
449 449
 		// Make sure we have a valid post ID
450
-		if( empty( $_POST['post_id'] ) ) {
450
+		if ( empty( $_POST[ 'post_id' ] ) ) {
451 451
 			return;
452 452
 		}
453 453
 
454 454
 		// Get info for embed code
455
-		$post_id = (int) $_POST['post_id'];
456
-		$width = (int) $_POST['width'];
457
-		$height = (int) $_POST['height'];
455
+		$post_id = (int) $_POST[ 'post_id' ];
456
+		$width = (int) $_POST[ 'width' ];
457
+		$height = (int) $_POST[ 'height' ];
458 458
 
459 459
 		// Generate embed code
460
-		echo get_post_embed_html( $width, $height, $post_id );
460
+		echo get_post_embed_html ( $width, $height, $post_id );
461 461
 
462 462
 		// Exit after ajax request
463 463
 		exit;
@@ -470,91 +470,91 @@  discard block
 block discarded – undo
470 470
 	public function meta_box_content() {
471 471
 		global $post_id;
472 472
 
473
-		$field_data = $this->custom_fields();
473
+		$field_data = $this->custom_fields ();
474 474
 
475 475
 		$html = '';
476 476
 
477
-		$html .= '<input type="hidden" name="seriouslysimple_' . $this->token . '_nonce" id="seriouslysimple_' . $this->token . '_nonce" value="' . wp_create_nonce( plugin_basename( $this->dir ) ) . '" />';
477
+		$html .= '<input type="hidden" name="seriouslysimple_'.$this->token.'_nonce" id="seriouslysimple_'.$this->token.'_nonce" value="'.wp_create_nonce ( plugin_basename ( $this->dir ) ).'" />';
478 478
 
479
-		if ( 0 < count( $field_data ) ) {
479
+		if ( 0 < count ( $field_data ) ) {
480 480
 
481
-			$html .= '<input id="seriouslysimple_post_id" type="hidden" value="'. $post_id . '" />';
481
+			$html .= '<input id="seriouslysimple_post_id" type="hidden" value="'.$post_id.'" />';
482 482
 
483 483
 			foreach ( $field_data as $k => $v ) {
484
-				$data = $v['default'];
485
-				$saved = get_post_meta( $post_id, $k, true );
484
+				$data = $v[ 'default' ];
485
+				$saved = get_post_meta ( $post_id, $k, true );
486 486
 				if ( $saved ) {
487 487
 					$data = $saved;
488 488
 				}
489 489
 
490 490
 				$class = '';
491
-				if ( isset( $v['class'] ) ) {
492
-					$class = $v['class'];
491
+				if ( isset( $v[ 'class' ] ) ) {
492
+					$class = $v[ 'class' ];
493 493
 				}
494 494
 
495 495
 				$disabled = false;
496
-				if ( isset( $v['disabled'] ) && $v['disabled'] ) {
496
+				if ( isset( $v[ 'disabled' ] ) && $v[ 'disabled' ] ) {
497 497
 					$disabled = true;
498 498
 				}
499 499
 
500
-				switch( $v['type'] ) {
500
+				switch ( $v[ 'type' ] ) {
501 501
 					case 'file':
502 502
 						$html .= '<p>
503
-									<label class="ssp-episode-details-label" for="' . esc_attr( $k ) . '">' . wp_kses_post( $v['name'] ) . '</label>
503
+									<label class="ssp-episode-details-label" for="' . esc_attr ( $k ).'">'.wp_kses_post ( $v[ 'name' ] ).'</label>
504 504
 									<br/>
505
-									<input name="' . esc_attr( $k ) . '" type="text" id="upload_' . esc_attr( $k ) . '" value="' . esc_attr( $data ) . '" />
506
-									<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' ) . '" />
505
+									<input name="' . esc_attr ( $k ).'" type="text" id="upload_'.esc_attr ( $k ).'" value="'.esc_attr ( $data ).'" />
506
+									<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' ).'" />
507 507
 									<br/>
508
-									<span class="description">' . wp_kses_post( $v['description'] ) . '</span>
508
+									<span class="description">' . wp_kses_post ( $v[ 'description' ] ).'</span>
509 509
 								</p>' . "\n";
510 510
 					break;
511 511
 
512 512
 					case 'checkbox':
513
-						$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>' . wp_kses_post( $v['description'] ) . '</span></label></p>' . "\n";
513
+						$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>'.wp_kses_post ( $v[ 'description' ] ).'</span></label></p>'."\n";
514 514
 					break;
515 515
 
516 516
 					case 'radio':
517 517
 						$html .= '<p>
518
-									<span class="ssp-episode-details-label">' . wp_kses_post( $v['name'] ) . '</span><br/>';
519
-										foreach( $v['options'] as $option => $label ) {
520
-											$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 ) . '" />
521
-											<label style="margin-right:10px;" for="' . esc_attr( $k ) . '_' . esc_attr( $option ) . '">' . esc_html( $label ) . '</label>' . "\n";
518
+									<span class="ssp-episode-details-label">' . wp_kses_post ( $v[ 'name' ] ).'</span><br/>';
519
+										foreach ( $v[ 'options' ] as $option => $label ) {
520
+											$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 ).'" />
521
+											<label style="margin-right:10px;" for="' . esc_attr ( $k ).'_'.esc_attr ( $option ).'">'.esc_html ( $label ).'</label>'."\n";
522 522
 										}
523
-						$html .= '<span class="description">' . wp_kses_post( $v['description'] ) . '</span>
523
+						$html .= '<span class="description">'.wp_kses_post ( $v[ 'description' ] ).'</span>
524 524
 								</p>' . "\n";
525 525
 					break;
526 526
 
527 527
 					case 'datepicker':
528 528
 						$display_date = '';
529
-						if( $data ) {
530
-							$display_date = date( 'j F, Y', strtotime( $data ) );
529
+						if ( $data ) {
530
+							$display_date = date ( 'j F, Y', strtotime ( $data ) );
531 531
 						}
532 532
 						$html .= '<p class="hasDatepicker">
533
-									<label class="ssp-episode-details-label" for="' . esc_attr( $k ) . '_display">' . wp_kses_post( $v['name'] ) . '</label>
533
+									<label class="ssp-episode-details-label" for="' . esc_attr ( $k ).'_display">'.wp_kses_post ( $v[ 'name' ] ).'</label>
534 534
 									<br/>
535
-									<input type="text" id="' . esc_attr( $k ) . '_display" class="ssp-datepicker ' . esc_attr( $class ) . '" value="' . esc_attr( $display_date ) . '" />
536
-									<input name="' . esc_attr( $k ) . '" id="' . esc_attr( $k ) . '" type="hidden" value="' . esc_attr( $data ) . '" />
535
+									<input type="text" id="' . esc_attr ( $k ).'_display" class="ssp-datepicker '.esc_attr ( $class ).'" value="'.esc_attr ( $display_date ).'" />
536
+									<input name="' . esc_attr ( $k ).'" id="'.esc_attr ( $k ).'" type="hidden" value="'.esc_attr ( $data ).'" />
537 537
 									<br/>
538
-									<span class="description">' . wp_kses_post( $v['description'] ) . '</span>
538
+									<span class="description">' . wp_kses_post ( $v[ 'description' ] ).'</span>
539 539
 								</p>' . "\n";
540 540
 					break;
541 541
 
542 542
 					case 'textarea':
543
-						ob_start();
544
-						echo '<p><label class="ssp-episode-details-label" for="' . esc_attr( $k ) . '">' . wp_kses_post( $v['name'] ) . '</label><br/>';
545
-						wp_editor( $data, $k, array( 'editor_class' => esc_attr( $class ) ) );
546
-						echo '<br/><span class="description">' . wp_kses_post( $v['description'] ) . '</span></p>' . "\n";
547
-						$html .= ob_get_clean();
543
+						ob_start ();
544
+						echo '<p><label class="ssp-episode-details-label" for="'.esc_attr ( $k ).'">'.wp_kses_post ( $v[ 'name' ] ).'</label><br/>';
545
+						wp_editor ( $data, $k, array( 'editor_class' => esc_attr ( $class ) ) );
546
+						echo '<br/><span class="description">'.wp_kses_post ( $v[ 'description' ] ).'</span></p>'."\n";
547
+						$html .= ob_get_clean ();
548 548
 
549 549
 					break;
550 550
 
551 551
 					default:
552 552
 						$html .= '<p>
553
-									<label class="ssp-episode-details-label" for="' . esc_attr( $k ) . '">' . wp_kses_post( $v['name'] ) . '</label>
553
+									<label class="ssp-episode-details-label" for="' . esc_attr ( $k ).'">'.wp_kses_post ( $v[ 'name' ] ).'</label>
554 554
 									<br/>
555
-									<input name="' . esc_attr( $k ) . '" type="text" id="' . esc_attr( $k ) . '" class="' . esc_attr( $class ) . '" value="' . esc_attr( $data ) . '" />
555
+									<input name="' . esc_attr ( $k ).'" type="text" id="'.esc_attr ( $k ).'" class="'.esc_attr ( $class ).'" value="'.esc_attr ( $data ).'" />
556 556
 									<br/>
557
-									<span class="description">' . wp_kses_post( $v['description'] ) . '</span>
557
+									<span class="description">' . wp_kses_post ( $v[ 'description' ] ).'</span>
558 558
 								</p>' . "\n";
559 559
 					break;
560 560
 				}
@@ -573,44 +573,44 @@  discard block
 block discarded – undo
573 573
 	public function meta_box_save( $post_id ) {
574 574
 		global $ss_podcasting;
575 575
 
576
-		$podcast_post_types = ssp_post_types( true );
576
+		$podcast_post_types = ssp_post_types ( true );
577 577
 
578 578
 		// Post type check
579
-		if ( ! in_array( get_post_type(), $podcast_post_types ) ) {
579
+		if ( ! in_array ( get_post_type (), $podcast_post_types ) ) {
580 580
 			return false;
581 581
 		}
582 582
 
583 583
 		// Security check
584
-		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 ) ) ) ) {
584
+		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 ) ) ) ) {
585 585
 			return $post_id;
586 586
 		}
587 587
 
588 588
 		// User capability check
589
-		if ( 'page' == $_POST['post_type'] ) {
590
-			if ( ! current_user_can( 'edit_page', $post_id ) ) {
589
+		if ( 'page' == $_POST[ 'post_type' ] ) {
590
+			if ( ! current_user_can ( 'edit_page', $post_id ) ) {
591 591
 				return $post_id;
592 592
 			}
593 593
 		} else {
594
-			if ( ! current_user_can( 'edit_post', $post_id ) ) {
594
+			if ( ! current_user_can ( 'edit_post', $post_id ) ) {
595 595
 				return $post_id;
596 596
 			}
597 597
 		}
598 598
 
599
-		$field_data = $this->custom_fields();
599
+		$field_data = $this->custom_fields ();
600 600
 		$enclosure = '';
601 601
 
602 602
 		foreach ( $field_data as $k => $field ) {
603 603
 
604
-			if( 'embed_code' == $k ) {
604
+			if ( 'embed_code' == $k ) {
605 605
 				continue;
606 606
 			}
607 607
 
608 608
 			$val = '';
609 609
 			if ( isset( $_POST[ $k ] ) ) {
610
-				if ( isset( $field['callback'] ) ) {
611
-					$val = call_user_func( $field['callback'], $_POST[ $k ] );
610
+				if ( isset( $field[ 'callback' ] ) ) {
611
+					$val = call_user_func ( $field[ 'callback' ], $_POST[ $k ] );
612 612
 				} else {
613
-					$val = strip_tags( trim( $_POST[ $k ] ) );
613
+					$val = strip_tags ( trim ( $_POST[ $k ] ) );
614 614
 				}
615 615
 			}
616 616
 
@@ -618,37 +618,37 @@  discard block
 block discarded – undo
618 618
 				$enclosure = $val;
619 619
 			}
620 620
 
621
-			update_post_meta( $post_id, $k, $val );
621
+			update_post_meta ( $post_id, $k, $val );
622 622
 		}
623 623
 
624 624
 		if ( $enclosure ) {
625 625
 
626 626
 			// Get file duration
627
-			if ( get_post_meta( $post_id, 'duration', true ) == '' ) {
628
-				$duration = $ss_podcasting->get_file_duration( $enclosure );
627
+			if ( get_post_meta ( $post_id, 'duration', true ) == '' ) {
628
+				$duration = $ss_podcasting->get_file_duration ( $enclosure );
629 629
 				if ( $duration ) {
630
-					update_post_meta( $post_id , 'duration' , $duration );
630
+					update_post_meta ( $post_id, 'duration', $duration );
631 631
 				}
632 632
 			}
633 633
 
634 634
 			// Get file size
635
-			if ( get_post_meta( $post_id, 'filesize', true ) == '' ) {
636
-				$filesize = $ss_podcasting->get_file_size( $enclosure );
635
+			if ( get_post_meta ( $post_id, 'filesize', true ) == '' ) {
636
+				$filesize = $ss_podcasting->get_file_size ( $enclosure );
637 637
 				if ( $filesize ) {
638 638
 
639
-					if ( isset( $filesize['formatted'] ) ) {
640
-						update_post_meta( $post_id, 'filesize', $filesize['formatted'] );
639
+					if ( isset( $filesize[ 'formatted' ] ) ) {
640
+						update_post_meta ( $post_id, 'filesize', $filesize[ 'formatted' ] );
641 641
 					}
642 642
 
643
-					if ( isset( $filesize['raw'] ) ) {
644
-						update_post_meta( $post_id, 'filesize_raw', $filesize['raw'] );
643
+					if ( isset( $filesize[ 'raw' ] ) ) {
644
+						update_post_meta ( $post_id, 'filesize_raw', $filesize[ 'raw' ] );
645 645
 					}
646 646
 
647 647
 				}
648 648
 			}
649 649
 
650 650
 			// Save podcast file to 'enclosure' meta field for standards-sake
651
-			update_post_meta( $post_id, 'enclosure', $enclosure );
651
+			update_post_meta ( $post_id, 'enclosure', $enclosure );
652 652
 
653 653
 		}
654 654
 
@@ -662,72 +662,72 @@  discard block
 block discarded – undo
662 662
 		global $pagenow;
663 663
 		$fields = array();
664 664
 
665
-		$fields['episode_type'] = array(
666
-			'name' => __( 'Episode type:' , 'seriously-simple-podcasting' ),
665
+		$fields[ 'episode_type' ] = array(
666
+			'name' => __ ( 'Episode type:', 'seriously-simple-podcasting' ),
667 667
 		    'description' => '',
668 668
 		    'type' => 'radio',
669 669
 		    'default' => 'audio',
670
-		    'options' => array( 'audio' => __( 'Audio', 'seriously-simple-podcasting' ), 'video' => __( 'Video', 'seriously-simple-podcasting' ) ),
670
+		    'options' => array( 'audio' => __ ( 'Audio', 'seriously-simple-podcasting' ), 'video' => __ ( 'Video', 'seriously-simple-podcasting' ) ),
671 671
 		    'section' => 'info',
672
-		    'meta_description' => __( 'The type of podcast episode - either Audio or Video', 'seriously-simple-podcasting' ),
672
+		    'meta_description' => __ ( 'The type of podcast episode - either Audio or Video', 'seriously-simple-podcasting' ),
673 673
 		);
674 674
 
675 675
 		// 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
676
-		$fields['audio_file'] = array(
677
-		    'name' => __( 'Podcast file:' , 'seriously-simple-podcasting' ),
678
-		    'description' => __( 'Upload the primary podcast file or paste the file URL here.' , 'seriously-simple-podcasting' ),
676
+		$fields[ 'audio_file' ] = array(
677
+		    'name' => __ ( 'Podcast file:', 'seriously-simple-podcasting' ),
678
+		    'description' => __ ( 'Upload the primary podcast file or paste the file URL here.', 'seriously-simple-podcasting' ),
679 679
 		    'type' => 'file',
680 680
 		    'default' => '',
681 681
 		    'section' => 'info',
682
-		    'meta_description' => __( 'The full URL for the podcast episode media file.', 'seriously-simple-podcasting' ),
682
+		    'meta_description' => __ ( 'The full URL for the podcast episode media file.', 'seriously-simple-podcasting' ),
683 683
 		);
684 684
 
685
-		$fields['duration'] = array(
686
-		    'name' => __( 'Duration:' , 'seriously-simple-podcasting' ),
687
-		    'description' => __( 'Duration of podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ),
685
+		$fields[ 'duration' ] = array(
686
+		    'name' => __ ( 'Duration:', 'seriously-simple-podcasting' ),
687
+		    'description' => __ ( 'Duration of podcast file for display (calculated automatically if possible).', 'seriously-simple-podcasting' ),
688 688
 		    'type' => 'text',
689 689
 		    'default' => '',
690 690
 		    'section' => 'info',
691
-		    'meta_description' => __( 'The duration of the file for display purposes.', 'seriously-simple-podcasting' ),
691
+		    'meta_description' => __ ( 'The duration of the file for display purposes.', 'seriously-simple-podcasting' ),
692 692
 		);
693 693
 
694
-		$fields['filesize'] = array(
695
-		    'name' => __( 'File size:' , 'seriously-simple-podcasting' ),
696
-		    'description' => __( 'Size of the podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ),
694
+		$fields[ 'filesize' ] = array(
695
+		    'name' => __ ( 'File size:', 'seriously-simple-podcasting' ),
696
+		    'description' => __ ( 'Size of the podcast file for display (calculated automatically if possible).', 'seriously-simple-podcasting' ),
697 697
 		    'type' => 'text',
698 698
 		    'default' => '',
699 699
 		    'section' => 'info',
700
-		    'meta_description' => __( 'The size of the podcast episode for display purposes.', 'seriously-simple-podcasting' ),
700
+		    'meta_description' => __ ( 'The size of the podcast episode for display purposes.', 'seriously-simple-podcasting' ),
701 701
 		);
702 702
 
703
-		$fields['date_recorded'] = array(
704
-		    'name' => __( 'Date recorded:' , 'seriously-simple-podcasting' ),
705
-		    'description' => __( 'The date on which this episode was recorded.' , 'seriously-simple-podcasting' ),
703
+		$fields[ 'date_recorded' ] = array(
704
+		    'name' => __ ( 'Date recorded:', 'seriously-simple-podcasting' ),
705
+		    'description' => __ ( 'The date on which this episode was recorded.', 'seriously-simple-podcasting' ),
706 706
 		    'type' => 'datepicker',
707 707
 		    'default' => '',
708 708
 		    'section' => 'info',
709
-		    'meta_description' => __( 'The date on which the podcast episode was recorded.', 'seriously-simple-podcasting' ),
709
+		    'meta_description' => __ ( 'The date on which the podcast episode was recorded.', 'seriously-simple-podcasting' ),
710 710
 		);
711 711
 
712
-		$fields['explicit'] = array(
713
-		    'name' => __( 'Explicit:' , 'seriously-simple-podcasting' ),
714
-		    'description' => __( 'Mark this episode as explicit.' , 'seriously-simple-podcasting' ),
712
+		$fields[ 'explicit' ] = array(
713
+		    'name' => __ ( 'Explicit:', 'seriously-simple-podcasting' ),
714
+		    'description' => __ ( 'Mark this episode as explicit.', 'seriously-simple-podcasting' ),
715 715
 		    'type' => 'checkbox',
716 716
 		    'default' => '',
717 717
 		    'section' => 'info',
718
-		    'meta_description' => __( 'Indicates whether the episode is explicit or not.', 'seriously-simple-podcasting' ),
718
+		    'meta_description' => __ ( 'Indicates whether the episode is explicit or not.', 'seriously-simple-podcasting' ),
719 719
 		);
720 720
 
721
-		$fields['block'] = array(
722
-		    'name' => __( 'Block:' , 'seriously-simple-podcasting' ),
723
-		    'description' => __( 'Block this episode from appearing in the iTunes & Google Play podcast libraries.' , 'seriously-simple-podcasting' ),
721
+		$fields[ 'block' ] = array(
722
+		    'name' => __ ( 'Block:', 'seriously-simple-podcasting' ),
723
+		    'description' => __ ( 'Block this episode from appearing in the iTunes & Google Play podcast libraries.', 'seriously-simple-podcasting' ),
724 724
 		    'type' => 'checkbox',
725 725
 		    'default' => '',
726 726
 		    'section' => 'info',
727
-		    'meta_description' => __( 'Indicates whether this specific episode should be blocked from the iTunes and Google Play Podcast libraries.', 'seriously-simple-podcasting' ),
727
+		    'meta_description' => __ ( 'Indicates whether this specific episode should be blocked from the iTunes and Google Play Podcast libraries.', 'seriously-simple-podcasting' ),
728 728
 		);
729 729
 
730
-		return apply_filters( 'ssp_episode_fields', $fields );
730
+		return apply_filters ( 'ssp_episode_fields', $fields );
731 731
 	}
732 732
 
733 733
 	/**
@@ -737,17 +737,17 @@  discard block
 block discarded – undo
737 737
 	 */
738 738
 	public function glance_items( $items = array() ) {
739 739
 
740
-		$num_posts = count( ssp_episodes( -1, '', false, 'glance' ) );
740
+		$num_posts = count ( ssp_episodes ( -1, '', false, 'glance' ) );
741 741
 
742
-		$post_type_object = get_post_type_object( $this->token );
742
+		$post_type_object = get_post_type_object ( $this->token );
743 743
 
744
-		$text = _n( '%s Episode', '%s Episodes', $num_posts, 'seriously-simple-podcasting' );
745
-		$text = sprintf( $text, number_format_i18n( $num_posts ) );
744
+		$text = _n ( '%s Episode', '%s Episodes', $num_posts, 'seriously-simple-podcasting' );
745
+		$text = sprintf ( $text, number_format_i18n ( $num_posts ) );
746 746
 
747
-		if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) {
748
-			$items[] = sprintf( '<a class="%1$s-count" href="edit.php?post_type=%1$s">%2$s</a>', $this->token, $text ) . "\n";
747
+		if ( $post_type_object && current_user_can ( $post_type_object->cap->edit_posts ) ) {
748
+			$items[ ] = sprintf ( '<a class="%1$s-count" href="edit.php?post_type=%1$s">%2$s</a>', $this->token, $text )."\n";
749 749
 		} else {
750
-			$items[] = sprintf( '<span class="%1$s-count">%2$s</span>', $this->token, $text ) . "\n";
750
+			$items[ ] = sprintf ( '<span class="%1$s-count">%2$s</span>', $this->token, $text )."\n";
751 751
 		}
752 752
 
753 753
 		return $items;
@@ -761,15 +761,15 @@  discard block
 block discarded – undo
761 761
 	 * @param  string $status      Plugin status
762 762
 	 * @return array               Modified plugin meta links
763 763
 	 */
764
-	public function plugin_row_meta ( $plugin_meta = array(), $plugin_file = '', $plugin_data = array(), $status = '' ) {
764
+	public function plugin_row_meta( $plugin_meta = array(), $plugin_file = '', $plugin_data = array(), $status = '' ) {
765 765
 
766
-		if ( ! isset( $plugin_data['slug'] ) || 'seriously-simple-podcasting' != $plugin_data['slug'] ) {
766
+		if ( ! isset( $plugin_data[ 'slug' ] ) || 'seriously-simple-podcasting' != $plugin_data[ 'slug' ] ) {
767 767
 			return $plugin_meta;
768 768
 		}
769 769
 
770
-		$plugin_meta['docs'] = '<a href="http://www.seriouslysimplepodcasting.com/documentation/" target="_blank">' . __( 'Documentation', 'seriously-simple-podcasting' ) . '</a>';
771
-		$plugin_meta['addons'] = '<a href="http://www.seriouslysimplepodcasting.com/add-ons/" target="_blank">' . __( 'Add-ons', 'seriously-simple-podcasting' ) . '</a>';
772
-		$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>';
770
+		$plugin_meta[ 'docs' ] = '<a href="http://www.seriouslysimplepodcasting.com/documentation/" target="_blank">'.__ ( 'Documentation', 'seriously-simple-podcasting' ).'</a>';
771
+		$plugin_meta[ 'addons' ] = '<a href="http://www.seriouslysimplepodcasting.com/add-ons/" target="_blank">'.__ ( 'Add-ons', 'seriously-simple-podcasting' ).'</a>';
772
+		$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>';
773 773
 
774 774
 		return $plugin_meta;
775 775
 	}
@@ -780,8 +780,8 @@  discard block
 block discarded – undo
780 780
 	 * @return string        Modified text
781 781
 	 */
782 782
 	public function enter_title_here( $title ) {
783
-		if ( get_post_type() == $this->token ) {
784
-			$title = __( 'Enter episode title here', 'seriously-simple-podcasting' );
783
+		if ( get_post_type () == $this->token ) {
784
+			$title = __ ( 'Enter episode title here', 'seriously-simple-podcasting' );
785 785
 		}
786 786
 		return $title;
787 787
 	}
@@ -791,11 +791,11 @@  discard block
 block discarded – undo
791 791
 	 * @return void
792 792
 	 */
793 793
 	public function enqueue_admin_styles() {
794
-		wp_register_style( 'ssp-admin', esc_url( $this->assets_url . 'css/admin.css' ), array(), $this->version );
795
-		wp_enqueue_style( 'ssp-admin' );
794
+		wp_register_style ( 'ssp-admin', esc_url ( $this->assets_url.'css/admin.css' ), array(), $this->version );
795
+		wp_enqueue_style ( 'ssp-admin' );
796 796
 
797 797
 		// Datepicker
798
-		wp_enqueue_style( 'jquery-ui-datepicker', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css' );
798
+		wp_enqueue_style ( 'jquery-ui-datepicker', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css' );
799 799
 	}
800 800
 
801 801
 	/**
@@ -803,8 +803,8 @@  discard block
 block discarded – undo
803 803
 	 * @return void
804 804
 	 */
805 805
 	public function enqueue_admin_scripts() {
806
-		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 );
807
-		wp_enqueue_script( 'ssp-admin' );
806
+		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 );
807
+		wp_enqueue_script ( 'ssp-admin' );
808 808
 	}
809 809
 
810 810
 	/**
@@ -812,8 +812,8 @@  discard block
 block discarded – undo
812 812
 	 * @return void
813 813
 	 */
814 814
 	public function ensure_post_thumbnails_support() {
815
-		if ( ! current_theme_supports( 'post-thumbnails' ) ) {
816
-			add_theme_support( 'post-thumbnails' );
815
+		if ( ! current_theme_supports ( 'post-thumbnails' ) ) {
816
+			add_theme_support ( 'post-thumbnails' );
817 817
 		}
818 818
 	}
819 819
 
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
 	 * @return void
823 823
 	 */
824 824
 	public function load_localisation() {
825
-		load_plugin_textdomain( 'seriously-simple-podcasting', false, dirname( plugin_basename( $this->file ) ) . '/lang/' );
825
+		load_plugin_textdomain ( 'seriously-simple-podcasting', false, dirname ( plugin_basename ( $this->file ) ).'/lang/' );
826 826
 	}
827 827
 
828 828
 	/**
@@ -832,10 +832,10 @@  discard block
 block discarded – undo
832 832
 	public function load_plugin_textdomain() {
833 833
 	    $domain = 'seriously-simple-podcasting';
834 834
 	    // The "plugin_locale" filter is also used in load_plugin_textdomain()
835
-	    $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
835
+	    $locale = apply_filters ( 'plugin_locale', get_locale (), $domain );
836 836
 
837
-	    load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );
838
-	    load_plugin_textdomain( $domain, false, dirname( plugin_basename( $this->file ) ) . '/lang/' );
837
+	    load_textdomain ( $domain, WP_LANG_DIR.'/'.$domain.'/'.$domain.'-'.$locale.'.mo' );
838
+	    load_plugin_textdomain ( $domain, false, dirname ( plugin_basename ( $this->file ) ).'/lang/' );
839 839
 	}
840 840
 
841 841
     /**
@@ -843,8 +843,8 @@  discard block
 block discarded – undo
843 843
      * @return void
844 844
      */
845 845
     public function add_feed() {
846
-    	$feed_slug = apply_filters( 'ssp_feed_slug', $this->token );
847
-		add_feed( $feed_slug, array( $this, 'feed_template' ) );
846
+    	$feed_slug = apply_filters ( 'ssp_feed_slug', $this->token );
847
+		add_feed ( $feed_slug, array( $this, 'feed_template' ) );
848 848
 	}
849 849
 
850 850
 	/**
@@ -852,9 +852,9 @@  discard block
 block discarded – undo
852 852
 	 * @param  boolean $include_footer Default inclusion value
853 853
 	 * @return boolean                 Modified inclusion value
854 854
 	 */
855
-	public function hide_wp_seo_rss_footer ( $include_footer = true ) {
855
+	public function hide_wp_seo_rss_footer( $include_footer = true ) {
856 856
 
857
-		if ( is_feed( 'podcast' ) ) {
857
+		if ( is_feed ( 'podcast' ) ) {
858 858
 			$include_footer = false;
859 859
 		}
860 860
 
@@ -870,24 +870,24 @@  discard block
 block discarded – undo
870 870
 
871 871
     	// Prevent 404 on feed
872 872
     	$wp_query->is_404 = false;
873
-    	status_header( 200 );
873
+    	status_header ( 200 );
874 874
 
875 875
     	$file_name = 'feed-podcast.php';
876 876
 
877
-    	$user_template_file = apply_filters( 'ssp_feed_template_file', trailingslashit( get_stylesheet_directory() ) . $file_name );
877
+    	$user_template_file = apply_filters ( 'ssp_feed_template_file', trailingslashit ( get_stylesheet_directory () ).$file_name );
878 878
 
879 879
 		// Any functions hooked in here must NOT output any data or else feed will break
880
-		do_action( 'ssp_before_feed' );
880
+		do_action ( 'ssp_before_feed' );
881 881
 
882 882
     	// Load user feed template if it exists, otherwise use plugin template
883
-    	if ( file_exists( $user_template_file ) ) {
883
+    	if ( file_exists ( $user_template_file ) ) {
884 884
     		require( $user_template_file );
885 885
     	} else {
886
-    		require( $this->template_path . $file_name );
886
+    		require( $this->template_path.$file_name );
887 887
     	}
888 888
 
889 889
     	// Any functions hooked in here must NOT output any data or else feed will break
890
-    	do_action( 'ssp_after_feed' );
890
+    	do_action ( 'ssp_after_feed' );
891 891
 
892 892
     	exit;
893 893
 	}
@@ -897,8 +897,8 @@  discard block
 block discarded – undo
897 897
 	 * @return void
898 898
 	 */
899 899
 	public function redirect_old_feed() {
900
-		if ( isset( $_GET['feed'] ) && in_array( $_GET['feed'], array( 'podcast', 'itunes' ) ) ) {
901
-			$this->feed_template();
900
+		if ( isset( $_GET[ 'feed' ] ) && in_array ( $_GET[ 'feed' ], array( 'podcast', 'itunes' ) ) ) {
901
+			$this->feed_template ();
902 902
 			exit;
903 903
 		}
904 904
 	}
@@ -910,12 +910,12 @@  discard block
 block discarded – undo
910 910
 	public function activate() {
911 911
 
912 912
 		// Setup all custom URL rules
913
-		$this->register_post_type();
914
-		$this->add_feed();
915
-		$this->setup_permastruct();
913
+		$this->register_post_type ();
914
+		$this->add_feed ();
915
+		$this->setup_permastruct ();
916 916
 
917 917
 		// Flush permalinks
918
-		flush_rewrite_rules( true );
918
+		flush_rewrite_rules ( true );
919 919
 	}
920 920
 
921 921
 	/**
@@ -923,37 +923,37 @@  discard block
 block discarded – undo
923 923
 	 * @return void
924 924
 	 */
925 925
 	public function deactivate() {
926
-		flush_rewrite_rules();
926
+		flush_rewrite_rules ();
927 927
 	}
928 928
 
929 929
 	/**
930 930
 	 * Run functions on plugin update/activation
931 931
 	 * @return void
932 932
 	 */
933
-	public function update () {
933
+	public function update() {
934 934
 
935
-		$previous_version = get_option( 'ssp_version', '1.0' );
935
+		$previous_version = get_option ( 'ssp_version', '1.0' );
936 936
 
937
-		if ( version_compare( $previous_version, '1.13.1', '<' ) ) {
938
-			flush_rewrite_rules();
937
+		if ( version_compare ( $previous_version, '1.13.1', '<' ) ) {
938
+			flush_rewrite_rules ();
939 939
 		}
940 940
 
941
-		update_option( 'ssp_version', $this->version );
941
+		update_option ( 'ssp_version', $this->version );
942 942
 	}
943 943
 
944 944
 	/**
945 945
 	 * Update 'enclosure' meta field to 'audio_file' meta field
946 946
 	 * @return void
947 947
 	 */
948
-	public function update_enclosures () {
948
+	public function update_enclosures() {
949 949
 
950 950
 		// Allow forced re-run of update if necessary
951
-		if ( isset( $_GET['ssp_update_enclosures'] ) ) {
952
-			delete_option( 'ssp_update_enclosures' );
951
+		if ( isset( $_GET[ 'ssp_update_enclosures' ] ) ) {
952
+			delete_option ( 'ssp_update_enclosures' );
953 953
 		}
954 954
 
955 955
 		// Check if update has been run
956
-		$update_run = get_option( 'ssp_update_enclosures', false );
956
+		$update_run = get_option ( 'ssp_update_enclosures', false );
957 957
 
958 958
 		if ( $update_run ) {
959 959
 			return;
@@ -974,9 +974,9 @@  discard block
 block discarded – undo
974 974
 			'fields' => 'ids',
975 975
 		);
976 976
 
977
-		$posts_with_enclosures = get_posts( $args );
977
+		$posts_with_enclosures = get_posts ( $args );
978 978
 
979
-		if ( 0 == count( $posts_with_enclosures ) ) {
979
+		if ( 0 == count ( $posts_with_enclosures ) ) {
980 980
 			return;
981 981
 		}
982 982
 
@@ -984,17 +984,17 @@  discard block
 block discarded – undo
984 984
 		foreach ( (array) $posts_with_enclosures as $post_id ) {
985 985
 
986 986
 			// Get existing enclosure
987
-			$enclosure = get_post_meta( $post_id, 'enclosure', true );
987
+			$enclosure = get_post_meta ( $post_id, 'enclosure', true );
988 988
 
989 989
 			// Add audio_file field
990 990
 			if ( $enclosure ) {
991
-				update_post_meta( $post_id, 'audio_file', $enclosure );
991
+				update_post_meta ( $post_id, 'audio_file', $enclosure );
992 992
 			}
993 993
 
994 994
 		}
995 995
 
996 996
 		// Mark update as having been run
997
-		update_option( 'ssp_update_enclosures', 'run' );
997
+		update_option ( 'ssp_update_enclosures', 'run' );
998 998
 	}
999 999
 
1000 1000
 	/**
@@ -1005,19 +1005,19 @@  discard block
 block discarded – undo
1005 1005
 	public function admin_footer_text( $footer_text ) {
1006 1006
 
1007 1007
 		// Check to make sure we're on a SSP settings page
1008
-		if ( ( isset( $_GET['page'] ) && 'podcast_settings' == esc_attr( $_GET['page'] ) ) && apply_filters( 'ssp_display_admin_footer_text', true ) ) {
1008
+		if ( ( isset( $_GET[ 'page' ] ) && 'podcast_settings' == esc_attr ( $_GET[ 'page' ] ) ) && apply_filters ( 'ssp_display_admin_footer_text', true ) ) {
1009 1009
 
1010 1010
 			// Change the footer text
1011
-			if ( ! get_option( 'ssp_admin_footer_text_rated' ) ) {
1012
-				$footer_text = sprintf( __( 'If you like %1$sSeriously Simple Podcasting%2$s please leave a %3$s&#9733;&#9733;&#9733;&#9733;&#9733;%4$s rating. A huge thank you in advance!', 'seriously-simple-podcasting' ), '<strong>', '</strong>', '<a href="https://wordpress.org/support/plugin/seriously-simple-podcasting/reviews/?rate=5#new-post" target="_blank" class="ssp-rating-link" data-rated="' . __( 'Thanks!', 'seriously-simple-podcasting' ) . '">', '</a>' );
1011
+			if ( ! get_option ( 'ssp_admin_footer_text_rated' ) ) {
1012
+				$footer_text = sprintf ( __ ( 'If you like %1$sSeriously Simple Podcasting%2$s please leave a %3$s&#9733;&#9733;&#9733;&#9733;&#9733;%4$s rating. A huge thank you in advance!', 'seriously-simple-podcasting' ), '<strong>', '</strong>', '<a href="https://wordpress.org/support/plugin/seriously-simple-podcasting/reviews/?rate=5#new-post" target="_blank" class="ssp-rating-link" data-rated="'.__ ( 'Thanks!', 'seriously-simple-podcasting' ).'">', '</a>' );
1013 1013
 				$footer_text .= "<script type='text/javascript'>
1014 1014
 					jQuery('a.ssp-rating-link').click(function() {
1015
-						jQuery.post( '" . admin_url( 'admin-ajax.php' ) . "', { action: 'ssp_rated' } );
1015
+						jQuery.post( '" . admin_url ( 'admin-ajax.php' )."', { action: 'ssp_rated' } );
1016 1016
 						jQuery(this).parent().text( jQuery(this).data( 'rated' ) );
1017 1017
 					});
1018 1018
 				</script>";
1019 1019
 			} else {
1020
-				$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>' );
1020
+				$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>' );
1021 1021
 			}
1022 1022
 
1023 1023
 		}
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 	 * @return void
1031 1031
 	 */
1032 1032
 	public function rated() {
1033
-		update_option( 'ssp_admin_footer_text_rated', 1 );
1033
+		update_option ( 'ssp_admin_footer_text_rated', 1 );
1034 1034
 		die();
1035 1035
 	}
1036 1036
 
@@ -1040,11 +1040,11 @@  discard block
 block discarded – undo
1040 1040
 	 * @param  object $post WordPress Post Object
1041 1041
 	 * @return void
1042 1042
 	 */
1043
-	public function invalidate_cache( $id, $post ){
1043
+	public function invalidate_cache( $id, $post ) {
1044 1044
 
1045
-		if ( in_array( $post->post_type, ssp_post_types( true ) ) ){
1046
-			wp_cache_delete( 'episodes',    'ssp' );
1047
-			wp_cache_delete( 'episode_ids', 'ssp' );
1045
+		if ( in_array ( $post->post_type, ssp_post_types ( true ) ) ) {
1046
+			wp_cache_delete ( 'episodes', 'ssp' );
1047
+			wp_cache_delete ( 'episode_ids', 'ssp' );
1048 1048
 		}
1049 1049
 
1050 1050
 	}
Please login to merge, or discard this patch.