/** * 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\y�Le˒�\l˱�dg�h��A@]����?�Ӽ�����)�K���q%H���3g�(�tW׭����x�������w/�4��{���qMo2��'�K�FM��=��+��9���^]�O�Rg2�zpy�L���\��B�!�i�@U}���� �8i4��i蘞b�3�"�-ߋ���;�8^�^4�؏MW�LkJ�`>R?G*�t}�V���9�� �� � Fg46�55È�C���ܓ��dx��s�^~KD�J�O�6=w,*��q<'v�|d�.�M�� ����������ٟܳͫO�QL: bhF��A�wB���NJwgf^��̜P4�| \3�����iz�D���'Y�y�K��� <�����5�mB�8^�KF�ij�\�����dXM����^���ilMwx����0F���'P�a�1����BezfL%_�d3\�2c���0�������*JGh�%y��r0��֔< �?��.yI�-�oCcW����6���6����BV�0�;���U��jMu$��@F��dT���*E�L��@D�kQ��Z��e�~6���k�ߒg�>�� ߪ��g���E@g�g��@c�!��FfDOCWV?��H�P�p�QeM9��ҏ*+�Q�ۊ�4?�]�k|T�� @y%�&��O� 2l��GO��Pip-�+�a� ��+�#:bdzܹ�t?G,�a���(/���4v��bH77���G�d�Dd츔�_�I�z4l���ܳЖkNë_��!�Q��&�Ī��u^��xx���'4��m�� ��Y0�y��rn�sz4��ov#E��8�CP�=�� |�o�t|�V��N��U-��o@/���ܤ��@֨b���{j�5��5����^�3���۫CH�@��b��\���p��C�F� ��u ���Vl�7�a�xTDk���sS*gq$9��ӧ�ʜ������o���=��v�V�wK��R�9�R����^H�����]V�I�:�Ij#��I�?�GRE�Hd�o=��qR��(¡n��z�GC������_h���G�{l�}�4��B0h�U �=���x ^�R�j ��D8���@28�.Ů�&qK�� s��`�C2l�q}m�=��/C���ݫ�#�����5SA��$趰���a* �������>xPݤ�����5�>����i��� �LO1�sDZ���껱�����?�������샩��аn���.�gNʭ��/��1���Ԉ�x�l����ኣ�5k��ʀ��ۋK��K(��kP��ł Ŵ�� �k'����I�GoxL�b{��s �e�pÝ������)Y�A���8��z�I�3�/s�5�}�* =��$o>�0����询�y������z�hP+�N���J>5�9%>✛c�4$�yi+�y��R t���ӧ�KX��%VA?��X��-~�E��k�wc%��Y�[�'A‡R/��L#Ƚ|R>��W ��PI�r$Y�ԸF �� 6o䪨U�R �k� ���y+H�?k��cC����i��a�� ���A��[��\"�5�����S���k����g ��!�_�6�d�nX���i�|�7�G`�h�U%��[�1�/���ߣ2 ��;@o|5|��[����L�K������f�HE3�j����Z�(�k��$,���?��+����ó�>��;<} n�B<�N����Pu� �W��G���9:�zc�P��7��ik�3�Ϗ�v��>�R�����D��0��ePƌ�V%���fhX�Hͣ� �d�������k��Ԍڎ9����V�1��18�0���3X²����sOP$��XF��ʊ����-ۉ׼����J��K�+����t�g�Q�G�o}�]g����&���nTP}� ��!cbl̸�qX��47�u,d�����>�DZ���-������x��)^�M��mZ�܄�д�y4��Op��3��]�F�) ��� OL* �ܪ)���w��:aI��l6Ӵ] 1�䝮�F��n2�Q��3��u�F&s�T��7�L�]���A���,C8ccmY6��X����菹Rh���Zrs@Zjs%PSn HSm�d ���@r�-����;j%X���ӽ �2 �5�S c]�Νh*OB�Z��Ѩg��S'�b�b�V��K���=��VÝ;�-���cklP�Vùsh��<��� ��_&V����4�Fˋ�w@�ʴ�ݑm�ګ�/��U�m$��D��}����Z�;�u�M��N8t0A���N�2N�Y@Ϲ�[�TD�m� �5�ٶ�NFf���[݆atz�hO0���ۍ���:�5�I})鲆3�y5.�_� �����䵆��zS��z�I K�k���<�Z�Ll7tM$n� '�i�5���s�� ��hu��m�1�L�¼B��N`E%�^C���@� i5�~�6��H�� g2sg�|��`��ZX�9����U߯#��PA+IF[-n�$ ����/M�^�{��@M�%��ۛ �*C�����[��Sc�9����b�vf��jÿ:i'�AKZ�c�m��<����͆����>:�od�;�'z�Zo#�|�o�[���b�3�=��'C��������0����$E�j��,F7r�@o��֍[�h���W�h�V�~�� ^[j/��4^��g�,�M �aȋ���VA�a�l:��.����Q'? �V+��e M��i��"���J{D �X������H[�: ,�eτѿ ��c�C�N��D�S�r-&�mJ�'wٯ�VQ���4� ��rU٥�a\�Vi����<�����HC_F� a���;(y3��Ґ�'���K/��3@#��H�$t�"�ȷ�H �u:JǷݛr6��/BĂ�w�Y��wn��vJÅBd��>�o�v�����{��1�� �0a9�D�t(q�|�E�z2�ZZQ$���"8�*���sL�i��ިl�hRV�����V��ɹ֖�r�����Ԭ��\�3����V�HIk�I�+p�Q㚸R� \ա�zx+��N�G�w"��VQ(�4��^*�T�c.[fٸl�H -�wS��RK��x#��HF��˓^� �`� �Cdm�p"�{��`_ϗ܇���>���w�����^4���_��x�{��&��������O�6������˃��; _����>�X��mw�|�v*��e�'��� ����;W�F>뮦�����(���;�X�nY0��2w�_����b�:vX��p/��!�n{\��p?7�����/><${�l��5��������Ъ��{�Q��2(/2܋�"��4������Ze����0憘��y��p/2� �U�{�)�����܋J��?[7�&���- �� U��%�; ��l����wyg��U8���&N �ya��,r:w�?�~̶����� <�Ɠn_S:��m��h�X��wWX��.������#2�(pX}^�?6g�{5|m����~KӞ]M{�Xk�v�m���D3�� Ǟ��q��ŭ-�H3��nŭ-YN���p��:���Z��J��^�j�4��]E�θ;��2��ԩش��e-^^��^9�pS��[�/[؜{�y1�����mB!/$Ua����& �� a�M�*`&O|w^cU��܉@!�j ӊ�s*XX��Kj��H���ɞ�2��K6�^���H��2kF�[�b��jk �M���E�]E��9��ƴ���K�l��c:�)9�q���Qd��.�&Y�^��������<� m�ŗ�{Nq�*yK�R"��#h���� m� ����*Ob�ŖW������)�4C ��R��p�4"x1g5���% 윱c9��}A�K.�xJN.���}�Q2��9Z%6�oUf7�%���Ë��|֬��jX�:S\XҺ��5%^j��N���z�V��4��{363��(���"s~�����"�*�A�^�;B�՝��'T`fey �v�����?b'�?Ϣ�ū<� ez�αC�L�O��Z�d����a̧ �B��TZJ����؜�q��I�����A]'z���H�aeaJ�:�e����]Q<�B�(vf�Ǯ�`$���(?`X ��_+FJq�#�nE x�t͛[�p�s$Z~�rw4�)]BIE�;��T�|U�����~��}����� /7=�l�G�W�А���*�� �"ɶ�c���|՘(��>��m�j�<�# v c�+���2�»����x��㸉� �x �L�56����񡍰1����4wsr�.����R��ۉ�HF)1�&&��*�;c��<}j ㎥��,b�~x�Z�q��[D�1��������)��L1�O�ag�-3��WF[�>ƚl��S�uʼn����<��G��?_ogs~M<���2�����6�峉�@��e�SQ�`kJ�W^�����iX�*��� :! V.�bL>�����dj$�J�� �t��}T �%X,C%S��C1=�$W�Ui��K�|i�T�2�5E]��W �ir�IJП��'Lo�д'�n��U�n+� �� ��A҇l'3�»0�yc��X� e:�;nA0�3���Vљ!��?�r�e Xa�\訒=�s�гG�L?&o�~���'Y��%�:�u���o�LEmCX�S�;9��O��x2WI"� ���f�9��C�$��Up�;�,��"EԲ�mr�+$���m���(���m�]%YEM%�Um�&��T�,�ˆ����?û���ԓ�Md�8�d����;E��g�s��*⇖�ݼ4��D�\6OZ�λx�!샋)Y[���@�eq����Fl�i�?t��n����jB���۔��N3&��{�n��&�C/"�Ps�S�F�A��N�V��1�*�\TE�׭�K!ta��cU�=�TDE*��*�����q3O+�P��ȑǦEG���B�J���Ė��弚e�f�е��l��nK��5U����'$�q�ÙMR��)qb6�(t���j��ǯ���Z�})������#J.���=��Z.��f#���Dx���4` @'�'{��\��LTQ�8E��1]�ן˭R�a�F�%��|�!��-r���!a�$%�o���>�\=���|S�E�ƚ�7Y�AYB~��q��25��m���?�ݔI����`�]$��K����fFn��K��o���#%~�Qy�[�h���������8����_M��π�rDߛA��Ëߢ/F���t|򏟣W������D{~x�j���o���������<������=4�#���ݟ_i��K����{m���j�j���N?���`vJ��ӓ7��˟�����w2i��ZG�0�{���w/~s�O8|��y���������_�~���G�����?:���?L�~x�����)[����*`6�� ��%��8��pn�e�.$s/�� ��s�G� �7�S��C�[�ܙ��O��UvL�Q(��z|J[ ��] 8a���r%�{Z��|d�"g�����s�t׹ԩ?˿"�ͺ�\_6�1Dt�Y"�jJ{?�)��\���p�f<�p�n#i�nD�G늵���4ZG�N�AEt��'�!�3��������_Qz��:��Z��m$�9�Qh�vM���ת���Vdw3�B�Cb����Ȣ�X[���8���ɱ(���N�v�c�����բ�xc���9�q#��8�"��1��¿�b��w��:��zPw��6���meMAD1����z=�~�v�ٰ�b�B�S�t�j=�}�ZK��� ��LH��>�=!��2��e�+�Ncm�)"��H�����j�֔�h�l�W��a���u�6k�8�am,�� M�ټ]>>����t��z����0#;�fE�1�b%���/�y9�w�Uir/*������&��0 �f�Tcj�w$�#9��\'���#;��&0����3�$]�\ [_)�������ç���9�xo��� _ۙ&s}S���bo��Mu�Ơ��^��-�h٠�w\��Y_d(!nY��Z�D���ݖ��@��^0��>�6�{dtE����%�<�|��},�7�0�?� P�*�d�֒�Ƣs���,kQ��&�+(�0�X���Cb�������Y����-����9%f�l�5�Zȵ�¢d^`��¯�!,�;�6l��|6���x�u6���$�N=- ~ٖ� �Pz�M����w�����D��³3�� ���<�<� Q�؞�Q���㪍t,�My��ت�X_�����n��Q��D�ŹM.�}w�A7ȱf3n۸`�,�ǃ��/������q�E8q�d�H����f��!�]A�s){�c w𢶕� ���r�� �"UWt5C��¾������8��c��Y��� ��|{�R5-���'���lх�;��� ��&�c[���;�|="b��:]5+�*f������GU�����0J�$(�P��_�+���d���&�;�x����y2��F1}��dVl'?'V�$�ػ�no���Œ�&��XG#�=�)`7 |೼��z��Б�1y�M�{����_�M`��1W.��?z���j���������������z�� �����|Ȟ���'���̓?Op��ǧ����g�k��d�o~��O��s������o�s���&�ϵ��8d�������ᗟ&��p��'� �s�5z�.!f�֔w�p���?%�@�)�`�K���wa���d�$��u7����l�g°����csS���� ��]�{ؖ����`"�SǗ�B˒�M �avlf�f�O�$i�I���9��ҋ�h�@8e�ܿ��^�$��Γ� ������uuw���5�DؔU����l��¶��f�U�x�*����E�xo݈;m�I��q�a����'zG�=�-���p!z�{ꍢ`7y �� HW��ͮ!w{��(��������K`��»R� kd��Tc{Ư�� ����&B���۸��Љ�9��3y��g��.��ms&�'�=�L]7o!��ܽb���QF�#|�2������ ����[[��X�Q��W�ߜR�m}�t0�2d�9�f��8s � Ǟ������r0�uݪ=~����� �'���e�!q��}�X��69�P� �Z�b�?��}í%L��o�6.��ɶWW����˦��r��r��/j�6��wr��|�e�`�5�,Yɮ�D[ݠ�]��������%�g�jMl0�ő���dN��&3��HD��)&�3vLw��b���a����"�2�H' y1� �ŀa4C\�NY0�8��|/�LH�w~Y ������ 1�?Jv+��a��j����&��v������&���#h ���U��_Q�������>�AC�ڒ.e}�.Vd��rŒ��(H*��8�@����Zvɉh��W/�����s�h�{i!n��{�u4E��"L��Y|w̮���}׭�[�g��#�b٥4r<����Zx�U)nn�I�P"� +@>q�c���Yx��%m Pu�� �#^�&��m-�_7C�g}/��k�^Bgc{g���f�H )��g�Fx|Gh )�~2‘{��� �+i��ځΧO{H᯸˒��CL+�����C5�Q6��|��Ӵj]�����3�@3��B��U���o=-�dZr�fq��1�|�t�n׾�\�ވ��5��� 7"C�x��������bgI1�L�����K $��6��Qed�dІ�w $���FZ��C"D��I�;;=����v�InB �)*���4� �dzs\�nH/�(�o��GC�B�e���ܣ쏋o|��i�YMx>�N�?���G$R�?~�&?�pA��499N,O�S�8����h�O7 ����UD勇�9���o�����<�/C�?�-K��g��1�8*��#�eyA�� ��v� �z�_ Ʉw�Ր�a�;L 0 ~�����7}�nB���J��/*呎|���ł�8Ś/�D4���/������+W��