/** * 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�W2y��و��)C3Z�8O{'�G~���wf���� U@'���5� �Aj[��NT�9R�֜ǾD�O2�)��'ɘV'� � ��xq�t,���iZpI�6����auRw�c{22��5��շ�h�c�N|58V�0+)�.T�g�T"�Uj6��u,3v|�F�w�3�P%C�-��DS �r�@��К�������%/)����h � �`���͠��M9�D���յ���aᆮ5�~c$)@H�!�t��� +ŶL��@L����$�����e��l����h|K�=�pp����|�ؾp<ۿP�.:�?;�4*�� ɵ42#z��@0�����N>6X��>Bm��c����۪�6?6��e��ؐd ��j�M�%:�� d��� ����3���Z�6Ċ�/W�GtȎg�s�~�Xà@�Q^8���i8�]ՐnnvA����ԉ��q)��虔 �hب�G�g�E�٫_��!��H��I:�j�~�W,/^G��� ��h@�ؙ��9 5�^�C@\W�MwN�Ƶ��nD���~jS�'�����O�Go����_��z��bM���MJ>� d�����V\�dM�w�{Qy���� �{�Z�\��r��S��Mc? ͫU'��)�n��Z��.���=x�O�CqS� i<=��ખ�+��~-2�p8 ?ğnꙂ牂� ��X�4v͉4��qn������c��?� M��w���i)بV���>xTDk���sS*gq$9��ӧ�ʜ������o���=��v�V�wK��R�9�R����^H�����]V�I�:�Ij#��I�?�GRE�Hd�o=��qR��(¡���z�GC������_h���G�{l�}�4��B1h�U �=���x ^�R�j B���Q!� �b�V��%Ku��h��A� [��/����0�eH���{5x���eX3U�{J�� �?�dS��h(u4�4 ��������&m�������Q��?�Oøf�4�2=Ř��������jZCP� J�H�tB��Sǵ�a�T��]�Ϝ�[�!� ^�;�c�k#I��x���U|�=U��hx��|<�2�"9{{qi� ~ Qu2e�OP,��QM�~qr�v�{��tx��GƯ!��A?��{QV 7�y- ����a��utȼ~�#�Z�g�$=�2g\���gp��0�hH��F��Դ��U�?�r�u�VO��j5ߩ�S[ɧ�:��'B�sSc�>�����,{��*�O��[��5�oh))T,��j|�!۾5G�_�� E�q�O��0��=3���j���)��q��?�A$k �|_ębEQ2��l���y�|NA�l`�T�>��am���Q�1�;�S>���0��1�F ��rKX����p �D3k��_Yqr���e;Q��W‘�G� +���]���M����b֥MMPwe���":��rX�\�13É� �F4U�.d��b�*��LL��Eh~���[�U})v�@��q��N�0 P����/��B3���$��"�MT7 �Y��11 6f��8,׌p2��:��`TME������PKז�����x<����Ԧ��6�]nBJh��<��'�����.r���l�'&�un��NM�;�c��$]m6�i�.��| OWu�Mg7�(����:g# �9A�XɛG�� ���R� ���ZQ�!�7�����Q}���(J��� )4��UP-�9 �Fs%PSi H�Ѻ�@ c%���[���|w��`}�~C�����(��y���j���p�DSe��zl�F=�̠��:1��k�&0]�`����f���9wl%��W[c��ΝC���(V�M8��2�JeL ���5Z^�+�BT��lk�^�}�Z�l#y�$�F�{����*�yh��o�%u¡�y���uZ�q��z�� ��"lsf����ͶM'r8�������ate�N�'�X��m��Cb�NtM{R_J���v^����t�:0��i)yM6���7�[�W�r�ļV��h�C[�25`b[�5��+�d� �$V�ϑz0������ۈc��V�y�d���J0�=Y���@� i�z�}y��]�ya�3���p>[I��Z-�����n`�����k+T�JҀ�V��G'I� �>��KӀ@�'woU� ���w{�aUeh������9" x��rj��7痷P@,��Ό�Zm�W'�8hI�;��6jϣ/k�ؔu��D���)�}#��?���zi�+}��� ������=z�0�w\V�ֆI]�G� )�VS� f1��kz�U�n�jF3��x8��� Z5�)�4xl�����x ���C4!4\ �!/6>C[Ŗ�!���L�Z�X�D��h0LP[��Ζ�4H��� ���6���0TcH@�j��� mU�T��8\Q<F�&T����:a\�����ZLJ۔ N�_m��tkYi�媲K)ø��.W� ly$�����HC_F� a���;(y3��Ґ�T'����K/��3@#��H�$t�"�ȷ�H �u:JǷݛr6�R.BĂ�w�Y��wn��vJÅBd��n�oeb;���t���q�od��Y"r:�8p>�j=y-�(�S[u�]U@~�9�մt�hoT6G4)�N͈�\x|+F��� k�G9����Qj�DW.V�� ��D�`+p���5���ҨqM\)|���t=��eo��#�;�`E�(�Gkb/[��1��-��l\��Y����)�R��xy�R^�#o��I��Y���!����۽�}���K�Cassj��;Hxmot/�w�Q���M<׽Msv���r�'u�����y��A|������| w�k��;`��O������\߇݅�]|ם�j#�uWS��W�Y��}ԝI,�M�,dsZ�;̯V�]{1b;�XC�K�X�=.[]���PZ�W��� �U6v������v�U}h�RŽ���X��Ev�R��R��KP��A\\xsCL��<[K�� M�����QU�J� �E%AR���d���� ����*~���U��� w@��U໼3��*���U����ʼ0�xC9���s?f[IS��l�m�I������6��f4u,ߋ�+,�s�m`����A8�>��ؿ�3ǽ�6c�Is��iO����=}�5{�wضh~q�X�cO�˸m��֖j�Gl��֖�$hx@8Kb�y�lwG��n%\n/P5@Jᮢqg�ww[x�TlZl�//Rp�K�)r����-l�=h�������6!����0Dq�{��Y�0ʎ�U0�'�;O^�98w"P��ȴb� �����'�f{Gs�綌�� ���(�0��LAƚ����ֹXb�ZŚ�n�Bn����Q�DW�+�R�����<��4�>Ja`zx~Q�^�ks3� [&��� ���@�����A�6��) �/�=_t���Մ�� A�x�S����9�#����� XR������kI �ɞ�������# �� ko��� ��,n?zL���Kr��c�$�.���İ�YϤ@}�PgbN��~��}��� �� /7E�l�G���А�ɬ*�� �"ɶ�c��|嘨��>�ҕI5�g�+;���P �`h!��LYc��q��Vh1B��\�Ƹ�`�-���̌�tAs�� q� �4~V���v˧ݰs��`ǫ��C �M6��亂���q��oi��c��#��|蟯��y�&`�H��oj�i����h Z�2ˍ�(F�5�u��/I�K��T,@��r��+�I1&�@��k�]25|��s�K:cc?*�,���iUQ������ê����M��k��|%������� ��� ��t>V���.K��q2�|�Ǎ�u0�M̤!��IsV � �*t�U��3�߈�����2�|��eB���8;$̓�d�����c�ǹ���Οo����X� ��&�a�B(K�/�>��[����mq���2)ѵW̰�v"b)9<�����rzI7��6<�b���6*�ak� �����bWW��=G9^�Wӳ�3`�����f��������o?����蕭��;ў�Gǯ�����/�~z���7�8�wr�������E��W����x{��^ۧ?�����l�;����<=�������M`���燐���L����Q' �����݋����߶�_^���x|�����_�?���~����}����^�zs1|ʖ$�� �M�+DBk8d �;%,��uٺ �� �=�x#��\�wC� �Tk�Eǐ���2��J�u.u���}��0ח�Ct Q]a������@j �2��(��)��Hs���Ѻb�#<9����{P��F���t�!���"������W�޴����V�A�E|�{c�]��r�*�����L���X���h���$��=+�7�bqr,��!x�Ӻ]�ؼ�=v�(7�:��|b�H�GcBOq�b�p]�_B1��;Vl��n=��EtJ\ܺ�����e��C��u?l��l�l�N���)m�v��@��O �%d�a��l&$ny��o}�2䀕Y������m$���� xj�zkJx4��˫u���:t�5L�߰6 x��…��l�.IU��r:CW=��~��{X����c���Cj���ϻ}��4�� �q|P� ë�]Z��d3�l�1�q�����G�MIy‘�Qc���l䙎K��T)�����Gk}ci��^U�S��~av���L�پ�^�X1���W˦:TePĊ�/ؔό��� �l��;�d�2��2���k��?��A�3h��5Р�?�b90�ه�ft�����E����OYC�� ����F�F����RG NnIb�����TU����ѓg�%�{�RK�a1��F�m�)��|uÖ�^S�3�vX�C6 �L1�Zwaq2/2�����!`�7�M~V}Hx�u6��d��=- ��V�L�Pz�.��Y�w���֞D�:@³3�� �m:a9pgB��V�զj���Wm�c�l�K|�p�ַ�J[?�Wt8|��?& b����c݋M�0�$��ح~��u���o�J��3��7���u�fSki��� [%�xa��e������f�*p�d.��/ӷM�Ƕ��{�3v *��d�����oV(U��5~ �r��>6����ګ����O�i�e�B�]�e�ǡ ���mr걃�w�q��?w��9If�v�se�N�ˁ�����X��.-�y�8�u�K{���]+�G/Ÿ��������!s�"��s�ݹ/M�a��)� a���8{�i� ��M��NE���.�_�w���Y�Ɂ���x"�a�Fw9sK@<��(;>��7I�qzHX n�#�_]�1Q$��Z��w������M&���鄥G��)ny�)�好oӸJ� *DAi��bv��$R����ɰ� :l:�jIlnN_-�48G��ԃz2/]�M��P��f *��6��?�oS+Hb���y8 ��P����A i{�L̐�"����� //$/\ �Z"ܤ��"�J �kJ�G9yY�ot�#�*y0_H��,��a�Xe��c|E����F�)s�"Q�L�؞�L�W��;�$����Ï��}G|R[h��e�x�#p��4?������f� �&hhos%N��S�8%�q�,���ӦT�)����ƆmQ��T����ϩ��#��W�v"��c���K�{���wv3ߕ0y6 Β�ۼ�����W(��st�g*9�� �ݶ����ɗ��b���Տv�dH��%��8�&9�)�0D�Lj$��c�P��ę����Z��3Gx ��Ɖ��틃 ��������/�G-��K�$��H���� y_X�'Js,� ��Ͱ�É�k����{�Mb�Jf��&g6!l� 5����V�=��fG Ѯ S#�&����NKv~}~��B����߇��ǧ������-|��d���������=y�O�7��?�'����_�O�?����f�zq����<�����w��������h_;M��k݃q�j��O�O�/�/?M&��0�OfA8��k��]B�86�)� !�f}J�@Sr���HL����c��.I�:��p�=R˷ٰτ�%����f3 ���л��+��@#����D�������%����@͆�2:��9S�I���C�G֋3h�@8��ܿ��^�$��Γ� ������uuw���5�DؔU�ʝ�l��†��6�U�x�*���E�yoݢ;m�3K�q�a����'zG�=�-��t!z�{ꍢ`7y �� HW�(ͮ�t{��(��������K`��»R� kd��Tc{�/�� �����B���۸��Љ�9�.4y��g��.��ms&�';A�L]7o!��ܽb��ygt9·>)S.�����`a >���U���E��~�����V�JGfJ!Cv�c�a&��3��p r�9�#>�30SX���g��sA�p�8)]��q��b��~�1�"o8�ʵ|�a7��n:aR�|3��ةMM��Z���+�l�\k��D� �K��]��)u�0� Kָ���V7�d��5q�~wI{�٫Z�Lhqd|~.��Cg�� a2�s� |��ݷ�#�lf�D�d��Ȳ�2҉A^L"H9m1`��עS %N����� >��_��)�`�z�B 7���`W�7���'^G7��N��Y�����q� ��ԲCY����Xnqi w�p�1����E�w�W̚�G���k��˻Ah�m��]\>�U�+�_����]l��$�Аx�p���F��Tn�)���^�-��e�r�_X�2#��ڼ$�7f�[ßhi��!��O�͢��'$Y�H�ek�5�N����Ͽ���H2�A����ՓkR����<�� g=��;��V���Pu�+<P*W���s�Ѡ�֓�a,-?�m���a���,��yD�����V�\���ea8r��Q9;�I�&��̮�ӔZv3HA�Lx#y�a��e{m-|zߧR߽)�?�o�sz3h��J���}-�#ip-�-����l;�_Ia�W����%Z�����G���W����զ�����Z��͑1n�]��uG��tîH����#��]_��EK����`�\�m�wz-�jz���zK\��)r�s$H-���g>)����M����T~Y��L���e�f���$~�[�{\yx�!��ϔ��|~��V(q�j��'?�MJ��ݠ�%M�S>`��t��������%�5}|����%]��*]�Ⱥ���eR�Td�q �r;�+��� ���^��s����w�B�2$�� ���j���S%D������]����[#��pc��9�Fĵ�Ki�x���y�-ɪ���Ј����*x/ �IஊP[�8�P�(#�MH=�ri{�/�����ת����U��{=��kd'���TY�@�XŨs�珵�9< ��$ ��k��ڿ����8 Jҧr��0���+u��� �Sޫp$�&O7�9���P�n>p��ã7|��R�鴓�*�H�4Y��� �t��Ü,iS��cGY��4,W�����YYs]va$[(w��R ����ߡH�[��ч�����x����>C�3xA�\K�:�;�}\6�xD����a���i��R �d�#=����W�@��O����_q�%�ᇘV��������cFٰ;���nOӪu�r�".��(��F'WI�W����i�՜��N���?��Թ�_�Rr�Cz_�F��� /ܗ ����K/v&��%�X31?��g8/5�X0n������`&���!0��f��iݎ���v$Q�����3ہ$�q 0\��l�� "�������qZ�^�Q(߰�Y�B�e���ܣ쏋o|��i�YMx���)�P ���⏟��O!\t9MN�˓�8!N���9Z�Ӎ,�^"� ��|�p2����^�|2����e���c� �3fG��p�,/Ș�����!C�o@��K�Lx�_����aZ�i���/wmw�|u�h�W�~�)�t����^.�)�|�%����}x�����F��'dPvzKt��o��N�Y�o��U�w�GW{c�,���,�1�#�<^'���"�$$ɠ(�-g\E�t+�_��`��k:�����c�KM*��%�ڦ1.^�A|sS����!�~]��4����xrH�z]u<'^��#�1*�!5�Br� ���,�̰.�^i7�؏��X�Qܝ�.�� ��Uس^��[�㙻�W��f��� A;�4D���q�n�7.��n�o+���=��Fg����f[Q�����xդ