@@ 241-249 (lines=9) @@ | ||
238 | $matches = array(); |
|
239 | if($model_name == EE_CSV::metadata_header){ |
|
240 | $headers[$i] = $column_name; |
|
241 | }else{ |
|
242 | //now get the db table name from it (the part between square brackets) |
|
243 | $success = preg_match('~(.*)\[(.*)\]~', $column_name,$matches); |
|
244 | if (!$success){ |
|
245 | EE_Error::add_error( sprintf(__("The column titled %s is invalid for importing. It must be be in the format of 'Nice Name[model_field_name]' in row %s", "event_espresso"),$column_name,implode(",",$data)), __FILE__, __FUNCTION__, __LINE__ ); |
|
246 | return false; |
|
247 | } |
|
248 | $headers[$i] = $matches[2]; |
|
249 | } |
|
250 | ||
251 | }else{ |
|
252 | // no column names means our final array will just use counters for keys |
@@ 1361-1368 (lines=8) @@ | ||
1358 | ||
1359 | $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args ); |
|
1360 | ||
1361 | if ( !is_array( $insert_ids ) ) { |
|
1362 | $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
1363 | EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1364 | } else { |
|
1365 | $cat_id = $insert_ids['term_id']; |
|
1366 | $msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name ); |
|
1367 | EE_Error::add_success( $msg ); |
|
1368 | } |
|
1369 | ||
1370 | return $cat_id; |
|
1371 | } |
@@ 2253-2260 (lines=8) @@ | ||
2250 | } |
|
2251 | $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2252 | ||
2253 | if ( !is_array( $insert_ids ) ) { |
|
2254 | $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
2255 | EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2256 | } else { |
|
2257 | $cat_id = $insert_ids['term_id']; |
|
2258 | $msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name ); |
|
2259 | EE_Error::add_success( $msg ); |
|
2260 | } |
|
2261 | ||
2262 | return $cat_id; |
|
2263 | } |