/** * 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�H��tN�C>��*��2U�ͻ-�%��m{4 �$!� �(�Js���}�����)�%7"I�"%���O�\���������B��|�pH�����|����;��@��X�2��d�YNl�c����>�Y�4��`vT���Y��f[�����a��Jŵ���-?=��IH}Kwd�Uƞd�NH������r�ʸ*�n�ے�CZ�^�<� M��M���@��+�oy!�8��N���4� �'ϥ�@*� GѮpiѱ���@b�]al��k�Kˠ�"˱B ��nӮ�фV��H �F~u�`hy��X1xV��Զ|���VJkk�_I�HP ���tl��-Ŀ�I�c�/��;���Q� ��&^�o�HIJ2�f�u�� }�eH�!UEQ�+��ٯ�o� ����-� ��> ��ﰭJ�y��3� ���YMA��=� 'V�<�2��r��?]�lx�"� G���9v>���}�?�|cH���o��M�Sj ��M�+Ÿ�ؾ;A��rh���Y5t�u�5{ �>�>i̵O b�q�7<�Wa�\���R��<{�e�`�d� ���9���gc���s똆�� �%�BO�o �������@ˮ?�Za*|����k�U�ZQ�"W�V��US�ZD���� �Kp9�>�Ȱ��C��� }D�εC:�U�¿X�_��X�aG&�=X� A�Ph|ld~��~�!7eM���>"'C+ }˦~�X�ԡ>p`�T�#�@u+Y�S���}⊁H��rb�h�:�'�]ؽ"m�  C����>�:%��� .˗�ѣ~�|�� 4ǡ��d�v���%W|}|�^� �����7 c��nnR�^ h kT6��>X������u�E�V0��M| ��� tk)p����\����j���OJTOا��� j����wK���a<��Myۧa�;$�)(����+��|���n��~�)g�c ��h�з��Љ+"�kd��|��կQ�*����(&|6�&/�����??R;��њ}=�\f_q$9��ӧ�f9��g�����h枵�s=�L��3-���s�3%�\I}��ގH��Y�F��A��&�i�T�=�'��ů�715��~��8(��9&�[8�G]��n�� 꿰ݞn�G�> �݇pƻc����|�����g�Z�.�g/w,��@�=MI��,�E����c��C�LA��X���s���=�>���Ӎ��X�*7sb�b��WLi����� Q��Ŗ����?��˹���ó�{�C�x���)��q�XB��jJ Ù��y��kDh��₩H#n����0�e꟟Dm�Ym0�4�"���r��d a^�J ��� H&��F��A%��Ϣe@�&UY��ӭ-6F�5-��2�fV�1��18�0A_���������,P%�\c"�ʪ��͍ � <[�tGBY#�`� ��m��M�w�0�_]I�Pq���s�JG3oX�\�b�����(�Ҝ{ � q�+�50I��q�� |�o!W�Rt�@c���f���D)@�=�5.$����?Y_%��"�MDV��j�S�D5؜q�0l=�����h� �Q9mz/ C�9;C)]������~;��V�j�jls�|ݴ��ӆ�j;�<�K�ȍdR���^�t��Q� T����eŠT�Z��e�b�E+UV�:�d\c���8��9I��5����zd���z%w|� �% •2�kK�x�c%FF���"ݧ0,��Aդj��*ե@U��!�J� ���@��n!�6�6�ݨ�����C��1�d/AGA�t�c������ ���G��X��Z�,�1�xh� R�V��BO���2#\�e��b�K��2%��]yl�5��b8;���FA\��p�E͚��c(�U���*h]A�2�x�g��2��a���fu$/�D��}��j�X�;�4�U��O8������^]��m�����Y�إi8�t?�QR�u�D��K Q�5EMk�j�(O�����bK��Z���򤼐���3�y1.�_R5 ������QSZ�ZUn�^����Z&��uQ�Ā�uQU�µX�$3i�!��~�T,Mi�����8F�iW�$;o�t�Vm����4� ����뷑7\�F�c�I̜��h)�f hհ�s:����]�.-/�A-)Fk5��� +����+-��ؼU| &����C�u��4�����[��Sc_��n�M�f��z�PV�ÿ2�'�AJ���V�Q3 .VhbUTU-kb��FAmk�؉���H3[��k����nKc�ISs���`�Z�Lj�>B�EA����1�Q��0P���U�V5Y����e4D���N��`���K����k�� ��� ��B yq�i�2(� �Mc�UV���O7 ��G�i�\��t���@�% 5Q����{�����-iHU������.+��K����_�nѱ�!P'̂+"����l/&�MJ=h .�RP���6����rQ݅�a^�ZiNW�� y$�P�b 8MC]D��a���;�y��OK��rM�)�oӫ��@�PI`>R3�-s��2��:�������!�}Ă��l�,A�;��;�ԟ�Dv��Q$�uY�N'�� ��m ,F�49��A���XNZ^JK���V\WW%h?��bZ���ת�#�ԕ�z�g.<��g��R�K�g9����1Ԭ�n�Zf6 Z�-��N�Vē��J��q����C���ֽ����D�U-�0;�X�L���^�l�E����P���B~�E;Sk!^���W)��������*�X��Y�>܇��V�>�W�%�������{ٝ$��5��;ب�w�:��ު��=��V�r�'u�����1�ܗ�yw@�����l���h���6�T�g��OpuvZw�]wl�]Um-[u禬n��Lb�m�e� [���a~?���ʛ��a�½XZ����q����\��ʶ*�����/ұ��$�g��/�E[��ca<0��p/����L��^�j����èbZd��^½�dh hL�܋�4�Zɾ���$H �}�la�:;R�qv���_��p��b���>��z����������<��.�ސyN#��-rCv�4���V��1������^�p��C�p�ྦྷ�+Lw��p��D�u�C$��I�`���6��n���R$[�t�Rr�j �?�\���&���u'����� #|����س��Kj_R<�J�ӈBI�x���o�wh=���|*��"v1>�o�e�s�9���B�R�?�< ^F�iM�Grx�;�oV8!�K ��� ��d �&��ȡ��j%�+Lo�H& ��W�������Ű|tt�.��dtYx�����ph�TO,̩�Bj�����(�xv��T�"��ւ��\��ⅺ�wb�tƓ�ftL�.�5c+cxZ���.2�wcc%�@T��5��;w���;�O.�`f�r��r? d�p�o��ݟ������}�^���%S����@������"���H{��W��~�F���Gv��qҟ��B�NCm+x�sC���6��)�m���Խ[7��02-B� �F��RV0Iq��(?`X ��ی���W,�eE x�t�,%i��#?1�\U`JPF)aV�<vr��?O����Ӽ�fx���{ˮR�P���*�ĝ(�S��p>�3�ߝ�5��|z��%�` A�E��̰�eI��O�QY#=��K� ) �|��T�2�`�;�{�K��a��V�͐?4�����,�TF���k����g����-Kñ���5I [_^���\�Pw��X�����#���0 �=������]���M�뻷i��0�#��/F�]��]��-�pq=����`���/� ��<��q�s'�K3G���3'9p}R���\�&}�'w)̝1�G��3�x����_��q�M��:,L$����� � ]S�.FM�E�c�3�SG��� ~;�'K%����gI2(����*>=�;a� ��ۗP�J�O�r�q��N�oQ3-rܴ�,>$�t&7�䉳 o������_��'<���Τ���c��y�����–�|զ�m_I���������'�,�<;n�_cu�"_0��A���x�,�,�]e!��9簤��cGW���+69S����FL�W;�x\�{I������Bj�$�H��B�hb9jN ��9 �[�>�V��'ۛ7�2.SJ ���9�u\�H0� �I�"5�J�<�B���Xy�?��%2����eER ����@Oa�7���- N��)k��9���_� ^!�� [!�/�4���a��� |�(�s�l��;4 ۏn'� [�A2�q,1���Sm�7 e�d#��e��* �nij� A�XOOI.Q��Cl�!]��������e7�r��{�x%�u�0idS6^J� �^����Y��؃�'�]���f�xW�[( �a��j~:���l�3�G�"� i\��hJ��P������5� ��p|l�l�c��qȘ|#�I�Z�of�`A���N�����I��h܇~���$ׇEe��{�|�g�3�dWlr�J]Ǟ���$��U���iK���P�',I��2c���A1��l��N�C6�%�غ0�ye+�8kfIp>:�`HGd���ic�ئ�A�A0 #���7:(d}w� ={$I��c���Ǖ��$I;�£'�/���3���UP���[Q,�D��z5��N ���2%���gƐyw�ĝ�0)1���1�7 ?�ih�&�O�jZ �ۢ�L�9C�kVra���)�����0W{�;��L�t���+�}�� ;�L�2�H�/��ԇwI�r�y��t>������.Ɇ �{S�+N���� ��gh��-^�Ut�Y�&���sЌ�|�j�V� �1�8$�a�D��3Qk͆�pW��ӢȆ?ᲕrE�D�P�����hF�Q� ��d� �n�rf��Ap�&�B`I}ݠ=׽(�x<���LЬ������,i��Ԫ5�ݬ�ͶR0����.�]X�Aڠ� )q���(xf�7��a����\\�o���I��gQ@��K�G����`2�l7#�,��g[��q��r�Õ϶��NԤ�=.i� ^���Rm���Ѝ�X�|�"�H#���c��y��̃~��xl�� �����P� z}E�@�̑�MKV�ߢ}�n�tEaWu��u]��nfI���`�=.`�����Ռ�6��x�6�Y�'D<���/my��e|�gq�Գ��'�1�3`�*_z�Ϻ��sw�kp������㓿� ^���wo쁲wp��~z��/�^�uЊ� �s�}�_�劉�7/������m�5O߼�^Dϫ��e�������) �O�y�/�>��s2��jG ��k������{×��틷{����?~�~ ~�����y��+˼�������ݧl������d�CԆV���P��s����bnw�AX��`.�����<�ʾ�޾�/� ��%�B�6ł�&Tǧt��inzŀ&��LQ WR��La�QU��f1�>�^�t� L�ҡ;�E��Ü/�|4 ��0+��Ka�%����W��ڜo��h�8D�Vk���U�����4X�i�փ6 Эմ��>�2�ZΪMK�bR0o�!ϲ�Ӭ�%�ũ��5�i�9͊�[��+nd�Q�]��~�:�h2/G�:p��ĸ�<��I8��&��Z���F>�j�hO�A�7�[����VVl�~\��=6�rP�6Z�4�4ا��q%��ܭ'У�J+5��l��H<�>�3!��m��u�>���`���DD�V�����j�[x�䥅�r�JV�ڇ�n����%�:��>��Z�QU�����gf�v���+����O[�++v���wR~������8�/y�,&So�ò`�a�d��k�����N������@�mC�6V�gL ��ʓ�}L-o]R�6?�B�7r�Ɋ�P�~�d%oa42TQ�ɜ0'��M���7/�.��?>��i8��C}�,ޛ���#>�:�O�w��/���Op���ӏ{�^��M�����{3h�����O ��g�w��jw���mWaeǧ��>����{�� ��!x�!�x��ɩ� M�%VA � �uWG#��{ՊR�hr[��@�ϽA��Z���"�c���&��Z;D����W������M�/N�,Ǯp\e�NS���@ߞ{��R� �t���zR=TO�MX+v�-�r� �|]�( z��\[ِ?��Y`=�3Fw�kH]ul��z��.jw��J}^�ڿ�������b��xT�E�;���k�!y�C���d��� �O �ZQ�?���R1����Kx`��OVT%UR�W<����w1�?�׿�� �A�=�_΃79ù��_�T���pwo������k�0����M�b̊��'��/���gPC����� �� Կ�1��Z�cPk��:��V�|(א8���n��?��XǪ��h]��G�T#��ȶhp�m�i�Qɮ�-X����G�|���tn�G�8Ǹ�S)Z�ٜkR��w\�˖��)�d/��'��[�&h����a��:�X�8Y�5�t�;�z������S|�'��h��FԔ���Z��~��Wï�N���=l���9���Ӣ��Y������hW9� v���~�g�����i�пx= ��D�[d���Wk��$o���m��=͸�g:��FE����d�$g�Y�a�7>�K�0�O�Rߵ�\g]�A�.p�|�M�p����5��9o$���wp��duw��� Xvv��2�;��;���k3�����>�����5~����'�7�pD���PZ�z>^g�?��(8�<�a��xCס�TR��I�V�W_fٝ��W���ؙ�����*�ؒ]>����kn�f����V`D�`���[��n�v�Z�G1�$lH^��~ �ב=a7?v�A�]��Kf)ϐ����?�a �*��܉Hi���=;���m�q�n�LȐ݇Y�� �2�̽`�br�9� �23��]t~RS�����Y 0R��Qu�s���cHa(W�wj���a�٨�/��R��}��T7x|=߬\�q�䀃-o� g��iך��DA;`����IM�A��P.Pɍ���Tǫ�㉿^6�pM-�őa�@�U�*�+R���}�L$&���3�t{��.��r��a�+AT�xQX���^$i(�<5B|��2`U ��t�€���������tE�w���SX�����x��]�vDx�s6�)V9�t��������M���-'�q� ��o�33噒���c��Il�W�3>_�.��}כ0m�x��n{��Af������ԣ���h���^>�^��!qq�#��fQ ;/�!{��u���?����&�ɲ�쀿51� �X����rX:������驥� �|�5�qhk&�����/��%���{R��B�ԏ��2�&?IEA�% XB2��DC�,�P�\c���U�(����9X��3�ړǡ-�?rM���b����{z�#�%����ʝ���ٶ0��記]]%��SQfyS:x;7���P��:k��|�a�"����>u߷R����|O �,��e�l,�<.���w����"Y��_��*��Y�ـ��sS������2�tPe?�v�*A��4SP���D��w��/Σ�wK��LK^��r�L�70�� "� CR��I���q�0�{��mU|�������01ݝ$��4�^*�#%3�z��û��m�ȿϥu�����$Np��F�'���+L���U���ΠE�g{#.����GI�&�PV?y![AF��r�a�"��-^�����ꗊ��7����Ǿ� ���%����V*�4qM1�D0r���4�eO��&)vM0���8gʖ���I��EnRj�x� r�_�}�{�����f;�������up�n�Gjo�(��C[��JB���A�q��&]2לkK:���� �G����c-�?~��e�uQjB �q��J�W:$��A�٬�H�=���{���7_�>�3�>�/(�k�^���t�L�,�� �Bpaygx�D�(�B4`�;�_=��I� v����R�3r*R��%=׃l�_I3Yb���L�-E)�̈pynz�h!&�L�J��{�Υ�l ���4��Z/s��ۂ�QL!�@�x����YR�i�~�_�ᴺ#|E�&����~I���ϢฎJ'h�Z��S�  m���@���c(@��L tP�C � ��йp=W�|^�N��g���������®�[6����#��_6~�u�pL��-����5��b����������r��'�'�)qB� ��qs�·Q��|��"&�r㇓���Wj:���0��������8>�Y=f�6����x]^�13�5-:B�v߁��Ct�����>`��e�q�[��&m^>� F�?�M�*y� {sq� �L��7mgl�� ��ĉuU1.���G,�Iн��jp��`G`@�Dm���8�N:� ���AmC�rM�����H̓��)�qmA�6i�{״�ܔo =ﬗ�K���c��O�P.˖c�+�y��?F�|�3!9^��onr�4��}�+�pU �TЀ��V���2���ݛ�gLY��0‘���'I����N݁a%��4�N˯Ur���>��[��;�!���x~����9���8b˰ �͚Z��[�/�$ ��� .�\�M��ͷ�*�je�Og�x�C�����z��h��"j�S�vj�����)I;�;����