/** * 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��gQij�\����dX����^���hlMvx��4#��c�C�N�5�8�JJ� Z�̘J$��]3\�2c��a}w5u! U2����K��.g�p2 � y���=�R[Z�xFސ� ����/ڔCK�� Y]e�w� 7t�a4^�_��'�+ �RL��|�r����B�1���� 3��oɳG�N>�oۗ�g����e@��g��;�8"r- ͈����\~l|lD��� �r��P�!��`�?6����͏��q�5>6$Y��xcx�.�w�6���#�'|����Կ��僱�b������Y��F��#��0(PW��� :jW5���=P�#r:q"2r\J�/� eL=6j��h�Yh�5G���fH|9��^�N��_���Ń�h�?>�Q��;Sx2�A�uN�q]�0�=��7{�"@s�!�MO�#_��N�ߪz��3���z��bM���MJ>� d�����V\�dM�w�{Qy���� �{ �Z�\��q��3p�M� �y��c� �x7�A��X��A�ɞ*\q4�fm>�@P������h����:�2�'(Tਦm���^;Q�=DM::~s�C���Ϡ�k�(�����\_� Mɺ:`^?���V��I����$�ܪ4H����45�~@�ϳ�w���4@��Z�wj��V��)�3׽�1fACB���" Z�Wj(�@g�_?} ���3�Yb�sh��L�R�G�P4h�&}7Rc��u���w$|(��Q]��`� ��I��;^ ,�B%I��ʑd Z�|�<�B�l��UQ�����k|����y+H�?k��cC���)�i��a�� ���A��[��\"��39���g��z�F����>�}Z(/����M��D�x�1f�%���{�{��@FARp��G:���xh��д���zP�YPk�Td1��f������B��(J�B��ܼ� ���1<���}����ӧ�.�c ��ZJ Uˀ�yȶo�����%C�:F��ӧ} �a���??��a��hBi�C{���bɚ�p�W@S�XQ���7��aţF%�� K��f����a����tU7�tz�q����sޯs6�0�����yd���z-�Cߏ�� Bk+���*���D�̐B��[�R�}�j4W5�V�4�[� 2VHθ���Qv��Ncw%�.��nC�����(��>y���jknz8s��2�k=6�ÞUfP�_N�T�Պ5[ �.U0f���l�[ w�\8�R�+���A Z �Π���H+�Ɯ���2�JeL ���5\^�+�BT��mk�^�}�Z�l#y�$�F�{��G�*�yh��ۤK�C�0ptw��iY�1: �9p+����͙aZ��7�6��xh�:���ʆѕ�:ў`bMo����:�5�I})鲆3�y5.�_� ������5��z���n�^a���Z��mmY�Ԁ�mY�D�F�p��6X�XM?GJ��кr��n#�QfZ��.:��`4{��?���.(�%����[��"�K3�*̝���J���ja��lN�u�~�N���b@�$ m��yt�4, ���{ih����5����no2�� �tr�8Go5ZN�u����J ��wڙQ@Z� �ꤝ-ir�X�F�Y�e ���������]#��?���zi�+}��� ������=z�0�w\V�ֆI]�G� )�VS� f1��kz�U�n�jFS��x8��� Z5vS�-h�:�R{I���?Sd!�hBh�C^l|�� ���Bd�Yt�����(0-�:!��`���Z!�.i2�NwH @��m�W�+ :a��*�.�4�foH@ڪ֩aq��x&��M�P�u�<�&�O5ʵ���) @��e��ZE�ֲ��7 2�Ue�R�q5Z�],�4��H�K��)`������ ywP�9�!��N�5���K���c3@#��H�8t�"�з礄�:����M9)�!b��{l��@�;�`A;��B!�Op[ķ2����u:�^�y�8��2LX�,9�A8�zQ�����Vɩ��ή* ?��jZ�j�7*�#��U'f�G.<�#bra��壜z~��(5k�+���Ak�c�8�AҚxR� \iԸ&��Wuh��ʲ������H��U�#�5���-��Ƙ�ŖYD6.��,�BK��m��R�<�)/R��������,�x��Y�?܇��^�>���%�������{��$��7��;���W�&��ަ��?��hk{�������y}�<�� >����uw@�����5}�0���݁��|�� ����B�.���U��Ϻ��m��,��>��$���[ �9����+讽��V�!܋�u����.܏�M(�����^�*�}M�~vv;��>�j��^|Tb��ʋ �"��n)�d���%�V� ..<��!�e~��%܋L���Fq��^t��*h%���� ���� ����l H��zC�l��y�*��u�; d�*�]��U������E�ʼ0�xC9���3?f[IS��l�m�I������6��f4q,ߋ�+,�s�m`�����A8�>��ؿ�Sǝ^����y�Ҵ'�aWӞ>֚��;l[4�8���ұ���eܶwqkK5Ҍ#�[qkKQ4< �&�N�Q�l(U�y�J&�Q�7�u��_�LvN�ا���x~�'�}|:���!�>1�_φ3/���!xTڞ�/?P���vU��(�D�D��G{����O�5T���#�-�b)/K��S�i4�0j������iD�0b�jߒWH0�sF���s�� �\:�^�9�}�Q2�Z%6�o�nxK&K�����Y��հ�u�'>���u9xt�%���h�tw,,��FZ� wy�Z��eܻL�2�N��)�`>��5%^j��N���z�V��4��{363��(���"s~�����"�*�A���!����� *0�����^�_ dps��ܟg����m� �`��!J��'�Z݀d������OEڅ^�����ʦ#s��?'�uRV��ku��L�΂"����)��`��#�{KwD��v|ݣؙ�����HD������a)D��)ō�X����9�5ohI��ϑh������t u$�Lo5P>G�~�ӟ���c4�"o�o�Oco�Q*�J�-@� #qo��C��q>�%�?�� ��s��-\�A�E(�J�g��$\ˆ�_������s�{�:�%��[T�j�m+X��.�ƅ��i���2zF�� ۉ���X}��]��������dXj0 �D������!�I ů/��;/V��Z�D �`̷������q��%�[�2�*�,<7�ת;_ {}����u*/k���>r� ș��YKQn�-7c�_��4F��U�W�^a8��d� �q�0�sr���4U����Ȉ�6_ m����9��bz>濰qt�G"qvF�Qt��z�&��@ţ}�2��9 ��g]j����(Ea�m��P�Yra�p��1{qߋ'�?Rаj�w�z���d'הQ;M��4�.?$�t�&7T嗋U%�c�����8�����A+� �t���'�ռ67���e��+��}- tZ�� 0Tkc��������Eg,�]M�|��� >�{�˘�[�K�\/0��%��)8;�F��0���9xh�<��>������q����I��↣��M{$7��:�J��b9jN ��uI Է u&fa��'{�7�*�i* �r�"�6Nt$x ���*�28�,��l#;.\ �׊� n�I\�TCx�Q�S΁jh�@#�f��B��&�'�%2���tb~N�#ć6�F�{ >x�R���ɭ�t�7K��n'r"�Ĉ��ؖ���t���5�:��B����e��:���:�c03V��%�#*�e�&��Y� 4b�-�v�N�[f����}(�0������ ���-V���=�=� !�����f��xdE#eV���m(�gӡ)�h�,7���֔���$ /�瓯U���{sB�\&Ř |,��:v��H�&�,霍� �@K�X|J&RE�bR�I���b4��P�2�e�k�,�R�s� �iro�f4�?LEO�ޫ�iO؍[���V���1�����N槅wa���V����$t!v܂`L�d�;���3ClEP�,��€��Q%{�w纡g��<~L����q� �e?�x������bz��ͳj�rv�����/zJWœJ�A���0&�˱�&�|����y�d��)���oS�^!���m+�M��2ql�*�*j*ɭj�4L�Bd)_�X1 g����8Ǟx�� l" �I&�����A("�?���DU?��.�!�%b�y��t��� a\L����,�m@0b�Hs����˝��&D~A��My(���4c"��o�ym�;�"r5=�'a�d��w�����n��EUd~�p�*�$B�/a�bQ�o�ǧ����ia�ŀ&��LQ WJ��0�p+�G�Y r�O� ~)�@w�K����+b߬;��e�C@W�%⬦��������Em/ gh�C ��6�����Y��XO΢uD��T4@��hx3s1� :��������_y.��#m��~Pq�F�^���k��|���>lEv7,�8$V.�0�8�":��}ϊ�]�X����k��n<6�|ϟ���{B�~��A�ɞ�h�B � �C,�+�K(F�yNJ�Sۭu��nC���U��P#|�����׳�m�� �-�)t�8�M׮�S���I����<���̈́�M�� �/��X��2�4ֶ��""��D��O�VoM �g!���v9_���Z��n�����&��!/�^��ԛ����#� _[Ng����3��kVs,VR~H ��✗�y�OQ�&���2�J XaxY�K ��lf�M5�6Np�,R���u� )O8�Sils2�=�qIҕ*�K��Jqp���Ik��Bz��� 3�|Eg���M�bƊ������PkAn�`�;SZ�2-�AA�>q[ �"�@B܊���8յ�����������V�3�M9��ٔ��pS+P�k�y���5��"V'o4�a$�hm�!Uq��<�$6-�k8UeYZ(y6@�I��*�$��ll$ܺ�z�W0li�55/(1�o�Xc��4B� ��~wa�>�%X�'p�a����Xg�m���AX������mE���G��)� |g���O�ID��W!��^��;��bK��Ι��z��F�e&�b���!,d�QE�$6 \'O˯���.�+�` �l�3��J���Ay�)��(�'bs�0�,w \��x|���|>:��g�b9ֱ(i���8i ��MÛ�,/���c"��x�=���G����b�~:�U�hx��5�y'�8���;�1 %�(q��&�{8%&��_�G��CU�9�oU偯��!���D��t��r��xPqQ�>��7I�A6�����j�ň�G�eL��I8�V�/�5��@�wmE|B ��x:a�8k����@Jeyi��4R� QP�Dg�R��*:�����v2�0�� [CΩZ;��W�w N���%<�j^��Ǔ��i� �Ty�t�"�,�������x�,f�'�+g?y�6(J�}�l ��;_�oS+Hb����8 ��Pͦ��i{�L̐�"����� //$/\ �Z"Ȥ�X!�J �kJ��9yY�ot���*y0_H��,��a�Xe��c|E����F�)s�"Q�L�؂�xN���Up�܇Ich���g<����9gQ?�;8��G� �#]!�)]B!� ���m��‰��yJ��U .�'�=�.aڔ�3�~F=�i�,�g&ձ�~~�r����4���mD|L��ȹB������>��;{��J�<��I�m^ [F�Uq�+t�9:�3����ׅ �m ${�����j����v�d8���ރ8�9�)�0<�Lj$��b�P��ԙ����X��SCx�������i� �`�����I+��,����$�sH��� y_X<'J�p,����Ͱ�;� U����{�]Ib�Ifզ$g:&�k�RKC����>z8}��Y��F����Sם����������?oO�&/���[�����/���E���{�ޟ��o~0O�����_O��?����f�zq����<�=ۍ�{ߍ�������h8>x�uG!���?�?k���4���>�������bƱiMx�8�8���Ğ��Д\�ǥ� �໰wX{�G�m�������m6�3a�m wy���� �0„����m��~�=u|%,4�,����f�a6l���O��O������ش?`^�|��@C��ɱ������#)��4v�4_6��?]Ww7�?�<�������Y�k�m|_�,����OZ�t�ɒ�����k'-~ިrs!N*�;&P�D�h�g���ŝ�"�bs-��O�a�%o���>����5�n���Yx���ps ��]zs5����J5�g�J(��&�������wf9�5c_q&O� ]�#��fۜ ��.�$S��[��4s��0��l<��.G��'e�%R����,,!�g��*��H��U��k9;zp۪Y�K)dȎh,1�`�q�2.A�=�w��w��` ��U;� �aw��:'�+���1N�T�]T��p(�C�\��vÈ��&��7C����d����j�S��PD�8�j������\nu�)� 9�S>�a,�A��OWo��nP�^��j�&���ijW�&6�������\2���z� �d$"H���;�{`e�+����0�B�Ho�e�e�����C�r�b�0���E', H���˼�|"$�;�x�SX�B�\�m�$���Ho Xg�N4��n K�x�(�����X�0L��e�J陑���Z@�\�cƗ˻�`���̚�G����`w�w�̫��� p!i�� ]P5Q�- ��������ʭ4eT��+���� �\.�� +_f���C��d���Ckc�--�:Du���I������]1+j0]�`��svJ7����ʹF�� R矊�}[�\�������.̉؅Z8��.�9aw���5���\��R� -����G��h��<ci��o�<���gg)|`�"z����D��r��x��, ÑK��iJ�'09Uev�G��Բ[= Zg��� �%/C��hk�Ӌ�>ݐ��Ma��p��қB�L�ﳔ��k�I�k�o��ld�$�x.���l|\a��W^}l|���c�c _.#�W�^�/f�պ�l�QS��ް;�J7�z���8�;��ž_��y\�o�6��ȶ�Q��2����Q���ĵX�"��Q>G�Ԓ��x&����x��D+hM��*�ȄI�]v���M�g���Ǖ� �L�����n���V^��~��ޤtm.��^�d?�}v�,A�� P���"^�^!��oА�lI���J+�ng9aF|G$�~C�\�NzY ��D4~�������w<��� ts��䒙"��T �s�,�;aW�����ȿ-�v�p�ͿqI�R9�p��Gl"FK�j��vs:4"y��D� � �j�yj�%�e�1�g@[.�b��%y8���;�Zx��b����x 'r��䵵�*+�ϧK�u����V�2�'As�$A7zM��7�*�C�;I��CnRf�Wx�r�_�}�{�����f/g�� ���st�搏^sU���v� �� +@>q�c��.Xx��%m Pu� �#^r&��ʶ��/�>+k�ˮwd���JA��_��/ i|K�=�pxtpz�/��0C��}/��k�^Agc{綏�f�H�}q�s�Q#<�#�5Y����p��� �;��J��v����>R�+0���~q6����v�(vQ���iZ��`T�S�řb��x9�x�d��7��0-�H���鿘��?:wO뮔\ܐ�n�ѕ��� �C�x��������b�I1�L����9�K�%��6�����(�����7�%��굆Z��C"D��I�;?;����v�InB � *����� �dz3\����t��7l�C���q�;��4�(�����lV��v}xJ�M�����'h�]N�����8%N�S��9n�V�t#K8埗�� *_<��hğ~���<�Nf�x|:���N��<�'���Qq4/� 2f�`��C�����;��%��,�ôw�`����]�]o�^݄*Z���>�_?�#5�2����q�5_l�h��g^@���q����� �����m�{Z��,l7J�y޿�ѣ����u�D ]ɘ���1�� �� �����dP��Ös��~:�ׯYD�q�5`p}�ӱХ&H�Ғ|m��i?����Xf �Y���A�Xx� <9�R��:��A瑎������T!9^��onffX�w�k��J���l,�(n�g�\ ��I�*�Y��������N)�7��h�N�Ag@�0���Q�5�)�'��_%��zd [��'X�j��0>�L�*��� b����i4;:�+2��u\���X��.� �l����!N