Skip to content

Commit

Permalink
Merge pull request #3 from kdambekalns/master
Browse files Browse the repository at this point in the history
[TASK] Some cosmetic cleanup
  • Loading branch information
robertlemke committed Nov 4, 2015
2 parents 584c5b3 + e5c47dc commit d38bd32
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
9 changes: 6 additions & 3 deletions Classes/RobertLemke/Akismet/Exception/ConnectionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
namespace RobertLemke\Akismet\Exception;

/* *
* This script belongs to the FLOW3 package "RobertLemke.Akismet". *
* This script belongs to the TYPO3 Flow package "RobertLemke.Akismet". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the MIT License. *
* *
* The TYPO3 project - inspiring people to share! *
* */

/**
Expand All @@ -11,5 +16,3 @@
class ConnectionException extends \TYPO3\Flow\Exception {

}

?>
15 changes: 11 additions & 4 deletions Classes/RobertLemke/Akismet/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@
namespace RobertLemke\Akismet;

/* *
* This script belongs to the FLOW3 package "RobertLemke.Akismet". *
* This script belongs to the TYPO3 Flow package "RobertLemke.Akismet". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the MIT License. *
* *
* The TYPO3 project - inspiring people to share! *
* */

use TYPO3\Flow\Http\Request;
use TYPO3\Flow\Http\Response;
use TYPO3\Flow\Http\Uri;

use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Object\DependencyInjection\DependencyProxy;

/**
* An Akismet service wrapper class for TYPO3 Flow
Expand Down Expand Up @@ -62,7 +67,7 @@ public function injectSettings(array $settings) {
* @return void
*/
public function initializeObject() {
if ($this->browserRequestEngine instanceof \TYPO3\Flow\Object\DependencyInjection\DependencyProxy) {
if ($this->browserRequestEngine instanceof DependencyProxy) {
$this->browserRequestEngine->_activateDependency();
}
$this->browser->setRequestEngine($this->browserRequestEngine);
Expand Down Expand Up @@ -108,10 +113,11 @@ public function isApiKeyValid() {
* @param string $authorEmailAddress The email address specified
* @param string $authorUri A URI specified linking to the author's homepage or similar
* @return boolean TRUE if the comment is considered spam, otherwise FALSE
* @throws Exception\ConnectionException
* @api
*/
public function isCommentSpam($permaLink, $content, $type, $author = '', $authorEmailAddress = '', $authorUri = '') {
if ($this->settings['apiKey'] === '') {
if ($this->settings['apiKey'] === '' || $this->settings['apiKey'] === NULL) {
$this->systemLogger->log('Could not check comment for spam because no Akismet API key was provided in the settings.', LOG_DEBUG);
return FALSE;
}
Expand Down Expand Up @@ -202,6 +208,7 @@ public function submitHam($permaLink, $content, $type, $author = '', $authorEmai
* @param array $arguments Post arguments (field => value) to send to the Askismet server
* @param boolean $useAccountSubdomain If the api key should be prepended to the host name (default case)
* @return \TYPO3\Flow\Http\Response The response from the POST request
* @throws Exception\ConnectionException
*/
protected function sendRequest($command, array $arguments, $useAccountSubdomain = TRUE) {
$arguments['key'] = $this->settings['apiKey'];
Expand Down
7 changes: 6 additions & 1 deletion Tests/Functional/ServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
namespace RobertLemke\Akismet\Tests\Functional;

/* *
* This script belongs to the FLOW3 package "RobertLemke.Akismet". *
* This script belongs to the TYPO3 Flow package "RobertLemke.Akismet". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the MIT License. *
* *
* The TYPO3 project - inspiring people to share! *
* */

use TYPO3\Flow\Http\Request;
Expand Down

0 comments on commit d38bd32

Please sign in to comment.