send_nosniff_header

Definition:
function send_nosniff_header() {}

Send a HTTP header to disable content type sniffing in browsers which support it.

Source code

function send_nosniff_header() {

	@header( 'X-Content-Type-Options: nosniff' );

}

2829

send_confirmation_on_profile_email

Definition:
function send_confirmation_on_profile_email() {}

Defined filters

  • new_user_email_content
    apply_filters( 'new_user_email_content', __( "Dear user,

    You recently requested to have the email address on your account changed.

    If this is correct, please click on the following link to change it:

    ###ADMIN_URL###

    You can safely ignore and delete this email if you do not want to

    take this action.

    This email has been sent to ###EMAIL###

    Regards,

    All at ###SITENAME###

    ###SITEURL###" )

Source code

function send_confirmation_on_profile_email() {

	global $errors, $wpdb;

	$current_user = wp_get_current_user();

	if ( ! is_object($errors) )

		$errors = new WP_Error();



	if ( $current_user->id != $_POST['user_id'] )

		return false;



	if ( $current_user->user_email != $_POST['email'] ) {

		if ( !is_email( $_POST['email'] ) ) {

			$errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address isn't correct." ), array( 'form-field' => 'email' ) );

			return;

		}



		if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email'] ) ) ) {

			$errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address is already used." ), array( 'form-field' => 'email' ) );

			delete_option( $current_user->ID . '_new_email' );

			return;

		}



		$hash = md5( $_POST['email'] . time() . mt_rand() );

		$new_user_email = array(

				'hash' => $hash,

				'newemail' => $_POST['email']

				);

		update_option( $current_user->ID . '_new_email', $new_user_email );



		$content = apply_filters( 'new_user_email_content', __( "Dear user,



You recently requested to have the email address on your account changed.

If this is correct, please click on the following link to change it:

###ADMIN_URL###



You can safely ignore and delete this email if you do not want to

take this action.



This email has been sent to ###EMAIL###



Regards,

All at ###SITENAME###

###SITEURL###" ), $new_user_email );



		$content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail='.$hash ) ), $content );

		$content = str_replace( '###EMAIL###', $_POST['email'], $content);

		$content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content );

		$content = str_replace( '###SITEURL###', network_home_url(), $content );



		wp_mail( $_POST['email'], sprintf( __( '[%s] New Email Address' ), get_option( 'blogname' ) ), $content );

		$_POST['email'] = $current_user->user_email;

	}

2827

self_link

Definition:
function self_link() {}

Display the link for the currently displayed feed in a XSS safe way.
Generate a correct link for the atom:self element.

Source code

function self_link() {

	$host = @parse_url(home_url());

	$host = $host['host'];

	echo esc_url(

		'http'

		. ( (isset($_SERVER['https']) && $_SERVER['https'] == 'on') ? 's' : '' ) . '://'

		. $host

		. stripslashes($_SERVER['REQUEST_URI'])

		);

}

2825

selected

Definition:
function selected( $selected, $current = true, $echo = true ) {}

Outputs the html selected attribute.
Compares the first two arguments and if identical marks as selected

Parameters

  • mixed $selected: One of the values to compare
  • mixed $current: (true) The other value to compare if not just true
  • bool $echo: Whether to echo or just return the string

Return values

returns:html attribute or empty string

Source code

function selected( $selected, $current = true, $echo = true ) {

	return __checked_selected_helper( $selected, $current, $echo, 'selected' );

}

2823

seems_utf8

Definition:
function seems_utf8($str) {}

Checks to see if a string is utf8 encoded.
NOTE: This function checks for 5-Byte sequences, UTF8 has Bytes Sequences with a maximum length of 4.

Parameters

  • string $str: The string to be checked

Return values

returns:True if $str fits a UTF-8 model, false otherwise.

Source code

function seems_utf8($str) {

	$length = strlen($str);

	for ($i=0; $i < $length; $i++) {

		$c = ord($str[$i]);

		if ($c < 0x80) $n = 0; # 0bbbbbbb

		elseif (($c & 0xE0) == 0xC0) $n=1; # 110bbbbb

		elseif (($c & 0xF0) == 0xE0) $n=2; # 1110bbbb

		elseif (($c & 0xF8) == 0xF0) $n=3; # 11110bbb

		elseif (($c & 0xFC) == 0xF8) $n=4; # 111110bb

		elseif (($c & 0xFE) == 0xFC) $n=5; # 1111110b

		else return false; # Does not match any model

		for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ?

			if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80))

				return false;

		}

	}

	return true;

}

2821