/** * 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���_��g��L�3��=��y����\��B�!�iѠ��]jzc'�� ���*��cz����b�^L�����E������*�iMi#�����t}�V���9�� �� � Fg46�55È�C���ғH#���J���0�� 9�.;�mz�XTa/2q<'v�|d�.�M�� ����������ܳ�+��4w��ђ��Ƴ��� ��G;)ٝ�y�83sBP�5p�pBw��V���>D�W ���ؗ��I&<��$����6�J/A��� ؀45M .��f�j2��B�wl/BF�4��;��v�1`�ԉ�O��'��bf%%Ӆ��̘J$� @�f��eƎ�5�(��r�B�d(���h�]���tZS�44�����%���� ��!�����_�)��(��z���Y,�к�1T��D����(FKa`�[��{ ��'���o*��e��l����h|K�=�pp����|�ؾp<ۿP�.:�?;�4�� ɵ42#z��@p�����N>6X;�>B%��c����۪�6?6��e��ؐd ��j�M�%:�� d��� ���݇ڧ��Z?�Ê�/��GtŽg�s�~�Xà@}Q^8���i8�]ՐnnvA����ԉ��q)��萔 �hب�G�g�!�٫_��!��H��I:�j�~�W,/^G�}� ��h@�ؙ��9 5�^�C@\W�MwN�Ƶ��nD���~jS�����|��㣷j��p⌯jq�~z��H��&%Ԁ�FU D �S+�i�&û遽��WH_y�W���=�j����w���)8ᦱ��U��� �x7�A��X��a�}Qw ��wϪ���h</N�w� �� �M}ਐ �K�c�Iܒ��lC4����qH�-���V�Ch�2��޽<�n�?��*�=%A��݇H��bD4�:�F�S��A]@t��h�~���\��_��a\3e A��b��c�{�U�wc5 �!(T%�~�Ɏ�A� ��샩��а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��ӧ= �a��??��aC�hJi�C{���cɚ���W@3�XQ���7��aţF%�JP%4U}��vXe�f�v���O�"��t������������-�w�"� �0��WV�\oom�N��Հp$�3� 6�xrG~h�p@`Թ�u�DS�]�-淈Ng�,We��p�x�Mպ ٠�����:S4u��$���Vr@_�]1�(d�l��;+��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��`�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�.�� �����"�?e^�o�!���]��������t6϶������z��l3�:��E�����6����È� VVD�ߏ͙�^ _������Ҵ'�AWӞ>֚��;l[4�8� ��±'��eܶwqkK5Ҍ#�[qkKQ4< �%�΀�Ԡ3�(�[��u�@7��;��y�-^���f��sv��d ҭ� H������9��T�]���jK�?�P6�s7���8鯓���_#��D`�w�?��,L�\�LA�[�� ���C�������D""��� K!�k�H)n|�bխϙ�ykK��D�O@&0�K�#�g*x���9��r��|��_��qyk�x@{��R�P"�nbU�{�O���(���o`���ml��&�/B Pb?�)$�Ft�z��W���#�cׁ,�n�ߩ��T��^��w�w4΍N#D���3J�_�N|�����^��e/�7�%��R�i�= Zu� ���Mj(~}������^���`O��Cw���8����-��x� �Ѻ�~�v� ��/��߼Nef-���KV>��332�)ʎ1�f���O�V����{�˘�K�\/0��%��(8;�F��0���9yh�<�>������q׸��I���ƣ��O�$7��:�J��b9jN ��uK Է u&fc��'��7�*�m* �r�#�6Nx$x ���*�28�,��lC;.\�׌� n��\�TCx�Q�S^�� ��F܍̔5�C��M�O�K d���i���PG�m��(X�@|�।���[q�8o�ʏ�N�D J��51�-U1��g�Skw,m�f#�;���j���"�ȏ��XM4����ݞ�N�ge*Ј �|� ;Qo�v� �:��0�d�<�J�+(N�X��f�8�h>�ȇ��z;��k����AX������,�M���e,�ܘ�b[SZG��4�$�O�Ty�� Q�r�c��dl���%S#�W�4X��36�3�,q�b*�Pu���'�:�J�}\�� C��h�ɮ)��J}ϽZ�O��34� �)`*z��~ M{�n��Z���}�/�1l$}�v2O-� ß7�*�e�P&A����c:#{܁l�b+��*�`Y��̅�*�þ;� ={�(��c���Ǎ�W��({�ģW'����3��o�5P����T�F~�S�:��T�,:=���0�_���8I�c\4���&���H�,|��� I`do[�|6���c�`WIVQSInU��`""K��Ċah8;�����9��;�d`Y0N2٬�ot�Bi��'����%v-/ !/+�͓֧��^�@��bJ֖ =(PdY� h#2�[,@��ݤ�[n�}�0!� ��m�CA���=C7�kܡ�c�9��? �'������h wd.�"� ��V�%����~ 㱪�C*�"@RIQ ��t渙��p�'�B�(cӢ#��R�� 5�f�fb+L�J^� W�b�Z�h��~��w�ZC›��'$�q�ÙMR��)qb6�(t���j���/���Z�})��[���#J.���=n�Z,��f#���Dx���4` @��'{��\��L��q�4gb�/>WZ��?���KI9�*C�Q*Z&� |��C�/~��������?~�^���7?����yt���돿�r�o/{����{�'��������e��9��~�����F��'o��������w2i��ZG�0�{���w/~s�O8|��y���������_�~���# ��~����}������^��>e�P�\�&�"�5������l݅d���A���`.��;���z����c�}k�;����ʎ |" Ţ��Q�OiKc��¸�'L2���@��vO+`��V��l�@� �r�rN%��:�:�g�WľYw����!:�(��0K�YMi� 5Y���^�Ќ��m$�9�m��h]����F���=�h�n#��\:Đb�}]������+J��_G�^����"���=�1 ׮�_9�Z�}؊�n&XHqH�\�a4uEtk ���;c�89����i�.xl^��?�Z�� ��a>1n${��1!���8c �D���/��b�+�Nm���"� %.nZYS�Q���2�n�^Ϻ��v6l�X��y�6]�ZO�F�'����Bv67�OqG�����cr�ʬ�X��C���6�{Dp<�Z�5%<������:u��?h��&�oX� ��z�BSo6o����*|m9���t�??��<�YQ|̱XI�!5��s^���>EU��K��8>(�`���.-LB��E6՘�8����H �#׉��<��N�� ��|6�L�%IW��C��W���?�����o�w�)^Z�05ȗv��T�T/f���[�eS*1(�ĝl�gF˴fR6��W/��WJ�[Ѻ0�8�����4Ek 4��9}-�@ڌ���fW ����)k��D�8f�h��H4���C��H�9-Il*Z�1׈�ʲ�8h�l��B�b�UjI> ���H�M>����h���kj�Sb&�+��&^�i�\�.,H���9/�F²}l�&��O�`Cio�Φ��w^��ܡ���'ۊ��J���S68`KZbq���+��?���!���'WZ��Q�I�p�J�k�����i�J˶�Jϲ,��M�m���n��ߤ���{�Y��湮b�k1�4��  sE��Ҿ�����X���m\){����×�r�z�޸�"��h2?�����f4�)�]A�s�x�c �}𢶕� ���r���PQCW�F<���}#)5}}q\�+�׳pS~5�1���Ki��q¸?�V[������ �6��@���؁��O�!�w��C��V�m����)�mll��ÅU;������kv�c��C#Ճ����c��4�P19&>�(�,bs�L���'�ʽ�{5��m1�.+�b� ��0J����N�6p�pg>�K����(��G7ĸ����������s�"޻s�ݭ�L||aa' �aT��8o�iM ��Mۯ�T&"�c��Y���G�BF����=��t��r���xPyQ:*|\9n� #��t ,F��(c2�$H�C�2��o�9��܁k+�;K8�� K���S���R*�K{ߦ���T���&:�e�c�7�8e��a�A g�sNՒض��Z� hp�7�/� zܙy�RoO�R��60KP� �Ur��� F��ȯ/��������-۽(�����|��M� ��"�h�4��BEx�ʆ�@��%21C*�$�^0��H���H�p���j� >�*�|( ,Ю)1,��e �������|! {䲰�[�IR`��Z����G3 �� �DA3yc��s2����w8?HC#��O����:�������pG���>?_��}��6� �&hhos%N��S�8%�q��,���� ӦT�)�Ӳ����M+��%���Se'Ǫ����1�$�7��%��%����q_��f�+a�l�%��y-lEW�q�P����L�Tr�n*0����������;�b-��Տv�dH��u��8�&9�)�0D�Lj$�4c�P��ę����TY��3�Ex�v�����x� �~��'��)-��,����$��H��� y_XZ'Js,����Ͱ�w� d��7�{�=Kb'JfՖ%g6!lh 5�����S��N.��hW��x�]� v�%;�>?z���j���������������z�� �����|Ȟ���'���̓�'����������ٵ^\2�7?O�������d������9��G���Z�`�Z{��������O��d8L�Y��f�F��%ČcӚ��m֗���4%�q�^�4�.�,֞�d3���#�|� �L�[�_��@lq��h��л��߰�@#����D�������%����̆�2:���Q�I���4��ЋSh�@8U�ܿ��^�$��Γ� ���������&�'�T�PaSV=+��m� [IsW��i��η`�1�u����O#Un=� ��wGj����lb���VdTl���q�7����-�B�2 ]��4�����Z�8����n.��� �J�/����R���8JL6DP�_��Yb�o��C'���[���㞡뻤?h�͙ ���H2uݼ�(�0£ ���<�3��[��)�H���O��� �;�ڪة�"��F����`�mkj��0��!;���0�Uƙ�`�9������)��V��3�ݓ�o�'����O��x�k��6@��1�"o8��Uz�a���n'aR�|3��@�MM���J�8\*��䐃��k��P�ȵ�F(�����=�.�d��u�������/ �&n��.iO<{Ukb� -����%sz�7�!LF"�tN1����c��Vv�b�m� �(� �YVXF:Q ȋI)�- �9�Zt�€�ĉ���{�gB���Y8�,TOV���qR쒁�N�u��D��覰��w�"+|@�z63��QYvܪ���-� �N n0f|�������Y3���wy7ȼڿ�wq����T~� �&J��寈��@����6R�Ѧ�J�{�7��!�˅~a�ˌ��~h��.�=�om ��%V���?q<6���ڟ�d)#=Y�-d����:;�{uv�>��fZ#�T����@O�I�ORPRs��D��-��`����rj�C�A��@�\����#D�4ZO����̷ir��س�>0�=�~�3$�[�s}8�T�Z���� �� �-�R�W�bE��,'̈����"ۏc���I�Ra���oy��8��{?��F��!�nn��\AS|�*!�tΟ�w��"~?�w�����p���7"��]J#�.���C�hIV���FO�F$���HT!�{QMwU��r�I��DoB�ЖK���xIN��θV�Ǹ����8�5�� �\#;ym���Jo��ƒ(F�{>����I��$IЍ^�����hf����O�>퐛G�Y�^����Wp��^�#a7y����4?`u�C��9ࣅ�\�ⶦ����FB�!� �O/�X��s�dI�T;����W� `���%�����ʚ�K �B��o�R/��v �@ߒg�>���k��͐�B�� ��Z�����ޙ���#�,E_�� c���HM�b�'#�7��Π��:��|������+) ?Ĵ�@� �?l�3ʆ�A��w{�V�+��qq�hF1^!:�J2��{N ��\�Y���_���2��͵/%�:�w`ot1j�����:(�4��q�bg��YR�5�yy��R�� |l�? f��,��h�z������*kG��N�!�>�h@�����xʆ � " >H?���e�%��� ����� t\���?�=����Ƨ���1�Մ�#���[xD�!���'h�S]N�����8%N�S��9n�V�t#K8埗�� *_<��iğ~���<�L�x|:��oV��<�nj��Qq4/� 2ff`��Cg����;��%��,�ôw�`����]�]��^݄*Z���>�_N�#5�2����q�5_l�h��g^@���q���n� �����m��=��j��p�<�]�������:K���.�dL�@�m�����v�H��I2(��a�W� �NJ��,"؅��1�>`G�X�R� �EiI��i� ��t���o,3�pȬ_��0�,<E�R�^Wωנ�H��J�FH�{��/H�77 33�˻���M%�ch6�y��˰{�$s���k�V�x���e(���w4d�֠3 I�b�q�ߚ��į��� =2��m@��#�ط �E��Ε#~���@E�6�������.\�����L�e�o�_�T��'���ͻ!^ �\m�o���h���������(�7ۊ���"T��