From af1bbb1c8a4c80d4210fb8c46c33deffe06eef24 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 12 Mar 2016 19:36:47 -0800 Subject: [PATCH] Social App UI cleanup. Tooltips may now be disabled in the social shortcodes if needed. --- e107_plugins/social/admin_config.php | 65 ++++++++++++++++++++++------ e107_plugins/social/e_shortcode.php | 39 +++++++++++------ 2 files changed, 77 insertions(+), 27 deletions(-) diff --git a/e107_plugins/social/admin_config.php b/e107_plugins/social/admin_config.php index 742d5fd39..9566d0463 100644 --- a/e107_plugins/social/admin_config.php +++ b/e107_plugins/social/admin_config.php @@ -170,6 +170,11 @@ class social_ui extends e_admin_ui "keys" => array ( "id" => "", "secret" => "" ), "scope" => "" ), +/* + "Instagram" => array ( + "enabled" => true, + "keys" => array ( "id" => "", "secret" => "" ) + ),*/ "LinkedIn" => array ( "enabled" => true, @@ -212,6 +217,7 @@ class social_ui extends e_admin_ui "Foursquare" => "https://www.foursquare.com/oauth/", "Github" => "https://github.com/settings/applications/new", "Steam" => "http://steamcommunity.com/dev/apikey", + "Instagram" => "http://instagram.com/developer" ); @@ -294,14 +300,23 @@ class social_ui extends e_admin_ui - - Application Keys and IDs
- + + - + + + + + + + + + + + "; @@ -312,46 +327,68 @@ class social_ui extends e_admin_ui foreach($this->social_logins as $prov=>$val) { - + $textKeys = ''; + $textScope = ''; + $keyCount= array(); $label = varset($this->social_external[$prov]) ? "".$prov."" : $prov; $radio_label = strtolower($prov); $text .= " - "; } - $text .= ""; + // $text .= ""; break; case 'scope': - $text .= $frm->hidden('social_login['.$prov.'][scope]','email'); + $textScope .= $frm->hidden('social_login['.$prov.'][scope]','email'); break; default: break; } + + + + } - $text .= " + + + if(empty($keyCount)) + { + $textKeys = ""; + } + elseif(count($keyCount) == 1) + { + $textKeys .= ""; + } + + $text .= $textKeys.""; + + $text .= " "; } @@ -427,7 +464,7 @@ class social_ui extends e_admin_ui "; $tabs = array(); - $tabs[] = array('caption'=>"Apps", 'text'=>$text); + $tabs[] = array('caption'=>"Applications", 'text'=>$text); $tabs[] = array('caption'=>'Pages', 'text'=>$text2); $ret = $frm->open('social','post',null, 'class=form-horizontal').$frm->tabs($tabs); diff --git a/e107_plugins/social/e_shortcode.php b/e107_plugins/social/e_shortcode.php index 24b98ff0f..1799063a2 100644 --- a/e107_plugins/social/e_shortcode.php +++ b/e107_plugins/social/e_shortcode.php @@ -77,6 +77,15 @@ class social_shortcodes extends e_shortcode $class = (vartrue($parm['size'])) ? 'fa-'.$parm['size'] : ''; $tooltipPos = vartrue($parm['tip-pos'], 'top'); + if(isset($parm['tip'])) + { + $tooltip = ($parm['tip'] == 'false' || empty($parm['tooltip'])) ? '' : 'e-tip'; + } + else + { + $tooltip = 'e-tip'; + } + if(!empty($parm['type'])) { $newList = array(); @@ -98,7 +107,7 @@ class social_shortcodes extends e_shortcode if($data['href'] != '') { - $text .= ''; + $text .= ''; $text .= "\n"; } } @@ -185,11 +194,8 @@ class social_shortcodes extends e_shortcode $providers = $this->getProviders(); - - if(empty($parm)) // No parms so use prefs instead. + if(empty($parm['providers'])) // No parms so use prefs instead. { - - $parm['dropdown'] = ($pref['sharing_mode'] == 'dropdown') ? 1 : 0; $parm['providers'] = !empty($pref['sharing_providers']) ? array_keys($pref['sharing_providers']) : array_keys($providers); } else @@ -197,9 +203,12 @@ class social_shortcodes extends e_shortcode $parm['providers'] = array_keys($providers); } + if(empty($parm['dropdown'])) + { + $parm['dropdown'] = ($pref['sharing_mode'] == 'dropdown') ? 1 : 0; + } - $url = varset($parm['url'], $defaultUrl); $title = varset($parm['title'], $defaultTitle) ; $description = varset($parm['title'], $defaultDiz); @@ -210,11 +219,6 @@ class social_shortcodes extends e_shortcode $size = varset($parm['size'], 'md'); - - - - - $data = array('u'=> rawurlencode($url), 't'=> rawurlencode($title), 'd' => rawurlencode($description), 'm' => rawurlencode($media)); if(!vartrue($parm['dropdown'])) @@ -235,6 +239,15 @@ class social_shortcodes extends e_shortcode $hashtags = $this->getHashtags($tags); + if(isset($parm['tip'])) + { + $tooltip = ($parm['tip'] == 'false' || empty($parm['tooltip'])) ? '' : 'e-tip'; + } + else + { + $tooltip = 'e-tip'; + } + $twitterAccount = basename(XURL_TWITTER); @@ -268,7 +281,7 @@ class social_shortcodes extends e_shortcode - $opt[$k] = "".$tp->toIcon($val["icon"]).""; + $opt[$k] = "".$tp->toIcon($val["icon"]).""; } // Show only Email, Facebook, Twitter and Google. @@ -301,7 +314,7 @@ class social_shortcodes extends e_shortcode $text = '
- '.$label.' + '.$label.'
ProviderKey/IDSecretSignup/Login
+ "; foreach($val as $k=>$v) { + + switch ($k) { case 'enabled': $eopt = array('class'=>'e-expandit'); - $text .= $frm->radio_switch('social_login['.$prov.'][enabled]', vartrue($pref['social_login'][$prov]['enabled']),'','',$eopt); + $textEnabled = $frm->radio_switch('social_login['.$prov.'][enabled]', vartrue($pref['social_login'][$prov]['enabled']),'','',$eopt); break; case 'keys': // $cls = vartrue($pref['single_login'][$prov]['keys'][$tk]) ? "class='e-hideme'" : ''; $sty = vartrue($pref['social_login'][$prov]['keys'][vartrue($tk)]) ? "" : "e-hideme"; - $text .= "
"; + // $text .= "
"; foreach($v as $tk=>$idk) { - $eopt = array('placeholder'=> $tk, 'size'=>'xxlarge'); - $text .= "
".$frm->text('social_login['.$prov.'][keys]['.$tk.']', vartrue($pref['social_login'][$prov]['keys'][$tk]), 100, $eopt); + $eopt = array( 'size'=>'block-level'); + $keyCount[] = 1; + $textKeys .= "
".$frm->text('social_login['.$prov.'][keys]['.$tk.']', vartrue($pref['social_login'][$prov]['keys'][$tk]), 100, $eopt)."   ".$textEnabled.$textScope."