Code Duplication    Length = 8-11 lines in 3 locations

admin_pages/venues/Venues_Admin_Page.core.php 2 locations

@@ 1135-1142 (lines=8) @@
1132
        $venue->_remove_relations('Term_Taxonomy');
1133
        $success = $venue->delete_permanently();
1134
        // did it all go as planned ?
1135
        if ($success) {
1136
            $msg = sprintf(__('Venue ID # %d has been deleted.', 'event_espresso'), $VNU_ID);
1137
            EE_Error::add_success($msg);
1138
        } else {
1139
            $msg = sprintf(__('An error occurred. Venue ID # %d could not be deleted.', 'event_espresso'), $VNU_ID);
1140
            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1141
            return false;
1142
        }
1143
        do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted');
1144
        return true;
1145
    }
@@ 1456-1463 (lines=8) @@
1453
                $term_args
1454
            );
1455
1456
        if (! is_array($insert_ids)) {
1457
            $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
1458
            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1459
        } else {
1460
            $cat_id = $insert_ids['term_id'];
1461
            $msg = sprintf(__('The category %s was successfully created', 'event_espresso'), $category_name);
1462
            EE_Error::add_success($msg);
1463
        }
1464
1465
        return $cat_id;
1466
    }

admin_pages/events/Events_Admin_Page.core.php 1 location

@@ 2574-2584 (lines=11) @@
2571
        $insert_ids = $update
2572
            ? wp_update_term($cat_id, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY, $term_args)
2573
            : wp_insert_term($category_name, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY, $term_args);
2574
        if (! is_array($insert_ids)) {
2575
            $msg = esc_html__(
2576
                'An error occurred and the category has not been saved to the database.',
2577
                'event_espresso'
2578
            );
2579
            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2580
        } else {
2581
            $cat_id = $insert_ids['term_id'];
2582
            $msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name);
2583
            EE_Error::add_success($msg);
2584
        }
2585
        return $cat_id;
2586
    }
2587