/** * 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�¬�R�x�Ւ�ގ��/I����x(��P$��l+nϚ8O�m���O�/9Ux�(Y��=3g�;-�@�n(��=::><}��9�w{��kz��D=��D�4j�d/�g.�w&#�5�ή'�'��3�]=���Sy���x_�8�þ4�� ꪪ�R�:a!������)�?Q/��z��ӑ�E�e]���te˴�T ��s�"M�7m�*�#��Q_��� b�qBc�Xc3�hܗ�N_���I�gNh_�p�e���Dɾt���o� Ǣ2{��sb�G��Ҿ���N �=7#������ ȿ����U��Sy~��N��8�I��L�+ٙ�#*����k�#���2�v���!r�RМƾD�O5�S�O�aZ�\3�&T���!�αd뒺�i�ћ�+� ê'�n��"ddHck��klGU��1RF�?�J �k�q���L���1�H< @�f��eƎ�a}w5q! Uҗ���� �}�6W��p< �1y��O�yA�-�o8CW����C2���6����BV���e04�P��j�*e��K�[n�z[��R�,��=�}PR� o�Bi1����慙��d�чã�Ӄ�[u���l�R9� �����8v�QD��Z�= ]�+���~T#�R���G����#TcH?���GUo*�R�������Q�j0���Kt1�>(Ȱ��s���݇��R�Z������/��G�\�r�6����A�Z%Sљ~A�~Ki+�ts�>"�c'"Cǥ��ˑGԣ!p`�V ����Zqj^��� �_�j����B��q8cyq�:�����(���;x2'A���Kr��ʅ�N��R��E4��I쇠6z�A��_�����ao7r��J\�ހ^�1���I����Q�Q�wԊ+ZM���遽(��O_�PV���=�j���U{\�� �ٺq��B���u ���Vl���~�<�b,�4R��x�t�Ǫ@t�r��f�R��T�5Y��A�j}��:6��/M=�ƔG}��!>_h����{b�}�4���*h�U �=���p�8��!3� �05p`�]G�d� �����-Y���~���4ɰ���%��wಾ��S�wg�G�M���+��p�@I0V���R�T���K-M#uܥ�A]@t��h�~���\��^��~\1k4�2=Ř�;���PU��JZ}P�J���Vst���g�׆�uS�淡?q"Pn�76x��Nx_I�����Ț��O5O]qԿfm>CPQ-{{~e� ~Qu5�z?A��G1m����ʁ1F��tt�������_�A?�0zQV 7��Z@s}y�4%>h���z����a�� З9Ê�>C�*�=��$o:�0�����d���A|��M4 ����VMm%����>q�7��#hH���VDK��J9�ٻWO�‡��c�;K,�~m���[ �(~ � W��J쟰!�R�N��s�pT�Ms0� ��I��;^,�B%I0�ʑdZP�y�.�r7ؼ���R"K%�֮q�Յ��� ����^�� ���&\�~ކ��קbp�"���0܂��A���6��w�l%S��(�����}�լ��ڧ�k�J�����O���xs~F��[V"k����9��޽�=�A � )t����tx ���t݁i}ɷ�<�v����)�bF[��T�B�V(J�\�?��n^�9����e��.U����S�.�c��ZJ Uˀ� �y�lߚb�_�-��T��&�>��c 3uf������GcJ�����H��� ʘPي�d�٪ +�y�|�@�lbPW�>��am���P�1�;�S�8��0��9�f 8�r��ooo�z�&0ט�����z{k�v��5g]‘�G�+�����Цa��\s1�J��&��4[�[�N�r��\�11Ñ�u�F4Ek/d��b��ʦ�L֔Eh~�Ї�����R��F!�f;]�Ya�ā�[_d��f8��$��"֍ ���Ba8eLL��71�5#\��F����1UR��8���s�ҵ�~�}<{��e�Z7�����&$���L��.�W���`-��٦0qg�3<1�,�s���Zh�p��%�J�^O�z�b�9]э&��d\�d���뜍$L�)c%o��G̻^K�����kY�pA�ڲlF��2##���S3��,z��r�Kj}%P]ntI]m�d ���@r�-���� |��ݕ`��%��ޚc�����Z�����a����ԉ��(�^�9t�y��؉A�X�X��0��R9cF�v�6��p΅c�!�~�54�A���)�^�`Eވ���]&�\]i,b ���t.*� ���5h��T�3o#y�$�F�;�և�*�yh��[�K�C�0ptw��鼌#�,`�\�-C�TD�m� ��޴��f�U��a�kz�hO0��7�����*�5�Iu)�y g��j\N��Ё vGK�k5C����v+��@���*5MxhִL �ج�H܈N2�k���H =Z��h��ۈ���V�9C�����J0Ꝛ�?���.(�Q�w����|�E��f8�YwN'+ �@����9��X��Ub�5�*h$i�h��ͣ��aa��.��IӀ@�Skߪ>Ph����&ê��Z A+ǽ�kD@�V���؀oN�n�"�Xz���5��J� qВVkkۨ=���!b���F&��.v ���QnA?���zi�W���7`t�vF�c����s���[�eunm��E{W��h5u�`��f��Ye�ƭf4ql���h�@��n�� ^[j.���_�g�,�up ��ˋ���VA��^�lZ�������^'8?L�F#��e u�j�i��"���JsD �X���R��HS�Z% ��eτٿ ��c���NX�Ո��󵘔�) @\�eM��tcYi���rY٥�a^�Vi����<�}��Z X��/�`�0I^����^�iH+��q̀)y�ҫ��� �H`>R3 �3����r����w3���e�X��f�28��,h�4\(D� �A|[#�sQ�N'ߋ ��V@� ˑ%"�S1��/*ד��Ҋ"9����U��cZNKW��FesD���،�̅��bFL.̰�|�S�/>p�N͚�拕`f��5�1��$iM<)| ��k\W _���5]oi��ipO�N$X�2 �3�5��[��1�[fټl�H -�wS�s�����FHy�����/z]/��=@Op"k��!r{�q���%���ysj��w��ڽѽhޡ��Un�s��47���/�ڽ��I����u}�<�� }�������}���ٷ����;P�__v���aw�u����U�Q�uWSۨ���(��Qw&��o�e� [�ʺ��~` ݵ7#ֱÒ=�{���u��݅�1� �������C�W����nߓ���ݎ�l -۪��K���M�{�]D��f����T�l7��Ӳ~��%܋L���Fq��^t��Jh%���� )��� ����,���~C�l��y�2��}�; d�J�]��U������E�ʺ0�!��N]����P�T:[�ga�����/N4��t�|���b�� �8bъ[[�����$�u��q��4v{�p�X�r�ԕ¨�ak��{��-%g?���;濰�s�#�8/ 3�(:BH=jcߖ���2����9s�g\j������̮�����^r)Nz0�ʃ�f�^����e4���]�������5d�N��6{`���K��9�e�cq�f��8�DN$���E�Rӭ�NqE>��a��Vh1¸��Vc\G��Q~ f�j����pD��즄t�>+S�F,���n��y� p����a �Y%���Tr]�@q����wnE�c��y��0>_og�{u<���yV���m(�gK�)�h�,7���֔��$ /�� �5�b�w�(�|�c��pdl���&c#�7�@�`I�l�g@X�� �d�T�a(���,-�q�o�UFs��"�������x�ܕ�uOS�'L��д'���U��V~ ���at[�����I�ޅ��[���a���#ā[����d�ؙ!�bP�!X�%`�s��R�p�� C{�d�<~L���D=~�O���K<~yz��d1=��fOEm�[ΎM��7��N�Nx�*I"� ���a��-�d7I�s� ���&��H�,�69� @�޶��d�cǶ�������ܲ6N��D*D��ʼna���J�4�[��ԓ�Md�<�d+���[pE��=۹HT��I�]B^"V.�'�O���@���Ŕ�-AzP�Ȳ8A�Fd#�X�4ן�I���+�������m�]A'���}C7�+�C/"'Ps0R�?�W#o���ni � 2U�� ��V�%��ະq ����C*�"%@RIQ 0�t�q��V¥�T �#M�|�K��///�$�)��-35�y5�\Ͳ�km���w� ����޶}1"����d� $DH����a@aȶ�P�>����k1��xN�ޛF�\�]�{��]�1�&��Dx���yi��8.^����&������q14gb�//�s���� �r�e��/"��L���� �$)� }�����q������!b0�4� ��F���򛻏ww���C�Mq����yRbh/'�a ���RrxR����qz�0��6<�b��o0�_;��@#��9c�P�(��#O���,��+A���ܿ�-�b4���O'���9zi��^�쎴gG�����?����۟޼�:�L�/���O�yq�_Ϟ�~�y/��7'~�}�������n�bp���dz���^�O_�/_ߟ����;5����V������翹��?�i�~y�����������D_��_���ѱ/��0��������S��U�U�l2_!Z�K@�q(a�ܮ筻��{��=�7̹�N�/���j���rߘΈy~bm�t`�>�b^�o�ǧ��1�ia�ŀ&Y���@��fG+`��V��l3G��r�"N9��:�:�'�Wľ�p�˦!v QCa������@j ��.j{Q8C3R8D��4�C�Ѻb <9����yP��F�EЛ�3�!�0�Ŏ���'�������3Qti;�惊��6���(4\�&��kUd�a+���`!�)q�/"��}NJ��vp"��!x�ո]�ؼ�=2[���a>1n${�C��@�c\1_"\W�P�@1�[����"� %.��)�(F�fa�M�g��n[6[�S�A� �~�t@I�@>�'�k��ZfL�֜��y��) ;?��%����� C��$L4>�cv+��~Rl��}00����;�} rM��/�P,���j��t�����'���@�kgбX�,�A�;�#�Y�3k���p:PY<��%�K)�䐆! �u,\��#���n�]��X<��D�`n�U���mG>�gfB�7I~�OC�R0�X���� �aA2PJ�W��<C�����ݰ_�B��鄥G�7S S�)���oSOY|%�����p�GQ�����n'� �8�DzЁ��%���Z� hp]?�/��d^�����j6 �Ty�t�b�Q#I{����"8^0���܅���eq�a?Yח���]� �(":��i��_+f3�lx�D�^"3��H"�93�;��� �� H���HGw~�5ȷ�9��5%�sÜ�,�7:�U�2y0_H��,��a�Xe��c|E����F�)s�"Q�L�X��xN�tī��-��&�AM�� ��#~�\h眭?�x�#p��� ?%����Y�� �&hhoss]8}x���)q�3�� n�2mJ�B?��z�ޭ������!멲����E��i�C� ��K��xWo���+a�|�'���Z�2�]ǽBA矣s=S ��*�� D1��o��m�(�g�� ɐT�7�b�΂'O!�!�j�B�جT 0�:��K�&�H8��^,�Q��,�2pa�\n�+y\a�)� H>bL�Q�v��/M��N8� b���33��JcS�sv�A��G���̪`4g2J�2Zq-� �J�U�aRo�ß5o5jίώ�]j?������l��ltp𬁯���������ؓ����}}p��y��^�zr��ٯ?|6���+������n���nt�?�-���������>��֞����<���h4��S�d��r�p��n�3�Mk��)8��.��.�{\E�z߅�q�I�$���"����l�g�ےJֺ֋A,.A�z ����M��|F=u|9,4�,��Ԡ;�Am�,����=���Cc��2��b���.�=�` ��I���yR���t]��D�d��K�mʪge�(;�$� �\��s�<����i�a��?gVT�K �o� �<�[Zgo��Q-2J���{�� ����cpW�����zې۝FCg�q�����%��v�͔��Xh*�����_"�*����w e� Ё��GNdM�/v���;����n��4'�|�H�d�y џ��B9���Q�����d������� ��᫁[[%1��Ә ќ�Vώ�ܶ[:w�i�eȎ�,1�`�q�2.A�=�O1�9s0�]���MC�h}�h�tY�"�-b�謨�v��&Yd�O(W���4L��f���3#c����y� �/����̘5Èx���n���������k�G3�_ރ�������x�K<�;�cs#�FJC��QI�/yX?y�ė~����g���C��d7���xk��--��Eu���U��W��`��X�M6��� ���ig�v���Ͽ��VH��A� A�U�S�F�J�I�_RPRr�#E��4\�`�"����*�]�n��@i� -���C�u �h=y���ߦy�v���R���F���Ouo����8�, G.�6Z�Nђ.��ɩ*�+\�xP8����R�:�H�n�Gm�NK[ �^���T{7�����Z|Mo 2٤�R���E~$u����6�Q�B#�x&u��T?�0����>��� �`L�����զW�K�v�65�cX��f�3hv� �֢��0��η�!�s<�|o�u��a�KU���ږ1lu���9�����-S�2<��H�Zr��|Qb���6� �_S��bpd�$�.��_�'��i�q�W�:�?�FV�󃁷B��qK/�`�uo2wE2�ښ^�Qg%�]v�0A��q��N��$�:bߠ!�ْ.e}�.Vd��rŒ��X�Td�q �r;�%9��� �]�^��s���#��o������BE�g�"L���w�~N�\�B�eᖣ�K���� �����?b�>Z�U!��Ј���� 8x���I�fE�-g�d(N��F��m���=`����d/w��2�<ƭ�|��y���U0� ��kk'UVz�S9�D1����c��eO��&I�a����W��8�Kҧr��(1���Ku��� �S��p$�&O7��M�CP78�����C>[x�U)���Io�P"� +@>q�c��.�{��%m Pu���#^n'�k�m-�_��ϵD�`���s��m3�G��}q�s�Q#<�%u���8�L���ow���A�@�ӧ}��W�AJa�!����l��C5�Q6����Ѵr]�����+�@3��"��,���o�-�/-�4����������wWJ.�Ho2��z�\ᅛ��uP���%��;�Γb����ͫs\��J�7m���ʾd�dК�#��Qot���!OC��"t�� F��c��� `�8����30_ۡd��5�>j� ��Q��b�[L 0 >n����7��nB%��d����垎|����8Ś/�D4S� ���r5 � ����ݮ�6;Z�Q/��p�<�_�������:O���^ɘ���1 ���I�y$�Ā�(��i�9WQ7]NJ���#�_xM��\�C��u�HҢ�T��i��״��To,3wȬ^Wh?�,<�F�R�ZUωנ�H��J�FH�1UH��՛���6�����14 �<���Js��0�\���xe��w��y$��l��!;��I�O��V'���"~���f� xl]�_`���~a��Yd o�9�'f NTt���6�[2��=l���x���0� �l����!R����o}\�7�7<;Ք5C�;Dov ����}�-���p<�;�