Code Duplication    Length = 26-26 lines in 2 locations

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

@@ 1083-1108 (lines=26) @@
1080
		$TKT = EEM_Ticket::instance();
1081
1082
		//checkboxes?
1083
		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
1084
			//if array has more than one element then success message should be plural
1085
			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1086
1087
			//cycle thru the boxes
1088
			while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
1089
				if ( $trash ) {
1090
					if ( ! $TKT->delete_by_ID( $TKT_ID ) )
1091
						$success = 0;
1092
				} else {
1093
					if ( ! $TKT->restore_by_ID( $TKT_ID ) )
1094
						$success = 0;
1095
				}
1096
			}
1097
		} else {
1098
			//grab single id and trash
1099
			$TKT_ID = absint( $this->_req_data['TKT_ID'] );
1100
1101
			if ( $trash ) {
1102
				if ( ! $TKT->delete_by_ID( $TKT_ID ) )
1103
					$success = 0;
1104
			} else {
1105
				if ( ! $TKT->restore_by_ID( $TKT_ID ) )
1106
					$success = 0;
1107
			}
1108
		}
1109
1110
		$action_desc = $trash ? 'moved to the trash' : 'restored';
1111
		$query_args = array(

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

@@ 239-264 (lines=26) @@
236
		$TKT = EEM_Ticket::instance();
237
238
		//checkboxes?
239
		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
240
			//if array has more than one element then success message should be plural
241
			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
242
243
			//cycle thru the boxes
244
			while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
245
				if ( $trash ) {
246
					if ( ! $TKT->delete_by_ID( $TKT_ID ) )
247
						$success = 0;
248
				} else {
249
					if ( ! $TKT->restore_by_ID( $TKT_ID ) )
250
						$success = 0;
251
				}
252
			}
253
		} else {
254
			//grab single id and trash
255
			$TKT_ID = absint( $this->_req_data['TKT_ID'] );
256
257
			if ( $trash ) {
258
				if ( ! $TKT->delete_by_ID( $TKT_ID ) )
259
					$success = 0;
260
			} else {
261
				if ( ! $TKT->restore_by_ID( $TKT_ID ) )
262
					$success = 0;
263
			}
264
		}
265
266
		$action_desc = $trash ? 'moved to the trash' : 'restored';
267
		$this->_redirect_after_action( $success, 'Tickets', $action_desc, array() );