/** * 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\y�Le˒�\l˱�dg�h��A@]����?�Ӽ�����)�K���q%H���3g�(�tW׭����x�������w/�4��{���qMo2��'�K�FM��=��+��9���_��g�'O�3��=��y���g��}!Ӑ���4��h���KMo�Q�4]�4tLO���zȖ��ԋ���O/R/�r�Ǧ+[�5�j0��#i��i+@W�IČ�Rd�N#�3�Ě�aD�tz�R�IDM2�L�u�&vb�x���9�����4IH_5:��?S9L��N��8�I ���Kٙ�*�*���k���D�2���!r�RҜǾD�O �S�Oj`Z�\3�&T���!�ϱd���i�%���OZA@�UQH���E�Ș��t��ڎ��c�L|8��0+)�.��1�H|�v� pˌ�S�(��r�B�d(���h�]���tZS�44�����%�����\�� ��� �/ڔCK�� Y]e�w��� ]�KO�~h�_��FG��J�,��=��}HJ�o�Bm1����湙��[��ч������[u���l�B9������Vo�!��FfDOCW�>��H�P�p�Qem5�ҏ*+�Q�ۊ�4?�]�k|T�� @y%�&��O� 2l��GO��C Sip-A[�`� ��+�#�Xdzܹ�t?G,�a���(/\���4v��bH77���G�d�Dd츔�_t:�z4l���ܳ�XkNë_��!�Q��&�Ī��u^��xx���'4��m�� ��Y0�y��rn�sz4��ov#E��8�CP���G��7~:>z�D��&�����7�k��nnR�A h kT�@��=�����nz`/ ���+���R�'P�����.�<G�4��м�Qe��;�� ڻgU�|��|4���;`�Z�(�!L}�(� �K� �Iܒ�z��h�cA� [j\_@[y��ː�1x�j�H��7�a�T�9( �*�>�@j� F=C��i�i@���D7i��/ (͵�����~�5�AA#H �S���q,p/���n�D�5�*�D������`ȭ@4@=�`�64��*5� ���rk>���|�v�}m$5���"�*>5}Z(����!�nU���Vc��K�����(������_ �����#���o�y@�fA�Y,R�Ō�����V" �Z�( ���Op�J.��>��,{��"�O��[��5�oh))T,��j|�Ѱ}k����X2�c�M>}��������6|����;ı�;�<��) �}�1��E�(~��VV �Y��11 6f��8,׌p���:��`TIE������PKז�����x<��/�Ԧ��6�]nBrh��<��'�����.r#��l~�'&�unՔNM�;�c��$]i6�i�.��|vNWt�Mg7�(����:g# �9A�XɛG�� ���R� ���Z��!����,�Q}����r��� )4��UP-�9 -���)����n2�X d 9�rzG�������W�N ��^���j�������L�N4�'!z���hԳ� ����J�Z�f+aӥrƌpݞmv��ΝsǖC ~�56�A���9�^�`Eބ���/�T��P�X��Eл� DeZ��ȶF�U��a����6�WJ�l�Gm}l���:�&]R':������Q[�e'�,��\�-�_*"�6g�i���l�t�'#��i�n�0� �N�'�X���FO��V������tY����ӯ�t`���R�Z��z ���J��$��%�J F�� -S&��&7b��̴���j�9RB��m�:��6�e�Ua^!�E'���f�!��l����z�}y 'ǁ��d����l%�n h���s6�7t��_'F^X1��V���Z�<:I����^�Z�F�V���@K\�7VU�� :9� �#��-��:|s~y %��;��( �Նu�N����F�X�F�y�e � ]72�}t z��(w�O����F��Jߢ�xF��hgt{sO��#����ջ�aR�B=H����5�Y�n䚁�d�����̱=ί���� ���^R{i��� Y�!�.����b+��tV]&`-c, L �N~4&(�VHg�@� ��]�}E~�� �@�� � M��[����u*@X.˞ ��T���@�0�5����ZLJ۔ N�_m��tkYi�媲K)ø��.�� ly$���)`������ ywP�fp1�!�)N�uL�c�^֯'f�F�*�I��E��o_���t��o�7�l�%_���� �� ܂픆 �����6��ׯ���"�c���a�rd���P ���̋��d䵴�HNm�EpvU���V����Q�Ѥ�25#>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>]^M �>6�_OGs/���xTڞ�/?P���vU��)�D/G��ǻ����O�5T���#�-�b)/K��S�i4�0j������iD�0b�j�oɋK$�9c�r�+�� �\8�\�+��ȣd�[s�Jl�ߪ�nxK&K�����Y��հ�u �>���u9xX�%���h�tw,,��FZ� wy�Z���w�Te�zS�k�|kJ�Զ�K-�d���i|��flf w PT![E��nm���EU`��-<��;B�՝��'WT`fey �v�����?b'�?Ϣ��K<� ez��C�L�O��Z�d����a̧ �B��TZJ����؜�q��I�����A]'z���H�aeaJ�:�e����]Q<�B�(vf��.�`$���(?`X ��_+FJq�#�nE x�t�;Y�p�s$Z~�rw4�)]BI>��W�e/�����:�5 P��\��gf�����Ud�N�������y��}Da'd�m��pe!�\��-F�)��4vIn=u �D��rԜV9�d�o�L̻v�Ov�o��Ŕ��A�m��H��1aUBepTX!��u,\�����gӶ R ��rD�Na xTC3XA72S�z7�?!/��I��&�@!>�6v`�������nNn٥�X�Y*?v;��(%���ĶT�tg�S��O�aܱ��E���/W�1�#Xp��#?3c5]�\b8�B\vOB:U���@#���i7��e���h�Ї˜���x*��`�8A�b�[���أ�H�>������^�h� ��7��� e�l4-c���T#ؚ�:����%�|����xSN���ˤ��E c�u�.� ���8��%���`��M�ԩ��PL�?��aUZ��&_*UF�LvM�EW�{��B�ܔ�M�OS��7ih�v���*g���xy0�a� �C��i�]���Ua,��2 G�� ���d���[�T9˲�0`.tT��ݹn��#Y&���?V�^�,���^��:^Lπ��y���!,g�����j�t<��$Xtz��a��[ơn���*�<���M�Y�"jY�69�� ��޶��l�SǶ�������ܪ6N��D*D��ʼne��pϙ�s�w���Fdtf�������"��3�9OT��I�]B^"V.�'�O���@���Ŕ�-AzP�Ȳ8A�Fd#�X�4��I{��+�L5!� ��m�CA���=C7�kܡ�c�9��? �� o'z���nd.�"� ��V�%����~ 㱪uC*�"@RIQ ��t渙��p�'�B��cӢ#��R�� %�f�fb�L�r^�2W�l�Z�h��~��w��*����8���&�@B��81 F�l{t����Xsu-������%�| �7yW-�EW���VA"���qY0 ���=n|���nb&��{� �Y��.� ��V��ϰ#�DR���E䊖 �_��0O���7�[�mg���{}���"FcM�⛬�a��,!�����o��Ǝ���1_��nʤD�^M0�.ة����r3#���%��7��l���������+[��gw�=?<��_5��_������ao|q~����燑���E��W����x{��^ۧ?�����l�;����<=�������M`����SWs~�N&m�]�o�r���o����o��/���r<��y�����/������~�ѱϿ�0���ի7çl������d�B$��C����P�¹]����̽��3�7̅y'0��@O�v_t �o�sg�"?17W�1�OD�XT4���)mi,tZw1��I�?Sȕ��i <���m���S.�_�)�]�R��,���7�s}�“�h�:� �m$�M�r�^�x��o����_y.��#m��~Pq�F����k��|���>lEv7,�8$�/�0�:�,:��}ϊ���X���k��n<6/}ϟ]-ʍ7�N�0��7�=���C �)�C,�+�K(F�yNJ�Sۭu��nC���S��@#|�����׳�m�� �-�)t�8�M׮����I����<���̈́�m�S���/��X��2�4ֶ��""��D��O�VoM ��!���vy�N6�Z��n�����&��/�^��ԛ����#� _[Ng����3�� kVs,VR~H ��✗�y�OQ�&���2�J Xax=�K ��lf�M5�6Np��<����u�))O8�shls:��<�qIҕ�ygD��Jql���Hk���z��� �|Ag�L�M�bƊ��՟��PiA�`�;3Z�2+�A?�:q; �"�P�}*�և��D7�>�ڲ�hб� ƽ/!1z ��8?4�{dtE��h�E�<�|�j}!+�7�0�?C�W�*�d�Ȓ���s-��,kC�#%�(�)�X���`������cX��څ-����9%f�Ol�5�@ȵ���c^H��¯�!,�!��_c�� 6鐪xcu6і����;- �ז�<�Pz� ��i�w����D�,³3�� 񭣺�l�<�mQ��C��%�qh$�h�.klr_1:J`��6̱d6�%�8`�Zb}��_�+��/����V� �r�mb(��v�6(fN?Kl �\�� �B���Y�m\{����×�r�z��8�"D�h2o���}U3TÐB�� ����豄;:xQ�JK�(X9�R�S�ꊮ��ch _�7-�R3����<a������~�̷�.U�R*�L¸?�R�������6��@����؁X�a���+�Z�J>�]��EN�l3�*�aCE�#�� n����� ]l�_�!�1���>mr�ӄw�( ����ClN�C��{��c_�c��-�1 O��,c]���htӦ� �4FY������=&B�����E0�=컮!6i��\�����\O�s�.,��� �� gH�6���1ٴ��KY���8��l��Ly�*�@�~AY<���M��h+gW �5�Q;��8�q�d�n`17���o�ʘ�( �`N� =�gnD���ڲ��Η�t��#�(n6�)�好o�(G� *DAi��4?v���8^d��a�A B�pNՒ�V��Z� hpv6�/� F�3�ҥ�$��N�m`������1bA�$�-�__� �1�?�;9��[��P"�cC ,�� �ZAE�m��i�%�h*C����� �(�Hz�L�"��B"��/�%��I�K|����]��@I`�vM�y\���%�FG8����4���o�&I�UVj�?�W4�l$�2'(�䍭֋�d`.^G�p�|�45����������E��pG���8?����YWB!� ���m��‰��yJ��U ��%�=��`ڔ�3�~����vu��%ձ�~~�q���3���=@|X��عD������>����w%L�M��$�6��-��8� :���J���B�ѕ@t�s;�~1Q��>��Ѯ� I�����$�1��Hj�I>�X�`8qf�y7=ߕ#� l�]i��f;� �� Z�I�lʉ�K&�Ģ1����ax;C���߉R��;���s3,�-b[���{�=Eb�HfՖ"g6!�{�RKC��G�PC=��e�Ю �x�]�4u��p~}~��B����߇��ǧ������-|��d���������=y�O�7��?�'_Op��ǧ����g�k��d�o~��O��s������o�s���&�ϵ��8d�������ᗟ&��p��'� ��6�p�^�K�Ǧ5��Iv�{J�f@Sr���L����_��.I6��f�=R˷و΄a�%�����f ���л���-C#ҕ��D���/���%����(ˆ�2:��)�Ɠ�<>146��‹� h�@8��ܿ��^�$��Γ� ���������&�'�T�PaSV=+���m� [=s�V��i��ηH�1ʽus��O Un �Ʉ�wGj����lb��/VdTl���q�7����-�B�2 ]�#7�����Z�8����n.��� �J�/����R����I,=DP�_���Xb�o��C'������㞡뻤?h�͙ ���H2uݼ��Os��%؟O�Q������L�D�?����%d���V�N:i�6ڕ�gn[�*V)� ��%���2�\�%ȱ��^����La��jߝ�?�}�=l�I|�8�U���g�j�cE�p������n��7�����fh�O��l�s�X-p ���l�\k�U�D� 7*�d]��)u�0� KV��7�V7�d�}a�?5q�|wI{�٫Z�Lhqd|~.��Cg�� a2�s� |��ݷ���l�e�D�d��Ȳ�2҉A^L"H9m1`��עS %N���%� >��_��)�`�z�B 7���`��g���c ����2$�������8�S�GY�q�Rzfd,���;շ������"�;��+f��#^B������ �j����u\+�R�,��(�?�����GG|ln�H�F�2*i�ߜM^�`.~���/3�����K�[Y����1����X������,��kBpϭ��5��^��� 7;�nv�>��fZ#�T��O��O�I�ORPRr�D�,��`��;kj�C�A��@i� -����G�h��<ci��o�<��;gg)|`�#z���g<�r��x(�, ÑK6���d@>`r���"��L�ewr�΄7����� a����O/��tC�7�����H|No 29����m_��H\KKm���mup�+i ����q���_Q�Q� ����? �d��[F��6��_��׺�l��qS��ި;ꏤv9A� P�o�b_x/�X��;���8��s9�-c�� ��ms�k�-q�U��ex�ϑ ��b(� 8���&��6� �_S�e� 82a~��W�/k�� ji�q�E��?�AV���]�B��M+�k`?�yoR��o�L�oh�� �;���|p\���xq.I/��4�?[ҥ���Ŋ��YN����AE��(W��^u�. �߷�Eq:?�~��p+�-C��p/�"��� G�n�t���i~����9�Y=f�6����xY^�13�:C��߀��WC2�5�w���L�_7�k��-۫�PE+���'��Cy��_&�r� 8N��- 4��� (v�g���t;OȠ���n���i�V���(���y�F�>����Y5 ��H� d���hx��?�D>���E�8l9�*��Xq��E�^�!��( ]jR��(-5�m�B�5�77�ˌ!2��5:L� O0Q�'�T���s�5�<���R�R�*$� ������ ���uMuS����a�=��Zj��0�\�=S��+� ��=���,�����\t$ Sl<��[�� ~r��򚚡Gf� H~�u��J��މr�O� �}����"�9^��+�_�\�I� ���k���A�����y7ī����� �k�e͐���x���. �Ͷ,�������