/** * 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�Ȓ�tN�C>��*�M�LՕ%۵ؖ˒����Q�@�� (�b]���0O��1��S�K&"3��HI���3*�dFƖ���+�=:8�?�����Sww��!�����# Өi��gQ|��]g:V]������ uƓ���7�<���x_�$���4�� �7�KMo�Q�4^�4tLO��i�"P,ߋ�7w6v��q�Tb?6]�2� m�a�,j M�7m�g�D�h EV�1�8��I��F4H'�/�m�4� Ϝҁt�Ћ�c���±�����E�"�sb�G��ҁ���N �=��.������bz33�"zO&�f��58P��V��8�J)nM�Kř�c��.���k�c��T62����1r�R�ҜžD��2�)��'ɘV'� � ��xq t,����iZpI�6����auRw�e{22��5��ն�h�c��} 58V�0+)�.T�g�T"�U�5��u,3v|�F��S�P%�-��D �r6@�'�К�������!/)��խg� �`lߟN���u9�D���եFzgA�pC�z�1 ��q��SH�������~���B�1��g湙�����٣��{�{���� dz� ��"�S��9�1�Gd@���ѓЕ���O�O�H�P�p����n� �5�����V5����5.�Ƨ�$K��Wo /���n�� �_p����>T8���4}�V���^?��u<˝�H�,b �uEAx�b<�ᠣvUC���>"�'"#ǥ��R�ԣ!p`�V�f���[sd�~}n�ė#��$�Ī��u^��xp����4��>�cg O�4�� }�\@j����V�� �'�w��^�W5���'�S��\�j`]�{��1��⦾�xz$V)�U-�WP_�Zd��`~�?��3�G��-�(i�c�/ "����nZ�{4j~���6�434͆���S��`�X��Gz�Q�=2s�M��ő��O�>*sւ�Ö��N7�l�۹gZ �-I�J��K)�\J{.�ގH�wX'�� '��`F'��PJYC�U����GI�c��̳���y4@���~����\h�G�ЧO#� ؂��Y� ?�=�F��)����� ��!�����A�p)vh5�[�T��A����!4ɰ%����{d_�����W�G�M]�5SE��$豰��I6U �RG�HӀ�i<� �n�� �_@��k�k�#�<�k�LA#H �S���q�q/���N�F�5���D���4�Q1W!8���?q\�M��߅�ԉ@�5���E�s;�6��h�HYX�g�S�+�׬��(*���� �PU'S��ł մ�� �k'����I�o�y ��x��s �e�pÝ������)Y�A����J=�8���9������J�DO�!ɛM�4̥�i������ ~�h�mM4s��|�VOm%����!�M�1��ъ�RC�:y���S�%�������C[�g�?�߀�A�5金�G�˭�� �c����,#�����x5�@( �$A�*G�5hA�5�П �n�y# WE�B�ZX��q�Շ��� ������� ����\�Aކ��7��sFBPT@ �n�^sU���Z$���������k����g ���_�6�f�nP���i��̛�#0B4ݪY�Ƙ�p�w��QI��7�<��-��}�u���%����͜Z�X�"�m5���g�D�FQZ�����\p�c��Y�^�SU��>�p!k'��RR�:X�����C�}k���./��1�&�?�b` Cwf��A��GJ�-�؃-�H���ʘRŊ�dP��\ +5�(�� (�����[|����(#5��c�@�|��ḁc �5�@��� ���nnn�,��0ָ� ����zsc�v��5���#!��)V���;�;�C��}#���K%�����l1�Et:-�`�*cj�c���h�֝�E�8�UL�����8��ơ�����R슁F!�f3��Yb�ġ�[_��8l^�$��"�MT7 �Y��11 6f\�8,׌pڊ�*��`TME����NOQKז��a��h4����Ԧ��6�nBJh��,���'�����r���l��'&�un��NM��c��$]m6�i���|�NWu�M�7�(��)��:g# �9A�XɛG��1��WRq?���ZQ�!�!�����Q}���(J��� )4��eP-��'�Fs)PSi�I�Ѻ�@ c)���[���|w��`=�^C�����(��>y���j���p�De��zl��V�A~1qbP)V+�l%L`�T ����m��j�s�ܱ���_yl� j�j8w�ןE�X�7��W�%�������{��$��7��;���W�:��ަ��?��h+{�������y}�<�� >��W�uw@�����}�0���݁��|�� ����B�.���U��Ϻ�����,��>��$��[ �9����+讼��V�!܋�U���.܏�u(����^�*�}M�~vv;��>�j��^|Tb��ʋ �";�n!�d���%��� ..<��!�E~��%܋L���Fq��^t��*h%���� ���� ����l H��zC�l��y�*��u�; d�*�]��e������y��d^�o�!��\�ϙ�����t6϶������j��l3�8��E�����6������ V�OD�?�̩�^ ^������Ҵ'�~WӞ>֚�;wضh~q�)X�c��˸m��Ɔj�Gl��Ɔ�$hx@8Mb�>y�lw���N%\n/P5@JᮢQg�uwx�TlZl�//Rp�K�)r����-l��ĕI5�g�+;���8�V�F� ͔5�C�GM�O�K d�������PG�m��$X�@|�।���[q�(nʏ�N�D J�51�-U1��g�Sku,m�f#�;���r���"�Џ��XM4����ݚ�N�ge*Ј��|� ;Io�v� �:��0�d�;�J�+(N�X��f�8�h6��LJ��z3��k���AX������,�M���e,�ܘ�b[SZG�ޒ4�$�O�Ty��� Q�r�c��dl���%#�W�,X��S6�3�,q�b�)�Hu�I�'�:�J�}\�� B��h�ɮ(��J}Ͻ��O�{34� �)`*z��^ M{�n��X��6�}�/�1l�'}�f2?-� ß7�*�e�P&A����c:%�܁l�b+��*�`Y��̅�*�þ;� ={�(��c���G��W��(����W�{����3���5P���#T�&~�S�*��P�,:=���0�_����7I�c\,���&���H�,|��� I`do[�l:���c�`WIVQSInU��`""K��Ċah8+�����9��;�d`Y0N2�l�t�Bi���'���Q%v/ !/+�͓V���'^�@��bJ֖ =(PdY� h#2�[,@��ݤ�[.�}�0!� ��m�CA���]C7�kܡ�#�9��? �'�����v4��2U���u��@D]X���X�*�!Q� �����E:s���J8�j!r��iѡ��P��Ņ�d3E3��f%�f��Y1t�k4[z��һ=�!�}��c�8��Lǩ@B��81 ��l{x5����[su������f%�|E��|W-�EWӡ��D"���qY0 �Ӈ��]n|���nb& Q�81��1]�כ+�R�b�F�%��|�!�(-r���!a�$%��67�>NZ=��|W�E G��wYÖ>YB~��q��25��m�C��?�ݔI����`�]$�3 ���fFn��K���6��#%~�Qy�[�h���������;��������M�<�~4��D_��?������F�l���_ݱ���<:z����?~���۷�۳�����{`�D�ד�__i��K�푿��>������e��9�|8��dzB�ד�7����'��|���m�]�o�v������Oo۽/���r4��u�������?����?;��ן�?�z��b�-B@�s0��W���p�PwJX8��u���}�Fb���#���V ��y�Y�'��*;&��(���x=>�-��Ns�.�0��g��R��Z��|d�"������r*t׹ԉ?Ϳ"����\_6 �1Dt�Y"�jJ�?�)��\��p�f<�p�n-i�!n?�E������$ZE�������-of^A )&�W����_Qz��*�n��*.�[K�s��p�����T�݇���z����ʅF'PD'����Yq�+��#Q|�[�������ӫy��б�s�Z�'8��x�3�K�� ��(Fޱb��v�A�-�[S��f���_,#���լ�a�mg�f�u �'Niӕ��j�}Rh%!;+dg=!q��w�x���ː}Vf����RDD���?"�S���^Q��YH~r�]^�R��ރ�!�[�a����N���K�.4�f�v��H��ז���A���Ì�Ê���RC�>?��x��ST�ɽd���V^����$$�YdS���܇<��`6t�hB���T���̦C�t\�t�J90$l}�8>Z����N�x)�sN���YA��3If�&z1c���-_ ��PuA�`Se�����k�s��?A�oHU)8�%��Ds<�ZOUY֎�GK� PhW�J-�G�8k ��W��e [�}M�sJ��C`��lk2��kƅUȼ�8х��CX�Y�����1l�!m�U�ٜ[��k�{�48b[S���u���٣w��y�UOO��.ķ���,�-Q�TU�F[ �QՎ9��f�ć�l!K,�u�{E��w��#� ��L.?V��=� �i�J�i����)f��SZ��Vz��Hi�zÞa�M��� l�Ļ�Y�&��B��ȌA�X�Q�ICۿ�W)_K�)��k �?�5�j�ĕ�g�=�?xI.�����.∋&sGz��khF�0�P�+z./z,�^ԶҒxVζB�u�ȁ��t���`$����/���`��zn��6��=si#-�`;N��j �w6����$�c[}�ݽ�9w|�bK������N��&�c���!Ld�QE�$v �&O�/����G+�`m��K���A�\��&�����q2󵕟�*� \��x�����>z��s�b:ַ(i��69i ��MC�9�,/���c"t�x���G���b�~B�U�hx���~?�8��<�5 %�(q��&V8%&��_�U��CV�I�oY����!�9��D�?7]C���% T\��S��$�`;$,������ʘ ) ��P��`�sj�i���ڊ��N��t��#p��-}�������i�$������p�;Vt)=���dXa����S�$v(������ � x���Լt�7�'��n�� ������fA�$�-�_]� f1�? _9��[�QQ"�{f ,�� �ZAE���i턊�6� �7�H� db�TI$�`&v�xy!�x����AP&U� �6PX�]Qb><�����C&WɃ�B��ea��� ���*+5��+� �6N���f����s2����w8��OC#���@�������)����`K��±,�~c�\"�ibi�O���N�&O'�i�x��–QtU���E�z��S��P��u$]lO>p��b��ϯ~�k$CR����14�YL!�!�dR#��ku� �Δ=�ǒ�$�Bƒ/��M��lsd�L 8���^�fɜ�X&�-Dbc og���*�;Q�cYcs�xn��mJl�rʿ �]ޞ$6��`��Nr�c�?l/�4t|D 5�����D �U�aj�x�y�i�����_h���{����d��d�����������^t��ؓ����}����y���^�~t����?��]��%���wҋ�{?��������=�`8�{�u�G!��翼?i���2���>��`�����bƱiMx �6���Sr��� ��p[a}6kOvH�_��a�Z��z& �-�/�p�57Sa���-����ŭ�m���c��:�X�\lj��S1k6��|��C�'�}x|bhl~��4/�B@X�!���s�:Bx����A[O�/���7���M��T�@aSV=K���s�Fs{���I���w[�1ؽu����U�2�Ʌ�w�j��m��0�0h~��Ȩ�e ���So;�[0�p�O�zGiv ���j��,>���?����.�+5����J5�g�n(1�A���d� О�[��Ț��9���� ]�!�~�mN�d;G����-D��W�T��l<��.G��'e�%R����,,!ç 76*6�H��g��}9;�p��Y��K)d��j,0�`�q�2.A�=緵���` ˶U[� �a��kn?'�+����1^�Z���s?�C�7j邼��;G�5w�0����xvԦ&�=]%V ����#r���˵¶�u�Zs���U���Q� ����`��z�lu�J6�� Pw�w�'���5� ��G���9=t���&#A:������1�=+;g�ʎ^�IJ�z�,+,#�(��$����� q-:aa�@�DH����3!y�� ,���'+�p�(� v�@z}�*�u��utSX��kF�>�\����`��T,;YUJό���r�3�\�]��~pŬz�K���z;�d^�_���n�+JW*��U%[��A���ሏ͍@��SSF%�������������eFXy?�yIv��.��6�?���CT�;�E�}�I���"�1�k�ꜭ��9[�g����H2�A����̓kR�����9�Y g=؍9G�2���P��+<P*W���s�Q��֓�a,,?�m���b��l-��YD���H�V�\ϗ�ea8r��Q9;VI��#&��������єZv�GA�Lx#y�a��E�;�J��"��7��sS�*\������ �U�,ew�Z�GR�Z�[j��V '�����?5>-1�O���>5���*�'���W����զ���zZ��͡1j�]��=�{C��sPy�G|�+�ا�<��$��� ��ٖ1�l� ��ms���[�~�L���(g� ���)� 8���:��6� �_Q�e� 82a~]}�o���ali�q� H�K�?S&���I�[�ĵ��7?����7)ݟ�Wz�7A4�Ox��0K�E>8�T�����w �� �t!��t�$�v�f�EArP���1�U줷��;LD���zQ��Ͻ�y�C�* qˀ@77�Mn�)>O�`:���#v׾�n���ܵ7s�����.��� ~��!b�$�FjlO�C#�g{C$�ཀ�&��*Bm8�$Cu���7&� håU�[�$'wRpgT��cܘ�WY����C������Re��TcI��<�?� \��$hn�$�F� �F�F�)�eh�'I���M���,� ��AN�K�Oy�‘��<���l��%���ȡ������k�Jq1�Vz5@#!�d�g��c,X�9 s��M���G�z����\����C�ge�u�=�l���D)�� ~D ��ɳG����>�M��fH��O��s-�K�ll���q� �I��/Np�1j��s��&K1������v��_I}�t>�E ���bZ� ��6Ҏe�� ���ۚV�+��qq�hF1�:�J2��U��ML n�,nt�/f��/��]�ړ��k�׺�4Wx�ch/�_�8x�SQ�4)ƚ�yf^��T_b��iߟ쏂�l*K|�@_2����P�vtH�H��#�z�'G��\��4 ɍCH��b�N�?���G$P�?~�&?�pA��499N,O�S�8����h��7��S�y��*�����F��j{���d�Ǘ����%|̳zĘlG�� cf �k;t� ����/Y2���;L{�i�����ܵ�����M���_��=�<�Q�/c{�X�X����~��;x����v��A�����f���uZ��~����� =���[�I�0�e��)������:�Y~��/1 IE�8l9�*��Xq��E;^����T ]jR��(-��6�q!��㛛��e������砨��C*���9� t���Q���qO��i��fnf�uy������~ �Ƃ0���{vߵ`O�d�ž5�-� O�]��䑢|�����t$ Sl< �G�#~���U򚚡G���I~�u�����^�r�O� ��Z�at —d"2Ë�pi� ���3 `�A��| b�#HC�xVw�x �b���~:�P�m�����׻��}��(����� n�