/** * 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�HS9�d;�r,)99�G E6 (P��Y��4o��ޟ�_2{Wn$H����5�CU���v��u�GGLJ���{A�����~�_ij�Q_��vv�`�����3�Qͳ��]O\_Sw4��Fxu�.�y����#:�+�8Y�^��6 ��_�2�0�aVR�<�Lߊ�B�YJ���sm+v�1���ă,TI_9F; /�Ȼ�%���4���id�1 z�%���� ����� �۔C[�� Y]�T�,��{us��8�R��XBD3�+�ض�� ��DT��A�4�Wq��ua�>��-y���������m}�����v~�I��=�q��#F��ZX��E�ҕ�~����e-�F�!��P��X�?֍VM�5>�;�U��XWT���� �� �����@O�@�S�{��#��� ����#�a׷���t?3��1hP_��n�� �۵N�Tnnz��G�t�22t=J�=�6�>����h8�m�䊫��� +"��T�K҉]���8��ͦ!z�S�b֥j�N�ɚ�݊O/� ��.,oJ����M�Q��ID����A�J��tr�������W�7�{��nnR�ah k�f���{j�]�Ux�|�����W��U!��N�Z+1��՞�</�0�ȚUhm�I}(n������'q���*i�����2�����C�馚)x�(�]��~������g���,�h��Sg�a��p��8R}�qj��m�#R��`�X��GF�Q�3�r� e>K �T�>}4�Y>M>�v'�l�[�gZߙ�����ϥ� )��z; ]��*�NB�ANR��v���1PJ�2�z#1Y��Z�F�p�t����<�G��7}��+/Xމ���SF�!`��}��{�����8��!7� �8*�7ծ[�dp/<�[E��TU���b�C1E������ۗ�c �ެ�H���A�b��9( z-�>�PQ��D}���aB4u�D7i�D/ p͵��u��~��K��$��)�|�8��]U��Xd�A�5P"x�G���0,�A�@}�p�z4��25�����@����E�s;��)*�-R�V�I�k���5o��ʀ����ŕ ��K(��S)�~�bAn�r� �k���CT���7�""~ �=� ���ދ�j��kY,���Ӕ���}��CT�z�Q�3�/s�%|���=���qD.��v?�����Y⻶���u@�����Ԫ���Ss�S���wS��>�����\�e��_���i��*��#0B4ݲY�-ǘ������QI��7������y���o�y@�fA�Y,R�ō�����2G�BQZ����k����ó�ڥ59vx��¥|� �|CKI��`�R#� �):���d(Rň�|����5 ���V;|l�Ɣ�;�u�;�4��1�� �1���X2��l~�g�N]6�Fz���`�k�3(�/�n *�jŚ-� -�j!3�uv�Sw�^��Q�+���IMZ�M��S& ��#�C{o�Xse, ���=X^�+�BT�� {�Z�}��䕒(�ߥ�1�W��C���]R':�F���{��A�e����s�~��ۜ�%*F��Б�V��͎j�ը� &V�VK�5 �Y%��?�.%=��v^���W �:0���S�j껪��o�^b���Z��e-U�Ԁ�-��e�F���6x�XM?GJ���;j� �n#�QfZ� �.:��`6vU�f�=PHS5�Z�����C��V4Ѹ;����;M��Ċ�ٜ�&V�^��y `ŀ �I0�l �h'iX����i@���vnU� �$�w{��Ue�m������9" x�� j�÷�W�P@,��ʌҚ-�W%��8hIW���6�Lٗ5Dl��af"���S0�̌r��.���Hs_��o��69���ݓi�c}��e���0����$1���nr�1�\30�� �V3���/��U4TЪ���oB�7��ZKj/�� ��@ 1DBå@�b�3�UP|9"��*���i.��в!��G�aB�ٌ�dH���;+@�b��oa~��� f�\��F���d@Z5�]��pM�-�[P �:�?�{p]%�_͜�Ť�Ci���.�h�%���J�wf���.� �j�J�X\k$8���è�)`������ ywP�{9���\�5���G���#+D#��H�(r�"� pfd�u:JǷ��|6~h�b��!k�N�-��Ni�P���%�J��z��9@3� �#KDN�bN'>+ד��Ҋ"9����U ��cZN˨�����&ekc�����o刘\XQe�(���|8惚5��+��Ak��%8�AҚxR�\iԸ&��Wyh��Ҳ�����H�e�Gkb�+�T�c�/��"�q�f�Z��h�J-�+����"%E�����^�{Op"k�����k��z��>6�0��v/����F��yu����s��47�g�mm/wR��>1�/��^����������qw���o��;��;P��/�?��}�]h��wݹ�6�Yw5��|՝EY�Gݙ�R�t˂A6�����z` ݵ#ֱÒ5�{���u��Յ�1� ��}U~��!�+A_fc��I���n�_և�-U܋�R�����"ý�.�[J3Yjxz �U6�� cn�i���k �"��)�Q\5��"�Zɺ���$HJ��u�lb�:�R�q~���_��p��`���:��r%���� �����"�2/,6ސEN����4��V�T����x��k�vo��a��Ʈ�쾻�kV�r5�n�q.,i].�$k��>|�X�0p�‚�ꤙ�p�/P����{�IY�Ѯ�1��Gr���Km;߉�Թ��9gc��p!����U�W��[[ku � lP��W���su�m�ɵ%�yG9��^�_ dps��ޟg���E�cE���!J��n��C�D��La�WCڅ^�Qk��@(���g�`���IYJ���s����E�+(S��b�)"�{Kw�x���,v'��/��$���(?`X ��_+FJq�#�nE x�t�{[�p�3�-?q�����������g���0}}��_�qyk��&��{��R�P"�nbU��ӄO�]𙖘��o`���ml��.�/BI0�~vSH�%����� � �?���ׁ,�oE\���T�._��w�w�/�:N#�z�c�s�_8n|�����^��m/�O�6�%�Ю���{@���=x1P�TP��2�� �n�M��I� ��|����i��yy�?1_¿�X �r�/}�w��{_d}����u*3o!���^���aM��ϭ�(;Ƙ����?�[i�C����c�^�8��d� �u�p$�r�uɛ��4jf���!����8@���s����|���i�#L����'c�a��@m8T>ڈ� �������J��\�V4~ �>)�%�h�@�c����ُ�~<ւ���U�kV�~W ;�Č:i���U�!��S7�!��s��H�#mm��� D\@,Z N��/�l��E�z5���(l���.e_K�����U����8x��)Ks�%D>�5D��=��;�K�\/0��%��(8;�F������9yh�">������q�xm!�\�ōG�)��4{$7��:�R��bjA ��wKԷu&gc;�'����mj�r�#�Nx$x ���ƚCe T!X!نv,\�@��8�q�'sUR�[�����pT#+\� �X)k��=��H�@�$[�ӊ�����Q����璦^Nnͣ�X�Y*?v;�eJ��5��-�1�g�Sk�m}�f#�;��l5�u ou�`f�� �K GV��oOH'�2%h�[>톟���;^ m�Pi�q�H%�% ����~�f�v6h� ���z;��k���̃��M-?mCY>�Md�Xf�1������p�%ixI�����Y\�?'B��ˤ��e ���� ��Is�K:�>*�,�� UY������ò�8��M�04W�y�k�,����f �irIJП��'L����'�f��U�n+�I��!2��ݤ�N橥w����V�q�7̓ �qD�qK���}�@��� ��A�C�m[�JB�R����uC�iy�����I��>i�~.��������� x��gu�6���(��C\����'3���A�'�� �p �I���vY�ge��e�۴�WH*#{ǎ���Ʈ�]%YEM%�em�&��T�,�k�����>Û����ԓ� �a�d�Y�����"��3ǽHT�đ%~//� /+�-�֧��Q�@��bJ֖ =,P�Y� h#2�[,@Z�ݔ�[��}V� � ��;T��.N3&����a���C���9��? �������i�wd.�"� D�V�%����~ 㱲�S)�"%@JIY ��t�Up�'�s��e�A|)Q���e-���bk\�Z^͚P�fz�l4��N����u���(��w2J�"�ĉx`�0��e;��(c_\}-Ե��R>'�^?�2J����=�/[,c�� �k# �}��D/1���{� �Y��.��ϵ�\�c�F�%Ȥ|�!�h%-r%���!a��$�o��;N\=��|S�E ���7Y×@yB~����^��u~�%���v3OJv��3�2���XJO/72r=A/馾نgK��ĭF�sG�(�^�Z3~]���3r�����|;8����}o�!>�/c_��?~����?�W������H~t�N^5~��_��������4������;�.�X��ً�ϯt����$�}���j�j���׾��~����䌲���7��˟��y���:j9���(�{뗋w/~�8z�����/��˟���x����G�����?��ş?��~4{����/F@� p��W���p�PwJZ���y�.$ /�� ��s�G� ��7�S���@�[����O�͕vL�Q(M�z|J[��]8a���r��v�ne��6D��)�!.��B�s��`�E�u���l�c`!t�Y"�j*�?�)��\���p�n>�p�n#i�nC��u�:@xr���������D�CN�Ӌ]]Ņ��������:��6[*.��H� ��h��U��U������f�E�Ĺ�I�-�{^<���Y| �������U��٢�x_�(��9�q#��aD<�c�%�u� �#�x�uj�����m(qq�ʚ��bD,�~�z������a��:�������z 5�>)����������}�;B��e�ːC^f���2RDD����#�s���]S��iD~p�]�֩��ރ�!�۬a����I�p(J�.4�F�v��H���Χst����ف�5+J�9+)?��x}q����ۧ��&���2��@����d�&!��"�jLm��~�)����s٘�O8��i|s<� |��Hҕj2�+�>#|u�8:Z�7��<����;�f���8��Ō3xk�B�؀J �8q����yb�-��N�w��+��ĭ�{��z���-Movu��sL�f?�6��d0#�� 4�"d�j>e �����y8�z0��+ei8��ȝE <�ZRYYަGN��Phc��L-�ψ 66n�_�z,�5e�5�.(�� +��g_���\�.�J��ʼn/����;�F���g���)�2��/�)�e/�A��J���"A^׌�9c"��� �s^����}P�mn��;����]cs��ЪD�?%���މX9�&� ���k_�\��K0 ۦ�@��?��+:=�� �+p�8��Ȏf@��4�͢��� ]� ��j�G.�_EH�T�4�h�k�/t�� rqi�r����)��! p�z]�ͣ�WJ�s�;ߜ�����W�a��\��'�餲�}8S+��MU ���G��,r���G/����Y�qI��������W�ͺij��W��+��Bu�d���s�\�au�f�s�qd�_��M$�&�þ�� .)�Ulܴ�?�W��ԣ��T�����e���|�����6�?��B�cw袁}-� ���ER�tq_����:�9X�F��+�Ҫ��|�1����X��+q�">p)�a�끏:����;�׋AF]�%�@l�V�L�{_! �":��� �ąg���Z���R� ziP�����{L� ��c/�e��a��Cn����"�{ �ݭG�� ɯ~�(�NE�I�V7� � ������Q���`QlO�EE�)e@�~Ao"�.,��)go ������A��zI2 s#�Spg+���\�� twa��J��A3w��O���?f��%� Og�R�1�RJ�+�ߦ��� KDAi��\=��{�8�����A �*nNՊ���ځhp�5 .� ���ʣ���v�eb�����䐁]A�$�-�k����4��'��`?y˶*���X_ w���^��D1BNC>��� i{�Lܐ�"ɤ��� �(/%�/B ��Z"�$>�+���osK�kJ,��<�7:�j�<�/��B�xK�pI ��R �q��t0q��ʂ�L�4�7��.��ѵ|���!�a��<� ����#�Zj�O�x�#q��(Zb[��~u �|�� �&i��hss.�H���JB��y���_L�Ry�ԏ3ṕ�4FRK��w��N�. _���#�b�7����'�������e�+a�|�'��y-lEW%p�P��gvnd*9��G�*h� H.w_'�0���(�k��~t*$�Q�_�=�a�0��r8E%���a� P��F���KOn%aI4�PD�`|g����2��)�p�'�6;��� ��K�{w��̐����w�ԉ����*,�܊����ֹ�����}Ar�Gfն w2J��M�8F� \>�B��rL����G��M������K��W���ޞ��_���7���Ӄ_���E����ߟ�zo~�N�<��������������ÿ�y�w�?���������`t�\�#^k�z�z}�i4���}r ¹a���^�+�-{,�G��L<��r��=.�ϗ߅ݻ��I6 �Kd�;R;p��ςQ����!��l"_ � &���K��=� jiЈ���p$�S7ТB˒�M �ave�f�.Fx>S}�8��'��'�Q���D:��ЅK/�W�� ���� i����YM\���a���5 x�F>B8`s#�FJ7�̣R�_� ��%.�]�^~�^>�Q�߷�����[Zbu��#�������}�r6Y�K�1�k���kv�?��fZ!�T��m���;�&%IA������pփ_Ys�o���k U���C�jZ�C;���h��<si�I��<��gg)|hM=��s�[��<�9/ ǑKn����yF�%09Uev�F�l�Բ{5 Z�›�� �P�!�m�k�3��>ݐj�0�T~�^\���me�q�/<@ ]������x̭P�������/?�H�.�� ��� �W���jt,�)@�]�u�$=@��]�J�ڒ.e}�.Vd��rŒ�5E�T�1�|;�U��y����҇Q_27�~�p �}.���\�Q|�*�`:����~�xx^����] W{� �We.��� 'g��L�*�·����<�[2��� �Q�Yj�&5�e��f@[-c�%EW�K��a� <�qk1�����x!r��䵵�*+�ͤK�����c��eO��&IvM�*�7�"�S�G�H��CnR%f�Wx�r�_�}�{����馗�i���惀�9:~s("��B��6����_���FxHw���1t���-<2����4�1� ���)� byR�� $���@�|�Q�n�K$f`U N����ߨ�'ϧ�i$_F�x8�ݖ��g��3�*�F eEA����q�:xz�U��?T���ô����/wmw��xu*i�%}��|QD:����Y.�)�|�%�9�A�+(7O�����ӝ�rқm;��֮�n6 [=R�r��/]P ����y5� U&c 2�|�-�_'�}ϙ �� RTP��Ös��n:�W�yDЃ���1�>�G�x�RQ �eiE�vh��0״��Tol+�pȪ^Wh?�l<�A%�R�Z����A瑁�8�ꍔ�� 9Q�Vonr�bQռ˻�� -bh66�y�C��~%{�$s����.�x���e�4��w4��r�3 I���I����C�_#���d[��'�j��9�E��N�c>�ͱ�@�4ꍶN�l8#S��W��+85��e��� A3�4ĉ�pq�d�W�-W�n�ni����hu��n��(�7ۚ����:~�