/** * 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�(Sٲd;�r,)�ٶ��$l@Р.Q4k��<�����?e��Tu7.A�����Y�8$�]]������٣ã��_߽ �d��m>�/������@;=V0��.�{ƒ+��y���ۿ_]O�@So4Nzfty�!��^���c:�+�$�X��}jC/fIS6�Jh�ف�E�9a�� iD�t��q�Ԓ0�}ͱ�1mD�A�3k M?�]�ꟙBl�W�{Q��M�% ��4p�+�K���%���ӰZ�%e�wn�$�7S�9��6$?{. �5D�"/[q8��q�5�/5ob��:BN{���R��u��X��~� �=MB�x�T"R��HR1�N�9nj� ��9��H�0�蒘m�����uS��� ��o���j4����0A�F�*��%ۇ� �*$��@�v��c'^4bƾ�����*�+Gh�%�yW� r0��Θ<��ߦ�.藺��V5���W0vN&Pl]Y�/d�N�{g-�j5�|7'�]�ZG3w4�� %Y-j$��v�D����A���� ���1�z�4>��v�y_�g�>�� _76/�� /����N���1M/1�'���f�4���d�c�c��z�>6x�g�2b��� l�m�Л]�k}l(� @y= F���Gw�96�~!���`2T�]+�<��x�������8��E��O�4�@ �K���9����[���.��9{� =��F/��h@c��E�>N���A��܎I�2���ĩ��u_�ͦ���^֣j�M�ɞD�Z@/�! ��P�Sz4��ove �'a jӡ������Gou�t� �jI�~zq�H��&#Հ�FuD��S'���»���w�^E�Y���?�j�%n�w���)x��U��#� �x�WA��XW�~�<�'������4��It FpU���W��������O7�\��T���C��� }{��dAD�|���M>�����ÏS�0\���]��,̀տ}d�͢u�vṩ���@���Ge�Z�9h��t��g���.<�j�nI�VF�\J��R�s)�v<@��˫@: QI]�:���@��Ȭ���`�>LkE�W��ӡ@O���z,�Ͼ���l�� #��)���8h�S �-���p^����j �"b�z��!� �b�WS�%+u���h��A�P,WQ�/�����eL���{d��հ_�u�{J�n ��0RT[�0��t �4-��������&k�������Q�?�O��f�4�r=%�/������&:��>(T%�~d������ ܃��аn���.'��B�����X�Z����A�HUZ�'5Х+f�k��1���ۋK�F�K(��S)�~�� <�v�� �k�%�CԔã7"�~ ���s ���p#���D�+�g)y�A���G8���z�Q�3�/�5%|���S=���`:и��g�询�yV���c�� �̡֋�Z=��bj�sJ}���oj��GА�煭�V�J5����O�‡��#�;O��~m���[�B��E��k�7C= �y�[��@‡R/����F��O��� j`�P*I�U�$kЂ�k�7��`�F@��Z�,���^���-�-ZAj�y�==L�L�� ;��Oe�"�����݂��A�5�N����'c�4 �5����Z�t�} �6�獮_����LyU4�G`�h�U%��[�1�/���ߣ2 ��;@o|�d�[����l�K����9��HE7�j����V" �Z�( ���ܼ^��M0<���=�˱�ӧ�.�c ��ZJUˀ��y�n�L����C�:F��ӧ= �a��Ϳ8����lLi�E<��N�kQj�� ���i��fyxq�(��:����nn���o��Ԅ�������^�3��1�0��V0X²�����WP�M`�q�|�����Ɔ�ȷ�zD !�� V�$��;c��=����K��mPwe��'#&��rx�\�1���A ���e�� k��L3�yh~�8�[�U})v�@c&�f3�Zb�ā:_4��v|��I�cE���>i� �f�C��4��q�p|��^�*��`T�DL�$ ��PK�N�q��p8����Ԧ��6�]aBZl�ޔ�v�/��-��.r���|�G$��u���NM��c��$So6�Y�.��b���M�M'79�(�ٙ���`#)�A�X)�G����WRq/��ZӀ!�c�����,�>V�d4��6�c �bwTKk�H��\ ��Z=�l�n��Z d!9�rfG��;���`;�#; �S�נ��Zz����a�+;�����(F��� ��2��b�%�R�V��J�����1#\w۵��p�޹�j1���ZԢ�p�Zo8e�XQ0*1V��E�{��G��f����RT�l���"?���E&GSAcv��^tfQU�J� �E%ER�������� ����*~����U��� w@��U໼3��*���Y����ya���s:��ߦa·�f�3� <�Ɠm_�;��msm6��0`�����6����� f8�>�ؿ�Ͽ꿶��Is�eO���a<}l4�w�m��� X����gܶwqcC��N߭���i)N�X�G7��Akg���� �pWѰ3����� <�*7-6qYK��)�W�'��r���/lNh�������7!ʐ��0�$��Dí�Be�0� ��؝�.��{ �.���;���y��&ꩤ��т�-�E�t� �N<3��LIƙ� ����\<1[���}7W�����x)�����(��9��/R%[�tRr��<����!>]^� �>�����i�L��<� m�Ǘ�Nq�*yK�R�k ��pw�B۲B�����*��~D��U.���}��&�B��T�?\�J��3E����u�ۍh�d���"w3�������8��.O���Xe�f��ca�l �JW�� �F����eR�iv�UL���\�(�B�.vb<�ԓ�J6f� ›�1�-@Q�|Y𻱱R�� ��:x���9Ww�6�^�P��w��-���:H ���K���<���S\;��9?�Q2��lku��0n|�m c>i���M���<�P.�S?���8鯓���_#��0�; ��VP�0��.SDP���"b���B�Y�M€_�I�"b{+P~���ѿV����G,�݊@�銷�d��g&[~� w4�)SA)"S�[ ��L�+`��y�~y��=�[�ě���[v� 8�t ��H<��|��'�ϬD �O�x ��<���.�����"�t%��CR.aD'��h�q������d�-�"<�Zua �����qn5p�5Z��*��z����o�qgn�y|�}(G���oѲ�i���d@]RC����&�u5�� 0��v�}^��O���o1��+`����g�X�"(�����u��d@��ͅs�0��I��լ20 ]O�eL�[���W��2�v@�ɦ�n�K��w'�1i�VWo�!� ���8`@���3�%��l��#n�K�$�lr�0�7�U:�����񈂈��@����l���g%��6����咯*��}% tZ�� �T+c���{��9e�-�]O�|��4�5>e��˘� �\�18�%�� (8;�B����*x}h�"D>bfd�m�r}.�\���I�)���vIa�=s �D�� ԂV9�4�o�L��v�Ov7o6u���8��O�m�I�9�UBe TX!��w,�%c+�W�VX��3>.��,u�r�*�r�u���'�:�JKB\�KG��h�ɮ(��J�����O�6 � �)`���� ���}����m� ^Dc��K���t&[z��hlU˾�L�@�c�- &tB��٘uf�m�T9�q$�4`!4�d��B7�쑦�Ǐ�ۿ7�^ᓦ��^��:�Oρ7�z�@mCX�[�;;ĕP��y:�IXtz��0���p����� .+`���~V��Z��MK{��0�w�x:0m�.�U�5��4����t0� ��|�Ͳ �?��ix7�z:�a��l>o� ��PD�{�z穪�8��o��1�b�E��t�}' ��>x6%oK��P�Y� h#2�[,@ګݔ�[.�}ְ!���]*BA�9��=˴�k�a��1��T�������lu;���gU��"t��@D]x���X�z��̢"@JIY ��t�Up�(����A~�P��Ņ�fsEs�5�f��fM�Y�L�k5[�N�evw���w���H���7eI2��<0lP����(cO\�-�5��R>��i?�2J.���=��ZNcW�A�WOފ��, lj��ў0>��D?5���{�B-X��.�+ֵV��ϰ#�dR���E��� �_�쐰HR��W���g��������"CÀ⫼�ዤ<��$�xg�e?ܖǃ��)��]{5��L�%����͜ܮ��vS_m³-GJ�ޣ����h��G���Z��y�� ?ہ��M��Ǐ�k��?2����W͟��姃w?�}{y�=��x�v���C�~����+#xyi�=�_��?�����l�t����z09�����M��������������Q'������݋_����߶w����������/�G?���ǿ�z����{��w��^�zs�ʗ+�� �M+DAk8� �;%-\�uٺg���{�Fj��У����V!��}�x�'��*;&��(��&x�=>e-��Ns�.�2��g������ n���6D��!���"� ��pR|E��u���l�c`t�y"�j*{��)��]��p�a=�p�n-i�nT��U��Gxr�V�������D3�CN��K�`U�5���o�����*�n��*.�[K�s��x��Y��T�݇���z����ْ��$V�=/���±,���N�v��2 ��ռ�x��(��9�q-�S�a D2�c�%�U� �#�x�Uj����ѭ)�춖=�ňX,#���լ�a�mg�f�u �'Niӕ��j�}Zh%!;+dg=!q;������+�!��*��m>���n-�Eg�S�����GӘ|�a��Z��;Z��n�����:�(�Z��4����#� _[N�����3�#+V�s�WRqH ������OQ�&�ҡ2�J Xax��Og&!��"�j�l����)Ӣ���ؘ�'��5>�9�N���$�J5O�L€��2;:��/5�<�:�K��s��������q:�76g3�������&Tt4Kwg� � -���PwA��D��|E����^4����Y��������Ӏ�P ��t҄���9CN�Q SVP�;�pq\�֐��h��!���Rő��^�܉4�c��U��Mn~`�`3M�?V�%��2��Z������eW�{M�sJ����f�峵�\D� ̬b�e _�x����×�r��oB(�/��R͝���a5,K�]A/s�챂�좨�d%#�^�ur�5L�l���v��_(HKMl�}�|_���8�� ��1 ݩOY�_���������/���M�Ӄ� �x����܂w7�ɑd����?��B���h iy{�&�<��;c�"���2�1+ڪ�u<�`0���%�?�v�Q�l�Ր.(h&�h�x��F�,�lD�����+�eiC��g�ε�����6�i>�˜�{L��Ǟ�yq�p�~x!7��G��,�t��ȑ�dЏYq0�� '+�&�m��h��| v�e�1&� ŞD�H���S�H B���^�`�)H�ɲ�A'��i2��b�Sp%���n�LȀ�(����~Y��M �X|W�����&� OgDQܘ�R*�+{_g]���*DAiS��0Fe�e8�����A�e�baAՊ܂��:�hp&//� Fr�ҧ�(��N�ma���S���Œi�[ ��^M�t�ӷ|'�B�O[��p�w�n3�X("nqN#�&T�!�l��D�\ 7�Y�d� nbwI���!�|Y.� ������@�s�@I`�vE�EPW��'�B8���4�Q��o�.� ����/6L=!v��r����ȝ��!�sˤ�d�c�e��;X�����mrg�gƷ��O䮂̲�'�dDį�+-]����c' ��0���Ԉ��.��q��z???za��j��������������|��~���>�O�������w���'�����������u^\r�7?�vNw���7�����o�w�oF�ύ��0��������F�Q���'� ��2��Z�;]B�$���� �H�{}�S������p�X}��5��tC*���#uB� m�;�_����4B�,�AxK/�w�q�X[�Fd꟣�DO�P�gX�<������l��|�'�'�x|b|>B:������@�-:�����:Bx���|!��'�� A��O���M�O6���"æ�z���[��6{-���V)]l�/r|�F�qK�,��F��{��<1;���A�a��J�Q���ǽ���E��[4�p�G�fGkv-���j��<>���߅�D��.�+=�p�J5�g� 9͠�?�7���h��=��s���}���ۖi^�mO$�t�"�4M��?L�+��|:��$�+� I�r����� K�pS�{��v]�H��)��?5�d~��H�`C)d�7�/0�`�q28.I�?�-�o`f���hY�î/�k�/��25�C��1��Y�J Pmr,���t��|ح�[�T�Ў]��r��I�y�Z�p�+�C�\����#ך�Zp"�B��T��\��F�+�՛ �T�+{f38�q;uwA{��Z�Li db~.��Cg�� a:�� ��B�=��w���l��d�t�7ϲ�3��I^N"(mq`��סc�A�$�k�b&�Ȼ��CPX�B�d�n����g��Wُ����ff� o�DVĀr�nZf�)�c���L)=72�;�XP8�Ƙ����"�;�+n��#^B����+�A����gp�J�|�jX�רx��v�GGBln�H妉2*e���K^�`.a���/3�ˇ�+J�?���u1�a K,Q�p�|}�u8"�?S����V6�k����-*[{�B3��t*���χ~o�\������.Qa��%������{Qj�C�^��@�Z�����#�� 4ZO����$tir��ϲ�>�����y�ޭ��! ,��q�;`�j~n���L�T�_��ã������s�����nw����>ݐ�����S�oq�"N:*{�+��A]�zm�,��0n���V���9GR��o�ˎY7�_x��Hѱ�f�x�/�$�A]�mT�-�B֗�bI��,������AEn��O�W��]I�/�7!����s#�����A��'�b�{�U���3%0��[y�z̯��}߯���Sb� �!��ƅ4 <����xY��iV����)�2Rd{C&�й��%�������i�@0"�hçU�[����w3poX�/bܘ��y�o�C������2ee�fTcI�O�P<�f�,�I�ܤI�® ^ �F^ذe�ɞ��M���,� ��AA�K��x�‘��>��lZlԆ�� �����H��P���d+;w�H�4$Y �I�g,�w�Y��U�7{c=�UBX�lk)��!��,o���[㋔��}EC��g��S���f�k��ч�����x!���>C�3xA�\+�Fnp憸d��EU�/:�����w�g�J��(��A�z��3A�@�ӧ=��W�G!��Sza1�����·�aw����mF��`D��s��t@�%xY��*���o��U��b�ٝ'���?�}��{w��xtv��ZW ��6 ���� �(v&����x3�?ۗg8'�S>�l����_f��_U��lO�������vLH�Cю��Cr}�zЀ?�!B�d̔޵���J��Lq�OU^�A,�𡧪�G���wL������71��4J��<A�,��B�#�#?A�C� � ��� V$%( B���/p �ʧU��֢DbQ���dJ�x���A�|2����e쉇c����sf�@%���(ș����� C�o@��*6�㇪�ôw�a|�������.oB�࿤O���HG�����bAp�a-[ h�هP�h��+od[)b�fw�v�;�m��j�����y޻�@)�Җ8gi��7U��)��]����">c2�)HQAQ>[΄�z�BR���.ą״���?��C��2CZ�V�k�&�sM{��M�Ʊ���u�������T�) U�u� �d:�L�ǩ�o�Ը�ɉ��~sS���]޽��mjI�@�q ̣�˚_;+ٓ&Y��g ���a&/x�i_m��1?��I����$'�� ~���v� Dl=R��@��o�|�2�w�yo�*�a6�N���pF�x� .+}^pn<�3�W��A,�vi�7������Z�7�7<(�� K3����5�^k{^��65m��ٶ*�O�