Skip to content

Commit

Permalink
Add mewebstudio/purifier package
Browse files Browse the repository at this point in the history
  • Loading branch information
ThorntonMatthewD committed Dec 13, 2023
1 parent 5aa6e75 commit aa9605c
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use HackGreenville\EventImporter\Data\EventData;
use HackGreenville\EventImporter\Data\VenueData;
use Illuminate\Support\Collection;
use Mews\Purifier\Facades\Purifier;

abstract class AbstractEventHandler
{
Expand Down Expand Up @@ -36,4 +37,10 @@ public function getPaginatedData(int $page): array
$this->page_count,
];
}

/** @return string */
public function sanitize_description(string $description_text): string
{
return Purifier::clean($description_text);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected function mapIntoEventData(array $data): EventData
'service_id' => $data['id'],

'name' => $data['name']['text'],
'description' => $data['description']['text'],
'description' => $this->sanitize_description($data['description']['text']),
'url' => $data['url'],
'starts_at' => Carbon::parse($data['start']['local']),
// Yes "canceled" is misspelled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function mapIntoEventData(array $data): EventData
return EventData::from([
'id' => $data['id'],
'name' => $data['name'],
'description' => $data['description'],
'description' => $this->sanitize_description($data['description']),
'url' => $data['link'],
'starts_at' => Carbon::createFromTimestampMs($data['time']),
'event_type' => match ($data['eventType']) {
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"laravel/ui": "v4.2.2",
"laravelcollective/html": "^6.3",
"livewire/livewire": "^2.12",
"mews/purifier": "^3.4",
"scyllaly/hcaptcha": "^4.4",
"spatie/laravel-data": "*",
"spatie/laravel-google-calendar": "^3.0"
Expand Down
143 changes: 141 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit aa9605c

Please sign in to comment.