[ 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      ),
   9  );
  10  $kses_allow_strong = array( 'strong' => true );
  11  
  12  /*
  13   * Some notices (plugin, spam-check, spam-check-cron-disabled, alert and usage-limit) are shown elsewhere in wp-admin,
  14   * so look different to the standard notices.
  15   */
  16  ?>
  17  <?php if ( $type === 'plugin' ) : ?>
  18  <div class="updated" id="akismet_setup_prompt">
  19      <form name="akismet_activate" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
  20          <div class="akismet_activate">
  21              <div class="aa_a">A</div>
  22              <div class="aa_button_container">
  23                  <div class="aa_button_border">
  24                      <input type="submit" class="aa_button" value="<?php esc_attr_e( 'Set up your Akismet account', 'akismet' ); ?>" />
  25                  </div>
  26              </div>
  27              <div class="aa_description">
  28                  <?php
  29                  echo wp_kses(
  30                      __( '<strong>Almost done</strong> - configure Akismet and say goodbye to spam', 'akismet' ),
  31                      $kses_allow_strong
  32                  );
  33                  ?>
  34              </div>
  35          </div>
  36      </form>
  37  </div>
  38  
  39  <?php elseif ( $type === 'spam-check' ) : ?>
  40  <div class="notice notice-warning">
  41      <p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' ); ?></strong></p>
  42      <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>
  43      <?php if ( $link_text ) : ?>
  44          <p><?php echo wp_kses( $link_text, $kses_allow_link ); ?></p>
  45      <?php endif; ?>
  46  </div>
  47  
  48  <?php elseif ( $type === 'spam-check-cron-disabled' ) : ?>
  49  <div class="notice notice-warning">
  50      <p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' ); ?></strong></p>
  51      <p><?php esc_html_e( 'WP-Cron has been disabled using the DISABLE_WP_CRON constant. Comment rechecks may not work properly.', 'akismet' ); ?></p>
  52  </div>
  53  
  54  <?php elseif ( $type === 'alert' ) : ?>
  55  <div class="error">
  56      <?php /* translators: The placeholder is an error code returned by Akismet. */ ?>
  57      <p><strong><?php printf( esc_html__( 'Akismet error code: %s', 'akismet' ), esc_html( $code ) ); ?></strong></p>
  58      <p><?php echo esc_html( $msg ); ?></p>
  59      <p>
  60          <?php
  61          /* translators: the placeholder is a clickable URL that leads to more information regarding an error code. */
  62          printf( esc_html__( 'For more information: %s', 'akismet' ), '<a href="https://akismet.com/errors/' . esc_attr( $code ) . '">https://akismet.com/errors/' . esc_attr( $code ) . '</a>' );
  63          ?>
  64      </p>
  65  </div>
  66  
  67  <?php elseif ( $type === 'notice' ) : ?>
  68  <div class="akismet-alert is-bad">
  69      <h3 class="akismet-alert__heading"><?php echo wp_kses( $notice_header, Akismet_Admin::get_notice_kses_allowed_elements() ); ?></h3>
  70      <p>
  71          <?php echo wp_kses( $notice_text, Akismet_Admin::get_notice_kses_allowed_elements() ); ?>
  72      </p>
  73  </div>
  74  
  75  <?php elseif ( $type === 'missing-functions' ) : ?>
  76  <div class="akismet-alert is-bad">
  77      <h3 class="akismet-alert__heading"><?php esc_html_e( 'Network functions are disabled.', 'akismet' ); ?></h3>
  78      <p>
  79          <?php
  80          /* translators: The placeholder is a URL. */
  81          echo wp_kses( sprintf( __( 'Your web host or server administrator has disabled PHP&#8217;s <code>gethostbynamel</code> function.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet&#8217;s system requirements</a>.', 'akismet' ), esc_url( 'https://akismet.com/akismet-hosting-faq/' ) ), array_merge( $kses_allow_link, $kses_allow_strong, array( 'code' => true ) ) );
  82          ?>
  83      </p>
  84  </div>
  85  
  86  <?php elseif ( $type === 'servers-be-down' ) : ?>
  87  <div class="akismet-alert is-bad">
  88      <h3 class="akismet-alert__heading"><?php esc_html_e( 'Your site can&#8217;t connect to the Akismet servers.', 'akismet' ); ?></h3>
  89      <p>
  90      <?php
  91          /* translators: The placeholder is a URL. */
  92          echo wp_kses( sprintf( __( 'Your firewall may be blocking Akismet from connecting to its API. Please contact your host and refer to <a href="%s" target="_blank">our guide about firewalls</a>.', 'akismet' ), esc_url( 'https://akismet.com/akismet-hosting-faq/' ) ), $kses_allow_link );
  93      ?>
  94      </p>
  95  </div>
  96  
  97  <?php elseif ( $type === 'active-dunning' ) : ?>
  98  <div class="akismet-alert is-bad">
  99      <h3 class="akismet-alert__heading"><?php esc_html_e( 'Please update your payment information.', 'akismet' ); ?></h3>
 100      <p>
 101          <?php
 102          /* translators: The placeholder is a URL. */
 103          echo wp_kses( sprintf( __( 'We cannot process your payment. Please <a href="%s" target="_blank">update your payment details</a>.', 'akismet' ), esc_url( 'https://akismet.com/account/' ) ), $kses_allow_link );
 104          ?>
 105      </p>
 106  </div>
 107  
 108  <?php elseif ( $type === 'cancelled' ) : ?>
 109  <div class="akismet-alert is-bad">
 110      <h3 class="akismet-alert__heading"><?php esc_html_e( 'Your Akismet plan has been cancelled.', 'akismet' ); ?></h3>
 111      <p>
 112          <?php
 113          /* translators: The placeholder is a URL. */
 114          echo wp_kses( sprintf( __( 'Please visit your <a href="%s" target="_blank">Akismet account page</a> to reactivate your subscription.', 'akismet' ), esc_url( 'https://akismet.com/account/' ) ), $kses_allow_link );
 115          ?>
 116      </p>
 117  </div>
 118  
 119  <?php elseif ( $type === 'suspended' ) : ?>
 120  <div class="akismet-alert is-bad">
 121      <h3 class="akismet-alert__heading"><?php esc_html_e( 'Your Akismet subscription is suspended.', 'akismet' ); ?></h3>
 122      <p>
 123          <?php
 124          /* translators: The placeholder is a URL. */
 125          echo wp_kses( sprintf( __( 'Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet' ), esc_url( 'https://akismet.com/contact/' ) ), $kses_allow_link );
 126          ?>
 127      </p>
 128  </div>
 129  
 130  <?php elseif ( $type === 'active-notice' && $time_saved ) : ?>
 131  <div class="akismet-alert is-neutral">
 132      <h3 class="akismet-alert__heading"><?php echo esc_html( $time_saved ); ?></h3>
 133      <p>
 134          <?php
 135          /* translators: the placeholder is a clickable URL to the Akismet account upgrade page. */
 136          echo wp_kses( sprintf( __( 'You can help us fight spam and upgrade your account by <a href="%s" target="_blank">contributing a token amount</a>.', 'akismet' ), esc_url( 'https://akismet.com/pricing' ) ), $kses_allow_link );
 137          ?>
 138      </p>
 139  </div>
 140  
 141  <?php elseif ( $type === 'missing' ) : ?>
 142  <div class="akismet-alert is-bad">
 143      <h3 class="akismet-alert__heading"><?php esc_html_e( 'There is a problem with your API key.', 'akismet' ); ?></h3>
 144      <p>
 145          <?php
 146          /* translators: The placeholder is a URL to the Akismet contact form. */
 147          echo wp_kses( sprintf( __( 'Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet' ), esc_url( 'https://akismet.com/contact/' ) ), $kses_allow_link );
 148          ?>
 149      </p>
 150  </div>
 151  
 152  <?php elseif ( $type === 'no-sub' ) : ?>
 153  <div class="akismet-alert is-bad">
 154      <h3 class="akismet-alert__heading"><?php esc_html_e( 'You don&#8217;t have an Akismet plan.', 'akismet' ); ?></h3>
 155      <p><?php echo esc_html__( 'Your API key must have an Akismet plan before it can protect your site from spam.', 'akismet' ); ?></p>
 156      <p>
 157          <?php
 158          /* translators: the placeholder is the URL to the Akismet pricing page. */
 159          echo wp_kses( sprintf( __( 'Please <a href="%s" target="_blank">choose a plan</a> to get started with Akismet.', 'akismet' ), esc_url( 'https://akismet.com/pricing' ) ), $kses_allow_link );
 160          ?>
 161      </p>
 162  </div>
 163  
 164  <?php elseif ( $type === 'new-key-valid' ) : ?>
 165      <?php
 166      global $wpdb;
 167  
 168      $check_pending_link = false;
 169  
 170      $at_least_one_comment_in_moderation = ! ! $wpdb->get_var( "SELECT comment_ID FROM {$wpdb->comments} WHERE comment_approved = '0' LIMIT 1" );
 171  
 172      if ( $at_least_one_comment_in_moderation ) {
 173          $check_pending_link = 'edit-comments.php?akismet_recheck=' . wp_create_nonce( 'akismet_recheck' );
 174      }
 175      ?>
 176      <div class="akismet-alert is-good">
 177          <p><?php esc_html_e( 'Akismet is now protecting your site from spam.', 'akismet' ); ?></p>
 178          <?php if ( $check_pending_link ) : ?>
 179              <p>
 180                  <?php
 181                  echo wp_kses(
 182                      sprintf(
 183                          /* translators: The placeholder is a URL for checking pending comments. */
 184                          __( 'Would you like to <a href="%s">check pending comments</a>?', 'akismet' ),
 185                          esc_url( $check_pending_link )
 186                      ),
 187                      $kses_allow_link
 188                  );
 189                  ?>
 190              </p>
 191          <?php endif; ?>
 192      </div>
 193  
 194  <?php elseif ( $type === 'new-key-invalid' ) : ?>
 195  <div class="akismet-alert is-bad">
 196      <p><?php esc_html_e( 'The key you entered is invalid. Please double-check it.', 'akismet' ); ?></p>
 197  </div>
 198  
 199  <?php elseif ( $type === 'existing-key-invalid' ) : ?>
 200  <div class="akismet-alert is-bad">
 201      <h3 class="akismet-alert__heading"><?php echo esc_html( __( 'Your API key is no longer valid.', 'akismet' ) ); ?></h3>
 202      <p>
 203          <?php
 204          echo wp_kses(
 205              sprintf(
 206                  /* translators: The placeholder is a URL to the Akismet contact form. */
 207                  __( 'Please enter a new key or <a href="%s" target="_blank">contact Akismet support</a>.', 'akismet' ),
 208                  'https://akismet.com/contact/'
 209              ),
 210              $kses_allow_link
 211          );
 212          ?>
 213      </p>
 214  </div>
 215  
 216  <?php elseif ( $type === 'new-key-failed' ) : ?>
 217  <div class="akismet-alert is-bad">
 218      <h3 class="akismet-alert__heading"><?php esc_html_e( 'The API key you entered could not be verified.', 'akismet' ); ?></h3>
 219      <p>
 220          <?php
 221          echo wp_kses(
 222              sprintf(
 223                  /* translators: The placeholder is a URL. */
 224                  __( 'The connection to akismet.com could not be established. Please refer to <a href="%s" target="_blank">our guide about firewalls</a> and check your server configuration.', 'akismet' ),
 225                  'https://blog.akismet.com/akismet-hosting-faq/'
 226              ),
 227              $kses_allow_link
 228          );
 229          ?>
 230      </p>
 231  </div>
 232  
 233  <?php elseif ( $type === 'usage-limit' && isset( Akismet::$limit_notices[ $code ] ) ) : ?>
 234  <div class="error akismet-usage-limit-alert">
 235      <div class="akismet-usage-limit-logo">
 236          <img src="<?php echo esc_url( plugins_url( '../_inc/img/logo-a-2x.png', __FILE__ ) ); ?>" alt="Akismet logo" />
 237      </div>
 238      <div class="akismet-usage-limit-text">
 239          <h3>
 240          <?php
 241          switch ( Akismet::$limit_notices[ $code ] ) {
 242              case 'FIRST_MONTH_OVER_LIMIT':
 243              case 'SECOND_MONTH_OVER_LIMIT':
 244                  esc_html_e( 'Your Akismet account usage is over your plan&#8217;s limit', 'akismet' );
 245                  break;
 246              case 'THIRD_MONTH_APPROACHING_LIMIT':
 247                  esc_html_e( 'Your Akismet account usage is approaching your plan&#8217;s limit', 'akismet' );
 248                  break;
 249              case 'THIRD_MONTH_OVER_LIMIT':
 250              case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
 251                  esc_html_e( 'Your account has been restricted', 'akismet' );
 252                  break;
 253              default:
 254          }
 255          ?>
 256          </h3>
 257          <p>
 258          <?php
 259          switch ( Akismet::$limit_notices[ $code ] ) {
 260              case 'FIRST_MONTH_OVER_LIMIT':
 261                  echo esc_html(
 262                      sprintf(
 263                          /* translators: The first placeholder is a date, the second is a (formatted) number, the third is another formatted number. */
 264                          __( 'Since %1$s, your account made %2$s API calls, compared to your plan&#8217;s limit of %3$s.', 'akismet' ),
 265                          esc_html( gmdate( 'F' ) . ' 1' ),
 266                          number_format( $api_calls ),
 267                          number_format( $usage_limit )
 268                      )
 269                  );
 270                  echo '&nbsp;';
 271                  echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
 272                  echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
 273                  echo '</a>';
 274  
 275                  break;
 276              case 'SECOND_MONTH_OVER_LIMIT':
 277                  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. Please consider upgrading your plan.', 'akismet' ) );
 278                  echo '&nbsp;';
 279                  echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
 280                  echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
 281                  echo '</a>';
 282  
 283                  break;
 284              case 'THIRD_MONTH_APPROACHING_LIMIT':
 285                  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. Upgrade your plan so Akismet can continue blocking spam.', 'akismet' ) );
 286                  echo '&nbsp;';
 287                  echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
 288                  echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
 289                  echo '</a>';
 290  
 291                  break;
 292              case 'THIRD_MONTH_OVER_LIMIT':
 293              case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
 294                  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. Upgrade your plan so Akismet can continue blocking spam.', 'akismet' ) );
 295                  echo '&nbsp;';
 296                  echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
 297                  echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
 298                  echo '</a>';
 299  
 300                  break;
 301  
 302              default:
 303          }
 304          ?>
 305          </p>
 306      </div>
 307      <div class="akismet-usage-limit-cta">
 308          <a href="<?php echo esc_attr( $upgrade_url ); ?>" class="button" target="_blank">
 309              <?php
 310              // If only a qty upgrade is required, show a more generic message.
 311              if ( ! empty( $upgrade_type ) && 'qty' === $upgrade_type ) {
 312                  esc_html_e( 'Upgrade your subscription level', 'akismet' );
 313              } else {
 314                  echo esc_html(
 315                      sprintf(
 316                          /* translators: The placeholder is the name of a subscription level, like "Plus" or "Enterprise" . */
 317                          __( 'Upgrade to %s', 'akismet' ),
 318                          $upgrade_plan
 319                      )
 320                  );
 321              }
 322              ?>
 323          </a>
 324      </div>
 325  </div>
 326  <?php endif; ?>


Generated : Thu Apr 18 08:20:02 2024 Cross-referenced by PHPXref