Code Duplication    Length = 18-18 lines in 2 locations

caffeinated/admin/new/tickets/Tickets_Admin_Page.core.php 1 location

@@ 291-308 (lines=18) @@
288
        $TKT = EEM_Ticket::instance();
289
290
        // checkboxes?
291
        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
292
            // if array has more than one element then success message should be plural
293
            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
294
295
            // cycle thru the boxes
296
            while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
297
                // delete
298
                if (! $this->_delete_the_ticket($TKT_ID)) {
299
                    $success = 0;
300
                }
301
            }
302
        } else {
303
            // grab single id and trash
304
            $TKT_ID = absint($this->_req_data['TKT_ID']);
305
            if (! $this->_delete_the_ticket($TKT_ID)) {
306
                $success = 0;
307
            }
308
        }
309
310
        $action_desc = 'deleted';
311
        $this->_redirect_after_action($success, 'Tickets', $action_desc, array());

caffeinated/admin/extend/events/Extend_Events_Admin_Page.core.php 1 location

@@ 1279-1296 (lines=18) @@
1276
    {
1277
        $success = 1;
1278
        // checkboxes?
1279
        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1280
            // if array has more than one element then success message should be plural
1281
            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1282
            // cycle thru the boxes
1283
            while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
1284
                // delete
1285
                if (! $this->_delete_the_ticket($TKT_ID)) {
1286
                    $success = 0;
1287
                }
1288
            }
1289
        } else {
1290
            // grab single id and trash
1291
            $TKT_ID = absint($this->_req_data['TKT_ID']);
1292
            if (! $this->_delete_the_ticket($TKT_ID)) {
1293
                $success = 0;
1294
            }
1295
        }
1296
        $action_desc = 'deleted';
1297
        $query_args = array(
1298
            'action' => 'ticket_list_table',
1299
            'status' => 'trashed',