Skip to content

Commit

Permalink
Merge pull request #2196 from ahmedkaludi/1.37
Browse files Browse the repository at this point in the history
1.37
  • Loading branch information
shridhamdeveloper authored Oct 9, 2024
2 parents afa53b4 + 053de02 commit e23d841
Show file tree
Hide file tree
Showing 19 changed files with 257 additions and 86 deletions.
7 changes: 4 additions & 3 deletions admin_section/common-function.php
Original file line number Diff line number Diff line change
Expand Up @@ -2755,7 +2755,7 @@ function saswp_get_author_details() {

$author_image = array();

if ( function_exists( 'get_avatar_data') ) {
if ( function_exists( 'get_avatar_data') && ! empty( get_option( 'show_avatars' ) ) ) {
$author_image = get_avatar_data($author_id);
}

Expand Down Expand Up @@ -2880,7 +2880,7 @@ function saswp_get_multiple_author_details($author_details)

$author_image = array();

if ( function_exists( 'get_avatar_data') ) {
if ( function_exists( 'get_avatar_data') && ! empty( get_option( 'show_avatars' ) ) ) {
$author_image = get_avatar_data($author_id);
}

Expand Down Expand Up @@ -3581,7 +3581,8 @@ function saswp_get_field_note($pname){
'modern_events_calendar' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/modern-events-calendar-lite/">Modern Events Calendar</a>',
'flex_mls_idx' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/flexmls-idx/">FlexMLS IDX</a>',
'woocommerce_membership' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://woocommerce.com/products/woocommerce-memberships">Woocommerce Membership</a>',
'woocommerce_bookings' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://woocommerce.com/products/woocommerce-bookings">Woocommerce Bookings</a>',
'woocommerce_bookings' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://woocommerce.com/products/woocommerce-bookings">Woocommerce Bookings</a>',
'woo_discount_rules' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://wordpress.org/plugins/woo-discount-rules">Discount Rules for WooCommerce</a>',
'extra' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://www.elegantthemes.com/gallery/extra/">Extra Theme</a>',
'homeland' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://themeforest.net/item/homeland-responsive-real-estate-theme-for-wordpress/6518965">Homeland</a>',
'ratency' => esc_html__( 'Requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="https://themeforest.net/item/ratency-review-magazine-theme/21303977">Ratency - Review & Magazine Theme</a>',
Expand Down
2 changes: 1 addition & 1 deletion admin_section/css/main-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ Compatibility tab css ends
.saswp-knowledge-label label[for="saswp_breadcrumb_include_parent_cat_checkbox"] {
padding-left: 10px;
}
.saswp-knowledge-label label[for="saswp-woocommerce-booking-checkbox"] {
.saswp-knowledge-label label[for="saswp-woocommerce-booking-checkbox"], .saswp-knowledge-label label[for="saswp-woo-discount-rules-checkbox"] {
padding-left: 10px;
}

Expand Down
2 changes: 1 addition & 1 deletion admin_section/css/main-style.min.css

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion admin_section/js/functions-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,23 @@
jQuery.get(ajaxurl,
{ action:"saswp_get_meta_list", saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
function(response){
saswp_meta_list[type] = response[type];
saswp_meta_list[type] = response[type];
if( fields_name == 'saswpimage_object_url' ) {
jQuery.each( response['image'], function( ri, re ) {
if( saswp_meta_list[type].length > 0 ) {
jQuery.each( saswp_meta_list[type], function( smli,smle ) {
if( smle['label'].length > 0 && re['label'].length > 0 ) {
if( smle['label'] == re['label'] ) {
jQuery.each( re['meta-list'], function( imgI, imgE ) {
saswp_meta_list[type][smli]['meta-list'][imgI] = imgE;
});
}
}
});
}

});
}
saswp_meta_list_html(current_fly, saswp_meta_list[type], fields, fields_name, id, tr);

},'json');
Expand Down
2 changes: 1 addition & 1 deletion admin_section/js/functions-list.min.js

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions admin_section/js/main-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1665,6 +1665,15 @@ jQuery(document).ready(function($){
}
break;

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

case 'saswp-woocommerce-booking-main-checkbox':
saswp_compatibliy_notes(current, id);
if ($(this).is(':checked')) {
Expand Down
2 changes: 1 addition & 1 deletion admin_section/js/main-script.min.js

Large diffs are not rendered by default.

40 changes: 31 additions & 9 deletions admin_section/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4074,6 +4074,19 @@ function saswp_compatibility_page_callback() {
)
);

$woo_discount_rules = array(
'label' => 'Discount Rules for WooCommerce',
'id' => 'saswp-woo-discount-rules-checkbox',
'name' => 'saswp-woo-discount-rules-checkbox',
'type' => 'checkbox',
'class' => 'checkbox saswp-checkbox',
'note' => saswp_get_field_note('woo_discount_rules'),
'hidden' => array(
'id' => 'saswp-woo-discount-rules',
'name' => 'sd_data[saswp-woo-discount-rules]',
)
);

$cooked = array(
'label' => 'Cooked',
'id' => 'saswp-cooked-checkbox',
Expand Down Expand Up @@ -4336,8 +4349,10 @@ function saswp_compatibility_page_callback() {
);

if(!is_plugin_active('woocommerce-compatibility-for-schema/woocommerce-compatibility-for-schema.php') ) {

$woocommerce_bok['note'] = esc_html__( 'This feature requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="http://structured-data-for-wp.com/woocommerce-compatibility-for-schema/">Woocommerce Addon</a>';

$woo_note = esc_html__( 'This feature requires', 'schema-and-structured-data-for-wp' ) .' <a target="_blank" href="http://structured-data-for-wp.com/woocommerce-compatibility-for-schema/">Woocommerce Addon</a>';
$woocommerce_bok['note'] = $woo_note;
$woo_discount_rules['note'] = $woo_note;

}

Expand Down Expand Up @@ -4502,6 +4517,7 @@ function saswp_compatibility_page_callback() {
$woocommerce,
$woocommerce_bok,
$woocommerce_mem,
$woo_discount_rules,
$cooked,
$soledad,
$enfold,
Expand Down Expand Up @@ -4668,7 +4684,7 @@ function saswp_compatibility_page_callback() {

foreach ( $act_meta_fields as $key => $field){

if($field['hidden']['id'] == 'saswp-woocommerce-booking' || $field['hidden']['id'] == 'saswp-woocommerce-membership'){
if( $field['hidden']['id'] == 'saswp-woocommerce-booking' || $field['hidden']['id'] == 'saswp-woocommerce-membership' || $field['hidden']['id'] == 'saswp-woo-discount-rules' ) {

if(!array_search('saswp-woocommerce', $active_plugins) ) {

Expand Down Expand Up @@ -4716,7 +4732,7 @@ function saswp_compatibility_page_callback() {

foreach ( $ina_meta_fields as $key => $field){

if($field['hidden']['id'] == 'saswp-woocommerce-booking' || $field['hidden']['id'] == 'saswp-woocommerce-membership'){
if( $field['hidden']['id'] == 'saswp-woocommerce-booking' || $field['hidden']['id'] == 'saswp-woocommerce-membership' || $field['hidden']['id'] == 'saswp-woo-discount-rules' ) {

if(array_search('saswp-woocommerce', $active_plugins) ) {

Expand Down Expand Up @@ -4893,11 +4909,9 @@ function saswp_enqueue_style_js( $hook ) {

wp_enqueue_script('thickbox');
wp_enqueue_style('thickbox');

if( ! class_exists( 'acf' ) ) {
wp_enqueue_script( 'saswp-timepicker-js', SASWP_PLUGIN_URL . 'admin_section/js/jquery.timepicker.js', array( 'jquery' ), SASWP_VERSION, true);
wp_enqueue_style( 'saswp-timepicker-css', SASWP_PLUGIN_URL . 'admin_section/css/jquery.timepicker.css', false , SASWP_VERSION );
}

wp_enqueue_script( 'saswp-timepicker-js', SASWP_PLUGIN_URL . 'admin_section/js/jquery.timepicker.js', array( 'jquery' ), SASWP_VERSION, true);
wp_enqueue_style( 'saswp-timepicker-css', SASWP_PLUGIN_URL . 'admin_section/css/jquery.timepicker.css', false , SASWP_VERSION );

if( !class_exists('TM_Builder_Core') ){

Expand Down Expand Up @@ -4987,6 +5001,14 @@ 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' ) ) {
wp_dequeue_script('saswp-timepicker-js');
}
}

}

function saswp_dequeue_other_select2_on_saswp_screen() {
Expand Down
69 changes: 43 additions & 26 deletions admin_section/structure-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,51 +655,52 @@ function saswp_comparison_logic_checker($input, $post){
// Get the list of all the taxonomies associated with current post
$taxonomy_names = '';

if(is_object($post) ) {
if ( is_object( $post ) ) {
$taxonomy_names = get_post_taxonomies( $post->ID );
}

$checker = '';
$post_terms = null;

if ( $data != 'all') {
if ( $data != 'all' ) {

if(is_object($post) ) {
if ( is_object( $post ) && is_singular() ) {

$post_term_data = wp_get_post_terms( $post->ID, $data );

$post_term_data = wp_get_post_terms($post->ID, $data);
if ( ! is_wp_error( $post_term_data) ) {
if ( ! is_wp_error( $post_term_data ) ) {
$post_terms = $post_term_data;
}

}

if ( isset( $input['key_4'] ) && $input['key_4'] !='all'){
if ( isset( $input['key_4'] ) && $input['key_4'] !='all' ){

$term_data = $input['key_4'];
$termChoices = array();

if(is_tax() || is_tag() ) {
if ( is_tax() || is_tag() || is_category() ) {

$queried_obj = get_queried_object();
$termChoices[] = $queried_obj->slug;
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information but only loading it inside the admin_init hook.
}elseif( isset($_GET['tag_ID'] ) && is_admin() ){
}elseif( isset( $_GET['tag_ID'] ) && is_admin() ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information but only loading it inside the admin_init hook.
$term_object = get_term( intval($_GET['tag_ID']) );
$term_object = get_term( intval( $_GET['tag_ID'] ) );
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information but only loading it inside the admin_init hook.
$termChoices[] = $term_object->slug;

}else{

if( is_object($post) ) {
if ( is_object( $post ) ) {

$terms = wp_get_post_terms( $post->ID ,$data);
$terms = wp_get_post_terms( $post->ID ,$data );

if ( ! is_wp_error( $terms) ) {

if(count($terms)>0){
if ( count( $terms ) > 0 ) {

foreach ( $terms as $key => $termvalue) {
foreach ( $terms as $key => $termvalue ) {

$termChoices[] = $termvalue->slug;

Expand All @@ -715,36 +716,52 @@ function saswp_comparison_logic_checker($input, $post){


if ( $comparison == 'equal' ) {
if(in_array($term_data, $termChoices) ) {
$result = true;
if ( in_array( $term_data, $termChoices ) ) {
$result = true;
}
}

if ( $comparison == 'not_equal') {
if(!in_array($term_data, $termChoices) ) {
if ( $comparison == 'not_equal' ) {
if ( ! in_array( $term_data, $termChoices ) ) {
$result = true;
}
}

}else{
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information but only loading it inside the admin_init hook.
if( isset($_GET['tag_ID'] ) && is_admin() ){
if ( isset( $_GET['tag_ID'] ) && is_admin() ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information but only loading it inside the admin_init hook.
$term_object = get_term( intval($_GET['tag_ID']) );
$term_object = get_term( intval( $_GET['tag_ID'] ) );
$post_terms[] = $term_object->slug;

}

if( isset($input['key_4']) && $input['key_4'] == 'all' ) {

if ( isset( $input['key_4'] ) && $input['key_4'] == 'all' ) {

$tax_name = '';

if ( is_tax() || is_tag() || is_category() ) {

$queried_obj = get_queried_object();
if ( is_object( $queried_obj ) ) {
$tax_name = $queried_obj->taxonomy;
}
}

if ( $comparison == 'equal' ) {
if ( $post_terms ) {
$result = true;
}
if ( $data == $tax_name ) {
$result = true;
}
}

if ( $comparison == 'not_equal') {
if ( !$post_terms ) {
if ( $comparison == 'not_equal' ) {
if ( ! $post_terms ) {
$result = true;
}
if ( $data != $tax_name ) {
$result = true;
}
}
Expand All @@ -757,9 +774,9 @@ function saswp_comparison_logic_checker($input, $post){
}
}

if ( $comparison == 'not_equal') {
if ( is_array( $taxonomy_names) ) {
$checker = in_array($data, $taxonomy_names);
if ( $comparison == 'not_equal' ) {
if ( is_array( $taxonomy_names ) ) {
$checker = in_array( $data, $taxonomy_names );
if ( ! $checker ) {
$result = true;
}
Expand Down
6 changes: 6 additions & 0 deletions core/array-list/compatibility-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,12 @@
'part_in' => 'pro',
'parent' => 'woocommerce'
),
'woo_discount_rules' => array(
'name' => 'Discount Rules for WooCommerce',
'free' => 'woo-discount-rules/woo-discount-rules.php',
'opt_name' => 'saswp-woo-discount-rules',
'part_in' => 'free',
),
'cooked' => array(
'name' => 'Cooked',
'free' => 'cooked/cooked.php',
Expand Down
13 changes: 12 additions & 1 deletion core/array-list/schema-properties.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
$author_url = get_the_author_meta('user_url',$author_id);
}

if ( function_exists( 'get_avatar_data') && is_object($current_user) ){
if ( function_exists( 'get_avatar_data') && is_object($current_user) && ! empty( get_option( 'show_avatars' ) ) ) {
$author_details = get_avatar_data($current_user->ID);
}

Expand Down Expand Up @@ -7135,11 +7135,22 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,

case 'ImageObject':
$meta_field = array(
array(
'label' => 'ID',
'id' => 'saswpimage_object_id_'.$schema_id,
'type' => 'text',
'default' => 'ImageObject'
),
array(
'label' => 'URL',
'id' => 'saswpimage_object_url_'.$schema_id,
'type' => 'text',
'default' => get_permalink()
),
array(
'label' => 'Image',
'id' => 'saswpimage_object_image_'.$schema_id,
'type' => 'media'
),
array(
'label' => 'Date Published',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,4 +432,4 @@ public function saswp_rating_box_appearance()
}
if (class_exists('SASWP_Rating_Box_Backend')) {
new SASWP_Rating_Box_Backend();
};
};
Loading

0 comments on commit e23d841

Please sign in to comment.