묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
다음뷰 애드온 수정 관련 질문드립니다.
2014.03.26 02:26
다음뷰 애드온을 설치했는데...
게시물 하단 중앙에 애드온이 나오더라구요.
다음뷰 버튼을 추천/비추천 버튼 옆에 붙이고 싶은데
어디를 고쳐야 할까요?
<?php
if(!defined("__ZBXE__")) exit();
/**
* @file daumview_vote.addon.php
* @author k2man (k2mani@gmail.com)
* @brief 다음view 추가 애드온
**/
if($called_position == 'before_display_content' && Context::getResponseMethod() == 'HTML') {
if ($addon_info->type == 2) {
$type = 2; $width = 400; $height = 58;
} elseif ($addon_info->type == 3) {
$type = 3; $width = 67; $height = 80;
} else {
$type = 1; $width = 400; $height = 80;
}
preg_match_all("/document_(.*)_[0-9]+ xe_content/", $output, $match);
for ($index = 0; $index < sizeof($match[1]); $index++) {
$document_srl = $match[1][$index];
if (!$document_srl) return;
$db_info = Context::getDBInfo();
$default_url = $db_info->default_url;
if (substr($default_url, -1) == '/')
$default_url = substr($default_url, 0, strlen($default_url)-1);
if (substr($default_url, 0, 7) != 'http://')
$default_url = 'http://' . $default_url;
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
if ($db_info->use_rewrite == 'Y')
$rssLinkUrl = $default_url.'/'.$document_srl;
else
$rssLinkUrl = $default_url.'/?document_srl='.$document_srl;
$buff = FileHandler::getRemoteResource('http://api.v.daum.net/open/news_info.xml?permalink='.$rssLinkUrl);
if ($addon_info->charset == 'kr')
$buff = iconv('EUC-KR', 'UTF-8', $buff);
$oXmlParser = new XmlParser();
$xml_doc = $oXmlParser->parse($buff);
// 다음View에 등록되어 있다면, 추천 버튼 출력
if ($xml_doc->result->head->code->body == '200') {
$embed = '<div style="text-align:center; margin-top:10px; margin-bottom:10px;">';
if ($xml_doc->result->head->code->body == '200')
$embed .= '<embed src="http://api.v.daum.net/static/recombox'.$type.'.swf?nid='.$xml_doc->result->entity->news->id->body.'" quality="high" bgcolor="#ffffff" width="'.$width.'" height="'.$height.'" type="application/x-shockwave-flash"></embed>';
if ($addon_info->muid && $addon_info->view == 2)
$embed .= '<br /><br /><embed src="http://www.mixsh.com/widget/mixup/loader.html?muid=' . $addon_info->muid . '&guid=' . $rssLinkUrl . '&rdate=' . $oDocument->getRegdate('Y.m.d') . ' ' . $oDocument->getRegdate('H:i:s') .'&rawhtml=&skin=1&showhitcnt=1&platform=4" width="400" height="89" wmode="window" allowScriptAccess="always"></embed>';
elseif ($addon_info->muid && $addon_info->view == 3)
$embed .= ' <embed src="http://www.mixsh.com/widget/mixup/loader.html?muid=' . $addon_info->muid . '&guid=' . $rssLinkUrl . '&rdate=' . $oDocument->getRegdate('Y.m.d') . ' ' . $oDocument->getRegdate('H:i:s') .'&rawhtml=&skin=1&showhitcnt=1&platform=4" width="400" height="89" wmode="window" allowScriptAccess="always"></embed>';
$embed .= '</div>';
$pre_embed = '<div style="float:right; margin:0 0 10px 10px;"><embed src="http://api.v.daum.net/static/recombox3.swf?nid='.$xml_doc->result->entity->news->id->body.'" quality="high" bgcolor="#ffffff" width="67" height="80" type="application/x-shockwave-flash"></embed></div>';
//삭제 $output = str_replace(' xe_content">', ' xe_content">'.$pre_embed, $output);
//원본 $output = str_replace('<!--AfterDocument('.$document_srl, $embed.'<!--AfterDocument('.$document_srl, $output);
$output = str_replace('<!--AfterDocument('.$document_srl, $embed.'<!--AfterDocument('.$document_srl, $output);
// 등록되지 않았다면, 전송기능 출력
} else {
$logged_info = Context::get('logged_info');
if ($logged_info->is_admin !='Y' && $logged_info->is_site_admin != 'Y') return;
Context::addJsFile('./addons/daumview_vote/daumview_vote.js');
$buff = FileHandler::getRemoteResource('http://api.v.daum.net/open/user_info.xml?blogurl='.$default_url);
if ($addon_info->charset == 'kr')
$buff = iconv('EUC-KR', 'UTF-8', $buff);
$oXmlParser = new XmlParser();
$xml_doc = $oXmlParser->parse($buff);
$embed = '<div style="float:right;"><a href="javascript:"><img src="/addons/daumview_vote/send.gif" border="0" id="daumview_send_button"></a></div>';
$embed .= '<div style="width:100%; padding:10px; text-align:center; display:none; background:#f5f5f5;" id="daumview_send_view">';
// 다음View에 가입되어 있으면 카테고리 출력
if ($xml_doc->result->head->code->body == '200') {
$buff = FileHandler::getRemoteResource('http://api.v.daum.net/open/category.xml');
if ($addon_info->charset == 'kr')
$buff = iconv('EUC-KR', 'UTF-8', $buff);
$oXmlParser = new XmlParser();
$xml_doc = $oXmlParser->parse($buff);
if ($xml_doc->result->head->code->body == '200') {
$embed .= '<table border=0 width=97% cellpadding=3>';
for ($entity = 0; $entity < sizeof($xml_doc->result->entity->category); $entity++) {
$embed .= '<tr><td><b>' . $xml_doc->result->entity->category[$entity]->name->body . '</b></td><td align="left">';
for ($list = 0; $list < sizeof($xml_doc->result->entity->category[$entity]->list->category); $list++) {
if (sizeof($xml_doc->result->entity->category[$entity]->list->category) > 1)
$embed .= ' <input type="radio" name="daumview_trackback" id="daumview_trackback" value="' . $xml_doc->result->entity->category[$entity]->list->category[$list]->trackback_url->body . '"> ' . $xml_doc->result->entity->category[$entity]->list->category[$list]->name->body . ' ';
else
$embed .= ' <input type="radio" name="daumview_trackback" id="daumview_trackback" value="' . $xml_doc->result->entity->category[$entity]->list->category->trackback_url->body . '"> ' . $xml_doc->result->entity->category[$entity]->list->category->name->body . ' ';
if ($list == 7)
$embed .= '<br />';
}
$embed .= '</td></tr>';
}
$embed .= '<tr><td colspan="2" align="right" id="daumview_result"><a href="javascript:"><img src="/addons/daumview_vote/send_action.gif" border="0" id="daumview_send_action"></a></td></tr>';
$embed .= '</table>';
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
$embed .= '<input type="hidden" id="daumview_default_url" value="' . $default_url . '">';
$embed .= '<input type="hidden" id="daumview_title" value="' . rawurlencode($oDocument->getTitleText()) . '">';
$embed .= '<input type="hidden" id="daumview_excerpt" value="' . rawurlencode($oDocument->getSummary(200)) . '">';
$embed .= '<input type="hidden" id="daumview_document_srl" value="' . $document_srl . '">';
$embed .= '<input type="hidden" id="daumview_link_url" value="' . $rssLinkUrl . '">';
// 썸네일 이미지 송고
if ($addon_info->thumbnail == 'yes') {
if ($addon_info->thumbnail_type) $thumbnail_type = $addon_info->thumbnail_type;
else $thumbnail_type = 'ratio';
if ($addon_info->thumbnail_width) $thumbnail_width = $addon_info->thumbnail_width;
else $thumbnail_width = 100;
if ($addon_info->thumbnail_height) $thumbnail_height = $addon_info->thumbnail_height;
else $thumbnail_height = 100;
$file_url = $oDocument->getThumbnail($thumbnail_width, $thumbnail_height, $addon_info->thumbnail_type);
$embed .= '<input type="hidden" id="daumview_file_url" value="' . rawurlencode($file_url) . '">';
} else {
$embed .= '<input type="hidden" id="daumview_file_url" value="">';
}
}
} else {
$embed .= '다음View에 가입되지 않았습니다. <a href="http://v.daum.net" target="_blank">http://v.daum.net</a>에서 가입 후 사용하실 수 있습니다.';
}
$embed .= '</div>';
if ($addon_info->muid && ($addon_info->view == 2 || $addon_info->view == 3))
$embed .= '<div style="text-align:center; width:100%; margin-top:10px; margin-bottom:10px;"><embed src="http://www.mixsh.com/widget/mixup/loader.html?muid=' . $addon_info->muid . '&guid=' . $rssLinkUrl . '&rdate=' . $oDocument->getRegdate('Y.m.d') . ' ' . $oDocument->getRegdate('H:i:s') .'&rawhtml=&skin=1&showhitcnt=1&platform=4" width="400" height="89" wmode="window" allowScriptAccess="always"></embed></div>';
$output = str_replace('<!--AfterDocument('.$document_srl, $embed.'<!--AfterDocument('.$document_srl, $output);
}
}
}
?>