Plugin Updates

This commit is contained in:
Tony Volpe
2024-04-02 20:23:21 +00:00
parent 96800520e8
commit 94170ec2c4
1514 changed files with 133309 additions and 105985 deletions

View File

@@ -34,8 +34,16 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Course' ) ) {
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
$schema['offers']['@type'] = 'Offer';
$schema['offers']['category'] = ! empty( $data['offer-category'] ) ? wp_strip_all_tags( (string) $data['offer-category'] ) : null;
if (isset($data['offers']) && !empty($data['offers'])) {
foreach ($data['offers'] as $offer_key => $offer_value) {
if (!empty($offer_value['category']) || !empty($offer_value['priceCurrency']) || !empty($offer_value['price'])) {
$schema['offers'][$offer_key]['@type'] = 'Offer';
$schema['offers'][$offer_key]['category'] = !empty($offer_value['offer-category']) ? wp_strip_all_tags((string)$offer_value['offer-category']) : null;
$schema['offers'][$offer_key]['priceCurrency'] = !empty($offer_value['priceCurrency']) ? wp_strip_all_tags((string)$offer_value['priceCurrency']) : null;
$schema['offers'][$offer_key]['price'] = !empty($offer_value['price']) ? wp_strip_all_tags((string)$offer_value['price']) : null;
}
}
}
if ( isset( $data['course-instance'] ) && ! empty( $data['course-instance'] ) ) {

View File

@@ -94,12 +94,16 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Person' ) ) {
$schema ['ContactPoint']['email'] = ! empty( $contact_type['email'] ) ? wp_strip_all_tags( (string) $contact_type['email'] ) : null;
if ( isset( $contact_type['areaServed'] ) && ! empty( $contact_type['areaServed'] ) ) {
$language = explode( ',', $contact_type['areaServed'] );
foreach ( $language as $key => $value ) {
$schema ['ContactPoint']['areaServed'][ $key ] = wp_strip_all_tags( (string) $value );
if ( is_array( $language )) {
foreach ( $language as $key => $value ) {
$schema ['ContactPoint']['areaServed'][ $key ] = wp_strip_all_tags( (string) $value );
}
}
}
foreach ( $contact_point_type as $key => $value ) {
$schema ['ContactPoint']['contactOption'][ $key ] = wp_strip_all_tags( (string) $value );
if (is_array($contact_point_type)) {
foreach ( $contact_point_type as $key => $value ) {
$schema ['ContactPoint']['contactOption'][ $key ] = wp_strip_all_tags( (string) $value );
}
}
$schema ['ContactPoint']['availableLanguage'] = ! empty( $contact_type['availableLanguage'] ) ? wp_strip_all_tags( (string) $contact_type['availableLanguage'] ) : null;
}

View File

@@ -13,8 +13,9 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Recipe' ) ) {
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_Recipe {
class BSF_AIOSRS_Pro_Schema_Recipe {
/**
* Render Schema.
*
@@ -22,7 +23,21 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Recipe' ) ) {
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
// Get timezone string from WordPress settings.
$timezone_string = get_option( 'timezone_string' );
// Check if the timezone string is not empty and is valid before setting it.
if ( ! empty( $timezone_string ) && in_array( $timezone_string, timezone_identifiers_list() ) ) {
// WordPress calculates offsets from UTC.
// phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set
date_default_timezone_set( $timezone_string );
} else {
// If the timezone string is empty or invalid, set a fallback timezone.
date_default_timezone_set( 'UTC' );
}
$schema = array();
$schema['@context'] = 'https://schema.org';
@@ -33,6 +48,7 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Recipe' ) ) {
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
}
if ( isset( $data['reviewer-type'] ) && ! empty( $data['reviewer-type'] ) ) {
$schema['author']['@type'] = wp_strip_all_tags( (string) $data['reviewer-type'] );
} else {
@@ -107,18 +123,26 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Recipe' ) ) {
if ( isset( $value['recipe-video-embed-url'] ) && ! empty( $value['recipe-video-embed-url'] ) ) {
$schema['video'][ $key ]['embedUrl'] = esc_url( $value['recipe-video-embed-url'] );
}
$schema['video'][ $key ]['duration'] = ! empty( $value['recipe-video-duration'] ) ? wp_strip_all_tags( (string) $value['recipe-video-duration'] ) : null;
$schema['video'][ $key ]['uploadDate'] = ! empty( $value['recipe-video-upload-date'] ) ? wp_strip_all_tags( (string) $value['recipe-video-upload-date'] ) : null;
$schema['video'][ $key ]['interactionCount'] = ! empty( $value['recipe-video-interaction-count'] ) ? wp_strip_all_tags( (string) $value['recipe-video-interaction-count'] ) : null;
$schema['video'][ $key ]['duration'] = ! empty( $value['recipe-video-duration'] ) ? wp_strip_all_tags( (string) $value['recipe-video-duration'] ) : null;
// Convert uploadDate to DateTime object and set the timezone.
$upload_date = new DateTime( $value['recipe-video-upload-date'] );
$upload_date->setTimezone( new DateTimeZone( $timezone_string ?: 'UTC' ) );
$schema['video'][ $key ]['uploadDate'] = $upload_date->format( 'c' );
// Use DateTime to handle timezone for 'expires'
if ( isset( $value['recipe-video-expires-date'] ) && ! empty( $value['recipe-video-expires-date'] ) && is_string( $value['recipe-video-expires-date'] ) ) {
$schema['video'][ $key ]['expires'] = wp_strip_all_tags( $value['recipe-video-expires-date'] );
$expires_date = new DateTime( $value['recipe-video-expires-date'] );
$expires_date->setTimezone( new DateTimeZone( $timezone_string ?: 'UTC' ) );
$schema['video'][ $key ]['expires'] = $expires_date->format( 'c' );
}
$schema['video'][ $key ]['interactionCount'] = ! empty( $value['recipe-video-interaction-count'] ) ? wp_strip_all_tags( (string) $value['recipe-video-interaction-count'] ) : null;
}
}
}
return apply_filters( 'wp_schema_pro_schema_recipe', $schema, $data, $post );
}
}
}

View File

@@ -66,13 +66,18 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Video_Object' ) ) {
$schema['interactionStatistic']['userInteractionCount'] = wp_strip_all_tags( (string) $data['interaction-count'] );
}
if ( isset( $data['thumbnail-url'] ) && ! empty( $data['thumbnail-url'] ) ) {
$schema['thumbnailUrl'] = $data['thumbnail-url'];
}
if ( isset( $data['clip'] ) && ! empty( $data['clip'] ) ) {
foreach ( $data['clip'] as $key => $value ) {
$schema['hasPart'][ $key ]['@type'] = 'Clip';
$schema['hasPart'][ $key ]['name'] = wp_strip_all_tags( (string) $value['clip-name'] );
$schema['hasPart'][ $key ]['startOffset'] = wp_strip_all_tags( (string) $value['clip-start-offset'] );
$schema['hasPart'][ $key ]['endOffset'] = wp_strip_all_tags( (string) $value['clip-end-offset'] );
$schema['hasPart'][ $key ]['url'] = esc_url( $value['clip-url'] );
$schema['hasPart'][$key]['@type'] = 'Clip';
$schema['hasPart'][$key]['name'] = wp_strip_all_tags( (string) $value['clip-name'] );
$schema['hasPart'][$key]['startOffset'] = wp_strip_all_tags( (string) $value['clip-start-offset'] );
$schema['hasPart'][$key]['endOffset'] = wp_strip_all_tags( (string) $value['clip-end-offset'] );
$schema['hasPart'][$key]['url'] = esc_url( $value['clip-url'] );
}
}
@@ -82,8 +87,20 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Video_Object' ) ) {
$schema['potentialAction']['startOffset-input'] = 'required name=seek_to_second_number';
}
if ( isset( $data['regions-allowed'] ) && ! empty( $data['regions-allowed'] ) ) {
$schema['regionsAllowed'] = wp_strip_all_tags( (string) $data['regions-allowed'] );
}
if ( isset( $data['is-live-broadcast'] ) && $data['is-live-broadcast'] ) {
$schema['publication']['@type'] = 'BroadcastEvent';
$schema['publication']['isLiveBroadcast'] = true;
$schema['publication']['startDate'] = ! empty( $data['start-date'] ) ? wp_strip_all_tags( (string) $data['start-date'] ) : null;
$schema['publication']['endDate'] = ! empty( $data['end-date'] ) ? wp_strip_all_tags( (string) $data['end-date'] ) : null;
}
return apply_filters( 'wp_schema_pro_schema_video_object', $schema, $data, $post );
}
}
}

View File

@@ -90,14 +90,14 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Organization' ) ) {
}
foreach ( $social_profiles as $type => $social_link ) {
if ( 'other' === $type ) {
if ( 'other' === $type && is_array( $social_link ) ) {
foreach ( $social_link as $dynamic_social_link ) {
if ( ! empty( $dynamic_social_link ) ) {
$schema['sameAs'][] = $dynamic_social_link;
}
}
}
if ( ! empty( $social_link ) && ( ! is_array( $social_link ) ) ) {
if ( ! empty( $social_link ) && ! is_array( $social_link ) ) {
$schema['sameAs'][] = $social_link;
}
@@ -108,3 +108,4 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Organization' ) ) {
}
}

View File

@@ -50,16 +50,19 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Person' ) ) {
$schema ['ContactPoint']['url'] = $contact_type['contact-page-id'];
}
}
foreach ( $social_profiles as $type => $social_link ) {
if ( 'other' === $type ) {
foreach ( $social_link as $dynamic_social_link ) {
if ( ! empty( $dynamic_social_link ) ) {
$schema['sameAs'][] = $dynamic_social_link;
if ( is_array( $social_profiles ) ) {
foreach ( $social_profiles as $type => $social_link ) {
if ( 'other' === $type && is_array( $social_link ) ) {
foreach ( $social_link as $dynamic_social_link ) {
if ( ! empty( $dynamic_social_link ) ) {
$schema['sameAs'][] = $dynamic_social_link;
}
}
} else {
if ( ! empty( $social_link ) && ( ! is_array( $social_link ) ) ) {
$schema['sameAs'][] = $social_link;
}
}
} else {
if ( ! empty( $social_link ) && ( ! is_array( $social_link ) ) ) {
$schema['sameAs'][] = $social_link;
}
}
}