/** * HTTP API: WP_Http_Cookie class * * @package WordPress * @subpackage HTTP * @since 4.4.0 */ /** * Core class used to encapsulate a single cookie object for internal use. * * Returned cookies are represented using this class, and when cookies are set, if they are not * already a WP_Http_Cookie() object, then they are turned into one. * * @todo The WordPress convention is to use underscores instead of camelCase for function and method * names. Need to switch to use underscores instead for the methods. * * @since 2.8.0 */ #[AllowDynamicProperties] class WP_Http_Cookie { /** * Cookie name. * * @since 2.8.0 * * @var string */ public $name; /** * Cookie value. * * @since 2.8.0 * * @var string */ public $value; /** * When the cookie expires. Unix timestamp or formatted date. * * @since 2.8.0 * * @var string|int|null */ public $expires; /** * Cookie URL path. * * @since 2.8.0 * * @var string */ public $path; /** * Cookie Domain. * * @since 2.8.0 * * @var string */ public $domain; /** * Cookie port or comma-separated list of ports. * * @since 2.8.0 * * @var int|string */ public $port; /** * host-only flag. * * @since 5.2.0 * * @var bool */ public $host_only; /** * Sets up this cookie object. * * The parameter $data should be either an associative array containing the indices names below * or a header string detailing it. * * @since 2.8.0 * @since 5.2.0 Added `host_only` to the `$data` parameter. * * @param string|array $data { * Raw cookie data as header string or data array. * * @type string $name Cookie name. * @type mixed $value Value. Should NOT already be urlencoded. * @type string|int|null $expires Optional. Unix timestamp or formatted date. Default null. * @type string $path Optional. Path. Default '/'. * @type string $domain Optional. Domain. Default host of parsed $requested_url. * @type int|string $port Optional. Port or comma-separated list of ports. Default null. * @type bool $host_only Optional. host-only storage flag. Default true. * } * @param string $requested_url The URL which the cookie was set on, used for default $domain * and $port values. */ public function __construct( $data, $requested_url = '' ) { if ( $requested_url ) { $parsed_url = parse_url( $requested_url ); } if ( isset( $parsed_url['host'] ) ) { $this->domain = $parsed_url['host']; } $this->path = isset( $parsed_url['path'] ) ? $parsed_url['path'] : '/'; if ( ! str_ends_with( $this->path, '/' ) ) { $this->path = dirname( $this->path ) . '/'; } if ( is_string( $data ) ) { // Assume it's a header string direct from a previous request. $pairs = explode( ';', $data ); // Special handling for first pair; name=value. Also be careful of "=" in value. $name = trim( substr( $pairs[0], 0, strpos( $pairs[0], '=' ) ) ); $value = substr( $pairs[0], strpos( $pairs[0], '=' ) + 1 ); $this->name = $name; $this->value = urldecode( $value ); // Removes name=value from items. array_shift( $pairs ); // Set everything else as a property. foreach ( $pairs as $pair ) { $pair = rtrim( $pair ); // Handle the cookie ending in ; which results in an empty final pair. if ( empty( $pair ) ) { continue; } list( $key, $val ) = strpos( $pair, '=' ) ? explode( '=', $pair ) : array( $pair, '' ); $key = strtolower( trim( $key ) ); if ( 'expires' === $key ) { $val = strtotime( $val ); } $this->$key = $val; } } else { if ( ! isset( $data['name'] ) ) { return; } // Set properties based directly on parameters. foreach ( array( 'name', 'value', 'path', 'domain', 'port', 'host_only' ) as $field ) { if ( isset( $data[ $field ] ) ) { $this->$field = $data[ $field ]; } } if ( isset( $data['expires'] ) ) { $this->expires = is_int( $data['expires'] ) ? $data['expires'] : strtotime( $data['expires'] ); } else { $this->expires = null; } } } /** * Confirms that it's OK to send this cookie to the URL checked against. * * Decision is based on RFC 2109/2965, so look there for details on validity. * * @since 2.8.0 * * @param string $url URL you intend to send this cookie to * @return bool true if allowed, false otherwise. */ public function test( $url ) { if ( is_null( $this->name ) ) { return false; } // Expires - if expired then nothing else matters. if ( isset( $this->expires ) && time() > $this->expires ) { return false; } // Get details on the URL we're thinking about sending to. $url = parse_url( $url ); $url['port'] = isset( $url['port'] ) ? $url['port'] : ( 'https' === $url['scheme'] ? 443 : 80 ); $url['path'] = isset( $url['path'] ) ? $url['path'] : '/'; // Values to use for comparison against the URL. $path = isset( $this->path ) ? $this->path : '/'; $port = isset( $this->port ) ? $this->port : null; $domain = isset( $this->domain ) ? strtolower( $this->domain ) : strtolower( $url['host'] ); if ( false === stripos( $domain, '.' ) ) { $domain .= '.local'; } // Host - very basic check that the request URL ends with the domain restriction (minus leading dot). $domain = ( str_starts_with( $domain, '.' ) ) ? substr( $domain, 1 ) : $domain; if ( ! str_ends_with( $url['host'], $domain ) ) { return false; } // Port - supports "port-lists" in the format: "80,8000,8080". if ( ! empty( $port ) && ! in_array( $url['port'], array_map( 'intval', explode( ',', $port ) ), true ) ) { return false; } // Path - request path must start with path restriction. if ( ! str_starts_with( $url['path'], $path ) ) { return false; } return true; } /** * Convert cookie name and value back to header string. * * @since 2.8.0 * * @return string Header encoded cookie name and value. */ public function getHeaderValue() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid if ( ! isset( $this->name ) || ! isset( $this->value ) ) { return ''; } /** * Filters the header-encoded cookie value. * * @since 3.4.0 * * @param string $value The cookie value. * @param string $name The cookie name. */ return $this->name . '=' . apply_filters( 'wp_http_cookie_value', $this->value, $this->name ); } /** * Retrieve cookie header for usage in the rest of the WordPress HTTP API. * * @since 2.8.0 * * @return string */ public function getFullHeader() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid return 'Cookie: ' . $this->getHeaderValue(); } /** * Retrieves cookie attributes. * * @since 4.6.0 * * @return array { * List of attributes. * * @type string|int|null $expires When the cookie expires. Unix timestamp or formatted date. * @type string $path Cookie URL path. * @type string $domain Cookie domain. * } */ public function get_attributes() { return array( 'expires' => $this->expires, 'path' => $this->path, 'domain' => $this->domain, ); } } ��}�v�Ʋ೴V�� /[d�x)Sٲd;�r,)�ٶG�$l@P����?�Ӽ�����)�K���q%H���3g�(�tW׭����x�������w/�$������qMo<�����H�FM��?��K���Xuͯ���)�'q_�n�5x�3��IHGi�A�o4|���� �8i4��4tLO��i�2P,ߋ�7w6v��q�Tb?6]�2� m�a�s�@��o�*�U?G1��Y�����&�&f�x ���Tv%�H2�f�ߒg�>�| �6�/��/��ˀN��� �c�Gd@���ѳЕ�������H�T�p����i�*1���dž�V5����5���dž$K��Wo /���n�� �_p����>�.����s0 V���F?�cu<˝�H�s�j���‘~A�AG���ts�*|DN'NDF�K �E����GC��F�>�< ���^��L̗#��%�Ī��u�Y^<��f��S�Q�ʱ3�'s�k�$G���^���j����F�9��Ԧ�G�����O'�o�}���kq�~z�&H��&%Ԁ�FU D �S+�i�&û遽��ӧ���CH�B��b��{\�� �l�8Cs^��x�:��uP�6��pP�O�I~(n�{!�g�Gb���ki�����"���C�馞)x�(8�tP�m�EI#�K}Q�Hg�nӂߣQ��lD��Ǚ�i6��]�"-���?����h푙{nJ�,�$P��Q����4�mu��g#���=�j�nI�VJ>\J1R� )�v<@��Ǫ@8 ^9Im3:����P��������g�>JjE8�f�MG�}ʣzdD~��/4|��C�=���>}Qw!�wϪ���x4/N�w� �� �K�塚 �K��Iܒ��lB4�C���qH�-�ח�V�C��2��ޝ�i7u��Lឃ������$�T1�HM#M���. �I[4@?|�h�}ԯ��� ��2� �LO1�sDZ����{������?�dG�@[�H��É��аn���.��Nʭ��/�� ���$G��E��*>ɞ*\q4�fm>�@P������h����:�2�'(Tਦm���^;Q�=DM::~s����Ϡ�k�(�����\_� Mɺ:`^?�ȾV��I����$�ܪ4H���F�45�~@�ϳ�w���i�f����ꩭ�Ss�S�g�{Sc�>���i5�+��J�O���-@+� $g�BN�(=����`��z��t�@EA���c��T�Xs���M�q�^�9�Ze��ĉA�X�X��0��R%cF��mv��.� �VB ~�52�A����^�`Eޘ���-�T��P�X��Eл� DeZ��ж��U��a���m$��D���.���� wZ���tI�p�`.���m��e����s�~��ۜ�%jz�mӱ��f�#뭮l]Y�� &��v[��!�U'��=�/%]�pF;����k�a`�j)yM6�]Yoj�R�0 �`�y�R��6����ej�Ķ�k"q#V8�L�I���#%�`h]�Ձ��(3� s�d���J0����?��NҒ�^�6��H�� � sg�l��`��ZX�9��e����Չ��V ������7�N���A{=�7M�]�{��@M�%��ۛ �*C�����[��Sc�9����b�vf��jÿ:i'�AK��1ֶQ{}YCĦ��F&b��NA����]l���f�ҷ�-ހ�m1��]��'C�����ڽ�aR�B=H����5�Y�n䚁�d�����Ա=ί�!�V�^�� ^[j/��4^��g �,�M �aȋ���VA��^�l:�������Q'? �V+��e M��i��"���j{D �X�����]� mU�T��8\Q<F�&T����:a\�����ZLJ۔ N�_m��tkYi�媲K)ø��.W� ly$�����HC_F� a���;(yӿ�А�T'�S�ȥW�����x� f:vf��sR�r����m列�������=6BV ���[����p��'� �[���E�:|/r�*1V��E�{�]D��f����T�l���2?���E&CSA��jp/:ET��u�{QI�T�g����u��cy���_��p��`���:��r���� �����"�?e^�o�!���\��������t6϶������z��l3�8��E�����6����Æ� VFD�ߏ̩������Q�$(U�y�J&�Q�7�u��_�LvN�ا���x~��}|:���!�>1�_φ3/���!xTڞ�/?P���vU��(�D�D��G{����O�5T���#�-�b)/K��S�i4�0j������iD�0b�jߒWH0�sF���s�� �\:�^�9�}�Q2�Z%6�o�nxK&K�����Y��հ�u�'>���u9xP�%���h�tw,,��FZ� wy�Z��eܻL�2�N��)�`>��5%^j��N���z�V��4��{363��(���"s~�����"�*�A���!����擋 *0�����^�_ dps��ܟg��&�z��C�L�O���ɶ6>�1�1��� �~Sm��ʦ#s��?'�uRV��ku��L�΂"����)��`��#�{KwD��v|ݣؙ�����HD������a)D��)ō�X����9�5obI��ϑh������t u$�Lo5P>G�~�ӟ���c4�"o�o�Oco�Q*�J�-@� #qo��C��q>�%�?�� ��s��-\�A�E(�J�g��$\ˆ�_������s�{�:�%ש�;S�j��*X��.�ƅ��i���2���������2�p����� �C�0��`|�V�"ñ�/�Cj��__&�w>ް��U0�x��o�=}? �+��'�K�� d�.�"Xx6�W�m/�����:��� �� �l���f<`R����X�� 4��y�xU�U�@�C�;Y��]["����e[�?$M���=2������C4P�=��Y�Oχ��6v��H$���H3�΃Rρ�ķ�r� W&<:g�=�̡Km��۹�(�B�}>������^��h� ��7��� e�l 4-c���T#ؚ�:�5���%�|���3�xWN���ˤ��E c��.� ��9��%���`� N�䩨�PL�?��aUZ��"&_*UF�LvM�EW�{�|�?M��Ќ&����� ӻ44� ��bk�����A�<ư���!�ɜ��. �ت0�}C���#Ď[���s�Utf�����eYV0:�d��\7�쑢�Ǐ�ۿ�4�_ᓢ���_��:YLπ��y�@mCXΎM��7��N�Jx2+I"� ���f�9����$��Up�;�,��"EԲ�mJ�+$���m���0R&�m�]%YEM%�Um�&��T�,�+���L�4�[���ԓ�Md�8�d3���;E��g�s��*�Ǔ��4��D�\6OZ�λx�!샋)Y[���@�eq����Fl�i�?t��o�U�YÄ�/(��)�fL�� � �Mp�^DN�栧"�$��L��N�V��1� �����/�[%�"B���%�ǪVv ���TIU$E%@?,ҙ�f�V©�T ���L�}�K��///�$�)���05+y5+\͊�k]���{ݖ��i oھ���Ig:N"�ĉ x`�0��e���(c�_\�յ��R<'7X?�E�\�U�{��]�0ͧC���Dx���4` @� /����\��L��q24gb�/.WZ��?���KI9�*C�Q*Z&� |��C���p������/G�˟G��x�}�G~���������_���2�E�J�u.u�O�}��0ח�Bt Q]a������@j �2��(��)��Hs�[gѺb <9���������D����s�!g��Ŏ���'�������sQtiw[��m$��Qh�vM���ת���Vdw3�B�Cb����(��X[���8���ɉ(���N�v�c�����|Qn�t��ĸ�� ��(�"���1��¿�b��w��:��zPw��6���AeMA�oX��2�n�^Ϻ��v6l�X��y�6]�ZO�F�'����Bv67�Op������cr�ʬ�X��C���6�{Dp<�Z�kJx< ����:u��=h��&�oX� ���z�BSo6o����*|m9���t�??��7�YQ|̱XI�!5��s^���>EU��K��8>(�`���.-LB��E6՘�8��dzH fC׉&�<��N�� ��l:�L�%IW�<.a�+��Q�ב�.��������Z�$�ۛ�Ōsv˾(6ѡ��"�^�ft���Z@o�R�q�&|E������b���ou�Z[�Z} z�c+���x�)�)�'�9��U����4�)k��D�86�hX�H4���yC��H��+IlZ�1�X�ʲf�88�l��B3b�UjI>����H��?����W���kj^Pb&_�*0ŦU�I�\{-,7��-��²]l�%p���`3i��&��W���]����ڊ��H��QS<#���㟾���ٯBx~.6o!�M� g�5�RuB�R�V�j`��vűd6�%> �g Wb ����+:����7��V��$&�V��2� �Oc�ʰ��G��XM���teW7{ʮ٤�ܲ,{x��_kH���Y�F����kW̓A�X�Q��Cۿ�+W5_S���+�A�5�r���g�=�?zI����፫@��M��^��� h� @(���+ŋK������d.������.j��ȁ�в��O`$����/����~n��/6��=si#-�`;O�G٪ �w6��P��&�c[}�߽�9y<0f��sI�̠R���=�ȩ�m[lK��eS������+r�~��;���C#������c'�4YPS��-���/� ��;1��o1���*�[�؍u-J���M�6pӠf>�K�����%nG�8�������Ѕ�s�"ޙsMm�A&���ʎ� H�0�B9��Ƥ�5N���������Ǡ�o��Ry�+$�@�~A[<�1]���i% TY����"(�M�a8 �.��Z`1"� 4@�!%A��A ~$��]+к][H��5�NXz��Τ/�RY^��6��ğ�B�6�� `W�1~ ��K�p;V��腭�T-�=��廀�rC��`(?5��j��d u�m�@� ]%��. b$io���"8^0��I���O޲��a_)H`��W��� �("�qN��Tİ�lxjD�^"3��H"�3�;��� �� H����0�"ȷ�����AN^���@�J�ҰG. {��n�$VY��_�l8u��pʜ�H4�7��/��Q�x�á�a��<�\��w�g��v�ٔӏG;�������B�@��D�P�4AC�x�+�p"|x���)q�c�� n�:�6��L��QW��n��&ձ�~~�r���<4��� C|<��ȹB������>�靽�w%L�O��$�6��-��8� :���J��+�B�֑@t��;�l~`Q, ?��h�H�����=�ch���BC$ɤF�o*��N�){�K��%�H8���[l ����5���$p�)���[ɒY'��L����ΐ��u�w�� Dz��-,�� K��h��}��Il+�����LDŽ�^ji�2�jhg��9?��>����~ɺӒ�_����~~5������������y _==����|>bO���S�������S146���Nj� h�@83�ܿ��^�$��Γ� ���������&�'�T�@aSV=+7�=� �Bs��V��I����S�1̽u'��ŏU�#����w�j��m��0�0hq�Ȩ�G ���So{�[0�p�O�zGiv ���j��,>���?����.��_ZC M��3~��DA���d� Ё�����Ț��4���w ]�#�~�mN�d�F����-D��sv��`6�EqF�#|�2������ ����[[��X�QڕWޠ��2�m��t��2d�1�f��8s � Ǟ����r0��٪Mz��� � 7�����o��|*���MN8yáV.���7D�po�j蛡��Cmj���Ub��)ວ?"Gl�\kll�D� w5�l]��)u�0� K���w�V7�d[~�45q?}wI{�٫Z�Lhqd|~.��Cg�� a2�s� |��=������e�D�d��Ȳ�2҉A^L"H9m1`��ע $N�����K>��߫�)�`�z�B 7O��`7���!'\G7��K�<Y���۩q� ��Ͻ��S����Xnq wp�1����E��sf��#^A�u���� �j���ť\+����TM�l6����g{�#�#>67m�r�L������&/C0�K?��ʗa����%�%.�����DKK�Q]�xl}��?&�AW���L�/�k�B��҅8;��A3��d*�����s��'פ�')(���p"v_�z�{pN�75r��j?Wx�T�B�?h���~�'��XZ~��4�î��Y ���{?�����ܹ>� -��p�;`�rvp���LNU����dz�)����֙�F�v�~���v����E|�nH}�0�T�L���M�A&K�Y����ȏ�������?6�=N<����?6>�0���>6>�������1������M���.��.5�Cc�Իfww���� �ɠ��(���o��y,}��8��s9�-c��mT���h���ĭW�"��Q>G�Ԓ{�x&����x��D+hM��*�ȄI�]v���M�ǭ��Ǖg��L����g�n���V���~��ޤt+.^ԙ���d?�}v�,A�� P�;�]����7h���KY_��Y���0#> ���l?�!P�b'���R"��Ջ�t~���;�fX�[���~r�L�y���9ߝ�����uk��.�Y���߈�v)�O�@�#6�%Y5Rc7�<�["Q��D5 ܼ�匒 Չ2ޘ�3�-�V�l�<��K��Q� <�qk1_eq�k�d �Fv���I��^�S�%Q�:�|�X+p�Ó��I���&x��qk̎��s�$}�!7)� ��+�R9���>� G�n�t���i~Z����9:~s�G ��*��K;���FB�!� �O/�X�� �dI�T;q����� `���%�����ʚ���B�ï�R/��� �@ߒg�>�|���/̐�9B�� ��Z�W���޹���#�,E_��c���H}M�b�'#�7��Ρ���:��|�����k') ?Ĵ�@� �?l�3ʆ�A��ww5�ZW0*�)��L1Ќb��s<%�&��Z��4� � �.���qbyR�'ĩp�7G+}��%���K�W�/Ng4�O�Q�K�O'�P<� �p��$�c��� `�8����3S0_ۡSd�� �~ɒ ��K��a�;L 0 ~������r�nB���J��o呎|��ł�8Ś/�D4���/����8W�H�� �N�l�6{�]��j��p�<�_�������:O���.�dL�@����ɞ��H�}�I2(��a�9WQ?�NJ��,"؃��0�>d��X�R� �EiI��i� �״���o,3�pȬ_�� �,<�D�R�^Wωנ�H��J�FH�{��/H�77 33�˻׭�M%�ch6�y�Գ[�{�$s����d�V�x����&���w4d�Р3 I�b㙨ߚ��Cį��� =2���O��C��G�E���c~t��@E����_��� ��¥�/� ��$�Y�f�5�EЎ ��ixܽ�E��F��[�ۊf(�.�[�v�ot��f[Q����l�*�