[ 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>
 156          <?php
 157          /* translators: the placeholder is a clickable URL to the Akismet account upgrade page. */
 158          echo wp_kses( sprintf( __( 'In 2012, Akismet began using subscription plans for all accounts (even free ones). A plan has not been assigned to your account, and we&#8217;d appreciate it if you&#8217;d <a href="%s" target="_blank">sign into your account</a> and choose one.', 'akismet' ), esc_url( 'https://akismet.com/pricing' ) ), $kses_allow_link );
 159          ?>
 160          <br /><br />
 161          <?php
 162          /* translators: The placeholder is a URL to the Akismet contact form. */
 163          echo wp_kses( sprintf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), esc_url( 'https://akismet.com/contact/' ) ), $kses_allow_link );
 164          ?>
 165      </p>
 166  </div>
 167  
 168  <?php elseif ( $type === 'new-key-valid' ) : ?>
 169      <?php
 170      global $wpdb;
 171  
 172      $check_pending_link = false;
 173  
 174      $at_least_one_comment_in_moderation = ! ! $wpdb->get_var( "SELECT comment_ID FROM {$wpdb->comments} WHERE comment_approved = '0' LIMIT 1" );
 175  
 176      if ( $at_least_one_comment_in_moderation ) {
 177          $check_pending_link = 'edit-comments.php?akismet_recheck=' . wp_create_nonce( 'akismet_recheck' );
 178      }
 179      ?>
 180      <div class="akismet-alert is-good">
 181          <p><?php esc_html_e( 'Akismet is now protecting your site from spam.', 'akismet' ); ?></p>
 182          <?php if ( $check_pending_link ) : ?>
 183              <p>
 184                  <?php
 185                  echo wp_kses(
 186                      sprintf(
 187                          /* translators: The placeholder is a URL for checking pending comments. */
 188                          __( 'Would you like to <a href="%s">check pending comments</a>?', 'akismet' ),
 189                          esc_url( $check_pending_link )
 190                      ),
 191                      $kses_allow_link
 192                  );
 193                  ?>
 194              </p>
 195          <?php endif; ?>
 196      </div>
 197  
 198  <?php elseif ( $type === 'new-key-invalid' ) : ?>
 199  <div class="akismet-alert is-bad">
 200      <p><?php esc_html_e( 'The key you entered is invalid. Please double-check it.', 'akismet' ); ?></p>
 201  </div>
 202  
 203  <?php elseif ( $type === 'existing-key-invalid' ) : ?>
 204  <div class="akismet-alert is-bad">
 205      <h3 class="akismet-alert__heading"><?php echo esc_html( __( 'Your API key is no longer valid.', 'akismet' ) ); ?></h3>
 206      <p>
 207          <?php
 208          echo wp_kses(
 209              sprintf(
 210                  /* translators: The placeholder is a URL to the Akismet contact form. */
 211                  __( 'Please enter a new key or <a href="%s" target="_blank">contact Akismet support</a>.', 'akismet' ),
 212                  'https://akismet.com/contact/'
 213              ),
 214              $kses_allow_link
 215          );
 216          ?>
 217      </p>
 218  </div>
 219  
 220  <?php elseif ( $type === 'new-key-failed' ) : ?>
 221  <div class="akismet-alert is-bad">
 222      <h3 class="akismet-alert__heading"><?php esc_html_e( 'The API key you entered could not be verified.', 'akismet' ); ?></h3>
 223      <p>
 224          <?php
 225          echo wp_kses(
 226              sprintf(
 227                  /* translators: The placeholder is a URL. */
 228                  __( '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' ),
 229                  'https://blog.akismet.com/akismet-hosting-faq/'
 230              ),
 231              $kses_allow_link
 232          );
 233          ?>
 234      </p>
 235  </div>
 236  
 237  <?php elseif ( $type === 'usage-limit' && isset( Akismet::$limit_notices[ $code ] ) ) : ?>
 238  <div class="error akismet-usage-limit-alert">
 239      <div class="akismet-usage-limit-logo">
 240          <img src="<?php echo esc_url( plugins_url( '../_inc/img/logo-a-2x.png', __FILE__ ) ); ?>" alt="Akismet logo" />
 241      </div>
 242      <div class="akismet-usage-limit-text">
 243          <h3>
 244          <?php
 245          switch ( Akismet::$limit_notices[ $code ] ) {
 246              case 'FIRST_MONTH_OVER_LIMIT':
 247              case 'SECOND_MONTH_OVER_LIMIT':
 248                  esc_html_e( 'Your Akismet account usage is over your plan&#8217;s limit', 'akismet' );
 249                  break;
 250              case 'THIRD_MONTH_APPROACHING_LIMIT':
 251                  esc_html_e( 'Your Akismet account usage is approaching your plan&#8217;s limit', 'akismet' );
 252                  break;
 253              case 'THIRD_MONTH_OVER_LIMIT':
 254              case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
 255                  esc_html_e( 'Your account has been restricted', 'akismet' );
 256                  break;
 257              default:
 258          }
 259          ?>
 260          </h3>
 261          <p>
 262          <?php
 263          switch ( Akismet::$limit_notices[ $code ] ) {
 264              case 'FIRST_MONTH_OVER_LIMIT':
 265                  echo esc_html(
 266                      sprintf(
 267                          /* translators: The first placeholder is a date, the second is a (formatted) number, the third is another formatted number. */
 268                          __( 'Since %1$s, your account made %2$s API calls, compared to your plan&#8217;s limit of %3$s.', 'akismet' ),
 269                          esc_html( gmdate( 'F' ) . ' 1' ),
 270                          number_format( $api_calls ),
 271                          number_format( $usage_limit )
 272                      )
 273                  );
 274                  echo '&nbsp;';
 275                  echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
 276                  echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
 277                  echo '</a>';
 278  
 279                  break;
 280              case 'SECOND_MONTH_OVER_LIMIT':
 281                  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' ) );
 282                  echo '&nbsp;';
 283                  echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
 284                  echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
 285                  echo '</a>';
 286  
 287                  break;
 288              case 'THIRD_MONTH_APPROACHING_LIMIT':
 289                  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' ) );
 290                  echo '&nbsp;';
 291                  echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
 292                  echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
 293                  echo '</a>';
 294  
 295                  break;
 296              case 'THIRD_MONTH_OVER_LIMIT':
 297              case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
 298                  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' ) );
 299                  echo '&nbsp;';
 300                  echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
 301                  echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
 302                  echo '</a>';
 303  
 304                  break;
 305  
 306              default:
 307          }
 308          ?>
 309          </p>
 310      </div>
 311      <div class="akismet-usage-limit-cta">
 312          <a href="<?php echo esc_attr( $upgrade_url ); ?>" class="button" target="_blank">
 313              <?php
 314              // If only a qty upgrade is required, show a more generic message.
 315              if ( ! empty( $upgrade_type ) && 'qty' === $upgrade_type ) {
 316                  esc_html_e( 'Upgrade your subscription level', 'akismet' );
 317              } else {
 318                  echo esc_html(
 319                      sprintf(
 320                          /* translators: The placeholder is the name of a subscription level, like "Plus" or "Enterprise" . */
 321                          __( 'Upgrade to %s', 'akismet' ),
 322                          $upgrade_plan
 323                      )
 324                  );
 325              }
 326              ?>
 327          </a>
 328      </div>
 329  </div>
 330  <?php endif; ?>


Generated : Tue Mar 19 08:20:01 2024 Cross-referenced by PHPXref