Make WordPress Core


Ignore:
Timestamp:
04/08/2019 05:31:35 AM (6 years ago)
Author:
pento
Message:

HTTP: Add support for the host-only flag to Wp_Http_Cookie.

Props soulseekah.
Fixes #43231.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-http-cookie.php

    r42343 r45135  
    6262
    6363    /**
     64     * host-only flag.
     65     *
     66     * @since 5.2.0
     67     * @var bool
     68     */
     69    public $host_only;
     70
     71    /**
    6472     * Sets up this cookie object.
    6573     *
     
    6876     *
    6977     * @since 2.8.0
     78     * @since 5.2.0 Added `host_only` to the `$data` parameter.
    7079     *
    7180     * @param string|array $data {
    7281     *     Raw cookie data as header string or data array.
    7382     *
    74      *     @type string     $name    Cookie name.
    75      *     @type mixed      $value   Value. Should NOT already be urlencoded.
    76      *     @type string|int $expires Optional. Unix timestamp or formatted date. Default null.
    77      *     @type string     $path    Optional. Path. Default '/'.
    78      *     @type string     $domain  Optional. Domain. Default host of parsed $requested_url.
    79      *     @type int        $port    Optional. Port. Default null.
     83     *     @type string     $name      Cookie name.
     84     *     @type mixed      $value     Value. Should NOT already be urlencoded.
     85     *     @type string|int $expires   Optional. Unix timestamp or formatted date. Default null.
     86     *     @type string     $path      Optional. Path. Default '/'.
     87     *     @type string     $domain    Optional. Domain. Default host of parsed $requested_url.
     88     *     @type int        $port      Optional. Port. Default null.
     89     *     @type bool       $host_only Optional. host-only storage flag. Default true.
    8090     * }
    8191     * @param string       $requested_url The URL which the cookie was set on, used for default $domain
     
    129139
    130140            // Set properties based directly on parameters.
    131             foreach ( array( 'name', 'value', 'path', 'domain', 'port' ) as $field ) {
     141            foreach ( array( 'name', 'value', 'path', 'domain', 'port', 'host_only' ) as $field ) {
    132142                if ( isset( $data[ $field ] ) ) {
    133143                    $this->$field = $data[ $field ];
Note: See TracChangeset for help on using the changeset viewer.