94.cache.php 197 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652
  1. <?php return array (
  2. 'resourceClass' => 'modDocument',
  3. 'resource' =>
  4. array (
  5. 'id' => 94,
  6. 'type' => 'document',
  7. 'contentType' => 'text/html',
  8. 'pagetitle' => 'Albrecht Soil Analysis',
  9. 'longtitle' => 'Albrecht Soil Analysis Reporting',
  10. 'description' => 'Dr. Albrecht saw a direct link between soil quality and food quality, drawing a direct connection between poor quality forage crops, and ill health in livestock. Use crop monitor online soil analysis to start the journey to better soil and crop quality.',
  11. 'alias' => 'albrecht-soil-analysis',
  12. 'alias_visible' => 1,
  13. 'link_attributes' => '',
  14. 'published' => 1,
  15. 'pub_date' => 0,
  16. 'unpub_date' => 0,
  17. 'parent' => 0,
  18. 'isfolder' => 0,
  19. 'introtext' => 'When you correct cation balance, you have addressed soil chemistry, which improves the physical structure of the soil.',
  20. 'content' => '<!-- Page Content -->
  21. <section id="about" class="py-5">
  22. <div class="container">
  23. <h2 class="text-success">Albrecht Soil Analysis</h2>
  24. <hr>
  25. <blockquote class="blockquote text-center">
  26. <p class="mb-0">The soil is the ‘<i>creative material</i>’ of most of the basic needs of life. Creation starts with a handful of dust.</p>
  27. <footer class="blockquote-footer">Dr. William A. Abrecht. <cite title="Source Title">University of Missouri</cite></footer>
  28. </blockquote>
  29. <hr>
  30. <div class="row card-deck">
  31. <div class="card border-success text-center mb-3">
  32. <div class="card-body">
  33. <h2 class="card-title text-center">Physical</h2>
  34. <i class="fas fa-atom fa-3x"></i>
  35. <p class="card-text">When you correct cation balance, you have addressed soil chemistry, which improves the physical structure of the soil.</p>
  36. </div>
  37. </div>
  38. <div class="card border-success text-center mb-3">
  39. <div class="card-body">
  40. <h2 class="card-title text-center">Chemical</h2>
  41. <i class="fas fa-flask fa-3x"></i>
  42. <p class="card-text">The correction of cation balance and the provision of minimum levels of micronutrients tkatesk care of the chemical part of soil productivity and health.</p>
  43. </div>
  44. </div>
  45. <div class="card border-success text-center mb-3">
  46. <div class="card-body">
  47. <h2 class="card-title text-center">Biological</h2>
  48. <i class="fas fa-bug fa-3x"></i>
  49. <p class="card-text">The essential understanding involves a recognition that the purpose of cation balancing is to stimulate soil biology, and much of the beneficial response relates to firing up this workforce</p>
  50. </div>
  51. </div>
  52. </div>
  53. <hr>
  54. </div>
  55. </section>
  56. <!-- Projects Section -->
  57. <section id="services" class="projects-section bg-light pt-2">
  58. <div class="container">
  59. [[!getResources?
  60. &parents=`[[*id]]`
  61. &level=`0`
  62. &includeTVs=`1`
  63. &processTVs=`1`
  64. &includeContent=`1`
  65. &tplFirst=`projectsSectionFIRST`
  66. &tpl=`projectsSectionEVEN`
  67. &tplOdd=`projectsSectionODD`
  68. &sortby=`FIELD(modResource.id, 95 )`
  69. &sortdir=`ASC`
  70. &limit=`0`
  71. ]]
  72. </div>
  73. </section>
  74. <section class="bg-dark text-light py-5" id="blog" >
  75. <div class="container">
  76. <p class="lead">
  77. </p>
  78. </div>
  79. </section>
  80. <section class="py-5" id="contact" >
  81. <div class="container">
  82. <p class="lead">
  83. Dr. Albrecht saw a direct link between soil quality and food quality, drawing direct connection between poor quality forage crops, and ill health in livestock.
  84. </p>
  85. </div>
  86. </section>
  87. <section class="bg-dark text-light py-5" id="login" >
  88. <div class="container">
  89. <p class="lead">
  90. Feed the soil to feed the plant is another vital concept of the Albrecht Model of soil building.
  91. </p>
  92. </div>
  93. </section>
  94. <section class="py-5" id="" >
  95. <div class="container">
  96. <p class="lead">
  97. Feed the soil to feed the plant is another vital concept of the Albrecht Model of soil building.
  98. </p>
  99. </div>
  100. </section>',
  101. 'richtext' => 0,
  102. 'template' => 13,
  103. 'menuindex' => 10,
  104. 'searchable' => 1,
  105. 'cacheable' => 1,
  106. 'createdby' => 1,
  107. 'createdon' => 1564350148,
  108. 'editedby' => 1,
  109. 'editedon' => 1566968689,
  110. 'deleted' => 0,
  111. 'deletedon' => 0,
  112. 'deletedby' => 0,
  113. 'publishedon' => 1564350120,
  114. 'publishedby' => 1,
  115. 'menutitle' => 'Soil Analysis',
  116. 'donthit' => 0,
  117. 'privateweb' => 0,
  118. 'privatemgr' => 0,
  119. 'content_dispo' => 0,
  120. 'hidemenu' => 1,
  121. 'class_key' => 'modDocument',
  122. 'context_key' => 'web',
  123. 'content_type' => 1,
  124. 'uri' => 'albrecht-soil-analysis.html',
  125. 'uri_override' => 0,
  126. 'hide_children_in_tree' => 0,
  127. 'show_in_tree' => 1,
  128. 'properties' => NULL,
  129. '_content' => '<!doctype html>
  130. <html lang="en">
  131. <head>
  132. <title>Albrecht Soil Analysis Reporting | Crop Monitor</title>
  133. <base href="[[!++site_url]]" >
  134. <meta charset="UTF-8" >
  135. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" >
  136. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
  137. <meta name="keywords" content="When you correct cation balance, you have addressed soil chemistry, which improves the physical structure of the soil." >
  138. <meta name="description" content="Dr. Albrecht saw a direct link between soil quality and food quality, drawing a direct connection between poor quality forage crops, and ill health in livestock. Use crop monitor online soil analysis to start the journey to better soil and crop quality." >
  139. <link rel="icon" href="client-assets/images/favicon.ico?v=2" type="image/x-icon" >
  140. <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  141. <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
  142. <script type="text/javascript" src="https://use.fontawesome.com/1e2844bb90.js"></script>
  143. <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous" />
  144. <link rel="stylesheet" type="text/css" href="/client-assets/weather-icons/css/weather-icons.min.css?version=1.16" />
  145. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css" />
  146. <!-- Custom styles for this template -->
  147. <link rel="stylesheet" href="client-assets/css/greyscale.css" >
  148. </header>
  149. <body>
  150. <style>
  151. .carousel-item {
  152. height: 65vh;
  153. min-height: 250px;
  154. background: no-repeat center center scroll;
  155. -webkit-background-size: cover;
  156. -moz-background-size: cover;
  157. -o-background-size: cover;
  158. background-size: cover;
  159. }
  160. .nav-link {
  161. /* font-size: 2em; */
  162. text-align: center;
  163. font-weight: bold;
  164. }
  165. </style>
  166. <!-- Navigation -->
  167. <nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top" id="mainNav">
  168. <div class="container">
  169. <a class="navbar-brand js-scroll-trigger" href="#">
  170. <img src="client-assets/images/favicon.ico" width="30" height="30" class="d-inline-block align-top" alt="">
  171. Crop monitor
  172. </a>
  173. <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
  174. <span class="navbar-toggler-icon"></span>
  175. </button>
  176. <div class="collapse navbar-collapse" id="navbarResponsive">
  177. <form class="form-inline mx-auto justify-content-center d-none d-md-block">
  178. <button class="btn btn-sm btn-outline-success" type="button">Try a Albrecht Soil Analysis Reporting Free</button>
  179. </form>
  180. <ul class="navbar-nav ml-auto">
  181. <li class="nav-item">
  182. <a class="nav-link js-scroll-trigger" href="about.html">About</a>
  183. </li>
  184. <li class="nav-item">
  185. <a class="nav-link js-scroll-trigger" href="blog/">Blog</a>
  186. </li>
  187. <li class="nav-item">
  188. <a class="nav-link js-scroll-trigger" href="contact-us.html">Contact Us</a>
  189. </li>
  190. <li class="nav-item">
  191. <a class="nav-link js-scroll-trigger" href="login/">Login</a>
  192. </li>
  193. <div class="row">
  194. <li class="col pr-0 nav-item"><a class="nav-link text-dark" href="#"><i class="fab fa-facebook-f"></i></a></li>
  195. <li class="col px-0 nav-item"><a class="nav-link text-dark" href="#"><i class="fab fa-twitter"></i></a></li>
  196. <li class="col pl-0 nav-item"><a class="nav-link text-dark" href="#"><i class="fab fa-instagram"></i></a></li>
  197. </div>
  198. </ul>
  199. </div>
  200. </div>
  201. </nav>
  202. <header>
  203. <div id="carouselLandingPage" class="carousel slide" data-ride="carousel">
  204. <ol class="carousel-indicators">
  205. <li data-target="#carouselLandingPage" data-slide-to="0" class="active"></li>
  206. <li data-target="#carouselLandingPage" data-slide-to="1"></li>
  207. <li data-target="#carouselLandingPage" data-slide-to="2"></li>
  208. </ol>
  209. <div class="carousel-inner" role="listbox">
  210. [[!Gallery?
  211. &album=`Albrech Landing Page`
  212. &thumbTpl=`slideshow_landing_page`
  213. ]]
  214. <style>
  215. .slideOne {
  216. background-image: linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25) ), url(\'client-assets/FredTemplate/images/work.png\'), url(\'client-assets/FredTemplate/images/g6.jpg\');
  217. background-size: cover, auto 300px;
  218. background-position: center, center right 25%;
  219. }
  220. .slideTwo {
  221. background-image: linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25) ), url(\'client-assets/FredTemplate/images/work.png\'), url(\'client-assets/FredTemplate/images/g7.jpg\');
  222. background-size: cover, auto 300px;
  223. background-position: center, center right 25%;
  224. }
  225. .slideThree {
  226. background-image: linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25) ), url(\'client-assets/FredTemplate/images/work.png\'), url(\'client-assets/FredTemplate/images/g3.jpg\');
  227. background-size: cover, auto 300px;
  228. background-position: center, center right 25%;
  229. }
  230. </style>
  231. <!-- Slide One - Set the background image for this slide in the line below -->
  232. <div class="carousel-item active slideOne" style=" ">
  233. <div class="carousel-caption text-left">
  234. <div class="row">
  235. <div class="col-md-9">
  236. <h2 class="text-bold">Albrecht Soil Analysis Reporting</h2>
  237. <p class="lead col-12 col-md-6 ">When you correct cation balance, you have addressed soil chemistry, which improves the physical structure of the soil.</p>
  238. <p class="col-12 col-md-6 font-italic d-none d-md-block">Dr. Albrecht saw a direct link between soil quality and food quality, drawing a direct connection between poor quality forage crops, and ill health in livestock. Use crop monitor online soil analysis to start the journey to better soil and crop quality.</p>
  239. <a href="#" class="btn btn-outline-success">Get a Free Soil Report now!</a>
  240. </div>
  241. <div class="col-md-3 d-none d-md-block align-middle">
  242. <!-- <img src="client-assets/FredTemplate/images/work.png" class="img-fluid mx-auto" alt="Responsive image"> -->
  243. </div>
  244. </div>
  245. </div>
  246. </div>
  247. <!-- Slide Two - Set the background image for this slide in the line below -->
  248. <div class="carousel-item slideTwo" style="">
  249. <div class="carousel-caption text-left">
  250. <div class="row">
  251. <div class="col-md-8">
  252. <h2 class="text-bold">Second Slide</h2>
  253. <p class="lead col-12 col-md-6 ">This is a description for the second slide.</p>
  254. <p class="col-12 col-md-6 font-italic d-none d-md-block"></p>
  255. <a href="#" class="btn btn-outline-success">Get a Free Soil Report now!</a>
  256. </div>
  257. <div class="col-md-4 d-none d-md-block">
  258. <!-- <img src="client-assets/FredTemplate/images/work.png" class="img-fluid mx-auto align-middle" alt="Responsive image"> -->
  259. </div>
  260. </div>
  261. </div>
  262. </div>
  263. <!-- Slide Three - Set the background image for this slide in the line below -->
  264. <div class="carousel-item slideThree" style="">
  265. <div class="carousel-caption text-left">
  266. <div class="row">
  267. <div class="col-md-8">
  268. <h2 class="text-bold">Third Slide</h2>
  269. <p class="lead col-12 col-md-6 ">This is a description for the third slide.</p>
  270. <p class="col-12 col-md-6 font-italic d-none d-md-block"></p>
  271. <a href="#" class="btn btn-outline-success">Get a Free Soil Report now!</a>
  272. </div>
  273. <div class="col-md-4 d-none d-md-block">
  274. <!-- <img src="client-assets/FredTemplate/images/work.png" class="img-fluid mx-auto align-middle" alt="Responsive image"> -->
  275. </div>
  276. </div>
  277. </div>
  278. </div>
  279. </div>
  280. <a class="carousel-control-prev" href="#carouselLandingPage" role="button" data-slide="prev">
  281. <span class="carousel-control-prev-icon" aria-hidden="true"></span>
  282. <span class="sr-only">Previous</span>
  283. </a>
  284. <a class="carousel-control-next" href="#carouselLandingPage" role="button" data-slide="next">
  285. <span class="carousel-control-next-icon" aria-hidden="true"></span>
  286. <span class="sr-only">Next</span>
  287. </a>
  288. </div>
  289. </header>
  290. <!-- Page Content -->
  291. <section id="about" class="py-5">
  292. <div class="container">
  293. <h2 class="text-success">Albrecht Soil Analysis</h2>
  294. <hr>
  295. <blockquote class="blockquote text-center">
  296. <p class="mb-0">The soil is the ‘<i>creative material</i>’ of most of the basic needs of life. Creation starts with a handful of dust.</p>
  297. <footer class="blockquote-footer">Dr. William A. Abrecht. <cite title="Source Title">University of Missouri</cite></footer>
  298. </blockquote>
  299. <hr>
  300. <div class="row card-deck">
  301. <div class="card border-success text-center mb-3">
  302. <div class="card-body">
  303. <h2 class="card-title text-center">Physical</h2>
  304. <i class="fas fa-atom fa-3x"></i>
  305. <p class="card-text">When you correct cation balance, you have addressed soil chemistry, which improves the physical structure of the soil.</p>
  306. </div>
  307. </div>
  308. <div class="card border-success text-center mb-3">
  309. <div class="card-body">
  310. <h2 class="card-title text-center">Chemical</h2>
  311. <i class="fas fa-flask fa-3x"></i>
  312. <p class="card-text">The correction of cation balance and the provision of minimum levels of micronutrients tkatesk care of the chemical part of soil productivity and health.</p>
  313. </div>
  314. </div>
  315. <div class="card border-success text-center mb-3">
  316. <div class="card-body">
  317. <h2 class="card-title text-center">Biological</h2>
  318. <i class="fas fa-bug fa-3x"></i>
  319. <p class="card-text">The essential understanding involves a recognition that the purpose of cation balancing is to stimulate soil biology, and much of the beneficial response relates to firing up this workforce</p>
  320. </div>
  321. </div>
  322. </div>
  323. <hr>
  324. </div>
  325. </section>
  326. <!-- Projects Section -->
  327. <section id="services" class="projects-section bg-light pt-2">
  328. <div class="container">
  329. [[!getResources?
  330. &parents=`94`
  331. &level=`0`
  332. &includeTVs=`1`
  333. &processTVs=`1`
  334. &includeContent=`1`
  335. &tplFirst=`projectsSectionFIRST`
  336. &tpl=`projectsSectionEVEN`
  337. &tplOdd=`projectsSectionODD`
  338. &sortby=`FIELD(modResource.id, 95 )`
  339. &sortdir=`ASC`
  340. &limit=`0`
  341. ]]
  342. </div>
  343. </section>
  344. <section class="bg-dark text-light py-5" id="blog" >
  345. <div class="container">
  346. <p class="lead">
  347. </p>
  348. </div>
  349. </section>
  350. <section class="py-5" id="contact" >
  351. <div class="container">
  352. <p class="lead">
  353. Dr. Albrecht saw a direct link between soil quality and food quality, drawing direct connection between poor quality forage crops, and ill health in livestock.
  354. </p>
  355. </div>
  356. </section>
  357. <section class="bg-dark text-light py-5" id="login" >
  358. <div class="container">
  359. <p class="lead">
  360. Feed the soil to feed the plant is another vital concept of the Albrecht Model of soil building.
  361. </p>
  362. </div>
  363. </section>
  364. <section class="py-5" id="" >
  365. <div class="container">
  366. <p class="lead">
  367. Feed the soil to feed the plant is another vital concept of the Albrecht Model of soil building.
  368. </p>
  369. </div>
  370. </section>
  371. <!-- Signup Section -->
  372. <section id="signup" class="signup-section">
  373. <div class="container">
  374. <div class="row">
  375. <div class="col-md-10 col-lg-8 mx-auto text-center">
  376. <i class="far fa-paper-plane fa-2x mb-2 text-white"></i>
  377. <h2 class="text-white mb-5">Subscribe to receive updates!</h2>
  378. [[!FormIt?
  379. &hooks=`MailChimpSubscribe`
  380. &validate=`email:email:required,name:required`
  381. &validationErrorMessage=`true`
  382. &clearFieldsOnSuccess=`1`
  383. &submitVar=`newsletter-submit`
  384. &mailchimpListId=`04e221f3bc`
  385. &mailchimpFields=`name=FNAME,email=EMAIL`
  386. &mailchimpSubscribeField=`newsletter`
  387. &mailchimpSubscribeFieldValue=`1`
  388. &successMessage=`Thankyou for subscribing`
  389. ]]
  390. <span>[[!+fi.successMessage:notempty=`<h2 class="text-white mb-5">[[!+fi.successMessage]]</h2>`]]
  391. [[!+fi.validation_error_message:notempty=`<h2 class="text-white mb-5">[[+errors]] [[!+fi.validation_error_message]]</h2>`]]</span>
  392. <form action="albrecht-soil-analysis.html#signup" method="post" class="form-inline d-flex">
  393. <input type="hidden" name="nospam" value="" />
  394. <input class="form-control flex-fill mr-0 mr-sm-2 mb-3 mb-sm-0" type="email" name="email" id="email" value="[[!+fi.email]]" placeholder="Email Address" >
  395. <input class="form-control flex-fill mr-0 mr-sm-2 mb-3 mb-sm-0" type="text" name="name" id="name" value="[[!+fi.name]]" placeholder="Full Name">
  396. <input type="submit" name="newsletter-submit" class="btn btn-success mx-auto" value="Subscribe" />
  397. </form>
  398. </div>
  399. </div>
  400. </div>
  401. </section>
  402. <!-- Contact Section -->
  403. <section id="contact" class="contact-section bg-black">
  404. <div class="container">
  405. <div class="row">
  406. <div class="col-md-4 mb-3 mb-md-0">
  407. <div class="card py-4 h-100">
  408. <div class="card-body text-center">
  409. <i class="fas fa-map-marked-alt text-primary mb-2"></i>
  410. <h4 class="text-uppercase m-0">Address</h4>
  411. <hr class="my-4">
  412. <div class="small text-black-50">34 Coplestone Street,<br> Scottsdale, Tasmania 7260</div>
  413. </div>
  414. </div>
  415. </div>
  416. <div class="col-md-4 mb-3 mb-md-0">
  417. <div class="card py-4 h-100">
  418. <div class="card-body text-center">
  419. <i class="fas fa-envelope text-primary mb-2"></i>
  420. <h4 class="text-uppercase m-0">Email</h4>
  421. <hr class="my-4">
  422. <div class="small text-black-50">
  423. <a href="#">enquiry@cropmonitor.info</a>
  424. </div>
  425. </div>
  426. </div>
  427. </div>
  428. <div class="col-md-4 mb-3 mb-md-0">
  429. <div class="card py-4 h-100">
  430. <div class="card-body text-center">
  431. <i class="fas fa-mobile-alt text-primary mb-2"></i>
  432. <h4 class="text-uppercase m-0">Phone</h4>
  433. <hr class="my-4">
  434. <div class="small text-black-50">0417 728 061</div>
  435. </div>
  436. </div>
  437. </div>
  438. </div>
  439. <div class="row">
  440. <div class="col mb-3 mt-3 mb-md-0">
  441. <div class="card py-4 h-100">
  442. <div class="card-body text-center">
  443. <i class="fas fa-mobile-alt text-primary mb-2"></i>
  444. <h4 class="text-uppercase m-0">Contact Us</h4>
  445. <hr class="my-4">
  446. [[!FormIt?
  447. &hooks=`spam,email`
  448. &submitVar=`enquiry-submit`
  449. &emailTpl=`CMenquiryEmailTpl`
  450. &emailTo=`enquiries@cropmonitor.info`
  451. &successMessage=`Thankyou for contacting us, we will be in touch soon.`
  452. &validationErrorMessage=`true`
  453. &validate=`nospam:blank,
  454. name:required,
  455. email:email:required,
  456. text:required:stripTags`
  457. ]]
  458. <span>
  459. [[!+fi.successMessage:notempty=`<div class="small text-black-50">[[!+fi.successMessage]]</div>`]]
  460. [[!+fi.validation_error_message:notempty=`<div class="small text-black-50">[[+errors]] [[!+fi.validation_error_message]]</div>`]]
  461. </span>
  462. <form action="albrecht-soil-analysis.html#contact" method="post" class="form-inline d-flex">
  463. <input type="hidden" name="nospam" value="" />
  464. <input class="form-control form-control-sm flex-fill mr-0 mr-sm-2 mb-3 mb-sm-0" type="email" name="email" id="email" value="[[!+fi.email]]" placeholder="Email Address" >
  465. <input class="form-control form-control-sm flex-fill mr-0 mr-sm-2 mb-3 mb-sm-0" type="text" name="name" id="name" value="[[!+fi.name]]" placeholder="Full Name">
  466. <textarea class="form-control form-control-sm flex-fill mr-0 mr-sm-2 mb-3 mb-sm-0" name="text" id="text" rows="1" value="[[!+fi.text]]" placeholder="Your enquiry is about...." ></textarea>
  467. <input type="submit" name="enquiry-submit" class="btn-sm btn btn-success" value="Submit" />
  468. </form>
  469. </div>
  470. </div>
  471. </div>
  472. </div>
  473. <!--
  474. <div class="social d-flex justify-content-center">
  475. <a href="#" class="mx-2">
  476. <i class="fab fa-youtube"></i>
  477. </a>
  478. <a href="#" class="mx-2">
  479. <i class="fab fa-facebook-f"></i>
  480. </a>
  481. <a href="#" class="mx-2">
  482. <i class="fab fa-linkedin"></i>
  483. </a>
  484. </div>
  485. -->
  486. </div>
  487. </section>
  488. <!-- Footer -->
  489. <footer class="footer bg-dark py-2 text-center text-white-50">
  490. <div class="container">
  491. <span>&copy; 2005-2019 by Crop Monitor</span>. All Rights Reserved<a href="/"></a>
  492. </div>
  493. </footer>
  494. </body>
  495. <!-- jQuery first, then Popper.js, then Bootstrap JS -->
  496. <script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
  497. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
  498. <script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
  499. <script type="text/javascript">
  500. addEventListener("load", function() {
  501. setTimeout(hideURLbar, 0);
  502. }, false);
  503. function hideURLbar(){
  504. window.scrollTo(0,1);
  505. }
  506. </script>
  507. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js" integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o" crossorigin="anonymous"></script>
  508. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js"></script>
  509. <script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.js"></script>
  510. </html>',
  511. '_isForward' => false,
  512. ),
  513. 'contentType' =>
  514. array (
  515. 'id' => 1,
  516. 'name' => 'HTML',
  517. 'description' => 'HTML content',
  518. 'mime_type' => 'text/html',
  519. 'file_extensions' => '.html',
  520. 'headers' => NULL,
  521. 'binary' => 0,
  522. ),
  523. 'policyCache' =>
  524. array (
  525. ),
  526. 'elementCache' =>
  527. array (
  528. '[[*longtitle]]' => 'Albrecht Soil Analysis Reporting',
  529. '[[*introtext]]' => 'When you correct cation balance, you have addressed soil chemistry, which improves the physical structure of the soil.',
  530. '[[*description]]' => 'Dr. Albrecht saw a direct link between soil quality and food quality, drawing a direct connection between poor quality forage crops, and ill health in livestock. Use crop monitor online soil analysis to start the journey to better soil and crop quality.',
  531. '[[$dash-header]]' => '<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  532. <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
  533. <script type="text/javascript" src="https://use.fontawesome.com/1e2844bb90.js"></script>
  534. <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous" />
  535. <link rel="stylesheet" type="text/css" href="/client-assets/weather-icons/css/weather-icons.min.css?version=1.16" />
  536. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css" />',
  537. '[[~18]]' => 'about.html',
  538. '[[~71]]' => 'blog/',
  539. '[[~17]]' => 'contact-us.html',
  540. '[[~4]]' => 'login/',
  541. '[[*id]]' => 94,
  542. '[[~94]]' => 'albrecht-soil-analysis.html',
  543. '[[SimpleCopyright? &startYear=`2005`]]' => '<span>&copy; 2005-2019 by Crop Monitor</span>',
  544. '[[~1]]' => '/',
  545. '[[$dash-footer]]' => '<!-- jQuery first, then Popper.js, then Bootstrap JS -->
  546. <script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
  547. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
  548. <script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
  549. <script type="text/javascript">
  550. addEventListener("load", function() {
  551. setTimeout(hideURLbar, 0);
  552. }, false);
  553. function hideURLbar(){
  554. window.scrollTo(0,1);
  555. }
  556. </script>
  557. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js" integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o" crossorigin="anonymous"></script>
  558. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js"></script>
  559. <script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.js"></script>',
  560. ),
  561. 'sourceCache' =>
  562. array (
  563. 'modChunk' =>
  564. array (
  565. 'dash-header' =>
  566. array (
  567. 'fields' =>
  568. array (
  569. 'id' => 13,
  570. 'source' => 0,
  571. 'property_preprocess' => false,
  572. 'name' => 'dash-header',
  573. 'description' => '',
  574. 'editor_type' => 0,
  575. 'category' => 0,
  576. 'cache_type' => 0,
  577. 'snippet' => '<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  578. <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
  579. <script type="text/javascript" src="https://use.fontawesome.com/1e2844bb90.js"></script>
  580. <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous" />
  581. <link rel="stylesheet" type="text/css" href="/client-assets/weather-icons/css/weather-icons.min.css?version=1.16" />
  582. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css" />',
  583. 'locked' => false,
  584. 'properties' =>
  585. array (
  586. ),
  587. 'static' => false,
  588. 'static_file' => '',
  589. 'content' => '<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  590. <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
  591. <script type="text/javascript" src="https://use.fontawesome.com/1e2844bb90.js"></script>
  592. <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous" />
  593. <link rel="stylesheet" type="text/css" href="/client-assets/weather-icons/css/weather-icons.min.css?version=1.16" />
  594. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css" />',
  595. ),
  596. 'policies' =>
  597. array (
  598. 'web' =>
  599. array (
  600. ),
  601. ),
  602. 'source' =>
  603. array (
  604. ),
  605. ),
  606. 'sc_chunk' =>
  607. array (
  608. 'fields' =>
  609. array (
  610. 'id' => 24,
  611. 'source' => 1,
  612. 'property_preprocess' => false,
  613. 'name' => 'sc_chunk',
  614. 'description' => 'This chunk styles the year output',
  615. 'editor_type' => 0,
  616. 'category' => 4,
  617. 'cache_type' => 0,
  618. 'snippet' => '<span>&copy; [[+output]] by [[++site_name]]</span>',
  619. 'locked' => false,
  620. 'properties' =>
  621. array (
  622. ),
  623. 'static' => false,
  624. 'static_file' => '',
  625. 'content' => '<span>&copy; [[+output]] by [[++site_name]]</span>',
  626. ),
  627. 'policies' =>
  628. array (
  629. 'web' =>
  630. array (
  631. ),
  632. ),
  633. 'source' =>
  634. array (
  635. 'id' => 1,
  636. 'name' => 'Filesystem',
  637. 'description' => '',
  638. 'class_key' => 'sources.modFileMediaSource',
  639. 'properties' =>
  640. array (
  641. 'fred' =>
  642. array (
  643. 'name' => 'fred',
  644. 'desc' => '',
  645. 'type' => 'combo-boolean',
  646. 'options' =>
  647. array (
  648. ),
  649. 'value' => false,
  650. 'lexicon' => NULL,
  651. ),
  652. 'fredReadOnly' =>
  653. array (
  654. 'name' => 'fredReadOnly',
  655. 'desc' => '',
  656. 'type' => 'combo-boolean',
  657. 'options' =>
  658. array (
  659. ),
  660. 'value' => false,
  661. 'lexicon' => NULL,
  662. ),
  663. ),
  664. 'is_stream' => true,
  665. ),
  666. ),
  667. 'dash-footer' =>
  668. array (
  669. 'fields' =>
  670. array (
  671. 'id' => 15,
  672. 'source' => 0,
  673. 'property_preprocess' => false,
  674. 'name' => 'dash-footer',
  675. 'description' => '',
  676. 'editor_type' => 0,
  677. 'category' => 0,
  678. 'cache_type' => 0,
  679. 'snippet' => '<!-- jQuery first, then Popper.js, then Bootstrap JS -->
  680. <script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
  681. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
  682. <script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
  683. <script type="text/javascript">
  684. addEventListener("load", function() {
  685. setTimeout(hideURLbar, 0);
  686. }, false);
  687. function hideURLbar(){
  688. window.scrollTo(0,1);
  689. }
  690. </script>
  691. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js" integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o" crossorigin="anonymous"></script>
  692. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js"></script>
  693. <script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.js"></script>',
  694. 'locked' => false,
  695. 'properties' =>
  696. array (
  697. ),
  698. 'static' => false,
  699. 'static_file' => '',
  700. 'content' => '<!-- jQuery first, then Popper.js, then Bootstrap JS -->
  701. <script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
  702. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
  703. <script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
  704. <script type="text/javascript">
  705. addEventListener("load", function() {
  706. setTimeout(hideURLbar, 0);
  707. }, false);
  708. function hideURLbar(){
  709. window.scrollTo(0,1);
  710. }
  711. </script>
  712. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js" integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o" crossorigin="anonymous"></script>
  713. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js"></script>
  714. <script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.js"></script>',
  715. ),
  716. 'policies' =>
  717. array (
  718. 'web' =>
  719. array (
  720. ),
  721. ),
  722. 'source' =>
  723. array (
  724. ),
  725. ),
  726. ),
  727. 'modSnippet' =>
  728. array (
  729. 'SimpleCopyright' =>
  730. array (
  731. 'fields' =>
  732. array (
  733. 'id' => 12,
  734. 'source' => 1,
  735. 'property_preprocess' => false,
  736. 'name' => 'SimpleCopyright',
  737. 'description' => 'This Snippet returns the current year and can be called with a placeholder for the start year of the website.',
  738. 'editor_type' => 0,
  739. 'category' => 4,
  740. 'cache_type' => 0,
  741. 'snippet' => '/*
  742. * DESCRIPTION:
  743. * This snippet returns the current year
  744. * It is then styled with a chunk to output a copyright notice which you can adapt to fit your needs.
  745. * You can call this snippet with a startyear for your website.
  746. * If you use a start year it automatically changes when the year passes.
  747. * i.e. 2012 turns into 2012-2013
  748. *
  749. * PARAMETERS:
  750. * @ &startYear (string) optional. Default: Current Year
  751. * @ &separator (string) optional. Default: \'-\'
  752. * @ &static (bool) optional. Default: 0
  753. * @ &tpl (string) optional. Default: \'sc_chunk\'
  754. *
  755. * PLACEHOLDERS:
  756. * @ [[+output]]
  757. *
  758. * The usage defines \'2012\' as the \'current\' year purely for illustration purpose only.
  759. * This is obviously wrong in 2013 or up...
  760. *
  761. * USAGE:
  762. * // Outputs: "&copy; 2012 by [[+site_name]]"
  763. * [[SimpleCopyright]]
  764. *
  765. * // Outputs: "&copy; 2007-2012 by [[+site_name]]"
  766. * // After newyears eve it turns into 2012-2013 automatically
  767. * [[SimpleCopyright? &startYear=`2007`]]
  768. *
  769. * // Outputs: "&copy; 2004 by [[+site_name]]".
  770. * // Always use \'static\' in conjunction with \'startYear\'.
  771. * // If you use \'static\' only it will ignore it\'s setting and resolve to the current year.
  772. * [[SimpleCopyright? &startYear=`2004` &static=`1`]]
  773. *
  774. * You can also set the separator just for fun...
  775. * It defaults to "-"
  776. *
  777. * This outputs "&copy; 2007/2012"
  778. * [[SimpleCopyright? &startYear=`2007` &separator=`/`]]
  779. *
  780. */
  781. // Get the current year
  782. $currentYear = date(\'Y\');
  783. // Check for a starting year, separator, static & chunk
  784. $startYear = (string) $modx->getOption(\'startYear\', $scriptProperties);
  785. $separator = (string) $modx->getOption(\'separator\', $scriptProperties, \'-\');
  786. $static = (bool) $modx->getOption(\'static\', $scriptProperties, 0);
  787. $tpl = (string) $modx->getOption(\'tpl\', $scriptProperties, \'sc_chunk\');
  788. if($static&&!empty($startYear)){
  789. // is static : can be the future too
  790. $construct = $startYear;
  791. } elseif(!empty($startYear)) {
  792. // is semi dynamic : set with a starting year that never exceeds the future
  793. $construct = ($startYear>=$currentYear ? $currentYear : $startYear.$separator.$currentYear);
  794. } else {
  795. // is dynamic : changes with each year
  796. $construct = $currentYear;
  797. }
  798. // Get a chunk to style the output & check if it exists...
  799. $chunk = $modx->getObject(\'modChunk\',array(
  800. \'name\' => $tpl
  801. ));
  802. if (!$chunk){
  803. // If no chunk is found return error & write to log
  804. $modx->log(xPDO::LOG_LEVEL_ERROR, \'No chunk found!\');
  805. return \'No chunk found!\';
  806. } else {
  807. $outputString = $modx->getChunk($tpl,array(
  808. \'output\' => $construct
  809. ));
  810. }
  811. return $outputString;',
  812. 'locked' => false,
  813. 'properties' =>
  814. array (
  815. ),
  816. 'moduleguid' => '',
  817. 'static' => false,
  818. 'static_file' => '',
  819. 'content' => '/*
  820. * DESCRIPTION:
  821. * This snippet returns the current year
  822. * It is then styled with a chunk to output a copyright notice which you can adapt to fit your needs.
  823. * You can call this snippet with a startyear for your website.
  824. * If you use a start year it automatically changes when the year passes.
  825. * i.e. 2012 turns into 2012-2013
  826. *
  827. * PARAMETERS:
  828. * @ &startYear (string) optional. Default: Current Year
  829. * @ &separator (string) optional. Default: \'-\'
  830. * @ &static (bool) optional. Default: 0
  831. * @ &tpl (string) optional. Default: \'sc_chunk\'
  832. *
  833. * PLACEHOLDERS:
  834. * @ [[+output]]
  835. *
  836. * The usage defines \'2012\' as the \'current\' year purely for illustration purpose only.
  837. * This is obviously wrong in 2013 or up...
  838. *
  839. * USAGE:
  840. * // Outputs: "&copy; 2012 by [[+site_name]]"
  841. * [[SimpleCopyright]]
  842. *
  843. * // Outputs: "&copy; 2007-2012 by [[+site_name]]"
  844. * // After newyears eve it turns into 2012-2013 automatically
  845. * [[SimpleCopyright? &startYear=`2007`]]
  846. *
  847. * // Outputs: "&copy; 2004 by [[+site_name]]".
  848. * // Always use \'static\' in conjunction with \'startYear\'.
  849. * // If you use \'static\' only it will ignore it\'s setting and resolve to the current year.
  850. * [[SimpleCopyright? &startYear=`2004` &static=`1`]]
  851. *
  852. * You can also set the separator just for fun...
  853. * It defaults to "-"
  854. *
  855. * This outputs "&copy; 2007/2012"
  856. * [[SimpleCopyright? &startYear=`2007` &separator=`/`]]
  857. *
  858. */
  859. // Get the current year
  860. $currentYear = date(\'Y\');
  861. // Check for a starting year, separator, static & chunk
  862. $startYear = (string) $modx->getOption(\'startYear\', $scriptProperties);
  863. $separator = (string) $modx->getOption(\'separator\', $scriptProperties, \'-\');
  864. $static = (bool) $modx->getOption(\'static\', $scriptProperties, 0);
  865. $tpl = (string) $modx->getOption(\'tpl\', $scriptProperties, \'sc_chunk\');
  866. if($static&&!empty($startYear)){
  867. // is static : can be the future too
  868. $construct = $startYear;
  869. } elseif(!empty($startYear)) {
  870. // is semi dynamic : set with a starting year that never exceeds the future
  871. $construct = ($startYear>=$currentYear ? $currentYear : $startYear.$separator.$currentYear);
  872. } else {
  873. // is dynamic : changes with each year
  874. $construct = $currentYear;
  875. }
  876. // Get a chunk to style the output & check if it exists...
  877. $chunk = $modx->getObject(\'modChunk\',array(
  878. \'name\' => $tpl
  879. ));
  880. if (!$chunk){
  881. // If no chunk is found return error & write to log
  882. $modx->log(xPDO::LOG_LEVEL_ERROR, \'No chunk found!\');
  883. return \'No chunk found!\';
  884. } else {
  885. $outputString = $modx->getChunk($tpl,array(
  886. \'output\' => $construct
  887. ));
  888. }
  889. return $outputString;',
  890. ),
  891. 'policies' =>
  892. array (
  893. 'web' =>
  894. array (
  895. ),
  896. ),
  897. 'source' =>
  898. array (
  899. 'id' => 1,
  900. 'name' => 'Filesystem',
  901. 'description' => '',
  902. 'class_key' => 'sources.modFileMediaSource',
  903. 'properties' =>
  904. array (
  905. 'fred' =>
  906. array (
  907. 'name' => 'fred',
  908. 'desc' => '',
  909. 'type' => 'combo-boolean',
  910. 'options' =>
  911. array (
  912. ),
  913. 'value' => false,
  914. 'lexicon' => NULL,
  915. ),
  916. 'fredReadOnly' =>
  917. array (
  918. 'name' => 'fredReadOnly',
  919. 'desc' => '',
  920. 'type' => 'combo-boolean',
  921. 'options' =>
  922. array (
  923. ),
  924. 'value' => false,
  925. 'lexicon' => NULL,
  926. ),
  927. ),
  928. 'is_stream' => true,
  929. ),
  930. ),
  931. 'Gallery' =>
  932. array (
  933. 'fields' =>
  934. array (
  935. 'id' => 129,
  936. 'source' => 0,
  937. 'property_preprocess' => false,
  938. 'name' => 'Gallery',
  939. 'description' => '',
  940. 'editor_type' => 0,
  941. 'category' => 45,
  942. 'cache_type' => 0,
  943. 'snippet' => '/**
  944. * Gallery
  945. *
  946. * Copyright 2010-2012 by Shaun McCormick <shaun@modx.com>
  947. *
  948. * Gallery is free software; you can redistribute it and/or modify it under the
  949. * terms of the GNU General Public License as published by the Free Software
  950. * Foundation; either version 2 of the License, or (at your option) any later
  951. * version.
  952. *
  953. * Gallery is distributed in the hope that it will be useful, but WITHOUT ANY
  954. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  955. * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  956. *
  957. * You should have received a copy of the GNU General Public License along with
  958. * Gallery; if not, write to the Free Software Foundation, Inc., 59 Temple
  959. * Place, Suite 330, Boston, MA 02111-1307 USA
  960. *
  961. * @package gallery
  962. */
  963. /**
  964. * The main Gallery snippet.
  965. *
  966. * @var modX $modx
  967. * @var Gallery $gallery
  968. *
  969. * @package gallery
  970. */
  971. $gallery = $modx->getService(\'gallery\',\'Gallery\',$modx->getOption(\'gallery.core_path\',null,$modx->getOption(\'core_path\').\'components/gallery/\').\'model/gallery/\',$scriptProperties);
  972. if (!($gallery instanceof Gallery)) return \'\';
  973. $modx->lexicon->load(\'gallery:web\');
  974. /* check for REQUEST vars if property set */
  975. $imageGetParam = $modx->getOption(\'imageGetParam\',$scriptProperties,\'galItem\');
  976. $albumRequestVar = $modx->getOption(\'albumRequestVar\',$scriptProperties,\'galAlbum\');
  977. $tagRequestVar = $modx->getOption(\'tagRequestVar\',$scriptProperties,\'galTag\');
  978. if ($modx->getOption(\'checkForRequestAlbumVar\',$scriptProperties,true)) {
  979. if (!empty($_REQUEST[$albumRequestVar])) $scriptProperties[\'album\'] = $_REQUEST[$albumRequestVar];
  980. }
  981. if ($modx->getOption(\'checkForRequestTagVar\',$scriptProperties,true)) {
  982. if (!empty($_REQUEST[$tagRequestVar])) $scriptProperties[\'tag\'] = $_REQUEST[$tagRequestVar];
  983. }
  984. if (empty($scriptProperties[\'album\']) && empty($scriptProperties[\'tag\'])) return \'\';
  985. $data = $modx->call(\'galItem\',\'getList\',array(&$modx,$scriptProperties));
  986. $totalVar = $modx->getOption(\'totalVar\', $scriptProperties, \'total\');
  987. $modx->setPlaceholder($totalVar,$data[\'total\']);
  988. /* load plugins */
  989. $plugin = $modx->getOption(\'plugin\',$scriptProperties,\'\');
  990. if (!empty($plugin)) {
  991. $pluginPath = $modx->getOption(\'pluginPath\',$scriptProperties,\'\');
  992. if (empty($pluginPath)) {
  993. $pluginPath = $gallery->config[\'modelPath\'].\'gallery/plugins/\';
  994. }
  995. /** @var GalleryPlugin $plugin */
  996. if (($className = $modx->loadClass($plugin,$pluginPath,true,true))) {
  997. $plugin = new $className($gallery,$scriptProperties);
  998. $plugin->load();
  999. $scriptProperties = $plugin->adjustSettings($scriptProperties);
  1000. } else {
  1001. return $modx->lexicon(\'gallery.plugin_err_load\',array(\'name\' => $plugin,\'path\' => $pluginPath));
  1002. }
  1003. } else {
  1004. if ($modx->getOption(\'useCss\',$scriptProperties,true)) {
  1005. $modx->regClientCSS($gallery->config[\'cssUrl\'].\'web.css\');
  1006. }
  1007. }
  1008. /* iterate */
  1009. $imageProperties = $modx->getOption(\'imageProperties\',$scriptProperties,\'\');
  1010. $imageProperties = !empty($imageProperties) ? $modx->fromJSON($imageProperties) : array();
  1011. $imageProperties = array_merge(array(
  1012. \'w\' => (int)$modx->getOption(\'imageWidth\',$scriptProperties,500),
  1013. \'h\' => (int)$modx->getOption(\'imageHeight\',$scriptProperties,500),
  1014. \'zc\' => (boolean)$modx->getOption(\'imageZoomCrop\',$scriptProperties,0),
  1015. \'far\' => (string)$modx->getOption(\'imageFar\',$scriptProperties,false),
  1016. \'q\' => (int)$modx->getOption(\'imageQuality\',$scriptProperties,90),
  1017. ),$imageProperties);
  1018. $thumbProperties = $modx->getOption(\'thumbProperties\',$scriptProperties,\'\');
  1019. $thumbProperties = !empty($thumbProperties) ? $modx->fromJSON($thumbProperties) : array();
  1020. $thumbProperties = array_merge(array(
  1021. \'w\' => (int)$modx->getOption(\'thumbWidth\',$scriptProperties,100),
  1022. \'h\' => (int)$modx->getOption(\'thumbHeight\',$scriptProperties,100),
  1023. \'zc\' => (boolean)$modx->getOption(\'thumbZoomCrop\',$scriptProperties,1),
  1024. \'far\' => (string)$modx->getOption(\'thumbFar\',$scriptProperties,\'C\'),
  1025. \'q\' => (int)$modx->getOption(\'thumbQuality\',$scriptProperties,90),
  1026. ),$thumbProperties);
  1027. $idx = 0;
  1028. $output = array();
  1029. $filesUrl = $modx->call(\'galAlbum\',\'getFilesUrl\',array(&$modx));
  1030. $filesPath = $modx->call(\'galAlbum\',\'getFilesPath\',array(&$modx));
  1031. $itemCls = $modx->getOption(\'itemCls\',$scriptProperties,\'gal-item\');
  1032. $imageAttributes = $modx->getOption(\'imageAttributes\',$scriptProperties,\'\');
  1033. $linkAttributes = $modx->getOption(\'linkAttributes\',$scriptProperties,\'\');
  1034. $linkToImage = $modx->getOption(\'linkToImage\',$scriptProperties,false);
  1035. $activeCls = $modx->getOption(\'activeCls\',$scriptProperties,\'gal-item-active\');
  1036. $highlightItem = $modx->getOption($imageGetParam,$_REQUEST,false);
  1037. $defaultThumbTpl = $modx->getOption(\'thumbTpl\',$scriptProperties,\'galItemThumb\');
  1038. /** @var galItem $item */
  1039. if (!is_array($data)) return \'\';
  1040. // prep for &thumbTpl_N
  1041. $keys = array_keys($scriptProperties);
  1042. $nthTpls = array();
  1043. foreach($keys as $key) {
  1044. $keyBits = $gallery->explodeAndClean($key, \'_\');
  1045. if (isset($keyBits[0]) && $keyBits[0] === \'thumbTpl\') {
  1046. if ($i = (int) $keyBits[1]) $nthTpls[$i] = $scriptProperties[$key];
  1047. }
  1048. }
  1049. ksort($nthTpls);
  1050. foreach ($data[\'items\'] as $item) {
  1051. $itemArray = $item->toArray();
  1052. $itemArray[\'idx\'] = $idx;
  1053. $itemArray[\'cls\'] = $itemCls;
  1054. if ($itemArray[\'id\'] == $highlightItem) {
  1055. $itemArray[\'cls\'] .= \' \'.$activeCls;
  1056. }
  1057. $itemArray[\'filename\'] = basename($item->get(\'filename\'));
  1058. $itemArray[\'image_absolute\'] = $item->get(\'base_url\').$filesUrl.$item->get(\'filename\');
  1059. $itemArray[\'fileurl\'] = $itemArray[\'image_absolute\'];
  1060. $itemArray[\'filepath\'] = $filesPath.$item->get(\'filename\');
  1061. $itemArray[\'filesize\'] = $item->get(\'filesize\');
  1062. $itemArray[\'thumbnail\'] = $item->get(\'thumbnail\',$thumbProperties);
  1063. $itemArray[\'image\'] = $item->get(\'thumbnail\',$imageProperties);
  1064. $itemArray[\'image_attributes\'] = $imageAttributes;
  1065. $itemArray[\'link_attributes\'] = $linkAttributes;
  1066. if (!empty($scriptProperties[\'album\'])) $itemArray[\'album\'] = $scriptProperties[\'album\'];
  1067. if (!empty($scriptProperties[\'tag\'])) $itemArray[\'tag\'] = $scriptProperties[\'tag\'];
  1068. $itemArray[\'linkToImage\'] = $linkToImage;
  1069. $itemArray[\'url\'] = $item->get(\'url\');
  1070. $itemArray[\'imageGetParam\'] = $imageGetParam;
  1071. $itemArray[\'albumRequestVar\'] = $albumRequestVar;
  1072. $itemArray[\'tagRequestVar\'] = $tagRequestVar;
  1073. $itemArray[\'tag\'] = \'\';
  1074. if ($plugin) {
  1075. $plugin->renderItem($itemArray);
  1076. }
  1077. $thumbTpl = $defaultThumbTpl;
  1078. if (isset($nthTpls[$idx])) {
  1079. $thumbTpl = $nthTpls[$idx];
  1080. } else {
  1081. foreach ($nthTpls as $int => $tpl) {
  1082. if ( ($idx % $int) === 0 ) $thumbTpl = $tpl;
  1083. }
  1084. }
  1085. $output[] = $gallery->getChunk($thumbTpl,$itemArray);
  1086. $idx++;
  1087. }
  1088. $output = implode("\\n",$output);
  1089. /* if set, place in a container tpl */
  1090. $containerTpl = $modx->getOption(\'containerTpl\',$scriptProperties,false);
  1091. if (!empty($containerTpl)) {
  1092. $ct = $gallery->getChunk($containerTpl,array(
  1093. \'thumbnails\' => $output,
  1094. \'album_name\' => $data[\'album\'][\'name\'],
  1095. \'album_description\' => $data[\'album\'][\'description\'],
  1096. \'album_year\' => isset($data[\'album\'][\'year\']) ? $data[\'album\'][\'year\'] : \'\',
  1097. \'albumRequestVar\' => $albumRequestVar,
  1098. \'albumId\' => $data[\'album\'][\'id\'],
  1099. ));
  1100. if (!empty($ct)) $output = $ct;
  1101. }
  1102. /* set to placeholders or output directly */
  1103. $toPlaceholder = $modx->getOption(\'toPlaceholder\',$scriptProperties,false);
  1104. if (!empty($toPlaceholder)) {
  1105. $modx->toPlaceholders(array(
  1106. $toPlaceholder => $output,
  1107. $toPlaceholder.\'.id\' => $data[\'album\'][\'id\'],
  1108. $toPlaceholder.\'.name\' => $data[\'album\'][\'name\'],
  1109. $toPlaceholder.\'.year\' => isset($data[\'album\'][\'year\']) ? $data[\'album\'][\'year\'] : \'\',
  1110. $toPlaceholder.\'.description\' => $data[\'album\'][\'description\'],
  1111. $toPlaceholder.\'.total\' => $data[\'total\'],
  1112. $toPlaceholder.\'.next\' => $data[\'album\'][\'id\'] + 1,
  1113. $toPlaceholder.\'.prev\' => $data[\'album\'][\'id\'] - 1,
  1114. ));
  1115. } else {
  1116. $placeholderPrefix = $modx->getOption(\'placeholderPrefix\',$scriptProperties,\'gallery.\');
  1117. $modx->toPlaceholders(array(
  1118. $placeholderPrefix.\'id\' => $data[\'album\'][\'id\'],
  1119. $placeholderPrefix.\'name\' => $data[\'album\'][\'name\'],
  1120. $placeholderPrefix.\'year\' => isset($data[\'album\'][\'year\']) ? $data[\'album\'][\'year\'] : \'\',
  1121. $placeholderPrefix.\'description\' => $data[\'album\'][\'description\'],
  1122. $placeholderPrefix.\'total\' => $data[\'total\'],
  1123. $placeholderPrefix.\'next\' => $data[\'album\'][\'id\'] + 1,
  1124. $placeholderPrefix.\'prev\' => $data[\'album\'][\'id\'] - 1,
  1125. ));
  1126. return $output;
  1127. }
  1128. return \'\';',
  1129. 'locked' => false,
  1130. 'properties' =>
  1131. array (
  1132. 'album' =>
  1133. array (
  1134. 'name' => 'album',
  1135. 'desc' => 'gallery.album_desc',
  1136. 'type' => 'textfield',
  1137. 'options' => '',
  1138. 'value' => '',
  1139. 'lexicon' => 'gallery:properties',
  1140. 'area' => '',
  1141. 'desc_trans' => 'Will load only items from this album. Can be either the name or ID of the Album.',
  1142. 'area_trans' => '',
  1143. ),
  1144. 'tag' =>
  1145. array (
  1146. 'name' => 'tag',
  1147. 'desc' => 'gallery.tag_desc',
  1148. 'type' => 'textfield',
  1149. 'options' => '',
  1150. 'value' => '',
  1151. 'lexicon' => 'gallery:properties',
  1152. 'area' => '',
  1153. 'desc_trans' => 'Will load only items with this tag.',
  1154. 'area_trans' => '',
  1155. ),
  1156. 'plugin' =>
  1157. array (
  1158. 'name' => 'plugin',
  1159. 'desc' => 'gallery.plugin_desc',
  1160. 'type' => 'textfield',
  1161. 'options' => '',
  1162. 'value' => '',
  1163. 'lexicon' => 'gallery:properties',
  1164. 'area' => '',
  1165. 'desc_trans' => 'The name of a plugin to use for front-end displaying. Please see the official docs for a list of available plugins.',
  1166. 'area_trans' => '',
  1167. ),
  1168. 'pluginPath' =>
  1169. array (
  1170. 'name' => 'pluginPath',
  1171. 'desc' => 'gallery.pluginpath_desc',
  1172. 'type' => 'textfield',
  1173. 'options' => '',
  1174. 'value' => '',
  1175. 'lexicon' => 'gallery:properties',
  1176. 'area' => '',
  1177. 'desc_trans' => 'Could not load plugin "[[+name]]" from path: [[+path]]',
  1178. 'area_trans' => '',
  1179. ),
  1180. 'thumbTpl' =>
  1181. array (
  1182. 'name' => 'thumbTpl',
  1183. 'desc' => 'gallery.thumbtpl_desc',
  1184. 'type' => 'textfield',
  1185. 'options' => '',
  1186. 'value' => 'galItemThumb',
  1187. 'lexicon' => 'gallery:properties',
  1188. 'area' => '',
  1189. 'desc_trans' => 'The Chunk to use as a tpl for each thumbnail.',
  1190. 'area_trans' => '',
  1191. ),
  1192. 'containerTpl' =>
  1193. array (
  1194. 'name' => 'containerTpl',
  1195. 'desc' => 'gallery.containertpl_desc',
  1196. 'type' => 'textfield',
  1197. 'options' => '',
  1198. 'value' => '',
  1199. 'lexicon' => 'gallery:properties',
  1200. 'area' => '',
  1201. 'desc_trans' => 'An optional chunk to wrap the output in.',
  1202. 'area_trans' => '',
  1203. ),
  1204. 'itemCls' =>
  1205. array (
  1206. 'name' => 'itemCls',
  1207. 'desc' => 'gallery.itemcls_desc',
  1208. 'type' => 'textfield',
  1209. 'options' => '',
  1210. 'value' => 'gal-item',
  1211. 'lexicon' => 'gallery:properties',
  1212. 'area' => '',
  1213. 'desc_trans' => 'The CSS class for each thumbnail.',
  1214. 'area_trans' => '',
  1215. ),
  1216. 'activeCls' =>
  1217. array (
  1218. 'name' => 'activeCls',
  1219. 'desc' => 'gallery.activecls_desc',
  1220. 'type' => 'textfield',
  1221. 'options' => '',
  1222. 'value' => 'gal-item-active',
  1223. 'lexicon' => 'gallery:properties',
  1224. 'area' => '',
  1225. 'desc_trans' => 'The CSS class to add when the active item (the item specified in the GalleryItem snippet) is displayed.',
  1226. 'area_trans' => '',
  1227. ),
  1228. 'toPlaceholder' =>
  1229. array (
  1230. 'name' => 'toPlaceholder',
  1231. 'desc' => 'gallery.toplaceholder_desc',
  1232. 'type' => 'textfield',
  1233. 'options' => '',
  1234. 'value' => '',
  1235. 'lexicon' => 'gallery:properties',
  1236. 'area' => '',
  1237. 'desc_trans' => 'If set, will set the output to a placeholder of this value, and the snippet call will output nothing.',
  1238. 'area_trans' => '',
  1239. ),
  1240. 'thumbWidth' =>
  1241. array (
  1242. 'name' => 'thumbWidth',
  1243. 'desc' => 'gallery.thumbwidth_desc',
  1244. 'type' => 'textfield',
  1245. 'options' => '',
  1246. 'value' => '100',
  1247. 'lexicon' => 'gallery:properties',
  1248. 'area' => '',
  1249. 'desc_trans' => 'The width of the generated thumbnails, in pixels.',
  1250. 'area_trans' => '',
  1251. ),
  1252. 'thumbHeight' =>
  1253. array (
  1254. 'name' => 'thumbHeight',
  1255. 'desc' => 'gallery.thumbheight_desc',
  1256. 'type' => 'textfield',
  1257. 'options' => '',
  1258. 'value' => '100',
  1259. 'lexicon' => 'gallery:properties',
  1260. 'area' => '',
  1261. 'desc_trans' => 'The height of the generated thumbnails, in pixels.',
  1262. 'area_trans' => '',
  1263. ),
  1264. 'thumbZoomCrop' =>
  1265. array (
  1266. 'name' => 'thumbZoomCrop',
  1267. 'desc' => 'gallery.thumbzoomcrop_desc',
  1268. 'type' => 'combo-boolean',
  1269. 'options' => '',
  1270. 'value' => true,
  1271. 'lexicon' => 'gallery:properties',
  1272. 'area' => '',
  1273. 'desc_trans' => 'Whether or not the thumbnail will be zoom-cropped.',
  1274. 'area_trans' => '',
  1275. ),
  1276. 'thumbFar' =>
  1277. array (
  1278. 'name' => 'thumbFar',
  1279. 'desc' => 'gallery.thumbfar_desc',
  1280. 'type' => 'textfield',
  1281. 'options' => '',
  1282. 'value' => 'C',
  1283. 'lexicon' => 'gallery:properties',
  1284. 'area' => '',
  1285. 'desc_trans' => 'The "far" value for phpThumb for the thumbnail, for aspect ratio zooming.',
  1286. 'area_trans' => '',
  1287. ),
  1288. 'thumbQuality' =>
  1289. array (
  1290. 'name' => 'thumbQuality',
  1291. 'desc' => 'gallery.thumbquality_desc',
  1292. 'type' => 'textfield',
  1293. 'options' => '',
  1294. 'value' => 90,
  1295. 'lexicon' => 'gallery:properties',
  1296. 'area' => '',
  1297. 'desc_trans' => 'The "q" value for phpThumb for the thumbnail, for quality.',
  1298. 'area_trans' => '',
  1299. ),
  1300. 'thumbProperties' =>
  1301. array (
  1302. 'name' => 'thumbProperties',
  1303. 'desc' => 'gallery.thumbproperties_desc',
  1304. 'type' => 'textfield',
  1305. 'options' => '',
  1306. 'value' => '',
  1307. 'lexicon' => 'gallery:properties',
  1308. 'area' => '',
  1309. 'desc_trans' => 'A JSON object of parameters to pass to phpThumb as properties for the thumbnail.',
  1310. 'area_trans' => '',
  1311. ),
  1312. 'linkToImage' =>
  1313. array (
  1314. 'name' => 'linkToImage',
  1315. 'desc' => 'gallery.linktoimage_desc',
  1316. 'type' => 'combo-boolean',
  1317. 'options' => '',
  1318. 'value' => '',
  1319. 'lexicon' => 'gallery:properties',
  1320. 'area' => '',
  1321. 'desc_trans' => 'If true, will link directly to the image. If false, will append GET parameters to the URL to load the image with the GalleryItem snippet.',
  1322. 'area_trans' => '',
  1323. ),
  1324. 'imageGetParam' =>
  1325. array (
  1326. 'name' => 'imageGetParam',
  1327. 'desc' => 'gallery.imagegetparam_desc',
  1328. 'type' => 'textfield',
  1329. 'options' => '',
  1330. 'value' => 'galItem',
  1331. 'lexicon' => 'gallery:properties',
  1332. 'area' => '',
  1333. 'desc_trans' => 'The GET param to use when not linking directly to an image. Make sure this matches the getParam property in the GalleryItem snippet call.',
  1334. 'area_trans' => '',
  1335. ),
  1336. 'imageWidth' =>
  1337. array (
  1338. 'name' => 'imageWidth',
  1339. 'desc' => 'gallery.imagewidth_desc',
  1340. 'type' => 'textfield',
  1341. 'options' => '',
  1342. 'value' => 500,
  1343. 'lexicon' => 'gallery:properties',
  1344. 'area' => '',
  1345. 'desc_trans' => 'If being used by a plugin, the width of the currently on-display image.',
  1346. 'area_trans' => '',
  1347. ),
  1348. 'imageHeight' =>
  1349. array (
  1350. 'name' => 'imageHeight',
  1351. 'desc' => 'gallery.imageheight_desc',
  1352. 'type' => 'textfield',
  1353. 'options' => '',
  1354. 'value' => 500,
  1355. 'lexicon' => 'gallery:properties',
  1356. 'area' => '',
  1357. 'desc_trans' => 'If being used by a plugin, the height of the currently on-display image.',
  1358. 'area_trans' => '',
  1359. ),
  1360. 'imageZoomCrop' =>
  1361. array (
  1362. 'name' => 'imageZoomCrop',
  1363. 'desc' => 'gallery.imagezoomcrop_desc',
  1364. 'type' => 'combo-boolean',
  1365. 'options' => '',
  1366. 'value' => false,
  1367. 'lexicon' => 'gallery:properties',
  1368. 'area' => '',
  1369. 'desc_trans' => 'If being used by a plugin, whether or not the currently on-display image will be zoom-cropped.',
  1370. 'area_trans' => '',
  1371. ),
  1372. 'imageFar' =>
  1373. array (
  1374. 'name' => 'imageFar',
  1375. 'desc' => 'gallery.imagefar_desc',
  1376. 'type' => 'textfield',
  1377. 'options' => '',
  1378. 'value' => '',
  1379. 'lexicon' => 'gallery:properties',
  1380. 'area' => '',
  1381. 'desc_trans' => 'The "far" value for phpThumb for the image, for aspect ratio zooming.',
  1382. 'area_trans' => '',
  1383. ),
  1384. 'imageQuality' =>
  1385. array (
  1386. 'name' => 'imageQuality',
  1387. 'desc' => 'gallery.imagequality_desc',
  1388. 'type' => 'textfield',
  1389. 'options' => '',
  1390. 'value' => 90,
  1391. 'lexicon' => 'gallery:properties',
  1392. 'area' => '',
  1393. 'desc_trans' => 'The "q" value for phpThumb for the image, for quality.',
  1394. 'area_trans' => '',
  1395. ),
  1396. 'imageProperties' =>
  1397. array (
  1398. 'name' => 'imageProperties',
  1399. 'desc' => 'gallery.imageproperties_desc',
  1400. 'type' => 'textfield',
  1401. 'options' => '',
  1402. 'value' => '',
  1403. 'lexicon' => 'gallery:properties',
  1404. 'area' => '',
  1405. 'desc_trans' => 'A JSON object of parameters to pass to phpThumb as properties for the image.',
  1406. 'area_trans' => '',
  1407. ),
  1408. 'sort' =>
  1409. array (
  1410. 'name' => 'sort',
  1411. 'desc' => 'gallery.sort_desc',
  1412. 'type' => 'textfield',
  1413. 'options' => '',
  1414. 'value' => 'rank',
  1415. 'lexicon' => 'gallery:properties',
  1416. 'area' => '',
  1417. 'desc_trans' => 'The field to sort images by.',
  1418. 'area_trans' => '',
  1419. ),
  1420. 'dir' =>
  1421. array (
  1422. 'name' => 'dir',
  1423. 'desc' => 'gallery.dir_desc',
  1424. 'type' => 'textfield',
  1425. 'options' => '',
  1426. 'value' => 'ASC',
  1427. 'lexicon' => 'gallery:properties',
  1428. 'area' => '',
  1429. 'desc_trans' => 'The direction to sort images by.',
  1430. 'area_trans' => '',
  1431. ),
  1432. 'limit' =>
  1433. array (
  1434. 'name' => 'limit',
  1435. 'desc' => 'gallery.limit_desc',
  1436. 'type' => 'textfield',
  1437. 'options' => '',
  1438. 'value' => 0,
  1439. 'lexicon' => 'gallery:properties',
  1440. 'area' => '',
  1441. 'desc_trans' => 'If set to non-zero, will only show X number of items.',
  1442. 'area_trans' => '',
  1443. ),
  1444. 'start' =>
  1445. array (
  1446. 'name' => 'start',
  1447. 'desc' => 'gallery.start_desc',
  1448. 'type' => 'textfield',
  1449. 'options' => '',
  1450. 'value' => 0,
  1451. 'lexicon' => 'gallery:properties',
  1452. 'area' => '',
  1453. 'desc_trans' => 'The index to start grabbing from when limiting the number of items. Similar to an SQL order by start clause.',
  1454. 'area_trans' => '',
  1455. ),
  1456. 'showInactive' =>
  1457. array (
  1458. 'name' => 'showInactive',
  1459. 'desc' => 'gallery.showinactive_desc',
  1460. 'type' => 'combo-boolean',
  1461. 'options' => '',
  1462. 'value' => false,
  1463. 'lexicon' => 'gallery:properties',
  1464. 'area' => '',
  1465. 'desc_trans' => 'If 1, will also display inactive images.',
  1466. 'area_trans' => '',
  1467. ),
  1468. 'checkForRequestAlbumVar' =>
  1469. array (
  1470. 'name' => 'checkForRequestAlbumVar',
  1471. 'desc' => 'gallery.checkforrequestalbumvar_desc',
  1472. 'type' => 'combo-boolean',
  1473. 'options' => '',
  1474. 'value' => true,
  1475. 'lexicon' => 'gallery:properties',
  1476. 'area' => '',
  1477. 'desc_trans' => 'If 1, if a REQUEST var of "album" is found, will use that as the album property for the snippet.',
  1478. 'area_trans' => '',
  1479. ),
  1480. 'albumRequestVar' =>
  1481. array (
  1482. 'name' => 'albumRequestVar',
  1483. 'desc' => 'gallery.albumrequestvar_desc',
  1484. 'type' => 'textfield',
  1485. 'options' => '',
  1486. 'value' => 'galAlbum',
  1487. 'lexicon' => 'gallery:properties',
  1488. 'area' => '',
  1489. 'desc_trans' => 'If checkForRequestAlbumVar is set to true, will look for a REQUEST var with this name to select the album.',
  1490. 'area_trans' => '',
  1491. ),
  1492. 'checkForRequestTagVar' =>
  1493. array (
  1494. 'name' => 'checkForRequestTagVar',
  1495. 'desc' => 'gallery.checkforrequesttagvar_desc',
  1496. 'type' => 'combo-boolean',
  1497. 'options' => '',
  1498. 'value' => true,
  1499. 'lexicon' => 'gallery:properties',
  1500. 'area' => '',
  1501. 'desc_trans' => 'If 1, if a REQUEST var of "tag" is found, will use that as the tag property for the snippet.',
  1502. 'area_trans' => '',
  1503. ),
  1504. 'tagRequestVar' =>
  1505. array (
  1506. 'name' => 'tagRequestVar',
  1507. 'desc' => 'gallery.tagrequestvar_desc',
  1508. 'type' => 'textfield',
  1509. 'options' => '',
  1510. 'value' => 'galTag',
  1511. 'lexicon' => NULL,
  1512. 'area' => '',
  1513. 'desc_trans' => 'If checkForRequestTagVar is set to true, will look for a REQUEST var with this name to select the tag.',
  1514. 'area_trans' => '',
  1515. ),
  1516. 'useCss' =>
  1517. array (
  1518. 'name' => 'useCss',
  1519. 'desc' => 'gallery.usecss_desc',
  1520. 'type' => 'combo-boolean',
  1521. 'options' => '',
  1522. 'value' => true,
  1523. 'lexicon' => 'gallery:properties',
  1524. 'area' => '',
  1525. 'desc_trans' => 'Whether or not to use the pre-provided CSS for the snippet.',
  1526. 'area_trans' => '',
  1527. ),
  1528. ),
  1529. 'moduleguid' => '',
  1530. 'static' => false,
  1531. 'static_file' => '',
  1532. 'content' => '/**
  1533. * Gallery
  1534. *
  1535. * Copyright 2010-2012 by Shaun McCormick <shaun@modx.com>
  1536. *
  1537. * Gallery is free software; you can redistribute it and/or modify it under the
  1538. * terms of the GNU General Public License as published by the Free Software
  1539. * Foundation; either version 2 of the License, or (at your option) any later
  1540. * version.
  1541. *
  1542. * Gallery is distributed in the hope that it will be useful, but WITHOUT ANY
  1543. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  1544. * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  1545. *
  1546. * You should have received a copy of the GNU General Public License along with
  1547. * Gallery; if not, write to the Free Software Foundation, Inc., 59 Temple
  1548. * Place, Suite 330, Boston, MA 02111-1307 USA
  1549. *
  1550. * @package gallery
  1551. */
  1552. /**
  1553. * The main Gallery snippet.
  1554. *
  1555. * @var modX $modx
  1556. * @var Gallery $gallery
  1557. *
  1558. * @package gallery
  1559. */
  1560. $gallery = $modx->getService(\'gallery\',\'Gallery\',$modx->getOption(\'gallery.core_path\',null,$modx->getOption(\'core_path\').\'components/gallery/\').\'model/gallery/\',$scriptProperties);
  1561. if (!($gallery instanceof Gallery)) return \'\';
  1562. $modx->lexicon->load(\'gallery:web\');
  1563. /* check for REQUEST vars if property set */
  1564. $imageGetParam = $modx->getOption(\'imageGetParam\',$scriptProperties,\'galItem\');
  1565. $albumRequestVar = $modx->getOption(\'albumRequestVar\',$scriptProperties,\'galAlbum\');
  1566. $tagRequestVar = $modx->getOption(\'tagRequestVar\',$scriptProperties,\'galTag\');
  1567. if ($modx->getOption(\'checkForRequestAlbumVar\',$scriptProperties,true)) {
  1568. if (!empty($_REQUEST[$albumRequestVar])) $scriptProperties[\'album\'] = $_REQUEST[$albumRequestVar];
  1569. }
  1570. if ($modx->getOption(\'checkForRequestTagVar\',$scriptProperties,true)) {
  1571. if (!empty($_REQUEST[$tagRequestVar])) $scriptProperties[\'tag\'] = $_REQUEST[$tagRequestVar];
  1572. }
  1573. if (empty($scriptProperties[\'album\']) && empty($scriptProperties[\'tag\'])) return \'\';
  1574. $data = $modx->call(\'galItem\',\'getList\',array(&$modx,$scriptProperties));
  1575. $totalVar = $modx->getOption(\'totalVar\', $scriptProperties, \'total\');
  1576. $modx->setPlaceholder($totalVar,$data[\'total\']);
  1577. /* load plugins */
  1578. $plugin = $modx->getOption(\'plugin\',$scriptProperties,\'\');
  1579. if (!empty($plugin)) {
  1580. $pluginPath = $modx->getOption(\'pluginPath\',$scriptProperties,\'\');
  1581. if (empty($pluginPath)) {
  1582. $pluginPath = $gallery->config[\'modelPath\'].\'gallery/plugins/\';
  1583. }
  1584. /** @var GalleryPlugin $plugin */
  1585. if (($className = $modx->loadClass($plugin,$pluginPath,true,true))) {
  1586. $plugin = new $className($gallery,$scriptProperties);
  1587. $plugin->load();
  1588. $scriptProperties = $plugin->adjustSettings($scriptProperties);
  1589. } else {
  1590. return $modx->lexicon(\'gallery.plugin_err_load\',array(\'name\' => $plugin,\'path\' => $pluginPath));
  1591. }
  1592. } else {
  1593. if ($modx->getOption(\'useCss\',$scriptProperties,true)) {
  1594. $modx->regClientCSS($gallery->config[\'cssUrl\'].\'web.css\');
  1595. }
  1596. }
  1597. /* iterate */
  1598. $imageProperties = $modx->getOption(\'imageProperties\',$scriptProperties,\'\');
  1599. $imageProperties = !empty($imageProperties) ? $modx->fromJSON($imageProperties) : array();
  1600. $imageProperties = array_merge(array(
  1601. \'w\' => (int)$modx->getOption(\'imageWidth\',$scriptProperties,500),
  1602. \'h\' => (int)$modx->getOption(\'imageHeight\',$scriptProperties,500),
  1603. \'zc\' => (boolean)$modx->getOption(\'imageZoomCrop\',$scriptProperties,0),
  1604. \'far\' => (string)$modx->getOption(\'imageFar\',$scriptProperties,false),
  1605. \'q\' => (int)$modx->getOption(\'imageQuality\',$scriptProperties,90),
  1606. ),$imageProperties);
  1607. $thumbProperties = $modx->getOption(\'thumbProperties\',$scriptProperties,\'\');
  1608. $thumbProperties = !empty($thumbProperties) ? $modx->fromJSON($thumbProperties) : array();
  1609. $thumbProperties = array_merge(array(
  1610. \'w\' => (int)$modx->getOption(\'thumbWidth\',$scriptProperties,100),
  1611. \'h\' => (int)$modx->getOption(\'thumbHeight\',$scriptProperties,100),
  1612. \'zc\' => (boolean)$modx->getOption(\'thumbZoomCrop\',$scriptProperties,1),
  1613. \'far\' => (string)$modx->getOption(\'thumbFar\',$scriptProperties,\'C\'),
  1614. \'q\' => (int)$modx->getOption(\'thumbQuality\',$scriptProperties,90),
  1615. ),$thumbProperties);
  1616. $idx = 0;
  1617. $output = array();
  1618. $filesUrl = $modx->call(\'galAlbum\',\'getFilesUrl\',array(&$modx));
  1619. $filesPath = $modx->call(\'galAlbum\',\'getFilesPath\',array(&$modx));
  1620. $itemCls = $modx->getOption(\'itemCls\',$scriptProperties,\'gal-item\');
  1621. $imageAttributes = $modx->getOption(\'imageAttributes\',$scriptProperties,\'\');
  1622. $linkAttributes = $modx->getOption(\'linkAttributes\',$scriptProperties,\'\');
  1623. $linkToImage = $modx->getOption(\'linkToImage\',$scriptProperties,false);
  1624. $activeCls = $modx->getOption(\'activeCls\',$scriptProperties,\'gal-item-active\');
  1625. $highlightItem = $modx->getOption($imageGetParam,$_REQUEST,false);
  1626. $defaultThumbTpl = $modx->getOption(\'thumbTpl\',$scriptProperties,\'galItemThumb\');
  1627. /** @var galItem $item */
  1628. if (!is_array($data)) return \'\';
  1629. // prep for &thumbTpl_N
  1630. $keys = array_keys($scriptProperties);
  1631. $nthTpls = array();
  1632. foreach($keys as $key) {
  1633. $keyBits = $gallery->explodeAndClean($key, \'_\');
  1634. if (isset($keyBits[0]) && $keyBits[0] === \'thumbTpl\') {
  1635. if ($i = (int) $keyBits[1]) $nthTpls[$i] = $scriptProperties[$key];
  1636. }
  1637. }
  1638. ksort($nthTpls);
  1639. foreach ($data[\'items\'] as $item) {
  1640. $itemArray = $item->toArray();
  1641. $itemArray[\'idx\'] = $idx;
  1642. $itemArray[\'cls\'] = $itemCls;
  1643. if ($itemArray[\'id\'] == $highlightItem) {
  1644. $itemArray[\'cls\'] .= \' \'.$activeCls;
  1645. }
  1646. $itemArray[\'filename\'] = basename($item->get(\'filename\'));
  1647. $itemArray[\'image_absolute\'] = $item->get(\'base_url\').$filesUrl.$item->get(\'filename\');
  1648. $itemArray[\'fileurl\'] = $itemArray[\'image_absolute\'];
  1649. $itemArray[\'filepath\'] = $filesPath.$item->get(\'filename\');
  1650. $itemArray[\'filesize\'] = $item->get(\'filesize\');
  1651. $itemArray[\'thumbnail\'] = $item->get(\'thumbnail\',$thumbProperties);
  1652. $itemArray[\'image\'] = $item->get(\'thumbnail\',$imageProperties);
  1653. $itemArray[\'image_attributes\'] = $imageAttributes;
  1654. $itemArray[\'link_attributes\'] = $linkAttributes;
  1655. if (!empty($scriptProperties[\'album\'])) $itemArray[\'album\'] = $scriptProperties[\'album\'];
  1656. if (!empty($scriptProperties[\'tag\'])) $itemArray[\'tag\'] = $scriptProperties[\'tag\'];
  1657. $itemArray[\'linkToImage\'] = $linkToImage;
  1658. $itemArray[\'url\'] = $item->get(\'url\');
  1659. $itemArray[\'imageGetParam\'] = $imageGetParam;
  1660. $itemArray[\'albumRequestVar\'] = $albumRequestVar;
  1661. $itemArray[\'tagRequestVar\'] = $tagRequestVar;
  1662. $itemArray[\'tag\'] = \'\';
  1663. if ($plugin) {
  1664. $plugin->renderItem($itemArray);
  1665. }
  1666. $thumbTpl = $defaultThumbTpl;
  1667. if (isset($nthTpls[$idx])) {
  1668. $thumbTpl = $nthTpls[$idx];
  1669. } else {
  1670. foreach ($nthTpls as $int => $tpl) {
  1671. if ( ($idx % $int) === 0 ) $thumbTpl = $tpl;
  1672. }
  1673. }
  1674. $output[] = $gallery->getChunk($thumbTpl,$itemArray);
  1675. $idx++;
  1676. }
  1677. $output = implode("\\n",$output);
  1678. /* if set, place in a container tpl */
  1679. $containerTpl = $modx->getOption(\'containerTpl\',$scriptProperties,false);
  1680. if (!empty($containerTpl)) {
  1681. $ct = $gallery->getChunk($containerTpl,array(
  1682. \'thumbnails\' => $output,
  1683. \'album_name\' => $data[\'album\'][\'name\'],
  1684. \'album_description\' => $data[\'album\'][\'description\'],
  1685. \'album_year\' => isset($data[\'album\'][\'year\']) ? $data[\'album\'][\'year\'] : \'\',
  1686. \'albumRequestVar\' => $albumRequestVar,
  1687. \'albumId\' => $data[\'album\'][\'id\'],
  1688. ));
  1689. if (!empty($ct)) $output = $ct;
  1690. }
  1691. /* set to placeholders or output directly */
  1692. $toPlaceholder = $modx->getOption(\'toPlaceholder\',$scriptProperties,false);
  1693. if (!empty($toPlaceholder)) {
  1694. $modx->toPlaceholders(array(
  1695. $toPlaceholder => $output,
  1696. $toPlaceholder.\'.id\' => $data[\'album\'][\'id\'],
  1697. $toPlaceholder.\'.name\' => $data[\'album\'][\'name\'],
  1698. $toPlaceholder.\'.year\' => isset($data[\'album\'][\'year\']) ? $data[\'album\'][\'year\'] : \'\',
  1699. $toPlaceholder.\'.description\' => $data[\'album\'][\'description\'],
  1700. $toPlaceholder.\'.total\' => $data[\'total\'],
  1701. $toPlaceholder.\'.next\' => $data[\'album\'][\'id\'] + 1,
  1702. $toPlaceholder.\'.prev\' => $data[\'album\'][\'id\'] - 1,
  1703. ));
  1704. } else {
  1705. $placeholderPrefix = $modx->getOption(\'placeholderPrefix\',$scriptProperties,\'gallery.\');
  1706. $modx->toPlaceholders(array(
  1707. $placeholderPrefix.\'id\' => $data[\'album\'][\'id\'],
  1708. $placeholderPrefix.\'name\' => $data[\'album\'][\'name\'],
  1709. $placeholderPrefix.\'year\' => isset($data[\'album\'][\'year\']) ? $data[\'album\'][\'year\'] : \'\',
  1710. $placeholderPrefix.\'description\' => $data[\'album\'][\'description\'],
  1711. $placeholderPrefix.\'total\' => $data[\'total\'],
  1712. $placeholderPrefix.\'next\' => $data[\'album\'][\'id\'] + 1,
  1713. $placeholderPrefix.\'prev\' => $data[\'album\'][\'id\'] - 1,
  1714. ));
  1715. return $output;
  1716. }
  1717. return \'\';',
  1718. ),
  1719. 'policies' =>
  1720. array (
  1721. 'web' =>
  1722. array (
  1723. ),
  1724. ),
  1725. 'source' =>
  1726. array (
  1727. ),
  1728. ),
  1729. 'getResources' =>
  1730. array (
  1731. 'fields' =>
  1732. array (
  1733. 'id' => 26,
  1734. 'source' => 0,
  1735. 'property_preprocess' => false,
  1736. 'name' => 'getResources',
  1737. 'description' => '<strong>1.6.1-pl</strong> A general purpose Resource listing and summarization snippet for MODX Revolution',
  1738. 'editor_type' => 0,
  1739. 'category' => 0,
  1740. 'cache_type' => 0,
  1741. 'snippet' => '/**
  1742. * getResources
  1743. *
  1744. * A general purpose Resource listing and summarization snippet for MODX 2.x.
  1745. *
  1746. * @author Jason Coward
  1747. * @copyright Copyright 2010-2013, Jason Coward
  1748. *
  1749. * TEMPLATES
  1750. *
  1751. * tpl - Name of a chunk serving as a resource template
  1752. * [NOTE: if not provided, properties are dumped to output for each resource]
  1753. *
  1754. * tplOdd - (Opt) Name of a chunk serving as resource template for resources with an odd idx value
  1755. * (see idx property)
  1756. * tplFirst - (Opt) Name of a chunk serving as resource template for the first resource (see first
  1757. * property)
  1758. * tplLast - (Opt) Name of a chunk serving as resource template for the last resource (see last
  1759. * property)
  1760. * tpl_{n} - (Opt) Name of a chunk serving as resource template for the nth resource
  1761. *
  1762. * tplCondition - (Opt) Defines a field of the resource to evaluate against keys defined in the
  1763. * conditionalTpls property. Must be a resource field; does not work with Template Variables.
  1764. * conditionalTpls - (Opt) A JSON object defining a map of field values and the associated tpl to
  1765. * use when the field defined by tplCondition matches the value. [NOTE: tplOdd, tplFirst, tplLast,
  1766. * and tpl_{n} will take precedence over any defined conditionalTpls]
  1767. *
  1768. * tplWrapper - (Opt) Name of a chunk serving as a wrapper template for the output
  1769. * [NOTE: Does not work with toSeparatePlaceholders]
  1770. *
  1771. * SELECTION
  1772. *
  1773. * parents - Comma-delimited list of ids serving as parents
  1774. *
  1775. * context - (Opt) Comma-delimited list of context keys to limit results by; if empty, contexts for all specified
  1776. * parents will be used (all contexts if 0 is specified) [default=]
  1777. *
  1778. * depth - (Opt) Integer value indicating depth to search for resources from each parent [default=10]
  1779. *
  1780. * tvFilters - (Opt) Delimited-list of TemplateVar values to filter resources by. Supports two
  1781. * delimiters and two value search formats. The first delimiter || represents a logical OR and the
  1782. * primary grouping mechanism. Within each group you can provide a comma-delimited list of values.
  1783. * These values can be either tied to a specific TemplateVar by name, e.g. myTV==value, or just the
  1784. * value, indicating you are searching for the value in any TemplateVar tied to the Resource. An
  1785. * example would be &tvFilters=`filter2==one,filter1==bar%||filter1==foo`
  1786. * [NOTE: filtering by values uses a LIKE query and % is considered a wildcard.]
  1787. * [NOTE: this only looks at the raw value set for specific Resource, i. e. there must be a value
  1788. * specifically set for the Resource and it is not evaluated.]
  1789. *
  1790. * tvFiltersAndDelimiter - (Opt) Custom delimiter for logical AND, default \',\', in case you want to
  1791. * match a literal comma in the tvFilters. E.g. &tvFiltersAndDelimiter=`&&`
  1792. * &tvFilters=`filter1==foo,bar&&filter2==baz` [default=,]
  1793. *
  1794. * tvFiltersOrDelimiter - (Opt) Custom delimiter for logical OR, default \'||\', in case you want to
  1795. * match a literal \'||\' in the tvFilters. E.g. &tvFiltersOrDelimiter=`|OR|`
  1796. * &tvFilters=`filter1==foo||bar|OR|filter2==baz` [default=||]
  1797. *
  1798. * where - (Opt) A JSON expression of criteria to build any additional where clauses from. An example would be
  1799. * &where=`{{"alias:LIKE":"foo%", "OR:alias:LIKE":"%bar"},{"OR:pagetitle:=":"foobar", "AND:description:=":"raboof"}}`
  1800. *
  1801. * sortby - (Opt) Field to sort by or a JSON array, e.g. {"publishedon":"ASC","createdon":"DESC"} [default=publishedon]
  1802. * sortbyTV - (opt) A Template Variable name to sort by (if supplied, this precedes the sortby value) [default=]
  1803. * sortbyTVType - (Opt) A data type to CAST a TV Value to in order to sort on it properly [default=string]
  1804. * sortbyAlias - (Opt) Query alias for sortby field [default=]
  1805. * sortbyEscaped - (Opt) Escapes the field name(s) specified in sortby [default=0]
  1806. * sortdir - (Opt) Order which to sort by [default=DESC]
  1807. * sortdirTV - (Opt) Order which to sort by a TV [default=DESC]
  1808. * limit - (Opt) Limits the number of resources returned [default=5]
  1809. * offset - (Opt) An offset of resources returned by the criteria to skip [default=0]
  1810. * dbCacheFlag - (Opt) Controls caching of db queries; 0|false = do not cache result set; 1 = cache result set
  1811. * according to cache settings, any other integer value = number of seconds to cache result set [default=0]
  1812. *
  1813. * OPTIONS
  1814. *
  1815. * includeContent - (Opt) Indicates if the content of each resource should be returned in the
  1816. * results [default=0]
  1817. * includeTVs - (Opt) Indicates if TemplateVar values should be included in the properties available
  1818. * to each resource template [default=0]
  1819. * includeTVList - (Opt) Limits the TemplateVars that are included if includeTVs is true to those specified
  1820. * by name in a comma-delimited list [default=]
  1821. * prepareTVs - (Opt) Prepares media-source dependent TemplateVar values [default=1]
  1822. * prepareTVList - (Opt) Limits the TVs that are prepared to those specified by name in a comma-delimited
  1823. * list [default=]
  1824. * processTVs - (Opt) Indicates if TemplateVar values should be rendered as they would on the
  1825. * resource being summarized [default=0]
  1826. * processTVList - (opt) Limits the TemplateVars that are processed if included to those specified
  1827. * by name in a comma-delimited list [default=]
  1828. * tvPrefix - (Opt) The prefix for TemplateVar properties [default=tv.]
  1829. * idx - (Opt) You can define the starting idx of the resources, which is an property that is
  1830. * incremented as each resource is rendered [default=1]
  1831. * first - (Opt) Define the idx which represents the first resource (see tplFirst) [default=1]
  1832. * last - (Opt) Define the idx which represents the last resource (see tplLast) [default=# of
  1833. * resources being summarized + first - 1]
  1834. * outputSeparator - (Opt) An optional string to separate each tpl instance [default="\\n"]
  1835. * wrapIfEmpty - (Opt) Indicates if the tplWrapper should be applied if the output is empty [default=0]
  1836. *
  1837. */
  1838. $output = array();
  1839. $outputSeparator = isset($outputSeparator) ? $outputSeparator : "\\n";
  1840. /* set default properties */
  1841. $tpl = !empty($tpl) ? $tpl : \'\';
  1842. $includeContent = !empty($includeContent) ? true : false;
  1843. $includeTVs = !empty($includeTVs) ? true : false;
  1844. $includeTVList = !empty($includeTVList) ? explode(\',\', $includeTVList) : array();
  1845. $processTVs = !empty($processTVs) ? true : false;
  1846. $processTVList = !empty($processTVList) ? explode(\',\', $processTVList) : array();
  1847. $prepareTVs = !empty($prepareTVs) ? true : false;
  1848. $prepareTVList = !empty($prepareTVList) ? explode(\',\', $prepareTVList) : array();
  1849. $tvPrefix = isset($tvPrefix) ? $tvPrefix : \'tv.\';
  1850. $parents = (!empty($parents) || $parents === \'0\') ? explode(\',\', $parents) : array($modx->resource->get(\'id\'));
  1851. array_walk($parents, \'trim\');
  1852. $parents = array_unique($parents);
  1853. $depth = isset($depth) ? (integer) $depth : 10;
  1854. $tvFiltersOrDelimiter = isset($tvFiltersOrDelimiter) ? $tvFiltersOrDelimiter : \'||\';
  1855. $tvFiltersAndDelimiter = isset($tvFiltersAndDelimiter) ? $tvFiltersAndDelimiter : \',\';
  1856. $tvFilters = !empty($tvFilters) ? explode($tvFiltersOrDelimiter, $tvFilters) : array();
  1857. $where = !empty($where) ? $modx->fromJSON($where) : array();
  1858. $showUnpublished = !empty($showUnpublished) ? true : false;
  1859. $showDeleted = !empty($showDeleted) ? true : false;
  1860. $sortby = isset($sortby) ? $sortby : \'publishedon\';
  1861. $sortbyTV = isset($sortbyTV) ? $sortbyTV : \'\';
  1862. $sortbyAlias = isset($sortbyAlias) ? $sortbyAlias : \'modResource\';
  1863. $sortbyEscaped = !empty($sortbyEscaped) ? true : false;
  1864. $sortdir = isset($sortdir) ? $sortdir : \'DESC\';
  1865. $sortdirTV = isset($sortdirTV) ? $sortdirTV : \'DESC\';
  1866. $limit = isset($limit) ? (integer) $limit : 5;
  1867. $offset = isset($offset) ? (integer) $offset : 0;
  1868. $totalVar = !empty($totalVar) ? $totalVar : \'total\';
  1869. $dbCacheFlag = !isset($dbCacheFlag) ? false : $dbCacheFlag;
  1870. if (is_string($dbCacheFlag) || is_numeric($dbCacheFlag)) {
  1871. if ($dbCacheFlag == \'0\') {
  1872. $dbCacheFlag = false;
  1873. } elseif ($dbCacheFlag == \'1\') {
  1874. $dbCacheFlag = true;
  1875. } else {
  1876. $dbCacheFlag = (integer) $dbCacheFlag;
  1877. }
  1878. }
  1879. /* multiple context support */
  1880. $contextArray = array();
  1881. $contextSpecified = false;
  1882. if (!empty($context)) {
  1883. $contextArray = explode(\',\',$context);
  1884. array_walk($contextArray, \'trim\');
  1885. $contexts = array();
  1886. foreach ($contextArray as $ctx) {
  1887. $contexts[] = $modx->quote($ctx);
  1888. }
  1889. $context = implode(\',\',$contexts);
  1890. $contextSpecified = true;
  1891. unset($contexts,$ctx);
  1892. } else {
  1893. $context = $modx->quote($modx->context->get(\'key\'));
  1894. }
  1895. $pcMap = array();
  1896. $pcQuery = $modx->newQuery(\'modResource\', array(\'id:IN\' => $parents), $dbCacheFlag);
  1897. $pcQuery->select(array(\'id\', \'context_key\'));
  1898. if ($pcQuery->prepare() && $pcQuery->stmt->execute()) {
  1899. foreach ($pcQuery->stmt->fetchAll(PDO::FETCH_ASSOC) as $pcRow) {
  1900. $pcMap[(integer) $pcRow[\'id\']] = $pcRow[\'context_key\'];
  1901. }
  1902. }
  1903. $children = array();
  1904. $parentArray = array();
  1905. foreach ($parents as $parent) {
  1906. $parent = (integer) $parent;
  1907. if ($parent === 0) {
  1908. $pchildren = array();
  1909. if ($contextSpecified) {
  1910. foreach ($contextArray as $pCtx) {
  1911. if (!in_array($pCtx, $contextArray)) {
  1912. continue;
  1913. }
  1914. $options = $pCtx !== $modx->context->get(\'key\') ? array(\'context\' => $pCtx) : array();
  1915. $pcchildren = $modx->getChildIds($parent, $depth, $options);
  1916. if (!empty($pcchildren)) $pchildren = array_merge($pchildren, $pcchildren);
  1917. }
  1918. } else {
  1919. $cQuery = $modx->newQuery(\'modContext\', array(\'key:!=\' => \'mgr\'));
  1920. $cQuery->select(array(\'key\'));
  1921. if ($cQuery->prepare() && $cQuery->stmt->execute()) {
  1922. foreach ($cQuery->stmt->fetchAll(PDO::FETCH_COLUMN) as $pCtx) {
  1923. $options = $pCtx !== $modx->context->get(\'key\') ? array(\'context\' => $pCtx) : array();
  1924. $pcchildren = $modx->getChildIds($parent, $depth, $options);
  1925. if (!empty($pcchildren)) $pchildren = array_merge($pchildren, $pcchildren);
  1926. }
  1927. }
  1928. }
  1929. $parentArray[] = $parent;
  1930. } else {
  1931. $pContext = array_key_exists($parent, $pcMap) ? $pcMap[$parent] : false;
  1932. if ($debug) $modx->log(modX::LOG_LEVEL_ERROR, "context for {$parent} is {$pContext}");
  1933. if ($pContext && $contextSpecified && !in_array($pContext, $contextArray, true)) {
  1934. $parent = next($parents);
  1935. continue;
  1936. }
  1937. $parentArray[] = $parent;
  1938. $options = !empty($pContext) && $pContext !== $modx->context->get(\'key\') ? array(\'context\' => $pContext) : array();
  1939. $pchildren = $modx->getChildIds($parent, $depth, $options);
  1940. }
  1941. if (!empty($pchildren)) $children = array_merge($children, $pchildren);
  1942. $parent = next($parents);
  1943. }
  1944. $parents = array_merge($parentArray, $children);
  1945. /* build query */
  1946. $criteria = array("modResource.parent IN (" . implode(\',\', $parents) . ")");
  1947. if ($contextSpecified) {
  1948. $contextResourceTbl = $modx->getTableName(\'modContextResource\');
  1949. $criteria[] = "(modResource.context_key IN ({$context}) OR EXISTS(SELECT 1 FROM {$contextResourceTbl} ctx WHERE ctx.resource = modResource.id AND ctx.context_key IN ({$context})))";
  1950. }
  1951. if (empty($showDeleted)) {
  1952. $criteria[\'deleted\'] = \'0\';
  1953. }
  1954. if (empty($showUnpublished)) {
  1955. $criteria[\'published\'] = \'1\';
  1956. }
  1957. if (empty($showHidden)) {
  1958. $criteria[\'hidemenu\'] = \'0\';
  1959. }
  1960. if (!empty($hideContainers)) {
  1961. $criteria[\'isfolder\'] = \'0\';
  1962. }
  1963. $criteria = $modx->newQuery(\'modResource\', $criteria);
  1964. if (!empty($tvFilters)) {
  1965. $tmplVarTbl = $modx->getTableName(\'modTemplateVar\');
  1966. $tmplVarResourceTbl = $modx->getTableName(\'modTemplateVarResource\');
  1967. $conditions = array();
  1968. $operators = array(
  1969. \'<=>\' => \'<=>\',
  1970. \'===\' => \'=\',
  1971. \'!==\' => \'!=\',
  1972. \'<>\' => \'<>\',
  1973. \'==\' => \'LIKE\',
  1974. \'!=\' => \'NOT LIKE\',
  1975. \'<<\' => \'<\',
  1976. \'<=\' => \'<=\',
  1977. \'=<\' => \'=<\',
  1978. \'>>\' => \'>\',
  1979. \'>=\' => \'>=\',
  1980. \'=>\' => \'=>\'
  1981. );
  1982. foreach ($tvFilters as $fGroup => $tvFilter) {
  1983. $filterGroup = array();
  1984. $filters = explode($tvFiltersAndDelimiter, $tvFilter);
  1985. $multiple = count($filters) > 0;
  1986. foreach ($filters as $filter) {
  1987. $operator = \'==\';
  1988. $sqlOperator = \'LIKE\';
  1989. foreach ($operators as $op => $opSymbol) {
  1990. if (strpos($filter, $op, 1) !== false) {
  1991. $operator = $op;
  1992. $sqlOperator = $opSymbol;
  1993. break;
  1994. }
  1995. }
  1996. $tvValueField = \'tvr.value\';
  1997. $tvDefaultField = \'tv.default_text\';
  1998. $f = explode($operator, $filter);
  1999. if (count($f) >= 2) {
  2000. if (count($f) > 2) {
  2001. $k = array_shift($f);
  2002. $b = join($operator, $f);
  2003. $f = array($k, $b);
  2004. }
  2005. $tvName = $modx->quote($f[0]);
  2006. if (is_numeric($f[1]) && !in_array($sqlOperator, array(\'LIKE\', \'NOT LIKE\'))) {
  2007. $tvValue = $f[1];
  2008. if ($f[1] == (integer)$f[1]) {
  2009. $tvValueField = "CAST({$tvValueField} AS SIGNED INTEGER)";
  2010. $tvDefaultField = "CAST({$tvDefaultField} AS SIGNED INTEGER)";
  2011. } else {
  2012. $tvValueField = "CAST({$tvValueField} AS DECIMAL)";
  2013. $tvDefaultField = "CAST({$tvDefaultField} AS DECIMAL)";
  2014. }
  2015. } else {
  2016. $tvValue = $modx->quote($f[1]);
  2017. }
  2018. if ($multiple) {
  2019. $filterGroup[] =
  2020. "(EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.name = {$tvName} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id) " .
  2021. "OR EXISTS (SELECT 1 FROM {$tmplVarTbl} tv WHERE tv.name = {$tvName} AND {$tvDefaultField} {$sqlOperator} {$tvValue} AND tv.id NOT IN (SELECT tmplvarid FROM {$tmplVarResourceTbl} WHERE contentid = modResource.id)) " .
  2022. ")";
  2023. } else {
  2024. $filterGroup =
  2025. "(EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.name = {$tvName} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id) " .
  2026. "OR EXISTS (SELECT 1 FROM {$tmplVarTbl} tv WHERE tv.name = {$tvName} AND {$tvDefaultField} {$sqlOperator} {$tvValue} AND tv.id NOT IN (SELECT tmplvarid FROM {$tmplVarResourceTbl} WHERE contentid = modResource.id)) " .
  2027. ")";
  2028. }
  2029. } elseif (count($f) == 1) {
  2030. $tvValue = $modx->quote($f[0]);
  2031. if ($multiple) {
  2032. $filterGroup[] = "EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id)";
  2033. } else {
  2034. $filterGroup = "EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id)";
  2035. }
  2036. }
  2037. }
  2038. $conditions[] = $filterGroup;
  2039. }
  2040. if (!empty($conditions)) {
  2041. $firstGroup = true;
  2042. foreach ($conditions as $cGroup => $c) {
  2043. if (is_array($c)) {
  2044. $first = true;
  2045. foreach ($c as $cond) {
  2046. if ($first && !$firstGroup) {
  2047. $criteria->condition($criteria->query[\'where\'][0][1], $cond, xPDOQuery::SQL_OR, null, $cGroup);
  2048. } else {
  2049. $criteria->condition($criteria->query[\'where\'][0][1], $cond, xPDOQuery::SQL_AND, null, $cGroup);
  2050. }
  2051. $first = false;
  2052. }
  2053. } else {
  2054. $criteria->condition($criteria->query[\'where\'][0][1], $c, $firstGroup ? xPDOQuery::SQL_AND : xPDOQuery::SQL_OR, null, $cGroup);
  2055. }
  2056. $firstGroup = false;
  2057. }
  2058. }
  2059. }
  2060. /* include/exclude resources, via &resources=`123,-456` prop */
  2061. if (!empty($resources)) {
  2062. $resourceConditions = array();
  2063. $resources = explode(\',\',$resources);
  2064. $include = array();
  2065. $exclude = array();
  2066. foreach ($resources as $resource) {
  2067. $resource = (int)$resource;
  2068. if ($resource == 0) continue;
  2069. if ($resource < 0) {
  2070. $exclude[] = abs($resource);
  2071. } else {
  2072. $include[] = $resource;
  2073. }
  2074. }
  2075. if (!empty($include)) {
  2076. $criteria->where(array(\'OR:modResource.id:IN\' => $include), xPDOQuery::SQL_OR);
  2077. }
  2078. if (!empty($exclude)) {
  2079. $criteria->where(array(\'modResource.id:NOT IN\' => $exclude), xPDOQuery::SQL_AND, null, 1);
  2080. }
  2081. }
  2082. if (!empty($where)) {
  2083. $criteria->where($where);
  2084. }
  2085. $total = $modx->getCount(\'modResource\', $criteria);
  2086. $modx->setPlaceholder($totalVar, $total);
  2087. $fields = array_keys($modx->getFields(\'modResource\'));
  2088. if (empty($includeContent)) {
  2089. $fields = array_diff($fields, array(\'content\'));
  2090. }
  2091. $columns = $includeContent ? $modx->getSelectColumns(\'modResource\', \'modResource\') : $modx->getSelectColumns(\'modResource\', \'modResource\', \'\', array(\'content\'), true);
  2092. $criteria->select($columns);
  2093. if (!empty($sortbyTV)) {
  2094. $criteria->leftJoin(\'modTemplateVar\', \'tvDefault\', array(
  2095. "tvDefault.name" => $sortbyTV
  2096. ));
  2097. $criteria->leftJoin(\'modTemplateVarResource\', \'tvSort\', array(
  2098. "tvSort.contentid = modResource.id",
  2099. "tvSort.tmplvarid = tvDefault.id"
  2100. ));
  2101. if (empty($sortbyTVType)) $sortbyTVType = \'string\';
  2102. if ($modx->getOption(\'dbtype\') === \'mysql\') {
  2103. switch ($sortbyTVType) {
  2104. case \'integer\':
  2105. $criteria->select("CAST(IFNULL(tvSort.value, tvDefault.default_text) AS SIGNED INTEGER) AS sortTV");
  2106. break;
  2107. case \'decimal\':
  2108. $criteria->select("CAST(IFNULL(tvSort.value, tvDefault.default_text) AS DECIMAL) AS sortTV");
  2109. break;
  2110. case \'datetime\':
  2111. $criteria->select("CAST(IFNULL(tvSort.value, tvDefault.default_text) AS DATETIME) AS sortTV");
  2112. break;
  2113. case \'string\':
  2114. default:
  2115. $criteria->select("IFNULL(tvSort.value, tvDefault.default_text) AS sortTV");
  2116. break;
  2117. }
  2118. } elseif ($modx->getOption(\'dbtype\') === \'sqlsrv\') {
  2119. switch ($sortbyTVType) {
  2120. case \'integer\':
  2121. $criteria->select("CAST(ISNULL(tvSort.value, tvDefault.default_text) AS BIGINT) AS sortTV");
  2122. break;
  2123. case \'decimal\':
  2124. $criteria->select("CAST(ISNULL(tvSort.value, tvDefault.default_text) AS DECIMAL) AS sortTV");
  2125. break;
  2126. case \'datetime\':
  2127. $criteria->select("CAST(ISNULL(tvSort.value, tvDefault.default_text) AS DATETIME) AS sortTV");
  2128. break;
  2129. case \'string\':
  2130. default:
  2131. $criteria->select("ISNULL(tvSort.value, tvDefault.default_text) AS sortTV");
  2132. break;
  2133. }
  2134. }
  2135. $criteria->sortby("sortTV", $sortdirTV);
  2136. }
  2137. if (!empty($sortby)) {
  2138. if (strpos($sortby, \'{\') === 0) {
  2139. $sorts = $modx->fromJSON($sortby);
  2140. } else {
  2141. $sorts = array($sortby => $sortdir);
  2142. }
  2143. if (is_array($sorts)) {
  2144. while (list($sort, $dir) = each($sorts)) {
  2145. if ($sortbyEscaped) $sort = $modx->escape($sort);
  2146. if (!empty($sortbyAlias)) $sort = $modx->escape($sortbyAlias) . ".{$sort}";
  2147. $criteria->sortby($sort, $dir);
  2148. }
  2149. }
  2150. }
  2151. if (!empty($limit)) $criteria->limit($limit, $offset);
  2152. if (!empty($debug)) {
  2153. $criteria->prepare();
  2154. $modx->log(modX::LOG_LEVEL_ERROR, $criteria->toSQL());
  2155. }
  2156. $collection = $modx->getCollection(\'modResource\', $criteria, $dbCacheFlag);
  2157. $idx = !empty($idx) || $idx === \'0\' ? (integer) $idx : 1;
  2158. $first = empty($first) && $first !== \'0\' ? 1 : (integer) $first;
  2159. $last = empty($last) ? (count($collection) + $idx - 1) : (integer) $last;
  2160. /* include parseTpl */
  2161. include_once $modx->getOption(\'getresources.core_path\',null,$modx->getOption(\'core_path\').\'components/getresources/\').\'include.parsetpl.php\';
  2162. $templateVars = array();
  2163. if (!empty($includeTVs) && !empty($includeTVList)) {
  2164. $templateVars = $modx->getCollection(\'modTemplateVar\', array(\'name:IN\' => $includeTVList));
  2165. }
  2166. /** @var modResource $resource */
  2167. foreach ($collection as $resourceId => $resource) {
  2168. $tvs = array();
  2169. if (!empty($includeTVs)) {
  2170. if (empty($includeTVList)) {
  2171. $templateVars = $resource->getMany(\'TemplateVars\');
  2172. }
  2173. /** @var modTemplateVar $templateVar */
  2174. foreach ($templateVars as $tvId => $templateVar) {
  2175. if (!empty($includeTVList) && !in_array($templateVar->get(\'name\'), $includeTVList)) continue;
  2176. if ($processTVs && (empty($processTVList) || in_array($templateVar->get(\'name\'), $processTVList))) {
  2177. $tvs[$tvPrefix . $templateVar->get(\'name\')] = $templateVar->renderOutput($resource->get(\'id\'));
  2178. } else {
  2179. $value = $templateVar->getValue($resource->get(\'id\'));
  2180. if ($prepareTVs && method_exists($templateVar, \'prepareOutput\') && (empty($prepareTVList) || in_array($templateVar->get(\'name\'), $prepareTVList))) {
  2181. $value = $templateVar->prepareOutput($value);
  2182. }
  2183. $tvs[$tvPrefix . $templateVar->get(\'name\')] = $value;
  2184. }
  2185. }
  2186. }
  2187. $odd = ($idx & 1);
  2188. $properties = array_merge(
  2189. $scriptProperties
  2190. ,array(
  2191. \'idx\' => $idx
  2192. ,\'first\' => $first
  2193. ,\'last\' => $last
  2194. ,\'odd\' => $odd
  2195. )
  2196. ,$includeContent ? $resource->toArray() : $resource->get($fields)
  2197. ,$tvs
  2198. );
  2199. $resourceTpl = false;
  2200. if ($idx == $first && !empty($tplFirst)) {
  2201. $resourceTpl = parseTpl($tplFirst, $properties);
  2202. }
  2203. if ($idx == $last && empty($resourceTpl) && !empty($tplLast)) {
  2204. $resourceTpl = parseTpl($tplLast, $properties);
  2205. }
  2206. $tplidx = \'tpl_\' . $idx;
  2207. if (empty($resourceTpl) && !empty($$tplidx)) {
  2208. $resourceTpl = parseTpl($$tplidx, $properties);
  2209. }
  2210. if ($idx > 1 && empty($resourceTpl)) {
  2211. $divisors = getDivisors($idx);
  2212. if (!empty($divisors)) {
  2213. foreach ($divisors as $divisor) {
  2214. $tplnth = \'tpl_n\' . $divisor;
  2215. if (!empty($$tplnth)) {
  2216. $resourceTpl = parseTpl($$tplnth, $properties);
  2217. if (!empty($resourceTpl)) {
  2218. break;
  2219. }
  2220. }
  2221. }
  2222. }
  2223. }
  2224. if ($odd && empty($resourceTpl) && !empty($tplOdd)) {
  2225. $resourceTpl = parseTpl($tplOdd, $properties);
  2226. }
  2227. if (!empty($tplCondition) && !empty($conditionalTpls) && empty($resourceTpl)) {
  2228. $conTpls = $modx->fromJSON($conditionalTpls);
  2229. $subject = $properties[$tplCondition];
  2230. $tplOperator = !empty($tplOperator) ? $tplOperator : \'=\';
  2231. $tplOperator = strtolower($tplOperator);
  2232. $tplCon = \'\';
  2233. foreach ($conTpls as $operand => $conditionalTpl) {
  2234. switch ($tplOperator) {
  2235. case \'!=\':
  2236. case \'neq\':
  2237. case \'not\':
  2238. case \'isnot\':
  2239. case \'isnt\':
  2240. case \'unequal\':
  2241. case \'notequal\':
  2242. $tplCon = (($subject != $operand) ? $conditionalTpl : $tplCon);
  2243. break;
  2244. case \'<\':
  2245. case \'lt\':
  2246. case \'less\':
  2247. case \'lessthan\':
  2248. $tplCon = (($subject < $operand) ? $conditionalTpl : $tplCon);
  2249. break;
  2250. case \'>\':
  2251. case \'gt\':
  2252. case \'greater\':
  2253. case \'greaterthan\':
  2254. $tplCon = (($subject > $operand) ? $conditionalTpl : $tplCon);
  2255. break;
  2256. case \'<=\':
  2257. case \'lte\':
  2258. case \'lessthanequals\':
  2259. case \'lessthanorequalto\':
  2260. $tplCon = (($subject <= $operand) ? $conditionalTpl : $tplCon);
  2261. break;
  2262. case \'>=\':
  2263. case \'gte\':
  2264. case \'greaterthanequals\':
  2265. case \'greaterthanequalto\':
  2266. $tplCon = (($subject >= $operand) ? $conditionalTpl : $tplCon);
  2267. break;
  2268. case \'isempty\':
  2269. case \'empty\':
  2270. $tplCon = empty($subject) ? $conditionalTpl : $tplCon;
  2271. break;
  2272. case \'!empty\':
  2273. case \'notempty\':
  2274. case \'isnotempty\':
  2275. $tplCon = !empty($subject) && $subject != \'\' ? $conditionalTpl : $tplCon;
  2276. break;
  2277. case \'isnull\':
  2278. case \'null\':
  2279. $tplCon = $subject == null || strtolower($subject) == \'null\' ? $conditionalTpl : $tplCon;
  2280. break;
  2281. case \'inarray\':
  2282. case \'in_array\':
  2283. case \'ia\':
  2284. $operand = explode(\',\', $operand);
  2285. $tplCon = in_array($subject, $operand) ? $conditionalTpl : $tplCon;
  2286. break;
  2287. case \'between\':
  2288. case \'range\':
  2289. case \'>=<\':
  2290. case \'><\':
  2291. $operand = explode(\',\', $operand);
  2292. $tplCon = ($subject >= min($operand) && $subject <= max($operand)) ? $conditionalTpl : $tplCon;
  2293. break;
  2294. case \'==\':
  2295. case \'=\':
  2296. case \'eq\':
  2297. case \'is\':
  2298. case \'equal\':
  2299. case \'equals\':
  2300. case \'equalto\':
  2301. default:
  2302. $tplCon = (($subject == $operand) ? $conditionalTpl : $tplCon);
  2303. break;
  2304. }
  2305. }
  2306. if (!empty($tplCon)) {
  2307. $resourceTpl = parseTpl($tplCon, $properties);
  2308. }
  2309. }
  2310. if (!empty($tpl) && empty($resourceTpl)) {
  2311. $resourceTpl = parseTpl($tpl, $properties);
  2312. }
  2313. if ($resourceTpl === false && !empty($debug)) {
  2314. $chunk = $modx->newObject(\'modChunk\');
  2315. $chunk->setCacheable(false);
  2316. $output[]= $chunk->process(array(), \'<pre>\' . print_r($properties, true) .\'</pre>\');
  2317. } else {
  2318. $output[]= $resourceTpl;
  2319. }
  2320. $idx++;
  2321. }
  2322. /* output */
  2323. $toSeparatePlaceholders = $modx->getOption(\'toSeparatePlaceholders\', $scriptProperties, false);
  2324. if (!empty($toSeparatePlaceholders)) {
  2325. $modx->setPlaceholders($output, $toSeparatePlaceholders);
  2326. return \'\';
  2327. }
  2328. $output = implode($outputSeparator, $output);
  2329. $tplWrapper = $modx->getOption(\'tplWrapper\', $scriptProperties, false);
  2330. $wrapIfEmpty = $modx->getOption(\'wrapIfEmpty\', $scriptProperties, false);
  2331. if (!empty($tplWrapper) && ($wrapIfEmpty || !empty($output))) {
  2332. $output = parseTpl($tplWrapper, array_merge($scriptProperties, array(\'output\' => $output)));
  2333. }
  2334. $toPlaceholder = $modx->getOption(\'toPlaceholder\', $scriptProperties, false);
  2335. if (!empty($toPlaceholder)) {
  2336. $modx->setPlaceholder($toPlaceholder, $output);
  2337. return \'\';
  2338. }
  2339. return $output;',
  2340. 'locked' => false,
  2341. 'properties' =>
  2342. array (
  2343. 'tpl' =>
  2344. array (
  2345. 'name' => 'tpl',
  2346. 'desc' => 'Name of a chunk serving as a resource template. NOTE: if not provided, properties are dumped to output for each resource.',
  2347. 'type' => 'textfield',
  2348. 'options' => '',
  2349. 'value' => '',
  2350. 'lexicon' => NULL,
  2351. 'area' => '',
  2352. 'desc_trans' => 'Name of a chunk serving as a resource template. NOTE: if not provided, properties are dumped to output for each resource.',
  2353. 'area_trans' => '',
  2354. ),
  2355. 'tplOdd' =>
  2356. array (
  2357. 'name' => 'tplOdd',
  2358. 'desc' => 'Name of a chunk serving as resource template for resources with an odd idx value (see idx property).',
  2359. 'type' => 'textfield',
  2360. 'options' => '',
  2361. 'value' => '',
  2362. 'lexicon' => NULL,
  2363. 'area' => '',
  2364. 'desc_trans' => 'Name of a chunk serving as resource template for resources with an odd idx value (see idx property).',
  2365. 'area_trans' => '',
  2366. ),
  2367. 'tplFirst' =>
  2368. array (
  2369. 'name' => 'tplFirst',
  2370. 'desc' => 'Name of a chunk serving as resource template for the first resource (see first property).',
  2371. 'type' => 'textfield',
  2372. 'options' => '',
  2373. 'value' => '',
  2374. 'lexicon' => NULL,
  2375. 'area' => '',
  2376. 'desc_trans' => 'Name of a chunk serving as resource template for the first resource (see first property).',
  2377. 'area_trans' => '',
  2378. ),
  2379. 'tplLast' =>
  2380. array (
  2381. 'name' => 'tplLast',
  2382. 'desc' => 'Name of a chunk serving as resource template for the last resource (see last property).',
  2383. 'type' => 'textfield',
  2384. 'options' => '',
  2385. 'value' => '',
  2386. 'lexicon' => NULL,
  2387. 'area' => '',
  2388. 'desc_trans' => 'Name of a chunk serving as resource template for the last resource (see last property).',
  2389. 'area_trans' => '',
  2390. ),
  2391. 'tplWrapper' =>
  2392. array (
  2393. 'name' => 'tplWrapper',
  2394. 'desc' => 'Name of a chunk serving as wrapper template for the Snippet output. This does not work with toSeparatePlaceholders.',
  2395. 'type' => 'textfield',
  2396. 'options' => '',
  2397. 'value' => '',
  2398. 'lexicon' => NULL,
  2399. 'area' => '',
  2400. 'desc_trans' => 'Name of a chunk serving as wrapper template for the Snippet output. This does not work with toSeparatePlaceholders.',
  2401. 'area_trans' => '',
  2402. ),
  2403. 'wrapIfEmpty' =>
  2404. array (
  2405. 'name' => 'wrapIfEmpty',
  2406. 'desc' => 'Indicates if empty output should be wrapped by the tplWrapper, if specified. Defaults to false.',
  2407. 'type' => 'combo-boolean',
  2408. 'options' => '',
  2409. 'value' => false,
  2410. 'lexicon' => NULL,
  2411. 'area' => '',
  2412. 'desc_trans' => 'Indicates if empty output should be wrapped by the tplWrapper, if specified. Defaults to false.',
  2413. 'area_trans' => '',
  2414. ),
  2415. 'sortby' =>
  2416. array (
  2417. 'name' => 'sortby',
  2418. 'desc' => 'A field name to sort by or JSON object of field names and sortdir for each field, e.g. {"publishedon":"ASC","createdon":"DESC"}. Defaults to publishedon.',
  2419. 'type' => 'textfield',
  2420. 'options' => '',
  2421. 'value' => 'publishedon',
  2422. 'lexicon' => NULL,
  2423. 'area' => '',
  2424. 'desc_trans' => 'A field name to sort by or JSON object of field names and sortdir for each field, e.g. {"publishedon":"ASC","createdon":"DESC"}. Defaults to publishedon.',
  2425. 'area_trans' => '',
  2426. ),
  2427. 'sortbyTV' =>
  2428. array (
  2429. 'name' => 'sortbyTV',
  2430. 'desc' => 'Name of a Template Variable to sort by. Defaults to empty string.',
  2431. 'type' => 'textfield',
  2432. 'options' => '',
  2433. 'value' => '',
  2434. 'lexicon' => NULL,
  2435. 'area' => '',
  2436. 'desc_trans' => 'Name of a Template Variable to sort by. Defaults to empty string.',
  2437. 'area_trans' => '',
  2438. ),
  2439. 'sortbyTVType' =>
  2440. array (
  2441. 'name' => 'sortbyTVType',
  2442. 'desc' => 'An optional type to indicate how to sort on the Template Variable value.',
  2443. 'type' => 'list',
  2444. 'options' =>
  2445. array (
  2446. 0 =>
  2447. array (
  2448. 'text' => 'string',
  2449. 'value' => 'string',
  2450. 'name' => 'string',
  2451. ),
  2452. 1 =>
  2453. array (
  2454. 'text' => 'integer',
  2455. 'value' => 'integer',
  2456. 'name' => 'integer',
  2457. ),
  2458. 2 =>
  2459. array (
  2460. 'text' => 'decimal',
  2461. 'value' => 'decimal',
  2462. 'name' => 'decimal',
  2463. ),
  2464. 3 =>
  2465. array (
  2466. 'text' => 'datetime',
  2467. 'value' => 'datetime',
  2468. 'name' => 'datetime',
  2469. ),
  2470. ),
  2471. 'value' => 'string',
  2472. 'lexicon' => NULL,
  2473. 'area' => '',
  2474. 'desc_trans' => 'An optional type to indicate how to sort on the Template Variable value.',
  2475. 'area_trans' => '',
  2476. ),
  2477. 'sortbyAlias' =>
  2478. array (
  2479. 'name' => 'sortbyAlias',
  2480. 'desc' => 'Query alias for sortby field. Defaults to an empty string.',
  2481. 'type' => 'textfield',
  2482. 'options' => '',
  2483. 'value' => '',
  2484. 'lexicon' => NULL,
  2485. 'area' => '',
  2486. 'desc_trans' => 'Query alias for sortby field. Defaults to an empty string.',
  2487. 'area_trans' => '',
  2488. ),
  2489. 'sortbyEscaped' =>
  2490. array (
  2491. 'name' => 'sortbyEscaped',
  2492. 'desc' => 'Determines if the field name specified in sortby should be escaped. Defaults to 0.',
  2493. 'type' => 'textfield',
  2494. 'options' => '',
  2495. 'value' => '0',
  2496. 'lexicon' => NULL,
  2497. 'area' => '',
  2498. 'desc_trans' => 'Determines if the field name specified in sortby should be escaped. Defaults to 0.',
  2499. 'area_trans' => '',
  2500. ),
  2501. 'sortdir' =>
  2502. array (
  2503. 'name' => 'sortdir',
  2504. 'desc' => 'Order which to sort by. Defaults to DESC.',
  2505. 'type' => 'list',
  2506. 'options' =>
  2507. array (
  2508. 0 =>
  2509. array (
  2510. 'text' => 'ASC',
  2511. 'value' => 'ASC',
  2512. 'name' => 'ASC',
  2513. ),
  2514. 1 =>
  2515. array (
  2516. 'text' => 'DESC',
  2517. 'value' => 'DESC',
  2518. 'name' => 'DESC',
  2519. ),
  2520. ),
  2521. 'value' => 'DESC',
  2522. 'lexicon' => NULL,
  2523. 'area' => '',
  2524. 'desc_trans' => 'Order which to sort by. Defaults to DESC.',
  2525. 'area_trans' => '',
  2526. ),
  2527. 'sortdirTV' =>
  2528. array (
  2529. 'name' => 'sortdirTV',
  2530. 'desc' => 'Order which to sort a Template Variable by. Defaults to DESC.',
  2531. 'type' => 'list',
  2532. 'options' =>
  2533. array (
  2534. 0 =>
  2535. array (
  2536. 'text' => 'ASC',
  2537. 'value' => 'ASC',
  2538. 'name' => 'ASC',
  2539. ),
  2540. 1 =>
  2541. array (
  2542. 'text' => 'DESC',
  2543. 'value' => 'DESC',
  2544. 'name' => 'DESC',
  2545. ),
  2546. ),
  2547. 'value' => 'DESC',
  2548. 'lexicon' => NULL,
  2549. 'area' => '',
  2550. 'desc_trans' => 'Order which to sort a Template Variable by. Defaults to DESC.',
  2551. 'area_trans' => '',
  2552. ),
  2553. 'limit' =>
  2554. array (
  2555. 'name' => 'limit',
  2556. 'desc' => 'Limits the number of resources returned. Defaults to 5.',
  2557. 'type' => 'textfield',
  2558. 'options' => '',
  2559. 'value' => '5',
  2560. 'lexicon' => NULL,
  2561. 'area' => '',
  2562. 'desc_trans' => 'Limits the number of resources returned. Defaults to 5.',
  2563. 'area_trans' => '',
  2564. ),
  2565. 'offset' =>
  2566. array (
  2567. 'name' => 'offset',
  2568. 'desc' => 'An offset of resources returned by the criteria to skip.',
  2569. 'type' => 'textfield',
  2570. 'options' => '',
  2571. 'value' => '0',
  2572. 'lexicon' => NULL,
  2573. 'area' => '',
  2574. 'desc_trans' => 'An offset of resources returned by the criteria to skip.',
  2575. 'area_trans' => '',
  2576. ),
  2577. 'tvFilters' =>
  2578. array (
  2579. 'name' => 'tvFilters',
  2580. 'desc' => 'Delimited-list of TemplateVar values to filter resources by. Supports two delimiters and two value search formats. THe first delimiter || represents a logical OR and the primary grouping mechanism. Within each group you can provide a comma-delimited list of values. These values can be either tied to a specific TemplateVar by name, e.g. myTV==value, or just the value, indicating you are searching for the value in any TemplateVar tied to the Resource. An example would be &tvFilters=`filter2==one,filter1==bar%||filter1==foo`. <br />NOTE: filtering by values uses a LIKE query and % is considered a wildcard. <br />ANOTHER NOTE: This only looks at the raw value set for specific Resource, i. e. there must be a value specifically set for the Resource and it is not evaluated.',
  2581. 'type' => 'textfield',
  2582. 'options' => '',
  2583. 'value' => '',
  2584. 'lexicon' => NULL,
  2585. 'area' => '',
  2586. 'desc_trans' => 'Delimited-list of TemplateVar values to filter resources by. Supports two delimiters and two value search formats. THe first delimiter || represents a logical OR and the primary grouping mechanism. Within each group you can provide a comma-delimited list of values. These values can be either tied to a specific TemplateVar by name, e.g. myTV==value, or just the value, indicating you are searching for the value in any TemplateVar tied to the Resource. An example would be &tvFilters=`filter2==one,filter1==bar%||filter1==foo`. <br />NOTE: filtering by values uses a LIKE query and % is considered a wildcard. <br />ANOTHER NOTE: This only looks at the raw value set for specific Resource, i. e. there must be a value specifically set for the Resource and it is not evaluated.',
  2587. 'area_trans' => '',
  2588. ),
  2589. 'tvFiltersAndDelimiter' =>
  2590. array (
  2591. 'name' => 'tvFiltersAndDelimiter',
  2592. 'desc' => 'The delimiter to use to separate logical AND expressions in tvFilters. Default is ,',
  2593. 'type' => 'textfield',
  2594. 'options' => '',
  2595. 'value' => ',',
  2596. 'lexicon' => NULL,
  2597. 'area' => '',
  2598. 'desc_trans' => 'The delimiter to use to separate logical AND expressions in tvFilters. Default is ,',
  2599. 'area_trans' => '',
  2600. ),
  2601. 'tvFiltersOrDelimiter' =>
  2602. array (
  2603. 'name' => 'tvFiltersOrDelimiter',
  2604. 'desc' => 'The delimiter to use to separate logical OR expressions in tvFilters. Default is ||',
  2605. 'type' => 'textfield',
  2606. 'options' => '',
  2607. 'value' => '||',
  2608. 'lexicon' => NULL,
  2609. 'area' => '',
  2610. 'desc_trans' => 'The delimiter to use to separate logical OR expressions in tvFilters. Default is ||',
  2611. 'area_trans' => '',
  2612. ),
  2613. 'depth' =>
  2614. array (
  2615. 'name' => 'depth',
  2616. 'desc' => 'Integer value indicating depth to search for resources from each parent. Defaults to 10.',
  2617. 'type' => 'textfield',
  2618. 'options' => '',
  2619. 'value' => '10',
  2620. 'lexicon' => NULL,
  2621. 'area' => '',
  2622. 'desc_trans' => 'Integer value indicating depth to search for resources from each parent. Defaults to 10.',
  2623. 'area_trans' => '',
  2624. ),
  2625. 'parents' =>
  2626. array (
  2627. 'name' => 'parents',
  2628. 'desc' => 'Optional. Comma-delimited list of ids serving as parents.',
  2629. 'type' => 'textfield',
  2630. 'options' => '',
  2631. 'value' => '',
  2632. 'lexicon' => NULL,
  2633. 'area' => '',
  2634. 'desc_trans' => 'Optional. Comma-delimited list of ids serving as parents.',
  2635. 'area_trans' => '',
  2636. ),
  2637. 'includeContent' =>
  2638. array (
  2639. 'name' => 'includeContent',
  2640. 'desc' => 'Indicates if the content of each resource should be returned in the results. Defaults to false.',
  2641. 'type' => 'combo-boolean',
  2642. 'options' => '',
  2643. 'value' => false,
  2644. 'lexicon' => NULL,
  2645. 'area' => '',
  2646. 'desc_trans' => 'Indicates if the content of each resource should be returned in the results. Defaults to false.',
  2647. 'area_trans' => '',
  2648. ),
  2649. 'includeTVs' =>
  2650. array (
  2651. 'name' => 'includeTVs',
  2652. 'desc' => 'Indicates if TemplateVar values should be included in the properties available to each resource template. Defaults to false.',
  2653. 'type' => 'combo-boolean',
  2654. 'options' => '',
  2655. 'value' => false,
  2656. 'lexicon' => NULL,
  2657. 'area' => '',
  2658. 'desc_trans' => 'Indicates if TemplateVar values should be included in the properties available to each resource template. Defaults to false.',
  2659. 'area_trans' => '',
  2660. ),
  2661. 'includeTVList' =>
  2662. array (
  2663. 'name' => 'includeTVList',
  2664. 'desc' => 'Limits included TVs to those specified as a comma-delimited list of TV names. Defaults to empty.',
  2665. 'type' => 'textfield',
  2666. 'options' => '',
  2667. 'value' => '',
  2668. 'lexicon' => NULL,
  2669. 'area' => '',
  2670. 'desc_trans' => 'Limits included TVs to those specified as a comma-delimited list of TV names. Defaults to empty.',
  2671. 'area_trans' => '',
  2672. ),
  2673. 'showHidden' =>
  2674. array (
  2675. 'name' => 'showHidden',
  2676. 'desc' => 'Indicates if Resources that are hidden from menus should be shown. Defaults to false.',
  2677. 'type' => 'combo-boolean',
  2678. 'options' => '',
  2679. 'value' => false,
  2680. 'lexicon' => NULL,
  2681. 'area' => '',
  2682. 'desc_trans' => 'Indicates if Resources that are hidden from menus should be shown. Defaults to false.',
  2683. 'area_trans' => '',
  2684. ),
  2685. 'showUnpublished' =>
  2686. array (
  2687. 'name' => 'showUnpublished',
  2688. 'desc' => 'Indicates if Resources that are unpublished should be shown. Defaults to false.',
  2689. 'type' => 'combo-boolean',
  2690. 'options' => '',
  2691. 'value' => false,
  2692. 'lexicon' => NULL,
  2693. 'area' => '',
  2694. 'desc_trans' => 'Indicates if Resources that are unpublished should be shown. Defaults to false.',
  2695. 'area_trans' => '',
  2696. ),
  2697. 'showDeleted' =>
  2698. array (
  2699. 'name' => 'showDeleted',
  2700. 'desc' => 'Indicates if Resources that are deleted should be shown. Defaults to false.',
  2701. 'type' => 'combo-boolean',
  2702. 'options' => '',
  2703. 'value' => false,
  2704. 'lexicon' => NULL,
  2705. 'area' => '',
  2706. 'desc_trans' => 'Indicates if Resources that are deleted should be shown. Defaults to false.',
  2707. 'area_trans' => '',
  2708. ),
  2709. 'resources' =>
  2710. array (
  2711. 'name' => 'resources',
  2712. 'desc' => 'A comma-separated list of resource IDs to exclude or include. IDs with a - in front mean to exclude. Ex: 123,-456 means to include Resource 123, but always exclude Resource 456.',
  2713. 'type' => 'textfield',
  2714. 'options' => '',
  2715. 'value' => '',
  2716. 'lexicon' => NULL,
  2717. 'area' => '',
  2718. 'desc_trans' => 'A comma-separated list of resource IDs to exclude or include. IDs with a - in front mean to exclude. Ex: 123,-456 means to include Resource 123, but always exclude Resource 456.',
  2719. 'area_trans' => '',
  2720. ),
  2721. 'processTVs' =>
  2722. array (
  2723. 'name' => 'processTVs',
  2724. 'desc' => 'Indicates if TemplateVar values should be rendered as they would on the resource being summarized. Defaults to false.',
  2725. 'type' => 'combo-boolean',
  2726. 'options' => '',
  2727. 'value' => false,
  2728. 'lexicon' => NULL,
  2729. 'area' => '',
  2730. 'desc_trans' => 'Indicates if TemplateVar values should be rendered as they would on the resource being summarized. Defaults to false.',
  2731. 'area_trans' => '',
  2732. ),
  2733. 'processTVList' =>
  2734. array (
  2735. 'name' => 'processTVList',
  2736. 'desc' => 'Limits processed TVs to those specified as a comma-delimited list of TV names; note only includedTVs will be available for processing if specified. Defaults to empty.',
  2737. 'type' => 'textfield',
  2738. 'options' => '',
  2739. 'value' => '',
  2740. 'lexicon' => NULL,
  2741. 'area' => '',
  2742. 'desc_trans' => 'Limits processed TVs to those specified as a comma-delimited list of TV names; note only includedTVs will be available for processing if specified. Defaults to empty.',
  2743. 'area_trans' => '',
  2744. ),
  2745. 'prepareTVs' =>
  2746. array (
  2747. 'name' => 'prepareTVs',
  2748. 'desc' => 'Indicates if TemplateVar values that are not processed fully should be prepared before being returned. Defaults to true.',
  2749. 'type' => 'combo-boolean',
  2750. 'options' => '',
  2751. 'value' => true,
  2752. 'lexicon' => NULL,
  2753. 'area' => '',
  2754. 'desc_trans' => 'Indicates if TemplateVar values that are not processed fully should be prepared before being returned. Defaults to true.',
  2755. 'area_trans' => '',
  2756. ),
  2757. 'prepareTVList' =>
  2758. array (
  2759. 'name' => 'prepareTVList',
  2760. 'desc' => 'Limits prepared TVs to those specified as a comma-delimited list of TV names; note only includedTVs will be available for preparing if specified. Defaults to empty.',
  2761. 'type' => 'textfield',
  2762. 'options' => '',
  2763. 'value' => '',
  2764. 'lexicon' => NULL,
  2765. 'area' => '',
  2766. 'desc_trans' => 'Limits prepared TVs to those specified as a comma-delimited list of TV names; note only includedTVs will be available for preparing if specified. Defaults to empty.',
  2767. 'area_trans' => '',
  2768. ),
  2769. 'tvPrefix' =>
  2770. array (
  2771. 'name' => 'tvPrefix',
  2772. 'desc' => 'The prefix for TemplateVar properties. Defaults to: tv.',
  2773. 'type' => 'textfield',
  2774. 'options' => '',
  2775. 'value' => 'tv.',
  2776. 'lexicon' => NULL,
  2777. 'area' => '',
  2778. 'desc_trans' => 'The prefix for TemplateVar properties. Defaults to: tv.',
  2779. 'area_trans' => '',
  2780. ),
  2781. 'idx' =>
  2782. array (
  2783. 'name' => 'idx',
  2784. 'desc' => 'You can define the starting idx of the resources, which is an property that is incremented as each resource is rendered.',
  2785. 'type' => 'textfield',
  2786. 'options' => '',
  2787. 'value' => '',
  2788. 'lexicon' => NULL,
  2789. 'area' => '',
  2790. 'desc_trans' => 'You can define the starting idx of the resources, which is an property that is incremented as each resource is rendered.',
  2791. 'area_trans' => '',
  2792. ),
  2793. 'first' =>
  2794. array (
  2795. 'name' => 'first',
  2796. 'desc' => 'Define the idx which represents the first resource (see tplFirst). Defaults to 1.',
  2797. 'type' => 'textfield',
  2798. 'options' => '',
  2799. 'value' => '',
  2800. 'lexicon' => NULL,
  2801. 'area' => '',
  2802. 'desc_trans' => 'Define the idx which represents the first resource (see tplFirst). Defaults to 1.',
  2803. 'area_trans' => '',
  2804. ),
  2805. 'last' =>
  2806. array (
  2807. 'name' => 'last',
  2808. 'desc' => 'Define the idx which represents the last resource (see tplLast). Defaults to the number of resources being summarized + first - 1',
  2809. 'type' => 'textfield',
  2810. 'options' => '',
  2811. 'value' => '',
  2812. 'lexicon' => NULL,
  2813. 'area' => '',
  2814. 'desc_trans' => 'Define the idx which represents the last resource (see tplLast). Defaults to the number of resources being summarized + first - 1',
  2815. 'area_trans' => '',
  2816. ),
  2817. 'toPlaceholder' =>
  2818. array (
  2819. 'name' => 'toPlaceholder',
  2820. 'desc' => 'If set, will assign the result to this placeholder instead of outputting it directly.',
  2821. 'type' => 'textfield',
  2822. 'options' => '',
  2823. 'value' => '',
  2824. 'lexicon' => NULL,
  2825. 'area' => '',
  2826. 'desc_trans' => 'If set, will assign the result to this placeholder instead of outputting it directly.',
  2827. 'area_trans' => '',
  2828. ),
  2829. 'toSeparatePlaceholders' =>
  2830. array (
  2831. 'name' => 'toSeparatePlaceholders',
  2832. 'desc' => 'If set, will assign EACH result to a separate placeholder named by this param suffixed with a sequential number (starting from 0).',
  2833. 'type' => 'textfield',
  2834. 'options' => '',
  2835. 'value' => '',
  2836. 'lexicon' => NULL,
  2837. 'area' => '',
  2838. 'desc_trans' => 'If set, will assign EACH result to a separate placeholder named by this param suffixed with a sequential number (starting from 0).',
  2839. 'area_trans' => '',
  2840. ),
  2841. 'debug' =>
  2842. array (
  2843. 'name' => 'debug',
  2844. 'desc' => 'If true, will send the SQL query to the MODX log. Defaults to false.',
  2845. 'type' => 'combo-boolean',
  2846. 'options' => '',
  2847. 'value' => false,
  2848. 'lexicon' => NULL,
  2849. 'area' => '',
  2850. 'desc_trans' => 'If true, will send the SQL query to the MODX log. Defaults to false.',
  2851. 'area_trans' => '',
  2852. ),
  2853. 'where' =>
  2854. array (
  2855. 'name' => 'where',
  2856. 'desc' => 'A JSON expression of criteria to build any additional where clauses from, e.g. &where=`{{"alias:LIKE":"foo%", "OR:alias:LIKE":"%bar"},{"OR:pagetitle:=":"foobar", "AND:description:=":"raboof"}}`',
  2857. 'type' => 'textfield',
  2858. 'options' => '',
  2859. 'value' => '',
  2860. 'lexicon' => NULL,
  2861. 'area' => '',
  2862. 'desc_trans' => 'A JSON expression of criteria to build any additional where clauses from, e.g. &where=`{{"alias:LIKE":"foo%", "OR:alias:LIKE":"%bar"},{"OR:pagetitle:=":"foobar", "AND:description:=":"raboof"}}`',
  2863. 'area_trans' => '',
  2864. ),
  2865. 'dbCacheFlag' =>
  2866. array (
  2867. 'name' => 'dbCacheFlag',
  2868. 'desc' => 'Determines how result sets are cached if cache_db is enabled in MODX. 0|false = do not cache result set; 1 = cache result set according to cache settings, any other integer value = number of seconds to cache result set',
  2869. 'type' => 'textfield',
  2870. 'options' => '',
  2871. 'value' => '0',
  2872. 'lexicon' => NULL,
  2873. 'area' => '',
  2874. 'desc_trans' => 'Determines how result sets are cached if cache_db is enabled in MODX. 0|false = do not cache result set; 1 = cache result set according to cache settings, any other integer value = number of seconds to cache result set',
  2875. 'area_trans' => '',
  2876. ),
  2877. 'context' =>
  2878. array (
  2879. 'name' => 'context',
  2880. 'desc' => 'A comma-delimited list of context keys for limiting results. Default is empty, i.e. do not limit results by context.',
  2881. 'type' => 'textfield',
  2882. 'options' => '',
  2883. 'value' => '',
  2884. 'lexicon' => NULL,
  2885. 'area' => '',
  2886. 'desc_trans' => 'A comma-delimited list of context keys for limiting results. Default is empty, i.e. do not limit results by context.',
  2887. 'area_trans' => '',
  2888. ),
  2889. 'tplCondition' =>
  2890. array (
  2891. 'name' => 'tplCondition',
  2892. 'desc' => 'A condition to compare against the conditionalTpls property to map Resources to different tpls based on custom conditional logic.',
  2893. 'type' => 'textfield',
  2894. 'options' => '',
  2895. 'value' => '',
  2896. 'lexicon' => NULL,
  2897. 'area' => '',
  2898. 'desc_trans' => 'A condition to compare against the conditionalTpls property to map Resources to different tpls based on custom conditional logic.',
  2899. 'area_trans' => '',
  2900. ),
  2901. 'tplOperator' =>
  2902. array (
  2903. 'name' => 'tplOperator',
  2904. 'desc' => 'An optional operator to use for the tplCondition when comparing against the conditionalTpls operands. Default is == (equals).',
  2905. 'type' => 'list',
  2906. 'options' =>
  2907. array (
  2908. 0 =>
  2909. array (
  2910. 'text' => 'is equal to',
  2911. 'value' => '==',
  2912. 'name' => 'is equal to',
  2913. ),
  2914. 1 =>
  2915. array (
  2916. 'text' => 'is not equal to',
  2917. 'value' => '!=',
  2918. 'name' => 'is not equal to',
  2919. ),
  2920. 2 =>
  2921. array (
  2922. 'text' => 'less than',
  2923. 'value' => '<',
  2924. 'name' => 'less than',
  2925. ),
  2926. 3 =>
  2927. array (
  2928. 'text' => 'less than or equal to',
  2929. 'value' => '<=',
  2930. 'name' => 'less than or equal to',
  2931. ),
  2932. 4 =>
  2933. array (
  2934. 'text' => 'greater than or equal to',
  2935. 'value' => '>=',
  2936. 'name' => 'greater than or equal to',
  2937. ),
  2938. 5 =>
  2939. array (
  2940. 'text' => 'is empty',
  2941. 'value' => 'empty',
  2942. 'name' => 'is empty',
  2943. ),
  2944. 6 =>
  2945. array (
  2946. 'text' => 'is not empty',
  2947. 'value' => '!empty',
  2948. 'name' => 'is not empty',
  2949. ),
  2950. 7 =>
  2951. array (
  2952. 'text' => 'is null',
  2953. 'value' => 'null',
  2954. 'name' => 'is null',
  2955. ),
  2956. 8 =>
  2957. array (
  2958. 'text' => 'is in array',
  2959. 'value' => 'inarray',
  2960. 'name' => 'is in array',
  2961. ),
  2962. 9 =>
  2963. array (
  2964. 'text' => 'is between',
  2965. 'value' => 'between',
  2966. 'name' => 'is between',
  2967. ),
  2968. ),
  2969. 'value' => '==',
  2970. 'lexicon' => NULL,
  2971. 'area' => '',
  2972. 'desc_trans' => 'An optional operator to use for the tplCondition when comparing against the conditionalTpls operands. Default is == (equals).',
  2973. 'area_trans' => '',
  2974. ),
  2975. 'conditionalTpls' =>
  2976. array (
  2977. 'name' => 'conditionalTpls',
  2978. 'desc' => 'A JSON map of conditional operands and tpls to compare against the tplCondition property using the specified tplOperator.',
  2979. 'type' => 'textfield',
  2980. 'options' => '',
  2981. 'value' => '',
  2982. 'lexicon' => NULL,
  2983. 'area' => '',
  2984. 'desc_trans' => 'A JSON map of conditional operands and tpls to compare against the tplCondition property using the specified tplOperator.',
  2985. 'area_trans' => '',
  2986. ),
  2987. ),
  2988. 'moduleguid' => '',
  2989. 'static' => false,
  2990. 'static_file' => '',
  2991. 'content' => '/**
  2992. * getResources
  2993. *
  2994. * A general purpose Resource listing and summarization snippet for MODX 2.x.
  2995. *
  2996. * @author Jason Coward
  2997. * @copyright Copyright 2010-2013, Jason Coward
  2998. *
  2999. * TEMPLATES
  3000. *
  3001. * tpl - Name of a chunk serving as a resource template
  3002. * [NOTE: if not provided, properties are dumped to output for each resource]
  3003. *
  3004. * tplOdd - (Opt) Name of a chunk serving as resource template for resources with an odd idx value
  3005. * (see idx property)
  3006. * tplFirst - (Opt) Name of a chunk serving as resource template for the first resource (see first
  3007. * property)
  3008. * tplLast - (Opt) Name of a chunk serving as resource template for the last resource (see last
  3009. * property)
  3010. * tpl_{n} - (Opt) Name of a chunk serving as resource template for the nth resource
  3011. *
  3012. * tplCondition - (Opt) Defines a field of the resource to evaluate against keys defined in the
  3013. * conditionalTpls property. Must be a resource field; does not work with Template Variables.
  3014. * conditionalTpls - (Opt) A JSON object defining a map of field values and the associated tpl to
  3015. * use when the field defined by tplCondition matches the value. [NOTE: tplOdd, tplFirst, tplLast,
  3016. * and tpl_{n} will take precedence over any defined conditionalTpls]
  3017. *
  3018. * tplWrapper - (Opt) Name of a chunk serving as a wrapper template for the output
  3019. * [NOTE: Does not work with toSeparatePlaceholders]
  3020. *
  3021. * SELECTION
  3022. *
  3023. * parents - Comma-delimited list of ids serving as parents
  3024. *
  3025. * context - (Opt) Comma-delimited list of context keys to limit results by; if empty, contexts for all specified
  3026. * parents will be used (all contexts if 0 is specified) [default=]
  3027. *
  3028. * depth - (Opt) Integer value indicating depth to search for resources from each parent [default=10]
  3029. *
  3030. * tvFilters - (Opt) Delimited-list of TemplateVar values to filter resources by. Supports two
  3031. * delimiters and two value search formats. The first delimiter || represents a logical OR and the
  3032. * primary grouping mechanism. Within each group you can provide a comma-delimited list of values.
  3033. * These values can be either tied to a specific TemplateVar by name, e.g. myTV==value, or just the
  3034. * value, indicating you are searching for the value in any TemplateVar tied to the Resource. An
  3035. * example would be &tvFilters=`filter2==one,filter1==bar%||filter1==foo`
  3036. * [NOTE: filtering by values uses a LIKE query and % is considered a wildcard.]
  3037. * [NOTE: this only looks at the raw value set for specific Resource, i. e. there must be a value
  3038. * specifically set for the Resource and it is not evaluated.]
  3039. *
  3040. * tvFiltersAndDelimiter - (Opt) Custom delimiter for logical AND, default \',\', in case you want to
  3041. * match a literal comma in the tvFilters. E.g. &tvFiltersAndDelimiter=`&&`
  3042. * &tvFilters=`filter1==foo,bar&&filter2==baz` [default=,]
  3043. *
  3044. * tvFiltersOrDelimiter - (Opt) Custom delimiter for logical OR, default \'||\', in case you want to
  3045. * match a literal \'||\' in the tvFilters. E.g. &tvFiltersOrDelimiter=`|OR|`
  3046. * &tvFilters=`filter1==foo||bar|OR|filter2==baz` [default=||]
  3047. *
  3048. * where - (Opt) A JSON expression of criteria to build any additional where clauses from. An example would be
  3049. * &where=`{{"alias:LIKE":"foo%", "OR:alias:LIKE":"%bar"},{"OR:pagetitle:=":"foobar", "AND:description:=":"raboof"}}`
  3050. *
  3051. * sortby - (Opt) Field to sort by or a JSON array, e.g. {"publishedon":"ASC","createdon":"DESC"} [default=publishedon]
  3052. * sortbyTV - (opt) A Template Variable name to sort by (if supplied, this precedes the sortby value) [default=]
  3053. * sortbyTVType - (Opt) A data type to CAST a TV Value to in order to sort on it properly [default=string]
  3054. * sortbyAlias - (Opt) Query alias for sortby field [default=]
  3055. * sortbyEscaped - (Opt) Escapes the field name(s) specified in sortby [default=0]
  3056. * sortdir - (Opt) Order which to sort by [default=DESC]
  3057. * sortdirTV - (Opt) Order which to sort by a TV [default=DESC]
  3058. * limit - (Opt) Limits the number of resources returned [default=5]
  3059. * offset - (Opt) An offset of resources returned by the criteria to skip [default=0]
  3060. * dbCacheFlag - (Opt) Controls caching of db queries; 0|false = do not cache result set; 1 = cache result set
  3061. * according to cache settings, any other integer value = number of seconds to cache result set [default=0]
  3062. *
  3063. * OPTIONS
  3064. *
  3065. * includeContent - (Opt) Indicates if the content of each resource should be returned in the
  3066. * results [default=0]
  3067. * includeTVs - (Opt) Indicates if TemplateVar values should be included in the properties available
  3068. * to each resource template [default=0]
  3069. * includeTVList - (Opt) Limits the TemplateVars that are included if includeTVs is true to those specified
  3070. * by name in a comma-delimited list [default=]
  3071. * prepareTVs - (Opt) Prepares media-source dependent TemplateVar values [default=1]
  3072. * prepareTVList - (Opt) Limits the TVs that are prepared to those specified by name in a comma-delimited
  3073. * list [default=]
  3074. * processTVs - (Opt) Indicates if TemplateVar values should be rendered as they would on the
  3075. * resource being summarized [default=0]
  3076. * processTVList - (opt) Limits the TemplateVars that are processed if included to those specified
  3077. * by name in a comma-delimited list [default=]
  3078. * tvPrefix - (Opt) The prefix for TemplateVar properties [default=tv.]
  3079. * idx - (Opt) You can define the starting idx of the resources, which is an property that is
  3080. * incremented as each resource is rendered [default=1]
  3081. * first - (Opt) Define the idx which represents the first resource (see tplFirst) [default=1]
  3082. * last - (Opt) Define the idx which represents the last resource (see tplLast) [default=# of
  3083. * resources being summarized + first - 1]
  3084. * outputSeparator - (Opt) An optional string to separate each tpl instance [default="\\n"]
  3085. * wrapIfEmpty - (Opt) Indicates if the tplWrapper should be applied if the output is empty [default=0]
  3086. *
  3087. */
  3088. $output = array();
  3089. $outputSeparator = isset($outputSeparator) ? $outputSeparator : "\\n";
  3090. /* set default properties */
  3091. $tpl = !empty($tpl) ? $tpl : \'\';
  3092. $includeContent = !empty($includeContent) ? true : false;
  3093. $includeTVs = !empty($includeTVs) ? true : false;
  3094. $includeTVList = !empty($includeTVList) ? explode(\',\', $includeTVList) : array();
  3095. $processTVs = !empty($processTVs) ? true : false;
  3096. $processTVList = !empty($processTVList) ? explode(\',\', $processTVList) : array();
  3097. $prepareTVs = !empty($prepareTVs) ? true : false;
  3098. $prepareTVList = !empty($prepareTVList) ? explode(\',\', $prepareTVList) : array();
  3099. $tvPrefix = isset($tvPrefix) ? $tvPrefix : \'tv.\';
  3100. $parents = (!empty($parents) || $parents === \'0\') ? explode(\',\', $parents) : array($modx->resource->get(\'id\'));
  3101. array_walk($parents, \'trim\');
  3102. $parents = array_unique($parents);
  3103. $depth = isset($depth) ? (integer) $depth : 10;
  3104. $tvFiltersOrDelimiter = isset($tvFiltersOrDelimiter) ? $tvFiltersOrDelimiter : \'||\';
  3105. $tvFiltersAndDelimiter = isset($tvFiltersAndDelimiter) ? $tvFiltersAndDelimiter : \',\';
  3106. $tvFilters = !empty($tvFilters) ? explode($tvFiltersOrDelimiter, $tvFilters) : array();
  3107. $where = !empty($where) ? $modx->fromJSON($where) : array();
  3108. $showUnpublished = !empty($showUnpublished) ? true : false;
  3109. $showDeleted = !empty($showDeleted) ? true : false;
  3110. $sortby = isset($sortby) ? $sortby : \'publishedon\';
  3111. $sortbyTV = isset($sortbyTV) ? $sortbyTV : \'\';
  3112. $sortbyAlias = isset($sortbyAlias) ? $sortbyAlias : \'modResource\';
  3113. $sortbyEscaped = !empty($sortbyEscaped) ? true : false;
  3114. $sortdir = isset($sortdir) ? $sortdir : \'DESC\';
  3115. $sortdirTV = isset($sortdirTV) ? $sortdirTV : \'DESC\';
  3116. $limit = isset($limit) ? (integer) $limit : 5;
  3117. $offset = isset($offset) ? (integer) $offset : 0;
  3118. $totalVar = !empty($totalVar) ? $totalVar : \'total\';
  3119. $dbCacheFlag = !isset($dbCacheFlag) ? false : $dbCacheFlag;
  3120. if (is_string($dbCacheFlag) || is_numeric($dbCacheFlag)) {
  3121. if ($dbCacheFlag == \'0\') {
  3122. $dbCacheFlag = false;
  3123. } elseif ($dbCacheFlag == \'1\') {
  3124. $dbCacheFlag = true;
  3125. } else {
  3126. $dbCacheFlag = (integer) $dbCacheFlag;
  3127. }
  3128. }
  3129. /* multiple context support */
  3130. $contextArray = array();
  3131. $contextSpecified = false;
  3132. if (!empty($context)) {
  3133. $contextArray = explode(\',\',$context);
  3134. array_walk($contextArray, \'trim\');
  3135. $contexts = array();
  3136. foreach ($contextArray as $ctx) {
  3137. $contexts[] = $modx->quote($ctx);
  3138. }
  3139. $context = implode(\',\',$contexts);
  3140. $contextSpecified = true;
  3141. unset($contexts,$ctx);
  3142. } else {
  3143. $context = $modx->quote($modx->context->get(\'key\'));
  3144. }
  3145. $pcMap = array();
  3146. $pcQuery = $modx->newQuery(\'modResource\', array(\'id:IN\' => $parents), $dbCacheFlag);
  3147. $pcQuery->select(array(\'id\', \'context_key\'));
  3148. if ($pcQuery->prepare() && $pcQuery->stmt->execute()) {
  3149. foreach ($pcQuery->stmt->fetchAll(PDO::FETCH_ASSOC) as $pcRow) {
  3150. $pcMap[(integer) $pcRow[\'id\']] = $pcRow[\'context_key\'];
  3151. }
  3152. }
  3153. $children = array();
  3154. $parentArray = array();
  3155. foreach ($parents as $parent) {
  3156. $parent = (integer) $parent;
  3157. if ($parent === 0) {
  3158. $pchildren = array();
  3159. if ($contextSpecified) {
  3160. foreach ($contextArray as $pCtx) {
  3161. if (!in_array($pCtx, $contextArray)) {
  3162. continue;
  3163. }
  3164. $options = $pCtx !== $modx->context->get(\'key\') ? array(\'context\' => $pCtx) : array();
  3165. $pcchildren = $modx->getChildIds($parent, $depth, $options);
  3166. if (!empty($pcchildren)) $pchildren = array_merge($pchildren, $pcchildren);
  3167. }
  3168. } else {
  3169. $cQuery = $modx->newQuery(\'modContext\', array(\'key:!=\' => \'mgr\'));
  3170. $cQuery->select(array(\'key\'));
  3171. if ($cQuery->prepare() && $cQuery->stmt->execute()) {
  3172. foreach ($cQuery->stmt->fetchAll(PDO::FETCH_COLUMN) as $pCtx) {
  3173. $options = $pCtx !== $modx->context->get(\'key\') ? array(\'context\' => $pCtx) : array();
  3174. $pcchildren = $modx->getChildIds($parent, $depth, $options);
  3175. if (!empty($pcchildren)) $pchildren = array_merge($pchildren, $pcchildren);
  3176. }
  3177. }
  3178. }
  3179. $parentArray[] = $parent;
  3180. } else {
  3181. $pContext = array_key_exists($parent, $pcMap) ? $pcMap[$parent] : false;
  3182. if ($debug) $modx->log(modX::LOG_LEVEL_ERROR, "context for {$parent} is {$pContext}");
  3183. if ($pContext && $contextSpecified && !in_array($pContext, $contextArray, true)) {
  3184. $parent = next($parents);
  3185. continue;
  3186. }
  3187. $parentArray[] = $parent;
  3188. $options = !empty($pContext) && $pContext !== $modx->context->get(\'key\') ? array(\'context\' => $pContext) : array();
  3189. $pchildren = $modx->getChildIds($parent, $depth, $options);
  3190. }
  3191. if (!empty($pchildren)) $children = array_merge($children, $pchildren);
  3192. $parent = next($parents);
  3193. }
  3194. $parents = array_merge($parentArray, $children);
  3195. /* build query */
  3196. $criteria = array("modResource.parent IN (" . implode(\',\', $parents) . ")");
  3197. if ($contextSpecified) {
  3198. $contextResourceTbl = $modx->getTableName(\'modContextResource\');
  3199. $criteria[] = "(modResource.context_key IN ({$context}) OR EXISTS(SELECT 1 FROM {$contextResourceTbl} ctx WHERE ctx.resource = modResource.id AND ctx.context_key IN ({$context})))";
  3200. }
  3201. if (empty($showDeleted)) {
  3202. $criteria[\'deleted\'] = \'0\';
  3203. }
  3204. if (empty($showUnpublished)) {
  3205. $criteria[\'published\'] = \'1\';
  3206. }
  3207. if (empty($showHidden)) {
  3208. $criteria[\'hidemenu\'] = \'0\';
  3209. }
  3210. if (!empty($hideContainers)) {
  3211. $criteria[\'isfolder\'] = \'0\';
  3212. }
  3213. $criteria = $modx->newQuery(\'modResource\', $criteria);
  3214. if (!empty($tvFilters)) {
  3215. $tmplVarTbl = $modx->getTableName(\'modTemplateVar\');
  3216. $tmplVarResourceTbl = $modx->getTableName(\'modTemplateVarResource\');
  3217. $conditions = array();
  3218. $operators = array(
  3219. \'<=>\' => \'<=>\',
  3220. \'===\' => \'=\',
  3221. \'!==\' => \'!=\',
  3222. \'<>\' => \'<>\',
  3223. \'==\' => \'LIKE\',
  3224. \'!=\' => \'NOT LIKE\',
  3225. \'<<\' => \'<\',
  3226. \'<=\' => \'<=\',
  3227. \'=<\' => \'=<\',
  3228. \'>>\' => \'>\',
  3229. \'>=\' => \'>=\',
  3230. \'=>\' => \'=>\'
  3231. );
  3232. foreach ($tvFilters as $fGroup => $tvFilter) {
  3233. $filterGroup = array();
  3234. $filters = explode($tvFiltersAndDelimiter, $tvFilter);
  3235. $multiple = count($filters) > 0;
  3236. foreach ($filters as $filter) {
  3237. $operator = \'==\';
  3238. $sqlOperator = \'LIKE\';
  3239. foreach ($operators as $op => $opSymbol) {
  3240. if (strpos($filter, $op, 1) !== false) {
  3241. $operator = $op;
  3242. $sqlOperator = $opSymbol;
  3243. break;
  3244. }
  3245. }
  3246. $tvValueField = \'tvr.value\';
  3247. $tvDefaultField = \'tv.default_text\';
  3248. $f = explode($operator, $filter);
  3249. if (count($f) >= 2) {
  3250. if (count($f) > 2) {
  3251. $k = array_shift($f);
  3252. $b = join($operator, $f);
  3253. $f = array($k, $b);
  3254. }
  3255. $tvName = $modx->quote($f[0]);
  3256. if (is_numeric($f[1]) && !in_array($sqlOperator, array(\'LIKE\', \'NOT LIKE\'))) {
  3257. $tvValue = $f[1];
  3258. if ($f[1] == (integer)$f[1]) {
  3259. $tvValueField = "CAST({$tvValueField} AS SIGNED INTEGER)";
  3260. $tvDefaultField = "CAST({$tvDefaultField} AS SIGNED INTEGER)";
  3261. } else {
  3262. $tvValueField = "CAST({$tvValueField} AS DECIMAL)";
  3263. $tvDefaultField = "CAST({$tvDefaultField} AS DECIMAL)";
  3264. }
  3265. } else {
  3266. $tvValue = $modx->quote($f[1]);
  3267. }
  3268. if ($multiple) {
  3269. $filterGroup[] =
  3270. "(EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.name = {$tvName} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id) " .
  3271. "OR EXISTS (SELECT 1 FROM {$tmplVarTbl} tv WHERE tv.name = {$tvName} AND {$tvDefaultField} {$sqlOperator} {$tvValue} AND tv.id NOT IN (SELECT tmplvarid FROM {$tmplVarResourceTbl} WHERE contentid = modResource.id)) " .
  3272. ")";
  3273. } else {
  3274. $filterGroup =
  3275. "(EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.name = {$tvName} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id) " .
  3276. "OR EXISTS (SELECT 1 FROM {$tmplVarTbl} tv WHERE tv.name = {$tvName} AND {$tvDefaultField} {$sqlOperator} {$tvValue} AND tv.id NOT IN (SELECT tmplvarid FROM {$tmplVarResourceTbl} WHERE contentid = modResource.id)) " .
  3277. ")";
  3278. }
  3279. } elseif (count($f) == 1) {
  3280. $tvValue = $modx->quote($f[0]);
  3281. if ($multiple) {
  3282. $filterGroup[] = "EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id)";
  3283. } else {
  3284. $filterGroup = "EXISTS (SELECT 1 FROM {$tmplVarResourceTbl} tvr JOIN {$tmplVarTbl} tv ON {$tvValueField} {$sqlOperator} {$tvValue} AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id)";
  3285. }
  3286. }
  3287. }
  3288. $conditions[] = $filterGroup;
  3289. }
  3290. if (!empty($conditions)) {
  3291. $firstGroup = true;
  3292. foreach ($conditions as $cGroup => $c) {
  3293. if (is_array($c)) {
  3294. $first = true;
  3295. foreach ($c as $cond) {
  3296. if ($first && !$firstGroup) {
  3297. $criteria->condition($criteria->query[\'where\'][0][1], $cond, xPDOQuery::SQL_OR, null, $cGroup);
  3298. } else {
  3299. $criteria->condition($criteria->query[\'where\'][0][1], $cond, xPDOQuery::SQL_AND, null, $cGroup);
  3300. }
  3301. $first = false;
  3302. }
  3303. } else {
  3304. $criteria->condition($criteria->query[\'where\'][0][1], $c, $firstGroup ? xPDOQuery::SQL_AND : xPDOQuery::SQL_OR, null, $cGroup);
  3305. }
  3306. $firstGroup = false;
  3307. }
  3308. }
  3309. }
  3310. /* include/exclude resources, via &resources=`123,-456` prop */
  3311. if (!empty($resources)) {
  3312. $resourceConditions = array();
  3313. $resources = explode(\',\',$resources);
  3314. $include = array();
  3315. $exclude = array();
  3316. foreach ($resources as $resource) {
  3317. $resource = (int)$resource;
  3318. if ($resource == 0) continue;
  3319. if ($resource < 0) {
  3320. $exclude[] = abs($resource);
  3321. } else {
  3322. $include[] = $resource;
  3323. }
  3324. }
  3325. if (!empty($include)) {
  3326. $criteria->where(array(\'OR:modResource.id:IN\' => $include), xPDOQuery::SQL_OR);
  3327. }
  3328. if (!empty($exclude)) {
  3329. $criteria->where(array(\'modResource.id:NOT IN\' => $exclude), xPDOQuery::SQL_AND, null, 1);
  3330. }
  3331. }
  3332. if (!empty($where)) {
  3333. $criteria->where($where);
  3334. }
  3335. $total = $modx->getCount(\'modResource\', $criteria);
  3336. $modx->setPlaceholder($totalVar, $total);
  3337. $fields = array_keys($modx->getFields(\'modResource\'));
  3338. if (empty($includeContent)) {
  3339. $fields = array_diff($fields, array(\'content\'));
  3340. }
  3341. $columns = $includeContent ? $modx->getSelectColumns(\'modResource\', \'modResource\') : $modx->getSelectColumns(\'modResource\', \'modResource\', \'\', array(\'content\'), true);
  3342. $criteria->select($columns);
  3343. if (!empty($sortbyTV)) {
  3344. $criteria->leftJoin(\'modTemplateVar\', \'tvDefault\', array(
  3345. "tvDefault.name" => $sortbyTV
  3346. ));
  3347. $criteria->leftJoin(\'modTemplateVarResource\', \'tvSort\', array(
  3348. "tvSort.contentid = modResource.id",
  3349. "tvSort.tmplvarid = tvDefault.id"
  3350. ));
  3351. if (empty($sortbyTVType)) $sortbyTVType = \'string\';
  3352. if ($modx->getOption(\'dbtype\') === \'mysql\') {
  3353. switch ($sortbyTVType) {
  3354. case \'integer\':
  3355. $criteria->select("CAST(IFNULL(tvSort.value, tvDefault.default_text) AS SIGNED INTEGER) AS sortTV");
  3356. break;
  3357. case \'decimal\':
  3358. $criteria->select("CAST(IFNULL(tvSort.value, tvDefault.default_text) AS DECIMAL) AS sortTV");
  3359. break;
  3360. case \'datetime\':
  3361. $criteria->select("CAST(IFNULL(tvSort.value, tvDefault.default_text) AS DATETIME) AS sortTV");
  3362. break;
  3363. case \'string\':
  3364. default:
  3365. $criteria->select("IFNULL(tvSort.value, tvDefault.default_text) AS sortTV");
  3366. break;
  3367. }
  3368. } elseif ($modx->getOption(\'dbtype\') === \'sqlsrv\') {
  3369. switch ($sortbyTVType) {
  3370. case \'integer\':
  3371. $criteria->select("CAST(ISNULL(tvSort.value, tvDefault.default_text) AS BIGINT) AS sortTV");
  3372. break;
  3373. case \'decimal\':
  3374. $criteria->select("CAST(ISNULL(tvSort.value, tvDefault.default_text) AS DECIMAL) AS sortTV");
  3375. break;
  3376. case \'datetime\':
  3377. $criteria->select("CAST(ISNULL(tvSort.value, tvDefault.default_text) AS DATETIME) AS sortTV");
  3378. break;
  3379. case \'string\':
  3380. default:
  3381. $criteria->select("ISNULL(tvSort.value, tvDefault.default_text) AS sortTV");
  3382. break;
  3383. }
  3384. }
  3385. $criteria->sortby("sortTV", $sortdirTV);
  3386. }
  3387. if (!empty($sortby)) {
  3388. if (strpos($sortby, \'{\') === 0) {
  3389. $sorts = $modx->fromJSON($sortby);
  3390. } else {
  3391. $sorts = array($sortby => $sortdir);
  3392. }
  3393. if (is_array($sorts)) {
  3394. while (list($sort, $dir) = each($sorts)) {
  3395. if ($sortbyEscaped) $sort = $modx->escape($sort);
  3396. if (!empty($sortbyAlias)) $sort = $modx->escape($sortbyAlias) . ".{$sort}";
  3397. $criteria->sortby($sort, $dir);
  3398. }
  3399. }
  3400. }
  3401. if (!empty($limit)) $criteria->limit($limit, $offset);
  3402. if (!empty($debug)) {
  3403. $criteria->prepare();
  3404. $modx->log(modX::LOG_LEVEL_ERROR, $criteria->toSQL());
  3405. }
  3406. $collection = $modx->getCollection(\'modResource\', $criteria, $dbCacheFlag);
  3407. $idx = !empty($idx) || $idx === \'0\' ? (integer) $idx : 1;
  3408. $first = empty($first) && $first !== \'0\' ? 1 : (integer) $first;
  3409. $last = empty($last) ? (count($collection) + $idx - 1) : (integer) $last;
  3410. /* include parseTpl */
  3411. include_once $modx->getOption(\'getresources.core_path\',null,$modx->getOption(\'core_path\').\'components/getresources/\').\'include.parsetpl.php\';
  3412. $templateVars = array();
  3413. if (!empty($includeTVs) && !empty($includeTVList)) {
  3414. $templateVars = $modx->getCollection(\'modTemplateVar\', array(\'name:IN\' => $includeTVList));
  3415. }
  3416. /** @var modResource $resource */
  3417. foreach ($collection as $resourceId => $resource) {
  3418. $tvs = array();
  3419. if (!empty($includeTVs)) {
  3420. if (empty($includeTVList)) {
  3421. $templateVars = $resource->getMany(\'TemplateVars\');
  3422. }
  3423. /** @var modTemplateVar $templateVar */
  3424. foreach ($templateVars as $tvId => $templateVar) {
  3425. if (!empty($includeTVList) && !in_array($templateVar->get(\'name\'), $includeTVList)) continue;
  3426. if ($processTVs && (empty($processTVList) || in_array($templateVar->get(\'name\'), $processTVList))) {
  3427. $tvs[$tvPrefix . $templateVar->get(\'name\')] = $templateVar->renderOutput($resource->get(\'id\'));
  3428. } else {
  3429. $value = $templateVar->getValue($resource->get(\'id\'));
  3430. if ($prepareTVs && method_exists($templateVar, \'prepareOutput\') && (empty($prepareTVList) || in_array($templateVar->get(\'name\'), $prepareTVList))) {
  3431. $value = $templateVar->prepareOutput($value);
  3432. }
  3433. $tvs[$tvPrefix . $templateVar->get(\'name\')] = $value;
  3434. }
  3435. }
  3436. }
  3437. $odd = ($idx & 1);
  3438. $properties = array_merge(
  3439. $scriptProperties
  3440. ,array(
  3441. \'idx\' => $idx
  3442. ,\'first\' => $first
  3443. ,\'last\' => $last
  3444. ,\'odd\' => $odd
  3445. )
  3446. ,$includeContent ? $resource->toArray() : $resource->get($fields)
  3447. ,$tvs
  3448. );
  3449. $resourceTpl = false;
  3450. if ($idx == $first && !empty($tplFirst)) {
  3451. $resourceTpl = parseTpl($tplFirst, $properties);
  3452. }
  3453. if ($idx == $last && empty($resourceTpl) && !empty($tplLast)) {
  3454. $resourceTpl = parseTpl($tplLast, $properties);
  3455. }
  3456. $tplidx = \'tpl_\' . $idx;
  3457. if (empty($resourceTpl) && !empty($$tplidx)) {
  3458. $resourceTpl = parseTpl($$tplidx, $properties);
  3459. }
  3460. if ($idx > 1 && empty($resourceTpl)) {
  3461. $divisors = getDivisors($idx);
  3462. if (!empty($divisors)) {
  3463. foreach ($divisors as $divisor) {
  3464. $tplnth = \'tpl_n\' . $divisor;
  3465. if (!empty($$tplnth)) {
  3466. $resourceTpl = parseTpl($$tplnth, $properties);
  3467. if (!empty($resourceTpl)) {
  3468. break;
  3469. }
  3470. }
  3471. }
  3472. }
  3473. }
  3474. if ($odd && empty($resourceTpl) && !empty($tplOdd)) {
  3475. $resourceTpl = parseTpl($tplOdd, $properties);
  3476. }
  3477. if (!empty($tplCondition) && !empty($conditionalTpls) && empty($resourceTpl)) {
  3478. $conTpls = $modx->fromJSON($conditionalTpls);
  3479. $subject = $properties[$tplCondition];
  3480. $tplOperator = !empty($tplOperator) ? $tplOperator : \'=\';
  3481. $tplOperator = strtolower($tplOperator);
  3482. $tplCon = \'\';
  3483. foreach ($conTpls as $operand => $conditionalTpl) {
  3484. switch ($tplOperator) {
  3485. case \'!=\':
  3486. case \'neq\':
  3487. case \'not\':
  3488. case \'isnot\':
  3489. case \'isnt\':
  3490. case \'unequal\':
  3491. case \'notequal\':
  3492. $tplCon = (($subject != $operand) ? $conditionalTpl : $tplCon);
  3493. break;
  3494. case \'<\':
  3495. case \'lt\':
  3496. case \'less\':
  3497. case \'lessthan\':
  3498. $tplCon = (($subject < $operand) ? $conditionalTpl : $tplCon);
  3499. break;
  3500. case \'>\':
  3501. case \'gt\':
  3502. case \'greater\':
  3503. case \'greaterthan\':
  3504. $tplCon = (($subject > $operand) ? $conditionalTpl : $tplCon);
  3505. break;
  3506. case \'<=\':
  3507. case \'lte\':
  3508. case \'lessthanequals\':
  3509. case \'lessthanorequalto\':
  3510. $tplCon = (($subject <= $operand) ? $conditionalTpl : $tplCon);
  3511. break;
  3512. case \'>=\':
  3513. case \'gte\':
  3514. case \'greaterthanequals\':
  3515. case \'greaterthanequalto\':
  3516. $tplCon = (($subject >= $operand) ? $conditionalTpl : $tplCon);
  3517. break;
  3518. case \'isempty\':
  3519. case \'empty\':
  3520. $tplCon = empty($subject) ? $conditionalTpl : $tplCon;
  3521. break;
  3522. case \'!empty\':
  3523. case \'notempty\':
  3524. case \'isnotempty\':
  3525. $tplCon = !empty($subject) && $subject != \'\' ? $conditionalTpl : $tplCon;
  3526. break;
  3527. case \'isnull\':
  3528. case \'null\':
  3529. $tplCon = $subject == null || strtolower($subject) == \'null\' ? $conditionalTpl : $tplCon;
  3530. break;
  3531. case \'inarray\':
  3532. case \'in_array\':
  3533. case \'ia\':
  3534. $operand = explode(\',\', $operand);
  3535. $tplCon = in_array($subject, $operand) ? $conditionalTpl : $tplCon;
  3536. break;
  3537. case \'between\':
  3538. case \'range\':
  3539. case \'>=<\':
  3540. case \'><\':
  3541. $operand = explode(\',\', $operand);
  3542. $tplCon = ($subject >= min($operand) && $subject <= max($operand)) ? $conditionalTpl : $tplCon;
  3543. break;
  3544. case \'==\':
  3545. case \'=\':
  3546. case \'eq\':
  3547. case \'is\':
  3548. case \'equal\':
  3549. case \'equals\':
  3550. case \'equalto\':
  3551. default:
  3552. $tplCon = (($subject == $operand) ? $conditionalTpl : $tplCon);
  3553. break;
  3554. }
  3555. }
  3556. if (!empty($tplCon)) {
  3557. $resourceTpl = parseTpl($tplCon, $properties);
  3558. }
  3559. }
  3560. if (!empty($tpl) && empty($resourceTpl)) {
  3561. $resourceTpl = parseTpl($tpl, $properties);
  3562. }
  3563. if ($resourceTpl === false && !empty($debug)) {
  3564. $chunk = $modx->newObject(\'modChunk\');
  3565. $chunk->setCacheable(false);
  3566. $output[]= $chunk->process(array(), \'<pre>\' . print_r($properties, true) .\'</pre>\');
  3567. } else {
  3568. $output[]= $resourceTpl;
  3569. }
  3570. $idx++;
  3571. }
  3572. /* output */
  3573. $toSeparatePlaceholders = $modx->getOption(\'toSeparatePlaceholders\', $scriptProperties, false);
  3574. if (!empty($toSeparatePlaceholders)) {
  3575. $modx->setPlaceholders($output, $toSeparatePlaceholders);
  3576. return \'\';
  3577. }
  3578. $output = implode($outputSeparator, $output);
  3579. $tplWrapper = $modx->getOption(\'tplWrapper\', $scriptProperties, false);
  3580. $wrapIfEmpty = $modx->getOption(\'wrapIfEmpty\', $scriptProperties, false);
  3581. if (!empty($tplWrapper) && ($wrapIfEmpty || !empty($output))) {
  3582. $output = parseTpl($tplWrapper, array_merge($scriptProperties, array(\'output\' => $output)));
  3583. }
  3584. $toPlaceholder = $modx->getOption(\'toPlaceholder\', $scriptProperties, false);
  3585. if (!empty($toPlaceholder)) {
  3586. $modx->setPlaceholder($toPlaceholder, $output);
  3587. return \'\';
  3588. }
  3589. return $output;',
  3590. ),
  3591. 'policies' =>
  3592. array (
  3593. 'web' =>
  3594. array (
  3595. ),
  3596. ),
  3597. 'source' =>
  3598. array (
  3599. ),
  3600. ),
  3601. 'FormIt' =>
  3602. array (
  3603. 'fields' =>
  3604. array (
  3605. 'id' => 16,
  3606. 'source' => 0,
  3607. 'property_preprocess' => false,
  3608. 'name' => 'FormIt',
  3609. 'description' => 'A dynamic form processing snippet.',
  3610. 'editor_type' => 0,
  3611. 'category' => 8,
  3612. 'cache_type' => 0,
  3613. 'snippet' => '/**
  3614. * FormIt
  3615. *
  3616. * Copyright 2009-2012 by Shaun McCormick <shaun@modx.com>
  3617. *
  3618. * FormIt is free software; you can redistribute it and/or modify it
  3619. * under the terms of the GNU General Public License as published by the Free
  3620. * Software Foundation; either version 2 of the License, or (at your option) any
  3621. * later version.
  3622. *
  3623. * FormIt is distributed in the hope that it will be useful, but WITHOUT ANY
  3624. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  3625. * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  3626. *
  3627. * You should have received a copy of the GNU General Public License along with
  3628. * FormIt; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
  3629. * Suite 330, Boston, MA 02111-1307 USA
  3630. *
  3631. * @package formit
  3632. */
  3633. /**
  3634. * FormIt
  3635. *
  3636. * A dynamic form processing Snippet for MODx Revolution.
  3637. *
  3638. * @var modX $modx
  3639. * @var array $scriptProperties
  3640. *
  3641. * @package formit
  3642. */
  3643. $modelPath = $modx->getOption(
  3644. \'formit.core_path\',
  3645. null,
  3646. $modx->getOption(\'core_path\', null, MODX_CORE_PATH) . \'components/formit/\'
  3647. ) . \'model/formit/\';
  3648. $modx->loadClass(\'FormIt\', $modelPath, true, true);
  3649. $fi = new FormIt($modx, $scriptProperties);
  3650. $fi->initialize($modx->context->get(\'key\'));
  3651. $fi->loadRequest();
  3652. $fields = $fi->request->prepare();
  3653. return $fi->request->handle($fields);',
  3654. 'locked' => false,
  3655. 'properties' =>
  3656. array (
  3657. 'hooks' =>
  3658. array (
  3659. 'name' => 'hooks',
  3660. 'desc' => 'prop_formit.hooks_desc',
  3661. 'type' => 'textfield',
  3662. 'options' => '',
  3663. 'value' => '',
  3664. 'lexicon' => 'formit:properties',
  3665. 'area' => '',
  3666. 'desc_trans' => 'What scripts to fire, if any, after the form passes validation. This can be a comma-separated list of hooks, and if the first fails, the proceeding ones will not fire. A hook can also be a Snippet name that will execute that Snippet.',
  3667. 'area_trans' => '',
  3668. ),
  3669. 'preHooks' =>
  3670. array (
  3671. 'name' => 'preHooks',
  3672. 'desc' => 'prop_formit.prehooks_desc',
  3673. 'type' => 'textfield',
  3674. 'options' => '',
  3675. 'value' => '',
  3676. 'lexicon' => 'formit:properties',
  3677. 'area' => '',
  3678. 'desc_trans' => 'What scripts to fire, if any, once the form loads. You can pre-set form fields via $scriptProperties[`hook`]->fields[`fieldname`]. This can be a comma-separated list of hooks, and if the first fails, the proceeding ones will not fire. A hook can also be a Snippet name that will execute that Snippet.',
  3679. 'area_trans' => '',
  3680. ),
  3681. 'submitVar' =>
  3682. array (
  3683. 'name' => 'submitVar',
  3684. 'desc' => 'prop_formit.submitvar_desc',
  3685. 'type' => 'textfield',
  3686. 'options' => '',
  3687. 'value' => '',
  3688. 'lexicon' => 'formit:properties',
  3689. 'area' => '',
  3690. 'desc_trans' => 'If set, will not begin form processing if this POST variable is not passed.',
  3691. 'area_trans' => '',
  3692. ),
  3693. 'validate' =>
  3694. array (
  3695. 'name' => 'validate',
  3696. 'desc' => 'prop_formit.validate_desc',
  3697. 'type' => 'textfield',
  3698. 'options' => '',
  3699. 'value' => '',
  3700. 'lexicon' => 'formit:properties',
  3701. 'area' => '',
  3702. 'desc_trans' => 'A comma-separated list of fields to validate, with each field name as name:validator (eg: username:required,email:required). Validators can also be chained, like email:email:required. This property can be specified on multiple lines.',
  3703. 'area_trans' => '',
  3704. ),
  3705. 'errTpl' =>
  3706. array (
  3707. 'name' => 'errTpl',
  3708. 'desc' => 'prop_formit.errtpl_desc',
  3709. 'type' => 'textfield',
  3710. 'options' => '',
  3711. 'value' => '<span class="error">[[+error]]</span>',
  3712. 'lexicon' => 'formit:properties',
  3713. 'area' => '',
  3714. 'desc_trans' => 'The wrapper template for error messages.',
  3715. 'area_trans' => '',
  3716. ),
  3717. 'validationErrorMessage' =>
  3718. array (
  3719. 'name' => 'validationErrorMessage',
  3720. 'desc' => 'prop_formit.validationerrormessage_desc',
  3721. 'type' => 'textfield',
  3722. 'options' => '',
  3723. 'value' => '<p class="error">A form validation error occurred. Please check the values you have entered.</p>',
  3724. 'lexicon' => 'formit:properties',
  3725. 'area' => '',
  3726. 'desc_trans' => 'A general error message to set to a placeholder if validation fails. Can contain [[+errors]] if you want to display a list of all errors at the top.',
  3727. 'area_trans' => '',
  3728. ),
  3729. 'validationErrorBulkTpl' =>
  3730. array (
  3731. 'name' => 'validationErrorBulkTpl',
  3732. 'desc' => 'prop_formit.validationerrorbulktpl_desc',
  3733. 'type' => 'textfield',
  3734. 'options' => '',
  3735. 'value' => '<li>[[+error]]</li>',
  3736. 'lexicon' => 'formit:properties',
  3737. 'area' => '',
  3738. 'desc_trans' => 'HTML tpl that is used for each individual error in the generic validation error message value.',
  3739. 'area_trans' => '',
  3740. ),
  3741. 'trimValuesBeforeValidation' =>
  3742. array (
  3743. 'name' => 'trimValuesBeforeValidation',
  3744. 'desc' => 'prop_formit.trimvaluesdeforevalidation_desc',
  3745. 'type' => 'combo-boolean',
  3746. 'options' => '',
  3747. 'value' => true,
  3748. 'lexicon' => 'formit:properties',
  3749. 'area' => '',
  3750. 'desc_trans' => 'Whether or not to trim spaces from the beginning and end of values before attempting validation. Defaults to true.',
  3751. 'area_trans' => '',
  3752. ),
  3753. 'customValidators' =>
  3754. array (
  3755. 'name' => 'customValidators',
  3756. 'desc' => 'prop_formit.customvalidators_desc',
  3757. 'type' => 'textfield',
  3758. 'options' => '',
  3759. 'value' => '',
  3760. 'lexicon' => 'formit:properties',
  3761. 'area' => '',
  3762. 'desc_trans' => 'A comma-separated list of custom validator names (snippets) you plan to use in this form. They must be explicitly stated here, or they will not be run.',
  3763. 'area_trans' => '',
  3764. ),
  3765. 'clearFieldsOnSuccess' =>
  3766. array (
  3767. 'name' => 'clearFieldsOnSuccess',
  3768. 'desc' => 'prop_formit.clearfieldsonsuccess_desc',
  3769. 'type' => 'combo-boolean',
  3770. 'options' => '',
  3771. 'value' => true,
  3772. 'lexicon' => 'formit:properties',
  3773. 'area' => '',
  3774. 'desc_trans' => 'If true, will clear the fields on a successful form submission that does not redirect.',
  3775. 'area_trans' => '',
  3776. ),
  3777. 'successMessage' =>
  3778. array (
  3779. 'name' => 'successMessage',
  3780. 'desc' => 'prop_formit.successmessage_desc',
  3781. 'type' => 'textfield',
  3782. 'options' => '',
  3783. 'value' => '',
  3784. 'lexicon' => 'formit:properties',
  3785. 'area' => '',
  3786. 'desc_trans' => 'If set, will set this a placeholder with the name of the value of the property &successMessagePlaceholder, which defaults to `fi.successMessage`.',
  3787. 'area_trans' => '',
  3788. ),
  3789. 'successMessagePlaceholder' =>
  3790. array (
  3791. 'name' => 'successMessagePlaceholder',
  3792. 'desc' => 'prop_formit.successmessageplaceholder_desc',
  3793. 'type' => 'textfield',
  3794. 'options' => '',
  3795. 'value' => 'fi.successMessage',
  3796. 'lexicon' => 'formit:properties',
  3797. 'area' => '',
  3798. 'desc_trans' => 'The placeholder to set the success message to.',
  3799. 'area_trans' => '',
  3800. ),
  3801. 'store' =>
  3802. array (
  3803. 'name' => 'store',
  3804. 'desc' => 'prop_formit.store_desc',
  3805. 'type' => 'combo-boolean',
  3806. 'options' => '',
  3807. 'value' => false,
  3808. 'lexicon' => 'formit:properties',
  3809. 'area' => '',
  3810. 'desc_trans' => 'If true, will store the data in the cache for retrieval using the FormItRetriever snippet.',
  3811. 'area_trans' => '',
  3812. ),
  3813. 'placeholderPrefix' =>
  3814. array (
  3815. 'name' => 'placeholderPrefix',
  3816. 'desc' => 'prop_formit.placeholderprefix_desc',
  3817. 'type' => 'textfield',
  3818. 'options' => '',
  3819. 'value' => 'fi.',
  3820. 'lexicon' => 'formit:properties',
  3821. 'area' => '',
  3822. 'desc_trans' => 'The prefix to use for all placeholders set by FormIt for fields. Defaults to `fi.`',
  3823. 'area_trans' => '',
  3824. ),
  3825. 'storeTime' =>
  3826. array (
  3827. 'name' => 'storeTime',
  3828. 'desc' => 'prop_formit.storetime_desc',
  3829. 'type' => 'textfield',
  3830. 'options' => '',
  3831. 'value' => '300',
  3832. 'lexicon' => 'formit:properties',
  3833. 'area' => '',
  3834. 'desc_trans' => 'If `store` is set to true, this specifies the number of seconds to store the data from the form submission. Defaults to five minutes.',
  3835. 'area_trans' => '',
  3836. ),
  3837. 'storeLocation' =>
  3838. array (
  3839. 'name' => 'storeLocation',
  3840. 'desc' => 'prop_formit.storelocation_desc',
  3841. 'type' => 'list',
  3842. 'options' =>
  3843. array (
  3844. 0 =>
  3845. array (
  3846. 'value' => 'cache',
  3847. 'text' => 'formit.opt_cache',
  3848. 'name' => 'MODX Cache',
  3849. ),
  3850. 1 =>
  3851. array (
  3852. 'value' => 'session',
  3853. 'text' => 'formit.opt_session',
  3854. 'name' => 'Session',
  3855. ),
  3856. ),
  3857. 'value' => 'cache',
  3858. 'lexicon' => 'formit:properties',
  3859. 'area' => '',
  3860. 'desc_trans' => 'If `store` is set to true, this specifies the cache location of the data from the form submission. Defaults to MODX cache.',
  3861. 'area_trans' => '',
  3862. ),
  3863. 'allowFiles' =>
  3864. array (
  3865. 'name' => 'allowFiles',
  3866. 'desc' => 'prop_formit.allowfiles_desc',
  3867. 'type' => 'combo-boolean',
  3868. 'options' => '',
  3869. 'value' => true,
  3870. 'lexicon' => 'formit:properties',
  3871. 'area' => '',
  3872. 'desc_trans' => 'If set to 0, will prevent files from being submitted on the form.',
  3873. 'area_trans' => '',
  3874. ),
  3875. 'spamEmailFields' =>
  3876. array (
  3877. 'name' => 'spamEmailFields',
  3878. 'desc' => 'prop_formit.spamemailfields_desc',
  3879. 'type' => 'textfield',
  3880. 'options' => '',
  3881. 'value' => 'email',
  3882. 'lexicon' => 'formit:properties',
  3883. 'area' => '',
  3884. 'desc_trans' => 'If `spam` is set as a hook, a comma-separated list of fields containing emails to check spam against.',
  3885. 'area_trans' => '',
  3886. ),
  3887. 'spamCheckIp' =>
  3888. array (
  3889. 'name' => 'spamCheckIp',
  3890. 'desc' => 'prop_formit.spamcheckip_desc',
  3891. 'type' => 'combo-boolean',
  3892. 'options' => '',
  3893. 'value' => false,
  3894. 'lexicon' => 'formit:properties',
  3895. 'area' => '',
  3896. 'desc_trans' => 'If `spam` is set as a hook, and this is true, will check the IP as well.',
  3897. 'area_trans' => '',
  3898. ),
  3899. 'recaptchaJs' =>
  3900. array (
  3901. 'name' => 'recaptchaJs',
  3902. 'desc' => 'prop_formit.recaptchajs_desc',
  3903. 'type' => 'textfield',
  3904. 'options' => '',
  3905. 'value' => '{}',
  3906. 'lexicon' => 'formit:properties',
  3907. 'area' => '',
  3908. 'desc_trans' => 'If `recaptcha` is set as a hook, this can be a JSON object that will be set to the JS RecaptchaOptions variable, which configures options for reCaptcha.',
  3909. 'area_trans' => '',
  3910. ),
  3911. 'recaptchaTheme' =>
  3912. array (
  3913. 'name' => 'recaptchaTheme',
  3914. 'desc' => 'prop_formit.recaptchatheme_desc',
  3915. 'type' => 'list',
  3916. 'options' =>
  3917. array (
  3918. 0 =>
  3919. array (
  3920. 'value' => 'red',
  3921. 'text' => 'formit.opt_red',
  3922. 'name' => 'Red',
  3923. ),
  3924. 1 =>
  3925. array (
  3926. 'value' => 'white',
  3927. 'text' => 'formit.opt_white',
  3928. 'name' => 'White',
  3929. ),
  3930. 2 =>
  3931. array (
  3932. 'value' => 'clean',
  3933. 'text' => 'formit.opt_clean',
  3934. 'name' => 'Clean',
  3935. ),
  3936. 3 =>
  3937. array (
  3938. 'value' => 'blackglass',
  3939. 'text' => 'formit.opt_blackglass',
  3940. 'name' => 'Black Glass',
  3941. ),
  3942. ),
  3943. 'value' => 'clean',
  3944. 'lexicon' => 'formit:properties',
  3945. 'area' => '',
  3946. 'desc_trans' => 'If `recaptcha` is set as a hook, this will select a theme for the reCaptcha widget.',
  3947. 'area_trans' => '',
  3948. ),
  3949. 'redirectTo' =>
  3950. array (
  3951. 'name' => 'redirectTo',
  3952. 'desc' => 'prop_formit.redirectto_desc',
  3953. 'type' => 'textfield',
  3954. 'options' => '',
  3955. 'value' => '',
  3956. 'lexicon' => 'formit:properties',
  3957. 'area' => '',
  3958. 'desc_trans' => 'If `redirect` is set as a hook, this must specify the Resource ID to redirect to.',
  3959. 'area_trans' => '',
  3960. ),
  3961. 'redirectParams' =>
  3962. array (
  3963. 'name' => 'redirectParams',
  3964. 'desc' => 'prop_formit.redirectparams_desc',
  3965. 'type' => 'textfield',
  3966. 'options' => '',
  3967. 'value' => '',
  3968. 'lexicon' => 'formit:properties',
  3969. 'area' => '',
  3970. 'desc_trans' => 'A JSON array of parameters to pass to the redirect hook that will be passed when redirecting.',
  3971. 'area_trans' => '',
  3972. ),
  3973. 'emailTo' =>
  3974. array (
  3975. 'name' => 'emailTo',
  3976. 'desc' => 'prop_formit.emailto_desc',
  3977. 'type' => 'textfield',
  3978. 'options' => '',
  3979. 'value' => '',
  3980. 'lexicon' => 'formit:properties',
  3981. 'area' => '',
  3982. 'desc_trans' => 'If `email` is set as a hook, then this specifies the email(s) to send the email to. Can be a comma-separated list of email addresses.',
  3983. 'area_trans' => '',
  3984. ),
  3985. 'emailToName' =>
  3986. array (
  3987. 'name' => 'emailToName',
  3988. 'desc' => 'prop_formit.emailtoname_desc',
  3989. 'type' => 'textfield',
  3990. 'options' => '',
  3991. 'value' => '',
  3992. 'lexicon' => 'formit:properties',
  3993. 'area' => '',
  3994. 'desc_trans' => 'Optional. If `email` is set as a hook, then this must be a parallel list of comma-separated names for the email addresses specified in the `emailTo` property.',
  3995. 'area_trans' => '',
  3996. ),
  3997. 'emailFrom' =>
  3998. array (
  3999. 'name' => 'emailFrom',
  4000. 'desc' => 'prop_formit.emailfrom_desc',
  4001. 'type' => 'textfield',
  4002. 'options' => '',
  4003. 'value' => '',
  4004. 'lexicon' => 'formit:properties',
  4005. 'area' => '',
  4006. 'desc_trans' => 'Optional. If `email` is set as a hook, and this is set, will specify the From: address for the email. If not set, will first look for an `email` form field. If none is found, will default to the `emailsender` system setting.',
  4007. 'area_trans' => '',
  4008. ),
  4009. 'emailFromName' =>
  4010. array (
  4011. 'name' => 'emailFromName',
  4012. 'desc' => 'prop_formit.emailfromname_desc',
  4013. 'type' => 'textfield',
  4014. 'options' => '',
  4015. 'value' => '',
  4016. 'lexicon' => 'formit:properties',
  4017. 'area' => '',
  4018. 'desc_trans' => 'Optional. If `email` is set as a hook, and this is set, will specify the From: name for the email.',
  4019. 'area_trans' => '',
  4020. ),
  4021. 'emailReplyTo' =>
  4022. array (
  4023. 'name' => 'emailReplyTo',
  4024. 'desc' => 'prop_formit.emailreplyto_desc',
  4025. 'type' => 'textfield',
  4026. 'options' => '',
  4027. 'value' => '',
  4028. 'lexicon' => 'formit:properties',
  4029. 'area' => '',
  4030. 'desc_trans' => 'Optional. If `email` is set as a hook, and this is set, will specify the Reply-To: address for the email.',
  4031. 'area_trans' => '',
  4032. ),
  4033. 'emailReplyToName' =>
  4034. array (
  4035. 'name' => 'emailReplyToName',
  4036. 'desc' => 'prop_formit.emailreplytoname_desc',
  4037. 'type' => 'textfield',
  4038. 'options' => '',
  4039. 'value' => '',
  4040. 'lexicon' => 'formit:properties',
  4041. 'area' => '',
  4042. 'desc_trans' => 'Optional. If `email` is set as a hook, and this is set, will specify the Reply-To: name for the email.',
  4043. 'area_trans' => '',
  4044. ),
  4045. 'emailCC' =>
  4046. array (
  4047. 'name' => 'emailCC',
  4048. 'desc' => 'prop_formit.emailcc_desc',
  4049. 'type' => 'textfield',
  4050. 'options' => '',
  4051. 'value' => '',
  4052. 'lexicon' => 'formit:properties',
  4053. 'area' => '',
  4054. 'desc_trans' => 'If `email` is set as a hook, then this specifies the email(s) to send the email to as a CC. Can be a comma-separated list of email addresses.',
  4055. 'area_trans' => '',
  4056. ),
  4057. 'emailCCName' =>
  4058. array (
  4059. 'name' => 'emailCCName',
  4060. 'desc' => 'prop_formit.emailccname_desc',
  4061. 'type' => 'textfield',
  4062. 'options' => '',
  4063. 'value' => '',
  4064. 'lexicon' => 'formit:properties',
  4065. 'area' => '',
  4066. 'desc_trans' => 'Optional. If `email` is set as a hook, then this must be a parallel list of comma-separated names for the email addresses specified in the `emailCC` property.',
  4067. 'area_trans' => '',
  4068. ),
  4069. 'emailBCC' =>
  4070. array (
  4071. 'name' => 'emailBCC',
  4072. 'desc' => 'prop_formit.emailbcc_desc',
  4073. 'type' => 'textfield',
  4074. 'options' => '',
  4075. 'value' => '',
  4076. 'lexicon' => 'formit:properties',
  4077. 'area' => '',
  4078. 'desc_trans' => 'If `email` is set as a hook, then this specifies the email(s) to send the email to as a BCC. Can be a comma-separated list of email addresses.',
  4079. 'area_trans' => '',
  4080. ),
  4081. 'emailBCCName' =>
  4082. array (
  4083. 'name' => 'emailBCCName',
  4084. 'desc' => 'prop_formit.emailbccname_desc',
  4085. 'type' => 'textfield',
  4086. 'options' => '',
  4087. 'value' => '',
  4088. 'lexicon' => 'formit:properties',
  4089. 'area' => '',
  4090. 'desc_trans' => 'Optional. If `email` is set as a hook, then this must be a parallel list of comma-separated names for the email addresses specified in the `emailBCC` property.',
  4091. 'area_trans' => '',
  4092. ),
  4093. 'emailReturnPath' =>
  4094. array (
  4095. 'name' => 'emailReturnPath',
  4096. 'desc' => 'prop_formit.emailreturnpath_desc',
  4097. 'type' => 'textfield',
  4098. 'options' => '',
  4099. 'value' => '',
  4100. 'lexicon' => 'formit:properties',
  4101. 'area' => '',
  4102. 'desc_trans' => 'Optional. If `email` is set as a hook, and this is set, will specify the Return-path: address for the email. If not set, will take the value of `emailFrom` property.',
  4103. 'area_trans' => '',
  4104. ),
  4105. 'emailSubject' =>
  4106. array (
  4107. 'name' => 'emailSubject',
  4108. 'desc' => 'prop_formit.emailsubject_desc',
  4109. 'type' => 'textfield',
  4110. 'options' => '',
  4111. 'value' => '',
  4112. 'lexicon' => 'formit:properties',
  4113. 'area' => '',
  4114. 'desc_trans' => 'If `email` is set as a hook, this is required as a subject line for the email.',
  4115. 'area_trans' => '',
  4116. ),
  4117. 'emailUseFieldForSubject' =>
  4118. array (
  4119. 'name' => 'emailUseFieldForSubject',
  4120. 'desc' => 'prop_formit.emailusefieldforsubject_desc',
  4121. 'type' => 'textfield',
  4122. 'options' => '',
  4123. 'value' => '',
  4124. 'lexicon' => 'formit:properties',
  4125. 'area' => '',
  4126. 'desc_trans' => 'If the field `subject` is passed into the form, if this is true, it will use the field content for the subject line of the email.',
  4127. 'area_trans' => '',
  4128. ),
  4129. 'emailHtml' =>
  4130. array (
  4131. 'name' => 'emailHtml',
  4132. 'desc' => 'prop_formit.emailhtml_desc',
  4133. 'type' => 'combo-boolean',
  4134. 'options' => '',
  4135. 'value' => true,
  4136. 'lexicon' => 'formit:properties',
  4137. 'area' => '',
  4138. 'desc_trans' => 'Optional. If `email` is set as a hook, this toggles HTML emails or not. Defaults to true.',
  4139. 'area_trans' => '',
  4140. ),
  4141. 'emailConvertNewlines' =>
  4142. array (
  4143. 'name' => 'emailConvertNewlines',
  4144. 'desc' => 'prop_formit.emailconvertnewlines_desc',
  4145. 'type' => 'combo-boolean',
  4146. 'options' => '',
  4147. 'value' => false,
  4148. 'lexicon' => 'formit:properties',
  4149. 'area' => '',
  4150. 'desc_trans' => 'If true and emailHtml is set to 1, will convert newlines to BR tags in the email.',
  4151. 'area_trans' => '',
  4152. ),
  4153. 'emailMultiWrapper' =>
  4154. array (
  4155. 'name' => 'emailMultiWrapper',
  4156. 'desc' => 'prop_formit.emailmultiwrapper_desc',
  4157. 'type' => 'textfield',
  4158. 'options' => '',
  4159. 'value' => '[[+value]]',
  4160. 'lexicon' => 'formit:properties',
  4161. 'area' => '',
  4162. 'desc_trans' => 'Will wrap each item in a collection of fields sent via checkboxes/multi-selects. Defaults to just the value.',
  4163. 'area_trans' => '',
  4164. ),
  4165. 'emailMultiSeparator' =>
  4166. array (
  4167. 'name' => 'emailMultiSeparator',
  4168. 'desc' => 'prop_formit.emailmultiseparator_desc',
  4169. 'type' => 'textfield',
  4170. 'options' => '',
  4171. 'value' => '',
  4172. 'lexicon' => 'formit:properties',
  4173. 'area' => '',
  4174. 'desc_trans' => 'The default separator for collections of items sent through checkboxes/multi-selects. Defaults to a newline.',
  4175. 'area_trans' => '',
  4176. ),
  4177. 'fiarTpl' =>
  4178. array (
  4179. 'name' => 'fiarTpl',
  4180. 'desc' => 'prop_formit.fiartpl_desc',
  4181. 'type' => 'textfield',
  4182. 'options' => '',
  4183. 'value' => '',
  4184. 'lexicon' => 'formit:properties',
  4185. 'area' => '',
  4186. 'desc_trans' => 'prop_formit.fiartpl_desc',
  4187. 'area_trans' => '',
  4188. ),
  4189. 'fiarToField' =>
  4190. array (
  4191. 'name' => 'fiarToField',
  4192. 'desc' => 'prop_formit.fiartofield_desc',
  4193. 'type' => 'textfield',
  4194. 'options' => '',
  4195. 'value' => 'email',
  4196. 'lexicon' => 'formit:properties',
  4197. 'area' => '',
  4198. 'desc_trans' => 'prop_formit.fiartofield_desc',
  4199. 'area_trans' => '',
  4200. ),
  4201. 'fiarSubject' =>
  4202. array (
  4203. 'name' => 'fiarSubject',
  4204. 'desc' => 'prop_formit.fiarsubject_desc',
  4205. 'type' => 'textfield',
  4206. 'options' => '',
  4207. 'value' => '[[++site_name]] Auto-Responder',
  4208. 'lexicon' => 'formit:properties',
  4209. 'area' => '',
  4210. 'desc_trans' => 'prop_formit.fiarsubject_desc',
  4211. 'area_trans' => '',
  4212. ),
  4213. 'fiarFrom' =>
  4214. array (
  4215. 'name' => 'fiarFrom',
  4216. 'desc' => 'prop_formit.fiarfrom_desc',
  4217. 'type' => 'textfield',
  4218. 'options' => '',
  4219. 'value' => '',
  4220. 'lexicon' => 'formit:properties',
  4221. 'area' => '',
  4222. 'desc_trans' => 'prop_formit.fiarfrom_desc',
  4223. 'area_trans' => '',
  4224. ),
  4225. 'fiarFromName' =>
  4226. array (
  4227. 'name' => 'fiarFromName',
  4228. 'desc' => 'prop_formit.fiarfromname_desc',
  4229. 'type' => 'textfield',
  4230. 'options' => '',
  4231. 'value' => '',
  4232. 'lexicon' => 'formit:properties',
  4233. 'area' => '',
  4234. 'desc_trans' => 'prop_formit.fiarfromname_desc',
  4235. 'area_trans' => '',
  4236. ),
  4237. 'fiarReplyTo' =>
  4238. array (
  4239. 'name' => 'fiarReplyTo',
  4240. 'desc' => 'prop_formit.fiarreplyto_desc',
  4241. 'type' => 'textfield',
  4242. 'options' => '',
  4243. 'value' => '',
  4244. 'lexicon' => 'formit:properties',
  4245. 'area' => '',
  4246. 'desc_trans' => 'prop_formit.fiarreplyto_desc',
  4247. 'area_trans' => '',
  4248. ),
  4249. 'fiarReplyToName' =>
  4250. array (
  4251. 'name' => 'fiarReplyToName',
  4252. 'desc' => 'prop_formit.fiarreplytoname_desc',
  4253. 'type' => 'textfield',
  4254. 'options' => '',
  4255. 'value' => '',
  4256. 'lexicon' => 'formit:properties',
  4257. 'area' => '',
  4258. 'desc_trans' => 'prop_formit.fiarreplytoname_desc',
  4259. 'area_trans' => '',
  4260. ),
  4261. 'fiarCC' =>
  4262. array (
  4263. 'name' => 'fiarCC',
  4264. 'desc' => 'prop_formit.fiarcc_desc',
  4265. 'type' => 'textfield',
  4266. 'options' => '',
  4267. 'value' => '',
  4268. 'lexicon' => 'formit:properties',
  4269. 'area' => '',
  4270. 'desc_trans' => 'prop_formit.fiarcc_desc',
  4271. 'area_trans' => '',
  4272. ),
  4273. 'fiarCCName' =>
  4274. array (
  4275. 'name' => 'fiarCCName',
  4276. 'desc' => 'prop_fiar.fiarccname_desc',
  4277. 'type' => 'textfield',
  4278. 'options' => '',
  4279. 'value' => '',
  4280. 'lexicon' => 'formit:properties',
  4281. 'area' => '',
  4282. 'desc_trans' => 'Optional. If `FormItAutoResponder` is set as a hook, then this must be a parallel list of comma-separated names for the email addresses specified in the `emailCC` property.',
  4283. 'area_trans' => '',
  4284. ),
  4285. 'fiarBCC' =>
  4286. array (
  4287. 'name' => 'fiarBCC',
  4288. 'desc' => 'prop_formit.fiarbcc_desc',
  4289. 'type' => 'textfield',
  4290. 'options' => '',
  4291. 'value' => '',
  4292. 'lexicon' => 'formit:properties',
  4293. 'area' => '',
  4294. 'desc_trans' => 'prop_formit.fiarbcc_desc',
  4295. 'area_trans' => '',
  4296. ),
  4297. 'fiarBCCName' =>
  4298. array (
  4299. 'name' => 'fiarBCCName',
  4300. 'desc' => 'prop_formit.fiarbccname_desc',
  4301. 'type' => 'textfield',
  4302. 'options' => '',
  4303. 'value' => '',
  4304. 'lexicon' => 'formit:properties',
  4305. 'area' => '',
  4306. 'desc_trans' => 'prop_formit.fiarbccname_desc',
  4307. 'area_trans' => '',
  4308. ),
  4309. 'fiarHtml' =>
  4310. array (
  4311. 'name' => 'fiarHtml',
  4312. 'desc' => 'prop_formit.fiarhtml_desc',
  4313. 'type' => 'combo-boolean',
  4314. 'options' => '',
  4315. 'value' => true,
  4316. 'lexicon' => 'formit:properties',
  4317. 'area' => '',
  4318. 'desc_trans' => 'prop_formit.fiarhtml_desc',
  4319. 'area_trans' => '',
  4320. ),
  4321. 'mathMinRange' =>
  4322. array (
  4323. 'name' => 'mathMinRange',
  4324. 'desc' => 'prop_formit.mathminrange_desc',
  4325. 'type' => 'textfield',
  4326. 'options' => '',
  4327. 'value' => '10',
  4328. 'lexicon' => 'formit:properties',
  4329. 'area' => '',
  4330. 'desc_trans' => 'prop_formit.mathminrange_desc',
  4331. 'area_trans' => '',
  4332. ),
  4333. 'mathMaxRange' =>
  4334. array (
  4335. 'name' => 'mathMaxRange',
  4336. 'desc' => 'prop_formit.mathmaxrange_desc',
  4337. 'type' => 'textfield',
  4338. 'options' => '',
  4339. 'value' => '100',
  4340. 'lexicon' => 'formit:properties',
  4341. 'area' => '',
  4342. 'desc_trans' => 'prop_formit.mathmaxrange_desc',
  4343. 'area_trans' => '',
  4344. ),
  4345. 'mathField' =>
  4346. array (
  4347. 'name' => 'mathField',
  4348. 'desc' => 'prop_formit.mathfield_desc',
  4349. 'type' => 'textfield',
  4350. 'options' => '',
  4351. 'value' => 'math',
  4352. 'lexicon' => 'formit:properties',
  4353. 'area' => '',
  4354. 'desc_trans' => 'prop_formit.mathfield_desc',
  4355. 'area_trans' => '',
  4356. ),
  4357. 'mathOp1Field' =>
  4358. array (
  4359. 'name' => 'mathOp1Field',
  4360. 'desc' => 'prop_formit.mathop1field_desc',
  4361. 'type' => 'textfield',
  4362. 'options' => '',
  4363. 'value' => 'op1',
  4364. 'lexicon' => 'formit:properties',
  4365. 'area' => '',
  4366. 'desc_trans' => 'prop_formit.mathop1field_desc',
  4367. 'area_trans' => '',
  4368. ),
  4369. 'mathOp2Field' =>
  4370. array (
  4371. 'name' => 'mathOp2Field',
  4372. 'desc' => 'prop_formit.mathop2field_desc',
  4373. 'type' => 'textfield',
  4374. 'options' => '',
  4375. 'value' => 'op2',
  4376. 'lexicon' => 'formit:properties',
  4377. 'area' => '',
  4378. 'desc_trans' => 'prop_formit.mathop2field_desc',
  4379. 'area_trans' => '',
  4380. ),
  4381. 'mathOperatorField' =>
  4382. array (
  4383. 'name' => 'mathOperatorField',
  4384. 'desc' => 'prop_formit.mathoperatorfield_desc',
  4385. 'type' => 'textfield',
  4386. 'options' => '',
  4387. 'value' => 'operator',
  4388. 'lexicon' => 'formit:properties',
  4389. 'area' => '',
  4390. 'desc_trans' => 'prop_formit.mathoperatorfield_desc',
  4391. 'area_trans' => '',
  4392. ),
  4393. 'saveTmpFiles' =>
  4394. array (
  4395. 'name' => 'saveTmpFiles',
  4396. 'desc' => 'prop_formit.savetmpfiles_desc',
  4397. 'type' => 'combo-boolean',
  4398. 'options' => '',
  4399. 'value' => false,
  4400. 'lexicon' => 'formit:properties',
  4401. 'area' => '',
  4402. 'desc_trans' => 'If set to 1, FormIt will store submitted files in a temporary folder.',
  4403. 'area_trans' => '',
  4404. ),
  4405. 'attachFilesToEmail' =>
  4406. array (
  4407. 'name' => 'attachFilesToEmail',
  4408. 'desc' => 'prop_formit.attachfiles_desc',
  4409. 'type' => 'combo-boolean',
  4410. 'options' => '',
  4411. 'value' => true,
  4412. 'lexicon' => 'formit:properties',
  4413. 'area' => '',
  4414. 'desc_trans' => 'If true, FormIt will add all file fields as attachments in the email.',
  4415. 'area_trans' => '',
  4416. ),
  4417. 'storeAttachments' =>
  4418. array (
  4419. 'name' => 'storeAttachments',
  4420. 'desc' => 'prop_formit.store_attachments_desc',
  4421. 'type' => 'combo-boolean',
  4422. 'options' => '',
  4423. 'value' => false,
  4424. 'lexicon' => 'formit:properties',
  4425. 'area' => '',
  4426. 'desc_trans' => 'prop_formit.store_attachments_desc',
  4427. 'area_trans' => '',
  4428. ),
  4429. ),
  4430. 'moduleguid' => '',
  4431. 'static' => false,
  4432. 'static_file' => '',
  4433. 'content' => '/**
  4434. * FormIt
  4435. *
  4436. * Copyright 2009-2012 by Shaun McCormick <shaun@modx.com>
  4437. *
  4438. * FormIt is free software; you can redistribute it and/or modify it
  4439. * under the terms of the GNU General Public License as published by the Free
  4440. * Software Foundation; either version 2 of the License, or (at your option) any
  4441. * later version.
  4442. *
  4443. * FormIt is distributed in the hope that it will be useful, but WITHOUT ANY
  4444. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  4445. * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  4446. *
  4447. * You should have received a copy of the GNU General Public License along with
  4448. * FormIt; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
  4449. * Suite 330, Boston, MA 02111-1307 USA
  4450. *
  4451. * @package formit
  4452. */
  4453. /**
  4454. * FormIt
  4455. *
  4456. * A dynamic form processing Snippet for MODx Revolution.
  4457. *
  4458. * @var modX $modx
  4459. * @var array $scriptProperties
  4460. *
  4461. * @package formit
  4462. */
  4463. $modelPath = $modx->getOption(
  4464. \'formit.core_path\',
  4465. null,
  4466. $modx->getOption(\'core_path\', null, MODX_CORE_PATH) . \'components/formit/\'
  4467. ) . \'model/formit/\';
  4468. $modx->loadClass(\'FormIt\', $modelPath, true, true);
  4469. $fi = new FormIt($modx, $scriptProperties);
  4470. $fi->initialize($modx->context->get(\'key\'));
  4471. $fi->loadRequest();
  4472. $fields = $fi->request->prepare();
  4473. return $fi->request->handle($fields);',
  4474. ),
  4475. 'policies' =>
  4476. array (
  4477. 'web' =>
  4478. array (
  4479. ),
  4480. ),
  4481. 'source' =>
  4482. array (
  4483. ),
  4484. ),
  4485. ),
  4486. 'modTemplateVar' =>
  4487. array (
  4488. ),
  4489. ),
  4490. );