mirror of
https://github.com/standardebooks/web.git
synced 2025-07-05 22:30:30 -04:00
Normalize URLs when submitting artwork to database
This commit is contained in:
parent
f9c873003e
commit
e17a4bcc65
10 changed files with 182 additions and 29 deletions
|
@ -1,6 +1,6 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class InvalidArtworkPageUrlException extends AppException{
|
||||
class InvalidArtworkPageUrlException extends InvalidUrlException{
|
||||
protected $message = 'Invalid link to page with artwork.';
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class InvalidCopyrightPageUrlException extends AppException{
|
||||
class InvalidCopyrightPageUrlException extends InvalidUrlException{
|
||||
protected $message = 'Invalid link to page with copyright details.';
|
||||
}
|
||||
|
|
6
lib/Exceptions/InvalidGoogleBooksUrlException.php
Normal file
6
lib/Exceptions/InvalidGoogleBooksUrlException.php
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?
|
||||
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”.';
|
||||
}
|
6
lib/Exceptions/InvalidHathiTrustUrlException.php
Normal file
6
lib/Exceptions/InvalidHathiTrustUrlException.php
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?
|
||||
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”.';
|
||||
}
|
6
lib/Exceptions/InvalidInternetArchiveUrlException.php
Normal file
6
lib/Exceptions/InvalidInternetArchiveUrlException.php
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?
|
||||
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”.';
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class InvalidMuseumUrlException extends AppException{
|
||||
class InvalidMuseumUrlException extends InvalidUrlException{
|
||||
protected $message = 'Invalid link to an approved museum page.';
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class InvalidPublicationYearPageUrlException extends AppException{
|
||||
class InvalidPublicationYearPageUrlException extends InvalidUrlException{
|
||||
protected $message = 'Invalid link to page with year of publication.';
|
||||
}
|
||||
|
|
12
lib/Exceptions/InvalidUrlException.php
Normal file
12
lib/Exceptions/InvalidUrlException.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class InvalidUrlException extends AppException{
|
||||
protected $message = 'Invalid URL.';
|
||||
|
||||
public function __construct(?string $url = null){
|
||||
if($url !== null){
|
||||
parent::__construct('Invalid URL: “' . $url . '”.');
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue