fatal error.' ), esc_html__( 'Theme will be auto-updated.' ), esc_html__( 'Theme will no longer be auto-updated.' ), // Plugins. esc_html__( 'Plugin activated.' ), esc_html__( 'Plugin deactivated.' ), esc_html__( 'Plugin downgraded successfully.' ), esc_html__( 'Plugin updated successfully.' ), // Settings. esc_html__( 'Settings saved.' ), esc_html__( 'Permalink structure updated.' ), // translators: file name. esc_html__( 'You should update your %s file now.' ), // translators: file name. esc_html__( 'Permalink structure updated. Remove write access on %s file now!' ), esc_html__( 'Privacy Policy page updated successfully.' ), esc_html__( 'The currently selected Privacy Policy page does not exist. Please create or select a new page.' ), // translators: file name. esc_html__( 'The currently selected Privacy Policy page is in the Trash. Please create or select a new Privacy Policy page or restore the current page.' ), // Multisite. esc_html__( 'Sites removed from spam.' ), esc_html__( 'Sites marked as spam.' ), esc_html__( 'Sites deleted.' ), esc_html__( 'Site deleted.' ), esc_html__( 'Sorry, you are not allowed to delete that site.' ), esc_html__( 'Site archived.' ), esc_html__( 'Site unarchived.' ), esc_html__( 'Site activated.' ), esc_html__( 'Site deactivated.' ), esc_html__( 'Site removed from spam.' ), esc_html__( 'Site marked as spam.' ), // Personal data export. esc_html__( 'Unable to initiate confirmation request.' ), esc_html__( 'Unable to initiate user privacy confirmation request.' ), esc_html__( 'Unable to add this request. A valid email address or username must be supplied.' ), esc_html__( 'Invalid user privacy action.' ), esc_html__( 'Confirmation request sent again successfully.' ), esc_html__( 'Confirmation request initiated successfully.' ), ); $plural_system_messages = array( // Posts and pages. array( '%s post permanently deleted.', '%s posts permanently deleted.' ), array( '%s post moved to the Trash.', '%s posts moved to the Trash.' ), array( '%s post restored from the Trash.', '%s posts restored from the Trash.' ), array( '%s page permanently deleted.', '%s pages permanently deleted.' ), array( '%s page moved to the Trash.', '%s pages moved to the Trash.' ), array( '%s page restored from the Trash.', '%s pages restored from the Trash.' ), array( '%s post updated.', '%s posts updated.' ), array( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.' ), array( '%s page updated.', '%s pages updated.' ), array( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.' ), // Comments. array( '%s comment approved.', '%s comments approved.' ), array( '%s comment marked as spam.', '%s comments marked as spam.' ), array( '%s comment restored from the spam.', '%s comments restored from the spam.' ), array( '%s comment moved to the Trash.', '%s comments moved to the Trash.' ), array( '%s comment restored from the Trash.', '%s comments restored from the Trash.' ), array( '%s comment permanently deleted.', '%s comments permanently deleted.' ), // Users. array( '%s user deleted.', '%s users deleted.' ), // Personal data export. array( '%d confirmation request failed to resend.', '%d confirmation requests failed to resend.' ), array( '%d confirmation request re-sent successfully.', '%d confirmation requests re-sent successfully.' ), array( '%d request marked as complete.', '%d requests marked as complete.' ), array( '%d request failed to delete.', '%d requests failed to delete.' ), array( '%d request deleted successfully.', '%d requests deleted successfully.' ), ); foreach ( $plural_system_messages as $message ) { array_push( $system_messages, _n( $message[0], $message[1], 0 ) ); // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingle, WordPress.WP.I18n.NonSingularStringLiteralPlural array_push( $system_messages, _n( $message[0], $message[1], 1 ) ); // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingle, WordPress.WP.I18n.NonSingularStringLiteralPlural array_push( $system_messages, _n( $message[0], $message[1], 2 ) ); // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingle, WordPress.WP.I18n.NonSingularStringLiteralPlural array_push( $system_messages, _n( $message[0], $message[1], 5 ) ); // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingle, WordPress.WP.I18n.NonSingularStringLiteralPlural } \wp_localize_script( 'admin_notices_manager_notices', 'anm_i18n', array( 'title' => esc_html__( 'Admin notices', 'admin-notices-manager' ), 'title_empty' => esc_html__( 'No admin notices', 'admin-notices-manager' ), 'date_time_preamble' => esc_html__( 'First logged:', 'admin-notices-manager' ) . ' ', 'hide_notice_text' => esc_attr__( 'Hide notice forever', 'admin-notices-manager' ), 'hide_notice' => esc_attr__( 'Hide this notice', 'admin-notices-manager' ), 'display_notice' => esc_attr__( 'Display notice as normal', 'admin-notices-manager' ), 'system_messages' => $system_messages, 'settings' => Settings::get_settings(), 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'anm-ajax-nonce' ), ) ); wp_localize_script( 'admin_notices_manager_settings', 'anm_settings', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), ) ); } /** * Enqueue styles for admin. * * @return void */ function admin_styles() { wp_enqueue_style( 'admin_notices_manager_admin', style_url( 'admin-style', 'admin' ), array(), ADMIN_NOTICES_MANAGER_VERSION ); } /** * Simple function to clear hidden notices. * * @return void */ function purge_notices() { if ( ! isset( $_REQUEST['nonce'] ) || ! \wp_verify_nonce( \sanitize_text_field( \wp_unslash( $_REQUEST['nonce'] ) ), 'anm_purge_notices_nonce' ) ) { exit; } \update_option( 'anm-hidden-notices', array() ); \wp_send_json_success(); }