auto-patch 748-dev-dev01-2024-06-08T22_32_58
This commit is contained in:
@@ -257,6 +257,7 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Markup' ) ) {
|
||||
}
|
||||
|
||||
$post_id = get_the_ID();
|
||||
$rating = '';
|
||||
if ( ! empty( $rating_enabled ) ) {
|
||||
ob_start();
|
||||
|
||||
@@ -305,10 +306,14 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Markup' ) ) {
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
$content .= ob_get_clean();
|
||||
$rating .= ob_get_clean();
|
||||
}
|
||||
|
||||
return $content;
|
||||
if(is_string( $content ) ) {
|
||||
return $content . $rating;
|
||||
} else {
|
||||
return $rating;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -677,12 +677,12 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'default' => 'none',
|
||||
'required' => true,
|
||||
),
|
||||
'course-mode' => array(
|
||||
'label' => esc_html__( 'Course Mode', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
'required' => true,
|
||||
'description' => esc_html__( 'The medium or means of delivery of the course instance or the mode of study, either as a text label (e.g. "online", "onsite" or "blended"; "synchronous" or "asynchronous"; "full-time" or "part-time") or as a URL reference to a term from a controlled vocabulary (e.g. https://ceds.ed.gov/element/001311#Asynchronous )', 'wp-schema-pro' ),
|
||||
'course-mode' => array(
|
||||
'label' => esc_html__( 'Course Mode', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'default' => 'custom-text',
|
||||
'dropdown-type' => 'course-attendance-mode',
|
||||
'required' => false,
|
||||
),
|
||||
'image' => array(
|
||||
'label' => esc_html__( 'Image', 'wp-schema-pro' ),
|
||||
@@ -697,15 +697,6 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'required' => true,
|
||||
'description' => esc_html__( 'The status of the Course Instance.', 'wp-schema-pro' ),
|
||||
|
||||
),
|
||||
'event-attendance-mode' => array(
|
||||
'label' => esc_html__( 'Course Attendance Mode', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'default' => 'custom-text',
|
||||
'dropdown-type' => 'event-attendance-mode',
|
||||
'required' => false,
|
||||
'description' => esc_html__( 'The location of the Course Instance. There are different requirements depending on if the Course is happening online or at a physical location.', 'wp-schema-pro' ),
|
||||
|
||||
),
|
||||
'start-date' => array(
|
||||
'label' => esc_html__( 'Start Date', 'wp-schema-pro' ),
|
||||
@@ -736,7 +727,7 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
),
|
||||
'course-workload' => array(
|
||||
'label' => esc_html__( 'Course Workload', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'type' => 'time-duration',
|
||||
'required' => true,
|
||||
'default' => 'none',
|
||||
),
|
||||
@@ -1552,58 +1543,162 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'guideline-link' => empty( $doc_link ) ? 'https://wpschema.com/docs/add-a-schema-markup-for-a-product-page/' : 'https://developers.google.com/search/docs/data-types/products',
|
||||
'path' => BSF_AIOSRS_PRO_DIR . 'classes/schema/',
|
||||
'subkeys' => array(
|
||||
'name' => array(
|
||||
'name' => array(
|
||||
'label' => esc_html__( 'Product Name', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'post_title',
|
||||
'required' => true,
|
||||
),
|
||||
'brand-name' => array(
|
||||
'brand-name' => array(
|
||||
'label' => esc_html__( 'Product Brand', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
),
|
||||
'image' => array(
|
||||
'image' => array(
|
||||
'label' => esc_html__( 'Product Image', 'wp-schema-pro' ),
|
||||
'type' => 'image',
|
||||
'default' => 'featured_img',
|
||||
'required' => true,
|
||||
),
|
||||
'url' => array(
|
||||
'url' => array(
|
||||
'label' => esc_html__( 'Product URL', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'post_permalink',
|
||||
),
|
||||
'description' => array(
|
||||
'description' => array(
|
||||
'label' => esc_html__( 'Product Description', 'wp-schema-pro' ),
|
||||
'type' => 'textarea',
|
||||
'default' => 'post_content',
|
||||
),
|
||||
'sku' => array(
|
||||
'sku' => array(
|
||||
'label' => esc_html__( 'Product SKU', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'create-field',
|
||||
'description' => esc_html__( 'The Stock Keeping Unit (SKU) is a unique numerical identifying number that refers to a specific stock item in a retailers inventory or product catalog.', 'wp-schema-pro' ),
|
||||
'description' => esc_html__( 'The Stock Keeping Unit (SKU) is a unique numerical identifying number that refers to a specific stock item in a retailer\'s inventory or product catalog.', 'wp-schema-pro' ),
|
||||
),
|
||||
'mpn' => array(
|
||||
'mpn' => array(
|
||||
'label' => esc_html__( 'Product MPN', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'create-field',
|
||||
'description' => esc_html__( 'The Manufacturer Part Number (MPN) of the product, or the product to which the offer refers. e.g. "925872"', 'wp-schema-pro' ),
|
||||
),
|
||||
'avail' => array(
|
||||
'avail' => array(
|
||||
'label' => esc_html__( 'Product Availability', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'default' => 'none',
|
||||
'dropdown-type' => 'availability',
|
||||
),
|
||||
'price-valid-until' => array(
|
||||
'merchant-return-policy' => array(
|
||||
'label' => esc_html__( 'Merchant Return Policy', 'wp-schema-pro' ),
|
||||
'type' => 'repeater',
|
||||
'fields' => array(
|
||||
'applicableCountry' => array(
|
||||
'label' => esc_html__( 'Applicable Country', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'US',
|
||||
),
|
||||
'returnPolicyCategory' => array(
|
||||
'label' => esc_html__( 'Return Policy Category', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'default' => 'none',
|
||||
'dropdown-type' => 'returnPolicyCategory',
|
||||
),
|
||||
'merchantReturnDays' => array(
|
||||
'label' => esc_html__( 'Merchant Return Days', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 30,
|
||||
),
|
||||
'returnFees' => array(
|
||||
'label' => esc_html__( 'Return Fees', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'default' => 'none',
|
||||
'dropdown-type' => 'returnFees',
|
||||
),
|
||||
'returnMethod' => array(
|
||||
'label' => esc_html__( 'Return Method', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'dropdown-type' => 'returnMethod',
|
||||
),
|
||||
'returnShippingFeesAmount' => array(
|
||||
'label' => esc_html__( 'Return Shipping Fees Amount', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 'none',
|
||||
),
|
||||
'merchantCurrency' => array(
|
||||
'label' => esc_html__( 'Currency', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'default' => 'none',
|
||||
'dropdown-type' => 'currency',
|
||||
),
|
||||
),
|
||||
),
|
||||
'shippingDetails' => array(
|
||||
'label' => esc_html__( 'Shipping Details', 'wp-schema-pro' ),
|
||||
'type' => 'repeater',
|
||||
'fields' => array(
|
||||
'shippingDestination' => array(
|
||||
'label' => esc_html__( 'Shipping Destination', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'default' => 'none',
|
||||
'dropdown-type' => 'country',
|
||||
),
|
||||
'handlingTimeMinValue' => array(
|
||||
'label' => esc_html__( 'Min Handling Time', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 'none',
|
||||
),
|
||||
'unitCode' => array(
|
||||
'label' => esc_html__( 'Unit Code', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'DAY',
|
||||
),
|
||||
'handlingTimeMaxValue' => array(
|
||||
'label' => esc_html__( 'Max Handling Time', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 'none',
|
||||
),
|
||||
'transitTimeMinValue' => array(
|
||||
'label' => esc_html__( 'Min Transit Time', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 'none',
|
||||
),
|
||||
'transitTimeMaxValue' => array(
|
||||
'label' => esc_html__( 'Max Transit Time', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 'none',
|
||||
),
|
||||
'shippingRate' => array(
|
||||
'label' => esc_html__( 'Shipping Rate', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 'none',
|
||||
),
|
||||
'shippingCurrency' => array(
|
||||
'label' => esc_html__( 'Currency', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'default' => 'none',
|
||||
'dropdown-type' => 'currency',
|
||||
),
|
||||
'shippingCost' => array(
|
||||
'label' => esc_html__( 'Shipping Cost', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 'none',
|
||||
|
||||
),
|
||||
'shippingCurrency' => array(
|
||||
'label' => esc_html__( 'Currency', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'default' => 'none',
|
||||
'dropdown-type' => 'currency',
|
||||
),
|
||||
),
|
||||
),
|
||||
'price-valid-until' => array(
|
||||
'label' => esc_html__( 'Price Valid Until', 'wp-schema-pro' ),
|
||||
'type' => 'datetime-local',
|
||||
'default' => 'create-field',
|
||||
'description' => esc_html__( 'The date after which the price will no longer be available. e.g. "31/12/2021 09:00 AM"', 'wp-schema-pro' ),
|
||||
),
|
||||
'price' => array(
|
||||
'price' => array(
|
||||
'label' => esc_html__( 'Product Price', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 'none',
|
||||
@@ -1612,13 +1707,13 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'step' => '0.01',
|
||||
),
|
||||
),
|
||||
'currency' => array(
|
||||
'currency' => array(
|
||||
'label' => esc_html__( 'Currency', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'default' => 'none',
|
||||
'dropdown-type' => 'currency',
|
||||
),
|
||||
'product-review' => array(
|
||||
'product-review' => array(
|
||||
'label' => esc_html__( 'Review', 'wp-schema-pro' ),
|
||||
'type' => 'repeater',
|
||||
'fields' => array(
|
||||
@@ -1649,50 +1744,18 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
),
|
||||
),
|
||||
),
|
||||
'rating' => array(
|
||||
'rating' => array(
|
||||
'label' => esc_html__( 'Rating', 'wp-schema-pro' ),
|
||||
'type' => 'rating',
|
||||
'default' => 'accept-user-rating',
|
||||
'description' => esc_html__( 'To maintain accurate product information, kindly provide at least one rating.', 'wp-schema-pro' ),
|
||||
),
|
||||
'review-count' => array(
|
||||
'review-count' => array(
|
||||
'label' => esc_html__( 'Review Count', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
'description' => esc_html__( 'The count of total number of reviews. e.g. "11"', 'wp-schema-pro' ),
|
||||
),
|
||||
'product-review' => array(
|
||||
'label' => esc_html__( 'Review', 'wp-schema-pro' ),
|
||||
'type' => 'repeater',
|
||||
'description' => esc_html__( 'To ensure the accuracy of our product ratings, kindly provide at least one review.', 'wp-schema-pro' ),
|
||||
'fields' => array(
|
||||
'reviewer-type' => array(
|
||||
'label' => esc_html__( 'Reviewer Type', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'Person',
|
||||
'choices' => array(
|
||||
'Person' => esc_html__( 'Person', 'wp-schema-pro' ),
|
||||
'Organization' => esc_html__( 'Organization', 'wp-schema-pro' ),
|
||||
),
|
||||
),
|
||||
'reviewer-name' => array(
|
||||
'label' => esc_html__( 'Reviewer Name', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'author_name',
|
||||
'required' => true,
|
||||
),
|
||||
'product-rating' => array(
|
||||
'label' => esc_html__( 'Product Rating', 'wp-schema-pro' ),
|
||||
'type' => 'rating',
|
||||
'default' => 'none',
|
||||
),
|
||||
'review-body' => array(
|
||||
'label' => esc_html__( 'Review Body', 'wp-schema-pro' ),
|
||||
'type' => 'textarea',
|
||||
'default' => 'post_content',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'bsf-aiosrs-recipe' => array(
|
||||
@@ -2091,16 +2154,14 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'is_recommnded' => true,
|
||||
'fields' => array(
|
||||
'clip-name' => array(
|
||||
'label' => esc_html__( 'Clip Name', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
'required' => true,
|
||||
'label' => esc_html__( 'Clip Name', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
),
|
||||
'clip-start-offset' => array(
|
||||
'label' => esc_html__( 'Clip Start Offset', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 'none',
|
||||
'required' => true,
|
||||
'description' => esc_html__( 'The start time of the clip expressed as the number of seconds from the beginning of the work.', 'wp-schema-pro' ),
|
||||
),
|
||||
'clip-end-offset' => array(
|
||||
@@ -2113,7 +2174,6 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'label' => esc_html__( 'Clip URL', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
'required' => true,
|
||||
'description' => esc_html__( 'A URL that points to the start time of the clip.', 'wp-schema-pro' ),
|
||||
),
|
||||
),
|
||||
@@ -2131,9 +2191,10 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'description' => esc_html__( 'A URL that points to the start time of the clip.', 'wp-schema-pro' ),
|
||||
),
|
||||
'thumbnail-url' => array(
|
||||
'label' => esc_html__( 'Thumbnail URL', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
'label' => esc_html__( 'Thumbnail URL', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
'required' => true,
|
||||
),
|
||||
'regions-allowed' => array(
|
||||
'label' => esc_html__( 'Regions Allowed', 'wp-schema-pro' ),
|
||||
@@ -2141,22 +2202,19 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'default' => 'none',
|
||||
),
|
||||
'is-live-broadcast' => array(
|
||||
'label' => esc_html__( 'Is Live Broadcast', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => false,
|
||||
'required' => true,
|
||||
'label' => esc_html__( 'Is Live Broadcast', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => false,
|
||||
),
|
||||
'start-date' => array(
|
||||
'label' => esc_html__( 'Live Broadcast Start Date', 'wp-schema-pro' ),
|
||||
'type' => 'datetime-local',
|
||||
'default' => 'none',
|
||||
'required' => true,
|
||||
'label' => esc_html__( 'Live Broadcast Start Date', 'wp-schema-pro' ),
|
||||
'type' => 'datetime-local',
|
||||
'default' => 'none',
|
||||
),
|
||||
'end-date' => array(
|
||||
'label' => esc_html__( 'Live Broadcast End Date', 'wp-schema-pro' ),
|
||||
'type' => 'datetime-local',
|
||||
'default' => 'none',
|
||||
'required' => true,
|
||||
'label' => esc_html__( 'Live Broadcast End Date', 'wp-schema-pro' ),
|
||||
'type' => 'datetime-local',
|
||||
'default' => 'none',
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -2414,9 +2472,57 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'type' => 'text',
|
||||
'default' => 'blogname',
|
||||
),
|
||||
'course-instance' => array(
|
||||
'label' => esc_html__( 'Course Instance', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'default' => 'none',
|
||||
'dropdown-type' => 'course-instance',
|
||||
),
|
||||
'name' => array(
|
||||
'label' => esc_html__( 'Instance Name', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
'required' => true,
|
||||
),
|
||||
'description' => array(
|
||||
'label' => esc_html__( 'Instance Description', 'wp-schema-pro' ),
|
||||
'type' => 'textarea',
|
||||
'default' => 'none',
|
||||
'required' => true,
|
||||
),
|
||||
'category' => array(
|
||||
'label' => esc_html__( 'Category', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'label' => esc_html__( 'Offer Category', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'default' => 'none',
|
||||
'dropdown-type' => 'offer-category',
|
||||
),
|
||||
'price' => array(
|
||||
'label' => esc_html__( 'Price', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'attrs' => array(
|
||||
'min' => '0',
|
||||
'step' => 'any',
|
||||
),
|
||||
),
|
||||
'courseMode' => array(
|
||||
'label' => esc_html__( 'Course Attendance Mode', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'default' => 'custom-text',
|
||||
'dropdown-type' => 'course-attendance-mode',
|
||||
'required' => false,
|
||||
'description' => esc_html__( 'The location of the Course Instance. There are different requirements depending on if the Course is happening online or at a physical location.', 'wp-schema-pro' ),
|
||||
),
|
||||
'course-workload' => array(
|
||||
'label' => esc_html__( 'Course Workload', 'wp-schema-pro' ),
|
||||
'type' => 'time-duration',
|
||||
'required' => true,
|
||||
'default' => 'none',
|
||||
),
|
||||
'currency' => array(
|
||||
'label' => esc_html__( 'Currency', 'wp-schema-pro' ),
|
||||
'type' => 'dropdown',
|
||||
'default' => 'custom-text',
|
||||
'dropdown-type' => 'currency',
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -4010,17 +4116,65 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'course-instance':
|
||||
$return = apply_filters(
|
||||
'wp_schema_pro_course_instance_options',
|
||||
array(
|
||||
'Yes' => __( 'Yes', 'wp-schema-pro' ),
|
||||
'No' => __( 'No', 'wp-schema-pro' ),
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'offer-category':
|
||||
$return = apply_filters(
|
||||
'wp_schema_pro_offer_category_options',
|
||||
array(
|
||||
'Free' => __( 'Free', 'wp-schema-pro' ),
|
||||
'Free' => __( 'Free', 'wp-schema-pro' ),
|
||||
'PartiallyFree' => __( 'Partially Free', 'wp-schema-pro' ),
|
||||
'Subscription' => __( 'Subscription', 'wp-schema-pro' ),
|
||||
'Paid' => __( 'Paid', 'wp-schema-pro' ),
|
||||
'Subscription' => __( 'Subscription', 'wp-schema-pro' ),
|
||||
'Paid' => __( 'Paid', 'wp-schema-pro' ),
|
||||
)
|
||||
);
|
||||
break;
|
||||
break;
|
||||
case 'hasmerchantreturnpolicy':
|
||||
$return = apply_filters(
|
||||
'wp_schema_pro_has_merchant_return_policy_options',
|
||||
array(
|
||||
'Yes' => __( 'Yes', 'wp-schema-pro' ),
|
||||
'No' => __( 'No', 'wp-schema-pro' ),
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'returnPolicyCategory':
|
||||
$return = apply_filters(
|
||||
'wp_schema_pro_return_policy_category_options',
|
||||
array(
|
||||
'https://schema.org/MerchantReturnFiniteReturnWindow' => __( 'Finite Return Window', 'wp-schema-pro' ),
|
||||
'https://schema.org/MerchantReturnNotPermitted' => __( 'Not Permitted', 'wp-schema-pro' ),
|
||||
'https://schema.org/MerchantReturnUnlimitedWindow' => __( 'Unlimited Window', 'wp-schema-pro' ),
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'returnFees':
|
||||
$return = apply_filters(
|
||||
'wp_schema_pro_return_fees_options',
|
||||
array(
|
||||
'https://schema.org/FreeReturn' => __( 'Free Return', 'wp-schema-pro' ),
|
||||
'https://schema.org/ReturnFeesCustomerResponsibility' => __( 'Customer Responsibility', 'wp-schema-pro' ),
|
||||
'https://schema.org/ReturnShippingFees' => __( 'Return Shipping Fees', 'wp-schema-pro' ),
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'returnMethod':
|
||||
$return = apply_filters(
|
||||
'wp_schema_pro_return_method_options',
|
||||
array(
|
||||
'https://schema.org/ReturnAtKiosk' => __( 'Return at Kiosk', 'wp-schema-pro' ),
|
||||
'https://schema.org/ReturnByMail' => __( 'Return by Mail', 'wp-schema-pro' ),
|
||||
'https://schema.org/ReturnInStore' => __( 'Return in Store', 'wp-schema-pro' ),
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'event-status':
|
||||
$return = apply_filters(
|
||||
'wp_schema_pro_event_status_options',
|
||||
@@ -4033,6 +4187,17 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'course-attendance-mode':
|
||||
$return = apply_filters(
|
||||
'wp_schema_pro_course_attendance_mode_options',
|
||||
array(
|
||||
'Online' => __( 'Online', 'wp-schema-pro' ),
|
||||
'Onsite' => __( 'Physical Location', 'wp-schema-pro' ),
|
||||
'Blended' => __( 'Mix Of Online & Physical Locations', 'wp-schema-pro' ),
|
||||
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'event-attendance-mode':
|
||||
$return = apply_filters(
|
||||
'wp_schema_pro_event_attendance_mode_options',
|
||||
@@ -4040,10 +4205,10 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'OfflineEventAttendanceMode' => __( 'Physical Location', 'wp-schema-pro' ),
|
||||
'OnlineEventAttendanceMode' => __( 'Online Event', 'wp-schema-pro' ),
|
||||
'MixedEventAttendanceMode' => __( 'Mix Of Online & Physical Locations', 'wp-schema-pro' ),
|
||||
|
||||
|
||||
)
|
||||
);
|
||||
break;
|
||||
break;
|
||||
case 'timezone':
|
||||
$return = apply_filters(
|
||||
'wp_schema_pro_event_timezone_options',
|
||||
|
||||
@@ -14,6 +14,7 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Product' ) ) {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_Product {
|
||||
|
||||
|
||||
/**
|
||||
* Render Schema.
|
||||
@@ -49,6 +50,116 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Product' ) ) {
|
||||
$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;
|
||||
}
|
||||
|
||||
// Initialize 'shippingDetails' array
|
||||
$shipping_details = array();
|
||||
|
||||
// Initialize 'deliveryTime' array
|
||||
$delivery_time = array();
|
||||
|
||||
// Modify the section where 'shippingDetails' are added to the schema
|
||||
if ( ! empty( $data['shippingDetails'] ) ) {
|
||||
// Iterate over each set of shipping details
|
||||
foreach ( $data['shippingDetails'] as $shipping_detail ) {
|
||||
// Initialize shipping detail array for this set
|
||||
$shipping = array();
|
||||
|
||||
// Add handlingTimeMinValue if available
|
||||
if ( ! empty( $shipping_detail['handlingTimeMinValue'] ) && $shipping_detail['handlingTimeMinValue'] !== 'none' ) {
|
||||
// Initialize 'deliveryTime' array
|
||||
$delivery_time = array();
|
||||
|
||||
// Add handlingTimeMinValue to 'deliveryTime' array
|
||||
$delivery_time['@type'] = 'ShippingDeliveryTime';
|
||||
$delivery_time['handlingTime']['minValue'] = wp_strip_all_tags( (string) $shipping_detail['handlingTimeMinValue'] );
|
||||
|
||||
|
||||
// Push the 'deliveryTime' array to 'shipping' array
|
||||
$shipping['deliveryTime'] = $delivery_time;
|
||||
}
|
||||
|
||||
if ( ! empty( $shipping_detail['unitCode'] ) && $shipping_detail['unitCode'] !== 'none' ) {
|
||||
$delivery_time['handlingTime']['unitCode'] = wp_strip_all_tags( (string) $shipping_detail['unitCode'] );
|
||||
|
||||
$delivery_time['transitTime']['unitCode'] = wp_strip_all_tags( (string) $shipping_detail['unitCode'] );
|
||||
}
|
||||
|
||||
// Add shipping destination
|
||||
if ( ! empty( $shipping_detail['shippingDestination'] ) && $shipping_detail['shippingDestination'] !== 'none' ) {
|
||||
// Initialize shipping destination array
|
||||
$shipping_destination = array();
|
||||
|
||||
// Add address country to shipping destination
|
||||
$shipping_destination['@type'] = 'DefinedRegion';
|
||||
$shipping_destination['addressCountry'] = $shipping_detail['shippingDestination']; // Assign selected country directly
|
||||
|
||||
$shipping['shippingDestination'] = $shipping_destination;
|
||||
}
|
||||
|
||||
// Add shipping rate
|
||||
if ( ! empty( $shipping_detail['shippingRate'] ) ) {
|
||||
// Initialize shipping rate array
|
||||
$shipping_rate = array();
|
||||
|
||||
// Add value and currency to shipping rate
|
||||
$shipping_rate['@type'] = 'MonetaryAmount';
|
||||
$shipping_rate['value'] = $shipping_detail['shippingRate'];
|
||||
$shipping_rate['currency'] = ! empty( $shipping_detail['shippingCurrency'] ) ? $shipping_detail['shippingCurrency'] : 'USD'; // Default to USD if currency not provided
|
||||
|
||||
$shipping['shippingRate'] = $shipping_rate;
|
||||
}
|
||||
|
||||
// Add handlingTimeMaxValue if available
|
||||
if ( ! empty( $shipping_detail['handlingTimeMaxValue'] ) && $shipping_detail['handlingTimeMaxValue'] !== 'none' ) {
|
||||
// Initialize 'deliveryTime' array if not already initialized
|
||||
if ( empty( $delivery_time ) ) {
|
||||
$delivery_time = array();
|
||||
}
|
||||
|
||||
// Add handlingTimeMaxValue to 'deliveryTime' array
|
||||
$delivery_time['handlingTime']['maxValue'] = wp_strip_all_tags( (string) $shipping_detail['handlingTimeMaxValue'] );
|
||||
|
||||
// Push the 'deliveryTime' array to 'shipping' array
|
||||
$shipping['deliveryTime'] = $delivery_time;
|
||||
}
|
||||
|
||||
// Add transitTimeMinValue if available
|
||||
if ( ! empty( $shipping_detail['transitTimeMinValue'] ) && $shipping_detail['transitTimeMinValue'] !== 'none' ) {
|
||||
// Initialize 'deliveryTime' array if not already initialized
|
||||
if ( empty( $delivery_time ) ) {
|
||||
$delivery_time = array();
|
||||
}
|
||||
|
||||
// Add transitTimeMinValue to 'deliveryTime' array
|
||||
$delivery_time['transitTime']['minValue'] = wp_strip_all_tags( (string) $shipping_detail['transitTimeMinValue'] );
|
||||
|
||||
|
||||
// Push the 'deliveryTime' array to 'shipping' array
|
||||
$shipping['deliveryTime'] = $delivery_time;
|
||||
}
|
||||
|
||||
// Add transitTimeMaxValue if available
|
||||
if ( ! empty( $shipping_detail['transitTimeMaxValue'] ) && $shipping_detail['transitTimeMaxValue'] !== 'none' ) {
|
||||
// Initialize 'deliveryTime' array if not already initialized
|
||||
if ( empty( $delivery_time ) ) {
|
||||
$delivery_time = array();
|
||||
}
|
||||
|
||||
// Add transitTimeMaxValue to 'deliveryTime' array
|
||||
$delivery_time['transitTime']['maxValue'] = wp_strip_all_tags( (string) $shipping_detail['transitTimeMaxValue'] );
|
||||
|
||||
// Push the 'deliveryTime' array to 'shipping' array
|
||||
$shipping['deliveryTime'] = $delivery_time;
|
||||
}
|
||||
|
||||
// Push the shipping detail to 'shippingDetails' array
|
||||
$shipping_details[] = $shipping;
|
||||
}
|
||||
|
||||
// Assign 'shippingDetails' array to 'offers'
|
||||
$schema['offers']['shippingDetails'] = $shipping_details;
|
||||
}
|
||||
|
||||
if ( apply_filters( 'wp_schema_pro_remove_product_offers', true ) ) {
|
||||
$schema['offers']['@type'] = 'Offer';
|
||||
$schema['offers']['price'] = '0';
|
||||
@@ -88,35 +199,80 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Product' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset($data['merchant-return-policy']) && !empty($data['merchant-return-policy'] ) ) {
|
||||
// Initialize hasMerchantReturnPolicy array
|
||||
$schema['offers']['hasMerchantReturnPolicy'] = array();
|
||||
|
||||
foreach ($data['merchant-return-policy'] as $policy) {
|
||||
// Add each policy to hasMerchantReturnPolicy
|
||||
$return_policy = array();
|
||||
|
||||
$return_policy['@type'] = 'MerchantReturnPolicy';
|
||||
$return_policy['applicableCountry'] = isset($policy['applicableCountry']) ? wp_strip_all_tags((string)$policy['applicableCountry']) : null;
|
||||
// Validate length of applicableCountry
|
||||
if ($return_policy['applicableCountry'] && strlen($return_policy['applicableCountry']) > 2) {
|
||||
// Truncate or handle the string appropriately if it exceeds the maximum length
|
||||
$return_policy['applicableCountry'] = substr($return_policy['applicableCountry'], 0, 2);
|
||||
}
|
||||
$return_policy['returnPolicyCategory'] = isset($policy['returnPolicyCategory']) ? esc_url($policy['returnPolicyCategory']) : null;
|
||||
$return_policy['merchantReturnDays'] = isset($policy['merchantReturnDays']) ? intval($policy['merchantReturnDays']) : null;
|
||||
$return_policy['returnFees'] = isset($policy['returnFees']) ? esc_url($policy['returnFees']) : null;
|
||||
$return_policy['returnMethod'] = isset($policy['returnMethod']) ? esc_url($policy['returnMethod']) : null;
|
||||
|
||||
// Add returnShippingFeesAmount if returnFees is set to ReturnShippingFees
|
||||
if (
|
||||
isset($policy['returnFees']) &&
|
||||
$policy['returnFees'] === 'https://schema.org/ReturnShippingFees' &&
|
||||
isset($policy['returnShippingFeesAmount']) &&
|
||||
!empty($policy['returnShippingFeesAmount'])
|
||||
) {
|
||||
// Initialize returnShippingFeesAmount array
|
||||
$return_shipping_fees_amount = array();
|
||||
|
||||
// Add value and currency to returnShippingFeesAmount
|
||||
$return_shipping_fees_amount['@type'] = 'MonetaryAmount';
|
||||
$return_shipping_fees_amount['value'] = floatval($policy['returnShippingFeesAmount']);
|
||||
$return_shipping_fees_amount['currency'] = !empty($policy['merchantCurrency']) ? $policy['merchantCurrency'] : null; // Default to USD if currency not provided
|
||||
|
||||
$return_policy['returnShippingFeesAmount'] = $return_shipping_fees_amount;
|
||||
}
|
||||
|
||||
// Push the policy to hasMerchantReturnPolicy array
|
||||
$schema['offers']['hasMerchantReturnPolicy'][] = $return_policy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 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,
|
||||
),
|
||||
$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 );
|
||||
$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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,11 +52,25 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Review' ) ) {
|
||||
$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'] );
|
||||
}
|
||||
//phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase.
|
||||
// Initialize 'hasCourseInstance' array.
|
||||
$hasCourseInstance = array();
|
||||
$schema['itemReviewed']['hasCourseInstance']['course-instance'] = ! empty( $data['bsf-aiosrs-course-course-instance'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-course-course-instance'] ) : null;
|
||||
$schema['itemReviewed']['hasCourseInstance']['courseMode'] = ! empty( $data['bsf-aiosrs-course-courseMode'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-course-courseMode'] ) : null;
|
||||
$schema['itemReviewed']['hasCourseInstance']['courseWorkload'] = ! empty( $data['bsf-aiosrs-course-course-workload'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-course-course-workload'] ) : null;
|
||||
|
||||
// Initialize 'offers' array.
|
||||
$offers = array();
|
||||
$schema['itemReviewed']['offers']['price'] = ! empty( $data['bsf-aiosrs-course-price'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-course-price'] ) : null;
|
||||
$schema['itemReviewed']['offers']['currency'] = ! empty( $data['bsf-aiosrs-course-currency'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-course-currency'] ) : null;
|
||||
$schema['itemReviewed']['offers']['category'] = ! empty( $data['bsf-aiosrs-course-category'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-course-category'] ) : null;
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user