mirror of
https://github.com/standardebooks/web.git
synced 2025-07-05 22:30:30 -04:00
Validate and normalize museum URLs when submitting artwork
This commit is contained in:
parent
9c27d80dd9
commit
16df5b29fe
9 changed files with 554 additions and 41 deletions
|
@ -1,6 +0,0 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class InvalidGoogleBooksUrlException extends InvalidUrlException{
|
||||
protected $message = 'Invalid Google Books URL. Google Books URLs begin with “https://www.google.com/books/edition/_/” and must be in single-page view. An example of a valid Google Books URL is “https://www.google.com/books/edition/_/mZpAAAAAYAAJ?gbpv=1&pg=PA70-IA2”.';
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class InvalidHathiTrustUrlException extends InvalidUrlException{
|
||||
protected $message = 'Invalid HathiTrust URL. HathiTrust URLs begin with “https://babel.hathitrust.org/cgi/pt”. An example of a valid HathiTrust URL is “https://babel.hathitrust.org/cgi/pt?id=hvd.32044034383265&seq=13”.';
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class InvalidInternetArchiveUrlException extends InvalidUrlException{
|
||||
protected $message = 'Invalid Internet Archive URL. Internet Archive URLs begin with “https://archive.org/details/” and must be in single-page view. An example of a valid Internet Archive URL is “https://archive.org/details/royalacademypict1902roya/page/n9/mode/1up”.';
|
||||
}
|
|
@ -2,5 +2,7 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidMuseumUrlException extends InvalidUrlException{
|
||||
protected $message = 'Invalid link to an approved museum page.';
|
||||
public function __construct(string $url, string $exampleUrl){
|
||||
$this->message = 'Invalid museum URL: <' . $url . '>. Expected a URL like: <'. $exampleUrl . '>.';
|
||||
}
|
||||
}
|
||||
|
|
8
lib/Exceptions/InvalidPageScanUrlException.php
Normal file
8
lib/Exceptions/InvalidPageScanUrlException.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class InvalidPageScanUrlException extends InvalidUrlException{
|
||||
public function __construct(string $url, string $exampleUrl){
|
||||
$this->message = 'Invalid page scan URL: <' . $url . '>. Expected a URL like: <'. $exampleUrl . '>.';
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ class InvalidUrlException extends AppException{
|
|||
|
||||
public function __construct(?string $url = null){
|
||||
if($url !== null){
|
||||
parent::__construct('Invalid URL: “' . $url . '”.');
|
||||
parent::__construct('Invalid URL: <' . $url . '>.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue