diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:51:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:51:18 +0000 |
commit | 0e41b5d52fdc6af6442816b5f465c9db9f84e126 (patch) | |
tree | e139a90049b158d4eed892d1662ee7f5c358fa31 /wp-content/plugins/akismet/views | |
parent | Adding upstream version 6.5.5+dfsg1. (diff) | |
download | wordpress-0e41b5d52fdc6af6442816b5f465c9db9f84e126.tar.xz wordpress-0e41b5d52fdc6af6442816b5f465c9db9f84e126.zip |
Adding upstream version 6.6.1+dfsg1.upstream/6.6.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-content/plugins/akismet/views')
-rw-r--r-- | wp-content/plugins/akismet/views/config.php | 88 | ||||
-rw-r--r-- | wp-content/plugins/akismet/views/notice.php | 44 | ||||
-rw-r--r-- | wp-content/plugins/akismet/views/setup.php | 2 |
3 files changed, 72 insertions, 62 deletions
diff --git a/wp-content/plugins/akismet/views/config.php b/wp-content/plugins/akismet/views/config.php index b9e4457..23ad5c7 100644 --- a/wp-content/plugins/akismet/views/config.php +++ b/wp-content/plugins/akismet/views/config.php @@ -20,55 +20,57 @@ $kses_allow_link_href = array( <?php } ?> <?php if ( ! empty( $notices ) ) { ?> <?php foreach ( $notices as $notice ) { ?> - <?php Akismet::view( 'notice', $notice ); ?> + <?php Akismet::view( 'notice', array_merge( $notice, array( 'parent_view' => $name ) ) ); ?> <?php } ?> <?php } ?> - <div class="akismet-card"> - <div class="akismet-section-header"> - <h2 class="akismet-section-header__label"> - <span><?php esc_html_e( 'Statistics', 'akismet' ); ?></span> - </h2> + <?php if ( isset( $stat_totals['all'] ) && isset( $stat_totals['6-months'] ) ) : ?> + <div class="akismet-card"> + <div class="akismet-section-header"> + <h2 class="akismet-section-header__label"> + <span><?php esc_html_e( 'Statistics', 'akismet' ); ?></span> + </h2> - <div class="akismet-section-header__actions"> - <a href="<?php echo esc_url( Akismet_Admin::get_page_url( 'stats' ) ); ?>"> - <?php esc_html_e( 'Detailed stats', 'akismet' ); ?> - </a> - </div> - </div> <!-- close akismet-section-header --> + <div class="akismet-section-header__actions"> + <a href="<?php echo esc_url( Akismet_Admin::get_page_url( 'stats' ) ); ?>"> + <?php esc_html_e( 'Detailed stats', 'akismet' ); ?> + </a> + </div> + </div> <!-- close akismet-section-header --> - <div class="akismet-new-snapshot"> - <?php /* name attribute on iframe is used as a cache-buster here to force Firefox to load the new style charts: https://bugzilla.mozilla.org/show_bug.cgi?id=356558 */ ?> - <div class="akismet-new-snapshot__chart"> - <iframe id="stats-iframe" allowtransparency="true" scrolling="no" frameborder="0" style="width: 100%; height: 220px; overflow: hidden;" src="<?php echo esc_url( sprintf( 'https://tools.akismet.com/1.0/snapshot.php?blog=%s&token=%s&height=200&locale=%s&is_redecorated=1', rawurlencode( get_option( 'home' ) ), rawurlencode( Akismet::get_access_token() ), get_locale() ) ); ?>" name="<?php echo esc_attr( 'snapshot-' . filemtime( __FILE__ ) ); ?>" title="<?php echo esc_attr__( 'Akismet stats' ); ?>"></iframe> - </div> - <ul class="akismet-new-snapshot__list"> - <li class="akismet-new-snapshot__item"> - <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Past six months', 'akismet' ); ?></h3> - <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['6-months']->spam ); ?></span> - <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['6-months']->spam, 'akismet' ) ); ?></span> - </li> - <li class="akismet-new-snapshot__item"> - <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'All time', 'akismet' ); ?></h3> - <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['all']->spam ); ?></span> - <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['all']->spam, 'akismet' ) ); ?></span> - </li> - <li class="akismet-new-snapshot__item"> - <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Accuracy', 'akismet' ); ?></h3> - <span class="akismet-new-snapshot__number"><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span> - <span class="akismet-new-snapshot__text"> - <?php - /* translators: %s: number of spam missed by Akismet */ - echo esc_html( sprintf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ) ) . ', '; - /* translators: %s: number of false positive spam flagged by Akismet */ - echo esc_html( sprintf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ) ); - ?> - </span> - </li> - </ul> - </div> <!-- close akismet-new-snapshot --> + <div class="akismet-new-snapshot"> + <?php /* name attribute on iframe is used as a cache-buster here to force Firefox to load the new style charts: https://bugzilla.mozilla.org/show_bug.cgi?id=356558 */ ?> + <div class="akismet-new-snapshot__chart"> + <iframe id="stats-iframe" allowtransparency="true" scrolling="no" frameborder="0" style="width: 100%; height: 220px; overflow: hidden;" src="<?php echo esc_url( sprintf( 'https://tools.akismet.com/1.0/snapshot.php?blog=%s&token=%s&height=200&locale=%s&is_redecorated=1', rawurlencode( get_option( 'home' ) ), rawurlencode( Akismet::get_access_token() ), get_locale() ) ); ?>" name="<?php echo esc_attr( 'snapshot-' . filemtime( __FILE__ ) ); ?>" title="<?php echo esc_attr__( 'Akismet stats' ); ?>"></iframe> + </div> - </div> <!-- close akismet-card --> + <ul class="akismet-new-snapshot__list"> + <li class="akismet-new-snapshot__item"> + <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Past six months', 'akismet' ); ?></h3> + <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['6-months']->spam ); ?></span> + <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['6-months']->spam, 'akismet' ) ); ?></span> + </li> + <li class="akismet-new-snapshot__item"> + <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'All time', 'akismet' ); ?></h3> + <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['all']->spam ); ?></span> + <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['all']->spam, 'akismet' ) ); ?></span> + </li> + <li class="akismet-new-snapshot__item"> + <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Accuracy', 'akismet' ); ?></h3> + <span class="akismet-new-snapshot__number"><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span> + <span class="akismet-new-snapshot__text"> + <?php + /* translators: %s: number of spam missed by Akismet */ + echo esc_html( sprintf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ) ) . ', '; + /* translators: %s: number of false positive spam flagged by Akismet */ + echo esc_html( sprintf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ) ); + ?> + </span> + </li> + </ul> + </div> <!-- close akismet-new-snapshot --> + </div> <!-- close akismet-card --> + <?php endif; ?> <?php if ( $akismet_user ) : ?> <div class="akismet-card"> diff --git a/wp-content/plugins/akismet/views/notice.php b/wp-content/plugins/akismet/views/notice.php index 466a322..be10ab2 100644 --- a/wp-content/plugins/akismet/views/notice.php +++ b/wp-content/plugins/akismet/views/notice.php @@ -9,9 +9,12 @@ $kses_allow_link = array( ); $kses_allow_strong = array( 'strong' => true ); +if ( ! isset( $type ) ) { + $type = false; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited +} + /* - * Some notices (plugin, spam-check, spam-check-cron-disabled, alert and usage-limit) are shown elsewhere in wp-admin, - * so look different to the standard notices. + * Some notices (plugin, spam-check, spam-check-cron-disabled, alert and usage-limit) are also shown elsewhere in wp-admin, so have different classes applied so that they match the standard WordPress notice format. */ ?> <?php if ( $type === 'plugin' ) : ?> @@ -37,25 +40,27 @@ $kses_allow_strong = array( 'strong' => true ); </div> <?php elseif ( $type === 'spam-check' ) : ?> -<div class="notice notice-warning"> - <p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' ); ?></strong></p> - <p><?php esc_html_e( 'Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation and will automatically be rechecked later.', 'akismet' ); ?></p> - <?php if ( $link_text ) : ?> - <p><?php echo wp_kses( $link_text, $kses_allow_link ); ?></p> - <?php endif; ?> -</div> + <?php // This notice is only displayed on edit-comments.php. ?> + <div class="notice notice-warning"> + <p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' ); ?></strong></p> + <p><?php esc_html_e( 'Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation and will automatically be rechecked later.', 'akismet' ); ?></p> + <?php if ( ! empty( $link_text ) ) : ?> + <p><?php echo wp_kses( $link_text, $kses_allow_link ); ?></p> + <?php endif; ?> + </div> <?php elseif ( $type === 'spam-check-cron-disabled' ) : ?> -<div class="notice notice-warning"> - <p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' ); ?></strong></p> - <p><?php esc_html_e( 'WP-Cron has been disabled using the DISABLE_WP_CRON constant. Comment rechecks may not work properly.', 'akismet' ); ?></p> -</div> - + <?php // This notice is only displayed on edit-comments.php. ?> + <div class="notice notice-warning"> + <p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' ); ?></strong></p> + <p><?php esc_html_e( 'WP-Cron has been disabled using the DISABLE_WP_CRON constant. Comment rechecks may not work properly.', 'akismet' ); ?></p> + </div> + <?php elseif ( $type === 'alert' ) : ?> -<div class="error"> +<div class="<?php echo isset( $parent_view ) && $parent_view === 'config' ? 'akismet-alert is-bad' : 'error'; ?>"> <?php /* translators: The placeholder is an error code returned by Akismet. */ ?> <p><strong><?php printf( esc_html__( 'Akismet error code: %s', 'akismet' ), esc_html( $code ) ); ?></strong></p> - <p><?php echo esc_html( $msg ); ?></p> + <p><?php echo isset( $msg ) ? esc_html( $msg ) : ''; ?></p> <p> <?php /* translators: the placeholder is a clickable URL that leads to more information regarding an error code. */ @@ -307,8 +312,11 @@ $kses_allow_strong = array( 'strong' => true ); <div class="akismet-usage-limit-cta"> <a href="<?php echo esc_attr( $upgrade_url ); ?>" class="button" target="_blank"> <?php - // If only a qty upgrade is required, show a more generic message. - if ( ! empty( $upgrade_type ) && 'qty' === $upgrade_type ) { + if ( isset( $upgrade_via_support ) && $upgrade_via_support ) { + // Direct user to contact support. + esc_html_e( 'Contact Akismet support', 'akismet' ); + } elseif ( ! empty( $upgrade_type ) && 'qty' === $upgrade_type ) { + // If only a qty upgrade is required, show a more generic message. esc_html_e( 'Upgrade your subscription level', 'akismet' ); } else { echo esc_html( diff --git a/wp-content/plugins/akismet/views/setup.php b/wp-content/plugins/akismet/views/setup.php index 5078009..f4ddaf1 100644 --- a/wp-content/plugins/akismet/views/setup.php +++ b/wp-content/plugins/akismet/views/setup.php @@ -1,4 +1,4 @@ <div class="akismet-setup-instructions"> <p><?php esc_html_e( 'Set up your Akismet account to enable spam filtering on this site.', 'akismet' ); ?></p> - <?php Akismet::view( 'get', array( 'text' => __( 'Set up your Akismet account' , 'akismet' ), 'classes' => array( 'akismet-button', 'akismet-is-primary' ) ) ); ?> + <?php Akismet::view( 'get', array( 'text' => __( 'Choose an Akismet plan', 'akismet' ), 'classes' => array( 'akismet-button', 'akismet-is-primary' ) ) ); ?> </div> |