/** * 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�)Sٲd;�r,)�ٶ��$l@P�(�5�p�����yߟ2_r��W�))���Fq$���n]]]}ųG�G'��{A�����~��kz��D=��X�4j�d�Y_�tϙM�������)u&�x��7�T���u�/d��P��q T�w�鍝0���F������5,�^��{1�b5p�Njԋ����*�iM��G��HE��o� ���IČ�Rd�N#�3�Ě�aD�tz�R�IDM2}T��G- ~[�n���=�sϴ�[������R����B ����*N��ANR��N���>�*�F"�~#0�Y���Z�F%��t�x��<�G���?�B�W�?2�c��ӧu�rA{��J�oў��c��z�Pk����N��A�p)vi5�[�T��a���a4ɰ%����{g_���9��W�G�M]��5��p�AI�ea���l60JM#Mb�}�. �I[4@?|�j�}ԯ���0��2� �LO1�sDZ����q# �!(�J�H��� �gL׆�uS��w�?s"Pn͇7x��܎���$9~�-RV�I��G�k���)���ۋK��K(���)�~�bANô�� �k'����I�Gox�by��s �e�pÝ������)Y�A�����J=�$���9��>�[����@C�7��h�Kk��询�y������z�hP7�Z=��|j�sJ|��uoj��GА�祭�V�J5����O��/a}G�w�X��b=S��Q� �Iߌ�̺�Z� >�z�.�s0r�{����;^ ,�B%I��ʑd Z�|�< B�l��UQ�����k� ���y+H�?k��cC����i��a�� ���A��[��\"��s9���g7�)� �|E��}�y�ֳ]�¯\ld�nX���i��̛�#0B4ݪY�Ƙ�p�w��QI��7�>��-���uG��%����͂Z�X�"�m5��Q+�z�Q�����n�� ���1<����c��O�-\��‰7�����j5>�mߚ���K�"u��ɧO{X��~T��F�є�x�8�pǟ� �5�1���2fT��(�o6#ÊGj%�AhJ60h6�>��am���Q�1�;�S>c��0��1�F ��rKX����p� �D3k\�_Yqr���e;Q��W‘�G� +���]���M��!�b֥MMPwe���":��rX�\�13É� �F���]�E�8�ULי��5q��MB�o%W����B��v:���(@�#׷�(�3 ��js�HƊX7*�>V �Y��11 6f��8,׌p��:��`���>�DZ���-������x��)^�M��mZ�܄�д�y4��Op��3��]�F�) �ٔ OL* �ܪ5:4�o��u’�F��L�v1��vzC7�tv�q����qޯs6�0�����yd����z-Bߏ��YBk+���*���D��͐B��]�R��R�+��Jk@�j� ���@�3n!�w�>��Q�+��8 }U�����(��y���j���p�DSe��zl�F=�̠��:1��k�&0]�`����f���9wl%��W[c��ΝC���(V�M8��2�JeL ���5Z^�+�BT��lk�^�}�Z�l#y�$�F�{����*�yh��o�%u¡�y���uZ�q��z�� ��"lsf����ͶM'r8�������ate�N�'�X��m��Cb�NtM{R_J���v^����t�:0��i)yM6���7�[�W�r�ļV��h�C[�25`b[�5��+�d� �$V�ϑz0������ۈc��V�y�d���J0�=Y���@� i�z�}y 'Ɂ������l%�n h���s6�˺�U߯#��PA+IF[-n�$ ����/M��ܽU}�&����M�U��u@�N�{爀�F˩�ߜ_�B D��N;3 Hk��_���%M�kۨ=���!bS�u#��G�����r�D[�m����-z�7`t[�vF�g0�d�9�X�pY�[&u�!ԃ�(ZM]3���F��MVٺq������*2h���[��u�����K�5~f�B ф�p)���� m[�Ȧ� �2k `Q`ZuB��0��j�t� ��@:� -�W�1��^��a��H����H��u*@X�(� ��T���@�0��D�k�ZLJ۔ N�_m��tkYi�媲K)ø��.W� ly$�����HC_F� a���;(y3��Ґ�N�uL)c�^֯'f�F�*�I��E��o_���t��o�7�l��\������ ܂픆 ����_��v�����{��1�� �0a9�D�t(q�|�E�z2�ZZQ$���"8�����sL�i� ��Q�ѤlcjF|���[1"&�fX[>ʩ�'8�rP�&�r� �l�&:[�#$��'����F�k�J�+pU����,{; �߉+ZE�<�X{��R]o��\l�Ed� �"-���MіJ-������"y�/Oz]/̂=�'�����}���5�}=_r �{��P���y@�k{�{Ѽ���Un��m����������?��|���s/���|}_w�k��;`]ӷ��|���ϗݟ��>�.����\U�����F��΢���Lb�o�e� ����a~=���ڋ��a�½XZ����q����܄�ھ*����U������$�gg���C��*��G%��x���p/����L��^�j� ���ØbZ���Z½�dh*hW �E����V�np/* � �l� �ؿζ�T`,�7T�˖��\g�BV���1^V���Ϛ8]$��� �7d�ӹ��6�c��4՟�f��6�t�Z�����0ی���{�}w�%x� l9{� "3���g��cs�W��f�?i�4�q�մ���fo���/N4��p� �a��]��j�i�ۭ���( ΒXg@7��Q��[ �� T ��R��h�w��]���4�����ˋ�+�n��~-�e �sZ#/�v�9��M�"䅤* Q��D�aVz!���iU���ΓWeΝb�2��9���E��&ꉤ��ќ�-�y�d� �% .�**S���a�p��u.���V�澛����(x@�*�U�J&�Q�7�u��_�Lv��ħ���x~�Ǐ}|:���@d}lz����^<ǧ�&�=_���9����-�SH�^��ُw+�-*4۟�k�<��G[^�R^��ۧ��h a,�.K���ӈ�aĜը_��H0�sƎ��W$� A.�p�)9�jW���G�ط�h�؜�V���L��/r7�Y����au�L}paI�r��0XK����(��:�XX0[������֩˸w�Te�zS�k�|kJ�Զ�K-�d���i|��flf w PT![E��nm���EU`��-<��;B�՝��'T`fey �v������b'�?Ϣ�ū<� z�ήC�L�O��Z�d��Ͽ�a��@څ^��h5� �M��܍3~0N�뤬$���:����E�+( S"��.�GP���"�����G�3�=vm#����-G��R�F�Z1R��Xu+�s�k�Ԓ���#����+� L��H� �j�|�����?�'�'h�E�Z%�П�ު�T�1��[�XF��<�S�>A�|�%J�:�X��b[�8� ��P���Ϯ I���C����s�{�:�%���T�jՕ+X��.��Pq!R�=�_���v����W��b�xy|�}(V#���U��p���وڤ��ח���O�j�U0_�=};�!+��'�K�� d�u/�G��ـ_+/}���%���ש��y��� ��.�~83�!����]n&�*���Q��9�m��2�q��Vn�����w"�!i6�n��K�7�Rj�@��t�`����0�����]�ӳ0� ��3�6�mj ĕ ��X�O=s�R[&�v&�) �ukϒ{�p��<���ً^� �����e����R4� .`Ia# Ύ�Q$%�'xr?=��(�,���m�/�X�$�dq��c�''�]��SOC%Qt�5'�U��$�ۄ:��������j* �r�"�6Nu$x ���*�28�,��l+;.\ �W�I��gӸ2����s%�`�0&���,� ��)k�� =������@�$[c��Y���K�����KIs7'7t��X�Y*?v;�)(%���ĶT�tg�S��O�aܱ��E���/W�1�#Xp��#?3c5]�\b8�B\voB:u���@#���i7�,�e��*h�Ї����x*��`�8a�b�[���أ�H�>�����\_�h� ��7��� e�lB4-c���T#ؚ�:����%�|����xsN���ˤ��E c�u�.� ��t9��%���`��O�T���PL�?��aUZ��&_*UF�LvM�EW�{��B�ܜQ/����� ӛ54� ��bk�����A�<8ưu��!�� ��. �ت0�}C���#Ď[���q�Utf�����eYV0:�d��\7�쑢�Ǐ�ۿ�G��IQ�r�G�N�_/�g��_=SQ���CT�.~�S�.��Q�,:=���0�_����7I�c\.���&���H�,|��� I`do[�|6���c�`WIVQSInU��`""K��Ċah8/�����9��;�d`#3:3�|�/t�Bi��'���a%v/ !/+�͓֧��;^�@��bJ֖ =(PdY� h#2�[,@��ݤ�[��}���e�6塠��ӌ�|�� �Ћ�1��T�������Dou;í��EUd~�p�*�$B�/a�u8�I*�!%NL�Æ�.�]-@�2��5�\]��/�sr���yD�%_���}�U�d��l�U�o�}\������d���`����*��FsV � �s�U��3�߈�����2�|��eB���8;$̓�d�����c��Y����������X� ��*�a��'K�/�>��[���#�mq����2)ѵW̰�v b)9<�����rzI7��6<�b���3*�ak� �2���bWT�==G9����Y�0�l�ѷf��������/?����蕭��;ў�Gǯ�?��O�~x���7�8�vp�������E��W����x{��^ۧ?�����l�;��_Ͽ?=�������M`���������L����Q' �����݋_����߶�_^���x|����������z����}��w��^�zs1|ʖ!�� �M�+DBk8d �;%,��uٺ �� �=�x#��\�wC� �Tk�Eǐ���2���J�u.u���}��0ח�Ct Q]a������w@j �2��(��)��Hs��Ѻb�#<9����{P��F��Yu�!���Ŏ������������:��Z��m$�9�Qh�vM���ת���Vdw3�B�Cb����(��X[���8���ɱ(���N�v�c�����բ�xS���9�q#��8�"��1��¿�b��w��:��zPw��6���]eMAD1���{z=�~�v�ٰ�b�B�S�t�j=�}�ZK��� ��LH��>Ž ��2��e�+�Ncm�)"��H�o���j�֔�h��l�W��a���u�6k�8�am,�� M�ټ]>>����t��z����0#;�fE�1�b%���/�y9�w�Uir/*������%��0 �f�Tcj�w"�#%��\'���#;��&0����3�$]��wF����F�|Ai�a�^J�S��~aN���L�9��^�X1ww�wȦ:T]Pć�-�ό� � tl��;�T���2�p� nJ1�]�,C9E������=\�і�pP�<-��W��+:�@���^�U���cg�4Q‰�:��؜�l������ ����Xw�^-锲h��IJ�Y�=N�6p��h>�K;����-�G���������"��s�" p=ݡ�Mz���=NS )�Hq��i�=��M��3EԀ�.�_�w���Yȁ���x�矛���^ξj.J��1�M���!��ܚ ,F��(c2�$H��Fe��bsp; �|�V�w�p֎���Ǧ��� �T����N�,�'��Mt�� � ��!��Q+{�� + �`�Ö�s��������]@�sġO=�'�ҥ�$��N�m`������AjA�$�-�__� �1�? |9��[��Q"�chC ,���6��$������Z�p*������ �(�Hz�L�"��B"��/�%�N��m�$�@���|`���%�BG8®��4���o�&I�UVj�?�W4�l$�2'(������x��1�A��T~|�G�;��B;gl.����c�����G�@�6[�P�4AC�x�+�p"|x���)q���g n?n�6��L��q�����F��� ���ϩ��c��W�v"���c���K�{���wv3ߕ0y6 Β�ۼ�����W(��st�g*9Ï� �}M������h�G�����{�F2$u���~C���r"I&5�|��V(�p����nz�, J�"<�b{�D����ANRAԀSW��ߣ�Lg��k��}$���v��/,����9� ��a��fX���,g�����&�_%�jc�3�6x����e��+��NA��hW�I ��.~0�Ӓ������~|5����������d�y _>�� ����>dO�������w���'����������ٵ^\2�7?N�������d�~�[��k����s�{0Y�=���i�E���d2���,G��p�^�K�Ǧ5��Iv{J�@Sr���HL����c��.I�:� p�=R˷�τ��%����, ο�л��+��@#����@O_ ,K.65p�ف� �et>�����<>1469���� ,�|�pf�� !���H � ��'�� A��O���M�O6���$¦�zV��GqF�#|�2������ ���s�[[��X�Q��W���_�m�td�2d�<�f��8s � Ǟ�;��;s0�ߪ����;� w.����iq���*ֿ�M�9yáV�����D�p� �j䛡��Nmj���Ub��)��*_�@��r��cj�6�.��vr��|�e�`�5�,Y��^[ݠ����c�č��%�g�jMl0�ő���dN��&3��HD��)&�3vLw�ʎh���a����"� �H' y1� �ŀa4C\�NY0�8��}/�LH�w~} ������ 1����� ���� w6�9�4�d�?K�۾��4������G5�c��W�@�G�� 3���8����O��)|9��_mz��ީ�u����5��Qw�I7슄�{�8�;��ž;_��z\�Wq��rl[Ƹ�kT�����[�r�L���(�#Aj�uU<p�I�M<�m������bpd�$�.�5�_!'�s�����Óx ��LV��Cf�B�;W+/�`?�yoR�|�M/�h�� �;����|p\���x�/I�!��4�?[ҥ���Ŋ��YN�_#�AE��(W��^�®? ���Eq:?�~��p�-�-C��p/����p��ã7|��R�鴓�*�&DTAV�|�x9Ƃ%���0'K����Q�G�(M˕m-�_7C�g}/��k�^Bgc{g���f�H�}q�3�Q#<�# 4Y����p��� �;��J�v����R�+n��0���~q6��PM;f� ��(���4�ZW0*�)��L1Ќb�btr�d����v1-������?����:w�k_J.H������\�;��uP��~I����D���k&�g�� � �M����? f��,��h�z������*kG��N�!�>�h@�����xʆ � " >H?���e�%��� ����� t\���?�=����Ƨ���1�Մ�#��S����?A��B� �r��'�'�)qB� ��qs�ҧY�)��D|Q���dN#�� ����d:������x�>�Y=f�6����xY^�13�:C��߀��,����d���ô����_���z���&T� �K�~�)�t����\,�S��bKD @?���<��r5��2(;����{Z��,�7J�y޻�ѣ����u�D C]ɘ����� ��m�g���dP��Ö3��A:�ׯYD� q�5bp}��Х&H�Ғ|m��� ����Xf �Y���a�Xx�� <9�R��p<'^��#�1*�!5�Br� ���,�̰.�^�g7�؏��X�Q�v�.�� ��U�3��­�����+S)�W��h�N�Ag@�0�ƣU�4� �'��A^S3�� "��O�� �b�.`|�›Y���Ă]�F�M��LD�x�.m~^p}&�2�WۯA,�vi������o\�7�7<0�V4C�{Do ����j[Q��������