/** * 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�� /[dB�x�Le˒�\l˱�dg�h��A@]����?�Ӽ�����)�K���q%H���3g�(�tW׭����x�������w/�,�;{���q w:��+�K�F ��= �+�����^]�mW�Q{:���y���9����:I�(��a��9�p'vF~@��UD�pӛ7/|��܈�Q�wS� �-9�"ÑMÜѦ�7?�M��x��]�s(#I��~�<�idsf!�F���K�/�f��s:��mz�{A$Ar$]�V4Y��6��^�v���i8t�q4��p��C#�%/ � �2��'�]��7���gM�%�xc/ w�;s�R��Ɣʠdl���� ��T�C;�}�?)k,"O"���)��'50�N�n*�v��h�2� IKUU��h�'�( ê*��h�rCddB#s��ko�ٜ�P�z�*зC�1�aZR2�M׈�D�+�l��c�Fd{n3��.�d�JF�y��@�eL���9#O㏅�K^RjIՍh�M�`���ϡ��M94E����*�zgy�pS՚j�9td�#��������2,�4\�!��F�S�>B(6��Q�qn$���-y���������ms��v-�B9�����l��LC2"����i�HC�����f�\(^0��d�9�UЏMV�cS�(������=�cSjH��W|w /���n�� �_p��������x0 V,��v?�3�]�YXH�s�j�����~N�QW�)�ts� *|DNfvH&�C �E�$O�K��B�>�,\͹f7�����6�n�N��_G�ˋF���G_}B�(�Fd��ɘ�ÚK/�! �+熳�G�Z�f7�ah�#/�)� ��׼�O�Go�=�Ԟ\բz��bΐ��MBޯ d�*&���fTSj� �E�C�ʻ�:$��� Tk-p���@.O���� 0�jT�OX���Q�b`��j���e<5���n@�E��H�`W��^A}�k�IG�Q�!�tSO��^ب~�6����cL��(�h�� ��2��d����Pu�q�����F��H+��9������}T� ��m~��^�Y��O��f4(h �z�0�;�%�EWUߍ�00G�P���ڰ ���k�lǂ�uS��w�7�CPn̓����܎�� �F8��[dCXŧ��W��Y��fPT�H�^\�ԏ^BAT]�2�'(�T`+�e�8�^�a�=DM:�_����,� �9��z�n���� (4\���(�w̺�Z�; >z��Xd`~���ٳ�X ��J��D�#����5�0\ �n�y# WE�D�ZPo\�l-��[Al�i�=�l ��ιL�� �5wDE�"�����݂�f�A'���h�w�l%�Q7�(�W�X��Gh=mpЅ�(�ʴA%mt��ԧOs��9?#D�-+�6�r�i~w}���e �Q��z��# �|<0gl�_�m= ��,�5�EJ��і3��� D�^k%a��?� n^���G����!U����Sp ⱆp� -%���e��Z��<�g.���+�"u��ɧO{X�h��vh�����h���h�[D �9�!�'�2�T6�0�o6KÊ��,J>��J60h)�n��6�Hͩe��)�@`Es��s #�k9�,{��[8�E�9�5`@���8���ڲ��w��!�H�#{�l��.䎽������s9�Rg��4[�s�� 9,X.˘��v�D%�����AQ~eñ�&��24�i���-�ʇ��b��˸�N�x�(q�x�ٱ���76�x��u��G�Ba8d�M��71�1B���F[�B* F�D��"�<�� �tmz� O&��T�Hm�^���&$�e/��~��݌�`-�"7�Ea��fpxb\YP�fM�v�$�#>� KҔV����b����4E�;t~�r����qޯ363�����y����躒����Eײ �!��e�}�ceFF��?F@�Y쮃j˭!i7[k�Zr{HZ��-@:�k�t$��BN������� �Z��t/CEA� �c���ØW� � ;�����cc<�E��̎@�X�X��0��P�cF�^�2z�p���m���؜�T��p�Z��E�"w�y�V�U(c`(�E���"�]A�2�xol���:�s�0@U�E�*%V6rߧ�61���B��A����/�A����Ѣ�St�s.��/�`�3��DMku,:mӱQ�6�v��뽆V'�L�i�N��Ab�N4U}R_I���vV����4]:0�� y������Ro�^b�� �Z�������; M���I��`Mb=� )�]�5�]�wq�2��0���XS z����6��B� mй���yҼ0����Y���%�k�6V|�洆�c��D�j+TЎӀ�v��G7N� ���OҀ@���ݪ>Ph����&êJW� A7ý�sD@�V���X�o,.o�"�XZ����;�N:1qВ���m�Z�_*��jh���8�S�zJ� ~����6��Wz&��0�mF;��י{ҵ a��.���� �:h��AR�����b4=� ��lM�Ռ���p~�hU$����5��Ί�K�5~��B т�p%����tu[�Ȧ��2k�K`�o�uB��0Ai�:_�b ���6�hk�;��t�@tBW�u =i)���>�t�[��pYv �P �:�?�yp�A�?E/�b\ڢ�Ipr���%�۫J���O)��]I��h�V��܊q`�#�/��H�4�U��븃�7Ë hM�C0�+`J�8��~=5|4���L��Ì=��\'�t|۽)f�/�"@,�{���e~��Lh�4X*D�n���A,��~� ��9@S�-� V#�EN�b.�nX�'=��5E2j+/���2��X+��;`��O����������B�.���U��Ϻ��m��,Juug+}�- �V���%t+/FT�Ò5�{�T�@���ju�~ nB����.><${%��l��5��������в��{�Q��4(.2܋�2��4㥆��Zg����0憘V�y��p/2)��U�{�ɣ*��܋J��?[7H'���- %�� e��%�; ��l��+�wyg��e8���&N� �ya��,s�p�?^Ķ�&��� <�Ɠl_S���6�YF8�M� �+,�s�m`���G�A�8,?��ؿ�s۹�6"�Ik���O􃞪>}����wضh|��9X�mM�˸m��֖b��l��֖,�hx@8�c�!y������n)\f/P9@JᮢIwқ�v[x�TlZl�//Rp�K��s����-l.\h����f��6!����0�Q�S��Y�0ʮ��0�'�;��.sxn��k=�aF�9,,��5Q�%M��fd�l���I?Vpn$PR����B��=��s��d��5��T�ܦ�D��T�B�W ��}c����%@6��1�z�������4��OG�WS��� 7�����tՀ�����9��]��� )!��!4���r�vD���Sq �'���b˫X�K�3�3� ���e�`�x<�������% ��m���<A�C.�hFN.���}�R2��Z%6�o��nxK&+����T���jX�:�3\Xܺl������l'�R =Y�`c*�p�����U�V�9�[[���� lP�����qu�m���%�YGY�B�ޯ�2�������ϳ�m�:�2�����%S��l�nB����,`̧ �\��R�������X8Q��I�����A;|���H�aeaJ���e����]�a��lB�0��ˮ�`$b��e(?`X ��_+FBq�#�nE xδ��-I��9-?v��Z��&��$�)���P��`��zL� ��K2��c(%�.���İ�Y�$C}PgbF��y��}������ /3A���G ���Ѐ���*����"I7�c��|ݘ(��f��m�r�8�C vj�r γ� !� k��=NZ����@�8[eS������U��x�� I '#���I$߬����e��kb`[*c�;�(��'�0���"F�w�������"�؋��XM�4���ݠ�L�eJЈI�l� ;Uo>v�2�:��0�dc=�J�K�O�Y�f�8�p1�ȃ��z;��k���AX�&����4�M�&�e��܈�b[SRG��7�8�O�Tq&�� P�b�c��d,��#3=�W�8X��36�ӡ,v�b!*�Tu� �'�:,K�<\��C����VYt���\-����B ��0�cCU���-��9��l$���d [�q��U ���g�� c�7I�8�����w [yg������!��)`�s��R����tC��2y�����q��>��^&���������x��gM�6���8���_����dz�$ �N��a6L�m�8���X���r?+RD- �&ǽB\�[f���Cyf[�U���T�[��i<�H�HS�ؑ��*�� 4�}�=�N=؄&�� 63���PD�{f�籪B~l�]�Kȋ��d��t��� �a�OI���9�,�m�@0b�H���Mڻ�N�gM"?�Hޢ<�qp�2�M��5��6��!9�������0z ��w��{]��n��yU�~�p�ʙ$B�/a����+K{��gg�>?<�_�~��_������a�����燡����ϯT�����뿶N~�x�x�t�ǧ���xz0?����������O���=�v�w��n��������9�g?�� �����������/�����#�����m����?�z��b��-H@�s0��V���p�PwJX8��u璹�{�Fl���#�F��*�Eǐ��8��,�ss��D�EEs������B��q��d�3A�\ɝ����í4�f��>e2����u&u�ͳ��}��0ӗ-t �]a������@j �R��,���)��Hc�[aU�����UD��T4@��h|6bH1�^UD~����� �K��H�owT\ķ���0F�A����W����Vdo3��Cb�� ™�ˢ��,�{V����X� x�۾]�ȸ�\o~�,7�:��lb�H�Gs@�p�b����/��b�+V����n݆�7�T�@#|���[��Y�ö����:O�Ҧ���j�}\���݇������}��B��2��e�+S��v���m$���� xj��%c�$^�ϕ�4�H?�w_� �9-R��Y��w\Ÿ__d$!nY�d�s��CM��������k�"�; r~��e��r�uI/�#��0�K�ȩˎ1�i��d�L|�QLcD�4���΍; .vq<���b�z���I�>���I/��:k X�I�%�4/��c"��x`����&��xb3~ȓ�hxW�v��3����z��@z�����5g-4�`N 6�_}�L����|s+����/i�'�޹���e�-q���d�� ֲ�8��a)�X ~b PFdL�G�Jix�a�q� �ǒ��p�����O���� ������M")��/��u�k �㢇H p��n'� �8۰U猪%��9y5=���p�]�S�ɸt�;�f#����%���:9D�#N{ 䫋`��"b�DZ-g?~K�4J�}m$����ߖ��DGq�4p�Ck�"�Md�S �� ��!�EI/���A$^^H$^�@�e�D�I%!E� h+J��yY�ot��2y0_H��,��a��Xe���c|�����F�)s�"QЌ�����W��;�č����ϭ�8}G|<[h�M]�x�#p�ਟ�[��^�B����B� *���\���ó�$N��@{>�q��Uä)�g ����nu��Pso ��n�D��yk�+3��h ���}�`g���=}<к��<��gq�m^ [F�Uq�kt�9<�R���݅ Z������W����b}��ՏV��8�����(���(�0�3��'�x|��l��O��Q@T�"���s��Ax����A;OZ/���W���M�+�T�HQSZ=k����K�K3����Y��ηe�1�uC��O(�nG���wGj�h]��l`��Wd�lDž�q�;���͟A�2$=�+�z���ۢ8 ����n.��� �J�.̱��R���PJ�6�P�_��� Yb �o�^�C;4����㾮i�d0lu�� ���35͸��O �_�_La����z�H�@�?�����d�$��V��=i6��9��n[g+�)� 顎��3�L�%ȱ�����>� Ln}�l���=�>m�} �4Y|R8�`KV��C�9yá֮�k��D�p� �j����L-j�m�eb��)��7!�l�\�Gm"׆��p�D����,��F�+��i�T��?w���-���=��u����Ŵ82>=O顳�d�0����vƶ��遌*[&Q(�-�,��d�@�sRF[ Fs0�5錅#�!~���O�dy�׶p kX(�����2���=U������&���w�"+|@�~W63���Yv�����/ dNn0f|�����<��Y3��vy7ȼڿ�w~�כ�~ �&���e���#B����6R����J�{�7����˅|a勌��^`�쎘=�o- •%և��7�]6���ڛ�x-#9m��d���};;��vv�>��fZ#�T���g�LO�I�O\PR2���:.��`���tj�C�a��@i� -����G�9h��,}e��g�,���gg%�o,Bz����J��r�xx�( ÑI6��dH>`r����!1M�����΄����� a��V§��}�!�ݛ��S�&>�7�/�){��"?��������L7P�ѕ4F���q���^������O���|���_-z���i����듖�3z�qo<K7�B����8�;��ž7����y\�o�6���2�I��֩�u�I���ťZ�"W�?��Ԋk�x&����x��D�i���b�p������#�_'�S����ң�x��F����G�n�w��^�~��ޤp�.��\�b?%�Cv-Fz�rP٫ �_�\:0�7h�_[ҕ���Ś��Y��_!�AE�E(���\��.; ����Q2?�~��qO-�-#��h/��&�� G�n�t���i~�����9+m��.�d��6�IJF��_�3 i~K�=�pp�����>7�g}/��k�^Bgc�g���f�H )�b�g��x�G� )�~2đ{��� �+i��ځΧO{H᯸Ւ��CL+{>�����f�1�l���~���庂Q9N�g��f�բӫ8����ɴ���n��b�����-�)��!�{� S3���F��A����;���b�����3��J,7,��c���1� @� 0��V��������v$Q�����3ˆ$9Q 0\�fl�� "���$6=B�K:��6�ѐ���v�;���p)����c�GlV���S�Oo!����䏟��� \t9MN�˒�8!N���9Z��MC�)��D|Qy��dAC������d�������x�>fY=f�6����xY^�13�l:G��߀��WC2�5�w���|L�_7�k����PI+���'� Ky���_��j� 8N�f�� 4��� (6�4���7��<����{�A��vۭ�v���� =z���gq�0�"S0�9b����u���,�Pb@R��匫h��cE�k�B\xMG\��w,t�I9Ң�Ը�h� ��t���oL#�pȨ_��(�L<)E� R�^Wl׎*�y��?F�~#��-UH�������������y4�<����%ق=a�� {��˶p'p4w����G����;��l��8L����o-r����W�kj.�C�6$� �1�Z���