wp_authenticate_cookie

Definition:
function wp_authenticate_cookie($user, $username, $password) {}

Authenticate the user using the WordPress auth cookie.

Parameters

  • $user
  • $username
  • $password

Source code

function wp_authenticate_cookie($user, $username, $password) {

	if ( is_a($user, 'WP_User') ) { return $user; }



	if ( empty($username) && empty($password) ) {

		$user_id = wp_validate_auth_cookie();

		if ( $user_id )

			return new WP_User($user_id);



		global $auth_secure_cookie;



		if ( $auth_secure_cookie )

			$auth_cookie = SECURE_AUTH_COOKIE;

		else

			$auth_cookie = AUTH_COOKIE;



		if ( !empty($_COOKIE[$auth_cookie]) )

			return new WP_Error('expired_session', __('Please log in again.'));



		// If the cookie is not set, be silent.

	}



	return $user;

}

3429

wp_attachment_is_image

Definition:
function wp_attachment_is_image( $post_id = 0 ) {}

Check if the attachment is an image.

Parameters

  • int $post_id: Attachment ID

Source code

function wp_attachment_is_image( $post_id = 0 ) {

	$post_id = (int) $post_id;

	if ( !$post =& get_post( $post_id ) )

		return false;



	if ( !$file = get_attached_file( $post->ID ) )

		return false;



	$ext = preg_match('/\.([^.]+)$/', $file, $matches) ? strtolower($matches[1]) : false;



	$image_exts = array('jpg', 'jpeg', 'gif', 'png');



	if ( 'image/' == substr($post->post_mime_type, 0, 6) || $ext && 'import' == $post->post_mime_type && in_array($ext, $image_exts) )

		return true;

	return false;

}

3425

wp_allow_comment

Definition:
function wp_allow_comment($commentdata) {}

Validates whether this comment is allowed to be made.

Parameters

  • array $commentdata: Contains information on the comment

Return values

returns:Signifies the approval status (0|1|’spam’)

Defined filters

  • pre_comment_approved
    apply_filters( 'pre_comment_approved', $approved, $commentdata )

Defined actions

  • comment_duplicate_trigger
    do_action( 'comment_duplicate_trigger', $commentdata );
  • check_comment_flood
    do_action( 'check_comment_flood', $comment_author_IP, $comment_author_email, $comment_date_gmt );

Source code

function wp_allow_comment($commentdata) {

	global $wpdb;

	extract($commentdata, EXTR_SKIP);



	// Simple duplicate check

	// expected_slashed ($comment_post_ID, $comment_author, $comment_author_email, $comment_content)

	$dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_approved != 'trash' AND ( comment_author = '$comment_author' ";

	if ( $comment_author_email )

		$dupe .= "OR comment_author_email = '$comment_author_email' ";

	$dupe .= ") AND comment_content = '$comment_content' LIMIT 1";

	if ( $wpdb->get_var($dupe) ) {

		do_action( 'comment_duplicate_trigger', $commentdata );

		if ( defined('DOING_AJAX') )

			die( __('Duplicate comment detected; it looks as though you’ve already said that!') );



		wp_die( __('Duplicate comment detected; it looks as though you’ve already said that!') );

	}



	do_action( 'check_comment_flood', $comment_author_IP, $comment_author_email, $comment_date_gmt );



	if ( isset($user_id) && $user_id) {

		$userdata = get_userdata($user_id);

		$user = new WP_User($user_id);

		$post_author = $wpdb->get_var($wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", $comment_post_ID));

	}



	if ( isset($userdata) && ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) {

		// The author and the admins get respect.

		$approved = 1;

	 } else {

		// Everyone else's comments will be checked.

		if ( check_comment($comment_author, $comment_author_email, $comment_author_url, $comment_content, $comment_author_IP, $comment_agent, $comment_type) )

			$approved = 1;

		else

			$approved = 0;

		if ( wp_blacklist_check($comment_author, $comment_author_email, $comment_author_url, $comment_content, $comment_author_IP, $comment_agent) )

			$approved = 'spam';

	}



	$approved = apply_filters( 'pre_comment_approved', $approved, $commentdata );

	return $approved;

}

3423

wp_admin_css_uri

Definition:
function wp_admin_css_uri( $file = 'wp-admin' ) {}

Display the URL of a WordPress admin CSS file.

Parameters

  • string $file: file relative to wp-admin/ without its “.css” extension.

Defined filters

  • wp_admin_css_uri
    apply_filters( 'wp_admin_css_uri', $_file, $file )

Source code

function wp_admin_css_uri( $file = 'wp-admin' ) {

	if ( defined('WP_INSTALLING') ) {

		$_file = "./$file.css";

	} else {

		$_file = admin_url("$file.css");

	}

	$_file = add_query_arg( 'version', get_bloginfo( 'version' ),  $_file );



	return apply_filters( 'wp_admin_css_uri', $_file, $file );

}

3421