/** * 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ץ�㑱��t�����ebhF�Y��i��ȏ�����̼T��9� �9�f8�;He+����j"�O R��ؗ��I&<��$����6�6/A��� ؀45M .��f�2��B�wl/BF�4��;��v�1`�ԉ�O��'ªbf%%Ӆj�̘J$� @�f��eƎ�5�(��r�B�d(���h�]���tZS�44�����SjK�[���_�؁?�A�E�rh�r!�+��΂`�f4�vc$(@@��m^)cAG�+ �R\��|�s�]N���Ә^ƍ�湙z�Ʒ�٣��'�ȷ�� dz� ��"�3��sLc�2�Ȑ\K#3���+ ��z����c�5��#�rH?6X� ��jj�c�k\v�� I��(��^�����AA� ���� �}�~* �%p`;�X�r�~D�x�;����%0 T������Î�U ��fT���L������I�P�����Z}4�{Zr͑����_�d����F��qx����u4�?��(�T��<��`P��9�u��t��h\���F4��q쇠6<�� |͗:>z�F� '�����7�k��nnR�A h kT�@��=��&k2��؋�{���wwuH����Z �Z}� �\��n�ah^ը:��N�wsԪ �u9�����x����nH�y�X�`W��^A}�k�I��a�!�tS�}T��G- ~[�n���=�sϴ�[������R����B ����*N��ANR��N���>�*�F"�~#0�Y���Z�F%p�t�x��<�G���7?�B�W�?2�c��ӧu�zA{��J��ў��c��z�Pk����� �� ^�����-Y���0D�?� �dؒ|}m�=��/C���ݫ�#��.�Ú�"�sPt\�}��$�*�DC��i�i@4��D7i��/ d͵�����~�5S��$��)�|�8�]U}7V���BUP"x�G����*P�>�:� �J��B�D�ܚ�n�"߹s_Ir4��[�,����G�k���)���ۋK��K(���)�~�bA�j���s����CԤã7<"~ 1=� ���ދ�j���kY��� Ӕ���C���J=�$���9��>�[����@C�7��h�KS���W��<�A|��Z=M4 ��|�VOm%������M�1��ъ�RC�:}���S�%�������C[�g�?�߀�A�5黱�Ǭ˭տ� �C����<#��O�g��j`�P*I�U�$kЂ�k�a���`�F@��Z�,��._�Xl-��[Ab�Y�=���͸Lü [5oHE�"�����݂��AǵH���<[���+4 �5����Z�t�C �rmP�ݰ2���By�7�G`�h�U%��[�1�/���ߣ2 ��;@o|5|��[����L�K������f�HE3�j����Z�(�k��$,���?�ͫ����ó�>��;<} n�B<�N����Pu� �W��l��]^2�c�M>}�������c�6�����;ı�;�<��)��}�1��E���Vn ��!cbl̸�qX��$7�u,d�����>�DZ���-������x��)^�M��mZ�܄�д�y4��Op��3��]�F�) ��� OL* �ܪ����w��:aI��l6Ӵ] 1�ԝ��F��n2�Q��3��u�F&s�T��7�L�]���A���C8_cmE1��X��Q�菹Rh���ZJs@Z��J����f�u ��@�J ����;J��4�+��8 ���)�1�+PQP-�Xc?�0֕��܉��$D����zV�A~1ubP)V+�l%L`�T ���۳�n5ܹs��JH��<��5h5�;����#Q�țp:�eb�ʘJck��zW���L+��֨���8 P�^�F�JI��������U���Z�ߤK�C�0p�?j�,���� ��KE���0-Qӛm�N�p22kYoue���z�hO0����rO��V������tY����ӯ�t`���R�lh=Yoj�R�0 �`�y�R��6����ej�Ķ�k"q#V8�L�I���#%�`h]�Ձ��(3� � �.:��`4{��?��NҒ�~�6��H�� g sg�|��`��ZX�9��e����׉��V ������7�N���A{}࿗��VO�ު>Ph����&ê��: A'ǽ�sD@�V���X�o�/o�"�Xz������N� qВ&w��mԞG_��)뺑���S��FF�~����6��W���0�-F;��3�{2�a����ޭ ��h��AR����bt#� �&�lݸՌf���p~ �j�S�-h�:�R{I���?3d!�hBh�C^l|�� �-Cd�Yt�����(0-�:!��`���Z!�-i2�NwH @��m�W�+ :a��*�.�4�foH@ڪ֩aq��x&��M�P�u�<�&�O5ʵ���) @��e��ZE�ֲ��7 2�Ue�R�q5Z�],�4��H�K��)`������ ywP�fp1�!��N�uL)c�^֯'f�F�*�I��E��o_���t��o�7�l��\������ ܂픆 ���]���v�����{��1�� �0a9�D�t(q�|�E�z2�ZZQ$���"8�����sL�i��ިl�hRV�����V��ɹ֖�r�����Ԭ��\�3����V�HIk�I�+p�Q㚸R� \ա�zx+��N�G�w"��VQ(�4��^*�T�c.[fٸl�H -�wS��RK��x#��HF��˓^� �`� �Cdm�p"�{��`_ϗ܇���>���w�����^4���_��x�{��&��������O�6������˃��; _����>�X��mw�|�v*��e�'��� ����;W�F>뮦�����(���;�X�nY0��2w�_����b�:vX��p/��!�n{\��p?7�����/><${�l��5��������Ъ��{�Q��2(/2܋�"��4������Ze����0憘��y��p/2� �U�{�)�����܋J��?[7�&���- �� U��%�; ��l����wyg��U8���&N �ya��,r:w�?�~̶����� <�Ɠn_S;��m��h�X��wWX��.�����O#2�(pX}Z�?6g�{5|m����~KӞ]M{�Xk�v�m���D3�� Ǟ��q��ŭ-�H3��nŭ-EI���p��:���Z��J��^�j�4��]E�θ;��2��̩ش��e-^^��^9�pS��[�/[؜{�y1�����mB!/$Ua����& �� a�M�*`&O|w��*sp�D�{5�i��9,,��%5QO$����d�m��%I/Qpa$PQ���5#� |��s��t��5��L�ܦD���T��"�W2y��1�c�� e�sL'>%�?���{<�������"�cӋ��t4��9>�G5�����u�)nW%o�BJ�J�~��X�mQ���T\C�Il?���*����>ŜFcc�vY*�.�F#欦�-yq �;g�XN|Eb�@� '��� �v�y��}k�V�����ޒ�R��E�f>kV�r5�n��.,i]�$k �><E5]� f��V��]^��:u�.��L�S�b |-���bM���v�c����U�1�o��ތ͌�n�*d�Ȝ߭����� lP����yGȸ����B� ̬�,o����A�\�G���Y��x�g��B��)v��)�I�V7 �����?�0�S�v��o�-��B�tl��8�㤿N�J����=� �YP$����0%r�2yuo�.�(�ێ�{;3�c�w0����r�0,�h��#����U�"R�����<��4�>Ja�����j^�� �P�2��]Ⱦ�:-mm�����O�=q����k�&D>�e ��ҝ�e�ٝ���h�\���F�]�HJ�O���<4~�pQ�eY{۸w\]�$�dq��c��(�]��_OC%Qt�5'�U�z&�ۄ:s������mg8y�)�f�=���DLf�PUAH�� ��+�D7�ٔ�L�!<�\�(ة��ʩ8Ӳ 4�od��1*�8n�B ^!�l�M.�g�:B|h#l\���/%�ݜ܊KDZ8~�T~�v"'RPJ����m����X�8W�Zøci+4���^�Vc\G��QG~ f�j����pD����t?+S�FL���nعz� ��U�֡��&��Tr]�@q���4�DZG��@>����ټ_�h� ��7��� e�lr4-c���T#ؚ�:�՗��%�|*��s�x�N���ˤ��E c�5�.� ���9��%����`�KQɴ���PL�?��aUZ���&_*UF�LvM�EW�{��B�ܢ�M�OS���lh�v���*g���xy��a� �C���j�]���Ua,��2 G�� ���d���[�T9˲�0`.tT��ݹn��#E!���?n��'E��%�:�u���o�چ���b�r�k��5�d��D`A���?̆ �rl��I:���v6Y�gE��e�۔�WH*#{� �Q�L��J���Jr��8M�Y�'V C�9"<���ϱ'ީ'�Ȃq���&~��w�H{�l��w?�B�S���A�"��A���b�\�&��r!��� �_P&oS :88͘�'��A^����C�AOE�I=�����nGc� sQ�_ \�J. D�Ѕ�K�U��R���H�J�~X�3��<���@�"G���� �_\\�I6S4[ajV�jV��C׺F����-�����}>!��3�l� $DH����aD�˶GW ��=~�5W�b�K�\~�lQr��'�qxՒYt5�l�$›o��c�8�x>����:��&f�u�Ӥ9+�x���*���oDX�H��WB��R�2!W�K��IR2@�f{�����s~��7�]�h�iA|��0l!�%�}��-S���߶8 ��M���ګ f�E;���anf�v9����f�M1R�w�现5Ј�xA{`^������������Y�0�Tσ�{3�yx�[��h�㷟�O��s���߿�ٝh�ϣ�W�_�헃w?�}{y؛_�߻?����a��y����+�{yi�=�{��ӟ_�_�_6�������?��Ni�zz�&����SWs~�N&m�]�o�r���o����o��/���r<��y�����/џ��??��G�>�����^��>eKP�\�&�"�5������l݅d���A���`.��;���z����c�}k�;����ʎ |" Ţ�^U�OiKc��¸�'L2���@��vO+`��V��l�@� �r��N%��:�:�g�WľYw����!:�(��0K�YMi� 5Y���^�Ќ��m$�9�͈�h]����F���=�h�n#��t:Đb�}]�Y������7�#m�P\ķ���0F���5�+_�"�[��� )�� ?��N��NbmA߳�xs,'Ǣ���:����K��gW�r㭡?�� ƍdOp4�!�g�!���%#P��c�֩�փ�[D���ŭ+k z ��XF�=��Y�ö�Ά��:O�ҦkW� �����ZBvV��fB��)� �֗�w,CX�uk[H�F"~�΀�V����G���`��Z����C@�Y��� k�`ဗX/\h������T��-�3tՃ���ٱ�5+��9+)?��x}q���ۧ�J�{�P�%�0�:٥�IH6�ȦS'�+y)�|�:є�'�56�9��F��$�J�r`H��Jq|���Jk���z��� ��|Ug���M�bƊٻ[�N6ա�"6�o��xf�LfV�b���q��|E�����P���� ��у��{�B;�@ڌ����V���4�)kh���8X�h��H4��~C��H��,Il(Z�1�z�ʲv�8Z�l��B�b�UjI> ���H� ?����f���kj�Sb&� +p�&]�)�\k.,F�E��.�B²=l�&����`#i�Φ��^��ܙ���ۊ��J���S<[�����ԓ����Bxv&�y!�M'(��D�R�j_5�j`��vѱd6�%>58`�Yba����+��=��'5��X�b A& ?�i*�5��vKٖ���v_鏭�b���i����ᾶ5�����:6��5�Y]sb� R�Z��L����ظ:�jˆOj�]e�r��d�6��= �����Kr9s�ho\tI\4�C���>�PB�� �T�豄?xQ�JK�KX9�j领��x �� �,FRj ��.WX�g�:�|`c��s�6�R ��q���|g3>_�|�~lkݼ;c��IF��\�S3�T-ܹ�5��)�mol����UA�M7���+w���A�C#�v��mr걳�w�T��"�o3�9I&�v��a�~�ˁ]���X7�~,�l�P��5J� ��N�6p��g>�K;����)��G�ĸ����������s�"��s�ݹ�L~a�g"� a���8{�i� ���߯�EEd�-�B�7���X�Ɂ���x�矛��]���/J���-�M�a(���o�ň���eLF�I��V�7��5w��KpmE|v '�x:a�8t����@Jeyi��4�� QP�Dg���.:����v2�0��� [iΩZ���W�w N��<����K�z�x:�:�6�*��\���`���,;vUJό��Wr�73�\�]{~pŬz�K������d^�_���z��MW*�U%���WE� �ሏ͍@��pSF%������������eFXy?�yIv3���6�?���CTן8�D�{�OH����0ʖ2�k�����-;;{�A3��d*�����sߣ'פ�')(��Kv"v �z��u�ٽ95r��� Wx �T�B�?h���A�'��XZ~��4�����Y ��y?�Y���ܹ>>-��p�;`�rv� �LNU�]�1�c�)��֙�F�v�~���:�Z��"�O7��{S�*��ħ�f� ���,eo�Z�G��Z�[j�� '����?6>�0��k�>6>������1�/���M/�9��.5�#c�Իf�7��#�]�Py G|�ۼ�W�<�>:��� ��ۖ1��Z���9�5���J+S�2<��H�Zr9�|RbOs�h�����X�0 ������I�������x$^4�)����٭P���k!�O~ڛ�����?�k"��|���%�"W*=^�Kҋ�� �kK���U�X�u;� 3�ۣ 9�����*v�+U�'�A�;_�(N���Ͻ��eH���%W���J�0��g��1����]�F�m�N��+p����e���� ?b�1Z�U#5��ӡɳ�%U�^@T��]���q��:QF���z���*��-^����)�3�U��1n-�,�{�7w�!��N^[;���[��$�Q��k.sx47It��/�#.��14q��O;�&�Qay�W� ��ܧ�W�H�M�nvs6��@�|�P;�Go�h�5W���i'�7��i����1,霅�9YҦU��`=�UhX�lk ��!볲��JH�N��ۣċ��%"�Ʒ�٣��'����s3$}��g������%t6�wf��l�$K�'8�5£;�@����Gz� b�3诤�j:�>�!���.K �1��g��inj�aw��ݞ�U� F�8E\�)�Q��N����~�ia+Ӓ�7�۝����;�sw����z��F썮I�^�Z�{�4^�L;K��fb~6/�p^j �`ܴ�� �G�L6�%�A` �V�5Һ!Re�H����1$ �g� Hr�`�O�PD���'��-j��쀄�7l�C����q�;��4�(����c�lV���S�Oo!����⏟��O!\t9MN�˓�8!N���9Z�Ӎ,�^"� ��|�p2����^�|2����e���c�a �3fG��p�,/Ș�����!C�o@��K�Lx�_����aZ�i���/wmw��{u�h�W�~I)�t����^.�)�|�%����}x�����F��'dPvzt��o��N�Y�n��U�w�GW{c�,���,�1�#� <^'���"�$$ɠ(�-g\E�t+�_��`��k:�����c�KM*��%�ڦ1.^�A|sS����!�~]��4���xrH�z]u<'^��#�1*�!5n�Br� ���,�̰.�^We7�؏��X�QܔϮ�� ��Uس^��;�㙻���