| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
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’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’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’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 === 'cancelled' ) : ?> 138 <div class="akismet-alert is-bad"> 139 <h3 class="akismet-alert__heading"><?php esc_html_e( 'Your Akismet plan has been cancelled.', 'akismet' ); ?></h3> 140 <p> 141 <?php 142 /* translators: The placeholder is a URL. */ 143 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 ); 144 ?> 145 </p> 146 </div> 147 148 <?php elseif ( $type === 'suspended' ) : ?> 149 <div class="akismet-alert is-bad"> 150 <h3 class="akismet-alert__heading"><?php esc_html_e( 'Your Akismet subscription is suspended.', 'akismet' ); ?></h3> 151 <p> 152 <?php 153 /* translators: The placeholder is a URL. */ 154 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 ); 155 ?> 156 </p> 157 </div> 158 159 <?php elseif ( $type === 'active-notice' && $time_saved ) : ?> 160 <div class="akismet-alert is-neutral"> 161 <h3 class="akismet-alert__heading"><?php echo esc_html( $time_saved ); ?></h3> 162 <p> 163 <?php 164 /* translators: the placeholder is a clickable URL to the Akismet account upgrade page. */ 165 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 ); 166 ?> 167 </p> 168 </div> 169 170 <?php elseif ( $type === 'missing' ) : ?> 171 <div class="akismet-alert is-bad"> 172 <h3 class="akismet-alert__heading"><?php esc_html_e( 'There is a problem with your API key.', 'akismet' ); ?></h3> 173 <p> 174 <?php 175 /* translators: The placeholder is a URL to the Akismet contact form. */ 176 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 ); 177 ?> 178 </p> 179 </div> 180 181 <?php elseif ( $type === 'no-sub' ) : ?> 182 <div class="akismet-alert is-bad"> 183 <h3 class="akismet-alert__heading"><?php esc_html_e( 'You don’t have an Akismet plan.', 'akismet' ); ?></h3> 184 <p> 185 <?php 186 /* translators: the placeholder is the URL to the Akismet pricing page. */ 187 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 ); 188 ?> 189 </p> 190 <p><?php echo esc_html__( 'Once you\'ve chosen a plan, return here to complete your setup.', 'akismet' ); ?></p> 191 </div> 192 193 <?php elseif ( $type === 'new-key-valid' ) : ?> 194 <?php 195 global $wpdb; 196 197 $check_pending_link = false; 198 199 $at_least_one_comment_in_moderation = ! ! $wpdb->get_var( "SELECT comment_ID FROM {$wpdb->comments} WHERE comment_approved = '0' LIMIT 1" ); 200 201 if ( $at_least_one_comment_in_moderation ) { 202 $check_pending_link = 'edit-comments.php?akismet_recheck=' . wp_create_nonce( 'akismet_recheck' ); 203 } 204 ?> 205 <div class="akismet-alert is-good"> 206 <p><?php esc_html_e( 'Akismet is now protecting your site from spam.', 'akismet' ); ?></p> 207 <?php if ( $check_pending_link ) : ?> 208 <p> 209 <?php 210 echo wp_kses( 211 sprintf( 212 /* translators: The placeholder is a URL for checking pending comments. */ 213 __( 'Would you like to <a href="%s">scan pending comments for spam</a>?', 'akismet' ), 214 esc_url( $check_pending_link ) 215 ), 216 $kses_allow_link 217 ); 218 ?> 219 </p> 220 <?php endif; ?> 221 </div> 222 223 <?php elseif ( $type === 'new-key-invalid' ) : ?> 224 <div class="akismet-alert is-bad"> 225 <p><?php esc_html_e( 'The key you entered is invalid. Please double-check it.', 'akismet' ); ?></p> 226 </div> 227 228 <?php elseif ( $type === Akismet_Admin::NOTICE_EXISTING_KEY_INVALID ) : ?> 229 <div class="akismet-alert is-bad"> 230 <h3 class="akismet-alert__heading"><?php echo esc_html( __( 'Your API key is no longer valid.', 'akismet' ) ); ?></h3> 231 <p> 232 <?php 233 echo wp_kses( 234 sprintf( 235 /* translators: The placeholder is a URL to the Akismet contact form. */ 236 __( 'Please enter a new key or <a class="akismet-external-link" href="%s" target="_blank">contact Akismet support</a>', 'akismet' ), 237 'https://akismet.com/contact/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=support_invalid_key' 238 ), 239 $kses_allow_link 240 ); 241 ?> 242 </p> 243 </div> 244 245 <?php elseif ( $type === 'new-key-failed' ) : ?> 246 <div class="akismet-alert is-bad"> 247 <h3 class="akismet-alert__heading"><?php esc_html_e( 'The API key you entered could not be verified.', 'akismet' ); ?></h3> 248 <p> 249 <?php 250 echo wp_kses( 251 sprintf( 252 /* translators: The placeholder is a URL. */ 253 __( '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' ), 254 'https://akismet.com/akismet-hosting-faq/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=hosting_faq' 255 ), 256 $kses_allow_link 257 ); 258 ?> 259 </p> 260 </div> 261 262 <?php elseif ( $type === 'usage-limit' && isset( Akismet::$limit_notices[ $code ] ) ) : ?> 263 <div class="error akismet-usage-limit-alert"> 264 <div class="akismet-usage-limit-logo"> 265 <img src="<?php echo esc_url( plugins_url( '../_inc/img/logo-a-2x.png', __FILE__ ) ); ?>" alt="Akismet logo" /> 266 </div> 267 <div class="akismet-usage-limit-text"> 268 <h3> 269 <?php 270 switch ( Akismet::$limit_notices[ $code ] ) { 271 case 'FIRST_MONTH_OVER_LIMIT': 272 case 'SECOND_MONTH_OVER_LIMIT': 273 esc_html_e( 'Your Akismet account usage is over your plan’s limit', 'akismet' ); 274 break; 275 case 'THIRD_MONTH_APPROACHING_LIMIT': 276 esc_html_e( 'Your Akismet account usage is approaching your plan’s limit', 'akismet' ); 277 break; 278 case 'THIRD_MONTH_OVER_LIMIT': 279 case 'FOUR_PLUS_MONTHS_OVER_LIMIT': 280 esc_html_e( 'Your account has been restricted', 'akismet' ); 281 break; 282 default: 283 } 284 ?> 285 </h3> 286 <p> 287 <?php 288 switch ( Akismet::$limit_notices[ $code ] ) { 289 case 'FIRST_MONTH_OVER_LIMIT': 290 echo esc_html( 291 sprintf( 292 /* translators: The first placeholder is a date, the second is a (formatted) number, the third is another formatted number. */ 293 __( 'Since %1$s, your account made %2$s API calls, compared to your plan’s limit of %3$s.', 'akismet' ), 294 esc_html( gmdate( 'F' ) . ' 1' ), 295 number_format( $api_calls ), 296 number_format( $usage_limit ) 297 ) 298 ); 299 echo ' '; 300 echo '<a class="akismet-external-link" href="https://akismet.com/support/general/akismet-api-usage-limits/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=usage_limit_docs" target="_blank">'; 301 echo esc_html( __( 'Learn more about usage limits', 'akismet' ) ); 302 echo '</a>'; 303 304 break; 305 case 'SECOND_MONTH_OVER_LIMIT': 306 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. Increase your limit to make sure your site stays protected from spam.', 'akismet' ) ); 307 echo ' '; 308 echo '<a class="akismet-external-link" href="https://akismet.com/support/general/akismet-api-usage-limits/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=usage_limit_docs" target="_blank">'; 309 echo esc_html( __( 'Learn more about usage limits', 'akismet' ) ); 310 echo '</a>'; 311 312 break; 313 case 'THIRD_MONTH_APPROACHING_LIMIT': 314 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. Increase your limit to make sure your site stays protected from spam.', 'akismet' ) ); 315 echo ' '; 316 echo '<a class="akismet-external-link" href="https://akismet.com/support/general/akismet-api-usage-limits/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=usage_limit_docs" target="_blank">'; 317 echo esc_html( __( 'Learn more about usage limits', 'akismet' ) ); 318 echo '</a>'; 319 320 break; 321 case 'THIRD_MONTH_OVER_LIMIT': 322 case 'FOUR_PLUS_MONTHS_OVER_LIMIT': 323 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. Increase your limit to make sure your site stays protected from spam.', 'akismet' ) ); 324 echo ' '; 325 echo '<a class="akismet-external-link" href="https://akismet.com/support/general/akismet-api-usage-limits/?utm_source=akismet_plugin&utm_campaign=plugin_static_link&utm_medium=in_plugin&utm_content=usage_limit_docs" target="_blank">'; 326 echo esc_html( __( 'Learn more about usage limits', 'akismet' ) ); 327 echo '</a>'; 328 329 break; 330 331 default: 332 } 333 ?> 334 </p> 335 </div> 336 <div class="akismet-usage-limit-cta"> 337 <a href="<?php echo esc_url( $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"> 338 <?php 339 if ( isset( $upgrade_via_support ) && $upgrade_via_support ) { 340 // Direct user to contact support. 341 esc_html_e( 'Contact Akismet support', 'akismet' ); 342 } elseif ( ! empty( $upgrade_type ) && 'qty' === $upgrade_type ) { 343 // If a qty upgrade is required, use recommended plan name if available. 344 if ( ! empty( $recommended_plan_name ) && is_string( $recommended_plan_name ) ) { 345 echo esc_html( 346 sprintf( 347 /* translators: The placeholder is the name of an Akismet subscription plan, like "Akismet Pro" or "Akismet Business" . */ 348 __( 'Add an %s subscription', 'akismet' ), 349 $recommended_plan_name 350 ) 351 ); 352 } else { 353 esc_html_e( 'Increase your limit', 'akismet' ); 354 } 355 } else { 356 echo esc_html( 357 sprintf( 358 /* translators: The placeholder is the name of a subscription level, like "Akismet Business" or "Akismet Enterprise" . */ 359 __( 'Upgrade to %s', 'akismet' ), 360 $upgrade_plan 361 ) 362 ); 363 } 364 ?> 365 </a> 366 </div> 367 </div> 368 <?php endif; ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Sun Jun 28 08:20:12 2026 | Cross-referenced by PHPXref |