Version Description
- Code optimization. Removal of unnecessary php opening and closing tags.
Download this release
Release Info
Developer | Access Keys |
Plugin | Social Login WordPress Plugin – AccessPress Social Login Lite |
Version | 2.0.6 |
Comparing to | |
See all releases |
Code changes from version 2.0.5 to 2.0.6
- accesspress-social-login-lite.php +101 -125
- inc/backend/activation.php +6 -31
- inc/backend/main-page.php +138 -125
- inc/backend/save-settings.php +19 -39
- inc/backend/widget.php +19 -24
- inc/frontend/login_check.php +191 -188
- inc/frontend/login_integration.php +3 -2
- readme.txt +6 -3
accesspress-social-login-lite.php
CHANGED
@@ -3,300 +3,276 @@
|
|
3 |
Plugin name: AccessPress Social Login Lite
|
4 |
Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-login-lite/
|
5 |
Description: A plugin to add various social logins to a site.
|
6 |
-
version: 2.0.
|
7 |
Author: AccessPress Themes
|
8 |
Author URI: https://accesspressthemes.com/
|
9 |
Text Domain: accesspress-social-login-lite
|
10 |
Domain Path: /languages/
|
11 |
License: GPLv2 or later
|
12 |
-
|
13 |
-
|
14 |
//Declearation of the necessary constants for plugin
|
15 |
-
if
|
16 |
-
define( 'APSL_VERSION', '2.0.
|
17 |
}
|
18 |
|
19 |
-
if
|
20 |
define( 'APSL_IMAGE_DIR', plugin_dir_url( __FILE__ ) . 'images' );
|
21 |
}
|
22 |
|
23 |
-
if
|
24 |
define( 'APSL_JS_DIR', plugin_dir_url( __FILE__ ) . 'js' );
|
25 |
}
|
26 |
|
27 |
-
if
|
28 |
define( 'APSL_CSS_DIR', plugin_dir_url( __FILE__ ) . 'css' );
|
29 |
}
|
30 |
|
31 |
-
if
|
32 |
define( 'APSL_LANG_DIR', basename( dirname( __FILE__ ) ) . '/languages/' );
|
33 |
}
|
34 |
|
35 |
-
if
|
36 |
define( 'APSL_TEXT_DOMAIN', 'accesspress-social-login-lite' );
|
37 |
}
|
38 |
|
39 |
-
if
|
40 |
define( 'APSL_SETTINGS', 'apsl-lite-settings' );
|
41 |
}
|
42 |
|
43 |
-
if
|
44 |
define( 'APSL_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
45 |
}
|
46 |
-
|
47 |
-
|
48 |
/**
|
49 |
* Register a widget
|
50 |
-
*
|
|
|
51 |
include_once( 'inc/backend/widget.php' );
|
52 |
-
|
53 |
// Redefine user notification function
|
54 |
-
if
|
55 |
-
|
56 |
function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {
|
57 |
$user = new WP_User( $user_id );
|
58 |
-
|
59 |
$user_login = stripslashes( $user->user_login );
|
60 |
$user_email = stripslashes( $user->user_email );
|
61 |
-
|
62 |
$message = sprintf( __( 'New user registration on your site %s:' ), get_option( 'blogname' ) ) . "\r\n\r\n";
|
63 |
-
$message
|
64 |
-
$message
|
65 |
-
$message
|
66 |
-
|
67 |
$headers = 'From:' . get_option( 'blogname' ) . ' <' . get_option( 'admin_email' ) . '>' . "\r\n";
|
68 |
@wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] New User Registration' ), get_option( 'blogname' ) ), $message, $headers );
|
69 |
-
|
70 |
-
if
|
71 |
-
|
72 |
-
|
73 |
$message = __( 'Hi there,' ) . "\r\n\r\n";
|
74 |
-
$message
|
75 |
-
$message
|
76 |
-
$message
|
77 |
-
$message
|
78 |
-
$message
|
79 |
-
$message
|
80 |
-
|
81 |
$headers = 'From:' . get_option( 'blogname' ) . ' <' . get_option( 'admin_email' ) . '>' . "\r\n";
|
82 |
-
|
83 |
wp_mail( $user_email, sprintf( __( '[%s] Your username and password' ), get_option( 'blogname' ) ), $message, $headers );
|
84 |
}
|
85 |
-
|
86 |
}
|
87 |
-
|
88 |
// Declaration of the class
|
89 |
-
if
|
90 |
-
|
91 |
class APSL_Lite_Class {
|
92 |
-
|
93 |
var $apsl_settings;
|
94 |
-
|
95 |
function __construct() {
|
96 |
$this->apsl_settings = get_option( APSL_SETTINGS );
|
97 |
-
add_action( 'init', array(
|
98 |
-
register_activation_hook( __FILE__, array(
|
99 |
-
add_action( 'init', array(
|
100 |
-
add_action( 'admin_menu', array(
|
101 |
-
add_action( 'admin_enqueue_scripts', array(
|
102 |
-
add_action( 'wp_enqueue_scripts', array(
|
103 |
-
add_action( 'admin_post_apsl_save_options', array(
|
104 |
-
|
105 |
$options = get_option( APSL_SETTINGS );
|
106 |
-
if
|
107 |
-
if
|
108 |
-
add_action( 'login_form', array(
|
|
|
109 |
}
|
110 |
-
|
111 |
-
if
|
112 |
-
add_action( 'register_form', array(
|
113 |
-
add_action( 'after_signup_form', array(
|
114 |
}
|
115 |
-
|
116 |
-
if
|
117 |
-
add_action( 'comment_form_top', array(
|
|
|
118 |
}
|
119 |
}
|
120 |
-
|
121 |
-
add_shortcode( 'apsl-login-lite', array(
|
122 |
-
add_action( 'init', array(
|
123 |
-
add_action( 'widgets_init', array(
|
124 |
-
add_action( 'login_enqueue_scripts', array(
|
125 |
-
add_action( 'login_enqueue_scripts', array(
|
126 |
-
add_action( 'admin_post_apsl_restore_default_settings', array(
|
127 |
-
|
|
|
128 |
/**
|
129 |
* Hook to display custom avatars
|
130 |
*/
|
131 |
-
add_filter( 'get_avatar', array(
|
132 |
}
|
133 |
-
|
134 |
function apsl_social_login_custom_avatar( $avatar, $mixed, $size, $default, $alt = '' ) {
|
135 |
$options = get_option( APSL_SETTINGS );
|
136 |
-
|
137 |
//Check if we have an user identifier
|
138 |
-
if
|
139 |
$user_id = $mixed;
|
140 |
}
|
141 |
-
|
142 |
//Check if we have an user email
|
143 |
-
elseif
|
144 |
$user_id = $user->ID;
|
145 |
}
|
146 |
//Check if we have an user object
|
147 |
-
elseif
|
148 |
$user_id = $mixed->user_id;
|
149 |
}
|
150 |
//None found
|
151 |
else {
|
152 |
$user_id = null;
|
153 |
}
|
154 |
-
|
155 |
//User found?
|
156 |
-
if
|
157 |
-
|
158 |
//Override current avatar ?
|
159 |
$override_avatar = true;
|
160 |
-
|
161 |
//Read the avatar
|
162 |
$user_meta_thumbnail = get_user_meta( $user_id, 'deuimage', true );
|
163 |
-
|
164 |
//read user details
|
165 |
$user_meta_name = get_user_meta( $user_id, 'first_name', true );
|
166 |
-
|
167 |
-
if
|
168 |
-
$user_picture =
|
169 |
-
|
170 |
//Avatar found?
|
171 |
-
if
|
172 |
return '<img alt="' . $user_meta_name . '" src="' . $user_picture . '" class="avatar apsl-avatar-social-login avatar-' . $size . ' photo" height="' . $size . '" width="' . $size . '" />';
|
173 |
}
|
174 |
}
|
175 |
}
|
176 |
return $avatar;
|
177 |
}
|
178 |
-
|
179 |
//starts the session with the call of init hook
|
180 |
function session_init() {
|
181 |
-
if
|
182 |
session_start();
|
183 |
}
|
184 |
}
|
185 |
-
|
186 |
//load the default settings of the plugin
|
187 |
function plugin_activation() {
|
188 |
-
if
|
189 |
-
include('inc/backend/activation.php');
|
190 |
}
|
191 |
}
|
192 |
-
|
193 |
//loads the text domain for translation
|
194 |
function plugin_text_domain() {
|
195 |
-
load_plugin_textdomain( 'accesspress-social-login-lite'
|
196 |
}
|
197 |
-
|
198 |
//register the plugin menu for backend.
|
199 |
function add_apsl_menu() {
|
200 |
-
add_menu_page( 'AccessPress Social Login Lite', 'AccessPress Social Login Lite', 'manage_options', 'accesspress-social-login-lite'
|
201 |
}
|
202 |
-
|
203 |
//menu page
|
204 |
function main_page() {
|
205 |
include( 'inc/backend/main-page.php' );
|
206 |
}
|
207 |
-
|
208 |
//registration of the backend assets
|
209 |
function register_admin_assets() {
|
210 |
wp_enqueue_style( 'fontawsome-css', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', '', APSL_VERSION );
|
211 |
-
if
|
212 |
//backend scripts
|
213 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
214 |
-
wp_enqueue_script( 'apsl-admin-js', APSL_JS_DIR . '/backend.js', array(
|
215 |
//register backend css
|
216 |
wp_enqueue_style( 'apsl-backend-css', APSL_CSS_DIR . '/backend.css', '', APSL_VERSION );
|
217 |
}
|
218 |
}
|
219 |
-
|
220 |
//registration of the plugins frontend assets
|
221 |
function register_frontend_assets() {
|
222 |
//register frontend scripts
|
223 |
-
wp_enqueue_script( 'apsl-frontend-js', APSL_JS_DIR . '/frontend.js', array(
|
224 |
-
|
225 |
//register frontend css
|
226 |
wp_enqueue_style( 'fontawsome-css', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', '', APSL_VERSION );
|
227 |
wp_enqueue_style( 'apsl-frontend-css', APSL_CSS_DIR . '/frontend.css', '', APSL_VERSION );
|
228 |
}
|
229 |
-
|
230 |
//save the settings of a plugin
|
231 |
function save_settings() {
|
232 |
-
if
|
233 |
-
include('inc/backend/save-settings.php');
|
234 |
-
}
|
|
|
235 |
die( 'No script kiddies please!' );
|
236 |
}
|
237 |
}
|
238 |
-
|
239 |
//function to add the social login in the login and registration form.
|
240 |
function add_social_login() {
|
241 |
-
if
|
242 |
-
include('inc/frontend/login_integration.php');
|
243 |
}
|
244 |
}
|
245 |
-
|
246 |
//function to add the social login in the comment form.
|
247 |
function add_social_login_form_to_comment() {
|
248 |
$options = get_option( APSL_SETTINGS );
|
249 |
$login_text = $options['apsl_title_text_field'];
|
250 |
-
if
|
251 |
-
?>
|
252 |
-
<?php
|
253 |
-
|
254 |
echo do_shortcode( "[apsl-login-lite login_text='{$login_text}']" );
|
255 |
}
|
256 |
}
|
257 |
-
|
258 |
//function for adding shortcode of a plugin
|
259 |
function apsl_shortcode( $attr ) {
|
260 |
ob_start();
|
261 |
-
include('inc/frontend/shortcode.php');
|
262 |
$html = ob_get_contents();
|
263 |
ob_get_clean();
|
264 |
return $html;
|
265 |
}
|
266 |
-
|
267 |
//checking of the login
|
268 |
function login_check() {
|
269 |
-
include('inc/frontend/login_check.php');
|
270 |
}
|
271 |
-
|
272 |
//registration of the social login widget
|
273 |
function register_apsl_widget() {
|
274 |
register_widget( 'APSL_Lite_Widget' );
|
275 |
}
|
276 |
-
|
277 |
function apsl_login_form_enqueue_style() {
|
278 |
wp_enqueue_style( 'fontawsome-css', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', '', APSL_VERSION );
|
279 |
wp_enqueue_style( 'apsl-backend-css', APSL_CSS_DIR . '/backend.css', '', APSL_VERSION );
|
280 |
wp_enqueue_style( 'apsl-frontend-css', APSL_CSS_DIR . '/frontend.css', '', APSL_VERSION );
|
281 |
}
|
282 |
-
|
283 |
function apsl_login_form__enqueue_script() {
|
284 |
-
wp_enqueue_script( 'apsl-admin-js', APSL_JS_DIR . '/backend.js', array(
|
|
|
285 |
}
|
286 |
-
|
287 |
function apsl_restore_default_settings() {
|
288 |
$nonce = $_REQUEST['_wpnonce'];
|
289 |
-
if
|
290 |
//restore the default plugin activation settings from the activation page.
|
291 |
include( 'inc/backend/activation.php' );
|
292 |
$_SESSION['apsl_message'] = __( 'Settings restored Successfully.', 'accesspress-social-login-lite' );
|
293 |
wp_redirect( admin_url() . 'admin.php?page=' . 'accesspress-social-login-lite' );
|
294 |
exit;
|
295 |
-
}
|
|
|
296 |
die( 'No script kiddies please!' );
|
297 |
}
|
298 |
}
|
|
|
299 |
|
300 |
-
}//class termination
|
301 |
}
|
302 |
$apsl_object = new APSL_Lite_Class();
|
3 |
Plugin name: AccessPress Social Login Lite
|
4 |
Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-login-lite/
|
5 |
Description: A plugin to add various social logins to a site.
|
6 |
+
version: 2.0.6
|
7 |
Author: AccessPress Themes
|
8 |
Author URI: https://accesspressthemes.com/
|
9 |
Text Domain: accesspress-social-login-lite
|
10 |
Domain Path: /languages/
|
11 |
License: GPLv2 or later
|
12 |
+
*/
|
|
|
13 |
//Declearation of the necessary constants for plugin
|
14 |
+
if( !defined( 'APSL_VERSION' ) ) {
|
15 |
+
define( 'APSL_VERSION', '2.0.6' );
|
16 |
}
|
17 |
|
18 |
+
if( !defined( 'APSL_IMAGE_DIR' ) ) {
|
19 |
define( 'APSL_IMAGE_DIR', plugin_dir_url( __FILE__ ) . 'images' );
|
20 |
}
|
21 |
|
22 |
+
if( !defined( 'APSL_JS_DIR' ) ) {
|
23 |
define( 'APSL_JS_DIR', plugin_dir_url( __FILE__ ) . 'js' );
|
24 |
}
|
25 |
|
26 |
+
if( !defined( 'APSL_CSS_DIR' ) ) {
|
27 |
define( 'APSL_CSS_DIR', plugin_dir_url( __FILE__ ) . 'css' );
|
28 |
}
|
29 |
|
30 |
+
if( !defined( 'APSL_LANG_DIR' ) ) {
|
31 |
define( 'APSL_LANG_DIR', basename( dirname( __FILE__ ) ) . '/languages/' );
|
32 |
}
|
33 |
|
34 |
+
if( !defined( 'APSL_TEXT_DOMAIN' ) ) {
|
35 |
define( 'APSL_TEXT_DOMAIN', 'accesspress-social-login-lite' );
|
36 |
}
|
37 |
|
38 |
+
if( !defined( 'APSL_SETTINGS' ) ) {
|
39 |
define( 'APSL_SETTINGS', 'apsl-lite-settings' );
|
40 |
}
|
41 |
|
42 |
+
if( !defined( 'APSL_PLUGIN_DIR' ) ) {
|
43 |
define( 'APSL_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
44 |
}
|
|
|
|
|
45 |
/**
|
46 |
* Register a widget
|
47 |
+
*
|
48 |
+
*/
|
49 |
include_once( 'inc/backend/widget.php' );
|
|
|
50 |
// Redefine user notification function
|
51 |
+
if( !function_exists( 'wp_new_user_notification' ) ) {
|
52 |
+
|
53 |
function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {
|
54 |
$user = new WP_User( $user_id );
|
55 |
+
|
56 |
$user_login = stripslashes( $user->user_login );
|
57 |
$user_email = stripslashes( $user->user_email );
|
58 |
+
|
59 |
$message = sprintf( __( 'New user registration on your site %s:' ), get_option( 'blogname' ) ) . "\r\n\r\n";
|
60 |
+
$message.= sprintf( __( 'Username: %s' ), $user_login ) . "\r\n\r\n";
|
61 |
+
$message.= sprintf( __( 'E-mail: %s' ), $user_email ) . "\r\n";
|
62 |
+
$message.= __( 'Thanks!' );
|
63 |
+
|
64 |
$headers = 'From:' . get_option( 'blogname' ) . ' <' . get_option( 'admin_email' ) . '>' . "\r\n";
|
65 |
@wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] New User Registration' ), get_option( 'blogname' ) ), $message, $headers );
|
66 |
+
|
67 |
+
if( empty( $plaintext_pass ) )return;
|
68 |
+
|
|
|
69 |
$message = __( 'Hi there,' ) . "\r\n\r\n";
|
70 |
+
$message.= sprintf( __( "Welcome to %s! Here's how to log in:" ), get_option( 'blogname' ) ) . "\r\n\r\n";
|
71 |
+
$message.= wp_login_url() . "\r\n";
|
72 |
+
$message.= sprintf( __( 'Username: %s' ), $user_login ) . "\r\n";
|
73 |
+
$message.= sprintf( __( 'Password: %s' ), $plaintext_pass ) . "\r\n\r\n";
|
74 |
+
$message.= sprintf( __( 'If you have any problems, please contact me at %s.' ), get_option( 'admin_email' ) ) . "\r\n\r\n";
|
75 |
+
$message.= __( 'Thanks!' );
|
76 |
+
|
77 |
$headers = 'From:' . get_option( 'blogname' ) . ' <' . get_option( 'admin_email' ) . '>' . "\r\n";
|
78 |
+
|
79 |
wp_mail( $user_email, sprintf( __( '[%s] Your username and password' ), get_option( 'blogname' ) ), $message, $headers );
|
80 |
}
|
|
|
81 |
}
|
|
|
82 |
// Declaration of the class
|
83 |
+
if( !class_exists( 'APSL_Lite_Class' ) ) {
|
84 |
+
|
85 |
class APSL_Lite_Class {
|
86 |
+
|
87 |
var $apsl_settings;
|
88 |
+
|
89 |
function __construct() {
|
90 |
$this->apsl_settings = get_option( APSL_SETTINGS );
|
91 |
+
add_action( 'init', array($this, 'session_init') ); //start the session if not started yet.
|
92 |
+
register_activation_hook( __FILE__, array($this, 'plugin_activation') ); //load the default setting for the plugin while activating
|
93 |
+
add_action( 'init', array($this, 'plugin_text_domain') ); //load the plugin text domain
|
94 |
+
add_action( 'admin_menu', array($this, 'add_apsl_menu') ); //register the plugin menu in backend
|
95 |
+
add_action( 'admin_enqueue_scripts', array($this, 'register_admin_assets') ); //registers all the assets required for wp-admin
|
96 |
+
add_action( 'wp_enqueue_scripts', array($this, 'register_frontend_assets') ); // registers all the assets required for the frontend
|
97 |
+
add_action( 'admin_post_apsl_save_options', array($this, 'save_settings') ); //save settings of a plugin
|
98 |
+
|
99 |
$options = get_option( APSL_SETTINGS );
|
100 |
+
if( $options['apsl_enable_disable_plugin'] == 'yes' ) {
|
101 |
+
if( in_array( "login_form", $options['apsl_display_options'] ) ) {
|
102 |
+
add_action( 'login_form', array($this, 'add_social_login') ); // add the social logins to the login form
|
103 |
+
|
104 |
}
|
105 |
+
|
106 |
+
if( in_array( "register_form", $options['apsl_display_options'] ) ) {
|
107 |
+
add_action( 'register_form', array($this, 'add_social_login') ); //add the social logins to the registration form
|
108 |
+
add_action( 'after_signup_form', array($this, 'add_social_login') );
|
109 |
}
|
110 |
+
|
111 |
+
if( in_array( "comment_form", $options['apsl_display_options'] ) ) {
|
112 |
+
add_action( 'comment_form_top', array($this, 'add_social_login_form_to_comment') ); //add the social logins to the comment form
|
113 |
+
|
114 |
}
|
115 |
}
|
116 |
+
|
117 |
+
add_shortcode( 'apsl-login-lite', array($this, 'apsl_shortcode') ); //adds a shortcode
|
118 |
+
add_action( 'init', array($this, 'login_check') ); //check for the social logins
|
119 |
+
add_action( 'widgets_init', array($this, 'register_apsl_widget') ); //register the widget of a plugin
|
120 |
+
add_action( 'login_enqueue_scripts', array($this, 'apsl_login_form_enqueue_style'), 10 );
|
121 |
+
add_action( 'login_enqueue_scripts', array($this, 'apsl_login_form__enqueue_script'), 1 );
|
122 |
+
add_action( 'admin_post_apsl_restore_default_settings', array($this, 'apsl_restore_default_settings') ); //restores default settings.
|
123 |
+
|
124 |
+
|
125 |
/**
|
126 |
* Hook to display custom avatars
|
127 |
*/
|
128 |
+
add_filter( 'get_avatar', array($this, 'apsl_social_login_custom_avatar'), 10, 5 );
|
129 |
}
|
130 |
+
|
131 |
function apsl_social_login_custom_avatar( $avatar, $mixed, $size, $default, $alt = '' ) {
|
132 |
$options = get_option( APSL_SETTINGS );
|
|
|
133 |
//Check if we have an user identifier
|
134 |
+
if( is_numeric( $mixed ) AND $mixed > 0 ) {
|
135 |
$user_id = $mixed;
|
136 |
}
|
|
|
137 |
//Check if we have an user email
|
138 |
+
elseif( is_string( $mixed ) AND( $user = get_user_by( 'email', $mixed ) ) ) {
|
139 |
$user_id = $user->ID;
|
140 |
}
|
141 |
//Check if we have an user object
|
142 |
+
elseif( is_object( $mixed ) AND property_exists( $mixed, 'user_id' ) AND is_numeric( $mixed->user_id ) ) {
|
143 |
$user_id = $mixed->user_id;
|
144 |
}
|
145 |
//None found
|
146 |
else {
|
147 |
$user_id = null;
|
148 |
}
|
|
|
149 |
//User found?
|
150 |
+
if( !empty( $user_id ) ) {
|
|
|
151 |
//Override current avatar ?
|
152 |
$override_avatar = true;
|
|
|
153 |
//Read the avatar
|
154 |
$user_meta_thumbnail = get_user_meta( $user_id, 'deuimage', true );
|
|
|
155 |
//read user details
|
156 |
$user_meta_name = get_user_meta( $user_id, 'first_name', true );
|
157 |
+
|
158 |
+
if( $options['apsl_user_avatar_options'] == 'social' ) {
|
159 |
+
$user_picture =( !empty( $user_meta_thumbnail ) ? $user_meta_thumbnail : '' );
|
|
|
160 |
//Avatar found?
|
161 |
+
if( $user_picture !== false AND strlen( trim( $user_picture ) ) > 0 ) {
|
162 |
return '<img alt="' . $user_meta_name . '" src="' . $user_picture . '" class="avatar apsl-avatar-social-login avatar-' . $size . ' photo" height="' . $size . '" width="' . $size . '" />';
|
163 |
}
|
164 |
}
|
165 |
}
|
166 |
return $avatar;
|
167 |
}
|
|
|
168 |
//starts the session with the call of init hook
|
169 |
function session_init() {
|
170 |
+
if( !session_id() ) {
|
171 |
session_start();
|
172 |
}
|
173 |
}
|
|
|
174 |
//load the default settings of the plugin
|
175 |
function plugin_activation() {
|
176 |
+
if( !get_option( APSL_SETTINGS ) ) {
|
177 |
+
include( 'inc/backend/activation.php' );
|
178 |
}
|
179 |
}
|
|
|
180 |
//loads the text domain for translation
|
181 |
function plugin_text_domain() {
|
182 |
+
load_plugin_textdomain( 'accesspress-social-login-lite', false, APSL_LANG_DIR );
|
183 |
}
|
|
|
184 |
//register the plugin menu for backend.
|
185 |
function add_apsl_menu() {
|
186 |
+
add_menu_page( 'AccessPress Social Login Lite', 'AccessPress Social Login Lite', 'manage_options', 'accesspress-social-login-lite', array($this, 'main_page'), APSL_IMAGE_DIR . '/icon.png' );
|
187 |
}
|
|
|
188 |
//menu page
|
189 |
function main_page() {
|
190 |
include( 'inc/backend/main-page.php' );
|
191 |
}
|
|
|
192 |
//registration of the backend assets
|
193 |
function register_admin_assets() {
|
194 |
wp_enqueue_style( 'fontawsome-css', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', '', APSL_VERSION );
|
195 |
+
if( isset( $_GET['page'] ) && $_GET['page'] == 'accesspress-social-login-lite' ) {
|
196 |
//backend scripts
|
197 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
198 |
+
wp_enqueue_script( 'apsl-admin-js', APSL_JS_DIR . '/backend.js', array('jquery', 'jquery-ui-sortable'), APSL_VERSION ); //registering plugin's admin js
|
199 |
//register backend css
|
200 |
wp_enqueue_style( 'apsl-backend-css', APSL_CSS_DIR . '/backend.css', '', APSL_VERSION );
|
201 |
}
|
202 |
}
|
|
|
203 |
//registration of the plugins frontend assets
|
204 |
function register_frontend_assets() {
|
205 |
//register frontend scripts
|
206 |
+
wp_enqueue_script( 'apsl-frontend-js', APSL_JS_DIR . '/frontend.js', array('jquery'), APSL_VERSION );
|
|
|
207 |
//register frontend css
|
208 |
wp_enqueue_style( 'fontawsome-css', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', '', APSL_VERSION );
|
209 |
wp_enqueue_style( 'apsl-frontend-css', APSL_CSS_DIR . '/frontend.css', '', APSL_VERSION );
|
210 |
}
|
|
|
211 |
//save the settings of a plugin
|
212 |
function save_settings() {
|
213 |
+
if( isset( $_POST['apsl_save_settings'] ) && $_POST['apsl_settings_action'] && wp_verify_nonce( $_POST['apsl_settings_action'], 'apsl_nonce_save_settings' ) ) {
|
214 |
+
include( 'inc/backend/save-settings.php' );
|
215 |
+
}
|
216 |
+
else {
|
217 |
die( 'No script kiddies please!' );
|
218 |
}
|
219 |
}
|
|
|
220 |
//function to add the social login in the login and registration form.
|
221 |
function add_social_login() {
|
222 |
+
if( !is_user_logged_in() ) {
|
223 |
+
include( 'inc/frontend/login_integration.php' );
|
224 |
}
|
225 |
}
|
|
|
226 |
//function to add the social login in the comment form.
|
227 |
function add_social_login_form_to_comment() {
|
228 |
$options = get_option( APSL_SETTINGS );
|
229 |
$login_text = $options['apsl_title_text_field'];
|
230 |
+
if( !is_user_logged_in() ) {
|
|
|
|
|
|
|
231 |
echo do_shortcode( "[apsl-login-lite login_text='{$login_text}']" );
|
232 |
}
|
233 |
}
|
|
|
234 |
//function for adding shortcode of a plugin
|
235 |
function apsl_shortcode( $attr ) {
|
236 |
ob_start();
|
237 |
+
include( 'inc/frontend/shortcode.php' );
|
238 |
$html = ob_get_contents();
|
239 |
ob_get_clean();
|
240 |
return $html;
|
241 |
}
|
|
|
242 |
//checking of the login
|
243 |
function login_check() {
|
244 |
+
include( 'inc/frontend/login_check.php' );
|
245 |
}
|
|
|
246 |
//registration of the social login widget
|
247 |
function register_apsl_widget() {
|
248 |
register_widget( 'APSL_Lite_Widget' );
|
249 |
}
|
250 |
+
|
251 |
function apsl_login_form_enqueue_style() {
|
252 |
wp_enqueue_style( 'fontawsome-css', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', '', APSL_VERSION );
|
253 |
wp_enqueue_style( 'apsl-backend-css', APSL_CSS_DIR . '/backend.css', '', APSL_VERSION );
|
254 |
wp_enqueue_style( 'apsl-frontend-css', APSL_CSS_DIR . '/frontend.css', '', APSL_VERSION );
|
255 |
}
|
256 |
+
|
257 |
function apsl_login_form__enqueue_script() {
|
258 |
+
wp_enqueue_script( 'apsl-admin-js', APSL_JS_DIR . '/backend.js', array('jquery', 'jquery-ui-sortable'), APSL_VERSION ); //registering plugin's admin js
|
259 |
+
|
260 |
}
|
261 |
+
|
262 |
function apsl_restore_default_settings() {
|
263 |
$nonce = $_REQUEST['_wpnonce'];
|
264 |
+
if( !empty( $_GET ) && wp_verify_nonce( $nonce, 'apsl-restore-default-settings-nonce' ) ) {
|
265 |
//restore the default plugin activation settings from the activation page.
|
266 |
include( 'inc/backend/activation.php' );
|
267 |
$_SESSION['apsl_message'] = __( 'Settings restored Successfully.', 'accesspress-social-login-lite' );
|
268 |
wp_redirect( admin_url() . 'admin.php?page=' . 'accesspress-social-login-lite' );
|
269 |
exit;
|
270 |
+
}
|
271 |
+
else {
|
272 |
die( 'No script kiddies please!' );
|
273 |
}
|
274 |
}
|
275 |
+
} //class termination
|
276 |
|
|
|
277 |
}
|
278 |
$apsl_object = new APSL_Lite_Class();
|
inc/backend/activation.php
CHANGED
@@ -1,48 +1,23 @@
|
|
1 |
<?php
|
2 |
-
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
3 |
-
<?php
|
4 |
$apsl_settings = array();
|
5 |
-
|
6 |
-
$social_networks = array(
|
7 |
-
0 => 'facebook',
|
8 |
-
1 => 'twitter',
|
9 |
-
2 => 'google'
|
10 |
-
);
|
11 |
|
12 |
$apsl_settings['network_ordering'] = $social_networks;
|
13 |
-
|
14 |
//facebook settings
|
15 |
-
$facebook_parameters = array(
|
16 |
-
'apsl_facebook_enable' => '0',
|
17 |
-
'apsl_facebook_app_id' => '',
|
18 |
-
'apsl_facebook_app_secret' => ''
|
19 |
-
);
|
20 |
$apsl_settings['apsl_facebook_settings'] = $facebook_parameters;
|
21 |
-
|
22 |
//twitter settings
|
23 |
-
$twitter_parameters = array(
|
24 |
-
'apsl_twitter_enable' => '0',
|
25 |
-
'apsl_twitter_api_key' => '',
|
26 |
-
'apsl_twitter_api_secret' => ''
|
27 |
-
);
|
28 |
$apsl_settings['apsl_twitter_settings'] = $twitter_parameters;
|
29 |
-
|
30 |
//google settings
|
31 |
-
$google_parameters = array(
|
32 |
-
'apsl_google_enable' => '0',
|
33 |
-
'apsl_google_client_id' => '',
|
34 |
-
'apsl_google_client_secret' => ''
|
35 |
-
);
|
36 |
|
37 |
$apsl_settings['apsl_google_settings'] = $google_parameters;
|
38 |
|
39 |
$apsl_settings['apsl_enable_disable_plugin'] = 'yes';
|
40 |
|
41 |
-
$display_options = array(
|
42 |
-
'login_form',
|
43 |
-
'register_form',
|
44 |
-
'comment_form'
|
45 |
-
);
|
46 |
$apsl_settings['apsl_display_options'] = $display_options;
|
47 |
|
48 |
$apsl_settings['apsl_icon_theme'] = '1';
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|
|
3 |
$apsl_settings = array();
|
4 |
+
$social_networks = array(0 => 'facebook', 1 => 'twitter', 2 => 'google');
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
$apsl_settings['network_ordering'] = $social_networks;
|
|
|
7 |
//facebook settings
|
8 |
+
$facebook_parameters = array('apsl_facebook_enable' => '0', 'apsl_facebook_app_id' => '', 'apsl_facebook_app_secret' => '');
|
|
|
|
|
|
|
|
|
9 |
$apsl_settings['apsl_facebook_settings'] = $facebook_parameters;
|
|
|
10 |
//twitter settings
|
11 |
+
$twitter_parameters = array('apsl_twitter_enable' => '0', 'apsl_twitter_api_key' => '', 'apsl_twitter_api_secret' => '');
|
|
|
|
|
|
|
|
|
12 |
$apsl_settings['apsl_twitter_settings'] = $twitter_parameters;
|
|
|
13 |
//google settings
|
14 |
+
$google_parameters = array('apsl_google_enable' => '0', 'apsl_google_client_id' => '', 'apsl_google_client_secret' => '');
|
|
|
|
|
|
|
|
|
15 |
|
16 |
$apsl_settings['apsl_google_settings'] = $google_parameters;
|
17 |
|
18 |
$apsl_settings['apsl_enable_disable_plugin'] = 'yes';
|
19 |
|
20 |
+
$display_options = array('login_form', 'register_form', 'comment_form');
|
|
|
|
|
|
|
|
|
21 |
$apsl_settings['apsl_display_options'] = $display_options;
|
22 |
|
23 |
$apsl_settings['apsl_icon_theme'] = '1';
|
inc/backend/main-page.php
CHANGED
@@ -37,17 +37,19 @@
|
|
37 |
<div class="clear"></div>
|
38 |
|
39 |
<?php
|
40 |
-
|
41 |
-
|
42 |
-
?>
|
43 |
|
44 |
-
|
|
|
|
|
45 |
<div class="apsl-message">
|
46 |
<p> <?php echo $_SESSION['apsl_message'];
|
47 |
-
|
48 |
</p>
|
49 |
</div>
|
50 |
-
<?php
|
|
|
51 |
<div class='apsl-networks'>
|
52 |
<div class='apsl-network-options'>
|
53 |
<form method="post" action="<?php echo admin_url() . 'admin-post.php' ?>">
|
@@ -65,11 +67,11 @@
|
|
65 |
<div class='apsl-tab-contents' id='tab-apsl-networks-settings'>
|
66 |
|
67 |
<div class='network-settings'>
|
68 |
-
<?php foreach
|
69 |
<?php
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
<div class='apsl-settings apsl-facebook-settings'>
|
74 |
<!-- Facebook Settings -->
|
75 |
<div class='apsl-label'><?php _e( "Facebook", 'accesspress-social-login-lite' ); ?><span class='apsl_show_hide' id='apsl_show_hide_<?php echo $value; ?>'><i class="fa fa-caret-down"></i></span> </div>
|
@@ -81,17 +83,17 @@
|
|
81 |
</div>
|
82 |
<div class='apsl-app-id-wrapper'>
|
83 |
<label><?php _e( 'App ID:', 'accesspress-social-login-lite' ); ?></label><input type='text' id='apsl-facebook-app-id' name='apsl_facebook_settings[apsl_facebook_app_id]' value='<?php
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
</div>
|
89 |
<div class='apsl-app-secret-wrapper'>
|
90 |
<label><?php _e( 'App Secret:', 'accesspress-social-login-lite' ); ?></label><input type='text' id='apsl-facebook-app-secret' name='apsl_facebook_settings[apsl_facebook_app_secret]' value='<?php
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
</div>
|
96 |
<div class='apsl-info'>
|
97 |
<span class='apsl-info-note'><?php _e( 'Note:', 'accesspress-social-login-lite' ); ?></span> <br />
|
@@ -111,9 +113,11 @@
|
|
111 |
</div>
|
112 |
</div>
|
113 |
</div>
|
114 |
-
<?php
|
|
|
115 |
|
116 |
-
<?php
|
|
|
117 |
<div class='apsl-settings apsl-twitter-settings'>
|
118 |
<!-- Twitter Settings -->
|
119 |
<div class='apsl-label'><?php _e( "Twitter", 'accesspress-social-login-lite' ); ?> <span class='apsl_show_hide' id='apsl_show_hide_<?php echo $value; ?>'><i class="fa fa-caret-down"></i></span> </div>
|
@@ -125,18 +129,18 @@
|
|
125 |
|
126 |
<div class='apsl-app-id-wrapper'>
|
127 |
<label><?php _e( 'Consumer Key (API Key):', 'accesspress-social-login-lite' ); ?></label><input type='text' id='apsl-twitter-app-id' name='apsl_twitter_settings[apsl_twitter_api_key]' value='<?php
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
</div>
|
133 |
|
134 |
<div class='apsl-app-secret-wrapper'>
|
135 |
<label><?php _e( 'Consumer Secret (API Secret):', 'accesspress-social-login-lite' ); ?></label><input type='text' id='apsl-twitter-app-secret' name='apsl_twitter_settings[apsl_twitter_api_secret]' value='<?php
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
</div>
|
141 |
|
142 |
<input type='hidden' name='network_ordering[]' value='twitter' />
|
@@ -153,13 +157,12 @@
|
|
153 |
</ul>
|
154 |
|
155 |
</div>
|
156 |
-
</div>
|
157 |
</div>
|
158 |
<?php
|
159 |
-
|
160 |
-
|
161 |
case 'google':
|
162 |
-
|
163 |
<div class='apsl-settings apsl-google-settings'>
|
164 |
<!-- Google Settings -->
|
165 |
<div class='apsl-label'><?php _e( "Google", 'accesspress-social-login-lite' ); ?> <span class='apsl_show_hide' id='apsl_show_hide_<?php echo $value; ?>'><i class="fa fa-caret-down"></i></span> </div>
|
@@ -170,17 +173,17 @@
|
|
170 |
</div>
|
171 |
<div class='apsl-app-id-wrapper'>
|
172 |
<label><?php _e( 'Client ID:', 'accesspress-social-login-lite' ); ?></label><input type='text' id='apsl-google-client-id' name='apsl_google_settings[apsl_google_client_id]' value='<?php
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
</div>
|
178 |
<div class='apsl-app-secret-wrapper'>
|
179 |
<label><?php _e( 'Client Secret:', 'accesspress-social-login-lite' ); ?></label><input type='text' id='apsl-google-client-secret' name='apsl_google_settings[apsl_google_client_secret]' value='<?php
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
</div>
|
185 |
<input type='hidden' name='network_ordering[]' value='google' />
|
186 |
<div class='apsl-info'>
|
@@ -205,18 +208,20 @@
|
|
205 |
</li>
|
206 |
</ul>
|
207 |
</div>
|
208 |
-
</div>
|
209 |
</div>
|
210 |
-
<?php
|
|
|
211 |
|
212 |
<?php
|
213 |
default:
|
214 |
echo "should not reach here";
|
215 |
-
|
216 |
}
|
217 |
-
|
218 |
-
<?php
|
219 |
-
|
|
|
220 |
</div>
|
221 |
|
222 |
<div class='apsl-tab-contents' id='tab-apsl-theme-settings' style="display:none">
|
@@ -240,19 +245,19 @@
|
|
240 |
<div class='apsl_network_settings_wrapper' style='display:none'>
|
241 |
<p><?php _e( 'Please choose the options where you want to display the social login form.', 'accesspress-social-login-lite' ); ?></p>
|
242 |
<p><input type="checkbox" id="apsl_login_form" value="login_form" name="apsl_display_options[]" <?php
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
?> ><label for="apsl_login_form"><?php _e( 'Login Form', 'accesspress-social-login-lite' ); ?> </label></p>
|
247 |
<p><input type="checkbox" id="apsl_register_form" value="register_form" name="apsl_display_options[]" <?php
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
?> ><label for="apsl_register_form"><?php _e( 'Register Form', 'accesspress-social-login-lite' ); ?> </label></p>
|
252 |
<p><input type="checkbox" id="apsl_comment_form" value="comment_form" name="apsl_display_options[]" <?php
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
?> ><label for="apsl_comment_form"><?php _e( 'Comments', 'accesspress-social-login-lite' ); ?> </label></p>
|
257 |
</div>
|
258 |
</div>
|
@@ -262,7 +267,7 @@
|
|
262 |
<div class='apsl-themes-wrapper'>
|
263 |
<div class="apsl-label"><?php _e( 'Available icon themes', 'accesspress-social-login-lite' ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
264 |
<div class='apsl_network_settings_wrapper' style='display:none'>
|
265 |
-
<?php for
|
266 |
<div class='apsl-theme apsl-theme-<?php echo $i; ?>'>
|
267 |
<label><input type="radio" id="apsl-theme-<?php echo $i; ?>" value="<?php echo $i; ?>" class="apsl-theme apsl-png-theme" name="apsl_icon_theme" <?php checked( $i, $options['apsl_icon_theme'] ); ?> >
|
268 |
<span><?php _e( 'Theme ' . $i, 'accesspress-social-login-lite' ); ?></span></label>
|
@@ -270,7 +275,8 @@
|
|
270 |
<img src="<?php echo APSL_IMAGE_DIR; ?>/preview-<?php echo $i; ?>.jpg" alt="theme preview">
|
271 |
</div>
|
272 |
</div>
|
273 |
-
<?php
|
|
|
274 |
</div>
|
275 |
</div>
|
276 |
</div>
|
@@ -281,12 +287,12 @@
|
|
281 |
<div class='apsl_network_settings_wrapper' style='display:none'>
|
282 |
<p class='apsl-title-text-field'>
|
283 |
<span><?php _e( 'Login text:', 'accesspress-social-login-lite' ); ?></span> <input type='text' name='apsl_title_text_field' id='apsl-title-text' value='<?php
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
</p>
|
289 |
-
</div>
|
290 |
</div>
|
291 |
</div>
|
292 |
|
@@ -295,34 +301,37 @@
|
|
295 |
<div class="apsl-label"><?php _e( 'Logout redirect link', 'accesspress-social-login-lite' ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
296 |
<div class='apsl_network_settings_wrapper' style='display:none'>
|
297 |
<input type='radio' id='apsl_custom_logout_redirect_home' class='apsl_custom_logout_redirect_options' name='apsl_custom_logout_redirect_options' value='home' <?php
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
<input type='radio' id='apsl_custom_logout_redirect_current' class='apsl_custom_logout_redirect_options' name='apsl_custom_logout_redirect_options' value='current_page' <?php
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
|
308 |
|
309 |
<input type='radio' id='apsl_custom_logout_redirect_custom' class='apsl_custom_logout_redirect_options' name='apsl_custom_logout_redirect_options' value='custom_page' <?php
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
<div class='apsl-custom-logout-redirect-link' <?php if
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
|
|
|
|
|
|
320 |
<p class='apsl-title-text-field'>
|
321 |
<span><?php _e( 'Logout redirect page:', 'accesspress-social-login-lite' ); ?></span> <input type='text' name='apsl_custom_logout_redirect_link' id='apsl-custom-logout-redirect-link' value='<?php
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
</p>
|
327 |
<div class='apsl-info'>
|
328 |
<span class='apsl-info-note'><?php _e( 'Note:', 'accesspress-social-login-lite' ); ?></span> <br />
|
@@ -334,19 +343,20 @@
|
|
334 |
</div>
|
335 |
|
336 |
<div class='apsl-settings'>
|
337 |
-
<div class='apsl-login-
|
|
|
338 |
<div class="apsl-label"><?php _e( 'Login redirect link', 'accesspress-social-login-lite' ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
339 |
<div class='apsl_network_settings_wrapper' style='display:none'>
|
340 |
<input type='radio' id='apsl_custom_login_redirect_home' class='apsl_custom_login_redirect_options' name='apsl_custom_login_redirect_options' value='home' <?php
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
<input type='radio' id='apsl_custom_login_redirect_current' class='apsl_custom_login_redirect_options' name='apsl_custom_login_redirect_options' value='current_page' <?php
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
<div class='apsl-custom-login-redirect-link1' >
|
351 |
<div class='apsl-info'>
|
352 |
<span class='apsl-info-note'><?php _e( 'Note:', 'accesspress-social-login-lite' ); ?></span> <br />
|
@@ -354,22 +364,25 @@
|
|
354 |
</div>
|
355 |
</div>
|
356 |
<input type='radio' id='apsl_custom_login_redirect_custom' class='apsl_custom_login_redirect_options' name='apsl_custom_login_redirect_options' value='custom_page' <?php
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
<div class='apsl-custom-login-redirect-link' <?php if
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
|
|
|
|
|
|
367 |
<p class='apsl-title-text-field'>
|
368 |
<span><?php _e( 'Login redirect page:', 'accesspress-social-login-lite' ); ?></span> <input type='text' name='apsl_custom_login_redirect_link' id='apsl-custom-login-redirect-link' value='<?php
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
</p>
|
374 |
<div class='apsl-info'>
|
375 |
<span class='apsl-info-note'><?php _e( 'Note:', 'accesspress-social-login-lite' ); ?></span> <br />
|
@@ -385,15 +398,15 @@
|
|
385 |
<div class="apsl-label"><?php _e( 'User avatar', 'accesspress-social-login-lite' ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
386 |
<div class='apsl_network_settings_wrapper apsl_network_settings_outer' style='display:none'>
|
387 |
<input type='radio' id='apsl_user_avatar_default' class='apsl_user_avatar_options' name='apsl_user_avatar_options' value='default' <?php
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
<input type='radio' id='apsl_user_avatar_social' class='apsl_user_avatar_options' name='apsl_user_avatar_options' value='social' <?php
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
<div class='apsl-info'>
|
398 |
<span class='apsl-info-note'><?php _e( 'Note:', 'accesspress-social-login-lite' ); ?></span> <br />
|
399 |
<span class='apsl-info-content'>Please choose the options from where you want your users avatar to be loaded from. If you choose default wordpress avatar it will use the gravatar profile image if user have gravatar profile assocated with their registered email address.</span>
|
@@ -407,15 +420,15 @@
|
|
407 |
<div class="apsl-label"><?php _e( 'Email notification settings', 'accesspress-social-login-lite' ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
408 |
<div class='apsl_network_settings_wrapper apsl_network_settings_outer' style='display:none'>
|
409 |
<input type='radio' id='apsl_send_email_notification_yes' class='apsl_send_email_notification_yes' name='apsl_send_email_notification_options' value='yes' <?php
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
<input type='radio' id='apsl_send_email_notification_no' class='apsl_send_email_notification_no' name='apsl_send_email_notification_options' value='no' <?php
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
<div class='apsl-info'>
|
420 |
<span class='apsl-info-note'><?php _e( 'Note:', 'accesspress-social-login-lite' ); ?></span> <br />
|
421 |
<span class='apsl-info-content'>Here you can configure an options to send email notifications about user registration to site admin and user.</span>
|
@@ -429,12 +442,12 @@
|
|
429 |
|
430 |
<!-- how to use section -->
|
431 |
<div class='apsl-tab-contents' id='tab-apsl-how-to-use' style="display:none">
|
432 |
-
<?php include(APSL_PLUGIN_DIR . 'inc/backend/how-to-use.php'); ?>
|
433 |
</div>
|
434 |
|
435 |
<!-- about section -->
|
436 |
<div class='apsl-tab-contents' id='tab-apsl-about' style="display:none">
|
437 |
-
<?php include(APSL_PLUGIN_DIR . 'inc/backend/about.php'); ?>
|
438 |
</div>
|
439 |
|
440 |
<!-- Save settings Button -->
|
37 |
<div class="clear"></div>
|
38 |
|
39 |
<?php
|
40 |
+
$options = get_option( APSL_SETTINGS );
|
41 |
+
//$this->print_array($options);
|
|
|
42 |
|
43 |
+
?>
|
44 |
+
|
45 |
+
<?php if( isset( $_SESSION['apsl_message'] ) ) { ?>
|
46 |
<div class="apsl-message">
|
47 |
<p> <?php echo $_SESSION['apsl_message'];
|
48 |
+
unset( $_SESSION['apsl_message'] ); ?>
|
49 |
</p>
|
50 |
</div>
|
51 |
+
<?php
|
52 |
+
} ?>
|
53 |
<div class='apsl-networks'>
|
54 |
<div class='apsl-network-options'>
|
55 |
<form method="post" action="<?php echo admin_url() . 'admin-post.php' ?>">
|
67 |
<div class='apsl-tab-contents' id='tab-apsl-networks-settings'>
|
68 |
|
69 |
<div class='network-settings'>
|
70 |
+
<?php foreach( $options['network_ordering'] as $key => $value ): ?>
|
71 |
<?php
|
72 |
+
switch( $value ) {
|
73 |
+
case 'facebook':
|
74 |
+
?>
|
75 |
<div class='apsl-settings apsl-facebook-settings'>
|
76 |
<!-- Facebook Settings -->
|
77 |
<div class='apsl-label'><?php _e( "Facebook", 'accesspress-social-login-lite' ); ?><span class='apsl_show_hide' id='apsl_show_hide_<?php echo $value; ?>'><i class="fa fa-caret-down"></i></span> </div>
|
83 |
</div>
|
84 |
<div class='apsl-app-id-wrapper'>
|
85 |
<label><?php _e( 'App ID:', 'accesspress-social-login-lite' ); ?></label><input type='text' id='apsl-facebook-app-id' name='apsl_facebook_settings[apsl_facebook_app_id]' value='<?php
|
86 |
+
if( isset( $options['apsl_facebook_settings']['apsl_facebook_app_id'] ) ) {
|
87 |
+
echo $options['apsl_facebook_settings']['apsl_facebook_app_id'];
|
88 |
+
}
|
89 |
+
?>' />
|
90 |
</div>
|
91 |
<div class='apsl-app-secret-wrapper'>
|
92 |
<label><?php _e( 'App Secret:', 'accesspress-social-login-lite' ); ?></label><input type='text' id='apsl-facebook-app-secret' name='apsl_facebook_settings[apsl_facebook_app_secret]' value='<?php
|
93 |
+
if( isset( $options['apsl_facebook_settings']['apsl_facebook_app_secret'] ) ) {
|
94 |
+
echo $options['apsl_facebook_settings']['apsl_facebook_app_secret'];
|
95 |
+
}
|
96 |
+
?>' />
|
97 |
</div>
|
98 |
<div class='apsl-info'>
|
99 |
<span class='apsl-info-note'><?php _e( 'Note:', 'accesspress-social-login-lite' ); ?></span> <br />
|
113 |
</div>
|
114 |
</div>
|
115 |
</div>
|
116 |
+
<?php
|
117 |
+
break; ?>
|
118 |
|
119 |
+
<?php
|
120 |
+
case 'twitter': ?>
|
121 |
<div class='apsl-settings apsl-twitter-settings'>
|
122 |
<!-- Twitter Settings -->
|
123 |
<div class='apsl-label'><?php _e( "Twitter", 'accesspress-social-login-lite' ); ?> <span class='apsl_show_hide' id='apsl_show_hide_<?php echo $value; ?>'><i class="fa fa-caret-down"></i></span> </div>
|
129 |
|
130 |
<div class='apsl-app-id-wrapper'>
|
131 |
<label><?php _e( 'Consumer Key (API Key):', 'accesspress-social-login-lite' ); ?></label><input type='text' id='apsl-twitter-app-id' name='apsl_twitter_settings[apsl_twitter_api_key]' value='<?php
|
132 |
+
if( isset( $options['apsl_twitter_settings']['apsl_twitter_api_key'] ) ) {
|
133 |
+
echo $options['apsl_twitter_settings']['apsl_twitter_api_key'];
|
134 |
+
}
|
135 |
+
?>' />
|
136 |
</div>
|
137 |
|
138 |
<div class='apsl-app-secret-wrapper'>
|
139 |
<label><?php _e( 'Consumer Secret (API Secret):', 'accesspress-social-login-lite' ); ?></label><input type='text' id='apsl-twitter-app-secret' name='apsl_twitter_settings[apsl_twitter_api_secret]' value='<?php
|
140 |
+
if( isset( $options['apsl_twitter_settings']['apsl_twitter_api_secret'] ) ) {
|
141 |
+
echo $options['apsl_twitter_settings']['apsl_twitter_api_secret'];
|
142 |
+
}
|
143 |
+
?>' />
|
144 |
</div>
|
145 |
|
146 |
<input type='hidden' name='network_ordering[]' value='twitter' />
|
157 |
</ul>
|
158 |
|
159 |
</div>
|
160 |
+
</div>
|
161 |
</div>
|
162 |
<?php
|
163 |
+
break;
|
|
|
164 |
case 'google':
|
165 |
+
?>
|
166 |
<div class='apsl-settings apsl-google-settings'>
|
167 |
<!-- Google Settings -->
|
168 |
<div class='apsl-label'><?php _e( "Google", 'accesspress-social-login-lite' ); ?> <span class='apsl_show_hide' id='apsl_show_hide_<?php echo $value; ?>'><i class="fa fa-caret-down"></i></span> </div>
|
173 |
</div>
|
174 |
<div class='apsl-app-id-wrapper'>
|
175 |
<label><?php _e( 'Client ID:', 'accesspress-social-login-lite' ); ?></label><input type='text' id='apsl-google-client-id' name='apsl_google_settings[apsl_google_client_id]' value='<?php
|
176 |
+
if( isset( $options['apsl_google_settings']['apsl_google_client_id'] ) ) {
|
177 |
+
echo $options['apsl_google_settings']['apsl_google_client_id'];
|
178 |
+
}
|
179 |
+
?>' />
|
180 |
</div>
|
181 |
<div class='apsl-app-secret-wrapper'>
|
182 |
<label><?php _e( 'Client Secret:', 'accesspress-social-login-lite' ); ?></label><input type='text' id='apsl-google-client-secret' name='apsl_google_settings[apsl_google_client_secret]' value='<?php
|
183 |
+
if( isset( $options['apsl_google_settings']['apsl_google_client_secret'] ) ) {
|
184 |
+
echo $options['apsl_google_settings']['apsl_google_client_secret'];
|
185 |
+
}
|
186 |
+
?>' />
|
187 |
</div>
|
188 |
<input type='hidden' name='network_ordering[]' value='google' />
|
189 |
<div class='apsl-info'>
|
208 |
</li>
|
209 |
</ul>
|
210 |
</div>
|
211 |
+
</div>
|
212 |
</div>
|
213 |
+
<?php
|
214 |
+
break; ?>
|
215 |
|
216 |
<?php
|
217 |
default:
|
218 |
echo "should not reach here";
|
219 |
+
break;
|
220 |
}
|
221 |
+
?>
|
222 |
+
<?php
|
223 |
+
endforeach; ?>
|
224 |
+
</div>
|
225 |
</div>
|
226 |
|
227 |
<div class='apsl-tab-contents' id='tab-apsl-theme-settings' style="display:none">
|
245 |
<div class='apsl_network_settings_wrapper' style='display:none'>
|
246 |
<p><?php _e( 'Please choose the options where you want to display the social login form.', 'accesspress-social-login-lite' ); ?></p>
|
247 |
<p><input type="checkbox" id="apsl_login_form" value="login_form" name="apsl_display_options[]" <?php
|
248 |
+
if( in_array( "login_form", $options['apsl_display_options'] ) ) {
|
249 |
+
echo "checked='checked'";
|
250 |
+
}
|
251 |
?> ><label for="apsl_login_form"><?php _e( 'Login Form', 'accesspress-social-login-lite' ); ?> </label></p>
|
252 |
<p><input type="checkbox" id="apsl_register_form" value="register_form" name="apsl_display_options[]" <?php
|
253 |
+
if( in_array( "register_form", $options['apsl_display_options'] ) ) {
|
254 |
+
echo "checked='checked'";
|
255 |
+
}
|
256 |
?> ><label for="apsl_register_form"><?php _e( 'Register Form', 'accesspress-social-login-lite' ); ?> </label></p>
|
257 |
<p><input type="checkbox" id="apsl_comment_form" value="comment_form" name="apsl_display_options[]" <?php
|
258 |
+
if( in_array( "comment_form", $options['apsl_display_options'] ) ) {
|
259 |
+
echo "checked='checked'";
|
260 |
+
}
|
261 |
?> ><label for="apsl_comment_form"><?php _e( 'Comments', 'accesspress-social-login-lite' ); ?> </label></p>
|
262 |
</div>
|
263 |
</div>
|
267 |
<div class='apsl-themes-wrapper'>
|
268 |
<div class="apsl-label"><?php _e( 'Available icon themes', 'accesspress-social-login-lite' ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
269 |
<div class='apsl_network_settings_wrapper' style='display:none'>
|
270 |
+
<?php for( $i = 1;$i <= 4;$i++ ): ?>
|
271 |
<div class='apsl-theme apsl-theme-<?php echo $i; ?>'>
|
272 |
<label><input type="radio" id="apsl-theme-<?php echo $i; ?>" value="<?php echo $i; ?>" class="apsl-theme apsl-png-theme" name="apsl_icon_theme" <?php checked( $i, $options['apsl_icon_theme'] ); ?> >
|
273 |
<span><?php _e( 'Theme ' . $i, 'accesspress-social-login-lite' ); ?></span></label>
|
275 |
<img src="<?php echo APSL_IMAGE_DIR; ?>/preview-<?php echo $i; ?>.jpg" alt="theme preview">
|
276 |
</div>
|
277 |
</div>
|
278 |
+
<?php
|
279 |
+
endfor; ?>
|
280 |
</div>
|
281 |
</div>
|
282 |
</div>
|
287 |
<div class='apsl_network_settings_wrapper' style='display:none'>
|
288 |
<p class='apsl-title-text-field'>
|
289 |
<span><?php _e( 'Login text:', 'accesspress-social-login-lite' ); ?></span> <input type='text' name='apsl_title_text_field' id='apsl-title-text' value='<?php
|
290 |
+
if( isset( $options['apsl_title_text_field'] ) && $options['apsl_title_text_field'] != '' ) {
|
291 |
+
echo $options['apsl_title_text_field'];
|
292 |
+
}
|
293 |
+
?>' />
|
294 |
</p>
|
295 |
+
</div>
|
296 |
</div>
|
297 |
</div>
|
298 |
|
301 |
<div class="apsl-label"><?php _e( 'Logout redirect link', 'accesspress-social-login-lite' ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
302 |
<div class='apsl_network_settings_wrapper' style='display:none'>
|
303 |
<input type='radio' id='apsl_custom_logout_redirect_home' class='apsl_custom_logout_redirect_options' name='apsl_custom_logout_redirect_options' value='home' <?php
|
304 |
+
if( isset( $options['apsl_custom_logout_redirect_options'] ) ) {
|
305 |
+
checked( $options['apsl_custom_logout_redirect_options'], 'home', 'true' );
|
306 |
+
}
|
307 |
+
?> /> <label for='apsl_custom_logout_redirect_home'><?php _e( 'Home page', 'accesspress-social-login-lite' ); ?></label><br /><br />
|
308 |
<input type='radio' id='apsl_custom_logout_redirect_current' class='apsl_custom_logout_redirect_options' name='apsl_custom_logout_redirect_options' value='current_page' <?php
|
309 |
+
if( isset( $options['apsl_custom_logout_redirect_options'] ) ) {
|
310 |
+
checked( $options['apsl_custom_logout_redirect_options'], 'current_page', 'true' );
|
311 |
+
}
|
312 |
+
?> /> <label for='apsl_custom_logout_redirect_current'><?php _e( 'Current page', 'accesspress-social-login-lite' ); ?></label><br /><br />
|
313 |
|
314 |
|
315 |
<input type='radio' id='apsl_custom_logout_redirect_custom' class='apsl_custom_logout_redirect_options' name='apsl_custom_logout_redirect_options' value='custom_page' <?php
|
316 |
+
if( isset( $options['apsl_custom_logout_redirect_options'] ) ) {
|
317 |
+
checked( $options['apsl_custom_logout_redirect_options'], 'custom_page', 'true' );
|
318 |
+
}
|
319 |
+
?> /> <label for='apsl_custom_logout_redirect_custom'><?php _e( 'Custom page', 'accesspress-social-login-lite' ); ?></label><br />
|
320 |
+
|
321 |
+
<div class='apsl-custom-logout-redirect-link' <?php if( isset( $options['apsl_custom_logout_redirect_options'] ) ) {
|
322 |
+
if( $options['apsl_custom_logout_redirect_options'] == 'custom_page' ) {
|
323 |
+
?> style='display: block' <?php
|
324 |
+
}
|
325 |
+
else { ?> style='display:none' <?php
|
326 |
+
}
|
327 |
+
}
|
328 |
+
?>>
|
329 |
<p class='apsl-title-text-field'>
|
330 |
<span><?php _e( 'Logout redirect page:', 'accesspress-social-login-lite' ); ?></span> <input type='text' name='apsl_custom_logout_redirect_link' id='apsl-custom-logout-redirect-link' value='<?php
|
331 |
+
if( isset( $options['apsl_custom_logout_redirect_link'] ) && $options['apsl_custom_logout_redirect_link'] != '' ) {
|
332 |
+
echo $options['apsl_custom_logout_redirect_link'];
|
333 |
+
}
|
334 |
+
?>' />
|
335 |
</p>
|
336 |
<div class='apsl-info'>
|
337 |
<span class='apsl-info-note'><?php _e( 'Note:', 'accesspress-social-login-lite' ); ?></span> <br />
|
343 |
</div>
|
344 |
|
345 |
<div class='apsl-settings'>
|
346 |
+
<div class='apsl-login-redir
|
347 |
+
ect-settings'>
|
348 |
<div class="apsl-label"><?php _e( 'Login redirect link', 'accesspress-social-login-lite' ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
349 |
<div class='apsl_network_settings_wrapper' style='display:none'>
|
350 |
<input type='radio' id='apsl_custom_login_redirect_home' class='apsl_custom_login_redirect_options' name='apsl_custom_login_redirect_options' value='home' <?php
|
351 |
+
if( isset( $options['apsl_custom_login_redirect_options'] ) ) {
|
352 |
+
checked( $options['apsl_custom_login_redirect_options'], 'home', 'true' );
|
353 |
+
}
|
354 |
+
?> /> <label for='apsl_custom_login_redirect_home'><?php _e( 'Home page', 'accesspress-social-login-lite' ); ?></label><br /><br />
|
355 |
<input type='radio' id='apsl_custom_login_redirect_current' class='apsl_custom_login_redirect_options' name='apsl_custom_login_redirect_options' value='current_page' <?php
|
356 |
+
if( isset( $options['apsl_custom_login_redirect_options'] ) ) {
|
357 |
+
checked( $options['apsl_custom_login_redirect_options'], 'current_page', 'true' );
|
358 |
+
}
|
359 |
+
?> /> <label for='apsl_custom_login_redirect_current'><?php _e( 'Current page', 'accesspress-social-login-lite' ); ?></label><br /><br />
|
360 |
<div class='apsl-custom-login-redirect-link1' >
|
361 |
<div class='apsl-info'>
|
362 |
<span class='apsl-info-note'><?php _e( 'Note:', 'accesspress-social-login-lite' ); ?></span> <br />
|
364 |
</div>
|
365 |
</div>
|
366 |
<input type='radio' id='apsl_custom_login_redirect_custom' class='apsl_custom_login_redirect_options' name='apsl_custom_login_redirect_options' value='custom_page' <?php
|
367 |
+
if( isset( $options['apsl_custom_login_redirect_options'] ) ) {
|
368 |
+
checked( $options['apsl_custom_login_redirect_options'], 'custom_page', 'true' );
|
369 |
+
}
|
370 |
+
?> /> <label for='apsl_custom_login_redirect_custom'><?php _e( 'Custom page', 'accesspress-social-login-lite' ); ?></label><br />
|
371 |
+
|
372 |
+
<div class='apsl-custom-login-redirect-link' <?php if( isset( $options['apsl_custom_login_redirect_options'] ) ) {
|
373 |
+
if( $options['apsl_custom_login_redirect_options'] == 'custom_page' ) {
|
374 |
+
?> style='display: block' <?php
|
375 |
+
}
|
376 |
+
else { ?> style='display:none' <?php
|
377 |
+
}
|
378 |
+
}
|
379 |
+
?>>
|
380 |
<p class='apsl-title-text-field'>
|
381 |
<span><?php _e( 'Login redirect page:', 'accesspress-social-login-lite' ); ?></span> <input type='text' name='apsl_custom_login_redirect_link' id='apsl-custom-login-redirect-link' value='<?php
|
382 |
+
if( isset( $options['apsl_custom_login_redirect_link'] ) && $options['apsl_custom_login_redirect_link'] != '' ) {
|
383 |
+
echo $options['apsl_custom_login_redirect_link'];
|
384 |
+
}
|
385 |
+
?>' />
|
386 |
</p>
|
387 |
<div class='apsl-info'>
|
388 |
<span class='apsl-info-note'><?php _e( 'Note:', 'accesspress-social-login-lite' ); ?></span> <br />
|
398 |
<div class="apsl-label"><?php _e( 'User avatar', 'accesspress-social-login-lite' ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
399 |
<div class='apsl_network_settings_wrapper apsl_network_settings_outer' style='display:none'>
|
400 |
<input type='radio' id='apsl_user_avatar_default' class='apsl_user_avatar_options' name='apsl_user_avatar_options' value='default' <?php
|
401 |
+
if( isset( $options['apsl_user_avatar_options'] ) ) {
|
402 |
+
checked( $options['apsl_user_avatar_options'], 'default', 'true' );
|
403 |
+
}
|
404 |
+
?> /> <label for='apsl_user_avatar_default'><?php _e( 'Use wordpress provided default avatar.', 'accesspress-social-login-lite' ); ?></label><br /><br />
|
405 |
<input type='radio' id='apsl_user_avatar_social' class='apsl_user_avatar_options' name='apsl_user_avatar_options' value='social' <?php
|
406 |
+
if( isset( $options['apsl_user_avatar_options'] ) ) {
|
407 |
+
checked( $options['apsl_user_avatar_options'], 'social', 'true' );
|
408 |
+
}
|
409 |
+
?> /> <label for='apsl_user_avatar_social'><?php _e( 'Use the profile picture from social media where available.', 'accesspress-social-login-lite' ); ?></label><br /><br />
|
410 |
<div class='apsl-info'>
|
411 |
<span class='apsl-info-note'><?php _e( 'Note:', 'accesspress-social-login-lite' ); ?></span> <br />
|
412 |
<span class='apsl-info-content'>Please choose the options from where you want your users avatar to be loaded from. If you choose default wordpress avatar it will use the gravatar profile image if user have gravatar profile assocated with their registered email address.</span>
|
420 |
<div class="apsl-label"><?php _e( 'Email notification settings', 'accesspress-social-login-lite' ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
421 |
<div class='apsl_network_settings_wrapper apsl_network_settings_outer' style='display:none'>
|
422 |
<input type='radio' id='apsl_send_email_notification_yes' class='apsl_send_email_notification_yes' name='apsl_send_email_notification_options' value='yes' <?php
|
423 |
+
if( isset( $options['apsl_send_email_notification_options'] ) ) {
|
424 |
+
checked( $options['apsl_send_email_notification_options'], 'yes', 'true' );
|
425 |
+
}
|
426 |
+
?> /> <label for='apsl_send_email_notification_yes'><?php _e( 'Send email notification to both user and site admin.', 'accesspress-social-login-lite' ); ?></label><br /><br />
|
427 |
<input type='radio' id='apsl_send_email_notification_no' class='apsl_send_email_notification_no' name='apsl_send_email_notification_options' value='no' <?php
|
428 |
+
if( isset( $options['apsl_send_email_notification_options'] ) ) {
|
429 |
+
checked( $options['apsl_send_email_notification_options'], 'no', 'true' );
|
430 |
+
}
|
431 |
+
?> /> <label for='apsl_send_email_notification_no'><?php _e( 'Do not send email notification to both user and site admin.', 'accesspress-social-login-lite' ); ?></label><br /><br />
|
432 |
<div class='apsl-info'>
|
433 |
<span class='apsl-info-note'><?php _e( 'Note:', 'accesspress-social-login-lite' ); ?></span> <br />
|
434 |
<span class='apsl-info-content'>Here you can configure an options to send email notifications about user registration to site admin and user.</span>
|
442 |
|
443 |
<!-- how to use section -->
|
444 |
<div class='apsl-tab-contents' id='tab-apsl-how-to-use' style="display:none">
|
445 |
+
<?php include( APSL_PLUGIN_DIR . 'inc/backend/how-to-use.php' ); ?>
|
446 |
</div>
|
447 |
|
448 |
<!-- about section -->
|
449 |
<div class='apsl-tab-contents' id='tab-apsl-about' style="display:none">
|
450 |
+
<?php include( APSL_PLUGIN_DIR . 'inc/backend/about.php' ); ?>
|
451 |
</div>
|
452 |
|
453 |
<!-- Save settings Button -->
|
inc/backend/save-settings.php
CHANGED
@@ -1,74 +1,54 @@
|
|
1 |
-
<?php defined( 'ABSPATH' ) or die( "No script kiddies please!" ); ?>
|
2 |
<?php
|
|
|
3 |
|
4 |
$apsl_settings = array();
|
5 |
$apsl_settings['network_ordering'] = $_POST['network_ordering'];
|
6 |
-
|
7 |
//for facebook settings
|
8 |
-
foreach
|
9 |
-
$$key = sanitize_text_field($value);
|
10 |
}
|
11 |
$apsl_facebook_enable = isset( $apsl_facebook_enable ) ? $apsl_facebook_enable : '';
|
12 |
|
13 |
-
$facebook_parameters = array(
|
14 |
-
'apsl_facebook_enable' => $apsl_facebook_enable,
|
15 |
-
'apsl_facebook_app_id' => $apsl_facebook_app_id,
|
16 |
-
'apsl_facebook_app_secret' => $apsl_facebook_app_secret
|
17 |
-
);
|
18 |
$apsl_settings['apsl_facebook_settings'] = $facebook_parameters;
|
19 |
-
|
20 |
//for twitter settings
|
21 |
-
foreach
|
22 |
-
$$key = sanitize_text_field($value);
|
23 |
}
|
24 |
$apsl_twitter_enable = isset( $apsl_twitter_enable ) ? $apsl_twitter_enable : '';
|
25 |
|
26 |
-
$twitter_parameters = array(
|
27 |
-
'apsl_twitter_enable' => $apsl_twitter_enable,
|
28 |
-
'apsl_twitter_api_key' => $apsl_twitter_api_key,
|
29 |
-
'apsl_twitter_api_secret' => $apsl_twitter_api_secret
|
30 |
-
);
|
31 |
|
32 |
$apsl_settings['apsl_twitter_settings'] = $twitter_parameters;
|
33 |
-
|
34 |
//for google settings
|
35 |
-
foreach
|
36 |
-
$$key = sanitize_text_field($value);
|
37 |
}
|
|
|
38 |
$apsl_google_enable = isset( $apsl_google_enable ) ? $apsl_google_enable : '';
|
39 |
|
40 |
-
$google_parameters = array(
|
41 |
-
|
42 |
-
'apsl_google_client_id' => $apsl_google_client_id,
|
43 |
-
'apsl_google_client_secret' => $apsl_google_client_secret
|
44 |
-
);
|
45 |
$apsl_settings['apsl_google_settings'] = $google_parameters;
|
46 |
|
47 |
$apsl_settings['apsl_enable_disable_plugin'] = $_POST['apsl_enable_disable_plugin'];
|
48 |
|
49 |
$display_options = array();
|
50 |
-
if
|
51 |
-
|
52 |
-
foreach ( $_POST['apsl_display_options'] as $key => $value ) {
|
53 |
$display_options[] = $value;
|
54 |
}
|
55 |
}
|
56 |
|
57 |
$apsl_settings['apsl_display_options'] = $display_options;
|
58 |
-
|
59 |
$apsl_settings['apsl_icon_theme'] = $_POST['apsl_icon_theme'];
|
60 |
-
|
61 |
-
$apsl_settings['
|
62 |
-
$apsl_settings['
|
63 |
-
$apsl_settings['
|
64 |
-
|
65 |
-
$apsl_settings['apsl_custom_login_redirect_options'] = sanitize_text_field($_POST['apsl_custom_login_redirect_options']);
|
66 |
-
$apsl_settings['apsl_custom_login_redirect_link'] = sanitize_text_field($_POST['apsl_custom_login_redirect_link']);
|
67 |
-
|
68 |
$apsl_settings['apsl_user_avatar_options'] = $_POST['apsl_user_avatar_options'];
|
69 |
-
|
70 |
$apsl_settings['apsl_send_email_notification_options'] = $_POST['apsl_send_email_notification_options'];
|
71 |
-
|
72 |
//for saving the settings
|
73 |
update_option( APSL_SETTINGS, $apsl_settings );
|
74 |
$_SESSION['apsl_message'] = __( 'Settings Saved Successfully.', 'accesspress-social-login-lite' );
|
|
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) or die( "No script kiddies please!" );
|
3 |
|
4 |
$apsl_settings = array();
|
5 |
$apsl_settings['network_ordering'] = $_POST['network_ordering'];
|
|
|
6 |
//for facebook settings
|
7 |
+
foreach( $_POST['apsl_facebook_settings'] as $key => $value ) {
|
8 |
+
$$key = sanitize_text_field( $value );
|
9 |
}
|
10 |
$apsl_facebook_enable = isset( $apsl_facebook_enable ) ? $apsl_facebook_enable : '';
|
11 |
|
12 |
+
$facebook_parameters = array('apsl_facebook_enable' => $apsl_facebook_enable, 'apsl_facebook_app_id' => $apsl_facebook_app_id, 'apsl_facebook_app_secret' => $apsl_facebook_app_secret);
|
|
|
|
|
|
|
|
|
13 |
$apsl_settings['apsl_facebook_settings'] = $facebook_parameters;
|
|
|
14 |
//for twitter settings
|
15 |
+
foreach( $_POST['apsl_twitter_settings'] as $key => $value ) {
|
16 |
+
$$key = sanitize_text_field( $value );
|
17 |
}
|
18 |
$apsl_twitter_enable = isset( $apsl_twitter_enable ) ? $apsl_twitter_enable : '';
|
19 |
|
20 |
+
$twitter_parameters = array('apsl_twitter_enable' => $apsl_twitter_enable, 'apsl_twitter_api_key' => $apsl_twitter_api_key, 'apsl_twitter_api_secret' => $apsl_twitter_api_secret);
|
|
|
|
|
|
|
|
|
21 |
|
22 |
$apsl_settings['apsl_twitter_settings'] = $twitter_parameters;
|
|
|
23 |
//for google settings
|
24 |
+
foreach( $_POST['apsl_google_settings'] as $key => $value ) {
|
25 |
+
$$key = sanitize_text_field( $value );
|
26 |
}
|
27 |
+
|
28 |
$apsl_google_enable = isset( $apsl_google_enable ) ? $apsl_google_enable : '';
|
29 |
|
30 |
+
$google_parameters = array('apsl_google_enable' => $apsl_google_enable, 'apsl_google_client_id' => $apsl_google_client_id, 'apsl_google_client_secret' => $apsl_google_client_secret);
|
31 |
+
|
|
|
|
|
|
|
32 |
$apsl_settings['apsl_google_settings'] = $google_parameters;
|
33 |
|
34 |
$apsl_settings['apsl_enable_disable_plugin'] = $_POST['apsl_enable_disable_plugin'];
|
35 |
|
36 |
$display_options = array();
|
37 |
+
if( isset( $_POST['apsl_display_options'] ) ) {
|
38 |
+
foreach( $_POST['apsl_display_options'] as $key => $value ) {
|
|
|
39 |
$display_options[] = $value;
|
40 |
}
|
41 |
}
|
42 |
|
43 |
$apsl_settings['apsl_display_options'] = $display_options;
|
|
|
44 |
$apsl_settings['apsl_icon_theme'] = $_POST['apsl_icon_theme'];
|
45 |
+
$apsl_settings['apsl_title_text_field'] = sanitize_text_field( $_POST['apsl_title_text_field'] );
|
46 |
+
$apsl_settings['apsl_custom_logout_redirect_options'] = sanitize_text_field( $_POST['apsl_custom_logout_redirect_options'] );
|
47 |
+
$apsl_settings['apsl_custom_logout_redirect_link'] = sanitize_text_field( $_POST['apsl_custom_logout_redirect_link'] );
|
48 |
+
$apsl_settings['apsl_custom_login_redirect_options'] = sanitize_text_field( $_POST['apsl_custom_login_redirect_options'] );
|
49 |
+
$apsl_settings['apsl_custom_login_redirect_link'] = sanitize_text_field( $_POST['apsl_custom_login_redirect_link'] );
|
|
|
|
|
|
|
50 |
$apsl_settings['apsl_user_avatar_options'] = $_POST['apsl_user_avatar_options'];
|
|
|
51 |
$apsl_settings['apsl_send_email_notification_options'] = $_POST['apsl_send_email_notification_options'];
|
|
|
52 |
//for saving the settings
|
53 |
update_option( APSL_SETTINGS, $apsl_settings );
|
54 |
$_SESSION['apsl_message'] = __( 'Settings Saved Successfully.', 'accesspress-social-login-lite' );
|
inc/backend/widget.php
CHANGED
@@ -1,22 +1,18 @@
|
|
1 |
<?php
|
2 |
defined( 'ABSPATH' ) or die( "No script kiddies please!" );
|
3 |
-
|
4 |
/**
|
5 |
* Adds AccessPress Social Login Widget
|
6 |
*/
|
7 |
class APSL_Lite_Widget extends WP_Widget {
|
8 |
-
|
9 |
/**
|
10 |
* Register widget with WordPress.
|
11 |
*/
|
12 |
function __construct() {
|
13 |
-
parent::__construct(
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
);
|
18 |
}
|
19 |
-
|
20 |
/**
|
21 |
* Back-end widget form.
|
22 |
*
|
@@ -25,19 +21,20 @@ class APSL_Lite_Widget extends WP_Widget {
|
|
25 |
* @param array $instance Previously saved values from database.
|
26 |
*/
|
27 |
public function form( $instance ) {
|
28 |
-
|
29 |
-
if ( isset( $instance['title'] ) ) {
|
30 |
$title = $instance['title'];
|
31 |
-
}
|
|
|
32 |
$title = '';
|
33 |
}
|
34 |
-
|
35 |
-
if
|
36 |
$login_text = $instance['login_text'];
|
37 |
-
}
|
|
|
38 |
$login_text = '';
|
39 |
}
|
40 |
-
|
41 |
<p>
|
42 |
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title: ', 'accesspress-social-login-lite' ); ?></label>
|
43 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
|
@@ -50,7 +47,6 @@ class APSL_Lite_Widget extends WP_Widget {
|
|
50 |
|
51 |
<?php
|
52 |
}
|
53 |
-
|
54 |
/**
|
55 |
* Front-end display of widget.
|
56 |
*
|
@@ -61,23 +57,23 @@ class APSL_Lite_Widget extends WP_Widget {
|
|
61 |
*/
|
62 |
public function widget( $args, $instance ) {
|
63 |
echo $args['before_widget'];
|
64 |
-
if
|
65 |
echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
|
66 |
}
|
67 |
global $post;
|
68 |
-
if
|
69 |
$widget_flag = get_post_meta( $post->ID, 'apsl_widget_flag', true );
|
70 |
-
}
|
|
|
71 |
$widget_flag = 0;
|
72 |
}
|
73 |
-
if
|
74 |
echo "<div class='apsl-widget'>";
|
75 |
echo do_shortcode( "[apsl-login-lite login_text='{$instance['login_text']}']" );
|
76 |
echo "</div>";
|
77 |
}
|
78 |
echo $args['after_widget'];
|
79 |
}
|
80 |
-
|
81 |
/**
|
82 |
* Sanitize widget form values as they are saved.
|
83 |
*
|
@@ -90,9 +86,8 @@ class APSL_Lite_Widget extends WP_Widget {
|
|
90 |
*/
|
91 |
public function update( $new_instance, $old_instance ) {
|
92 |
$instance = array();
|
93 |
-
$instance['title'] =
|
94 |
-
$instance['login_text'] =
|
95 |
return $instance;
|
96 |
}
|
97 |
-
|
98 |
}
|
1 |
<?php
|
2 |
defined( 'ABSPATH' ) or die( "No script kiddies please!" );
|
|
|
3 |
/**
|
4 |
* Adds AccessPress Social Login Widget
|
5 |
*/
|
6 |
class APSL_Lite_Widget extends WP_Widget {
|
|
|
7 |
/**
|
8 |
* Register widget with WordPress.
|
9 |
*/
|
10 |
function __construct() {
|
11 |
+
parent::__construct( 'apsl_widget', // Base ID
|
12 |
+
__( 'AccessPress Social Login Lite', 'accesspress-social-login-lite' ), // Name
|
13 |
+
array('description' => __( 'AccessPress Social Login Lite Widget', 'accesspress-social-login-lite' )) // Args
|
14 |
+
);
|
|
|
15 |
}
|
|
|
16 |
/**
|
17 |
* Back-end widget form.
|
18 |
*
|
21 |
* @param array $instance Previously saved values from database.
|
22 |
*/
|
23 |
public function form( $instance ) {
|
24 |
+
if( isset( $instance['title'] ) ) {
|
|
|
25 |
$title = $instance['title'];
|
26 |
+
}
|
27 |
+
else {
|
28 |
$title = '';
|
29 |
}
|
30 |
+
|
31 |
+
if( isset( $instance['login_text'] ) ) {
|
32 |
$login_text = $instance['login_text'];
|
33 |
+
}
|
34 |
+
else {
|
35 |
$login_text = '';
|
36 |
}
|
37 |
+
?>
|
38 |
<p>
|
39 |
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title: ', 'accesspress-social-login-lite' ); ?></label>
|
40 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
|
47 |
|
48 |
<?php
|
49 |
}
|
|
|
50 |
/**
|
51 |
* Front-end display of widget.
|
52 |
*
|
57 |
*/
|
58 |
public function widget( $args, $instance ) {
|
59 |
echo $args['before_widget'];
|
60 |
+
if( !empty( $instance['title'] ) ) {
|
61 |
echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
|
62 |
}
|
63 |
global $post;
|
64 |
+
if( have_posts() ) {
|
65 |
$widget_flag = get_post_meta( $post->ID, 'apsl_widget_flag', true );
|
66 |
+
}
|
67 |
+
else {
|
68 |
$widget_flag = 0;
|
69 |
}
|
70 |
+
if( $widget_flag != '1' ) {
|
71 |
echo "<div class='apsl-widget'>";
|
72 |
echo do_shortcode( "[apsl-login-lite login_text='{$instance['login_text']}']" );
|
73 |
echo "</div>";
|
74 |
}
|
75 |
echo $args['after_widget'];
|
76 |
}
|
|
|
77 |
/**
|
78 |
* Sanitize widget form values as they are saved.
|
79 |
*
|
86 |
*/
|
87 |
public function update( $new_instance, $old_instance ) {
|
88 |
$instance = array();
|
89 |
+
$instance['title'] =( !empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
|
90 |
+
$instance['login_text'] =( !empty( $new_instance['login_text'] ) ) ? strip_tags( $new_instance['login_text'] ) : '';
|
91 |
return $instance;
|
92 |
}
|
|
|
93 |
}
|
inc/frontend/login_check.php
CHANGED
@@ -1,57 +1,54 @@
|
|
1 |
-
<?php defined( 'ABSPATH' ) or die( "No script kiddies please!" ); ?>
|
2 |
<?php
|
3 |
|
4 |
-
|
5 |
|
|
|
|
|
6 |
class APSL_Lite_Login_Check_Class {
|
7 |
-
|
8 |
//constructor
|
9 |
function __construct() {
|
10 |
-
if
|
11 |
-
if
|
12 |
parse_str( base64_decode( $_REQUEST['state'] ), $state_vars );
|
13 |
-
|
14 |
-
if
|
15 |
$_GET['redirect_to'] = $_REQUEST['redirect_to'] = $state_vars['redirect_to'];
|
16 |
}
|
17 |
}
|
18 |
-
|
19 |
$exploder = explode( '_', $_GET['apsl_login_id'] );
|
20 |
-
switch
|
21 |
case 'facebook':
|
22 |
-
if
|
23 |
echo _e( 'The Facebook SDK requires PHP version 5.4 or higher. Please notify about this error to site admin.', 'accesspress-social-login-lite' );
|
24 |
die();
|
25 |
}
|
26 |
$this->onFacebookLogin();
|
27 |
-
|
28 |
-
|
29 |
case 'twitter':
|
30 |
-
if
|
31 |
include( APSL_PLUGIN_DIR . 'twitter/OAuth.php' );
|
32 |
include( APSL_PLUGIN_DIR . 'twitter/twitteroauth.php' );
|
33 |
}
|
34 |
$this->onTwitterLogin();
|
35 |
-
|
36 |
-
|
37 |
case 'google':
|
38 |
include( APSL_PLUGIN_DIR . 'google/Client.php' );
|
39 |
include( APSL_PLUGIN_DIR . 'google/Service/Plus.php' );
|
40 |
$this->onGoogleLogin();
|
41 |
-
|
42 |
}
|
43 |
}
|
44 |
}
|
45 |
-
|
46 |
//for facebook login
|
47 |
function onFacebookLogin() {
|
48 |
$response = new stdClass();
|
49 |
$result = $this->facebookLogin( $response );
|
50 |
-
if
|
51 |
$row = $this->getUserByMail( $result->email );
|
52 |
$options = get_option( APSL_SETTINGS );
|
53 |
-
|
54 |
-
if
|
55 |
$this->creatUser( $result->username, $result->email );
|
56 |
$row = $this->getUserByMail( $result->email );
|
57 |
update_user_meta( $row->ID, 'email', $result->email );
|
@@ -62,12 +59,12 @@ if ( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
62 |
update_user_meta( $row->ID, 'deuimage', $result->deuimage );
|
63 |
update_user_meta( $row->ID, 'description', $result->about );
|
64 |
update_user_meta( $row->ID, 'sex', $result->gender );
|
65 |
-
wp_update_user( array(
|
66 |
}
|
67 |
$this->loginUser( $row->ID );
|
68 |
}
|
69 |
}
|
70 |
-
|
71 |
function facebookLogin() {
|
72 |
$request = $_REQUEST;
|
73 |
$site = $this->siteUrl();
|
@@ -77,72 +74,72 @@ if ( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
77 |
$exploder = explode( '_', $_GET['apsl_login_id'] );
|
78 |
$action = $exploder[1];
|
79 |
$options = get_option( APSL_SETTINGS );
|
80 |
-
$config = array(
|
81 |
-
|
82 |
-
'app_secret' => $options['apsl_facebook_settings']['apsl_facebook_app_secret'],
|
83 |
-
'default_graph_version' => 'v2.4'
|
84 |
-
);
|
85 |
-
|
86 |
include( APSL_PLUGIN_DIR . 'facebook/autoload.php' );
|
87 |
$fb = new Facebook\Facebook( $config );
|
88 |
-
|
89 |
$encoded_url = isset( $_GET['redirect_to'] ) ? $_GET['redirect_to'] : '';
|
90 |
-
if
|
91 |
$callback = $callBackUrl . 'apsl_login_id' . '=facebook_check&redirect_to=' . $encoded_url;
|
92 |
-
}
|
|
|
93 |
$callback = $callBackUrl . 'apsl_login_id' . '=facebook_check';
|
94 |
}
|
95 |
-
|
96 |
-
if
|
97 |
// Well looks like we are a fresh dude, login to Facebook!
|
98 |
$helper = $fb->getRedirectLoginHelper();
|
99 |
-
$permissions = array(
|
100 |
$loginUrl = $helper->getLoginUrl( $callback, $permissions );
|
101 |
$this->redirect( $loginUrl );
|
102 |
-
}
|
103 |
-
|
|
|
104 |
$response->status = 'ERROR';
|
105 |
$response->error_code = 2;
|
106 |
$response->error_message = 'INVALID AUTHORIZATION';
|
107 |
return $response;
|
108 |
die();
|
109 |
}
|
110 |
-
if
|
111 |
$helper = $fb->getRedirectLoginHelper();
|
112 |
try {
|
113 |
$accessToken = $helper->getAccessToken();
|
114 |
-
}
|
115 |
-
|
116 |
// When Graph returns an error
|
117 |
echo 'Graph returned an error: ' . $e->getMessage();
|
118 |
exit;
|
119 |
-
}
|
120 |
-
|
121 |
// When validation fails or other local issues
|
122 |
echo 'Facebook SDK returned an error: ' . $e->getMessage();
|
123 |
exit;
|
124 |
}
|
125 |
-
|
126 |
-
if
|
127 |
// Logged in!
|
128 |
-
$_SESSION['facebook_access_token'] = (string)
|
129 |
$fb->setDefaultAccessToken( $accessToken );
|
130 |
-
|
131 |
try {
|
132 |
$response = $fb->get( '/me?fields=email,name, first_name, last_name, gender, link, about, address, bio, birthday, education, hometown, is_verified, languages, location, website' );
|
133 |
$userNode = $response->getGraphUser();
|
134 |
-
}
|
|
|
135 |
// When Graph returns an error
|
136 |
echo 'Graph returned an error: ' . $e->getMessage();
|
137 |
exit;
|
138 |
-
}
|
|
|
139 |
// When validation fails or other local issues
|
140 |
echo 'Facebook SDK returned an error: ' . $e->getMessage();
|
141 |
exit;
|
142 |
}
|
143 |
-
|
144 |
$user_profile = $this->accessProtected( $userNode, 'items' );
|
145 |
-
if
|
146 |
$return_user_details->status = 'SUCCESS';
|
147 |
$return_user_details->deuid = $user_profile['id'];
|
148 |
$return_user_details->deutype = 'facebook';
|
@@ -154,38 +151,41 @@ if ( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
154 |
$return_user_details->url = $user_profile['link'];
|
155 |
$return_user_details->about = ''; //facebook doesn't return user about details.
|
156 |
$headers = get_headers( 'https://graph.facebook.com/' . $user_profile['id'] . '/picture', 1 );
|
157 |
-
|
158 |
// just a precaution, check whether the header isset...
|
159 |
-
if
|
160 |
$return_user_details->deuimage = $headers['Location']; // string
|
161 |
-
|
|
|
|
|
162 |
$return_user_details->deuimage = false; // nothing there? .. weird, but okay!
|
|
|
163 |
}
|
164 |
$return_user_details->error_message = '';
|
165 |
-
}
|
|
|
166 |
$return_user_details->status = 'ERROR';
|
167 |
$return_user_details->error_code = 2;
|
168 |
$return_user_details->error_message = 'INVALID AUTHORIZATION';
|
169 |
}
|
170 |
}
|
171 |
-
}
|
|
|
172 |
// Well looks like we are a fresh dude, login to Facebook!
|
173 |
$helper = $fb->getRedirectLoginHelper();
|
174 |
-
$permissions = array(
|
175 |
$loginUrl = $helper->getLoginUrl( $callback, $permissions );
|
176 |
$this->redirect( $loginUrl );
|
177 |
}
|
178 |
}
|
179 |
return $return_user_details;
|
180 |
}
|
181 |
-
|
182 |
//for twitter login
|
183 |
function onTwitterLogin() {
|
184 |
$result = $this->twitterLogin();
|
185 |
-
if
|
186 |
$row = $this->getUserByMail( $result->email );
|
187 |
$options = get_option( APSL_SETTINGS );
|
188 |
-
if
|
189 |
$this->creatUser( $result->username, $result->email );
|
190 |
$row = $this->getUserByMail( $result->email );
|
191 |
update_user_meta( $row->ID, 'email', $result->email );
|
@@ -195,12 +195,12 @@ if ( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
195 |
update_user_meta( $row->ID, 'deutype', $result->deutype );
|
196 |
update_user_meta( $row->ID, 'deuimage', $result->deuimage );
|
197 |
update_user_meta( $row->ID, 'description', $result->about );
|
198 |
-
wp_update_user( array(
|
199 |
}
|
200 |
$this->loginUser( $row->ID );
|
201 |
}
|
202 |
}
|
203 |
-
|
204 |
function twitterLogin() {
|
205 |
$request = $_REQUEST;
|
206 |
$site = $this->siteUrl();
|
@@ -210,68 +210,66 @@ if ( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
210 |
$action = $exploder[1];
|
211 |
@session_start();
|
212 |
$options = get_option( APSL_SETTINGS );
|
213 |
-
if
|
214 |
// Get identity from user and redirect browser to OpenID Server
|
215 |
-
if
|
216 |
$twitterObj = new TwitterOAuth( $options['apsl_twitter_settings']['apsl_twitter_api_key'], $options['apsl_twitter_settings']['apsl_twitter_api_secret'] );
|
217 |
$encoded_url = isset( $_GET['redirect_to'] ) ? $_GET['redirect_to'] : '';
|
218 |
-
if
|
219 |
$callback = $callBackUrl . 'apsl_login_id' . '=twitter_check&redirect_to=' . $encoded_url;
|
220 |
-
}
|
|
|
221 |
$callback = $callBackUrl . 'apsl_login_id' . '=twitter_check';
|
222 |
}
|
223 |
-
|
224 |
$request_token = $twitterObj->getRequestToken( $callback );
|
225 |
$_SESSION['oauth_twitter'] = array();
|
226 |
-
|
227 |
/* Save temporary credentials to session. */
|
228 |
$_SESSION['oauth_twitter']['oauth_token'] = $token = $request_token['oauth_token'];
|
229 |
$_SESSION['oauth_twitter']['oauth_token_secret'] = $request_token['oauth_token_secret'];
|
230 |
-
|
231 |
/* If last connection failed don't display authorization link. */
|
232 |
-
switch
|
233 |
case 200:
|
234 |
try {
|
235 |
$url = $twitterObj->getAuthorizeUrl( $token );
|
236 |
$this->redirect( $url );
|
237 |
-
}
|
|
|
238 |
$response->status = 'ERROR';
|
239 |
$response->error_code = 2;
|
240 |
$response->error_message = 'Could not get AuthorizeUrl.';
|
241 |
}
|
242 |
-
|
243 |
-
|
244 |
default:
|
245 |
$response->status = 'ERROR';
|
246 |
$response->error_code = 2;
|
247 |
$response->error_message = 'Could not connect to Twitter. Refresh the page or try again later.';
|
248 |
-
|
249 |
}
|
250 |
-
}
|
|
|
251 |
$response->status = 'ERROR';
|
252 |
$response->error_code = 2;
|
253 |
$response->error_message = 'INVALID AUTHORIZATION';
|
254 |
}
|
255 |
-
}
|
256 |
-
|
257 |
/* Create TwitteroAuth object with app key/secret and token key/secret from default phase */
|
258 |
$twitterObj = new TwitterOAuth( $options['apsl_twitter_settings']['apsl_twitter_api_key'], $options['apsl_twitter_settings']['apsl_twitter_api_secret'], $_SESSION['oauth_twitter']['oauth_token'], $_SESSION['oauth_twitter']['oauth_token_secret'] );
|
259 |
-
|
260 |
/* Remove no longer needed request tokens */
|
261 |
unset( $_SESSION['oauth_twitter'] );
|
262 |
try {
|
263 |
$access_token = $twitterObj->getAccessToken( $request['oauth_verifier'] );
|
264 |
/* If HTTP response is 200 continue otherwise send to connect page to retry */
|
265 |
-
if
|
266 |
-
$user_profile = $twitterObj->get( 'users/show', array(
|
267 |
-
|
268 |
/* Request access twitterObj from twitter */
|
269 |
$response->status = 'SUCCESS';
|
270 |
$response->deuid = $user_profile->id;
|
271 |
$response->deutype = 'twitter';
|
272 |
$response->name = explode( ' ', $user_profile->name, 2 );
|
273 |
$response->first_name = $response->name[0];
|
274 |
-
$response->last_name =
|
275 |
$response->deuimage = $user_profile->profile_image_url_https;
|
276 |
$response->email = $user_profile->screen_name . '@twitter.com';
|
277 |
$response->username = $user_profile->screen_name . '@twitter.com';
|
@@ -280,31 +278,33 @@ if ( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
280 |
$response->gender = $user_profile->gender;
|
281 |
$response->location = $user_profile->location;
|
282 |
$response->error_message = '';
|
283 |
-
}
|
|
|
284 |
$response->status = 'ERROR';
|
285 |
$response->error_code = 2;
|
286 |
$response->error_message = 'Could not connect to Twitter. Refresh the page or try again later.';
|
287 |
}
|
288 |
-
}
|
|
|
289 |
$response->status = 'ERROR';
|
290 |
$response->error_code = 2;
|
291 |
$response->error_message = 'Could not get AccessToken.';
|
292 |
}
|
293 |
-
}
|
|
|
294 |
$response->status = 'ERROR';
|
295 |
$response->error_code = 1;
|
296 |
$response->error_message = "USER CANCELED REQUEST";
|
297 |
}
|
298 |
return $response;
|
299 |
}
|
300 |
-
|
301 |
//for google login
|
302 |
function onGoogleLogin() {
|
303 |
$result = $this->GoogleLogin();
|
304 |
-
if
|
305 |
$row = $this->getUserByMail( $result->email );
|
306 |
$options = get_option( APSL_SETTINGS );
|
307 |
-
if
|
308 |
$this->creatUser( $result->username, $result->email );
|
309 |
$row = $this->getUserByMail( $result->email );
|
310 |
update_user_meta( $row->ID, 'email', $result->email );
|
@@ -314,12 +314,12 @@ if ( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
314 |
update_user_meta( $row->ID, 'deutype', $result->deutype );
|
315 |
update_user_meta( $row->ID, 'deuimage', $result->deuimage );
|
316 |
update_user_meta( $row->ID, 'description', $result->about );
|
317 |
-
wp_update_user( array(
|
318 |
}
|
319 |
$this->loginUser( $row->ID );
|
320 |
}
|
321 |
}
|
322 |
-
|
323 |
function GoogleLogin() {
|
324 |
$post = $_POST;
|
325 |
$get = $_GET;
|
@@ -332,52 +332,56 @@ if ( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
332 |
$action = $a[1];
|
333 |
$client_id = $options['apsl_google_settings']['apsl_google_client_id'];
|
334 |
$client_secret = $options['apsl_google_settings']['apsl_google_client_secret'];
|
335 |
-
|
336 |
$site_url = site_url() . '/wp-admin';
|
337 |
$encoded_url = isset( $_GET['redirect_to'] ) ? $_GET['redirect_to'] : $site_url;
|
338 |
$callback = $callBackUrl . 'apsl_login_id' . '=google_check';
|
339 |
-
|
340 |
$redirect_uri = $callback;
|
341 |
$client = new Google_Client;
|
342 |
-
|
343 |
$client->setClientId( $client_id );
|
344 |
$client->setClientSecret( $client_secret );
|
345 |
$client->setRedirectUri( $redirect_uri );
|
346 |
$client->addScope( "https://www.googleapis.com/auth/plus.profile.emails.read" );
|
347 |
-
if
|
348 |
$client->setState( base64_encode( "redirect_to=$encoded_url" ) );
|
349 |
-
} else {
|
350 |
-
|
351 |
}
|
|
|
352 |
$service = new Google_Service_Plus( $client );
|
353 |
-
|
354 |
-
|
|
|
355 |
$authUrl = $client->createAuthUrl();
|
356 |
$this->redirect( $authUrl );
|
357 |
die();
|
358 |
-
}
|
|
|
359 |
$this->redirect( $redirect_uri . "&redirect_to=$encoded_url" );
|
360 |
die();
|
361 |
}
|
362 |
-
}
|
|
|
363 |
$client->authenticate( $_GET['code'] );
|
364 |
$_SESSION['access_token'] = $client->getAccessToken();
|
365 |
$this->redirect( $redirect_uri . "&redirect_to=$encoded_url" );
|
366 |
die();
|
367 |
-
}
|
|
|
368 |
$client->setAccessToken( $_SESSION['access_token'] );
|
369 |
-
|
370 |
try {
|
371 |
$user = $service->people->get( "me", array() );
|
372 |
-
}
|
|
|
373 |
unset( $_SESSION['access_token'] );
|
374 |
$ref_object = $this->accessProtected( $fault, 'errors' );
|
375 |
echo $ref_object[0]['message'] . " Please notify about this error to the Site Admin.";
|
376 |
die();
|
377 |
}
|
378 |
-
|
379 |
-
if
|
380 |
-
if
|
381 |
$response->email = $user->emails[0]->value;
|
382 |
$response->username = $user->emails[0]->value;
|
383 |
$response->first_name = $user->name->givenName;
|
@@ -391,132 +395,134 @@ if ( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
391 |
$response->deutype = 'google';
|
392 |
$response->status = 'SUCCESS';
|
393 |
$response->error_message = '';
|
394 |
-
}
|
|
|
395 |
$response->status = 'ERROR';
|
396 |
$response->error_code = 2;
|
397 |
$response->error_message = "INVALID AUTHORIZATION";
|
398 |
}
|
399 |
-
}
|
|
|
400 |
$response->status = 'ERROR';
|
401 |
$response->error_code = 2;
|
402 |
$response->error_message = "INVALID AUTHORIZATION";
|
403 |
}
|
404 |
-
}
|
|
|
405 |
$response->status = 'ERROR';
|
406 |
$response->error_code = 1;
|
407 |
$response->error_message = "USER CANCELED REQUEST";
|
408 |
-
}
|
|
|
409 |
$response->status = 'ERROR';
|
410 |
$response->error_code = 3;
|
411 |
$response->error_message = "USER LOGIN FAIL";
|
412 |
}
|
413 |
return $response;
|
414 |
}
|
415 |
-
|
416 |
//other remaining methods
|
417 |
function siteUrl() {
|
418 |
return site_url();
|
419 |
}
|
420 |
-
|
421 |
function callBackUrl() {
|
422 |
$connection = !empty( $_SERVER['HTTPS'] ) ? 'https://' : 'http://';
|
423 |
$url = $connection . $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"];
|
424 |
-
if
|
425 |
-
$url
|
426 |
-
}
|
427 |
-
|
|
|
428 |
}
|
429 |
return $url;
|
430 |
}
|
431 |
-
|
432 |
//function to return json values from social media urls
|
433 |
function get_json_values( $url ) {
|
434 |
$response = wp_remote_get( $url );
|
435 |
$json_response = wp_remote_retrieve_body( $response );
|
436 |
return $json_response;
|
437 |
}
|
438 |
-
|
439 |
function redirect( $redirect ) {
|
440 |
-
if
|
441 |
echo '<script language="JavaScript" type="text/javascript">window.location=\'';
|
442 |
echo $redirect;
|
443 |
echo '\';</script>';
|
444 |
-
}
|
|
|
445 |
header( 'Location: ' . $redirect );
|
446 |
}
|
447 |
exit;
|
448 |
}
|
449 |
-
|
450 |
function updateUser( $username, $email ) {
|
451 |
$row = $this->getUserByUsername( $username );
|
452 |
-
if
|
453 |
-
$row = (array)
|
454 |
$row['user_email'] = $email;
|
455 |
wp_update_user( $row );
|
456 |
}
|
457 |
}
|
458 |
-
|
459 |
// Redefine user notification function
|
460 |
function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {
|
461 |
$user = new WP_User( $user_id );
|
462 |
-
|
463 |
$user_login = stripslashes( $user->user_login );
|
464 |
$user_email = stripslashes( $user->user_email );
|
465 |
-
|
466 |
$message = sprintf( __( 'New user registration on your blog %s:' ), get_option( 'blogname' ) ) . "\r\n\r\n";
|
467 |
-
$message
|
468 |
-
$message
|
469 |
-
|
470 |
@wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] New User Registration' ), get_option( 'blogname' ) ), $message );
|
471 |
-
|
472 |
-
if
|
473 |
-
|
474 |
-
|
475 |
$message = __( 'Hi there,' ) . "\r\n\r\n";
|
476 |
-
$message
|
477 |
-
$message
|
478 |
-
$message
|
479 |
-
$message
|
480 |
-
$message
|
481 |
-
$message
|
482 |
-
|
483 |
wp_mail( $user_email, sprintf( __( '[%s] Your username and password' ), get_option( 'blogname' ) ), $message );
|
484 |
}
|
485 |
-
|
486 |
function getUserByMail( $email ) {
|
487 |
global $wpdb;
|
488 |
$row = $wpdb->get_row( "SELECT * FROM $wpdb->users WHERE user_email = '$email'" );
|
489 |
-
if
|
490 |
return $row;
|
491 |
}
|
492 |
return false;
|
493 |
}
|
494 |
-
|
495 |
function getUserByUsername( $username ) {
|
496 |
global $wpdb;
|
497 |
$row = $wpdb->get_row( "SELECT * FROM $wpdb->users WHERE user_login = '$username'" );
|
498 |
-
if
|
499 |
return $row;
|
500 |
}
|
501 |
return false;
|
502 |
}
|
503 |
-
|
504 |
function creatUser( $user_name, $user_email ) {
|
505 |
$random_password = wp_generate_password( 12, false );
|
506 |
$user_id = wp_create_user( $user_name, $random_password, $user_email );
|
507 |
do_action( 'APSL_createUser', $user_id ); //hookable function to perform additional work after creation of user.
|
508 |
$options = get_option( APSL_SETTINGS );
|
509 |
-
if
|
510 |
wp_new_user_notification( $user_id, $random_password );
|
511 |
}
|
512 |
return $user_id;
|
513 |
}
|
514 |
-
|
515 |
function set_cookies( $user_id = 0, $remember = true ) {
|
516 |
-
if
|
517 |
return false;
|
518 |
}
|
519 |
-
if
|
520 |
return false;
|
521 |
}
|
522 |
wp_clear_auth_cookie();
|
@@ -524,81 +530,78 @@ if ( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
524 |
wp_set_current_user( $user_id );
|
525 |
return true;
|
526 |
}
|
527 |
-
|
528 |
function loginUser( $user_id ) {
|
529 |
-
|
530 |
$current_url_an = get_permalink();
|
531 |
$reauth = empty( $_REQUEST['reauth'] ) ? false : true;
|
532 |
-
if
|
533 |
-
|
534 |
-
|
535 |
-
if ( isset( $_REQUEST['redirect_to'] ) ) {
|
536 |
$redirect_to = $_REQUEST['redirect_to'];
|
537 |
// Redirect to https if user wants ssl
|
538 |
-
if
|
539 |
-
|
540 |
-
|
541 |
$redirect_to = admin_url();
|
542 |
}
|
543 |
-
if
|
544 |
-
$secure_cookie = false;
|
545 |
-
|
546 |
// If cookies are disabled we can't log in even with a valid user+pass
|
547 |
-
if
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
if ( !$this->set_cookies( $user_id ) ) {
|
553 |
return false;
|
554 |
}
|
555 |
$requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : site_url();
|
556 |
$user_login_url = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user );
|
557 |
-
|
558 |
$options = get_option( APSL_SETTINGS );
|
559 |
-
if
|
560 |
-
if
|
561 |
$user_login_url = home_url();
|
562 |
-
}
|
563 |
-
|
|
|
564 |
$redirect_to = $_REQUEST['redirect_to'];
|
565 |
// Redirect to https if user wants ssl
|
566 |
-
if
|
567 |
-
|
568 |
-
|
569 |
$user_login_url = home_url();
|
570 |
}
|
571 |
-
}
|
572 |
-
|
|
|
573 |
$login_page = $options['apsl_custom_login_redirect_link'];
|
574 |
$user_login_url = $login_page;
|
575 |
-
}
|
|
|
576 |
$user_login_url = home_url();
|
577 |
}
|
578 |
}
|
579 |
-
}
|
|
|
580 |
$user_login_url = home_url();
|
581 |
}
|
582 |
$redirect_to = $user_login_url;
|
583 |
wp_safe_redirect( $redirect_to );
|
584 |
exit();
|
585 |
}
|
586 |
-
|
587 |
//returns the current page url
|
588 |
public static function curPageURL() {
|
589 |
$pageURL = 'http';
|
590 |
-
if
|
591 |
-
$pageURL
|
592 |
}
|
593 |
-
$pageURL
|
594 |
-
if
|
595 |
-
$pageURL
|
596 |
-
}
|
597 |
-
|
|
|
598 |
}
|
599 |
return $pageURL;
|
600 |
}
|
601 |
-
|
602 |
//function to access the protected object properties
|
603 |
function accessProtected( $obj, $prop ) {
|
604 |
$reflection = new ReflectionClass( $obj );
|
@@ -606,8 +609,8 @@ if ( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
606 |
$property->setAccessible( true );
|
607 |
return $property->getValue( $obj );
|
608 |
}
|
609 |
-
|
610 |
-
|
611 |
} //end of if statement
|
612 |
|
613 |
$apsl_login_check = new APSL_Lite_Login_Check_Class();
|
|
|
1 |
<?php
|
2 |
|
3 |
+
defined( 'ABSPATH' ) or die( "No script kiddies please!" );
|
4 |
|
5 |
+
if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
6 |
+
|
7 |
class APSL_Lite_Login_Check_Class {
|
|
|
8 |
//constructor
|
9 |
function __construct() {
|
10 |
+
if( isset( $_GET['apsl_login_id'] ) ) {
|
11 |
+
if( isset( $_REQUEST['state'] ) ) {
|
12 |
parse_str( base64_decode( $_REQUEST['state'] ), $state_vars );
|
13 |
+
|
14 |
+
if( isset( $state_vars['redirect_to'] ) ) {
|
15 |
$_GET['redirect_to'] = $_REQUEST['redirect_to'] = $state_vars['redirect_to'];
|
16 |
}
|
17 |
}
|
18 |
+
|
19 |
$exploder = explode( '_', $_GET['apsl_login_id'] );
|
20 |
+
switch( $exploder[0] ) {
|
21 |
case 'facebook':
|
22 |
+
if( version_compare( PHP_VERSION, '5.4.0', '<' ) ) {
|
23 |
echo _e( 'The Facebook SDK requires PHP version 5.4 or higher. Please notify about this error to site admin.', 'accesspress-social-login-lite' );
|
24 |
die();
|
25 |
}
|
26 |
$this->onFacebookLogin();
|
27 |
+
break;
|
|
|
28 |
case 'twitter':
|
29 |
+
if( !class_exists( 'TwitterOAuth' ) ) {
|
30 |
include( APSL_PLUGIN_DIR . 'twitter/OAuth.php' );
|
31 |
include( APSL_PLUGIN_DIR . 'twitter/twitteroauth.php' );
|
32 |
}
|
33 |
$this->onTwitterLogin();
|
34 |
+
break;
|
|
|
35 |
case 'google':
|
36 |
include( APSL_PLUGIN_DIR . 'google/Client.php' );
|
37 |
include( APSL_PLUGIN_DIR . 'google/Service/Plus.php' );
|
38 |
$this->onGoogleLogin();
|
39 |
+
break;
|
40 |
}
|
41 |
}
|
42 |
}
|
|
|
43 |
//for facebook login
|
44 |
function onFacebookLogin() {
|
45 |
$response = new stdClass();
|
46 |
$result = $this->facebookLogin( $response );
|
47 |
+
if( isset( $result->status ) == 'SUCCESS' ) {
|
48 |
$row = $this->getUserByMail( $result->email );
|
49 |
$options = get_option( APSL_SETTINGS );
|
50 |
+
|
51 |
+
if( !$row ) {
|
52 |
$this->creatUser( $result->username, $result->email );
|
53 |
$row = $this->getUserByMail( $result->email );
|
54 |
update_user_meta( $row->ID, 'email', $result->email );
|
59 |
update_user_meta( $row->ID, 'deuimage', $result->deuimage );
|
60 |
update_user_meta( $row->ID, 'description', $result->about );
|
61 |
update_user_meta( $row->ID, 'sex', $result->gender );
|
62 |
+
wp_update_user( array('ID' => $row->ID, 'display_name' => $result->first_name . ' ' . $result->last_name, 'role' => $options['apsl_user_role'], 'user_url' => $result->url) );
|
63 |
}
|
64 |
$this->loginUser( $row->ID );
|
65 |
}
|
66 |
}
|
67 |
+
|
68 |
function facebookLogin() {
|
69 |
$request = $_REQUEST;
|
70 |
$site = $this->siteUrl();
|
74 |
$exploder = explode( '_', $_GET['apsl_login_id'] );
|
75 |
$action = $exploder[1];
|
76 |
$options = get_option( APSL_SETTINGS );
|
77 |
+
$config = array('app_id' => $options['apsl_facebook_settings']['apsl_facebook_app_id'], 'app_secret' => $options['apsl_facebook_settings']['apsl_facebook_app_secret'], 'default_graph_version' => 'v2.4');
|
78 |
+
|
|
|
|
|
|
|
|
|
79 |
include( APSL_PLUGIN_DIR . 'facebook/autoload.php' );
|
80 |
$fb = new Facebook\Facebook( $config );
|
81 |
+
|
82 |
$encoded_url = isset( $_GET['redirect_to'] ) ? $_GET['redirect_to'] : '';
|
83 |
+
if( isset( $encoded_url ) && $encoded_url != '' ) {
|
84 |
$callback = $callBackUrl . 'apsl_login_id' . '=facebook_check&redirect_to=' . $encoded_url;
|
85 |
+
}
|
86 |
+
else {
|
87 |
$callback = $callBackUrl . 'apsl_login_id' . '=facebook_check';
|
88 |
}
|
89 |
+
|
90 |
+
if( $action == 'login' ) {
|
91 |
// Well looks like we are a fresh dude, login to Facebook!
|
92 |
$helper = $fb->getRedirectLoginHelper();
|
93 |
+
$permissions = array('email', 'public_profile'); // optional
|
94 |
$loginUrl = $helper->getLoginUrl( $callback, $permissions );
|
95 |
$this->redirect( $loginUrl );
|
96 |
+
}
|
97 |
+
else {
|
98 |
+
if( isset( $_REQUEST['error'] ) ) {
|
99 |
$response->status = 'ERROR';
|
100 |
$response->error_code = 2;
|
101 |
$response->error_message = 'INVALID AUTHORIZATION';
|
102 |
return $response;
|
103 |
die();
|
104 |
}
|
105 |
+
if( isset( $_REQUEST['code'] ) ) {
|
106 |
$helper = $fb->getRedirectLoginHelper();
|
107 |
try {
|
108 |
$accessToken = $helper->getAccessToken();
|
109 |
+
}
|
110 |
+
catch( Facebook\Exceptions\FacebookResponseException $e ) {
|
111 |
// When Graph returns an error
|
112 |
echo 'Graph returned an error: ' . $e->getMessage();
|
113 |
exit;
|
114 |
+
}
|
115 |
+
catch( Facebook\Exceptions\FacebookSDKException $e ) {
|
116 |
// When validation fails or other local issues
|
117 |
echo 'Facebook SDK returned an error: ' . $e->getMessage();
|
118 |
exit;
|
119 |
}
|
120 |
+
|
121 |
+
if( isset( $accessToken ) ) {
|
122 |
// Logged in!
|
123 |
+
$_SESSION['facebook_access_token'] = (string)$accessToken;
|
124 |
$fb->setDefaultAccessToken( $accessToken );
|
125 |
+
|
126 |
try {
|
127 |
$response = $fb->get( '/me?fields=email,name, first_name, last_name, gender, link, about, address, bio, birthday, education, hometown, is_verified, languages, location, website' );
|
128 |
$userNode = $response->getGraphUser();
|
129 |
+
}
|
130 |
+
catch( Facebook\Exceptions\FacebookResponseException $e ) {
|
131 |
// When Graph returns an error
|
132 |
echo 'Graph returned an error: ' . $e->getMessage();
|
133 |
exit;
|
134 |
+
}
|
135 |
+
catch( Facebook\Exceptions\FacebookSDKException $e ) {
|
136 |
// When validation fails or other local issues
|
137 |
echo 'Facebook SDK returned an error: ' . $e->getMessage();
|
138 |
exit;
|
139 |
}
|
140 |
+
|
141 |
$user_profile = $this->accessProtected( $userNode, 'items' );
|
142 |
+
if( $user_profile != null ) {
|
143 |
$return_user_details->status = 'SUCCESS';
|
144 |
$return_user_details->deuid = $user_profile['id'];
|
145 |
$return_user_details->deutype = 'facebook';
|
151 |
$return_user_details->url = $user_profile['link'];
|
152 |
$return_user_details->about = ''; //facebook doesn't return user about details.
|
153 |
$headers = get_headers( 'https://graph.facebook.com/' . $user_profile['id'] . '/picture', 1 );
|
|
|
154 |
// just a precaution, check whether the header isset...
|
155 |
+
if( isset( $headers['Location'] ) ) {
|
156 |
$return_user_details->deuimage = $headers['Location']; // string
|
157 |
+
|
158 |
+
}
|
159 |
+
else {
|
160 |
$return_user_details->deuimage = false; // nothing there? .. weird, but okay!
|
161 |
+
|
162 |
}
|
163 |
$return_user_details->error_message = '';
|
164 |
+
}
|
165 |
+
else {
|
166 |
$return_user_details->status = 'ERROR';
|
167 |
$return_user_details->error_code = 2;
|
168 |
$return_user_details->error_message = 'INVALID AUTHORIZATION';
|
169 |
}
|
170 |
}
|
171 |
+
}
|
172 |
+
else {
|
173 |
// Well looks like we are a fresh dude, login to Facebook!
|
174 |
$helper = $fb->getRedirectLoginHelper();
|
175 |
+
$permissions = array('email', 'public_profile'); // optional
|
176 |
$loginUrl = $helper->getLoginUrl( $callback, $permissions );
|
177 |
$this->redirect( $loginUrl );
|
178 |
}
|
179 |
}
|
180 |
return $return_user_details;
|
181 |
}
|
|
|
182 |
//for twitter login
|
183 |
function onTwitterLogin() {
|
184 |
$result = $this->twitterLogin();
|
185 |
+
if( isset( $result->status ) == 'SUCCESS' ) {
|
186 |
$row = $this->getUserByMail( $result->email );
|
187 |
$options = get_option( APSL_SETTINGS );
|
188 |
+
if( !$row ) {
|
189 |
$this->creatUser( $result->username, $result->email );
|
190 |
$row = $this->getUserByMail( $result->email );
|
191 |
update_user_meta( $row->ID, 'email', $result->email );
|
195 |
update_user_meta( $row->ID, 'deutype', $result->deutype );
|
196 |
update_user_meta( $row->ID, 'deuimage', $result->deuimage );
|
197 |
update_user_meta( $row->ID, 'description', $result->about );
|
198 |
+
wp_update_user( array('ID' => $row->ID, 'display_name' => $result->first_name . ' ' . $result->last_name, 'role' => $options['apsl_user_role'], 'user_url' => $result->url) );
|
199 |
}
|
200 |
$this->loginUser( $row->ID );
|
201 |
}
|
202 |
}
|
203 |
+
|
204 |
function twitterLogin() {
|
205 |
$request = $_REQUEST;
|
206 |
$site = $this->siteUrl();
|
210 |
$action = $exploder[1];
|
211 |
@session_start();
|
212 |
$options = get_option( APSL_SETTINGS );
|
213 |
+
if( $action == 'login' ) {
|
214 |
// Get identity from user and redirect browser to OpenID Server
|
215 |
+
if( !isset( $request['oauth_token'] ) || $request['oauth_token'] == '' ) {
|
216 |
$twitterObj = new TwitterOAuth( $options['apsl_twitter_settings']['apsl_twitter_api_key'], $options['apsl_twitter_settings']['apsl_twitter_api_secret'] );
|
217 |
$encoded_url = isset( $_GET['redirect_to'] ) ? $_GET['redirect_to'] : '';
|
218 |
+
if( isset( $encoded_url ) && $encoded_url != '' ) {
|
219 |
$callback = $callBackUrl . 'apsl_login_id' . '=twitter_check&redirect_to=' . $encoded_url;
|
220 |
+
}
|
221 |
+
else {
|
222 |
$callback = $callBackUrl . 'apsl_login_id' . '=twitter_check';
|
223 |
}
|
224 |
+
|
225 |
$request_token = $twitterObj->getRequestToken( $callback );
|
226 |
$_SESSION['oauth_twitter'] = array();
|
|
|
227 |
/* Save temporary credentials to session. */
|
228 |
$_SESSION['oauth_twitter']['oauth_token'] = $token = $request_token['oauth_token'];
|
229 |
$_SESSION['oauth_twitter']['oauth_token_secret'] = $request_token['oauth_token_secret'];
|
|
|
230 |
/* If last connection failed don't display authorization link. */
|
231 |
+
switch( $twitterObj->http_code ) {
|
232 |
case 200:
|
233 |
try {
|
234 |
$url = $twitterObj->getAuthorizeUrl( $token );
|
235 |
$this->redirect( $url );
|
236 |
+
}
|
237 |
+
catch( Exception $e ) {
|
238 |
$response->status = 'ERROR';
|
239 |
$response->error_code = 2;
|
240 |
$response->error_message = 'Could not get AuthorizeUrl.';
|
241 |
}
|
242 |
+
break;
|
|
|
243 |
default:
|
244 |
$response->status = 'ERROR';
|
245 |
$response->error_code = 2;
|
246 |
$response->error_message = 'Could not connect to Twitter. Refresh the page or try again later.';
|
247 |
+
break;
|
248 |
}
|
249 |
+
}
|
250 |
+
else {
|
251 |
$response->status = 'ERROR';
|
252 |
$response->error_code = 2;
|
253 |
$response->error_message = 'INVALID AUTHORIZATION';
|
254 |
}
|
255 |
+
}
|
256 |
+
else if( isset( $request['oauth_token'] ) && isset( $request['oauth_verifier'] ) ) {
|
257 |
/* Create TwitteroAuth object with app key/secret and token key/secret from default phase */
|
258 |
$twitterObj = new TwitterOAuth( $options['apsl_twitter_settings']['apsl_twitter_api_key'], $options['apsl_twitter_settings']['apsl_twitter_api_secret'], $_SESSION['oauth_twitter']['oauth_token'], $_SESSION['oauth_twitter']['oauth_token_secret'] );
|
|
|
259 |
/* Remove no longer needed request tokens */
|
260 |
unset( $_SESSION['oauth_twitter'] );
|
261 |
try {
|
262 |
$access_token = $twitterObj->getAccessToken( $request['oauth_verifier'] );
|
263 |
/* If HTTP response is 200 continue otherwise send to connect page to retry */
|
264 |
+
if( 200 == $twitterObj->http_code ) {
|
265 |
+
$user_profile = $twitterObj->get( 'users/show', array('screen_name' => $access_token['screen_name'], 'include_entities' => true) );
|
|
|
266 |
/* Request access twitterObj from twitter */
|
267 |
$response->status = 'SUCCESS';
|
268 |
$response->deuid = $user_profile->id;
|
269 |
$response->deutype = 'twitter';
|
270 |
$response->name = explode( ' ', $user_profile->name, 2 );
|
271 |
$response->first_name = $response->name[0];
|
272 |
+
$response->last_name =( isset( $response->name[1] ) ) ? $response->name[1] : '';
|
273 |
$response->deuimage = $user_profile->profile_image_url_https;
|
274 |
$response->email = $user_profile->screen_name . '@twitter.com';
|
275 |
$response->username = $user_profile->screen_name . '@twitter.com';
|
278 |
$response->gender = $user_profile->gender;
|
279 |
$response->location = $user_profile->location;
|
280 |
$response->error_message = '';
|
281 |
+
}
|
282 |
+
else {
|
283 |
$response->status = 'ERROR';
|
284 |
$response->error_code = 2;
|
285 |
$response->error_message = 'Could not connect to Twitter. Refresh the page or try again later.';
|
286 |
}
|
287 |
+
}
|
288 |
+
catch( Exception $e ) {
|
289 |
$response->status = 'ERROR';
|
290 |
$response->error_code = 2;
|
291 |
$response->error_message = 'Could not get AccessToken.';
|
292 |
}
|
293 |
+
}
|
294 |
+
else { // User Canceled your Request
|
295 |
$response->status = 'ERROR';
|
296 |
$response->error_code = 1;
|
297 |
$response->error_message = "USER CANCELED REQUEST";
|
298 |
}
|
299 |
return $response;
|
300 |
}
|
|
|
301 |
//for google login
|
302 |
function onGoogleLogin() {
|
303 |
$result = $this->GoogleLogin();
|
304 |
+
if( isset( $result->status ) == 'SUCCESS' ) {
|
305 |
$row = $this->getUserByMail( $result->email );
|
306 |
$options = get_option( APSL_SETTINGS );
|
307 |
+
if( !$row ) {
|
308 |
$this->creatUser( $result->username, $result->email );
|
309 |
$row = $this->getUserByMail( $result->email );
|
310 |
update_user_meta( $row->ID, 'email', $result->email );
|
314 |
update_user_meta( $row->ID, 'deutype', $result->deutype );
|
315 |
update_user_meta( $row->ID, 'deuimage', $result->deuimage );
|
316 |
update_user_meta( $row->ID, 'description', $result->about );
|
317 |
+
wp_update_user( array('ID' => $row->ID, 'display_name' => $result->first_name, 'role' => $options['apsl_user_role'], 'user_url' => $result->url) );
|
318 |
}
|
319 |
$this->loginUser( $row->ID );
|
320 |
}
|
321 |
}
|
322 |
+
|
323 |
function GoogleLogin() {
|
324 |
$post = $_POST;
|
325 |
$get = $_GET;
|
332 |
$action = $a[1];
|
333 |
$client_id = $options['apsl_google_settings']['apsl_google_client_id'];
|
334 |
$client_secret = $options['apsl_google_settings']['apsl_google_client_secret'];
|
335 |
+
|
336 |
$site_url = site_url() . '/wp-admin';
|
337 |
$encoded_url = isset( $_GET['redirect_to'] ) ? $_GET['redirect_to'] : $site_url;
|
338 |
$callback = $callBackUrl . 'apsl_login_id' . '=google_check';
|
339 |
+
|
340 |
$redirect_uri = $callback;
|
341 |
$client = new Google_Client;
|
342 |
+
|
343 |
$client->setClientId( $client_id );
|
344 |
$client->setClientSecret( $client_secret );
|
345 |
$client->setRedirectUri( $redirect_uri );
|
346 |
$client->addScope( "https://www.googleapis.com/auth/plus.profile.emails.read" );
|
347 |
+
if( isset( $encoded_url ) && $encoded_url != '' ) {
|
348 |
$client->setState( base64_encode( "redirect_to=$encoded_url" ) );
|
|
|
|
|
349 |
}
|
350 |
+
|
351 |
$service = new Google_Service_Plus( $client );
|
352 |
+
|
353 |
+
if( $action == 'login' ) { // Get identity from user and redirect browser to OpenID Server
|
354 |
+
if( !( isset( $_SESSION['access_token'] ) && $_SESSION['access_token'] ) ) {
|
355 |
$authUrl = $client->createAuthUrl();
|
356 |
$this->redirect( $authUrl );
|
357 |
die();
|
358 |
+
}
|
359 |
+
else {
|
360 |
$this->redirect( $redirect_uri . "&redirect_to=$encoded_url" );
|
361 |
die();
|
362 |
}
|
363 |
+
}
|
364 |
+
elseif( isset( $_GET['code'] ) ) { // Perform HTTP Request to OpenID server to validate key
|
365 |
$client->authenticate( $_GET['code'] );
|
366 |
$_SESSION['access_token'] = $client->getAccessToken();
|
367 |
$this->redirect( $redirect_uri . "&redirect_to=$encoded_url" );
|
368 |
die();
|
369 |
+
}
|
370 |
+
elseif( isset( $_SESSION['access_token'] ) && $_SESSION['access_token'] ) {
|
371 |
$client->setAccessToken( $_SESSION['access_token'] );
|
372 |
+
|
373 |
try {
|
374 |
$user = $service->people->get( "me", array() );
|
375 |
+
}
|
376 |
+
catch( Exception $fault ) {
|
377 |
unset( $_SESSION['access_token'] );
|
378 |
$ref_object = $this->accessProtected( $fault, 'errors' );
|
379 |
echo $ref_object[0]['message'] . " Please notify about this error to the Site Admin.";
|
380 |
die();
|
381 |
}
|
382 |
+
|
383 |
+
if( !empty( $user ) ) {
|
384 |
+
if( !empty( $user->emails ) ) {
|
385 |
$response->email = $user->emails[0]->value;
|
386 |
$response->username = $user->emails[0]->value;
|
387 |
$response->first_name = $user->name->givenName;
|
395 |
$response->deutype = 'google';
|
396 |
$response->status = 'SUCCESS';
|
397 |
$response->error_message = '';
|
398 |
+
}
|
399 |
+
else {
|
400 |
$response->status = 'ERROR';
|
401 |
$response->error_code = 2;
|
402 |
$response->error_message = "INVALID AUTHORIZATION";
|
403 |
}
|
404 |
+
}
|
405 |
+
else { // Signature Verification Failed
|
406 |
$response->status = 'ERROR';
|
407 |
$response->error_code = 2;
|
408 |
$response->error_message = "INVALID AUTHORIZATION";
|
409 |
}
|
410 |
+
}
|
411 |
+
elseif( $get['openid_mode'] == 'cancel' ) { // User Canceled your Request
|
412 |
$response->status = 'ERROR';
|
413 |
$response->error_code = 1;
|
414 |
$response->error_message = "USER CANCELED REQUEST";
|
415 |
+
}
|
416 |
+
else { // User failed to login
|
417 |
$response->status = 'ERROR';
|
418 |
$response->error_code = 3;
|
419 |
$response->error_message = "USER LOGIN FAIL";
|
420 |
}
|
421 |
return $response;
|
422 |
}
|
|
|
423 |
//other remaining methods
|
424 |
function siteUrl() {
|
425 |
return site_url();
|
426 |
}
|
427 |
+
|
428 |
function callBackUrl() {
|
429 |
$connection = !empty( $_SERVER['HTTPS'] ) ? 'https://' : 'http://';
|
430 |
$url = $connection . $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"];
|
431 |
+
if( strpos( $url, '?' ) === false ) {
|
432 |
+
$url.= '?';
|
433 |
+
}
|
434 |
+
else {
|
435 |
+
$url.= '&';
|
436 |
}
|
437 |
return $url;
|
438 |
}
|
|
|
439 |
//function to return json values from social media urls
|
440 |
function get_json_values( $url ) {
|
441 |
$response = wp_remote_get( $url );
|
442 |
$json_response = wp_remote_retrieve_body( $response );
|
443 |
return $json_response;
|
444 |
}
|
445 |
+
|
446 |
function redirect( $redirect ) {
|
447 |
+
if( headers_sent() ) { // Use JavaScript to redirect if content has been previously sent (not recommended, but safe)
|
448 |
echo '<script language="JavaScript" type="text/javascript">window.location=\'';
|
449 |
echo $redirect;
|
450 |
echo '\';</script>';
|
451 |
+
}
|
452 |
+
else { // Default Header Redirect
|
453 |
header( 'Location: ' . $redirect );
|
454 |
}
|
455 |
exit;
|
456 |
}
|
457 |
+
|
458 |
function updateUser( $username, $email ) {
|
459 |
$row = $this->getUserByUsername( $username );
|
460 |
+
if( $row && $email != '' && $row->user_email != $email ) {
|
461 |
+
$row = (array)$row;
|
462 |
$row['user_email'] = $email;
|
463 |
wp_update_user( $row );
|
464 |
}
|
465 |
}
|
|
|
466 |
// Redefine user notification function
|
467 |
function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {
|
468 |
$user = new WP_User( $user_id );
|
469 |
+
|
470 |
$user_login = stripslashes( $user->user_login );
|
471 |
$user_email = stripslashes( $user->user_email );
|
472 |
+
|
473 |
$message = sprintf( __( 'New user registration on your blog %s:' ), get_option( 'blogname' ) ) . "\r\n\r\n";
|
474 |
+
$message.= sprintf( __( 'Username: %s' ), $user_login ) . "\r\n\r\n";
|
475 |
+
$message.= sprintf( __( 'E-mail: %s' ), $user_email ) . "\r\n";
|
476 |
+
|
477 |
@wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] New User Registration' ), get_option( 'blogname' ) ), $message );
|
478 |
+
|
479 |
+
if( empty( $plaintext_pass ) )return;
|
480 |
+
|
|
|
481 |
$message = __( 'Hi there,' ) . "\r\n\r\n";
|
482 |
+
$message.= sprintf( __( "Welcome to %s! Here's how to log in:" ), get_option( 'blogname' ) ) . "\r\n\r\n";
|
483 |
+
$message.= wp_login_url() . "\r\n";
|
484 |
+
$message.= sprintf( __( 'Username: %s' ), $user_login ) . "\r\n";
|
485 |
+
$message.= sprintf( __( 'Password: %s' ), $plaintext_pass ) . "\r\n\r\n";
|
486 |
+
$message.= sprintf( __( 'If you have any problems, please contact me at %s.' ), get_option( 'admin_email' ) ) . "\r\n\r\n";
|
487 |
+
$message.= __( 'Adios!' );
|
488 |
+
|
489 |
wp_mail( $user_email, sprintf( __( '[%s] Your username and password' ), get_option( 'blogname' ) ), $message );
|
490 |
}
|
491 |
+
|
492 |
function getUserByMail( $email ) {
|
493 |
global $wpdb;
|
494 |
$row = $wpdb->get_row( "SELECT * FROM $wpdb->users WHERE user_email = '$email'" );
|
495 |
+
if( $row ) {
|
496 |
return $row;
|
497 |
}
|
498 |
return false;
|
499 |
}
|
500 |
+
|
501 |
function getUserByUsername( $username ) {
|
502 |
global $wpdb;
|
503 |
$row = $wpdb->get_row( "SELECT * FROM $wpdb->users WHERE user_login = '$username'" );
|
504 |
+
if( $row ) {
|
505 |
return $row;
|
506 |
}
|
507 |
return false;
|
508 |
}
|
509 |
+
|
510 |
function creatUser( $user_name, $user_email ) {
|
511 |
$random_password = wp_generate_password( 12, false );
|
512 |
$user_id = wp_create_user( $user_name, $random_password, $user_email );
|
513 |
do_action( 'APSL_createUser', $user_id ); //hookable function to perform additional work after creation of user.
|
514 |
$options = get_option( APSL_SETTINGS );
|
515 |
+
if( $options['apsl_send_email_notification_options'] == 'yes' ) {
|
516 |
wp_new_user_notification( $user_id, $random_password );
|
517 |
}
|
518 |
return $user_id;
|
519 |
}
|
520 |
+
|
521 |
function set_cookies( $user_id = 0, $remember = true ) {
|
522 |
+
if( !function_exists( 'wp_set_auth_cookie' ) ) {
|
523 |
return false;
|
524 |
}
|
525 |
+
if( !$user_id ) {
|
526 |
return false;
|
527 |
}
|
528 |
wp_clear_auth_cookie();
|
530 |
wp_set_current_user( $user_id );
|
531 |
return true;
|
532 |
}
|
533 |
+
|
534 |
function loginUser( $user_id ) {
|
|
|
535 |
$current_url_an = get_permalink();
|
536 |
$reauth = empty( $_REQUEST['reauth'] ) ? false : true;
|
537 |
+
if( $reauth )wp_clear_auth_cookie();
|
538 |
+
|
539 |
+
if( isset( $_REQUEST['redirect_to'] ) ) {
|
|
|
540 |
$redirect_to = $_REQUEST['redirect_to'];
|
541 |
// Redirect to https if user wants ssl
|
542 |
+
if( isset( $secure_cookie ) && false !== strpos( $redirect_to, 'wp-admin' ) )$redirect_to = preg_replace( '|^http://|', 'https://', $redirect_to );
|
543 |
+
}
|
544 |
+
else {
|
545 |
$redirect_to = admin_url();
|
546 |
}
|
547 |
+
if( !isset( $secure_cookie ) && is_ssl() && force_ssl_login() && !force_ssl_admin() &&( 0 !== strpos( $redirect_to, 'https' ) ) &&( 0 === strpos( $redirect_to, 'http' ) ) )$secure_cookie = false;
|
|
|
|
|
548 |
// If cookies are disabled we can't log in even with a valid user+pass
|
549 |
+
if( isset( $_POST['testcookie'] ) && empty( $_COOKIE[TEST_COOKIE] ) )$user = new WP_Error( 'test_cookie', __( "<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress." ) );
|
550 |
+
else $user = wp_signon( '', isset( $secure_cookie ) );
|
551 |
+
|
552 |
+
if( !$this->set_cookies( $user_id ) ) {
|
|
|
|
|
553 |
return false;
|
554 |
}
|
555 |
$requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : site_url();
|
556 |
$user_login_url = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user );
|
557 |
+
|
558 |
$options = get_option( APSL_SETTINGS );
|
559 |
+
if( isset( $options['apsl_custom_login_redirect_options'] ) && $options['apsl_custom_login_redirect_options'] != '' ) {
|
560 |
+
if( $options['apsl_custom_login_redirect_options'] == 'home' ) {
|
561 |
$user_login_url = home_url();
|
562 |
+
}
|
563 |
+
else if( $options['apsl_custom_login_redirect_options'] == 'current_page' ) {
|
564 |
+
if( isset( $_REQUEST['redirect_to'] ) ) {
|
565 |
$redirect_to = $_REQUEST['redirect_to'];
|
566 |
// Redirect to https if user wants ssl
|
567 |
+
if( isset( $secure_cookie ) && false !== strpos( $redirect_to, 'wp-admin' ) )$user_login_url = preg_replace( '|^http://|', 'https://', $redirect_to );
|
568 |
+
}
|
569 |
+
else {
|
570 |
$user_login_url = home_url();
|
571 |
}
|
572 |
+
}
|
573 |
+
else if( $options['apsl_custom_login_redirect_options'] == 'custom_page' ) {
|
574 |
+
if( $options['apsl_custom_login_redirect_link'] != '' ) {
|
575 |
$login_page = $options['apsl_custom_login_redirect_link'];
|
576 |
$user_login_url = $login_page;
|
577 |
+
}
|
578 |
+
else {
|
579 |
$user_login_url = home_url();
|
580 |
}
|
581 |
}
|
582 |
+
}
|
583 |
+
else {
|
584 |
$user_login_url = home_url();
|
585 |
}
|
586 |
$redirect_to = $user_login_url;
|
587 |
wp_safe_redirect( $redirect_to );
|
588 |
exit();
|
589 |
}
|
|
|
590 |
//returns the current page url
|
591 |
public static function curPageURL() {
|
592 |
$pageURL = 'http';
|
593 |
+
if( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) {
|
594 |
+
$pageURL.= "s";
|
595 |
}
|
596 |
+
$pageURL.= "://";
|
597 |
+
if( $_SERVER["SERVER_PORT"] != "80" ) {
|
598 |
+
$pageURL.= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
599 |
+
}
|
600 |
+
else {
|
601 |
+
$pageURL.= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
602 |
}
|
603 |
return $pageURL;
|
604 |
}
|
|
|
605 |
//function to access the protected object properties
|
606 |
function accessProtected( $obj, $prop ) {
|
607 |
$reflection = new ReflectionClass( $obj );
|
609 |
$property->setAccessible( true );
|
610 |
return $property->getValue( $obj );
|
611 |
}
|
612 |
+
} //termination of a class
|
613 |
+
|
614 |
} //end of if statement
|
615 |
|
616 |
$apsl_login_check = new APSL_Lite_Login_Check_Class();
|
inc/frontend/login_integration.php
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
-
<?php
|
2 |
-
|
|
|
3 |
$options = get_option( APSL_SETTINGS );
|
4 |
|
5 |
$redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
|
1 |
+
<?php
|
2 |
+
|
3 |
+
defined( 'ABSPATH' ) or die( "No script kiddies please!" );
|
4 |
$options = get_option( APSL_SETTINGS );
|
5 |
|
6 |
$redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
|
readme.txt
CHANGED
@@ -4,14 +4,14 @@ Tags: social, login, social login, facebook, twitter, google, social connect, s
|
|
4 |
Donate link: http://accesspressthemes.com/donation/
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.3
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
No WordPress account and user credentials to remember, login using any of the most popular 3 social media accounts!
|
12 |
|
13 |
== Description ==
|
14 |
-
AccessPress <strong>Social Login<strong> lite - is a perfect <strong>Free WordPress plugin</strong> to allow your website users to register/login to the website using one of their favorite social website accounts.
|
15 |
|
16 |
As a website owner you can easily configure which social accounts to enable/disable for login, which areas of the website social login should be displayed (login, registration, comments). Also you can select the social login buttons/icons from 4 beautifully designed templates to fit them with your website's overall design/theme. Your website will fetch real data of the user's social profile!
|
17 |
|
@@ -77,7 +77,7 @@ For more features upgrade to PRO version
|
|
77 |
|
78 |
★ Works with Buddypress.
|
79 |
|
80 |
-
★ High level of customization/configuration - admin can change the title
|
81 |
attributes for social media icons, other texts, strings etc.
|
82 |
|
83 |
= Premium upgrade =
|
@@ -131,6 +131,9 @@ Yes. You can use the AccessPress social login lite anywhere by using shortcode i
|
|
131 |
4. Backend Other settings Section.
|
132 |
|
133 |
== Changelog ==
|
|
|
|
|
|
|
134 |
= 2.0.5 =
|
135 |
* Text domain changed to match the plugin folder name.
|
136 |
* Done the backend css modifications.
|
4 |
Donate link: http://accesspressthemes.com/donation/
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.3
|
7 |
+
Stable tag: 2.0.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
No WordPress account and user credentials to remember, login using any of the most popular 3 social media accounts!
|
12 |
|
13 |
== Description ==
|
14 |
+
AccessPress <strong>Social Login<strong> lite - is a perfect <strong>Free WordPress plugin</strong> to allow your website users to register/login to the website using one of their favorite social website accounts.
|
15 |
|
16 |
As a website owner you can easily configure which social accounts to enable/disable for login, which areas of the website social login should be displayed (login, registration, comments). Also you can select the social login buttons/icons from 4 beautifully designed templates to fit them with your website's overall design/theme. Your website will fetch real data of the user's social profile!
|
17 |
|
77 |
|
78 |
★ Works with Buddypress.
|
79 |
|
80 |
+
★ High level of customization/configuration - admin can change the title
|
81 |
attributes for social media icons, other texts, strings etc.
|
82 |
|
83 |
= Premium upgrade =
|
131 |
4. Backend Other settings Section.
|
132 |
|
133 |
== Changelog ==
|
134 |
+
= 2.0.6 =
|
135 |
+
* Code optimization. Removal of unnecessary php opening and closing tags.
|
136 |
+
|
137 |
= 2.0.5 =
|
138 |
* Text domain changed to match the plugin folder name.
|
139 |
* Done the backend css modifications.
|