plugin updates

This commit is contained in:
Tony Volpe
2024-06-17 15:33:26 -04:00
parent 3751a5a1a6
commit e4e274a9a7
2674 changed files with 0 additions and 507851 deletions

View File

@@ -1,89 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Article' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_Article {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
$general_settings = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-general-settings'];
$schema['@context'] = 'https://schema.org';
if ( isset( $data['schema-type'] ) && ! empty( $data['schema-type'] ) ) {
$schema['@type'] = $data['schema-type'];
}
if ( isset( $data['main-entity'] ) && ! empty( $data['main-entity'] ) ) {
$schema['mainEntityOfPage']['@type'] = 'WebPage';
$schema['mainEntityOfPage']['@id'] = esc_url( $data['main-entity'] );
}
$schema['headline'] = ! 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'] );
}
$schema['datePublished'] = ! empty( $data['published-date'] ) ? wp_strip_all_tags( (string) $data['published-date'] ) : null;
$schema['dateModified'] = ! empty( $data['modified-date'] ) ? wp_strip_all_tags( (string) $data['modified-date'] ) : null;
if ( ! empty( $data['author'] ) ) {
$schema['author']['@type'] = 'Person';
$schema['author']['name'] = wp_strip_all_tags( (string) $data['author'] );
$schema['author']['url'] = ! empty( $data['author-url'] ) ? wp_strip_all_tags( (string) $data['author-url'] ) : null;
}
if ( ! empty( $data['orgnization-name'] ) ) {
$schema['publisher']['@type'] = 'Organization';
$schema['publisher']['name'] = wp_strip_all_tags( (string) $data['orgnization-name'] );
}
if ( isset( $data['site-logo'] ) && ! empty( $data['site-logo'] ) ) {
$schema['publisher']['@type'] = 'Organization';
$schema['publisher']['logo'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['site-logo'], 'ImageObject2' );
} else {
$logo_id = get_post_thumbnail_id( $post['ID'] );
if ( isset( $general_settings['site-logo'] ) && 'custom' === $general_settings['site-logo'] ) {
$logo_id = isset( $general_settings['site-logo-custom'] ) ? $general_settings['site-logo-custom'] : '';
}
if ( $logo_id ) {
// Add logo image size.
add_filter( 'intermediate_image_sizes_advanced', 'BSF_AIOSRS_Pro_Schema_Template::logo_image_sizes', 10, 2 );
$logo_image = wp_get_attachment_image_src( $logo_id, 'aiosrs-logo-size' );
if ( isset( $logo_image[3] ) && 1 !== $logo_image[3] ) {
BSF_AIOSRS_Pro_Schema_Template::generate_logo_by_width( $logo_id );
$logo_image = wp_get_attachment_image_src( $logo_id, 'aiosrs-logo-size' );
}
// Remove logo image size.
remove_filter( 'intermediate_image_sizes_advanced', 'BSF_AIOSRS_Pro_Schema_Template::logo_image_sizes', 10, 2 );
$schema['publisher']['@type'] = 'Organization';
$schema['publisher']['logo'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $logo_image, 'ImageObject' );
}
}
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
return apply_filters( 'wp_schema_pro_schema_article', $schema, $data, $post );
}
}
}

View File

@@ -1,91 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Book' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_Book {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'Book';
$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 ( ! empty( $data['author'] ) ) {
$schema['author']['@type'] = 'Person';
$schema['author']['name'] = wp_strip_all_tags( (string) $data['author'] );
}
if ( isset( $data['url'] ) && ! empty( $data['url'] ) ) {
$schema['url'] = esc_url( $data['url'] );
}
if ( isset( $data['same-as'] ) && ! empty( $data['same-as'] ) ) {
$schema['sameAs'] = esc_url( $data['same-as'] );
}
if ( isset( $data['work-example'] ) && ! empty( $data['work-example'] ) ) {
foreach ( $data['work-example'] as $key => $value ) {
$schema['workExample'][ $key ]['@type'] = 'Book';
$schema['workExample'][ $key ]['isbn'] = ! empty( $value['serial-number'] ) ? wp_strip_all_tags( (string) $value['serial-number'] ) : null;
$schema['workExample'][ $key ]['bookEdition'] = ! empty( $value['book-edition'] ) ? wp_strip_all_tags( (string) $value['book-edition'] ) : null;
$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';
$action_platform = explode( ',', $value['action-platform'] );
$action_platform = array_map( 'trim', $action_platform );
$schema['workExample'][ $key ]['potentialAction']['target']['urlTemplate'] = $value['url-template'];
$schema['workExample'][ $key ]['potentialAction']['target']['actionPlatform'] = $action_platform;
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['@type'] = 'Offer';
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['price'] = '0';
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['price'] = ! empty( $value['price'] ) ? wp_strip_all_tags( (string) $value['price'] ) : null;
$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'] );
$expects_acceptance = array_map( 'trim', $expects_acceptance );
$expects_acceptances = array();
foreach ( $expects_acceptance as $index => $country_name ) {
$expects_acceptances[ $index ]['@type'] = 'Country';
$expects_acceptances[ $index ]['name'] = $country_name;
}
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['eligibleRegion'] = $expects_acceptances;
}
}
}
return apply_filters( 'wp_schema_pro_schema_book', $schema, $data, $post );
}
}
}

View File

@@ -1,168 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Course' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_Course {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'Course';
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
$schema['courseCode'] = ! empty( $data['course-code'] ) ? wp_strip_all_tags( (string) $data['course-code'] ) : null;
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : 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'] ) ) {
foreach ( $data['course-instance'] as $key => $value ) {
if ( isset( $value['name'] ) && ! empty( $value['name'] ) ||
isset( $value['description'] ) && ! empty( $value['description'] ) ||
isset( $value['start-date'] ) && ! empty( $value['start-date'] ) ||
isset( $value['location-address'] ) && ! empty( $value['location-address'] ) ) {
$schema['hasCourseInstance'][ $key ]['@type'] = 'CourseInstance';
$schema['hasCourseInstance'][ $key ]['name'] = ! empty( $value['name'] ) ? wp_strip_all_tags( (string) $value['name'] ) : null;
$schema['hasCourseInstance'][ $key ]['description'] = ! empty( $value['description'] ) ? wp_strip_all_tags( (string) $value['description'] ) : null;
$schema['hasCourseInstance'][ $key ]['courseMode'] = ! empty( $value['course-mode'] ) ? wp_strip_all_tags( (string) $value['course-mode'] ) : null;
if ( ! empty( $value['course-workload'] ) ) {
$schema['hasCourseInstance'][ $key ]['courseWorkload'] = ! empty( $value['course-workload'] ) ? wp_strip_all_tags( (string) $value['course-workload'] ) : null;
} elseif ( ! empty( $value['repeat-count'] ) && ! empty( $value['repeat-frequency'] ) ) {
$schema['hasCourseInstance'][ $key ]['courseSchedule']['@type'] = 'Schedule';
$schema['hasCourseInstance'][ $key ]['courseSchedule']['repeatCount'] = ! empty( $value['repeat-count'] ) ? wp_strip_all_tags( (string) $value['repeat-count'] ) : null;
$schema['hasCourseInstance'][ $key ]['courseSchedule']['repeatFrequency'] = ! empty( $value['repeat-frequency'] ) ? wp_strip_all_tags( (string) $value['repeat-frequency'] ) : null;
if ( ! empty( $value['start-date'] ) ) {
if ( 'OfflineEventAttendanceMode' !== isset( $value['event-attendance-mode'] ) ) {
$start_date = gmdate( DATE_ISO8601, strtotime( $value['start-date'] ) );
$schema['hasCourseInstance'][ $key ]['courseSchedule']['startDate'] = wp_strip_all_tags( (string) $start_date );
} else {
$schema['hasCourseInstance'][ $key ]['courseSchedule']['startDate'] = wp_strip_all_tags( (string) $value['start-date'] );
}
}
if ( ! empty( $value['end-date'] ) ) {
$schema['hasCourseInstance'][ $key ]['courseSchedule']['endDate'] = ! empty( $value['end-date'] ) ? wp_strip_all_tags( (string) $value['end-date'] ) : null;
}
}
$schema['hasCourseInstance'][ $key ]['eventStatus'] = ! empty( $value['event-status'] ) ? wp_strip_all_tags( (string) $value['event-status'] ) : null;
$schema['hasCourseInstance'][ $key ]['eventAttendanceMode'] = ! empty( $value['event-attendance-mode'] ) ? wp_strip_all_tags( (string) $value['event-attendance-mode'] ) : null;
if ( ! empty( $value['start-date'] ) ) {
if ( 'OfflineEventAttendanceMode' !== isset( $value['event-attendance-mode'] ) ) {
$start_date = gmdate( DATE_ISO8601, strtotime( $value['start-date'] ) );
$schema['hasCourseInstance'][ $key ]['startDate'] = wp_strip_all_tags( (string) $start_date );
} else {
$schema['hasCourseInstance'][ $key ]['startDate'] = wp_strip_all_tags( (string) $value['start-date'] );
}
}
$schema['hasCourseInstance'][ $key ]['endDate'] = ! empty( $value['end-date'] ) ? wp_strip_all_tags( (string) $value['end-date'] ) : null;
$schema['hasCourseInstance'][ $key ]['previousStartDate'] = ! empty( $value['previous-date'] ) ? wp_strip_all_tags( (string) $value['previous-date'] ) : null;
if ( isset( $value['online-location'] ) && ! empty( $value['online-location'] ) && 'OfflineEventAttendanceMode' !== $value['event-attendance-mode'] || 'MixedEventAttendanceMode' === $value['event-attendance-mode'] ) {
$schema['hasCourseInstance'][ $key ]['location']['@type'] = 'VirtualLocation';
$schema['hasCourseInstance'][ $key ]['location']['url'] = esc_url( $value['online-location'] );
}
if ( isset( $value['image'] ) && ! empty( $value['image'] ) ) {
$schema['hasCourseInstance'][ $key ]['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $value['image'] );
}
if ( ! empty( $value['location-name'] ) && 'OnlineEventAttendanceMode' !== $value['event-attendance-mode'] ) {
$schema['hasCourseInstance'][ $key ]['location']['@type'] = 'Place';
$schema['hasCourseInstance'][ $key ]['location']['name'] = wp_strip_all_tags( (string) $value['location-name'] );
}
if ( ! empty( $value['location-address'] ) && 'OnlineEventAttendanceMode' !== $value['event-attendance-mode'] && is_string( $value['location-address'] ) ) {
$schema['hasCourseInstance'][ $key ]['location']['@type'] = 'Place';
$schema['hasCourseInstance'][ $key ]['location']['address'] = wp_strip_all_tags( (string) $value['location-address'] );
}
$schema['hasCourseInstance'][ $key ]['organizer']['@type'] = 'Organization';
$schema['hasCourseInstance'][ $key ]['organizer']['name'] = ! empty( $value['course-organizer-name'] ) ? wp_strip_all_tags( (string) $value['course-organizer-name'] ) : null;
$schema['hasCourseInstance'][ $key ]['organizer']['url'] = ! empty( $value['course-organizer-url'] ) ? wp_strip_all_tags( (string) $value['course-organizer-url'] ) : null;
$schema['hasCourseInstance'][ $key ]['offers']['@type'] = 'Offer';
$schema['hasCourseInstance'][ $key ]['offers']['price'] = '0';
$schema['hasCourseInstance'][ $key ]['offers']['price'] = ! empty( $value['price'] ) ? wp_strip_all_tags( (string) $value['price'] ) : null;
$schema['hasCourseInstance'][ $key ]['offers']['priceCurrency'] = ! empty( $value['currency'] ) ? wp_strip_all_tags( (string) $value['currency'] ) : null;
$schema['hasCourseInstance'][ $key ]['offers']['url'] = ! empty( $value['url'] ) ? wp_strip_all_tags( (string) $value['url'] ) : null;
$schema['hasCourseInstance'][ $key ]['offers']['validFrom'] = ! empty( $value['valid-from'] ) ? wp_strip_all_tags( (string) $value['valid-from'] ) : null;
$schema['hasCourseInstance'][ $key ]['offers']['availability'] = ! empty( $value['avail'] ) ? wp_strip_all_tags( (string) $value['avail'] ) : null;
if ( ! empty( $value['performer'] ) ) {
$schema['hasCourseInstance'][ $key ]['performer']['@type'] = 'Person';
$schema['hasCourseInstance'][ $key ]['performer']['name'] = wp_strip_all_tags( (string) $value['performer'] );
}
}
}
}
if ( ( isset( $data['orgnization-name'] ) && ! empty( $data['orgnization-name'] ) ) ||
( isset( $data['same-as'] ) && ! empty( $data['same-as'] ) ) ) {
$schema['provider']['@type'] = 'Organization';
$schema['provider']['name'] = ! empty( $data['orgnization-name'] ) ? wp_strip_all_tags( (string) $data['orgnization-name'] ) : null;
if ( isset( $data['same-as'] ) && ! empty( $data['same-as'] ) ) {
$schema['provider']['sameAs'] = esc_url( $data['same-as'] );
}
}
if ( ( isset( $data['rating'] ) && ! empty( $data['rating'] ) ) ||
( isset( $data['review-count'] ) && ! empty( $data['review-count'] ) ) ) {
$schema['aggregateRating']['@type'] = 'AggregateRating';
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string) $data['rating'] ) : null;
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( $data['review-count'] ) : null;
}
return apply_filters( 'wp_schema_pro_schema_course', $schema, $data, $post );
}
}
}

View File

@@ -1,35 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 2.5.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Custom_Markup' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 2.5.0
*/
class BSF_AIOSRS_Pro_Schema_Custom_Markup {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
if ( isset( $data['custom-markup'] ) && ! empty( $data['custom-markup'] ) ) {
$schema['custom-markup'] = $data['custom-markup'];
}
return apply_filters( 'wp_schema_pro_schema_article', $schema, $data, $post );
}
}
}

View File

@@ -1,210 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Event' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_Event {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
if ( isset( $data['schema-type'] ) && ! empty( $data['schema-type'] ) ) {
$schema['@type'] = $data['schema-type'];
}
$schema = self::prepare_basics( $schema, $data );
$schema = self::prepare_attendence_mode( $schema, $data );
$schema = self::prepare_location_by_attendence_mode( $schema, $data );
$schema = self::prepare_dates( $schema, $data );
$schema = self::prepare_offer( $schema, $data );
$schema = self::prepare_performer( $schema, $data );
return apply_filters( 'wp_schema_pro_schema_event', $schema, $data, $post );
}
/**
* Prepare location by attendence mode schema field.
*
* @param array $schema schema.
* @param array $data data.
* @return array
*/
public static function prepare_location_by_attendence_mode( $schema, $data ) {
if ( 'OnlineEventAttendanceMode' === $data['event-attendance-mode'] ) {
$schema = self::prepare_location( $schema, $data, false );
} elseif ( 'OfflineEventAttendanceMode' === $data['event-attendance-mode'] ) {
$schema = self::prepare_location( $schema, $data, true );
} else {
$online_location = self::prepare_location( $schema, $data, false );
$offline_location = self::prepare_location( $schema, $data, true );
$schema['location'] = array( $online_location['location'], $offline_location['location'] );
}
return $schema;
}
/**
* Prepare location schema field.
*
* @param array $schema schema.
* @param array $data data.
* @param boolean $offline offline.
* @return array
*/
public static function prepare_location( $schema, $data, $offline = true ) {
if ( $offline ) {
if ( ! empty( $data['location'] ) ) {
$schema['location']['@type'] = 'Place';
$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;
if ( ! empty( $data['location-country'] ) ) {
$schema['location']['address']['addressCountry']['@type'] = 'Country';
$schema['location']['address']['addressCountry']['name'] = wp_strip_all_tags( (string) $data['location-country'] );
}
} else {
$schema['location']['@type'] = 'VirtualLocation';
$schema['location']['url'] = esc_url( $data['online-location'] );
}
return $schema;
}
/**
* Prepare Offer schema field.
*
* @param array $schema schema.
* @param array $data data.
* @return array
*/
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;
if ( isset( $data['ticket-buy-url'] ) && ! empty( $data['ticket-buy-url'] ) ) {
$schema['offers']['url'] = esc_url( $data['ticket-buy-url'] );
}
return $schema;
}
/**
* Prepare Performer schema field.
*
* @param array $schema schema.
* @param array $data data.
* @return array
*/
public static function prepare_performer( $schema, $data ) {
if ( ! empty( $data['performer'] ) ) {
$schema['performer']['@type'] = 'Person';
$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;
return $schema;
}
/**
* Prepare dates schema field.
*
* @param array $schema schema.
* @param array $data data.
* @return array
*/
public static function prepare_dates( $schema, $data ) {
$start_date = gmdate( DATE_ISO8601, strtotime( $data['start-date'] ) );
$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['startDate'] = ! empty( $start_date ) ? wp_strip_all_tags( $start_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;
}
/**
* Prepare attendence schema field.
*
* @param array $schema schema.
* @param array $data data.
* @return array
*/
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;
return $schema;
}
/**
* Prepare basic schema field.
*
* @param array $schema schema.
* @param array $data data.
* @return array
*/
public static function prepare_basics( $schema, $data ) {
$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;
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;
return $schema;
}
}
}

View File

@@ -1,47 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_FAQ' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_FAQ {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
global $post; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.VariableRedeclaration
$schema = array();
if ( isset( $data['question-answer'][0]['question'] ) && ! empty( $data['question-answer'][0]['question'] ) ) {
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'FAQPage';
foreach ( $data['question-answer'] as $key => $value ) {
if ( isset( $value['question'] ) && ! empty( $value['question'] ) ) {
$schema['mainEntity'][ $key ]['@type'] = 'Question';
$schema['mainEntity'][ $key ]['name'] = $value['question'];
}
if ( isset( $value['answer'] ) && ! empty( $value['answer'] ) ) {
$schema['mainEntity'][ $key ]['acceptedAnswer']['@type'] = 'Answer';
$schema['mainEntity'][ $key ]['acceptedAnswer']['text'] = $value['answer'];
}
}
}
return apply_filters( 'wp_schema_pro_schema_faq', $schema, $data, $post );
}
}
}

View File

@@ -1,87 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 2.1.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_How_To' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 2.1.0
*/
class BSF_AIOSRS_Pro_Schema_How_To {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'HowTo';
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
$schema['totalTime'] = ! empty( $data['total-time'] ) ? wp_strip_all_tags( (string) $data['total-time'] ) : null;
if ( isset( $data['supply'] ) && ! empty( $data['supply'] ) ) {
foreach ( $data['supply'] as $key => $value ) {
if ( isset( $value['name'] ) && ! empty( $value['name'] ) ) {
$schema['supply'][ $key ]['@type'] = 'HowToSupply';
$schema['supply'][ $key ]['name'] = ! empty( $value['name'] ) ? wp_strip_all_tags( (string) $value['name'] ) : null;
}
}
}
if ( isset( $data['tool'] ) && ! empty( $data['tool'] ) ) {
foreach ( $data['tool'] as $key => $value ) {
if ( isset( $value['name'] ) && ! empty( $value['name'] ) ) {
$schema['tool'][ $key ]['@type'] = 'HowToTool';
$schema['tool'][ $key ]['name'] = ! empty( $value['name'] ) ? wp_strip_all_tags( (string) $value['name'] ) : null;
}
}
}
if ( isset( $data['steps'] ) && ! empty( $data['steps'] ) ) {
foreach ( $data['steps'] as $key => $value ) {
$schema['step'][ $key ]['@type'] = 'HowToStep';
if ( isset( $value['name'] ) && ! empty( $value['name'] ) ) {
$schema['step'][ $key ]['name'] = $value['name'];
}
if ( isset( $value['url'] ) && ! empty( $value['url'] ) ) {
$schema['step'][ $key ]['url'] = $value['url'];
}
if ( isset( $value['description'] ) && ! empty( $value['description'] ) ) {
$schema['step'][ $key ]['itemListElement']['@type'] = 'HowToDirection';
$schema['step'][ $key ]['itemListElement']['text'] = $value['description'];
}
$step_image = wp_get_attachment_image_src( $value['image'], 'full' );
if ( isset( $value['image'] ) && ! empty( $value['image'] ) ) {
$schema['step'][ $key ]['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $step_image, 'ImageObject' );
}
}
}
return apply_filters( 'wp_schema_pro_schema_how_to', $schema, $data, $post );
}
}
}

View File

@@ -1,62 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Image_License' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 2.7.0
*/
class BSF_AIOSRS_Pro_Schema_Image_License {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
if ( isset( $data['image-license'] ) && ! empty( $data['image-license'] ) ) {
foreach ( $data['image-license'] as $key => $value ) {
$schema[ $key ]['@context'] = 'https://schema.org';
$schema[ $key ]['@type'] = 'ImageObject';
if ( isset( $value['content-url'] ) && ! empty( $value['content-url'] ) ) {
$schema[ $key ]['contentUrl'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $value['content-url'], 'URL' );
}
if ( isset( $value['license'] ) && ! empty( $value['license'] ) ) {
$schema[ $key ]['license'] = esc_url( $value['license'] );
}
if ( isset( $value['acquire-license-Page'] ) && ! empty( $value['acquire-license-Page'] ) ) {
$schema[ $key ]['acquireLicensePage'] = esc_url( $value['acquire-license-Page'] );
}
if ( isset( $value['credit-text'] ) && ! empty( $value['credit-text'] ) ) {
$schema[ $key ]['creditText'] = esc_url( $value['credit-text'] );
}
if ( ! empty( $data['creator-type'] ) ) {
$schema['creator']['@type'] = wp_strip_all_tags( (string) $data['creator-type'] );
} else {
$schema[ $key ]['creator']['@type'] = 'Person';
}
if ( isset( $value['creator'] ) && ! empty( $value['creator'] ) ) {
$schema[ $key ]['creator']['name'] = esc_url( $value['creator'] );
}
if ( isset( $value['copy-right-notice'] ) && ! empty( $value['copy-right-notice'] ) ) {
$schema[ $key ]['copyrightNotice'] = esc_url( $value['copy-right-notice'] );
}
}
}
return apply_filters( 'wp_schema_pro_schema_image_license', $schema, $data, $post );
}
}
}

View File

@@ -1,127 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Job_Posting' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_Job_Posting {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'JobPosting';
$schema['title'] = ! empty( $data['title'] ) ? wp_strip_all_tags( (string) $data['title'] ) : null;
$schema['description'] = ! empty( $data['description'] ) ? (string) $data['description'] : null;
$schema['datePosted'] = ! empty( $data['start-date'] ) ? wp_strip_all_tags( (string) $data['start-date'] ) : null;
$schema['validThrough'] = ! empty( $data['expiry-date'] ) ? wp_strip_all_tags( (string) $data['expiry-date'] ) : null;
$schema['employmentType'] = ! empty( $data['job-type'] ) ? wp_strip_all_tags( (string) $data['job-type'] ) : null;
if ( ! empty( $data['education-requirements'] ) && 'none' !== $data['education-requirements'] ) {
$schema['educationRequirements']['@type'] = 'EducationalOccupationalCredential';
$schema['educationRequirements']['credentialCategory'] = wp_strip_all_tags( (string) $data['education-requirements'] );
}
if ( ! empty( $data['experience-requirements'] ) && 'none' !== $data['experience-requirements'] ) {
$schema['experienceRequirements']['@type'] = 'OccupationalExperienceRequirements';
$schema['experienceRequirements']['monthsOfExperience'] = wp_strip_all_tags( (string) $data['experience-requirements'] );
}
$schema['industry'] = ! empty( $data['industry'] ) ? wp_strip_all_tags( (string) $data['industry'] ) : null;
$schema['qualifications'] = ! empty( $data['qualifications'] ) ? wp_strip_all_tags( (string) $data['qualifications'] ) : null;
$schema['responsibilities'] = ! empty( $data['responsibilities'] ) ? wp_strip_all_tags( (string) $data['responsibilities'] ) : null;
$schema['skills'] = ! empty( $data['skills'] ) ? wp_strip_all_tags( (string) $data['skills'] ) : null;
$schema['workHours'] = ! empty( $data['work-hours'] ) ? wp_strip_all_tags( (string) $data['work-hours'] ) : null;
if ( ( isset( $data['orgnization-name'] ) && ! empty( $data['orgnization-name'] ) ) ||
( isset( $data['same-as'] ) && ! empty( $data['same-as'] ) ) ) {
$schema['hiringOrganization']['@type'] = 'Organization';
$schema['hiringOrganization']['name'] = wp_strip_all_tags( (string) $data['orgnization-name'] );
if ( isset( $data['same-as'] ) && ! empty( $data['same-as'] ) ) {
$schema['hiringOrganization']['sameAs'] = esc_url( $data['same-as'] );
}
if ( isset( $data['organization-logo'] ) && ! empty( $data['organization-logo'] ) ) {
$schema['hiringOrganization']['logo'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['organization-logo'], 'ImageObject' );
}
}
if ( ( isset( $data['location-street'] ) && ! empty( $data['location-street'] ) ) ||
( isset( $data['location-locality'] ) && ! empty( $data['location-locality'] ) ) ||
( isset( $data['location-postal'] ) && ! empty( $data['location-postal'] ) ) ||
( isset( $data['location-region'] ) && ! empty( $data['location-region'] ) ) ||
( isset( $data['location-country'] ) && ! empty( $data['location-country'] ) ) ) {
$schema['jobLocation']['@type'] = 'Place';
$schema['jobLocation']['address']['@type'] = 'PostalAddress';
$schema['jobLocation']['address']['streetAddress'] = ! empty( $data['location-street'] ) ? wp_strip_all_tags( (string) $data['location-street'] ) : null;
$schema['jobLocation']['address']['addressLocality'] = ! empty( $data['location-locality'] ) ? wp_strip_all_tags( (string) $data['location-locality'] ) : null;
$schema['jobLocation']['address']['postalCode'] = ! empty( $data['location-postal'] ) ? wp_strip_all_tags( (string) $data['location-postal'] ) : null;
$schema['jobLocation']['address']['addressRegion'] = ! empty( $data['location-region'] ) ? wp_strip_all_tags( (string) $data['location-region'] ) : null;
$schema['jobLocation']['address']['addressCountry'] = ! empty( $data['location-country'] ) ? wp_strip_all_tags( (string) $data['location-country'] ) : null;
}
$schema['jobLocationType'] = ( ! empty( $data['job-location-type'] ) && 'none' !== $data['job-location-type'] ) ? wp_strip_all_tags( (string) $data['job-location-type'] ) : null;
if ( isset( $data['remote-location'] ) && ! empty( $data['remote-location'] ) ) {
foreach ( $data['remote-location'] as $key => $value ) {
$schema['applicantLocationRequirements'][ $key ]['@type'] = 'Country';
$schema['applicantLocationRequirements'][ $key ]['name'] = wp_strip_all_tags( (string) $value['applicant-location'] );
}
} else {
if ( isset( $data['applicant-location'] ) && ! empty( $data['applicant-location'] ) ) {
$schema['applicantLocationRequirements']['@type'] = 'Country';
$schema['applicantLocationRequirements']['name'] = wp_strip_all_tags( (string) $data['applicant-location'] );
}
}
if ( isset( $data['salary-currency'] ) && ! empty( $data['salary-currency'] ) ) {
$schema['baseSalary']['@type'] = 'MonetaryAmount';
$schema['baseSalary']['currency'] = wp_strip_all_tags( (string) $data['salary-currency'] );
}
if ( ( isset( $data['salary'] ) && ! empty( $data['salary'] ) ) ||
( isset( $data['salary-unit'] ) && ! empty( $data['salary-unit'] ) ) ) {
$schema['baseSalary']['@type'] = 'MonetaryAmount';
$schema['baseSalary']['value']['@type'] = 'QuantitativeValue';
$schema['baseSalary']['value']['value'] = ! empty( $data['salary'] ) ? wp_strip_all_tags( (string) $data['salary'] ) : null;
$schema['baseSalary']['value']['minValue'] = ( ! empty( $data['salary-min-value'] ) && 'none' !== $data['salary-min-value'] ) ? wp_strip_all_tags( (string) $data['salary-min-value'] ) : null;
$schema['baseSalary']['value']['maxValue'] = ( ! empty( $data['salary-max-value'] ) && 'none' !== $data['salary-max-value'] ) ? wp_strip_all_tags( (string) $data['salary-max-value'] ) : null;
$schema['baseSalary']['value']['unitText'] = ! empty( $data['salary-unit'] ) ? wp_strip_all_tags( (string) $data['salary-unit'] ) : null;
}
return apply_filters( 'wp_schema_pro_schema_job_posting', $schema, $data, $post );
}
}
}

View File

@@ -1,117 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Local_Business' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_Local_Business {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
if ( isset( $data['schema-type'] ) && ! empty( $data['schema-type'] ) && 'ProfessionalService' !== $data['schema-type'] ) {
$schema['@type'] = $data['schema-type'];
} else {
$schema['@type'] = 'LocalBusiness';
}
$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'] );
}
$schema['telephone'] = ! empty( $data['telephone'] ) ? wp_strip_all_tags( (string) $data['telephone'] ) : null;
$schema['url'] = ! empty( $data['url'] ) ? wp_strip_all_tags( (string) $data['url'] ) : null;
if ( ( isset( $data['location-street'] ) && ! empty( $data['location-street'] ) ) ||
( isset( $data['location-locality'] ) && ! empty( $data['location-locality'] ) ) ||
( isset( $data['location-postal'] ) && ! empty( $data['location-postal'] ) ) ||
( isset( $data['location-region'] ) && ! empty( $data['location-region'] ) ) ||
( isset( $data['location-country'] ) && ! empty( $data['location-country'] ) ) ) {
$schema['address']['@type'] = 'PostalAddress';
$schema['address']['streetAddress'] = ! empty( $data['location-street'] ) ? wp_strip_all_tags( (string) $data['location-street'] ) : null;
$schema['address']['addressLocality'] = ! empty( $data['location-locality'] ) ? wp_strip_all_tags( (string) $data['location-locality'] ) : null;
$schema['address']['postalCode'] = ! empty( $data['location-postal'] ) ? wp_strip_all_tags( (string) $data['location-postal'] ) : null;
$schema['address']['addressRegion'] = ! empty( $data['location-region'] ) ? wp_strip_all_tags( (string) $data['location-region'] ) : null;
$schema['address']['addressCountry'] = ! empty( $data['location-country'] ) ? wp_strip_all_tags( (string) $data['location-country'] ) : null;
}
if ( ! empty( $data['rating'] ) && ! empty( $data['review-count'] ) && 'none' !== $data['rating'] && 'none' !== $data['review-count'] ) {
$schema['aggregateRating']['@type'] = 'AggregateRating';
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string) $data['rating'] ) : null;
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( (string) $data['review-count'] ) : null;
}
$schema['priceRange'] = ! empty( $data['price-range'] ) ? wp_strip_all_tags( (string) $data['price-range'] ) : null;
if ( isset( $data['hours-specification'] ) && ! empty( $data['hours-specification'] ) ) {
foreach ( $data['hours-specification'] as $key => $value ) {
$schema['openingHoursSpecification'][ $key ]['@type'] = 'OpeningHoursSpecification';
$days = explode( ',', $value['days'] );
$days = array_map( 'trim', $days );
$schema['openingHoursSpecification'][ $key ]['dayOfWeek'] = $days;
$schema['openingHoursSpecification'][ $key ]['opens'] = $value['opens'];
$schema['openingHoursSpecification'][ $key ]['closes'] = $value['closes'];
}
}
if ( isset( $data['geo-latitude'] ) && isset( $data['geo-longitude'] ) ) {
$schema['geo']['@type'] = 'GeoCoordinates';
$schema['geo']['latitude'] = wp_strip_all_tags( (string) $data['geo-latitude'] );
$schema['geo']['longitude'] = wp_strip_all_tags( (string) $data['geo-longitude'] );
}
$contact_type = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-corporate-contact'];
$contact_hear = isset( $contact_type['contact-hear'] ) ? $contact_type['contact-hear'] : '';
$contact_toll = isset( $contact_type['contact-toll'] ) ? $contact_type['contact-toll'] : '';
$contact_point_type = $contact_hear . ' ' . $contact_toll;
$contact_point_type = explode( ' ', $contact_point_type );
if ( '1' === $contact_type['cp-schema-type'] && true === apply_filters( 'wp_schema_pro_contactpoint_local_business_schema_enabled', true ) && isset( $contact_type['contact-type'] ) && ! empty( $contact_type['contact-type'] ) ) {
$schema['ContactPoint']['@type'] = 'ContactPoint';
$schema ['ContactPoint']['contactType'] = ! empty( $contact_type['contact-type'] ) ? wp_strip_all_tags( (string) $contact_type['contact-type'] ) : null;
$schema ['ContactPoint']['telephone'] = ! empty( $contact_type['telephone'] ) ? wp_strip_all_tags( (string) $contact_type['telephone'] ) : null;
if ( isset( $contact_type['url'] ) && ! empty( $contact_type['url'] ) ) {
$schema ['ContactPoint']['url'] = esc_url( $contact_type['url'] );
}
$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 );
}
}
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;
}
return apply_filters( 'wp_schema_pro_schema_local_business', $schema, $data, $post );
}
}
}

View File

@@ -1,115 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Person' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_Person {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'Person';
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
if ( ( isset( $data['street'] ) && ! empty( $data['street'] ) ) ||
( isset( $data['locality'] ) && ! empty( $data['locality'] ) ) ||
( isset( $data['postal'] ) && ! empty( $data['postal'] ) ) ||
( isset( $data['region'] ) && ! empty( $data['region'] ) ) ) {
$schema['address']['@type'] = 'PostalAddress';
$schema['address']['addressLocality'] = ! empty( $data['locality'] ) ? wp_strip_all_tags( (string) $data['locality'] ) : null;
$schema['address']['addressRegion'] = ! empty( $data['region'] ) ? wp_strip_all_tags( (string) $data['region'] ) : null;
$schema['address']['postalCode'] = ! empty( $data['postal'] ) ? wp_strip_all_tags( (string) $data['postal'] ) : null;
$schema['address']['streetAddress'] = ! empty( $data['street'] ) ? wp_strip_all_tags( (string) $data['street'] ) : null;
}
$schema['email'] = ! empty( $data['email'] ) ? wp_strip_all_tags( (string) $data['email'] ) : null;
$schema['gender'] = ! empty( $data['gender'] ) ? wp_strip_all_tags( (string) $data['gender'] ) : null;
if ( isset( $data['dob'] ) && ! empty( $data['dob'] ) ) {
$date_informat = gmdate( 'Y.m.d', strtotime( $data['dob'] ) );
$schema['birthDate'] = wp_strip_all_tags( (string) $date_informat );
}
$schema['memberOf'] = ! empty( $data['member'] ) ? wp_strip_all_tags( (string) $data['member'] ) : null;
$schema['nationality'] = ! empty( $data['nationality'] ) ? wp_strip_all_tags( (string) $data['nationality'] ) : null;
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
}
$schema['jobTitle'] = ! empty( $data['job-title'] ) ? wp_strip_all_tags( (string) $data['job-title'] ) : null;
$schema['telephone'] = ! empty( $data['telephone'] ) ? wp_strip_all_tags( (string) $data['telephone'] ) : null;
if ( isset( $data['homepage-url'] ) && ! empty( $data['homepage-url'] ) ) {
$schema['url'] = esc_url( $data['homepage-url'] );
}
if ( isset( $data['add-url'] ) && ! empty( $data['add-url'] ) ) {
foreach ( $data['add-url'] as $key => $value ) {
if ( isset( $value['same-as'] ) && ! empty( $value['same-as'] ) ) {
$schema['sameAs'][ $key ] = esc_url( $value['same-as'] );
}
}
}
$contact_type = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-corporate-contact'];
$contact_hear = isset( $contact_type['contact-hear'] ) ? $contact_type['contact-hear'] : '';
$contact_toll = isset( $contact_type['contact-toll'] ) ? $contact_type['contact-toll'] : '';
$contact_point_type = $contact_hear . ' ' . $contact_toll;
$contact_point_type = explode( ' ', $contact_point_type );
if ( '1' === $contact_type['cp-schema-type'] && true === apply_filters( 'wp_schema_pro_contactpoint_person_schema_enabled', true ) && isset( $contact_type['contact-type'] ) && ! empty( $contact_type['contact-type'] ) ) {
$schema['ContactPoint']['@type'] = 'ContactPoint';
$schema ['ContactPoint']['contactType'] = ! empty( $contact_type['contact-type'] ) ? wp_strip_all_tags( (string) $contact_type['contact-type'] ) : null;
$schema ['ContactPoint']['telephone'] = ! empty( $contact_type['telephone'] ) ? wp_strip_all_tags( (string) $contact_type['telephone'] ) : null;
if ( isset( $contact_type['url'] ) && ! empty( $contact_type['url'] ) ) {
$schema ['ContactPoint']['url'] = esc_url( $contact_type['url'] );
}
$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'] );
if ( is_array( $language )) {
foreach ( $language as $key => $value ) {
$schema ['ContactPoint']['areaServed'][ $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;
}
return apply_filters( 'wp_schema_pro_schema_person', $schema, $data, $post );
}
}
}

View File

@@ -1,127 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Product' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_Product {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'Product';
$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'] );
}
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
$schema['sku'] = ! empty( $data['sku'] ) ? wp_strip_all_tags( (string) $data['sku'] ) : null;
$schema['mpn'] = ! empty( $data['mpn'] ) ? wp_strip_all_tags( (string) $data['mpn'] ) : null;
if ( ! empty( $data['brand-name'] ) ) {
$schema['brand']['@type'] = 'Brand';
$schema['brand']['name'] = wp_strip_all_tags( (string) $data['brand-name'] );
}
if ( ( isset( $data['rating'] ) && ! empty( $data['rating'] ) ) ||
( isset( $data['review-count'] ) && ! empty( $data['review-count'] ) ) ) {
$schema['aggregateRating']['@type'] = 'AggregateRating';
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string) $data['rating'] ) : null;
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( (string) $data['review-count'] ) : null;
}
if ( apply_filters( 'wp_schema_pro_remove_product_offers', true ) ) {
$schema['offers']['@type'] = 'Offer';
$schema['offers']['price'] = '0';
$schema['offers']['price'] = ! empty( $data['price'] ) ? wp_strip_all_tags( (string) $data['price'] ) : null;
$schema['offers']['priceValidUntil'] = ! empty( $data['price-valid-until'] ) ? wp_strip_all_tags( (string) $data['price-valid-until'] ) : null;
if ( isset( $data['url'] ) && ! empty( $data['url'] ) ) {
$schema['offers']['url'] = esc_url( $data['url'] );
}
if ( ( isset( $data['currency'] ) && ! empty( $data['currency'] ) ) ||
( isset( $data['avail'] ) && ! empty( $data['avail'] ) ) ) {
$schema['offers']['priceCurrency'] = ! empty( $data['currency'] ) ? wp_strip_all_tags( (string) $data['currency'] ) : null;
$schema['offers']['availability'] = ! empty( $data['avail'] ) ? wp_strip_all_tags( (string) $data['avail'] ) : null;
}
}
if ( apply_filters( 'wp_schema_pro_remove_product_reviews', true ) && isset( $data['product-review'] ) && ! empty( $data['product-review'] ) ) {
foreach ( $data['product-review'] as $key => $value ) {
if ( ( isset( $value['reviewer-name'] ) && ! empty( $value['reviewer-name'] ) ) && ( isset( $value['product-rating'] ) && ! empty( $value['product-rating'] ) ) ) {
$schema['review'][ $key ]['@type'] = 'Review';
$schema['review'][ $key ]['author']['name'] = wp_strip_all_tags( (string) $value['reviewer-name'] );
if ( isset( $value['reviewer-type'] ) && ! empty( $value['reviewer-type'] ) ) {
$schema['review'][ $key ]['author']['@type'] = wp_strip_all_tags( (string) $value['reviewer-type'] );
} else {
$schema['review'][ $key ]['author']['@type'] = 'Person';
}
if ( isset( $value['product-rating'] ) && ! empty( $value['product-rating'] ) ) {
$schema['review'][ $key ]['reviewRating']['@type'] = 'Rating';
$schema['review'][ $key ]['reviewRating']['ratingValue'] = wp_strip_all_tags( (string) $value['product-rating'] );
}
$schema['review'][ $key ]['reviewBody'] = ! empty( $value['review-body'] ) ? wp_strip_all_tags( (string) $value['review-body'] ) : null;
}
}
}
// Fetch woocommerce review.
if ( defined( 'WC_VERSION' ) && apply_filters( 'wp_schema_pro_add_woocommerce_review', false ) ) {
$comments = get_comments(
array(
'number' => 5,
'post_id' => $post['ID'],
'status' => 'approve',
'post_status' => 'publish',
'post_type' => 'product',
'parent' => 0,
'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
array(
'key' => 'rating',
'type' => 'NUMERIC',
'compare' => '>',
'value' => 0,
),
),
)
);
if ( $comments ) {
foreach ( $comments as $key => $comment ) {
$schema['review'][ $key ]['@type'] = 'Review';
$schema['review'][ $key ]['reviewRating']['@type'] = 'Rating';
$schema['review'][ $key ]['reviewRating']['ratingValue'] = get_comment_meta( $comment->comment_ID, 'rating', true );
$schema['review'][ $key ]['author']['@type'] = 'Person';
$schema['review'][ $key ]['author']['name'] = get_comment_author( $comment );
$schema['review'][ $key ]['reviewBody'] = get_comment_text( $comment );
}
}
}
return apply_filters( 'wp_schema_pro_schema_product', $schema, $data, $post );
}
}
}

View File

@@ -1,148 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Recipe' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_Recipe {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @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';
$schema['@type'] = 'Recipe';
$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['reviewer-type'] ) && ! empty( $data['reviewer-type'] ) ) {
$schema['author']['@type'] = wp_strip_all_tags( (string) $data['reviewer-type'] );
} else {
$schema['author']['@type'] = 'Person';
}
$schema['author']['name'] = ! empty( $data['author'] ) ? wp_strip_all_tags( (string) $data['author'] ) : null;
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
$schema['prepTime'] = ! empty( $data['preperation-time'] ) ? wp_strip_all_tags( (string) $data['preperation-time'] ) : null;
$schema['cookTime'] = ! empty( $data['cook-time'] ) ? wp_strip_all_tags( (string) $data['cook-time'] ) : null;
if ( isset( $data['recipe-yield'] ) && ! empty( $data['recipe-yield'] ) ) {
$schema['recipeYield'] = esc_html( $data['recipe-yield'] );
}
$schema['keywords'] = ! empty( $data['recipe-keywords'] ) ? wp_strip_all_tags( (string) $data['recipe-keywords'] ) : null;
$schema['recipeCategory'] = ! empty( $data['recipe-category'] ) ? wp_strip_all_tags( (string) $data['recipe-category'] ) : null;
$schema['recipeCuisine'] = ! empty( $data['recipe-cuisine'] ) ? wp_strip_all_tags( (string) $data['recipe-cuisine'] ) : null;
if ( ( isset( $data['rating'] ) && ! empty( $data['rating'] ) ) ||
( isset( $data['review-count'] ) && ! empty( $data['review-count'] ) ) ) {
$schema['aggregateRating']['@type'] = 'AggregateRating';
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string) $data['rating'] ) : null;
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( (string) $data['review-count'] ) : null;
}
if ( isset( $data['nutrition'] ) && ! empty( $data['nutrition'] ) ) {
$schema['nutrition']['@type'] = 'NutritionInformation';
$schema['nutrition']['calories'] = wp_strip_all_tags( (string) $data['nutrition'] );
}
if ( isset( $data['ingredients'] ) && ! empty( $data['ingredients'] ) ) {
$recipe_ingredients = explode( ',', $data['ingredients'] );
foreach ( $recipe_ingredients as $key => $value ) {
$schema['recipeIngredient'][ $key ] = wp_strip_all_tags( (string) $value );
}
}
if ( isset( $data['recipe-instructions'] ) && ! empty( $data['recipe-instructions'] ) ) {
foreach ( $data['recipe-instructions'] as $key => $value ) {
if ( isset( $value['steps'] ) && ! empty( $value['steps'] ) ) {
$schema['recipeInstructions'][ $key ]['@type'] = 'HowToStep';
$schema['recipeInstructions'][ $key ]['text'] = wp_strip_all_tags( (string) $value['steps'] );
$schema['recipeInstructions'][ $key ]['name'] = ! empty( $value['name'] ) ? wp_strip_all_tags( (string) $value['name'] ) : null;
$schema['recipeInstructions'][ $key ]['url'] = ! empty( $value['url'] ) ? wp_strip_all_tags( (string) $value['url'] ) : null;
if ( isset( $value['image'] ) && ! empty( $value['image'] ) ) {
$schema['recipeInstructions'][ $key ]['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $value['image'], 'URL' );
}
}
}
}
if ( isset( $data['recipe-video'] ) && ! empty( $data['recipe-video'] ) ) {
foreach ( $data['recipe-video'] as $key => $value ) {
if ( isset( $value['video-name'] ) && ! empty( $value['video-name'] ) ) {
$schema['video'][ $key ]['@type'] = 'VideoObject';
$schema['video'][ $key ]['name'] = wp_strip_all_tags( (string) $value['video-name'] );
$schema['video'][ $key ]['description'] = ! empty( $value['video-desc'] ) ? wp_strip_all_tags( (string) $value['video-desc'] ) : null;
if ( isset( $value['video-image'] ) && ! empty( $value['video-image'] ) ) {
$schema['video'][ $key ]['thumbnailUrl'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $value['video-image'], 'URL' );
}
if ( isset( $value['recipe-video-content-url'] ) && ! empty( $value['recipe-video-content-url'] ) ) {
$schema['video'][ $key ]['contentUrl'] = esc_url( $value['recipe-video-content-url'] );
}
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;
// 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'] ) ) {
$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

@@ -1,349 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Review' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_Review {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'Review';
/* start Book schema fields */
$data['schema-type'] = isset( $data['schema-type'] ) ? $data['schema-type'] : '';
switch ( $data['schema-type'] ) {
case 'bsf-aiosrs-book':
$schema['itemReviewed']['@type'] = 'Book';
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-book-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-book-name'] ) : null;
if ( isset( $data['bsf-aiosrs-book-author'] ) && ! empty( $data['bsf-aiosrs-book-author'] ) ) {
$schema['itemReviewed']['author']['@type'] = 'Person';
$schema['itemReviewed']['author']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-book-author'] );
$schema['itemReviewed']['author']['sameAs'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-book-same-As'] );
}
$schema['itemReviewed']['isbn'] = ! empty( $data['bsf-aiosrs-book-serial-number'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-book-serial-number'] ) : null;
$schema['description'] = ! empty( $data['bsf-aiosrs-book-description'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-book-description'] ) : null;
$book_url = get_permalink( $post['ID'] );
if ( isset( $book_url ) && ! empty( $book_url ) ) {
$schema['url'] = esc_url( $book_url );
}
break;
case 'bsf-aiosrs-course':
$schema['itemReviewed']['@type'] = 'Course';
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-course-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-course-name'] ) : null;
$schema['itemReviewed']['description'] = ! empty( $data['bsf-aiosrs-course-description'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-course-description'] ) : null;
if ( isset( $data['bsf-aiosrs-course-orgnization-name'] ) && ! empty( $data['bsf-aiosrs-course-orgnization-name'] ) ) {
$schema['itemReviewed']['provider']['@type'] = 'Organization';
$schema['itemReviewed']['provider']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-course-orgnization-name'] );
}
break;
case 'bsf-aiosrs-event':
$schema['itemReviewed']['@type'] = 'event';
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-event-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-name'] ) : null;
$schema['itemReviewed']['description'] = ! empty( $data['bsf-aiosrs-event-description'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-description'] ) : null;
if ( isset( $data['bsf-aiosrs-event-image'] ) && ! empty( $data['bsf-aiosrs-event-image'] ) ) {
$schema['itemReviewed']['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['bsf-aiosrs-event-image'] );
}
if ( isset( $data['bsf-aiosrs-event-start-date'] ) && ! empty( $data['bsf-aiosrs-event-start-date'] ) ) {
if ( 'OfflineEventAttendanceMode' !== $data['bsf-aiosrs-event-event-attendance-mode'] ) {
$start_date = gmdate( DATE_ISO8601, strtotime( $data['bsf-aiosrs-event-start-date'] ) );
$schema['itemReviewed']['startDate'] = wp_strip_all_tags( (string) $start_date );
} else {
$schema['itemReviewed']['startDate'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-event-start-date'] );
}
}
$schema['itemReviewed']['endDate'] = ! empty( $data['bsf-aiosrs-event-end-date'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-end-date'] ) : null;
$schema['itemReviewed']['eventStatus'] = ! empty( $data['bsf-aiosrs-event-event-status'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-event-status'] ) : null;
$schema['itemReviewed']['eventAttendanceMode'] = ! empty( $data['bsf-aiosrs-event-event-attendance-mode'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-event-attendance-mode'] ) : null;
$schema['itemReviewed']['previousStartDate'] = ! empty( $data['bsf-aiosrs-event-previous-date'] ) && 'EventRescheduled' === $data['bsf-aiosrs-event-event-status'] ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-previous-date'] ) : null;
if ( isset( $data['bsf-aiosrs-event-online-location'] ) && ! empty( $data['bsf-aiosrs-event-online-location'] ) &&
( 'OfflineEventAttendanceMode' !== $data['bsf-aiosrs-event-event-attendance-mode'] ) ||
( 'MixedEventAttendanceMode' === $data['bsf-aiosrs-event-event-attendance-mode'] ) ) {
$schema['itemReviewed']['location']['@type'] = 'VirtualLocation';
$schema['itemReviewed']['location']['url'] = esc_url( $data['bsf-aiosrs-event-online-location'] );
}
if ( isset( $data['bsf-aiosrs-event-performer'] ) && ! empty( $data['bsf-aiosrs-event-performer'] ) ) {
$schema['itemReviewed']['performer']['@type'] = 'Person';
$schema['itemReviewed']['performer']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-event-performer'] );
}
if ( isset( $data['bsf-aiosrs-event-location'] ) && ! empty( $data['bsf-aiosrs-event-location'] ) && 'OnlineEventAttendanceMode' !== $data['bsf-aiosrs-event-event-attendance-mode'] ) {
$schema['itemReviewed']['location']['@type'] = 'Place';
$schema['itemReviewed']['location']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-event-location'] );
}
if ( ( ( isset( $data['bsf-aiosrs-event-location-street'] ) && ! empty( $data['bsf-aiosrs-event-location-street'] ) ) ||
( isset( $data['bsf-aiosrs-event-location-locality'] ) && ! empty( $data['bsf-aiosrs-event-location-locality'] ) ) ||
( isset( $data['bsf-aiosrs-event-location-postal'] ) && ! empty( $data['bsf-aiosrs-event-location-postal'] ) ) ||
( isset( $data['bsf-aiosrs-event-location-region'] ) && ! empty( $data['bsf-aiosrs-event-location-region'] ) ) ||
( isset( $data['bsf-aiosrs-event-location-country'] ) && ! empty( $data['bsf-aiosrs-event-location-country'] ) ) ) && ( 'OnlineEventAttendanceMode' !== $data['bsf-aiosrs-event-event-attendance-mode'] ) ) {
$schema['itemReviewed']['location']['address']['@type'] = 'PostalAddress';
$schema['itemReviewed']['location']['address']['streetAddress'] = ! empty( $data['bsf-aiosrs-event-location-street'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-location-street'] ) : null;
$schema['itemReviewed']['location']['address']['addressLocality'] = ! empty( $data['bsf-aiosrs-event-location-locality'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-location-locality'] ) : null;
$schema['itemReviewed']['location']['address']['postalCode'] = ! empty( $data['bsf-aiosrs-event-location-postal'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-location-postal'] ) : null;
$schema['itemReviewed']['location']['address']['addressRegion'] = ! empty( $data['bsf-aiosrs-event-location-region'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-location-region'] ) : null;
$schema['itemReviewed']['location']['address']['addressCountry'] = ! empty( $data['bsf-aiosrs-event-location-country'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-location-country'] ) : null;
}
$schema['itemReviewed']['offers']['@type'] = 'Offer';
if ( ( isset( $data['bsf-aiosrs-event-avail'] ) && ! empty( $data['bsf-aiosrs-event-avail'] ) ) ||
( isset( $data['bsf-aiosrs-event-currency'] ) && ! empty( $data['bsf-aiosrs-event-currency'] ) ) ||
( isset( $data['bsf-aiosrs-event-valid-from'] ) && ! empty( $data['bsf-aiosrs-event-valid-from'] ) ) ||
( isset( $data['bsf-aiosrs-event-ticket-buy-url'] ) && ! empty( $data['bsf-aiosrs-event-ticket-buy-url'] ) ) ) {
if ( isset( $data['bsf-aiosrs-event-ticket-buy-url'] ) && ! empty( $data['bsf-aiosrs-event-ticket-buy-url'] ) ) {
$schema['itemReviewed']['offers']['url'] = esc_url( $data['bsf-aiosrs-event-ticket-buy-url'] );
}
$schema['itemReviewed']['offers']['price'] = ! empty( $data['bsf-aiosrs-event-price'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-price'] ) : null;
$schema['itemReviewed']['offers']['availability'] = ! empty( $data['bsf-aiosrs-event-avail'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-avail'] ) : null;
$schema['itemReviewed']['offers']['priceCurrency'] = ! empty( $data['bsf-aiosrs-event-currency'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-currency'] ) : null;
$schema['itemReviewed']['offers']['validFrom'] = ! empty( $data['bsf-aiosrs-event-valid-from'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-valid-from'] ) : null;
}
if ( ( isset( $data['bsf-aiosrs-event-event-organizer-name'] ) && ! empty( $data['bsf-aiosrs-event-event-organizer-name'] ) ) ||
( isset( $data['bsf-aiosrs-event-event-organizer-url'] ) && ! empty( $data['bsf-aiosrs-event-event-organizer-url'] ) ) ) {
$schema['itemReviewed']['organizer']['@type'] = 'Organization';
$schema['itemReviewed']['organizer']['name'] = ! empty( $data['bsf-aiosrs-event-event-organizer-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-event-organizer-name'] ) : null;
if ( isset( $data['bsf-aiosrs-event-event-organizer-url'] ) && ! empty( $data['bsf-aiosrs-event-event-organizer-url'] ) ) {
$schema['itemReviewed']['organizer']['url'] = esc_url( $data['bsf-aiosrs-event-event-organizer-url'] );
}
}
break;
case 'bsf-aiosrs-local-business':
$schema['itemReviewed']['@type'] = 'LocalBusiness';
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-local-business-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-name'] ) : null;
if ( isset( $data['bsf-aiosrs-local-business-image'] ) && ! empty( $data['bsf-aiosrs-local-business-image'] ) ) {
$schema['itemReviewed']['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['bsf-aiosrs-local-business-image'] );
}
$schema['itemReviewed']['telephone'] = ! empty( $data['bsf-aiosrs-local-business-telephone'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-telephone'] ) : null;
if ( ( isset( $data['bsf-aiosrs-local-business-location-street'] ) && ! empty( $data['bsf-aiosrs-local-business-location-street'] ) ) ||
( isset( $data['bsf-aiosrs-local-business-location-locality'] ) && ! empty( $data['bsf-aiosrs-local-business-location-locality'] ) ) ||
( isset( $data['bsf-aiosrs-local-business-location-postal'] ) && ! empty( $data['bsf-aiosrs-local-business-location-postal'] ) ) ||
( isset( $data['bsf-aiosrs-local-business-location-region'] ) && ! empty( $data['bsf-aiosrs-local-business-location-region'] ) ) ||
( isset( $data['bsf-aiosrs-local-business-location-country'] ) && ! empty( $data['bsf-aiosrs-local-business-location-country'] ) ) ) {
$schema['itemReviewed']['address']['@type'] = 'PostalAddress';
$schema['itemReviewed']['address']['streetAddress'] = ! empty( $data['bsf-aiosrs-local-business-location-street'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-location-street'] ) : null;
$schema['itemReviewed']['address']['addressLocality'] = ! empty( $data['bsf-aiosrs-local-business-location-locality'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-location-locality'] ) : null;
$schema['itemReviewed']['address']['postalCode'] = ! empty( $data['bsf-aiosrs-local-business-location-postal'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-location-postal'] ) : null;
$schema['itemReviewed']['address']['addressRegion'] = ! empty( $data['bsf-aiosrs-local-business-location-region'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-location-region'] ) : null;
$schema['itemReviewed']['address']['addressCountry'] = ! empty( $data['bsf-aiosrs-local-business-location-country'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-location-country'] ) : null;
}
$schema['itemReviewed']['priceRange'] = ! empty( $data['bsf-aiosrs-local-business-price-range'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-price-range'] ) : null;
break;
case 'bsf-aiosrs-recipe':
$schema['itemReviewed']['@type'] = 'Recipe';
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-recipe-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-name'] ) : null;
if ( isset( $data['bsf-aiosrs-recipe-image'] ) && ! empty( $data['bsf-aiosrs-recipe-image'] ) ) {
$schema['itemReviewed']['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['bsf-aiosrs-recipe-image'] );
}
if ( isset( $data['bsf-aiosrs-recipe-author'] ) && ! empty( $data['bsf-aiosrs-recipe-author'] ) ) {
$schema['itemReviewed']['author']['@type'] = 'Person';
$schema['itemReviewed']['author']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-author'] );
}
$schema['itemReviewed']['description'] = ! empty( $data['bsf-aiosrs-recipe-description'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-description'] ) : null;
$schema['itemReviewed']['prepTime'] = ! empty( $data['bsf-aiosrs-recipe-preperation-time'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-preperation-time'] ) : null;
$schema['itemReviewed']['cookTime'] = ! empty( $data['bsf-aiosrs-recipe-cook-time'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-cook-time'] ) : null;
$schema['itemReviewed']['keywords'] = ! empty( $data['bsf-aiosrs-recipe-recipe-keywords'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-recipe-keywords'] ) : null;
$schema['itemReviewed']['recipeCategory'] = ! empty( $data['bsf-aiosrs-recipe-recipe-category'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-recipe-category'] ) : null;
$schema['itemReviewed']['recipeCuisine'] = ! empty( $data['bsf-aiosrs-recipe-recipe-cuisine'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-recipe-cuisine'] ) : null;
if ( ( isset( $data['bsf-aiosrs-recipe-rating'] ) && ! empty( $data['bsf-aiosrs-recipe-rating'] ) ) ||
( isset( $data['review-count'] ) && ! empty( $data['review-count'] ) ) ) {
$schema['itemReviewed']['aggregateRating']['@type'] = 'AggregateRating';
$schema['itemReviewed']['aggregateRating']['ratingValue'] = ! empty( $data['bsf-aiosrs-recipe-rating'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-rating'] ) : null;
$schema['itemReviewed']['aggregateRating']['reviewCount'] = ! empty( $data['bsf-aiosrs-recipe-review-count'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-review-count'] ) : null;
}
if ( isset( $data['bsf-aiosrs-recipe-nutrition'] ) && ! empty( $data['bsf-aiosrs-recipe-nutrition'] ) ) {
$schema['itemReviewed']['nutrition']['@type'] = 'NutritionInformation';
$schema['itemReviewed']['nutrition']['calories'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-nutrition'] );
}
if ( isset( $data['bsf-aiosrs-recipe-ingredients'] ) && ! empty( $data['bsf-aiosrs-recipe-ingredients'] ) ) {
$recipe_ingredients = explode( ',', $data['bsf-aiosrs-recipe-ingredients'] );
foreach ( $recipe_ingredients as $key => $value ) {
$schema['itemReviewed']['recipeIngredient'][ $key ] = wp_strip_all_tags( (string) $value );
}
}
if ( isset( $data['bsf-aiosrs-recipe-recipe-instructions'] ) && ! empty( $data['bsf-aiosrs-recipe-recipe-instructions'] ) ) {
$recipe_instructions = explode( ',', $data['bsf-aiosrs-recipe-recipe-instructions'] );
foreach ( $recipe_instructions as $key => $value ) {
if ( isset( $value ) && ! empty( $value ) ) {
$schema['itemReviewed']['recipeInstructions'][ $key ]['@type'] = 'HowToStep';
$schema['itemReviewed']['recipeInstructions'][ $key ]['text'] = wp_strip_all_tags( (string) $value );
}
}
}
if ( isset( $data['bsf-aiosrs-recipe-video-name'] ) && ! empty( $data['bsf-aiosrs-recipe-video-name'] ) ) {
$schema['itemReviewed']['video']['@type'] = 'VideoObject';
$schema['itemReviewed']['video']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-video-name'] );
$schema['itemReviewed']['video']['description'] = ! empty( $data['bsf-aiosrs-recipe-video-desc'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-video-desc'] ) : null;
if ( isset( $data['bsf-aiosrs-recipe-video-image'] ) && ! empty( $data['bsf-aiosrs-recipe-video-image'] ) ) {
$schema['itemReviewed']['video']['thumbnailUrl'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['bsf-aiosrs-recipe-video-image'] );
}
if ( isset( $data['bsf-aiosrs-recipe-recipe-video-content-url'] ) && ! empty( $data['bsf-aiosrs-recipe-recipe-video-content-url'] ) ) {
$schema['itemReviewed']['video']['contentUrl'] = esc_url( $data['bsf-aiosrs-recipe-recipe-video-content-url'] );
}
if ( isset( $data['bsf-aiosrs-recipe-recipe-video-embed-url'] ) && ! empty( $data['bsf-aiosrs-recipe-recipe-video-embed-url'] ) ) {
$schema['itemReviewed']['video']['embedUrl'] = esc_url( $data['bsf-aiosrs-recipe-recipe-video-embed-url'] );
}
$schema['itemReviewed']['video']['duration'] = ! empty( $data['bsf-aiosrs-recipe-recipe-video-duration'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-recipe-video-duration'] ) : null;
$schema['itemReviewed']['video']['uploadDate'] = ! empty( $data['bsf-aiosrs-recipe-recipe-video-upload-date'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-recipe-video-upload-date'] ) : null;
$schema['itemReviewed']['video']['interactionCount'] = ! empty( $data['bsf-aiosrs-recipe-recipe-video-interaction-count'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-recipe-video-interaction-count'] ) : null;
$schema['itemReviewed']['video']['expires'] = ! empty( $data['bsf-aiosrs-recipe-recipe-video-expires-date'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-recipe-video-expires-date'] ) : null;
}
break;
case 'bsf-aiosrs-software-application':
$schema['itemReviewed']['@type'] = 'SoftwareApplication';
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-software-application-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-software-application-name'] ) : null;
$schema['itemReviewed']['operatingSystem'] = ! empty( $data['bsf-aiosrs-software-application-operating-system'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-software-application-operating-system'] ) : null;
$schema['itemReviewed']['applicationCategory'] = ! empty( $data['bsf-aiosrs-software-application-category'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-software-application-category'] ) : null;
if ( ( isset( $data['bsf-aiosrs-software-application-rating'] ) && ! empty( $data['bsf-aiosrs-software-application-rating'] ) ) ||
( isset( $data['bsf-aiosrs-software-application-review-count'] ) && ! empty( $data['bsf-aiosrs-software-application-review-count'] ) ) ) {
$schema['itemReviewed']['aggregateRating']['@type'] = 'AggregateRating';
$schema['itemReviewed']['aggregateRating']['ratingValue'] = ! empty( $data['bsf-aiosrs-software-application-rating'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-software-application-rating'] ) : null;
$schema['itemReviewed']['aggregateRating']['reviewCount'] = ! empty( $data['bsf-aiosrs-software-application-review-count'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-software-application-review-count'] ) : null;
}
if ( true === apply_filters( 'wp_schema_pro_remove_software_application_offers_review_type', true ) ) {
$schema['itemReviewed']['offers']['@type'] = 'Offer';
$schema['itemReviewed']['offers']['price'] = '0';
$schema['itemReviewed']['offers']['price'] = ! empty( $data['bsf-aiosrs-software-application-price'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-software-application-price'] ) : null;
$schema['itemReviewed']['offers']['priceCurrency'] = ! empty( $data['bsf-aiosrs-software-application-currency'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-software-application-currency'] ) : null;
}
break;
case 'bsf-aiosrs-product':
$schema['itemReviewed']['@type'] = 'product';
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-product-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-name'] ) : null;
if ( isset( $data['bsf-aiosrs-product-image'] ) && ! empty( $data['bsf-aiosrs-product-image'] ) ) {
$schema['itemReviewed']['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['bsf-aiosrs-product-image'] );
}
$schema['itemReviewed']['description'] = ! empty( $data['bsf-aiosrs-product-description'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-description'] ) : null;
$schema['itemReviewed']['sku'] = ! empty( $data['bsf-aiosrs-product-sku'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-sku'] ) : null;
$schema['itemReviewed']['mpn'] = ! empty( $data['bsf-aiosrs-product-mpn'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-mpn'] ) : null;
if ( isset( $data['bsf-aiosrs-product-brand-name'] ) && ! empty( $data['bsf-aiosrs-product-brand-name'] ) ) {
$schema['itemReviewed']['brand']['@type'] = 'Organization';
$schema['itemReviewed']['brand']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-product-brand-name'] );
}
if ( ( isset( $data['bsf-aiosrs-product-rating'] ) && ! empty( $data['bsf-aiosrs-product-rating'] ) ) ||
( isset( $data['bsf-aiosrs-product-review-count'] ) && ! empty( $data['bsf-aiosrs-product-review-count'] ) ) ) {
$schema['itemReviewed']['aggregateRating']['@type'] = 'AggregateRating';
$schema['itemReviewed']['aggregateRating']['ratingValue'] = ! empty( $data['bsf-aiosrs-product-rating'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-rating'] ) : null;
$schema['itemReviewed']['aggregateRating']['reviewCount'] = ! empty( $data['bsf-aiosrs-product-review-count'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-review-count'] ) : null;
}
if ( apply_filters( 'wp_schema_pro_remove_product_offers', true ) ) {
$schema['itemReviewed']['offers']['@type'] = 'Offer';
$schema['itemReviewed']['offers']['price'] = '0';
$schema['itemReviewed']['offers']['price'] = ! empty( $data['bsf-aiosrs-product-price'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-price'] ) : null;
$schema['itemReviewed']['offers']['priceValidUntil'] = ! empty( $data['bsf-aiosrs-product-price-valid-until'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-price-valid-until'] ) : null;
$schema['itemReviewed']['offers']['url'] = get_permalink( $post['ID'] );
if ( ( isset( $data['bsf-aiosrs-product-currency'] ) && ! empty( $data['bsf-aiosrs-product-currency'] ) ) ||
( isset( $data['bsf-aiosrs-product-avail'] ) && ! empty( $data['bsf-aiosrs-product-avail'] ) ) ) {
$schema['itemReviewed']['offers']['priceCurrency'] = ! empty( $data['bsf-aiosrs-product-currency'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-currency'] ) : null;
$schema['itemReviewed']['offers']['availability'] = ! empty( $data['bsf-aiosrs-product-avail'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-avail'] ) : null;
}
}
break;
case 'bsf-aiosrs-movie':
$schema['itemReviewed']['@type'] = 'Movie';
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-movie-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-movie-name'] ) : null;
$schema['itemReviewed']['sameAs'] = ! empty( $data['bsf-aiosrs-movie-same-As'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-movie-same-As'] ) : null;
if ( isset( $data['bsf-aiosrs-movie-image'] ) && ! empty( $data['bsf-aiosrs-movie-image'] ) ) {
$schema['itemReviewed']['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['bsf-aiosrs-movie-image'] );
}
$schema['itemReviewed']['dateCreated'] = ! empty( $data['bsf-aiosrs-movie-dateCreated'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-movie-dateCreated'] ) : null;
if ( isset( $data['bsf-aiosrs-movie-director-name'] ) && ! empty( $data['bsf-aiosrs-movie-director-name'] ) ) {
$schema['itemReviewed']['director']['@type'] = 'Person';
$schema['itemReviewed']['director']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-movie-director-name'] );
}
$schema['description'] = ! empty( $data['bsf-aiosrs-movie-description'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-movie-description'] ) : null;
break;
case 'bsf-aiosrs-organization':
$schema['itemReviewed']['@type'] = 'Organization';
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-organization-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-organization-name'] ) : null;
if ( ( isset( $data['bsf-aiosrs-organization-location-street'] ) && ! empty( $data['bsf-aiosrs-organization-location-street'] ) ) ||
( isset( $data['bsf-aiosrs-organization-location-locality'] ) && ! empty( $data['bsf-aiosrs-organization-location-locality'] ) ) ||
( isset( $data['bsf-aiosrs-organization-location-postal'] ) && ! empty( $data['bsf-aiosrs-organization-location-postal'] ) ) ||
( isset( $data['bsf-aiosrs-organization-location-region'] ) && ! empty( $data['bsf-aiosrs-organization-location-region'] ) ) ||
( isset( $data['bsf-aiosrs-organization-location-country'] ) && ! empty( $data['bsf-aiosrs-organization-location-country'] ) ) ) {
$schema['itemReviewed']['address']['@type'] = 'PostalAddress';
$schema['itemReviewed']['address']['streetAddress'] = ! empty( $data['bsf-aiosrs-organization-location-street'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-organization-location-street'] ) : null;
$schema['itemReviewed']['address']['addressLocality'] = ! empty( $data['bsf-aiosrs-organization-location-locality'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-organization-location-locality'] ) : null;
$schema['itemReviewed']['address']['postalCode'] = ! empty( $data['bsf-aiosrs-organization-location-postal'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-organization-location-postal'] ) : null;
$schema['itemReviewed']['address']['addressRegion'] = ! empty( $data['bsf-aiosrs-organization-location-region'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-organization-location-region'] ) : null;
$schema['itemReviewed']['address']['addressCountry'] = ! empty( $data['bsf-aiosrs-organization-location-country'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-organization-location-country'] ) : null;
}
break;
default:
break;
}
/*Review schema fields*/
if ( isset( $data['rating'] ) && ! empty( $data['rating'] ) ) {
$schema['reviewRating']['@type'] = 'Rating';
$schema['reviewRating']['ratingValue'] = wp_strip_all_tags( (string) $data['rating'] );
}
$schema['reviewBody'] = ! empty( $data['review-body'] ) ? wp_strip_all_tags( (string) $data['review-body'] ) : null;
$schema['datePublished'] = ! empty( $data['date'] ) ? wp_strip_all_tags( (string) $data['date'] ) : null;
$schema['author']['@type'] = ! empty( $data['reviewer-type'] ) ? wp_strip_all_tags( (string) $data['reviewer-type'] ) : 'Person';
if ( isset( $data['reviewer-name'] ) && ! empty( $data['reviewer-name'] ) ) {
$schema['author']['name'] = wp_strip_all_tags( (string) $data['reviewer-name'] );
$author_data = get_userdata( $post['post_author'] );
$author_name = ( isset( $author_data->user_nicename ) ) ? $author_data->user_nicename : '';
$author_url = get_author_posts_url( $post['ID'] );
$final_url = $author_url . '' . $author_name;
$is_available = true;
$schema['author']['sameAs'] = esc_url( $final_url );
}
if ( isset( $data['publisher-name'] ) && ! empty( $data['publisher-name'] ) ) {
$schema['publisher']['@type'] = 'Organization';
$schema['publisher']['name'] = wp_strip_all_tags( (string) $data['publisher-name'] );
$prg_url_value = get_bloginfo( 'url' );
$schema['publisher']['sameAs'] = esc_url( $prg_url_value );
}
return apply_filters( 'wp_schema_pro_schema_review', $schema, $data, $post );
}
}
}

View File

@@ -1,77 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Service' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_Service {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'Service';
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
$schema['serviceType'] = ! empty( $data['type'] ) ? wp_strip_all_tags( (string) $data['type'] ) : null;
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
}
if ( ( isset( $data['provider'] ) && ! empty( $data['provider'] ) ) ||
( isset( $data['location-image'] ) && ! empty( $data['location-image'] ) ) ||
( isset( $data['telephone'] ) && ! empty( $data['telephone'] ) ) ||
( isset( $data['price-range'] ) && ! empty( $data['price-range'] ) ) ) {
$schema['provider']['@type'] = 'LocalBusiness';
$schema['provider']['name'] = ! empty( $data['provider'] ) ? wp_strip_all_tags( (string) $data['provider'] ) : null;
if ( isset( $data['location-image'] ) && ! empty( $data['location-image'] ) ) {
$schema['provider']['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['location-image'] );
}
$schema['provider']['telephone'] = ! empty( $data['telephone'] ) ? wp_strip_all_tags( (string) $data['telephone'] ) : null;
$schema['provider']['priceRange'] = ! empty( $data['price-range'] ) ? wp_strip_all_tags( (string) $data['price-range'] ) : null;
}
if ( ( isset( $data['location-locality'] ) && ! empty( $data['location-locality'] ) ) ||
( isset( $data['location-region'] ) && ! empty( $data['location-region'] ) ) ||
( isset( $data['location-street'] ) && ! empty( $data['location-street'] ) ) ) {
$schema['provider']['@type'] = 'LocalBusiness';
$schema['provider']['address']['@type'] = 'PostalAddress';
$schema['provider']['address']['addressLocality'] = ! empty( $data['location-locality'] ) ? wp_strip_all_tags( (string) $data['location-locality'] ) : null;
$schema['provider']['address']['addressRegion'] = ! empty( $data['location-region'] ) ? wp_strip_all_tags( (string) $data['location-region'] ) : null;
$schema['provider']['address']['streetAddress'] = ! empty( $data['location-street'] ) ? wp_strip_all_tags( (string) $data['location-street'] ) : null;
}
if ( isset( $data['area'] ) && ! empty( $data['area'] ) ) {
$schema['areaServed']['@type'] = 'State';
$schema['areaServed']['name'] = wp_strip_all_tags( (string) $data['area'] );
}
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
return apply_filters( 'wp_schema_pro_schema_service', $schema, $data, $post );
}
}
}

View File

@@ -1,61 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Software_Application' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_Software_Application {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'SoftwareApplication';
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
$schema['operatingSystem'] = ! empty( $data['operating-system'] ) ? wp_strip_all_tags( (string) $data['operating-system'] ) : null;
$schema['applicationCategory'] = ! empty( $data['category'] ) ? wp_strip_all_tags( (string) $data['category'] ) : null;
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
}
if ( ( isset( $data['rating'] ) && ! empty( $data['rating'] ) ) ||
( isset( $data['review-count'] ) && ! empty( $data['review-count'] ) ) ) {
$schema['aggregateRating']['@type'] = 'AggregateRating';
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string) $data['rating'] ) : null;
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( (string) $data['review-count'] ) : 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']['priceCurrency'] = ! empty( $data['currency'] ) ? wp_strip_all_tags( (string) $data['currency'] ) : null;
return apply_filters( 'wp_schema_pro_schema_software_application', $schema, $data, $post );
}
}
}

View File

@@ -1,106 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.0.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Video_Object' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.0.0
*/
class BSF_AIOSRS_Pro_Schema_Video_Object {
/**
* Render Schema.
*
* @param array $data Meta Data.
* @param array $post Current Post Array.
* @return array
*/
public static function render( $data, $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'VideoObject';
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
if ( isset( $data['orgnization-name'] ) && ! empty( $data['orgnization-name'] ) ) {
$schema['publisher']['@type'] = 'Organization';
$schema['publisher']['name'] = wp_strip_all_tags( (string) $data['orgnization-name'] );
}
if ( isset( $data['site-logo'] ) && ! empty( $data['site-logo'] ) ) {
$schema['publisher']['@type'] = 'Organization';
$schema['publisher']['logo'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['site-logo'], 'ImageObject' );
}
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
$schema['thumbnailUrl'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'], 'URL' );
}
$schema['uploadDate'] = ! empty( $data['upload-date'] ) ? wp_strip_all_tags( (string) $data['upload-date'] ) : null;
$schema['duration'] = ! empty( $data['duration'] ) ? wp_strip_all_tags( (string) $data['duration'] ) : null;
if ( isset( $data['content-url'] ) && ! empty( $data['content-url'] ) ) {
$schema['contentUrl'] = esc_url( $data['content-url'] );
}
if ( isset( $data['embed-url'] ) && ! empty( $data['embed-url'] ) ) {
$schema['embedUrl'] = esc_url( $data['embed-url'] );
}
$schema['expires'] = ! empty( $data['expires-date'] ) ? wp_strip_all_tags( (string) $data['expires-date'] ) : null;
if ( isset( $data['interaction-count'] ) && ! empty( $data['interaction-count'] ) ) {
$schema['interactionStatistic']['@type'] = 'InteractionCounter';
$schema['interactionStatistic']['interactionType']['@type'] = 'WatchAction';
$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'] );
}
}
if ( isset( $data['seekto-action-start-offset'] ) && ! empty( $data['seekto-action-start-offset'] ) && isset( $data['content-url'] ) ) {
$schema['potentialAction']['@type'] = 'SeekToAction';
$schema['potentialAction']['target'] = esc_url( $data['seekto-action-target'] ) . '?t={seek_to_second_number}';
$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

@@ -1,81 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.1.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_About_Page' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.1.0
*/
class BSF_AIOSRS_Pro_Schema_Global_About_Page {
/**
* Render Schema.
*
* @param array $post Current Post Array.
* @return array
*/
public static function render( $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'AboutPage';
$schema['mainEntityOfPage']['@type'] = 'WebPage';
$schema['mainEntityOfPage']['@id'] = esc_url( get_permalink( $post['ID'] ) );
$schema['headline'] = wp_strip_all_tags( $post['post_title'] );
$schema['description'] = BSF_AIOSRS_Pro_Schema_Template::strip_markup( $post['post_content'] );
$image_id = get_post_thumbnail_id( $post['ID'] );
if ( ! empty( $image_id ) ) {
$thumb_image = wp_get_attachment_image_src( $image_id, 'full' );
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $thumb_image );
}
$settings = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-general-settings'];
if ( 'person' === $settings['site-represent'] || 'personblog' === $settings['site-represent'] ) {
$settings['site-represent'] = 'person';
}
if ( 'organization' === $settings['site-represent'] || 'Webshop' === $settings['site-represent'] || 'Smallbusiness' === $settings['site-represent'] || 'Otherbusiness' === $settings['site-represent'] ) {
$settings['site-represent'] = 'organization';
}
$schema['publisher']['@type'] = ( isset( $settings['site-represent'] ) && ! empty( $settings['site-represent'] ) ) ? $settings['site-represent'] : 'Organization';
if ( 'organization' === $settings['site-represent'] ) {
$schema['publisher']['name'] = ( isset( $settings['site-name'] ) && ! empty( $settings['site-name'] ) ) ? $settings['site-name'] : wp_strip_all_tags( get_bloginfo( 'name' ) );
} else {
$schema['publisher']['name'] = ( isset( $settings['person-name'] ) && ! empty( $settings['person-name'] ) ) ? $settings['person-name'] : wp_strip_all_tags( get_bloginfo( 'name' ) );
}
$schema['publisher']['url'] = wp_strip_all_tags( get_bloginfo( 'url' ) );
if ( 'organization' === $settings['site-represent'] ) {
$logo_id = get_theme_mod( 'custom_logo' );
if ( isset( $settings['site-logo'] ) && 'custom' === $settings['site-logo'] ) {
$logo_id = isset( $settings['site-logo-custom'] ) ? $settings['site-logo-custom'] : '';
}
if ( $logo_id ) {
// Add logo image size.
add_filter( 'intermediate_image_sizes_advanced', 'BSF_AIOSRS_Pro_Schema_Template::logo_image_sizes', 10, 2 );
$logo_image = wp_get_attachment_image_src( $logo_id, 'aiosrs-logo-size' );
if ( isset( $logo_image[3] ) && 1 !== $logo_image[3] ) {
BSF_AIOSRS_Pro_Schema_Template::generate_logo_by_width( $logo_id );
$logo_image = wp_get_attachment_image_src( $logo_id, 'aiosrs-logo-size' );
}
// Remove logo image size.
remove_filter( 'intermediate_image_sizes_advanced', 'BSF_AIOSRS_Pro_Schema_Template::logo_image_sizes', 10, 2 );
$schema['publisher']['logo'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $logo_image, 'ImageObject' );
}
}
return apply_filters( 'wp_schema_pro_global_schema_about_page', $schema, $post );
}
}
}

View File

@@ -1,42 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.1.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Breadcrumb' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.1.0
*/
class BSF_AIOSRS_Pro_Schema_Global_Breadcrumb {
/**
* Render Schema.
*
* @param array $post Current Post Array.
* @return array
*/
public static function render( $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'BreadcrumbList';
$breadcrumb_list = BSF_AIOSRS_Pro_Schema_Template::get_breadcrumb_list();
foreach ( $breadcrumb_list as $key => $breadcrumb ) {
$schema['itemListElement'][ $key ]['@type'] = 'ListItem';
$schema['itemListElement'][ $key ]['position'] = $key + 1;
$schema['itemListElement'][ $key ]['item']['@id'] = esc_url( $breadcrumb['url'] );
$schema['itemListElement'][ $key ]['item']['name'] = $breadcrumb['title'];
}
return apply_filters( 'wp_schema_pro_global_schema_breadcrumb', $schema, $post );
}
}
}

View File

@@ -1,81 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.1.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Contact_Page' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.1.0
*/
class BSF_AIOSRS_Pro_Schema_Global_Contact_Page {
/**
* Render Schema.
*
* @param array $post Current Post Array.
* @return array
*/
public static function render( $post ) {
$schema = array();
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'ContactPage';
$schema['mainEntityOfPage']['@type'] = 'WebPage';
$schema['mainEntityOfPage']['@id'] = esc_url( get_permalink( $post['ID'] ) );
$schema['headline'] = wp_strip_all_tags( $post['post_title'] );
$schema['description'] = BSF_AIOSRS_Pro_Schema_Template::strip_markup( $post['post_content'] );
$image_id = get_post_thumbnail_id( $post['ID'] );
if ( ! empty( $image_id ) ) {
$thumb_image = wp_get_attachment_image_src( $image_id, 'full' );
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $thumb_image );
}
$settings = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-general-settings'];
if ( 'person' === $settings['site-represent'] || 'personblog' === $settings['site-represent'] ) {
$settings['site-represent'] = 'person';
}
if ( 'organization' === $settings['site-represent'] || 'Webshop' === $settings['site-represent'] || 'Smallbusiness' === $settings['site-represent'] || 'Otherbusiness' === $settings['site-represent'] ) {
$settings['site-represent'] = 'organization';
}
$schema['publisher']['@type'] = ( isset( $settings['site-represent'] ) && ! empty( $settings['site-represent'] ) ) ? $settings['site-represent'] : 'Organization';
if ( 'organization' === $settings['site-represent'] ) {
$schema['publisher']['name'] = ( isset( $settings['site-name'] ) && ! empty( $settings['site-name'] ) ) ? $settings['site-name'] : wp_strip_all_tags( get_bloginfo( 'name' ) );
} else {
$schema['publisher']['name'] = ( isset( $settings['person-name'] ) && ! empty( $settings['person-name'] ) ) ? $settings['person-name'] : wp_strip_all_tags( get_bloginfo( 'name' ) );
}
$schema['publisher']['url'] = wp_strip_all_tags( get_bloginfo( 'url' ) );
if ( 'organization' === $settings['site-represent'] ) {
$logo_id = get_theme_mod( 'custom_logo' );
if ( isset( $settings['site-logo'] ) && 'custom' === $settings['site-logo'] ) {
$logo_id = isset( $settings['site-logo-custom'] ) ? $settings['site-logo-custom'] : '';
}
if ( $logo_id ) {
// Add logo image size.
add_filter( 'intermediate_image_sizes_advanced', 'BSF_AIOSRS_Pro_Schema_Template::logo_image_sizes', 10, 2 );
$logo_image = wp_get_attachment_image_src( $logo_id, 'aiosrs-logo-size' );
if ( isset( $logo_image[3] ) && 1 !== $logo_image[3] ) {
BSF_AIOSRS_Pro_Schema_Template::generate_logo_by_width( $logo_id );
$logo_image = wp_get_attachment_image_src( $logo_id, 'aiosrs-logo-size' );
}
// Remove logo image size.
remove_filter( 'intermediate_image_sizes_advanced', 'BSF_AIOSRS_Pro_Schema_Template::logo_image_sizes', 10, 2 );
$schema['publisher']['logo'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $logo_image, 'ImageObject' );
}
}
return apply_filters( 'wp_schema_pro_global_schema_contact_page', $schema, $post );
}
}
}

View File

@@ -1,111 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.1.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Organization' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.1.0
*/
class BSF_AIOSRS_Pro_Schema_Global_Organization {
/**
* Render Schema.
*
* @param array $post Current Post Array.
* @return array
*/
public static function render( $post ) {
$schema = array();
$general_settings = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-general-settings'];
$social_profiles = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-social-profiles'];
$contact_type = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-corporate-contact'];
$contact_hear = isset( $contact_type['contact-hear'] ) ? $contact_type['contact-hear'] : '';
$contact_toll = isset( $contact_type['contact-toll'] ) ? $contact_type['contact-toll'] : '';
$contactpoint = array( $contact_hear, $contact_toll );
$schema['@context'] = 'https://schema.org';
$schema['@type'] = ( isset( $general_settings['organization'] ) && ! empty( $general_settings['organization'] ) ) ? $general_settings['organization'] : 'organization';
$schema['name'] = ( isset( $general_settings['site-name'] ) && ! empty( $general_settings['site-name'] ) ) ? $general_settings['site-name'] : wp_strip_all_tags( get_bloginfo( 'name' ) );
$schema['url'] = wp_strip_all_tags( get_bloginfo( 'url' ) );
if ( isset( $contact_type['contact-type'] ) && ! empty( $contact_type['contact-type'] ) || isset( $contact_type['telephone'] ) && ! empty( $contact_type['telephone'] ) || isset( $contact_type['contact-page-id'] ) && ! empty( $contact_type['contact-page-id'] ) ) {
$schema['ContactPoint']['@type'] = 'ContactPoint';
if ( isset( $contact_type['contact-type'] ) && ! empty( $contact_type['contact-type'] ) ) {
if ( 'other' === $contact_type['contact-type'] ) {
$schema ['ContactPoint']['contactType'] = $contact_type['contact-type-other'];
} else {
$schema ['ContactPoint']['contactType'] = $contact_type['contact-type'];
}
}
if ( isset( $contact_type['telephone'] ) && ! empty( $contact_type['telephone'] ) ) {
$schema ['ContactPoint']['telephone'] = $contact_type['telephone'];
}
if ( isset( $contact_type['contact-page-id'] ) && ! empty( $contact_type['contact-page-id'] ) ) {
$page_url = get_permalink( $contact_type['contact-page-id'] );
$schema ['ContactPoint']['url'] = $page_url;
} else {
$schema ['ContactPoint']['url'] = $contact_type['contact-page-id'];
}
if ( isset( $contact_type['email'] ) && ! empty( $contact_type['email'] ) ) {
$schema ['ContactPoint']['email'] = $contact_type['email'];
}
if ( isset( $contactpoint ) && ! empty( $contactpoint ) ) {
$schema ['ContactPoint']['contactOption'] = $contactpoint;
}
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( $value );
}
}
if ( isset( $contact_type['availableLanguage'] ) && ! empty( $contact_type['availableLanguage'] ) ) {
$language = explode( ',', $contact_type['availableLanguage'] );
foreach ( $language as $key => $value ) {
$schema ['ContactPoint']['availableLanguage'][ $key ] = wp_strip_all_tags( $value );
}
} else {
$schema ['ContactPoint']['availableLanguage'] = 'English';
}
}
$logo_id = get_post_thumbnail_id( $post['ID'] );
if ( isset( $general_settings['site-logo-custom'] ) ) {
$logo_id = isset( $general_settings['site-logo-custom'] ) ? $general_settings['site-logo-custom'] : '';
} elseif ( isset( $general_settings['site-logo'] ) && 'customizer-logo' === $general_settings['site-logo'] ) {
if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
$logo_id = get_theme_mod( 'custom_logo' );
}
}
if ( $logo_id ) {
$key = 'site-logo';
$logo_image = BSF_AIOSRS_Pro_Schema_Template::get_image_object( $logo_id, $key );
$schema['logo'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $logo_image, 'ImageObject' );
}
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;
}
}
}
if ( ! empty( $social_link ) && ! is_array( $social_link ) ) {
$schema['sameAs'][] = $social_link;
}
}
return apply_filters( 'wp_schema_pro_global_schema_organization', $schema, $post );
}
}
}

View File

@@ -1,74 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.1.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Person' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.1.0
*/
class BSF_AIOSRS_Pro_Schema_Global_Person {
/**
* Render Schema.
*
* @param array $post Current Post Array.
* @return array
*/
public static function render( $post ) {
$schema = array();
$general_settings = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-general-settings'];
$social_profiles = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-social-profiles'];
$contact_type = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-corporate-contact'];
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'Person';
$schema['name'] = ( isset( $general_settings['person-name'] ) && ! empty( $general_settings['person-name'] ) ) ? $general_settings['person-name'] : wp_strip_all_tags( get_bloginfo( 'name' ) );
$schema['url'] = wp_strip_all_tags( get_bloginfo( 'url' ) );
if ( isset( $contact_type['contact-type'] ) && ! empty( $contact_type['contact-type'] ) || isset( $contact_type['telephone'] ) && ! empty( $contact_type['telephone'] ) || isset( $contact_type['contact-page-id'] ) && ! empty( $contact_type['contact-page-id'] ) ) {
$schema['ContactPoint']['@type'] = 'ContactPoint';
if ( isset( $contact_type['contact-type'] ) && ! empty( $contact_type['contact-type'] ) ) {
if ( 'other' === $contact_type['contact-type'] ) {
$schema ['ContactPoint']['contactType'] = $contact_type['contact-type-other'];
} else {
$schema ['ContactPoint']['contactType'] = $contact_type['contact-type'];
}
}
if ( isset( $contact_type['telephone'] ) && ! empty( $contact_type['telephone'] ) ) {
$schema ['ContactPoint']['telephone'] = $contact_type['telephone'];
}
if ( isset( $contact_type['contact-page-id'] ) && ! empty( $contact_type['contact-page-id'] ) ) {
$page_url = get_permalink( $contact_type['contact-page-id'] );
$schema ['ContactPoint']['url'] = $page_url;
} else {
$schema ['ContactPoint']['url'] = $contact_type['contact-page-id'];
}
}
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;
}
}
}
}
return apply_filters( 'wp_schema_pro_global_schema_person', $schema, $post );
}
}
}

View File

@@ -1,70 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.1.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Site_Navigation_Element' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.1.0
*/
class BSF_AIOSRS_Pro_Schema_Global_Site_Navigation_Element {
/**
* Render Schema.
*
* @param array $post Current Post Array.
* @return array
*/
public static function render( $post ) {
$schema = array();
$names = array();
$urls = array();
$settings = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-global-schemas'];
if ( isset( $settings['site-navigation-element'] ) && ! empty( $settings['site-navigation-element'] ) ) {
$navigation_links = wp_get_nav_menu_items( $settings['site-navigation-element'] );
if ( $navigation_links ) {
foreach ( $navigation_links as $link ) {
$names[] = wp_strip_all_tags( $link->title );
$urls[] = esc_url( $link->url );
}
}
}
/**
* Convert normal array into associative array
*/
$combine_array = array_combine( $names, $urls );
$new_arr[] = array();
$j = 0;
foreach ( $combine_array as $key => $value ) {
$new_arr[ $j ]['name'] = $key;
$new_arr[ $j ]['url'] = $value;
$j++;
}
$schema['@context'] = 'https://schema.org';
if ( isset( $new_arr ) && ! empty( $new_arr ) ) {
foreach ( $new_arr as $key2 => $value2 ) {
$schema['@graph'][ $key2 ]['@context'] = 'https://schema.org';
$schema['@graph'][ $key2 ]['@type'] = 'SiteNavigationElement';
$schema['@graph'][ $key2 ]['id'] = 'site-navigation';
$schema['@graph'][ $key2 ]['name'] = isset( $value2['name'] ) ? $value2['name'] : '';
$schema['@graph'][ $key2 ]['url'] = isset( $value2['url'] ) ? $value2['url'] : '';
}
}
return apply_filters( 'wp_schema_pro_global_schema_site_navigation_element', $schema, $post );
}
}
}

View File

@@ -1,50 +0,0 @@
<?php
/**
* Schemas Template.
*
* @package Schema Pro
* @since 1.1.0
*/
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Sitelink_Search_Box' ) ) {
/**
* AIOSRS Schemas Initialization
*
* @since 1.1.0
*/
class BSF_AIOSRS_Pro_Schema_Global_Sitelink_Search_Box {
/**
* Render Schema.
*
* @param array $post Current Post Array.
* @return array
*/
public static function render( $post ) {
$schema = array();
$general_settings = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-general-settings'];
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'WebSite';
$schema['name'] = ( isset( $general_settings['site-name'] ) && ! empty( $general_settings['site-name'] ) ) ? $general_settings['site-name'] : wp_strip_all_tags( get_bloginfo( 'name' ) );
$schema['url'] = home_url();
$potential_action = array();
$template_urls = apply_filters( 'wp_schema_pro_sitelink_srearch_box_template_urls', array( site_url( '?s=' ) ) );
foreach ( $template_urls as $template_url ) {
$potential_action[] = array(
'@type' => 'SearchAction',
'target' => esc_url( $template_url ) . '{search_term_string}',
'query-input' => 'required name=search_term_string',
);
}
$schema['potentialAction'] = $potential_action;
return apply_filters( 'wp_schema_pro_global_schema_sitelink_search_box', $schema, $post );
}
}
}