/** * 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�xe*[�|Ib[�%%;���@�� Jb�����y����?�|�Tu7�)RRr��ő���uuu��������Sw��!����� Өi��gQ5>5"�R���k��'���~j�Ÿz[���F׸���,P^ �1�D�Ⴢ �}����P�T�_KЪ�X�������,wf#�/K`� � ��� �������9�89`.�݋2� ���h4�,4˚#{�� 3$��t/I'V�֯�p����u4 п��(��T��)<�Ӡ_��%9�u��tg�xT���E4��I쇠6<� |͗<9~�F����h^���Ћ5Ar77)��4�5����j�5M�dx7=��{���wWuH��S��Z �Z}� �\��Kmah�kTOX����j���j���c<��M}/��,�H�R0�y-�WP_�Zd��`~�?��3�G���-�(i�c�/ "����5-�=5?�FT}��f����)�R�a���#��������T��Hr��O�9k��aK��V��{6r���3���$i��s��c!���Bo���{� ���u���F0��j�����Ȫ� zV룤ֱQ�i��t�xЏ<�G�G�W?�J�W�?4���ӧuG:A{��J��ў�G#��z��Pk������ �� ^�;���-Y��� D�?�h �dؒ|} m���/C�� ��y��vS��A�T�9( z)�>�@�M㛁��4�4 4:����u@��r��G���H?�)S���c>w ܋����Qh @�*(<�#MvT �U���gN׆�uS����?u"Pn͇P5x���N���$9|�-RV�Y�Tኣ�5k��ʀ����ŕE��%D�ɔy?A��G5m����Ɖb�!j����C޾��x�\C�EY5�p絀,���iJ�}���F�R�0Nz�eΨ&��/�V�A�'А�ͦC��Դ��U�?�r�u�VO��j5ߩ�S[ɧ�:��'�\��Ƙ} y^ڊ�hE^��T�}x��)��w�xg�U�ϡ-�3uK��oAѠ���H�������I��� Guy������g���x5�@( �$A�*G�5hA�5��_�n�y# WE�B�ZX��q`Շ��� ����^�� ����\�Aކ��7��sFBPT@ �n�^sU���Z$���������k����g ���_�6�f�nP���i��̛�#0B4ݪY�Ƙ�p����QI��7������C���o�y@�fA�Y,R�Ō�����V" �Z�( ���Op�j.��>��,{���*�O��[��5�oh))T,��j|�!۾5C�_�� E�q�ϟ�1��Q93��@j� ԣ ��q���?�A$kCu_eL�bEQ2^�lf��y�|b@�l`�T�>��am���R�1;�S>��0��1�F ��rKX����p��DSk�e���8���ڲ�(p�y�p$�3� 6�xr�~hӰO`���u�D�]�-榈N��,WeL�p�x}�Mպ ٠�����:cS4u��8���Vr@_�]1�(d�l�s5+��8t}��:�� 盛D2Vĺi���F�0 2&��ƌ����Hq�]�B������Y���9j���]?�?�F{����4�ݦ��MH MۙE�]� ��rƃ����(6��;���IeA�[5��A���@�X',IW��f���!&���U�h��M�5Jv~�y���H�dN�*V��iz̢�T�}?�V`'�`��(f@�02��>3C �boTKi�I��\ �TZ}�l�n2�X d 9�rzG��;�ݕ`��'� �Sc�W���Z���~�a����̉&�8D���{V�A~9qbP)V+�l%L`�T ���۳�n5܅s��JH��<�F5h5�;����"Q��s:���*�11��"�py���Q�V�;��a{�p�j���䕒(��Q[Y�p硵�n�.����E��a[�e��,��\���_*"�6g�i���l�t,��Y��z�+FW��D{��5�ݖ{:$��D״'�����h�ո�~M7 �잖��dC��zS��z�I K�k���<�e-S&�e]���If�`Mb5�)�C�ʭ���8F�iU�s$��VT�������:������o#o���4/�p�0wΦ+ v[@����9]� ���:1�����4`�����IҰ0ho��i@�Փ����Z����ɰ�2�H��qo���h95�ᛳ�[(� ��igFi�6���vB���cm�g��5Dlʺnd"��S�w��r�D[�m����-z�7`t[�vF�g0�d�9�X�pY�[&u�!ԃ�(ZM]3���F��MVٺq�M����*2h��M���`K�%���k�L!��� ��R y���*(�� �Mg�U�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ɛ�儆��:��RF.��_����#U0�б�0Cߞ���t��o{7�l��\������܂픆 ��>�-���v.����{��1�� �0a9�D�t(q�l�E�z2�ZZQ$���"8�����sL�i��ިl�hRV�����V��Ʌ֖�r�����Ԭ��\�3����V�HIk�I�+p�Q㚸R� \ա�zx+��N�G�w"��VQ(�4��^*�T�c.[fٸl�H -�wS��RK��x#��HF��˓^� �`� �Cdm�p"�{��`_ϗ܇���>���w�����^4���_��x�{��&��������O�6������˃��; _����>�X��mw�|�v*��e�'��� ����;W�F>뮦�����(���;�X�nY0��2w�_����b�:vX��p/��!�n{\��p?7�����/><${�l��5��������Ъ��{�Q��2(/2܋�"��4������Ze����0憘��y��p/2� �U�{�)�����܋J��?[7�&���- �� U��%�; ��l����wug�WU8���&N �)��|� Y�t溿���m%M���x��'ݾ�v���f��ı|/�ﮰ�]��-g�-dQ���!b�~dNw>xc����AKӞ�]M{�Xk���m���DS��K���q��ŭ-�H3��nŭ-EI���p��:}���[�{�p��@�i(���F�Qw��c l�R�i���Z��H��r,�����_��9�5�bl��ۄ(B^H��š�f���(;�VU�L�����#�W2y��5��� e�sB�>%g?���iz���Rw@(��̙g�`���IYI���u�0�; ��VP�D��]&���-�e�3��!t�bg�{�� F"�[�������b�7>b��V��L׼q% ��D��' wW@��%ԑ�3��@�I��L>O�/�Ѹ���J� �?��UG��c(@��*�ĽY§}���LK�@�t�7��/�6�pq��� (��� �p #:~=Fc�+B��/���@�\��oH�C�U7�`�;л F��FS�%�/l'>��C��-v��'GЇ�a`��$���3�c�_L��&5��L��|�PwP/��m���g�;`�a��x ��c�L���h]����W��HZ_ȿ�}���Zh뿷l|�b�S30�(ʊ1�f���?�֙�ȼ@�*�*� ���ϝ,r�-n�a�"-q���jt��Q��Ka@��>���h,���C`�+/G{$gdatE�A��@m�� T6ڄ+����z�Х�L��\�Fve�>�%�^�@�[y�;����=�'��1ռ�Z����5�N��v���ij]~Hd��LnH�/�<2��@[[c���Ӄ��C��J3Zx2Q�^�ks3� [&��� ���@�����A�6��) �� �=_t���Մ�G��@�H�s�g��9������� XR������kI �i��S��� �# �� kw�� ��,n,zL�|��Gr3�c�$�.���İ�Y7^��Pgb���~��}���ܥ� /7��l�F��А�i�*�� �"�6�c����<pp�M�ʤ�3/������oTC3XA�64S�z5�?!/��I�Ʀ �s?!>�6b`������fnNnť�X�Y*?v;�)(%F��ĶT�tg�S��O�aԱ��E���/���,�Eԡ����.h.1Q!.�!����T�j��vb�2�x�u�Ca$��q<�\W0P�n��-��q��l��|����lF��GS4Ra��Z~چ�|6�����rc*�lMi�J��|>� P�YZ�'D��eR� ��"����b�L�_iR`���٨΀ ���E�d�T�a(&ߟ��*-�q�/��*�]&��Ȣ+�=w�П&�chF�S�T�������\����m�� ^c��O���dZx�?olU˾�L�@�b�-�tJ���*:3�V�U��,+ � U��}w�z�HQ������Oǯ�IQ�s�ǯN^�,�g���>����t��z���� %;�fE��b%���/Θ9�w�Wij0h���&>X���d�l�2�q���g�̆�M��t��7�R�I�JLq$U�X�ڣ�C��޹�xY�”!_�$S����bjo�b*#("��l�gJ˘��6��=W��WH�qEѺ��:��~����V_� zK&�FS�O�s�ͧ@��B� �S���{�aq�Ѡ��h����Tő�3[��J��c�1T�e�bq���P�f��Ԓ|􋳱�p�>����c���j^Pb&_�*�æ[�Ʉ\K,,C��Ù.�j²�l&����` i��&��7Y�������ڊ��H���R�p;V����-�T-����廀�hC��`�=5�\���@��f *�96��?�oS+Hb���y8 \S~���i{�L̐�"����� //$/\ �Z"���>?�J �kJ̃���,�W:�1j�<�/�a�\�xK�0I ��R �1���p�`#�9A�(h&ol�^<'l�*8z���ä14Ry�!1J�/N 휳٠�v�H�Sn ؁���Mh�P�4AC�x�+�p"|x���)q�3�� n?!�6��L�����uà���:���o?N��n�2��h��9Wv�X���ǻzg/�] �������I\vh���05o�����d���.��^���ywr6yq6>8x���_N~ƿ/�_�ؓ����}{p��<��^�rr���/���]�����x�l7~�}7>��?�W�hG���s�{8 Y�=���Y�E����x<���,��t 3\���%ČcӚ�r�$�o�=%4�)�`�Kw��wa���d�$[��53����l4g������R� F������]�m��~ �=u|%,4�,����fZ6l���Op�O���������/�"@X�!����s� :Bx����A;O�/��ӟ����ȟlPQI�MY�����6�/l��m�[�'�R:�(�_���-��?3T�Ag���y�w�޳a�a���X�Q�A�����0 ���`�J�t����J��j��,>���?����.��_ZC M��3~}��A��n�c� Ё�����Ț�/.���{����~�mN�d'F����-Dل(8��gQ������L�D�?����%d�4��V�~:i��ەwg�n[�*Y)� �1�%���2�\�%ȱ�����μLaʹj���?�ڿ���?8)]���Պd�j�E�r������n��7ܶ���fh�O��l�s�X-p �$��[-�;�6�k� G8OW!��G]6 �� ȒU����� *�o_��OM�(�]Ҟx����&Z��K���Yo2C��D�b;c�t���:�q&Q(�-����t�@��RN[ Fs0ĵ脅�!1~E��τ�y痤p +X����͓�2�U���u��D��覰�7�"+|@�z�43���Vv(����-.���m0f|�����`άz�+��v�x7ȼڿ�wq�W��*�|U%���9��ሏ͍@���RF%���[���������eFXy?�yIv#�>��6�?���CT�;�E�� �3��Ӆ ����f�t�������Lk$�� u�Y��w��5��I Jj�r��]~���R�v_M�\c���(�����9x��_�F���0����6�C�{sv���,���k<�ѿ�;�ǣ�eY�\rlT�ND�>��ɩ*��8�x�3����Q�:�H�n�/y�^G[ �^������n �O������d�螥�o_��H�_KKm�S#����s�/��S�� 3�����S� ��N�$S��n9���*�Ү֥fsh��z�������P�aWT�����-�u�"������{�y.G�e�:��A5�m�zM�%���� ��%��\ �3������&ZA�k*�,VG&L��[+�Em?G-�?�<���@�g�du>?�u+��ٴ������&�+n�����&����a ���U��_�����]|���gK���U�X�u;� 3⛟ 9�����*v� O��#�A�V�(N��>̼�!�S��e@���'���J�0��g�� ��\�F�m�ƚ� j��� ]���� ?`�1Z�U#5��ҡɳ�%U�^@T��͋P[�(�P�(#��I=�ri{�/��ɽ�ժ����U��3��kd'���TY�<�XŨ3�珵�9< ��$ ��k�ƿ����8�Iҧr��0���+u��� �Sޫp$�&O7{9��9�n>r���㷇|����Rܩ����o$D�����r�K�`�aN��)@ձ� X�xQ��+�Z¿x�����.���-�;�n'�b�ﰀ��-y��������G���� @�#�9��~�%z����>.�A<"�R�� �1F��h���d)�~2‘{����+���ځ����H᯸C���CL+������F�1�l�D�~��iպ�Q9Ng��f�E��y���6Zظ�������b����ܝ��Rr�Bz�Fד� /�D ���}�K/v.��'�X31��W�8/՗X0n������`&���!З�f��jݎ���v$Q�����sہ$�q 0\�'l�� "R������pZ�^�a(߲�Y:B�e���̣쏋o|�Nh�YMx>�N�?���G$Q�?~�&?�pA��499N,O�S�8����h��7��S�y��*�����F��Wj{���d�Ǘ��N��#|̳z˜lG�� cf �k;t� ���/Y2���{L{�i�����ܵ�����M����� � Q��ױ�\,�S��bKD @?���<�sp�t;OȠ����ns���:�fa�Q W���%�}\퍭�$j�H� d��N�hp�� ?�Dޗ�$��\��s��y��~�"�=� ����Cv���.5�@Z���k�ƸxM���M��2c���u�����SJT��!��u��x :�t�Ǩ�o�Ը� ��~s�03ú�{]Q�Tb?�fcA�Gq�<��Z�'L2Wa�x�n���>^Y�HQ��~OCv> :��)6g��IN?9D�*yC��#S���$?�:�P�}!��Yd oF9�g_ Tt��0::�K2��Z���x���0� �l����!R<掻wC��o�����V[� E�����}C_��mE��?Q i�ߣ