Skip to content

Commit

Permalink
API: Remove TextParser and BBCodeParser
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Minnee committed Sep 13, 2016
1 parent 6025090 commit aecf526
Show file tree
Hide file tree
Showing 23 changed files with 3 additions and 2,302 deletions.
19 changes: 0 additions & 19 deletions ORM/FieldType/DBText.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use SilverStripe\Forms\NullableField;
use SilverStripe\Forms\TextField;
use SilverStripe\ORM\DB;
use SilverStripe\View\Parsers\TextParser;
use InvalidArgumentException;

/**
Expand Down Expand Up @@ -233,24 +232,6 @@ public function ContextSummary(
return $summary;
}

/**
* Allows a sub-class of TextParser to be rendered.
*
* @see TextParser for implementation details.
* @param string $parser Class name of parser (Must extend {@see TextParser})
* @return DBField Parsed value in the appropriate type
*/
public function Parse($parser) {
$reflection = new \ReflectionClass($parser);
if($reflection->isAbstract() || !$reflection->isSubclassOf('SilverStripe\\View\\Parsers\\TextParser')) {
throw new InvalidArgumentException("Invalid parser {$parser}");
}

/** @var TextParser $obj */
$obj = Injector::inst()->createWithArgs($parser, [$this->forTemplate()]);
return $obj->parse();
}

public function scaffoldFormField($title = null, $params = null) {
if(!$this->nullifyEmpty) {
// Allow the user to select if it's null instead of automatically assuming empty string is
Expand Down
24 changes: 0 additions & 24 deletions View/Parsers/BBCodeParser.ini

This file was deleted.

152 changes: 0 additions & 152 deletions View/Parsers/BBCodeParser.php

This file was deleted.

66 changes: 0 additions & 66 deletions View/Parsers/TextParser.php

This file was deleted.

6 changes: 1 addition & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,10 @@
"SilverStripe\\Security\\": "Security/",
"SilverStripe\\View\\": "View/"
},
"psr-0": {
"HTML_": "thirdparty/HTML_BBCodeParser2"
},
"files": ["Core/Constants.php"],
"classmap": ["tests/behat/features/bootstrap"]
},
"include-path": [
"thirdparty/",
"thirdparty/HTML_BBCodeParser2/"
"thirdparty/"
]
}
2 changes: 2 additions & 0 deletions docs/en/04_Changelogs/4.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,8 @@ specific functions.
* `RestfulService` has been removed. Use Guzzle instead. See Upgrading notes.
* Our self-maintained `Oembed` implementation has been removed, in favour of introducing
[oscarotero/Embed](https://github.com/oscarotero/Embed) as a dependency.
* Removed TextParser and BBCodeParser. These are available in an archived module,
[silverstripe-archive/bbcodeparser](https://github.com/silverstripe-archive/silverstripe-bbcodeparser)

#### <a name="overview-general-deprecated"></a>General and Core Deprecated API

Expand Down
15 changes: 0 additions & 15 deletions tests/model/DBHTMLTextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,21 +411,6 @@ public function testShortcodesProcessed()
);
}

public function testParse() {
// Test parse
/** @var DBHTMLText $obj */
$obj = DBField::create_field(
'HTMLText',
'<p>[b]Some content[/b] [test_shortcode] with shortcode</p>'
);

// BBCode strips HTML and applies own formatting
$this->assertEquals(
'<strong>Some content</strong> shortcode content with shortcode',
$obj->Parse('SilverStripe\\View\\Parsers\\BBCodeParser')->forTemplate()
);
}

function testExists() {
$h = new DBHTMLText();
$h->setValue("");
Expand Down
4 changes: 0 additions & 4 deletions thirdparty/HTML_BBCodeParser2/.gitignore

This file was deleted.

Loading

0 comments on commit aecf526

Please sign in to comment.