diff options
Diffstat (limited to 'wp-admin')
-rw-r--r-- | wp-admin/edit-link-form.php | 5 | ||||
-rw-r--r-- | wp-admin/friends.php | 141 | ||||
-rw-r--r-- | wp-admin/index.php | 93 | ||||
-rw-r--r-- | wp-admin/menu.php | 3 |
4 files changed, 188 insertions, 54 deletions
diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php index faa4956..5534f1d 100644 --- a/wp-admin/edit-link-form.php +++ b/wp-admin/edit-link-form.php @@ -39,10 +39,15 @@ function xfn_check($class, $value = '', $type = 'check') { <div id="moremeta">
<div id="grabit" class="dbx-group">
+<?php autocomplete_css(); ?>
<fieldset id="categorydiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Categories') ?></h3>
<div class="dbx-content">
<p id="jaxcat"></p>
+<?php if ( current_user_can('manage_categories') ) : ?>
+<div id="searchresults" class="autocomplete"></div>
+<?php autocomplete_textbox( "wpmu-edit.php?action=searchcategories&search=", "newcat", "searchresults" ); ?>
+<?php endif; ?>
<ul id="categorychecklist"><?php dropdown_categories(get_settings('default_link_category')); ?></ul>
</div>
</fieldset>
diff --git a/wp-admin/friends.php b/wp-admin/friends.php new file mode 100644 index 0000000..f2b8a6b --- /dev/null +++ b/wp-admin/friends.php @@ -0,0 +1,141 @@ +<?php +require_once('admin.php'); +$title = __('Friends'); +$parent_file = 'index.php'; + +$links = get_bookmarks(); +if( is_array( $links ) ) { + include(ABSPATH . WPINC . '/simplepie.php'); + while( list( $key, $link ) = each( $links ) ) { + if( $link->link_rss ) { + $url = $link->link_rss; + } else { + $url = $link->link_url; + } + + // Create a new instance of the SimplePie object + $feed = new SimplePie(); + $feed->cache_location = ABSPATH . 'wp-content/cache'; + + // Set these Configuration Options + $feed->bypass_image_hotlink(); + $feed->strip_ads(true); + + $feed->feed_url($url); + // Initialize the whole SimplePie object. Read the feed, process it, parse it, cache it, and + // all that other good stuff. The feed's information will not be available to SimplePie before + // this is called. + $feed->init(); + // Check to see if there are more than zero errors (i.e. if there are any errors at all) + + if ($feed->data) { + $count = 0; + foreach($feed->get_items() as $item) { + if( $count > 3 ) + break; + $count++; + $items[ $item->get_date('U') ] = array( "link_id" => $link->link_id, "blog_url" => $feed->get_feed_link(), "blog_title" => $feed->get_feed_title(), "title" => $item->get_title(), "description" => $item->get_description(), "link" => $item->get_permalink(), "pubdate" => $item->get_date( "D, j M Y H:i:s O") ); + } + } + unset( $feed ); + } +} + +if( $_POST[ 'friend' ] ) { + $friend = wp_specialchars( $_POST[ 'friend' ] ); + $link = get_default_link_to_edit(); + $link->link_url = $friend; + wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') ); + if ( current_user_can( 'manage_categories' ) ) + wp_enqueue_script( 'ajaxcat' ); +} +require_once('admin-header.php'); +if( $friend ) { + include('edit-link-form.php'); +} else { +?> + +<div class="wrap"> + +<h2><?php _e('Friends'); ?></h2> + +<p>Your friends are bookmarked using the <a href="link-manager.php">Link Manager</a>. This is the latest news from their websites.</p> +<?php +?> +<form name="addlink" id="addlink" method="post" action="friends.php"> +Add another friend: <input type='text' name='friend' value='http://'> +<input type='submit'> +</form> +<br /> +<?php +if( is_array( $items ) ) { + reset( $items ); + krsort( $items ); + $blog_title = ''; + $count = 0; + foreach ($items as $item ) { + if( $blog_title != $item[ 'blog_title' ] ) { + ++ $count; + if ($count % 2) + $style = 'alternate'; + else + $style = ''; + if( $count != 1 ) + print "</div><br />"; // not the first time! + print "<div class='{$style}' style='padding: 5px; border: 1px solid #000'>"; + print "<div style='background: #94c6fa; color: #c3def1; border: 1px solid #000; padding: 2px;'><h3><a href='{$item[ 'blog_url' ]}/'>".wp_specialchars( $item[ 'blog_title' ] )."</a>  <sub><a href='link.php?link_id={$item[ 'link_id' ]}&action=edit'>(edit)</a></sub></h3></div>"; + $blog_title = $item[ 'blog_title' ]; + } + ?> + <div style='border-bottom: 1px dotted #333; padding: 5px;'> + <h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> — <?php printf(__('%s ago'), human_time_diff(strtotime($item['pubdate'], time() ) ) ); ?></h4> + <p><?php echo $item['description']; ?></p> + </div> + <?php + } +} else { + ?> + <p><?php _e("Below is the latest news from the official WordPress development blog, click on a title to read the full entry. If you need help with WordPress please see our <a href='http://codex.wordpress.org/'>great documentation</a> or if that doesn't help visit the <a href='http://wordpress.org/support/'>support forums</a>."); ?></p> + <?php + $rss = @fetch_rss('http://wordpress.org/development/feed/'); + if ( isset($rss->items) && 0 != count($rss->items) ) { + ?> + <h3><?php _e('WordPress Development Blog'); ?></h3> + <?php + $rss->items = array_slice($rss->items, 0, 3); + foreach ($rss->items as $item ) { + ?> + <h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> — <?php printf(__('%s ago'), human_time_diff(strtotime($item['pubdate'], time() ) ) ); ?></h4> + <p><?php echo $item['description']; ?></p> + <?php + } + } + $rss = @fetch_rss('http://planet.wordpress.org/feed/'); + if ( isset($rss->items) && 0 != count($rss->items) ) { + ?> + <div id="planetnews"> + <h3><?php _e('Other WordPress News'); ?> <a href="http://planet.wordpress.org/"><?php _e('more'); ?> »</a></h3> + <ul> + <?php + $rss->items = array_slice($rss->items, 0, 20); + foreach ($rss->items as $item ) { + ?> + <li><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a></li> + <?php + } + ?> + </ul> + </div> + <?php + } +} +?> +<div style="clear: both"> +<br clear="all" /> +</div> +</div> + +<?php +} // else $friend +require('./admin-footer.php'); +?> diff --git a/wp-admin/index.php b/wp-admin/index.php index 8455e80..91eb4cb 100644 --- a/wp-admin/index.php +++ b/wp-admin/index.php @@ -112,64 +112,49 @@ if (0 < $numcats) $numcats = number_format($numcats); <?php do_action('activity_box_end'); ?> </div> -<?php -$rss = @fetch_rss(get_site_option( 'dashboardfeed1' )); -$title = get_site_option( 'dashboardfeed1name' ); -if( get_site_option( 'customizefeed1' ) == 1 ) { - if( get_option( 'dashboardfeed1' ) == 0 ) { - $rss = @fetch_rss(get_option( 'dashboardfeed1' )); - $title = get_option( 'dashboardfeed1name' ); - } -} - -if( $rss == false ) { - $rss = @fetch_rss('http://wordpress.org/development/feed/'); - $title = "WordPress Development Blog"; -} - -if ( isset($rss->items) && 0 != count($rss->items) ) { - print "<h3>$title</h3>"; - $rss->items = array_slice($rss->items, 0, 3); - foreach ($rss->items as $item ) { -?> -<h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> — <?php printf(__('%s ago'), human_time_diff(strtotime($item['pubdate'], time() ) ) ); ?></h4> -<p><?php echo $item['description']; ?></p> -<?php - } -} -?> +<h3><?php _e('Welcome to WordPress MU'); ?></h3> +<p><?php _e('Use these links to get started:'); ?></p> -<?php -$rss = @fetch_rss(get_site_option( 'dashboardfeed2' )); -$title = get_site_option( 'dashboardfeed2name' ); -if( get_site_option( 'customizefeed2' ) == 1 ) { - if( get_option( 'dashboardfeed2' ) == 0 ) { - $rss = @fetch_rss(get_option( 'dashboardfeed2' )); - $title = get_option( 'dashboardfeed2name' ); - } -} -if( $rss == false ) { - $rss = @fetch_rss('http://wordpress.org/development/feed/'); -} - -if ( isset($rss->items) && 0 != count($rss->items) ) { -?> -<div id="planetnews"> -<h3><?php _e( $title ); ?> »</a></h3> <ul> -<?php -$rss->items = array_slice($rss->items, 0, 20); -foreach ($rss->items as $item ) { -?> -<li><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a></li> -<?php - } -?> +<li><a href="post-new.php"><?php _e('Write a post'); ?></a></li> +<li><a href="profile.php"><?php _e('Update your profile or change your password'); ?></a></li> +<li><a href="link-add.php"><?php _e('Add a bookmark to your blogroll'); ?></a></li> +<li><a href="themes.php"><?php _e('Change your site’s look or theme'); ?></a></li> </ul> -</div> -<?php -} + <p><?php _e("Below is the latest news from the official WordPress development blog, click on a title to read the full entry. If you need help with WordPress please see our <a href='http://codex.wordpress.org/'>great documentation</a> or if that doesn't help visit the <a href='http://wordpress.org/support/'>support forums</a>."); ?></p> + <?php + $rss = @fetch_rss('http://wordpress.org/development/feed/'); + if ( isset($rss->items) && 0 != count($rss->items) ) { + ?> + <h3><?php _e('WordPress Development Blog'); ?></h3> + <?php + $rss->items = array_slice($rss->items, 0, 3); + foreach ($rss->items as $item ) { + ?> + <h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> — <?php printf(__('%s ago'), human_time_diff(strtotime($item['pubdate'], time() ) ) ); ?></h4> + <p><?php echo $item['description']; ?></p> + <?php + } + } + $rss = @fetch_rss('http://planet.wordpress.org/feed/'); + if ( isset($rss->items) && 0 != count($rss->items) ) { + ?> + <div id="planetnews"> + <h3><?php _e('Other WordPress News'); ?> <a href="http://planet.wordpress.org/"><?php _e('more'); ?> »</a></h3> + <ul> + <?php + $rss->items = array_slice($rss->items, 0, 20); + foreach ($rss->items as $item ) { + ?> + <li><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a></li> + <?php + } + ?> + </ul> + </div> + <?php + } ?> <div style="clear: both"> <br clear="all" /> diff --git a/wp-admin/menu.php b/wp-admin/menu.php index b9571a0..6edff3e 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -23,6 +23,9 @@ else $menu[40] = array(__('Options'), 'manage_options', 'options-general.php'); +$submenu['index.php'][5] = array(__('Dashboard'), 'read', 'index.php'); +$submenu['index.php'][10] = array(__('Friends'), 'manage_links', 'friends.php'); + $submenu['post-new.php'][5] = array(__('Write Post'), 'edit_posts', 'post-new.php'); $submenu['post-new.php'][10] = array(__('Write Page'), 'edit_pages', 'page-new.php'); |