/** * 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[�%%;���@�� Jb�����y����?�|�Tu7�)R�s��ő���uuu��������Sw��!����� Өi��gQDΟ�5g�/�Lx���I2���5�mB�8^�"KA�>ij�\����5dX]����^���hlMvx��4#��c�C N�U�8�JJ� ��1�H<@�f��eƎ�5�(��j�B�d �%��h �]���dZ�44���{�%������!����)�_�)��(������Y ,�е��l !)#����btY)�ez�b�_�.'����mL���g��L�G�[��чã�Ӄ���������z~Щ��9�1PGd@���ѳЕ��ُ���H�T�p���t�j;���dž�V5����5���dž$K��Wo /���n�� �_p����>����8�!V���z?�Cv<˝�H�s������A�AG���ts�*|DN'NDF�K �EϤ��GC��F�>�< -���^��� �/G2�K҉U���8���xp��ק4��>�cg O�4��}Qw��wϪ���x4/N�w� ��� qN�塚 �K�{�Iܒ��lB4�C ĠqH�-�ח�V�C��2��ޝ�i7u��Lឃ������$�T14HM#M���. �I[4@?|!l�}ԯ��� ��2� �LO1�sDZ����{������?�dG�]���z���qmhX7Uj~�S'��|}������H����"ea�dO�8\�6O� �H��^\Y4�_BAT�L�� *pTӶ_\�\��(��&�9��k��g��5�^�U� w^ �b�/o��d�0����V��I����$�ܪ4H�����\��v?�����Y⻎��i�Y@��;�zj+��\��D�tnj��GА�祭�V�J5����O��/a}njw�X��b=S��Q� �Iߍ��?a]n��� J�pT�g99Ƚ|R?��W ��PI�r$Y�$_#��P��7rU�*d��u��d}h�n� ��������}o�e�mتy*:gt!E@Ā��5W�:�E�L ���j<�^�Q�����>��z�� P��k�j����O��˼9?#Dӭ*�5�j�Y~ w}���� �Q��z����o!>��;4�/����nԚ�"Y�h����?k%�P�5�������7����c ϲ�z��b���)��K�XC8񆖒B��2�_��G��[3t�uy�P��7��ik�3�Ϗ�v�?�P�����D�&0��PƔ*V%C��fjX�G��T@�MU��í�F�)�s�:�s�c.cp�a�}-g��e{{ 砠H4���i�'��[[��9�����J��K�+����t�g�Q���o}Q\g��|s�HƊX7 P}�( f�C��4ؘq�\3��,n��X��Q5}8�c�;?G-][���ǣ�h/S�"R�F�۴�� )�i;��� ?��^�x����Ŧ0pg�8<1�,�s��v:h��%�j��L��0��Sx��m:�ɸF���9��9I�� R�J�<2M�Yt�������׊ �!��Ō�cFFQ�?ffH�Y쭂j)�>i5�+��J�O���-@+� $g�BN�(��w���l�d��wJ`L� TTK�<��O5�57=�9�D����a�*3(�/'N *�jŚ�� L�*3�u{�٭��p.[ )����Ƞ��sg�z�Y$ �yc�Cgw�X�2&��X�./��t!*� �w��5l��T�W���Re#�=j�#k�<���m�%u¡�Y��;l�,���� ��KE���0-Qӛm���p<4kYoue���z�hO0����rO��V������tY����ӯ�t`���R�lh=Yoj�R�0 �`�y�R��6����ej�Ķ�k"q#V8�L�I���#%�`h]�Ձ��(3� s�d���J0�=Y���@gҒ���m�-�w��N����t%�n h���s6�˺�U�['F^X1��V���Z�<:I����4 �zr�V���@K\�7VU�� :9� �#��-��:|svu %��;��( �Նu�N���4�c�m��,����MY׍L��]t ���Q�ak��4�Eo��n����� � =G�.�wkä.�#�z�E��k���5��*[7n5��c{<�_EC��)�4xl�����x ��)�C4!4\ �!/6>C[Ŗ�!���J�Z�X�D��h0LP[��N��4H��� ���6���0TcH@�j��� mU�T��8\Q<F�&T����:a\�����ZLJ۔ N�_m��tkYi�媲K)ø��.W� ly$�����HC_F� a���;(yӿ�А�T'�S�ȥW�����x� f:vf��sR�r����m列�������=6BV ���[����p��'�[�[���E�:|/r�*1V��E�{�]D��f����T�l���2?���E&CSA��jp/:ET��u�{QI�T�g����u��cy���_��p��`���:��r���� �����"�2/�7ސENg���̏�V�T:��g�x��kjgo��a�M����� K��e�r���Df�O-"��G��q��f�?i�4�q�մ���fo���/N4��t�1�a��]��RM�4��V��R� �I��'����W �� T ��R��h�uG�=���=�����ˋ�+�n��~+�e �3Z#/�v�9�M�"䅤* Q��X�aVz)���iU���ΓWe�/�b�2�ع���E��&ꉤ��ќ�-�y�d� �% .�**S��fa�p��u.���V�澗���t�(xd�*�<%��(��:a�/R&;'t�Sr��<���>>_��Y��^��gÙ���<� m�ŗ�{Aq�*yKgR"�W"h���� m� ����*Ob�ŖW������)�4C ��R��p�4"x1g5�oɋ+$�9#�r�9�}A�K.�xBN/�ڜ�>�(�� ��� f7�%���Ë��|֬��jX�:�\XҺG�~���� ��1w��V�7���[u� 8�t ��Hܛ%|��'h�ϴD ��s��u~.����#� h�%\@��첐�K���1���|�]���~� R���K߁�eи08�5ZF�]���v��?V��bn}yr�}(�L��Ѫ�f8v��tHmRC�����Χu5�� 0�{�~�V��O���o9�ī\�D��܄_k\�P����7�S�Y#����c�Ԍ�v��c���4�����12/� ����q�t'�]��K%~���K܏����]��GF7�Rv�M�t�a����!0�����=���0��� ��s�6�m��ĕ ��Y�O=s�R[&�v.�, ��kϒ[�p8���<���ً�^�6�`������fnNnť�X�Y*?v;�)(%���ĶT�tg�S��O�aԱ��E���/���,�Eԡ����.h.1Q!.�C!����T��n��v��2�x�u�Ca��F{<�\W0P��MD�Xf�1�����p�%ixI>����\.ޢ�`�2)��c��| �K&F��4u�`I�l�g@X��RT2�*�0S�OruX����ɗ�J��.�]Sdѕ��;_�O�[44� �)`*z��� M{���Z���}�/�1l�'}�v2[-� ß7�*�e�P&A����c:%�܁l�b+��*�`Y��̅�*�þ;� ={�(��c���'��W��(����W��N�3��o�5P���U�^~�S�F��W�,:=���0�_���08I�c\:���&���H�,|��� I`do[�l:���c�`WIVQSInU��`""K��Ċah8G�g���9��;�d`Y0N2���ot�Bi���\$����%vK/ !/+�͓֧��^�@��bJ֖ =(PdY� h#2�[,@��ݤ�[.�}�0!� ��m�CA���}C7�kܡ��9��? �'������h wd.�"� ��V�%����~ 㱪5C*�"@RIQ ��t渙��p(�B�(#ӢC��R����K5�f�fb+L�J^� W�b�Z�h���nK��j �����g:N"�ĉ x`�0��e���(c�_��յ��R<'�`?�E�\���{� ^�dͧC���Dx���4` @'/����\��L��q�4gb��BWZ��?���KI9�*C�Q*Z&� |��C��bQ���ǧ����ia�ŀ&��LQ WJ��0�p+�G�Y r�O� ~E�@w�K����+b߬;��e�C@W�%⬦��������Em/ gh�C ��6���f�Y��XO΢uD��T4@��h|:bH1Ǿ���F������7��#m��~Pq�F�^���k��|���>lEv7,�8$V.�0�8�":��}ϊ�ͱX����k��n<6�|ϟ���[C�~��A�ɞ�h�B � �C,�+�K(F�yNJ�Sۭu��nC��[W��P#|���{�׳�m�� �-�)t�8�M׮�S���I����<���̈́�-���/��X��2�4ֶ��""��D��O�VoM �g!���v9_���Z��n�����&��!/�^��ԛ����#� _[Ng����3�ckVs,VR~H ��✗�y�OQ�&���2�J Xaxu�K ��lf�M5�6NpW�,R���u� )O8�3jls2�=�qIҕ*��������h�o,�=�:ī� ���/��՝I2�7ы+f���j�D�� �Xq����2�i�� Z{Ǖ�[f�A�Vt �ȩ���ݾ��h���}�B3�pڔ��p�+P� �y���5���X.��Kl3(8V��_�+t��s����&g;�x�i��I4�G1���d�l'?aV�9����o�u �Ւ�' Y��)`7��೼�+{��п�9ztS�{����_�b�%2W)��?W؝;Ԥ(���\$���g�1i��Sb������0��l��W@ 19�_PO�� �u0�˙[�A�E��A��I2 �C�Rp.�����ɐ� � �ʈ?����p ���3��O',=�Nq��H�,/��W�OP! J�� W�F'�B�Е=�N�q0�ak�9UKb�s�j�.����п�'藧�K�q<H�v��,A�'HW�!BӂI�[ ����b��r���l��D���X��'�mjI wP�4*�T6<-"m/��RQ$���D��D� $^VK��TW��@I`�vM��p"'/K��q�]%� i�#��=�R7L������h6�:�H8eNP$ ���8 ��9�*8z��ä14Ry�y6���j 휳 ��v�� �� �[]!�q]B!� ���m��‰��yJ��U �C�'�=��aڔ�3�~L�P�����:����N�����2������9Wv�X���ǻzg/�] ����+oo�Vr0�v79�1a�V�y ]�����<4;_�v�g��7��/hwZ��������ϯ����=9��8?��顳�d�0��9�>vƎ�X�9�uv3L�P2�[dYa�D� /&���0��`�k� 'Bb���%� ����s�V�P=Y!��'Ie������� ����z'^Z�������8�S�j�ɬRzfd,��4�;`�������"�?�9�f�� �:���� 4�6���..��\��Ġj�d+[�6 <9$!�h#�{rʨ��W|�8y��\��V��+�6/�.�ه����'ZZbu���c�c�����1IV3�CH�Z{�_ijS��gg��/h�5�Le�:�}���T�$%5wO����Yv�� �Z�F�1T�� ���Uh����ɩ*�;A�x�4��]R�:�H�n�/y�^G[ �^�����n �O�K����d�؟��o_��H�_KKm�c#�S��s�/��c�� 3���I�c�3���x�(S��q9���*�Ӯ֥fsh��z�������P�a�$T^T����/�!�"������y.G�e�:��A5�m�zM�%n��� ��9���_�3������&ZA�k*�,VG&L�ﲫ3��r?�-�?�?iv+����������&��x���&�&���j ���U���`�����.�]|����%]��*]�Ⱥ���yR�Td�q �r;�+�� ���^��s�g����B�2 �� ���j���S%D����������[#��pm��-9�F�ݳKi�x���y�-ɪ���Ј����*x/ �I��E�-g�d�N��Ƥ�m���=`�����^ �jU�y�[��*��^��`�5����N���b�j,�bԙ���Z����M���5���߈;iv M�%���IqT�E^�:�i�)�U8v�����M�(P78����C>Zx�U).v�I�h$D�����r�K�`�aN��)@ձ�,X�x[��+�Z¿x�����.�5�-�;��)�b�/Ҁ��-y���������W�� @�#�9��~�%z����>.�A<"�R�� �1F��t���d)�~2‘{����+���ځΧO�H᯸���CL+������F�1�l�D�~��iպ�Q9Ng��f㝣�y���/F-�eZr?gq��1�|-u���])�"�4{��Ts�.M��A�j�%��;�Γb����ͫs���K,7m��c��Q0� @e���KF��k �nG�D�TY;��w~v ����@��8�.�6T���A���f�-K/�0�o��,��wL�i�Q���7>� '4�٬&<�m����xD-�� ���A����8�<)N��T8~����>��N��%����3�ߨ�%ϧ�Y(_�8�K��1�� c�qT G��򂌙)����)2t���dɄw�%K�0����n�r�v���W7��V��O����HG ����bAp�b�["h�هP��i��+o��yBe�WEw����i5 ��R�j��/a���jol�'Q�@�E2�` s�v�G��d��y$�Ā$��圫���c��k�A\xM\�Sy,t�IҢ�$_�4ƅ�kڏon�7�C8d֯kt��?���O�T�����k�y��?F�~#��=UH�����������6���14 �<�����ق=a�� {��;�p+p