@@ 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(); |
@@ 155-167 (lines=13) @@ | ||
152 | * @param string $feed The RSS feed URL to load. |
|
153 | * @return SimplePie|WP_Error The RSS object or error. |
|
154 | */ |
|
155 | private static function load_feed( $feed ) { |
|
156 | $rss = fetch_feed( esc_url_raw( $feed ) ); |
|
157 | ||
158 | if ( is_wp_error( $rss ) ) { |
|
159 | return new WP_Error( 'invalid_url', __( 'Your podcast couldn\'t be embedded. Please double check your URL.', 'jetpack' ) ); |
|
160 | } |
|
161 | ||
162 | if ( ! $rss->get_item_quantity() ) { |
|
163 | return new WP_Error( 'no_tracks', __( 'Podcast audio RSS feed has no tracks.', 'jetpack' ) ); |
|
164 | } |
|
165 | ||
166 | return $rss; |
|
167 | } |
|
168 | ||
169 | /** |
|
170 | * Prepares Episode data to be used by the Podcast Player block. |