[ 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      <div class="akismet-masthead">
  13          <div class="akismet-masthead__inside-container">
  14              <?php Akismet::view( 'logo' ); ?>
  15          </div>
  16      </div>
  17      <div class="akismet-lower">
  18          <?php if ( Akismet::get_api_key() ) { ?>
  19              <?php Akismet_Admin::display_status(); ?>
  20          <?php } ?>
  21          <?php if ( ! empty( $notices ) ) { ?>
  22              <?php foreach ( $notices as $notice ) { ?>
  23                  <?php Akismet::view( 'notice', $notice ); ?>
  24              <?php } ?>
  25          <?php } ?>
  26  
  27          <div class="akismet-card">
  28              <div class="akismet-section-header">
  29                  <h2 class="akismet-section-header__label">
  30                      <span><?php esc_html_e( 'Statistics', 'akismet' ); ?></span>
  31                  </h2>
  32  
  33              <?php if ( $stat_totals && isset( $stat_totals['all'] ) && (int) $stat_totals['all']->spam > 0 ) : ?>
  34                  <div class="akismet-section-header__actions">
  35                      <a href="<?php echo esc_url( Akismet_Admin::get_page_url( 'stats' ) ); ?>">
  36                          <?php esc_html_e( 'Detailed stats', 'akismet' ); ?>
  37                      </a>
  38                  </div>
  39              </div> <!-- close akismet-section-header -->
  40  
  41                  <div class="akismet-new-snapshot">
  42                      <?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 */ ?>
  43                      <div class="akismet-new-snapshot__chart">
  44                          <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>
  45                      </div>
  46                      <ul class="akismet-new-snapshot__list">
  47                          <li class="akismet-new-snapshot__item">
  48                              <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Past six months', 'akismet' ); ?></h3>
  49                              <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['6-months']->spam ); ?></span>
  50                              <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['6-months']->spam, 'akismet' ) ); ?></span>
  51                          </li>
  52                          <li class="akismet-new-snapshot__item">
  53                              <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'All time', 'akismet' ); ?></h3>
  54                              <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['all']->spam ); ?></span>
  55                              <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['all']->spam, 'akismet' ) ); ?></span>
  56                          </li>
  57                          <li class="akismet-new-snapshot__item">
  58                              <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Accuracy', 'akismet' ); ?></h3>
  59                              <span class="akismet-new-snapshot__number"><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span>
  60                              <span class="akismet-new-snapshot__text">
  61                              <?php
  62                              /* translators: %s: number of spam missed by Akismet */
  63                              echo esc_html( sprintf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ) ) . ', ';
  64                              /* translators: %s: number of false positive spam flagged by Akismet */
  65                              echo esc_html( sprintf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ) );
  66                              ?>
  67                              </span>
  68                          </li>
  69                      </ul>
  70                  </div> <!-- close akismet-new-snapshot -->
  71  
  72              <?php else : ?>
  73              </div> <!-- close akismet-section-header -->
  74              <div class="inside">
  75                  <p class="akismet-awaiting-stats"><?php esc_html_e( 'Akismet is active and ready to stop spam. Your site&#8217;s spam statistics will be displayed here.', 'akismet' ); ?></p>
  76              </div>
  77              <?php endif; ?>
  78  
  79          </div> <!-- close akismet-card -->
  80  
  81          <?php if ( $akismet_user ) : ?>
  82              <div class="akismet-card">
  83                  <div class="akismet-section-header">
  84                      <h2 class="akismet-section-header__label">
  85                          <span><?php esc_html_e( 'Settings', 'akismet' ); ?></span>
  86                      </h2>
  87                  </div>
  88  
  89                  <div class="inside">
  90                      <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" autocomplete="off" method="POST" id="akismet-settings-form">
  91  
  92                          <div class="akismet-settings">
  93                              <?php if ( ! Akismet::predefined_api_key() ) : ?>
  94                                  <div class="akismet-settings__row">
  95                                      <h3 class="akismet-settings__row-title">
  96                                          <label class="akismet-settings__row-label" for="key"><?php esc_html_e( 'API key', 'akismet' ); ?></label>
  97                                      </h3>
  98                                      <div class="akismet-settings__row-input">
  99                                          <span class="api-key"><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 ); ?>"></span>
 100                                      </div>
 101                                  </div>
 102                              <?php endif; ?>
 103  
 104                              <?php
 105                              //phpcs:ignore WordPress.Security.NonceVerification.Recommended
 106                              if ( isset( $_GET['ssl_status'] ) ) :
 107                                  ?>
 108                                  <div class="akismet-settings__row">
 109                                      <div class="akismet-settings__row-text">
 110                                          <h3 class="akismet-settings__row-title"><?php esc_html_e( 'SSL status', 'akismet' ); ?></h3>
 111                                          <div class="akismet-settings__row-description">
 112                                              <?php if ( ! wp_http_supports( array( 'ssl' ) ) ) : ?>
 113                                                  <strong><?php esc_html_e( 'Disabled.', 'akismet' ); ?></strong>
 114                                                  <?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' ); ?>
 115                                              <?php else : ?>
 116                                                  <?php $ssl_disabled = get_option( 'akismet_ssl_disabled' ); ?>
 117  
 118                                                  <?php if ( $ssl_disabled ) : ?>
 119                                                      <strong><?php esc_html_e( 'Temporarily disabled.', 'akismet' ); ?></strong>
 120                                                      <?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' ); ?>
 121                                                  <?php else : ?>
 122                                                      <strong><?php esc_html_e( 'Enabled.', 'akismet' ); ?></strong>
 123                                                      <?php esc_html_e( 'All systems functional.', 'akismet' ); ?>
 124                                                  <?php endif; ?>
 125                                              <?php endif; ?>
 126                                          </div>
 127                                      </div>
 128                                  </div>
 129                              <?php endif; ?>
 130  
 131                              <div class="akismet-settings__row">
 132                                  <div class="akismet-settings__row-text">
 133                                      <h3 class="akismet-settings__row-title"><?php esc_html_e( 'Comments', 'akismet' ); ?></h3>
 134                                  </div>
 135                                  <div class="akismet-settings__row-input">
 136                                      <label class="akismet-settings__row-input-label" for="akismet_show_user_comments_approved">
 137                                          <input
 138                                          name="akismet_show_user_comments_approved"
 139                                          id="akismet_show_user_comments_approved"
 140                                          value="1"
 141                                          type="checkbox"
 142                                          <?php
 143                                          // 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.
 144                                          checked( true, ( in_array( get_option( 'akismet_show_user_comments_approved' ), array( false, '1', 'true' ), true ) ) );
 145                                          ?>
 146                                          />
 147                                          <span class="akismet-settings__row-label-text">
 148                                              <?php esc_html_e( 'Show the number of approved comments beside each comment author.', 'akismet' ); ?>
 149                                          </span>
 150                                      </label>
 151                                  </div>
 152                              </div>
 153  
 154                              <div class="akismet-settings__row is-radio">
 155                                  <div class="akismet-settings__row-text">
 156                                      <h3 class="akismet-settings__row-title"><?php esc_html_e( 'Spam filtering', 'akismet' ); ?></h3>
 157                                  </div>
 158                                  <div class="akismet-settings__row-input">
 159                                      <fieldset>
 160                                          <legend class="screen-reader-text">
 161                                              <span><?php esc_html_e( 'Akismet Anti-spam strictness', 'akismet' ); ?></span>
 162                                          </legend>
 163                                          <div>
 164                                              <label class="akismet-settings__row-input-label" for="akismet_strictness_1">
 165                                                  <input type="radio" name="akismet_strictness" id="akismet_strictness_1" value="1" <?php checked( '1', get_option( 'akismet_strictness' ) ); ?> />
 166                                                  <span class="akismet-settings__row-label-text">
 167                                                      <?php esc_html_e( 'Silently discard the worst and most pervasive spam so I never see it.', 'akismet' ); ?>
 168                                                  </span>
 169                                              </label>
 170                                          </div>
 171                                          <div>
 172                                              <label class="akismet-settings__row-input-label" for="akismet_strictness_0">
 173                                                  <input type="radio" name="akismet_strictness" id="akismet_strictness_0" value="0" <?php checked( '0', get_option( 'akismet_strictness' ) ); ?> />
 174                                                  <span class="akismet-settings__row-label-text">
 175                                                      <?php esc_html_e( 'Always put spam in the Spam folder for review.', 'akismet' ); ?>
 176                                                  </span>
 177                                              </label>
 178                                          </div>
 179                                      </fieldset>
 180  
 181                                      <div class="akismet-settings__row-note">
 182                                          <strong><?php esc_html_e( 'Note:', 'akismet' ); ?></strong>
 183                                          <?php
 184                                          $delete_interval = max( 1, intval( apply_filters( 'akismet_delete_comment_interval', 15 ) ) );
 185  
 186                                          $spam_folder_link = sprintf(
 187                                              '<a href="%s">%s</a>',
 188                                              esc_url( admin_url( 'edit-comments.php?comment_status=spam' ) ),
 189                                              esc_html__( 'spam folder', 'akismet' )
 190                                          );
 191  
 192                                          // The _n() needs to be on one line so the i18n tooling can extract the translator comment.
 193                                          /* translators: %1$s: spam folder link, %2$d: delete interval in days */
 194                                          $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' );
 195  
 196                                          printf(
 197                                              wp_kses( $delete_message, $kses_allow_link_href ),
 198                                              wp_kses( $spam_folder_link, $kses_allow_link_href ),
 199                                              esc_html( $delete_interval )
 200                                          );
 201                                          ?>
 202                                      </div>
 203                                  </div>
 204                              </div>
 205  
 206                              <div class="akismet-settings__row is-radio">
 207                                  <div class="akismet-settings__row-text">
 208                                      <h3 class="akismet-settings__row-title"><?php esc_html_e( 'Privacy', 'akismet' ); ?></h3>
 209                                  </div>
 210                                  <div class="akismet-settings__row-input">
 211                                      <fieldset>
 212                                          <legend class="screen-reader-text">
 213                                              <span><?php esc_html_e( 'Akismet privacy notice', 'akismet' ); ?></span>
 214                                          </legend>
 215                                          <div>
 216                                              <label class="akismet-settings__row-input-label" for="akismet_comment_form_privacy_notice_display">
 217                                                  <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' ) ); ?> />
 218                                                  <span class="akismet-settings__row-label-text">
 219                                                      <?php esc_html_e( 'Display a privacy notice under your comment forms.', 'akismet' ); ?>
 220                                                  </span>
 221                                              </label>
 222                                          </div>
 223                                          <div>
 224                                              <label class="akismet-settings__row-input-label" for="akismet_comment_form_privacy_notice_hide">
 225                                                  <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"'; ?> />
 226                                                  <span class="akismet-settings__row-label-text">
 227                                                      <?php esc_html_e( 'Do not display privacy notice.', 'akismet' ); ?>
 228                                                  </span>
 229                                              </label>
 230                                          </div>
 231                                      </fieldset>
 232  
 233                                      <div class="akismet-settings__row-note">
 234                                          <?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' ); ?>
 235                                      </div>
 236                                  </div>
 237                              </div>
 238                          </div>
 239  
 240                          <div class="akismet-card-actions">
 241                              <?php if ( ! Akismet::predefined_api_key() ) : ?>
 242                                  <div id="delete-action" class="akismet-card-actions__secondary-action">
 243                                      <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>
 244                                  </div>
 245                              <?php endif; ?>
 246  
 247                              <?php wp_nonce_field( Akismet_Admin::NONCE ); ?>
 248  
 249                              <div id="publishing-action">
 250                                  <input type="hidden" name="action" value="enter-key">
 251                                  <input type="submit" name="submit" id="submit" class="akismet-button akismet-could-be-primary" value="<?php esc_attr_e( 'Save changes', 'akismet' ); ?>">
 252                              </div>
 253                          </div>
 254                      </form>
 255                  </div>
 256              </div>
 257  
 258              <?php if ( ! Akismet::predefined_api_key() ) : ?>
 259                  <div class="akismet-card">
 260                      <div class="akismet-section-header">
 261                          <h2 class="akismet-section-header__label">
 262                              <span><?php esc_html_e( 'Account', 'akismet' ); ?></span>
 263                          </h2>
 264                      </div>
 265  
 266                      <div class="inside">
 267                          <table class="akismet-account">
 268                              <tbody>
 269                                  <tr>
 270                                      <th scope="row"><?php esc_html_e( 'Subscription type', 'akismet' ); ?></th>
 271                                      <td>
 272                                          <?php echo esc_html( $akismet_user->account_name ); ?>
 273                                      </td>
 274                                  </tr>
 275                                  <tr>
 276                                      <th scope="row"><?php esc_html_e( 'Status', 'akismet' ); ?></th>
 277                                      <td>
 278                                          <?php
 279                                          if ( 'cancelled' === $akismet_user->status ) :
 280                                              esc_html_e( 'Cancelled', 'akismet' );
 281                                          elseif ( 'suspended' === $akismet_user->status ) :
 282                                              esc_html_e( 'Suspended', 'akismet' );
 283                                          elseif ( 'missing' === $akismet_user->status ) :
 284                                              esc_html_e( 'Missing', 'akismet' );
 285                                          elseif ( 'no-sub' === $akismet_user->status ) :
 286                                              esc_html_e( 'No subscription found', 'akismet' );
 287                                          else :
 288                                              esc_html_e( 'Active', 'akismet' );
 289                                          endif;
 290                                          ?>
 291                                      </td>
 292                                  </tr>
 293                                  <?php if ( $akismet_user->next_billing_date ) : ?>
 294                                  <tr>
 295                                      <th scope="row"><?php esc_html_e( 'Next billing date', 'akismet' ); ?></th>
 296                                      <td>
 297                                          <?php echo esc_html( gmdate( 'F j, Y', $akismet_user->next_billing_date ) ); ?>
 298                                      </td>
 299                                  </tr>
 300                                  <?php endif; ?>
 301                              </tbody>
 302                          </table>
 303                          <div class="akismet-card-actions">
 304                              <?php if ( $akismet_user->status === 'active' ) : ?>
 305                                  <div class="akismet-card-actions__secondary-action">
 306                                      <a href="https://akismet.com/account" target="_blank" rel="noopener noreferrer" aria-label="Account overview on akismet.com (opens in a new window)"><?php esc_html_e( 'Account overview', 'akismet' ); ?></a>
 307                                  </div>
 308                              <?php endif; ?>
 309                              <div id="publishing-action">
 310                                  <?php
 311                                  Akismet::view(
 312                                      'get',
 313                                      array(
 314                                          'text'     => ( $akismet_user->account_type === 'free-api-key' && $akismet_user->status === 'active' ? __( 'Upgrade', 'akismet' ) : __( 'Change', 'akismet' ) ),
 315                                          'redirect' => 'upgrade',
 316                                      )
 317                                  );
 318                                  ?>
 319                              </div>
 320                          </div>
 321                      </div>
 322                  </div>
 323              <?php endif; ?>
 324          <?php endif; ?>
 325      </div>
 326  </div>


Generated : Mon Mar 18 08:20:01 2024 Cross-referenced by PHPXref