easier maintainable spaceAPI config
parent
177c2c0c96
commit
8f8337776a
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"debug" : false,
|
"debug" : false,
|
||||||
"google" : {
|
"google" : {
|
||||||
"api_key" : "",
|
"api_key" : "GOOGLE_API_KEY_GOES_HERE",
|
||||||
"calendar_id" : ""
|
"calendar_id" : "GOOGLE_CALENDAR_ID_GOES_HERE"
|
||||||
}
|
},
|
||||||
|
"spaceAPI" : "URL_TO_SPACE_API_GOES_HERE"
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
class Level2 {
|
class Level2 {
|
||||||
|
|
||||||
static public function getStatus() {
|
static public function getStatus( $app ) {
|
||||||
|
|
||||||
$spaceAPI = json_decode(
|
$spaceAPI = json_decode(
|
||||||
file_get_contents( 'https://spaceapi.syn2cat.lu/status/json' ),
|
file_get_contents( $app[ 'spaceAPI' ] ),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
$event[ 'description' ]
|
$event[ 'description' ]
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( is_array( $image ) ) {
|
if ( sizeof( $image[ 0 ] ) > 0 ) {
|
||||||
if ( $image[ 0 ][ 0 ] != '' ) {
|
if ( $image[ 0 ][ 0 ] != '' ) {
|
||||||
$event[ 'image' ] = $image[ 0 ][ 0 ];
|
$event[ 'image' ] = $image[ 0 ][ 0 ];
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
$event[ 'description' ]
|
$event[ 'description' ]
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( is_array( $url ) ) {
|
if ( sizeof( $url[ 0 ] ) > 0 ) {
|
||||||
$event[ 'url' ] = $url[ 0 ][ 0 ];
|
$event[ 'url' ] = $url[ 0 ][ 0 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
'level2.twig',
|
'level2.twig',
|
||||||
array(
|
array(
|
||||||
'page' => 'home',
|
'page' => 'home',
|
||||||
'level2' => Level2::getStatus(),
|
'level2' => Level2::getStatus( $app ),
|
||||||
'events' => array_slice(
|
'events' => array_slice(
|
||||||
Level2::getEvents( $app ),
|
Level2::getEvents( $app ),
|
||||||
0,
|
0,
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
'level2.twig',
|
'level2.twig',
|
||||||
array(
|
array(
|
||||||
'page' => 'events',
|
'page' => 'events',
|
||||||
'level2' => Level2::getStatus(),
|
'level2' => Level2::getStatus( $app ),
|
||||||
'events' => array_slice(
|
'events' => array_slice(
|
||||||
Level2::getEvents( $app ),
|
Level2::getEvents( $app ),
|
||||||
0,
|
0,
|
||||||
|
|
Loading…
Reference in New Issue