function createMap() { global $database, $db; func::mkpath($this->cacheDir); if (!is_dir($this->cacheDir) || !is_writable($this->cacheDir)) return false; requireComponent('LZ.PHP.XMLStruct'); requireComponent('LZ.PHP.XMLWriter'); $case = array(); $program = array(); $xmls = new XMLStruct; $db->query("SELECT domain, program FROM {$database['prefix']}Exports WHERE status='on' ORDER BY id ASC"); // 활성화 된 플러그인 목록 while ($data = $db->fetch()) { if (!$xmls->openFile(ROOT . '/exports/'. $data->program . '/index.xml')) continue; for ($i=1; $func=$xmls->getValue("/export/binding/listener[$i]"); $i++) { $action = $xmls->getAttribute("/export/binding/listener[$i]", 'action'); if (!isset($case[$data->domain])) $case[$data->domain] = array(); if (!isset($program[$data->domain])) $program[$data->domain] = $data->program; array_push($case[$data->domain], array("program"=>$data->program, "action"=> $action, "listener"=>$func)); } } // bloglounge $xml = new XMLFile($this->cacheDir.'/export_1.xml.php'); $xml->startGroup('map'); foreach ($case as $domain=>$binders) { $xml->startGroup('event', array('domain'=>$domain, 'program'=>$program[$domain])); foreach ($binders as $bind) { $xml->write('bind', $bind['listener'], false, array('action'=>$bind['action'])); } $xml->endGroup(); } $xml->endAllGroups(); $xml->close(); return true; }
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) $IV = array('GET' => array('Name' => array('string'), 'Tab' => array('string', 'default' => 'about'))); require ROOT . '/library/preprocessor.php'; $targetURL = $context->getProperty('uri.host') . preg_replace('/(currentSetting)$/', 'receiveConfig', $context->getProperty('uri.folder')); $pluginName = $_GET['Name']; $tabName = $_GET['Tab']; $active = in_array($pluginName, $activePlugins); $result = handleConfig($pluginName); if (is_null($result)) { Respond::NotFoundPage(); } $xmls = new XMLStruct(); if (!$xmls->open(file_get_contents(ROOT . "/plugins/{$pluginName}/index.xml"))) { Respond::NotFoundPage(); } else { $pluginAttrs = array("link" => $xmls->getValue('/plugin/link[lang()]'), "title" => htmlspecialchars($xmls->getValue('/plugin/title[lang()]')), "version" => htmlspecialchars($xmls->getValue('/plugin/version[lang()]')), "requirements" => $xmls->doesExist('/plugin/requirements/tattertools') ? $xmls->getValue('/plugin/requirements/tattertools') : $xmls->getValue('/plugin/requirements/textcube'), "description" => htmlspecialchars($xmls->getValue('/plugin/description[lang()]')), "authorLink" => $xmls->getAttribute('/plugin/author[lang()]', 'link'), "author" => htmlspecialchars($xmls->getValue('/plugin/author[lang()]')), "license" => htmlspecialchars($xmls->getValue('/plugin/license[lang()]')), "scope" => array()); if ($xmls->doesExist('/plugin/binding/adminMenu')) { array_push($pluginAttrs['scope'], '관리자'); } if ($xmls->doesExist('/plugin/binding/tag')) { array_push($pluginAttrs['scope'], '블로그'); } if ($xmls->doesExist('/plugin/binding/center')) { array_push($pluginAttrs['scope'], '대시보드'); } if ($xmls->doesExist('/plugin/binding/listener')) { array_push($pluginAttrs['scope'], '분류없음'); } if ($xmls->doesExist('/plugin/binding/sidebar')) { array_push($pluginAttrs['scope'], '사이드바'); }
function getPluginInformation($plugin) { $xmls = new XMLStruct(); // Error checking routine if (!preg_match('@^[A-Za-z0-9 _-]+$@', $plugin)) { return false; } if (!file_exists(ROOT . "/plugins/{$plugin}/index.xml")) { return false; } if (!$xmls->open(file_get_contents(ROOT . "/plugins/{$plugin}/index.xml"))) { error_log("PLUGIN XML_PARSE_ERROR: " . $plugin . ": " . xml_error_string($xmls->error['code'])); return false; } else { // Determine plugin scopes. $scopeByXMLPath = array('admin' => '/plugin/binding/adminMenu', 'blog' => '/plugin/binding/tag', 'center' => '/plugin/binding/center', 'coverpage' => '/plugin/binding/coverpage', 'global' => '/plugin/binding/listener', 'sidebar' => '/plugin/binding/sidebar', 'editor' => '/plugin/binding/editor', 'formatter' => '/plugin/binding/formatter'); $pluginScope = array(); $scopeCount = 0; foreach ($scopeByXMLPath as $key => $value) { if ($xmls->doesExist($value)) { array_push($pluginScope, $key); $scopeCount = $scopeCount + 1; } } if ($scopeCount == 0) { array_push($pluginScope, 'none'); } // load plugin information. $maxVersion = max($xmls->getValue('/plugin/requirements/tattertools'), $xmls->getValue('/plugin/requirements/textcube')); $requiredVersion = empty($maxVersion) ? 0 : $maxVersion; $pluginInformation = array('link' => $xmls->getValue('/plugin/link[lang()]'), 'title' => $xmls->getValue('/plugin/title[lang()]'), 'version' => $xmls->getValue('/plugin/version[lang()]'), 'requirements' => $requiredVersion, 'scope' => $pluginScope, 'description' => $xmls->getValue('/plugin/description[lang()]'), 'authorLink' => $xmls->getAttribute('/plugin/author[lang()]', 'link'), 'author' => $xmls->getValue('/plugin/author[lang()]'), 'config' => $xmls->doesExist('/plugin/binding/config'), 'directory' => trim($plugin), 'width' => $xmls->getAttribute('/plugin/binding/config/window', 'width'), 'height' => $xmls->getAttribute('/plugin/binding/config/window', 'height'), 'privilege' => $xmls->getValue('/plugin/requirements/privilege')); return $pluginInformation; } return null; }
function importOPMLFromFile($blogid, $xml) { global $database, $service; $xmls = new XMLStruct(); if (!$xmls->open($xml, $service['encoding'])) { return array(1, null); } if ($xmls->getAttribute('/opml/body/outline', 'title')) { $result = array(0, 0); for ($i = 0; $xmls->getAttribute("/opml/body/outline[{$i}]", 'title'); $i++) { if ($xmls->getAttribute("/opml/body/outline[{$i}]", 'xmlUrl')) { $result[addFeed($blogid, $group = 0, $xmls->getAttribute("/opml/body/outline[{$i}]", 'xmlUrl'), false, $xmls->getAttribute("/opml/body/outline[{$i}]", 'htmlUrl'), $xmls->getAttribute("/opml/body/outline[{$i}]", 'title'), $xmls->getAttribute("/opml/body/outline[{$i}]", 'description'))] += 1; } for ($j = 0; $xmls->getAttribute("/opml/body/outline[{$i}]/outline[{$j}]", 'title'); $j++) { if ($xmls->getAttribute("/opml/body/outline[{$i}]/outline[{$j}]", 'xmlUrl')) { $result[addFeed($blogid, $group = 0, $xmls->getAttribute("/opml/body/outline[{$i}]/outline[{$j}]", 'xmlUrl'), false, $xmls->getAttribute("/opml/body/outline[{$i}]/outline[{$j}]", 'htmlUrl'), $xmls->getAttribute("/opml/body/outline[{$i}]/outline[{$j}]", 'title'), $xmls->getAttribute("/opml/body/outline[{$i}]/outline[{$j}]", 'description'))] += 1; } } } } else { return array(2, null); } return array(0, array('total' => array_sum($result), 'success' => $result[0])); }
requireComponent('LZ.PHP.XMLStruct'); $xmls = new XMLStruct; if (!$xmls->openFile(ROOT . '/exports/'.$programName.'/index.xml')) { func::alert(_t('프로그램 정보를 읽을 수 없습니다'), 'dialog'); } $exportInfo = array(); $exportInfo['domain'] = $domainName; $exportInfo['program'] = $programName; $exportInfo['title'] = $xmls->getValue('/export/information/name[lang()]'); $exportInfo['config'] = $xmls->selectNode('/export/config[lang()]'); $exportInfo['description'] = func::filterJavascript($xmls->getValue('/export/information/description[lang()]')); $exportInfo['license'] = func::filterJavascript($xmls->getValue('/export/information/license[lang()]')); $exportInfo['version'] = func::filterJavascript($xmls->getValue('/export/information/version')); $exportInfo['author'] = func::filterJavascript($xmls->getValue('/export/information/author[lang()]')); $exportInfo['email'] = func::filterJavascript($xmls->getAttribute('/export/information/author[lang()]', 'email')); $exportInfo['homepage'] = func::filterJavascript($xmls->getAttribute('/export/information/author[lang()]', 'link')); $exportInfo['status'] = Validator::getBool($db->queryCell("SELECT status FROM {$database['prefix']}Exports WHERE domain='{$domainName}'")); $exportInfo['tags'] = array(); $sNode = $xmls->selectNode('/export/binding'); if(isset($sNode['tag'])) { foreach($sNode['tag'] as $tag) { array_push($exportInfo['tags'], '[##_'.$tag['.attributes']['name'].'_##]'); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" />
function getDefaultCenterPanel($mapping) { $ctx = Model_Context::getInstance(); $blogid = $ctx->getProperty('blog.id'); ?> <div id="<?php echo $mapping['plugin']; ?> " class="section"> <h3 class="caption<?php echo isset($_REQUEST['edit']) ? ' visible' : ' invisible'; ?> "> <span><?php echo _t('알림판'); if (isset($_REQUEST['edit'])) { ?> <a id="<?php echo $mapping['plugin']; ?> widgetup" href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/center/dashboard?edit&pos=<?php echo $positionCounter; ?> &rel=-1&edit"><?php echo _t('위로'); ?> </a> <a id="<?php echo $mapping['plugin']; ?> widgetdown" href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/center/dashboard?edit&pos=<?php echo $positionCounter; ?> &rel=1&edit"><?php echo _t('아래로'); ?> </a> <?php } ?> </span> </h3> <?php if (isset($_REQUEST['edit'])) { ?> </div> <?php return true; } else { // Get default data $stats = Statistics::getStatistics($blogid); $latestEntryId = Setting::getBlogSettingGlobal('LatestEditedEntry_user' . getUserId(), 0); $comments = getRecentComments($blogid, 10); $guestbooks = getRecentGuestbook($blogid, 10); list($commentNotifies, $paging) = getCommentsNotifiedWithPagingForOwner($blogid, 0, null, null, null, 1, 10); $trackbacks = getRecentTrackbacks($blogid, 10); $recents = array(); // title, date, link, category foreach ($comments as $comment) { array_push($recents, array('title' => $comment['comment'], 'date' => $comment['written'], 'link' => $ctx->getProperty('uri.blog') . "/" . $comment['entry'] . "#comment" . $comment['id'], 'category' => 'comment')); } foreach ($commentNotifies as $comment) { array_push($recents, array('title' => $comment['comment'], 'date' => $comment['written'], 'link' => $ctx->getProperty('uri.blog') . "/owner/communication/notify", 'category' => 'commentNotify')); } foreach ($guestbooks as $guestbook) { array_push($recents, array('title' => $guestbook['comment'], 'date' => $guestbook['written'], 'link' => $ctx->getProperty('uri.blog') . "/guestbook/" . $guestbook['id'] . "#guestbook" . $guestbook['id'], 'category' => 'guestbook')); } foreach ($trackbacks as $trackback) { array_push($recents, array('title' => $trackback['subject'], 'date' => $trackback['written'], 'link' => $ctx->getProperty('uri.blog') . "/" . $trackback['entry'] . "#trackback" . $trackback['id'], 'category' => 'trackback')); } $sort_array = array(); foreach ($recents as $uniqid => $row) { // Sorting. foreach ($row as $key => $value) { if (!array_key_exists($key, $sort_array)) { $sort_array[$key] = array(); } $sort_array[$key][$uniqid] = $value; } } if (!empty($sort_array)) { array_multisort($sort_array['date'], SORT_DESC, $recents); } $recents = array_slice($recents, 0, 14); ?> <div id="shortcut-collection"> <h4 class="caption"><span><?php echo _t('바로가기'); ?> </span></h4> <ul> <li class="newPost"><a class="newPost" href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/entry/post"><span><?php echo _t('새 글 쓰기'); ?> </span></a></li> <?php if ($latestEntryId !== 0) { $latestEntry = getEntry($blogid, $latestEntryId); if (!is_null($latestEntry)) { ?> <li class="modifyPost"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/entry/edit/<?php echo $latestEntry['id']; ?> "><?php echo _f('최근글(%1) 수정', htmlspecialchars(Utils_Unicode::lessenAsEm($latestEntry['title'], 10))); ?> </a></li> <?php } } if ($ctx->getProperty('service.reader') == true) { ?> <li class="rssReader"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/network/reader"><?php echo _t('RSS로 등록한 이웃 글 보기'); ?> </a></li> <?php } if (Acl::check("group.administrators")) { ?> <li class="deleteCache"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/center/dashboard/cleanup" onclick="cleanupCache();return false;"><?php echo _t('캐시 지우기'); ?> </a></li> <?php if (Acl::check("group.creators")) { ?> <li class="optimizeStorage"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/data" onclick="optimizeData();return false;"><?php echo _t('저장소 최적화'); ?> </a></li> <?php } } ?> <li class="clear"></li> </ul> </div> <div id="total-information"> <h4 class="caption"><span><?php echo _t('요약'); ?> </span></h4> <table class="posts-line"> <caption><?php echo _t('글'); ?> </caption> <thead> <th>type</th> <th>sum</th> </thead> <tbody> <tr> <td class="type"><?php echo _t('글'); ?> </td> <td class="sum"><?php echo number_format(getEntriesTotalCount($blogid)); ?> </td> </tr> <tr> <td class="type"><?php echo _t('댓글'); ?> </td> <td class="sum"><?php echo number_format(getCommentCount($blogid)); ?> </td> </tr> <tr> <td class="type"><?php echo _t('방명록'); ?> </td> <td class="sum"><?php echo number_format(getGuestbookCount($blogid)); ?> </td> </tr> <tr> <td class="type"><?php echo _t('걸린 글'); ?> </td> <td class="sum"><?php echo number_format(getTrackbackCount($blogid)); ?> </td> </tr> </tbody> </table> <table class="visitors-line"> <caption><?php echo _t('방문자'); ?> </caption> <thead> <th>type</th> <th>sum</th> </thead> <tbody> <tr> <td class="type"><?php echo _t('오늘'); ?> </td> <td class="sum"><?php echo number_format($stats['today']); ?> </td> </tr> <tr> <td class="type"><?php echo _t('어제'); ?> </td> <td class="sum"><?php echo number_format($stats['yesterday']); ?> </td> </tr> <tr> <td class="type"><?php echo _t('7일 평균'); ?> </td> <td class="sum"><?php $weekly = Statistics::getWeeklyStatistics(); $weeklycount = 0; foreach ($weekly as $day) { $weeklycount += $day['visits']; } echo number_format($weeklycount / 7); unset($weekly); unset($weeklycount); ?> </td> </tr> <tr> <td class="type"><?php echo _t('총방문자'); ?> </td> <td class="sum"><?php echo number_format($stats['total']); ?> </td> </tr> </tbody> </table> </div> <div id="myBlogInfo"> <h4 class="caption"><span><a href="<?php echo $ctx->getProperty('uri.blog') . '/owner/communication/comment'; ?> "><?php echo _t('알림판'); ?> </a></span></h4> <table class="recent"> <caption>asdasd</caption> <thead> <tr> <th scope="col" class="date"><?php echo _t('날짜'); ?> </th> <th scope="col" class="category"><?php echo _t('종류'); ?> </th> <th scope="col"><?php echo _t('내용'); ?> </th> </tr> </thead> <tbody> <?php foreach ($recents as $item) { ?> <tr class="<?php echo $item['category']; ?> "> <td class="date"><?php echo Timestamp::format('%m/%d', $item['date']); ?> </td> <td class="category"> <?php switch ($item['category']) { case 'trackback': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/trackback?status=received">' . _t('걸린글') . '</a>'; break; case 'comment': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/comment?status=comment">' . _t('댓글') . '</a>'; break; case 'commentNotify': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/notify">' . _t('알리미') . '</a>'; break; case 'guestbook': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/comment?status=guestbook">' . _t('방명록') . '</a>'; break; } ?> </td> <td class="title"><a href="<?php echo $item['link']; ?> "><?php echo htmlspecialchars(Utils_Unicode::lessenAsEm($item['title'], 20)); ?> </a></td> </tr> <?php } ?> </tbody> </table> </div> <?php $noticeURL = TEXTCUBE_NOTICE_URL; $noticeURLRSS = $noticeURL . ($ctx->getProperty('blog.language') ? $ctx->getProperty('blog.language') : "ko") . "/rss"; $noticeEntries = array(); if (!is_null(Setting::getServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language')))) { $noticeEntries = unserialize(Setting::getServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language'))); } else { list($result, $feed, $xml) = getRemoteFeed($noticeURLRSS); if ($result == 0) { $xmls = new XMLStruct(); $xmls->setXPathBaseIndex(1); $noticeEntries = array(); if ($xmls->open($xml, $ctx->getProperty('service.encoding'))) { if ($xmls->getAttribute('/rss', 'version')) { for ($i = 1; $link = $xmls->getValue("/rss/channel/item[{$i}]/link"); $i++) { $item = array('permalink' => rawurldecode($link)); $item['title'] = $xmls->getValue("/rss/channel/item[{$i}]/title"); if ($xmls->getValue("/rss/channel/item[{$i}]/pubDate")) { $item['written'] = parseDate($xmls->getValue("/rss/channel/item[{$i}]/pubDate")); } else { if ($xmls->getValue("/rss/channel/item[{$i}]/dc:date")) { $item['written'] = parseDate($xmls->getValue("/rss/channel/item[{$i}]/dc:date")); } else { $item['written'] = 0; } } array_push($noticeEntries, $item); } } } Setting::setServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language'), serialize($noticeEntries)); } } ?> <div id="textcube-notice"> <h4 class="caption"><span><a href="<?php echo $noticeURL . ($ctx->getProperty('blog.language') ? $ctx->getProperty('blog.language') : "ko"); ?> "><?php echo _t('공지사항'); ?> </a></span></h4> <?php if (count($noticeEntries) > 0) { array_splice($noticeEntries, 3, count($noticeEntries) - 3); ?> <table> <tbody> <?php foreach ($noticeEntries as $item) { ?> <tr> <td class="date"><?php echo Timestamp::format2($item['written']); ?> </td> <td class="title"><a href="<?php echo $item['permalink']; ?> " onclick="return openLinkInNewWindow(this);" ><?php echo htmlspecialchars(Utils_Unicode::lessenAsEm($item['title'], 35)); ?> </a></td> </tr> <?php } ?> </tbody> </table> <?php } else { ?> <div id="fail-notice"> <?php echo _t('공지사항을 가져올 수 없습니다. 잠시 후 다시 시도해 주십시오.'); ?> </div> <?php } ?> </div> <?php } ?> </div> <?php }
function getFeedItems($xml) { if (preg_match('/^<\?xml[^<]*\s+encoding=["\']?([\w-]+)["\']?/', $xml, $matches)) // kor env $encoding = $matches[1]; if (strcasecmp($encoding, 'euc-kr') == 0) { $xml = UTF8::bring($xml, $encoding); $xml = preg_replace('/^(<\?xml[^<]*\s+encoding=)["\']?[\w-]+["\']?/', '$1"utf-8"', $xml, 1); } $xmls=new XMLStruct(); if (!$xmls->open($xml)) return false; $items = array(); if ($xmls->getAttribute('/rss','version')){ // rss element must have version attribute for ($i=1;$link=$xmls->getValue("/rss/channel/item[$i]/link");$i++){ $item=array('permalink'=>rawurldecode($link)); if (!$item['author']=$xmls->getValue("/rss/channel/item[$i]/author")) $item['author']=$xmls->getValue("/rss/channel/item[$i]/dc:creator"); $item['title']=$xmls->getValue("/rss/channel/item[$i]/title"); if (!$item['description']=$xmls->getValue("/rss/channel/item[$i]/content:encoded")) $item['description']=htmlspecialchars_decode($xmls->getValue("/rss/channel/item[$i]/description")); $item['tags']=array(); for ($j=1;$tag=$xmls->getValue("/rss/channel/item[$i]/category[$j]");$j++) if (!empty($tag)) { // array_push($item['tags'],$tag); $tags = explode('/', $tag); // allblog, blogkorea types foreach($tags as $tag) { array_push($item['tags'], trim($tag)); } } for ($j=1;$tag=$xmls->getValue("/rss/channel/item[$i]/subject[$j]");$j++) if (!empty($tag)) array_push($item['tags'],$tag); if ($youtubeTags = $xmls->getValue("/rss/channel/item[$i]/media:category")) { // for Youtube,Flickr Feed array_push($item['tags'], ''); // blank. first tag not equals category foreach (explode(' ', $youtubeTags) as $tag) { $tag = trim($tag); if(!empty($tag)) array_push($item['tags'], $tag); } } $item['enclosures']=array(); for ($j=1;$result=$xmls->getAttributes("/rss/channel/item[$i]/enclosure[$j]",array('url','type'));$j++) { if (!empty($result)) { array_push($item['enclosures'],array('url'=>$result[0],'type'=>$result[1])); } } $flickrContent=$xmls->getAttributes("/rss/channel/item[$i]/media:content[$j]",array('url','type')); // for flickr feed if(!empty($flickrContent)) { array_push($item['enclosures'],array('url'=>$flickrContent[0],'type'=>$flickrContent[1])); } if ($xmls->getValue("/rss/channel/item[$i]/pubDate")) $item['written']=Feed::parseDate($xmls->getValue("/rss/channel/item[$i]/pubDate")); elseif ($xmls->getValue("/rss/channel/item[$i]/dc:date")) $item['written']=Feed::parseDate($xmls->getValue("/rss/channel/item[$i]/dc:date")); else $item['written']=0; if (!$item['generator']=$xmls->getValue("/rss/channel/generator")) { if (strpos($item['permalink'], 'tvpot.daum.net') !== false) $item['generator'] = 'Daum Tvpot'; else $item['generator'] = 'Unknown'; } if (!$item['guid']=$xmls->getValue("/rss/channel/item[$i]/guid")) $item['guid'] = $item['permalink']; array_push($items, $item); } } elseif ($xmls->doesExist('/feed')){ // atom 0.3 for ($i=1;$link=$xmls->getValue("/feed/entry[$i]/id");$i++){ $item['enclosures']=array(); for ($j=1;$rel=$xmls->getAttribute("/feed/entry[$i]/link[$j]",'rel');$j++){ if ($rel=='alternate'){ $link=$xmls->getAttribute("/feed/entry[$i]/link[$j]",'href'); } else if($rel=='enclosure' || $rel=='image') { $result = $xmls->getAttributes("/feed/entry[$i]/link[$j]",array('href','type')); if($result) { array_push($item['enclosures'],array('url'=>$result[0],'type'=>$result[1])); } } } $item=array('permalink'=>rawurldecode($link),'enclosures'=>$item['enclosures']); $item['author']=$xmls->getValue("/feed/entry[$i]/author/name"); $item['title']=$xmls->getValue("/feed/entry[$i]/title"); if (!$item['description']=htmlspecialchars_decode($xmls->getValue("/feed/entry[$i]/content"))) $item['description']=htmlspecialchars_decode($xmls->getValue("/feed/entry[$i]/summary")); $item['tags']=array(); for ($j=1;$tag=$xmls->getValue("/feed/entry[$i]/dc:subject[$j]");$j++) { if (!empty($tag)) array_push($item['tags'],trim($tag)); } for ($j=1;$tag=$xmls->getAttribute("/feed/entry[$i]/category[$j]", 'term');$j++) { if (!empty($tag)) array_push($item['tags'],trim($tag)); } if (!$item['written']= $xmls->getValue("/feed/entry[$i]/issued")) { if (!$item['written'] = $xmls->getValue("/feed/entry[$i]/published")) { $item['written'] = $xmls->getValue("/feed/entry[$i]/updated"); } } $item['written'] = Feed::parseDate($item['written']); if (!$item['generator'] = $xmls->getValue("/feed/generator")) $item['generator'] = 'Unknown'; array_push($items, $item); } } elseif ($xmls->getAttribute('/rdf:RDF','xmlns')){ // rss 1.0, rdf for ($i=1;$link=$xmls->getValue("/rdf:RDF/item[$i]/link");$i++){ $item=array('permalink'=>rawurldecode($link)); if (!$item['author']=$xmls->getValue("/rdf:RDF/item[$i]/dc:creator")) $item['author']=$xmls->getValue("/rdf:RDF/item[$i]/author"); // for NaverBlog rss 1.0 $item['title']=$xmls->getValue("/rdf:RDF/item[$i]/title"); if (!$item['description']=$xmls->getValue("/rdf:RDF/item[$i]/content:encoded")) $item['description']=htmlspecialchars_decode($xmls->getValue("/rdf:RDF/item[$i]/description")); $item['tags']=array(); $item['enclosures']=array(); $item['written']=Feed::parseDate($xmls->getValue("/rdf:RDF/item[$i]/dc:date")); array_push($items, $item); } } else return false; return $items; }
$request = new HTTPRequest; if (!$cont = $request->getPage($_POST['importURL'])) { echo '<script type="text/javascript">alert("'._t('파일을 가져올 수 없습니다.\n정확한 주소가 맞는지 확인해 주세요.').'");</script>'; exit; } $xmls = new XMLStruct(); $xmls->open($cont, true); if (!$n = $xmls->getNodeCount("/opml/body/outline")) { echo '<script type="text/javascript">alert("'._t('바른 형식의 OPML 파일이 아닙니다.').'");</script>'; exit; } echo '<script type="text/javascript">"'._t('피드를 추가하고 있습니다').'";</script>'; flush(); $_feeder = new Feed; for ($i=1; $i <= $n; $i++) { $xmlURL = $xmls->getAttribute("/opml/body/outline[$i]", "xmlUrl"); if (empty($xmlURL)) continue; $_feeder->add($xmlURL); } } ?> <script type="text/javascript"> parent.document.location.reload(); </script> </body> </html>
function createMap() { global $database, $db; func::mkpath($this->cacheDir); if (!is_dir($this->cacheDir) || !is_writable($this->cacheDir)) return false; requireComponent('LZ.PHP.XMLStruct'); requireComponent('LZ.PHP.XMLWriter'); $case = array(); $tags = array(); $admins = array(); $xmls = new XMLStruct; $db->query("SELECT name FROM {$database['prefix']}Plugins WHERE status='on' ORDER BY name ASC"); // 활성화 된 플러그인 목록 while ($data = $db->fetch()) { if (!$xmls->openFile(ROOT . '/plugins/'. $data->name . '/index.xml')) continue; for ($i=1; $func=$xmls->getValue("/plugin/binding/listener[$i]"); $i++) { $event = $xmls->getAttribute("/plugin/binding/listener[$i]", 'event'); if (!isset($case[$event])) $case[$event] = array(); array_push($case[$event], array("plugin"=>$data->name, "listener"=>$func)); } for ($i=1; $func=$xmls->getValue("/plugin/binding/tag[$i]"); $i++) { $event = $xmls->getAttribute("/plugin/binding/tag[$i]", 'name'); if (!isset($tags[$event])) $tags[$event] = array(); array_push($tags[$event], array("plugin"=>$data->name, "listener"=>$func)); } if ($xmls->doesExist('/plugin/binding/admin')) { foreach ($xmls->selectNodes('/plugin/binding/admin') as $admin) { $menu = isset($admin['.attributes']['menu'])?$admin['.attributes']['menu']:'plugin'; if (!isset($admins[$menu])) $admins[$menu] = array(); $textFunc = isset($admin['text'][0]['.value'])?$admin['text'][0]['.value']:''; $pageFunc = isset($admin['page'][0]['.value'])?$admin['page'][0]['.value']:''; array_push($admins[$menu], array("plugin"=>$data->name, "text"=>$textFunc,"page"=>$pageFunc)); } } } // bloglounge $xml = new XMLFile($this->cacheDir.'/1.xml.php'); $xml->startGroup('map'); foreach ($case as $event=>$binders) { $xml->startGroup('event', array('name'=>$event)); foreach ($binders as $bind) { $xml->write('bind', $bind['listener'], false, array('plugin'=>$bind['plugin'])); } $xml->endGroup(); } foreach ($tags as $event=>$binders) { $xml->startGroup('tag', array('name'=>$event)); foreach ($binders as $bind) { $xml->write('bind', $bind['listener'], false, array('plugin'=>$bind['plugin'])); } $xml->endGroup(); } $xml->endAllGroups(); $xml->close(); // admin $xml = new XMLFile($this->cacheDir.'/admin.xml.php'); $xml->startGroup('map'); foreach ($admins as $event=>$binders) { $xml->startGroup('event', array('name'=>$event)); foreach ($binders as $bind) { $xml->write('bind', $bind['text'], false, array( 'plugin'=>$bind['plugin'],'event'=>'text')); $xml->write('bind', $bind['page'], false, array('plugin'=>$bind['plugin'],'event'=>'page')); } $xml->endGroup(); } // admin $xml->endAllGroups(); $xml->close(); return true; }