@@ 169-180 (lines=12) @@ | ||
166 | * |
|
167 | * @return SimplePie|WP_Error The RSS object or error. |
|
168 | */ |
|
169 | public function load_feed() { |
|
170 | $rss = fetch_feed( $this->feed ); |
|
171 | if ( is_wp_error( $rss ) ) { |
|
172 | return new WP_Error( 'invalid_url', __( 'Your podcast couldn\'t be embedded. Please double check your URL.', 'jetpack' ) ); |
|
173 | } |
|
174 | ||
175 | if ( ! $rss->get_item_quantity() ) { |
|
176 | return new WP_Error( 'no_tracks', __( 'Podcast audio RSS feed has no tracks.', 'jetpack' ) ); |
|
177 | } |
|
178 | ||
179 | return $rss; |
|
180 | } |
|
181 | ||
182 | /** |
|
183 | * Prepares Episode data to be used by the Podcast Player block. |
@@ 308-318 (lines=11) @@ | ||
305 | } |
|
306 | ||
307 | ||
308 | protected function validate_plugin( $plugin ) { |
|
309 | if ( ! isset( $plugin) || empty( $plugin ) ) { |
|
310 | return new WP_Error( 'missing_plugin', __( 'You are required to specify a plugin to activate.', 'jetpack' ), 400 ); |
|
311 | } |
|
312 | ||
313 | if ( is_wp_error( $error = validate_plugin( $plugin ) ) ) { |
|
314 | return new WP_Error( 'unknown_plugin', $error->get_error_messages() , 404 ); |
|
315 | } |
|
316 | ||
317 | return true; |
|
318 | } |
|
319 | ||
320 | protected function get_plugin_updates( $plugin_file ) { |
|
321 | $plugin_updates = get_plugin_updates(); |