editor_script_handles as $handle ) { wp_set_script_translations( $handle, 'gruver-subscribe' ); } } } /** * The lists for the block editor, only when an editor loads (not on every request). */ public static function editor_assets(): void { $block = \WP_Block_Type_Registry::get_instance()->get_registered( Renderer::BLOCK ); if ( null === $block ) { return; } foreach ( $block->editor_script_handles as $handle ) { wp_add_inline_script( $handle, 'window.gruverSubscribe = ' . wp_json_encode( self::editor_data() ) . ';', 'before' ); } } /** * Classic widget. */ public static function widgets(): void { register_widget( Widget::class ); } /** * Lists for the block editor: keys and names, never the tokens. * * @return array{lists: list, settingsUrl: string} */ private static function editor_data(): array { $lists = array(); foreach ( Settings::lists() as $mailing_list ) { $name = Status::get( $mailing_list->key )['list']; $lists[] = array( 'key' => $mailing_list->key, 'label' => '' === $name ? $mailing_list->key : $name . ' (' . $mailing_list->key . ')', ); } return array( 'lists' => $lists, 'settingsUrl' => SettingsPage::url(), ); } /** * Suggested text for the privacy policy of the site. */ public static function privacy_policy(): void { if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) { return; } wp_add_privacy_policy_content( __( 'GruVer Subscribe', 'gruver-subscribe' ), '

' . esc_html__( 'You can sign up for our mailing lists with a form on our website. The mailing lists are run with GruVer (app.gruver.de), which processes the data on our behalf.', 'gruver-subscribe' ) . '

' . '

' . esc_html__( 'When you send the form, our web server passes your email address, your name if you enter it, the text of your consent, the address of the page and your IP address without its last part to GruVer. GruVer then sends you an email with a confirmation link (double opt-in). Only after you confirm are you added to the list; unconfirmed sign-ups are deleted after 7 days. GruVer keeps the consent text, the times of sign-up and confirmation and the shortened IP addresses as proof of your consent.', 'gruver-subscribe' ) . '

' . '

' . esc_html__( 'To protect the form against abuse, our website counts sign-ups per IP address under a pseudonymised value of the address (a keyed hash). The counter is valid for 10 minutes and deleted after one day at the latest. What you enter in the form is not stored on our website. The form sets no cookies.', 'gruver-subscribe' ) . '

' . '

' . esc_html__( 'You can unsubscribe at any time with the link in every email.', 'gruver-subscribe' ) . '

' ); } }