/** * 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�Le˒�\l˱�dg�h��A@]����?�Ӽ�����)�K���q%H���3g�(�tW׭����x�������w/�4��{���qMo2����K�FM��=��+��9���^]�O�Rg2�zpy��󟹎��LC:J�8�A�����N�AH��ULC��T˟5.��zq#p�NjM%�c�U,Ӛ�F05>G �����]�s$3J�:A�<�hlkj������K�'�F��3:��z�a,Ar(]8v<��ܱ��^d�xN���2]:�9�؉A��sץ�㑱��Lon�W����Ќ����� ��G;)ŝ�y�83sB�r4p�pBw��V���>DΟ�4�/�Lx���I2���5�mBm8^�KA�ij�\����5dX����^���ilMwx��4c��ߟ@�N�U�8�JJ� ��1�H|�z� pˌ�k�Q���̅,T�P:B /�Ȼ� ���<���ih�1�w�KJmi}�xC�+;�g3��hS-Q�/du���Y,���a4F���h�����Q��� +ŵL��@<����$�_:��e��l����h|K�=�pp����|�ؾp<ۿP�.:�?;�4*�� ɵ42#z��@0�����N>6XC�>B-��c����۪�6?6��e��ؐd ��j�M�%:�� d��� ���݇���ZG�Ê�/W�Gt��g�s�~�Xà@�Q^8���i8�]ՐnnvA����ԉ��q)��葔 �hب�G�g�%�٫_��!��H��I:�j�~�W,/^G��� ��h@�ؙ��9 5�^�C@\W�MwN�Ƶ��nD���~jS�����|��㣷j��p⌯jq�~z��H��&%Ԁ�FU D �S+�i�&û遽��GH_ywW���=�j����w���)xᦱ��U��� �x7�A��X��a�}Qw ��wϪ���h</N�w� �!� �M}ਐ �K�{�Iܒ��lC4� ��qH�-���V�CX�2��޽<�n�?��*�=%ADž݇H��bH4�:�F�DS��A]@t��h�~�B�\��_��a\3e A��b��c�{�U�wc5 �!(T%�~�Ɏ�� ��샩��аn���.�gNʭ��/��1���$G��E��*>ɞ*\q4�fm>�BP������h����:�2�'(Tਦm�8�^;Q�=DM:�_����,� �9��z�n)�� (4\����̺�Z�; >�z�.�s0r�{��~��e��$�Q�H�-H�F �� 6o䪨U�R ��5���Pݼ$֟��s߱���ތ�4�۰U�Tt�� B�� ��-�k� t\��@����xJ�B�_Qcm|����A:��+�լ� +S�>-��ys~F��[U"k��������=�A � )���W�G:���x`��ȴ���zP�YPk�Td1��f������B��(J�B��ܼ� ���1<�������ӧ�.�c ��ZJ Uˀ�yȶo�����%C�:F��ӧ= �a ��??��ac�hJi�C{���cɚ���W@3�XQ� �7��aţF%�KP%4U}��vXe�f�v�����"��t������������-�s�"� �W2�WV�\oom�N��Հp$�3� 6�xrG~h�p@`๘u�DS�]�-消Ng�,We��p�x�Mպ ٠�G���:S4u��$���Vr@_�]1�(d�l��;+��8r}��:����D2Vĺi���F�0 2&��ƌ���Nbq�]�B�����y���j���]?<�ǻ����4�ݦ��MH MۙG�>���9��Z�En����M��Ĥ��έ���I|G |�����f3M���O��n���&�%;;�_�l$a2'H+y��4=a��Z*��_+ 0��0�V3 ��UE����!�f�� ��4��h�j*�i6Z�d�2��q 9����N�����o�ӽ�2 �5�S c]�Νh�LB�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�ٶ�D'#�֑�VW6���׉�kz�-�tHlՉ�iO�KI�5��Ϋq9��n@�=-%�Ɇ֓��v+� �@���*5mxh�Z�Ll˺&7b��̴���j�9RB�֕[�wq�2Ӫ0���XQ F�'��3��A!-Y�o#o���4/�p�0w�g+ v[@����9]� ��~�y `ŀ ZI0�jq��$iX���{ih����5����no2�� �tr�8Go5ZN�u����J ��wڙQ@Z� �ꤝ-ir�X�F�y�e ������>:�od�;�'z�Zo#�|�o�[���b�3�=��'C��������0����$E�j��,F7r�@o��֍[�h���WѐA�F?�߂��-���^�A�3�@b�&��K�0���gh���r0D6�U@� X�X�ӂ�� � j���2�&�tW��D_���|����j��HSm�V����j� �+�g��߄jձ�!P'̃k2�T�\�Ii��$��]���U�n-+ � �\Uv)eW�U���J3��-�d����i��(X! �Wq%oSҚ�D`\W��2v�e�zbh$0�����]���)a�NG���{S��_�E�X��.!+���-X�Ni�P���%�Ll�~��9@3� �#KDN�b�g^T�'#��Erj�.��� �<Ǵ������&eթ� �oň���am�(���|�8�A͚���*0�AК�l�t��&��W5��+���U�������4x$~'�h��HcM�bKu�1�r�e���60���R~7E[*�/�7BʋT`�m�<�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_����ݎ���Z���+��"ý�.�[J3Yjxz �U6�� cn�i��gk �"����Q\5��"� Zɺ���$H*�u�lb�:�R����P�/[b�B^��vp��Y� |�w�xY�s��j�t��W��o�"�s��c��l+i�?����m<��5�����0ی���{�}w�%x� l9{�4"3��է��cs�W��f�?i�4�q�մ���fo���/N4��p� �a��]��RM�4��V��R� gI�3 �����߭����HC)�U4��.c` Ϝ�M�M\���E �c 7En����͹��c;ߜ?�&D�BR�(}o"�0+�F�Ѵ�f��w�ɫ2�N �W�V�S�¢�^R�D�l�hN�ܖ�<\�A��F�)�X�0B��w�:KLW�Xs��T�mz@<*J��*%��(��:f�/R&;�t�Sr��<�ǃ�>>]^M �>6�_OGs/���xTڞ�/?P���vU��)�D�D��ǻ����O�5T���#�-�b)/K��S�i4�0j������iD�0b�jߒ�H0�sƎ��W$� A.�p�)9�jW���G�ط�h�؜�m0��-�,�^�n�f�/W���1���’���Ib���ãQT�uܱ�`�i%+��j�S�q�2���;�*��ׂ�.֔x�m�;1�Z��Z%��� �������B������Z��� ���[x��w���;o�O.4���:��z�~$�����Np�Eo�W x�*���b�(�Ÿtku�m?l|�cc>iz���R� �M��܍3~0N�뤬$���:����E�+( S"��.�GP���"�����G�3�=v}#����-G��R�F�Z1R��Xu+�s�k�ؒ���#����+� L��H� �j�|���������4�"o�o諱��(p %� V���7O�ԡO�8�i��W�x��\lc G0A�|J����e! �0���c46�5����d�}+�R<�Zu� �����qn4p!j�Zz�D���ħ�����.�����p�P2 ,5���U��p���وڤ��ח���O�j�`� ���� 332�)����fҬ�R�n����;�˘�;K�\/0��%��(8;�F��0����yh�< �>������q︺�I������OQ�$7��:�J��b9jN ���L Է u&�d��'��7�*�p* �rS$�6N{$x ���*�28�,��l[;.\�W�� n�)]�TCx�Q�S/�Sq�eh!��LYc��q��Vh1B��\�Ƹ�`�-���̌�tAs�� q� �4~V���v˧ݰs��`ǫ��C �M6��亂���q��oi��c��#��|蟯��y�&`�H��oj�i����h Z�2ˍ�(F�5�u��/I�K��T,@��r��+�I1&�@��k�]25|��s�K:cc?*�,���iUQ������ê����M��k��|%������� ��� ��t>V���[!�����ei��8N&�O���&���4D��4i� �t^}��J���� �r�U��/�T�L��g��y�� ����zl�8w�����Mu1kD�d= [e �e���~��4v��-���vS&%��j�v��ND,%�g���]N/馾نgS����F�#l 4�!^��W��j��g�(#�k�jz� 7�� �� |^�}1Z����������o~v'������U������Oo�^������O�y~������J�^^o���k���W�W��~�|t������S���� �_����՜߽�I�~�:���ۿ��{��|����v�����/~���}�K��?����~�ѱ���a��ëWo.�OْT=W��|�Hh �,uǡ��s�.[w!�{��go$6� =�N`(���j���rߚ�΄E~bn��c��B��h�W��S��X�0�b� ���(�+��� x���#�,9ç\��S ��ΥN�Y��o����y��! �+�qVS���@MAV梶�34�!�CtIc�p3��1��c_W�cV�?��E� ��H�k�T\ķ���0F���5�+_�"�[��� )�� ?��N��NbmA߳�xs,'Ǣ���:����K��gW�r㭡?�� ƍdOp4�!�g�!���%#P��c�֩�փ�[D���ŭ+k z ��XF�=��Y�ö�Ά��:O�ҦkW� �����ZBvV��fB��)� �֗�w,CX�uk[H�F"~�΀�V����G���`��Z����C@�Y��� k�`ဗX/\h������T��-�3tՃ���ٱ�5+��9+)?��x}q���ۧ�J�{�P�%�0�:٥�IH6�ȦS'�+y)�|�:є�'�56�9��F��$�J�r`H��Jq|���Jk���z��� ��|Ug���M�bƊٻ[�N6ա�"6�o��xf�LfV�b���q��|E����MW �D�Z{��)�[��=e��>�6�{dtE��(��<�|�Z}a+�7�0 <��ߐ�8Rp2K�x̵����-��<,�Ю�c�Z��q66n�Og=������甘ɷ� �I�dJ!ך ��y�q� �Ї�l�۬ l�9��C���������� 3w�ii�Ƕ"f���#l�������7�$"������}^�o� �y�;�T��jtT����jKf�]�[���%V�:�a�������1I�&��^l"Ȅ�'7M�lv����鵕�H)=�O�fO���Q��f�2%�J�=��,d�\W���'�� U,�(�ܡ�_x����/)����ݵ� ǚ͸m�ٳ���$�3׋��e��E�y%���74�Jt�ϥ�E�%�����VZ2����VCH�N�F<���}#)5 ~q\��,��po~C�1���Ki��x¸?�]��i���Y�m?�5��ދ��Q��$#�{��p��n_�L���86�������N��/�i��B�]�U�Hơ ���mr��w�Y��'q��9If�v�sb�΂ˁ�����X_��,�q�x�u8J���N�6p��g>�K{���]*�G�ĸ��������s�"��s�ݹM�~a��#� a���8{�i� ��M��FEx�Q-�G�w��Y�Ɂ���x�矛��Q]���/J��".�M�a<��[p�ň���eLF�IШV9��5���KpmE|{ g�x:a�8t�[��@Jeyi��4�� QP�Dg����.:�G���v2�0��[nΩZ���W�w ���<����K�z�x:�:�6*��6��?�oS+Hb���I8 ��P��i{�L̐�"����� //$/\ �Z"ؤ�x"�J �kJ�G9yY�ot�#�*y0_H��,��a�Xe��c|E����F�)s�"Q�L����L�W��;�$����Ï��`}G|2[h��Y�x�#p��p���[��nu �lSu �H44����� '‡�)I�W�8�|������iS���i���~_�'ձ�~~�s���5���G|���عD������>����w%L�M��$�6��-��8� :���J��C�B����m����Ӎba��Տv�d8�����8�9�)�0<�Lj$�Zc�P��ę�����Y��3�Fxƶ���m� ����g���-�-��+�$��Hl��� y_Xg'Js,l���Ͱ��� g��w�{� Lb[Jf��%g6!l� �����Up=�if'Ѭ S#�&����NKv~}~��B����߇��ǧ������-|��d���������=y�O�7��?�'����_�O�?����f�zq����<�����w��������h_;M��k݃q�j��O�O�/�/?M&��0�OfA8��k��]B�86�)�!�f]J΁@Sr��n�L]7o!��ܽb���ygt9·>)S.�����`a >���U�m�E�]}� ��)���J'cJ!Cv�c�a&��3��p r�9��=�0SXح��g��AA�p�8)]_���׊en��!����P+�����[�o���I5����ӥ65���*�Z�p���C�Z�56Fm"׆��p�B����l��F�%K�ջh�T���p�������=��U����%�82>=�L顳�d�0��9�>vƎ��[�I�u��2L�P2�[dYa�<� /����0��`�k�) �'Bb�������ol�V�P=W!F��Ie�� ��� ���� '^K�������8�S��f�٫Rzfd,��2�;B�������"�;��+f��#^B������ �j�����\l�R�M0��(٬��/��GG|ln�H宛2*i�� N^�`.~���/3�����K��a����1����X������$��kB�Ō��Q���^�W�씮����� �i�$S�ο1��(=�&?IAI�ݴ���pփݰs�.ϩ�k U��c�rZ�A;� �h=y���3ߦy�v���R���G���� n����jY�#������d@>`r���֏�-M�e��΄7���K^�����§�}�!�ݛ��S�&>�7��,�g){��"?����R����vQ8�4F���q���ߕ����ǯ��)|���_mz��ѩ�u����5��Qw�I7�&�ʫ�8�;_��>5_���y\�o�6��ض�q��2����q����}Z�"��Q>G�Ԓ�x&����x��D+hM��*�ȄI�]v9�5N�ǵ��Ǖg$��L����g�n�׬V� �~��ޤt�.^���d?�v-A�� P�; �_��6��7h�_[ҥ���Ŋ��YN� �AE��(W��ޫ�n9 �_��Eq:?�~��p3-�-C��p/����� G�n�t���i~�����9��ϵD/����3��e3�G$Y��8�ƨ�ߑ�,��OF8�co۝A% tP;���i)�ZR~�ie?�8|�H;f� ��(���4�ZW0*�)��L1Ќb�Utr�d|��O [����Y���_��_<���/%w<��botWj��µ��:(^>��q�bg��YR�5�yy��R�� |l�? f��,� �h�z������*kG��N�!�>�h@�����xʆ � " >Hb�#佤�P<�a�������1���G���t7<� f���|�2z �H<��M~ Ⴀ�irr�X��� q*?���J�nd ����UD勇�9���o�����<�/C�?�5K��g��1�8*��#�eyA�� ��v� �z�_�d�;���w���L�_7�k��u߫�PE+���'�Jy��_&�r� 8N��- 4��� (6�4���7��