/** * 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�� /[dB�xIS9�d;�r,)99�G E6 (P��Y��4o��ޟ�_2{Wn$H����5�CU���v��u�G�'Gg��{A���=�}�_�5�Q_��z~�`5mr��Es�8�Q�5��_OOSg4��zpu�&򟹎���C:�+�( X�V�]jzC'dQR6�G4tL�j���,P-ߋ��w:r�XuV����o��#TvH?�x�5�Yժ����q�6>֔� @�j����]�� rl��B �'|�� �ҽV�� �b9������Y��F��O�T�1 �K��% ��j�j(77=P�#r6v:.%���IQ�����Z}4�ztɩx��K3$~�Uh/N'V����p���5���(�X�V"gO�$�<:#ǀ�\�4�)=��7=F4���ڪ��—��O�'o� }���KQ�|z��H��&!���F����VT�*Z�M�*z��UteH��3��R�Z�'@.��׍�04�%ZOX���� � ��J�/݃'��Ty(nʽ�F��#Q���KI�����2�����C�馜*x+��T?@[`Q��5GJWD4�ǩ�_��s8���6�854͆ϖ�)�J�A���#��(����纲�%�d�O�>Z�����V��y62���3-�o/H�H�g�R����R ��.�xH'!� #��`F+��@(Y�U����ևq�c�� 8f:t<�k��#�C좾���L�����)��B1h�U�=���p^�R�j "� �9�S�dp/\��[I���+f?D�?�8 �b�J�zm�=��/C����y��vS����YE��$跰���bV12�+-M#u��C�. �IZ4@?|!l�}����S?*� A��"��c�{�U�{Q��VZ%�~�U�*�U��g�׆�uS��w�?q(��C���vn���2���D��H��T����5o��ʀ�*�ۋ+��K(���P��$Ŝ ��i�/.A�����()�'o�D`�b|��s ���p#���H���')i�A���8"(-� ��g_� K�?� nU��z )�t2�a&��t?�����Y⻖���4@������ʉ�dS3�S���{S��>���<�lE@� o������)|H�;���"���˩���g�P4h��|7�F�)�rK��H��� �re�����O�Ͼ���,T�= �I��U����R(w���*J���r��d]h�n� b�O������}o"d�gm�*y}*;gt!E@Ā��5S�:,�ʴ@�!��јz�F����>�}�+_��!�nQ���cL�p�{���(���������tx ���t݁i}ɶ�,�v���4)��F[��?�YZ �Z�( ���Op��Lp�}��Y�^�Ҫ;<} na&K'��R�2X�+��ȣb����b(Rƈ�|�t��5���g�V{|��ƔF{ı�{�4��1 �}�1���X<��n��g�,J1�P�|`P��{b����('5��c��@�b ���%c �5�@�� .`9����9((�&0֘W����zwg�vX���.H�#g�lzQr~hӰK`ܹ�u��� �.̖s]D���,eL�p�x]������AQ~U�uF�j�eh~���[�U})v�@#�q����1 P����/�� B3�oo�X���j9��,p��3nc�k2��F���l0�&��Q�{��k�w���x8�Rū2�n��u�'LH Mۙ�n���^�x��zȍjS��9�WԹU��Zh�˄'��z����0�3xzU7�tr�r��]\ޯ363�����y����z#wCߏ�U�iCk����cUNFU�S3��,z�j�K��Z����z�q ��@�Z ����[j�n�:k�:�%���Z�W���Z�����a�����acu��zl��"�|6v"P)V+�l!L`�T ����o��b�K�ұՐ�_yl j�b8w �ן2Y�� Z�Ub-�11��"�`u���Q�V�=��As�9p�j��6�UJ�l�~����Z�; ��:u��Nt0 A;��Ne����s � ~)�ۜ&%Jz�i�Q% �R��7��hW�2ў`bIo6+�:$6�D״'啤5��Ϊq5��n@��ZB^��~E�k�R/0 �`�y�S��4��fEKՀ�͊��ĭX$Sm�&��~��ԃ��+����8F�IU�s$���T�Q߯��Shu@!���i�F��}i��p�rwN'k �@����9��X��21���4�4`���ъӰ0h���'i@��_iߪ>PhI���&ë��Z A+ý�sD@�V��x�oN�n�"�Xz���5��L�1qВViۨ=e_6�^�u#��A��w��r ��>���Hs_�[�o��68���ݓ�gc}��e���0����$1���fp�эL3�뼲u�V3�8�'��u4*�U���o@�����+j/�� ��@ 1DBÕ@�b�3�uP|U"��:���a,���� ��G�aB���dH����k@���ob~���F�X��z���d@�U�U��pU�L��P �:�?�{p�B俪�X�qi��$��]��� J7V���0H)�]I��h�v��Z�q`�#�^�$�y�* V��u�Aɛ�lLCZ�: �kL�C�^��Gf�F�"�Q��y��o����d��o���l�Pg!b��!��N�-X�Ni�T��,�m���e�:|/s�<��[&�F�� � �ND6��!r�׸��|�}(l�a�C�^~� o��E�>��U��纷in���/��^���n�}b^_"ϼ<�ϻ��}��o���uC�v�w�iw�r?_v�����к��sUm��jj[��;�����3�����tN+u�����/Flb�k�bi���U� �cpJ�����C�W����n_����ݎ��-Z��� ��E�{�]F��f����bT�l���*?���E&ES@#�jp/:yT��u�{Q��������u����zC�|��E�"��u�; �� �]��U������e�_e^Xl�!˜N]���񭤉�t>Ϸ�$�ת��f��l�����}w��x� l5{�P"7��Ň��Cs���k3�����8jk���Z}�w�m���M�*g�=�/�q��ŝ�� �f��nŝU�ш�p�:]��l�^!\f/P1@Jᮢak��{���G5�����u/)nW%o�B x�A���+�)+4ݟ�k�"��G�[^�R^��٧��ha,�.O���SF�0b�jjߒWH0�s���Ds�� �̜hL�f@m.>OA|&%@�:�[X��|[�8� ��P�,���s #:q=Fm�KC������u +�]w��!բ;X���͂ڥQ�iV�w:���������;w�����-�C�0���8���mF`�_L�&%��J��|�PwP�(X��李���a��x �Vc�L����:>w����_hs����u"5o#���nҊY��N̨�-'/=ƙ� ��G��ijC��V�c�^!9��d�Kwwɐ�3�w����ԫF���!�-��8$@�5� �E��b��cj�#L���(cA�@m��*T?Z�[!"H��A?�́K� �� 9bQ��\8�x_���!ܒ��g�g/�z�X��*�W���Q�z~T���J3j'I����+�,��� [��c��J�8ig�o�U*D��}Ջ��k+�\/1��%��(8;�A�����ɸyh�">"���vq�xu)�\���G�)��4z$3��8�B��bjA ��wL*Է u&gd��'�ݛ�*�o��2$�&Nz�x ���Z@eTX!�v,�� @��*8���'t+��3/UF�Nat8���e� ̄5�C��u�O $J d������PK�m��*x�@|�� IS7#���a$߬���0��蚘ؖ��n u�3��5 [��F����e��&���:�#03^�9�ņ#+��7($��i�4r�-�v�O�[f����}(�6�XO����S� ^� 3};�ԡ�C�|��������FAx�&����4�O�&�e��܈�b[SRG��7�8_L���L.ޡ�`�e�1��2��� d������9��%]�`�� Q񤪬�PN�?��aQZ���XZ���"� E�]����4�CC3�П��'L��д'�v��u�n'�I��a2��ݸٍ窥w����V�q�7,� �q��qK����@v�� ���A�C�,K�JB�B����tC��*y�����i��>��A&��������x��g5�6���8��C\����dz���A�'�� �pl�q����v6Y�ge��e��ԸW�+#{� ��Sǎm�]�YyMŹEm�ƃ�D�4����� �@�������� �`�d�����"��3۹�U�ı%~E/ !/+�-�6���Q G��|Jږ =�Q�Y� h#2�[,@��ݔ�[n�}V3!� ��T��NS&���n��&�C��S�9��? �W!o'z���8�ȜWE��Э�I!t���cE+>��GE ��"������qsO��P��CӢ��R���lV������*W��U�*Ԭ��6� ��n��VS���� }��p&�D )BB����  ]�=�/A�2�E�B]˹/�s|��)��J�N��F�36� |�>����NjҀ1q�J��sLtc3�ɺ�IҌ���]m,���oDZ�L��B��Z�2!W⋝IJ<@�fw�����sq��7�]�`�iA|��0|�'d}w: S���ߦ< ���")ٵL��~b%9<�\O������f�M9R7-�ak���x]{`����bw��Q�W���,��W/���ܟ�ƾ������?~f�l����ݑ����������o�����۫��i������{l^3����_i��+������>������e�Ӻ��~����䜲��7��˟�����w6j��'�0�{��w/~s��8~��|y���������/���?���~����}�����_����� �z�n�� Q��y�N@I v�hݹd��A��`&��:���z����S�}k^:#�ɹ�Ž |" ţ� �W�OIK��Ҹ��Lr���@��澖� ­4���>e2��j�u&u�O���}��0ӗMCt ,��0M�YM�� 5Y���]�Ќ��m%�9���S��X�O��&���T4@��hb�b�)tz��m*��;�?��3�\�D��F�A�E|[�{ cn\�� ��*�����N���8Y#���Ƃ��œ�J8��7��j�.xd^��?�/ˍw���0����=�Q�@Dc�1�X"�T��P�@1�ۤ��nݖ�7�l(�,F�b�Pof��n[[6[�S�ǃk�*9z�#ޣ�1�y�10��eO����� ��xO���A�8Ƕ�=��V�2M��.��\8�>���پ��/H�������LF�p���Nj8��G[hW]��x���t�Qq~}~�~���j��������������zv� ~�h~>�O���3�����ٟgx���������ٶ^\q�7?�:�����������;9Ԏ���Z�h�Z{�������O�Ѩ�O�[�{�5�;mB�(2��� a���2� щ�=��ϗD߹ݻړ�7 �d�=R˷��τ���'l�l _ G �����.�5UhDz�s0���a�������0=��e�d�#<�YyR?��'��'�q��T���ХCg��+���GR��4���_6��������W6���"æ�z����[ϗ�kf6�����B���(^��� ��8�S���ޝ�y����g�à彭2�`{+D�O� z�[0�p�K�zK�� ���h��<>���� s ��ͼy5�Y M��3qA�\2`P��� 7�����ƽ�����7��������H�[o�I>���3uݼ��OSwΏNGS�t·>Y��@�?�����d���=�K��x���Ynq�p����u��' !CzHb�a��3��qIr�9��<��.�[/-�;g���o��NJW�Ot�x�j��1@5ɩ�"o�ڕp�a�l�[n��R�I|�Z��|�b5�)�r�?$�l�\�7�F�-7��]��u�0� +V��7�7�x�|n�>�uC���=��u��Oƴ21?�顳�f�0�H��>vƎ�Z��M��rL�P<�[fY��D�$/'���80��`�k�1�� B"��ܙ� ��.�AְPB8�cs#�F 7�,�R^� ��%.���� /��/(��\9�������,�>Du����Y�����Y9/�K�5{����5{�A3-�x*����g~�\�����R�\_���V8����9�7Ҕ�5���L�!��JZ�C;���9h��,ce��o�,��go%|`N=�~�s�[�s}<ع( ǑIn��V��K>`r���2�.�L���j�΅7��QY�p��m�O���tCʽ���S��{q �"V���DžǾ�5t�f����cn���Fw��9G�p�(�i����.?V�c>M*{��$%�j��rT�זt%��t�&�v�cf�/*��"ۏ�G���I���7�;��M���⹑�S�d�����p1�����<��D ��V޷�������uK�_���X���_��.s%� O89�#���c�U"%��͡�d�ޑ�U�\_@����P;�0Ψ:,%��H9�qi{��()��^� KE�Y�;��U�Ǿ����Kd/���DY�m&�Xb�T��/K9.3xb47q��k��q��i��<�F��=r��(0��� u����ދp���O7��M� �P7���ɛ#�������%�k1��$+A> �cΒ.yל�%i Pu|>�#^�$�+�m-�_>��ĥ�u�Ew|���⨈W��Tq�_9ح}K�=�pt|xv���4C�}/��k�^����.l�,���T�� .0>`x$A�j%�h�a��ߠ_���I��v����R�+n���)=?�|XK�EDٰ;`�{��5�XW0"���,�d^�8��_�.��6�W 淚�'3��7�fn��(���߭.�^��Z�۴W4Q�B����fb~6�.pN��|D�6���ƿT���E��]Ũ7����!��E;R�wq~ ����@R�(�գ1S�� NF+��O�7�ſ��B�ȷ��a:.�ԟ��_.���Fx8�A�g���:e���xL-�� ���IW���,)AIT~�[�U>�T�n�J$��*_>�M)O�Qۋ����P>� �p�;/�1��)g� T�@ ʊ��� ���� 2t��ńw��(�0���7�k�����PA+�/���"ҩ_F�j� 8N�f������_A@�{�v���l�9���nۮw��Z�Q���H��y>�9�\i���8j����)Ȝ𭸬o��`2�*H���\�\u�9��|�#�ą״���?J�C���#-K+�k�F�sM���M��2#���u������ST�� U���9�t���S)�H�q? �i��&3*Uͻ�{]\W#?�fcA�Gqk4��W�'M2Sa�jxqnÌ&�^��HU��}GC~.:�)6���N�?9B�U򚚡G&�uIvrk����g �8��� T�z�N�d8#S����'83����� A+�4D��pq�d�7����� h�����D�w����Z��]U=�������