@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly. |
4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined ( 'ABSPATH' ) ) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
@@ -31,37 +31,37 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function __construct( $file ) { |
33 | 33 | $this->file = $file; |
34 | - $this->dir = dirname( $this->file ); |
|
35 | - $this->assets_dir = trailingslashit( $this->dir ) . 'assets'; |
|
36 | - $this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $this->file ) ) ); |
|
37 | - $this->home_url = trailingslashit( home_url() ); |
|
34 | + $this->dir = dirname ( $this->file ); |
|
35 | + $this->assets_dir = trailingslashit ( $this->dir ).'assets'; |
|
36 | + $this->assets_url = esc_url ( trailingslashit ( plugins_url ( '/assets/', $this->file ) ) ); |
|
37 | + $this->home_url = trailingslashit ( home_url () ); |
|
38 | 38 | $this->token = 'podcast'; |
39 | 39 | $this->settings_base = 'ss_podcasting_'; |
40 | 40 | |
41 | - add_action( 'init', array( $this, 'load_settings' ), 11 ); |
|
41 | + add_action ( 'init', array( $this, 'load_settings' ), 11 ); |
|
42 | 42 | |
43 | 43 | // Register podcast settings |
44 | - add_action( 'admin_init' , array( $this, 'register_settings' ) ); |
|
44 | + add_action ( 'admin_init', array( $this, 'register_settings' ) ); |
|
45 | 45 | |
46 | 46 | // Add settings page to menu |
47 | - add_action( 'admin_menu', array( $this , 'add_menu_item' ) ); |
|
47 | + add_action ( 'admin_menu', array( $this, 'add_menu_item' ) ); |
|
48 | 48 | |
49 | 49 | // Add settings link to plugins page |
50 | - add_filter( 'plugin_action_links_' . plugin_basename( $this->file ), array( $this , 'add_plugin_links' ) ); |
|
50 | + add_filter ( 'plugin_action_links_'.plugin_basename ( $this->file ), array( $this, 'add_plugin_links' ) ); |
|
51 | 51 | |
52 | 52 | // Load scripts for settings page |
53 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) , 10 ); |
|
53 | + add_action ( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 10 ); |
|
54 | 54 | |
55 | 55 | // Mark date on which feed redirection was activated |
56 | - add_action( 'update_option', array( $this, 'mark_feed_redirect_date' ) , 10 , 3 ); |
|
56 | + add_action ( 'update_option', array( $this, 'mark_feed_redirect_date' ), 10, 3 ); |
|
57 | 57 | |
58 | 58 | // New caps for editors and above. |
59 | - add_action( 'admin_init', array( $this, 'add_caps' ), 1 ); |
|
59 | + add_action ( 'admin_init', array( $this, 'add_caps' ), 1 ); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | 63 | public function load_settings() { |
64 | - $this->settings = $this->settings_fields(); |
|
64 | + $this->settings = $this->settings_fields (); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return void |
70 | 70 | */ |
71 | 71 | public function add_menu_item() { |
72 | - add_submenu_page( 'edit.php?post_type=podcast' , __( 'Podcast Settings', 'seriously-simple-podcasting' ) , __( 'Settings', 'seriously-simple-podcasting' ), 'manage_podcast' , 'podcast_settings' , array( $this , 'settings_page' ) ); |
|
72 | + add_submenu_page ( 'edit.php?post_type=podcast', __ ( 'Podcast Settings', 'seriously-simple-podcasting' ), __ ( 'Settings', 'seriously-simple-podcasting' ), 'manage_podcast', 'podcast_settings', array( $this, 'settings_page' ) ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | |
80 | 80 | // Roles you'd like to have administer the podcast settings page. |
81 | 81 | // Admin and Editor, as default. |
82 | - $roles = apply_filters( 'ssp_manage_podcast', array( 'administrator', 'editor' ) ); |
|
82 | + $roles = apply_filters ( 'ssp_manage_podcast', array( 'administrator', 'editor' ) ); |
|
83 | 83 | |
84 | 84 | // Loop through each role and assign capabilities |
85 | - foreach( $roles as $the_role ) { |
|
85 | + foreach ( $roles as $the_role ) { |
|
86 | 86 | |
87 | - $role = get_role( $the_role ); |
|
87 | + $role = get_role ( $the_role ); |
|
88 | 88 | $caps = array( |
89 | 89 | 'manage_podcast', |
90 | 90 | ); |
91 | 91 | |
92 | 92 | // Add the caps. |
93 | 93 | foreach ( $caps as $cap ) { |
94 | - $this->maybe_add_cap( $role, $cap ); |
|
94 | + $this->maybe_add_cap ( $role, $cap ); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | } |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function maybe_add_cap( $role, $cap ) { |
107 | 107 | // Update the roles, if needed. |
108 | - if ( ! $role->has_cap( $cap ) ) { |
|
109 | - $role->add_cap( $cap ); |
|
108 | + if ( ! $role->has_cap ( $cap ) ) { |
|
109 | + $role->add_cap ( $cap ); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @return array $links Modified links |
117 | 117 | */ |
118 | 118 | public function add_plugin_links( $links ) { |
119 | - $settings_link = '<a href="edit.php?post_type=podcast&page=podcast_settings">' . __( 'Settings', 'seriously-simple-podcasting' ) . '</a>'; |
|
120 | - array_push( $links, $settings_link ); |
|
119 | + $settings_link = '<a href="edit.php?post_type=podcast&page=podcast_settings">'.__ ( 'Settings', 'seriously-simple-podcasting' ).'</a>'; |
|
120 | + array_push ( $links, $settings_link ); |
|
121 | 121 | return $links; |
122 | 122 | } |
123 | 123 | |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function enqueue_scripts() { |
129 | 129 | global $pagenow; |
130 | - if ( in_array( $pagenow, array( 'post-new.php', 'post.php' ) ) || ( isset( $_GET['page'] ) && 'podcast_settings' == $_GET['page'] ) ) { |
|
131 | - wp_enqueue_media(); |
|
130 | + if ( in_array ( $pagenow, array( 'post-new.php', 'post.php' ) ) || ( isset( $_GET[ 'page' ] ) && 'podcast_settings' == $_GET[ 'page' ] ) ) { |
|
131 | + wp_enqueue_media (); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // Set options for post type selection |
145 | 145 | foreach ( $wp_post_types as $post_type => $data ) { |
146 | 146 | |
147 | - if ( in_array( $post_type, array( 'page', 'attachment', 'revision', 'nav_menu_item', 'wooframework', 'podcast' ) ) ){ |
|
147 | + if ( in_array ( $post_type, array( 'page', 'attachment', 'revision', 'nav_menu_item', 'wooframework', 'podcast' ) ) ) { |
|
148 | 148 | continue; |
149 | 149 | } |
150 | 150 | |
@@ -153,181 +153,181 @@ discard block |
||
153 | 153 | |
154 | 154 | // Set up available category options |
155 | 155 | $category_options = array( |
156 | - '' => __( '-- None --', 'seriously-simple-podcasting' ), |
|
157 | - 'Arts' => __( 'Arts', 'seriously-simple-podcasting' ), |
|
158 | - 'Business' => __( 'Business', 'seriously-simple-podcasting' ), |
|
159 | - 'Comedy' => __( 'Comedy', 'seriously-simple-podcasting' ), |
|
160 | - 'Education' => __( 'Education', 'seriously-simple-podcasting' ), |
|
161 | - 'Games & Hobbies' => __( 'Games & Hobbies', 'seriously-simple-podcasting' ), |
|
162 | - 'Government & Organizations' => __( 'Government & Organizations', 'seriously-simple-podcasting' ), |
|
163 | - 'Health' => __( 'Health', 'seriously-simple-podcasting' ), |
|
164 | - 'Kids & Family' => __( 'Kids & Family', 'seriously-simple-podcasting' ), |
|
165 | - 'Music' => __( 'Music', 'seriously-simple-podcasting' ), |
|
166 | - 'News & Politics' => __( 'News & Politics', 'seriously-simple-podcasting' ), |
|
167 | - 'Religion & Spirituality' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ), |
|
168 | - 'Science & Medicine' => __( 'Science & Medicine', 'seriously-simple-podcasting' ), |
|
169 | - 'Society & Culture' => __( 'Society & Culture', 'seriously-simple-podcasting' ), |
|
170 | - 'Sports & Recreation' => __( 'Sports & Recreation', 'seriously-simple-podcasting' ), |
|
171 | - 'Technology' => __( 'Technology', 'seriously-simple-podcasting' ), |
|
172 | - 'TV & Film' => __( 'TV & Film', 'seriously-simple-podcasting' ), |
|
156 | + '' => __ ( '-- None --', 'seriously-simple-podcasting' ), |
|
157 | + 'Arts' => __ ( 'Arts', 'seriously-simple-podcasting' ), |
|
158 | + 'Business' => __ ( 'Business', 'seriously-simple-podcasting' ), |
|
159 | + 'Comedy' => __ ( 'Comedy', 'seriously-simple-podcasting' ), |
|
160 | + 'Education' => __ ( 'Education', 'seriously-simple-podcasting' ), |
|
161 | + 'Games & Hobbies' => __ ( 'Games & Hobbies', 'seriously-simple-podcasting' ), |
|
162 | + 'Government & Organizations' => __ ( 'Government & Organizations', 'seriously-simple-podcasting' ), |
|
163 | + 'Health' => __ ( 'Health', 'seriously-simple-podcasting' ), |
|
164 | + 'Kids & Family' => __ ( 'Kids & Family', 'seriously-simple-podcasting' ), |
|
165 | + 'Music' => __ ( 'Music', 'seriously-simple-podcasting' ), |
|
166 | + 'News & Politics' => __ ( 'News & Politics', 'seriously-simple-podcasting' ), |
|
167 | + 'Religion & Spirituality' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ), |
|
168 | + 'Science & Medicine' => __ ( 'Science & Medicine', 'seriously-simple-podcasting' ), |
|
169 | + 'Society & Culture' => __ ( 'Society & Culture', 'seriously-simple-podcasting' ), |
|
170 | + 'Sports & Recreation' => __ ( 'Sports & Recreation', 'seriously-simple-podcasting' ), |
|
171 | + 'Technology' => __ ( 'Technology', 'seriously-simple-podcasting' ), |
|
172 | + 'TV & Film' => __ ( 'TV & Film', 'seriously-simple-podcasting' ), |
|
173 | 173 | ); |
174 | 174 | |
175 | 175 | // Set up available sub-category options |
176 | 176 | $subcategory_options = array( |
177 | 177 | |
178 | - '' => __( '-- None --', 'seriously-simple-podcasting' ), |
|
179 | - |
|
180 | - 'Design' => array( 'label' => __( 'Design', 'seriously-simple-podcasting' ), 'group' => __( 'Arts', 'seriously-simple-podcasting' ) ), |
|
181 | - 'Fashion & Beauty' => array( 'label' => __( 'Fashion & Beauty', 'seriously-simple-podcasting' ), 'group' => __( 'Arts', 'seriously-simple-podcasting' ) ), |
|
182 | - 'Food' => array( 'label' => __( 'Food', 'seriously-simple-podcasting' ), 'group' => __( 'Arts', 'seriously-simple-podcasting' ) ), |
|
183 | - 'Literature' => array( 'label' => __( 'Literature', 'seriously-simple-podcasting' ), 'group' => __( 'Arts', 'seriously-simple-podcasting' ) ), |
|
184 | - 'Performing Arts' => array( 'label' => __( 'Performing Arts', 'seriously-simple-podcasting' ), 'group' => __( 'Arts', 'seriously-simple-podcasting' ) ), |
|
185 | - 'Visual Arts' => array( 'label' => __( 'Visual Arts', 'seriously-simple-podcasting' ), 'group' => __( 'Arts', 'seriously-simple-podcasting' ) ), |
|
186 | - |
|
187 | - 'Business News' => array( 'label' => __( 'Business News', 'seriously-simple-podcasting' ), 'group' => __( 'Business', 'seriously-simple-podcasting' ) ), |
|
188 | - 'Careers' => array( 'label' => __( 'Careers', 'seriously-simple-podcasting' ), 'group' => __( 'Business', 'seriously-simple-podcasting' ) ), |
|
189 | - 'Investing' => array( 'label' => __( 'Investing', 'seriously-simple-podcasting' ), 'group' => __( 'Business', 'seriously-simple-podcasting' ) ), |
|
190 | - 'Management & Marketing' => array( 'label' => __( 'Management & Marketing', 'seriously-simple-podcasting' ), 'group' => __( 'Business', 'seriously-simple-podcasting' ) ), |
|
191 | - 'Shopping' => array( 'label' => __( 'Shopping', 'seriously-simple-podcasting' ), 'group' => __( 'Business', 'seriously-simple-podcasting' ) ), |
|
192 | - |
|
193 | - 'Education' => array( 'label' => __( 'Education', 'seriously-simple-podcasting' ), 'group' => __( 'Education', 'seriously-simple-podcasting' ) ), |
|
194 | - 'Education Technology' => array( 'label' => __( 'Education Technology', 'seriously-simple-podcasting' ), 'group' => __( 'Education', 'seriously-simple-podcasting' ) ), |
|
195 | - 'Higher Education' => array( 'label' => __( 'Higher Education', 'seriously-simple-podcasting' ), 'group' => __( 'Education', 'seriously-simple-podcasting' ) ), |
|
196 | - 'K-12' => array( 'label' => __( 'K-12', 'seriously-simple-podcasting' ), 'group' => __( 'Education', 'seriously-simple-podcasting' ) ), |
|
197 | - 'Language Courses' => array( 'label' => __( 'Language Courses', 'seriously-simple-podcasting' ), 'group' => __( 'Education', 'seriously-simple-podcasting' ) ), |
|
198 | - 'Training' => array( 'label' => __( 'Training', 'seriously-simple-podcasting' ), 'group' => __( 'Education', 'seriously-simple-podcasting' ) ), |
|
199 | - |
|
200 | - 'Automotive' => array( 'label' => __( 'Automotive', 'seriously-simple-podcasting' ), 'group' => __( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
201 | - 'Aviation' => array( 'label' => __( 'Aviation', 'seriously-simple-podcasting' ), 'group' => __( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
202 | - 'Hobbies' => array( 'label' => __( 'Hobbies', 'seriously-simple-podcasting' ), 'group' => __( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
203 | - 'Other Games' => array( 'label' => __( 'Other Games', 'seriously-simple-podcasting' ), 'group' => __( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
204 | - 'Video Games' => array( 'label' => __( 'Video Games', 'seriously-simple-podcasting' ), 'group' => __( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
205 | - |
|
206 | - 'Local' => array( 'label' => __( 'Local', 'seriously-simple-podcasting' ), 'group' => __( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
207 | - 'National' => array( 'label' => __( 'National', 'seriously-simple-podcasting' ), 'group' => __( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
208 | - 'Non-Profit' => array( 'label' => __( 'Non-Profit', 'seriously-simple-podcasting' ), 'group' => __( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
209 | - 'Regional' => array( 'label' => __( 'Regional', 'seriously-simple-podcasting' ), 'group' => __( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
210 | - |
|
211 | - 'Alternative Health' => array( 'label' => __( 'Alternative Health', 'seriously-simple-podcasting' ), 'group' => __( 'Health', 'seriously-simple-podcasting' ) ), |
|
212 | - 'Fitness & Nutrition' => array( 'label' => __( 'Fitness & Nutrition', 'seriously-simple-podcasting' ), 'group' => __( 'Health', 'seriously-simple-podcasting' ) ), |
|
213 | - 'Self-Help' => array( 'label' => __( 'Self-Help', 'seriously-simple-podcasting' ), 'group' => __( 'Health', 'seriously-simple-podcasting' ) ), |
|
214 | - 'Sexuality' => array( 'label' => __( 'Sexuality', 'seriously-simple-podcasting' ), 'group' => __( 'Health', 'seriously-simple-podcasting' ) ), |
|
215 | - |
|
216 | - 'Buddhism' => array( 'label' => __( 'Buddhism', 'seriously-simple-podcasting' ), 'group' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
217 | - 'Christianity' => array( 'label' => __( 'Christianity', 'seriously-simple-podcasting' ), 'group' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
218 | - 'Hinduism' => array( 'label' => __( 'Hinduism', 'seriously-simple-podcasting' ), 'group' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
219 | - 'Islam' => array( 'label' => __( 'Islam', 'seriously-simple-podcasting' ), 'group' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
220 | - 'Judaism' => array( 'label' => __( 'Judaism', 'seriously-simple-podcasting' ), 'group' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
221 | - 'Other' => array( 'label' => __( 'Other', 'seriously-simple-podcasting' ), 'group' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
222 | - 'Spirituality' => array( 'label' => __( 'Spirituality', 'seriously-simple-podcasting' ), 'group' => __( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
223 | - |
|
224 | - 'Medicine' => array( 'label' => __( 'Medicine', 'seriously-simple-podcasting' ), 'group' => __( 'Science & Medicine', 'seriously-simple-podcasting' ) ), |
|
225 | - 'Natural Sciences' => array( 'label' => __( 'Natural Sciences', 'seriously-simple-podcasting' ), 'group' => __( 'Science & Medicine', 'seriously-simple-podcasting' ) ), |
|
226 | - 'Social Sciences' => array( 'label' => __( 'Social Sciences', 'seriously-simple-podcasting' ), 'group' => __( 'Science & Medicine', 'seriously-simple-podcasting' ) ), |
|
227 | - |
|
228 | - 'History' => array( 'label' => __( 'History', 'seriously-simple-podcasting' ), 'group' => __( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
229 | - 'Personal Journals' => array( 'label' => __( 'Personal Journals', 'seriously-simple-podcasting' ), 'group' => __( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
230 | - 'Philosophy' => array( 'label' => __( 'Philosophy', 'seriously-simple-podcasting' ), 'group' => __( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
231 | - 'Places & Travel' => array( 'label' => __( 'Places & Travel', 'seriously-simple-podcasting' ), 'group' => __( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
232 | - |
|
233 | - 'Amateur' => array( 'label' => __( 'Amateur', 'seriously-simple-podcasting' ), 'group' => __( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
234 | - 'College & High School' => array( 'label' => __( 'College & High School', 'seriously-simple-podcasting' ), 'group' => __( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
235 | - 'Outdoor' => array( 'label' => __( 'Outdoor', 'seriously-simple-podcasting' ), 'group' => __( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
236 | - 'Professional' => array( 'label' => __( 'Professional', 'seriously-simple-podcasting' ), 'group' => __( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
237 | - |
|
238 | - 'Gadgets' => array( 'label' => __( 'Gadgets', 'seriously-simple-podcasting' ), 'group' => __( 'Technology', 'seriously-simple-podcasting' ) ), |
|
239 | - 'Tech News' => array( 'label' => __( 'Tech News', 'seriously-simple-podcasting' ), 'group' => __( 'Technology', 'seriously-simple-podcasting' ) ), |
|
240 | - 'Podcasting' => array( 'label' => __( 'Podcasting', 'seriously-simple-podcasting' ), 'group' => __( 'Technology', 'seriously-simple-podcasting' ) ), |
|
241 | - 'Software How-To' => array( 'label' => __( 'Software How-To', 'seriously-simple-podcasting' ), 'group' => __( 'Technology', 'seriously-simple-podcasting' ) ), |
|
178 | + '' => __ ( '-- None --', 'seriously-simple-podcasting' ), |
|
179 | + |
|
180 | + 'Design' => array( 'label' => __ ( 'Design', 'seriously-simple-podcasting' ), 'group' => __ ( 'Arts', 'seriously-simple-podcasting' ) ), |
|
181 | + 'Fashion & Beauty' => array( 'label' => __ ( 'Fashion & Beauty', 'seriously-simple-podcasting' ), 'group' => __ ( 'Arts', 'seriously-simple-podcasting' ) ), |
|
182 | + 'Food' => array( 'label' => __ ( 'Food', 'seriously-simple-podcasting' ), 'group' => __ ( 'Arts', 'seriously-simple-podcasting' ) ), |
|
183 | + 'Literature' => array( 'label' => __ ( 'Literature', 'seriously-simple-podcasting' ), 'group' => __ ( 'Arts', 'seriously-simple-podcasting' ) ), |
|
184 | + 'Performing Arts' => array( 'label' => __ ( 'Performing Arts', 'seriously-simple-podcasting' ), 'group' => __ ( 'Arts', 'seriously-simple-podcasting' ) ), |
|
185 | + 'Visual Arts' => array( 'label' => __ ( 'Visual Arts', 'seriously-simple-podcasting' ), 'group' => __ ( 'Arts', 'seriously-simple-podcasting' ) ), |
|
186 | + |
|
187 | + 'Business News' => array( 'label' => __ ( 'Business News', 'seriously-simple-podcasting' ), 'group' => __ ( 'Business', 'seriously-simple-podcasting' ) ), |
|
188 | + 'Careers' => array( 'label' => __ ( 'Careers', 'seriously-simple-podcasting' ), 'group' => __ ( 'Business', 'seriously-simple-podcasting' ) ), |
|
189 | + 'Investing' => array( 'label' => __ ( 'Investing', 'seriously-simple-podcasting' ), 'group' => __ ( 'Business', 'seriously-simple-podcasting' ) ), |
|
190 | + 'Management & Marketing' => array( 'label' => __ ( 'Management & Marketing', 'seriously-simple-podcasting' ), 'group' => __ ( 'Business', 'seriously-simple-podcasting' ) ), |
|
191 | + 'Shopping' => array( 'label' => __ ( 'Shopping', 'seriously-simple-podcasting' ), 'group' => __ ( 'Business', 'seriously-simple-podcasting' ) ), |
|
192 | + |
|
193 | + 'Education' => array( 'label' => __ ( 'Education', 'seriously-simple-podcasting' ), 'group' => __ ( 'Education', 'seriously-simple-podcasting' ) ), |
|
194 | + 'Education Technology' => array( 'label' => __ ( 'Education Technology', 'seriously-simple-podcasting' ), 'group' => __ ( 'Education', 'seriously-simple-podcasting' ) ), |
|
195 | + 'Higher Education' => array( 'label' => __ ( 'Higher Education', 'seriously-simple-podcasting' ), 'group' => __ ( 'Education', 'seriously-simple-podcasting' ) ), |
|
196 | + 'K-12' => array( 'label' => __ ( 'K-12', 'seriously-simple-podcasting' ), 'group' => __ ( 'Education', 'seriously-simple-podcasting' ) ), |
|
197 | + 'Language Courses' => array( 'label' => __ ( 'Language Courses', 'seriously-simple-podcasting' ), 'group' => __ ( 'Education', 'seriously-simple-podcasting' ) ), |
|
198 | + 'Training' => array( 'label' => __ ( 'Training', 'seriously-simple-podcasting' ), 'group' => __ ( 'Education', 'seriously-simple-podcasting' ) ), |
|
199 | + |
|
200 | + 'Automotive' => array( 'label' => __ ( 'Automotive', 'seriously-simple-podcasting' ), 'group' => __ ( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
201 | + 'Aviation' => array( 'label' => __ ( 'Aviation', 'seriously-simple-podcasting' ), 'group' => __ ( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
202 | + 'Hobbies' => array( 'label' => __ ( 'Hobbies', 'seriously-simple-podcasting' ), 'group' => __ ( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
203 | + 'Other Games' => array( 'label' => __ ( 'Other Games', 'seriously-simple-podcasting' ), 'group' => __ ( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
204 | + 'Video Games' => array( 'label' => __ ( 'Video Games', 'seriously-simple-podcasting' ), 'group' => __ ( 'Games & Hobbies', 'seriously-simple-podcasting' ) ), |
|
205 | + |
|
206 | + 'Local' => array( 'label' => __ ( 'Local', 'seriously-simple-podcasting' ), 'group' => __ ( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
207 | + 'National' => array( 'label' => __ ( 'National', 'seriously-simple-podcasting' ), 'group' => __ ( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
208 | + 'Non-Profit' => array( 'label' => __ ( 'Non-Profit', 'seriously-simple-podcasting' ), 'group' => __ ( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
209 | + 'Regional' => array( 'label' => __ ( 'Regional', 'seriously-simple-podcasting' ), 'group' => __ ( 'Government & Organizations', 'seriously-simple-podcasting' ) ), |
|
210 | + |
|
211 | + 'Alternative Health' => array( 'label' => __ ( 'Alternative Health', 'seriously-simple-podcasting' ), 'group' => __ ( 'Health', 'seriously-simple-podcasting' ) ), |
|
212 | + 'Fitness & Nutrition' => array( 'label' => __ ( 'Fitness & Nutrition', 'seriously-simple-podcasting' ), 'group' => __ ( 'Health', 'seriously-simple-podcasting' ) ), |
|
213 | + 'Self-Help' => array( 'label' => __ ( 'Self-Help', 'seriously-simple-podcasting' ), 'group' => __ ( 'Health', 'seriously-simple-podcasting' ) ), |
|
214 | + 'Sexuality' => array( 'label' => __ ( 'Sexuality', 'seriously-simple-podcasting' ), 'group' => __ ( 'Health', 'seriously-simple-podcasting' ) ), |
|
215 | + |
|
216 | + 'Buddhism' => array( 'label' => __ ( 'Buddhism', 'seriously-simple-podcasting' ), 'group' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
217 | + 'Christianity' => array( 'label' => __ ( 'Christianity', 'seriously-simple-podcasting' ), 'group' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
218 | + 'Hinduism' => array( 'label' => __ ( 'Hinduism', 'seriously-simple-podcasting' ), 'group' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
219 | + 'Islam' => array( 'label' => __ ( 'Islam', 'seriously-simple-podcasting' ), 'group' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
220 | + 'Judaism' => array( 'label' => __ ( 'Judaism', 'seriously-simple-podcasting' ), 'group' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
221 | + 'Other' => array( 'label' => __ ( 'Other', 'seriously-simple-podcasting' ), 'group' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
222 | + 'Spirituality' => array( 'label' => __ ( 'Spirituality', 'seriously-simple-podcasting' ), 'group' => __ ( 'Religion & Spirituality', 'seriously-simple-podcasting' ) ), |
|
223 | + |
|
224 | + 'Medicine' => array( 'label' => __ ( 'Medicine', 'seriously-simple-podcasting' ), 'group' => __ ( 'Science & Medicine', 'seriously-simple-podcasting' ) ), |
|
225 | + 'Natural Sciences' => array( 'label' => __ ( 'Natural Sciences', 'seriously-simple-podcasting' ), 'group' => __ ( 'Science & Medicine', 'seriously-simple-podcasting' ) ), |
|
226 | + 'Social Sciences' => array( 'label' => __ ( 'Social Sciences', 'seriously-simple-podcasting' ), 'group' => __ ( 'Science & Medicine', 'seriously-simple-podcasting' ) ), |
|
227 | + |
|
228 | + 'History' => array( 'label' => __ ( 'History', 'seriously-simple-podcasting' ), 'group' => __ ( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
229 | + 'Personal Journals' => array( 'label' => __ ( 'Personal Journals', 'seriously-simple-podcasting' ), 'group' => __ ( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
230 | + 'Philosophy' => array( 'label' => __ ( 'Philosophy', 'seriously-simple-podcasting' ), 'group' => __ ( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
231 | + 'Places & Travel' => array( 'label' => __ ( 'Places & Travel', 'seriously-simple-podcasting' ), 'group' => __ ( 'Society & Culture', 'seriously-simple-podcasting' ) ), |
|
232 | + |
|
233 | + 'Amateur' => array( 'label' => __ ( 'Amateur', 'seriously-simple-podcasting' ), 'group' => __ ( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
234 | + 'College & High School' => array( 'label' => __ ( 'College & High School', 'seriously-simple-podcasting' ), 'group' => __ ( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
235 | + 'Outdoor' => array( 'label' => __ ( 'Outdoor', 'seriously-simple-podcasting' ), 'group' => __ ( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
236 | + 'Professional' => array( 'label' => __ ( 'Professional', 'seriously-simple-podcasting' ), 'group' => __ ( 'Sports & Recreation', 'seriously-simple-podcasting' ) ), |
|
237 | + |
|
238 | + 'Gadgets' => array( 'label' => __ ( 'Gadgets', 'seriously-simple-podcasting' ), 'group' => __ ( 'Technology', 'seriously-simple-podcasting' ) ), |
|
239 | + 'Tech News' => array( 'label' => __ ( 'Tech News', 'seriously-simple-podcasting' ), 'group' => __ ( 'Technology', 'seriously-simple-podcasting' ) ), |
|
240 | + 'Podcasting' => array( 'label' => __ ( 'Podcasting', 'seriously-simple-podcasting' ), 'group' => __ ( 'Technology', 'seriously-simple-podcasting' ) ), |
|
241 | + 'Software How-To' => array( 'label' => __ ( 'Software How-To', 'seriously-simple-podcasting' ), 'group' => __ ( 'Technology', 'seriously-simple-podcasting' ) ), |
|
242 | 242 | |
243 | 243 | ); |
244 | 244 | |
245 | 245 | $settings = array(); |
246 | 246 | |
247 | - $settings['general'] = array( |
|
248 | - 'title' => __( 'General', 'seriously-simple-podcasting' ), |
|
249 | - 'description' => __( '', 'seriously-simple-podcasting' ), |
|
247 | + $settings[ 'general' ] = array( |
|
248 | + 'title' => __ ( 'General', 'seriously-simple-podcasting' ), |
|
249 | + 'description' => __ ( '', 'seriously-simple-podcasting' ), |
|
250 | 250 | 'fields' => array( |
251 | 251 | array( |
252 | 252 | 'id' => 'use_post_types', |
253 | - 'label' => __( 'Podcast post types', 'seriously-simple-podcasting' ), |
|
254 | - 'description' => __( 'Use this setting to enable podcast functions on any post type - this will add all podcast posts from the specified types to your podcast feed.', 'seriously-simple-podcasting' ), |
|
253 | + 'label' => __ ( 'Podcast post types', 'seriously-simple-podcasting' ), |
|
254 | + 'description' => __ ( 'Use this setting to enable podcast functions on any post type - this will add all podcast posts from the specified types to your podcast feed.', 'seriously-simple-podcasting' ), |
|
255 | 255 | 'type' => 'checkbox_multi', |
256 | 256 | 'options' => $post_type_options, |
257 | 257 | 'default' => array(), |
258 | 258 | ), |
259 | 259 | array( |
260 | 260 | 'id' => 'include_in_main_query', |
261 | - 'label' => __( 'Include podcast in main blog', 'seriously-simple-podcasting' ), |
|
262 | - 'description' => __( 'This setting may behave differently in each theme, so test it carefully after activation - it will add the \'podcast\' post type to your site\'s main query so that your podcast episodes appear on your home page along with your blog posts.', 'seriously-simple-podcasting' ), |
|
261 | + 'label' => __ ( 'Include podcast in main blog', 'seriously-simple-podcasting' ), |
|
262 | + 'description' => __ ( 'This setting may behave differently in each theme, so test it carefully after activation - it will add the \'podcast\' post type to your site\'s main query so that your podcast episodes appear on your home page along with your blog posts.', 'seriously-simple-podcasting' ), |
|
263 | 263 | 'type' => 'checkbox', |
264 | 264 | 'default' => '', |
265 | 265 | ), |
266 | 266 | array( |
267 | 267 | 'id' => 'player_locations', |
268 | - 'label' => __( 'Media player locations', 'seriously-simple-podcasting' ), |
|
269 | - 'description' => __( 'Select where to show the podcast media player along with the episode data (download link, duration and file size)', 'seriously-simple-podcasting' ), |
|
268 | + 'label' => __ ( 'Media player locations', 'seriously-simple-podcasting' ), |
|
269 | + 'description' => __ ( 'Select where to show the podcast media player along with the episode data (download link, duration and file size)', 'seriously-simple-podcasting' ), |
|
270 | 270 | 'type' => 'checkbox_multi', |
271 | - 'options' => array( 'content' => __( 'Full content', 'seriously-simple-podcasting' ), 'excerpt' => __( 'Excerpt', 'seriously-simple-podcasting' ), 'excerpt_embed' => __( 'oEmbed Excerpt', 'seriously-simple-podcasting' ) ), |
|
271 | + 'options' => array( 'content' => __ ( 'Full content', 'seriously-simple-podcasting' ), 'excerpt' => __ ( 'Excerpt', 'seriously-simple-podcasting' ), 'excerpt_embed' => __ ( 'oEmbed Excerpt', 'seriously-simple-podcasting' ) ), |
|
272 | 272 | 'default' => array(), |
273 | 273 | ), |
274 | 274 | array( |
275 | 275 | 'id' => 'player_content_location', |
276 | - 'label' => __( 'Media player position', 'seriously-simple-podcasting' ), |
|
277 | - 'description' => __( 'Select whether to display the media player above or below the full post content.', 'seriously-simple-podcasting' ), |
|
276 | + 'label' => __ ( 'Media player position', 'seriously-simple-podcasting' ), |
|
277 | + 'description' => __ ( 'Select whether to display the media player above or below the full post content.', 'seriously-simple-podcasting' ), |
|
278 | 278 | 'type' => 'radio', |
279 | - 'options' => array( 'above' => __( 'Above content', 'seriously-simple-podcasting' ), 'below' => __( 'Below content', 'seriously-simple-podcasting' ) ), |
|
279 | + 'options' => array( 'above' => __ ( 'Above content', 'seriously-simple-podcasting' ), 'below' => __ ( 'Below content', 'seriously-simple-podcasting' ) ), |
|
280 | 280 | 'default' => 'above', |
281 | 281 | ), |
282 | 282 | array( |
283 | 283 | 'id' => 'player_content_visibility', |
284 | - 'label' => __( 'Media player visibility', 'seriously-simple-podcasting' ), |
|
285 | - 'description' => __( 'Select whether to display the media player to everybody or only logged in users.', 'seriously-simple-podcasting' ), |
|
284 | + 'label' => __ ( 'Media player visibility', 'seriously-simple-podcasting' ), |
|
285 | + 'description' => __ ( 'Select whether to display the media player to everybody or only logged in users.', 'seriously-simple-podcasting' ), |
|
286 | 286 | 'type' => 'radio', |
287 | - 'options' => array( 'all' => __( 'Everybody', 'seriously-simple-podcasting' ), 'membersonly' => __( 'Only logged in users', 'seriously-simple-podcasting' ) ), |
|
287 | + 'options' => array( 'all' => __ ( 'Everybody', 'seriously-simple-podcasting' ), 'membersonly' => __ ( 'Only logged in users', 'seriously-simple-podcasting' ) ), |
|
288 | 288 | 'default' => 'all', |
289 | 289 | ), |
290 | 290 | ), |
291 | 291 | ); |
292 | 292 | |
293 | - $settings['feed-details'] = array( |
|
294 | - 'title' => __( 'Feed details', 'seriously-simple-podcasting' ), |
|
295 | - 'description' => sprintf( __( 'This data will be used in the feed for your podcast so your listeners will know more about it before they subscribe.%1$sAll of these fields are optional, but it is recommended that you fill in as many of them as possible. Blank fields will use the assigned defaults in the feed.%2$s', 'seriously-simple-podcasting' ), '<br/><em>', '</em>' ), |
|
293 | + $settings[ 'feed-details' ] = array( |
|
294 | + 'title' => __ ( 'Feed details', 'seriously-simple-podcasting' ), |
|
295 | + 'description' => sprintf ( __ ( 'This data will be used in the feed for your podcast so your listeners will know more about it before they subscribe.%1$sAll of these fields are optional, but it is recommended that you fill in as many of them as possible. Blank fields will use the assigned defaults in the feed.%2$s', 'seriously-simple-podcasting' ), '<br/><em>', '</em>' ), |
|
296 | 296 | 'fields' => array( |
297 | 297 | array( |
298 | 298 | 'id' => 'data_title', |
299 | - 'label' => __( 'Title' , 'seriously-simple-podcasting' ), |
|
300 | - 'description' => __( 'Your podcast title.', 'seriously-simple-podcasting' ), |
|
299 | + 'label' => __ ( 'Title', 'seriously-simple-podcasting' ), |
|
300 | + 'description' => __ ( 'Your podcast title.', 'seriously-simple-podcasting' ), |
|
301 | 301 | 'type' => 'text', |
302 | - 'default' => get_bloginfo( 'name' ), |
|
303 | - 'placeholder' => get_bloginfo( 'name' ), |
|
302 | + 'default' => get_bloginfo ( 'name' ), |
|
303 | + 'placeholder' => get_bloginfo ( 'name' ), |
|
304 | 304 | 'class' => 'large-text', |
305 | 305 | 'callback' => 'wp_strip_all_tags', |
306 | 306 | ), |
307 | 307 | array( |
308 | 308 | 'id' => 'data_subtitle', |
309 | - 'label' => __( 'Subtitle' , 'seriously-simple-podcasting' ), |
|
310 | - 'description' => __( 'Your podcast subtitle.', 'seriously-simple-podcasting' ), |
|
309 | + 'label' => __ ( 'Subtitle', 'seriously-simple-podcasting' ), |
|
310 | + 'description' => __ ( 'Your podcast subtitle.', 'seriously-simple-podcasting' ), |
|
311 | 311 | 'type' => 'text', |
312 | - 'default' => get_bloginfo( 'description' ), |
|
313 | - 'placeholder' => get_bloginfo( 'description' ), |
|
312 | + 'default' => get_bloginfo ( 'description' ), |
|
313 | + 'placeholder' => get_bloginfo ( 'description' ), |
|
314 | 314 | 'class' => 'large-text', |
315 | 315 | 'callback' => 'wp_strip_all_tags', |
316 | 316 | ), |
317 | 317 | array( |
318 | 318 | 'id' => 'data_author', |
319 | - 'label' => __( 'Author' , 'seriously-simple-podcasting' ), |
|
320 | - 'description' => __( 'Your podcast author.', 'seriously-simple-podcasting' ), |
|
319 | + 'label' => __ ( 'Author', 'seriously-simple-podcasting' ), |
|
320 | + 'description' => __ ( 'Your podcast author.', 'seriously-simple-podcasting' ), |
|
321 | 321 | 'type' => 'text', |
322 | - 'default' => get_bloginfo( 'name' ), |
|
323 | - 'placeholder' => get_bloginfo( 'name' ), |
|
322 | + 'default' => get_bloginfo ( 'name' ), |
|
323 | + 'placeholder' => get_bloginfo ( 'name' ), |
|
324 | 324 | 'class' => 'large-text', |
325 | 325 | 'callback' => 'wp_strip_all_tags', |
326 | 326 | ), |
327 | 327 | array( |
328 | 328 | 'id' => 'data_category', |
329 | - 'label' => __( 'Primary Category' , 'seriously-simple-podcasting' ), |
|
330 | - 'description' => __( 'Your podcast\'s primary category.', 'seriously-simple-podcasting' ), |
|
329 | + 'label' => __ ( 'Primary Category', 'seriously-simple-podcasting' ), |
|
330 | + 'description' => __ ( 'Your podcast\'s primary category.', 'seriously-simple-podcasting' ), |
|
331 | 331 | 'type' => 'select', |
332 | 332 | 'options' => $category_options, |
333 | 333 | 'default' => '', |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | ), |
336 | 336 | array( |
337 | 337 | 'id' => 'data_subcategory', |
338 | - 'label' => __( 'Primary Sub-Category' , 'seriously-simple-podcasting' ), |
|
339 | - 'description' => __( 'Your podcast\'s primary sub-category (if available) - must be a sub-category of the primary category selected above.', 'seriously-simple-podcasting' ), |
|
338 | + 'label' => __ ( 'Primary Sub-Category', 'seriously-simple-podcasting' ), |
|
339 | + 'description' => __ ( 'Your podcast\'s primary sub-category (if available) - must be a sub-category of the primary category selected above.', 'seriously-simple-podcasting' ), |
|
340 | 340 | 'type' => 'select', |
341 | 341 | 'options' => $subcategory_options, |
342 | 342 | 'default' => '', |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | ), |
345 | 345 | array( |
346 | 346 | 'id' => 'data_category2', |
347 | - 'label' => __( 'Secondary Category' , 'seriously-simple-podcasting' ), |
|
348 | - 'description' => __( 'Your podcast\'s secondary category.', 'seriously-simple-podcasting' ), |
|
347 | + 'label' => __ ( 'Secondary Category', 'seriously-simple-podcasting' ), |
|
348 | + 'description' => __ ( 'Your podcast\'s secondary category.', 'seriously-simple-podcasting' ), |
|
349 | 349 | 'type' => 'select', |
350 | 350 | 'options' => $category_options, |
351 | 351 | 'default' => '', |
@@ -353,8 +353,8 @@ discard block |
||
353 | 353 | ), |
354 | 354 | array( |
355 | 355 | 'id' => 'data_subcategory2', |
356 | - 'label' => __( 'Secondary Sub-Category' , 'seriously-simple-podcasting' ), |
|
357 | - 'description' => __( 'Your podcast\'s secondary sub-category (if available) - must be a sub-category of the secondary category selected above.', 'seriously-simple-podcasting' ), |
|
356 | + 'label' => __ ( 'Secondary Sub-Category', 'seriously-simple-podcasting' ), |
|
357 | + 'description' => __ ( 'Your podcast\'s secondary sub-category (if available) - must be a sub-category of the secondary category selected above.', 'seriously-simple-podcasting' ), |
|
358 | 358 | 'type' => 'select', |
359 | 359 | 'options' => $subcategory_options, |
360 | 360 | 'default' => '', |
@@ -362,8 +362,8 @@ discard block |
||
362 | 362 | ), |
363 | 363 | array( |
364 | 364 | 'id' => 'data_category3', |
365 | - 'label' => __( 'Tertiary Category' , 'seriously-simple-podcasting' ), |
|
366 | - 'description' => __( 'Your podcast\'s tertiary category.', 'seriously-simple-podcasting' ), |
|
365 | + 'label' => __ ( 'Tertiary Category', 'seriously-simple-podcasting' ), |
|
366 | + 'description' => __ ( 'Your podcast\'s tertiary category.', 'seriously-simple-podcasting' ), |
|
367 | 367 | 'type' => 'select', |
368 | 368 | 'options' => $category_options, |
369 | 369 | 'default' => '', |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | ), |
372 | 372 | array( |
373 | 373 | 'id' => 'data_subcategory3', |
374 | - 'label' => __( 'Tertiary Sub-Category' , 'seriously-simple-podcasting' ), |
|
375 | - 'description' => __( 'Your podcast\'s tertiary sub-category (if available) - must be a sub-category of the tertiary category selected above.', 'seriously-simple-podcasting' ), |
|
374 | + 'label' => __ ( 'Tertiary Sub-Category', 'seriously-simple-podcasting' ), |
|
375 | + 'description' => __ ( 'Your podcast\'s tertiary sub-category (if available) - must be a sub-category of the tertiary category selected above.', 'seriously-simple-podcasting' ), |
|
376 | 376 | 'type' => 'select', |
377 | 377 | 'options' => $subcategory_options, |
378 | 378 | 'default' => '', |
@@ -380,18 +380,18 @@ discard block |
||
380 | 380 | ), |
381 | 381 | array( |
382 | 382 | 'id' => 'data_description', |
383 | - 'label' => __( 'Description/Summary' , 'seriously-simple-podcasting' ), |
|
384 | - 'description' => __( 'A description/summary of your podcast - no HTML allowed.', 'seriously-simple-podcasting' ), |
|
383 | + 'label' => __ ( 'Description/Summary', 'seriously-simple-podcasting' ), |
|
384 | + 'description' => __ ( 'A description/summary of your podcast - no HTML allowed.', 'seriously-simple-podcasting' ), |
|
385 | 385 | 'type' => 'textarea', |
386 | - 'default' => get_bloginfo( 'description' ), |
|
387 | - 'placeholder' => get_bloginfo( 'description' ), |
|
386 | + 'default' => get_bloginfo ( 'description' ), |
|
387 | + 'placeholder' => get_bloginfo ( 'description' ), |
|
388 | 388 | 'callback' => 'wp_strip_all_tags', |
389 | 389 | 'class' => 'large-text', |
390 | 390 | ), |
391 | 391 | array( |
392 | 392 | 'id' => 'data_image', |
393 | - 'label' => __( 'Cover Image' , 'seriously-simple-podcasting' ), |
|
394 | - 'description' => __( 'Your podcast cover image - must have a minimum size of 1400x1400 px.', 'seriously-simple-podcasting' ), |
|
393 | + 'label' => __ ( 'Cover Image', 'seriously-simple-podcasting' ), |
|
394 | + 'description' => __ ( 'Your podcast cover image - must have a minimum size of 1400x1400 px.', 'seriously-simple-podcasting' ), |
|
395 | 395 | 'type' => 'image', |
396 | 396 | 'default' => '', |
397 | 397 | 'placeholder' => '', |
@@ -399,182 +399,182 @@ discard block |
||
399 | 399 | ), |
400 | 400 | array( |
401 | 401 | 'id' => 'data_owner_name', |
402 | - 'label' => __( 'Owner name' , 'seriously-simple-podcasting' ), |
|
403 | - 'description' => __( 'Podcast owner\'s name.', 'seriously-simple-podcasting' ), |
|
402 | + 'label' => __ ( 'Owner name', 'seriously-simple-podcasting' ), |
|
403 | + 'description' => __ ( 'Podcast owner\'s name.', 'seriously-simple-podcasting' ), |
|
404 | 404 | 'type' => 'text', |
405 | - 'default' => get_bloginfo( 'name' ), |
|
406 | - 'placeholder' => get_bloginfo( 'name' ), |
|
405 | + 'default' => get_bloginfo ( 'name' ), |
|
406 | + 'placeholder' => get_bloginfo ( 'name' ), |
|
407 | 407 | 'class' => 'large-text', |
408 | 408 | 'callback' => 'wp_strip_all_tags', |
409 | 409 | ), |
410 | 410 | array( |
411 | 411 | 'id' => 'data_owner_email', |
412 | - 'label' => __( 'Owner email address' , 'seriously-simple-podcasting' ), |
|
413 | - 'description' => __( 'Podcast owner\'s email address.', 'seriously-simple-podcasting' ), |
|
412 | + 'label' => __ ( 'Owner email address', 'seriously-simple-podcasting' ), |
|
413 | + 'description' => __ ( 'Podcast owner\'s email address.', 'seriously-simple-podcasting' ), |
|
414 | 414 | 'type' => 'text', |
415 | - 'default' => get_bloginfo( 'admin_email' ), |
|
416 | - 'placeholder' => get_bloginfo( 'admin_email' ), |
|
415 | + 'default' => get_bloginfo ( 'admin_email' ), |
|
416 | + 'placeholder' => get_bloginfo ( 'admin_email' ), |
|
417 | 417 | 'class' => 'large-text', |
418 | 418 | 'callback' => 'wp_strip_all_tags', |
419 | 419 | ), |
420 | 420 | array( |
421 | 421 | 'id' => 'data_language', |
422 | - 'label' => __( 'Language' , 'seriously-simple-podcasting' ), |
|
423 | - 'description' => sprintf( __( 'Your podcast\'s language in %1$sISO-639-1 format%2$s.', 'seriously-simple-podcasting' ), '<a href="' . esc_url( 'http://www.loc.gov/standards/iso639-2/php/code_list.php' ) . '" target="' . wp_strip_all_tags( '_blank' ) . '">', '</a>' ), |
|
422 | + 'label' => __ ( 'Language', 'seriously-simple-podcasting' ), |
|
423 | + 'description' => sprintf ( __ ( 'Your podcast\'s language in %1$sISO-639-1 format%2$s.', 'seriously-simple-podcasting' ), '<a href="'.esc_url ( 'http://www.loc.gov/standards/iso639-2/php/code_list.php' ).'" target="'.wp_strip_all_tags ( '_blank' ).'">', '</a>' ), |
|
424 | 424 | 'type' => 'text', |
425 | - 'default' => get_bloginfo( 'language' ), |
|
426 | - 'placeholder' => get_bloginfo( 'language' ), |
|
425 | + 'default' => get_bloginfo ( 'language' ), |
|
426 | + 'placeholder' => get_bloginfo ( 'language' ), |
|
427 | 427 | 'class' => 'all-options', |
428 | 428 | 'callback' => 'wp_strip_all_tags', |
429 | 429 | ), |
430 | 430 | array( |
431 | 431 | 'id' => 'data_copyright', |
432 | - 'label' => __( 'Copyright' , 'seriously-simple-podcasting' ), |
|
433 | - 'description' => __( 'Copyright line for your podcast.', 'seriously-simple-podcasting' ), |
|
432 | + 'label' => __ ( 'Copyright', 'seriously-simple-podcasting' ), |
|
433 | + 'description' => __ ( 'Copyright line for your podcast.', 'seriously-simple-podcasting' ), |
|
434 | 434 | 'type' => 'text', |
435 | - 'default' => '© ' . date( 'Y' ) . ' ' . get_bloginfo( 'name' ), |
|
436 | - 'placeholder' => '© ' . date( 'Y' ) . ' ' . get_bloginfo( 'name' ), |
|
435 | + 'default' => '© '.date ( 'Y' ).' '.get_bloginfo ( 'name' ), |
|
436 | + 'placeholder' => '© '.date ( 'Y' ).' '.get_bloginfo ( 'name' ), |
|
437 | 437 | 'class' => 'large-text', |
438 | 438 | 'callback' => 'wp_strip_all_tags', |
439 | 439 | ), |
440 | 440 | array( |
441 | 441 | 'id' => 'explicit', |
442 | - 'label' => __( 'Explicit', 'seriously-simple-podcasting' ), |
|
443 | - 'description' => __( 'Mark if your podcast is explicit or not.', 'seriously-simple-podcasting' ), |
|
442 | + 'label' => __ ( 'Explicit', 'seriously-simple-podcasting' ), |
|
443 | + 'description' => __ ( 'Mark if your podcast is explicit or not.', 'seriously-simple-podcasting' ), |
|
444 | 444 | 'type' => 'checkbox', |
445 | 445 | 'default' => '', |
446 | 446 | 'callback' => 'wp_strip_all_tags', |
447 | 447 | ), |
448 | 448 | array( |
449 | 449 | 'id' => 'complete', |
450 | - 'label' => __( 'Complete', 'seriously-simple-podcasting' ), |
|
451 | - 'description' => __( 'Mark if this podcast is complete or not. Only do this if no more episodes are going to be added to this feed.', 'seriously-simple-podcasting' ), |
|
450 | + 'label' => __ ( 'Complete', 'seriously-simple-podcasting' ), |
|
451 | + 'description' => __ ( 'Mark if this podcast is complete or not. Only do this if no more episodes are going to be added to this feed.', 'seriously-simple-podcasting' ), |
|
452 | 452 | 'type' => 'checkbox', |
453 | 453 | 'default' => '', |
454 | 454 | 'callback' => 'wp_strip_all_tags', |
455 | 455 | ), |
456 | 456 | array( |
457 | 457 | 'id' => 'redirect_feed', |
458 | - 'label' => __( 'Redirect this feed to new URL', 'seriously-simple-podcasting' ), |
|
459 | - 'description' => sprintf( __( 'Redirect your feed to a new URL (specified below).', 'seriously-simple-podcasting' ) , '<br/>' ), |
|
458 | + 'label' => __ ( 'Redirect this feed to new URL', 'seriously-simple-podcasting' ), |
|
459 | + 'description' => sprintf ( __ ( 'Redirect your feed to a new URL (specified below).', 'seriously-simple-podcasting' ), '<br/>' ), |
|
460 | 460 | 'type' => 'checkbox', |
461 | 461 | 'default' => '', |
462 | 462 | 'callback' => 'wp_strip_all_tags', |
463 | 463 | ), |
464 | 464 | array( |
465 | 465 | 'id' => 'new_feed_url', |
466 | - 'label' => __( 'New podcast feed URL', 'seriously-simple-podcasting' ), |
|
467 | - 'description' => __( 'Your podcast feed\'s new URL.', 'seriously-simple-podcasting' ), |
|
466 | + 'label' => __ ( 'New podcast feed URL', 'seriously-simple-podcasting' ), |
|
467 | + 'description' => __ ( 'Your podcast feed\'s new URL.', 'seriously-simple-podcasting' ), |
|
468 | 468 | 'type' => 'text', |
469 | 469 | 'default' => '', |
470 | - 'placeholder' => __( 'New feed URL', 'seriously-simple-podcasting' ), |
|
470 | + 'placeholder' => __ ( 'New feed URL', 'seriously-simple-podcasting' ), |
|
471 | 471 | 'callback' => 'esc_url_raw', |
472 | 472 | 'class' => 'regular-text', |
473 | 473 | ), |
474 | 474 | ) |
475 | 475 | ); |
476 | 476 | |
477 | - $settings['security'] = array( |
|
478 | - 'title' => __( 'Security', 'seriously-simple-podcasting' ), |
|
479 | - 'description' => __( 'Change these settings to ensure that your podcast feed remains private. This will block feed readers (including iTunes) from accessing your feed.', 'seriously-simple-podcasting' ), |
|
477 | + $settings[ 'security' ] = array( |
|
478 | + 'title' => __ ( 'Security', 'seriously-simple-podcasting' ), |
|
479 | + 'description' => __ ( 'Change these settings to ensure that your podcast feed remains private. This will block feed readers (including iTunes) from accessing your feed.', 'seriously-simple-podcasting' ), |
|
480 | 480 | 'fields' => array( |
481 | 481 | array( |
482 | 482 | 'id' => 'protect', |
483 | - 'label' => __( 'Password protect your podcast feed', 'seriously-simple-podcasting' ), |
|
484 | - 'description' => __( 'Mark if you would like to password protect your podcast feed - you can set the username and password below. This will block all feed readers (including iTunes) from accessing your feed.', 'seriously-simple-podcasting' ), |
|
483 | + 'label' => __ ( 'Password protect your podcast feed', 'seriously-simple-podcasting' ), |
|
484 | + 'description' => __ ( 'Mark if you would like to password protect your podcast feed - you can set the username and password below. This will block all feed readers (including iTunes) from accessing your feed.', 'seriously-simple-podcasting' ), |
|
485 | 485 | 'type' => 'checkbox', |
486 | 486 | 'default' => '', |
487 | 487 | 'callback' => 'wp_strip_all_tags', |
488 | 488 | ), |
489 | 489 | array( |
490 | 490 | 'id' => 'protection_username', |
491 | - 'label' => __( 'Username' , 'seriously-simple-podcasting' ), |
|
492 | - 'description' => __( 'Username for your podcast feed.', 'seriously-simple-podcasting' ), |
|
491 | + 'label' => __ ( 'Username', 'seriously-simple-podcasting' ), |
|
492 | + 'description' => __ ( 'Username for your podcast feed.', 'seriously-simple-podcasting' ), |
|
493 | 493 | 'type' => 'text', |
494 | 494 | 'default' => '', |
495 | - 'placeholder' => __( 'Feed username', 'seriously-simple-podcasting' ), |
|
495 | + 'placeholder' => __ ( 'Feed username', 'seriously-simple-podcasting' ), |
|
496 | 496 | 'class' => 'regular-text', |
497 | 497 | 'callback' => 'wp_strip_all_tags', |
498 | 498 | ), |
499 | 499 | array( |
500 | 500 | 'id' => 'protection_password', |
501 | - 'label' => __( 'Password' , 'seriously-simple-podcasting' ), |
|
502 | - 'description' => __( 'Password for your podcast feed. Once saved, the password is encoded and secured so it will not be visible on this page again.', 'seriously-simple-podcasting' ), |
|
501 | + 'label' => __ ( 'Password', 'seriously-simple-podcasting' ), |
|
502 | + 'description' => __ ( 'Password for your podcast feed. Once saved, the password is encoded and secured so it will not be visible on this page again.', 'seriously-simple-podcasting' ), |
|
503 | 503 | 'type' => 'text_secret', |
504 | 504 | 'default' => '', |
505 | - 'placeholder' => __( 'Feed password', 'seriously-simple-podcasting' ), |
|
505 | + 'placeholder' => __ ( 'Feed password', 'seriously-simple-podcasting' ), |
|
506 | 506 | 'callback' => array( $this, 'encode_password' ), |
507 | 507 | 'class' => 'regular-text', |
508 | 508 | ), |
509 | 509 | array( |
510 | 510 | 'id' => 'protection_no_access_message', |
511 | - 'label' => __( 'No access message' , 'seriously-simple-podcasting' ), |
|
512 | - 'description' => __( 'This message will be displayed to people who are not allowed access to your podcast feed. Limited HTML allowed.', 'seriously-simple-podcasting' ), |
|
511 | + 'label' => __ ( 'No access message', 'seriously-simple-podcasting' ), |
|
512 | + 'description' => __ ( 'This message will be displayed to people who are not allowed access to your podcast feed. Limited HTML allowed.', 'seriously-simple-podcasting' ), |
|
513 | 513 | 'type' => 'textarea', |
514 | - 'default' => __( 'You are not permitted to view this podcast feed.', 'seriously-simple-podcasting' ), |
|
515 | - 'placeholder' => __( 'Message displayed to users who do not have access to the podcast feed', 'seriously-simple-podcasting' ), |
|
514 | + 'default' => __ ( 'You are not permitted to view this podcast feed.', 'seriously-simple-podcasting' ), |
|
515 | + 'placeholder' => __ ( 'Message displayed to users who do not have access to the podcast feed', 'seriously-simple-podcasting' ), |
|
516 | 516 | 'callback' => array( $this, 'validate_message' ), |
517 | 517 | 'class' => 'large-text', |
518 | 518 | ), |
519 | 519 | ) |
520 | 520 | ); |
521 | 521 | |
522 | - $settings['redirection'] = array( |
|
523 | - 'title' => __( 'Redirection', 'seriously-simple-podcasting' ), |
|
524 | - 'description' => __( 'Use these settings to safely move your podcast to a different location. Only do this once your new podcast is setup and active.', 'seriously-simple-podcasting' ), |
|
522 | + $settings[ 'redirection' ] = array( |
|
523 | + 'title' => __ ( 'Redirection', 'seriously-simple-podcasting' ), |
|
524 | + 'description' => __ ( 'Use these settings to safely move your podcast to a different location. Only do this once your new podcast is setup and active.', 'seriously-simple-podcasting' ), |
|
525 | 525 | 'fields' => array( |
526 | 526 | array( |
527 | 527 | 'id' => 'redirect_feed', |
528 | - 'label' => __( 'Redirect podcast feed to new URL', 'seriously-simple-podcasting' ), |
|
529 | - 'description' => sprintf( __( 'Redirect your feed to a new URL (specified below).%1$sThis will inform all podcasting services that your podcast has moved and 48 hours after you have saved this option it will permanently redirect your feed to the new URL.', 'seriously-simple-podcasting' ) , '<br/>' ), |
|
528 | + 'label' => __ ( 'Redirect podcast feed to new URL', 'seriously-simple-podcasting' ), |
|
529 | + 'description' => sprintf ( __ ( 'Redirect your feed to a new URL (specified below).%1$sThis will inform all podcasting services that your podcast has moved and 48 hours after you have saved this option it will permanently redirect your feed to the new URL.', 'seriously-simple-podcasting' ), '<br/>' ), |
|
530 | 530 | 'type' => 'checkbox', |
531 | 531 | 'default' => '', |
532 | 532 | 'callback' => 'wp_strip_all_tags', |
533 | 533 | ), |
534 | 534 | array( |
535 | 535 | 'id' => 'new_feed_url', |
536 | - 'label' => __( 'New podcast feed URL', 'seriously-simple-podcasting' ), |
|
537 | - 'description' => __( 'Your podcast feed\'s new URL.', 'seriously-simple-podcasting' ), |
|
536 | + 'label' => __ ( 'New podcast feed URL', 'seriously-simple-podcasting' ), |
|
537 | + 'description' => __ ( 'Your podcast feed\'s new URL.', 'seriously-simple-podcasting' ), |
|
538 | 538 | 'type' => 'text', |
539 | 539 | 'default' => '', |
540 | - 'placeholder' => __( 'New feed URL', 'seriously-simple-podcasting' ), |
|
540 | + 'placeholder' => __ ( 'New feed URL', 'seriously-simple-podcasting' ), |
|
541 | 541 | 'callback' => 'esc_url_raw', |
542 | 542 | 'class' => 'regular-text', |
543 | 543 | ), |
544 | 544 | ) |
545 | 545 | ); |
546 | 546 | |
547 | - $settings['publishing'] = array( |
|
548 | - 'title' => __( 'Publishing' , 'seriously-simple-podcasting' ), |
|
549 | - 'description' => __( 'Use these URLs to share and publish your podcast feed. These URLs will work with any podcasting service (including iTunes).' , 'seriously-simple-podcasting' ), |
|
547 | + $settings[ 'publishing' ] = array( |
|
548 | + 'title' => __ ( 'Publishing', 'seriously-simple-podcasting' ), |
|
549 | + 'description' => __ ( 'Use these URLs to share and publish your podcast feed. These URLs will work with any podcasting service (including iTunes).', 'seriously-simple-podcasting' ), |
|
550 | 550 | 'fields' => array( |
551 | 551 | array( |
552 | 552 | 'id' => 'feed_url', |
553 | - 'label' => __( 'External feed URL', 'seriously-simple-podcasting' ), |
|
554 | - 'description' => __( 'If you are syndicating your podcast using a third-party service (like Feedburner) you can insert the URL here, otherwise this must be left blank.' , 'seriously-simple-podcasting' ), |
|
553 | + 'label' => __ ( 'External feed URL', 'seriously-simple-podcasting' ), |
|
554 | + 'description' => __ ( 'If you are syndicating your podcast using a third-party service (like Feedburner) you can insert the URL here, otherwise this must be left blank.', 'seriously-simple-podcasting' ), |
|
555 | 555 | 'type' => 'text', |
556 | 556 | 'default' => '', |
557 | - 'placeholder' => __( 'External feed URL', 'seriously-simple-podcasting' ), |
|
557 | + 'placeholder' => __ ( 'External feed URL', 'seriously-simple-podcasting' ), |
|
558 | 558 | 'callback' => 'esc_url_raw', |
559 | 559 | 'class' => 'regular-text', |
560 | 560 | ), |
561 | 561 | array( |
562 | 562 | 'id' => 'feed_link', |
563 | - 'label' => __( 'Complete feed', 'seriously-simple-podcasting' ), |
|
563 | + 'label' => __ ( 'Complete feed', 'seriously-simple-podcasting' ), |
|
564 | 564 | 'description' => '', |
565 | 565 | 'type' => 'feed_link', |
566 | 566 | 'callback' => 'esc_url_raw', |
567 | 567 | ), |
568 | 568 | array( |
569 | 569 | 'id' => 'feed_link_series', |
570 | - 'label' => __( 'Feed for a specific series', 'seriously-simple-podcasting' ), |
|
570 | + 'label' => __ ( 'Feed for a specific series', 'seriously-simple-podcasting' ), |
|
571 | 571 | 'description' => '', |
572 | 572 | 'type' => 'feed_link_series', |
573 | 573 | 'callback' => 'esc_url_raw', |
574 | 574 | ), |
575 | 575 | array( |
576 | 576 | 'id' => 'podcast_url', |
577 | - 'label' => __( 'Podcast page', 'seriously-simple-podcasting' ), |
|
577 | + 'label' => __ ( 'Podcast page', 'seriously-simple-podcasting' ), |
|
578 | 578 | 'description' => '', |
579 | 579 | 'type' => 'podcast_url', |
580 | 580 | 'callback' => 'esc_url_raw', |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | ) |
583 | 583 | ); |
584 | 584 | |
585 | - $settings = apply_filters( 'ssp_settings_fields', $settings ); |
|
585 | + $settings = apply_filters ( 'ssp_settings_fields', $settings ); |
|
586 | 586 | |
587 | 587 | return $settings; |
588 | 588 | } |
@@ -592,15 +592,15 @@ discard block |
||
592 | 592 | * @return void |
593 | 593 | */ |
594 | 594 | public function register_settings() { |
595 | - if ( is_array( $this->settings ) ) { |
|
595 | + if ( is_array ( $this->settings ) ) { |
|
596 | 596 | |
597 | 597 | // Check posted/selected tab |
598 | 598 | $current_section = 'general'; |
599 | - if ( isset( $_POST['tab'] ) && $_POST['tab'] ) { |
|
600 | - $current_section = $_POST['tab']; |
|
599 | + if ( isset( $_POST[ 'tab' ] ) && $_POST[ 'tab' ] ) { |
|
600 | + $current_section = $_POST[ 'tab' ]; |
|
601 | 601 | } else { |
602 | - if ( isset( $_GET['tab'] ) && $_GET['tab'] ) { |
|
603 | - $current_section = $_GET['tab']; |
|
602 | + if ( isset( $_GET[ 'tab' ] ) && $_GET[ 'tab' ] ) { |
|
603 | + $current_section = $_GET[ 'tab' ]; |
|
604 | 604 | } |
605 | 605 | } |
606 | 606 | |
@@ -615,81 +615,81 @@ discard block |
||
615 | 615 | $series_id = 0; |
616 | 616 | if ( 'feed-details' == $section ) { |
617 | 617 | |
618 | - if ( isset( $_REQUEST['feed-series'] ) && $_REQUEST['feed-series'] && 'default' != $_REQUEST['feed-series'] ) { |
|
618 | + if ( isset( $_REQUEST[ 'feed-series' ] ) && $_REQUEST[ 'feed-series' ] && 'default' != $_REQUEST[ 'feed-series' ] ) { |
|
619 | 619 | |
620 | 620 | // Get selected series |
621 | - $series = get_term_by( 'slug', esc_attr( $_REQUEST['feed-series'] ), 'series' ); |
|
621 | + $series = get_term_by ( 'slug', esc_attr ( $_REQUEST[ 'feed-series' ] ), 'series' ); |
|
622 | 622 | |
623 | 623 | // Store series ID for later use |
624 | 624 | $series_id = $series->term_id; |
625 | 625 | |
626 | 626 | // Append series name to section title |
627 | 627 | if ( $series ) { |
628 | - $title_tail = ': ' . $series->name; |
|
628 | + $title_tail = ': '.$series->name; |
|
629 | 629 | } |
630 | 630 | } |
631 | 631 | } |
632 | 632 | |
633 | - $section_title = $data['title'] . $title_tail; |
|
633 | + $section_title = $data[ 'title' ].$title_tail; |
|
634 | 634 | |
635 | 635 | // Add section to page |
636 | - add_settings_section( $section, $section_title, array( $this, 'settings_section' ), 'ss_podcasting' ); |
|
636 | + add_settings_section ( $section, $section_title, array( $this, 'settings_section' ), 'ss_podcasting' ); |
|
637 | 637 | |
638 | - foreach ( $data['fields'] as $field ) { |
|
638 | + foreach ( $data[ 'fields' ] as $field ) { |
|
639 | 639 | |
640 | 640 | // Validation callback for field |
641 | 641 | $validation = ''; |
642 | - if ( isset( $field['callback'] ) ) { |
|
643 | - $validation = $field['callback']; |
|
642 | + if ( isset( $field[ 'callback' ] ) ) { |
|
643 | + $validation = $field[ 'callback' ]; |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | // Get field option name |
647 | - $option_name = $this->settings_base . $field['id']; |
|
647 | + $option_name = $this->settings_base.$field[ 'id' ]; |
|
648 | 648 | |
649 | 649 | // Append series ID if selected |
650 | 650 | if ( $series_id ) { |
651 | - $option_name .= '_' . $series_id; |
|
651 | + $option_name .= '_'.$series_id; |
|
652 | 652 | } |
653 | 653 | |
654 | 654 | // Register setting |
655 | - register_setting( 'ss_podcasting', $option_name, $validation ); |
|
655 | + register_setting ( 'ss_podcasting', $option_name, $validation ); |
|
656 | 656 | |
657 | 657 | // Add field to page |
658 | - add_settings_field( $field['id'], $field['label'], array( $this, 'display_field' ), 'ss_podcasting', $section, array( 'field' => $field, 'prefix' => $this->settings_base, 'feed-series' => $series_id ) ); |
|
658 | + add_settings_field ( $field[ 'id' ], $field[ 'label' ], array( $this, 'display_field' ), 'ss_podcasting', $section, array( 'field' => $field, 'prefix' => $this->settings_base, 'feed-series' => $series_id ) ); |
|
659 | 659 | } |
660 | 660 | } |
661 | 661 | } |
662 | 662 | } |
663 | 663 | |
664 | 664 | public function settings_section( $section ) { |
665 | - $html = '<p>' . $this->settings[ $section['id'] ]['description'] . '</p>' . "\n"; |
|
665 | + $html = '<p>'.$this->settings[ $section[ 'id' ] ][ 'description' ].'</p>'."\n"; |
|
666 | 666 | |
667 | - if( 'feed-details' == $section['id'] ) { |
|
667 | + if ( 'feed-details' == $section[ 'id' ] ) { |
|
668 | 668 | |
669 | 669 | $feed_series = 'default'; |
670 | - if( isset( $_GET['feed-series'] ) ) { |
|
671 | - $feed_series = esc_attr( $_GET['feed-series'] ); |
|
670 | + if ( isset( $_GET[ 'feed-series' ] ) ) { |
|
671 | + $feed_series = esc_attr ( $_GET[ 'feed-series' ] ); |
|
672 | 672 | } |
673 | 673 | |
674 | - $permalink_structure = get_option( 'permalink_structure' ); |
|
674 | + $permalink_structure = get_option ( 'permalink_structure' ); |
|
675 | 675 | |
676 | 676 | if ( $permalink_structure ) { |
677 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
678 | - $feed_url = $this->home_url . 'feed/' . $feed_slug; |
|
677 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
678 | + $feed_url = $this->home_url.'feed/'.$feed_slug; |
|
679 | 679 | } else { |
680 | - $feed_url = $this->home_url . '?feed=' . $this->token; |
|
680 | + $feed_url = $this->home_url.'?feed='.$this->token; |
|
681 | 681 | } |
682 | 682 | |
683 | - if( $feed_series && $feed_series != 'default' ) { |
|
683 | + if ( $feed_series && $feed_series != 'default' ) { |
|
684 | 684 | if ( $permalink_structure ) { |
685 | - $feed_url .= '/' . $feed_series; |
|
685 | + $feed_url .= '/'.$feed_series; |
|
686 | 686 | } else { |
687 | - $feed_url .= '&podcast_series=' . $feed_series; |
|
687 | + $feed_url .= '&podcast_series='.$feed_series; |
|
688 | 688 | } |
689 | 689 | } |
690 | 690 | |
691 | - if( $feed_url ) { |
|
692 | - $html .= '<p><a class="view-feed-link" href="' . esc_url( $feed_url ) . '" target="_blank"><span class="dashicons dashicons-rss"></span>' . __( 'View feed', 'seriously-simple-podcasting' ) . '</a></p>' . "\n"; |
|
691 | + if ( $feed_url ) { |
|
692 | + $html .= '<p><a class="view-feed-link" href="'.esc_url ( $feed_url ).'" target="_blank"><span class="dashicons dashicons-rss"></span>'.__ ( 'View feed', 'seriously-simple-podcasting' ).'</a></p>'."\n"; |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | } |
@@ -704,116 +704,116 @@ discard block |
||
704 | 704 | */ |
705 | 705 | public function display_field( $args ) { |
706 | 706 | |
707 | - $field = $args['field']; |
|
707 | + $field = $args[ 'field' ]; |
|
708 | 708 | |
709 | 709 | $html = ''; |
710 | 710 | |
711 | 711 | // Get option name |
712 | - $option_name = $this->settings_base . $field['id']; |
|
712 | + $option_name = $this->settings_base.$field[ 'id' ]; |
|
713 | 713 | $default_option_name = $option_name; |
714 | 714 | |
715 | 715 | // Get field default |
716 | 716 | $default = ''; |
717 | - if ( isset( $field['default'] ) ) { |
|
718 | - $default = $field['default']; |
|
717 | + if ( isset( $field[ 'default' ] ) ) { |
|
718 | + $default = $field[ 'default' ]; |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | // Get option value |
722 | - $data = get_option( $option_name, $default ); |
|
722 | + $data = get_option ( $option_name, $default ); |
|
723 | 723 | |
724 | 724 | // Get specific series data if applicable |
725 | - if ( isset( $args['feed-series'] ) && $args['feed-series'] ) { |
|
725 | + if ( isset( $args[ 'feed-series' ] ) && $args[ 'feed-series' ] ) { |
|
726 | 726 | |
727 | 727 | $option_default = ''; |
728 | 728 | |
729 | 729 | // Set placeholder to default feed option with specified default fallback |
730 | 730 | if ( $data ) { |
731 | - $field['placeholder'] = $data; |
|
731 | + $field[ 'placeholder' ] = $data; |
|
732 | 732 | |
733 | - if ( in_array( $field['type'], array( 'checkbox', 'select', 'image' ) ) ) { |
|
733 | + if ( in_array ( $field[ 'type' ], array( 'checkbox', 'select', 'image' ) ) ) { |
|
734 | 734 | $option_default = $data; |
735 | 735 | } |
736 | 736 | } |
737 | 737 | |
738 | 738 | // Append series ID to option name |
739 | - $option_name .= '_' . $args['feed-series']; |
|
739 | + $option_name .= '_'.$args[ 'feed-series' ]; |
|
740 | 740 | |
741 | 741 | // Get series-sepcific option |
742 | - $data = get_option( $option_name, $option_default ); |
|
742 | + $data = get_option ( $option_name, $option_default ); |
|
743 | 743 | |
744 | 744 | } |
745 | 745 | |
746 | 746 | // Get field class if supplied |
747 | 747 | $class = ''; |
748 | - if ( isset( $field['class'] ) ) { |
|
749 | - $class = $field['class']; |
|
748 | + if ( isset( $field[ 'class' ] ) ) { |
|
749 | + $class = $field[ 'class' ]; |
|
750 | 750 | } |
751 | 751 | |
752 | 752 | // Get parent class if supplied |
753 | 753 | $parent_class = ''; |
754 | - if ( isset( $field['parent_class'] ) ) { |
|
755 | - $parent_class = $field['parent_class']; |
|
754 | + if ( isset( $field[ 'parent_class' ] ) ) { |
|
755 | + $parent_class = $field[ 'parent_class' ]; |
|
756 | 756 | } |
757 | 757 | |
758 | - switch( $field['type'] ) { |
|
758 | + switch ( $field[ 'type' ] ) { |
|
759 | 759 | case 'text': |
760 | 760 | case 'password': |
761 | 761 | case 'number': |
762 | - $html .= '<input id="' . esc_attr( $field['id'] ) . '" type="' . $field['type'] . '" name="' . esc_attr( $option_name ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" value="' . esc_attr( $data ) . '" class="' . $class . '"/>' . "\n"; |
|
762 | + $html .= '<input id="'.esc_attr ( $field[ 'id' ] ).'" type="'.$field[ 'type' ].'" name="'.esc_attr ( $option_name ).'" placeholder="'.esc_attr ( $field[ 'placeholder' ] ).'" value="'.esc_attr ( $data ).'" class="'.$class.'"/>'."\n"; |
|
763 | 763 | break; |
764 | 764 | |
765 | 765 | case 'text_secret': |
766 | - $placeholder = $field['placeholder']; |
|
766 | + $placeholder = $field[ 'placeholder' ]; |
|
767 | 767 | if ( $data ) { |
768 | - $placeholder = __( 'Password stored securely', 'seriously-simple-podcasting' ); |
|
768 | + $placeholder = __ ( 'Password stored securely', 'seriously-simple-podcasting' ); |
|
769 | 769 | } |
770 | - $html .= '<input id="' . esc_attr( $field['id'] ) . '" type="text" name="' . esc_attr( $option_name ) . '" placeholder="' . esc_attr( $placeholder ) . '" value="" class="' . $class . '"/>' . "\n"; |
|
770 | + $html .= '<input id="'.esc_attr ( $field[ 'id' ] ).'" type="text" name="'.esc_attr ( $option_name ).'" placeholder="'.esc_attr ( $placeholder ).'" value="" class="'.$class.'"/>'."\n"; |
|
771 | 771 | break; |
772 | 772 | |
773 | 773 | case 'textarea': |
774 | - $html .= '<textarea id="' . esc_attr( $field['id'] ) . '" rows="5" cols="50" name="' . esc_attr( $option_name ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" class="' . $class . '">' . $data . '</textarea><br/>'. "\n"; |
|
774 | + $html .= '<textarea id="'.esc_attr ( $field[ 'id' ] ).'" rows="5" cols="50" name="'.esc_attr ( $option_name ).'" placeholder="'.esc_attr ( $field[ 'placeholder' ] ).'" class="'.$class.'">'.$data.'</textarea><br/>'."\n"; |
|
775 | 775 | break; |
776 | 776 | |
777 | 777 | case 'checkbox': |
778 | 778 | $checked = ''; |
779 | - if ( $data && 'on' == $data ){ |
|
779 | + if ( $data && 'on' == $data ) { |
|
780 | 780 | $checked = 'checked="checked"'; |
781 | 781 | } |
782 | - $html .= '<input id="' . esc_attr( $field['id'] ) . '" type="' . $field['type'] . '" name="' . esc_attr( $option_name ) . '" ' . $checked . ' class="' . $class . '"/>' . "\n"; |
|
782 | + $html .= '<input id="'.esc_attr ( $field[ 'id' ] ).'" type="'.$field[ 'type' ].'" name="'.esc_attr ( $option_name ).'" '.$checked.' class="'.$class.'"/>'."\n"; |
|
783 | 783 | break; |
784 | 784 | |
785 | 785 | case 'checkbox_multi': |
786 | - foreach ( $field['options'] as $k => $v ) { |
|
786 | + foreach ( $field[ 'options' ] as $k => $v ) { |
|
787 | 787 | $checked = false; |
788 | - if ( in_array( $k, (array) $data ) ) { |
|
788 | + if ( in_array ( $k, (array) $data ) ) { |
|
789 | 789 | $checked = true; |
790 | 790 | } |
791 | - $html .= '<label for="' . esc_attr( $field['id'] . '_' . $k ) . '"><input type="checkbox" ' . checked( $checked, true, false ) . ' name="' . esc_attr( $option_name ) . '[]" value="' . esc_attr( $k ) . '" id="' . esc_attr( $field['id'] . '_' . $k ) . '" class="' . $class . '" /> ' . $v . '</label><br/>'; |
|
791 | + $html .= '<label for="'.esc_attr ( $field[ 'id' ].'_'.$k ).'"><input type="checkbox" '.checked ( $checked, true, false ).' name="'.esc_attr ( $option_name ).'[]" value="'.esc_attr ( $k ).'" id="'.esc_attr ( $field[ 'id' ].'_'.$k ).'" class="'.$class.'" /> '.$v.'</label><br/>'; |
|
792 | 792 | } |
793 | 793 | break; |
794 | 794 | |
795 | 795 | case 'radio': |
796 | - foreach ( $field['options'] as $k => $v ) { |
|
796 | + foreach ( $field[ 'options' ] as $k => $v ) { |
|
797 | 797 | $checked = false; |
798 | 798 | if ( $k == $data ) { |
799 | 799 | $checked = true; |
800 | 800 | } |
801 | - $html .= '<label for="' . esc_attr( $field['id'] . '_' . $k ) . '"><input type="radio" ' . checked( $checked, true, false ) . ' name="' . esc_attr( $option_name ) . '" value="' . esc_attr( $k ) . '" id="' . esc_attr( $field['id'] . '_' . $k ) . '" class="' . $class . '" /> ' . $v . '</label><br/>'; |
|
801 | + $html .= '<label for="'.esc_attr ( $field[ 'id' ].'_'.$k ).'"><input type="radio" '.checked ( $checked, true, false ).' name="'.esc_attr ( $option_name ).'" value="'.esc_attr ( $k ).'" id="'.esc_attr ( $field[ 'id' ].'_'.$k ).'" class="'.$class.'" /> '.$v.'</label><br/>'; |
|
802 | 802 | } |
803 | 803 | break; |
804 | 804 | |
805 | 805 | case 'select': |
806 | 806 | |
807 | - $html .= '<select name="' . esc_attr( $option_name ) . '" id="' . esc_attr( $field['id'] ) . '" class="' . $class . '">'; |
|
807 | + $html .= '<select name="'.esc_attr ( $option_name ).'" id="'.esc_attr ( $field[ 'id' ] ).'" class="'.$class.'">'; |
|
808 | 808 | $prev_group = ''; |
809 | - foreach ( $field['options'] as $k => $v ) { |
|
809 | + foreach ( $field[ 'options' ] as $k => $v ) { |
|
810 | 810 | |
811 | 811 | $group = ''; |
812 | - if ( is_array( $v ) ) { |
|
813 | - if ( isset( $v['group'] ) ) { |
|
814 | - $group = $v['group']; |
|
812 | + if ( is_array ( $v ) ) { |
|
813 | + if ( isset( $v[ 'group' ] ) ) { |
|
814 | + $group = $v[ 'group' ]; |
|
815 | 815 | } |
816 | - $v = $v['label']; |
|
816 | + $v = $v[ 'label' ]; |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | if ( $prev_group && $group != $prev_group ) { |
@@ -826,10 +826,10 @@ discard block |
||
826 | 826 | } |
827 | 827 | |
828 | 828 | if ( $group && $group != $prev_group ) { |
829 | - $html .= '<optgroup label="' . esc_attr( $group ) . '">'; |
|
829 | + $html .= '<optgroup label="'.esc_attr ( $group ).'">'; |
|
830 | 830 | } |
831 | 831 | |
832 | - $html .= '<option ' . selected( $selected, true, false ) . ' value="' . esc_attr( $k ) . '">' . esc_html( $v ) . '</option>'; |
|
832 | + $html .= '<option '.selected ( $selected, true, false ).' value="'.esc_attr ( $k ).'">'.esc_html ( $v ).'</option>'; |
|
833 | 833 | |
834 | 834 | $prev_group = $group; |
835 | 835 | } |
@@ -837,65 +837,65 @@ discard block |
||
837 | 837 | break; |
838 | 838 | |
839 | 839 | case 'image': |
840 | - $html .= '<img id="' . esc_attr( $default_option_name ) . '_preview" src="' . esc_attr( $data ) . '" style="max-width:400px;height:auto;" /><br/>' . "\n"; |
|
841 | - $html .= '<input id="' . esc_attr( $default_option_name ) . '_button" type="button" class="button" value="'. __( 'Upload new image' , 'seriously-simple-podcasting' ) . '" />' . "\n"; |
|
842 | - $html .= '<input id="' . esc_attr( $default_option_name ) . '_delete" type="button" class="button" value="'. __( 'Remove image' , 'seriously-simple-podcasting' ) . '" />' . "\n"; |
|
843 | - $html .= '<input id="' . esc_attr( $default_option_name ) . '" type="hidden" name="' . esc_attr( $option_name ) . '" value="' . esc_attr( $data ) . '"/><br/>' . "\n"; |
|
840 | + $html .= '<img id="'.esc_attr ( $default_option_name ).'_preview" src="'.esc_attr ( $data ).'" style="max-width:400px;height:auto;" /><br/>'."\n"; |
|
841 | + $html .= '<input id="'.esc_attr ( $default_option_name ).'_button" type="button" class="button" value="'.__ ( 'Upload new image', 'seriously-simple-podcasting' ).'" />'."\n"; |
|
842 | + $html .= '<input id="'.esc_attr ( $default_option_name ).'_delete" type="button" class="button" value="'.__ ( 'Remove image', 'seriously-simple-podcasting' ).'" />'."\n"; |
|
843 | + $html .= '<input id="'.esc_attr ( $default_option_name ).'" type="hidden" name="'.esc_attr ( $option_name ).'" value="'.esc_attr ( $data ).'"/><br/>'."\n"; |
|
844 | 844 | break; |
845 | 845 | |
846 | 846 | case 'feed_link': |
847 | 847 | |
848 | 848 | // Set feed URL based on site's permalink structure |
849 | - if ( get_option( 'permalink_structure' ) ) { |
|
850 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
851 | - $url = $this->home_url . 'feed/' . $feed_slug; |
|
849 | + if ( get_option ( 'permalink_structure' ) ) { |
|
850 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
851 | + $url = $this->home_url.'feed/'.$feed_slug; |
|
852 | 852 | } else { |
853 | - $url = $this->home_url . '?feed=' . $this->token; |
|
853 | + $url = $this->home_url.'?feed='.$this->token; |
|
854 | 854 | } |
855 | 855 | |
856 | - $html .= '<a href="' . esc_url( $url ) . '" target="_blank">' . $url . '</a>'; |
|
856 | + $html .= '<a href="'.esc_url ( $url ).'" target="_blank">'.$url.'</a>'; |
|
857 | 857 | break; |
858 | 858 | |
859 | 859 | case 'feed_link_series': |
860 | 860 | |
861 | 861 | // Set feed URL based on site's permalink structure |
862 | - if ( get_option( 'permalink_structure' ) ) { |
|
863 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
864 | - $url = $this->home_url . 'feed/' . $feed_slug . '/series-slug'; |
|
862 | + if ( get_option ( 'permalink_structure' ) ) { |
|
863 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
864 | + $url = $this->home_url.'feed/'.$feed_slug.'/series-slug'; |
|
865 | 865 | } else { |
866 | - $url = $this->home_url . '?feed=' . $this->token . '&podcast_series=series-slug'; |
|
866 | + $url = $this->home_url.'?feed='.$this->token.'&podcast_series=series-slug'; |
|
867 | 867 | } |
868 | 868 | |
869 | - $html .= esc_url( $url ) . "\n"; |
|
869 | + $html .= esc_url ( $url )."\n"; |
|
870 | 870 | break; |
871 | 871 | |
872 | 872 | case 'podcast_url'; |
873 | 873 | |
874 | - $slug = apply_filters( 'ssp_archive_slug', __( 'podcast' , 'seriously-simple-podcasting' ) ); |
|
875 | - $podcast_url = $this->home_url . $slug; |
|
874 | + $slug = apply_filters ( 'ssp_archive_slug', __ ( 'podcast', 'seriously-simple-podcasting' ) ); |
|
875 | + $podcast_url = $this->home_url.$slug; |
|
876 | 876 | |
877 | - $html .= '<a href="' . esc_url( $podcast_url ) . '" target="_blank">' . $podcast_url . '</a>'; |
|
877 | + $html .= '<a href="'.esc_url ( $podcast_url ).'" target="_blank">'.$podcast_url.'</a>'; |
|
878 | 878 | break; |
879 | 879 | |
880 | 880 | } |
881 | 881 | |
882 | - if ( ! in_array( $field['type'], array( 'feed_link', 'feed_link_series', 'podcast_url' ) ) ) { |
|
883 | - switch( $field['type'] ) { |
|
882 | + if ( ! in_array ( $field[ 'type' ], array( 'feed_link', 'feed_link_series', 'podcast_url' ) ) ) { |
|
883 | + switch ( $field[ 'type' ] ) { |
|
884 | 884 | |
885 | 885 | case 'checkbox_multi': |
886 | 886 | case 'radio': |
887 | 887 | case 'select_multi': |
888 | - $html .= '<br/><span class="description">' . esc_attr( $field['description'] ) . '</span>'; |
|
888 | + $html .= '<br/><span class="description">'.esc_attr ( $field[ 'description' ] ).'</span>'; |
|
889 | 889 | break; |
890 | 890 | |
891 | 891 | default: |
892 | - $html .= '<label for="' . esc_attr( $field['id'] ) . '"><span class="description">' . wp_kses_post( $field['description'] ) . '</span></label>' . "\n"; |
|
892 | + $html .= '<label for="'.esc_attr ( $field[ 'id' ] ).'"><span class="description">'.wp_kses_post ( $field[ 'description' ] ).'</span></label>'."\n"; |
|
893 | 893 | break; |
894 | 894 | } |
895 | 895 | } |
896 | 896 | |
897 | - if( $parent_class ) { |
|
898 | - $html = '<div class="' . $parent_class . '">' . $html . '</div>'; |
|
897 | + if ( $parent_class ) { |
|
898 | + $html = '<div class="'.$parent_class.'">'.$html.'</div>'; |
|
899 | 899 | } |
900 | 900 | |
901 | 901 | echo $html; |
@@ -907,8 +907,8 @@ discard block |
||
907 | 907 | * @return string Validated string |
908 | 908 | */ |
909 | 909 | public function validate_slug( $slug ) { |
910 | - if ( $slug && strlen( $slug ) > 0 && $slug != '' ) { |
|
911 | - $slug = urlencode( strtolower( str_replace( ' ' , '-' , $slug ) ) ); |
|
910 | + if ( $slug && strlen ( $slug ) > 0 && $slug != '' ) { |
|
911 | + $slug = urlencode ( strtolower ( str_replace ( ' ', '-', $slug ) ) ); |
|
912 | 912 | } |
913 | 913 | return $slug; |
914 | 914 | } |
@@ -920,10 +920,10 @@ discard block |
||
920 | 920 | */ |
921 | 921 | public function encode_password( $password ) { |
922 | 922 | |
923 | - if ( $password && strlen( $password ) > 0 && $password != '' ) { |
|
924 | - $password = md5( $password ); |
|
923 | + if ( $password && strlen ( $password ) > 0 && $password != '' ) { |
|
924 | + $password = md5 ( $password ); |
|
925 | 925 | } else { |
926 | - $option = get_option( 'ss_podcasting_protection_password' ); |
|
926 | + $option = get_option ( 'ss_podcasting_protection_password' ); |
|
927 | 927 | $password = $option; |
928 | 928 | } |
929 | 929 | |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | 'p' => array() |
952 | 952 | ); |
953 | 953 | |
954 | - $message = wp_kses( $message, $allowed ); |
|
954 | + $message = wp_kses ( $message, $allowed ); |
|
955 | 955 | } |
956 | 956 | |
957 | 957 | return $message; |
@@ -968,8 +968,8 @@ discard block |
||
968 | 968 | |
969 | 969 | if ( $option == 'ss_podcasting_redirect_feed' ) { |
970 | 970 | if ( ( $new_value != $old_value ) && $new_value == 'on' ) { |
971 | - $date = time(); |
|
972 | - update_option( 'ss_podcasting_redirect_feed_date', $date ); |
|
971 | + $date = time (); |
|
972 | + update_option ( 'ss_podcasting_redirect_feed_date', $date ); |
|
973 | 973 | } |
974 | 974 | } |
975 | 975 | |
@@ -982,64 +982,64 @@ discard block |
||
982 | 982 | public function settings_page() { |
983 | 983 | |
984 | 984 | // Build page HTML |
985 | - $html = '<div class="wrap" id="podcast_settings">' . "\n"; |
|
986 | - $html .= '<h1>' . __( 'Podcast Settings' , 'seriously-simple-podcasting' ) . '</h1>' . "\n"; |
|
985 | + $html = '<div class="wrap" id="podcast_settings">'."\n"; |
|
986 | + $html .= '<h1>'.__ ( 'Podcast Settings', 'seriously-simple-podcasting' ).'</h1>'."\n"; |
|
987 | 987 | |
988 | 988 | $tab = 'general'; |
989 | - if ( isset( $_GET['tab'] ) && $_GET['tab'] ) { |
|
990 | - $tab = $_GET['tab']; |
|
989 | + if ( isset( $_GET[ 'tab' ] ) && $_GET[ 'tab' ] ) { |
|
990 | + $tab = $_GET[ 'tab' ]; |
|
991 | 991 | } |
992 | 992 | |
993 | 993 | // Show page tabs |
994 | - if ( is_array( $this->settings ) && 1 < count( $this->settings ) ) { |
|
994 | + if ( is_array ( $this->settings ) && 1 < count ( $this->settings ) ) { |
|
995 | 995 | |
996 | - $html .= '<h2 class="nav-tab-wrapper">' . "\n"; |
|
996 | + $html .= '<h2 class="nav-tab-wrapper">'."\n"; |
|
997 | 997 | |
998 | 998 | $c = 0; |
999 | 999 | foreach ( $this->settings as $section => $data ) { |
1000 | 1000 | |
1001 | 1001 | // Set tab class |
1002 | 1002 | $class = 'nav-tab'; |
1003 | - if ( ! isset( $_GET['tab'] ) ) { |
|
1003 | + if ( ! isset( $_GET[ 'tab' ] ) ) { |
|
1004 | 1004 | if ( 0 == $c ) { |
1005 | 1005 | $class .= ' nav-tab-active'; |
1006 | 1006 | } |
1007 | 1007 | } else { |
1008 | - if ( isset( $_GET['tab'] ) && $section == $_GET['tab'] ) { |
|
1008 | + if ( isset( $_GET[ 'tab' ] ) && $section == $_GET[ 'tab' ] ) { |
|
1009 | 1009 | $class .= ' nav-tab-active'; |
1010 | 1010 | } |
1011 | 1011 | } |
1012 | 1012 | |
1013 | 1013 | // Set tab link |
1014 | - $tab_link = add_query_arg( array( 'tab' => $section ) ); |
|
1015 | - if ( isset( $_GET['settings-updated'] ) ) { |
|
1016 | - $tab_link = remove_query_arg( 'settings-updated', $tab_link ); |
|
1014 | + $tab_link = add_query_arg ( array( 'tab' => $section ) ); |
|
1015 | + if ( isset( $_GET[ 'settings-updated' ] ) ) { |
|
1016 | + $tab_link = remove_query_arg ( 'settings-updated', $tab_link ); |
|
1017 | 1017 | } |
1018 | 1018 | |
1019 | - if ( isset( $_GET['feed-series'] ) ) { |
|
1020 | - $tab_link = remove_query_arg( 'feed-series', $tab_link ); |
|
1019 | + if ( isset( $_GET[ 'feed-series' ] ) ) { |
|
1020 | + $tab_link = remove_query_arg ( 'feed-series', $tab_link ); |
|
1021 | 1021 | } |
1022 | 1022 | |
1023 | 1023 | // Output tab |
1024 | - $html .= '<a href="' . esc_url( $tab_link ) . '" class="' . esc_attr( $class ) . '">' . esc_html( $data['title'] ) . '</a>' . "\n"; |
|
1024 | + $html .= '<a href="'.esc_url ( $tab_link ).'" class="'.esc_attr ( $class ).'">'.esc_html ( $data[ 'title' ] ).'</a>'."\n"; |
|
1025 | 1025 | |
1026 | 1026 | ++$c; |
1027 | 1027 | } |
1028 | 1028 | |
1029 | - $html .= '</h2>' . "\n"; |
|
1029 | + $html .= '</h2>'."\n"; |
|
1030 | 1030 | } |
1031 | 1031 | |
1032 | - if ( isset( $_GET['settings-updated'] ) ) { |
|
1032 | + if ( isset( $_GET[ 'settings-updated' ] ) ) { |
|
1033 | 1033 | $html .= '<br/><div class="updated notice notice-success is-dismissible"> |
1034 | - <p>' . sprintf( __( '%1$s settings updated.', 'seriously-simple-podcasting' ), '<b>' . str_replace( '-', ' ', ucfirst( $tab ) ) . '</b>' ) . '</p> |
|
1034 | + <p>' . sprintf ( __ ( '%1$s settings updated.', 'seriously-simple-podcasting' ), '<b>'.str_replace ( '-', ' ', ucfirst ( $tab ) ).'</b>' ).'</p> |
|
1035 | 1035 | </div>'; |
1036 | 1036 | } |
1037 | 1037 | |
1038 | - if( function_exists( 'php_sapi_name') && 'security' == $tab ) { |
|
1039 | - $sapi_type = php_sapi_name(); |
|
1040 | - if ( strpos( $sapi_type, 'fcgi' ) !== false ) { |
|
1038 | + if ( function_exists ( 'php_sapi_name' ) && 'security' == $tab ) { |
|
1039 | + $sapi_type = php_sapi_name (); |
|
1040 | + if ( strpos ( $sapi_type, 'fcgi' ) !== false ) { |
|
1041 | 1041 | $html .= '<br/><div class="update-nag"> |
1042 | - <p>' . sprintf( __( 'It looks like your server has FastCGI enabled, which will prevent the feed password protection feature from working. You can fix this by following %1$sthis quick guide%2$s.', 'seriously-simple-podcasting' ), '<a href="http://www.seriouslysimplepodcasting.com/documentation/why-does-the-feed-password-protection-feature-not-work/" target="_blank">', '</a>' ) . '</p> |
|
1042 | + <p>' . sprintf ( __ ( 'It looks like your server has FastCGI enabled, which will prevent the feed password protection feature from working. You can fix this by following %1$sthis quick guide%2$s.', 'seriously-simple-podcasting' ), '<a href="http://www.seriouslysimplepodcasting.com/documentation/why-does-the-feed-password-protection-feature-not-work/" target="_blank">', '</a>' ).'</p> |
|
1043 | 1043 | </div>'; |
1044 | 1044 | } |
1045 | 1045 | } |
@@ -1048,23 +1048,23 @@ discard block |
||
1048 | 1048 | |
1049 | 1049 | // Series submenu for feed details |
1050 | 1050 | if ( 'feed-details' == $tab ) { |
1051 | - $series = get_terms( 'series', array( 'hide_empty' => false ) ); |
|
1051 | + $series = get_terms ( 'series', array( 'hide_empty' => false ) ); |
|
1052 | 1052 | |
1053 | 1053 | if ( ! empty( $series ) ) { |
1054 | 1054 | |
1055 | - if ( isset( $_GET['feed-series'] ) && $_GET['feed-series'] && 'default' != $_GET['feed-series'] ) { |
|
1056 | - $current_series = esc_attr( $_GET['feed-series'] ); |
|
1055 | + if ( isset( $_GET[ 'feed-series' ] ) && $_GET[ 'feed-series' ] && 'default' != $_GET[ 'feed-series' ] ) { |
|
1056 | + $current_series = esc_attr ( $_GET[ 'feed-series' ] ); |
|
1057 | 1057 | $series_class = ''; |
1058 | 1058 | } else { |
1059 | 1059 | $current_series = 'default'; |
1060 | 1060 | $series_class = 'current'; |
1061 | 1061 | } |
1062 | 1062 | |
1063 | - $html .= '<div class="feed-series-list-container">' . "\n"; |
|
1064 | - $html .= '<span id="feed-series-toggle" class="series-open" title="' . __( 'Toggle series list display', 'seriously-simple-podcasting' ) . '"></span>' . "\n"; |
|
1063 | + $html .= '<div class="feed-series-list-container">'."\n"; |
|
1064 | + $html .= '<span id="feed-series-toggle" class="series-open" title="'.__ ( 'Toggle series list display', 'seriously-simple-podcasting' ).'"></span>'."\n"; |
|
1065 | 1065 | |
1066 | - $html .= '<ul id="feed-series-list" class="subsubsub series-open">' . "\n"; |
|
1067 | - $html .= '<li><a href="' . add_query_arg( array( 'feed-series' => 'default', 'settings-updated' => false ) ) . '" class="' . $series_class . '">' . __( 'Default feed', 'seriously-simple-podcasting' ) . '</a></li>'; |
|
1066 | + $html .= '<ul id="feed-series-list" class="subsubsub series-open">'."\n"; |
|
1067 | + $html .= '<li><a href="'.add_query_arg ( array( 'feed-series' => 'default', 'settings-updated' => false ) ).'" class="'.$series_class.'">'.__ ( 'Default feed', 'seriously-simple-podcasting' ).'</a></li>'; |
|
1068 | 1068 | |
1069 | 1069 | foreach ( $series as $s ) { |
1070 | 1070 | |
@@ -1074,39 +1074,39 @@ discard block |
||
1074 | 1074 | $series_class = ''; |
1075 | 1075 | } |
1076 | 1076 | |
1077 | - $html .= '<li>' . "\n"; |
|
1078 | - $html .= ' | <a href="' . esc_url( add_query_arg( array( 'feed-series' => $s->slug, 'settings-updated' => false ) ) ) . '" class="' . $series_class . '">' . $s->name . '</a>' . "\n"; |
|
1079 | - $html .= '</li>' . "\n"; |
|
1077 | + $html .= '<li>'."\n"; |
|
1078 | + $html .= ' | <a href="'.esc_url ( add_query_arg ( array( 'feed-series' => $s->slug, 'settings-updated' => false ) ) ).'" class="'.$series_class.'">'.$s->name.'</a>'."\n"; |
|
1079 | + $html .= '</li>'."\n"; |
|
1080 | 1080 | } |
1081 | 1081 | |
1082 | - $html .= '</ul>' . "\n"; |
|
1083 | - $html .= '<br class="clear" />' . "\n"; |
|
1084 | - $html .= '</div>' . "\n"; |
|
1082 | + $html .= '</ul>'."\n"; |
|
1083 | + $html .= '<br class="clear" />'."\n"; |
|
1084 | + $html .= '</div>'."\n"; |
|
1085 | 1085 | |
1086 | 1086 | } |
1087 | 1087 | } |
1088 | 1088 | |
1089 | - $html .= '<form method="post" action="options.php" enctype="multipart/form-data">' . "\n"; |
|
1089 | + $html .= '<form method="post" action="options.php" enctype="multipart/form-data">'."\n"; |
|
1090 | 1090 | |
1091 | 1091 | // Add current series to posted data |
1092 | 1092 | if ( $current_series ) { |
1093 | - $html .= '<input type="hidden" name="feed-series" value="' . esc_attr( $current_series ) . '" />' . "\n"; |
|
1093 | + $html .= '<input type="hidden" name="feed-series" value="'.esc_attr ( $current_series ).'" />'."\n"; |
|
1094 | 1094 | } |
1095 | 1095 | |
1096 | 1096 | // Get settings fields |
1097 | - ob_start(); |
|
1098 | - settings_fields( 'ss_podcasting' ); |
|
1099 | - do_settings_sections( 'ss_podcasting' ); |
|
1100 | - $html .= ob_get_clean(); |
|
1097 | + ob_start (); |
|
1098 | + settings_fields ( 'ss_podcasting' ); |
|
1099 | + do_settings_sections ( 'ss_podcasting' ); |
|
1100 | + $html .= ob_get_clean (); |
|
1101 | 1101 | |
1102 | 1102 | // Submit button |
1103 | - $html .= '<p class="submit">' . "\n"; |
|
1104 | - $html .= '<input type="hidden" name="tab" value="' . esc_attr( $tab ) . '" />' . "\n"; |
|
1105 | - $html .= '<input name="Submit" type="submit" class="button-primary" value="' . esc_attr( __( 'Save Settings' , 'seriously-simple-podcasting' ) ) . '" />' . "\n"; |
|
1106 | - $html .= '</p>' . "\n"; |
|
1103 | + $html .= '<p class="submit">'."\n"; |
|
1104 | + $html .= '<input type="hidden" name="tab" value="'.esc_attr ( $tab ).'" />'."\n"; |
|
1105 | + $html .= '<input name="Submit" type="submit" class="button-primary" value="'.esc_attr ( __ ( 'Save Settings', 'seriously-simple-podcasting' ) ).'" />'."\n"; |
|
1106 | + $html .= '</p>'."\n"; |
|
1107 | 1107 | |
1108 | - $html .= '</form>' . "\n"; |
|
1109 | - $html .= '</div>' . "\n"; |
|
1108 | + $html .= '</form>'."\n"; |
|
1109 | + $html .= '</div>'."\n"; |
|
1110 | 1110 | |
1111 | 1111 | echo $html; |
1112 | 1112 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly. |
4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined ( 'ABSPATH' ) ) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
@@ -33,57 +33,57 @@ discard block |
||
33 | 33 | |
34 | 34 | $this->version = $version; |
35 | 35 | |
36 | - $this->dir = dirname( $file ); |
|
36 | + $this->dir = dirname ( $file ); |
|
37 | 37 | $this->file = $file; |
38 | - $this->assets_dir = trailingslashit( $this->dir ) . 'assets'; |
|
39 | - $this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $file ) ) ); |
|
40 | - $this->template_path = trailingslashit( $this->dir ) . 'templates/'; |
|
41 | - $this->template_url = esc_url( trailingslashit( plugins_url( '/templates/', $file ) ) ); |
|
42 | - $this->home_url = trailingslashit( home_url() ); |
|
43 | - $this->site_url = trailingslashit( site_url() ); |
|
38 | + $this->assets_dir = trailingslashit ( $this->dir ).'assets'; |
|
39 | + $this->assets_url = esc_url ( trailingslashit ( plugins_url ( '/assets/', $file ) ) ); |
|
40 | + $this->template_path = trailingslashit ( $this->dir ).'templates/'; |
|
41 | + $this->template_url = esc_url ( trailingslashit ( plugins_url ( '/templates/', $file ) ) ); |
|
42 | + $this->home_url = trailingslashit ( home_url () ); |
|
43 | + $this->site_url = trailingslashit ( site_url () ); |
|
44 | 44 | $this->token = 'podcast'; |
45 | 45 | |
46 | 46 | // Add meta data to start of podcast content |
47 | - $locations = get_option( 'ss_podcasting_player_locations', array() ); |
|
47 | + $locations = get_option ( 'ss_podcasting_player_locations', array() ); |
|
48 | 48 | |
49 | - if ( in_array( 'content', (array) $locations ) ) { |
|
50 | - add_filter( 'the_content', array( $this, 'content_meta_data' ), 10, 1 ); |
|
49 | + if ( in_array ( 'content', (array) $locations ) ) { |
|
50 | + add_filter ( 'the_content', array( $this, 'content_meta_data' ), 10, 1 ); |
|
51 | 51 | } |
52 | 52 | |
53 | - if ( in_array( 'excerpt', (array) $locations ) ) { |
|
54 | - add_filter( 'the_excerpt', array( $this, 'get_excerpt_meta_data' ), 10, 1 ); |
|
53 | + if ( in_array ( 'excerpt', (array) $locations ) ) { |
|
54 | + add_filter ( 'the_excerpt', array( $this, 'get_excerpt_meta_data' ), 10, 1 ); |
|
55 | 55 | } |
56 | 56 | |
57 | - if ( in_array( 'excerpt_embed', (array) $locations ) ) { |
|
58 | - add_filter( 'the_excerpt_embed', array( $this, 'get_embed_meta_data' ), 10, 1 ); |
|
57 | + if ( in_array ( 'excerpt_embed', (array) $locations ) ) { |
|
58 | + add_filter ( 'the_excerpt_embed', array( $this, 'get_embed_meta_data' ), 10, 1 ); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | // Add SSP label and version to generator tags |
62 | - add_action( 'get_the_generator_html', array( $this, 'generator_tag' ), 10, 2 ); |
|
63 | - add_action( 'get_the_generator_xhtml', array( $this, 'generator_tag' ), 10, 2 ); |
|
62 | + add_action ( 'get_the_generator_html', array( $this, 'generator_tag' ), 10, 2 ); |
|
63 | + add_action ( 'get_the_generator_xhtml', array( $this, 'generator_tag' ), 10, 2 ); |
|
64 | 64 | |
65 | 65 | // Add RSS meta tag to site header |
66 | - add_action( 'wp_head' , array( $this, 'rss_meta_tag' ) ); |
|
66 | + add_action ( 'wp_head', array( $this, 'rss_meta_tag' ) ); |
|
67 | 67 | |
68 | 68 | // Add podcast episode to main query loop if setting is activated |
69 | - add_action( 'pre_get_posts' , array( $this, 'add_to_home_query' ) ); |
|
69 | + add_action ( 'pre_get_posts', array( $this, 'add_to_home_query' ) ); |
|
70 | 70 | |
71 | 71 | // Make sure to fetch all relevant post types when viewing series archive |
72 | - add_action( 'pre_get_posts' , array( $this, 'add_all_post_types' ) ); |
|
72 | + add_action ( 'pre_get_posts', array( $this, 'add_all_post_types' ) ); |
|
73 | 73 | |
74 | 74 | // Download podcast episode |
75 | - add_action( 'wp', array( $this, 'download_file' ), 1 ); |
|
75 | + add_action ( 'wp', array( $this, 'download_file' ), 1 ); |
|
76 | 76 | |
77 | 77 | // Register widgets |
78 | - add_action( 'widgets_init', array( $this, 'register_widgets' ), 1 ); |
|
78 | + add_action ( 'widgets_init', array( $this, 'register_widgets' ), 1 ); |
|
79 | 79 | |
80 | 80 | // Add shortcodes |
81 | - add_action( 'init', array( $this, 'register_shortcodes' ), 1 ); |
|
81 | + add_action ( 'init', array( $this, 'register_shortcodes' ), 1 ); |
|
82 | 82 | |
83 | - add_filter( 'feed_content_type', array( $this, 'feed_content_type' ), 10, 2 ); |
|
83 | + add_filter ( 'feed_content_type', array( $this, 'feed_content_type' ), 10, 2 ); |
|
84 | 84 | |
85 | 85 | // Handle localisation |
86 | - add_action( 'plugins_loaded', array( $this, 'load_localisation' ) ); |
|
86 | + add_action ( 'plugins_loaded', array( $this, 'load_localisation' ) ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -94,36 +94,36 @@ discard block |
||
94 | 94 | public function get_episode_download_link( $episode_id, $referrer = '' ) { |
95 | 95 | |
96 | 96 | // Get file URL |
97 | - $file = $this->get_enclosure( $episode_id ); |
|
97 | + $file = $this->get_enclosure ( $episode_id ); |
|
98 | 98 | |
99 | 99 | if ( ! $file ) { |
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
103 | 103 | // Get download link based on permalink structure |
104 | - if ( get_option( 'permalink_structure' ) ) { |
|
105 | - $episode = get_post( $episode_id ); |
|
104 | + if ( get_option ( 'permalink_structure' ) ) { |
|
105 | + $episode = get_post ( $episode_id ); |
|
106 | 106 | |
107 | 107 | // Get file extension - default to MP3 to prevent empty extension strings |
108 | - $ext = pathinfo( $file, PATHINFO_EXTENSION ); |
|
109 | - if( ! $ext ) { |
|
108 | + $ext = pathinfo ( $file, PATHINFO_EXTENSION ); |
|
109 | + if ( ! $ext ) { |
|
110 | 110 | $ext = 'mp3'; |
111 | 111 | } |
112 | 112 | |
113 | - $link = $this->home_url . 'podcast-download/' . $episode_id . '/' . $episode->post_name . '.' . $ext; |
|
113 | + $link = $this->home_url.'podcast-download/'.$episode_id.'/'.$episode->post_name.'.'.$ext; |
|
114 | 114 | } else { |
115 | - $link = add_query_arg( array( 'podcast_episode' => $episode_id ), $this->home_url ); |
|
115 | + $link = add_query_arg ( array( 'podcast_episode' => $episode_id ), $this->home_url ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | // Allow for dyamic referrer |
119 | - $referrer = apply_filters( 'ssp_download_referrer', $referrer, $episode_id ); |
|
119 | + $referrer = apply_filters ( 'ssp_download_referrer', $referrer, $episode_id ); |
|
120 | 120 | |
121 | 121 | // Add referrer flag if supplied |
122 | 122 | if ( $referrer ) { |
123 | - $link = add_query_arg( array( 'ref' => $referrer ), $link ); |
|
123 | + $link = add_query_arg ( array( 'ref' => $referrer ), $link ); |
|
124 | 124 | } |
125 | 125 | |
126 | - return apply_filters( 'ssp_episode_download_link', esc_url( $link ), $episode_id, $file ); |
|
126 | + return apply_filters ( 'ssp_episode_download_link', esc_url ( $link ), $episode_id, $file ); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function get_episode_type( $episode_id = 0 ) { |
135 | 135 | |
136 | - if( ! $episode_id ) { |
|
136 | + if ( ! $episode_id ) { |
|
137 | 137 | return false; |
138 | 138 | } |
139 | 139 | |
140 | - $type = get_post_meta( $episode_id , 'episode_type' , true ); |
|
140 | + $type = get_post_meta ( $episode_id, 'episode_type', true ); |
|
141 | 141 | |
142 | - if( ! $type ) { |
|
142 | + if ( ! $type ) { |
|
143 | 143 | $type = 'audio'; |
144 | 144 | } |
145 | 145 | |
@@ -155,39 +155,39 @@ discard block |
||
155 | 155 | global $post, $wp_current_filter, $episode_context; |
156 | 156 | |
157 | 157 | // Don't output unformatted data on excerpts |
158 | - if ( in_array( 'get_the_excerpt', (array) $wp_current_filter ) ) { |
|
158 | + if ( in_array ( 'get_the_excerpt', (array) $wp_current_filter ) ) { |
|
159 | 159 | return $content; |
160 | 160 | } |
161 | 161 | |
162 | 162 | // Don't output episode meta in shortcode or widget |
163 | - if ( isset( $episode_context ) && in_array( $episode_context, array( 'shortcode', 'widget' ) ) ) { |
|
163 | + if ( isset( $episode_context ) && in_array ( $episode_context, array( 'shortcode', 'widget' ) ) ) { |
|
164 | 164 | return $content; |
165 | 165 | } |
166 | 166 | |
167 | - if( post_password_required( $post->ID ) ) { |
|
167 | + if ( post_password_required ( $post->ID ) ) { |
|
168 | 168 | return $content; |
169 | 169 | } |
170 | 170 | |
171 | - $podcast_post_types = ssp_post_types( true ); |
|
171 | + $podcast_post_types = ssp_post_types ( true ); |
|
172 | 172 | |
173 | - $player_visibility = get_option( 'ss_podcasting_player_content_visibility' ); |
|
173 | + $player_visibility = get_option ( 'ss_podcasting_player_content_visibility' ); |
|
174 | 174 | |
175 | - switch( $player_visibility ) { |
|
175 | + switch ( $player_visibility ) { |
|
176 | 176 | case 'all': $player_visibility_bool = true; break; |
177 | - case 'membersonly': $player_visibility_bool = is_user_logged_in(); break; |
|
177 | + case 'membersonly': $player_visibility_bool = is_user_logged_in (); break; |
|
178 | 178 | } |
179 | 179 | |
180 | - if ( $player_visibility_bool && in_array( $post->post_type, $podcast_post_types ) && ! is_feed() && ! isset( $_GET['feed'] ) ) { |
|
180 | + if ( $player_visibility_bool && in_array ( $post->post_type, $podcast_post_types ) && ! is_feed () && ! isset( $_GET[ 'feed' ] ) ) { |
|
181 | 181 | |
182 | 182 | // Get episode meta data |
183 | - $meta = $this->episode_meta( $post->ID, 'content' ); |
|
183 | + $meta = $this->episode_meta ( $post->ID, 'content' ); |
|
184 | 184 | |
185 | 185 | // Get specified player position |
186 | - $player_position = get_option( 'ss_podcasting_player_content_location', 'above' ); |
|
186 | + $player_position = get_option ( 'ss_podcasting_player_content_location', 'above' ); |
|
187 | 187 | |
188 | - switch( $player_position ) { |
|
189 | - case 'above': $content = $meta . $content; break; |
|
190 | - case 'below': $content = $content . $meta; break; |
|
188 | + switch ( $player_position ) { |
|
189 | + case 'above': $content = $meta.$content; break; |
|
190 | + case 'below': $content = $content.$meta; break; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @return string Modified excerpt |
202 | 202 | */ |
203 | 203 | public function get_excerpt_meta_data( $excerpt = '' ) { |
204 | - return $this->excerpt_meta_data( $excerpt, 'excerpt' ); |
|
204 | + return $this->excerpt_meta_data ( $excerpt, 'excerpt' ); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @return string Modified excerpt |
211 | 211 | */ |
212 | 212 | public function get_embed_meta_data( $excerpt = '' ) { |
213 | - return $this->excerpt_meta_data( $excerpt, 'embed' ); |
|
213 | + return $this->excerpt_meta_data ( $excerpt, 'embed' ); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -221,17 +221,17 @@ discard block |
||
221 | 221 | public function excerpt_meta_data( $excerpt = '', $content = 'excerpt' ) { |
222 | 222 | global $post; |
223 | 223 | |
224 | - if( post_password_required( $post->ID ) ) { |
|
224 | + if ( post_password_required ( $post->ID ) ) { |
|
225 | 225 | return $excerpt; |
226 | 226 | } |
227 | 227 | |
228 | - $podcast_post_types = ssp_post_types( true ); |
|
228 | + $podcast_post_types = ssp_post_types ( true ); |
|
229 | 229 | |
230 | - if ( ( in_array( $post->post_type, $podcast_post_types ) ) && ! is_feed() ) { |
|
230 | + if ( ( in_array ( $post->post_type, $podcast_post_types ) ) && ! is_feed () ) { |
|
231 | 231 | |
232 | - $meta = $this->episode_meta( $post->ID, $content ); |
|
232 | + $meta = $this->episode_meta ( $post->ID, $content ); |
|
233 | 233 | |
234 | - $excerpt = $meta . $excerpt; |
|
234 | + $excerpt = $meta.$excerpt; |
|
235 | 235 | |
236 | 236 | } |
237 | 237 | |
@@ -252,34 +252,34 @@ discard block |
||
252 | 252 | return $meta; |
253 | 253 | } |
254 | 254 | |
255 | - $file = $this->get_enclosure( $episode_id ); |
|
255 | + $file = $this->get_enclosure ( $episode_id ); |
|
256 | 256 | |
257 | 257 | if ( $file ) { |
258 | 258 | |
259 | - if ( get_option( 'permalink_structure' ) ) { |
|
260 | - $file = $this->get_episode_download_link( $episode_id ); |
|
259 | + if ( get_option ( 'permalink_structure' ) ) { |
|
260 | + $file = $this->get_episode_download_link ( $episode_id ); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | // Hide audio player in `ss_podcast` shortcode by default |
264 | 264 | $show_player = true; |
265 | - if( 'shortcode' == $context ) { |
|
265 | + if ( 'shortcode' == $context ) { |
|
266 | 266 | $show_player = false; |
267 | 267 | } |
268 | 268 | |
269 | 269 | // Allow media player to be dynamically hidden/displayed |
270 | - $show_player = apply_filters( 'ssp_show_media_player', $show_player, $context ); |
|
270 | + $show_player = apply_filters ( 'ssp_show_media_player', $show_player, $context ); |
|
271 | 271 | |
272 | 272 | // Show audio player if requested |
273 | - if( $show_player ) { |
|
274 | - $meta .= '<div class="podcast_player">' . $this->media_player( $file, $episode_id ) . '</div>'; |
|
273 | + if ( $show_player ) { |
|
274 | + $meta .= '<div class="podcast_player">'.$this->media_player ( $file, $episode_id ).'</div>'; |
|
275 | 275 | } |
276 | 276 | |
277 | - if ( apply_filters( 'ssp_show_episode_details', true, $episode_id, $context ) ) { |
|
278 | - $meta .= $this->episode_meta_details( $episode_id, $context ); |
|
277 | + if ( apply_filters ( 'ssp_show_episode_details', true, $episode_id, $context ) ) { |
|
278 | + $meta .= $this->episode_meta_details ( $episode_id, $context ); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
282 | - $meta = apply_filters( 'ssp_episode_meta', $meta, $episode_id, $context ); |
|
282 | + $meta = apply_filters ( 'ssp_episode_meta', $meta, $episode_id, $context ); |
|
283 | 283 | |
284 | 284 | return $meta; |
285 | 285 | } |
@@ -290,36 +290,36 @@ discard block |
||
290 | 290 | * @param string $context Context for display |
291 | 291 | * @return string Episode meta details |
292 | 292 | */ |
293 | - public function episode_meta_details ( $episode_id = 0, $context = 'content' ) { |
|
293 | + public function episode_meta_details( $episode_id = 0, $context = 'content' ) { |
|
294 | 294 | |
295 | 295 | if ( ! $episode_id ) { |
296 | 296 | return; |
297 | 297 | } |
298 | 298 | |
299 | - $file = $this->get_enclosure( $episode_id ); |
|
299 | + $file = $this->get_enclosure ( $episode_id ); |
|
300 | 300 | |
301 | 301 | if ( ! $file ) { |
302 | 302 | return; |
303 | 303 | } |
304 | 304 | |
305 | - $link = $this->get_episode_download_link( $episode_id, 'download' ); |
|
306 | - $duration = get_post_meta( $episode_id , 'duration' , true ); |
|
307 | - $size = get_post_meta( $episode_id , 'filesize' , true ); |
|
305 | + $link = $this->get_episode_download_link ( $episode_id, 'download' ); |
|
306 | + $duration = get_post_meta ( $episode_id, 'duration', true ); |
|
307 | + $size = get_post_meta ( $episode_id, 'filesize', true ); |
|
308 | 308 | if ( ! $size ) { |
309 | - $size_data = $this->get_file_size( $file ); |
|
310 | - $size = $size_data['formatted']; |
|
309 | + $size_data = $this->get_file_size ( $file ); |
|
310 | + $size = $size_data[ 'formatted' ]; |
|
311 | 311 | if ( $size ) { |
312 | - if ( isset( $size_data['formatted'] ) ) { |
|
313 | - update_post_meta( $episode_id, 'filesize', $size_data['formatted'] ); |
|
312 | + if ( isset( $size_data[ 'formatted' ] ) ) { |
|
313 | + update_post_meta ( $episode_id, 'filesize', $size_data[ 'formatted' ] ); |
|
314 | 314 | } |
315 | 315 | |
316 | - if ( isset( $size_data['raw'] ) ) { |
|
317 | - update_post_meta( $episode_id, 'filesize_raw', $size_data['raw'] ); |
|
316 | + if ( isset( $size_data[ 'raw' ] ) ) { |
|
317 | + update_post_meta ( $episode_id, 'filesize_raw', $size_data[ 'raw' ] ); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
322 | - $date_recorded = get_post_meta( $episode_id, 'date_recorded', true ); |
|
322 | + $date_recorded = get_post_meta ( $episode_id, 'date_recorded', true ); |
|
323 | 323 | |
324 | 324 | // Build up meta data array with default values |
325 | 325 | $meta = array( |
@@ -330,62 +330,62 @@ discard block |
||
330 | 330 | 'date_recorded' => '', |
331 | 331 | ); |
332 | 332 | |
333 | - if( $link ) { |
|
334 | - $meta['link'] = $link; |
|
333 | + if ( $link ) { |
|
334 | + $meta[ 'link' ] = $link; |
|
335 | 335 | } |
336 | 336 | |
337 | - if( $link && apply_filters( 'ssp_show_new_window_link', true, $context ) ) { |
|
338 | - $meta['new_window'] = true; |
|
337 | + if ( $link && apply_filters ( 'ssp_show_new_window_link', true, $context ) ) { |
|
338 | + $meta[ 'new_window' ] = true; |
|
339 | 339 | } |
340 | 340 | |
341 | - if( $link ) { |
|
342 | - $meta['duration'] = $duration; |
|
341 | + if ( $link ) { |
|
342 | + $meta[ 'duration' ] = $duration; |
|
343 | 343 | } |
344 | 344 | |
345 | - if( $size ) { |
|
346 | - $meta['size'] = $size; |
|
345 | + if ( $size ) { |
|
346 | + $meta[ 'size' ] = $size; |
|
347 | 347 | } |
348 | 348 | |
349 | - if( $date_recorded ) { |
|
350 | - $meta['date_recorded'] = $date_recorded; |
|
349 | + if ( $date_recorded ) { |
|
350 | + $meta[ 'date_recorded' ] = $date_recorded; |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | // Allow dynamic filtering of meta data - to remove, add or reorder meta items |
354 | - $meta = apply_filters( 'ssp_episode_meta_details', $meta, $episode_id, $context ); |
|
354 | + $meta = apply_filters ( 'ssp_episode_meta_details', $meta, $episode_id, $context ); |
|
355 | 355 | |
356 | 356 | $meta_display = ''; |
357 | - $meta_sep = apply_filters( 'ssp_episode_meta_separator', ' | ' ); |
|
357 | + $meta_sep = apply_filters ( 'ssp_episode_meta_separator', ' | ' ); |
|
358 | 358 | foreach ( $meta as $key => $data ) { |
359 | 359 | |
360 | - if( ! $data ) { |
|
360 | + if ( ! $data ) { |
|
361 | 361 | continue; |
362 | 362 | } |
363 | 363 | |
364 | - if( $meta_display ) { |
|
364 | + if ( $meta_display ) { |
|
365 | 365 | $meta_display .= $meta_sep; |
366 | 366 | } |
367 | 367 | |
368 | - switch( $key ) { |
|
368 | + switch ( $key ) { |
|
369 | 369 | |
370 | 370 | case 'link': |
371 | - $meta_display .= '<a href="' . esc_url( $data ) . '" title="' . get_the_title() . ' " class="podcast-meta-download" download>' . __( 'Download file' , 'seriously-simple-podcasting' ) . '</a>'; |
|
371 | + $meta_display .= '<a href="'.esc_url ( $data ).'" title="'.get_the_title ().' " class="podcast-meta-download" download>'.__ ( 'Download file', 'seriously-simple-podcasting' ).'</a>'; |
|
372 | 372 | break; |
373 | 373 | |
374 | 374 | case 'new_window': |
375 | - $play_link = add_query_arg( 'ref', 'new_window', $link ); |
|
376 | - $meta_display .= '<a href="' . esc_url( $play_link ) . '" target="_blank" title="' . get_the_title() . ' " class="podcast-meta-new-window">' . __( 'Play in new window' , 'seriously-simple-podcasting' ) . '</a>'; |
|
375 | + $play_link = add_query_arg ( 'ref', 'new_window', $link ); |
|
376 | + $meta_display .= '<a href="'.esc_url ( $play_link ).'" target="_blank" title="'.get_the_title ().' " class="podcast-meta-new-window">'.__ ( 'Play in new window', 'seriously-simple-podcasting' ).'</a>'; |
|
377 | 377 | break; |
378 | 378 | |
379 | 379 | case 'duration': |
380 | - $meta_display .= '<span class="podcast-meta-duration">' . __( 'Duration' , 'seriously-simple-podcasting' ) . ': ' . $data . '</span>'; |
|
380 | + $meta_display .= '<span class="podcast-meta-duration">'.__ ( 'Duration', 'seriously-simple-podcasting' ).': '.$data.'</span>'; |
|
381 | 381 | break; |
382 | 382 | |
383 | 383 | case 'size': |
384 | - $meta_display .= '<span class="podcast-meta-size">' . __( 'Size' , 'seriously-simple-podcasting' ) . ': ' . $data . '</span>'; |
|
384 | + $meta_display .= '<span class="podcast-meta-size">'.__ ( 'Size', 'seriously-simple-podcasting' ).': '.$data.'</span>'; |
|
385 | 385 | break; |
386 | 386 | |
387 | 387 | case 'date_recorded': |
388 | - $meta_display .= '<span class="podcast-meta-date">' . __( 'Recorded on' , 'seriously-simple-podcasting' ) . ' ' . date_i18n( get_option( 'date_format' ), strtotime( $data ) ) . '</span>'; |
|
388 | + $meta_display .= '<span class="podcast-meta-date">'.__ ( 'Recorded on', 'seriously-simple-podcasting' ).' '.date_i18n ( get_option ( 'date_format' ), strtotime ( $data ) ).'</span>'; |
|
389 | 389 | break; |
390 | 390 | |
391 | 391 | // Allow for custom items to be added, but only allow a small amount of HTML tags |
@@ -401,13 +401,13 @@ discard block |
||
401 | 401 | 'target' => array(), |
402 | 402 | ), |
403 | 403 | ); |
404 | - $meta_display .= wp_kses( $data, $allowed_tags ); |
|
404 | + $meta_display .= wp_kses ( $data, $allowed_tags ); |
|
405 | 405 | break; |
406 | 406 | |
407 | 407 | } |
408 | 408 | } |
409 | 409 | |
410 | - $meta_display = '<div class="podcast_meta"><aside>' . $meta_display . '</aside></div>'; |
|
410 | + $meta_display = '<div class="podcast_meta"><aside>'.$meta_display.'</aside></div>'; |
|
411 | 411 | |
412 | 412 | return $meta_display; |
413 | 413 | |
@@ -419,43 +419,43 @@ discard block |
||
419 | 419 | */ |
420 | 420 | public function add_to_home_query( $query ) { |
421 | 421 | |
422 | - if ( is_admin() ) { |
|
422 | + if ( is_admin () ) { |
|
423 | 423 | return; |
424 | 424 | } |
425 | 425 | |
426 | - $include_in_main_query = get_option('ss_podcasting_include_in_main_query'); |
|
426 | + $include_in_main_query = get_option ( 'ss_podcasting_include_in_main_query' ); |
|
427 | 427 | if ( $include_in_main_query && $include_in_main_query == 'on' ) { |
428 | - if ( $query->is_home() && $query->is_main_query() ) { |
|
429 | - $query->set( 'post_type', array( 'post', 'podcast' ) ); |
|
428 | + if ( $query->is_home () && $query->is_main_query () ) { |
|
429 | + $query->set ( 'post_type', array( 'post', 'podcast' ) ); |
|
430 | 430 | } |
431 | 431 | } |
432 | 432 | } |
433 | 433 | |
434 | - public function add_all_post_types ( $query ) { |
|
434 | + public function add_all_post_types( $query ) { |
|
435 | 435 | |
436 | - if ( is_admin() ) { |
|
436 | + if ( is_admin () ) { |
|
437 | 437 | return; |
438 | 438 | } |
439 | 439 | |
440 | - if ( ! $query->is_main_query() ) { |
|
440 | + if ( ! $query->is_main_query () ) { |
|
441 | 441 | return; |
442 | 442 | } |
443 | 443 | |
444 | - if ( is_post_type_archive( 'podcast' ) || is_tax( 'series' ) ) { |
|
444 | + if ( is_post_type_archive ( 'podcast' ) || is_tax ( 'series' ) ) { |
|
445 | 445 | |
446 | - $podcast_post_types = ssp_post_types( false ); |
|
446 | + $podcast_post_types = ssp_post_types ( false ); |
|
447 | 447 | |
448 | 448 | if ( empty( $podcast_post_types ) ) { |
449 | 449 | return; |
450 | 450 | } |
451 | 451 | |
452 | - $episode_ids = ssp_episode_ids(); |
|
452 | + $episode_ids = ssp_episode_ids (); |
|
453 | 453 | if ( ! empty( $episode_ids ) ) { |
454 | 454 | |
455 | - $query->set( 'post__in', $episode_ids ); |
|
455 | + $query->set ( 'post__in', $episode_ids ); |
|
456 | 456 | |
457 | - $podcast_post_types[] = 'podcast'; |
|
458 | - $query->set( 'post_type', $podcast_post_types ); |
|
457 | + $podcast_post_types[ ] = 'podcast'; |
|
458 | + $query->set ( 'post_type', $podcast_post_types ); |
|
459 | 459 | |
460 | 460 | } |
461 | 461 | |
@@ -473,29 +473,29 @@ discard block |
||
473 | 473 | if ( $file ) { |
474 | 474 | |
475 | 475 | // Include media functions if necessary |
476 | - if ( ! function_exists( 'wp_read_audio_metadata' ) ) { |
|
477 | - require_once( ABSPATH . 'wp-admin/includes/media.php' ); |
|
476 | + if ( ! function_exists ( 'wp_read_audio_metadata' ) ) { |
|
477 | + require_once( ABSPATH.'wp-admin/includes/media.php' ); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | // translate file URL to local file path if possible |
481 | - $file = $this->get_local_file_path( $file ); |
|
481 | + $file = $this->get_local_file_path ( $file ); |
|
482 | 482 | |
483 | 483 | // Get file data (for local file) |
484 | - $data = wp_read_audio_metadata( $file ); |
|
484 | + $data = wp_read_audio_metadata ( $file ); |
|
485 | 485 | |
486 | 486 | $raw = $formatted = ''; |
487 | 487 | |
488 | 488 | if ( $data ) { |
489 | - $raw = $data['filesize']; |
|
490 | - $formatted = $this->format_bytes( $raw ); |
|
489 | + $raw = $data[ 'filesize' ]; |
|
490 | + $formatted = $this->format_bytes ( $raw ); |
|
491 | 491 | } else { |
492 | 492 | |
493 | 493 | // get file data (for remote file) |
494 | - $data = wp_remote_head( $file, array( 'timeout' => 10, 'redirection' => 5 ) ); |
|
494 | + $data = wp_remote_head ( $file, array( 'timeout' => 10, 'redirection' => 5 ) ); |
|
495 | 495 | |
496 | - if ( ! is_wp_error( $data ) && is_array( $data ) && isset( $data['headers']['content-length'] ) ) { |
|
497 | - $raw = $data['headers']['content-length']; |
|
498 | - $formatted = $this->format_bytes( $raw ); |
|
496 | + if ( ! is_wp_error ( $data ) && is_array ( $data ) && isset( $data[ 'headers' ][ 'content-length' ] ) ) { |
|
497 | + $raw = $data[ 'headers' ][ 'content-length' ]; |
|
498 | + $formatted = $this->format_bytes ( $raw ); |
|
499 | 499 | } |
500 | 500 | } |
501 | 501 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | 'formatted' => $formatted |
507 | 507 | ); |
508 | 508 | |
509 | - return apply_filters( 'ssp_file_size', $size, $file ); |
|
509 | + return apply_filters ( 'ssp_file_size', $size, $file ); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | } |
@@ -524,30 +524,30 @@ discard block |
||
524 | 524 | if ( $file ) { |
525 | 525 | |
526 | 526 | // Include media functions if necessary |
527 | - if ( ! function_exists( 'wp_read_audio_metadata' ) ) { |
|
528 | - require_once( ABSPATH . 'wp-admin/includes/media.php' ); |
|
527 | + if ( ! function_exists ( 'wp_read_audio_metadata' ) ) { |
|
528 | + require_once( ABSPATH.'wp-admin/includes/media.php' ); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | // translate file URL to local file path if possible |
532 | - $file = $this->get_local_file_path( $file ); |
|
532 | + $file = $this->get_local_file_path ( $file ); |
|
533 | 533 | |
534 | 534 | // Get file data (will only work for local files) |
535 | - $data = wp_read_audio_metadata( $file ); |
|
535 | + $data = wp_read_audio_metadata ( $file ); |
|
536 | 536 | |
537 | 537 | $duration = false; |
538 | 538 | |
539 | 539 | if ( $data ) { |
540 | - if ( isset( $data['length_formatted'] ) && strlen( $data['length_formatted'] ) > 0 ) { |
|
541 | - $duration = $data['length_formatted']; |
|
540 | + if ( isset( $data[ 'length_formatted' ] ) && strlen ( $data[ 'length_formatted' ] ) > 0 ) { |
|
541 | + $duration = $data[ 'length_formatted' ]; |
|
542 | 542 | } else { |
543 | - if ( isset( $data['length'] ) && strlen( $data['length'] ) > 0 ) { |
|
544 | - $duration = gmdate( 'H:i:s', $data['length'] ); |
|
543 | + if ( isset( $data[ 'length' ] ) && strlen ( $data[ 'length' ] ) > 0 ) { |
|
544 | + $duration = gmdate ( 'H:i:s', $data[ 'length' ] ); |
|
545 | 545 | } |
546 | 546 | } |
547 | 547 | } |
548 | 548 | |
549 | 549 | if ( $data ) { |
550 | - return apply_filters( 'ssp_file_duration', $duration, $file ); |
|
550 | + return apply_filters ( 'ssp_file_duration', $duration, $file ); |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | } |
@@ -561,15 +561,15 @@ discard block |
||
561 | 561 | * @param integer $precision Level of precision for formatting |
562 | 562 | * @return mixed Formatted file size on success, false on failure |
563 | 563 | */ |
564 | - protected function format_bytes( $size , $precision = 2 ) { |
|
564 | + protected function format_bytes( $size, $precision = 2 ) { |
|
565 | 565 | |
566 | 566 | if ( $size ) { |
567 | 567 | |
568 | - $base = log ( $size ) / log( 1024 ); |
|
569 | - $suffixes = array( '' , 'k' , 'M' , 'G' , 'T' ); |
|
570 | - $formatted_size = round( pow( 1024 , $base - floor( $base ) ) , $precision ) . $suffixes[ floor( $base ) ]; |
|
568 | + $base = log ( $size ) / log ( 1024 ); |
|
569 | + $suffixes = array( '', 'k', 'M', 'G', 'T' ); |
|
570 | + $formatted_size = round ( pow ( 1024, $base - floor ( $base ) ), $precision ).$suffixes[ floor ( $base ) ]; |
|
571 | 571 | |
572 | - return apply_filters( 'ssp_file_size_formatted', $formatted_size, $size ); |
|
572 | + return apply_filters ( 'ssp_file_size_formatted', $formatted_size, $size ); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | return false; |
@@ -585,10 +585,10 @@ discard block |
||
585 | 585 | |
586 | 586 | // Let's hash the URL to ensure that we don't get |
587 | 587 | // any illegal chars that might break the cache. |
588 | - $key = md5( $url ); |
|
588 | + $key = md5 ( $url ); |
|
589 | 589 | |
590 | 590 | // Do we have anything in the cache for this URL? |
591 | - $attachment_id = wp_cache_get( $key, 'attachment_id' ); |
|
591 | + $attachment_id = wp_cache_get ( $key, 'attachment_id' ); |
|
592 | 592 | |
593 | 593 | if ( $attachment_id === false ) { |
594 | 594 | |
@@ -605,39 +605,39 @@ discard block |
||
605 | 605 | |
606 | 606 | |
607 | 607 | // Function introduced in 4.0, let's try this first. |
608 | - if ( function_exists( 'attachment_url_to_postid' ) ) { |
|
609 | - $attachment_id = absint( attachment_url_to_postid( $url ) ); |
|
608 | + if ( function_exists ( 'attachment_url_to_postid' ) ) { |
|
609 | + $attachment_id = absint ( attachment_url_to_postid ( $url ) ); |
|
610 | 610 | if ( 0 !== $attachment_id ) { |
611 | - wp_cache_set( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
611 | + wp_cache_set ( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
612 | 612 | return $attachment_id; |
613 | 613 | } |
614 | 614 | } |
615 | 615 | |
616 | 616 | // Then this. |
617 | - if ( preg_match( '#\.[a-zA-Z0-9]+$#', $url ) ) { |
|
618 | - $sql = $wpdb->prepare( |
|
617 | + if ( preg_match ( '#\.[a-zA-Z0-9]+$#', $url ) ) { |
|
618 | + $sql = $wpdb->prepare ( |
|
619 | 619 | "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND guid = %s", |
620 | - esc_url_raw( $url ) |
|
620 | + esc_url_raw ( $url ) |
|
621 | 621 | ); |
622 | - $attachment_id = absint( $wpdb->get_var( $sql ) ); |
|
622 | + $attachment_id = absint ( $wpdb->get_var ( $sql ) ); |
|
623 | 623 | if ( 0 !== $attachment_id ) { |
624 | - wp_cache_set( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
624 | + wp_cache_set ( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
625 | 625 | return $attachment_id; |
626 | 626 | } |
627 | 627 | } |
628 | 628 | |
629 | 629 | // And then try this |
630 | - $upload_dir_paths = wp_upload_dir(); |
|
631 | - if ( false !== strpos( $url, $upload_dir_paths['baseurl'] ) ) { |
|
630 | + $upload_dir_paths = wp_upload_dir (); |
|
631 | + if ( false !== strpos ( $url, $upload_dir_paths[ 'baseurl' ] ) ) { |
|
632 | 632 | // Ensure that we have file extension that matches iTunes. |
633 | - $url = preg_replace( '/(?=\.(m4a|mp3|mov|mp4)$)/i', '', $url ); |
|
633 | + $url = preg_replace ( '/(?=\.(m4a|mp3|mov|mp4)$)/i', '', $url ); |
|
634 | 634 | // Remove the upload path base directory from the attachment URL |
635 | - $url = str_replace( $upload_dir_paths['baseurl'] . '/', '', $url ); |
|
635 | + $url = str_replace ( $upload_dir_paths[ 'baseurl' ].'/', '', $url ); |
|
636 | 636 | // Finally, run a custom database query to get the attachment ID from the modified attachment URL |
637 | - $sql = $wpdb->prepare( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $url ); |
|
638 | - $attachment_id = absint( $wpdb->get_var( $sql ) ); |
|
637 | + $sql = $wpdb->prepare ( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $url ); |
|
638 | + $attachment_id = absint ( $wpdb->get_var ( $sql ) ); |
|
639 | 639 | if ( 0 !== $attachment_id ) { |
640 | - wp_cache_set( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
640 | + wp_cache_set ( $key, $attachment_id, 'attachment_id', DAY_IN_SECONDS ); |
|
641 | 641 | return $attachment_id; |
642 | 642 | } |
643 | 643 | } |
@@ -655,20 +655,20 @@ discard block |
||
655 | 655 | public function get_attachment_mimetype( $attachment = '' ) { |
656 | 656 | |
657 | 657 | // Let's hash the URL to ensure that we don't get any illegal chars that might break the cache. |
658 | - $key = md5( $attachment ); |
|
658 | + $key = md5 ( $attachment ); |
|
659 | 659 | |
660 | 660 | if ( $attachment ) { |
661 | 661 | // Do we have anything in the cache for this? |
662 | - $mime = wp_cache_get( $key, 'mime-type' ); |
|
662 | + $mime = wp_cache_get ( $key, 'mime-type' ); |
|
663 | 663 | if ( $mime === false ) { |
664 | 664 | |
665 | 665 | // Get the ID |
666 | - $id = $this->get_attachment_id_from_url( $attachment ); |
|
666 | + $id = $this->get_attachment_id_from_url ( $attachment ); |
|
667 | 667 | |
668 | 668 | // Get the MIME type |
669 | - $mime = get_post_mime_type( $id ); |
|
669 | + $mime = get_post_mime_type ( $id ); |
|
670 | 670 | // Set the cache |
671 | - wp_cache_set( $key, $mime, 'mime-type', DAY_IN_SECONDS ); |
|
671 | + wp_cache_set ( $key, $mime, 'mime-type', DAY_IN_SECONDS ); |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | return $mime; |
@@ -685,8 +685,8 @@ discard block |
||
685 | 685 | * @return string Audio player HTML on success, false on failure |
686 | 686 | */ |
687 | 687 | public function audio_player( $src = '', $episode_id = 0 ) { |
688 | - $player = $this->media_player( $src, $episode_id ); |
|
689 | - return apply_filters( 'ssp_audio_player', $player, $src, $episode_id ); |
|
688 | + $player = $this->media_player ( $src, $episode_id ); |
|
689 | + return apply_filters ( 'ssp_audio_player', $player, $src, $episode_id ); |
|
690 | 690 | } |
691 | 691 | |
692 | 692 | /** |
@@ -695,40 +695,40 @@ discard block |
||
695 | 695 | * @param integer $episode_id Episode ID for audio file |
696 | 696 | * @return string Media player HTML on success, empty string on failure |
697 | 697 | */ |
698 | - public function media_player ( $src = '', $episode_id = 0 ) { |
|
698 | + public function media_player( $src = '', $episode_id = 0 ) { |
|
699 | 699 | $player = ''; |
700 | 700 | |
701 | 701 | if ( $src ) { |
702 | 702 | |
703 | 703 | // Get episode type and default to audio |
704 | - $type = $this->get_episode_type( $episode_id ); |
|
705 | - if( ! $type ) { |
|
704 | + $type = $this->get_episode_type ( $episode_id ); |
|
705 | + if ( ! $type ) { |
|
706 | 706 | $type = 'audio'; |
707 | 707 | } |
708 | 708 | |
709 | 709 | // Switch to podcast player URL |
710 | - $src = str_replace( 'podcast-download', 'podcast-player', $src ); |
|
710 | + $src = str_replace ( 'podcast-download', 'podcast-player', $src ); |
|
711 | 711 | |
712 | 712 | // Set up paramters for media player |
713 | 713 | $params = array( 'src' => $src, 'preload' => 'none' ); |
714 | 714 | |
715 | 715 | // Use built-in WordPress media player |
716 | - switch( $type ) { |
|
717 | - case 'audio': $player = wp_audio_shortcode( $params ); break; |
|
716 | + switch ( $type ) { |
|
717 | + case 'audio': $player = wp_audio_shortcode ( $params ); break; |
|
718 | 718 | case 'video': |
719 | 719 | // Use featured image as video poster |
720 | - if( $episode_id && has_post_thumbnail( $episode_id ) ) { |
|
721 | - $poster = wp_get_attachment_url( get_post_thumbnail_id( $episode_id ) ); |
|
722 | - if( $poster ) { |
|
723 | - $params['poster'] = $poster; |
|
720 | + if ( $episode_id && has_post_thumbnail ( $episode_id ) ) { |
|
721 | + $poster = wp_get_attachment_url ( get_post_thumbnail_id ( $episode_id ) ); |
|
722 | + if ( $poster ) { |
|
723 | + $params[ 'poster' ] = $poster; |
|
724 | 724 | } |
725 | 725 | } |
726 | - $player = wp_video_shortcode( $params ); |
|
726 | + $player = wp_video_shortcode ( $params ); |
|
727 | 727 | break; |
728 | 728 | } |
729 | 729 | |
730 | 730 | // Allow filtering so that alternative players can be used |
731 | - $player = apply_filters( 'ssp_media_player', $player, $src, $episode_id ); |
|
731 | + $player = apply_filters ( 'ssp_media_player', $player, $src, $episode_id ); |
|
732 | 732 | } |
733 | 733 | |
734 | 734 | return $player; |
@@ -743,17 +743,17 @@ discard block |
||
743 | 743 | public function get_image( $id = 0, $size = 'full' ) { |
744 | 744 | $image = ''; |
745 | 745 | |
746 | - if ( has_post_thumbnail( $id ) ) { |
|
746 | + if ( has_post_thumbnail ( $id ) ) { |
|
747 | 747 | // If not a string or an array, and not an integer, default to 200x9999. |
748 | - if ( is_int( $size ) || ( 0 < intval( $size ) ) ) { |
|
749 | - $size = array( intval( $size ), intval( $size ) ); |
|
750 | - } elseif ( ! is_string( $size ) && ! is_array( $size ) ) { |
|
748 | + if ( is_int ( $size ) || ( 0 < intval ( $size ) ) ) { |
|
749 | + $size = array( intval ( $size ), intval ( $size ) ); |
|
750 | + } elseif ( ! is_string ( $size ) && ! is_array ( $size ) ) { |
|
751 | 751 | $size = array( 200, 9999 ); |
752 | 752 | } |
753 | - $image = get_the_post_thumbnail( intval( $id ), $size ); |
|
753 | + $image = get_the_post_thumbnail ( intval ( $id ), $size ); |
|
754 | 754 | } |
755 | 755 | |
756 | - return apply_filters( 'ssp_episode_image', $image, $id ); |
|
756 | + return apply_filters ( 'ssp_episode_image', $image, $id ); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | /** |
@@ -768,29 +768,29 @@ discard block |
||
768 | 768 | 'series' => '' |
769 | 769 | ); |
770 | 770 | |
771 | - $args = apply_filters( 'ssp_get_podcast_args', wp_parse_args( $args, $defaults ) ); |
|
771 | + $args = apply_filters ( 'ssp_get_podcast_args', wp_parse_args ( $args, $defaults ) ); |
|
772 | 772 | |
773 | 773 | $query = array(); |
774 | 774 | |
775 | - if ( 'episodes' == $args['content'] ) { |
|
775 | + if ( 'episodes' == $args[ 'content' ] ) { |
|
776 | 776 | |
777 | 777 | // Get selected series |
778 | 778 | $podcast_series = ''; |
779 | - if ( isset( $args['series'] ) && $args['series'] ) { |
|
780 | - $podcast_series = $args['series']; |
|
779 | + if ( isset( $args[ 'series' ] ) && $args[ 'series' ] ) { |
|
780 | + $podcast_series = $args[ 'series' ]; |
|
781 | 781 | } |
782 | 782 | |
783 | 783 | // Get query args |
784 | - $query_args = apply_filters( 'ssp_get_podcast_query_args', ssp_episodes( -1, $podcast_series, true, '' ) ); |
|
784 | + $query_args = apply_filters ( 'ssp_get_podcast_query_args', ssp_episodes ( -1, $podcast_series, true, '' ) ); |
|
785 | 785 | |
786 | 786 | // The Query |
787 | - $query = get_posts( $query_args ); |
|
787 | + $query = get_posts ( $query_args ); |
|
788 | 788 | |
789 | 789 | // The Display |
790 | - if ( ! is_wp_error( $query ) && is_array( $query ) && count( $query ) > 0 ) { |
|
790 | + if ( ! is_wp_error ( $query ) && is_array ( $query ) && count ( $query ) > 0 ) { |
|
791 | 791 | foreach ( $query as $k => $v ) { |
792 | 792 | // Get the URL |
793 | - $query[$k]->url = get_permalink( $v->ID ); |
|
793 | + $query[ $k ]->url = get_permalink ( $v->ID ); |
|
794 | 794 | } |
795 | 795 | } else { |
796 | 796 | $query = false; |
@@ -798,27 +798,27 @@ discard block |
||
798 | 798 | |
799 | 799 | } else { |
800 | 800 | |
801 | - $terms = get_terms( 'series' ); |
|
801 | + $terms = get_terms ( 'series' ); |
|
802 | 802 | |
803 | - if ( count( $terms ) > 0) { |
|
803 | + if ( count ( $terms ) > 0 ) { |
|
804 | 804 | |
805 | 805 | foreach ( $terms as $term ) { |
806 | - $query[ $term->term_id ] = new stdClass(); |
|
806 | + $query[ $term->term_id ] = new stdClass (); |
|
807 | 807 | $query[ $term->term_id ]->title = $term->name; |
808 | - $query[ $term->term_id ]->url = get_term_link( $term ); |
|
808 | + $query[ $term->term_id ]->url = get_term_link ( $term ); |
|
809 | 809 | |
810 | - $query_args = apply_filters( 'ssp_get_podcast_series_query_args', ssp_episodes( -1, $term->slug, true, '' ) ); |
|
810 | + $query_args = apply_filters ( 'ssp_get_podcast_series_query_args', ssp_episodes ( -1, $term->slug, true, '' ) ); |
|
811 | 811 | |
812 | - $posts = get_posts( $query_args ); |
|
812 | + $posts = get_posts ( $query_args ); |
|
813 | 813 | |
814 | - $count = count( $posts ); |
|
814 | + $count = count ( $posts ); |
|
815 | 815 | $query[ $term->term_id ]->count = $count; |
816 | 816 | } |
817 | 817 | } |
818 | 818 | |
819 | 819 | } |
820 | 820 | |
821 | - $query['content'] = $args['content']; |
|
821 | + $query[ 'content' ] = $args[ 'content' ]; |
|
822 | 822 | |
823 | 823 | return $query; |
824 | 824 | } |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | public function get_enclosure( $episode_id = 0 ) { |
832 | 832 | |
833 | 833 | if ( $episode_id ) { |
834 | - return apply_filters( 'ssp_episode_enclosure', get_post_meta( $episode_id, 'audio_file', true ), $episode_id ); |
|
834 | + return apply_filters ( 'ssp_episode_enclosure', get_post_meta ( $episode_id, 'audio_file', true ), $episode_id ); |
|
835 | 835 | } |
836 | 836 | |
837 | 837 | return ''; |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | |
850 | 850 | if ( $file != '' ) { |
851 | 851 | |
852 | - $post_types = ssp_post_types( true ); |
|
852 | + $post_types = ssp_post_types ( true ); |
|
853 | 853 | |
854 | 854 | $args = array( |
855 | 855 | 'post_type' => $post_types, |
@@ -859,17 +859,17 @@ discard block |
||
859 | 859 | 'meta_value' => $file |
860 | 860 | ); |
861 | 861 | |
862 | - $qry = new WP_Query( $args ); |
|
862 | + $qry = new WP_Query ( $args ); |
|
863 | 863 | |
864 | - if ( $qry->have_posts() ) { |
|
865 | - while ( $qry->have_posts() ) { $qry->the_post(); |
|
864 | + if ( $qry->have_posts () ) { |
|
865 | + while ( $qry->have_posts () ) { $qry->the_post (); |
|
866 | 866 | $episode = $post; |
867 | 867 | break; |
868 | 868 | } |
869 | 869 | } |
870 | 870 | } |
871 | 871 | |
872 | - return apply_filters( 'ssp_episode_from_file', $episode, $file ); |
|
872 | + return apply_filters ( 'ssp_episode_from_file', $episode, $file ); |
|
873 | 873 | |
874 | 874 | } |
875 | 875 | |
@@ -879,33 +879,33 @@ discard block |
||
879 | 879 | */ |
880 | 880 | public function download_file() { |
881 | 881 | |
882 | - if ( is_podcast_download() ) { |
|
882 | + if ( is_podcast_download () ) { |
|
883 | 883 | global $wp_query; |
884 | 884 | |
885 | 885 | // Get requested episode ID |
886 | - $episode_id = intval( $wp_query->query_vars['podcast_episode'] ); |
|
886 | + $episode_id = intval ( $wp_query->query_vars[ 'podcast_episode' ] ); |
|
887 | 887 | |
888 | 888 | if ( isset( $episode_id ) && $episode_id ) { |
889 | 889 | |
890 | 890 | // Get episode post object |
891 | - $episode = get_post( $episode_id ); |
|
891 | + $episode = get_post ( $episode_id ); |
|
892 | 892 | |
893 | 893 | // Make sure we have a valid episode post object |
894 | - if ( ! $episode || ! is_object( $episode ) || is_wp_error( $episode ) || ! isset( $episode->ID ) ) { |
|
894 | + if ( ! $episode || ! is_object ( $episode ) || is_wp_error ( $episode ) || ! isset( $episode->ID ) ) { |
|
895 | 895 | return; |
896 | 896 | } |
897 | 897 | |
898 | 898 | // Do we have newlines? |
899 | 899 | $parts = false; |
900 | - if( is_string( $episode ) ) { |
|
901 | - $parts = explode( "\n", $episode ); |
|
900 | + if ( is_string ( $episode ) ) { |
|
901 | + $parts = explode ( "\n", $episode ); |
|
902 | 902 | } |
903 | 903 | |
904 | - if ( $parts && is_array( $parts ) && count( $parts ) > 1 ) { |
|
905 | - $file = $parts[0]; |
|
904 | + if ( $parts && is_array ( $parts ) && count ( $parts ) > 1 ) { |
|
905 | + $file = $parts[ 0 ]; |
|
906 | 906 | } else { |
907 | 907 | // Get audio file for download |
908 | - $file = $this->get_enclosure( $episode_id ); |
|
908 | + $file = $this->get_enclosure ( $episode_id ); |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | // Exit if no file is found |
@@ -915,77 +915,77 @@ discard block |
||
915 | 915 | |
916 | 916 | // Get file referrer |
917 | 917 | $referrer = ''; |
918 | - if( isset( $wp_query->query_vars['podcast_ref'] ) && $wp_query->query_vars['podcast_ref'] ) { |
|
919 | - $referrer = $wp_query->query_vars['podcast_ref']; |
|
918 | + if ( isset( $wp_query->query_vars[ 'podcast_ref' ] ) && $wp_query->query_vars[ 'podcast_ref' ] ) { |
|
919 | + $referrer = $wp_query->query_vars[ 'podcast_ref' ]; |
|
920 | 920 | } else { |
921 | - if( isset( $_GET['ref'] ) ) { |
|
922 | - $referrer = esc_attr( $_GET['ref'] ); |
|
921 | + if ( isset( $_GET[ 'ref' ] ) ) { |
|
922 | + $referrer = esc_attr ( $_GET[ 'ref' ] ); |
|
923 | 923 | } |
924 | 924 | } |
925 | 925 | |
926 | 926 | // Allow other actions - functions hooked on here must not output any data |
927 | - do_action( 'ssp_file_download', $file, $episode, $referrer ); |
|
927 | + do_action ( 'ssp_file_download', $file, $episode, $referrer ); |
|
928 | 928 | |
929 | 929 | // Set necessary headers |
930 | - header( "Pragma: no-cache" ); |
|
931 | - header( "Expires: 0" ); |
|
932 | - header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); |
|
933 | - header( "Robots: none" ); |
|
930 | + header ( "Pragma: no-cache" ); |
|
931 | + header ( "Expires: 0" ); |
|
932 | + header ( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); |
|
933 | + header ( "Robots: none" ); |
|
934 | 934 | |
935 | 935 | // Check file referrer |
936 | - if( 'download' == $referrer ) { |
|
936 | + if ( 'download' == $referrer ) { |
|
937 | 937 | |
938 | 938 | // Set size of file |
939 | 939 | // Do we have anything in Cache/DB? |
940 | - $size = wp_cache_get( $episode_id, 'filesize_raw' ); |
|
940 | + $size = wp_cache_get ( $episode_id, 'filesize_raw' ); |
|
941 | 941 | |
942 | 942 | // Nothing in the cache, let's see if we can figure it out. |
943 | 943 | if ( false === $size ) { |
944 | 944 | |
945 | 945 | // Do we have anything in post_meta? |
946 | - $size = get_post_meta( $episode_id, 'filesize_raw', true ); |
|
946 | + $size = get_post_meta ( $episode_id, 'filesize_raw', true ); |
|
947 | 947 | |
948 | 948 | if ( empty( $size ) ) { |
949 | 949 | |
950 | 950 | // Let's see if we can figure out the path... |
951 | - $attachment_id = $this->get_attachment_id_from_url( $file ); |
|
951 | + $attachment_id = $this->get_attachment_id_from_url ( $file ); |
|
952 | 952 | |
953 | - if ( ! empty( $attachment_id ) ) { |
|
954 | - $size = filesize( get_attached_file( $attachment_id ) ); |
|
955 | - update_post_meta( $episode_id, 'filesize_raw', $size ); |
|
953 | + if ( ! empty( $attachment_id ) ) { |
|
954 | + $size = filesize ( get_attached_file ( $attachment_id ) ); |
|
955 | + update_post_meta ( $episode_id, 'filesize_raw', $size ); |
|
956 | 956 | } |
957 | 957 | |
958 | 958 | } |
959 | 959 | |
960 | 960 | // Update the cache |
961 | - wp_cache_set( $episode_id, $size, 'filesize_raw' ); |
|
961 | + wp_cache_set ( $episode_id, $size, 'filesize_raw' ); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | // Send Content-Length header |
965 | 965 | if ( ! empty( $size ) ) { |
966 | - header( "Content-Length: " . $size ); |
|
966 | + header ( "Content-Length: ".$size ); |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | // Force file download |
970 | - header( "Content-Type: application/force-download" ); |
|
970 | + header ( "Content-Type: application/force-download" ); |
|
971 | 971 | |
972 | 972 | // Set other relevant headers |
973 | - header( "Content-Description: File Transfer" ); |
|
974 | - header( "Content-Disposition: attachment; filename=\"" . basename( $file ) . "\";" ); |
|
975 | - header( "Content-Transfer-Encoding: binary" ); |
|
973 | + header ( "Content-Description: File Transfer" ); |
|
974 | + header ( "Content-Disposition: attachment; filename=\"".basename ( $file )."\";" ); |
|
975 | + header ( "Content-Transfer-Encoding: binary" ); |
|
976 | 976 | |
977 | 977 | // Encode spaces in file names until this is fixed in core (https://core.trac.wordpress.org/ticket/36998) |
978 | - $file = str_replace( ' ', '%20', $file ); |
|
978 | + $file = str_replace ( ' ', '%20', $file ); |
|
979 | 979 | |
980 | 980 | // Use ssp_readfile_chunked() if allowed on the server or simply access file directly |
981 | - @ssp_readfile_chunked( $file ) or header( 'Location: ' . $file ); |
|
981 | + @ssp_readfile_chunked ( $file ) or header ( 'Location: '.$file ); |
|
982 | 982 | } else { |
983 | 983 | |
984 | 984 | // Encode spaces in file names until this is fixed in core (https://core.trac.wordpress.org/ticket/36998) |
985 | - $file = str_replace( ' ', '%20', $file ); |
|
985 | + $file = str_replace ( ' ', '%20', $file ); |
|
986 | 986 | |
987 | 987 | // For all other referrers redirect to the raw file |
988 | - wp_redirect( $file, 302 ); |
|
988 | + wp_redirect ( $file, 302 ); |
|
989 | 989 | } |
990 | 990 | |
991 | 991 | // Exit to prevent other processes running later on |
@@ -1002,16 +1002,16 @@ discard block |
||
1002 | 1002 | public function generator_tag( $gen, $type ) { |
1003 | 1003 | |
1004 | 1004 | // Allow generator tags to be hidden if necessary |
1005 | - if ( apply_filters( 'ssp_show_generator_tag', true, $type ) ) { |
|
1005 | + if ( apply_filters ( 'ssp_show_generator_tag', true, $type ) ) { |
|
1006 | 1006 | |
1007 | - $generator = 'Seriously Simple Podcasting ' . esc_attr( $this->version ); |
|
1007 | + $generator = 'Seriously Simple Podcasting '.esc_attr ( $this->version ); |
|
1008 | 1008 | |
1009 | 1009 | switch ( $type ) { |
1010 | 1010 | case 'html': |
1011 | - $gen .= "\n" . '<meta name="generator" content="' . $generator . '">'; |
|
1011 | + $gen .= "\n".'<meta name="generator" content="'.$generator.'">'; |
|
1012 | 1012 | break; |
1013 | 1013 | case 'xhtml': |
1014 | - $gen .= "\n" . '<meta name="generator" content="' . $generator . '" />'; |
|
1014 | + $gen .= "\n".'<meta name="generator" content="'.$generator.'" />'; |
|
1015 | 1015 | break; |
1016 | 1016 | } |
1017 | 1017 | |
@@ -1027,53 +1027,53 @@ discard block |
||
1027 | 1027 | public function rss_meta_tag() { |
1028 | 1028 | |
1029 | 1029 | // Get feed slug |
1030 | - $feed_slug = apply_filters( 'ssp_feed_slug', $this->token ); |
|
1030 | + $feed_slug = apply_filters ( 'ssp_feed_slug', $this->token ); |
|
1031 | 1031 | |
1032 | - if ( get_option( 'permalink_structure' ) ) { |
|
1033 | - $feed_url = $this->home_url . 'feed/' . $feed_slug; |
|
1032 | + if ( get_option ( 'permalink_structure' ) ) { |
|
1033 | + $feed_url = $this->home_url.'feed/'.$feed_slug; |
|
1034 | 1034 | } else { |
1035 | - $feed_url = $this->home_url . '?feed=' . $feed_slug; |
|
1035 | + $feed_url = $this->home_url.'?feed='.$feed_slug; |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | - $custom_feed_url = get_option( 'ss_podcasting_feed_url' ); |
|
1038 | + $custom_feed_url = get_option ( 'ss_podcasting_feed_url' ); |
|
1039 | 1039 | if ( $custom_feed_url ) { |
1040 | 1040 | $feed_url = $custom_feed_url; |
1041 | 1041 | } |
1042 | 1042 | |
1043 | - $feed_url = apply_filters( 'ssp_feed_url', $feed_url ); |
|
1043 | + $feed_url = apply_filters ( 'ssp_feed_url', $feed_url ); |
|
1044 | 1044 | |
1045 | 1045 | $html = ''; |
1046 | 1046 | |
1047 | - if( apply_filters( 'ssp_show_global_feed_tag', true ) ) { |
|
1048 | - $html = '<link rel="alternate" type="application/rss+xml" title="' . __( 'Podcast RSS feed', 'seriously-simple-podcasting' ) . '" href="' . esc_url( $feed_url ) . '" />'; |
|
1047 | + if ( apply_filters ( 'ssp_show_global_feed_tag', true ) ) { |
|
1048 | + $html = '<link rel="alternate" type="application/rss+xml" title="'.__ ( 'Podcast RSS feed', 'seriously-simple-podcasting' ).'" href="'.esc_url ( $feed_url ).'" />'; |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | // Check if this is a series taxonomy archive and display series-specific RSS feed tag |
1052 | - $current_obj = get_queried_object(); |
|
1053 | - if( isset( $current_obj->taxonomy ) && 'series' == $current_obj->taxonomy && isset( $current_obj->slug ) && $current_obj->slug ) { |
|
1052 | + $current_obj = get_queried_object (); |
|
1053 | + if ( isset( $current_obj->taxonomy ) && 'series' == $current_obj->taxonomy && isset( $current_obj->slug ) && $current_obj->slug ) { |
|
1054 | 1054 | |
1055 | - if( apply_filters( 'ssp_show_series_feed_tag', true, $current_obj->slug ) ) { |
|
1055 | + if ( apply_filters ( 'ssp_show_series_feed_tag', true, $current_obj->slug ) ) { |
|
1056 | 1056 | |
1057 | - if ( get_option( 'permalink_structure' ) ) { |
|
1058 | - $series_feed_url = $feed_url . '/' . $current_obj->slug; |
|
1057 | + if ( get_option ( 'permalink_structure' ) ) { |
|
1058 | + $series_feed_url = $feed_url.'/'.$current_obj->slug; |
|
1059 | 1059 | } else { |
1060 | - $series_feed_url = $feed_url . '&podcast_series=' . $current_obj->slug; |
|
1060 | + $series_feed_url = $feed_url.'&podcast_series='.$current_obj->slug; |
|
1061 | 1061 | } |
1062 | 1062 | |
1063 | - $html .= "\n" . '<link rel="alternate" type="application/rss+xml" title="' . sprintf( __( '%s RSS feed', 'seriously-simple-podcasting' ), $current_obj->name ) . '" href="' . esc_url( $series_feed_url ) . '" />'; |
|
1063 | + $html .= "\n".'<link rel="alternate" type="application/rss+xml" title="'.sprintf ( __ ( '%s RSS feed', 'seriously-simple-podcasting' ), $current_obj->name ).'" href="'.esc_url ( $series_feed_url ).'" />'; |
|
1064 | 1064 | |
1065 | 1065 | } |
1066 | 1066 | |
1067 | 1067 | } |
1068 | 1068 | |
1069 | - echo "\n" . apply_filters( 'ssp_rss_meta_tag', $html ) . "\n\n"; |
|
1069 | + echo "\n".apply_filters ( 'ssp_rss_meta_tag', $html )."\n\n"; |
|
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | /** |
1073 | 1073 | * Register plugin widgets |
1074 | 1074 | * @return void |
1075 | 1075 | */ |
1076 | - public function register_widgets () { |
|
1076 | + public function register_widgets() { |
|
1077 | 1077 | |
1078 | 1078 | $widgets = array( |
1079 | 1079 | 'recent-episodes' => 'Recent_Episodes', |
@@ -1083,8 +1083,8 @@ discard block |
||
1083 | 1083 | ); |
1084 | 1084 | |
1085 | 1085 | foreach ( $widgets as $id => $name ) { |
1086 | - require_once( $this->dir . '/includes/widgets/class-ssp-widget-' . $id . '.php' ); |
|
1087 | - register_widget( 'SSP_Widget_' . $name ); |
|
1086 | + require_once( $this->dir.'/includes/widgets/class-ssp-widget-'.$id.'.php' ); |
|
1087 | + register_widget ( 'SSP_Widget_'.$name ); |
|
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | } |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | * Register plugin shortcodes |
1094 | 1094 | * @return void |
1095 | 1095 | */ |
1096 | - public function register_shortcodes () { |
|
1096 | + public function register_shortcodes() { |
|
1097 | 1097 | |
1098 | 1098 | $shortcodes = array( |
1099 | 1099 | 'podcast_episode', |
@@ -1102,8 +1102,8 @@ discard block |
||
1102 | 1102 | ); |
1103 | 1103 | |
1104 | 1104 | foreach ( $shortcodes as $shortcode ) { |
1105 | - require_once( $this->dir . '/includes/shortcodes/class-ssp-shortcode-' . $shortcode . '.php' ); |
|
1106 | - add_shortcode( $shortcode, array( $GLOBALS['ssp_shortcodes'][ $shortcode ], 'shortcode' ) ); |
|
1105 | + require_once( $this->dir.'/includes/shortcodes/class-ssp-shortcode-'.$shortcode.'.php' ); |
|
1106 | + add_shortcode ( $shortcode, array( $GLOBALS[ 'ssp_shortcodes' ][ $shortcode ], 'shortcode' ) ); |
|
1107 | 1107 | } |
1108 | 1108 | |
1109 | 1109 | } |
@@ -1114,64 +1114,64 @@ discard block |
||
1114 | 1114 | * @param array $content_items Orderd array of content items to display |
1115 | 1115 | * @return string HTML of episode with specified content items |
1116 | 1116 | */ |
1117 | - public function podcast_episode ( $episode_id = 0, $content_items = array( 'title', 'player', 'details' ), $context = '' ) { |
|
1117 | + public function podcast_episode( $episode_id = 0, $content_items = array( 'title', 'player', 'details' ), $context = '' ) { |
|
1118 | 1118 | global $post, $episode_context; |
1119 | 1119 | |
1120 | - if ( ! $episode_id || ! is_array( $content_items ) || empty( $content_items ) ) { |
|
1120 | + if ( ! $episode_id || ! is_array ( $content_items ) || empty( $content_items ) ) { |
|
1121 | 1121 | return; |
1122 | 1122 | } |
1123 | 1123 | |
1124 | 1124 | // Get episode object |
1125 | - $episode = get_post( $episode_id ); |
|
1125 | + $episode = get_post ( $episode_id ); |
|
1126 | 1126 | |
1127 | - if ( ! $episode || is_wp_error( $episode ) ) { |
|
1127 | + if ( ! $episode || is_wp_error ( $episode ) ) { |
|
1128 | 1128 | return; |
1129 | 1129 | } |
1130 | 1130 | |
1131 | - $html = '<div class="podcast-episode episode-' . esc_attr( $episode_id ) . '">' . "\n"; |
|
1131 | + $html = '<div class="podcast-episode episode-'.esc_attr ( $episode_id ).'">'."\n"; |
|
1132 | 1132 | |
1133 | 1133 | // Setup post data for episode post object |
1134 | 1134 | $post = $episode; |
1135 | - setup_postdata( $post ); |
|
1135 | + setup_postdata ( $post ); |
|
1136 | 1136 | |
1137 | 1137 | $episode_context = $context; |
1138 | 1138 | |
1139 | 1139 | // Display specified content items in the order supplied |
1140 | 1140 | foreach ( $content_items as $item ) { |
1141 | 1141 | |
1142 | - switch( $item ) { |
|
1142 | + switch ( $item ) { |
|
1143 | 1143 | |
1144 | 1144 | case 'title': |
1145 | - $html .= '<h3 class="episode-title">' . get_the_title() . '</h3>' . "\n"; |
|
1145 | + $html .= '<h3 class="episode-title">'.get_the_title ().'</h3>'."\n"; |
|
1146 | 1146 | break; |
1147 | 1147 | |
1148 | 1148 | case 'excerpt': |
1149 | - $html .= '<p class="episode-excerpt">' . get_the_excerpt() . '</p>' . "\n"; |
|
1149 | + $html .= '<p class="episode-excerpt">'.get_the_excerpt ().'</p>'."\n"; |
|
1150 | 1150 | break; |
1151 | 1151 | |
1152 | 1152 | case 'content': |
1153 | - $html .= '<div class="episode-content">' . apply_filters( 'the_content', get_the_content() ) . '</div>' . "\n"; |
|
1153 | + $html .= '<div class="episode-content">'.apply_filters ( 'the_content', get_the_content () ).'</div>'."\n"; |
|
1154 | 1154 | break; |
1155 | 1155 | |
1156 | 1156 | case 'player': |
1157 | - $file = $this->get_enclosure( $episode_id ); |
|
1158 | - if ( get_option( 'permalink_structure' ) ) { |
|
1159 | - $file = $this->get_episode_download_link( $episode_id ); |
|
1157 | + $file = $this->get_enclosure ( $episode_id ); |
|
1158 | + if ( get_option ( 'permalink_structure' ) ) { |
|
1159 | + $file = $this->get_episode_download_link ( $episode_id ); |
|
1160 | 1160 | } |
1161 | - $html .= '<div class="podcast_player">' . $this->media_player( $file, $episode_id ) . '</div>' . "\n"; |
|
1161 | + $html .= '<div class="podcast_player">'.$this->media_player ( $file, $episode_id ).'</div>'."\n"; |
|
1162 | 1162 | break; |
1163 | 1163 | |
1164 | 1164 | case 'details': |
1165 | - $html .= $this->episode_meta_details( $episode_id, $episode_context ); |
|
1165 | + $html .= $this->episode_meta_details ( $episode_id, $episode_context ); |
|
1166 | 1166 | break; |
1167 | 1167 | |
1168 | 1168 | } |
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | // Reset post data after fetching episode details |
1172 | - wp_reset_postdata(); |
|
1172 | + wp_reset_postdata (); |
|
1173 | 1173 | |
1174 | - $html .= '</div>' . "\n"; |
|
1174 | + $html .= '</div>'."\n"; |
|
1175 | 1175 | |
1176 | 1176 | return $html; |
1177 | 1177 | } |
@@ -1186,26 +1186,26 @@ discard block |
||
1186 | 1186 | function get_local_file_path( $file ) { |
1187 | 1187 | |
1188 | 1188 | // Identify file by root path and not URL (required for getID3 class) |
1189 | - $site_root = trailingslashit( ABSPATH ); |
|
1189 | + $site_root = trailingslashit ( ABSPATH ); |
|
1190 | 1190 | |
1191 | 1191 | // Remove common dirs from the ends of site_url and site_root, so that file can be outside of the WordPress installation |
1192 | - $root_chunks = explode( '/', $site_root ); |
|
1193 | - $url_chunks = explode( '/', $this->site_url ); |
|
1192 | + $root_chunks = explode ( '/', $site_root ); |
|
1193 | + $url_chunks = explode ( '/', $this->site_url ); |
|
1194 | 1194 | |
1195 | - end( $root_chunks ); |
|
1196 | - end( $url_chunks ); |
|
1195 | + end ( $root_chunks ); |
|
1196 | + end ( $url_chunks ); |
|
1197 | 1197 | |
1198 | - while ( ! is_null( key( $root_chunks ) ) && ! is_null( key( $url_chunks ) ) && ( current( $root_chunks ) == current( $url_chunks ) ) ) { |
|
1199 | - array_pop( $root_chunks ); |
|
1200 | - array_pop( $url_chunks ); |
|
1201 | - end( $root_chunks ); |
|
1202 | - end( $url_chunks ); |
|
1198 | + while ( ! is_null ( key ( $root_chunks ) ) && ! is_null ( key ( $url_chunks ) ) && ( current ( $root_chunks ) == current ( $url_chunks ) ) ) { |
|
1199 | + array_pop ( $root_chunks ); |
|
1200 | + array_pop ( $url_chunks ); |
|
1201 | + end ( $root_chunks ); |
|
1202 | + end ( $url_chunks ); |
|
1203 | 1203 | } |
1204 | 1204 | |
1205 | - $site_root = implode('/', $root_chunks); |
|
1206 | - $site_url = implode('/', $url_chunks); |
|
1205 | + $site_root = implode ( '/', $root_chunks ); |
|
1206 | + $site_url = implode ( '/', $url_chunks ); |
|
1207 | 1207 | |
1208 | - $file = str_replace( $site_url, $site_root, $file ); |
|
1208 | + $file = str_replace ( $site_url, $site_root, $file ); |
|
1209 | 1209 | |
1210 | 1210 | return $file; |
1211 | 1211 | } |
@@ -1217,16 +1217,16 @@ discard block |
||
1217 | 1217 | * @param string $type Type of feed |
1218 | 1218 | * @return string Updated content type |
1219 | 1219 | */ |
1220 | - public function feed_content_type ( $content_type = '', $type = '' ) { |
|
1220 | + public function feed_content_type( $content_type = '', $type = '' ) { |
|
1221 | 1221 | |
1222 | - if( 'podcast' == $type ) { |
|
1222 | + if ( 'podcast' == $type ) { |
|
1223 | 1223 | $content_type = 'text/xml'; |
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | return $content_type; |
1227 | 1227 | } |
1228 | 1228 | |
1229 | - public function load_localisation () { |
|
1230 | - load_plugin_textdomain( 'seriously-simple-podcasting', false, basename( dirname( $this->file ) ) . '/languages/' ); |
|
1229 | + public function load_localisation() { |
|
1230 | + load_plugin_textdomain ( 'seriously-simple-podcasting', false, basename ( dirname ( $this->file ) ).'/languages/' ); |
|
1231 | 1231 | } |
1232 | 1232 | } |