Code Duplication    Length = 8-11 lines in 4 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 2 locations

@@ 2332-2342 (lines=11) @@
2329
        }
2330
        $success = $this->_cpt_model_obj->delete_permanently();
2331
        // did it all go as planned ?
2332
        if ($success) {
2333
            $msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID);
2334
            EE_Error::add_success($msg);
2335
        } else {
2336
            $msg = sprintf(
2337
                esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'),
2338
                $EVT_ID
2339
            );
2340
            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2341
            return false;
2342
        }
2343
        do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
2344
        return true;
2345
    }
@@ 2741-2751 (lines=11) @@
2738
        $insert_ids = $update
2739
            ? wp_update_term($cat_id, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY, $term_args)
2740
            : wp_insert_term($category_name, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY, $term_args);
2741
        if (! is_array($insert_ids)) {
2742
            $msg = esc_html__(
2743
                'An error occurred and the category has not been saved to the database.',
2744
                'event_espresso'
2745
            );
2746
            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2747
        } else {
2748
            $cat_id = $insert_ids['term_id'];
2749
            $msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name);
2750
            EE_Error::add_success($msg);
2751
        }
2752
        return $cat_id;
2753
    }
2754