@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | /** |
300 | 300 | * Fetch a protected ressource |
301 | 301 | * |
302 | - * @param string $protected_ressource_url Protected resource URL |
|
302 | + * @param string $protected_resource_url Protected resource URL |
|
303 | 303 | * @param array $parameters Array of parameters |
304 | 304 | * @param string $http_method HTTP Method to use (POST, PUT, GET, HEAD, DELETE) |
305 | 305 | * @param array $http_headers HTTP headers |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | /** |
481 | 481 | * Converts the class name to camel case |
482 | 482 | * |
483 | - * @param mixed $grant_type the grant type |
|
483 | + * @param integer $grant_type the grant type |
|
484 | 484 | * @return string |
485 | 485 | */ |
486 | 486 | private function convertToCamelCase($grant_type) |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | const ACCESS_TOKEN_MAC = 3; |
20 | 20 | |
21 | 21 | /** |
22 | - * Different Grant types |
|
23 | - */ |
|
22 | + * Different Grant types |
|
23 | + */ |
|
24 | 24 | const GRANT_TYPE_AUTH_CODE = 'authorization_code'; |
25 | 25 | const GRANT_TYPE_PASSWORD = 'password'; |
26 | 26 | const GRANT_TYPE_CLIENT_CREDENTIALS = 'client_credentials'; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | $curl_options[CURLOPT_POST] = true; |
398 | 398 | /* No break */ |
399 | 399 | case self::HTTP_METHOD_PUT: |
400 | - case self::HTTP_METHOD_PATCH: |
|
400 | + case self::HTTP_METHOD_PATCH: |
|
401 | 401 | |
402 | 402 | /** |
403 | 403 | * Passing an array to CURLOPT_POSTFIELDS will encode the data as multipart/form-data, |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | const HTTP_METHOD_PUT = 'PUT'; |
35 | 35 | const HTTP_METHOD_DELETE = 'DELETE'; |
36 | 36 | const HTTP_METHOD_HEAD = 'HEAD'; |
37 | - const HTTP_METHOD_PATCH = 'PATCH'; |
|
37 | + const HTTP_METHOD_PATCH = 'PATCH'; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * HTTP Form content types |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $this->client_secret = $client_secret; |
139 | 139 | $this->client_auth = $client_auth; |
140 | 140 | $this->certificate_file = $certificate_file; |
141 | - if (!empty($this->certificate_file) && !is_file($this->certificate_file)) { |
|
141 | + if (!empty($this->certificate_file) && !is_file($this->certificate_file)) { |
|
142 | 142 | throw new InvalidArgumentException('The certificate file was not found', InvalidArgumentException::CERTIFICATE_NOT_FOUND); |
143 | 143 | } |
144 | 144 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | throw new InvalidArgumentException('The grant_type is mandatory.', InvalidArgumentException::INVALID_GRANT_TYPE); |
198 | 198 | } |
199 | 199 | $grantTypeClassName = $this->convertToCamelCase($grant_type); |
200 | - $grantTypeClass = __NAMESPACE__ . '\\GrantType\\' . $grantTypeClassName; |
|
200 | + $grantTypeClass = __NAMESPACE__ . '\\GrantType\\' . $grantTypeClassName; |
|
201 | 201 | if (!class_exists($grantTypeClass)) { |
202 | 202 | throw new InvalidArgumentException('Unknown grant type \'' . $grant_type . '\'', InvalidArgumentException::INVALID_GRANT_TYPE); |
203 | 203 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | break; |
217 | 217 | case self::AUTH_TYPE_AUTHORIZATION_BASIC: |
218 | 218 | $parameters['client_id'] = $this->client_id; |
219 | - $http_headers['Authorization'] = 'Basic ' . base64_encode($this->client_id . ':' . $this->client_secret); |
|
219 | + $http_headers['Authorization'] = 'Basic ' . base64_encode($this->client_id . ':' . $this->client_secret); |
|
220 | 220 | break; |
221 | 221 | default: |
222 | 222 | throw new Exception('Unknown client auth type.', Exception::INVALID_CLIENT_AUTHENTICATION_TYPE); |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | CURLOPT_CUSTOMREQUEST => $http_method |
393 | 393 | ); |
394 | 394 | |
395 | - switch($http_method) { |
|
395 | + switch ($http_method) { |
|
396 | 396 | case self::HTTP_METHOD_POST: |
397 | 397 | $curl_options[CURLOPT_POST] = true; |
398 | 398 | /* No break */ |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * while passing a URL-encoded string will encode the data as application/x-www-form-urlencoded. |
405 | 405 | * http://php.net/manual/en/function.curl-setopt.php |
406 | 406 | */ |
407 | - if(is_array($parameters) && self::HTTP_FORM_CONTENT_TYPE_APPLICATION === $form_content_type) { |
|
407 | + if (is_array($parameters) && self::HTTP_FORM_CONTENT_TYPE_APPLICATION === $form_content_type) { |
|
408 | 408 | $parameters = http_build_query($parameters, null, '&'); |
409 | 409 | } |
410 | 410 | $curl_options[CURLOPT_POSTFIELDS] = $parameters; |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | |
429 | 429 | if (is_array($http_headers)) { |
430 | 430 | $header = array(); |
431 | - foreach($http_headers as $key => $parsed_urlvalue) { |
|
431 | + foreach ($http_headers as $key => $parsed_urlvalue) { |
|
432 | 432 | $header[] = "$key: $parsed_urlvalue"; |
433 | 433 | } |
434 | 434 | $curl_options[CURLOPT_HTTPHEADER] = $header; |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | private function convertToCamelCase($grant_type) |
487 | 487 | { |
488 | 488 | $parts = explode('_', $grant_type); |
489 | - array_walk($parts, function (&$item) { |
|
489 | + array_walk($parts, function(&$item) { |
|
490 | 490 | $item = ucfirst($item); |
491 | 491 | }); |
492 | 492 | return implode('', $parts); |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if (!defined ('TYPO3_MODE')) die ('Access denied.'); |
|
2 | +if (!defined('TYPO3_MODE')) die ('Access denied.'); |
|
3 | 3 | |
4 | 4 | \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( |
5 | 5 | 'Filoucrackeur.' . $_EXTKEY, |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined ('TYPO3_MODE')) die ('Access denied.'); |
|
2 | +if (!defined ('TYPO3_MODE')) { |
|
3 | + die ('Access denied.'); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( |
5 | 7 | 'Filoucrackeur.' . $_EXTKEY, |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use TYPO3\CMS\Extbase\Persistence\Repository; |
19 | 19 | use TYPO3\CMS\Extbase\Utility\DebuggerUtility; |
20 | 20 | |
21 | -class AccountRepository extends Repository { |
|
21 | +class AccountRepository extends Repository { |
|
22 | 22 | |
23 | 23 | // Order by BE sorting |
24 | 24 | protected $defaultOrderings = array( |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | ); |
27 | 27 | |
28 | 28 | |
29 | - public function initializeObject(){ |
|
29 | + public function initializeObject() { |
|
30 | 30 | /** @var $defaultQuerySettings \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings */ |
31 | 31 | $defaultQuerySettings = $this->objectManager->get('TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings'); |
32 | 32 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | |
18 | 18 | use TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject; |
19 | 19 | |
20 | -class Account extends AbstractDomainObject { |
|
20 | +class Account extends AbstractDomainObject { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @var \string |
@@ -91,9 +91,9 @@ |
||
91 | 91 | */ |
92 | 92 | public function authenticationResponseAction(Account $account) |
93 | 93 | { |
94 | - if( $this->client->callHubic($account) ){ |
|
94 | + if ($this->client->callHubic($account)) { |
|
95 | 95 | $this->addFlashMessage('Token successfully added', 'Authentication request', \TYPO3\CMS\Core\Messaging\AbstractMessage::OK); |
96 | - }else { |
|
96 | + } else { |
|
97 | 97 | $this->addFlashMessage('Failed getting token please check client ID and client secret', 'Authentication request', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR); |
98 | 98 | } |
99 | 99 | $this->redirect('show', '', '', ['account' => $account]); |
@@ -93,7 +93,7 @@ |
||
93 | 93 | { |
94 | 94 | if( $this->client->callHubic($account) ){ |
95 | 95 | $this->addFlashMessage('Token successfully added', 'Authentication request', \TYPO3\CMS\Core\Messaging\AbstractMessage::OK); |
96 | - }else { |
|
96 | + } else { |
|
97 | 97 | $this->addFlashMessage('Failed getting token please check client ID and client secret', 'Authentication request', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR); |
98 | 98 | } |
99 | 99 | $this->redirect('show', '', '', ['account' => $account]); |
@@ -70,13 +70,13 @@ |
||
70 | 70 | $params = array('code' => $code, 'redirect_uri' => $this->getRedirectUri($this->account)); |
71 | 71 | $response = $this->OAuth->getAccessToken(self::TOKEN_ENDPOINT, 'authorization_code', $params); |
72 | 72 | |
73 | - if( $response ){ |
|
74 | - if( $response['code'] == 200 ){ |
|
73 | + if ($response) { |
|
74 | + if ($response['code'] == 200) { |
|
75 | 75 | $this->account->setAccessToken($response['result']['access_token']); |
76 | 76 | $this->persistenceManager->update($this->account); |
77 | 77 | $this->persistenceManager->persistAll(); |
78 | 78 | return true; |
79 | - }else { |
|
79 | + } else { |
|
80 | 80 | return false; |
81 | 81 | // throw new \Exception('hubiC Api : '.implode(' ',$response['result'])); |
82 | 82 | } |
@@ -76,7 +76,7 @@ |
||
76 | 76 | $this->persistenceManager->update($this->account); |
77 | 77 | $this->persistenceManager->persistAll(); |
78 | 78 | return true; |
79 | - }else { |
|
79 | + } else { |
|
80 | 80 | return false; |
81 | 81 | // throw new \Exception('hubiC Api : '.implode(' ',$response['result'])); |
82 | 82 | } |
@@ -29,8 +29,7 @@ |
||
29 | 29 | 'The \'username\' parameter must be defined for the Password grant type', |
30 | 30 | InvalidArgumentException::MISSING_PARAMETER |
31 | 31 | ); |
32 | - } |
|
33 | - elseif (!isset($parameters['password'])) |
|
32 | + } elseif (!isset($parameters['password'])) |
|
34 | 33 | { |
35 | 34 | throw new InvalidArgumentException( |
36 | 35 | 'The \'password\' parameter must be defined for the Password grant type', |
@@ -29,8 +29,7 @@ |
||
29 | 29 | 'The \'code\' parameter must be defined for the Authorization Code grant type', |
30 | 30 | InvalidArgumentException::MISSING_PARAMETER |
31 | 31 | ); |
32 | - } |
|
33 | - elseif (!isset($parameters['redirect_uri'])) |
|
32 | + } elseif (!isset($parameters['redirect_uri'])) |
|
34 | 33 | { |
35 | 34 | throw new InvalidArgumentException( |
36 | 35 | 'The \'redirect_uri\' parameter must be defined for the Authorization Code grant type', |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | $TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY.'_list']='layout,select_key,pages,recursive'; |
32 | 32 | $TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY.'_list']='pi_flexform'; |
33 | - // new! |
|
33 | + // new! |
|
34 | 34 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( |
35 | 35 | $_EXTKEY.'_list', |
36 | 36 | 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform_list.xml' |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | if (version_compare(TYPO3_version, '7.6.0', '>=')) { |
12 | 12 | \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( |
13 | 13 | 'Filoucrackeur.hubic', |
14 | - 'tools', // Main area |
|
15 | - 'hubic', // Name of the module |
|
16 | - '', // Position of the module |
|
14 | + 'tools', // Main area |
|
15 | + 'hubic', // Name of the module |
|
16 | + '', // Position of the module |
|
17 | 17 | array( // Allowed controller action combinations |
18 | 18 | 'Backend\Account' => 'index,show,delete,add,unlink,authenticationRequest,authenticationResponse' |
19 | 19 | ), |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | -$TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY.'_list']='layout,select_key,pages,recursive'; |
|
32 | -$TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY.'_list']='pi_flexform'; |
|
31 | +$TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY . '_list'] = 'layout,select_key,pages,recursive'; |
|
32 | +$TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY . '_list'] = 'pi_flexform'; |
|
33 | 33 | // new! |
34 | 34 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( |
35 | - $_EXTKEY.'_list', |
|
35 | + $_EXTKEY . '_list', |
|
36 | 36 | 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform_list.xml' |
37 | 37 | ); |