rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -28,16 +28,14 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Book' ) ) {
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'Book';
if ( isset( $data['name'] ) && ! empty( $data['name'] ) ) {
$schema['name'] = wp_strip_all_tags( $data['name'] );
}
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
}
if ( isset( $data['author'] ) && ! empty( $data['author'] ) ) {
if ( ! empty( $data['author'] ) ) {
$schema['author']['@type'] = 'Person';
$schema['author']['name'] = wp_strip_all_tags( $data['author'] );
$schema['author']['name'] = wp_strip_all_tags( (string)$data['author'] );
}
if ( isset( $data['url'] ) && ! empty( $data['url'] ) ) {
@@ -52,17 +50,11 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Book' ) ) {
foreach ( $data['work-example'] as $key => $value ) {
$schema['workExample'][ $key ]['@type'] = 'Book';
if ( isset( $value['serial-number'] ) && ! empty( $value['serial-number'] ) ) {
$schema['workExample'][ $key ]['isbn'] = wp_strip_all_tags( $value['serial-number'] );
}
$schema['workExample'][ $key ]['isbn'] = ! empty( $value['serial-number'] ) ? wp_strip_all_tags( (string)$value['serial-number'] ) : NULL;
if ( isset( $value['book-edition'] ) && ! empty( $value['book-edition'] ) ) {
$schema['workExample'][ $key ]['bookEdition'] = wp_strip_all_tags( $value['book-edition'] );
}
$schema['workExample'][ $key ]['bookEdition'] = ! empty( $value['book-edition'] ) ? wp_strip_all_tags( (string)$value['book-edition'] ) : NULL;
if ( isset( $value['book-format'] ) && ! empty( $value['book-format'] ) ) {
$schema['workExample'][ $key ]['bookFormat'] = 'https://schema.org/' . wp_strip_all_tags( $value['book-format'] );
}
$schema['workExample'][ $key ]['bookFormat'] = ! empty( $value['book-format'] ) ? 'https://schema.org/' . wp_strip_all_tags( (string)$value['book-format'] ) : NULL;
$schema['workExample'][ $key ]['potentialAction']['@type'] = 'ReadAction';
$schema['workExample'][ $key ]['potentialAction']['target']['@type'] = 'EntryPoint';
@@ -73,20 +65,10 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Book' ) ) {
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['@type'] = 'Offer';
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['price'] = '0';
if ( isset( $value['price'] ) && ! empty( $value['price'] ) ) {
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['price'] = wp_strip_all_tags( $value['price'] );
}
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['price'] = ! empty( $value['price'] ) ? wp_strip_all_tags( (string)$value['price'] ) : NULL;
if ( ( isset( $value['currency'] ) && ! empty( $value['currency'] ) ) ||
( isset( $value['avail'] ) && ! empty( $value['avail'] ) ) ) {
if ( isset( $value['currency'] ) && ! empty( $value['currency'] ) ) {
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['priceCurrency'] = wp_strip_all_tags( $value['currency'] );
}
if ( isset( $value['avail'] ) && ! empty( $value['avail'] ) ) {
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['availability'] = wp_strip_all_tags( $value['avail'] );
}
}
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['priceCurrency'] = ! empty( $value['currency'] ) ? wp_strip_all_tags( (string)$value['currency'] ) : NULL;
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['availability'] = ! empty( $value['avail'] ) ? wp_strip_all_tags( (string)$value['avail'] ) : NULL;
if ( isset( $value['country'] ) && ! empty( $value['country'] ) ) {
$expects_acceptance = explode( ',', $value['country'] );