8889841cplugins/cookie-law-info/lite/admin/modules/uninstall-feedback/class-uninstall-feedback.php000064400000037241150513603540035721 0ustar00home/clixcotz/tcchp.clix.co.tz/wp-contentplugin_file ), array( $this, 'plugin_action_links' ) ); add_action( 'rest_api_init', array( $this, 'cky_register_routes' ) ); } /** * Register the routes for uninstall feedback. */ public function cky_register_routes() { register_rest_route( $this->namespace, $this->rest_base, array( 'methods' => 'POST', 'callback' => array( $this, 'send_uninstall_reason' ), 'permission_callback' => array( $this, 'create_item_permissions_check' ), ) ); } /** * Check if a given request has access to create an item. * * @param WP_REST_Request $request Full details about the request. * @return WP_Error|boolean */ public function create_item_permissions_check( $request ) { if ( ! current_user_can( 'manage_options' ) ) { return new WP_Error( 'cookieyes_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'cookie-law-info' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } /** * Edit action links * * @param array $links action links. * @return array */ public function plugin_action_links( $links ) { if ( array_key_exists( 'deactivate', $links ) ) { $links['deactivate'] = str_replace( ' 'setup-difficult', 'text' => __( 'Setup is too difficult/ Lack of documentation', 'cookie-law-info' ), 'fields' => array( array( 'type' => 'textarea', 'placeholder' => __( 'Describe the challenges that you faced while using our plugin', 'cookie-law-info' ), ), ), ), array( 'id' => 'not-have-that-feature', 'text' => __( 'The plugin is great, but I need specific feature that you don\'t support', 'cookie-law-info' ), 'fields' => array( array( 'type' => 'textarea', 'placeholder' => __( 'Could you tell us more about that feature?', 'cookie-law-info' ), ), ), ), array( 'id' => 'affecting-performance', 'text' => __( 'The plugin is affecting website speed', 'cookie-law-info' ), ), array( 'id' => 'found-better-plugin', 'text' => __( 'I found a better plugin', 'cookie-law-info' ), 'fields' => array( array( 'type' => 'text', 'placeholder' => __( 'Please share which plugin', 'cookie-law-info' ), ), ), ), array( 'id' => 'cookieyes-connection-issues', 'text' => __( 'I have issues while connecting to the CookieYes web app', 'cookie-law-info' ), 'fields' => array( array( 'type' => 'textarea', 'placeholder' => __( 'Please describe the issues', 'cookie-law-info' ), ), ), ), array( 'id' => 'use-cookieyes-webapp', 'text' => __( 'I would like to use the CookieYes web app instead of the plugin', 'cookie-law-info' ), ), array( 'id' => 'temporary-deactivation', 'text' => __( 'It’s a temporary deactivation', 'cookie-law-info' ), ), array( 'id' => 'other', 'text' => __( 'Other', 'cookie-law-info' ), 'fields' => array( array( 'type' => 'textarea', 'placeholder' => __( 'Please share the reason', 'cookie-law-info' ), ), ), ), ); return $reasons; } /** * Attach modal for feedback and uninstall * * @return void */ public function attach_feedback_modal() { global $pagenow; if ( 'plugins.php' !== $pagenow ) { return; } $reasons = $this->get_uninstall_reasons(); ?>
sanitize_text_field( wp_unslash( $request['reason_id'] ) ), 'reason_detail' => ! empty( $request['reason_text'] ) ? sanitize_text_field( wp_unslash( $request['reason_text'] ) ) : null, 'date' => gmdate( 'M d, Y h:i:s A' ), 'comments' => ! empty( $request['reason_info'] ) ? sanitize_text_field( wp_unslash( $request['reason_info'] ) ) : null, 'server' => ! empty( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : null, 'php_version' => phpversion(), 'mysql_version' => $wpdb->db_version(), 'wp_version' => get_bloginfo( 'version' ), 'wc_version' => defined( 'WC_VERSION' ) ? WC_VERSION : null, 'locale' => get_locale(), 'plugin_version' => $this->current_version, 'is_multisite' => is_multisite(), ); $response = wp_remote_post( $this->api_url, array( 'headers' => array( 'Content-Type' => 'application/json; charset=utf-8' ), 'method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => false, 'body' => wp_json_encode( $data ), 'cookies' => array(), ) ); wp_send_json_success(); } }