esc_url_raw( rest_url( 'pds/v1/' ) ), 'siteName' => get_bloginfo( 'name' ), ] ); } // ------------------------------------------------------------------------- // Body class // ------------------------------------------------------------------------- public function tag_reader_body( array $classes ): array { $row = Prweb_Reader_Sessions::verify( Prweb_Reader_Sessions::cookie_value() ); $classes[] = $row ? 'webapp-reader-licensed' : 'webapp-reader-unlicensed'; return $classes; } // ------------------------------------------------------------------------- // Content gate // ------------------------------------------------------------------------- /** * Soft-gate the content of single posts. Unlicensed readers see only the * first ~60 words plus a placeholder the JS replaces with a Register CTA. * The home page, archives, RSS feeds, and the WP REST API are unaffected * so the validator's /assets proxy can still see the full content. */ public function gate_post_content( string $content ): string { if ( is_admin() || ! is_singular( 'post' ) || is_feed() ) { return $content; } if ( Prweb_Reader_Sessions::verify( Prweb_Reader_Sessions::cookie_value() ) ) { return $content; } $excerpt = wp_trim_words( wp_strip_all_tags( $content ), 60, '…' ); $cta_id = 'webapp-gate-' . get_the_ID(); return sprintf( '
%s