wp_favicon_request

Definition:
function wp_favicon_request() {}

Don’t load all of WordPress when handling a favicon.ico request.
Instead, send the headers for a zero-length favicon and bail.

Source code

function wp_favicon_request() {

	if ( '/favicon.ico' == $_SERVER['REQUEST_URI'] ) {

		header('Content-Type: image/vnd.microsoft.icon');

		header('Content-Length: 0');

		exit;

	}

}

3649

wp_ext2type

Definition:
function wp_ext2type( $ext ) {}

Retrieve the file type based on the extension name.

Parameters

  • string $ext: The extension to search.

Return values

returns:The file type, example: audio, video, document, spreadsheet, etc. Null if not found.

Defined filters

  • ext2type
    apply_filters( 'ext2type', array(

    'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' )

Source code

function wp_ext2type( $ext ) {

	$ext2type = apply_filters( 'ext2type', array(

		'audio'       => array( 'aac', 'ac3',  'aif',  'aiff', 'm3a',  'm4a',   'm4b', 'mka', 'mp1', 'mp2',  'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),

		'video'       => array( 'asf', 'avi',  'divx', 'dv',   'flv',  'm4v',   'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt',  'rm', 'vob', 'wmv' ),

		'document'    => array( 'doc', 'docx', 'docm', 'dotm', 'odt',  'pages', 'pdf', 'rtf', 'wp',  'wpd' ),

		'spreadsheet' => array( 'numbers',     'ods',  'xls',  'xlsx', 'xlsb',  'xlsm' ),

		'interactive' => array( 'key', 'ppt',  'pptx', 'pptm', 'odp',  'swf' ),

		'text'        => array( 'asc', 'csv',  'tsv',  'txt' ),

		'archive'     => array( 'bz2', 'cab',  'dmg',  'gz',   'rar',  'sea',   'sit', 'sqx', 'tar', 'tgz',  'zip', '7z' ),

		'code'        => array( 'css', 'htm',  'html', 'php',  'js' ),

	));

	foreach ( $ext2type as $type => $exts )

		if ( in_array( $ext, $exts ) )

			return $type;

}

3647

wp_explain_nonce

Definition:
function wp_explain_nonce( $action ) {}

Retrieve nonce action "Are you sure" message.
The action is split by verb and noun. The action format is as follows: verb-action_extra. The verb is before the first dash and has the format of letters and no spaces and numbers. The noun is after the dash and before the underscore, if an underscore exists. The noun is also only letters.

Parameters

  • string $action: Nonce action.

Return values

returns:Are you sure message.

Defined filters

  • explain_nonce_$verb-$noun
    apply_filters( 'explain_nonce_' . $verb . '-' . $noun, __( 'Are you sure you want to do this?' )
  • explain_nonce_$action
    apply_filters( 'explain_nonce_' . $action, __( 'Are you sure you want to do this?' )

Source code

function wp_explain_nonce( $action ) {

	if ( $action !== -1 && preg_match( '/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches ) ) {

		$verb = $matches[1];

		$noun = $matches[2];



		$trans = array();

		$trans['update']['attachment'] = array( __( 'Your attempt to edit this attachment: “%s” has failed.' ), 'get_the_title' );



		$trans['add']['category']      = array( __( 'Your attempt to add this category has failed.' ), false );

		$trans['delete']['category']   = array( __( 'Your attempt to delete this category: “%s” has failed.' ), 'get_cat_name' );

		$trans['update']['category']   = array( __( 'Your attempt to edit this category: “%s” has failed.' ), 'get_cat_name' );



		$trans['delete']['comment']    = array( __( 'Your attempt to delete this comment: “%s” has failed.' ), 'use_id' );

		$trans['unapprove']['comment'] = array( __( 'Your attempt to unapprove this comment: “%s” has failed.' ), 'use_id' );

		$trans['approve']['comment']   = array( __( 'Your attempt to approve this comment: “%s” has failed.' ), 'use_id' );

		$trans['update']['comment']    = array( __( 'Your attempt to edit this comment: “%s” has failed.' ), 'use_id' );

		$trans['bulk']['comments']     = array( __( 'Your attempt to bulk modify comments has failed.' ), false );

		$trans['moderate']['comments'] = array( __( 'Your attempt to moderate comments has failed.' ), false );



		$trans['add']['bookmark']      = array( __( 'Your attempt to add this link has failed.' ), false );

		$trans['delete']['bookmark']   = array( __( 'Your attempt to delete this link: “%s” has failed.' ), 'use_id' );

		$trans['update']['bookmark']   = array( __( 'Your attempt to edit this link: “%s” has failed.' ), 'use_id' );

		$trans['bulk']['bookmarks']    = array( __( 'Your attempt to bulk modify links has failed.' ), false );



		$trans['add']['page']          = array( __( 'Your attempt to add this page has failed.' ), false );

		$trans['delete']['page']       = array( __( 'Your attempt to delete this page: “%s” has failed.' ), 'get_the_title' );

		$trans['update']['page']       = array( __( 'Your attempt to edit this page: “%s” has failed.' ), 'get_the_title' );



		$trans['edit']['plugin']       = array( __( 'Your attempt to edit this plugin file: “%s” has failed.' ), 'use_id' );

		$trans['activate']['plugin']   = array( __( 'Your attempt to activate this plugin: “%s” has failed.' ), 'use_id' );

		$trans['deactivate']['plugin'] = array( __( 'Your attempt to deactivate this plugin: “%s” has failed.' ), 'use_id' );

		$trans['upgrade']['plugin']    = array( __( 'Your attempt to update this plugin: “%s” has failed.' ), 'use_id' );



		$trans['add']['post']          = array( __( 'Your attempt to add this post has failed.' ), false );

		$trans['delete']['post']       = array( __( 'Your attempt to delete this post: “%s” has failed.' ), 'get_the_title' );

		$trans['update']['post']       = array( __( 'Your attempt to edit this post: “%s” has failed.' ), 'get_the_title' );



		$trans['add']['user']          = array( __( 'Your attempt to add this user has failed.' ), false );

		$trans['delete']['users']      = array( __( 'Your attempt to delete users has failed.' ), false );

		$trans['bulk']['users']        = array( __( 'Your attempt to bulk modify users has failed.' ), false );

		$trans['update']['user']       = array( __( 'Your attempt to edit this user: “%s” has failed.' ), 'get_the_author_meta', 'display_name' );

		$trans['update']['profile']    = array( __( 'Your attempt to modify the profile for: “%s” has failed.' ), 'get_the_author_meta', 'display_name' );



		$trans['update']['options']    = array( __( 'Your attempt to edit your settings has failed.' ), false );

		$trans['update']['permalink']  = array( __( 'Your attempt to change your permalink structure to: %s has failed.' ), 'use_id' );

		$trans['edit']['file']         = array( __( 'Your attempt to edit this file: “%s” has failed.' ), 'use_id' );

		$trans['edit']['theme']        = array( __( 'Your attempt to edit this theme file: “%s” has failed.' ), 'use_id' );

		$trans['switch']['theme']      = array( __( 'Your attempt to switch to this theme: “%s” has failed.' ), 'use_id' );



		$trans['log']['out']           = array( sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'sitename' ) ), false );



		if ( isset( $trans[$verb][$noun] ) ) {

			if ( !empty( $trans[$verb][$noun][1] ) ) {

				$lookup = $trans[$verb][$noun][1];

				if ( isset($trans[$verb][$noun][2]) )

					$lookup_value = $trans[$verb][$noun][2];

				$object = $matches[4];

				if ( 'use_id' != $lookup ) {

					if ( isset( $lookup_value ) )

						$object = call_user_func( $lookup, $lookup_value, $object );

					else

						$object = call_user_func( $lookup, $object );

				}

				return sprintf( $trans[$verb][$noun][0], esc_html($object) );

			} else {

				return $trans[$verb][$noun][0];

			}

		}



		return apply_filters( 'explain_nonce_' . $verb . '-' . $noun, __( 'Are you sure you want to do this?' ), isset($matches[4]) ? $matches[4] : '' );

	} else {

		return apply_filters( 'explain_nonce_' . $action, __( 'Are you sure you want to do this?' ) );

	}

}

3645

wp_expand_dimensions

Definition:
function wp_expand_dimensions( $example_width, $example_height, $max_width, $max_height ) {}

Based on a supplied width/height example, return the biggest possible dimensions based on the max width/height.

Parameters

  • int $example_width: The width of an example embed.
  • int $example_height: The height of an example embed.
  • int $max_width: The maximum allowed width.
  • int $max_height: The maximum allowed height.

Return values

returns:The maximum possible width and height based on the example ratio.

Source code

function wp_expand_dimensions( $example_width, $example_height, $max_width, $max_height ) {

	$example_width  = (int) $example_width;

	$example_height = (int) $example_height;

	$max_width      = (int) $max_width;

	$max_height     = (int) $max_height;



	return wp_constrain_dimensions( $example_width * 1000000, $example_height * 1000000, $max_width, $max_height );

}

3643

wp_exif_frac2dec

Definition:
function wp_exif_frac2dec($str) {}

Convert a fraction string to a decimal.

Parameters

  • string $str

Source code

function wp_exif_frac2dec($str) {

	@list( $n, $d ) = explode( '/', $str );

	if ( !empty($d) )

		return $n / $d;

	return $str;

}

3641