PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
16.3 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 All 508 releases
← All changes | extensions/blocks/paypal-payment-buttons/paypal-payment-buttons.php +24 -0 16.2 → 16.3 View file →
@@ -12,10 +12,34 @@
12 12 if ( ! defined( 'ABSPATH' ) ) {
13 13 exit( 0 );
14 14 }
15 15
16 +// The API-managed buttons ship behind a flag; register it before anything reads it.
17 +PayPal_Payment_Buttons::register_feature_flags();
18 +add_filter( 'jetpack_block_editor_feature_flags', array( PayPal_Payment_Buttons::class, 'add_editor_feature_flags' ) );
19 +
16 20 // Register the block.
17 21 add_action( 'init', array( PayPal_Payment_Buttons::class, 'register_block' ), 9 );
22 +
23 +/*
24 + * Register the PayPal REST routes (wpcom/v2/paypal/*) that the block editor calls
25 + * to connect an account and manage payment links. Without them the block renders
26 + * but every request the editor makes -- onboarding, connect, button CRUD -- 404s.
27 + *
28 + * Only the routes: init_api() also hooks sharing and the email sender, neither of
29 + * which is wired up on Jetpack today. Both this and init_admin() no-op while the
30 + * flag is off.
31 + */
32 +PayPal_Payment_Buttons::init_rest_api();
33 +
34 +/*
35 + * Register the Payment Links admin page. The standalone plugin wires this up in
36 + * its own bootstrap; the Jetpack loader has to do the same or PayPal_Admin_Page
37 + * never runs and the page does not exist in wp-admin.
38 + */
39 +if ( is_admin() ) {
40 + PayPal_Payment_Buttons::init_admin();
41 +}
18 42
19 43 // Load scripts for the editing interface
20 44 add_action( 'enqueue_block_editor_assets', array( PayPal_Payment_Buttons::class, 'load_editor_scripts' ), 9 );
21 45