/** * 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��]��۱��%�ӱݽ{'��$&�&)_��k���y;1��SΗL^Eɒ���3k�i� uC(�٣ã���߽ �x��m?�?�5��P��rz,a5m��,��\���&�k�yu=s6"�B����k��G0��~l��z[����F׸��,P^ � �D瓻Ⴢ �}����`!T\K�W�y�b�˵�;ndzܹ�t?G,�aP��(/:���i8�]ՐnnvA����ԉ��q)���i)��8�Q���s�Bc�9�W�>7C�ˑLw�tb�h�:�X^<�����'4���cgO�,�������4~w�.O���� `���GE����=7�rG��?}���Y ~�Z��:�ܳ�{n�i5|�$I+%�.� )�z; ]�eU : ^9Im3:��G�H��������g�>NjE8��Mǎcϣ!������_h���G�{l�}�4��\6h�U �=���x �8��3�xA2�@���B2t/\��]M�,�es�����C2lI�������!�c�����vS��a�T�9( �/>�@�M�����4�4����Qݤ���W7�>����i�L��F�@���yDZ���껱�����~�Ɏ��� ��샩��аn���.�gNʭ��"/��1�k#I��x���U|�=Ut����x e@Er���ҢA� ��d�z?A��G5m��9��ډb!j��ћ�4���� ���ы�j��������)��A���p�P+� �dd����$��Ui�� 4$y�و��45~@�ϳ�w���4@��Z�j��V��)��ṩ1fACB���" Z�Wj(�@��_?} ���1�Yb�sh��L�R�G�P4h�&}7Vc�� ���w$|(��Q]��`� ��I��;^ ,�B%I0�ʑd Z�|�< \�l��UQ�����k�� ���y+H�?k��cC����i��a�� �����)*  �`��*D�q-��r~�V�)� ���k���Z� �C �rmP�ݰ2���By�7�G`�h�U%��[�1�/���ߣ2 �Bw�����o!>��;2�/����nԚ�"Y�h����?k%�P�5��0�����n^�9����e��U����S�.�c ��ZJ Uˀ��yȶoͱ��K�"u��ɧO{�X�\��~��æ�є�x�8�pǟ� �5U��W@3�XQ��l��ÊG��V��Ck�~�.����E����Ӳ��,`�\��@�TD�m� �5�ٶ�D'#�֑�VW6���׉�kz�-�tHlՉ�iO�KI�5��Ϋq9��n@&�=-%�Ɇ֓��v+� �@���*5mxh�Z�Ll˺&7b��̴���j�9RB�֕[�wq�2Ӫ0���b'���fO�g6��BZ��o�F��}i^��La�Y8��$�m�V|��tY7���ub�5�*h%i�h��ͣ��aa�^��i@�Փ����Z����ɰ�2�H��qo���h956����[(� ��igFi�6���vB���cm��ї5Dlʺnd"���)�}#�܁~����6Ҭ��-zKo���n�`ݓ��c}w�����0����$E�j��,F7r�@o��֍[�h��w�WѐA�F?�߂��-���^ꯁ�3G|�&��K�����gh��؎1x6�U@� X�X���� � j���2�&�tW��D_���|����j��HSm�V����j� �+�g��߄jձ��Q'��d"��F���6�H����W[�(�ZV��AF���R�0�F���ŕf�[�~�u9,�ЗQ�B�$��J� .�4�5Չ����)e������ �H`>R3 �3��+R�r����m����������]6CV���A�`A;��B!�G0��[���y�:�|/r�KLw�Xs��T�mz@<E5]Lj���H+��.oPk����ˤ*S�ԫ����Gp���Km;?����H�*٘�.xo�V�0Z�� �.2�wkk��/��o�yb>2��6�\�P�� ��z�~$����?b'�?�b�ū<� z����L�OZ݀d����ÜOEڅQ�����eӱ9w����:)+��5��N�&xgA��� �ܔ�up��Խ���xn;>��Q��|���H$"b{�Q~@��ѿV����G,V݊@��7�����H�������t u$�Lo5P>G�^���� �� w��V�7���[u� 8� ��Lܛ'|�0&h�ϴD ��s��u~.����#� h�%���ٝ! �0���c46�<����dɕ,��<�Zu? �����qn4p!j4�f�D���ħ����.\���p�P2 ,5���U7�p���وڤ��ח���O�j�`� �����T���W�_ez��8e��/��%\?�]�%nK�C�T����%c�!�&�8E@C6�3�����l�as�h�D�\-�H��,!� �M}[3@kqe�36 ��9r�-|;3�]޵�ӌg��[89�-~0����4���]�>�����Uh�N���q��Vh1¸�\�Ƹ�`�-���̌�tAs�� qٍ �~V��X�˧ݰS�������� �O6��亂��Rr��oi�c��#p�|����U�&g�H��oj�i���Ri Z�2ˍ�(F�5�u�{1I�K���,@�Wv�N�+�I1& G��;�]25|��t�K:c3A*��XlL%���C�`�$W�Ui����|��T�2�5EC��W �ir��f4a<LŞ0�sCӞ��.�Vuv[�1H������1d;Y�� ß7�*�御L�����-�tF�x�U��[�?��,��€��Q%{8v熡g��<~L����q� �e/�x��d���bz��ͳj�rv�����/�Jw̓�K�����0&�˱�'�|�� 8x�dq�)��Eߦ$�BR���V8��"e��6�U�U�T�[��i2�H��R�8�b��4���=�A=��D̓L�R��WD�{f;牪"~��]�KC�K��e�����(�1����%H Y'�� `� ���S7i�l�5L���2y�rW���i�D>y�� �ڄ�Ћ�1��T䟄ѓ��߉��v4��2U�� ��V�%��ະq ��� C*�"@RIQ 0�t�q��V�%�T ���M��|�K��/..�$�)���05+y5+\͊�k]����ݖ��k o�>���Džg6I"�ĉ x`�0�0dۣ�P��@��k1��xNn�~6�(�仕��I�j-���|�_�=���Ҁ1q\Z<��q�sLt3i���EӜ���@]i�j� �7",A$�� !_D�h��+�%��IR2A�f{����s~�7�C�h�i�A|��0l[�%�7���-S��a�8 ��M��ګ f�E;���hnf�v9�d��f�M1S�7�׎�5P���W�Zk�3q���5~5=�?���y}o>/~��������?~�^���7?����yt���돿�r�o/{����{�'��:����Ӄ�)�^OO��/�~�j���ɤm�ku����_�߽��}>���m����?^��?��>�%��a���������0���ի7çl������d�B$��C����P�¹]�����{��g�o$6�s=��Pz#��c�1�5ϝ ����\��}" ż��m�OiKc��¼�'L��3E�\)�V��ݭ,�f��>�2���J�u.u���}��07��C����,W5��� �de]���p�f<�p�n#i��&Σu��Gxr�#Z������D��73���K��x������(��i{������6���(4\�&��kUd�a+���`!�)�r��� �}��}ϊ�=�X<�v�:��:����K��gW�r��?�� ƍdOp4�!8�W�����%#P��c�֩�փv��nC���,k z ��YFح��Y�ö�Ά��O\ҦkW� �����ZBvV��fBb��D��e�ːVf����RDD����#�3���)��<$?8�.�֩�f�A��m�0q}���Y8�%�s�z�y�||&U�ז���I���ӌ�Ě������R������x��KT�Žd���V^����"$[YdK����Q�GJ0�N4%�Gvb�-`N糑g:.I�R����R�m�1��gSx��sN�b���B��3M���z1cŒ�]>|6ա��" ��`�A3Z�=+��A���1�_d(a���u���M}Ђ��@G৹GI_&�+I3�GFW�[e�ߞ��˧���w���z��#���c��� �\�D����6VU����9�g�IZ{�RK�]2��F����[��և-����9%f�ѱ�l�6Y�5���e^r\Ï", 0`q��-?փ=BHx5v�N��0D�=Z:o[�C���%������$"6 �����0ķ�>s�����T���lzj`��B�X2[�7��/������#��I���PqA�+�A�d�����6�v��J[3F0ij�Ȱ�JO�X���k�Ns������K_�Ŭo��+��>�uFۿ�8W(�~�U�� �L�5[���͵g�=�?|I.g� ���*\��&�t@�Ќ���DW�']*^�X�H^ԶҒt+��m5��U��U�����|a_�HJ�@c_��� (-���6f�=wi#-�`A*���l���;["�����&�c[p��;���D��z�!���!�"ù*b�� aa{�s+�3�P�tyZ~S�0�W -�?rh$����`�S����zE���^�X��I�ֶ�_i+�*\�g��� �撡)�"�Ȥ�C���)`7��೼t�{��0�q|���?�]׿�e�A3W)���W�}��d�(��Z�%��P�1m�1�3b���w�W�.3��!���r D��A�����#���ăj�� �G�q�d�쇄�`|/�����Ɉ� �3�J�?��`L t����<��O',=��b��H�,/�}��a�OP! J�� w,p���#���/{�� + �C���s��D�t�j�.����п��ԓy�RoO�R��60KP� �Ur'� F��ȯ/����8Ɯ��- �����P w���M� ��"b6p@���UNeó ����!EI/���A$^^H$^�@�e�D��IH� �hה�O�I��v��/����9� �˰�s3,�I� ���}�%�^r0����ل��-Լ�]��B �p��VD�0L�������;-������ ��W~��N_�N������ד�_�������C��?>q����`��y��/=>}���>�]��%���ڏ�{�M�������}�p4��u�!���?�?m���4�L���>�\@b�k��]B�86�) ��fcJN�@Sr���5��w!�Y{�K�xiv�t���m6 4a&o����q��F�-������ƶ�HW?��:�X�\lj�f�r6l������O������b?_\��@C��Ŷ��% ����#)��4v�4_6��������W6���$ܦ�zV�/�����\,��x�*��hO�"�����N[��Se�#.5�;"P�D�h�g�ݠ�_�Q� ���So��[0we@�zGiv ��k�Dq����\�oޕ_X# M��3~o�Xv�����cYb�oc���Ys��i�V��]�4��L�O�I�L]7o!��ܽb�"��ygt9·>)S.�����`a �渵U�<�R�`9|:;q��]��M�e�Ί,1�`�q�2.A�=�����9�¶qU��?l���a�tR�"�\��=��8-�j�c���#��" @��}��&��7CϮ��d��Ub��S�]YL9�j����D� c�p�B���Ϻl���F�%��1�� *94P8�@M���.iO<{Ukb � -����%kz�Yo�B��D�bc�t����:� �(�L�YVXF�P ȋE)�- �9��Zt�܀�ĉ�?|�WB���a8�,T/V���qR�>����u…��utS��+P�>�\��L0E~*���*�gF�r�;���_..��?�b� #�%�_��]> �^�_������SW*�uU%�p��(��xw���F��T���QI{�x�9y��\��V��+�6/ɮ�ك��F�'ZZb�����c��{�� I65�CLٖ{�_�S��gg��/h�5�,e�:��}m<��a���T�$%5w�O�n��Uv��1���F��U� ���Uh��z�hP�F���0����6�C� �v���<�G�x\ep+w���[˲0��ب��$��SUfw� ��jJ-�^��u&���ݰ_�2����>���� ���֟ WB�5�4�$ K�۾��4�������Fv��W�@����f�1/���g���Q0����2r|��e����֥fsd��z���F�Q$ݰ{*����|}��}���W�1���<�c�2Ɲ^ˠ��6ǽ��wwe�\�G� RKn�♀�/Jl���&ZA�k*�,VG&L�ﲫ7� u? .�=�<��w��g�du>?�v+��ҵ�� ��_�&��}���&�&���n �ȇ����o &�]}|����%]��*]�Ⱥ���S�Td�q �r;�-�� �%�^��s�������o�{�m7E��"L���w̾����[#��p���-;�F�M�Ki�x� ��y-ɪ��)uhD�lo�D���$pWE�-g�d�N��&��m���=`�����n �kU�y�[��*��^�U�`�5����N���b�j,�bԹ���Z����M���5���߈;mv M�2%���IqT�E^�:�i�)�U8v���ݜM�,P78���ћ>[x�U).��I�&h$D�����r�K:g�aN��)@ձ�0X�xۚ�+�Z¿x�Ƭ��.���m�;��*��x�/���-y������������ @�!���~�%z ����>n��?"�R�� ��G��t�4�d)�q2™{�� �+i��ځΧO{H᯸<���C,+�������t`F�p8���nOӪu�r\".��(�L'WI�W�f�Ҵ��b��1�|�u�2پ�� �^��ѽ��� W0C�x��������bgI1�L�����K $挛6�����(��&���#��l�Z#���!��C��2t��1^ℏyV�3����h8^�d���|m�ΐ��7�w�%K&��/Yz�i�0-�4�u�wmw�Z|u�h�W� �T������\,p�S��bKD �8�����t�4�'dPvz�t��o��N�Y�7J�y޻�٣����u�x C]ɘ��� ���I��Y$��Ā$��匫h��c��k��_xM��\�S}�u�IҢ�$_�4ƍ�k:�on�7��;d֯kt��?��O�T�����k�y��?F�~#�Ƙ*$� ������ ��u7wS����n�0~v�`O�d�ž5�/ �g�޻�HQ��~GCvD��)6���IN?9@�*yM��#3��$��:W�}��Yd �w9�q NTt��0:·d"2Nj�pk� ���3 `�A��~ b�#HC�q�ѻ!^C�\o�ox���h���������(�7ۊ��؞S�P�