apsl_settings = get_option( APSL_SETTINGS ); add_action('init', array($this, 'session_init')); //start the session if not started yet. register_activation_hook(__FILE__, array($this, 'plugin_activation')); //load the default setting for the plugin while activating add_action( 'init', array( $this, 'plugin_text_domain' ) ); //load the plugin text domain add_action( 'admin_menu', array( $this, 'add_apsl_menu' )); //register the plugin menu in backend add_action('admin_enqueue_scripts', array($this, 'register_admin_assets')); //registers all the assets required for wp-admin add_action('wp_enqueue_scripts', array($this, 'register_frontend_assets')); // registers all the assets required for the frontend add_action( 'admin_post_apsl_save_options', array($this, 'save_settings') ); //save settings of a plugin $options = get_option( APSL_SETTINGS ); if($options['apsl_enable_disable_plugin'] =='yes'){ if(in_array("login_form", $options['apsl_display_options'])) { add_action( 'login_form', array($this, 'add_social_login') ); // add the social logins to the login form } if( in_array("register_form", $options['apsl_display_options']) ) { add_action( 'register_form', array($this, 'add_social_login') ); //add the social logins to the registration form add_action('after_signup_form', array($this,'add_social_login') ); } if( in_array( "comment_form", $options['apsl_display_options'] ) ) { add_action( 'comment_form_top', array($this, 'add_social_login_form_to_comment') ); //add the social logins to the comment form } } add_shortcode('apsl-login-lite', array($this, 'apsl_shortcode')); //adds a shortcode add_action( 'init', array($this,'login_check') ); //check for the social logins add_action('widgets_init', array($this, 'register_apsl_widget')); //register the widget of a plugin add_action( 'login_enqueue_scripts', array($this, 'apsl_login_form_enqueue_style'), 10 ); add_action( 'login_enqueue_scripts', array($this, 'apsl_login_form__enqueue_script'), 1 ); add_action('admin_post_apsl_restore_default_settings',array($this,'apsl_restore_default_settings'));//restores default settings. } //starts the session with the call of init hook function session_init() { if (!session_id()) { session_start(); } } //load the default settings of the plugin function plugin_activation(){ if( !get_option( APSL_SETTINGS ) ){ include('inc/backend/activation.php'); } } //loads the text domain for translation function plugin_text_domain(){ load_plugin_textdomain( APSL_TEXT_DOMAIN, false, APSL_LANG_DIR ); } //register the plugin menu for backend. function add_apsl_menu(){ add_menu_page( 'AccessPress Social Login Lite', 'AccessPress Social Login Lite', 'manage_options', APSL_TEXT_DOMAIN , array( $this, 'main_page' ), APSL_IMAGE_DIR . '/icon.png' ); } //menu page function main_page(){ include( 'inc/backend/main-page.php' ); } //registration of the backend assets function register_admin_assets(){ wp_enqueue_style( 'fontawsome-css', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', '', APSL_VERSION ); if( isset($_GET['page']) && $_GET['page']== APSL_TEXT_DOMAIN ){ //backend scripts wp_enqueue_script( 'jquery-ui-sortable' ); wp_enqueue_script( 'apsl-admin-js', APSL_JS_DIR . '/backend.js', array( 'jquery', 'jquery-ui-sortable' ), APSL_VERSION );//registering plugin's admin js //register backend css wp_enqueue_style( 'apsl-backend-css', APSL_CSS_DIR.'/backend.css', '', APSL_VERSION ); } } //registration of the plugins frontend assets function register_frontend_assets(){ //register frontend scripts wp_enqueue_script('apsl-frontend-js', APSL_JS_DIR.'/frontend.js', array('jquery'), APSL_VERSION ); //register frontend css wp_enqueue_style( 'fontawsome-css', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', '', APSL_VERSION ); wp_enqueue_style( 'apsl-frontend-css', APSL_CSS_DIR.'/frontend.css', '', APSL_VERSION ); } //save the settings of a plugin function save_settings(){ if(isset($_POST['apsl_save_settings']) && $_POST['apsl_settings_action'] && wp_verify_nonce( $_POST['apsl_settings_action'], 'apsl_nonce_save_settings')){ include('inc/backend/save-settings.php'); }else{ die('No script kiddies please!'); } } //function to add the social login in the login and registration form. function add_social_login(){ if(!is_user_logged_in()){ include('inc/frontend/login_integration.php'); } } //function to add the social login in the comment form. function add_social_login_form_to_comment(){ ?>