/** * 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�Le˒�\l˱�dg�h��A@]����?�Ӽ�����)�K���q%H���3g�(�tW׭����x�������w/�4��{���qMo2����K�FM��=��+��9���^]�O�Rg2�zpy��󟹎��LC:J�8�A�����N�AH��ULC��T˟5.��zq#p�NjM%�c�U,Ӛ�F05>G �����]�s$3J�:A�<�hlkj������K�'�F��3:��z�a,Ar(]8v<��ܱ��^d�xN���2]:�9�؉A��sץ�㑱��g�W29�bDCғ���g �'��#?�vR�;3�Rqf�*�dl���� ��L�'�}��?)k�c_"�'�����dL��k�ۄJq�8=:��`��4-�$z��I+ Ȱ� �;ܱ��ؚ����i4ƀ1R'�?� �k�q���Lj�3c*��*-�A�:�;����˙ Y���t��@^�%�w9S �yhM����c�����F4���W0v��fPѦZ��_��:�zgy�pC�Z�1t��D���s2JOa��B[��{ ����r��G���2n|6���s4�%�}88�?��@�ml_8��_�g����c�ID��Z�= ]i x���؈� �'�5G��C��� l�mUS�]�k|lH� @y5�&��O� 2l��GO�� Pip-�7b� ��k�#:cdzܹ�t?G,�aP��(/����4vԮjH77���G�d�Dd츔�_tKʄz4l���ܳМk��կ�͐�r$��$�X5Z���+���y����Fq4�r���ɜ��G/�! ���;�G�Z�f7�Qh�c?��� ���|��㣷j�q⌯jq�~z��H��&%Ԁ�FU D �S+�i�&û遽��wH_y�W���=�j����w���)�⦱��U��� �x7�A��X��a�}Qw a�wϪ���h</N�w� �q� AN}ਐ �K�s�Iܒ��lC4�� qH�-���V�C��2��޽<�n�?��*�=%A��݇H��b\4�:�F��T��A]@t��h�~���\��_��a\3e A��b��c�{�U�wc5 �!(T%�~�Ɏ��� ��샩��аn���.�gNʭ��/��1���$G��E��*>ɞ*\q4�fm>�BP������h����:�2�'(Tਦm�8�^;Q�=DM:�_����,� �9��z�n)�� (4\����̺�Z�; >�z�.�s0r�{��~��e��$�Q�H�-H�F �� 6o䪨U�R ��5��Pݼ$֟��s߱���ތ�4�۰U�Tt�� B�� ��-�k� t\��@����xJ�B�_Qcm|����A:��+�լ� +S�>-��ys~F��[U"k��������=�A � )���W�G:���x`��ȴ���zP�YPk�Td1��f������B��(J�B��ܼ� ���1<�������ӧ�.�c ��ZJ Uˀ�yȶo�����%C�:F��ӧ= �a4��??��a�hJi�C{���cɚ��W@3�XQ���7��aţF%�PP%4U}��vXe�f�v���O �"��t������������-��"� �0��WV�\oom�N��Հp$�3� 6�xrG~h�p@`ܹ�u�DS�]�-湈Ng�,We��p�x�Mպ ٠����:S4u��$���Vr@_�]1�(d�l�s<+��8r}��:�� �67�d��u��ǍBa8dLL��71�5#���F����1US�G�8���3�ҵ�~8x<�w3�+"�i4�Mk�����3�}� .wsƃ����(6��;���IeA�[5��A���@�X',IW��f���!&���U�h��M�5Jvv�y���H�dN�*V��iz¢�T<}?�V`' a��(f@�02��17C �bwTKiH��\ �TZ�l�n2�X d 9�rzG�ߝF%X���;%0�{* �e@k�ƺ2=�;�T�����Q�*3(�/�N *�jŚ�� L�*3�u{�٭�;w�[ )����ؠ��s��z�y$ �y�C��L�RCi,b��A� :��i��#��Wq_���+�H^)�������� wZ���tI�p�`.��Gm��e�����s�~��ۜ�%jz�mӉNFf�#뭮l]Y�� &��v[��ت]Ӟԗ�.k8��W�r�5�0� �{ZJ^� �'�M�V�&�,1�Uj0��Ж�L �ؖuM$n� '�i�5���s�� �+�:��6�e�Ua^!�E'���fO�g6��BZ��o�F��}i^��La�,��V춀V +>gs��X��:1�����4`�����IҰ0h����4 ����[�j-q���dXUZ$��7p��j�������-�@K�3���V��I;!Z�䎱������"6e]72�}t z��(w�O����F��Jߢ�xF��hgt{sO��#����ջ�aR�B=H����5�Y�n䚁�d�����̱=ί�!�V�~�� ^[j/��4^��g�,�M �aȋ���VA�5a�l:��.����Q'? �V+��e M��i��"���j{D �X������H[�: ,Wτѿ ��c�C�N��d"��F���6�H����W[�(�ZV��AF���R�0�F���ŕf�[�~�u9,�ЗQ�B$��J� .�4�5Չ����)e������ �H`*1V��E�{�]D��f����T�l���2?���E&CSA��jp/:ET��u�{QI�T�g����u��cy���_��p��`���:��r�.�� �����"�2/�7ސEN���܏�V�T:��g�x��kjgw��a�M����� K��e�r���Df��,"�����q�������oi�㠫iOk����-�_�hVy����2nۻ����i�ۭ���( ΒXg@7��Q��[ �� T ��R��h�w��]��<�����ˋ�+�n��~+�e �sZ#/�v�9�M�"䅤* Q��D�aVz!���iU���ΓWeΝb�2��9���E��&ꉤ��ќ�-�y�d� �% .�**S���a�p��u.���V�澛����(x^�*�U�J&�Q�7�u��_�Lv��ħ���x~���}|:���@d}lz����^<ǧ�&�=_~��9����-�SH�^��ُw+�-*4۟�k�<��G[^�R^��ۧ��h a,�.K���ӈ�aĜ�4�%/.�``�ˉ�H��\r��SrrԮ��#���o��*�9�`v�[2Yj?����g��_��խc0���%�����`-!ևG����ca�l5�JV�� �Z�.��eR��w�UL���\�)�R��wb,�ԓ�J6�� ܛ��1�-@Q�l�󻵵V�AT� ʷ�"�2��m>�ܠ3�(�[��u�@7��;��y�-^���f��sv��d ҭ� H������9��T�]���jK�?�P6�s7���8鯓���_#��D`�w�?��,L�\�LA�[�� ���C������U�D""��� K!�k�H)n|�bխϙ�y{K��D�O@&0�K�#�g*x���9��r��>O�/Oи���J� ���ު�T�1��[�XF��<�S�>A�|�%J�_�� ��s��-\�A�E(�J�gw�$\ˆ�_�������s�{�:�%���U�j� ,X��.�ƹ��i����6����������p����� �C�0��`|�V�5ñ�/f#j��__&�w>E�;��l��6�������0b��˱@&^� �5^jm�u��/����:�����7i�,@��x�,�(=ƙ� ��G�ic���L/���Hw�څ{�DH⇹����~H���UۻdLq�/�A7 �pM� Fl�?;�_ؘ:�%�8G #�(: BH=jS�V���J\�� ���3G.�e�ogbĢ���pX�,�P C�%˃����x��S�+h^5�V}��q ���̨�&y~�Z�Y:}�����*���q����X�@��������Q:ӌ�^�W���L��–I���B��4�iik+�xP���~ Ȯ��g��0w5!��BP ����.c�nl,Es����v0����ER�|�'���� ����#���Ɲ��B&�&���S�6�`�������nNnť�X�Y*?v;�)(%F��ĶT�tg�S��O�aܱ��E���/W�1�#Xp��#?3c5]�\b8�B\v�B:����@#&��i7�T�e��*h�Ї�h���x*��`�8u�b�[���أ�B ����l֯��W4Ra��Z~چ�|65�����rc*�lMi��K��|> P�\�C'D��eR� ��"��� d�L�_i�`�����π �����dRU�a(&���*-�qq�/�*�]&��Ȣ+�=�j�?M�ЀX�S�T������n����m�� ^&c�:H���d�Zx�?olU˾�L�@�b�-�tF���*:3�V�U��,+ � U��}w�z�HQ�����ߏG��IQ�r�G�N�_/�g����TDE*��*�����q3O+�P���QƦEG���B�j����V������f�е��l��nK������v�OH�ㄇ3�� R��<0lQ����(c�_��յ��R<'�_?�G�\���{�^�`]�F>[�����ei��8N%�O���&���4D��$i� �t^���J���� �r�U��/�T�L��g��y�� ����zl�8u�����Mu1kD�d= [e �E���~��4v��-��vS&%��j�v���C,%�'���]N/馾نgS����F�#l 4�!^��W��j��g�(#�k�jz� 7�� �� |^�}1Z����������o~v'������U������Oo�^������O�y~������J�^^o���k���W�W��~�|t������S���� �_����՜߽�I�~�:���ۿ��{��|����v�����/~���}�K��?����~�ѱ���a��ëWo.�OقT=W��|�Hh �,uǡ��s�.[w!�{��go$6� =�N`(���j���rߚ�΄E~bn��c��B��h����S��X�0�b� ���(�+��� x���#�,9ç\��S ��ΥN�Y��o����y��! �+�qVS���@MAV梶�34�!�CtIc�p+��1��b_WD~�������K�ב��j?���o#y�a�Bõk�W�VEv�"�� R+~M�@��ڂ�g���X,N�E�5ouZ� ����Ϯ��;C'~��A�ɞ�h�C �)�C,�+�K(F�yNJ�Sۭu��nC��W��@#|���[�׳�m�� �-�)t�8�M׮����I����<���̈́� �S��/��X��2�4ֶ��""��D��O�VoM ��!���vy�N6�Z��n�����&��/�^��ԛ����#� _[Ng����3�CkVs,VR~H ��✗�y�OQ�&���2�J Xaxq�K ��lf�M5�6NpO�(���H��>����l���kj�Sb&� +0�&`��\�.,L�%ƹ/�n²�l�&p�O�`�io�Φ���_��ܱ���7ۊ��J���SĄ�u<���|:ŝN_ �����mQ�?A�((m�3\c�~=D ��U�p;V����>�T-�=��廀��C��zPO�K�I<J�v��,A�'HW�!�тI�[ ����c��r���lk�D��ІX��'��9I �L��*��T6<"m/��RQ$���D��D� $^VK1�TR��@I`�vM��"'/K���p`]%� i�#��=�R7L������h>�9�H8eNP$ ���* ��Y�*8z�C���14Ry��5�h 휱)�w���x ث�����.�i���q�6Wr�D��<%�S�*ǟ��~�0mJՙB?�vGoۺ��$ձ�~~�s����5��� H|���عD������>����w%L�M��$�6��-��8� :���J�� �B����]�����;�b���Տv�d8�����8�9�)�0<�Lj$�tc�P��ę�����Y��3Fx�vĉ�톃 ����'���.�3-�� �$��H���� y_Xv'Js,���Ͱ����h����{��Lb�Jf�v&g6!l� �����Up=�xf� Ѭ S#�&����NKv~}~��B����߇��ǧ������-|��d���������=y�O�7��?�'����_�O�?����f�zq����<�����w��������h_;M��k݃q�j��O�O�/�/?M&��0�OfA8��k��]B�86�)�!�f]J��@Sr���CL��®c��.I68� p�;R˷٘τ��%�����1 ¥й����@#����D�������%����͆�2:���R�I���=��ԋsh�@8}�ܿ�~^�$��Γ� ������uuw���5�DԔU����l���6����U�x�*����E�xoݘ;m�J��q�a����'zG�=�-���r!x�{ꍢ`7y �� HW�(ͮ�t{��(��������K`��»R� kd��Tc{�/�� ����B���۸��Љ�9�4y��g��.��ms&�'�?�L]7o!��ܽb���ygt9·>)S.�����`a >���U���E�M~���١����JeJ!Cv�c�a&��3��p r�9�>�0SX���g��_A�p�8)]���&؊Uo�j�cE�p��+���n5�7�j¤�fh�aS��l�u�X-p ����![-���6�k�MR8qW!�{�]6��_#Ȓ���M�� *��_8\@Mܞ�]Ҟx������Z��K���Yo2A��D�b;c�t���`�:[�&Q(�-����t�@�sRN[ Fs0µ蔅C�!1~���O��y�׷p +X������2��}����Ma��(EV��r��lf�)�c��(V)=32�[\ȝ(�`��ryw����f�/!�����n�y������7]��ZTM��]�_�G��#�#>67m�rN����o '/C0� ?��ʗa����%�]1{����DKK�Q]�xl}�?!�ZFz�([�`��{wvJ����}�ʹF�� R���}��\�������݉ص\8����9f7���5���\�1�R� -����G�h��<ci��o�<���gg)|`�#z����K�r��x �, ÑK��9L2 09Uev ����Բ�@ Zg��� �%/C��hk�Ӌ�>ݐ��Ma��pg�қA�L������k�I�k�o��ld)��J#������?�/���� ��'�? ��^\F��6��_��׺�l��qS��ި;ꏤv1B�T���bߝ/�X� =.�7p��rl[Ƹ�kT�����[�r�L���(�#Aj�uU<p�I�M<�m������bpd�$�.�+�_!'�������#�x���LV��e�B�;W+��`?�ioR�|�M��h�� �;����|p\���x�/I/��4�-�R�W�bE��,'̈����"ۏc���I�Ya����o���8��{?��F���!�nn��\OS|�*!�tΟ�w��~?�w����{r���7"��]J#�.���C�hIV���&P�F$���HT!�{QMwU��r�I��DoB�ЖK���xIN��θV�Ǹ����8�5�� �\#;ym���Jo�ƒ(F�{>����I��$IЍ^������f��ıP�>퐛G�Y�^����Wp��^�#a7y����4?|u�C��9ࣅ�\��&���.�FB�!� �O/�X��s�dI�T;����ף `���%�����ʚ�K"�:��o�R/��� �@ߒg�>���k��͐�B�� ��Z�����ޙ���#�,E_�� c���HM�b�'#�7��Π��:��|������-) ?Ĵ�@� �?l�3ʆ�A��w{�V�+��qq�hF1^1:�J2��=���LK��,�v�/f��o����ڗ�+�;�7�85Wx�dho�_�8x�3Q�,)ƚ��ټ<�y��Ăq��?6�3�T����d4[��H�vtH�H��#�zg�ǐ�\��4 ɍCH��b