⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pluggable-functions.php

📁 php 开发的内容管理系统
💻 PHP
📖 第 1 页 / 共 2 页
字号:
// http://support.microsoft.com/kb/q176113/if ( !function_exists('wp_redirect') ) :function wp_redirect($location) {	global $is_IIS;	$location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $location);	$strip = array('%0d', '%0a');	$location = str_replace($strip, '', $location);	if ($is_IIS)		header("Refresh: 0;url=$location");	else		header("Location: $location");}endif;if ( !function_exists('wp_get_cookie_login') ):function wp_get_cookie_login() {	if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) )		return false;	return array('login' => $_COOKIE[USER_COOKIE],	'password' => $_COOKIE[PASS_COOKIE]);}endif;if ( !function_exists('wp_setcookie') ) :function wp_setcookie($username, $password, $already_md5 = false, $home = '', $siteurl = '', $remember = false) {	if ( !$already_md5 )		$password = md5( md5($password) ); // Double hash the password in the cookie.	if ( empty($home) )		$cookiepath = COOKIEPATH;	else		$cookiepath = preg_replace('|https?://[^/]+|i', '', $home . '/' );	if ( empty($siteurl) ) {		$sitecookiepath = SITECOOKIEPATH;		$cookiehash = COOKIEHASH;	} else {		$sitecookiepath = preg_replace('|https?://[^/]+|i', '', $siteurl . '/' );		$cookiehash = md5($siteurl);	}	if ( $remember )		$expire = time() + 31536000;	else		$expire = 0;	setcookie(USER_COOKIE, $username, $expire, $cookiepath, COOKIE_DOMAIN);	setcookie(PASS_COOKIE, $password, $expire, $cookiepath, COOKIE_DOMAIN);	if ( $cookiepath != $sitecookiepath ) {		setcookie(USER_COOKIE, $username, $expire, $sitecookiepath, COOKIE_DOMAIN);		setcookie(PASS_COOKIE, $password, $expire, $sitecookiepath, COOKIE_DOMAIN);	}}endif;if ( !function_exists('wp_clearcookie') ) :function wp_clearcookie() {	setcookie(USER_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);	setcookie(PASS_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);	setcookie(USER_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);	setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);}endif;if ( ! function_exists('wp_notify_postauthor') ) :function wp_notify_postauthor($comment_id, $comment_type='') {	global $wpdb;    	$comment = get_comment($comment_id);	$post    = get_post($comment->comment_post_ID);	$user    = get_userdata( $post->post_author );	if ('' == $user->user_email) return false; // If there's no email to send the comment to	$comment_author_domain = gethostbyaddr($comment->comment_author_IP);	$blogname = get_settings('blogname');		if ( empty( $comment_type ) ) $comment_type = 'comment';		if ('comment' == $comment_type) {		$notify_message  = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";		$notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";		$notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";		$notify_message .= sprintf( __('URI    : %s'), $comment->comment_author_url ) . "\r\n";		$notify_message .= sprintf( __('Whois  : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n";		$notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";		$notify_message .= __('You can see all comments on this post here: ') . "\r\n";		$subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title );	} elseif ('trackback' == $comment_type) {		$notify_message  = sprintf( __('New trackback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";		$notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";		$notify_message .= sprintf( __('URI    : %s'), $comment->comment_author_url ) . "\r\n";		$notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";		$notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n";		$subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );	} elseif ('pingback' == $comment_type) {		$notify_message  = sprintf( __('New pingback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";		$notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";		$notify_message .= sprintf( __('URI    : %s'), $comment->comment_author_url ) . "\r\n";		$notify_message .= __('Excerpt: ') . "\r\n" . sprintf('[...] %s [...]', $comment->comment_content ) . "\r\n\r\n";		$notify_message .= __('You can see all pingbacks on this post here: ') . "\r\n";		$subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title );	}	$notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";	$notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";	$wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));	if ( '' == $comment->comment_author ) {		$from = "From: \"$blogname\" <$wp_email>";		if ( '' != $comment->comment_author_email )			$reply_to = "Reply-To: $comment->comment_author_email"; 	} else {		$from = "From: \"$comment->comment_author\" <$wp_email>";		if ( '' != $comment->comment_author_email )			$reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>"; 	}	$message_headers = "MIME-Version: 1.0\n"		. "$from\n"		. "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";	if ( isset($reply_to) )		$message_headers .= $reply_to . "\n";	$notify_message = apply_filters('comment_notification_text', $notify_message, $comment_id);	$subject = apply_filters('comment_notification_subject', $subject, $comment_id);	$message_headers = apply_filters('comment_notification_headers', $message_headers, $comment_id);	@wp_mail($user->user_email, $subject, $notify_message, $message_headers);   	return true;}endif;/* wp_notify_moderator   notifies the moderator of the blog (usually the admin)   about a new comment that waits for approval   always returns true */if ( !function_exists('wp_notify_moderator') ) :function wp_notify_moderator($comment_id) {	global $wpdb;	if( get_settings( "moderation_notify" ) == 0 )		return true;     	$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");	$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");	$comment_author_domain = gethostbyaddr($comment->comment_author_IP);	$comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");	$notify_message  = sprintf( __('A new comment on the post #%1$s "%2$s" is waiting for your approval'), $post->ID, $post->post_title ) . "\r\n";	$notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";	$notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";	$notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";	$notify_message .= sprintf( __('URI    : %s'), $comment->comment_author_url ) . "\r\n";	$notify_message .= sprintf( __('Whois  : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n";	$notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";	$notify_message .= sprintf( __('To approve this comment, visit: %s'),  get_settings('siteurl').'/wp-admin/post.php?action=mailapprovecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";	$notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";	$notify_message .= sprintf( __('Currently %s comments are waiting for approval. Please visit the moderation panel:'), $comments_waiting ) . "\r\n";	$notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n";	$subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_settings('blogname'), $post->post_title );	$admin_email = get_settings('admin_email');	$notify_message = apply_filters('comment_moderation_text', $notify_message, $comment_id);	$subject = apply_filters('comment_moderation_subject', $subject, $comment_id);	@wp_mail($admin_email, $subject, $notify_message);    	return true;}endif;if ( !function_exists('wp_new_user_notification') ) :function wp_new_user_notification($user_id, $plaintext_pass = '') {	$user = new WP_User($user_id);		$user_login = stripslashes($user->user_login);	$user_email = stripslashes($user->user_email);		$message  = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n";	$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";	$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";		@wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message);	if ( empty($plaintext_pass) )		return;	$message  = sprintf(__('Username: %s'), $user_login) . "\r\n";	$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";	$message .= get_settings('siteurl') . "/wp-login.php\r\n";			wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_settings('blogname')), $message);	}endif;if ( !function_exists('wp_verify_nonce') ) :function wp_verify_nonce($nonce, $action = -1) {	$user = wp_get_current_user();	$uid = $user->id;	$i = ceil(time() / 43200);	//Allow for expanding range, but only do one check if we can	if( substr(wp_hash($i . $action . $uid), -12, 10) == $nonce || substr(wp_hash(($i - 1) . $action . $uid), -12, 10) == $nonce )		return true;	return false;}endif;if ( !function_exists('wp_create_nonce') ) :function wp_create_nonce($action = -1) {	$user = wp_get_current_user();	$uid = $user->id;	$i = ceil(time() / 43200);		return substr(wp_hash($i . $action . $uid), -12, 10);}endif;if ( !function_exists('wp_salt') ) :function wp_salt() {	$salt = get_option('secret');	if ( empty($salt) )		$salt = DB_PASSWORD . DB_USER . DB_NAME . DB_HOST . ABSPATH;	return $salt;}endif;if ( !function_exists('wp_hash') ) :function wp_hash($data) {	$salt = wp_salt();	if ( function_exists('hash_hmac') ) {		return hash_hmac('md5', $data, $salt);	} else {		return md5($data . $salt);	}}endif;?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -