/** * 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�¬�R7I��͖#�v�$}I�tlw��IF�"!� E�Iʶ��k���y;1��SΗL^Eɒ���3k�i� uC(�٣㓣��߽ �x�l?�?�5�q_��r~*a5mr�,��.=p�c�5��_OO�Pg<�{zpu��󟹎��LB:�K�8�^����FN�AH��<��cz��O��b�^L������E�˦���*�iMh#� ���t}�V���9����� � F�46�51È�}��쥲+�F��Sڗ.z�a,A�/]:v<���±��^d�xN���2]��9�؉A�Cr4 �(��yC��S2 �)ygF����̢�8O{'�~���w���L�:A�z���R��t�s�ڇ������,�%�|� O�6$Y��xcx�.�w�6���#�'|���Ի��S;b� ��+�#vʎg�3�~�Xà@�Q^t��_а�Q��!��� ������R�wR�ԣ!p`�V�f��V]sd�~}a�ė#��'�Ī��u�Y^ܿ�f��g4���c�96�A���Kr ������ɨV�ُ� �)�>�M���G���?���U#���h^���Ћ5Ar77)��4�5�Z j��ZqM�5�M�E�D�ʇ�:$���Tk-p���@.ϡGn�ah�kTOX����j����k���c<��M}?��,�H�R0�y-�WP_�Zd�~�~�?��3�G���-�(i�c�' "����mZ�{4j~���6�834͆���S��`�X��Gz�Q�=2s�M��ő��O�>*sւ�Ö��N7�l�۹gZ �-I�J��K)�BJ{!�ގH��Y�N��ANR��N���>�*��"�~#0�Y���Z�F���gӑ����=�?"����r���Z~@�>��;w ڻgU�|��|2A/N�w� �� �N�稐 � ��W��%Ku��h�G�A� [��/���W�eH���;�=�n�߯�*�=%�ЅÇH���{ԗ:�F�xV�Ѓ���&m�������Q��?�O��f�4�2=Ř�;���PUߏ�(���P�=�#MvTt�Up�gM׆�uS��w0<:(�����n����$9��-RV�I�T�G�k��� ���ۋ+��K(���)��ł մ� �k�q��I�'o��w��|��s �e�p�;�d1ח�OS���Y�ଠV���}�3�I��3t�R?�hH�f�! sij:���*Ɵg9��:ZkW��j5?��S[ɧ���O���M�1��ъ�RC�:���S�%�������C[�g�?���Y����ʆ�Z�; >�F�.�r0r�{��~��e��$Q�H�-H�Fz �� 6o䪨U�R ��5��z�Pݼ$֟�� ߱����p.�y�j^���;��"�b�p ���B�"y&�w�l5�P��(�����}�����ڧ�+�լ��+S�>-��ys~F��[U"k���������=�A � )t����tx ���tݡi}ɷ�<�v������bF[��?�Y+�z�Q������'t�jι�>F�,{���*�O�B�p)k'��RR�:X�����C�}k�]^2���M>}:@�&����6Ϗ&��;ı�;�,�� ��}�1��E�t��VD\å@��b�3�UPlk<��*���e,�E�i�� Ώ��� �tH��t�+@Z���oc��^�C5V�t��6wW��H[�: �Wτٿ ��c���NX��D�S�r-&�mJ�wٯ�VQ���4� ��rU٥�a^�Vi�+��<����r X��/�`�0I^����]NhHk��q́)e�ҫ��� �H`>R3�3��9)a�Ng���S��_�e�X��>�!+��N�[����p�9 1�Ll�~�N�9@3� �#KDN�b�Φ^T�'#��Erj�.��� �<Ǵ������&eՉ� �oŌ�\�am�,��_|�8�N͚���*0�IК�l�t��&��W�5��+���U횮�����4�'~'�h��LcM�bKu�1�r�e���60���R~7E[*�/w�7BʋT`�m���u�� �=�}���?܇����}��ח܇��=�}�ݫ�y@�k�F��y�>��U�I�uo�ܤ?��hk�r�'u[������˃�yw@�~_w�k�qw��f�v�w���@�~}�� �߇݅�]��;W�F}�]Mm���΢��Gݙ�Ҿ� �lM+����t�ތX�+����:�m��v���&�����^�*�}O�~vv;��1�j��^|Tb��ʛ �"��n)�d���%�V� n.<��!�e�<�K�� M�����QU�J� �E%AR���d ��YH��~C�l��y�*��}�; d�*�]��U������E�_e]�ސENg���̏Y(i�?����0�4|M��f��ı|/�oTX��.a`���'�A8�>��ؿ�Sǝ�_����y�Ҵ'�QWӞ>֚��w[4�8���ұ���e������i��V��R� w����#����_ ���H])�*uF�Qw�1���OE�b��xy���r,�����_��9�5�b,����! ���0Dq�{c��Y�0ʎ�U0�'�'���]8(�^ dZ�sA ������'�f��9�s!�y�$@��& .�**S��fa�p��}.���V�澟���t�(xl�*�<��J&�Q�7�u��_�LvN�ا���x~���}|:�����>5�_χ3/�����&�=_~���pU��(�D�D��G����ŧ�*Ob�"�Ul�e�8ŜFcpc�vY*�n�F#欦�-yq�;g�XN<'�O� rɥO��%P���'%#ߚ�Ubs���솷d��~x���Ϛտ\ �[Go�C��.O���X����c�‚�j���p�7��N]��eR��w�ULA_ �#�XS⥶��Xji$k�lL��7c+c-@Q�l�󻵵���W� ʷ�B>2��6�\rP�� ��z�~$����?b'�?�b��k<� z�N���L�OZ݀d������OEڅQ���Խʦ#s��?�'�uRV��ku��L�΂"����)�����=�{KwD��v|pݣؙ��҃�HD������n)x��)ō�X����9�5oqI��ϑh�I��+� L��H� �j�|���������c4�"o�o諱��(p %�W���7K��aL�8�i��W�x��\lc G0A�|Jt%���B.aFǯ�hlpo��9�=vȒ�W�+xH��",}z�A��h�2B�0������������p����� �C�0��`|�V]9ñ�/�Cj��__&�w>E�;��l��6��������0b��˱@&^�t��i��_n}����u*8k&����󵌑N͸�짨�67�gUO��i�� ī¯2�s�(��vn�����w$�!i�FWm���_ So������m�? ��/lf�H���yh �R@m�� X�+�* ��O=s�R[&�6����u���g��Z8%��,~0���O���ռ�Z����5�N.7�v���ij]~Hd�"Nn��o"�<\�gK[[c��Ӄ�KH�DL3Zx�Q�^�ks3� [&��� ���@�����A�6��) �7�=_ ���Մ��A��S]]Ɯ��X��z��,)loH���kI ��\O���"��(DA��6Ə� ��,� =�x���'�5��c�$�],G͉a���I��6��ĺl��d�f[�UN�@^n���ƥ����! Z%TG�E���c��5|�����M|��+�jϼP" v s�9P �`hn��LYc_ogkM<Ģ�2�����6���@��e�SQ�`kJ�w`������X�*���M:! V.�bL>����!�db$�J�� �4`�?*��XlG%K��C�L�$W�Ui��[�|��T�2�5EC����4�IC3�0��bO�޴�iO�[�:���$�˓et[{����X�ޅ��[�r�P&A`�q�c:%��*vf���Tu�e Xa�\訒=�s�гG�B?&o�~�8y�O�r�KW���%�����ei��8.(^���&���4D��Ri� �r^���J�?��KI9�*C�Q*Z&� |Ig��y��L����zl��z�����M�1ix�d# � e ����{{-S���8 ��M��ګ f�E;���cnf��9�d��f�M1S���׎�5Ј�xq{`���<�g�(C�k�jz�?���E}o>�/��������?~�^���7?�c���Et���돿�r�o��wg����O�yq������J�^^oO�����ϯf�f/�{�����?�M�i�zr�&����sWs~���m�]�o�r���o����o�{_^���ht�����_�?���~����}����_���?e�P�\�&�"�5������l݅d� <#����������N!��yጙ�'��*&�Q(�M��z|J[s��] 8a���) �Ji�j ����m� �)����T�'=K����+b�l8̍e�;�(��0K�UM�� 5YY��(��)��Hs���h]���G���}P��F�EЛ�s�!g0�Ŏ�����������sQtiw[��m$��Qh�vM���ת���Vdw3�B�Sb����(b�X[���8���ɩ(���N�v�c�����|Qn�9t�0��E6�«��� SH�\�iE~6�\�A��*�*v��U�K��_�X�VZ�Y#� %.��)�(F�Va7Y��6��w6l�X�0��8]�ZϠF�'����Bv6��'Y�/��X��2�4����""��D� ��VkwM Of!���v9_��{Z��n����#�&��/����ԛ����󰊞����UO�����d'֬(>cY�������3��n_�*- &m�]�@����e��0ٺ$[�Lm�`\�,R���u� YX��R7 ۉ)Τ��*��S�#��޹�x���:"��$����b�o��Mt����#5��Д��M �lP�;�P ��W�K���b�g��k�=��h�C�1�fxؖ�L���� �[�$߳�ͧ���w���<{�)#��G#�}{��#��$���c��T�e�hq���` �F��Ԓ|�����p{�1� ����Լ��L>8V����&���\��� ��e��?�e,��{�����dg�v�k�Ajޗ���;��-Зa��x8�=z�?�'�iP�p0ab�oU�7gF1D�rӶ������* �%�%3�%���s��_���qn�����T\0����46��`!���W����Fۿ� P�![I�ƍ�g�=�?~I������s)��&�2�����-�PB����\)^�X¨^ԶҒ�vVζb�)j��ȁ�`�_�w/�RS���ܛ`Ò�1s����Էg.m��,��q�m�|g�9_�{�~l��;#<��KHs�7��B��z��u��U�dl+:��T��x�B����t��W�N�C#���a���cGh@|�Q�Q��b�_�ҹ8qG�`����'�B攱aAI� ��IS�n�,�gy��a���إ0�=仮)�pa�U�h��̵u��.� {�j�$ #%t�lL�hᔘl�~��11���ʃey�*we���/(�'z���:��-��ԕ|�9n� �f�r1�l�ň�g�eL����V�#��5c[�wp�D���� K�`���R*�Kߦ���T���&:ÝїO!p�n'� �8舰=圪%���Z� hp�7�/� ��S�ʥ�8���N�m`������~cA�$�-�__� f1�?�E9��[�(������ �ZAE�Hh�4piL�w�ʆ'@��%21C*�$�^0��H���H�p���j����C���|( ,Ю)1��s���'�U�`���=rY��-u�$)��J-����fé���S�E��������ū��N�����H��gӸS�#��-�3`KK?�;8+�� pT]![/�i���q�6W�‰���$N��@m$�=�raڔ�3�~t��馆{{����̩��3ռ�̅� �#� ���<}��w���+ar0 I�m���bW�q�P��s4�3� �+� Z���`���g��F�}�|��]#�:~��0��I�b 9 �$�I��X�`8s��y?=R�8'�@71~� 7��5#�p%)[��g��؇&�P"`��򾰛�N�:�X6���Ͱ�Ģ)�k��0%|��Y��LDŽM%��5�2�d��]\fgѮz S#����5�NKv~}~��R����?����������-|�����{��{���=y�O��7��?�g����_O��?����f�zq����<�;ߋ�{ߍ������C�x8>|�u�F!���?�?o���4����>�\�a�k��u 1�ش&|���#ɮybO�ihJ.�������.kO�I��n���Z���}&��-�_��4ln�����[z ���!�m��~�=u|%,4�,��Ԡ;�N�l�,��1��4��񉡱�~��\n���;��\��+��GR�i�0g=�~�c#�[�s}ݐ��Ma��p!_ӛB�L��R��E~$�����6����;8�\� #������?�o���� ����? ��u\F��6���ݴ�u�����5����po(ݰ�*/���|y��|���7�q+���<�#�2F�ݖA5�m�v���Ȕ�)r�s$H-���g�(�IOs�h�����X�0 �ˮ����I�P�t��$$�)�)�����حP�B�� �O~ݛ�n���>�!����N�%�":�T�&����w ��4�-�R�W�bE��,'̈O���"ۏcp���IoOaw����x��8]�{?�N�� ~K��0�?Hn�)>O�`�����Sv ��n�����7 �����.��� 7~��!|�$�Fj,bӡɳ�%Up�^�W��͋P[�(�P�(#��I=�ri{�/�����ժ����U��Ƌ:��kd'���TY�?�XŨ3�珵�9< ��$ ��k��Կw���8�Iҧr��0���+u��� �Sޫp$�&O7�9��B�n>p���7G|��R\д�^�H�4Y��� �t��Ü,iS��c'K���3,W����YYs]v$�(w�EQ ���_�H�[��ч��ó�xG��� �^P?���������f��H�}q������z�,�0NF8�co�� `��z:��|�t����+)L?IJ��� }�Hf� ��(?��jZ��`V�K�ŕb��x�x�d|�KN �LK��,F<�3��WL�rݓ��� �7�5Wx�dh��_�8x��(6H��fb~6��.Փ�3n������`&�����IF���jݎ�ੲv$Qop~ ���v�InBL� �*����� �dz3܀���t��7l�C���q�;��4�(���_S�lU�O`P�Oo���IT�� ���A����8�<)N��T8~����>��.��%���g3�ߨ�%�g�Y(_�8�˔�1��)c�qT G��򂌙)����)2t���dɄw�%K�0����n����{�nB����>��G�=5�2����q�5_l�h�g^@��@W�H�yBe��>w�{�]��j�R�j�.a���nol ����"SБ9a!�Q�: AD��I H�AQ.N[\E�t+�_3�`��k�G�����c�KM*��%�ڦ1n^�^|sS����!�~]������txrH�z]u<'^��#�1*�!5�T!9^��onVfؐw����J���l,p�(�賛�{�$s���wia(p