WordPress:wp-includes/pluggable.php

Un article de Wiki.

Jump to: navigation, search

Sommaire

[modifier] Introduction

Ce fichier contient les fonctions que l'utilisateur peut rédéfinir pour sa propre installation de WordPress. En effet, chaque définition de ces fonctions est précédée d'un test sur l'existence du nom de la fonction. Donc si un fichier a auparavant défini la fonction (typiquement dans un plugin), elle ne sera pas redéfinie et ce sera la version du plugin qui sera utilisée.

[modifier] Liste des fonctions dans pluggable.php

(Note: extrait de WP2.2)

pluggable.php:7:function set_current_user($id, $name = ) {
pluggable.php:13:function wp_set_current_user($id, $name = ) {
pluggable.php:30:function wp_get_current_user() {
pluggable.php:40:function get_currentuserinfo() {
pluggable.php:61:function get_userdata( $user_id ) {
pluggable.php:105:function update_user_cache() {
pluggable.php:111:function get_userdatabylogin($user_login) {
pluggable.php:160:function wp_mail($to, $subject, $message, $headers = ) {
pluggable.php:224:function wp_login($username, $password, $already_md5 = false) {
pluggable.php:256:function is_user_logged_in() {
pluggable.php:267:function auth_redirect() {
pluggable.php:281:function check_admin_referer($action = -1) {
pluggable.php:293:function check_ajax_referer() {
pluggable.php:310:function wp_redirect($location, $status = 302) {
pluggable.php:335:function wp_get_cookie_login() {
pluggable.php:345:function wp_setcookie($username, $password, $already_md5 = false, $home = , $siteurl = , $remember = false) {
pluggable.php:378:function wp_clearcookie() {
pluggable.php:387:function wp_notify_postauthor($comment_id, $comment_type=) {
pluggable.php:465:function wp_notify_moderator($comment_id) {
pluggable.php:503:function wp_new_user_notification($user_id, $plaintext_pass = ) {
pluggable.php:528:function wp_verify_nonce($nonce, $action = -1) {
pluggable.php:542:function wp_create_nonce($action = -1) {
pluggable.php:553:function wp_salt() {
pluggable.php:563:function wp_hash($data) {

[modifier] Fonctions

On s'intéresse ici aux 2 fonctions wp_verify_nonce et wp_create_nonce:

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;


[modifier] Liens Utiles

Le Codex officiel http://codex.wordpress.org/Pluggable_Functions