Code Duplication    Length = 5-23 lines in 10 locations

admin_pages/messages/Messages_Admin_Page.core.php 2 locations

@@ 2999-3008 (lines=10) @@
2996
            $message_type
2997
        )) {
2998
            $success = $this->_preview_message(true);
2999
            if ($success) {
3000
                EE_Error::add_success(__('Test message sent', 'event_espresso'));
3001
            } else {
3002
                EE_Error::add_error(
3003
                    esc_html__('The test message was not sent', 'event_espresso'),
3004
                    __FILE__,
3005
                    __FUNCTION__,
3006
                    __LINE__
3007
                );
3008
            }
3009
        }
3010
    }
3011
@@ 4371-4383 (lines=13) @@
4368
        // okay we should have the data all setup.  Now we just update!
4369
        $success = $this->_message_resource_manager->update_active_messengers_option();
4370
4371
        if ($success) {
4372
            EE_Error::add_success(__('Settings updated', 'event_espresso'));
4373
        } else {
4374
            EE_Error::add_error(
4375
                esc_html__(
4376
                    'Settings did not get updated',
4377
                    'event_espresso'
4378
                ),
4379
                __FILE__,
4380
                __FUNCTION__,
4381
                __LINE__
4382
            );
4383
        }
4384
4385
        $this->_template_args['success'] = $success;
4386
        $this->_return_json();

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

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

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

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

modules/messages/EED_Messages.module.php 2 locations

@@ 1158-1177 (lines=20) @@
1155
        } else {
1156
            // can count how many sent by using the messages in the queue
1157
            $sent_count = $sent_queue->count_STS_in_queue(EEM_Message::instance()->stati_indicating_sent());
1158
            if ($sent_count > 0) {
1159
                EE_Error::add_success(
1160
                    sprintf(
1161
                        _n(
1162
                            'There was %d message successfully sent.',
1163
                            'There were %d messages successfully sent.',
1164
                            $sent_count,
1165
                            'event_espresso'
1166
                        ),
1167
                        $sent_count
1168
                    )
1169
                );
1170
            } else {
1171
                EE_Error::overwrite_errors();
1172
                EE_Error::add_error(
1173
                    __(
1174
                        '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.
1175
					If there was an error, you can look at the messages in the message activity list table for any error messages.',
1176
                        'event_espresso'
1177
                    ),
1178
                    __FILE__,
1179
                    __FUNCTION__,
1180
                    __LINE__
@@ 1266-1283 (lines=18) @@
1263
            || EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
1264
        ) {
1265
            $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_sent);
1266
            if ($queue_count > 0) {
1267
                EE_Error::add_success(
1268
                    sprintf(
1269
                        _n(
1270
                            '%d message successfully sent.',
1271
                            '%d messages successfully sent.',
1272
                            $queue_count,
1273
                            'event_espresso'
1274
                        ),
1275
                        $queue_count
1276
                    )
1277
                );
1278
            } else {
1279
                EE_Error::add_error(
1280
                    __(
1281
                        '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.',
1282
                        'event_espresso'
1283
                    ),
1284
                    __FILE__,
1285
                    __FUNCTION__,
1286
                    __LINE__

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

@@ 248-252 (lines=5) @@
245
            }
246
            $config_saved = $config->update_espresso_config(false, false);
247
        }
248
        if ($config_saved) {
249
            EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso'));
250
        } else {
251
            EE_Error::add_error(
252
                __('Display Order was not updated.', 'event_espresso'),
253
                __FILE__,
254
                __FUNCTION__,
255
                __LINE__

admin_pages/transactions/Transactions_Admin_Page.core.php 3 locations

@@ 1664-1686 (lines=23) @@
1661
                    __LINE__
1662
                );
1663
            }
1664
        } else {
1665
            if ($has_access) {
1666
                EE_Error::add_error(
1667
                    esc_html__(
1668
                        'The payment form data could not be processed. Please try again.',
1669
                        'event_espresso'
1670
                    ),
1671
                    __FILE__,
1672
                    __FUNCTION__,
1673
                    __LINE__
1674
                );
1675
            } else {
1676
                EE_Error::add_error(
1677
                    esc_html__(
1678
                        'You do not have access to apply payments or refunds to a registration.',
1679
                        'event_espresso'
1680
                    ),
1681
                    __FILE__,
1682
                    __FUNCTION__,
1683
                    __LINE__
1684
                );
1685
            }
1686
        }
1687
        $notices = EE_Error::get_notices(
1688
            false,
1689
            false,
@@ 1927-1934 (lines=8) @@
1924
        /** @type EE_Transaction_Payments $transaction_payments */
1925
        $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1926
        // update the transaction with this payment
1927
        if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) {
1928
            EE_Error::add_success(
1929
                esc_html__(
1930
                    'The payment has been processed successfully.',
1931
                    'event_espresso'
1932
                ),
1933
                __FILE__,
1934
                __FUNCTION__,
1935
                __LINE__
1936
            );
1937
        } else {
@@ 2251-2271 (lines=21) @@
2248
                    __LINE__
2249
                );
2250
            }
2251
        } else {
2252
            if ($can_delete) {
2253
                EE_Error::add_error(
2254
                    esc_html__(
2255
                        'A valid Payment ID was not received, therefore payment form data could not be loaded.',
2256
                        'event_espresso'
2257
                    ),
2258
                    __FILE__,
2259
                    __FUNCTION__,
2260
                    __LINE__
2261
                );
2262
            } else {
2263
                EE_Error::add_error(
2264
                    esc_html__(
2265
                        'You do not have access to delete a payment.',
2266
                        'event_espresso'
2267
                    ),
2268
                    __FILE__,
2269
                    __FUNCTION__,
2270
                    __LINE__
2271
                );
2272
            }
2273
        }
2274
        $notices = EE_Error::get_notices(false, false, false);