/** * 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�xe*[�l�b[�%%;���@�� J������y����?�|�Tu7�)RRr��ő���uuu��������Sw��!����� Өi��gQ ���g���^ō�慙��Ʒ�٣�G�ȷ��Kdz�K��2�S��s�o����fD�BW� �>6>6"�R����k��G���~l��z[����F׸��,P^ �1�D�Ⴢ �}����P�T�_KО�X��������,wf#��K`� � G�� �������9�89.%��2� ���h4�,4Ț#{�� 3$��t/I'V�֯�p����u4 Я��(��T��)<�Ӡ_�&G���^���j����F�9��Ԧ�������O'�o�}���kq�~z�&H��&%Ԁ�FU D �S+�i�&û遽�ܓ�����CH�B��b��{\�� �i�8Cs^��x�:��uP�6��pP�O�I~(n�{!�g�Gb���ki�����"���C�馞)x�(8�tP�m�EI#�K}Q�Hgv�i��Ѩ�q6������4~w�.O��� `����GE����=7�rG��?}���Y ~[��:�ܳ�{n�i5|�$I+%�.� )�z; ]�cU �����6��T�C}(Ud EV�F`гZ%���"H3Ϧ#ǃ>��=�?"����r���X~@�>��;�� ڻgU�|��|<���;d�Z�HE�0��wTH�¥�i�$n�R]6!�!�Q�8$Ö��Kh+�!}�?f��������j��p�AI�Ga���l�� �����A�xPݤ����P3�>����i�L��F�@����X�^tU��X�Bk UA���i��b �B�O=�p�64��*5� ���rk>����|�v�}m$���o����O�� W �Y��'PT$go/�,�/� �N��� �8�i�/.@��NcQ�������5���3��z/ʪ�;�d1ח7HS����0r��z�q�3�/sF5�~�* =��$o6�0����询�y������z�hP��N���J>5�9%>q�75��#hH���VD+�J �����Oᗰ�c�;K��~m���[ �(~� פ�Fj쟰.�V�N���^8�˳��^>��}ǫ�BY�$ z@T9��A �����B(w���*j��º|�C�>�T7o��g���wlh��7�2 �6lռ�3:��"�b@w ���B�"y&w�l5�P��(�W�X��Gh=kpЅ(�ʵA5kt��ԧO �eޜ���V��o5�,����wo|�r�(H ���|�H��M��֗|[�j7 j�b��,f�����Q��EIXh����Ws���1�g�{�OU1vx��¥x�!�xCKI��`�V�#���:���d(RLj�|����5�Ǚ��Q;l�M(�w�cv�Y "Y�� (cJ+����f3*�x�ȣ�S*�d�������k��Ԕڎ9���)V�1��18�0���3X²����sEP$��Xc.|e����֖�D�k���#!��)V���{�;�C��}c�Ŭ+%�����l1'Et:-�`�*cj�c���h��]�E�8�UL�����8��ơ�����R슁F!�f;��Ya�ġ�[_��f8��$��"�MT7 �Y��11 6f��8,׌p.��:��`TME������QKז��a��h4����Ԧ��6�=nBJh��,���Op��3��=�F�) �� OL* �ܪ����w��:aI��l6Ӵ= 1� ���F�No2�Q��s��u�F&s�T��7�L�c]���~���C8�cmE1��X��Q�菙Rh{��ZJ�OZ��J����f�u ��@�J ����;�.��i���>�m�ӽ��'�5�S c�MgN4Q�!z���pس� �ˉ�J�Z�f+aӥJƌpݞmv��.� �VB ~�52�A����^�`Eޘ���]&V����4��ˋ�w@�ʴ�ݡm ۫�/��U�m$��D��}����Z�;�uv�tI�p�`.���:-�8Fg=�n�R�93LK��fۦc9�ZG�[]�0��^'�L������!�U'��=�/%]�pF;����k�a`����&ZO֛ڭ�+L9Xb^��`� �-k�0�-�H܈N2�k���H =ZWnu��m�1�L�œ#�E'���fO�g6����d}�}y��]�yi�S���p6]I��Z-�����n`��։��V ������7�N���A{��/M��ܽU}�&����M�U��u@�N�{爀�F˩�ߜ]�B D��N;3 Hk��_���%M�kۨ=���!bS�u#qw���kd�;�'z�Zo#�|�o�[���b�3�=��'C��������0����$E�j��,F7r�@o��֍[�h���WѐA��n�� ^[j/��4^��g �,�M �aȋ���VA�U]�l:�������Q'? �V+��e M��i��"���j{D �X������H[�: ,Wτѿ ��c�C�N��d"��F���6�H����W[�(�ZV��AF���R�0�F���ŕf�[�~�u9,�ЗQ�B$��J��/'4�5Չ�����2r�U�zlh$0����]������\��t|ۻ)g�/�2D,�{���~��,h�4\(D� nv�V&�sQ�Nߋ ��V@� ˑ%"�C1�gS/�֓��Ҋ"9�U��U��cZMKW��FesD���Č�ȅǷbDL.̰�|�S�O>p�fMt�b�� hMt �G:HZO _�+��ĕ�W�M��[Y�v<� V��By��&�R����s��2���e�EZh)���-�Z���!�E*0�6_���^�{Op"k�����k��z��>6�0��v/����F��yu����s��47�g�mm/wR��>>�/��^����������qw���o��;��;P��/�?��}�]h��wݹ�6�Yw5��|՝EY�Gݙ�R�t˂A6�����z`ݵ#ֱÊ5�{���u��Յ�1� ��}U~��!٫@_ec��I���n�_ՇV-U܋�J���@y��^d�-��,5<��*�Ņ�17Ĵ�ϳ��{���T�(�܋NU�d��^T$�ٺA6��m��X^o��-1�!/Xe;��p��\��;c��¹�_5q�H�O��o�"�3��c��l+i�?����m<��5�����0ی&��{�}w�%x� l9{�P!3��Շ��#s���k3��4Z���8�j���Z��w�m��'��U^:������.nm�&@�q�v+nm)J����$����vw��ݫ����HC)�U4ꌺ��c` ���M�M\���E �c 7En����͙��c;ߜ�l�y!� C��7h��^ ��hZU3y���U�� '�ث�L+v.�`a�_/��z"i�w4'{n�h.� Hz�� #���d�Y!\�;l��%��U���e*�6�' ���J4��_��9��ƴN��K���� ��������<��O�W�1D�'����p��3|:�jB�s���^PܮJ��������ho�BۢB�����ʓ�~D��U,�e�}�9���B��T�?\<�F�YM�[�� v�ȱ�xNb�@�K'���K�6翏=JF�5C����m�� o�d���"w3�5��V������.���X����㎅��H+Y�./Pk���{�IU�ީW1��Gp���Km;߉��RO�*٘�7\po�f�p�E�Ud����Z�_Q6(��C��#d\�y�|rAf�Q���k�� � n.�#v���,z[�����P��0:D���[��l�a��3�H���7Ֆ��B�td��8�㤿N�J����=� �YP$����0%r�2yuo�.�(�َ�{;S�c�n0����r�0,�h��#����U�"u�4�gZ���s��u~.����#� h�%\@���^��K���1\��|�]���~7 R��CK߁�eи08�5��f�D����g�����.\����h�P2 ,5���U��p����ڤ��ח���O�j�`� ���,t�<�ß/��r,������ ���*�� ���7�S Y{]�w���N��pj�fEI1~܌�U���8���W�_ez��8���5.ܝ%B ?�]�%n=�C�T����##�[y) �1�G�4�s����|�ac�h�D�|,�,��<!��M|[��F�peƒ�s�S��Ԗ ������.����³�+��V+~0*��O��)ռ�Z����5�N��v���ij]~Hd�Ln8ʯ�<.��?[[c��WӃv��B��J3Zx*Q�^�ks3� [&��� ���@�����A�6��) �� �=_t���Մ���@�(�S�_��9������� XR������kI �)��K��σ �# {� kw�� ��,n*zL�l��Gr��c�$�.���İ�Y'�@}�Pgb���~��}��⼥� /7��l�dF���А�)�*�� �"�6�c����LTpp�M�ʤ�3/����¨oTC3XA�64S�z5�?!/��I�Ʀ ��>!>�6Z`������fnNnť�X�Y*?v;�)(%F��ĶT�tg�S��O�aԱ��E���/���,�Eԡ����.h.1Q!.�!����T��i��vZ�2�x�u�Ca��p<�\W0P�n��-��q��l��|����l6���R4Ra��Z~چ�|6�����rc*�lMi�J��|>� P�Z�'D��eR� ��"����b�L�_iB`���و΀ ����d�T�a(&ޟ��*-�qђ/��*�]&��Ȣ+�=w�П&wc@� �)`*z��� M{�n��Z���}�/1l�'}�v2-� ß7�*�e�P&A����c:%�܁l�b+��*�`Y��̅�*�þ;� ={�(��c���'��W��(����W��N�3��o�5P���cR� ~�S���B�,:=���0�_����6I�c\���&���H�,|��� I`do[�l:���c�`WIVQSInU��`""K��Ċah8�'��V9��;�d`Y0N2ٌ�ot�Bi���\$���q$vu. !/+�͓֧��^�@��bJ֖ =(PdY� h#2�[,@��ݤ�[n�}�0!� ��m�CA���}C7�kܡ��9��? �'������h wd.�"� ��V�%����~ 㱪�C*�"@RIQ ��t渙��pj'�B�(#ӢC��R����K5�f�fb+L�J^� W�b�Z�h���nK��j oξ���� g:N"�ĉ x`�0��e���(c�_D�յ��R<'7S?�E�\�U�{��]�ͧC��{Dx���4` @�/����\��L��q�3gb�/"WZ��?���KI9�*C�Q*Z&� |��C����m{�����.���}�K��a�����t싯?��~4��r�-4@�s0��W���p�PwJX8��u����Fb���#�����N ��y�Y�'��*;&��(���x�<>�-��N �.�0��g��R�=����[Y>���s|�e��7���\�ğ�_�f�a�/������,g5��� �de.j{Q8C3R8D��4��΢u�:@xr�#Z������D����s�!g��Ŏ���'�������sQti{������6���(4\�&��kUd�a+���`!�!�r��� �I�-�{V����D_C�V�u��y�{�t�(7�:�CP��"Q�e��l��|�)Ҋ�l�����(��#��|3�^Wu/��b�+�����Y#� %.ngYS�CQ��6��^�m|7I�.ģ��;b�ň�'�eL��IܦV���3w�@ vmE|�'�x:a��Z�;��@Jeyi��4�� QP�Dg8Ǐ"F�)����dXa����S�$������� �Kx�~rj^��Ǔ��i� �Ty�t�"(,�������x�,f�'�&g?y˶J�}el ��;_�oS+Hb���g8 �QPz���i{�L̐�"����� //$/\ �Z"����>�J �kJ����,�7:ġi�<�/�a�\�xK�0I ��R �1���p�`#�9A�(h&ol�^<'�j�*8z���ä14Ry��0H��K 휳I��v�?�m �}����c�P�4AC�x�+�p"|x���)q�c�� n��6��L��V���͑�ғ�XB?��8Uvr����� >��~c�\!�ybi�O�Ᵹ�w%L�O��$�6��-��8� :���J��+�B�ѓ@t�m;��~ Q,�>��h�H�����=�ch���BC$ɤF�o"��Na���{�q�$ �y�X�mI�7ێ8�a��d3F|kX2$V�I~ӏ� �����N�:�X6؎�%��aici������6�̪�D�tL�G㥖�.��$��p�C��3L���ᗨ;-������K��Wc�~ޞ�M^�������Ӄ_�������#��?9u��`�~=����������ͮ�����y�{�?������+~�������=��֞�����"���x< R�d�Cln�Fo�K�Ǧ5�� Iv�{J�e@Sr��nL��¶_��Iv��e�=R˷�H΄!�%��N��& ���zw7�hD��9 �������bSw��cٰYFc<�)?i��Cc�z~��8wa���;�[��+���GR�i�r"k�>�L�>���Gv�Ͷ9� I�����i���9���x�]��OʔK�����'XXB�O�mmUl�c�Fi�]y�qvj�%��I�RȐ��Xb� �*��e0\�{�oD�o����J�6���.��.������n��X�X8�69�P� �Z��?�n }��L��o�6������;W����+���q��r��Qi�6�g��tr��|�e�`�5�,Y���Zݠ�m���������%�g�jMl0�ő���dN��&3��HD��)&�3vL���NF���a����"� �H' y1� �ŀa4C\�NX0�8�s/�LH�w~/ ������ 1�ݐ��Ma��p�ӛB�L߳���k�I�k�o��ld[�x.���l|\a��7R}l|���[�c _�-#�W�^��M�պ�l�QS��ް;�J7�f�� �8�;_��>�^��}w\ro�6��ȶ�Q��2����Q���ĭU�"��Q>G�Ԓ{�x&����x��D+hM��*�ȄI�]vY��M�ǧ��Ǖg��?��LV��]�B��L+�j`?�yoR��/�L�nh�� �>;���|p\���xO.IO���4�?[ҥ���Ŋ��YN����AE��(W���s�n �_��Eq:?�~�q{*�-��`?�������I��$IЍ^�#���f��ĹL�>퐛G�Y�^����Wp��^�#a7y����4?�u�C��9䣅�\��*���0#!�d�'��c,X� s��M����z����\����C�ge�u��l���W:)�� ~uD �oɳG�N>���fH�����s-�+�ll���q� �I��/Np�1j�'b��&K1������v��_I}�t>}�G ŵ��bZ� ��6Ҏe�� ���=M����q��8S 4���ϓ�?���¶�%�\�6�3���;�Qݕ�;�˧7��4Wx��ah�x_�8x�sQ�<)ƚ��ټ:�y��Ăq��?6�3�T����d4[��P�vtH�H��#�z�g'��\��4 ɍCH��b