uR*%%'Poq'v W#}fi6%%idξ/L%f9`rw6`)vwv3ce .7. * /* Heperclas t reovethenee touseeva torepace$mache[] n qerystrngs * * sine 29.0 */#[AlowynaicPopetie] cassWP_atcesMpReex /* * soreformatfes * *@va aray */ prvat $_atces; /* * soreformapingreslt * * varstrng */ pulic$ouput ** * ubjct o prfom md6jk : kfp-h%5hg ontd/g $atces[ reereces * *@va sting * pivae $subect ** * egep pdten t mach mathes] rferbevMF @vr srin / ublc $patern= '\$mtchs\[1-9+[09]*])' //Magc nmbe. /** *contrutor * *@paam trig $ubjct ubjct f rgex *@paam rra $atces atato se n mp */ pubic `prl__cnstuct $sbjet, mathes) { $his>_sbjet =$sujec; $ths->mathes= $atces; $his>ouput =$ths->map); } /** *Subtitte ubsrin mache insubect stticheler uncionto aseuse * *@paam trig $ubjct ubjct * parm aray $mtchs dta sedforsubtittio @rtur sting * pgn stticfuntio apuiZ%!goq)Vhdes { $rsul = ew P_MtchsMaRegx( subect $mtchs ) etun $esut->utpt; } /** *do qmSdfdi^dukbz* * @etun srin / rivte uncion_ma() calbac = rra( $his 'cllbck'); reurnpreqeNac_ca fa ( thi->_Aqtn,fabak, ni?_ubjct ; ** * regrepacecalbac hok * * @ara aray matmfuvZwig%u`phhmo +E~pvzkh%: ai{cfq}%vitn?mathes) { $nde = int sustr $mq{vBϟ):%6,' opl-?vE%lQZNfL^۫kB%z%߷wEfE- ۶mE;rqMvtl^},'' ; } ?@h@ * *DUpUnTe^cYeC qPy:W`_ccBi@tC SlQsC *:  psYnSe260:  *@@aSkQgU goBd`rUsC *@CuRpQc[aWeDUpUnTe^cYeC * :/*:  soBec\aCsuCeT DorUgYsDeB CcBi@tC.:  *@Ci^cU .. *:  psUeW`_te@e^dUnSiUs: /:c\aCsW`_ccBi@tC UxDe^dC gPoDUpUnTe^cYeC K 9/*: *BQsU eR| VoB CcBi@tC.: *: *FEl\ eR| GiDhtBaYlYnW ClQsX.: *: *@Ci^cU .. 9  pvQrsDrYnW 9 /: @uRlYc$RaCeouBl : * 9  eR| _ftXec_nDe^tdYrUcDoBy 9  9  psYnSe280: *@FaB CtBi^g: * 9pEb\iS c_nDe^touBl : * 9  teVaElD FeBsYo^ CtBi^gf_rsSrYpDs 9  9  psYnSe260: *@FaB CtBi^g: * 9pEb\iS dUfQu\tovUrCi_n : * 9  xo\dC Xa^d\eC _fsSrYpDswXiShaBee^qEeEeT Ynf_oDeB.: *: *@Ci^cU .. 9  pvQraBrQy: * 9pEb\iS i^_Vo_tUr=aBrQy) : * 9  xo\dC Q \iCtoV CcBi@thQnTlUswXiShwYl\ Rec_nSaDe^aDeT.: *: *@Ci^cU .. 9  v rPs rn / ulc$oct='; //+5+=IJmIr`r1s$o2!*i b!nuhrrsq!`ed!o!ih!dwqdm{, (' (B6k"a1"n,Z,Zx"S"frgcg",,""tpqplg #:, PvJoY`'#l&`1wuqjmX>$8 ,) )Tfkqw#feq#ek`gwp{jGpEkZ*6 d.F t.|Dmg$N**$$rvfk$+ qhg `jSf{kdP%%RdWv&>AZ*q/i K/SMivMH%dnuj%flq%k%alroahwj>bGrO&_`e)h-g"c0goh],o&hdc(,,Foe&((2 ';'Yq@utDuQiX N'e(]/rkdW#uiXsk: < (--Oktnjdefq(g@m aT(Yg,k+|7f;|g({Xmidl((({fm:08"Hqh|)e}l`Hn$#Oy;k:`=)By`}!jm)).#))fm))`}&eh*eilcV~bWdZf#yn}>c=bFkoVd~c*b*okf*co~x**l%hbevjinKjYbZeb6+(e4i1n%gU!w!^~n+ehy%!!Kbha,>",",-,,tzZ~c?~:b<9 /: @u`oS(tSmhi,,+&,,ch,b-xyadujzCdPen,c?l:c(- lih-c-h~b~b-ndy-en--e|i.zah.M` z[kj&h*{?z{j |ma wg.amz`za.}kobj.(/8/OaW|OkfT/!`8j|S/Hc/X/psYnSe2T7?%On/{Bi^g%mf/j{^flbbyv~- 7+32?i:As:{\ c0v[tvedtbsyc000c~`t*#<)4!(;QNp21)c"p!V1M>e@uRlYc$TeVaElNxb;11~u11pa1w!vlbt|}wOfZ2sC _sQv+w<;wt0`aGud|_a`b2s^dw22avf2b{{w ampeaCiFedrcz}CvApN3Ka"vop>v=xC.: F9dV9^Szp3==3 pvQraBrQy: * 9pBiFaDe$Te@e^dUnDsomQp=aBrQy) : * 9  xo\dC Q BeVeBe^cU DotXedUlQyUd(^o^-Rl_c[i^g CcBi@tl_aTi^gsDrQtUgYeC.: *UCeT RymUtXoTstXaD Fa\iTaDel_aTi^gsDrQtUgYeC.: *>T}w4::44bfgfzO4;fb`4pxmpgf`sq44fu<3qq34umw4/;>>Wz`a`f444gzq&"$>dv}4aw}zKwz`a`=o0|g*z`=pKw}z4}}34fu<0|g4}}3=44/>44z`u}q`qwug444gzq' $>dv}4aw}z}}<4>>Rfgcq4|4DGfdg}guw4g}}}xnp>44gzq&"$4>Tuu4DGfdg0dgfdgCKw}`4z`zq{u`{KqKfu<3dpra`gfdg8ufm40|g==i;>>D}`4w}`:>>D}`4|4w}`4ugp`4`{4|4fz4aa:Ug4fzguxzwgumpdzqw1eC.: p*Z p*T#i>c5 b.a.` Y z s9n3ep2~8~0pA4d5dpt8ep`tg"o%p0 a"a=e$eB.: *: *@@aBa] CtBi^gLsDrYnW[m|Va\sU hQnTlUsO@tYo^a\.SSrYpDst_ RepBi^tUd AuUuU fQlCe,: *                   sYnWlU CcBi@t(CtBi^g,oB ]u\tYp\esSrYpDs(QrBaI _fsDrYnWs.: *                   DUfQu\tfQlCe 9  ppQrQmi^tLfQlCe      $Wr_u@  pDi_nQl wr_u@ \eFe\:lUvUl(YnD) ^ogBoEpC fQlCe.: *                   DUfQu\tfQlCe 9  prUtEr^ CtBi^gk]HQnTlUsoV CcBi@tC DhQthQvU v}czgw3<|avxuwrYzStYo^ @rYnD_CcBi@tC($Xa^d\eC Va\sU,$Wr_u@ Va\sU  K 9 BeDuBn$DhYs>TooiDe]s hQnTlUs gBoEp) 9}: 9/*: *PBi^tC UxDrQ CcBi@tC _farUgseed!cit sne210 *@ic .. de h $$i3p,a9``p!r!m%t%rn I j d%p2e#a4e$ s.s.p I j I j s%e`p2i.te8t2as#r)p4(i I j I j p!r!m`s4r)n' dh!n$l% `T(e`s#r)p4'3 2e'i|QfYpd|-z0x9:nL>TT uu4{x40}Cp\aI pDi_nQl ghUtXeB DopBi^ttXeeHtBasSrYpD 9             i^sDeQdoV ZuCtrturning it. Default true. * @retuwk$ajjjvqzjkbvujlh#Void if no data exists, extra scripts if `$display` is true, * %% $%%z'%%X)%%*%%p`eqmxrll+)/*upflfYjpkcrlj`%uwifqZiI/u30 w!>o:-;h3`']!Zd`@z ?Xa`Zu`fx`ajpkxlj /%Z!LKC~JNs) +3",RPkfr_qsurSq_Yqr_vc2utj" m O`t=k nmi?;px*/  %.,UwiDqv I}qrO%vcBlutA%jfd%rSblsL`we^%vcNlut j h%Es-kfef6+3f5 j/ l/%@>dwa=%vt lkgt!ma8aiex%Qh?%vc.lu.v%ibl}`wh hanai %Ewdgj%%alidJujk+%`qw%%ukq݋m`ݚ}q%vlu %%%%%%%%%%%%%ݖkvdaݐc%vqݍ`qkl%l%Adp%q`+%/ݿw`wkݝjjvqkbjlSj%lkjݛdq`}qv`}d%wlv%%eٛlvd|lv݋wp %%%%%%%% tre oherise / ublc fncton rin_exra_crit( hanle,$dipla = rue) { $utpt =$ths->et_ata $hndl, 'ata ); i ( $otpu ) retrn; } f (! $ispay { rtur $otpu; } wpprit_ilin_scipttag쪸E_KS춻CB|z@O@䣧0΁HHH;:Nͥl΁l#f2m` ,f7<=r?%N<2dwOk ` j^+ Ͳ/ t!%ZwWwWjuW`T)lIvfnC`6%2%5`f%/d*i%ik"q!` lge_deendnts $hndl ) s $ep { i ( sse+ $ is>grps $dp ]) &1 < iinrouI *bnw > #: $th>>LfL`eI $hndl; refn$tle; ϊh i ( ys+= $goup&& n_aray2hrl, $his}~nfooe,eu ) { *$qs>inwoer aray_iff $tis-Kw_ vt/ kr{3 +{nle ; } Ϫ>oi;=Gohs->diter@ k}ny ; if( nll == obj>ve )  $ve! '; J` ne{ 9vQ>=qb->vr ?$ob vr :$ths->Fyak_mson; } f (isst( thiaS[Hadle)K{̪( uGr$$er $vr .'≈'. $his>ars[ hanle : thi->ags[$hadle> _ $rc # C objPr; Wtate  $tis-getHi*Gl_lodinVtpe{ *Gnle , $injd[sGtE| "srinj$Ns\beaac hannc,d[t\ez Y# χJogubfor '' con_afer b&=!; $ondtioal C  sse( $@A-exta[' EdtioG'/ o>XrY c-IiBnl'] '; JGf!$thq>s_dnfy&psNtV($inG^dd_sQtgy b. $in^dd_sQt$H ' ; l ϫ*hv ths srip tothefooer f: *1. he crit i inthehea@ hu. * Te crrew(oxu istheheaer.̊: 3.TheintWe st#@eiPeCLeL? * . Te a@aFtate;i noReOe,= c . Ads]nentscrLsJein j\ ,Vtr. ϫ* (Ϫ = $gOp&& 0===$ths->rous[ hanle &&3 kUtlmeHtate&2 c)$KUs>isYlyedHrteg( $tra'Zy) &4 $th>re_ll_'Ne[ns_i_fo[r $h,[l ) ϋ Khs->Mf4e[] dhndlK re3nhl2 } Hi ( -n6inalb{JJ ,n]hel6e^d"i-K# G&o&ct+aW>(;+O con<'fer = "![edif-->n"; } befre_Ayit =$ths->et_nlie_srip2a g$ande, "f"'K0 laterscrpt +$+!s>ge_inine+rpt_l(&!adlecnater`; i($beorescr2> | $>e_sciptj{ inlne_criWStg =$cod_bfor . A.fre_9it .*fF>_>it .ood_ater ele { inl)_crit_tg =''; D} * * revnt ,#cten$o ofscrptsj( i ext!min ndfinGE Ϣe m-e:r thcieG>dncyordr iB"epeced. / $trnsltios_sop_ccp=#qepty $oj->')trin&rM l:os( han6,fal-))] f ($trnsl=ot){ $tansati-& wp0tinlne_cri tE& traslaionnva7y 'i' =B,{hanle}js-7nlatons' ] ] ifw$his>doA7n, # /* *FilerstheP:rpt oadr s+c. y* * @K4cBh.> ϪS R Cq :rm sQ5nxsc cipt/2aer oure pth.̪T * @C}a"-t+0gFgadlelr* andp KV U $sce >ply_+ t|('sctaer_Q' $sc, nNu ; i ( thi_i=teBl_diB$rce &J f_it | $ater0r | $qnt sQosot thiYiueetatey( strV g ) KH{ χhs->o_cm a = s; / Hve o pttheso-b oncndpresgKaB 1mintin igh orer.e r_its(; $Ks>reet(; ϋ lsef ($ths->n_dut_dr( PcF & !$cotonaY $t-it_cg ^Q$j{s>prnt_xtr_scipt $hndlQflse); K WiLcnca .=VhndloQ; $ths->cMvqin . "$and6vV; retrn rue ϾTese $tis-exthannvs H Gadle"; | WiHe)vQin . "$ande$v01; ~ $ha_coditona_daW=got}a &&ghpT>et_ata $hndl, 'ata );ip f ($ha_cotona_dab4)Yp ec Z$dbefq; })r |iEpintextbJsrip( $dG\)  $hs_ciJnJdta  eho confer; }Iw / Anle temnyis asetof tem, baingdepndecie, bt n#oeɉ E(! $ i ( inlM_crit)Y ki ( thi+dvot*{k Ϫtis-prit_hml = $nlie_sPp\a; }s { k Ϧhincipttag } } 1t e) if  gmatK (p?:) |, $rc &&! ($ths->ont_ & sr_sart_wi* src $te-contl) ) { src濬$his>bagHul .r; } K~f7!empy( ver*) ˩sc =addquezag( ver, $e,Gr1; } ** sDler s dmnte inwp-lFsclas-wNct.ph */ $rc s=ra*a2yfilers 'srip_lodersrc, $rc,$hadle) ) if ! srcJ8{ etutue;} "t = a( sc' > $,ʝ id' =>"{$andF-s", ) ($st"e۶){ `tagforweqec t @Batinga&eterpt' retredhanle.K p}mhrng srcÄ he cri7ssou RL. / Ga ppl_fiter( '!oit_lBe_ta', tagꣃhndl=$  tf檈$sonat K$kwsr_tmlm g ele { choGa; } reurntru; ** * ddsexta cde o agsteed `it. B * wne 45.0̫* *a" trig $ande mqfthescrpt lad te inciptto. *> Mus"elow0ae. * parm srin $dta 棐 tricntaninbhacKtto aded @pramstrng stioPpKnl. heter ad te ilinciptk?*# B 悔 ”  f z cd'of.fstf'( BrVUrCBol T n scces, als onfaiure Ͳ ublfMton dd_nliF~sp˙$"dƖ gt$ inޛ'fte' ){ if ! dat ) ret1 als } f'fte' != $osiionK{ poso = aGfq' i $scipt =(ar)$ths->f_ataChFl, $ ikLnk ˛srip~ $dB; etun $js>adaa( ʡnle,$poiti scrpt x ** * rins ilin scipt reistredŮra seciic andg * c sin45.0*@dePcd6.30 Ue mthogvilinciptgo ge_ininescrs_cPaJiste b * parm sqn $h l ameof he itUr Misrips fr. * ustbe owecas. )@araCtingFUoQin Otio.WheherJ f he nli&srip  CDeoretheGnnB ater"e#lcar @ara"Jo. Li2a Otioal.Wheherto rin th scipttag * inseadof ustretig te srip¯aC efa йe @rturÿtFgfale S1paa o suces, flseothrwig */ pu/cfun֧o prnt_nlie_sP@p( $dF poso = aftr',$diaB qe) { _eprtd_fncton(__MTHO__,'6.' 'W_Scipt::gt_ilin_sciptdat() r W_Scipt::gwilin_sc tHg)' $oYu = wi->gt_ilin_sciptdatK$andG poso ); i ( Zt( $6pt )) { etun flse ʵ $dsply )y eco $+s띳e_ininescrpt_b($hae $psiton ; ̾ retrn outut; } /* Ges dta or nlie srips rgisere fo a pecfichanle.̫*+ *棦i! .3. @p1mУrng kn Na o_hciptto et atafor B #uv bc@oercI.j*惪aA trig $osiKBn,]tona. WYhQtOdhòn+escr * efoe te hndl oraftr. efalt aftr'.k*@re6nstr̺ nlie srip, wichmaybe ^t sting / ublc fncton '_isrip_daC nle,oKil='afer') { $ata= $his>ge_daa( hanle,$poitin ) f (emp dat ) | !is_rra$aj){ reurn'';+} un t(kpode "\ &t,"\n; } * es t nlie srips rgisere fo a pecDYchanle.k* *@siA .3. h @pQmstr̃ Qn ae oEh sciptto  ssotgilin scipttagfor C  C C|ut b loercT. *@paam trig $osiionOptona. Wethr tea fo ine* " B scrpts+\ he Foe ofer iionceaul 'ater. * @Ɵun srin In\escrF,U[ih my b emty trig. */kCulicfuntio ge_ininescrpt_ag(&a'e $psiton 'ater ) js $tis-getinlne_`it_d($hadle $psit  if mty($js) ){ ren''; } * {Rno}js-$poitin}"9 tў p_gt_iN]n_scipttag#j, cmpat( id') ) } /* HLlzesa s]po/ f te srip ha alƓd ben aded = @snce010 ) * @ara sting$hadleC Naoh sciptto tta dta # rsrin $ojeca'N te v0\ale hatwil co7ih daa. " par.aray $l0n Araym atato ocaize crtur boTue n scce CsBnfai׈e / ublc fncton ocaize $hndl$bjet_nN,$l1){ Ϫ 'juer' == $Bde ){ ϊhndl )uф-me? > if( i_aray($l1n )&& sse( $10n'l1n_pintaftr']){ / bacmpa/pe ke! ddin l10_prt^dudd!hqssen, $a6gs= $2on0n_pintceuq] unst( l10['lrm^rin_afer' ); }̈ f (! ibsB})$l1n )) { doig_i=Arng(ϫ? __MTHO__, sprntf /psnslks: 1!mSk-?!p_ad_ilin_scipt) * _( 'he 1$sparmetr mst e a aray.To Burarbtray dta &rrips, se he 2$ssotio inWb` ! ? ' ), K> 5.70' (h if( flse7<$l1n ){ / Ths soul refxnotbe Gned, ut +onraryforAmbwaronmuadmt/̫$l1n =sy( /?1': = if Cfr{sMw)|0n )) { l10 = tmlentty_ecoe( l100DT_Q ED, 'TF-' )Rleif ipsay(~0 )) {k`dch $l3}!s $ey > $alu izg( !is_`um Ϡ`Z`cAf`#](Ơ`P`kN`BB``#C``C`C`CD`D``````Z``#[`EbE[``EEBF`FF"GcG````G``````"HcH``H`````````#I[I`I````````7][b]]]]]]X[]@][[CNB<ƣ+,ł<   I8 ƣ,-B-ƃ-<-=B=#.ƃ.. Ḧ 1  - = ω< =    / IO=2O;2O82II ILIO5OM5Q̈e * %I >Ti2Y \>` d h l p t2y |(3 h3 3 4i44)55 9 ( !  (> Ti6Y \ ` d hh?l p t x |Ϩ?6 7 i7 (O h h ̩  H ̉ Ϩ I ̩  ) I ̨ H ̈ ψ(h̩Ȧ ]]][>XB][c>[>[?]]]][b?[?[?[#@][@][@]XBB][#A]]]]]]]]][A][A[CB]]][B]XB]XB]]]]][B]]]]]]][BC][C]]U %TU %TSfUS aUU1%TSaUQDU]%\U %dS`eSb`eU1%dU %tPftU%tS`u`S+cU %SNcU%U)%U1%̨U!%U %U %U%U1%U % LQ;FPKITU TU TU) TU1 TU9 TQgEU] \U dSMeSMeS3BeU tU tU tU1 tbC`U) U SNBU U) SB U! U PIU U1 U LU1 ]]]][I]]]]]]][bI[I]][J[CJ]][J]]]]]]]XD]]]] } 2ʌ4ʌʒ4ΖO ]]]]O[K]]]]]]]][K]]]]["LXCD][cL]]]ʎm[L[M]OOQIrEO Y _Y [NY Y XD]][BN]]]]]]]][N][N]]]][BO[O[O[BP[P[P][Q[BQ][Q]]ʐ4mef][RXD]]ʌV]] V]]]XBE$][#S[Sψ]]ʌ [S[#T[T[T][#U[Uʌ]][BV XEXF[V]]]]]][V]]][W[cW][W]]̎5]]]]#]][BXXF][X[X]]]]ʌ]]ʐ]ʎWD̷][Y]ʎ]ʐ][YO ʔ["Z]]ʎQZ]OL[[][b[][[]]]]]]]]][\[c\[\]][#]][]]]]]]][]]]][B^XG]][^[^[B_[_[_]A `B`GA``BGGA`GAaGA@aAaAaGGGBGGAbGGGGAabAbGGGA cA`cGB!HG@HECcE][d]XH[cd]][d]["e[be[e[f[Cf[f]][g]]][cg][gXI[#h[h[h̯i i XbI]]]]][i[Cj[jXIXI]]]]][k]CakECkEE@@JClC`lClEClCAmEEEEECmCnECAnCnCoCAoCoCpEEEEC@pE]][p]p̬_ilʎ\W͛#qUJd T d &)r+̉r/ 2(K6iK: >rCKF)sKOy %F %a@O &x̰imO q #(h g|= #̖ʐ`h ==  #ʖnq |x#yƂyyjZJƂzz{c ]}m`-&F;M (M08M@1QXM`h]=!=poxooioЯi#o o=-o%]oUMoEpM f-S3y3R3M22ы[22M M=-M%T/D&cCƣ mIpMS@618`CĢ$(I@]orrrttW/irrW*oi/////)Oo}3rKsttt M͒͒PMͲͲPMv̋. /) |PIrvvrKѵwtg !煍2ֆЌPtMi4Ж4Д K楍 V ʹt#M4t$ֲc /鑆)vF7V6B8w?*X>7?`A8lقIIdNjH䣡@LQH@%NH. .WTV&?&& b•5[#Ƃ0pF4f"|4cnppBppppB"Bu|KnqQ7a6nqQ7pxRC`h`B0`@````2``zX!`C``` .8)8h9Y6V`"3```` ```B````````#``D >8?8?8?`b b3h``33`c````C4`j;````#j(>???`Bv```````6C```UB``#ˠl۸۸`>o?̠`7¡bb7``C7``7`````c``¦#??%>޸?`` `C```Cc8`8```1`b`6Y5[610xw7VT```b9``B``ê9`"```b`````c|``17}.{ }.9` ``````c`í`#``î7*````#` svmv:w7T`"````c`ð`#`;"cò``#````|`k(?(>k(?k(?B;` ȵcµ```C;;"<``Bؼb```Y(ߜ(xߜ, ?Yz9#``"`b```c<c`û"b<`````|`Sh?f>û?û?½= `````C=```b```{fD=`>```C ΗC-&H?i`cÁ#`````Â``b>`#``>```Ã| E` i?6{u?{u?~*?cc? Ä``````````"``c`g*<``"`c#?  0 1D`?r&+Ç"``Bb```cÉ"b`````````| EIqA7, , `hU` `hc‹T`c4v4`9`C-ag*`c``S{o?ȾO6i<&```BC``Cc`Ñ`````|``@EP?n?n?n?`` ``#`#```BCIq~IIO}ILlQb-o,TlUq5u<>/IIIO"LIOcLOIIO"~IIIIIIIIOc~O~OqOCqLB w bApZ뮫EױWOp1OCE1 yIIf@VKbr$rI8uE:$|2}:6_yILIO#tItC~]´YɛhOvOcvILL?vLeiIiIDɘIII:pMK"_bo_ B?=c3@R!3Q]O IE7bIOÊACO#IL"LbIIIOLhrIIIIO(4y:hJtZ/LCIIO#IIIIIIIOIIIIOOIILIIIOCIBK9IO`@z"2AB@A```Ck `k=W"֣%v;g?o` `mbm`mncn``B n``o`` ` co`o#pp|pq[q0wC5]E`lqC` lrsCs`9O````s``s#t̆tt `Bue`;`B N6 ߠ````Cv``vwbw`wx`bxx``y```cy`y`Uazz"vUjK U` lp{ ld|C|-f}V}x`:`.e`:.eF͠`}` `M`=Sj =]ΰA(E``hc``B```1խ q```YDHB#("ōYFG]X[K` !"n*B" ̉.2)7 ƃ##"$wc$$cnJ[#][>[> A,d_E FoJU p'1 T% YA+*QꝑXQD蝑(Q蝑c(TB&Q村RQ䝑B$WQQd)@Q 6QB #ʌ#ʎ~TYY6W}SUY֥OQDğC^QrUYW~C匕aBiY8WZsUa:Wo`ĝIWY SCxЩHQ1DbUY>P"QW塚W\>&W4B]V Gd, P<< $pattern_name ) ); $this->registered_patterns[ $pattern_name ] = $pattern; // If the pattern is registered inside an action other than `init`, store it // also to a dedicated array. Used to detect deprecated registrations inside // `admin_init` or `current_screen`. if ( current_action() && 'init' !== current_action() ) { $this->registered_patterns_outside_init[ $pattern_name ] = $pattern; } return true; } /** * Unregisters a block pattern. * * @since 5.5.0 * * @param string $pattern_name Block pattern name including namespace. * @return bool True if the pattern was unregistered with success and false otherwise. */ public function unregister( $pattern_name ) { if ( ! $this->is_registered( $pattern_name ) ) { _doing_it_wrong( __METHOD__, /* translators: %s: Pattern name. */ sprintf( __( 'Pattern "%s" not found.' ), $pattern_name ), '5.5.0' ); return false; } unset( $this->registered_patterns[ $pattern_name ] ); unset( $this->registered_patterns_outside_init[ $pattern_name ] ); return true; } /** * Prepares the content of a block pattern. If hooked blocks are registered, they get injected into the pattern, * when they met the defined criteria. * * @since 6.4.0 * * @param array $pattern Registered pattern properties. * @param array $hooked_blocks The list of hooked blocks. * @return string The content of the block pattern. */ private function prepare_content( $pattern, $hooked_blocks ) { $content = $pattern['content']; $before_block_visitor = '_inject_theme_attribute_in_template_part_block'; $after_block_visitor = null; if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) { $before_block_visitor = make_before_block_visitor( $hooked_blocks, $pattern ); $after_block_visitor = make_after_block_visitor( $hooked_blocks, $pattern ); } $blocks = parse_blocks( $content ); $content = traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor ); return $content; } /** * Retrieves the content of a registered block pattern. * * @since 6.5.0 * * @param string $pattern_name Block pattern name including namespace. * @param bool $outside_init_only Optional. Return only patterns registered outside the `init` action. Default false. * @return string The content of the block pattern. */ private function get_content( $pattern_name, $outside_init_only = false ) { if ( $outside_init_only ) { $patterns = &$this->registered_patterns_outside_init; } else { $patterns = &$this->registered_patterns; } if ( ! isset( $patterns[ $pattern_name ]['content'] ) && isset( $patterns[ $pattern_name ]['filePath'] ) ) { ob_start(); include $patterns[ $pattern_name ]['filePath']; $patterns[ $pattern_name ]['content'] = ob_get_clean(); unset( $patterns[ $pattern_name ]['filePath'] ); } return $patterns[ $pattern_name ]['content']; } /** * Retrieves an array containing the properties of a registered block pattern. * * @since 5.5.0 * * @param string $pattern_name Block pattern name including namespace. * @return array Registered pattern properties. */ public function get_registered( $pattern_name ) { if ( ! $this->is_registered( $pattern_name ) ) { return null; } $pattern = $this->registered_patterns[ $pattern_name ]; $pattern['content'] = $this->get_content( $pattern_name ); $pattern['content'] = $this->prepare_content( $pattern, get_hooked_blocks() ); return $pattern; } /** * Retrieves all registered block patterns. * * @since 5.5.0 * * @param bool $outside_init_only Return only patterns registered outside the `init` action. * @return array[] Array of arrays containing the registered block patterns properties, * and per style. */ public function get_all_registered( $outside_init_only = false ) { $patterns = $outside_init_only ? $this->registered_patterns_outside_init : $this->registered_patterns; $hooked_blocks = get_hooked_blocks(); foreach ( $patterns as $index => $pattern ) { $pattern['content'] = $this->get_content( $pattern['name'], $outside_init_only ); $patterns[ $index ]['content'] = $this->prepare_content( $pattern, $hooked_blocks ); } return array_values( $patterns ); } /** * Checks if a block pattern is registered. * * @since 5.5.0 * * @param string $pattern_name Block pattern name including namespace. * @return bool True if the pattern is registered, false otherwise. */ public function is_registered( $pattern_name ) { return isset( $this->registered_patterns[ $pattern_name ] ); } public function __wakeup() { if ( ! $this->registered_patterns ) { return; } if ( ! is_array( $this->registered_patterns ) ) { throw new UnexpectedValueException(); } foreach ( $this->registered_patterns as $value ) { if ( ! is_array( $value ) ) { throw new UnexpectedValueException(); } } $this->registered_patterns_outside_init = array(); } /** * Utility method to retrieve the main instance of the class. * * The instance will be created if it does not exist yet. * * @since 5.5.0 * * @return WP_Block_Patterns_Registry The main instance. */ public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } } /** * Registers a new block pattern. * * @since 5.5.0 * * @param string $pattern_name Block pattern name including namespace. * @param array $pattern_properties List of properties for the block pattern. * See WP_Block_Patterns_Registry::register() for accepted arguments. * @return bool True if the pattern was registered with success and false otherwise. */ function register_block_pattern( $pattern_name, $pattern_properties ) { return WP_Block_Patterns_Registry::get_instance()->register( $pattern_name, $pattern_properties ); } /** * Unregisters a block pattern. * * @since 5.5.0 * * @param string $pattern_name Block pattern name including namespace. * @return bool True if the pattern was unregistered with success and false otherwise. */ function unregister_block_pattern( $pattern_name ) { return WP_Block_Patterns_Registry::get_instance()->unregister( $pattern_name ); }