Skip to content

Commit

Permalink
A bit of cleanup and rewrite to existing coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
designosis committed Apr 24, 2018
1 parent eec9ef1 commit fa862ad
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 39 deletions.
2 changes: 1 addition & 1 deletion examples/example_07/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
// 'Instagram' => ['enabled' => true, 'keys' => [ 'id' => '...', 'secret' => '...']],

],
];
];
64 changes: 26 additions & 38 deletions examples/example_07/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,57 +17,45 @@
<head>
<meta charset="UTF-8">
<title>Example 07</title>

<script>
function auth_popup( provider ){
// replace 'path/to/hybridauth' with the real path to this script
var authWindow = window.open('https://path/to/hybridauth/examples/example_07/callback.php?provider='+provider, 'authWindow', 'width=600,height=400,scrollbars=yes');
return false;
}
</script>

</head>
<body>
<h1>Sign in</h1>

<ul>

<?php
foreach ($hybridauth->getProviders() as $name) {
if (!isset($adapters[$name])) {
echo '
<?php foreach ($hybridauth->getProviders() as $name) : ?>
<?php if (!isset($adapters[$name])) : ?>
<li>
<a href="#" onclick="javascript:auth_popup(\''. $name .'\');">
Sign in with '. $name .'
<a href="#" onclick="javascript:auth_popup('<?php print $name ?>');">
Sign in with <?php print $name ?>
</a>
</li>';
}
}
?>
</li>
<?php endif; ?>
<?php endforeach; ?>

</ul>

<?php if ($adapters) { ?>
<h1>You are logged in with:</h1>
<?php if ($adapters) : ?>
<h1>You are logged in:</h1>
<ul>
<?php
foreach ($adapters as $name=>$adapter) {
echo '
<li>
'. $adapter->getUserProfile()->displayName .' from
<i>'. $name .'</i>
(<a href="'. $config['callback'] .'?logout='. $name .'">Log Out</a>)
</li>';
}
?>
<?php foreach ($adapters as $name => $adapter) : ?>
<li>
<strong><?php print $adapter->getUserProfile()->displayName; ?></strong> from
<i><?php print $name; ?></i>
<span>(<a href="<?php print $config['callback'] . "?logout={$name}"; ?>">Log Out</a>)</span>
</li>
<?php endforeach; ?>
</ul>
<?php } ?>
<?php endif; ?>

</body>
</html>




<a href="#" onclick="javascript:auth_popup('Google');">Sign in with Google</a>
<a href="#" onclick="javascript:auth_popup('Facebook');">Sign in with Facebook</a>


<script>
function auth_popup( provider ){
// replace 'path/to/hybridauth' with the real path to this script
var authWindow = window.open('https://path/to/hybridauth/examples/example_07/callback.php?provider='+provider, 'authWindow', 'width=600,height=400,scrollbars=yes');
return false;
}
</script>

0 comments on commit fa862ad

Please sign in to comment.