/** * 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�Le˒�\l˱�dg�h��A@]����?�Ӽ�����)�K���q%H���3g�(�tW׭����x�������w/�4��{���qMo2����K�FM��=��+��9���^]�O�Rg2�zpy��󟹎��LC:J�8�A�����N�AH��ULC��T˟5.��zq#p�NjM%�c�U,Ӛ�F05>G �����]�s$3J�:A�<�hlkj������K�'�F��3:��z�a,Ar(]8v<��ܱ��^d�xN���2]:�9�؉A��sץ�㑱��g�W29�ALg#]&�f��58t��N��8�II���Kř���R���k����2e���!r�� �9�}�8�d�S�O�1�N�n����4�X � HSӴ���m�'�* �*+��p��"ddLck���o���H����0p"�3�aVR2]�Oό�D��l��Xf��^#���.g.d�J���y��@�匁L�5%OC󏹿K^RjK����_�؁?�A�E�rh�r!��Y�%�� ��0z����%%b��(!�� ��2=�AݯH���B�7��q�yn���-y���������mc���l�B=�������L"2$��Ȍ�i�J�����F�^�~8��`m:�ҏ V�cCo�������]�cC�%`ʫ�7���|r7|P�a��/8Bx�w,�J�k |�+V��\��);���m��9b �uFAxᄿ?�ᰣvUC���>"'S'"cǥ��sR&ԣ!p`�V�瞅F]sd�~}n�ė#��&�Ī��u^��xx���'4���cgO�,�*sւߣ���N7�l�۹gZ �-I�J��K)�BJ{!�ގH�wY'�� '��`F'��HIY#�U�����I�c��xj:v<�o �#�c�~��+������ӈ�cǠ�{V%��h�G�1xqJ�f�5�vdu�G�dp/\�\M�,�es��`,�C2lI�����Bݗ!�c�����vS��a�T�9( z.�>�@�M�����4�4 ������u@�����G���@? �)S���c>w ܋����Qh A�*(<�#MvT �U��gL׆�uS��w�?s"Pn͇�7x��܎���$9~�-RV�I�Tኣ�5k��ʀ����ť��K(���)�~�bA�j���s����CԤã7<8~ q>� ���ދ�j���kY��� Ӕ���C���J=�$���9��>�[����@C�7�0"����询�y������z�hP��N���J>5�9%>B��c�4$�yi+�y��R t���ӧ�KX��%VA?��X��-~�E��k�wc5��Y�[�'A‡R/��yFr/��Ͼ����,T�= �I֠����`!���捀\� Yja]��a�Z��������{�;64~ߛq��y�jސ��DAP1��{�U!��k�<��;x�O�Wh�+j���#��58�B�~�ڠ�5�ae�ӧ��2oΏ��t�Jd��c�_�]߽7�G9d$w���j�H��L��֗|[�j7 j�b��,f�����Q��EIXh����Ws���1�g�{}@U1vx��…x�!�xCKI��`�V�#���9:���d(RLj�|����5����W;l�M)�w�cw�y "YS�� (cF+����f�5�x�ȣ�� *�d�������k��Ԍڎ9���iV�1��18�0���3X²�����PP$��X���ʊ����-ۉ׼����J��K�+����t�g�Q�G�o}Q\g����&���n���Q@(����i�1�&�a�f��Y�hױ�5�j*�hǾwv�Z��|�����n�xE�6�f�i�rRB�v�Ѡ?��n�x��v�Ŧ0pg�8<1�,�s��v:h��%�j��L�v1��x��m:�ɸF���8��9I�� R�J�<2MOXt������׊ ��!��Ō�cFFQ�?�fH�Y쮂j)�i5�+��Jk@���-@+� $g�BN�(}�������z��t�@EA� �c��T�XW��s'�*���cs4�Ye��ԉA�X�X��0��R%cF�n�6��p�ιc+!���Ԡ�p�Z�?�D�"o�y����U*cb(�E���"�]A�2�xwd[��*� �0@�ze�+%Q6rߣ�>�V��Ck�~�.����E����Ӳ�t�s.�V�/`�3ôDMo�m:���Ȭud�Օ �+�u�=�Ě�n�=[u�kړ�R�e g��j\N��ЁvOK�k���d���J��$��%�J F�ڲ��۲��čX�$3m�&��~��Ѓ�u�V��F�̴*�+$��VT�������:}PHK�����[��"� 3�)̝���J���ja��lN�u��_'F^X1��V���Z�<:I����^�Z=�{��@M�%��ۛ �*C�����[��Sc�9����b�vf��jÿ:i'�AK��1ֶQ{}YCĦ��F&b��NA�������H3_�[�o���n�`���s���;�z�6L�=B�IQ���f0�э\3Л��u�V3�9����U4dЪ�O���`K�%���k�� ��� ��R y���*(�2 �Mg�e�2���� ��G�a��j�t� ��@:� -�W�1_m������@��T�� =i�Z�����0�7�@u�� ���L�?�(�bRڦ4Ipr��jk�[�J��0�(W�]J��h�v���Lp`�#�/�.��E�2 V��U�Aɛ�Ŕ���:�0��]zY��� �G�`&�caF�}EJX��Q:��ޔ��r"���F� �3p �S."{7L|+�9�_���E�nj|+ Ä���ӡā�U���kiE��ڪ�����1����F{��9�IYujF|���[1"&�fX[>ʩ�'8�rP�&�r� �l�&:[�#$��'����F�k�J�+pU����,{; �߉+ZE�<�X{��R]o��\l�Ed� �"-���MіJ-������"y�/Oz]/̂=�'�����}���5�}=_r �{��P���y@�k{�{Ѽ���Un��m����������?��|���s/���|}_w�k��;`]ӷ��|���ϗݟ��>�.����\U�����F��΢���Lb�o�e� ����a~=���ڋ��a�½XZ����q����܄�ھ*����U������$�gg���C��*��G%��x���p/����L��^�j� ���ØbZ���Z½�dh*hW �E����V�np/* � �l� �ؿζ�T`,�7T�˖��\g�BV���1^V�����8]$�U�������u���1�J��Og3�lO�}M�쮷9�6��c�^t�]a ��l[�?�� ��a��E���؜9����O��-M{bt5��c��۽öE���*/{X�m{��T �8b���%A��Y� ��f�;j�w+�r{���P w�;�����b�b��xy��{�X�M��o�las�Ak����7�O� Q���T�!�Cߛ4�J/�Qv4����<��y�����B��@�;�T��诗�D=�4�;��=�e4�l$�D���@Ee 2�<�.������*��w3r�O�R%���_��9��ƴ���K����1���������L��OG�W���M/����܋��tՄ�����=��]���s )�+4���b��E�f�Sq �'���b˫X���s�s�!���e�`�x<����Ʒ��% 윱c9��}A�K.�xJN.���}�Q2��9Z%6�o�nxK&K�����Y��հ�u �>���u9x��%���h�tw,,��FZ� wy�Z��eܻL�2�N��)�`>��5%^j��N���z�V��4��{363��(���"s~�����"�*�A�^�;B�՝��'�T`fey �v�����?b'�?Ϣ��k<� z��C�L�O���ɶ6>�1�1��� �~Sm��ʦcs��?'�uRV��ku��L�΂"����)��`��#�{KwD��v|ݣؙ��҃�HD������a)D��)ō�X����9�5oqI��ϑh������t u$�Lo5P>G�^���� �� w��V�7���[u� 8�t ��Hܛ'|��'h�ϴD ��s��u~.����#� h�%\@��춐�K���1\��|�]���~� R���K߁�E�878�5Zz�S���v���?V_�b.~y|�}(�L��Ѫg8v��lDmRC������ǫU6�&&Q/��m����;d�a��x ��c�L���h=|�_���`� ��7�S�Y+ �����d�̌��z��c���8�����16�� ����q�t'�]��K�%~���Kܐ����]��K���Rx���t�`����0�����]���0 ��� ��3�6�m �ĕ ��X�O=s�R[&�v&F- ��k�ϒ��p@�۲<��ڋ^��q��Vh1B��\�Ƹ�`�-���̌�tAs�� q�- �D~V���x˧ݰ���`ǫ��C #N6��亂���q��oi��c��#�|蟯����&a�H��oj�i����h Z�2ˍ�(F�5�u��/I�K��d,@�gs��+�I1&�@�櫐]25|��s�K:c�?*�,���UQ������ê���N�@T��v��"����ܫ��4�GC3�П��'L��д'솋�U�n+� ��P��A҇l'��»0�yc��X� e:�;nAv���Vљ!��?�r�e Xa�\訒=�s�гG�B?&o�~�8z�O���KV���[#�����ei��8N'�O���&���4D��Di� �t^���J���� �r�U��/�T�L��g��y�� ����zl�8y�����Mu1kD�d= [ e �����~��4v�-��vS&%��j�v���D,%�����]N/馾نgS����F�#l 4�!^��W��j��g�(#�k�jz� 7�� �� |^�}1Z����������o~v'������U������Oo�^������O�y~������J�^^o���k���W�W��~�|t������S���� �_����՜߽�I�~�:���ۿ��{��|����v�����/~���}�K��?����~�ѱ���a��ëWo.�O٢T=W��|�Hh �,uǡ��s�.[w!�{��go$6� =�N`(���j���rߚ�΄E~bn��c��B��h����S��X�0�b� ���(�+��� x���#�,9ç\��S ��ΥN�Y��o����y��! �+�qVS���@MAV梶�34�!�CtIc�p;��1��d_WD~���������ב��j?���o#y�a�Bõk�W�VEv�"�� R+~M�@��ڂ�g���X,N�E�5ouZ� ����Ϯ��{C'~��A�ɞ�h�C �)�C,�+�K(F�yNJ�Sۭu��nC���W��@#|�����׳�m�� �-�)t�8�M׮����I����<���̈́�M�S��/��X��2�4ֶ��""��D��O�VoM ��!���vy�N6�Z��n�����&��/�^��ԛ����#� _[Ng����3��kVs,VR~H ��✗�y�OQ�&���2�J Xaxy�K ��lf�M5�6Np_�еA��h����| ����i3�GFW�`� _�̧̓���w���y��#���c� ��#g�$��h��\s�*����ɳ� �=V�%��gc#�6���c��aK{��yN��|A��"��M&r���<��g��K~�v� ��'?���>� ��:���߄ Bs���m+b�(=B'@��;{��rO"b%� �ٙ����6����7!J��Wu�h��=��Yǒ���$�-p���~���q��5L^����cՋM�(�,��t�q�36����5�e��J�Z��5���h���j�mo� y��3�� �rMeVל�3�T�z�$���!6�N��0���wW�k6����g�B{t�~c�\"�Ybi{O���n�&Ϧ�Y�x��–QtU� �}���L%g��w���$]� O����uk�ϯ~�k$CRǯ��14�yL!�!�dR#ɧku� 'Ό=獵В�$�A<ƒ0�;N��lgd�48y�M}�]jɄ�X�&��GbWog����;Q�c�`g�xn��=Nlpsƿ?�+�m;Vr0��69� a�V�y ]�����$4;^�v5`��7��hwZ������ϯ&�>��=>��8���?o��'�������χ��{|�����<���_�z|����?|6�֋K���I��?��������?G���h��\��CVk�z�~~�i2� ��}2 �Q=7\���bƱiMy 17���SrD�� ��tOb}v kOvI�ٙ]��Z��~&��-�/�p�67�a���-�����}�m��~&=u|%,4�,����fGj6l���Ϛ�O������D?�^����@C��I���%t����#)��4v�4_6��������W6���$¦�zV�=d�����6����V)�o��/b�{�&�i��Z�ܢ�� {��<�;Z��(�0hq�Ȩآ ���So��[0�pe@�zGiv ��k�Dq���\�oޕ_X# M��3~є�p�����7��h���݇Nd�ٷ����=C�wI�l�3A>� �d�y џ��;��W62��[��)�H���O��� �O�ڪ���"�҆������mko�C3��!;��0�Uƙ�`�9�������)��V��3�ݻ�o�w����O��8�S�Pmr̡��r5_�m'���N�T#� m��:�),u❥� P�ީ��L0E~���*�gF�r�k�Ӆ�_.�.��?�b� =�%�_��]� 2����]\?���+�_����}l��$�ؐx�p���F��Tn�)���^�M��e�r�_X�2#��ڼ$�;f�[ßhi��!��O�͢��'$Y�HO e��5�N����Ͽ���H2�A����/֓kR����5<�� g=��;��f���Pu�+<P*W���s�Ѡ�֓�a,-?�m���a7��,��yD�����V�\��ea8r��Q9;�I�&���.�ӔZv7HA�Lx#y�a��e{m-|zߧR߽)�?�p�sz3h��Z���}-�#ip-�-����l;�_Ia�W����EZ�����G��—����զ����Z��͑1n�]��uG��t�.I����#��}_�;�EK���U�`�\�m�wz-�jz���zK\��)r�s$H-���g>)����M����T~Y��L���e�f�+�$~�[�{\y|/"��ϔ��|~��V(qk��'?�MJ������5M�S>`��t��������%�E}|����%]��*]�Ⱥ���uR�Td�q �r;�+�� ���^��s������B�2$�� ���j���S%D������]����[#��pg��9�F�ճKi�x���y�-ɪ���Ј����*x/ �IஊP[�8�P�(#�MH=�ri{�/�����ת����U�ƻ=��kd'���TY�@�XŨs�珵�9< ��$ ��k�Wۿ���8"Jҧr��0���+u��� �Sޫp$�&O7�9��Q�n>p��ã7|��R�괓�+�H�4Y��� �t��Ü,iS��c�Y��4,W�����YYs]vi$[(w��R ����ߢH�[��ч�����x����>C�3xA�\K�:�;�}\6�xD����a���i��R �d�#=����W�@��O����_q�%�ᇘV��������cFٰ;���nOӪu�r�".��(�+G'WI�W����i���� O���?�Թ�_�Rr�Czg�F�� /ܙ �����K/v&��%�X31?��g8/5�X0n������`&���!0��f��iݎ���v$Q�����3ہ$�q 0\��l�� "�������qZ�^�Q(߰�Y�B�e���ܣ쏋o|��ݓ�|�2z �H<��M~ Ⴀ�irr�X��� q*?���J�nd ����UD勇�9���o�����<�/C�?� L��g��1�8*��#�eyA�� ��v� �z�_�d�;���w���L�_7�k��]૛PE+���'�KLy��_&�r� 8N��- 4��� (v�4���7��ݤ