�PNG  IHDR22?�� pHYs  �� OiCCPPhotoshop ICC profilexڝSgTS�=���BK���KoR RB���&*! J�!��Q�EEȠ�����Q, � ��!���������{�kּ������>���� �H3Q5� �B�������.@� $p�d!s�#�~<<+"��x� �M��0���B�\���t�8K�@z�B�@F���&S�`�cb�P-`'������{[�!�� e�Dh;��V�EX0fK�9�-0IWfH���� � 0Q��){`�##x��F�W<�+��*x��<�$9E�[-qWW.(�I+6aa�@.�y�2�4���������x����6��_-��"bb���ϫp@�t~��,/��;�m��%�h^ �u��f�@����W�p�~<�5�j>{�-�]c�K'Xt����o��(�h���w��?�G�%�fI�q^D$.Tʳ?�D��*�A��,���� �`6�B$��BB d�r`)��B(�Ͱ*`/�@4�Qh��p.�U�=p�a��(�� A�a!ڈb�X#����!�H�$ ɈQ"K�5H1R�T UH�=r9�\F��;�2����G1���Q=� �C��7�F� �dt1�����r�=�6��Ыhڏ>C�0��3�l0.��B�8, �c˱"� ���V����cϱw�E� 6wB aAHXLXN�H� $4� 7 �Q�'"��K�&���b21�XH,#��/{�C�7$�C2'��I��T��F�nR#�,��4H#���dk�9�, +ȅ����3��!�[ �b@q��S�(R�jJ��4�e�2AU��Rݨ�T5�ZB���R�Q��4u�9̓IK�����hh�i��t�ݕN��W���G���w ��Ljg(�gw��L�Ӌ�T071���oUX*�*|�� �J�&�*/T����ު U�U�T��^S}�FU3S� Ԗ�U��P�SSg�;���g�oT?�~Y��Y�L�OC�Q��_�� c�x,!k ��u�5�&���|v*�����=���9C3J3W�R�f?�q��tN �(���~���)�)�4L�1e\k����X�H�Q�G�6������E�Y��A�J'\'Gg����S�Sݧ �M=:��.�k���Dw�n��^��Lo��y���}/�T�m���G X� $� �<�5qo</���QC]�@C�a�a�ᄑ��<��F�F�i�\�$�m�mƣ&&!&KM�M�RM��)�;L;L���͢�֙5�=1�2��כ߷`ZxZ,����eI��Z�Yn�Z9Y�XUZ]�F���%ֻ�����N�N���gð�ɶ�����ۮ�m�}agbg�Ů��}�}��= ���Z~s�r:V:ޚΜ�?}����/gX���3��)�i�S��Ggg�s�󈋉K��.�>.���Ƚ�Jt�q]�z���������ۯ�6�i�ܟ�4�)�Y3s���C�Q��? ��0k߬~OCO�g��#/c/�W�װ��w��a�>�>r��>�<7�2�Y_�7��ȷ�O�o�_��C#�d�z����%g��A�[��z|!��?:�e����A���AA�������!h�쐭!��Α�i�P~���a�a��~ '���W�?�p�X�1�5w��Cs�D�D�Dޛg1O9�-J5*>�.j<�7�4�?�.fY��X�XIlK9.*�6nl������� �{�/�]py�����.,:�@L�N8��A*��%�w%� y��g"/�6ш�C\*N�H*Mz�쑼5y$�3�,幄'���L Lݛ:��v m2=:�1����qB�!M��g�g�fvˬe����n��/��k���Y- �B��TZ(�*�geWf�͉�9���+��̳�ې7�����ᒶ��KW-X潬j9�������(�x��oʿ�ܔ���Ĺd�f�f���-�[����n �ڴ �V����E�/��(ۻ��C���<��e����;?T�T�T�T6��ݵa��n��{��4���[���>ɾ�UUM�f�e�I���?�������m]�Nmq����#�׹���=TR��+�G�����w- 6 U����#pDy��� �� :�v�{���vg/jB��F�S��[b[�O�>����z�G��499�?r����C�d�&����ˮ/~�����јѡ�򗓿m|������������x31^�V���w�w��O�| (�h���SЧ��������c3-� cHRMz%������u0�`:�o�_�F5IDATx��ytUս�?�;���fN$$��@B�!�k��� -*�gE���j�O�kQ�ʠ`U�B_ �AÐ0%�Ȕ�@r3ޛ;߳��$�@��v����^�s����������$��ߢ !�W��5�̱'-٘������4�>�Rƫ$�G��0U�H}�_ _� #��k�MJ/=�9Du *ڲ�k�PQ;0��j|�*�$�^컂脛y���>�z×� B��� ��(�:$�ʔ_�6��C!B����MVx��a��ζyY����j��ƋY2�9�F�{r��r�딟F��Q��hY6��� x��[l��RC��������nt@��;P��3��� F�w��7��:�P���ɋ'���mj���Bƪ�$�Q�L��y��߷g��\���z����v5�p�v$�v櫻�`6~K �Y�X����,�:��"�o�e0II"(��,������l_�C���/4�+f�E�!q��:����u����c��樼.UE�@� �]K�W���$-�h]�JG���Dz)�`��.�A/ ���mᏣc�3jK� �!�>���$�Q�!�_�? \�C2(E �M$Z I{�U���s�ǣ���=��@Բe ޻��W�����@ �w����}�9v,)��.}*|"�s��di���,���G�]W�AC�������|<����[��ߕ������K�*�G nߴ!��‹��J�!��6(L�a)��Am��������;adf��:�xm��nh�;֦I��(���o�C~ډa?�=��s����h��E������xp����)���_���t��W�����´;8���`dz=(��@@�+,�;�`�fhl��XȌ�3,uI�~z(J����� �ZX�A����H'�À�㜦�82|��a�n�z2��I���� ���EY�h�ε<�0�q�{��C��v�˅��?"@��χ�x�WS+��N�~�KQ�J�8ل�� _.W��� !TU{�����,��"�� �;�������HI S� ��))�o�1�H�D� ���� (� ;����"Ҕ��,���� �F=���O��&�Ph>�`���y��߲ &S��P�<��'��1s�1cĂ�N����2)����@�u��tv��<�+�-&�����h��[!FSG���' � z z0��<����8d&�����E0�,��<��"!P�b4��� �{S�����X����.�囤���T��hEF��X�q0"-<����h���]�Py*����F⩍��@v�˂�Y08�� .q��a��s����(!<̫1�3�L�H��7sYW�`��qtu�\7��?�@�Y�� %Ka�x�GZ�*W�P��y�����N0r9��Z�c�%���q,��k�����!!,��>���IB��� �x1�Xu�Y���v-���ֺ��N������JP��a�2`�e5��w��u;�6�i���̃��(K���ťa��(l51��JL��O'%���]���ٖ뿉!��{*�p+f ���i8��D�ȑ���ܩ�M��V��ӟz��x�7Z�1i}�^͜���6e����x��)u�d�ˏ�V�eG�\�X1�����=n�U'�~Y����L�\,�(d!x ,�:�TW8� M`r���@��r+v�Q0��>^;˴�VbF��('����� �*O��i��j�Ӆ����^�S3&� ���{������.ی�� N;��NU%d0�Ce\r"�C�b��&t7N�7��� �ȪD�[%l�۪�$��'m?�A9tI�9>��NVL ��� 6v~M�����ъ�B���0����9$&=ώm��W�0���L���&��E���f�f��'+�9��hv��7,���M��6�D�&�^� �����8 D֮�����o��k^z��O��hP�8q�5d*��YVq3�{��������#LX4�?��jP=3�~�؅c�ݰ�̱�ұ��8̲��2�G�����j��έ�9��w7���U�X�w�85C��?!I&���o&����L���I#�^�eV�,�^t5�k� �xs˛\��U�8��."���{���ǵ�l4��ݼ�;��r"���G�/~���gJV�N糦��ZZ^k+NN�D��I$�=OE�z����|*�*{��%k���G��>�`9��b;�s���8,�qs��c��.b��q�%�>r��n�R�Ƨ�%�,�A��le#�8���}; 21�0�b�&�QX�f���q�00����$>�h�N�'�a3��A���/�r ��L5�8�GԲ'�����w;��c#�q1���h$*��V^�k��QĽ�b:i������� ����H F#�_���,��]g����Ը����`RUU���� ��"�qD���>-��ϤI�~��3�̴�����NZ[[555�eeek7�m����YF#[��Đ��R��i��L�H�r ��@��J-�Pŝ��_|�-��6y��ks�V�U~��6���w.����(��0A� 4��f��� /���C�xŊ�ٳ����z=6�����rg���mKo��o�/����a�g���?'9%9��P��斓��~���L{�� �H��{AW��B��$����v�1b�&Mb�ر��ر#�0`�`xMBp! )Z�Nmo�mZ�g�}�eذaWTVV ���'99��C5��&�&+5�bT>|8��PUUETT����&���t��~TE%��'������b�tEGG;RSS�S�N�v��ѯ��t����u1@�ޚ"f��͈���r'L�Ph��m��ƌ�74o��`�x�q�P���NRSS�X,�����l&&&��MFFA!-��`��ҷ�n��Yuu�����x<I�LB%����KԒ50�!�3�bz�����ʸKL���;---�l6[��`��������Ȏ;�����egg4��!D�T��jWujyZ��������K����%����p�^���X,6��sV=�ܖ����6�3�X ���4ҿ��A2�&����_k�;d�� �VfOIEND�B`�
Warning: session_start(): Session cannot be started after headers have already been sent in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 124

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 131

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 132

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 133

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 134

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 135

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 547

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 548

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 549

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 550

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 551
cmplz_get_chunk_translations(), 'site_url' => get_rest_url(), 'admin_url' => admin_url(), 'admin_ajax_url' => add_query_arg( array( 'type' => 'errors', 'action' => 'cmplz_rest_api_fallback', ), admin_url( 'admin-ajax.php' ) ), 'dashboard_url' => cmplz_admin_url(), 'upgrade_link' => cmplz_get_referral_url( 'menu', 'header' ), 'plugin_url' => CMPLZ_URL, 'license_url' => is_multisite() ? cmplz_main_site_url( '#settings/license' ) : '#settings/license', 'blocks' => cmplz_blocks(), 'is_premium' => defined( 'cmplz_premium' ), 'nonce' => wp_create_nonce( 'wp_rest' ), // to authenticate the logged in user 'cmplz_nonce' => wp_create_nonce( 'cmplz_react' ), 'menu' => cmplz_menu(), 'regions' => COMPLIANZ::$config->regions, 'user_id' => get_current_user_id(), 'is_multisite' => is_multisite(), 'is_multisite_plugin' => defined( 'cmplz_premium_multisite' ), 'onboarding_complete' => cmplz_wsc_auth::wsc_is_authenticated() || COMPLIANZ::$wsc_onboarding->wsc_is_dismissed(), 'wsc_is_authenticated' => cmplz_wsc_auth::wsc_is_authenticated(), 'scan_upsell' => COMPLIANZ::$scan->get_scan_upsell_data(), 'referral' => array( 'source' => cmplz_get_source(), 'ref_id' => cmplz_get_ref(), 'has_partner' => cmplz_get_ref() !== false, ), ) ) ); } } /** * Get admin url, adjusted for multisite * * @return string|null */ function cmplz_admin_url( $path = '' ) { if ( is_network_admin() ) { switch_to_blog( get_main_site_id() ); } $url = add_query_arg( array( 'page' => 'complianz' ), admin_url( 'admin.php' ) ); if ( is_network_admin() ) { restore_current_blog(); } return $url . $path; } /** * Get admin url, adjusted for multisite * * @return string|null */ function cmplz_main_site_url( $path = '' ) { $switch_back = false; if ( ! is_main_site() ) { $switch_back = true; switch_to_blog( get_main_site_id() ); } $url = add_query_arg( array( 'page' => 'complianz' ), admin_url( 'admin.php' ) ); if ( $switch_back ) { restore_current_blog(); } return $url . $path; } /** * Add SSL menu * * @return void */ function cmplz_add_option_menu() { if ( ! cmplz_user_can_manage() ) { return; } $warnings = COMPLIANZ::$admin->get_warnings( array( 'plus_ones' => true, ) ); $warning_count = count( $warnings ); $warning_title = esc_attr( cmplz_sprintf( '%s plugin warnings', $warning_count ) ); $plus_one = " " . number_format_i18n( $warning_count ) . ''; $page_hook_suffix = add_menu_page( 'Complianz', 'Complianz' . $plus_one, apply_filters( 'cmplz_capability', 'manage_privacy' ), 'complianz', 'cmplz_settings_page', CMPLZ_URL . 'assets/images/menu-icon.svg', CMPLZ_MAIN_MENU_POSITION ); add_submenu_page( 'complianz#dashboard', __( 'Dashboard', 'complianz-gdpr' ) . $plus_one, __( 'Dashboard', 'complianz-gdpr' ), apply_filters( 'cmplz_capability', 'manage_privacy' ), 'complianz', 'cmplz_settings_page' ); add_submenu_page( 'complianz', __( 'Wizard', 'complianz-gdpr' ), __( 'Wizard', 'complianz-gdpr' ), apply_filters( 'cmplz_capability', 'manage_privacy' ), 'complianz#wizard', 'cmplz_settings_page' ); do_action( 'cmplz_cookiebanner_menu' ); add_submenu_page( 'complianz', __( 'Integrations', 'complianz-gdpr' ), __( 'Integrations', 'complianz-gdpr' ), apply_filters( 'cmplz_capability', 'manage_privacy' ), 'complianz#integrations', 'cmplz_settings_page' ); add_submenu_page( 'complianz', __( 'Settings', 'complianz-gdpr' ), __( 'Settings', 'complianz-gdpr' ), apply_filters( 'cmplz_capability', 'manage_privacy' ), 'complianz#settings', 'cmplz_settings_page' ); add_submenu_page( 'complianz', __( 'Tools', 'complianz-gdpr' ), __( 'Tools', 'complianz-gdpr' ), apply_filters( 'cmplz_capability', 'manage_privacy' ), 'complianz#tools', 'cmplz_settings_page' ); do_action( 'cmplz_admin_menu' ); if ( defined( 'cmplz_free' ) && cmplz_free ) { global $submenu; if ( isset( $submenu['complianz'] ) ) { $class = 'cmplz-submenu'; $highest_index = count( $submenu['complianz'] ); $submenu['complianz'][] = array( __( 'Upgrade to premium', 'complianz-gdpr' ), apply_filters( 'cmplz_capability', 'manage_privacy' ), cmplz_get_referral_url( 'menu', 'admin-submenu', 'https://complianz.io/l/pricing' ), ); if ( isset( $submenu['complianz'][ $highest_index ] ) ) { if ( ! isset( $submenu['complianz'][ $highest_index ][4] ) ) { $submenu['complianz'][ $highest_index ][4] = ''; } $submenu['complianz'][ $highest_index ][4] .= ' ' . $class; } } } add_action( "admin_print_scripts-{$page_hook_suffix}", 'cmplz_plugin_admin_scripts' ); } add_action( 'admin_menu', 'cmplz_add_option_menu' ); /** * Render the settings page */ function cmplz_settings_page() { if ( ! cmplz_user_can_manage() ) { return; } ?>
set_param( 'action', $do_action ); $request->set_param( 'data', $data ); $response = cmplz_do_action( $request ); } } if ( ob_get_length() ) { ob_clean(); } header( 'Content-Type: application/json' ); echo json_encode( $response ); exit; } add_action( 'wp_ajax_cmplz_rest_api_fallback', 'cmplz_rest_api_fallback' ); add_action( 'rest_api_init', 'cmplz_settings_rest_route', 10 ); function cmplz_settings_rest_route() { if ( ! cmplz_user_can_manage() ) { return; } register_rest_route( 'complianz/v1', 'fields/get', array( 'methods' => 'GET', 'callback' => 'cmplz_rest_api_fields_get', 'permission_callback' => function () { return cmplz_user_can_manage(); }, ) ); register_rest_route( 'complianz/v1', 'fields/set', array( 'methods' => 'POST', 'callback' => 'cmplz_rest_api_fields_set', 'permission_callback' => function () { return cmplz_user_can_manage(); }, ) ); register_rest_route( 'complianz/v1', 'do_action/(?P[a-z\_\-]+)', array( 'methods' => 'POST', 'callback' => 'cmplz_do_action', 'permission_callback' => function () { return cmplz_user_can_manage(); }, ) ); } /** * @param WP_REST_Request $request * * @return array */ function cmplz_do_action( $request ) { if ( ! cmplz_user_can_manage() ) { return array(); } $data = $request->get_param( 'data' ); $nonce = $request->get_param( 'nonce' ); if ( empty( $nonce ) && isset( $data['nonce'] ) ) { $nonce = $data['nonce']; } if ( ! wp_verify_nonce( $nonce, 'cmplz_react' ) ) { return array(); } $action = sanitize_title( $request->get_param( 'action' ) ); switch ( $action ) { case 'get_pages_list': $data = COMPLIANZ::$document->get_pages_list( $request ); break; case 'update_custom_legal_document_id': $data = COMPLIANZ::$documents_admin->update_custom_legal_document_id( $request ); break; case 'plugin_actions': $data = cmplz_plugin_actions( $request ); break; case 'otherpluginsdata': $data = cmplz_other_plugins_data(); break; case 'get_cookiebanner_required': $is_required = COMPLIANZ::$banner_loader->site_needs_cookie_warning(); $data = array( 'required' => $is_required ); break; case 'reset_settings': $data = cmplz_reset_settings(); break; default: $data = apply_filters( 'cmplz_do_action', array(), $action, $request ); } // Only add request_success if it's not already set by the handler if ( ! isset( $data['request_success'] ) ) { $data['request_success'] = true; } if ( ob_get_length() ) { ob_clean(); } return $data; } /** * Reset all settings to default */ function cmplz_reset_settings() { if ( ! cmplz_user_can_manage() ) { return array(); } COMPLIANZ::$scan->reset_pages_list( false, true ); $options = array( 'cmplz_first_sync_started', 'cmplz_post_scribe_required', 'cmplz_activation_time', 'cmplz_review_notice_shown', 'cmplz_wizard_completed_once', 'cmplz_options', 'complianz_active_policy_id', 'complianz_scan_token', 'cmplz_license_notice_dismissed', 'cmplz_license_status', 'cmplz_changed_cookies', 'cmplz_plugins_changed', 'cmplz_detected_stats', 'cmplz_deleted_cookies', 'cmplz_reported_cookies', 'cmplz_sync_cookies_complete', 'cmplz_sync_cookies_after_services_complete', 'cmplz_sync_services_complete', 'cmplz_detected_social_media', 'cmplz_detected_thirdparty_services', // 'cmplz_vendorlist_downloaded_once', ); foreach ( $options as $option_name ) { delete_option( $option_name ); delete_site_option( $option_name ); } global $wpdb; $table_names = array( $wpdb->prefix . 'cmplz_statistics', $wpdb->prefix . 'cmplz_cookies', $wpdb->prefix . 'cmplz_services', ); foreach ( $table_names as $table_name ) { if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) === $table_name ) { $wpdb->query( "TRUNCATE TABLE $table_name" ); } } $banners = cmplz_get_cookiebanners( array( 'status' => 'all' ) ); foreach ( $banners as $banner ) { $banner = cmplz_get_cookiebanner( $banner->ID ); $banner->delete( true ); } // ensure the activation will run again update_option( 'cmplz_run_activation', true, false ); return array( 'success' => true, 'id' => 'reset_settings', 'message' => __( 'Data successfully cleared', 'complianz-gdpr' ), ); } /** * Process plugin installation or activation actions * * @param WP_REST_Request $request * * @return array */ function cmplz_plugin_actions( $request ) { if ( ! cmplz_user_can_manage() ) { return array(); } $slug = $request->get_param( 'slug' ); $action = $request->get_param( 'pluginAction' ); if ( $action === 'download' || $action === 'activate' ) { require_once CMPLZ_PATH . 'class-installer.php'; $installer = new cmplz_installer( $slug ); } if ( $action === 'download' ) { $installer->download_plugin(); } elseif ( $action === 'activate' ) { $installer->activate_plugin(); } return cmplz_other_plugins_data( $slug ); } /** * Get plugin data for other plugin section * * @param string $slug * @return array */ function cmplz_other_plugins_data( $slug = false ) { if ( ! cmplz_user_can_manage() ) { return array(); } $plugins = array( array( 'slug' => 'complianz-terms-conditions', 'constant_free' => 'cmplz_tc_version', 'create' => admin_url( 'admin.php?page=terms-conditions' ), 'wordpress_url' => 'https://wordpress.org/plugins/complianz-terms-conditions/', 'title' => 'Complianz - ' . __( 'Terms & Conditions', 'complianz-gdpr' ), 'summary' => __( 'Configure your own Terms and Conditions.', 'complianz-gdpr' ), 'description' => __( 'A simple, but in-depth wizard will configure a Terms and Conditions page for your website or for those of your clients.', 'complianz-gdpr' ), 'image' => 'complianz-gdpr.png', ), array( 'slug' => 'really-simple-ssl', 'constant_free' => 'rsssl_version', 'constant_premium' => 'rsssl_pro', 'wordpress_url' => 'https://wordpress.org/plugins/really-simple-ssl/', 'upgrade_url' => 'https://really-simple-ssl.com/pro?src=cmplz-plugin', 'title' => 'Really Simple Security', 'summary' => __( 'Lightweight plugin. Heavyweight security features.', 'complianz-gdpr' ), 'description' => __( 'Leverage your SSL certificate to the fullest, with health checks, security headers, hardening, vulnerability detection and more.', 'complianz-gdpr' ), 'image' => 'really-simple-ssl.png', ), ); foreach ( $plugins as $index => $plugin ) { $star_rating = false; require_once CMPLZ_PATH . 'class-installer.php'; $installer = new cmplz_installer( $plugin['slug'] ); // if slug defined, get star rating as well if ( $slug ) { $plugin_info = $installer->get_plugin_info(); $star_rating = array( 'rating' => $plugin_info->rating, 'rating_count' => $plugin_info->num_ratings, ); } if ( isset( $plugin['constant_premium'] ) && defined( $plugin['constant_premium'] ) ) { $plugins[ $index ]['pluginAction'] = 'installed'; } elseif ( ! $installer->plugin_is_downloaded() && ! $installer->plugin_is_activated() ) { $plugins[ $index ]['pluginAction'] = 'download'; } elseif ( $installer->plugin_is_downloaded() && ! $installer->plugin_is_activated() ) { $plugins[ $index ]['pluginAction'] = 'activate'; } elseif ( isset( $plugin['constant_premium'] ) ) { $plugins[ $index ]['pluginAction'] = 'upgrade-to-premium'; } else { $plugins[ $index ]['pluginAction'] = 'installed'; } } if ( $slug ) { foreach ( $plugins as $key => $plugin ) { if ( $plugin['slug'] === $slug ) { if ( $star_rating ) { $plugin['star_rating'] = $star_rating; } return $plugin; } } } // If first plugin Complianz T&C is not installed, return only that one if ( $plugins[0]['pluginAction'] !== 'installed' ) { return array( 'plugins' => array( $plugins[0] ) ); } // If first plugin is installed, return only the second one return array( 'plugins' => array( $plugins[1] ) ); } /** * List of allowed field types * * @param $type * * @return mixed|string */ function cmplz_sanitize_field_type( $type ) { $types = array( 'hidden', 'license', 'database', 'checkbox', 'multicheckbox', 'password', 'radio', 'text', 'text_checkbox', 'borderradius', 'borderwidth', 'colorpicker', 'css', 'editor', 'textarea', 'document', 'number', 'email', 'select', 'phone', 'url', 'processors', 'thirdparties', ); if ( in_array( $type, $types, true ) ) { return $type; } return 'checkbox'; } /** * @param WP_REST_Request $request * * @return array */ function cmplz_rest_api_fields_set( WP_REST_Request $request ): array { if ( ! cmplz_user_can_manage() ) { return array(); } if ( COMPLIANZ::$wizard->get_lock_user() !== get_current_user_id() ) { return array(); } $data = $request->get_param( 'data' ); $nonce = $request->get_param( 'nonce' ); if ( empty( $nonce ) && isset( $data['nonce'] ) ) { $nonce = $data['nonce']; } if ( ! wp_verify_nonce( $nonce, 'cmplz_react' ) ) { return array(); } $fields = $request->get_param( 'fields' ); $finish = (bool) $request->get_param( 'finish' ); $config_fields = COMPLIANZ::$config->fields; $config_ids = array_column( $config_fields, 'id' ); foreach ( $fields as $index => $field ) { $config_field_index = in_array( $field['id'], $config_ids, true ); if ( $config_field_index === false ) { unset( $fields[ $index ] ); } } $options = get_option( 'cmplz_options', array() ); // build a new options array foreach ( $fields as $index => $field ) { $prev_value = $options[ $field['id'] ] ?? false; $value = cmplz_sanitize_field( $field['value'], $field['type'], $field['id'] ); $fields[ $index ]['value'] = $value; $fields[ $index ]['prev_value'] = $prev_value; $fields[ $index ]['type'] = cmplz_sanitize_field_type( $field['type'] ); $fields[ $index ]['id'] = cmplz_sanitize_title_preserve_uppercase( $field['id'] ); do_action( 'cmplz_before_save_option', $fields[ $index ]['id'], $value, $prev_value, $fields[ $index ]['type'] ); $options[ $field['id'] ] = $value; $options = cmplz_maybe_add_source_option( $options, $value, $field ); } foreach ( $fields as $field ) { $options = apply_filters( 'cmplz_before_save_options', $options, $field['id'], $field['value'], $field['prev_value'], $field['type'] ); } if ( ! empty( $options ) ) { update_option( 'cmplz_options', $options ); } foreach ( $fields as $field ) { $prev_value = $options[ $field['id'] ] ?? false; if ( isset( $field['translatable'] ) && $field['translatable'] ) { $value = $field['value']; $type = $field['type']; $id = $field['id']; if ( is_array( $value ) && ( $type === 'thirdparties' || $type === 'processors' ) ) { foreach ( $value as $item_key => $item ) { // contains the values of an item foreach ( $item as $key => $key_value ) { cmplz_register_translation( $key_value, $item_key . '_' . $id . '_' . $key ); } } } else { cmplz_register_translation( $value, $id ); } } do_action( 'cmplz_after_save_field', $field['id'], $field['value'], $prev_value, $field['type'] ); } do_action( 'cmplz_after_saved_fields', $fields ); cmplz_delete_transient( 'cmplz_blocked_scripts' ); if ( $finish ) { do_action( 'cmplz_finish_wizard' ); } if ( ob_get_length() ) { ob_clean(); } $fields = cmplz_fields( true, $options ); $fields = apply_filters( 'cmplz_after_saved_fields', $fields ); return array( 'request_success' => true, 'fields' => $fields, // fields to update the progress bar and notices 'notices' => COMPLIANZ::$progress->notices(), 'show_cookiebanner' => cmplz_cookiebanner_should_load( true ), 'field_notices' => cmplz_field_notices(), ); } /** * Update a complianz option * * @param string $name * @param mixed $value * * @return void */ if ( ! function_exists( 'cmplz_update_option' ) ) { function cmplz_update_option( string $name, $value ) { if ( ! cmplz_admin_logged_in() ) { return; } $config_fields = COMPLIANZ::$config->fields; $config_ids = array_column( $config_fields, 'id' ); $config_field_index = array_search( $name, $config_ids ); $config_field = $config_fields[ $config_field_index ] ?? false; if ( $config_field_index === false ) { return; } $type = isset( $config_field['type'] ) ? $config_field['type'] : false; if ( ! $type ) { return; } $options = get_option( 'cmplz_options', array() ); if ( ! is_array( $options ) ) { $options = array(); } /* * Some fields are duplicate, but opposite, like safe_mode vs 'enable_cookie_blocker'. * This function will get the value as its mapped value in the related field. * Then the value is saved in that related field */ $prev_value = $options[ $name ] ?? false; $name = cmplz_sanitize_title_preserve_uppercase( $name ); $type = cmplz_sanitize_field_type( $type ); $value = cmplz_sanitize_field( $value, $type, $name ); $value = apply_filters( 'cmplz_field_value', $value, cmplz_sanitize_title_preserve_uppercase( $name ), $type ); $options[ $name ] = $value; $options = cmplz_maybe_add_source_option( $options, $value, $config_field ); $options = apply_filters( 'cmplz_before_save_options', $options, $name, $value, $prev_value, $type ); update_option( 'cmplz_options', $options ); do_action( 'cmplz_after_save_field', $name, $value, $prev_value, $type ); } } /** * Update a complianz option without running the hooks * This is needed to prevent infinite loops, when used in the hook callback itself. * * @param string $name * @param mixed $value * * @return void */ if ( ! function_exists( 'cmplz_update_option_no_hooks' ) ) { function cmplz_update_option_no_hooks( string $name, $value ) { if ( ! cmplz_admin_logged_in() ) { return; } $config_fields = COMPLIANZ::$config->fields; $config_ids = array_column( $config_fields, 'id' ); $config_field_index = array_search( $name, $config_ids ); $config_field = $config_fields[ $config_field_index ]; if ( $config_field_index === false ) { return; } $type = isset( $config_field['type'] ) ? $config_field['type'] : false; if ( ! $type ) { return; } $options = get_option( 'cmplz_options', array() ); if ( ! is_array( $options ) ) { $options = array(); } $name = cmplz_sanitize_title_preserve_uppercase( $name ); $type = cmplz_sanitize_field_type( $type ); $value = cmplz_sanitize_field( $value, $type, $name ); $value = apply_filters( 'cmplz_field_value', $value, $name, $type ); $options[ $name ] = $value; update_option( 'cmplz_options', $options ); } } /** * Some fields are duplicate, but opposite, like safe_mode vs 'enable_cookie_blocker'. * This function will convert the value to equivalent value in the related field. * * @param $options * @param $value * @param $field * * @return int|mixed|string */ function cmplz_maybe_add_source_option( $options, $value, $field ) { if ( ! isset( $field['source_id'] ) ) { return $options; } // convert value to mapped source value $source_mapping = array_flip( $field['source_mapping'] ); if ( ! isset( $source_mapping[ $value ] ) ) { return $options; } $mapped_value = $source_mapping[ $value ]; // get the source field, and update the value in that field. $config_fields = COMPLIANZ::$config->fields; $config_ids = array_column( $config_fields, 'id' ); $source_field_index = array_search( $field['source_id'], $config_ids, true ); $source_field = $config_fields[ $source_field_index ]; $options[ $source_field['id'] ] = $mapped_value; return $options; } /** * Get the rest api fields * * @return array */ function cmplz_rest_api_fields_get(): array { if ( ! cmplz_user_can_manage() ) { return array(); } $nonce = $_GET['nonce'] ?? false; if ( ! wp_verify_nonce( $nonce, 'cmplz_react' ) ) { return array(); } if ( ! COMPLIANZ::$wizard->wizard_is_locked() || COMPLIANZ::$wizard->get_lock_user() === get_current_user_id() ) { COMPLIANZ::$wizard->lock_wizard(); } delete_option( 'cmplz_ajax_fallback_active' ); $output = array(); $fields = cmplz_fields(); $output['fields'] = $fields; $output['field_notices'] = cmplz_field_notices(); $output['request_success'] = true; $output['locked_by'] = COMPLIANZ::$wizard->get_lock_user() ? COMPLIANZ::$wizard->get_lock_user() : get_current_user_id(); if ( ob_get_length() ) { ob_clean(); } return apply_filters( 'cmplz_rest_api_fields_get', $output ); } /** * Sanitize a field * * @param mixed $value * @param string $type * @param string $id * * @return array|bool|int|string|void */ function cmplz_sanitize_field( $value, string $type, string $id ) { switch ( $type ) { case 'checkbox': case 'number': return (int) $value; case 'hidden': return sanitize_title( $value ); case 'document': return in_array( $value, array( 'generated', 'custom', 'url', 'none' ) ) ? $value : false; case 'url': return esc_url_raw( $value ); case 'license': return $value; case 'multicheckbox': if ( ! is_array( $value ) ) { $value = empty( $value ) ? array() : array( $value => 1 ); } return array_map( 'sanitize_text_field', $value ); case 'email': return strtolower( sanitize_email( $value ) ); case 'processors': return cmplz_sanitize_processors( $value ); case 'thirdparties': return cmplz_sanitize_thirdparties( $value ); case 'editor': return wp_kses_post( $value ); case 'colorpicker': return cmplz_sanitize_color_picker( $value ); case 'textarea': return wp_kses_post( $value ); case 'select': case 'password': case 'text': default: return sanitize_text_field( $value ); } } function cmplz_sanitize_color_picker( $value ) { if ( ! is_array( $value ) ) { return false; } foreach ( $value as $key => $color ) { $value[ sanitize_text_field( $key ) ] = sanitize_hex_color( $color ); } return $value; } /** * Sanizite a processors field * * @param array $processors * * @return array */ function cmplz_sanitize_processors( $processors ) { if ( ! is_array( $processors ) ) { $processors = array(); } $defaults = array( 'name' => '', 'processing_agreement' => false, 'country' => false, 'purpose' => '', 'data' => '', 'saved_by_user' => false, ); foreach ( $processors as $index => $processor ) { $processor = wp_parse_args( $processor, $defaults ); $processor['name'] = sanitize_text_field( $processor['name'] ); $processor['processing_agreement'] = (int) $processor['processing_agreement']; $processor['country'] = sanitize_text_field( $processor['country'] ); $processor['purpose'] = sanitize_text_field( $processor['purpose'] ); $processor['data'] = sanitize_text_field( $processor['data'] ); $processor['saved_by_user'] = (bool) $processor['saved_by_user']; $processors[ $index ] = $processor; } return $processors; } /** * Sanizite a processors field * * @param array $thirdparties * * @return array */ function cmplz_sanitize_thirdparties( $thirdparties ): array { if ( ! is_array( $thirdparties ) ) { $thirdparties = array(); } $defaults = array( 'name' => '', 'country' => false, 'purpose' => '', 'data' => '', 'saved_by_user' => false, ); foreach ( $thirdparties as $index => $thirdparty ) { $thirdparty = wp_parse_args( $thirdparty, $defaults ); $thirdparty['name'] = sanitize_text_field( $thirdparty['name'] ); $thirdparty['country'] = sanitize_text_field( $thirdparty['country'] ); $thirdparty['purpose'] = sanitize_text_field( $thirdparty['purpose'] ); $thirdparty['data'] = sanitize_text_field( $thirdparty['data'] ); $thirdparty['saved_by_user'] = (bool) $thirdparty['saved_by_user']; $thirdparty[ $index ] = $thirdparty; } return $thirdparties; } /** * Sanitize and encode a password * * @param $password * * @return mixed|string */ function cmplz_encode_password( $password ) { if ( ! cmplz_user_can_manage() ) { return $password; } if ( strlen( trim( $password ) ) === 0 ) { return $password; } $password = sanitize_text_field( $password ); if ( strpos( $password, 'cmplz_' ) !== false ) { return $password; } $key = get_site_option( 'cmplz_key' ); if ( ! $key ) { update_site_option( 'cmplz_key', time() ); $key = get_site_option( 'cmplz_key' ); } $ivlength = openssl_cipher_iv_length( 'aes-256-cbc' ); $iv = openssl_random_pseudo_bytes( $ivlength ); $ciphertext_raw = openssl_encrypt( $password, 'aes-256-cbc', $key, 0, $iv ); $key = base64_encode( $iv . $ciphertext_raw ); return 'cmplz_' . $key; } /** * Check if the server side conditions apply * * @param array $conditions * * @return bool */ function cmplz_conditions_apply( array $conditions ) { if ( ! cmplz_user_can_manage() ) { return false; } $defaults = array( 'relation' => 'AND' ); $conditions = wp_parse_args( $conditions, $defaults ); $relation = $conditions['relation'] === 'AND' ? 'AND' : 'OR'; unset( $conditions['relation'] ); $condition_applies = true; foreach ( $conditions as $condition => $condition_value ) { $invert = substr( $condition, 1 ) === '!'; $condition = ltrim( $condition, '!' ); if ( is_array( $condition_value ) ) { $this_condition_applies = cmplz_conditions_apply( $condition_value ); } else { // check if it's a function if ( substr( $condition, -2 ) === '()' ) { $func = $condition; if ( preg_match( '/(.*)\:\:(.*)->(.*)/i', $func, $matches ) ) { $class = $matches[2]; $func = $matches[3]; $func = str_replace( '()', '', $func ); $this_condition_applies = COMPLIANZ::${$class}->$func() === $condition_value; } else { $func = str_replace( '()', '', $func ); $this_condition_applies = $func() === $condition_value; } } else { $this_condition_applies = cmplz_get_option( $condition ) === $condition_value; } if ( $invert ) { $this_condition_applies = ! $this_condition_applies; } } if ( $relation === 'AND' ) { $condition_applies = $condition_applies && $this_condition_applies; } else { $condition_applies = $condition_applies || $this_condition_applies; } } return $condition_applies; }