| @@ -132,9 +132,8 @@ | ||
| 132 | 132 | foreach($map as $key => $value){ |
| 133 | 133 | $csv_value= trim($map[$key]); |
| 134 | 134 | |
| 135 | 135 | if(!empty($csv_value)){ |
| 136 | - //if(preg_match_all('/{(\w+)}/', $csv_value, $matches)){ | |
| 137 | 136 | $pattern = "/({([a-z A-Z 0-9 | , _ -]+)(.*?)(}))/"; |
| 138 | 137 | if(preg_match_all($pattern, $csv_value, $matches, PREG_PATTERN_ORDER)){ |
| 139 | 138 | $csv_element = $csv_value; |
| 140 | 139 | |
| @@ -158,9 +157,8 @@ | ||
| 158 | 157 | $wp_element= trim($key); |
| 159 | 158 | if(!empty($csv_element) && !empty($wp_element)){ |
| 160 | 159 | $post_values[$wp_element] = $csv_element; |
| 161 | 160 | } |
| 162 | - //} | |
| 163 | 161 | } |
| 164 | 162 | |
| 165 | 163 | elseif(!in_array($csv_value , $header_array)){ |
| 166 | 164 | $wp_element= trim($key); |
| @@ -185,9 +183,9 @@ | ||
| 185 | 183 | public function evalmath($equation) { |
| 186 | 184 | |
| 187 | 185 | $result = 0; |
| 188 | 186 | |
| 189 | - // sanitize input | |
| 187 | + //input | |
| 190 | 188 | $equation = preg_replace("/[^0-9+\-.*\/()%]/","",$equation); |
| 191 | 189 | |
| 192 | 190 | // convert percentages to decimal |
| 193 | 191 | $equation = preg_replace("/([+-])([0-9]{1})(%)/","*(1\$1.0\$2)",$equation); |
| @@ -301,9 +299,9 @@ | ||
| 301 | 299 | public function update_count($hash_key){ |
| 302 | 300 | $response = []; |
| 303 | 301 | global $wpdb; |
| 304 | 302 | $log_table_name = $wpdb->prefix ."import_detail_log"; |
| 305 | - $get_data = $wpdb->get_results("SELECT skipped , created , updated FROM $log_table_name WHERE hash_key = '$hash_key' "); | |
| 303 | + $get_data = $wpdb->get_results($wpdb->prepare("SELECT skipped , created , updated FROM $log_table_name WHERE hash_key = %s", $hash_key)); | |
| 306 | 304 | $skipped = $get_data[0]->skipped; |
| 307 | 305 | $response['skipped'] = $skipped + 1; |
| 308 | 306 | $created = $get_data[0]->created; |
| 309 | 307 | $response['created'] = $created + 1; |