/** * 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�� /[dB�x�HQٲd;�r,)�ٶ��$,@Р(FѬ���t��/������S�ݸ� EJJf�Q lT׭�������O�O��~}�����{����kzÞB=��T�2j��`�E3�8�a�5�݌OQg8�:zp}�_��]ǻ$��z�(�֩�|���� Y���g ӫZ��6 T��"�E��� �զu5�#�U-��Z0�׾��t}Ӯ�����f�N!�c���!�QO9?{��*����1�)W�~)D��)SǎF=�^9U�� q<'r�<�L��t�&r"�t�����l��_I�f�5�O�.��0��a��zBYDއ%�k�v�������IX��ת36�T%!�� �t�o���8���9�SߜD�B��"J��(�`Y��p�&4��E!hֱT됺�i�5ћ�O�t@�7^H�ގ�1dd@#k�#�s�VFV���4p�!�0���.��gFT!�,��A�:�9�W ��z��+TIO9A���B_�q���$�F�yh�6������Y ������1�۔CK�� Y����[BC3�5 h4k�SV����T ]5�ɩ����(Z'Z���|���U\��� ���ż2�S���?�xt|xv��|]۞:��O�Ӏ��/�)�"�2�#7J�d��i��S�W�TӛU�Z�Tk�m�SM�(�ԯ�>�����AE� ��� ?�`3T��(�=��x���������,wb#�/�p *4 �������V�]5���.�� 99� ���nLR�����Z}2�x�ɩx�+3$~�Uh7.'V��o�p��E�6 �۟A���D���q�)ytJ�q�ze�z2(�o��2hN#?�Ua��/��NO�UzС3���r��b����mB>( d�V-5�@���U� |6=���_��b�,CH�A��"��]!ry��n��9+��x�6��uPWm,W�^��[;E�S��Ӂ��H������vI�׮�7�S���猺䠿{V!ȷh�'�xqJ�#n�%��*�;N��A�t)}%EX�R��� ��6��a+��)��$� �o�wg�'�m���Jf�^��`�����Y�8���4�� ������6����%�B��Q��?�Ͻ�dV(h �z��p �ˡ�܍�,�z��*(<���T1��B|A=�h�6t��"5����@�%��evp;��)��(zdEZ��W����nx��FPTTI?���h����� ��OR̩������ �z�G��r|��H��o`�<�~n`���n��Z@ }y��$>h�{�����a� �˜AI��_��*�XO�!ś��4̔U���W0��g �ii�]M4 ���A���J�438�>q⺷%���H���^D ��u�b��o�?�_��N8P���r�n%�Y� .)� ��ʇ�R� >΍¬\�d`*A������J`�PI�U�$KЃ*7�Cg!���B�YJa�r���T��������wl���72��6l����3:��"�b�p ��iB�XeR ���шz�N����>�ߓ 2 ��;@o<�=��S��G���M�2�׳���Z�X��7�b����4GڵDQZ����j&��6��,�\�Ъ�;<na*K'?��$Pe� �W*��G��� :�re�T��7���k��s��δv��Q�������ω`j䫠�1U-��u���yxuVˢ U@�'���#�[;��rRcj;fot*x�\2�\� �Z������-\��*l s�Y��G^��lom� \s�! y⌱�M/��۾�4���.��V��u��+eD��7PhI���.Û��Z A+ý�kD@�N����oN��"�Xz���5��L�1qВVikۨ=a�k�X�躑����NA�3R�-���[�"�}�o�;����S��wO��!�����{gǤ.�#�zP��j��-F72�@���֍;�h�؞�WѨ�V��:���\�zI���Y�!�.;�����{�ٴV]�` c��Q'?L��FH��@���^�}��&��6W@�¨�@�R��wW��H��� @x��� ��T���@�p�U��W5�[1�mS�$���5��ڍe��o����.� �j�J;_]��8����^�$�y�2 V��U�A���tDCZ�: �kL��^�o�f�F�"�a��y��o����d�������:  ���� ��܂��� ���Ԋ�+�v��7��{��1�?�a�rd���T ����c�z2�ZZQ%���*������sD�i�U��Q� Ѹnud21s��+3,-�唳��|P�&��j��$hMt�G2IZO_�+��ĕ��*M��[X�n"� ^����LcM�sՖ�zc��ՖYD:/��,�JK���\��xE�RQ�����^7 �`�� Bdm��"w{��`_ϗ<����!��w�����A4��ޔ�x���&��᢭��N�.�'��%�̇G�y�@�����5|�=������>�T��Np}vZ��]�n��|�}Mm#_uoQ��Q�&��7ݱa��i��0�X@w�͈u�`�A,�C`���lw�a nBim_��|xL� ����{������E[�ca<0��� ���Ҍ��^�j� ����bZ���^ƒȤh h�w D'���V�o� *1��|� ]ؿIS@ 0��7�˷�PT,��g�B^����1^����Z8]$��� ������u��O%M���x�Ɠ��U[����l�����C��b<�I[Ξ8�� "�a�G����;��ƌ�g�Æ�=3�ښ���V���#mѼt��r��C��_ܕ���U5Ҍ�V��R���q��!O��v���-���$�f Z����� l�AU��X�m-Q_�`�/��s���olN<荢�|s~�I�2䅢" , }o(�p+�J�liZQ3~�y�U/;W�ث�L+r��da�_/i�r,i�;��=�2����n���L��1%k2� |��s��d��w�n�Ba����R��U!/Pܷ�u�?�� �9�C����w���^����z6�����~<�O�h�OG�QM�{.~���W�U�;:�P�^e����m�M�SqU�|D��*����L�bF���к��7O�È��}M^^ ���8��H��\2u�9����}�Q2� Z%v�k�nDO&K�GT�������հ�wtF>���w9x��%���(c%]nj���H#��ߠ�Z� �.���z�\��Z0�Ś/��� �K�F�Ɯ�i"�Bx3�2��U�w��[[k  � �P��W ���su���z��|��O��6@L.�-r���,G[�P���P�W��;D��$��5(����� ���H;7�׫���#eӁ9q�����:) ��5��{���H�q�a s2E�`��&��C��"g�{�2N"�[��#�����b$7>b��V��L׼�% ��0��c��+�L� �H/U��@�”���?�'��h�y�s�I�?��UG��c����*�ĽI̧c�&�Lj́��o`�_�}l��.�/BI0�~zuH�%����� ���0��ׁ,��E�Ă�T�nl����7 jWF �X��ls�_�Nt����+b��1N�7�5�����[@��n��9�S��P��2���)B�C �b ̷Ɵ���n�ׇy�3��[�^�0�Gk�3���"������M��e@��ͅk?�Q��U^�n&�*& �+�[�_���qu/�^�L,~��Lޝ���^5��f� (&S�����t/`>��>0�gܬK�gGר� A��_�(�G�2����6�W^������� K�K2k�c($�.V�İ��8�B{��fr���|�ݾݮ����]f����%����!� ]s� �*� $My�ʹ�Į2����|��B�!<�Je��3���2P�_�LX�<�qP���@�BƯ5��]=jI��9�|�h�f�V]:��ќ�������{�Rӭ�Nq?��A��Vh1¸��Vc\G��Q�~f�[:���pd���~�d�?�S�F.�e�n��{� p�U��a ��(� �RrS�@~a���wnP`g��:�}�o��5�:n��<o���>��� � ���,7���ޔ����/~/�ij~�o� Q��: ��S��b�MFF�onY`��.��Ѐ���m�x�U�a(��eڰ�,�q�Sl�5Fs��"ˡ�����x߰�0���)� �84���bk���ʎA|~�ak'C��l�]8���a�� �$ !ܒ`D��@8���3ClyP�,˒�Ҁ�Ь�=�3���U%O��w?����'U=���>;|}�X�o�_CmCX�[�;;ĕP��y��IX z��a��[�)r\.�*�����M�YY"[Y�65���޶�ɸ�ԑc�`W񫼦�E}�Ɠ�D���҉T��p�ϧ��t�I ��Ć�Dll�u�_h�=�"����\Ūb�P��.+�Z�O��w�B������/Ay���_ ����F�i�?uS��v�fB�̓�����Ld� � oLp�#��r0R�?�W!�~%z���8�ȜWE��Э�)!t���cE�A��GE ��"��`���qsO��Q��Ӣ}߿,P�t:�Ư����*W��U�*Ԭ��6� }����{ZM�[���$�q���� qb�6�) �v��8�l u-�}%��۴�'��k�w���Ƌ���l���� �[q��K��q��jx ��u�Ѝͤ&��P3V � �u�1��8�i �(_d�*jAτ�_�쐰(R� �W�[OmW�^����*"�M��t�ᛤ� �%�to�aj?ܔǃ���'%��b�)vY�OK,%���)���S_mó)gJ�ޣ��#� �������Z�� ��x��M��/��z�*`ߚA�Ͻ�/��h��N���#{m������W��u���������]�N�K����yu����_�|�y���w������דדW���U��׫�Ϗ�甽�� �~���՜_��a�~�8i��ߛ?]����b������� �?~}�!�����0��ף_�w�߿��x������oW@� p��6���p� PwJZ���y�� /x��Fl���#�z�[���N��;����O��L�Q(���{|Jz��]8f���r�6w�n��m�\�S慸�S `�Δ��q�#b�l8̌e� `(L qUS9��@K���Em/ gh�c ��6���c�ℭ+�!“s��h��G �m$�Xi�r�^�x�(�����?���Uבv��|Tq�F�^���k���|��l?nC�7,�8%N�L� ���x��{Ne�5o�w �׾�g�r㍢C?̾A��� B ��C,�+�+�F�yϫ��ڍGu��nC��i-k z$��YF���Y����ֆ��O\Ҧk7��臸�ZB�W��fBb:�sF��e��#^g����SDD����"� ���]S“IH�s�_��i��ޣ�!�۬c����I�p$j�.��z�n��L���Ηstœ���鑈5J�9);��x}q��񼻗����2��@���Ze��!��"_jLl�`�����:lD���5��9�����$JUO��}������﫚֞O���ŋ� �f�(^���+����h#�:ȓ�� �$4����9�6h��hL����S0�E՚��<ӍNS�����h�. � @p=iLHF�m樉M�,�l��~!.N�7�q50'QS�8Rq�K��H �]8�7��V�c�Li�_rHф4 i��c��0��T?tpKq:�c������&�r�/Nɏ�R���D ���Y���闟����=�^��'u�� �Pr��%l>?Q���t>�"�c�c�$�K��:�����^M3j����f�\�{�`:��j[I�z-�g[5�?�jzU�e��д.�YĵƦ�.P���F&���ƾ=qi-�U� ���t��g��|��6���@��"g���eD�{̺�+ǒ貃I�>�y�5iz�o*mSf伜(�n�����.��2��;.8�s�X��jA>ĩɑ*Y����u�yW.d�1I�f[�Qb��iLJ5'��Gu �I����KƖX���1����=�L��/s�<16 �=�x'B��݌�E$O8Y�7�lmTG����K��o�ɁcW�-+rWE$,�@�~A����L��X,c�1��ɒ���X�q�b�u���`�-��~��� �A�U ��6�[���8�o_B[儗3�)&0]BIa}���$��QP�Xg�u��;N������ #|S9�jE�*'-�4���Sx��ؼv�7�!��l�JR�1�Ur�82'F\���Ep�`q���T�J3¿����;��ߺ���@1�N��&��i{�Lܐ�"ɢ����!��/%��@��j�t ��\O$"��~x�� ,Ѯ)���3��_h��E��{) ���;چK�c��Z����&����DPe����9��ˏ���8?�;C-�GZ�8;򛶥v.�����;�N�ũ�h�@�S��P�2IC�D��s�D��,%EP*�g�/b�~�aҕ�_J��ljRK�z�K�g��eLJ������Xƍ�s�`��<������q�]^ {F�U �+t�]�J.��� �����l��;��������v��H�����L?�����H������T(�p��s79k*����L79~�,7x�KNI�BT��%2���)�M��D2�F�3�}a;���u*�l��5^��\���]��ߝ�S��'�UiJ�xO=Z~� �|�v��j�7���d���'�ڏ���!��;=�<�h�ǟ�¿�/ۇ_�������}{x��y�������Ë���b������ý������~�[��j���� �}4y�����y�ex��p8�����K+�p�ݽ6!fA0-� ���'��L���=.�/L��\6���K��e~� �Gj�6��0۷�������&��p�`��;:����Ŧ� �H�~ �=u|5�u��8�����c6��j�'J+��G�������8��_���@C��r�� !|����A;��/��ӟ����ȟl�P=E�Mi��#�� 飙��U�xԘ+i�⃜ߙp;j�H�醸�p���@������C �sm勂t[��{}t�O�•i�-��6��n�!�������X�z�j4���J1�}q��ܲ`P����ɂ�0:�1W��aք4y�t���.��ԛ�X���/◺n�A�;��'� �R��;��S�#������b2�TxN�Bv�4������w����� �CK 3Xe���$ǟ����<� Ln��(���7A�0����/���ׂ�l�j�SE� ��;��㦐���p�Ć�?�y�i�E�E��p{��c�Z�5�6�k��'\�+���.&�odɎuq�lq����s���i��%�I�^՛�`LK �s�:�MV㙈$�QL��`��X'��c����"�*�,H�rA�h��l���0��"$�o�����,���Aa ŋr�y7�X �G`��ֻa���H��Y��Y�8�S�c���������fA��s�Wˇ����fܚaD����p�+�A����� ��5���`P5,�I�^ �G��#�#>v7}�0�f�r�Z$|�W��7��K^�^�mQ��s㭍�[Zcu���C���o�!�<^�o*�;�c������vv���fZ"�R)����|/=�!?qE���l��˸pՃ_�s���)� U;����"���v�ur�h=Y���cߦY�~���R���0z�}��F:wr��x�t^�#S����+I�|��D���ƾ����Kd'���DY��*�Xb�T'�/K9.3xb4�q�������{���I�[zTī~a���@9خ}M��|<:><;��_�!� ������^ì��.l�,���Tv�0<"�t��A4�0��`\���I��v����R�+����%=?�|XKnqD�p8`�[w5�XW0#���*�d^�8��/���'sY%K.@�g��'3����f���S�c�ɭ�]U���p+-��w/��څ�vW����b^_��@G�� 0m��S��Q�%�+�؝�(F����k���/��B���S(@�/l:��F!@���ҹQp1Z�|T~0� n�U�W��Ƿ|�YQ��q�g,�a�Q���Ob�Ni�%x>�AY<���GSK<~�.?�pA�49A,KJP��_�h�Ϸ�[��XD�ˇ� e��j{���h��W�#N1����rf�@%����ș���#C�oA�𫢘�U��X��,�_��k��m˫�PA/�/��e�"ҩ�C{�X'X�Ֆ�fc�� �̞�]�+�%�!����x�����j�s� \1�S��;m�uG =�"������z7q��xG�@J���B����!D�t!.��= ����&���iY[���4�M�ډno˷�A8d�oJ���?�:�O�R.Wω֠�D��J�VJ��,HNT����̬X45�t]q]�����y��fͯ'��I��4�~ /2�4�h���OT����4��`0 q�b�ɓ_�� �#�_%o�zd [�d��j���9�y������ͱ�DE�Z5��G�r8#� ��.�\����7 A;�2D����9�]l��F���i��f��.����1v��j[U��|�y�