Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
@@ -47,6 +47,16 @@ class Twitter extends OAuth1
|
||||
{
|
||||
return 'login_handler_Twitter';
|
||||
}
|
||||
|
||||
/**
|
||||
* Can this handler sync profile photos?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canSyncProfilePhoto() : bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* ACP Settings Form
|
||||
@@ -73,6 +83,15 @@ class Twitter extends OAuth1
|
||||
'screen' => array( 'login_update_name_changes_inc_optional' ),
|
||||
)
|
||||
), NULL, NULL, NULL, 'login_real_name' ),
|
||||
'real_photo' => new Radio( 'login_real_photo', $this->settings['real_photo'] ?? 1, false, array(
|
||||
'options' => array(
|
||||
1 => 'login_real_photo_twitter',
|
||||
0 => 'login_real_photo_disabled'
|
||||
),
|
||||
'toggles' => array(
|
||||
1 => array( 'login_update_photo_changes_inc_optional' )
|
||||
)
|
||||
) )
|
||||
),
|
||||
parent::acpForm(),
|
||||
array()
|
||||
@@ -240,7 +259,7 @@ class Twitter extends OAuth1
|
||||
*/
|
||||
public function userProfileName( Member $member ): ?string
|
||||
{
|
||||
if ( !( $link = $this->_link( $member ) ) )
|
||||
if ( !( $link = $this->_link( $member ) ) OR empty( $link['token_access_token'] ) )
|
||||
{
|
||||
throw new LoginException( "", LoginException::INTERNAL_ERROR );
|
||||
}
|
||||
@@ -260,16 +279,20 @@ class Twitter extends OAuth1
|
||||
*/
|
||||
public function userProfilePhoto( Member $member ): ?Url
|
||||
{
|
||||
if ( !( $link = $this->_link( $member ) ) )
|
||||
if ( !( $link = $this->_link( $member ) ) OR empty( $link['token_access_token'] ) )
|
||||
{
|
||||
throw new LoginException( "", LoginException::INTERNAL_ERROR );
|
||||
}
|
||||
|
||||
$userData = $this->_userData( $link['token_access_token'], $link['token_secret'] );
|
||||
if ( !$userData['default_profile_image'] )
|
||||
{
|
||||
return Url::external( str_replace( '_normal', '', $userData['profile_image_url_https'] ?: $userData['profile_image_url'] ) );
|
||||
}
|
||||
|
||||
if ( isset( $this->settings['real_photo'] ) and $this->settings['real_photo'] )
|
||||
{
|
||||
$userData = $this->_userData( $link['token_access_token'], $link['token_secret'] );
|
||||
if ( !$userData['default_profile_image'] )
|
||||
{
|
||||
return Url::external( str_replace( '_normal', '', $userData['profile_image_url_https'] ?: $userData['profile_image_url'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -335,8 +358,12 @@ class Twitter extends OAuth1
|
||||
{
|
||||
$return[] = 'name';
|
||||
}
|
||||
|
||||
$return[] = 'photo';
|
||||
|
||||
if( isset( $this->settings['update_photo_changes'] ) and $this->settings['update_photo_changes'] == 'optional' and isset( $this->settings['real_photo'] ) and $this->settings['real_photo'] )
|
||||
{
|
||||
$return[] = 'photo';
|
||||
}
|
||||
|
||||
$return[] = 'cover';
|
||||
|
||||
return $return;
|
||||
|
||||
Reference in new issue
Block a user