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