| @@ 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(); |
|
| @@ 289-300 (lines=12) @@ | ||
| 286 | * |
|
| 287 | * @return SimplePie|WP_Error The RSS object or error. |
|
| 288 | */ |
|
| 289 | public function load_feed() { |
|
| 290 | $rss = fetch_feed( $this->feed ); |
|
| 291 | if ( is_wp_error( $rss ) ) { |
|
| 292 | return new WP_Error( 'invalid_url', __( 'Your podcast couldn\'t be embedded. Please double check your URL.', 'jetpack' ) ); |
|
| 293 | } |
|
| 294 | ||
| 295 | if ( ! $rss->get_item_quantity() ) { |
|
| 296 | return new WP_Error( 'no_tracks', __( 'Podcast audio RSS feed has no tracks.', 'jetpack' ) ); |
|
| 297 | } |
|
| 298 | ||
| 299 | return $rss; |
|
| 300 | } |
|
| 301 | ||
| 302 | /** |
|
| 303 | * Prepares Episode data to be used by the Podcast Player block. |
|