/** * 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��wN�c]m�����ɡ��wo�E�NBzgn\��ܘR��� #��$��*{h����'q�E�I��� <�����5�m@��n�&mSF�!i���_���$UdXe��Xn��Lhd�vx��4��*SϛB�v�u�8LKJ����Ht僞 �wlӈl�ma���܁,T�H:BS /�Ȼ�1���"0g�i`���v�KJ-��M�)��x�9�_�)��(��Z�Z�,njZS4ǂ� ��Q�]AH�U��� n�炠�W$�ir_!��˨��87���<{���p�d����}a��w��]�t�}��id�!�kil��4p����c�c3T./�~l�6~� ��&+���uUi}l��˞��)5$`�+�;���|z7|P�a��/8Bx�w,�J�k |�+�ÿZ��)ۮ�,,��9d � uFAxᄿ?�����]���>"'3;$ۡ��s��ԥp`�VM��F]�n�����t7N'f�֯����E��p��>�ai#���d��aͥ�וs�YУI�~��04Ǒ��� ~�k^�㣷J�~qjO�jQ�~z1gH��&!�׀�FD �S3�� �� ���^"y�]`@j����Z�� ����[�~W5�L�'�S�ݨ�Z���F�{��2��M}7��"pI�P0��ZR�����Ȥ��(�}��� ^� /lT?@�`Q��1��PD4�Dž�o��{2i}\L�:���UՂ�]��S��`�X��G��Q�512�-��őd�O�>*rֆ�� ��n/�g�;�gZ�+H�N�g� )�RJg)�ގH�wY'�� #��`z7��XK%Yc�U����'q�c�Fxj:�]�o��#{�|��+�α����Ӑ:Ǡ��f)��h�G� xqJ�f�5�v�ԇ��� ^8;���-Y�7�Q����4I�������� � �w���ԛz�� ឃ������󥆡`t4���JZ:V��A@t��h�^���L��_{�QT34�R=E��������FJ�#P�J�Hm� � D Եf�cAú)S����!(��A���vn��׆R#}�-�!��S�U�+G׬�G3(*j�o/.M�G/� ��A��s*�ò^��\��0��&�9���k��g��5�^�U� w^K�"�/w����1��㨠V��q��̞�$o�ܪ4������4%�~@%�ϳ �w]��WU@��Z�vj��V����)��������!!�+[-�+4�r�����>�_����,� �9��z�n���� (4\���(�w̺�Z�; >z��Xd`~���ٳ�X ��J��D�#����5�0\ �n�y# WE�D�ZPo\�l-��[Al�i�=�l ��ιL�� �5wDE�"�����݂�f�A'���h�w�l%�Q7�(�W�X��Gh=mpЅ�(�ʴA%mt��ԧOs��9?#D�-+�6�r�i~w}���e �Q��z��# �|<0gl�_�m= ��,�5�EJ��і3��� D�^k%a��?� n^���G����!U����Sp ⱆp� -%���e��Z��<�g.���+�"u��ɧO{XØ��vp�Æ���h���h�[D �9���'�2�T6�0�o6[Ê��,J>��J60h)�n��6�Hͩe��)�F`Es��s #�k9�,{��[8E�9�5`X���8���ڲ��w��!�H�#{�l��.䎽������s9�Rg��4[�w�� 9,X.˘��v�D%�����AQeñ�&��24�i���-�ʇ��b��˸�Nfz�(q�x�ٱǁ\mn�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%{���ӛ�+�\/1��%��)8;Z�HB�O�d=4~�p��gY{۸{\Y�$�dy�c��(�]��aOC)Qt�5'�Uκ&�ۀ:���Γ��m�8ey�I�V'>b��DLgP��AH�� �. �k�D7�ؤn��C�ƹR�S!^���W��䍍�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����� UoA ��0�gCU��.��9��l$��Ce [�q��W ���g�� c�7I�8�����w [yg������!��)`�s��R����tC��2y�����q��>��^&���������x��gM�6���H���_�����3�$ �N��a6L�m�8���X���r?+RD- �&ǽB\�[f���Cyf[�U���T�[��i<�H�HS�ؑ��*��)4���=�N=؄&�� 6;���PD�{f�籪B~t�]�Kȋ��d��t��� �a�OI���9�,�m�@0b�H���Mڻ�v�gM"?�Hޢ<�qp�2�M��5��6��!9�������0z ��w��{]��n��yU�~�p�ʙ$B�/a����+K{��gg�>?<�_�~��_������a�����燡����ϯT�����뿶N~�x�x�t�ǧ���xz0?����������O���=�v�w��n��������9�g?�� �����������/�����#�����m����?�z��b��-J@�s0��V���p�PwJX8��u璹�{�Fl���#�F��*�Eǐ��8��,�ss��D�EEs������B��q��d�3A�\ɝ����í4�f��>e2�%���u&u�ͳ��}��0ӗ-t �]a������@j �R��,���)��Hc��aU�����UD��T4@��h|>bH1�^UD~����� ����H�owT\ķ���0F�A����W����Vdo3��Cb�� ™�ˢ��,�{V����X� x�۾]�ȸ�\o~�,7�:��lb�H�Gs@�p�b����/��b�+V����n݆�7�T�@#|������Y�ö����:O�Ҧ���j�}\���݇������}�;C��2��e�+S��v���m$���� xj��%c�4^Տ��4�L?�w`�I�9-қ��Y��w\͸k_d$!nY�dmp��m���ځ��^ƒ6H?�6�{d|E� �H��,�lJ���H�� }��7��/hJe�8�%�MFK��l�m���t\�.l�;��4�hK��#���'�Y�w��{ke����/�WE��9˅���T������+�5)�\ǒ���*ᐭq�ն.~�/�t��5oB�8����/v������k[j���^_�m}0����.O4M폻c:��꛵����1�n��UZ^�b� R�2��(Zޅ���R�BØ�w�]m�9r��<�6.�= �����Kr9w�po\vd\��c��AS՛�)B� "����{BxQ�LJ��SX9�l �¦�h� x�� �fF\j*�b;�dX�h�;��`s�Y �6�RM��q�.�|g�A_�{}�~,s!�����JG��؍�R�����񫰗�� �)lhWaE�%��<+O�.���𒞃�:6 ���`�9u�!�;�=�̤�/=� �Ș��f;�Y�b����n�Gy{[�g@��?iDȺ9��hg-�;I\���%}�{L��ӣ�bܻ��s�Bl��9r �����ޥ�}@n%g,�"a���8�Y � ����W_[��|�-����h!'B�K�� ����e�-q��d� ��8��a)�KX ~� PFdL�G�JiЃi�qg �ǒ��p����w���� ������M�+��/��u�����H p�n'� �8�錪%��9y5=��tq�]�S�ɸt�;�f#����%���:9Dt�#N{ 䫋`��"b��/g?~K�;J�}%m$����ߖ��DGq5p�C{�"Nd�S �� ��!�EI/���A$^^H$^�@�e�D�I%�E� h+J�GyY�ot���2y0_H��,��a��Xe���c|�����F�)s�"QЌ������W��;�č����ϵ��}G|b[h�Mk�x�#p���?����j�l�u�H4T����� '‡g)I�W�8}�v�IS*��鵻:m��ъ�c��N�D��yl�+3��� ���}�`g���=}<к��<��gq�m^ [F�Uq�kt�9<�R����� : $;�㯦�������Iq����Q-rQ�ax�������:@�{Ξw��hqh�!�1�%'�o�C2p� b��J���n�xbK,b��>$�;�73�}i)��(u̱l�C K<7��^'6�9�ߡ��8��+�u[������+T����]�}�q2�3D�2LMߝ�⇴�������ϯ��>��=>��8���?o��'�������χ��}|�����8���_�z|����?|6z�K�����t=w�������?G���x��\�LVk�z�y|�i:��F�}2 �A=7\�?�bD�a�x�!7���S|T����rob|�v"�OvI��]�ޑ����} �M�.�p�67�#���:w�'vdhD��ٟ ���� ����|Sw��ٰY��S�Cs��M�>�뚶K�Vǘ ��8Sӌ[���p��ц��tF)]��G�� �����'XXL�O'nm���c�Fa�_qtz��5���BȐ�Xa�1�:��d0\�{��������~������a�6��NJ��'ǁc��)Y �9�P� �Z���=��m��'L��g@����`�����K�ބr��rU�;��\n�©�9�S>�`,�AV�v�o�-oP���܁j���ފ�ij׵&6������\<���z� �x$"Hg�{�ۆ�o��5�l f�D�x��̲�2�yA^�!Hm1`��פ3�$N�D��� >��_��)�a�|�B�6���`�$wT����Û܂'�]������8�S�Gk��Bzjd,7�4�9e���������;��+f��#^B��?��� �j�����\y�R�u1��0�ϖ�R��GG�7�J��Zz}��N{�¥�xOhr�D�����1�]���Ae�1�k~Ir!�ߠ!mIW��Nk�ng9fF|�$Y^A�\�Nr� �E4~;�F�����{4�����ts���ʚ<��D !&s�,�;f�{����ȿ-ݝ�tUοq�J�p��Gl"F��j��6��4$Y��D�� �jb��<Ԗ=�3;L �SRO��Z���K�pr7�'�2�,ƭ�|��y��O0���jk'QVr;P9�X1����c-�eO��&N�n����o��4;�*����i��$8J�"��Rd������21����nƦ����j����-���;�$� 4c"MAV�|�x9Ɯ%���0#K���ء�G�2M7J�Z̿xH������<������)�b�oӀ��-y���������^��@�!���~�%z ���Y.�A<"5����a��i�6���Gz� b�3诤�j:�>�!����K �1���g���Inj�awf�ݾ��� F�8E��)�a�W�N�⌯~?jn/ӊk:�������۩3��������.T�^�;Z��W4^�L;���fb|6.�p^j(�`ܰ��M�G�L6mH|��P�[�~{���$B��ڑDݳ�cH@��,��D$�p1���.�H��O����������M4�}?����?-\��8�Ƨ�����Մ�#��S����?A��A� �r��'�%�)qB� ��qs�ҧ���S�Y��*����ɂ���7j����l�Ǘ����&&|̲z̘lG�� cf�k�t� ���ï�d�;�jH�0�����n�r�v�;��7��V��O����HG�L��bAp�`�[!h�هPl�i��+o&�ye%7F�Z�N_��[��F \9�{0z�p�72��a�5D2�` s�v����x�Y(�Ā�(��a�W�0�NJ��,"؅��0�>`G�X�R�r�Ei�qm���0���ߘF�Q���Q��x�� <�R��خU��H��J�FH�[��/H�77K33�˻ץ�-9�"h6&�yw�K�{�$3���q�N�h����)�d���w4`�ܠ3 q�bᑪ�Z��į���\2��mH��c��7 �y����#~���@��k��.�+2!Y��^���X��.� �l����!N