/** * 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�HQ޲d;�r,)�޶��$l@P�h���y:o��}�|ɩ�n�H�"%%3s�( tW׭�����t|rt��� 2�����>~��=�z����iԴ��~�\z����k�>�;�2��pw���f����]��JF!��QQ�V�]jz'�� �Q��1=��ǵi�X�S/��d�xQmZWb?6]�2���~�KTC��o�*�U�D1��Y�����&�FfѸ'���Tv%RK2T1�:�4v�V���J?��u<˝�H�K�����¡>��a���UC��� ������R��u�!�hب�G��g��V٫^_�!��H��$�XZ���ˋ{��$@�{F�8�P9v��d��NţSr ����N�ɠR��F4��i쇠6<� |ŗ<=y�F����`V���Ћ5Br77)��4�5�Z j��ZqE�5�M�E�?}��Y@j� ���V�r��s�u�0 �Y��C� �x7�A��X��^�[f��HK����Gz�Q�=0s�ui>�#�T�>}4�Y>� >�V;�l䞛�gZߞ�����ϥ )ͅz; ]��*N��ANR��V���ޗJ��"�z#0�Y��Z�F�$��t�xЫ<�G���|��+������ӈ����{V)�3����8��3� �12�0Վ�B28�.�n�"qK���� ���0Ȃ�!�$_O������eH��;�<�n��߫�*�=%Ag�݇H��b�ӓZ�F�DL��A]@t��h�~�B�\��^���^\1e A��b��c�{�UU���V���?�dGŀ[�p�z���qmhX7ej~�c'�V|e������H���G�"ea�eO�8�]�6�� �H��^\Y4�_BAT�L�� *pTӶ_\�\��(��"��9�Q�k�فg��5�^�U� w^ �b�/���d��1�`�_���I���T$��ܪ�K���ɸO�\��v?����g?�]Kk�j�Y@��;�jj+��\��ĉ��T���!!�K[-ɛk(�@��_?} ��N�,� �9��j�n)�� (4\����ʺ�J�; >���QU��`� ��Y��;^,�B%I��ʑdZ�|�-��ys~F��[V"k����9����=�A � )��Ƴ�#�B|<2]�oZ_�m=��,�5�EJ��і3���9�P�������?�ͫ���Y��Y�^�PU��>�0��oh))T,�U*|�!۾5A�_�� E�q�ϟ0���:3��xj��ߣ��q�ގ?�A$k#x_e��bEQ2��l��jy�|�@�l`PW�>��am��S�1{;�S>?��0��1�F ��r�loo���0֘�_Yqr���e;Q����H�#g�lzqr�~hӰC`���u�D#�]�-殈N�s9,X.�����:D#����AQ1�x�u��h�"4�a��-�*���b�Qȸ�N�pV(����W�u���67�d��uS�ǵBa8dLL��71�5#���F����1US���8��� �ҵ�~�y< ����Z7�����&����L���Wݜ�`-u�Ŧ0pg4<1�,�s���Zh���%�j�^OӺb��9]Ս&�d\�d��뜍$L�)c%o���,�^Kŝ���kE�pN�ڊbF�� #�(�o3��,���J�C��J����z�q ��@�J ����[��ݪ����٫�90�{* ��Ck�ƚ�N�h� C�Z��~ךgP�OGN *�jŚ-� L�*3µwm�]w�\:�R�+���A Z�N����H+򆜇��2��ʘJc���zW���L+���V����8 P��y�+%Q6r�Km}`���Z{u��N8t0 A��M���8Dg=�n�R�93LKT�zӦC9��JK�m�0ڲ^%�L��ͦ��Cb�JtM{R]Jz^����ӯ�t`�����5��ve���J��$��%�J F���������čX�$3m�&��~��Ѓ���F ��F�̴*��]t+*�������Z{�����5o#o���4�f8V�; '�� �����ٜ.�V�^�y `ŀ I0�hp�h%iX����i@��+�oU� ���w{�aUeh-������9" x��rj��7'W�P@,��̌�M�W%̈́8hI�[��6jO��k�X�u��D��C������]l���f�ҷ�-ހ�m0��]��'C���n��ڽ�aR�B=H����5�Y�n䚁^g�����ر=ί�!�V�����\R{i���Y�!�.����bK�ٴV]%` c, L �N~4&��FH��@� ��^�}E~��� �@�� � u���d@���*aq��x&��M�P�u�<�&�O5�k1)mS�$8��>�ZI�Ʋ��岲K)ø��.W� ly$�Ыr X��/�`�0H^����LG4�Չ��f��2p�U�zhh$0)���]������a�NG��ֽ���e"�����܂픆 �������v.����{��1�� �0a9�D�t(q�d�E�z2�ZZQ$���"8�����sL�i��ܨl�hRV����V��ɥV��r����c>�Y�|��l�&:[�#$��'�/��F�k�J�Kp�����--{; �߉+ZFa~��&��bKu�1��b�,"�m`i���n�v��R�<�)/R�����I��Y���!����۽�}���K�Cassj��;Hxmot/�w�Q���M<׽Msv���r�'u�����y��A|������| w�k��;`��O������\߇݅�]|ם�j#�uWS��W�Y��}ԝI,�M�,dsZ�;̯��]{1b;,YC�K�X�=.[]���PZ�W����e6v������v�e}h�RŽ�(�X�/2܋�"��4������Ze����0憘��y��p/2��U�{�)�*���܋J��?[7�&���- %����eK w@� ���3�!+W������pn�gM�.�S�������u��1�J��Og3�lO�}Mmu��f��ȱ|/�ﮰ�]��-g��8dQ��D"b60ǎ;�6c�I���iO����=}��w�wضh~u�1X�Ա���2nۻ����i�ۭ���( ��X�Cכ�~c�[ �� T��R��h���.c` ϕ�M�u\���E �c 7En����͉��c;ߜ��&D�BR�(}o(�0+� �liZY3y���U��K'�ث�L+v.�`a�_/��j"i�w4'{n�h.� HvF%�)�X�0B��w�:KLW�Xs�f*�6�! �J4��_��9��ƴN��K����)�������񰱏O'W�!D֧���y��|:�jB�s��{�^RܮJ�� ��������X�MQ���T\C�Il?���*����>ŜFcc�vY*�.�F#欦�-yq�;g�XN<#�O r�ԉG�l �f��ģd�[�Jl��֘��L��/r7�Y����au��|paI�r�0XK����(��:�XX0[�4���j�U�q�2)��[�2��ׂ�.֔x�m�;1�:ד5�lL�.�7c3c�[�� �*2�wkk��/���o��~�2��m>���3�(��k�� � n.�-v���,z[�����P���:D��ҭ�5H����� ��T�]���jC�{�l:0'n��q�_'e)��FP׉��,(�XAY��v�<���t� �'��C��������D""��� K!�k�H)n|�bխϙ�y#K��D�O@:0�K�#�g*x���%�r��|��_�qyk��&��4�V���D�Ī0�& �:� �3-1��s��u~)����#� h�%\���! �0���c�6�)����dɝ*��<�Zv� ���iP�4j8�� co�� ۉ���P~��]��������dXj0 ��UW�p���q�ڤ��W����O�j�k`�5��l�=V��O���o9�ċ^�K�����K�{���e���ש��a���[���+~86�����Qn&�*o� �Kī��<��o ��>n������ �!��F[mvɀ��^ �k ��DM��f�?���_��9�H����f]!�^��o+P�h�Lx8t��{�}��2�� 16QؽZ8��On��an���3�q�w�x��m��}רv"�����$��4�&J[���s��j^� �P�2��]Ⱦ�Z mm�����Oٝo���� �&D>� � ���󘳻�jK�\/0��%���)8;�F��0����vh�<��>�����q����I���6��OK]��GOC)Qt�5'�U�z#�ۄ:s�����Ͷ�3� ���TH��� ^�BC"&��PUAH�} ��+�D7��ԭL�!<�R�(�)�g@54�e��r}3e��P��A���dkl1?��Ca��=<�\���ɭ�t�c6K��n'r"��8��ؖʘn t�s�5 Z��B����e��:�����c03V��%�#*�ew%���Y�4bz-�v���[f����}(�+٨������� V�ssz{4�+߇��z;�߫�A�̃��M-?mCY>�MD�Xf�1�����p�%ixI>�r��9[�-'D��ˤ��E c��6 ��)r�K�`c<*�,����SQ������ò���eL� 4W�y�k�,�R�sg �ir[�fԡ?LEO�ަ�iO�=[���V���b [;I���J ���獭 �o�'A����c:&܁l�b+��2�`Y��̅�J�þ;� �?R��1y�����+|R��\�ɫ��W�����7�5�6������_�'�$ �N�1&��� w�t>V�%��w��B�S���A�"��A���b�\�&�r��~̈́�/�'oS :88͘�'�A^�����B�AOE� ��L�~ z�����\TE�׭�K!ta��cek;�TDEJ��2�����q3O+�dO���Q�E����D���TM����� S��W��լ��6� }����{ZM�;�/�$�q��S��)qb6�)t�v��8�WXsu-���E�����+�y���˖Ƣٸﳕ�o�}��D71���{��Y��.�+̕�\�_`�F�%��|�!�(%-r���!a�$%�o���>�W=�w�|S�E���7Y����F_��?~����?E�l����ܡ���2:}U��_>z��۷Wǻ�����{l^G���/�?�Ҽ�W��S��}�ӫɫ���^������9�^����Ͽ8w5�w6l��'�0�{���w/~u���?~�����/��O�/�?G��# �p��Ǿ����ߏg��L{O��T=W��|�Hh �,uǡ��s����B2���o$6� =�N�'���j���rߚ�ΐE~bn��c��B��h����S��X�0�b� ���(�+���0�p+�G�Y r�O� ~�@w�K���+b߬;��e�C@W�%⬦t�=������Em/ gh�C ��6�����I��X�OΣuDk�>�h�n#��|:Đ��b�[WD~E������sQtiw��m$�%�Qh�vM���ת���Vd{3�B�C�taDtk ��O��T_C�F�q��y�{�x�(7�:��|b�H�GmB�p�b�p]�_B1��;Vl��n<��EtJ\ܢ���G��e��7��u?l�mm�l�N���)m�v��A��O �%d�a�lm&$nm��o}?`r�ʬ�X��C���6�"����5%<���{��l�:��=h��&�oX� G��z�B]��o����J|�|:CW>���~��oX����c���Cj���ϻ}�jnr/*��`+ �Hvia��,����� �>�DJ0�N4"���,��M�}�t\�t���'� ƾ��R-�����LGx �sI�^���@��3J��Fz1cż݊��PaA�`;c:Ob\�`�n�qU�f|E����TMW�ڙ�u���h͎����7����&Ù�1= ��VV�ȗ�4�)kh��8D�ht�H����{M*�H�),IlZ�1�f�ʲֳ8F�l��Bkb�ejI~����pk��c�naK��yI����W�+6��L��ma�1/&�l�o� ��$L-+=�ƶC��z ���7({�v�a00�SR,�O� ��e���I�/d�s;d�dl^��� �zIv��5!� z�`��?�'5�� _�߅����|��'A����Ų�K!���^��Q�JMXr��n\΢����Y�Ll��K���g6�%�c�z �REYI�5�.`7�೼����D�i�|8v'L���Ď(��-W)��� W�F] ?O!D~���H�0�B;��ڨ�����f��_9=%�u|#)��ɃD!B� �≞i�893K@<��( ���$À4$,������1�~+H�'����sp�4w;�#ChQ<����P�{{�BJiy���4�_A�((m�3�U�����g��v2�0���>[oͩZ�x�W�w N����`0<6�\� �wm5�f *�|�>�r̞���g����ͳ�����/�������m��b�o~���Ͻ�������P;��k��A�j����ϛ/¯?��^/�OfA8�� ���kbƱi�x v֗�t� �y�ǥ[��軰�V{�%ɞ^v� �Gj�6�0ж��i��6nM�+�!�����t ����:M��~ �=u|%,4�,����f'G6l���N�O�G�����\?�]�q��@C��t���!���H ���Γ� ���������&�'�TTOaSV=+�ر]� ;+s��V��Qc.��H�/b�{�^�Q��)݉�s �N�<�[��~?�0hq��(ى ���S���-A��!m���ۆ��m4Dqw����\�oSo��S�o���c��&���J���qKL�m��|�Dք��1y�x���.��ԛ�X�Of)�L]7o!��ĝ������$�3��[��S�#������2�T�v���k,Ҙ��6��7ۧ���ِ��!;ϰ�0�Uƙ�`�9��������),m�ms3�]��7\�'�+�w��c��d�g��)�"o8��Ek�awW��`R�x�Z��S{�b5�)�ʡ? �l�\kl �D� ��t]��)u�0� Ks����7�dc{a?=5qGz{I{�٫Z�Lhqd|~.��Cg�� a2�s� |��=�����ze�D�d��Ȳ�2҉A^L"H9m1`��ע#�$N����S>���M�)�`�|�B 7O��`g��#��li�z��Ma�/�DV��r��df�)����\zfd,��$�;D�������"88��f�� �:���n�y������T~� �&J�k�oL��1����6R��d�t���&/q-m�_Y�yFXy?�yIv���6�?���CT�:�E?x� nq3��z^�~�^����]*�s��g4� I�2H���z����5)�K Jj�N���9���.�SvML�\c���(�����9x��S�F���0���6�C��jv���$�'��x��s+w��g0�ea8r�-�Q9;zH:�#&�������ʔZvFA�Lx#y�a�2��-m-|z��R����O��$�H-<.=��g���5e�:��d�J\�Xz2�����ܭ�x�`zR���J�;�L�.��h P��xO(I�:㏊��lI���J+�ng9aF��!H*�������Vvǂ��_/���/�y?�N������;Hn�(>O�`:����Sv��n���µ �p� wX.��� 'g��ܢL�*��v�94"y��D� �� �Q�Yj�$�e�!�f@[.-c��%yW�M��A� <�qk1_e}�k�$ �Bv���I��^퐛G�Y�^����Wp��^�#a7y���l��u���ȡv�O��H�5W��8f'=�\K��Y��� �tɺ�,iS��c���6&,������ݖ5�e�ϱEJ�_`� ^�K������v�[���������G���� @_ ���~�%z�ۻ�}\��:�$K�W'��� ��RG�����l����ORG��ϟ��_qm��OL���8���ZzY!ʆ�A��,oW��u#"��+���(ƻ ��$�O�`��wd�=��%���?����k$���yz��F72� /\� ����K/v!�]$�X31��W8'Б>�L��Tc_ f��_���lG2��F_k�tHt}ގ$�]��Br}a;Ѐ$7!B�xI�k '���GIl������7l�)K�A��S�x�}��Ƨ��1�Q�����[xD�1���gh�#]N�����8%N�S��9n�V�|#K8ݚ����"*_<�Mhğ~���<��&�x|:��7P�c��S� `�8����3c0_ۡcd�� �>dɄw���w���L����ܵ��R��M����� ��D��ס�\,�S��bKD�q�� ��=Q�W^K�R� �N��m����Z�Q/��H��y>�:�\i���$j��H� dN؎ڨw��཈Dޑ�$��\�\pu�9��z�"�.ą״���;��B��T -JK�Mc\������zc�1�Cf��B{i�c�i *��Jժ�xN��G:�cT�7Bj�ς�xAZ��ɍ�yU�.�^��֕؏��X�Q���n�� ��U�~ ���m���=�{)�7��hȎ�@g@�0�ƣ����'G�_%��zd [��'��j�K��E����6�Ͱ�@�ޮ�:����A���X���.� �l����!N�}�'C��l����?�b(�.�}�S�[�mE9��p�