Constant to turn off API images

This commit is contained in:
Tetrakern 2023-02-18 01:01:10 +01:00
parent f4ebe61b38
commit f48ca2bf3e
2 changed files with 16 additions and 3 deletions

View File

@ -149,7 +149,12 @@ if ( ! defined( 'FICTIONEER_COLLAPSE_COMMENT_FORM' ) ) {
define( 'FICTIONEER_COLLAPSE_COMMENT_FORM', true );
}
// Integer: Storygraph API hotlink permission
// Boolean: Add images to Storygraph API
if ( ! defined( 'FICTIONEER_API_STORYGRAPH_IMAGES' ) ) {
define( 'FICTIONEER_API_STORYGRAPH_IMAGES', true );
}
// Boolean: Storygraph API hotlink permission
if ( ! defined( 'FICTIONEER_API_STORYGRAPH_HOTLINK' ) ) {
define( 'FICTIONEER_API_STORYGRAPH_HOTLINK', false );
}

View File

@ -74,8 +74,11 @@ if ( ! function_exists( 'fictioneer_api_get_story_node' ) ) {
$node['protected'] = post_password_required( $story_id );
// Image
if ( true ) {
$node['images'] = ['hotlinkAllowed' => FICTIONEER_API_STORYGRAPH_HOTLINK];
if ( FICTIONEER_API_STORYGRAPH_IMAGES ) {
$node['images'] = array(
'hotlinkAllowed' => FICTIONEER_API_STORYGRAPH_HOTLINK,
'disabled' => false
);
$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' );
@ -91,6 +94,11 @@ if ( ! function_exists( 'fictioneer_api_get_story_node' ) ) {
if ( empty( $node['images'] ) ) {
unset( $node['images'] );
}
} else {
$node['images'] = array(
'hotlinkAllowed' => false,
'disabled' => true
);
}
// Taxonomies