/** * 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�� /[dB�x�Le˒�\l˱�dg�h��A@]����?�Ӽ�����)�K���q%H���3g�(�tW׭����x�������w/�,�;{���q w:��+�K�F ��= �+�����^]�mW�Q{:���y���9����:I�(��a��9�p'vF~@��UD�pӛ7/|��܈�Q�wS� �-9�"ÑMÜѦ�7?�M��x��]�s(#I��~�<�idsf!�F���K�/�f��s:��mz�{A$Ar$]�V4Y��6��^�v���i8t�q4��p��C#�%/ � �2��% #�"�� ����59t��N���(�IH�̍KٞS*�R���cS���Re���!��� ���<�؟�������:�f� �ۍФm�6$-UU�K�u؟��� ���:�� �� ������fsCe�yS�B����iI�p�>]#���|г���m���� ���;��*IGh �%�y�1r0[�< �?�.(�ZRu3�xS�+;��s��pSMQ�/d����Y",�T��:h�%(�!�$O!Y�eZ*�i�� �:_�0��}�PoD/��g��H����dD���������ۏ͏�P�P�`����t�*<����Ǧ�QT�����/{�ǦԐ�(���^�����AA� ���� �=�* �%� `F�X�j�~D�l�������%0 2��������St��fT�����Ll����I�R����Z}4Y�&u�n���s# ^#l��8��5Z���+���Å�>���Q8��ȞÓ1��5�^�C@\W� gA�&���nH��G^jS�7���y�����*!�ũ=��E�� �Ŝ!�����_�UL5xOͨ�6��.؋�{��w�uH����Z�j}� �\��Cn��A`\ը2��N�w� j��z#�����xj<7�݀F��%�B��jI�����"��F��C�馞*x+8��Q�m�EIǘJCQ�HV�e��ɤ�q1����BWU ~w�O�V��s`��i�Gy����<��bG��?}���Y~��*�6��̳�y�d�i9|� I;!�.��K)��z; ]�eU ��������D�cm,�d�EV�F`��Z�ĵ��"I���v��y4B��M�o^���ol8Ǧ�ӧOC�L �� ߣ=M&��)u��� �i@�S� $��x�P��j�d��0F��b�8$ݒ��V�C��2�,޹>Ro� oT3�{J�� �ϗ����H�*i�X�u�M�:�z� c3��~�}��FQ�hP�H�a>wK܋���)a`�@� (<�#�a+�+5P�:�َ �L��on��ܚ��"۹s_J�p�Ȇ��O W�8]�6͠ ������4������e�OP̩�V �zqr���{��tx��ǯ!��A?��{QV 7�y-!����Q��vtļ����Z�g��=�2{R���gp��(�hHr�1 2iJ����J��g��j����f ����ꉭdS3�S�!Թ�1fACB�W�" Z�Wh(�@��_?} ���1�Yb�sh��Tݒ��P4h�&}7Q"�u���w$|(��a����4���'�g�5�@( �$A�*G�5hA�k�a���`�F@��Z�,��޸�a�Z��������{��4~ϝs�FY6k�DAP1��{�T!�Njac��!���J4�n�Q�����>��z�� Q��i�J��F��O���7xs~F��[V"m��������=�@ � )���W�G��x`8��0�d�zP�YRk��d1�-g�����B��(J�B��ܼ� ���0��am���S�6F;�S>���0�1�F ��r X����p ��sk��_Yqr���e١�WC‘�G�+�p�]�{�E�!���r֥� Pwi���"�rX�\�17����JTE�-e��"�ʆcOLV�eh~���[ʕ})v�@#�q�����1 P����/�c�6ol�X� ���9��,p��3nb�c�8�ō���T�*���Ey��j���/>�L&���e���[����MH �^��������Z�End�������ĸ���͚���I|G |���)�V+I�����i��w��&�%;;�_gl$f2#H+Y�H5=e�u%ϋ�e©Ck˲���ʌ�,�,��B��]Ֆ[C�n���������[�t���HN���֕�w�9X 6�!4�n��^���j��*�)�1� v8��z���x�7� ����J�Z�fKa|á�ƌp��e�����sے ~�9ѩN���^o�`E�����P��P����Eл� DeZ���2ǝu���a����6�UJ�l�O-mb�Ý�V��]Q'�_����qG�E��,��\�-�_�#�6gI����Xt��c��mh�^C�{ �N�'�X�:�F_��v�h�����tQ�)��Wӯi�t`��W�jCW� ���J��$���N zG: 5U&v�*7b��L����z�RB��k����6�e&Ua\!�e'���V�!�Om�;��ڠsy���yas���`1_K��Zm����i MǪԉ��V �����67�n���A{࿟��v�ѻU}�&����M�U��vA�n�{爀�F˩��X\�B D��n'5 Hkw�_�tb�%���+ۨ��T���4=q0@�� ��r�D[�m����Lz�7`tیvJ��3��k�X�]pY�[&u�!ԃ�0\O]ՙ�hz�h-Vٚ~��m����: Ъ>H��k`K����k��!�����J y����:(�2 �Mw�e �֗�B�0!��G�a��nt� ��@��5 m���w0_鬁�����@z�RZ�5 }�(j�����0�7�@u�� ��j���^�Ÿ�E����.��QKJ�W�����R.+��2���*�|q����G�_Z���ih�(� ��q%o�3Кb�`\W��ث���P���܇ڽ�����E�>��U��纷in���/Ze/wR��>>�/�g^���yu_w�|��V�mw�|�v*��e�'X݇݅�]|ם�j#�uWS��W�Y��>��$V��[ �9��f�K�V^��b�%k�b� ���q����܄Re_�]|xH�JЗ���k�������eK��ci��8L���.��%�/�\�%nH��R����%��~) �qX��k8g0j����������. �YZ���@�P�y� �v�4��X�O]c�P�A��L�Zdv1�-��Wk��e��ۇ� �h&{ ��~׮]/�Av|���$�KR덇D�L�d����ң�|����77~}1\h-8�� �T��'����6�����W]�^IݶZY��*�2��) �4�]Ot��ܕ���A���S����9�)�����KX�ᘂ���$��tO��C����}F�����Ǖ�LrM�7 =�x�R�%���1�E�QsbX�k��� �31+��<�ݾ�Vp�Sf���$iup�#� ah@�tV��Q�`��۱p��vLpp3�M�6H9�k��!;��r9�ZV��䍍�5�C�'-�O�K d������QW�m��,X�@<�������[v�$pVʏ�Nh�2J�61�-�1ݝhg�k�tMu�f#�;���z�U�ou�E`f��s�� GT��nQH&��2%h��[6톝�7 ;^m�Pq��O%�% 䧏۬~ �}{�C�A�|�������J� �~�O�P�ϦG�2VYnDE1��)�#\�^��'c�8����(X�L�1F�X2_�쑙�+L�,X���P�;`�O��: �$��L��E.p��Bet�d+�,�R�u����� �e�?LyO�ܳ��O� [��V��š2��øَ竅wa���V����$tv܂`D�d�;���3ClyP�L��€��a){�wg��g�d�<~L����y� �dy/�x��d���rz ��ͳ&j�rv�����/~JV��K�A���0&�˶d��|����yXd��)���o��^!���-3X�ǡ<�- �*��k*�-k�4L$B�)_�H�ug���@Ǟx�lB�I������A("�=���XU!?�Į���be�yRu:�~�r��Χ�m ��E�� �6| ���Q}�&��r;�����_$oQ �88M��&��N^�ݐC�AOE�I�y�;�ڽ��p7A�*R�@�n�L�� �0+[�ѥ<*R$�����Hg��yZ ��-��<1L:��/%*���P�l�h&���,g�,s5˺���V[��Zo�6%���|J�<��4H��'��aØB�m��� @{�Bl���ܗ�9� ��"�䒯P��f�E��j>��I�w�>.J��q:�|�Ǎϱ1щͤ)�'J3V � �Bt�]��3�߈����/3�l��eB��;;$̓�x�����c��ɫ��֟oʻ��DU!��&�a�R(K�.�> چ���q���")ѵ�L��v&b%9<��J��rzq7��6<b��o7*�ak�! ��v߸b�W�>S[�n�W�5�3`�����������������o?����𕥽�3U���ǯZ����/�~z����ؿ�~r�������E��W���R{��_[�?�Z�Z�l ������<=�������o���硫j��L;ֻ�Q7������݋ߜ��v_^���dr������_�?��~����u��ӿ^�zs1z�%�� �Mf+DBk8d �;%,��uѺs�� �=�x#��L�u#� �T���c�}k��S����Ҏ |" Ţ�9�[�OIKc��Ҹ��L2���@��N_�a��V��l�@� �2��Nه�:�:���WľYw���:�Ї�0M�YMi� 5Y���^NW���m$�1�툋��X�ON�*�u�*��H4>�1��d�*"�V�?����u�U���;*.��H�s�РrM���+Ud�a+���`�!�|����e�IT�=+�w�bqr,�W��m�.xd\z�7�Z�� �zA61n${��9 ��f8c �DPU��P�@1��R��u��nC��W* z ��XF�M�լ�a�mw�f�u �'Ni���z5�>.TI��� ��LH��>Ý!nu�2䀕��X;�C���6�{Dp<����-���J�Z��n�����&��/Q-\hi�����T��-�3t����������˕�RC��<�e���ST�ɽx���V^����$$�YdS���ܗ�e1v�pF������-�cװw�r10$l}%?>�����#����>�x���� _ޙ��}3-��f����fT��G�;0ؤϜ��s�,��;�f�5��2����:8��a�;� d�3T��Ox��O��=2�"�s�Rd�f6��z�A ���F>�DӛL�4�2�d�ޒ��%3���,kY��'�Sȵ4�X����b������{Z���%����9%F� ��l6�e�4���dVf��O�!,�F�vp������6���t6.{6��{R\�%����������;��=����2�ggb�⫢�̔��ǽ a�[]�tEo)�5)�Zǒ����&ᐭp���.~�/�r��5oBb�8���Ǻ� RY�iNC��愶�&�{�Dn�۪�o��l郉:�UMTߩUQ�=��죺aVUgy݉i3H 8r<�hy.�� �K c>�}w�A�ȱ�3p۸��,�&���/���q�!�q�Exq�b>I L.]9��X�Rv����E-3)�;a�,�)� ���53���/�kq�9h���8<�a���{���͹g-�LJ5�F��a�C�M}�/�m���!t�ndOlK�*��b�J%��Ư�^���Ǧ��=\!��e�s�<-����K: ��4�^,�"�.;�x�Y��94�G1��x�l';_V�5�����no�u ���'�Y�#']��%`}'����Ӽ�{��й�AztT�{כx��]� b�)2GΣ�=?W��{������q�)FI���ל�� �91� �U5)`��7��-�<�rr D��;��z�cc����ą �����v�d�����\`1$��5@�1%~?*��~���=1�K�f©;�NXzޝ⾧/�RZ^��6 ���D�6��8`��~"���+{�� + �`��֢3�������@�ŁwO}�'�ҡ�4���n��c���c����iN�8�-��.����������-��(�}��n� [jNE����텊�7� �K�H�+db��I$�`&v�xy!�x����A�&��6PX��(1Ld�e ��1����|! {䲰�[�I�c��Z��.�s �� �DA3~c�sdO��������ɟ'�����������3_\2�7?O�����t������9�W����j�`�Z{����΋��O��t4J�Y����A�#� s��G�YWƟ�C"Д�Ǖ���;�Y}�K����J����,6�3`�n wy�#�� � o�t��L��Ј4�?���A�������0=T�a� ϧxڴ�u�Ot��#����� � T� �E{�]B?/�?��?Hc�I�`CPx�꺺��|e�I"jJ�g��C��~i�if+�:6?�������1����E/�> �5Zc}��zF�?�c�]�PzSG|��ؗ��<>L���M�f��X�>���:U��1鷴��n+U�*<��P�Zq��|RbOs�h9�WT~Q��T���U7g�K�$~�[�{\z��"���h�����٭P��ҋ#�Ovڛ���B��$Z�|����BW*{�^�K��� �kK���u�X�u;�13��� 9����2v�KW�(�A�{a�0J���/ܣ1�eD���ŗ���'J0��g��1��� ��F�m�֜�Kr����gW���� ?b�1Z�U#5�%Ԧ!ɲ�%�^@T�]塶�I���aJ���z ���2��-^���� �=���g1n-�+,�{��{�!��NV[;���{�ʱĊQ��k9.3xb47qt��/�#����UqH�$O;�&�QbY��� ��5�'���ٍ�nv36͏�@�|�P;�Go�h�5W���i'�Y�i ����1�,霅�Y��Uǎ�`=�ei�Q��b��C�g��uյ�l����KɈ� ~�D �oɳG�O�?����F@� ����s-�K�l,���p� ��!�_l� c��HC�!E�O�8�co۝A% 5P;���i)��]R~�ieχ8|�L:f� ��0���U�\W0*�)��L1� #�ttzg|��Qs{�V\Й���_���K���u �@$�fot�j��ҭ��:(�M��q�bg��Y\�5�qy��RC��|l�?2f�hC����j��c��� "U֎$ꞝCr}f�Ѐ$' ��ь pAD~�~2\ܣy�&Hx|æ?Ҿ�{�ԟ.e|����pL���j��t���-<"���4�� �.���qbYR�'ĩp�7G+}�iH8埕�� *O<�,hȟ~��?���x|����`��,�nj��Qq4/� 2f�`��M�����;�jH�㯆���a��i���/wmw� |}*i�W�~�)�t���Z-� �l�����}x�����f��'`PVrWt�5���n���n����w�GW{#�,�FZC$c 2GlGx8��w���"J Hj����q �y��~�"�]� ����v(��.5)GZ����p!������iD��%񏉧����A*����Q:�4�Ǩ�o�Ը� ��~s�43ú�{]�ݒ#/�fcB�Gq�>�>[�'L2SaϚx����^��H���~Gv� :�)����EN?9@� yM��%s�؆$;�:�P�}̀�g og9��l T4��Ի=—dB��{�pi� ���31`�A��~ b�#HC�x�7�x��j����^�%��Dk ;���Z��mY��?*���ߤ