human_time_diff

Definition:
function human_time_diff( $from, $to = '' ) {}

Determines the difference between two timestamps.
The difference is returned in a human readable format such as "1 hour", "5 mins", "2 days".

Parameters

  • int $from: Unix timestamp from which the difference begins.
  • int $to: Optional. Unix timestamp to end the time difference. Default becomes time() if not set.

Return values

returns:Human readable time difference.

Source code

function human_time_diff( $from, $to = '' ) {

	if ( empty($to) )

		$to = time();

	$diff = (int) abs($to - $from);

	if ($diff <= 3600) {

		$mins = round($diff / 60);

		if ($mins <= 1) {

			$mins = 1;

		}

		/* translators: min=minute */

		$since = sprintf(_n('%s min', '%s mins', $mins), $mins);

	} else if (($diff <= 86400) && ($diff > 3600)) {

		$hours = round($diff / 3600);

		if ($hours <= 1) {

			$hours = 1;

		}

		$since = sprintf(_n('%s hour', '%s hours', $hours), $hours);

	} elseif ($diff >= 86400) {

		$days = round($diff / 86400);

		if ($days <= 1) {

			$days = 1;

		}

		$since = sprintf(_n('%s day', '%s days', $days), $days);

	}

	return $since;

}

1959

html_type_rss

Definition:
function html_type_rss() {}

Display the HTML type based on the blog setting.
The two possible values are either ‘xhtml’ or ‘html’.

Source code

function html_type_rss() {

	$type = get_bloginfo('html_type');

	if (strpos($type, 'xhtml') !== false)

		$type = 'xhtml';

	else

		$type = 'html';

	echo $type;

}

1957

htmlentities2

Definition:
function htmlentities2($myHTML) {}

Convert entities, while preserving already-encoded entities.

Parameters

  • string $myHTML: The text to be converted.

Return values

returns:Converted text.

Source code

function htmlentities2($myHTML) {

	$translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES );

	$translation_table[chr(38)] = '&';

	return preg_replace( "/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&amp;", strtr($myHTML, $translation_table) );

}

1955

home_url

Definition:
function home_url( $path = '', $scheme = null ) {}

Retrieve the home url for the current site.
Returns the ‘home’ option with the appropriate protocol, ‘https’ if is_ssl() and ‘http’ otherwise. If $scheme is ‘http’ or ‘https’, is_ssl() is overridden.

Parameters

  • string $path: (optional) Path relative to the home url.
  • string $scheme: (optional) Scheme to give the home url context. Currently ‘http’, ‘https’.

Return values

returns:Home url link with optional path appended.

Source code

function home_url( $path = '', $scheme = null ) {

	return get_home_url(null, $path, $scheme);

}

1953

hello_dolly_get_lyric

Definition:
function hello_dolly_get_lyric() {}

Source code

function hello_dolly_get_lyric() {

	/** These are the lyrics to Hello Dolly */

	$lyrics = "Hello, Dolly

Well, hello, Dolly

It's so nice to have you back where you belong

You're lookin' swell, Dolly

I can tell, Dolly

You're still glowin', you're still crowin'

You're still goin' strong

We feel the room swayin'

While the band's playin'

One of your old favourite songs from way back when

So, take her wrap, fellas

Find her an empty lap, fellas

Dolly'll never go away again

Hello, Dolly

Well, hello, Dolly

It's so nice to have you back where you belong

You're lookin' swell, Dolly

I can tell, Dolly

You're still glowin', you're still crowin'

You're still goin' strong

We feel the room swayin'

While the band's playin'

One of your old favourite songs from way back when

Golly, gee, fellas

Find her a vacant knee, fellas

Dolly'll never go away

Dolly'll never go away

Dolly'll never go away again";



	// Here we split it into lines

	$lyrics = explode( "\n", $lyrics );



	// And then randomly choose a line

	return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] );

}

1951