capital_P_dangit

Definition:
function capital_P_dangit( $text ) {}

Forever eliminate "Wordpress" from the planet (or at least the little bit we can influence).
Violating our coding standards for a good function name.

Parameters

  • $text

Source code

function capital_P_dangit( $text ) {

	// Simple replacement for titles

	if ( 'the_title' === current_filter() )

		return str_replace( 'Wordpress', 'WordPress', $text );

	// Still here? Use the more judicious replacement

	static $dblq = false;

	if ( false === $dblq )

		$dblq = _x('“', 'opening curly quote');

	return str_replace(

		array( ' WordPress', '‘WordPress', $dblq . 'Wordpress', '>Wordpress', '(WordPress' ),

		array( ' WordPress', '‘WordPress', $dblq . 'WordPress', '>WordPress', '(WordPress' ),

	$text );



}

583

cancel_comment_reply_link

Definition:
function cancel_comment_reply_link($text = '') {}

Display HTML content for cancel comment reply link.

Parameters

  • string $text: Optional. Text to display for cancel reply link.

Source code

function cancel_comment_reply_link($text = '') {

	echo get_cancel_comment_reply_link($text);

}

581

calendar_week_mod

Definition:
function calendar_week_mod($num) {}

Get number of days since the start of the week.

Parameters

  • int $num: Number of day.

Return values

returns:Days since the start of the week.

Source code

function calendar_week_mod($num) {

	$base = 7;

	return ($num - $base*floor($num/$base));

}

579

cache_users

Definition:
function cache_users( $user_ids ) {}

Retrieve info for user lists to prevent multiple queries by get_userdata()

Parameters

  • array $user_ids: User ID numbers list

Source code

function cache_users( $user_ids ) {

	global $wpdb;



	$clean = array();

	foreach ( $user_ids as $id ) {

		$id = (int) $id;

		if ( !wp_cache_get( $id, 'users' ) ) {

			$clean[] = $id;

		}

	}



	if ( empty( $clean ) )

		return;



	$list = implode( ',', $clean );



	$users = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($list)" );



	$ids = array();

	foreach ( $users as $user ) {

		update_user_caches( $user );

		$ids[] = $user->ID;

	}

	update_meta_cache( 'user', $ids );

}

577

cache_javascript_headers

Definition:
function cache_javascript_headers() {}

Set the headers for caching for 10 days with JavaScript content type.

Source code

function cache_javascript_headers() {

	$expiresOffset = 864000; // 10 days

	header( "Content-Type: text/javascript; charset=" . get_bloginfo( 'charset' ) );

	header( "Vary: Accept-Encoding" ); // Handle proxies

	header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . " GMT" );

}

575