Advertisements

wp_dashboard_incoming_links_output

Definition:
function wp_dashboard_incoming_links_output() {}

Display incoming links dashboard widget content.

Source code

function wp_dashboard_incoming_links_output() {

	$widgets = get_option( 'dashboard_widget_options' );

	@extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP );

	$rss = fetch_feed( $url );



	if ( is_wp_error($rss) ) {

		if ( is_admin() || current_user_can('manage_options') ) {

			echo '<p>';

			printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());

			echo '</p>';

		}

		return;

	}



	if ( !$rss->get_item_quantity() ) {

		echo '<p>' . __('This dashboard widget queries <a href="http://blogsearch.google.com/">Google Blog Search</a> so that when another blog links to your site it will show up here. It has found no incoming links&hellip; yet. It’s okay — there is no rush.') . "</p>\n";

		$rss->__destruct();

		unset($rss);

		return;

	}



	echo "<ul>\n";



	if ( !isset($items) )

		$items = 10;



	foreach ( $rss->get_items(0, $items) as $item ) {

		$publisher = '';

		$site_link = '';

		$link = '';

		$content = '';

		$date = '';

		$link = esc_url( strip_tags( $item->get_link() ) );



		$author = $item->get_author();

		if ( $author ) {

			$site_link = esc_url( strip_tags( $author->get_link() ) );



			if ( !$publisher = esc_html( strip_tags( $author->get_name() ) ) )

				$publisher = __( 'Somebody' );

		} else {

		  $publisher = __( 'Somebody' );

		}

		if ( $site_link )

			$publisher = "<a href='$site_link'>$publisher</a>";

		else

			$publisher = "<strong>$publisher</strong>";



		$content = $item->get_content();

		$content = wp_html_excerpt($content, 50) . ' ...';



		if ( $link )

			/* translators: incoming links feed, %1$s is other person, %3$s is content */

			$text = __( '%1$s linked here <a href="%2$s">saying</a>, "%3$s"' );

		else

			/* translators: incoming links feed, %1$s is other person, %3$s is content */

			$text = __( '%1$s linked here saying, "%3$s"' );



		if ( !empty($show_date) ) {

			if ( !empty($show_author) || !empty($show_summary) )

				/* translators: incoming links feed, %4$s is the date */

				$text .= ' ' . __( 'on %4$s' );

			$date = esc_html( strip_tags( $item->get_date() ) );

			$date = strtotime( $date );

			$date = gmdate( get_option( 'date_format' ), $date );

		}



		echo "\t<li>" . sprintf( $text, $publisher, $link, $content, $date ) . "</li>\n";

	}



	echo "</ul>\n";

	$rss->__destruct();

	unset($rss);

}

3537

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: