page_slug = 'welcome'; $this->title = __( 'Welcome to Social Snap!', 'socialsnap' ); // Actions add_action( 'admin_menu', array( $this, 'register_pages' ), 12 ); add_action( 'admin_init', array( $this, 'redirect' ), 9999 ); add_action( 'admin_notices', array( $this, 'display_notices' ) ); // Add AJAX handler for subscribe add_action( 'wp_ajax_socialsnap_subscribe', array( $this, 'subscribe' ) ); } /** * Register the pages to be used for the Welcome screen (and tabs). * * These pages will be removed from the Dashboard menu, so they will * not actually show. * * @since 1.0.0 */ public function register_pages() { // Getting started - shows after installation add_submenu_page( 'socialsnap-settings', __( 'Welcome to Social Snap', 'socialsnap' ), __( 'About', 'socialsnap' ), apply_filters( 'socialsnap_welcome_cap', 'manage_options' ), 'about-socialsnap', array( $this, 'render' ) ); } /** * Welcome screen redirect. * * This function checks if a new install or update has just occured. If so, * then we redirect the user to the appropriate page. * * @since 1.0.0 */ public function redirect() { // Check if we should consider redirection. if ( ! get_site_transient( 'socialsnap_activation_redirect' ) ) { return; } // If we are redirecting, clear the transient so it only happens once. delete_site_transient( 'socialsnap_activation_redirect' ); // Check option to disable welcome redirect. if ( get_option( 'socialsnap_activation_redirect', false ) ) { return; } // Only do this for single site installs. if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; } // Initial install. wp_safe_redirect( admin_url( 'admin.php?page=about-socialsnap' ) ); exit; } /** * Build the output for the plugin welcome page. * * @since 1.0.0 */ public function render() { ?>

Social Snap — Start driving more traffic and increase engagement by leveraging the power of social media.', 'socialsnap' ); ?>

pro ? esc_html_e( 'Social Snap Features', 'socialsnap' ) : esc_html_e( 'Social Snap Lite Features', 'socialsnap' ); ?>

svg

pro ? __( 'See All Features', 'socialsnap' ) : __( 'See Premium Features', 'socialsnap' ); ?>
pro ) { ?>

39 per year
pro ) { $margin_top = ' style="margin-top: 25px;"'; } ?>

$email, ), 'https://socialsnap.com/wp-json/api/v1/subscribe' ); $args = array( 'user-agent' => 'SocialSnap/' . SOCIALSNAP_VERSION . '; ' . esc_url( home_url() ), ); // Send request to socialsnap.com $request = wp_remote_get( $url, $args ); if ( is_wp_error( $request ) ) { wp_send_json_error(); } if ( 200 !== wp_remote_retrieve_response_code( $request ) ) { wp_send_json_error(); } $response = json_decode( wp_remote_retrieve_body( $request ), true ); if ( ! isset( $response['success'] ) ) { wp_send_json_error(); } if ( false == $response['success'] ) { wp_send_json_error( array( 'message' => isset( $response['message'] ) ? esc_html( $response['message'] ) : __( 'Error. Please try again.', 'socialsnap' ), ) ); } wp_send_json_success( array( 'message' => isset( $response['message'] ) ? esc_html( $response['message'] ) : __( 'Success.', 'socialsnap' ), ) ); } /** * Outputs the Social Snap admin notices. * * @since 1.0.5 */ public function display_notices() { } } new SocialSnap_Welcome();