[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-content/plugins/akismet/views/ -> config.php (source)

   1  <?php
   2  
   3  //phpcs:disable VariableAnalysis
   4  // There are "undefined" variables here because they're defined in the code that includes this file as a template.
   5  $kses_allow_link_href = array(
   6      'a' => array(
   7          'href' => true,
   8      ),
   9  );
  10  ?>
  11  <div id="akismet-plugin-container">
  12      <?php if ( has_action( 'akismet_header' ) ) : ?>
  13          <?php do_action( 'akismet_header' ); ?>
  14      <?php else : ?>
  15          <div class="akismet-masthead">
  16              <div class="akismet-masthead__inside-container">
  17                  <?php Akismet::view( 'logo' ); ?>
  18              </div>
  19          </div>
  20      <?php endif; ?>
  21      <div class="akismet-lower">
  22          <?php if ( Akismet::get_api_key() ) { ?>
  23              <?php Akismet_Admin::display_status(); ?>
  24          <?php } ?>
  25          <?php if ( ! empty( $notices ) ) { ?>
  26              <?php foreach ( $notices as $notice ) { ?>
  27                  <?php Akismet::view( 'notice', array_merge( $notice, array( 'parent_view' => $name ) ) ); ?>
  28              <?php } ?>
  29          <?php } ?>
  30  
  31          <?php if ( isset( $stat_totals['all'] ) && isset( $stat_totals['6-months'] ) ) : ?>
  32              <div class="akismet-card">
  33                  <div class="akismet-section-header">
  34                      <h2 class="akismet-section-header__label">
  35                          <span><?php esc_html_e( 'Statistics', 'akismet' ); ?></span>
  36                      </h2>
  37                  </div> <!-- close akismet-section-header -->
  38  
  39                  <div class="akismet-new-snapshot">
  40                      <?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 */ ?>
  41                      <div class="akismet-new-snapshot__chart">
  42                          <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_user_locale() ) ); ?>" name="<?php echo esc_attr( 'snapshot-' . filemtime( __FILE__ ) ); ?>" title="<?php echo esc_attr__( 'Akismet stats', 'akismet' ); ?>"></iframe>
  43                      </div>
  44  
  45                      <ul class="akismet-new-snapshot__list">
  46                          <li class="akismet-new-snapshot__item">
  47                              <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Past six months', 'akismet' ); ?></h3>
  48                              <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['6-months']->spam ); ?></span>
  49                              <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['6-months']->spam, 'akismet' ) ); ?></span>
  50                          </li>
  51                          <li class="akismet-new-snapshot__item">
  52                              <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'All time', 'akismet' ); ?></h3>
  53                              <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['all']->spam ); ?></span>
  54                              <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['all']->spam, 'akismet' ) ); ?></span>
  55                          </li>
  56                          <li class="akismet-new-snapshot__item">
  57                              <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Accuracy', 'akismet' ); ?></h3>
  58                              <span class="akismet-new-snapshot__number"><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span>
  59                              <span class="akismet-new-snapshot__text">
  60                              <?php
  61                              /* translators: %s: number of spam missed by Akismet */
  62                              echo esc_html( sprintf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ) ) . ', ';
  63                              /* translators: %s: number of false positive spam flagged by Akismet */
  64                              echo esc_html( sprintf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ) );
  65                              ?>
  66                              </span>
  67                          </li>
  68                      </ul>
  69                  </div> <!-- close akismet-new-snapshot -->
  70  
  71                  <a href="<?php echo esc_url( Akismet_Admin::get_page_url( 'stats' ) ); ?>" class="akismet-stats-footer">
  72                      <?php esc_html_e( 'View detailed stats', 'akismet' ); ?>
  73                      <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
  74                          <polyline points="9 18 15 12 9 6"/>
  75                      </svg>
  76                  </a>
  77              </div> <!-- close akismet-card -->
  78          <?php endif; ?>
  79  
  80          <?php if ( apply_filters( 'akismet_show_compatible_plugins', true ) ) : ?>
  81              <?php Akismet::view( 'compatible-plugins' ); ?>
  82          <?php endif; ?>
  83  
  84          <?php if ( $akismet_user ) : ?>
  85              <div class="akismet-card">
  86                  <div class="akismet-section-header">
  87                      <h2 class="akismet-section-header__label">
  88                          <span><?php esc_html_e( 'Settings', 'akismet' ); ?></span>
  89                      </h2>
  90                  </div>
  91  
  92                  <div class="inside">
  93                      <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" autocomplete="off" method="POST" id="akismet-settings-form">
  94  
  95                          <div class="akismet-settings">
  96                              <?php if ( ! Akismet::predefined_api_key() ) : ?>
  97                                  <div class="akismet-settings__row">
  98                                      <h3 class="akismet-settings__row-title">
  99                                          <label class="akismet-settings__row-label" for="key"><?php esc_html_e( 'API key', 'akismet' ); ?></label>
 100                                      </h3>
 101                                      <div class="akismet-settings__row-input">
 102                                          <div class="akismet-api-key-wrapper">
 103                                              <input id="key" name="key" type="text" size="15" value="<?php echo esc_attr( get_option( 'wordpress_api_key' ) ); ?>" class="<?php echo esc_attr( 'regular-text code ' . $akismet_user->status ); ?>">
 104                                              <button type="button" class="akismet-api-key-copy" aria-label="<?php esc_attr_e( 'Copy API key', 'akismet' ); ?>">
 105                                                  <?php include plugin_dir_path( __FILE__ ) . '../_inc/img/copy.svg'; ?>
 106                                              </button>
 107                                          </div>
 108                                      </div>
 109                                  </div>
 110                              <?php endif; ?>
 111  
 112                              <?php
 113                              //phpcs:ignore WordPress.Security.NonceVerification.Recommended
 114                              if ( isset( $_GET['ssl_status'] ) ) :
 115                                  ?>
 116                                  <div class="akismet-settings__row">
 117                                      <div class="akismet-settings__row-text">
 118                                          <h3 class="akismet-settings__row-title"><?php esc_html_e( 'SSL status', 'akismet' ); ?></h3>
 119                                          <div class="akismet-settings__row-description">
 120                                              <?php if ( ! wp_http_supports( array( 'ssl' ) ) ) : ?>
 121                                                  <strong><?php esc_html_e( 'Disabled.', 'akismet' ); ?></strong>
 122                                                  <?php esc_html_e( 'Your Web server cannot make SSL requests; contact your Web host and ask them to add support for SSL requests.', 'akismet' ); ?>
 123                                              <?php else : ?>
 124                                                  <?php $ssl_disabled = get_option( 'akismet_ssl_disabled' ); ?>
 125  
 126                                                  <?php if ( $ssl_disabled ) : ?>
 127                                                      <strong><?php esc_html_e( 'Temporarily disabled.', 'akismet' ); ?></strong>
 128                                                      <?php esc_html_e( 'Akismet encountered a problem with a previous SSL request and disabled it temporarily. It will begin using SSL for requests again shortly.', 'akismet' ); ?>
 129                                                  <?php else : ?>
 130                                                      <strong><?php esc_html_e( 'Enabled.', 'akismet' ); ?></strong>
 131                                                      <?php esc_html_e( 'All systems functional.', 'akismet' ); ?>
 132                                                  <?php endif; ?>
 133                                              <?php endif; ?>
 134                                          </div>
 135                                      </div>
 136                                  </div>
 137                              <?php endif; ?>
 138  
 139                              <div class="akismet-settings__row">
 140                                  <div class="akismet-settings__row-text">
 141                                      <h3 class="akismet-settings__row-title"><?php esc_html_e( 'Comments', 'akismet' ); ?></h3>
 142                                  </div>
 143                                  <div class="akismet-settings__row-input">
 144                                      <label class="akismet-settings__row-input-label" for="akismet_show_user_comments_approved">
 145                                          <input
 146                                          name="akismet_show_user_comments_approved"
 147                                          id="akismet_show_user_comments_approved"
 148                                          value="1"
 149                                          type="checkbox"
 150                                          <?php
 151                                          // If the option isn't set, or if it's enabled ('1'), or if it was enabled a long time ago ('true'), check the checkbox.
 152                                          checked( true, ( in_array( get_option( 'akismet_show_user_comments_approved' ), array( false, '1', 'true' ), true ) ) );
 153                                          ?>
 154                                          />
 155                                          <span class="akismet-settings__row-label-text">
 156                                              <?php esc_html_e( 'Show the number of approved comments beside each comment author.', 'akismet' ); ?>
 157                                          </span>
 158                                      </label>
 159                                  </div>
 160                              </div>
 161  
 162                              <div class="akismet-settings__row is-radio">
 163                                  <div class="akismet-settings__row-text">
 164                                      <h3 class="akismet-settings__row-title"><?php esc_html_e( 'Spam filtering', 'akismet' ); ?></h3>
 165                                  </div>
 166                                  <div class="akismet-settings__row-input">
 167                                      <fieldset>
 168                                          <legend class="screen-reader-text">
 169                                              <span><?php esc_html_e( 'Akismet Anti-spam strictness', 'akismet' ); ?></span>
 170                                          </legend>
 171                                          <div>
 172                                              <label class="akismet-settings__row-input-label" for="akismet_strictness_1">
 173                                                  <input type="radio" name="akismet_strictness" id="akismet_strictness_1" value="1" <?php checked( '1', get_option( 'akismet_strictness' ) ); ?> />
 174                                                  <span class="akismet-settings__row-label-text">
 175                                                      <?php esc_html_e( 'Silently discard the worst and most pervasive spam so I never see it.', 'akismet' ); ?>
 176                                                  </span>
 177                                              </label>
 178                                          </div>
 179                                          <div>
 180                                              <label class="akismet-settings__row-input-label" for="akismet_strictness_0">
 181                                                  <input type="radio" name="akismet_strictness" id="akismet_strictness_0" value="0" <?php checked( true, get_option( 'akismet_strictness' ) !== '1' ); ?> />
 182                                                  <span class="akismet-settings__row-label-text">
 183                                                      <?php esc_html_e( 'Always put spam in the Spam folder for review.', 'akismet' ); ?>
 184                                                  </span>
 185                                              </label>
 186                                          </div>
 187                                      </fieldset>
 188  
 189                                      <div class="akismet-settings__row-note">
 190                                          <strong><?php esc_html_e( 'Note:', 'akismet' ); ?></strong>
 191                                          <?php
 192                                          $delete_interval = max( 1, intval( apply_filters( 'akismet_delete_comment_interval', 15 ) ) );
 193  
 194                                          $spam_folder_link = sprintf(
 195                                              '<a href="%s">%s</a>',
 196                                              esc_url( admin_url( 'edit-comments.php?comment_status=spam' ) ),
 197                                              esc_html__( 'spam folder', 'akismet' )
 198                                          );
 199  
 200                                          // The _n() needs to be on one line so the i18n tooling can extract the translator comment.
 201                                          /* translators: %1$s: spam folder link, %2$d: delete interval in days */
 202                                          $delete_message = _n( 'Spam in the %1$s older than %2$d day is deleted automatically.', 'Spam in the %1$s older than %2$d days is deleted automatically.', $delete_interval, 'akismet' );
 203  
 204                                          printf(
 205                                              wp_kses( $delete_message, $kses_allow_link_href ),
 206                                              wp_kses( $spam_folder_link, $kses_allow_link_href ),
 207                                              esc_html( $delete_interval )
 208                                          );
 209                                          ?>
 210                                      </div>
 211                                  </div>
 212                              </div>
 213  
 214                              <div class="akismet-settings__row is-radio">
 215                                  <div class="akismet-settings__row-text">
 216                                      <h3 class="akismet-settings__row-title"><?php esc_html_e( 'Privacy', 'akismet' ); ?></h3>
 217                                  </div>
 218                                  <div class="akismet-settings__row-input">
 219                                      <fieldset>
 220                                          <legend class="screen-reader-text">
 221                                              <span><?php esc_html_e( 'Akismet privacy notice', 'akismet' ); ?></span>
 222                                          </legend>
 223                                          <div>
 224                                              <label class="akismet-settings__row-input-label" for="akismet_comment_form_privacy_notice_display">
 225                                                  <input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_display" value="display" <?php checked( 'display', get_option( 'akismet_comment_form_privacy_notice' ) ); ?> />
 226                                                  <span class="akismet-settings__row-label-text">
 227                                                      <?php esc_html_e( 'Display a privacy notice under your comment forms.', 'akismet' ); ?>
 228                                                  </span>
 229                                              </label>
 230                                          </div>
 231                                          <div>
 232                                              <label class="akismet-settings__row-input-label" for="akismet_comment_form_privacy_notice_hide">
 233                                                  <input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_hide" value="hide" <?php echo in_array( get_option( 'akismet_comment_form_privacy_notice' ), array( 'display', 'hide' ), true ) ? checked( 'hide', get_option( 'akismet_comment_form_privacy_notice' ), false ) : 'checked="checked"'; ?> />
 234                                                  <span class="akismet-settings__row-label-text">
 235                                                      <?php esc_html_e( 'Do not display privacy notice.', 'akismet' ); ?>
 236                                                  </span>
 237                                              </label>
 238                                          </div>
 239                                      </fieldset>
 240  
 241                                      <div class="akismet-settings__row-note">
 242                                          <?php esc_html_e( 'To help your site with transparency under privacy laws like the GDPR, Akismet can display a notice to your users under your comment forms.', 'akismet' ); ?>
 243                                      </div>
 244                                  </div>
 245                              </div>
 246  
 247                              <?php if ( apply_filters( 'akismet_show_mcp_setting', true ) ) : ?>
 248                                  <div class="akismet-settings__row">
 249                                      <div class="akismet-settings__row-text">
 250                                          <h3 class="akismet-settings__row-title">
 251                                              <?php esc_html_e( 'Tool access', 'akismet' ); ?>
 252                                          </h3>
 253                                      </div>
 254                                      <div class="akismet-settings__row-input">
 255                                          <label class="akismet-settings__row-input-label" for="akismet_enable_mcp_access">
 256                                              <input
 257                                                  name="akismet_enable_mcp_access"
 258                                                  id="akismet_enable_mcp_access"
 259                                                  value="1"
 260                                                  type="checkbox"
 261                                                  <?php checked( '1', get_option( 'akismet_enable_mcp_access' ) ); ?>
 262                                              />
 263                                              <span class="akismet-settings__row-label-text">
 264                                                  <?php esc_html_e( 'Allow ', 'akismet' ); ?><abbr title="<?php esc_attr_e( 'Model Context Protocol', 'akismet' ); ?>"><?php esc_html_e( 'MCP', 'akismet' ); ?></abbr><?php esc_html_e( ' clients to access Akismet data and functionality', 'akismet' ); ?>
 265                                              </span>
 266                                          </label>
 267                                          <div class="akismet-settings__row-note">
 268                                              <?php esc_html_e( 'MCP (Model Context Protocol) allows AI assistants to access Akismet statistics and spam checking features.', 'akismet' ); ?>
 269                                          </div>
 270                                      </div>
 271                                  </div>
 272                              <?php endif; ?>
 273                          </div>
 274  
 275                          <div class="akismet-card-actions">
 276                              <?php if ( ! Akismet::predefined_api_key() ) : ?>
 277                                  <div id="delete-action" class="akismet-card-actions__secondary-action">
 278                                      <a class="submitdelete deletion" href="<?php echo esc_url( Akismet_Admin::get_page_url( 'delete_key' ) ); ?>"><?php esc_html_e( 'Disconnect this account', 'akismet' ); ?></a>
 279                                  </div>
 280                              <?php endif; ?>
 281  
 282                              <?php wp_nonce_field( Akismet_Admin::NONCE ); ?>
 283  
 284                              <div id="publishing-action">
 285                                  <input type="hidden" name="action" value="enter-key">
 286                                  <input type="submit" name="submit" id="submit" class="akismet-button akismet-could-be-primary" value="<?php esc_attr_e( 'Save changes', 'akismet' ); ?>">
 287                              </div>
 288                          </div>
 289                      </form>
 290                  </div>
 291              </div>
 292  
 293              <?php if ( ! Akismet::predefined_api_key() ) : ?>
 294                  <div class="akismet-card">
 295                      <div class="akismet-section-header">
 296                          <h2 class="akismet-section-header__label">
 297                              <span><?php esc_html_e( 'Account', 'akismet' ); ?></span>
 298                          </h2>
 299                      </div>
 300  
 301                      <div class="inside">
 302                          <dl class="akismet-account">
 303                              <dt class="akismet-account__label"><?php esc_html_e( 'Subscription type', 'akismet' ); ?></dt>
 304                              <dd class="akismet-account__value"><?php echo esc_html( $akismet_user->account_name ); ?></dd>
 305  
 306                              <dt class="akismet-account__label"><?php esc_html_e( 'Status', 'akismet' ); ?></dt>
 307                              <dd class="akismet-account__value">
 308                                  <?php
 309                                  if ( Akismet::USER_STATUS_CANCELLED === $akismet_user->status ) :
 310                                      esc_html_e( 'Cancelled', 'akismet' );
 311                                  elseif ( Akismet::USER_STATUS_SUSPENDED === $akismet_user->status ) :
 312                                      esc_html_e( 'Suspended', 'akismet' );
 313                                  elseif ( Akismet::USER_STATUS_MISSING === $akismet_user->status ) :
 314                                      esc_html_e( 'Missing', 'akismet' );
 315                                  elseif ( Akismet::USER_STATUS_NO_SUB === $akismet_user->status ) :
 316                                      esc_html_e( 'No subscription found', 'akismet' );
 317                                  else :
 318                                      esc_html_e( 'Active', 'akismet' );
 319                                  endif;
 320                                  ?>
 321                              </dd>
 322  
 323                              <?php if ( $akismet_user->next_billing_date ) : ?>
 324                                  <dt class="akismet-account__label"><?php esc_html_e( 'Next billing date', 'akismet' ); ?></dt>
 325                                  <dd class="akismet-account__value"><?php echo esc_html( gmdate( 'F j, Y', $akismet_user->next_billing_date ) ); ?></dd>
 326                              <?php endif; ?>
 327                          </dl>
 328                          <div class="akismet-card-actions">
 329                              <?php if ( $akismet_user->status === Akismet::USER_STATUS_ACTIVE ) : ?>
 330                                  <div class="akismet-card-actions__secondary-action">
 331                                      <a href="https://akismet.com/account?utm_source=akismet_plugin&amp;utm_campaign=plugin_static_link&amp;utm_medium=in_plugin&amp;utm_content=account_overview" class="akismet-external-link" aria-label="Account overview on akismet.com"><?php esc_html_e( 'Account overview', 'akismet' ); ?></a>
 332                                  </div>
 333                              <?php endif; ?>
 334                              <div id="publishing-action">
 335                                  <?php
 336                                  Akismet::view(
 337                                      'get',
 338                                      array(
 339                                          'text'        => ( $akismet_user->account_type === 'free-api-key' && $akismet_user->status === Akismet::USER_STATUS_ACTIVE ? __( 'Upgrade', 'akismet' ) : __( 'Change', 'akismet' ) ),
 340                                          'redirect'    => 'upgrade',
 341                                          'utm_content' => ( $akismet_user->account_type === 'free-api-key' && $akismet_user->status === Akismet::USER_STATUS_ACTIVE ? 'config_upgrade' : 'config_change' ),
 342                                      )
 343                                  );
 344                                  ?>
 345                              </div>
 346                          </div>
 347                      </div>
 348                  </div>
 349              <?php endif; ?>
 350          <?php endif; ?>
 351      </div>
 352      <?php Akismet::view( 'footer' ); ?>
 353  </div>


Generated : Wed Jul 1 08:20:12 2026 Cross-referenced by PHPXref