Requests_Cookie::normalize() WordPress Method

The Requests_Cookie::normalize() method is used to normalize a cookie name and value. This is useful when you need to store a cookie with a name that is not a valid cookie name. For example, if you try to store a cookie with the name "foo[bar]", the cookie will be stored as "foo%5Bbar%5D".

Requests_Cookie::normalize() #

Normalize cookie and attributes


Return

(boolean) Whether the cookie was successfully normalized


Top ↑

Source

File: wp-includes/Requests/Cookie.php

	public function normalize() {
		foreach ($this->attributes as $key => $value) {
			$orig_value = $value;
			$value      = $this->normalize_attribute($key, $value);
			if ($value === null) {
				unset($this->attributes[$key]);
				continue;
			}

			if ($value !== $orig_value) {
				$this->attributes[$key] = $value;
			}
		}

		return true;
	}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.