diff --git a/e107_core/shortcodes/batch/signup_shortcodes.php b/e107_core/shortcodes/batch/signup_shortcodes.php
index 3f871b958..82a929565 100755
--- a/e107_core/shortcodes/batch/signup_shortcodes.php
+++ b/e107_core/shortcodes/batch/signup_shortcodes.php
@@ -66,106 +66,86 @@ class signup_shortcodes extends e_shortcode
function sc_signup_xup_login($parm)
{
$pref = e107::getPref('social_login_active');
- $tp = e107::getParser();
-
+ if (empty($pref)) return '';
+
$size = empty($parm['size']) ? '3x' : $parm['size'];
$class = empty($parm['class']) ? 'btn btn-primary' : $parm['class'] ;
-
- if(!empty($pref))
- {
- $text = "";
- $manager = new SocialLoginConfigManager(e107::getConfig());
- $providers = $manager->getValidConfiguredProviderConfigs();
-
- foreach($providers as $p=>$v)
- {
- if($v['enabled'] == 1)
- {
-
- // $text .= "
";
-
- $ic = strtolower($p);
-
- switch ($ic)
- {
- case 'windowslive':
- $ic = 'windows';
- break;
- }
-
- // 'signup' Creates a new XUP user if not found, otherwise it logs the person in.
-
- if (defset('FONTAWESOME') && in_array($ic, e107::getMedia()->getGlyphs()))
- $button = "" . $tp->toGlyph('fa-' . $ic, array('size' => $size, 'fw' => true)) . "";
- elseif (is_file(e107::getFolder('images') . "xup/{$ic}.png"))
- $button = "
";
- else
- $button = "$p";
-
- $text .= " ".$button." ";
- }
- //TODO different icon options. see: http://zocial.smcllns.com/
- }
-
- // $text .= "
";
- return $text;
- }
+ return $this->generateXupLoginButtons("login", $size, $class);
}
// TODO - template
function sc_signup_xup_signup($parm)
{
$pref = e107::getPref('social_login_active');
+ if (empty($pref)) return '';
+
+ $size = empty($parm['size']) ? '2x' : $parm['size'];
+ $class = empty($parm['class']) ? 'btn btn-primary' : $parm['class'] ;
+
+ if($size == '2x')
+ {
+ $class .= ' btn-lg';
+ }
+
+ return $this->generateXupLoginButtons("signup", $size, $class);
+ }
+
+ /**
+ * @param string $type
+ * @param $size
+ * @param $class
+ * @return string
+ */
+ private function generateXupLoginButtons($type, $size, $class)
+ {
+ $text = "";
$tp = e107::getParser();
-
-
- if(!empty($pref))
+ $lan_plugin_social_xup = '';
+ switch ($type)
{
- $text = "";
- $manager = new SocialLoginConfigManager(e107::getConfig());
- $providers = $manager->getValidConfiguredProviderConfigs();
+ case "login":
+ $lan_plugin_social_xup = LAN_PLUGIN_SOCIAL_XUP_REG;
+ break;
+ case "signup":
+ $lan_plugin_social_xup = LAN_PLUGIN_SOCIAL_XUP_SIGNUP;
+ break;
+ }
- $size = empty($parm['size']) ? '2x' : $parm['size'];
- $class = empty($parm['class']) ? 'btn btn-primary' : $parm['class'] ;
-
- if($size == '2x')
+
+ $manager = new SocialLoginConfigManager(e107::getConfig());
+ $providers = $manager->getValidConfiguredProviderConfigs();
+
+ foreach ($providers as $p => $v)
+ {
+ if ($v['enabled'] == 1)
{
- $class .= ' btn-lg';
- }
+ $ic = strtolower($p);
-
- foreach($providers as $p=>$v)
- {
- if($v['enabled'] == 1)
+ switch ($ic)
{
- $ic = strtolower($p);
+ case 'windowslive':
+ $ic = 'windows';
+ break;
+ }
- switch ($ic)
- {
- case 'windowslive':
- $ic = 'windows';
- break;
- }
+ if (defset('FONTAWESOME') && in_array($ic, e107::getMedia()->getGlyphs()))
+ $button = "" . $tp->toGlyph('fa-' . $ic, array('size' => $size, 'fw' => true)) . "";
+ elseif (is_file(e107::getFolder('images') . "xup/{$ic}.png"))
+ $button = "
";
+ else
+ $button = "$p";
- if (defset('FONTAWESOME') && in_array($ic, e107::getMedia()->getGlyphs()))
- $button = "" . $tp->toGlyph('fa-' . $ic, array('size' => $size, 'fw' => true)) . "";
- elseif (is_file(e107::getFolder('images') . "xup/{$ic}.png"))
- $button = "
";
- else
- $button = "$p";
- $text .= " " . $button . " ";
+ $callback_url = e107::getUserProvider($p)->generateCallbackUrl($type, e_REQUEST_URL);
+ $text .= " $button ";
}
- //TODO different icon options. see: http://zocial.smcllns.com/
- }
-
- // $text .= "
";
- return $text;
- }
+ //TODO different icon options. see: http://zocial.smcllns.com/
+ }
+
+ return $text;
}
-
-
+
function sc_signup_form_open()
{
return "