| @@ 283-293 (lines=11) @@ | ||
| 280 | } |
|
| 281 | ||
| 282 | ||
| 283 | protected function validate_plugin( $plugin ) { |
|
| 284 | if ( ! isset( $plugin) || empty( $plugin ) ) { |
|
| 285 | return new WP_Error( 'missing_plugin', __( 'You are required to specify a plugin to activate.', 'jetpack' ), 400 ); |
|
| 286 | } |
|
| 287 | ||
| 288 | if ( is_wp_error( $error = validate_plugin( $plugin ) ) ) { |
|
| 289 | return new WP_Error( 'unknown_plugin', $error->get_error_messages() , 404 ); |
|
| 290 | } |
|
| 291 | ||
| 292 | return true; |
|
| 293 | } |
|
| 294 | ||
| 295 | protected function get_plugin_updates( $plugin_file ) { |
|
| 296 | $plugin_updates = get_plugin_updates(); |
|
| @@ 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. |
|