Skip to content

Commit

Permalink
chore: fixed small warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigoreMihai committed Feb 27, 2024
1 parent 5ea10b7 commit e374365
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
9 changes: 4 additions & 5 deletions classes/form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* @version 1.0
*/

/*
**========== Block direct access ===========
/*
**========== Block direct access ===========
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
Expand Down Expand Up @@ -37,7 +37,7 @@ class PPOM_Form {
*
* @var object
*/
// public static $product;
public $product;

/**
* Return templates args
Expand All @@ -48,7 +48,6 @@ class PPOM_Form {

function __construct( $product, $args ) {


$this->product = $product;

$this->product_id = ppom_get_product_id( $this->product );
Expand Down Expand Up @@ -364,7 +363,7 @@ function get_field_default_value( $posted_values, $data_name, $meta ) {
default:
$default_value = $posted_values[ $data_name ];
break;
}
}
} elseif ( isset( $_GET[ $data_name ] ) ) {
// When Cart Edit addon used.
$edit_data = isset( $_GET[ $data_name ] ) ? $_GET[ $data_name ] : '';
Expand Down
18 changes: 11 additions & 7 deletions classes/ppom.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ function get_meta_id( $product_id ) {
$ppom_product_id = array_merge( $ppom_in_category, $ppom_product_id );
} else {
$ppom_product_id = array_merge( $ppom_product_id, $ppom_in_category );
}
}
} elseif ( ! $ppom_product_id ) { // If no meta groups attached to products

$ppom_product_id = $ppom_in_category;
}
break;

}
}
}

return apply_filters( 'ppom_product_meta_id', $ppom_product_id, $product_id );
Expand Down Expand Up @@ -254,7 +254,11 @@ function settings() {
}

global $wpdb;
$meta_id = implode( ',', $this->meta_id );

if ( is_array( $meta_id ) ) {
$meta_id = implode( ',', $meta_id );
}

$qry = 'SELECT * FROM ' . $wpdb->prefix . PPOM_TABLE_META . " WHERE productmeta_id IN($meta_id)";
$meta_settings = $wpdb->get_results( $qry );
$filter_meta = array_filter(
Expand Down Expand Up @@ -308,7 +312,7 @@ function get_fields() {
(array) $meta_fields,
function ( $field ) {
return ! isset( $field['status'] ) || $field['status'] == 'on';
}
}
);

// ppom_pa($meta_fields);
Expand Down Expand Up @@ -338,14 +342,14 @@ function get_fields_by_id( $ppom_id ) {
$meta_fields,
function ( $field ) {
return ! isset( $field['status'] ) || $field['status'] == 'on';
}
}
);

$meta_fields = array_filter(
$meta_fields,
function ( $field ) {
return ! isset( $field['status'] ) || $field['status'] == 'on';
}
}
);

// if( empty($meta_fields) ) return null;
Expand Down Expand Up @@ -380,7 +384,7 @@ function ppom_has_category_meta( $product_id ) {
$meta_found[] = $meta_cats->productmeta_id;
}
}
}
}
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions inc/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function ppom_admin_product_meta_column( $column, $post_id ) {
'productmeta_id' => $ppom_setting->productmeta_id,
'do_meta' => 'edit',
),
$ppom_settings_url
$ppom_settings_url
);
echo sprintf( __( '<a href="%1$s">%2$s</a>', 'woocommerce-product-addon' ), esc_url( $url_edit ), $meta_title );
echo ', ';
Expand All @@ -59,7 +59,7 @@ function ppom_admin_product_meta_column( $column, $post_id ) {
'productmeta_id' => $ppom->meta_id,
'do_meta' => 'edit',
),
$ppom_settings_url
$ppom_settings_url
);
echo sprintf( __( '<a href="%1$s">%2$s</a>', 'woocommerce-product-addon' ), esc_url( $url_edit ), $ppom->meta_title );
} else {
Expand Down Expand Up @@ -149,7 +149,7 @@ function ppom_admin_process_product_meta( $post_id ) {
$ppom_meta_selected = intval( $ppom_meta_selected );
}

// ppom_pa($ppom_meta_selected); exit;
// ppom_pa($ppom_meta_selected); exit;
update_post_meta( $post_id, PPOM_PRODUCT_META_KEY, $ppom_meta_selected );

do_action( 'ppom_proccess_meta', $post_id );
Expand Down Expand Up @@ -210,7 +210,7 @@ function ppom_admin_save_form_meta() {
$aviary_api_key = 'NA';
$show_cart_thumb = 'NA';

$ppom_meta = isset( $_REQUEST['ppom_meta'] ) ? $_REQUEST['ppom_meta'] : $_REQUEST['ppom'];
$ppom_meta = ( isset($_REQUEST['ppom_meta']) ? $_REQUEST['ppom_meta'] : isset($_REQUEST['ppom']) ) ? $_REQUEST['ppom'] : '';

if ( empty( $ppom_meta ) ) {
$resp = array(
Expand Down Expand Up @@ -257,7 +257,7 @@ function ppom_admin_save_form_meta() {
'productmeta_categories' => $productmeta_categories,
'the_meta' => $product_meta,
'productmeta_created' => current_time( 'mysql' ),
)
)
);


Expand Down Expand Up @@ -413,7 +413,7 @@ function( $pm ) {
'productmeta_categories' => $productmeta_categories,
'the_meta' => $product_meta,
),
$productmeta_id
$productmeta_id
);

// wp_send_json($dt);
Expand Down Expand Up @@ -687,7 +687,7 @@ function ppom_admin_bar_menu() {
'id' => 'ppom-setting-bar',
'title' => sprintf( __( '%s', 'woocommerce-product-addon' ), $bar_title ),
'href' => esc_url( $ppom_setting_url ),
)
)
);

$all_meta = PPOM()->get_product_meta_all();
Expand All @@ -708,7 +708,7 @@ function ppom_admin_bar_menu() {
'title' => sprintf( __( '%s', 'woocommerce-product-addon' ), $bar_title ),
'href' => esc_url( $apply_link ),
'parent' => 'ppom-setting-bar',
)
)
);
}
}
Expand All @@ -720,4 +720,4 @@ function ppom_admin_update_pro_notice() {
echo '<div class="ppom-more-plugins-block pb-5">';
echo '<a class="btn btn-sm btn-primary ppom-nm-plugins" href="' . esc_url( $buy_paddle ) . '">' . __( 'Add more field types', 'woocommerce-product-addon' ) . '</a>';
echo '</div>';
}
}

0 comments on commit e374365

Please sign in to comment.