Add social redirect animation

This commit is contained in:
RainLoop Team 2016-07-13 00:46:33 +03:00
parent f64cf601ce
commit 0a6a84b3d7
5 changed files with 157 additions and 55 deletions

View file

@ -447,6 +447,7 @@ Enables caching in the system'),
'replace_env_in_configuration' => array(''),
'startup_url' => array(''),
'emogrifier' => array(true),
'nice_social_redirect' => array(true),
'dev_email' => array(''),
'dev_password' => array('')
),

View file

@ -125,9 +125,70 @@ class Social
/**
* @return string
*/
public function GooglePopupService($bGmail = false)
public function popupServiceResult($sTypeStr, $sLoginUrl, $bLogin, $iErrorCode)
{
$sResult = '';
$bNiceSocialRedirect = $this->oActions->Config()->Get('labs', 'nice_social_redirect', true);
$bAppCssDebug = !!$this->oActions->Config()->Get('labs', 'use_app_debug_css', false);
$sIcon = $sTypeStr;
if ('facebook' === $sIcon)
{
$sIcon = $sIcon.'-alt';
}
if ($sLoginUrl)
{
if (!$bNiceSocialRedirect)
{
$this->oActions->Location($sLoginUrl);
}
else
{
$this->oHttp->ServerNoCache();
@\header('Content-Type: text/html; charset=utf-8');
$sResult = \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/Social.html'), array(
'{{RefreshMeta}}' => '<meta http-equiv="refresh" content="0; URL='.$sLoginUrl.'" />',
'{{Stylesheet}}' => $this->oActions->StaticPath('css/social'.($bAppCssDebug ? '' : '.min').'.css'),
'{{Icon}}' => $sIcon,
'{{Script}}' => ''
));
}
}
else
{
$this->oHttp->ServerNoCache();
@\header('Content-Type: text/html; charset=utf-8');
$sCallBackType = $bLogin ? '_login' : '';
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_'.$sTypeStr.$sCallBackType.'_service';
if (!$bNiceSocialRedirect)
{
$sResult = '<script data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
}
else
{
$sResult = \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/Social.html'), array(
'{{RefreshMeta}}' => '',
'{{Stylesheet}}' => $this->oActions->StaticPath('css/social'.($bAppCssDebug ? '' : '.min').'.css'),
'{{Icon}}' => $sIcon,
'{{Script}}' => '<script data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>'
));
}
}
return $sResult;
}
/**
* @return string
*/
public function GooglePopupService($bGmail = false)
{
$sLoginUrl = '';
$oAccount = null;
@ -276,20 +337,7 @@ class Social
$this->oActions->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
}
if ($sLoginUrl)
{
$this->oActions->Location($sLoginUrl);
}
else
{
@\header('Content-Type: text/html; charset=utf-8');
$sCallBackType = $bLogin ? '_login' : '';
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_google'.$sCallBackType.'_service';
$sResult = '<script data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
}
return $sResult;
return $this->popupServiceResult('google', $sLoginUrl, $bLogin, $iErrorCode);
}
/**
@ -297,7 +345,6 @@ class Social
*/
public function FacebookPopupService()
{
$sResult = '';
$sLoginUrl = '';
$sSocialName = '';
@ -393,23 +440,7 @@ class Social
}
}
if ($sLoginUrl)
{
$this->oActions->Location($sLoginUrl);
}
else
{
$this->oHttp->ServerNoCache();
@\header('Content-Type: text/html; charset=utf-8');
$sCallBackType = $bLogin ? '_login' : '';
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_facebook'.$sCallBackType.'_service';
$sResult = '<script data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
}
return $sResult;
return $this->popupServiceResult('facebook', $sLoginUrl, $bLogin, $iErrorCode);
}
/**
@ -417,7 +448,6 @@ class Social
*/
public function TwitterPopupService()
{
$sResult = '';
$sLoginUrl = '';
$sSocialName = '';
@ -585,20 +615,7 @@ class Social
$this->oActions->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
}
if ($sLoginUrl)
{
$this->oActions->Location($sLoginUrl);
}
else
{
@\header('Content-Type: text/html; charset=utf-8');
$sCallBackType = $bLogin ? '_login' : '';
$sConnectionFunc = 'rl_'.\md5(\RainLoop\Utils::GetConnectionToken()).'_twitter'.$sCallBackType.'_service';
$sResult = '<script data-cfasync="false">opener && opener.'.$sConnectionFunc.' && opener.'.
$sConnectionFunc.'('.$iErrorCode.'); self && self.close && self.close();</script>';
}
return $sResult;
return $this->popupServiceResult('twitter', $sLoginUrl, $bLogin, $iErrorCode);
}
/**

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
{{RefreshMeta}}
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="google" content="notranslate" />
<meta name="robots" content="noindex,nofollow,noodp" />
<link type="text/css" rel="stylesheet" href="{{Stylesheet}}" />
<title></title>
</head>
<body>
<div class="social-icon-wrp redirecting">
<div class="social-icon">
<i class="icon-{{Icon}}"></i>
</div>
</div>
{{Script}}
</body>
</html>