Changeset 10666 for trunk/wp-includes/widgets.php
- Timestamp:
- 02/27/2009 07:32:50 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/widgets.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/widgets.php
r10535 r10666 1502 1502 return; 1503 1503 1504 require_once(ABSPATH . WPINC . '/rss.php'); 1505 1506 $rss = fetch_rss($url); 1507 $link = clean_url(strip_tags($rss->channel['link'])); 1504 $rss = fetch_feed($url); 1505 $link = clean_url(strip_tags($rss->get_permalink())); 1508 1506 while ( strstr($link, 'http') != $link ) 1509 1507 $link = substr($link, 1); 1510 $desc = attribute_escape(strip_tags(html_entity_decode($rss-> channel['description'], ENT_QUOTES)));1508 $desc = attribute_escape(strip_tags(html_entity_decode($rss->get_description(), ENT_QUOTES))); 1511 1509 $title = $options[$number]['title']; 1512 1510 if ( empty($title) ) 1513 $title = htmlentities(strip_tags($rss-> channel['title']));1511 $title = htmlentities(strip_tags($rss->get_title())); 1514 1512 if ( empty($title) ) 1515 1513 $title = $desc; … … 1542 1540 function wp_widget_rss_output( $rss, $args = array() ) { 1543 1541 if ( is_string( $rss ) ) { 1544 require_once(ABSPATH . WPINC . '/rss.php'); 1545 if ( !$rss = fetch_rss($rss) ) 1542 if ( !$rss = fetch_feed($rss) ) 1546 1543 return; 1547 1544 } elseif ( is_array($rss) && isset($rss['url']) ) { 1548 require_once(ABSPATH . WPINC . '/rss.php');1549 1545 $args = $rss; 1550 if ( !$rss = fetch_ rss($rss['url']) )1546 if ( !$rss = fetch_feed($rss['url']) ) 1551 1547 return; 1552 1548 } elseif ( !is_object($rss) ) { … … 1565 1561 $show_date = (int) $show_date; 1566 1562 1567 if ( is_array( $rss->items ) && !empty( $rss->items ) ) { 1568 $rss->items = array_slice($rss->items, 0, $items); 1569 echo '<ul>'; 1570 foreach ( (array) $rss->items as $item ) { 1571 while ( strstr($item['link'], 'http') != $item['link'] ) 1572 $item['link'] = substr($item['link'], 1); 1573 $link = clean_url(strip_tags($item['link'])); 1574 $title = attribute_escape(strip_tags($item['title'])); 1575 if ( empty($title) ) 1576 $title = __('Untitled'); 1577 $desc = ''; 1578 if ( isset( $item['description'] ) && is_string( $item['description'] ) ) 1579 $desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['description'], ENT_QUOTES)))); 1580 elseif ( isset( $item['summary'] ) && is_string( $item['summary'] ) ) 1581 $desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['summary'], ENT_QUOTES)))); 1582 if ( 360 < strlen( $desc ) ) 1583 $desc = wp_html_excerpt( $desc, 360 ) . ' […]'; 1584 $summary = $desc; 1585 1586 if ( $show_summary ) { 1587 $desc = ''; 1588 $summary = wp_specialchars( $summary ); 1589 $summary = "<div class='rssSummary'>$summary</div>"; 1590 } else { 1591 $summary = ''; 1563 if ( !$rss->get_item_quantity() ) { 1564 echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>'; 1565 return; 1566 } 1567 1568 echo '<ul>'; 1569 foreach ( $rss->get_items(0, $items) as $item ) { 1570 $link = $item->get_link(); 1571 while ( strstr($link, 'http') != $link ) 1572 $link = substr($link, 1); 1573 $link = clean_url(strip_tags($link)); 1574 $title = attribute_escape(strip_tags($item->get_title())); 1575 if ( empty($title) ) 1576 $title = __('Untitled'); 1577 1578 $desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item->get_description(), ENT_QUOTES)))); 1579 $desc = wp_html_excerpt( $desc, 360 ) . ' […]'; 1580 $desc = wp_specialchars( $desc ); 1581 1582 if ( $show_summary ) { 1583 $summary = "<div class='rssSummary'>$desc</div>"; 1584 } else { 1585 $summary = ''; 1586 } 1587 1588 $date = ''; 1589 if ( $show_date ) { 1590 $date = $item->get_date(); 1591 1592 if ( $date ) { 1593 if ( $date_stamp = strtotime( $date ) ) 1594 $date = ' <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date_stamp ) . '</span>'; 1595 else 1596 $date = ''; 1592 1597 } 1593 1594 $date = ''; 1595 if ( $show_date ) { 1596 if ( isset($item['pubdate']) ) 1597 $date = $item['pubdate']; 1598 elseif ( isset($item['published']) ) 1599 $date = $item['published']; 1600 1601 if ( $date ) { 1602 if ( $date_stamp = strtotime( $date ) ) 1603 $date = ' <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date_stamp ) . '</span>'; 1604 else 1605 $date = ''; 1606 } 1607 } 1608 1609 $author = ''; 1610 if ( $show_author ) { 1611 if ( isset($item['dc']['creator']) ) 1612 $author = ' <cite>' . wp_specialchars( strip_tags( $item['dc']['creator'] ) ) . '</cite>'; 1613 elseif ( isset($item['author_name']) ) 1614 $author = ' <cite>' . wp_specialchars( strip_tags( $item['author_name'] ) ) . '</cite>'; 1615 } 1616 1617 if ( $link == '' ) { 1618 echo "<li>$title{$date}{$summary}{$author}</li>"; 1619 } else { 1620 echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>"; 1621 } 1622 } 1623 echo '</ul>'; 1624 } else { 1625 echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>'; 1626 } 1598 } 1599 1600 $author = ''; 1601 if ( $show_author ) { 1602 $author = $item->get_author(); 1603 $author = $author->get_name(); 1604 $author = ' <cite>' . wp_specialchars( strip_tags( $author ) ) . '</cite>'; 1605 } 1606 1607 if ( $link == '' ) { 1608 echo "<li>$title{$date}{$summary}{$author}</li>"; 1609 } else { 1610 echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>"; 1611 } 1612 } 1613 echo '</ul>'; 1627 1614 } 1628 1615 … … 1811 1798 1812 1799 if ( $check_feed ) { 1813 require_once(ABSPATH . WPINC . '/rss.php'); 1814 $rss = fetch_rss($url); 1800 $rss = fetch_feed($url); 1815 1801 $error = false; 1816 1802 $link = ''; … … 1819 1805 $error = sprintf(__('Error in RSS %1$d'), $widget_number ); 1820 1806 } else { 1821 $link = clean_url(strip_tags($rss-> channel['link']));1807 $link = clean_url(strip_tags($rss->get_permalink())); 1822 1808 while ( strstr($link, 'http') != $link ) 1823 1809 $link = substr($link, 1);
Note: See TracChangeset
for help on using the changeset viewer.