PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.7
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.7
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 | modules/subscriptions/subscribe-modal/class-jetpack-subscribe-modal.php +39 -8 13.6.2 → 16.3-a.7 View file →
@@ -63,19 +63,47 @@
63 63 wp_enqueue_style( 'subscribe-modal-css', plugins_url( 'subscribe-modal.css', __FILE__ ), array(), JETPACK__VERSION );
64 64 wp_enqueue_script( 'subscribe-modal-js', plugins_url( 'subscribe-modal.js', __FILE__ ), array( 'wp-dom-ready' ), JETPACK__VERSION, true );
65 65
66 66 /**
67 - * Filter how many milliseconds a user must scroll for until the Subscribe Modal appears.
67 + * Filter how many milliseconds until the Subscribe Modal appears.
68 68 *
69 69 * @module subscriptions
70 70 *
71 71 * @since 13.4
72 72 *
73 - * @param int 300 Time in milliseconds for the Subscribe Modal to appear upon scrolling.
73 + * @param int 60000 Time in milliseconds for the Subscribe Modal to appear.
74 74 */
75 - $load_time = absint( apply_filters( 'jetpack_subscribe_modal_load_time', 300 ) );
75 + $load_time = absint( apply_filters( 'jetpack_subscribe_modal_load_time', 60000 ) );
76 76
77 - wp_localize_script( 'subscribe-modal-js', 'Jetpack_Subscriptions', array( 'modalLoadTime' => $load_time ) );
77 + /**
78 + * Filter how many percentage of the page should be scrolled before the Subscribe Modal appears.
79 + *
80 + * @module subscriptions
81 + *
82 + * @since 13.6
83 + *
84 + * @param int Percentage of the page scrolled before the Subscribe Modal appears.
85 + */
86 + $scroll_threshold = absint( apply_filters( 'jetpack_subscribe_modal_scroll_threshold', 50 ) );
87 +
88 + /**
89 + * Filter to control the interval at which the subscribe modal is shown to the same user. The default interval is 24 hours.
90 + *
91 + * @since 13.7
92 + *
93 + * @param int 24 Hours before we show the same user the Subscribe Modal to again.
94 + */
95 + $modal_interval = absint( apply_filters( 'jetpack_subscribe_modal_interval', 24 ) );
96 +
97 + wp_localize_script(
98 + 'subscribe-modal-js',
99 + 'Jetpack_Subscriptions',
100 + array(
101 + 'modalLoadTime' => $load_time,
102 + 'modalScrollThreshold' => $scroll_threshold,
103 + 'modalInterval' => ( $modal_interval * HOUR_IN_SECONDS * 1000 ),
104 + )
105 + );
78 106 }
79 107 }
80 108
81 109 /**
@@ -157,15 +185,15 @@
157 185 <h2 class="wp-block-heading has-text-align-center" style="margin-top:4px;margin-bottom:10px;font-size:26px;font-style:normal;font-weight:600">$discover_more_from</h2>
158 186 <!-- /wp:heading -->
159 187
160 188 <!-- wp:paragraph {"align":"center","style":{"typography":{"fontSize":"15px"},"spacing":{"margin":{"top":"4px","bottom":"0px"}}}} -->
161 - <p class='has-text-align-center' style='margin-top:4px;margin-bottom:0px;font-size:15px'>$subscribe_text</p>
189 + <p class='has-text-align-center' style='margin-top:4px;margin-bottom:1em;font-size:15px'>$subscribe_text</p>
162 190 <!-- /wp:paragraph -->
163 191
164 - <!-- wp:jetpack/subscriptions {"borderRadius":50,"className":"is-style-compact"} /-->
192 + <!-- wp:jetpack/subscriptions {"borderRadius":50,"className":"is-style-compact","appSource":"subscribe-modal"} /-->
165 193
166 194 <!-- wp:paragraph {"align":"center","style":{"spacing":{"margin":{"top":"20px"}},"typography":{"fontSize":"14px"}},"className":"jetpack-subscribe-modal__close"} -->
167 - <p class="has-text-align-center jetpack-subscribe-modal__close" style="margin-top:20px;font-size:14px"><a href="#">$continue_reading</a></p>
195 + <p class="has-text-align-center jetpack-subscribe-modal__close" style="margin-top:20px;margin-bottom:0;font-size:14px"><a href="#">$continue_reading</a></p>
168 196 <!-- /wp:paragraph -->
169 197 </div>
170 198 <!-- /wp:group -->
171 199 HTML;
@@ -204,10 +232,13 @@
204 232 if ( isset( $_GET['subscribe'] ) || isset( $_GET['blogsub'] ) ) {
205 233 return false;
206 234 }
207 235
208 - // Don't show if post is for subscribers only or has paywall block
236 + // Don't show if post is not a post, is for subscribers only, or has paywall block
209 237 global $post;
238 + if ( ! $post instanceof WP_Post ) {
239 + return false;
240 + }
210 241 if ( defined( 'Automattic\\Jetpack\\Extensions\\Subscriptions\\META_NAME_FOR_POST_LEVEL_ACCESS_SETTINGS' ) ) {
211 242 $access_level = get_post_meta( $post->ID, META_NAME_FOR_POST_LEVEL_ACCESS_SETTINGS, true );
212 243 } else {
213 244 $access_level = get_post_meta( $post->ID, '_jetpack_newsletter_access', true );