/** * 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�x�HQٲd;�r,)�ٶ��$,@Р(FѬ���t��/������S�ݸ� EJJf�Q议[WWW_���������/�(����E\���� �Q�&�,���������f�x�:�Q�у������wB:�)�( X�V�]jz'dQR֟E4tL�j���4P-ߋ��w2t<;�H��mO���Ջi@���F�� ��o2z�JG�����ƪӪ?�xKe��C��� ��ͪV������T`�Wo/�jx?|P�c��!<��K�΍-����_��O�\�r'6���xǠB-Q^:�o�h�kU�UC��� �������q)�ot9�z4l���ij�TKN�+�\�!�+�B�q:�J�|�3��n�$@�{FY�:�9cx2�A���)9����N�ɠT��2��9���V��=_�+?����2�vCg0+E��-��!��ۄ|P��Z j��ZQI�hx7=�����ɫ��ʐR�gP����rW�\�����ah�J�:��N�ws�U˕�WzO��Xܔ�!�&�G�*#���z��od&��z����m9U�$V0�:�~������k��,�h�O{�n��`P�4Pm�ibh� �-�-R��`�X��'z�I�=03�ue>K ���?2�Y>� >�V;�ld���gZ ߞ�����ϥ )ͅz7 ]��*�NB�AFR��V����W ��2�|+1�i��Z�F�p�t�xЧ<�G���\����M�����9���*h�U�-���`^�R�j b� 0�S�dp/]��XI���+f/D�?� �b�J�f m����B����Y�v[����YE��$諰���bV1��)-M#u¥C�. �MZ4@?| �h�}�o���s/*� A��"��c�{�U��Q��VZ%�~�U�*�U��g�׆�u[����?v(��C��vn���2��zE��H��\���� o��ʀ�*���k��+(���P��$Ŝ ��i�/�@�7���()�'o�D���u��s���p+���H���%)i�A{��ݗ�z�a�3�/s%�����b=��o2��0�VM��_A�������5v5 �,��f;�rb+��L��ĉ�ޖ8�O�!!�K[-țk(�@��<��N8�<����r�n%�Y� .)� ��ʻ�R�>��¬\�d`*A��s���x%�@( ��@�*G�%hA�䡳��b�F@��R�,��\���VZ�[������{�;64~� �zY�J^���DAP1��{�T!�J�2�w��j4�^�Q��(�>��r�� �Q�ȴ�j��z��ϟ��WDs~F��[T"m����9����=�@ � )��Ƴ��B|<2]�oZ�ٶ��nԚ�"Y�h�����Q��EIxh���櫙���ó��ܡU9vx���T>�N���$Pe� �W*��G��� :�re�P��7���k�s���v����(�v�c�v�I"Y#��*(cLU��x �٬ /�jY�b�� (���^�w�pk��QNjLm���N��/™K��k�`_+��r�����IP��a�1�|�����֖���5g"��'�+���.���Цa��Xs1�Ze#�]�-筈N�s9� Oҫ�z=I�b�)����n4��6�%����dl$f2#H+Y�H5=���Z*ݨ*0��0�VU��Ǫ�����&fH�YtWA5�z�4j��@u��!�Z� ���@�3� ���=�U�[ ���W�[s`\�*TTK�<��_1�53=�8l�C�ZO�~ךgP�OGN*�jŚ-� L��3µwm�] w�\9�R�+O��A Z �N���& �yC�Cko�XseL ����_^�+�BT�o�m��\�}��d�+�ߥ�>�V��Bk��:]R':�����{��N�e����s� ~)�ۜ&%Jz�i�a%��R��7��hW�2ўabIo6+�:$6�D״g奤�5��Ϊq9��n@ػZB^��nE�kwR/0 �`�y�R��4��fEKՀ�͊��čX$Sm�&��~��ԃ��+����8F�IU�3$��VT�Q߭��Sh�B}�yy��]�95ñ��Y8�$�n�V|���n`���V ������0�V���A{{��n������5�����n2�� ��2�8G�4ZA�w����J �����Q@Z� �ʤ-i������v��������{{��=#��?����.��W���p� N;��kp�d��X�-pY�w6L�=B�I�����bt#� �:�lݸӌƎ�p~� h��K�7���`K�%���k��!�����R y���*(�� �Mk�u �0�X`ZuB��0��h�t� ��AZ� �W�71��\��j�iH�Z�]� ͪ�*�q��z&��M�P�u�=�V!�_՘�Ÿ�Mi���.�hj��J�w����.� �j�J;_\��8���C/W�< }+�A�*��mg:�!-U�5�ԁK��7C3@#��H�0t�1�/�g^����������q����o��{��{Py�/{8��}�}h��wݻ�6�Y�5��|սEY�Gݛ�R�tǂA:�����z`ݵ#ֱÂ5����u��Յ�1� ��}Uv��1�+@_dcw�I<����_ԇ-U<��B�����"Ã�.�[J3^jxz1�U6�� �cn�i���k "��)��_5x�<�Z�����H ��u�tb�&�R�q~���_��p��`���:�=�r���������"�?e^Xl�!��N\���񭤉�t>Ϸ�$�ת��z��l�����Cw��x� l9{�!7������s츳�3�����8jk��Z}�{�m����`�S��ϸk���V�H3b|��֖��hD@8�c�yZo����n!\f/P1@JᮢAk�����-�G5�����u�(nW%��B x�A�t+�)+4ݟ�k�"��G�[^�R^��٧��ha,�.O���SF�0b�jj_���H0�s��D3�� �L�hDΦ@m&>OO�/Ѹ�5�x�@{��R�P"�nbU�{��O�M𙔘��9��:������\4_��.`���~��Kщ�1j\�a�ǯYr���5�ݮ���AoԮ�N#�Z�Qo��i;���s�s׹|8=ހ>� ���oѪ{dv��OmRB�����Ƨu5��50��v�=^��όW�o9��{^�K3�?�o{���E���7���]���;H(f+~86�����On&�*_$n�� �+�[��yz��8��u.ܷ%C?�\�%oA�CR��j�K��R\c�j�02���E���cg�%L����&cA�@m��*T9Z�[!"���=�̾K� �� 92Q��Z8|؏/��An���3�Q�u�h��M��}�(wL���F>����bϼR;�Q� ��f� �A �7�8z��?)�(��q�Ƨ��@-)>�>z������%M܌ܪK��Ȗ��r#*�lMI�K���|1� P�3�xWN��͗I0���@�+�m22b|s� �t�GxT ��X.8œ��C9�,S�Ei����bh�2��d�Yv�������� w�?LyO�ܥ�i��-[���V�����a [;q��IK���g���o�'A����#:&l�b���"�`Y���,�f��aߝ����*y�����i��5>��A&���������x���j�r~l�߾!.wJV��YI�����_܆ ~8����8]�Up�;�,��2Eֲ�mj�+����m��q��#Ƕ��⬼��ܢ6N��D"D�r�D�ah8�'��9�$:�x`�,'�|����r�o;W���8��/٥!��be�E��t�' �a�OI��9��wX�O%�b��x-��ٸ��u���>��������@��`��IM�=N�f�@N���jc��/�#�dR���EԂ� �_�쐰HR��W�[Om��^��}�*�"�M�⫴��˝ޝ�ί��c������l��Z�^]�N��7����'�'��{�����Wߟ��){3:{�?��빫9�zgæ��q� ��7�z������wͽ�7�x5L���C���a���G�~��W�7������i�9_x��*�6����'����pa��֝K^�`��3�G� ����S���B�;����O��vL�Q(���y|JZ��]8f���r�6w�n���6D.�)�!.�T�3�#�}E�u���l�c`t�i"�j*��)�J]���p�f<�p�n#i�>n9��u�:Dxr���������D��CN�Ӌo]�����o�����:��6��*.��H�+��p��Y��U��ǭ��f����ɺ��$��/�����,����V�n�#�����lQn�t��ĸ��1�� �"�1��¿�b�����:��xTw��6�8�AeMA�d1"��mz=�~�v�ڰ�b�B�S�t�j=��ZK��� ��LH��>����2��e�/�Ncm�)"��H�o���h�)��$$�9�.g��a}�Q��m�0q~��$X8%� �z�~�|b$U�k��9��A���Ì�pÚ%����RC��8��x��STs�{�P�s XaxA�Ks��|f�O5&6Np�����:lD�'�I4>�9�����$�JUO��}����-����GLGx�sE�R���@��3���Fz>cŴ���P]A���:c:Oa�#`�f� E�N|E���[TT�P �L�:�F�n�Z��A����� � F� N ���ψ0�I�ژ%�MYC��!V��F�N����kJG*�`)r����&ST�7��!�gC��,RK��_����������U [9xC�+J����rL���x� �js��Y)q^ Ko� 'abYɱ4������+h�>�A�+��C�I��|�l�H�7/��̘� :{���!��@`���w!TK�l�%V�� +V���?� FN����]�-G$�P{ 䚮�O�l,���l��v�0.�t�7'�������dx+�Ǘ˺d8 }n�]8. �GU�c�Li��*H�@4 i��c��-�Y�T?tp�o:�s����Ưr9.�ő� �ֹA��l����Y��0��V.U��-rR��6 ���Mg��Q��U��A���+r=v=ց7A\Ҟ�y���������� תǞ*�kB���dm�����\�a5���2�QhZ���#�Rc�f�(�K�; ���O��ƾ=qi-)U�68���b�w>]�X�S�M�϶:�,��8hV��������%rwp_�#��Q&��W��p���X�z�߈��RV�/+�Ww(�>�q���{��޽F��Р&;�d ��� �NUȂ]��i���°7��i����xl4�Q]�n,��y��������q�R� �?��%�MQ�[��G#�B��M�q�ˆ�J5�ȑḥrG�Q+?��c��v$;K ��VR��S��R2���%=��t r2V�xPe, ���'Ð4$<w����ψʈ@��1T����sp�4u��#ChP"��t�(��=��RX^9�:�.�WP J� ��1��89���� / �`��W\3�V�>����]@�ӡ�?�'��k�zC�X[ͦ�Y� ����C�f91�wؿ�-������{���-�Χ�K_=,����ZNE��8 \��e�Ȇ;�A��%2qCʋ$�^r��H���H����j�t z�@H����bq� � ,Ѯ)���3��_h�E�`���? Y��u�%ɱ�K-���b����F"( �2QҌ���|�G��Ur���Gqc�%�Yb�ʎ��g�� >m���ı�#^q�l{�5�}�s(d��� \��͹p"}x��"( ȣ�1n�/iJřR?���;����ձ�~v�o���L��M7"…~c�\#�Eliϟ��n�b&/F�E�x��–�wU� ]|az�� �5r���R@t�U:��/��B���b��]")�2���aAQ�ሔ )��w Ke� g0 ��nr�*�F�1D "����d�ͷ�A��@���4��؎���UZ��h#���v��/�5���N� �@a�f8����.�O���o�[320���8�a<�kh�ζ���U�c�ް���jT��_�|�j?�������|��|xx����?���߇/ۇ_�������}{x��y�������Ë���b������ý��������[��j���� �}4y�����y�ex��p8�����3�p�ݽ6!f��Ht�0V�}�xJ�0�{\��.��s[m�g]��巻�{��o�� clK)�Xo��$@�� !��S��]��i�Ј��`(�S�W�\K��M �azvd�fɮ�xp��~�� �O�3��� 4��+�N_���� ���� i�<��l O���o"�y@E�6�ճr��'���2�cn�?5��ŞD�"��w�F5��½x8�p���@������C �7�ʌ���=<��,��o�•i�-��6��n�!�������X�z�j4���J1�}qk���gP����;�xb th�F�c�Y�C����]C׻d�So�cI>���3uݼ��w���N��t�w>��br������L���`�΅7�[�QY�p����O���|K�����S�9yq7�"֧����g��3t�f���gY�9�M��9G2w�'^4��U���?�c>M*{F� %�ig�QqT�-�R�W�bE��,��ȟ9�AE��/������oY�C��%=��s#&�I7�A��#�bz�}y��&�o=�7����ȿ,\̱pǿy��R�pr�{<�-��8�DJ|ߙCɲ�%�й��%��塶�A�QuXJ��r ���"��-QRt��������󫼏}���!��NV[;����G��Ċ�N<_<�r\f��hn�$pa7��~+o��14y�$O;�6�Q`Y�� ���'��ٍ�n���ݡn> ��㓷G"R{#T)���I/�b"5IV�|xƜ%]�9#K�����y�G��IW �Z̿|H�nK�����"�#��Q����⨾r�]���?�xt|xv���2C�}/���^è��.l�,���Tv�0Aܔ("�jp9����q�5[l�h6n����'j��k�V��C�ɕ���^sWk5깽 \1�S��+m�uG =�"�1�����n�ͻL��)P��Ö ��N2��oxDЅ����0�>��~x�RRr�ei�rc�anh'��-�Zf�Y�)�^�Xx`�J<�J�\u<'Z���q*�[)5�gAr� -��fFŢ�y���[y�j�G�l,�(nn��J��If*l�����6�h��� OT����4�h�3 q�b�i�_�� �#�_%o�zd [�d'��j�K�9�y���>�ͱ�@E�Z5��G�t8#�:��.���� �����A"�ݷ�s2ċʖ�� w�7�,��K�FG�:��t_m����bz���