PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.5
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.5
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 13.8.3 All 506 releases
← All changes | extensions/blocks/premium-content/premium-content.php +15 -14 13.8.3 → 16.3-a.5 View file →
@@ -24,23 +24,23 @@
24 24 * This is done via an action so that we can disable
25 25 * registration if we need to.
26 26 */
27 27 function register_block() {
28 - // Determine required `context` key based on Gutenberg version.
29 - $deprecated = function_exists( 'gutenberg_get_post_from_context' );
30 - $provides = $deprecated ? 'providesContext' : 'provides_context';
31 28
32 - Blocks::jetpack_register_block(
33 - __DIR__,
34 - array(
35 - 'render_callback' => __NAMESPACE__ . '\render_block',
36 - $provides => array(
37 - 'premium-content/planId' => 'selectedPlanId', // Deprecated.
38 - 'premium-content/planIds' => 'selectedPlanIds',
39 - 'isPremiumContentChild' => 'isPremiumContentChild',
40 - ),
41 - )
42 - );
29 + require_once JETPACK__PLUGIN_DIR . '/modules/memberships/class-jetpack-memberships.php';
30 + if ( \Jetpack_Memberships::should_enable_monetize_blocks_in_editor() ) {
31 + Blocks::jetpack_register_block(
32 + __DIR__,
33 + array(
34 + 'render_callback' => __NAMESPACE__ . '\render_block',
35 + 'provides_context' => array(
36 + 'premium-content/planId' => 'selectedPlanId', // Deprecated.
37 + 'premium-content/planIds' => 'selectedPlanIds',
38 + 'isPremiumContentChild' => 'isPremiumContentChild',
39 + ),
40 + )
41 + );
42 + }
43 43
44 44 register_post_meta(
45 45 'post',
46 46 META_NAME_CONTAINS_PAID_CONTENT,
@@ -69,8 +69,9 @@
69 69
70 70 add_action( 'wp_after_insert_post', __NAMESPACE__ . '\add_paid_content_post_meta', 99, 2 );
71 71 }
72 72 add_action( 'init', __NAMESPACE__ . '\register_block' );
73 +add_action( 'template_redirect', __NAMESPACE__ . '\prewarm_premium_content_session_cookie' );
73 74
74 75 /**
75 76 * Render callback.
76 77 *