當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FeedItem::getIdByURL方法代碼示例

本文整理匯總了PHP中FeedItem::getIdByURL方法的典型用法代碼示例。如果您正苦於以下問題:PHP FeedItem::getIdByURL方法的具體用法?PHP FeedItem::getIdByURL怎麽用?PHP FeedItem::getIdByURL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FeedItem的用法示例。


在下文中一共展示了FeedItem::getIdByURL方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

<?php
	define('ROOT', '..');
	include ROOT . '/lib/include.php';
	include ROOT . '/lib/link.begin.php';	

	if(isset($accessInfo['action'])) {
		$id = $accessInfo['action'];	
		if(!is_numeric($id) || empty($id)) {
			$id = FeedItem::getIdByURL($accessInfo['address']);
		}

		$linker_post = FeedItem::getFeedItem($id);
		$linker_feed = Feed::getAll($linker_post['feed']);
		
		FeedItem::edit($linker_post['id'], 'click', $linker_post['click']+1);
	}

	if(!empty($config->linkskin)) {	
		$skin = new Skin;	
		$skin->load('link/'.$config->linkskin);

		include ROOT.'/lib/link/skin.begin.php';
			include ROOT . '/lib/piece/linker.php';	
		include ROOT.'/lib/link/skin.end.php';
	} else {
		if(isset($linker_post)) {	
			header('Location: ' . func::translate_uri($linker_post['permalink'])); // 한글주소 문제없이..
		}
	}
	
	include ROOT . '/lib/link.end.php';
開發者ID:ncloud,項目名稱:bloglounge,代碼行數:31,代碼來源:go.php

示例2: saveFeedItem

		function saveFeedItem($feedId,$feedVisibility,$item){
			global $database, $db, $event;

			$db->query("SELECT id FROM {$database['prefix']}DeleteHistory WHERE feed='$feedId' and permalink='{$item['permalink']}'");
			if ($db->numRows() > 0) 
				return false;
	
			if ($item['written']>gmmktime()+86400)
				return false;

			$item['title']=$db->escape($db->lessen(UTF8::correct($item['title'])));

			list($useRssOut) = Settings::gets('useRssOut');
		
			list($feedCreated,$localFilter,$localFilterType) = Feed::gets($feedId, 'created,filter,filterType');

			$tagString=$db->escape($db->lessen(UTF8::correct(implode(', ',$item['tags']))));

			list($globalFilter,$blackFilter,$globalFilterType,$blackFilterType) = Settings::gets('filter,blackfilter,filterType,blackfilterType');
			$filter = empty($globalFilter)?$localFilter:$globalFilter;
			$filterType = empty($globalFilter)?$localFilterType:$globalFilterType;


			if (!Validator::is_empty($filter)) {
				$filtered = true;				
				$allowTags = explode(',', $filter);

				if($filterType == 'tag' || $filterType == 'tag+title') {					
					foreach ($allowTags as $ftag) {
						if (Validator::enum($ftag, $tagString)) {
							$filtered = false;
							break;
						}
					}
				}

				if($filtered && ($filterType == 'title' || $filterType == 'tag+title')) {
					foreach ($allowTags as $ftag) {
						if(strpos($item['title'],$ftag)!==false) {
							$filtered = false;
							break;
						}
					}
				}

				if ($filtered) return false;
			}

			if (!Validator::is_empty($blackFilter)) {
				$filtered = false;
				$denyTags = explode(',', $blackFilter);
				if($blackFilterType == 'tag' || $blackFilterType == 'tag+title') {					
					foreach ($denyTags as $ftag) {
						if (Validator::enum($ftag, $tagString)) {
							$filtered = true;
							break;
						}
					}
				}
				if($filtered && ($filterType == 'title' || $filterType == 'tag+title')) {
					foreach ($denyTags as $ftag) {
						if(strpos($item['title'],$ftag)!==false) {
							$filtered = true;
							break;
						}
					}
				}

				if ($filtered) return false;
			}

			if (preg_match('/\((.[^\)]+)\)$/Ui', trim($item['author']), $_matches)) $item['author'] = $_matches[1];
			$item['author']=$db->escape($db->lessen(UTF8::correct($item['author'])));
			$item['permalink']=$db->escape($db->lessen(UTF8::correct($item['permalink'])));
			$item['description']=$db->escape($db->lessen(UTF8::correct(trim($item['description'])),65535));
			
			$enclosures = array();
			foreach($item['enclosures'] as $en) {
				array_push($enclosures, $en['url']);
			}

			$enclosureString=$db->escape($db->lessen(UTF8::correct(implode('|',$enclosures))));				

			$deadLine=0;
			$feedLife = Settings::get('archivePeriod');
			if ($feedLife > 0) $deadLine=gmmktime()-($feedLife*86400);

			requireComponent('Bloglounge.Data.FeedItems');

			$oldTags = null;
			$id = FeedItem::getIdByURL($item['permalink']);
			if($id === false && isset($item['guid'])) {
				$item['guid']=$db->escape($db->lessen(UTF8::correct($item['guid'])));
				$id = FeedItem::getIdByURL($item['guid']);
			}

			$item['author'] = Feed::getAuthor($item, $feedId, $id);
			$item['title'] = Feed::getTitle($item, $feedId, $id);

			$affected = 0;
//.........這裏部分代碼省略.........
開發者ID:ncloud,項目名稱:bloglounge,代碼行數:101,代碼來源:LZ.PHP.Feeder.php


注:本文中的FeedItem::getIdByURL方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。