@@ 1365-1372 (lines=8) @@ | ||
1362 | ||
1363 | $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args ); |
|
1364 | ||
1365 | if ( !is_array( $insert_ids ) ) { |
|
1366 | $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
1367 | EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1368 | } else { |
|
1369 | $cat_id = $insert_ids['term_id']; |
|
1370 | $msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name ); |
|
1371 | EE_Error::add_success( $msg ); |
|
1372 | } |
|
1373 | ||
1374 | return $cat_id; |
|
1375 | } |
@@ 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 |
@@ 2261-2268 (lines=8) @@ | ||
2258 | } |
|
2259 | $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2260 | ||
2261 | if ( !is_array( $insert_ids ) ) { |
|
2262 | $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
2263 | EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2264 | } else { |
|
2265 | $cat_id = $insert_ids['term_id']; |
|
2266 | $msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name ); |
|
2267 | EE_Error::add_success( $msg ); |
|
2268 | } |
|
2269 | ||
2270 | return $cat_id; |
|
2271 | } |