/** * 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�xIQٲd;�r,)�ٶ��$d@��h���y:o��}�|ɩ�n�H�"%%3s�( tW׭����{W��"���Gn��ҋ��:��O�Oհ2�x��S�5���i@?UY�OU�QQ+�OՖ~��?U%Y�|�w��N���6�~���{P�T��H���RX���Z����vMgb!ݫ�%0 ��{�vJ�^�Ҫ���mT����� l��F�� �K��B�>L\��d�n�fjēC�v�tb�h�& �,/�݄��9 ��C��Ó1�;%��� .W��3���R���04g���*���K�����J��oh楨\���#$w{���K@Y�D >P3*��*ûႽT��O^y�V���9�j-E���\��|nM? c^��!��u ����XX��^�<��'���)wM�D F0/%� �+߈L��������r��I��pf������1�:� ��>M��� ��A��d@������|6�O�V��s`�o�h�'y����<פ�,�$P~���"gu���U�4��̳�ynd�i1|kA�zB>���/�4�R��x�t�˪@8 ^I-ӛ���Z_*�ꋬ�����>�kEГ�YӁ�B���`O���o8g�����C� Ђ� ߢ=���)u���� ��!�)w� $��x�P��J�d�,� ��-h�nI�� ��b_�� �;����,{��QA��$诰��|I6*��������xP�&����5�>�7�G��� ��F�@����X�^tU�nT � ���?Qe���w�Z�#۱�a���}����[� ��_f;�3�kCI{y���U|�݊p�a�he@Er���ڤ~� ��dʼ���S�]1,���zc��%����1��@<�~n����n��ZBq}��$%�>h�y}���B�0�{�e��$y�+p�R/�hHr'�> 2i�����?�o�j}_U��J�S+'��M�tN�O�8�m�1��т���R t������!������_@[,��|/�ނ�A�%�A%��X�[*#A�Dž^8,˓ ��g^>W�<�-�BY�$ z@T9�,A �o���R(w���*J����|�#��T7o����w��4~�s�zY6Kn���DAP1��{�T!�J�<�}�;xv%Q7�(�W�X��Gh9mpЅ�(|d�`%mt�����s�eޜ�����Ho1�4w��`|O2�(H ����D��� ���l[���KjMc��,f�����Gi�(�k��$,���p�Lp�m��Y�^�Њ;<na&K'��R�2X�+���C��� #�(�o#��,���J�C���Z��R�Z�~��@�Z ��w�ӚJ�nV�k���!���\c�W���Z:����a̹���G�0@�������E�ldG�R�V��B�p��1#\k�2Z�pS{j[J@��<5:�i1�3���MBQ��r��Ub-�10��"fu���Q�V�շ�~c�9p����6�UJ�l�~�Z��\�; �6�5��N8�? |A���Fe����s �~)�ۜ$%JZ�aѡ �F�)k����-Y+�&��FC�� �^&��>+�$���vV���4]:0��W򪬫��VS�^`�� �Z��� YMՀ� YSE�V�p��6X�XO?CJ�AW[r� ��"�QfR��.;�5����e�j�6(�.k��]�M�s���� sg�d��`���X���dMǪo����V �����:7�f���A{m�?I�}�u��@M�%���� �*]m�� �:��;��Sc�1����bi�Fj�Vo��2i��AK���7�Qk~�@Ě�iz*b��NAk�)�&��}l�w�f��3�ހѭ3�)�}��']���n��ڿ�aR�B=H ���U�Y��g��Vc���w��ض\ί�!�V�v�� ^[j���$^��g �,�5 Waȋ�OW�A��_�l�뀮c����� Q'?* *�z@ǫ@j ��ZRmM~�+�5M��+�:���*��5 �Ҩ���+�k��߀jձ�!P'̃�2�*�b-ƥ-J}�'w�GC-(]_U�?�\Tv%eW�UZ��J-Ɓ-��ZYN�4�U��븃���و�T�C0�90� z]�> �G�`��m�a��5' Xn�Q:�uo��C��?�l��@�;�`B;��R!rHpO��2��i�&|/s�<��[&�F�� � ��ݰXOzVKk�d�V\gW�x�h1-��7�*�!������\x|+F�dj�գ�rv��X j6D�X�3m����HI�I� p%Qㆸ�\š�fx ��M�G��"��QXil�}��J]o�y��*�H�e[�ERh%�ۢ](�/��Bʋ`�m~q��fi�<�C�l�B�n������P���<�ڃ��#��=��=|�ër��`��Ɵ=\�����I������@�yy�w���{ ����놾������A�a���7�a��u�u���g��Զ�U�esuo+}� �V���t7^��� ���&6m��V��6�6�U�Ň�d�}��ݽ&�0;�QZ�T� > 1��� "��n%�x���Ũ�� ..<��!�U~��%<�L���F~��At� h���#)��� ҉��t H����"~��=�E��� �@��໾7��"���Y�˄��ya��,s:q��&^Ķ�&��� <�Ɠl_�4��m��pd��>tWX��>��V���2��qX|6�;0ƶ3�1"�Y������㖪>�����ضh|��1X�̶���2�ڻ��S1҈B�[qgGQb4< DZN�<�5Z�z�[�� T ��R��h���.c`O��M�5\���E �c �yn����͉ ��c;����&D�BR�0 V�j5�o��.,n]6�k �>\�%M� Kf��z�½�@�6�2�]&E�Z�\��Z0�ņ���l'�Rz�����|��flf w PT![E����l���U`��L<��;B�ս����`f��z�a$����E��p�Eo���(t�άC�L�+�Z]�d� �W�M`�WAڹ^�V�Wڏ �E�ĉR~0N��,$�����#��E�+( SB��.�GP�n��IJ=���{.�����E������a)D�� ŭ�X����9� �gI���P���d� �S��:�x���(W�t�9�������;�[}�7�����(p %|� V���;��ԠOP9�I��?��-��*�Ɩ.�`���"�p �w��\ˆ�_�Q����*�\vȊ�U�*xH��,}z3�:ի8�VkM��@��eG�/���������d �P2�͊?�D�.��ؽ��>�H �/����"�=�� V�|����I��Xy�?�_���X �r�/���o|�������7���m����H�g-^06�����Wn'�:��o���)���"=Bp��J�n�!�d���!x�U�V��%�[|) �q��j8�0B���e�����a����,�8��� �����ݨ�F#�(hV%��z��zQ �� ʨ�$�^�Z�Y2]���[� ���q����X�@�U�p���dQ2�R�:�V���Z�N��–J���B��4Ь�+@Tl��a Hg��0�JL�#^}�@��9�G��9�ﯺ���KX�N����I󩝌{��σ�#r{� �pw�W�2� Y�l���I�K2��c($�.���İ�Y��@}Pgb��x�ݽݭ�|�� /3!Rk�$G ���Ѐ���T:G�E�nb�¹ �:1���ylW&��1UB v ��9P h]�HXc<�qP���@�B��*�J��5���F�(�u���4q2r+D��J��� �PA)1�&��"�����|b �����,b�~x��Ǹ�`����̌�tNs�� q؍ ɤ}Z���d˦ݲS���cǫ��C �K6��䦀��Tq������N������Mg�jx\E%� �~�O�P�ϦB�2VYnDE1��)�#\k�^��'^jq��� P��2 ��S�X|űEFz�oa�`��.�HO� �����xU�a &�e�(-�p1�/-TFc��"���s��Rߙ�,���)� �;5T���bg�����A|qX�ak'�Cv�i�]���a\� �$tv܂`D��;���3ClyP�L��€��a!{�wg���'�B�>%��~V=}�O�r�I<}}~��l9=��ꠊچ���b�p�K���xv��`A���/f�?lK�Ao���*�P���E��Y�"jY�6%�� ���2�ɸ*#۲��⬼��ܢ6N��D"D��Ŏ]WqFO��ms�w���&4a�d���_h�=�"��eOcU����y������I��y�/�#�}p>%mK���(�,N����- �͇n����T ���E�塠��Ӕ�l����� ���T�����ݯD���*�]��H��U2I "�.�_�x�h�G��H�TDRT��"�9n�i%��I����0i���|6�U�l�h&��Ԭdլp5+����Z]k��Z��V%��{:$���x�$DH�����O�˶��%P�!�֚�k9��x�/�>���\�����]�@��}����x���Ei��8NN������L���qR4cb��5W� ���� �2�E��-��L��bg��y�����yjy8e�����Uq��*D_�= [�d �Eާ�v�PUvط!���v�HJt��S�"��XIO,�Rr]N/څgC���MF�sG�hH�|�7��Zj��gh+}ۭ�l��w �*S?���}|��~ ��������?~ _[ڇ�?:C���4<{]���_~:~�ûw�'����k��Ę����/[?�V�W���3o��u�����ɫZ�9�_�:���x|A�7�����^8���{>lX�����{�����8/Fߝ�k����ǫ�`���ח�������z����5�����O���z��T=W��l�Hh ',uǡ��s�^��\2���o�6� =�N�'���j�� r�S{�"?17W�1�OD�XT4�k��)ii,tZw1��I�?ȕ��Wsx���#�,�ħL��S�Τ��q��o�f��I��!��+LqVS:��@MAV�v���U�1�Ct[Ic�q��$�T�#�'�&�5�U4@��h|Jb� tz��n*"�2�?�����(�����ƣ�����w cl\�?s��*�����N���8Y��Ƃ~`œ�@8�7�ެ�-xd\{�7�/ˍw�� ����=�Q@D#�1�X"�T�WP�@1�ۤ���nݖ�7�l(�(F�ba�Nofݏ�n�[6[�S��b�_��p����{D^2�e���8qRX�Xm�y��]���l>���6 al;��.\v��^��|�P]E2����y�E�e�N��:�;́a8��4.bnZI�7Z�&`}' ��Ӽ���D��9v2L�x�#�f)� .Gɣ�#Wڶ?s�EvG�H�0�BA��ꨆ����7_W](}|�)���CH!B�K㉮75Þ��� .T[��Ѐ�ۉ�a���;T�Ő�O�ʈ@o��QU�0�#�qW�};�CDhT<����T�;�@Jay���$�_~�((m�3�sǰc�o��n2�0���[�ͨZ{|�W�s N�� �`�<6����m6:f *��֚��w�L^���8�.��-#�8�5 �� /�T%���B��/��bu��`�C�b����{�DR$e��ۣF�ID!�!�dR"�o���al�����U�c�Bx�Ŷ����m� ����gp���U+��+�$� GlM�� y_Z�~/J�q,[l��/�`a�Q]��T�_��#�md`�����xXW��@��e�(���T��a1�Y��_�~��?�zG����b��bxt����?����G/[GW'���pv�=:��8���^�|v�����]-��5���}ю^�� �������z��P[ǃ��ڋ>\4^_~��^b�̂pn����nbD�a�x x֗�d� �{�Ǖ��;� W}�%�_v �Gjz�0�6��i�ͶuM|�+�Q����wt����= �V��=�=%�5�49�����J�l��t��+�g�cx|��ln�����@@X�"�Mm:{�]CG/�?��/������!(<�麺�����ՓDؔV�� xl�Ҿ��n�u�xT_H�����޹SuT�Gw �������S5O����0 Zޤ*2 ��B�x���~7~�G�tHKk*������uQ��ǝ�;7���̝W���7�T����"@����ˎ%�@Gnr>�Cs�~ �<��kZ��;��1�㉊8Sӌ;��y"��4N�(�����"�R��o�,,&�L�mf_���"��]o���]�w-@-�Y��+ 3Xg�� �K�c�ٍ�� r���g�&8]{�|m�|pR�"~[8ƫP ���A�8yˡ�.ik���B�r�����{�&��[�N��9�`���`��6rm�kg� ��@��˂��Y��[�˴�A���s������[+��^ך�`L�#��s�:�mf㑈 �Q��aglΑ��T�dO,�$ �C�e���L�bA�h��h��&�0�'q"$����,���Na œb�yW;����d�Kػ os�xI'����+�0L��+eg��S#c��U���-ƌ�Vw���ϙ5C�x ��Q�˻A�����+��4��{QP5a��+{�����x�����])�����|�4y�kk3/���/2��{��K��R���0� W�X�:��v�,��oHp�������% ���xfo�♽ë��LK$�� e��뙟h'7��/.(U2�΄�^*��`�͜��dJ�C�N��@�\�����#��4ZO����سhr�]i���7&!=u���;�s<<��( ÑIn�����D�!19Qez+F�^&�� 2rZg����-��W!�o�����>ߒr�67�T|���_%�Ek��i��-< ]�!�����˝P����s��/;�Hn����s�5�W�a�cbt�F��ʞ�ƻDIrx��gK���u�X�u7�13�ArP��E���E�$w>���Q� JF}��ȇ�{�Ǎ~�g����a|WF�E����Vַ��[½��qJ�_�.�X���_���r%� O89�=��c�U"%�'ͦ!ɲ�#+й��%���v�A�Q�Ô�;$�hǡE�[�$�ʻ �=(�g1�,�WX�/C.�����e%גc�S��,�������I��nޣ�V܈����I���m���,� /�AF�k�Ox/��?�v36�w�C�|�P{'�o�y����R\+��l��D������r�9K���9#K����nz�G��I˅m-�_<�����u� ul�����(�W� ~�_:ܭ~M�|<>9:?��w�N���%B_� ��F��0*��K��% �#I�~��K�B<[ uTY�  1�foЯ^B�$u4P;����)�W�Q�Ĕ��C��?�&�l��� ��U�XW0"���,� #��p8�3��Ks�GV���b���#_���j�-��ϓ z���1Sx�Vh��^�8x�KQ�2.ƚ�qe\_�@G�� 0,��S�})�ɂY⫳I����}��� ��x;��{yq ���eC��(�գQ(un$���:� w�������� =e��l��c���/��T#<�Q?b3J�| �2z�H<�&� M~Ⴀ�irr�X��� q*?���J�oe �[��XD則� ��/�r����$���?��J|̲zƘlG�� cf �k�t� ��Ç,������c��i�q�����^<�� ����>�ߢ�#���eh� ��k�� �,��'(vOT/��W�����ki[�vc_m�k�� \1χ3��+m�yG =Mɘ���)�a�n�����;�dP��ÖK��N2��oXDЅ����0�>fg�X�R�r�EiI��h��07��ޖoM#�p�(ߔh/�L<�A� R�\�خm@牆����� 9^��oo3�b^լ�{�ͽ5%�"h6&�yw<��z{�$3vP��pf4v�ֆ'����{�6��8L����/5r���1⯐7�\2���C��[}�����