@@ 113-125 (lines=13) @@ | ||
110 | * @param string $feed The RSS feed URL to load. |
|
111 | * @return SimplePie|WP_Error The RSS object or error. |
|
112 | */ |
|
113 | private static function load_feed( $feed ) { |
|
114 | $rss = fetch_feed( esc_url_raw( $feed ) ); |
|
115 | ||
116 | if ( is_wp_error( $rss ) ) { |
|
117 | return new WP_Error( 'invalid_url', __( 'Your podcast couldn\'t be embedded. Please double check your URL.', 'jetpack' ) ); |
|
118 | } |
|
119 | ||
120 | if ( ! $rss->get_item_quantity() ) { |
|
121 | return new WP_Error( 'no_tracks', __( 'Podcast audio RSS feed has no tracks.', 'jetpack' ) ); |
|
122 | } |
|
123 | ||
124 | return $rss; |
|
125 | } |
|
126 | ||
127 | /** |
|
128 | * 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(); |