/** * 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�xe*[�l�b[�%%;���@�� J������y����?�|�Tu7�)RRr��%����uuu��������Sw��!����� Өi��gQij�\�����dX=����^���hlMvx��4#��c�C�N���8�JJ� U�1�H<@�f��eƎ�5�(��j�B�d ���h�]���dZ�44���{�%������!����)�_�)��(��z���Y,��� �h �(#�L��QT��������9499��>cz7>�f�-ߒg�>�| �6�/��/��ˀN��� ���8"r- ͈�����~l|lD��� ֈ��P�!��`�?6����͏��q�5>6$Y��xcx�.�w�6���#�'|���Կ�� �ݰb��U���Y��F��#��0(P]��� :jW5���=P�#r:q"2r\J�/z#eL=6j��h�Yh�5G���fH|9��^�N��_���Ń�h�>�Q��;Sx2�A���Kr�������V�ًh���Am*x�A��/�tr�V����Ѽ��7�k��nnR�A h kT�@��=��&k2��؋�{���wwuH��S��Z �Z}� �\��nah�kTOX����j���j���c<��M}/��,�H�R0�y-�WP_�Zd��`~�?��3�G���-�(i�c�/ "����5-�=5?�FT}��f����)�R�a���#��������T��Hr��O�9k��aK��V��{6r���3���$i��s��c!���Bo���{� ���u���F0��j�����Ȫ� zV룤ֱQ� �49�2���������M�����iD��^��=��{�����8��!3��72�6���B28�.�n�&qK��9��1���!�$__B[ya�ː�1xw����eP3U�{J�N �?�dS�ph u4�4 �������&m�������Q��?�O��f�4�2=Ř��������jZP� J�H�r��هǵ�a�T��]�O��[�!� ^�;��k#I�x���U|�=U��hp��|<�2�"9{{qe� ~ Qu2e�OP,��QM�~qr�v�{��tt��Gï!��A?��{QV 7�y- ����A��ut��~�#�Z�g'=�2gT���gp�� �hH�f�! sij����*��g9��:Z��i�f����ꩭ�Ss�S�!ʹ�1fACB���" Z�Wj(�@g�_?} ���3�Yb�sh��L�R�G�P4h�&}7Rc��u���w$|(��Q]��`� ��I��;^ ,�B%I��ʑd Z�|�<�B�l��UQ�����k�����y+H�?k��cC���)�i��a�� ���A��[��\"��39���g��z�F����>�}Z(/����M��D�x�1f�%���{�{��@FARp��G:���xh��д���zP�YPk�Td1��f������B��(J�B��ܼ� ���1<���}����ӧ�.�c ��ZJ Uˀ�k5>�mߚ���K�"u��ɧO�X� ��~\����ф�x�8�`ǟ� �5�����2�T��(�o63ÊG���J60h��n��6�HM�혃�)�7`Es��s #�k9�%,���[8�E�)�5`���8���ڲ�(p�y�p$�3� 6�xr�~hӰO`й�u�D�]�-消N��,WeL�p�x}�Mպ ٠�G���:cS4u��8���Vr@_�]1�(d�l�S;+��8t}��:�� 盛D2Vĺi���F�0 2&��ƌ���N`q�]�B������Y���9j���]?�?�F{����4�ݦ��MH MۙE�]� ��rƃ����(6��;���IeA�[5��A���@�X',IW��f���!&���U�h��M�5Jv~�y���H�dN�*V��iz̢�T�}?�V`� a��(f@�02��13C �boTKi�I��\ �TZ}�l�n2�X d 9�rzG��;�ݕ`��'� �Sc�W���Z���~�a����̉&�8D���{V�A~9qbP)V+�l%L`�T ���۳�n5܅s��JH��<�F5h5�;����"Q��s:���*�11��"�py���Q�V�;��a{�p�j���䕒(��Q[Y�p硵�n�.����E��a[�e��,��\���_*"�6g�i���l�t,��Y��z�+FW��D{��5�ݖ{:$��D״'�����h�ո�~M7 �잖��dC��zS��z�I K�k���<�e-S&�e]���If�`Mb5�)�C�ʭ�q�2Ӫ0�Hv� ���ٓſ�:������o#o���4/�p�0wΦ+ v[@����9]� ���:1�����4`�����IҰ0ho��i@�Փ����Z����ɰ�2�H��qo���h95�ᛳ�[(� ��igFi�6�_'�8hI�;��6jϢ/k�ؔu��D��E���������H3_�[�o���n�`���s���;�z�6L�=B�IQ���f0�э\3Л��u�V3�:����U4dЪ���oA�����Kj/�� ��B 1DBå@�b�3�UPl)"��*���e,�E�iA� ����� �tH��t�+@Z���oc��^�C5V�t��6{+@z�V�N���3a�oB5���?� ���L���Q�Ť�Mi���.���*J�����a�Q�*��2���*�bq�����G�_z]N�4�e�ɫ���7�� iMu"0�90��\zU�� �G�`ơca��='%,��(��n���K�  ��c#d��)� �)  �}�;$����\ԯ���"�c���a�rd���P ���ԋ��d䵴�HNm�EpvU���V��U��Q�Ѥ�:1#>r��� 3�-���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%g?���{<������| ����E�z6�y� ������\|�������tF!%x%�f?�[�ж��l*���$�QlyKyYzn�bN�1��P�,�O#��sV�����@���3r,'���'��҉'������c���o��*�9�`v�[2Yj?����g��_��խ�?���%���S�`-!ևG����ca�l5�JV�� �Z�.��eR��w�UL���\�)�R��wb,�ԓ�J6�� ܛ��1�-@Q�l�󻵵V�AT� ʷ��?�Ww�6�\hP��u��-���:H ��������<���@�l3T�;�Q2�?���$�~���� �|*�.��M���>�P6�37���8鯓���_#��D`�w�?��,L�\�LA�[�� �g��C��������D""��� K!�k�H)n|�bխϙ�ycK��D�O@&0�K�#�g*x���9��s��|��_�qyk�x@{��R�P"�nbU�{��O���(���o`���ml��&�/B Pb?�($�Ft�z��7���#�cׁ,�k�_���T�.^��w�w4.�N#D���n�述������7�؅�^ޟm@J�����{@����1R��P��2���)B�A �`̷������q��%�� d�U.�Gk��n�� ֗��o^�"���o%*������E�s3IVy'~'Mcd^ ^~������N��pK�F�0wM���IS5�j{��(n��0�������X-���C`� MG{$'ha�E�A��@m�� �=��+��p�z�Х�L��\�Uv��>(�%7h�07cy�;�q���x��#m��}ת�=?�Avry��$�OS��C"K'nrV~�X�R>B�����4��4�6J_`zxnQ�^�ks3� [&��� ���@�����A�6��) ��=_t���Մ��A�8�S����9� ����� XR������kI �I��������# �� k��� ��,n;zL����Gr��c�$�.���İ�Y��@}�Pgb.��~��}���̦� /75�l�tG���А�I�*�� �"ɶ�c���|Ř���&>�ʕI5�g^(;�q���f� 4��nh��1*�8j�B ^!�l�M*�g�:B|h#l<���/%�ܜ܊KG�8v�T~�v"'RPJ����m����H�8G�Zèci+4���^�1�#Xp��C?3c5]�\b8�B\vwB:}���@#���i7�<�e��*h�Ї�8���x*��`�8i�b�[���أ������l���W4Ra��Z~چ�|6)�����rc*�lMi�K��|> P�9\�='D��eR� ��"����c�L�_i�`���٘π ���%�d:U�a(����*-�qY�/ �*�]&��Ȣ+�=w�П&�ghF�S�T�������k����m�� ^ c��O���d�Zx�?olU˾�L�@�b�-�tJ���*:3�V�U��,+ � U��}w�z�HQ������Oǯ�IQ�s�ǯN^�,�g�����k1��xN.�~6�(�������j�,�O�>[�����ei��8N"^����&���4D���h� �t^y��J���� �r�U��/�T�L��g��y�� ����zl�8o�����Mu1iD�d= [e ���ǻ�-S�ر߶8� ��LJt��3�"���XJ�.73r{�^�M}� Ϧ)�;��sG�hDC��=0��j��g�(C�k�jz� 7Ջ �� |\�}1Z�����������o~v�����U������Oo�^�f����O�yq�_�^t~�y/���'~�}��٫���n�bx��ŏg��3���� �_��~�j����m�kw����_.޽��}>���m{�����.���}�K��a�����t싯?��~4��r�-E@�s0��W���p�PwJX8��u����Fb���#�����N ��y�Y�'��*;&��(���x==>�-��N �.�0��g��R�=����[Y>���s|�e�9���\�ğ�_�f�a�/������,g5��� �de.j{Q8C3R8D��4�7!΢u�:@xr�#Z������D�S�C���uE������(�Ui{������6���(4\�&��kUd�a+���`!�!�r��� �I�-�{Vo����D_C�V�u��y�{�t�(7�:��|b�H�GcBOp�b�p]�_B1��;Vl��n=��EtJ\ܲ������e��?��u?l��l�l�N���)m�v��B��O �%d�a��l&$nu��~o}�2䐕Y������m$����xj�zkJx< ����:u��}�:t�5L�߰6 y��…��l�.IU��r:CW=��~��wX����c���Cj���ϻ}��4�� �q|P� �+�]Z��d3�l�1�q���g�̆�MHy‘�Mc���t虎K��T)�����G�~Oi���!^O�\P��~af���L����^�X1��Ɨ�&:TaPĈ�.�Tϔ�IM �l��;�\�&��2�����8�����7{���k��3�F�a�)�'�9�6W�����)kh���8`�h��H4��C��H� -Il(Z�1ׂ�ʲ��8b�l��B�b�UjI>���H� >����f���kj^Pb&�+p�&]�)�\k.,F����.�2²=l�&����`#i�Φ��]��ܙ���ۊ��H���S����I� (�P��_�+����`����&g;�x����1��F1m��d6l'?V�$�ط��m���’�&��XG��=�)`7 y೼��z��Ѝ��x�J�{����_��_�q1W)��}b���~�C=WɃ�B��ea��� ���*+���+� �6N���f�����d�/^G�p<~�4�F*?����il��s6O��ю���C|~�n��5���%"M��8.��J.���$qJ\�t�y��Ï�M�:S��hv��jvL�T����ͩ��c��W�v�a�#� ��K��xW��e�+a�|�'��y-lEW�q�P����\�Tr�m*л���������;�b5���G�F2$u���AC���r"I&5�|��V(�p�L��^z�, K�)�"<�b��D����AN@A܀�R٤��LU�ei��Y$���v��/,���N8� �|a��fXڽ��0����%�%�jӒ36>����e�*i���qA��>����~�Ӓ�_����~~5������������y _==����|>bO���S�������S)S.�����`a >m��U�W�E��|�]��ф�V�J�aJ!Cv�c�a&��3��p r�9��=��/SXͭ��g��+A�pW8)]���׊�m��!'���P+�����P�o���I5����#�65٦�j��#�Bq��r��j�6� ��vr��|�e�`�5�,Y���:[ݠ����#��M��%�g�jMl0�ő���dN��&3��HD��)&�3vL��ʎ_��їa����"� �H' y1� �ŀa4C\�NX0�8��{/�LH�w~= ������ 1���6�?���CT�;�E��I����-��1�k�^��ҽ:;��A3��d*����s_�'פ�')(��ku"v��z��tN�M95r��j?Wx�T�B�?h���~�'��XZ~��4��n��Y ���{?�)���ܹ>;-��p�;`�rvڒ��LNU�]����)��֏�֙�F�v�~���:�Z��"�O7��wS�*������� �U�,e�Z�GR�Z�[j��� '�K}a�W�����X��~���`L�+�e��jӫ��M�Z��͡1j�]��v��C�]Py�G|����w�<�>3��� ��ٖ1��Z���9�5���<+S�2<��H�Zr�|RbOs�h�����X�0 ��n��W�I�������`$^1�)����٭P�N�� !�O~ޛ�.���>� "�����%�"W*1^�K�+v� �-�R�W�bE��,'̈����"ۏc���I/SaW���oy��8��{?󎇸���nn��\BS|�*!�tΟ�w'�"~?�5�fH�����s-�+�ll���q� �I��/Np�1j��v��&K1������v��_I}�t>}�G ���bZ� ��6Ҏe�� ���=M����q��8S 4��ϓ�?����>�%�m�:�3���L�nsݕ���;�7�5Wx�dho�_�8x�sQ�<)ƚ��ټ:�y��Ăq��?6�3�T����d4[��P�vtH�H��#�z�g'��\��4 ɍCH��bd��X�R� �EiI��i� �״���o,3�pȬ_�� �,<E�R�^Wωנ�H�������T!9^��onffX�w�˱�J���l,�(��g�a ��I�*�Y��­������P)�7��h�N�Ag@�0��3S�5�)�'��_%��zd [��'X�j�o0>�L�+��D b����uFG'|I&"3�� �6�/�>�f��� A;�4D�G�q�n��.��n�o+���=���M���,J�Ͷ����!���