Skip to content

Commit

Permalink
standardize LitCalDicoesanData / LitCalNationalAndRegionalData
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRDOrazio committed May 10, 2022
1 parent 2e807ff commit ea5beac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 8 additions & 4 deletions LitCalDiocesanData.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@
include_once( 'includes/enums/ReturnType.php' );
include_once( 'includes/APICore.php' );

if( file_exists("allowedOrigins.php") ) {
include_once( 'allowedOrigins.php' );
}

$allowedOrigins = [
"https://johnromanodorazio.com",
"https://www.johnromanodorazio.com",
"https://litcal.johnromanodorazio.com",
"https://litcal-staging.johnromanodorazio.com"
];

if( defined('ALLOWED_ORIGINS') && is_array( ALLOWED_ORIGINS ) ) {
$allowedOrigins = array_merge( $allowedOrigins, ALLOWED_ORIGINS );
}

$LitCalDiocesanData = new LitCalDiocesanData();

$LitCalDiocesanData->APICore->setAllowedOrigins( $allowedOrigins );
Expand Down Expand Up @@ -47,7 +55,6 @@ private function handleGetPostRequests( array $REQUEST ) {
$this->DATA = (object)$REQUEST;
}
$this->retrieveDiocesanCalendar();

}

private function handlePutPatchDeleteRequests( string $requestMethod ) {
Expand All @@ -70,7 +77,6 @@ private function handlePutPatchDeleteRequests( string $requestMethod ) {
}

private function handleRequestedMethod() {

switch( strtoupper( $_SERVER[ "REQUEST_METHOD" ] ) ) {
case RequestMethod::GET:
$this->handleGetPostRequests( $_GET );
Expand Down Expand Up @@ -192,12 +198,10 @@ private function deleteDiocesanCalendar() {
}

public function Init() {

$this->APICore->Init();
$this->APICore->setResponseContentTypeHeader();
$this->loadIndex();
$this->handleRequestedMethod();

}

}
5 changes: 2 additions & 3 deletions LitCalNationalAndRegionalData.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
"https://johnromanodorazio.com",
"https://www.johnromanodorazio.com",
"https://litcal.johnromanodorazio.com",
"https://litcal-staging.johnromanodorazio.com",
"https://litcal.org",
"https://www.litcal.org"
"https://litcal-staging.johnromanodorazio.com"
];

if( defined('ALLOWED_ORIGINS') && is_array( ALLOWED_ORIGINS ) ) {
Expand Down Expand Up @@ -48,6 +46,7 @@ public function __construct(){
}

private function handleGetPostRequests( array $REQUEST ) {

$this->APICore->validateAcceptHeader( true );
if( $this->APICore->getRequestContentType() === 'application/json' ) {
$this->DATA = $this->APICore->retrieveRequestParamsFromJsonBody();
Expand Down

0 comments on commit ea5beac

Please sign in to comment.