@@ -90,7 +90,7 @@ |
||
90 | 90 | { |
91 | 91 | $this->joinElementTable('enupalsocializer_tokens'); |
92 | 92 | |
93 | - if (is_null($this->query)){ |
|
93 | + if (is_null($this->query)) { |
|
94 | 94 | return false; |
95 | 95 | } |
96 | 96 |
@@ -103,7 +103,7 @@ |
||
103 | 103 | { |
104 | 104 | $this->joinElementTable('enupalsocializer_providers'); |
105 | 105 | |
106 | - if (is_null($this->query)){ |
|
106 | + if (is_null($this->query)) { |
|
107 | 107 | return false; |
108 | 108 | } |
109 | 109 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public static function displayName(): string |
79 | 79 | { |
80 | - return Craft::t('enupal-socializer','Socializer'); |
|
80 | + return Craft::t('enupal-socializer', 'Socializer'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $record = TokenRecord::findOne($this->id); |
173 | 173 | |
174 | 174 | if (!$record) { |
175 | - throw new \Exception('Invalid Token ID: ' . $this->id); |
|
175 | + throw new \Exception('Invalid Token ID: '.$this->id); |
|
176 | 176 | } |
177 | 177 | } else { |
178 | 178 | $record->id = $this->id; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $redirect = $this->getRedirectUrl(); |
32 | 32 | |
33 | 33 | if (is_null($provider)) { |
34 | - throw new \Exception(Craft::t('enupal-socializer','Provider not found or disabled')); |
|
34 | + throw new \Exception(Craft::t('enupal-socializer', 'Provider not found or disabled')); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $redirectUrl = $redirect ?? Craft::$app->getRequest()->referrer; |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | $adapter = $provider->getAdapter(); |
41 | 41 | |
42 | 42 | try { |
43 | - if ($adapter->authenticate()){ |
|
44 | - if (!Socializer::$app->providers->loginOrRegisterUser($provider)){ |
|
43 | + if ($adapter->authenticate()) { |
|
44 | + if (!Socializer::$app->providers->loginOrRegisterUser($provider)) { |
|
45 | 45 | Craft::$app->getSession()->setError(Craft::t('enupal-socializer', "Unable to authenticate user")); |
46 | 46 | } |
47 | 47 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $redirect = Craft::$app->getRequest()->getParam('redirect'); |
64 | 64 | |
65 | - if ($redirect){ |
|
65 | + if ($redirect) { |
|
66 | 66 | $redirect = UrlHelper::siteUrl($redirect); |
67 | 67 | } |
68 | 68 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $redirectUrl = Craft::$app->getSession()->get(self::SESSION_REDIRECT_URL); |
81 | 81 | $user = Craft::$app->getUser()->getIdentity(); |
82 | 82 | |
83 | - if ($user){ |
|
83 | + if ($user) { |
|
84 | 84 | $variables['user'] = $user; |
85 | 85 | $redirectUrl = Craft::$app->getView()->renderString($redirectUrl, $variables); |
86 | 86 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | $providerHandle = Craft::$app->getSession()->get(self::SESSION_PROVIDER_HANDLE); |
104 | 104 | $provider = Socializer::$app->providers->getProviderByHandle($providerHandle); |
105 | 105 | |
106 | - if (is_null($provider)){ |
|
107 | - throw new \Exception(Craft::t('enupal-socializer','Provider not found or disabled')); |
|
106 | + if (is_null($provider)) { |
|
107 | + throw new \Exception(Craft::t('enupal-socializer', 'Provider not found or disabled')); |
|
108 | 108 | } |
109 | 109 | |
110 | - if (!Socializer::$app->providers->loginOrRegisterUser($provider)){ |
|
110 | + if (!Socializer::$app->providers->loginOrRegisterUser($provider)) { |
|
111 | 111 | Craft::$app->getSession()->setError(Craft::t('enupal-socializer', "Unable to authenticate user")); |
112 | 112 | } |
113 | 113 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | // Save it |
46 | 46 | if (!Socializer::$app->providers->saveProvider($provider)) { |
47 | - Craft::$app->getSession()->setError(Craft::t('enupal-socializer','Couldn’t save provider')); |
|
47 | + Craft::$app->getSession()->setError(Craft::t('enupal-socializer', 'Couldn’t save provider')); |
|
48 | 48 | |
49 | 49 | Craft::$app->getUrlManager()->setRouteParams([ |
50 | 50 | 'provider' => $provider |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | return null; |
55 | 55 | } |
56 | 56 | |
57 | - Craft::$app->getSession()->setNotice(Craft::t('enupal-socializer','Provider saved.')); |
|
57 | + Craft::$app->getSession()->setNotice(Craft::t('enupal-socializer', 'Provider saved.')); |
|
58 | 58 | |
59 | 59 | return $this->redirectToPostedUrl($provider); |
60 | 60 | } |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | $request = Craft::$app->getRequest(); |
78 | 78 | $providerType = $request->getRequiredBodyParam("providerType"); |
79 | 79 | $provider = Socializer::$app->providers->getProviderByType($providerType); |
80 | - if ($provider){ |
|
81 | - throw new \Exception(Craft::t('enupal-socializer','Provider '.$provider->name.' already exists')); |
|
80 | + if ($provider) { |
|
81 | + throw new \Exception(Craft::t('enupal-socializer', 'Provider '.$provider->name.' already exists')); |
|
82 | 82 | } |
83 | 83 | $providerName = Socializer::$app->providers->getClassNameFromNamespace($providerType); |
84 | 84 | $providerHandle = lcfirst($providerName); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | return $this->redirect($url); |
90 | 90 | } else { |
91 | 91 | $errors = $provider->getErrors(); |
92 | - throw new \Exception(Craft::t('enupal-socializer','Error creating the Provider'.json_encode($errors))); |
|
92 | + throw new \Exception(Craft::t('enupal-socializer', 'Error creating the Provider'.json_encode($errors))); |
|
93 | 93 | } |
94 | 94 | } else { |
95 | 95 | if ($providerId !== null) { |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | $provider = Socializer::$app->providers->getProviderById($providerId); |
99 | 99 | |
100 | 100 | if (!$provider) { |
101 | - throw new NotFoundHttpException(Craft::t('enupal-socializer','Provider not found')); |
|
101 | + throw new NotFoundHttpException(Craft::t('enupal-socializer', 'Provider not found')); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | - if (is_string($provider->fieldMapping)){ |
|
107 | + if (is_string($provider->fieldMapping)) { |
|
108 | 108 | $provider->fieldMapping = json_decode($provider->fieldMapping, true); |
109 | 109 | } |
110 | 110 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | // @TODO - handle errors |
147 | 147 | Socializer::$app->providers->deleteProvider($provider); |
148 | 148 | |
149 | - Craft::$app->getSession()->setNotice(Craft::t('enupal-socializer','Provider deleted.')); |
|
149 | + Craft::$app->getSession()->setNotice(Craft::t('enupal-socializer', 'Provider deleted.')); |
|
150 | 150 | |
151 | 151 | return $this->redirectToPostedUrl($provider); |
152 | 152 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $reflection = new \ReflectionClass($providerType); |
162 | 162 | $property = $reflection->getProperty('apiDocumentation'); |
163 | 163 | $property->setAccessible(true); |
164 | - $obj = new $providerType(['callback' => 'https://example.com/path/to/script.php',"keys"=>["key" => "ads", "secret"=>"test"]]); |
|
164 | + $obj = new $providerType(['callback' => 'https://example.com/path/to/script.php', "keys"=>["key" => "ads", "secret"=>"test"]]); |
|
165 | 165 | |
166 | 166 | return $property->getValue($obj); |
167 | 167 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | $this->requirePostRequest(); |
27 | 27 | $settings = Craft::$app->getRequest()->getBodyParam('settings'); |
28 | - $message = Craft::t('enupal-socializer','Settings saved.'); |
|
28 | + $message = Craft::t('enupal-socializer', 'Settings saved.'); |
|
29 | 29 | |
30 | 30 | $plugin = Socializer::$app->settings->getPlugin(); |
31 | 31 | $settingsModel = $plugin->getSettings(); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | if (!Socializer::$app->settings->saveSettings($settingsModel)) { |
36 | 36 | |
37 | - Craft::$app->getSession()->setError(Craft::t('enupal-socializer','Couldn’t save settings.')); |
|
37 | + Craft::$app->getSession()->setError(Craft::t('enupal-socializer', 'Couldn’t save settings.')); |
|
38 | 38 | |
39 | 39 | // Send the settings back to the template |
40 | 40 | Craft::$app->getUrlManager()->setRouteParams([ |
@@ -98,11 +98,11 @@ |
||
98 | 98 | return array_merge($parent, [ |
99 | 99 | 'subnav' => [ |
100 | 100 | 'providers' => [ |
101 | - "label" => Craft::t('enupal-socializer',"Providers"), |
|
101 | + "label" => Craft::t('enupal-socializer', "Providers"), |
|
102 | 102 | "url" => 'enupal-socializer/providers' |
103 | 103 | ], |
104 | 104 | 'settings' => [ |
105 | - "label" => Craft::t('enupal-socializer',"Settings"), |
|
105 | + "label" => Craft::t('enupal-socializer', "Settings"), |
|
106 | 106 | "url" => 'enupal-socializer/settings' |
107 | 107 | ] |
108 | 108 | ] |
@@ -28,15 +28,15 @@ |
||
28 | 28 | { |
29 | 29 | if ($object->type != Apple::class) { |
30 | 30 | if ($object->enabled && !$object->clientId) { |
31 | - $this->addError($object, $attribute, Craft::t('enupal-socializer','Client ID cannot be blank')); |
|
31 | + $this->addError($object, $attribute, Craft::t('enupal-socializer', 'Client ID cannot be blank')); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | if ($object->enabled && !$object->clientSecret) { |
35 | - $this->addError($object, 'clientSecret', Craft::t('enupal-socializer','Client Secret cannot be blank')); |
|
35 | + $this->addError($object, 'clientSecret', Craft::t('enupal-socializer', 'Client Secret cannot be blank')); |
|
36 | 36 | } |
37 | - }else if ($object->type === Apple::class && $object->enabled) { |
|
37 | + } else if ($object->type === Apple::class && $object->enabled) { |
|
38 | 38 | if (!Socializer::$app->settings->validateAppleSettings()) { |
39 | - $this->addError($object, 'enabled', Craft::t('enupal-socializer','Unable to process the Apple settings from the config file')); |
|
39 | + $this->addError($object, 'enabled', Craft::t('enupal-socializer', 'Unable to process the Apple settings from the config file')); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 |
@@ -15,5 +15,5 @@ |
||
15 | 15 | // Disable CSRF validation for the entire controller |
16 | 16 | public $enableCsrfValidation = false; |
17 | 17 | |
18 | - protected array|int|bool $allowAnonymous = true; |
|
18 | + protected array | int | bool $allowAnonymous = true; |
|
19 | 19 | } |