/** * 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��$�C��Ą"�%Y����?�Ӽ�����)�K� �M%K���ݎ#�@��P( �ғ'�����<#�h��>�?�5�~G��rq&a5mr��ES�:þ�LgC�S����\]?���'��}&���:� �֪T|��^� Y��u� �S-X���{��J�����*�����*�i h%u+�Xi��i�@W��$b��Ĭ� "�qH#�X3d4�H�ϕ}�TwwvD�giG ��A٘dG�|dz�U�ء����ı�AǦcǢ ���9��2�tiG爞DN�������IE���� F�R�{C�Jq�f�* "��rͰO�8c��[+�g�*o�"_"�G����!�dL+��mB#9^�\KA��j�\���� dxӅ����CFz4�{�5�*�`dj���Р�ð9�YI�t�u=3���� ױ���J��wWC�P$��#2��&��+�bv>T>T�:Q����»�m�^�CE���Z�PiWM�CE�%`ʫ�ׇ6������3���݇ƢRk&A�E�`�9������Y��F��O�h �����cvjS5���6��98������C�S�����R}�y�]ɑ��ll�ė�L�I:�J�<��)ϋ:36 �n�S��#gO�0h�<:!'����MwDO{��u�Q��Y� 6���P��/�tv�Zeh��NoZ���k��5@r��)��4�5�ZP��-���&k2���*,u�*Ƭ2$@��sh�R�Z�-*�\^�ͬGahNKT�Oئ��� j���vJw���<���M��hz$R)(����+��<�3i�� �G�˙�G����A��%�\�/�₈F�0���|�z���zF�����0�"EZ ֝+�@o=�Gk���sUZ�Hr�Ǐ,rV��nM�O���=��z��7jRK��R����R ��.�y�FB�A��6��T�]�+du��u�A�Z���:v��#��M�9�:h����?����wM�����1�n\"��U�=��i�V�R�+j ��r�Q! �3���X��&Ke�섨���.A� [�g�+o�7}��G�N[���wJ��pOAH04����l���t�������XP]��:�>�3�?�3�=�؉J�LA"H �S���p,qU�v����@U"X����U�0�S�>8� �H�oB�0n�4x��΄�e��:�E��c��({jl�Yg��|4�2 "9{{ve� zQt2��/�8'G5m�����a�%���ձ�__�c<�|f0zQ� ��x-!����N�� �í~�n|iad�'#�2�W���'0�R'�HH�F�. sij:��� Ɵ'9��Zm_��j5?��S]ɧ���&�\��ę} y^ً�hA�BG)�x���c���������B_,g��E�@� ��]O��3>���I��~afey������G�̦J��PI�E�$KЃ���Zr宱{#�E��.��,�p�Ԃ��� �����}dž��{CQ�N^���ס���"��@5`�}�5!��JL��"[�ԛ�`+J���#��u8B;>r}P�:]�0������@ Qu�Jd��c����ܾ3�9dj ����@���M����|_�j�Kb�|��,�������Ю%�5��?� f^�9��G�e��U����`&�c ��7Ԕ� �����yȶo����S�2z����Ct�a���??{��3q6�4�#����GT��\�W@C�X�%��WxqVɣ3P�AU���tk��QNjHm���L�L��̥s �5�@p� .`9�����#(†0ט�_yq2��ٱ��E��b�^Ԇܮ�4l�Z.g])l`�� ��*���Bw��2�f�w�ш�jͥlT��[�t�>�)���կ�` � `,šh�e\曆1k���u}��:�� �۫D2WĶ�����X-pʘ��3n��k2\rJ���l0UӪwGQ�{��(���~�z���ڙ��8�jT�U�-TH M����W��`+��Ŧ0q�K-"1i,hs��6��p˄'�j�ZM���b��6]Ս:^g\c�./ﳜ�$L�*R�J^=2I��w���[��G3E�pu�ڊb��X��Q��� )t��:��Rm�Z�����Z�Z��d ���@r� ��r|7*k��E*zc��^���fi���)�����#� �~�V����[� �����H�Y�e aӥJʌp�}�lÍ��c+!����Ԡ�p�z�?bq�"�/xh���B]i,buWA� 2�K��]����q?TmQG�BI����S[�Y�p硵�A��h���EЃn]��u죱��s �vi�93LK��jݦ}9�w�RC�kM�0��^&�#L,�����Cb�LtM{T^IzQ���W�/�t`�����5���e���H�@%���N F�겖�벮ʼn[�"Hf��]b=��X�֔k ���8z�iS�S$�l�4�Qݗ���4@ 5Y?��D��}iN�p�ps��k 6k@�� ��9]� l��21���Ԓ4`�V��HҰ0H���OӀ@m_n�(>HI���.Û��P�F�{׈���J+���]�@ ����L) �V��2�'�AJ��06�Q{�>oPŪ��FVŃ4 ���Qn�����zin+}��` 8�����7�y2�al����;&uQ�Ճ$��S� �1���z�7�nܨFC���;��� R5R�5��:�R}E��8?Cpd����k�]^�|���oނg�Xt��Ռ%0�x���h0MPk��W�T9H��� ���:��5 �0TcH@�ju �>��U�Q��pE�L���� :�u�-�&��W5[1)mS@Mpq�Ե�ҵU��od��ʮ� �j�J{��RMp`�#ه^�S�y�* V��u�A���d@CZR�5���K�ʳ����|��:��-�r��n��������e�_d]X�!˜�\���񣤩�t�Ϗ����F{��a����{쮧�<�9��=qw�+���w ��=s���K3�U�j���8nj��Zu�}�c��g� A+'�݇?<㦳�;;� �f��iŝEI��p��:-�Zovk�B��Y�b�ԕ�SE�F��k�9;xC4>�X�m-Q>N��r<�z��oc~���ȃ�(��o��b��BR��׏�p-��J�д�f�$N���2[c��@��@�9c��l�W�D9�ivv4W�ܑ�<\r@��'�� 4fL�� ����\<1ݭ�ݽ��P�t�(x��*l��^��)V��i����)��3��)��q���a�N��}��L���Ew�E#|:�jB�s���)W%��B x�A�ﵗ�7hv>�PE?�y�����9ŜD#pc�uy*�n�2��sZS��<�@����s,'���'��d�Dr>jS�y�Q��j%v�o+\oDO&+�G���l���Ű�w�>���w9x��%���(c%]� Kj��Z�ý�A�5�2�]&E�z�\��ZP��� k�R��O]�j :��š�1<-@Q�|Y𻳳�������[x)_ ���[�O�`���z�n$����GNpw���Cx�*t��L�Oz��ɶV>�>�9����F��ZS�R6�#7��A?��ղ��ש��{P�[W��oE���\�L�Aݹv��E#���ug�3�=V��H���-G��R�F�n5R�[_�X��=� î���'����bT�)]BI"S���'&�.0}y�`\�r��V[�-�b쭻JC���Ua&�>u4�gZb�s��v~��cK�#xEP}*6 �g�@.aF'�cT�� �b��Á���"B��%բP)X��&Ael$QIhh����3ۉ.��X�Ş ����d �dXj0�D��U��خ>�4V�)���1�U�c�^:̷��"2��!(L�V�86L.PS<��a.RS|�IU5�j�MzϕR�١߉-e��0-���ed�O�X����&Ls� BH�j�V��x�L�H|�=K�]���.c�X���0�T����*����3�)���h��=���}W+���k���EUxwQ8�;;��Ӊ�٤�+���5�"�^�ku������V=��FhԴ�`ܫ6�v7d�����c����y����>��w1g��*+�̖\’¶��^�ER�b=!7�B�#��sY �p�'�K�dF�O�<�xQ�h��nj ����1lr>�(��&�Y��׬?j�^視��p���«u�Y'q��$^/Y@eTh!��i, }\�p���BqR��<01�R���t �q(� q-�>���x�OF��+��u�h�E�.l:��|��a�ԇ��e�"5� �sLt5��m�km9-�0�R[h�K�H� qR�H�E��� �1���!a�$%S�ovw�>�w=�c�)�=M�l �iY����x�_M��/��:��f�sg��l����Og���������~v��ӓ1;{Q����~9~����W'������{b�O���ų��/4�������i_��b�b��z�w/ލ�8^P�rp�*���݅�9��~�~S;m���뿌�<��}:���u����<��&?��={����G����ݏ�=����O�/^M:���64���|�H� '<e'�b z���s�� >�"���s�7��T�Eg���;}��ūo��D��{���ҞƝ���N���3E�\)�}m�p��|d��˗���q\Y̥�a��o7�ƲQ���0f��n)�d�� +3Q�˕34�>+�趪���m#�i���\�M��ؿת�������S�!G0�E��i�x�������Ӹ�&�ݯ�ﵺ�o��f��7�f��4d�~��]�B��^e�l�J��趪����x���7���($?8�/���a��^��m�1q}���Y8%6s�z�zs��L���.�stœ������ J�9�)?�}y��񼛗����2�@��0��K� � n�7�H������������C���8�˫�|�d~�|e���W��1p�3��|i�Ol� �e��1��~9nT��I���u�msT�FE�_=� ���}Pi���9�'��/�zА.�5��� R~#Z�l_�#!qE�_�\o�j�V��h����s� G�e���pAiHIwJ�r�Q��y��� Z� Tg�[M�8���끕�HE�g��\W+*�;���ʳA��:!,K�S���*W���-���3��9>�:l�ʐ��s;������X�x�l��H˯\�i`A��c[�I�Kmr�� �r��)S��V�����iQ�il"a�V��4Zƿ��2�F���F�ڪ��2ZZ�e�e����Ҿ�Ѫ���j�hU���2Z�������_F�K�F�K�ڿ�Ѫ�V����~���������_F��ڗ4Z��U���W4ZͿ��f�U��h��h�d���$�JM����#?��?�(���Ļ���Z|��&?t��� ݍBr��ИߖJ�tZC�M~���k<4�G���W��=}�.�q�g�!��o������^J|n�䏾�B��@�Z:��&.u&�lq(K<5Å��|�%���d�~�S�`֝�u�}���w�H~���>����x��1U��6j����ӷ��}�~^�] �]􏎞�����_��ѳ�ѧ��=;w_�`��q�G�=�x���>�M����s��� z�}�?�������#���?z�5�{!o��?���? ?����;�T?��K���?hbF�i ��(���׎?%��+���+��K"|����Q�$7ix8/p-���0�l�Y���w)�=L= �/����F!�ă��i��)����+�\˒�Z�0w�s�n��}�&/?���#C�����.���M��|���<��:{��$��ޣ�3������eu{��� Ց\�:��k���YK�rg����Am!]�/����~Ƞ&����GO���)��'zC�� 1��Ր8��vx����. ��[0�=�"M��T���ܯ���0�9n�_�%�%��6�j4���J1�'"L^|4�A���m� Б�W�Nf��7����o�z���us�O�!&��n�@���;���F��2��k�,R^ ����?A�2¹�KbK�ɹ��p�|��Mv;�c 72\��� �L�)g.������u������q����~����-�́��Fy��׺��@�ə�"��ڃd���xԷ<��k����ƨ65����j��(�ʇ�#'l}�68��M��<���ւz��bfk���%��8`U|���C%����Q��)��Id��M�ޔ��0I""@ �b����)nxUB�Db�9�>Ǝ�Y���Mn�pLq!�J�`����$~OB^��c0�D�K$pM��БᷕOh��y���5,@k ����ml�#���Cp�& l��1S֙�� ��̗$�� ����/�������.�gJ�s�8rW׷�3>_=\��~0��O���b�V�_�{~P��r��a��|�#��?�;�cw#�G ς.��_��I�y�2��ϼ�"#��ڢ$�|u㭍�[Yb����}�㱕_�}��N⋵q ��4�5Elo!����_PMK��������]�i�7�b��dF ~���� "�x�A ���ag<.X���Um� ���Eh��,k�A���q+�}��!�x|�����9b����9�n���1��b]8�\rtT�.��y�ɩ(�hS-�i�R�O�I�W�Hޮ��� �~C��>���5)���mEl�P!�Ç���1� ��L��ۥ7B��{ ���|D��#˦�a�����o�&�J3��K���Ia��@�_��+Y_'�5Y7��0�-�Dd�QNJ;i,%�(�(� {0�K�Fގ��.��1�C��t�T�OS!0L�����3��~x�%�K���b_�������ɣ�#�P���$�DJ|?͡���މU\�����M�v�^��:,#��I9�qi{��()��v ��JE�y�;��*c_bTXP���Kk/V�K"u���4�eO��:I6#����HS{�� '���Nq�E^��2�I �)�E8v���vN���3h��j���ձ��^ Q�����p"��H%&�|x�9M�9W��+@��;l؎1� �Z����̺�p�� ���U��)"<�t�[��;�%� o�I-M�"��z�� ��K🤖b:?"��'���/���8`��J����GG�״bY�����W�&�0Xm�d|��w � �{ %�SҀ�[E��^ X F�kV�(v�L�qM3?�W�8�nIP� |��? fr�Y�<߳@�$�Zۯu�fC�D��(Q��� ��K���(��v��Z3 �s��{�'�Ý}�K6�������Q:.�ԟF�\|�u�pF��/���)�k��5� q� ���G�5qc��� '��I J���"� ����Z�p�2_#�������|D�x���^�|>�����g� �qf�@%���(ș���"CG�@��!K&��,���7�`|\u�p�@��PA/�S�7X8 j�o����)�|��N �?�u� b]��1��S�uf��.Y��$$�@�E/�R�k�Sڨ<�Tܔ���w�/��$͑�KK�̦� �h+��._[f��Y��h'�-<%Ec<9�R��:�m@灎��J�:�5�oCr� -__�&iB#��q���U%�#PA �Z F]