@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly. |
4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined ( 'ABSPATH' ) ) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
@@ -32,84 +32,84 @@ discard block |
||
32 | 32 | |
33 | 33 | $this->version = $version; |
34 | 34 | |
35 | - $this->dir = dirname( $file ); |
|
35 | + $this->dir = dirname ( $file ); |
|
36 | 36 | $this->file = $file; |
37 | - $this->assets_dir = trailingslashit( $this->dir ) . 'assets'; |
|
38 | - $this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $file ) ) ); |
|
39 | - $this->template_path = trailingslashit( $this->dir ) . 'templates/'; |
|
40 | - $this->home_url = trailingslashit( home_url() ); |
|
37 | + $this->assets_dir = trailingslashit ( $this->dir ).'assets'; |
|
38 | + $this->assets_url = esc_url ( trailingslashit ( plugins_url ( '/assets/', $file ) ) ); |
|
39 | + $this->template_path = trailingslashit ( $this->dir ).'templates/'; |
|
40 | + $this->home_url = trailingslashit ( home_url () ); |
|
41 | 41 | $this->token = 'podcast'; |
42 | 42 | |
43 | - $this->script_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
43 | + $this->script_suffix = defined ( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
44 | 44 | |
45 | 45 | // Handle localisation |
46 | - $this->load_plugin_textdomain(); |
|
47 | - add_action( 'init', array( $this, 'load_localisation' ), 0 ); |
|
46 | + $this->load_plugin_textdomain (); |
|
47 | + add_action ( 'init', array( $this, 'load_localisation' ), 0 ); |
|
48 | 48 | |
49 | 49 | // Regsiter podcast post type and taxonomies |
50 | - add_action( 'init', array( $this, 'register_post_type' ), 1 ); |
|
50 | + add_action ( 'init', array( $this, 'register_post_type' ), 1 ); |
|
51 | 51 | |
52 | 52 | // Register podcast feed |
53 | - add_action( 'init', array( $this, 'add_feed' ), 1 ); |
|
53 | + add_action ( 'init', array( $this, 'add_feed' ), 1 ); |
|
54 | 54 | |
55 | 55 | // Hide WP SEO footer text for podcast RSS feed |
56 | - add_filter( 'wpseo_include_rss_footer', array( $this, 'hide_wp_seo_rss_footer' ) ); |
|
56 | + add_filter ( 'wpseo_include_rss_footer', array( $this, 'hide_wp_seo_rss_footer' ) ); |
|
57 | 57 | |
58 | 58 | // Handle v1.x feed URL as well as feed URLs for default permalinks |
59 | - add_action( 'init', array( $this, 'redirect_old_feed' ) ); |
|
59 | + add_action ( 'init', array( $this, 'redirect_old_feed' ) ); |
|
60 | 60 | |
61 | 61 | // Setup custom permalink structures |
62 | - add_action( 'init', array( $this, 'setup_permastruct' ), 10 ); |
|
62 | + add_action ( 'init', array( $this, 'setup_permastruct' ), 10 ); |
|
63 | 63 | |
64 | - if ( is_admin() ) { |
|
64 | + if ( is_admin () ) { |
|
65 | 65 | |
66 | - add_action( 'admin_init', array( $this, 'update_enclosures' ) ); |
|
66 | + add_action ( 'admin_init', array( $this, 'update_enclosures' ) ); |
|
67 | 67 | |
68 | 68 | // Episode meta box |
69 | - add_action( 'admin_init', array( $this, 'register_meta_boxes' ) ); |
|
70 | - add_action( 'save_post', array( $this, 'meta_box_save' ), 10, 1 ); |
|
69 | + add_action ( 'admin_init', array( $this, 'register_meta_boxes' ) ); |
|
70 | + add_action ( 'save_post', array( $this, 'meta_box_save' ), 10, 1 ); |
|
71 | 71 | |
72 | 72 | // Episode edit screen |
73 | - add_filter( 'enter_title_here', array( $this, 'enter_title_here' ) ); |
|
74 | - add_filter( 'post_updated_messages', array( $this, 'updated_messages' ) ); |
|
73 | + add_filter ( 'enter_title_here', array( $this, 'enter_title_here' ) ); |
|
74 | + add_filter ( 'post_updated_messages', array( $this, 'updated_messages' ) ); |
|
75 | 75 | |
76 | 76 | // Admin JS & CSS |
77 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ), 10 ); |
|
78 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 10 ); |
|
77 | + add_action ( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ), 10 ); |
|
78 | + add_action ( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 10 ); |
|
79 | 79 | |
80 | 80 | // Episodes list table |
81 | - add_filter( 'manage_edit-' . $this->token . '_columns', array( $this, 'register_custom_column_headings' ), 10, 1 ); |
|
82 | - add_action( 'manage_posts_custom_column', array( $this, 'register_custom_columns' ), 10, 2 ); |
|
81 | + add_filter ( 'manage_edit-'.$this->token.'_columns', array( $this, 'register_custom_column_headings' ), 10, 1 ); |
|
82 | + add_action ( 'manage_posts_custom_column', array( $this, 'register_custom_columns' ), 10, 2 ); |
|
83 | 83 | |
84 | 84 | // Series list table |
85 | - add_filter( 'manage_edit-series_columns' , array( $this, 'edit_series_columns' ) ); |
|
86 | - add_filter( 'manage_series_custom_column' , array( $this, 'add_series_columns' ), 1, 3 ); |
|
85 | + add_filter ( 'manage_edit-series_columns', array( $this, 'edit_series_columns' ) ); |
|
86 | + add_filter ( 'manage_series_custom_column', array( $this, 'add_series_columns' ), 1, 3 ); |
|
87 | 87 | |
88 | 88 | // Dashboard widgets |
89 | - add_filter( 'dashboard_glance_items', array( $this, 'glance_items' ), 10, 1 ); |
|
89 | + add_filter ( 'dashboard_glance_items', array( $this, 'glance_items' ), 10, 1 ); |
|
90 | 90 | |
91 | 91 | // Appreciation links |
92 | - add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 ); |
|
92 | + add_filter ( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 ); |
|
93 | 93 | |
94 | 94 | // Add footer text to dashboard |
95 | - add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 ); |
|
95 | + add_filter ( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 ); |
|
96 | 96 | |
97 | 97 | // Clear the cache on post save. |
98 | - add_action( 'save_post', array( $this, 'invalidate_cache' ), 10, 2 ); |
|
98 | + add_action ( 'save_post', array( $this, 'invalidate_cache' ), 10, 2 ); |
|
99 | 99 | |
100 | 100 | } |
101 | 101 | |
102 | 102 | // Add ajax action for plugin rating |
103 | - add_action( 'wp_ajax_ssp_rated', array( $this, 'rated' ) ); |
|
103 | + add_action ( 'wp_ajax_ssp_rated', array( $this, 'rated' ) ); |
|
104 | 104 | |
105 | 105 | // Add ajax action for customising episode embed code |
106 | - add_action( 'wp_ajax_update_episode_embed_code', array( $this, 'update_episode_embed_code' ) ); |
|
106 | + add_action ( 'wp_ajax_update_episode_embed_code', array( $this, 'update_episode_embed_code' ) ); |
|
107 | 107 | |
108 | 108 | // Setup activation and deactivation hooks |
109 | - register_activation_hook( $file, array( $this, 'activate' ) ); |
|
110 | - register_deactivation_hook( $file, array( $this, 'deactivate' ) ); |
|
109 | + register_activation_hook ( $file, array( $this, 'activate' ) ); |
|
110 | + register_deactivation_hook ( $file, array( $this, 'deactivate' ) ); |
|
111 | 111 | |
112 | - add_action( 'init', array( $this, 'update' ), 11 ); |
|
112 | + add_action ( 'init', array( $this, 'update' ), 11 ); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -119,17 +119,17 @@ discard block |
||
119 | 119 | public function setup_permastruct() { |
120 | 120 | |
121 | 121 | // Episode download & player URLs |
122 | - add_rewrite_rule( '^podcast-download/([^/]*)/([^/]*)/?', 'index.php?podcast_episode=$matches[1]', 'top' ); |
|
123 | - add_rewrite_rule( '^podcast-player/([^/]*)/([^/]*)/?', 'index.php?podcast_episode=$matches[1]&podcast_ref=player', 'top' ); |
|
122 | + add_rewrite_rule ( '^podcast-download/([^/]*)/([^/]*)/?', 'index.php?podcast_episode=$matches[1]', 'top' ); |
|
123 | + add_rewrite_rule ( '^podcast-player/([^/]*)/([^/]*)/?', 'index.php?podcast_episode=$matches[1]&podcast_ref=player', 'top' ); |
|
124 | 124 | |
125 | 125 | // Custom query variables |
126 | - add_rewrite_tag( '%podcast_episode%', '([^&]+)' ); |
|
127 | - add_rewrite_tag( '%podcast_ref%', '([^&]+)' ); |
|
126 | + add_rewrite_tag ( '%podcast_episode%', '([^&]+)' ); |
|
127 | + add_rewrite_tag ( '%podcast_ref%', '([^&]+)' ); |
|
128 | 128 | |
129 | 129 | // Series feed URLs |
130 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
131 | - add_rewrite_rule( '^feed/' . $feed_slug . '/([^/]*)/?', 'index.php?feed=podcast&podcast_series=$matches[1]', 'top' ); |
|
132 | - add_rewrite_tag( '%podcast_series%', '([^&]+)' ); |
|
130 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
131 | + add_rewrite_rule ( '^feed/'.$feed_slug.'/([^/]*)/?', 'index.php?feed=podcast&podcast_series=$matches[1]', 'top' ); |
|
132 | + add_rewrite_tag ( '%podcast_series%', '([^&]+)' ); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -139,25 +139,25 @@ discard block |
||
139 | 139 | public function register_post_type() { |
140 | 140 | |
141 | 141 | $labels = array( |
142 | - 'name' => _x( 'Podcast', 'post type general name' , 'seriously-simple-podcasting' ), |
|
143 | - 'singular_name' => _x( 'Podcast', 'post type singular name' , 'seriously-simple-podcasting' ), |
|
144 | - 'add_new' => _x( 'Add New', 'podcast' , 'seriously-simple-podcasting' ), |
|
145 | - 'add_new_item' => sprintf( __( 'Add New %s' , 'seriously-simple-podcasting' ), __( 'Episode' , 'seriously-simple-podcasting' ) ), |
|
146 | - 'edit_item' => sprintf( __( 'Edit %s' , 'seriously-simple-podcasting' ), __( 'Episode' , 'seriously-simple-podcasting' ) ), |
|
147 | - 'new_item' => sprintf( __( 'New %s' , 'seriously-simple-podcasting' ), __( 'Episode' , 'seriously-simple-podcasting' ) ), |
|
148 | - 'all_items' => sprintf( __( 'All %s' , 'seriously-simple-podcasting' ), __( 'Episodes' , 'seriously-simple-podcasting' ) ), |
|
149 | - 'view_item' => sprintf( __( 'View %s' , 'seriously-simple-podcasting' ), __( 'Episode' , 'seriously-simple-podcasting' ) ), |
|
150 | - 'search_items' => sprintf( __( 'Search %a' , 'seriously-simple-podcasting' ), __( 'Episodes' , 'seriously-simple-podcasting' ) ), |
|
151 | - 'not_found' => sprintf( __( 'No %s Found' , 'seriously-simple-podcasting' ), __( 'Episodes' , 'seriously-simple-podcasting' ) ), |
|
152 | - 'not_found_in_trash' => sprintf( __( 'No %s Found In Trash' , 'seriously-simple-podcasting' ), __( 'Episodes' , 'seriously-simple-podcasting' ) ), |
|
142 | + 'name' => _x ( 'Podcast', 'post type general name', 'seriously-simple-podcasting' ), |
|
143 | + 'singular_name' => _x ( 'Podcast', 'post type singular name', 'seriously-simple-podcasting' ), |
|
144 | + 'add_new' => _x ( 'Add New', 'podcast', 'seriously-simple-podcasting' ), |
|
145 | + 'add_new_item' => sprintf ( __ ( 'Add New %s', 'seriously-simple-podcasting' ), __ ( 'Episode', 'seriously-simple-podcasting' ) ), |
|
146 | + 'edit_item' => sprintf ( __ ( 'Edit %s', 'seriously-simple-podcasting' ), __ ( 'Episode', 'seriously-simple-podcasting' ) ), |
|
147 | + 'new_item' => sprintf ( __ ( 'New %s', 'seriously-simple-podcasting' ), __ ( 'Episode', 'seriously-simple-podcasting' ) ), |
|
148 | + 'all_items' => sprintf ( __ ( 'All %s', 'seriously-simple-podcasting' ), __ ( 'Episodes', 'seriously-simple-podcasting' ) ), |
|
149 | + 'view_item' => sprintf ( __ ( 'View %s', 'seriously-simple-podcasting' ), __ ( 'Episode', 'seriously-simple-podcasting' ) ), |
|
150 | + 'search_items' => sprintf ( __ ( 'Search %a', 'seriously-simple-podcasting' ), __ ( 'Episodes', 'seriously-simple-podcasting' ) ), |
|
151 | + 'not_found' => sprintf ( __ ( 'No %s Found', 'seriously-simple-podcasting' ), __ ( 'Episodes', 'seriously-simple-podcasting' ) ), |
|
152 | + 'not_found_in_trash' => sprintf ( __ ( 'No %s Found In Trash', 'seriously-simple-podcasting' ), __ ( 'Episodes', 'seriously-simple-podcasting' ) ), |
|
153 | 153 | 'parent_item_colon' => '', |
154 | - 'menu_name' => __( 'Podcast' , 'seriously-simple-podcasting' ), |
|
155 | - 'filter_items_list' => sprintf( __( 'Filter %s list' , 'seriously-simple-podcasting' ), __( 'Episode' , 'seriously-simple-podcasting' ) ), |
|
156 | - 'items_list_navigation' => sprintf( __( '%s list navigation' , 'seriously-simple-podcasting' ), __( 'Episode' , 'seriously-simple-podcasting' ) ), |
|
157 | - 'items_list' => sprintf( __( '%s list' , 'seriously-simple-podcasting' ), __( 'Episode' , 'seriously-simple-podcasting' ) ), |
|
154 | + 'menu_name' => __ ( 'Podcast', 'seriously-simple-podcasting' ), |
|
155 | + 'filter_items_list' => sprintf ( __ ( 'Filter %s list', 'seriously-simple-podcasting' ), __ ( 'Episode', 'seriously-simple-podcasting' ) ), |
|
156 | + 'items_list_navigation' => sprintf ( __ ( '%s list navigation', 'seriously-simple-podcasting' ), __ ( 'Episode', 'seriously-simple-podcasting' ) ), |
|
157 | + 'items_list' => sprintf ( __ ( '%s list', 'seriously-simple-podcasting' ), __ ( 'Episode', 'seriously-simple-podcasting' ) ), |
|
158 | 158 | ); |
159 | 159 | |
160 | - $slug = apply_filters( 'ssp_archive_slug', __( 'podcast' , 'seriously-simple-podcasting' ) ); |
|
160 | + $slug = apply_filters ( 'ssp_archive_slug', __ ( 'podcast', 'seriously-simple-podcasting' ) ); |
|
161 | 161 | |
162 | 162 | $args = array( |
163 | 163 | 'labels' => $labels, |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | 'show_in_rest' => true, |
180 | 180 | ); |
181 | 181 | |
182 | - $args = apply_filters( 'ssp_register_post_type_args', $args ); |
|
182 | + $args = apply_filters ( 'ssp_register_post_type_args', $args ); |
|
183 | 183 | |
184 | - register_post_type( $this->token, $args ); |
|
184 | + register_post_type ( $this->token, $args ); |
|
185 | 185 | |
186 | - $this->register_taxonomies(); |
|
186 | + $this->register_taxonomies (); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -192,45 +192,45 @@ discard block |
||
192 | 192 | */ |
193 | 193 | private function register_taxonomies() { |
194 | 194 | |
195 | - $podcast_post_types = ssp_post_types( true ); |
|
195 | + $podcast_post_types = ssp_post_types ( true ); |
|
196 | 196 | |
197 | 197 | $series_labels = array( |
198 | - 'name' => __( 'Podcast Series' , 'seriously-simple-podcasting' ), |
|
199 | - 'singular_name' => __( 'Series', 'seriously-simple-podcasting' ), |
|
200 | - 'search_items' => __( 'Search Series' , 'seriously-simple-podcasting' ), |
|
201 | - 'all_items' => __( 'All Series' , 'seriously-simple-podcasting' ), |
|
202 | - 'parent_item' => __( 'Parent Series' , 'seriously-simple-podcasting' ), |
|
203 | - 'parent_item_colon' => __( 'Parent Series:' , 'seriously-simple-podcasting' ), |
|
204 | - 'edit_item' => __( 'Edit Series' , 'seriously-simple-podcasting' ), |
|
205 | - 'update_item' => __( 'Update Series' , 'seriously-simple-podcasting' ), |
|
206 | - 'add_new_item' => __( 'Add New Series' , 'seriously-simple-podcasting' ), |
|
207 | - 'new_item_name' => __( 'New Series Name' , 'seriously-simple-podcasting' ), |
|
208 | - 'menu_name' => __( 'Series' , 'seriously-simple-podcasting' ), |
|
209 | - 'view_item' => __( 'View Series' , 'seriously-simple-podcasting' ), |
|
210 | - 'popular_items' => __( 'Popular Series' , 'seriously-simple-podcasting' ), |
|
211 | - 'separate_items_with_commas' => __( 'Separate series with commas' , 'seriously-simple-podcasting' ), |
|
212 | - 'add_or_remove_items' => __( 'Add or remove Series' , 'seriously-simple-podcasting' ), |
|
213 | - 'choose_from_most_used' => __( 'Choose from the most used Series' , 'seriously-simple-podcasting' ), |
|
214 | - 'not_found' => __( 'No Series Found' , 'seriously-simple-podcasting' ), |
|
215 | - 'items_list_navigation' => __( 'Series list navigation' , 'seriously-simple-podcasting' ), |
|
216 | - 'items_list' => __( 'Series list' , 'seriously-simple-podcasting' ), |
|
198 | + 'name' => __ ( 'Podcast Series', 'seriously-simple-podcasting' ), |
|
199 | + 'singular_name' => __ ( 'Series', 'seriously-simple-podcasting' ), |
|
200 | + 'search_items' => __ ( 'Search Series', 'seriously-simple-podcasting' ), |
|
201 | + 'all_items' => __ ( 'All Series', 'seriously-simple-podcasting' ), |
|
202 | + 'parent_item' => __ ( 'Parent Series', 'seriously-simple-podcasting' ), |
|
203 | + 'parent_item_colon' => __ ( 'Parent Series:', 'seriously-simple-podcasting' ), |
|
204 | + 'edit_item' => __ ( 'Edit Series', 'seriously-simple-podcasting' ), |
|
205 | + 'update_item' => __ ( 'Update Series', 'seriously-simple-podcasting' ), |
|
206 | + 'add_new_item' => __ ( 'Add New Series', 'seriously-simple-podcasting' ), |
|
207 | + 'new_item_name' => __ ( 'New Series Name', 'seriously-simple-podcasting' ), |
|
208 | + 'menu_name' => __ ( 'Series', 'seriously-simple-podcasting' ), |
|
209 | + 'view_item' => __ ( 'View Series', 'seriously-simple-podcasting' ), |
|
210 | + 'popular_items' => __ ( 'Popular Series', 'seriously-simple-podcasting' ), |
|
211 | + 'separate_items_with_commas' => __ ( 'Separate series with commas', 'seriously-simple-podcasting' ), |
|
212 | + 'add_or_remove_items' => __ ( 'Add or remove Series', 'seriously-simple-podcasting' ), |
|
213 | + 'choose_from_most_used' => __ ( 'Choose from the most used Series', 'seriously-simple-podcasting' ), |
|
214 | + 'not_found' => __ ( 'No Series Found', 'seriously-simple-podcasting' ), |
|
215 | + 'items_list_navigation' => __ ( 'Series list navigation', 'seriously-simple-podcasting' ), |
|
216 | + 'items_list' => __ ( 'Series list', 'seriously-simple-podcasting' ), |
|
217 | 217 | ); |
218 | 218 | |
219 | 219 | $series_args = array( |
220 | 220 | 'public' => true, |
221 | 221 | 'hierarchical' => true, |
222 | - 'rewrite' => array( 'slug' => apply_filters( 'ssp_series_slug', 'series' ) ), |
|
222 | + 'rewrite' => array( 'slug' => apply_filters ( 'ssp_series_slug', 'series' ) ), |
|
223 | 223 | 'labels' => $series_labels, |
224 | 224 | 'show_in_rest' => true, |
225 | 225 | ); |
226 | 226 | |
227 | - $series_args = apply_filters( 'ssp_register_taxonomy_args', $series_args, 'series' ); |
|
227 | + $series_args = apply_filters ( 'ssp_register_taxonomy_args', $series_args, 'series' ); |
|
228 | 228 | |
229 | - register_taxonomy( 'series', $podcast_post_types, $series_args ); |
|
229 | + register_taxonomy ( 'series', $podcast_post_types, $series_args ); |
|
230 | 230 | |
231 | 231 | // Add Tags to podcast post type |
232 | - if ( apply_filters( 'ssp_use_post_tags', true ) ) { |
|
233 | - register_taxonomy_for_object_type( 'post_tag', $this->token ); |
|
232 | + if ( apply_filters ( 'ssp_use_post_tags', true ) ) { |
|
233 | + register_taxonomy_for_object_type ( 'post_tag', $this->token ); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
@@ -240,13 +240,13 @@ discard block |
||
240 | 240 | * @return array Modified columns |
241 | 241 | */ |
242 | 242 | public function register_custom_column_headings( $defaults ) { |
243 | - $new_columns = apply_filters( 'ssp_admin_columns_episodes', array( 'series' => __( 'Series' , 'seriously-simple-podcasting' ) , 'image' => __( 'Image' , 'seriously-simple-podcasting' ) ) ); |
|
243 | + $new_columns = apply_filters ( 'ssp_admin_columns_episodes', array( 'series' => __ ( 'Series', 'seriously-simple-podcasting' ), 'image' => __ ( 'Image', 'seriously-simple-podcasting' ) ) ); |
|
244 | 244 | |
245 | 245 | // remove date column |
246 | - unset( $defaults['date'] ); |
|
246 | + unset( $defaults[ 'date' ] ); |
|
247 | 247 | |
248 | 248 | // add new columns before last default one |
249 | - $columns = array_slice( $defaults, 0, -1 ) + $new_columns + array_slice( $defaults, -1 ); |
|
249 | + $columns = array_slice ( $defaults, 0, -1 ) + $new_columns + array_slice ( $defaults, -1 ); |
|
250 | 250 | |
251 | 251 | return $columns; |
252 | 252 | } |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | switch ( $column_name ) { |
264 | 264 | |
265 | 265 | case 'series': |
266 | - $terms = wp_get_post_terms( $id , 'series' ); |
|
267 | - $term_names = wp_list_pluck( $terms, 'name' ); |
|
268 | - echo join( ', ', $term_names ); |
|
266 | + $terms = wp_get_post_terms ( $id, 'series' ); |
|
267 | + $term_names = wp_list_pluck ( $terms, 'name' ); |
|
268 | + echo join ( ', ', $term_names ); |
|
269 | 269 | break; |
270 | 270 | |
271 | 271 | case 'image': |
272 | - $value = $ss_podcasting->get_image( $id, 40 ); |
|
272 | + $value = $ss_podcasting->get_image ( $id, 40 ); |
|
273 | 273 | echo $value; |
274 | 274 | break; |
275 | 275 | |
@@ -286,13 +286,13 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function edit_series_columns( $columns ) { |
288 | 288 | |
289 | - unset( $columns['description'] ); |
|
290 | - unset( $columns['posts'] ); |
|
289 | + unset( $columns[ 'description' ] ); |
|
290 | + unset( $columns[ 'posts' ] ); |
|
291 | 291 | |
292 | - $columns['series_feed_url'] = __( 'Series feed URL' , 'seriously-simple-podcasting' ); |
|
293 | - $columns['posts'] = __( 'Episodes' , 'seriously-simple-podcasting' ); |
|
292 | + $columns[ 'series_feed_url' ] = __ ( 'Series feed URL', 'seriously-simple-podcasting' ); |
|
293 | + $columns[ 'posts' ] = __ ( 'Episodes', 'seriously-simple-podcasting' ); |
|
294 | 294 | |
295 | - $columns = apply_filters( 'ssp_admin_columns_series', $columns ); |
|
295 | + $columns = apply_filters ( 'ssp_admin_columns_series', $columns ); |
|
296 | 296 | |
297 | 297 | return $columns; |
298 | 298 | } |
@@ -306,18 +306,18 @@ discard block |
||
306 | 306 | * |
307 | 307 | * @return string |
308 | 308 | */ |
309 | - public function add_series_columns( $column_data , $column_name , $term_id ) { |
|
309 | + public function add_series_columns( $column_data, $column_name, $term_id ) { |
|
310 | 310 | |
311 | 311 | switch ( $column_name ) { |
312 | 312 | case 'series_feed_url': |
313 | - $series = get_term( $term_id, 'series' ); |
|
313 | + $series = get_term ( $term_id, 'series' ); |
|
314 | 314 | $series_slug = $series->slug; |
315 | 315 | |
316 | - if ( get_option( 'permalink_structure' ) ) { |
|
317 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
318 | - $feed_url = $this->home_url . 'feed/' . $feed_slug . '/' . $series_slug; |
|
316 | + if ( get_option ( 'permalink_structure' ) ) { |
|
317 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
318 | + $feed_url = $this->home_url.'feed/'.$feed_slug.'/'.$series_slug; |
|
319 | 319 | } else { |
320 | - $feed_url = add_query_arg( |
|
320 | + $feed_url = add_query_arg ( |
|
321 | 321 | array( |
322 | 322 | 'feed' => $this->token, |
323 | 323 | 'podcast_series' => $series_slug |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | ); |
327 | 327 | } |
328 | 328 | |
329 | - $column_data = '<a href="' . esc_attr( $feed_url ) . '" target="_blank">' . esc_html( $feed_url ) . '</a>'; |
|
329 | + $column_data = '<a href="'.esc_attr ( $feed_url ).'" target="_blank">'.esc_html ( $feed_url ).'</a>'; |
|
330 | 330 | break; |
331 | 331 | } |
332 | 332 | |
@@ -343,16 +343,16 @@ discard block |
||
343 | 343 | |
344 | 344 | $messages[ $this->token ] = array( |
345 | 345 | 0 => '', |
346 | - 1 => sprintf( __( 'Episode updated. %sView episode%s.' , 'seriously-simple-podcasting' ), '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), |
|
347 | - 2 => __( 'Custom field updated.' , 'seriously-simple-podcasting' ), |
|
348 | - 3 => __( 'Custom field deleted.' , 'seriously-simple-podcasting' ), |
|
349 | - 4 => __( 'Episode updated.' , 'seriously-simple-podcasting' ), |
|
350 | - 5 => isset($_GET['revision']) ? sprintf( __( 'Episode restored to revision from %s.' , 'seriously-simple-podcasting' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
351 | - 6 => sprintf( __( 'Episode published. %sView episode%s.' , 'seriously-simple-podcasting' ), '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), |
|
352 | - 7 => __( 'Episode saved.' , 'seriously-simple-podcasting' ), |
|
353 | - 8 => sprintf( __( 'Episode submitted. %sPreview episode%s.' , 'seriously-simple-podcasting' ), '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) . '">', '</a>' ), |
|
354 | - 9 => sprintf( __( 'Episode scheduled for: %1$s. %2$sPreview episode%3$s.' , 'seriously-simple-podcasting' ), '<strong>' . date_i18n( __( 'M j, Y @ G:i' , 'seriously-simple-podcasting' ), strtotime( $post->post_date ) ) . '</strong>', '<a target="_blank" href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ), |
|
355 | - 10 => sprintf( __( 'Episode draft updated. %sPreview episode%s.' , 'seriously-simple-podcasting' ), '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) . '">', '</a>' ), |
|
346 | + 1 => sprintf ( __ ( 'Episode updated. %sView episode%s.', 'seriously-simple-podcasting' ), '<a href="'.esc_url ( get_permalink ( $post_ID ) ).'">', '</a>' ), |
|
347 | + 2 => __ ( 'Custom field updated.', 'seriously-simple-podcasting' ), |
|
348 | + 3 => __ ( 'Custom field deleted.', 'seriously-simple-podcasting' ), |
|
349 | + 4 => __ ( 'Episode updated.', 'seriously-simple-podcasting' ), |
|
350 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf ( __ ( 'Episode restored to revision from %s.', 'seriously-simple-podcasting' ), wp_post_revision_title ( (int) $_GET[ 'revision' ], false ) ) : false, |
|
351 | + 6 => sprintf ( __ ( 'Episode published. %sView episode%s.', 'seriously-simple-podcasting' ), '<a href="'.esc_url ( get_permalink ( $post_ID ) ).'">', '</a>' ), |
|
352 | + 7 => __ ( 'Episode saved.', 'seriously-simple-podcasting' ), |
|
353 | + 8 => sprintf ( __ ( 'Episode submitted. %sPreview episode%s.', 'seriously-simple-podcasting' ), '<a target="_blank" href="'.esc_url ( add_query_arg ( 'preview', 'true', get_permalink ( $post_ID ) ) ).'">', '</a>' ), |
|
354 | + 9 => sprintf ( __ ( 'Episode scheduled for: %1$s. %2$sPreview episode%3$s.', 'seriously-simple-podcasting' ), '<strong>'.date_i18n ( __ ( 'M j, Y @ G:i', 'seriously-simple-podcasting' ), strtotime ( $post->post_date ) ).'</strong>', '<a target="_blank" href="'.esc_url ( get_permalink ( $post_ID ) ).'">', '</a>' ), |
|
355 | + 10 => sprintf ( __ ( 'Episode draft updated. %sPreview episode%s.', 'seriously-simple-podcasting' ), '<a target="_blank" href="'.esc_url ( add_query_arg ( 'preview', 'true', get_permalink ( $post_ID ) ) ).'">', '</a>' ), |
|
356 | 356 | ); |
357 | 357 | |
358 | 358 | return $messages; |
@@ -362,14 +362,14 @@ discard block |
||
362 | 362 | * Register podcast episode details meta boxes |
363 | 363 | * @return void |
364 | 364 | */ |
365 | - public function register_meta_boxes () { |
|
365 | + public function register_meta_boxes() { |
|
366 | 366 | |
367 | 367 | // Get all podcast post types |
368 | - $podcast_post_types = ssp_post_types( true ); |
|
368 | + $podcast_post_types = ssp_post_types ( true ); |
|
369 | 369 | |
370 | 370 | // Add meta box to each post type |
371 | 371 | foreach ( (array) $podcast_post_types as $post_type ) { |
372 | - add_action( 'add_meta_boxes_' . $post_type, array( $this, 'meta_box_setup' ), 10, 1 ); |
|
372 | + add_action ( 'add_meta_boxes_'.$post_type, array( $this, 'meta_box_setup' ), 10, 1 ); |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | |
@@ -377,17 +377,17 @@ discard block |
||
377 | 377 | * Create meta box on episode edit screen |
378 | 378 | * @return void |
379 | 379 | */ |
380 | - public function meta_box_setup ( $post ) { |
|
380 | + public function meta_box_setup( $post ) { |
|
381 | 381 | global $pagenow; |
382 | 382 | |
383 | - add_meta_box( 'podcast-episode-data', __( 'Podcast Episode Details' , 'seriously-simple-podcasting' ), array( $this, 'meta_box_content' ), $post->post_type, 'normal', 'high' ); |
|
383 | + add_meta_box ( 'podcast-episode-data', __ ( 'Podcast Episode Details', 'seriously-simple-podcasting' ), array( $this, 'meta_box_content' ), $post->post_type, 'normal', 'high' ); |
|
384 | 384 | |
385 | - if( 'post.php' == $pagenow && 'publish' == $post->post_status && function_exists( 'get_post_embed_html' ) ) { |
|
386 | - add_meta_box( 'episode-embed-code', __( 'Episode Embed Code' , 'seriously-simple-podcasting' ), array( $this, 'embed_code_meta_box_content' ), $post->post_type, 'side', 'low' ); |
|
385 | + if ( 'post.php' == $pagenow && 'publish' == $post->post_status && function_exists ( 'get_post_embed_html' ) ) { |
|
386 | + add_meta_box ( 'episode-embed-code', __ ( 'Episode Embed Code', 'seriously-simple-podcasting' ), array( $this, 'embed_code_meta_box_content' ), $post->post_type, 'side', 'low' ); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | // Allow more metaboxes to be added |
390 | - do_action( 'ssp_meta_boxes', $post ); |
|
390 | + do_action ( 'ssp_meta_boxes', $post ); |
|
391 | 391 | |
392 | 392 | } |
393 | 393 | |
@@ -396,15 +396,15 @@ discard block |
||
396 | 396 | * @param object $post Current post object |
397 | 397 | * @return void |
398 | 398 | */ |
399 | - public function embed_code_meta_box_content ( $post ) { |
|
399 | + public function embed_code_meta_box_content( $post ) { |
|
400 | 400 | |
401 | 401 | // Get post embed code |
402 | - $embed_code = get_post_embed_html( 500, 350, $post ); |
|
402 | + $embed_code = get_post_embed_html ( 500, 350, $post ); |
|
403 | 403 | |
404 | 404 | // Generate markup for meta box |
405 | - $html = '<p><em>' . __( 'Customise the size of your episode embed below, then copy the HTML to your clipboard.', 'seriously-simple-podcasting' ) . '</em></p>'; |
|
406 | - $html .= '<p><label for="episode_embed_code_width">' . __( 'Width:', 'seriously-simple-podcasting' ) . '</label> <input id="episode_embed_code_width" class="episode_embed_code_size_option" type="number" value="500" length="3" min="0" step="1" /> <label for="episode_embed_code_height">' . __( 'Height:', 'seriously-simple-podcasting' ) . '</label> <input id="episode_embed_code_height" class="episode_embed_code_size_option" type="number" value="350" length="3" min="0" step="1" /></p>'; |
|
407 | - $html .= '<p><textarea readonly id="episode_embed_code">' . esc_textarea( $embed_code ) . '</textarea></p>'; |
|
405 | + $html = '<p><em>'.__ ( 'Customise the size of your episode embed below, then copy the HTML to your clipboard.', 'seriously-simple-podcasting' ).'</em></p>'; |
|
406 | + $html .= '<p><label for="episode_embed_code_width">'.__ ( 'Width:', 'seriously-simple-podcasting' ).'</label> <input id="episode_embed_code_width" class="episode_embed_code_size_option" type="number" value="500" length="3" min="0" step="1" /> <label for="episode_embed_code_height">'.__ ( 'Height:', 'seriously-simple-podcasting' ).'</label> <input id="episode_embed_code_height" class="episode_embed_code_size_option" type="number" value="350" length="3" min="0" step="1" /></p>'; |
|
407 | + $html .= '<p><textarea readonly id="episode_embed_code">'.esc_textarea ( $embed_code ).'</textarea></p>'; |
|
408 | 408 | |
409 | 409 | echo $html; |
410 | 410 | } |
@@ -413,20 +413,20 @@ discard block |
||
413 | 413 | * Update the epiaode embed code via ajax |
414 | 414 | * @return void |
415 | 415 | */ |
416 | - public function update_episode_embed_code () { |
|
416 | + public function update_episode_embed_code() { |
|
417 | 417 | |
418 | 418 | // Make sure we have a valid post ID |
419 | - if( empty( $_POST['post_id'] ) ) { |
|
419 | + if ( empty( $_POST[ 'post_id' ] ) ) { |
|
420 | 420 | return; |
421 | 421 | } |
422 | 422 | |
423 | 423 | // Get info for embed code |
424 | - $post_id = (int) $_POST['post_id']; |
|
425 | - $width = (int) $_POST['width']; |
|
426 | - $height = (int) $_POST['height']; |
|
424 | + $post_id = (int) $_POST[ 'post_id' ]; |
|
425 | + $width = (int) $_POST[ 'width' ]; |
|
426 | + $height = (int) $_POST[ 'height' ]; |
|
427 | 427 | |
428 | 428 | // Generate embed code |
429 | - echo get_post_embed_html( $width, $height, $post_id ); |
|
429 | + echo get_post_embed_html ( $width, $height, $post_id ); |
|
430 | 430 | |
431 | 431 | // Exit after ajax request |
432 | 432 | exit; |
@@ -439,82 +439,82 @@ discard block |
||
439 | 439 | public function meta_box_content() { |
440 | 440 | global $post_id; |
441 | 441 | |
442 | - $field_data = $this->custom_fields(); |
|
442 | + $field_data = $this->custom_fields (); |
|
443 | 443 | |
444 | 444 | $html = ''; |
445 | 445 | |
446 | - $html .= '<input type="hidden" name="seriouslysimple_' . $this->token . '_nonce" id="seriouslysimple_' . $this->token . '_nonce" value="' . wp_create_nonce( plugin_basename( $this->dir ) ) . '" />'; |
|
446 | + $html .= '<input type="hidden" name="seriouslysimple_'.$this->token.'_nonce" id="seriouslysimple_'.$this->token.'_nonce" value="'.wp_create_nonce ( plugin_basename ( $this->dir ) ).'" />'; |
|
447 | 447 | |
448 | - if ( 0 < count( $field_data ) ) { |
|
448 | + if ( 0 < count ( $field_data ) ) { |
|
449 | 449 | |
450 | - $html .= '<input id="seriouslysimple_post_id" type="hidden" value="'. $post_id . '" />'; |
|
450 | + $html .= '<input id="seriouslysimple_post_id" type="hidden" value="'.$post_id.'" />'; |
|
451 | 451 | |
452 | 452 | foreach ( $field_data as $k => $v ) { |
453 | - $data = $v['default']; |
|
454 | - $saved = get_post_meta( $post_id, $k, true ); |
|
453 | + $data = $v[ 'default' ]; |
|
454 | + $saved = get_post_meta ( $post_id, $k, true ); |
|
455 | 455 | if ( $saved ) { |
456 | 456 | $data = $saved; |
457 | 457 | } |
458 | 458 | |
459 | 459 | $class = ''; |
460 | - if ( isset( $v['class'] ) ) { |
|
461 | - $class = $v['class']; |
|
460 | + if ( isset( $v[ 'class' ] ) ) { |
|
461 | + $class = $v[ 'class' ]; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | $disabled = false; |
465 | - if ( isset( $v['disabled'] ) && $v['disabled'] ) { |
|
465 | + if ( isset( $v[ 'disabled' ] ) && $v[ 'disabled' ] ) { |
|
466 | 466 | $disabled = true; |
467 | 467 | } |
468 | 468 | |
469 | - switch( $v['type'] ) { |
|
469 | + switch ( $v[ 'type' ] ) { |
|
470 | 470 | case 'file': |
471 | 471 | $html .= '<p> |
472 | - <label class="ssp-episode-details-label" for="' . esc_attr( $k ) . '">' . $v['name'] . '</label> |
|
472 | + <label class="ssp-episode-details-label" for="' . esc_attr ( $k ).'">'.$v[ 'name' ].'</label> |
|
473 | 473 | <br/> |
474 | - <input name="' . esc_attr( $k ) . '" type="text" id="upload_' . esc_attr( $k ) . '" value="' . esc_attr( $data ) . '" /> |
|
475 | - <input type="button" class="button" id="upload_' . esc_attr( $k ) . '_button" value="' . __( 'Upload File' , 'seriously-simple-podcasting' ) . '" data-uploader_title="' . __( 'Choose a file', 'seriously-simple-podcasting' ) . '" data-uploader_button_text="' . __( 'Insert podcast file', 'seriously-simple-podcasting' ) . '" /> |
|
474 | + <input name="' . esc_attr ( $k ).'" type="text" id="upload_'.esc_attr ( $k ).'" value="'.esc_attr ( $data ).'" /> |
|
475 | + <input type="button" class="button" id="upload_' . esc_attr ( $k ).'_button" value="'.__ ( 'Upload File', 'seriously-simple-podcasting' ).'" data-uploader_title="'.__ ( 'Choose a file', 'seriously-simple-podcasting' ).'" data-uploader_button_text="'.__ ( 'Insert podcast file', 'seriously-simple-podcasting' ).'" /> |
|
476 | 476 | <br/> |
477 | - <span class="description">' . $v['description'] . '</span> |
|
477 | + <span class="description">' . $v[ 'description' ].'</span> |
|
478 | 478 | </p>' . "\n"; |
479 | 479 | break; |
480 | 480 | |
481 | 481 | case 'checkbox': |
482 | - $html .= '<p><input name="' . esc_attr( $k ) . '" type="checkbox" class="' . esc_attr( $class ) . '" id="' . esc_attr( $k ) . '" ' . checked( 'on' , $data , false ) . ' /> <label for="' . esc_attr( $k ) . '"><span>' . $v['description'] . '</span></label></p>' . "\n"; |
|
482 | + $html .= '<p><input name="'.esc_attr ( $k ).'" type="checkbox" class="'.esc_attr ( $class ).'" id="'.esc_attr ( $k ).'" '.checked ( 'on', $data, false ).' /> <label for="'.esc_attr ( $k ).'"><span>'.$v[ 'description' ].'</span></label></p>'."\n"; |
|
483 | 483 | break; |
484 | 484 | |
485 | 485 | case 'radio': |
486 | 486 | $html .= '<p> |
487 | - <span class="ssp-episode-details-label">' . $v['name'] . '</span><br/>'; |
|
488 | - foreach( $v['options'] as $option => $label ) { |
|
489 | - $html .= '<input style="vertical-align: bottom;" name="' . esc_attr( $k ) . '" type="radio" class="' . esc_attr( $class ) . '" id="' . esc_attr( $k ) . '_' . esc_attr( $option ) . '" ' . checked( $option , $data , false ) . ' value="' . esc_attr( $option ) . '" /> |
|
490 | - <label style="margin-right:10px;" for="' . esc_attr( $k ) . '_' . esc_attr( $option ) . '">' . esc_html( $label ) . '</label>' . "\n"; |
|
487 | + <span class="ssp-episode-details-label">' . $v[ 'name' ].'</span><br/>'; |
|
488 | + foreach ( $v[ 'options' ] as $option => $label ) { |
|
489 | + $html .= '<input style="vertical-align: bottom;" name="'.esc_attr ( $k ).'" type="radio" class="'.esc_attr ( $class ).'" id="'.esc_attr ( $k ).'_'.esc_attr ( $option ).'" '.checked ( $option, $data, false ).' value="'.esc_attr ( $option ).'" /> |
|
490 | + <label style="margin-right:10px;" for="' . esc_attr ( $k ).'_'.esc_attr ( $option ).'">'.esc_html ( $label ).'</label>'."\n"; |
|
491 | 491 | } |
492 | - $html .= '<span class="description">' . $v['description'] . '</span> |
|
492 | + $html .= '<span class="description">'.$v[ 'description' ].'</span> |
|
493 | 493 | </p>' . "\n"; |
494 | 494 | break; |
495 | 495 | |
496 | 496 | case 'datepicker': |
497 | 497 | $display_date = ''; |
498 | - if( $data ) { |
|
499 | - $display_date = date( 'j F, Y', strtotime( $data ) ); |
|
498 | + if ( $data ) { |
|
499 | + $display_date = date ( 'j F, Y', strtotime ( $data ) ); |
|
500 | 500 | } |
501 | 501 | $html .= '<p class="hasDatepicker"> |
502 | - <label class="ssp-episode-details-label" for="' . esc_attr( $k ) . '_display">' . $v['name'] . '</label> |
|
502 | + <label class="ssp-episode-details-label" for="' . esc_attr ( $k ).'_display">'.$v[ 'name' ].'</label> |
|
503 | 503 | <br/> |
504 | - <input type="text" id="' . esc_attr( $k ) . '_display" class="ssp-datepicker ' . esc_attr( $class ) . '" value="' . esc_attr( $display_date ) . '" /> |
|
505 | - <input name="' . esc_attr( $k ) . '" id="' . esc_attr( $k ) . '" type="hidden" value="' . esc_attr( $data ) . '" /> |
|
504 | + <input type="text" id="' . esc_attr ( $k ).'_display" class="ssp-datepicker '.esc_attr ( $class ).'" value="'.esc_attr ( $display_date ).'" /> |
|
505 | + <input name="' . esc_attr ( $k ).'" id="'.esc_attr ( $k ).'" type="hidden" value="'.esc_attr ( $data ).'" /> |
|
506 | 506 | <br/> |
507 | - <span class="description">' . $v['description'] . '</span> |
|
507 | + <span class="description">' . $v[ 'description' ].'</span> |
|
508 | 508 | </p>' . "\n"; |
509 | 509 | break; |
510 | 510 | |
511 | 511 | default: |
512 | 512 | $html .= '<p> |
513 | - <label class="ssp-episode-details-label" for="' . esc_attr( $k ) . '">' . $v['name'] . '</label> |
|
513 | + <label class="ssp-episode-details-label" for="' . esc_attr ( $k ).'">'.$v[ 'name' ].'</label> |
|
514 | 514 | <br/> |
515 | - <input name="' . esc_attr( $k ) . '" type="text" id="' . esc_attr( $k ) . '" class="' . esc_attr( $class ) . '" value="' . esc_attr( $data ) . '" /> |
|
515 | + <input name="' . esc_attr ( $k ).'" type="text" id="'.esc_attr ( $k ).'" class="'.esc_attr ( $class ).'" value="'.esc_attr ( $data ).'" /> |
|
516 | 516 | <br/> |
517 | - <span class="description">' . $v['description'] . '</span> |
|
517 | + <span class="description">' . $v[ 'description' ].'</span> |
|
518 | 518 | </p>' . "\n"; |
519 | 519 | break; |
520 | 520 | } |
@@ -533,78 +533,78 @@ discard block |
||
533 | 533 | public function meta_box_save( $post_id ) { |
534 | 534 | global $ss_podcasting; |
535 | 535 | |
536 | - $podcast_post_types = ssp_post_types( true ); |
|
536 | + $podcast_post_types = ssp_post_types ( true ); |
|
537 | 537 | |
538 | 538 | // Post type check |
539 | - if ( ! in_array( get_post_type(), $podcast_post_types ) ) { |
|
539 | + if ( ! in_array ( get_post_type (), $podcast_post_types ) ) { |
|
540 | 540 | return false; |
541 | 541 | } |
542 | 542 | |
543 | 543 | // Security check |
544 | - if ( ! isset( $_POST['seriouslysimple_' . $this->token . '_nonce'] ) || ! ( isset( $_POST['seriouslysimple_' . $this->token . '_nonce'] ) && wp_verify_nonce( $_POST['seriouslysimple_' . $this->token . '_nonce'], plugin_basename( $this->dir ) ) ) ) { |
|
544 | + if ( ! isset( $_POST[ 'seriouslysimple_'.$this->token.'_nonce' ] ) || ! ( isset( $_POST[ 'seriouslysimple_'.$this->token.'_nonce' ] ) && wp_verify_nonce ( $_POST[ 'seriouslysimple_'.$this->token.'_nonce' ], plugin_basename ( $this->dir ) ) ) ) { |
|
545 | 545 | return $post_id; |
546 | 546 | } |
547 | 547 | |
548 | 548 | // User capability check |
549 | - if ( 'page' == $_POST['post_type'] ) { |
|
550 | - if ( ! current_user_can( 'edit_page', $post_id ) ) { |
|
549 | + if ( 'page' == $_POST[ 'post_type' ] ) { |
|
550 | + if ( ! current_user_can ( 'edit_page', $post_id ) ) { |
|
551 | 551 | return $post_id; |
552 | 552 | } |
553 | 553 | } else { |
554 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
554 | + if ( ! current_user_can ( 'edit_post', $post_id ) ) { |
|
555 | 555 | return $post_id; |
556 | 556 | } |
557 | 557 | } |
558 | 558 | |
559 | - $field_data = $this->custom_fields(); |
|
559 | + $field_data = $this->custom_fields (); |
|
560 | 560 | $enclosure = ''; |
561 | 561 | |
562 | 562 | foreach ( $field_data as $k => $field ) { |
563 | 563 | |
564 | - if( 'embed_code' == $k ) { |
|
564 | + if ( 'embed_code' == $k ) { |
|
565 | 565 | continue; |
566 | 566 | } |
567 | 567 | |
568 | 568 | $val = ''; |
569 | 569 | if ( isset( $_POST[ $k ] ) ) { |
570 | - $val = strip_tags( trim( $_POST[ $k ] ) ); |
|
570 | + $val = strip_tags ( trim ( $_POST[ $k ] ) ); |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | if ( $k == 'audio_file' ) { |
574 | 574 | $enclosure = $val; |
575 | 575 | } |
576 | 576 | |
577 | - update_post_meta( $post_id, $k, $val ); |
|
577 | + update_post_meta ( $post_id, $k, $val ); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | if ( $enclosure ) { |
581 | 581 | |
582 | 582 | // Get file duration |
583 | - if ( get_post_meta( $post_id, 'duration', true ) == '' ) { |
|
584 | - $duration = $ss_podcasting->get_file_duration( $enclosure ); |
|
583 | + if ( get_post_meta ( $post_id, 'duration', true ) == '' ) { |
|
584 | + $duration = $ss_podcasting->get_file_duration ( $enclosure ); |
|
585 | 585 | if ( $duration ) { |
586 | - update_post_meta( $post_id , 'duration' , $duration ); |
|
586 | + update_post_meta ( $post_id, 'duration', $duration ); |
|
587 | 587 | } |
588 | 588 | } |
589 | 589 | |
590 | 590 | // Get file size |
591 | - if ( get_post_meta( $post_id, 'filesize', true ) == '' ) { |
|
592 | - $filesize = $ss_podcasting->get_file_size( $enclosure ); |
|
591 | + if ( get_post_meta ( $post_id, 'filesize', true ) == '' ) { |
|
592 | + $filesize = $ss_podcasting->get_file_size ( $enclosure ); |
|
593 | 593 | if ( $filesize ) { |
594 | 594 | |
595 | - if ( isset( $filesize['formatted'] ) ) { |
|
596 | - update_post_meta( $post_id, 'filesize', $filesize['formatted'] ); |
|
595 | + if ( isset( $filesize[ 'formatted' ] ) ) { |
|
596 | + update_post_meta ( $post_id, 'filesize', $filesize[ 'formatted' ] ); |
|
597 | 597 | } |
598 | 598 | |
599 | - if ( isset( $filesize['raw'] ) ) { |
|
600 | - update_post_meta( $post_id, 'filesize_raw', $filesize['raw'] ); |
|
599 | + if ( isset( $filesize[ 'raw' ] ) ) { |
|
600 | + update_post_meta ( $post_id, 'filesize_raw', $filesize[ 'raw' ] ); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | } |
604 | 604 | } |
605 | 605 | |
606 | 606 | // Save podcast file to 'enclosure' meta field for standards-sake |
607 | - update_post_meta( $post_id, 'enclosure', $enclosure ); |
|
607 | + update_post_meta ( $post_id, 'enclosure', $enclosure ); |
|
608 | 608 | |
609 | 609 | } |
610 | 610 | |
@@ -618,65 +618,65 @@ discard block |
||
618 | 618 | global $pagenow; |
619 | 619 | $fields = array(); |
620 | 620 | |
621 | - $fields['episode_type'] = array( |
|
622 | - 'name' => __( 'Episode type:' , 'seriously-simple-podcasting' ), |
|
621 | + $fields[ 'episode_type' ] = array( |
|
622 | + 'name' => __ ( 'Episode type:', 'seriously-simple-podcasting' ), |
|
623 | 623 | 'description' => '', |
624 | 624 | 'type' => 'radio', |
625 | 625 | 'default' => 'audio', |
626 | - 'options' => array( 'audio' => __( 'Audio', 'seriously-simple-podcasting' ), 'video' => __( 'Video', 'seriously-simple-podcasting' ) ), |
|
626 | + 'options' => array( 'audio' => __ ( 'Audio', 'seriously-simple-podcasting' ), 'video' => __ ( 'Video', 'seriously-simple-podcasting' ) ), |
|
627 | 627 | 'section' => 'info', |
628 | 628 | ); |
629 | 629 | |
630 | 630 | // In v1.14+ the `audio_file` field can actually be either audio or video, but we're keeping the field name here for backwards compatibility |
631 | - $fields['audio_file'] = array( |
|
632 | - 'name' => __( 'Podcast file:' , 'seriously-simple-podcasting' ), |
|
633 | - 'description' => __( 'Upload the primary podcast file or paste the file URL here.' , 'seriously-simple-podcasting' ), |
|
631 | + $fields[ 'audio_file' ] = array( |
|
632 | + 'name' => __ ( 'Podcast file:', 'seriously-simple-podcasting' ), |
|
633 | + 'description' => __ ( 'Upload the primary podcast file or paste the file URL here.', 'seriously-simple-podcasting' ), |
|
634 | 634 | 'type' => 'file', |
635 | 635 | 'default' => '', |
636 | 636 | 'section' => 'info', |
637 | 637 | ); |
638 | 638 | |
639 | - $fields['duration'] = array( |
|
640 | - 'name' => __( 'Duration:' , 'seriously-simple-podcasting' ), |
|
641 | - 'description' => __( 'Duration of podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ), |
|
639 | + $fields[ 'duration' ] = array( |
|
640 | + 'name' => __ ( 'Duration:', 'seriously-simple-podcasting' ), |
|
641 | + 'description' => __ ( 'Duration of podcast file for display (calculated automatically if possible).', 'seriously-simple-podcasting' ), |
|
642 | 642 | 'type' => 'text', |
643 | 643 | 'default' => '', |
644 | 644 | 'section' => 'info', |
645 | 645 | ); |
646 | 646 | |
647 | - $fields['filesize'] = array( |
|
648 | - 'name' => __( 'File size:' , 'seriously-simple-podcasting' ), |
|
649 | - 'description' => __( 'Size of the podcast file for display (calculated automatically if possible).' , 'seriously-simple-podcasting' ), |
|
647 | + $fields[ 'filesize' ] = array( |
|
648 | + 'name' => __ ( 'File size:', 'seriously-simple-podcasting' ), |
|
649 | + 'description' => __ ( 'Size of the podcast file for display (calculated automatically if possible).', 'seriously-simple-podcasting' ), |
|
650 | 650 | 'type' => 'text', |
651 | 651 | 'default' => '', |
652 | 652 | 'section' => 'info', |
653 | 653 | ); |
654 | 654 | |
655 | - $fields['date_recorded'] = array( |
|
656 | - 'name' => __( 'Date recorded:' , 'seriously-simple-podcasting' ), |
|
657 | - 'description' => __( 'The date on which this episode was recorded.' , 'seriously-simple-podcasting' ), |
|
655 | + $fields[ 'date_recorded' ] = array( |
|
656 | + 'name' => __ ( 'Date recorded:', 'seriously-simple-podcasting' ), |
|
657 | + 'description' => __ ( 'The date on which this episode was recorded.', 'seriously-simple-podcasting' ), |
|
658 | 658 | 'type' => 'datepicker', |
659 | 659 | 'default' => '', |
660 | 660 | 'section' => 'info', |
661 | 661 | ); |
662 | 662 | |
663 | - $fields['explicit'] = array( |
|
664 | - 'name' => __( 'Explicit:' , 'seriously-simple-podcasting' ), |
|
665 | - 'description' => __( 'Mark this episode as explicit.' , 'seriously-simple-podcasting' ), |
|
663 | + $fields[ 'explicit' ] = array( |
|
664 | + 'name' => __ ( 'Explicit:', 'seriously-simple-podcasting' ), |
|
665 | + 'description' => __ ( 'Mark this episode as explicit.', 'seriously-simple-podcasting' ), |
|
666 | 666 | 'type' => 'checkbox', |
667 | 667 | 'default' => '', |
668 | 668 | 'section' => 'info', |
669 | 669 | ); |
670 | 670 | |
671 | - $fields['block'] = array( |
|
672 | - 'name' => __( 'Block:' , 'seriously-simple-podcasting' ), |
|
673 | - 'description' => __( 'Block this episode from appearing in the iTunes & Google Play podcast libraries.' , 'seriously-simple-podcasting' ), |
|
671 | + $fields[ 'block' ] = array( |
|
672 | + 'name' => __ ( 'Block:', 'seriously-simple-podcasting' ), |
|
673 | + 'description' => __ ( 'Block this episode from appearing in the iTunes & Google Play podcast libraries.', 'seriously-simple-podcasting' ), |
|
674 | 674 | 'type' => 'checkbox', |
675 | 675 | 'default' => '', |
676 | 676 | 'section' => 'info', |
677 | 677 | ); |
678 | 678 | |
679 | - return apply_filters( 'ssp_episode_fields', $fields ); |
|
679 | + return apply_filters ( 'ssp_episode_fields', $fields ); |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | /** |
@@ -686,17 +686,17 @@ discard block |
||
686 | 686 | */ |
687 | 687 | public function glance_items( $items = array() ) { |
688 | 688 | |
689 | - $num_posts = count( ssp_episodes( -1, '', false, 'glance' ) ); |
|
689 | + $num_posts = count ( ssp_episodes ( -1, '', false, 'glance' ) ); |
|
690 | 690 | |
691 | - $post_type_object = get_post_type_object( $this->token ); |
|
691 | + $post_type_object = get_post_type_object ( $this->token ); |
|
692 | 692 | |
693 | - $text = _n( '%s Episode', '%s Episodes', $num_posts, 'seriously-simple-podcasting' ); |
|
694 | - $text = sprintf( $text, number_format_i18n( $num_posts ) ); |
|
693 | + $text = _n ( '%s Episode', '%s Episodes', $num_posts, 'seriously-simple-podcasting' ); |
|
694 | + $text = sprintf ( $text, number_format_i18n ( $num_posts ) ); |
|
695 | 695 | |
696 | - if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) { |
|
697 | - $items[] = sprintf( '<a class="%1$s-count" href="edit.php?post_type=%1$s">%2$s</a>', $this->token, $text ) . "\n"; |
|
696 | + if ( $post_type_object && current_user_can ( $post_type_object->cap->edit_posts ) ) { |
|
697 | + $items[ ] = sprintf ( '<a class="%1$s-count" href="edit.php?post_type=%1$s">%2$s</a>', $this->token, $text )."\n"; |
|
698 | 698 | } else { |
699 | - $items[] = sprintf( '<span class="%1$s-count">%2$s</span>', $this->token, $text ) . "\n"; |
|
699 | + $items[ ] = sprintf ( '<span class="%1$s-count">%2$s</span>', $this->token, $text )."\n"; |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | return $items; |
@@ -710,15 +710,15 @@ discard block |
||
710 | 710 | * @param string $status Plugin status |
711 | 711 | * @return array Modified plugin meta links |
712 | 712 | */ |
713 | - public function plugin_row_meta ( $plugin_meta = array(), $plugin_file = '', $plugin_data = array(), $status = '' ) { |
|
713 | + public function plugin_row_meta( $plugin_meta = array(), $plugin_file = '', $plugin_data = array(), $status = '' ) { |
|
714 | 714 | |
715 | - if ( ! isset( $plugin_data['slug'] ) || 'seriously-simple-podcasting' != $plugin_data['slug'] ) { |
|
715 | + if ( ! isset( $plugin_data[ 'slug' ] ) || 'seriously-simple-podcasting' != $plugin_data[ 'slug' ] ) { |
|
716 | 716 | return $plugin_meta; |
717 | 717 | } |
718 | 718 | |
719 | - $plugin_meta['docs'] = '<a href="http://www.seriouslysimplepodcasting.com/documentation/" target="_blank">' . __( 'Documentation', 'seriously-simple-podcasting' ) . '</a>'; |
|
720 | - $plugin_meta['addons'] = '<a href="http://www.seriouslysimplepodcasting.com/add-ons/" target="_blank">' . __( 'Add-ons', 'seriously-simple-podcasting' ) . '</a>'; |
|
721 | - $plugin_meta['review'] = '<a href="https://wordpress.org/support/view/plugin-reviews/' . $plugin_data['slug'] . '?rate=5#postform" target="_blank">' . __( 'Write a review', 'seriously-simple-podcasting' ) . '</a>'; |
|
719 | + $plugin_meta[ 'docs' ] = '<a href="http://www.seriouslysimplepodcasting.com/documentation/" target="_blank">'.__ ( 'Documentation', 'seriously-simple-podcasting' ).'</a>'; |
|
720 | + $plugin_meta[ 'addons' ] = '<a href="http://www.seriouslysimplepodcasting.com/add-ons/" target="_blank">'.__ ( 'Add-ons', 'seriously-simple-podcasting' ).'</a>'; |
|
721 | + $plugin_meta[ 'review' ] = '<a href="https://wordpress.org/support/view/plugin-reviews/'.$plugin_data[ 'slug' ].'?rate=5#postform" target="_blank">'.__ ( 'Write a review', 'seriously-simple-podcasting' ).'</a>'; |
|
722 | 722 | |
723 | 723 | return $plugin_meta; |
724 | 724 | } |
@@ -729,8 +729,8 @@ discard block |
||
729 | 729 | * @return string Modified text |
730 | 730 | */ |
731 | 731 | public function enter_title_here( $title ) { |
732 | - if ( get_post_type() == $this->token ) { |
|
733 | - $title = __( 'Enter episode title here', 'seriously-simple-podcasting' ); |
|
732 | + if ( get_post_type () == $this->token ) { |
|
733 | + $title = __ ( 'Enter episode title here', 'seriously-simple-podcasting' ); |
|
734 | 734 | } |
735 | 735 | return $title; |
736 | 736 | } |
@@ -740,11 +740,11 @@ discard block |
||
740 | 740 | * @return void |
741 | 741 | */ |
742 | 742 | public function enqueue_admin_styles() { |
743 | - wp_register_style( 'ssp-admin', esc_url( $this->assets_url . 'css/admin.css' ), array(), $this->version ); |
|
744 | - wp_enqueue_style( 'ssp-admin' ); |
|
743 | + wp_register_style ( 'ssp-admin', esc_url ( $this->assets_url.'css/admin.css' ), array(), $this->version ); |
|
744 | + wp_enqueue_style ( 'ssp-admin' ); |
|
745 | 745 | |
746 | 746 | // Datepicker |
747 | - wp_enqueue_style( 'jquery-ui-datepicker', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css' ); |
|
747 | + wp_enqueue_style ( 'jquery-ui-datepicker', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css' ); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | /** |
@@ -752,8 +752,8 @@ discard block |
||
752 | 752 | * @return void |
753 | 753 | */ |
754 | 754 | public function enqueue_admin_scripts() { |
755 | - wp_register_script( 'ssp-admin', esc_url( $this->assets_url . 'js/admin' . $this->script_suffix . '.js' ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker' ), $this->version ); |
|
756 | - wp_enqueue_script( 'ssp-admin' ); |
|
755 | + wp_register_script ( 'ssp-admin', esc_url ( $this->assets_url.'js/admin'.$this->script_suffix.'.js' ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker' ), $this->version ); |
|
756 | + wp_enqueue_script ( 'ssp-admin' ); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | /** |
@@ -761,8 +761,8 @@ discard block |
||
761 | 761 | * @return void |
762 | 762 | */ |
763 | 763 | public function ensure_post_thumbnails_support() { |
764 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
765 | - add_theme_support( 'post-thumbnails' ); |
|
764 | + if ( ! current_theme_supports ( 'post-thumbnails' ) ) { |
|
765 | + add_theme_support ( 'post-thumbnails' ); |
|
766 | 766 | } |
767 | 767 | } |
768 | 768 | |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | * @return void |
772 | 772 | */ |
773 | 773 | public function load_localisation() { |
774 | - load_plugin_textdomain( 'seriously-simple-podcasting', false, dirname( plugin_basename( $this->file ) ) . '/lang/' ); |
|
774 | + load_plugin_textdomain ( 'seriously-simple-podcasting', false, dirname ( plugin_basename ( $this->file ) ).'/lang/' ); |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | /** |
@@ -781,10 +781,10 @@ discard block |
||
781 | 781 | public function load_plugin_textdomain() { |
782 | 782 | $domain = 'seriously-simple-podcasting'; |
783 | 783 | // The "plugin_locale" filter is also used in load_plugin_textdomain() |
784 | - $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); |
|
784 | + $locale = apply_filters ( 'plugin_locale', get_locale (), $domain ); |
|
785 | 785 | |
786 | - load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' ); |
|
787 | - load_plugin_textdomain( $domain, false, dirname( plugin_basename( $this->file ) ) . '/lang/' ); |
|
786 | + load_textdomain ( $domain, WP_LANG_DIR.'/'.$domain.'/'.$domain.'-'.$locale.'.mo' ); |
|
787 | + load_plugin_textdomain ( $domain, false, dirname ( plugin_basename ( $this->file ) ).'/lang/' ); |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | /** |
@@ -792,8 +792,8 @@ discard block |
||
792 | 792 | * @return void |
793 | 793 | */ |
794 | 794 | public function add_feed() { |
795 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
796 | - add_feed( $feed_slug, array( $this, 'feed_template' ) ); |
|
795 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
796 | + add_feed ( $feed_slug, array( $this, 'feed_template' ) ); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | /** |
@@ -801,9 +801,9 @@ discard block |
||
801 | 801 | * @param boolean $include_footer Default inclusion value |
802 | 802 | * @return boolean Modified inclusion value |
803 | 803 | */ |
804 | - public function hide_wp_seo_rss_footer ( $include_footer = true ) { |
|
804 | + public function hide_wp_seo_rss_footer( $include_footer = true ) { |
|
805 | 805 | |
806 | - if ( is_feed( 'podcast' ) ) { |
|
806 | + if ( is_feed ( 'podcast' ) ) { |
|
807 | 807 | $include_footer = false; |
808 | 808 | } |
809 | 809 | |
@@ -819,24 +819,24 @@ discard block |
||
819 | 819 | |
820 | 820 | // Prevent 404 on feed |
821 | 821 | $wp_query->is_404 = false; |
822 | - status_header( 200 ); |
|
822 | + status_header ( 200 ); |
|
823 | 823 | |
824 | 824 | $file_name = 'feed-podcast.php'; |
825 | 825 | |
826 | - $user_template_file = apply_filters( 'ssp_feed_template_file', trailingslashit( get_stylesheet_directory() ) . $file_name ); |
|
826 | + $user_template_file = apply_filters ( 'ssp_feed_template_file', trailingslashit ( get_stylesheet_directory () ).$file_name ); |
|
827 | 827 | |
828 | 828 | // Any functions hooked in here must NOT output any data or else feed will break |
829 | - do_action( 'ssp_before_feed' ); |
|
829 | + do_action ( 'ssp_before_feed' ); |
|
830 | 830 | |
831 | 831 | // Load user feed template if it exists, otherwise use plugin template |
832 | - if ( file_exists( $user_template_file ) ) { |
|
832 | + if ( file_exists ( $user_template_file ) ) { |
|
833 | 833 | require( $user_template_file ); |
834 | 834 | } else { |
835 | - require( $this->template_path . $file_name ); |
|
835 | + require( $this->template_path.$file_name ); |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | // Any functions hooked in here must NOT output any data or else feed will break |
839 | - do_action( 'ssp_after_feed' ); |
|
839 | + do_action ( 'ssp_after_feed' ); |
|
840 | 840 | |
841 | 841 | exit; |
842 | 842 | } |
@@ -846,8 +846,8 @@ discard block |
||
846 | 846 | * @return void |
847 | 847 | */ |
848 | 848 | public function redirect_old_feed() { |
849 | - if ( isset( $_GET['feed'] ) && in_array( $_GET['feed'], array( 'podcast', 'itunes' ) ) ) { |
|
850 | - $this->feed_template(); |
|
849 | + if ( isset( $_GET[ 'feed' ] ) && in_array ( $_GET[ 'feed' ], array( 'podcast', 'itunes' ) ) ) { |
|
850 | + $this->feed_template (); |
|
851 | 851 | exit; |
852 | 852 | } |
853 | 853 | } |
@@ -859,12 +859,12 @@ discard block |
||
859 | 859 | public function activate() { |
860 | 860 | |
861 | 861 | // Setup all custom URL rules |
862 | - $this->register_post_type(); |
|
863 | - $this->add_feed(); |
|
864 | - $this->setup_permastruct(); |
|
862 | + $this->register_post_type (); |
|
863 | + $this->add_feed (); |
|
864 | + $this->setup_permastruct (); |
|
865 | 865 | |
866 | 866 | // Flush permalinks |
867 | - flush_rewrite_rules( true ); |
|
867 | + flush_rewrite_rules ( true ); |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | /** |
@@ -872,37 +872,37 @@ discard block |
||
872 | 872 | * @return void |
873 | 873 | */ |
874 | 874 | public function deactivate() { |
875 | - flush_rewrite_rules(); |
|
875 | + flush_rewrite_rules (); |
|
876 | 876 | } |
877 | 877 | |
878 | 878 | /** |
879 | 879 | * Run functions on plugin update/activation |
880 | 880 | * @return void |
881 | 881 | */ |
882 | - public function update () { |
|
882 | + public function update() { |
|
883 | 883 | |
884 | - $previous_version = get_option( 'ssp_version', '1.0' ); |
|
884 | + $previous_version = get_option ( 'ssp_version', '1.0' ); |
|
885 | 885 | |
886 | - if ( version_compare( $previous_version, '1.13.1', '<' ) ) { |
|
887 | - flush_rewrite_rules(); |
|
886 | + if ( version_compare ( $previous_version, '1.13.1', '<' ) ) { |
|
887 | + flush_rewrite_rules (); |
|
888 | 888 | } |
889 | 889 | |
890 | - update_option( 'ssp_version', $this->version ); |
|
890 | + update_option ( 'ssp_version', $this->version ); |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | /** |
894 | 894 | * Update 'enclosure' meta field to 'audio_file' meta field |
895 | 895 | * @return void |
896 | 896 | */ |
897 | - public function update_enclosures () { |
|
897 | + public function update_enclosures() { |
|
898 | 898 | |
899 | 899 | // Allow forced re-run of update if necessary |
900 | - if ( isset( $_GET['ssp_update_enclosures'] ) ) { |
|
901 | - delete_option( 'ssp_update_enclosures' ); |
|
900 | + if ( isset( $_GET[ 'ssp_update_enclosures' ] ) ) { |
|
901 | + delete_option ( 'ssp_update_enclosures' ); |
|
902 | 902 | } |
903 | 903 | |
904 | 904 | // Check if update has been run |
905 | - $update_run = get_option( 'ssp_update_enclosures', false ); |
|
905 | + $update_run = get_option ( 'ssp_update_enclosures', false ); |
|
906 | 906 | |
907 | 907 | if ( $update_run ) { |
908 | 908 | return; |
@@ -923,9 +923,9 @@ discard block |
||
923 | 923 | 'fields' => 'ids', |
924 | 924 | ); |
925 | 925 | |
926 | - $posts_with_enclosures = get_posts( $args ); |
|
926 | + $posts_with_enclosures = get_posts ( $args ); |
|
927 | 927 | |
928 | - if ( 0 == count( $posts_with_enclosures ) ) { |
|
928 | + if ( 0 == count ( $posts_with_enclosures ) ) { |
|
929 | 929 | return; |
930 | 930 | } |
931 | 931 | |
@@ -933,17 +933,17 @@ discard block |
||
933 | 933 | foreach ( (array) $posts_with_enclosures as $post_id ) { |
934 | 934 | |
935 | 935 | // Get existing enclosure |
936 | - $enclosure = get_post_meta( $post_id, 'enclosure', true ); |
|
936 | + $enclosure = get_post_meta ( $post_id, 'enclosure', true ); |
|
937 | 937 | |
938 | 938 | // Add audio_file field |
939 | 939 | if ( $enclosure ) { |
940 | - update_post_meta( $post_id, 'audio_file', $enclosure ); |
|
940 | + update_post_meta ( $post_id, 'audio_file', $enclosure ); |
|
941 | 941 | } |
942 | 942 | |
943 | 943 | } |
944 | 944 | |
945 | 945 | // Mark update as having been run |
946 | - update_option( 'ssp_update_enclosures', 'run' ); |
|
946 | + update_option ( 'ssp_update_enclosures', 'run' ); |
|
947 | 947 | } |
948 | 948 | |
949 | 949 | /** |
@@ -954,19 +954,19 @@ discard block |
||
954 | 954 | public function admin_footer_text( $footer_text ) { |
955 | 955 | |
956 | 956 | // Check to make sure we're on a SSP settings page |
957 | - if ( ( isset( $_GET['page'] ) && 'podcast_settings' == esc_attr( $_GET['page'] ) ) && apply_filters( 'ssp_display_admin_footer_text', true ) ) { |
|
957 | + if ( ( isset( $_GET[ 'page' ] ) && 'podcast_settings' == esc_attr ( $_GET[ 'page' ] ) ) && apply_filters ( 'ssp_display_admin_footer_text', true ) ) { |
|
958 | 958 | |
959 | 959 | // Change the footer text |
960 | - if ( ! get_option( 'ssp_admin_footer_text_rated' ) ) { |
|
961 | - $footer_text = sprintf( __( 'If you like %1$sSeriously Simple Podcasting%2$s please leave a %3$s★★★★★%4$s rating. A huge thank you in advance!', 'seriously-simple-podcasting' ), '<strong>', '</strong>', '<a href="https://wordpress.org/support/view/plugin-reviews/seriously-simple-podcasting?filter=5#postform" target="_blank" class="ssp-rating-link" data-rated="' . __( 'Thanks!', 'seriously-simple-podcasting' ) . '">', '</a>' ); |
|
960 | + if ( ! get_option ( 'ssp_admin_footer_text_rated' ) ) { |
|
961 | + $footer_text = sprintf ( __ ( 'If you like %1$sSeriously Simple Podcasting%2$s please leave a %3$s★★★★★%4$s rating. A huge thank you in advance!', 'seriously-simple-podcasting' ), '<strong>', '</strong>', '<a href="https://wordpress.org/support/view/plugin-reviews/seriously-simple-podcasting?filter=5#postform" target="_blank" class="ssp-rating-link" data-rated="'.__ ( 'Thanks!', 'seriously-simple-podcasting' ).'">', '</a>' ); |
|
962 | 962 | $footer_text .= "<script type='text/javascript'> |
963 | 963 | jQuery('a.ssp-rating-link').click(function() { |
964 | - jQuery.post( '" . admin_url( 'admin-ajax.php' ) . "', { action: 'ssp_rated' } ); |
|
964 | + jQuery.post( '" . admin_url ( 'admin-ajax.php' )."', { action: 'ssp_rated' } ); |
|
965 | 965 | jQuery(this).parent().text( jQuery(this).data( 'rated' ) ); |
966 | 966 | }); |
967 | 967 | </script>"; |
968 | 968 | } else { |
969 | - $footer_text = sprintf( __( '%1$sThank you for publishing with %2$sSeriously Simple Podcasting%3$s.%4$s', 'seriously-simple-podcasting' ), '<span id="footer-thankyou">', '<a href="http://www.seriouslysimplepodcasting.com/" target="_blank">', '</a>', '</span>' ); |
|
969 | + $footer_text = sprintf ( __ ( '%1$sThank you for publishing with %2$sSeriously Simple Podcasting%3$s.%4$s', 'seriously-simple-podcasting' ), '<span id="footer-thankyou">', '<a href="http://www.seriouslysimplepodcasting.com/" target="_blank">', '</a>', '</span>' ); |
|
970 | 970 | } |
971 | 971 | |
972 | 972 | } |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | * @return void |
980 | 980 | */ |
981 | 981 | public function rated() { |
982 | - update_option( 'ssp_admin_footer_text_rated', 1 ); |
|
982 | + update_option ( 'ssp_admin_footer_text_rated', 1 ); |
|
983 | 983 | die(); |
984 | 984 | } |
985 | 985 | |
@@ -989,11 +989,11 @@ discard block |
||
989 | 989 | * @param object $post WordPress Post Object |
990 | 990 | * @return void |
991 | 991 | */ |
992 | - public function invalidate_cache( $id, $post ){ |
|
992 | + public function invalidate_cache( $id, $post ) { |
|
993 | 993 | |
994 | - if ( in_array( $post->post_type, ssp_post_types( true ) ) ){ |
|
995 | - wp_cache_delete( 'episodes', 'ssp' ); |
|
996 | - wp_cache_delete( 'episode_ids', 'ssp' ); |
|
994 | + if ( in_array ( $post->post_type, ssp_post_types ( true ) ) ) { |
|
995 | + wp_cache_delete ( 'episodes', 'ssp' ); |
|
996 | + wp_cache_delete ( 'episode_ids', 'ssp' ); |
|
997 | 997 | } |
998 | 998 | |
999 | 999 | } |