Maccms.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. <?php
  2. namespace app\common\taglib;
  3. use think\template\TagLib;
  4. use think\Db;
  5. class Maccms extends Taglib {
  6. protected $tags = [
  7. 'link'=> ['attr'=>'order,by,type,not,start,num,cachetime'],
  8. 'area'=> ['attr'=>'order,start,num'],
  9. 'lang'=> ['attr'=>'order,start,num'],
  10. 'year'=> ['attr'=>'order,start,num'],
  11. 'class'=> ['attr'=>'order,start,num'],
  12. 'version'=> ['attr'=>'order,start,num'],
  13. 'state'=> ['attr'=>'order,start,num'],
  14. 'letter'=> ['attr'=>'order,start,num'],
  15. 'type' => ['attr' =>'order,by,start,num,id,ids,not,parent,flag,mid,format,cachetime'],
  16. 'comment'=>['attr' =>'order,by,start,num,paging,pageurl,id,pid,rid,mid,uid,half'],
  17. 'gbook'=>['attr' =>'order,by,start,num,paging,pageurl,rid,uid,half'],
  18. 'role'=>['attr' =>'order,by,start,num,paging,pageurl,id,ids,not,rid,actor,name,level,letter,half,timeadd,timehits,time,cachetime'],
  19. 'actor'=>['attr' =>'order,by,start,num,paging,pageurl,id,ids,not,area,sex,name,level,letter,type,typenot,starsign,blood,half,timeadd,timehits,time,cachetime'],
  20. 'topic' => ['attr' =>'order,by,start,num,id,ids,not,paging,pageurl,class,tag,half,timeadd,timehits,time,cachetime'],
  21. 'art' => ['attr' =>'order,by,start,num,id,ids,not,paging,pageurl,type,typenot,class,tag,level,letter,half,rel,timeadd,timehits,time,hitsmonth,hitsweek,hitsday,hits,cachetime'],
  22. 'manga' => ['attr' =>'order,by,start,num,id,ids,not,paging,pageurl,type,typenot,class,tag,area,lang,year,level,letter,half,rel,version,state,tv,weekday,timeadd,timehits,time,hitsmonth,hitsweek,hitsday,hits,isend,cachetime'],
  23. 'vod' => ['attr' =>'order,by,start,num,id,ids,not,paging,pageurl,type,typenot,class,tag,area,lang,year,level,letter,half,rel,version,state,tv,weekday,timeadd,timehits,time,hitsmonth,hitsweek,hitsday,hits,isend,cachetime'],
  24. 'website'=>['attr' =>'order,by,start,num,paging,pageurl,id,ids,not,area,lang,name,level,letter,type,typenot,half,timeadd,timehits,time,cachetime'],
  25. 'foreach' => ['attr'=>'name,id,key'],
  26. 'for' => ['attr'=>'start,end,comparison,step,name'],
  27. ];
  28. public function tagFor($tag,$content)
  29. {
  30. if(empty($tag['start'])){
  31. $tag['start'] = 1;
  32. }
  33. if(empty($tag['end'])){
  34. $tag['end'] = 5;
  35. }
  36. if(empty($tag['comparison'])){
  37. $tag['comparison'] = 'elt';
  38. }
  39. if(empty($tag['step'])){
  40. $tag['step'] = 1;
  41. }
  42. if(empty($tag['name'])){
  43. $tag['name'] = 'i';
  44. }
  45. $parse='';
  46. $parse .= '{for start="'.$tag['start'].'" end="'.$tag['end'].'" comparison="'.$tag['comparison'].'" step="'.$tag['step'].'" name="'.$tag['name'].'"}';
  47. $parse .= $content;
  48. $parse .= '{/for}';
  49. return $parse;
  50. }
  51. public function tagForeach($tag,$content)
  52. {
  53. if(empty($tag['id'])){
  54. $tag['id'] = 'vo';
  55. }
  56. if(empty($tag['key'])){
  57. $tag['key'] = 'key';
  58. }
  59. // foreach标签强化
  60. // https://github.com/magicblack/maccms10/issues/984
  61. $parse_addon = '';
  62. if(!empty($tag['offset'])){
  63. $parse_addon .= ' offset="'.$tag['offset'].'"';
  64. }
  65. if(!empty($tag['length'])){
  66. $parse_addon .= ' length="'.$tag['length'].'"';
  67. }
  68. if(!empty($tag['mod'])){
  69. $parse_addon .= ' mod="'.$tag['mod'].'"';
  70. }
  71. if(!empty($tag['empty'])){
  72. $parse_addon .= ' empty="'.$tag['empty'].'"';
  73. }
  74. $parse='';
  75. $parse .= '{foreach name="'.$tag['name'].'" id="'.$tag['id'].'" key="'.$tag['key'].'"' . $parse_addon . '}';
  76. $parse .= $content;
  77. $parse .= '{/foreach}';
  78. return $parse;
  79. }
  80. public function tagArea($tag,$content)
  81. {
  82. if(empty($tag['id'])){
  83. $tag['id'] = 'vo';
  84. }
  85. if(empty($tag['key'])){
  86. $tag['key'] = 'key';
  87. }
  88. $parse = '<?php ';
  89. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  90. $parse .= '$__LIST__ = model("Extend")->areaData($__TAG__);';
  91. $parse .= ' ?>';
  92. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  93. if(!empty($tag['offset'])){
  94. $parse .= ' offset="'.$tag['offset'].'"';
  95. }
  96. if(!empty($tag['length'])){
  97. $parse .= ' length="'.$tag['length'].'"';
  98. }
  99. if(!empty($tag['mod'])){
  100. $parse .= ' mod="'.$tag['mod'].'"';
  101. }
  102. if(!empty($tag['empty'])){
  103. $parse .= ' empty="'.$tag['empty'].'"';
  104. }
  105. $parse .= '}';
  106. $parse .= $content;
  107. $parse .= '{/volist}';
  108. return $parse;
  109. }
  110. public function tagLang($tag,$content)
  111. {
  112. if(empty($tag['id'])){
  113. $tag['id'] = 'vo';
  114. }
  115. if(empty($tag['key'])){
  116. $tag['key'] = 'key';
  117. }
  118. $parse = '<?php ';
  119. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  120. $parse .= '$__LIST__ = model("Extend")->langData($__TAG__);';
  121. $parse .= ' ?>';
  122. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  123. if(!empty($tag['offset'])){
  124. $parse .= ' offset="'.$tag['offset'].'"';
  125. }
  126. if(!empty($tag['length'])){
  127. $parse .= ' length="'.$tag['length'].'"';
  128. }
  129. if(!empty($tag['mod'])){
  130. $parse .= ' mod="'.$tag['mod'].'"';
  131. }
  132. if(!empty($tag['empty'])){
  133. $parse .= ' empty="'.$tag['empty'].'"';
  134. }
  135. $parse .= '}';
  136. $parse .= $content;
  137. $parse .= '{/volist}';
  138. return $parse;
  139. }
  140. public function tagClass($tag,$content)
  141. {
  142. if(empty($tag['id'])){
  143. $tag['id'] = 'vo';
  144. }
  145. if(empty($tag['key'])){
  146. $tag['key'] = 'key';
  147. }
  148. $parse = '<?php ';
  149. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  150. $parse .= '$__LIST__ = model("Extend")->classData($__TAG__);';
  151. $parse .= ' ?>';
  152. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  153. if(!empty($tag['offset'])){
  154. $parse .= ' offset="'.$tag['offset'].'"';
  155. }
  156. if(!empty($tag['length'])){
  157. $parse .= ' length="'.$tag['length'].'"';
  158. }
  159. if(!empty($tag['mod'])){
  160. $parse .= ' mod="'.$tag['mod'].'"';
  161. }
  162. if(!empty($tag['empty'])){
  163. $parse .= ' empty="'.$tag['empty'].'"';
  164. }
  165. $parse .= '}';
  166. $parse .= $content;
  167. $parse .= '{/volist}';
  168. return $parse;
  169. }
  170. public function tagYear($tag,$content)
  171. {
  172. if(empty($tag['id'])){
  173. $tag['id'] = 'vo';
  174. }
  175. if(empty($tag['key'])){
  176. $tag['key'] = 'key';
  177. }
  178. $parse = '<?php ';
  179. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  180. $parse .= '$__LIST__ = model("Extend")->YearData($__TAG__);';
  181. $parse .= ' ?>';
  182. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  183. if(!empty($tag['offset'])){
  184. $parse .= ' offset="'.$tag['offset'].'"';
  185. }
  186. if(!empty($tag['length'])){
  187. $parse .= ' length="'.$tag['length'].'"';
  188. }
  189. if(!empty($tag['mod'])){
  190. $parse .= ' mod="'.$tag['mod'].'"';
  191. }
  192. if(!empty($tag['empty'])){
  193. $parse .= ' empty="'.$tag['empty'].'"';
  194. }
  195. $parse .= '}';
  196. $parse .= $content;
  197. $parse .= '{/volist}';
  198. return $parse;
  199. }
  200. public function tagVersion($tag,$content)
  201. {
  202. if(empty($tag['id'])){
  203. $tag['id'] = 'vo';
  204. }
  205. if(empty($tag['key'])){
  206. $tag['key'] = 'key';
  207. }
  208. $parse = '<?php ';
  209. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  210. $parse .= '$__LIST__ = model("Extend")->versionData($__TAG__);';
  211. $parse .= ' ?>';
  212. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  213. if(!empty($tag['offset'])){
  214. $parse .= ' offset="'.$tag['offset'].'"';
  215. }
  216. if(!empty($tag['length'])){
  217. $parse .= ' length="'.$tag['length'].'"';
  218. }
  219. if(!empty($tag['mod'])){
  220. $parse .= ' mod="'.$tag['mod'].'"';
  221. }
  222. if(!empty($tag['empty'])){
  223. $parse .= ' empty="'.$tag['empty'].'"';
  224. }
  225. $parse .= '}';
  226. $parse .= $content;
  227. $parse .= '{/volist}';
  228. return $parse;
  229. }
  230. public function tagState($tag,$content)
  231. {
  232. if(empty($tag['id'])){
  233. $tag['id'] = 'vo';
  234. }
  235. if(empty($tag['key'])){
  236. $tag['key'] = 'key';
  237. }
  238. $parse = '<?php ';
  239. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  240. $parse .= '$__LIST__ = model("Extend")->stateData($__TAG__);';
  241. $parse .= ' ?>';
  242. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  243. if(!empty($tag['offset'])){
  244. $parse .= ' offset="'.$tag['offset'].'"';
  245. }
  246. if(!empty($tag['length'])){
  247. $parse .= ' length="'.$tag['length'].'"';
  248. }
  249. if(!empty($tag['mod'])){
  250. $parse .= ' mod="'.$tag['mod'].'"';
  251. }
  252. if(!empty($tag['empty'])){
  253. $parse .= ' empty="'.$tag['empty'].'"';
  254. }
  255. $parse .= '}';
  256. $parse .= $content;
  257. $parse .= '{/volist}';
  258. return $parse;
  259. }
  260. public function tagLetter($tag,$content)
  261. {
  262. if(empty($tag['id'])){
  263. $tag['id'] = 'vo';
  264. }
  265. if(empty($tag['key'])){
  266. $tag['key'] = 'key';
  267. }
  268. $parse = '<?php ';
  269. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  270. $parse .= '$__LIST__ = model("Extend")->letterData($__TAG__);';
  271. $parse .= ' ?>';
  272. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  273. if(!empty($tag['offset'])){
  274. $parse .= ' offset="'.$tag['offset'].'"';
  275. }
  276. if(!empty($tag['length'])){
  277. $parse .= ' length="'.$tag['length'].'"';
  278. }
  279. if(!empty($tag['mod'])){
  280. $parse .= ' mod="'.$tag['mod'].'"';
  281. }
  282. if(!empty($tag['empty'])){
  283. $parse .= ' empty="'.$tag['empty'].'"';
  284. }
  285. $parse .= '}';
  286. $parse .= $content;
  287. $parse .= '{/volist}';
  288. return $parse;
  289. }
  290. public function tagLink($tag,$content)
  291. {
  292. if(empty($tag['id'])){
  293. $tag['id'] = 'vo';
  294. }
  295. if(empty($tag['key'])){
  296. $tag['key'] = 'key';
  297. }
  298. $parse = '<?php ';
  299. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  300. $parse .= '$__LIST__ = model("Link")->listCacheData($__TAG__);';
  301. $parse .= ' ?>';
  302. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  303. if(!empty($tag['offset'])){
  304. $parse .= ' offset="'.$tag['offset'].'"';
  305. }
  306. if(!empty($tag['length'])){
  307. $parse .= ' length="'.$tag['length'].'"';
  308. }
  309. if(!empty($tag['mod'])){
  310. $parse .= ' mod="'.$tag['mod'].'"';
  311. }
  312. if(!empty($tag['empty'])){
  313. $parse .= ' empty="'.$tag['empty'].'"';
  314. }
  315. $parse .= '}';
  316. $parse .= $content;
  317. $parse .= '{/volist}';
  318. return $parse;
  319. }
  320. public function tagType($tag,$content)
  321. {
  322. if(empty($tag['id'])){
  323. $tag['id'] = 'vo';
  324. }
  325. if(empty($tag['key'])){
  326. $tag['key'] = 'key';
  327. }
  328. $parse = '<?php ';
  329. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  330. $parse .= '$__LIST__ = model("Type")->listCacheData($__TAG__);';
  331. $parse .= ' ?>';
  332. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  333. if(!empty($tag['offset'])){
  334. $parse .= ' offset="'.$tag['offset'].'"';
  335. }
  336. if(!empty($tag['length'])){
  337. $parse .= ' length="'.$tag['length'].'"';
  338. }
  339. if(!empty($tag['mod'])){
  340. $parse .= ' mod="'.$tag['mod'].'"';
  341. }
  342. if(!empty($tag['empty'])){
  343. $parse .= ' empty="'.$tag['empty'].'"';
  344. }
  345. $parse .= '}';
  346. $parse .= $content;
  347. $parse .= '{/volist}';
  348. return $parse;
  349. }
  350. public function tagComment($tag,$content)
  351. {
  352. if(empty($tag['id'])){
  353. $tag['id'] = 'vo';
  354. }
  355. if(empty($tag['key'])){
  356. $tag['key'] = 'key';
  357. }
  358. $parse = '<?php ';
  359. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  360. $parse .= '$__LIST__ = model("Comment")->listCacheData($__TAG__);';
  361. if($tag['paging']=='yes'){
  362. $parse .= '$__PAGING__ = mac_page_param($__LIST__[\'total\'],$__LIST__[\'limit\'],$__LIST__[\'page\'],$__LIST__[\'pageurl\'],$__LIST__[\'half\']);';
  363. }
  364. $parse .= ' ?>';
  365. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  366. if(!empty($tag['offset'])){
  367. $parse .= ' offset="'.$tag['offset'].'"';
  368. }
  369. if(!empty($tag['length'])){
  370. $parse .= ' length="'.$tag['length'].'"';
  371. }
  372. if(!empty($tag['mod'])){
  373. $parse .= ' mod="'.$tag['mod'].'"';
  374. }
  375. if(!empty($tag['empty'])){
  376. $parse .= ' empty="'.$tag['empty'].'"';
  377. }
  378. $parse .= '}';
  379. $parse .= $content;
  380. $parse .= '{/volist}';
  381. return $parse;
  382. }
  383. public function tagGbook($tag,$content)
  384. {
  385. if(empty($tag['id'])){
  386. $tag['id'] = 'vo';
  387. }
  388. if(empty($tag['key'])){
  389. $tag['key'] = 'key';
  390. }
  391. $parse = '<?php ';
  392. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  393. $parse .= '$__LIST__ = model("Gbook")->listCacheData($__TAG__);';
  394. if($tag['paging']=='yes'){
  395. $parse .= '$__PAGING__ = mac_page_param($__LIST__[\'total\'],$__LIST__[\'limit\'],$__LIST__[\'page\'],$__LIST__[\'pageurl\'],$__LIST__[\'half\']);';
  396. }
  397. $parse .= ' ?>';
  398. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  399. if(!empty($tag['offset'])){
  400. $parse .= ' offset="'.$tag['offset'].'"';
  401. }
  402. if(!empty($tag['length'])){
  403. $parse .= ' length="'.$tag['length'].'"';
  404. }
  405. if(!empty($tag['mod'])){
  406. $parse .= ' mod="'.$tag['mod'].'"';
  407. }
  408. if(!empty($tag['empty'])){
  409. $parse .= ' empty="'.$tag['empty'].'"';
  410. }
  411. $parse .= '}';
  412. $parse .= $content;
  413. $parse .= '{/volist}';
  414. return $parse;
  415. }
  416. public function tagTopic($tag,$content)
  417. {
  418. if(empty($tag['id'])){
  419. $tag['id'] = 'vo';
  420. }
  421. if(empty($tag['key'])){
  422. $tag['key'] = 'key';
  423. }
  424. $parse = '<?php ';
  425. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  426. $parse .= '$__LIST__ = model("Topic")->listCacheData($__TAG__);';
  427. if($tag['paging']=='yes'){
  428. $parse .= '$__PAGING__ = mac_page_param($__LIST__[\'total\'],$__LIST__[\'limit\'],$__LIST__[\'page\'],$__LIST__[\'pageurl\'],$__LIST__[\'half\']);';
  429. }
  430. $parse .= ' ?>';
  431. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  432. if(!empty($tag['offset'])){
  433. $parse .= ' offset="'.$tag['offset'].'"';
  434. }
  435. if(!empty($tag['length'])){
  436. $parse .= ' length="'.$tag['length'].'"';
  437. }
  438. if(!empty($tag['mod'])){
  439. $parse .= ' mod="'.$tag['mod'].'"';
  440. }
  441. if(!empty($tag['empty'])){
  442. $parse .= ' empty="'.$tag['empty'].'"';
  443. }
  444. $parse .= '}';
  445. $parse .= $content;
  446. $parse .= '{/volist}';
  447. return $parse;
  448. }
  449. public function tagActor($tag,$content)
  450. {
  451. if(empty($tag['id'])){
  452. $tag['id'] = 'vo';
  453. }
  454. if(empty($tag['key'])){
  455. $tag['key'] = 'key';
  456. }
  457. $parse = '<?php ';
  458. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  459. $parse .= '$__LIST__ = model("Actor")->listCacheData($__TAG__);';
  460. if($tag['paging']=='yes'){
  461. $parse .= '$__PAGING__ = mac_page_param($__LIST__[\'total\'],$__LIST__[\'limit\'],$__LIST__[\'page\'],$__LIST__[\'pageurl\'],$__LIST__[\'half\']);';
  462. }
  463. $parse .= ' ?>';
  464. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  465. if(!empty($tag['offset'])){
  466. $parse .= ' offset="'.$tag['offset'].'"';
  467. }
  468. if(!empty($tag['length'])){
  469. $parse .= ' length="'.$tag['length'].'"';
  470. }
  471. if(!empty($tag['mod'])){
  472. $parse .= ' mod="'.$tag['mod'].'"';
  473. }
  474. if(!empty($tag['empty'])){
  475. $parse .= ' empty="'.$tag['empty'].'"';
  476. }
  477. $parse .= '}';
  478. $parse .= $content;
  479. $parse .= '{/volist}';
  480. return $parse;
  481. }
  482. public function tagRole($tag,$content)
  483. {
  484. if(empty($tag['id'])){
  485. $tag['id'] = 'vo';
  486. }
  487. if(empty($tag['key'])){
  488. $tag['key'] = 'key';
  489. }
  490. $parse = '<?php ';
  491. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  492. $parse .= '$__LIST__ = model("Role")->listCacheData($__TAG__);';
  493. if($tag['paging']=='yes'){
  494. $parse .= '$__PAGING__ = mac_page_param($__LIST__[\'total\'],$__LIST__[\'limit\'],$__LIST__[\'page\'],$__LIST__[\'pageurl\'],$__LIST__[\'half\']);';
  495. }
  496. $parse .= ' ?>';
  497. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  498. if(!empty($tag['offset'])){
  499. $parse .= ' offset="'.$tag['offset'].'"';
  500. }
  501. if(!empty($tag['length'])){
  502. $parse .= ' length="'.$tag['length'].'"';
  503. }
  504. if(!empty($tag['mod'])){
  505. $parse .= ' mod="'.$tag['mod'].'"';
  506. }
  507. if(!empty($tag['empty'])){
  508. $parse .= ' empty="'.$tag['empty'].'"';
  509. }
  510. $parse .= '}';
  511. $parse .= $content;
  512. $parse .= '{/volist}';
  513. return $parse;
  514. }
  515. public function tagArt($tag,$content)
  516. {
  517. if(empty($tag['id'])){
  518. $tag['id'] = 'vo';
  519. }
  520. if(empty($tag['key'])){
  521. $tag['key'] = 'key';
  522. }
  523. $parse = '<?php ';
  524. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  525. $parse .= '$__LIST__ = model("Art")->listCacheData($__TAG__);';
  526. if($tag['paging']=='yes'){
  527. $parse .= '$__PAGING__ = mac_page_param($__LIST__[\'total\'],$__LIST__[\'limit\'],$__LIST__[\'page\'],$__LIST__[\'pageurl\'],$__LIST__[\'half\']);';
  528. }
  529. $parse .= ' ?>';
  530. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  531. if(!empty($tag['offset'])){
  532. $parse .= ' offset="'.$tag['offset'].'"';
  533. }
  534. if(!empty($tag['length'])){
  535. $parse .= ' length="'.$tag['length'].'"';
  536. }
  537. if(!empty($tag['mod'])){
  538. $parse .= ' mod="'.$tag['mod'].'"';
  539. }
  540. if(!empty($tag['empty'])){
  541. $parse .= ' empty="'.$tag['empty'].'"';
  542. }
  543. $parse .= '}';
  544. $parse .= $content;
  545. $parse .= '{/volist}';
  546. return $parse;
  547. }
  548. public function tagManga($tag,$content)
  549. {
  550. if(empty($tag['id'])){
  551. $tag['id'] = 'vo';
  552. }
  553. if(empty($tag['key'])){
  554. $tag['key'] = 'key';
  555. }
  556. $parse = '<?php ';
  557. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  558. $parse .= '$__LIST__ = model("Manga")->listCacheData($__TAG__);';
  559. if($tag['paging']=='yes'){
  560. $parse .= '$__PAGING__ = mac_page_param($__LIST__[\'total\'],$__LIST__[\'limit\'],$__LIST__[\'page\'],$__LIST__[\'pageurl\'],$__LIST__[\'half\']);';
  561. }
  562. $parse .= ' ?>';
  563. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  564. if(!empty($tag['offset'])){
  565. $parse .= ' offset="'.$tag['offset'].'"';
  566. }
  567. if(!empty($tag['length'])){
  568. $parse .= ' length="'.$tag['length'].'"';
  569. }
  570. if(!empty($tag['mod'])){
  571. $parse .= ' mod="'.$tag['mod'].'"';
  572. }
  573. if(!empty($tag['empty'])){
  574. $parse .= ' empty="'.$tag['empty'].'"';
  575. }
  576. $parse .= '}';
  577. $parse .= $content;
  578. $parse .= '{/volist}';
  579. return $parse;
  580. }
  581. public function tagVod($tag,$content)
  582. {
  583. if(empty($tag['id'])){
  584. $tag['id'] = 'vo';
  585. }
  586. if(empty($tag['key'])){
  587. $tag['key'] = 'key';
  588. }
  589. $parse = '<?php ';
  590. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  591. $parse .= '$__LIST__ = model("Vod")->listCacheData($__TAG__);';
  592. if($tag['paging']=='yes'){
  593. $parse .= '$__PAGING__ = mac_page_param($__LIST__[\'total\'],$__LIST__[\'limit\'],$__LIST__[\'page\'],$__LIST__[\'pageurl\'],$__LIST__[\'half\']);';
  594. }
  595. $parse .= ' ?>';
  596. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  597. if(!empty($tag['offset'])){
  598. $parse .= ' offset="'.$tag['offset'].'"';
  599. }
  600. if(!empty($tag['length'])){
  601. $parse .= ' length="'.$tag['length'].'"';
  602. }
  603. if(!empty($tag['mod'])){
  604. $parse .= ' mod="'.$tag['mod'].'"';
  605. }
  606. if(!empty($tag['empty'])){
  607. $parse .= ' empty="'.$tag['empty'].'"';
  608. }
  609. $parse .= '}';
  610. $parse .= $content;
  611. $parse .= '{/volist}';
  612. return $parse;
  613. }
  614. public function tagWebsite($tag,$content)
  615. {
  616. if(empty($tag['id'])){
  617. $tag['id'] = 'vo';
  618. }
  619. if(empty($tag['key'])){
  620. $tag['key'] = 'key';
  621. }
  622. $parse = '<?php ';
  623. $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
  624. $parse .= '$__LIST__ = model("Website")->listCacheData($__TAG__);';
  625. if($tag['paging']=='yes'){
  626. $parse .= '$__PAGING__ = mac_page_param($__LIST__[\'total\'],$__LIST__[\'limit\'],$__LIST__[\'page\'],$__LIST__[\'pageurl\'],$__LIST__[\'half\']);';
  627. }
  628. $parse .= ' ?>';
  629. $parse .= '{volist name="__LIST__[\'list\']" id="'.$tag['id'].'" key="'.$tag['key'].'"';
  630. if(!empty($tag['offset'])){
  631. $parse .= ' offset="'.$tag['offset'].'"';
  632. }
  633. if(!empty($tag['length'])){
  634. $parse .= ' length="'.$tag['length'].'"';
  635. }
  636. if(!empty($tag['mod'])){
  637. $parse .= ' mod="'.$tag['mod'].'"';
  638. }
  639. if(!empty($tag['empty'])){
  640. $parse .= ' empty="'.$tag['empty'].'"';
  641. }
  642. $parse .= '}';
  643. $parse .= $content;
  644. $parse .= '{/volist}';
  645. return $parse;
  646. }
  647. }