*/ class Feedback { use User_Data; /** * Construct Method * * @return void * @author Jewel Theme */ public function __construct(){ add_action( 'admin_enqueue_scripts' , [ $this,'admin_suvery_scripts'] ); add_action( 'admin_footer' , [ $this , 'deactivation_footer' ] ); add_action( 'wp_ajax_jlt_admin_bar_editor_deactivation_survey', array( $this, 'jlt_admin_bar_editor_deactivation_survey' ) ); } public function proceed(){ global $current_screen; if( isset($current_screen->parent_file) && $current_screen->parent_file == 'plugins.php' && isset($current_screen->id) && $current_screen->id == 'plugins' ){ return true; } return false; } public function admin_suvery_scripts($handle){ if('plugins.php' === $handle){ wp_enqueue_style( 'admin-bar-survey' , JLT_ADMIN_BAR_EDITOR_ASSETS . 'css/admin-bar-survey.css' ); } } /** * Deactivation Survey */ public function jlt_admin_bar_editor_deactivation_survey(){ check_ajax_referer( 'jlt_admin_bar_editor_deactivation_nonce' ); $deactivation_reason = ! empty( $_POST['deactivation_reason'] ) ? sanitize_text_field( wp_unslash( $_POST['deactivation_reason'] ) ) : ''; if( empty( $deactivation_reason )){ return; } $email = get_bloginfo( 'admin_email' ); $author_obj = get_user_by( 'email', $email ); $user_id = $author_obj->ID; $full_name = $author_obj->display_name; $response = $this->get_collect_data( $user_id, array( 'first_name' => $full_name, 'email' => $email, 'deactivation_reason' => $deactivation_reason, ) ); return $response; } public function get_survey_questions(){ return [ 'no_longer_needed' => [ 'title' => esc_html__( 'I no longer need the plugin', 'admin-bar' ), 'input_placeholder' => '', ], 'found_a_better_plugin' => [ 'title' => esc_html__( 'I found a better plugin', 'admin-bar' ), 'input_placeholder' => esc_html__( 'Please share which plugin', 'admin-bar' ), ], 'couldnt_get_the_plugin_to_work' => [ 'title' => esc_html__( 'I couldn\'t get the plugin to work', 'admin-bar' ), 'input_placeholder' => '', ], 'temporary_deactivation' => [ 'title' => esc_html__( 'It\'s a temporary deactivation', 'admin-bar' ), 'input_placeholder' => '', ], 'jlt_admin_bar_editor_pro' => [ 'title' => sprintf( esc_html__( 'I have %1$s Pro', 'admin-bar' ), JLT_ADMIN_BAR_EDITOR ), 'input_placeholder' => '', 'alert' => sprintf( esc_html__( 'Wait! Don\'t deactivate %1$s. You have to activate both %1$s and %1$s Pro in order for the plugin to work.', 'admin-bar' ), JLT_ADMIN_BAR_EDITOR ), ], 'need_better_design' => [ 'title' => esc_html__( 'I need better design and presets', 'admin-bar' ), 'input_placeholder' => esc_html__( 'Let us know your thoughts', 'admin-bar' ), ], 'other' => [ 'title' => esc_html__( 'Other', 'admin-bar' ), 'input_placeholder' => esc_html__( 'Please share the reason', 'admin-bar' ), ], ]; } /** * Deactivation Footer */ public function deactivation_footer(){ if(!$this->proceed()){ return; } ?>

get_survey_questions() as $reason_key => $reason){ ?>