/** * 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�x�Le˒�\l˱�dg�h��A@]����?�Ӽ�����)�K���q%H���3g�(�tW׭����x�������w/�,�;{���q w:��+�K�F ��= �+�����^]�mW�Q{:���y���9����:I�(��a��9�p'vF~@��UD�pӛ7/|��܈�Q�wS� �-9�"ÑMÜѦ�7?�M��x��]�s(#I��~�<�idsf!�F���K�/�f��s:��mz�{A$Ar$]�V4Y��6��^�v���i8t�q4��p��C#�%/ � �2��Ȍ�1 HKm]��gM���xc/ w�;s�R��Ɣʠ�l���� ��T�C;�}�?)Hk,"O"���)��'50�N�nj�v�i�2� �1U�/��a��2���v,7DF&42g;��v�� ` ���M�};�*c�%%Á�t��J$��A͆�;�iD��6�0��r�@�d$�%��h �]���l�3�40�Xx��%��T݊&ޔ� ����/ܔCS�� Y�d�w 75��kͱ $!9d�d�ӑ[�� K�6 �sAL����$�����e��l���h~K�=�pp����|�ܾ�]˻P�.|:�>��4*Ӑ�ȵ46Bz8�P0����*�L?6Y�?Bm�c����:���>6{�eO�ؔ0�ߝ�Kx>�>(Ȱ��!<�f@��l���_�ޏ�m�t����A�*� �p�ߟ�`�Uz�.��� ������P�3�S��8�P��& �D��� �~}n�k� ���F��Qp���u���_��0 ���sx2����� r��ʹ�,�ѤV�� i��� @m �?��5�����[%D�8�'W��^���3$ws���k@Y�� ���Ԇڀw�{Qx���� �s�Z�\��r��S��-}?��U���)�nTA�XXo��=xrO��⦾�h�$R(�U-�WP_�Zd��h|�>��S/b�6��M�(i�Si( "����L�=��>.&T�|\�j����)�J�q���#m�(�֚��T��H2��O9k��q[��f��y�3ϝ�3-��$i'�3��})���Bo��뻬 ���u���B0��h������Ȫ� ZZ듸ֱQ# 5��.�6�F葽 �� ����� ���|��iH� �b��]��{����8��3��: �s�C[�dp/��[M�,��(@�?�@ ��[R����{s_��;W�G�M��j��p�AI�qa���R�P04I]U%-��}� �IZ4@/x!l�}ԯ���(� A��"��c�{�U�w#% �(T%�~�6ltB�Z3۱�aݔ��]����[� ��_d;�c�kC��>��V��*���k���5ҷ�&���PUנ�� �9؊aY/�A��vaQ������5���3��z/ʪ�;�%dח;JR����qDP+� Ӹg_fOj�7� nU�z I�bqD&MI��_I��,�]Wm�U�,�V��Z=��lj�s�}"D:75��#hH���VDK� �����Oᗰ�#�;K,�~m���[�0z� פ�&J��.�V�N���^8�7���y��|�l�e��$�Q�H�-�q�< �B�l��UQ+����8&B @u�V[�~�=ۂ��s.�(k�f�Q�9�� (* t�`��*D�I-l,>�<[�f��5 �5����ZOt�# �2mPIݨ4���\�oΏ��t�J���c�_�]߽7�Gd$w���j�H�� ��l[��7KjMc��,f�����Q��EIXh����W2����g�{}H1vx��…x�!�xCKI��`�V�#��� t��Ɗ�H#n����0�g�[��1~8�4�!�5���d�`��ɠ�9��0�����԰�a3���)(�� Z��Ç[;��2Rsj��ht��X�\2��\��Z�`�����AA�pc ��++N����,;��jH8�Ȟcn� �c/�h0$0�\κ�Ù�.�s]D��B ��2�F0��!Q�����lPT��_�p�)�ɪ���ox�K��/Ůh�2n��i�5FJ;��Ev�q`W��D��2##�� #��,v�A��֐����@-�=$�f� ���@:��o!�u���mւ pHM�[c�����Z���~�a�+�����i�^�1��"��bfG�R�V��R�p��1#\�o�r�s�ܶ䀂_ylNt��r8g��[��X�;���$]�pJ;����k��`�Մ����~Ck��R/1 �`�y�S��с�NCMՀ�����čX�$Sm�&��~��Ѓ���.���8F�IUWHv� ����o��S�@!�6��F��<i^�\f�,X��쵁V+>csZCӱ�u�g5�*h�i�h��ͣ�aa����'i@��o�nU� ���w{�aU��]����^�9" x��rj��7��P@,��I����W'��8hImt��6j-�/Dl54MOE �)h=��?���zi�+=��� �6������=�Z�0�w\V�ֆI�G� ) �SWuf1��iZ�U���jFs�ry8��F���mh��RgE�%�?sd!�hAh�C^l|���- Cd�]t���%��7L�:!�Qa������i1�no H@�5��W:k ��+�:����V H@:��-aq�,��� �P�u�<�� ⟢k1.mQ�$8��~uԒ��U��o৔�ʮ� �j�J+_\n�8����Vo$�y�* f��u�Aɛ�Ō���!�0%OzY��> �G�`��m�aƞuE X��Q:�����| ���F�2�sp &�S,"{wK|� �}^�N�� �)��C� ���"'C1�s7,ד��Қ"����U��#ZNKS��Fe3D����ȅǷbDL΍��z�S�N>pŠ�"�b��lT�-�� �*�I�Kp%QcE\ | ��д�Ҳ������H��e�#��� �V�zc��b�,"�m`I���n��Pj%^o��)���|q��zi�<�}�T��!r�׸�j��>6�0��v/��+{�{Ѽ���Un��m������V��ݟ�m���� 䙗�yw@^���yw�}�0���݁��|�� V�aw�u�u���g���6�Uw����3�����tN+u������#��a�½X�B�j{\��p?7�T�We���e6v������v�e}h�RŽ�(�X�Ev�J��R�ЋQ��A\\xsCL��<[K��M �������Q�Њ� �E%FR������������2~���e��� w@�ʕ໼3��2���U�˄�ʼ0�xC�9]8� /b[I�il�m�I��)��j��,#�٦�����6����S�� r��ZD��O���\�^�����V�'�AOU�>V[��;l[4�����¶���eܶwqkK1҈B�[qkK�c4< �DZΐr)�x����Mf7�%���Ë��|*V�j5�oÙ.,n]6�(k �>\�5M� Kf��v��]\�V���]&e�Z�^��Z0�EE�W�v�c����]�1�o��ތ͌�n�*d�Ȝ߭�J�_Q6(���xGȸ������̬�,n�W��A�\�Gd���Y��x%�k�L��iv��)�I�V7!����?0�S�v��o)me�BYtb,�(�㤿N�R����>� �YP$����0%tl�2yuo�.�0ZX��{�s�e�y0����2�0,�h��#����u�"t����f�J�\/I�7Y2�����J������X�@���p����Q2S�6�_�����L��–J^Ut!{% t�je�������8xv=�5 sWb"�2�O���"����J4�K .aI`�c ΎV(��=?���!�G�vA��6�W�2�5Y�~���)J}�d���PJ],G͉a���I��6��Ĝl��dw�f[�N�@^f����i�����YT:G�E�nk�¹+��1Q���<6�� ��q.��ƇW@50�U�!�xc#a��P��I ��g�lr1;C��Ca� �=ƛl��S�u ���6���\�.�y�?_o��~-<���"����6����@��U�QQ�`kJ�W_���X�*���-: V,�`�>���� {d��� S� �t��~:T ��X,E�Ӫ�1E�$S�ei��˛|y�P�"ي"���s����4�EC�[П��'Ln�P�'�~��u�n+� ��@��a܇ldz�»0�Yc+�X� E:�;nA0�s���Vޙ!��?(s�i Xa�\谔=�3�гG�L?&o�~�%k��|% ������ �e[2��t>V���<,��ϊQ�·�q�WF��,��P�ٖvg�5疵q&!Ҕ/v$뺊sDx �cO�S�6� �$��M�F�� ���Y�y���\b����b�2�<�:�w?�9B��SҶ�~�"��A>���bҨ>t��n���YӀ��/��(m��Ld��tM'� p�nH��栧"�$�^����h�^We�� s^�_ \�r& D�Ѕ�K�����R)��H�J�~X�3��<���@�B[�&{ޗ�_\\(q6S4[fj��j���e]S{z�� zm�7P���}>%��3�|�$DH����aL�˶�WK��=~6W�r�K�_��lRr��'�q'xْYx5{l�$ěo�c�8�x>����ؘ��f�u�Ӥ+�x��.���oDX�H���B��\�2!W����IR<@�f{�����s~��7�]�x��A|��0l!�%d�}mCU��ߎ8 ��M����� ��E;���an��v9����f� 1R�w现5Аxa�o\�������-�m�����0�R���{���yt�[�Eo�㷟�O��s���޿�ٙ�����W�_�헃w?�}{y�_�_��{?9���a��y����+�}y��=����ӟ_-^-^�������?��Oi�zv�Ʒ~���SG�wO��]�����r���o����o;�/���r2��y�����/���??��G�:�����^��=eKP�\�&�"�5������hݹd���A��`&��:���z��}�1�5��)����\i�>�bQ���ǧ����ii�ŀc&��LP Wr���0�p+�G�Y r�O� ~E��Cw�I�y��+b߬;��e�C�CW�&⬦��������Em/ ���C ��6���f�EXU�}�'�aѺ� �m$�N�ṞW�ߨ��������*��۝�m$�9�QhP�&���*�����L���X���pf���$* ��Ǜc�89�+��o<2.=כ_-ˍ��N� ��7�=�ќ@D3�1�X"�*�K(F�yNJU�����[D�����+=�_,#��j������a��:����i�j=�}�$d�a��n&$ny������cr��Ti��!EDt��="8���~E ����vyU�[��C@�Y��� s�`ဗ�.��V�v��H������A���Ì��CŊ�c��J��!^_��]��)���^�(&4"cϓ�dgɊ��{:��m��=X�� �r�/B�����$��|���_�1:U<<�>�q�z�q� �- ??��y4��� �s/����=NP A� Mq���ZA0'�֯��&�s��Z�ϕG�BL��T�]��pl��2���Pa2j|s�N� #�ܔ ,���(#2�ď�F�4��/�ٸ\�c��kL8_�� K��S���RJ�K{�&��㗈���:�e�v�I$8^e��a�A q�tFՒ�֜���hpv8�.��d\:ԝF����tt�Ty�t�"͉����E�]1�������%�>�6����?�oK�I����m8���P�&�� i{�L̐�"����� //$/\ �^"٤��"�  �%�c���,�7:Ʊu�<�/�a�\�xK�0Ir��RK�1���xnc#�9A�(h�ol��x�'ī�������L���x��#>�-�s�f�~<�8vp���[��n�B�ͺ�B� *���\���ó�$N��@��>�q���ä)�g �L&��5�T��ձ�~v�s����5���=H|���ľD������>h���w�L����8�6��-#�8�5 :��i�J��S�Bڠ/��b�x��4���Xk~~��U#)�:~x?��I." 9 �� 5��V(�pb���nr�,M�9�#<c��D��v�ANOA쀓V�ߝOd�Ek��w$v��v��/-����9� v�a��FP����5g�����&�S%�nK�=�6Z��W�e��*��>N>�C�hWC����]�lv�ݰ}~��B����ۇ��ǧ������m|��d���������=��O�7��?'����_�O�?����F�|q����<����w��������h_=O�����I�j��O�O;/�/?M���(�OfA������A�#� s�;H�Y_Ɵ�!Д�Ǖ{��;��X}�K�M��p���,6�3`�n y�c��� ���л;��#C#Ҕ��T���'��&����(͆�2<�� �Ɠ�<>�U6����g* ,P|�p��w !���H � ��'�� A�����&��*j$��)���{ٶ����� ����]H�[4���޺9w�槕J�&��޻#5O���60 Zޗ+2J��B������n��� \��֕[=]���mQ�����7��ۅ{�D��DS)���_/%�B(������,1ڷp_��� �Eh��q_״]2�:�\����ę�f�B���sŎ2�/��0J�r�o=R�\ ����?��b2|*qk�d'�4 ��{�Ӄ ����B��� Ì�g&����sv/|vO`&��[��O�vς��pR�,>0�}�%+��&����PkW��n�m�݄I5�����5ؖ�r��#.Er��rU�+��\n�©�9�S>�`0�AV�n�o�-oP�N��j��ފ�ij׵&6�����\<���z��x$"Hg�{�ۆ�o��3�lf�D�x��̲�2��A^L"Hm1`��פ3�$N�D��� >��_��)�a�|�B 7���`�$wT����Û�"'�T������8�S�Gi�q�Bzjd,7�4�9U���������;��+f��#^B��?��� 4�����/�ӕ�/�AՄ����x\H6?���a���1����E/��< �5Zc}��zF�?�c�]�Pz;G|�[�����<>F� �M�f��X�>���:U��1鷴��b+U�*<��P�Zqi�|RbOs�h9�WT~Q��T���U�e���$~�[�{\zl/ ���h����x٭P�����"�Ovޛ���[A��#Z�|Ȏ���BW*{m^�K� � �kK���u�X�u;�13⛤ 9����2v��V��'�A�`�0J���/ܣ1�eD����W���'J0��g��1��� ��F�m鮜��q��� gW���� ?b�1Z�U#5�Ԧ!ɲ�%�^@T�]塶�I���aJ���z ���2��-^���� �=���g1n-�+,�{�7z�!��NV[;���ۀʱĊQ��k9.3xb47qt��/�#.���Uq4�$O;�&�QbY��� ��5�'���ٍ�nv36��@�|�P;�Go�h�5W���i'�O�i ����1�,霅�Y��U��`=�i�Q��b��C�g��u�U�l���JɈ� ~{D �oɳG�O�?�e��F@� ����s-�K�l,���p� ��!�_l� c���HC�!E�O�8�co۝A% 5P;���i)�w\R~�ieχ8|�L:f� ��0���U�\W0*�)��L1� #�htzg|��Ps{�V\ʙ���_���E���u ��>$7eot}j���M��:(�G��q�bg��Y\�5�qy��RC��|l�?2f�hC�;���j��c��� "U֎$ꞝCr}f�Ѐ$' ��ь pAD~�~2�.@7��t��7l��!�����wL�i�R���7>� �ԏج&<�m����xHM�� �� �A����8�,)N��T8~����>�4$���J�W�'N4�O�Qˍ�Of�@<� l�p�7/�c��c� `�8����3s0_˦sdh� �~5$��WCz�i�0��4�u󗻶���� ����+}���G:��ej� ��k�� �@��>��bO� \y3��0(+���t�j����7J��y޻�ѣ����yG #�!�1�#�<]ǻ��B�%$5@Q[θ���