Plugin Directory

Changeset 3479192


Ignore:
Timestamp:
03/10/2026 03:16:59 PM (3 weeks ago)
Author:
google
Message:

Update to version 1.174.0 from GitHub

Location:
google-site-kit
Files:
84 added
62 deleted
126 edited
1 copied

Legend:

Unmodified
Added
Removed
  • google-site-kit/tags/1.174.0/dist/assets/blocks/reader-revenue-manager/contribute-with-google/block.json

    r3467940 r3479192  
    33    "apiVersion": 2,
    44    "name": "google-site-kit/rrm-contribute-with-google",
    5     "version": "1.173.0",
     5    "version": "1.174.0",
    66    "title": "Contribute with Google",
    77    "category": "widgets",
  • google-site-kit/tags/1.174.0/dist/assets/blocks/reader-revenue-manager/contribute-with-google/v3/block.json

    r3467940 r3479192  
    33    "apiVersion": 3,
    44    "name": "google-site-kit/rrm-contribute-with-google",
    5     "version": "1.173.0",
     5    "version": "1.174.0",
    66    "title": "Contribute with Google",
    77    "category": "widgets",
  • google-site-kit/tags/1.174.0/dist/assets/blocks/reader-revenue-manager/subscribe-with-google/block.json

    r3467940 r3479192  
    33    "apiVersion": 2,
    44    "name": "google-site-kit/rrm-subscribe-with-google",
    5     "version": "1.173.0",
     5    "version": "1.174.0",
    66    "title": "Subscribe with Google",
    77    "category": "widgets",
  • google-site-kit/tags/1.174.0/dist/assets/blocks/reader-revenue-manager/subscribe-with-google/v3/block.json

    r3467940 r3479192  
    33    "apiVersion": 3,
    44    "name": "google-site-kit/rrm-subscribe-with-google",
    5     "version": "1.173.0",
     5    "version": "1.174.0",
    66    "title": "Subscribe with Google",
    77    "category": "widgets",
  • google-site-kit/tags/1.174.0/dist/assets/blocks/sign-in-with-google/block.json

    r3467940 r3479192  
    33    "apiVersion": 2,
    44    "name": "google-site-kit/sign-in-with-google",
    5     "version": "1.173.0",
     5    "version": "1.174.0",
    66    "title": "Sign in with Google",
    77    "category": "widgets",
     
    1212        "shape": {
    1313            "type": "string",
    14             "enum": ["", "rectangular", "pill"]
     14            "enum": [ "", "rectangular", "pill" ]
    1515        },
    1616        "text": {
     
    2626        "theme": {
    2727            "type": "string",
    28             "enum": ["", "outline", "filled_blue", "filled_black"]
     28            "enum": [ "", "outline", "filled_blue", "filled_black" ]
    2929        },
    3030        "buttonClassName": {
  • google-site-kit/tags/1.174.0/dist/assets/blocks/sign-in-with-google/v3/block.json

    r3467940 r3479192  
    33    "apiVersion": 3,
    44    "name": "google-site-kit/sign-in-with-google",
    5     "version": "1.173.0",
     5    "version": "1.174.0",
    66    "title": "Sign in with Google",
    77    "category": "widgets",
  • google-site-kit/tags/1.174.0/dist/config.php

    r3457523 r3479192  
    88
    99return array(
    10     'features' => array( 'googleTagGateway','gtagUserData','privacySandboxModule','proactiveUserEngagement','rrmPolicyViolations','setupFlowRefresh' ),
     10    'features' => array( 'googleTagGateway','gtagUserData','privacySandboxModule','proactiveUserEngagement','setupFlowRefresh' ),
    1111);
  • google-site-kit/tags/1.174.0/dist/manifest.php

    r3467940 r3479192  
    2828    'sign-in-with-google/index'                                       => array( "sign-in-with-google/index.js", null ),
    2929    'sign-in-with-google/editor-styles'                               => array( "sign-in-with-google/editor-styles.js", null ),
    30     'googlesitekit-admin-css'                                         => array( "googlesitekit-admin-css-d9aa9ae0497bce9f2e2b.min.css", null ),
     30    'googlesitekit-admin-css'                                         => array( "googlesitekit-admin-css-b0a55e41cd054885c01d.min.css", null ),
    3131    'googlesitekit-adminbar-css'                                      => array( "googlesitekit-adminbar-css-da31a8a65334682e590b.min.css", null ),
    3232    'googlesitekit-wp-dashboard-css'                                  => array( "googlesitekit-wp-dashboard-css-ff8420adbc8b86a5776c.min.css", null ),
    3333    'googlesitekit-authorize-application-css'                         => array( "googlesitekit-authorize-application-css-5b98b536e7f34c6411c1.min.css", null ),
    34     'googlesitekit-api'                                               => array( "googlesitekit-api-1b42ccd8014a64002e13.js", null ),
     34    'googlesitekit-api'                                               => array( "googlesitekit-api-6b742f1f3e956905b33c.js", null ),
    3535    'googlesitekit-data'                                              => array( "googlesitekit-data-ab56c0ab3c6231462584.js", null ),
    36     'googlesitekit-datastore-site'                                    => array( "googlesitekit-datastore-site-0ad3830862d5da40c7cc.js", null ),
    37     'googlesitekit-datastore-user'                                    => array( "googlesitekit-datastore-user-ee3b9189c8a41f17a304.js", null ),
    38     'googlesitekit-datastore-forms'                                   => array( "googlesitekit-datastore-forms-5c9a265fe07db133d11e.js", null ),
     36    'googlesitekit-datastore-site'                                    => array( "googlesitekit-datastore-site-d81d1d7e77fb878db074.js", null ),
     37    'googlesitekit-datastore-user'                                    => array( "googlesitekit-datastore-user-50662a4a25e8662f50d2.js", null ),
     38    'googlesitekit-datastore-forms'                                   => array( "googlesitekit-datastore-forms-75b32a3db427355b3d54.js", null ),
    3939    'googlesitekit-datastore-location'                                => array( "googlesitekit-datastore-location-6671f1e766c63f15d64f.js", null ),
    40     'googlesitekit-datastore-ui'                                      => array( "googlesitekit-datastore-ui-aae8b190894508c436a3.js", null ),
    41     'googlesitekit-modules'                                           => array( "googlesitekit-modules-ec132025723e115c493e.js", null ),
    42     'googlesitekit-notifications'                                     => array( "googlesitekit-notifications-aa32e0cf3becd3087d95.js", null ),
    43     'googlesitekit-widgets'                                           => array( "googlesitekit-widgets-c56d4ffc3e0d41ad8632.js", null ),
    44     'googlesitekit-modules-ads'                                       => array( "googlesitekit-modules-ads-f2cd5b1ca68cdc0afafc.js", null ),
    45     'googlesitekit-modules-adsense'                                   => array( "googlesitekit-modules-adsense-caf75cf03cc3f65ad722.js", null ),
    46     'googlesitekit-modules-analytics-4'                               => array( "googlesitekit-modules-analytics-4-08baceaf34b9dc342006.js", null ),
    47     'googlesitekit-modules-pagespeed-insights'                        => array( "googlesitekit-modules-pagespeed-insights-6460d6ee27011faeb822.js", null ),
    48     'googlesitekit-modules-reader-revenue-manager'                    => array( "googlesitekit-modules-reader-revenue-manager-35a4e97b0acf40878735.js", null ),
    49     'googlesitekit-modules-search-console'                            => array( "googlesitekit-modules-search-console-878bb1ae8fdd94ea3668.js", null ),
    50     'googlesitekit-modules-sign-in-with-google'                       => array( "googlesitekit-modules-sign-in-with-google-99767d36de8ec7cc6fd9.js", null ),
    51     'googlesitekit-modules-tagmanager'                                => array( "googlesitekit-modules-tagmanager-d3dc9c4311dfd79986ce.js", null ),
    52     'googlesitekit-user-input'                                        => array( "googlesitekit-user-input-c6ffcdff35f0c900e28b.js", null ),
    53     'googlesitekit-ad-blocking-recovery'                              => array( "googlesitekit-ad-blocking-recovery-b2c14915cb4d745197eb.js", null ),
    54     'googlesitekit-block-tracking'                                    => array( "googlesitekit-block-tracking-562fd213268d8cb25f04.js", null ),
     40    'googlesitekit-datastore-ui'                                      => array( "googlesitekit-datastore-ui-6ae38e48c7d1c550209c.js", null ),
     41    'googlesitekit-modules'                                           => array( "googlesitekit-modules-019df226afc930fb7baa.js", null ),
     42    'googlesitekit-notifications'                                     => array( "googlesitekit-notifications-d97f80ea7c9788e8616a.js", null ),
     43    'googlesitekit-widgets'                                           => array( "googlesitekit-widgets-291ae05540f5ce1d4b5f.js", null ),
     44    'googlesitekit-modules-ads'                                       => array( "googlesitekit-modules-ads-87ff0f042c3f8bb75ffe.js", null ),
     45    'googlesitekit-modules-adsense'                                   => array( "googlesitekit-modules-adsense-da3acba40b247879cea2.js", null ),
     46    'googlesitekit-modules-analytics-4'                               => array( "googlesitekit-modules-analytics-4-6c316f95903d72619464.js", null ),
     47    'googlesitekit-modules-pagespeed-insights'                        => array( "googlesitekit-modules-pagespeed-insights-e61b3aaa46e17ebf457f.js", null ),
     48    'googlesitekit-modules-reader-revenue-manager'                    => array( "googlesitekit-modules-reader-revenue-manager-28b1f326a7af16311546.js", null ),
     49    'googlesitekit-modules-search-console'                            => array( "googlesitekit-modules-search-console-42651fba89fd889cbbe8.js", null ),
     50    'googlesitekit-modules-sign-in-with-google'                       => array( "googlesitekit-modules-sign-in-with-google-aa284c1fba6c038e71ff.js", null ),
     51    'googlesitekit-modules-tagmanager'                                => array( "googlesitekit-modules-tagmanager-c24942280b3785810fd1.js", null ),
     52    'googlesitekit-user-input'                                        => array( "googlesitekit-user-input-ace5668810c71164dfe0.js", null ),
     53    'googlesitekit-ad-blocking-recovery'                              => array( "googlesitekit-ad-blocking-recovery-781b5e4c086bb56009ee.js", null ),
     54    'googlesitekit-block-tracking'                                    => array( "googlesitekit-block-tracking-15a11a002738d55d094b.js", null ),
    5555    'googlesitekit-polyfills'                                         => array( "googlesitekit-polyfills-f2726df5859ebd38706b.js", null ),
    5656    'googlesitekit-components'                                        => array( "googlesitekit-components-1288bf8a9eda8d2eaa36.js", null ),
    57     'googlesitekit-metric-selection'                                  => array( "googlesitekit-metric-selection-c09232a39f84c396a99f.js", null ),
    58     'googlesitekit-key-metrics-setup'                                 => array( "googlesitekit-key-metrics-setup-f327cd289672fb9d8d5c.js", null ),
    59     'googlesitekit-activation'                                        => array( "googlesitekit-activation-a18418b23eed5131e342.js", null ),
    60     'googlesitekit-adminbar'                                          => array( "googlesitekit-adminbar-8b23f8ec0b9885d93b72.js", null ),
    61     'googlesitekit-admin-pointers-tracking'                           => array( "googlesitekit-admin-pointers-tracking-c845ba1cde77a0f3bc14.js", null ),
    62     'googlesitekit-settings'                                          => array( "googlesitekit-settings-83ebe6d5a541de36c404.js", null ),
    63     'googlesitekit-main-dashboard'                                    => array( "googlesitekit-main-dashboard-4385a32f5ff0102cb3d2.js", null ),
    64     'googlesitekit-entity-dashboard'                                  => array( "googlesitekit-entity-dashboard-b61e170cdb6b569e03bb.js", null ),
    65     'googlesitekit-splash'                                            => array( "googlesitekit-splash-46fa2e595d002163ed1b.js", null ),
    66     'googlesitekit-wp-dashboard'                                      => array( "googlesitekit-wp-dashboard-a5d6a1d4bf8a176fcac7.js", null ),
     57    'googlesitekit-metric-selection'                                  => array( "googlesitekit-metric-selection-878a437e42477c6d1739.js", null ),
     58    'googlesitekit-key-metrics-setup'                                 => array( "googlesitekit-key-metrics-setup-acc873033a51c241703a.js", null ),
     59    'googlesitekit-activation'                                        => array( "googlesitekit-activation-33cfec7e5d5ce1d52c84.js", null ),
     60    'googlesitekit-adminbar'                                          => array( "googlesitekit-adminbar-edc2347b3d5db1c50fe9.js", null ),
     61    'googlesitekit-admin-pointers-tracking'                           => array( "googlesitekit-admin-pointers-tracking-aaf3edcbdbcc6193ae8f.js", null ),
     62    'googlesitekit-settings'                                          => array( "googlesitekit-settings-244369c6fd856ce6cdf5.js", null ),
     63    'googlesitekit-main-dashboard'                                    => array( "googlesitekit-main-dashboard-0712bc98382fa42245ba.js", null ),
     64    'googlesitekit-entity-dashboard'                                  => array( "googlesitekit-entity-dashboard-50d1fe8d423ac6604e9a.js", null ),
     65    'googlesitekit-splash'                                            => array( "googlesitekit-splash-f26e7cde106af6278046.js", null ),
     66    'googlesitekit-wp-dashboard'                                      => array( "googlesitekit-wp-dashboard-eec86376ce895eb5422a.js", null ),
    6767    'googlesitekit-runtime'                                           => array( "runtime-4b2eb8d81a08b104395a.js", null ),
    6868    'googlesitekit-vendor'                                            => array( "googlesitekit-vendor-568c1105b8e4f20eff16.js", null ),
  • google-site-kit/tags/1.174.0/google-site-kit.php

    r3467940 r3479192  
    1212 * Plugin URI:        https://sitekit.withgoogle.com
    1313 * Description:       Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
    14  * Version:           1.173.0
     14 * Version:           1.174.0
    1515 * Requires at least: 5.2
    1616 * Requires PHP:      7.4
     
    2727
    2828// Define most essential constants.
    29 define( 'GOOGLESITEKIT_VERSION', '1.173.0' );
     29define( 'GOOGLESITEKIT_VERSION', '1.174.0' );
    3030define( 'GOOGLESITEKIT_PLUGIN_MAIN_FILE', __FILE__ );
     31define( 'GOOGLESITEKIT_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
     32define( 'GOOGLESITEKIT_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) );
    3133define( 'GOOGLESITEKIT_PHP_MINIMUM', '7.4.0' );
    3234define( 'GOOGLESITEKIT_WP_MINIMUM', '5.2.0' );
  • google-site-kit/tags/1.174.0/includes/Context.php

    r3349867 r3479192  
    379379            // If recent version, we can properly detect the mode.
    380380            if ( $amp_plugin_version_2_or_higher ) {
    381                 $mode = AMP_Options_Manager::get_option( 'theme_support' );
     381                $mode = AMP_Options_Manager::get_option( 'theme_support' ); // @phpstan-ignore class.notFound
    382382            } else {
    383383                $mode = AMP_Theme_Support::get_support_mode();
  • google-site-kit/tags/1.174.0/includes/Core/Admin/Screens.php

    r3407206 r3479192  
    190190                $dashboard_index = array_search( 'index.php', $menu_order, true );
    191191
    192                 $sitekit_index = false;
     192                if ( false === $dashboard_index ) {
     193                    return $menu_order;
     194                }
     195
    193196                foreach ( $menu_order as $key => $value ) {
    194197                    if ( strpos( $value, self::PREFIX ) === 0 ) {
    195                         $sitekit_index = $key;
    196                         $sitekit_value = $value;
     198                        unset( $menu_order[ $key ] );
     199                        array_splice( $menu_order, $dashboard_index + 1, 0, $value );
    197200                        break;
    198201                    }
    199202                }
    200203
    201                 if ( false === $dashboard_index || false === $sitekit_index ) {
    202                     return $menu_order;
    203                 }
    204                 unset( $menu_order[ $sitekit_index ] );
    205                 array_splice( $menu_order, $dashboard_index + 1, 0, $sitekit_value );
    206204                return $menu_order;
    207205            }
     
    293291
    294292        if ( current_user_can( Permissions::VIEW_SPLASH ) ) {
     293            $notification = $this->context->input()->filter( INPUT_GET, 'notification' );
     294            $panel        = $this->context->input()->filter( INPUT_GET, 'panel' );
     295
    295296            wp_safe_redirect(
    296                 $this->context->admin_url( 'splash' )
     297                $this->context->admin_url(
     298                    'splash',
     299                    array_filter(
     300                        array(
     301                            'notification' => $notification,
     302                            'panel'        => $panel,
     303                        ),
     304                        function ( $value ) {
     305                            return null !== $value && '' !== $value;
     306                        }
     307                    )
     308                )
    297309            );
    298310            exit;
     
    317329
    318330        if ( current_user_can( Permissions::VIEW_DASHBOARD ) ) {
     331            $notification = $this->context->input()->filter( INPUT_GET, 'notification' );
     332            $panel        = $this->context->input()->filter( INPUT_GET, 'panel' );
     333
    319334            wp_safe_redirect(
    320                 $this->context->admin_url()
     335                $this->context->admin_url(
     336                    'dashboard',
     337                    array_filter(
     338                        array(
     339                            'notification' => $notification,
     340                            'panel'        => $panel,
     341                        ),
     342                        function ( $value ) {
     343                            return null !== $value && '' !== $value;
     344                        }
     345                    )
     346                )
    321347            );
    322348            exit;
     
    507533                                $context->admin_url(
    508534                                    'dashboard',
    509                                     array(
    510                                         // Pass through the notification parameter, or removes it if none.
    511                                         'notification' => $context->input()->filter( INPUT_GET, 'notification' ),
     535                                    array_filter(
     536                                        array(
     537                                            // Pass through supported params, or remove if none.
     538                                            'notification' => $context->input()->filter( INPUT_GET, 'notification' ),
     539                                            'panel'        => $context->input()->filter( INPUT_GET, 'panel' ),
     540                                        ),
     541                                        function ( $value ) {
     542                                            return null !== $value && '' !== $value;
     543                                        }
    512544                                    )
    513545                                )
  • google-site-kit/tags/1.174.0/includes/Core/Assets/Script.php

    r3118692 r3479192  
    7171        if ( $src ) {
    7272            $entry = Manifest::get( $this->handle );
     73
     74            list( $filename, $hash ) = array( null, null );
    7375
    7476            if ( is_array( $entry[0] ) ) {
  • google-site-kit/tags/1.174.0/includes/Core/Authentication/Authentication.php

    r3397601 r3479192  
    313313
    314314                $this->set_connected_proxy_url();
    315             },
    316             10,
    317             3
     315            }
    318316        );
    319317
     
    11451143                        <a
    11461144                            href="#"
    1147                             onclick="clearSiteKitAppStorage()"
     1145                            onclick="reauthenticateAndContinueSetup()"
    11481146                        ><?php esc_html_e( 'Click here', 'google-site-kit' ); ?></a>
    11491147                    </p>
     
    11521150                        sprintf(
    11531151                            "
    1154                             function clearSiteKitAppStorage() {
    1155                                 if ( localStorage ) {
    1156                                     localStorage.clear();
     1152                            function reauthenticateAndContinueSetup() {
     1153                                const moduleSlug = getAbandonedModuleSlug();
     1154
     1155                                if ( moduleSlug ) {
     1156                                    const redirect = '%3\$s&slug=' + moduleSlug;
     1157                                    document.location = '%2\$s&redirect=' + encodeURIComponent( redirect );
     1158                                } else {
     1159                                    if ( localStorage ) {
     1160                                        localStorage.clear();
     1161                                    }
     1162                                    if ( sessionStorage ) {
     1163                                        sessionStorage.clear();
     1164                                    }
     1165                                    document.location = '%2\$s';
    11571166                                }
    1158                                 if ( sessionStorage ) {
    1159                                     sessionStorage.clear();
     1167                            }
     1168
     1169                            function getAbandonedModuleSlug() {
     1170                                for ( const storage of [ localStorage, sessionStorage ] ) {
     1171                                    if ( ! storage ) {
     1172                                        continue;
     1173                                    }
     1174                                    const key = Object.keys( storage ).find( ( k ) =>
     1175                                        k.match( 'googlesitekit_%1\$s_.*_module_setup' )
     1176                                    );
     1177                                    if ( ! key ) {
     1178                                        continue;
     1179                                    }
     1180                                    try {
     1181                                        return JSON.parse( storage[ key ] )?.value;
     1182                                    } catch ( _ ) {}
    11601183                                }
    1161                                 document.location = '%s';
    11621184                            }
    11631185                            ",
    1164                             esc_url_raw( $this->get_connect_url() )
     1186                            GOOGLESITEKIT_VERSION,
     1187                            esc_url_raw( $this->get_connect_url() ),
     1188                            esc_url_raw(
     1189                                $this->context->admin_url(
     1190                                    'dashboard',
     1191                                    array(
     1192                                        'reAuth' => 'true',
     1193                                    )
     1194                                )
     1195                            )
    11651196                        )
    11661197                    );
  • google-site-kit/tags/1.174.0/includes/Core/Authentication/Clients/Client_Factory.php

    r3343017 r3479192  
    161161         * @since 1.115.0
    162162         *
    163          * @param $force_ip_resolve null|string IP version to force. Default: null.
     163         * @param null|string $force_ip_resolve IP version to force. Default: null.
    164164         */
    165165        $force_ip_resolve = apply_filters( 'googlesitekit_force_ip_resolve', null );
  • google-site-kit/tags/1.174.0/includes/Core/Authentication/Disconnected_Reason.php

    r3118692 r3479192  
    3939    public function register() {
    4040        parent::register();
    41         add_action( 'googlesitekit_authorize_user', array( $this, 'delete' ) );
     41        // The delete method returns a boolean but actions expect a void return, so we ignore it here.
     42        add_action( 'googlesitekit_authorize_user', array( $this, 'delete' ) ); // @phpstan-ignore return.void
    4243    }
    4344}
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Eligible_Subscribers_Query.php

    r3438138 r3479192  
    123123     */
    124124    private function query_shared_roles( $excluded_user_ids ) {
    125         $shared_roles = $this->modules->get_module_sharing_settings()->get_all_shared_roles();
     125        $sharing_settings = $this->modules->get_module_sharing_settings();
     126
     127        $shared_roles = array_unique(
     128            array_merge(
     129                $sharing_settings->get_shared_roles( 'analytics-4' ),
     130                $sharing_settings->get_shared_roles( 'search-console' )
     131            )
     132        );
    126133
    127134        if ( empty( $shared_roles ) ) {
     
    131138        $query = new WP_User_Query(
    132139            array(
    133                 'role__in'    => array_values( array_unique( $shared_roles ) ),
     140                'role__in'    => array_values( $shared_roles ),
    134141                'number'      => self::QUERY_LIMIT,
    135142                'count_total' => false,
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Email_Assets.php

    r3467940 r3479192  
    5858        // subscription-confirmation assets.
    5959        'subscription-envelope-graphic' => '2026-02-20-subscription-envelope-graphic.png',
     60        // error-email assets.
     61        'warning-icon'                  => '2026-02-20-warning-icon.png',
    6062    );
    6163
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Email_Log.php

    r3467940 r3479192  
    8282
    8383    /**
     84     * Template type meta key.
     85     *
     86     * @since 1.174.0
     87     */
     88    const META_TEMPLATE_TYPE = '_template_type';
     89
     90    /**
    8491     * Email log post statuses.
    8592     *
     
    9198    const STATUS_FAILED    = 'email_failed';
    9299    const STATUS_SCHEDULED = 'email_scheduled';
     100
     101    /**
     102     * Email template types.
     103     *
     104     * @since 1.174.0
     105     */
     106    const TEMPLATE_TYPE_EMAIL_REPORT      = 'email-report';
     107    const TEMPLATE_TYPE_SUBSCRIBE_SUCCESS = 'subscribe-success';
    93108
    94109    /**
     
    353368            )
    354369        );
     370
     371        register_post_meta(
     372            self::POST_TYPE,
     373            self::META_TEMPLATE_TYPE,
     374            array(
     375                'type'              => 'string',
     376                'single'            => true,
     377                'auth_callback'     => $auth_callback,
     378                'sanitize_callback' => array( __CLASS__, 'sanitize_template_type' ),
     379            )
     380        );
    355381    }
    356382
     
    483509    public static function sanitize_site_id( $value ) {
    484510        return absint( $value );
     511    }
     512
     513    /**
     514     * Sanitizes the template type meta value.
     515     *
     516     * @since 1.174.0
     517     *
     518     * @param mixed $value Meta value.
     519     * @return string Sanitized template type.
     520     */
     521    public static function sanitize_template_type( $value ) {
     522        $value = sanitize_text_field( $value );
     523
     524        $allowed = array(
     525            self::TEMPLATE_TYPE_EMAIL_REPORT,
     526            self::TEMPLATE_TYPE_SUBSCRIBE_SUCCESS,
     527        );
     528
     529        if ( in_array( $value, $allowed, true ) ) {
     530            return $value;
     531        }
     532
     533        return self::TEMPLATE_TYPE_EMAIL_REPORT;
    485534    }
    486535
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Email_Log_Batch_Query.php

    r3467940 r3479192  
    310310        }
    311311
    312         return get_post_meta( $batch_post_ids[0], Email_Log::META_ERROR_DETAILS, true );
     312        $first_post_id = min( $batch_post_ids );
     313        return get_post_meta( $first_post_id, Email_Log::META_ERROR_DETAILS, true );
    313314    }
    314315}
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Email_Log_Processor.php

    r3457523 r3479192  
    102102        }
    103103
     104        $template_type = $this->get_template_type_from_log( $email_log );
     105
     106        if ( Email_Log::TEMPLATE_TYPE_SUBSCRIBE_SUCCESS === $template_type ) {
     107            $this->process_subscription_confirmation_log( $post_id, $user, $frequency );
     108            return;
     109        }
     110
    104111        $date_range = $this->get_date_range_for_log( $email_log );
    105112        if ( is_wp_error( $date_range ) ) {
     
    143150
    144151    /**
     152     * Processes a subscription confirmation log.
     153     *
     154     * @since 1.174.0
     155     *
     156     * @param int     $post_id   Email log post ID.
     157     * @param WP_User $user      Recipient user.
     158     * @param string  $frequency Frequency slug.
     159     */
     160    private function process_subscription_confirmation_log( $post_id, WP_User $user, $frequency ) {
     161        $template_data = $this->template_formatter->prepare_subscription_confirmation_template_data( $frequency );
     162
     163        $send_result = $this->report_sender->send(
     164            $user,
     165            array(),
     166            $template_data,
     167            'subscription-confirmation'
     168        );
     169
     170        if ( is_wp_error( $send_result ) ) {
     171            $this->mark_failed( $post_id, $send_result );
     172            return;
     173        }
     174
     175        $this->mark_sent( $post_id );
     176    }
     177
     178    /**
    145179     * Retrieves a valid email log post.
    146180     *
     
    162196
    163197        return $email_log;
     198    }
     199
     200    /**
     201     * Gets the template type for an email log.
     202     *
     203     * @since 1.174.0
     204     *
     205     * @param WP_Post $email_log Email log post.
     206     * @return string Template type.
     207     */
     208    private function get_template_type_from_log( WP_Post $email_log ) {
     209        $template_type = get_post_meta( $email_log->ID, Email_Log::META_TEMPLATE_TYPE, true );
     210
     211        return Email_Log::sanitize_template_type( $template_type );
    164212    }
    165213
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Email_Report_Sender.php

    r3457523 r3479192  
    6464     * @param array   $sections_payload Sections payload.
    6565     * @param array   $template_data    Template data.
     66     * @param string  $template_name    Optional. Template name. Default Email_Log::TEMPLATE_TYPE_EMAIL_REPORT.
    6667     * @return true|WP_Error True on success, WP_Error on failure.
    6768     */
    68     public function send( WP_User $user, $sections_payload, $template_data ) {
     69    public function send( WP_User $user, $sections_payload, $template_data, $template_name = Email_Log::TEMPLATE_TYPE_EMAIL_REPORT ) {
    6970        $renderer = $this->template_renderer_factory->create( $sections_payload );
    7071
     
    7374        }
    7475
    75         $html_content = $this->render_template( $renderer, $template_data );
     76        $html_content = $this->render_template( $renderer, $template_data, $template_name );
    7677
    7778        if ( is_wp_error( $html_content ) ) {
     
    7980        }
    8081
    81         $text_content = $this->render_text_template( $renderer, $template_data );
     82        $text_content = $this->render_text_template( $renderer, $template_data, $template_name );
    8283
    8384        if ( is_wp_error( $text_content ) ) {
     
    113114     * @param Email_Template_Renderer $renderer      Template renderer instance.
    114115     * @param array                   $template_data Template data.
     116     * @param string                  $template_name Template name.
    115117     * @return string|WP_Error Rendered HTML or WP_Error.
    116118     */
    117     private function render_template( Email_Template_Renderer $renderer, $template_data ) {
    118         $rendered = $renderer->render( 'email-report', $template_data );
     119    private function render_template( Email_Template_Renderer $renderer, $template_data, $template_name ) {
     120        $rendered = $renderer->render( $template_name, $template_data );
    119121
    120122        if ( is_wp_error( $rendered ) ) {
     
    136138     * @param Email_Template_Renderer $renderer      Template renderer instance.
    137139     * @param array                   $template_data Template data.
     140     * @param string                  $template_name Template name.
    138141     * @return string|WP_Error Rendered plain text or WP_Error.
    139142     */
    140     private function render_text_template( Email_Template_Renderer $renderer, $template_data ) {
    141         $rendered = $renderer->render_text( 'email-report', $template_data );
     143    private function render_text_template( Email_Template_Renderer $renderer, $template_data, $template_name ) {
     144        $rendered = $renderer->render_text( $template_name, $template_data );
    142145
    143146        if ( is_wp_error( $rendered ) ) {
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Email_Reporting.php

    r3467940 r3479192  
    1414use Google\Site_Kit\Core\Email\Email;
    1515use Google\Site_Kit\Core\Authentication\Authentication;
     16use Google\Site_Kit\Core\Golinks\Golinks;
    1617use Google\Site_Kit\Core\Modules\Modules;
    1718use Google\Site_Kit\Core\Storage\Options;
     
    6667
    6768    /**
     69     * Golinks instance.
     70     *
     71     * @since 1.174.0
     72     * @var Golinks
     73     */
     74    protected $golinks;
     75
     76    /**
    6877     * Email_Reporting_Settings instance.
    6978     *
     
    182191     * @since 1.162.0
    183192     * @since 1.168.0 Added authentication dependency.
     193     * @since 1.174.0 Added golinks dependency.
    184194     *
    185195     * @param Context                       $context       Plugin context.
    186196     * @param Modules                       $modules       Modules instance.
    187197     * @param Email_Reporting_Data_Requests $data_requests Email reporting data requests.
     198     * @param Golinks                       $golinks       Golinks instance.
    188199     * @param Authentication                $authentication Authentication instance.
    189200     * @param Options|null                  $options       Optional. Options instance. Default is a new instance.
     
    194205        Modules $modules,
    195206        Email_Reporting_Data_Requests $data_requests,
     207        Golinks $golinks,
    196208        Authentication $authentication,
    197209        ?Options $options = null,
     
    201213        $this->modules        = $modules;
    202214        $this->data_requests  = $data_requests;
     215        $this->golinks        = $golinks;
    203216        $this->authentication = $authentication;
    204217        $this->options        = $options ?: new Options( $this->context );
     
    214227        $email_sender                 = new Email();
    215228        $section_builder              = new Email_Report_Section_Builder( $this->context );
    216         $template_formatter           = new Email_Template_Formatter( $this->context, $section_builder );
    217         $template_renderer_factory    = new Email_Template_Renderer_Factory( $this->context );
     229        $template_formatter           = new Email_Template_Formatter( $this->context, $section_builder, $this->golinks );
     230        $template_renderer_factory    = new Email_Template_Renderer_Factory( $this->context, $this->golinks );
    218231        $report_sender                = new Email_Report_Sender( $template_renderer_factory, $email_sender );
    219232        $log_processor                = new Email_Log_Processor( $this->email_log_batch_query, $this->data_requests, $template_formatter, $report_sender );
     
    224237            $this->user_settings,
    225238            $eligible_subscribers_query,
    226             $email_sender
     239            $email_sender,
     240            $this->golinks
    227241        );
    228         $this->email_log         = new Email_Log( $this->context );
     242        $this->email_log         = new Email_Log();
    229243        $this->scheduler         = new Email_Reporting_Scheduler( $frequency_planner );
    230244        $this->initiator_task    = new Initiator_Task( $this->scheduler, $this->subscribed_users_query );
     
    247261     */
    248262    public function register() {
     263        $this->golinks->register_handler( 'manage-subscription-email-reporting', new Email_Reporting_Golink_Handler() );
    249264        $this->settings->register();
    250265        $this->rest_controller->register();
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Email_Reporting_Data_Requests.php

    r3457523 r3479192  
    3838class Email_Reporting_Data_Requests {
    3939
     40    const PERMISSIONS_ERROR_STATUSES = array( 401, 403 );
     41
     42    const PERMISSIONS_ERROR_REASONS = array(
     43        'unauthorized',
     44        'authError',
     45        'expired',
     46        'required',
     47        'forbidden',
     48        'insufficientPermissions',
     49        'accountDeleted',
     50        'accountDisabled',
     51        'accessNotConfigured',
     52    );
     53
    4054    /**
    4155     * Modules instance.
     
    175189
    176190    /**
     191     * Categorizes a WP_Error based on its status and reason for better messaging in the front end.
     192     *
     193     * @since 1.174.0
     194     *
     195     * @param WP_Error $error       The error to categorize.
     196     * @param string   $module_slug The module slug related to the error.
     197     * @return WP_Error The categorized error with an added 'category' data field.
     198     */
     199    public function categorize_error( WP_Error $error, $module_slug ) {
     200        $status = $error->get_error_data()['status'];
     201        $reason = $error->get_error_data()['reason'];
     202
     203        $category = 'report_error';
     204        if ( in_array( $status, self::PERMISSIONS_ERROR_STATUSES, true ) || in_array( $reason, self::PERMISSIONS_ERROR_REASONS, true ) ) {
     205            $category = 'permissions_error';
     206        }
     207
     208        return new WP_Error(
     209            $error->get_error_code(),
     210            $error->get_error_message(),
     211            array_merge(
     212                $error->get_error_data(),
     213                array(
     214                    'category_id' => $category,
     215                    'module_slug' => $module_slug,
     216                )
     217            )
     218        );
     219    }
     220
     221    /**
    177222     * Gets active module slugs for email reporting.
    178223     *
     
    204249
    205250                if ( is_wp_error( $shared_payload ) ) {
    206                     return $shared_payload;
     251                    return $this->categorize_error( $shared_payload, $slug );
    207252                }
    208253
     
    223268
    224269            if ( is_wp_error( $result ) ) {
    225                 return $result;
     270                return $this->categorize_error( $result, $slug );
    226271            }
    227272
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Email_Reporting_Pointer.php

    r3457523 r3479192  
    176176                'buttons'         => sprintf(
    177177                    '<a class="googlesitekit-pointer-cta button-primary" data-action="dismiss" href="%s">%s</a>',
    178                     $this->context->admin_url( 'dashboard', array( 'email-reporting-panel' => 1 ) ),
     178                    $this->context->admin_url( 'dashboard', array( 'panel' => 'email-reporting' ) ),
    179179                    esc_html__( 'Set up', 'google-site-kit' )
    180180                ),
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Email_Reporting_Scheduler.php

    r3420533 r3479192  
    164164
    165165    /**
     166     * Schedules subscription confirmation delivery via existing worker and fallback pipeline.
     167     *
     168     * @since 1.174.0
     169     *
     170     * @param int   $user_id           User ID.
     171     * @param array $previous_settings Previous settings.
     172     * @param array $updated_settings  Updated settings.
     173     * @return true|\WP_Error True on success, WP_Error on failure.
     174     */
     175    public function schedule_email_confirmation( $user_id, array $previous_settings, array $updated_settings ) {
     176        $task  = new Subscription_Confirmation_Task( $this->frequency_planner );
     177        $batch = $task->maybe_schedule(
     178            $user_id,
     179            $previous_settings,
     180            $updated_settings
     181        );
     182
     183        if ( false === $batch ) {
     184            return true;
     185        }
     186
     187        if ( is_wp_error( $batch ) ) {
     188            return $batch;
     189        }
     190
     191        if ( empty( $batch['batch_id'] ) || empty( $batch['frequency'] ) || ! isset( $batch['timestamp'] ) ) {
     192            return new \WP_Error(
     193                'email_reporting_invalid_confirmation_batch',
     194                __( 'Subscription confirmation batch payload is invalid.', 'google-site-kit' ),
     195                array( 'status' => 500 )
     196            );
     197        }
     198
     199        $batch_id  = (string) $batch['batch_id'];
     200        $frequency = (string) $batch['frequency'];
     201        $timestamp = (int) $batch['timestamp'];
     202
     203        $this->schedule_worker( $batch_id, $frequency, $timestamp, 0 );
     204        $this->schedule_fallback( $batch_id, $frequency, $timestamp, 0 );
     205
     206        return true;
     207    }
     208
     209    /**
    166210     * Unschedules all email reporting related events.
    167211     *
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Email_Template_Formatter.php

    r3467940 r3479192  
    1212
    1313use Google\Site_Kit\Context;
     14use Google\Site_Kit\Core\Golinks\Golinks;
    1415use Google\Site_Kit\Core\User\Email_Reporting_Settings;
    1516use WP_Error;
     
    4546
    4647    /**
     48     * Golinks instance.
     49     *
     50     * @since 1.174.0
     51     *
     52     * @var Golinks
     53     */
     54    private $golinks;
     55
     56    /**
    4757     * Constructor.
    4858     *
    4959     * @since 1.170.0
     60     * @since 1.174.0 Added golinks dependency.
    5061     *
    5162     * @param Context                      $context         Plugin context.
    5263     * @param Email_Report_Section_Builder $section_builder Section builder instance.
    53      */
    54     public function __construct( Context $context, Email_Report_Section_Builder $section_builder ) {
     64     * @param Golinks                      $golinks         Golinks instance.
     65     */
     66    public function __construct( Context $context, Email_Report_Section_Builder $section_builder, Golinks $golinks ) {
    5567        $this->context         = $context;
    5668        $this->section_builder = $section_builder;
     69        $this->golinks         = $golinks;
    5770    }
    5871
     
    123136        }
    124137
    125         $sections_map = new Sections_Map( $this->context, $sections_payload );
     138        $sections_map = new Sections_Map( $this->context, $sections_payload, $this->golinks );
    126139        if ( empty( $sections_map->get_sections() ) ) {
    127140            return new WP_Error(
     
    299312     */
    300313    public function prepare_simple_email_data( $subject, $preheader, $email_data = array() ) {
    301         $site_domain = $this->get_site_domain();
     314        $site_domain        = $this->get_site_domain();
     315        $dashboard_url      = $this->golinks->get_url( 'dashboard' );
     316        $email_settings_url = $this->golinks->get_url( 'manage-subscription-email-reporting' );
     317        $help_center_url    = add_query_arg( 'doc', 'get-support', 'https://sitekit.withgoogle.com/support/' );
    302318
    303319        $data = array(
     
    311327            'primary_call_to_action' => array(
    312328                'label' => $email_data['cta_label'] ?? __( 'Get your report', 'google-site-kit' ),
    313                 'url'   => $email_data['cta_url'] ?? admin_url( 'admin.php?page=googlesitekit-dashboard' ),
     329                'url'   => $email_data['cta_url'] ?? $dashboard_url,
    314330            ),
    315331            'footer'                 => array(
    316                 'copy' => $email_data['footer_copy'] ?? '',
     332                'copy'            => $email_data['footer_copy'] ?? '',
     333                'unsubscribe_url' => $email_settings_url,
     334                'links'           => array(
     335                    array(
     336                        'label' => __( 'Manage subscription', 'google-site-kit' ),
     337                        'url'   => $email_settings_url,
     338                    ),
     339                    array(
     340                        'label' => __( 'Privacy Policy', 'google-site-kit' ),
     341                        'url'   => 'https://policies.google.com/privacy',
     342                    ),
     343                    array(
     344                        'label' => __( 'Help center', 'google-site-kit' ),
     345                        'url'   => $help_center_url,
     346                    ),
     347                ),
    317348            ),
    318349        );
    319350
    320351        return $data;
     352    }
     353
     354    /**
     355     * Builds template data for the subscription confirmation email.
     356     *
     357     * @since 1.174.0
     358     *
     359     * @param string $frequency Frequency slug.
     360     * @return array Template data.
     361     */
     362    public function prepare_subscription_confirmation_template_data( $frequency ) {
     363        $site_domain        = $this->get_site_domain();
     364        $frequency_label    = $this->get_frequency_label( $frequency );
     365        $first_report_date  = $this->get_first_report_date_label( $frequency );
     366        $dashboard_url      = $this->golinks->get_url( 'dashboard' );
     367        $email_settings_url = $this->golinks->get_url( 'manage-subscription-email-reporting' );
     368        $help_center_url    = add_query_arg( 'doc', 'get-support', 'https://sitekit.withgoogle.com/support/' );
     369
     370        return array(
     371            'subject'                => sprintf(
     372                /* translators: %s: Site domain. */
     373                __( 'Success! You’re subscribed to Site Kit reports for %s', 'google-site-kit' ),
     374                $site_domain
     375            ),
     376            'preheader'              => __( 'Your subscription is confirmed and your first report is on the way.', 'google-site-kit' ),
     377            'site'                   => array(
     378                'domain' => $site_domain,
     379                'url'    => $this->context->get_reference_site_url(),
     380            ),
     381            'title'                  => Content_Map::get_title( 'subscription-confirmation' ),
     382            'body'                   => Content_Map::get_body_with_args(
     383                'subscription-confirmation',
     384                array(
     385                    $frequency_label,
     386                    $first_report_date,
     387                )
     388            ),
     389            'learn_more_url'         => 'https://sitekit.withgoogle.com/documentation/email-reports/',
     390            'primary_call_to_action' => array(
     391                'label' => __( 'View dashboard', 'google-site-kit' ),
     392                'url'   => $dashboard_url,
     393            ),
     394            'footer'                 => array(
     395                'copy'            => __( 'You received this email because you signed up to receive email reports from Site Kit. If you do not want to receive these emails in the future you can unsubscribe', 'google-site-kit' ),
     396                'unsubscribe_url' => $email_settings_url,
     397                'links'           => array(
     398                    array(
     399                        'label' => __( 'Manage subscription', 'google-site-kit' ),
     400                        'url'   => $email_settings_url,
     401                    ),
     402                    array(
     403                        'label' => __( 'Privacy Policy', 'google-site-kit' ),
     404                        'url'   => 'https://policies.google.com/privacy',
     405                    ),
     406                    array(
     407                        'label' => __( 'Help center', 'google-site-kit' ),
     408                        'url'   => $help_center_url,
     409                    ),
     410                ),
     411            ),
     412        );
    321413    }
    322414
     
    331423     */
    332424    private function prepare_template_data( $frequency, $date_range ) {
     425        $dashboard_url      = $this->golinks->get_url( 'dashboard' );
     426        $email_settings_url = $this->golinks->get_url( 'manage-subscription-email-reporting' );
     427        $help_center_url    = add_query_arg( 'doc', 'get-support', 'https://sitekit.withgoogle.com/support/' );
     428
    333429        return array(
    334430            'subject'                => $this->build_subject( $frequency ),
     
    344440            'primary_call_to_action' => array(
    345441                'label' => __( 'View dashboard', 'google-site-kit' ),
    346                 'url'   => admin_url( 'admin.php?page=googlesitekit-dashboard' ),
     442                'url'   => $dashboard_url,
    347443            ),
    348444            'footer'                 => array(
    349445                'copy'            => __( 'You received this email because you signed up to receive email reports from Site Kit. If you do not want to receive these emails in the future you can unsubscribe', 'google-site-kit' ), // The space and unsubscribe link are handled in the template.
    350                 'unsubscribe_url' => admin_url( 'admin.php?page=googlesitekit-settings#/admin-settings' ),
     446                'unsubscribe_url' => $email_settings_url,
    351447                'links'           => array(
    352448                    array(
    353449                        'label' => __( 'Manage subscription', 'google-site-kit' ),
    354                         'url'   => admin_url( 'admin.php?page=googlesitekit-dashboard&email-reporting-panel=1' ),
     450                        'url'   => $email_settings_url,
    355451                    ),
    356452                    array(
     
    360456                    array(
    361457                        'label' => __( 'Help center', 'google-site-kit' ),
    362                         'url'   => 'https://sitekit.withgoogle.com/documentation/troubleshooting/site-kit-support/',
     458                        'url'   => $help_center_url,
    363459                    ),
    364460                ),
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Email_Template_Renderer.php

    r3467940 r3479192  
    160160        // Handle simple email templates (invitation-email, subscription-confirmation, etc.).
    161161        if ( 'email-report' !== $template_name ) {
    162             if ( empty( $data['body'] ) ) {
    163                 $data['body'] = Body_Content_Map::get_body( $template_name );
    164             }
    165 
    166162            return Plain_Text_Formatter::format_simple_email( $data );
    167163        }
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Email_Template_Renderer_Factory.php

    r3438138 r3479192  
    1212
    1313use Google\Site_Kit\Context;
     14use Google\Site_Kit\Core\Golinks\Golinks;
    1415
    1516/**
     
    3233
    3334    /**
     35     * Golinks instance.
     36     *
     37     * @since 1.174.0
     38     *
     39     * @var Golinks
     40     */
     41    private $golinks;
     42
     43    /**
    3444     * Constructor.
    3545     *
    3646     * @since 1.170.0
     47     * @since 1.174.0 Added golinks dependency.
    3748     *
    3849     * @param Context $context Plugin context.
     50     * @param Golinks $golinks Golinks instance.
    3951     */
    40     public function __construct( Context $context ) {
     52    public function __construct( Context $context, Golinks $golinks ) {
    4153        $this->context = $context;
     54        $this->golinks = $golinks;
    4255    }
    4356
     
    5164     */
    5265    public function create( array $sections_payload ) {
    53         return new Email_Template_Renderer( new Sections_Map( $this->context, $sections_payload ) );
     66        return new Email_Template_Renderer( new Sections_Map( $this->context, $sections_payload, $this->golinks ) );
    5467    }
    5568}
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Initiator_Task.php

    r3457523 r3479192  
    6666        $user_ids = $this->subscribed_users_query->for_frequency( $frequency );
    6767
    68         $reference_dates = $this->build_reference_dates( $frequency, $timestamp );
     68        $reference_dates = self::build_reference_dates( $frequency, $timestamp );
    6969
    7070        foreach ( $user_ids as $user_id ) {
     
    8181                        Email_Log::META_SEND_ATTEMPTS    => 0,
    8282                        Email_Log::META_SITE_ID          => get_current_blog_id(),
     83                        Email_Log::META_TEMPLATE_TYPE    => Email_Log::TEMPLATE_TYPE_EMAIL_REPORT,
    8384                    ),
    8485                )
     
    9394     * Builds the report reference dates for a batch.
    9495     *
     96     * @since 1.167.0
     97     * @since 1.174.0 Made method static.
     98     *
    9599     * @param string $frequency Frequency slug.
    96100     * @param int    $timestamp Base timestamp.
    97101     * @return array Reference date payload.
    98102     */
    99     private function build_reference_dates( $frequency, $timestamp ) {
     103    public static function build_reference_dates( $frequency, $timestamp ) {
    100104        $time_zone = wp_timezone();
    101105        $send_date = ( new DateTimeImmutable( '@' . $timestamp ) )
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Plain_Text_Formatter.php

    r3467940 r3479192  
    4545     *
    4646     * Simple emails share a common structure with customizable content.
    47      * The preheader is used as the main message body in plain text format.
    4847     *
    4948     * @since 1.173.0
    5049     *
    51      * @param array $data The simple email data containing site, preheader, learn_more_url,
    52      *                    primary_call_to_action, and footer.
     50     * @param array $data The simple email data containing site, title, learn_more_url,
     51     *                    primary_call_to_action, body, and footer.
    5352     * @return string Formatted plain text email.
    5453     */
    5554    public static function format_simple_email( $data ) {
    5655        $site_domain    = $data['site']['domain'] ?? '';
    57         $preheader      = $data['preheader'] ?? '';
     56        $title          = wp_strip_all_tags( $data['title'] ?? '' );
    5857        $learn_more_url = $data['learn_more_url'] ?? '';
    5958        $cta            = $data['primary_call_to_action'] ?? array();
     
    6665            $site_domain,
    6766            '',
    68             $preheader,
    69             '',
    7067        );
     68
     69        // Title.
     70        if ( ! empty( $title ) ) {
     71            $lines[] = $title;
     72            $lines[] = '';
     73        }
    7174
    7275        // Body paragraphs (strip any HTML tags for plain text output).
     
    9194            $lines[] = '';
    9295        }
     96
     97        $lines[] = str_repeat( '-', 50 );
     98        $lines[] = '';
    9399
    94100        // Footer copy.
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/REST_Email_Reporting_Controller.php

    r3467940 r3479192  
    1212
    1313use Google\Site_Kit\Core\Email\Email;
     14use Google\Site_Kit\Core\Golinks\Golinks;
    1415use Google\Site_Kit\Core\Modules\Modules;
    1516use Google\Site_Kit\Core\Permissions\Permissions;
     
    9798
    9899    /**
     100     * Golinks instance.
     101     *
     102     * @since 1.174.0
     103     * @var Golinks
     104     */
     105    private $golinks;
     106
     107    /**
    99108     * Constructor.
    100109     *
     
    102111     * @since 1.170.0 Added modules and user email reporting settings dependencies.
    103112     * @since 1.173.0 Added eligible subscribers query and email sender dependencies and removed unused user options dependency.
     113     * @since 1.174.0 Added golinks dependency.
    104114     *
    105115     * @param Email_Reporting_Settings      $settings                       Email_Reporting_Settings instance.
     
    108118     * @param Eligible_Subscribers_Query    $eligible_subscribers_query     Eligible subscribers query instance.
    109119     * @param Email                         $email_sender                   Email sender instance.
     120     * @param Golinks                       $golinks                        Golinks instance.
    110121     */
    111122    public function __construct(
     
    114125        User_Email_Reporting_Settings $user_email_reporting_settings,
    115126        Eligible_Subscribers_Query $eligible_subscribers_query,
    116         Email $email_sender
     127        Email $email_sender,
     128        Golinks $golinks
    117129    ) {
    118130        $this->settings                      = $settings;
     
    122134        $this->email_log_batch_query         = new Email_Log_Batch_Query();
    123135        $this->email_sender                  = $email_sender;
     136        $this->golinks                       = $golinks;
    124137    }
    125138
     
    382395            'role'        => $this->get_primary_role( $user ),
    383396            'subscribed'  => is_array( $settings ) && ! empty( $settings['subscribed'] ),
     397            'invited'     => $this->is_invite_rate_limited( $user->ID ),
    384398        );
    385399    }
     
    509523                'url'    => home_url( '/' ),
    510524            ),
    511             'body'                   => Body_Content_Map::get_body( 'invitation-email' ),
     525            'title'                  => Content_Map::get_title_with_args( 'invitation-email', array( $inviter_email ) ),
     526            'body'                   => Content_Map::get_body( 'invitation-email' ),
    512527            'inviter_email'          => $inviter_email,
    513528            'learn_more_url'         => 'https://sitekit.withgoogle.com/documentation/email-reports/',
    514529            'primary_call_to_action' => array(
    515530                'label' => __( 'Get your report', 'google-site-kit' ),
    516                 'url'   => admin_url( 'admin.php?page=googlesitekit-dashboard' ),
     531                'url'   => $this->golinks->get_url( 'manage-subscription-email-reporting' ),
    517532            ),
    518533            'footer'                 => array(
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/Sections_Map.php

    r3467940 r3479192  
    1212
    1313use Google\Site_Kit\Context;
     14use Google\Site_Kit\Core\Golinks\Golinks;
    1415
    1516/**
     
    7071
    7172    /**
     73     * Golinks instance.
     74     *
     75     * @since 1.174.0
     76     * @var Golinks
     77     */
     78    protected $golinks;
     79
     80    /**
    7281     * Constructor.
    7382     *
    7483     * @since 1.168.0
     84     * @since 1.174.0 Added golinks dependency.
    7585     *
    7686     * @param Context $context Plugin context.
    7787     * @param array   $payload The payload data to be used in sections.
    78      */
    79     public function __construct( Context $context, $payload ) {
     88     * @param Golinks $golinks Golinks instance.
     89     */
     90    public function __construct( Context $context, $payload, Golinks $golinks ) {
    8091        $this->context = $context;
    8192        $this->payload = $payload;
     93        $this->golinks = $golinks;
     94    }
     95
     96    /**
     97     * Gets the dashboard golink URL.
     98     *
     99     * @since 1.174.0
     100     *
     101     * @return string Dashboard URL.
     102     */
     103    protected function get_dashboard_url() {
     104        return $this->golinks->get_url( 'dashboard' );
    82105    }
    83106
     
    156179                'icon'             => 'conversions',
    157180                'section_template' => 'section-conversions',
    158                 'dashboard_url'    => $this->context->admin_url( 'dashboard' ),
     181                'dashboard_url'    => $this->get_dashboard_url(),
    159182                'section_parts'    => $section_parts,
    160183            ),
     
    215238                'icon'             => 'visitors',
    216239                'section_template' => 'section-metrics',
    217                 'dashboard_url'    => $this->context->admin_url( 'dashboard' ),
     240                'dashboard_url'    => $this->get_dashboard_url(),
    218241                'section_parts'    => $section_parts,
    219242            ),
     
    248271                'icon'             => 'search',
    249272                'section_template' => 'section-page-metrics',
    250                 'dashboard_url'    => $this->context->admin_url( 'dashboard' ),
     273                'dashboard_url'    => $this->get_dashboard_url(),
    251274                'section_parts'    => $section_parts,
    252275            ),
     
    287310                'icon'             => 'views',
    288311                'section_template' => 'section-page-metrics',
    289                 'dashboard_url'    => $this->context->admin_url( 'dashboard' ),
     312                'dashboard_url'    => $this->get_dashboard_url(),
    290313                'section_parts'    => $section_parts,
    291314            ),
     
    320343                'icon'             => 'growth',
    321344                'section_template' => 'section-page-metrics',
    322                 'dashboard_url'    => $this->context->admin_url( 'dashboard' ),
     345                'dashboard_url'    => $this->get_dashboard_url(),
    323346                'section_parts'    => $section_parts,
    324347            ),
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/templates/email-report/parts/header.php

    r3467940 r3479192  
    2323                <tr>
    2424                    <td style="vertical-align:top;" width="79">
    25                         <img src="<?php echo esc_url( $logo_url ); ?>" alt="<?php echo esc_attr__( 'Site Kit by Google', 'google-site-kit' ); ?>" width="79" height="22" style="display:block; margin-top: 12px;" />
     25                        <img src="<?php echo esc_url( $logo_url ); ?>" alt="<?php echo esc_attr__( 'Site Kit by Google', 'google-site-kit' ); ?>" width="79" height="22" style="display:block; margin-top: 8px;" />
    2626                    </td>
    2727                    <?php /* Extra centering for Outlook. */ ?>
    2828                    <td style="vertical-align:top; text-align:center;" align="center">
    2929                        <center>
    30                             <img src="<?php echo esc_url( $shooting_stars_url ); ?>" alt="" width="107" height="56" style="display:block; margin: 24px auto 0 auto;" align="center" />
     30                            <img src="<?php echo esc_url( $shooting_stars_url ); ?>" alt="" width="107" height="56" style="display:block; margin: 12px auto 0 auto;" align="center" />
    3131                        </center>
    3232                    </td>
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/templates/email-report/parts/section-conversions-metric-part.php

    r3467940 r3479192  
    5454                        ?>
    5555                    </td>
    56                     <td width="110"
    57                         style="font-size:12px; font-weight:500;  color:#6C726E; text-align: right; width: 110px; padding-bottom: 10px;">
     56                    <td class="subtitle" width="110" style="font-size:12px; font-weight:500; color:#6C726E; text-align: right; width: 110px; padding-bottom: 10px;">
    5857                        <?php echo esc_html( $change_context ); ?>
    5958                    </td>
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/templates/email-report/parts/section-conversions.php

    r3467940 r3479192  
    4343                        <?php echo esc_html( $section_parts['total_conversion_events']['data']['label'] ); ?>
    4444                    </td>
    45                     <td width="110" style="font-size:12px; line-height:16px; font-weight:500; color:#6C726E; text-align: right; width: 110px;">
     45                    <td class="subtitle" width="110" style="font-size:12px; line-height:16px; font-weight:500; color:#6C726E; text-align: right; width: 110px;">
    4646                        <?php echo esc_html( $section_parts['total_conversion_events']['data']['change_context'] ); ?>
    4747                    </td>
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/templates/email-report/parts/section-metrics.php

    r3467940 r3479192  
    4444                <tr>
    4545                    <td>&nbsp;</td>
    46                     <td width="110"
    47                         style="text-align: right; font-size:12px; line-height:16px; font-weight:500; color:#6C726E; width: 110px;">
     46                    <td class="subtitle" width="110" style="text-align: right; font-size:12px; line-height:16px; font-weight:500; color:#6C726E; width: 110px;">
    4847                        <?php echo esc_html( $subtitle ); ?>
    4948                    </td>
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/templates/email-report/template.php

    r3467940 r3479192  
    2020$preheader          = $data['preheader'];
    2121$site_domain        = $data['site']['domain'];
    22 $site_url           = $data['site']['url'];
     22$site_url           = ! empty( $data['site']['url'] ) ? $data['site']['url'] : '';
    2323$date_label         = $data['date_range']['label'];
    2424$primary_cta        = $data['primary_call_to_action'];
     
    110110            overflow: hidden;
    111111        }
     112
     113        @media (min-width: 481px) {
     114            .subtitle {
     115                /* `!important` used to override inline styles in the element. */
     116                width: auto !important;
     117            }
     118        }
    112119    </style>
    113120</head>
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/templates/invitation-email/template.php

    r3467940 r3479192  
    1818$site_domain        = $data['site']['domain'];
    1919$site_url           = $data['site']['url'];
     20$email_title        = $data['title'];
    2021$body               = $data['body'];
    2122$inviter_email      = $data['inviter_email'];
     
    143144                                        </p>
    144145
    145                                         <?php /* Invitation title. */ ?>
     146                                        <?php /* Title from Content_Map with inviter email link. */ ?>
    146147                                        <h1 style="font-size: 22px; line-height: 28px; font-weight: 500; color: #161B18; margin: 0 0 16px 0;">
    147148                                            <?php
    148                                             printf(
    149                                                 /* translators: %s: Email address of the person who sent the invitation (wrapped in mailto link) */
    150                                                 esc_html__( '%s invited you to receive periodic performance reports', 'google-site-kit' ),
    151                                                 /* Mailto link styled to match title text as inline styles prevent email clients from auto-styling the email address as a blue link. */
    152                                                 '<a href="mailto:' . esc_attr( $inviter_email ) . '" style="color: #161B18; text-decoration: none; font-weight: 500;">' . esc_html( $inviter_email ) . '</a>'
    153                                             );
     149                                            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Contains pre-escaped mailto link.
     150                                            echo $email_title;
    154151                                            ?>
    155152                                        </h1>
    156153
    157                                         <?php /* Body paragraphs from Body_Content_Map. */ ?>
     154                                        <?php /* Body paragraphs from Content_Map. */ ?>
    158155                                        <?php foreach ( $body as $index => $paragraph ) : ?>
    159156                                        <p style="font-size: 14px; line-height: 20px; font-weight: 400; color: #161B18; margin: 0 0 16px 0;">
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/templates/subscription-confirmation/parts/content.php

    r3467940 r3479192  
    1313 * @var string   $site_domain        The site domain.
    1414 * @var string   $site_url           The full site URL with protocol.
     15 * @var string   $title              The email title.
    1516 * @var array    $body               Body paragraphs (may contain HTML).
    1617 * @var array    $cta                Primary CTA configuration with 'url' and 'label'.
     
    3839            </p>
    3940
    40             <?php /* Title. */ ?>
     41            <?php /* Title from Content_Map. */ ?>
    4142            <h1 style="font-size: 22px; line-height: 28px; font-weight: 500; color: #161B18; margin: 0 0 16px 0;">
    42                 <?php echo esc_html__( 'Success! You’re subscribed to Site Kit reports', 'google-site-kit' ); ?>
     43                <?php echo esc_html( $title ); ?>
    4344            </h1>
    4445
    45             <?php /* Body paragraphs from Body_Content_Map. */ ?>
     46            <?php /* Body paragraphs from Content_Map. */ ?>
    4647            <?php foreach ( $body as $paragraph ) : ?>
    4748            <p style="font-size: 14px; line-height: 20px; font-weight: 400; color: #161B18; margin: 0 0 16px 0;">
  • google-site-kit/tags/1.174.0/includes/Core/Email_Reporting/templates/subscription-confirmation/template.php

    r3467940 r3479192  
    1818$site_domain        = $data['site']['domain'];
    1919$site_url           = $data['site']['url'];
     20$email_title        = $data['title'];
    2021$body               = $data['body'];
    2122$cta                = $data['primary_call_to_action'];
     
    138139                                    'site_domain'        => $site_domain,
    139140                                    'site_url'           => $site_url,
     141                                    'title'              => $email_title,
    140142                                    'body'               => $body,
    141143                                    'cta'                => $cta,
  • google-site-kit/tags/1.174.0/includes/Core/Modules/Module_With_Owner.php

    r3118692 r3479192  
    1010
    1111namespace Google\Site_Kit\Core\Modules;
     12
     13use Google\Site_Kit\Core\Authentication\Clients\OAuth_Client;
    1214
    1315/**
     
    2830     */
    2931    public function get_owner_id();
     32
     33    /**
     34     * Gets the OAuth_Client instance for the module owner.
     35     *
     36     * @since 1.174.0
     37     *
     38     * @return OAuth_Client OAuth_Client instance.
     39     */
     40    public function get_owner_oauth_client();
    3041}
  • google-site-kit/tags/1.174.0/includes/Core/Permissions/Permissions.php

    r3349867 r3479192  
    392392     */
    393393    private function check_dashboard_sharing_capability( $cap, $user_id, $args ) {
    394         if ( isset( $args[0] ) ) {
    395             $module_slug = $args[0];
    396         }
     394        $module_slug = $args[0] ?? '';
    397395
    398396        switch ( $cap ) {
  • google-site-kit/tags/1.174.0/includes/Core/Storage/Encrypted_User_Options.php

    r2466816 r3479192  
    127127     *
    128128     * @since 1.4.0
     129     * @since 1.174.0 Returns callable to restore previous user.
    129130     *
    130131     * @param int $user_id User ID.
     132     * @return callable A closure to switch back to the original user.
    131133     */
    132134    public function switch_user( $user_id ) {
    133         $this->user_options->switch_user( $user_id );
     135        return $this->user_options->switch_user( $user_id );
    134136    }
    135137}
  • google-site-kit/tags/1.174.0/includes/Core/User/Email_Reporting.php

    r3389193 r3479192  
    1111namespace Google\Site_Kit\Core\User;
    1212
     13use Google\Site_Kit\Core\Email_Reporting\Email_Reporting_Scheduler;
     14use Google\Site_Kit\Core\Email_Reporting\Frequency_Planner;
    1315use Google\Site_Kit\Core\Storage\User_Options;
    1416
     
    4648     */
    4749    public function __construct( User_Options $user_options ) {
     50        $frequency_planner = new Frequency_Planner();
     51        $scheduler         = new Email_Reporting_Scheduler( $frequency_planner );
     52
    4853        $this->email_reporting_settings = new Email_Reporting_Settings( $user_options );
    49         $this->rest_controller          = new REST_Email_Reporting_Controller( $this->email_reporting_settings );
     54        $this->rest_controller          = new REST_Email_Reporting_Controller(
     55            $this->email_reporting_settings,
     56            $scheduler
     57        );
    5058    }
    5159
  • google-site-kit/tags/1.174.0/includes/Core/User/REST_Email_Reporting_Controller.php

    r3397601 r3479192  
    1111namespace Google\Site_Kit\Core\User;
    1212
     13use Google\Site_Kit\Core\Email_Reporting\Email_Reporting_Scheduler;
    1314use Google\Site_Kit\Core\Permissions\Permissions;
    1415use Google\Site_Kit\Core\REST_API\REST_Route;
     
    3637
    3738    /**
     39     * Email reporting scheduler instance.
     40     *
     41     * @since 1.174.0
     42     * @var Email_Reporting_Scheduler
     43     */
     44    private $scheduler;
     45
     46    /**
    3847     * Constructor.
    3948     *
    4049     * @since 1.162.0
    4150     *
    42      * @param Email_Reporting_Settings $settings Email_Reporting_Settings instance.
     51     * @param Email_Reporting_Settings  $settings  Email_Reporting_Settings instance.
     52     * @param Email_Reporting_Scheduler $scheduler Scheduler instance.
    4353     */
    44     public function __construct( Email_Reporting_Settings $settings ) {
    45         $this->settings = $settings;
     54    public function __construct( Email_Reporting_Settings $settings, Email_Reporting_Scheduler $scheduler ) {
     55        $this->settings  = $settings;
     56        $this->scheduler = $scheduler;
    4657    }
    4758
     
    98109                        'methods'             => WP_REST_Server::EDITABLE,
    99110                        'callback'            => function ( WP_REST_Request $request ) {
     111                            $previous_settings = $this->settings->get();
    100112                            $settings = $request['data']['settings'];
    101113
    102114                            $this->settings->merge( $settings );
    103115
    104                             return new WP_REST_Response( $this->settings->get() );
     116                            $updated_settings = $this->settings->get();
     117
     118                            $scheduling_error = $this->scheduler->schedule_email_confirmation(
     119                                get_current_user_id(),
     120                                $previous_settings,
     121                                $updated_settings
     122                            );
     123
     124                            if ( is_wp_error( $scheduling_error ) ) {
     125                                return $scheduling_error;
     126                            }
     127
     128                            return new WP_REST_Response( $updated_settings );
    105129                        },
    106130                        'permission_callback' => $can_view_dashboard,
  • google-site-kit/tags/1.174.0/includes/Core/User_Input/Site_Specific_Answers.php

    r3118692 r3479192  
    103103                $valid_values['values'] = $valid_answers;
    104104
    105                 if ( ! empty( $valid_values ) ) {
    106                     $results[ $setting_key ] = $valid_values;
    107                 }
     105                $results[ $setting_key ] = $valid_values;
    108106            }
    109107
  • google-site-kit/tags/1.174.0/includes/Core/User_Input/User_Specific_Answers.php

    r3118692 r3479192  
    102102                $valid_values['values'] = $valid_answers;
    103103
    104                 if ( ! empty( $valid_values ) ) {
    105                     $results[ $setting_key ] = $valid_values;
    106                 }
     104                $results[ $setting_key ] = $valid_values;
    107105            }
    108106
  • google-site-kit/tags/1.174.0/includes/Core/Util/BC_Functions.php

    r3447448 r3479192  
    1919 * @access private
    2020 * @ignore
     21 *
     22 * @method static void wp_print_script_tag( $attributes )
     23 * @method static void wp_print_inline_script_tag( $javascript, $attributes = array() )
     24 * @method static bool array_is_list( array $value )
    2125 */
    2226class BC_Functions {
  • google-site-kit/tags/1.174.0/includes/Core/Util/Entity_Factory.php

    r3148853 r3479192  
    266266        // See WordPress's `get_the_archive_title()` function for this behavior. The strings here intentionally omit
    267267        // the 'google-site-kit' text domain since they should use WordPress core translations.
     268        $title = $term->name;
     269
    268270        switch ( $term->taxonomy ) {
    269271            case 'category':
    270                 $title  = $term->name;
    271272                $prefix = _x( 'Category:', 'category archive title prefix', 'default' );
    272273                break;
    273274            case 'post_tag':
    274                 $title  = $term->name;
    275275                $prefix = _x( 'Tag:', 'tag archive title prefix', 'default' );
    276276                break;
     
    309309            default:
    310310                $tax    = get_taxonomy( $term->taxonomy );
    311                 $title  = $term->name;
    312311                $prefix = sprintf(
    313312                    /* translators: %s: Taxonomy singular name. */
  • google-site-kit/tags/1.174.0/includes/Core/Util/URL.php

    r3148853 r3479192  
    1010
    1111namespace Google\Site_Kit\Core\Util;
     12
     13use Exception;
    1214
    1315/**
     
    6971        }
    7072
    71         return _get_component_from_parsed_url_array( $parts, $component );
     73        return _get_component_from_parsed_url_array( $parts, $component ); // @phpstan-ignore function.internal
    7274    }
    7375
  • google-site-kit/tags/1.174.0/includes/Modules/Analytics_4.php

    r3457523 r3479192  
    940940         * @since 1.1.0
    941941         *
    942          * @param $disabled bool Whether to disable tracking or not.
     942         * @param bool $disabled Whether to disable tracking or not.
    943943         */
    944944        return (bool) apply_filters( 'googlesitekit_analytics_tracking_disabled', $disabled );
     
    24282428            );
    24292429        }
     2430        return array();
    24302431    }
    24312432
  • google-site-kit/tags/1.174.0/includes/Modules/Analytics_4/Audience_Utilities.php

    r3457523 r3479192  
    198198     */
    199199    private function get_audience_type( $audience_slug ) {
    200         if ( ! $audience_slug ) {
    201             return 'USER_AUDIENCE';
    202         }
    203 
    204200        switch ( $audience_slug ) {
    205201            case 'all-users':
     
    210206                return 'SITE_KIT_AUDIENCE';
    211207        }
     208
     209        return 'USER_AUDIENCE';
    212210    }
    213211
  • google-site-kit/tags/1.174.0/includes/Modules/Analytics_4/Synchronize_AdSenseLinked.php

    r3118692 r3479192  
    1414use Google\Site_Kit\Core\Storage\Options;
    1515use Google\Site_Kit\Core\Storage\User_Options;
    16 use Google\Site_Kit\Modules\Adsense;
     16use Google\Site_Kit\Modules\AdSense;
    1717use Google\Site_Kit\Modules\Analytics_4;
    18 use Google\Site_Kit\Modules\AdSense\Settings as Adsense_Settings;
     18use Google\Site_Kit\Modules\AdSense\Settings as AdSense_Settings;
    1919
    2020/**
     
    8282
    8383    /**
    84      * Cron callback for synchronizing the adsense linked data.
     84     * Cron callback for synchronizing the AdSense linked data.
    8585     *
    8686     * @since 1.123.0
  • google-site-kit/tags/1.174.0/includes/Modules/Reader_Revenue_Manager.php

    r3467940 r3479192  
    4646use Google\Site_Kit\Core\Tracking\Provides_Feature_Metrics;
    4747use Google\Site_Kit\Core\Util\Block_Support;
    48 use Google\Site_Kit\Core\Util\Feature_Flags;
    4948use Google\Site_Kit\Core\Util\Method_Proxy_Trait;
    5049use Google\Site_Kit\Core\Util\URL;
     
    220219                    }
    221220
    222                     if ( Feature_Flags::enabled( 'rrmPolicyViolations' ) ) {
    223                         foreach ( self::POLICY_VIOLATION_NOTIFICATIONS as $notification ) {
    224                             $dismissed_items->remove( $notification );
    225                         }
     221                    foreach ( self::POLICY_VIOLATION_NOTIFICATIONS as $notification ) {
     222                        $dismissed_items->remove( $notification );
    226223                    }
    227224                }
     
    817814        }
    818815
    819         if ( Feature_Flags::enabled( 'rrmPolicyViolations' ) && isset( $settings['contentPolicyStatus'] ) ) {
     816        if ( isset( $settings['contentPolicyStatus'] ) ) {
    820817            $content_policy_status = (array) $settings['contentPolicyStatus'];
    821818            $content_policy_state  = $content_policy_status['contentPolicyState'] ?? '';
  • google-site-kit/tags/1.174.0/includes/Modules/Reader_Revenue_Manager/Admin_Post_List.php

    r3253534 r3479192  
    7575        }
    7676
    77         add_action(
    78             'bulk_edit_custom_box',
    79             array( $this, 'bulk_edit_field' ),
    80             10,
    81             2
    82         );
    83 
     77        add_action( 'bulk_edit_custom_box', array( $this, 'bulk_edit_field' ) );
    8478        add_action( 'save_post', array( $this, 'save_field' ) );
    8579    }
  • google-site-kit/tags/1.174.0/includes/Modules/Reader_Revenue_Manager/Settings.php

    r3447448 r3479192  
    1616use Google\Site_Kit\Core\Storage\Setting_With_ViewOnly_Keys_Interface;
    1717use Google\Site_Kit\Core\Util\BC_Functions;
    18 use Google\Site_Kit\Core\Util\Feature_Flags;
    1918use Google\Site_Kit\Core\Util\Method_Proxy_Trait;
    2019
     
    7170     */
    7271    protected function get_default() {
    73         $defaults = array(
     72        return array(
     73            'contentPolicyStatus'               => (object) array(),
    7474            'ownerID'                           => 0,
    7575            'publicationID'                     => '',
     
    8282            'productID'                         => 'openaccess',
    8383        );
    84 
    85         if ( Feature_Flags::enabled( 'rrmPolicyViolations' ) ) {
    86             $defaults['contentPolicyStatus'] = (object) array();
    87         }
    88 
    89         return $defaults;
    9084    }
    9185
     
    190184            }
    191185
    192             if ( Feature_Flags::enabled( 'rrmPolicyViolations' ) && isset( $option['contentPolicyStatus'] ) ) {
     186            if ( isset( $option['contentPolicyStatus'] ) ) {
    193187                // If the `contentPolicyStatus` setting is not an associative array, set it to an empty object.
    194188                if ( ! ( is_array( $option['contentPolicyStatus'] ) && ! BC_Functions::array_is_list( $option['contentPolicyStatus'] ) ) ) {
  • google-site-kit/tags/1.174.0/includes/Modules/Reader_Revenue_Manager/Synchronize_Publication.php

    r3447448 r3479192  
    1313use Google\Site_Kit\Core\Permissions\Permissions;
    1414use Google\Site_Kit\Core\Storage\User_Options;
    15 use Google\Site_Kit\Core\Util\Feature_Flags;
    1615use Google\Site_Kit\Modules\Reader_Revenue_Manager;
    1716use Google\Site_Kit_Dependencies\Google\Service\SubscribewithGoogle\Publication;
     
    128127            );
    129128
    130             if ( Feature_Flags::enabled( 'rrmPolicyViolations' ) ) {
    131                 $content_policy_status = $publication->getContentPolicyStatus();
    132 
    133                 if ( $content_policy_status ) {
    134                     $new_settings['contentPolicyStatus'] = (array) $content_policy_status->toSimpleObject();
    135                 }
     129            $content_policy_status = $publication->getContentPolicyStatus();
     130
     131            if ( $content_policy_status ) {
     132                $new_settings['contentPolicyStatus'] = (array) $content_policy_status->toSimpleObject();
    136133            }
    137134
  • google-site-kit/tags/1.174.0/includes/Modules/Search_Console/Email_Reporting/Report_Data_Builder.php

    r3447448 r3479192  
    473473        }
    474474
    475         if ( empty( $labels ) ) {
    476             return null;
    477         }
    478 
    479475        return array(
    480476            'section_key'      => $section_key,
  • google-site-kit/tags/1.174.0/includes/Modules/Sign_In_With_Google.php

    r3389193 r3479192  
    522522             * @param array $args Optional arguments to customize button attributes.
    523523             */
    524             do_action( 'googlesitekit_render_sign_in_with_google_button' );
     524            do_action( 'googlesitekit_render_sign_in_with_google_button', array() );
    525525            $content .= ob_get_clean();
    526526        }
  • google-site-kit/tags/1.174.0/includes/Plugin.php

    r3457523 r3479192  
    184184                $permissions = new Core\Permissions\Permissions( $this->context, $authentication, $modules, $user_options, $dismissed_items );
    185185                $permissions->register();
     186
     187                $golinks = new Core\Golinks\Golinks( $this->context );
     188                $golinks->register();
     189                $golinks->register_handler( 'dashboard', new Core\Golinks\Dashboard_Golink_Handler() );
    186190
    187191                $nonces = new Core\Nonces\Nonces( $this->context );
     
    241245                    );
    242246
    243                     ( new Core\Email_Reporting\Email_Reporting( $this->context, $modules, $data_requests, $authentication, $options, $user_options ) )->register();
     247                    ( new Core\Email_Reporting\Email_Reporting( $this->context, $modules, $data_requests, $golinks, $authentication, $options, $user_options ) )->register();
    244248                }
    245249
     
    318322
    319323        if ( file_exists( GOOGLESITEKIT_PLUGIN_DIR_PATH . 'dist/config.php' ) ) {
    320             $config = include GOOGLESITEKIT_PLUGIN_DIR_PATH . 'dist/config.php';
     324            $config = include GOOGLESITEKIT_PLUGIN_DIR_PATH . 'dist/config.php'; // @phpstan-ignore include.fileNotFound
    321325            Feature_Flags::set_features( (array) $config['features'] );
    322326        }
  • google-site-kit/tags/1.174.0/includes/loader.php

    r3118692 r3479192  
    1010
    1111namespace Google\Site_Kit;
    12 
    13 // Define global constants.
    14 define( 'GOOGLESITEKIT_PLUGIN_BASENAME', plugin_basename( GOOGLESITEKIT_PLUGIN_MAIN_FILE ) );
    15 define( 'GOOGLESITEKIT_PLUGIN_DIR_PATH', plugin_dir_path( GOOGLESITEKIT_PLUGIN_MAIN_FILE ) );
    1612
    1713/**
  • google-site-kit/tags/1.174.0/includes/vendor/composer/autoload_classmap.php

    r3467940 r3479192  
    8585    'Google\\Site_Kit\\Core\\Dismissals\\REST_Dismissals_Controller' => $baseDir . '/Core/Dismissals/REST_Dismissals_Controller.php',
    8686    'Google\\Site_Kit\\Core\\Email\\Email' => $baseDir . '/Core/Email/Email.php',
    87     'Google\\Site_Kit\\Core\\Email_Reporting\\Body_Content_Map' => $baseDir . '/Core/Email_Reporting/Body_Content_Map.php',
     87    'Google\\Site_Kit\\Core\\Email_Reporting\\Content_Map' => $baseDir . '/Core/Email_Reporting/Content_Map.php',
    8888    'Google\\Site_Kit\\Core\\Email_Reporting\\Eligible_Subscribers_Query' => $baseDir . '/Core/Email_Reporting/Eligible_Subscribers_Query.php',
    8989    'Google\\Site_Kit\\Core\\Email_Reporting\\Email_Assets' => $baseDir . '/Core/Email_Reporting/Email_Assets.php',
     
    9898    'Google\\Site_Kit\\Core\\Email_Reporting\\Email_Reporting' => $baseDir . '/Core/Email_Reporting/Email_Reporting.php',
    9999    'Google\\Site_Kit\\Core\\Email_Reporting\\Email_Reporting_Data_Requests' => $baseDir . '/Core/Email_Reporting/Email_Reporting_Data_Requests.php',
     100    'Google\\Site_Kit\\Core\\Email_Reporting\\Email_Reporting_Golink_Handler' => $baseDir . '/Core/Email_Reporting/Email_Reporting_Golink_Handler.php',
    100101    'Google\\Site_Kit\\Core\\Email_Reporting\\Email_Reporting_Pointer' => $baseDir . '/Core/Email_Reporting/Email_Reporting_Pointer.php',
    101102    'Google\\Site_Kit\\Core\\Email_Reporting\\Email_Reporting_Scheduler' => $baseDir . '/Core/Email_Reporting/Email_Reporting_Scheduler.php',
     
    115116    'Google\\Site_Kit\\Core\\Email_Reporting\\Sections_Map' => $baseDir . '/Core/Email_Reporting/Sections_Map.php',
    116117    'Google\\Site_Kit\\Core\\Email_Reporting\\Subscribed_Users_Query' => $baseDir . '/Core/Email_Reporting/Subscribed_Users_Query.php',
     118    'Google\\Site_Kit\\Core\\Email_Reporting\\Subscription_Confirmation_Task' => $baseDir . '/Core/Email_Reporting/Subscription_Confirmation_Task.php',
    117119    'Google\\Site_Kit\\Core\\Email_Reporting\\Worker_Task' => $baseDir . '/Core/Email_Reporting/Worker_Task.php',
    118120    'Google\\Site_Kit\\Core\\Expirables\\Expirable_Items' => $baseDir . '/Core/Expirables/Expirable_Items.php',
     
    122124    'Google\\Site_Kit\\Core\\Feature_Tours\\Feature_Tours' => $baseDir . '/Core/Feature_Tours/Feature_Tours.php',
    123125    'Google\\Site_Kit\\Core\\Feature_Tours\\REST_Feature_Tours_Controller' => $baseDir . '/Core/Feature_Tours/REST_Feature_Tours_Controller.php',
     126    'Google\\Site_Kit\\Core\\Golinks\\Dashboard_Golink_Handler' => $baseDir . '/Core/Golinks/Dashboard_Golink_Handler.php',
     127    'Google\\Site_Kit\\Core\\Golinks\\Golink_Handler_Interface' => $baseDir . '/Core/Golinks/Golink_Handler_Interface.php',
     128    'Google\\Site_Kit\\Core\\Golinks\\Golinks' => $baseDir . '/Core/Golinks/Golinks.php',
    124129    'Google\\Site_Kit\\Core\\Guards\\Guard_Interface' => $baseDir . '/Core/Guards/Guard_Interface.php',
    125130    'Google\\Site_Kit\\Core\\HTTP\\Middleware' => $baseDir . '/Core/HTTP/Middleware.php',
  • google-site-kit/tags/1.174.0/readme.txt

    r3467940 r3479192  
    55Tested up to:      6.9
    66Requires PHP:      7.4
    7 Stable tag:        1.173.0
     7Stable tag:        1.174.0
    88License:           Apache License 2.0
    99License URI:       https://www.apache.org/licenses/LICENSE-2.0
     
    110110== Changelog ==
    111111
    112 = 1.173.0 =
     112= 1.174.0 =
    113113
    114114**Enhanced**
    115115
    116 * Reset Reader Revenue Manager policy violation notification dismissals when connecting a different publication, or disconnecting the service. See [#12189](https://github.com/google/site-kit-wp/issues/12189).
    117 * Update opt-in user tracking for Reader Revenue Manager setup success notification. See [#12104](https://github.com/google/site-kit-wp/issues/12104).
    118 * Add GA4 tracking events for RRM policy violation notifications. See [#12103](https://github.com/google/site-kit-wp/issues/12103).
    119 * Prevent the Welcome modal from being shown to existing users when the Setup Flow Refresh feature flag is enabled. See [#12068](https://github.com/google/site-kit-wp/issues/12068).
    120 * Add "Action needed" badge to RRM module status for policy violations. See [#12017](https://github.com/google/site-kit-wp/issues/12017).
    121 * Add Reader Revenue Manager policy violation notifications in Site Kit settings. See [#12014](https://github.com/google/site-kit-wp/issues/12014).
    122 * Update email report to include dynamic conversion metrics based on sites' tracked metrics. See [#12001](https://github.com/google/site-kit-wp/issues/12001).
    123 * Update the unsubscribe notice of Email Reporting to have a black background. See [#11996](https://github.com/google/site-kit-wp/issues/11996).
    124 * Add a confirmation before disabling the Email Reporting settings. See [#11862](https://github.com/google/site-kit-wp/issues/11862).
    125 * Add subscription confirmation email template. See [#11853](https://github.com/google/site-kit-wp/issues/11853).
    126 * Add email invite template for email reporting. See [#11851](https://github.com/google/site-kit-wp/issues/11851).
    127 * Add Email Reporting stats to feature metrics. See [#11850](https://github.com/google/site-kit-wp/issues/11850).
    128 * Add the Search Console-only dashboard tour for the new setup flow. See [#11814](https://github.com/google/site-kit-wp/issues/11814).
    129 * Add support for base admin URLs that already contain query parameters in the `getAdminURL` selector. Props xipasduarte. See [#11115](https://github.com/google/site-kit-wp/issues/11115).
    130 * Add controls for Reader Revenue Manager settings in the WordPress site editor. See [#10312](https://github.com/google/site-kit-wp/issues/10312).
     116* Improve dismissal behavior for RRM policy violation notifications by delaying them for 24 hours after setup and allowing extreme notifications to reappear up to 5 times before permanent dismissal. See [#12247](https://github.com/google/site-kit-wp/issues/12247).
     117* Improve UX of Reader Revenue Manager module setup success notification when setting it up with a publication that has an extreme policy violation. See [#12245](https://github.com/google/site-kit-wp/issues/12245).
     118* Remove the `rrmPolicyViolations` feature flag. Props fresh3nough. See [#12232](https://github.com/google/site-kit-wp/issues/12232).
     119* Add error tracking for Site Kit modules to Email Reporting. See [#12110](https://github.com/google/site-kit-wp/issues/12110).
     120* Remove "New" badges from several modules/settings that are no longer new. See [#12096](https://github.com/google/site-kit-wp/issues/12096).
     121* Ensure the correct GA events are tracked for the dashboard tour. See [#12030](https://github.com/google/site-kit-wp/issues/12030).
     122* Add GA event tracking for user interactions with the "activate Analytics" notification. See [#12028](https://github.com/google/site-kit-wp/issues/12028).
     123* Add GA event tracking for user interaction with the Welcome modal. See [#12027](https://github.com/google/site-kit-wp/issues/12027).
     124* Enhance the reauthentication admin notice to continue an interrupted module setup flow after the user grants the required scopes. See [#11989](https://github.com/google/site-kit-wp/issues/11989).
     125* Adjust desktop layout on email reporting email-report template. See [#11898](https://github.com/google/site-kit-wp/issues/11898).
     126* Ensure query params persist during email subscription flow. See [#11890](https://github.com/google/site-kit-wp/issues/11890).
     127* Include the AdSense menu item in the updated help menu. See [#11877](https://github.com/google/site-kit-wp/issues/11877).
     128* Add component to allow subscription invitations. See [#11857](https://github.com/google/site-kit-wp/issues/11857).
     129* Add error email template. See [#11852](https://github.com/google/site-kit-wp/issues/11852).
     130* Add support for stable deep links to dashboard and email subscription management. See [#11849](https://github.com/google/site-kit-wp/issues/11849).
     131* Implement Email Reporting subscription confirmation email. See [#11842](https://github.com/google/site-kit-wp/issues/11842).
     132* Allow users to start the dashboard feature tour from the "Start a feature tour" item in the help menu. See [#11820](https://github.com/google/site-kit-wp/issues/11820).
     133* Add a notification that prompts users to connect more services after completing Site Kit setup. See [#11818](https://github.com/google/site-kit-wp/issues/11818).
    131134
    132135**Fixed**
    133136
    134 * Fix the issue when users with no permissions received emails from Email Reporting. See [#12152](https://github.com/google/site-kit-wp/issues/12152).
    135 * Update email headings text to use sentence-case. See [#11966](https://github.com/google/site-kit-wp/issues/11966).
    136 * Select the "In the field" tab immediately in the PageSpeed Insights widget when field data is available, preventing a flicker due to the "In the Lab" tab being active initially. See [#11173](https://github.com/google/site-kit-wp/issues/11173).
     137* Fix bug that caused the Key Metrics banner not to be dismissed. See [#12158](https://github.com/google/site-kit-wp/issues/12158).
     138* Optimize requests for view-only users of Dashboard Sharing when Analytics module is not shared. See [#11994](https://github.com/google/site-kit-wp/issues/11994).
     139* Fix bug that caused text on some notification banners to change/flicker when clicked. See [#11188](https://github.com/google/site-kit-wp/issues/11188).
    137140
    138141[See changelog for all versions](https://raw.githubusercontent.com/google/site-kit-wp/main/changelog.txt).
  • google-site-kit/trunk/dist/assets/blocks/reader-revenue-manager/contribute-with-google/block.json

    r3467940 r3479192  
    33    "apiVersion": 2,
    44    "name": "google-site-kit/rrm-contribute-with-google",
    5     "version": "1.173.0",
     5    "version": "1.174.0",
    66    "title": "Contribute with Google",
    77    "category": "widgets",
  • google-site-kit/trunk/dist/assets/blocks/reader-revenue-manager/contribute-with-google/v3/block.json

    r3467940 r3479192  
    33    "apiVersion": 3,
    44    "name": "google-site-kit/rrm-contribute-with-google",
    5     "version": "1.173.0",
     5    "version": "1.174.0",
    66    "title": "Contribute with Google",
    77    "category": "widgets",
  • google-site-kit/trunk/dist/assets/blocks/reader-revenue-manager/subscribe-with-google/block.json

    r3467940 r3479192  
    33    "apiVersion": 2,
    44    "name": "google-site-kit/rrm-subscribe-with-google",
    5     "version": "1.173.0",
     5    "version": "1.174.0",
    66    "title": "Subscribe with Google",
    77    "category": "widgets",
  • google-site-kit/trunk/dist/assets/blocks/reader-revenue-manager/subscribe-with-google/v3/block.json

    r3467940 r3479192  
    33    "apiVersion": 3,
    44    "name": "google-site-kit/rrm-subscribe-with-google",
    5     "version": "1.173.0",
     5    "version": "1.174.0",
    66    "title": "Subscribe with Google",
    77    "category": "widgets",
  • google-site-kit/trunk/dist/assets/blocks/sign-in-with-google/block.json

    r3467940 r3479192  
    33    "apiVersion": 2,
    44    "name": "google-site-kit/sign-in-with-google",
    5     "version": "1.173.0",
     5    "version": "1.174.0",
    66    "title": "Sign in with Google",
    77    "category": "widgets",
     
    1212        "shape": {
    1313            "type": "string",
    14             "enum": ["", "rectangular", "pill"]
     14            "enum": [ "", "rectangular", "pill" ]
    1515        },
    1616        "text": {
     
    2626        "theme": {
    2727            "type": "string",
    28             "enum": ["", "outline", "filled_blue", "filled_black"]
     28            "enum": [ "", "outline", "filled_blue", "filled_black" ]
    2929        },
    3030        "buttonClassName": {
  • google-site-kit/trunk/dist/assets/blocks/sign-in-with-google/v3/block.json

    r3467940 r3479192  
    33    "apiVersion": 3,
    44    "name": "google-site-kit/sign-in-with-google",
    5     "version": "1.173.0",
     5    "version": "1.174.0",
    66    "title": "Sign in with Google",
    77    "category": "widgets",
  • google-site-kit/trunk/dist/config.php

    r3457523 r3479192  
    88
    99return array(
    10     'features' => array( 'googleTagGateway','gtagUserData','privacySandboxModule','proactiveUserEngagement','rrmPolicyViolations','setupFlowRefresh' ),
     10    'features' => array( 'googleTagGateway','gtagUserData','privacySandboxModule','proactiveUserEngagement','setupFlowRefresh' ),
    1111);
  • google-site-kit/trunk/dist/manifest.php

    r3467940 r3479192  
    2828    'sign-in-with-google/index'                                       => array( "sign-in-with-google/index.js", null ),
    2929    'sign-in-with-google/editor-styles'                               => array( "sign-in-with-google/editor-styles.js", null ),
    30     'googlesitekit-admin-css'                                         => array( "googlesitekit-admin-css-d9aa9ae0497bce9f2e2b.min.css", null ),
     30    'googlesitekit-admin-css'                                         => array( "googlesitekit-admin-css-b0a55e41cd054885c01d.min.css", null ),
    3131    'googlesitekit-adminbar-css'                                      => array( "googlesitekit-adminbar-css-da31a8a65334682e590b.min.css", null ),
    3232    'googlesitekit-wp-dashboard-css'                                  => array( "googlesitekit-wp-dashboard-css-ff8420adbc8b86a5776c.min.css", null ),
    3333    'googlesitekit-authorize-application-css'                         => array( "googlesitekit-authorize-application-css-5b98b536e7f34c6411c1.min.css", null ),
    34     'googlesitekit-api'                                               => array( "googlesitekit-api-1b42ccd8014a64002e13.js", null ),
     34    'googlesitekit-api'                                               => array( "googlesitekit-api-6b742f1f3e956905b33c.js", null ),
    3535    'googlesitekit-data'                                              => array( "googlesitekit-data-ab56c0ab3c6231462584.js", null ),
    36     'googlesitekit-datastore-site'                                    => array( "googlesitekit-datastore-site-0ad3830862d5da40c7cc.js", null ),
    37     'googlesitekit-datastore-user'                                    => array( "googlesitekit-datastore-user-ee3b9189c8a41f17a304.js", null ),
    38     'googlesitekit-datastore-forms'                                   => array( "googlesitekit-datastore-forms-5c9a265fe07db133d11e.js", null ),
     36    'googlesitekit-datastore-site'                                    => array( "googlesitekit-datastore-site-d81d1d7e77fb878db074.js", null ),
     37    'googlesitekit-datastore-user'                                    => array( "googlesitekit-datastore-user-50662a4a25e8662f50d2.js", null ),
     38    'googlesitekit-datastore-forms'                                   => array( "googlesitekit-datastore-forms-75b32a3db427355b3d54.js", null ),
    3939    'googlesitekit-datastore-location'                                => array( "googlesitekit-datastore-location-6671f1e766c63f15d64f.js", null ),
    40     'googlesitekit-datastore-ui'                                      => array( "googlesitekit-datastore-ui-aae8b190894508c436a3.js", null ),
    41     'googlesitekit-modules'                                           => array( "googlesitekit-modules-ec132025723e115c493e.js", null ),
    42     'googlesitekit-notifications'                                     => array( "googlesitekit-notifications-aa32e0cf3becd3087d95.js", null ),
    43     'googlesitekit-widgets'                                           => array( "googlesitekit-widgets-c56d4ffc3e0d41ad8632.js", null ),
    44     'googlesitekit-modules-ads'                                       => array( "googlesitekit-modules-ads-f2cd5b1ca68cdc0afafc.js", null ),
    45     'googlesitekit-modules-adsense'                                   => array( "googlesitekit-modules-adsense-caf75cf03cc3f65ad722.js", null ),
    46     'googlesitekit-modules-analytics-4'                               => array( "googlesitekit-modules-analytics-4-08baceaf34b9dc342006.js", null ),
    47     'googlesitekit-modules-pagespeed-insights'                        => array( "googlesitekit-modules-pagespeed-insights-6460d6ee27011faeb822.js", null ),
    48     'googlesitekit-modules-reader-revenue-manager'                    => array( "googlesitekit-modules-reader-revenue-manager-35a4e97b0acf40878735.js", null ),
    49     'googlesitekit-modules-search-console'                            => array( "googlesitekit-modules-search-console-878bb1ae8fdd94ea3668.js", null ),
    50     'googlesitekit-modules-sign-in-with-google'                       => array( "googlesitekit-modules-sign-in-with-google-99767d36de8ec7cc6fd9.js", null ),
    51     'googlesitekit-modules-tagmanager'                                => array( "googlesitekit-modules-tagmanager-d3dc9c4311dfd79986ce.js", null ),
    52     'googlesitekit-user-input'                                        => array( "googlesitekit-user-input-c6ffcdff35f0c900e28b.js", null ),
    53     'googlesitekit-ad-blocking-recovery'                              => array( "googlesitekit-ad-blocking-recovery-b2c14915cb4d745197eb.js", null ),
    54     'googlesitekit-block-tracking'                                    => array( "googlesitekit-block-tracking-562fd213268d8cb25f04.js", null ),
     40    'googlesitekit-datastore-ui'                                      => array( "googlesitekit-datastore-ui-6ae38e48c7d1c550209c.js", null ),
     41    'googlesitekit-modules'                                           => array( "googlesitekit-modules-019df226afc930fb7baa.js", null ),
     42    'googlesitekit-notifications'                                     => array( "googlesitekit-notifications-d97f80ea7c9788e8616a.js", null ),
     43    'googlesitekit-widgets'                                           => array( "googlesitekit-widgets-291ae05540f5ce1d4b5f.js", null ),
     44    'googlesitekit-modules-ads'                                       => array( "googlesitekit-modules-ads-87ff0f042c3f8bb75ffe.js", null ),
     45    'googlesitekit-modules-adsense'                                   => array( "googlesitekit-modules-adsense-da3acba40b247879cea2.js", null ),
     46    'googlesitekit-modules-analytics-4'                               => array( "googlesitekit-modules-analytics-4-6c316f95903d72619464.js", null ),
     47    'googlesitekit-modules-pagespeed-insights'                        => array( "googlesitekit-modules-pagespeed-insights-e61b3aaa46e17ebf457f.js", null ),
     48    'googlesitekit-modules-reader-revenue-manager'                    => array( "googlesitekit-modules-reader-revenue-manager-28b1f326a7af16311546.js", null ),
     49    'googlesitekit-modules-search-console'                            => array( "googlesitekit-modules-search-console-42651fba89fd889cbbe8.js", null ),
     50    'googlesitekit-modules-sign-in-with-google'                       => array( "googlesitekit-modules-sign-in-with-google-aa284c1fba6c038e71ff.js", null ),
     51    'googlesitekit-modules-tagmanager'                                => array( "googlesitekit-modules-tagmanager-c24942280b3785810fd1.js", null ),
     52    'googlesitekit-user-input'                                        => array( "googlesitekit-user-input-ace5668810c71164dfe0.js", null ),
     53    'googlesitekit-ad-blocking-recovery'                              => array( "googlesitekit-ad-blocking-recovery-781b5e4c086bb56009ee.js", null ),
     54    'googlesitekit-block-tracking'                                    => array( "googlesitekit-block-tracking-15a11a002738d55d094b.js", null ),
    5555    'googlesitekit-polyfills'                                         => array( "googlesitekit-polyfills-f2726df5859ebd38706b.js", null ),
    5656    'googlesitekit-components'                                        => array( "googlesitekit-components-1288bf8a9eda8d2eaa36.js", null ),
    57     'googlesitekit-metric-selection'                                  => array( "googlesitekit-metric-selection-c09232a39f84c396a99f.js", null ),
    58     'googlesitekit-key-metrics-setup'                                 => array( "googlesitekit-key-metrics-setup-f327cd289672fb9d8d5c.js", null ),
    59     'googlesitekit-activation'                                        => array( "googlesitekit-activation-a18418b23eed5131e342.js", null ),
    60     'googlesitekit-adminbar'                                          => array( "googlesitekit-adminbar-8b23f8ec0b9885d93b72.js", null ),
    61     'googlesitekit-admin-pointers-tracking'                           => array( "googlesitekit-admin-pointers-tracking-c845ba1cde77a0f3bc14.js", null ),
    62     'googlesitekit-settings'                                          => array( "googlesitekit-settings-83ebe6d5a541de36c404.js", null ),
    63     'googlesitekit-main-dashboard'                                    => array( "googlesitekit-main-dashboard-4385a32f5ff0102cb3d2.js", null ),
    64     'googlesitekit-entity-dashboard'                                  => array( "googlesitekit-entity-dashboard-b61e170cdb6b569e03bb.js", null ),
    65     'googlesitekit-splash'                                            => array( "googlesitekit-splash-46fa2e595d002163ed1b.js", null ),
    66     'googlesitekit-wp-dashboard'                                      => array( "googlesitekit-wp-dashboard-a5d6a1d4bf8a176fcac7.js", null ),
     57    'googlesitekit-metric-selection'                                  => array( "googlesitekit-metric-selection-878a437e42477c6d1739.js", null ),
     58    'googlesitekit-key-metrics-setup'                                 => array( "googlesitekit-key-metrics-setup-acc873033a51c241703a.js", null ),
     59    'googlesitekit-activation'                                        => array( "googlesitekit-activation-33cfec7e5d5ce1d52c84.js", null ),
     60    'googlesitekit-adminbar'                                          => array( "googlesitekit-adminbar-edc2347b3d5db1c50fe9.js", null ),
     61    'googlesitekit-admin-pointers-tracking'                           => array( "googlesitekit-admin-pointers-tracking-aaf3edcbdbcc6193ae8f.js", null ),
     62    'googlesitekit-settings'                                          => array( "googlesitekit-settings-244369c6fd856ce6cdf5.js", null ),
     63    'googlesitekit-main-dashboard'                                    => array( "googlesitekit-main-dashboard-0712bc98382fa42245ba.js", null ),
     64    'googlesitekit-entity-dashboard'                                  => array( "googlesitekit-entity-dashboard-50d1fe8d423ac6604e9a.js", null ),
     65    'googlesitekit-splash'                                            => array( "googlesitekit-splash-f26e7cde106af6278046.js", null ),
     66    'googlesitekit-wp-dashboard'                                      => array( "googlesitekit-wp-dashboard-eec86376ce895eb5422a.js", null ),
    6767    'googlesitekit-runtime'                                           => array( "runtime-4b2eb8d81a08b104395a.js", null ),
    6868    'googlesitekit-vendor'                                            => array( "googlesitekit-vendor-568c1105b8e4f20eff16.js", null ),
  • google-site-kit/trunk/google-site-kit.php

    r3467940 r3479192  
    1212 * Plugin URI:        https://sitekit.withgoogle.com
    1313 * Description:       Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
    14  * Version:           1.173.0
     14 * Version:           1.174.0
    1515 * Requires at least: 5.2
    1616 * Requires PHP:      7.4
     
    2727
    2828// Define most essential constants.
    29 define( 'GOOGLESITEKIT_VERSION', '1.173.0' );
     29define( 'GOOGLESITEKIT_VERSION', '1.174.0' );
    3030define( 'GOOGLESITEKIT_PLUGIN_MAIN_FILE', __FILE__ );
     31define( 'GOOGLESITEKIT_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
     32define( 'GOOGLESITEKIT_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) );
    3133define( 'GOOGLESITEKIT_PHP_MINIMUM', '7.4.0' );
    3234define( 'GOOGLESITEKIT_WP_MINIMUM', '5.2.0' );
  • google-site-kit/trunk/includes/Context.php

    r3349867 r3479192  
    379379            // If recent version, we can properly detect the mode.
    380380            if ( $amp_plugin_version_2_or_higher ) {
    381                 $mode = AMP_Options_Manager::get_option( 'theme_support' );
     381                $mode = AMP_Options_Manager::get_option( 'theme_support' ); // @phpstan-ignore class.notFound
    382382            } else {
    383383                $mode = AMP_Theme_Support::get_support_mode();
  • google-site-kit/trunk/includes/Core/Admin/Screens.php

    r3407206 r3479192  
    190190                $dashboard_index = array_search( 'index.php', $menu_order, true );
    191191
    192                 $sitekit_index = false;
     192                if ( false === $dashboard_index ) {
     193                    return $menu_order;
     194                }
     195
    193196                foreach ( $menu_order as $key => $value ) {
    194197                    if ( strpos( $value, self::PREFIX ) === 0 ) {
    195                         $sitekit_index = $key;
    196                         $sitekit_value = $value;
     198                        unset( $menu_order[ $key ] );
     199                        array_splice( $menu_order, $dashboard_index + 1, 0, $value );
    197200                        break;
    198201                    }
    199202                }
    200203
    201                 if ( false === $dashboard_index || false === $sitekit_index ) {
    202                     return $menu_order;
    203                 }
    204                 unset( $menu_order[ $sitekit_index ] );
    205                 array_splice( $menu_order, $dashboard_index + 1, 0, $sitekit_value );
    206204                return $menu_order;
    207205            }
     
    293291
    294292        if ( current_user_can( Permissions::VIEW_SPLASH ) ) {
     293            $notification = $this->context->input()->filter( INPUT_GET, 'notification' );
     294            $panel        = $this->context->input()->filter( INPUT_GET, 'panel' );
     295
    295296            wp_safe_redirect(
    296                 $this->context->admin_url( 'splash' )
     297                $this->context->admin_url(
     298                    'splash',
     299                    array_filter(
     300                        array(
     301                            'notification' => $notification,
     302                            'panel'        => $panel,
     303                        ),
     304                        function ( $value ) {
     305                            return null !== $value && '' !== $value;
     306                        }
     307                    )
     308                )
    297309            );
    298310            exit;
     
    317329
    318330        if ( current_user_can( Permissions::VIEW_DASHBOARD ) ) {
     331            $notification = $this->context->input()->filter( INPUT_GET, 'notification' );
     332            $panel        = $this->context->input()->filter( INPUT_GET, 'panel' );
     333
    319334            wp_safe_redirect(
    320                 $this->context->admin_url()
     335                $this->context->admin_url(
     336                    'dashboard',
     337                    array_filter(
     338                        array(
     339                            'notification' => $notification,
     340                            'panel'        => $panel,
     341                        ),
     342                        function ( $value ) {
     343                            return null !== $value && '' !== $value;
     344                        }
     345                    )
     346                )
    321347            );
    322348            exit;
     
    507533                                $context->admin_url(
    508534                                    'dashboard',
    509                                     array(
    510                                         // Pass through the notification parameter, or removes it if none.
    511                                         'notification' => $context->input()->filter( INPUT_GET, 'notification' ),
     535                                    array_filter(
     536                                        array(
     537                                            // Pass through supported params, or remove if none.
     538                                            'notification' => $context->input()->filter( INPUT_GET, 'notification' ),
     539                                            'panel'        => $context->input()->filter( INPUT_GET, 'panel' ),
     540                                        ),
     541                                        function ( $value ) {
     542                                            return null !== $value && '' !== $value;
     543                                        }
    512544                                    )
    513545                                )
  • google-site-kit/trunk/includes/Core/Assets/Script.php

    r3118692 r3479192  
    7171        if ( $src ) {
    7272            $entry = Manifest::get( $this->handle );
     73
     74            list( $filename, $hash ) = array( null, null );
    7375
    7476            if ( is_array( $entry[0] ) ) {
  • google-site-kit/trunk/includes/Core/Authentication/Authentication.php

    r3397601 r3479192  
    313313
    314314                $this->set_connected_proxy_url();
    315             },
    316             10,
    317             3
     315            }
    318316        );
    319317
     
    11451143                        <a
    11461144                            href="#"
    1147                             onclick="clearSiteKitAppStorage()"
     1145                            onclick="reauthenticateAndContinueSetup()"
    11481146                        ><?php esc_html_e( 'Click here', 'google-site-kit' ); ?></a>
    11491147                    </p>
     
    11521150                        sprintf(
    11531151                            "
    1154                             function clearSiteKitAppStorage() {
    1155                                 if ( localStorage ) {
    1156                                     localStorage.clear();
     1152                            function reauthenticateAndContinueSetup() {
     1153                                const moduleSlug = getAbandonedModuleSlug();
     1154
     1155                                if ( moduleSlug ) {
     1156                                    const redirect = '%3\$s&slug=' + moduleSlug;
     1157                                    document.location = '%2\$s&redirect=' + encodeURIComponent( redirect );
     1158                                } else {
     1159                                    if ( localStorage ) {
     1160                                        localStorage.clear();
     1161                                    }
     1162                                    if ( sessionStorage ) {
     1163                                        sessionStorage.clear();
     1164                                    }
     1165                                    document.location = '%2\$s';
    11571166                                }
    1158                                 if ( sessionStorage ) {
    1159                                     sessionStorage.clear();
     1167                            }
     1168
     1169                            function getAbandonedModuleSlug() {
     1170                                for ( const storage of [ localStorage, sessionStorage ] ) {
     1171                                    if ( ! storage ) {
     1172                                        continue;
     1173                                    }
     1174                                    const key = Object.keys( storage ).find( ( k ) =>
     1175                                        k.match( 'googlesitekit_%1\$s_.*_module_setup' )
     1176                                    );
     1177                                    if ( ! key ) {
     1178                                        continue;
     1179                                    }
     1180                                    try {
     1181                                        return JSON.parse( storage[ key ] )?.value;
     1182                                    } catch ( _ ) {}
    11601183                                }
    1161                                 document.location = '%s';
    11621184                            }
    11631185                            ",
    1164                             esc_url_raw( $this->get_connect_url() )
     1186                            GOOGLESITEKIT_VERSION,
     1187                            esc_url_raw( $this->get_connect_url() ),
     1188                            esc_url_raw(
     1189                                $this->context->admin_url(
     1190                                    'dashboard',
     1191                                    array(
     1192                                        'reAuth' => 'true',
     1193                                    )
     1194                                )
     1195                            )
    11651196                        )
    11661197                    );
  • google-site-kit/trunk/includes/Core/Authentication/Clients/Client_Factory.php

    r3343017 r3479192  
    161161         * @since 1.115.0
    162162         *
    163          * @param $force_ip_resolve null|string IP version to force. Default: null.
     163         * @param null|string $force_ip_resolve IP version to force. Default: null.
    164164         */
    165165        $force_ip_resolve = apply_filters( 'googlesitekit_force_ip_resolve', null );
  • google-site-kit/trunk/includes/Core/Authentication/Disconnected_Reason.php

    r3118692 r3479192  
    3939    public function register() {
    4040        parent::register();
    41         add_action( 'googlesitekit_authorize_user', array( $this, 'delete' ) );
     41        // The delete method returns a boolean but actions expect a void return, so we ignore it here.
     42        add_action( 'googlesitekit_authorize_user', array( $this, 'delete' ) ); // @phpstan-ignore return.void
    4243    }
    4344}
  • google-site-kit/trunk/includes/Core/Email_Reporting/Eligible_Subscribers_Query.php

    r3438138 r3479192  
    123123     */
    124124    private function query_shared_roles( $excluded_user_ids ) {
    125         $shared_roles = $this->modules->get_module_sharing_settings()->get_all_shared_roles();
     125        $sharing_settings = $this->modules->get_module_sharing_settings();
     126
     127        $shared_roles = array_unique(
     128            array_merge(
     129                $sharing_settings->get_shared_roles( 'analytics-4' ),
     130                $sharing_settings->get_shared_roles( 'search-console' )
     131            )
     132        );
    126133
    127134        if ( empty( $shared_roles ) ) {
     
    131138        $query = new WP_User_Query(
    132139            array(
    133                 'role__in'    => array_values( array_unique( $shared_roles ) ),
     140                'role__in'    => array_values( $shared_roles ),
    134141                'number'      => self::QUERY_LIMIT,
    135142                'count_total' => false,
  • google-site-kit/trunk/includes/Core/Email_Reporting/Email_Assets.php

    r3467940 r3479192  
    5858        // subscription-confirmation assets.
    5959        'subscription-envelope-graphic' => '2026-02-20-subscription-envelope-graphic.png',
     60        // error-email assets.
     61        'warning-icon'                  => '2026-02-20-warning-icon.png',
    6062    );
    6163
  • google-site-kit/trunk/includes/Core/Email_Reporting/Email_Log.php

    r3467940 r3479192  
    8282
    8383    /**
     84     * Template type meta key.
     85     *
     86     * @since 1.174.0
     87     */
     88    const META_TEMPLATE_TYPE = '_template_type';
     89
     90    /**
    8491     * Email log post statuses.
    8592     *
     
    9198    const STATUS_FAILED    = 'email_failed';
    9299    const STATUS_SCHEDULED = 'email_scheduled';
     100
     101    /**
     102     * Email template types.
     103     *
     104     * @since 1.174.0
     105     */
     106    const TEMPLATE_TYPE_EMAIL_REPORT      = 'email-report';
     107    const TEMPLATE_TYPE_SUBSCRIBE_SUCCESS = 'subscribe-success';
    93108
    94109    /**
     
    353368            )
    354369        );
     370
     371        register_post_meta(
     372            self::POST_TYPE,
     373            self::META_TEMPLATE_TYPE,
     374            array(
     375                'type'              => 'string',
     376                'single'            => true,
     377                'auth_callback'     => $auth_callback,
     378                'sanitize_callback' => array( __CLASS__, 'sanitize_template_type' ),
     379            )
     380        );
    355381    }
    356382
     
    483509    public static function sanitize_site_id( $value ) {
    484510        return absint( $value );
     511    }
     512
     513    /**
     514     * Sanitizes the template type meta value.
     515     *
     516     * @since 1.174.0
     517     *
     518     * @param mixed $value Meta value.
     519     * @return string Sanitized template type.
     520     */
     521    public static function sanitize_template_type( $value ) {
     522        $value = sanitize_text_field( $value );
     523
     524        $allowed = array(
     525            self::TEMPLATE_TYPE_EMAIL_REPORT,
     526            self::TEMPLATE_TYPE_SUBSCRIBE_SUCCESS,
     527        );
     528
     529        if ( in_array( $value, $allowed, true ) ) {
     530            return $value;
     531        }
     532
     533        return self::TEMPLATE_TYPE_EMAIL_REPORT;
    485534    }
    486535
  • google-site-kit/trunk/includes/Core/Email_Reporting/Email_Log_Batch_Query.php

    r3467940 r3479192  
    310310        }
    311311
    312         return get_post_meta( $batch_post_ids[0], Email_Log::META_ERROR_DETAILS, true );
     312        $first_post_id = min( $batch_post_ids );
     313        return get_post_meta( $first_post_id, Email_Log::META_ERROR_DETAILS, true );
    313314    }
    314315}
  • google-site-kit/trunk/includes/Core/Email_Reporting/Email_Log_Processor.php

    r3457523 r3479192  
    102102        }
    103103
     104        $template_type = $this->get_template_type_from_log( $email_log );
     105
     106        if ( Email_Log::TEMPLATE_TYPE_SUBSCRIBE_SUCCESS === $template_type ) {
     107            $this->process_subscription_confirmation_log( $post_id, $user, $frequency );
     108            return;
     109        }
     110
    104111        $date_range = $this->get_date_range_for_log( $email_log );
    105112        if ( is_wp_error( $date_range ) ) {
     
    143150
    144151    /**
     152     * Processes a subscription confirmation log.
     153     *
     154     * @since 1.174.0
     155     *
     156     * @param int     $post_id   Email log post ID.
     157     * @param WP_User $user      Recipient user.
     158     * @param string  $frequency Frequency slug.
     159     */
     160    private function process_subscription_confirmation_log( $post_id, WP_User $user, $frequency ) {
     161        $template_data = $this->template_formatter->prepare_subscription_confirmation_template_data( $frequency );
     162
     163        $send_result = $this->report_sender->send(
     164            $user,
     165            array(),
     166            $template_data,
     167            'subscription-confirmation'
     168        );
     169
     170        if ( is_wp_error( $send_result ) ) {
     171            $this->mark_failed( $post_id, $send_result );
     172            return;
     173        }
     174
     175        $this->mark_sent( $post_id );
     176    }
     177
     178    /**
    145179     * Retrieves a valid email log post.
    146180     *
     
    162196
    163197        return $email_log;
     198    }
     199
     200    /**
     201     * Gets the template type for an email log.
     202     *
     203     * @since 1.174.0
     204     *
     205     * @param WP_Post $email_log Email log post.
     206     * @return string Template type.
     207     */
     208    private function get_template_type_from_log( WP_Post $email_log ) {
     209        $template_type = get_post_meta( $email_log->ID, Email_Log::META_TEMPLATE_TYPE, true );
     210
     211        return Email_Log::sanitize_template_type( $template_type );
    164212    }
    165213
  • google-site-kit/trunk/includes/Core/Email_Reporting/Email_Report_Sender.php

    r3457523 r3479192  
    6464     * @param array   $sections_payload Sections payload.
    6565     * @param array   $template_data    Template data.
     66     * @param string  $template_name    Optional. Template name. Default Email_Log::TEMPLATE_TYPE_EMAIL_REPORT.
    6667     * @return true|WP_Error True on success, WP_Error on failure.
    6768     */
    68     public function send( WP_User $user, $sections_payload, $template_data ) {
     69    public function send( WP_User $user, $sections_payload, $template_data, $template_name = Email_Log::TEMPLATE_TYPE_EMAIL_REPORT ) {
    6970        $renderer = $this->template_renderer_factory->create( $sections_payload );
    7071
     
    7374        }
    7475
    75         $html_content = $this->render_template( $renderer, $template_data );
     76        $html_content = $this->render_template( $renderer, $template_data, $template_name );
    7677
    7778        if ( is_wp_error( $html_content ) ) {
     
    7980        }
    8081
    81         $text_content = $this->render_text_template( $renderer, $template_data );
     82        $text_content = $this->render_text_template( $renderer, $template_data, $template_name );
    8283
    8384        if ( is_wp_error( $text_content ) ) {
     
    113114     * @param Email_Template_Renderer $renderer      Template renderer instance.
    114115     * @param array                   $template_data Template data.
     116     * @param string                  $template_name Template name.
    115117     * @return string|WP_Error Rendered HTML or WP_Error.
    116118     */
    117     private function render_template( Email_Template_Renderer $renderer, $template_data ) {
    118         $rendered = $renderer->render( 'email-report', $template_data );
     119    private function render_template( Email_Template_Renderer $renderer, $template_data, $template_name ) {
     120        $rendered = $renderer->render( $template_name, $template_data );
    119121
    120122        if ( is_wp_error( $rendered ) ) {
     
    136138     * @param Email_Template_Renderer $renderer      Template renderer instance.
    137139     * @param array                   $template_data Template data.
     140     * @param string                  $template_name Template name.
    138141     * @return string|WP_Error Rendered plain text or WP_Error.
    139142     */
    140     private function render_text_template( Email_Template_Renderer $renderer, $template_data ) {
    141         $rendered = $renderer->render_text( 'email-report', $template_data );
     143    private function render_text_template( Email_Template_Renderer $renderer, $template_data, $template_name ) {
     144        $rendered = $renderer->render_text( $template_name, $template_data );
    142145
    143146        if ( is_wp_error( $rendered ) ) {
  • google-site-kit/trunk/includes/Core/Email_Reporting/Email_Reporting.php

    r3467940 r3479192  
    1414use Google\Site_Kit\Core\Email\Email;
    1515use Google\Site_Kit\Core\Authentication\Authentication;
     16use Google\Site_Kit\Core\Golinks\Golinks;
    1617use Google\Site_Kit\Core\Modules\Modules;
    1718use Google\Site_Kit\Core\Storage\Options;
     
    6667
    6768    /**
     69     * Golinks instance.
     70     *
     71     * @since 1.174.0
     72     * @var Golinks
     73     */
     74    protected $golinks;
     75
     76    /**
    6877     * Email_Reporting_Settings instance.
    6978     *
     
    182191     * @since 1.162.0
    183192     * @since 1.168.0 Added authentication dependency.
     193     * @since 1.174.0 Added golinks dependency.
    184194     *
    185195     * @param Context                       $context       Plugin context.
    186196     * @param Modules                       $modules       Modules instance.
    187197     * @param Email_Reporting_Data_Requests $data_requests Email reporting data requests.
     198     * @param Golinks                       $golinks       Golinks instance.
    188199     * @param Authentication                $authentication Authentication instance.
    189200     * @param Options|null                  $options       Optional. Options instance. Default is a new instance.
     
    194205        Modules $modules,
    195206        Email_Reporting_Data_Requests $data_requests,
     207        Golinks $golinks,
    196208        Authentication $authentication,
    197209        ?Options $options = null,
     
    201213        $this->modules        = $modules;
    202214        $this->data_requests  = $data_requests;
     215        $this->golinks        = $golinks;
    203216        $this->authentication = $authentication;
    204217        $this->options        = $options ?: new Options( $this->context );
     
    214227        $email_sender                 = new Email();
    215228        $section_builder              = new Email_Report_Section_Builder( $this->context );
    216         $template_formatter           = new Email_Template_Formatter( $this->context, $section_builder );
    217         $template_renderer_factory    = new Email_Template_Renderer_Factory( $this->context );
     229        $template_formatter           = new Email_Template_Formatter( $this->context, $section_builder, $this->golinks );
     230        $template_renderer_factory    = new Email_Template_Renderer_Factory( $this->context, $this->golinks );
    218231        $report_sender                = new Email_Report_Sender( $template_renderer_factory, $email_sender );
    219232        $log_processor                = new Email_Log_Processor( $this->email_log_batch_query, $this->data_requests, $template_formatter, $report_sender );
     
    224237            $this->user_settings,
    225238            $eligible_subscribers_query,
    226             $email_sender
     239            $email_sender,
     240            $this->golinks
    227241        );
    228         $this->email_log         = new Email_Log( $this->context );
     242        $this->email_log         = new Email_Log();
    229243        $this->scheduler         = new Email_Reporting_Scheduler( $frequency_planner );
    230244        $this->initiator_task    = new Initiator_Task( $this->scheduler, $this->subscribed_users_query );
     
    247261     */
    248262    public function register() {
     263        $this->golinks->register_handler( 'manage-subscription-email-reporting', new Email_Reporting_Golink_Handler() );
    249264        $this->settings->register();
    250265        $this->rest_controller->register();
  • google-site-kit/trunk/includes/Core/Email_Reporting/Email_Reporting_Data_Requests.php

    r3457523 r3479192  
    3838class Email_Reporting_Data_Requests {
    3939
     40    const PERMISSIONS_ERROR_STATUSES = array( 401, 403 );
     41
     42    const PERMISSIONS_ERROR_REASONS = array(
     43        'unauthorized',
     44        'authError',
     45        'expired',
     46        'required',
     47        'forbidden',
     48        'insufficientPermissions',
     49        'accountDeleted',
     50        'accountDisabled',
     51        'accessNotConfigured',
     52    );
     53
    4054    /**
    4155     * Modules instance.
     
    175189
    176190    /**
     191     * Categorizes a WP_Error based on its status and reason for better messaging in the front end.
     192     *
     193     * @since 1.174.0
     194     *
     195     * @param WP_Error $error       The error to categorize.
     196     * @param string   $module_slug The module slug related to the error.
     197     * @return WP_Error The categorized error with an added 'category' data field.
     198     */
     199    public function categorize_error( WP_Error $error, $module_slug ) {
     200        $status = $error->get_error_data()['status'];
     201        $reason = $error->get_error_data()['reason'];
     202
     203        $category = 'report_error';
     204        if ( in_array( $status, self::PERMISSIONS_ERROR_STATUSES, true ) || in_array( $reason, self::PERMISSIONS_ERROR_REASONS, true ) ) {
     205            $category = 'permissions_error';
     206        }
     207
     208        return new WP_Error(
     209            $error->get_error_code(),
     210            $error->get_error_message(),
     211            array_merge(
     212                $error->get_error_data(),
     213                array(
     214                    'category_id' => $category,
     215                    'module_slug' => $module_slug,
     216                )
     217            )
     218        );
     219    }
     220
     221    /**
    177222     * Gets active module slugs for email reporting.
    178223     *
     
    204249
    205250                if ( is_wp_error( $shared_payload ) ) {
    206                     return $shared_payload;
     251                    return $this->categorize_error( $shared_payload, $slug );
    207252                }
    208253
     
    223268
    224269            if ( is_wp_error( $result ) ) {
    225                 return $result;
     270                return $this->categorize_error( $result, $slug );
    226271            }
    227272
  • google-site-kit/trunk/includes/Core/Email_Reporting/Email_Reporting_Pointer.php

    r3457523 r3479192  
    176176                'buttons'         => sprintf(
    177177                    '<a class="googlesitekit-pointer-cta button-primary" data-action="dismiss" href="%s">%s</a>',
    178                     $this->context->admin_url( 'dashboard', array( 'email-reporting-panel' => 1 ) ),
     178                    $this->context->admin_url( 'dashboard', array( 'panel' => 'email-reporting' ) ),
    179179                    esc_html__( 'Set up', 'google-site-kit' )
    180180                ),
  • google-site-kit/trunk/includes/Core/Email_Reporting/Email_Reporting_Scheduler.php

    r3420533 r3479192  
    164164
    165165    /**
     166     * Schedules subscription confirmation delivery via existing worker and fallback pipeline.
     167     *
     168     * @since 1.174.0
     169     *
     170     * @param int   $user_id           User ID.
     171     * @param array $previous_settings Previous settings.
     172     * @param array $updated_settings  Updated settings.
     173     * @return true|\WP_Error True on success, WP_Error on failure.
     174     */
     175    public function schedule_email_confirmation( $user_id, array $previous_settings, array $updated_settings ) {
     176        $task  = new Subscription_Confirmation_Task( $this->frequency_planner );
     177        $batch = $task->maybe_schedule(
     178            $user_id,
     179            $previous_settings,
     180            $updated_settings
     181        );
     182
     183        if ( false === $batch ) {
     184            return true;
     185        }
     186
     187        if ( is_wp_error( $batch ) ) {
     188            return $batch;
     189        }
     190
     191        if ( empty( $batch['batch_id'] ) || empty( $batch['frequency'] ) || ! isset( $batch['timestamp'] ) ) {
     192            return new \WP_Error(
     193                'email_reporting_invalid_confirmation_batch',
     194                __( 'Subscription confirmation batch payload is invalid.', 'google-site-kit' ),
     195                array( 'status' => 500 )
     196            );
     197        }
     198
     199        $batch_id  = (string) $batch['batch_id'];
     200        $frequency = (string) $batch['frequency'];
     201        $timestamp = (int) $batch['timestamp'];
     202
     203        $this->schedule_worker( $batch_id, $frequency, $timestamp, 0 );
     204        $this->schedule_fallback( $batch_id, $frequency, $timestamp, 0 );
     205
     206        return true;
     207    }
     208
     209    /**
    166210     * Unschedules all email reporting related events.
    167211     *
  • google-site-kit/trunk/includes/Core/Email_Reporting/Email_Template_Formatter.php

    r3467940 r3479192  
    1212
    1313use Google\Site_Kit\Context;
     14use Google\Site_Kit\Core\Golinks\Golinks;
    1415use Google\Site_Kit\Core\User\Email_Reporting_Settings;
    1516use WP_Error;
     
    4546
    4647    /**
     48     * Golinks instance.
     49     *
     50     * @since 1.174.0
     51     *
     52     * @var Golinks
     53     */
     54    private $golinks;
     55
     56    /**
    4757     * Constructor.
    4858     *
    4959     * @since 1.170.0
     60     * @since 1.174.0 Added golinks dependency.
    5061     *
    5162     * @param Context                      $context         Plugin context.
    5263     * @param Email_Report_Section_Builder $section_builder Section builder instance.
    53      */
    54     public function __construct( Context $context, Email_Report_Section_Builder $section_builder ) {
     64     * @param Golinks                      $golinks         Golinks instance.
     65     */
     66    public function __construct( Context $context, Email_Report_Section_Builder $section_builder, Golinks $golinks ) {
    5567        $this->context         = $context;
    5668        $this->section_builder = $section_builder;
     69        $this->golinks         = $golinks;
    5770    }
    5871
     
    123136        }
    124137
    125         $sections_map = new Sections_Map( $this->context, $sections_payload );
     138        $sections_map = new Sections_Map( $this->context, $sections_payload, $this->golinks );
    126139        if ( empty( $sections_map->get_sections() ) ) {
    127140            return new WP_Error(
     
    299312     */
    300313    public function prepare_simple_email_data( $subject, $preheader, $email_data = array() ) {
    301         $site_domain = $this->get_site_domain();
     314        $site_domain        = $this->get_site_domain();
     315        $dashboard_url      = $this->golinks->get_url( 'dashboard' );
     316        $email_settings_url = $this->golinks->get_url( 'manage-subscription-email-reporting' );
     317        $help_center_url    = add_query_arg( 'doc', 'get-support', 'https://sitekit.withgoogle.com/support/' );
    302318
    303319        $data = array(
     
    311327            'primary_call_to_action' => array(
    312328                'label' => $email_data['cta_label'] ?? __( 'Get your report', 'google-site-kit' ),
    313                 'url'   => $email_data['cta_url'] ?? admin_url( 'admin.php?page=googlesitekit-dashboard' ),
     329                'url'   => $email_data['cta_url'] ?? $dashboard_url,
    314330            ),
    315331            'footer'                 => array(
    316                 'copy' => $email_data['footer_copy'] ?? '',
     332                'copy'            => $email_data['footer_copy'] ?? '',
     333                'unsubscribe_url' => $email_settings_url,
     334                'links'           => array(
     335                    array(
     336                        'label' => __( 'Manage subscription', 'google-site-kit' ),
     337                        'url'   => $email_settings_url,
     338                    ),
     339                    array(
     340                        'label' => __( 'Privacy Policy', 'google-site-kit' ),
     341                        'url'   => 'https://policies.google.com/privacy',
     342                    ),
     343                    array(
     344                        'label' => __( 'Help center', 'google-site-kit' ),
     345                        'url'   => $help_center_url,
     346                    ),
     347                ),
    317348            ),
    318349        );
    319350
    320351        return $data;
     352    }
     353
     354    /**
     355     * Builds template data for the subscription confirmation email.
     356     *
     357     * @since 1.174.0
     358     *
     359     * @param string $frequency Frequency slug.
     360     * @return array Template data.
     361     */
     362    public function prepare_subscription_confirmation_template_data( $frequency ) {
     363        $site_domain        = $this->get_site_domain();
     364        $frequency_label    = $this->get_frequency_label( $frequency );
     365        $first_report_date  = $this->get_first_report_date_label( $frequency );
     366        $dashboard_url      = $this->golinks->get_url( 'dashboard' );
     367        $email_settings_url = $this->golinks->get_url( 'manage-subscription-email-reporting' );
     368        $help_center_url    = add_query_arg( 'doc', 'get-support', 'https://sitekit.withgoogle.com/support/' );
     369
     370        return array(
     371            'subject'                => sprintf(
     372                /* translators: %s: Site domain. */
     373                __( 'Success! You’re subscribed to Site Kit reports for %s', 'google-site-kit' ),
     374                $site_domain
     375            ),
     376            'preheader'              => __( 'Your subscription is confirmed and your first report is on the way.', 'google-site-kit' ),
     377            'site'                   => array(
     378                'domain' => $site_domain,
     379                'url'    => $this->context->get_reference_site_url(),
     380            ),
     381            'title'                  => Content_Map::get_title( 'subscription-confirmation' ),
     382            'body'                   => Content_Map::get_body_with_args(
     383                'subscription-confirmation',
     384                array(
     385                    $frequency_label,
     386                    $first_report_date,
     387                )
     388            ),
     389            'learn_more_url'         => 'https://sitekit.withgoogle.com/documentation/email-reports/',
     390            'primary_call_to_action' => array(
     391                'label' => __( 'View dashboard', 'google-site-kit' ),
     392                'url'   => $dashboard_url,
     393            ),
     394            'footer'                 => array(
     395                'copy'            => __( 'You received this email because you signed up to receive email reports from Site Kit. If you do not want to receive these emails in the future you can unsubscribe', 'google-site-kit' ),
     396                'unsubscribe_url' => $email_settings_url,
     397                'links'           => array(
     398                    array(
     399                        'label' => __( 'Manage subscription', 'google-site-kit' ),
     400                        'url'   => $email_settings_url,
     401                    ),
     402                    array(
     403                        'label' => __( 'Privacy Policy', 'google-site-kit' ),
     404                        'url'   => 'https://policies.google.com/privacy',
     405                    ),
     406                    array(
     407                        'label' => __( 'Help center', 'google-site-kit' ),
     408                        'url'   => $help_center_url,
     409                    ),
     410                ),
     411            ),
     412        );
    321413    }
    322414
     
    331423     */
    332424    private function prepare_template_data( $frequency, $date_range ) {
     425        $dashboard_url      = $this->golinks->get_url( 'dashboard' );
     426        $email_settings_url = $this->golinks->get_url( 'manage-subscription-email-reporting' );
     427        $help_center_url    = add_query_arg( 'doc', 'get-support', 'https://sitekit.withgoogle.com/support/' );
     428
    333429        return array(
    334430            'subject'                => $this->build_subject( $frequency ),
     
    344440            'primary_call_to_action' => array(
    345441                'label' => __( 'View dashboard', 'google-site-kit' ),
    346                 'url'   => admin_url( 'admin.php?page=googlesitekit-dashboard' ),
     442                'url'   => $dashboard_url,
    347443            ),
    348444            'footer'                 => array(
    349445                'copy'            => __( 'You received this email because you signed up to receive email reports from Site Kit. If you do not want to receive these emails in the future you can unsubscribe', 'google-site-kit' ), // The space and unsubscribe link are handled in the template.
    350                 'unsubscribe_url' => admin_url( 'admin.php?page=googlesitekit-settings#/admin-settings' ),
     446                'unsubscribe_url' => $email_settings_url,
    351447                'links'           => array(
    352448                    array(
    353449                        'label' => __( 'Manage subscription', 'google-site-kit' ),
    354                         'url'   => admin_url( 'admin.php?page=googlesitekit-dashboard&email-reporting-panel=1' ),
     450                        'url'   => $email_settings_url,
    355451                    ),
    356452                    array(
     
    360456                    array(
    361457                        'label' => __( 'Help center', 'google-site-kit' ),
    362                         'url'   => 'https://sitekit.withgoogle.com/documentation/troubleshooting/site-kit-support/',
     458                        'url'   => $help_center_url,
    363459                    ),
    364460                ),
  • google-site-kit/trunk/includes/Core/Email_Reporting/Email_Template_Renderer.php

    r3467940 r3479192  
    160160        // Handle simple email templates (invitation-email, subscription-confirmation, etc.).
    161161        if ( 'email-report' !== $template_name ) {
    162             if ( empty( $data['body'] ) ) {
    163                 $data['body'] = Body_Content_Map::get_body( $template_name );
    164             }
    165 
    166162            return Plain_Text_Formatter::format_simple_email( $data );
    167163        }
  • google-site-kit/trunk/includes/Core/Email_Reporting/Email_Template_Renderer_Factory.php

    r3438138 r3479192  
    1212
    1313use Google\Site_Kit\Context;
     14use Google\Site_Kit\Core\Golinks\Golinks;
    1415
    1516/**
     
    3233
    3334    /**
     35     * Golinks instance.
     36     *
     37     * @since 1.174.0
     38     *
     39     * @var Golinks
     40     */
     41    private $golinks;
     42
     43    /**
    3444     * Constructor.
    3545     *
    3646     * @since 1.170.0
     47     * @since 1.174.0 Added golinks dependency.
    3748     *
    3849     * @param Context $context Plugin context.
     50     * @param Golinks $golinks Golinks instance.
    3951     */
    40     public function __construct( Context $context ) {
     52    public function __construct( Context $context, Golinks $golinks ) {
    4153        $this->context = $context;
     54        $this->golinks = $golinks;
    4255    }
    4356
     
    5164     */
    5265    public function create( array $sections_payload ) {
    53         return new Email_Template_Renderer( new Sections_Map( $this->context, $sections_payload ) );
     66        return new Email_Template_Renderer( new Sections_Map( $this->context, $sections_payload, $this->golinks ) );
    5467    }
    5568}
  • google-site-kit/trunk/includes/Core/Email_Reporting/Initiator_Task.php

    r3457523 r3479192  
    6666        $user_ids = $this->subscribed_users_query->for_frequency( $frequency );
    6767
    68         $reference_dates = $this->build_reference_dates( $frequency, $timestamp );
     68        $reference_dates = self::build_reference_dates( $frequency, $timestamp );
    6969
    7070        foreach ( $user_ids as $user_id ) {
     
    8181                        Email_Log::META_SEND_ATTEMPTS    => 0,
    8282                        Email_Log::META_SITE_ID          => get_current_blog_id(),
     83                        Email_Log::META_TEMPLATE_TYPE    => Email_Log::TEMPLATE_TYPE_EMAIL_REPORT,
    8384                    ),
    8485                )
     
    9394     * Builds the report reference dates for a batch.
    9495     *
     96     * @since 1.167.0
     97     * @since 1.174.0 Made method static.
     98     *
    9599     * @param string $frequency Frequency slug.
    96100     * @param int    $timestamp Base timestamp.
    97101     * @return array Reference date payload.
    98102     */
    99     private function build_reference_dates( $frequency, $timestamp ) {
     103    public static function build_reference_dates( $frequency, $timestamp ) {
    100104        $time_zone = wp_timezone();
    101105        $send_date = ( new DateTimeImmutable( '@' . $timestamp ) )
  • google-site-kit/trunk/includes/Core/Email_Reporting/Plain_Text_Formatter.php

    r3467940 r3479192  
    4545     *
    4646     * Simple emails share a common structure with customizable content.
    47      * The preheader is used as the main message body in plain text format.
    4847     *
    4948     * @since 1.173.0
    5049     *
    51      * @param array $data The simple email data containing site, preheader, learn_more_url,
    52      *                    primary_call_to_action, and footer.
     50     * @param array $data The simple email data containing site, title, learn_more_url,
     51     *                    primary_call_to_action, body, and footer.
    5352     * @return string Formatted plain text email.
    5453     */
    5554    public static function format_simple_email( $data ) {
    5655        $site_domain    = $data['site']['domain'] ?? '';
    57         $preheader      = $data['preheader'] ?? '';
     56        $title          = wp_strip_all_tags( $data['title'] ?? '' );
    5857        $learn_more_url = $data['learn_more_url'] ?? '';
    5958        $cta            = $data['primary_call_to_action'] ?? array();
     
    6665            $site_domain,
    6766            '',
    68             $preheader,
    69             '',
    7067        );
     68
     69        // Title.
     70        if ( ! empty( $title ) ) {
     71            $lines[] = $title;
     72            $lines[] = '';
     73        }
    7174
    7275        // Body paragraphs (strip any HTML tags for plain text output).
     
    9194            $lines[] = '';
    9295        }
     96
     97        $lines[] = str_repeat( '-', 50 );
     98        $lines[] = '';
    9399
    94100        // Footer copy.
  • google-site-kit/trunk/includes/Core/Email_Reporting/REST_Email_Reporting_Controller.php

    r3467940 r3479192  
    1212
    1313use Google\Site_Kit\Core\Email\Email;
     14use Google\Site_Kit\Core\Golinks\Golinks;
    1415use Google\Site_Kit\Core\Modules\Modules;
    1516use Google\Site_Kit\Core\Permissions\Permissions;
     
    9798
    9899    /**
     100     * Golinks instance.
     101     *
     102     * @since 1.174.0
     103     * @var Golinks
     104     */
     105    private $golinks;
     106
     107    /**
    99108     * Constructor.
    100109     *
     
    102111     * @since 1.170.0 Added modules and user email reporting settings dependencies.
    103112     * @since 1.173.0 Added eligible subscribers query and email sender dependencies and removed unused user options dependency.
     113     * @since 1.174.0 Added golinks dependency.
    104114     *
    105115     * @param Email_Reporting_Settings      $settings                       Email_Reporting_Settings instance.
     
    108118     * @param Eligible_Subscribers_Query    $eligible_subscribers_query     Eligible subscribers query instance.
    109119     * @param Email                         $email_sender                   Email sender instance.
     120     * @param Golinks                       $golinks                        Golinks instance.
    110121     */
    111122    public function __construct(
     
    114125        User_Email_Reporting_Settings $user_email_reporting_settings,
    115126        Eligible_Subscribers_Query $eligible_subscribers_query,
    116         Email $email_sender
     127        Email $email_sender,
     128        Golinks $golinks
    117129    ) {
    118130        $this->settings                      = $settings;
     
    122134        $this->email_log_batch_query         = new Email_Log_Batch_Query();
    123135        $this->email_sender                  = $email_sender;
     136        $this->golinks                       = $golinks;
    124137    }
    125138
     
    382395            'role'        => $this->get_primary_role( $user ),
    383396            'subscribed'  => is_array( $settings ) && ! empty( $settings['subscribed'] ),
     397            'invited'     => $this->is_invite_rate_limited( $user->ID ),
    384398        );
    385399    }
     
    509523                'url'    => home_url( '/' ),
    510524            ),
    511             'body'                   => Body_Content_Map::get_body( 'invitation-email' ),
     525            'title'                  => Content_Map::get_title_with_args( 'invitation-email', array( $inviter_email ) ),
     526            'body'                   => Content_Map::get_body( 'invitation-email' ),
    512527            'inviter_email'          => $inviter_email,
    513528            'learn_more_url'         => 'https://sitekit.withgoogle.com/documentation/email-reports/',
    514529            'primary_call_to_action' => array(
    515530                'label' => __( 'Get your report', 'google-site-kit' ),
    516                 'url'   => admin_url( 'admin.php?page=googlesitekit-dashboard' ),
     531                'url'   => $this->golinks->get_url( 'manage-subscription-email-reporting' ),
    517532            ),
    518533            'footer'                 => array(
  • google-site-kit/trunk/includes/Core/Email_Reporting/Sections_Map.php

    r3467940 r3479192  
    1212
    1313use Google\Site_Kit\Context;
     14use Google\Site_Kit\Core\Golinks\Golinks;
    1415
    1516/**
     
    7071
    7172    /**
     73     * Golinks instance.
     74     *
     75     * @since 1.174.0
     76     * @var Golinks
     77     */
     78    protected $golinks;
     79
     80    /**
    7281     * Constructor.
    7382     *
    7483     * @since 1.168.0
     84     * @since 1.174.0 Added golinks dependency.
    7585     *
    7686     * @param Context $context Plugin context.
    7787     * @param array   $payload The payload data to be used in sections.
    78      */
    79     public function __construct( Context $context, $payload ) {
     88     * @param Golinks $golinks Golinks instance.
     89     */
     90    public function __construct( Context $context, $payload, Golinks $golinks ) {
    8091        $this->context = $context;
    8192        $this->payload = $payload;
     93        $this->golinks = $golinks;
     94    }
     95
     96    /**
     97     * Gets the dashboard golink URL.
     98     *
     99     * @since 1.174.0
     100     *
     101     * @return string Dashboard URL.
     102     */
     103    protected function get_dashboard_url() {
     104        return $this->golinks->get_url( 'dashboard' );
    82105    }
    83106
     
    156179                'icon'             => 'conversions',
    157180                'section_template' => 'section-conversions',
    158                 'dashboard_url'    => $this->context->admin_url( 'dashboard' ),
     181                'dashboard_url'    => $this->get_dashboard_url(),
    159182                'section_parts'    => $section_parts,
    160183            ),
     
    215238                'icon'             => 'visitors',
    216239                'section_template' => 'section-metrics',
    217                 'dashboard_url'    => $this->context->admin_url( 'dashboard' ),
     240                'dashboard_url'    => $this->get_dashboard_url(),
    218241                'section_parts'    => $section_parts,
    219242            ),
     
    248271                'icon'             => 'search',
    249272                'section_template' => 'section-page-metrics',
    250                 'dashboard_url'    => $this->context->admin_url( 'dashboard' ),
     273                'dashboard_url'    => $this->get_dashboard_url(),
    251274                'section_parts'    => $section_parts,
    252275            ),
     
    287310                'icon'             => 'views',
    288311                'section_template' => 'section-page-metrics',
    289                 'dashboard_url'    => $this->context->admin_url( 'dashboard' ),
     312                'dashboard_url'    => $this->get_dashboard_url(),
    290313                'section_parts'    => $section_parts,
    291314            ),
     
    320343                'icon'             => 'growth',
    321344                'section_template' => 'section-page-metrics',
    322                 'dashboard_url'    => $this->context->admin_url( 'dashboard' ),
     345                'dashboard_url'    => $this->get_dashboard_url(),
    323346                'section_parts'    => $section_parts,
    324347            ),
  • google-site-kit/trunk/includes/Core/Email_Reporting/templates/email-report/parts/header.php

    r3467940 r3479192  
    2323                <tr>
    2424                    <td style="vertical-align:top;" width="79">
    25                         <img src="<?php echo esc_url( $logo_url ); ?>" alt="<?php echo esc_attr__( 'Site Kit by Google', 'google-site-kit' ); ?>" width="79" height="22" style="display:block; margin-top: 12px;" />
     25                        <img src="<?php echo esc_url( $logo_url ); ?>" alt="<?php echo esc_attr__( 'Site Kit by Google', 'google-site-kit' ); ?>" width="79" height="22" style="display:block; margin-top: 8px;" />
    2626                    </td>
    2727                    <?php /* Extra centering for Outlook. */ ?>
    2828                    <td style="vertical-align:top; text-align:center;" align="center">
    2929                        <center>
    30                             <img src="<?php echo esc_url( $shooting_stars_url ); ?>" alt="" width="107" height="56" style="display:block; margin: 24px auto 0 auto;" align="center" />
     30                            <img src="<?php echo esc_url( $shooting_stars_url ); ?>" alt="" width="107" height="56" style="display:block; margin: 12px auto 0 auto;" align="center" />
    3131                        </center>
    3232                    </td>
  • google-site-kit/trunk/includes/Core/Email_Reporting/templates/email-report/parts/section-conversions-metric-part.php

    r3467940 r3479192  
    5454                        ?>
    5555                    </td>
    56                     <td width="110"
    57                         style="font-size:12px; font-weight:500;  color:#6C726E; text-align: right; width: 110px; padding-bottom: 10px;">
     56                    <td class="subtitle" width="110" style="font-size:12px; font-weight:500; color:#6C726E; text-align: right; width: 110px; padding-bottom: 10px;">
    5857                        <?php echo esc_html( $change_context ); ?>
    5958                    </td>
  • google-site-kit/trunk/includes/Core/Email_Reporting/templates/email-report/parts/section-conversions.php

    r3467940 r3479192  
    4343                        <?php echo esc_html( $section_parts['total_conversion_events']['data']['label'] ); ?>
    4444                    </td>
    45                     <td width="110" style="font-size:12px; line-height:16px; font-weight:500; color:#6C726E; text-align: right; width: 110px;">
     45                    <td class="subtitle" width="110" style="font-size:12px; line-height:16px; font-weight:500; color:#6C726E; text-align: right; width: 110px;">
    4646                        <?php echo esc_html( $section_parts['total_conversion_events']['data']['change_context'] ); ?>
    4747                    </td>
  • google-site-kit/trunk/includes/Core/Email_Reporting/templates/email-report/parts/section-metrics.php

    r3467940 r3479192  
    4444                <tr>
    4545                    <td>&nbsp;</td>
    46                     <td width="110"
    47                         style="text-align: right; font-size:12px; line-height:16px; font-weight:500; color:#6C726E; width: 110px;">
     46                    <td class="subtitle" width="110" style="text-align: right; font-size:12px; line-height:16px; font-weight:500; color:#6C726E; width: 110px;">
    4847                        <?php echo esc_html( $subtitle ); ?>
    4948                    </td>
  • google-site-kit/trunk/includes/Core/Email_Reporting/templates/email-report/template.php

    r3467940 r3479192  
    2020$preheader          = $data['preheader'];
    2121$site_domain        = $data['site']['domain'];
    22 $site_url           = $data['site']['url'];
     22$site_url           = ! empty( $data['site']['url'] ) ? $data['site']['url'] : '';
    2323$date_label         = $data['date_range']['label'];
    2424$primary_cta        = $data['primary_call_to_action'];
     
    110110            overflow: hidden;
    111111        }
     112
     113        @media (min-width: 481px) {
     114            .subtitle {
     115                /* `!important` used to override inline styles in the element. */
     116                width: auto !important;
     117            }
     118        }
    112119    </style>
    113120</head>
  • google-site-kit/trunk/includes/Core/Email_Reporting/templates/invitation-email/template.php

    r3467940 r3479192  
    1818$site_domain        = $data['site']['domain'];
    1919$site_url           = $data['site']['url'];
     20$email_title        = $data['title'];
    2021$body               = $data['body'];
    2122$inviter_email      = $data['inviter_email'];
     
    143144                                        </p>
    144145
    145                                         <?php /* Invitation title. */ ?>
     146                                        <?php /* Title from Content_Map with inviter email link. */ ?>
    146147                                        <h1 style="font-size: 22px; line-height: 28px; font-weight: 500; color: #161B18; margin: 0 0 16px 0;">
    147148                                            <?php
    148                                             printf(
    149                                                 /* translators: %s: Email address of the person who sent the invitation (wrapped in mailto link) */
    150                                                 esc_html__( '%s invited you to receive periodic performance reports', 'google-site-kit' ),
    151                                                 /* Mailto link styled to match title text as inline styles prevent email clients from auto-styling the email address as a blue link. */
    152                                                 '<a href="mailto:' . esc_attr( $inviter_email ) . '" style="color: #161B18; text-decoration: none; font-weight: 500;">' . esc_html( $inviter_email ) . '</a>'
    153                                             );
     149                                            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Contains pre-escaped mailto link.
     150                                            echo $email_title;
    154151                                            ?>
    155152                                        </h1>
    156153
    157                                         <?php /* Body paragraphs from Body_Content_Map. */ ?>
     154                                        <?php /* Body paragraphs from Content_Map. */ ?>
    158155                                        <?php foreach ( $body as $index => $paragraph ) : ?>
    159156                                        <p style="font-size: 14px; line-height: 20px; font-weight: 400; color: #161B18; margin: 0 0 16px 0;">
  • google-site-kit/trunk/includes/Core/Email_Reporting/templates/subscription-confirmation/parts/content.php

    r3467940 r3479192  
    1313 * @var string   $site_domain        The site domain.
    1414 * @var string   $site_url           The full site URL with protocol.
     15 * @var string   $title              The email title.
    1516 * @var array    $body               Body paragraphs (may contain HTML).
    1617 * @var array    $cta                Primary CTA configuration with 'url' and 'label'.
     
    3839            </p>
    3940
    40             <?php /* Title. */ ?>
     41            <?php /* Title from Content_Map. */ ?>
    4142            <h1 style="font-size: 22px; line-height: 28px; font-weight: 500; color: #161B18; margin: 0 0 16px 0;">
    42                 <?php echo esc_html__( 'Success! You’re subscribed to Site Kit reports', 'google-site-kit' ); ?>
     43                <?php echo esc_html( $title ); ?>
    4344            </h1>
    4445
    45             <?php /* Body paragraphs from Body_Content_Map. */ ?>
     46            <?php /* Body paragraphs from Content_Map. */ ?>
    4647            <?php foreach ( $body as $paragraph ) : ?>
    4748            <p style="font-size: 14px; line-height: 20px; font-weight: 400; color: #161B18; margin: 0 0 16px 0;">
  • google-site-kit/trunk/includes/Core/Email_Reporting/templates/subscription-confirmation/template.php

    r3467940 r3479192  
    1818$site_domain        = $data['site']['domain'];
    1919$site_url           = $data['site']['url'];
     20$email_title        = $data['title'];
    2021$body               = $data['body'];
    2122$cta                = $data['primary_call_to_action'];
     
    138139                                    'site_domain'        => $site_domain,
    139140                                    'site_url'           => $site_url,
     141                                    'title'              => $email_title,
    140142                                    'body'               => $body,
    141143                                    'cta'                => $cta,
  • google-site-kit/trunk/includes/Core/Modules/Module_With_Owner.php

    r3118692 r3479192  
    1010
    1111namespace Google\Site_Kit\Core\Modules;
     12
     13use Google\Site_Kit\Core\Authentication\Clients\OAuth_Client;
    1214
    1315/**
     
    2830     */
    2931    public function get_owner_id();
     32
     33    /**
     34     * Gets the OAuth_Client instance for the module owner.
     35     *
     36     * @since 1.174.0
     37     *
     38     * @return OAuth_Client OAuth_Client instance.
     39     */
     40    public function get_owner_oauth_client();
    3041}
  • google-site-kit/trunk/includes/Core/Permissions/Permissions.php

    r3349867 r3479192  
    392392     */
    393393    private function check_dashboard_sharing_capability( $cap, $user_id, $args ) {
    394         if ( isset( $args[0] ) ) {
    395             $module_slug = $args[0];
    396         }
     394        $module_slug = $args[0] ?? '';
    397395
    398396        switch ( $cap ) {
  • google-site-kit/trunk/includes/Core/Storage/Encrypted_User_Options.php

    r2466816 r3479192  
    127127     *
    128128     * @since 1.4.0
     129     * @since 1.174.0 Returns callable to restore previous user.
    129130     *
    130131     * @param int $user_id User ID.
     132     * @return callable A closure to switch back to the original user.
    131133     */
    132134    public function switch_user( $user_id ) {
    133         $this->user_options->switch_user( $user_id );
     135        return $this->user_options->switch_user( $user_id );
    134136    }
    135137}
  • google-site-kit/trunk/includes/Core/User/Email_Reporting.php

    r3389193 r3479192  
    1111namespace Google\Site_Kit\Core\User;
    1212
     13use Google\Site_Kit\Core\Email_Reporting\Email_Reporting_Scheduler;
     14use Google\Site_Kit\Core\Email_Reporting\Frequency_Planner;
    1315use Google\Site_Kit\Core\Storage\User_Options;
    1416
     
    4648     */
    4749    public function __construct( User_Options $user_options ) {
     50        $frequency_planner = new Frequency_Planner();
     51        $scheduler         = new Email_Reporting_Scheduler( $frequency_planner );
     52
    4853        $this->email_reporting_settings = new Email_Reporting_Settings( $user_options );
    49         $this->rest_controller          = new REST_Email_Reporting_Controller( $this->email_reporting_settings );
     54        $this->rest_controller          = new REST_Email_Reporting_Controller(
     55            $this->email_reporting_settings,
     56            $scheduler
     57        );
    5058    }
    5159
  • google-site-kit/trunk/includes/Core/User/REST_Email_Reporting_Controller.php

    r3397601 r3479192  
    1111namespace Google\Site_Kit\Core\User;
    1212
     13use Google\Site_Kit\Core\Email_Reporting\Email_Reporting_Scheduler;
    1314use Google\Site_Kit\Core\Permissions\Permissions;
    1415use Google\Site_Kit\Core\REST_API\REST_Route;
     
    3637
    3738    /**
     39     * Email reporting scheduler instance.
     40     *
     41     * @since 1.174.0
     42     * @var Email_Reporting_Scheduler
     43     */
     44    private $scheduler;
     45
     46    /**
    3847     * Constructor.
    3948     *
    4049     * @since 1.162.0
    4150     *
    42      * @param Email_Reporting_Settings $settings Email_Reporting_Settings instance.
     51     * @param Email_Reporting_Settings  $settings  Email_Reporting_Settings instance.
     52     * @param Email_Reporting_Scheduler $scheduler Scheduler instance.
    4353     */
    44     public function __construct( Email_Reporting_Settings $settings ) {
    45         $this->settings = $settings;
     54    public function __construct( Email_Reporting_Settings $settings, Email_Reporting_Scheduler $scheduler ) {
     55        $this->settings  = $settings;
     56        $this->scheduler = $scheduler;
    4657    }
    4758
     
    98109                        'methods'             => WP_REST_Server::EDITABLE,
    99110                        'callback'            => function ( WP_REST_Request $request ) {
     111                            $previous_settings = $this->settings->get();
    100112                            $settings = $request['data']['settings'];
    101113
    102114                            $this->settings->merge( $settings );
    103115
    104                             return new WP_REST_Response( $this->settings->get() );
     116                            $updated_settings = $this->settings->get();
     117
     118                            $scheduling_error = $this->scheduler->schedule_email_confirmation(
     119                                get_current_user_id(),
     120                                $previous_settings,
     121                                $updated_settings
     122                            );
     123
     124                            if ( is_wp_error( $scheduling_error ) ) {
     125                                return $scheduling_error;
     126                            }
     127
     128                            return new WP_REST_Response( $updated_settings );
    105129                        },
    106130                        'permission_callback' => $can_view_dashboard,
  • google-site-kit/trunk/includes/Core/User_Input/Site_Specific_Answers.php

    r3118692 r3479192  
    103103                $valid_values['values'] = $valid_answers;
    104104
    105                 if ( ! empty( $valid_values ) ) {
    106                     $results[ $setting_key ] = $valid_values;
    107                 }
     105                $results[ $setting_key ] = $valid_values;
    108106            }
    109107
  • google-site-kit/trunk/includes/Core/User_Input/User_Specific_Answers.php

    r3118692 r3479192  
    102102                $valid_values['values'] = $valid_answers;
    103103
    104                 if ( ! empty( $valid_values ) ) {
    105                     $results[ $setting_key ] = $valid_values;
    106                 }
     104                $results[ $setting_key ] = $valid_values;
    107105            }
    108106
  • google-site-kit/trunk/includes/Core/Util/BC_Functions.php

    r3447448 r3479192  
    1919 * @access private
    2020 * @ignore
     21 *
     22 * @method static void wp_print_script_tag( $attributes )
     23 * @method static void wp_print_inline_script_tag( $javascript, $attributes = array() )
     24 * @method static bool array_is_list( array $value )
    2125 */
    2226class BC_Functions {
  • google-site-kit/trunk/includes/Core/Util/Entity_Factory.php

    r3148853 r3479192  
    266266        // See WordPress's `get_the_archive_title()` function for this behavior. The strings here intentionally omit
    267267        // the 'google-site-kit' text domain since they should use WordPress core translations.
     268        $title = $term->name;
     269
    268270        switch ( $term->taxonomy ) {
    269271            case 'category':
    270                 $title  = $term->name;
    271272                $prefix = _x( 'Category:', 'category archive title prefix', 'default' );
    272273                break;
    273274            case 'post_tag':
    274                 $title  = $term->name;
    275275                $prefix = _x( 'Tag:', 'tag archive title prefix', 'default' );
    276276                break;
     
    309309            default:
    310310                $tax    = get_taxonomy( $term->taxonomy );
    311                 $title  = $term->name;
    312311                $prefix = sprintf(
    313312                    /* translators: %s: Taxonomy singular name. */
  • google-site-kit/trunk/includes/Core/Util/URL.php

    r3148853 r3479192  
    1010
    1111namespace Google\Site_Kit\Core\Util;
     12
     13use Exception;
    1214
    1315/**
     
    6971        }
    7072
    71         return _get_component_from_parsed_url_array( $parts, $component );
     73        return _get_component_from_parsed_url_array( $parts, $component ); // @phpstan-ignore function.internal
    7274    }
    7375
  • google-site-kit/trunk/includes/Modules/Analytics_4.php

    r3457523 r3479192  
    940940         * @since 1.1.0
    941941         *
    942          * @param $disabled bool Whether to disable tracking or not.
     942         * @param bool $disabled Whether to disable tracking or not.
    943943         */
    944944        return (bool) apply_filters( 'googlesitekit_analytics_tracking_disabled', $disabled );
     
    24282428            );
    24292429        }
     2430        return array();
    24302431    }
    24312432
  • google-site-kit/trunk/includes/Modules/Analytics_4/Audience_Utilities.php

    r3457523 r3479192  
    198198     */
    199199    private function get_audience_type( $audience_slug ) {
    200         if ( ! $audience_slug ) {
    201             return 'USER_AUDIENCE';
    202         }
    203 
    204200        switch ( $audience_slug ) {
    205201            case 'all-users':
     
    210206                return 'SITE_KIT_AUDIENCE';
    211207        }
     208
     209        return 'USER_AUDIENCE';
    212210    }
    213211
  • google-site-kit/trunk/includes/Modules/Analytics_4/Synchronize_AdSenseLinked.php

    r3118692 r3479192  
    1414use Google\Site_Kit\Core\Storage\Options;
    1515use Google\Site_Kit\Core\Storage\User_Options;
    16 use Google\Site_Kit\Modules\Adsense;
     16use Google\Site_Kit\Modules\AdSense;
    1717use Google\Site_Kit\Modules\Analytics_4;
    18 use Google\Site_Kit\Modules\AdSense\Settings as Adsense_Settings;
     18use Google\Site_Kit\Modules\AdSense\Settings as AdSense_Settings;
    1919
    2020/**
     
    8282
    8383    /**
    84      * Cron callback for synchronizing the adsense linked data.
     84     * Cron callback for synchronizing the AdSense linked data.
    8585     *
    8686     * @since 1.123.0
  • google-site-kit/trunk/includes/Modules/Reader_Revenue_Manager.php

    r3467940 r3479192  
    4646use Google\Site_Kit\Core\Tracking\Provides_Feature_Metrics;
    4747use Google\Site_Kit\Core\Util\Block_Support;
    48 use Google\Site_Kit\Core\Util\Feature_Flags;
    4948use Google\Site_Kit\Core\Util\Method_Proxy_Trait;
    5049use Google\Site_Kit\Core\Util\URL;
     
    220219                    }
    221220
    222                     if ( Feature_Flags::enabled( 'rrmPolicyViolations' ) ) {
    223                         foreach ( self::POLICY_VIOLATION_NOTIFICATIONS as $notification ) {
    224                             $dismissed_items->remove( $notification );
    225                         }
     221                    foreach ( self::POLICY_VIOLATION_NOTIFICATIONS as $notification ) {
     222                        $dismissed_items->remove( $notification );
    226223                    }
    227224                }
     
    817814        }
    818815
    819         if ( Feature_Flags::enabled( 'rrmPolicyViolations' ) && isset( $settings['contentPolicyStatus'] ) ) {
     816        if ( isset( $settings['contentPolicyStatus'] ) ) {
    820817            $content_policy_status = (array) $settings['contentPolicyStatus'];
    821818            $content_policy_state  = $content_policy_status['contentPolicyState'] ?? '';
  • google-site-kit/trunk/includes/Modules/Reader_Revenue_Manager/Admin_Post_List.php

    r3253534 r3479192  
    7575        }
    7676
    77         add_action(
    78             'bulk_edit_custom_box',
    79             array( $this, 'bulk_edit_field' ),
    80             10,
    81             2
    82         );
    83 
     77        add_action( 'bulk_edit_custom_box', array( $this, 'bulk_edit_field' ) );
    8478        add_action( 'save_post', array( $this, 'save_field' ) );
    8579    }
  • google-site-kit/trunk/includes/Modules/Reader_Revenue_Manager/Settings.php

    r3447448 r3479192  
    1616use Google\Site_Kit\Core\Storage\Setting_With_ViewOnly_Keys_Interface;
    1717use Google\Site_Kit\Core\Util\BC_Functions;
    18 use Google\Site_Kit\Core\Util\Feature_Flags;
    1918use Google\Site_Kit\Core\Util\Method_Proxy_Trait;
    2019
     
    7170     */
    7271    protected function get_default() {
    73         $defaults = array(
     72        return array(
     73            'contentPolicyStatus'               => (object) array(),
    7474            'ownerID'                           => 0,
    7575            'publicationID'                     => '',
     
    8282            'productID'                         => 'openaccess',
    8383        );
    84 
    85         if ( Feature_Flags::enabled( 'rrmPolicyViolations' ) ) {
    86             $defaults['contentPolicyStatus'] = (object) array();
    87         }
    88 
    89         return $defaults;
    9084    }
    9185
     
    190184            }
    191185
    192             if ( Feature_Flags::enabled( 'rrmPolicyViolations' ) && isset( $option['contentPolicyStatus'] ) ) {
     186            if ( isset( $option['contentPolicyStatus'] ) ) {
    193187                // If the `contentPolicyStatus` setting is not an associative array, set it to an empty object.
    194188                if ( ! ( is_array( $option['contentPolicyStatus'] ) && ! BC_Functions::array_is_list( $option['contentPolicyStatus'] ) ) ) {
  • google-site-kit/trunk/includes/Modules/Reader_Revenue_Manager/Synchronize_Publication.php

    r3447448 r3479192  
    1313use Google\Site_Kit\Core\Permissions\Permissions;
    1414use Google\Site_Kit\Core\Storage\User_Options;
    15 use Google\Site_Kit\Core\Util\Feature_Flags;
    1615use Google\Site_Kit\Modules\Reader_Revenue_Manager;
    1716use Google\Site_Kit_Dependencies\Google\Service\SubscribewithGoogle\Publication;
     
    128127            );
    129128
    130             if ( Feature_Flags::enabled( 'rrmPolicyViolations' ) ) {
    131                 $content_policy_status = $publication->getContentPolicyStatus();
    132 
    133                 if ( $content_policy_status ) {
    134                     $new_settings['contentPolicyStatus'] = (array) $content_policy_status->toSimpleObject();
    135                 }
     129            $content_policy_status = $publication->getContentPolicyStatus();
     130
     131            if ( $content_policy_status ) {
     132                $new_settings['contentPolicyStatus'] = (array) $content_policy_status->toSimpleObject();
    136133            }
    137134
  • google-site-kit/trunk/includes/Modules/Search_Console/Email_Reporting/Report_Data_Builder.php

    r3447448 r3479192  
    473473        }
    474474
    475         if ( empty( $labels ) ) {
    476             return null;
    477         }
    478 
    479475        return array(
    480476            'section_key'      => $section_key,
  • google-site-kit/trunk/includes/Modules/Sign_In_With_Google.php

    r3389193 r3479192  
    522522             * @param array $args Optional arguments to customize button attributes.
    523523             */
    524             do_action( 'googlesitekit_render_sign_in_with_google_button' );
     524            do_action( 'googlesitekit_render_sign_in_with_google_button', array() );
    525525            $content .= ob_get_clean();
    526526        }
  • google-site-kit/trunk/includes/Plugin.php

    r3457523 r3479192  
    184184                $permissions = new Core\Permissions\Permissions( $this->context, $authentication, $modules, $user_options, $dismissed_items );
    185185                $permissions->register();
     186
     187                $golinks = new Core\Golinks\Golinks( $this->context );
     188                $golinks->register();
     189                $golinks->register_handler( 'dashboard', new Core\Golinks\Dashboard_Golink_Handler() );
    186190
    187191                $nonces = new Core\Nonces\Nonces( $this->context );
     
    241245                    );
    242246
    243                     ( new Core\Email_Reporting\Email_Reporting( $this->context, $modules, $data_requests, $authentication, $options, $user_options ) )->register();
     247                    ( new Core\Email_Reporting\Email_Reporting( $this->context, $modules, $data_requests, $golinks, $authentication, $options, $user_options ) )->register();
    244248                }
    245249
     
    318322
    319323        if ( file_exists( GOOGLESITEKIT_PLUGIN_DIR_PATH . 'dist/config.php' ) ) {
    320             $config = include GOOGLESITEKIT_PLUGIN_DIR_PATH . 'dist/config.php';
     324            $config = include GOOGLESITEKIT_PLUGIN_DIR_PATH . 'dist/config.php'; // @phpstan-ignore include.fileNotFound
    321325            Feature_Flags::set_features( (array) $config['features'] );
    322326        }
  • google-site-kit/trunk/includes/loader.php

    r3118692 r3479192  
    1010
    1111namespace Google\Site_Kit;
    12 
    13 // Define global constants.
    14 define( 'GOOGLESITEKIT_PLUGIN_BASENAME', plugin_basename( GOOGLESITEKIT_PLUGIN_MAIN_FILE ) );
    15 define( 'GOOGLESITEKIT_PLUGIN_DIR_PATH', plugin_dir_path( GOOGLESITEKIT_PLUGIN_MAIN_FILE ) );
    1612
    1713/**
  • google-site-kit/trunk/includes/vendor/composer/autoload_classmap.php

    r3467940 r3479192  
    8585    'Google\\Site_Kit\\Core\\Dismissals\\REST_Dismissals_Controller' => $baseDir . '/Core/Dismissals/REST_Dismissals_Controller.php',
    8686    'Google\\Site_Kit\\Core\\Email\\Email' => $baseDir . '/Core/Email/Email.php',
    87     'Google\\Site_Kit\\Core\\Email_Reporting\\Body_Content_Map' => $baseDir . '/Core/Email_Reporting/Body_Content_Map.php',
     87    'Google\\Site_Kit\\Core\\Email_Reporting\\Content_Map' => $baseDir . '/Core/Email_Reporting/Content_Map.php',
    8888    'Google\\Site_Kit\\Core\\Email_Reporting\\Eligible_Subscribers_Query' => $baseDir . '/Core/Email_Reporting/Eligible_Subscribers_Query.php',
    8989    'Google\\Site_Kit\\Core\\Email_Reporting\\Email_Assets' => $baseDir . '/Core/Email_Reporting/Email_Assets.php',
     
    9898    'Google\\Site_Kit\\Core\\Email_Reporting\\Email_Reporting' => $baseDir . '/Core/Email_Reporting/Email_Reporting.php',
    9999    'Google\\Site_Kit\\Core\\Email_Reporting\\Email_Reporting_Data_Requests' => $baseDir . '/Core/Email_Reporting/Email_Reporting_Data_Requests.php',
     100    'Google\\Site_Kit\\Core\\Email_Reporting\\Email_Reporting_Golink_Handler' => $baseDir . '/Core/Email_Reporting/Email_Reporting_Golink_Handler.php',
    100101    'Google\\Site_Kit\\Core\\Email_Reporting\\Email_Reporting_Pointer' => $baseDir . '/Core/Email_Reporting/Email_Reporting_Pointer.php',
    101102    'Google\\Site_Kit\\Core\\Email_Reporting\\Email_Reporting_Scheduler' => $baseDir . '/Core/Email_Reporting/Email_Reporting_Scheduler.php',
     
    115116    'Google\\Site_Kit\\Core\\Email_Reporting\\Sections_Map' => $baseDir . '/Core/Email_Reporting/Sections_Map.php',
    116117    'Google\\Site_Kit\\Core\\Email_Reporting\\Subscribed_Users_Query' => $baseDir . '/Core/Email_Reporting/Subscribed_Users_Query.php',
     118    'Google\\Site_Kit\\Core\\Email_Reporting\\Subscription_Confirmation_Task' => $baseDir . '/Core/Email_Reporting/Subscription_Confirmation_Task.php',
    117119    'Google\\Site_Kit\\Core\\Email_Reporting\\Worker_Task' => $baseDir . '/Core/Email_Reporting/Worker_Task.php',
    118120    'Google\\Site_Kit\\Core\\Expirables\\Expirable_Items' => $baseDir . '/Core/Expirables/Expirable_Items.php',
     
    122124    'Google\\Site_Kit\\Core\\Feature_Tours\\Feature_Tours' => $baseDir . '/Core/Feature_Tours/Feature_Tours.php',
    123125    'Google\\Site_Kit\\Core\\Feature_Tours\\REST_Feature_Tours_Controller' => $baseDir . '/Core/Feature_Tours/REST_Feature_Tours_Controller.php',
     126    'Google\\Site_Kit\\Core\\Golinks\\Dashboard_Golink_Handler' => $baseDir . '/Core/Golinks/Dashboard_Golink_Handler.php',
     127    'Google\\Site_Kit\\Core\\Golinks\\Golink_Handler_Interface' => $baseDir . '/Core/Golinks/Golink_Handler_Interface.php',
     128    'Google\\Site_Kit\\Core\\Golinks\\Golinks' => $baseDir . '/Core/Golinks/Golinks.php',
    124129    'Google\\Site_Kit\\Core\\Guards\\Guard_Interface' => $baseDir . '/Core/Guards/Guard_Interface.php',
    125130    'Google\\Site_Kit\\Core\\HTTP\\Middleware' => $baseDir . '/Core/HTTP/Middleware.php',
  • google-site-kit/trunk/readme.txt

    r3467940 r3479192  
    55Tested up to:      6.9
    66Requires PHP:      7.4
    7 Stable tag:        1.173.0
     7Stable tag:        1.174.0
    88License:           Apache License 2.0
    99License URI:       https://www.apache.org/licenses/LICENSE-2.0
     
    110110== Changelog ==
    111111
    112 = 1.173.0 =
     112= 1.174.0 =
    113113
    114114**Enhanced**
    115115
    116 * Reset Reader Revenue Manager policy violation notification dismissals when connecting a different publication, or disconnecting the service. See [#12189](https://github.com/google/site-kit-wp/issues/12189).
    117 * Update opt-in user tracking for Reader Revenue Manager setup success notification. See [#12104](https://github.com/google/site-kit-wp/issues/12104).
    118 * Add GA4 tracking events for RRM policy violation notifications. See [#12103](https://github.com/google/site-kit-wp/issues/12103).
    119 * Prevent the Welcome modal from being shown to existing users when the Setup Flow Refresh feature flag is enabled. See [#12068](https://github.com/google/site-kit-wp/issues/12068).
    120 * Add "Action needed" badge to RRM module status for policy violations. See [#12017](https://github.com/google/site-kit-wp/issues/12017).
    121 * Add Reader Revenue Manager policy violation notifications in Site Kit settings. See [#12014](https://github.com/google/site-kit-wp/issues/12014).
    122 * Update email report to include dynamic conversion metrics based on sites' tracked metrics. See [#12001](https://github.com/google/site-kit-wp/issues/12001).
    123 * Update the unsubscribe notice of Email Reporting to have a black background. See [#11996](https://github.com/google/site-kit-wp/issues/11996).
    124 * Add a confirmation before disabling the Email Reporting settings. See [#11862](https://github.com/google/site-kit-wp/issues/11862).
    125 * Add subscription confirmation email template. See [#11853](https://github.com/google/site-kit-wp/issues/11853).
    126 * Add email invite template for email reporting. See [#11851](https://github.com/google/site-kit-wp/issues/11851).
    127 * Add Email Reporting stats to feature metrics. See [#11850](https://github.com/google/site-kit-wp/issues/11850).
    128 * Add the Search Console-only dashboard tour for the new setup flow. See [#11814](https://github.com/google/site-kit-wp/issues/11814).
    129 * Add support for base admin URLs that already contain query parameters in the `getAdminURL` selector. Props xipasduarte. See [#11115](https://github.com/google/site-kit-wp/issues/11115).
    130 * Add controls for Reader Revenue Manager settings in the WordPress site editor. See [#10312](https://github.com/google/site-kit-wp/issues/10312).
     116* Improve dismissal behavior for RRM policy violation notifications by delaying them for 24 hours after setup and allowing extreme notifications to reappear up to 5 times before permanent dismissal. See [#12247](https://github.com/google/site-kit-wp/issues/12247).
     117* Improve UX of Reader Revenue Manager module setup success notification when setting it up with a publication that has an extreme policy violation. See [#12245](https://github.com/google/site-kit-wp/issues/12245).
     118* Remove the `rrmPolicyViolations` feature flag. Props fresh3nough. See [#12232](https://github.com/google/site-kit-wp/issues/12232).
     119* Add error tracking for Site Kit modules to Email Reporting. See [#12110](https://github.com/google/site-kit-wp/issues/12110).
     120* Remove "New" badges from several modules/settings that are no longer new. See [#12096](https://github.com/google/site-kit-wp/issues/12096).
     121* Ensure the correct GA events are tracked for the dashboard tour. See [#12030](https://github.com/google/site-kit-wp/issues/12030).
     122* Add GA event tracking for user interactions with the "activate Analytics" notification. See [#12028](https://github.com/google/site-kit-wp/issues/12028).
     123* Add GA event tracking for user interaction with the Welcome modal. See [#12027](https://github.com/google/site-kit-wp/issues/12027).
     124* Enhance the reauthentication admin notice to continue an interrupted module setup flow after the user grants the required scopes. See [#11989](https://github.com/google/site-kit-wp/issues/11989).
     125* Adjust desktop layout on email reporting email-report template. See [#11898](https://github.com/google/site-kit-wp/issues/11898).
     126* Ensure query params persist during email subscription flow. See [#11890](https://github.com/google/site-kit-wp/issues/11890).
     127* Include the AdSense menu item in the updated help menu. See [#11877](https://github.com/google/site-kit-wp/issues/11877).
     128* Add component to allow subscription invitations. See [#11857](https://github.com/google/site-kit-wp/issues/11857).
     129* Add error email template. See [#11852](https://github.com/google/site-kit-wp/issues/11852).
     130* Add support for stable deep links to dashboard and email subscription management. See [#11849](https://github.com/google/site-kit-wp/issues/11849).
     131* Implement Email Reporting subscription confirmation email. See [#11842](https://github.com/google/site-kit-wp/issues/11842).
     132* Allow users to start the dashboard feature tour from the "Start a feature tour" item in the help menu. See [#11820](https://github.com/google/site-kit-wp/issues/11820).
     133* Add a notification that prompts users to connect more services after completing Site Kit setup. See [#11818](https://github.com/google/site-kit-wp/issues/11818).
    131134
    132135**Fixed**
    133136
    134 * Fix the issue when users with no permissions received emails from Email Reporting. See [#12152](https://github.com/google/site-kit-wp/issues/12152).
    135 * Update email headings text to use sentence-case. See [#11966](https://github.com/google/site-kit-wp/issues/11966).
    136 * Select the "In the field" tab immediately in the PageSpeed Insights widget when field data is available, preventing a flicker due to the "In the Lab" tab being active initially. See [#11173](https://github.com/google/site-kit-wp/issues/11173).
     137* Fix bug that caused the Key Metrics banner not to be dismissed. See [#12158](https://github.com/google/site-kit-wp/issues/12158).
     138* Optimize requests for view-only users of Dashboard Sharing when Analytics module is not shared. See [#11994](https://github.com/google/site-kit-wp/issues/11994).
     139* Fix bug that caused text on some notification banners to change/flicker when clicked. See [#11188](https://github.com/google/site-kit-wp/issues/11188).
    137140
    138141[See changelog for all versions](https://raw.githubusercontent.com/google/site-kit-wp/main/changelog.txt).
Note: See TracChangeset for help on using the changeset viewer.