本文整理汇总了PHP中parse_w3cdtf函数的典型用法代码示例。如果您正苦于以下问题:PHP parse_w3cdtf函数的具体用法?PHP parse_w3cdtf怎么用?PHP parse_w3cdtf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_w3cdtf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: smarty_modifier_rss_date_parse
function smarty_modifier_rss_date_parse($rss_date, $default_date = null)
{
if ($rss_date != '') {
return parse_w3cdtf($rss_date);
} elseif (isset($default_date) && $default_date != '') {
return parse_w3cdtf($default_date);
} else {
return;
}
}
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:10,代码来源:modifier.rss_date_parse.php
示例2: getRss
/**
* Récupère le flux RSS à partir d'une URL.
* Utilise MagpieRss http://magpierss.sourceforge.net/
*/
public function getRss($url, $nbMax = -1)
{
$arFeeds = array();
// Test and Create rss temp_dir
$cachePath = COPIX_CACHE_PATH . 'fluxrss/';
$cacheTestFile = 'rss.txt';
if (!file_exists($cachePath . $cacheTestFile)) {
require_once COPIX_UTILS_PATH . 'CopixFile.class.php';
$objectWriter = new CopixFile();
$objectWriter->write($cachePath . $cacheTestFile, date('Y/m/d H:i'));
}
// Use Magpie to parse current RSS file
define('MAGPIE_CACHE_DIR', COPIX_CACHE_PATH . 'rss');
require_once 'rss_fetch.inc';
$rss = fetch_rss($url);
if ($rss) {
if ($nbMax > 0) {
$arFeeds = array_slice($rss->items, 0, intval($nbMax));
} else {
$arFeeds = $rss->items;
}
}
foreach ($arFeeds as $key => $Feed) {
//print_r($Feed);
if (isset($Feed['dc']['date'])) {
$currentDate = @parse_w3cdtf($Feed['dc']['date']);
// Ok with dotclear that uses w3c date format
//var_dump($currentDate);
} else {
$currentDate = -1;
}
if ($currentDate != -1) {
$Feed['dc']['datecopix'] = date("Ymd", $currentDate);
if (!isset($Feed['date_timestamp'])) {
$Feed['date_timestamp'] = $currentDate;
}
} else {
if (isset($Feed['date_timestamp'])) {
// Ok with b2evolution that uses timestamp format
$Feed['dc']['datecopix'] = date('Ymd', $Feed['date_timestamp']);
} else {
$Feed['dc']['datecopix'] = null;
$Feed['date_timestamp'] = null;
}
}
//var_dump($Feed);
//die();
$arFeeds[$key] = $Feed;
}
return $arFeeds;
}
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:55,代码来源:fluxrssservices.class.php
示例3: MagpieRSSDate
function MagpieRSSDate($item)
{
# by http://www.pmwiki.org/wiki/Profiles/Mike
$date = "";
$rss_2_date = $item['pubdate'];
$rss_1_date = $item['dc']['date'];
$rss_3_date = $item['prism']['publicationDate'];
$atom_date = $item['issued'];
if ($atom_date != "") {
$date = parse_w3cdtf($atom_date);
}
if ($rss_1_date != "") {
$date = parse_w3cdtf($rss_1_date);
}
if ($rss_2_date != "") {
$date = strtotime($rss_2_date);
}
if ($rss_3_date != "") {
$date = parse_w3cdtf($rss_3_date);
}
if ($date == '-1') {
if ($atom_date != "") {
$date = strtotime($atom_date);
}
if ($rss_1_date != "") {
$date = strtotime($rss_1_date);
}
if ($rss_3_date != "") {
$date = strtotime($rss_3_date);
}
}
if ($date != "" && $date != '-1') {
$secondsinaday = 60 * 60 * 24;
$dateformat = 'd M Y';
$today = time();
$yesterday = time() - $secondsinaday;
$datetoday = date($dateformat, $today);
$dateyesterday = date($dateformat, $yesterday);
$daterss = date($dateformat, $date);
if ($daterss == $datetoday || $daterss == $dateyesterday) {
$color = 'red';
} else {
$color = 'gray';
}
return '<div class="magpie-date" style="color:' . $color . '">' . $daterss . '</div>';
}
return '';
}
开发者ID:anomen-s,项目名称:pmwiki-recipes,代码行数:48,代码来源:rssdisplay.php
示例4: getUnixTimestamp
public static function getUnixTimestamp($item)
{
$rss_2_date = $item['pubdate'];
$rss_1_date = $item['dc']['date'];
$atom_date = $item['issued'];
if ($atom_date != "") {
$date = parse_w3cdtf($atom_date);
}
if ($rss_1_date != "") {
$date = parse_w3cdtf($rss_1_date);
}
if ($rss_2_date != "") {
$date = strtotime($rss_2_date);
}
return $date;
}
开发者ID:jbzdak,项目名称:wikidot,代码行数:16,代码来源:MagpieFeed.php
示例5: rss_fetch_date_format
function rss_fetch_date_format($format, $item)
{
global $L_DATE_PATTERN;
$date = "";
if (isset($item['date_timestamp'])) {
$date = date($format, $item['date_timestamp']);
} else {
if (isset($item['dc']['date'])) {
$date = date($format, parse_w3cdtf($item['dc']['date']));
} else {
if (isset($item['pubdate'])) {
if (preg_match($L_DATE_PATTERN, $item['pubdate'])) {
$date = date($format, parse_w3cdtf(conv_date($item['pubdate'])));
} else {
// "$item['pubdate']"を上で変換出来なかった時はそのまま表示
$date = $item['pubdate'];
}
}
}
}
return $date;
}
开发者ID:ateliee,项目名称:php_lib,代码行数:22,代码来源:config.php
示例6: foreach
$_echo_LT5 = " (LT5!)";
}
foreach ($feed->items as $item) {
$check_sql = $sql = $ftime = $flink = $ftitle = $fdesc = '';
$we_have_a_date = TRUE;
if (@(!($flink = $item['link']))) {
$flink = $item['guid'];
}
$time = dst_test(time());
if (isset($item['pubdate'])) {
$stamp = bug_free_strtotime($item['pubdate']);
$stamp = dst_test($stamp);
$ftime = date("Y-m-d", $stamp) . "T" . date("H:i:s+01:00", $stamp);
$_date_from = "pubdate";
} elseif (isset($item['dc']['date'])) {
$stamp = parse_w3cdtf($item['dc']['date']);
$stamp = dst_test($stamp);
$ftime = date("Y-m-d", $stamp) . "T" . date("H:i:s+01:00", $stamp);
$_date_from = "dc:date";
} else {
$stamp = $time;
$ftime = date("Y-m-d", $stamp) . "T" . date("H:i:s+01:00", $stamp);
$we_have_a_date = FALSE;
$_date_from = "time()";
}
if (@(!($ftitle = $item['title']))) {
$ftitle = substr(strip_tags($fdesc), 0, 25) . "...";
}
$ftitle = str_replace("'", "\\'", $ftitle);
if (@(!($fdesc = $item['content']['encoded']))) {
if (@(!($fdesc = $item['description']))) {
开发者ID:BackupTheBerlios,项目名称:erona,代码行数:31,代码来源:cronup.php
示例7: define
define('MAGPIE_DIR', '/home/kellan/projs/magpierss/');
require_once MAGPIE_DIR . 'rss_fetch.inc';
require_once MAGPIE_DIR . 'rss_utils.inc';
// optionally show lots of debugging info
# define('MAGPIE_DEBUG', 2);
// optionally flush cache quickly for debugging purposes,
// don't do this on a live site
# define('MAGPIE_CACHE_AGE', 10);
// use cache? default is yes. see rss_fetch for other Magpie options
# define('MAGPIE_CACHE_ON', 1)
// setup template object
$smarty = new Smarty();
$smarty->compile_check = true;
// url of an rss file
$url = htmlspecialchars($_GET['rss_url'], ENT_QUOTES);
if ($url) {
// assign a variable to smarty for use in the template
$smarty->assign('rss_url', $url);
// use MagpieRSS to fetch remote RSS file, and parse it
$rss = fetch_rss($url);
// if fetch_rss returned false, we encountered an error
if (!$rss) {
$smarty->assign('error', magpie_error());
}
$smarty->assign('rss', $rss);
$item = $rss->items[0];
$date = parse_w3cdtf($item['dc']['date']);
$smarty->assign('date', $date);
}
// parse smarty template, and display using the variables we assigned
$smarty->display('simple.smarty');
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:simple_smarty.php
示例8: update_rss_feed
//.........这里部分代码省略.........
}
} else {
$entry_guid = $item["id"];
if (!$entry_guid) {
$entry_guid = $item["guid"];
}
if (!$entry_guid) {
$entry_guid = $item["about"];
}
if (!$entry_guid) {
$entry_guid = $item["link"];
}
if (!$entry_guid) {
$entry_guid = make_guid_from_title($item["title"]);
}
}
if ($debug_enabled) {
_debug("update_rss_feed: guid {$entry_guid}");
}
if (!$entry_guid) {
continue;
}
$entry_timestamp = "";
if ($use_simplepie) {
$entry_timestamp = strtotime($item->get_date());
} else {
$rss_2_date = $item['pubdate'];
$rss_1_date = $item['dc']['date'];
$atom_date = $item['issued'];
if (!$atom_date) {
$atom_date = $item['updated'];
}
if ($atom_date != "") {
$entry_timestamp = parse_w3cdtf($atom_date);
}
if ($rss_1_date != "") {
$entry_timestamp = parse_w3cdtf($rss_1_date);
}
if ($rss_2_date != "") {
$entry_timestamp = strtotime($rss_2_date);
}
}
if ($entry_timestamp == "" || $entry_timestamp == -1 || !$entry_timestamp) {
$entry_timestamp = time();
$no_orig_date = 'true';
} else {
$no_orig_date = 'false';
}
$entry_timestamp_fmt = strftime("%Y/%m/%d %H:%M:%S", $entry_timestamp);
if ($debug_enabled) {
_debug("update_rss_feed: date {$entry_timestamp} [{$entry_timestamp_fmt}]");
}
if ($use_simplepie) {
$entry_title = $item->get_title();
} else {
$entry_title = trim(strip_tags($item["title"]));
}
if ($use_simplepie) {
$entry_link = $item->get_link();
} else {
// strange Magpie workaround
$entry_link = $item["link_"];
if (!$entry_link) {
$entry_link = $item["link"];
}
}
开发者ID:nvdnkpr,项目名称:Tiny-Tiny-RSS,代码行数:67,代码来源:rssfuncs.php
示例9: _parse_date
/**
* Try to read the date and return as timestamp
*
* @param string $datestr
* @return int the date
*/
function _parse_date($datestr)
{
//$datestr = preg_replace("/^\s*([0-9]{1,2})[\/\. -]+([0-9]{1,2})[\/\. -]+([0-9]{2,4})/", "\\2/\\1/\\3", $datestr);
// $datestr = str_replace('/', '-', $datestr);
if (is_numeric($datestr)) {
return $datestr;
}
$date = strtotime($datestr);
if ($date == -1) {
$date = parse_w3cdtf($datestr);
}
if ($date == -1 || $date == "") {
$date = time();
}
return $date;
}
开发者ID:kentonquatman,项目名称:iofa,代码行数:22,代码来源:datagrab_model.php
示例10: date
$dccreator = $row['dccreator'];
$dcdate = $row['dcdate'];
$dcsubject = $row['dcsubject'];
print '<div class="item">';
print '<div class="header">';
print "<a class=\"headline\" href=\"{$item_link}\">{$item_title}</a> ";
print "<a class=\"feed\" href=\"{$feed_link}\" title=\"{$feed_description}\">{$feed_title}</a>";
print '<span class="meta">';
if ($dccreator) {
print "by {$dccreator} ";
}
if ($dcsubject) {
print "on {$dcsubject} ";
}
if ($dcdate) {
$dcdate = date("F j, Y, g:i a", parse_w3cdtf($dcdate) + $asec - FOF_TIME_OFFSET * 60 * 60);
print "at {$dcdate} ";
}
print "(cached at {$timestamp})</span>";
if (!$noedit) {
echo ' <span class="controls">';
print "<a href=\"javascript:flag_upto('c{$item_id}')\">flag all up to this item</a> ";
print "<input type=\"checkbox\" name=\"c{$item_id}\" value=\"checked\" />";
echo '</span>';
}
print "<div class=\"clearer\"></div><br/></div><div class=\"body\">{$item_content}</div></div>";
}
if (!$items) {
echo "No items found.";
}
if (!$noedit) {
开发者ID:radicaldesigns,项目名称:amp,代码行数:31,代码来源:view.php
示例11: strtotime
//gestion de la date de publication, selon le flux, elle se trouve parsee ? des endroits differents
if ($item['pubdate']) {
$aso_page['datestamp'] = strtotime($item['pubdate']);
} elseif ($item['dc']['date']) {
//en php5 on peut convertir les formats de dates exotiques plus facilement
if (PHP_VERSION >= 5) {
$aso_page['datestamp'] = strtotime($item['dc']['date']);
} else {
$aso_page['datestamp'] = parse_w3cdtf($item['dc']['date']);
}
} elseif ($item['issued']) {
//en php5 on peut convertir les formats de dates exotiques plus facilement
if (PHP_VERSION >= 5) {
$aso_page['datestamp'] = strtotime($item['issued']);
} else {
$aso_page['datestamp'] = parse_w3cdtf($item['issued']);
}
} else {
$aso_page['datestamp'] = time();
}
if ($formatdate != '') {
switch ($formatdate) {
case 'jm':
$aso_page['date'] = strftime('%d.%m', $aso_page['datestamp']);
break;
case 'jma':
$aso_page['date'] = strftime('%d.%m.%Y', $aso_page['datestamp']);
break;
case 'jmh':
$aso_page['date'] = strftime('%d.%m %H:%M', $aso_page['datestamp']);
break;
开发者ID:YesWiki,项目名称:yeswiki-sandstorm,代码行数:31,代码来源:syndication.php
示例12: get_feed_item_date
function get_feed_item_date($item)
{
//Is there an Atom date? If so, parse it.
if (isset($item['issued']) && ($atom_date = $item['issued'])) {
$date = parse_w3cdtf($atom_date);
} elseif (isset($item['pubdate']) && ($rss_2_date = $item['pubdate'])) {
$date = strtotime($rss_2_date);
} elseif (isset($item['dc']['date']) && ($rss_1_date = $item['dc']['date'])) {
$date = parse_w3cdtf($rss_1_date);
} else {
$date = null;
}
//Return a UNIX timestamp.
if ($date) {
return $date;
} else {
return 0;
}
}
开发者ID:Bencheci,项目名称:blueRavenStudiosProject,代码行数:19,代码来源:sds-blog.php
示例13: update
//.........这里部分代码省略.........
// Now let plugins modify the description
$description = rss_plugin_hook('rss.plugins.import.description', $description);
// link
if (array_key_exists('link', $item) && $item['link'] != "") {
$url = $item['link'];
} elseif (array_key_exists('guid', $item) && $item['guid'] != "") {
$url = $item['guid'];
} elseif (array_key_exists('link_', $item) && $item['link_'] != "") {
$url = $item['link_'];
} else {
// fall back to something basic
$url = md5($title);
}
// make sure the url is properly escaped
$url = htmlentities($url, ENT_QUOTES);
$url = rss_real_escape_string($url);
// author
if (array_key_exists('dc', $item) && array_key_exists('creator', $item['dc'])) {
// RSS 1.0
$author = $item['dc']['creator'];
} else {
if (array_key_exists('author_name', $item)) {
// Atom 0.3
$author = $item['author_name'];
} else {
$author = "";
}
}
$author = trim(strip_tags($author));
// pubdate
$cDate = -1;
if (array_key_exists('dc', $item) && array_key_exists('date', $item['dc'])) {
// RSS 1.0
$cDate = parse_w3cdtf($item['dc']['date']);
} elseif (array_key_exists('pubdate', $item)) {
// RSS 2.0 (?)
// We use the second param of strtotime here as a workaround
// of a PHP bug with strtotime. If the pubdate field doesn't
// contain seconds, the strtotime function will use the current
// time to fill in seconds in PHP4. This interferes with the
// update mechanism of gregarius. See ticket #328 for the full
// gory details. Giving a known date as a second param to
// strtotime fixes this problem, hence the 0 here.
$cDate = strtotime($item['pubdate'], 0);
} elseif (array_key_exists('published', $item)) {
// atom 1.0
$cDate = parse_iso8601($item['published']);
} elseif (array_key_exists('issued', $item)) {
//Atom, alternative
$cDate = parse_iso8601($item['issued']);
} elseif (array_key_exists('updated', $item)) {
//Atom, alternative
$cDate = parse_iso8601($item['updated']);
} elseif (array_key_exists('created', $item)) {
// atom 0.3
$cDate = parse_iso8601($item['created']);
}
// enclosure
if (array_key_exists('enclosure@url', $item)) {
$enclosure = $item['enclosure@url'];
// If the enclosure is an image, append it to the content
// but only if it isn't there yet
if ($enclosure && array_key_exists('enclosure@type', $item) && preg_match('#image/(png|gif|jpe?g)#', $item['enclosure@type']) && FALSE == strpos($description, $enclosure)) {
$description = '<img src="' . $enclosure . '" alt="" />' . $description;
$enclosure = '';
}
开发者ID:abdallahchamas,项目名称:haiti_tracker,代码行数:67,代码来源:util.php
示例14: normalize
function normalize()
{
// if atom populate rss fields and normalize 0.3 and 1.0 feeds
if ($this->is_atom()) {
// Atom 1.0 elements <=> Atom 0.3 elements (Thanks, o brilliant wordsmiths of the Atom 1.0 standard!)
if ($this->feed_version < 1.0) {
$this->normalize_element($this->channel, 'tagline', $this->channel, 'subtitle');
$this->normalize_element($this->channel, 'copyright', $this->channel, 'rights');
$this->normalize_element($this->channel, 'modified', $this->channel, 'updated');
} else {
$this->normalize_element($this->channel, 'subtitle', $this->channel, 'tagline');
$this->normalize_element($this->channel, 'rights', $this->channel, 'copyright');
$this->normalize_element($this->channel, 'updated', $this->channel, 'modified');
}
$this->normalize_element($this->channel, 'author', $this->channel['dc'], 'creator', 'normalize_atom_person');
$this->normalize_element($this->channel, 'contributor', $this->channel['dc'], 'contributor', 'normalize_atom_person');
// Atom elements to RSS elements
$this->normalize_element($this->channel, 'subtitle', $this->channel, 'description');
if (isset($this->channel['logo'])) {
$this->normalize_element($this->channel, 'logo', $this->image, 'url');
$this->normalize_element($this->channel, 'link', $this->image, 'link');
$this->normalize_element($this->channel, 'title', $this->image, 'title');
}
for ($i = 0; $i < count($this->items); $i++) {
$item = $this->items[$i];
// Atom 1.0 elements <=> Atom 0.3 elements
if ($this->feed_version < 1.0) {
$this->normalize_element($item, 'modified', $item, 'updated');
$this->normalize_element($item, 'issued', $item, 'published');
} else {
$this->normalize_element($item, 'updated', $item, 'modified');
$this->normalize_element($item, 'published', $item, 'issued');
}
// "If an atom:entry element does not contain
// atom:author elements, then the atom:author elements
// of the contained atom:source element are considered
// to apply. In an Atom Feed Document, the atom:author
// elements of the containing atom:feed element are
// considered to apply to the entry if there are no
// atom:author elements in the locations described
// above." <http://atompub.org/2005/08/17/draft-ietf-atompub-format-11.html#rfc.section.4.2.1>
if (!isset($item["author#"])) {
if (isset($item["source_author#"])) {
// from aggregation source
$source = $item;
$author = "source_author";
} elseif (isset($this->channel["author#"])) {
// from containing feed
$source = $this->channel;
$author = "author";
} else {
$author = null;
}
if (!is_null($author)) {
$item["author#"] = $source["{$author}#"];
for ($au = 1; $au <= $item["author#"]; $au++) {
$id_to = $this->element_id('author', $au);
$id_from = $this->element_id($author, $au);
$item[$id_to] = $source[$id_from];
foreach (array('name', 'email', 'uri', 'url') as $what) {
if (isset($source["{$id_from}_{$what}"])) {
$item["{$id_to}_{$what}"] = $source["{$id_from}_{$what}"];
}
}
}
}
}
// Atom elements to RSS elements
$this->normalize_element($item, 'author', $item['dc'], 'creator', 'normalize_atom_person');
$this->normalize_element($item, 'contributor', $item['dc'], 'contributor', 'normalize_atom_person');
$this->normalize_element($item, 'summary', $item, 'description');
$this->normalize_element($item, 'atom_content', $item['content'], 'encoded');
$this->normalize_element($item, 'link_enclosure', $item, 'enclosure', 'normalize_enclosure');
// Categories
if (isset($item['category#'])) {
// Atom 1.0 categories to dc:subject and RSS 2.0 categories
$this->normalize_element($item, 'category', $item['dc'], 'subject', 'normalize_category');
} elseif (isset($item['dc']['subject#'])) {
// dc:subject to Atom 1.0 and RSS 2.0 categories
$this->normalize_element($item['dc'], 'subject', $item, 'category', 'normalize_dc_subject');
}
// Normalized item timestamp
$atom_date = isset($item['published']) ? $item['published'] : $item['updated'];
if ($atom_date) {
$epoch = @parse_w3cdtf($atom_date);
if ($epoch and $epoch > 0) {
$item['date_timestamp'] = $epoch;
}
}
$this->items[$i] = $item;
}
} elseif ($this->is_rss()) {
// RSS elements to Atom elements
$this->normalize_element($this->channel, 'description', $this->channel, 'tagline');
// Atom 0.3
$this->normalize_element($this->channel, 'description', $this->channel, 'subtitle');
// Atom 1.0 (yay wordsmithing!)
$this->normalize_element($this->image, 'url', $this->channel, 'logo');
for ($i = 0; $i < count($this->items); $i++) {
$item = $this->items[$i];
//.........这里部分代码省略.........
开发者ID:jcbozonier,项目名称:master,代码行数:101,代码来源:rss.php
示例15: update_rss_feed_real
//.........这里部分代码省略.........
}
if (!$entry_guid) {
$entry_guid = make_guid_from_title($item->get_title());
}
} else {
$entry_guid = $item["id"];
if (!$entry_guid) {
$entry_guid = $item["guid"];
}
if (!$entry_guid) {
$entry_guid = $item["link"];
}
if (!$entry_guid) {
$entry_guid = make_guid_from_title($item["title"]);
}
}
if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) {
_debug("update_rss_feed: guid {$entry_guid}");
}
if (!$entry_guid) {
continue;
}
$entry_timestamp = "";
if ($use_simplepie) {
$entry_timestamp = strtotime($item->get_date());
} else {
$rss_2_date = $item['pubdate'];
$rss_1_date = $item['dc']['date'];
$atom_date = $item['issued'];
if (!$atom_date) {
$atom_date = $item['updated'];
}
if ($atom_date != "") {
$entry_timestamp = parse_w3cdtf($atom_date);
}
if ($rss_1_date != "") {
$entry_timestamp = parse_w3cdtf($rss_1_date);
}
if ($rss_2_date != "") {
$entry_timestamp = strtotime($rss_2_date);
}
}
if ($entry_timestamp == "" || $entry_timestamp == -1 || !$entry_timestamp) {
$entry_timestamp = time();
$no_orig_date = 'true';
} else {
$no_orig_date = 'false';
}
$entry_timestamp_fmt = strftime("%Y/%m/%d %H:%M:%S", $entry_timestamp);
if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) {
_debug("update_rss_feed: date {$entry_timestamp} [{$entry_timestamp_fmt}]");
}
if ($use_simplepie) {
$entry_title = $item->get_title();
} else {
$entry_title = trim(strip_tags($item["title"]));
}
if ($use_simplepie) {
$entry_link = $item->get_link();
} else {
// strange Magpie workaround
$entry_link = $item["link_"];
if (!$entry_link) {
$entry_link = $item["link"];
}
}
开发者ID:wangroot,项目名称:Tiny-Tiny-RSS,代码行数:67,代码来源:functions.php
示例16: elseif
$target = "_main";
if (strstr($_SERVER['HTTP_USER_AGENT'], "Opera")) {
$target = "_blank";
} elseif (strstr($_SERVER['HTTP_USER_AGENT'], "Gecko")) {
$target = "_content";
}
$sql = "SELECT id FROM user WHERE id=" . $_GET['p'] . " AND public=1";
$res = mysql_query($sql);
$row = mysql_fetch_array($res);
if ($row['id'] != $_GET['p']) {
die("Diese Feed-Sammlung ist nicht öffentlich.");
}
$sql = "SELECT i.url AS iurl, i.title AS ititle, i.date AS idate, f.title AS ftitle, f.url AS furl FROM items AS i LEFT JOIN user_feeds ON i.feed_id = user_feeds.feed_id LEFT JOIN feeds AS f ON i.feed_id = f.id WHERE user_feeds.user_id = " . $_GET['p'] . " ORDER BY i.date DESC LIMIT 10";
$res = mysql_query($sql) or die(mysql_error() . " {$sql}");
while ($row = mysql_fetch_array($res)) {
$stamp = parse_w3cdtf($row['idate']);
$stamp = dst_test($stamp);
$ftime = date("H:i", $stamp);
$ftitle = $row['ftitle'];
if (strlen($ftitle) > 20) {
$ftitle = substr($ftitle, 0, 16) . "...";
}
$ititle = $row['ititle'];
if (strlen($ititle) > 25) {
$ititle = substr($ititle, 0, 22) . "...";
}
echo '<p>• [' . $ftime . '] ' . $ftitle . '<br />';
echo '<a target="' . $target . '" href="' . $row['iurl'] . '" title="' . $row['ititle'] . '">' . $ititle . '</a></p>';
}
?>
<br />Powered by <a target="_content" href="http://" . ERONA_URL . ""><strong>eRONA</strong></a>
开发者ID:BackupTheBerlios,项目名称:erona,代码行数:31,代码来源:sidebar.php
示例17: foreach
// WRAPPING EVERYTHING BUT HEADER & FOOTER.
?>
<section class="wrap start-wrap group">
<!--<div class="colwrap">
<img src="<?php
echo BASE_URL;
?>
images/Logo-2012.png" id="icpc-live-logo" />
</div>-->
<div class="col2">
<?php
foreach ($rss->items as $item) {
$published = parse_w3cdtf($item['pubdate']);
?>
<article class="post">
<header class="entry-header">
<h1 class="entry-title"><?php
echo $item['title'];
?>
</h1>
<small class="pubdate"><?php
echo date("D, j M", strtotime($item['pubdate']));
?>
</small>
</header><!-- .entry-header -->
<div class="entry-content">
<?php
开发者ID:nikek,项目名称:wolf,代码行数:31,代码来源:view_start.php
示例18: RSSListUpdate
function RSSListUpdate(&$irc)
{
global $lastupdatetime;
global $SRB2MS_mute;
if ($SRB2MS_mute) {
return;
}
$RSS10content = $this->GenFeed();
$SRB2MSRSS10 = new MagpieRSS($RSS10content);
if ($SRB2MSRSS10) {
//$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun', 'Running SRB2 netgames ');
foreach ($SRB2MSRSS10->items as $item) {
if ($item['title'] == "No servers") {
// NOP
} elseif ($item['title'] == "No master server") {
// NOP
} else {
$published = parse_w3cdtf($item['dc']['date']);
if ($published >= $lastupdatetime) {
$title = $item['title'];
$serveraddress = $item['srb2ms']['address'];
$serverport = $item['srb2ms']['port'];
$serverversion = $item['srb2ms']['version'];
$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun', "New Server, {$serveraddress}:{$serverport} Name: {$title} Version: {$serverversion}");
//$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2general', "New Server, Name: $title $description");
} else {
// NOP
}
}
}
$today = getdate();
// update time
$lastupdatetime = mktime($today['hours'], $today['minutes'], 0, $today['mon'], $today['mday'], $today['year']);
} else {
$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun', '.magpie_error()');
$irc->message(SMARTIRC_TYPE_CHANNEL, '#srb2fun', 'The SRB2 MasterServer RSS feed is not up');
}
}
开发者ID:ToBeFree,项目名称:SRB2-Public,代码行数:38,代码来源:SRB2MS_Bot_beta.php
示例19: normalize
function normalize()
{
// if atom populate rss fields
if ($this->is_atom()) {
$this->channel['description'] = $this->channel['tagline'];
for ($i = 0; $i < count($this->items); $i++) {
$item = $this->items[$i];
if (isset($item['summary'])) {
$item['description'] = $item['summary'];
}
if (isset($item['atom_content'])) {
$item['content']['encoded'] = $item['atom_content'];
}
$atom_date = isset($item['issued']) ? $item['issued'] : $item['modified'];
if ($atom_date) {
$epoch = @parse_w3cdtf($atom_date);
if ($epoch and $epoch > 0) {
$item['date_timestamp'] = $epoch;
}
}
$this->items[$i] = $item;
}
} elseif ($this->is_rss()) {
$this->channel['tagline'] = $this->channel['description'];
for ($i = 0; $i < count($this->items); $i++) {
$item = $this->items[$i];
if (isset($item['description'])) {
$item['summary'] = $item['description'];
}
if (isset($item['content']['encoded'])) {
$item['atom_content'] = $item['content']['encoded'];
}
if ($this->is_rss() == '1.0' and isset($item['dc']['date'])) {
$epoch = @parse_w3cdtf($item['dc']['date']);
if ($epoch and $epoch > 0) {
$item['date_timestamp'] = $epoch;
}
} elseif (isset($item['pubdate'])) {
$epoch = @strtotime($item['pubdate']);
if ($epoch > 0) {
$item['date_timestamp'] = $epoch;
}
}
$this->items[$i] = $item;
}
}
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:47,代码来源:rss_parse.inc.php
示例20: updated
function updated($fallback = true, $default = -1)
{
$epoch = null;
# As far as I know, only dcterms and Atom have reliable ways to
# specify when something was *modified* last. If neither is
# available, then we'll try to get the time of publication.
if (isset($this->item['dc']['modified'])) {
// Not really correct
$epoch = @parse_w3cdtf($this->item['dc']['modified']);
} elseif (isset($this->item['dcterms']['modified'])) {
// Dublin Core extensions
$epoch = @parse_w3cdtf($this->item['dcterms']['modified']);
} elseif (isset($this->item['modified'])) {
// Atom 0.3
$epoch = @parse_w3cdtf($this->item['modified']);
} elseif (isset($this->item['updated'])) {
// Atom 1.0
$epoch = @parse_w3cdtf($this->item['updated']);
} elseif ($fallback) {
// Fall back to issued / dc:date
$epoch = $this->published(false, $default);
}
# If everything failed, then default to the current time.
if (is_null($epoch)) {
if (-1 == $default) {
$epoch = time();
} else {
$epoch = $default;
}
}
return $epoch;
}
开发者ID:jcbozonier,项目名称:master,代码行数:32,代码来源:feedwordpress.php
注:本文中的parse_w3cdtf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论