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