[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

   1  <?php
   2  //phpcs:disable VariableAnalysis
   3  // There are "undefined" variables here because they're defined in the code that includes this file as a template.
   4  $kses_allow_link   = array(
   5      'a' => array(
   6          'href'   => true,
   7          'target' => true,
   8          'class'  => true,
   9      ),
  10  );
  11  $kses_allow_strong = array( 'strong' => true );
  12  
  13  if ( ! isset( $type ) ) {
  14      $type = false; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
  15  }
  16  
  17  /*
  18   * 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.
  19   */
  20  ?>
  21  <?php if ( $type === 'plugin' ) : ?>
  22      <?php // Displayed on edit-comments.php to users who have not set up Akismet yet. ?>
  23      <div class="updated" id="akismet-setup-prompt">
  24          <form name="akismet_activate" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post">
  25              <div class="akismet-activate">
  26                  <input type="submit" class="akismet-activate__button akismet-button" value="<?php esc_attr_e( 'Set up your Akismet account', 'akismet' ); ?>" />
  27                  <div class="akismet-activate__description">
  28                      <?php esc_html_e( 'Almost done! Configure Akismet and say goodbye to spam', 'akismet' ); ?>
  29                  </div>
  30              </div>
  31          </form>
  32      </div>
  33  <?php elseif ( $type === 'spam-check' ) : ?>
  34      <?php // This notice is only displayed on edit-comments.php. ?>
  35      <div class="notice notice-warning">
  36          <p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' ); ?></strong></p>
  37          <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>
  38          <?php if ( ! empty( $link_text ) ) : ?>
  39              <p><?php echo wp_kses( $link_text, $kses_allow_link ); ?></p>
  40          <?php endif; ?>
  41      </div>
  42  
  43  <?php elseif ( $type === 'spam-check-cron-disabled' ) : ?>
  44      <?php // This notice is only displayed on edit-comments.php. ?>
  45      <div class="notice notice-warning">
  46          <p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' ); ?></strong></p>
  47          <p><?php esc_html_e( 'WP-Cron has been disabled using the DISABLE_WP_CRON constant. Comment rechecks may not work properly.', 'akismet' ); ?></p>
  48      </div>
  49  
  50  <?php elseif ( $type === 'alert' && $code === Akismet::ALERT_CODE_COMMERCIAL && isset( $parent_view ) && $parent_view === 'config' ) : ?>
  51      <?php // Display a different commercial warning alert on the config page ?>
  52      <div class="akismet-card akismet-alert is-commercial">
  53          <div>
  54              <h3 class="akismet-alert-header"><?php esc_html_e( 'We detected commercial activity on your site', 'akismet' ); ?></h3>
  55              <p class="akismet-alert-info">
  56                  <?php
  57                      /* translators: The placeholder is a URL. */
  58                      echo wp_kses( sprintf( __( 'Your current subscription is for <a class="akismet-external-link" href="%s">personal, non-commercial use</a>. Please upgrade your plan to continue using Akismet.', 'akismet' ), esc_url( 'https://akismet.com/support/getting-started/free-or-paid/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=commercial_support' ) ), $kses_allow_link );
  59                  ?>
  60              </p>
  61              <p class="akismet-alert-info">
  62                  <?php
  63                      /* translators: The placeholder is a URL to the contact form. */
  64                      echo wp_kses( sprintf( __( 'If you believe your site should not be classified as commercial, <a class="akismet-external-link" href="%s">please get in touch</a>', 'akismet' ), esc_url( 'https://akismet.com/contact/?purpose=commercial&utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=commercial_contact' ) ), $kses_allow_link );
  65                  ?>
  66              </p>
  67          </div>
  68          <div class="akismet-alert-button-wrapper">
  69              <?php
  70              Akismet::view(
  71                  'get',
  72                  array(
  73                      'text'         => __( 'Upgrade plan', 'akismet' ),
  74                      'classes'      => array( 'akismet-alert-button', 'akismet-button' ),
  75                      'redirect'     => 'upgrade',
  76                      'utm_content'  => 'commercial_upgrade',
  77                  )
  78              );
  79              ?>
  80          </div>
  81      </div>
  82  
  83  <?php elseif ( $type === 'alert' ) : ?>
  84  <div class="<?php echo isset( $parent_view ) && $parent_view === 'config' ? 'akismet-alert is-bad' : 'error'; ?>">
  85      <?php /* translators: The placeholder is an error code returned by Akismet. */ ?>
  86      <p><strong><?php printf( esc_html__( 'Akismet error code: %s', 'akismet' ), esc_html( $code ) ); ?></strong></p>
  87      <p><?php echo isset( $msg ) ? esc_html( $msg ) : ''; ?></p>
  88      <p>
  89          <?php
  90          echo wp_kses(
  91              sprintf(
  92                  /* translators: the placeholder is a clickable URL that leads to more information regarding an error code. */
  93                  __( 'For more information, see the <a class="akismet-external-link" href="%s">error documentation on akismet.com</a>', 'akismet' ),
  94                  esc_url( 'https://akismet.com/developers/detailed-docs/errors/akismet-error-' . absint( $code ) . '?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=error_info' )
  95              ),
  96              $kses_allow_link
  97          );
  98          ?>
  99      </p>
 100  </div>
 101  
 102  <?php elseif ( $type === 'notice' ) : ?>
 103  <div class="akismet-alert is-bad">
 104      <h3 class="akismet-alert__heading"><?php echo wp_kses( $notice_header, Akismet_Admin::get_notice_kses_allowed_elements() ); ?></h3>
 105      <p>
 106          <?php echo wp_kses( $notice_text, Akismet_Admin::get_notice_kses_allowed_elements() ); ?>
 107      </p>
 108  </div>
 109  
 110  <?php elseif ( $type === 'missing-functions' ) : ?>
 111  <div class="akismet-alert is-bad">
 112      <h3 class="akismet-alert__heading"><?php esc_html_e( 'Network functions are disabled.', 'akismet' ); ?></h3>
 113      <p>
 114          <?php
 115          echo wp_kses( __( 'Your web host or server administrator has disabled PHP&#8217;s <code>gethostbynamel</code> function.', 'akismet' ), array_merge( $kses_allow_link, $kses_allow_strong, array( 'code' => true ) ) );
 116          ?>
 117      </p>
 118      <p>
 119          <?php
 120          /* translators: The placeholder is a URL. */
 121          echo wp_kses( sprintf( __( 'Please contact your web host or firewall administrator and give them <a class="akismet-external-link" href="%s" target="_blank">this information about Akismet&#8217;s system requirements</a>', 'akismet' ), esc_url( 'https://akismet.com/akismet-hosting-faq/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=hosting_faq_php' ) ), array_merge( $kses_allow_link, $kses_allow_strong, array( 'code' => true ) ) );
 122          ?>
 123      </p>
 124  </div>
 125  
 126  <?php elseif ( $type === 'servers-be-down' ) : ?>
 127  <div class="akismet-alert is-bad">
 128      <h3 class="akismet-alert__heading"><?php esc_html_e( 'Your site can&#8217;t connect to the Akismet servers.', 'akismet' ); ?></h3>
 129      <p>
 130      <?php
 131          /* translators: The placeholder is a URL. */
 132          echo wp_kses( sprintf( __( 'Your firewall may be blocking Akismet from connecting to its API. Please contact your host and refer to <a class="akismet-external-link" href="%s" target="_blank">our guide about firewalls</a>', 'akismet' ), esc_url( 'https://akismet.com/akismet-hosting-faq/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=hosting_faq_firewall' ) ), $kses_allow_link );
 133      ?>
 134      </p>
 135  </div>
 136  
 137  <?php elseif ( $type === 'active-dunning' ) : ?>
 138  <div class="akismet-alert is-bad">
 139      <h3 class="akismet-alert__heading"><?php esc_html_e( 'Please update your payment information.', 'akismet' ); ?></h3>
 140      <p>
 141          <?php
 142          /* translators: The placeholder is a URL. */
 143          echo wp_kses( sprintf( __( 'We cannot process your payment. Please <a class="akismet-external-link" href="%s" target="_blank">update your payment details</a>', 'akismet' ), esc_url( 'https://wordpress.com/me/purchases/payment-methods?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=payment_update' ) ), $kses_allow_link );
 144          ?>
 145      </p>
 146  </div>
 147  
 148  <?php elseif ( $type === 'cancelled' ) : ?>
 149  <div class="akismet-alert is-bad">
 150      <h3 class="akismet-alert__heading"><?php esc_html_e( 'Your Akismet plan has been cancelled.', 'akismet' ); ?></h3>
 151      <p>
 152          <?php
 153          /* translators: The placeholder is a URL. */
 154          echo wp_kses( sprintf( __( 'Please visit <a class="akismet-external-link" href="%s" target="_blank">Akismet.com</a> to purchase a new subscription.', 'akismet' ), esc_url( 'https://akismet.com/pricing/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=pricing_cancelled' ) ), $kses_allow_link );
 155          ?>
 156      </p>
 157  </div>
 158  
 159  <?php elseif ( $type === 'suspended' ) : ?>
 160  <div class="akismet-alert is-bad">
 161      <h3 class="akismet-alert__heading"><?php esc_html_e( 'Your Akismet subscription is suspended.', 'akismet' ); ?></h3>
 162      <p>
 163          <?php
 164          /* translators: The placeholder is a URL. */
 165          echo wp_kses( sprintf( __( 'Please contact <a class="akismet-external-link" href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet' ), esc_url( 'https://akismet.com/contact/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=support_suspended' ) ), $kses_allow_link );
 166          ?>
 167      </p>
 168  </div>
 169  
 170  <?php elseif ( $type === 'active-notice' && $time_saved ) : ?>
 171  <div class="akismet-alert is-neutral">
 172      <h3 class="akismet-alert__heading"><?php echo esc_html( $time_saved ); ?></h3>
 173      <p>
 174          <?php
 175          /* translators: the placeholder is a clickable URL to the Akismet account upgrade page. */
 176          echo wp_kses( sprintf( __( 'You can help us fight spam and upgrade your account by <a class="akismet-external-link" href="%s" target="_blank">contributing a token amount</a>', 'akismet' ), esc_url( 'https://akismet.com/pricing?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=upgrade_contribution' ) ), $kses_allow_link );
 177          ?>
 178      </p>
 179  </div>
 180  
 181  <?php elseif ( $type === 'missing' ) : ?>
 182  <div class="akismet-alert is-bad">
 183      <h3 class="akismet-alert__heading"><?php esc_html_e( 'There is a problem with your API key.', 'akismet' ); ?></h3>
 184      <p>
 185          <?php
 186          /* translators: The placeholder is a URL to the Akismet contact form. */
 187          echo wp_kses( sprintf( __( 'Please contact <a class="akismet-external-link" href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet' ), esc_url( 'https://akismet.com/contact/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=support_missing' ) ), $kses_allow_link );
 188          ?>
 189      </p>
 190  </div>
 191  
 192  <?php elseif ( $type === 'no-sub' ) : ?>
 193  <div class="akismet-alert is-bad">
 194      <h3 class="akismet-alert__heading"><?php esc_html_e( 'You don&#8217;t have an Akismet plan.', 'akismet' ); ?></h3>
 195      <p>
 196          <?php
 197          /* translators: the placeholder is the URL to the Akismet pricing page. */
 198          echo wp_kses( sprintf( __( 'Please <a class="akismet-external-link" href="%s" target="_blank">choose a free or paid plan</a> so Akismet can protect your site from spam.', 'akismet' ), esc_url( 'https://akismet.com/pricing?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=choose_plan' ) ), $kses_allow_link );
 199          ?>
 200      </p>
 201      <p><?php echo esc_html__( 'Once you\'ve chosen a plan, return here to complete your setup.', 'akismet' ); ?></p>
 202  </div>
 203  
 204  <?php elseif ( $type === 'new-key-valid' ) : ?>
 205      <?php
 206      global $wpdb;
 207  
 208      $check_pending_link = false;
 209  
 210      $at_least_one_comment_in_moderation = ! ! $wpdb->get_var( "SELECT comment_ID FROM {$wpdb->comments} WHERE comment_approved = '0' LIMIT 1" );
 211  
 212      if ( $at_least_one_comment_in_moderation ) {
 213          $check_pending_link = 'edit-comments.php?akismet_recheck=' . wp_create_nonce( 'akismet_recheck' );
 214      }
 215      ?>
 216      <div class="akismet-alert is-good">
 217          <p><?php esc_html_e( 'Akismet is now protecting your site from spam.', 'akismet' ); ?></p>
 218          <?php if ( $check_pending_link ) : ?>
 219              <p>
 220                  <?php
 221                  echo wp_kses(
 222                      sprintf(
 223                          /* translators: The placeholder is a URL for checking pending comments. */
 224                          __( 'Would you like to <a href="%s">check pending comments</a>?', 'akismet' ),
 225                          esc_url( $check_pending_link )
 226                      ),
 227                      $kses_allow_link
 228                  );
 229                  ?>
 230              </p>
 231          <?php endif; ?>
 232      </div>
 233  
 234  <?php elseif ( $type === 'new-key-invalid' ) : ?>
 235  <div class="akismet-alert is-bad">
 236      <p><?php esc_html_e( 'The key you entered is invalid. Please double-check it.', 'akismet' ); ?></p>
 237  </div>
 238  
 239  <?php elseif ( $type === Akismet_Admin::NOTICE_EXISTING_KEY_INVALID ) : ?>
 240  <div class="akismet-alert is-bad">
 241      <h3 class="akismet-alert__heading"><?php echo esc_html( __( 'Your API key is no longer valid.', 'akismet' ) ); ?></h3>
 242      <p>
 243          <?php
 244          echo wp_kses(
 245              sprintf(
 246                  /* translators: The placeholder is a URL to the Akismet contact form. */
 247                  __( 'Please enter a new key or <a class="akismet-external-link" href="%s" target="_blank">contact Akismet support</a>', 'akismet' ),
 248                  'https://akismet.com/contact/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=support_invalid_key'
 249              ),
 250              $kses_allow_link
 251          );
 252          ?>
 253      </p>
 254  </div>
 255  
 256  <?php elseif ( $type === 'new-key-failed' ) : ?>
 257  <div class="akismet-alert is-bad">
 258      <h3 class="akismet-alert__heading"><?php esc_html_e( 'The API key you entered could not be verified.', 'akismet' ); ?></h3>
 259      <p>
 260          <?php
 261          echo wp_kses(
 262              sprintf(
 263                  /* translators: The placeholder is a URL. */
 264                  __( 'The connection to akismet.com could not be established. Please refer to <a class="akismet-external-link" href="%s" target="_blank">our guide about firewalls</a> and check your server configuration.', 'akismet' ),
 265                  'https://akismet.com/akismet-hosting-faq/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=hosting_faq'
 266              ),
 267              $kses_allow_link
 268          );
 269          ?>
 270      </p>
 271  </div>
 272  
 273  <?php elseif ( $type === 'usage-limit' && isset( Akismet::$limit_notices[ $code ] ) ) : ?>
 274  <div class="error akismet-usage-limit-alert">
 275      <div class="akismet-usage-limit-logo">
 276          <img src="<?php echo esc_url( plugins_url( '../_inc/img/logo-a-2x.png', __FILE__ ) ); ?>" alt="Akismet logo" />
 277      </div>
 278      <div class="akismet-usage-limit-text">
 279          <h3>
 280          <?php
 281          switch ( Akismet::$limit_notices[ $code ] ) {
 282              case 'FIRST_MONTH_OVER_LIMIT':
 283              case 'SECOND_MONTH_OVER_LIMIT':
 284                  esc_html_e( 'Your Akismet account usage is over your plan&#8217;s limit', 'akismet' );
 285                  break;
 286              case 'THIRD_MONTH_APPROACHING_LIMIT':
 287                  esc_html_e( 'Your Akismet account usage is approaching your plan&#8217;s limit', 'akismet' );
 288                  break;
 289              case 'THIRD_MONTH_OVER_LIMIT':
 290              case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
 291                  esc_html_e( 'Your account has been restricted', 'akismet' );
 292                  break;
 293              default:
 294          }
 295          ?>
 296          </h3>
 297          <p>
 298          <?php
 299          switch ( Akismet::$limit_notices[ $code ] ) {
 300              case 'FIRST_MONTH_OVER_LIMIT':
 301                  echo esc_html(
 302                      sprintf(
 303                          /* translators: The first placeholder is a date, the second is a (formatted) number, the third is another formatted number. */
 304                          __( 'Since %1$s, your account made %2$s API calls, compared to your plan&#8217;s limit of %3$s.', 'akismet' ),
 305                          esc_html( gmdate( 'F' ) . ' 1' ),
 306                          number_format( $api_calls ),
 307                          number_format( $usage_limit )
 308                      )
 309                  );
 310                  echo '&nbsp;';
 311                  echo '<a class="akismet-external-link" href="https://akismet.com/support/general/akismet-api-usage-limits/?utm_source=akismet_plugin&amp;utm_campaign=plugin_static_link&amp;utm_medium=in_plugin&amp;utm_content=usage_limit_docs" target="_blank">';
 312                  echo esc_html( __( 'Learn more about usage limits', 'akismet' ) );
 313                  echo '</a>';
 314  
 315                  break;
 316              case 'SECOND_MONTH_OVER_LIMIT':
 317                  echo esc_html( __( 'Your Akismet usage has been over your plan&#8217;s limit for two consecutive months. Next month, we will restrict your account after you reach the limit. Increase your limit to make sure your site stays protected from spam.', 'akismet' ) );
 318                  echo '&nbsp;';
 319                  echo '<a class="akismet-external-link" href="https://akismet.com/support/general/akismet-api-usage-limits/?utm_source=akismet_plugin&amp;utm_campaign=plugin_static_link&amp;utm_medium=in_plugin&amp;utm_content=usage_limit_docs" target="_blank">';
 320                  echo esc_html( __( 'Learn more about usage limits', 'akismet' ) );
 321                  echo '</a>';
 322  
 323                  break;
 324              case 'THIRD_MONTH_APPROACHING_LIMIT':
 325                  echo esc_html( __( 'Your Akismet usage is nearing your plan&#8217;s limit for the third consecutive month. We will restrict your account after you reach the limit. Increase your limit to make sure your site stays protected from spam.', 'akismet' ) );
 326                  echo '&nbsp;';
 327                  echo '<a class="akismet-external-link" href="https://akismet.com/support/general/akismet-api-usage-limits/?utm_source=akismet_plugin&amp;utm_campaign=plugin_static_link&amp;utm_medium=in_plugin&amp;utm_content=usage_limit_docs" target="_blank">';
 328                  echo esc_html( __( 'Learn more about usage limits', 'akismet' ) );
 329                  echo '</a>';
 330  
 331                  break;
 332              case 'THIRD_MONTH_OVER_LIMIT':
 333              case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
 334                  echo esc_html( __( 'Your Akismet usage has been over your plan&#8217;s limit for three consecutive months. We have restricted your account for the rest of the month. Increase your limit to make sure your site stays protected from spam.', 'akismet' ) );
 335                  echo '&nbsp;';
 336                  echo '<a class="akismet-external-link" href="https://akismet.com/support/general/akismet-api-usage-limits/?utm_source=akismet_plugin&amp;utm_campaign=plugin_static_link&amp;utm_medium=in_plugin&amp;utm_content=usage_limit_docs" target="_blank">';
 337                  echo esc_html( __( 'Learn more about usage limits', 'akismet' ) );
 338                  echo '</a>';
 339  
 340                  break;
 341  
 342              default:
 343          }
 344          ?>
 345          </p>
 346      </div>
 347      <div class="akismet-usage-limit-cta">
 348          <a href="<?php echo esc_attr( $upgrade_url . ( strpos( $upgrade_url, '?' ) !== false ? '&' : '?' ) . 'utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=usage_limit_upgrade' ); ?>" class="button" target="_blank">
 349              <?php
 350              if ( isset( $upgrade_via_support ) && $upgrade_via_support ) {
 351                  // Direct user to contact support.
 352                  esc_html_e( 'Contact Akismet support', 'akismet' );
 353              } elseif ( ! empty( $upgrade_type ) && 'qty' === $upgrade_type ) {
 354                  // If a qty upgrade is required, use recommended plan name if available.
 355                  if ( ! empty( $recommended_plan_name ) && is_string( $recommended_plan_name ) ) {
 356                      echo esc_html(
 357                          sprintf(
 358                              /* translators: The placeholder is the name of an Akismet subscription plan, like "Akismet Pro" or "Akismet Business" . */
 359                              __( 'Add an %s subscription', 'akismet' ),
 360                              $recommended_plan_name
 361                          )
 362                      );
 363                  } else {
 364                      esc_html_e( 'Increase your limit', 'akismet' );
 365                  }
 366              } else {
 367                  echo esc_html(
 368                      sprintf(
 369                          /* translators: The placeholder is the name of a subscription level, like "Akismet Business" or "Akismet Enterprise" . */
 370                          __( 'Upgrade to %s', 'akismet' ),
 371                          $upgrade_plan
 372                      )
 373                  );
 374              }
 375              ?>
 376          </a>
 377      </div>
 378  </div>
 379  <?php endif; ?>


Generated : Wed Apr 15 08:20:10 2026 Cross-referenced by PHPXref