/** * 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���_��g��L�3��=��y����\��B�!�iѠ��]jzc'�� ���*��cz����b�^L�����E������*�iMi#�����t}�V���9�� �� � Fg46�55È�C���ғH#���J���0�� 9�.;�mz�XTa/2q<'v�|d�.�M�� ����������ܳ�+��4�(1�214����!�wB���NJvgf^*�̜P�l \3��$��)z�D��󕂨�<�%�|� O�z�F� '�����7�k��nnR�A h kT�@��=��&k2��؋�{���wyuH����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%��t�x��<�G���7?�B�W�?2�c��ӧu�~A{��J��ў��c��z�Pk����� �� ^�;���-Y���0D�?�� �dؒ|}m�=��/C���ݫ�#��.�Ú�"�sP�Z�}��$�*FDC��i�i@0��D7i��/ l͵�����~�5S��$��)�|�8�]U}7V���BUP"x�G����)P�>�:� �J��B�D�ܚ�n�"߹s_Ir4��[�,����G�k���)���ۋK��K(���)�~�bA�j���s����CԤã7< ~ q=� ���ދ�j���kY��� Ӕ���C���J=�$���9��>�[����@C�7��h�KS���W��<�A|��Z=M4 ��|�VOm%����a�M�1��ъ�RC�:}���S�%�������C[�g�?�߀�A�5黱�Ǭ˭տ� �C����<#��O�g��j`�P*I�U�$kЂ�k�a���`�F@��Z�,��._�Pl-��[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>}���������6�����;ı�;�<��) �}�1��E���V��i�W��p@� �Sc�W���Z��~�a�+���M�I�^�9��2��b�ĠR�V��J��t��1#\�g��j�s�ܱ���_yl� j�j8w�ןG�X�7�(�%���m�-�w�������l%�n h���s6�˺�U߯#��PA+IF[-n�$ ����/M��ܽU}�&����M�U��u@�N�{爀�F˩�ߜ_�B D��N;3 Hk��_���%M�kۨ=���!bS�u#��G�����r�D[�m����-z�7`t[�vF�g0�d�9�X�pY�[&u�!ԃ�(ZM]3���F��MVٺq������*2h���[��u�����K�5~f�B ф�p)���� m[ �Ȧ� �2k `Q`ZuB��0Am�B:[�d �� ���+�ۘ��W@t�P�U ]i��� ���U�S��pE�L��P �:�?�ypM&�j�k1)mS�$8��~���ҭe��od���.� �j�J�X\i&8���^�S�" }+�A�*����bJCZS��� �R�.��_O���#U0�б�0#߾"%,��(�vo���K� ��e#d��� �)  �=��$����ׯ���"�c���a�rd���P ���̋��d䵴�HNm�EpvU���V��U��Q�Ѥ�:5#>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� �%N<%'@��>�(����� f7�%���Ë��|֬��jX�:S\XҺ��Q��|�]��H$"b{�Q~���ѿV����G,V݊@�隷�����H����� hS��:�x���(�#i/w���� �� w��V�7�����(p %� V���7O�ԡO�8�i���������.�`���"�p%���B.aDǯ�hlpe��9�=vȒ�V��*xH���,}zA��h�4B�h��Z�� ۉO��X}ً]��������dXj0 �D�n������I ů/��;�"��� 6�|���y�Yy�?1^¿�X �r�?Z� �u۽/����:�����/Y� ���xȬ�(;Ƙ����?�[ic���L/�p�Gw�؅��D8⇹˺��~H���UۻdLq�/�7�hM� Fk�?;�_�x:�%�8C ��(: BH=jS�V���F\�����3G.�e�ogb���K��pH�,�F B�˃����x��S�+h\5�V}��q ��+̨�&y~�Z�Y:u���+�*���1����X�@��������Q:�Ҍ�\�W���L��–I���B��4�iik+�xP���~ �.��g���0w5!��AP ����.c�nl,Es����v0����ER�|�'���������"����]��B&�&��S�6�`�������nNnť�X�Y*?v;�)(%F��ĶT�tg�S��O�aܱ��E���/W�1�#Xp��#?3c5]�\b8�B\v{B:����@#&��i7�D�e��*h�Ї�H���x*��`�8m�b�[���أ� ����lƯ�GW4Ra��Z~چ�|6-�����rc*�lMi�K��|> P�Y\�?'D��eR� ��"����c�L�_i�`���بπ ���E�dBU�a(&���*-�qa�/ �*�]&��Ȣ+�=�j�?M�πX�S�T�������l����m�� ^"c�:H���d�Zx�?olU˾�L�@�b�-�tF���*:3�V�U��,+ � U��}w�z�HQ�����ߏG��IQ�r�G�N�_/�g���[�����ei��8N#�O���&���4D��i� �t^|��J���� �r�U��/�T�L��g��y�� ����zl�8q�����Mu1kD�d= [e ����~��4v�-���vS&%��j�v���B,%�����]N/馾نgS����F�#l 4�!^��W�j��g�(#�k�jz� 7�� �� |^�}1Z����������o~v'������U������Oo�^������O�y~�_O_t~�y//���~�}������f�s>:����Ӄ�)�^OO��/_?u5�w�dҶߵ�:a���/��^��>��p������/�㋟ǿ�x�}�G~���������^�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���$��=+�w�bqr,��!x�Ӻ]�ؼ�=v�(7�:��|b�H�GcBOq�b�p]�_B1��;Vl��n=��EtJ\ܴ�����e��@��u?l��l�l�N���)m�v��@��O �%d�a��l&$nv��o}�2䀕Y������m$���� xj�zkJx4��˫u���:t�5L�߰6 x��…��l�.IU��r:CW=��~��xX����c���Cj���ϻ}��4�� �q|P� �K�]Z��d3�l�1�q�����G�MIy‘�Nc���l䙎K��T)�����G�Ti����P�S��~aj�/�L����^�X1���ʦ:TbPD�;/�dό�i� �l��;�^�)��2���u�8ѵA�9h��5Р����i3�GFW��]�_�̧���w��y��#���ch� ��#�$��h��\#�*˚��ɳ� ͋=V�%��gc#�6�p�c��aK{��yN��|#���xM�r-�� ����}�� ����#?�� =� ��:�~��y s����l+bv(=�fO�d�;{��PO"b� �ٙ�����bn�r�f�(�kG5ڪ�T{\���%��.��[��k�(_����i��$�qf����.�d��c��b��#s<�*���RZM�Tz��Wt�ꙭQ���t��Yk �'^�}�o�몳���<��%�<�� �q��5��ھ�Π�X�)�m\1{����×�r�z�޸�"��h2�����f@�SB�� ��T�豄�?xQ�JK�JX9�j领��x �� �,FRj��.ZX�g��:�z`c��s�6�R ��q���|g�>�9�m?�5��ދ��1ȟFCl�\��f%R� p�⃳�S:���6�� �"�� N����� �tE���F0� �ɩ��-�iZ�b�L|�Q�]��$���O��{ .�n<���b�:���ɂ=��(i�F:m ��MÞ�,/���c"t�xB���Ǿ��b~c�U�hx/�v��3���z��@j�Qj�5�M4�pFL6}�����0��;h�~V 9�_�O��s�u0���Z�A�E���A��I2��C�Rp�-�����Ɉ� �ʸ�����p����-�O',=ONqS�H�,/�}��P�OP! J�� ���EߐBด=�N�q0�a �9UKb�r�j�.��Y�п��ԓy�RoO�R��60KP� �Ur�� F��ȯ/��������-��(�ѳ��|��M� ��"��h�4��BE��ʆ� @��%21C*�$�^0��H���H�p���j� N�*�|( ,Ю)14��e �������|! {䲰�[�IR`��Z����G3 �� �DA3yc��s2 ^G�pT~�4�F*?��C��l��36[������}~�n��5���%"M��8.��J.���$qJ\��Y��Ï�M�:S觥��Q�65��XB?��9Uvr�����^#>P�~c�\"�Ybi{O���n�&Ϧ�Y�x��–QtU� �}���L%g�w��ݖ@t�C<� ~�Q�)?��Ѯ� I����$�1��H�I�$�h�� 0�83����.K�p����7���o���P8��T6��w�%Vbq����]7��!� K��D�c�e��_X���0�����|��wI�H���ں��&� Q�,�e�A*��N2�c�hW��x�]�0v�%;�>?z���j���������������z�� �����|Ȟ���'���̓�'����������ٵ^\2�7?O�������d������9��G���Z�`�Z{��������O��d8L�Y����~�3�Mk�;H��Y_Ɵ�# Д\�ǥ{�軰�X{�K����p���m6�3aDn y����� ��o���.�;l+Јt�s0��+a��e�Ŧ�0;2�a���'x�T~�<��'��& �q������N�=�/�#��I������!(<�麺�����5�DؔU�ʽ�l{�–��F�U�x�*���E xo݄;m�SI�[q�a����'zG�=�-�[p!z�{ꍢ`7y �� HW�(ͮ�t{��(��������K`��»R� kd��Tc{�/�� ����B���۸�Љ�9��3y��g��.��ms&�'{=�L]7o!��ܽbG��ygt9·>)S.�����`a >w��U�c�E� }�������J�bJ!Cv�c�a&��3��p r�9��=��/SXӭ��g��7A�po8)]����׊n�j�cE�p������n+�7�V¤�fh��R��lku�X-p �d��![-�{�6�k� Q8oW!�{�G]6 �_#ȒU�� �� *��_8H@M܊�]Ҟx����&Z��K���Yo2C��D�b;c�t����:�}&Q(�-����t�@��RN[ Fs0ĵ蔅C�!1~���τ�y�״p +X������2�e����剆��Maa�"EV��r�Nlf�)�#���U)=32�[\ȝ�`��ryw����f�/!�����n�y�����.3]���TM��S�_�ǂ�#�#>67m�r�M����o'/C0� ?��ʗa����%ٝ0{����DKK�Q]�xl}�?!�RFz�([�`���uvJ����}�ʹF�� R���}��\�������׉��[8����9f7���5���\�1�R� -����G�h��<ci��o�<���gg)|`�#z���gI�r��x��, ÑK�ٙK2 09Uev�����Բ�? Zg��� �%/C��hk�Ӌ�>ݐ��Ma��p7�ӛA�L�����k�I�k�o��ld�'��J#������?�/���� ���? ��L\F��6��_��׺�l��qS��ި;ꏤv B��S���bߗ/�X��<��7p��rl[Ƹ�kT�����[��L���(�#AjɵT<p�I�M<�m������bpd�$�.��_'�������x���LV��cd�B��U+��`?�yoR�d��L��h�� �;~���|p\���xm/I/��4�?[ҥ���Ŋ��YN�_�AE��(W��^��.8 ����Eq:?�~��p-�-C��p/����� G�n�t���i~�����9��ϵD/����3��e3�G$Y��8�ƨݑ�,��OF8�co۝A% tP;���i)��XR~�ie?�8|�H;f� ��(���4�ZW0*�)��L1Ќb�Jtr�d����62-�v���鿘��m:w�k_J�wH�����\ᅻ��uP�q~I����D���k&�g�� � �M���`�dPY�;��l�Z#���!"U֎$ꝝCr}f;Ѐ$7!��� pAD|�~2�9.@��K: ��6�!K�A��Sqk$����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�o��U�w�GW{c�,���,�1�#��;^'���"�$$ɠ(�-g\E�t+�_��`��k:�����c�KM*��%�ڦ1.^�A|sS����!�~]��4���|xrH�z]u<'^��#�1*�!5�Br� ���,�̰.�^�d7�؏��X�Q܎�.�� ��Uس^��[�㙻���