wp_dashboard_browser_nag

Definition:
function wp_dashboard_browser_nag() {}

Source code

function wp_dashboard_browser_nag() {

	$notice = '';

	$response = wp_check_browser_version();



	if ( $response ) {

		if ( $response['insecure'] ) {

			$msg = sprintf( __( "It looks like you're using an insecure version of <a href='%s'>%s</a>. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser." ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ) );

		} else {

			$msg = sprintf( __( "It looks like you're using an old version of <a href='%s'>%s</a>. For the best WordPress experience, please update your browser." ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ) );

		}



		$browser_nag_class = '';

		if ( !empty( $response['img_src'] ) ) {

			$img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) )? $response['img_src_ssl'] : $response['img_src'];



			$notice .= '<div class="alignright browser-icon"><a href="' . esc_attr($response['update_url']) . '"><img src="' . esc_attr( $img_src ) . '" alt="" /></a></div>';

			$browser_nag_class = ' has-browser-icon';

		}

		$notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>";

15006

wp_credits

Definition:
function wp_credits() {}

Source code

function wp_credits() {

	global $wp_version;

	$locale = get_locale();



	$results = get_site_transient( 'wordpress_credits_' . $locale );



	if ( ! is_array( $results ) ) {

		$response = wp_remote_get( "http://api.wordpress.org/core/credits/1.0/?version=$wp_version&locale=$locale" );



		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )

			return false;



		$results = maybe_unserialize( wp_remote_retrieve_body( $response ) );



		if ( ! is_array( $results ) )

			return false;



		set_site_transient( 'wordpress_credits_' . $locale, $results, 86400 ); // One day

	}



	return $results;

}

15001

wp_check_browser_version

Definition:
function wp_check_browser_version() {}

Check if the user needs a browser update

Return values

returns:False on failure, array of browser data on success.

Source code

function wp_check_browser_version() {

	if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )

		return false;



	$key = md5( $_SERVER['HTTP_USER_AGENT'] );



	if ( false === ($response = get_site_transient('browser_' . $key) ) ) {

		global $wp_version;



		$options = array(

			'body'			=> array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),

			'user-agent'	=> 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )

		);



		$response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.0/', $options );



		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )

			return false;



		/**

		 * Response should be an array with:

		 *  'name' - string - A user friendly browser name

		 *  'version' - string - The most recent version of the browser

		 *  'current_version' - string - The version of the browser the user is using

		 *  'upgrade' - boolean - Whether the browser needs an upgrade

		 *  'insecure' - boolean - Whether the browser is deemed insecure

		 *  'upgrade_url' - string - The url to visit to upgrade

		 *  'img_src' - string - An image representing the browser

		 *  'img_src_ssl' - string - An image (over SSL) representing the browser

		 */

		$response = unserialize( wp_remote_retrieve_body( $response ) );



		if ( ! $response )

			return false;



		set_site_transient( 'browser_' . $key, $response, 604800 ); // cache for 1 week

	}



	return $response;

}

14965

wp_admin_bar_dashboard_view_site_menu

Definition:
function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {}

Add the "Dashboard"/"Visit Site" menu.

Parameters

  • $wp_admin_bar

Source code

function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {

	$user_id = get_current_user_id();



	if ( 0 != $user_id ) {

		if ( is_admin() )

			$wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );

		elseif ( is_multisite() )

			$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );

		else

			$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );

	}

}

14932

update_post_thumbnail_cache

Definition:
function update_post_thumbnail_cache() {}

Update cache for thumbnails in the current loop

Source code

function update_post_thumbnail_cache() {

	global $wp_query;



	if ( $wp_query->thumbnails_cached )

		return;



	$thumb_ids = array();

	foreach ( $wp_query->posts as $post ) {

		if ( $id = get_post_thumbnail_id( $post->ID ) )

			$thumb_ids[] = $id;

	}



	if ( ! empty ( $thumb_ids ) ) {

		get_posts( array(

				'update_post_term_cache' => false,

				'include' => $thumb_ids,

				'post_type' => 'attachment',

				'post_status' => 'inherit',

				'nopaging' => true

		) );

	}



	$wp_query->thumbnails_cached = true;

}

14820