/** * 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�x�HSٲ�K�r,)�޶��$l@Р$��Z����_��������ƍ H������8�]]U]]]]]}�ӝ㓣�Q4v����ް'QO9?�0��69xʢ�K��Pu�ߧ���)#� GQG�o��D�S��QH=iE��j�KMo��, B��ӈ��驖?�]��{��Z�N���jWu%�#�U,��Z0�׾��t}�V����I�d=�Y�D��F&�Ff�hԓ��^({�%�9�=�ҡW�F�I��+ǎF=�^:U��Lω �,ӥ=]���*ghF�<���&��S��5�����}?b�)�ݱy�8csH�r�q�pHw�V&ێ�*��;�ڙ�ȗ��Y&"���$Ӫd�q�� �� 8�R�Cꚦ�Do�?i��6!u{��ǐ���Ѯh��Zm�:��!�X�0l"�aVR2]h>ό�D�ib5��u,3r|�2���؅,IO:��'/��ɻ\ۓ��$�F�Ih�6������� �&����1�۔C+.WΪez���`�ӕ>��[�^�Y����j_�K3��o�ӝ�GLJg�ɷ��+dz�+��*�c��sJ�����Lꛌ���ԉy�T�Tc���O5����.��j���T5����6��Ƨ�$K��Wo/�rx7|P�c���Bx�wZ�J��������/��'48�g��~a<�cP�e(T>60�_Ұ�R۪!��tA�;�l�02p\J�/�DeH=6Jug0�,T��#{�٥_f2�&�Ī��, �y�S��� ~[�v���=7sϴ�]�I#%�.� )ͅz; ]��&���h�\Mm3Z���z_*���Y՛���� iu�aO�x68 ;=���)��_i�����{j�}�Qw��w�*���d0+N�w��C� �z�㨐 �Kq��HB���l�BT�#t<�sH�-ɳ+�+���{��&�N;;�MU�{SE�g $�p��I6UtzRK�H�/�,� �n��������ՙ��~�ES� $��)�|a8����j7RYh�@�*,��&;*:�*��Գ�F�kCǺ)��; �[��� ���Sak�$��G�#�X+>˞�b֛�>�� �H�ޞ_[4�^@A�L���)Ή�QM�~~ �z��G��t|��Hx�����A>3�(o�a��EB^^/MɆ��V?@��R�����T$��̪�K���ɸO�\��? ����i⻖���4@��Z�j�TW��)��׽�pfw�#!�K{-�+t�r�����<�_���p�yb�3��L�R�� $\����ʇ�J�; >FaV�'99Ƚ|V���W ���H��(r$Y�$ϐ�΂+w���(*%u��Uy�s������g���wl���7u��uتx=�h Bp�� T�[��\"�����!��hD��N����>�y2W^�y�U��D�y�1f������� �Q�)����ގo!>���7������nĚ�"%Y\i˙��J�(�k�bM�k��`�՜s�}��Y�^�P5�;1�����n��>�I��혽]���3�"��t�!����������-��@6���T&�ʋ���֖���5�"��g� lzQr�~hӰC`~��u��� �.͎c9D��Bw��2�f8t�ш�j�lT��\�t�!�)����o�`K� `,šh�e�l�a�JB컾�Uq�~h���U"�+b��@�Qma�8eLT��7Q�5o�Ү�!kLFմ��I���Jif��v �n&x%N��v�� RB�v&��?�u7�<�J]�F�)L�y|E$&�mnU�V U�;�c��$]���iZ]L��U�h��M�5���B�>��H�d�"e���#���{�k���~4S`�d0�V�0�*�����&fH�[tWA5�z�4j��@u��!�Z� ���@�3n!���}�U�_ ���_�[0.{ ��Ci��ƚ�N6R�!Z�Gf��g���FN"�fŖ-� L�*(3µ�l�]w�\:�R�+���A Z�N���-򆂇���jʘ�Jc���ZW���\*���V����9p��j{E� %6r�Gm}`���Z�u��Mt0 A��M��8Dc#�n��<�sf������M�r8웕��7ڲa�e�J�ǘXћMyO��F������tQ����ӯ�t`�����5���d���J�D%��%�J F��������ʼn�"Hf��]b5��X�֖-�wq�2Ӧ0�Hv��h��'��g:���4d}�yy��]�ye�c���p2^I��Z l����n`��W���6 �������P�V���Az���^�{r�V�@JB~�w�T�ւ�r�#��*���|sr} %�TKo53���F�UI3!R�䖱����u�*�e]7�*��Q����r �����Hs[�[�k��68���͓��c{��d���1����$1���fp�э\7�뼱u�V5;�'��U4d�����o@��A��KZ/�����# >D\å@��b�3�UP|<��*���a,�������G�i��h�t� ��AZ� �W�71_m��h���@�RW�{+@���j��+�g��߄f����Q'܂k2���F���6�����WS+)�XV��AF���R�0�F���+��<��ҫr 8OC_F� a���;(yӹѐVT��rM�)e����lh�$0)���=���))`���t|����r"���3d��1� �)  �������\Vg��{��1���a�rdI�ө�������d䥴�HNl�E0��@��爖��U��Q�Ѥ�:2����6��K3�,��T�����Ԭ��X�3����Ö�H'Ik�I�Kp�^㚸R�\��zxK��NCx�w"���Q(�4��^(�T�c.[�ټl�H -�wS��RK� x#��H F��A��B�,�}��m�C�v�q��ْ�P���܇ڽ��^�݋�l���r�uo��Ğݿjk[��������~�<�� 6��׷uw@�����5m�0���݁��l�� �o��B�.���M��ͺ��md��\��mԝI,�M�,d1����K讽����!܋�u����.܏�M(�m���^ �2�}M�~zv;��1�l��^|�b,��� �"��n)�d���%�V� ..<��!�ev��%܋L���������̣*���܋J��?_7���l H ��zC�|��E�2��u�; ��J�]��u������"�?%.,6ސEN'���ď�V�T~:���m<��5��]os�m������+,�s�m`����B�qX~J�?0ǎ;��6#�q���i�����=y����wضh~u���ʱ���gܶwqkK5Ҍ߭���( ��_�C՛�~c�[ �� T��R��h���.g` �Zƛ븬%��)�W�'��s�m�/_؜x�E1�����oB�]^H*������1��W�R�4����<��y��Υ�@ �j ӊ�K��h���D5�i�w4W�ܖ�<\�A��%�� �4fLƚ� ����\<1]��ݽ��P�t�(x��*l��^��V��i���)��S:�)9�a���\�N��C�OM���y�E|:�jB�s��u/)nW%o�B x�A�t�7h�?�PEߏoy�����>ŜD#pc�uy*�.�2��sZS��<�@���3p,'���'���ʉF�� �M�����oMP+�;[�z#z2Y�?����g��_.�ս�3���%���þ�-!��G��:�XXP[�4����֪ʸw��e�jS`kA}b.֬�R��b<�0�5 :�� š����(B��,���Zk�c�U`��-<�.B�՝��'�K0󁲸�^�� dps�o�ܟ�x��#��m� �䧷�K��'�Z]�d�k_~���OE�s�~]m��P)�̉e�����ղ��_SQ�a��w�(�؊r7���ƒ�w��Ml�םE����u�DRE�o9�薂7��V#����U�" �H�.�R/��ȷh`�W&�Ϲ�~;�̾Km���E<�P�%R83x�\���U���&�^��6*P���Q�x~T����-j�I���V�D�F`r3OqeV��P1������8�OLz��Y�f4�b�z5���*�Pز��[���kI������X���]pϞ����� ��x����tktsv�]m)��� XR�N����kI �hMΐC�~��sۄ �`7� �dF�=�x ��\�<5 �D�� Ԃ69zho�,������7�*�(y�G��q��s�!��QT�@�F��K��sg���/Q���|��I9�g^*����o TC3X��G�)k��9��_\!Q!�l�G�!�V\}�#|b���/$M�\�����������`-�A&&��2�[�b�=ՆA��VH1¸�LWc\�b�-U���o�9�%�7��/AH��Y�4q�,�v��[f����c(L�tM��Y ���o�B�N`g��2�}�g�Yஎ'P4R��j~ڇ�|�L➱Ls##؛�6�哤�%�"� P�`,^�bŊeR� �G�#c�E�6 �B�`A�.��̀���kII\4n�0��?εaYZ����X�)4F�Hv�*�C��Ӆ�4�C3�0��yK�^��i��[���V~ ���3]t[;�����c���畭 c�6I8B�c��a@��b��e���6V`QiV��ݹa�鎢�G��ۿ��N^ⓢ�O^��<]Lπ��yZCi�[�OD�5���KW�E�$�H0��R[��+YB㔸c��$?�-:��N�}����I�慐�u_��R����N����<�w��'1^'sf���q�_i�TL:xj;���8T�o��!�%��e����{% ���u>%�&��Q�Y� H#2�;#@���ʤ�[�s}Z3�� ��m*�<���C7�k,���)� B�������7�-��A��E�uy"d�䒠����!]���C�GEJ��2�q#��s�̍���T �Q�E����D�WWWj��ͫ�p1+y1+B̊�km����� ����$�7�rHB��x�V(�BJ���f} ��ݟ.@�0�5�B\��/���B�FɵX;��}�e�Yl:��|��᭴���e���sLt5��m�!̜đ��[iZ��.kB���/S�|��gBn�/1vHX$I�����G��q�g�>�oʭ�i�|� |��'�d��7LM�Gs���\��n���Q��`�=N��������\W�KF�o��ٌ'A�ޡbX{e4���s��w{o���w��/�g��p]� ��f�s��W��h���O���{i������gǗ��e��~���ݏo�^�M��·���yy���ϟ�z�y/������k����������e�����G�s�^����Ͽ8w5�w6l��'�0�{���w�u��^�m�}�����O���?�����8���c_��j�����7W�'|��^���d�A$Ԇc���P�� �.j�\���O��Ht0�U�@Oz#��c�)�5/�!w��[��6+��1^��OiO�^�”�'Lr���@���6�AxRY>���� |�e��3�d�#�E� ���l�a` �Y",��W@Z �2��X9C3�r�n�ژ}�(8a�V���9[�j����ۨj ��9r�^�x�V�����<���S۽F�A���6��%L?h�vK�"��j���6d{���g�ʕ��(� �vE���x�+'�q�5*�h5n�xd^��?�.�o��a>1nT�Gm��0 �D�n�_@1��;^l��n<��Et�x~[ɚ=���F���i����ֆ��O�Vӵ�� Z�}Rh�J�����*���G�g�[��� 9�e��M�!���6�����xj4�֬��$$���uڰ���m�6�߰6q�D��܅�^��^?1�*���t��|���~��IX��Ĝc���Sj��c^����*���2� �`x��K��"ƿ1�ȵW�8>�� S�I�u؈�ŏ�N��֞�����%Ż��yb�e���F�|Ɗ�ےo\�tv2ˉnnQ'�� H:�%�&��������%!����c m�g���)�p3���i<8���!�:��gf.�+��.��o�}9�)9ƒ:�0K~=���ȝ�4G���)9�3�,���l����h�C`z�I~5�|��id:�u�P�@wP�2���D��&� ����@Lj����R���[,�+"�ȅ�V�^1��r0���xH�'֤����&Vh@��p���pY��1�o���O���˳��W�O/��!��===?>k��/g�?������/���{z�9<|e��~��/~9=��W_̶���ÿ�i��=�����?'��qx�Lk B�j�~|�|~�q8�z�~r "�1�+����&Č`pa�Q0O&�`%J�h@WrA�.H�� �� ���K��F~�L"�����=�dSς�x�ɦa�I�|1�ޛQӌ�[z� |� t"]� c���p��e��]�v���a�d�Cܫ)?���cC���]߱�rU�&�l� @���g�uoW��I�������!(<�鲺����� Փ�6����� |�za](�_e�G�B�XO/�'�}%m���J�p���� 8�Doi{O�|�_\D�3J���Wx��Y�Mނ���i�-��6��^����q;��7�.���+o�FWV�BU)ǖ�!"�Ơ�?�����6.�; �v����� ]��N�i�c�I�&��u��?N�)�Rp8�| �+��I�r����� K�pU��� aw�i����l�mra�J�e�6Z,Q�`�r�28���/\��9���YY���6��o`໢�/u���]��T�� ��G^9�� 6�� DD �'QB���Y�<+�K�䓦ܻ�)��eb*�������MZ�().C�4�{*�kS��F�%S��U���,���.�&�Ϸ��O���w����@�I{�q�;��LNq�E*1��I��8�;�{he;3�Y��B��x�$*aY��i�����o{�X�H��q��' "$���\�>���U�� ��`&����o�%$0��?j��%X'��z3v37 �+D��ҽey7U�*�-�|�U!=S2�?�-�h������'88�)�fa���;��a�[��;�끀zy���-��=��3�i�$�a#U�=���Ȍ��$%5w*��S� ��N�A� �����(�����9X֙�F���0���6�C��w�K�s��� 7�tn���q�i�.G.�:*g{,I�|��T���n#M�eg}��+o$o7��� �^K[ �>��� �v���P���t�$v�J�J���nzM����zn����(݂��(H�^�*!ݒ_�?%��(A�|P�9��Vp�鄤���h(�?��KY_%�Y���0�j"���-W�Nz|�&���� 2<�E&���羅 0f����Ar�g�Y*�&}b�T>���;����u+�_�-7��±�F�'����k=�� ����Cɳ�'��B���P[� �P�����m���=`K�Cy7w�2�<ƭ�|����eb�Lq��極� +=aU�%�:�|�X��2�'As�$� ����M|�g���=y$}�%7)��� �T9��>� G�n�t���X����(�v�_xލO����k �ZL6�,� �s�tɇ�\]Ү���i,������!;}�u�e����h"�U��)�D��ߡ$Ow>�~���7g��/��3��5� l���q D�H�,��Np��ýRG���!�^6�q��'���,��v����|��a-�n�����ӴrY���}�Q?��"�}a8M2�� �y�M�.�})ٲ����ѵ �� 7���Q��j�~�bq����4�y}���� `������`&��e��/��Qo�5�Z��C�� U��wq~ ����JnBx�шI����a��Q���&�'K/h?���ٛ,���wL�q�Q���7���SD<��'0�����3ĉ�����׌`č� ��� �'%( B���/p ���Y�h�F"(�����lB�x���^�|6������x �rf�@%���(ș���#C�o@��K�Lx�_����aZ�i���/�w�Yhu*��-m��SA8 j�uh/���)�|�����G�E2���������� ?��z�xTe,�;�d+���� �I��Q�QtpSf����ߒ�GҊ4G:.-�3�F��0���&��Y�Uh/�-܊Ac<9�R��:��AgG��J�&�5�Cr� ����&iB#��q�kn�J�G��x�L��Z����ys ���g�p+4v��Ď�|�����^0�$5mҟ�_�� �#į��� =��㧓�>����1��