*/ class Subscribe extends Notice { use User_Data; public $color = 'warning'; /** * Construct method * * @author Jewel Theme */ public function __construct() { parent::__construct(); add_action( 'wp_ajax_jltwp_adminify_subscribe', array( $this, 'jltwp_adminify_subscribe' ) ); } /** * Subscribe method * * @author Jewel Theme */ public function jltwp_adminify_subscribe() { check_ajax_referer( 'jltwp_adminify_subscribe_nonce' ); $name = ! empty( $_POST['name'] ) ? sanitize_text_field( wp_unslash( $_POST['name'] ) ) : ''; $email = ! empty( $_POST['email'] ) ? sanitize_email( wp_unslash( $_POST['email'] ) ) : ''; if ( ! is_email( $email ) ) { $email = get_bloginfo( 'admin_email' ); } $author_obj = get_user_by( 'email', get_bloginfo( 'admin_email' ) ); $user_id = $author_obj->ID; // First Name & Last name . if ( ! empty( $name ) ) { $full_name = $name; } else { $full_name = $author_obj->display_name; } $response = $this->get_collect_data( $user_id, array( 'first_name' => $full_name, 'email' => $email, ) ); if ( ! is_wp_error( $response ) && 200 === $response['response']['code'] && 'OK' === $response['response']['message'] ) { wp_send_json_success( 'Thanks for Subscribe!' ); } else { wp_send_json_error( "Couldn't Subscribe" ); } } /** * Notice Header * * @author Jewel Theme */ public function notice_header() { return ''; } /** * Notice footer * * @author Jewel Theme */ public function notice_footer() { return ''; } /** * Set Title * * @author Jewel Theme */ public function set_title() { printf( '

Wanna get some discount for %1$s? No Worries!! We got you!! Enter your email, we will send you the discount code?

', esc_html__( 'WP Adminify', 'adminify' ) ); } /** * Notice Content * * @author Jewel Theme */ public function notice_content() { $userdata = \wp_get_current_user(); ?>
<?php esc_attr_e( 'Logo', 'adminify' ); ?>
set_title(); ?>
*/ public function plugin_rate_url() { return 'https://wordpress.org/plugins/' . WP_ADMINIFY_SLUG; } /** * Footer content * * @author Jewel Theme */ public function footer_content() { ?> */ public function intervals() { return array( 5, 4, 10, 20, 15, 25, 30, 40, 60, 90, 150 ); } /** * Core Script * * @param [type] $trigger_time . * * @return void * @author Jewel Theme */ public function core_script( $trigger_time ) { parent::core_script( $trigger_time ); ?>