2006-11-18 18:12:39 -05:00
|
|
|
<?php
|
|
|
|
require_once('admin.php');
|
|
|
|
require_once (ABSPATH . WPINC . '/rss.php');
|
|
|
|
|
2007-06-02 01:21:18 -04:00
|
|
|
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
|
2007-02-06 15:12:53 -05:00
|
|
|
|
2008-02-02 02:57:51 -05:00
|
|
|
$widgets = get_option( 'dashboard_widget_options' );
|
2007-08-17 07:08:00 -04:00
|
|
|
|
2007-12-20 15:23:30 -05:00
|
|
|
|
2008-02-02 02:57:51 -05:00
|
|
|
switch ( $_GET['jax'] ) {
|
2007-08-17 07:08:00 -04:00
|
|
|
|
2008-02-02 02:57:51 -05:00
|
|
|
case 'incominglinks' :
|
|
|
|
@extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP );
|
|
|
|
$rss = @fetch_rss( $url );
|
2006-11-18 18:12:39 -05:00
|
|
|
if ( isset($rss->items) && 1 < count($rss->items) ) { // Technorati returns a 1-item feed when it has no results
|
|
|
|
?>
|
2007-12-20 15:23:30 -05:00
|
|
|
|
2006-11-18 18:12:39 -05:00
|
|
|
<ul>
|
|
|
|
<?php
|
2008-02-02 02:57:51 -05:00
|
|
|
$rss->items = array_slice($rss->items, 0, $items);
|
2006-11-18 18:12:39 -05:00
|
|
|
foreach ($rss->items as $item ) {
|
2008-02-02 02:57:51 -05:00
|
|
|
$publisher = '';
|
|
|
|
$site_link = '';
|
|
|
|
$link = '';
|
|
|
|
$content = '';
|
|
|
|
$date = '';
|
|
|
|
$link = clean_url( strip_tags( $item['link'] ) );
|
|
|
|
|
|
|
|
if ( isset( $item['author_uri'] ) )
|
|
|
|
$site_link = clean_url( strip_tags( $item['author_uri'] ) );
|
|
|
|
|
|
|
|
if ( !$publisher = wp_specialchars( strip_tags( isset($item['dc']['publisher']) ? $item['dc']['publisher'] : $item['author_name'] ) ) )
|
|
|
|
$publisher = __( 'Somebody' );
|
|
|
|
if ( $site_link )
|
|
|
|
$publisher = "<a href='$site_link'>$publisher</a>";
|
|
|
|
else
|
|
|
|
$publisher = "<strong>$publisher</strong>";
|
|
|
|
|
|
|
|
if ( isset($item['description']) )
|
|
|
|
$content = $item['description'];
|
|
|
|
elseif ( isset($item['summary']) )
|
|
|
|
$content = $item['summary'];
|
|
|
|
elseif ( isset($item['atom_content']) )
|
|
|
|
$content = $item['atom_content'];
|
|
|
|
else
|
|
|
|
$content = __( 'something' );
|
|
|
|
$content = strip_tags( $content );
|
|
|
|
if ( 50 < strlen($content) )
|
|
|
|
$content = substr($content, 0, 50) . ' ...';
|
|
|
|
$content = wp_specialchars( $content );
|
|
|
|
if ( $link )
|
|
|
|
$text = _c( '%1$s linked here <a href="%2$s">saying</a>, "%3$s"|feed_display' );
|
|
|
|
else
|
|
|
|
$text = _c( '%1$s linked here saying, "%3$s"|feed_display' );
|
|
|
|
|
|
|
|
if ( $show_date ) {
|
|
|
|
if ( $show_author || $show_summary )
|
|
|
|
$text .= _c( ' on %4$s|feed_display' );
|
|
|
|
$date = wp_specialchars( strip_tags( isset($item['pubdate']) ? $item['pubdate'] : $item['published'] ) );
|
|
|
|
$date = strtotime( $date );
|
|
|
|
$date = gmdate( get_option( 'date_format' ), $date );
|
|
|
|
}
|
|
|
|
|
2006-11-18 18:12:39 -05:00
|
|
|
?>
|
2008-02-02 02:57:51 -05:00
|
|
|
<li><?php printf( _c( "$text|feed_display" ), $publisher, $link, $content, $date ); ?></li>
|
2006-11-18 18:12:39 -05:00
|
|
|
<?php } ?>
|
|
|
|
</ul>
|
|
|
|
<?php
|
2007-12-20 15:23:30 -05:00
|
|
|
} else {
|
|
|
|
?>
|
|
|
|
<p><?php _e('No incoming links found... yet.'); ?></p>
|
|
|
|
<?php
|
2006-11-18 18:12:39 -05:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'devnews' :
|
2008-02-02 02:57:51 -05:00
|
|
|
wp_widget_rss_output( $widgets['dashboard_primary'] );
|
2006-11-18 18:12:39 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'planetnews' :
|
2008-02-02 02:57:51 -05:00
|
|
|
extract( $widgets['dashboard_secondary'], EXTR_SKIP );
|
|
|
|
$rss = @fetch_rss( $url );
|
2006-11-18 18:12:39 -05:00
|
|
|
if ( isset($rss->items) && 0 != count($rss->items) ) {
|
|
|
|
?>
|
|
|
|
<ul>
|
|
|
|
<?php
|
2008-02-02 02:57:51 -05:00
|
|
|
$rss->items = array_slice($rss->items, 0, $items);
|
2006-11-18 18:12:39 -05:00
|
|
|
foreach ($rss->items as $item ) {
|
|
|
|
$title = wp_specialchars($item['title']);
|
|
|
|
$author = preg_replace( '|(.+?):.+|s', '$1', $item['title'] );
|
|
|
|
$post = preg_replace( '|.+?:(.+)|s', '$1', $item['title'] );
|
|
|
|
?>
|
|
|
|
<li><a href='<?php echo wp_filter_kses($item['link']); ?>'><span class="post"><?php echo $post; ?></span><span class="hidden"> - </span><cite><?php echo $author; ?></cite></a></li>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|