Skip to content

Commit

Permalink
Merge pull request #2154 from ahmedkaludi/1.35
Browse files Browse the repository at this point in the history
1.35
  • Loading branch information
shridhamdeveloper authored Aug 2, 2024
2 parents a2f3e20 + 85f09e2 commit 9617e7c
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 53 deletions.
File renamed without changes.
9 changes: 8 additions & 1 deletion admin_section/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,11 @@ function saswp_handle_file_upload($option){
}else{
if (is_array($value)) {
foreach ( $value as $k => $val) {
$value[sanitize_key($k)] = sanitize_text_field($val);
if( is_array($val) ){
$value[sanitize_key($k)] = array_map('sanitize_text_field', $val);
}else {
$value[sanitize_key($k)] = sanitize_text_field($val);
}
}
$option[sanitize_key($key)] = $value;
}else{
Expand Down Expand Up @@ -4929,6 +4933,9 @@ function saswp_enqueue_saswp_select2_js( $hook ) {
// Dequeue Widget Options plugin select2 on schema dashboard to remove conflict
wp_dequeue_script('jquery-widgetopts-select2-script');

// Dequeue ReviewX Pro plugin select2 on schema dashboard to remove conflict
wp_dequeue_script('reviewx-pro-select2-js');

if($post_type == 'saswp'){

//conflict with jupitor theme fixed starts here
Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions core/array-list/schema-properties.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,21 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
'id' => 'local_review_count_'.$schema_id,
'type' => 'text',
);
$meta_field[] = array(
'label' => 'Check-in Time',
'id' => 'local_checkin_time_'.$schema_id,
'type' => 'text',
);
$meta_field[] = array(
'label' => 'Check-out Time',
'id' => 'local_checkout_time_'.$schema_id,
'type' => 'text',
);
$meta_field[] = array(
'label' => 'Identifier',
'id' => 'local_identifier_pvalue_'.$schema_id,
'type' => 'text',
);

break;

Expand Down Expand Up @@ -6235,6 +6250,8 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
'options' => array(
'' => 'Select Return Policy Fees',
'FreeReturn' => 'FreeReturn',
'ReturnFeesCustomerResponsibility' => 'ReturnFeesCustomerResponsibility',
'ReturnShippingFees' => 'ReturnShippingFees',
)
),
array(
Expand Down
4 changes: 1 addition & 3 deletions modules/divi-builder/includes/loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@

// Load custom Divi Builder modules
foreach ( (array) $module_files as $module_file ) {
if ( $module_file && preg_match( "/\/modules\/\b([^\/]+)\/\\1\.php$/", $module_file ) ) {
require_once $module_file;
}
require_once $module_file;
}
66 changes: 47 additions & 19 deletions output/class-saswp-output-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,7 @@ public function saswp_get_meta_list_value($key, $field, $schema_post_id, $schema
break;
case 'site_logo':

$sizes = array(
'width' => 600,
'height' => 60,
'crop' => false,
);
$sizes = array ( 600, 60 );

$custom_logo_id = get_theme_mod( 'custom_logo' );

Expand Down Expand Up @@ -2985,6 +2981,8 @@ public function saswp_replace_with_custom_fields_value($input1, $schema_post_id)

case 'local_business':

$business_name = get_post_meta($schema_post_id, 'saswp_business_name', true);

if ( isset( $custom_fields['local_business_id']) ) {
$input1['@id'] = get_permalink().$custom_fields['local_business_id'];
}
Expand Down Expand Up @@ -3015,6 +3013,9 @@ public function saswp_replace_with_custom_fields_value($input1, $schema_post_id)
if ( isset( $custom_fields['local_state']) ) {
$input1['address']['addressRegion'] = $custom_fields['local_state'];
}
if ( isset( $custom_fields['local_country']) ) {
$input1['address']['addressCountry'] = $custom_fields['local_country'];
}
if ( isset( $custom_fields['local_postal_code']) ) {
$input1['address']['postalCode'] = $custom_fields['local_postal_code'];
}
Expand Down Expand Up @@ -3123,6 +3124,17 @@ public function saswp_replace_with_custom_fields_value($input1, $schema_post_id)
if($sameas){
$input1['sameAs'] = $sameas;
}
if( $business_name == 'hotel' ) {
if( ! empty( $custom_fields['local_checkin_time'] ) ) {
$input1['checkinTime'] = $custom_fields['local_checkin_time'];
}
if( ! empty( $custom_fields['local_checkout_time'] ) ) {
$input1['checkoutTime'] = $custom_fields['local_checkout_time'];
}
if( ! empty( $custom_fields['local_identifier_pvalue'] ) ) {
$input1['identifier'] = $custom_fields['local_identifier_pvalue'];
}
}
break;

case 'Blogposting':
Expand Down Expand Up @@ -7874,7 +7886,7 @@ public function saswp_woocommerce_product_details($post_id){

if ( isset( $date_on_sale) ) {

$product_details['product_priceValidUntil'] = $date_on_sale->gmdate('Y-m-d G:i:s');
$product_details['product_priceValidUntil'] = $date_on_sale->date('Y-m-d G:i:s');

}else{

Expand Down Expand Up @@ -8727,20 +8739,22 @@ public function saswp_get_featured_image() {

if( ($image_details[1] > 0) && ($image_details[2] > 0) ){
$img_ratio = $image_details[1] / $image_details[2];
$targetHeight = 1200 / $img_ratio;
$targetHeight = round ( 1200 / $img_ratio );
}

if($multiple_size){


$min_val = min ( $image_details[1], $targetHeight );

if($targetHeight < 675){

$width = array(1200, 1200, 1200);
$height = array(900, 720, 675);
$width = array ( 1200, 1200, 1200, $min_val );
$height = array ( 900, 720, 675, $min_val );

}else{

$width = array(1200, 1200, 1200);
$height = array($targetHeight, 900, 675);
$width = array ( 1200, 1200, 1200, $min_val );
$height = array ( $targetHeight, 900, 675, $min_val );

}

Expand Down Expand Up @@ -8793,13 +8807,27 @@ public function saswp_get_featured_image() {

if ( isset( $image_details[1]) ) {

if($multiple_size){
$width = array($image_details[1], 1200, 1200);
$height = array($image_details[2], 900, 675);
}else{
$width = array($image_details[1]);
$height = array($image_details[2]);
}
if ( $multiple_size ) {

$width = array ( $image_details[1], 1200, 1200 );
$height = array ( $image_details[2], 900, 675 );
$height_array = array ( 900, 675 );
$min_val = min ( $image_details[1], $image_details[2] );

if ( $image_details[1] == 1200 && in_array ( $image_details[2], $height_array ) ) {

$width = array ( $min_val, 1200, 1200 );
$height = array ( $min_val, 900, 675 );

} else {
$width[] = $min_val;
$height[] = $min_val;
}

}else{
$width = array ( $image_details[1] );
$height = array ( $image_details[2] );
}

for($i = 0; $i < count($width); $i++){

Expand Down
16 changes: 16 additions & 0 deletions output/markup.php
Original file line number Diff line number Diff line change
Expand Up @@ -1923,6 +1923,22 @@ function saswp_local_business_schema_markup($schema_id, $schema_post_id, $all_po

}

$business_name = get_post_meta($schema_post_id, 'saswp_business_name', true);

if( $business_name == 'hotel' || $business_sub_name == 'hotel' ) {

if( ! empty( $all_post_meta['local_checkin_time_'.$schema_id] ) ) {
$input1['checkinTime'] = saswp_remove_warnings($all_post_meta, 'local_checkin_time_'.$schema_id, 'saswp_array');
}
if( ! empty( $all_post_meta['local_checkout_time_'.$schema_id] ) ) {
$input1['checkoutTime'] = saswp_remove_warnings($all_post_meta, 'local_checkout_time_'.$schema_id, 'saswp_array');
}
if( ! empty( $all_post_meta['local_identifier_pvalue_'.$schema_id] ) ) {
$input1['identifier'] = saswp_remove_warnings( $all_post_meta, 'local_identifier_pvalue_'.$schema_id, 'saswp_array' );
}

}


return $input1;
}
Expand Down
41 changes: 16 additions & 25 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Contributors: magazine3
Tags: Schema, Structured Data, Rich Snippets, SEO, AMP
Requires at least: 4.5
Tested up to: 6.5
Tested up to: 6.6
Requires PHP: 5.6.20
Stable tag: 1.34.1
Stable tag: 1.35
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Schema & Structured Data adds Google Rich Snippets markup according to Schema.org guidelines to structure your site for SEO.
Expand Down Expand Up @@ -121,6 +121,20 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)

== Changelog ==

= 1.35 (02 August 2024) =
* Enhancement: Added new properties in LodgingBusiness > Hotel schema #2105
* Fixed: Feature image size duplicate issue in schema markup #2140
* Fixed: Issue with country field missing in the schema markup while modifying the schema output (Local Business) #2147
* Fixed: A fatal error issue in the latest update of 1.34.2 #2148
* Fixed: FAQ Block not working on Divi Builder #2149
* Fixed: PHP warnings on schema types page #2150
* Fixed: ACF fields are unclickable when the plugin is activated and an error appears in the Console #2152
* Fixed: The ReturnFeesCustomerResponsibility field is missing in the product schema #2153

= 1.34.2 (18 July 2024) =
* Fixed: Error after version 1.34.1 update #2144
* Fixed: Tested with new version of wordpress i.e. 6.6v #2145

= 1.34.1 (16 July 2024) =
* Fixed: Fatal error after recent update #2142

Expand Down Expand Up @@ -268,27 +282,4 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
* Fixed: A deprecated warning with author image in schema markup #2012
* Fixed: Undefined array key "headingTag" #2013


= 1.20 (01 Sep 2023) =

* Enhancement: Corrected summery page for archive schema #1980
* Fixed: Resolved Organization URL issue in the knowledge graph #1989
* Fixed: Added proper display message on license activation/deactivation timeout #1998
* Fixed: Plugin Upgrade (v1.18) Causing Internal Page Breakage and Blank Screen #2001
* Fixed: Fatal error in review collection #2004
* Fixed: Breadcrumb schema showing wrong id in schema markup for custom post type #2005
* Fixed: PHP Warnings for Undefined Array Keys in Course Schema URL's #2006


= 1.19 (21 Aug 2023) =

* Fixed: Checking success of folder creation via HTTP #1954
* Fixed: Warning shown in the schema #1979
* Fixed: wp_remote_post timeout for some users while activating reviews api #1983
* Feature: Added slide interval option to perform auto slide for review collection #1984
* Fixed: PHP Warning in reveiw module #1986
* Fixed: Markup warning #1987
* Fixed: Collection reviews are not showing in schema markup #1988
* Fixed: Tested with WordPress 6.3 and updated readme.txt #1996

All changelog available on [GitHub](https://github.com/ahmedkaludi/schema-and-structured-data-for-wp/releases).
8 changes: 4 additions & 4 deletions structured-data-for-wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
Plugin Name: Schema & Structured Data for WP & AMP
Description: Schema & Structured Data adds Google Rich Snippets markup according to Schema.org guidelines to structure your site for SEO. (AMP Compatible)
Version: 1.34.1
Version: 1.35
Text Domain: schema-and-structured-data-for-wp
Domain Path: /languages
Author: Magazine3
Expand All @@ -13,7 +13,7 @@
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) exit;

define( 'SASWP_VERSION', '1.34.1' );
define( 'SASWP_VERSION', '1.35' );
define( 'SASWP_DIR_NAME_FILE', __FILE__ );
define( 'SASWP_DIR_NAME', dirname( __FILE__ ) );
define( 'SASWP_DIR_URI', plugin_dir_url( __FILE__ ) );
Expand Down Expand Up @@ -73,7 +73,7 @@ function saswp_non_amp() {
}

// Schema App end here
require_once SASWP_DIR_NAME.'/admin_section/structure_admin.php';
require_once SASWP_DIR_NAME.'/admin_section/structure-admin.php';
require_once SASWP_DIR_NAME.'/admin_section/settings.php';
require_once SASWP_DIR_NAME.'/admin_section/common-function.php';
require_once SASWP_DIR_NAME.'/output/class-saswp-location-widget.php';
Expand All @@ -86,7 +86,7 @@ function saswp_non_amp() {
require_once SASWP_DIR_NAME.'/view/help.php';
require_once SASWP_DIR_NAME.'/view/schema-type.php';
require_once SASWP_DIR_NAME.'/view/paywall.php';
require_once SASWP_DIR_NAME.'/admin_section/add-schema/add_new.php';
require_once SASWP_DIR_NAME.'/admin_section/add-schema/add-new.php';
require_once SASWP_DIR_NAME.'/view/class-saswp-post-specific.php';
require_once SASWP_DIR_NAME.'/modules/rating-box/class-saswp-rating-box-backend.php';
require_once SASWP_DIR_NAME.'/modules/rating-box/class-saswp-rating-box-frontend.php';
Expand Down
5 changes: 4 additions & 1 deletion view/class-saswp-view-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ public function saswp_post_specific_schema($schema_type, $saswp_meta_fields, $po
$output = '';

foreach ( $saswp_meta_fields as $meta_field ) {

if( isset( $meta_field['type'] ) ) {

$input = '';
$attributes = '';
Expand Down Expand Up @@ -660,7 +662,8 @@ public function saswp_post_specific_schema($schema_type, $saswp_meta_fields, $po
$output .= '<tr><th>'.$label.'</th><td>'.$input.'</td></tr>';
}

}
}
}

$tabs_fields = '';

Expand Down

0 comments on commit 9617e7c

Please sign in to comment.