Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -53,15 +53,12 @@ class _Facebook
|
||||
*/
|
||||
public static function canAutoshare()
|
||||
{
|
||||
if ( $method = \IPS\Login\Handler::findMethod( 'IPS\Login\Handler\OAuth2\Facebook' ) and $authorizedScopes = $method->authorizedScopes( \IPS\Member::loggedIn() ) )
|
||||
{
|
||||
return in_array( 'publish_actions', $authorizedScopes );
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish text or a URL to this service
|
||||
* @deprecated 4.3.3: Facebook have removed access to permission this method needs. Retaining method for 3rd party compatibility
|
||||
*
|
||||
* @param string $content Text to publish
|
||||
* @param string $url [URL to publish]
|
||||
@@ -69,26 +66,7 @@ class _Facebook
|
||||
*/
|
||||
public static function publish( $content, $url=null )
|
||||
{
|
||||
if ( static::canAutoshare() and $method = \IPS\Login\Handler::findMethod( 'IPS\Login\Handler\OAuth2\Facebook' ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if ( !$method->postToFacebook( \IPS\Member::loggedIn(), $content, $url ) )
|
||||
{
|
||||
throw new \Exception;
|
||||
}
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
\IPS\Log::log( \IPS\Member::loggedIn()->member_id . ': '. $e->getMessage(), 'facebook' );
|
||||
throw new \InvalidArgumentException( \IPS\Member::loggedIn()->language()->addToStack('facebook_publish_exception') );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \InvalidArgumentException( \IPS\Member::loggedIn()->language()->addToStack('facebook_publish_no_user') );
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,16 +79,6 @@ class _Facebook
|
||||
public static function modifyForm( \IPS\Helpers\Form &$form, $service )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'fbc_bot_group', \IPS\Settings::i()->fbc_bot_group, TRUE, array( 'options' => array_combine( array_keys( \IPS\Member\Group::groups() ), array_map( function( $_group ) { return (string) $_group; }, \IPS\Member\Group::groups() ) ) ) ) );
|
||||
|
||||
if ( \IPS\Login\Handler::findMethod( 'IPS\Login\Handler\OAuth2\Facebook' ) )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'share_autoshare_Facebook', $service->autoshare, false ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'share_autoshare_Facebook', FALSE, false, array( 'disabled' => TRUE ) ) );
|
||||
\IPS\Member::loggedIn()->language()->words['share_autoshare_Facebook_desc'] = \IPS\Member::loggedIn()->language()->addToStack('share_autoshare_Facebook_disabled');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user