/** * 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�HQٲd;Nl˱�dg�>h��A@Q��Y����_���)�%���q#A�����Y�8$�]]�����r������oQy��O�媟�&�5"OC����%/(��� g�5�`������M9�D����e�yg ͨ״fM߭E �2帕�R��,�2=�a�%ũ�6/�ӫ��ټ4SOP���?�pt|xv��|[۞:��OՋi@��g�Ʊ� #�#�Rߌ�y�J�����Z�NU?~���}�j ��+���7UM�������&�0����Kt9�>(Ȱ��s���݇��R�Z������/��Gt��g��~�Xà@-Q^8��/i�k�mՐnn���G�l�Ddด�7�eH=6j��`�Yh�G��חfH|9�i7I'V�V��p����u4 ����(�:T��1<��S���zi�z2�To��"@s�!�M�� ����'o�����*q�zz�FH��&%T��FU D �S+�h�&û遽��ۧ��+�BH�A�Vbת].ryn�n��9�Pu_h�����{j�}�4���*h�U �=���`^�R�jb�j�Q!�s�b'V��%KU��h�GaA� [����V�C��"��Oޝui7U��ULខ������$�T1��I-M#u¥C�. �I[4@?|�h�}T���S/��2� �LO1�sDZ��說�X�B� UA���i��b��B,@=�h�64��25� ���r+>����|�v�}m$�Q�o����O�� W��Y��GPT$goϯ,�/� �N��� �8�i��/A��NcQ��O���5���3��z/ʪ�;�d1ח�KS�����0���� äg_� *��� nU�%z I�dܧa.MM��_I�������5v5 �,�V�Z5��|j�sJ|��uo*��GА�祭����5�r�����>�a}'�w�X� �b5S��Q� �H� ��?e]n��� �z�*Or0r�{��~��e��$�Q�H�-H�F: �� 6o䪨��R ��5�:�Pݼ$֟��K߱���ޘ���۰U�zTt�� B�� ��-�k� tP��@����xD�B�_Qam|�լ�Aڣ�k�j��z��O��˼9?#D�-+�5�r�Y��j���� �Q��z�Y�o!>���7�/����nԚ�"%Y�h˙���Q�� EIXh�����\p�}��Y�^�PU��>�0��oh))T,�U*|�!۾5A�_�� E�q�O�0���:3��pj� ޣ��q�ގ?�A$k�w_e��bEQ2��lօ�jy�|�@�l`PW�>��am��S�1{;�S>9��0��1�F ��r�loo�|��0֘�_Yqr���e;Q����H�#g�lzqr�~hӰC`���u�D#�]�-歈N�s9,X.�����:D#����AQ1x�u��h�"4�a��-�*���b�Qȸ�N�oV(�����u���67�d��uS�ǵBa8dLL��71�5#���F����1US���8��� �ҵ�~�y< ����Z7�����&����L���Wݜ�`-u�Ŧ0pg�3<1�,�s���Zh���%�j�^OӺb�9]Ս&�d\�d��뜍$L�)c%o���,�^Kŝ���kE�pB�ڊbF�� #�(��3��,���J��3N+��J�C��-@+� $g�BNo){�w���l;d��������(��y���rkfz8q��2 �k=6��]k�A>91��k�&0]�`��޵�v9ܥs��JH��<�5h9�;���O"Q��rZ{�Ě+cb(�E���"�]A�2�x�o[��*� �0@�v�m$��D���.���� wZk���:���$ \��7u:/���� ��KE���0-Q��M��p�7+-Yo�e�h�z�hO0��7����*�5�Iu)�y g��j\N��Ё�����dCە��v+��@���*5Mxh�Z�Llʺ&7b��̴���j�9RB�֖-�wq�2Ӫ0gHv� ����+��3h�B��׼����.Ҝ��Xa�,��Wl7�V+>gs��X�{Ub�5�*h$i�h��ͣ��aa��𿛦�ƮܾU}�&����M�U���@�V�{爀�F˩�ߜ\�B D��V33 Hk4�_�4�%Mnkۨ=���!b]�u#qo���gd�[�'v���F��Jߢ�xF��hgtw � =G�.k�ֆI]�G� )�VS� f1��kz�U�n�jFc��x8��� Z5�R� h�:�RsI���?cd!��Ch�C^l|�� ���Bd�Zt��5��(0-�:!��`��6!/�3�V{H@��M�W�+ Za��*�6����� �]i�Z�����0�7�@u�� ���L�?՘�Ť�Mi���.�hj%��J�wd���.� �j�J�X\�'8���C��)`������ ywP�3ѐVT'�S���W�����x� f:v���32��:��[�f>?�i�X��F� �cp �S."�A|+۹�^���E�nj|+ Ä���ӡā������kiE���ʋ����1-���Fs��9�IYudF|���[1"&�fXY>ʩ�'8���fMt��J0�AК�l �t��&��W5��+�/�U�������4x$~'�h���ƚ��-��Ƙ�-��l\��Y����)ڹRK��x#��H F���'��f��܇����>Dn�����/���=�}����< ᵽѽh��Gݿ*7�\�6�M���E[��ݟ�m���� 乗�yw@�����5|�������>�T����Op}vZw�]w���|�]Mm#_ugQ��Qw&��7ݲ`��ie�0�XBw�ňu�d �^,�C`���lu�~ nBim_�_|xH�JЗ���k�������eK��ci<0��p/����L��^�j� ���ØbZ���Z½�dhJhW �E����V�np/* ��l� �ؿζ��`�_o(�-1�!/Xf;��p��\ ��;c�*ù��5q�H�O��o�"���}��l+i�?����m<��5��]os�mF#��辻�u�4�gZb�O�x��\lc G0A�|J��9���A.aDǯǨmpQ��9�=vȒ U��)xH��v,}zӠvi�p!�՛������U~��]��������dXj0 �D�������>�Iů.��;�"��� ��|k���I��Xy�?1^���X �y�/� �.|������7�SIY���w���V �pl�=f!E�1��L�U���@S���W��yz��8��u.ܷ%B?�]�%nA�CRW����ŭ���������b|�濰�s�%�8/ #�(�BH�j#�V���2\��`���3�.�e�obd��+�p���\����z��g�d/�x�H� �T���Q�x~\���2j�I���V�D�N�䆧����|<���7~E1=h8I��4����ռ�7���e��+��}- ��� 0Tkc��������E,�]M�|�+�>����1g��Ֆ��^`pK ��Spvt�")a>��s���y��}Da/dl�qu!�\��MF�)��4�$7��:�R��b9jN ��uF Է u&f^��'��m�1y���z'7��DLY͡28�,��l�:.\�ׇ� n䳉[��Cx�Q�S΀jh�@#��f��D��:�'�%2���b~�%ć6�F�{ >x𹤉��[q� �l�ʏ�N�D J�Q41�-�1��g�Sk�,m�f#�;��l5�u n���`f�� �K GT��nJH'�2%h��Z>톝���;^m�PU�1O%�% ���~�f�8�h�W����v6�W�c*�a��Z~چ�|6�����rc*�lMi�K��|>� P�3�xWN��͗I1&�@��+�m22|s� �t�FxT �%X,8%���C1�$W�ei����|h�2��d�Yt������� w�?LEO�ޥ�iO�-[���V����a [;I���I ���獭 �o�'A����c:&܁l�b+��2�`Y��̅�J�þ;� �?R��1y�����K|R��\��˳×�����7�5�6�����}�_�'��$ �N�1&��� v�t>V���w?�B�S���A�"��A���b�\�&�r��~̈́�/�'oS :88͘�'�A^�����B�AOE� ��L��F�F��1�5�����/�[%�"B���%���Vv ����Ie$E%@?,ҙ�f�V©�T �� L��}�K�ʧө�d3E3��f%�f��Y1t�m��^��������m_I��$�3� R��<0l�S���l�q�/���Z�}!��;��'%W|��x�-�E�q�g� �o�x^0 �S���n|���nb&5Q�8��1]���+��ڿ���KI9�2C�QJZ&� |��C��9���0����o����ÿ�^�������z�f�� ���Y�C �v=o݅d��!�Hl0z�@Oz=��}�)�5/�!����\i�>�bQ�o�ǧ����ia�ŀ&��LQ WJsW+`��V��l�@��r�"N%��:�:���WľYw���&!:�(��0K�YM�� 5Y���^�Ќ��m$���-��h]���G���}P��F���t�!'��Ŏ����v������g��:���R����6���(4\�&��kUd�a+���`!�!q�.":��}ϊ��vp*��!x�ո]�ؼ�=<[���a>1n${��6!��G8c �D���/��b�+�Nm7��"� %.nPYS�#Q���2�n�^Ϻ�ݶ6l�X��y�6]�ZϠF�'�����B�67��p������ar�ʬ�X��C���6�{Dp<5�kJx2 ����:uX�{�:t�5L�߰6 �x��…�^��.I����t��|����0#;ܰfE�1�b%���/�y9�w����^2T���V^����$$�YdS����{<��`�w�hD�'�I46�9�����$�JO��}/"lu�8:Z�Ik����z��� Ӂ|9g�L��bƊi��?,6ҡ��""�c��u�t�¸@�ͼ�ĝ0�� = ��(ZS�w�t��4C� ��7���+�9�1= ���U�����)k(���88�h\�H���zM*�H��+I�Z�1�Z�ʲv�8:�l��B;b�ejI~�����p���c�`aK��yI����W�)6����la�1/%Ni��� ��$L�*=�ƶA۳fz ���7({�6�a0�SR,�O� ��e���-��a��7d�]lX��� �jIv���#�� oP׸��:�����`݄��A؅��04|��'A����Ʋ�K!���^�NQ�JM8s��n\΢����Y�hl��K���g��%�c�z �RE�-+��F�l���|������} � �����]�� ����*E4�#�Jۤs�� ~�/Q�Pi�[(�sTձ��11����F��Ĉ��!�;:y|($�@�~A[<��/M���&ge �U��1����q�d������S`1"��a�2&�sI�v�� cn����b�~] ���AJq[�H)-/|���+(�Mt���b��B�Ȍ=�N�q��gK�9UKbo�j�.��y�П�����K�!v��f��,A�'HW�!"��I�[�����I��O�=�~��������|��V��@��Nz����i{�L̐�"������ //$/\ �Z"�6���}�J�os �kJ̣霼,�W��Qd�<�/�a�\�xK�0I ��R �1��I�`#�9A�(h&ol]\<'C`�*8z��ң�1�Ry��,�AeG������yu�#p��P��*[���t �lC� �&hhoss.���$qJ\�L�E��ß�K�Ry�Џ���^�9�Iu,����*;9L�}en� �p��8Wv�X����{z�����ɋQp�$�浰e]ǽBA�� =S�� �P��2$]�N~� �P��>���+$CR�ߴ=�!��Ob 9 �$� I~��R(�pcp|�g��h$C�C/��K��l�d�D � 8=�M��}Xɔ�X�%�6b� og���"�;Q�c�`��xf�s�x����6�����'#�j�3&��V��4+/�]u�Z� ��3Э�������T����?����������g |����g�>|�>�|̞���g���̳�gx������~��ٶ�_1�7? ����g�w�����o�wr����ϴ�� d�����������a���'� ����k�� 1�شF����:���S:Ȇ�<���]wi�]�c�=�d;/���#�|� �Lc[RɌ�z{�&������[:���ř���HW?C��:�X�\lj��C#6��r�'&�'�#x|bhl��.N6@X�!�]:t�̿��^�$_Hc�I�9`CPx��uuw���*�'��)�������M���r���1��7#�1̽u����n�é��w'j��-mw�b��Ud�lB����׏�n�� \鐶�R�mCi�6�8��;��wn.����7S�շ�Tʱ����4���︅�%&@�6�`>v"k�~�<}�k�z��u�Ms,�'�I�����q��ئ���p�]��O�)ϑ����`a f*l��ž5i�mi��ݛmѿmui�X�\ȐeXb� �*��e0\�{�����~��V5�v��î���΃�����1�oZ�� PMrʡ��r�Z؍��+�T|���ִ��ޢX p �h��1[-���6�k�-A8[W"�{�G]6 �_#Ȓu��-�� *��^�JOM܌�^Ҟx����&Z��K���Yo2C��D�b;c�t���:^&Q(�-����t�@��RN[ Fs0ĵ舅=�!1�j�τ�y痒p +X(����Ӥ2�q��t�:�Y��utSX�Û7�>�\���`���(;x4���-����m0f|�����`Ƭz�+�����d^����j� G3�_v�����Z���`�x�p���F���n9�G%��۠� \F���V~�V�m^�݀r����O���������f�^�C��[� l���,_���m2;s���|�ʹB�� R�?����urMJ������L&b�M��D��S!��vr�J�2���v!���z�8���ǾM�;잚����9�������ʝ����yY�\r lT�N���ɩ*�+/:x�2���~Q�:�H�n؇� �nK[ �^���T�7������R*��OK�Kg�1g�zM����Xn��8�Jg�9G2w�'�0�R����;����|0�T�p4^J�c��k��?[ҥ���Ŋ��YN��o���l?Ɵd/c'�Ё]� n���Jz0�K�F�O��>��>�G�����0���R%D�η����]�퇇�[!��p#���B��Ki�x���Wx�[�IV�T؆3�F$���HT�s}=J7+Bm9�$Cu���7$� h˥e�[�$�ʻ)�3����1n-櫬�}���!W�N^[;���;Gʱ$�Q'��+.sx47I��k��c��]��8�Fҧr��(1���Ku��� �S��p$�&O7ݜM�m�P78���ɛ#���w�줧�k �� +@>q�c��.Yל�%m Pul�<�#^�$��Ҷ��/�K۲���9�H��kī|�~F_:خ}K�}8:><;���^�!� ����ϵD�`T`{��KRG�d)��Dxp@�h�C4a��ޠ_���I��v����R�+�ˣ��)=?�|XKo)Dٰ;����jZ��`D��s�Y:��xi�p�d��7+��,�௸��?����6w䞔.Oo���*�\�[W�uP��zI���.D���k&�g���:�GT�i�k�K�L��_��HF����k����ۑD���SH@�/l���!$@��"�s-�d��� �hz\������7l�)Kl�%{��'e_.��Fx8�A�f���:e���xL-�� ���A����8�<)N��T8~����>��N��%�3���g�_��%�g�I(_�8Ž���g��1�8*��#�eyA����v�:|z�Y2�?d���ô����/wmw�Mxu*i�%}�"�G:j�eh/ ��k���l���'(vO�.���ҭ!��ӻf�����j� {=R�r��(W�b�"�z�,�1���6�]'�w/"�w$$ɠ(�-\E�t!�^��� q�5�ap}���Х"H�Ғ|m�a�i'����Xf �Y���^�XxR� <9�R��:��A瑎��ꍐ�� 9^�Vonr�b^լ˻�u�u%�ch6�y77��w{�$s�_��}pf�Z�6t�g�)����{3,8Pѵ��Ѫ>� ���J_��O� ���k��A"�ݷ�s2�ʖ�� w�7�P�]�7;��i4��f[Q�"�:��