PluginProbe
Passster – Password Protect Pages and Content / 4.3.17
Passster – Password Protect Pages and Content v4.3.17
4.3.17 4.3.16 4.3.15 4.3.14 4.3.12 4.3.13 4.3.11 4.3.10 4.3.9 4.3.8 4.3.7 4.3.6 4.3.5 trunk 3.5.4 3.5.5.2 3.5.5.8 3.5.5.9 4.0 4.1.4 4.2.10 4.2.11 4.2.12 4.2.13 4.2.14 All 49 releases
← All changes | inc/class-ps-public.php +13 -2 4.3.15 → 4.3.17 View file →
@@ -52,8 +52,12 @@
52 52 * @return string
53 53 */
54 54 private function render_unlocked_content( string $content ) : string {
55 55 if ( doing_filter( 'the_content' ) ) {
56 + // Mirror the_content order: blocks first, wpautop only for classic content.
57 + if ( has_blocks( $content ) ) {
58 + return do_shortcode( do_blocks( $content ) );
59 + }
56 60 return wpautop( do_shortcode( $content ) );
57 61 }
58 62 return apply_filters( 'the_content', $content );
59 63 }
@@ -192,8 +196,11 @@
192 196 $form = str_replace( '[PASSSTER_POST_ID]', absint( get_the_ID() ), $form );
193 197 // term id (for category archive protection — passed to REST API so it can validate against term meta).
194 198 $term_id_val = ( !empty( $atts['term_id'] ) ? absint( $atts['term_id'] ) : 0 );
195 199 $form = str_replace( '[PASSSTER_TERM_ID]', $term_id_val, $form );
200 + // post type (for post type archive protection — passed to REST API so it can validate against post type config).
201 + $post_type_val = ( !empty( $atts['post_type'] ) ? sanitize_key( $atts['post_type'] ) : '' );
202 + $form = str_replace( '[PASSSTER_POST_TYPE]', esc_attr( $post_type_val ), $form );
196 203 // hide or not.
197 204 if ( !empty( $atts['hide'] ) ) {
198 205 $form = str_replace( '[PASSSTER_HIDE]', ' passster-hide', $form );
199 206 } else {
@@ -394,8 +401,12 @@
394 401 $shortcodes[$shortcode] = do_shortcode( str_replace( '{post-id}', get_the_id(), $shortcode ) );
395 402 }
396 403 }
397 404 }
405 + // Archive/taxonomy pages have no singular post, so get_permalink() can't be used
406 + // to build the "reload after unlock" URL for links generated by area/CPT-level protection.
407 + $current_post_id = get_the_id();
408 + $reload_url = ( $current_post_id ? get_permalink( $current_post_id ) : esc_url_raw( remove_query_arg( 'pass' ) ) );
398 409 $args = array(
399 410 'ajax_url' => admin_url() . 'admin-ajax.php',
400 411 'rest_url' => get_rest_url(),
401 412 'nonce' => wp_create_nonce( 'ps-password-nonce' ),
@@ -400,11 +411,11 @@
400 411 'rest_url' => get_rest_url(),
401 412 'nonce' => wp_create_nonce( 'ps-password-nonce' ),
402 413 'hash_nonce' => wp_create_nonce( 'ps-hash-nonce' ),
403 414 'logout_nonce' => wp_create_nonce( 'ps-logout-nonce' ),
404 - 'post_id' => get_the_id(),
415 + 'post_id' => $current_post_id,
405 416 'shortcodes' => $shortcodes,
406 - 'permalink' => get_permalink( get_the_id() ),
417 + 'permalink' => $reload_url,
407 418 );
408 419 if ( isset( $options['cookie_duration_unit'] ) ) {
409 420 $args['cookie_duration_unit'] = esc_html( $options['cookie_duration_unit'] );
410 421 } else {