Code Duplication    Length = 4-8 lines in 8 locations

core/EE_Module_Request_Router.core.php 1 location

@@ 186-189 (lines=4) @@
183
	 * @return    EED_Module | NULL
184
	 */
185
	public static function module_factory( $module_name ) {
186
		if ( $module_name == 'EED_Module' ) {
187
			EE_Error::add_error( sprintf( __( 'EED_Module is an abstract parent class an can not be instantiated. Please provide a proper module name.', 'event_espresso' ), $module_name ), __FILE__, __FUNCTION__, __LINE__ );
188
			return NULL;
189
		}
190
		// let's pause to reflect on this...
191
		$mod_reflector = new ReflectionClass( $module_name );
192
		// ensure that class is actually a module

core/libraries/plugin_api/EE_Register_Messages_Template_Pack.lib.php 1 location

@@ 166-169 (lines=4) @@
163
164
		//loop through the existing registry and see if the classname is already present.
165
		foreach ( self::$_registry as $ref => $args ) {
166
			if ( $args['classname'] == $classname ) {
167
				EE_Error::add_error( sprintf( __('The %s template pack that you just activated cannot be registered with the messages system because there is already a template pack active using the same classname.  Contact the author of this template pack to let them know of the conflict.  To stop seeing this message you will need to deactivate this template pack.', 'event_espresso' ), (string) $setup_args['classname'] ), __FILE__, __LINE__, __FUNCTION__ );
168
				return false;
169
			}
170
		}
171
		return true;
172
	}

core/helpers/EEH_Activation.helper.php 2 locations

@@ 381-385 (lines=5) @@
378
				if ( $critical_page['post'] == NULL ) {
379
					$critical_page = EEH_Activation::create_critical_page( $critical_page );
380
					// REALLY? Still nothing ??!?!?
381
					if ( $critical_page['post'] == NULL ) {
382
						$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
383
						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
384
						break;
385
					}
386
				}
387
			}
388
			// track post_shortcodes
@@ 497-504 (lines=8) @@
494
	 */
495
	private static function _track_critical_page_post_shortcodes( $critical_page = array() ) {
496
		// check the goods
497
		if ( ! $critical_page['post'] instanceof WP_Post ) {
498
			$msg = sprintf(
499
				__( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ),
500
				$critical_page['name']
501
			);
502
			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
503
			return;
504
		}
505
		// map shortcode to post
506
		EE_Registry::instance()->CFG->core->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID;
507
		// and make sure it's NOT added to the WP "Posts Page"

admin_pages/messages/Messages_Admin_Page.core.php 2 locations

@@ 1949-1953 (lines=5) @@
1946
1947
		$success = $this->_preview_message(TRUE);
1948
1949
		if ( $success ) {
1950
			EE_Error::add_success( __('Test message sent', 'event_espresso') );
1951
		} else {
1952
			EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1953
		}
1954
	}
1955
1956
@@ 2797-2801 (lines=5) @@
2794
		//okay we should have the data all setup.  Now we just update!
2795
		$success = EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2796
2797
		if ( $success ) {
2798
			EE_Error::add_success( __('Settings updated', 'event_espresso') );
2799
		} else {
2800
			EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2801
		}
2802
2803
		$this->_template_args['success'] = $success;
2804
		$this->_return_json();

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

@@ 159-163 (lines=5) @@
156
			}
157
			$config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false );
158
		}
159
		if ( $config_saved ) {
160
			EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) );
161
		} else {
162
			EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
163
		}
164
		echo wp_json_encode( EE_Error::get_notices( false ));
165
		exit();
166
	}

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

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