Plugin Directory

Changeset 3771694


Ignore:
Timestamp:
10/28/2026 09:22:38 PM (7 days ago)
Author:
puregraceai
Message:

1.12.1: GraceGuard screens each comment once

Location:
puregrace-consent-connector
Files:
3 edited
6 copied

Legend:

Unmodified
Added
Removed
  • puregrace-consent-connector/tags/1.12.1/includes/class-pgcc-graceguard.php

    r3771604 r3771694  
    325325        return 'ALLOW'; // Site staff testing their own forms, same as the basics.
    326326    }
    327     $flat   = pgcc_gg_flatten( $raw );
    328     $result = pgcc_gg_call( $slug, $form_id, pgcc_gg_payload( $flat ) );
     327    $flat    = pgcc_gg_flatten( $raw );
     328    $payload = pgcc_gg_payload( $flat );
     329    // Some hooks run twice for one submission (WordPress applies
     330    // pre_comment_approved twice per comment). Screen each submission once
     331    // per request so it is counted, stored and billed once.
     332    $key  = $slug . '|' . $form_id . '|' . md5( (string) wp_json_encode( $payload ) );
     333    $memo = pgcc_gg_screen_memo();
     334    if ( isset( $memo[ $key ] ) ) {
     335        return $memo[ $key ];
     336    }
     337    $verdict = pgcc_gg_screen_once( $slug, $form_id, $flat, $payload, $notify_to );
     338    pgcc_gg_screen_memo( $key, $verdict );
     339    return $verdict;
     340}
     341
     342/**
     343 * This request's screening results. ( $key, $verdict ) stores one;
     344 * ( null, null, true ) clears them (tests only).
     345 */
     346function pgcc_gg_screen_memo( $key = null, $verdict = null, $reset = false ) {
     347    static $memo = array();
     348    if ( $reset ) {
     349        $memo = array();
     350    } elseif ( null !== $key ) {
     351        $memo[ $key ] = $verdict;
     352    }
     353    return $memo;
     354}
     355
     356/** One real screening call; see pgcc_gg_screen() for the per-request memo. */
     357function pgcc_gg_screen_once( $slug, $form_id, $flat, $payload, $notify_to ) {
     358    $result = pgcc_gg_call( $slug, $form_id, $payload );
    329359    if ( null === $result || 'ALLOW' === $result['verdict'] ) {
    330360        return 'ALLOW';
  • puregrace-consent-connector/tags/1.12.1/puregrace-consent-connector.php

    r3771604 r3771694  
    44 * Plugin URI: https://aiprivacycenter.com/wordpress-cookie-consent/
    55 * Description: Blocks hardcoded trackers server-side before the browser parses them, and connects your site to the AI Privacy Center consent platform (a service by Pure Grace AI, LLC).
    6  * Version: 1.12.0
     6 * Version: 1.12.1
    77 * Requires at least: 5.8
    88 * Requires PHP: 7.4
    … …  
    4242}
    4343
    44 define( 'PGCC_VERSION', '1.12.0' );
     44define( 'PGCC_VERSION', '1.12.1' );
    4545define( 'PGCC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    4646
  • puregrace-consent-connector/tags/1.12.1/readme.txt

    r3771604 r3771694  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.12.0
     7Stable tag: 1.12.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    117117== Changelog ==
    118118
     119= 1.12.1 =
     120* GraceGuard: each comment is now screened once. WordPress runs its comment-approval check twice per comment, which made every comment count twice in your GraceGuard results.
     121
    119122= 1.12.0 =
    120123* GraceGuard by AI Privacy Center (paid add-on, off unless you turn it on in your dashboard): submissions that pass the free spam checks are also screened by AI Privacy Center. Clear spam goes to each form plugin's spam handling as before. Borderline messages are held for review: the visitor sees the form's normal success message, the notification email is held back, and you release it with **Not spam** under the new **Settings → Held messages** screen (comments go to Comments → Pending, Gravity Forms entries to its Spam folder). Released senders are trusted from then on. Held copies stay in your own database and are deleted after 30 days.
    … …  
    209212== Upgrade Notice ==
    210213
     214= 1.12.1 =
     215GraceGuard counts each comment once instead of twice.
     216
    211217= 1.12.0 =
    212218Adds support for GraceGuard, AI Privacy Center's optional spam-screening add-on, with a review queue under Settings → Held messages. Nothing changes unless GraceGuard is turned on for this site in your dashboard.
  • puregrace-consent-connector/trunk/includes/class-pgcc-graceguard.php

    r3771604 r3771694  
    325325        return 'ALLOW'; // Site staff testing their own forms, same as the basics.
    326326    }
    327     $flat   = pgcc_gg_flatten( $raw );
    328     $result = pgcc_gg_call( $slug, $form_id, pgcc_gg_payload( $flat ) );
     327    $flat    = pgcc_gg_flatten( $raw );
     328    $payload = pgcc_gg_payload( $flat );
     329    // Some hooks run twice for one submission (WordPress applies
     330    // pre_comment_approved twice per comment). Screen each submission once
     331    // per request so it is counted, stored and billed once.
     332    $key  = $slug . '|' . $form_id . '|' . md5( (string) wp_json_encode( $payload ) );
     333    $memo = pgcc_gg_screen_memo();
     334    if ( isset( $memo[ $key ] ) ) {
     335        return $memo[ $key ];
     336    }
     337    $verdict = pgcc_gg_screen_once( $slug, $form_id, $flat, $payload, $notify_to );
     338    pgcc_gg_screen_memo( $key, $verdict );
     339    return $verdict;
     340}
     341
     342/**
     343 * This request's screening results. ( $key, $verdict ) stores one;
     344 * ( null, null, true ) clears them (tests only).
     345 */
     346function pgcc_gg_screen_memo( $key = null, $verdict = null, $reset = false ) {
     347    static $memo = array();
     348    if ( $reset ) {
     349        $memo = array();
     350    } elseif ( null !== $key ) {
     351        $memo[ $key ] = $verdict;
     352    }
     353    return $memo;
     354}
     355
     356/** One real screening call; see pgcc_gg_screen() for the per-request memo. */
     357function pgcc_gg_screen_once( $slug, $form_id, $flat, $payload, $notify_to ) {
     358    $result = pgcc_gg_call( $slug, $form_id, $payload );
    329359    if ( null === $result || 'ALLOW' === $result['verdict'] ) {
    330360        return 'ALLOW';
  • puregrace-consent-connector/trunk/puregrace-consent-connector.php

    r3771604 r3771694  
    44 * Plugin URI: https://aiprivacycenter.com/wordpress-cookie-consent/
    55 * Description: Blocks hardcoded trackers server-side before the browser parses them, and connects your site to the AI Privacy Center consent platform (a service by Pure Grace AI, LLC).
    6  * Version: 1.12.0
     6 * Version: 1.12.1
    77 * Requires at least: 5.8
    88 * Requires PHP: 7.4
    … …  
    4242}
    4343
    44 define( 'PGCC_VERSION', '1.12.0' );
     44define( 'PGCC_VERSION', '1.12.1' );
    4545define( 'PGCC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    4646
  • puregrace-consent-connector/trunk/readme.txt

    r3771604 r3771694  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.12.0
     7Stable tag: 1.12.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    117117== Changelog ==
    118118
     119= 1.12.1 =
     120* GraceGuard: each comment is now screened once. WordPress runs its comment-approval check twice per comment, which made every comment count twice in your GraceGuard results.
     121
    119122= 1.12.0 =
    120123* GraceGuard by AI Privacy Center (paid add-on, off unless you turn it on in your dashboard): submissions that pass the free spam checks are also screened by AI Privacy Center. Clear spam goes to each form plugin's spam handling as before. Borderline messages are held for review: the visitor sees the form's normal success message, the notification email is held back, and you release it with **Not spam** under the new **Settings → Held messages** screen (comments go to Comments → Pending, Gravity Forms entries to its Spam folder). Released senders are trusted from then on. Held copies stay in your own database and are deleted after 30 days.
    … …  
    209212== Upgrade Notice ==
    210213
     214= 1.12.1 =
     215GraceGuard counts each comment once instead of twice.
     216
    211217= 1.12.0 =
    212218Adds support for GraceGuard, AI Privacy Center's optional spam-screening add-on, with a review queue under Settings → Held messages. Nothing changes unless GraceGuard is turned on for this site in your dashboard.
Note: See TracChangeset for help on using the changeset viewer.