/** * 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�xi*[�l�b[�%%;��р@�� �b͚8O�m���O�/9Uݍ R��df��!���uuu����������`�~��F}�z����iԴ���(������T��}~=q��f�j_�g�>�~ _�vg�g�3�bЉ��9�q�x���ɵ40#z�RW������3�Gk��F�C��� ��MUS�km�m|�I� @y5�F�]�� 2l���#�'|��r�Խ����e�b�����Y��F��#��0(PI����K�[j[5�����9;:.%���FQ�����Z}4�z�iő����_�d�K҉U���8����M��g4��.�cgO�$�V<:#ǀ��^� +՛^D�М�~jS���W|��ӓ�j��n� 畸Z��Xc$ws��*@Y�����W4Y�����^T���WލU!�vϠZ+1�k��<[7�МW�:��N�wsԪ �U9�W����x���j/��4�H�R0�y%�WP_�Zd�~�~�?�T3OG3��X�4t͑���qjw�|����!Ն������2�zd�=��r���Z~@�>��;�� ڻg��|��|2���;b�Z�F���uTH�¥؅U$n�RU6�!��W�8$Ö������� �oS�w��G�MU��SE��$誰��I6U x�RK�H݀X�<� �n�� �_@(�k�k��ԏ+�LA#H �S���q,q/��j/V���BUP"x�G��h�P�>;� �L��B�D�܊!l�"߹�r_Ir���[�,����G�k���1���ۋ+��K(���)�~�bA�j���K����CT��7G<�} �:� ���ދ�j���k Y����Ӕ���}����+ =�(���9Ê�>�[����@C�7� h�KS���W��<�A|��M4K��|�VMm%����8uݛ c�4$�ye+�%y �����O�CX� �%�A?��X��-~�E��+�7C5�OY�[�~#A‡�^8�����^>��}ǫ�BY�$ z@T9��@ �����R(w���**%�Tª|�#�.�T7o��g���wlh��7�2��6lU�>�3:��"�b@w ���BV"y*w�l5S��(�WTX��Gh5kpЅ�)|�ڠ�5�~i�ӧ��2oΏ��t�Jd��c����ڻ7�G9d$w��x���[��G��L�K�����%�f�HI3�r�����@�BQZ���y5\cx��W�Tc��O�-��c��ZJ Uˀ� yȶoM��W�C�*F��ӧ �a���??��c#�hLi�G���Oc����W@�XQ� ෛqaţZ%�)P%�U}���Xe�&�v���� �"��t��������,��;8�E� �5�2�WV�\����N��K8�ș`�^܃܁�4�j.g])��u�f�9+���B ��2&f8r�.ш�j��lPT��]�t��)����o��K� �/Ůh2nv�ɛ5FJ���Eq�Ah���M"+b��@�q��P��`c�m��r�����nb! F�T��4�}���tm��v��^�xE�֍z�n�� )�i;Ө��U/g(�!�����[��"͙N����d-�vh5��s6�˺�U�_%F^X1��F��6�C[�{!�i��J��X�D��h0LP��NV��H��� ���&��5-�0TcH@�j��� MUk���8\Q<F�&T����:a\���������) @��eM��tcUi���rYٕ�a\�Vi�+��<�}�U9,��WQ�B$��J�tgcҊ�D`\s`J���z=24����B�.� |{N�\��t|��,f�2  ~��Y��wn��vJåB����eb;���t���q�od��Y"r:�8p:�r=y-�)�S[y�]U@~�9��t�hnU6G4)��͈�\x|+F��� +�G9���DZ�l�n�X f6��-���6ē—�J�� q��%��C��𖖽����D�-��8���B�����b�U��˶0���J~�E�Pj%^o��)��������,�x����?܇��^�>�7�%�������{��$��7��;���W�6��ަ��?��h{�������y}�<�� >��7�uw@����� }�0���݁��|�� n���B�.���U��Ϻ��m��,��>��$V��[ �9����K�n�����!܋�Ml�W�.܏�m(m���^ �2�}M�~vv;��>�l��^|�b,��Ev�J��R��KP��A\\xsCL��<[K�� M �����Q��J� �E%AR���d������� e��%�; ��l��+�wug�We8w��&N� �)��|� Y�t꺿M��m%M���x��'ݾ��z�m��h�X��wWX��.��V���2�(pX~�;4'�;�6c�I���iO����=}��;�;l[4�8��r��#�b��]��QM�4��V��Q� 'I��%�������+���*HC)�U4l ��v�1��'JŦ�:.k��"�ʱ��"�_ ~���ԃ�ȋ��o��l�y!� C��7h��΄Q�4����<��y����B��@�;�T���W�D5�4�;��=�e4�l$�D���@Ie 2�4�.������*��{� �Mw��A��#�W2y��1�S�� e�wJG>%�����{�z��������\|��������tJ!%x%�f?�-WhSTh�?�Pyۏ(�����,=�O1���X�]� �����È9��}M^\ ���:��I��\2s�19��9�<�(������5f7�%���Ë��|6���jX�:�c\XҺ<' �b}x4�*��;��V#�d�{q�ZkUeܻL�2�V��)�`>�� %^i��N��.�d���� �������B������٨�� ���[x��w���;o�O.*(��:��-���:H �������<���6�l3T�%;�Q2��tku �m?�}�m c>iz���P�@(�ͩg�`���IYJ���u�0�; ��VP�D��]&���-�,�����G�3�=v-#����-G��R�F�Z1R�[�Xw+�s��Ē���#����+�L��H� �j�|�����?�'�Gh�E� � �?��uG��c(@��*�Ľi§}���LK,���oa���ml��&�/B ��~v=H�%�����-� �?G�ǮYq� �2��]����@o�.�N#D�z��Y���v���ߗ��b�ryz�}(���oѺKd8v��d@mRA���Ƨu5��50�{�v�}V��O���o5��k^�Kk‡ށ���^ }sI���u*(k���򹊡N̸��(0F������gjC���H/��Bw�ͥ��D�ᇹ���~H��V�=2������4Oӽ�qY�O.��6r�z$�ea�EA�@m�� �8�+ ]�Оz����L��B�Kv���%�a�7^y��ً�^ƔlD�S�u � ��߅�<�=����C�|������FAX������,�M���e��ܘ�b[SZG�’4�$�O���|-ޔ�`�eR� ��"���:c������8��%]��`��M�ԩ��PL�?��aYZ��&_Z���"� E]����4�)�]�OS��7ih�v���:g�����`��n҇�&3�»0�yc+ø�I�8B���N�w ;Eg�؊���!X�%`�s��R����uC�) y�����i��>)�A.�������� x��g5�6�����{�_픮�'s�$ �N�1&��� u�t>V���[��v�NjҀ1q�0�p�sLt3���ǩМ����\i,���oDX�H���B��R�2!W�K��IR2@�jw���l�s~��W�]�`�iA|��0l��%�v��7LMcG|��/�`7��D�^N0�.ة����r=#����n�]x6�H��_�8w���F4���sή��{xF�2p��Ϧg��p]� �o� ��������/?�����蕭��;Ҟ_F���?��OG�~x���3 �8��p��������E��W����x{�w^��?�������.�^~~49����ٛ����_�]���;5�w��V�����������m�y��������/�?E��# ���������F?��z3�?e�P�\�&�"�5�����zѺ �� <�x#��\�w}� �T�E���ּtF,�ss��D�EE�l�Җ�B��qN�d�3E�\)͎V��í,�f��>�2�5�J�u.u�O�}��0חMCt Q]a������w@j �2��,��)��Js��Ѧb"<9�6��yP��V���t�!���Ŏ����b��������&�v��m%�%�Qh�qM���7����Vd{;�B�C�tYDt ��O��T�@�F�q��y�{�d�,7� :��|b�J�GmB�q�b�pS�_B1��;Vl��n<��Et[J\ܞ���G��e��5��u?l�mm�l�N���)m�q��A��O m$d�a�lm'$nk��os�2䈕٤�6���m%ⷈ�xj���F�LC��r�I����v �7�m��#^b�p������GR%�v1��+t�?�Ȏ6lXQ|̱\I�!5���s^���>E�0�� �q|����#��0 �f�Tcj�wO#%�\'�� Gv�M`����g:.I�RE�`ߋ[])��V�6���#�~޹�x#��l _�'�{c���f�n�/��u����wX�I� ]$0)�A/�q �"H_��)��T�Ιnt�F��T�FW�� ��wd� 8#4�d0'ܺ ��2c�^>e]�� ��[�j��?B3�Ie)8u%� CK<��JYY�j��F� �^hE�L-�~q6��֟�z�W+l��55/)1���*��&U�)�\k-,6���,����3���M����({�F/����e/�? �J����K��{L�>O�cG�d�����@����r�"�r�mѩ�s6�ץq��$C-t����X�ᄘl�z�"�Cb�7��m�<(�q D��,������`P�3�ă�Ҡ�A��I2 @C�Rp�)���0@豂$fRK�y�Q1�y@3w���B{�鄥GwR���RJ�K_�!�� JDAi��,:��8c��a�A����jNՒص��Z� hp�3�g��߉y�Ro�}j��40KP� �ur��� F��{��Ep�`3�� ����e��$�~ի/��;��w]+Hb������ ��R�p�?���B&fHE�D� fbw���.�xY/�����5�_η��� %�AtN^�� �бL�ҰG. {��n�$VY�%�_�t0q��pʜ�H4�7�.��q�x����Q�j�<�ߕ�'~�Yh�M�|�'p����$[���t�l� �&hhos .���$qJ\��E���_�K�Ry��Oc`7����^�v��~~_o����0���-6<��~c�\!�EbiO��^�&/��E�x��–QtU�]|�.�L%���B����}�ɯ|��������� �pT�Wlc�ӘB�#ɤB�� �T 0����{��$ '������7��8��N�d:|�U2M#�dI~W��k›򾴰�N�:�X���%�����6l��?��Yܱ#�a�`�m�q&�d��Њc=�Ze#%4�.�T �Q��Ր������i?�������|��|tx����?���߇/ڇ��ٓ����}sx��y����������l��W �͏������������[��jǃ��s�}4 Y�=���y�E���h����,�/����6!f�֘��0Jg]J��0�{\��. � �j�'=�l�e��w��o�ѝ �kK*� �l��4@�"8dKgй�8��T����`$�S�W�B˒�M �avPd�f]������~�O �M����i� 4��K�Ξ�W�� ���� i�=��l O���n"�y@E�%5eճvG����2�=n�?7��D�"��n=7�Y�ҍw8�p��@���u� B���w������<<�Q�Kނ1D+]��[J�m(�N�!�������X�ys5�Y M��3~A��ۏ��?��ͱ����]��NdM�o���;����~��4'�|2E�d�y ���m�?���Q�����d������� ��a��v�/�Sc���6���ٶ��V���,� �����3�\�%ȱ��N����La%�lW��?슼��<8)]?� ㍦%��$����Pkר���L�o���I�'��! kM���-���� ���s��rm�h����su%r��|�e�X�5��X�-�6Zޠ�}����� ���g�kMl�/�ő��dJ��6��HD��)&�3vL��ʎl�ɕa����2� �H� y1� �ŀa4#\��YЗ8�����DH�w~ ����� 1��\����%��F��!����2�梋�)Sjٍ�3���}ȫvZ�F��"�O7�ڻ)�?����PI|eZ:x\z �6C�k�d}>?�r+����� :��O9�� <�N��`z����wف�]������JP�m��G%�ْ�d}�.�d��rŒ�EC�Td�1�{;�%�Jq�I҃Q_27�~� p��}.��\~Q|�*!�t������o?� G�n�t���4��u�C���9��k�JqO�^zR��� ����1,�u�9YҦUǶ�c=��KX.mk ��!��-k��.�ck���FA���H�������٣GLJg��*�K3$}��������� l���q�B�J�,E_��� H]M�b��"�����?I]�t>}:@ � yB?1����k齄(vQ�^����� FD8=W���Q����IƟ~�ba�Ȋ+���K�����ls7F�KɁ���ݭ._�^�gZ�۬W4^�B�H��fb~6�.pN�+}D�6���ƾ�d��,��ٮd���@k�tHt}ގ$�]��Br}a;Ѐ$7!B�xI�k '����ӛ��,���P<�aCOY: B�e���ԣ���7>��4�ٌ<�@�̟�B�#���?A�C� �r��'�'�)qB� ��qs�ҧY��ּD|Q���lJ#�� ����l< �������k�2fG��p�,/Ș����� C�o@��!K&��,�ôw�`|�������oB%�࿤O��"�HG ����bAp�b�[!��}������Z��"dPvz�l����h�F���#�+��`�Rp�-�.�����"S0�9a�h��u�m�"xWb@� �rq�r�U�M���5�z^�>�G� ]*R��(-��6�q�v㛛�e���� ����3���C*U���9�t���Q���q; ��i��&7*�Uͺ�{]�[Wb?�fcA�Gq[3�pW�'L2Wa�jx��Œ'�^��HQ��}GCvb:��)6����N�?9B�*yM��#�غ$?�5�P����,2��=��yo�*����n>�)^��J_��O� ���k���A�ĭ��o2�K�V��� ��7�P���݆�m���}��(��E�DԠ