easier maintainable spaceAPI config

master
Tezza 2015-02-26 17:39:05 +01:00
parent 177c2c0c96
commit 8f8337776a
4 changed files with 12 additions and 11 deletions

View File

@ -1,7 +1,8 @@
{
"debug" : false,
"google" : {
"api_key" : "",
"calendar_id" : ""
}
"debug" : false,
"google" : {
"api_key" : "GOOGLE_API_KEY_GOES_HERE",
"calendar_id" : "GOOGLE_CALENDAR_ID_GOES_HERE"
},
"spaceAPI" : "URL_TO_SPACE_API_GOES_HERE"
}

View File

@ -6,10 +6,10 @@
class Level2 {
static public function getStatus() {
static public function getStatus( $app ) {
$spaceAPI = json_decode(
file_get_contents( 'https://spaceapi.syn2cat.lu/status/json' ),
file_get_contents( $app[ 'spaceAPI' ] ),
true
);
@ -76,7 +76,7 @@
$event[ 'description' ]
);
if ( is_array( $image ) ) {
if ( sizeof( $image[ 0 ] ) > 0 ) {
if ( $image[ 0 ][ 0 ] != '' ) {
$event[ 'image' ] = $image[ 0 ][ 0 ];
}
@ -95,7 +95,7 @@
$event[ 'description' ]
);
if ( is_array( $url ) ) {
if ( sizeof( $url[ 0 ] ) > 0 ) {
$event[ 'url' ] = $url[ 0 ][ 0 ];
}

View File

@ -17,7 +17,7 @@
'level2.twig',
array(
'page' => 'home',
'level2' => Level2::getStatus(),
'level2' => Level2::getStatus( $app ),
'events' => array_slice(
Level2::getEvents( $app ),
0,
@ -34,7 +34,7 @@
'level2.twig',
array(
'page' => 'events',
'level2' => Level2::getStatus(),
'level2' => Level2::getStatus( $app ),
'events' => array_slice(
Level2::getEvents( $app ),
0,

0
src/web/cache/.keep vendored Normal file
View File