WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/02/2008 07:57:51 AM (14 years ago)
Author:
ryan
Message:

New dashboard from mdawaffe. see #5750

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/index-extra.php

    r6431 r6705  
    55@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    66
     7$widgets = get_option( 'dashboard_widget_options' );
     8
     9
    710switch ( $_GET['jax'] ) {
    811
    912case 'incominglinks' :
    10 
    11 $rss_feed = apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=10&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) );
    12 
    13 
    14 $rss = @fetch_rss( $rss_feed );
     13@extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP );
     14$rss = @fetch_rss( $url );
    1515if ( isset($rss->items) && 1 < count($rss->items) ) { // Technorati returns a 1-item feed when it has no results
    1616?>
     
    1818<ul>
    1919<?php
    20 $rss->items = array_slice($rss->items, 0, 10);
     20$rss->items = array_slice($rss->items, 0, $items);
    2121foreach ($rss->items as $item ) {
     22    $publisher = '';
     23    $site_link = '';
     24    $link = '';
     25    $content = '';
     26    $date = '';
     27    $link = clean_url( strip_tags( $item['link'] ) );
     28
     29    if ( isset( $item['author_uri'] ) )
     30        $site_link = clean_url( strip_tags( $item['author_uri'] ) );
     31
     32    if ( !$publisher = wp_specialchars( strip_tags( isset($item['dc']['publisher']) ? $item['dc']['publisher'] : $item['author_name'] ) ) )
     33        $publisher = __( 'Somebody' );
     34    if ( $site_link )
     35        $publisher = "<a href='$site_link'>$publisher</a>";
     36    else
     37        $publisher = "<strong>$publisher</strong>";
     38
     39    if ( isset($item['description']) )
     40        $content = $item['description'];
     41    elseif ( isset($item['summary']) )
     42        $content = $item['summary'];
     43    elseif ( isset($item['atom_content']) )
     44        $content = $item['atom_content'];
     45    else
     46        $content = __( 'something' );
     47    $content = strip_tags( $content );
     48    if ( 50 < strlen($content) )
     49        $content = substr($content, 0, 50) . ' ...';
     50    $content = wp_specialchars( $content );
     51    if ( $link )
     52        $text = _c( '%1$s linked here <a href="%2$s">saying</a>, "%3$s"|feed_display' );
     53    else
     54        $text = _c( '%1$s linked here saying, "%3$s"|feed_display' );
     55
     56    if ( $show_date ) {
     57        if ( $show_author || $show_summary )
     58            $text .= _c( ' on %4$s|feed_display' );
     59        $date = wp_specialchars( strip_tags( isset($item['pubdate']) ? $item['pubdate'] : $item['published'] ) );
     60        $date = strtotime( $date );
     61        $date = gmdate( get_option( 'date_format' ), $date );
     62    }
     63
    2264?>
    23     <li><a href="<?php echo wp_filter_kses($item['link']); ?>"><?php echo wptexturize(wp_specialchars($item['title'])); ?></a></li>
     65    <li><?php printf( _c( "$text|feed_display" ), $publisher, $link, $content, $date ); ?></li>
    2466<?php } ?>
    2567</ul>
     
    3375
    3476case 'devnews' :
    35 $rss = @fetch_rss(apply_filters( 'dashboard_primary_feed', 'http://wordpress.org/development/feed/' ));
    36 if ( isset($rss->items) && 0 != count($rss->items) ) {
    37 
    38 $rss->items = array_slice($rss->items, 0, 2);
    39 foreach ($rss->items as $item ) {
    40 ?>
    41 <h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> <?php gmdate( 'Y/m/d', strtotime( $item['pubdate'] ) ); ?></h4>
    42 <p><?php echo $item['description']; ?></p>
    43 <?php
    44     }
    45 }
    46 ?>
    47 
    48 <?php
     77wp_widget_rss_output( $widgets['dashboard_primary'] );
    4978break;
    5079
    5180case 'planetnews' :
    52 $rss = @fetch_rss(apply_filters( 'dashboard_secondary_feed', 'http://planet.wordpress.org/feed/' ));
     81extract( $widgets['dashboard_secondary'], EXTR_SKIP );
     82$rss = @fetch_rss( $url );
    5383if ( isset($rss->items) && 0 != count($rss->items) ) {
    5484?>
    55 <h3><?php echo apply_filters( 'dashboard_secondary_title', __('Other WordPress News') ); ?></h3>
    5685<ul>
    5786<?php
    58 $rss->items = array_slice($rss->items, 0, 20);
     87$rss->items = array_slice($rss->items, 0, $items);
    5988foreach ($rss->items as $item ) {
    6089$title = wp_specialchars($item['title']);
     
    6796?>
    6897</ul>
    69 <p class="readmore"><a href="<?php echo apply_filters( 'dashboard_secondary_link', 'http://planet.wordpress.org/' ); ?>"><?php _e('Read more &raquo;'); ?></a></p>
    7098<?php
    7199}
Note: See TracChangeset for help on using the changeset viewer.