花魁直播高品质美女在线视频互动社区 - 花魁直播官方版

 歡迎來到素材無憂網(wǎng),按 + 收藏我們
登錄 注冊 退出 找回密碼

dedecms拓展函數(shù)

時(shí)間: 2018-12-11 08:44 閱讀: 作者:素材無憂網(wǎng)

這些函數(shù)是在一個(gè)視頻站點(diǎn)中復(fù)制下來的,發(fā)布出來做一個(gè)備份,也許以后能用的上,至于函數(shù)的作用可以看一下具體代碼,這里就不做解析了。

 

//解密js escape加密字符串
function unescape($str) {  
    $ret = '';  
    $len = strlen ( $str );  
    for($i = 0; $i < $len; $i ++) {  
        if ($str [$i] == '%' && $str [$i + 1] == 'u') {  
            $val = hexdec ( substr ( $str, $i + 2, 4 ) );  
            if ($val < 0x7f)  
                $ret .= chr ( $val );  
            else if ($val < 0x800)  
                $ret .= chr ( 0xc0 | ($val >> 6) ) . chr ( 0x80 | ($val & 0x3f) );  
            else  
                $ret .= chr ( 0xe0 | ($val >> 12) ) . chr ( 0x80 | (($val >> 6) & 0x3f) ) . chr ( 0x80 | ($val & 0x3f) );  
            $i += 5;  
        } else if ($str [$i] == '%') {  
            $ret .= urldecode ( substr ( $str, $i, 3 ) );  
            $i += 2;  
        } else  
            $ret .= $str [$i];  
    }  
    return $ret;  
}
//獲取視頻搜索結(jié)果列表
function get_videolist($str){
  global $cfg_cmsurl;
  $result="";
  foreach(explode('$@#$',$str) as $item){
     if(trim($item)=="") continue;
	 $arr=explode('$#',$item);
	 $link=$cfg_cmsurl."/play/".$arr[0];
	 $title=$arr[1];
	 $img=get_local_img($arr[2]);
	 $time=$arr[3];
	 $result.=' <li><a href="'.$link.'" class="img" title="'.$title.'" > <img src="'.$img.'" width="165" alt="'.$title.'" height="124" /> <label class="bg"></label> <label class="state">'.$time.'</label> </a> <h3>'.$title.'</h3></li> ';
  }
  return $result;
}
//獲得視頻詳細(xì)信息html
function get_videodetail($str){
  global $cfg_cmsurl;
  $result="";
  foreach(explode('$@#$',$str) as $item){
     if(trim($item)=="") continue;
	 $arr=explode('$#',$item);
	 $link=$cfg_cmsurl."/play/".$arr[0];
	 $title=$arr[1];
	 $img=get_local_img($arr[2]);
	 $nianfen=$arr[3];
	 $pingfen=$arr[4];
     $star=get_star_html($pingfen);
	 $column=$arr[5];
	 $status=$arr[6];
	 $zhuyan=str_replace('/','',$arr[7]);
	 $diqu=$arr[8];
	 $leixing=str_replace('/','',$arr[9]);
	 $intro=$arr[10];
	 $result.='<div class="content"> <div class="detail"> <div class="picture"> <div class="pic"><img src="'.$img.'" width="128" height="182" alt="'.$title.'"></div> <span></span> </div> <div class="summary"> <h1><a rel="nofollow" href="'.$link.'">'.$title.'</a><span>('.$column.') '.$nianfen.'</span></h1> <p class="role"><span><strong>主演:</strong>'.$zhuyan.'</span>  </p> <p class="two"> <span><strong>更新:</strong><em>'.$status.'</em></span> <span><strong>類型:</strong>'.$leixing.'</span> <span><strong>地區(qū):</strong>'.$diqu.'</span> </p> <p class="opera"><strong>劇情:</strong>'.$intro.'<span class="synopsis"><a href="'.$link.'" rel="nofollow">詳細(xì)劇情</a></span></p> <p class="bf"><a title="快速觀看" rel="nofollow" href="'.$link.'" class="playlink"></a> <a href="'.$cfg_cmsurl.'/plus/desktop.html?name='.$title.'" rel="nofollow" class="desktop"></a> </p> <div class="pingfen">'.$star.'&nbsp;<strong style="font-size:18px;color:red" id="MARK_B2">'.$pingfen.'</strong></div> </div> <div class="back"></div> </div> </div>';
  }
  return $result;
}
function get_star_html($pingfen){
     global $cfg_templets_skin;
	 $star0=(int)($pingfen/2);
	 $star1=(int)((10-$pingfen)/2);
	 $star2=5-$star0-$star1;
	 $html='';
	 for($i=0;$i<$star0;$i++){
	   $html.='<img src="'.$cfg_templets_skin.'/images/star0.gif">';
	 }
	 for($i=0;$i<$star2;$i++){
	   $html.='<img src="'.$cfg_templets_skin.'/images/star2.gif">';
	 }
	 for($i=0;$i<$star1;$i++){
	   $html.='<img src="'.$cfg_templets_skin.'/images/star1.gif">';
	 }
	 return $html;
}
function get_local_img($url){
   global $cfg_cmsurl;
   $result=$url;
   if(!strstr($url,'http://')&&!strstr($url,'/images/defaultpic.gif')){
    $result=$cfg_cmsurl.$url;
   }elseif(!strstr($url,'/images/defaultpic.gif')){
      //將遠(yuǎn)程地址替換為偽靜態(tài)地址
	   $filename=basename($url);
	  $result=$cfg_cmsurl.'/static/'.$filename;
   }
   return $result;
}
function curl_get($url,$gzip=false){
	$curl = curl_init();
	curl_setopt($curl, CURLOPT_URL, $url);
	curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);  //抓取https網(wǎng)頁
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); //抓取https網(wǎng)頁
	curl_setopt($curl, CURLOPT_HEADER, false);
	curl_setopt($curl, CURLOPT_REFERER,$url);
	curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; SeaPort/1.2; Windows NT 5.1; SV1; InfoPath.2)'); 
	curl_setopt($curl, CURLOPT_COOKIEJAR, 'cookie.txt');
	curl_setopt($curl, CURLOPT_COOKIEFILE, 'cookie.txt');
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0);
	if($gzip) curl_setopt($curl, CURLOPT_ENCODING, "gzip"); 
	$values = curl_exec($curl);
	curl_close($curl);
	return($values);
}
function curl_post($url,$post){
	$curl = curl_init();
	curl_setopt($curl, CURLOPT_URL, $url);
	curl_setopt($curl, CURLOPT_HEADER, false);
	curl_setopt($curl, CURLOPT_REFERER,$url);
	curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; SeaPort/1.2; Windows NT 5.1; SV1; InfoPath.2)'); 
	curl_setopt($curl, CURLOPT_COOKIEJAR, 'cookie.txt');
	curl_setopt($curl, CURLOPT_COOKIEFILE, 'cookie.txt');
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0);
	curl_setopt($curl, CURLOPT_POST, 1);//post提交方式 
    curl_setopt($curl, CURLOPT_POSTFIELDS, $post); 	//指定post提交的參數(shù)
	$values = curl_exec($curl);
	curl_close($curl);
	return($values);
}
function get_baidu_keys($type){
   if($type=="all") $url="http://top.baidu.com/buzz?b=1";
   elseif($type=="week") $url="http://top.baidu.com/buzz?b=42";
   $html=curl_get($url);
   $html=iconv("GB2312","UTF-8//IGNORE",$html);
   preg_match_all('/<a class="list-title"(.*?)>(.*?)<\/a>/',$html,$arr);
   $data=$arr[2];
   return $data;
}
function get_rewrite_url($url){
  global $rewriteArr,$db;
  $re='';
  if(strstr($url,"list.php")){
    preg_match('/list.php\?tid=([\d]+)/',$url,$arr);
	$id=$arr[1];
	$sn=$rewriteArr[$id];
	$re=preg_replace('/plus\/list.php\?tid=([\d]+)/',$sn.'/',$url);
  }elseif(strstr($url,"view.php")){
    preg_match('/view.php\?aid=([\d]+)/',$url,$arr);
	$id=$arr[1];
	//查詢出sn
	$row=$db->GetOne("select urlsn from dede_addonmovie where aid=$id");
	if(isset($row['urlsn'])) $sn=trim($row['urlsn']);
	$re=preg_replace('/plus\/view.php\?aid=([\d]+)/',$sn.'/',$url);
  }
  return $re;
}
function get_filter_title($typename){
  global $sn,$rewriteArr,$leixing;
  $sn=trim($sn);
  $re='';
  $arr=array_flip($rewriteArr);
  $tid=$arr[$sn];
  if(strstr($leixing,'劇')&&$tid==2) $re=$leixing;
  else  $re=$leixing.$typename;
  return $re;
} 

版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!

轉(zhuǎn)載請注明: dedecms拓展函數(shù)

標(biāo)簽:  
相關(guān)文章
模板推薦