Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_parse_auth_cookie [ WordPress Function ]

wp_parse_auth_cookie ( $cookie = '', $scheme = '' )
Parameters:
  • (string) $cookie
  • (string) $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
Returns:
  • (array) Authentication cookie components
Defined at:



Parse a cookie into its components

Source


<?php
function wp_parse_auth_cookie($cookie ''$scheme '') {
    if ( empty(
$cookie) ) {
        switch (
$scheme){
            case 
'auth':
                
$cookie_name AUTH_COOKIE;
                break;
            case 
'secure_auth':
                
$cookie_name SECURE_AUTH_COOKIE;
                break;
            case 
"logged_in":
                
$cookie_name LOGGED_IN_COOKIE;
                break;
            default:
                if ( 
is_ssl() ) {
                    
$cookie_name SECURE_AUTH_COOKIE;
                    
$scheme 'secure_auth';
                } else {
                    
$cookie_name AUTH_COOKIE;
                    
$scheme 'auth';
                }
        }

        if ( empty(
$_COOKIE[$cookie_name]) )
            return 
false;
        
$cookie $_COOKIE[$cookie_name];
    }

    
$cookie_elements explode('|'$cookie);
    if ( 
count($cookie_elements) != )
        return 
false;

    list(
$username$expiration$hmac) = $cookie_elements;

    return 
compact('username''expiration''hmac''scheme');
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics