/** * 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�HQ޲d;�r,)َ���& �hk���y:o��}�|ɩ�n�H�"%%3s�( tW׭�����t|rt��� 2�����>~��=�z����iԴ��~�\z����k�1�;�2��pw���f����]��JF!��QQ�V�]jz'�� �Q��1=��ǵi�X�S/��d�xQmZWb?6]�2���~�KTC��o�*�U�D1��Y�����&�FfѸ'���Tv%RK29MBkD�����K^RjK����k�_�ؑ?C�E�rh�r!�K���"�aԴfM7jC�L9j���*�W*�ez���I���]h,�Wq�yi�^��-��������#���=u<۟�Ӏ��/�)�c�F�G�����Е:��O�O�H��~8�Tc�4�u�O5V�SMo��Z�TkWm�SM�%`ʫ�7���rx7|P�a��!<��K�ε�,�+�_��O�X�r'6����A�J� �p��.i�k�mՐnn���G�l�Ddด�7�eH=6j��`�Yh�G��חfH|9�i7I'V�V��p����u4 ���(�:T��1<��S���zi�z2�To��"@s�!�M��_��OOު���3�U�j��b����MJ>� d�����V\�dM�w�{Q��O_y7V���=�j���U�\��|l�8 CsV��x�:��uP�6V�W�O�I~(n�ݐƓ�#�J�f��^A}�k�I{�^�1�|S����G��WL��F�@����X�^tU�n�F�����D���4�Q1�V!��}4r\�M��߅�؉@�B��E�s;�6�����HYX�g�S�+�z׬��#(*���W �PU'S��ł մ�� �k'����H�'o�x��bu��s �e�pÝ������)Y�A{���W�z�a�3�/s���*�=��$o2��0����诤���A|����hP��N���J>5�9%>q�7��#hH���VDK��J9����O�‡���;K,�~m���[ �(~� W��j쟲.�R�N���s�pT�'99Ƚ|V���W ��PI�r$Y�$_#��P��7rUTJd��U�GZh�n� ��������}o�e��mتx=*:gt!E@Ā��5W�:�D�D ���j<�^�Q�����>��j�� �Q�ȵA5kt��ԧO �eޜ��閕�o9�,w�{o|�r�(H ����H���L����|[�j7 j�b��,f������9�P�������7���g1�g�{�CU1vx���T>�������6r�F��;ı{;�$����}�1��E�~�V<��Q�P��A]�w�pk��QFjLm���N��+˜K��k�`_���r����sIP$�Xc&|e����֖�D�k�:�#!��1V���]����M����b֕�LPwi���":��`�,cl�C���h��^�E�8�UL�����8���������R슁F!�f;��Ya�ľ�[_��f8��$��"�M T� �Y��11 6f��8,׌p���:��`TME�O���..PKז��a��`0�f�WDjݨ��V�����3�:{�\usƃ��En����M��Ĥ��έ��j�I|G |�����z=M�b��'�tU7�t|�q��]\pޯs6�0�����yd���z-wBߏ���@k+���*���D�O̐B�讂j(�i��+��J�C��-@+� $g�BNo){�w���l;d��������(��y���rkfz8q��2 �k=6��]k�A>91��k�&0]�`��޵�v9ܥs��JH��<�5h9�;���O"Q��rZ{�Ě+cb(�E���"�]A�2�x�o[��*� �0@�v�m$��D���.���� wZk���:���$ \��7u:/���� ��KE���0-Q��M��p�7+-Yo�e�h�z�hO0��7����*�5�Iu)�y g��j\N��Ё�����dCە��v+��@���*5Mxh�Z�Llʺ&7b��̴���j�9RB�֖-�wq�2Ӫ0gHv� ����+��3h�B��׼����.Ҝ��Xa�,��Wl7�V+>gs��X�{Ub�5�*h$i�h��ͣ��aa��𿛦�ƮܾU}�&����M�U���@�V�{爀�F˩�ߜ\�B D��V33 Hk4�_�4�%Mnkۨ=���!b]�u#qo���gd�[�'v���F��Jߢ�xF��hgtw � =G�.k�ֆI]�G� )�VS� f1��kz�U�n�jFc��x8��� Z5�R� h�:�RsI���?cd!��Ch�C^l|�� �-�Bd�Zt��5��(0-�:!��`��6!/�3�V{H@��M�W�+ Za��*�6����� �]i�Z�����0�7�@u�� ���L�?՘�Ť�Mi���.�hj%��J�wd���.� �j�J�X\�'8���C��)`������ ywP�3ѐVT'�S���W�����x� f:v���32��:��[�f>?�i�X��F� �cp �S."�@|+۹�^���E�nj|+ Ä���ӡā������kiE���ʋ����1-���Fs��9�IYudF|���[1"&�fXY>ʩ�'8���fMt��J0�AК�l �t��&��W5��+�/�U�������4x$~'�h���ƚ��-��Ƙ�-��l\��Y����)ڹRK��x#��H F���'��f��܇����>Dn�����/���=�}����< ᵽѽh��Gݿ*7�\�6�M���E[��ݟ�m���� 乗�yw@�����5|�������>�T����Op}vZw�]w���|�]Mm#_ugQ��Qw&��7ݲ`��ie�0�XBw�ňu�d �^,�C`���lu�~ nBim_�_|xH�JЗ���k�������eK��ci<0��p/����L��^�j� ���ØbZ���Z½�dhJhW �E����V�np/* ��l� �ؿζ��`�_o(�-1�!/Xf;��p��\ ��;c�*ù��5q�H�O��o�"���}��l+i�?����m<��5��]os�mF#��辻�>�\͆Y��^�����O��<� m�ŗ�{Iq�*yK'R"�W"h���b�6E�f�Sq �'���b˫X���s�s�!���e�`�x<����ڷ�� 윁c9��>� �%S'��)P������oM�*�9[cv�[2Yj?����g��_��խ�3���%���s�`-!ևG����ca�l5�HV����VUƽˤ,SoU˘_ �#�XS⥶���X�\O֘�1�o��ތ͌�n�*d�Ȝ߭����� lP����yGȸ���䢂̬���B�ݯ�2����� �ϳ�m�j�6C�^�3�%S�J�V� ���ڗ�'0�S�v�ׯ� u�������q��I�����A]'z���H�aeaJ�:�e����M�(�؎�{;c�c�r0����r�0,�h��#����U�"�Iů.��;�"��� ��|k���$t{�<�ß/��r,��׼��ք�J/{���%���ש��Y�����*~86�����Mn��*O� �Kī��<�o��6n�����w �!��F[mvɀ��^ Ck ������ � ��4�"JZ���3��j^� �P�2��]Ⱦ�Z mm�����O�Mo������&D>� � �������jK�\/0��%���)8;�F��0���yvh�<��>�����q���I�����OJ]��COC)Qt�5'�U��"�ۄ:�����Ͷ��� ���4H��S ^�BC"&��PUAH�u ���D7�ٴ�L�!<�R�(�)�g@54�e��q}3e��P��A���dkl1? ��Cac�=<�\���ɭ�t�#6K��n'r"����ؖʘn t���5 Z��B����e��:�����c03V��%�#*�e�$�S�Y�4bj-�v���[f����}(�)و������ V�s�y{4�+߇��z;�۫�!�̃��M-?mCY>�MD�Xf�1�����p�%ixI>�n���Z�)'D��ˤ��E c�u�6 ���q�K�`�;*�,����SQ������ò���%L�4W�y�k�,�R�sg �irS�fԡ?LEO�ޤ�iO�[���V���a [;I���H ���獭 �o�'A����c:&܁l�b+��2�`Y��̅�J�þ;� �?R��1y�����+|R��\�ɫ��W�����7�5�6�����{�_픮�'s�$ �N�1&��� u�t>V���0t��6�z9�������0z2y���vKc�k sQ�_ \�J. D�Ѕ�K����R)��H�J�~X�3��<��=�"G������O�S5�f�fb+L�J^� W�b�Zۨ7��vCo�i5 �پ���9gz��۷Wǻ�����{l^G��/�?�Ҽ�W��S��}�ӫɫ���^������9�^�����|8w5�w6l��'�0�{���w/~u���?~��������������?~ �?>}���/��~���٫7��S��U�U�l2_!Z�1K@�q(a�ܮ筻�̽��>�� �B���Io��Z�/:�ܷ�3d����+��'�P,*�e����4:-��p�$�) �Ji�j <���m�\�S.�_é�]�RG�8���7�s}�$D��f�8�)|d�� +sQۋ����!���1���p�+�!“�h�Z�*��H4>�1�:�����_����"�\]G��F�A�E|�{ c�]��p�*�����L���8]��ڂ�g��:8����j�.xl^��?�-ʍ7��0��7�=�Q�@�#�1�X"\W��P�@1�[���n݆���)�(F�bawM�g��n[6[�S��X�������9/��n�����K��8>�� ��]Z��d3�l�1�q�;�'�L������#;��&0G�q�3�$]�"� ����E���GGK~i��^?�\R��~a6��挒ٽ�^�X1k���F:TVPă;,ؤΘ��۠�w\�� _�'��Ek*�q�������ѠCl�Lg����g�[W�_f��˧���w���x�Q #Q�h�5��#��$�ah��\[)+�Z���ȳ�� ��=��%��/��F����W��j�-���%%f�^�ؤj2e�k���Ƽ�8����7p��0���0�E``���%�uߠ�%��!��OI�@>�'����>fLĆ���y���]\�k �Ym�;�j%�&���.Z-ĸ����&�3�+``�DV����$�5]ן��Xu)���ؙ)\��3N����k�Y3p)V8 b����u�p��ֻ$p,\�ש��.��>�<��Ah�0�]�‰Z<�+~���t���W$Rs��u�d�F��jfķ��� �?����X��%[�v��8��ՙM9q+��G��ڃ����j�zQ�8qA{Zg Y��۫i8, �h����E�%����VZ2�6���VM��D5]�k9�84���"�Rcӎ�:� &)�,�|�?�W��ĥ��T���`�g��ټ���6�?��@3�bg�U=(⢍/�Z ,�������"٦����\T�"�� ΅��׫ ]V���]�C#�:.��s��ʻ�P����D'���cs�b�`ރrY�����`��'�m7�9� +�{F��l�}�|������= ������݁������*E4���J۠+�'� XȯF�I�Z�3Tձ��11�\���C�_���o�7y((�@�~AY<��/M��P&gd �5��0��P�q�dv����NS`1"�Ca�2&�OI������Sb��f��g?#���� K� ڤ���+�����M �����&:ùs _1N!p�n'� �8�ϳU՜�%�W7}�|���g�O� ��c�ʥ���V�i`������aXA�$�-��k��x�$f�'�g?y˶�I���WO w���V��@��N:~쥲��~i{�L̐�"����� //$/\ �Z"�6��+�}� �os �kJ�C眼,�W��c�<�/�a�\�xK�0I ��R �1��I�`#�9A�(h&ol \<'�]�*8z�CУ�1�Ry��+�eG���������xG���Q-?>�������9"M��8.���\8>��[��w%L^���$�6��-��8� ��]�J.�ƅ �� ������ �X@}>���� I��0�x�?�)�0D�L*$���J�� ���J��p ���V/��m^��s.-�LL6�÷\%�3b%��7ӈ-&��!� ���D�S�e�mNX��m�a� � ��u���̪}:�x���Zq��3�l��v�a�j�7���=������S��WC��ޞ��^��7����ß���E���1{�ޟ��o�7��8�×�������_̶�����i�w�?��������C��?<|���!���?�?o���8{��>��7\cw�M�Ǧ5�$ �Y_Ɵ��5 ���n�K���vZ�I�$;w��-����lxg��ڒJ&�۞5 ��H ��[:����y���HW�C��:�X�\lj���!6��r�G#�'�#x|bhl���.�3@X�!�]:t�ܿ��^�$_Hc�I�`CPx��uuw���*�'��)�����^�����]q���1����1ʽu�������Ù��w'j��-mw�b���Td��7����׏�n�� \鐶�R�mCi�6�8��;��wn.����7S�շ�Tʱ��{�Ĕ~����[�%&@�6nV>v"k�~ʘ<}�k�z��u�Ms,�'sI�����q�������p�]��O�)ϑ����`a f*lS���4i��^��ț�ƿm!i��\Ȑ�ZXb� �*��e0\�{�o��ot��0�6���.��.ă������1^dZ�� PMrʡ��riZ�=��{(�T|���ִ��ޢX p �>��1[-��6�k��?8YW"�{�G]6 �_#Ȓ%��ݢ� *پ^�5OM�w�^Ҟx����&Z��K���Yo2C��D�b;c�t����:{[&Q(�-����t�@��RN[ Fs0ĵ舅=�!1�<�τ�y総p +X(����Ӥ2���� �:W��utSX��+6�>�\����`��|(;c4���-.��m0f|�����`Ƭz�+�����d^����h�kF3��j����MY�{� �x�p���F����.�G%��;��K\A���WV~�V�m^�]ur����O���������f�^�C�Y� l����^����1;s���|�ʹB�� R志���urMJ������5&b�J��-�]S!��vr�J�2���v!���z�8���ǾM�;�B�����9���=���ʝ��I�yY�\r lT����ɩ*��-:x�2��]tQ�:�H�n؇� �nK[ �^����T�7�������)�/MK�K�a�f�zM�����Un��5��?g�9G2wo'^%��G����;璠�|0�T�4�J������?[ҥ���Ŋ��YN�?d���l?��^/c'���ݤ �~�Hz0�K�F�O��>n؃>�G����;/���S%D�η������퇇�[!��p���]�B�-�Ki�x����ȶ��� ���e�H��-��B��z�nV��rI��DoH�ЖK���xIޕwSpgP)�c�Z�WY��C�����vRe�׋�cI�N<�?V \��$hn�$pa�o�~#n��14q֌�O;�&�Qby��� ��ܧ���H�M�n�9��;ڡn>r���7G������d)�h(�(��A�z���A�@�����W\�G!�Sz~1����^G��aw���մr]���犳t@3��v��,��ӯP,�Yr�_qw�2�|�m��=)9G�^��ѝ��� ׫B�x������]�bI1�L�/��� t�O���?�ؗ��,��%�:ۑ�zc����-]��#�z秐�\_�4 ɍCH�P=ER�Z��h��Q���&��'K/i?�o��S���q�;��8�(�r�O5��) b6��'�)����cj�����G.��&'lj�IqJ����s����F�p�5/��ET�x8�Ј?�Jm/y>MB��2t��)n���<�����Qq4/� 2f�`��C�����;|Ȓ ��!K�0���7�k�����PI+�/��m�<�Q��C{�X�X�Ŗ�f�N�?A@�{�v���n���^*ۮ�5w�V�^��•�|0u@)��[I���e��)Ȝ�}�Q�:ٷ{��#1 IE�8l��*�sq��E]� �i��#v���.�@Z���k�ƸsM;��M��2c���u������ST��!��U��x :�t�ǨTo�Ը���zs��f]޽�ݭ+�C�� ̣���ݳ+�&�������0�{��/�L�%'lޛa�����jF�N�txD&x=.+}^pn<�2�7ۯA,�vi�7����/#[�7�7���T4C�w���FG3��f[Q�ލb̠