Authored by whb

详细页调整

... ... @@ -206,6 +206,7 @@ define('admin/news',function(require, exports)
box.alert('给张缩略图吧!');
return false ;
}
content = '<div id="temp">'+content+'</div>';
if((tag == "视频" || tag == "手机视频") && $(content).find("embed").size()<=0)
{
box.alert('天啊,视频呢!');
... ...
... ... @@ -46,26 +46,58 @@
<?php
if(preg_match('/ipad/i', $_SERVER['HTTP_USER_AGENT']))
{
$temps = $videoMatches = array();
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yoho\.cn\/res\/yohood\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $this->view->info['content'], $videoMatches1);
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yohood\.test\.yoho\.cn\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $this->view->info['content'], $videoMatches2);
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yohood\.cn\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $this->view->info['content'], $videoMatches3);
$temps[] = $videoMatches1;
$temps[] = $videoMatches2;
$temps[] = $videoMatches3;
foreach($temps as $temp)
preg_match_all('@<(object.*?)>(.*?)<(\/object.*?)>@si', $this->view->info['content'], $videosHtml);
if(!empty($videosHtml[0]))
{
if(!empty($temp[2]))
{
$videoMatches = $temp;
}
}
if(!empty($videoMatches[2]))
{
$video = current($videoMatches[2]);
$videoHtml = '<video controls="controls" preload="auto" poster="'.Lib_Images::getImageUrl($this->view->info['thumb'],'0640x0390','fragmentimg','autoCrop').'" width="640" height="390"><source src="'.$video.'" type="video/mp4" /></video>';
$this->view->info['content'] = preg_replace('@<(object.*?)>(.*?)<(\/object.*?)>@si',$videoHtml, $this->view->info['content']);
$this->view->info['content'] = preg_replace('@<(embed.*?)>@si', $videoHtml, $this->view->info['content']);
foreach($videosHtml[0] as $videoHtml)
{
$temps = array();
$cover = Lib_Images::getImageUrl($this->view->info['thumb'],'0300x0300','fragmentimg','autoCrop');
$video = '';
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yoho\.cn\/res\/yohood\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $videoHtml, $videoMatches1);
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yohood\.test\.yoho\.cn\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $videoHtml, $videoMatches2);
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yohood\.cn\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $videoHtml, $videoMatches3);
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yohoboys\.com\/res\/www\/swf\/util\/VideoPlayerNew\.swf\?url=(.+\.mp4|.+)&title1=*&shareurl=*&coverpic=(.+)\"@i", $videoHtml, $boysVideoMatches);
$videoMatches1 = array_filter($videoMatches1);
$videoMatches2 = array_filter($videoMatches2);
$videoMatches3 = array_filter($videoMatches3);
if(!empty($videoMatches1))
{
$temps = $videoMatches1;
}
else if(!empty($videoMatches2))
{
$temps = $videoMatches2;
}
else if(!empty($videoMatches3))
{
$temps = $videoMatches3;
}
if(!empty($temps))
{
if(!empty($temps[2][0]))
{
$video = $temps[2][0];
}
}
else if(!empty($boysVideoMatches))
{
$temps = $boysVideoMatches;
if(!empty($temps[2][0]))
{
$video = $temps[2][0];
}
if(!empty($temps[3][0]))
{
$cover = $temps[3][0];
}
}
if(!empty($video))
{
$html = '<video controls="controls" preload="auto" poster="'.$cover.'" width="300" height="300" style="width:300px;height:300px;display:block;margin:auto;"><source src="'.$video.'" type="video/mp4" /></video>';
$this->view->info['content'] = str_replace($videoHtml, $html, $this->view->info['content']);
}
}
}
}
echo $this->view->info['content'];
... ...
... ... @@ -26,26 +26,58 @@
<?php endif;?>
<div class="detail-article">
<?php
$temps = $videoMatches = array();
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yoho\.cn\/res\/yohood\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $this->view->info['content'], $videoMatches1);
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yohood\.test\.yoho\.cn\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $this->view->info['content'], $videoMatches2);
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yohood\.cn\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $this->view->info['content'], $videoMatches3);
$temps[] = $videoMatches1;
$temps[] = $videoMatches2;
$temps[] = $videoMatches3;
foreach($temps as $temp)
preg_match_all('@<(object.*?)>(.*?)<(\/object.*?)>@si', $this->view->info['content'], $videosHtml);
if(!empty($videosHtml[0]))
{
if(!empty($temp[2]))
{
$videoMatches = $temp;
}
}
if(!empty($videoMatches[2]))
{
$video = current($videoMatches[2]);
$videoHtml = '<video controls="controls" preload="auto" poster="'.Lib_Images::getImageUrl($this->view->info['thumb'],'0300x0300','fragmentimg','autoCrop').'" width="300" height="300" style="width:300px;height:300px;display:block;margin:auto;"><source src="'.$video.'" type="video/mp4" /></video>';
$this->view->info['content'] = preg_replace('@<(object.*?)>(.*?)<(\/object.*?)>@si',$videoHtml, $this->view->info['content']);
$this->view->info['content'] = preg_replace('@<(embed.*?)>@si', $videoHtml, $this->view->info['content']);
foreach($videosHtml[0] as $videoHtml)
{
$temps = array();
$cover = Lib_Images::getImageUrl($this->view->info['thumb'],'0300x0300','fragmentimg','autoCrop');
$video = '';
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yoho\.cn\/res\/yohood\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $videoHtml, $videoMatches1);
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yohood\.test\.yoho\.cn\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $videoHtml, $videoMatches2);
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yohood\.cn\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $videoHtml, $videoMatches3);
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yohoboys\.com\/res\/www\/swf\/util\/VideoPlayerNew\.swf\?url=(.+\.mp4|.+)&title1=*&shareurl=*&coverpic=(.+)\"@i", $videoHtml, $boysVideoMatches);
$videoMatches1 = array_filter($videoMatches1);
$videoMatches2 = array_filter($videoMatches2);
$videoMatches3 = array_filter($videoMatches3);
if(!empty($videoMatches1))
{
$temps = $videoMatches1;
}
else if(!empty($videoMatches2))
{
$temps = $videoMatches2;
}
else if(!empty($videoMatches3))
{
$temps = $videoMatches3;
}
if(!empty($temps))
{
if(!empty($temps[2][0]))
{
$video = $temps[2][0];
}
}
else if(!empty($boysVideoMatches))
{
$temps = $boysVideoMatches;
if(!empty($temps[2][0]))
{
$video = $temps[2][0];
}
if(!empty($temps[3][0]))
{
$cover = $temps[3][0];
}
}
if(!empty($video))
{
$html = '<video controls="controls" preload="auto" poster="'.$cover.'" width="300" height="300" style="width:300px;height:300px;display:block;margin:auto;"><source src="'.$video.'" type="video/mp4" /></video>';
$this->view->info['content'] = str_replace($videoHtml, $html, $this->view->info['content']);
}
}
}
echo $this->view->info['content'];
?>
... ...