Code Duplication    Length = 5-16 lines in 5 locations

core/data_migration_scripts/EE_DMS_Core_4_1_0.dms.php 2 locations

@@ 1512-1516 (lines=5) @@
1509
        // if the file is located remotely, download it to our uploads DIR, because wp_genereate_attachmnet_metadata needs the file to be local
1510
        if (strpos($guid, $wp_upload_dir['url']) === false) {
1511
            // image is located remotely. download it and place it in the uploads directory
1512
            if (! is_readable($guid)) {
1513
                $migration_stage->add_error(sprintf(esc_html__(
1514
                    "Could not create image attachment from non-existent file: %s",
1515
                    "event_espresso"
1516
                ), $guid));
1517
                return 0;
1518
            }
1519
            $contents = file_get_contents($guid);
@@ 1520-1524 (lines=5) @@
1517
                return 0;
1518
            }
1519
            $contents = file_get_contents($guid);
1520
            if ($contents === false) {
1521
                $migration_stage->add_error(sprintf(esc_html__(
1522
                    "Could not read image at %s, and therefore couldnt create an attachment post for it.",
1523
                    "event_espresso"
1524
                ), $guid));
1525
                return false;
1526
            }
1527
            $local_filepath = $wp_upload_dir['path'] . DS . basename($guid);

core/db_classes/EE_Base_Class.class.php 1 location

@@ 1210-1224 (lines=15) @@
1207
    public function get_DateTime_object($field_name)
1208
    {
1209
        $field_settings = $this->get_model()->field_settings_for($field_name);
1210
        if (! $field_settings instanceof EE_Datetime_Field) {
1211
            EE_Error::add_error(
1212
                sprintf(
1213
                    esc_html__(
1214
                        'The field %s is not an EE_Datetime_Field field.  There is no DateTime object stored on this field type.',
1215
                        'event_espresso'
1216
                    ),
1217
                    $field_name
1218
                ),
1219
                __FILE__,
1220
                __FUNCTION__,
1221
                __LINE__
1222
            );
1223
            return false;
1224
        }
1225
        return isset($this->_fields[ $field_name ]) && $this->_fields[ $field_name ] instanceof DateTime
1226
            ? clone $this->_fields[ $field_name ]
1227
            : null;

core/admin/EE_Admin_Page.core.php 1 location

@@ 1359-1374 (lines=16) @@
1356
                                                             . $tour
1357
                                                             . '.class.php' : $file_path;
1358
                    // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1359
                    if (! is_readable($file_path)) {
1360
                        EE_Error::add_error(
1361
                            sprintf(
1362
                                esc_html__(
1363
                                    'The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling',
1364
                                    'event_espresso'
1365
                                ),
1366
                                $file_path,
1367
                                $tour
1368
                            ),
1369
                            __FILE__,
1370
                            __FUNCTION__,
1371
                            __LINE__
1372
                        );
1373
                        return;
1374
                    }
1375
                    require_once $file_path;
1376
                    if (! class_exists($tour)) {
1377
                        $error_msg[] = sprintf(

modules/single_page_checkout/reg_steps/attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 1 location

@@ 984-995 (lines=12) @@
981
        // grab the saved registrations from the transaction
982
        foreach ($registrations as $registration) {
983
            // verify EE_Registration object
984
            if (! $registration instanceof EE_Registration) {
985
                EE_Error::add_error(
986
                    esc_html__(
987
                        'An invalid Registration object was discovered when attempting to process your registration information.',
988
                        'event_espresso'
989
                    ),
990
                    __FILE__,
991
                    __FUNCTION__,
992
                    __LINE__
993
                );
994
                return false;
995
            }
996
            /** @var string $reg_url_link */
997
            $reg_url_link = $registration->reg_url_link();
998
            // reg_url_link exists ?