コード例 #1
0
ファイル: read.php プロジェクト: leinue/daily
 $im = infoMgr::getInstance();
 $tm = new detailMgr($im);
 $gb = new getBase();
 $url = new urlMgr();
 $urlAvailable = $url->getContextUrl($id);
 $jsonData = $tm->getJSON($gb, $urlAvailable);
 $jsonArray = $tm->getContext(new decodeJSON($jsonData));
 $dataParser = new DataObj($jsonArray, DataObj::BODY);
 $stories = $dataParser->getSingleNew();
 if (!$stories) {
     header("location:index.php");
 } else {
     //print_r($stories);
     //echo $dataParser->getImages();
     $allContents = $dataParser->getBody();
     $newsTitle = $dataParser->getTitle();
     $keyTitle = array("整", "点", "儿", "新", "闻");
     $flag = 0;
     foreach ($keyTitle as $key => $value) {
         if (stripos($newsTitle, $value)) {
             $flag++;
         }
     }
     if (!$flag > 0) {
         //<img class="avatar" src=" ">
         $eregPattern = "<img class=\"avatar\" src=\"+[a-zA-Z0-9\\.\\_\\/\\:]+\">";
         ereg($eregPattern, $allContents, $faceUrl);
         $faceUrlFixed = substr($faceUrl[0], 25);
         $faceUrlFixed = substr($faceUrlFixed, 0, strlen($faceUrlFixed) - 2);
         $data = file_get_contents($faceUrlFixed);
         $filepath = "img/avatar/" . $id . "." . substr($faceUrlFixed, -3, 3);
コード例 #2
0
ファイル: index.php プロジェクト: leinue/daily
$gb = new getBase();
//print today
$jsonData = $tm->getJSON($gb);
$jsonArray = $tm->getContext(new decodeJSON($jsonData));
//print_r($jsonArray);
$dataParser = new DataObj($jsonArray, DataObj::_LIST);
//echo $dataParser->getDate();
$stories = $dataParser->getStories();
foreach ($stories as $key => $value) {
    $singleNew = $dataParser->getSingleNew($key);
    echo '			<div class="content-main-box">
				<div class="main-box-img">
					<img src="' . $dataParser->getImages() . '" alt="' . $dataParser->getID() . '" />
				</div>
				<div class="main-box-content">
					<div class="main-title">
						<a href="read.php?av=' . $dataParser->getID() . '">' . $dataParser->getTitle() . '</a>
					</div>
					<div class="main-time">' . $dataParser->getDate() . '</div>
				</div>
				<div class="main-box-footer">
					<div class="main-box-postscript">来自:<a href="http://zhihu.com">zhihu.com</a></div>
				</div>
			</div>';
}
?>

		</div>

<?php 
require "footer.php";