PluginProbe
Ever Compare – Products Compare Plugin for WooCommerce / trunk
Ever Compare – Products Compare Plugin for WooCommerce vtrunk
1.3.7 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 trunk 1.0.0 1.0.1 1.0.2 All 31 releases
← All changes | includes/helper-functions.php +13 -8 1.3.4trunk View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +defined( 'ABSPATH' ) || exit;
2 3 /*
3 4 * Plugisn Options value
4 5 * return on/off
5 6 */
@@ -19,13 +20,12 @@
19 20 * @return [string]
20 21 */
21 22 function ever_compare_update_option( $section, $option_key, $new_value ){
22 23 $options_data = get_option( $section );
23 - if( isset( $options_data[$option_key] ) ){
24 - $options_data[$option_key] = $new_value;
25 - }else{
26 - $options_data = array( $option_key => $new_value );
24 + if ( ! is_array( $options_data ) ) {
25 + $options_data = array();
27 26 }
27 + $options_data[ $option_key ] = $new_value;
28 28 update_option( $section, $options_data );
29 29 }
30 30
31 31 /**
@@ -42,10 +42,10 @@
42 42 */
43 43 function ever_compare_get_post_list( $post_type = 'page' ){
44 44 $options = array();
45 45 $options['0'] = __('Select','ever-compare');
46 - $perpage = -1;
47 - $all_post = array( 'posts_per_page' => $perpage, 'post_type'=> $post_type );
46 + $perpage = 200;
47 + $all_post = array( 'posts_per_page' => $perpage, 'post_type'=> $post_type, 'no_found_rows' => true );
48 48 $post_terms = get_posts( $all_post );
49 49 if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ){
50 50 foreach ( $post_terms as $term ) {
51 51 $options[ $term->ID ] = $term->post_title;
@@ -86,9 +86,14 @@
86 86 function ever_compare_get_template( $tmp_name = '', $args = null, $echo = true ) {
87 87 $located = ever_compare_locate_template( $tmp_name );
88 88
89 89 if ( $args && is_array( $args ) ) {
90 - extract( $args );
90 + $evercompare_args = $args;
91 + // Backward compat: if template is overridden in theme, extract for legacy support
92 + $default_path = EVERCOMPARE_PATH . '/includes/templates/' . $tmp_name;
93 + if ( $located !== $default_path ) {
94 + extract( $args, EXTR_SKIP ); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
95 + }
91 96 }
92 97
93 98 if ( $echo !== true ) { ob_start(); }
94 99
@@ -106,9 +111,9 @@
106 111 */
107 112 function ever_compare_get_default_fields(){
108 113 $fields = array(
109 114 'title' => esc_html__( 'Title', 'ever-compare' ),
110 - 'ratting' => esc_html__( 'Ratting', 'ever-compare' ),
115 + 'ratting' => esc_html__( 'Rating', 'ever-compare' ),
111 116 'price' => esc_html__( 'Price', 'ever-compare' ),
112 117 'add_to_cart' => esc_html__( 'Add To Cart', 'ever-compare' ),
113 118 'description' => esc_html__( 'Description', 'ever-compare' ),
114 119 'availability' => esc_html__( 'Availability', 'ever-compare' ),