rebase from live enviornment

This commit is contained in:
Rachit Bhargava
2024-01-09 22:14:20 -05:00
parent ff0b49a046
commit 3a22fcaa4a
15968 changed files with 2344674 additions and 45234 deletions

View File

@@ -76,19 +76,19 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Event' ) ) {
if ( $offline ) {
if ( ! empty( $data['location'] ) ) {
$schema['location']['@type'] = 'Place';
$schema['location']['name'] = wp_strip_all_tags( (string)$data['location'] );
$schema['location']['name'] = wp_strip_all_tags( (string) $data['location'] );
}
$schema['location']['@type'] = 'Place';
$schema['location']['address']['@type'] = 'PostalAddress';
$schema['location']['address']['streetAddress'] = ! empty( $data['location-street'] ) ? wp_strip_all_tags( (string)$data['location-street'] ) : NULL;
$schema['location']['address']['addressLocality'] = ! empty( $data['location-locality'] ) ? wp_strip_all_tags( (string)$data['location-locality'] ) : NULL;
$schema['location']['address']['postalCode'] = ! empty( $data['location-postal'] ) ? wp_strip_all_tags( (string)$data['location-postal'] ) : NULL;
$schema['location']['address']['addressRegion'] = ! empty( $data['location-region'] ) ? wp_strip_all_tags( (string)$data['location-region'] ) : NULL;
$schema['location']['@type'] = 'Place';
$schema['location']['address']['@type'] = 'PostalAddress';
$schema['location']['address']['streetAddress'] = ! empty( $data['location-street'] ) ? wp_strip_all_tags( (string) $data['location-street'] ) : null;
$schema['location']['address']['addressLocality'] = ! empty( $data['location-locality'] ) ? wp_strip_all_tags( (string) $data['location-locality'] ) : null;
$schema['location']['address']['postalCode'] = ! empty( $data['location-postal'] ) ? wp_strip_all_tags( (string) $data['location-postal'] ) : null;
$schema['location']['address']['addressRegion'] = ! empty( $data['location-region'] ) ? wp_strip_all_tags( (string) $data['location-region'] ) : null;
if ( ! empty( $data['location-country'] ) ) {
$schema['location']['address']['addressCountry']['@type'] = 'Country';
$schema['location']['address']['addressCountry']['name'] = wp_strip_all_tags( (string)$data['location-country'] );
$schema['location']['address']['addressCountry']['name'] = wp_strip_all_tags( (string) $data['location-country'] );
}
} else {
$schema['location']['@type'] = 'VirtualLocation';
@@ -106,12 +106,12 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Event' ) ) {
*/
public static function prepare_offer( $schema, $data ) {
$schema['offers']['@type'] = 'Offer';
$schema['offers']['price'] = '0';
$schema['offers']['price'] = ! empty( $data['price'] ) ? wp_strip_all_tags( (string)$data['price'] ) : NULL;
$schema['offers']['availability'] = ! empty( $data['avail'] ) ? wp_strip_all_tags( (string)$data['avail'] ) : NULL;
$schema['offers']['priceCurrency'] = ! empty( $data['currency'] ) ? wp_strip_all_tags( (string)$data['currency'] ) : NULL;
$schema['offers']['validFrom'] = ! empty( $data['valid-from'] ) ? wp_strip_all_tags( (string)$data['valid-from'] ) : NULL;
$schema['offers']['@type'] = 'Offer';
$schema['offers']['price'] = '0';
$schema['offers']['price'] = ! empty( $data['price'] ) ? wp_strip_all_tags( (string) $data['price'] ) : null;
$schema['offers']['availability'] = ! empty( $data['avail'] ) ? wp_strip_all_tags( (string) $data['avail'] ) : null;
$schema['offers']['priceCurrency'] = ! empty( $data['currency'] ) ? wp_strip_all_tags( (string) $data['currency'] ) : null;
$schema['offers']['validFrom'] = ! empty( $data['valid-from'] ) ? wp_strip_all_tags( (string) $data['valid-from'] ) : null;
if ( isset( $data['ticket-buy-url'] ) && ! empty( $data['ticket-buy-url'] ) ) {
$schema['offers']['url'] = esc_url( $data['ticket-buy-url'] );
}
@@ -131,11 +131,11 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Event' ) ) {
if ( ! empty( $data['performer'] ) ) {
$schema['performer']['@type'] = 'Person';
$schema['performer']['name'] = wp_strip_all_tags( (string)$data['performer'] );
$schema['performer']['name'] = wp_strip_all_tags( (string) $data['performer'] );
}
$schema['organizer']['@type'] = 'Organization';
$schema['organizer']['name'] = ! empty( $data['event-organizer-name'] ) ? wp_strip_all_tags( (string)$data['event-organizer-name'] ) : NULL;
$schema['organizer']['url'] = ! empty( $data['event-organizer-url'] ) ? wp_strip_all_tags( (string)$data['event-organizer-url'] ) : NULL;
$schema['organizer']['name'] = ! empty( $data['event-organizer-name'] ) ? wp_strip_all_tags( (string) $data['event-organizer-name'] ) : null;
$schema['organizer']['url'] = ! empty( $data['event-organizer-url'] ) ? wp_strip_all_tags( (string) $data['event-organizer-url'] ) : null;
return $schema;
}
@@ -150,11 +150,23 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Event' ) ) {
public static function prepare_dates( $schema, $data ) {
$start_date = gmdate( DATE_ISO8601, strtotime( $data['start-date'] ) );
$schema['startDate'] = ! empty( $start_date ) ? wp_strip_all_tags( (string)$start_date ) : NULL;
$end_date = $data['end-date'];
if ( 'OnlineEventAttendanceMode' === $data['event-attendance-mode'] && isset( $data['timezone'] ) && 'none' !== $data['timezone'] && '' !== $data['timezone'] ) {
$timezone = new DateTimeZone( $data['timezone'] );
$date_time = new DateTime( 'now', $timezone );
$offset = timezone_offset_get( $timezone, $date_time );
$timezone_offset = preg_replace( '/^00:/', '', gmdate( 'h:i', $offset ) );
$start_date = substr( $start_date, 0, -4 );
$end_date = substr( $end_date, 0, -4 );
$start_date .= $timezone_offset;
$end_date .= $timezone_offset;
}
$schema['endDate'] = ! empty( $data['end-date'] ) ? wp_strip_all_tags( (string)$data['end-date'] ) : NULL;
$schema['startDate'] = ! empty( $start_date ) ? wp_strip_all_tags( $start_date ) : null;
$schema['previousStartDate'] = 'EventRescheduled' === $data['event-status'] ? wp_strip_all_tags( (string)$data['previous-date'] ) : NULL;
$schema['endDate'] = ! empty( $end_date ) ? wp_strip_all_tags( $end_date ) : null;
$schema['previousStartDate'] = 'EventRescheduled' === $data['event-status'] ? wp_strip_all_tags( (string) $data['previous-date'] ) : null;
return $schema;
}
@@ -168,7 +180,7 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Event' ) ) {
*/
public static function prepare_attendence_mode( $schema, $data ) {
$schema['eventAttendanceMode'] = isset( $data['schema-type'] ) && ! empty( $data['event-attendance-mode'] ) ? 'https://schema.org/' . wp_strip_all_tags( (string)$data['event-attendance-mode'] ) : NULL;
$schema['eventAttendanceMode'] = isset( $data['schema-type'] ) && ! empty( $data['event-attendance-mode'] ) ? 'https://schema.org/' . wp_strip_all_tags( (string) $data['event-attendance-mode'] ) : null;
return $schema;
}
@@ -182,15 +194,15 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Event' ) ) {
*/
public static function prepare_basics( $schema, $data ) {
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
$schema['eventStatus'] = ! empty( $data['event-status'] ) ? 'https://schema.org/' . wp_strip_all_tags( (string)$data['event-status'] ) : NULL;
$schema['eventStatus'] = ! empty( $data['event-status'] ) ? 'https://schema.org/' . wp_strip_all_tags( (string) $data['event-status'] ) : null;
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
}
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string)$data['description'] ) : NULL;
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
return $schema;
}