Skip to content

Commit

Permalink
SilverStripe 4 and Namespacing
Browse files Browse the repository at this point in the history
  • Loading branch information
Firesphere authored and robbieaverill committed Aug 28, 2017
1 parent 5f8d2af commit b757c3d
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 8 deletions.
5 changes: 4 additions & 1 deletion _config.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
*
* @package spamprotection
*/
Deprecation::notification_version('1.1', 'spamprotection');

use SilverStripe\Dev\Deprecation;

Deprecation::notification_version('3.0', 'spamprotection');
4 changes: 2 additions & 2 deletions _config/spamprotection.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: spamprotection
---
Form:
SilverStripe\Forms\Form:
extensions:
- FormSpamProtectionExtension
- SilverStripe\Spamprotection\FormSpamProtectionExtension
1 change: 1 addition & 0 deletions code/EditableSpamProtectionField.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
namespace SilverStripe\Spamprotection;

/**
* Editable Spam Protecter Field. Used with the User Defined Forms module (if
Expand Down
7 changes: 5 additions & 2 deletions code/SpamProtectorManager.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php
namespace SilverStripe\Spamprotection;

use SilverStripe\Dev\Deprecation;

/**
* @package spamprotection
Expand All @@ -18,7 +21,7 @@ public static function set_spam_protector($protector)
'Use the new config system. FormSpamProtectorExtension.default_spam_protector'
);

self::$spam_protector = $protector;
static::$spam_protector = $protector;
}

public static function get_spam_protector()
Expand All @@ -29,7 +32,7 @@ public static function get_spam_protector()
'Use the new config system. FormSpamProtectorExtension.default_spam_protector'
);

return self::$spam_protector;
return static::$spam_protector;
}

public static function update_form($form, $before = null, $fieldsToSpamServiceMapping = array(), $title = null, $rightTitle = null)
Expand Down
4 changes: 4 additions & 0 deletions code/extensions/CommentSpamProtection.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

namespace SilverStripe\Spamprotection;

use SilverStripe\Core\Extension;

/**
* Apply the spam protection to the comments module if it is installed.
*
Expand Down
6 changes: 6 additions & 0 deletions code/extensions/FormSpamProtectionExtension.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<?php
namespace SilverStripe\Spamprotection;

use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Extension;
use SilverStripe\Core\Injector\Injector;

/**
* An extension to the {@link Form} class which provides the method
Expand Down Expand Up @@ -76,6 +81,7 @@ public static function get_protector($options = null)
* Activates the spam protection module.
*
* @param array $options
* @return Object
*/
public function enableSpamProtection($options = array())
{
Expand Down
3 changes: 3 additions & 0 deletions code/interfaces/SpamProtector.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php
namespace SilverStripe\Spamprotection;

use SilverStripe\Forms\FormField;

/**
* SpamProtector base interface.
Expand Down
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@
"email": "[email protected]"
}],
"require": {
"silverstripe/framework": "~3.1"
"silverstripe/framework": "^4@dev"
},
"require-dev": {
"phpunit/PHPUnit": "~3.7@stable"
"phpunit/phpunit": "^5.7",
"squizlabs/php_codesniffer": "^3.0"
},
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"license": "BSD-3-Clause"
"license": "BSD-3-Clause",
"minimum-stability": "dev",
"prefer-stable": true
}

0 comments on commit b757c3d

Please sign in to comment.