/** * 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#��L �h=kp�<���q���ޙ���33'T� k� 't�me�8Q�C��IA\s�q>Ʉ���$cZ�\3�&T���!hұ���i�%���OZU@�UVH���E�Ș��t���N�1��:�� Ta�DXg�ì�d�P��S��W�� ױ���FE�]�\�B� �#4�m���9��CkJ���s���Ԗ�7�1�7����6���6����BV׳�;K��Z���#AIJJ�()QBH�) �Rp��|u�"aN�� �ޘ^ƍ�湙z�Ʒ�٣��'�ȷ�� dz� ��"�3��sLc 3�Ȑ\K#3���+ ��z����c����#TxH?6X� ��jj�c�k\v�� I��(��^�����AA� ���� �}�* �%� `F�X�r�~D��x�;����%0 ������Î�U ��fT���L�������I�P�����Z}4�{u͑����_�d����F��qx����u4�g��(�T��<��`P��9�u��t��h\���F4��q쇠6z�A��/�t|�V��/N��U-��o@/���ܤ��@֨j���{j�5M�dx7=����+��R�'P�����.�<��4��м�Qu������4~w�.O���� `���GE����=7�rG��?}���Y ~�Z��:�ܳ�{n�i5|�$I+%�.� )�z; ]�eU �����6��T�#}$Ud�DV�F`гZ'���"J����y4D���o~����\d�ǖЧO#�!���Y� ߣ=����)���� ڑ!ԩ��A�p)vp5�[�T��a����4ɰ%����{u_��9��W�G�M]��5SE��$蹰��I6U���RG�HӀ�j<� �n�� �_@�k�k��4�k�LA#H �S���q,p/���n�F�5���D���4�Q1HW!j��}0u\�M��߅�̉@�5���E�s;�6��h���HYX�'�S�+��׬��S(*����t�/� �N��� �8�i�/�A��NcQ������5���3��z/ʪ�;�d1ח7LS����pTP+� ��g_�k�?� nU&z I�È\��v?�����Y⻎��i�Y@��;�zj+��\��Dunj��GА�祭�V�J5����O��/a}G�w�X��b=S��Q� �Iߍ��?f]n��� J�pT��99Ƚ|R?��W ��PI�r$Y�$_#��P��7rU�*d��u��eh�n� ��������}o�e�mتyC*:gt!E@Ā��5W�:�E�\ ���j<�^�Q�����>��z�� R��k�j�膕�O��˼9?#Dӭ*�5�j�Y~ w}���� �Q��z��#�B|<0]wdZ_�m=��,�5�E*���V3���JD�^k%a��?� n^�����e��U����Sp ⱆp� -%���e��Z�����9��Z�En�������Ĥ��έ���I|G |�����f3M������n���&�%;;�_�l$a2'H+y��4=a��Z*��_+ 0�S�0�V3 ��UE����!�f�� ��4��h�j*�i6Z�d�2��q 9����N�����o�ӽ�2 �5�S c]�Νh�LB�Z��Ѩg��S'�b�b�V��K���=��VÝ;玭���cklP�Vùsh��<��� ��_&V����4�Fˋ�w@�ʴ�ݑm�ګ�/��U�m$��D��}����Z�;�u�M��N8t0A���N�2N�Y@Ϲ�[�TD�m� �5�ٶ�D'#�֑�VW6���׉�kz�-�tHlՉ�iO�KI�5��Ϋq9��n@�=-%�Ɇ֓��v+� �@���*5mxh�Z�Ll˺&7b��̴���j�9RB�֕[�wq�2Ӫ0���XQ F�'��3��A!-Y�o#o���4/�p�0w�g+ v[@����9]� ��~�y `ŀ ZI0�jq��$iX���{ih����5����no2�� �tr�8Go5ZN�u����J ��wڙQ@Z� �ꤝ-ir�X�F�y�e ������>:�od�;�'z�Zo#�|�o�[���b�3�=��'C��������0����$E�j��,F7r�@o��֍[�h���WѐA�F?�߂��-���^�A�3�@b�&��K�0���gh����0D6�U@� X�X�ӂ�� � j���2�&�tW��D_���|����j��HSm�V����j� �+�g��߄jձ�!P'̃k2�T�\�Ii��$��]���U�n-+ � �\Uv)eW�U���J3��-�d����i��(X! �Wq%oSҚ�D`\W��2v�e�zbh$0�����]���)a�NG���{S��_�E�X��.!+���-X�Ni�P���0�Ll�~��9@3� �#KDN�b�g^T�'#��Erj�.��� �<Ǵ������&eթ� �oň���am�(���|�8�A͚���*0�AК�l�t��&��W5��+���U�������4x$~'�h��HcM�bKu�1�r�e���60���R~7E[*�/�7BʋT`�m�<�u�0 ���>D���!r�׸��|�}(l�a�C�^~� ���E�>��U��纷in���/��^���n�}|^_ Ͻ<�ϻ��}������uM�v�w�iw�r?_v�����к��sUm��jj��;�����3�����lN+s���� �k/F�c�k�bi��e� �cpJk�����C�W����n_����ݎ���Z���+��"ý�.�[J3Yjxz �U6�� cn�i��gk �"����Q\5��"� Zɺ���$H*�u�lb�:�R����P�/[b�B^��vp��Y� |�w�xY�s��j�t��W��o�"�s��c��l+i�?����m<��5�����0ی���{�}w�%x� l9{�`"3�����cs�W��f�?i�4�q�մ���fo���/N4��p� �a��]��RM�4��V��R� gI�3 �����߭����HC)�U4��.c` ���M�M\���E �c 7En����͹��c;ߜ?�&D�BR�(}o"�0+�F�Ѵ�f��w�ɫ2�N �W�V�S�¢�^R�D�l�hN�ܖ�<\�A��F�)�X�0B��w�:KLW�Xs��T�mz@<5J��*%��(��:f�/R&;�t�Sr��<��3�>>]^M �>6�_OGs/���xTڞ�/?P���vU��)�D�D��ǻ����O�5T���#�-�b)/K��S�i4�0j������iD�0b�jߒ�H0�sƎ��W$� A.�p�)9�jW���G�ط�h�؜�m0��-�,�^�n�f�/W���1���’���b���ãQT�uܱ�`�i%+��j�S�q�2���;�*��ׂ�.֔x�m�;1�Z��Z%��� �������B������Z��� ���[x!�Ww�6�\rP��u��-���:H ��������<���E�l3T�9;�Q2�?���$�~�����|*�.��M���@(��͹g�`���IYI���u�0�; ��VP�D��]&���-�E�s��!t�bg�{�JF"�[�������b�7>b��V��L׼�% �?G��' wW@��%ԑ�3��@�I{�L_�'�'h�E�Z%��Wco�Q*�J�-@� #qo��C��q>�%Я�������.�`���"�p%���B.aDǯ�hlpm��9�=vȒ�W��*xH��,}zA��h�4B�hZ�D���ħ�����.\����p�P2 ,5���U7�p���وڤ��ח����W�lrML�^���`O��Cw���8����-��x� ����� �ֹ�����o^�r�V��'/��������Xs3qV�)~;Mcl�#^~����0�N��p��K�0w���!�IS5�j{��)n��0��a����-�gg#`� WG�$giaEgA�g@m�� ډ+(����z�ȥ�L��L�Zv1�-�%Wk��ey�;���x��c ��}תV�����>����@J�a`zx�Q�^�ks3� [&��� ���@�����A�6��) �4�=_t���Մ��A���S����9�)����� XR������kI �鞜�����# �� kow�� ��,n@zL���Kr3�c�$�.���İ�Yפ@}�PgbV��~��}����� /7I�l��G��А��*�� �"�6�c��%|혨��>�ԕI5�g�Cov #�+���2�������x��㸉� �x �L�56���#�񡍰�����4wsr+.���R��ۉ�HA)1�&&��*�;c��l}j ㎥��,b�~x�Z�q��[D�1������[҉��L1�O�a'�-3��WA[�>F�l��S�u������l��G��?_og3M<¢�2�����6����@��e�SQ�`kJ��_������X�*���=:! V.�bL>���W!�dj$�J�� �t�FT �%X,F%��C1I�$W�Ui�� �|��T�2�5E]��W �ir��f4�?LEO�޳�iO� [���V���2�����N櫅wa���V����$t!v܂ �d�;���3ClEP�,��€��Q%{�w纡g��<~L����q� �e/�x��d���bz��ͳj�rv�����/~JWɓK�A���0&�˱'�|����y�d��)���oS�^!���m+��F�2ul�*�*j*ɭj�4L�Bd)_�X1 g���@Ǟx�� l" �I&������A("�=���DU?�Į�!�%b�y��t��� a\L����,�m@0b�Hs����w����&D~A��My(���4c"��g�ym�;�"r 5=�'a�d��w�����n��EUd~�p�*�$B�/aNy8�I*�!%NL�Æ�.�]-@�2����\]��/�sr��yD�%_�����U�f��l�5��}\����t��d���`���IC�=N��@L���J�T�gؿa ")_e�"JE˄\�/qvH�'I����Ƕ��W���?�Tw���A�M�ð�P��_�}��LMc���0�`7eR�k�&�a �L�Rrx��������n�mx6�H��nT�;��@#��yŮ��;|&�2r�Ư�g�g�pS=��� ����o�����~:>����+[��gw�=?<��_5��_������ao|q~����燑����ϯ4�����カO~55��w�G����xz0;����ɛ�����O]���;���w��N��������ϧ?�m������������/��D�# ��������&?�z��b��-J@�s0��W���p�PwJX8��u���{�Fb���#�����!��y�LX�'��*;&��(��fxo=>�-��N �.�0��g��R�=����[Y>���3|�e�K:���\�ԟ�_�f�a�/������,g5��� �de.j{Q8C3R8D��4��#Σu��Gxr�#Z������D���C�I�uE�������(�ni{������6���(4\�&��kUd�a+���`!�!�r��� �I�-�{V����X_C�V�u��y�{��jQn�7t��ĸ�� ��8�"��1��¿�b��w��:��zPw��6���yeMAD1����z=�~�v�ٰ�b�B�S�t�j=�}�ZK��� ��LH��>ŝ!��2��e�+�Ncm�)"��H�����j�֔�h�l�W��a���u�6k�8�am,�� M�ټ]>>����t��z����0#;��fE�1�b%���/�y9�w�Uir/*������'��0 �f�Tcj��%�#%��\'���#;��&0����3�$]�R [_)�������#����9�x���� _ޙ&�}S���boݏ�Mu�̠�w`�I�-ӛ�٠�w\͸k_d(!nE�+Z�D�z{��)Zk�A�����>�6�{dtE� H��<�|��}�,��7�0 <_А�8Rp~K��x�5����i-�<l����c�Z��q66n�j=�+�����甘�7� ,���d�!�� �y�q �凰l�� |�;��C��[����]� 4w�ii�Ѷ"f���#tO�����G�$"������_�o�I�y���T�}��-5��U{�X2��%�%.�����}߳揉���\z�z�� ���4�o��v{���N�k��:��2j��n��;Z�{��a+�����:60�5�Y]sb� R����L%����ظ:� ÈOt�]e�+r���6��= �����Kr9s�ho\t]\4�G��}h}F�0�P�+�./z,�f^ԶҒ8VζB����z#C���>������8��C�Z���/ؘ��ܥ��T��Ca�fk0��,���P�6��@����؁���@��Y�TC���U��U���6��˯"�� .���W� �wE����F0���ɩ�N7�iҡb M|�Q�l��$�0��O��� .�w<���b]�����BA��(i��F;m ��M��,/���c"t�x����Ǿ��b~��U�hx��v��4���%|��@��Q���5�M4�pFL6���KqF�|�-����g!'B� �㉞n��w9{K@<��(?>�7I��zHX n�#��^�1Q$�Z���������e&���鄥G��)n{�)�好o��J� *DAi�����'R����ɰ� :l):�jIlpN_-�48O��ԃz2/]�M��P��f *��6��?�oS+Hb����8 ��P����q i{�L̐�"����� //$/\ �Z"�ܤ��"�J �kJ̇9yY�ot���*y0_H��,��a�Xe��c|E����F�)s�"Q�L�ؾ�L�W��;�$�������}G|[[h��g�x�#p��T?�����ن� �&hhos%N��S�8%�q�,����ӦT�)��ن��MO�c ���T��Al�+s���� ���s�`g���=}��;���J�<�gI�m^ [F�Uq�+t�9:�3���߅ t]�@t��<�^~�Q�:?��Ѯ� I����$�1��H�I�$s�� 0�83����CKb�p����8���q��U<��U6����%SZb���w �}9��!� ���D�c�e��aX��v9����}���I�Y�������&� Z��5t|� ������!�Հaj�d?��i�ίϏ�_h?��������t��t������������_t�?�'����f���������������Z/.���'��~���n����[��k����s�{0Y�=���i�E���d2���,G��p�^�K�Ǧ5�$�ܬ/�O�!hJ.���]�i�]؃�=�%�vgv%�Gj�6��0J������܌��C���zww&�hD��9��������bSw��ٰYF��a0�A��sWo��nPɞ��Qj�f���ijW�&6������\2���z��d$"H���;��oe�4���0�B�Po�e�e����D�r�b�0��!�E�, J���|&$�;�ЅSX�B�d�n'���#HoXg�O4��n K�xk)�����j�0L��e�J陑����@�|�cƗ˻�`����5C�x ��~�w�̫���p��J�Šj�d'[�2 <8$!�h#�[rʨ��W|�8y��\��V��+�6/�n�ك����'ZZbu����c��{�� I�3�3H�b{��ijS��gg��/h�5�Le�:�}���T�$%5wO�.��Yv�1�[�F�1T� ���Uh���Y=f�6����xY^�13�:C��߀��,����d���ô����_���z��&T� ��� �S�����\,�S��bKD @?���<�3p�t;OȠ����n���i�V���(���y�F�>����Y5 uY$c 2GlKx4�N���E"H H�AQ.[θ��