NSL/Persistent/Persistent.php 0000666 00000003712 15214053722 0012221 0 ustar 00 storage === NULL) {
if (is_user_logged_in()) {
$this->storage = new Transient();
} else {
$this->storage = new Session();
}
}
}
public static function set($key, $value) {
self::$instance->storage->set($key, $value);
}
public static function get($key) {
return self::$instance->storage->get($key);
}
public static function delete($key) {
self::$instance->storage->delete($key);
}
/**
* @param $user_login
* @param WP_User $user
*/
public function transferSessionToUser($user_login, $user = null) {
if (!$user) { // For do_action( 'wp_login' ) calls that lacked passing the 2nd arg.
$user = get_user_by('login', $user_login);
}
$newStorage = new Transient($user->ID);
/**
* $this->storage might be NULL if init action not called yet
*/
if ($this->storage !== NULL) {
$newStorage->transferData($this->storage);
}
$this->storage = $newStorage;
}
public static function clear() {
self::$instance->storage->clear();
}
}
new Persistent(); NSL/Persistent/Storage/Abstract.php 0000666 00000002763 15214053722 0013235 0 ustar 00 load(true);
$this->data[$key] = $value;
$this->store();
}
public function get($key) {
$this->load();
if (isset($this->data[$key])) {
return $this->data[$key];
}
return null;
}
public function delete($key) {
$this->load();
if (isset($this->data[$key])) {
unset($this->data[$key]);
$this->store();
}
}
public function clear() {
$this->data = array();
$this->store();
}
protected function load($createSession = false) {
static $isLoaded = false;
if (!$isLoaded) {
$data = maybe_unserialize(get_site_transient($this->sessionId));
if (is_array($data)) {
$this->data = $data;
}
$isLoaded = true;
}
}
private function store() {
if (empty($this->data)) {
delete_site_transient($this->sessionId);
} else {
set_site_transient($this->sessionId, $this->data, apply_filters('nsl_persistent_expiration', HOUR_IN_SECONDS));
}
}
/**
* @param StorageAbstract $storage
*/
public function transferData($storage) {
$this->data = $storage->data;
$this->store();
$storage->clear();
}
} NSL/Persistent/Storage/Transient.php 0000666 00000000443 15214053722 0013432 0 ustar 00 sessionId = 'nsl_persistent_' . $user_id;
}
} NSL/Persistent/Storage/Session.php 0000666 00000005134 15214053722 0013110 0 ustar 00 sessionName = 'wordpress_nsl';
}
if (defined('NSL_SESSION_NAME')) {
$this->sessionName = NSL_SESSION_NAME;
}
$this->sessionName = apply_filters('nsl_session_name', $this->sessionName);
}
public function clear() {
parent::clear();
$this->destroy();
}
private function destroy() {
$sessionID = $this->sessionId;
if ($sessionID) {
$this->setCookie($sessionID, time() - YEAR_IN_SECONDS, apply_filters('nsl_session_use_secure_cookie', false));
add_action('shutdown', array(
$this,
'destroySiteTransient'
));
}
}
public function destroySiteTransient() {
$sessionID = $this->sessionId;
if ($sessionID) {
delete_site_transient('nsl_' . $sessionID);
}
}
protected function load($createSession = false) {
static $isLoaded = false;
if ($this->sessionId === null) {
if (isset($_COOKIE[$this->sessionName])) {
$this->sessionId = 'nsl_persistent_' . md5(SECURE_AUTH_KEY . $_COOKIE[$this->sessionName]);
} else if ($createSession) {
$unique = uniqid('nsl', true);
$this->setCookie($unique, apply_filters('nsl_session_cookie_expiration', 0), apply_filters('nsl_session_use_secure_cookie', false));
$this->sessionId = 'nsl_persistent_' . md5(SECURE_AUTH_KEY . $unique);
$isLoaded = true;
}
}
if (!$isLoaded) {
if ($this->sessionId !== null) {
$data = maybe_unserialize(get_site_transient($this->sessionId));
if (is_array($data)) {
$this->data = $data;
}
$isLoaded = true;
}
}
}
private function setCookie($value, $expire, $secure = false) {
setcookie($this->sessionName, $value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure);
}
} NSL/GDPR.php 0000666 00000012270 15214053722 0006454 0 ustar 00 ' . __('What personal data we collect and why we collect it') . '';
$content .= '
' . sprintf(__('%1$s collects data when a visitor register, login or link the account with with any of the enabled social provider. It collects the following data: email address, name, social provider identifier and access token. Also it can collect profile picture and more fields with the Pro Addon\'s sync data feature.'), 'Nextend Social Login') . '
';
$content .= '' . __('Who we share your data with') . '
';
$content .= '' . sprintf(__('%1$s stores the personal data on your site and does not share it with anyone except the access token which used for the authenticated communication with the social providers.'), 'Nextend Social Login') . '
';
$content .= '' . __('Does the plugin share personal data with third parties') . '
';
$content .= '' . sprintf(__('%1$s use the access token what the social provider gave to communicate with the providers to verify account and securely access personal data.'), 'Nextend Social Login') . '
';
$content .= '' . __('How long we retain your data') . '
';
$content .= '' . sprintf(__('%1$s removes the collected personal data when the user deleted from WordPress.'), 'Nextend Social Login') . '
';
$content .= '' . __('Does the plugin use personal data collected by others?') . '
';
$content .= '' . sprintf(__('%1$s use the personal data collected by the social providers to create account on your site when the visitor authorize it.'), 'Nextend Social Login') . '
';
$content .= '' . __('Does the plugin store things in the browser?') . '
';
$content .= '' . sprintf(__('Yes, %1$s must create a cookie for visitors who use the social login authorization flow. This cookie required for every provider to secure the communication and to redirect the user back to the last location.'), 'Nextend Social Login') . '
';
$content .= '' . __('Does the plugin collect telemetry data, directly or indirectly?') . '
';
$content .= '' . __('No') . '
';
$content .= '' . __('Does the plugin enqueue JavaScript, tracking pixels or embed iframes from a third party?') . '
';
$content .= '' . __('No') . '
';
wp_add_privacy_policy_content('Nextend Social Login', wp_kses_post($content));
}
public function register_exporter($exporters) {
$exporters['nextend-facebook-connect'] = array(
'exporter_friendly_name' => 'Nextend Social Login',
'callback' => array(
$this,
'exporter'
),
);
return $exporters;
}
public function exporter($email_address, $page = 1) {
$email_address = trim($email_address);
$data_to_export = array();
$user = get_user_by('email', $email_address);
if (!$user) {
return array(
'data' => array(),
'done' => true,
);
}
$user_data_to_export = array();
foreach (NextendSocialLogin::$allowedProviders AS $provider) {
$user_data_to_export = array_merge($user_data_to_export, $provider->exportPersonalData($user->ID));
}
if (!empty($user_data_to_export)) {
$data_to_export[] = array(
'group_id' => 'user',
'group_label' => __('User'),
'item_id' => "user-{$user->ID}",
'data' => $user_data_to_export,
);
}
return array(
'data' => $data_to_export,
'done' => true,
);
}
public function register_eraser($erasers) {
$erasers['nextend-facebook-connect'] = array(
'exporter_friendly_name' => 'Nextend Social Login',
'callback' => array(
$this,
'eraser'
),
);
return $erasers;
}
public function eraser($email_address, $page = 1) {
return array(
'items_removed' => false,
'items_retained' => false,
'messages' => array(),
'done' => true,
);
}
}
new GDPR(); NSL/Notices.php 0000666 00000012343 15214053722 0007325 0 ustar 00 get_error_messages() as $m) {
self::add('error', $m);
}
} else {
self::add('error', $message);
}
}
public static function getErrors() {
if (isset(self::$notices['error'])) {
$errors = self::$notices['error'];
unset(self::$notices['error']);
self::set();
return $errors;
}
return false;
}
public static function addSuccess($message) {
self::add('success', $message);
}
public static function displayNotices() {
$html = self::getHTML();
if (!empty($html)) {
echo '' . $html . '
';
}
}
public function admin_notices() {
echo self::getHTML();
}
/**
* Displays the non-displayed notices in lightbox as a fallback
*/
public function notices_fallback() {
$html = self::getHTML();
if (!empty($html)) {
?>
' . $message . '
';
}
}
if (isset(self::$notices['error'])) {
foreach (self::$notices['error'] AS $message) {
$html .= '';
}
}
self::clear();
return $html;
}
private static function get() {
return Persistent::get('notices');
}
private static function set() {
Persistent::set('notices', self::$notices);
}
public static function clear() {
Persistent::delete('notices');
self::$notices = array();
}
} NSL/REST.php 0000666 00000003255 15214053722 0006500 0 ustar 00 \w[\w\s\-]*)/get_user', array(
'args' => array(
'provider' => array(
'required' => true,
'validate_callback' => array(
$this,
'validate_provider'
)
),
'access_token' => array(
'required' => true,
),
),
array(
'methods' => 'POST',
'callback' => array(
$this,
'get_user'
)
),
));
}
public function validate_provider($providerID) {
return NextendSocialLogin::isProviderEnabled($providerID);
}
/**
* @param WP_REST_Request $request Full details about the request.
*
* @return WP_Error|WP_REST_Response
*/
public function get_user($request) {
$provider = NextendSocialLogin::$enabledProviders[$request['provider']];
try {
$user = $provider->findUserByAccessToken($request['access_token']);
} catch (Exception $e) {
return new WP_Error('error', $e->getMessage());
}
return $user;
}
}
new REST();
js/nsl.js 0000666 00000020264 15214053722 0006323 0 ustar 00 window.NSLPopup = function (url, title, w, h) {
var userAgent = navigator.userAgent,
mobile = function () {
return /\b(iPhone|iP[ao]d)/.test(userAgent) ||
/\b(iP[ao]d)/.test(userAgent) ||
/Android/i.test(userAgent) ||
/Mobile/i.test(userAgent);
},
screenX = window.screenX !== undefined ? window.screenX : window.screenLeft,
screenY = window.screenY !== undefined ? window.screenY : window.screenTop,
outerWidth = window.outerWidth !== undefined ? window.outerWidth : document.documentElement.clientWidth,
outerHeight = window.outerHeight !== undefined ? window.outerHeight : document.documentElement.clientHeight - 22,
targetWidth = mobile() ? null : w,
targetHeight = mobile() ? null : h,
V = screenX < 0 ? window.screen.width + screenX : screenX,
left = parseInt(V + (outerWidth - targetWidth) / 2, 10),
right = parseInt(screenY + (outerHeight - targetHeight) / 2.5, 10),
features = [];
if (targetWidth !== null) {
features.push('width=' + targetWidth);
}
if (targetHeight !== null) {
features.push('height=' + targetHeight);
}
features.push('left=' + left);
features.push('top=' + right);
features.push('scrollbars=1');
var newWindow = window.open(url, title, features.join(','));
if (window.focus) {
newWindow.focus();
}
return newWindow;
};
var isWebView = null;
function checkWebView() {
if (isWebView === null) {
function _detectOS(ua) {
if (/Android/.test(ua)) {
return "Android";
} else if (/iPhone|iPad|iPod/.test(ua)) {
return "iOS";
} else if (/Windows/.test(ua)) {
return "Windows";
} else if (/Mac OS X/.test(ua)) {
return "Mac";
} else if (/CrOS/.test(ua)) {
return "Chrome OS";
} else if (/Firefox/.test(ua)) {
return "Firefox OS";
}
return "";
}
function _detectBrowser(ua) {
var android = /Android/.test(ua);
if (/CriOS/.test(ua)) {
return "Chrome for iOS";
} else if (/Edge/.test(ua)) {
return "Edge";
} else if (android && /Silk\//.test(ua)) {
return "Silk";
} else if (/Chrome/.test(ua)) {
return "Chrome";
} else if (/Firefox/.test(ua)) {
return "Firefox";
} else if (android) {
return "AOSP";
} else if (/MSIE|Trident/.test(ua)) {
return "IE";
} else if (/Safari\//.test(ua)) {
return "Safari";
} else if (/AppleWebKit/.test(ua)) {
return "WebKit";
}
return "";
}
function _detectBrowserVersion(ua, browser) {
if (browser === "Chrome for iOS") {
return _getVersion(ua, "CriOS/");
} else if (browser === "Edge") {
return _getVersion(ua, "Edge/");
} else if (browser === "Chrome") {
return _getVersion(ua, "Chrome/");
} else if (browser === "Firefox") {
return _getVersion(ua, "Firefox/");
} else if (browser === "Silk") {
return _getVersion(ua, "Silk/");
} else if (browser === "AOSP") {
return _getVersion(ua, "Version/");
} else if (browser === "IE") {
return /IEMobile/.test(ua) ? _getVersion(ua, "IEMobile/") :
/MSIE/.test(ua) ? _getVersion(ua, "MSIE ")
:
_getVersion(ua, "rv:");
} else if (browser === "Safari") {
return _getVersion(ua, "Version/");
} else if (browser === "WebKit") {
return _getVersion(ua, "WebKit/");
}
return "0.0.0";
}
function _getVersion(ua, token) {
try {
return _normalizeSemverString(ua.split(token)[1].trim().split(/[^\w\.]/)[0]);
} catch (o_O) {
}
return "0.0.0";
}
function _normalizeSemverString(version) {
var ary = version.split(/[\._]/);
return (parseInt(ary[0], 10) || 0) + "." +
(parseInt(ary[1], 10) || 0) + "." +
(parseInt(ary[2], 10) || 0);
}
function _isWebView(ua, os, browser, version, options) {
switch (os + browser) {
case "iOSSafari":
return false;
case "iOSWebKit":
return _isWebView_iOS(options);
case "AndroidAOSP":
return false;
case "AndroidChrome":
return parseFloat(version) >= 42 ? /; wv/.test(ua) : /\d{2}\.0\.0/.test(version) ? true : _isWebView_Android(options);
}
return false;
}
function _isWebView_iOS(options) {
var document = (window["document"] || {});
if ("WEB_VIEW" in options) {
return options["WEB_VIEW"];
}
return !("fullscreenEnabled" in document || "webkitFullscreenEnabled" in document || false);
}
function _isWebView_Android(options) {
if ("WEB_VIEW" in options) {
return options["WEB_VIEW"];
}
return !("requestFileSystem" in window || "webkitRequestFileSystem" in window || false);
}
var options = {};
var nav = window.navigator || {};
var ua = nav.userAgent || "";
var os = _detectOS(ua);
var browser = _detectBrowser(ua);
var browserVersion = _detectBrowserVersion(ua, browser);
isWebView = _isWebView(ua, os, browser, browserVersion, options);
}
return isWebView;
}
window._nsl.push(function ($) {
window.nslRedirect = function (url) {
$('').appendTo('body');
window.location = url;
};
var targetWindow = _targetWindow || 'prefer-popup',
lastPopup = false;
$(document.body).on('click', 'a[data-plugin="nsl"][data-action="connect"],a[data-plugin="nsl"][data-action="link"]', function (e) {
if (lastPopup && !lastPopup.closed) {
e.preventDefault();
lastPopup.focus();
} else {
var $target = $(this),
href = $target.attr('href'),
success = false;
if (href.indexOf('?') !== -1) {
href += '&';
} else {
href += '?';
}
var redirectTo = $target.data('redirect');
if (redirectTo === 'current') {
href += 'redirect=' + encodeURIComponent(window.location.href) + '&';
} else if (redirectTo && redirectTo !== '') {
href += 'redirect=' + encodeURIComponent(redirectTo) + '&';
}
if (targetWindow !== 'prefer-same-window' && checkWebView()) {
targetWindow = 'prefer-same-window';
}
if (targetWindow === 'prefer-popup') {
lastPopup = NSLPopup(href + 'display=popup', 'nsl-social-connect', $target.data('popupwidth'), $target.data('popupheight'));
if (lastPopup) {
success = true;
e.preventDefault();
}
} else if (targetWindow === 'prefer-new-tab') {
var newTab = window.open(href + 'display=popup', '_blank');
if (newTab) {
if (window.focus) {
newTab.focus();
}
success = true;
e.preventDefault();
}
}
if (!success) {
window.location = href;
e.preventDefault();
}
}
});
var googleLoginButton = $('a[data-plugin="nsl"][data-provider="google"]');
if (googleLoginButton.length && checkWebView()) {
googleLoginButton.remove();
}
}); index.html 0000666 00000000000 15214053722 0006534 0 ustar 00 admin/templates-provider/settings-other.php 0000666 00000006143 15214053722 0015163 0 ustar 00 getProvider();
$settings = $provider->settings;
?>