Version Description
- Code formatting and optimization of the plugin files.
Download this release
Release Info
Developer | Access Keys |
Plugin | Social Login WordPress Plugin – AccessPress Social Login Lite |
Version | 2.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.0 to 2.0.1
- accesspress-social-login-lite.php +227 -229
- inc/backend/about.php +27 -27
- inc/backend/activation.php +29 -29
- inc/backend/how-to-use.php +39 -39
- inc/backend/main-page.php +395 -345
- inc/backend/save-settings.php +74 -75
- inc/frontend/login_check.php +339 -342
- inc/frontend/login_integration.php +25 -19
- inc/frontend/shortcode.php +63 -59
- readme.txt +5 -2
accesspress-social-login-lite.php
CHANGED
@@ -1,48 +1,49 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
3 |
/*
|
4 |
-
Plugin name: AccessPress Social Login Lite
|
5 |
-
Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-login-lite/
|
6 |
-
Description: A plugin to add various social logins to a site.
|
7 |
-
version: 2.0.
|
8 |
-
Author: AccessPress Themes
|
9 |
-
Author URI: https://accesspressthemes.com/
|
10 |
-
Text Domain: apsl-lite
|
11 |
-
Domain Path: /languages/
|
12 |
-
License: GPLv2 or later
|
13 |
-
*/
|
14 |
|
15 |
//Declearation of the necessary constants for plugin
|
16 |
-
if(!defined
|
17 |
-
|
18 |
}
|
19 |
|
20 |
-
if(
|
21 |
-
|
22 |
}
|
23 |
|
24 |
-
if(
|
25 |
-
|
26 |
}
|
27 |
|
28 |
-
if(
|
29 |
-
|
30 |
}
|
31 |
|
32 |
-
if(
|
33 |
-
|
34 |
}
|
35 |
|
36 |
-
if(
|
37 |
-
|
38 |
}
|
39 |
|
40 |
-
if(
|
41 |
-
|
42 |
}
|
43 |
|
44 |
-
if(
|
45 |
-
|
46 |
}
|
47 |
|
48 |
|
@@ -52,25 +53,26 @@ if( !defined('APSL_PLUGIN_DIR' )){
|
|
52 |
include_once( 'inc/backend/widget.php' );
|
53 |
|
54 |
// Redefine user notification function
|
55 |
-
if(!function_exists(
|
56 |
-
|
|
|
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
|
63 |
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
|
64 |
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
|
65 |
$message .= __('Thanks!');
|
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 |
return;
|
72 |
|
73 |
-
$message
|
74 |
$message .= sprintf(__("Welcome to %s! Here's how to log in:"), get_option('blogname')) . "\r\n\r\n";
|
75 |
$message .= wp_login_url() . "\r\n";
|
76 |
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n";
|
@@ -78,110 +80,105 @@ if(!function_exists( 'wp_new_user_notification' )){
|
|
78 |
$message .= sprintf(__('If you have any problems, please contact me at %s.'), get_option('admin_email')) . "\r\n\r\n";
|
79 |
$message .= __('Thanks!');
|
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 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
95 |
register_activation_hook(__FILE__, array($this, 'plugin_activation')); //load the default setting for the plugin while activating
|
96 |
-
add_action(
|
97 |
-
|
98 |
-
|
99 |
add_action('wp_enqueue_scripts', array($this, 'register_frontend_assets')); // registers all the assets required for the frontend
|
100 |
-
add_action(
|
101 |
-
|
102 |
-
$options = get_option(
|
103 |
-
if($options['apsl_enable_disable_plugin'] =='yes'){
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
}
|
117 |
|
118 |
add_shortcode('apsl-login-lite', array($this, 'apsl_shortcode')); //adds a shortcode
|
119 |
-
add_action(
|
120 |
add_action('widgets_init', array($this, 'register_apsl_widget')); //register the widget of a plugin
|
121 |
-
add_action(
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
return '<img alt="' . $user_meta_name . '" src="' . $user_picture . '" class="avatar apsl-avatar-social-login avatar-' . $size . ' photo" height="' . $size . '" width="' . $size . '" />';
|
178 |
-
}
|
179 |
-
}
|
180 |
-
}
|
181 |
-
return $avatar;
|
182 |
-
}
|
183 |
-
|
184 |
-
//starts the session with the call of init hook
|
185 |
function session_init() {
|
186 |
if (!session_id()) {
|
187 |
session_start();
|
@@ -189,82 +186,84 @@ if( !class_exists( 'APSL_Lite_Class' ) ){
|
|
189 |
}
|
190 |
|
191 |
//load the default settings of the plugin
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
|
|
|
|
268 |
function apsl_shortcode($attr) {
|
269 |
ob_start();
|
270 |
include('inc/frontend/shortcode.php');
|
@@ -274,42 +273,41 @@ if( !class_exists( 'APSL_Lite_Class' ) ){
|
|
274 |
}
|
275 |
|
276 |
//checking of the login
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
|
281 |
-
|
282 |
function register_apsl_widget() {
|
283 |
register_widget('APSL_Lite_Widget');
|
284 |
}
|
285 |
|
286 |
-
function apsl_login_form_enqueue_style(){
|
287 |
-
|
288 |
-
|
289 |
-
|
|
|
290 |
|
|
|
|
|
291 |
}
|
292 |
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
}else{
|
306 |
-
die( 'No script kiddies please!' );
|
307 |
-
}
|
308 |
-
}
|
309 |
|
310 |
-
|
311 |
-
}
|
312 |
|
313 |
-
|
|
|
314 |
|
315 |
-
|
1 |
<?php
|
2 |
+
|
3 |
+
defined('ABSPATH') or die("No script kiddies please!");
|
4 |
/*
|
5 |
+
Plugin name: AccessPress Social Login Lite
|
6 |
+
Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-login-lite/
|
7 |
+
Description: A plugin to add various social logins to a site.
|
8 |
+
version: 2.0.1
|
9 |
+
Author: AccessPress Themes
|
10 |
+
Author URI: https://accesspressthemes.com/
|
11 |
+
Text Domain: apsl-lite
|
12 |
+
Domain Path: /languages/
|
13 |
+
License: GPLv2 or later
|
14 |
+
*/
|
15 |
|
16 |
//Declearation of the necessary constants for plugin
|
17 |
+
if (!defined('APSL_VERSION')) {
|
18 |
+
define('APSL_VERSION', '2.0.1');
|
19 |
}
|
20 |
|
21 |
+
if (!defined('APSL_IMAGE_DIR')) {
|
22 |
+
define('APSL_IMAGE_DIR', plugin_dir_url(__FILE__) . 'images');
|
23 |
}
|
24 |
|
25 |
+
if (!defined('APSL_JS_DIR')) {
|
26 |
+
define('APSL_JS_DIR', plugin_dir_url(__FILE__) . 'js');
|
27 |
}
|
28 |
|
29 |
+
if (!defined('APSL_CSS_DIR')) {
|
30 |
+
define('APSL_CSS_DIR', plugin_dir_url(__FILE__) . 'css');
|
31 |
}
|
32 |
|
33 |
+
if (!defined('APSL_LANG_DIR')) {
|
34 |
+
define('APSL_LANG_DIR', basename(dirname(__FILE__)) . '/languages/');
|
35 |
}
|
36 |
|
37 |
+
if (!defined('APSL_TEXT_DOMAIN')) {
|
38 |
+
define('APSL_TEXT_DOMAIN', 'apsl-lite');
|
39 |
}
|
40 |
|
41 |
+
if (!defined('APSL_SETTINGS')) {
|
42 |
+
define('APSL_SETTINGS', 'apsl-lite-settings');
|
43 |
}
|
44 |
|
45 |
+
if (!defined('APSL_PLUGIN_DIR')) {
|
46 |
+
define('APSL_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
47 |
}
|
48 |
|
49 |
|
53 |
include_once( 'inc/backend/widget.php' );
|
54 |
|
55 |
// Redefine user notification function
|
56 |
+
if (!function_exists('wp_new_user_notification')) {
|
57 |
+
|
58 |
+
function wp_new_user_notification($user_id, $plaintext_pass = '') {
|
59 |
$user = new WP_User($user_id);
|
60 |
|
61 |
$user_login = stripslashes($user->user_login);
|
62 |
$user_email = stripslashes($user->user_email);
|
63 |
|
64 |
+
$message = sprintf(__('New user registration on your site %s:'), get_option('blogname')) . "\r\n\r\n";
|
65 |
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
|
66 |
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
|
67 |
$message .= __('Thanks!');
|
68 |
|
69 |
+
$headers = 'From:' . get_option('blogname') . ' <' . get_option('admin_email') . '>' . "\r\n";
|
70 |
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message, $headers);
|
71 |
|
72 |
+
if (empty($plaintext_pass))
|
73 |
return;
|
74 |
|
75 |
+
$message = __('Hi there,') . "\r\n\r\n";
|
76 |
$message .= sprintf(__("Welcome to %s! Here's how to log in:"), get_option('blogname')) . "\r\n\r\n";
|
77 |
$message .= wp_login_url() . "\r\n";
|
78 |
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n";
|
80 |
$message .= sprintf(__('If you have any problems, please contact me at %s.'), get_option('admin_email')) . "\r\n\r\n";
|
81 |
$message .= __('Thanks!');
|
82 |
|
83 |
+
$headers = 'From:' . get_option('blogname') . ' <' . get_option('admin_email') . '>' . "\r\n";
|
84 |
|
85 |
wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message, $headers);
|
|
|
86 |
}
|
87 |
+
|
88 |
}
|
89 |
|
90 |
// Declaration of the class
|
91 |
+
if (!class_exists('APSL_Lite_Class')) {
|
92 |
+
|
93 |
+
class APSL_Lite_Class {
|
94 |
+
|
95 |
+
var $apsl_settings;
|
96 |
+
|
97 |
+
function __construct() {
|
98 |
+
$this->apsl_settings = get_option(APSL_SETTINGS);
|
99 |
+
add_action('init', array($this, 'session_init')); //start the session if not started yet.
|
100 |
register_activation_hook(__FILE__, array($this, 'plugin_activation')); //load the default setting for the plugin while activating
|
101 |
+
add_action('init', array($this, 'plugin_text_domain')); //load the plugin text domain
|
102 |
+
add_action('admin_menu', array($this, 'add_apsl_menu')); //register the plugin menu in backend
|
103 |
+
add_action('admin_enqueue_scripts', array($this, 'register_admin_assets')); //registers all the assets required for wp-admin
|
104 |
add_action('wp_enqueue_scripts', array($this, 'register_frontend_assets')); // registers all the assets required for the frontend
|
105 |
+
add_action('admin_post_apsl_save_options', array($this, 'save_settings')); //save settings of a plugin
|
106 |
+
|
107 |
+
$options = get_option(APSL_SETTINGS);
|
108 |
+
if ($options['apsl_enable_disable_plugin'] == 'yes') {
|
109 |
+
if (in_array("login_form", $options['apsl_display_options'])) {
|
110 |
+
add_action('login_form', array($this, 'add_social_login')); // add the social logins to the login form
|
111 |
+
}
|
112 |
+
|
113 |
+
if (in_array("register_form", $options['apsl_display_options'])) {
|
114 |
+
add_action('register_form', array($this, 'add_social_login')); //add the social logins to the registration form
|
115 |
+
add_action('after_signup_form', array($this, 'add_social_login'));
|
116 |
+
}
|
117 |
+
|
118 |
+
if (in_array("comment_form", $options['apsl_display_options'])) {
|
119 |
+
add_action('comment_form_top', array($this, 'add_social_login_form_to_comment')); //add the social logins to the comment form
|
120 |
+
}
|
121 |
}
|
122 |
|
123 |
add_shortcode('apsl-login-lite', array($this, 'apsl_shortcode')); //adds a shortcode
|
124 |
+
add_action('init', array($this, 'login_check')); //check for the social logins
|
125 |
add_action('widgets_init', array($this, 'register_apsl_widget')); //register the widget of a plugin
|
126 |
+
add_action('login_enqueue_scripts', array($this, 'apsl_login_form_enqueue_style'), 10);
|
127 |
+
add_action('login_enqueue_scripts', array($this, 'apsl_login_form__enqueue_script'), 1);
|
128 |
+
add_action('admin_post_apsl_restore_default_settings', array($this, 'apsl_restore_default_settings')); //restores default settings.
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Hook to display custom avatars
|
132 |
+
*/
|
133 |
+
add_filter('get_avatar', array($this, 'apsl_social_login_custom_avatar'), 10, 5);
|
134 |
+
}
|
135 |
+
|
136 |
+
function apsl_social_login_custom_avatar($avatar, $mixed, $size, $default, $alt = '') {
|
137 |
+
$options = get_option(APSL_SETTINGS);
|
138 |
+
|
139 |
+
//Check if we have an user identifier
|
140 |
+
if (is_numeric($mixed) AND $mixed > 0) {
|
141 |
+
$user_id = $mixed;
|
142 |
+
}
|
143 |
+
|
144 |
+
//Check if we have an user email
|
145 |
+
elseif (is_string($mixed) AND ( $user = get_user_by('email', $mixed))) {
|
146 |
+
$user_id = $user->ID;
|
147 |
+
}
|
148 |
+
//Check if we have an user object
|
149 |
+
elseif (is_object($mixed) AND property_exists($mixed, 'user_id') AND is_numeric($mixed->user_id)) {
|
150 |
+
$user_id = $mixed->user_id;
|
151 |
+
}
|
152 |
+
//None found
|
153 |
+
else {
|
154 |
+
$user_id = null;
|
155 |
+
}
|
156 |
+
|
157 |
+
//User found?
|
158 |
+
if (!empty($user_id)) {
|
159 |
+
|
160 |
+
//Override current avatar ?
|
161 |
+
$override_avatar = true;
|
162 |
+
|
163 |
+
//Read the avatar
|
164 |
+
$user_meta_thumbnail = get_user_meta($user_id, 'deuimage', true);
|
165 |
+
|
166 |
+
//read user details
|
167 |
+
$user_meta_name = get_user_meta($user_id, 'first_name', true);
|
168 |
+
|
169 |
+
if ($options['apsl_user_avatar_options'] == 'social') {
|
170 |
+
$user_picture = (!empty($user_meta_thumbnail) ? $user_meta_thumbnail : '');
|
171 |
+
|
172 |
+
//Avatar found?
|
173 |
+
if ($user_picture !== false AND strlen(trim($user_picture)) > 0) {
|
174 |
+
return '<img alt="' . $user_meta_name . '" src="' . $user_picture . '" class="avatar apsl-avatar-social-login avatar-' . $size . ' photo" height="' . $size . '" width="' . $size . '" />';
|
175 |
+
}
|
176 |
+
}
|
177 |
+
}
|
178 |
+
return $avatar;
|
179 |
+
}
|
180 |
+
|
181 |
+
//starts the session with the call of init hook
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
function session_init() {
|
183 |
if (!session_id()) {
|
184 |
session_start();
|
186 |
}
|
187 |
|
188 |
//load the default settings of the plugin
|
189 |
+
function plugin_activation() {
|
190 |
+
if (!get_option(APSL_SETTINGS)) {
|
191 |
+
include('inc/backend/activation.php');
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
//loads the text domain for translation
|
196 |
+
function plugin_text_domain() {
|
197 |
+
load_plugin_textdomain(APSL_TEXT_DOMAIN, false, APSL_LANG_DIR);
|
198 |
+
}
|
199 |
+
|
200 |
+
//register the plugin menu for backend.
|
201 |
+
function add_apsl_menu() {
|
202 |
+
|
203 |
+
add_menu_page('AccessPress Social Login Lite', 'AccessPress Social Login Lite', 'manage_options', APSL_TEXT_DOMAIN, array($this, 'main_page'), APSL_IMAGE_DIR . '/icon.png');
|
204 |
+
}
|
205 |
+
|
206 |
+
//menu page
|
207 |
+
function main_page() {
|
208 |
+
include( 'inc/backend/main-page.php' );
|
209 |
+
}
|
210 |
+
|
211 |
+
//registration of the backend assets
|
212 |
+
function register_admin_assets() {
|
213 |
+
wp_enqueue_style('fontawsome-css', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', '', APSL_VERSION);
|
214 |
+
|
215 |
+
if (isset($_GET['page']) && $_GET['page'] == APSL_TEXT_DOMAIN) {
|
216 |
+
|
217 |
+
//backend scripts
|
218 |
+
wp_enqueue_script('jquery-ui-sortable');
|
219 |
+
wp_enqueue_script('apsl-admin-js', APSL_JS_DIR . '/backend.js', array('jquery', 'jquery-ui-sortable'), APSL_VERSION); //registering plugin's admin js
|
220 |
+
//register backend css
|
221 |
+
wp_enqueue_style('apsl-backend-css', APSL_CSS_DIR . '/backend.css', '', APSL_VERSION);
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
//registration of the plugins frontend assets
|
226 |
+
function register_frontend_assets() {
|
227 |
+
//register frontend scripts
|
228 |
+
wp_enqueue_script('apsl-frontend-js', APSL_JS_DIR . '/frontend.js', array('jquery'), APSL_VERSION);
|
229 |
+
|
230 |
+
//register frontend css
|
231 |
+
wp_enqueue_style('fontawsome-css', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', '', APSL_VERSION);
|
232 |
+
wp_enqueue_style('apsl-frontend-css', APSL_CSS_DIR . '/frontend.css', '', APSL_VERSION);
|
233 |
+
}
|
234 |
+
|
235 |
+
//save the settings of a plugin
|
236 |
+
function save_settings() {
|
237 |
+
if (isset($_POST['apsl_save_settings']) && $_POST['apsl_settings_action'] && wp_verify_nonce($_POST['apsl_settings_action'], 'apsl_nonce_save_settings')) {
|
238 |
+
include('inc/backend/save-settings.php');
|
239 |
+
} else {
|
240 |
+
die('No script kiddies please!');
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
//function to add the social login in the login and registration form.
|
245 |
+
function add_social_login() {
|
246 |
+
if (!is_user_logged_in()) {
|
247 |
+
include('inc/frontend/login_integration.php');
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
//function to add the social login in the comment form.
|
252 |
+
function add_social_login_form_to_comment() {
|
253 |
+
?>
|
254 |
+
<?php
|
255 |
+
|
256 |
+
$options = get_option(APSL_SETTINGS);
|
257 |
+
$login_text = $options['apsl_title_text_field'];
|
258 |
+
if (!is_user_logged_in()) {
|
259 |
+
?>
|
260 |
+
<?php
|
261 |
+
|
262 |
+
echo do_shortcode("[apsl-login-lite login_text='{$login_text}']");
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
//function for adding shortcode of a plugin
|
267 |
function apsl_shortcode($attr) {
|
268 |
ob_start();
|
269 |
include('inc/frontend/shortcode.php');
|
273 |
}
|
274 |
|
275 |
//checking of the login
|
276 |
+
function login_check() {
|
277 |
+
include('inc/frontend/login_check.php');
|
278 |
+
}
|
279 |
|
280 |
+
//registration of the social login widget
|
281 |
function register_apsl_widget() {
|
282 |
register_widget('APSL_Lite_Widget');
|
283 |
}
|
284 |
|
285 |
+
function apsl_login_form_enqueue_style() {
|
286 |
+
wp_enqueue_style('fontawsome-css', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', '', APSL_VERSION);
|
287 |
+
wp_enqueue_style('apsl-backend-css', APSL_CSS_DIR . '/backend.css', '', APSL_VERSION);
|
288 |
+
wp_enqueue_style('apsl-frontend-css', APSL_CSS_DIR . '/frontend.css', '', APSL_VERSION);
|
289 |
+
}
|
290 |
|
291 |
+
function apsl_login_form__enqueue_script() {
|
292 |
+
wp_enqueue_script('apsl-admin-js', APSL_JS_DIR . '/backend.js', array('jquery', 'jquery-ui-sortable'), APSL_VERSION); //registering plugin's admin js
|
293 |
}
|
294 |
|
295 |
+
function apsl_restore_default_settings() {
|
296 |
+
$nonce = $_REQUEST['_wpnonce'];
|
297 |
+
if (!empty($_GET) && wp_verify_nonce($nonce, 'apsl-restore-default-settings-nonce')) {
|
298 |
+
//restore the default plugin activation settings from the activation page.
|
299 |
+
include( 'inc/backend/activation.php' );
|
300 |
+
$_SESSION['apsl_message'] = __('Settings restored Successfully.', APSL_TEXT_DOMAIN);
|
301 |
+
wp_redirect(admin_url() . 'admin.php?page=' . APSL_TEXT_DOMAIN);
|
302 |
+
exit;
|
303 |
+
} else {
|
304 |
+
die('No script kiddies please!');
|
305 |
+
}
|
306 |
+
}
|
|
|
|
|
|
|
|
|
307 |
|
308 |
+
}
|
|
|
309 |
|
310 |
+
//class termination
|
311 |
+
}
|
312 |
|
313 |
+
$apsl_object = new APSL_Lite_Class();
|
inc/backend/about.php
CHANGED
@@ -1,31 +1,31 @@
|
|
1 |
<div class="about-wrapper clearfix">
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
</div>
|
7 |
</div>
|
8 |
</div>
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
</
|
16 |
-
|
17 |
-
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
1 |
<div class="about-wrapper clearfix">
|
2 |
+
<div class="about-desc-wrap clearfix">
|
3 |
+
<div class="ap-title"> About AccessPress Social Login</div>
|
4 |
+
<div class="about-content">
|
5 |
+
<p>AccessPress<strong>Social Login</strong> - is a perfect WordPress plugin to allow your website users to register/login to the website using one of their favorite social website accounts.</p>
|
|
|
6 |
</div>
|
7 |
</div>
|
8 |
+
</div>
|
9 |
+
<div class="social-more-wrap clearfix">
|
10 |
+
<div class="more-title"> More from AccessPress Themes </div>
|
11 |
+
<ul class="more-product">
|
12 |
+
<li><a href="https://accesspressthemes.com/plugins/"><span class="prod-title"> Wordpress Plugins </span> <img src="<?php echo APSL_IMAGE_DIR . '/plugin.png'; ?>" width="100%" /> </a></li>
|
13 |
+
<li><a href="https://accesspressthemes.com/themes/"><span class="prod-title"> Wordpress Themes </span> <img src="<?php echo APSL_IMAGE_DIR . '/theme.png'; ?>" width="100%" /></a></li>
|
14 |
+
<li><a href="https://accesspressthemes.com/contact/"><span class="prod-title"> Wordpress Customization </span> <img src="<?php echo APSL_IMAGE_DIR . '/customize.png'; ?>" width="100%" /></a></li>
|
15 |
+
</ul>
|
16 |
+
<div class="clear"></div>
|
17 |
+
</div>
|
18 |
|
19 |
+
<div class="social-share-wrap clearfix">
|
20 |
+
<div class="more-title"> Get social </div>
|
21 |
+
<div class="social-iframe"> <strong>Like us on facebook:</strong><br />
|
22 |
+
<iframe style="border: none; overflow: hidden; width: 764px; height: 206px;" src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fpages%2FAccessPress-Themes%2F1396595907277967&width=842&height=258&colorscheme=light&show_faces=true&header=false&stream=false&show_border=true&appId=1411139805828592" width="240" height="150" frameborder="0" scrolling="no"></iframe></div>
|
23 |
+
<ul class="about-social clearfix">
|
24 |
+
<li><a href="https://www.facebook.com/pages/AccessPress-Themes/1396595907277967" class="fb"><i class="fa fa-facebook"> </i><br /> <span> Follow us on <span class="bold"> Facebook </span></span></a></li>
|
25 |
+
<li><a href="https://twitter.com/apthemes" class="twt"><i class="fa fa-twitter"> </i><br /><span> Follow us on <span class="bold"> Twitter </span> </span></a></li>
|
26 |
+
<li><a href="https://plus.google.com/+Accesspressthemesprofile/" class="gp"><i class="fa fa-google-plus"> </i><br /><span> Follow us on <span class="bold"> Google + </span> </span></a></li>
|
27 |
+
<li><a href="https://www.youtube.com/user/accesspressthemes" class="utube"><i class="fa fa-youtube"> </i><br /><span> Subscribe us on <span class="bold"> Youtube </span> </span></a></li>
|
28 |
+
<li><a href="skype:access-keys" class="skype"><i class="fa fa-skype"> </i><br /><span> Contact us on <span class="bold"> Skype </span> </span></a></li>
|
29 |
+
<li><a href="https://www.pinterest.com/accesspresswp/" class="pin"><i class="fa fa-pinterest"> </i><br /><span> Follow us on <span class="bold"> Pinterest </span> </span></a></li>
|
30 |
+
</ul>
|
31 |
+
</div>
|
inc/backend/activation.php
CHANGED
@@ -1,52 +1,52 @@
|
|
1 |
-
<?php defined(
|
2 |
<?php
|
|
|
3 |
$apsl_settings = array();
|
4 |
|
5 |
-
$social_networks = array(
|
6 |
|
7 |
-
$apsl_settings['network_ordering']
|
8 |
|
9 |
//facebook settings
|
10 |
$facebook_parameters = array(
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
$apsl_settings['apsl_facebook_settings'] = $facebook_parameters;
|
16 |
|
17 |
//twitter settings
|
18 |
$twitter_parameters = array(
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
$apsl_settings['apsl_twitter_settings'] = $twitter_parameters;
|
24 |
|
25 |
//google settings
|
26 |
-
$google_parameters
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
$apsl_settings['apsl_google_settings']
|
32 |
|
33 |
-
$apsl_settings['apsl_enable_disable_plugin']
|
34 |
|
35 |
$display_options = array('login_form', 'register_form', 'comment_form');
|
36 |
-
$apsl_settings['apsl_display_options']
|
37 |
|
38 |
-
$apsl_settings['apsl_icon_theme']
|
39 |
|
40 |
-
$apsl_settings['apsl_title_text_field']
|
41 |
-
$apsl_settings['apsl_custom_logout_redirect_options']
|
42 |
-
$apsl_settings['apsl_custom_logout_redirect_link']
|
43 |
|
44 |
-
$apsl_settings['apsl_custom_login_redirect_options']
|
45 |
-
$apsl_settings['apsl_custom_login_redirect_link']
|
46 |
|
47 |
-
$apsl_settings['apsl_user_avatar_options']
|
48 |
|
49 |
-
$apsl_settings['apsl_send_email_notification_options']
|
50 |
|
51 |
-
update_option(
|
52 |
-
?>
|
1 |
+
<?php defined('ABSPATH') or die('No script kiddies please!'); ?>
|
2 |
<?php
|
3 |
+
|
4 |
$apsl_settings = array();
|
5 |
|
6 |
+
$social_networks = array(0 => 'facebook', 1 => 'twitter', 2 => 'google');
|
7 |
|
8 |
+
$apsl_settings['network_ordering'] = $social_networks;
|
9 |
|
10 |
//facebook settings
|
11 |
$facebook_parameters = array(
|
12 |
+
'apsl_facebook_enable' => '0',
|
13 |
+
'apsl_facebook_app_id' => '',
|
14 |
+
'apsl_facebook_app_secret' => ''
|
15 |
+
);
|
16 |
$apsl_settings['apsl_facebook_settings'] = $facebook_parameters;
|
17 |
|
18 |
//twitter settings
|
19 |
$twitter_parameters = array(
|
20 |
+
'apsl_twitter_enable' => '0',
|
21 |
+
'apsl_twitter_api_key' => '',
|
22 |
+
'apsl_twitter_api_secret' => ''
|
23 |
+
);
|
24 |
$apsl_settings['apsl_twitter_settings'] = $twitter_parameters;
|
25 |
|
26 |
//google settings
|
27 |
+
$google_parameters = array(
|
28 |
+
'apsl_google_enable' => '0',
|
29 |
+
'apsl_google_client_id' => '',
|
30 |
+
'apsl_google_client_secret' => ''
|
31 |
+
);
|
32 |
+
$apsl_settings['apsl_google_settings'] = $google_parameters;
|
33 |
|
34 |
+
$apsl_settings['apsl_enable_disable_plugin'] = 'yes';
|
35 |
|
36 |
$display_options = array('login_form', 'register_form', 'comment_form');
|
37 |
+
$apsl_settings['apsl_display_options'] = $display_options;
|
38 |
|
39 |
+
$apsl_settings['apsl_icon_theme'] = '1';
|
40 |
|
41 |
+
$apsl_settings['apsl_title_text_field'] = 'Social connect:';
|
42 |
+
$apsl_settings['apsl_custom_logout_redirect_options'] = 'home';
|
43 |
+
$apsl_settings['apsl_custom_logout_redirect_link'] = '';
|
44 |
|
45 |
+
$apsl_settings['apsl_custom_login_redirect_options'] = 'home';
|
46 |
+
$apsl_settings['apsl_custom_login_redirect_link'] = '';
|
47 |
|
48 |
+
$apsl_settings['apsl_user_avatar_options'] = 'default';
|
49 |
|
50 |
+
$apsl_settings['apsl_send_email_notification_options'] = 'yes';
|
51 |
|
52 |
+
update_option(APSL_SETTINGS, $apsl_settings);
|
|
inc/backend/how-to-use.php
CHANGED
@@ -1,47 +1,47 @@
|
|
1 |
<p>There are 2 main settings tabs that will help you to setup the plugin to work properly.</p>
|
2 |
<dl>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
|
46 |
</dl>
|
47 |
|
1 |
<p>There are 2 main settings tabs that will help you to setup the plugin to work properly.</p>
|
2 |
<dl>
|
3 |
+
<dt><strong>Network Settings:</strong></dt>
|
4 |
+
<dd>In this tab you can enable and disable the available social medias as per your need. Also you can order the apperance of the social medias simply by drag and drop.
|
5 |
+
</dd>
|
6 |
+
<p>For each social media you can</p>
|
7 |
+
<ul class='how-list'>
|
8 |
+
<li>Enable/Disable: You can enable and disable the social media.</li>
|
9 |
+
<li>App ID: App id of the social media.</li>
|
10 |
+
<li>App secret: App secret of the social media.</li>
|
11 |
+
</ul>
|
12 |
+
To get the App ID and App Secret please follow the instructions(notes).
|
13 |
|
14 |
+
<dt><strong>Other settings:</strong></dt>
|
15 |
+
<dd>
|
16 |
+
<p>In this tab you can do various settings of a plugin.</p>
|
17 |
+
<ul class="how-list">
|
18 |
+
<li>Enable or disable the social login.</li>
|
19 |
+
<li>Options to enable the social logins for login form, registration form and in comments.</li>
|
20 |
+
<li>Options to choose the pre available themes, You can choose any one theme from the pre available 4 themes.</li>
|
21 |
+
<li>Login text: Here you can setup the login text as per your need.</li>
|
22 |
+
</ul>
|
23 |
+
</dd>
|
24 |
|
25 |
+
<dt><strong>Shortcode:</strong></dt>
|
26 |
+
<dd><p>You can use shortcode for the display of the social logins in the contents of a posts and pages.
|
27 |
+
<ul class="how-list">
|
28 |
+
<li>Example 1: [apsl-login-lite login_text='Social Connection']</li>
|
29 |
+
<li>Shortcode attributes: <br />
|
30 |
+
i. login_text: you can use the custom login text for the shortcodes using this attribute.<br />
|
31 |
+
</li>
|
32 |
+
</ul>
|
33 |
+
</p></dd>
|
34 |
|
35 |
+
<dt><strong>Widget:</strong></dt>
|
36 |
+
<dd>
|
37 |
+
<p>You can use widget for the display of the social logins in the widgets area. <br/>
|
38 |
+
<ul class="how-list">
|
39 |
+
<li>Widget attributes <br />
|
40 |
+
i. Title: You can setup the widget title here.<br />
|
41 |
+
ii. Login text: You can setup the login text here.<br />
|
42 |
+
</li>
|
43 |
+
</ul>
|
44 |
+
</dd>
|
45 |
|
46 |
</dl>
|
47 |
|
inc/backend/main-page.php
CHANGED
@@ -1,356 +1,406 @@
|
|
1 |
<?php defined('ABSPATH') or die("No script kiddies please!"); ?>
|
2 |
<div class="wrap"><div class='apsl-outer-wrapper'>
|
3 |
|
4 |
-
<div class="apsl-setting-header clearfix">
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
</div>
|
|
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fpages%2FAccessPress-Themes%2F1396595907277967&width&layout=button&action=like&show_faces=false&share=false&height=35&appId=1411139805828592" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:20px; width:50px " allowtransparency="true"></iframe>
|
17 |
-
|
18 |
-
<iframe id="twitter-widget-0" scrolling="no" frameborder="0" allowtransparency="true" src="//platform.twitter.com/widgets/follow_button.5f46501ecfda1c3e1c05dd3e24875611.en.html#_=1421918256492&dnt=true&id=twitter-widget-0&lang=en&screen_name=apthemes&show_count=false&show_screen_name=true&size=m" class="twitter-follow-button twitter-follow-button" title="Twitter Follow Button" data-twttr-rendered="true" style="width: 126px; height: 20px;"></iframe>
|
19 |
-
<script>
|
20 |
-
!function (d, s, id) {
|
21 |
-
var js, fjs = d.getElementsByTagName(s)[0];
|
22 |
-
if (!d.getElementById(id)) {
|
23 |
-
js = d.createElement(s);
|
24 |
-
js.id = id;
|
25 |
-
js.src = "//platform.twitter.com/widgets.js";
|
26 |
-
fjs.parentNode.insertBefore(js, fjs);
|
27 |
-
}
|
28 |
-
}(document, "script", "twitter-wjs");
|
29 |
-
</script>
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
</div>
|
32 |
</div>
|
33 |
-
|
34 |
-
</div>
|
35 |
-
<div class="clear"></div>
|
36 |
</div>
|
37 |
-
<div class="clear"></div>
|
38 |
-
|
39 |
-
<?php $options = get_option( APSL_SETTINGS );
|
40 |
-
//$this->print_array($options);
|
41 |
-
?>
|
42 |
-
|
43 |
-
<?php
|
44 |
-
|
45 |
-
if(isset($_SESSION['apsl_message'])){ ?>
|
46 |
-
<div class="apsl-message">
|
47 |
-
<p><?php
|
48 |
-
echo $_SESSION['apsl_message'];
|
49 |
-
unset($_SESSION['apsl_message']);
|
50 |
-
?></p>
|
51 |
-
</div>
|
52 |
-
<?php } ?>
|
53 |
-
<div class='apsl-networks'>
|
54 |
-
<div class='apsl-network-options'>
|
55 |
-
<form method="post" action="<?php echo admin_url() . 'admin-post.php' ?>">
|
56 |
-
<input type="hidden" name="action" value="apsl_save_options"/>
|
57 |
-
<div class='apsl-settings-tabs-wrapper clearfix'>
|
58 |
-
<ul class='apsl-tab-wrapper-fix clearfix'>
|
59 |
-
<li><a href='javascript: void(0);' id='apsl-networks-settings' class='apsl-settings-tab apsl-active-tab' ><?php _e('Network settings', APSL_TEXT_DOMAIN ) ?></a></li>
|
60 |
-
<li><a href='javascript: void(0);' id='apsl-theme-settings' class='apsl-settings-tab' ><?php _e('Other settings', APSL_TEXT_DOMAIN ) ?></a></li>
|
61 |
-
<li><a href='javascript: void(0);' id='apsl-how-to-use' class='apsl-settings-tab' ><?php _e('How to use', APSL_TEXT_DOMAIN ) ?></a></li>
|
62 |
-
<li><a href='javascript: void(0);' id='apsl-about' class='apsl-settings-tab' ><?php _e('About', APSL_TEXT_DOMAIN ) ?></a></li>
|
63 |
-
</ul>
|
64 |
-
</div>
|
65 |
-
<div class="clear"></div>
|
66 |
-
<div class='apsl-setting-tabs-wrapper'>
|
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 switch($value){
|
72 |
-
case 'facebook': ?>
|
73 |
-
<div class='apsl-settings apsl-facebook-settings'>
|
74 |
-
<!-- Facebook Settings -->
|
75 |
-
<div class='apsl-label'><?php _e( "Facebook", APSL_TEXT_DOMAIN ); ?><span class='apsl_show_hide' id='apsl_show_hide_<?php echo $value; ?>'><i class="fa fa-caret-down"></i></span> </div>
|
76 |
-
<div class='apsl_network_settings_wrapper' id='apsl_network_settings_<?php echo $value; ?>' style='display:none'>
|
77 |
-
<div class='apsl-enable-disable'>
|
78 |
-
<label><?php _e('Enable?', APSL_TEXT_DOMAIN ); ?></label>
|
79 |
-
<input type='hidden' name='network_ordering[]' value='facebook' />
|
80 |
-
<input type="checkbox" id='aspl-facbook-enable' value='enable' name='apsl_facebook_settings[apsl_facebook_enable]' <?php checked( 'enable', $options['apsl_facebook_settings']['apsl_facebook_enable'] ); ?> />
|
81 |
-
</div>
|
82 |
-
<div class='apsl-app-id-wrapper'>
|
83 |
-
<label><?php _e( 'App ID:', APSL_TEXT_DOMAIN ); ?></label><input type='text' id='apsl-facebook-app-id' name='apsl_facebook_settings[apsl_facebook_app_id]' value='<?php if(isset($options['apsl_facebook_settings']['apsl_facebook_app_id'])){ echo $options['apsl_facebook_settings']['apsl_facebook_app_id']; } ?>' />
|
84 |
-
</div>
|
85 |
-
<div class='apsl-app-secret-wrapper'>
|
86 |
-
<label><?php _e( 'App Secret:', APSL_TEXT_DOMAIN ); ?></label><input type='text' id='apsl-facebook-app-secret' name='apsl_facebook_settings[apsl_facebook_app_secret]' value='<?php if(isset($options['apsl_facebook_settings']['apsl_facebook_app_secret'])){ echo $options['apsl_facebook_settings']['apsl_facebook_app_secret']; } ?>' />
|
87 |
-
</div>
|
88 |
-
<div class='apsl-info'>
|
89 |
-
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN ); ?></span> <br />
|
90 |
-
<span class='apsl-info-content'>You need to create a new facebook API Applitation to setup facebook login. Please follow the instructions to create new app.</span>
|
91 |
-
<br />
|
92 |
-
<ul class='apsl-info-lists'>
|
93 |
-
<li><b>Please note:</b> We have now updated our facbook sdk version to 5.0 so to make the facebook login work you need to have PHP version 5.4 at least.</li>
|
94 |
-
<li>Go to <a href='https://developers.facebook.com/apps' target='_blank'>https://developers.facebook.com/apps</a>.</li>
|
95 |
-
<li>Click on 'Add a New App' button. A popup will open. Then choose website.</li>
|
96 |
-
<li>Add the required informations and don't forget to make your app live. This is very important otherwise your app will not work for all users.</li>
|
97 |
-
<li>Then Click the "Create App" button and follow the instructions, your new app will be created. </li>
|
98 |
-
<li>To make app live please go to settings menu and enter your email address there. Click save changes.</li>
|
99 |
-
<li>Now go the 'status and reviews' menu and make the app live.</li>
|
100 |
-
<li>Copy and Paste "App ID" and "App Secret" here.</li>
|
101 |
-
<li>Site url: <input type='text' value='<?php echo site_url(); ?>' readonly='readonly' /></li>
|
102 |
-
</ul>
|
103 |
-
</div>
|
104 |
-
</div>
|
105 |
-
</div>
|
106 |
-
<?php break; ?>
|
107 |
-
|
108 |
-
<?php case 'twitter': ?>
|
109 |
-
<div class='apsl-settings apsl-twitter-settings'>
|
110 |
-
<!-- Twitter Settings -->
|
111 |
-
<div class='apsl-label'><?php _e( "Twitter", APSL_TEXT_DOMAIN ); ?> <span class='apsl_show_hide' id='apsl_show_hide_<?php echo $value; ?>'><i class="fa fa-caret-down"></i></span> </div>
|
112 |
-
<div class='apsl_network_settings_wrapper' id='apsl_network_settings_<?php echo $value; ?>' style='display:none'>
|
113 |
-
<div class='apsl-enable-disable'>
|
114 |
-
<label><?php _e('Enable?', APSL_TEXT_DOMAIN ); ?></label>
|
115 |
-
<input type="checkbox" id='aspl-twitter-enable' value='enable' name='apsl_twitter_settings[apsl_twitter_enable]' <?php checked( 'enable', $options['apsl_twitter_settings']['apsl_twitter_enable'] ); ?> />
|
116 |
-
</div>
|
117 |
-
|
118 |
-
<div class='apsl-app-id-wrapper'>
|
119 |
-
<label><?php _e( 'Consumer Key (API Key):', APSL_TEXT_DOMAIN ); ?></label><input type='text' id='apsl-twitter-app-id' name='apsl_twitter_settings[apsl_twitter_api_key]' value='<?php if(isset($options['apsl_twitter_settings']['apsl_twitter_api_key'])){ echo $options['apsl_twitter_settings']['apsl_twitter_api_key']; } ?>' />
|
120 |
-
</div>
|
121 |
-
|
122 |
-
<div class='apsl-app-secret-wrapper'>
|
123 |
-
<label><?php _e( 'Consumer Secret (API Secret):', APSL_TEXT_DOMAIN ); ?></label><input type='text' id='apsl-twitter-app-secret' name='apsl_twitter_settings[apsl_twitter_api_secret]' value='<?php if(isset($options['apsl_twitter_settings']['apsl_twitter_api_secret'])){ echo $options['apsl_twitter_settings']['apsl_twitter_api_secret']; } ?>' />
|
124 |
-
</div>
|
125 |
-
|
126 |
-
<input type='hidden' name='network_ordering[]' value='twitter' />
|
127 |
-
<div class='apsl-info'>
|
128 |
-
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN ); ?> <br /> </span>
|
129 |
-
<span class='apsl-info-content'>You need to create new twitter API application to setup the twitter login. Please follow the instructions to create new app.</span>
|
130 |
-
<ul class='apsl-info-lists'>
|
131 |
-
<li>Go to <a href='https://apps.twitter.com/' target='_blank'>https://apps.twitter.com/</a></li>
|
132 |
-
<li>Click on Create New App button. A new application details form will appear. Please fill up the application details and click on "create your twitter application" button.</li>
|
133 |
-
<li>Please note that before creating twiiter API application, You must add your mobile phone to your Twitter profile.</li>
|
134 |
-
<li>After successful creation of the app. Please go to "Keys and Access Tokens" tabs and get Consumer key(API Key) and Consumer secret(API secret).</li>
|
135 |
-
<li>Website: <input type='text' value='<?php echo site_url(); ?>' readonly='readonly'/></li>
|
136 |
-
<li>Callback URL: <input type='text' value='<?php echo site_url(); ?>' readonly='readonly'/></li>
|
137 |
-
</ul>
|
138 |
-
|
139 |
-
</div>
|
140 |
-
</div>
|
141 |
-
</div>
|
142 |
-
<?php break;
|
143 |
-
|
144 |
-
case 'google': ?>
|
145 |
-
<div class='apsl-settings apsl-google-settings'>
|
146 |
-
<!-- Google Settings -->
|
147 |
-
<div class='apsl-label'><?php _e( "Google", APSL_TEXT_DOMAIN ); ?> <span class='apsl_show_hide' id='apsl_show_hide_<?php echo $value; ?>'><i class="fa fa-caret-down"></i></span> </div>
|
148 |
-
<div class='apsl_network_settings_wrapper' id='apsl_network_settings_<?php echo $value; ?>' style='display:none'>
|
149 |
-
<div class='apsl-enable-disable'>
|
150 |
-
<label><?php _e('Enable?', APSL_TEXT_DOMAIN ); ?></label>
|
151 |
-
<input type="checkbox" id='aspl-google-enable' value='enable' name='apsl_google_settings[apsl_google_enable]' <?php checked( 'enable', $options['apsl_google_settings']['apsl_google_enable'] ); ?> />
|
152 |
-
</div>
|
153 |
-
<div class='apsl-app-id-wrapper'>
|
154 |
-
<label><?php _e( 'Client ID:', APSL_TEXT_DOMAIN ); ?></label><input type='text' id='apsl-google-client-id' name='apsl_google_settings[apsl_google_client_id]' value='<?php if(isset($options['apsl_google_settings']['apsl_google_client_id'])){ echo $options['apsl_google_settings']['apsl_google_client_id']; } ?>' />
|
155 |
-
</div>
|
156 |
-
<div class='apsl-app-secret-wrapper'>
|
157 |
-
<label><?php _e( 'Client Secret:', APSL_TEXT_DOMAIN ); ?></label><input type='text' id='apsl-google-client-secret' name='apsl_google_settings[apsl_google_client_secret]' value='<?php if(isset($options['apsl_google_settings']['apsl_google_client_secret'])){ echo $options['apsl_google_settings']['apsl_google_client_secret']; } ?>' />
|
158 |
-
</div>
|
159 |
-
<input type='hidden' name='network_ordering[]' value='google' />
|
160 |
-
<div class='apsl-info'>
|
161 |
-
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN ); ?></span> <br />
|
162 |
-
<span class='apsl-info-content'>You need to create new google API application to setup the google login. Please follow the instructions to create new application.</span>
|
163 |
-
<ul class='apsl-info-lists'>
|
164 |
-
<li>Go to <a href='https://console.developers.google.com/project' target='_blank'>https://console.developers.google.com/project.</a> </li>
|
165 |
-
<li>Click on "Create Project" button.</li>
|
166 |
-
<li>A pop up will appear.</li>
|
167 |
-
<li>Please enter Project name and click on "Create" button.</li>
|
168 |
-
<li>Now click on APIs & Auth > Consent screen and fill up the required credentials.</li>
|
169 |
-
<li>Now click on APIs & Auth > Credentials.</li>
|
170 |
-
<li>Now click on "Create new Client ID" button and fill up the required credentials.</li>
|
171 |
-
<li>Get the client ID and client secret.</li>
|
172 |
-
<li>Now go to APIs > Social APIs > Google+ API and enable it. It is very important to enable it for the google login to work.</li>
|
173 |
-
<li>Rediret uri setup:<br />
|
174 |
-
Please use <input type='text' value='<?php echo site_url(); ?>/wp-login.php?apsl_login_id=google_check' readonly='readonly'/> - for wordpress login page.<br />
|
175 |
-
Please use <input type='text' value='<?php echo site_url(); ?>/index.php?apsl_login_id=google_check' readonly='readonly'/> - if you have used the shortcode or widget in frontend.
|
176 |
-
</li>
|
177 |
-
<li>
|
178 |
-
Please note: Make sure to check the protocol "http://" or "https://" as google checks protocol as well. Better to add both URL in the list if you site is https so that google social login work properly for both https and http browser.
|
179 |
-
</li>
|
180 |
-
</ul>
|
181 |
-
</div>
|
182 |
-
</div>
|
183 |
-
</div>
|
184 |
-
<?php break; ?>
|
185 |
-
|
186 |
-
<?php default:
|
187 |
-
echo "should not reach here";
|
188 |
-
break;
|
189 |
-
|
190 |
-
} ?>
|
191 |
-
<?php endforeach; ?>
|
192 |
-
</div>
|
193 |
-
</div>
|
194 |
-
|
195 |
-
<div class='apsl-tab-contents' id='tab-apsl-theme-settings' style="display:none">
|
196 |
-
|
197 |
-
<div class='apsl-settings'>
|
198 |
-
<div class='apsl-enable-disable-opt'>
|
199 |
-
<div class="apsl-label"><?php _e('Social login', APSL_TEXT_DOMAIN ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
200 |
-
<div class='apsl_network_settings_wrapper' style='display:none'>
|
201 |
-
<p class="social-login">
|
202 |
-
<span><?php _e('Enable social login?', APSL_TEXT_DOMAIN ); ?></span>
|
203 |
-
<input type='radio' id='apsl_enable_plugin' name='apsl_enable_disable_plugin' value='yes' <?php checked( $options['apsl_enable_disable_plugin'], 'yes', 'true' ); ?> /> <label for='apsl_enable_plugin'>Yes</label>
|
204 |
-
<input type='radio' id='apsl_disable_plugin' name='apsl_enable_disable_plugin' value='no' <?php checked( $options['apsl_enable_disable_plugin'], 'no', 'true' ); ?> /> <label for='apsl_disable_plugin'>No</label>
|
205 |
-
</p>
|
206 |
-
</div>
|
207 |
-
</div>
|
208 |
-
</div>
|
209 |
-
|
210 |
-
<div class='apsl-settings'>
|
211 |
-
<div class='apsl-display-options'>
|
212 |
-
<div class="apsl-label"><?php _e('Display options', APSL_TEXT_DOMAIN ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span></div>
|
213 |
-
<div class='apsl_network_settings_wrapper' style='display:none'>
|
214 |
-
<p><?php _e('Please choose the options where you want to display the social login form.', APSL_TEXT_DOMAIN ); ?></p>
|
215 |
-
<p><input type="checkbox" id="apsl_login_form" value="login_form" name="apsl_display_options[]" <?php if (in_array("login_form", $options['apsl_display_options'])) { echo "checked='checked'"; } ?> ><label for="apsl_login_form"><?php _e( 'Login Form', APSL_TEXT_DOMAIN ); ?> </label></p>
|
216 |
-
<p><input type="checkbox" id="apsl_register_form" value="register_form" name="apsl_display_options[]" <?php if (in_array("register_form", $options['apsl_display_options'])) { echo "checked='checked'"; } ?> ><label for="apsl_register_form"><?php _e( 'Register Form', APSL_TEXT_DOMAIN ); ?> </label></p>
|
217 |
-
<p><input type="checkbox" id="apsl_comment_form" value="comment_form" name="apsl_display_options[]" <?php if (in_array("comment_form", $options['apsl_display_options'])) { echo "checked='checked'"; } ?> ><label for="apsl_comment_form"><?php _e( 'Comments', APSL_TEXT_DOMAIN ); ?> </label></p>
|
218 |
-
</div>
|
219 |
-
</div>
|
220 |
-
</div>
|
221 |
-
|
222 |
-
<div class='apsl-settings'>
|
223 |
-
<div class='apsl-themes-wrapper'>
|
224 |
-
<div class="apsl-label"><?php _e('Available icon themes', APSL_TEXT_DOMAIN ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
225 |
-
<div class='apsl_network_settings_wrapper' style='display:none'>
|
226 |
-
<?php for($i=1; $i<=4; $i++): ?>
|
227 |
-
<div class='apsl-theme apsl-theme-<?php echo $i; ?>'>
|
228 |
-
<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'] ); ?> >
|
229 |
-
<span><?php _e('Theme '.$i, APSL_TEXT_DOMAIN ); ?></span></label>
|
230 |
-
<div class="apsl-theme-previewbox">
|
231 |
-
<img src="<?php echo APSL_IMAGE_DIR; ?>/preview-<?php echo $i; ?>.jpg" alt="theme preview">
|
232 |
-
</div>
|
233 |
-
</div>
|
234 |
-
<?php endfor; ?>
|
235 |
-
</div>
|
236 |
-
</div>
|
237 |
-
</div>
|
238 |
-
|
239 |
-
<div class='apsl-settings'>
|
240 |
-
<div class='apsl-text-settings'>
|
241 |
-
<div class="apsl-label"><?php _e('Text settings', APSL_TEXT_DOMAIN ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
242 |
-
<div class='apsl_network_settings_wrapper' style='display:none'>
|
243 |
-
<p class='apsl-title-text-field'>
|
244 |
-
<span><?php _e('Login text:', APSL_TEXT_DOMAIN ); ?></span> <input type='text' name='apsl_title_text_field' id='apsl-title-text' value='<?php if(isset($options['apsl_title_text_field']) && $options['apsl_title_text_field'] !=''){ echo $options['apsl_title_text_field']; } ?>' />
|
245 |
-
</p>
|
246 |
-
</div>
|
247 |
-
</div>
|
248 |
-
</div>
|
249 |
-
|
250 |
-
<div class='apsl-settings'>
|
251 |
-
<div class='apsl-logout-redirect-settings'>
|
252 |
-
<div class="apsl-label"><?php _e('Logout redirect link', APSL_TEXT_DOMAIN ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
253 |
-
<div class='apsl_network_settings_wrapper' style='display:none'>
|
254 |
-
<input type='radio' id='apsl_custom_logout_redirect_home' class='apsl_custom_logout_redirect_options' name='apsl_custom_logout_redirect_options' value='home' <?php if(isset($options['apsl_custom_logout_redirect_options'])){ checked( $options['apsl_custom_logout_redirect_options'], 'home', 'true' ); } ?> /> <label for='apsl_custom_logout_redirect_home'><?php _e('Home page', APSL_TEXT_DOMAIN ); ?></label><br /><br />
|
255 |
-
<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 if(isset($options['apsl_custom_logout_redirect_options'])){ checked( $options['apsl_custom_logout_redirect_options'], 'current_page', 'true' ); } ?> /> <label for='apsl_custom_logout_redirect_current'><?php _e('Current page', APSL_TEXT_DOMAIN ); ?></label><br /><br />
|
256 |
-
|
257 |
-
|
258 |
-
<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 if(isset($options['apsl_custom_logout_redirect_options'])){ checked( $options['apsl_custom_logout_redirect_options'], 'custom_page', 'true' ); } ?> /> <label for='apsl_custom_logout_redirect_custom'><?php _e('Custom page', APSL_TEXT_DOMAIN ); ?></label><br />
|
259 |
-
|
260 |
-
<div class='apsl-custom-logout-redirect-link' <?php if(isset($options['apsl_custom_logout_redirect_options'])){ if($options['apsl_custom_logout_redirect_options'] =='custom_page'){ ?> style='display: block' <?php }else{ ?> style='display:none' <?php } } ?>>
|
261 |
-
<p class='apsl-title-text-field'>
|
262 |
-
<span><?php _e('Logout redirect page:', APSL_TEXT_DOMAIN ); ?></span> <input type='text' name='apsl_custom_logout_redirect_link' id='apsl-custom-logout-redirect-link' value='<?php if(isset($options['apsl_custom_logout_redirect_link']) && $options['apsl_custom_logout_redirect_link'] !=''){ echo $options['apsl_custom_logout_redirect_link']; } ?>' />
|
263 |
-
</p>
|
264 |
-
<div class='apsl-info'>
|
265 |
-
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN ); ?></span> <br />
|
266 |
-
<span class='apsl-info-content'>Please set this value if you want to redirect the user to the custom page url(full url). If this field is not set they will be redirected back to current page.</span>
|
267 |
-
</div>
|
268 |
-
</div>
|
269 |
-
</div>
|
270 |
-
</div>
|
271 |
-
</div>
|
272 |
-
|
273 |
-
<div class='apsl-settings'>
|
274 |
-
<div class='apsl-login-redirect-settings'>
|
275 |
-
<div class="apsl-label"><?php _e('Login redirect link', APSL_TEXT_DOMAIN ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
276 |
-
<div class='apsl_network_settings_wrapper' style='display:none'>
|
277 |
-
<input type='radio' id='apsl_custom_login_redirect_home' class='apsl_custom_login_redirect_options' name='apsl_custom_login_redirect_options' value='home' <?php if(isset($options['apsl_custom_login_redirect_options'])){ checked( $options['apsl_custom_login_redirect_options'], 'home', 'true' ); } ?> /> <label for='apsl_custom_login_redirect_home'><?php _e('Home page', APSL_TEXT_DOMAIN ); ?></label><br /><br />
|
278 |
-
<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 if(isset($options['apsl_custom_login_redirect_options'])){ checked( $options['apsl_custom_login_redirect_options'], 'current_page', 'true' ); } ?> /> <label for='apsl_custom_login_redirect_current'><?php _e('Current page', APSL_TEXT_DOMAIN ); ?></label><br /><br />
|
279 |
-
<div class='apsl-custom-login-redirect-link1' >
|
280 |
-
<div class='apsl-info'>
|
281 |
-
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN ); ?></span> <br />
|
282 |
-
<span class='apsl-info-content'> If plugin can't detect what is the redirect uri for the page it will be redirected to home page.</span>
|
283 |
-
</div>
|
284 |
-
</div>
|
285 |
-
<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 if(isset($options['apsl_custom_login_redirect_options'])){ checked( $options['apsl_custom_login_redirect_options'], 'custom_page', 'true' ); } ?> /> <label for='apsl_custom_login_redirect_custom'><?php _e('Custom page', APSL_TEXT_DOMAIN ); ?></label><br />
|
286 |
-
|
287 |
-
<div class='apsl-custom-login-redirect-link' <?php if(isset($options['apsl_custom_login_redirect_options'])) { if($options['apsl_custom_login_redirect_options'] =='custom_page'){ ?> style='display: block' <?php }else{ ?> style='display:none' <?php } } ?>>
|
288 |
-
<p class='apsl-title-text-field'>
|
289 |
-
<span><?php _e('Login redirect page:', APSL_TEXT_DOMAIN ); ?></span> <input type='text' name='apsl_custom_login_redirect_link' id='apsl-custom-login-redirect-link' value='<?php if(isset($options['apsl_custom_login_redirect_link']) && $options['apsl_custom_login_redirect_link'] !=''){ echo $options['apsl_custom_login_redirect_link']; } ?>' />
|
290 |
-
</p>
|
291 |
-
<div class='apsl-info'>
|
292 |
-
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN ); ?></span> <br />
|
293 |
-
<span class='apsl-info-content'>Please set this value if you want to redirect the user to the custom page url(full url). If this field is not set they will be redirected back to home page.</span>
|
294 |
-
</div>
|
295 |
-
</div>
|
296 |
-
</div>
|
297 |
-
</div>
|
298 |
-
</div>
|
299 |
-
|
300 |
-
<div class='apsl-settings'>
|
301 |
-
<div class='apsl-user-avatar-settings'>
|
302 |
-
<div class="apsl-label"><?php _e('User avatar', APSL_TEXT_DOMAIN ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
303 |
-
<div class='apsl_network_settings_wrapper' style='display:none'>
|
304 |
-
<input type='radio' id='apsl_user_avatar_default' class='apsl_user_avatar_options' name='apsl_user_avatar_options' value='default' <?php if(isset($options['apsl_user_avatar_options'])){ checked( $options['apsl_user_avatar_options'], 'default', 'true' ); } ?> /> <label for='apsl_user_avatar_default'><?php _e('Use wordpress provided default avatar.', APSL_TEXT_DOMAIN ); ?></label><br /><br />
|
305 |
-
<input type='radio' id='apsl_user_avatar_social' class='apsl_user_avatar_options' name='apsl_user_avatar_options' value='social' <?php if(isset($options['apsl_user_avatar_options'])){ checked( $options['apsl_user_avatar_options'], 'social', 'true' ); } ?> /> <label for='apsl_user_avatar_social'><?php _e('Use the profile picture from social media where available.', APSL_TEXT_DOMAIN ); ?></label><br /><br />
|
306 |
-
<div class='apsl-info'>
|
307 |
-
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN ); ?></span> <br />
|
308 |
-
<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>
|
309 |
-
</div>
|
310 |
-
</div>
|
311 |
-
</div>
|
312 |
-
</div>
|
313 |
-
|
314 |
-
<div class='apsl-settings'>
|
315 |
-
<div class='apsl-user-email-settings'>
|
316 |
-
<div class="apsl-label"><?php _e('Email notification settings', APSL_TEXT_DOMAIN ); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
317 |
-
<div class='apsl_network_settings_wrapper' style='display:none'>
|
318 |
-
<input type='radio' id='apsl_send_email_notification_yes' class='apsl_send_email_notification_yes' name='apsl_send_email_notification_options' value='yes' <?php if(isset($options['apsl_send_email_notification_options'])){ checked( $options['apsl_send_email_notification_options'], 'yes', 'true' ); } ?> /> <label for='apsl_send_email_notification_yes'><?php _e('Send email notification to both user and site admin.', APSL_TEXT_DOMAIN ); ?></label><br /><br />
|
319 |
-
<input type='radio' id='apsl_send_email_notification_no' class='apsl_send_email_notification_no' name='apsl_send_email_notification_options' value='no' <?php if(isset($options['apsl_send_email_notification_options'])){ checked( $options['apsl_send_email_notification_options'], 'no', 'true' ); } ?> /> <label for='apsl_send_email_notification_no'><?php _e('Do not send email notification to both user and site admin.', APSL_TEXT_DOMAIN ); ?></label><br /><br />
|
320 |
-
<div class='apsl-info'>
|
321 |
-
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN ); ?></span> <br />
|
322 |
-
<span class='apsl-info-content'>Here you can configure an options to send email notifications about user registration to site admin and user.</span>
|
323 |
-
</div>
|
324 |
-
</div>
|
325 |
-
</div>
|
326 |
-
</div>
|
327 |
-
|
328 |
-
</div>
|
329 |
-
|
330 |
-
|
331 |
-
<!-- how to use section -->
|
332 |
-
<div class='apsl-tab-contents' id='tab-apsl-how-to-use' style="display:none">
|
333 |
-
<?php include(APSL_PLUGIN_DIR.'inc/backend/how-to-use.php'); ?>
|
334 |
-
</div>
|
335 |
-
|
336 |
-
<!-- about section -->
|
337 |
-
<div class='apsl-tab-contents' id='tab-apsl-about' style="display:none">
|
338 |
-
<?php include(APSL_PLUGIN_DIR.'inc/backend/about.php'); ?>
|
339 |
-
</div>
|
340 |
-
|
341 |
-
<!-- Save settings Button -->
|
342 |
-
<div class='apsl-save-settings'>
|
343 |
-
<?php wp_nonce_field( 'apsl_nonce_save_settings', 'apsl_settings_action' ); ?>
|
344 |
-
<input type='submit' class='apsl-submit-settings primary-button' name='apsl_save_settings' value='<?php _e('Save settings', APSL_TEXT_DOMAIN ); ?>' />
|
345 |
-
</div>
|
346 |
-
|
347 |
-
<div class='apsl-restore-settings'>
|
348 |
-
<?php $nonce = wp_create_nonce( 'apsl-restore-default-settings-nonce' ); ?>
|
349 |
-
<a href="<?php echo admin_url().'admin-post.php?action=apsl_restore_default_settings&_wpnonce='.$nonce;?>" onclick="return confirm('<?php _e( 'Are you sure you want to restore default settings?',APSL_TEXT_DOMAIN ); ?>')"><input type="button" value="Restore Default Settings" class="apsl-reset-button button primary-button"/></a>
|
350 |
-
</div>
|
351 |
-
|
352 |
-
</div>
|
353 |
-
</div>
|
354 |
-
</div>
|
355 |
-
</div>
|
356 |
</div>
|
1 |
<?php defined('ABSPATH') or die("No script kiddies please!"); ?>
|
2 |
<div class="wrap"><div class='apsl-outer-wrapper'>
|
3 |
|
4 |
+
<div class="apsl-setting-header clearfix">
|
5 |
|
6 |
+
<div class="apsl-headerlogo">
|
7 |
+
<div class="logo-wrap"> <img src="<?php echo APSL_IMAGE_DIR; ?>/logo.png" alt="<?php esc_attr_e('AccessPress Social Login Lite', APSL_TEXT_DOMAIN); ?>" /></div>
|
8 |
+
<div class="logo-content"><?php esc_attr_e('AccessPress Social Login Lite', APSL_TEXT_DOMAIN); ?><br />
|
9 |
+
<span class='plugin-version'><?php _e('version ' . APSL_VERSION, APSL_TEXT_DOMAIN); ?></span></div>
|
10 |
+
</div>
|
11 |
+
|
12 |
+
<div class="apsl-right-header-block">
|
13 |
+
<div class="apsl-header-icons">
|
14 |
+
<p>Follow us for new updates</p>
|
15 |
+
<div class="apsl-social-bttns">
|
16 |
+
<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fpages%2FAccessPress-Themes%2F1396595907277967&width&layout=button&action=like&show_faces=false&share=false&height=35&appId=1411139805828592" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:20px; width:50px " allowtransparency="true"></iframe>
|
17 |
+
|
18 |
+
<iframe id="twitter-widget-0" scrolling="no" frameborder="0" allowtransparency="true" src="//platform.twitter.com/widgets/follow_button.5f46501ecfda1c3e1c05dd3e24875611.en.html#_=1421918256492&dnt=true&id=twitter-widget-0&lang=en&screen_name=apthemes&show_count=false&show_screen_name=true&size=m" class="twitter-follow-button twitter-follow-button" title="Twitter Follow Button" data-twttr-rendered="true" style="width: 126px; height: 20px;"></iframe>
|
19 |
+
<script>
|
20 |
+
!function (d, s, id) {
|
21 |
+
var js, fjs = d.getElementsByTagName(s)[0];
|
22 |
+
if (!d.getElementById(id)) {
|
23 |
+
js = d.createElement(s);
|
24 |
+
js.id = id;
|
25 |
+
js.src = "//platform.twitter.com/widgets.js";
|
26 |
+
fjs.parentNode.insertBefore(js, fjs);
|
27 |
+
}
|
28 |
+
}(document, "script", "twitter-wjs");
|
29 |
+
</script>
|
30 |
+
|
31 |
+
</div>
|
32 |
+
</div>
|
33 |
+
|
34 |
+
</div>
|
35 |
+
<div class="clear"></div>
|
36 |
</div>
|
37 |
+
<div class="clear"></div>
|
38 |
|
39 |
+
<?php
|
40 |
+
$options = get_option(APSL_SETTINGS);
|
41 |
+
//$this->print_array($options);
|
42 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
+
<?php if (isset($_SESSION['apsl_message'])) { ?>
|
45 |
+
<div class="apsl-message">
|
46 |
+
<p><?php
|
47 |
+
echo $_SESSION['apsl_message'];
|
48 |
+
unset($_SESSION['apsl_message']);
|
49 |
+
?></p>
|
50 |
+
</div>
|
51 |
+
<?php } ?>
|
52 |
+
<div class='apsl-networks'>
|
53 |
+
<div class='apsl-network-options'>
|
54 |
+
<form method="post" action="<?php echo admin_url() . 'admin-post.php' ?>">
|
55 |
+
<input type="hidden" name="action" value="apsl_save_options"/>
|
56 |
+
<div class='apsl-settings-tabs-wrapper clearfix'>
|
57 |
+
<ul class='apsl-tab-wrapper-fix clearfix'>
|
58 |
+
<li><a href='javascript: void(0);' id='apsl-networks-settings' class='apsl-settings-tab apsl-active-tab' ><?php _e('Network settings', APSL_TEXT_DOMAIN) ?></a></li>
|
59 |
+
<li><a href='javascript: void(0);' id='apsl-theme-settings' class='apsl-settings-tab' ><?php _e('Other settings', APSL_TEXT_DOMAIN) ?></a></li>
|
60 |
+
<li><a href='javascript: void(0);' id='apsl-how-to-use' class='apsl-settings-tab' ><?php _e('How to use', APSL_TEXT_DOMAIN) ?></a></li>
|
61 |
+
<li><a href='javascript: void(0);' id='apsl-about' class='apsl-settings-tab' ><?php _e('About', APSL_TEXT_DOMAIN) ?></a></li>
|
62 |
+
</ul>
|
63 |
+
</div>
|
64 |
+
<div class="clear"></div>
|
65 |
+
<div class='apsl-setting-tabs-wrapper'>
|
66 |
+
<div class='apsl-tab-contents' id='tab-apsl-networks-settings'>
|
67 |
+
|
68 |
+
<div class='network-settings'>
|
69 |
+
<?php foreach ($options['network_ordering'] as $key => $value): ?>
|
70 |
+
<?php switch ($value) {
|
71 |
+
case 'facebook':
|
72 |
+
?>
|
73 |
+
<div class='apsl-settings apsl-facebook-settings'>
|
74 |
+
<!-- Facebook Settings -->
|
75 |
+
<div class='apsl-label'><?php _e("Facebook", APSL_TEXT_DOMAIN); ?><span class='apsl_show_hide' id='apsl_show_hide_<?php echo $value; ?>'><i class="fa fa-caret-down"></i></span> </div>
|
76 |
+
<div class='apsl_network_settings_wrapper' id='apsl_network_settings_<?php echo $value; ?>' style='display:none'>
|
77 |
+
<div class='apsl-enable-disable'>
|
78 |
+
<label><?php _e('Enable?', APSL_TEXT_DOMAIN); ?></label>
|
79 |
+
<input type='hidden' name='network_ordering[]' value='facebook' />
|
80 |
+
<input type="checkbox" id='aspl-facbook-enable' value='enable' name='apsl_facebook_settings[apsl_facebook_enable]' <?php checked('enable', $options['apsl_facebook_settings']['apsl_facebook_enable']); ?> />
|
81 |
+
</div>
|
82 |
+
<div class='apsl-app-id-wrapper'>
|
83 |
+
<label><?php _e('App ID:', APSL_TEXT_DOMAIN); ?></label><input type='text' id='apsl-facebook-app-id' name='apsl_facebook_settings[apsl_facebook_app_id]' value='<?php if (isset($options['apsl_facebook_settings']['apsl_facebook_app_id'])) {
|
84 |
+
echo $options['apsl_facebook_settings']['apsl_facebook_app_id'];
|
85 |
+
} ?>' />
|
86 |
+
</div>
|
87 |
+
<div class='apsl-app-secret-wrapper'>
|
88 |
+
<label><?php _e('App Secret:', APSL_TEXT_DOMAIN); ?></label><input type='text' id='apsl-facebook-app-secret' name='apsl_facebook_settings[apsl_facebook_app_secret]' value='<?php if (isset($options['apsl_facebook_settings']['apsl_facebook_app_secret'])) {
|
89 |
+
echo $options['apsl_facebook_settings']['apsl_facebook_app_secret'];
|
90 |
+
} ?>' />
|
91 |
+
</div>
|
92 |
+
<div class='apsl-info'>
|
93 |
+
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN); ?></span> <br />
|
94 |
+
<span class='apsl-info-content'>You need to create a new facebook API Applitation to setup facebook login. Please follow the instructions to create new app.</span>
|
95 |
+
<br />
|
96 |
+
<ul class='apsl-info-lists'>
|
97 |
+
<li><b>Please note:</b> We have now updated our facbook sdk version to 5.0 so to make the facebook login work you need to have PHP version 5.4 at least.</li>
|
98 |
+
<li>Go to <a href='https://developers.facebook.com/apps' target='_blank'>https://developers.facebook.com/apps</a>.</li>
|
99 |
+
<li>Click on 'Add a New App' button. A popup will open. Then choose website.</li>
|
100 |
+
<li>Add the required informations and don't forget to make your app live. This is very important otherwise your app will not work for all users.</li>
|
101 |
+
<li>Then Click the "Create App" button and follow the instructions, your new app will be created. </li>
|
102 |
+
<li>To make app live please go to settings menu and enter your email address there. Click save changes.</li>
|
103 |
+
<li>Now go the 'status and reviews' menu and make the app live.</li>
|
104 |
+
<li>Copy and Paste "App ID" and "App Secret" here.</li>
|
105 |
+
<li>Site url: <input type='text' value='<?php echo site_url(); ?>' readonly='readonly' /></li>
|
106 |
+
</ul>
|
107 |
+
</div>
|
108 |
+
</div>
|
109 |
+
</div>
|
110 |
+
<?php break; ?>
|
111 |
+
|
112 |
+
<?php case 'twitter': ?>
|
113 |
+
<div class='apsl-settings apsl-twitter-settings'>
|
114 |
+
<!-- Twitter Settings -->
|
115 |
+
<div class='apsl-label'><?php _e("Twitter", APSL_TEXT_DOMAIN); ?> <span class='apsl_show_hide' id='apsl_show_hide_<?php echo $value; ?>'><i class="fa fa-caret-down"></i></span> </div>
|
116 |
+
<div class='apsl_network_settings_wrapper' id='apsl_network_settings_<?php echo $value; ?>' style='display:none'>
|
117 |
+
<div class='apsl-enable-disable'>
|
118 |
+
<label><?php _e('Enable?', APSL_TEXT_DOMAIN); ?></label>
|
119 |
+
<input type="checkbox" id='aspl-twitter-enable' value='enable' name='apsl_twitter_settings[apsl_twitter_enable]' <?php checked('enable', $options['apsl_twitter_settings']['apsl_twitter_enable']); ?> />
|
120 |
+
</div>
|
121 |
+
|
122 |
+
<div class='apsl-app-id-wrapper'>
|
123 |
+
<label><?php _e('Consumer Key (API Key):', APSL_TEXT_DOMAIN); ?></label><input type='text' id='apsl-twitter-app-id' name='apsl_twitter_settings[apsl_twitter_api_key]' value='<?php if (isset($options['apsl_twitter_settings']['apsl_twitter_api_key'])) {
|
124 |
+
echo $options['apsl_twitter_settings']['apsl_twitter_api_key'];
|
125 |
+
} ?>' />
|
126 |
+
</div>
|
127 |
+
|
128 |
+
<div class='apsl-app-secret-wrapper'>
|
129 |
+
<label><?php _e('Consumer Secret (API Secret):', APSL_TEXT_DOMAIN); ?></label><input type='text' id='apsl-twitter-app-secret' name='apsl_twitter_settings[apsl_twitter_api_secret]' value='<?php if (isset($options['apsl_twitter_settings']['apsl_twitter_api_secret'])) {
|
130 |
+
echo $options['apsl_twitter_settings']['apsl_twitter_api_secret'];
|
131 |
+
} ?>' />
|
132 |
+
</div>
|
133 |
+
|
134 |
+
<input type='hidden' name='network_ordering[]' value='twitter' />
|
135 |
+
<div class='apsl-info'>
|
136 |
+
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN); ?> <br /> </span>
|
137 |
+
<span class='apsl-info-content'>You need to create new twitter API application to setup the twitter login. Please follow the instructions to create new app.</span>
|
138 |
+
<ul class='apsl-info-lists'>
|
139 |
+
<li>Go to <a href='https://apps.twitter.com/' target='_blank'>https://apps.twitter.com/</a></li>
|
140 |
+
<li>Click on Create New App button. A new application details form will appear. Please fill up the application details and click on "create your twitter application" button.</li>
|
141 |
+
<li>Please note that before creating twiiter API application, You must add your mobile phone to your Twitter profile.</li>
|
142 |
+
<li>After successful creation of the app. Please go to "Keys and Access Tokens" tabs and get Consumer key(API Key) and Consumer secret(API secret).</li>
|
143 |
+
<li>Website: <input type='text' value='<?php echo site_url(); ?>' readonly='readonly'/></li>
|
144 |
+
<li>Callback URL: <input type='text' value='<?php echo site_url(); ?>' readonly='readonly'/></li>
|
145 |
+
</ul>
|
146 |
+
|
147 |
+
</div>
|
148 |
+
</div>
|
149 |
+
</div>
|
150 |
+
<?php break;
|
151 |
+
|
152 |
+
case 'google':
|
153 |
+
?>
|
154 |
+
<div class='apsl-settings apsl-google-settings'>
|
155 |
+
<!-- Google Settings -->
|
156 |
+
<div class='apsl-label'><?php _e("Google", APSL_TEXT_DOMAIN); ?> <span class='apsl_show_hide' id='apsl_show_hide_<?php echo $value; ?>'><i class="fa fa-caret-down"></i></span> </div>
|
157 |
+
<div class='apsl_network_settings_wrapper' id='apsl_network_settings_<?php echo $value; ?>' style='display:none'>
|
158 |
+
<div class='apsl-enable-disable'>
|
159 |
+
<label><?php _e('Enable?', APSL_TEXT_DOMAIN); ?></label>
|
160 |
+
<input type="checkbox" id='aspl-google-enable' value='enable' name='apsl_google_settings[apsl_google_enable]' <?php checked('enable', $options['apsl_google_settings']['apsl_google_enable']); ?> />
|
161 |
+
</div>
|
162 |
+
<div class='apsl-app-id-wrapper'>
|
163 |
+
<label><?php _e('Client ID:', APSL_TEXT_DOMAIN); ?></label><input type='text' id='apsl-google-client-id' name='apsl_google_settings[apsl_google_client_id]' value='<?php if (isset($options['apsl_google_settings']['apsl_google_client_id'])) {
|
164 |
+
echo $options['apsl_google_settings']['apsl_google_client_id'];
|
165 |
+
} ?>' />
|
166 |
+
</div>
|
167 |
+
<div class='apsl-app-secret-wrapper'>
|
168 |
+
<label><?php _e('Client Secret:', APSL_TEXT_DOMAIN); ?></label><input type='text' id='apsl-google-client-secret' name='apsl_google_settings[apsl_google_client_secret]' value='<?php if (isset($options['apsl_google_settings']['apsl_google_client_secret'])) {
|
169 |
+
echo $options['apsl_google_settings']['apsl_google_client_secret'];
|
170 |
+
} ?>' />
|
171 |
+
</div>
|
172 |
+
<input type='hidden' name='network_ordering[]' value='google' />
|
173 |
+
<div class='apsl-info'>
|
174 |
+
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN); ?></span> <br />
|
175 |
+
<span class='apsl-info-content'>You need to create new google API application to setup the google login. Please follow the instructions to create new application.</span>
|
176 |
+
<ul class='apsl-info-lists'>
|
177 |
+
<li>Go to <a href='https://console.developers.google.com/project' target='_blank'>https://console.developers.google.com/project.</a> </li>
|
178 |
+
<li>Click on "Create Project" button.</li>
|
179 |
+
<li>A pop up will appear.</li>
|
180 |
+
<li>Please enter Project name and click on "Create" button.</li>
|
181 |
+
<li>Now click on APIs & Auth > Consent screen and fill up the required credentials.</li>
|
182 |
+
<li>Now click on APIs & Auth > Credentials.</li>
|
183 |
+
<li>Now click on "Create new Client ID" button and fill up the required credentials.</li>
|
184 |
+
<li>Get the client ID and client secret.</li>
|
185 |
+
<li>Now go to APIs > Social APIs > Google+ API and enable it. It is very important to enable it for the google login to work.</li>
|
186 |
+
<li>Rediret uri setup:<br />
|
187 |
+
Please use <input type='text' value='<?php echo site_url(); ?>/wp-login.php?apsl_login_id=google_check' readonly='readonly'/> - for wordpress login page.<br />
|
188 |
+
Please use <input type='text' value='<?php echo site_url(); ?>/index.php?apsl_login_id=google_check' readonly='readonly'/> - if you have used the shortcode or widget in frontend.
|
189 |
+
</li>
|
190 |
+
<li>
|
191 |
+
Please note: Make sure to check the protocol "http://" or "https://" as google checks protocol as well. Better to add both URL in the list if you site is https so that google social login work properly for both https and http browser.
|
192 |
+
</li>
|
193 |
+
</ul>
|
194 |
+
</div>
|
195 |
+
</div>
|
196 |
+
</div>
|
197 |
+
<?php break; ?>
|
198 |
+
|
199 |
+
<?php
|
200 |
+
default:
|
201 |
+
echo "should not reach here";
|
202 |
+
break;
|
203 |
+
}
|
204 |
+
?>
|
205 |
+
<?php endforeach; ?>
|
206 |
+
</div>
|
207 |
+
</div>
|
208 |
+
|
209 |
+
<div class='apsl-tab-contents' id='tab-apsl-theme-settings' style="display:none">
|
210 |
+
|
211 |
+
<div class='apsl-settings'>
|
212 |
+
<div class='apsl-enable-disable-opt'>
|
213 |
+
<div class="apsl-label"><?php _e('Social login', APSL_TEXT_DOMAIN); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
214 |
+
<div class='apsl_network_settings_wrapper' style='display:none'>
|
215 |
+
<p class="social-login">
|
216 |
+
<span><?php _e('Enable social login?', APSL_TEXT_DOMAIN); ?></span>
|
217 |
+
<input type='radio' id='apsl_enable_plugin' name='apsl_enable_disable_plugin' value='yes' <?php checked($options['apsl_enable_disable_plugin'], 'yes', 'true'); ?> /> <label for='apsl_enable_plugin'>Yes</label>
|
218 |
+
<input type='radio' id='apsl_disable_plugin' name='apsl_enable_disable_plugin' value='no' <?php checked($options['apsl_enable_disable_plugin'], 'no', 'true'); ?> /> <label for='apsl_disable_plugin'>No</label>
|
219 |
+
</p>
|
220 |
+
</div>
|
221 |
+
</div>
|
222 |
+
</div>
|
223 |
+
|
224 |
+
<div class='apsl-settings'>
|
225 |
+
<div class='apsl-display-options'>
|
226 |
+
<div class="apsl-label"><?php _e('Display options', APSL_TEXT_DOMAIN); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span></div>
|
227 |
+
<div class='apsl_network_settings_wrapper' style='display:none'>
|
228 |
+
<p><?php _e('Please choose the options where you want to display the social login form.', APSL_TEXT_DOMAIN); ?></p>
|
229 |
+
<p><input type="checkbox" id="apsl_login_form" value="login_form" name="apsl_display_options[]" <?php if (in_array("login_form", $options['apsl_display_options'])) {
|
230 |
+
echo "checked='checked'";
|
231 |
+
} ?> ><label for="apsl_login_form"><?php _e('Login Form', APSL_TEXT_DOMAIN); ?> </label></p>
|
232 |
+
<p><input type="checkbox" id="apsl_register_form" value="register_form" name="apsl_display_options[]" <?php if (in_array("register_form", $options['apsl_display_options'])) {
|
233 |
+
echo "checked='checked'";
|
234 |
+
} ?> ><label for="apsl_register_form"><?php _e('Register Form', APSL_TEXT_DOMAIN); ?> </label></p>
|
235 |
+
<p><input type="checkbox" id="apsl_comment_form" value="comment_form" name="apsl_display_options[]" <?php if (in_array("comment_form", $options['apsl_display_options'])) {
|
236 |
+
echo "checked='checked'";
|
237 |
+
} ?> ><label for="apsl_comment_form"><?php _e('Comments', APSL_TEXT_DOMAIN); ?> </label></p>
|
238 |
+
</div>
|
239 |
+
</div>
|
240 |
+
</div>
|
241 |
+
|
242 |
+
<div class='apsl-settings'>
|
243 |
+
<div class='apsl-themes-wrapper'>
|
244 |
+
<div class="apsl-label"><?php _e('Available icon themes', APSL_TEXT_DOMAIN); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
245 |
+
<div class='apsl_network_settings_wrapper' style='display:none'>
|
246 |
+
<?php for ($i = 1; $i <= 4; $i++): ?>
|
247 |
+
<div class='apsl-theme apsl-theme-<?php echo $i; ?>'>
|
248 |
+
<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']); ?> >
|
249 |
+
<span><?php _e('Theme ' . $i, APSL_TEXT_DOMAIN); ?></span></label>
|
250 |
+
<div class="apsl-theme-previewbox">
|
251 |
+
<img src="<?php echo APSL_IMAGE_DIR; ?>/preview-<?php echo $i; ?>.jpg" alt="theme preview">
|
252 |
+
</div>
|
253 |
+
</div>
|
254 |
+
<?php endfor; ?>
|
255 |
+
</div>
|
256 |
+
</div>
|
257 |
+
</div>
|
258 |
+
|
259 |
+
<div class='apsl-settings'>
|
260 |
+
<div class='apsl-text-settings'>
|
261 |
+
<div class="apsl-label"><?php _e('Text settings', APSL_TEXT_DOMAIN); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
262 |
+
<div class='apsl_network_settings_wrapper' style='display:none'>
|
263 |
+
<p class='apsl-title-text-field'>
|
264 |
+
<span><?php _e('Login text:', APSL_TEXT_DOMAIN); ?></span> <input type='text' name='apsl_title_text_field' id='apsl-title-text' value='<?php if (isset($options['apsl_title_text_field']) && $options['apsl_title_text_field'] != '') {
|
265 |
+
echo $options['apsl_title_text_field'];
|
266 |
+
} ?>' />
|
267 |
+
</p>
|
268 |
+
</div>
|
269 |
+
</div>
|
270 |
+
</div>
|
271 |
+
|
272 |
+
<div class='apsl-settings'>
|
273 |
+
<div class='apsl-logout-redirect-settings'>
|
274 |
+
<div class="apsl-label"><?php _e('Logout redirect link', APSL_TEXT_DOMAIN); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
275 |
+
<div class='apsl_network_settings_wrapper' style='display:none'>
|
276 |
+
<input type='radio' id='apsl_custom_logout_redirect_home' class='apsl_custom_logout_redirect_options' name='apsl_custom_logout_redirect_options' value='home' <?php if (isset($options['apsl_custom_logout_redirect_options'])) {
|
277 |
+
checked($options['apsl_custom_logout_redirect_options'], 'home', 'true');
|
278 |
+
} ?> /> <label for='apsl_custom_logout_redirect_home'><?php _e('Home page', APSL_TEXT_DOMAIN); ?></label><br /><br />
|
279 |
+
<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 if (isset($options['apsl_custom_logout_redirect_options'])) {
|
280 |
+
checked($options['apsl_custom_logout_redirect_options'], 'current_page', 'true');
|
281 |
+
} ?> /> <label for='apsl_custom_logout_redirect_current'><?php _e('Current page', APSL_TEXT_DOMAIN); ?></label><br /><br />
|
282 |
+
|
283 |
+
|
284 |
+
<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 if (isset($options['apsl_custom_logout_redirect_options'])) {
|
285 |
+
checked($options['apsl_custom_logout_redirect_options'], 'custom_page', 'true');
|
286 |
+
} ?> /> <label for='apsl_custom_logout_redirect_custom'><?php _e('Custom page', APSL_TEXT_DOMAIN); ?></label><br />
|
287 |
+
|
288 |
+
<div class='apsl-custom-logout-redirect-link' <?php if (isset($options['apsl_custom_logout_redirect_options'])) {
|
289 |
+
if ($options['apsl_custom_logout_redirect_options'] == 'custom_page') { ?> style='display: block' <?php } else { ?> style='display:none' <?php }
|
290 |
+
} ?>>
|
291 |
+
<p class='apsl-title-text-field'>
|
292 |
+
<span><?php _e('Logout redirect page:', APSL_TEXT_DOMAIN); ?></span> <input type='text' name='apsl_custom_logout_redirect_link' id='apsl-custom-logout-redirect-link' value='<?php if (isset($options['apsl_custom_logout_redirect_link']) && $options['apsl_custom_logout_redirect_link'] != '') {
|
293 |
+
echo $options['apsl_custom_logout_redirect_link'];
|
294 |
+
} ?>' />
|
295 |
+
</p>
|
296 |
+
<div class='apsl-info'>
|
297 |
+
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN); ?></span> <br />
|
298 |
+
<span class='apsl-info-content'>Please set this value if you want to redirect the user to the custom page url(full url). If this field is not set they will be redirected back to current page.</span>
|
299 |
+
</div>
|
300 |
+
</div>
|
301 |
+
</div>
|
302 |
+
</div>
|
303 |
+
</div>
|
304 |
+
|
305 |
+
<div class='apsl-settings'>
|
306 |
+
<div class='apsl-login-redirect-settings'>
|
307 |
+
<div class="apsl-label"><?php _e('Login redirect link', APSL_TEXT_DOMAIN); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
308 |
+
<div class='apsl_network_settings_wrapper' style='display:none'>
|
309 |
+
<input type='radio' id='apsl_custom_login_redirect_home' class='apsl_custom_login_redirect_options' name='apsl_custom_login_redirect_options' value='home' <?php if (isset($options['apsl_custom_login_redirect_options'])) {
|
310 |
+
checked($options['apsl_custom_login_redirect_options'], 'home', 'true');
|
311 |
+
} ?> /> <label for='apsl_custom_login_redirect_home'><?php _e('Home page', APSL_TEXT_DOMAIN); ?></label><br /><br />
|
312 |
+
<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 if (isset($options['apsl_custom_login_redirect_options'])) {
|
313 |
+
checked($options['apsl_custom_login_redirect_options'], 'current_page', 'true');
|
314 |
+
} ?> /> <label for='apsl_custom_login_redirect_current'><?php _e('Current page', APSL_TEXT_DOMAIN); ?></label><br /><br />
|
315 |
+
<div class='apsl-custom-login-redirect-link1' >
|
316 |
+
<div class='apsl-info'>
|
317 |
+
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN); ?></span> <br />
|
318 |
+
<span class='apsl-info-content'> If plugin can't detect what is the redirect uri for the page it will be redirected to home page.</span>
|
319 |
+
</div>
|
320 |
+
</div>
|
321 |
+
<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 if (isset($options['apsl_custom_login_redirect_options'])) {
|
322 |
+
checked($options['apsl_custom_login_redirect_options'], 'custom_page', 'true');
|
323 |
+
} ?> /> <label for='apsl_custom_login_redirect_custom'><?php _e('Custom page', APSL_TEXT_DOMAIN); ?></label><br />
|
324 |
+
|
325 |
+
<div class='apsl-custom-login-redirect-link' <?php if (isset($options['apsl_custom_login_redirect_options'])) {
|
326 |
+
if ($options['apsl_custom_login_redirect_options'] == 'custom_page') { ?> style='display: block' <?php } else { ?> style='display:none' <?php }
|
327 |
+
} ?>>
|
328 |
+
<p class='apsl-title-text-field'>
|
329 |
+
<span><?php _e('Login redirect page:', APSL_TEXT_DOMAIN); ?></span> <input type='text' name='apsl_custom_login_redirect_link' id='apsl-custom-login-redirect-link' value='<?php if (isset($options['apsl_custom_login_redirect_link']) && $options['apsl_custom_login_redirect_link'] != '') {
|
330 |
+
echo $options['apsl_custom_login_redirect_link'];
|
331 |
+
} ?>' />
|
332 |
+
</p>
|
333 |
+
<div class='apsl-info'>
|
334 |
+
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN); ?></span> <br />
|
335 |
+
<span class='apsl-info-content'>Please set this value if you want to redirect the user to the custom page url(full url). If this field is not set they will be redirected back to home page.</span>
|
336 |
+
</div>
|
337 |
+
</div>
|
338 |
+
</div>
|
339 |
+
</div>
|
340 |
+
</div>
|
341 |
+
|
342 |
+
<div class='apsl-settings'>
|
343 |
+
<div class='apsl-user-avatar-settings'>
|
344 |
+
<div class="apsl-label"><?php _e('User avatar', APSL_TEXT_DOMAIN); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
345 |
+
<div class='apsl_network_settings_wrapper' style='display:none'>
|
346 |
+
<input type='radio' id='apsl_user_avatar_default' class='apsl_user_avatar_options' name='apsl_user_avatar_options' value='default' <?php if (isset($options['apsl_user_avatar_options'])) {
|
347 |
+
checked($options['apsl_user_avatar_options'], 'default', 'true');
|
348 |
+
} ?> /> <label for='apsl_user_avatar_default'><?php _e('Use wordpress provided default avatar.', APSL_TEXT_DOMAIN); ?></label><br /><br />
|
349 |
+
<input type='radio' id='apsl_user_avatar_social' class='apsl_user_avatar_options' name='apsl_user_avatar_options' value='social' <?php if (isset($options['apsl_user_avatar_options'])) {
|
350 |
+
checked($options['apsl_user_avatar_options'], 'social', 'true');
|
351 |
+
} ?> /> <label for='apsl_user_avatar_social'><?php _e('Use the profile picture from social media where available.', APSL_TEXT_DOMAIN); ?></label><br /><br />
|
352 |
+
<div class='apsl-info'>
|
353 |
+
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN); ?></span> <br />
|
354 |
+
<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>
|
355 |
+
</div>
|
356 |
+
</div>
|
357 |
+
</div>
|
358 |
+
</div>
|
359 |
+
|
360 |
+
<div class='apsl-settings'>
|
361 |
+
<div class='apsl-user-email-settings'>
|
362 |
+
<div class="apsl-label"><?php _e('Email notification settings', APSL_TEXT_DOMAIN); ?> <span class='apsl_show_hide'><i class="fa fa-caret-down"></i></span> </div>
|
363 |
+
<div class='apsl_network_settings_wrapper' style='display:none'>
|
364 |
+
<input type='radio' id='apsl_send_email_notification_yes' class='apsl_send_email_notification_yes' name='apsl_send_email_notification_options' value='yes' <?php if (isset($options['apsl_send_email_notification_options'])) {
|
365 |
+
checked($options['apsl_send_email_notification_options'], 'yes', 'true');
|
366 |
+
} ?> /> <label for='apsl_send_email_notification_yes'><?php _e('Send email notification to both user and site admin.', APSL_TEXT_DOMAIN); ?></label><br /><br />
|
367 |
+
<input type='radio' id='apsl_send_email_notification_no' class='apsl_send_email_notification_no' name='apsl_send_email_notification_options' value='no' <?php if (isset($options['apsl_send_email_notification_options'])) {
|
368 |
+
checked($options['apsl_send_email_notification_options'], 'no', 'true');
|
369 |
+
} ?> /> <label for='apsl_send_email_notification_no'><?php _e('Do not send email notification to both user and site admin.', APSL_TEXT_DOMAIN); ?></label><br /><br />
|
370 |
+
<div class='apsl-info'>
|
371 |
+
<span class='apsl-info-note'><?php _e('Note:', APSL_TEXT_DOMAIN); ?></span> <br />
|
372 |
+
<span class='apsl-info-content'>Here you can configure an options to send email notifications about user registration to site admin and user.</span>
|
373 |
+
</div>
|
374 |
+
</div>
|
375 |
+
</div>
|
376 |
+
</div>
|
377 |
+
|
378 |
+
</div>
|
379 |
+
|
380 |
+
|
381 |
+
<!-- how to use section -->
|
382 |
+
<div class='apsl-tab-contents' id='tab-apsl-how-to-use' style="display:none">
|
383 |
+
<?php include(APSL_PLUGIN_DIR . 'inc/backend/how-to-use.php'); ?>
|
384 |
+
</div>
|
385 |
+
|
386 |
+
<!-- about section -->
|
387 |
+
<div class='apsl-tab-contents' id='tab-apsl-about' style="display:none">
|
388 |
+
<?php include(APSL_PLUGIN_DIR . 'inc/backend/about.php'); ?>
|
389 |
+
</div>
|
390 |
+
|
391 |
+
<!-- Save settings Button -->
|
392 |
+
<div class='apsl-save-settings'>
|
393 |
+
<?php wp_nonce_field('apsl_nonce_save_settings', 'apsl_settings_action'); ?>
|
394 |
+
<input type='submit' class='apsl-submit-settings primary-button' name='apsl_save_settings' value='<?php _e('Save settings', APSL_TEXT_DOMAIN); ?>' />
|
395 |
+
</div>
|
396 |
+
|
397 |
+
<div class='apsl-restore-settings'>
|
398 |
+
<?php $nonce = wp_create_nonce('apsl-restore-default-settings-nonce'); ?>
|
399 |
+
<a href="<?php echo admin_url() . 'admin-post.php?action=apsl_restore_default_settings&_wpnonce=' . $nonce; ?>" onclick="return confirm('<?php _e('Are you sure you want to restore default settings?', APSL_TEXT_DOMAIN); ?>')"><input type="button" value="Restore Default Settings" class="apsl-reset-button button primary-button"/></a>
|
400 |
+
</div>
|
401 |
+
|
402 |
+
</div>
|
403 |
</div>
|
404 |
</div>
|
|
|
|
|
|
|
405 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
</div>
|
inc/backend/save-settings.php
CHANGED
@@ -1,77 +1,76 @@
|
|
1 |
<?php defined('ABSPATH') or die("No script kiddies please!"); ?>
|
2 |
<?php
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
?>
|
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 ($_POST['apsl_facebook_settings'] as $key => $value) {
|
9 |
+
$$key = $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 ($_POST['apsl_twitter_settings'] as $key => $value) {
|
22 |
+
$$key = $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 ($_POST['apsl_google_settings'] as $key => $value) {
|
36 |
+
$$key = $value;
|
37 |
+
}
|
38 |
+
$apsl_google_enable = isset($apsl_google_enable) ? $apsl_google_enable : '';
|
39 |
+
|
40 |
+
$google_parameters = array(
|
41 |
+
'apsl_google_enable' => $apsl_google_enable,
|
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 (isset($_POST['apsl_display_options'])) {
|
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['apsl_title_text_field'] = $_POST['apsl_title_text_field'];
|
62 |
+
$apsl_settings['apsl_custom_logout_redirect_options'] = $_POST['apsl_custom_logout_redirect_options'];
|
63 |
+
$apsl_settings['apsl_custom_logout_redirect_link'] = $_POST['apsl_custom_logout_redirect_link'];
|
64 |
+
|
65 |
+
$apsl_settings['apsl_custom_login_redirect_options'] = $_POST['apsl_custom_login_redirect_options'];
|
66 |
+
$apsl_settings['apsl_custom_login_redirect_link'] = $_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.', APSL_TEXT_DOMAIN);
|
75 |
+
wp_redirect(admin_url() . 'admin.php?page=' . APSL_TEXT_DOMAIN);
|
76 |
+
exit;
|
|
inc/frontend/login_check.php
CHANGED
@@ -1,41 +1,43 @@
|
|
1 |
-
<?php defined(
|
2 |
<?php
|
3 |
-
|
4 |
-
|
|
|
|
|
5 |
|
6 |
//constructor
|
7 |
-
function __construct(){
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
if ( isset($state_vars['redirect_to']) ) {
|
13 |
-
$_GET['redirect_to'] = $_REQUEST['redirect_to'] = $state_vars['redirect_to'];
|
14 |
-
}
|
15 |
-
}
|
16 |
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
19 |
case 'facebook':
|
20 |
//include( APSL_PLUGIN_DIR.'facebook/src/facebook.php' );
|
21 |
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
|
22 |
-
|
23 |
die();
|
24 |
}
|
25 |
$this->onFacebookLogin();
|
26 |
break;
|
27 |
|
28 |
case 'twitter':
|
29 |
-
if(
|
30 |
-
|
31 |
-
|
32 |
}
|
33 |
$this->onTwitterLogin();
|
34 |
break;
|
35 |
|
36 |
case 'google':
|
37 |
-
include( APSL_PLUGIN_DIR.'google/Client.php' );
|
38 |
-
include( APSL_PLUGIN_DIR.'google/Service/Plus.php' );
|
39 |
$this->onGoogleLogin();
|
40 |
break;
|
41 |
}
|
@@ -43,16 +45,16 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ){
|
|
43 |
}
|
44 |
|
45 |
//for facebook login
|
46 |
-
function onFacebookLogin(){
|
47 |
$response = new stdClass();
|
48 |
$result = $this->facebookLogin($response);
|
49 |
-
if(isset($result->status) == 'SUCCESS'){
|
50 |
-
$row = $this->getUserByMail(
|
51 |
-
$options = get_option(
|
52 |
|
53 |
-
if(!$row){
|
54 |
$this->creatUser($result->username, $result->email);
|
55 |
-
$row = $this->getUserByMail(
|
56 |
update_user_meta($row->ID, 'email', $result->email);
|
57 |
update_user_meta($row->ID, 'first_name', $result->first_name);
|
58 |
update_user_meta($row->ID, 'last_name', $result->last_name);
|
@@ -61,133 +63,132 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ){
|
|
61 |
update_user_meta($row->ID, 'deuimage', $result->deuimage);
|
62 |
update_user_meta($row->ID, 'description', $result->about);
|
63 |
update_user_meta($row->ID, 'sex', $result->gender);
|
64 |
-
wp_update_user(
|
65 |
}
|
66 |
$this->loginUser($row->ID);
|
67 |
}
|
68 |
}
|
69 |
|
70 |
-
function facebookLogin(){
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
-
|
96 |
-
//
|
97 |
-
$
|
98 |
-
$
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
$
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
108 |
}
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
$response = $fb->get('/me?fields=email,name, first_name, last_name, gender, link, about, address, bio, birthday, education, hometown, is_verified, languages, location, website');
|
132 |
-
$userNode = $response->getGraphUser();
|
133 |
-
} catch(Facebook\Exceptions\FacebookResponseException $e) {
|
134 |
-
// When Graph returns an error
|
135 |
-
echo 'Graph returned an error: ' . $e->getMessage();
|
136 |
-
exit;
|
137 |
-
} catch(Facebook\Exceptions\FacebookSDKException $e) {
|
138 |
-
// When validation fails or other local issues
|
139 |
-
echo 'Facebook SDK returned an error: ' . $e->getMessage();
|
140 |
-
exit;
|
141 |
-
}
|
142 |
-
|
143 |
-
$user_profile = $this->accessProtected($userNode, 'items');
|
144 |
-
if($user_profile!=null){
|
145 |
-
$return_user_details->status = 'SUCCESS';
|
146 |
-
$return_user_details->deuid = $user_profile['id'];
|
147 |
-
$return_user_details->deutype = 'facebook';
|
148 |
-
$return_user_details->first_name = $user_profile['first_name'];
|
149 |
-
$return_user_details->last_name = $user_profile['last_name'];
|
150 |
-
$return_user_details->email = $user_profile['email'];
|
151 |
-
$return_user_details->username = $user_profile['email'];
|
152 |
-
$return_user_details->gender = $user_profile['gender'];
|
153 |
-
$return_user_details->url = $user_profile['link'];
|
154 |
-
$return_user_details->about = ''; //facebook doesn't return user about details.
|
155 |
-
$headers = get_headers('https://graph.facebook.com/'.$user_profile['id'].'/picture',1);
|
156 |
-
|
157 |
-
// just a precaution, check whether the header isset...
|
158 |
-
if(isset($headers['Location'])) {
|
159 |
-
$return_user_details->deuimage = $headers['Location']; // string
|
160 |
-
} else {
|
161 |
-
$return_user_details->deuimage = false; // nothing there? .. weird, but okay!
|
162 |
-
}
|
163 |
-
$return_user_details->error_message = '';
|
164 |
-
}else{
|
165 |
-
$return_user_details->status = 'ERROR';
|
166 |
-
$return_user_details->error_code = 2;
|
167 |
-
$return_user_details->error_message= 'INVALID AUTHORIZATION';
|
168 |
-
}
|
169 |
-
}
|
170 |
} else {
|
171 |
-
|
172 |
-
$
|
173 |
-
$
|
174 |
-
$loginUrl = $helper->getLoginUrl($callback, $permissions);
|
175 |
-
$this->redirect($loginUrl);
|
176 |
}
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
-
|
|
|
180 |
}
|
181 |
|
182 |
//for twitter login
|
183 |
-
function onTwitterLogin(){
|
184 |
$result = $this->twitterLogin();
|
185 |
-
if(isset($result->status) == 'SUCCESS'){
|
186 |
-
$row = $this->getUserByMail(
|
187 |
-
$options = get_option(
|
188 |
-
if(!$row){
|
189 |
$this->creatUser($result->username, $result->email);
|
190 |
-
$row = $this->getUserByMail(
|
191 |
update_user_meta($row->ID, 'email', $result->email);
|
192 |
update_user_meta($row->ID, 'first_name', $result->first_name);
|
193 |
update_user_meta($row->ID, 'last_name', $result->last_name);
|
@@ -195,33 +196,33 @@ 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(
|
199 |
}
|
200 |
$this->loginUser($row->ID);
|
201 |
}
|
202 |
}
|
203 |
|
204 |
-
function twitterLogin(){
|
205 |
-
$request
|
206 |
-
$site
|
207 |
-
$callBackUrl= $this->callBackUrl();
|
208 |
-
$response
|
209 |
-
$exploder=explode('_', $_GET['apsl_login_id']);
|
210 |
-
$action
|
211 |
@session_start();
|
212 |
-
$options = get_option(
|
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
|
217 |
$encoded_url = isset($_GET['redirect_to']) ? $_GET['redirect_to'] : '';
|
218 |
-
if(isset($encoded_url) && $encoded_url !=''){
|
219 |
-
$callback
|
220 |
-
}else{
|
221 |
-
$callback
|
222 |
}
|
223 |
|
224 |
-
$request_token
|
225 |
$_SESSION['oauth_twitter'] = array();
|
226 |
|
227 |
/* Save temporary credentials to session. */
|
@@ -231,254 +232,252 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ){
|
|
231 |
/* If last connection failed don't display authorization link. */
|
232 |
switch ($twitterObj->http_code) {
|
233 |
case 200:
|
234 |
-
try{
|
235 |
$url = $twitterObj->getAuthorizeUrl($token);
|
236 |
$this->redirect($url);
|
237 |
-
}catch(Exception $e){
|
238 |
-
$response->status
|
239 |
-
$response->error_code
|
240 |
-
$response->error_message= 'Could not get AuthorizeUrl.';
|
241 |
}
|
242 |
-
|
243 |
|
244 |
default:
|
245 |
-
$response->status
|
246 |
-
$response->error_code
|
247 |
-
$response->error_message= 'Could not connect to Twitter. Refresh the page or try again later.';
|
248 |
-
|
249 |
}
|
250 |
-
|
251 |
-
|
252 |
-
$response->
|
253 |
-
$response->
|
254 |
-
$response->error_message= 'INVALID AUTHORIZATION';
|
255 |
}
|
256 |
-
}else if(isset($request['oauth_token']) && isset($request['oauth_verifier'])){
|
257 |
|
258 |
/* Create TwitteroAuth object with app key/secret and token key/secret from default phase */
|
259 |
-
$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']);
|
260 |
|
261 |
/* Remove no longer needed request tokens */
|
262 |
unset($_SESSION['oauth_twitter']);
|
263 |
-
try{
|
264 |
-
$access_token
|
265 |
/* If HTTP response is 200 continue otherwise send to connect page to retry */
|
266 |
if (200 == $twitterObj->http_code) {
|
267 |
-
$user_profile
|
268 |
|
269 |
/* Request access twitterObj from twitter */
|
270 |
-
$response->status
|
271 |
-
$response->deuid
|
272 |
-
$response->deutype
|
273 |
-
$response->name
|
274 |
-
$response->first_name
|
275 |
-
$response->last_name
|
276 |
-
$response->deuimage
|
277 |
-
$response->email
|
278 |
-
$response->username
|
279 |
-
$response->url
|
280 |
-
$response->about
|
281 |
-
$response->gender
|
282 |
-
$response->location
|
283 |
$response->error_message = '';
|
284 |
-
}else{
|
285 |
-
$response->status
|
286 |
-
$response->error_code
|
287 |
-
$response->error_message= 'Could not connect to Twitter. Refresh the page or try again later.';
|
288 |
}
|
289 |
-
}catch(Exception $e){
|
290 |
-
$response->status
|
291 |
-
$response->error_code
|
292 |
-
$response->error_message= 'Could not get AccessToken.';
|
293 |
}
|
294 |
-
}else{ // User Canceled your Request
|
295 |
-
$response->status
|
296 |
-
$response->error_code
|
297 |
-
$response->error_message= "USER CANCELED REQUEST";
|
298 |
}
|
299 |
return $response;
|
300 |
}
|
301 |
|
302 |
//for google login
|
303 |
-
function onGoogleLogin(){
|
304 |
$result = $this->GoogleLogin();
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
}
|
320 |
-
$this->loginUser($row->ID);
|
321 |
}
|
|
|
|
|
322 |
}
|
323 |
|
324 |
-
function GoogleLogin(){
|
325 |
-
$post
|
326 |
-
$get
|
327 |
-
$request
|
328 |
-
$site
|
329 |
-
$callBackUrl= $this->callBackUrl();
|
330 |
-
$options
|
331 |
-
$response
|
332 |
-
$a
|
333 |
-
$action
|
334 |
-
$client_id
|
335 |
-
$client_secret
|
336 |
-
|
337 |
-
$site_url = site_url().'/wp-admin';
|
338 |
$encoded_url = isset($_GET['redirect_to']) ? $_GET['redirect_to'] : $site_url;
|
339 |
-
$callback
|
340 |
|
341 |
-
$redirect_uri
|
342 |
$client = new Google_Client;
|
343 |
|
344 |
$client->setClientId($client_id);
|
345 |
$client->setClientSecret($client_secret);
|
346 |
$client->setRedirectUri($redirect_uri);
|
347 |
$client->addScope("https://www.googleapis.com/auth/plus.profile.emails.read");
|
348 |
-
if(isset($encoded_url) && $encoded_url !='') {
|
349 |
$client->setState(base64_encode("redirect_to=$encoded_url"));
|
350 |
} else {
|
351 |
-
|
352 |
}
|
353 |
$service = new Google_Service_Plus($client);
|
354 |
-
if ($action == 'login'){// Get identity from user and redirect browser to OpenID Server
|
355 |
-
if(!(isset($_SESSION['access_token']) && $_SESSION['access_token'])){
|
356 |
$authUrl = $client->createAuthUrl();
|
357 |
$this->redirect($authUrl);
|
358 |
die();
|
359 |
-
}else{
|
360 |
// if($encoded_url == ''){
|
361 |
// $this->redirect($redirect_uri);
|
362 |
// }else{
|
363 |
-
|
364 |
// }
|
365 |
die();
|
366 |
}
|
367 |
-
|
368 |
-
}elseif(isset($_GET['code'])){ // Perform HTTP Request to OpenID server to validate key
|
369 |
$client->authenticate($_GET['code']);
|
370 |
-
$_SESSION['access_token']
|
371 |
-
$this->redirect($redirect_uri."&redirect_to=$encoded_url");
|
372 |
die();
|
373 |
-
}elseif(isset($_SESSION['access_token']) && $_SESSION['access_token']){
|
374 |
$client->setAccessToken($_SESSION['access_token']);
|
375 |
|
376 |
-
try{
|
377 |
-
$user
|
378 |
-
}catch(Exception $fault){
|
379 |
unset($_SESSION['access_token']);
|
380 |
$ref_object = $this->accessProtected($fault, 'errors');
|
381 |
-
echo $ref_object[0]['message']." Please notify about this error to the Site Admin.";
|
382 |
die();
|
383 |
}
|
384 |
|
385 |
-
if(!empty($user)){
|
386 |
-
if(!empty($user->emails)){
|
387 |
-
$response->email
|
388 |
-
$response->username
|
389 |
-
$response->first_name
|
390 |
-
$response->last_name
|
391 |
-
$response->deuid
|
392 |
-
$response->deuimage
|
393 |
-
$response->gender
|
394 |
-
$response->id
|
395 |
-
$response->about
|
396 |
-
$response->url
|
397 |
-
$response->deutype
|
398 |
-
$response->status
|
399 |
$response->error_message = '';
|
400 |
-
}else{
|
401 |
$response->status = 'ERROR';
|
402 |
-
$response->error_code
|
403 |
$response->error_message = "INVALID AUTHORIZATION";
|
404 |
}
|
405 |
-
}else{// Signature Verification Failed
|
406 |
$response->status = 'ERROR';
|
407 |
-
$response->error_code
|
408 |
$response->error_message = "INVALID AUTHORIZATION";
|
409 |
}
|
410 |
-
}elseif ($get['openid_mode'] == 'cancel'){ // User Canceled your Request
|
411 |
$response->status = 'ERROR';
|
412 |
-
$response->error_code
|
413 |
$response->error_message = "USER CANCELED REQUEST";
|
414 |
-
}else{ // User failed to login
|
415 |
$response->status = 'ERROR';
|
416 |
-
$response->error_code
|
417 |
$response->error_message = "USER LOGIN FAIL";
|
418 |
}
|
419 |
return $response;
|
420 |
}
|
421 |
|
422 |
//other remaining methods
|
423 |
-
function siteUrl(){
|
424 |
-
|
425 |
}
|
426 |
|
427 |
-
function callBackUrl(){
|
428 |
$connection = !empty($_SERVER['HTTPS']) ? 'https://' : 'http://';
|
429 |
$url = $connection . $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"];
|
430 |
-
if(
|
431 |
$url .= '?';
|
432 |
-
}else{
|
433 |
$url .= '&';
|
434 |
}
|
435 |
return $url;
|
436 |
}
|
437 |
|
438 |
//function to return json values from social media urls
|
439 |
-
function get_json_values(
|
440 |
-
$response = wp_remote_get(
|
441 |
-
$json_response = wp_remote_retrieve_body(
|
442 |
return $json_response;
|
443 |
}
|
444 |
|
445 |
-
function redirect(
|
446 |
-
if (headers_sent()){ // Use JavaScript to redirect if content has been previously sent (not recommended, but safe)
|
447 |
echo '<script language="JavaScript" type="text/javascript">window.location=\'';
|
448 |
echo $redirect;
|
449 |
echo '\';</script>';
|
450 |
-
}else{
|
451 |
header('Location: ' . $redirect);
|
452 |
}
|
453 |
exit;
|
454 |
}
|
455 |
|
456 |
-
function updateUser($username, $email){
|
457 |
-
$row = $this->getUserByUsername
|
458 |
-
if($row && $email!='' && $row->user_email
|
459 |
$row = (array) $row;
|
460 |
-
$row['user_email']
|
461 |
wp_update_user($row);
|
462 |
}
|
463 |
}
|
464 |
|
465 |
// Redefine user notification function
|
466 |
-
function wp_new_user_notification(
|
467 |
$user = new WP_User($user_id);
|
468 |
|
469 |
$user_login = stripslashes($user->user_login);
|
470 |
$user_email = stripslashes($user->user_email);
|
471 |
|
472 |
-
$message
|
473 |
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
|
474 |
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
|
475 |
|
476 |
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message);
|
477 |
|
478 |
-
if (
|
479 |
return;
|
480 |
|
481 |
-
$message
|
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";
|
@@ -487,44 +486,43 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ){
|
|
487 |
$message .= __('Adios!');
|
488 |
|
489 |
wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);
|
490 |
-
|
491 |
}
|
492 |
|
493 |
-
function getUserByMail($email){
|
494 |
global $wpdb;
|
495 |
$row = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_email = '$email'");
|
496 |
-
if($row){
|
497 |
return $row;
|
498 |
}
|
499 |
return false;
|
500 |
}
|
501 |
|
502 |
-
function getUserByUsername
|
503 |
global $wpdb;
|
504 |
$row = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$username'");
|
505 |
-
if($row){
|
506 |
return $row;
|
507 |
}
|
508 |
return false;
|
509 |
}
|
510 |
|
511 |
-
function creatUser($user_name, $user_email){
|
512 |
$random_password = wp_generate_password(12, false);
|
513 |
-
$user_id = wp_create_user(
|
514 |
-
do_action(
|
515 |
-
$options = get_option(
|
516 |
-
if($options['apsl_send_email_notification_options'] == 'yes'){
|
517 |
-
wp_new_user_notification(
|
518 |
}
|
519 |
return $user_id;
|
520 |
}
|
521 |
|
522 |
function set_cookies($user_id = 0, $remember = true) {
|
523 |
-
if (!function_exists('wp_set_auth_cookie')){
|
524 |
-
|
525 |
}
|
526 |
-
if (!$user_id){
|
527 |
-
|
528 |
}
|
529 |
wp_clear_auth_cookie();
|
530 |
wp_set_auth_cookie($user_id, $remember);
|
@@ -532,75 +530,73 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ){
|
|
532 |
return true;
|
533 |
}
|
534 |
|
535 |
-
function loginUser($user_id){
|
536 |
|
537 |
$current_url_an = get_permalink();
|
538 |
$reauth = empty($_REQUEST['reauth']) ? false : true;
|
539 |
-
if (
|
540 |
wp_clear_auth_cookie();
|
541 |
|
542 |
-
if (
|
543 |
$redirect_to = $_REQUEST['redirect_to'];
|
544 |
// Redirect to https if user wants ssl
|
545 |
-
if (
|
546 |
$redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
|
547 |
} else {
|
548 |
$redirect_to = admin_url();
|
549 |
}
|
550 |
-
if (
|
551 |
-
|
552 |
|
553 |
// If cookies are disabled we can't log in even with a valid user+pass
|
554 |
-
if (
|
555 |
$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."));
|
556 |
else
|
557 |
$user = wp_signon('', isset($secure_cookie));
|
558 |
|
559 |
-
if(!$this->set_cookies($user_id)){
|
560 |
return false;
|
561 |
}
|
562 |
-
$requested_redirect_to = isset(
|
563 |
-
$user_login_url = apply_filters(
|
564 |
-
|
565 |
-
$options = get_option(
|
566 |
-
if(isset($options['apsl_custom_login_redirect_options']) && $options['apsl_custom_login_redirect_options'] !=''){
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
$user_login_url = home_url();
|
578 |
-
}
|
579 |
-
|
580 |
-
}else if( $options['apsl_custom_login_redirect_options'] == 'custom_page' ){
|
581 |
-
if( $options['apsl_custom_login_redirect_link'] !='' ){
|
582 |
-
$login_page = $options['apsl_custom_login_redirect_link'];
|
583 |
-
$user_login_url = $login_page;
|
584 |
-
}else{
|
585 |
-
$user_login_url = home_url();
|
586 |
-
}
|
587 |
}
|
588 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
$user_login_url = home_url();
|
590 |
}
|
591 |
$redirect_to = $user_login_url;
|
592 |
-
wp_safe_redirect(
|
593 |
exit();
|
594 |
}
|
595 |
|
596 |
//returns the current page url
|
597 |
public static function curPageURL() {
|
598 |
$pageURL = 'http';
|
599 |
-
if (
|
600 |
$pageURL .= "s";
|
601 |
}
|
602 |
$pageURL .= "://";
|
603 |
-
if (
|
604 |
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
605 |
} else {
|
606 |
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
@@ -616,8 +612,9 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ){
|
|
616 |
return $property->getValue($obj);
|
617 |
}
|
618 |
|
619 |
-
}
|
620 |
|
|
|
621 |
} //end of if statement
|
622 |
|
623 |
-
$apsl_login_check = new APSL_Lite_Login_Check_Class();
|
1 |
+
<?php defined('ABSPATH') or die("No script kiddies please!"); ?>
|
2 |
<?php
|
3 |
+
|
4 |
+
if (!class_exists('APSL_Lite_Login_Check_Class')) {
|
5 |
+
|
6 |
+
class APSL_Lite_Login_Check_Class {
|
7 |
|
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 |
//include( APSL_PLUGIN_DIR.'facebook/src/facebook.php' );
|
23 |
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
|
24 |
+
echo _e('The Facebook SDK requires PHP version 5.4 or higher. Please notify about this error to site admin.', APSL_TEXT_DOMAIN);
|
25 |
die();
|
26 |
}
|
27 |
$this->onFacebookLogin();
|
28 |
break;
|
29 |
|
30 |
case 'twitter':
|
31 |
+
if (!class_exists('TwitterOAuth')) {
|
32 |
+
include( APSL_PLUGIN_DIR . 'twitter/OAuth.php' );
|
33 |
+
include( APSL_PLUGIN_DIR . 'twitter/twitteroauth.php' );
|
34 |
}
|
35 |
$this->onTwitterLogin();
|
36 |
break;
|
37 |
|
38 |
case 'google':
|
39 |
+
include( APSL_PLUGIN_DIR . 'google/Client.php' );
|
40 |
+
include( APSL_PLUGIN_DIR . 'google/Service/Plus.php' );
|
41 |
$this->onGoogleLogin();
|
42 |
break;
|
43 |
}
|
45 |
}
|
46 |
|
47 |
//for facebook login
|
48 |
+
function onFacebookLogin() {
|
49 |
$response = new stdClass();
|
50 |
$result = $this->facebookLogin($response);
|
51 |
+
if (isset($result->status) == 'SUCCESS') {
|
52 |
+
$row = $this->getUserByMail($result->email);
|
53 |
+
$options = get_option(APSL_SETTINGS);
|
54 |
|
55 |
+
if (!$row) {
|
56 |
$this->creatUser($result->username, $result->email);
|
57 |
+
$row = $this->getUserByMail($result->email);
|
58 |
update_user_meta($row->ID, 'email', $result->email);
|
59 |
update_user_meta($row->ID, 'first_name', $result->first_name);
|
60 |
update_user_meta($row->ID, 'last_name', $result->last_name);
|
63 |
update_user_meta($row->ID, 'deuimage', $result->deuimage);
|
64 |
update_user_meta($row->ID, 'description', $result->about);
|
65 |
update_user_meta($row->ID, 'sex', $result->gender);
|
66 |
+
wp_update_user(array('ID' => $row->ID, 'display_name' => $result->first_name . ' ' . $result->last_name, 'role' => $options['apsl_user_role'], 'user_url' => $result->url));
|
67 |
}
|
68 |
$this->loginUser($row->ID);
|
69 |
}
|
70 |
}
|
71 |
|
72 |
+
function facebookLogin() {
|
73 |
+
$request = $_REQUEST;
|
74 |
+
$site = $this->siteUrl();
|
75 |
+
$callBackUrl = $this->callBackUrl();
|
76 |
+
$response = new stdClass();
|
77 |
+
$return_user_details = new stdClass();
|
78 |
+
$exploder = explode('_', $_GET['apsl_login_id']);
|
79 |
+
$action = $exploder[1];
|
80 |
+
$options = get_option(APSL_SETTINGS);
|
81 |
+
$config = array(
|
82 |
+
'app_id' => $options['apsl_facebook_settings']['apsl_facebook_app_id'],
|
83 |
+
'app_secret' => $options['apsl_facebook_settings']['apsl_facebook_app_secret'],
|
84 |
+
'default_graph_version' => 'v2.4'
|
85 |
+
);
|
86 |
+
|
87 |
+
include( APSL_PLUGIN_DIR . 'facebook/autoload.php' );
|
88 |
+
$fb = new Facebook\Facebook($config);
|
89 |
+
|
90 |
+
$encoded_url = isset($_GET['redirect_to']) ? $_GET['redirect_to'] : '';
|
91 |
+
if (isset($encoded_url) && $encoded_url != '') {
|
92 |
+
$callback = $callBackUrl . 'apsl_login_id' . '=facebook_check&redirect_to=' . $encoded_url;
|
93 |
+
} else {
|
94 |
+
$callback = $callBackUrl . 'apsl_login_id' . '=facebook_check';
|
95 |
+
}
|
96 |
+
|
97 |
+
if ($action == 'login') {
|
98 |
+
// Well looks like we are a fresh dude, login to Facebook!
|
99 |
+
$helper = $fb->getRedirectLoginHelper();
|
100 |
+
$permissions = array('email', 'public_profile'); // optional
|
101 |
+
$loginUrl = $helper->getLoginUrl($callback, $permissions);
|
102 |
+
$this->redirect($loginUrl);
|
103 |
+
} else {
|
104 |
+
if (isset($_REQUEST['error'])) {
|
105 |
+
$response->status = 'ERROR';
|
106 |
+
$response->error_code = 2;
|
107 |
+
$response->error_message = 'INVALID AUTHORIZATION';
|
108 |
+
return $response;
|
109 |
+
die();
|
110 |
}
|
111 |
+
if (isset($_REQUEST['code'])) {
|
112 |
+
$helper = $fb->getRedirectLoginHelper();
|
113 |
+
try {
|
114 |
+
$accessToken = $helper->getAccessToken();
|
115 |
+
} catch (Facebook\Exceptions\FacebookResponseException $e) {
|
116 |
+
|
117 |
+
// When Graph returns an error
|
118 |
+
echo 'Graph returned an error: ' . $e->getMessage();
|
119 |
+
exit;
|
120 |
+
} catch (Facebook\Exceptions\FacebookSDKException $e) {
|
121 |
+
|
122 |
+
// When validation fails or other local issues
|
123 |
+
echo 'Facebook SDK returned an error: ' . $e->getMessage();
|
124 |
+
exit;
|
125 |
+
}
|
126 |
|
127 |
+
if (isset($accessToken)) {
|
128 |
+
// Logged in!
|
129 |
+
$_SESSION['facebook_access_token'] = (string) $accessToken;
|
130 |
+
$fb->setDefaultAccessToken($accessToken);
|
131 |
+
|
132 |
+
try {
|
133 |
+
$response = $fb->get('/me?fields=email,name, first_name, last_name, gender, link, about, address, bio, birthday, education, hometown, is_verified, languages, location, website');
|
134 |
+
$userNode = $response->getGraphUser();
|
135 |
+
} catch (Facebook\Exceptions\FacebookResponseException $e) {
|
136 |
+
// When Graph returns an error
|
137 |
+
echo 'Graph returned an error: ' . $e->getMessage();
|
138 |
+
exit;
|
139 |
+
} catch (Facebook\Exceptions\FacebookSDKException $e) {
|
140 |
+
// When validation fails or other local issues
|
141 |
+
echo 'Facebook SDK returned an error: ' . $e->getMessage();
|
142 |
+
exit;
|
143 |
}
|
144 |
+
|
145 |
+
$user_profile = $this->accessProtected($userNode, 'items');
|
146 |
+
if ($user_profile != null) {
|
147 |
+
$return_user_details->status = 'SUCCESS';
|
148 |
+
$return_user_details->deuid = $user_profile['id'];
|
149 |
+
$return_user_details->deutype = 'facebook';
|
150 |
+
$return_user_details->first_name = $user_profile['first_name'];
|
151 |
+
$return_user_details->last_name = $user_profile['last_name'];
|
152 |
+
$return_user_details->email = $user_profile['email'];
|
153 |
+
$return_user_details->username = $user_profile['email'];
|
154 |
+
$return_user_details->gender = $user_profile['gender'];
|
155 |
+
$return_user_details->url = $user_profile['link'];
|
156 |
+
$return_user_details->about = ''; //facebook doesn't return user about details.
|
157 |
+
$headers = get_headers('https://graph.facebook.com/' . $user_profile['id'] . '/picture', 1);
|
158 |
+
|
159 |
+
// just a precaution, check whether the header isset...
|
160 |
+
if (isset($headers['Location'])) {
|
161 |
+
$return_user_details->deuimage = $headers['Location']; // string
|
162 |
+
} else {
|
163 |
+
$return_user_details->deuimage = false; // nothing there? .. weird, but okay!
|
164 |
+
}
|
165 |
+
$return_user_details->error_message = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
} else {
|
167 |
+
$return_user_details->status = 'ERROR';
|
168 |
+
$return_user_details->error_code = 2;
|
169 |
+
$return_user_details->error_message = 'INVALID AUTHORIZATION';
|
|
|
|
|
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 |
|
183 |
//for twitter login
|
184 |
+
function onTwitterLogin() {
|
185 |
$result = $this->twitterLogin();
|
186 |
+
if (isset($result->status) == 'SUCCESS') {
|
187 |
+
$row = $this->getUserByMail($result->email);
|
188 |
+
$options = get_option(APSL_SETTINGS);
|
189 |
+
if (!$row) {
|
190 |
$this->creatUser($result->username, $result->email);
|
191 |
+
$row = $this->getUserByMail($result->email);
|
192 |
update_user_meta($row->ID, 'email', $result->email);
|
193 |
update_user_meta($row->ID, 'first_name', $result->first_name);
|
194 |
update_user_meta($row->ID, 'last_name', $result->last_name);
|
196 |
update_user_meta($row->ID, 'deutype', $result->deutype);
|
197 |
update_user_meta($row->ID, 'deuimage', $result->deuimage);
|
198 |
update_user_meta($row->ID, 'description', $result->about);
|
199 |
+
wp_update_user(array('ID' => $row->ID, 'display_name' => $result->first_name . ' ' . $result->last_name, 'role' => $options['apsl_user_role'], 'user_url' => $result->url));
|
200 |
}
|
201 |
$this->loginUser($row->ID);
|
202 |
}
|
203 |
}
|
204 |
|
205 |
+
function twitterLogin() {
|
206 |
+
$request = $_REQUEST;
|
207 |
+
$site = $this->siteUrl();
|
208 |
+
$callBackUrl = $this->callBackUrl();
|
209 |
+
$response = new stdClass();
|
210 |
+
$exploder = explode('_', $_GET['apsl_login_id']);
|
211 |
+
$action = $exploder[1];
|
212 |
@session_start();
|
213 |
+
$options = get_option(APSL_SETTINGS);
|
214 |
+
if ($action == 'login') {
|
215 |
// Get identity from user and redirect browser to OpenID Server
|
216 |
+
if (!isset($request['oauth_token']) || $request['oauth_token'] == '') {
|
217 |
+
$twitterObj = new TwitterOAuth($options['apsl_twitter_settings']['apsl_twitter_api_key'], $options['apsl_twitter_settings']['apsl_twitter_api_secret']);
|
218 |
$encoded_url = isset($_GET['redirect_to']) ? $_GET['redirect_to'] : '';
|
219 |
+
if (isset($encoded_url) && $encoded_url != '') {
|
220 |
+
$callback = $callBackUrl . 'apsl_login_id' . '=twitter_check&redirect_to=' . $encoded_url;
|
221 |
+
} else {
|
222 |
+
$callback = $callBackUrl . 'apsl_login_id' . '=twitter_check';
|
223 |
}
|
224 |
|
225 |
+
$request_token = $twitterObj->getRequestToken($callback);
|
226 |
$_SESSION['oauth_twitter'] = array();
|
227 |
|
228 |
/* Save temporary credentials to session. */
|
232 |
/* If last connection failed don't display authorization link. */
|
233 |
switch ($twitterObj->http_code) {
|
234 |
case 200:
|
235 |
+
try {
|
236 |
$url = $twitterObj->getAuthorizeUrl($token);
|
237 |
$this->redirect($url);
|
238 |
+
} catch (Exception $e) {
|
239 |
+
$response->status = 'ERROR';
|
240 |
+
$response->error_code = 2;
|
241 |
+
$response->error_message = 'Could not get AuthorizeUrl.';
|
242 |
}
|
243 |
+
break;
|
244 |
|
245 |
default:
|
246 |
+
$response->status = 'ERROR';
|
247 |
+
$response->error_code = 2;
|
248 |
+
$response->error_message = 'Could not connect to Twitter. Refresh the page or try again later.';
|
249 |
+
break;
|
250 |
}
|
251 |
+
} else {
|
252 |
+
$response->status = 'ERROR';
|
253 |
+
$response->error_code = 2;
|
254 |
+
$response->error_message = 'INVALID AUTHORIZATION';
|
|
|
255 |
}
|
256 |
+
} else if (isset($request['oauth_token']) && isset($request['oauth_verifier'])) {
|
257 |
|
258 |
/* Create TwitteroAuth object with app key/secret and token key/secret from default phase */
|
259 |
+
$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']);
|
260 |
|
261 |
/* Remove no longer needed request tokens */
|
262 |
unset($_SESSION['oauth_twitter']);
|
263 |
+
try {
|
264 |
+
$access_token = $twitterObj->getAccessToken($request['oauth_verifier']);
|
265 |
/* If HTTP response is 200 continue otherwise send to connect page to retry */
|
266 |
if (200 == $twitterObj->http_code) {
|
267 |
+
$user_profile = $twitterObj->get('users/show', array('screen_name' => $access_token['screen_name'], 'include_entities' => true));
|
268 |
|
269 |
/* Request access twitterObj from twitter */
|
270 |
+
$response->status = 'SUCCESS';
|
271 |
+
$response->deuid = $user_profile->id;
|
272 |
+
$response->deutype = 'twitter';
|
273 |
+
$response->name = explode(' ', $user_profile->name, 2);
|
274 |
+
$response->first_name = $response->name[0];
|
275 |
+
$response->last_name = (isset($response->name[1])) ? $response->name[1] : '';
|
276 |
+
$response->deuimage = $user_profile->profile_image_url_https;
|
277 |
+
$response->email = $user_profile->screen_name . '@twitter.com';
|
278 |
+
$response->username = $user_profile->screen_name . '@twitter.com';
|
279 |
+
$response->url = $user_profile->url;
|
280 |
+
$response->about = $user_profile->description;
|
281 |
+
$response->gender = $user_profile->gender;
|
282 |
+
$response->location = $user_profile->location;
|
283 |
$response->error_message = '';
|
284 |
+
} else {
|
285 |
+
$response->status = 'ERROR';
|
286 |
+
$response->error_code = 2;
|
287 |
+
$response->error_message = 'Could not connect to Twitter. Refresh the page or try again later.';
|
288 |
}
|
289 |
+
} catch (Exception $e) {
|
290 |
+
$response->status = 'ERROR';
|
291 |
+
$response->error_code = 2;
|
292 |
+
$response->error_message = 'Could not get AccessToken.';
|
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 |
|
302 |
//for google login
|
303 |
+
function onGoogleLogin() {
|
304 |
$result = $this->GoogleLogin();
|
305 |
+
if (isset($result->status) == 'SUCCESS') {
|
306 |
+
$row = $this->getUserByMail($result->email);
|
307 |
+
$options = get_option(APSL_SETTINGS);
|
308 |
+
if (!$row) {
|
309 |
+
$this->creatUser($result->username, $result->email);
|
310 |
+
$row = $this->getUserByMail($result->email);
|
311 |
+
update_user_meta($row->ID, 'email', $result->email);
|
312 |
+
update_user_meta($row->ID, 'first_name', $result->first_name);
|
313 |
+
update_user_meta($row->ID, 'last_name', $result->last_name);
|
314 |
+
update_user_meta($row->ID, 'deuid', $result->deuid);
|
315 |
+
update_user_meta($row->ID, 'deutype', $result->deutype);
|
316 |
+
update_user_meta($row->ID, 'deuimage', $result->deuimage);
|
317 |
+
update_user_meta($row->ID, 'description', $result->about);
|
318 |
+
wp_update_user(array('ID' => $row->ID, 'display_name' => $result->first_name, 'role' => $options['apsl_user_role'], 'user_url' => $result->url));
|
|
|
|
|
319 |
}
|
320 |
+
$this->loginUser($row->ID);
|
321 |
+
}
|
322 |
}
|
323 |
|
324 |
+
function GoogleLogin() {
|
325 |
+
$post = $_POST;
|
326 |
+
$get = $_GET;
|
327 |
+
$request = $_REQUEST;
|
328 |
+
$site = $this->siteUrl();
|
329 |
+
$callBackUrl = $this->callBackUrl();
|
330 |
+
$options = get_option(APSL_SETTINGS);
|
331 |
+
$response = new stdClass();
|
332 |
+
$a = explode('_', $_GET['apsl_login_id']);
|
333 |
+
$action = $a[1];
|
334 |
+
$client_id = $options['apsl_google_settings']['apsl_google_client_id'];
|
335 |
+
$client_secret = $options['apsl_google_settings']['apsl_google_client_secret'];
|
336 |
+
|
337 |
+
$site_url = site_url() . '/wp-admin';
|
338 |
$encoded_url = isset($_GET['redirect_to']) ? $_GET['redirect_to'] : $site_url;
|
339 |
+
$callback = $callBackUrl . 'apsl_login_id' . '=google_check';
|
340 |
|
341 |
+
$redirect_uri = $callback;
|
342 |
$client = new Google_Client;
|
343 |
|
344 |
$client->setClientId($client_id);
|
345 |
$client->setClientSecret($client_secret);
|
346 |
$client->setRedirectUri($redirect_uri);
|
347 |
$client->addScope("https://www.googleapis.com/auth/plus.profile.emails.read");
|
348 |
+
if (isset($encoded_url) && $encoded_url != '') {
|
349 |
$client->setState(base64_encode("redirect_to=$encoded_url"));
|
350 |
} else {
|
351 |
+
|
352 |
}
|
353 |
$service = new Google_Service_Plus($client);
|
354 |
+
if ($action == 'login') {// Get identity from user and redirect browser to OpenID Server
|
355 |
+
if (!(isset($_SESSION['access_token']) && $_SESSION['access_token'])) {
|
356 |
$authUrl = $client->createAuthUrl();
|
357 |
$this->redirect($authUrl);
|
358 |
die();
|
359 |
+
} else {
|
360 |
// if($encoded_url == ''){
|
361 |
// $this->redirect($redirect_uri);
|
362 |
// }else{
|
363 |
+
$this->redirect($redirect_uri . "&redirect_to=$encoded_url");
|
364 |
// }
|
365 |
die();
|
366 |
}
|
367 |
+
} elseif (isset($_GET['code'])) { // Perform HTTP Request to OpenID server to validate key
|
|
|
368 |
$client->authenticate($_GET['code']);
|
369 |
+
$_SESSION['access_token'] = $client->getAccessToken();
|
370 |
+
$this->redirect($redirect_uri . "&redirect_to=$encoded_url");
|
371 |
die();
|
372 |
+
} elseif (isset($_SESSION['access_token']) && $_SESSION['access_token']) {
|
373 |
$client->setAccessToken($_SESSION['access_token']);
|
374 |
|
375 |
+
try {
|
376 |
+
$user = $service->people->get("me", array());
|
377 |
+
} catch (Exception $fault) {
|
378 |
unset($_SESSION['access_token']);
|
379 |
$ref_object = $this->accessProtected($fault, 'errors');
|
380 |
+
echo $ref_object[0]['message'] . " Please notify about this error to the Site Admin.";
|
381 |
die();
|
382 |
}
|
383 |
|
384 |
+
if (!empty($user)) {
|
385 |
+
if (!empty($user->emails)) {
|
386 |
+
$response->email = $user->emails[0]->value;
|
387 |
+
$response->username = $user->emails[0]->value;
|
388 |
+
$response->first_name = $user->name->givenName;
|
389 |
+
$response->last_name = $user->name->familyName;
|
390 |
+
$response->deuid = $user->emails[0]->value;
|
391 |
+
$response->deuimage = $user->image->url;
|
392 |
+
$response->gender = $user->gender;
|
393 |
+
$response->id = $user->id;
|
394 |
+
$response->about = $user->aboutMe;
|
395 |
+
$response->url = $user->url;
|
396 |
+
$response->deutype = 'google';
|
397 |
+
$response->status = 'SUCCESS';
|
398 |
$response->error_message = '';
|
399 |
+
} else {
|
400 |
$response->status = 'ERROR';
|
401 |
+
$response->error_code = 2;
|
402 |
$response->error_message = "INVALID AUTHORIZATION";
|
403 |
}
|
404 |
+
} else {// Signature Verification Failed
|
405 |
$response->status = 'ERROR';
|
406 |
+
$response->error_code = 2;
|
407 |
$response->error_message = "INVALID AUTHORIZATION";
|
408 |
}
|
409 |
+
} elseif ($get['openid_mode'] == 'cancel') { // User Canceled your Request
|
410 |
$response->status = 'ERROR';
|
411 |
+
$response->error_code = 1;
|
412 |
$response->error_message = "USER CANCELED REQUEST";
|
413 |
+
} else { // User failed to login
|
414 |
$response->status = 'ERROR';
|
415 |
+
$response->error_code = 3;
|
416 |
$response->error_message = "USER LOGIN FAIL";
|
417 |
}
|
418 |
return $response;
|
419 |
}
|
420 |
|
421 |
//other remaining methods
|
422 |
+
function siteUrl() {
|
423 |
+
return site_url();
|
424 |
}
|
425 |
|
426 |
+
function callBackUrl() {
|
427 |
$connection = !empty($_SERVER['HTTPS']) ? 'https://' : 'http://';
|
428 |
$url = $connection . $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"];
|
429 |
+
if (strpos($url, '?') === false) {
|
430 |
$url .= '?';
|
431 |
+
} else {
|
432 |
$url .= '&';
|
433 |
}
|
434 |
return $url;
|
435 |
}
|
436 |
|
437 |
//function to return json values from social media urls
|
438 |
+
function get_json_values($url) {
|
439 |
+
$response = wp_remote_get($url);
|
440 |
+
$json_response = wp_remote_retrieve_body($response);
|
441 |
return $json_response;
|
442 |
}
|
443 |
|
444 |
+
function redirect($redirect) {
|
445 |
+
if (headers_sent()) { // Use JavaScript to redirect if content has been previously sent (not recommended, but safe)
|
446 |
echo '<script language="JavaScript" type="text/javascript">window.location=\'';
|
447 |
echo $redirect;
|
448 |
echo '\';</script>';
|
449 |
+
} else { // Default Header Redirect
|
450 |
header('Location: ' . $redirect);
|
451 |
}
|
452 |
exit;
|
453 |
}
|
454 |
|
455 |
+
function updateUser($username, $email) {
|
456 |
+
$row = $this->getUserByUsername($username);
|
457 |
+
if ($row && $email != '' && $row->user_email != $email) {
|
458 |
$row = (array) $row;
|
459 |
+
$row['user_email'] = $email;
|
460 |
wp_update_user($row);
|
461 |
}
|
462 |
}
|
463 |
|
464 |
// Redefine user notification function
|
465 |
+
function wp_new_user_notification($user_id, $plaintext_pass = '') {
|
466 |
$user = new WP_User($user_id);
|
467 |
|
468 |
$user_login = stripslashes($user->user_login);
|
469 |
$user_email = stripslashes($user->user_email);
|
470 |
|
471 |
+
$message = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n";
|
472 |
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
|
473 |
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
|
474 |
|
475 |
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message);
|
476 |
|
477 |
+
if (empty($plaintext_pass))
|
478 |
return;
|
479 |
|
480 |
+
$message = __('Hi there,') . "\r\n\r\n";
|
481 |
$message .= sprintf(__("Welcome to %s! Here's how to log in:"), get_option('blogname')) . "\r\n\r\n";
|
482 |
$message .= wp_login_url() . "\r\n";
|
483 |
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n";
|
486 |
$message .= __('Adios!');
|
487 |
|
488 |
wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);
|
|
|
489 |
}
|
490 |
|
491 |
+
function getUserByMail($email) {
|
492 |
global $wpdb;
|
493 |
$row = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_email = '$email'");
|
494 |
+
if ($row) {
|
495 |
return $row;
|
496 |
}
|
497 |
return false;
|
498 |
}
|
499 |
|
500 |
+
function getUserByUsername($username) {
|
501 |
global $wpdb;
|
502 |
$row = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$username'");
|
503 |
+
if ($row) {
|
504 |
return $row;
|
505 |
}
|
506 |
return false;
|
507 |
}
|
508 |
|
509 |
+
function creatUser($user_name, $user_email) {
|
510 |
$random_password = wp_generate_password(12, false);
|
511 |
+
$user_id = wp_create_user($user_name, $random_password, $user_email);
|
512 |
+
do_action('APSL_createUser', $user_id); //hookable function to perform additional work after creation of user.
|
513 |
+
$options = get_option(APSL_SETTINGS);
|
514 |
+
if ($options['apsl_send_email_notification_options'] == 'yes') {
|
515 |
+
wp_new_user_notification($user_id, $random_password);
|
516 |
}
|
517 |
return $user_id;
|
518 |
}
|
519 |
|
520 |
function set_cookies($user_id = 0, $remember = true) {
|
521 |
+
if (!function_exists('wp_set_auth_cookie')) {
|
522 |
+
return false;
|
523 |
}
|
524 |
+
if (!$user_id) {
|
525 |
+
return false;
|
526 |
}
|
527 |
wp_clear_auth_cookie();
|
528 |
wp_set_auth_cookie($user_id, $remember);
|
530 |
return true;
|
531 |
}
|
532 |
|
533 |
+
function loginUser($user_id) {
|
534 |
|
535 |
$current_url_an = get_permalink();
|
536 |
$reauth = empty($_REQUEST['reauth']) ? false : true;
|
537 |
+
if ($reauth)
|
538 |
wp_clear_auth_cookie();
|
539 |
|
540 |
+
if (isset($_REQUEST['redirect_to'])) {
|
541 |
$redirect_to = $_REQUEST['redirect_to'];
|
542 |
// Redirect to https if user wants ssl
|
543 |
+
if (isset($secure_cookie) && false !== strpos($redirect_to, 'wp-admin'))
|
544 |
$redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
|
545 |
} else {
|
546 |
$redirect_to = admin_url();
|
547 |
}
|
548 |
+
if (!isset($secure_cookie) && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ))
|
549 |
+
$secure_cookie = false;
|
550 |
|
551 |
// If cookies are disabled we can't log in even with a valid user+pass
|
552 |
+
if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]))
|
553 |
$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."));
|
554 |
else
|
555 |
$user = wp_signon('', isset($secure_cookie));
|
556 |
|
557 |
+
if (!$this->set_cookies($user_id)) {
|
558 |
return false;
|
559 |
}
|
560 |
+
$requested_redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : site_url();
|
561 |
+
$user_login_url = apply_filters('login_redirect', $redirect_to, $requested_redirect_to, $user);
|
562 |
+
|
563 |
+
$options = get_option(APSL_SETTINGS);
|
564 |
+
if (isset($options['apsl_custom_login_redirect_options']) && $options['apsl_custom_login_redirect_options'] != '') {
|
565 |
+
if ($options['apsl_custom_login_redirect_options'] == 'home') {
|
566 |
+
$user_login_url = home_url();
|
567 |
+
} else if ($options['apsl_custom_login_redirect_options'] == 'current_page') {
|
568 |
+
if (isset($_REQUEST['redirect_to'])) {
|
569 |
+
$redirect_to = $_REQUEST['redirect_to'];
|
570 |
+
// Redirect to https if user wants ssl
|
571 |
+
if (isset($secure_cookie) && false !== strpos($redirect_to, 'wp-admin'))
|
572 |
+
$user_login_url = preg_replace('|^http://|', 'https://', $redirect_to);
|
573 |
+
} else {
|
574 |
+
$user_login_url = home_url();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
575 |
}
|
576 |
+
} else if ($options['apsl_custom_login_redirect_options'] == 'custom_page') {
|
577 |
+
if ($options['apsl_custom_login_redirect_link'] != '') {
|
578 |
+
$login_page = $options['apsl_custom_login_redirect_link'];
|
579 |
+
$user_login_url = $login_page;
|
580 |
+
} else {
|
581 |
+
$user_login_url = home_url();
|
582 |
+
}
|
583 |
+
}
|
584 |
+
} else {
|
585 |
$user_login_url = home_url();
|
586 |
}
|
587 |
$redirect_to = $user_login_url;
|
588 |
+
wp_safe_redirect($redirect_to);
|
589 |
exit();
|
590 |
}
|
591 |
|
592 |
//returns the current page url
|
593 |
public static function curPageURL() {
|
594 |
$pageURL = 'http';
|
595 |
+
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
|
596 |
$pageURL .= "s";
|
597 |
}
|
598 |
$pageURL .= "://";
|
599 |
+
if ($_SERVER["SERVER_PORT"] != "80") {
|
600 |
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
601 |
} else {
|
602 |
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
612 |
return $property->getValue($obj);
|
613 |
}
|
614 |
|
615 |
+
}
|
616 |
|
617 |
+
//termination of a class
|
618 |
} //end of if statement
|
619 |
|
620 |
+
$apsl_login_check = new APSL_Lite_Login_Check_Class();
|
inc/frontend/login_integration.php
CHANGED
@@ -1,30 +1,36 @@
|
|
1 |
<?php defined('ABSPATH') or die("No script kiddies please!"); ?>
|
2 |
-
<?php
|
|
|
3 |
|
4 |
$redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '';
|
5 |
|
6 |
$encoded_url = urlencode($redirect_to);
|
7 |
-
|
8 |
?>
|
9 |
<div class='apsl-login-networks theme-<?php echo $options['apsl_icon_theme']; ?> clearfix'>
|
10 |
-
|
11 |
-
|
12 |
<div class='apsl-error'>
|
13 |
-
|
14 |
</div>
|
15 |
-
|
16 |
|
17 |
-
|
18 |
-
<?php foreach($options['network_ordering'] as $key
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
</div>
|
1 |
<?php defined('ABSPATH') or die("No script kiddies please!"); ?>
|
2 |
+
<?php
|
3 |
+
$options = get_option(APSL_SETTINGS);
|
4 |
|
5 |
$redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '';
|
6 |
|
7 |
$encoded_url = urlencode($redirect_to);
|
|
|
8 |
?>
|
9 |
<div class='apsl-login-networks theme-<?php echo $options['apsl_icon_theme']; ?> clearfix'>
|
10 |
+
<span class='apsl-login-new-text'><?php echo $options['apsl_title_text_field']; ?></span>
|
11 |
+
<?php if (isset($_REQUEST['error']) || isset($_REQUEST['denied'])) { ?>
|
12 |
<div class='apsl-error'>
|
13 |
+
<?php _e('You have Access Denied. Please authorize the app to login.', APSL_TEXT_DOMAIN); ?>
|
14 |
</div>
|
15 |
+
<?php } ?>
|
16 |
|
17 |
+
<div class='social-networks'>
|
18 |
+
<?php foreach ($options['network_ordering'] as $key => $value): ?>
|
19 |
+
<?php if ($options["apsl_{$value}_settings"]["apsl_{$value}_enable"] === 'enable') { ?>
|
20 |
+
<a href="<?php wp_login_url() ?>?apsl_login_id=<?php echo $value; ?>_login<?php
|
21 |
+
if ($encoded_url) {
|
22 |
+
echo "&state=" . base64_encode("redirect_to=$encoded_url");
|
23 |
+
}
|
24 |
+
?>" title='<?php _e('Login with', APSL_TEXT_DOMAIN);
|
25 |
+
echo ' ' . $value;
|
26 |
+
?>' >
|
27 |
+
<div class="apsl-icon-block icon-<?php echo $value; ?> clearfix">
|
28 |
+
<i class="fa fa-<?php echo $value; ?>"></i>
|
29 |
+
<span class="apsl-login-text"><?php _e('Login', APSL_TEXT_DOMAIN); ?></span>
|
30 |
+
<span class="apsl-long-login-text"><?php _e('Login with', APSL_TEXT_DOMAIN); ?><?php echo ' ' . $value; ?></span>
|
31 |
+
</div>
|
32 |
+
</a>
|
33 |
+
<?php } ?>
|
34 |
+
<?php endforeach; ?>
|
35 |
+
</div>
|
36 |
</div>
|
inc/frontend/shortcode.php
CHANGED
@@ -1,64 +1,68 @@
|
|
1 |
-
<?php defined(
|
2 |
-
<?php $options = get_option(
|
3 |
<?php
|
4 |
-
if (is_user_logged_in()){
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
if( !empty( $_GET[ 'redirect' ] ))
|
10 |
-
$current_url = $_GET[ 'redirect' ];
|
11 |
-
else
|
12 |
-
$current_url = APSL_Lite_Login_Check_Class::curPageURL();
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
$user_logout_url = wp_logout_url( $current_url );
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
<?php
|
37 |
-
|
38 |
-
|
39 |
-
?>
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
<?php $theme = $options['apsl_icon_theme']; ?>
|
42 |
|
43 |
-
<div class='apsl-login-networks theme-<?php echo $theme; ?> clearfix'>
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php defined('ABSPATH') or die('No script kiddies please!'); ?>
|
2 |
+
<?php $options = get_option(APSL_SETTINGS); ?>
|
3 |
<?php
|
4 |
+
if (is_user_logged_in()) {
|
5 |
+
global $current_user;
|
6 |
+
$user_info = "<span class='display-name'>{$current_user->data->display_name}</span> ";
|
7 |
+
$user_info .= get_avatar($current_user->ID, 20);
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
+
if (!empty($_GET['redirect']))
|
10 |
+
$current_url = $_GET['redirect'];
|
11 |
+
else
|
12 |
+
$current_url = APSL_Lite_Login_Check_Class::curPageURL();
|
|
|
13 |
|
14 |
+
if (isset($options['apsl_custom_logout_redirect_options']) && $options['apsl_custom_logout_redirect_options'] != '') {
|
15 |
+
if ($options['apsl_custom_logout_redirect_options'] == 'home') {
|
16 |
+
$user_logout_url = wp_logout_url(home_url());
|
17 |
+
} else if ($options['apsl_custom_logout_redirect_options'] == 'current_page') {
|
18 |
+
$user_logout_url = wp_logout_url($current_url);
|
19 |
+
} else if ($options['apsl_custom_logout_redirect_options'] == 'custom_page') {
|
20 |
+
if ($options['apsl_custom_logout_redirect_link'] != '') {
|
21 |
+
$logout_page = $options['apsl_custom_logout_redirect_link'];
|
22 |
+
$user_logout_url = wp_logout_url($logout_page);
|
23 |
+
} else {
|
24 |
+
$user_logout_url = wp_logout_url($current_url);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
} else {
|
28 |
+
$user_logout_url = wp_logout_url($current_url);
|
29 |
+
}
|
30 |
+
?><div class="user-login">Welcome <b><?php echo $user_info; ?></b> | <a href="<?php echo $user_logout_url; ?>" title="Logout">Logout</a></div>
|
31 |
+
<?php
|
32 |
+
} else {
|
33 |
+
?>
|
34 |
+
<?php
|
35 |
+
$current_url = APSL_Lite_Login_Check_Class::curPageURL();
|
36 |
+
$encoded_url = urlencode($current_url);
|
37 |
+
?>
|
38 |
|
39 |
+
<?php $theme = $options['apsl_icon_theme']; ?>
|
40 |
|
41 |
+
<div class='apsl-login-networks theme-<?php echo $theme; ?> clearfix'>
|
42 |
+
<?php if (isset($attr['login_text']) && $attr['login_text'] != '') { ?>
|
43 |
+
<span class='apsl-login-new-text'><?php echo $attr['login_text']; ?></span>
|
44 |
+
<?php } ?>
|
45 |
+
<?php if (isset($_REQUEST['error']) || isset($_REQUEST['denied'])) { ?>
|
46 |
+
<div class='apsl-error'><?php _e('You have Access Denied. Please authorize the app to login.', APSL_TEXT_DOMAIN); ?></div>
|
47 |
+
<?php } ?>
|
48 |
+
<div class='social-networks'>
|
49 |
+
<?php foreach ($options['network_ordering'] as $key => $value): ?>
|
50 |
+
<?php if ($options["apsl_{$value}_settings"]["apsl_{$value}_enable"] === 'enable') { ?>
|
51 |
+
<a href="<?php echo wp_login_url() ?>?apsl_login_id=<?php echo $value; ?>_login<?php
|
52 |
+
if ($encoded_url) {
|
53 |
+
echo "&state=" . base64_encode("redirect_to=$encoded_url");
|
54 |
+
}
|
55 |
+
?>" title='<?php _e('Login with', APSL_TEXT_DOMAIN);
|
56 |
+
echo ' ' . $value;
|
57 |
+
?>'>
|
58 |
+
<div class="apsl-icon-block icon-<?php echo $value; ?>">
|
59 |
+
<i class="fa fa-<?php echo $value; ?>"></i>
|
60 |
+
<span class="apsl-login-text"><?php _e('Login', APSL_TEXT_DOMAIN); ?></span>
|
61 |
+
<span class="apsl-long-login-text"><?php _e('Login with', APSL_TEXT_DOMAIN); ?><?php echo ' ' . $value; ?></span>
|
62 |
+
</div>
|
63 |
+
</a>
|
64 |
+
<?php } ?>
|
65 |
+
<?php endforeach; ?>
|
66 |
+
</div>
|
67 |
+
</div>
|
68 |
+
<?php }
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: Access Keys
|
|
3 |
Tags: social, login, social login, facebook, twitter, google, social connect, social network login, register, login with, signin, oauth, authorize, oauth
|
4 |
Donate link: http://accesspressthemes.com/donation/
|
5 |
Requires at least: 3.8
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -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.0 =
|
135 |
* addition of the hookable function for the user creation.
|
136 |
* Code optimization for the login check class.
|
3 |
Tags: social, login, social login, facebook, twitter, google, social connect, social network login, register, login with, signin, oauth, authorize, oauth
|
4 |
Donate link: http://accesspressthemes.com/donation/
|
5 |
Requires at least: 3.8
|
6 |
+
Tested up to: 4.3
|
7 |
+
Stable tag: 2.0.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
131 |
4. Backend Other settings Section.
|
132 |
|
133 |
== Changelog ==
|
134 |
+
= 2.0.1 =
|
135 |
+
* Code formatting and optimization of the plugin files.
|
136 |
+
|
137 |
= 2.0.0 =
|
138 |
* addition of the hookable function for the user creation.
|
139 |
* Code optimization for the login check class.
|