API setting constants
This commit is contained in:
parent
8bb48da55e
commit
0b50861c75
@ -84,6 +84,11 @@ if ( ! defined( 'FICTIONEER_UPDATE_CHECK_TIMEOUT' ) ) {
|
||||
define( 'FICTIONEER_UPDATE_CHECK_TIMEOUT', 3600 );
|
||||
}
|
||||
|
||||
// Integer: Storygraph API cache TTL
|
||||
if ( ! defined( 'FICTIONEER_API_STORYGRAPH_CACHE_TTL' ) ) {
|
||||
define( 'FICTIONEER_API_STORYGRAPH_CACHE_TTL', 3600 );
|
||||
}
|
||||
|
||||
/*
|
||||
* Booleans
|
||||
*/
|
||||
@ -134,6 +139,11 @@ if ( ! defined( 'FICTIONEER_FILTER_STORY_CHAPTERS' ) ) {
|
||||
define( 'FICTIONEER_FILTER_STORY_CHAPTERS', true );
|
||||
}
|
||||
|
||||
// Integer: Storygraph API hotlink permission
|
||||
if ( ! defined( 'FICTIONEER_API_STORYGRAPH_HOTLINK' ) ) {
|
||||
define( 'FICTIONEER_API_STORYGRAPH_HOTLINK', false );
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// GLOBAL
|
||||
// =============================================================================
|
||||
|
@ -57,7 +57,7 @@ if ( ! function_exists( 'fictioneer_api_get_story_node' ) ) {
|
||||
|
||||
// Image
|
||||
if ( true ) {
|
||||
$node['images'] = ['hotlinkAllowed' => false]; // TODO
|
||||
$node['images'] = ['hotlinkAllowed' => FICTIONEER_API_STORYGRAPH_HOTLINK];
|
||||
$cover = get_the_post_thumbnail_url( $story_id, 'full' );
|
||||
$header = fictioneer_get_field( 'fictioneer_custom_header_image', $story_id );
|
||||
$header = wp_get_attachment_image_url( $header, 'full' );
|
||||
@ -160,7 +160,7 @@ if ( ! function_exists( 'fictioneer_api_request_story' ) ) {
|
||||
$graph['cached'] = false;
|
||||
|
||||
// Cache request
|
||||
set_transient( 'fictioneer_api_story_' . $story_id, $graph, 3600 );
|
||||
set_transient( 'fictioneer_api_story_' . $story_id, $graph, FICTIONEER_API_STORYGRAPH_CACHE_TTL );
|
||||
|
||||
// Response
|
||||
return rest_ensure_response( $graph );
|
||||
|
Loading…
x
Reference in New Issue
Block a user