Code Duplication    Length = 5-23 lines in 10 locations

caffeinated/admin/extend/registrations/Extend_Registrations_Admin_Page.core.php 1 location

@@ 1031-1035 (lines=5) @@
1028
            );
1029
            $this->_redirect_after_action(false, '', '', $query_args, true);
1030
        }
1031
        if ($errors > 0) {
1032
            EE_Error::add_error(
1033
                sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors),
1034
                __FILE__,
1035
                __FUNCTION__,
1036
                __LINE__
1037
            );
1038
        } else {

modules/messages/EED_Messages.module.php 2 locations

@@ 1086-1105 (lines=20) @@
1083
        } else {
1084
            //can count how many sent by using the messages in the queue
1085
            $sent_count = $sent_queue->count_STS_in_queue(EEM_Message::instance()->stati_indicating_sent());
1086
            if ($sent_count > 0) {
1087
                EE_Error::add_success(
1088
                    sprintf(
1089
                        _n(
1090
                            'There was %d message successfully sent.',
1091
                            'There were %d messages successfully sent.',
1092
                            $sent_count,
1093
                            'event_espresso'
1094
                        ),
1095
                        $sent_count
1096
                    )
1097
                );
1098
            } else {
1099
                EE_Error::overwrite_errors();
1100
                EE_Error::add_error(
1101
                    __('No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error.
1102
					If there was an error, you can look at the messages in the message activity list table for any error messages.',
1103
                        'event_espresso'),
1104
                    __FILE__, __FUNCTION__, __LINE__
1105
                );
1106
            }
1107
        }
1108
        return $sent_queue;
@@ 1192-1209 (lines=18) @@
1189
            || EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
1190
        ) {
1191
            $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_sent);
1192
            if ($queue_count > 0) {
1193
                EE_Error::add_success(
1194
                    sprintf(
1195
                        _n(
1196
                            '%d message successfully sent.',
1197
                            '%d messages successfully sent.',
1198
                            $queue_count,
1199
                            'event_espresso'
1200
                        ),
1201
                        $queue_count
1202
                    )
1203
                );
1204
            } else {
1205
                EE_Error::add_error(
1206
                    __('No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.',
1207
                        'event_espresso'),
1208
                    __FILE__, __FUNCTION__, __LINE__
1209
                );
1210
            }
1211
        } else {
1212
            EE_Error::add_error(

caffeinated/modules/event_single_caff/EED_Event_Single_Caff.module.php 1 location

@@ 180-184 (lines=5) @@
177
			}
178
			$config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false );
179
		}
180
		if ( $config_saved ) {
181
			EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) );
182
		} else {
183
			EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
184
		}
185
		echo wp_json_encode( EE_Error::get_notices( false ));
186
		exit();
187
	}

caffeinated/modules/events_archive_caff/EED_Events_Archive_Caff.module.php 1 location

@@ 213-217 (lines=5) @@
210
			}
211
			$config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false );
212
		}
213
		if ( $config_saved ) {
214
			EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) );
215
		} else {
216
			EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
217
		}
218
		echo wp_json_encode( EE_Error::get_notices( false ) );
219
		exit();
220
	}

admin_pages/messages/Messages_Admin_Page.core.php 2 locations

@@ 2976-2985 (lines=10) @@
2973
            $message_type
2974
        )) {
2975
            $success = $this->_preview_message(true);
2976
            if ($success) {
2977
                EE_Error::add_success(__('Test message sent', 'event_espresso'));
2978
            } else {
2979
                EE_Error::add_error(
2980
                    esc_html__('The test message was not sent', 'event_espresso'),
2981
                    __FILE__,
2982
                    __FUNCTION__,
2983
                    __LINE__
2984
                );
2985
            }
2986
        }
2987
    }
2988
    
@@ 4334-4346 (lines=13) @@
4331
        //okay we should have the data all setup.  Now we just update!
4332
        $success = $this->_message_resource_manager->update_active_messengers_option();
4333
        
4334
        if ($success) {
4335
            EE_Error::add_success(__('Settings updated', 'event_espresso'));
4336
        } else {
4337
            EE_Error::add_error(
4338
                esc_html__(
4339
                    'Settings did not get updated',
4340
                    'event_espresso'
4341
                ),
4342
                __FILE__,
4343
                __FUNCTION__,
4344
                __LINE__
4345
            );
4346
        }
4347
        
4348
        $this->_template_args['success'] = $success;
4349
        $this->_return_json();

admin_pages/transactions/Transactions_Admin_Page.core.php 3 locations

@@ 1589-1611 (lines=23) @@
1586
                    __LINE__
1587
                );
1588
            }
1589
        } else {
1590
            if ($has_access) {
1591
                EE_Error::add_error(
1592
                    esc_html__(
1593
                        'The payment form data could not be processed. Please try again.',
1594
                        'event_espresso'
1595
                    ),
1596
                    __FILE__,
1597
                    __FUNCTION__,
1598
                    __LINE__
1599
                );
1600
            } else {
1601
                EE_Error::add_error(
1602
                    esc_html__(
1603
                        'You do not have access to apply payments or refunds to a registration.',
1604
                        'event_espresso'
1605
                    ),
1606
                    __FILE__,
1607
                    __FUNCTION__,
1608
                    __LINE__
1609
                );
1610
            }
1611
        }
1612
        $notices              = EE_Error::get_notices(
1613
            false,
1614
            false,
@@ 1850-1857 (lines=8) @@
1847
        /** @type EE_Transaction_Payments $transaction_payments */
1848
        $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1849
        //update the transaction with this payment
1850
        if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) {
1851
            EE_Error::add_success(esc_html__(
1852
                'The payment has been processed successfully.', 'event_espresso'),
1853
                __FILE__,
1854
                __FUNCTION__,
1855
                __LINE__
1856
            );
1857
        } else {
1858
            EE_Error::add_error(
1859
                esc_html__(
1860
                    'The payment was processed successfully but the amount paid for the transaction was not updated.',
@@ 2171-2191 (lines=21) @@
2168
                    __FILE__, __FUNCTION__, __LINE__
2169
                );
2170
            }
2171
        } else {
2172
            if ($can_delete) {
2173
                EE_Error::add_error(
2174
                    esc_html__(
2175
                        'A valid Payment ID was not received, therefore payment form data could not be loaded.',
2176
                        'event_espresso'
2177
                    ),
2178
                    __FILE__, __FUNCTION__, __LINE__
2179
                );
2180
            } else {
2181
                EE_Error::add_error(
2182
                    esc_html__(
2183
                        'You do not have access to delete a payment.',
2184
                        'event_espresso'
2185
                    ),
2186
                    __FILE__,
2187
                    __FUNCTION__,
2188
                    __LINE__
2189
                );
2190
            }
2191
        }
2192
        $notices              = EE_Error::get_notices(false, false, false);
2193
        $this->_template_args = array(
2194
            'data'      => $json_response_data,