public function getLogin($social) { try { switch ($social) { case 'facebook': $su = \Social::facebook('user'); break; case 'google': $su = \Social::google('user'); break; default: $su = null; } if ($su === null) { return \Redirect::route('frontend.index'); } $m = \Member::where('uid', '=', $su->id)->where('social', '=', $social)->first(); if ($m == null) { $m = new \Member(); $m->uid = $su->id; $m->social = $social; $m->name = $su->name; $m->email = $su->email; if ($social == 'facebook') { if (isset($su->birthday)) { $m->birthday = date('Y-m-d', strtotime($su->birthday)); } if (isset($su->gender)) { $m->gender = substr($su->gender, 0, 1); } } $m->save(); } // register user into Auth that is a global variable \Auth::login($m); return \Redirect::route('frontend.index'); } catch (Exception $e) { echo $e->getMessage(); exit; } }
function widget($args, $instance) { extract($args); $Social = new Social(); echo $before_widget; if (!empty($instance['title'])) { echo $before_title; echo $instance['title']; echo $after_title; } ?> <ul class="subscribe"> <?php if (!empty($instance['dribbble'])) { $dribbble = $Social->dribbble($instance['dribbble']); ?> <li class="clearfix dribbble"> <a href="<?php echo $instance['dribbble']; ?> " target="_blank"> <span><i><?php echo @number_format($dribbble); ?> </i> <?php _e('Followers'); ?> </span> </a> </li> <?php } ?> <?php if (!empty($instance['vimeo'])) { $vimeo = $Social->vimeo($instance['vimeo']); ?> <li class="clearfix vimeo"> <a href="<?php echo $instance['vimeo']; ?> " target="_blank"> <span><i><?php echo @number_format($vimeo); ?> </i> <?php _e('Subscribers'); ?> </span> </a> </li> <?php } ?> <?php if (!empty($instance['youtube'])) { $youtube = $Social->youtube($instance['youtube']); ?> <li class="clearfix YouTube"> <a href="<?php echo $instance['youtube']; ?> " target="_blank"> <span><i><?php echo @number_format($youtube); ?> </i> <?php _e('Subscribers'); ?> </span> </a> </li> <?php } ?> <?php if (!empty($instance['facebook'])) { $facebook = $Social->facebook($instance['facebook']); ?> <li class="clearfix facebook"> <a href="<?php echo $instance['facebook']; ?> " target="_blank"> <span><i><?php echo @number_format($facebook); ?> </i> <?php _e('Fans'); ?> </span> </a> </li> <?php } ?> <?php if (!empty($instance['github'])) { $github = $Social->github($instance['github']); ?> <li class="clearfix github"> <a href="<?php echo $instance['github']; ?> " target="_blank"> <span><i><?php echo @number_format($github); ?> </i> <?php _e('Followers'); ?> </span> </a> </li> <?php } ?> </ul> <?php echo $after_widget; }
<?php /*----------------------------------------------------------------------------------- File contains the Facebook signin + after signin close window -------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------- START Facebook signin process -------------------------------------------------------------------------------------*/ require 'facebook.php'; $FACEBOOK = new Social(); if (isset($_GET['facebook'])) { $FACEBOOK->facebook(); //Sotring data in signup session $_SESSION["SIGNUP"]["DETAILS"]["email"] = $_SESSION['User']['email']; $_SESSION["SIGNUP"]["DETAILS"]["email"] = $_SESSION['User']['first_name']; $_SESSION["SIGNUP"]["DETAILS"]["email"] = $_SESSION['User']['last_name']; $_SESSION["SIGNUP"]["DETAILS"]["email"] = $_SESSION['User']['email']; } ?> <!-- after authentication close the popup --> <script type="text/javascript"> window.close(); </script> <?php /*----------------------------------------------------------------------------------- END Google signin -------------------------------------------------------------------------------------*/