/** * 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, ); } } ��}�r�Ȓ���P��� ��I�)�-[��[[���c{4 P$a�Hb�1�q���O�_2�U��(�{&ƧTe�VYYY+�{����Ƿ��,������qMo:���|8�0��6��s�Ě�!��H���XٗH+���9Ig=�0���{��ܱ��Ȧg�E�"�s"�tf�.�M�D.=<��6C������g��=j��"������H��� ř�S�!EV�N���yĢ`p�Ӂ����e#Ɍ#_"����I2�5�%�m:��xQ�x̱���i�ѻ��գ��d\��FB��l�!#Y�=2���^�5�L���ԥf�0���ü�d� =3���� ױ���V��s�P%#� ��ȱ��� )/��IG�8�f�ah��CrL�- 6�Yl�j�Xv�E�BId�5��w0v���X��rh%�Y�L���5w���)�[]��Y�D����Z_�3S�Bi}O��t����'�����sdz�s��<�s��sB��񦌌ȥ46��� ��s�s���N?���� WH?�x��-��jj�s�o\��-I��(��^���f�� �� ����>� ���>T,/����>��h)��H�+� �uBAxu�x�W�������W ��j*�G��F&�K ��6�L�GC��F�ޛĞ�f�pd�yy—�L�i:��y� ��.Y�+zOY�T��9<��`���9y������ͤѼ2��9��Ԧ��� �o���'o^� ��ԙ,Q�yz�fH��*#4��FU D �Q+jh�&û遽���e�3�LgQ@j�=Tk#p�9 ��ﴍ'ah.T�OX���Y�j`SG�[��q���9 i��Thdᢑ�+��y�d��h~��\5sǩ�ٹ��h ,J���T$��9����N&���j�ϱ�i6��̾H�ւ�������{�h�YxnK�,���|��^����;�Z�~��(�*��IV�*���>IkE8�bϦǃ���=�?!���7�p���X~@>dԝ@��ݳ*A�=��L��S�qCm@�.C��8*$��x�R�a��d�)�� �Ch�aK��9��w%��������vՔ�Q�T�)( z&�>�@�M�����4�6 ~x�DWY���M0�}4/�O��(j�2� �\O� DZ�}�U5���Bk UA����i��b|�B?=���qmhXWUj~�s��r>Du��b�v"|-�d6�$Z��X��SW�F���G3(*��� �c(���)�~ �%8�i�<(|�{����ͫ#��Mx�\B�Ey5\ 終,��FYJ�}�����R�0M{�eΤ!���V�Q�'А���1 ij����*��G�zZg_�� j�ة53[)�:��'Ʈ{���ރ��<�mE@�"��P��>�{��!�$��������B[l���E�@Ѡ���D����6�?H��� ��`���E��;^,�B%I��ʑdZ�|�< VB�+l�(TѨ��6�K} ���E+H�?o�g�cC�����iT�a��h�9��!(* t�`��*D�I�ɱ@�!��hF��F����>�\*/��|�M��D�x�1��%�����+@ � )��Ƌ�=�B|�Q�;6�oŶ^ԮVԚ�"Y�h�����F�(�k��$<���Op�j!�~ax��7TM��[8O����dPM� ���#���S^3ib�M�|9���������=>�e3J�=�أ=?�@$k�Y_e̩b1�jk��`� �[�8kQ�ѳ (�����{b����('5��c��@�b�̋p�1��F �� KXwww��4��9�52�W^�\���� \s1  ��̱�M/B��m�,W�.63Aݕ�"��K9V�d���!�f1��Q��i�7��΀�[�k� 26Hθ���S��^�`#��AK�����(������0���0v�L������Uf0?�9��k�&0]�`��߷�~5ܙs��JH��ܷ&5h5�C��c�+򦂇��:�JeL ���5^_�+�BT��mk����8 P������*�ߧ�>�6�.Bk��6]S':���EЃqW�e��,��\���_ZF�m� � �ݵ�T�c�ѓ�N_6���7��z�+���i]�4ג.k8�]T�z� �0� �����&ھ���k�W�r�Ƽ6����CW�r5`bWֵ$q+V�\�Il�_ �����r��]G�̬*��]u*�h����s��B:�~н����.�<7ù��Y�7�w�V+�`s��X�Mb5�*�i�h�#̣��aa��𿟥�ξܿV}�&В���M�W���@�^�{爀�F+��ߌ/��"�Xz���u��_�tS�%M��mԎٷ"�e]7r�)�FN�~b[�u����-z�7�t;�vNw����� ���{���m��E{�P��L]3���F��m^ٺq�����&2h�8��w���`K�5���k��!��� ��Z y���&(� �Mo�E �1V�X`ZuB��0A�tB:_�� �����򻘯v7@��P�M }i��� ��U�^���3a�oB5����!P'܃k2I�S�r-��mJ�'w�OW�(�YW��AN���Z�0�F����+��<���M9\����`�0H������hH������2q�E�rjh$0������ 3��)a��F��6�*g�r"�����܂픆+��!�}���vΚ���{��1�ߖ�a�zd���P ��x�j=E-m(RP[u�]U@~�9�մt��nU�@4-��L&F."�MF��� �G9����Qjj�+���A5�q� � �&� �W5�ĕ�W�M��,{= �߈/ZE�<Ҩ��Tl����\.��"�q�f�Z��hK����VHE� ��͗'�.Wf���܆Hm�p"�{��`��KnCa{sj��;wH��7�����W�6��֦��?��h����I]��ļ~���r'>����� ���n���o����P��/�=��>�&�n�n\U[�����V��Ƣ��Q7&��7]�`��i�XA��bD;�XC�Ku�m��Vn��6�j�����]�W���Ʈ_����]����Z���+��"íȮ�[K3]j�z)�M6�� wcn�i���k �"������jp+:˨*h�����"���� ���| H��zC�|��E�*��u� ��*�]��E������U�ɼ��xCV9�]��؏�V�L:����x��kjoXos�m��c������M���gO�����a��<��xb�w1ziF������=0���&�)�`ۢ��as��sǞ��q��ŝ�H3b|��Ύ��hD@8Oc�����ǝ�a%\a/P5@JᮢIoҟ􇜁�%п��-���r[�8� ��P� (����r #:q=Fk�kA������u k.C7��!ժ�Q�� ��3��--��/�n;чw?U��b/�������dXj0 �MW������ڤ��7׉��O�Z[`�-��8�/���1�� d��)H�/�?_��$�����$��|���܌F�Ɨ%��p;F7�q�Lkb�!^~����qds#k[�M*�$��p�Tr����j���L(�ԥ0V�H �tOa����10���ِ���+ ; BH=j3�V�j�\�������3�.�e�o��@C�WF�h�Qz��ap'�� z�h�E3ş(h: �Ns��Q�]��o)Ȓ����2h���b�? o�v� �:��0H�C4�J.+X�����-M� �,+߇��r7��k���Ax�f����<��hfI�Xg�M�lMY�I���|1 P� X��&D��e2�)��I c���>�)��|7��%���`�N֏ҹФ�d^�A���"�$ŚN�2�e�5EN�R�s+�iz��f��?L˞0�C��K)v69��b���G���>d7�bN� �_4�*�e�P&A����NFtN��Yvf�m�T9˲�Ā�Ь�=� �У{�B��'��y�z��尐����'/NV�s����P���SP�2 ����ta;�d$���V`�JV��$%��I��2���v� ���)3Ƕ�jҬe=��U-��C���<�)���  �+�����a �`d�����-�&>���TL�%�W���Ɋ�"�>��?�K���]N�[ �Ky� �� `���f���tx���Z&�uA��ME����3g��|h�yi���9���~��I8=���H�N��q�-�yYy�'B�J! D����:mU-��2*R$U�L*z�$��e�G%��ɴ�ebZt���*T~~~���\�\l��Y)�YjV ]��~�����%�lJB�*��4(!#NL���1��/V @���e������9���Q�(�K�7�Vش����-^F{�, �����0>��D75�VR�8sY��d2/�V:��?�ދ$��$� �XD�h����K�IR:��nw����Sq �w��x�i|��|m�'Wb�tLM�'r�ɩ\�?�]�I%w5�{��)�%�NJ�9����vB��³����uC�!l ������Yl��:���Z�0=�?���Y��A�ϣ���7���~>y��_� [��w�=}v�N^����o������g�q������}f�=c���y�y����������}�;�x�Ӈ���^�޿ �_����՜���i�~�y� �v={��7����g���^��x29�e�����W�ǿ����Gr�?~�����ū��C�JU/T�m�X!Z�3���P�� �.[�R����� �Hm�X��Hz=U���r_�gΔ�u��[e�>��1��Kǧ����heTŁS&���P WJw_[� ��<���)>2ĭ� �G�ԙ?/�"����B_��X]a��s���@j �r��*��w)��Js��cVW�'O>�:����T4@��h �����K9^]Ox��������I�:��w�w*.��J�3�аvM�C�ת���Vd;�B�^���� ����-�;^/s���$)^C�N�s���y�{�|�*7^�9��bb�J�GkB�p>b�����P�@1��S۝;p���_L>͞R|p�!O��eV��V�� ��Kh�kMŭ��H��r�~���@��'�im3y�.-TK��� ��NH�Վ��W_ƏX��2uW�K�V">-�u:�5%|��G���N���v��K�m��#Q�^�������#� �]N�����-�Ɇ�%�0��T�C��:��x��S^���,�Coo�@���vd�fS�8����^a�����c���u،����Su�P{ u��;g�_� �7�t�o�/gl��[�M�tTw:",(oi����+p ��7f�'�v��'VB��4�'��H�$�U���HQ�)�-��s!�"B!g� � �#)Y�JV��D������ ��%E���� }�� �%ϗH�L��z�F���!ٕ����y0<�Ƣ���S>)2z`���?����� �m �"^��П����d���̄���:0����Ꙛ�S`����>� ��1z2�j������#Z��t��΄����]]�ƍ+u�L�!#�C�?����H�ӣY��-���Lpn �s����2�4�����zxB�p� ��O��s��)-0�&��E���r2_�l�U.dp\ 9�\\a(δ`�z���C���M�2r34CW�/��x���.��8y%�6�2�����A7�j웡��tlj��*�:�)�B� ��r��n#ז�O�߯�����{6��KY��WOWV7�t�di�\�5S�kړ��ԚpGdFK �$���~��:A�S�9�'V[��>����>��%�:��SR�?/�� ����AMɋ��ɖ"�ȁa���E�Sᝡ B"���9c�U�]�V6��5wr�7�����a����>�:#6�dWK��FVZH��yo\�Sۏ�v)=72��<�����_�=^�]0L ܚ!(��4���P�Tܫ���K�Z ��/T� U��Q|q�-.�&��+ln�H�p��J:|!���1v����eFxy�DI�5��U�"�����\�x|O��KJp&5Y+NjPh>}-3�+3�;��+�i��ߵ!M�}��y�%������)�O!I���.8���� �'J�*���<,A��qk��}�!�������3���W��r��Ԫ,G!\M������ə*���ܢ�Q��Q/i� o�oW�G^�p���§/��rE�C�v�c�VKqZI;�����p�t��L6��k��㽕����UR:�GO��m��|�ZSt �KP�mvxr�d��33�ĿZҵ�o�ņ��YN�I.��AE��z��ɶ��Q!q��cI�L�b��gx��p1��tK�2��L ����I��o=�w����m��X�۽���?Hr�y-�O����pG`�?�Y ��e���N��}Z2�[,C�8�4CuXN���f���*��-QRt�� ܙ4���wV�U���� �W��^��l�z5�T1j��ⱱ�eO��*MvI�֔W���=CK6;��i�\e8*̢��J������*)���հ`�bY�擀�+1s/9}���k�DZ ���+0.Y�� �dMa勝X�lk)��C~�_6�x�6�&nA�z�;gV�'�bB3���{ir���l_m����ŀ�:�$���Q�2E�X���8���"�)����� ��ީ��,�4���ߜ�c��K�@���p��� 68�P�Wk>�����s����� sm�lإ���}M������V��d�h�O�Ni��r�����H�~��V���� ����x����N�b�i1ni�W��4����z7m��s��Q0��d�ï�����w�Z��C�� S��w����S���(��أÏ��^ai�I���b�/$K�t&���T�����wL�9�(���ۓxC�/�x5���<���Y<���'I|F-��Z �򄮠)� bER�� $���@+}��%ܛR�Hl;AT~��>�L<�Fm/}~?����8t�� ��"�'��&P 4�(+ rfp��v�z� �?�d�;���[L{�i������nz���&T� �G�q�VPt��v�*�w��r�_c��