/** * 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�x�Le˒�\l˱�dg�h��A@]����?�Ӽ�����)�K���q%H���3g�(�tW׭����x�������w/�4��{���qMo2����K�FM��=��+��9���^]�O�Rg2�zpy��󟹎��LC:J�8�A�����N�AH��ULC��T˟5.��zq#p�NjM%�c�U,Ӛ�F05>G �����]�s$3J�:A�<�hlkj������K�'�F��3:��z�a,Ar(]8v<��ܱ��^d�xN���2]:�9�؉A��sץ�㑱��g�W2ٟO�QL��L �h>kp�<���q��ޙ���33'T� c� 't�me�8Q�C��IAXs�q>Ʉ���$cZ�\3�&T���!�ѱ���i�%���OZQ@�UUH���E�Ș��t���N�1��:�� T`�DXc�ì�d�P��S��Wh� ױ���FE�]�\�B� �#4�-��˙9��CkJ���s���Ԗ�7�1�7����6���6����BVױ�;˃�Z��k����%bt��Q���+��L��@H���������e��l����h|K�=�pp����|�ؾp<ۿP�.:�?;�4"�� ɵ42#z��@������N>6Xk�>BU��c����۪�6?6��e��ؐd ��j�M�%:�� d��� �������ZoĊ�/��GtƎg�s�~�Xà@�Q^8���i8�]ՐnnvA����ԉ��q)��薔 �hب�G�g�9�٫_��!��H��I:�j�~�W,/^G�}� ��h@�ؙ��9 5�^�C@\W�MwN�Ƶ��nD���~jS������O�Go�=��_��z��bM���MJ>� d�����V\�dM�w�{Qy� �{�Z�\��r��Sp�Mc? ͫU'��)�n��Z��.���=x�O�CqS� i<=��ખ�+��~-2�p8 ?ğnꙂ牂� ��X�4v͉4��qn������c��?� M��w���i)بV���>xTDk���sS*gq$9��ӧ�ʜ������o���=��v�V�wK��R�9�R����^H�����]V�I�:�Ij#��I�?�GRE�Hd�o=��qR��(¡~����GC������_h���G�{l�}�4���0h�U �=���x ^�R�j �����Q!� �b�V��%Ku��h��A� [��/�����eH���{5x���eX3U�{J�~ �?�dSŸh(u4�4 �������&m�������Q��?�Oøf�4�2=Ř��������jZCP� J�H��s���Sǵ�a�T��]�Ϝ�[�!� ^�;�c�k#I��x���U|�=U��hx��|<�2�"9{{qi� ~ Qu2e�OP,��QM�~qr�v�{��tx�怇ů!��A?��{QV 7�y- ����a��utȼ~���Z�g�$=�2g\���gp��0�hH�� sij����*��g9��:Z��i�f����ꩭ�Ss�S�!й�1fACB���" Z�Wj(�@��_?} ���1�Yb�sh��L�R�G�P4h�&}7Vc��u���w$|(��Q]��`� ��I��;^ ,�B%I��ʑd Z�|�< B�l��UQ�����k� ���y+H�?k��cC����i��a�� ���A��[��\"��s9���g��z�F����>�}Z(/����M��D�x�1f�%���{�{��@FARp药��tx ���tݑi}ɷ�<�v���,��bF[��?�Y+�z�Q������'�y5\cx���Tc��O�-\��‰7�����j5>�mߚ���K�"u��ɧO{X�h��~h���є�x�8�pǟ� �5�!���2fT��(�o6KÊG���J60h��n��6�Hͨ���)�@`Es��s #�k9�%,{��[8�E��5`@���8���ڲ�(pͫ�H�#g�lz�.��Ц���s1�R��&��2[�s��J9,X�ʘ����D#��u�AQ1~�u&�h�"4�I����*���b�Qȸ�N�xV(q����uF�^mn�X�����,pȘ�3nb�kF8�ōv Yc0�����q�{gg��k�w�p�x<�f�WDj�hv��.7!%4mg ��\��ki�Ql w6���ʂ:�jj��&���NX��6��4mCL>���Ѧ���k����~����ɜ U���#��E�k�x�~|�(�N�X[Q�(�>Vad%�cn����*����V�������h�d ���@r�-����;��J�>H��wJ`L� TTˀ<��O5�uez8w��2 �k=6G��UfP�_L�T�Պ5[ �.U0f���l�[ w�;�R�+���A Z �Ρ���H+�&��N�X�2&��X�-/��t!*� �wG�5j��T�W���Re#�=j�ck�<���7�:���< \��:-�8Ag=�n�R�93LK��fۦ9���ZG�[]�0��^'�L������!�U'��=�/%]�pF;����k�a`����&ZO֛ڭ�+L9Xb^��`� �-k�0�-�H܈N2�k���H =ZWnu��m�1�L�¼B��N`E%͞,��l����d�߾����.Ҽ0Ù��Y8��$�m�V|��tY7���ub�5�*h%i�h��ͣ��aa�^��i@�Փ����Z����ɰ�2�H��qo���h95����[(� ��igFi�6���vB���cm��ї5Dlʺnd"������Q�ak��4�Eo��n����� � =G�.�wkä.�#�z�E��k���5��*[7n5��c{<�_EC�� ���^R{i��� Y�!�.����bk��tV]&`-c, L �N~4&��VHg�@� ��]�}E~��� �@�� � M��[����u*@X�(� ��T���@�0��D�S�r-&�mJ�'wٯ�VQ���4� ��rU٥�a\�Vi�+��<����r X��/�`�0H^���\LiHk��q]S�إ������x� f:vf��W���:����M9)!b�߻l��@�;�`A;��B!�Gp�ķ2����u:�^�y�8��2LX�,9�A8�yQ�����Vɩ��ή* ?��jZ�j�7*�#��U�f�G.<�#brn��壜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�*�]��e������E�_e^�o�!���]��������t6϶������z��l3�:��E�����6����#�� VYD�ߏ͙�^ _������Ҵ'�AWӞ>֚��;l[4�8� ��±'��eܶwqkK5Ҍ#�[qkKQ4< �%�΀zL� ��Kr��c�$�.���İ�YǤ@}�PgbF��~��}������ /7A�l�G���А���*�� �"�6�c��|ݘ���>�ЕI5�g�+;���P �`h��LYc��q��Vh1B��\�Ƹ�`�-���̌�tAs�� q� �$~V���t˧ݰS��`ǫ��C �M6��亂���q��oi��c��#�|蟯��Y�&_�H��oj�i����h Z�2ˍ�(F�5�u�k/I�K��D,@�gr��+�I1&�@��+�]25|��s�K:c#?*�,��IUQ������ê����M�8T��v��"����ܫ��4�CbY�OS��wlh�v���*g���xy��a� �C���j�]���Ua,��2 G�� ���d���[�T9˲�0`.tT��ݹn��#E!���?n��'E��%�:�u���o�چ���b�r�K���d��D`A���?̆ �rl�I:���v6Y�gE��e�۔�WH*#{� �Q�L��J���Jr��8M�Y�'V C�"<���ϱ'ީ'�Ȃq��f&~��w�H{�l��w?�B�S���A�"��A���b�\�&��r'��� �_P&oS :88͘�'��A^����C�AOE�I=�����nGc� sQ�_ \�J. D�Ѕ�K�U��R���H�J�~X�3��<��S@�"G���� �_\\�I6S4[ajV�jV��C׺F����-�����}>!���l� $DH����aD�˶GW ��=~ 6W�b�K���lQr�W'�qxՂYt5�l}$�{o��c�8�x>����:��&f�u���9+�x ��*���oDX�H��WB��R�2!W�K��IR2@�f{�����s~��7�]�h�iA|��0l�%�}��-S���߶8 ��M���ګ f�E;���`nf�v9����f�M1R�7�现5Ј�xU{`^�k�������Y�0�Tσ�{3�yx�[��h�㷟�O��s���߿�ٝh�ϣ�W�_�헃w?�}{y؛_�߻?����a��y����+�{yi�=�{��ӟ_�_�_6�������?��Ni�zz�&����SWs~�N&m�]�o�r���o����o��/���r<��y�����/џ��??��G�>�����^��>e P�\�&�"�5������l݅d���A���`.��;���z����c�}k�;����ʎ |" Ţ��V�OiKc��¸�'L2���@��vO+`��V��l�@� �r��N%��:�:�g�WľYw����!:�(��0K�YMi� 5Y���^�Ќ��m$�9­��h]����F���=�h�n#��l:Đb�}]�e�����+J/�_G�^����"���=�1 ׮�_9�Z�}؊�n&XHqH�\�a4uEtk ���{c�89����i�.xl^��?�Z�� ��a>1n${��1!���8c �D���/��b�+�Nm���"� %.n\YS�Q���2�n�^Ϻ��v6l�X��y�6]�ZO�F�'����Bv67�OqW�����cr�ʬ�X��C���6�{Dp<�Z�5%<������:u��?h��&�oX� ��z�BSo6o����*|m9���t�??��=�YQ|̱XI�!5��s^���>EU��K��8>(�`����.-LB��E6՘�8�=��H �#׉��<��N�� ��|6�L�%IW��C��W��u>������w�)^]�09�w��d�T/f���[�seS*2("��l�gF��fb6��W1��WJ�[�z�����@�Z���t� Z����#�+�@��B�I�S���;�aq�Ѡ��h��1x��Tő�3[��\��c�)U�e�jq���`�F��Ԓ|P����p�}D�1_ٰ����<��L�V`�M�&� ��]X��K�s_��>�e�ضM�������t�M�����cOK�o�1�?�a�x��=~�?�'�P���Ll�B|��17W9pSB�j���M�h��=��Oǒټ���-m�E�~���k�N5L�8���ǚ� 2Y�NS�Yc�oul�6������Ho��m�V��[8����)�xa���Y�����e�*Vn�d��/ηM�Ƕ��{�3v ��TĦϵzmV&��73~�r�g�v�p�U�Tb[A����Z^�ˮ�*xX��F�`�69��Y�;M3TL���9���؜$Sd;� �ro���~�t{[�3@g�t9Y��z%��X�M�i�����{L�.Oͣ�b�{��w]�B��J ����ڇ&^��d�SH�0:BQ��ƴ�FΈ�&��_D�F�|O-����e!%B� �㉞n��t9kK@<��(/>�7I��yHX n�#��Y�1Q$!�Z�����n���&���鄥G��)ns�)�好o�pJ� *DAi�����!R����ɰ� 8l�9�jIlhN_-�48/��ԃz2/]�M��P��f *��6��?�oS+Hb���a8 ��P���i{�L̐�"����� //$/\ �Z"�ؤ��"�J �kJ�9yY�ot���*y0_H��,��a�Xe��c|E����F�)s�"Q�L��>�L �W��;�$�������`}G|A[h��_�x�#p��П��[��^u �l�u �H44����� '‡�)I�W�8�|����ӆiS���Ѻ��ַ��M�c ����T�ɡk�+s���� ���s�`g���=}��;���J�<�gI�m^ [F�Uq�+t�9:�3����݅ �s��b�x�m4���Xe~~��]#�:~�w?��I�c 9 �$�I>�X�`8qf�y7=s�D&� ����p��f{� '� t��l���KK���r5��8�px;C��߉R��{���s3,�jbC�3���^y7�أ��Y��əM�B�k�2�pj�����0!�Հaj�d?��i�ίϏ�_h?��������t��t������������_t�?�'����f���������������Z/.���'��~���n����[��k����s�{0Y�=���i�E���d2���,���p�^�K�Ǧ5�$Dܬ/�OɡhJ.���]�i�]�s�=�%��fv� �Gj�6��06�����q��D�����zww"�hD��9��������bSw��ٰYF�,�=�k��&����P+�����h�o�фI5���ƣ�65�f�*�Z�p��C�Z�5vIm"׆[�p�B�����l��F�%���[j�T�ǿp����9���=��U��M&�82>?��顳�d�0��9�>vƎ��[ٱ�u63L�P2�[dYa�D� /&���0��`�k�) �'Bb���� ���/o�V�P=Y!���Ie������� ����'�P������8�S�h�A�Rzfd,��2�;O�������"�;��+f��#^B������ �j�����\p�R��0��(ٹ��< �GG|ln�H��2*i��N^�`.~���/3�����K��b����1����X������,��kB�Ō��Q���^���n����� �i�$S��?7��>=�&?IAI�]��K�pփ]�s��ѩ�k U��c�rZ�A;� �h=y���3ߦy�v���R���G���O� n����8jY�#����S�d@>`r��� �4M�e���΄7���K^�����§�}�!�ݛ��S��&>�7��,�g){��"?����R���ȶQ8�4F���q���_��������)|���_mz��ܩ�u����5��Qw�I7�Z��[�8�;��ž:_��z\�o�6��ض�q��2����q�����Z�"��Q>G�Ԓ˪x&����x��D+hM��*�ȄI�]vS�@N�g���Ǖ&���L�����n�7�V^�~��ޤt�.��^�d?�v -A�� P� �2_�^=��7h�_[ҥ���Ŋ��YN��"�AE��(W��^�®< ���Eq:?�~��pg-�-C��p/����� G�n�t���i~�����9��ϵD/����3��e3�G$Y��8�ƨ��,��OF8�co۝A% tP;���i)�w[R~�ie?�8|�H;f� ��(���4�ZW0*�)��L1Ќb�`tr�d|�[P [��\�Y���_���A���/%>�7dotmj��� ��:(�C��q�bg��YR�5�yy��R�� |l�? f��,��h�z������*kG��N�!�>�h@�����xʆ � " >H?���e�%��� ����� t\���?�=����Ƨ���1�Մ�#���[xD�!���'h�S]N�����8%N�S��9n�V�t#K8埗�� *_<��iğ~���<�L�x|:���\��<�nj��Qq4/� 2ff`��Cg����;��%��,�ôw�`����]�]o�^݄*Z���>�_[�#5�2����q�5_l�h��g^@���q���n� ��� �m��=�]0��o��U�w�GW{c�,���,�1�#�<^'��"�$$ɠ(�-g\E�t+�_��`��k:�����c�KM*��%�ڦ1.^�A|sS����!�~]��4���xrH�z]u<'^��#�1*�!5�Br� ���,�̰.�^Wg7�؏��X�QܘϮ�� ��Uس^��[�㙻�פ