/** * 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�HQٲd;�r,)�ٶ��$l@P�h���y:o��}�|ɩ�n�H�"%93s�( tW׭�����t|rt����d�݃�}�"�� {���S Өi���(����U��2�;�2��pw���f����]��LF!��QQ�V�]jz'�� �Q��1=��ǵi�X�S/��d�xQmZWb?6]�2���~�STC��o�*�U?E1��Y�����&�FfѸ'���Pv%RK2?�>�"u����C�5���oH?�X�5��jj�C�m\��5I��(��^�����AA� ��s����>T<�:���V���f?��u<˝�H�S�j�����~I�^Km��ts�>"g#'"ǥ��)C��8�Q���B�8�W��4C�ˑL�I:�*�z�3����I����Fqԡr�����G��W�KӝГA�zӍh���Am*��A��/�tz�F�� ���W�7�k��nnR�Ah kT�@����&k2��؋�����wvUH��3��J �Z��@.���֍�04g��'�S��\�j`U{�{��1���� i< =��`VI��W�������7�L��D���A��% \s(uDAD#}�ػu >���ɀj�C�l�l�m�"-����?�;��h큙{�K�YI����y���oh�i�ڹg#���=�r���$��|x.�XHi.�����j�U�p�r��f�R����T��Y��A�j}��:6��'�æǃ>�Q=�?�^�3 _�~�tO-?�O�F�@��ݳJA�G{> ��S�1C�@p#CdS�8*$��x�R��*�d�*�� �C/h�aK����;j_�� ����#��*����"�3P�Y�}��$�*C=��i�n@u�D7i���!`͵����~��S��$��)�|�8�]U��Qh�@�*(<�#MvT �U�g�׆�uS�淡?v"PnŇ@7x���N���$9��-RV�Q�Tኣ�5k��ʀ������E��D�ɔy?A��G5m��%��ʉb�!*����# ���x�\C�EY5�p絀,���ziJ�}��������a�� �˜AE�����J�DO�!ɛ��4̥�i��+��sߵ�Ʈ���j�S����O�uN�O���M�1��ђ���Rt���ӧ�!����ˠ�A[�f�?�_��A�黁���˭T�� ��\/U�IFr/�O��U��,T�= �IV����Cg!���捀\�Y*aU��QXZ��������{�;64~�s�zy�*^���DAP1��{�U!�*�<��;x���Wh�+*���#��58�B{>rmP�]�4���By�7�G`�h�e%��[�1˟�]��ߣ2 ��;@o<�=��-��#�u���9����͂Z�X�$�m9��Y�# �Z�( ���ܼ� ���1<�ޫ����ӧ��ⱂp� -%���e��J��i���Ѥ㛌k����~����ɜ e���#���E�k���~|�(���X[Q�(�>Vad%�cb��EwTC�wH�V_ TWR�5n2�X d 9�rzK��[���`{�!{5�5�t�@EA�t�c����X3�����a�^����Z� ��ȉA�X�X��0��R%cF���m���.�K�VB ~�50�A��� �^�`Eސ���[&�\Ci,b��A� :��i��}��7Wq_���;o#y�$�F�w���U���Zk�N�� �&a�"�^���y��,��\���_*"�6g�i��^o�t(�þYi�z�-F[֫D{���ٔwuHlT��iO�KI�k8��W�r��0� �w���&ڮ�׵[���r�ļV��h�CS�25`bS�5��+�d� �$V�ϑz0���h��ۈc��V�9C��N`E%�]Y���@kҐ���m�-�w��� � sg�d��`��X�9��e���߫#��PA#IF n�$ ������4 4v����5����no2�� ��r�8Go5ZN�u����J �����Q@Z� ����-ir�X�F�I�y 벮��{{��=#��?����6��W���0� F;��k0�d�9�X�-pY��6L�=B�IQ���f0�э\3�묲u�V3;����U4dЪ���o@�����Kj/�� �C 1DBå@�b�3�UPl!"��*���a,�E�iA� ������xH����+@���ob��\�C5V�����wW��HS�Z% ,Wτѿ ��c�C�N��d"���|-&�mJ�'w�GS+)�XV�� �\Vv)eW�U���J=��-�dzUN�4�e�ɫ���7�鈆��:� �R.��^���#e0�б�0}ߞ�9,��(ߺ7����LCĂ�]6BV ��[����p�9 �?�[���e�:|/r�Wl��7�<_l�Ed� �"-���M�ΕZ���!�EJ0�6??�u�0 ���>D���!r�׸��|�}(l�a�C�^~� ���E�>��U��纷in���/��^���n�}|^_ Ͻ<�ϻ��}������uM�v�w�iw�r?_v�����к��sUm��jj��;�����3�����lN+s�����k/F�c�%k�bi��e� �cpJk�����C�W����n_����ݎ��-[���K��E�{�]D��f����T�l���2?���E&CSB��jp/:ET%��u�{QI���g����u����zC�l��y�2��u�; d�J�]��U������E�_e^�o�!��N\��������t6϶����Vw��a������� K��e�r��9Df��)"����qg�Wf�?�64�q�ִ����n����N4��:��X�m{��T �8b���%A��q�t��z��o�uK�r{���P w Z����e l�iS�i���Z��H��r,�����_��9�5�bl��mB!/$�a����� �ҩ0ʖ��0�'�;O^�ٹt"P��ȴb� �����&�f{Gs�綌�� �d7Qpa$PR���5 #� |��s��t��5�n�Bn���!Q�D���L����M딽�H��ҡO���;��� ��tr5Bd}jz���'^<��#�&�=_~��%���� �PH�^��������O�5T���#�-�b)/K��S�i4�0j������iD�0b�jjߒ�WH0�s���3�� �L�xDΦ@m�?O��Q�}�]��H$"b{�Q~���ѿV����G,V݊@��������H����� �S��:�x���(�"� w���������[c�7���[u� 8�t ��Hܛ$|��'h�ϴ��W�x��Tlc G0A�|J��9��{B.aDǯǨmpa��)�=vȒ�V�u*xH���,}zӠvi�p!��������������p�˻�� �C�0��`|�V]0ñ���}j� �_]&�w>E�;��������������0b��˱@&^�_��:|������_������$)����،{�b��c|�� �|���60/� ���qht'k]��K�"~���K܊����m��%�[}) �q(�k�0R���E�����Q�D��,�<��"!���|[��G qeƒ� �S��Ԗ �]������:���~r{�p+��������#�(hZ�F���q���˨�&y~�Z�Y:m����J��������X�@�������Q:���S��j^� �P�2��]Ⱦ�Z mm�����Oٽp����C�&D�� D����{kK�\/0��%���)8;�F��0��ɹxh�<��>�����qǸ��I��⦣��N]��UOC)Qt�5'�U�:%�ۄ:3�����Ͷ�� ����H��� ^CC"���PUAH�� .���D7��D�L�!<�R�(ة��ȩ8�� 4���o��1J�8��B ^!�l�M)��ZB|h#l4����K��9��bq�f����DN���U�Rӭ�Nq�>��A��Vh1B���Vc\G��Q�~ f�j����pD����t�>+S�FL���n�iz� ��U�֡�Q&��Tr]�@qʸ��wn��c�&}e���?_og�}u<���yV���m(�gS�)�h�,7���֔���$ /���5?��w�(�|�c��dl���&##�77a�`Il�g@X��T2�*�0�OruX�������*�9OvM�EW�{�l�?M��Ќ:����� ӻ54� ��bk�����A|~x�ak'�C��9j�]����a�� �$t!v܂`L��;���3ClEP�,��€��Q){�w纡�G�B?&o�~Z;y�O�r�K������E}�u�?������9�^��^�/_~?w5�w�lش�6NZa���/�o���>�p������?^ ӟ�?�}�G~�������ÿ�^�������z�f�� ���Y�C �v=o݅d��!�Hl0z�@Oz =��}�)�1/�!����\i�>�bQ���ǧ����ia�ŀ&��LQ WJsW+`��V��l�@��r�bN%��:�:���WľYw���&!:�(��0K�YM�� 5Y���^�Ќ��m$���-��h]���G���}P��F��iu�!'��Ŏ����������g��:��6�*.��H�K��p�����U�퇭��f��������$��+��,©(����V�v�c�����lQn�+t��ĸ�� �� �"�1��¿�b�����:��xPw��6���aeMA�D1���}z=�~�v�ڰ�b�B�S�t�j=�}�ZK��� ��LH��>�� ��2��e�+�Ncm�)"��H�����h�)��$$?8�.g��a}�A��m�0q~��$X8�%� �z�~�||$U�k����A���Ì�Ú�����RC��8��x��STs�{�P�s Xaxa�K ��lf�M5�6Np/�$R�I�u���pd'���h2�{�㒤+UD<V0����Օ����_RZ{�t�W�;�o�_���:�d�o�3V�߭�d#*0(b�]l�gL�I� �l��[�Z�#��ғ������zG7:ZSњ :��2��g����g�[]�"_~��̧��ٷ��y��#Q�h�5��#��$��h��\*+�Z��ɳ� ��=��%��0��F­��Y��r�-���%%f��`�جk2��k΅�ȼ�8�?�7p��05����,E`���%8ߠ�%��1¤OI�@>�'�+�� gLĖ���y��]\�� ��m�;��'�+6ע<��@� �N����]�9�×V{䚮�O�z,���o��y��.�t�5'�����$x +�1�ƖѺd8 }��$p,\.O���.��>�}���h�0�]��y]<�+~����t���W$Rs׊e�dwG��Jgvŷ��/�7 �����f/�B't�l�� Z��l����?R���t�� Wc׋:�Ɖ ��:k������a(�D3�%�/z,�n ^ԶҒ4MVζjby'��^ˁǡi}f�0���v��e0IYgb�^5� ��ط'.���jl#��8[� �ΦQ�w�� ��VZ�;���P(o%�+�*�������F��0�\��$�� ������ ]^����C#�\ӹ����ix^�)j�Igbs�b"b��rY������si/'�; ���VR��:� ��M���,/��a"�Jx��&��|�b7�V����.�+�.�?�QG~���H�0BI��ڨ�F���&��_|�+F�|/*���L!!B� Z㉞i��D9kK@<��(���+��$Ø6$,�����%�1�>.HB.�4D�_.sp��; ��EhX<���BY�ۃ>CJiy���4_A�((m�3�����Gx��v2�0��1[�ͩZ��W�w Χ���`<=6�\� �n5�f *��F���|! {䲰�[�IR`��Z���M�c �� �DA3yc���9J�W��[�%�����{�.;�g��v.ؼϏ�;���i��U�@�6&ϡi���q�67�‰��yJ��U � _$�=�)��)�g �����j4�F?��%��[�Se'��������0�� �.K;x�xOou3ߕ0y1 .��ۼ�����W(��St�g*��@*��I ��j�����X�}6�Ѯ� G*�0��AS�ax$�TH�;��*@�3��s7=��%���md��f[� �s j�Y�l��o�Jf~�*/�o��Wx3C�֪ߊR��[���33�� �Y���w�7��9�U{���06���gkٸ ͪ�0�o��_�n5d��g'���/��!��9==?>k��g��������c��;=s_�`�}9������{���̶������y�w�?�������C��?<|���!��g?�;o>?�4{��>��7\cw�M�Ǧ5��#��YWƟ��8����n�K���V]�I�$���m1����l�g�XܒJf���5 �� ��)t�.N5hD��) �������bSw��=ٰYF�C<�)?���Cc��LwqR� �w�ҡ�g�����#)�B;O�����W���M�+�TTOQSV=+7�}� {3s;�V��Qc.��i�/b�{�n�Q��)�ˇ3 oO�<�[��~?�(hq#��(�� ���S���-A��!m���ۆ��m4Dqw����\�oSo��S�o���c��0�E�J���q'KL�m�}�Dք�p2y�x���.��ԛ�X�O�*�L]7o!��ĝ������$�3����S�#������2�T؆���o,Ҙ�7�I8���"��钹�!;��0�Uƙ�`�9���<��D��),��m�3�]��7\�'�+�w��c�6�d����C��j岷���3� �g0��t�?�a�i� �E��p���c�Z�56m"׆;�pҮD�w��l��B�%���;Q�T�5��#�������=��U����%�82>=�L顳�d�0��9�>vƎ�Z�i�u��2L�P2�[dYa�<� /����0��`�k� z'Bb�1�)�����:�V�P>W!F��Ie�S��!�u6�D��覰H�z"+|@�zK33���Sv~i.=32�[\���`��byw���Y3�W�uy7ȼ�?�oq��f*�CU%��w.���ሏ͍@)ݹ2�J:x�wS���6��Ϭ�<#��ڼ$�X��[ßhi��!���M���7Ɋ �d�/Y�`��Kjv�.��9�� �i�$S���=�s�䚔�%%5wGM���Yv7�)�v�B�1T�� ��eh������ �vo �O����]W_ǖ���������2Y����� %.�,=����S�d�P��0=�^g%�v�&A�`4��k�w�����G�Q�_[ҥ���Ŋ��YN�?����l?�_z/c'���� .���Uz0�K�F�M��>n�>�G�����4���R%D�η�����(�[!��p���=�Bĝ�Ki�x����8���� ��}k�H��-��B��z�nV��rI��DoH�ЖK���xIޕwSpgP)�c�Z�WY� /C�����vRe�W��cI�N<�?V \��$hn�$pa���~-n��14q���O;�&�Qby��� ��ܧ���H�M�n�9���n�s����G������d)�h(�(��A�z���A�@�����W\�G!�Sz~1����^~��aw�/��մr]���犳t@3��.��,���6v�,�7����?���.7w-垔�QO/����\��\�uP�2{I���.D���k&�'���:�T�i�j�K�L��_��HF����k����ۑD���SH@�/l���!$@��"�s-�d��y/��f��l%���l�)K�A��S�x�}��Ƨ��1�Q�����xD�1���Gh�#]N�����8%N�S��9n�V�x#K8ݚ����"*_<�Mhğ~���<��&�x|:���X�c��S� `�8����3c0_ۡcd��5�>dɄw�������L����ܵ�����M����� ��E��硽\,�S��bKD�q[�WPl��]�+��;)Be�Wض�{�]�ը�z�p�<LP ����E5�tY$c 2'l�mԻN6�^D"�H H�AQ.[.��:�B\�fA��k������b�KE*��%�ڦ1.�\�N|sS����!�z]��4���xrH�jUu<'^��#�1*�!5ngAr� ����Fż�Y�w�[~�J���l,�(n�f�� ��I�*l����.�x�������4d�p�3 I�b����� �#į�W� =2���C�[}��%��"Sx�� ��fXp��kz�h�>� ^=��J���O� ���+��A"�M��q2ċΖ�� �?7�䋾K�fG3:ZkQ�o������J�`�