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 +34 -8 1.2.5 → trunk 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' ),
@@ -215,5 +220,26 @@
215 220 'loading' => '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 471.701 471.701">
216 221 <g class="ever-compare-refresh"><path d="M409.6,0c-9.426,0-17.067,7.641-17.067,17.067v62.344C304.667-5.656,164.478-3.386,79.411,84.479 c-40.09,41.409-62.455,96.818-62.344,154.454c0,9.426,7.641,17.067,17.067,17.067S51.2,248.359,51.2,238.933 c0.021-103.682,84.088-187.717,187.771-187.696c52.657,0.01,102.888,22.135,138.442,60.976l-75.605,25.207 c-8.954,2.979-13.799,12.652-10.82,21.606s12.652,13.799,21.606,10.82l102.4-34.133c6.99-2.328,11.697-8.88,11.674-16.247v-102.4 C426.667,7.641,419.026,0,409.6,0z"/><path d="M443.733,221.867c-9.426,0-17.067,7.641-17.067,17.067c-0.021,103.682-84.088,187.717-187.771,187.696 c-52.657-0.01-102.888-22.135-138.442-60.976l75.605-25.207c8.954-2.979,13.799-12.652,10.82-21.606 c-2.979-8.954-12.652-13.799-21.606-10.82l-102.4,34.133c-6.99,2.328-11.697,8.88-11.674,16.247v102.4 c0,9.426,7.641,17.067,17.067,17.067s17.067-7.641,17.067-17.067v-62.345c87.866,85.067,228.056,82.798,313.122-5.068 c40.09-41.409,62.455-96.818,62.344-154.454C460.8,229.508,453.159,221.867,443.733,221.867z"/></g></svg>'
217 222 ];
218 223 return ( $key == '' ) ? $icon_list : $icon_list[$key];
224 +}
225 +
226 +function get_allowed_tags_for_svg () {
227 + return [
228 + 'svg' => [
229 + 'xmlns' => true,
230 + 'width' => true,
231 + 'height' => true,
232 + 'viewbox' => true,
233 + 'xmlns:xlink' => true,
234 + ],
235 + 'g' => [
236 + 'class' => true,
237 + ],
238 + 'path' => [
239 + 'd' => true,
240 + ],
241 + 'span' => [
242 + 'class' => true,
243 + ],
244 + ];
219 245 }