/** * 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�xe*[�l�b[�%%;���@�� J������y����?�|�Tu7�)RRr��ő���uuu��������Sw��!����� Өi��gQ6$Y��xcx�.�w�6���#�'|��ިԿ��C��b�˕�ݤ�Y��F��#��0(P1�n�� :jW5���=P�#r:q"2r\J�/�eL=6j��h�Yh�5G���fH|9��^�N��_���Ń�h�=�Q��;Sx2�A���Kr�������V�ًh���Am*��A��/�tr�V�Ћ��Ѽ��7�k��nnR�A h kT�@��=��&k2��؋��v��;�:$���)Tk-p���@.��}6��04�5���'�S��\�j`]�{��1��⦾�xz$V)����+��~-2�`0?ğnꙂg���K��X�4rͱ���qf�����g#��>� M��w���i)ذV����TDk���sS*gq$9��ӧ�ʜ������o���=��v�V�wK��R�9�R����^H�����=V�I�:�Ij#��I�?ԇRE�Pd�o=��QR��(4�l:r<�9 �#�#�~��+������ӈ�#���{V%��h�ǣxqJ�Cf�5�MdL�}G�dp/\�]UM�,�es��b��C2lI������ϗ!�c���H�����f����v~ ɦ���@�hi�u�M�:��� ,s��~���q͔)h dz�1�;��EWUߋ�(��P���&;*��*��Գ'�kCú�R�П:(��C@��wn'��F� >�) ��${�p������xe@Er���ʢA� ��dʼ��XP�������z�D1�5����!e_C� <�~�����n��Z@s}y�4%�>�y���Z�g'=�2gT���gp�� �hH�f�! sij����*��g9��:Z��i�f����ꩭ�Ss�S�g�{Sc�>����mߚ���K�"u��ɧO�X���~���ф�x�8�`ǟ� �5�a���2�T��(�o6ŠG� �J60h��n��6�HM�혃�)��"��t������������-��"��s��++N����l' \s�' y�L��M/ރܡ�4�^.f])��uWf�(��i)��US3;^�hDS��B6(*�1�b���M]ā�7}�\ЗbW 4 7��� �%]�����04���&���n���Q@(����i�1�&�a�f��O�hױ�5�j*�pǾw~�Z��|���G��^�xE�6�f�i�qRB�vfQ~�����`-�!7�Ma��f]xbRYP�VM�t�$�#>� K��f����a����tU7�tz�q����sޯs6�0�����yd���z-�Cߏ�‰>k+���*���D�̐B��[�R�}�j4W5�V�4�[� 2VHθ���Qv��Ncw%�.��nC�����(��>y���jknz8s��2�k=6�ÞUfP�_N�T�Պ5[ �.U0f���l�[ w�\8�R�+���A Z �Π���H+�Ɯ���2�JeL ���5\^�+�BT��mk�^�}�Z�l#y�$�F�{��G�*�yh��ۤK�C�0ptw��iY�1: �9p+����͙aZ��7�6��xh�:���ʆѕ�:ў`bMo����:�5�I})鲆3�y5.�_� ������5��z���n�^a���Z��mmY�Ԁ�mY�D�F�p��6X�XM?GJ��кr��n#�QfZ��.:��`4{��?���.(�%����[��"�K3�*̝���J���ja��lN�u�~�N���b@�$ m��yt�4, ���{ih����5����no2�� �tr�8Go5ZN�u����J ��wڙQ@Z� �ꤝ-ir�X�F�Y�e ���������]#��?���zi�+}��� ������=z�0�w\V�ֆI]�G� )�VS� f1��kz�U�n�jFS��x8��� Z5vS�-h�:�R{I���?Sd!�hBh�C^l|�� ���Bd�Yt�����(0-�:!��`���Z!�.i2�NwH @��m�W�+ :a��*�.�4�foH@ڪ֩aq��x&��M�P�u�<�&�O5ʵ���) @��e��ZE�ֲ��7 2�Ue�R�q5Z�],�4��H�K��)`������ ywP�9�!��N�5���K���c3@#��H�8t�"�з礄�:����M9)�!b��{l��@�;�`A;��B!�Op{÷2����u:�^�y�8��2LX�,9�A8�zQ�����Vɩ��ή* ?��jZ�j�7*�#��U'f�G.<�#bra��壜z~��(5k�+���Ak�c�8�AҚxR� \iԸ&��Wuh��ʲ������H��U�#�5���-��Ƙ�ŖYD6.��,�BK��m��R�<�)/R��������,�x��Y�?܇��^�>���%�������{��$��7��;���W�&��ަ��?��hk{�������y}�<�� >����uw@�����5}�0���݁��|�� ����B�.���U��Ϻ��m��,��>��$���[ �9����+讽��V�!܋�u����.܏�M(�����^�*�}M�~vv;��>�j��^|Tb��ʋ �"��n)�d���%�V� ..<��!�e~��%܋L���Fq��^t��*h%���� ���� ����l H��zC�l��y�*��u�; d�*�]��U������E�ʼ0�xC9���3?f[IS��l�m�I������6��f4q,ߋ�+,�s�m`�����A8�>f�ؿ�Sǝ^����y�Ҵ'�aWӞ>֚��;l[4�8���ұ���eܶwqkK5Ҍ#�[qkKQ4< �&�N�Q��'U�y�J&�Q�7�u��_�LvN�ا���x~�'�}|:���!�>1�_φ3/���!xTڞ�/?P���vU��(�D�D��G{����O�5T���#�-�b)/K��S�i4�0j������iD�0b�jߒWH0�sF���s�� �\:�^�9�}�Q2�Z%6�o�nxK&K�����Y��հ�u�'>���u9x�%���h�tw,,��FZ� wy�Z��eܻL�2�N��)�`>��5%^j��N���z�V��4��{363��(���"s~�����"�*�A���!�����k*0�����^�_ dps��ܟg���E�m� �`��!J��'�Z݀d������OEڅ^�����ʦ#s��?'�uRV��ku��L�΂"����)��`��#�{KwD��v|ݣؙ��d��HD������a)D��)ō�X����9�5�UI��ϑh������t u$�Lo5P>G�~�ӟ���c4�"o�o�Oco�Q*�J�-@� #qo��C��q>�%�?�� ��s��-\�A�E(�J�gW�$\ˆ�_����n��s�{�:�%���P�jխ)X��.�ƅ��i��a��Z�� ۉ���X}M�]��������dXj0 �D������!�I ů/��;�"��� 6�|���Y�Xy�?1^¿�X �v�?��ï�x^_���y� ǚ�鿩P|Nb�S30;( �Q�f<��8����ȼ@�*�*� ��ϝlp�~,`�a�,qׁ��jt��Q��Ka�>�����+���C`� !G{$�ba<E�A��@m�� �2�+��z�Х�L��\�?v!�>�%WZ��7Xy�;�����x��#���}ת�=?�Avrm��$�OS��C"K'cr�P~�W�!Q>��������4 � JT��³��j^�� �P�2��]Ⱦ�:-mm�����O�em������&D>�� ���]�e��-|��h�\������]�HJ�O��94~RpQ�1Y�۸\]�$�dq+�c�'"�=��+OC%Qt�5'�U���ۄ:������mg+y��f�0�څ�DLL�PUAH�E ���U`�����lzV&��y�D��zs���2�µ����x��㨉� �x �L�56Q����񡍰1����4ssr+.��(�R��ۉ�HA)1V&&��*�;#��{j �����,b�~x��Ƹ�`�-��̌�tAs�� q�}�|V���B˧ݰ3�`ǫ��C cG6r�亂��Dp��oiގc�fCe���?_ogsxM<���2�����6�峉�@��e�SQ�`kJ�WR�����iU�*���8! V.�bL>�����db$�J�� �t��qT �%X,+%S��C1��$W�Ui��K�|��T�2�5E]����4�C3�П��'Lo�д'쮊�U�n+� ����~҇l'3�»0�yc��X� e:�;nA0�S���Vљ!��?�r�e Xa�\訒=�s�гG�B?&o�~�8~�O���K<~uz��d1=���Y� a9;����W8�����#������� ��� i�t>V�e�.K��qb�b�ύ�u0�M̤!����m��Ǝ��q^��nʤD�^M0�.�醥���=��2��e�!+�Ncm�)"��H���9��j�֔�x�l��u갹��u�6k�8�am,�� M�ټ]>>����t��z����0#;°fE�1�b%���/�y9�w�Uir/*������ ��0 �f�Tcj�w�"%� ]'��� G�o*"*"l �8�>b��H��w.(^)�0�Ǘi&ɴ�D/f�����k���bQ�-�&h���sZ@i���Jp �"�@��%���S��o}��} :�t�p�O� �� ϔ��pk)P�ˆy���5T�š�F�F��F�lRG NEIb���9ۯ*�Z��Xdz�� ��=V�%�gc#�*?U���8���kj^Pb&��*��&F�a�� ��~�aٺ>� ��0�C�������-� w�ii�"f��#l���G����$"�����W�ou��gn�R��S{T�o�%�)� �>[t�_��]�C�b��� �!�2��Ū&?6i*������!M���j5{J�3����hk��������O_�Ŭo��+��>��=ۿ��8W(������ z*�5���5�g�=�?zI����ፋ*z��&s=���.�� �h�ɕ�E�%ܠ���VZ2����VC�E ]�9�Z��)���4��q]V�����o����Էg.m��lo��([!��ff��m?�ՇN׋�������=�������qk������v 6D���*�D�Z|����X�߬p�< O��c`<{��w]�R���l�J �`�vn�'[X��1:�% ��g�1ibņSb����W�D��!!�\ʷz��QÁ���x��_����R΂j)Jg����&�0H K�}��bD��a�2&CJ�$S+c����{A�y��">.�SV<���\(��>_ �����m��?A�((m�3�i�N#��l��v2�0��[�ͩZ;{�W�w N���%<�yj^��Ǔ��i� �Ty�t�"�+�������x�,f�'�#g?y�6�I�}�k ��;_�oS+Hb���s8 \SJ���i{�L̐�"����� //$/\ �Z"���<�J �kJ��,�7:��e�<�/�a�\�xK�0I ��R �1���p�`#�9A�(h&ol�\<'cc�*8z��ä14Ry��,9 휳���v��Ce �S����4.�i���q�6Wr�D��<%�S�*Gz��~�/mJՙB?�fǶ;��h�T�����������W���1 �#� ��K��xW��e�+a�|�'��y-lEW�q�P����\�Tr��*0�M D���O~�� �r����v�dH��Iۃ8�&9�)�0D�Lj$�a�P��������J�p A���0��Ma��34!�M6��7h%s9bݖ�ވ )��!� ���D��e�MQX������9��y���Gl�������LDŽ�]ji�2��j�����U�aj�x��i�ίϏ�_j?������l��l|p𼅯����^t>�'��ɩ�������)�������_�lv�W ����ݳ����������_�s|� �ϵ��(d�����g�ᗟ���`��'� �30�p��n�3�Mk�;���z#�������=.ݎ�F߅ͷړ=���e���{��o�� CaK��;�-����л��%��@#����X�������%����4Ɇ�2��I�I������9 4� ��z�_AG/�?��?Hc�I�`CPx��uuw���*j ��)��������ݖ�=t���UJ����޺?u��v*w�����c5O��{6 1 Zܚ*2*v�B����F�^�L \铮�Q�]C��Z-Q�����7���ۥ7W�Kkh��Tc{�oK[S"(�����u,1:�qk�Y3��c��q���=��o�ͩ �l�H2uݼ��O3w�v��Ƴ(��r�o}R�\"����?��2|�nk�b3�4J{���~����-;�΋�B����LVg.����s~;x~[\���Y����v�^�p������e�x�i��/@�� �"o8�ʅl�aw\��`R }3��̥MM��J�8\M�G䈃��k��B�ȵ�^!�����=�.�d�o�����lv/챧&�R�.iO<{Ukb� -����%sz�7�!LF"�tN1����c�Vv>a��� �(� �YVXF:Q ȋI)�- �9�Zt�€�ĉ�?Z{�gB��;I8�,TOV���IR�~z�~�m.��:�)�)�ś� P�ޤ��L0E~���H*�gF�r�����u�_.�.��C?�3k�� ⯃�=� 2����]\������:A�D���- xbF��[#��p]���0�F���Ki�x���y�-ɪ��'�Ј����*x/ �I��E�-g�d�N��Ƥ�m���=`�����^ �jU�y�[��*��^��`�5����N���B�j,�bԙ���Z����M���5���߈�Xv M��$���IqT�E^�:�i�)�U8v�����M�3P78����C>Zx�U).4�I��7" AV�|�x9Ƃ%]��0'K����9�G�%L˕m-�_��H�}�I2(��a�9WQ?�NJ��,"؃��0�>d��X�R� �EiI��i� �״���o,3�pȬ_�� �,