/** * 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��gQ6$Y��xcx�.�w�6���#�'|��ިԿ��C��b�˕�ݤ�Y��F��#��0(P1�n�� :jW5���=P�#r:q"2r\J�/�eL=6j��h�Yh�5G���fH|9��^�N��_���Ń�h�=�Q��;Sx2�A���Kr�������V�ًh���Am*��A��/�tr�V�Ћ��Ѽ��7�k��nnR�A h kT�@��=��&k2��؋��v��;�:$���)Tk-p���@.��}6��04�5���'�S��\�j`]�{��1��⦾�xz$V)����+��~-2�`0?ğnꙂg���K��X�4rͱ���qf�����g#��>� M��w���i)ذV����TDk���sS*gq$9��ӧ�ʜ������o���=��v�V�wK��R�9�R����^H�����=V�I�:�Ij#��I�?ԇRE�Pd�o=��QR��(4�l:r<�9 �#�#�~��+������ӈ�#���{V%��h�ǣxqJ�Cf�5�MdL�}G�dp/\�]UM�,�es��b��C2lI������ϗ!�c���H�����f����v~ ɦ���@�hi�u�M�:��� ,s��~���q͔)h dz�1�;��EWUߋ�(��P���&;*��*��Գ'�kCú�R�П:(��C@��wn'��F� >�) ��${�p������xe@Er���ʢA� ��dʼ��XP�������z�D1�5����!e_C� <�~�����n��Z@s}y�4%�>�y���Z�g'=�2gT���gp�� �hH�f�! sij����*��g9��:Z��i�f����ꩭ�Ss�S�g�{Sc�>����mߚ���K�"u��ɧO�X���~���ф�x�8�`ǟ� �5�a���2�T��(�o6ŠG� �J60h��n��6�HM�혃�)��"��t������������-��"��s��++N����l' \s�' y�L��M/ރܡ�4�^.f])��uWf�(��i)��US3;^�hDS��B6(*�1�b���M]ā�7}�\ЗbW 4 7��� �%]�����04���&���n���Q@(����i�1�&�a�f��O�hױ�5�j*�pǾw~�Z��|���G��^�xE�6�f�i�qRB�vfQ~�����`-�!7�Ma��f]xbRYP�VM�t�$�#>� K��f����a����tU7�tz�q����sޯs6�0�����yd���z-�Cߏ�‰>k+���*���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�>f�ؿ�Sǝ^����y�Ҵ'�aWӞ>֚��;l[4�8���ұ���eܶwqkK5Ҍ#�[qkKQ4< �&�N�Q��'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�'>���u9x�%���h�tw,,��FZ� wy�Z��eܻL�2�N��)�`>��5%^j��N���z�V��4��{363��(���"s~�����"�*�A���!�����k*0�����^�_ dps��ܟg���E�m� �`��!J��'�Z݀d������OEڅ^�����ʦ#s��?'�uRV��ku��L�΂"����)��`��#�{KwD��v|ݣؙ��d��HD������a)D��)ō�X����9�5�UI��ϑh������t u$�Lo5P>G�~�ӟ���c4�"o�o�Oco�Q*�J�-@� #qo��C��q>�%�?�� ��s��-\�A�E(�J�gW�$\ˆ�_����n��s�{�:�%���P�jխ)X��.�ƅ��i��a�:����������pM���� �C�0��`|�V�ñ�/�Cj��__&�w>E�;��l��6�������0b��˱@&^�4�K�_�/�t�:�5P�S������f<`vP���x^�q�=3��y�xU�U�@���;����X"����Y�?$M���=2�����|4C�=��W�Oχ��6B��H$N��x2�΃Rρ�ķ�e4W&<�9g!<�̡Km��۹(�B�}$���˘�[�K�\/0��%��)8;�F��0���ysh�<��>��c���q���I���V��OD{$7W�:�J��b9jN ���? Է u&�W��'{�7�*�V* �r��6Na$x� ���*�28�,��l�:.���D7����L�!<�B�(�)���@54�e��kC3e��P��Q���dkl�0?���Cac�=Ǝl��S�uʼn���Ҽ�͆���������xE#eV���m(�g�)�h�,7���֔���$ /��ӪU���qB�\&Ř |,��'v��H��,霍� �@K�XVJ�HE�b��I���b�*�RO�2�e�k�,�R�s� �ir#�f4�?LEO�ޘ�iO�][���V���A/�����Nf��wa���V����$t!v܂`L�d�;���3ClEP�,��€��Q%{�w纡g��<~L����q� �e?�x������bz��ͳj�rv8�ݱ��pJ׻��G�A���0&�˱�&�|����y�d��)���oS�^!���m+�M��2ql�*�*j*ɭj�4L�Bd)_�X1 �{�<�%Ǟx�� l" �I&�g���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��ǧ����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��u�W��U�݇���f����ʥF'PD'����Yq���Q| �[�����������x���9�q#��QD<�c�%�u� �#�X�uj�����m(qqʚ��b�/�v��z������a��:�������z 5�>)����������}}�{<��e�ːCVf����RDD����#�s���)��,$?8�.���as�A��m�0q~��$X8�%� �z�y�||$U�k�� ]�����aFv�a͊�c��J��!^_��r<��)���^2T��A + �Avia��,����� �0�EJ0�N4! ���TDTD�Jq �}�h��!��\P�R~a��/�L�i��^�X1����D�Ţ�[�M�Li紀���q��6|E����K ��z����[=Ek�5�_�a8�>]&�3d4T���������d�ؤ���������ݥ��ҩ� ��pzS�u��Z���F����O_�Ŭo��+��>��=ۿ��8W(������ z*�5���5�g�=�?zI����ፋ*z��&s=���.�� �h�ɕ�E�%ܠ���VZ2����VC�E ]�9�Z��)���4��q]V�����o����Էg.m��lo��([!��ff��m?�ՇN׋�������=�������qk������v 6D���*�D�Z|����X�߬p�< O��c`<{��w]�R���l�J �`�vn�'[X��1:�% ��g�1ibņSb����W�D��!!�\ʷz��QÁ���x��_����R΂j)Jg����&�0H K�}��bD��a�2&CJ�$S+c����{A�y��">.�SV<���\(��>_ �����m��?A�((m�3�i�N#��l��v2�0��[�ͩZ;{�W�w N���%<�yj^��Ǔ��i� �Ty�t�"�+�������x�,f�'�#g?y�6�I�}�k ��;_�oS+Hb���s8 \SJ���i{�L̐�"����� //$/\ �Z"���<�J �kJ��,�7:��e�<�/�a�\�xK�0I ��R �1���p�`#�9A�(h&ol�\<'cc�*8z��ä14Ry��,9 휳���v��Ce �S����4.�i���q�6Wr�D��<%�S�*Gz��~�/mJՙB?#�g�m�G�Iu,�����*;9K�}en�@�1r��<�����w��^�&�'�y�x��–QtU� ����L%��=q��-��b�t��/�6�Xm}>�Ѯ� G�h{��"g1��G�I�$�#�� 0��h��ғTI�N!��Q�&�o�' 2p����&}���d*G,ے����73�}a���(u±l�' K<7���6�8�_<�w���9�U�z���K- =�����+;"�f�g��7�Ï@wZ��������ϯ����=9��8�]�����x�l7~�}7>��?�W�hG���s�{8 Y�=���Y�E���x<���,�� 3\���%ČcӚ��qq$�݈=%�#�)�`�Kw��wa��d�$�|٥.����l�f�H����@��o�%t�.��k+Јt�s0��+a��e�Ŧ�0;L�a��.�x^R~�<��'�����uqJ� �w'���W�� ������y�|���t]��D�d�H"jʪg�;�q|a�en �*ݐ��Ma��p�қB�Lѳ���k�I�k�o��ld��x.���l|\a��A}l|���3�c _�-#�W�^�,�պ�l�QS��ް;�J7�z�ʻ�8�;�Yž�^��iu\Io�6��ȶ�Q��2����Q���ąQ�"��Q>G�Ԓ+�x&����x��D+hM��*�ȄI�]vc�M�g���Ǖ�>��LV��V�B�{D+/L`?�ioR�P�L/Ph�� �>;����|p\���}����G��{�ؐ�lI���J+�ng9aF|a$�~C�\�Nz���C4~��������w<��� ts��䒖"��T �s�,�;a������ȿ-��p9̿q}�R9�p��Gl"FK�j�ƶI:4"y��D� � �j�yj�%�e�1�g@[.�b��%y8���;�Zx��b����x?%r��䵵�*+��K�u����V�2�'As�$A7zM�z�7�*�C�#I��CnRf�Wx�r�_�}�{�����f/g�����st�搏^sU���v����HC� �8^��`I,<�ɒ6�:v��/ �re[K�Y��5�e�ur�߫� ^�/���4�%�}8<:8=��WC_�!�s�>��ϵD�����s��e3�G$Y��8�9ƨj���,��OF8�co۝C%�uP;���i)�76R~�ie?�8|�H;f� ��(���4�ZW0*�)��L1Ќb�6sH�}��2�\�{�uP�]}I����E��k&�g���� �M���`�dPY����l�ZC���!"U֎$ꝟ�@r}n;Ѐ$7!��� pAD��~2=��y�>wx|æ?d� ��c�O3��?.���nx8�A�f5��:e���xD-�� ���A����8�<)N��T8~����>��N��%����3�ߨ�%ϧ�Y(_�8����1�� c�qT G��򂌙)����)2t���dɄw�%K�0����n�r�v���W7��V���'��;y��_��r� 8N��- 4��� (6�4���7��