/** * 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�HQ9�d;�r,)99�G E2 (��Ѭ��y����y�O�/��� W�))��Y�8$P�k�j׮]W�?9>9:���K2�&���>~�pG}������i԰��~�z`OF5��:��خ2��hu5��v������B���q�a�^�j�C;#?��`��6ܚ�M�3_1=7�nT����v����D^d8�i�cZ����eXG��gX5�[� %b�})4ۏ�� � b�� �Q_:?{��J�g�Ƅ��+��|/�$"H���mE�E�l�*�E&�kG6�Má}�����;���1'�yA8�}�?I��u�zs����vo�E�NBlgb\+��QԀ�t#�$����k���������4�$b� O��am�y#�4����iI�p�]#���>h��}�6����z��]O�B����|� k���T?9OsL��S�G^QjI�����_�ؑ7�@���rh�r!�����2�ެ� ��� �2㸕��u�,�4\�a�G%ũ�6/���~i\�'�K��|<:><;�H��o�l��f���O'ޥ}J��vG!�i`��N]M�b�n����'�2���Ĭ��M�Y^Կ �>��3Fa�ʑ=�'c�w+.��c@\�]Δ� +��^H�МF^j��W���x�O�'�j!z��=�W�j��b����mBޯ d��L5�@ͨ�ʪ � �R��>y�]Y@j� ���Z�q��sp� �0�y��F��)�n���f`U����2����� h4 \�(����+��z#2i��>F�o������Ù��h,J:�Hꊂ�F�4�v&|��O�!U�����Z��6:<_���<}�����C�t�D�I��/!ʹ����~�GC��$��)�|�8�]U�����Bk�D��OTٮa�]�X�����v,hX�ej~x;�V<c�������P���G�"ea�e�&\qؿam>CP�����6�����:�2�'(�T`� �zyr���{��t|�����o ^�A?7�{QV ��y- ����~��v�ϼ���}��3��|�=�H��ܪԏ����d@�LZ-�~@%��~⻶��UU@�����Ԫ��dS3�S���s[a�>������0�Yb� h��Tݒ��[P4h�"}7�E�)�r+��$H�X�ê<���~��s�ҳ� X ��J��D�#� � �y�.�r�ؼ���R"K%��78��B @u�V[�~�<ۂ��.S?k�f��S�9�� (* t�`��*D�a%���qϮEc���� k����� ��>��L����_���y��̛�0B4ݲi�-ǘ�pW{��$��������O4x ���p��a~ɶ�,�z���4)�bF[��?�Y)�z�P������'��Z&��>��,}�viM��?�0��oh) T,�U*|�![�9E�_�� E�q�ϟ0���:3��pj� ��1������7�@$s �wOeL�b�a<��lօ�Y�|��(���Q�v�pk��QFjB-���N��+˜K��k�`_�,`9�����$(N`�1� ����f{k˲C�1�]‘�'�+�p�����A��Xs1�Z ���4[�[�N 9,X.˘��v�D%jM�,d��"�*�c�LQk�8��F����+�R슁F.�v;��Ya�ā�_�F0��$�"�MT�s�Y��16 6f��8L�q���:��`���>�F��^\��nL�����p�K��Ԇ��4�7!%0,{v��Ͽ�e�k���(��;���qeA���Z��&���JX�Vk4IZCL>7��4�E'�)�(����&c#1�A�XɚG�����Rq7��FQ�!������}���(J���(4��*����f����4��Qo��#��HGr�䴶�|��{+���K��Z��t�@EA�t�S���Øs�����Q�^�1�E�llG�R�V��R�p��1#\g�2:�pW��m)����T��p�Z�7 E�"w�yh�-�P��P����Eл� DeZ���2�U���a���m$��X���.���� wZm�5�:���4���4Z�q��z�� ��<lsF���h��EGr0���5;��wd�J�g�X�Z-yW��f�h�����tQ�)���ӯh�t`���&�UYWwe���I��$��%�J zKZ���[���čX�$Sm�&��~��Ѓ�v�f��E�̤*�9�]t+*Ao������{�������"oz��4gF0Q�; ���;M��Ċ�؜&k:V�^��Y `ŀ �q0�lr�h�iX����&i@��+w�T� ���ww�aU��m����^�9" x��rj��7��wP@,��J�Қ-�W%��8hI����6jM�/k�ؐ5MOE��C����)�6��]l�w�f��3�ހ�m2�)�]��']���n��ڽ�aR�B=H ���U�Y��g���`���w��Ķ\ί�!�V�����ZR{I���Y�!.����b�ٴW]�`M},� �N~T&Ԛ̀N��4H��� ڊ���Z+ ����U i��+@v�US�% ,W׀ѿ��c�C�N�We"���b-ƥ-J}�'w�GK-)�\V�?�\Vv)eW�UZ��J#Ɓ-��ZUN�4�e�ɫ�����٘�R�C0�90� z]�> �G�`F�m�a�5',7�(�z��l�Pfb��!+�N�-��Ni�P���L,��z� �9@S�-� �#�EN�bN'nX�'=��E2j+/��� �����u�@�����5}�=0�ç݃��|�� ����C�>���U��Ϻ��m��-��>��$���; �9��f�K讽����!<��u����.<��M(�������^ �2�{M�avv7��>�l��A|�b,��� "��n)�x���ŨV� ..<��!�e~��%<�L���F~��At�Jh���#)��� ҉��t H ��zC�l��y�2��u�{ d�J�]��u������E�ʼ0�xC9�:�S/b[I�il�m�I���ڽ�6�YF8�M� �+,�s�m`���� �A�8,?��ؿۙ�����q�T�g�QGU�?U��{l[4����rf[#�bw�]�ڪiD!ۭ���(1N�X�K�6Z�As�W �� T��R��h�v��c` ��M� \���E �c �yn����ͩ ��c;��l�y!� C�;h��΄Q�U���?��y����B��@��WT��诗�D5�4�;��=�e4 o$���s#���d�i"���l��%&�U���Rr��ςR%���d��}k����@�d甎�G5��9��u�(nW%��BJ�J�~�[�Ж��t*���$�QlyKyizf�bF���P�,�OC��3VS����@���=�M;���#9dfGcr6js�y�R2��)Z%6�o��nxK&K�����Y��հ�ut����u�xT�%��piV4 w,,��J�� wq�ZmWeܻL�2�v��)�`>��5%^j��N��z�f��T��{363��(���"s~�����B�*�Ay&��!������� J0�����^}X dps���?�g�����e �b��!J��l��C����?�0�!�\�ߨ5k{� �E��ԉR~0N��,%�����#��E�+( SB��.�GP�n��Բ=��Ȟx.�����E������a)D�� ō�X����9�5ocI���P���d� hS��:�x���(��t�9�������;�[������[u� 8�>t ��Hܝ�|j�'��ϤD�O�x�̷���#� h�%\@���~��K���1�\�_��ˮYr� �5��ݮ���Ao�ׯ�:N#����n�@��eG�~,����]����x�P2�͚?��D���ؽ���Hů.��;�"�=�� ��|����i��Yy�?�_���X �y�/�������X_Կ�}�H���쿃�|�b�#�3 �K���f��E���иB�5�(��!�ơн�s�-zxA��-q ��FM��Z=2������C4Pù��Y�M.��6v{$�ea��~�@m�Y T9Z�# ]��������L��B�Lv����K�pЃ[�\��a��F]7+�PA����5�]׋*�_CF�$���Ԫ��Ȓi���_ Vz|�������b¯ � �'���X'�R�W���L��–J���B��4�n�k+@T���a H�{�g��0�ZL�#^y�@��9�?]Ĝ��W_��f��, lw@���5�$���NƵC������D�u��;�k ��,n2zJ��#�Y��1�E�QsbX�3R�� �31��i=�m�n�pSa���i�pr#�K_h@ĔU��Q�`���ױp�"�>Lj������I9�k\)!;�Q���� 4�@n`$�1J�8l�B ^!�l�M!f��B|h#l����/$M��܊C��8d�T~�vB;TPJ����m����P�8#�Xðm�+4���^�1�#���/3c5��\l8�BvSB2Y��)A#&ײi����i���*h�Ї¨���x*�)a ?E�d�[������@z��7���^������7��� ��l 4-c��FT#ؚ�:�5�����|���3�xWN���$c�OE c���1��9��%]��`� N�䩨�@L�?��aYZ��"&_*TF�HvM�EW��|�?���P����)� ��4T���bk�����A�8ư��!���. ���0}C���#��[��p��wf�-���i�V0:,e��L7��DQ�ӧ���O�'��IQ2�'��_�.�������Q���cS�� ~�S��J�,:=��l���m)8؍��X���b?+RD- ߦĽB\�[f0� Bel[�U���T�[��i<�H�HS�ؑ��*��I3�e�=�N=؄&�� 6���PD:ط�XU!?��.٥��be�y��t��� �a�OI���9�,�m�@0b�Hc���tpǽ��u"?�Hޢ<�qp�2�M>�5��1��!9�������0z2y�;њ���p�A�*R�@�n�L�� �0+[�ѥ<*R$�����Hg��yZ �z-��24L:�/%*��f�8�)���05+Y5+\͊������:M����%�m�jD'9��(H��'��aÀB�m � ��~y5W�b�+��a�? )�櫐�Żla,�O[ �~ۧEi��8N^���96&:���E��dh� �t^^�4 ���� �2�e��-���L��bg��y�����zjy8]�����My1�*Dߤ= [�d ��ݧ{{MCU�!ߖ8� ��m����� ��E;����Tn��z�^�M}� φ)���sG�hH�b�7��j��gd+ۭ�j��w 7jW~�����ܟ�~ћ����ӳ����ovF����u������O��]�N�/��c��8�������Zu_]��N��7��ϯ����{�����W?�M�i�f|�ַ~�����ڿ�g����y����~�z��7�����w��/o��j8��<�������?����G��h[W_��x������-<@�s0��V���p�PwJX8��u璹<؇x#��L�u}�-�Tk�E���θ�G,�ss��D�EE�q����B��q��d�3A�\)�]5���[i>��� |�d��8��L�؛d_�f�a�/��B��4g5��� �d�.j{Q8]�S8D��4��N�u�:Dxr�#Z{�QEt�Ƨ�!��B���"�����_�wH^���H��l=���o#y�`�B��k�W�VEv�";� P'�"��X[��x�k����7�ͻ��k��&�E��nБds�F��8���h�3�K� � �(F޳b��v�Q�-��P���5=�_,#�����q�m{�f�u �'Niӵ�� j�C\h-!ۏ+d{3!qc�w����;�!G��:���=���n#�G�S�����'Ӏ�`c���S���G�C@�Y��� s�`ሗX/\hh�����T��-�3t������5+��9+);��x}q��vݻ�� �{�P��0� ١�IH6�Ȧ'��x*�t���'�I46�9�N�a;$�JO�L<7$lu%?:Z�Ik����z���� Ӂ|9gO|Ɗi��?,6֠��<"�c��u&�Ha�#`�f�sE�N|E���[T�Ê3M������ͮ ]�[QJWe�@8+4�d0'��r��Rc�b6e u��@���l��7BS�Ke)8}%�]C �p�/j�II�#+g�u�~ֵ�VπG�a~a?��V��e0IYoa�f4����ij��'��l���8]� ���I�� �Yf���C��q1�|ڏ1�D�.n�{$2�d���p�Q�XN����]��ub%ޓw�6 a�k;�v�]vV�^��|LP�B2���ъ���C岠�����sW��^9 |�SVo�8nX�I�4/��0z<�� ������ [�Q�hx7ȕ�I���A��]�ơ8� �P�>n`�b� ���DG��C�wt��PHƁ���x��]���M��b�,L�c������0 K����bH���eD�����V���/�ٸ����}�u!4(�NXz!(�m=_ ���t�mY�/�D�6�N�cL�r�#3�p7V��~�-�fT-� �ɫ�9��AoO0��uGر�[-�@#]%���rb�i�o_[����?��8��[��O"�'��X���jNE��8���E��Ȇ[�A��%21Cʋ$�^2��H���H�p���j�4 z��/��*q� hה���yY�ot���2y0_H��,��a��Xe��c|�����F�)s�"QЌ�غ�x����Up�ǥGqc�'��CY|�ʎ��g�� 6_������C]~�l{�5� �"M�P9.�� .���$qJ\�L�E��ş�K�Ry��O��0[Mՠ��:���n�M�&�2�ۆG��o �k��-����=��K}W���ؿ���Z�2��^�����BKUr�?C.T�۔@r�E:��/�qB���b��U!)�*���a1�`Q�ax$�TH�{��*@�3��s/9J#�y��_��f[� �a Z�ٙtn�oÊgl��,�n��Nx3C�֘ߋR��[��� #(l�ac� �����;bKFf��{2��{M5?��YV6\B��2Lu���W��M����ɇ����w�N��/�G��/������/�}��sxy̞��g�������gx�����/~����/��۟G{�{� �������o�wr�F�/���0`���筗���F�Q���'� �������u1��0Ǽ��:���S2Ɔ�<���MwI��b�>�x7/���#5=��� b�RɄ�z[��>��A�q�;:����i���H�]�#��ڞ�X��oj��3#6��j�&�g�#x|��l�����5@T�"�]�t�»�~^�$_Hc�Y�%`CPx��uu���*�/��)���������=���r���YH�{���޹ u���rJ�������5O����?0 Z܀*2J��B�x���~/~���tIGk+���tv�MQ�����7n.����;�E3s`���c��%�Y�J����:�Z�����)��c��鮮i=��m��� �Qę�f�A���3g{���i�t9�w)R.����_`a1f*l��–5iv�7��;��Z\*� )� �I�%��2�L�%ȱ����� LnQ�l���=�⼶��<8)M�� ���%K��"����P+�����W�m���I�g�! k �O�-����k�ސs��r��)h�6���u%r|�|�e�X� �,Y�-�AZޠ�-����WM�Β�ijW�&6������\<���z� �x$"Hg�{�ۆsh������0�B�Ho�e�e$����C�2�b�0���I�, �K���Gkg|"$�;���SX�B�\�m�ƕ�N�'������o����^�������8�S�gFٹ�Bzjd,7� �9>��������?8��9�f��!�:���n�y��?�E\7���]'��0ި��+�ňGG� G�n�t���4��u�C���=���Jqe�Nrh�� ��3��1�,�u�Y��U�v�c=�=LX.mk1��!��-m��n�ck�6��FA��e��#���v�[���������G����@_ ���~n$z �˽�<\����$K�ۿ�� �sRW�����l����ORW��ϟ��_q]��OL�y>�8���zrI!ʆ�A��$oWU�u#"������0�; G�8�O�X1�sd��~��%���?򵶙�#���lyr��F71f /\� �����K/v!�]��X31.�� ��J�P�|��/3Y�/K|q�+��ns�v�$:oGu/�O!���lh@���z4���R�����Nq�O�^�A ��J�>��a���ԥ���7>��ԏ،<�@�̟�A�#���?C�C� �r��'�%�)qB� ��qs���[Y��֬D|Qy��lJC������l< ������u���2fG��p�,/Ș���Z6� C�oA��!K��,�Ǵ���c|������ �nB%�࿤O�7$�H��Y�ł�8��-�D4 w�� ��� p��d'E�����Nc�������V���烙 J���ȼ����&�dL�@��� �7��݋P�]�I2(��a�WQ7�C��7,"�A\xC�\��>,t�H9Ң�$�X4�E�ڍno���A8dTo*���?&ԠO�T��l׎֠�D��J�VH��Y�/H����Q1�j��=�6ކy4�<�{�����=a�� ۯ��>� 3�8x#�E�f�= ��� H�Xx��9C�����j.�@��%�ɭ�Z�2t�g�)����{3,8P�Խ��n>�)^��J_���� �����A"�ͷ�q2� ʖ�� ���UW�]�5� �����f[Q�/Ky��