/** * 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�¬�R�H��͒,g;v��$q:��wv��HHbB�l���v{���y:o��}�|ɩ��(Y��=3g�;mS`�n( @�{tt|x��� 2������!��u� ˨a���0�;tߞ���}~=�]yB��$�i���^���sl�+�t4�&Q䇽z�s��� �����yD�pӛ�/}��܈�Q�wfc� � 9�"ÑMÜк?ֿ�u��x��]�K(#H��~����}�6����z��]Mx�*H����%6?y�ir8��< ��f^���Ԓַ��ץ���Co:�� 7����BV�蝅�U�YG,�zȐ˗�������♆� ��8���"zտF� �ߒ�G�N>�o�ۗ�ky����O����F��C2 ����Y�H=����z�\*^0�Tg�5�-�OuV�S]k)���T��W�S]�I��W|w ‹���AE� ���� ?{��T�]K���>X���*���vMgf!�/!+`dh& � ������Qt��*|DN'vHF�C �E�#��K��B�>�\��b�������h?.'f�V��`��E��p��=�a�h-���dL�^ť��W� Ù��Q�z�i��� @m x�@��W�������ۣy%�Vo@/����$�� �@֨b���{jF����Ⴝ(��'�pV���9�f�D�V�\�� {����Z##�ܐ��8� @���GEΚ�{�T���d���s+�L��;I� � p�D_(i-�����j�5�p� 2�Z�����T�j(^Uo-m�Q���)�����lF�G���ǟ�4x�xC�91=�>}Rg��w�,y��|<���=d�Z�0�1L�g+P �Cq�Hܒ�j�h��dA�tK�]_B_ya�ˀ�6xg�{��Tkޠb(����/� Þ��VU��!b:����w@��f�G���H?��Q��$��)���q,p/��j?R���BP"x�Gj�V0�V ��u8� :�M�����A�BY�Evp;�6�j��#�5a�k�"\q8�f}>�@PQ-���ʤ~�*��j�y?A1�[1,�����#!*���C����x�\��EY3�p絀,��rII:|���>F����0�G�e��"y�/�V�A�'А�ΦCdʔd����?{���jsWU�j%;�U[ɖf��'��˜} y^ڋ�hɻBG):{���S�%���� ˠ�C_���|/�ހ�A�黑y'lȭT����ca��Y��g>|V�x�[ ���H���r$Y�T�Fz �� vo䪨��R ��k�o����y/��?���mA���)�i��a�����A�[��L"��f5��Z�&��u �����ZM; � �2}PI;ݠ����\��Ώ��t�j���c����ڿ7�Gd$w��x>x��� ���l_��7 jMc��W�h˙��J�(�k��$,���p�J&�~ax�~���"�O��[�����R�*X��T�̣fy� ��d*Rň�|����5L֙�g�S;l�N(�v�m v�Y"���{2(cJe3 �i�f+/�zXϢ�� �d�������료ԔZ�1����V�1��18�0���3X������kJP%��\c^#��U'��[[���1���<��������� ,�L6_]���u��kWD���,�����v{D%��v^��"��ʆc�LV�Eh~���[ʕc)�@#��f;Y�Ya�ġ�_e�F0��$�"�MT�s�Y��16 6g��8L�q���:��dTID΢�s��QKצ�xA��h4꧊�EiCotf����= {]�����V�#7�Ea��hxa�X��fEi��$�#>V +ҔF����1���s���-:�I�F���9�����R�J� �G�`Ɓm�a��5',��,?�o���| ��g3d��)��) *�}���ֈe_T����"�c�~�!Â��b���ā����I�jiE���ʫ�� ��-��)zk���q]eb�|���[1#&FPY>˩f8�bP�&�b��l�&:[�#�$��'�/��D�k�J�Kp�����-�{; �߉�ZF�8�X{��R]o��Xm�E�� �"����M�j-������*%y�/.z]/��=�'�����}���5�}=_r �{��P���y@�k{�{Ѽ���Sn��m����������?��|_��3����������qw���o��;��;P��/�?��}�]h��wݹ�6�Yw5��|՝EY�Gݙ�R�tˆA������~` ݵ7#ֱÒ=�{���u��݅�1� ��}Uv��!�+A_fc��I���n�_6��mU܋�R���@q��^d�-�o5<��*�ͅ�17Ĵ�ϳ��{�Iє���܋NU �x��^Tb$%�پA������`,�7��˶W,��g�BV��՝1^�����Z8]$��� ������q~�yK%M���x�Ɠ��)��z�a�Nl�s��f��x���=~�D�������Ș��|�ڈ�'����>�;��������!m��j�S��K�����ŭ-�H# Y��֖,�hx@8�c�y�hu��n�.� T��R�U4j�:�N�1���JE�b��x}Q��r��&����_��9s�7�j,����%!����0�Q�c��Y�0ʶ��U0�'��W[��wa��k5�aF�,,��%-Q�%MsG3�gRF�pq� ٍ�� �4� c΂�|�f�\�0٭bݽ����t��x���<U#�Q�7�y�>���9�c���v��=6����j>����pC�x6��� �������=u.(����tF�$x9�n?�/6hK4h���{����#��W����g�3� ���e�`�y<�������� ��m�ќD� �!�v4!��@m����k6�r5����.,�]6�k �=\�MÌ��UI3��.nP��j s�I�K�]-c |-���bM���vvc����Y�1�'\po�V�0[�� �.2�wkk��/��;�g��~>2��6_XP�� ��z�~$�����"ۿ?�b��+\�dz�N�C�L�O�Z]�b� �_~���OAڹQ��4��eё1s�����:)K��5�:v�&xgA��� �”бq��Խ����hf���adO=�]��H�"b�P~���ѿV����G,V݊@��7�$���P���d� hS��:��Ko5����~�ӟ���c4���?�� ��K��-\�A�E(� ���\Œ�_�Q����K��:�%w���S�j�+X��.���^�e���ԻZ�� ˎ���P~�����������f���?��UW�p�ދ�Z���W����G�j��`�u��l8V��O���o9x����`���\�o֗��o^'���J�o!"_�y�Ԉ�F�"cD�������>2.����|�q2t'�\�uK^��vK܃������'#�ɽ������9��"oz>濲�s�'�81 s�0<�(=jϒ���4����9 �k j�~:s�ݫ�����f,��`� �}�'�Qύ&�7�Ѧ*�w�j��� ��/#�VR�zIi���Ȓ�����"Vz��ψ���Ƣ�/ � �����'�S�W���L��–J���B��4�n�k+@P���~ H�|�g�C�0w%&�/=�!n��dP1�w�՗��^`pK�Rpvt�* a�������y��}D.�^�oc����\��4��OK�}�YGOC)Qt�5'�M�F#�ۀ6k��֓��Ͷ�+�2�w���F �7b���D,ZP��AH����sW�b����xl�F�!\�B)�)��@50�e�!�rC#a��P��Q���V�"bv%�-ć>��lx x�B����-;t�c6K��a'�C��8�ؗʘn�4�k�5�ڦ�B����e��:����:�"03��9�ņ#�aw%$��i�4by-[v��ϛ�����c(�+٬������M־�5=�=� ����|����5�J� �}�O�P��-�&�g,�܈�j{S�F��w��=_r��-ޖ�`�: ��c�X|��C&z���D�`I�l��CX�ŖS�|*�0K�O2mXVy��ɷ� ��*�]Sd1�z�3_O��2T��)`�{��6 U}���Z�춲c�/N�1l��c�v�*-� ß5�2�E�P$A`�p�#:%�܁l�b���2�`���̅K�ñ;3 �=�e��1y�����+|���L��ӃW'��)��7{u�6������_����$ �A��a6L�m�8ݍ��\�p���8+JD+ �&ǣB��[f0�Cyb[�U�*���mY��d""-�jG�����g��9���xb�0O2�įt�Biϲ/bU����i��.+��O����B������/A����^q�� �F�i�?u��o�\v�n@���[���6NNS&��������C7$'�r0R�?�W#o?��i� wdΫ"� ��V�����q 㱲�]ʣ"%@RI�0�r渙��p�'�Bh�#äC��Z����K%~��Ė��嬚e�fY�Ԏ�hj�NS�tպ�wn_�I��*�=' ��<0mR���|��ϯ���Z|�R<�Y��BJ��>�=��.� �ӡ�vBB���qQ0 ����}n|���Nl&u������\�W���B���F�%�� |�!d��%=� |��C¼H�'H�lo=�<\�z�����|��T"�o��mx������n�i�*;��G}��)�C{9��(`'��óʍ�\�Ӌ��o���3%~�Qq�{ i���Ɯ]E��xƶ<���/�kz��pC���g����������ǯ?����𕥽�3V�]�'�����χ�~|���hw��?t~t��������E�W���J{�����~z5{5{��/�g.~8;�������o����3G�?�����y����~�x��W�����������x9]�4����s��?����~���߿��h�����)�z���*`6�m ����8��pn�E��s/���Fl���#�����N��[����O�͕L�Q(M��y|Jz ��] 8f���r%�v�n��m���S���S�a�ΔN�i�#b�l8̌e�C��P�⪦��=����W���^NW���m$�1Ĥ�Y��XO��uDk�>�h�n#��z:Đ3�"�]WD~E���� �sQuiw���m$��Qh�vK����j���6dg3��S�dcD k ��UO���DT_C�f�y���q��t�(7�:���ĸ��1��(�"���1���¿�j��w��:��|Pw��6�8��������e��7��u?l�mo�m�Ma��%m�v��B���+�%d�a�lo&$��O0��]_�X��:�t֖��""��D|�΁�fswM �g���~9_� �mC@�Y��� s�`��X/\hh�����T��-�3t������5��9);��x}q��v�ۗ� �{�T�l0�"١�EH��Ȗ'�}< e6t�pB� ��,[��̦Cװ���'� ������-�����L�x �}A�^���@��3���&Z�Ŋu��/6Ѡ��<&̲` ;SZ$1�Q�@7�*1?"�@�,���8մ^S�5;���0���7��F� � M�>� ��E�ݘ��-YC�� X�)�F�F��F���RG2.aI"uh��L�)��z��ɵ��s��=��%� 0��F­�eX����%����%F�-_9���j�x�鷹mǬ����ߩ7�dz ���hK�"0�g��z��������``6�$_![� ���x;3b��^�\p;9d���d|�^�{�(�v��� ](�b�[�D�W�I-�q�wƠ�BpA��:���8�%��iR�B�Mqߎ����>�f�C��<\MWcs?��~Y����l�O|��}Ap��x�K:d R4� ��c�����V#� l�����Qy����&�b?.N�ȏ�B�̠xB���H�5����^� N����4p%�+7]��6�� ?�yY�� �᧱����7�K ��J�����Ԇ�ْ��@z�Ο�i�w����Dh+�T���\��6]���(k��7MUtU�QY�$+f���#{l_S찶���C �M�F��E�r���T�T~NאU�� MM�-��+7���F��-C�-�h��]z������G�96�R�)����2):��(�kǖw�"2�J��4�;w��Ak�⺍�{�5�?zI������\t����n�[W����!�s�}�d7|,a��j�IM�V�2�B���)Z=A��ʾ%�5�}��O3ݲ����J�>��Գf�'��,�q�n��̖��+� �Xf���#���.wޙ��&��0E����(��օ=��޹�{"C$7r��l.*+ x�j�P� �k�3�@�ӊQ>̭�'Y���񊵱bx�e�h����[̻���c�4�g!���h������$�]�O�%��{,�� �;@��dp�����H��/�s�<�q�m)��;�v��KH�0�B;������L��6e�w�"��Y ϋ�Y�|�#D�@�~A]���. ��x=cf1� m&s>�������Y@X �T�!�o���0̏�Ji��ߛgctw���YhQ����4�T��PRZ_��6����D�6�n�����W���dXe�X�>�Q�$�ғ���\��Kxڅv2��1Hl�Z:�Ty�t�b��#.{����"خ?���܅�JsS%¾�n ��ۿ�߆��DG1tN}"Y1�IdÃ, ����!�EE/���A$^_H$>p�ć�i�/��>PX�]Sb>7��� ~�C\)�� i�#��=��6L������p6���I8eNP ��'��!��e�Qp��Z��PO��G yȽ#��\h眭A�p�#p��� ?+����Y�|�(4T����� '‡g)I�W�8�~�v�(��T�R��4�a�lP͊�c �l�z����<��� 2>�qcd_!�yli�Ow�v?�]1���<.��ka�Ȼ*�{��ο��Z����@S��.���o�������?X�"��75D0��p���H�� ��f�R(�pjO�s?9!�#�B{��F1~�|Fx���/��c�`�s �eH�r@�Yc"���3�}!q❨u±l�χ5�A!3��O���y���&�20����8^�h��� �:`s���T��q�ܼݬٿ�0�Z��Kk�Qol�l}��7&��-V`�m�x��}�ޑ�S�#ig���h�/e�������e�Q��kR�W���I!�B W=��H'�֣ ��P���<PZ+C�?h���^�'�C_Z�Y4 ��n_�Y ������ �ޭ�9).��pd��`���$-鑏X��2�ƥ���j�.9�3���� �U[�p����O���|C�����S�~-��7��է%����}(����%6���&C��\� #�T����?e/9�T��[`X�c2��-"Ǐ��^��U;�h �QC���ag�J7�j��;�8�;�ņLx�� z������6���2�Q{��SUk�݆����\�G� RK��/_�����&ZN�k*�(VG*L���N�u�����z��# �3jd�{~8�V(q?n�e�'��M %�ݭ�� �S�c� ct��+��t�^&��]��ϖt)�t����,�̈o��AE�E(���\�î�����Q�>�~�1;��an�_0�|�(!�d͟�w'�K���q*�_n:Z���_��x)� O�A�v�ů*��ym�,�[�P��D51�<�e�����1��@[-c��5y8�O��Q� <�qk����x�*r��d���(+�˩K�e�z����2�'Fs�0zM�kވk�vtU�%���Ip��EV�:�h� �e8bv㧛~Ʀ��!h��j����!�-��wq�$�A�c"uAV�|�x9Ɯ%]��0#K����$lG��N�J�Z̿xHǬ��.�Гm���N0��x��>���-�{�������#^y~a���>�~�%z���[n�A<"դ��c��,��֤��gz��v�0^I= �t>�G �M��bY��!��ԓ�e�� ̎���Z�+���q~�h�^;��/��;ks�KK�N��8�'3��7�gn��J��}�]r���p�5�����s�j��y\�u�qu��R=��|��?2�dК�3z��h�6�j��A!D��I�=?;���ܲ�IN@L� �*�����(�h�3܀�I/�0�o��GM:��a���ǙK�?��nx8�~�V5�Yd���[xD�5��g��]N���IJ�8%N�S��9n�V�|S�p�?+�@T�x8�ѐ?�J-7~>����2��� ��c��� `�8����3S0_˦Sd�� �~�$>㯚���a��e���/wmw��}u*��%}�z�G:��ul- ��k���,<>�'(2x�����I:O�����N���U��F.�(�+�y�f���F�y5 ��(� d�YVw8�����C��$$�@QN[ι�z�:VT�fA��k:�����d�KEʑ��ڵE#������zc�CF��BI�c�8*�d�Jժb�v��G�cT�7Bj̩Br�"���,�̰!�^�7�ȋ�ۘ�Q̲g� ��Ifl��צa*p4u��G����;�S�0�8L��tܯ r���!�W�kj.�B��#��!�Z�{&�y��F�c~F��DES;u��!|K&$3�� �6�/�?�/�7ۯA,�ve�S�1{7����� OK�dU��]�5{�fO�.J�Ͷ,��?�RE�