1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| function ActivePlugin_acgME() { Add_Filter_Plugin('Filter_Plugin_ViewList_Template', 'acgME_Main'); Add_Filter_Plugin('Filter_Plugin_Post_Thumbs', 'acgME_Thumbs'); Add_Filter_Plugin('Filter_Plugin_Zbp_BuildTemplate', 'acgME_BuidTemp'); } function acgME_Main(&$template) { global $zbp; if ($articles = $template->GetTags('articles')) { foreach ($articles as $article) { acgME_SetIMG($article); } } }
function acgME_Thumbs($article, &$all_images, $width, $height, $count, $clip) { $rndNum = $article->ID % 19 + 1; $rndImg = acgME_Path("v-noimg", "host") . $rndNum . ".jpg"; $all_images[] = $rndImg; Thumb::changeDefaultImg($rndImg); }
function acgME_SetIMG(&$article) { if (!isset($article->Img_640x360)) { $article->Img_640x360 = $article->Thumbs(640, 360, 1, false)[0]; } }
function acgME_BuidTemp(&$templates) { global $zbp; $templates['n-slide'] = ""; if (!$zbp->template->HasTemplate("m-slide")) { return; } $uFile = acgME_Path("u-slide"); if (!is_file($uFile)) { return; } $slides = json_decode(file_get_contents($uFile)); foreach ($slides as $key => &$item) { $item->Img_142x80 = Thumb::Thumbs([$item->Img], 142, 80, 1, false)[0]; $item->Img_647x404 = Thumb::Thumbs([$item->Img], 647, 404, 1, false)[0]; } $zbp->template->SetTags('slides', $slides); $templates['n-slide'] = $zbp->template->Output("m-slide"); $script = $zbp->host . 'zb_users/theme/acgME/script/swiper-3.4.2.jquery.min.js'; $templates['n-slide'] .= '{php}$footer .= \'<script src="' . script .'"></script>\'{/php}'; $script = $zbp->host . 'zb_users/theme/acgME/script/swiper-act.js'; $templates['n-slide'] .= '{php}$footer .= \'<script src="' . $script . '"></script>\'{/php}'; }
|