LimeSurvey API - Master branch

GoogleOAuthSMTP extends SmtpOAuthPluginBase
in package

Table of Contents

Constants

SETUP_STATUS_INCOMPLETE_CREDENTIALS  = 3
SETUP_STATUS_INVALID_REFRESH_TOKEN  = 5
SETUP_STATUS_MISSING_REFRESH_TOKEN  = 4
SETUP_STATUS_REQUIREMENT_UNMET  = 2
SETUP_STATUS_VALID_REFRESH_TOKEN  = 1

Properties

$allowedPublicMethods  : mixed
$credentialAttributes  : array<string|int, string>
$description  : mixed
$name  : mixed
$settings  : mixed
$storage  : mixed

Methods

afterReceiveOAuthResponse()  : mixed
Default handler for the afterReceiveOAuthResponse event
afterSelectEmailPlugin()  : mixed
Handles the afterSelectEmailPlugin event, triggered when the plugin is selected as the SMTP OAuth plugin in Global Settings
beforeEmailDispatch()  : mixed
Handles the beforeEmailDispatch event, triggered right before an email is sent.
beforePrepareRedirectToAuthPage()  : mixed
beforeRedirectToAuthPage()  : mixed
Default handler for beforeRedirectToAuthPage
getHealthStatusText()  : mixed
getOAuthConfigForMailer()  : array<string, mixed>|null
Returns the OAuth configuration for PHPMailer
getPluginSettings()  : mixed
getPluginTwigPath()  : mixed
Adds view's path to twig system
init()  : mixed
listEmailPlugins()  : mixed
Adds the plugin to the list of SMTP OAuth plugins
MailerConstruct()  : mixed
Default handler for the MailerConstruct event, triggered during LimeMailer initialization.
saveSettings()  : mixed
afterRefreshTokenRetrieved()  : mixed
This method is invoked after the refresh token is retrieved.
clearRefreshToken()  : mixed
Clears the stored refresh token
getAuthorizationOptions()  : array<string, mixed>
Returns the OAuth options for authorization (like the scope)
getCredentials()  : array<string, mixed>
Returns the credentials according to the plugin specified credential attributes
getDisplayName()  : mixed
getEmailPluginInfo()  : EmailPluginInfo
Returns the plugin's metadata
getHealthStatusClass()  : mixed
getHealthStatusIcon()  : mixed
getProvider()  : AbstractProvider
Returns the OAuth provider object for the specified credentials
getRedirectUri()  : mixed
getSetupStatus()  : mixed
Returns the setup status of the plugin.
getSetupStatusAlert()  : string
Renders the contents of the "information" setting depending on settings and token validity.
getSetupStatusDescription()  : mixed
haveCredentialsChanged()  : mixed
Returns true if the credentials have changed
isActive()  : bool
Returns true if the plugin is active
isCurrentEmailPlugin()  : bool
Returns true if the plugin is the currently selected email plugin
saveRefreshToken()  : mixed
Saves the specified refresh token and associated credentials
setupMailer()  : mixed
Applies the basic OAuth configuration to the given LimeMailer
validateCredentials()  : bool
Checks if the credentials are valid.
validateRefreshToken()  : bool
Returns true if the specified refresh token is valid
getHelpContent()  : mixed
retrieveRefreshToken()  : mixed
Retrieve and store the refresh token

Constants

SETUP_STATUS_INCOMPLETE_CREDENTIALS

public mixed SETUP_STATUS_INCOMPLETE_CREDENTIALS = 3

SETUP_STATUS_INVALID_REFRESH_TOKEN

public mixed SETUP_STATUS_INVALID_REFRESH_TOKEN = 5

SETUP_STATUS_MISSING_REFRESH_TOKEN

public mixed SETUP_STATUS_MISSING_REFRESH_TOKEN = 4

Properties

$allowedPublicMethods

public mixed $allowedPublicMethods = []
Tags
inheritdoc

this plugin doesn't have any public method

$credentialAttributes

protected array<string|int, string> $credentialAttributes = ['clientId', 'clientSecret']

The names of attributes that form part of the credentials set. Example: ['clientId', 'clientSecret']

Tags
inheritdoc

$description

protected static mixed $description = 'Core: Adds Google OAuth support for email sending'

$settings

protected mixed $settings = ['help' => ['type' => 'info', 'content' => ''], 'clientId' => ['type' => 'string', 'label' => 'Client ID'], 'clientSecret' => ['type' => 'string', 'label' => 'Client Secret']]

Methods

afterReceiveOAuthResponse()

Default handler for the afterReceiveOAuthResponse event

public afterReceiveOAuthResponse() : mixed

afterSelectEmailPlugin()

Handles the afterSelectEmailPlugin event, triggered when the plugin is selected as the SMTP OAuth plugin in Global Settings

public afterSelectEmailPlugin() : mixed

beforeEmailDispatch()

Handles the beforeEmailDispatch event, triggered right before an email is sent.

public beforeEmailDispatch() : mixed

This is used to set the "Reply To" header, because Google automatically overrides the sender with the logged user.

beforePrepareRedirectToAuthPage()

public beforePrepareRedirectToAuthPage() : mixed

beforeRedirectToAuthPage()

Default handler for beforeRedirectToAuthPage

public beforeRedirectToAuthPage() : mixed

getOAuthConfigForMailer()

Returns the OAuth configuration for PHPMailer

public getOAuthConfigForMailer() : array<string, mixed>|null
Tags
inheritdoc
Return values
array<string, mixed>|null

getPluginSettings()

public getPluginSettings([mixed $getValues = true ]) : mixed
Parameters
$getValues : mixed = true
Tags
inheritdoc

Update the information content

getPluginTwigPath()

Adds view's path to twig system

public getPluginTwigPath() : mixed

listEmailPlugins()

Adds the plugin to the list of SMTP OAuth plugins

public listEmailPlugins() : mixed

MailerConstruct()

Default handler for the MailerConstruct event, triggered during LimeMailer initialization.

public MailerConstruct() : mixed

The event is expected to be dispatched specifically for the selected email plugin.

saveSettings()

public saveSettings(mixed $settings) : mixed
Parameters
$settings : mixed
Tags
inheritdoc

Handle changes in credentials

afterRefreshTokenRetrieved()

This method is invoked after the refresh token is retrieved.

protected afterRefreshTokenRetrieved(AbstractProvider $provider, AccessTokenInterface $token) : mixed

The default implementation tries to retrieve the email address of the authenticated user. You may override this method to do additional processing.

Parameters
$provider : AbstractProvider
$token : AccessTokenInterface

clearRefreshToken()

Clears the stored refresh token

protected clearRefreshToken() : mixed

getAuthorizationOptions()

Returns the OAuth options for authorization (like the scope)

protected getAuthorizationOptions() : array<string, mixed>
Tags
inheritdoc
Return values
array<string, mixed>

getCredentials()

Returns the credentials according to the plugin specified credential attributes

protected getCredentials() : array<string, mixed>
Tags
throws
Exception

if credentials are incomplete.

Return values
array<string, mixed>

The credentials array

getDisplayName()

protected getDisplayName() : mixed
Tags
inheritdoc

getHealthStatusClass()

protected getHealthStatusClass(mixed $setupStatus) : mixed
Parameters
$setupStatus : mixed

getHealthStatusIcon()

protected getHealthStatusIcon(mixed $statusClass) : mixed
Parameters
$statusClass : mixed

getProvider()

Returns the OAuth provider object for the specified credentials

protected getProvider(mixed $credentials) : AbstractProvider
Parameters
$credentials : mixed
Tags
inheritdoc
Return values
AbstractProvider

getSetupStatus()

Returns the setup status of the plugin.

protected getSetupStatus() : mixed

getSetupStatusAlert()

Renders the contents of the "information" setting depending on settings and token validity.

protected getSetupStatusAlert() : string
Return values
string

getSetupStatusDescription()

protected getSetupStatusDescription(mixed $setupStatus) : mixed
Parameters
$setupStatus : mixed

haveCredentialsChanged()

Returns true if the credentials have changed

protected haveCredentialsChanged(mixed $oldCredentials, mixed $newCredentials) : mixed
Parameters
$oldCredentials : mixed
$newCredentials : mixed

isActive()

Returns true if the plugin is active

protected isActive() : bool
Return values
bool

isCurrentEmailPlugin()

Returns true if the plugin is the currently selected email plugin

protected isCurrentEmailPlugin() : bool
Return values
bool

saveRefreshToken()

Saves the specified refresh token and associated credentials

protected saveRefreshToken(mixed $refreshToken, mixed $credentials) : mixed
Parameters
$refreshToken : mixed
$credentials : mixed

setupMailer()

Applies the basic OAuth configuration to the given LimeMailer

protected setupMailer(mixed $mailer) : mixed
Parameters
$mailer : mixed
Tags
inheritdoc

Add Google specific settings to the mailer

validateCredentials()

Checks if the credentials are valid.

protected validateCredentials(array<string, mixed> $credentials) : bool

By default, it checks if the credentials are not empty.

Parameters
$credentials : array<string, mixed>
Return values
bool

True if the credentials are valid, false otherwise.

validateRefreshToken()

Returns true if the specified refresh token is valid

protected validateRefreshToken(string $refreshToken, array<string, mixed> $credentials) : bool
Parameters
$refreshToken : string
$credentials : array<string, mixed>
Return values
bool

retrieveRefreshToken()

Retrieve and store the refresh token

private retrieveRefreshToken(mixed $code, mixed $credentials) : mixed
Parameters
$code : mixed
$credentials : mixed

        
On this page

Search results