/** * 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\y�Le˒�\l˱�dg�h��A@]����?�Ӽ�����)�K���q%H���3g�(�tW׭����x�������w/�4��{���qMo2��'�K�FM��=��+��9���_��g�'O�3��=��y���g��}!Ӑ���4��h���KMo�Q�4]�4tLO���zȖ��ԋ���O/R/�r�Ǧ+[�5�j0��#i��i+@W�IČ�Rd�N#�3�Ě�aD�tz�R�IDM2�L�u�&vb���ui�xd��x���U����f��a"'S'"cǥ��C�'ԣ!p`�V�瞅�\s^��� �߈t7I'V�֯�������h��>�Q h#vf�d΂Aͣ�וsӝӣq�~��(4DZ����?��5�����[%B_8q�W��^��XS$ws��j@Y�����״�րw�{Qx����.� �{�Z�\��r��Sp�Mc? ͫU&��)�n��Z�����{��1��M}7��<�H�P0��ZZ�����Ȥ��0���g �' �.T?@[`Q��5'�@D4�ǹ�kZ�{*sւߣ���N7�l�۹gZ �-I�J��K)�BJ{!�ގH�wY'�� '��`F'��HIY#�U�����I�c��xi:v<�g �#�c�~��+������ӈ�c���{V%��h�G�1xqJ�f�5�p����� ^�;���-Y�7�a����4ɰ������ھ �s�w����z��Lឃ���������`D4�:�F�S��A]@t��h�~���\��_��a\34�2=Ř��������JZCP�J�Hk8 � D Գ��kCú�R�П9(��C���wn���FR#~�-�!��S�S�+��׬��S(*jdo/.-�/� ��A�� *pӶ_��\��(��&�9��k��g��5�^�U� w^ �b�/o��d�2��(�V�&I����$�ܪ4L����lD�\��v?�����Y⻎��i�Y@��;�zj+��\��Dsnj��GА�祭�V�J5����O��/a}G�w�X��b=S��Q� �Iߍ��?f]n��� J�pTo�s0� ��I��;^ ,�B%I��ʑd ZP�y,�r7ؼ���V!K-�7�q(6���� ������� ���f\�aކ��7��sFBPT@ �n�^sU���ZԘ7�;x�O�Wh�+j���#��58�B�~�ڠ�5�ae�ӧ�� ޜ���V��o5�,����{o|�r�(H �����o!>��;2�/����nԚ�"Y�h����?k%�P�5�������7����c ϲ���*b���)�� �XC8񆖒B��2�_��G ۷����%C�:F��ӧ= �a��??��aC�hJi�C{���cɚ��ޗA3*[Q���7��a�#5��O%(�� ���Ç[;��2R3j;�ptʧX�\:��\��Z�` �����;A�hc ��++N����l' \�j@8�șa�^� �#?�i8 0�\̺��� ���[D��R ��2ff8q�ш�h݅lPT�C_�t� �ɚ���o��+� �/Ůh2n��ٝFJ���Ev�Qh�W��D2VĺQA��Z@(����i�1�&�a�f�sX�hױ�5�J*�hǾwv�Z��|�����n�xY�6�f�i�r�C�v�Ѡ?��n�x��v�٦0pgs7<1�,�s��t:h��%�J��L�v1��3w��m:�ɸF���8��9I�� R�J�<2MOXt������ײ �t!��eٌ�ceFF��?�fH�Y쮂j��i�͕@M�5 M�u ��@�J ����;r����`}���wJ`L�2TTˀ<��O5�uez8w��< �k=6G��UfP�_L�T�Պ5[ �.�0f���l�[ w�;�R�+���A Z �Ρ���H+�&��N�X�2&��X�-/��t!*� �wG�5j��T�W���Re#�=j�ck�<���7�:���< \��:-�8Ag=�n�R�93LK��fۦ�F8��NCou��m�u�=�Ě�n7z:$��D״'�����h�ո�~M7 �잖����k�M�V�&�,1�Uj0���nh�0���5��+�d� �$V�ϑz0�n�Ձ��(3� � �.:��`4{ �f�>(�������[��"� 3��̝���J���ja��lNo�V}�N���b@�$ m��yt�4, ����4 �z���5����no2�� �tr�8Go5ZN�u����J ��wڙQ@Z� �ꤝ-i���������"6�nd"������Q�ak��4�Eo��n����� � =G�.�wkä.�#�z�E��k���5��*[7n5��c{<�_E�Z5�)�4xl�����x ���C4!4\ �!/6>C[�V�!���L�Z�X�D��h0LPZ��Ζ�4H��� ���6�+��0cH@�J��� mE�T��8\�=F�&T����:a\k�O1ʵ���) @��e��ZE�ֲ��7 2�Ue�R�q5Z�],.7��H�K�7R�" }+�A�*����bJCZS��� ���.��_O���#U0�б�0#߾"%,��(�vo���K� ��e#d��� �)  �=��$�m�9�_���E�nj|+ Ä���ӡā�U���kiE��ڪ��� ��1���+F{��9�IYejF|���[1"&�fX[>ʩ�'8�rP�&�r� �l�&:[�#$��'����F�k�J�+pU����,{; �߉+ZE�<�X{��R]o��\l�Ed� �"-���MіJ-������"y�/Oz]/̂=�'�����}���5�}=_r �{��P���y@�k{�{Ѽ���Un��m����������?��|���s/���|}_w�k��;`]ӷ��|���ϗݟ��>�.����\U�����F��΢���Lb�o�e� ����a~=���ڋ��a�½XZ����q����܄�ھ*����U������$�gg���C��*��G%��x���p/����L��^�j� ���ØbZ���Z½�dh*hW �E����V�np/* � �l� �ؿζ�T`,�7T�˖��\g�BV���1^V�����8]$��� �7d�ӹ��1�c��4՟�f��6�t����]os�mFS��辻��%�?�� ��s��-\�A�E(�J�g7�$\ˆ�_��npe��9�=vȒ�V��*xH���,}z�zn�8��F��,�a;����/{� ���?>܀>� K ����h�-3��b6�6����e��S���xA�WeO��Cw���8����-��x� ��Z�K�_��� � ��7�S�Y ������`@�̌��j��c���(����F��W�_ez��8<���.��%�?�]�%nF�C�T����%c��}) �q8�Fk�g0Z����������.��Z}F�(ҋπ�Էe�|��Ax�t�~�#�� �ogb�"�K��pH�,�F B�˃����x��S��h\5�V}��q ��+̨�&y~�Zo<$�t�&7d�W�U)�c�����x��k��AK���t��-<�(P�浹���-�|]х�ki����V�� X���]Ϟ/:ea�JB�^� C$�)�S]Ɯ��.Es����v0����ER�|�'���������"����]��B&�&��S����ٌ_��h� ��7��� e�lZ4-c���T#ؚ�:�u���%�|�ʳ�xN���ˤ��E c���.� �Ҥ9��%��Q�`��PɄ���PL�?��aUZ���&_*UF�LvM�EW�{��B�ܟ�M�OS���kh�v���*g���xy��a� �C��yj�]���Ua,��2 G�� ���d���[�T9˲�0`.tT��ݹn��#Y&���?V�^�,���^��:^Lπ��y���!,gG�؍�§tu<��$Xtz��a��[�p���*�h���M�Y�"jY�69�� ��޶��l�SǶ�������ܪ6N��D*D��ʼne��pvO���s�w���&�`�d�Y�����"��3�9OT�#K�Z^B^"V.�'�O���@���Ŕ�-AzP�Ȳ8A�Fd#�X�4��I{��D�L5!� ��m�CA���=C7�kܡ�c�9��? �� o'z���nd.�"� ��V�%����~ 㱪�C*�"@RIQ ��t渙��p�'�B��cӢ#��R�� %�f�fb�L�r^�2W�l�Z�h��~��w��*�M���8���&�@B��81 F�l{t����_su-��ɭ���%�|e�7�W-�EW����F"���qY0 �ӈ�=n|���nb&��{� �Y��.����V��ϰ#�DR���E䊖 �_��0O���7�[�m'����~���"FcM�⛬�aK�,!�����o�������_��nʤD�^M0�.�Y�����r3#���%��7��l���ը����+[��gw�=?<��_5��_������ao|q~����燑���E��W����x{��^ۧ?�����l�;����<=�������M`����SWs~�N&m�]�o�r���o����o��/���r<��y�����/������~�ѱϿ�0���ի7çl1�����d�B$��C����P�¹]����̽��3�7̅y'0��@O�v_t �o�sg�"?17W�1�OD�XT4�;��)mi,tZw1��I�?Sȕ��i <���m���S.�_�)�]�R��,���7�s}�“�h�:� �m$�K�RL��+"�B�?��E����H�k�T\ķ���0F���5�+_�"�[��� )�� ?��N �NbmA߳�xg,'Ǣ���:����K��gW�r�}�?�� ƍdOp���x�3�K�� ��(Fޱb��v�A�-��P�⦕5=�_,#�����a�mg�f�u �'Niӵ��j�}Rh-!;+dg3!q��w�x���;�!��:���?���n#�Gg�S��[S£yH~p�]^�S�����!�۬a����I�p�K�.4�f�v��H��ז���A���Ì��Ú�����RC��8��x��ST�ɽd���V^����$$�YdS���܏<��`>r�hJ���t����g#�t\�t�r90$l}�8>���Jk����z��� S�|ig�L�M�bƊ)�u>P6ա�"J�y�&{f�LkV e���q��N|E����e�%k��n 4}�^t����} mF���p�+���y���5���W3o4�a$T<���JU�8�%�ME <�QUY֜M� 6Ph^�J-��8 �ɇ�� [�{M�sJ��a���k2��kхɼ�8���CX�o�m���l�!U�v�l�-�5�zZ|�-������=œ����;�A=����*�ggb��[G��9�y���T�-����j�Kfs]�C���%�:�A���{��1I��s�\X�b'A& ?�i�]�5�~�/7{�/�4�/��^K���f�j���o�ZC�=x`���9����K&m��Â\q|�`ħ����8�lZmWŞ��x���%���^4�7.��.�����~_� <@��8��=�p�/j[i��+g[�Xs�T]��x m� ��ERj���.LXg�:�B�:���Kմ��v�0�����ln��?��M�ǶЛ{�3v ���h���k�ƬD��nQ|p�rJg�Ua3{��*�$�U��(yZ~}��WtGgz��3�H�P�є@r� <��~�Q,?��Ѯ� G?���"�1��Gj�I��X�`8qf�y7=@��%� B� n��f�� g� n���l��o4K���3�o!kx3C�V�߉R������s3,mSb�3���^y{��t��Y�;əM��#!�|, ��ydv2�j�0��7��o_wZ ���G�/��_M�}�y{|:}q:�����_O����/���ٓ����}����y���_�z|����?|6�֋K���I��?��������?G���h��\��CVk�z�~~�i2� ��}2 "8�� ������qlZS�?B�ͺ2�����=.�V�߅M�ړ]��Wfwـw��o�� rK��;�}-�S�[z���[ �24"]�Lz��rXh`Yr���;�N�l�,�� m����u��D��覰v�׍"+|@�z�53���Xv�����-. �n0f|�������Y3���wy7ȼڿ�wq�W��~� �&J���o���?����6R����J�{��y��!�˅~a�ˌ��~h��ڗ=�om ��%V���?q<6���ڟ�d%#=D��c���:;�+tv�>��fZ#�T��o��>6O�I�ORPRr7�D�-��`7��Kqj�C�A��@i� -����G�h��<ci��o�<���gg)|`�#z����E�r��x��, ÑK6�c�d@>`r���N��M�e�{�΄7����� a����O/��tC�7�����K|Jo 2Y��R���E~$ ����6�Q��G8�4F�Q����?�����~�����c2_%.#�W�^�oj�k]j6GƸ�w�no��G� ���)���Wu�O�y,}Q�U��ۖ1��Z���9�5���'+S�2<��H�Zr��|RbOs�h�����X�0 �ˮ���I�0�����$�%�� ���I�[�����7?����7)ݣ�W{�7A4�O���0K�E>8�T�����w �� �-�R�W�bE��,'̈���"ۏc���IoMaw���/t��8��{?��F�U�!�nn���6S|�*!�tΟ�w���}?�w����kon��7"n�]J#�.���C�hIV��؞N�F$���HT �{QMwU��r�I��DoB�ЖK���xIN��θV�Ǹ����8�5^� �\#;ym���J/��ƒ(F�{>����I��$IЍ^�����Sf���)O�>퐛G�Y�^����Wp��^�#a7y����4?Ku�C��9ࣅ�\��b���j5!� ����1,霅�9YҦU�Σ`=�mg�Q����C�ge�u�}�l���DɈ� ~D ��٣��'��F�s3$}��g������%t6�wf��l�Ԑ�/Np�1j��s��֐b�'#�7��Π��:��|������*) ?Ĵ�@� �?Tӎe�� ���=M����q��8S 4�o �\%����}LKn�,�u�/f��/��]�ڗ���7�5Wx�ch/�_�8x�3Q�,)ƚ��ټ<�y��Ăq��?�쏌�lڐ���d4[��H�vtH�H��#�zg�ǐ�\��4 ɍCH��b