public function doList(LJL_Request $input, LJL_Response $output) { $page = $input->get('page') ? intval($input->get('page')) : 1; $cate = $input->get('cate'); $articleList = array(); //与搜索标签方法融合 $tag = $input->get('tag') ? urldecode(trim($input->get('tag'))) : urldecode(trim($input->get('keyword'))); if ($cate === 'meinv') { $arr = array('清纯美女', '美女', '性感美女', '模特', '美女写真', '长腿美女', '大胸美女', '校花'); shuffle($arr); $url = 'http://image.baidu.com/search/index?tn=baiduimage&word=' . array_pop($arr); //$url = 'https://www.baidu.com'; $content = file_get_contents($url); preg_match_all('/hoverURL\\"\\:\\"(.*?)\\"/is', $content, $mathes); shuffle($mathes[1]); $outArr = array_slice($mathes[1], 1, 5); foreach ((array) $outArr as $key => $src) { $articleList[$key]['src'] = $src; } exit(json_encode($articleList)); } //文章列表 $articleList = Helper_Blog::getArticleList(array('page' => $page, 'pageSize' => $this->pageSize, 'fields' => array('id', 'firstImgId', 'title', 'descript'), 'cate' => $cate, 'tag' => $tag)); if (is_array($articleList)) { foreach ($articleList as $key => $val) { if (!$val['firstImgId']) { $articleList[$key]['src'] = ''; continue; } $imgInfo = Helper_Blog::getPicInfo(array('picId' => $val['firstImgId'])); $articleList[$key]['src'] = Helper_Blog::getPicWebPath(array('imgName' => $imgInfo['picName'], 'imgExt' => $imgInfo['picExt'], 'time' => $imgInfo['time'], 'rootdir' => UPLOAD_IMG_PATH . 'blog_' . APP_BLOG_NAME . '/', 'size' => '110x66_')); } } exit(json_encode($articleList)); }
public function doDefault(LJL_Request $input, LJL_Response $output) { $articleId = $input->get('articleid'); $articleInfo = Helper_Blog::getArticleInfo(array('articleId' => $articleId, 'fileds' => array('cate', 'title', 'source', 'tags', 'content'))); $picInfo = Helper_Blog::getPicInfo(array('articleId' => $articleId)); $picArr = array(); if (is_array($picInfo)) { foreach ($picInfo as $key => $val) { $picArr[$key] = Helper_Blog::getPicWebPath(array('imgName' => $val['picName'], 'imgExt' => $val['picExt'], 'time' => $val['time'], 'rootdir' => UPLOAD_IMG_PATH . 'blog_' . APP_BLOG_NAME . '/')); } } $output->cate = LJL_Config::get('Blog_' . ucfirst(APP_BLOG_NAME) . '_Cate', 'CATE'); $output->articleId = $articleId; $output->articleInfo = $articleInfo; $output->picArr = $picArr; $output->setTemplate('Admin'); }
/** * 获取文章图片src */ private function _getImgSrc($imgId) { $imgInfo = Helper_Blog::getPicInfo(array('picId' => $imgId)); return Helper_Blog::getPicWebPath(array('imgName' => $imgInfo['picName'], 'imgExt' => $imgInfo['picExt'], 'time' => $imgInfo['time'], 'rootdir' => UPLOAD_IMG_PATH . 'blog_cui/', 'size' => '')); }
<div class="plist"> <div class="p_r"> <h2><a href="<?php echo Blog_Plugin_Urls::getDetailUrl(array('articleid' => $articleInfo['id'])); ?> " title="<?php echo strip_tags($articleInfo['title']); ?> "><?php echo htmlspecialchars_decode($articleInfo['title']); ?> </a></h2> <p> <?php if ($articleInfo['firstImgId']) { $imgInfo = Helper_Blog::getPicInfo(array('picId' => $articleInfo['firstImgId'])); ?> <a href="<?php echo Blog_Plugin_Urls::getDetailUrl(array('articleid' => $articleInfo['id'])); ?> " title="<?php echo $articleInfo['title']; ?> "><img src="<?php echo Helper_Blog::getPicWebPath(array('imgName' => $imgInfo['picName'], 'imgExt' => $imgInfo['picExt'], 'time' => $imgInfo['time'], 'rootdir' => UPLOAD_IMG_PATH . 'blog_' . APP_BLOG_NAME . '/', 'size' => '110x66_')); ?> " width="50" height="50" alt="<?php echo $articleInfo['title']; ?> "></a> <?php