Skip to content

Commit

Permalink
Merge pull request rodrigoprimo#30 from hacklabr/fix-user-interface
Browse files Browse the repository at this point in the history
Add social-connect html only if there is a social login enabled
  • Loading branch information
rodrigoprimo committed Jan 16, 2014
2 parents fdbde61 + 663b45a commit 3ef60bb
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 51 deletions.
4 changes: 1 addition & 3 deletions twitter/connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
define('CONSUMER_SECRET', get_option('social_connect_twitter_consumer_secret'));
define('OAUTH_CALLBACK', SOCIAL_CONNECT_PLUGIN_URL . '/twitter/callback.php');

$twitter_enabled = get_option('social_connect_twitter_enabled');

if($twitter_enabled && CONSUMER_KEY != '' && CONSUMER_SECRET != '') {
if(CONSUMER_KEY != '' && CONSUMER_SECRET != '') {
/* Build TwitterOAuth object with client credentials. */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);

Expand Down
97 changes: 49 additions & 48 deletions ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,54 +18,55 @@ function sc_render_login_form_social_connect( $args = NULL ) {
$yahoo_enabled = get_option( 'social_connect_yahoo_enabled', 1 );
$wordpress_enabled = get_option( 'social_connect_wordpress_enabled', 1 );
?>
<div class="social_connect_ui <?php if( strpos( $_SERVER['REQUEST_URI'], 'wp-signup.php' ) ) echo 'mu_signup'; ?>">
<p class="comment-form-social-connect">
<?php if( $display_label !== false ) : ?>
<label><?php _e( 'Connect with', 'social_connect' ); ?></label>
<?php endif; ?>
<div class="social_connect_form">
<?php do_action ('social_connect_pre_form'); ?>
<?php if( $facebook_enabled ) :
echo apply_filters('social_connect_login_facebook','<a href="javascript:void(0);" title="Facebook" class="social_connect_login_facebook"><img alt="Facebook" src="'.$images_url.'facebook_32.png" /></a>');
endif; ?>
<?php if( $twitter_enabled ) :
echo apply_filters('social_connect_login_twitter','<a href="javascript:void(0);" title="Twitter" class="social_connect_login_twitter"><img alt="Twitter" src="'.$images_url.'twitter_32.png" /></a>');
endif; ?>
<?php if( $google_enabled ) :
echo apply_filters('social_connect_login_google','<a href="javascript:void(0);" title="Google" class="social_connect_login_google"><img alt="Google" src="'.$images_url.'google_32.png" /></a>');
endif; ?>
<?php if( $yahoo_enabled ) :
echo apply_filters('social_connect_login_yahoo','<a href="javascript:void(0);" title="Yahoo" class="social_connect_login_yahoo"><img alt="Yahoo" src="'.$images_url.'yahoo_32.png" /></a>');
endif; ?>
<?php if( $wordpress_enabled ) :
echo apply_filters('social_connect_login_wordpress','<a href="javascript:void(0);" title="WordPress.com" class="social_connect_login_wordpress"><img alt="WordPress.com" src="'.$images_url.'wordpress_32.png" /></a>');
endif; ?>
<?php do_action ('social_connect_post_form'); ?>
</div></p>

<?php
$social_connect_provider = isset( $_COOKIE['social_connect_current_provider']) ? $_COOKIE['social_connect_current_provider'] : '';

?>
<?php do_action ('social_connect_auth'); ?>
<div id="social_connect_facebook_auth">
<input type="hidden" name="client_id" value="<?php echo get_option( 'social_connect_facebook_api_key' ); ?>" />
<input type="hidden" name="redirect_uri" value="<?php echo urlencode( SOCIAL_CONNECT_PLUGIN_URL . '/facebook/callback.php' ); ?>" />
</div>
<div id="social_connect_twitter_auth"><input type="hidden" name="redirect_uri" value="<?php echo( SOCIAL_CONNECT_PLUGIN_URL . '/twitter/connect.php' ); ?>" /></div>
<div id="social_connect_google_auth"><input type="hidden" name="redirect_uri" value="<?php echo( SOCIAL_CONNECT_PLUGIN_URL . '/google/connect.php' ); ?>" /></div>
<div id="social_connect_yahoo_auth"><input type="hidden" name="redirect_uri" value="<?php echo( SOCIAL_CONNECT_PLUGIN_URL . '/yahoo/connect.php' ); ?>" /></div>
<div id="social_connect_wordpress_auth"><input type="hidden" name="redirect_uri" value="<?php echo( SOCIAL_CONNECT_PLUGIN_URL . '/wordpress/connect.php' ); ?>" /></div>

<div class="social_connect_wordpress_form" title="WordPress">
<p><?php _e( 'Enter your WordPress.com blog URL', 'social_connect' ); ?></p><br />
<p>
<span>http://</span><input class="wordpress_blog_url" size="15" value=""/><span>.wordpress.com</span> <br /><br />
<a href="javascript:void(0);" class="social_connect_wordpress_proceed"><?php _e( 'Proceed', 'social_connect' ); ?></a>
</p>
</div>
</div> <!-- End of social_connect_ui div -->
<?php

<?php if ($twitter_enabled || $facebook_enabled || $google_enabled || $yahoo_enabled || $wordpress_enabled) : ?>
<div class="social_connect_ui <?php if( strpos( $_SERVER['REQUEST_URI'], 'wp-signup.php' ) ) echo 'mu_signup'; ?>">
<p class="comment-form-social-connect">
<?php if( $display_label !== false ) : ?>
<label><?php _e( 'Connect with', 'social_connect' ); ?></label>
<?php endif; ?>
<div class="social_connect_form">
<?php do_action ('social_connect_pre_form'); ?>
<?php if( $facebook_enabled ) :
echo apply_filters('social_connect_login_facebook','<a href="javascript:void(0);" title="Facebook" class="social_connect_login_facebook"><img alt="Facebook" src="'.$images_url.'facebook_32.png" /></a>');
endif; ?>
<?php if( $twitter_enabled ) :
echo apply_filters('social_connect_login_twitter','<a href="javascript:void(0);" title="Twitter" class="social_connect_login_twitter"><img alt="Twitter" src="'.$images_url.'twitter_32.png" /></a>');
endif; ?>
<?php if( $google_enabled ) :
echo apply_filters('social_connect_login_google','<a href="javascript:void(0);" title="Google" class="social_connect_login_google"><img alt="Google" src="'.$images_url.'google_32.png" /></a>');
endif; ?>
<?php if( $yahoo_enabled ) :
echo apply_filters('social_connect_login_yahoo','<a href="javascript:void(0);" title="Yahoo" class="social_connect_login_yahoo"><img alt="Yahoo" src="'.$images_url.'yahoo_32.png" /></a>');
endif; ?>
<?php if( $wordpress_enabled ) :
echo apply_filters('social_connect_login_wordpress','<a href="javascript:void(0);" title="WordPress.com" class="social_connect_login_wordpress"><img alt="WordPress.com" src="'.$images_url.'wordpress_32.png" /></a>');
endif; ?>
<?php do_action ('social_connect_post_form'); ?>
</div></p>

<?php
$social_connect_provider = isset( $_COOKIE['social_connect_current_provider']) ? $_COOKIE['social_connect_current_provider'] : '';

do_action ('social_connect_auth'); ?>
<div id="social_connect_facebook_auth">
<input type="hidden" name="client_id" value="<?php echo get_option( 'social_connect_facebook_api_key' ); ?>" />
<input type="hidden" name="redirect_uri" value="<?php echo urlencode( SOCIAL_CONNECT_PLUGIN_URL . '/facebook/callback.php' ); ?>" />
</div>
<div id="social_connect_twitter_auth"><input type="hidden" name="redirect_uri" value="<?php echo( SOCIAL_CONNECT_PLUGIN_URL . '/twitter/connect.php' ); ?>" /></div>
<div id="social_connect_google_auth"><input type="hidden" name="redirect_uri" value="<?php echo( SOCIAL_CONNECT_PLUGIN_URL . '/google/connect.php' ); ?>" /></div>
<div id="social_connect_yahoo_auth"><input type="hidden" name="redirect_uri" value="<?php echo( SOCIAL_CONNECT_PLUGIN_URL . '/yahoo/connect.php' ); ?>" /></div>
<div id="social_connect_wordpress_auth"><input type="hidden" name="redirect_uri" value="<?php echo( SOCIAL_CONNECT_PLUGIN_URL . '/wordpress/connect.php' ); ?>" /></div>

<div class="social_connect_wordpress_form" title="WordPress">
<p><?php _e( 'Enter your WordPress.com blog URL', 'social_connect' ); ?></p><br />
<p>
<span>http://</span><input class="wordpress_blog_url" size="15" value=""/><span>.wordpress.com</span> <br /><br />
<a href="javascript:void(0);" class="social_connect_wordpress_proceed"><?php _e( 'Proceed', 'social_connect' ); ?></a>
</p>
</div>
</div> <!-- End of social_connect_ui div -->
<?php endif;
}
endif; // function_exist

Expand Down

0 comments on commit 3ef60bb

Please sign in to comment.