PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
← All changes | _inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-podcast-player.php +19 -6 12.0.3 → 16.3-beta View file →
@@ -5,8 +5,12 @@
5 5 * @package automattic/jetpack
6 6 * @since 8.4.0
7 7 */
8 8
9 +if ( ! defined( 'ABSPATH' ) ) {
10 + exit( 0 );
11 +}
12 +
9 13 /**
10 14 * Fetch podcast feeds and parse data for the Podcast Player block.
11 15 *
12 16 * @since 8.4.0
@@ -15,12 +19,8 @@
15 19 /**
16 20 * Constructor.
17 21 */
18 22 public function __construct() {
19 - if ( ! class_exists( 'Jetpack_Podcast_Helper' ) ) {
20 - require_once JETPACK__PLUGIN_DIR . '/_inc/lib/class-jetpack-podcast-helper.php';
21 - }
22 -
23 23 $this->namespace = 'wpcom/v2';
24 24 $this->rest_base = 'podcast-player';
25 25 // This endpoint *does not* need to connect directly to Jetpack sites.
26 26 add_action( 'rest_api_init', array( $this, 'register_routes' ) );
@@ -93,21 +93,30 @@
93 93 *
94 94 * @return Integer number of tracks.
95 95 * */
96 96 public function get_tracks_quantity() {
97 + if ( ! class_exists( 'Jetpack_Podcast_Helper' ) ) {
98 + require_once JETPACK__PLUGIN_DIR . '/_inc/lib/class-jetpack-podcast-helper.php';
99 + }
100 +
97 101 return rest_ensure_response( Jetpack_Podcast_Helper::get_tracks_quantity() );
98 102 }
99 103
100 104 /**
101 - * Retreives data needed to display a podcast player from RSS feed.
105 + * Retrieves data needed to display a podcast player from RSS feed.
102 106 *
103 107 * @param WP_REST_Request $request The REST API request data.
104 108 * @return WP_REST_Response The REST API response.
105 109 */
106 110 public function get_player_data( $request ) {
111 + if ( ! class_exists( 'Jetpack_Podcast_Helper' ) ) {
112 + require_once JETPACK__PLUGIN_DIR . '/_inc/lib/class-jetpack-podcast-helper.php';
113 + }
114 +
107 115 $helper = new Jetpack_Podcast_Helper( $request['url'] );
108 116
109 - $args = array();
117 + // The editor needs the feed's true state, not a fallback papering over a broken URL.
118 + $args = array( 'report_errors' => true );
110 119
111 120 if ( isset( $request['guids'] ) ) {
112 121 $args['guids'] = $request['guids'];
113 122 }
@@ -155,8 +164,12 @@
155 164 *
156 165 * @return array
157 166 */
158 167 public function get_item_schema() {
168 + if ( ! class_exists( 'Jetpack_Podcast_Helper' ) ) {
169 + require_once JETPACK__PLUGIN_DIR . '/_inc/lib/class-jetpack-podcast-helper.php';
170 + }
171 +
159 172 return Jetpack_Podcast_Helper::get_player_data_schema();
160 173 }
161 174 }
162 175 wpcom_rest_api_v2_load_plugin( 'WPCOM_REST_API_V2_Endpoint_Podcast_Player' );