/** * 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�¬�R7I��͖,�v�$}I�tlw��IƇ"!�1E�IJ���k���y;1��SΗL�$J�l�ϜY�N�X� �P��������%�c�`{���=�z����eԴ��~�\z����k�9�;�2��pw���v���ﻎwIF!��QQ�V�]jz'�� �Q��1=��ǵ�@�|/�^\ �����U]���t˴F�L��/Q i��i�@W�IČzRd�N#�c���aD�t~�JٕH-y�cړ�� �0�� ٓ�;�l:u,��2q<'v�|d�.��M�� �[3�����#��o(��B���1���Ռ�~����~ߏ�����ؼV��9� hy�f8�;Ho+�vlj*#�O �ؗ��Y&���"˪��6�]/A��� X��5M ���dҶ2��B��vl/BF4�F;�wj�`�ԡ�� '�Fcf5%Ӆ�̘J$��h3\�2c��ja}w=v���'��-�Wh �}���hZ#�<4���]�R[Zߎ^�� Ǝ���/ڔCK�� Y]�\�-��͚���Zm�H).#�\)�K�D���+�����[��{ ��5)s��_ ��:�}1�f�Ejߒ�'���?�ok�W�g�W��U@����@i����fD�CW�v?�>�"�J������'h�~��ʟjzS����Z۸n�j�,P_ �!|����჊ �}��~���Թ��-�%�j��� ��Y��F�_"V�0(�h����) {-����mT������ ����IR�����Z}2�x�uő���� �/G2�&�Ī��M�ػ�wM��g4���cg O�8�THZ;Eؓ&�M�#Γzd@~��K�v���Z~@�?��;�� ��g��|��|2���;b�Z��G�h��qT(�ҥ8�U$n�RU6{!��c�9$Ö�+�+ �}�?&��:O�۪��*��p/@I0t����l� ��������!xPݦ�:���P6�?�7�G��WL��F�@���sDZ�����X�B� UA����h��b��B�@=�h�6t��25����r+>������v�}m$�Q�#��ϲ� W�nX��GPT$g�^^[4�_AET�L�� *pTӶ_NA�7N�Q��O���� ���3��F/ʚ�;�d1ח�KK�����pfP������T$��ܪ�K���ɸO�\��?����g?�]Kk�j�Y@���jj+������ĉ��V�O�#!�K{-y7�Qʁ�?�y�~ �;a���2��������ⷠh�pE�n���)r+��$(�87 GUy����܇����*`�PI�U�$+Ѓ�䡳��b�F@��J�,��*��̬=��{Ab�Y���� ����\�^ކ��ףbpFBPT@ n�^sM���J$O���Z���+t �����Z�: �= �r}P�:]�����B}�w�'`�h�e5��[�1{?���}0�'9d$w��x�{�ç�L���e������f�H�+f�����9�Ю�������7����c ϲ��U����sp Wⱂp�ZJ Uˀ� �yȶoM��W�%S�*F���� �aZ��??��a3�hDi�C���Ob��\�W@c�XQ�L�7[�aգZ%_YP%��U}�O�vXe���v��蔯$�*��t��������9,��[�U�1�5f2���:���ڲ�(p�Y�p$�3�6�� o�~hӰC`���Z�F&����X�":Ͻa�r� ���C4��Z{�5(*���b���M]ā�7 }�\0��P 4 /n��ŞFJ컾u��N?4���&���mj���V@(����i�9�&�a�f�KZ�hױ�5&�j*zǾwq�Z��|�;O�A7S�"J�F�]��܄�д�I�ك�ປ3l�.r��&�l)�&�mnU�V M�;�c��"]���iYCL�����Ѥ�یk����~����ɜ e���#���E�k���~|�(���\[Q�(�1Vad%�cb��EwTC�wH�V_ TWR�5�2�X d 9�rzK��[���`{�!{5�5�t�@CA�t�S����X3�����a�^����Z� ��J�Y�eKaӥJƌp�]�l��M��c+!���Ԡ�p�z�?�D�"o�yh�-k����4V��˫�w@�ʴ���m����/��U۝���Re#�����*�yh��W�KڄC�0pt���鼌Ct0r.�V�/`�3ôFE�7m:��a߬�d�і �-�U�=�Š�lʻ:6�D״gե��5��Ϋq9��n@&ػZJ^� mW��ڝ�KL9Xb^��`4 �)k���)�(܈N2�����H =Z[n���]�1�L�œ!�E'�����,��l�� i��^�.��H�� � sg�d��`����9��e���߫#�lPA#)F n�� +�����ݴ 4v����5������2�� ��r��F�4ZN� ����J �����Q@Y� ����-ir�X�F�It���uY׍LĽ=t ���Qn�����zi�+}��� �����5�{2�al����;;&u�!ԃ�(ZM]3���F��u�غq������*2h��K�7���`K�%���k��!�����R y���*(�9 �Mk�u�0����pwL14�&��FH��@� ��^�}��&�W�+ Za��*�6����� �]i�Z�����0�7�@u�� ���L�?՘oŤ�Mi���.���Jj7�Ն�a�Q.���2̫�*�bu�����G�_zUN�4�e�&ɫ������ iEu"0�0� \z]�� �G�`��ca��=#sXn�Y:~��ο�_�U�X�w�͐~��,�4\�D�L|+ۙVo���"�c�~* Â���өā������kiE���ʫ����1-���Fs��9�I]udF|���[1#&S3�,��T��|P�&��j%��$hMt �G:IZO _�+��ĕ—�*M��[Z�n<� V����LcM�sՖ�zc��ՖYD6/��,�JK���\��xy�R^�#���^7 �`�� Bdm��"w{��`_ϗ<����!��w�����A4��ޔ�x���&��᢭��N�.�����܇G�y�@�����5|�=������>�T��Np}vZ��]�n��|�}Mm#_uoQ��Q�&��7ݱa��ie�0�XBw�͈u�d�A,�C`���lw�a nBim_��|xL�JЗ���{���񗍡e[�ci<0��� ����L��^�j� ����bZ���^ƒ�dhJhw D����V�o� * ��l� [ؿ�R@J0��7��˶W,��g�BV����1^�����Z8]$�Uօy� Y�t�L�������� � �%WN<"gW@m��x� |k�V�����ޓ�R��U�g>k6�r5����.,�]�+k �=<E]nj���H#��ߠ�ZUs�I�K�U-c |-���bM���v~c�s#Yc��4�p��[�l�*d�Ȝ߭����� �P������qu��䢃�l��O��6@L.�#v���,F[����P�Sv��d ����~X����|*�.��u���=�P6�7���8鯓���_#��D�`���?��,L�\�LA=X�� �'��C�����ص�D""���G K!�k�H)n|�bխϙ�y�K��D�O@:0�K�#��T�V�K$�0}}�`\�qyk��&��{��R�P#�abU��{��O���֘��o`�_�}l��&�/B 0�~v]H�%����� � ��D�ǮYr� �b��]ł��A�*�M�.#D�F�ޜ���v��?���b�~�pz�}�����ѪKg8v��OmRA����Χu5��50�{�~�=V��όW�o9x�׾�M�_u���Z���[_�}� κ ���|-c��c3�1�)*����Y���4��9E�*����8Q���.��%?�]�%�H�CRW������_ So�������b|��/��:�H���yh]!�^��o+`h(�Lx�t�B�}��2�Obޢ�۹pr��ܯ�S"L���wsh/�x�H� ZX���Q�x~\���g�N����D,h͡28�,��,�+� ��D7�ٲ�L�!��lx >x𹢉��[q� Gp�ʏ�N�D J�161�/�1����Sk�,m�f#�;��l5�u ����`f�� �K G4���QH��:%h��[�얝���^m�P�s�/%7% ��}���8�h�W����v��W�C,�a�Z~ڇ��l�4=c���TT#؛�6����%��r,@ͯ��M:! 6_'Ř |*��C���H��-�,X���Ѐ�8`��,��6 �2��\���>nq�-���hΓ]Sd1���;[O��44��)`*z��� M{���Z���c���,c��IƐ�d�Zx�?ole�}�< G�� �19�d���[��9˲�0`.tT��ݹah�����Oɻ���N^㓢� O^��>],π��ٯ��!,g������t���k��Ǝ7�1`��n�I����`�]�SK��9�zF���%��7��l����h~�{K_�9cWX���������Y�0\W�A���ܻ�-�4����ӳ����ov�ڋ�it���돿�r���wﮏw'���{�'�؜G���/�?�ּW�ƻS��}�����ɫ�^k�?�}������FoFgo��??w5�w�lش�7NZa���/��/s_�~8~�ܻ|�W���σ�_~~���G�����?:����?��~{�{ζ%�� �M�DBk8f�;%,����u��<؇x#��\�w=�-�Tk�E����9u�,�ks��D�EEc���Ҟ�B��yN�d�3E�\)�]����[�{d�"��{���T�s�#����7sc�$D�0f���)�d���U梶�34�1�CtIc�1!q�+�!“�h�Z��*��H���9�r�^�x�x��������Uבv��|Tq�F�Na�Bõ[�W�VC��!ۛ R�+W~�� �Y[��:��Փ�KXG�F�q��y�{�x�(7�:���ĸ�� �� �"�1��¿�j�����:��xTw��6�������G��e��E��u?n�mm�m�Ma��%m�v��A�~H*�%d�q�lm&$���07�[_�߱9bu��M�1EDt��="����5%<�����l�6��=j��:&�oX� G��z�B]��ϤJ|�|9CW>��~��}X����c���Sj��׼ϻ{�jnq/�*��` �Ovia��,����� f&O"%��]'��GvN�-`�&�g:.I�RE�`cߋ�]����]KkO���zgJ����A��3JV�Fz�ŊU����l�CcE����}�t��@����jƴ�� = �YMW�ڙ�u�NsWњ ��Lo���uM&��Fcz@�3�-�@�oE�i�K���{dq���̇������&�q���$��x������g-Ο<l����c�Z�/�ll$��_����p���jN)1��+��b�e�\/lP��50�F��3������Xq"�ۧ�|�u�,oÆI��b�|1/w8��X��?��* ��@w`���w!�R��G�*9K�y���P��_>(5�� �O�� ! a8��kO�����W`P�E] �9��>vB �y����}pb�(q �΂�d�l]2��>�]8�&�#V�c�\�>�����h�0�]��e_<+~�������H��0��xI�Gq �L�'�5���7ˍ~6���g/I�zO�;p��+:[�����(�~h:�_���E�ĉ �Wu�������f� C%�A�q�x�S �-xU�Jk�[Y=۪�ݟ���z-��uɾ�"�56���e0I�Xca*~�_m�����Z5����?��8~f�,_�� ��V:�;���c�1�UK�������`�!X�aM��nq C�����g���/�@¡̯<ع���kb_�Fjb�I�bs�b c�7sYp`�a���|i'> ��WRǏ�;� ��M#���]:X|�B���:TL���ND~痫���+��?��J~���$a���8��Qm!�����{%Fd -y2+O-偪�!���Bϟ����T��Z0Ju�A��&�0) +����8Edw�a�A�(؞oNՒ�$N?Z� hpA6��� &�c�ڥ���V��#vB�'HW�!��I�;����I��O�J�~�)K(��&���� �ZAE��8 \$D��ʆ'@��%21C*�$�^2��H���H|���%�1~bS1�'�����>0'�@������^����2��i8�z�}2 ��n���^�3�Mk�H�����?��ub�`�K���軐�=�$���>�Z�ͦ&L�-�dqa��I�|E8a0p ���������HW�C��:�:XV\�j���+v�h:ă���<>34���ψ�- ,�|���z�_�@�$��γ�K������uu��� ՓDؔ5��4?����ݙ��[�G��r��?�Y����? T� �+ �O�<�[��~?�0h1V�(Ɇ����׏�n�)A��!m���ۆ��m4Duw���\�oW�L������R�m���$Ra"�����\>V�ژJ}�Dք}3y�t���.��ԛ�X�O�,���n�A���;c�'�Igt9�w>���/�ٙ��f���/h��,e�*�����ÓR�T��ܝ7� W=�]7��� ��P���<P*����s�Q��֓�a,�?�m���a���,��IDO��XG�N�\ρ���p�[`�rv��t�G,NU�ݽ���)����֙�F�����!�mik�Ӌ�>ߒj����T~R�ߝ%�n��i�)1J"�޽��P<�eSOY: B�e�����G�?�Fx8�A�V���e��QxL-�����A����8�<)N��T8~����>��.��%�+���g�ߨ�%�g�I(_�8�4L|̳zʘlG��"cf �k;t� ���/Y2�3����X��,�_��k��ǫ�PI/���'�y���C{�X�X�Ֆ�fc��WPdO�.����T��A�镸��^sWk5�\����+��;m�u�D =]�X��� �ˍz7I�E$��Ā$��傫���!��t!.��= ����#�T�iQ[�ol�&� �ķ��[ˌ!2�7�K� ψP�'�T�VU�s�5�<���R�Rc> ��i��67+�M͆��\Wb?�ncA�G1O��,�&�k���3�i���=��!�(�7��iȎ��`@�0��##����'G�_%o�zd [����j�K��E�� ���Ͱ�DEo��:�����E��t ���x�� �l����!N�����oJ[�6�7���K�FGku�E��V����/��ɡ