Plugin Directory


Ignore:
Timestamp:
10/19/2026 10:48:39 AM (4 weeks ago)
Author:
avakodeforge
Message:

Release 1.6.4 (trunk + tag; see readme changelog)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guardforge/trunk/includes/class-core.php

    r3735184 r3754541  
    2424        add_filter( 'admin_body_class', [ $this, 'add_body_class' ] );
    2525        add_action( 'admin_notices', [ $this, 'pro_addon_outdated_notice' ] );
     26        add_action( 'admin_notices', [ $this, 'rest_migration_notice' ] );
     27        add_action( 'admin_post_guardforge_rest_notice_dismiss', [ $this, 'handle_rest_notice_dismiss' ] );
    2628        add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
    2729    }
    … …  
    7476        echo ' <a href="https://avakode.com/dashboard/downloads/" target="_blank" rel="noopener">' . esc_html( __( 'Open Downloads', 'guardforge' ) ) . '</a>';
    7577        echo '</p></div>';
     78    }
     79
     80    /**
     81 * Once, after the 1.6.4 update: what happened to the REST API protection.
     82 *
     83 * The update split "Restrict REST API" in two (see
     84 * GUARDFORGE_Options::migrate_rest_settings) and picked one for the
     85 * site, so the site owner is told which and where to change it. The
     86 * sentences carry no placeholders: the machine translator drops them.
     87 */
     88    public function rest_migration_notice() {
     89        if ( ! self::notice_screen_allows() ) {
     90            return;
     91        }
     92        $mode = GUARDFORGE_Options::rest_migration_notice();
     93        if ( $mode === null ) {
     94            return;
     95        }
     96        $settings = admin_url( 'admin.php?page=guardforge#gf-card-api' );
     97        $dismiss  = wp_nonce_url( admin_url( 'admin-post.php?action=guardforge_rest_notice_dismiss' ), 'guardforge_rest_notice_dismiss' );
     98
     99        echo '<div class="notice notice-warning"><p><strong>';
     100        if ( $mode === 'lockdown' ) {
     101            echo esc_html__( 'GuardForge still closes the REST API to visitors who are not signed in, as you had set it.', 'guardforge' );
     102            echo '</strong></p><p>';
     103            echo esc_html__( 'Version 1.6.4 split the REST API protection in two. Because you had written your own list of exceptions, the switch that closes the whole REST API is now on, with your list. To keep only user records private instead, turn that switch off in Settings, under API & Protocols.', 'guardforge' );
     104        } else {
     105            echo esc_html__( 'GuardForge now keeps only user records private in the REST API.', 'guardforge' );
     106            echo '</strong></p><p>';
     107            echo esc_html__( 'Version 1.6.4 split the REST API protection in two. The protection you had used the default list, which also shut out the WooCommerce cart and checkout, contact forms and webhooks, so it now closes user records to visitors and nothing else. To close the whole REST API to visitors who are not signed in, turn that switch on in Settings, under API & Protocols.', 'guardforge' );
     108        }
     109        echo '</p><p><a class="button button-primary" href="' . esc_url( $settings ) . '">' . esc_html__( 'Open Settings', 'guardforge' ) . '</a> ';
     110        echo '<a class="button" href="' . esc_url( $dismiss ) . '">' . esc_html__( 'Dismiss', 'guardforge' ) . '</a></p></div>';
     111    }
     112
     113    public function handle_rest_notice_dismiss() {
     114        if ( ! current_user_can( 'manage_options' ) ) {
     115            wp_die( esc_html__( 'Access denied.', 'guardforge' ) );
     116        }
     117        check_admin_referer( 'guardforge_rest_notice_dismiss' );
     118        GUARDFORGE_Options::dismiss_rest_migration_notice();
     119        $back = wp_get_referer();
     120        wp_safe_redirect( $back ? $back : admin_url() );
     121        exit;
    76122    }
    77123
Note: See TracChangeset for help on using the changeset viewer.