Completed
Branch Gutenberg/use-new-wordpress-pa... (9fa7a4)
by
unknown
63:25 queued 48:18
created
core/data_migration_scripts/EE_Data_Migration_Script_Stage_Table.core.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
     {
66 66
         global $wpdb;
67 67
         $start_at_record = $this->count_records_migrated();
68
-        $query = "SELECT * FROM {$this->_old_table} {$this->_extra_where_sql} " . $wpdb->prepare(
68
+        $query = "SELECT * FROM {$this->_old_table} {$this->_extra_where_sql} ".$wpdb->prepare(
69 69
             "LIMIT %d, %d",
70 70
             $start_at_record,
71 71
             $limit
Please login to merge, or discard this patch.
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -16,84 +16,84 @@
 block discarded – undo
16 16
 abstract class EE_Data_Migration_Script_Stage_Table extends EE_Data_Migration_Script_Stage
17 17
 {
18 18
 
19
-    protected $_old_table;
19
+	protected $_old_table;
20 20
 
21
-    /**
22
-     * Set in the constructor to add this sql to both the counting query in
23
-     * EE_Data_Migration_Script_Stage_Table::_count_records_to_migrate() and
24
-     * EE_Data_Migration_Script_Stage_Table::_get_rows().
25
-     * Eg "where column_name like '%some_value%'"
26
-     *
27
-     * @var string
28
-     */
29
-    protected $_extra_where_sql;
21
+	/**
22
+	 * Set in the constructor to add this sql to both the counting query in
23
+	 * EE_Data_Migration_Script_Stage_Table::_count_records_to_migrate() and
24
+	 * EE_Data_Migration_Script_Stage_Table::_get_rows().
25
+	 * Eg "where column_name like '%some_value%'"
26
+	 *
27
+	 * @var string
28
+	 */
29
+	protected $_extra_where_sql;
30 30
 
31 31
 
32
-    /**
33
-     * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property
34
-     * accordingly. Note: it should not alter the count of items migrated. That is done in the public function that
35
-     * calls this. IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the
36
-     * last migration step, otherwise it should always return $num_items_to_migrate. (Eg, if we're migrating attendees
37
-     * rows from the database, and $num_items_to_migrate is set to 50, then we SHOULD actually migrate 50 rows,but at
38
-     * very least we MUST report/return 50 items migrated)
39
-     *
40
-     * @param int $num_items
41
-     * @return int number of items ACTUALLY migrated
42
-     */
43
-    public function _migration_step($num_items = 50)
44
-    {
45
-        $rows = $this->_get_rows($num_items);
46
-        $items_actually_migrated = 0;
47
-        foreach ($rows as $old_row) {
48
-            $this->_migrate_old_row($old_row);
49
-            $items_actually_migrated++;
50
-        }
51
-        if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
52
-            $this->set_completed();
53
-        }
54
-        return $items_actually_migrated;
55
-    }
32
+	/**
33
+	 * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property
34
+	 * accordingly. Note: it should not alter the count of items migrated. That is done in the public function that
35
+	 * calls this. IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the
36
+	 * last migration step, otherwise it should always return $num_items_to_migrate. (Eg, if we're migrating attendees
37
+	 * rows from the database, and $num_items_to_migrate is set to 50, then we SHOULD actually migrate 50 rows,but at
38
+	 * very least we MUST report/return 50 items migrated)
39
+	 *
40
+	 * @param int $num_items
41
+	 * @return int number of items ACTUALLY migrated
42
+	 */
43
+	public function _migration_step($num_items = 50)
44
+	{
45
+		$rows = $this->_get_rows($num_items);
46
+		$items_actually_migrated = 0;
47
+		foreach ($rows as $old_row) {
48
+			$this->_migrate_old_row($old_row);
49
+			$items_actually_migrated++;
50
+		}
51
+		if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
52
+			$this->set_completed();
53
+		}
54
+		return $items_actually_migrated;
55
+	}
56 56
 
57
-    /**
58
-     * Gets the rows for each migration stage from the old table
59
-     *
60
-     * @global wpdb $wpdb
61
-     * @param int   $limit
62
-     * @return array of arrays like $wpdb->get_results($sql, ARRAY_A)
63
-     */
64
-    protected function _get_rows($limit)
65
-    {
66
-        global $wpdb;
67
-        $start_at_record = $this->count_records_migrated();
68
-        $query = "SELECT * FROM {$this->_old_table} {$this->_extra_where_sql} " . $wpdb->prepare(
69
-            "LIMIT %d, %d",
70
-            $start_at_record,
71
-            $limit
72
-        );
73
-        return $wpdb->get_results($query, ARRAY_A);
74
-    }
57
+	/**
58
+	 * Gets the rows for each migration stage from the old table
59
+	 *
60
+	 * @global wpdb $wpdb
61
+	 * @param int   $limit
62
+	 * @return array of arrays like $wpdb->get_results($sql, ARRAY_A)
63
+	 */
64
+	protected function _get_rows($limit)
65
+	{
66
+		global $wpdb;
67
+		$start_at_record = $this->count_records_migrated();
68
+		$query = "SELECT * FROM {$this->_old_table} {$this->_extra_where_sql} " . $wpdb->prepare(
69
+			"LIMIT %d, %d",
70
+			$start_at_record,
71
+			$limit
72
+		);
73
+		return $wpdb->get_results($query, ARRAY_A);
74
+	}
75 75
 
76 76
 
77
-    /**
78
-     * Counts the records to migrate; the public version may cache it
79
-     *
80
-     * @return int
81
-     */
82
-    public function _count_records_to_migrate()
83
-    {
84
-        global $wpdb;
85
-        $query = "SELECT COUNT(*) FROM {$this->_old_table} {$this->_extra_where_sql}";
86
-        $count = $wpdb->get_var($query);
87
-        return $count;
88
-    }
77
+	/**
78
+	 * Counts the records to migrate; the public version may cache it
79
+	 *
80
+	 * @return int
81
+	 */
82
+	public function _count_records_to_migrate()
83
+	{
84
+		global $wpdb;
85
+		$query = "SELECT COUNT(*) FROM {$this->_old_table} {$this->_extra_where_sql}";
86
+		$count = $wpdb->get_var($query);
87
+		return $count;
88
+	}
89 89
 
90
-    /**
91
-     * takes care of migrating this particular row from the OLD table to whatever its
92
-     * representation is in the new database. If there are errors, use $this->add_error to log them. If there is a
93
-     * fatal error which prevents all future migrations, throw an exception describing it
94
-     *
95
-     * @param array $old_row an associative array where keys are column names and values are their values.
96
-     * @return null
97
-     */
98
-    abstract protected function _migrate_old_row($old_row);
90
+	/**
91
+	 * takes care of migrating this particular row from the OLD table to whatever its
92
+	 * representation is in the new database. If there are errors, use $this->add_error to log them. If there is a
93
+	 * fatal error which prevents all future migrations, throw an exception describing it
94
+	 *
95
+	 * @param array $old_row an associative array where keys are column names and values are their values.
96
+	 * @return null
97
+	 */
98
+	abstract protected function _migrate_old_row($old_row);
99 99
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_Data_Migration_Script_Stage.core.php 1 patch
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -37,103 +37,103 @@
 block discarded – undo
37 37
  */
38 38
 abstract class EE_Data_Migration_Script_Stage extends EE_Data_Migration_Class_Base
39 39
 {
40
-    /**
41
-     * The migration script this is a stage of
42
-     *
43
-     * @var EE_Data_Migration_Script_Base
44
-     */
45
-    protected $_migration_script;
40
+	/**
41
+	 * The migration script this is a stage of
42
+	 *
43
+	 * @var EE_Data_Migration_Script_Base
44
+	 */
45
+	protected $_migration_script;
46 46
 
47
-    /**
48
-     * This should eb called to essentially 'finalize' construction of the stage.
49
-     * This isn't done on the main constructor in order to avoid repetitive code. Instead, this is
50
-     * called by EE_Data_Migration_Script_Base's __construct() method so children don't have to
51
-     *
52
-     * @param EE_Data_Migration_Script_Base $migration_script
53
-     */
54
-    public function _construct_finalize($migration_script)
55
-    {
56
-        $this->_migration_script = $migration_script;
57
-    }
47
+	/**
48
+	 * This should eb called to essentially 'finalize' construction of the stage.
49
+	 * This isn't done on the main constructor in order to avoid repetitive code. Instead, this is
50
+	 * called by EE_Data_Migration_Script_Base's __construct() method so children don't have to
51
+	 *
52
+	 * @param EE_Data_Migration_Script_Base $migration_script
53
+	 */
54
+	public function _construct_finalize($migration_script)
55
+	{
56
+		$this->_migration_script = $migration_script;
57
+	}
58 58
 
59
-    /**
60
-     * Migrates X old records to the new format. If a fatal error is encountered it is NOT caught here,
61
-     * but is propagated upwards for catching. So basically, the _migration_step() function implemented by children
62
-     * needs to catch exceptions and decide what's a fatal error and what isn't.
63
-     *
64
-     * @param int $num_items_to_migrate
65
-     * @return int
66
-     */
67
-    public function migration_step($num_items_to_migrate = 50)
68
-    {
69
-        // before we run the migration step, we want ot take note of warnings that get outputted
70
-        ob_start();
71
-        $items_migrated = $this->_migration_step($num_items_to_migrate);
72
-        $output = ob_get_contents();
73
-        ob_end_clean();
74
-        if ($output) {
75
-            $this->add_error($output);
76
-        }
77
-        $this->_records_migrated += $items_migrated;
78
-        return $items_migrated;
79
-    }
59
+	/**
60
+	 * Migrates X old records to the new format. If a fatal error is encountered it is NOT caught here,
61
+	 * but is propagated upwards for catching. So basically, the _migration_step() function implemented by children
62
+	 * needs to catch exceptions and decide what's a fatal error and what isn't.
63
+	 *
64
+	 * @param int $num_items_to_migrate
65
+	 * @return int
66
+	 */
67
+	public function migration_step($num_items_to_migrate = 50)
68
+	{
69
+		// before we run the migration step, we want ot take note of warnings that get outputted
70
+		ob_start();
71
+		$items_migrated = $this->_migration_step($num_items_to_migrate);
72
+		$output = ob_get_contents();
73
+		ob_end_clean();
74
+		if ($output) {
75
+			$this->add_error($output);
76
+		}
77
+		$this->_records_migrated += $items_migrated;
78
+		return $items_migrated;
79
+	}
80 80
 
81 81
 
82
-    /**
83
-     * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property
84
-     * accordingly. Note: it should not alter the count of items migrated. That is done in the public function that
85
-     * calls this. IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the
86
-     * last migration step, otherwise it should always return $num_items_to_migrate. (Eg, if we're migrating attendees
87
-     * rows from the database, and $num_items_to_migrate is set to 50, then we SHOULD actually migrate 50 rows,but at
88
-     * very least we MUST report/return 50 items migrated)
89
-     *
90
-     * @param int $num_items_to_migrate
91
-     * @return int number of items ACTUALLY migrated
92
-     */
93
-    abstract protected function _migration_step($num_items_to_migrate = 50);
82
+	/**
83
+	 * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property
84
+	 * accordingly. Note: it should not alter the count of items migrated. That is done in the public function that
85
+	 * calls this. IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the
86
+	 * last migration step, otherwise it should always return $num_items_to_migrate. (Eg, if we're migrating attendees
87
+	 * rows from the database, and $num_items_to_migrate is set to 50, then we SHOULD actually migrate 50 rows,but at
88
+	 * very least we MUST report/return 50 items migrated)
89
+	 *
90
+	 * @param int $num_items_to_migrate
91
+	 * @return int number of items ACTUALLY migrated
92
+	 */
93
+	abstract protected function _migration_step($num_items_to_migrate = 50);
94 94
 
95
-    /**
96
-     * Counts the records that have been migrated so far
97
-     *
98
-     * @return int
99
-     */
100
-    public function count_records_migrated()
101
-    {
102
-        return $this->_records_migrated;
103
-    }
95
+	/**
96
+	 * Counts the records that have been migrated so far
97
+	 *
98
+	 * @return int
99
+	 */
100
+	public function count_records_migrated()
101
+	{
102
+		return $this->_records_migrated;
103
+	}
104 104
 
105
-    /**
106
-     * returns an array of strings describing errors
107
-     *
108
-     * @return array
109
-     */
110
-    public function get_errors()
111
-    {
112
-        return $this->_errors;
113
-    }
105
+	/**
106
+	 * returns an array of strings describing errors
107
+	 *
108
+	 * @return array
109
+	 */
110
+	public function get_errors()
111
+	{
112
+		return $this->_errors;
113
+	}
114 114
 
115 115
 
116
-    /**
117
-     * Sets all of the properties of this script stage to match what's in the array, which is assumed
118
-     * to have been made from the properties_as_array() function.
119
-     *
120
-     * @param array $array_of_properties like what's produced from properties_as_array() method
121
-     */
122
-    public function instantiate_from_array_of_properties($array_of_properties)
123
-    {
124
-        unset($array_of_properties['class']);
125
-        foreach ($array_of_properties as $property_name => $property_value) {
126
-            $this->{$property_name} = $property_value;
127
-        }
128
-    }
116
+	/**
117
+	 * Sets all of the properties of this script stage to match what's in the array, which is assumed
118
+	 * to have been made from the properties_as_array() function.
119
+	 *
120
+	 * @param array $array_of_properties like what's produced from properties_as_array() method
121
+	 */
122
+	public function instantiate_from_array_of_properties($array_of_properties)
123
+	{
124
+		unset($array_of_properties['class']);
125
+		foreach ($array_of_properties as $property_name => $property_value) {
126
+			$this->{$property_name} = $property_value;
127
+		}
128
+	}
129 129
 
130
-    /**
131
-     * Gets the script this is a stage of
132
-     *
133
-     * @return EE_Data_Migration_Script_Base
134
-     */
135
-    protected function get_migration_script()
136
-    {
137
-        return $this->_migration_script;
138
-    }
130
+	/**
131
+	 * Gets the script this is a stage of
132
+	 *
133
+	 * @return EE_Data_Migration_Script_Base
134
+	 */
135
+	protected function get_migration_script()
136
+	{
137
+		return $this->_migration_script;
138
+	}
139 139
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_6_0.dms.php 2 patches
Indentation   +259 added lines, -259 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
 $stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*');
15 15
 $class_to_filepath = array();
16 16
 foreach ($stages as $filepath) {
17
-    $matches = array();
18
-    preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches);
19
-    $class_to_filepath[ $matches[1] ] = $filepath;
17
+	$matches = array();
18
+	preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches);
19
+	$class_to_filepath[ $matches[1] ] = $filepath;
20 20
 }
21 21
 // give addons a chance to autoload their stages too
22 22
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath);
@@ -35,69 +35,69 @@  discard block
 block discarded – undo
35 35
 class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base
36 36
 {
37 37
 
38
-    /**
39
-     * return EE_DMS_Core_4_6_0
40
-     *
41
-     * @param TableManager  $table_manager
42
-     * @param TableAnalysis $table_analysis
43
-     */
44
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
45
-    {
46
-        $this->_pretty_name = __("Data Update to Event Espresso 4.6.0", "event_espresso");
47
-        $this->_priority = 10;
48
-        $this->_migration_stages = array(
49
-            new EE_DMS_4_6_0_gateways(),
50
-            new EE_DMS_4_6_0_question_types(),
51
-            new EE_DMS_4_6_0_country_system_question(),
52
-            new EE_DMS_4_6_0_state_system_question(),
53
-            new EE_DMS_4_6_0_billing_info(),
54
-            new EE_DMS_4_6_0_transactions(),
55
-            new EE_DMS_4_6_0_payments(),
56
-            new EE_DMS_4_6_0_invoice_settings(),
57
-        );
58
-        parent::__construct($table_manager, $table_analysis);
59
-    }
38
+	/**
39
+	 * return EE_DMS_Core_4_6_0
40
+	 *
41
+	 * @param TableManager  $table_manager
42
+	 * @param TableAnalysis $table_analysis
43
+	 */
44
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
45
+	{
46
+		$this->_pretty_name = __("Data Update to Event Espresso 4.6.0", "event_espresso");
47
+		$this->_priority = 10;
48
+		$this->_migration_stages = array(
49
+			new EE_DMS_4_6_0_gateways(),
50
+			new EE_DMS_4_6_0_question_types(),
51
+			new EE_DMS_4_6_0_country_system_question(),
52
+			new EE_DMS_4_6_0_state_system_question(),
53
+			new EE_DMS_4_6_0_billing_info(),
54
+			new EE_DMS_4_6_0_transactions(),
55
+			new EE_DMS_4_6_0_payments(),
56
+			new EE_DMS_4_6_0_invoice_settings(),
57
+		);
58
+		parent::__construct($table_manager, $table_analysis);
59
+	}
60 60
 
61 61
 
62 62
 
63
-    /**
64
-     * @param array $version_array
65
-     * @return bool
66
-     */
67
-    public function can_migrate_from_version($version_array)
68
-    {
69
-        $version_string = $version_array['Core'];
70
-        if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) {
63
+	/**
64
+	 * @param array $version_array
65
+	 * @return bool
66
+	 */
67
+	public function can_migrate_from_version($version_array)
68
+	{
69
+		$version_string = $version_array['Core'];
70
+		if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) {
71 71
 //          echo "$version_string can be migrated from";
72
-            return true;
73
-        } elseif (! $version_string) {
72
+			return true;
73
+		} elseif (! $version_string) {
74 74
 //          echo "no version string provided: $version_string";
75
-            // no version string provided... this must be pre 4.3
76
-            return false;// changed mind. dont want people thinking they should migrate yet because they cant
77
-        } else {
75
+			// no version string provided... this must be pre 4.3
76
+			return false;// changed mind. dont want people thinking they should migrate yet because they cant
77
+		} else {
78 78
 //          echo "$version_string doesnt apply";
79
-            return false;
80
-        }
81
-    }
79
+			return false;
80
+		}
81
+	}
82 82
 
83 83
 
84 84
 
85
-    /**
86
-     * @return bool
87
-     */
88
-    public function schema_changes_before_migration()
89
-    {
90
-        // relies on 4.1's EEH_Activation::create_table
91
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
92
-        $table_name = 'esp_answer';
93
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
85
+	/**
86
+	 * @return bool
87
+	 */
88
+	public function schema_changes_before_migration()
89
+	{
90
+		// relies on 4.1's EEH_Activation::create_table
91
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
92
+		$table_name = 'esp_answer';
93
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
94 94
 					REG_ID INT UNSIGNED NOT NULL,
95 95
 					QST_ID INT UNSIGNED NOT NULL,
96 96
 					ANS_value TEXT NOT NULL,
97 97
 					PRIMARY KEY  (ANS_ID)";
98
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
99
-        $table_name = 'esp_attendee_meta';
100
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
98
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
99
+		$table_name = 'esp_attendee_meta';
100
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
101 101
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
102 102
 						ATT_fname VARCHAR(45) NOT NULL,
103 103
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 								KEY ATT_fname (ATT_fname),
114 114
 								KEY ATT_lname (ATT_lname),
115 115
 								KEY ATT_email (ATT_email)";
116
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
117
-        $table_name = 'esp_country';
118
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
116
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
117
+		$table_name = 'esp_country';
118
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
119 119
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
120 120
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
121 121
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -131,24 +131,24 @@  discard block
 block discarded – undo
131 131
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
132 132
 					  CNT_active TINYINT(1) DEFAULT '0',
133 133
 					  PRIMARY KEY  (CNT_ISO)";
134
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
135
-        $table_name = 'esp_currency';
136
-        $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
134
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
135
+		$table_name = 'esp_currency';
136
+		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
137 137
 				CUR_single VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollar',
138 138
 				CUR_plural VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollars',
139 139
 				CUR_sign VARCHAR(45) COLLATE utf8_bin DEFAULT '$',
140 140
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
141 141
 				CUR_active TINYINT(1) DEFAULT '0',
142 142
 				PRIMARY KEY  (CUR_code)";
143
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
144
-        $table_name = 'esp_currency_payment_method';
145
-        $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
143
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
144
+		$table_name = 'esp_currency_payment_method';
145
+		$sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
146 146
 				CUR_code  VARCHAR(6) COLLATE utf8_bin NOT NULL,
147 147
 				PMD_ID INT(11) NOT NULL,
148 148
 				PRIMARY KEY  (CPM_ID)";
149
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
150
-        $table_name = 'esp_datetime';
151
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
149
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
150
+		$table_name = 'esp_datetime';
151
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
152 152
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
153 153
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
154 154
 				  DTT_description TEXT NOT NULL,
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 						PRIMARY KEY  (DTT_ID),
164 164
 						KEY EVT_ID (EVT_ID),
165 165
 						KEY DTT_is_primary (DTT_is_primary)";
166
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
167
-        $table_name = 'esp_event_meta';
168
-        $sql = "
166
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
167
+		$table_name = 'esp_event_meta';
168
+		$sql = "
169 169
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
170 170
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
171 171
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -180,31 +180,31 @@  discard block
 block discarded – undo
180 180
 			EVT_external_URL VARCHAR(200) NULL,
181 181
 			EVT_donations TINYINT(1) NULL,
182 182
 			PRIMARY KEY  (EVTM_ID)";
183
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
184
-        $table_name = 'esp_event_question_group';
185
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
183
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
184
+		$table_name = 'esp_event_question_group';
185
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
186 186
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
187 187
 					QSG_ID INT UNSIGNED NOT NULL,
188 188
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
189 189
 					PRIMARY KEY  (EQG_ID)";
190
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
191
-        $table_name = 'esp_event_venue';
192
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
190
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
191
+		$table_name = 'esp_event_venue';
192
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
193 193
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
194 194
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
195 195
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
196 196
 				PRIMARY KEY  (EVV_ID)";
197
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
198
-        $table_name = 'esp_extra_meta';
199
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
197
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
198
+		$table_name = 'esp_extra_meta';
199
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
200 200
 				OBJ_ID INT(11) DEFAULT NULL,
201 201
 				EXM_type VARCHAR(45) DEFAULT NULL,
202 202
 				EXM_key VARCHAR(45) DEFAULT NULL,
203 203
 				EXM_value TEXT,
204 204
 				PRIMARY KEY  (EXM_ID)";
205
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
206
-        $table_name = 'esp_line_item';
207
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
205
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
206
+		$table_name = 'esp_line_item';
207
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
208 208
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
209 209
 				TXN_ID INT(11) DEFAULT NULL,
210 210
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 				OBJ_ID INT(11) DEFAULT NULL,
221 221
 				OBJ_type VARCHAR(45)DEFAULT NULL,
222 222
 				PRIMARY KEY  (LIN_ID)";
223
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
224
-        $table_name = 'esp_log';
225
-        $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
223
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
224
+		$table_name = 'esp_log';
225
+		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
226 226
 				LOG_time DATETIME DEFAULT NULL,
227 227
 				OBJ_ID VARCHAR(45) DEFAULT NULL,
228 228
 				OBJ_type VARCHAR(45) DEFAULT NULL,
@@ -230,19 +230,19 @@  discard block
 block discarded – undo
230 230
 				LOG_message TEXT,
231 231
 				LOG_wp_user INT(11) DEFAULT NULL,
232 232
 				PRIMARY KEY  (LOG_ID)";
233
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
234
-        $table_name = 'esp_message_template';
235
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
233
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
234
+		$table_name = 'esp_message_template';
235
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
236 236
 					GRP_ID INT(10) UNSIGNED NOT NULL,
237 237
 					MTP_context VARCHAR(50) NOT NULL,
238 238
 					MTP_template_field VARCHAR(30) NOT NULL,
239 239
 					MTP_content TEXT NOT NULL,
240 240
 					PRIMARY KEY  (MTP_ID),
241 241
 					KEY GRP_ID (GRP_ID)";
242
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
243
-        $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
244
-        $table_name = 'esp_message_template_group';
245
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
242
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
243
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
244
+		$table_name = 'esp_message_template_group';
245
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
246 246
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
247 247
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
248 248
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
255 255
 					PRIMARY KEY  (GRP_ID),
256 256
 					KEY MTP_user_id (MTP_user_id)";
257
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
258
-        $table_name = 'esp_event_message_template';
259
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
257
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
258
+		$table_name = 'esp_event_message_template';
259
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
260 260
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
261 261
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
262 262
 					PRIMARY KEY  (EMT_ID),
263 263
 					KEY EVT_ID (EVT_ID),
264 264
 					KEY GRP_ID (GRP_ID)";
265
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
266
-        $table_name = 'esp_payment';
267
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
265
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
266
+		$table_name = 'esp_payment';
267
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
268 268
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
269 269
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
270 270
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -281,9 +281,9 @@  discard block
 block discarded – undo
281 281
 					PRIMARY KEY  (PAY_ID),
282 282
 					KEY TXN_ID (TXN_ID),
283 283
 					KEY PAY_timestamp (PAY_timestamp)";
284
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
285
-        $table_name = 'esp_payment_method';
286
-        $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
284
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
285
+		$table_name = 'esp_payment_method';
286
+		$sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
287 287
 				PMD_type VARCHAR(124) DEFAULT NULL,
288 288
 				PMD_name VARCHAR(255) DEFAULT NULL,
289 289
 				PMD_desc TEXT,
@@ -298,28 +298,28 @@  discard block
 block discarded – undo
298 298
 				PMD_scope VARCHAR(255) NULL DEFAULT 'frontend',
299 299
 				PRIMARY KEY  (PMD_ID),
300 300
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug)";
301
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
302
-        $table_name = "esp_ticket_price";
303
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
301
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
302
+		$table_name = "esp_ticket_price";
303
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
304 304
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
305 305
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
306 306
 					  PRIMARY KEY  (TKP_ID)";
307
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
308
-        $table_name = "esp_datetime_ticket";
309
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
307
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
308
+		$table_name = "esp_datetime_ticket";
309
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
310 310
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
311 311
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
312 312
 					  PRIMARY KEY  (DTK_ID)";
313
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
314
-        $table_name = "esp_ticket_template";
315
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
313
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
314
+		$table_name = "esp_ticket_template";
315
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
316 316
 					  TTM_name VARCHAR(45) NOT NULL,
317 317
 					  TTM_description TEXT,
318 318
 					  TTM_file VARCHAR(45),
319 319
 					  PRIMARY KEY  (TTM_ID)";
320
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
321
-        $table_name = 'esp_question';
322
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
320
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
321
+		$table_name = 'esp_question';
322
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
323 323
 					QST_display_text TEXT NOT NULL,
324 324
 					QST_admin_label VARCHAR(255) NOT NULL,
325 325
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -331,25 +331,25 @@  discard block
 block discarded – undo
331 331
 					QST_wp_user BIGINT UNSIGNED NULL,
332 332
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
333 333
 					PRIMARY KEY  (QST_ID)';
334
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
335
-        $table_name = 'esp_question_group_question';
336
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
334
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
335
+		$table_name = 'esp_question_group_question';
336
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
337 337
 					QSG_ID INT UNSIGNED NOT NULL,
338 338
 					QST_ID INT UNSIGNED NOT NULL,
339 339
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
340 340
 					PRIMARY KEY  (QGQ_ID) ";
341
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
342
-        $table_name = 'esp_question_option';
343
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
341
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
342
+		$table_name = 'esp_question_option';
343
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
344 344
 					QSO_value VARCHAR(255) NOT NULL,
345 345
 					QSO_desc TEXT NOT NULL,
346 346
 					QST_ID INT UNSIGNED NOT NULL,
347 347
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
348 348
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
349 349
 					PRIMARY KEY  (QSO_ID)";
350
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
351
-        $table_name = 'esp_registration';
352
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
350
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
351
+		$table_name = 'esp_registration';
352
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
353 353
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
354 354
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
355 355
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -372,25 +372,25 @@  discard block
 block discarded – undo
372 372
 					  KEY STS_ID (STS_ID),
373 373
 					  KEY REG_url_link (REG_url_link),
374 374
 					  KEY REG_code (REG_code)";
375
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
376
-        $table_name = 'esp_checkin';
377
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
375
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
376
+		$table_name = 'esp_checkin';
377
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
378 378
 					REG_ID INT(10) UNSIGNED NOT NULL,
379 379
 					DTT_ID INT(10) UNSIGNED NOT NULL,
380 380
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
381 381
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
382 382
 					PRIMARY KEY  (CHK_ID)";
383
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
384
-        $table_name = 'esp_state';
385
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
383
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
384
+		$table_name = 'esp_state';
385
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
386 386
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
387 387
 					  STA_abbrev VARCHAR(24) COLLATE utf8_bin NOT NULL,
388 388
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
389 389
 					  STA_active TINYINT(1) DEFAULT '1',
390 390
 					  PRIMARY KEY  (STA_ID)";
391
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
392
-        $table_name = 'esp_status';
393
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
391
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
392
+		$table_name = 'esp_status';
393
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
394 394
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
395 395
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
396 396
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -398,9 +398,9 @@  discard block
 block discarded – undo
398 398
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
399 399
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
400 400
 					  KEY STS_type (STS_type)";
401
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
402
-        $table_name = 'esp_transaction';
403
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
401
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
402
+		$table_name = 'esp_transaction';
403
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
404 404
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
405 405
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
406 406
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -412,9 +412,9 @@  discard block
 block discarded – undo
412 412
 					  PRIMARY KEY  (TXN_ID),
413 413
 					  KEY TXN_timestamp (TXN_timestamp),
414 414
 					  KEY STS_ID (STS_ID)";
415
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
416
-        $table_name = 'esp_venue_meta';
417
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
415
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
416
+		$table_name = 'esp_venue_meta';
417
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
418 418
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
419 419
 			VNU_address VARCHAR(255) DEFAULT NULL,
420 420
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -432,10 +432,10 @@  discard block
 block discarded – undo
432 432
 			PRIMARY KEY  (VNUM_ID),
433 433
 			KEY STA_ID (STA_ID),
434 434
 			KEY CNT_ISO (CNT_ISO)";
435
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
436
-        // modified tables
437
-        $table_name = "esp_price";
438
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
435
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
436
+		// modified tables
437
+		$table_name = "esp_price";
438
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
439 439
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
440 440
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
441 441
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
 					  PRC_wp_user BIGINT UNSIGNED NULL,
448 448
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
449 449
 					  PRIMARY KEY  (PRC_ID)";
450
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
451
-        $table_name = "esp_price_type";
452
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
450
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
451
+		$table_name = "esp_price_type";
452
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
453 453
 				  PRT_name VARCHAR(45) NOT NULL,
454 454
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
455 455
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
459 459
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
460 460
 				  PRIMARY KEY  (PRT_ID)";
461
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
462
-        $table_name = "esp_ticket";
463
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
461
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
462
+		$table_name = "esp_ticket";
463
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
464 464
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
465 465
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
466 466
 					  TKT_description TEXT NOT NULL,
@@ -481,10 +481,10 @@  discard block
 block discarded – undo
481 481
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
482 482
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
483 483
 					  PRIMARY KEY  (TKT_ID)";
484
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
485
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
486
-        $table_name = 'esp_question_group';
487
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
484
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
485
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
486
+		$table_name = 'esp_question_group';
487
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
488 488
 					QSG_name VARCHAR(255) NOT NULL,
489 489
 					QSG_identifier VARCHAR(100) NOT NULL,
490 490
 					QSG_desc TEXT NULL,
@@ -496,124 +496,124 @@  discard block
 block discarded – undo
496 496
 					QSG_wp_user BIGINT UNSIGNED NULL,
497 497
 					PRIMARY KEY  (QSG_ID),
498 498
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
499
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
500
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
501
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
502
-        // (because many need to convert old string states to foreign keys into the states table)
503
-        $script_4_1_defaults->insert_default_states();
504
-        $script_4_1_defaults->insert_default_countries();
505
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
506
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
507
-        $script_4_5_defaults->insert_default_price_types();
508
-        $script_4_5_defaults->insert_default_prices();
509
-        $script_4_5_defaults->insert_default_tickets();
510
-        // setting up the config wp option pretty well counts as a 'schema change', or at least should happen here
511
-        EE_Config::instance()->update_espresso_config(false, true);
512
-        $this->add_default_admin_only_payments();
513
-        $this->insert_default_currencies();
514
-        return true;
515
-    }
499
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
500
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
501
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
502
+		// (because many need to convert old string states to foreign keys into the states table)
503
+		$script_4_1_defaults->insert_default_states();
504
+		$script_4_1_defaults->insert_default_countries();
505
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
506
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
507
+		$script_4_5_defaults->insert_default_price_types();
508
+		$script_4_5_defaults->insert_default_prices();
509
+		$script_4_5_defaults->insert_default_tickets();
510
+		// setting up the config wp option pretty well counts as a 'schema change', or at least should happen here
511
+		EE_Config::instance()->update_espresso_config(false, true);
512
+		$this->add_default_admin_only_payments();
513
+		$this->insert_default_currencies();
514
+		return true;
515
+	}
516 516
 
517 517
 
518 518
 
519
-    /**
520
-     * @return boolean
521
-     */
522
-    public function schema_changes_after_migration()
523
-    {
524
-        return true;
525
-    }
519
+	/**
520
+	 * @return boolean
521
+	 */
522
+	public function schema_changes_after_migration()
523
+	{
524
+		return true;
525
+	}
526 526
 
527 527
 
528 528
 
529
-    public function migration_page_hooks()
530
-    {
531
-    }
529
+	public function migration_page_hooks()
530
+	{
531
+	}
532 532
 
533 533
 
534 534
 
535
-    public function add_default_admin_only_payments()
536
-    {
537
-        global $wpdb;
538
-        $table_name = $wpdb->prefix . "esp_payment_method";
539
-        $user_id = EEH_Activation::get_default_creator_id();
540
-        if ($this->_get_table_analysis()->tableExists($table_name)) {
541
-            $SQL = "SELECT COUNT( * ) FROM $table_name";
542
-            $existing_payment_methods = $wpdb->get_var($SQL);
543
-            $default_admin_only_payment_methods = apply_filters(
544
-                'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods',
545
-                array(
546
-                    __("Bank", 'event_espresso')        => __("Bank Draft", 'event_espresso'),
547
-                    __("Cash", 'event_espresso')        => __("Cash Delivered Physically", 'event_espresso'),
548
-                    __("Check", 'event_espresso')       => __("Paper Check", 'event_espresso'),
549
-                    __("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'),
550
-                    __("Debit Card", 'event_espresso')  => __("Offline Debit Payment", 'event_espresso'),
551
-                    __("Invoice", 'event_espresso')     => __(
552
-                        "Invoice received with monies included",
553
-                        'event_espresso'
554
-                    ),
555
-                    __("Money Order", 'event_espresso') => '',
556
-                    __("Paypal", 'event_espresso')      => __("Paypal eCheck, Invoice, etc", 'event_espresso'),
557
-                    __('Other', 'event_espresso')       => __('Other method of payment', 'event_espresso'),
558
-                )
559
-            );
560
-            // make sure we hae payment method records for the following
561
-            // so admins can record payments for them from the admin page
562
-            foreach ($default_admin_only_payment_methods as $nicename => $description) {
563
-                $slug = sanitize_key($nicename);
564
-                // check that such a payment method exists
565
-                $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
566
-                if (! $exists) {
567
-                    $values = array(
568
-                        'PMD_type'       => 'Admin_Only',
569
-                        'PMD_name'       => $nicename,
570
-                        'PMD_admin_name' => $nicename,
571
-                        'PMD_admin_desc' => $description,
572
-                        'PMD_slug'       => $slug,
573
-                        'PMD_wp_user'    => $user_id,
574
-                        'PMD_scope'      => serialize(array('ADMIN')),
575
-                    );
576
-                    $success = $wpdb->insert(
577
-                        $table_name,
578
-                        $values,
579
-                        array(
580
-                            '%s',// PMD_type
581
-                            '%s',// PMD_name
582
-                            '%s',// PMD_admin_name
583
-                            '%s',// PMD_admin_desc
584
-                            '%s',// PMD_slug
585
-                            '%d',// PMD_wp_user
586
-                            '%s',// PMD_scope
587
-                        )
588
-                    );
589
-                    if (! $success) {
590
-                        $this->add_error(sprintf(__(
591
-                            "Could not insert new admin-only payment method with values %s during migration",
592
-                            "event_espresso"
593
-                        ), $this->_json_encode($values)));
594
-                    }
595
-                }
596
-            }
597
-        }
598
-    }
535
+	public function add_default_admin_only_payments()
536
+	{
537
+		global $wpdb;
538
+		$table_name = $wpdb->prefix . "esp_payment_method";
539
+		$user_id = EEH_Activation::get_default_creator_id();
540
+		if ($this->_get_table_analysis()->tableExists($table_name)) {
541
+			$SQL = "SELECT COUNT( * ) FROM $table_name";
542
+			$existing_payment_methods = $wpdb->get_var($SQL);
543
+			$default_admin_only_payment_methods = apply_filters(
544
+				'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods',
545
+				array(
546
+					__("Bank", 'event_espresso')        => __("Bank Draft", 'event_espresso'),
547
+					__("Cash", 'event_espresso')        => __("Cash Delivered Physically", 'event_espresso'),
548
+					__("Check", 'event_espresso')       => __("Paper Check", 'event_espresso'),
549
+					__("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'),
550
+					__("Debit Card", 'event_espresso')  => __("Offline Debit Payment", 'event_espresso'),
551
+					__("Invoice", 'event_espresso')     => __(
552
+						"Invoice received with monies included",
553
+						'event_espresso'
554
+					),
555
+					__("Money Order", 'event_espresso') => '',
556
+					__("Paypal", 'event_espresso')      => __("Paypal eCheck, Invoice, etc", 'event_espresso'),
557
+					__('Other', 'event_espresso')       => __('Other method of payment', 'event_espresso'),
558
+				)
559
+			);
560
+			// make sure we hae payment method records for the following
561
+			// so admins can record payments for them from the admin page
562
+			foreach ($default_admin_only_payment_methods as $nicename => $description) {
563
+				$slug = sanitize_key($nicename);
564
+				// check that such a payment method exists
565
+				$exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
566
+				if (! $exists) {
567
+					$values = array(
568
+						'PMD_type'       => 'Admin_Only',
569
+						'PMD_name'       => $nicename,
570
+						'PMD_admin_name' => $nicename,
571
+						'PMD_admin_desc' => $description,
572
+						'PMD_slug'       => $slug,
573
+						'PMD_wp_user'    => $user_id,
574
+						'PMD_scope'      => serialize(array('ADMIN')),
575
+					);
576
+					$success = $wpdb->insert(
577
+						$table_name,
578
+						$values,
579
+						array(
580
+							'%s',// PMD_type
581
+							'%s',// PMD_name
582
+							'%s',// PMD_admin_name
583
+							'%s',// PMD_admin_desc
584
+							'%s',// PMD_slug
585
+							'%d',// PMD_wp_user
586
+							'%s',// PMD_scope
587
+						)
588
+					);
589
+					if (! $success) {
590
+						$this->add_error(sprintf(__(
591
+							"Could not insert new admin-only payment method with values %s during migration",
592
+							"event_espresso"
593
+						), $this->_json_encode($values)));
594
+					}
595
+				}
596
+			}
597
+		}
598
+	}
599 599
 
600 600
 
601 601
 
602
-    /**
603
-     * insert_default_countries
604
-     *
605
-     * @static
606
-     * @return void
607
-     */
608
-    public function insert_default_currencies()
609
-    {
610
-        global $wpdb;
611
-        $currency_table = $wpdb->prefix . "esp_currency";
612
-        if ($this->_get_table_analysis()->tableExists($currency_table)) {
613
-            $SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
614
-            $countries = $wpdb->get_var($SQL);
615
-            if (! $countries) {
616
-                $SQL = "INSERT INTO $currency_table
602
+	/**
603
+	 * insert_default_countries
604
+	 *
605
+	 * @static
606
+	 * @return void
607
+	 */
608
+	public function insert_default_currencies()
609
+	{
610
+		global $wpdb;
611
+		$currency_table = $wpdb->prefix . "esp_currency";
612
+		if ($this->_get_table_analysis()->tableExists($currency_table)) {
613
+			$SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
614
+			$countries = $wpdb->get_var($SQL);
615
+			if (! $countries) {
616
+				$SQL = "INSERT INTO $currency_table
617 617
 				( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES
618 618
 				( 'EUR',  'Euro',  'Euros',  '€',  2,1),
619 619
 				( 'AED',  'Dirham',  'Dirhams', 'د.إ',2,1),
@@ -767,8 +767,8 @@  discard block
 block discarded – undo
767 767
 				( 'ZAR',  'Rand',  'Rands',  'R',  2,1),
768 768
 				( 'ZMK',  'Kwacha',  'Kwachas',  '',  2,1),
769 769
 				( 'ZWD', 'Dollar', 'Dollars', 'Z$', 2,1);";
770
-                $wpdb->query($SQL);
771
-            }
772
-        }
773
-    }
770
+				$wpdb->query($SQL);
771
+			}
772
+		}
773
+	}
774 774
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@  discard block
 block discarded – undo
11 11
 // unfortunately, this needs to be done upon INCLUSION of this file,
12 12
 // instead of construction, because it only gets constructed on first page load
13 13
 // (all other times it gets resurrected from a wordpress option)
14
-$stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*');
14
+$stages = glob(EE_CORE.'data_migration_scripts/4_6_0_stages/*');
15 15
 $class_to_filepath = array();
16 16
 foreach ($stages as $filepath) {
17 17
     $matches = array();
18 18
     preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches);
19
-    $class_to_filepath[ $matches[1] ] = $filepath;
19
+    $class_to_filepath[$matches[1]] = $filepath;
20 20
 }
21 21
 // give addons a chance to autoload their stages too
22 22
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath);
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
         if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) {
71 71
 //          echo "$version_string can be migrated from";
72 72
             return true;
73
-        } elseif (! $version_string) {
73
+        } elseif ( ! $version_string) {
74 74
 //          echo "no version string provided: $version_string";
75 75
             // no version string provided... this must be pre 4.3
76
-            return false;// changed mind. dont want people thinking they should migrate yet because they cant
76
+            return false; // changed mind. dont want people thinking they should migrate yet because they cant
77 77
         } else {
78 78
 //          echo "$version_string doesnt apply";
79 79
             return false;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     public function schema_changes_before_migration()
89 89
     {
90 90
         // relies on 4.1's EEH_Activation::create_table
91
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
91
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
92 92
         $table_name = 'esp_answer';
93 93
         $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
94 94
 					REG_ID INT UNSIGNED NOT NULL,
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
     public function add_default_admin_only_payments()
536 536
     {
537 537
         global $wpdb;
538
-        $table_name = $wpdb->prefix . "esp_payment_method";
538
+        $table_name = $wpdb->prefix."esp_payment_method";
539 539
         $user_id = EEH_Activation::get_default_creator_id();
540 540
         if ($this->_get_table_analysis()->tableExists($table_name)) {
541 541
             $SQL = "SELECT COUNT( * ) FROM $table_name";
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
                 $slug = sanitize_key($nicename);
564 564
                 // check that such a payment method exists
565 565
                 $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
566
-                if (! $exists) {
566
+                if ( ! $exists) {
567 567
                     $values = array(
568 568
                         'PMD_type'       => 'Admin_Only',
569 569
                         'PMD_name'       => $nicename,
@@ -577,16 +577,16 @@  discard block
 block discarded – undo
577 577
                         $table_name,
578 578
                         $values,
579 579
                         array(
580
-                            '%s',// PMD_type
581
-                            '%s',// PMD_name
582
-                            '%s',// PMD_admin_name
583
-                            '%s',// PMD_admin_desc
584
-                            '%s',// PMD_slug
585
-                            '%d',// PMD_wp_user
586
-                            '%s',// PMD_scope
580
+                            '%s', // PMD_type
581
+                            '%s', // PMD_name
582
+                            '%s', // PMD_admin_name
583
+                            '%s', // PMD_admin_desc
584
+                            '%s', // PMD_slug
585
+                            '%d', // PMD_wp_user
586
+                            '%s', // PMD_scope
587 587
                         )
588 588
                     );
589
-                    if (! $success) {
589
+                    if ( ! $success) {
590 590
                         $this->add_error(sprintf(__(
591 591
                             "Could not insert new admin-only payment method with values %s during migration",
592 592
                             "event_espresso"
@@ -608,11 +608,11 @@  discard block
 block discarded – undo
608 608
     public function insert_default_currencies()
609 609
     {
610 610
         global $wpdb;
611
-        $currency_table = $wpdb->prefix . "esp_currency";
611
+        $currency_table = $wpdb->prefix."esp_currency";
612 612
         if ($this->_get_table_analysis()->tableExists($currency_table)) {
613 613
             $SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
614 614
             $countries = $wpdb->get_var($SQL);
615
-            if (! $countries) {
615
+            if ( ! $countries) {
616 616
                 $SQL = "INSERT INTO $currency_table
617 617
 				( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES
618 618
 				( 'EUR',  'Euro',  'Euros',  '€',  2,1),
Please login to merge, or discard this patch.
4_3_0_stages/EE_DMS_4_3_0_event_message_templates.dmsstage.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -13,59 +13,59 @@
 block discarded – undo
13 13
 class EE_DMS_4_3_0_event_message_templates extends EE_Data_Migration_Script_Stage_Table
14 14
 {
15 15
 
16
-    /**
17
-     * This property will hold the table name for event_message_templates
18
-     * @var string
19
-     */
20
-    private $_emt_table;
16
+	/**
17
+	 * This property will hold the table name for event_message_templates
18
+	 * @var string
19
+	 */
20
+	private $_emt_table;
21 21
 
22 22
 
23
-    public function __construct()
24
-    {
25
-        global $wpdb;
26
-        $this->_pretty_name = __('Event Message Templates', 'event_espresso');
27
-        $this->_old_table = $wpdb->prefix."esp_message_template_group";
28
-        $this->_emt_table = $wpdb->prefix."esp_event_message_template";
29
-        parent::__construct();
30
-    }
23
+	public function __construct()
24
+	{
25
+		global $wpdb;
26
+		$this->_pretty_name = __('Event Message Templates', 'event_espresso');
27
+		$this->_old_table = $wpdb->prefix."esp_message_template_group";
28
+		$this->_emt_table = $wpdb->prefix."esp_event_message_template";
29
+		parent::__construct();
30
+	}
31 31
 
32 32
 
33 33
 
34
-    protected function _migrate_old_row($old_row)
35
-    {
36
-        // foreach row that has an evt_id ..let's create an equivalent entry in the new event_messages_template table to link the message template to the event (since EVT_ID is no longer referenced in esp_message_template_groups )
37
-        global $wpdb;
38
-        if ($old_row['EVT_ID'] > 0) {
39
-                                    // let's get the EVT for this id so we can update the custom name on the old row.
40
-                                    $event_name = 'Custom Template for ' . $wpdb->get_var($wpdb->prepare("SELECT post_title from $wpdb->posts WHERE ID = %d", absint($old_row['EVT_ID'])));
34
+	protected function _migrate_old_row($old_row)
35
+	{
36
+		// foreach row that has an evt_id ..let's create an equivalent entry in the new event_messages_template table to link the message template to the event (since EVT_ID is no longer referenced in esp_message_template_groups )
37
+		global $wpdb;
38
+		if ($old_row['EVT_ID'] > 0) {
39
+									// let's get the EVT for this id so we can update the custom name on the old row.
40
+									$event_name = 'Custom Template for ' . $wpdb->get_var($wpdb->prepare("SELECT post_title from $wpdb->posts WHERE ID = %d", absint($old_row['EVT_ID'])));
41 41
 
42
-                                    // update name
43
-                                    $updated = $wpdb->update(
44
-                                        $this->_old_table,
45
-                                        array(
46
-                                            'MTP_name' =>$event_name
47
-                                            ),
48
-                                        array( 'GRP_ID' => (int) $old_row['GRP_ID'] ),
49
-                                        array( '%s' ),
50
-                                        array( '%d' )
51
-                                    );
42
+									// update name
43
+									$updated = $wpdb->update(
44
+										$this->_old_table,
45
+										array(
46
+											'MTP_name' =>$event_name
47
+											),
48
+										array( 'GRP_ID' => (int) $old_row['GRP_ID'] ),
49
+										array( '%s' ),
50
+										array( '%d' )
51
+									);
52 52
 
53
-            $inserted = $wpdb->insert(
54
-                $this->_emt_table,
55
-                array(
56
-                    'EVT_ID' => (int) $old_row['EVT_ID'],
57
-                    'GRP_ID' => (int) $old_row['GRP_ID'],
58
-                    ),
59
-                array( '%d', '%d' )
60
-            );
53
+			$inserted = $wpdb->insert(
54
+				$this->_emt_table,
55
+				array(
56
+					'EVT_ID' => (int) $old_row['EVT_ID'],
57
+					'GRP_ID' => (int) $old_row['GRP_ID'],
58
+					),
59
+				array( '%d', '%d' )
60
+			);
61 61
 
62
-            if (false === $updated) {
63
-                $this->add_error(sprintf(__("Error in updating the row in %s setting 'MTP_name = %s", 'event_espresso'), $this->_old_table, $event_name));
64
-            }
62
+			if (false === $updated) {
63
+				$this->add_error(sprintf(__("Error in updating the row in %s setting 'MTP_name = %s", 'event_espresso'), $this->_old_table, $event_name));
64
+			}
65 65
 
66
-            if (false === $inserted) {
67
-                $this->add_error(sprintf(__("Error in inserting a row into  setting EVT_ID = %d and GRP_ID = %d", "event_espresso"), $this->_emt_table, $old_row['EVT_ID'], $old_row['GRP_ID']));
68
-            }
69
-        }
70
-    }
66
+			if (false === $inserted) {
67
+				$this->add_error(sprintf(__("Error in inserting a row into  setting EVT_ID = %d and GRP_ID = %d", "event_espresso"), $this->_emt_table, $old_row['EVT_ID'], $old_row['GRP_ID']));
68
+			}
69
+		}
70
+	}
71 71
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         global $wpdb;
38 38
         if ($old_row['EVT_ID'] > 0) {
39 39
                                     // let's get the EVT for this id so we can update the custom name on the old row.
40
-                                    $event_name = 'Custom Template for ' . $wpdb->get_var($wpdb->prepare("SELECT post_title from $wpdb->posts WHERE ID = %d", absint($old_row['EVT_ID'])));
40
+                                    $event_name = 'Custom Template for '.$wpdb->get_var($wpdb->prepare("SELECT post_title from $wpdb->posts WHERE ID = %d", absint($old_row['EVT_ID'])));
41 41
 
42 42
                                     // update name
43 43
                                     $updated = $wpdb->update(
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
                                         array(
46 46
                                             'MTP_name' =>$event_name
47 47
                                             ),
48
-                                        array( 'GRP_ID' => (int) $old_row['GRP_ID'] ),
49
-                                        array( '%s' ),
50
-                                        array( '%d' )
48
+                                        array('GRP_ID' => (int) $old_row['GRP_ID']),
49
+                                        array('%s'),
50
+                                        array('%d')
51 51
                                     );
52 52
 
53 53
             $inserted = $wpdb->insert(
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                     'EVT_ID' => (int) $old_row['EVT_ID'],
57 57
                     'GRP_ID' => (int) $old_row['GRP_ID'],
58 58
                     ),
59
-                array( '%d', '%d' )
59
+                array('%d', '%d')
60 60
             );
61 61
 
62 62
             if (false === $updated) {
Please login to merge, or discard this patch.
4_3_0_stages/EE_DMS_4_3_0_question_option_order.dmsstage.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -7,39 +7,39 @@
 block discarded – undo
7 7
 
8 8
 class EE_DMS_4_3_0_question_option_order extends EE_Data_Migration_Script_Stage_Table
9 9
 {
10
-    public function __construct()
11
-    {
12
-        global $wpdb;
13
-        $this->_pretty_name = __("Question Options", "event_espresso");
14
-        $this->_old_table = $wpdb->prefix."esp_question_option";
15
-        parent::__construct();
16
-    }
17
-    protected function _migrate_old_row($old_row)
18
-    {
19
-        // foreach question_group_question entry with this QST_ID, we want to set its
20
-        // QSG_order equal to this question's QST_order
21
-        global $wpdb;
22
-        $updated = $wpdb->update(
23
-            $this->_old_table,
24
-            array('QSO_order'=>$old_row['QSO_ID']),
25
-            array('QSO_ID'=>$old_row['QSO_ID']),
26
-            array('%d',// QSO_order
27
-                    ),
28
-            array('%d',// QSO_ID
29
-                    )
30
-        );
31
-        if (false === $updated) {
32
-            $this->add_error(
33
-                sprintf(
34
-                    __(
35
-                        "Error in updating table %s setting QSO_order = %d where QSO_ID = %d",
36
-                        'event_espresso'
37
-                    ),
38
-                    $this->_old_table,
39
-                    $old_row['QSO_ID'],
40
-                    $old_row['QSO_ID']
41
-                )
42
-            );
43
-        }
44
-    }
10
+	public function __construct()
11
+	{
12
+		global $wpdb;
13
+		$this->_pretty_name = __("Question Options", "event_espresso");
14
+		$this->_old_table = $wpdb->prefix."esp_question_option";
15
+		parent::__construct();
16
+	}
17
+	protected function _migrate_old_row($old_row)
18
+	{
19
+		// foreach question_group_question entry with this QST_ID, we want to set its
20
+		// QSG_order equal to this question's QST_order
21
+		global $wpdb;
22
+		$updated = $wpdb->update(
23
+			$this->_old_table,
24
+			array('QSO_order'=>$old_row['QSO_ID']),
25
+			array('QSO_ID'=>$old_row['QSO_ID']),
26
+			array('%d',// QSO_order
27
+					),
28
+			array('%d',// QSO_ID
29
+					)
30
+		);
31
+		if (false === $updated) {
32
+			$this->add_error(
33
+				sprintf(
34
+					__(
35
+						"Error in updating table %s setting QSO_order = %d where QSO_ID = %d",
36
+						'event_espresso'
37
+					),
38
+					$this->_old_table,
39
+					$old_row['QSO_ID'],
40
+					$old_row['QSO_ID']
41
+				)
42
+			);
43
+		}
44
+	}
45 45
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@
 block discarded – undo
23 23
             $this->_old_table,
24 24
             array('QSO_order'=>$old_row['QSO_ID']),
25 25
             array('QSO_ID'=>$old_row['QSO_ID']),
26
-            array('%d',// QSO_order
26
+            array('%d', // QSO_order
27 27
                     ),
28
-            array('%d',// QSO_ID
28
+            array('%d', // QSO_ID
29 29
                     )
30 30
         );
31 31
         if (false === $updated) {
Please login to merge, or discard this patch.
core/EE_Front_Controller.core.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
         print(
345 345
         apply_filters(
346 346
             'FHEE__EE_Front_Controller__header_meta_tag',
347
-            '<meta name="generator" content="Event Espresso Version ' . EVENT_ESPRESSO_VERSION . "\" />\n"
347
+            '<meta name="generator" content="Event Espresso Version '.EVENT_ESPRESSO_VERSION."\" />\n"
348 348
         )
349 349
         );
350 350
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
             print(
361 361
             apply_filters(
362 362
                 'FHEE__EE_Front_Controller__header_meta_tag__noindex_for_event_type',
363
-                '<meta name="robots" content="noindex,follow" />' . "\n"
363
+                '<meta name="robots" content="noindex,follow" />'."\n"
364 364
             )
365 365
             );
366 366
         }
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
     {
414 414
         static $shown_already = false;
415 415
         do_action('AHEE__EE_Front_Controller__display_errors__begin');
416
-        if (! $shown_already
416
+        if ( ! $shown_already
417 417
             && apply_filters('FHEE__EE_Front_Controller__display_errors', true)
418 418
             && is_main_query()
419 419
             && ! is_feed()
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         ) {
423 423
             echo EE_Error::get_notices();
424 424
             $shown_already = true;
425
-            EEH_Template::display_template(EE_TEMPLATES . 'espresso-ajax-notices.template.php');
425
+            EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php');
426 426
         }
427 427
         do_action('AHEE__EE_Front_Controller__display_errors__end');
428 428
     }
Please login to merge, or discard this patch.
Indentation   +470 added lines, -470 removed lines patch added patch discarded remove patch
@@ -26,474 +26,474 @@
 block discarded – undo
26 26
 final class EE_Front_Controller
27 27
 {
28 28
 
29
-    /**
30
-     * @var string $_template_path
31
-     */
32
-    private $_template_path;
33
-
34
-    /**
35
-     * @var string $_template
36
-     */
37
-    private $_template;
38
-
39
-    /**
40
-     * @type EE_Registry $Registry
41
-     */
42
-    protected $Registry;
43
-
44
-    /**
45
-     * @type EE_Request_Handler $Request_Handler
46
-     */
47
-    protected $Request_Handler;
48
-
49
-    /**
50
-     * @type EE_Module_Request_Router $Module_Request_Router
51
-     */
52
-    protected $Module_Request_Router;
53
-
54
-
55
-    /**
56
-     *    class constructor
57
-     *    should fire after shortcode, module, addon, or other plugin's default priority init phases have run
58
-     *
59
-     * @access    public
60
-     * @param \EE_Registry              $Registry
61
-     * @param \EE_Request_Handler       $Request_Handler
62
-     * @param \EE_Module_Request_Router $Module_Request_Router
63
-     */
64
-    public function __construct(
65
-        EE_Registry $Registry,
66
-        EE_Request_Handler $Request_Handler,
67
-        EE_Module_Request_Router $Module_Request_Router
68
-    ) {
69
-        $this->Registry = $Registry;
70
-        $this->Request_Handler = $Request_Handler;
71
-        $this->Module_Request_Router = $Module_Request_Router;
72
-        // determine how to integrate WP_Query with the EE models
73
-        add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy'));
74
-        // load other resources and begin to actually run shortcodes and modules
75
-        add_action('wp_loaded', array($this, 'wp_loaded'), 5);
76
-        // analyse the incoming WP request
77
-        add_action('parse_request', array($this, 'get_request'), 1, 1);
78
-        // process request with module factory
79
-        add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1);
80
-        // before headers sent
81
-        add_action('wp', array($this, 'wp'), 5);
82
-        // primarily used to process any content shortcodes
83
-        add_action('template_redirect', array($this, 'templateRedirect'), 999);
84
-        // header
85
-        add_action('wp_head', array($this, 'header_meta_tag'), 5);
86
-        add_action('wp_print_scripts', array($this, 'wp_print_scripts'), 10);
87
-        add_filter('template_include', array($this, 'template_include'), 1);
88
-        // display errors
89
-        add_action('loop_start', array($this, 'display_errors'), 2);
90
-        // the content
91
-        // add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 );
92
-        // exclude our private cpt comments
93
-        add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1);
94
-        // make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://)
95
-        add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1);
96
-        // action hook EE
97
-        do_action('AHEE__EE_Front_Controller__construct__done', $this);
98
-    }
99
-
100
-
101
-    /**
102
-     * @return EE_Request_Handler
103
-     */
104
-    public function Request_Handler()
105
-    {
106
-        return $this->Request_Handler;
107
-    }
108
-
109
-
110
-    /**
111
-     * @return EE_Module_Request_Router
112
-     */
113
-    public function Module_Request_Router()
114
-    {
115
-        return $this->Module_Request_Router;
116
-    }
117
-
118
-
119
-    /**
120
-     * @return LegacyShortcodesManager
121
-     */
122
-    public function getLegacyShortcodesManager()
123
-    {
124
-        return EE_Config::getLegacyShortcodesManager();
125
-    }
126
-
127
-
128
-
129
-
130
-
131
-    /***********************************************        INIT ACTION HOOK         ***********************************************/
132
-    /**
133
-     * filter_wp_comments
134
-     * This simply makes sure that any "private" EE CPTs do not have their comments show up in any wp comment
135
-     * widgets/queries done on frontend
136
-     *
137
-     * @param  array $clauses array of comment clauses setup by WP_Comment_Query
138
-     * @return array array of comment clauses with modifications.
139
-     * @throws InvalidArgumentException
140
-     * @throws InvalidDataTypeException
141
-     * @throws InvalidInterfaceException
142
-     */
143
-    public function filter_wp_comments($clauses)
144
-    {
145
-        global $wpdb;
146
-        if (strpos($clauses['join'], $wpdb->posts) !== false) {
147
-            /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_types */
148
-            $custom_post_types = LoaderFactory::getLoader()->getShared(
149
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'
150
-            );
151
-            $cpts = $custom_post_types->getPrivateCustomPostTypes();
152
-            foreach ($cpts as $cpt => $details) {
153
-                $clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt);
154
-            }
155
-        }
156
-        return $clauses;
157
-    }
158
-
159
-
160
-    /**
161
-     * @return void
162
-     * @throws InvalidArgumentException
163
-     * @throws InvalidDataTypeException
164
-     * @throws InvalidInterfaceException
165
-     */
166
-    public function employ_CPT_Strategy()
167
-    {
168
-        if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) {
169
-            LoaderFactory::getLoader()->getShared('EE_CPT_Strategy');
170
-        }
171
-    }
172
-
173
-
174
-    /**
175
-     * this just makes sure that if the site is using ssl that we force that for any admin ajax calls from frontend
176
-     *
177
-     * @param  string $url incoming url
178
-     * @return string         final assembled url
179
-     */
180
-    public function maybe_force_admin_ajax_ssl($url)
181
-    {
182
-        if (is_ssl() && preg_match('/admin-ajax.php/', $url)) {
183
-            $url = str_replace('http://', 'https://', $url);
184
-        }
185
-        return $url;
186
-    }
187
-
188
-
189
-
190
-
191
-
192
-
193
-    /***********************************************        WP_LOADED ACTION HOOK         ***********************************************/
194
-
195
-
196
-    /**
197
-     *    wp_loaded - should fire after shortcode, module, addon, or other plugin's have been registered and their
198
-     *    default priority init phases have run
199
-     *
200
-     * @access    public
201
-     * @return    void
202
-     */
203
-    public function wp_loaded()
204
-    {
205
-    }
206
-
207
-
208
-
209
-
210
-
211
-    /***********************************************        PARSE_REQUEST HOOK         ***********************************************/
212
-    /**
213
-     *    _get_request
214
-     *
215
-     * @access public
216
-     * @param WP $WP
217
-     * @return void
218
-     */
219
-    public function get_request(WP $WP)
220
-    {
221
-        do_action('AHEE__EE_Front_Controller__get_request__start');
222
-        $this->Request_Handler->parse_request($WP);
223
-        do_action('AHEE__EE_Front_Controller__get_request__complete');
224
-    }
225
-
226
-
227
-    /**
228
-     *    pre_get_posts - basically a module factory for instantiating modules and selecting the final view template
229
-     *
230
-     * @access    public
231
-     * @param   WP_Query $WP_Query
232
-     * @return    void
233
-     */
234
-    public function pre_get_posts($WP_Query)
235
-    {
236
-        // only load Module_Request_Router if this is the main query
237
-        if ($this->Module_Request_Router instanceof EE_Module_Request_Router
238
-            && $WP_Query->is_main_query()
239
-        ) {
240
-            // cycle thru module routes
241
-            while ($route = $this->Module_Request_Router->get_route($WP_Query)) {
242
-                // determine module and method for route
243
-                $module = $this->Module_Request_Router->resolve_route($route[0], $route[1]);
244
-                if ($module instanceof EED_Module) {
245
-                    // get registered view for route
246
-                    $this->_template_path = $this->Module_Request_Router->get_view($route);
247
-                    // grab module name
248
-                    $module_name = $module->module_name();
249
-                    // map the module to the module objects
250
-                    $this->Registry->modules->{$module_name} = $module;
251
-                }
252
-            }
253
-        }
254
-    }
255
-
256
-
257
-
258
-
259
-
260
-    /***********************************************        WP HOOK         ***********************************************/
261
-
262
-
263
-    /**
264
-     *    wp - basically last chance to do stuff before headers sent
265
-     *
266
-     * @access    public
267
-     * @return    void
268
-     */
269
-    public function wp()
270
-    {
271
-    }
272
-
273
-
274
-
275
-    /***********************     GET_HEADER && WP_HEAD HOOK     ***********************/
276
-
277
-
278
-    /**
279
-     * callback for the "template_redirect" hook point
280
-     * checks sidebars for EE widgets
281
-     * loads resources and assets accordingly
282
-     *
283
-     * @return void
284
-     */
285
-    public function templateRedirect()
286
-    {
287
-        global $wp_query;
288
-        if (empty($wp_query->posts)) {
289
-            return;
290
-        }
291
-        // if we already know this is an espresso page, then load assets
292
-        $load_assets = $this->Request_Handler->is_espresso_page();
293
-        // if we are already loading assets then just move along, otherwise check for widgets
294
-        $load_assets = $load_assets ? $load_assets : $this->espresso_widgets_in_active_sidebars();
295
-        if ($load_assets) {
296
-            add_action('wp_enqueue_scripts', array($this, 'enqueueStyle'), 10);
297
-            add_action('wp_print_footer_scripts', array($this, 'enqueueScripts'), 10);
298
-        }
299
-    }
300
-
301
-
302
-    /**
303
-     * builds list of active widgets then scans active sidebars looking for them
304
-     * returns true is an EE widget is found in an active sidebar
305
-     * Please Note: this does NOT mean that the sidebar or widget
306
-     * is actually in use in a given template, as that is unfortunately not known
307
-     * until a sidebar and it's widgets are actually loaded
308
-     *
309
-     * @return boolean
310
-     */
311
-    private function espresso_widgets_in_active_sidebars()
312
-    {
313
-        $espresso_widgets = array();
314
-        foreach ($this->Registry->widgets as $widget_class => $widget) {
315
-            $id_base = EspressoWidget::getIdBase($widget_class);
316
-            if (is_active_widget(false, false, $id_base)) {
317
-                $espresso_widgets[] = $id_base;
318
-            }
319
-        }
320
-        $all_sidebar_widgets = wp_get_sidebars_widgets();
321
-        foreach ($all_sidebar_widgets as $sidebar_name => $sidebar_widgets) {
322
-            if (is_array($sidebar_widgets) && ! empty($sidebar_widgets)) {
323
-                foreach ($sidebar_widgets as $sidebar_widget) {
324
-                    foreach ($espresso_widgets as $espresso_widget) {
325
-                        if (strpos($sidebar_widget, $espresso_widget) !== false) {
326
-                            return true;
327
-                        }
328
-                    }
329
-                }
330
-            }
331
-        }
332
-        return false;
333
-    }
334
-
335
-
336
-    /**
337
-     *    header_meta_tag
338
-     *
339
-     * @access    public
340
-     * @return    void
341
-     */
342
-    public function header_meta_tag()
343
-    {
344
-        print(
345
-        apply_filters(
346
-            'FHEE__EE_Front_Controller__header_meta_tag',
347
-            '<meta name="generator" content="Event Espresso Version ' . EVENT_ESPRESSO_VERSION . "\" />\n"
348
-        )
349
-        );
350
-
351
-        // let's exclude all event type taxonomy term archive pages from search engine indexing
352
-        // @see https://events.codebasehq.com/projects/event-espresso/tickets/10249
353
-        // also exclude all critical pages from indexing
354
-        if ((
355
-                is_tax('espresso_event_type')
356
-                && get_option('blog_public') !== '0'
357
-            )
358
-            || is_page(EE_Registry::instance()->CFG->core->get_critical_pages_array())
359
-        ) {
360
-            print(
361
-            apply_filters(
362
-                'FHEE__EE_Front_Controller__header_meta_tag__noindex_for_event_type',
363
-                '<meta name="robots" content="noindex,follow" />' . "\n"
364
-            )
365
-            );
366
-        }
367
-    }
368
-
369
-
370
-    /**
371
-     * wp_print_scripts
372
-     *
373
-     * @return void
374
-     */
375
-    public function wp_print_scripts()
376
-    {
377
-        global $post;
378
-        if (isset($post->EE_Event)
379
-            && $post->EE_Event instanceof EE_Event
380
-            && get_post_type() === 'espresso_events'
381
-            && is_singular()
382
-        ) {
383
-            \EEH_Schema::add_json_linked_data_for_event($post->EE_Event);
384
-        }
385
-    }
386
-
387
-
388
-    public function enqueueStyle()
389
-    {
390
-        wp_enqueue_style('espresso_default');
391
-        wp_enqueue_style('espresso_custom_css');
392
-    }
393
-
394
-
395
-
396
-    /***********************************************        WP_FOOTER         ***********************************************/
397
-
398
-
399
-    public function enqueueScripts()
400
-    {
401
-        wp_enqueue_script('espresso_core');
402
-    }
403
-
404
-
405
-    /**
406
-     * display_errors
407
-     *
408
-     * @access public
409
-     * @return void
410
-     * @throws DomainException
411
-     */
412
-    public function display_errors()
413
-    {
414
-        static $shown_already = false;
415
-        do_action('AHEE__EE_Front_Controller__display_errors__begin');
416
-        if (! $shown_already
417
-            && apply_filters('FHEE__EE_Front_Controller__display_errors', true)
418
-            && is_main_query()
419
-            && ! is_feed()
420
-            && in_the_loop()
421
-            && did_action('wp_head')
422
-            && $this->Request_Handler->is_espresso_page()
423
-        ) {
424
-            echo EE_Error::get_notices();
425
-            $shown_already = true;
426
-            EEH_Template::display_template(EE_TEMPLATES . 'espresso-ajax-notices.template.php');
427
-        }
428
-        do_action('AHEE__EE_Front_Controller__display_errors__end');
429
-    }
430
-
431
-
432
-
433
-
434
-
435
-    /***********************************************        UTILITIES         ***********************************************/
436
-    /**
437
-     *    template_include
438
-     *
439
-     * @access    public
440
-     * @param   string $template_include_path
441
-     * @return    string
442
-     */
443
-    public function template_include($template_include_path = null)
444
-    {
445
-        if ($this->Request_Handler->is_espresso_page()) {
446
-            $this->_template_path = ! empty($this->_template_path)
447
-                ? basename($this->_template_path)
448
-                : basename(
449
-                    $template_include_path
450
-                );
451
-            $template_path = EEH_Template::locate_template($this->_template_path, array(), false);
452
-            $this->_template_path = ! empty($template_path) ? $template_path : $template_include_path;
453
-            $this->_template = basename($this->_template_path);
454
-            return $this->_template_path;
455
-        }
456
-        return $template_include_path;
457
-    }
458
-
459
-
460
-    /**
461
-     *    get_selected_template
462
-     *
463
-     * @access    public
464
-     * @param bool $with_path
465
-     * @return    string
466
-     */
467
-    public function get_selected_template($with_path = false)
468
-    {
469
-        return $with_path ? $this->_template_path : $this->_template;
470
-    }
471
-
472
-
473
-    /**
474
-     * @deprecated 4.9.26
475
-     * @param string $shortcode_class
476
-     * @param \WP    $wp
477
-     */
478
-    public function initialize_shortcode($shortcode_class = '', WP $wp = null)
479
-    {
480
-        \EE_Error::doing_it_wrong(
481
-            __METHOD__,
482
-            __(
483
-                'Usage is deprecated. Please use \EventEspresso\core\services\shortcodes\LegacyShortcodesManager::initializeShortcode() instead.',
484
-                'event_espresso'
485
-            ),
486
-            '4.9.26'
487
-        );
488
-        $this->getLegacyShortcodesManager()->initializeShortcode($shortcode_class, $wp);
489
-    }
490
-
491
-
492
-    /**
493
-     * @return void
494
-     * @deprecated 4.9.57.p
495
-     */
496
-    public function loadPersistentAdminNoticeManager()
497
-    {
498
-    }
29
+	/**
30
+	 * @var string $_template_path
31
+	 */
32
+	private $_template_path;
33
+
34
+	/**
35
+	 * @var string $_template
36
+	 */
37
+	private $_template;
38
+
39
+	/**
40
+	 * @type EE_Registry $Registry
41
+	 */
42
+	protected $Registry;
43
+
44
+	/**
45
+	 * @type EE_Request_Handler $Request_Handler
46
+	 */
47
+	protected $Request_Handler;
48
+
49
+	/**
50
+	 * @type EE_Module_Request_Router $Module_Request_Router
51
+	 */
52
+	protected $Module_Request_Router;
53
+
54
+
55
+	/**
56
+	 *    class constructor
57
+	 *    should fire after shortcode, module, addon, or other plugin's default priority init phases have run
58
+	 *
59
+	 * @access    public
60
+	 * @param \EE_Registry              $Registry
61
+	 * @param \EE_Request_Handler       $Request_Handler
62
+	 * @param \EE_Module_Request_Router $Module_Request_Router
63
+	 */
64
+	public function __construct(
65
+		EE_Registry $Registry,
66
+		EE_Request_Handler $Request_Handler,
67
+		EE_Module_Request_Router $Module_Request_Router
68
+	) {
69
+		$this->Registry = $Registry;
70
+		$this->Request_Handler = $Request_Handler;
71
+		$this->Module_Request_Router = $Module_Request_Router;
72
+		// determine how to integrate WP_Query with the EE models
73
+		add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy'));
74
+		// load other resources and begin to actually run shortcodes and modules
75
+		add_action('wp_loaded', array($this, 'wp_loaded'), 5);
76
+		// analyse the incoming WP request
77
+		add_action('parse_request', array($this, 'get_request'), 1, 1);
78
+		// process request with module factory
79
+		add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1);
80
+		// before headers sent
81
+		add_action('wp', array($this, 'wp'), 5);
82
+		// primarily used to process any content shortcodes
83
+		add_action('template_redirect', array($this, 'templateRedirect'), 999);
84
+		// header
85
+		add_action('wp_head', array($this, 'header_meta_tag'), 5);
86
+		add_action('wp_print_scripts', array($this, 'wp_print_scripts'), 10);
87
+		add_filter('template_include', array($this, 'template_include'), 1);
88
+		// display errors
89
+		add_action('loop_start', array($this, 'display_errors'), 2);
90
+		// the content
91
+		// add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 );
92
+		// exclude our private cpt comments
93
+		add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1);
94
+		// make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://)
95
+		add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1);
96
+		// action hook EE
97
+		do_action('AHEE__EE_Front_Controller__construct__done', $this);
98
+	}
99
+
100
+
101
+	/**
102
+	 * @return EE_Request_Handler
103
+	 */
104
+	public function Request_Handler()
105
+	{
106
+		return $this->Request_Handler;
107
+	}
108
+
109
+
110
+	/**
111
+	 * @return EE_Module_Request_Router
112
+	 */
113
+	public function Module_Request_Router()
114
+	{
115
+		return $this->Module_Request_Router;
116
+	}
117
+
118
+
119
+	/**
120
+	 * @return LegacyShortcodesManager
121
+	 */
122
+	public function getLegacyShortcodesManager()
123
+	{
124
+		return EE_Config::getLegacyShortcodesManager();
125
+	}
126
+
127
+
128
+
129
+
130
+
131
+	/***********************************************        INIT ACTION HOOK         ***********************************************/
132
+	/**
133
+	 * filter_wp_comments
134
+	 * This simply makes sure that any "private" EE CPTs do not have their comments show up in any wp comment
135
+	 * widgets/queries done on frontend
136
+	 *
137
+	 * @param  array $clauses array of comment clauses setup by WP_Comment_Query
138
+	 * @return array array of comment clauses with modifications.
139
+	 * @throws InvalidArgumentException
140
+	 * @throws InvalidDataTypeException
141
+	 * @throws InvalidInterfaceException
142
+	 */
143
+	public function filter_wp_comments($clauses)
144
+	{
145
+		global $wpdb;
146
+		if (strpos($clauses['join'], $wpdb->posts) !== false) {
147
+			/** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_types */
148
+			$custom_post_types = LoaderFactory::getLoader()->getShared(
149
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'
150
+			);
151
+			$cpts = $custom_post_types->getPrivateCustomPostTypes();
152
+			foreach ($cpts as $cpt => $details) {
153
+				$clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt);
154
+			}
155
+		}
156
+		return $clauses;
157
+	}
158
+
159
+
160
+	/**
161
+	 * @return void
162
+	 * @throws InvalidArgumentException
163
+	 * @throws InvalidDataTypeException
164
+	 * @throws InvalidInterfaceException
165
+	 */
166
+	public function employ_CPT_Strategy()
167
+	{
168
+		if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) {
169
+			LoaderFactory::getLoader()->getShared('EE_CPT_Strategy');
170
+		}
171
+	}
172
+
173
+
174
+	/**
175
+	 * this just makes sure that if the site is using ssl that we force that for any admin ajax calls from frontend
176
+	 *
177
+	 * @param  string $url incoming url
178
+	 * @return string         final assembled url
179
+	 */
180
+	public function maybe_force_admin_ajax_ssl($url)
181
+	{
182
+		if (is_ssl() && preg_match('/admin-ajax.php/', $url)) {
183
+			$url = str_replace('http://', 'https://', $url);
184
+		}
185
+		return $url;
186
+	}
187
+
188
+
189
+
190
+
191
+
192
+
193
+	/***********************************************        WP_LOADED ACTION HOOK         ***********************************************/
194
+
195
+
196
+	/**
197
+	 *    wp_loaded - should fire after shortcode, module, addon, or other plugin's have been registered and their
198
+	 *    default priority init phases have run
199
+	 *
200
+	 * @access    public
201
+	 * @return    void
202
+	 */
203
+	public function wp_loaded()
204
+	{
205
+	}
206
+
207
+
208
+
209
+
210
+
211
+	/***********************************************        PARSE_REQUEST HOOK         ***********************************************/
212
+	/**
213
+	 *    _get_request
214
+	 *
215
+	 * @access public
216
+	 * @param WP $WP
217
+	 * @return void
218
+	 */
219
+	public function get_request(WP $WP)
220
+	{
221
+		do_action('AHEE__EE_Front_Controller__get_request__start');
222
+		$this->Request_Handler->parse_request($WP);
223
+		do_action('AHEE__EE_Front_Controller__get_request__complete');
224
+	}
225
+
226
+
227
+	/**
228
+	 *    pre_get_posts - basically a module factory for instantiating modules and selecting the final view template
229
+	 *
230
+	 * @access    public
231
+	 * @param   WP_Query $WP_Query
232
+	 * @return    void
233
+	 */
234
+	public function pre_get_posts($WP_Query)
235
+	{
236
+		// only load Module_Request_Router if this is the main query
237
+		if ($this->Module_Request_Router instanceof EE_Module_Request_Router
238
+			&& $WP_Query->is_main_query()
239
+		) {
240
+			// cycle thru module routes
241
+			while ($route = $this->Module_Request_Router->get_route($WP_Query)) {
242
+				// determine module and method for route
243
+				$module = $this->Module_Request_Router->resolve_route($route[0], $route[1]);
244
+				if ($module instanceof EED_Module) {
245
+					// get registered view for route
246
+					$this->_template_path = $this->Module_Request_Router->get_view($route);
247
+					// grab module name
248
+					$module_name = $module->module_name();
249
+					// map the module to the module objects
250
+					$this->Registry->modules->{$module_name} = $module;
251
+				}
252
+			}
253
+		}
254
+	}
255
+
256
+
257
+
258
+
259
+
260
+	/***********************************************        WP HOOK         ***********************************************/
261
+
262
+
263
+	/**
264
+	 *    wp - basically last chance to do stuff before headers sent
265
+	 *
266
+	 * @access    public
267
+	 * @return    void
268
+	 */
269
+	public function wp()
270
+	{
271
+	}
272
+
273
+
274
+
275
+	/***********************     GET_HEADER && WP_HEAD HOOK     ***********************/
276
+
277
+
278
+	/**
279
+	 * callback for the "template_redirect" hook point
280
+	 * checks sidebars for EE widgets
281
+	 * loads resources and assets accordingly
282
+	 *
283
+	 * @return void
284
+	 */
285
+	public function templateRedirect()
286
+	{
287
+		global $wp_query;
288
+		if (empty($wp_query->posts)) {
289
+			return;
290
+		}
291
+		// if we already know this is an espresso page, then load assets
292
+		$load_assets = $this->Request_Handler->is_espresso_page();
293
+		// if we are already loading assets then just move along, otherwise check for widgets
294
+		$load_assets = $load_assets ? $load_assets : $this->espresso_widgets_in_active_sidebars();
295
+		if ($load_assets) {
296
+			add_action('wp_enqueue_scripts', array($this, 'enqueueStyle'), 10);
297
+			add_action('wp_print_footer_scripts', array($this, 'enqueueScripts'), 10);
298
+		}
299
+	}
300
+
301
+
302
+	/**
303
+	 * builds list of active widgets then scans active sidebars looking for them
304
+	 * returns true is an EE widget is found in an active sidebar
305
+	 * Please Note: this does NOT mean that the sidebar or widget
306
+	 * is actually in use in a given template, as that is unfortunately not known
307
+	 * until a sidebar and it's widgets are actually loaded
308
+	 *
309
+	 * @return boolean
310
+	 */
311
+	private function espresso_widgets_in_active_sidebars()
312
+	{
313
+		$espresso_widgets = array();
314
+		foreach ($this->Registry->widgets as $widget_class => $widget) {
315
+			$id_base = EspressoWidget::getIdBase($widget_class);
316
+			if (is_active_widget(false, false, $id_base)) {
317
+				$espresso_widgets[] = $id_base;
318
+			}
319
+		}
320
+		$all_sidebar_widgets = wp_get_sidebars_widgets();
321
+		foreach ($all_sidebar_widgets as $sidebar_name => $sidebar_widgets) {
322
+			if (is_array($sidebar_widgets) && ! empty($sidebar_widgets)) {
323
+				foreach ($sidebar_widgets as $sidebar_widget) {
324
+					foreach ($espresso_widgets as $espresso_widget) {
325
+						if (strpos($sidebar_widget, $espresso_widget) !== false) {
326
+							return true;
327
+						}
328
+					}
329
+				}
330
+			}
331
+		}
332
+		return false;
333
+	}
334
+
335
+
336
+	/**
337
+	 *    header_meta_tag
338
+	 *
339
+	 * @access    public
340
+	 * @return    void
341
+	 */
342
+	public function header_meta_tag()
343
+	{
344
+		print(
345
+		apply_filters(
346
+			'FHEE__EE_Front_Controller__header_meta_tag',
347
+			'<meta name="generator" content="Event Espresso Version ' . EVENT_ESPRESSO_VERSION . "\" />\n"
348
+		)
349
+		);
350
+
351
+		// let's exclude all event type taxonomy term archive pages from search engine indexing
352
+		// @see https://events.codebasehq.com/projects/event-espresso/tickets/10249
353
+		// also exclude all critical pages from indexing
354
+		if ((
355
+				is_tax('espresso_event_type')
356
+				&& get_option('blog_public') !== '0'
357
+			)
358
+			|| is_page(EE_Registry::instance()->CFG->core->get_critical_pages_array())
359
+		) {
360
+			print(
361
+			apply_filters(
362
+				'FHEE__EE_Front_Controller__header_meta_tag__noindex_for_event_type',
363
+				'<meta name="robots" content="noindex,follow" />' . "\n"
364
+			)
365
+			);
366
+		}
367
+	}
368
+
369
+
370
+	/**
371
+	 * wp_print_scripts
372
+	 *
373
+	 * @return void
374
+	 */
375
+	public function wp_print_scripts()
376
+	{
377
+		global $post;
378
+		if (isset($post->EE_Event)
379
+			&& $post->EE_Event instanceof EE_Event
380
+			&& get_post_type() === 'espresso_events'
381
+			&& is_singular()
382
+		) {
383
+			\EEH_Schema::add_json_linked_data_for_event($post->EE_Event);
384
+		}
385
+	}
386
+
387
+
388
+	public function enqueueStyle()
389
+	{
390
+		wp_enqueue_style('espresso_default');
391
+		wp_enqueue_style('espresso_custom_css');
392
+	}
393
+
394
+
395
+
396
+	/***********************************************        WP_FOOTER         ***********************************************/
397
+
398
+
399
+	public function enqueueScripts()
400
+	{
401
+		wp_enqueue_script('espresso_core');
402
+	}
403
+
404
+
405
+	/**
406
+	 * display_errors
407
+	 *
408
+	 * @access public
409
+	 * @return void
410
+	 * @throws DomainException
411
+	 */
412
+	public function display_errors()
413
+	{
414
+		static $shown_already = false;
415
+		do_action('AHEE__EE_Front_Controller__display_errors__begin');
416
+		if (! $shown_already
417
+			&& apply_filters('FHEE__EE_Front_Controller__display_errors', true)
418
+			&& is_main_query()
419
+			&& ! is_feed()
420
+			&& in_the_loop()
421
+			&& did_action('wp_head')
422
+			&& $this->Request_Handler->is_espresso_page()
423
+		) {
424
+			echo EE_Error::get_notices();
425
+			$shown_already = true;
426
+			EEH_Template::display_template(EE_TEMPLATES . 'espresso-ajax-notices.template.php');
427
+		}
428
+		do_action('AHEE__EE_Front_Controller__display_errors__end');
429
+	}
430
+
431
+
432
+
433
+
434
+
435
+	/***********************************************        UTILITIES         ***********************************************/
436
+	/**
437
+	 *    template_include
438
+	 *
439
+	 * @access    public
440
+	 * @param   string $template_include_path
441
+	 * @return    string
442
+	 */
443
+	public function template_include($template_include_path = null)
444
+	{
445
+		if ($this->Request_Handler->is_espresso_page()) {
446
+			$this->_template_path = ! empty($this->_template_path)
447
+				? basename($this->_template_path)
448
+				: basename(
449
+					$template_include_path
450
+				);
451
+			$template_path = EEH_Template::locate_template($this->_template_path, array(), false);
452
+			$this->_template_path = ! empty($template_path) ? $template_path : $template_include_path;
453
+			$this->_template = basename($this->_template_path);
454
+			return $this->_template_path;
455
+		}
456
+		return $template_include_path;
457
+	}
458
+
459
+
460
+	/**
461
+	 *    get_selected_template
462
+	 *
463
+	 * @access    public
464
+	 * @param bool $with_path
465
+	 * @return    string
466
+	 */
467
+	public function get_selected_template($with_path = false)
468
+	{
469
+		return $with_path ? $this->_template_path : $this->_template;
470
+	}
471
+
472
+
473
+	/**
474
+	 * @deprecated 4.9.26
475
+	 * @param string $shortcode_class
476
+	 * @param \WP    $wp
477
+	 */
478
+	public function initialize_shortcode($shortcode_class = '', WP $wp = null)
479
+	{
480
+		\EE_Error::doing_it_wrong(
481
+			__METHOD__,
482
+			__(
483
+				'Usage is deprecated. Please use \EventEspresso\core\services\shortcodes\LegacyShortcodesManager::initializeShortcode() instead.',
484
+				'event_espresso'
485
+			),
486
+			'4.9.26'
487
+		);
488
+		$this->getLegacyShortcodesManager()->initializeShortcode($shortcode_class, $wp);
489
+	}
490
+
491
+
492
+	/**
493
+	 * @return void
494
+	 * @deprecated 4.9.57.p
495
+	 */
496
+	public function loadPersistentAdminNoticeManager()
497
+	{
498
+	}
499 499
 }
Please login to merge, or discard this patch.
core/EE_Psr4AutoloaderInit.core.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -17,38 +17,38 @@
 block discarded – undo
17 17
 {
18 18
 
19 19
 
20
-    /**
21
-     * @type \EventEspresso\core\Psr4Autoloader
22
-     */
23
-    protected static $psr4_loader;
24
-
25
-
26
-    /**
27
-     * @return \EventEspresso\core\Psr4Autoloader
28
-     */
29
-    public function initializeAutoloader()
30
-    {
31
-        static $initialized = false;
32
-        if (! $initialized) {
33
-            // instantiate PSR4 autoloader
34
-            espresso_load_required('Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php');
35
-            EE_Psr4AutoloaderInit::$psr4_loader = new Psr4Autoloader();
36
-            // register the autoloader
37
-            EE_Psr4AutoloaderInit::$psr4_loader->register();
38
-            // register the base directories for the namespace prefix
39
-            EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH);
40
-            EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES . 'batch');
41
-            EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoVendor', EE_THIRD_PARTY);
42
-            $initialized = true;
43
-        }
44
-    }
45
-
46
-
47
-    /**
48
-     * @return \EventEspresso\core\Psr4Autoloader
49
-     */
50
-    public static function psr4_loader()
51
-    {
52
-        return self::$psr4_loader;
53
-    }
20
+	/**
21
+	 * @type \EventEspresso\core\Psr4Autoloader
22
+	 */
23
+	protected static $psr4_loader;
24
+
25
+
26
+	/**
27
+	 * @return \EventEspresso\core\Psr4Autoloader
28
+	 */
29
+	public function initializeAutoloader()
30
+	{
31
+		static $initialized = false;
32
+		if (! $initialized) {
33
+			// instantiate PSR4 autoloader
34
+			espresso_load_required('Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php');
35
+			EE_Psr4AutoloaderInit::$psr4_loader = new Psr4Autoloader();
36
+			// register the autoloader
37
+			EE_Psr4AutoloaderInit::$psr4_loader->register();
38
+			// register the base directories for the namespace prefix
39
+			EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH);
40
+			EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES . 'batch');
41
+			EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoVendor', EE_THIRD_PARTY);
42
+			$initialized = true;
43
+		}
44
+	}
45
+
46
+
47
+	/**
48
+	 * @return \EventEspresso\core\Psr4Autoloader
49
+	 */
50
+	public static function psr4_loader()
51
+	{
52
+		return self::$psr4_loader;
53
+	}
54 54
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@
 block discarded – undo
29 29
     public function initializeAutoloader()
30 30
     {
31 31
         static $initialized = false;
32
-        if (! $initialized) {
32
+        if ( ! $initialized) {
33 33
             // instantiate PSR4 autoloader
34
-            espresso_load_required('Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php');
34
+            espresso_load_required('Psr4Autoloader', EE_CORE.'Psr4Autoloader.php');
35 35
             EE_Psr4AutoloaderInit::$psr4_loader = new Psr4Autoloader();
36 36
             // register the autoloader
37 37
             EE_Psr4AutoloaderInit::$psr4_loader->register();
38 38
             // register the base directories for the namespace prefix
39 39
             EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH);
40
-            EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES . 'batch');
40
+            EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES.'batch');
41 41
             EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoVendor', EE_THIRD_PARTY);
42 42
             $initialized = true;
43 43
         }
Please login to merge, or discard this patch.
core/EE_Object_Repository.core.php 1 patch
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -16,98 +16,98 @@
 block discarded – undo
16 16
 abstract class EE_Object_Repository extends EE_Object_Collection implements EEI_Repository
17 17
 {
18 18
 
19
-    /**
20
-     * default persist method called on repository objects if none supplied
21
-     *
22
-     * @type string $persist_method
23
-     */
24
-    protected $persist_method;
19
+	/**
20
+	 * default persist method called on repository objects if none supplied
21
+	 *
22
+	 * @type string $persist_method
23
+	 */
24
+	protected $persist_method;
25 25
 
26 26
 
27
-    /**
28
-     * _call_user_func_array_on_current
29
-     *
30
-     * calls the supplied callback method name on the current repository object,
31
-     * an array of arguments can also be supplied that will be passed along to the callback method,
32
-     * where each element of the $arguments array corresponds to a parameter for the callback method
33
-     * PLZ NOTE: if the first argument of the callback requires an array, for example array( 'key' => 'value' )
34
-     * then $arguments needs to be a DOUBLE array ie: array( array( 'key' => 'value' ) )
35
-     *
36
-     * @access public
37
-     * @param string $callback  name of method found on object to be called.
38
-     * @param array  $arguments arrays of arguments that will be passed to the object's callback method
39
-     * @return bool | int
40
-     */
41
-    protected function _call_user_func_array_on_current($callback = '', $arguments = array())
42
-    {
43
-        if ($callback !== '' && method_exists($this->current(), $callback)) {
44
-            return call_user_func_array(array($this->current(), $callback), $arguments);
45
-        }
46
-        return false;
47
-    }
27
+	/**
28
+	 * _call_user_func_array_on_current
29
+	 *
30
+	 * calls the supplied callback method name on the current repository object,
31
+	 * an array of arguments can also be supplied that will be passed along to the callback method,
32
+	 * where each element of the $arguments array corresponds to a parameter for the callback method
33
+	 * PLZ NOTE: if the first argument of the callback requires an array, for example array( 'key' => 'value' )
34
+	 * then $arguments needs to be a DOUBLE array ie: array( array( 'key' => 'value' ) )
35
+	 *
36
+	 * @access public
37
+	 * @param string $callback  name of method found on object to be called.
38
+	 * @param array  $arguments arrays of arguments that will be passed to the object's callback method
39
+	 * @return bool | int
40
+	 */
41
+	protected function _call_user_func_array_on_current($callback = '', $arguments = array())
42
+	{
43
+		if ($callback !== '' && method_exists($this->current(), $callback)) {
44
+			return call_user_func_array(array($this->current(), $callback), $arguments);
45
+		}
46
+		return false;
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * _call_user_func_on_all
52
-     *
53
-     * calls the supplied callback method name on ALL repository objects,
54
-     *
55
-     * @access public
56
-     * @param string $callback name of method found on repository objects to be called
57
-     * @return bool | int
58
-     */
59
-    protected function _call_user_func_on_all($callback = '')
60
-    {
61
-        $success = true;
62
-        if ($this->valid()) {
63
-            $this->rewind();
64
-            while ($this->valid()) {
65
-                // any negative result will toggle success to false
66
-                $success = $this->_call_user_func_array_on_current($callback) ? $success : false;
67
-                $this->next();
68
-            }
69
-            $this->rewind();
70
-        }
71
-        return $success;
72
-    }
50
+	/**
51
+	 * _call_user_func_on_all
52
+	 *
53
+	 * calls the supplied callback method name on ALL repository objects,
54
+	 *
55
+	 * @access public
56
+	 * @param string $callback name of method found on repository objects to be called
57
+	 * @return bool | int
58
+	 */
59
+	protected function _call_user_func_on_all($callback = '')
60
+	{
61
+		$success = true;
62
+		if ($this->valid()) {
63
+			$this->rewind();
64
+			while ($this->valid()) {
65
+				// any negative result will toggle success to false
66
+				$success = $this->_call_user_func_array_on_current($callback) ? $success : false;
67
+				$this->next();
68
+			}
69
+			$this->rewind();
70
+		}
71
+		return $success;
72
+	}
73 73
 
74 74
 
75
-    /**
76
-     * persist
77
-     *
78
-     * primarily used for saving EE_Base_Class classes to the database,
79
-     * but can be supplied with a "persistence callback" that can be used for classes that are not instances of
80
-     * EE_Base_Class, or for providing alternate ways to persist an object such as session caching, etc... an array of
81
-     * arguments can also be supplied that will be passed along to the object's persistence method
82
-     *
83
-     * @access public
84
-     * @param string $persistence_callback                                    name of method found on object that can
85
-     *                                                                        be used for persisting the object
86
-     *                                                                        defaults to
87
-     *                                                                        EE_Object_Repository::$persist_method
88
-     * @param array  $persistence_arguments                                   arrays of arguments that will be passed
89
-     *                                                                        to the object's persistence method
90
-     * @return bool | int
91
-     */
92
-    public function persist($persistence_callback = '', $persistence_arguments = array())
93
-    {
94
-        $persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method;
95
-        return $this->_call_user_func_array_on_current($persistence_callback, $persistence_arguments);
96
-    }
75
+	/**
76
+	 * persist
77
+	 *
78
+	 * primarily used for saving EE_Base_Class classes to the database,
79
+	 * but can be supplied with a "persistence callback" that can be used for classes that are not instances of
80
+	 * EE_Base_Class, or for providing alternate ways to persist an object such as session caching, etc... an array of
81
+	 * arguments can also be supplied that will be passed along to the object's persistence method
82
+	 *
83
+	 * @access public
84
+	 * @param string $persistence_callback                                    name of method found on object that can
85
+	 *                                                                        be used for persisting the object
86
+	 *                                                                        defaults to
87
+	 *                                                                        EE_Object_Repository::$persist_method
88
+	 * @param array  $persistence_arguments                                   arrays of arguments that will be passed
89
+	 *                                                                        to the object's persistence method
90
+	 * @return bool | int
91
+	 */
92
+	public function persist($persistence_callback = '', $persistence_arguments = array())
93
+	{
94
+		$persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method;
95
+		return $this->_call_user_func_array_on_current($persistence_callback, $persistence_arguments);
96
+	}
97 97
 
98 98
 
99
-    /**
100
-     * persist_all
101
-     *
102
-     * calls \EE_Object_Repository::persist() on all objects within the repository
103
-     *
104
-     * @access public
105
-     * @param string $persistence_callback name of method found on object that can be used for persisting the object
106
-     * @return bool | int
107
-     */
108
-    public function persist_all($persistence_callback = '')
109
-    {
110
-        $persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method;
111
-        return $this->_call_user_func_on_all($persistence_callback);
112
-    }
99
+	/**
100
+	 * persist_all
101
+	 *
102
+	 * calls \EE_Object_Repository::persist() on all objects within the repository
103
+	 *
104
+	 * @access public
105
+	 * @param string $persistence_callback name of method found on object that can be used for persisting the object
106
+	 * @return bool | int
107
+	 */
108
+	public function persist_all($persistence_callback = '')
109
+	{
110
+		$persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method;
111
+		return $this->_call_user_func_on_all($persistence_callback);
112
+	}
113 113
 }
Please login to merge, or discard this patch.
core/EED_Module.module.php 2 patches
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -12,110 +12,110 @@
 block discarded – undo
12 12
 abstract class EED_Module extends EE_Configurable implements ResettableInterface
13 13
 {
14 14
 
15
-    /**
16
-     * rendered output to be returned to WP
17
-     *
18
-     * @var    string $output
19
-     */
20
-    protected $output = '';
21
-
22
-    /**
23
-     * the current active espresso template theme
24
-     *
25
-     * @var    string $theme
26
-     */
27
-    protected $theme = '';
28
-
29
-
30
-    /**
31
-     * @return void
32
-     */
33
-    public static function reset()
34
-    {
35
-        $module_name = get_called_class();
36
-        new $module_name();
37
-    }
38
-
39
-
40
-    /**
41
-     *    set_hooks - for hooking into EE Core, other modules, etc
42
-     *
43
-     * @access    public
44
-     * @return    void
45
-     */
46
-    public static function set_hooks()
47
-    {
48
-    }
49
-
50
-
51
-    /**
52
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
53
-     *
54
-     * @access    public
55
-     * @return    void
56
-     */
57
-    public static function set_hooks_admin()
58
-    {
59
-    }
60
-
61
-
62
-    /**
63
-     *    run - initial module setup
64
-     *    this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters
65
-     *
66
-     * @access    public
67
-     * @var            WP $WP
68
-     * @return    void
69
-     */
70
-    abstract public function run($WP);
71
-
72
-
73
-    /**
74
-     * EED_Module constructor.
75
-     */
76
-    final public function __construct()
77
-    {
78
-        $this->theme = EE_Config::get_current_theme();
79
-        $module_name = $this->module_name();
80
-        EE_Registry::instance()->modules->{$module_name} = $this;
81
-    }
82
-
83
-
84
-    /**
85
-     * @param $module_name
86
-     * @return EED_Module
87
-     */
88
-    protected static function get_instance($module_name = '')
89
-    {
90
-        $module_name = ! empty($module_name)
91
-            ? $module_name
92
-            : get_called_class();
93
-        if (! isset(EE_Registry::instance()->modules->{$module_name})
94
-            || ! EE_Registry::instance()->modules->{$module_name} instanceof EED_Module
95
-        ) {
96
-            EE_Registry::instance()->add_module($module_name);
97
-        }
98
-        return EE_Registry::instance()->get_module($module_name);
99
-    }
100
-
101
-
102
-    /**
103
-     *    module_name
104
-     *
105
-     * @access    public
106
-     * @return    string
107
-     */
108
-    public function module_name()
109
-    {
110
-        return get_class($this);
111
-    }
112
-
113
-
114
-    /**
115
-     * @return string
116
-     */
117
-    public function theme()
118
-    {
119
-        return $this->theme;
120
-    }
15
+	/**
16
+	 * rendered output to be returned to WP
17
+	 *
18
+	 * @var    string $output
19
+	 */
20
+	protected $output = '';
21
+
22
+	/**
23
+	 * the current active espresso template theme
24
+	 *
25
+	 * @var    string $theme
26
+	 */
27
+	protected $theme = '';
28
+
29
+
30
+	/**
31
+	 * @return void
32
+	 */
33
+	public static function reset()
34
+	{
35
+		$module_name = get_called_class();
36
+		new $module_name();
37
+	}
38
+
39
+
40
+	/**
41
+	 *    set_hooks - for hooking into EE Core, other modules, etc
42
+	 *
43
+	 * @access    public
44
+	 * @return    void
45
+	 */
46
+	public static function set_hooks()
47
+	{
48
+	}
49
+
50
+
51
+	/**
52
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
53
+	 *
54
+	 * @access    public
55
+	 * @return    void
56
+	 */
57
+	public static function set_hooks_admin()
58
+	{
59
+	}
60
+
61
+
62
+	/**
63
+	 *    run - initial module setup
64
+	 *    this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters
65
+	 *
66
+	 * @access    public
67
+	 * @var            WP $WP
68
+	 * @return    void
69
+	 */
70
+	abstract public function run($WP);
71
+
72
+
73
+	/**
74
+	 * EED_Module constructor.
75
+	 */
76
+	final public function __construct()
77
+	{
78
+		$this->theme = EE_Config::get_current_theme();
79
+		$module_name = $this->module_name();
80
+		EE_Registry::instance()->modules->{$module_name} = $this;
81
+	}
82
+
83
+
84
+	/**
85
+	 * @param $module_name
86
+	 * @return EED_Module
87
+	 */
88
+	protected static function get_instance($module_name = '')
89
+	{
90
+		$module_name = ! empty($module_name)
91
+			? $module_name
92
+			: get_called_class();
93
+		if (! isset(EE_Registry::instance()->modules->{$module_name})
94
+			|| ! EE_Registry::instance()->modules->{$module_name} instanceof EED_Module
95
+		) {
96
+			EE_Registry::instance()->add_module($module_name);
97
+		}
98
+		return EE_Registry::instance()->get_module($module_name);
99
+	}
100
+
101
+
102
+	/**
103
+	 *    module_name
104
+	 *
105
+	 * @access    public
106
+	 * @return    string
107
+	 */
108
+	public function module_name()
109
+	{
110
+		return get_class($this);
111
+	}
112
+
113
+
114
+	/**
115
+	 * @return string
116
+	 */
117
+	public function theme()
118
+	{
119
+		return $this->theme;
120
+	}
121 121
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
         $module_name = ! empty($module_name)
91 91
             ? $module_name
92 92
             : get_called_class();
93
-        if (! isset(EE_Registry::instance()->modules->{$module_name})
93
+        if ( ! isset(EE_Registry::instance()->modules->{$module_name})
94 94
             || ! EE_Registry::instance()->modules->{$module_name} instanceof EED_Module
95 95
         ) {
96 96
             EE_Registry::instance()->add_module($module_name);
Please login to merge, or discard this patch.