WordPress.org

Plugin Directory

Changeset 584975


Ignore:
Timestamp:
08/13/12 18:30:58 (20 months ago)
Author:
ocean90
Message:
  • Copy wp_nonce_tick() to self::nonce_tick()
  • Introduce the filter ppp_nonce_life
Location:
public-post-preview/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • public-post-preview/trunk/public-post-preview.php

    r577122 r584975  
    22/** 
    33 * Plugin Name: Public Post Preview 
    4  * Version: 2.0.1 
     4 * Version: 2.0.2 
    55 * Description: Enables you to give a link to anonymous users for public preview of any post type before it is published. 
    66 * Author: Dominik Schilling 
     
    343343 
    344344    /** 
     345     * Get the time-dependent variable for nonce creation. 
     346     * 
     347     * @see    wp_nonce_tick() 
     348     * 
     349     * @since  2.0.2 
     350     * 
     351     * @return int The time-dependent variable 
     352     */ 
     353    private static function nonce_tick() { 
     354        $nonce_life = apply_filters( 'ppp_nonce_life', 60 * 60 * 24 ); // 24 hours 
     355 
     356        return ceil( time() / ( $nonce_life / 2 ) ); 
     357    } 
     358 
     359    /** 
    345360     * Creates a random, one time use token. Without an UID. 
    346361     * 
     
    353368     */ 
    354369    private static function create_nonce( $action = -1 ) { 
    355         $i = wp_nonce_tick(); 
     370        $i = self::nonce_tick(); 
    356371 
    357372        return substr( wp_hash( $i . $action, 'nonce' ), -12, 10 ); 
     
    370385     */ 
    371386    private static function verify_nonce( $nonce, $action = -1 ) { 
    372         $i = wp_nonce_tick(); 
     387        $i = self::nonce_tick(); 
    373388 
    374389        // Nonce generated 0-12 hours ago 
  • public-post-preview/trunk/readme.txt

    r577123 r584975  
    6464 
    6565== Change Log == 
     66= 2.0.2 (20012-XX-XX): = 
     67* Introduces a filter `ppp_nonce_life`. With this you can adjust the expiration of a link. By default a link has a lifetime of 24 hours. 
     68 
    6669= 2.0.1 (20012-07-25): = 
    6770* Makes the preview link copyable again 
Note: See TracChangeset for help on using the changeset viewer.