Esempio n. 1
0
 public function show()
 {
     //先取出支持百度视频收录站点
     $sql = "SELECT id,video_record_url,video_record_count,sub_weburl,weburl,site_dir,user_email,video_update_peri,video_record_filename FROM " . DB_PREFIX . "site WHERE is_video_record=1 ORDER BY id";
     $info = $this->db->query($sql);
     while ($row = $this->db->fetch_array($info)) {
         $site[$row['id']]['site_id'] = $row['id'];
         $site[$row['id']]['video_record_count'] = $row['video_record_count'];
         $sitedata[] = $row;
     }
     if (!$sitedata) {
         $this->errorOutput('NO_SITE');
     }
     //publishcontent取出视频收录数据
     $video_data = $this->pub_content->video_record($site);
     foreach ($sitedata as $k => $v) {
         $xml = $item_list = '';
         $xml = '<?xml version="1.0" encoding="utf-8"?><document><webSite>' . $v['weburl'] . '</webSite><webMaster>' . $v['user_email'] . '</webMaster><updatePeri>' . $v['video_update_peri'] . '</updatePeri>';
         if (empty($video_data['video_record'][$v['id']])) {
             continue;
         }
         foreach ($video_data['video_record'][$v['id']] as $kk => $vv) {
             $title = $video_data['content_data'][$vv['relation_id']]['title'];
             $content_url = $video_data['content_data'][$vv['relation_id']]['content_url'];
             $indexpic = $video_data['content_data'][$vv['relation_id']]['indexpic'];
             $keywords = $video_data['content_data'][$vv['relation_id']]['keywords'];
             $brief = $video_data['content_data'][$vv['relation_id']]['brief'];
             $create_time = $video_data['content_data'][$vv['relation_id']]['create_time'];
             $duration = $video_data['content_data'][$vv['relation_id']]['video']['duration'];
             if (empty($video_data['content_data'][$vv['relation_id']])) {
                 continue;
             }
             $item_list .= '<item><op>' . $vv['opration'] . '</op>';
             if ($title) {
                 $item_list .= '<title><![CDATA[' . xml_filter($title) . ']]></title>';
             }
             $item_list .= '<playLink><![CDATA[' . $content_url . ']]></playLink>';
             if (!empty($indexpic)) {
                 $item_list .= '<imageLink>' . hg_fetchimgurl($indexpic) . '</imageLink>';
             }
             if (!empty($content_url)) {
                 $item_list .= '<videoLink>' . $content_url . '</videoLink>';
             }
             if (!empty($keywords)) {
                 $tag = explode(",", $keywords);
                 foreach ($tag as $kkk => $vvv) {
                     $item_list .= '<tag><![CDATA[' . xml_filter($vvv) . ']]></tag>';
                 }
             }
             $item_list .= '<comment><![CDATA[' . xml_filter($brief) . ']]></comment>';
             $item_list .= '<pubDate>' . date('Y-m-d H:i:s', $create_time) . '</pubDate>';
             if (!empty($duration)) {
                 $item_list .= '<duration>' . $duration . '</duration>';
             }
             $item_list .= '</item>';
         }
         $xml .= $item_list . '</document>';
         $row = array();
         $row['xml'] = $xml;
         $row['video_record_url'] = $v['video_record_url'];
         $row['video_record_filename'] = $v['video_record_filename'];
         $this->addItem($row);
     }
     $this->output();
 }
Esempio n. 2
0
 public function getRecordXML()
 {
     $xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
     $xml .= "<document>\n";
     $xml .= "<webSite>{$this->webSite}</webSite>\n";
     $xml .= "<webMaster>{$this->email}</webMaster>\n";
     $xml .= "<updatePeri>{$this->updatePeri}</updatePeri>\n";
     if (is_array($this->recordContent) && count($this->recordContent) > 0) {
         foreach ($this->recordContent as $record) {
             if (empty($record)) {
                 continue;
             }
             $record['playLink'] = $record['content_url'];
             $record['imageLink'] = hg_fetchimgurl($record['video']['indexpic']);
             $record['videoLink'] = $record['video']['host'] . $record['video']['dir'] . $record['video']['filepath'] . $record['video']['filename'];
             $record['tag'] = xml_filter($record['keywords']);
             $record['comment'] = xml_filter($record['brief']);
             $record['pubDate'] = date('Y-m-d H:i:s', $record['create_time']);
             $record['duration'] = $record['video']['duration'];
             $xml .= "<item>\n";
             $xml .= "<op>{$record['op']}</op>\n";
             if ($record['title']) {
                 $xml .= "<title><![CDATA[ {$record['title']} ]]></title>\n";
             }
             if ($record['category']) {
                 $xml .= "<category><![CDATA[ {$record['category']} ]]></category>\n";
             }
             if ($record['playLink']) {
                 $xml .= "<playLink><![CDATA[ {$record['playLink']} ]]></playLink>\n";
             }
             if ($record['imageLink']) {
                 $xml .= "<imageLink><![CDATA[ {$record['imageLink']} ]]></imageLink>\n";
             }
             if ($record['videoLink']) {
                 $xml .= "<videoLink><![CDATA[ {$record['videoLink']} ]]></videoLink>\n";
             }
             if ($record['userid']) {
                 $xml .= "<userid><![CDATA[ {$record['userid']} ]]></userid>\n";
             }
             if ($record['userurl']) {
                 $xml .= "<userurl><![CDATA[ {$record['userurl']} ]]></userurl>\n";
             }
             if ($record['playNum']) {
                 $xml .= "<playNum><![CDATA[ {$record['playNum']} ]]></playNum>\n";
             }
             if ($record['definition']) {
                 $xml .= "<definition><![CDATA[ {$record['definition']} ]]></definition>\n";
             }
             if ($record['tag']) {
                 $tag = explode(",", $record['tag']);
                 foreach ($tag as $kkk => $vvv) {
                     $item_list .= "<tag><![CDATA[" . $vvv . "]]></tag>\n";
                 }
             }
             if ($record['comment']) {
                 $xml .= "<comment><![CDATA[ {$record['comment']} ]]></comment>\n";
             }
             if ($record['pubDate']) {
                 $xml .= "<pubDate><![CDATA[ {$record['pubDate']} ]]></pubDate>\n";
             }
             if ($record['duration']) {
                 $xml .= "<duration><![CDATA[ {$record['duration']} ]]></duration>\n";
             }
             if ($record['avg_p_duration']) {
                 $xml .= "<avg_p_duration><![CDATA[ {$record['avg_p_duration']} ]]></avg_p_duration>\n";
             }
             $xml .= "</item>\n";
         }
     }
     $xml .= "</document>\n";
     return $xml;
 }