Skip to content

Commit

Permalink
Merge pull request #2208 from ahmedkaludi/1.38
Browse files Browse the repository at this point in the history
1.38
  • Loading branch information
shridhamdeveloper authored Nov 2, 2024
2 parents e23d841 + e411720 commit 001974a
Show file tree
Hide file tree
Showing 21 changed files with 1,133 additions and 86 deletions.
5 changes: 4 additions & 1 deletion admin_section/common-function.php
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,7 @@ function saswp_fields_and_type($data_type = 'value'){
'saswp-pretty-print' => array('type' => 'checkbox', 'value' => 0),
'saswp-microdata-cleanup' => array('type' => 'checkbox', 'value' => 1),
'saswp-other-images' => array('type' => 'checkbox', 'value' => 1),
'saswp-archive-images' => array('type' => 'checkbox', 'value' => 0),
'saswp-image-resizing' => array('type' => 'checkbox', 'value' => 1),
'saswp-multiple-size-image' => array('type' => 'checkbox', 'value' => 1),
'saswp-resized-image-folder' => array('type' => 'checkbox', 'value' => 0),
Expand Down Expand Up @@ -2138,7 +2139,7 @@ function saswp_defaultSettings() {
$sd_data = get_option( 'sd_data', saswp_default_settings_array());

// If data is not set for custom schema option then set default data to 1
if(!array_key_exists('saswp-for-cschema', $sd_data) ) {
if ( is_array( $sd_data ) && ! array_key_exists( 'saswp-for-cschema', $sd_data ) ) {
$sd_data['saswp-for-cschema'] = 1;
}

Expand Down Expand Up @@ -3507,6 +3508,7 @@ function saswp_get_field_note($pname){
'ultimatefaqs' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/ultimate-faqs/">Ultimate FAQs</a>',
'ultimatemember' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/ultimate-member/">Ultimate Member</a>',
'showcaseidx' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/showcase-idx/">Showcaseidx</a>',
'realtypress' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://realtypress.ca/">RealtyPress Premium</a>',
'easyaccordion' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/easy-accordion-free/">Easy Accordion</a>',
'wpresponsivefaq' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/sp-faq">WP responsive FAQ with category plugin</a>',
'arconixfaq' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/arconix-faq/">Arconix FAQ</a>',
Expand Down Expand Up @@ -3542,6 +3544,7 @@ function saswp_get_field_note($pname){
'simple_author_box' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/simple-author-box//">Simple Author Box</a>',
'wp_post_ratings' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/wp-postratings/">WP-PostRatings</a>',
'bb_press' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/bbpress/">bbPress</a>',
'wpforo' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/wpforo/">wpForo Forum</a>',
'woocommerce' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/woocommerce/">Woocommerce</a>',
'cooked' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/cooked/">Cooked</a>',
'the_events_calendar' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/the-events-calendar/">The Events Calendar</a>',
Expand Down
28 changes: 28 additions & 0 deletions admin_section/js/main-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1826,6 +1826,15 @@ jQuery(document).ready(function($){
}
break;

case 'saswp-wpforo-checkbox':
saswp_compatibliy_notes(current, id);
if ($(this).is(':checked')) {
$("#saswp-wpforo").val(1);
}else{
$("#saswp-wpforo").val(0);
}
break;

case 'saswp-microdata-cleanup-checkbox':

if ($(this).is(':checked')) {
Expand All @@ -1844,6 +1853,16 @@ jQuery(document).ready(function($){
}

break;

case 'saswp-archive-images-checkbox':

if ($(this).is(':checked')) {
$("#saswp-archive-images").val(1);
}else{
$("#saswp-archive-images").val(0);
}

break;

case 'saswp-full-heading-checkbox':

Expand Down Expand Up @@ -2122,6 +2141,15 @@ jQuery(document).ready(function($){
$("#saswp-showcaseidx").val(0);
}

break;
case 'saswp-realtypress-checkbox':
saswp_compatibliy_notes(current, id);
if ($(this).is(':checked')) {
$("#saswp-realtypress").val(1);
}else{
$("#saswp-realtypress").val(0);
}

break;

case 'saswp-arconixfaq-checkbox':
Expand Down
2 changes: 1 addition & 1 deletion admin_section/js/main-script.min.js

Large diffs are not rendered by default.

46 changes: 44 additions & 2 deletions admin_section/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -1731,6 +1731,18 @@ function saswp_import_callback() {
'id' => 'saswp-other-images',
'name' => 'sd_data[saswp-other-images]',
)
),
array(
'label' => 'Add All Available Images Of Tags & Categories',
'id' => 'saswp-archive-images-checkbox',
'name' => 'saswp-archive-images-checkbox',
'type' => 'checkbox',
'class' => 'checkbox saswp-checkbox',
'note' => 'It adds all the available images on tags and categories to schema markup. <a target="_blank" href="https://structured-data-for-wp.com/docs/article/what-is-add-all-available-images-on-post-in-schema-structured-data-for-wp-amp">Learn More</a>',
'hidden' => array(
'id' => 'saswp-archive-images',
'name' => 'sd_data[saswp-archive-images]',
)
),
array(
'label' => 'Allow Image Resizing',
Expand Down Expand Up @@ -3001,6 +3013,19 @@ function saswp_compatibility_page_callback() {
'name' => 'sd_data[saswp-showcaseidx]',
)
);

$realtypress = array(
'label' => 'RealtyPress Premium',
'id' => 'saswp-realtypress-checkbox',
'name' => 'saswp-realtypress-checkbox',
'type' => 'checkbox',
'class' => 'checkbox saswp-checkbox',
'note' => saswp_get_field_note('realtypress'),
'hidden' => array(
'id' => 'saswp-realtypress',
'name' => 'sd_data[saswp-realtypress]',
)
);

$arconixfaq = array(
'label' => 'Arconix FAQ',
Expand Down Expand Up @@ -4210,6 +4235,19 @@ function saswp_compatibility_page_callback() {
'name' => 'sd_data[saswp-bbpress]',
)
);

$wpforo = array(
'label' => 'wpForo Forum',
'id' => 'saswp-wpforo-checkbox',
'name' => 'saswp-wpforo-checkbox',
'type' => 'checkbox',
'class' => 'checkbox saswp-checkbox',
'note' => saswp_get_field_note('wpforo'),
'hidden' => array(
'id' => 'saswp-wpforo',
'name' => 'sd_data[saswp-wpforo]',
)
);

$yoast = array(
'label' => 'Yoast SEO Plugin',
Expand Down Expand Up @@ -4374,6 +4412,7 @@ function saswp_compatibility_page_callback() {
$realestate_7['note'] = $real_addon_req;
$geo_directory['note'] = $real_addon_req;
$showcaseidx['note'] = $real_addon_req;
$realtypress['note'] = $real_addon_req;

}

Expand Down Expand Up @@ -4512,6 +4551,7 @@ function saswp_compatibility_page_callback() {
$wppostratings,
$wpreviewpro,
$bbpress,
$wpforo,
$webstories,
$wpecommerce,
$woocommerce,
Expand Down Expand Up @@ -4609,6 +4649,7 @@ function saswp_compatibility_page_callback() {
$ultimatefaqs,
$ultimatemember,
$showcaseidx,
$realtypress,
$arconixfaq,
$faqconcertina,
$faqschemaforpost,
Expand Down Expand Up @@ -5003,8 +5044,9 @@ function saswp_enqueue_saswp_select2_js( $hook ) {

// If ACF is active then dequeue timepicker script on posts and pages
$current_screen = get_current_screen();
if( is_object( $current_screen ) && ! empty( $current_screen->base ) ) {
if( class_exists( 'acf' ) && ( $current_screen->base == 'post' || $current_screen->base == 'page' ) ) {
$post_types = saswp_post_type_generator();
if ( is_object( $current_screen ) && ! empty( $current_screen->post_type ) ) {
if ( class_exists( 'acf' ) && ( is_array( $post_types ) && in_array( $current_screen->post_type, $post_types ) ) ) {
wp_dequeue_script('saswp-timepicker-js');
}
}
Expand Down
25 changes: 23 additions & 2 deletions admin_section/structure-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,10 @@ function saswp_comparison_logic_checker($input, $post){

case 'author_name':

$get_author = get_post_field('post_author',$post->ID);
$get_author = '';
if ( is_object( $post ) && isset( $post->ID ) ) {
$get_author = get_post_field( 'post_author',$post->ID );
}

if ( $comparison == 'equal' ) {
if ( $get_author == $data ) {
Expand Down Expand Up @@ -2556,4 +2559,22 @@ function save_extra_user_profile_fields( $user_id ) {
}

}
//user Custom Schema filed save end
//user Custom Schema filed save end

/**
* Add protection to schema post meta fields
* @param $protected Boolean
* @param $meta_key String
* @param $meta_type String
* @return $protected Boolean
* @since 1.38
* */
add_filter( 'is_protected_meta', 'saswp_add_protection_schema_meta', 10, 3 );

function saswp_add_protection_schema_meta( $protected, $meta_key, $meta_type ){
// Allow fields starting with underscore to be displayed
if ( strpos( $meta_key, 'saswp_' ) === 0 ) {
return true;
}
return $protected;
}
7 changes: 5 additions & 2 deletions core/3rd-party/class-saswp-youtube.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ public static function getVideoInfo($vid, $api_key)
if($result['items'][0]['snippet']['description']){ $vinfo['description'] = $result['items'][0]['snippet']['description']; }
if($result['items'][0]['statistics']['viewCount']){ $vinfo['viewCount'] = $result['items'][0]['statistics']['viewCount']; }

if ( isset( $vinfo['duration'] ) && $vinfo['duration'] != 'P0D' ) {

$interval = new DateInterval($vinfo['duration']);
$vinfo['duration_sec'] = $interval->h * 3600 + $interval->i * 60 + $interval->s;
$interval = new DateInterval($vinfo['duration']);
$vinfo['duration_sec'] = $interval->h * 3600 + $interval->i * 60 + $interval->s;

}

$vinfo['thumbnail']['default'] = self::$thumbnail_base . $vid . '/default.jpg';
$vinfo['thumbnail']['mqDefault'] = self::$thumbnail_base . $vid . '/mqdefault.jpg';
Expand Down
12 changes: 12 additions & 0 deletions core/array-list/compatibility-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@
'opt_name' => 'saswp-showcaseidx',
'part_in' => 'pro',
),
'realtypress' => array(
'name' => 'RealtyPress Premium',
'free' => 'realtypress-premium/realtypress.php',
'opt_name' => 'saswp-realtypress',
'part_in' => 'pro',
),
'easyaccordion' => array(
'name' => 'Easy Accordion',
'free' => 'easy-accordion-free/plugin-main.php',
Expand Down Expand Up @@ -469,6 +475,12 @@
'opt_name' => 'saswp-bbpress',
'part_in' => 'free',
),
'wpforo' => array(
'name' => 'wpForo Forum',
'free' => 'wpforo/wpforo.php',
'opt_name' => 'saswp-wpforo',
'part_in' => 'free',
),
'woocommerce' => array(
'name' => 'Woocommerce',
'free' => 'woocommerce/woocommerce.php',
Expand Down
88 changes: 83 additions & 5 deletions core/array-list/repeater-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@
'product_pros' => 'product_pros',
'product_cons' => 'product_cons',
),
'SoftwareApplication' => array(
'product_reviews' => 'product_reviews',
'product_pros' => 'product_pros',
'product_cons' => 'product_cons',
),
'ProductGroup' => array(
'product_group_has_varient' => 'product_group_has_varient',
),
'SoftwareApplication' => array(
'product_reviews' => 'product_reviews',
'product_pros' => 'product_pros',
'product_cons' => 'product_cons',
),
'DataFeed' => array(
'feed_element' => 'feed_element',
),
Expand Down Expand Up @@ -306,6 +309,81 @@
'type' => 'text',
),
),
'product_group_has_varient' => array(
array(
'label' => 'Sku',
'name' => 'saswp_product_grp_sku',
'type' => 'text',
),
array(
'label' => 'GTIN14',
'name' => 'saswp_product_grp_gtin14',
'type' => 'text',
),
array(
'label' => 'Image',
'name' => 'saswp_product_grp_img',
'type' => 'media',
),
array(
'label' => 'Name',
'name' => 'saswp_product_grp_name',
'type' => 'text',
),
array(
'label' => 'Description',
'name' => 'saswp_product_grp_description',
'type' => 'textarea',
),
array(
'label' => 'Offer URL',
'name' => 'saswp_product_grp_offer_url',
'type' => 'text',
),
array(
'label' => 'Offer Currency',
'name' => 'saswp_product_grp_offer_currency',
'type' => 'text',
),
array(
'label' => 'Offer Price',
'name' => 'saswp_product_grp_offer_price',
'type' => 'number',
),
array(
'label' => 'Price Valid Until',
'name' => 'saswp_product_grp_schema_priceValidUntil',
'type' => 'text',
),
array(
'label' => 'Offer Item Condition',
'name' => 'saswp_product_grp_offer_icondition',
'type' => 'select',
'options' => array(
'NewCondition' => 'New Condition',
'RefurbishedCondition' => 'Refurbished Condition',
'UsedCondition' => 'Used Condition',
),
),
array(
'label' => 'Offer Availability',
'name' => 'saswp_product_grp_offer_avail',
'type' => 'select',
'options' => array(
'InStock' => 'In Stock',
'BackOrder' => 'Back Order',
'Discontinued' => 'Discontinued',
'Discontinued' => 'Discontinued',
'InStoreOnly' => 'In Store Only',
'LimitedAvailability' => 'Limited Availability',
'OnlineOnly' => 'Online Only',
'OutOfStock' => 'Out Of Stock',
'PreOrder' => 'Pre Order',
'PreSale' => 'Pre Sale',
'SoldOut' => 'Sold Out',
),
),
),
'feed_element' => array(
array(
'label' => 'Date Created',
Expand Down
Loading

0 comments on commit 001974a

Please sign in to comment.