rebase on oct-10-2023

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

View File

@@ -28,9 +28,7 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Person' ) ) {
$schema['@context'] = 'https://schema.org';
$schema['@type'] = 'Person';
if ( isset( $data['name'] ) && ! empty( $data['name'] ) ) {
$schema['name'] = wp_strip_all_tags( $data['name'] );
}
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
if ( ( isset( $data['street'] ) && ! empty( $data['street'] ) ) ||
( isset( $data['locality'] ) && ! empty( $data['locality'] ) ) ||
@@ -39,55 +37,35 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Person' ) ) {
$schema['address']['@type'] = 'PostalAddress';
if ( isset( $data['locality'] ) && ! empty( $data['locality'] ) ) {
$schema['address']['addressLocality'] = wp_strip_all_tags( $data['locality'] );
}
$schema['address']['addressLocality'] = ! empty( $data['locality'] ) ? wp_strip_all_tags( (string)$data['locality'] ) : NULL;
if ( isset( $data['region'] ) && ! empty( $data['region'] ) ) {
$schema['address']['addressRegion'] = wp_strip_all_tags( $data['region'] );
}
$schema['address']['addressRegion'] = ! empty( $data['region'] ) ? wp_strip_all_tags( (string)$data['region'] ) : NULL;
if ( isset( $data['postal'] ) && ! empty( $data['postal'] ) ) {
$schema['address']['postalCode'] = wp_strip_all_tags( $data['postal'] );
}
$schema['address']['postalCode'] = ! empty( $data['postal'] ) ? wp_strip_all_tags( (string)$data['postal'] ) : NULL;
if ( isset( $data['street'] ) && ! empty( $data['street'] ) ) {
$schema['address']['streetAddress'] = wp_strip_all_tags( $data['street'] );
}
$schema['address']['streetAddress'] = ! empty( $data['street'] ) ? wp_strip_all_tags( (string)$data['street'] ) : NULL;
}
if ( isset( $data['email'] ) && ! empty( $data['email'] ) ) {
$schema['email'] = wp_strip_all_tags( $data['email'] );
}
$schema['email'] = ! empty( $data['email'] ) ? wp_strip_all_tags( (string)$data['email'] ) : NULL;
if ( isset( $data['gender'] ) && ! empty( $data['gender'] ) ) {
$schema['gender'] = wp_strip_all_tags( $data['gender'] );
}
$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( $date_informat );
$schema['birthDate'] = wp_strip_all_tags( (string)$date_informat );
}
if ( isset( $data['member'] ) && ! empty( $data['member'] ) ) {
$schema['memberOf'] = wp_strip_all_tags( $data['member'] );
}
$schema['memberOf'] = ! empty( $data['member'] ) ? wp_strip_all_tags( (string)$data['member'] ) : NULL;
if ( isset( $data['nationality'] ) && ! empty( $data['nationality'] ) ) {
$schema['nationality'] = wp_strip_all_tags( $data['nationality'] );
}
$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'] );
}
if ( isset( $data['job-title'] ) && ! empty( $data['job-title'] ) ) {
$schema['jobTitle'] = wp_strip_all_tags( $data['job-title'] );
}
$schema['jobTitle'] = ! empty( $data['job-title'] ) ? wp_strip_all_tags( (string)$data['job-title'] ) : NULL;
if ( isset( $data['telephone'] ) && ! empty( $data['telephone'] ) ) {
$schema['telephone'] = wp_strip_all_tags( $data['telephone'] );
}
$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'] );
@@ -108,30 +86,22 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Person' ) ) {
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';
if ( isset( $contact_type['contact-type'] ) && ! empty( $contact_type['contact-type'] ) ) {
$schema ['ContactPoint']['contactType'] = wp_strip_all_tags( $contact_type['contact-type'] );
}
if ( isset( $contact_type['telephone'] ) && ! empty( $contact_type['telephone'] ) ) {
$schema ['ContactPoint']['telephone'] = wp_strip_all_tags( $contact_type['telephone'] );
}
$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'] );
}
if ( isset( $contact_type['email'] ) && ! empty( $contact_type['email'] ) ) {
$schema ['ContactPoint']['email'] = wp_strip_all_tags( $contact_type['email'] );
}
$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( $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( $value );
}
if ( isset( $contact_type['availableLanguage'] ) && ! empty( $contact_type['availableLanguage'] ) ) {
$schema ['ContactPoint']['availableLanguage'] = wp_strip_all_tags( $contact_type['availableLanguage'] );
$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 );