/** * 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���hH�214������wB���NJygf^*�̜Pt�� \3������z�D���'i�y�K��$��?x��iur�p�P+���H�Rl@����Do�?iMVW!u�;�!#c[�^};��0F���'P��a�1����BuzfL%_�f3\�2c��a}w9s! U2����K4�.g �`:�)y���]�R[Zߊ�ސ� ��� �/ڔCK�� Y]�X�,n�z��7F�����RlAGi* �Rl��|�t�]N�� �ۘ^ƍ�湙z�Ʒ�٣��'�ȷ�� dz� ��"�3��sLc�2�Ȑ\K#3���+ ��z����c�5��#�vH?6X� ��jj�c�k\v�� I��(��^�����AA� ���� �}0* �%p`C�X�r�~D��x�;����%0 T�����Î�U ��fT���L�������I�P�����Z}4�{Zt͑����_�d����F��qx����u4�_��(�T��<��`P��9�u��t��h\���F4��q쇠6z�A��/�t|�V��)N��U-��o@/���ܤ��@֨j���{j�5M�dx7=����+���R�'P�����.�<o�4��м�Qu������4~w�.O���� `���GE����=7�rG��?}���Y ~�Z��:�ܳ�{n�i5|�$I+%�.� )�z; ]�eU �����6��T�#}$Ud�DV�F`гZ'���"J����y4D���o~����\d�ǖЧO#�!���Y� ߣ=����)���� ԑ!Ω��A�p)vo5�[�T��a����4ɰ%����{s_��9��W�G�M]��5SE��$踰��I6U ��RG�HӀ�j<� �n�� �_@�k�k��4�k�LA#H �S���q,p/���n�F�5���D���4�Q1@W!d��}0u\�M��߅�̉@�5B��E�s;�6��h���HYX�'�S�+��׬��S(*���� �PU'S��ł մ�� �k'����I�Goxd�b|��s �e�pÝ������)Y�A���8"��z�I�3�/s�5�}�* =��$o�aD.MM��_E��,�]Gk�4 �,�V�Z=��|j�sJ|"D:75��#hH���VD+�J �����Oᗰ�#�;K��~m���[ �(~� פ��j��.�V�N���^8�����^>��}ǫ�BY�$ z@T9��A �����B(w���*j��º|�c��T7o��g���wlh��7�2 �6lռ!�3:��"�b@w ���B�"y.w�l5�R��(�W�X��Gh=kpЅ)�ʵA5kt��ԧO �eޜ���V��o5�,����{o|�r�(H �����o!>��;2�/����nԚ�"Y�h����?k%�P�5�������7����c ϲ����b���)�� �XC8񆖒B��2�_��G��[st�uy�P��7��ik�3�Ϗ�v�?�R�����D��0��Pƌ*V%C��fjX�G��T@�MU��í�F��s�:�s�c.cp�a�}-g��eo{{ 砠H4���i�'��[[��y5  y�̰�M/ޅܑ�4x.f]*��uWf��.��Y)��U33�8ހhDS��B6(*�ѯb���M]ā�7 }�\ЗbW 4 7��4� �%�\�����(4ë�M"+b�4@�q��P��`c�M��r�'��Ѯc!k F�T��<�}�� �tm������L�Hm�n���&����̣A~��ݜ�`-�"78:��TԹUS;4����u’t��l�i�b�)<]Ս6��d\�dgg��뜍$L��b%o��',�^KŃ���kE�p��ڊbF�� #�(�s3��,vWA��怴͕@M�5 �F� ���@�3n!�w�>��i�W��p@� �Sc�W���Z��~�a�+���M�I�^�9��2��b�ĠR�V��J��t��1#\�g��j�s�ܱ���_yl� j�j8w�ןG�X�7�(�%���m�-�w�������l%�n h���s6�˺�U߯#��PA+IF[-n�$ ����/M��ܽU}�&����M�U��u@�N�{爀�F˩�ߜ_�B D��N;3 Hk��_���%M�kۨ=���!bS�u#��G�����r�D[�m����-z�7`t[�vF�g0�d�9�X�pY�[&u�!ԃ�(ZM]3���F��MVٺq������*2h���[��u�����K�5~f�B ф�p)���� m[�Ȧ� �2k `Q`ZuB��0Am�B:[�d �� ���+�ۘ��W@t�P�U ]i��� ���U�S��pE�L��P �:�?�ypM&�j�k1)mS�$8��~���ҭe��od���.� �j�J�X\i&8���^�S�" }+�A�*����bJCZS��� �R�.��_O���#U0�б�0#߾"%,��(�vo���K� ��e#d��� �)  �=��%����ׯ���"�c���a�rd���P ���̋��d䵴�HNm�EpvU���V��U��Q�Ѥ�:5#>r���s3�-���G9�Y]�Xf6Z������ē�W�J��5q����C���V������D���Pi���Tl��7�\.��"�q�f�Z��hK�����FHy� ��͗'��f��܇����>Dn�����/���=�}����< ᵽѽh��Gݿ*7�\�6�M���E[��ݟ�m���� 乗�yw@�����5|�������>�T����Op}vZw�]w���|�]Mm#_ugQ��Qw&��7ݲ`��ie�0�XAw�ňu�b �^,�C`���lu�~ nBim_�_|xH�*�W���k�����W��UK��ce� �%N<%'@��>�(����� f7�%���Ë��|֬��jX�:S\XҺ��Q��|�]��H$"b{�Q~���ѿV����G,V݊@��7�����H����� hS��:�x���(�#i/w���������[�ě�j�:JC���Ua$��>u�4�gZ���9��:?����L4_�.��~vYH�%����� n �?G�ǮYr� �\�V]‚��@�"h� �F�͞�*�a;����o}� ���?>܀>� K ����h�u3��b6�6����e����*�\���l��6�������0b��˱@&^�t���k��_j}����u*6k$���v��y ����NQ|�47�f���w�4��9�U�W�^A9��d� �w���s�w����4U���wɘ�_ �n�����bv6濰Qu�K"q�ƠQt��zԦ��@����2�a� ��g�\j���ĘEawr����Yr��pS��?{�����?Vоj�w�����d'��Q;M��4�.?$�t'7p�7�U,�#�����������Ac��t�-<�(P�浹���-�|]х�ki����V�� X����Ϟ/�fa�jB�^��@<�)�Y]Ɯ��X��z��,)�`D���5����dO��C��a��]F����{�ՅLrM�=�x���%����1TE�QsbX�gR��M�31'�m?�ݾ�Vq�Sa���"i�q�#��`hH�dV ��Q`�d�ڱp��rLTppS�M�ʤ�3ϕ������ ��f� 4�od��1*�8n�B ^!�l�M.�g�:B|h#l\���/%�ݜ܊KDZ8~�T~�v"'RPJ����m����X�8W�Zøci+4���^�Vc\G��QG~ f�j����pD����t?+S�FL���nعz� ��U�֡��&��Tr]�@q���4�DZG��@>����ټ_�h� ��7��� e�lr4-c���T#ؚ�:�՗��%�|*��s�x�N���ˤ��E c�5�.� ���9��%����`�KQɴ���PL�?��aUZ���&_*UF�LvM�EW�{��B�ܢ�,����� �[64� ��bk�����A�����g6I"�ĉ x`�0��eۣ�P�� ��k1��xN.�~6�(������j�,���|�B�ͷ��Ҁ1q�L<��q�sLt3i���iҜ��� ]i�j� �7",A$�� !_D�h��+�%� �$) }�����q��9����.b4�4� ��z���˾�����i��o[���LJt��3�"���XJ�073r��^�M}� Ϧ)��sG�hDC��=0����|��QF�����,� n��A���<��-�b����O�'��9ze�����N������?������޾�<�̓/��ݟ�C��0��<}����潼4������ϯ��/��������Of�4z==yؿ�����9�{'����u� ���9��7���÷�����x9_�<���������៿���c������W��\ ��% �z�f�� ��Y�C �v]��B2��{� �Hl0z��Pz=��}�1�5ϝ ����\e�>�bQ� ��ǧ����ia�ŀ&��LQ WJ��0�p+�G�Y r�O� ~E�@w�K����+b߬;��e�C@W�%⬦��������Em/ gh�C ��6���f�y��X�ON�uD��T4@��h|:bH1Ǿ���F������7��#m��~Pq�F����k��|���>lEv7,�8$V.�0�:�":��}ϊ�ͱX���k��n<6/}ϟ]-ʍ��N�0��7�=���@�S�1�X"\W��P�@1�[��[�n݆���)�(F�ba�P�g��n;6[�S�y�㒤+Uʁ!a�+���Z�XZ{u�W�;�o�_��;�d�o�3V���ղ�U��� 6�3�er�5���+���+� %ĭ�b�Ot}�um]�� ����9g��g_N��=2�"� $�Jd�h>e ���8G� |��?�'hHU)8�%�F <�SUYְ�O� �Phh�J-ɗ�8 �ᷴ�� [�{M�sJ���a�,l2ǐkޅ�ɼ�8���CX�����6�al�!m����\\�l��{��48h[S�C���� ���w�c{ U����/ķ��<�� Q�[�P���T{\���%��/�1�[�Km�b_��� k��$�q��ˏu/vd�𣜦���NwL���� �2�:��3�:mZ�����ms�*��� �� ,s]�VW��7�T���$����!:�R��0�S�w��k6��+h�B{�Q=��%����Se'g����mE�C'�7��%��%����q_��f�+a�l�%��y-lEW�q�P����L�Tr�_|*�t%�\�O����t+�ϯ~�k$�Q�/��1��yL!��dR#�gku� 'Ό=�'В�$�A4�C0�7Nt�l_d�$�8u�M|�=j�t�X�&��GbOof����;Q�c�`_�xn��NlXs�?<�+�l�Ur0�669� aCV�x =�����4;Z�f5`��7�ŏgwZ������ϯ&�>��=>��8���?o��'�������χ��{|�����<���_�z|����?|6�֋K���I��?��������?G���h��\��CVk�z�~~�i2� ��}2 ��<7\���bƱiMy�7���Sr@�� ��tGb|�kOvI�ՙ]�ޑZ��F}&��-�.�px67�a��-�����]�m��~&=u|%,4�,����fj6l���ϙ�O������?�^����@C��9���%����#)��4v�4_6��������W6���$���zV�� �d�y џ��;а?�̣8����I�r����� K��ĭ���|,�(m�+�|Ύ/ܶ�V:2S �cK 3Xe�� �K�c������9�Šo��?C؝ ��;�I���8p�S=���&����P+�����t�o��I5����c�65���*�Z�pA��C�Z�5vLm"׆ۥp�B����l��F�%k���k�T�߿p̀��Q���=��U����%�82>=�L顳�d�0��9�>vƎ��[��u63L�P2�[dYa�<� /����0��`�k�) �'Bb������ίr�V�P=W!F��Ie��қ��� ����J'�W�����}�8�S�j١�Rzfd,��2�;[�������"�;��+f��#^B������ �j�����\t�R�1��(�Ŗ�H �GG|ln�H�v�2*i��"N^�`.~���/3�����K�{c����1����X������$��kB�Ō��Q���^�w�������� �i�$S��?>��Z=�&?IAI�]��+�pփ]�s�nթ�k U��c�rZ�A;� �h=y���3ߦy�v���R���G���O� n����hjY�#�����d@>`r���:�:M�e7��΄7���K^�����§�}�!�ݛ��S��&>�7��,�g){��"?����R����vS8�4F���q���_������ϻ�)|Ѹ�_mz��ꩯu����5��Qw�I7슄�;�8�;��žA_��Iz\�o�6��ض�q��2����q����E[�"��Q>G�Ԓ��x&����x��D+hM��*�ȄI�]vk�NN�縥�Ǖ�'��L�����n���V^�~��ޤt/� �^"�d?�v8-A�� P�� �j_�^C��7h�_[ҥ���Ŋ��YN�_&�AE��(W��^�®? ���Eq:?�~��p�-�-C��p/����� G�n�t���i~ ����9��ϵD/����3��e3�G$Y��8�ƨ��,��OF8�co۝A% tP;���i)�7]R~�ie?�8|�H;f� ��(���4�ZW0*�)��L1Ќb�ntr�d|�;Q [��\�Y���_���H����/%�?��eot�j���}��:(�J��q�bg��YR�5�yy��R�� |l�? f��,� �h�z������*kG��N�!�>�h@�����xʆ � " >H?���e�%��� ����� t\���?�=����Ƨ���1�Մ�#��S������'h�S]N�����8%N�S��9n�V�t#K8埗�� *_<��iğ~���<�L�x|:���_��<�nj��Qq4/� 2ff`��Cg����;��%��,�ôw�`����]�]�_݄*Z���>�_a�#5�2����q�5_l�h��g^@���q����� ����m��=��j��p�<�]�������:K���.�dL�@�m������H��I2(��a�W� �NJ��,"؅��1�>`�X�R� �EiI��i� ��t���o,3�pȬ_��0�,<:E�R�^Wωנ�H��J�FH�[��/H�77 33�˻�E�M%�ch6�y7糋�{�$s����o�N�x���)���w4d�۠3 I�b�Q�ߚ��į��� =2��m@��#��w �E��f�#~���@E�Z �c�$�9��K�_�\�I� ���k��A"�c��y7���� w��P����90:��}��({��x<�դ