root

Changeset 717

Show
Ignore:
Timestamp:
10/06/09 15:04:56 (10 months ago)
Author:
wbond
Message:

Fixed ticket #304 - added fCookie::delete()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fCookie.php

    r514 r717 Hide Line Numbers
    33 * Provides a consistent cookie API, HTTPOnly compatibility with older PHP versions and default parameters 
    44 *  
    5  * @copyright  Copyright (c) 2008-2009 Will Bond 
     5 * @copyright  Copyright (c) 2008-2009 Will Bond, others 
    66 * @author     Will Bond [wb] <will@flourishlib.com> 
     7 * @author     Nick Trew [nt] 
    78 * @license    http://flourishlib.com/license 
    89 *  
     
    1011 * @link       http://flourishlib.com/fCookie 
    1112 *  
    12  * @version    1.0.0b2 
     13 * @version    1.0.0b3 
     14 * @changes    1.0.0b3  Added the ::delete() method [nt+wb, 2009-09-30] 
    1315 * @changes    1.0.0b2  Updated for new fCore API [wb, 2009-02-16] 
    1416 * @changes    1.0.0b   The initial implementation [wb, 2008-09-01] 
     
    1719{ 
    1820    // The following constants allow for nice looking callbacks to static methods 
     21    const delete             = 'fCookie::delete'; 
    1922    const get                = 'fCookie::get'; 
    2023    const reset              = 'fCookie::reset'; 
     
    6467     
    6568    /** 
     69     * Deletes a cookie - uses default parameters set by the other set methods of this class 
     70     *  
     71     * @param  string  $name    The cookie name to delete 
     72     * @param  string  $path    The path of the cookie to delete 
     73     * @param  string  $domain  The domain of the cookie to delete 
     74     * @param  boolean $secure  If the cookie is a secure-only cookie 
     75     * @return void 
     76     */ 
     77    static public function delete($name, $path=NULL, $domain=NULL, $secure=NULL) 
     78    { 
     79        self::set($name, '', time() - 86400, $path, $domain, $secure); 
     80    } 
     81     
     82     
     83    /** 
    6684     * Gets a cookie value from `$_COOKIE`, while allowing a default value to be provided 
    6785     *  
     
    116134     * @param  string         $path      The path this cookie applies to 
    117135     * @param  string         $domain    The domain this cookie applies to 
    118      * @param  boolean        $secure    If the cookie should only be transmitted over a secure connectino 
     136     * @param  boolean        $secure    If the cookie should only be transmitted over a secure connection 
    119137     * @param  boolean        $httponly  If the cookie should only be readable by HTTP connection, not javascript 
    120138     * @return void 
     
    261279 
    262280/** 
    263  * Copyright (c) 2008-2009 Will Bond <will@flourishlib.com> 
     281 * Copyright (c) 2008-2009 Will Bond <will@flourishlib.com>, others 
    264282 *  
    265283 * Permission is hereby granted, free of charge, to any person obtaining a copy