_inc/fonts/inter.css000064400000004221147177153510010452 0ustar00@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url("https://s0.wp.com/i/fonts/inter/Inter-Regular.woff2?v=3.19") format("woff2"), url("https://s0.wp.com/i/fonts/inter/Inter-Regular.woff?v=3.19") format("woff"); } @font-face { font-family: 'Inter'; font-style: italic; font-weight: 400; font-display: swap; src: url("https://s0.wp.com/i/fonts/inter/Inter-Italic.woff2?v=3.19") format("woff2"), url("https://s0.wp.com/i/fonts/inter/Inter-Italic.woff?v=3.19") format("woff"); } @font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url("https://s0.wp.com/i/fonts/inter/Inter-Medium.woff2?v=3.19") format("woff2"), url("https://s0.wp.com/i/fonts/inter/Inter-Medium.woff?v=3.19") format("woff"); } @font-face { font-family: 'Inter'; font-style: italic; font-weight: 500; font-display: swap; src: url("https://s0.wp.com/i/fonts/inter/Inter-MediumItalic.woff2?v=3.19") format("woff2"), url("https://s0.wp.com/i/fonts/inter/Inter-MediumItalic.woff?v=3.19") format("woff"); } @font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url("https://s0.wp.com/i/fonts/inter/Inter-SemiBold.woff2?v=3.19") format("woff2"), url("https://s0.wp.com/i/fonts/inter/Inter-SemiBold.woff?v=3.19") format("woff"); } @font-face { font-family: 'Inter'; font-style: italic; font-weight: 600; font-display: swap; src: url("https://s0.wp.com/i/fonts/inter/Inter-SemiBoldItalic.woff2?v=3.19") format("woff2"), url("https://s0.wp.com/i/fonts/inter/Inter-SemiBoldItalic.woff?v=3.19") format("woff"); } @font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url("https://s0.wp.com/i/fonts/inter/Inter-Bold.woff2?v=3.19") format("woff2"), url("https://s0.wp.com/i/fonts/inter/Inter-Bold.woff?v=3.19") format("woff"); } @font-face { font-family: 'Inter'; font-style: italic; font-weight: 700; font-display: swap; src: url("https://s0.wp.com/i/fonts/inter/Inter-BoldItalic.woff2?v=3.19") format("woff2"), url("https://s0.wp.com/i/fonts/inter/Inter-BoldItalic.woff?v=3.19") format("woff"); } _inc/img/akismet-activation-banner-elements.png000060400000013207147177153510015621 0ustar00PNG  IHDRȿsRGBPLTEGpLUU??HHJUHmH$mH3L:N:uNOoO_?O 6O5xO 6{M3G:N:uN<{O4{F9J OoOgG_GW7K4}L:|N5I7J<I6yH8|IJ[5J5zJ7}K  OkKkK[G[  I\  Mk MjJ\G\ MiH\ NjLjJ\LiH[ I\LjH\  I\  MjH[  MjI\ LkH\  MjLjMjLjI\ LiI[  MjI\~~~~~||}{{{yyywwwttusstrrsqqqonpmmollnkkmiikhhjggiffgddfccdaac__a^]_\[^[Z\XWYVVXTTVRRSPPRNNQMLNKJMIHKHGJFEHDCFBAD@@B>>@=pgRo14J(2؀!nL9nf-:b HbB IAq38†!'zLu\ e9ku`,OwK שlrn~~q)@zcU~D4W승Q2gLs96J%g'7Kx~F8!zyRHk*PJ=lʥ[Kvo E؍jT5\zJe*oP02vsJ{%YEQ/uUԵ# "Y !kקjŏsWjź0[)#"˴L}_^\<5ZY+,(#S4_[8`8]r`m,-7-$rlvWckJ @Ȏ(\oO8duk σU%XUAF7ReIEIK胹*aK}w@3+'5z Xɐhn]~Zs=Qiuˆ)n]"!RHSOiKK]o"d8$F0 [iRANTwf;٢M8vG Է, FPjI9*X-}{Q!Vh`FGWSteھ<8牟mBvkhq2Pĕm$[-SRR98c>G/..>mV@x}Aw9nҎiƭ߀x;y1/ ɱBy8=9޺ՓF;JL YB$7D] BqR7Dt#Zc\j0 QdtOϤT{Mw Pu ?MAo^Np)0 MÝqL3M֙|:wbֹvןwl}Mzw?ĘND L`ftfQ~m|YQ)\r8:v3ԮkĿza+s7 רvTTUp$dlM+nl_12>:} iti=Ǎ'))Kf#fauɚVW#Y^ؤG 3$Q a ),2$|\d&::$B+[.uoxqlg6[G @ᡔRrAJyfX|cg3"1B5+y<%=$a* s Xdg=˾rt:UP":TBJQL2! MT,Q3CW1'1}0pHLL9%OLf$K&!$K ;ZQ|l{XWTOop2Oғp<` !p@ʥqɏ7VScܵ:ȸI=I?g 2E8p0/eIt̥$KXQW7x;O?.e!#Ĭ$Q5wi)&Gjy[,Mu]Q=yNnqzqH8 %CdO9Ȧ$w'OgWҴ :JQN, K9rIMvs|ѶgZIpuy67`x EPd27'$OR*Y|<\jRwJʷ|q'7^dMJ4 &0% c<x|'=qEuKnJ)M넚d.$W6Rn"eԶfow\H%13iȞ䤤B"r:@'O Ip/yp- bI6py7m4manf8!E$pҖ3%Ϡ<çիÈ,/VbfQSDM(l@I9\(9$XkgA _a-}:_REq”4!l$*MiJ@|[7b#zWLn泚s7RBLH'nך6]m6CsZ~rM\`@)-9fm?)6-:EXd3x+,) :SJӴM;jO~j1 2px5Rv%?ΊpT5Դmeޗs@fGX0RWzR1 USQ=W9?pYwÇE7cSz̄,Yyaw:43SFcW&ӊʷE jӺA~mI)rH.dNT"qjx[i={*AO/HH.i>FG%\]ͧ{KՓ/jG@5988}}ΥKwlo{!`y؎.Nӿ8j7ϡKf'En2%GIU[wdM[w0\w_yqd`pp捣`{q m~68?8%2dF.&\kڭZ&UNtڪ1iP)ҠՓ݋mմi'dC>s羗 T /P xgoo ۻ/om_[;; L!I 3ݾw|%!؊3p$- Qjucɵ~~1#L Q p3.q/oCO>a0m8 ]'7zO|s#"( 2{)?>tw޾E m(DMm8%,\H |iEcF֓)8%t¸e (Ժ*ď (6Q?XDv=u h i=ׂ FmHG?ONoLm}Sbq:g;FX#gjv|m|촟QZL>ܤKTNHLlL8:ebH-BAjA WǨa[5|@zڱ=3♘;-6ثBңcnî 68p >::ZA|EbȄQ2 C"Z:Y4_?yYp:ȥK97yĢ3((.M.4ořz(i܊xR)}*Jی>,CZ䑱Iq)f<}z1 aak "o3 JيeĐ:2(֒3.d LAz82GZezҌcn/`GIO^l "&V/dOH Wc6䍌]ыyx 1p2. #"?>JSTK%:SNQ=?A\ zNQ!E2E|3@+gE8H{ ?[q)*@.#៼o[ҷ"qҚфhXWdT"?F$oEmLx _q8\l1lb.femFBWW9E^qb^m-wBJit0 hX p> g."*Avՠof!|U.f|ܼʐ19[QHO >!:rPQkuq ๎07<[t@=U-)yǯd\9Skbo+yu^,I54e+ZJ>%`uyKֳ5[ݛ#/ŊvHa`ûsvWgu&,x4cpa,`P0z,q7}m_?uj닾,HrssN̸WT+XrX_7>36Y-{fq~#^ 뎼We+vSɻ0L/]Y}=66;_9C[8߫ӟvu+LtX`*y}bJڢɻ6b!' _V"*ý>Q(.ȉqpUQGufroJEb }'PRzGέ \ kD*+K0M|z ,@ֱƷbvF[-C!_?1T52v(,ĩ `9ND<1Q` Go9ky殳?=*"hG98(uUm 0uXT4KјjGx:p%RtNClI2yUr~eJFѩ؝KyifoGC(\dY,)?`7t0 !-"87@Qt&Gm0 .ja_g1őN^-X%UF;³z7͙XuY0uf/$Ϗv,2Ǣ"ol jhC|kas%Cg] ^3t ChYd!MҢI gl$1* 97{VSUM]6k''ibѡؓamGf  p G@Tvuf_UyX:iE?]&Đw$itDe5EA>\km2aƻIWqwbAk }&>jFSeI}0Ig#@fYv,' 0D^ř>bMr*Y,v}pO֫a_wŰx Ţ_*sA,AQ FzbgbESe;yXa d c`}-F,Lsa,t* o].KKVND52Q,BnWUrȻ\~WtҡݗӕƂ jtKg+&c/GR W0‡'tՙt_.瘅 І́K-gcq,X._.Ӣ_"…&"*Kxsוrte%}.fU}ve-y~)-LqJ׳T`J\͂.}RύX\ Kmre,1Hiˇ5jY@?@%^5Ak -CR,fuq Q&nv{y,BO8_`cX,h[;Z-^F5$l:P4yGrrV;h= 4ڒ IXFh+K_inc/img/arrow-left.svg000064400000000307147177153510011046 0ustar00_inc/img/icon-external.svg000064400000000536147177153510011540 0ustar00_inc/img/logo-a-2x.png000064400000001610147177153510010454 0ustar00PNG  IHDR, iFz pHYs%%IR$sRGBgAMA aIDATx͘MHQKC++ccתZDAצڵ JA1(hrU}$Hedm,̏<s77f|o|o^{w#X̼qR=(+]|5Q0V&9UGX0 b`hozr I0ԠAn=<0nk-ð\_Eq\TSNF@2L_| &jy(gנP{zeYRA9l|I;]7̸.cX&ʗ0aN(j=`)Z49A4;ĩ:I&2p)Mrm J(WdhrO0L?Zp 9f'_rzl3BlfW"O _ra=0NSט>i0Ui@%zc;R>quh`ٛ)K!UU>JQ6}$uc=۟Sn=l+.H@f"WP\ٻ/{lqAtlwyhb;_q]+0"bboI\7rV gZO_Gb;ij&磐*YJ>=S_A׹+N ĩ]IENDB`_inc/rtl/akismet-admin-rtl.css000064400000017062147177153510012332 0ustar00/* This file was automatically generated on Nov 20 2023 03:10:42 */ #akismet-plugin-container { background-color: var(--akismet-color-light-grey); font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif; --akismet-color-charcoal: #272635; --akismet-color-light-grey: #f6f7f7; --akismet-color-mid-grey: #a7aaad; --akismet-color-dark-grey: #646970; --akismet-color-grey-80: #2c3338; --akismet-color-grey-100: #101517; --akismet-color-white: #fff; --akismet-color-mid-green: #357b49; --akismet-color-mid-red: #e82c3f; --akismet-color-light-blue: #256eff; --akismet-color-notice-light-green: #dbf0e1; --akismet-color-notice-dark-green: #69bf82; --akismet-color-notice-light-red: #ffdbde; --akismet-color-notice-dark-red: #ff6676; } #akismet-plugin-container a { color: var(--akismet-color-mid-green); } #akismet-plugin-container button:focus-visible, #akismet-plugin-container input:focus-visible { border: 0; box-shadow: none; outline: 2px solid var(--akismet-color-light-blue); } .akismet-masthead { box-shadow: none; } .akismet-masthead__logo { margin: 20px 0; } .akismet-section-header { box-shadow: none; margin-bottom: 0; } .akismet-section-header__label { color: var(--akismet-color-charcoal); font-weight: 600; } .akismet-button, .akismet-button:hover { background-color: var(--akismet-color-mid-green); border: 0; color: #fff; } /* Need this specificity to override the existing header rule */ .akismet-new-snapshot h3.akismet-new-snapshot__header { background: none; font-size: 13px; color: var(--akismet-color-charcoal); text-align: right; text-transform: none; } .akismet-new-snapshot .akismet-new-snapshot__number { color: var(--akismet-color-charcoal); letter-spacing: -1px; text-align: right; } .akismet-new-snapshot li.akismet-new-snapshot__item { color: var(--akismet-color-dark-grey); font-size: 13px; text-align: right; text-transform: none; } .akismet-masthead__logo-link { min-height: 50px; } .akismet-masthead__back-link-container { margin-top: 16px; margin-bottom: 2px; } /* Need this specificity to override the existing link rule */ #akismet-plugin-container a.akismet-masthead__back-link { background-image: url(../img/arrow-left.svg); background-position: right; background-repeat: no-repeat; background-size: 16px; color: var(--akismet-color-charcoal); font-weight: 400; padding-right: 20px; text-decoration: none; } #akismet-plugin-container a.akismet-masthead__back-link:hover { text-decoration: underline; } .akismet-new-snapshot__item { border-top: 1px solid var(--akismet-color-light-grey); border-right: 1px solid var(--akismet-color-light-grey); padding: 1em; } .akismet-new-snapshot li:first-child { border-right: none; } .akismet-new-snapshot__list { display: flex; margin-bottom: 0; } .akismet-new-snapshot__item { flex: 1 0 33.33%; margin-bottom: 0; padding-right: 1.5em; padding-left: 1.5em; } .akismet-new-snapshot__chart { padding: 1em; } .akismet-box { border: 0; } .akismet-box, .akismet-card { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06), 0 0 2px rgba(0, 0, 0, 0.16); border-radius: 8px; overflow: hidden; } .akismet-card { margin: 32px auto 0 auto; } .akismet-lower { padding-top: 0; } .akismet-lower .inside { padding: 0; } .akismet-section-header__label { margin: 0; } .akismet-settings__row { border-bottom: 1px solid var(--akismet-color-light-grey); display: block; padding: 1em 1.5em; } .akismet-settings__row-input { margin-right: auto; } .akismet-settings__row-title { font-weight: 500; font-size: 1em; margin: 0; margin-bottom: 1em; } .akismet-settings__row-description { margin-top: 0.5em; } .akismet-card-actions { display: flex; justify-content: flex-end; padding: 1em; } .akismet-card-actions__secondary-action { align-self: center; margin-left: auto; } .akismet-card-actions__secondary-action a[target="_blank"]::after { background: url('../img/icon-external.svg') no-repeat; background-size: contain; content: ""; display: inline-block; height: 16px; margin-right: 5px; vertical-align: middle; width: 16px; } .akismet-settings__row label { padding-bottom: 1em; } .akismet-settings__row-note { font-size: 0.9em; margin-top: 0.4em; } .akismet-settings__row input[type="checkbox"], .akismet-settings__row input[type="radio"] { accent-color: var(--akismet-color-mid-green); box-shadow: none; flex-shrink: 0; margin: 2px 0 0 0; } .akismet-settings__row input[type="checkbox"] { margin-top: 1px; vertical-align: top; -webkit-appearance: checkbox; } .akismet-settings__row input[type="radio"] { -webkit-appearance: radio; } /* Fix up misbehaving wp-admin styles in Chrome (from forms and colors stylesheets) */ .akismet-settings__row input[type="checkbox"]:checked:before { content: ''; } .akismet-settings__row input[type="radio"]:checked:before { background: none; } .akismet-settings__row input[type="checkbox"]:checked:hover, .akismet-settings__row input[type="radio"]:checked:hover { accent-color: var(--akismet-color-mid-green); } .akismet-button:disabled { background-color: var(--akismet-color-mid-grey); color: var(--akismet-color-white); cursor: arrow; } .akismet-awaiting-stats, .akismet-account { padding: 0 1rem 1rem 1rem; margin: 0; } .akismet-account { padding-bottom: 0; } .akismet-account th { font-weight: 500; padding-left: 1em; } .akismet-account th, .akismet-account td { padding-bottom: 1em; } .akismet-settings__row-input-label { align-items: center; display: flex; } .akismet-settings__row-label-text { padding-right: 0.5em; margin-top: 2px; } .akismet-alert { border-right: 8px solid; border-radius: 8px; margin: 20px 0; padding: 0.2em 1em; } .akismet-alert__heading { font-size: 1em; } .akismet-alert.is-good { background-color: var(--akismet-color-notice-light-green); border-right-color: var(--akismet-color-notice-dark-green); } .akismet-alert.is-neutral { background-color: var(--akismet-color-white); border-right-color: var(--akismet-color-dark-grey); } .akismet-alert.is-bad { background-color: var(--akismet-color-notice-light-red); border-right-color: var(--akismet-color-notice-dark-red); } #akismet-plugin-container .akismet-alert.is-good a, #akismet-plugin-container .akismet-alert.is-bad a { /* For better contrast - green isn't great */ color: var(--akismet-color-grey-80); } /* Setup - API key input */ .akismet-enter-api-key-box { margin: 1.5rem 0; } .akismet-enter-api-key-box__reveal { background: none; border: 0; color: var(--akismet-color-mid-green); cursor: pointer; text-decoration: underline; } .akismet-enter-api-key-box__form-wrapper { display: none; margin-top: 1.5rem; } .akismet-enter-api-key-box__input-wrapper { box-sizing: border-box; display: flex; flex-wrap: nowrap; padding: 0 1.5rem; width: 100%; } .akismet-enter-api-key-box__key-input { flex-grow: 1; margin-left: 1rem; } h3.akismet-enter-api-key-box__header { padding-top: 0; padding-bottom: 1em; text-align: right; } @media screen and (max-width: 782px) { .akismet-new-snapshot__list { display: block; } .akismet-new-snapshot__number { float: left; font-size: 20px; font-weight: 500; margin-top: -16px; } .akismet-new-snapshot__header { font-size: 14px; font-weight: 500; } .akismet-new-snapshot__text { font-size: 12px; } .akismet-settings__row input[type="checkbox"], .akismet-settings__row input[type="radio"] { height: 24px; width: 24px; } .akismet-settings__row-label-text { padding-right: 0.8em; } .akismet-settings__row input[type="checkbox"], .akismet-settings__row input[type="radio"] { margin-top: 0; } }_inc/rtl/akismet-rtl.css000064400000030313147177153510011236 0ustar00/* This file was automatically generated on Aug 25 2023 03:41:43 */ .wp-admin.jetpack_page_akismet-key-config, .wp-admin.settings_page_akismet-key-config { background-color:#f3f6f8; } #submitted-on { position: relative; } #the-comment-list .author .akismet-user-comment-count { display: inline; } #the-comment-list .author a span { text-decoration: none; color: #999; } #the-comment-list .author a span.akismet-span-link { text-decoration: inherit; color: inherit; } #the-comment-list .akismet_remove_url { margin-right: 3px; color: #999; padding: 2px 0 2px 3px; } #the-comment-list .akismet_remove_url:hover { color: #A7301F; font-weight: bold; padding: 2px 0 2px 2px; } #dashboard_recent_comments .akismet-status { display: none; } .akismet-status { float: left; } .akismet-status a { color: #AAA; font-style: italic; } table.comments td.comment p a { text-decoration: underline; } table.comments td.comment p a:after { content: attr(href); color: #aaa; display: inline-block; /* Show the URL without the link's underline extending under it. */ padding: 0 1ex; /* Because it's inline block, we can't just use spaces in the content: attribute to separate it from the link text. */ } .mshot-arrow { width: 0; height: 0; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-left: 10px solid #5C5C5C; position: absolute; right: -6px; top: 91px; } .mshot-container { background: #5C5C5C; position: absolute; top: -94px; padding: 7px; width: 450px; height: 338px; z-index: 20000; -moz-border-radius: 6px; border-radius: 6px; -webkit-border-radius: 6px; } .akismet-mshot { position: absolute; z-index: 100; } .akismet-mshot .mshot-image { margin: 0; height: 338px; width: 450px; } .checkforspam { display: inline-block !important; } .checkforspam-spinner { display: inline-block; margin-top: 7px; } .akismet-right { float: left; } .akismet-card .akismet-right { margin: 1em 0; } .akismet-alert-text { color: #dd3d36; font-weight: bold; font-size: 120%; margin-top: .5rem; } .akismet-new-snapshot { margin-top: 1em; text-align: center; background: #fff; } .akismet-new-snapshot h3 { background: #f5f5f5; color: #888; font-size: 11px; margin: 0; } .akismet-new-snapshot ul li { color: #999; font-size: 11px; text-transform: uppercase; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -ms-box-sizing: border-box; } .akismet-new-snapshot__number { display: block; font-size: 32px; font-weight: lighter; line-height: 1.5em; } .akismet-settings th:first-child { vertical-align: top; padding-top: 15px; } .akismet-settings th.akismet-api-key { vertical-align: middle; padding-top: 0; } .akismet-settings span.akismet-note{ float: right; padding-right: 23px; font-size: 75%; margin-top: -10px; } /** * For the activation notice on the plugins page. */ #akismet_setup_prompt { background: none; border: none; margin: 0; padding: 0; width: 100%; } .akismet_activate { border: 1px solid #4F800D; padding: 5px; margin: 15px 0; background: #83AF24; background-image: -webkit-gradient(linear, 0% 0, 80% 100%, from(#83AF24), to(#4F800D)); background-image: -moz-linear-gradient(-80% 100% 120deg, #4F800D, #83AF24); -moz-border-radius: 3px; border-radius: 3px; -webkit-border-radius: 3px; position: relative; overflow: hidden; } .akismet_activate .aa_a { position: absolute; top: -5px; left: 10px; font-size: 140px; color: #769F33; font-family: Georgia, "Times New Roman", Times, serif; } .akismet_activate .aa_button { font-weight: bold; border: 1px solid #029DD6; border-top: 1px solid #06B9FD; font-size: 15px; text-align: center; padding: 9px 0 8px 0; color: #FFF; background: #029DD6; background-image: -webkit-gradient(linear, 0% 0, 0% 100%, from(#029DD6), to(#0079B1)); background-image: -moz-linear-gradient(0% 100% 90deg, #0079B1, #029DD6); -moz-border-radius: 2px; border-radius: 2px; -webkit-border-radius: 2px; width: 100%; cursor: pointer; margin: 0; } .akismet_activate .aa_button:hover { text-decoration: none !important; border: 1px solid #029DD6; border-bottom: 1px solid #00A8EF; font-size: 15px; text-align: center; padding: 9px 0 8px 0; color: #F0F8FB; background: #0079B1; background-image: -webkit-gradient(linear, 0% 0, 0% 100%, from(#0079B1), to(#0092BF)); background-image: -moz-linear-gradient(0% 100% 90deg, #0092BF, #0079B1); -moz-border-radius: 2px; border-radius: 2px; -webkit-border-radius: 2px; } .akismet_activate .aa_button_border { border: 1px solid #006699; -moz-border-radius: 2px; border-radius: 2px; -webkit-border-radius: 2px; background: #029DD6; background-image: -webkit-gradient(linear, 0% 0, 0% 100%, from(#029DD6), to(#0079B1)); background-image: -moz-linear-gradient(0% 100% 90deg, #0079B1, #029DD6); } .akismet_activate .aa_button_container { box-sizing: border-box; display: inline-block; background: #DEF1B8; padding: 5px; -moz-border-radius: 2px; border-radius: 2px; -webkit-border-radius: 2px; width: 266px; } .akismet_activate .aa_description { position: absolute; top: 22px; right: 285px; margin-right: 25px; color: #E5F2B1; font-size: 15px; } .akismet_activate .aa_description strong { color: #FFF; font-weight: normal; } @media (max-width: 550px) { .akismet_activate .aa_a { display: none; } .akismet_activate .aa_button_container { width: 100%; } } @media (max-width: 782px) { .akismet_activate { min-width: 0; } } @media (max-width: 850px) { #akismet_setup_prompt .aa_description { display: none; } .akismet_activate { min-width: 0; } } .jetpack_page_akismet-key-config #wpcontent, .settings_page_akismet-key-config #wpcontent { padding-right: 0; } .akismet-masthead { background-color:#fff; text-align:center; box-shadow:0 1px 0 rgba(200,215,225,0.5),0 1px 2px #e9eff3 } @media (max-width: 45rem) { .akismet-masthead { padding:0 1.25rem } } .akismet-masthead__inside-container { padding:.375rem 0; margin:0 auto; width:100%; max-width:45rem; text-align: right; } .akismet-masthead__logo-container { padding:.3125rem 0 0 } .akismet-masthead__logo-link { display:inline-block; outline:none; vertical-align:middle } .akismet-masthead__logo-link:focus { line-height:0; box-shadow:0 0 0 2px #78dcfa } .akismet-masthead__logo-link+code { margin:0 10px; padding:5px 9px; border-radius:2px; background:#e6ecf1; color:#647a88 } .akismet-masthead__links { display:-ms-flexbox; display:flex; -ms-flex-flow:row wrap; flex-flow:row wrap; -ms-flex:2 50%; flex:2 50%; -ms-flex-pack:end; justify-content:flex-end; margin:0 } @media (max-width: 480px) { .akismet-masthead__links { padding-left:.625rem } } .akismet-masthead__link-li { margin:0; padding:0 } .akismet-masthead__link { font-style:normal; color:#0087be; padding:.625rem; display:inline-block } .akismet-masthead__link:visited { color:#0087be } .akismet-masthead__link:active,.akismet-masthead__link:hover { color:#00aadc } .akismet-masthead__link:hover { text-decoration:underline } .akismet-masthead__link .dashicons { display:none } @media (max-width: 480px) { .akismet-masthead__link:hover,.akismet-masthead__link:active { text-decoration:none } .akismet-masthead__link .dashicons { display:block; font-size:1.75rem } .akismet-masthead__link span+span { display:none } } .akismet-masthead__link-li:last-of-type .akismet-masthead__link { padding-left:0 } .akismet-lower { margin: 0 auto; text-align: right; max-width: 45rem; padding: 1.5rem; } .akismet-lower .notice { margin-bottom: 2rem; } .akismet-card { margin-top: 1rem; margin-bottom: 0; position: relative; box-sizing: border-box; background: white; } .akismet-card:after, .akismet-card .inside:after, .akismet-masthead__logo-container:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .akismet-card .inside { padding: 1.5rem; padding-top: 1rem; } .akismet-card .akismet-card-actions { margin-top: 1rem; } .jetpack_page_akismet-key-config .update-nag, .settings_page_akismet-key-config .update-nag { display: none; } .akismet-masthead .akismet-right { line-height: 2.125rem; font-size: 0.9rem; } .akismet-box { box-sizing: border-box; background: white; border: 1px solid rgba(200, 215, 225, 0.5); } .akismet-box h2, .akismet-box h3 { padding: 1.5rem 1.5rem .5rem 1.5rem; margin: 0; } .akismet-box p { padding: 0 1.5rem 1.5rem 1.5rem; margin: 0; } .akismet-jetpack-email { font-style: oblique; } .akismet-jetpack-gravatar { padding: 0 1.5rem 0 0; float: right; margin-left: 1rem; width: 54px; height: 54px; } .akismet-box p:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .akismet-box .akismet-right { padding-left: 1.5rem; } .akismet-boxes .akismet-box { margin-bottom: 0; padding: 0; margin-top: -1px; } .akismet-boxes .akismet-box:last-child { margin-bottom: 1.5rem; } .akismet-boxes .akismet-box:first-child { margin-top: 1.5rem; } .akismet-box-header { max-width: 700px; margin: 0 auto 40px auto; line-height: 1.5; } .akismet-box-header h2 { margin: 1.5rem 10% 0; font-size: 1.375rem; font-weight: 700; color: #000; } .akismet-box .centered { text-align: center; } .akismet-box .akismet-toggles { margin: 3rem 0; } .akismet-box .akismet-ak-connect, .akismet-box .toggle-jp-connect { display: none; } .akismet-button, .akismet-button:hover, .akismet-button:visited { background: white; border-color: #c8d7e1; border-style: solid; border-width: 1px 1px 2px; color: #2e4453; cursor: pointer; display: inline-block; margin: 0; outline: 0; overflow: hidden; font-size: 14px; font-weight: 500; text-overflow: ellipsis; text-decoration: none; vertical-align: top; box-sizing: border-box; font-size: 14px; line-height: 21px; border-radius: 4px; padding: 7px 14px 9px; -webkit-appearance: none; -moz-appearance: none; appearance: none; } .akismet-button:hover { border-color: #a8bece; } .akismet-button:active { border-width: 2px 1px 1px; } .akismet-is-primary, .akismet-is-primary:hover, .akismet-is-primary:visited { background: #00aadc; border-color: #0087be; color: white; } .akismet-is-primary:hover, .akismet-is-primary:focus { border-color: #005082; } .akismet-is-primary:hover { border-color: #005082; } .akismet-section-header { position: relative; margin: 0 auto 0.625rem auto; padding: 1rem; box-sizing: border-box; box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3; background: #ffffff; width: 100%; padding-top: 0.6875rem; padding-bottom: 0.6875rem; display: flex; } .akismet-section-header__label { display: -ms-flexbox; display: flex; -ms-flex-align: center; align-items: center; -ms-flex-positive: 1; flex-grow: 1; line-height: 1.75rem; position: relative; font-size: 0.875rem; color: #4f748e; } .akismet-section-header__actions { line-height: 1.75rem; } .akismet-setup-instructions { text-align: center; } .akismet-setup-instructions form { padding-bottom: 1.5rem; } div.error.akismet-usage-limit-alert { padding: 25px 15px 25px 45px; display: flex; align-items: center; } #akismet-plugin-container .akismet-usage-limit-alert { margin: 0 auto 0.625rem auto; box-sizing: border-box; box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3; border: none; border-right: 4px solid #d63638; } .akismet-usage-limit-alert .akismet-usage-limit-logo { width: 38px; min-width: 38px; height: 38px; border-radius: 20px; margin-left: 18px; background: black; position: relative; } .akismet-usage-limit-alert .akismet-usage-limit-logo img { position: absolute; width: 22px; right: 8px; top: 10px; } .akismet-usage-limit-alert .akismet-usage-limit-text { flex-grow: 1; margin-left: 18px; } .akismet-usage-limit-alert h3 { margin: 0; } .akismet-usage-limit-alert .akismet-usage-limit-cta { text-align: left; } #akismet-plugin-container .akismet-usage-limit-cta a { color: #d63638; } @media (max-width: 550px) { div.error.akismet-usage-limit-alert { display: block; } .akismet-usage-limit-alert .akismet-usage-limit-logo, .akismet-usage-limit-alert .akismet-usage-limit-text { margin-bottom: 15px; } .akismet-usage-limit-alert .akismet-usage-limit-cta { text-align: right; } }_inc/akismet-admin.css000064400000016733147177153510010736 0ustar00#akismet-plugin-container { background-color: var(--akismet-color-light-grey); font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif; --akismet-color-charcoal: #272635; --akismet-color-light-grey: #f6f7f7; --akismet-color-mid-grey: #a7aaad; --akismet-color-dark-grey: #646970; --akismet-color-grey-80: #2c3338; --akismet-color-grey-100: #101517; --akismet-color-white: #fff; --akismet-color-mid-green: #357b49; --akismet-color-mid-red: #e82c3f; --akismet-color-light-blue: #256eff; --akismet-color-notice-light-green: #dbf0e1; --akismet-color-notice-dark-green: #69bf82; --akismet-color-notice-light-red: #ffdbde; --akismet-color-notice-dark-red: #ff6676; } #akismet-plugin-container a { color: var(--akismet-color-mid-green); } #akismet-plugin-container button:focus-visible, #akismet-plugin-container input:focus-visible { border: 0; box-shadow: none; outline: 2px solid var(--akismet-color-light-blue); } .akismet-masthead { box-shadow: none; } .akismet-masthead__logo { margin: 20px 0; } .akismet-section-header { box-shadow: none; margin-bottom: 0; } .akismet-section-header__label { color: var(--akismet-color-charcoal); font-weight: 600; } .akismet-button, .akismet-button:hover { background-color: var(--akismet-color-mid-green); border: 0; color: #fff; } /* Need this specificity to override the existing header rule */ .akismet-new-snapshot h3.akismet-new-snapshot__header { background: none; font-size: 13px; color: var(--akismet-color-charcoal); text-align: left; text-transform: none; } .akismet-new-snapshot .akismet-new-snapshot__number { color: var(--akismet-color-charcoal); letter-spacing: -1px; text-align: left; } .akismet-new-snapshot li.akismet-new-snapshot__item { color: var(--akismet-color-dark-grey); font-size: 13px; text-align: left; text-transform: none; } .akismet-masthead__logo-link { min-height: 50px; } .akismet-masthead__back-link-container { margin-top: 16px; margin-bottom: 2px; } /* Need this specificity to override the existing link rule */ #akismet-plugin-container a.akismet-masthead__back-link { background-image: url(img/arrow-left.svg); background-position: left; background-repeat: no-repeat; background-size: 16px; color: var(--akismet-color-charcoal); font-weight: 400; padding-left: 20px; text-decoration: none; } #akismet-plugin-container a.akismet-masthead__back-link:hover { text-decoration: underline; } .akismet-new-snapshot__item { border-top: 1px solid var(--akismet-color-light-grey); border-left: 1px solid var(--akismet-color-light-grey); padding: 1em; } .akismet-new-snapshot li:first-child { border-left: none; } .akismet-new-snapshot__list { display: flex; margin-bottom: 0; } .akismet-new-snapshot__item { flex: 1 0 33.33%; margin-bottom: 0; padding-left: 1.5em; padding-right: 1.5em; } .akismet-new-snapshot__chart { padding: 1em; } .akismet-box { border: 0; } .akismet-box, .akismet-card { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06), 0 0 2px rgba(0, 0, 0, 0.16); border-radius: 8px; overflow: hidden; } .akismet-card { margin: 32px auto 0 auto; } .akismet-lower { padding-top: 0; } .akismet-lower .inside { padding: 0; } .akismet-section-header__label { margin: 0; } .akismet-settings__row { border-bottom: 1px solid var(--akismet-color-light-grey); display: block; padding: 1em 1.5em; } .akismet-settings__row-input { margin-left: auto; } .akismet-settings__row-title { font-weight: 500; font-size: 1em; margin: 0; margin-bottom: 1em; } .akismet-settings__row-description { margin-top: 0.5em; } .akismet-card-actions { display: flex; justify-content: flex-end; padding: 1em; } .akismet-card-actions__secondary-action { align-self: center; margin-right: auto; } .akismet-card-actions__secondary-action a[target="_blank"]::after { background: url('img/icon-external.svg') no-repeat; background-size: contain; content: ""; display: inline-block; height: 16px; margin-left: 5px; vertical-align: middle; width: 16px; } .akismet-settings__row label { padding-bottom: 1em; } .akismet-settings__row-note { font-size: 0.9em; margin-top: 0.4em; } .akismet-settings__row input[type="checkbox"], .akismet-settings__row input[type="radio"] { accent-color: var(--akismet-color-mid-green); box-shadow: none; flex-shrink: 0; margin: 2px 0 0 0; } .akismet-settings__row input[type="checkbox"] { margin-top: 1px; vertical-align: top; -webkit-appearance: checkbox; } .akismet-settings__row input[type="radio"] { -webkit-appearance: radio; } /* Fix up misbehaving wp-admin styles in Chrome (from forms and colors stylesheets) */ .akismet-settings__row input[type="checkbox"]:checked:before { content: ''; } .akismet-settings__row input[type="radio"]:checked:before { background: none; } .akismet-settings__row input[type="checkbox"]:checked:hover, .akismet-settings__row input[type="radio"]:checked:hover { accent-color: var(--akismet-color-mid-green); } .akismet-button:disabled { background-color: var(--akismet-color-mid-grey); color: var(--akismet-color-white); cursor: arrow; } .akismet-awaiting-stats, .akismet-account { padding: 0 1rem 1rem 1rem; margin: 0; } .akismet-account { padding-bottom: 0; } .akismet-account th { font-weight: 500; padding-right: 1em; } .akismet-account th, .akismet-account td { padding-bottom: 1em; } .akismet-settings__row-input-label { align-items: center; display: flex; } .akismet-settings__row-label-text { padding-left: 0.5em; margin-top: 2px; } .akismet-alert { border-left: 8px solid; border-radius: 8px; margin: 20px 0; padding: 0.2em 1em; } .akismet-alert__heading { font-size: 1em; } .akismet-alert.is-good { background-color: var(--akismet-color-notice-light-green); border-left-color: var(--akismet-color-notice-dark-green); } .akismet-alert.is-neutral { background-color: var(--akismet-color-white); border-left-color: var(--akismet-color-dark-grey); } .akismet-alert.is-bad { background-color: var(--akismet-color-notice-light-red); border-left-color: var(--akismet-color-notice-dark-red); } #akismet-plugin-container .akismet-alert.is-good a, #akismet-plugin-container .akismet-alert.is-bad a { /* For better contrast - green isn't great */ color: var(--akismet-color-grey-80); } /* Setup - API key input */ .akismet-enter-api-key-box { margin: 1.5rem 0; } .akismet-enter-api-key-box__reveal { background: none; border: 0; color: var(--akismet-color-mid-green); cursor: pointer; text-decoration: underline; } .akismet-enter-api-key-box__form-wrapper { display: none; margin-top: 1.5rem; } .akismet-enter-api-key-box__input-wrapper { box-sizing: border-box; display: flex; flex-wrap: nowrap; padding: 0 1.5rem; width: 100%; } .akismet-enter-api-key-box__key-input { flex-grow: 1; margin-right: 1rem; } h3.akismet-enter-api-key-box__header { padding-top: 0; padding-bottom: 1em; text-align: left; } @media screen and (max-width: 782px) { .akismet-new-snapshot__list { display: block; } .akismet-new-snapshot__number { float: right; font-size: 20px; font-weight: 500; margin-top: -16px; } .akismet-new-snapshot__header { font-size: 14px; font-weight: 500; } .akismet-new-snapshot__text { font-size: 12px; } .akismet-settings__row input[type="checkbox"], .akismet-settings__row input[type="radio"] { height: 24px; width: 24px; } .akismet-settings__row-label-text { padding-left: 0.8em; } .akismet-settings__row input[type="checkbox"], .akismet-settings__row input[type="radio"] { margin-top: 0; } }_inc/akismet-admin.js000064400000000405147177153510010547 0ustar00document.addEventListener( 'DOMContentLoaded', function() { // Prevent aggressive iframe caching in Firefox var statsIframe = document.getElementById( 'stats-iframe' ); if ( statsIframe ) { statsIframe.contentWindow.location.href = statsIframe.src; } } );_inc/akismet.css000064400000030230147177153510007634 0ustar00.wp-admin.jetpack_page_akismet-key-config, .wp-admin.settings_page_akismet-key-config { background-color:#f3f6f8; } #submitted-on { position: relative; } #the-comment-list .author .akismet-user-comment-count { display: inline; } #the-comment-list .author a span { text-decoration: none; color: #999; } #the-comment-list .author a span.akismet-span-link { text-decoration: inherit; color: inherit; } #the-comment-list .akismet_remove_url { margin-left: 3px; color: #999; padding: 2px 3px 2px 0; } #the-comment-list .akismet_remove_url:hover { color: #A7301F; font-weight: bold; padding: 2px 2px 2px 0; } #dashboard_recent_comments .akismet-status { display: none; } .akismet-status { float: right; } .akismet-status a { color: #AAA; font-style: italic; } table.comments td.comment p a { text-decoration: underline; } table.comments td.comment p a:after { content: attr(href); color: #aaa; display: inline-block; /* Show the URL without the link's underline extending under it. */ padding: 0 1ex; /* Because it's inline block, we can't just use spaces in the content: attribute to separate it from the link text. */ } .mshot-arrow { width: 0; height: 0; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-right: 10px solid #5C5C5C; position: absolute; left: -6px; top: 91px; } .mshot-container { background: #5C5C5C; position: absolute; top: -94px; padding: 7px; width: 450px; height: 338px; z-index: 20000; -moz-border-radius: 6px; border-radius: 6px; -webkit-border-radius: 6px; } .akismet-mshot { position: absolute; z-index: 100; } .akismet-mshot .mshot-image { margin: 0; height: 338px; width: 450px; } .checkforspam { display: inline-block !important; } .checkforspam-spinner { display: inline-block; margin-top: 7px; } .akismet-right { float: right; } .akismet-card .akismet-right { margin: 1em 0; } .akismet-alert-text { color: #dd3d36; font-weight: bold; font-size: 120%; margin-top: .5rem; } .akismet-new-snapshot { margin-top: 1em; text-align: center; background: #fff; } .akismet-new-snapshot h3 { background: #f5f5f5; color: #888; font-size: 11px; margin: 0; } .akismet-new-snapshot ul li { color: #999; font-size: 11px; text-transform: uppercase; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -ms-box-sizing: border-box; } .akismet-new-snapshot__number { display: block; font-size: 32px; font-weight: lighter; line-height: 1.5em; } .akismet-settings th:first-child { vertical-align: top; padding-top: 15px; } .akismet-settings th.akismet-api-key { vertical-align: middle; padding-top: 0; } .akismet-settings span.akismet-note{ float: left; padding-left: 23px; font-size: 75%; margin-top: -10px; } /** * For the activation notice on the plugins page. */ #akismet_setup_prompt { background: none; border: none; margin: 0; padding: 0; width: 100%; } .akismet_activate { border: 1px solid #4F800D; padding: 5px; margin: 15px 0; background: #83AF24; background-image: -webkit-gradient(linear, 0% 0, 80% 100%, from(#83AF24), to(#4F800D)); background-image: -moz-linear-gradient(80% 100% 120deg, #4F800D, #83AF24); -moz-border-radius: 3px; border-radius: 3px; -webkit-border-radius: 3px; position: relative; overflow: hidden; } .akismet_activate .aa_a { position: absolute; top: -5px; right: 10px; font-size: 140px; color: #769F33; font-family: Georgia, "Times New Roman", Times, serif; } .akismet_activate .aa_button { font-weight: bold; border: 1px solid #029DD6; border-top: 1px solid #06B9FD; font-size: 15px; text-align: center; padding: 9px 0 8px 0; color: #FFF; background: #029DD6; background-image: -webkit-gradient(linear, 0% 0, 0% 100%, from(#029DD6), to(#0079B1)); background-image: -moz-linear-gradient(0% 100% 90deg, #0079B1, #029DD6); -moz-border-radius: 2px; border-radius: 2px; -webkit-border-radius: 2px; width: 100%; cursor: pointer; margin: 0; } .akismet_activate .aa_button:hover { text-decoration: none !important; border: 1px solid #029DD6; border-bottom: 1px solid #00A8EF; font-size: 15px; text-align: center; padding: 9px 0 8px 0; color: #F0F8FB; background: #0079B1; background-image: -webkit-gradient(linear, 0% 0, 0% 100%, from(#0079B1), to(#0092BF)); background-image: -moz-linear-gradient(0% 100% 90deg, #0092BF, #0079B1); -moz-border-radius: 2px; border-radius: 2px; -webkit-border-radius: 2px; } .akismet_activate .aa_button_border { border: 1px solid #006699; -moz-border-radius: 2px; border-radius: 2px; -webkit-border-radius: 2px; background: #029DD6; background-image: -webkit-gradient(linear, 0% 0, 0% 100%, from(#029DD6), to(#0079B1)); background-image: -moz-linear-gradient(0% 100% 90deg, #0079B1, #029DD6); } .akismet_activate .aa_button_container { box-sizing: border-box; display: inline-block; background: #DEF1B8; padding: 5px; -moz-border-radius: 2px; border-radius: 2px; -webkit-border-radius: 2px; width: 266px; } .akismet_activate .aa_description { position: absolute; top: 22px; left: 285px; margin-left: 25px; color: #E5F2B1; font-size: 15px; } .akismet_activate .aa_description strong { color: #FFF; font-weight: normal; } @media (max-width: 550px) { .akismet_activate .aa_a { display: none; } .akismet_activate .aa_button_container { width: 100%; } } @media (max-width: 782px) { .akismet_activate { min-width: 0; } } @media (max-width: 850px) { #akismet_setup_prompt .aa_description { display: none; } .akismet_activate { min-width: 0; } } .jetpack_page_akismet-key-config #wpcontent, .settings_page_akismet-key-config #wpcontent { padding-left: 0; } .akismet-masthead { background-color:#fff; text-align:center; box-shadow:0 1px 0 rgba(200,215,225,0.5),0 1px 2px #e9eff3 } @media (max-width: 45rem) { .akismet-masthead { padding:0 1.25rem } } .akismet-masthead__inside-container { padding:.375rem 0; margin:0 auto; width:100%; max-width:45rem; text-align: left; } .akismet-masthead__logo-container { padding:.3125rem 0 0 } .akismet-masthead__logo-link { display:inline-block; outline:none; vertical-align:middle } .akismet-masthead__logo-link:focus { line-height:0; box-shadow:0 0 0 2px #78dcfa } .akismet-masthead__logo-link+code { margin:0 10px; padding:5px 9px; border-radius:2px; background:#e6ecf1; color:#647a88 } .akismet-masthead__links { display:-ms-flexbox; display:flex; -ms-flex-flow:row wrap; flex-flow:row wrap; -ms-flex:2 50%; flex:2 50%; -ms-flex-pack:end; justify-content:flex-end; margin:0 } @media (max-width: 480px) { .akismet-masthead__links { padding-right:.625rem } } .akismet-masthead__link-li { margin:0; padding:0 } .akismet-masthead__link { font-style:normal; color:#0087be; padding:.625rem; display:inline-block } .akismet-masthead__link:visited { color:#0087be } .akismet-masthead__link:active,.akismet-masthead__link:hover { color:#00aadc } .akismet-masthead__link:hover { text-decoration:underline } .akismet-masthead__link .dashicons { display:none } @media (max-width: 480px) { .akismet-masthead__link:hover,.akismet-masthead__link:active { text-decoration:none } .akismet-masthead__link .dashicons { display:block; font-size:1.75rem } .akismet-masthead__link span+span { display:none } } .akismet-masthead__link-li:last-of-type .akismet-masthead__link { padding-right:0 } .akismet-lower { margin: 0 auto; text-align: left; max-width: 45rem; padding: 1.5rem; } .akismet-lower .notice { margin-bottom: 2rem; } .akismet-card { margin-top: 1rem; margin-bottom: 0; position: relative; box-sizing: border-box; background: white; } .akismet-card:after, .akismet-card .inside:after, .akismet-masthead__logo-container:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .akismet-card .inside { padding: 1.5rem; padding-top: 1rem; } .akismet-card .akismet-card-actions { margin-top: 1rem; } .jetpack_page_akismet-key-config .update-nag, .settings_page_akismet-key-config .update-nag { display: none; } .akismet-masthead .akismet-right { line-height: 2.125rem; font-size: 0.9rem; } .akismet-box { box-sizing: border-box; background: white; border: 1px solid rgba(200, 215, 225, 0.5); } .akismet-box h2, .akismet-box h3 { padding: 1.5rem 1.5rem .5rem 1.5rem; margin: 0; } .akismet-box p { padding: 0 1.5rem 1.5rem 1.5rem; margin: 0; } .akismet-jetpack-email { font-style: oblique; } .akismet-jetpack-gravatar { padding: 0 0 0 1.5rem; float: left; margin-right: 1rem; width: 54px; height: 54px; } .akismet-box p:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .akismet-box .akismet-right { padding-right: 1.5rem; } .akismet-boxes .akismet-box { margin-bottom: 0; padding: 0; margin-top: -1px; } .akismet-boxes .akismet-box:last-child { margin-bottom: 1.5rem; } .akismet-boxes .akismet-box:first-child { margin-top: 1.5rem; } .akismet-box-header { max-width: 700px; margin: 0 auto 40px auto; line-height: 1.5; } .akismet-box-header h2 { margin: 1.5rem 10% 0; font-size: 1.375rem; font-weight: 700; color: #000; } .akismet-box .centered { text-align: center; } .akismet-box .akismet-toggles { margin: 3rem 0; } .akismet-box .akismet-ak-connect, .akismet-box .toggle-jp-connect { display: none; } .akismet-button, .akismet-button:hover, .akismet-button:visited { background: white; border-color: #c8d7e1; border-style: solid; border-width: 1px 1px 2px; color: #2e4453; cursor: pointer; display: inline-block; margin: 0; outline: 0; overflow: hidden; font-size: 14px; font-weight: 500; text-overflow: ellipsis; text-decoration: none; vertical-align: top; box-sizing: border-box; font-size: 14px; line-height: 21px; border-radius: 4px; padding: 7px 14px 9px; -webkit-appearance: none; -moz-appearance: none; appearance: none; } .akismet-button:hover { border-color: #a8bece; } .akismet-button:active { border-width: 2px 1px 1px; } .akismet-is-primary, .akismet-is-primary:hover, .akismet-is-primary:visited { background: #00aadc; border-color: #0087be; color: white; } .akismet-is-primary:hover, .akismet-is-primary:focus { border-color: #005082; } .akismet-is-primary:hover { border-color: #005082; } .akismet-section-header { position: relative; margin: 0 auto 0.625rem auto; padding: 1rem; box-sizing: border-box; box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3; background: #ffffff; width: 100%; padding-top: 0.6875rem; padding-bottom: 0.6875rem; display: flex; } .akismet-section-header__label { display: -ms-flexbox; display: flex; -ms-flex-align: center; align-items: center; -ms-flex-positive: 1; flex-grow: 1; line-height: 1.75rem; position: relative; font-size: 0.875rem; color: #4f748e; } .akismet-section-header__actions { line-height: 1.75rem; } .akismet-setup-instructions { text-align: center; } .akismet-setup-instructions form { padding-bottom: 1.5rem; } div.error.akismet-usage-limit-alert { padding: 25px 45px 25px 15px; display: flex; align-items: center; } #akismet-plugin-container .akismet-usage-limit-alert { margin: 0 auto 0.625rem auto; box-sizing: border-box; box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3; border: none; border-left: 4px solid #d63638; } .akismet-usage-limit-alert .akismet-usage-limit-logo { width: 38px; min-width: 38px; height: 38px; border-radius: 20px; margin-right: 18px; background: black; position: relative; } .akismet-usage-limit-alert .akismet-usage-limit-logo img { position: absolute; width: 22px; left: 8px; top: 10px; } .akismet-usage-limit-alert .akismet-usage-limit-text { flex-grow: 1; margin-right: 18px; } .akismet-usage-limit-alert h3 { margin: 0; } .akismet-usage-limit-alert .akismet-usage-limit-cta { border-color: none; text-align: right; } #akismet-plugin-container .akismet-usage-limit-cta a { color: #d63638; } @media (max-width: 550px) { div.error.akismet-usage-limit-alert { display: block; } .akismet-usage-limit-alert .akismet-usage-limit-logo, .akismet-usage-limit-alert .akismet-usage-limit-text { margin-bottom: 15px; } .akismet-usage-limit-alert .akismet-usage-limit-cta { text-align: left; } }_inc/akismet-frontend.js000064400000026174147177153510011311 0ustar00/** * Observe how the user enters content into the comment form in order to determine whether it's a bot or not. * * Note that no actual input is being saved here, only counts and timings between events. */ ( function() { // Passive event listeners are guaranteed to never call e.preventDefault(), // but they're not supported in all browsers. Use this feature detection // to determine whether they're available for use. var supportsPassive = false; try { var opts = Object.defineProperty( {}, 'passive', { get : function() { supportsPassive = true; } } ); window.addEventListener( 'testPassive', null, opts ); window.removeEventListener( 'testPassive', null, opts ); } catch ( e ) {} function init() { var input_begin = ''; var keydowns = {}; var lastKeyup = null; var lastKeydown = null; var keypresses = []; var modifierKeys = []; var correctionKeys = []; var lastMouseup = null; var lastMousedown = null; var mouseclicks = []; var mousemoveTimer = null; var lastMousemoveX = null; var lastMousemoveY = null; var mousemoveStart = null; var mousemoves = []; var touchmoveCountTimer = null; var touchmoveCount = 0; var lastTouchEnd = null; var lastTouchStart = null; var touchEvents = []; var scrollCountTimer = null; var scrollCount = 0; var correctionKeyCodes = [ 'Backspace', 'Delete', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Home', 'End', 'PageUp', 'PageDown' ]; var modifierKeyCodes = [ 'Shift', 'CapsLock' ]; var forms = document.querySelectorAll( 'form[method=post]' ); for ( var i = 0; i < forms.length; i++ ) { var form = forms[i]; var formAction = form.getAttribute( 'action' ); // Ignore forms that POST directly to other domains; these could be things like payment forms. if ( formAction ) { // Check that the form is posting to an external URL, not a path. if ( formAction.indexOf( 'http://' ) == 0 || formAction.indexOf( 'https://' ) == 0 ) { if ( formAction.indexOf( 'http://' + window.location.hostname + '/' ) != 0 && formAction.indexOf( 'https://' + window.location.hostname + '/' ) != 0 ) { continue; } } } form.addEventListener( 'submit', function () { var ak_bkp = prepare_timestamp_array_for_request( keypresses ); var ak_bmc = prepare_timestamp_array_for_request( mouseclicks ); var ak_bte = prepare_timestamp_array_for_request( touchEvents ); var ak_bmm = prepare_timestamp_array_for_request( mousemoves ); var input_fields = { // When did the user begin entering any input? 'bib': input_begin, // When was the form submitted? 'bfs': Date.now(), // How many keypresses did they make? 'bkpc': keypresses.length, // How quickly did they press a sample of keys, and how long between them? 'bkp': ak_bkp, // How quickly did they click the mouse, and how long between clicks? 'bmc': ak_bmc, // How many mouseclicks did they make? 'bmcc': mouseclicks.length, // When did they press modifier keys (like Shift or Capslock)? 'bmk': modifierKeys.join( ';' ), // When did they correct themselves? e.g., press Backspace, or use the arrow keys to move the cursor back 'bck': correctionKeys.join( ';' ), // How many times did they move the mouse? 'bmmc': mousemoves.length, // How many times did they move around using a touchscreen? 'btmc': touchmoveCount, // How many times did they scroll? 'bsc': scrollCount, // How quickly did they perform touch events, and how long between them? 'bte': ak_bte, // How many touch events were there? 'btec' : touchEvents.length, // How quickly did they move the mouse, and how long between moves? 'bmm' : ak_bmm }; var akismet_field_prefix = 'ak_'; if ( this.getElementsByClassName ) { // Check to see if we've used an alternate field name prefix. We store this as an attribute of the container around some of the Akismet fields. var possible_akismet_containers = this.getElementsByClassName( 'akismet-fields-container' ); for ( var containerIndex = 0; containerIndex < possible_akismet_containers.length; containerIndex++ ) { var container = possible_akismet_containers.item( containerIndex ); if ( container.getAttribute( 'data-prefix' ) ) { akismet_field_prefix = container.getAttribute( 'data-prefix' ); break; } } } for ( var field_name in input_fields ) { var field = document.createElement( 'input' ); field.setAttribute( 'type', 'hidden' ); field.setAttribute( 'name', akismet_field_prefix + field_name ); field.setAttribute( 'value', input_fields[ field_name ] ); this.appendChild( field ); } }, supportsPassive ? { passive: true } : false ); form.addEventListener( 'keydown', function ( e ) { // If you hold a key down, some browsers send multiple keydown events in a row. // Ignore any keydown events for a key that hasn't come back up yet. if ( e.key in keydowns ) { return; } var keydownTime = ( new Date() ).getTime(); keydowns[ e.key ] = [ keydownTime ]; if ( ! input_begin ) { input_begin = keydownTime; } // In some situations, we don't want to record an interval since the last keypress -- for example, // on the first keypress, or on a keypress after focus has changed to another element. Normally, // we want to record the time between the last keyup and this keydown. But if they press a // key while already pressing a key, we want to record the time between the two keydowns. var lastKeyEvent = Math.max( lastKeydown, lastKeyup ); if ( lastKeyEvent ) { keydowns[ e.key ].push( keydownTime - lastKeyEvent ); } lastKeydown = keydownTime; }, supportsPassive ? { passive: true } : false ); form.addEventListener( 'keyup', function ( e ) { if ( ! ( e.key in keydowns ) ) { // This key was pressed before this script was loaded, or a mouseclick happened during the keypress, or... return; } var keyupTime = ( new Date() ).getTime(); if ( 'TEXTAREA' === e.target.nodeName || 'INPUT' === e.target.nodeName ) { if ( -1 !== modifierKeyCodes.indexOf( e.key ) ) { modifierKeys.push( keypresses.length - 1 ); } else if ( -1 !== correctionKeyCodes.indexOf( e.key ) ) { correctionKeys.push( keypresses.length - 1 ); } else { // ^ Don't record timings for keys like Shift or backspace, since they // typically get held down for longer than regular typing. var keydownTime = keydowns[ e.key ][0]; var keypress = []; // Keypress duration. keypress.push( keyupTime - keydownTime ); // Amount of time between this keypress and the previous keypress. if ( keydowns[ e.key ].length > 1 ) { keypress.push( keydowns[ e.key ][1] ); } keypresses.push( keypress ); } } delete keydowns[ e.key ]; lastKeyup = keyupTime; }, supportsPassive ? { passive: true } : false ); form.addEventListener( "focusin", function ( e ) { lastKeydown = null; lastKeyup = null; keydowns = {}; }, supportsPassive ? { passive: true } : false ); form.addEventListener( "focusout", function ( e ) { lastKeydown = null; lastKeyup = null; keydowns = {}; }, supportsPassive ? { passive: true } : false ); } document.addEventListener( 'mousedown', function ( e ) { lastMousedown = ( new Date() ).getTime(); }, supportsPassive ? { passive: true } : false ); document.addEventListener( 'mouseup', function ( e ) { if ( ! lastMousedown ) { // If the mousedown happened before this script was loaded, but the mouseup happened after... return; } var now = ( new Date() ).getTime(); var mouseclick = []; mouseclick.push( now - lastMousedown ); if ( lastMouseup ) { mouseclick.push( lastMousedown - lastMouseup ); } mouseclicks.push( mouseclick ); lastMouseup = now; // If the mouse has been clicked, don't record this time as an interval between keypresses. lastKeydown = null; lastKeyup = null; keydowns = {}; }, supportsPassive ? { passive: true } : false ); document.addEventListener( 'mousemove', function ( e ) { if ( mousemoveTimer ) { clearTimeout( mousemoveTimer ); mousemoveTimer = null; } else { mousemoveStart = ( new Date() ).getTime(); lastMousemoveX = e.offsetX; lastMousemoveY = e.offsetY; } mousemoveTimer = setTimeout( function ( theEvent, originalMousemoveStart ) { var now = ( new Date() ).getTime() - 500; // To account for the timer delay. var mousemove = []; mousemove.push( now - originalMousemoveStart ); mousemove.push( Math.round( Math.sqrt( Math.pow( theEvent.offsetX - lastMousemoveX, 2 ) + Math.pow( theEvent.offsetY - lastMousemoveY, 2 ) ) ) ); if ( mousemove[1] > 0 ) { // If there was no measurable distance, then it wasn't really a move. mousemoves.push( mousemove ); } mousemoveStart = null; mousemoveTimer = null; }, 500, e, mousemoveStart ); }, supportsPassive ? { passive: true } : false ); document.addEventListener( 'touchmove', function ( e ) { if ( touchmoveCountTimer ) { clearTimeout( touchmoveCountTimer ); } touchmoveCountTimer = setTimeout( function () { touchmoveCount++; }, 500 ); }, supportsPassive ? { passive: true } : false ); document.addEventListener( 'touchstart', function ( e ) { lastTouchStart = ( new Date() ).getTime(); }, supportsPassive ? { passive: true } : false ); document.addEventListener( 'touchend', function ( e ) { if ( ! lastTouchStart ) { // If the touchstart happened before this script was loaded, but the touchend happened after... return; } var now = ( new Date() ).getTime(); var touchEvent = []; touchEvent.push( now - lastTouchStart ); if ( lastTouchEnd ) { touchEvent.push( lastTouchStart - lastTouchEnd ); } touchEvents.push( touchEvent ); lastTouchEnd = now; // Don't record this time as an interval between keypresses. lastKeydown = null; lastKeyup = null; keydowns = {}; }, supportsPassive ? { passive: true } : false ); document.addEventListener( 'scroll', function ( e ) { if ( scrollCountTimer ) { clearTimeout( scrollCountTimer ); } scrollCountTimer = setTimeout( function () { scrollCount++; }, 500 ); }, supportsPassive ? { passive: true } : false ); } /** * For the timestamp data that is collected, don't send more than `limit` data points in the request. * Choose a random slice and send those. */ function prepare_timestamp_array_for_request( a, limit ) { if ( ! limit ) { limit = 100; } var rv = ''; if ( a.length > 0 ) { var random_starting_point = Math.max( 0, Math.floor( Math.random() * a.length - limit ) ); for ( var i = 0; i < limit && i < a.length; i++ ) { rv += a[ random_starting_point + i ][0]; if ( a[ random_starting_point + i ].length >= 2 ) { rv += "," + a[ random_starting_point + i ][1]; } rv += ";"; } } return rv; } if ( document.readyState !== 'loading' ) { init(); } else { document.addEventListener( 'DOMContentLoaded', init ); } })();_inc/akismet.js000064400000031746147177153510007475 0ustar00jQuery( function ( $ ) { var mshotRemovalTimer = null; var mshotRetryTimer = null; var mshotTries = 0; var mshotRetryInterval = 1000; var mshotEnabledLinkSelector = 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a'; var preloadedMshotURLs = []; $('.akismet-status').each(function () { var thisId = $(this).attr('commentid'); $(this).prependTo('#comment-' + thisId + ' .column-comment'); }); $('.akismet-user-comment-count').each(function () { var thisId = $(this).attr('commentid'); $(this).insertAfter('#comment-' + thisId + ' .author strong:first').show(); }); akismet_enable_comment_author_url_removal(); $( '#the-comment-list' ).on( 'click', '.akismet_remove_url', function () { var thisId = $(this).attr('commentid'); var data = { action: 'comment_author_deurl', _wpnonce: WPAkismet.comment_author_url_nonce, id: thisId }; $.ajax({ url: ajaxurl, type: 'POST', data: data, beforeSend: function () { // Removes "x" link $("a[commentid='"+ thisId +"']").hide(); // Show temp status $("#author_comment_url_"+ thisId).html( $( '' ).text( WPAkismet.strings['Removing...'] ) ); }, success: function (response) { if (response) { // Show status/undo link $("#author_comment_url_"+ thisId) .attr('cid', thisId) .addClass('akismet_undo_link_removal') .html( $( '' ).text( WPAkismet.strings['URL removed'] ) ) .append( ' ' ) .append( $( '' ) .text( WPAkismet.strings['(undo)'] ) .addClass( 'akismet-span-link' ) ); } } }); return false; }).on( 'click', '.akismet_undo_link_removal', function () { var thisId = $(this).attr('cid'); var thisUrl = $(this).attr('href'); var data = { action: 'comment_author_reurl', _wpnonce: WPAkismet.comment_author_url_nonce, id: thisId, url: thisUrl }; $.ajax({ url: ajaxurl, type: 'POST', data: data, beforeSend: function () { // Show temp status $("#author_comment_url_"+ thisId).html( $( '' ).text( WPAkismet.strings['Re-adding...'] ) ); }, success: function (response) { if (response) { // Add "x" link $("a[commentid='"+ thisId +"']").show(); // Show link. Core strips leading http://, so let's do that too. $("#author_comment_url_"+ thisId).removeClass('akismet_undo_link_removal').text( thisUrl.replace( /^http:\/\/(www\.)?/ig, '' ) ); } } }); return false; }); // Show a preview image of the hovered URL. Applies to author URLs and URLs inside the comments. if ( "enable_mshots" in WPAkismet && WPAkismet.enable_mshots ) { $( '#the-comment-list' ).on( 'mouseover', mshotEnabledLinkSelector, function () { clearTimeout( mshotRemovalTimer ); if ( $( '.akismet-mshot' ).length > 0 ) { if ( $( '.akismet-mshot:first' ).data( 'link' ) == this ) { // The preview is already showing for this link. return; } else { // A new link is being hovered, so remove the old preview. $( '.akismet-mshot' ).remove(); } } clearTimeout( mshotRetryTimer ); var linkUrl = $( this ).attr( 'href' ); if ( preloadedMshotURLs.indexOf( linkUrl ) !== -1 ) { // This preview image was already preloaded, so begin with a retry URL so the user doesn't see the placeholder image for the first second. mshotTries = 2; } else { mshotTries = 1; } var mShot = $( '
' ); mShot.data( 'link', this ); mShot.data( 'url', linkUrl ); mShot.find( 'img' ).on( 'load', function () { $( '.akismet-mshot' ).data( 'pending-request', false ); } ); var offset = $( this ).offset(); mShot.offset( { left : Math.min( $( window ).width() - 475, offset.left + $( this ).width() + 10 ), // Keep it on the screen if the link is near the edge of the window. top: offset.top + ( $( this ).height() / 2 ) - 101 // 101 = top offset of the arrow plus the top border thickness } ); $( 'body' ).append( mShot ); mshotRetryTimer = setTimeout( retryMshotUntilLoaded, mshotRetryInterval ); } ).on( 'mouseout', 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a', function () { mshotRemovalTimer = setTimeout( function () { clearTimeout( mshotRetryTimer ); $( '.akismet-mshot' ).remove(); }, 200 ); } ); var preloadDelayTimer = null; $( window ).on( 'scroll resize', function () { clearTimeout( preloadDelayTimer ); preloadDelayTimer = setTimeout( preloadMshotsInViewport, 500 ); } ); preloadMshotsInViewport(); } /** * The way mShots works is if there was no screenshot already recently generated for the URL, * it returns a "loading..." image for the first request. Then, some subsequent request will * receive the actual screenshot, but it's unknown how long it will take. So, what we do here * is continually re-request the mShot, waiting a second after every response until we get the * actual screenshot. */ function retryMshotUntilLoaded() { clearTimeout( mshotRetryTimer ); var imageWidth = $( '.akismet-mshot img' ).get(0).naturalWidth; if ( imageWidth == 0 ) { // It hasn't finished loading yet the first time. Check again shortly. setTimeout( retryMshotUntilLoaded, mshotRetryInterval ); } else if ( imageWidth == 400 ) { // It loaded the preview image. if ( mshotTries == 20 ) { // Give up if we've requested the mShot 20 times already. return; } if ( ! $( '.akismet-mshot' ).data( 'pending-request' ) ) { $( '.akismet-mshot' ).data( 'pending-request', true ); mshotTries++; $( '.akismet-mshot .mshot-image' ).attr( 'src', akismet_mshot_url( $( '.akismet-mshot' ).data( 'url' ), mshotTries ) ); } mshotRetryTimer = setTimeout( retryMshotUntilLoaded, mshotRetryInterval ); } else { // All done. } } function preloadMshotsInViewport() { var windowWidth = $( window ).width(); var windowHeight = $( window ).height(); $( '#the-comment-list' ).find( mshotEnabledLinkSelector ).each( function ( index, element ) { var linkUrl = $( this ).attr( 'href' ); // Don't attempt to preload an mshot for a single link twice. if ( preloadedMshotURLs.indexOf( linkUrl ) !== -1 ) { // The URL is already preloaded. return true; } if ( typeof element.getBoundingClientRect !== 'function' ) { // The browser is too old. Return false to stop this preloading entirely. return false; } var rect = element.getBoundingClientRect(); if ( rect.top >= 0 && rect.left >= 0 && rect.bottom <= windowHeight && rect.right <= windowWidth ) { akismet_preload_mshot( linkUrl ); $( this ).data( 'akismet-mshot-preloaded', true ); } } ); } $( '.checkforspam.enable-on-load' ).on( 'click', function( e ) { if ( $( this ).hasClass( 'ajax-disabled' ) ) { // Akismet hasn't been configured yet. Allow the user to proceed to the button's link. return; } e.preventDefault(); if ( $( this ).hasClass( 'button-disabled' ) ) { window.location.href = $( this ).data( 'success-url' ).replace( '__recheck_count__', 0 ).replace( '__spam_count__', 0 ); return; } $('.checkforspam').addClass('button-disabled').addClass( 'checking' ); $('.checkforspam-spinner').addClass( 'spinner' ).addClass( 'is-active' ); akismet_check_for_spam(0, 100); }).removeClass( 'button-disabled' ); var spam_count = 0; var recheck_count = 0; function akismet_check_for_spam(offset, limit) { var check_for_spam_buttons = $( '.checkforspam' ); var nonce = check_for_spam_buttons.data( 'nonce' ); // We show the percentage complete down to one decimal point so even queues with 100k // pending comments will show some progress pretty quickly. var percentage_complete = Math.round( ( recheck_count / check_for_spam_buttons.data( 'pending-comment-count' ) ) * 1000 ) / 10; // Update the progress counter on the "Check for Spam" button. $( '.checkforspam' ).text( check_for_spam_buttons.data( 'progress-label' ).replace( '%1$s', percentage_complete ) ); $.post( ajaxurl, { 'action': 'akismet_recheck_queue', 'offset': offset, 'limit': limit, 'nonce': nonce }, function(result) { if ( 'error' in result ) { // An error is only returned in the case of a missing nonce, so we don't need the actual error message. window.location.href = check_for_spam_buttons.data( 'failure-url' ); return; } recheck_count += result.counts.processed; spam_count += result.counts.spam; if (result.counts.processed < limit) { window.location.href = check_for_spam_buttons.data( 'success-url' ).replace( '__recheck_count__', recheck_count ).replace( '__spam_count__', spam_count ); } else { // Account for comments that were caught as spam and moved out of the queue. akismet_check_for_spam(offset + limit - result.counts.spam, limit); } } ); } if ( "start_recheck" in WPAkismet && WPAkismet.start_recheck ) { $( '.checkforspam' ).click(); } if ( typeof MutationObserver !== 'undefined' ) { // Dynamically add the "X" next the the author URL links when a comment is quick-edited. var comment_list_container = document.getElementById( 'the-comment-list' ); if ( comment_list_container ) { var observer = new MutationObserver( function ( mutations ) { for ( var i = 0, _len = mutations.length; i < _len; i++ ) { if ( mutations[i].addedNodes.length > 0 ) { akismet_enable_comment_author_url_removal(); // Once we know that we'll have to check for new author links, skip the rest of the mutations. break; } } } ); observer.observe( comment_list_container, { attributes: true, childList: true, characterData: true } ); } } function akismet_enable_comment_author_url_removal() { $( '#the-comment-list' ) .find( 'tr.comment, tr[id ^= "comment-"]' ) .find( '.column-author a[href^="http"]:first' ) // Ignore mailto: links, which would be the comment author's email. .each(function () { if ( $( this ).parent().find( '.akismet_remove_url' ).length > 0 ) { return; } var linkHref = $(this).attr( 'href' ); // Ignore any links to the current domain, which are diagnostic tools, like the IP address link // or any other links another plugin might add. var currentHostParts = document.location.href.split( '/' ); var currentHost = currentHostParts[0] + '//' + currentHostParts[2] + '/'; if ( linkHref.indexOf( currentHost ) != 0 ) { var thisCommentId = $(this).parents('tr:first').attr('id').split("-"); $(this) .attr("id", "author_comment_url_"+ thisCommentId[1]) .after( $( 'x' ) .attr( 'commentid', thisCommentId[1] ) .attr( 'title', WPAkismet.strings['Remove this URL'] ) ); } }); } /** * Generate an mShot URL if given a link URL. * * @param string linkUrl * @param int retry If retrying a request, the number of the retry. * @return string The mShot URL; */ function akismet_mshot_url( linkUrl, retry ) { var mshotUrl = '//s0.wp.com/mshots/v1/' + encodeURIComponent( linkUrl ) + '?w=900'; if ( retry > 1 ) { mshotUrl += '&r=' + encodeURIComponent( retry ); } mshotUrl += '&source=akismet'; return mshotUrl; } /** * Begin loading an mShot preview of a link. * * @param string linkUrl */ function akismet_preload_mshot( linkUrl ) { var img = new Image(); img.src = akismet_mshot_url( linkUrl ); preloadedMshotURLs.push( linkUrl ); } $( '.akismet-could-be-primary' ).each( function () { var form = $( this ).closest( 'form' ); form.data( 'initial-state', form.serialize() ); form.on( 'change keyup', function () { var self = $( this ); var submit_button = self.find( '.akismet-could-be-primary' ); if ( self.serialize() != self.data( 'initial-state' ) ) { submit_button.addClass( 'akismet-is-primary' ); } else { submit_button.removeClass( 'akismet-is-primary' ); } } ); } ); /** * Shows the Enter API key form */ $( '.akismet-enter-api-key-box__reveal' ).on( 'click', function ( e ) { e.preventDefault(); var div = $( '.akismet-enter-api-key-box__form-wrapper' ); div.show( 500 ); div.find( 'input[name=key]' ).focus(); $( this ).hide(); } ); /** * Hides the Connect with Jetpack form | Shows the Activate Akismet Account form */ $( 'a.toggle-ak-connect' ).on( 'click', function ( e ) { e.preventDefault(); $( '.akismet-ak-connect' ).slideToggle('slow'); $( 'a.toggle-ak-connect' ).hide(); $( '.akismet-jp-connect' ).hide(); $( 'a.toggle-jp-connect' ).show(); } ); /** * Shows the Connect with Jetpack form | Hides the Activate Akismet Account form */ $( 'a.toggle-jp-connect' ).on( 'click', function ( e ) { e.preventDefault(); $( '.akismet-jp-connect' ).slideToggle('slow'); $( 'a.toggle-jp-connect' ).hide(); $( '.akismet-ak-connect' ).hide(); $( 'a.toggle-ak-connect' ).show(); } ); }); views/activate.php000064400000000261147177153510010224 0ustar00

views/config.php000064400000035701147177153510007700 0ustar00 array( 'href' => true, ), ); ?>
$name ) ) ); ?>
  • spam ); ?> spam, 'akismet' ) ); ?>
  • spam ); ?> spam, 'akismet' ) ); ?>
  • accuracy ); ?>% missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ) ) . ', '; /* translators: %s: number of false positive spam flagged by Akismet */ echo esc_html( sprintf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ) ); ?>

%s', esc_url( admin_url( 'edit-comments.php?comment_status=spam' ) ), esc_html__( 'spam folder', 'akismet' ) ); // The _n() needs to be on one line so the i18n tooling can extract the translator comment. /* translators: %1$s: spam folder link, %2$d: delete interval in days */ $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' ); printf( wp_kses( $delete_message, $kses_allow_link_href ), wp_kses( $spam_folder_link, $kses_allow_link_href ), esc_html( $delete_interval ) ); ?>

next_billing_date ) : ?>
status === 'active' ) : ?>
( $akismet_user->account_type === 'free-api-key' && $akismet_user->status === 'active' ? __( 'Upgrade', 'akismet' ) : __( 'Change', 'akismet' ) ), 'redirect' => 'upgrade', ) ); ?>
views/connect-jp.php000064400000011755147177153510010476 0ustar00

status, array( 'no-sub', 'missing' ) ) ) { ?>

user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>

' . esc_html( $akismet_user->user_login ) . '' ); ?>
user_email ); ?>

status == 'cancelled' ) { ?>

user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>

user_email ) ); ?>
user_email ); ?>

status == 'suspended' ) { ?>

user_email ) ); ?>

user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>

' . esc_html( $akismet_user->user_login ) . '' ); ?>
user_email ); ?>


views/enter.php000064400000002024147177153510007540 0ustar00

views/get.php000064400000001771147177153510007212 0ustar00 0 ) { $submit_classes_attr = implode( ' ', $classes ); } ?>
views/logo.php000064400000001402147177153510007362 0ustar00 views/notice.php000064400000033233147177153510007712 0ustar00 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. */ ?>
A
Almost done - configure Akismet and say goodbye to spam', 'akismet' ), $kses_allow_strong ); ?>

https://akismet.com/errors/' . esc_attr( $code ) . '' ); ?>

gethostbynamel function. Akismet cannot work correctly until this is fixed. Please contact your web host or firewall administrator and give them this information about Akismet’s system requirements.', 'akismet' ), esc_url( 'https://akismet.com/akismet-hosting-faq/' ) ), array_merge( $kses_allow_link, $kses_allow_strong, array( 'code' => true ) ) ); ?>

our guide about firewalls.', 'akismet' ), esc_url( 'https://akismet.com/akismet-hosting-faq/' ) ), $kses_allow_link ); ?>

update your payment details.', 'akismet' ), esc_url( 'https://akismet.com/account/' ) ), $kses_allow_link ); ?>

Akismet account page to reactivate your subscription.', 'akismet' ), esc_url( 'https://akismet.com/account/' ) ), $kses_allow_link ); ?>

Akismet support for assistance.', 'akismet' ), esc_url( 'https://akismet.com/contact/' ) ), $kses_allow_link ); ?>

contributing a token amount.', 'akismet' ), esc_url( 'https://akismet.com/pricing' ) ), $kses_allow_link ); ?>

Akismet support for assistance.', 'akismet' ), esc_url( 'https://akismet.com/contact/' ) ), $kses_allow_link ); ?>

choose a plan to get started with Akismet.', 'akismet' ), esc_url( 'https://akismet.com/pricing' ) ), $kses_allow_link ); ?>

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' ); } ?>

check pending comments?', 'akismet' ), esc_url( $check_pending_link ) ), $kses_allow_link ); ?>

contact Akismet support.', 'akismet' ), 'https://akismet.com/contact/' ), $kses_allow_link ); ?>

our guide about firewalls and check your server configuration.', 'akismet' ), 'https://blog.akismet.com/akismet-hosting-faq/' ), $kses_allow_link ); ?>

'; echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) ); echo ''; 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 ''; echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) ); echo ''; 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 ''; echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) ); echo ''; 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 ''; echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) ); echo ''; break; default: } ?>

views/predefined.php000064400000000476147177153510010541 0ustar00

wp-config.php' ); ?>

views/setup.php000064400000000476147177153510007574 0ustar00

__( 'Choose an Akismet plan', 'akismet' ), 'classes' => array( 'akismet-button', 'akismet-is-primary' ) ) ); ?>
views/start.php000064400000001460147177153510007563 0ustar00
status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) { Akismet::view( 'connect-jp', compact( 'akismet_user' ) ); } else { Akismet::view( 'activate' ); } ?>
views/stats.php000064400000002057147177153510007567 0ustar00
true ) ); ?>
views/title.php000064400000000175147177153510007551 0ustar00

akismet.php000064400000005071147177153510006730 0ustar00protect your blog from spam. Akismet Anti-spam keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key. Version: 5.3.3 Requires at least: 5.8 Requires PHP: 5.6.20 Author: Automattic - Anti-spam Team Author URI: https://automattic.com/wordpress-plugins/ License: GPLv2 or later Text Domain: akismet */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Copyright 2005-2023 Automattic, Inc. */ // Make sure we don't expose any info if called directly if ( !function_exists( 'add_action' ) ) { echo 'Hi there! I\'m just a plugin, not much I can do when called directly.'; exit; } define( 'AKISMET_VERSION', '5.3.3' ); define( 'AKISMET__MINIMUM_WP_VERSION', '5.8' ); define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'AKISMET_DELETE_LIMIT', 10000 ); register_activation_hook( __FILE__, array( 'Akismet', 'plugin_activation' ) ); register_deactivation_hook( __FILE__, array( 'Akismet', 'plugin_deactivation' ) ); require_once AKISMET__PLUGIN_DIR . 'class.akismet.php'; require_once AKISMET__PLUGIN_DIR . 'class.akismet-widget.php'; require_once AKISMET__PLUGIN_DIR . 'class.akismet-rest-api.php'; add_action( 'init', array( 'Akismet', 'init' ) ); add_action( 'rest_api_init', array( 'Akismet_REST_API', 'init' ) ); if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { require_once AKISMET__PLUGIN_DIR . 'class.akismet-admin.php'; add_action( 'init', array( 'Akismet_Admin', 'init' ) ); } //add wrapper class around deprecated akismet functions that are referenced elsewhere require_once AKISMET__PLUGIN_DIR . 'wrapper.php'; if ( defined( 'WP_CLI' ) && WP_CLI ) { require_once AKISMET__PLUGIN_DIR . 'class.akismet-cli.php'; } changelog.txt000064400000052720147177153510007255 0ustar00=== Akismet Anti-spam === == Archived Changelog Entries == This file contains older changelog entries, so we can keep the size of the standard WordPress readme.txt file reasonable. For the latest changes, please see the "Changelog" section of the [readme.txt file](https://plugins.svn.wordpress.org/akismet/trunk/readme.txt). = 4.1.12 = *Release Date - 3 September 2021* * Fixed "Use of undefined constant" notice. * Improved styling of alert notices. = 4.1.11 = *Release Date - 23 August 2021* * Added support for Akismet API usage notifications on Akismet settings and edit-comments admin pages. * Added support for the deleted_comment action when bulk-deleting comments from Spam. = 4.1.10 = *Release Date - 6 July 2021* * Simplified the code around checking comments in REST API and XML-RPC requests. * Updated Plus plan terminology in notices to match current subscription names. * Added `rel="noopener"` to the widget link to avoid warnings in Google Lighthouse. * Set the Akismet JavaScript as deferred instead of async to improve responsiveness. * Improved the preloading of screenshot popups on the edit comments admin page. = 4.1.9 = *Release Date - 2 March 2021* * Improved handling of pingbacks in XML-RPC multicalls = 4.1.8 = *Release Date - 6 January 2021* * Fixed missing fields in submit-spam and submit-ham calls that could lead to reduced accuracy. * Fixed usage of deprecated jQuery function. = 4.1.7 = *Release Date - 22 October 2020* * Show the "Set up your Akismet account" banner on the comments admin screen, where it's relevant to mention if Akismet hasn't been configured. * Don't use wp_blacklist_check when the new wp_check_comment_disallowed_list function is available. = 4.1.6 = *Release Date - 4 June 2020* * Disable "Check for Spam" button until the page is loaded to avoid errors with clicking through to queue recheck endpoint directly. * Added filter "akismet_enable_mshots" to allow disabling screenshot popups on the edit comments admin page. = 4.1.5 = *Release Date - 29 April 2020* * Based on user feedback, we have dropped the in-admin notice explaining the availability of the "privacy notice" option in the AKismet settings screen. The option itself is available, but after displaying the notice for the last 2 years, it is now considered a known fact. * Updated the "Requires at least" to WP 4.6, based on recommendations from https://wp-info.org/tools/checkplugini18n.php?slug=akismet * Moved older changelog entries to a separate file to keep the size of this readme reasonable, also based on recommendations from https://wp-info.org/tools/checkplugini18n.php?slug=akismet = 4.1.4 = *Release Date - 17 March 2020* * Only redirect to the Akismet setup screen upon plugin activation if the plugin was activated manually from within the plugin-related screens, to help users with non-standard install workflows, like WP-CLI. * Update the layout of the initial setup screen to be more readable on small screens. * If no API key has been entered, don't run code that expects an API key. * Improve the readability of the comment history entries. * Don't modify the comment form HTML if no API key has been set. = 4.1.3 = *Release Date - 31 October 2019* * Prevented an attacker from being able to cause a user to unknowingly recheck their Pending comments for spam. * Improved compatibility with Jetpack 7.7+. * Updated the plugin activation page to use consistent language and markup. * Redirecting users to the Akismet connnection/settings screen upon plugin activation, in an effort to make it easier for people to get setup. = 4.1.2 = *Release Date - 14 May 2019* * Fixed a conflict between the Akismet setup banner and other plugin notices. * Reduced the number of API requests made by the plugin when attempting to verify the API key. * Include additional data in the pingback pre-check API request to help make the stats more accurate. * Fixed a bug that was enabling the "Check for Spam" button when no comments were eligible to be checked. * Improved Akismet's AMP compatibility. = 4.1.1 = *Release Date - 31 January 2019* * Fixed the "Setup Akismet" notice so it resizes responsively. * Only highlight the "Save Changes" button in the Akismet config when changes have been made. * The count of comments in your spam queue shown on the dashboard show now always be up-to-date. = 4.1 = *Release Date - 12 November 2018* * Added a WP-CLI method for retrieving stats. * Hooked into the new "Personal Data Eraser" functionality from WordPress 4.9.6. * Added functionality to clear outdated alerts from Akismet.com. = 4.0.8 = *Release Date - 19 June 2018* * Improved the grammar and consistency of the in-admin privacy related notes (notice and config). * Revised in-admin explanation of the comment form privacy notice to make its usage clearer. * Added `rel="nofollow noopener"` to the comment form privacy notice to improve SEO and security. = 4.0.7 = *Release Date - 28 May 2018* * Based on user feedback, the link on "Learn how your comment data is processed." in the optional privacy notice now has a `target` of `_blank` and opens in a new tab/window. * Updated the in-admin privacy notice to use the term "comment" instead of "contact" in "Akismet can display a notice to your users under your comment forms." * Only show in-admin privacy notice if Akismet has an API Key configured = 4.0.6 = *Release Date - 26 May 2018* * Moved away from using `empty( get_option() )` to instantiating a variable to be compatible with older versions of PHP (5.3, 5.4, etc). = 4.0.5 = *Release Date - 26 May 2018* * Corrected version number after tagging. Sorry... = 4.0.4 = *Release Date - 26 May 2018* * Added a hook to provide Akismet-specific privacy information for a site's privacy policy. * Added tools to control the display of a privacy related notice under comment forms. * Fixed HTML in activation failure message to close META and HEAD tag properly. * Fixed a bug that would sometimes prevent Akismet from being correctly auto-configured. = 4.0.3 = *Release Date - 19 February 2018* * Added a scheduled task to remove entries in wp_commentmeta that no longer have corresponding comments in wp_comments. * Added a new `akismet_batch_delete_count` action to the batch delete methods for people who'd like to keep track of the numbers of records being processed by those methods. = 4.0.2 = *Release Date - 18 December 2017* * Fixed a bug that could cause Akismet to recheck a comment that has already been manually approved or marked as spam. * Fixed a bug that could cause Akismet to claim that some comments are still waiting to be checked when no comments are waiting to be checked. = 4.0.1 = *Release Date - 6 November 2017* * Fixed a bug that could prevent some users from connecting Akismet via their Jetpack connection. * Ensured that any pending Akismet-related events are unscheduled if the plugin is deactivated. * Allow some JavaScript to be run asynchronously to avoid affecting page render speeds. = 4.0 = *Release Date - 19 September 2017* * Added REST API endpoints for configuring Akismet and retrieving stats. * Increased the minimum supported WordPress version to 4.0. * Added compatibility with comments submitted via the REST API. * Improved the progress indicator on the "Check for Spam" button. = 3.3.4 = *Release Date - 3 August 2017* * Disabled Akismet's debug log output by default unless AKISMET_DEBUG is defined. * URL previews now begin preloading when the mouse moves near them in the comments section of wp-admin. * When a comment is caught by the Comment Blacklist, Akismet will always allow it to stay in the trash even if it is spam as well. * Fixed a bug that was preventing an error from being shown when a site can't reach Akismet's servers. = 3.3.3 = *Release Date - 13 July 2017* * Reduced amount of bandwidth used by the URL Preview feature. * Improved the admin UI when the API key is manually pre-defined for the site. * Removed a workaround for WordPress installations older than 3.3 that will improve Akismet's compatibility with other plugins. * The number of spam blocked that is displayed on the WordPress dashboard will now be more accurate and updated more frequently. * Fixed a bug in the Akismet widget that could cause PHP warnings. = 3.3.2 = *Release Date - 10 May 2017* * Fixed a bug causing JavaScript errors in some browsers. = 3.3.1 = *Release Date - 2 May 2017* * Improve performance by only requesting the akismet_comment_nonce option when absolutely necessary. * Fixed two bugs that could cause PHP warnings. * Fixed a bug that was preventing the "Remove author URL" feature from working after a comment was edited using "Quick Edit." * Fixed a bug that was preventing the URL preview feature from working after a comment was edited using "Quick Edit." = 3.3 = *Release Date - 23 February 2017* * Updated the Akismet admin pages with a new clean design. * Fixed bugs preventing the `akismet_add_comment_nonce` and `akismet_update_alert` wrapper functions from working properly. * Fixed bug preventing the loading indicator from appearing when re-checking all comments for spam. * Added a progress indicator to the "Check for Spam" button. * Added a success message after manually rechecking the Pending queue for spam. = 3.2 = *Release Date - 6 September 2016* * Added a WP-CLI module. You can now check comments and recheck the moderation queue from the command line. * Stopped using the deprecated jQuery function `.live()`. * Fixed a bug in `remove_comment_author_url()` and `add_comment_author_url()` that could generate PHP notices. * Fixed a bug that could cause an infinite loop for sites with very very very large comment IDs. * Fixed a bug that could cause the Akismet widget title to be blank. = 3.1.11 = *Release Date - 12 May 2016* * Fixed a bug that could cause the "Check for Spam" button to skip some comments. * Fixed a bug that could prevent some spam submissions from being sent to Akismet. * Updated all links to use https:// when possible. * Disabled Akismet debug logging unless WP_DEBUG and WP_DEBUG_LOG are both enabled. = 3.1.10 = *Release Date - 1 April 2016* * Fixed a bug that could cause comments caught as spam to be placed in the Pending queue. * Fixed a bug that could have resulted in comments that were caught by the core WordPress comment blacklist not to have a corresponding History entry. * Fixed a bug that could have caused avoidable PHP warnings in the error log. = 3.1.9 = *Release Date - 28 March 2016* * Add compatibility with Jetpack so that Jetpack can automatically configure Akismet settings when appropriate. * Fixed a bug preventing some comment data from being sent to Akismet. = 3.1.8 = *Release Date - 4 March 2016* * Fixed a bug preventing Akismet from being used with some plugins that rewrite admin URLs. * Reduced the amount of bandwidth used on Akismet API calls * Reduced the amount of space Akismet uses in the database * Fixed a bug that could cause comments caught as spam to be placed in the Pending queue. = 3.1.7 = *Release Date - 4 January 2016* * Added documentation for the 'akismet_comment_nonce' filter. * The post-install activation button is now accessible to screen readers and keyboard-only users. * Fixed a bug that was preventing the "Remove author URL" feature from working in WordPress 4.4 = 3.1.6 = *Release Date - 14 December 2015* * Improve the notices shown after activating Akismet. * Update some strings to allow for the proper plural forms in all languages. = 3.1.5 = *Release Date - 13 October 2015* * Closes a potential XSS vulnerability. = 3.1.4 = *Release Date - 24 September 2015* * Fixed a bug that was preventing some users from automatically connecting using Jetpack if they didn't have a current Akismet subscription. * Fixed a bug that could cause comments caught as spam to be placed in the Pending queue. * Error messages and instructions have been simplified to be more understandable. * Link previews are enabled for all links inside comments, not just the author's website link. = 3.1.3 = *Release Date - 6 July 2015* * Notify users when their account status changes after previously being successfully set up. This should help any users who are seeing blank Akismet settings screens. = 3.1.2 = *Release Date - 7 June 2015* * Reduced the amount of space Akismet uses in the commentmeta table. * Fixed a bug where some comments with quotes in the author name weren't getting history entries * Pre-emptive security improvements to ensure that the Akismet plugin can't be used by attackers to compromise a WordPress installation. * Better UI for the key entry field: allow whitespace to be included at the beginning or end of the key and strip it out automatically when the form is submitted. * When deactivating the plugin, notify the Akismet API so the site can be marked as inactive. * Clearer error messages. = 3.1.1 = *Release Date - 17th March, 2015* * Improvements to the "Remove comment author URL" JavaScript * Include the pingback pre-check from the 2.6 branch. = 3.1 = *Release Date - 11th March, 2015* * Use HTTPS by default for all requests to Akismet. * Fix for a situation where Akismet might strip HTML from a comment. = 3.0.4 = *Release Date - 11th December, 2014* * Fix to make .htaccess compatible with Apache 2.4. * Fix to allow removal of https author URLs. * Fix to avoid stripping part of the author URL when removing and re-adding. * Removed the "Check for Spam" button from the "Trash" and "Approved" queues, where it would have no effect. * Allow automatic API key configuration when Jetpack is installed and connected to a WordPress.com account = 3.0.3 = *Release Date - 3rd November, 2014* * Fix for sending the wrong data to delete_comment action that could have prevented old spam comments from being deleted. * Added a filter to disable logging of Akismet debugging information. * Added a filter for the maximum comment age when deleting old spam comments. * Added a filter for the number per batch when deleting old spam comments. * Removed the "Check for Spam" button from the Spam folder. = 3.0.2 = *Release Date - 18th August, 2014* * Performance improvements. * Fixed a bug that could truncate the comment data being sent to Akismet for checking. = 3.0.1 = *Release Date - 9th July, 2014* * Removed dependency on PHP's fsockopen function * Fix spam/ham reports to work when reported outside of the WP dashboard, e.g., from Notifications or the WP app * Remove jQuery dependency for comment form JavaScript * Remove unnecessary data from some Akismet comment meta * Suspended keys will now result in all comments being put in moderation, not spam. = 3.0.0 = *Release Date - 15th April, 2014* * Move Akismet to Settings menu * Drop Akismet Stats menu * Add stats snapshot to Akismet settings * Add Akismet subscription details and status to Akismet settings * Add contextual help for each page * Improve Akismet setup to use Jetpack to automate plugin setup * Fix "Check for Spam" to use AJAX to avoid page timing out * Fix Akismet settings page to be responsive * Drop legacy code * Tidy up CSS and Javascript * Replace the old discard setting with a new "discard pervasive spam" feature. = 2.6.0 = *Release Date - 18th March, 2014* * Add ajax paging to the check for spam button to handle large volumes of comments * Optimize javascript and add localization support * Fix bug in link to spam comments from right now dashboard widget * Fix bug with deleting old comments to avoid timeouts dealing with large volumes of comments * Include X-Pingback-Forwarded-For header in outbound WordPress pingback verifications * Add pre-check for pingbacks, to stop spam before an outbound verification request is made = 2.5.9 = *Release Date - 1st August, 2013* * Update 'Already have a key' link to redirect page rather than depend on javascript * Fix some non-translatable strings to be translatable * Update Activation banner in plugins page to redirect user to Akismet config page = 2.5.8 = *Release Date - 20th January, 2013* * Simplify the activation process for new users * Remove the reporter_ip parameter * Minor preventative security improvements = 2.5.7 = *Release Date - 13th December, 2012* * FireFox Stats iframe preview bug * Fix mshots preview when using https * Add .htaccess to block direct access to files * Prevent some PHP notices * Fix Check For Spam return location when referrer is empty * Fix Settings links for network admins * Fix prepare() warnings in WP 3.5 = 2.5.6 = *Release Date - 26th April, 2012* * Prevent retry scheduling problems on sites where wp_cron is misbehaving * Preload mshot previews * Modernize the widget code * Fix a bug where comments were not held for moderation during an error condition * Improve the UX and display when comments are temporarily held due to an error * Make the Check For Spam button force a retry when comments are held due to an error * Handle errors caused by an invalid key * Don't retry comments that are too old * Improve error messages when verifying an API key = 2.5.5 = *Release Date - 11th January, 2012* * Add nonce check for comment author URL remove action * Fix the settings link = 2.5.4 = *Release Date - 5th January, 2012* * Limit Akismet CSS and Javascript loading in wp-admin to just the pages that need it * Added author URL quick removal functionality * Added mShot preview on Author URL hover * Added empty index.php to prevent directory listing * Move wp-admin menu items under Jetpack, if it is installed * Purge old Akismet comment meta data, default of 15 days = 2.5.3 = *Release Date - 8th Febuary, 2011* * Specify the license is GPL v2 or later * Fix a bug that could result in orphaned commentmeta entries * Include hotfix for WordPress 3.0.5 filter issue = 2.5.2 = *Release Date - 14th January, 2011* * Properly format the comment count for author counts * Look for super admins on multisite installs when looking up user roles * Increase the HTTP request timeout * Removed padding for author approved count * Fix typo in function name * Set Akismet stats iframe height to fixed 2500px. Better to have one tall scroll bar than two side by side. = 2.5.1 = *Release Date - 17th December, 2010* * Fix a bug that caused the "Auto delete" option to fail to discard comments correctly * Remove the comment nonce form field from the 'Akismet Configuration' page in favor of using a filter, akismet_comment_nonce * Fixed padding bug in "author" column of posts screen * Added margin-top to "cleared by ..." badges on dashboard * Fix possible error when calling akismet_cron_recheck() * Fix more PHP warnings * Clean up XHTML warnings for comment nonce * Fix for possible condition where scheduled comment re-checks could get stuck * Clean up the comment meta details after deleting a comment * Only show the status badge if the comment status has been changed by someone/something other than Akismet * Show a 'History' link in the row-actions * Translation fixes * Reduced font-size on author name * Moved "flagged by..." notification to top right corner of comment container and removed heavy styling * Hid "flagged by..." notification while on dashboard = 2.5.0 = *Release Date - 7th December, 2010* * Track comment actions under 'Akismet Status' on the edit comment screen * Fix a few remaining deprecated function calls ( props Mike Glendinning ) * Use HTTPS for the stats IFRAME when wp-admin is using HTTPS * Use the WordPress HTTP class if available * Move the admin UI code to a separate file, only loaded when needed * Add cron retry feature, to replace the old connectivity check * Display Akismet status badge beside each comment * Record history for each comment, and display it on the edit page * Record the complete comment as originally submitted in comment_meta, to use when reporting spam and ham * Highlight links in comment content * New option, "Show the number of comments you've approved beside each comment author." * New option, "Use a nonce on the comment form." = 2.4.0 = *Release Date - 23rd August, 2010* * Spell out that the license is GPLv2 * Fix PHP warnings * Fix WordPress deprecated function calls * Fire the delete_comment action when deleting comments * Move code specific for older WP versions to legacy.php * General code clean up = 2.3.0 = *Release Date - 5th June, 2010* * Fix "Are you sure" nonce message on config screen in WPMU * Fix XHTML compliance issue in sidebar widget * Change author link; remove some old references to WordPress.com accounts * Localize the widget title (core ticket #13879) = 2.2.9 = *Release Date - 2nd June, 2010* * Eliminate a potential conflict with some plugins that may cause spurious reports = 2.2.8 = *Release Date - 27th May, 2010* * Fix bug in initial comment check for ipv6 addresses * Report comments as ham when they are moved from spam to moderation * Report comments as ham when clicking undo after spam * Use transition_comment_status action when available instead of older actions for spam/ham submissions * Better diagnostic messages when PHP network functions are unavailable * Better handling of comments by logged-in users = 2.2.7 = *Release Date - 17th December, 2009* * Add a new AKISMET_VERSION constant * Reduce the possibility of over-counting spam when another spam filter plugin is in use * Disable the connectivity check when the API key is hard-coded for WPMU = 2.2.6 = *Release Date - 20th July, 2009* * Fix a global warning introduced in 2.2.5 * Add changelog and additional readme.txt tags * Fix an array conversion warning in some versions of PHP * Support a new WPCOM_API_KEY constant for easier use with WordPress MU = 2.2.5 = *Release Date - 13th July, 2009* * Include a new Server Connectivity diagnostic check, to detect problems caused by firewalls = 2.2.4 = *Release Date - 3rd June, 2009* * Fixed a key problem affecting the stats feature in WordPress MU * Provide additional blog information in Akismet API calls class.akismet-admin.php000064400000157541147177153510011134 0ustar00 array( 'href' => true, 'title' => true, ), 'b' => array(), 'code' => array(), 'del' => array( 'datetime' => true, ), 'em' => array(), 'i' => array(), 'q' => array( 'cite' => true, ), 'strike' => array(), 'strong' => array(), ); public static function init() { if ( ! self::$initiated ) { self::init_hooks(); } if ( isset( $_POST['action'] ) && $_POST['action'] == 'enter-key' ) { self::enter_api_key(); } } public static function init_hooks() { // The standalone stats page was removed in 3.0 for an all-in-one config and stats page. // Redirect any links that might have been bookmarked or in browser history. if ( isset( $_GET['page'] ) && 'akismet-stats-display' == $_GET['page'] ) { wp_safe_redirect( esc_url_raw( self::get_page_url( 'stats' ) ), 301 ); die; } self::$initiated = true; add_action( 'admin_init', array( 'Akismet_Admin', 'admin_init' ) ); add_action( 'admin_menu', array( 'Akismet_Admin', 'admin_menu' ), 5 ); # Priority 5, so it's called before Jetpack's admin_menu. add_action( 'admin_notices', array( 'Akismet_Admin', 'display_notice' ) ); add_action( 'admin_enqueue_scripts', array( 'Akismet_Admin', 'load_resources' ) ); add_action( 'activity_box_end', array( 'Akismet_Admin', 'dashboard_stats' ) ); add_action( 'rightnow_end', array( 'Akismet_Admin', 'rightnow_stats' ) ); add_action( 'manage_comments_nav', array( 'Akismet_Admin', 'check_for_spam_button' ) ); add_action( 'admin_action_akismet_recheck_queue', array( 'Akismet_Admin', 'recheck_queue' ) ); add_action( 'wp_ajax_akismet_recheck_queue', array( 'Akismet_Admin', 'recheck_queue' ) ); add_action( 'wp_ajax_comment_author_deurl', array( 'Akismet_Admin', 'remove_comment_author_url' ) ); add_action( 'wp_ajax_comment_author_reurl', array( 'Akismet_Admin', 'add_comment_author_url' ) ); add_action( 'jetpack_auto_activate_akismet', array( 'Akismet_Admin', 'connect_jetpack_user' ) ); add_filter( 'plugin_action_links', array( 'Akismet_Admin', 'plugin_action_links' ), 10, 2 ); add_filter( 'comment_row_actions', array( 'Akismet_Admin', 'comment_row_action' ), 10, 2 ); add_filter( 'plugin_action_links_'.plugin_basename( plugin_dir_path( __FILE__ ) . 'akismet.php'), array( 'Akismet_Admin', 'admin_plugin_settings_link' ) ); add_filter( 'wxr_export_skip_commentmeta', array( 'Akismet_Admin', 'exclude_commentmeta_from_export' ), 10, 3 ); add_filter( 'all_plugins', array( 'Akismet_Admin', 'modify_plugin_description' ) ); // priority=1 because we need ours to run before core's comment anonymizer runs, and that's registered at priority=10 add_filter( 'wp_privacy_personal_data_erasers', array( 'Akismet_Admin', 'register_personal_data_eraser' ), 1 ); } public static function admin_init() { if ( get_option( 'Activated_Akismet' ) ) { delete_option( 'Activated_Akismet' ); if ( ! headers_sent() ) { $admin_url = self::get_page_url( 'init' ); wp_redirect( $admin_url ); } } load_plugin_textdomain( 'akismet' ); add_meta_box( 'akismet-status', __('Comment History', 'akismet'), array( 'Akismet_Admin', 'comment_status_meta_box' ), 'comment', 'normal' ); if ( function_exists( 'wp_add_privacy_policy_content' ) ) { wp_add_privacy_policy_content( __( 'Akismet', 'akismet' ), __( 'We collect information about visitors who comment on Sites that use our Akismet Anti-spam service. The information we collect depends on how the User sets up Akismet for the Site, but typically includes the commenter\'s IP address, user agent, referrer, and Site URL (along with other information directly provided by the commenter such as their name, username, email address, and the comment itself).', 'akismet' ) ); } } public static function admin_menu() { if ( class_exists( 'Jetpack' ) ) { add_action( 'jetpack_admin_menu', array( 'Akismet_Admin', 'load_menu' ) ); } else { self::load_menu(); } } public static function admin_head() { if ( !current_user_can( 'manage_options' ) ) return; } public static function admin_plugin_settings_link( $links ) { $settings_link = ''.__('Settings', 'akismet').''; array_unshift( $links, $settings_link ); return $links; } public static function load_menu() { if ( class_exists( 'Jetpack' ) ) { $hook = add_submenu_page( 'jetpack', __( 'Akismet Anti-spam', 'akismet' ), __( 'Akismet Anti-spam', 'akismet' ), 'manage_options', 'akismet-key-config', array( 'Akismet_Admin', 'display_page' ) ); } else { $hook = add_options_page( __( 'Akismet Anti-spam', 'akismet' ), __( 'Akismet Anti-spam', 'akismet' ), 'manage_options', 'akismet-key-config', array( 'Akismet_Admin', 'display_page' ) ); } if ( $hook ) { add_action( "load-$hook", array( 'Akismet_Admin', 'admin_help' ) ); } } public static function load_resources() { global $hook_suffix; if ( in_array( $hook_suffix, apply_filters( 'akismet_admin_page_hook_suffixes', array( 'index.php', # dashboard 'edit-comments.php', 'comment.php', 'post.php', 'settings_page_akismet-key-config', 'jetpack_page_akismet-key-config', 'plugins.php', ) ) ) ) { $akismet_css_path = is_rtl() ? '_inc/rtl/akismet-rtl.css' : '_inc/akismet.css'; wp_register_style( 'akismet', plugin_dir_url( __FILE__ ) . $akismet_css_path, array(), self::get_asset_file_version( $akismet_css_path ) ); wp_enqueue_style( 'akismet' ); wp_register_style( 'akismet-font-inter', plugin_dir_url( __FILE__ ) . '_inc/fonts/inter.css', array(), self::get_asset_file_version( '_inc/fonts/inter.css' ) ); wp_enqueue_style( 'akismet-font-inter' ); $akismet_admin_css_path = is_rtl() ? '_inc/rtl/akismet-admin-rtl.css' : '_inc/akismet-admin.css'; wp_register_style( 'akismet-admin', plugin_dir_url( __FILE__ ) . $akismet_admin_css_path, array(), self::get_asset_file_version( $akismet_admin_css_path ) ); wp_enqueue_style( 'akismet-admin' ); wp_register_script( 'akismet.js', plugin_dir_url( __FILE__ ) . '_inc/akismet.js', array( 'jquery' ), self::get_asset_file_version( '_inc/akismet.js' ) ); wp_enqueue_script( 'akismet.js' ); wp_register_script( 'akismet-admin.js', plugin_dir_url( __FILE__ ) . '_inc/akismet-admin.js', array(), self::get_asset_file_version( '/_inc/akismet-admin.js' ) ); wp_enqueue_script( 'akismet-admin.js' ); $inline_js = array( 'comment_author_url_nonce' => wp_create_nonce( 'comment_author_url_nonce' ), 'strings' => array( 'Remove this URL' => __( 'Remove this URL' , 'akismet'), 'Removing...' => __( 'Removing...' , 'akismet'), 'URL removed' => __( 'URL removed' , 'akismet'), '(undo)' => __( '(undo)' , 'akismet'), 'Re-adding...' => __( 'Re-adding...' , 'akismet'), ) ); if ( isset( $_GET['akismet_recheck'] ) && wp_verify_nonce( $_GET['akismet_recheck'], 'akismet_recheck' ) ) { $inline_js['start_recheck'] = true; } if ( apply_filters( 'akismet_enable_mshots', true ) ) { $inline_js['enable_mshots'] = true; } wp_localize_script( 'akismet.js', 'WPAkismet', $inline_js ); } } /** * Add help to the Akismet page * * @return false if not the Akismet page */ public static function admin_help() { $current_screen = get_current_screen(); // Screen Content if ( current_user_can( 'manage_options' ) ) { if ( !Akismet::get_api_key() || ( isset( $_GET['view'] ) && $_GET['view'] == 'start' ) ) { //setup page $current_screen->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' , 'akismet'), 'content' => '

' . esc_html__( 'Akismet Setup' , 'akismet') . '

' . '

' . esc_html__( 'Akismet filters out spam, so you can focus on more important things.' , 'akismet') . '

' . '

' . esc_html__( 'On this page, you are able to set up the Akismet plugin.' , 'akismet') . '

', ) ); $current_screen->add_help_tab( array( 'id' => 'setup-signup', 'title' => __( 'New to Akismet' , 'akismet'), 'content' => '

' . esc_html__( 'Akismet Setup' , 'akismet') . '

' . '

' . esc_html__( 'You need to enter an API key to activate the Akismet service on your site.' , 'akismet') . '

' . '

' . sprintf( __( 'Sign up for an account on %s to get an API Key.' , 'akismet'), 'Akismet.com' ) . '

', ) ); $current_screen->add_help_tab( array( 'id' => 'setup-manual', 'title' => __( 'Enter an API Key' , 'akismet'), 'content' => '

' . esc_html__( 'Akismet Setup' , 'akismet') . '

' . '

' . esc_html__( 'If you already have an API key' , 'akismet') . '

' . '
    ' . '
  1. ' . esc_html__( 'Copy and paste the API key into the text field.' , 'akismet') . '
  2. ' . '
  3. ' . esc_html__( 'Click the Use this Key button.' , 'akismet') . '
  4. ' . '
', ) ); } elseif ( isset( $_GET['view'] ) && $_GET['view'] == 'stats' ) { //stats page $current_screen->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' , 'akismet'), 'content' => '

' . esc_html__( 'Akismet Stats' , 'akismet') . '

' . '

' . esc_html__( 'Akismet filters out spam, so you can focus on more important things.' , 'akismet') . '

' . '

' . esc_html__( 'On this page, you are able to view stats on spam filtered on your site.' , 'akismet') . '

', ) ); } else { //configuration page $current_screen->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' , 'akismet'), 'content' => '

' . esc_html__( 'Akismet Configuration' , 'akismet') . '

' . '

' . esc_html__( 'Akismet filters out spam, so you can focus on more important things.' , 'akismet') . '

' . '

' . esc_html__( 'On this page, you are able to update your Akismet settings and view spam stats.' , 'akismet') . '

', ) ); $current_screen->add_help_tab( array( 'id' => 'settings', 'title' => __( 'Settings' , 'akismet'), 'content' => '

' . esc_html__( 'Akismet Configuration' , 'akismet') . '

' . ( Akismet::predefined_api_key() ? '' : '

' . esc_html__( 'API Key' , 'akismet') . ' - ' . esc_html__( 'Enter/remove an API key.' , 'akismet') . '

' ) . '

' . esc_html__( 'Comments' , 'akismet') . ' - ' . esc_html__( 'Show the number of approved comments beside each comment author in the comments list page.' , 'akismet') . '

' . '

' . esc_html__( 'Strictness' , 'akismet') . ' - ' . esc_html__( 'Choose to either discard the worst spam automatically or to always put all spam in spam folder.' , 'akismet') . '

', ) ); if ( ! Akismet::predefined_api_key() ) { $current_screen->add_help_tab( array( 'id' => 'account', 'title' => __( 'Account' , 'akismet'), 'content' => '

' . esc_html__( 'Akismet Configuration' , 'akismet') . '

' . '

' . esc_html__( 'Subscription Type' , 'akismet') . ' - ' . esc_html__( 'The Akismet subscription plan' , 'akismet') . '

' . '

' . esc_html__( 'Status' , 'akismet') . ' - ' . esc_html__( 'The subscription status - active, cancelled or suspended' , 'akismet') . '

', ) ); } } } // Help Sidebar $current_screen->set_help_sidebar( '

' . esc_html__( 'For more information:' , 'akismet') . '

' . '

' . esc_html__( 'Akismet FAQ' , 'akismet') . '

' . '

' . esc_html__( 'Akismet Support' , 'akismet') . '

' ); } public static function enter_api_key() { if ( ! current_user_can( 'manage_options' ) ) { die( __( 'Cheatin’ uh?', 'akismet' ) ); } if ( !wp_verify_nonce( $_POST['_wpnonce'], self::NONCE ) ) return false; foreach( array( 'akismet_strictness', 'akismet_show_user_comments_approved' ) as $option ) { update_option( $option, isset( $_POST[$option] ) && (int) $_POST[$option] == 1 ? '1' : '0' ); } if ( ! empty( $_POST['akismet_comment_form_privacy_notice'] ) ) { self::set_form_privacy_notice_option( $_POST['akismet_comment_form_privacy_notice'] ); } else { self::set_form_privacy_notice_option( 'hide' ); } if ( Akismet::predefined_api_key() ) { return false; //shouldn't have option to save key if already defined } $new_key = preg_replace( '/[^a-f0-9]/i', '', $_POST['key'] ); $old_key = Akismet::get_api_key(); if ( empty( $new_key ) ) { if ( !empty( $old_key ) ) { delete_option( 'wordpress_api_key' ); self::$notices[] = 'new-key-empty'; } } elseif ( $new_key != $old_key ) { self::save_key( $new_key ); } return true; } public static function save_key( $api_key ) { $key_status = Akismet::verify_key( $api_key ); if ( $key_status == 'valid' ) { $akismet_user = self::get_akismet_user( $api_key ); if ( $akismet_user ) { if ( in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub' ) ) ) update_option( 'wordpress_api_key', $api_key ); if ( $akismet_user->status == 'active' ) self::$notices['status'] = 'new-key-valid'; elseif ( $akismet_user->status == 'notice' ) self::$notices['status'] = $akismet_user; else self::$notices['status'] = $akismet_user->status; } else self::$notices['status'] = 'new-key-invalid'; } elseif ( in_array( $key_status, array( 'invalid', 'failed' ) ) ) self::$notices['status'] = 'new-key-'.$key_status; } public static function dashboard_stats() { if ( did_action( 'rightnow_end' ) ) { return; // We already displayed this info in the "Right Now" section } if ( !$count = get_option('akismet_spam_count') ) return; global $submenu; echo '

' . esc_html( _x( 'Spam', 'comments' , 'akismet') ) . '

'; echo '

'.sprintf( _n( 'Akismet has protected your site from %3$s spam comment.', 'Akismet has protected your site from %3$s spam comments.', $count , 'akismet'), 'https://akismet.com/wordpress/', esc_url( add_query_arg( array( 'page' => 'akismet-admin' ), admin_url( isset( $submenu['edit-comments.php'] ) ? 'edit-comments.php' : 'edit.php' ) ) ), number_format_i18n($count) ).'

'; } // WP 2.5+ public static function rightnow_stats() { if ( $count = get_option('akismet_spam_count') ) { $intro = sprintf( _n( 'Akismet has protected your site from %2$s spam comment already. ', 'Akismet has protected your site from %2$s spam comments already. ', $count , 'akismet'), 'https://akismet.com/wordpress/', number_format_i18n( $count ) ); } else { $intro = sprintf( __('Akismet blocks spam from getting to your blog. ', 'akismet'), 'https://akismet.com/wordpress/' ); } $link = add_query_arg( array( 'comment_status' => 'spam' ), admin_url( 'edit-comments.php' ) ); if ( $queue_count = self::get_spam_count() ) { $queue_text = sprintf( _n( 'There’s %1$s comment in your spam queue right now.', 'There are %1$s comments in your spam queue right now.', $queue_count , 'akismet'), number_format_i18n( $queue_count ), esc_url( $link ) ); } else { $queue_text = sprintf( __( "There’s nothing in your spam queue at the moment." , 'akismet'), esc_url( $link ) ); } $text = $intro . '
' . $queue_text; echo "

$text

\n"; } public static function check_for_spam_button( $comment_status ) { // The "Check for Spam" button should only appear when the page might be showing // a comment with comment_approved=0, which means an un-trashed, un-spammed, // not-yet-moderated comment. if ( 'all' != $comment_status && 'moderated' != $comment_status ) { return; } $link = ''; $comments_count = wp_count_comments(); echo ''; echo '
'; $classes = array( 'button-secondary', 'checkforspam', 'button-disabled' // Disable button until the page is loaded ); if ( $comments_count->moderated > 0 ) { $classes[] = 'enable-on-load'; if ( ! Akismet::get_api_key() ) { $link = self::get_page_url(); $classes[] = 'ajax-disabled'; } } echo '' . esc_html__('Check for Spam', 'akismet') . ''; echo ''; } public static function recheck_queue() { global $wpdb; Akismet::fix_scheduled_recheck(); if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) ) { return; } if ( ! wp_verify_nonce( $_POST['nonce'], 'akismet_check_for_spam' ) ) { wp_send_json( array( 'error' => __( 'You don’t have permission to do that.', 'akismet' ), )); return; } $result_counts = self::recheck_queue_portion( empty( $_POST['offset'] ) ? 0 : $_POST['offset'], empty( $_POST['limit'] ) ? 100 : $_POST['limit'] ); if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { wp_send_json( array( 'counts' => $result_counts, )); } else { $redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : admin_url( 'edit-comments.php' ); wp_safe_redirect( $redirect_to ); exit; } } public static function recheck_queue_portion( $start = 0, $limit = 100 ) { global $wpdb; $paginate = ''; if ( $limit <= 0 ) { $limit = 100; } if ( $start < 0 ) { $start = 0; } $moderation = $wpdb->get_col( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_approved = '0' LIMIT %d OFFSET %d", $limit, $start ) ); $result_counts = array( 'processed' => is_countable( $moderation ) ? count( $moderation ) : 0, 'spam' => 0, 'ham' => 0, 'error' => 0, ); foreach ( $moderation as $comment_id ) { $api_response = Akismet::recheck_comment( $comment_id, 'recheck_queue' ); if ( 'true' === $api_response ) { ++$result_counts['spam']; } elseif ( 'false' === $api_response ) { ++$result_counts['ham']; } else { ++$result_counts['error']; } } return $result_counts; } // Adds an 'x' link next to author URLs, clicking will remove the author URL and show an undo link public static function remove_comment_author_url() { if ( !empty( $_POST['id'] ) && check_admin_referer( 'comment_author_url_nonce' ) ) { $comment_id = intval( $_POST['id'] ); $comment = get_comment( $comment_id, ARRAY_A ); if ( $comment && current_user_can( 'edit_comment', $comment['comment_ID'] ) ) { $comment['comment_author_url'] = ''; do_action( 'comment_remove_author_url' ); print( wp_update_comment( $comment ) ); die(); } } } public static function add_comment_author_url() { if ( !empty( $_POST['id'] ) && !empty( $_POST['url'] ) && check_admin_referer( 'comment_author_url_nonce' ) ) { $comment_id = intval( $_POST['id'] ); $comment = get_comment( $comment_id, ARRAY_A ); if ( $comment && current_user_can( 'edit_comment', $comment['comment_ID'] ) ) { $comment['comment_author_url'] = esc_url( $_POST['url'] ); do_action( 'comment_add_author_url' ); print( wp_update_comment( $comment ) ); die(); } } } public static function comment_row_action( $a, $comment ) { $akismet_result = get_comment_meta( $comment->comment_ID, 'akismet_result', true ); if ( ! $akismet_result && get_comment_meta( $comment->comment_ID, 'akismet_skipped', true ) ) { $akismet_result = 'skipped'; // Akismet chose to skip the comment-check request. } $akismet_error = get_comment_meta( $comment->comment_ID, 'akismet_error', true ); $user_result = get_comment_meta( $comment->comment_ID, 'akismet_user_result', true ); $comment_status = wp_get_comment_status( $comment->comment_ID ); $desc = null; if ( $akismet_error ) { $desc = __( 'Awaiting spam check' , 'akismet'); } elseif ( !$user_result || $user_result == $akismet_result ) { // Show the original Akismet result if the user hasn't overridden it, or if their decision was the same if ( $akismet_result == 'true' && $comment_status != 'spam' && $comment_status != 'trash' ) $desc = __( 'Flagged as spam by Akismet' , 'akismet'); elseif ( $akismet_result == 'false' && $comment_status == 'spam' ) $desc = __( 'Cleared by Akismet' , 'akismet'); } else { $who = get_comment_meta( $comment->comment_ID, 'akismet_user', true ); if ( $user_result == 'true' ) $desc = sprintf( __('Flagged as spam by %s', 'akismet'), $who ); else $desc = sprintf( __('Un-spammed by %s', 'akismet'), $who ); } // add a History item to the hover links, just after Edit if ( $akismet_result && is_array( $a ) ) { $b = array(); foreach ( $a as $k => $item ) { $b[ $k ] = $item; if ( $k == 'edit' || $k == 'unspam' ) { $b['history'] = ' '. esc_html__('History', 'akismet') . ''; } } $a = $b; } if ( $desc ) echo ''.esc_html( $desc ).''; $show_user_comments_option = get_option( 'akismet_show_user_comments_approved' ); if ( $show_user_comments_option === false ) { // Default to active if the user hasn't made a decision. $show_user_comments_option = '1'; } $show_user_comments = apply_filters( 'akismet_show_user_comments_approved', $show_user_comments_option ); $show_user_comments = $show_user_comments === 'false' ? false : $show_user_comments; //option used to be saved as 'false' / 'true' if ( $show_user_comments ) { $comment_count = Akismet::get_user_comments_approved( $comment->user_id, $comment->comment_author_email, $comment->comment_author, $comment->comment_author_url ); $comment_count = intval( $comment_count ); echo ''; } return $a; } public static function comment_status_meta_box( $comment ) { $history = Akismet::get_comment_history( $comment->comment_ID ); if ( $history ) { foreach ( $history as $row ) { $message = ''; if ( ! empty( $row['message'] ) ) { // Old versions of Akismet stored the message as a literal string in the commentmeta. // New versions don't do that for two reasons: // 1) Save space. // 2) The message can be translated into the current language of the blog, not stuck // in the language of the blog when the comment was made. $message = esc_html( $row['message'] ); } else if ( ! empty( $row['event'] ) ) { // If possible, use a current translation. switch ( $row['event'] ) { case 'recheck-spam': $message = esc_html( __( 'Akismet re-checked and caught this comment as spam.', 'akismet' ) ); break; case 'check-spam': $message = esc_html( __( 'Akismet caught this comment as spam.', 'akismet' ) ); break; case 'recheck-ham': $message = esc_html( __( 'Akismet re-checked and cleared this comment.', 'akismet' ) ); break; case 'check-ham': $message = esc_html( __( 'Akismet cleared this comment.', 'akismet' ) ); break; case 'wp-blacklisted': case 'wp-disallowed': $message = sprintf( /* translators: The placeholder is a WordPress PHP function name. */ esc_html( __( 'Comment was caught by %s.', 'akismet' ) ), function_exists( 'wp_check_comment_disallowed_list' ) ? 'wp_check_comment_disallowed_list' : 'wp_blacklist_check' ); break; case 'report-spam': if ( isset( $row['user'] ) ) { /* translators: The placeholder is a username. */ $message = esc_html( sprintf( __( '%s reported this comment as spam.', 'akismet' ), $row['user'] ) ); } else if ( ! $message ) { $message = esc_html( __( 'This comment was reported as spam.', 'akismet' ) ); } break; case 'report-ham': if ( isset( $row['user'] ) ) { /* translators: The placeholder is a username. */ $message = esc_html( sprintf( __( '%s reported this comment as not spam.', 'akismet' ), $row['user'] ) ); } else if ( ! $message ) { $message = esc_html( __( 'This comment was reported as not spam.', 'akismet' ) ); } break; case 'cron-retry-spam': $message = esc_html( __( 'Akismet caught this comment as spam during an automatic retry.', 'akismet' ) ); break; case 'cron-retry-ham': $message = esc_html( __( 'Akismet cleared this comment during an automatic retry.', 'akismet' ) ); break; case 'check-error': if ( isset( $row['meta'], $row['meta']['response'] ) ) { /* translators: The placeholder is an error response returned by the API server. */ $message = sprintf( esc_html( __( 'Akismet was unable to check this comment (response: %s) but will automatically retry later.', 'akismet' ) ), '' . esc_html( $row['meta']['response'] ) . '' ); } else { $message = esc_html( __( 'Akismet was unable to check this comment but will automatically retry later.', 'akismet' ) ); } break; case 'recheck-error': if ( isset( $row['meta'], $row['meta']['response'] ) ) { /* translators: The placeholder is an error response returned by the API server. */ $message = sprintf( esc_html( __( 'Akismet was unable to recheck this comment (response: %s).', 'akismet' ) ), '' . esc_html( $row['meta']['response'] ) . '' ); } else { $message = esc_html( __( 'Akismet was unable to recheck this comment.', 'akismet' ) ); } break; case 'webhook-spam': $message = esc_html( __( 'Akismet caught this comment as spam and updated its status via webhook.', 'akismet' ) ); break; case 'webhook-ham': $message = esc_html( __( 'Akismet cleared this comment and updated its status via webhook.', 'akismet' ) ); break; case 'webhook-spam-noaction': $message = esc_html( __( 'Akismet determined this comment was spam during a recheck. It did not update the comment status because it had already been modified by another user or plugin.', 'akismet' ) ); break; case 'webhook-ham-noaction': $message = esc_html( __( 'Akismet cleared this comment during a recheck. It did not update the comment status because it had already been modified by another user or plugin.', 'akismet' ) ); break; case 'akismet-skipped': $message = esc_html( __( 'This comment was not sent to Akismet when it was submitted because it was caught by something else.', 'akismet' ) ); break; case 'akismet-skipped-disallowed': $message = esc_html( __( 'This comment was not sent to Akismet when it was submitted because it was caught by the comment disallowed list.', 'akismet' ) ); break; default: if ( preg_match( '/^status-changed/', $row['event'] ) ) { // Half of these used to be saved without the dash after 'status-changed'. // See https://plugins.trac.wordpress.org/changeset/1150658/akismet/trunk $new_status = preg_replace( '/^status-changed-?/', '', $row['event'] ); /* translators: The placeholder is a short string (like 'spam' or 'approved') denoting the new comment status. */ $message = sprintf( esc_html( __( 'Comment status was changed to %s', 'akismet' ) ), '' . esc_html( $new_status ) . '' ); } else if ( preg_match( '/^status-/', $row['event'] ) ) { $new_status = preg_replace( '/^status-/', '', $row['event'] ); if ( isset( $row['user'] ) ) { /* translators: %1$s is a username; %2$s is a short string (like 'spam' or 'approved') denoting the new comment status. */ $message = sprintf( esc_html( __( '%1$s changed the comment status to %2$s.', 'akismet' ) ), $row['user'], '' . esc_html( $new_status ) . '' ); } } break; } } if ( ! empty( $message ) ) { echo '

'; if ( isset( $row['time'] ) ) { $time = gmdate( 'D d M Y @ h:i:s a', (int) $row['time'] ) . ' GMT'; /* translators: The placeholder is an amount of time, like "7 seconds" or "3 days" returned by the function human_time_diff(). */ $time_html = '' . sprintf( esc_html__( '%s ago', 'akismet' ), human_time_diff( $row['time'] ) ) . ''; echo sprintf( /* translators: %1$s is a human-readable time difference, like "3 hours ago", and %2$s is an already-translated phrase describing how a comment's status changed, like "This comment was reported as spam." */ esc_html( __( '%1$s - %2$s', 'akismet' ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped $time_html, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped $message ); // esc_html() is done above so that we can use HTML in $message. } else { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $message; // esc_html() is done above so that we can use HTML in $message. } echo '

'; } } } else { echo '

'; echo esc_html( __( 'No comment history.', 'akismet' ) ); echo '

'; } } public static function plugin_action_links( $links, $file ) { if ( $file == plugin_basename( plugin_dir_url( __FILE__ ) . '/akismet.php' ) ) { $links[] = ''.esc_html__( 'Settings' , 'akismet').''; } return $links; } // Total spam in queue // get_option( 'akismet_spam_count' ) is the total caught ever public static function get_spam_count( $type = false ) { global $wpdb; if ( !$type ) { // total $count = wp_cache_get( 'akismet_spam_count', 'widget' ); if ( false === $count ) { $count = wp_count_comments(); $count = $count->spam; wp_cache_set( 'akismet_spam_count', $count, 'widget', 3600 ); } return $count; } elseif ( 'comments' == $type || 'comment' == $type ) { // comments $type = ''; } return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(comment_ID) FROM {$wpdb->comments} WHERE comment_approved = 'spam' AND comment_type = %s", $type ) ); } // Check connectivity between the WordPress blog and Akismet's servers. // Returns an associative array of server IP addresses, where the key is the IP address, and value is true (available) or false (unable to connect). public static function check_server_ip_connectivity() { $servers = $ips = array(); // Some web hosts may disable this function if ( function_exists( 'gethostbynamel' ) ) { $ips = gethostbynamel( 'rest.akismet.com' ); if ( $ips && is_array($ips) && count($ips) ) { $api_key = Akismet::get_api_key(); foreach ( $ips as $ip ) { $response = Akismet::verify_key( $api_key, $ip ); // even if the key is invalid, at least we know we have connectivity if ( $response == 'valid' || $response == 'invalid' ) $servers[$ip] = 'connected'; else $servers[$ip] = $response ? $response : 'unable to connect'; } } } return $servers; } // Simpler connectivity check public static function check_server_connectivity($cache_timeout = 86400) { $debug = array(); $debug[ 'PHP_VERSION' ] = PHP_VERSION; $debug[ 'WORDPRESS_VERSION' ] = $GLOBALS['wp_version']; $debug[ 'AKISMET_VERSION' ] = AKISMET_VERSION; $debug[ 'AKISMET__PLUGIN_DIR' ] = AKISMET__PLUGIN_DIR; $debug[ 'SITE_URL' ] = site_url(); $debug[ 'HOME_URL' ] = home_url(); $servers = get_option('akismet_available_servers'); if ( (time() - get_option('akismet_connectivity_time') < $cache_timeout) && $servers !== false ) { $servers = self::check_server_ip_connectivity(); update_option('akismet_available_servers', $servers); update_option('akismet_connectivity_time', time()); } if ( wp_http_supports( array( 'ssl' ) ) ) { $response = wp_remote_get( 'https://rest.akismet.com/1.1/test' ); } else { $response = wp_remote_get( 'http://rest.akismet.com/1.1/test' ); } $debug[ 'gethostbynamel' ] = function_exists('gethostbynamel') ? 'exists' : 'not here'; $debug[ 'Servers' ] = $servers; $debug[ 'Test Connection' ] = $response; Akismet::log( $debug ); if ( $response && 'connected' == wp_remote_retrieve_body( $response ) ) return true; return false; } // Check the server connectivity and store the available servers in an option. public static function get_server_connectivity($cache_timeout = 86400) { return self::check_server_connectivity( $cache_timeout ); } /** * Find out whether any comments in the Pending queue have not yet been checked by Akismet. * * @return bool */ public static function are_any_comments_waiting_to_be_checked() { return !! get_comments( array( // Exclude comments that are not pending. This would happen if someone manually approved or spammed a comment // that was waiting to be checked. The akismet_error meta entry will eventually be removed by the cron recheck job. 'status' => 'hold', // This is the commentmeta that is saved when a comment couldn't be checked. 'meta_key' => 'akismet_error', // We only need to know whether at least one comment is waiting for a check. 'number' => 1, ) ); } public static function get_page_url( $page = 'config' ) { $args = array( 'page' => 'akismet-key-config' ); if ( $page == 'stats' ) { $args = array( 'page' => 'akismet-key-config', 'view' => 'stats' ); } elseif ( $page == 'delete_key' ) { $args = array( 'page' => 'akismet-key-config', 'view' => 'start', 'action' => 'delete-key', '_wpnonce' => wp_create_nonce( self::NONCE ) ); } elseif ( $page === 'init' ) { $args = array( 'page' => 'akismet-key-config', 'view' => 'start' ); } return add_query_arg( $args, menu_page_url( 'akismet-key-config', false ) ); } public static function get_akismet_user( $api_key ) { $akismet_user = false; $request_args = array( 'key' => $api_key, 'blog' => get_option( 'home' ), ); $request_args = apply_filters( 'akismet_request_args', $request_args, 'get-subscription' ); $subscription_verification = Akismet::http_post( Akismet::build_query( $request_args ), 'get-subscription' ); if ( ! empty( $subscription_verification[1] ) ) { if ( 'invalid' !== $subscription_verification[1] ) { $akismet_user = json_decode( $subscription_verification[1] ); } } return $akismet_user; } public static function get_stats( $api_key ) { $stat_totals = array(); foreach( array( '6-months', 'all' ) as $interval ) { $request_args = array( 'blog' => get_option( 'home' ), 'key' => $api_key, 'from' => $interval, ); $request_args = apply_filters( 'akismet_request_args', $request_args, 'get-stats' ); $response = Akismet::http_post( Akismet::build_query( $request_args ), 'get-stats' ); if ( ! empty( $response[1] ) ) { $data = json_decode( $response[1] ); /* * The json decoded response should be an object. If it's not an object, something's wrong, and the data * shouldn't be added to the stats_totals array. */ if ( is_object( $data ) ) { $stat_totals[ $interval ] = $data; } } } return $stat_totals; } public static function verify_wpcom_key( $api_key, $user_id, $extra = array() ) { $request_args = array_merge( array( 'user_id' => $user_id, 'api_key' => $api_key, 'get_account_type' => 'true', ), $extra ); $request_args = apply_filters( 'akismet_request_args', $request_args, 'verify-wpcom-key' ); $akismet_account = Akismet::http_post( Akismet::build_query( $request_args ), 'verify-wpcom-key' ); if ( ! empty( $akismet_account[1] ) ) $akismet_account = json_decode( $akismet_account[1] ); Akismet::log( compact( 'akismet_account' ) ); return $akismet_account; } public static function connect_jetpack_user() { if ( $jetpack_user = self::get_jetpack_user() ) { if ( isset( $jetpack_user['user_id'] ) && isset( $jetpack_user['api_key'] ) ) { $akismet_user = self::verify_wpcom_key( $jetpack_user['api_key'], $jetpack_user['user_id'], array( 'action' => 'connect_jetpack_user' ) ); if ( is_object( $akismet_user ) ) { self::save_key( $akismet_user->api_key ); return in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub' ) ); } } } return false; } public static function display_alert() { Akismet::view( 'notice', array( 'type' => 'alert', 'code' => (int) get_option( 'akismet_alert_code' ), 'msg' => get_option( 'akismet_alert_msg' ) ) ); } public static function get_usage_limit_alert_data() { return array( 'type' => 'usage-limit', 'code' => (int) get_option( 'akismet_alert_code' ), 'msg' => get_option( 'akismet_alert_msg' ), 'api_calls' => get_option( 'akismet_alert_api_calls' ), 'usage_limit' => get_option( 'akismet_alert_usage_limit' ), 'upgrade_plan' => get_option( 'akismet_alert_upgrade_plan' ), 'upgrade_url' => get_option( 'akismet_alert_upgrade_url' ), 'upgrade_type' => get_option( 'akismet_alert_upgrade_type' ), 'upgrade_via_support' => get_option( 'akismet_alert_upgrade_via_support' ) === 'true', ); } public static function display_usage_limit_alert() { Akismet::view( 'notice', self::get_usage_limit_alert_data() ); } public static function display_spam_check_warning() { Akismet::fix_scheduled_recheck(); if ( wp_next_scheduled('akismet_schedule_cron_recheck') > time() && self::are_any_comments_waiting_to_be_checked() ) { /* * The 'akismet_display_cron_disabled_notice' filter can be used to control whether the WP-Cron disabled notice is displayed. */ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON && apply_filters( 'akismet_display_cron_disabled_notice', true ) ) { Akismet::view( 'notice', array( 'type' => 'spam-check-cron-disabled' ) ); } else { /* translators: The Akismet configuration page URL. */ $link_text = apply_filters( 'akismet_spam_check_warning_link_text', sprintf( __( 'Please check your Akismet configuration and contact your web host if problems persist.', 'akismet' ), esc_url( self::get_page_url() ) ) ); Akismet::view( 'notice', array( 'type' => 'spam-check', 'link_text' => $link_text ) ); } } } public static function display_api_key_warning() { Akismet::view( 'notice', array( 'type' => 'plugin' ) ); } public static function display_page() { if ( !Akismet::get_api_key() || ( isset( $_GET['view'] ) && $_GET['view'] == 'start' ) ) self::display_start_page(); elseif ( isset( $_GET['view'] ) && $_GET['view'] == 'stats' ) self::display_stats_page(); else self::display_configuration_page(); } public static function display_start_page() { if ( isset( $_GET['action'] ) ) { if ( $_GET['action'] == 'delete-key' ) { if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], self::NONCE ) ) delete_option( 'wordpress_api_key' ); } } if ( $api_key = Akismet::get_api_key() && ( empty( self::$notices['status'] ) || 'existing-key-invalid' != self::$notices['status'] ) ) { self::display_configuration_page(); return; } //the user can choose to auto connect their API key by clicking a button on the akismet done page //if jetpack, get verified api key by using connected wpcom user id //if no jetpack, get verified api key by using an akismet token $akismet_user = false; if ( isset( $_GET['token'] ) && preg_match('/^(\d+)-[0-9a-f]{20}$/', $_GET['token'] ) ) $akismet_user = self::verify_wpcom_key( '', '', array( 'token' => $_GET['token'] ) ); elseif ( $jetpack_user = self::get_jetpack_user() ) $akismet_user = self::verify_wpcom_key( $jetpack_user['api_key'], $jetpack_user['user_id'] ); if ( isset( $_GET['action'] ) ) { if ( $_GET['action'] == 'save-key' ) { if ( is_object( $akismet_user ) ) { self::save_key( $akismet_user->api_key ); self::display_configuration_page(); return; } } } Akismet::view( 'start', compact( 'akismet_user' ) ); /* // To see all variants when testing. $akismet_user->status = 'no-sub'; Akismet::view( 'start', compact( 'akismet_user' ) ); $akismet_user->status = 'cancelled'; Akismet::view( 'start', compact( 'akismet_user' ) ); $akismet_user->status = 'suspended'; Akismet::view( 'start', compact( 'akismet_user' ) ); $akismet_user->status = 'other'; Akismet::view( 'start', compact( 'akismet_user' ) ); $akismet_user = false; */ } public static function display_stats_page() { Akismet::view( 'stats' ); } public static function display_configuration_page() { $api_key = Akismet::get_api_key(); $akismet_user = self::get_akismet_user( $api_key ); if ( ! $akismet_user ) { // This could happen if the user's key became invalid after it was previously valid and successfully set up. self::$notices['status'] = 'existing-key-invalid'; self::display_start_page(); return; } $stat_totals = self::get_stats( $api_key ); // If unset, create the new strictness option using the old discard option to determine its default. // If the old option wasn't set, default to discarding the blatant spam. if ( get_option( 'akismet_strictness' ) === false ) { add_option( 'akismet_strictness', ( get_option( 'akismet_discard_month' ) === 'false' ? '0' : '1' ) ); } // Sync the local "Total spam blocked" count with the authoritative count from the server. if ( isset( $stat_totals['all'], $stat_totals['all']->spam ) ) { update_option( 'akismet_spam_count', $stat_totals['all']->spam ); } $notices = array(); if ( empty( self::$notices ) ) { if ( ! empty( $stat_totals['all'] ) && isset( $stat_totals['all']->time_saved ) && $akismet_user->status == 'active' && $akismet_user->account_type == 'free-api-key' ) { $time_saved = false; if ( $stat_totals['all']->time_saved > 1800 ) { $total_in_minutes = round( $stat_totals['all']->time_saved / 60 ); $total_in_hours = round( $total_in_minutes / 60 ); $total_in_days = round( $total_in_hours / 8 ); $cleaning_up = __( 'Cleaning up spam takes time.' , 'akismet'); if ( $total_in_days > 1 ) $time_saved = $cleaning_up . ' ' . sprintf( _n( 'Akismet has saved you %s day!', 'Akismet has saved you %s days!', $total_in_days, 'akismet' ), number_format_i18n( $total_in_days ) ); elseif ( $total_in_hours > 1 ) $time_saved = $cleaning_up . ' ' . sprintf( _n( 'Akismet has saved you %d hour!', 'Akismet has saved you %d hours!', $total_in_hours, 'akismet' ), $total_in_hours ); elseif ( $total_in_minutes >= 30 ) $time_saved = $cleaning_up . ' ' . sprintf( _n( 'Akismet has saved you %d minute!', 'Akismet has saved you %d minutes!', $total_in_minutes, 'akismet' ), $total_in_minutes ); } $notices[] = array( 'type' => 'active-notice', 'time_saved' => $time_saved ); } } if ( !isset( self::$notices['status'] ) && in_array( $akismet_user->status, array( 'cancelled', 'suspended', 'missing', 'no-sub' ) ) ) { $notices[] = array( 'type' => $akismet_user->status ); } $alert_code = get_option( 'akismet_alert_code' ); if ( isset( Akismet::$limit_notices[ $alert_code ] ) ) { $notices[] = self::get_usage_limit_alert_data(); } elseif ( $alert_code > 0 ) { $notices[] = array( 'type' => 'alert', 'code' => (int) get_option( 'akismet_alert_code' ), 'msg' => get_option( 'akismet_alert_msg' ), ); } /* * To see all variants when testing. * * You may also want to comment out the akismet_view_arguments filter in Akismet::view() * to ensure that you can see all of the notices (e.g. suspended, active-notice). */ // $notices[] = array( 'type' => 'active-notice', 'time_saved' => 'Cleaning up spam takes time. Akismet has saved you 1 minute!' ); // $notices[] = array( 'type' => 'plugin' ); // $notices[] = array( 'type' => 'notice', 'notice_header' => 'This is the notice header.', 'notice_text' => 'This is the notice text.' ); // $notices[] = array( 'type' => 'missing-functions' ); // $notices[] = array( 'type' => 'servers-be-down' ); // $notices[] = array( 'type' => 'active-dunning' ); // $notices[] = array( 'type' => 'cancelled' ); // $notices[] = array( 'type' => 'suspended' ); // $notices[] = array( 'type' => 'missing' ); // $notices[] = array( 'type' => 'no-sub' ); // $notices[] = array( 'type' => 'new-key-valid' ); // $notices[] = array( 'type' => 'new-key-invalid' ); // $notices[] = array( 'type' => 'existing-key-invalid' ); // $notices[] = array( 'type' => 'new-key-failed' ); // $notices[] = array( 'type' => 'usage-limit', 'api_calls' => '15000', 'usage_limit' => '10000', 'upgrade_plan' => 'Enterprise', 'upgrade_url' => 'https://akismet.com/account/', 'code' => 10502 ); // $notices[] = array( 'type' => 'spam-check', 'link_text' => 'Link text.' ); // $notices[] = array( 'type' => 'spam-check-cron-disabled' ); // $notices[] = array( 'type' => 'alert', 'code' => 123 ); Akismet::log( compact( 'stat_totals', 'akismet_user' ) ); Akismet::view( 'config', compact( 'api_key', 'akismet_user', 'stat_totals', 'notices' ) ); } public static function display_notice() { global $hook_suffix; if ( in_array( $hook_suffix, array( 'jetpack_page_akismet-key-config', 'settings_page_akismet-key-config' ) ) ) { // This page manages the notices and puts them inline where they make sense. return; } // To see notice variants while testing. // Akismet::view( 'notice', array( 'type' => 'spam-check-cron-disabled' ) ); // Akismet::view( 'notice', array( 'type' => 'spam-check' ) ); // Akismet::view( 'notice', array( 'type' => 'alert', 'code' => 123, 'msg' => 'Message' ) ); if ( in_array( $hook_suffix, array( 'edit-comments.php' ) ) && (int) get_option( 'akismet_alert_code' ) > 0 ) { Akismet::verify_key( Akismet::get_api_key() ); //verify that the key is still in alert state $alert_code = get_option( 'akismet_alert_code' ); if ( isset( Akismet::$limit_notices[ $alert_code ] ) ) { self::display_usage_limit_alert(); } elseif ( $alert_code > 0 ) { self::display_alert(); } } elseif ( ( 'plugins.php' === $hook_suffix || 'edit-comments.php' === $hook_suffix ) && ! Akismet::get_api_key() ) { // Show the "Set Up Akismet" banner on the comments and plugin pages if no API key has been set. self::display_api_key_warning(); } elseif ( $hook_suffix == 'edit-comments.php' && wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) { self::display_spam_check_warning(); } if ( isset( $_GET['akismet_recheck_complete'] ) ) { $recheck_count = (int) $_GET['recheck_count']; $spam_count = (int) $_GET['spam_count']; if ( $recheck_count === 0 ) { $message = __( 'There were no comments to check. Akismet will only check comments awaiting moderation.', 'akismet' ); } else { $message = sprintf( _n( 'Akismet checked %s comment.', 'Akismet checked %s comments.', $recheck_count, 'akismet' ), number_format( $recheck_count ) ); $message .= ' '; if ( $spam_count === 0 ) { $message .= __( 'No comments were caught as spam.', 'akismet' ); } else { $message .= sprintf( _n( '%s comment was caught as spam.', '%s comments were caught as spam.', $spam_count, 'akismet' ), number_format( $spam_count ) ); } } echo '

' . esc_html( $message ) . '

'; } else if ( isset( $_GET['akismet_recheck_error'] ) ) { echo '

' . esc_html( __( 'Akismet could not recheck your comments for spam.', 'akismet' ) ) . '

'; } } public static function display_status() { if ( ! self::get_server_connectivity() ) { Akismet::view( 'notice', array( 'type' => 'servers-be-down' ) ); } else if ( ! empty( self::$notices ) ) { foreach ( self::$notices as $index => $type ) { if ( is_object( $type ) ) { $notice_header = $notice_text = ''; if ( property_exists( $type, 'notice_header' ) ) { $notice_header = wp_kses( $type->notice_header, self::$allowed ); } if ( property_exists( $type, 'notice_text' ) ) { $notice_text = wp_kses( $type->notice_text, self::$allowed ); } if ( property_exists( $type, 'status' ) ) { $type = wp_kses( $type->status, self::$allowed ); Akismet::view( 'notice', compact( 'type', 'notice_header', 'notice_text' ) ); unset( self::$notices[ $index ] ); } } else { Akismet::view( 'notice', compact( 'type' ) ); unset( self::$notices[ $index ] ); } } } } private static function get_jetpack_user() { if ( !class_exists('Jetpack') ) return false; if ( defined( 'JETPACK__VERSION' ) && version_compare( JETPACK__VERSION, '7.7', '<' ) ) { // For version of Jetpack prior to 7.7. Jetpack::load_xml_rpc_client(); } $xml = new Jetpack_IXR_ClientMulticall( array( 'user_id' => get_current_user_id() ) ); $xml->addCall( 'wpcom.getUserID' ); $xml->addCall( 'akismet.getAPIKey' ); $xml->query(); Akismet::log( compact( 'xml' ) ); if ( !$xml->isError() ) { $responses = $xml->getResponse(); if ( ( is_countable( $responses ) ? count( $responses ) : 0 ) > 1 ) { // Due to a quirk in how Jetpack does multi-calls, the response order // can't be trusted to match the call order. It's a good thing our // return values can be mostly differentiated from each other. $first_response_value = array_shift( $responses[0] ); $second_response_value = array_shift( $responses[1] ); // If WPCOM ever reaches 100 billion users, this will fail. :-) if ( preg_match( '/^[a-f0-9]{12}$/i', $first_response_value ) ) { $api_key = $first_response_value; $user_id = (int) $second_response_value; } else { $api_key = $second_response_value; $user_id = (int) $first_response_value; } return compact( 'api_key', 'user_id' ); } } return false; } /** * Some commentmeta isn't useful in an export file. Suppress it (when supported). * * @param bool $exclude * @param string $key The meta key * @param object $meta The meta object * @return bool Whether to exclude this meta entry from the export. */ public static function exclude_commentmeta_from_export( $exclude, $key, $meta ) { if ( in_array( $key, array( 'akismet_as_submitted', 'akismet_rechecking', 'akismet_delayed_moderation_email' ) ) ) { return true; } return $exclude; } /** * When Akismet is active, remove the "Activate Akismet" step from the plugin description. */ public static function modify_plugin_description( $all_plugins ) { if ( isset( $all_plugins['akismet/akismet.php'] ) ) { if ( Akismet::get_api_key() ) { $all_plugins['akismet/akismet.php']['Description'] = __( 'Used by millions, Akismet is quite possibly the best way in the world to protect your blog from spam. Your site is fully configured and being protected, even while you sleep.', 'akismet' ); } else { $all_plugins['akismet/akismet.php']['Description'] = __( 'Used by millions, Akismet is quite possibly the best way in the world to protect your blog from spam. It keeps your site protected even while you sleep. To get started, just go to your Akismet Settings page to set up your API key.', 'akismet' ); } } return $all_plugins; } private static function set_form_privacy_notice_option( $state ) { if ( in_array( $state, array( 'display', 'hide' ) ) ) { update_option( 'akismet_comment_form_privacy_notice', $state ); } } public static function register_personal_data_eraser( $erasers ) { $erasers['akismet'] = array( 'eraser_friendly_name' => __( 'Akismet', 'akismet' ), 'callback' => array( 'Akismet_Admin', 'erase_personal_data' ), ); return $erasers; } /** * When a user requests that their personal data be removed, Akismet has a duty to discard * any personal data we store outside of the comment itself. Right now, that is limited * to the copy of the comment we store in the akismet_as_submitted commentmeta. * * FWIW, this information would be automatically deleted after 15 days. * * @param $email_address string The email address of the user who has requested erasure. * @param $page int This function can (and will) be called multiple times to prevent timeouts, * so this argument is used for pagination. * @return array * @see https://developer.wordpress.org/plugins/privacy/adding-the-personal-data-eraser-to-your-plugin/ */ public static function erase_personal_data( $email_address, $page = 1 ) { $items_removed = false; $number = 50; $page = (int) $page; $comments = get_comments( array( 'author_email' => $email_address, 'number' => $number, 'paged' => $page, 'order_by' => 'comment_ID', 'order' => 'ASC', ) ); foreach ( (array) $comments as $comment ) { $comment_as_submitted = get_comment_meta( $comment->comment_ID, 'akismet_as_submitted', true ); if ( $comment_as_submitted ) { delete_comment_meta( $comment->comment_ID, 'akismet_as_submitted' ); $items_removed = true; } } // Tell core if we have more comments to work on still $done = ( is_countable( $comments ) ? count( $comments ) : 0 ) < $number; return array( 'items_removed' => $items_removed, 'items_retained' => false, // always false in this example 'messages' => array(), // no messages in this example 'done' => $done, ); } /** * Return an array of HTML elements that are allowed in a notice. * * @return array */ public static function get_notice_kses_allowed_elements() { return self::$allowed; } /** * Return a version to append to the URL of an asset file (e.g. CSS and images). * * @param string $relative_path Relative path to asset file * @return string */ public static function get_asset_file_version( $relative_path ) { $full_path = AKISMET__PLUGIN_DIR . $relative_path; // If the AKISMET_VERSION contains a lower-case letter, it's a development version (e.g. 5.3.1a2). // Use the file modified time in development. if ( preg_match( '/[a-z]/', AKISMET_VERSION ) && file_exists( $full_path ) ) { return filemtime( $full_path ); } // Otherwise, use the AKISMET_VERSION. return AKISMET_VERSION; } } class.akismet-cli.php000064400000011245147177153510010601 0ustar00... * : The ID(s) of the comment(s) to check. * * [--noaction] * : Don't change the status of the comment. Just report what Akismet thinks it is. * * ## EXAMPLES * * wp akismet check 12345 * * @alias comment-check */ public function check( $args, $assoc_args ) { foreach ( $args as $comment_id ) { if ( isset( $assoc_args['noaction'] ) ) { // Check the comment, but don't reclassify it. $api_response = Akismet::check_db_comment( $comment_id, 'wp-cli' ); } else { $api_response = Akismet::recheck_comment( $comment_id, 'wp-cli' ); } if ( 'true' === $api_response ) { WP_CLI::line( sprintf( __( "Comment #%d is spam.", 'akismet' ), $comment_id ) ); } else if ( 'false' === $api_response ) { WP_CLI::line( sprintf( __( "Comment #%d is not spam.", 'akismet' ), $comment_id ) ); } else { if ( false === $api_response ) { WP_CLI::error( __( "Failed to connect to Akismet.", 'akismet' ) ); } else if ( is_wp_error( $api_response ) ) { WP_CLI::warning( sprintf( __( "Comment #%d could not be checked.", 'akismet' ), $comment_id ) ); } } } } /** * Recheck all comments in the Pending queue. * * ## EXAMPLES * * wp akismet recheck_queue * * @alias recheck-queue */ public function recheck_queue() { $batch_size = 100; $start = 0; $total_counts = array(); do { $result_counts = Akismet_Admin::recheck_queue_portion( $start, $batch_size ); if ( $result_counts['processed'] > 0 ) { foreach ( $result_counts as $key => $count ) { if ( ! isset( $total_counts[ $key ] ) ) { $total_counts[ $key ] = $count; } else { $total_counts[ $key ] += $count; } } $start += $batch_size; $start -= $result_counts['spam']; // These comments will have been removed from the queue. } } while ( $result_counts['processed'] > 0 ); WP_CLI::line( sprintf( _n( "Processed %d comment.", "Processed %d comments.", $total_counts['processed'], 'akismet' ), number_format( $total_counts['processed'] ) ) ); WP_CLI::line( sprintf( _n( "%d comment moved to Spam.", "%d comments moved to Spam.", $total_counts['spam'], 'akismet' ), number_format( $total_counts['spam'] ) ) ); if ( $total_counts['error'] ) { WP_CLI::line( sprintf( _n( "%d comment could not be checked.", "%d comments could not be checked.", $total_counts['error'], 'akismet' ), number_format( $total_counts['error'] ) ) ); } } /** * Fetches stats from the Akismet API. * * ## OPTIONS * * [] * : The time period for which to retrieve stats. * --- * default: all * options: * - days * - months * - all * --- * * [--format=] * : Allows overriding the output of the command when listing connections. * --- * default: table * options: * - table * - json * - csv * - yaml * - count * --- * * [--summary] * : When set, will display a summary of the stats. * * ## EXAMPLES * * wp akismet stats * wp akismet stats all * wp akismet stats days * wp akismet stats months * wp akismet stats all --summary */ public function stats( $args, $assoc_args ) { $api_key = Akismet::get_api_key(); if ( empty( $api_key ) ) { WP_CLI::error( __( 'API key must be set to fetch stats.', 'akismet' ) ); } switch ( $args[0] ) { case 'days': $interval = '60-days'; break; case 'months': $interval = '6-months'; break; default: $interval = 'all'; break; } $request_args = array( 'blog' => get_option( 'home' ), 'key' => $api_key, 'from' => $interval, ); $request_args = apply_filters( 'akismet_request_args', $request_args, 'get-stats' ); $response = Akismet::http_post( Akismet::build_query( $request_args ), 'get-stats' ); if ( empty( $response[1] ) ) { WP_CLI::error( __( 'Currently unable to fetch stats. Please try again.', 'akismet' ) ); } $response_body = json_decode( $response[1], true ); if ( is_null( $response_body ) ) { WP_CLI::error( __( 'Stats response could not be decoded.', 'akismet' ) ); } if ( isset( $assoc_args['summary'] ) ) { $keys = array( 'spam', 'ham', 'missed_spam', 'false_positives', 'accuracy', 'time_saved', ); WP_CLI\Utils\format_items( $assoc_args['format'], array( $response_body ), $keys ); } else { $stats = $response_body['breakdown']; WP_CLI\Utils\format_items( $assoc_args['format'], $stats, array_keys( end( $stats ) ) ); } } }class.akismet.php000064400000217560147177153510010044 0ustar00 'FIRST_MONTH_OVER_LIMIT', 10502 => 'SECOND_MONTH_OVER_LIMIT', 10504 => 'THIRD_MONTH_APPROACHING_LIMIT', 10508 => 'THIRD_MONTH_OVER_LIMIT', 10516 => 'FOUR_PLUS_MONTHS_OVER_LIMIT', ); private static $last_comment = ''; private static $initiated = false; private static $prevent_moderation_email_for_these_comments = array(); private static $last_comment_result = null; private static $comment_as_submitted_allowed_keys = array( 'blog' => '', 'blog_charset' => '', 'blog_lang' => '', 'blog_ua' => '', 'comment_agent' => '', 'comment_author' => '', 'comment_author_IP' => '', 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => '', 'comment_date_gmt' => '', 'comment_tags' => '', 'comment_type' => '', 'guid' => '', 'is_test' => '', 'permalink' => '', 'reporter' => '', 'site_domain' => '', 'submit_referer' => '', 'submit_uri' => '', 'user_ID' => '', 'user_agent' => '', 'user_id' => '', 'user_ip' => '' ); public static function init() { if ( ! self::$initiated ) { self::init_hooks(); } } /** * Initializes WordPress hooks */ private static function init_hooks() { self::$initiated = true; add_action( 'wp_insert_comment', array( 'Akismet', 'auto_check_update_meta' ), 10, 2 ); add_filter( 'preprocess_comment', array( 'Akismet', 'auto_check_comment' ), 1 ); add_filter( 'rest_pre_insert_comment', array( 'Akismet', 'rest_auto_check_comment' ), 1 ); add_action( 'comment_form', array( 'Akismet', 'load_form_js' ) ); add_action( 'do_shortcode_tag', array( 'Akismet', 'load_form_js_via_filter' ), 10, 4 ); add_action( 'akismet_scheduled_delete', array( 'Akismet', 'delete_old_comments' ) ); add_action( 'akismet_scheduled_delete', array( 'Akismet', 'delete_old_comments_meta' ) ); add_action( 'akismet_scheduled_delete', array( 'Akismet', 'delete_orphaned_commentmeta' ) ); add_action( 'akismet_schedule_cron_recheck', array( 'Akismet', 'cron_recheck' ) ); add_action( 'comment_form', array( 'Akismet', 'add_comment_nonce' ), 1 ); add_action( 'comment_form', array( 'Akismet', 'output_custom_form_fields' ) ); add_filter( 'script_loader_tag', array( 'Akismet', 'set_form_js_async' ), 10, 3 ); add_filter( 'comment_moderation_recipients', array( 'Akismet', 'disable_moderation_emails_if_unreachable' ), 1000, 2 ); add_filter( 'pre_comment_approved', array( 'Akismet', 'last_comment_status' ), 10, 2 ); add_action( 'transition_comment_status', array( 'Akismet', 'transition_comment_status' ), 10, 3 ); // Run this early in the pingback call, before doing a remote fetch of the source uri add_action( 'xmlrpc_call', array( 'Akismet', 'pre_check_pingback' ), 10, 3 ); // Jetpack compatibility add_filter( 'jetpack_options_whitelist', array( 'Akismet', 'add_to_jetpack_options_whitelist' ) ); add_filter( 'jetpack_contact_form_html', array( 'Akismet', 'inject_custom_form_fields' ) ); add_filter( 'jetpack_contact_form_akismet_values', array( 'Akismet', 'prepare_custom_form_values' ) ); // Gravity Forms add_filter( 'gform_get_form_filter', array( 'Akismet', 'inject_custom_form_fields' ) ); add_filter( 'gform_akismet_fields', array( 'Akismet', 'prepare_custom_form_values' ) ); // Contact Form 7 add_filter( 'wpcf7_form_elements', array( 'Akismet', 'append_custom_form_fields' ) ); add_filter( 'wpcf7_akismet_parameters', array( 'Akismet', 'prepare_custom_form_values' ) ); // Formidable Forms add_filter( 'frm_filter_final_form', array( 'Akismet', 'inject_custom_form_fields' ) ); add_filter( 'frm_akismet_values', array( 'Akismet', 'prepare_custom_form_values' ) ); // Fluent Forms /* * The Fluent Forms hook names were updated in version 5.0.0. The last version that supported * the original hook names was 4.3.25, and version 4.3.25 was tested up to WordPress version 6.1. * * The legacy hooks are fired before the new hooks. See * https://github.com/fluentform/fluentform/commit/cc45341afcae400f217470a7bbfb15efdd80454f * * The legacy Fluent Forms hooks will be removed when Akismet no longer supports WordPress version 6.1. * This will provide compatibility with previous versions of Fluent Forms for a reasonable amount of time. */ add_filter( 'fluentform_form_element_start', array( 'Akismet', 'output_custom_form_fields' ) ); add_filter( 'fluentform_akismet_fields', array( 'Akismet', 'prepare_custom_form_values' ), 10, 2 ); // Current Fluent Form hooks. add_filter( 'fluentform/form_element_start', array( 'Akismet', 'output_custom_form_fields' ) ); add_filter( 'fluentform/akismet_fields', array( 'Akismet', 'prepare_custom_form_values' ), 10, 2 ); add_action( 'update_option_wordpress_api_key', array( 'Akismet', 'updated_option' ), 10, 2 ); add_action( 'add_option_wordpress_api_key', array( 'Akismet', 'added_option' ), 10, 2 ); add_action( 'comment_form_after', array( 'Akismet', 'display_comment_form_privacy_notice' ) ); } public static function get_api_key() { return apply_filters( 'akismet_get_api_key', defined('WPCOM_API_KEY') ? constant('WPCOM_API_KEY') : get_option('wordpress_api_key') ); } /** * Exchange the API key for a token that can only be used to access stats pages. * * @return string */ public static function get_access_token() { static $access_token = null; if ( is_null( $access_token ) ) { $request_args = array( 'api_key' => self::get_api_key() ); $request_args = apply_filters( 'akismet_request_args', $request_args, 'token' ); $response = self::http_post( self::build_query( $request_args ), 'token' ); $access_token = $response[1]; } return $access_token; } public static function check_key_status( $key, $ip = null ) { $request_args = array( 'key' => $key, 'blog' => get_option( 'home' ), ); $request_args = apply_filters( 'akismet_request_args', $request_args, 'verify-key' ); return self::http_post( self::build_query( $request_args ), 'verify-key', $ip ); } public static function verify_key( $key, $ip = null ) { // Shortcut for obviously invalid keys. if ( strlen( $key ) != 12 ) { return 'invalid'; } $response = self::check_key_status( $key, $ip ); if ( $response[1] != 'valid' && $response[1] != 'invalid' ) return 'failed'; return $response[1]; } public static function deactivate_key( $key ) { $request_args = array( 'key' => $key, 'blog' => get_option( 'home' ), ); $request_args = apply_filters( 'akismet_request_args', $request_args, 'deactivate' ); $response = self::http_post( self::build_query( $request_args ), 'deactivate' ); if ( $response[1] != 'deactivated' ) return 'failed'; return $response[1]; } /** * Add the akismet option to the Jetpack options management whitelist. * * @param array $options The list of whitelisted option names. * @return array The updated whitelist */ public static function add_to_jetpack_options_whitelist( $options ) { $options[] = 'wordpress_api_key'; return $options; } /** * When the akismet option is updated, run the registration call. * * This should only be run when the option is updated from the Jetpack/WP.com * API call, and only if the new key is different than the old key. * * @param mixed $old_value The old option value. * @param mixed $value The new option value. */ public static function updated_option( $old_value, $value ) { // Not an API call if ( ! class_exists( 'WPCOM_JSON_API_Update_Option_Endpoint' ) ) { return; } // Only run the registration if the old key is different. if ( $old_value !== $value ) { self::verify_key( $value ); } } /** * Treat the creation of an API key the same as updating the API key to a new value. * * @param mixed $option_name Will always be "wordpress_api_key", until something else hooks in here. * @param mixed $value The option value. */ public static function added_option( $option_name, $value ) { if ( 'wordpress_api_key' === $option_name ) { return self::updated_option( '', $value ); } } public static function rest_auto_check_comment( $commentdata ) { return self::auto_check_comment( $commentdata, 'rest_api' ); } /** * Check a comment for spam. * * @param array $commentdata * @param string $context What kind of request triggered this comment check? Possible values are 'default', 'rest_api', and 'xml-rpc'. * @return array|WP_Error Either the $commentdata array with additional entries related to its spam status * or a WP_Error, if it's a REST API request and the comment should be discarded. */ public static function auto_check_comment( $commentdata, $context = 'default' ) { // If no key is configured, then there's no point in doing any of this. if ( ! self::get_api_key() ) { return $commentdata; } self::$last_comment_result = null; // Skip the Akismet check if the comment matches the Disallowed Keys list. if ( function_exists( 'wp_check_comment_disallowed_list' ) ) { $comment_author = isset( $commentdata['comment_author'] ) ? $commentdata['comment_author'] : ''; $comment_author_email = isset( $commentdata['comment_author_email'] ) ? $commentdata['comment_author_email'] : ''; $comment_author_url = isset( $commentdata['comment_author_url'] ) ? $commentdata['comment_author_url'] : ''; $comment_content = isset( $commentdata['comment_content'] ) ? $commentdata['comment_content'] : ''; $comment_author_ip = isset( $commentdata['comment_author_IP'] ) ? $commentdata['comment_author_IP'] : ''; $comment_agent = isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : ''; if ( wp_check_comment_disallowed_list( $comment_author, $comment_author_email, $comment_author_url, $comment_content, $comment_author_ip, $comment_agent ) ) { self::set_last_comment( $commentdata ); return $commentdata; } } $comment = $commentdata; $comment['user_ip'] = self::get_ip_address(); $comment['user_agent'] = self::get_user_agent(); $comment['referrer'] = self::get_referer(); $comment['blog'] = get_option( 'home' ); $comment['blog_lang'] = get_locale(); $comment['blog_charset'] = get_option('blog_charset'); $comment['permalink'] = get_permalink( $comment['comment_post_ID'] ); if ( ! empty( $comment['user_ID'] ) ) { $comment['user_role'] = Akismet::get_user_roles( $comment['user_ID'] ); } /** See filter documentation in init_hooks(). */ $akismet_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) ); $comment['akismet_comment_nonce'] = 'inactive'; if ( $akismet_nonce_option == 'true' || $akismet_nonce_option == '' ) { $comment['akismet_comment_nonce'] = 'failed'; if ( isset( $_POST['akismet_comment_nonce'] ) && wp_verify_nonce( $_POST['akismet_comment_nonce'], 'akismet_comment_nonce_' . $comment['comment_post_ID'] ) ) $comment['akismet_comment_nonce'] = 'passed'; // comment reply in wp-admin if ( isset( $_POST['_ajax_nonce-replyto-comment'] ) && check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ) ) $comment['akismet_comment_nonce'] = 'passed'; } if ( self::is_test_mode() ) $comment['is_test'] = 'true'; foreach( $_POST as $key => $value ) { if ( is_string( $value ) ) $comment["POST_{$key}"] = $value; } foreach ( $_SERVER as $key => $value ) { if ( ! is_string( $value ) ) { continue; } if ( preg_match( "/^HTTP_COOKIE/", $key ) ) { continue; } // Send any potentially useful $_SERVER vars, but avoid sending junk we don't need. if ( preg_match( "/^(HTTP_|REMOTE_ADDR|REQUEST_URI|DOCUMENT_URI)/", $key ) ) { $comment[ "$key" ] = $value; } } $post = get_post( $comment['comment_post_ID'] ); if ( ! is_null( $post ) ) { // $post can technically be null, although in the past, it's always been an indicator of another plugin interfering. $comment[ 'comment_post_modified_gmt' ] = $post->post_modified_gmt; // Tags and categories are important context in which to consider the comment. $comment['comment_context'] = array(); $tag_names = wp_get_post_tags( $post->ID, array( 'fields' => 'names' ) ); if ( $tag_names && ! is_wp_error( $tag_names ) ) { foreach ( $tag_names as $tag_name ) { $comment['comment_context'][] = $tag_name; } } $category_names = wp_get_post_categories( $post->ID, array( 'fields' => 'names' ) ); if ( $category_names && ! is_wp_error( $category_names ) ) { foreach ( $category_names as $category_name ) { $comment['comment_context'][] = $category_name; } } } /** * Filter the data that is used to generate the request body for the API call. * * @since 5.3.1 * * @param array $comment An array of request data. * @param string $endpoint The API endpoint being requested. */ $comment = apply_filters( 'akismet_request_args', $comment, 'comment-check' ); $response = self::http_post( self::build_query( $comment ), 'comment-check' ); do_action( 'akismet_comment_check_response', $response ); $commentdata['comment_as_submitted'] = array_intersect_key( $comment, self::$comment_as_submitted_allowed_keys ); // Also include any form fields we inject into the comment form, like ak_js foreach ( $_POST as $key => $value ) { if ( is_string( $value ) && strpos( $key, 'ak_' ) === 0 ) { $commentdata['comment_as_submitted'][ 'POST_' . $key ] = $value; } } $commentdata['akismet_result'] = $response[1]; if ( isset( $response[0]['x-akismet-pro-tip'] ) ) $commentdata['akismet_pro_tip'] = $response[0]['x-akismet-pro-tip']; if ( isset( $response[0]['x-akismet-guid'] ) ) { $commentdata['akismet_guid'] = $response[0]['x-akismet-guid']; } if ( isset( $response[0]['x-akismet-error'] ) ) { // An error occurred that we anticipated (like a suspended key) and want the user to act on. // Send to moderation. self::$last_comment_result = '0'; } else if ( 'true' == $response[1] ) { // akismet_spam_count will be incremented later by comment_is_spam() self::$last_comment_result = 'spam'; $discard = ( isset( $commentdata['akismet_pro_tip'] ) && $commentdata['akismet_pro_tip'] === 'discard' && self::allow_discard() ); do_action( 'akismet_spam_caught', $discard ); if ( $discard ) { // The spam is obvious, so we're bailing out early. // akismet_result_spam() won't be called so bump the counter here if ( $incr = apply_filters( 'akismet_spam_count_incr', 1 ) ) { update_option( 'akismet_spam_count', get_option( 'akismet_spam_count' ) + $incr ); } if ( 'rest_api' === $context ) { return new WP_Error( 'akismet_rest_comment_discarded', __( 'Comment discarded.', 'akismet' ) ); } else if ( 'xml-rpc' === $context ) { // If this is a pingback that we're pre-checking, the discard behavior is the same as the normal spam response behavior. return $commentdata; } else { // Redirect back to the previous page, or failing that, the post permalink, or failing that, the homepage of the blog. $redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : ( $post ? get_permalink( $post ) : home_url() ); wp_safe_redirect( esc_url_raw( $redirect_to ) ); die(); } } else if ( 'rest_api' === $context ) { // The way the REST API structures its calls, we can set the comment_approved value right away. $commentdata['comment_approved'] = 'spam'; } } // if the response is neither true nor false, hold the comment for moderation and schedule a recheck if ( 'true' != $response[1] && 'false' != $response[1] ) { if ( !current_user_can('moderate_comments') ) { // Comment status should be moderated self::$last_comment_result = '0'; } if ( ! wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) { wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); do_action( 'akismet_scheduled_recheck', 'invalid-response-' . $response[1] ); } self::$prevent_moderation_email_for_these_comments[] = $commentdata; } // Delete old comments daily if ( ! wp_next_scheduled( 'akismet_scheduled_delete' ) ) { wp_schedule_event( time(), 'daily', 'akismet_scheduled_delete' ); } self::set_last_comment( $commentdata ); self::fix_scheduled_recheck(); return $commentdata; } public static function get_last_comment() { return self::$last_comment; } public static function set_last_comment( $comment ) { if ( is_null( $comment ) ) { self::$last_comment = null; } else { // We filter it here so that it matches the filtered comment data that we'll have to compare against later. // wp_filter_comment expects comment_author_IP self::$last_comment = wp_filter_comment( array_merge( array( 'comment_author_IP' => self::get_ip_address() ), $comment ) ); } } // this fires on wp_insert_comment. we can't update comment_meta when auto_check_comment() runs // because we don't know the comment ID at that point. public static function auto_check_update_meta( $id, $comment ) { // wp_insert_comment() might be called in other contexts, so make sure this is the same comment // as was checked by auto_check_comment if ( is_object( $comment ) && !empty( self::$last_comment ) && is_array( self::$last_comment ) ) { if ( self::matches_last_comment( $comment ) ) { load_plugin_textdomain( 'akismet' ); // normal result: true or false if ( isset( self::$last_comment['akismet_result'] ) && self::$last_comment['akismet_result'] == 'true' ) { update_comment_meta( $comment->comment_ID, 'akismet_result', 'true' ); self::update_comment_history( $comment->comment_ID, '', 'check-spam' ); if ( $comment->comment_approved != 'spam' ) { self::update_comment_history( $comment->comment_ID, '', 'status-changed-' . $comment->comment_approved ); } } elseif ( isset( self::$last_comment['akismet_result'] ) && self::$last_comment['akismet_result'] == 'false' ) { update_comment_meta( $comment->comment_ID, 'akismet_result', 'false' ); self::update_comment_history( $comment->comment_ID, '', 'check-ham' ); // Status could be spam or trash, depending on the WP version and whether this change applies: // https://core.trac.wordpress.org/changeset/34726 if ( $comment->comment_approved == 'spam' || $comment->comment_approved == 'trash' ) { if ( function_exists( 'wp_check_comment_disallowed_list' ) ) { if ( wp_check_comment_disallowed_list( $comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent ) ) { self::update_comment_history( $comment->comment_ID, '', 'wp-disallowed' ); } else { self::update_comment_history( $comment->comment_ID, '', 'status-changed-' . $comment->comment_approved ); } } else { self::update_comment_history( $comment->comment_ID, '', 'status-changed-' . $comment->comment_approved ); } } } elseif ( ! isset( self::$last_comment['akismet_result'] ) ) { // akismet_result isn't set, so the comment wasn't sent to Akismet. update_comment_meta( $comment->comment_ID, 'akismet_skipped', 'true' ); $caught_by_disallowed_list = false; if ( function_exists( 'wp_check_comment_disallowed_list' ) ) { $caught_by_disallowed_list = wp_check_comment_disallowed_list( $comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent ); } if ( $caught_by_disallowed_list ) { self::update_comment_history( $comment->comment_ID, '', 'wp-disallowed' ); self::update_comment_history( $comment->comment_ID, '', 'akismet-skipped-disallowed' ); } else { // Add a generic skipped history item. self::update_comment_history( $comment->comment_ID, '', 'akismet-skipped' ); } } else { // abnormal result: error update_comment_meta( $comment->comment_ID, 'akismet_error', time() ); self::update_comment_history( $comment->comment_ID, '', 'check-error', array( 'response' => substr( self::$last_comment['akismet_result'], 0, 50 ) ) ); } // record the complete original data as submitted for checking if ( isset( self::$last_comment['comment_as_submitted'] ) ) { update_comment_meta( $comment->comment_ID, 'akismet_as_submitted', self::$last_comment['comment_as_submitted'] ); } if ( isset( self::$last_comment['akismet_pro_tip'] ) ) { update_comment_meta( $comment->comment_ID, 'akismet_pro_tip', self::$last_comment['akismet_pro_tip'] ); } if ( isset( self::$last_comment['akismet_guid'] ) ) { update_comment_meta( $comment->comment_ID, 'akismet_guid', self::$last_comment['akismet_guid'] ); } } } } public static function delete_old_comments() { global $wpdb; /** * Determines how many comments will be deleted in each batch. * * @param int The default, as defined by AKISMET_DELETE_LIMIT. */ $delete_limit = apply_filters( 'akismet_delete_comment_limit', defined( 'AKISMET_DELETE_LIMIT' ) ? AKISMET_DELETE_LIMIT : 10000 ); $delete_limit = max( 1, intval( $delete_limit ) ); /** * Determines how many days a comment will be left in the Spam queue before being deleted. * * @param int The default number of days. */ $delete_interval = apply_filters( 'akismet_delete_comment_interval', 15 ); $delete_interval = max( 1, intval( $delete_interval ) ); while ( $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_id FROM {$wpdb->comments} WHERE DATE_SUB(NOW(), INTERVAL %d DAY) > comment_date_gmt AND comment_approved = 'spam' LIMIT %d", $delete_interval, $delete_limit ) ) ) { if ( empty( $comment_ids ) ) return; $wpdb->queries = array(); $comments = array(); foreach ( $comment_ids as $comment_id ) { $comments[ $comment_id ] = get_comment( $comment_id ); do_action( 'delete_comment', $comment_id, $comments[ $comment_id ] ); do_action( 'akismet_batch_delete_count', __FUNCTION__ ); } // Prepared as strings since comment_id is an unsigned BIGINT, and using %d will constrain the value to the maximum signed BIGINT. $format_string = implode( ', ', array_fill( 0, is_countable( $comment_ids ) ? count( $comment_ids ) : 0, '%s' ) ); $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->comments} WHERE comment_id IN ( " . $format_string . " )", $comment_ids ) ); $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->commentmeta} WHERE comment_id IN ( " . $format_string . " )", $comment_ids ) ); foreach ( $comment_ids as $comment_id ) { do_action( 'deleted_comment', $comment_id, $comments[ $comment_id ] ); unset( $comments[ $comment_id ] ); } clean_comment_cache( $comment_ids ); do_action( 'akismet_delete_comment_batch', is_countable( $comment_ids ) ? count( $comment_ids ) : 0 ); } if ( apply_filters( 'akismet_optimize_table', ( mt_rand(1, 5000) == 11), $wpdb->comments ) ) // lucky number $wpdb->query("OPTIMIZE TABLE {$wpdb->comments}"); } public static function delete_old_comments_meta() { global $wpdb; $interval = apply_filters( 'akismet_delete_commentmeta_interval', 15 ); # enforce a minimum of 1 day $interval = absint( $interval ); if ( $interval < 1 ) $interval = 1; // akismet_as_submitted meta values are large, so expire them // after $interval days regardless of the comment status while ( $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT m.comment_id FROM {$wpdb->commentmeta} as m INNER JOIN {$wpdb->comments} as c USING(comment_id) WHERE m.meta_key = 'akismet_as_submitted' AND DATE_SUB(NOW(), INTERVAL %d DAY) > c.comment_date_gmt LIMIT 10000", $interval ) ) ) { if ( empty( $comment_ids ) ) return; $wpdb->queries = array(); foreach ( $comment_ids as $comment_id ) { delete_comment_meta( $comment_id, 'akismet_as_submitted' ); do_action( 'akismet_batch_delete_count', __FUNCTION__ ); } do_action( 'akismet_delete_commentmeta_batch', is_countable( $comment_ids ) ? count( $comment_ids ) : 0 ); } if ( apply_filters( 'akismet_optimize_table', ( mt_rand(1, 5000) == 11), $wpdb->commentmeta ) ) // lucky number $wpdb->query("OPTIMIZE TABLE {$wpdb->commentmeta}"); } // Clear out comments meta that no longer have corresponding comments in the database public static function delete_orphaned_commentmeta() { global $wpdb; $last_meta_id = 0; $start_time = isset( $_SERVER['REQUEST_TIME_FLOAT'] ) ? $_SERVER['REQUEST_TIME_FLOAT'] : microtime( true ); $max_exec_time = max( ini_get('max_execution_time') - 5, 3 ); while ( $commentmeta_results = $wpdb->get_results( $wpdb->prepare( "SELECT m.meta_id, m.comment_id, m.meta_key FROM {$wpdb->commentmeta} as m LEFT JOIN {$wpdb->comments} as c USING(comment_id) WHERE c.comment_id IS NULL AND m.meta_id > %d ORDER BY m.meta_id LIMIT 1000", $last_meta_id ) ) ) { if ( empty( $commentmeta_results ) ) return; $wpdb->queries = array(); $commentmeta_deleted = 0; foreach ( $commentmeta_results as $commentmeta ) { if ( 'akismet_' == substr( $commentmeta->meta_key, 0, 8 ) ) { delete_comment_meta( $commentmeta->comment_id, $commentmeta->meta_key ); do_action( 'akismet_batch_delete_count', __FUNCTION__ ); $commentmeta_deleted++; } $last_meta_id = $commentmeta->meta_id; } do_action( 'akismet_delete_commentmeta_batch', $commentmeta_deleted ); // If we're getting close to max_execution_time, quit for this round. if ( microtime(true) - $start_time > $max_exec_time ) return; } if ( apply_filters( 'akismet_optimize_table', ( mt_rand(1, 5000) == 11), $wpdb->commentmeta ) ) // lucky number $wpdb->query("OPTIMIZE TABLE {$wpdb->commentmeta}"); } // how many approved comments does this author have? public static function get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ) { global $wpdb; /** * Which comment types should be ignored when counting a user's approved comments? * * Some plugins add entries to the comments table that are not actual * comments that could have been checked by Akismet. Allow these comments * to be excluded from the "approved comment count" query in order to * avoid artificially inflating the approved comment count. * * @param array $comment_types An array of comment types that won't be considered * when counting a user's approved comments. * * @since 4.2.2 */ $excluded_comment_types = apply_filters( 'akismet_excluded_comment_types', array() ); $comment_type_where = ''; if ( is_array( $excluded_comment_types ) && ! empty( $excluded_comment_types ) ) { $excluded_comment_types = array_unique( $excluded_comment_types ); foreach ( $excluded_comment_types as $excluded_comment_type ) { $comment_type_where .= $wpdb->prepare( ' AND comment_type <> %s ', $excluded_comment_type ); } } if ( ! empty( $user_id ) ) { return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE user_id = %d AND comment_approved = 1" . $comment_type_where, $user_id ) ); } if ( ! empty( $comment_author_email ) ) { return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_author_email = %s AND comment_author = %s AND comment_author_url = %s AND comment_approved = 1" . $comment_type_where, $comment_author_email, $comment_author, $comment_author_url ) ); } return 0; } /** * Get the full comment history for a given comment, as an array in reverse chronological order. * Each entry will have an 'event', a 'time', and possible a 'message' member (if the entry is old enough). * Some entries will also have a 'user' or 'meta' member. * * @param int $comment_id The relevant comment ID. * @return array|bool An array of history events, or false if there is no history. */ public static function get_comment_history( $comment_id ) { $history = get_comment_meta( $comment_id, 'akismet_history', false ); if ( empty( $history ) || empty( $history[ 0 ] ) ) { return false; } /* // To see all variants when testing. $history[] = array( 'time' => 445856401, 'message' => 'Old versions of Akismet stored the message as a literal string in the commentmeta.', 'event' => null ); $history[] = array( 'time' => 445856402, 'event' => 'recheck-spam' ); $history[] = array( 'time' => 445856403, 'event' => 'check-spam' ); $history[] = array( 'time' => 445856404, 'event' => 'recheck-ham' ); $history[] = array( 'time' => 445856405, 'event' => 'check-ham' ); $history[] = array( 'time' => 445856406, 'event' => 'wp-blacklisted' ); $history[] = array( 'time' => 445856406, 'event' => 'wp-disallowed' ); $history[] = array( 'time' => 445856407, 'event' => 'report-spam' ); $history[] = array( 'time' => 445856408, 'event' => 'report-spam', 'user' => 'sam' ); $history[] = array( 'message' => 'sam reported this comment as spam (hardcoded message).', 'time' => 445856400, 'event' => 'report-spam', 'user' => 'sam' ); $history[] = array( 'time' => 445856409, 'event' => 'report-ham', 'user' => 'sam' ); $history[] = array( 'message' => 'sam reported this comment as ham (hardcoded message).', 'time' => 445856400, 'event' => 'report-ham', 'user' => 'sam' ); // $history[] = array( 'time' => 445856410, 'event' => 'cron-retry-spam' ); $history[] = array( 'time' => 445856411, 'event' => 'cron-retry-ham' ); $history[] = array( 'time' => 445856412, 'event' => 'check-error' ); // $history[] = array( 'time' => 445856413, 'event' => 'check-error', 'meta' => array( 'response' => 'The server was taking a nap.' ) ); $history[] = array( 'time' => 445856414, 'event' => 'recheck-error' ); // Should not generate a message. $history[] = array( 'time' => 445856415, 'event' => 'recheck-error', 'meta' => array( 'response' => 'The server was taking a nap.' ) ); $history[] = array( 'time' => 445856416, 'event' => 'status-changedtrash' ); $history[] = array( 'time' => 445856417, 'event' => 'status-changedspam' ); $history[] = array( 'time' => 445856418, 'event' => 'status-changedhold' ); $history[] = array( 'time' => 445856419, 'event' => 'status-changedapprove' ); $history[] = array( 'time' => 445856420, 'event' => 'status-changed-trash' ); $history[] = array( 'time' => 445856421, 'event' => 'status-changed-spam' ); $history[] = array( 'time' => 445856422, 'event' => 'status-changed-hold' ); $history[] = array( 'time' => 445856423, 'event' => 'status-changed-approve' ); $history[] = array( 'time' => 445856424, 'event' => 'status-trash', 'user' => 'sam' ); $history[] = array( 'time' => 445856425, 'event' => 'status-spam', 'user' => 'sam' ); $history[] = array( 'time' => 445856426, 'event' => 'status-hold', 'user' => 'sam' ); $history[] = array( 'time' => 445856427, 'event' => 'status-approve', 'user' => 'sam' ); $history[] = array( 'time' => 445856427, 'event' => 'webhook-spam' ); $history[] = array( 'time' => 445856427, 'event' => 'webhook-ham' ); $history[] = array( 'time' => 445856427, 'event' => 'webhook-spam-noaction' ); $history[] = array( 'time' => 445856427, 'event' => 'webhook-ham-noaction' ); */ usort( $history, array( 'Akismet', '_cmp_time' ) ); return $history; } /** * Log an event for a given comment, storing it in comment_meta. * * @param int $comment_id The ID of the relevant comment. * @param string $message The string description of the event. No longer used. * @param string $event The event code. * @param array $meta Metadata about the history entry. e.g., the user that reported or changed the status of a given comment. */ public static function update_comment_history( $comment_id, $message, $event=null, $meta=null ) { global $current_user; $user = ''; $event = array( 'time' => self::_get_microtime(), 'event' => $event, ); if ( is_object( $current_user ) && isset( $current_user->user_login ) ) { $event['user'] = $current_user->user_login; } if ( ! empty( $meta ) ) { $event['meta'] = $meta; } // $unique = false so as to allow multiple values per comment $r = add_comment_meta( $comment_id, 'akismet_history', $event, false ); } public static function check_db_comment( $id, $recheck_reason = 'recheck_queue' ) { global $wpdb; if ( ! self::get_api_key() ) { return new WP_Error( 'akismet-not-configured', __( 'Akismet is not configured. Please enter an API key.', 'akismet' ) ); } $c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $id ), ARRAY_A ); if ( ! $c ) { return new WP_Error( 'invalid-comment-id', __( 'Comment not found.', 'akismet' ) ); } $c['user_ip'] = $c['comment_author_IP']; $c['user_agent'] = $c['comment_agent']; $c['referrer'] = ''; $c['blog'] = get_option( 'home' ); $c['blog_lang'] = get_locale(); $c['blog_charset'] = get_option('blog_charset'); $c['permalink'] = get_permalink($c['comment_post_ID']); $c['recheck_reason'] = $recheck_reason; $c['user_role'] = ''; if ( ! empty( $c['user_ID'] ) ) { $c['user_role'] = Akismet::get_user_roles( $c['user_ID'] ); } if ( self::is_test_mode() ) $c['is_test'] = 'true'; $c = apply_filters( 'akismet_request_args', $c, 'comment-check' ); $response = self::http_post( self::build_query( $c ), 'comment-check' ); if ( ! empty( $response[1] ) ) { return $response[1]; } return false; } public static function recheck_comment( $id, $recheck_reason = 'recheck_queue' ) { add_comment_meta( $id, 'akismet_rechecking', true ); $api_response = self::check_db_comment( $id, $recheck_reason ); if ( is_wp_error( $api_response ) ) { // Invalid comment ID. } else if ( 'true' === $api_response ) { wp_set_comment_status( $id, 'spam' ); update_comment_meta( $id, 'akismet_result', 'true' ); delete_comment_meta( $id, 'akismet_error' ); delete_comment_meta( $id, 'akismet_delayed_moderation_email' ); Akismet::update_comment_history( $id, '', 'recheck-spam' ); } elseif ( 'false' === $api_response ) { update_comment_meta( $id, 'akismet_result', 'false' ); delete_comment_meta( $id, 'akismet_error' ); delete_comment_meta( $id, 'akismet_delayed_moderation_email' ); Akismet::update_comment_history( $id, '', 'recheck-ham' ); } else { // abnormal result: error update_comment_meta( $id, 'akismet_result', 'error' ); Akismet::update_comment_history( $id, '', 'recheck-error', array( 'response' => substr( $api_response, 0, 50 ) ) ); } delete_comment_meta( $id, 'akismet_rechecking' ); return $api_response; } public static function transition_comment_status( $new_status, $old_status, $comment ) { if ( $new_status == $old_status ) return; if ( 'spam' === $new_status || 'spam' === $old_status ) { // Clear the cache of the "X comments in your spam queue" count on the dashboard. wp_cache_delete( 'akismet_spam_count', 'widget' ); } # we don't need to record a history item for deleted comments if ( $new_status == 'delete' ) return; if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) && !current_user_can( 'moderate_comments' ) ) return; if ( defined('WP_IMPORTING') && WP_IMPORTING == true ) return; // if this is present, it means the status has been changed by a re-check, not an explicit user action if ( get_comment_meta( $comment->comment_ID, 'akismet_rechecking' ) ) return; if ( function_exists( 'getallheaders' ) ) { $request_headers = getallheaders(); foreach ( $request_headers as $header => $value ) { if ( strtolower( $header ) == 'x-akismet-webhook' ) { // This change is due to a webhook request. return; } } } // Assumption alert: // We want to submit comments to Akismet only when a moderator explicitly spams or approves it - not if the status // is changed automatically by another plugin. Unfortunately WordPress doesn't provide an unambiguous way to // determine why the transition_comment_status action was triggered. And there are several different ways by which // to spam and unspam comments: bulk actions, ajax, links in moderation emails, the dashboard, and perhaps others. // We'll assume that this is an explicit user action if certain POST/GET variables exist. if ( // status=spam: Marking as spam via the REST API or... // status=unspam: I'm not sure. Maybe this used to be used instead of status=approved? Or the UI for removing from spam but not approving has been since removed?... // status=approved: Unspamming via the REST API (Calypso) or... ( isset( $_POST['status'] ) && in_array( $_POST['status'], array( 'spam', 'unspam', 'approved', ) ) ) // spam=1: Clicking "Spam" underneath a comment in wp-admin and allowing the AJAX request to happen. || ( isset( $_POST['spam'] ) && (int) $_POST['spam'] == 1 ) // unspam=1: Clicking "Not Spam" underneath a comment in wp-admin and allowing the AJAX request to happen. Or, clicking "Undo" after marking something as spam. || ( isset( $_POST['unspam'] ) && (int) $_POST['unspam'] == 1 ) // comment_status=spam/unspam: It's unclear where this is happening. || ( isset( $_POST['comment_status'] ) && in_array( $_POST['comment_status'], array( 'spam', 'unspam' ) ) ) // action=spam: Choosing "Mark as Spam" from the Bulk Actions dropdown in wp-admin (or the "Spam it" link in notification emails). // action=unspam: Choosing "Not Spam" from the Bulk Actions dropdown in wp-admin. // action=spamcomment: Following the "Spam" link below a comment in wp-admin (not allowing AJAX request to happen). // action=unspamcomment: Following the "Not Spam" link below a comment in wp-admin (not allowing AJAX request to happen). || ( isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'spam', 'unspam', 'spamcomment', 'unspamcomment', ) ) ) // action=editedcomment: Editing a comment via wp-admin (and possibly changing its status). || ( isset( $_POST['action'] ) && in_array( $_POST['action'], array( 'editedcomment' ) ) ) // for=jetpack: Moderation via the WordPress app, Calypso, anything powered by the Jetpack connection. || ( isset( $_GET['for'] ) && ( 'jetpack' == $_GET['for'] ) && ( ! defined( 'IS_WPCOM' ) || ! IS_WPCOM ) ) // Certain WordPress.com API requests || ( defined( 'REST_API_REQUEST' ) && REST_API_REQUEST ) // WordPress.org REST API requests || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) { if ( $new_status == 'spam' && ( $old_status == 'approved' || $old_status == 'unapproved' || !$old_status ) ) { return self::submit_spam_comment( $comment->comment_ID ); } elseif ( $old_status == 'spam' && ( $new_status == 'approved' || $new_status == 'unapproved' ) ) { return self::submit_nonspam_comment( $comment->comment_ID ); } } self::update_comment_history( $comment->comment_ID, '', 'status-' . $new_status ); } public static function submit_spam_comment( $comment_id ) { global $wpdb, $current_user, $current_site; $comment_id = (int) $comment_id; $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $comment_id ), ARRAY_A ); if ( ! $comment ) { // it was deleted return; } if ( 'spam' != $comment['comment_approved'] ) { return; } self::update_comment_history( $comment_id, '', 'report-spam' ); // If the user hasn't configured Akismet, there's nothing else to do at this point. if ( ! self::get_api_key() ) { return; } // use the original version stored in comment_meta if available $as_submitted = self::sanitize_comment_as_submitted( get_comment_meta( $comment_id, 'akismet_as_submitted', true ) ); if ( $as_submitted && is_array( $as_submitted ) && isset( $as_submitted['comment_content'] ) ) { $comment = array_merge( $comment, $as_submitted ); } $comment['blog'] = get_option( 'home' ); $comment['blog_lang'] = get_locale(); $comment['blog_charset'] = get_option( 'blog_charset' ); $comment['permalink'] = get_permalink( $comment['comment_post_ID'] ); if ( is_object( $current_user ) ) { $comment['reporter'] = $current_user->user_login; } if ( is_object( $current_site ) ) { $comment['site_domain'] = $current_site->domain; } $comment['user_role'] = ''; if ( ! empty( $comment['user_ID'] ) ) { $comment['user_role'] = self::get_user_roles( $comment['user_ID'] ); } if ( self::is_test_mode() ) { $comment['is_test'] = 'true'; } $post = get_post( $comment['comment_post_ID'] ); if ( ! is_null( $post ) ) { $comment['comment_post_modified_gmt'] = $post->post_modified_gmt; } $comment = apply_filters( 'akismet_request_args', $comment, 'submit-spam' ); $response = self::http_post( self::build_query( $comment ), 'submit-spam' ); update_comment_meta( $comment_id, 'akismet_user_result', 'true' ); if ( $comment['reporter'] ) { update_comment_meta( $comment_id, 'akismet_user', $comment['reporter'] ); } do_action('akismet_submit_spam_comment', $comment_id, $response[1]); } public static function submit_nonspam_comment( $comment_id ) { global $wpdb, $current_user, $current_site; $comment_id = (int) $comment_id; $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $comment_id ), ARRAY_A ); if ( ! $comment ) { // it was deleted return; } self::update_comment_history( $comment_id, '', 'report-ham' ); // If the user hasn't configured Akismet, there's nothing else to do at this point. if ( ! self::get_api_key() ) { return; } // use the original version stored in comment_meta if available $as_submitted = self::sanitize_comment_as_submitted( get_comment_meta( $comment_id, 'akismet_as_submitted', true ) ); if ( $as_submitted && is_array( $as_submitted ) && isset( $as_submitted['comment_content'] ) ) { $comment = array_merge( $comment, $as_submitted ); } $comment['blog'] = get_option( 'home' ); $comment['blog_lang'] = get_locale(); $comment['blog_charset'] = get_option( 'blog_charset' ); $comment['permalink'] = get_permalink( $comment['comment_post_ID'] ); $comment['user_role'] = ''; if ( is_object( $current_user ) ) { $comment['reporter'] = $current_user->user_login; } if ( is_object( $current_site ) ) { $comment['site_domain'] = $current_site->domain; } if ( ! empty( $comment['user_ID'] ) ) { $comment['user_role'] = self::get_user_roles( $comment['user_ID'] ); } if ( self::is_test_mode() ) { $comment['is_test'] = 'true'; } $post = get_post( $comment['comment_post_ID'] ); if ( ! is_null( $post ) ) { $comment['comment_post_modified_gmt'] = $post->post_modified_gmt; } $comment = apply_filters( 'akismet_request_args', $comment, 'submit-ham' ); $response = self::http_post( self::build_query( $comment ), 'submit-ham' ); update_comment_meta( $comment_id, 'akismet_user_result', 'false' ); if ( $comment['reporter'] ) { update_comment_meta( $comment_id, 'akismet_user', $comment['reporter'] ); } do_action('akismet_submit_nonspam_comment', $comment_id, $response[1]); } public static function cron_recheck() { global $wpdb; $api_key = self::get_api_key(); $status = self::verify_key( $api_key ); if ( get_option( 'akismet_alert_code' ) || $status == 'invalid' ) { // since there is currently a problem with the key, reschedule a check for 6 hours hence wp_schedule_single_event( time() + 21600, 'akismet_schedule_cron_recheck' ); do_action( 'akismet_scheduled_recheck', 'key-problem-' . get_option( 'akismet_alert_code' ) . '-' . $status ); return false; } delete_option('akismet_available_servers'); $comment_errors = $wpdb->get_col( "SELECT comment_id FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error' LIMIT 100" ); load_plugin_textdomain( 'akismet' ); foreach ( (array) $comment_errors as $comment_id ) { // if the comment no longer exists, or is too old, remove the meta entry from the queue to avoid getting stuck $comment = get_comment( $comment_id ); if ( ! $comment // Comment has been deleted || strtotime( $comment->comment_date_gmt ) < strtotime( "-15 days" ) // Comment is too old. || $comment->comment_approved !== "0" // Comment is no longer in the Pending queue ) { delete_comment_meta( $comment_id, 'akismet_error' ); delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' ); continue; } add_comment_meta( $comment_id, 'akismet_rechecking', true ); $status = self::check_db_comment( $comment_id, 'retry' ); $event = ''; if ( $status == 'true' ) { $event = 'cron-retry-spam'; } elseif ( $status == 'false' ) { $event = 'cron-retry-ham'; } // If we got back a legit response then update the comment history // other wise just bail now and try again later. No point in // re-trying all the comments once we hit one failure. if ( !empty( $event ) ) { delete_comment_meta( $comment_id, 'akismet_error' ); self::update_comment_history( $comment_id, '', $event ); update_comment_meta( $comment_id, 'akismet_result', $status ); // make sure the comment status is still pending. if it isn't, that means the user has already moved it elsewhere. $comment = get_comment( $comment_id ); if ( $comment && 'unapproved' == wp_get_comment_status( $comment_id ) ) { if ( $status == 'true' ) { wp_spam_comment( $comment_id ); } elseif ( $status == 'false' ) { // comment is good, but it's still in the pending queue. depending on the moderation settings // we may need to change it to approved. if ( check_comment($comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent, $comment->comment_type) ) wp_set_comment_status( $comment_id, 1 ); else if ( get_comment_meta( $comment_id, 'akismet_delayed_moderation_email', true ) ) wp_notify_moderator( $comment_id ); } } delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' ); } else { // If this comment has been pending moderation for longer than MAX_DELAY_BEFORE_MODERATION_EMAIL, // send a moderation email now. if ( ( intval( gmdate( 'U' ) ) - strtotime( $comment->comment_date_gmt ) ) < self::MAX_DELAY_BEFORE_MODERATION_EMAIL ) { delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' ); wp_notify_moderator( $comment_id ); } delete_comment_meta( $comment_id, 'akismet_rechecking' ); wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); do_action( 'akismet_scheduled_recheck', 'check-db-comment-' . $status ); return; } delete_comment_meta( $comment_id, 'akismet_rechecking' ); } $remaining = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error'" ); if ( $remaining && !wp_next_scheduled('akismet_schedule_cron_recheck') ) { wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); do_action( 'akismet_scheduled_recheck', 'remaining' ); } } public static function fix_scheduled_recheck() { $future_check = wp_next_scheduled( 'akismet_schedule_cron_recheck' ); if ( !$future_check ) { return; } if ( get_option( 'akismet_alert_code' ) > 0 ) { return; } $check_range = time() + 1200; if ( $future_check > $check_range ) { wp_clear_scheduled_hook( 'akismet_schedule_cron_recheck' ); wp_schedule_single_event( time() + 300, 'akismet_schedule_cron_recheck' ); do_action( 'akismet_scheduled_recheck', 'fix-scheduled-recheck' ); } } public static function add_comment_nonce( $post_id ) { /** * To disable the Akismet comment nonce, add a filter for the 'akismet_comment_nonce' tag * and return any string value that is not 'true' or '' (empty string). * * Don't return boolean false, because that implies that the 'akismet_comment_nonce' option * has not been set and that Akismet should just choose the default behavior for that * situation. */ if ( ! self::get_api_key() ) { return; } $akismet_comment_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) ); if ( $akismet_comment_nonce_option == 'true' || $akismet_comment_nonce_option == '' ) { echo '

'; wp_nonce_field( 'akismet_comment_nonce_' . $post_id, 'akismet_comment_nonce', FALSE ); echo '

'; } } public static function is_test_mode() { return defined('AKISMET_TEST_MODE') && AKISMET_TEST_MODE; } public static function allow_discard() { if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) return false; if ( is_user_logged_in() ) return false; return ( get_option( 'akismet_strictness' ) === '1' ); } public static function get_ip_address() { return isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : null; } /** * Do these two comments, without checking the comment_ID, "match"? * * @param mixed $comment1 A comment object or array. * @param mixed $comment2 A comment object or array. * @return bool Whether the two comments should be treated as the same comment. */ private static function comments_match( $comment1, $comment2 ) { $comment1 = (array) $comment1; $comment2 = (array) $comment2; // Set default values for these strings that we check in order to simplify // the checks and avoid PHP warnings. if ( ! isset( $comment1['comment_author'] ) ) { $comment1['comment_author'] = ''; } if ( ! isset( $comment2['comment_author'] ) ) { $comment2['comment_author'] = ''; } if ( ! isset( $comment1['comment_author_email'] ) ) { $comment1['comment_author_email'] = ''; } if ( ! isset( $comment2['comment_author_email'] ) ) { $comment2['comment_author_email'] = ''; } $comments_match = ( isset( $comment1['comment_post_ID'], $comment2['comment_post_ID'] ) && intval( $comment1['comment_post_ID'] ) == intval( $comment2['comment_post_ID'] ) && ( // The comment author length max is 255 characters, limited by the TINYTEXT column type. // If the comment author includes multibyte characters right around the 255-byte mark, they // may be stripped when the author is saved in the DB, so a 300+ char author may turn into // a 253-char author when it's saved, not 255 exactly. The longest possible character is // theoretically 6 bytes, so we'll only look at the first 248 bytes to be safe. substr( $comment1['comment_author'], 0, 248 ) == substr( $comment2['comment_author'], 0, 248 ) || substr( stripslashes( $comment1['comment_author'] ), 0, 248 ) == substr( $comment2['comment_author'], 0, 248 ) || substr( $comment1['comment_author'], 0, 248 ) == substr( stripslashes( $comment2['comment_author'] ), 0, 248 ) // Certain long comment author names will be truncated to nothing, depending on their encoding. || ( ! $comment1['comment_author'] && strlen( $comment2['comment_author'] ) > 248 ) || ( ! $comment2['comment_author'] && strlen( $comment1['comment_author'] ) > 248 ) ) && ( // The email max length is 100 characters, limited by the VARCHAR(100) column type. // Same argument as above for only looking at the first 93 characters. substr( $comment1['comment_author_email'], 0, 93 ) == substr( $comment2['comment_author_email'], 0, 93 ) || substr( stripslashes( $comment1['comment_author_email'] ), 0, 93 ) == substr( $comment2['comment_author_email'], 0, 93 ) || substr( $comment1['comment_author_email'], 0, 93 ) == substr( stripslashes( $comment2['comment_author_email'] ), 0, 93 ) // Very long emails can be truncated and then stripped if the [0:100] substring isn't a valid address. || ( ! $comment1['comment_author_email'] && strlen( $comment2['comment_author_email'] ) > 100 ) || ( ! $comment2['comment_author_email'] && strlen( $comment1['comment_author_email'] ) > 100 ) ) ); return $comments_match; } // Does the supplied comment match the details of the one most recently stored in self::$last_comment? public static function matches_last_comment( $comment ) { return self::comments_match( self::$last_comment, $comment ); } private static function get_user_agent() { return isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : null; } private static function get_referer() { return isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : null; } // return a comma-separated list of role names for the given user public static function get_user_roles( $user_id ) { $comment_user = null; $roles = false; if ( !class_exists('WP_User') ) return false; if ( $user_id > 0 ) { $comment_user = new WP_User( $user_id ); if ( isset( $comment_user->roles ) ) $roles = implode( ',', $comment_user->roles ); } if ( is_multisite() && is_super_admin( $user_id ) ) { if ( empty( $roles ) ) { $roles = 'super_admin'; } else { $comment_user->roles[] = 'super_admin'; $roles = implode( ',', $comment_user->roles ); } } return $roles; } // filter handler used to return a spam result to pre_comment_approved public static function last_comment_status( $approved, $comment ) { if ( is_null( self::$last_comment_result ) ) { // We didn't have reason to store the result of the last check. return $approved; } // Only do this if it's the correct comment if ( ! self::matches_last_comment( $comment ) ) { self::log( "comment_is_spam mismatched comment, returning unaltered $approved" ); return $approved; } if ( 'trash' === $approved ) { // If the last comment we checked has had its approval set to 'trash', // then it failed the comment blacklist check. Let that blacklist override // the spam check, since users have the (valid) expectation that when // they fill out their blacklists, comments that match it will always // end up in the trash. return $approved; } // bump the counter here instead of when the filter is added to reduce the possibility of overcounting if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); return self::$last_comment_result; } /** * If Akismet is temporarily unreachable, we don't want to "spam" the blogger with * moderation emails for comments that will be automatically cleared or spammed on * the next retry. * * For comments that will be rechecked later, empty the list of email addresses that * the moderation email would be sent to. * * @param array $emails An array of email addresses that the moderation email will be sent to. * @param int $comment_id The ID of the relevant comment. * @return array An array of email addresses that the moderation email will be sent to. */ public static function disable_moderation_emails_if_unreachable( $emails, $comment_id ) { if ( ! empty( self::$prevent_moderation_email_for_these_comments ) && ! empty( $emails ) ) { $comment = get_comment( $comment_id ); if ( $comment ) { foreach ( self::$prevent_moderation_email_for_these_comments as $possible_match ) { if ( self::comments_match( $possible_match, $comment ) ) { update_comment_meta( $comment_id, 'akismet_delayed_moderation_email', true ); return array(); } } } } return $emails; } public static function _cmp_time( $a, $b ) { return $a['time'] > $b['time'] ? -1 : 1; } public static function _get_microtime() { $mtime = explode( ' ', microtime() ); return $mtime[1] + $mtime[0]; } /** * Make a POST request to the Akismet API. * * @param string $request The body of the request. * @param string $path The path for the request. * @param string $ip The specific IP address to hit. * @return array A two-member array consisting of the headers and the response body, both empty in the case of a failure. */ public static function http_post( $request, $path, $ip=null ) { $akismet_ua = sprintf( 'WordPress/%s | Akismet/%s', $GLOBALS['wp_version'], constant( 'AKISMET_VERSION' ) ); $akismet_ua = apply_filters( 'akismet_ua', $akismet_ua ); $host = self::API_HOST; $api_key = self::get_api_key(); if ( $api_key ) { $request = add_query_arg( 'api_key', $api_key, $request ); } $http_host = $host; // use a specific IP if provided // needed by Akismet_Admin::check_server_connectivity() if ( $ip && long2ip( ip2long( $ip ) ) ) { $http_host = $ip; } $http_args = array( 'body' => $request, 'headers' => array( 'Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option( 'blog_charset' ), 'Host' => $host, 'User-Agent' => $akismet_ua, ), 'httpversion' => '1.0', 'timeout' => 15 ); $akismet_url = $http_akismet_url = "http://{$http_host}/1.1/{$path}"; /** * Try SSL first; if that fails, try without it and don't try it again for a while. */ $ssl = $ssl_failed = false; // Check if SSL requests were disabled fewer than X hours ago. $ssl_disabled = get_option( 'akismet_ssl_disabled' ); if ( $ssl_disabled && $ssl_disabled < ( time() - 60 * 60 * 24 ) ) { // 24 hours $ssl_disabled = false; delete_option( 'akismet_ssl_disabled' ); } else if ( $ssl_disabled ) { do_action( 'akismet_ssl_disabled' ); } if ( ! $ssl_disabled && ( $ssl = wp_http_supports( array( 'ssl' ) ) ) ) { $akismet_url = set_url_scheme( $akismet_url, 'https' ); do_action( 'akismet_https_request_pre' ); } $response = wp_remote_post( $akismet_url, $http_args ); Akismet::log( compact( 'akismet_url', 'http_args', 'response' ) ); if ( $ssl && is_wp_error( $response ) ) { do_action( 'akismet_https_request_failure', $response ); // Intermittent connection problems may cause the first HTTPS // request to fail and subsequent HTTP requests to succeed randomly. // Retry the HTTPS request once before disabling SSL for a time. $response = wp_remote_post( $akismet_url, $http_args ); Akismet::log( compact( 'akismet_url', 'http_args', 'response' ) ); if ( is_wp_error( $response ) ) { $ssl_failed = true; do_action( 'akismet_https_request_failure', $response ); do_action( 'akismet_http_request_pre' ); // Try the request again without SSL. $response = wp_remote_post( $http_akismet_url, $http_args ); Akismet::log( compact( 'http_akismet_url', 'http_args', 'response' ) ); } } if ( is_wp_error( $response ) ) { do_action( 'akismet_request_failure', $response ); return array( '', '' ); } if ( $ssl_failed ) { // The request failed when using SSL but succeeded without it. Disable SSL for future requests. update_option( 'akismet_ssl_disabled', time() ); do_action( 'akismet_https_disabled' ); } $simplified_response = array( $response['headers'], $response['body'] ); $alert_code_check_paths = array( 'verify-key', 'comment-check', 'get-stats', ); if ( in_array( $path, $alert_code_check_paths ) ) { self::update_alert( $simplified_response ); } return $simplified_response; } // given a response from an API call like check_key_status(), update the alert code options if an alert is present. public static function update_alert( $response ) { $alert_option_prefix = 'akismet_alert_'; $alert_header_prefix = 'x-akismet-alert-'; $alert_header_names = array( 'code', 'msg', 'api-calls', 'usage-limit', 'upgrade-plan', 'upgrade-url', 'upgrade-type', 'upgrade-via-support', ); foreach ( $alert_header_names as $alert_header_name ) { $value = null; if ( isset( $response[0][ $alert_header_prefix . $alert_header_name ] ) ) { $value = $response[0][ $alert_header_prefix . $alert_header_name ]; } $option_name = $alert_option_prefix . str_replace( '-', '_', $alert_header_name ); if ( $value != get_option( $option_name ) ) { if ( ! $value ) { delete_option( $option_name ); } else { update_option( $option_name, $value ); } } } } /** * Mark akismet-frontend.js as deferred. Because nothing depends on it, it can run at any time * after it's loaded, and the browser won't have to wait for it to load to continue * parsing the rest of the page. */ public static function set_form_js_async( $tag, $handle, $src ) { if ( 'akismet-frontend' !== $handle ) { return $tag; } return preg_replace( '/^'; } $fields .= '

'; return $fields; } public static function output_custom_form_fields( $post_id ) { if ( 'fluentform/form_element_start' === current_filter() && did_action( 'fluentform_form_element_start' ) ) { // Already did this via the legacy filter. return; } // phpcs:ignore WordPress.Security.EscapeOutput echo self::get_akismet_form_fields(); } public static function inject_custom_form_fields( $html ) { $html = str_replace( '', self::get_akismet_form_fields() . '', $html ); return $html; } public static function append_custom_form_fields( $html ) { $html .= self::get_akismet_form_fields(); return $html; } /** * Ensure that any Akismet-added form fields are included in the comment-check call. * * @param array $form * @param array $data Some plugins will supply the POST data via the filter, since they don't * read it directly from $_POST. * @return array $form */ public static function prepare_custom_form_values( $form, $data = null ) { if ( 'fluentform/akismet_fields' === current_filter() && did_filter( 'fluentform_akismet_fields' ) ) { // Already updated the form fields via the legacy filter. return $form; } if ( is_null( $data ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing $data = $_POST; } $prefix = 'ak_'; // Contact Form 7 uses _wpcf7 as a prefix to know which fields to exclude from comment_content. if ( 'wpcf7_akismet_parameters' === current_filter() ) { $prefix = '_wpcf7_ak_'; } foreach ( $data as $key => $val ) { if ( 0 === strpos( $key, $prefix ) ) { $form[ 'POST_ak_' . substr( $key, strlen( $prefix ) ) ] = $val; } } return $form; } private static function bail_on_activation( $message, $deactivate = true ) { ?>

$plugin ) { if ( $plugin === $akismet ) { $plugins[$i] = false; $update = true; } } if ( $update ) { update_option( 'active_plugins', array_filter( $plugins ) ); } } exit; } public static function view( $name, array $args = array() ) { $args = apply_filters( 'akismet_view_arguments', $args, $name ); foreach ( $args as $key => $val ) { $$key = $val; } load_plugin_textdomain( 'akismet' ); $file = AKISMET__PLUGIN_DIR . 'views/'. $name . '.php'; include( $file ); } /** * Attached to activate_{ plugin_basename( __FILES__ ) } by register_activation_hook() * @static */ public static function plugin_activation() { if ( version_compare( $GLOBALS['wp_version'], AKISMET__MINIMUM_WP_VERSION, '<' ) ) { load_plugin_textdomain( 'akismet' ); $message = ''.sprintf(esc_html__( 'Akismet %s requires WordPress %s or higher.' , 'akismet'), AKISMET_VERSION, AKISMET__MINIMUM_WP_VERSION ).' '.sprintf(__('Please upgrade WordPress to a current version, or downgrade to version 2.4 of the Akismet plugin.', 'akismet'), 'https://codex.wordpress.org/Upgrading_WordPress', 'https://wordpress.org/extend/plugins/akismet/download/'); Akismet::bail_on_activation( $message ); } elseif ( ! empty( $_SERVER['SCRIPT_NAME'] ) && false !== strpos( $_SERVER['SCRIPT_NAME'], '/wp-admin/plugins.php' ) ) { add_option( 'Activated_Akismet', true ); } } /** * Removes all connection options * @static */ public static function plugin_deactivation( ) { self::deactivate_key( self::get_api_key() ); // Remove any scheduled cron jobs. $akismet_cron_events = array( 'akismet_schedule_cron_recheck', 'akismet_scheduled_delete', ); foreach ( $akismet_cron_events as $akismet_cron_event ) { $timestamp = wp_next_scheduled( $akismet_cron_event ); if ( $timestamp ) { wp_unschedule_event( $timestamp, $akismet_cron_event ); } } } /** * Essentially a copy of WP's build_query but one that doesn't expect pre-urlencoded values. * * @param array $args An array of key => value pairs * @return string A string ready for use as a URL query string. */ public static function build_query( $args ) { return _http_build_query( $args, '', '&' ); } /** * Log debugging info to the error log. * * Enabled when WP_DEBUG_LOG is enabled (and WP_DEBUG, since according to * core, "WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless * WP_DEBUG is true), but can be disabled via the akismet_debug_log filter. * * @param mixed $akismet_debug The data to log. */ public static function log( $akismet_debug ) { if ( apply_filters( 'akismet_debug_log', defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG && defined( 'AKISMET_DEBUG' ) && AKISMET_DEBUG ) ) { error_log( print_r( compact( 'akismet_debug' ), true ) ); } } /** * Check pingbacks for spam before they're saved to the DB. * * @param string $method The XML-RPC method that was called. * @param array $args This and the $server arg are marked as optional since plugins might still be * calling do_action( 'xmlrpc_action', [...] ) without the arguments that were added in WP 5.7. * @param wp_xmlrpc_server $server */ public static function pre_check_pingback( $method, $args = array(), $server = null ) { if ( $method !== 'pingback.ping' ) { return; } /* * $args looks like this: * * Array * ( * [0] => http://www.example.net/?p=1 // Site that created the pingback. * [1] => https://www.example.com/?p=2 // Post being pingback'd on this site. * ) */ if ( ! is_null( $server ) && ! empty( $args[1] ) ) { $is_multicall = false; $multicall_count = 0; if ( 'system.multicall' === $server->message->methodName ) { $is_multicall = true; $multicall_count = is_countable( $server->message->params ) ? count( $server->message->params ) : 0; } $post_id = url_to_postid( $args[1] ); // If pingbacks aren't open on this post, we'll still check whether this request is part of a potential DDOS, // but indicate to the server that pingbacks are indeed closed so we don't include this request in the user's stats, // since the user has already done their part by disabling pingbacks. $pingbacks_closed = false; $post = get_post( $post_id ); if ( ! $post || ! pings_open( $post ) ) { $pingbacks_closed = true; } $comment = array( 'comment_author_url' => $args[0], 'comment_post_ID' => $post_id, 'comment_author' => '', 'comment_author_email' => '', 'comment_content' => '', 'comment_type' => 'pingback', 'akismet_pre_check' => '1', 'comment_pingback_target' => $args[1], 'pingbacks_closed' => $pingbacks_closed ? '1' : '0', 'is_multicall' => $is_multicall, 'multicall_count' => $multicall_count, ); $comment = self::auto_check_comment( $comment, 'xml-rpc' ); if ( isset( $comment['akismet_result'] ) && 'true' == $comment['akismet_result'] ) { // Sad: tightly coupled with the IXR classes. Unfortunately the action provides no context and no way to return anything. $server->error( new IXR_Error( 0, 'Invalid discovery target' ) ); // Also note that if this was part of a multicall, a spam result will prevent the subsequent calls from being executed. // This is probably fine, but it raises the bar for what should be acceptable as a false positive. } } } /** * Ensure that we are loading expected scalar values from akismet_as_submitted commentmeta. * * @param mixed $meta_value * @return mixed */ private static function sanitize_comment_as_submitted( $meta_value ) { if ( empty( $meta_value ) ) { return $meta_value; } $meta_value = (array) $meta_value; foreach ( $meta_value as $key => $value ) { if ( ! is_scalar( $value ) ) { unset( $meta_value[ $key ] ); } else { // These can change, so they're not explicitly listed in comment_as_submitted_allowed_keys. if ( strpos( $key, 'POST_ak_' ) === 0 ) { continue; } if ( ! isset( self::$comment_as_submitted_allowed_keys[ $key ] ) ) { unset( $meta_value[ $key ] ); } } } return $meta_value; } public static function predefined_api_key() { if ( defined( 'WPCOM_API_KEY' ) ) { return true; } return apply_filters( 'akismet_predefined_api_key', false ); } /** * Controls the display of a privacy related notice underneath the comment form using the `akismet_comment_form_privacy_notice` option and filter respectively. * Default is top not display the notice, leaving the choice to site admins, or integrators. */ public static function display_comment_form_privacy_notice() { if ( 'display' !== apply_filters( 'akismet_comment_form_privacy_notice', get_option( 'akismet_comment_form_privacy_notice', 'hide' ) ) ) { return; } echo apply_filters( 'akismet_comment_form_privacy_notice_markup', '

' . sprintf( __( 'This site uses Akismet to reduce spam. Learn how your comment data is processed.', 'akismet' ), 'https://akismet.com/privacy/' ) . '

' ); } public static function load_form_js() { if ( ! is_admin() && ( ! function_exists( 'amp_is_request' ) || ! amp_is_request() ) && self::get_api_key() ) { wp_register_script( 'akismet-frontend', plugin_dir_url( __FILE__ ) . '_inc/akismet-frontend.js', array(), filemtime( plugin_dir_path( __FILE__ ) . '_inc/akismet-frontend.js' ), true ); wp_enqueue_script( 'akismet-frontend' ); } } /** * Add the form JavaScript when we detect that a supported form shortcode is being parsed. */ public static function load_form_js_via_filter( $return_value, $tag, $attr, $m ) { if ( in_array( $tag, array( 'contact-form', 'gravityform', 'contact-form-7', 'formidable', 'fluentform' ) ) ) { self::load_form_js(); } return $return_value; } /** * Was the last entry in the comment history created by Akismet? * * @param int $comment_id The ID of the comment. * @return bool */ public static function last_comment_status_change_came_from_akismet( $comment_id ) { $history = self::get_comment_history( $comment_id ); if ( empty( $history ) ) { return false; } $most_recent_history_event = $history[0]; if ( ! isset( $most_recent_history_event['event'] ) ) { return false; } $akismet_history_events = array( 'check-error', 'cron-retry-ham', 'cron-retry-spam', 'check-ham', 'check-spam', 'recheck-error', 'recheck-ham', 'recheck-spam', 'webhook-ham', 'webhook-spam', ); if ( in_array( $most_recent_history_event['event'], $akismet_history_events ) ) { return true; } return false; } } class.akismet-rest-api.php000064400000042507147177153510011563 0ustar00 WP_REST_Server::READABLE, 'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'get_key' ), ), array( 'methods' => WP_REST_Server::EDITABLE, 'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'set_key' ), 'args' => array( 'key' => array( 'required' => true, 'type' => 'string', 'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ), 'description' => __( 'A 12-character Akismet API key. Available at akismet.com/get/', 'akismet' ), ), ), ), array( 'methods' => WP_REST_Server::DELETABLE, 'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'delete_key' ), ) ) ); register_rest_route( 'akismet/v1', '/settings/', array( array( 'methods' => WP_REST_Server::READABLE, 'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'get_settings' ), ), array( 'methods' => WP_REST_Server::EDITABLE, 'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'set_boolean_settings' ), 'args' => array( 'akismet_strictness' => array( 'required' => false, 'type' => 'boolean', 'description' => __( 'If true, Akismet will automatically discard the worst spam automatically rather than putting it in the spam folder.', 'akismet' ), ), 'akismet_show_user_comments_approved' => array( 'required' => false, 'type' => 'boolean', 'description' => __( 'If true, show the number of approved comments beside each comment author in the comments list page.', 'akismet' ), ), ), ) ) ); register_rest_route( 'akismet/v1', '/stats', array( 'methods' => WP_REST_Server::READABLE, 'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'get_stats' ), 'args' => array( 'interval' => array( 'required' => false, 'type' => 'string', 'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_interval' ), 'description' => __( 'The time period for which to retrieve stats. Options: 60-days, 6-months, all', 'akismet' ), 'default' => 'all', ), ), ) ); register_rest_route( 'akismet/v1', '/stats/(?P[\w+])', array( 'args' => array( 'interval' => array( 'description' => __( 'The time period for which to retrieve stats. Options: 60-days, 6-months, all', 'akismet' ), 'type' => 'string', ), ), array( 'methods' => WP_REST_Server::READABLE, 'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'get_stats' ), ) ) ); register_rest_route( 'akismet/v1', '/alert', array( array( 'methods' => WP_REST_Server::READABLE, 'permission_callback' => array( 'Akismet_REST_API', 'remote_call_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'get_alert' ), 'args' => array( 'key' => array( 'required' => false, 'type' => 'string', 'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ), 'description' => __( 'A 12-character Akismet API key. Available at akismet.com/get/', 'akismet' ), ), ), ), array( 'methods' => WP_REST_Server::EDITABLE, 'permission_callback' => array( 'Akismet_REST_API', 'remote_call_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'set_alert' ), 'args' => array( 'key' => array( 'required' => false, 'type' => 'string', 'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ), 'description' => __( 'A 12-character Akismet API key. Available at akismet.com/get/', 'akismet' ), ), ), ), array( 'methods' => WP_REST_Server::DELETABLE, 'permission_callback' => array( 'Akismet_REST_API', 'remote_call_permission_callback' ), 'callback' => array( 'Akismet_REST_API', 'delete_alert' ), 'args' => array( 'key' => array( 'required' => false, 'type' => 'string', 'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ), 'description' => __( 'A 12-character Akismet API key. Available at akismet.com/get/', 'akismet' ), ), ), ) ) ); register_rest_route( 'akismet/v1', '/webhook', array( 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( 'Akismet_REST_API', 'receive_webhook' ), 'permission_callback' => array( 'Akismet_REST_API', 'remote_call_permission_callback' ), ) ); } /** * Get the current Akismet API key. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function get_key( $request = null ) { return rest_ensure_response( Akismet::get_api_key() ); } /** * Set the API key, if possible. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function set_key( $request ) { if ( defined( 'WPCOM_API_KEY' ) ) { return rest_ensure_response( new WP_Error( 'hardcoded_key', __( 'This site\'s API key is hardcoded and cannot be changed via the API.', 'akismet' ), array( 'status'=> 409 ) ) ); } $new_api_key = $request->get_param( 'key' ); if ( ! self::key_is_valid( $new_api_key ) ) { return rest_ensure_response( new WP_Error( 'invalid_key', __( 'The value provided is not a valid and registered API key.', 'akismet' ), array( 'status' => 400 ) ) ); } update_option( 'wordpress_api_key', $new_api_key ); return self::get_key(); } /** * Unset the API key, if possible. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function delete_key( $request ) { if ( defined( 'WPCOM_API_KEY' ) ) { return rest_ensure_response( new WP_Error( 'hardcoded_key', __( 'This site\'s API key is hardcoded and cannot be deleted.', 'akismet' ), array( 'status'=> 409 ) ) ); } delete_option( 'wordpress_api_key' ); return rest_ensure_response( true ); } /** * Get the Akismet settings. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function get_settings( $request = null ) { return rest_ensure_response( array( 'akismet_strictness' => ( get_option( 'akismet_strictness', '1' ) === '1' ), 'akismet_show_user_comments_approved' => ( get_option( 'akismet_show_user_comments_approved', '1' ) === '1' ), ) ); } /** * Update the Akismet settings. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function set_boolean_settings( $request ) { foreach ( array( 'akismet_strictness', 'akismet_show_user_comments_approved', ) as $setting_key ) { $setting_value = $request->get_param( $setting_key ); if ( is_null( $setting_value ) ) { // This setting was not specified. continue; } // From 4.7+, WP core will ensure that these are always boolean // values because they are registered with 'type' => 'boolean', // but we need to do this ourselves for prior versions. $setting_value = Akismet_REST_API::parse_boolean( $setting_value ); update_option( $setting_key, $setting_value ? '1' : '0' ); } return self::get_settings(); } /** * Parse a numeric or string boolean value into a boolean. * * @param mixed $value The value to convert into a boolean. * @return bool The converted value. */ public static function parse_boolean( $value ) { switch ( $value ) { case true: case 'true': case '1': case 1: return true; case false: case 'false': case '0': case 0: return false; default: return (bool) $value; } } /** * Get the Akismet stats for a given time period. * * Possible `interval` values: * - all * - 60-days * - 6-months * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function get_stats( $request ) { $api_key = Akismet::get_api_key(); $interval = $request->get_param( 'interval' ); $stat_totals = array(); $request_args = array( 'blog' => get_option( 'home' ), 'key' => $api_key, 'from' => $interval, ); $request_args = apply_filters( 'akismet_request_args', $request_args, 'get-stats' ); $response = Akismet::http_post( Akismet::build_query( $request_args ), 'get-stats' ); if ( ! empty( $response[1] ) ) { $stat_totals[$interval] = json_decode( $response[1] ); } return rest_ensure_response( $stat_totals ); } /** * Get the current alert code and message. Alert codes are used to notify the site owner * if there's a problem, like a connection issue between their site and the Akismet API, * invalid requests being sent, etc. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function get_alert( $request ) { return rest_ensure_response( array( 'code' => get_option( 'akismet_alert_code' ), 'message' => get_option( 'akismet_alert_msg' ), ) ); } /** * Update the current alert code and message by triggering a call to the Akismet server. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function set_alert( $request ) { delete_option( 'akismet_alert_code' ); delete_option( 'akismet_alert_msg' ); // Make a request so the most recent alert code and message are retrieved. Akismet::verify_key( Akismet::get_api_key() ); return self::get_alert( $request ); } /** * Clear the current alert code and message. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function delete_alert( $request ) { delete_option( 'akismet_alert_code' ); delete_option( 'akismet_alert_msg' ); return self::get_alert( $request ); } private static function key_is_valid( $key ) { $request_args = array( 'key' => $key, 'blog' => get_option( 'home' ), ); $request_args = apply_filters( 'akismet_request_args', $request_args, 'verify-key' ); $response = Akismet::http_post( Akismet::build_query( $request_args ), 'verify-key' ); if ( $response[1] == 'valid' ) { return true; } return false; } public static function privileged_permission_callback() { return current_user_can( 'manage_options' ); } /** * For calls that Akismet.com makes to the site to clear outdated alert codes, use the API key for authorization. */ public static function remote_call_permission_callback( $request ) { $local_key = Akismet::get_api_key(); return $local_key && ( strtolower( $request->get_param( 'key' ) ) === strtolower( $local_key ) ); } public static function sanitize_interval( $interval, $request, $param ) { $interval = trim( $interval ); $valid_intervals = array( '60-days', '6-months', 'all', ); if ( ! in_array( $interval, $valid_intervals ) ) { $interval = 'all'; } return $interval; } public static function sanitize_key( $key, $request, $param ) { return trim( $key ); } /** * Process a webhook request from the Akismet servers. * * @param WP_REST_Request $request * @return WP_Error|WP_REST_Response */ public static function receive_webhook( $request ) { Akismet::log( array( 'Webhook request received', $request->get_body() ) ); /** * The request body should look like this: * array( * 'key' => '1234567890abcd', * 'endpoint' => '[comment-check|submit-ham|submit-spam]', * 'comments' => array( * array( * 'guid' => '[...]', * 'result' => '[true|false]', * 'comment_author' => '[...]', * [...] * ), * array( * 'guid' => '[...]', * [...], * ), * [...] * ) * ) * * Multiple comments can be included in each request, and the only truly required * field for each is the guid, although it would be friendly to include also * comment_post_ID, comment_parent, and comment_author_email, if possible to make * searching easier. */ // The response will include statuses for the result of each comment that was supplied. $response = array( 'comments' => array(), ); $endpoint = $request->get_param( 'endpoint' ); switch ( $endpoint ) { case 'comment-check': $webhook_comments = $request->get_param( 'comments' ); if ( ! is_array( $webhook_comments ) ) { return rest_ensure_response( new WP_Error( 'malformed_request', __( 'The \'comments\' parameter must be an array.', 'akismet' ), array( 'status' => 400 ) ) ); } foreach ( $webhook_comments as $webhook_comment ) { $guid = $webhook_comment['guid']; if ( ! $guid ) { // Without the GUID, we can't be sure that we're matching the right comment. // We'll make it a rule that any comment without a GUID is ignored intentionally. continue; } // Search on the fields that are indexed in the comments table, plus the GUID. // The GUID is the only thing we really need to search on, but comment_meta // is not indexed in a useful way if there are many many comments. This // should help narrow it down first. $queryable_fields = array( 'comment_post_ID' => 'post_id', 'comment_parent' => 'parent', 'comment_author_email' => 'author_email', ); $query_args = array(); $query_args['status'] = 'any'; $query_args['meta_key'] = 'akismet_guid'; $query_args['meta_value'] = $guid; foreach ( $queryable_fields as $queryable_field => $wp_comment_query_field ) { if ( isset( $webhook_comment[ $queryable_field ] ) ) { $query_args[ $wp_comment_query_field ] = $webhook_comment[ $queryable_field ]; } } $comments_query = new WP_Comment_Query( $query_args ); $comments = $comments_query->comments; if ( ! $comments ) { // Unexpected, although the comment could have been deleted since being submitted. Akismet::log( 'Webhook failed: no matching comment found.' ); $response['comments'][ $guid ] = array( 'status' => 'error', 'message' => __( 'Could not find matching comment.', 'akismet' ) ); continue; } if ( count( $comments ) > 1 ) { // Two comments shouldn't be able to match the same GUID. Akismet::log( 'Webhook failed: multiple matching comments found.', $comments ); $response['comments'][ $guid ] = array( 'status' => 'error', 'message' => __( 'Multiple comments matched request.', 'akismet' ) ); continue; } else { // We have one single match, as hoped for. Akismet::log( 'Found matching comment.', $comments ); $current_status = wp_get_comment_status( $comments[0] ); $result = $webhook_comment['result']; if ( 'true' == $result ) { Akismet::log( 'Comment should be spam' ); // The comment should be classified as spam. if ( 'spam' != $current_status ) { // The comment is not classified as spam. If Akismet was the one to act on it, move it to spam. if ( Akismet::last_comment_status_change_came_from_akismet( $comments[0]->comment_ID ) ) { Akismet::log( 'Comment is not spam; marking as spam.' ); wp_spam_comment( $comments[0] ); Akismet::update_comment_history( $comments[0]->comment_ID, '', 'webhook-spam' ); } else { Akismet::log( 'Comment is not spam, but it has already been manually handled by some other process.' ); Akismet::update_comment_history( $comments[0]->comment_ID, '', 'webhook-spam-noaction' ); } } } else if ( 'false' == $result ) { Akismet::log( 'Comment should be ham' ); // The comment should be classified as ham. if ( 'spam' == $current_status ) { Akismet::log( 'Comment is spam.' ); // The comment is classified as spam. If Akismet was the one to label it as spam, unspam it. if ( Akismet::last_comment_status_change_came_from_akismet( $comments[0]->comment_ID ) ) { Akismet::log( 'Akismet marked it as spam; unspamming.' ); wp_unspam_comment( $comments[0] ); akismet::update_comment_history( $comments[0]->comment_ID, '', 'webhook-ham' ); } else { Akismet::log( 'Comment is not spam, but it has already been manually handled by some other process.' ); Akismet::update_comment_history( $comments[0]->comment_ID, '', 'webhook-ham-noaction' ); } } } $response['comments'][ $guid ] = array( 'status' => 'success' ); } } break; case 'submit-ham': case 'submit-spam': // Nothing to do for submit-ham or submit-spam. break; default: // Unsupported endpoint. break; } /** * Allow plugins to do things with a successfully processed webhook request, like logging. * * @since 5.3.2 * * @param WP_REST_Request $request The REST request object. */ do_action( 'akismet_webhook_received', $request ); Akismet::log( 'Done processing webhook.' ); return rest_ensure_response( $response ); } } class.akismet-widget.php000064400000006105147177153510011314 0ustar00 __( 'Display the number of spam comments Akismet has caught' , 'akismet') ) ); if ( is_active_widget( false, false, $this->id_base ) ) { add_action( 'wp_head', array( $this, 'css' ) ); } } function css() { ?>

Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. readme.txt000064400000013625147177153510006564 0ustar00=== Akismet Anti-spam: Spam Protection === Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer, stephdau, kbrownkd, bluefuton, akismetantispam Tags: comments, spam, antispam, anti-spam, contact form Requires at least: 5.8 Tested up to: 6.6 Stable tag: 5.3.3 License: GPLv2 or later The best anti-spam protection to block spam comments and spam in a contact form. The most trusted antispam solution for WordPress and WooCommerce. == Description == The best anti-spam protection to block spam comments and spam in a contact form. The most trusted antispam solution for WordPress and WooCommerce. Akismet checks your comments and contact form submissions against our global database of spam to prevent your site from publishing malicious content. You can review the comment spam it catches on your blog's "Comments" admin screen. Major features in Akismet include: * Automatically checks all comments and filters out the ones that look like spam. * Each comment has a status history, so you can easily see which comments were caught or cleared by Akismet and which were spammed or unspammed by a moderator. * URLs are shown in the comment body to reveal hidden or misleading links. * Moderators can see the number of approved comments for each user. * A discard feature that outright blocks the worst spam, saving you disk space and speeding up your site. PS: You'll be prompted to get an Akismet.com API key to use it, once activated. Keys are free for personal blogs; paid subscriptions are available for businesses and commercial sites. == Installation == Upload the Akismet plugin to your blog, activate it, and then enter your Akismet.com API key. 1, 2, 3: You're done! == Changelog == = 5.3.3 = *Release Date - 10 July 2024* * Make setup step clearer for new users. * Remove the stats section from the configuration page if the site has been revoked from the key. * Skip the Akismet comment check when the comment matches something in the disallowed list. * Prompt users on legacy plans to contact Akismet support for upgrades. = 5.3.2 = *Release Date - 21 March 2024* * Improve the empty state shown to new users when no spam has been caught yet. * Update the message shown to users without a current subscription. * Add foundations for future webhook support. = 5.3.1 = *Release Date - 17 January 2024* * Make the plugin more resilient when asset files are missing (as seen in WordPress Playground). * Add a link to the 'Account overview' page on akismet.com. * Fix a minor error that occurs when another plugin removes all comment actions from the dashboard. * Add the akismet_request_args filter to allow request args in Akismet API requests to be filtered. * Fix a bug that causes some contact forms to include unnecessary data in the comment_content parameter. = 5.3 = *Release Date - 14 September 2023* * Improve display of user notices. * Add stylesheets for RTL languages. * Remove initial disabled state from 'Save changes' button. * Improve accessibility of API key entry form. * Add new filter hooks for Fluent Forms. * Fix issue with PHP 8.1 compatibility. = 5.2 = *Release Date - 21 June 2023* * Visual refresh of Akismet stats. * Improve PHP 8.1 compatibility. * Improve appearance of plugin to match updated stats. * Change minimum supported PHP version to 5.6 to match WordPress. * Drop IE11 support and update minimum WordPress version to 5.8 (where IE11 support was removed from WP Core). = 5.1 = *Release Date - 20 March 2023* * Removed unnecessary limit notices from admin page. * Improved spam detection by including post taxonomies in the comment-check call. * Removed API keys from stats iframes to avoid possible inadvertent exposure. = 5.0.2 = *Release Date - 1 December 2022* * Improved compatibility with themes that hide or show UI elements based on mouse movements. * Increased security of API keys by sending them in request bodies instead of subdomains. = 5.0.1 = *Release Date - 28 September 2022* * Added an empty state for the Statistics section on the admin page. * Fixed a bug that broke some admin page links when Jetpack plugins are active. * Marked some event listeners as passive to improve performance in newer browsers. * Disabled interaction observation on forms that post to other domains. = 5.0 = *Release Date - 26 July 2022* * Added a new feature to catch spammers by observing how they interact with the page. = 4.2.5 = *Release Date - 11 July 2022* * Fixed a bug that added unnecessary comment history entries after comment rechecks. * Added a notice that displays when WP-Cron is disabled and might be affecting comment rechecks. = 4.2.4 = *Release Date - 20 May 2022* * Improved translator instructions for comment history. * Bumped the "Tested up to" tag to WP 6.0. = 4.2.3 = *Release Date - 25 April 2022* * Improved compatibility with Fluent Forms * Fixed missing translation domains * Updated stats URL. * Improved accessibility of elements on the config page. = 4.2.2 = *Release Date - 24 January 2022* * Improved compatibility with Formidable Forms * Fixed a bug that could cause issues when multiple contact forms appear on one page. * Updated delete_comment and deleted_comment actions to pass two arguments to match WordPress core since 4.9.0. * Added a filter that allows comment types to be excluded when counting users' approved comments. = 4.2.1 = *Release Date - 1 October 2021* * Fixed a bug causing AMP validation to fail on certain pages with forms. = 4.2 = *Release Date - 30 September 2021* * Added links to additional information on API usage notifications. * Reduced the number of network requests required for a comment page when running Akismet. * Improved compatibility with the most popular contact form plugins. * Improved API usage buttons for clarity on what upgrade is needed. For older changelog entries, please see the [additional changelog.txt file](https://plugins.svn.wordpress.org/akismet/trunk/changelog.txt) delivered with the plugin. wrapper.php000064400000014446147177153510006761 0ustar00_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>DtRNS  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~z9|4lIDATyxV BD p[qcQpĭQKđ*VBu@Q+ZEF h 6ÎI|9}|\k7 ~ ҳ~af4 DH/41aK-O @0y4ͥcE[!]+e I%] …Ԋ&AO>r~vvQVFǒt-ef8+,C#$Gc%?$FRKm5J*SȀɡm& ҷT4 |tLQ(2Jdmpaj7QH &#-Ӗ^6j7Q4&#- [LjYp P.Rm 6r=4)VUxH._a .Tq2Bޢm~!m9HG7jMy9 GU"Km;.%!{!/C@;:!@2iFL~!% ~S_7jMI<#cT* d! T攓r@NC6\^0jHHgr#c+⓳eBDOAoRa <AITFl*zhI ZI RxBRdЕ /-}M ZAڞAAT*T@d u+aaP, ~T*k 32T.D˧RYj#%A -ԑ#L.) LD@=C0ZBe1T 7iقtT ZI J{đO AQ a=LS?< 2P{ ~TK--#'C!d$ݰK۞,ĒO A0줲U90{UrG1t!*eA&r3؆!d"/ѶXfRY68< UQ-IY02~uulp  !}GA RרP)Bȣm2J7ԊaTMe|F1N^^7GP5&i_#&z2@#T@a[  ӶAvLZP5 6kڵw8€w͂ Jb(c Uhz_V;aөLJۏel]AXk?%ȧuQ59d ET2ƒ?E=}CS!oZFT~Q'j&OCNo @`VHV3i5阏 ̃~ |*aԉZSP, ҡ"RYH9LZ=t2&WU 0H- F5T«;mkaTHe"-NaҊވg%INijʇ0 *E0N- F5T΅ׅTb*} 0[DvCm9HF~ P)QjY0:B,xS@:JG9dr2qP鈣x$'ȜJ(R@kv jG:JL@ôLF tA,Ԯx1l,"<mO&=e¨JWxE %T#5yN~OW&v--UP#װu(T/LRi˨A:ʨGZ>G r&]C6`KSt`D  ̇Qj0Tv <z R3ĐM ( F ":*K*`ԇZkQ9U*!mHm(]6A@mYB"2FWS5Rx2)LH-]6pu P?ЁH%T`" LQIe0Rj :"Z. uFyjTB^rFRXjqd F*6\#R.pHZN 9j@>^Ti0MFQC7"cɷB* QzrKrp L3}PyFsjO90*>^G ٴhD\j- =$zS$„FD:DePIe/QHɦm ktZ g•0UාEDDm9L 0 Cp~ mo7z,k mǫtu),`Hm~6R\JGO MFN&ԗ"@T^BR:"nC*FUAJt54P0BWwO?C52DaetM zzۺbۛvTQ_ӵ khd2qeB1I GszC8B^g0 KiDYIWm 9&܉S0b:ޒ5k6Ztd"`$hkת)Ϡ :[Z7]{f %oajND)aC=^FA#Լ A4I{]` >>4v_\@l_a_xAՖśSZM/Acr9} z[ēH n奭5\tu޸aJF坐p,C=M6C4{d~M*zv>Lٕ43LnaHOhR?fydc}@l&q~NH X L_2nǐ{ {hs$or-@pL~@F!HȞ@5dC<[nv>lm+7,lV}XtRi)8& }oaC΀&AwOd _{o 8: AX;t1W5AjF h8j11MIENDB`