/** * 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\ye*[�l�b[�%%;���@�� J������y����?�|�Tu7�)RRr��ő���uuu��������Sw��!���� Өi��gQ�o��Kdz�K��2�S��s(o����fD�BW� .?��H�T�p�Qe-7��ҏ*+�Q�ۊ�4?�]�k|T�� @y%���]�� 2l��GO��C}S�-A�ca� ����#:\dzܙ�t?G,�a���(/��4t��bH77{��G�t�Dd且�_tA�z4l���̳�tkNë__�!�Q��%�Ī��u�Y^<��f��S�Q�6bg O�4��}T���- ~[�n���=�sϴ�[������R����B ����*N��ANR��N���>�*��"�~#0�Y���Z�F$p�t�xп<�G�G�7?�B�W�?4���ӧuGjA{��J��ў�G#��z��Pk�4 �����A�p)vh5�[�To�� �#.h�aK��Kh+�!�}�?f������z��Lឃ���������` 4�:�F��O�A]@t��h�~�B�\��_��A\34�2=Ř��������JZP�J�Hk8 � �Գ'�kCú�R�П:(��Ch��wn'��FR#|�-�!��S�S�+�׬��(*jdo/�,�/� ��A�� *pӶ_\�\��(��&�9�!�k��g��5�^�U� w^ �b�/o��d�0�`�_+� �g_�j�?� nU$z I�l:�a.MI��_E��,�]Gk�4 �,�V�Z=��|j�sJ|��uoj��GА�祭�V�J5����O��/a}njw�X��b=S��Q� �Iߍ��?a]n��� J�pTo�r0� ��I��;^ ,�B%I��ʑd ZP�y�/�r7ؼ���V!K-�7�q�Շ��� ����^�� ����\�Aކ��7��sFBPT@ �n�^sU���ZԘ5�;x�O�Wh�+j���#��58�B~�ڠ�5�Ae�ӧ�� ޜ���V��o5�,����wo|�r�(H ���|�H��M��֗|[�j7 j�b��,f�����Q��EIXh����Wr���1�g�{�O1vx��¥x�!�xCKI��`�V�#���[3t��ƒ�H#n���>�0rg�T���|4�4�!�=��g1�dM`8�ˠ�)��(J����İ⑚G�'@�ME��í�F�)�s�:��c.cp�a�}-g��e{{ 瘠H4��ƼA�'��[[��9�����J��K�+����t>g�Q���o}�]g��|s�HƊX7*�>V �Y��11 6f��8,׌p֊�:��`TIE������QKז��a��h4��/�Ԧ��6�=nBrh��,���Op��3��=�F�) ��l OL* �ܪ)���w��:aI��l6Ӵ= 1�\���F�No2�Q��s��u�F&s�T��7�L�c]���~���,C8AcmY6��X����菙Rh{��Zr�OZjs%PSn�ISm�d ���@r�-�� |w�ݕ`��'���)�1��PQP-}�Xc?�0���p�Dy��zl�=�̠��81��k�&0]*`����f��¹pl9��W[#��ΝA��g�(V�9��eb�ʘJck��zW���L+��ְ���8 P�^�F�JI��������U���Zg�I�� �fa�"�Ӳ�ct�s.���/`�3ôDMo�m:n��Y�4�V�a݆^'�L���v��Cb�NtM{R_J���v^����t�:0��i)y�ah����n�^a���Z��m톖�� ]���If�`Mb5�)�C�6Z�wq�2Ӫ0�Hv� ����k��3��BZ }�}y �ȁ�Ne����t%�n h���s6�7t�~�N���b@�$ m��yt�4, ���{ih��[�j-q���dXUZ$��7p��j�������-�@K�3���V��I;!Z�cm�gї5Dl6t��D��E���������H3_�[�o���n�`���s���;�z�6L�=B�IQ���f0�э\3Л��u�V3�:����U4�Uc7�߂��-���^�A�3�@b�&��K�0���gh����/D6�U@W X�X�ӂ�� � J���2�&�tW��D_���|����b��HSi�V����h� �˲g��߄jձ�!P'̃k "�)F���6�H����W[�(�ZV��AF���R�0�F�����f�[�~��F X��/�`�0H^����_NhHk��q́)y�ҫ��� �H`*1V��E�{�]D��f����T�l���2?���E&CSA��jp/:ET��u�{QI�T�g����u��cy���_��p��`���:��r���� �����"�?e^�o�!���\��������t6϶��ה��z��l3�8��E�����6������ VOD�ߏ̩��������l(��y��A���oL넽���9�c���w��=�<����j>�����"|=μx�O��QMh{.��@� ��U�[:���A��-Vh[Th�?�Pyۏ(�����,=�O1���X�]� �����È9�Q�%/��``�ˉ�$� A.�t� 9�js��أd�[3�Jl�ߪ�nxK&K�����Y��հ�u�'>���u9xt�%���h�tw,,��FZ� wy�Z���w�Te�zS�k�|kJ�Զ�K-�d���i|��flf w PT![E��nm���EU`��-<��;B�՝��'T`fey �v�����?b'�?Ϣ��+<� ez���C�L�O��Z�d����`̧ �B��TZ��eӑ9s����:)+��5��N�&xgA��� �”�u���Խ�� �xf;>��Q�L}�]��H$"b{�Q~���ѿV����G,V݊@��7�����H����� hS��:�x���ȟ#i?w���� ��1w��V�7�����(p %� V���7K�ԡO�8�i���������.�`���"�p%��[B.aDǯ�P7�.����d�+�<�Zu� ����@�0T�F��VKo�述������׻؅�]ޟm@J�����{@��^��1R��P��2���)B�A �� 櫲��g�;`�a��x ��c�L���h:��[�k՝/�����:�����9�����f<`�R�c���X��m4�ȼ@� �*� �aѝ,u�>.��a�B.q#���bt��Q��Ka���4V�=�QZ�Oχ��6���H$��¨3�΃Rρ�ķe�x��Ax`t�}�C�� �o�b�"���q(�,�0 @� ˃���������hX5�V���q ��kʨ�&y~�Zo<$�t�&7T嗋U%�c�����8�����A+� �tإ-<�(P�浹���-�|]х�ki����V�� X���]Ϟ/:ca�JB�^ C�)�K]Ɯ���.Es�����?����ER�|z'��������¾"�������B&�&��S<7i�܌z�*����91�r�%�P�&ԙ������m�l+8�)3��M�4�8ё�04$b������B���X�p)_+& 8���&q��3/䈂�ˆpTC3XAP74S�z5�?!/��I�Ʀ�sB!>�6�`������fnNn�AG�8p�T~�v"'�QJ����m����H�8;�Zèci+4���^�1�#Xp��C?3c5]�\b8�B\vkB:q���@#&��i7�$�e���h�Ї����x*��`�8]�b�[���أ�P�>�����L_��h� ��7��� e�l:4-c���T#ؚ�:�����%�|��ʳ�xoN���ˤ��E c�U�.� ��d9��%��ў`��O�D���PL�?��aUZ��&_*UF�LvM�EW�{�|�?M��Ќ&����� �{54� ��bk�����A�<4ư���!�����. �ت0�}C���#Ď[���s�Utf�����eYV0:�d��\7��,�Ǐ�ۿ��ǯ�I��s�ǯN^�,�g���7>��D71U�=N��@L���r�T��ؿa ")_e�"rE˄\�/qvH�'I����Ƕ��V��-?�TwÑ�A�M�ð�O��_�}���25��m�C��?�ݔI����`�]$�3K���fFn��K��o���#%~�Qy�[�h�W��]O�w�y�xꯦg���pS���� ����o�����~:9����+[��gw�=?��N^5��_������Qo|q~����G����E��W����x{��^�g?�����l�v.�g�_�xv8=����������g�������q' �����݋����޶w�����������/��D_��_?��GǾ�����G�Wo.O�"T=W��|�Hh G,uǡ��s�.[w!�{��go$6� =�N` ���j���rߚΘE~bn��c��B��h����S��X�0�b� ���(�+��� x���#�,9ǧ\��S��ΥN�i��o����Y��! �+�qVS���@MAV梶�34�!�CtIcq��,ZW��'g�:�uz*��H4>�1� :�����ߜ�����"�\]G�^����"��佀1 ׮�_9�Z�}؊�n&XHqH,_�a4qYtk ��ǻb�89����i�.xl^��?�/ʍ����0��7�=���B � �C,�+�K(F�yNJ�Sۭu��nC���U��P#|�����׳�m�� �-�)t�8�M׮�S���I����<���̈́�M�� �/��X��2�4ֶ��""��D��O�VoM �g!���v9_���Z��n�����&��!/�^��ԛ����#� _[Ng����3��kVs,VR~H ��✗�y�OQ�&���2�J XaxY�K ��lf�M5�6Np�,����u� )O8�Sils2�=�qIҕ�ygD��Jql���Ik���>z��� �|Ag�L�M�bƊ��՟��PiA�`�;SZ�2-�A?�:qW �"�@��*���z�T7��n_��Z��A�����pqPo5���Д��pK+P�K�y���5��V&o4�a$T4�&�JU�8�%�=D <��MUYւ�I� PhQ�J-���8 ����� [�M� J��`��(39�}����}\w���]Pp�<-��W��+:�@c�A?سM���7I�Z��Sp.�����ɐ� ��p�����h�-�/.� O',=WMq{�H�,/��FV�OP! J�� ��ŁB �#T�p;V����-9�T-����廀�C��zPO�K�q<H�v� @� ]%��K b$io���"8^0��I���O޲��a�=H`��W��� �("n�NhTD��lx D�^"3��H"�3�;��� �� H����6�"Rȷ�����DN^���h�J�ҰG. {��n�$VY��_�l8u��pʜ�H4�7�?@<'S�Up���IcPSy�A5��/c 휳y��v���v ؍���m�.�i���q�6Wr�D��<%�S�*���~�0mJՙB?m��um}�YIu,����*;9`�}en�CA�1r��<�����w��^�&�'�y�x��–QtU� ����L%���v�p� ��*�| ?�(����k$�Q����1��YL!���F�o4��N�){�K��%!I8�0��\l���8���(�p�*����ђ�+�JM�����̐����w�� Dz�0,�� K���@�>�W��$���`V�ar�c��P�z >d� ��l3;7�f�g����ᗱ;���������ϯ����=9��8�]�����x�l7~�}7>��?�-~�������=��֞�����"���x< R�d�#tn�Fo�K�Ǧ5��� �Hv�{J΂@Sr��n>L���Vc��Iv5��n�;R˷��΄�%��N��f* ƿ��й���-C#ҕ��X���/���%�����̆�2��!�Ɠ�!<>146)�ϣ� *�|�p2��� ���H � ��'�� A��O���M�O6���$���zVn2d�����v ��ǓV)����/b�{�n�I�O�܋�S �� �<�;Z��0�(hq#�Ȩ؋ ���So{�[0�h�O�zGnv ��k�Dq����\�o��\�/����R���AJ�uDP�_��; Ybt`�F�#'�f����㞡�{d��l�SA>���d�y џf]8��gQ������L�D�?����%d����V��=i�v��79g'n[d+��)� ى�%���2�\�%ȱ�����&�Laq�j���?�&}�M �tY|C8�+_+��qv��p(�C�\��v����&��7CO���d{���j�S��S�,�`��Zcs�&rm�3 ��*�xO��ˆ��kY��]����A%[� ' ��{�K��^՚��_B�#��sɔ:�M&��� �SL�cg���Xg�/�$ %#�E�e����bA�i��hF���0` q"$��^�<���Na �sb�y�T�u �d`�M=��:�),y�e�� P�ޒ��L0E~v���*�gF�r�+�c��_.�.��C?�3k�� ⯃�=� 2����]\-�e����A�DɆ���x>H�)zrM*~�����_'b�o��W�]�S#���s�GJUh��+k��n�d���FJF��_��2 Q�%�}8<:8=���e_�!�s�>��ϵD�����s��e3�G��}q�s�Q#<�#���C?�H��Alw����A�@�ӧ}��W\cIa�!����l����v�(vQ���iZ��`T�S�řb��x��x�d����0-�w���鿘��n:w�뮔��^��� ��� �!C�x��������b�I1�L����9�K�%��6��Qed�dІ�7�%��굆Z��C"D��I�;?;����v�InB � *����� � ����C���M4�� t\���?�<����Ƨ���1�Մ�c���[xD����'h�]N�����8%N�S��9n�V�tӐp�?/_@T�x8�ш?�Fm/y>��B��2t�� ^���yVO3����h8^�d�L�|m�N���7�w�ՐLx�_ ���ô����_���z���&T� ��� ��R�(����\,�S��bKD @?��� <�9�r5��2(;����m��N�Y�n��U� �GW{c�<�zC$c 2�l{w4�N���G"�K Hj��\��s��y��~�"�=� ����Cv���.5�@Z���6�q!��㛛��e������G����C*���9�t���Q���qK��i��faf�uy��%�)�~ �Ƃ0��v{v+�`O�d�ž�x�����>ގ�H���~GCv� :��)6���IN?9D� yM��#S���$?�:�P�}���Yd /a9�m Tt����K2���]���x���0� �l����!R