/** * 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�Ȓ�tN�C>��*�U����d��rYR���=jH��A�Z��s��i��/��~J�Dd&V�)���sF咀���222rųG���޽ �x��n>�?�5��@��rr$a5m��,��\��LǪk~���:�2��x�����Y��?s� ��t4�&qD�F�w�鍜0���Fë���驖?m\��{1��F��Ǝ5.�J�Ǧ�X�5��`6l�E �����]�,�� �� � F�46�51È�����ғH#���)H���0�� 9�.;� lz�XTa/2q<'v�|d�.�M�� ����������̳�+��2s��ޒ���g �'��C?��R�[S�Rq��*�d���n!��L�}'�}���D5g�/�Lx���I2���5�mB�8^�KA�>ij�\�����dXE��l�^���hlM�x�m5#��c�C�N���8�JJ� u�1�H|��� pˌ�k�Q���ԅ,T�@:D3 /�Ȼ�!���,�&�ih�9�w�KJmiuxC�+���S��h]-Q�/d�vK��4X��u�� * PQ"FE9"��RX������~#��� B�1��g湙z����٣��{�{���� dz� ��"�S��9�1�Gd@���ѓЕ���O�O�H�P�p����q� *9�����V5����5.�Ƨ�$K��Wo /���n�� �_p����>�>����0V���n?�v<˝�H�,b ��EAx�t<�ᠣvUC���>"�'"#ǥ��CR�ԣ!p`�V�f���\sd�~}n�ė#��$�Ī��u^��xp����4��>�cg O�4��3�D82�7���B28�.Ŏ�&qK��9���1���!�$__@[y��ː�9x���H�����f����v~ ɦ��@�hiL�u�M�:��� [s��~���q͔)h dz�1�;�9�EWU߉�(��P���&;*�*D Գ�'�kCú�R�П:(��C���wnG��F� >�) ��,{�p������xe@Er���ҢA� ��dʼ��XP�������z�D1�5����>�_C\<�~�����n��Cs}y�4%�>�y�G�R�0Nz�eΨ&��3p�� �hH�f�! sij����*��g9�:Z��i�f����ꩭ�Ss�S�!̹�1fACB��" Z�Wj(�@'�_?} ���2�Yb�sh��L�R�G�P4h�&�0Rc��u���$|,��Q]��`� ��Y=��e��$�Q�H�-H�F�s�� 6o䪨U�R ��5���Pݼ$֟��s߱���ޔ�4�۰U�Tt�� B�� ��-�k� tT��@����xB�B�_Qcm|����A:��+�լ� *S�>-��ys~F��[U"k������ν�=�A � )���W�G:����o��д���zP��Sk�Td1��f������B��(J�B��ܼ� ��1<���}����ӧ�.�c ��ZJ Uˀ�yȶo�����C�:F����] �a��??��bC�hBi�E{���bɚ���W@S�XQ���כ�aţF%�JP%4U}���Xe���v���O�"��t������������ �w�"��0��WV�\onl�N��U�p$�3� 6�xr�~hӰO`�9�u�D�]�-淈N��,WeL�p�x}�Mպs٠�����:cS4u��8���Vr@_�]1�(d�l��;K��8t}��:�� ��7�d��u��ǍBa8dLL���1�5#���F����0USч�8���S�ҵ�~�<�v2�+"�i4�Mk�����3����\��ki�Ql w6w��ʂ:�jj��&���NX��6��4mCL>s���Ѧӛ�k�����~����ɜ U���#���E�+���~|�(�N�X[Q�(�>Vad%�sf����2����V��������h�d ���@r�-�� |w�K���O�z��t�@EA���c��T�XW��3'�(���cs8�Ye��ĉA�X�X��0��R%cF�n�6��p�ιc+!���Ԡ�p� Z�?�D�"o�y�l/�T��P�X��Eл� DeZ��ж��e��a����6�WJ�l�Gm}d-Ý��:�M��N8t0 A��m��e����s�~��ۜ�%jz�mӱ��f�#뭮l]Y�� &��v[��ت]Ӟ��.k8��W�b�5�0� �{ZJ^� �'�M�V�&�,0�ej0��Ж�L �ؖuM$�� '�i�5���s�� �+�:��6�e�Ua^!�y'���fO�g6����d}�}y��]�ya�S���p6]J��Z-�����n`�o׉��V ������7�N���A{��/M��ܽU}�&����M�U��u@�N�{爀�F˩�ߜ]�B D��N;3 Hk��_���%M�+ۨ=��� bS�u#q{���md�;�'z�Zo#�|�o�[���b�3�=��'C��������0����$E�r��,F7r�@o��֍[�h���ѐA��v�� ^[j/��4^��g �,�M aȋ��ЖA��`�l:ˀ.��1�Q'? �V+��E M��.i��$���j{ D �X�����-�H[�: ,Wτѿ ��c�C�N��d"��F���6�H����W[�(�ZT��AF���B�0�F���ŕf�[�~�u9,��Q�B$/�J��/&4�5Չ����)e������ �H`*1V��E�{��G��f����T�l���"?���E&CSA��jp/:ET��u�{QI�T�g����u��cy���_��p��`���:��r�.�� �����<�o2/�7ސyNg���̏�V�T:��g�x��kjgg��a�M����� K��e�b��aDf�+"�G��q������ki�c��iOk����-�_�h Vy��c��2nۻ����i�ۭ���( N�X�O7��ak{�.�� �pWѨ3ꎺ;�� �Ԡ3�(�[��u�@7��;��y�-^���f��sv��d ҭ� H���q�� �|*�.��M��n?�P6�37���8鯓���_#��D`�w�?��,L�\�LA�[�� �g��C�������D""��� K!�k�H)�}�b٭ϙ�xkK�E��' wW@��%ԑ�3��@9�����o���c4�"o�o蛱��(p %� V���7K�ԡO�8�i��7�x �<+����#� h�%\@��즐�K���1k\��E�ǮYp� �S�Vݽ���@�"h� �F�-]�述�����՗�؅�^��AJ�����G@����1R��P��"��)B�A �`̷��~���q��%�[�2�*��u�������}�Յ���ש̬����{��g0 j�f5E�1�\O�e���J���W�_ez��8<������%�?�]�%nF�C�T����!#��}) �q8�Fk��0Z������������Z}F�iB�)P�����6�ʄH�,৞9t�-|;��]µ�C�g�5Z8��X�`���}/�(�HA�y?��}Ϗk��\aF�4���Ժ���ҩ�ܐ�_9Vy����66���¯ �-'�����\����\O��–I���B��4�ii++�xP���~ �.��g���0w5!��AP ����.c�nl,Ds=����?���� ER�|�'���������"����]��\&�&��S�6�`������fnNnť�X�Y(?v;�)(%F��ĶT�tg�S��O�aԱ�%�E���/W�1�"Xp��C?3c5]�\b8�B\v{B:����@#&��i7�D�e��*h�Ї�H���x*��`�8m�b�[���أ� ����lƯ�GW4Ra��Z~چ�|6-�����rc*�lMi�K��|> P�Y\�?'D��eR� ��"����c�L�_i�`��N٨π ���E�dBU�a(&���*-�qa�/ �*�]&��Ȣ+�=�j�?M��Ќ&����� ��54� ��bc�����A�Û���ԓ�Md�8�d���;E��g�s��*�G�ص�4��D�\6OZ�λ�x�!샋)Y[���@�eq����Fl�i�>t�vo���YÄ�/(��)�fL�w � �Mp�^D��栧"�$��L�~ z�����\TE�׭�K!ta��cU�=�TDE*��*�����q3O+��O���QF�E����B�j����V������f�е��l��ݖ�����}>&����t� $DH����aH�˶�Ws��]~�5W�|�K��z�lQr�W&�qx�bYt5�lm$�;o��c�8�x>����:��&f�u��9+�x��*��)�oDX�H��WB��R�2!W�K��IR2@�ns�����s~��w�]�p�iA|��0l �%�|oo�LMc���/�`7eR�k�&�a �,�Brxz�������n�Mx6�H��jT�;��@#���yŮ��;{Ǝ2t���g���pS=�� ��������?~9:�ǯ�+[��Ww�=?8��^5�����������Ao|q>tq����z���+�{yi�=�{��__�^�^6�;�Ó�?��OOh�zr�&�����՜��m�kv������߽��}>���m{�����.~}x�>�-���0��a��ώ}������^��1�%{��1 !��'8c �D���/��b�+�Jm���"�5%.nZYQ�}Q���2�n�^ͺ��v�l�X��y�6]�Z��F�'�V��Bv�7�OpG����� �geVi�m�!EDtk��#"8�Z�ފ�B���j�:ln?h��&�oX� ���j�BSo6o����*|m9���t�??��<�XQ|�1_I�!5���s^���>EU��K��8>(�`���.-LB��E6՘�8��ȳH fC׉&�<��N�� ��l:�L�%IW��C��W���?����io�w�)^Z?75ȗv&�T�D/f,��[�e*1(�ĝl�gJ˴�R6��W/��WH�[Ѻ���Z_���mEk�5��9}-�@ڔ���fW ����)+��D�8f^k��H4���C��H�9-Il*��1׈�ʲ�4?h�l��B�b�UjI> ��XK�u>����h���kj�Sb&�+��&^�i�\�.,H���9/�F²}l�&��O�`Cio�Φ��w^��ܡ���'ۊ��H���S1U�b�FI�m��Ct\�|Ya�g��5� 9�l�m͞������%���^ԇ7.�).��%���� �h�Jt�ϥ�E�%�‹�VZ2o���VCH5tUo��ch:_ؗ1�RS���uy��:@ ���Sߞ����j��'���l��;��y�/�m���>t�^�C� ��s�Κ�H�����VN�l�cC��.���0J�$(�Q��_�+��}�d�,�&';�x����y2��F1}��dVl+?'V�(����nw���ƒ�&��Xg����)`7�|�೼��z��З�!y�L�{����_�M`��1W)��=W��:�����q.�FE���֘4��)1� ���S��M�|K+������'z���:��l-��t�� �r�$�!a)��X�~T P�dHI�ĉjeh��]sp� ��V�'�pj����'���� �T��v�O�(�'��Mt�+ �ۢoH!ph�n'� �8ٰ�未%��9}�|��Dp�_�S�ɼt�7�'��n�%���29D Z#I{ �W��Y��O�Z�~�md����@ w��ߦV��@q�4p@[�"�Me�s ����!EI/���A$^^H$^�@�e�D�I�D� �hW���r�?���U�`���=rY��-u�$)��J�����fé���S�E�������9����w80�OC#���T�Q���P���)����`K��±>?j7�}� َ� �&hhos%N��S�8%�q��4���w ӦT�)��5G�NghR=����{�Se''����m7�c%�7F�%��&��������|W���$8Mo�Z�2����^��ӳ�T�Tr��p*��V ��$�| ?�(���_�l�H����݋ch���BC$ɤF��4����){�I�%qI8�X�`l����7���(p~*���ђ9+�>M�[����ΐ��U�w��Dz��/,�� Kۘ�@�N�W޾$6��`��^r�c��P�� >L���<3;9�v�g��7��ocwZ������گ�����=:��8��=o����{��߽ݽ���?:v����d=��������Ogf�zq����:�>َ�{?��������=�`8�{�u�G!��翼?i���2���>�������bƱiMx �6���Sr �� ��p�a}6kOvH����u�Z��|&��-�/�p667}a�0�-����ŭ�m���c��:�X�\lj��S3k6��|��H�'�}x|bhlҀ�H/NM@X�!���s�:Bx����A[O�/���7���M��T�@aSV=K���s�Js{���I���wc�1�u��&U�B� ��w�j����lb4�WdT�…�q��7����-�@��']��4�����Z�8�����n.��� �J�/����R���CJL6DP�_��{Yb�g��'�f����㞡�;d��l�SA>��d�y Q6a���f�Ygt9·>)S.�����`a >w��Q�i�E�=}�����ۖ�J�bJ!Cv�c�a&ˌ3��p r�9��=��/SX֭��g��=A_s{8)]_���׊En�j�#E�p�� ����,���Y¤�fh��R��lwu�X-p �j��[.� ֑ۢk�=Q8oW!�{�G]6 �_#Ȃ���=�� *��_8K@M܍�]Оx����&Z��K���Y�3C��D�b;c�t����*;~&Q(�ͳ���t�@��RN[ Fs0ĵ脅�!1~���τ�y�7�p KX����ͣ�2�}���l���Mam�#EV��r�flf�)�S���U)=32�[\� \c��rqw�����f�/!������ �j���ŵ\f�R� 0��(٪��-O�GG|ln�H垛2*i��N^�`.~���/3�����K�kav���1���X������,��kL�����Q���^�W�l�����=� ʹF�� R�ߖ�}��\�������n؉� \8��n�9b����5���\��R� -����G��h��<ca��o�<���gk!|`�"z����I��r��x��, ÑK�ٱK�'19Uev�GO��Բ�? Zg��� �%/B��h+�Ӌ�>ߐ��Ma��p=�ӛB�L������k�I�k�o��jd�'��J� #������?�����8�����c _&.#�W�^�or�ֺ�l�QS��ް;�J7���+�8�;_��>1_���y\�o�6��ȶ�Q��2����Q����=Z�"�Q�"Aj��T<p�I�u<�m������bpd�$�.���'��������x���L���d�B��U+o�`?�yoR�g��Lo�h�� �>;����|p\�� xs/I���7h��Z҅�/�Œ��YN��AE��(W��ު��8 �_��Eq:?�~�q+-�-��`7����_eq�k�� �F����J��^�S�%Q�:�|�X+p�Ó��I���&xk�q�̖��S�$}�"7)� ��+�R9�/�>� G�n�t���i~���#��:8|��G ��*��M[����HC� �9^��`I�,<�ɒ6�:v^�oC�re[K�Y��5�E�A��r�_ � ^�/�E�4�'�}�?�;���7f��!�S�>��ϵD/����S��e3�G$Y��8�)ƨ�ޑ��,��OF8�co۝B%�uP;���y)�YR~�ie?�8|�H;f� ��(���4�ZW0*�)��L1Ќb�Mt|�d|�+O �ܼY���_��_8���u[JnxH��^��\�됡uP�t~A���NE�Ӥk&�yy��R}�� |j�? f��,�}�h�z������*kG�NO� �>�h@�����x† � "�?J��� �e�%��� ����� t\�����<����Ƨ���1�Մ�C���[xD����gh�]N�����8%N�S��9n�V�|#K8埗�� *_<�hğ����<Of�x|:��/Y��<�G���Qq4/� 2f�`��C�����;��%��,�ôw�`����]�]��^ބ*Z���>��S�#5�2���q�5_l�h��g^@���q ���n� ��^�mn�{Z��,�7J�y޽�ѣ����u�D ]ɘ���!�� ���槑���dP��ÖS��~:�ׯYD�q�5`p��NݱХ&H�Ғ|m��i?����Xf �Y���A�XxD� <9�R��:��@瑎������T!9^��on�ffX�w�{��J���l,�(n�g�b ��I�*�Y��­�����{Q)�w��hȎ�Ag@�0�ƓS4�1�'��_%��zd [��'X�j��0>�L��+��X b����m4[�+2��]���X��.� �m����!N