当前位置: 首页>>代码示例>>PHP>>正文


PHP Feed::getTitle方法代码示例

本文整理汇总了PHP中Feed::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Feed::getTitle方法的具体用法?PHP Feed::getTitle怎么用?PHP Feed::getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Feed的用法示例。


在下文中一共展示了Feed::getTitle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render_rss_feed

/**
 * Render a sepecific feed instance
 *
 * @param Feed $feed
 * @param Smarty $smarty
 * @return null
 */
function render_rss_feed($feed, $header = true)
{
    if ($header) {
        header('Content-Type: text/xml; charset=utf-8');
    }
    // if
    $result = "<rss version=\"2.0\">\n<channel>\n";
    $result .= '<title>' . clean($feed->getTitle()) . "</title>\n";
    $result .= '<link>' . clean($feed->getLink()) . "</link>\n";
    if ($description = trim($feed->getDescription())) {
        $result .= '<description><![CDATA[' . clean($description) . "]]></description>\n";
    }
    // if
    if ($language = trim($feed->getLanguage())) {
        $result .= '<language>' . clean($language) . "</language>\n";
    }
    // if
    foreach ($feed->getItems() as $item) {
        $result .= "<item>\n";
        $result .= '<title>' . clean($item->getTitle()) . "</title>\n";
        $result .= '<link>' . clean($item->getLink()) . "</link>\n";
        if ($description = trim($item->getDescription())) {
            $result .= '<description><![CDATA[' . $description . "]]></description>\n";
        }
        // if
        $author = $item->getAuthor();
        if (instance_of($author, 'FeedAuthor')) {
            $result .= '<author>' . clean($author->getEmail()) . ' (' . clean($author->getName()) . ")</author>\n";
        }
        // if
        $pubdate = $item->getPublicationDate();
        if (instance_of($pubdate, 'DateValue')) {
            $result .= '<pubDate>' . $pubdate->toRSS() . "</pubDate>\n";
        }
        // if
        $id = $item->getId();
        if ($id) {
            $result .= '<guid>' . clean($id) . "</guid>\n";
        }
        // if
        $result .= "</item>\n";
    }
    // foreach
    $result .= "</channel>\n</rss>";
    return $result;
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:53,代码来源:init.php

示例2: save

    public function save(Feed $feed, $folderid)
    {
        $title = $feed->getTitle();
        $url = $feed->getUrl();
        $url_hash = md5($url);
        if (empty($title)) {
            $l = \OC_L10N::get('news');
            $title = $l->t('no title');
        }
        $favicon = $feed->getFavicon();
        //FIXME: Detect when feed contains already a database id
        $feedid = $this->findIdFromUrl($url);
        if ($feedid === null) {
            $query = \OCP\DB::prepare("\n\t\t\t\tINSERT INTO " . self::tableName . "(url, url_hash, title, favicon_link, folder_id, user_id, added, lastmodified)\n\t\t\t\tVALUES (?, ?, ?, ?, ?, ?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP())\n\t\t\t\t");
            $params = array($url, $url_hash, $title, $favicon, $folderid, $this->userid);
            $query->execute($params);
            $feedid = \OCP\DB::insertid(self::tableName);
        } else {
            //update the db. it needs to be done, since it might be the first save after a full fetch
            $stmt = \OCP\DB::prepare('
					UPDATE ' . self::tableName . ' SET favicon_link = ? , lastmodified = UNIX_TIMESTAMP() , folder_id = ?
					WHERE id = ?
					');
            $params = array($favicon, $folderid, $feedid);
            $stmt->execute($params);
        }
        $feed->setId($feedid);
        $itemMapper = new ItemMapper();
        $items = $feed->getItems();
        if ($items !== null) {
            foreach ($items as $item) {
                $itemMapper->save($item, $feedid);
            }
        }
        return $feedid;
    }
开发者ID:netcon-source,项目名称:apps,代码行数:36,代码来源:feedmapper.php

示例3: 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


注:本文中的Feed::getTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。