section_1 ) ? stripslashes( $json->section_1 ) : ''; $section_2 = !empty( $json->section_2 ) ? stripslashes( $json->section_2 ) : ''; $section_3 = !empty( $json->section_3 ) ? stripslashes( $json->section_3 ) : ''; $ppwp_fss_expire = !empty( $json->ppwp_fss_expire ) ? (int) $json->ppwp_fss_expire : 1; /* set the transient by api response */ set_transient( 'ppwp_sidebar_content', $response['body'], DAY_IN_SECONDS * $ppwp_fss_expire ); if( !empty( $section_1 ) ){ echo '
'.$section_1.'
'; } if( !empty( $section_2 ) ){ echo '
'.$section_2.'
'; } if( !empty( $section_3 ) ){ echo '
'.$section_3.'
'; } } } else { /* if transient is not empty */ $response = get_transient( 'ppwp_sidebar_content' ); $json = json_decode( $response ); if ( !empty( $json ) ) { $section_1 = !empty( $json->section_1 ) ? stripslashes( $json->section_1 ) : ''; $section_2 = !empty( $json->section_2 ) ? stripslashes( $json->section_2 ) : ''; $section_3 = !empty( $json->section_3 ) ? stripslashes( $json->section_3 ) : ''; if( !empty( $section_1 ) ){ echo '
'.$section_1.'
'; } if( !empty( $section_2 ) ){ echo '
'.$section_2.'
'; } if( !empty( $section_3 ) ){ echo '
'.$section_3.'
'; } } } ?>