Completed
Branch dependabot/composer/jaybizzle/... (2225bb)
by
unknown
04:46 queued 19s
created
core/data_migration_scripts/EE_DMS_Core_4_9_0.dms.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
 // unfortunately, this needs to be done upon INCLUSION of this file,
10 10
 // instead of construction, because it only gets constructed on first page load
11 11
 // (all other times it gets resurrected from a wordpress option)
12
-$stages = glob(EE_CORE . 'data_migration_scripts/4_9_0_stages/*');
12
+$stages = glob(EE_CORE.'data_migration_scripts/4_9_0_stages/*');
13 13
 $class_to_filepath = array();
14 14
 foreach ($stages as $filepath) {
15 15
     $matches = array();
16 16
     preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches);
17
-    $class_to_filepath[ $matches[1] ] = $filepath;
17
+    $class_to_filepath[$matches[1]] = $filepath;
18 18
 }
19 19
 // give addons a chance to autoload their stages too
20 20
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath);
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
         if (version_compare($version_string, '4.9.0.decaf', '<') && version_compare($version_string, '4.8.0.decaf', '>=')) {
66 66
             //          echo "$version_string can be migrated from";
67 67
             return true;
68
-        } elseif (! $version_string) {
68
+        } elseif ( ! $version_string) {
69 69
             //          echo "no version string provided: $version_string";
70 70
             // no version string provided... this must be pre 4.3
71
-            return false;// changed mind. dont want people thinking they should migrate yet because they cant
71
+            return false; // changed mind. dont want people thinking they should migrate yet because they cant
72 72
         } else {
73 73
             //          echo "$version_string doesnt apply";
74 74
             return false;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function schema_changes_before_migration()
84 84
     {
85
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
85
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
86 86
         $now_in_mysql = current_time('mysql', true);
87 87
         $table_name = 'esp_answer';
88 88
         $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
Please login to merge, or discard this patch.
Indentation   +303 added lines, -303 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 $stages = glob(EE_CORE . 'data_migration_scripts/4_9_0_stages/*');
13 13
 $class_to_filepath = array();
14 14
 foreach ($stages as $filepath) {
15
-    $matches = array();
16
-    preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches);
17
-    $class_to_filepath[ $matches[1] ] = $filepath;
15
+	$matches = array();
16
+	preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches);
17
+	$class_to_filepath[ $matches[1] ] = $filepath;
18 18
 }
19 19
 // give addons a chance to autoload their stages too
20 20
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath);
@@ -33,68 +33,68 @@  discard block
 block discarded – undo
33 33
  */
34 34
 class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base
35 35
 {
36
-    /**
37
-     * return EE_DMS_Core_4_9_0
38
-     *
39
-     * @param TableManager  $table_manager
40
-     * @param TableAnalysis $table_analysis
41
-     */
42
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
43
-    {
44
-        $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.9.0", "event_espresso");
45
-        $this->_priority = 10;
46
-        $this->_migration_stages = array(
47
-            new EE_DMS_4_9_0_Email_System_Question(),
48
-            new EE_DMS_4_9_0_Answers_With_No_Registration(),
49
-        );
50
-        parent::__construct($table_manager, $table_analysis);
51
-    }
36
+	/**
37
+	 * return EE_DMS_Core_4_9_0
38
+	 *
39
+	 * @param TableManager  $table_manager
40
+	 * @param TableAnalysis $table_analysis
41
+	 */
42
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
43
+	{
44
+		$this->_pretty_name = esc_html__("Data Update to Event Espresso 4.9.0", "event_espresso");
45
+		$this->_priority = 10;
46
+		$this->_migration_stages = array(
47
+			new EE_DMS_4_9_0_Email_System_Question(),
48
+			new EE_DMS_4_9_0_Answers_With_No_Registration(),
49
+		);
50
+		parent::__construct($table_manager, $table_analysis);
51
+	}
52 52
 
53 53
 
54 54
 
55
-    /**
56
-     * Whether to migrate or not.
57
-     *
58
-     * @param array $version_array
59
-     * @return bool
60
-     */
61
-    public function can_migrate_from_version($version_array)
62
-    {
63
-        $version_string = $version_array['Core'];
64
-        if (version_compare($version_string, '4.9.0.decaf', '<') && version_compare($version_string, '4.8.0.decaf', '>=')) {
65
-            //          echo "$version_string can be migrated from";
66
-            return true;
67
-        } elseif (! $version_string) {
68
-            //          echo "no version string provided: $version_string";
69
-            // no version string provided... this must be pre 4.3
70
-            return false;// changed mind. dont want people thinking they should migrate yet because they cant
71
-        } else {
72
-            //          echo "$version_string doesnt apply";
73
-            return false;
74
-        }
75
-    }
55
+	/**
56
+	 * Whether to migrate or not.
57
+	 *
58
+	 * @param array $version_array
59
+	 * @return bool
60
+	 */
61
+	public function can_migrate_from_version($version_array)
62
+	{
63
+		$version_string = $version_array['Core'];
64
+		if (version_compare($version_string, '4.9.0.decaf', '<') && version_compare($version_string, '4.8.0.decaf', '>=')) {
65
+			//          echo "$version_string can be migrated from";
66
+			return true;
67
+		} elseif (! $version_string) {
68
+			//          echo "no version string provided: $version_string";
69
+			// no version string provided... this must be pre 4.3
70
+			return false;// changed mind. dont want people thinking they should migrate yet because they cant
71
+		} else {
72
+			//          echo "$version_string doesnt apply";
73
+			return false;
74
+		}
75
+	}
76 76
 
77 77
 
78 78
 
79
-    /**
80
-     * @return bool
81
-     */
82
-    public function schema_changes_before_migration()
83
-    {
84
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
85
-        $now_in_mysql = current_time('mysql', true);
86
-        $table_name = 'esp_answer';
87
-        $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
79
+	/**
80
+	 * @return bool
81
+	 */
82
+	public function schema_changes_before_migration()
83
+	{
84
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
85
+		$now_in_mysql = current_time('mysql', true);
86
+		$table_name = 'esp_answer';
87
+		$sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
88 88
 					REG_ID int(10) unsigned NOT NULL,
89 89
 					QST_ID int(10) unsigned NOT NULL,
90 90
 					ANS_value text NOT NULL,
91 91
 					PRIMARY KEY  (ANS_ID),
92 92
 					KEY REG_ID (REG_ID),
93 93
 					KEY QST_ID (QST_ID)";
94
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
95
-        $table_name = 'esp_attendee_meta';
96
-        $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'ATT_email');
97
-        $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
94
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
95
+		$table_name = 'esp_attendee_meta';
96
+		$this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'ATT_email');
97
+		$sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
98 98
 				ATT_ID bigint(20) unsigned NOT NULL,
99 99
 				ATT_fname varchar(45) NOT NULL,
100 100
 				ATT_lname varchar(45) NOT NULL,
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 				KEY ATT_email (ATT_email(191)),
112 112
 				KEY ATT_lname (ATT_lname),
113 113
 				KEY ATT_fname (ATT_fname)";
114
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
115
-        $table_name = 'esp_checkin';
116
-        $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
114
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
115
+		$table_name = 'esp_checkin';
116
+		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
117 117
 				REG_ID int(10) unsigned NOT NULL,
118 118
 				DTT_ID int(10) unsigned NOT NULL,
119 119
 				CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 				PRIMARY KEY  (CHK_ID),
122 122
 				KEY REG_ID (REG_ID),
123 123
 				KEY DTT_ID (DTT_ID)";
124
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
125
-        $table_name = 'esp_country';
126
-        $sql = "CNT_ISO varchar(2) NOT NULL,
124
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
125
+		$table_name = 'esp_country';
126
+		$sql = "CNT_ISO varchar(2) NOT NULL,
127 127
 				CNT_ISO3 varchar(3) NOT NULL,
128 128
 				RGN_ID tinyint(3) unsigned DEFAULT NULL,
129 129
 				CNT_name varchar(45) NOT NULL,
@@ -139,18 +139,18 @@  discard block
 block discarded – undo
139 139
 				CNT_is_EU tinyint(1) DEFAULT '0',
140 140
 				CNT_active tinyint(1) DEFAULT '0',
141 141
 				PRIMARY KEY  (CNT_ISO)";
142
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
143
-        $table_name = 'esp_currency';
144
-        $sql = "CUR_code varchar(6) NOT NULL,
142
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
143
+		$table_name = 'esp_currency';
144
+		$sql = "CUR_code varchar(6) NOT NULL,
145 145
 				CUR_single varchar(45) DEFAULT 'dollar',
146 146
 				CUR_plural varchar(45) DEFAULT 'dollars',
147 147
 				CUR_sign varchar(45) DEFAULT '$',
148 148
 				CUR_dec_plc varchar(1) NOT NULL DEFAULT '2',
149 149
 				CUR_active tinyint(1) DEFAULT '0',
150 150
 				PRIMARY KEY  (CUR_code)";
151
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
152
-        $table_name = 'esp_datetime';
153
-        $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
151
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
152
+		$table_name = 'esp_datetime';
153
+		$sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
154 154
 				EVT_ID bigint(20) unsigned NOT NULL,
155 155
 				DTT_name varchar(255) NOT NULL DEFAULT '',
156 156
 				DTT_description text NOT NULL,
@@ -167,25 +167,25 @@  discard block
 block discarded – undo
167 167
 				KEY DTT_EVT_start (DTT_EVT_start),
168 168
 				KEY EVT_ID (EVT_ID),
169 169
 				KEY DTT_is_primary (DTT_is_primary)";
170
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
171
-        $table_name = "esp_datetime_ticket";
172
-        $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
170
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
171
+		$table_name = "esp_datetime_ticket";
172
+		$sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
173 173
 				DTT_ID int(10) unsigned NOT NULL,
174 174
 				TKT_ID int(10) unsigned NOT NULL,
175 175
 				PRIMARY KEY  (DTK_ID),
176 176
 				KEY DTT_ID (DTT_ID),
177 177
 				KEY TKT_ID (TKT_ID)";
178
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
179
-        $table_name = 'esp_event_message_template';
180
-        $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
178
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
179
+		$table_name = 'esp_event_message_template';
180
+		$sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
181 181
 				EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0,
182 182
 				GRP_ID int(10) unsigned NOT NULL DEFAULT 0,
183 183
 				PRIMARY KEY  (EMT_ID),
184 184
 				KEY EVT_ID (EVT_ID),
185 185
 				KEY GRP_ID (GRP_ID)";
186
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
187
-        $table_name = 'esp_event_meta';
188
-        $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
186
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
187
+		$table_name = 'esp_event_meta';
188
+		$sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
189 189
 				EVT_ID bigint(20) unsigned NOT NULL,
190 190
 				EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1,
191 191
 				EVT_display_ticket_selector tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -200,34 +200,34 @@  discard block
 block discarded – undo
200 200
 				EVT_donations tinyint(1) NULL,
201 201
 				PRIMARY KEY  (EVTM_ID),
202 202
 				KEY EVT_ID (EVT_ID)";
203
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
204
-        $table_name = 'esp_event_question_group';
205
-        $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
203
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
204
+		$table_name = 'esp_event_question_group';
205
+		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
206 206
 				EVT_ID bigint(20) unsigned NOT NULL,
207 207
 				QSG_ID int(10) unsigned NOT NULL,
208 208
 				EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
209 209
 				PRIMARY KEY  (EQG_ID),
210 210
 				KEY EVT_ID (EVT_ID),
211 211
 				KEY QSG_ID (QSG_ID)";
212
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
213
-        $table_name = 'esp_event_venue';
214
-        $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
212
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
213
+		$table_name = 'esp_event_venue';
214
+		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
215 215
 				EVT_ID bigint(20) unsigned NOT NULL,
216 216
 				VNU_ID bigint(20) unsigned NOT NULL,
217 217
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
218 218
 				PRIMARY KEY  (EVV_ID)";
219
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
220
-        $table_name = 'esp_extra_meta';
221
-        $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
219
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
220
+		$table_name = 'esp_extra_meta';
221
+		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
222 222
 				OBJ_ID int(11) DEFAULT NULL,
223 223
 				EXM_type varchar(45) DEFAULT NULL,
224 224
 				EXM_key varchar(45) DEFAULT NULL,
225 225
 				EXM_value text,
226 226
 				PRIMARY KEY  (EXM_ID),
227 227
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
228
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
229
-        $table_name = 'esp_extra_join';
230
-        $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
228
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
229
+		$table_name = 'esp_extra_join';
230
+		$sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
231 231
 				EXJ_first_model_id varchar(6) NOT NULL,
232 232
 				EXJ_first_model_name varchar(20) NOT NULL,
233 233
 				EXJ_second_model_id varchar(6) NOT NULL,
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
 				PRIMARY KEY  (EXJ_ID),
236 236
 				KEY first_model (EXJ_first_model_name,EXJ_first_model_id),
237 237
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
238
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
239
-        $table_name = 'esp_line_item';
240
-        $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
238
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
239
+		$table_name = 'esp_line_item';
240
+		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
241 241
 				LIN_code varchar(245) NOT NULL DEFAULT '',
242 242
 				TXN_ID int(11) DEFAULT NULL,
243 243
 				LIN_name varchar(245) NOT NULL DEFAULT '',
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
 				KEY txn_type_timestamp (TXN_ID,LIN_type,LIN_timestamp),
259 259
 				KEY txn_obj_id_obj_type (TXN_ID,OBJ_ID,OBJ_type),
260 260
 				KEY obj_id_obj_type (OBJ_ID,OBJ_type)";
261
-        $this->_get_table_manager()->dropIndex('esp_line_item', 'TXN_ID');
262
-        $this->_get_table_manager()->dropIndex('esp_line_item', 'LIN_code');
263
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
264
-        $table_name = 'esp_log';
265
-        $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
261
+		$this->_get_table_manager()->dropIndex('esp_line_item', 'TXN_ID');
262
+		$this->_get_table_manager()->dropIndex('esp_line_item', 'LIN_code');
263
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
264
+		$table_name = 'esp_log';
265
+		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
266 266
 				LOG_time datetime DEFAULT NULL,
267 267
 				OBJ_ID varchar(45) DEFAULT NULL,
268 268
 				OBJ_type varchar(45) DEFAULT NULL,
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
 				KEY LOG_time (LOG_time),
274 274
 				KEY OBJ (OBJ_type,OBJ_ID),
275 275
 				KEY LOG_type (LOG_type)";
276
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
277
-        $table_name = 'esp_message';
278
-        $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_to');
279
-        $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_from');
280
-        $this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_subject');
281
-        $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
276
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
277
+		$table_name = 'esp_message';
278
+		$this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_to');
279
+		$this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_from');
280
+		$this->_get_table_manager()->dropIndexIfSizeNot($table_name, 'MSG_subject');
281
+		$sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
282 282
 				GRP_ID int(10) unsigned NULL,
283 283
 				MSG_token varchar(255) NULL,
284 284
 				TXN_ID int(10) unsigned NULL,
@@ -310,18 +310,18 @@  discard block
 block discarded – undo
310 310
 				KEY STS_ID (STS_ID),
311 311
 				KEY MSG_created (MSG_created),
312 312
 				KEY MSG_modified (MSG_modified)";
313
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
314
-        $table_name = 'esp_message_template';
315
-        $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
313
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
314
+		$table_name = 'esp_message_template';
315
+		$sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
316 316
 				GRP_ID int(10) unsigned NOT NULL,
317 317
 				MTP_context varchar(50) NOT NULL,
318 318
 				MTP_template_field varchar(30) NOT NULL,
319 319
 				MTP_content text NOT NULL,
320 320
 				PRIMARY KEY  (MTP_ID),
321 321
 				KEY GRP_ID (GRP_ID)";
322
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
323
-        $table_name = 'esp_message_template_group';
324
-        $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
322
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
323
+		$table_name = 'esp_message_template_group';
324
+		$sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
325 325
 				MTP_user_id int(10) NOT NULL DEFAULT '1',
326 326
 				MTP_name varchar(245) NOT NULL DEFAULT '',
327 327
 				MTP_description varchar(245) NOT NULL DEFAULT '',
@@ -333,9 +333,9 @@  discard block
 block discarded – undo
333 333
 				MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
334 334
 				PRIMARY KEY  (GRP_ID),
335 335
 				KEY MTP_user_id (MTP_user_id)";
336
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
337
-        $table_name = 'esp_payment';
338
-        $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
336
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
337
+		$table_name = 'esp_payment';
338
+		$sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
339 339
 				TXN_ID int(10) unsigned DEFAULT NULL,
340 340
 				STS_ID varchar(3) DEFAULT NULL,
341 341
 				PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
 				PRIMARY KEY  (PAY_ID),
353 353
 				KEY PAY_timestamp (PAY_timestamp),
354 354
 				KEY TXN_ID (TXN_ID)";
355
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
356
-        $table_name = 'esp_payment_method';
357
-        $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
355
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
356
+		$table_name = 'esp_payment_method';
357
+		$sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
358 358
 				PMD_type varchar(124) DEFAULT NULL,
359 359
 				PMD_name varchar(255) DEFAULT NULL,
360 360
 				PMD_desc text,
@@ -370,24 +370,24 @@  discard block
 block discarded – undo
370 370
 				PRIMARY KEY  (PMD_ID),
371 371
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug),
372 372
 				KEY PMD_type (PMD_type)";
373
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
374
-        $table_name = "esp_ticket_price";
375
-        $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
373
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
374
+		$table_name = "esp_ticket_price";
375
+		$sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
376 376
 				TKT_ID int(10) unsigned NOT NULL,
377 377
 				PRC_ID int(10) unsigned NOT NULL,
378 378
 				PRIMARY KEY  (TKP_ID),
379 379
 				KEY TKT_ID (TKT_ID),
380 380
 				KEY PRC_ID (PRC_ID)";
381
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
382
-        $table_name = "esp_ticket_template";
383
-        $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
381
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
382
+		$table_name = "esp_ticket_template";
383
+		$sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
384 384
 				TTM_name varchar(45) NOT NULL,
385 385
 				TTM_description text,
386 386
 				TTM_file varchar(45),
387 387
 				PRIMARY KEY  (TTM_ID)";
388
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
389
-        $table_name = 'esp_question';
390
-        $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
388
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
389
+		$table_name = 'esp_question';
390
+		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
391 391
 				QST_display_text text NOT NULL,
392 392
 				QST_admin_label varchar(255) NOT NULL,
393 393
 				QST_system varchar(25) DEFAULT NULL,
@@ -401,18 +401,18 @@  discard block
 block discarded – undo
401 401
 				QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
402 402
 				PRIMARY KEY  (QST_ID),
403 403
 				KEY QST_order (QST_order)';
404
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
405
-        $table_name = 'esp_question_group_question';
406
-        $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
404
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
405
+		$table_name = 'esp_question_group_question';
406
+		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
407 407
 				QSG_ID int(10) unsigned NOT NULL,
408 408
 				QST_ID int(10) unsigned NOT NULL,
409 409
 				QGQ_order int(10) unsigned NOT NULL DEFAULT 0,
410 410
 				PRIMARY KEY  (QGQ_ID),
411 411
 				KEY QST_ID (QST_ID),
412 412
 				KEY QSG_ID_order (QSG_ID,QGQ_order)";
413
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
414
-        $table_name = 'esp_question_option';
415
-        $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
413
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
414
+		$table_name = 'esp_question_option';
415
+		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
416 416
 				QSO_value varchar(255) NOT NULL,
417 417
 				QSO_desc text NOT NULL,
418 418
 				QST_ID int(10) unsigned NOT NULL,
@@ -422,9 +422,9 @@  discard block
 block discarded – undo
422 422
 				PRIMARY KEY  (QSO_ID),
423 423
 				KEY QST_ID (QST_ID),
424 424
 				KEY QSO_order (QSO_order)";
425
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
426
-        $table_name = 'esp_registration';
427
-        $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
425
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
426
+		$table_name = 'esp_registration';
427
+		$sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
428 428
 				EVT_ID bigint(20) unsigned NOT NULL,
429 429
 				ATT_ID bigint(20) unsigned NOT NULL,
430 430
 				TXN_ID int(10) unsigned NOT NULL,
@@ -448,18 +448,18 @@  discard block
 block discarded – undo
448 448
 				KEY TKT_ID (TKT_ID),
449 449
 				KEY EVT_ID (EVT_ID),
450 450
 				KEY STS_ID (STS_ID)";
451
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
452
-        $table_name = 'esp_registration_payment';
453
-        $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
451
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
452
+		$table_name = 'esp_registration_payment';
453
+		$sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
454 454
 					  REG_ID int(10) unsigned NOT NULL,
455 455
 					  PAY_ID int(10) unsigned NULL,
456 456
 					  RPY_amount decimal(12,3) NOT NULL DEFAULT '0.00',
457 457
 					  PRIMARY KEY  (RPY_ID),
458 458
 					  KEY REG_ID (REG_ID),
459 459
 					  KEY PAY_ID (PAY_ID)";
460
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
461
-        $table_name = 'esp_state';
462
-        $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
460
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
461
+		$table_name = 'esp_state';
462
+		$sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
463 463
 				CNT_ISO varchar(2) NOT NULL,
464 464
 				STA_abbrev varchar(24) NOT NULL,
465 465
 				STA_name varchar(100) NOT NULL,
@@ -467,9 +467,9 @@  discard block
 block discarded – undo
467 467
 				PRIMARY KEY  (STA_ID),
468 468
 				KEY STA_abbrev (STA_abbrev),
469 469
 				KEY CNT_ISO (CNT_ISO)";
470
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
471
-        $table_name = 'esp_status';
472
-        $sql = "STS_ID varchar(3) NOT NULL,
470
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
471
+		$table_name = 'esp_status';
472
+		$sql = "STS_ID varchar(3) NOT NULL,
473 473
 				STS_code varchar(45) NOT NULL,
474 474
 				STS_type varchar(45) NOT NULL,
475 475
 				STS_can_edit tinyint(1) NOT NULL DEFAULT 0,
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
 				STS_open tinyint(1) NOT NULL DEFAULT 1,
478 478
 				UNIQUE KEY STS_ID_UNIQUE (STS_ID),
479 479
 				KEY STS_type (STS_type)";
480
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
481
-        $table_name = 'esp_transaction';
482
-        $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
480
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
481
+		$table_name = 'esp_transaction';
482
+		$sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
483 483
 				TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
484 484
 				TXN_total decimal(12,3) DEFAULT '0.00',
485 485
 				TXN_paid decimal(12,3) NOT NULL DEFAULT '0.00',
@@ -491,9 +491,9 @@  discard block
 block discarded – undo
491 491
 				PRIMARY KEY  (TXN_ID),
492 492
 				KEY TXN_timestamp (TXN_timestamp),
493 493
 				KEY STS_ID (STS_ID)";
494
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
495
-        $table_name = 'esp_venue_meta';
496
-        $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
494
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
495
+		$table_name = 'esp_venue_meta';
496
+		$sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
497 497
 			VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0,
498 498
 			VNU_address varchar(255) DEFAULT NULL,
499 499
 			VNU_address2 varchar(255) DEFAULT NULL,
@@ -512,10 +512,10 @@  discard block
 block discarded – undo
512 512
 			KEY VNU_ID (VNU_ID),
513 513
 			KEY STA_ID (STA_ID),
514 514
 			KEY CNT_ISO (CNT_ISO)";
515
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
516
-        // modified tables
517
-        $table_name = "esp_price";
518
-        $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
515
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
516
+		// modified tables
517
+		$table_name = "esp_price";
518
+		$sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
519 519
 				PRT_ID tinyint(3) unsigned NOT NULL,
520 520
 				PRC_amount decimal(12,3) NOT NULL DEFAULT '0.00',
521 521
 				PRC_name varchar(245) NOT NULL,
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
 				PRC_parent int(10) unsigned DEFAULT 0,
529 529
 				PRIMARY KEY  (PRC_ID),
530 530
 				KEY PRT_ID (PRT_ID)";
531
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
532
-        $table_name = "esp_price_type";
533
-        $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
531
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
532
+		$table_name = "esp_price_type";
533
+		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
534 534
 				PRT_name varchar(45) NOT NULL,
535 535
 				PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1',
536 536
 				PRT_is_percent tinyint(1) NOT NULL DEFAULT '0',
@@ -539,9 +539,9 @@  discard block
 block discarded – undo
539 539
 				PRT_deleted tinyint(1) NOT NULL DEFAULT '0',
540 540
 				UNIQUE KEY PRT_name_UNIQUE (PRT_name),
541 541
 				PRIMARY KEY  (PRT_ID)";
542
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
543
-        $table_name = "esp_ticket";
544
-        $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
542
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
543
+		$table_name = "esp_ticket";
544
+		$sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
545 545
 				TTM_ID int(10) unsigned NOT NULL,
546 546
 				TKT_name varchar(245) NOT NULL DEFAULT '',
547 547
 				TKT_description text NOT NULL,
@@ -564,9 +564,9 @@  discard block
 block discarded – undo
564 564
 				TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
565 565
 				PRIMARY KEY  (TKT_ID),
566 566
 				KEY TKT_start_date (TKT_start_date)";
567
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
568
-        $table_name = 'esp_question_group';
569
-        $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
567
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
568
+		$table_name = 'esp_question_group';
569
+		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
570 570
 				QSG_name varchar(255) NOT NULL,
571 571
 				QSG_identifier varchar(100) NOT NULL,
572 572
 				QSG_desc text NULL,
@@ -579,165 +579,165 @@  discard block
 block discarded – undo
579 579
 				PRIMARY KEY  (QSG_ID),
580 580
 				UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
581 581
 				KEY QSG_order (QSG_order)';
582
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
583
-        $this->insert_default_data();
584
-        return true;
585
-    }
582
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
583
+		$this->insert_default_data();
584
+		return true;
585
+	}
586 586
 
587
-    /**
588
-     * Inserts default data after parent was called.
589
-     * @since 4.10.0.p
590
-     * @throws EE_Error
591
-     * @throws InvalidArgumentException
592
-     * @throws ReflectionException
593
-     * @throws InvalidDataTypeException
594
-     * @throws InvalidInterfaceException
595
-     */
596
-    public function insert_default_data()
597
-    {
598
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
599
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
600
-        // (because many need to convert old string states to foreign keys into the states table)
601
-        $script_4_1_defaults->insert_default_states();
602
-        $script_4_1_defaults->insert_default_countries();
603
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
604
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
605
-        $script_4_5_defaults->insert_default_price_types();
606
-        $script_4_5_defaults->insert_default_prices();
607
-        $script_4_5_defaults->insert_default_tickets();
608
-        /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
609
-        $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
610
-        $script_4_6_defaults->add_default_admin_only_payments();
611
-        $script_4_6_defaults->insert_default_currencies();
612
-        /** @var EE_DMS_Core_4_8_0 $script_4_8_defaults */
613
-        $script_4_8_defaults = EE_Registry::instance()->load_dms('Core_4_8_0');
614
-        $script_4_8_defaults->verify_new_countries();
615
-        $script_4_8_defaults->verify_new_currencies();
616
-        $this->verify_db_collations();
617
-        $this->verify_db_collations_again();
618
-    }
587
+	/**
588
+	 * Inserts default data after parent was called.
589
+	 * @since 4.10.0.p
590
+	 * @throws EE_Error
591
+	 * @throws InvalidArgumentException
592
+	 * @throws ReflectionException
593
+	 * @throws InvalidDataTypeException
594
+	 * @throws InvalidInterfaceException
595
+	 */
596
+	public function insert_default_data()
597
+	{
598
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
599
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
600
+		// (because many need to convert old string states to foreign keys into the states table)
601
+		$script_4_1_defaults->insert_default_states();
602
+		$script_4_1_defaults->insert_default_countries();
603
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
604
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
605
+		$script_4_5_defaults->insert_default_price_types();
606
+		$script_4_5_defaults->insert_default_prices();
607
+		$script_4_5_defaults->insert_default_tickets();
608
+		/** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
609
+		$script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
610
+		$script_4_6_defaults->add_default_admin_only_payments();
611
+		$script_4_6_defaults->insert_default_currencies();
612
+		/** @var EE_DMS_Core_4_8_0 $script_4_8_defaults */
613
+		$script_4_8_defaults = EE_Registry::instance()->load_dms('Core_4_8_0');
614
+		$script_4_8_defaults->verify_new_countries();
615
+		$script_4_8_defaults->verify_new_currencies();
616
+		$this->verify_db_collations();
617
+		$this->verify_db_collations_again();
618
+	}
619 619
 
620 620
 
621 621
 
622
-    /**
623
-     * @return boolean
624
-     */
625
-    public function schema_changes_after_migration()
626
-    {
627
-        return true;
628
-    }
622
+	/**
623
+	 * @return boolean
624
+	 */
625
+	public function schema_changes_after_migration()
626
+	{
627
+		return true;
628
+	}
629 629
 
630 630
 
631 631
 
632
-    public function migration_page_hooks()
633
-    {
634
-    }
632
+	public function migration_page_hooks()
633
+	{
634
+	}
635 635
 
636 636
 
637 637
 
638
-    /**
639
-     * Verify all EE4 models' tables use utf8mb4 collation
640
-     *
641
-     * @return void
642
-     */
643
-    public function verify_db_collations()
644
-    {
645
-        global $wpdb;
646
-        // double-check we haven't already done it or that that the DB doesn't support utf8mb4
647
-        if (
648
-            'utf8mb4' !== $wpdb->charset
649
-            || get_option('ee_verified_db_collations', false)
650
-        ) {
651
-            return;
652
-        }
653
-        // grab tables from each model
654
-        $tables_to_check = array();
655
-        foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
656
-            if (method_exists($model_name, 'instance')) {
657
-                $model_obj = call_user_func(array($model_name, 'instance'));
658
-                if ($model_obj instanceof EEM_Base) {
659
-                    foreach ($model_obj->get_tables() as $table) {
660
-                        if (
661
-                            strpos($table->get_table_name(), 'esp_')
662
-                            && (is_main_site()// for main tables, verify global tables
663
-                                || ! $table->is_global()// if not the main site, then only verify non-global tables (avoid doubling up)
664
-                            )
665
-                            && function_exists('maybe_convert_table_to_utf8mb4')
666
-                        ) {
667
-                            $tables_to_check[] = $table->get_table_name();
668
-                        }
669
-                    }
670
-                }
671
-            }
672
-        }
673
-        // and let's just be sure these addons' tables get migrated too. They already get handled if their addons are active
674
-        // when this code is run, but not otherwise. Once we record what tables EE added, we'll be able to use that instead
675
-        // of hard-coding this
676
-        $addon_tables = array(
677
-            // mailchimp
678
-            'esp_event_mailchimp_list_group',
679
-            'esp_event_question_mailchimp_field',
680
-            // multisite
681
-            'esp_blog_meta',
682
-            // people
683
-            'esp_people_to_post',
684
-            // promotions
685
-            'esp_promotion',
686
-            'esp_promotion_object',
687
-        );
688
-        foreach ($addon_tables as $table_name) {
689
-                $tables_to_check[] = $table_name;
690
-        }
691
-        $this->_verify_db_collations_for_tables(array_unique($tables_to_check));
692
-        // ok and now let's remember this was done (without needing to check the db schemas all over again)
693
-        add_option('ee_verified_db_collations', true, null, 'no');
694
-        // seeing how this ran with the fix from 10435, no need to check again
695
-        add_option('ee_verified_db_collations_again', true, null, 'no');
696
-    }
638
+	/**
639
+	 * Verify all EE4 models' tables use utf8mb4 collation
640
+	 *
641
+	 * @return void
642
+	 */
643
+	public function verify_db_collations()
644
+	{
645
+		global $wpdb;
646
+		// double-check we haven't already done it or that that the DB doesn't support utf8mb4
647
+		if (
648
+			'utf8mb4' !== $wpdb->charset
649
+			|| get_option('ee_verified_db_collations', false)
650
+		) {
651
+			return;
652
+		}
653
+		// grab tables from each model
654
+		$tables_to_check = array();
655
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
656
+			if (method_exists($model_name, 'instance')) {
657
+				$model_obj = call_user_func(array($model_name, 'instance'));
658
+				if ($model_obj instanceof EEM_Base) {
659
+					foreach ($model_obj->get_tables() as $table) {
660
+						if (
661
+							strpos($table->get_table_name(), 'esp_')
662
+							&& (is_main_site()// for main tables, verify global tables
663
+								|| ! $table->is_global()// if not the main site, then only verify non-global tables (avoid doubling up)
664
+							)
665
+							&& function_exists('maybe_convert_table_to_utf8mb4')
666
+						) {
667
+							$tables_to_check[] = $table->get_table_name();
668
+						}
669
+					}
670
+				}
671
+			}
672
+		}
673
+		// and let's just be sure these addons' tables get migrated too. They already get handled if their addons are active
674
+		// when this code is run, but not otherwise. Once we record what tables EE added, we'll be able to use that instead
675
+		// of hard-coding this
676
+		$addon_tables = array(
677
+			// mailchimp
678
+			'esp_event_mailchimp_list_group',
679
+			'esp_event_question_mailchimp_field',
680
+			// multisite
681
+			'esp_blog_meta',
682
+			// people
683
+			'esp_people_to_post',
684
+			// promotions
685
+			'esp_promotion',
686
+			'esp_promotion_object',
687
+		);
688
+		foreach ($addon_tables as $table_name) {
689
+				$tables_to_check[] = $table_name;
690
+		}
691
+		$this->_verify_db_collations_for_tables(array_unique($tables_to_check));
692
+		// ok and now let's remember this was done (without needing to check the db schemas all over again)
693
+		add_option('ee_verified_db_collations', true, null, 'no');
694
+		// seeing how this ran with the fix from 10435, no need to check again
695
+		add_option('ee_verified_db_collations_again', true, null, 'no');
696
+	}
697 697
 
698 698
 
699 699
 
700
-    /**
701
-     * Verifies DB collations because a bug was discovered on https://events.codebasehq.com/projects/event-espresso/tickets/10435
702
-     * which meant some DB collations might not have been updated
703
-     * @return void
704
-     */
705
-    public function verify_db_collations_again()
706
-    {
707
-        global $wpdb;
708
-        // double-check we haven't already done this or that the DB doesn't support it
709
-        // compare to how WordPress' upgrade_430() function does this check
710
-        if (
711
-            'utf8mb4' !== $wpdb->charset
712
-            || get_option('ee_verified_db_collations_again', false)
713
-        ) {
714
-            return;
715
-        }
716
-        $tables_to_check = array(
717
-            'esp_attendee_meta',
718
-            'esp_message'
719
-        );
720
-        $this->_verify_db_collations_for_tables(array_unique($tables_to_check));
721
-        add_option('ee_verified_db_collations_again', true, null, 'no');
722
-    }
700
+	/**
701
+	 * Verifies DB collations because a bug was discovered on https://events.codebasehq.com/projects/event-espresso/tickets/10435
702
+	 * which meant some DB collations might not have been updated
703
+	 * @return void
704
+	 */
705
+	public function verify_db_collations_again()
706
+	{
707
+		global $wpdb;
708
+		// double-check we haven't already done this or that the DB doesn't support it
709
+		// compare to how WordPress' upgrade_430() function does this check
710
+		if (
711
+			'utf8mb4' !== $wpdb->charset
712
+			|| get_option('ee_verified_db_collations_again', false)
713
+		) {
714
+			return;
715
+		}
716
+		$tables_to_check = array(
717
+			'esp_attendee_meta',
718
+			'esp_message'
719
+		);
720
+		$this->_verify_db_collations_for_tables(array_unique($tables_to_check));
721
+		add_option('ee_verified_db_collations_again', true, null, 'no');
722
+	}
723 723
 
724 724
 
725 725
 
726
-    /**
727
-     * Runs maybe_convert_table_to_utf8mb4 on the specified tables
728
-     * @param $tables_to_check
729
-     * @return boolean true if logic ran, false if it didn't
730
-     */
731
-    protected function _verify_db_collations_for_tables($tables_to_check)
732
-    {
733
-        foreach ($tables_to_check as $table_name) {
734
-            $table_name = $this->_table_analysis->ensureTableNameHasPrefix($table_name);
735
-            if (
736
-                ! apply_filters('FHEE__EE_DMS_Core_4_9_0__verify_db_collations__check_overridden', false, $table_name)
737
-                && $this->_get_table_analysis()->tableExists($table_name)
738
-            ) {
739
-                maybe_convert_table_to_utf8mb4($table_name);
740
-            }
741
-        }
742
-    }
726
+	/**
727
+	 * Runs maybe_convert_table_to_utf8mb4 on the specified tables
728
+	 * @param $tables_to_check
729
+	 * @return boolean true if logic ran, false if it didn't
730
+	 */
731
+	protected function _verify_db_collations_for_tables($tables_to_check)
732
+	{
733
+		foreach ($tables_to_check as $table_name) {
734
+			$table_name = $this->_table_analysis->ensureTableNameHasPrefix($table_name);
735
+			if (
736
+				! apply_filters('FHEE__EE_DMS_Core_4_9_0__verify_db_collations__check_overridden', false, $table_name)
737
+				&& $this->_get_table_analysis()->tableExists($table_name)
738
+			) {
739
+				maybe_convert_table_to_utf8mb4($table_name);
740
+			}
741
+		}
742
+	}
743 743
 }
Please login to merge, or discard this patch.
4_6_0_stages/EE_DMS_4_6_0_invoice_settings.dmsstage.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,8 +66,8 @@
 block discarded – undo
66 66
     {
67 67
 
68 68
         $templates_relative_path = 'modules/gateways/Invoice/lib/templates/';
69
-        $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true);
70
-        $overridden_receipt_body = EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true);
69
+        $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', null, false, false, true);
70
+        $overridden_receipt_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', null, false, false, true);
71 71
         if ($overridden_invoice_body || $overridden_receipt_body) {
72 72
             new PersistentAdminNotice(
73 73
                 'invoice_overriding_templates',
Please login to merge, or discard this patch.
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -27,59 +27,59 @@
 block discarded – undo
27 27
  */
28 28
 class EE_DMS_4_6_0_invoice_settings extends EE_Data_Migration_Script_Stage
29 29
 {
30
-    /**
31
-     * Just initializes the status of the migration
32
-     */
33
-    public function __construct()
34
-    {
35
-        $this->_pretty_name = esc_html__('Update Invoice Settings', 'event_espresso');
36
-        parent::__construct();
37
-    }
30
+	/**
31
+	 * Just initializes the status of the migration
32
+	 */
33
+	public function __construct()
34
+	{
35
+		$this->_pretty_name = esc_html__('Update Invoice Settings', 'event_espresso');
36
+		parent::__construct();
37
+	}
38 38
 
39 39
 
40 40
 
41
-    /**
42
-     * _count_records_to_migrate
43
-     * Counts the records to migrate; the public version may cache it
44
-     *
45
-     * @access protected
46
-     * @return int
47
-     */
48
-    protected function _count_records_to_migrate()
49
-    {
50
-        return 1;
51
-    }
41
+	/**
42
+	 * _count_records_to_migrate
43
+	 * Counts the records to migrate; the public version may cache it
44
+	 *
45
+	 * @access protected
46
+	 * @return int
47
+	 */
48
+	protected function _count_records_to_migrate()
49
+	{
50
+		return 1;
51
+	}
52 52
 
53 53
 
54 54
 
55
-    /**
56
-     *    _migration_step
57
-     *
58
-     * @access protected
59
-     * @param int $num_items
60
-     * @throws EE_Error
61
-     * @return int number of items ACTUALLY migrated
62
-     * @throws InvalidDataTypeException
63
-     */
64
-    protected function _migration_step($num_items = 1)
65
-    {
55
+	/**
56
+	 *    _migration_step
57
+	 *
58
+	 * @access protected
59
+	 * @param int $num_items
60
+	 * @throws EE_Error
61
+	 * @return int number of items ACTUALLY migrated
62
+	 * @throws InvalidDataTypeException
63
+	 */
64
+	protected function _migration_step($num_items = 1)
65
+	{
66 66
 
67
-        $templates_relative_path = 'modules/gateways/Invoice/lib/templates/';
68
-        $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true);
69
-        $overridden_receipt_body = EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true);
70
-        if ($overridden_invoice_body || $overridden_receipt_body) {
71
-            new PersistentAdminNotice(
72
-                'invoice_overriding_templates',
73
-                esc_html__(
74
-                    'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overridden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents (but this will be removed in an upcoming version). We recommend deleting your old Invoice/Receipt templates and using the new messages system. Then modify the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.',
75
-                    'event_espresso'
76
-                ),
77
-                true
78
-            );
79
-        }
67
+		$templates_relative_path = 'modules/gateways/Invoice/lib/templates/';
68
+		$overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true);
69
+		$overridden_receipt_body = EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true);
70
+		if ($overridden_invoice_body || $overridden_receipt_body) {
71
+			new PersistentAdminNotice(
72
+				'invoice_overriding_templates',
73
+				esc_html__(
74
+					'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overridden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents (but this will be removed in an upcoming version). We recommend deleting your old Invoice/Receipt templates and using the new messages system. Then modify the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.',
75
+					'event_espresso'
76
+				),
77
+				true
78
+			);
79
+		}
80 80
 
81
-        // regardless of whether it worked or not, we ought to continue the migration
82
-        $this->set_completed();
83
-        return 1;
84
-    }
81
+		// regardless of whether it worked or not, we ought to continue the migration
82
+		$this->set_completed();
83
+		return 1;
84
+	}
85 85
 }
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Restriction_Generator_Public.strategy.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     protected function _generate_restrictions(): array
20 20
     {
21 21
         // if there are no standard caps for this model, then for allow full access
22
-        if (! $this->model()->cap_slug()) {
22
+        if ( ! $this->model()->cap_slug()) {
23 23
             return [];
24 24
         }
25 25
 
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
             )
33 33
         ) {
34 34
             if ($this->model() instanceof EEM_CPT_Base) {
35
-                $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
35
+                $restrictions[EE_Restriction_Generator_Base::get_cap_name(
36 36
                     $this->model(),
37 37
                     $this->action()
38
-                ) ] = new EE_Default_Where_Conditions(
38
+                )] = new EE_Default_Where_Conditions(
39 39
                     $this->addPublishedPostConditions()
40 40
                 );
41 41
             } elseif ($this->model() instanceof EEM_Soft_Delete_Base) {
42
-                $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
42
+                $restrictions[EE_Restriction_Generator_Base::get_cap_name(
43 43
                     $this->model(),
44 44
                     $this->action()
45
-                ) ] = new EE_Default_Where_Conditions(
45
+                )] = new EE_Default_Where_Conditions(
46 46
                     [$this->model()->deleted_field_name() => false]
47 47
                 );
48 48
             }
@@ -52,21 +52,21 @@  discard block
 block discarded – undo
52 52
             if (
53 53
                 EE_Restriction_Generator_Base::is_cap(
54 54
                     $this->model(),
55
-                    $this->action() . '_others'
55
+                    $this->action().'_others'
56 56
                 )
57 57
             ) {// both caps exist
58 58
                 if ($this->model() instanceof EEM_CPT_Base) {
59 59
                     // then if they don't have the others cap,
60 60
                     // AT MOST show them their own and other published ones
61
-                    $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
61
+                    $restrictions[EE_Restriction_Generator_Base::get_cap_name(
62 62
                         $this->model(),
63
-                        $this->action() . '_others'
64
-                    ) ] = new EE_Default_Where_Conditions(
63
+                        $this->action().'_others'
64
+                    )] = new EE_Default_Where_Conditions(
65 65
                         [
66
-                            'OR*' .
66
+                            'OR*'.
67 67
                             EE_Restriction_Generator_Base::get_cap_name(
68 68
                                 $this->model(),
69
-                                $this->action() . '_others'
69
+                                $this->action().'_others'
70 70
                             ) => $this->addPublishedPostConditions(
71 71
                                 [
72 72
                                     EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
                 } elseif ($this->model() instanceof EEM_Soft_Delete_Base) {
78 78
                     // then if they don't have the other cap,
79 79
                     // AT MOST show them their own or non deleted ones
80
-                    $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
80
+                    $restrictions[EE_Restriction_Generator_Base::get_cap_name(
81 81
                         $this->model(),
82
-                        $this->action() . '_others'
83
-                    ) ] = new EE_Default_Where_Conditions(
82
+                        $this->action().'_others'
83
+                    )] = new EE_Default_Where_Conditions(
84 84
                         [
85
-                            'OR*' .
85
+                            'OR*'.
86 86
                             EE_Restriction_Generator_Base::get_cap_name(
87 87
                                 $this->model(),
88
-                                $this->action() . '_others'
88
+                                $this->action().'_others'
89 89
                             ) => [
90 90
                                 EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
91 91
                                 $this->model()->deleted_field_name(
@@ -101,20 +101,20 @@  discard block
 block discarded – undo
101 101
                 if (
102 102
                     EE_Restriction_Generator_Base::is_cap(
103 103
                         $this->model(),
104
-                        $this->action() . '_private'
104
+                        $this->action().'_private'
105 105
                     ) && $this->model() instanceof EEM_CPT_Base
106 106
                 ) {
107 107
                     // if they have basic and others, but not private,
108 108
                     // restrict them to see theirs and others' that aren't private
109
-                    $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
109
+                    $restrictions[EE_Restriction_Generator_Base::get_cap_name(
110 110
                         $this->model(),
111
-                        $this->action() . '_private'
112
-                    ) ] = new EE_Default_Where_Conditions(
111
+                        $this->action().'_private'
112
+                    )] = new EE_Default_Where_Conditions(
113 113
                         [
114
-                            'OR*' .
114
+                            'OR*'.
115 115
                             EE_Restriction_Generator_Base::get_cap_name(
116 116
                                 $this->model(),
117
-                                $this->action() . '_private'
117
+                                $this->action().'_private'
118 118
                             ) => $this->addPublishedPostConditions(
119 119
                                 [
120 120
                                     EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
Please login to merge, or discard this patch.
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -11,123 +11,123 @@
 block discarded – undo
11 11
  */
12 12
 class EE_Restriction_Generator_Public extends EE_Restriction_Generator_Base
13 13
 {
14
-    /**
15
-     * @return EE_Default_Where_Conditions[]|EE_Return_None_Where_Conditions[]
16
-     * @throws EE_Error
17
-     */
18
-    protected function _generate_restrictions(): array
19
-    {
20
-        // if there are no standard caps for this model, then for allow full access
21
-        if (! $this->model()->cap_slug()) {
22
-            return [];
23
-        }
14
+	/**
15
+	 * @return EE_Default_Where_Conditions[]|EE_Return_None_Where_Conditions[]
16
+	 * @throws EE_Error
17
+	 */
18
+	protected function _generate_restrictions(): array
19
+	{
20
+		// if there are no standard caps for this model, then for allow full access
21
+		if (! $this->model()->cap_slug()) {
22
+			return [];
23
+		}
24 24
 
25
-        $restrictions = [];
26
-        // does the basic cap exist? (eg 'ee_read_registrations')
27
-        if (
28
-            EE_Restriction_Generator_Base::is_cap(
29
-                $this->model(),
30
-                $this->action()
31
-            )
32
-        ) {
33
-            if ($this->model() instanceof EEM_CPT_Base) {
34
-                $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
35
-                    $this->model(),
36
-                    $this->action()
37
-                ) ] = new EE_Default_Where_Conditions(
38
-                    $this->addPublishedPostConditions()
39
-                );
40
-            } elseif ($this->model() instanceof EEM_Soft_Delete_Base) {
41
-                $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
42
-                    $this->model(),
43
-                    $this->action()
44
-                ) ] = new EE_Default_Where_Conditions(
45
-                    [$this->model()->deleted_field_name() => false]
46
-                );
47
-            }
48
-            // don't impose any restrictions if they don't have the basic reading cap
25
+		$restrictions = [];
26
+		// does the basic cap exist? (eg 'ee_read_registrations')
27
+		if (
28
+			EE_Restriction_Generator_Base::is_cap(
29
+				$this->model(),
30
+				$this->action()
31
+			)
32
+		) {
33
+			if ($this->model() instanceof EEM_CPT_Base) {
34
+				$restrictions[ EE_Restriction_Generator_Base::get_cap_name(
35
+					$this->model(),
36
+					$this->action()
37
+				) ] = new EE_Default_Where_Conditions(
38
+					$this->addPublishedPostConditions()
39
+				);
40
+			} elseif ($this->model() instanceof EEM_Soft_Delete_Base) {
41
+				$restrictions[ EE_Restriction_Generator_Base::get_cap_name(
42
+					$this->model(),
43
+					$this->action()
44
+				) ] = new EE_Default_Where_Conditions(
45
+					[$this->model()->deleted_field_name() => false]
46
+				);
47
+			}
48
+			// don't impose any restrictions if they don't have the basic reading cap
49 49
 
50
-            // does the others cap exist? (eg 'ee_read_others_registrations')
51
-            if (
52
-                EE_Restriction_Generator_Base::is_cap(
53
-                    $this->model(),
54
-                    $this->action() . '_others'
55
-                )
56
-            ) {// both caps exist
57
-                if ($this->model() instanceof EEM_CPT_Base) {
58
-                    // then if they don't have the others cap,
59
-                    // AT MOST show them their own and other published ones
60
-                    $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
61
-                        $this->model(),
62
-                        $this->action() . '_others'
63
-                    ) ] = new EE_Default_Where_Conditions(
64
-                        [
65
-                            'OR*' .
66
-                            EE_Restriction_Generator_Base::get_cap_name(
67
-                                $this->model(),
68
-                                $this->action() . '_others'
69
-                            ) => $this->addPublishedPostConditions(
70
-                                [
71
-                                    EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
72
-                                ]
73
-                            ),
74
-                        ]
75
-                    );
76
-                } elseif ($this->model() instanceof EEM_Soft_Delete_Base) {
77
-                    // then if they don't have the other cap,
78
-                    // AT MOST show them their own or non deleted ones
79
-                    $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
80
-                        $this->model(),
81
-                        $this->action() . '_others'
82
-                    ) ] = new EE_Default_Where_Conditions(
83
-                        [
84
-                            'OR*' .
85
-                            EE_Restriction_Generator_Base::get_cap_name(
86
-                                $this->model(),
87
-                                $this->action() . '_others'
88
-                            ) => [
89
-                                EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
90
-                                $this->model()->deleted_field_name(
91
-                                )                                    => false,
92
-                            ],
93
-                        ]
94
-                    );
95
-                }
96
-                // again, if they don't have the others cap,
97
-                // continue showing all because there are no inherently hidden ones
50
+			// does the others cap exist? (eg 'ee_read_others_registrations')
51
+			if (
52
+				EE_Restriction_Generator_Base::is_cap(
53
+					$this->model(),
54
+					$this->action() . '_others'
55
+				)
56
+			) {// both caps exist
57
+				if ($this->model() instanceof EEM_CPT_Base) {
58
+					// then if they don't have the others cap,
59
+					// AT MOST show them their own and other published ones
60
+					$restrictions[ EE_Restriction_Generator_Base::get_cap_name(
61
+						$this->model(),
62
+						$this->action() . '_others'
63
+					) ] = new EE_Default_Where_Conditions(
64
+						[
65
+							'OR*' .
66
+							EE_Restriction_Generator_Base::get_cap_name(
67
+								$this->model(),
68
+								$this->action() . '_others'
69
+							) => $this->addPublishedPostConditions(
70
+								[
71
+									EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
72
+								]
73
+							),
74
+						]
75
+					);
76
+				} elseif ($this->model() instanceof EEM_Soft_Delete_Base) {
77
+					// then if they don't have the other cap,
78
+					// AT MOST show them their own or non deleted ones
79
+					$restrictions[ EE_Restriction_Generator_Base::get_cap_name(
80
+						$this->model(),
81
+						$this->action() . '_others'
82
+					) ] = new EE_Default_Where_Conditions(
83
+						[
84
+							'OR*' .
85
+							EE_Restriction_Generator_Base::get_cap_name(
86
+								$this->model(),
87
+								$this->action() . '_others'
88
+							) => [
89
+								EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
90
+								$this->model()->deleted_field_name(
91
+								)                                    => false,
92
+							],
93
+						]
94
+					);
95
+				}
96
+				// again, if they don't have the others cap,
97
+				// continue showing all because there are no inherently hidden ones
98 98
 
99
-                // does the private cap exist (eg 'ee_read_others_private_events')
100
-                if (
101
-                    EE_Restriction_Generator_Base::is_cap(
102
-                        $this->model(),
103
-                        $this->action() . '_private'
104
-                    ) && $this->model() instanceof EEM_CPT_Base
105
-                ) {
106
-                    // if they have basic and others, but not private,
107
-                    // restrict them to see theirs and others' that aren't private
108
-                    $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
109
-                        $this->model(),
110
-                        $this->action() . '_private'
111
-                    ) ] = new EE_Default_Where_Conditions(
112
-                        [
113
-                            'OR*' .
114
-                            EE_Restriction_Generator_Base::get_cap_name(
115
-                                $this->model(),
116
-                                $this->action() . '_private'
117
-                            ) => $this->addPublishedPostConditions(
118
-                                [
119
-                                    EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
120
-                                ],
121
-                                false
122
-                            ),
123
-                        ]
124
-                    );
125
-                }
126
-            }
127
-        } else {
128
-            // there is no basic cap. So allow full access
129
-            $restrictions = [];
130
-        }
131
-        return $restrictions;
132
-    }
99
+				// does the private cap exist (eg 'ee_read_others_private_events')
100
+				if (
101
+					EE_Restriction_Generator_Base::is_cap(
102
+						$this->model(),
103
+						$this->action() . '_private'
104
+					) && $this->model() instanceof EEM_CPT_Base
105
+				) {
106
+					// if they have basic and others, but not private,
107
+					// restrict them to see theirs and others' that aren't private
108
+					$restrictions[ EE_Restriction_Generator_Base::get_cap_name(
109
+						$this->model(),
110
+						$this->action() . '_private'
111
+					) ] = new EE_Default_Where_Conditions(
112
+						[
113
+							'OR*' .
114
+							EE_Restriction_Generator_Base::get_cap_name(
115
+								$this->model(),
116
+								$this->action() . '_private'
117
+							) => $this->addPublishedPostConditions(
118
+								[
119
+									EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
120
+								],
121
+								false
122
+							),
123
+						]
124
+					);
125
+				}
126
+			}
127
+		} else {
128
+			// there is no basic cap. So allow full access
129
+			$restrictions = [];
130
+		}
131
+		return $restrictions;
132
+	}
133 133
 }
Please login to merge, or discard this patch.
strategies/EE_Restriction_Generator_Default_Protected.strategy.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     public function __construct(string $default_field_name, string $path_to_event_model)
44 44
     {
45 45
         $this->_default_field_name  = $default_field_name;
46
-        $this->_path_to_event_model = rtrim($path_to_event_model, '.') . '.';
46
+        $this->_path_to_event_model = rtrim($path_to_event_model, '.').'.';
47 47
     }
48 48
 
49 49
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
         // if there are no standard caps for this model, then for now
57 57
         // all we know is if they need the default cap to access this
58
-        if (! $this->model()->cap_slug()) {
58
+        if ( ! $this->model()->cap_slug()) {
59 59
             return [
60 60
                 self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions(),
61 61
             ];
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         // if they don't have the "others" default capability,
84 84
         // restrict access to only their default ones, and non-default ones
85 85
         if (EE_Restriction_Generator_Base::is_cap($this->model(), $others_default)) {
86
-            $restrictions[ $this->getCapKey($this->model(), $others_default) ] = $this->othersDefaultRestrictions(
86
+            $restrictions[$this->getCapKey($this->model(), $others_default)] = $this->othersDefaultRestrictions(
87 87
                 $others_default
88 88
             );
89 89
         }
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
             [
127 127
                 // if they don't have the others default cap, they can't access others default items
128 128
                 // (but they can access their own default items, and non-default items)
129
-                'OR*no_' . $this->getCapKey($this->model(), $action) => [
129
+                'OR*no_'.$this->getCapKey($this->model(), $action) => [
130 130
                     'AND'                      => [
131
-                        $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
131
+                        $this->_path_to_event_model.'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
132 132
                         $this->_default_field_name                  => true,
133 133
                     ],
134 134
                     $this->_default_field_name => false,
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
     {
149 149
         return new EE_Default_Where_Conditions(
150 150
             [
151
-                'OR*no_' . $this->getCapKey($event_model, $action) => [
152
-                    $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
151
+                'OR*no_'.$this->getCapKey($event_model, $action) => [
152
+                    $this->_path_to_event_model.'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
153 153
                 ],
154 154
                 $this->_default_field_name                         => true,
155 155
             ]
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
     {
168 168
         return new EE_Default_Where_Conditions(
169 169
             [
170
-                'OR*no_' . $this->getCapKey($event_model, $action) => [
171
-                    $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
172
-                    $this->_path_to_event_model . 'status'      => ['!=', 'private'],
170
+                'OR*no_'.$this->getCapKey($event_model, $action) => [
171
+                    $this->_path_to_event_model.'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
172
+                    $this->_path_to_event_model.'status'      => ['!=', 'private'],
173 173
                     $this->_default_field_name                  => true,
174 174
                 ],
175 175
             ]
Please login to merge, or discard this patch.
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -14,164 +14,164 @@
 block discarded – undo
14 14
  */
15 15
 class EE_Restriction_Generator_Default_Protected extends EE_Restriction_Generator_Base
16 16
 {
17
-    /**
18
-     * Name of the field on this model (or a related model, including the model chain to it)
19
-     * that is a boolean indicating whether or not a model object is considered "Default" or not
20
-     *
21
-     * @var string
22
-     */
23
-    protected $_default_field_name;
24
-
25
-    /**
26
-     * The model chain to follow to get to the event model, including the event model itself.
27
-     * Eg 'Ticket.Datetime.Event'
28
-     *
29
-     * @var string
30
-     */
31
-    protected $_path_to_event_model;
32
-
33
-
34
-    /**
35
-     * @param string $default_field_name  the name of the field Name of the field on this model
36
-     *                                    (or a related model, including the model chain to it)
37
-     *                                    that is a boolean indicating whether or not a model object
38
-     *                                    is considered "Default" or not
39
-     * @param string $path_to_event_model The model chain to follow to get to the event model,
40
-     *                                    including the event model itself. Eg 'Ticket.Datetime.Event'
41
-     */
42
-    public function __construct(string $default_field_name, string $path_to_event_model)
43
-    {
44
-        $this->_default_field_name  = $default_field_name;
45
-        $this->_path_to_event_model = rtrim($path_to_event_model, '.') . '.';
46
-    }
47
-
48
-
49
-    /**
50
-     * @return EE_Default_Where_Conditions[]|EE_Return_None_Where_Conditions[]
51
-     * @throws EE_Error
52
-     */
53
-    protected function _generate_restrictions(): array
54
-    {
55
-        // if there are no standard caps for this model, then for now
56
-        // all we know is if they need the default cap to access this
57
-        if (! $this->model()->cap_slug()) {
58
-            return [
59
-                self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions(),
60
-            ];
61
-        }
62
-
63
-        $action         = $this->action();
64
-        $others         = "{$action}_others";
65
-        $private        = "{$action}_private";
66
-        $default        = "{$action}_default";
67
-        $others_default = "{$action}_others_default";
68
-        $event_model    = EEM_Event::instance();
69
-
70
-        $restrictions = [
71
-            // first: access to non-defaults is essentially controlled by which events are accessible
72
-            // if they don't have the basic event cap, they can't access ANY non-default items
73
-            $this->getCapKey($event_model, $action)    => $this->nonDefaultRestrictions(true),
74
-            // if they don't have the others event cap, they can't access others' non-default items
75
-            $this->getCapKey($event_model, $others)    => $this->othersNonDefaultRestrictions($event_model, $others),
76
-            // if they have basic and others, but not private, they can't access others' private non-default items
77
-            $this->getCapKey($event_model, $private)   => $this->privateRestrictions($event_model, $private),
78
-            // second: access to defaults is controlled by the default capabilities
79
-            // if they don't have the default capability, restrict access to only non-default items
80
-            $this->getCapKey($this->model(), $default) => $this->nonDefaultRestrictions(false),
81
-        ];
82
-        // if they don't have the "others" default capability,
83
-        // restrict access to only their default ones, and non-default ones
84
-        if (EE_Restriction_Generator_Base::is_cap($this->model(), $others_default)) {
85
-            $restrictions[ $this->getCapKey($this->model(), $others_default) ] = $this->othersDefaultRestrictions(
86
-                $others_default
87
-            );
88
-        }
89
-        return $restrictions;
90
-    }
91
-
92
-
93
-    /**
94
-     * @param EEM_Base $model
95
-     * @param string   $action
96
-     * @return string
97
-     * @since   5.0.0.p
98
-     */
99
-    private function getCapKey(EEM_Base $model, string $action): string
100
-    {
101
-        return EE_Restriction_Generator_Base::get_cap_name($model, $action);
102
-    }
103
-
104
-
105
-    /**
106
-     * @param bool $use_default_field_name
107
-     * @return EE_Default_Where_Conditions
108
-     * @since   5.0.0.p
109
-     */
110
-    private function nonDefaultRestrictions(bool $use_default_field_name): EE_Default_Where_Conditions
111
-    {
112
-        return new EE_Default_Where_Conditions([$this->_default_field_name => $use_default_field_name]);
113
-    }
114
-
115
-
116
-    /**
117
-     * @param string $action
118
-     * @return EE_Default_Where_Conditions
119
-     * @throws EE_Error
120
-     * @since   5.0.0.p
121
-     */
122
-    private function othersDefaultRestrictions(string $action): EE_Default_Where_Conditions
123
-    {
124
-        return new EE_Default_Where_Conditions(
125
-            [
126
-                // if they don't have the others default cap, they can't access others default items
127
-                // (but they can access their own default items, and non-default items)
128
-                'OR*no_' . $this->getCapKey($this->model(), $action) => [
129
-                    'AND'                      => [
130
-                        $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
131
-                        $this->_default_field_name                  => true,
132
-                    ],
133
-                    $this->_default_field_name => false,
134
-                ],
135
-            ]
136
-        );
137
-    }
138
-
139
-
140
-    /**
141
-     * @param EEM_Event $event_model
142
-     * @param string    $action
143
-     * @return EE_Default_Where_Conditions
144
-     * @since   5.0.0.p
145
-     */
146
-    private function othersNonDefaultRestrictions(EEM_Event $event_model, string $action): EE_Default_Where_Conditions
147
-    {
148
-        return new EE_Default_Where_Conditions(
149
-            [
150
-                'OR*no_' . $this->getCapKey($event_model, $action) => [
151
-                    $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
152
-                ],
153
-                $this->_default_field_name                         => true,
154
-            ]
155
-        );
156
-    }
157
-
158
-
159
-    /**
160
-     * @param EEM_Event $event_model
161
-     * @param string    $action
162
-     * @return EE_Default_Where_Conditions
163
-     * @since   5.0.0.p
164
-     */
165
-    private function privateRestrictions(EEM_Event $event_model, string $action): EE_Default_Where_Conditions
166
-    {
167
-        return new EE_Default_Where_Conditions(
168
-            [
169
-                'OR*no_' . $this->getCapKey($event_model, $action) => [
170
-                    $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
171
-                    $this->_path_to_event_model . 'status'      => ['!=', 'private'],
172
-                    $this->_default_field_name                  => true,
173
-                ],
174
-            ]
175
-        );
176
-    }
17
+	/**
18
+	 * Name of the field on this model (or a related model, including the model chain to it)
19
+	 * that is a boolean indicating whether or not a model object is considered "Default" or not
20
+	 *
21
+	 * @var string
22
+	 */
23
+	protected $_default_field_name;
24
+
25
+	/**
26
+	 * The model chain to follow to get to the event model, including the event model itself.
27
+	 * Eg 'Ticket.Datetime.Event'
28
+	 *
29
+	 * @var string
30
+	 */
31
+	protected $_path_to_event_model;
32
+
33
+
34
+	/**
35
+	 * @param string $default_field_name  the name of the field Name of the field on this model
36
+	 *                                    (or a related model, including the model chain to it)
37
+	 *                                    that is a boolean indicating whether or not a model object
38
+	 *                                    is considered "Default" or not
39
+	 * @param string $path_to_event_model The model chain to follow to get to the event model,
40
+	 *                                    including the event model itself. Eg 'Ticket.Datetime.Event'
41
+	 */
42
+	public function __construct(string $default_field_name, string $path_to_event_model)
43
+	{
44
+		$this->_default_field_name  = $default_field_name;
45
+		$this->_path_to_event_model = rtrim($path_to_event_model, '.') . '.';
46
+	}
47
+
48
+
49
+	/**
50
+	 * @return EE_Default_Where_Conditions[]|EE_Return_None_Where_Conditions[]
51
+	 * @throws EE_Error
52
+	 */
53
+	protected function _generate_restrictions(): array
54
+	{
55
+		// if there are no standard caps for this model, then for now
56
+		// all we know is if they need the default cap to access this
57
+		if (! $this->model()->cap_slug()) {
58
+			return [
59
+				self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions(),
60
+			];
61
+		}
62
+
63
+		$action         = $this->action();
64
+		$others         = "{$action}_others";
65
+		$private        = "{$action}_private";
66
+		$default        = "{$action}_default";
67
+		$others_default = "{$action}_others_default";
68
+		$event_model    = EEM_Event::instance();
69
+
70
+		$restrictions = [
71
+			// first: access to non-defaults is essentially controlled by which events are accessible
72
+			// if they don't have the basic event cap, they can't access ANY non-default items
73
+			$this->getCapKey($event_model, $action)    => $this->nonDefaultRestrictions(true),
74
+			// if they don't have the others event cap, they can't access others' non-default items
75
+			$this->getCapKey($event_model, $others)    => $this->othersNonDefaultRestrictions($event_model, $others),
76
+			// if they have basic and others, but not private, they can't access others' private non-default items
77
+			$this->getCapKey($event_model, $private)   => $this->privateRestrictions($event_model, $private),
78
+			// second: access to defaults is controlled by the default capabilities
79
+			// if they don't have the default capability, restrict access to only non-default items
80
+			$this->getCapKey($this->model(), $default) => $this->nonDefaultRestrictions(false),
81
+		];
82
+		// if they don't have the "others" default capability,
83
+		// restrict access to only their default ones, and non-default ones
84
+		if (EE_Restriction_Generator_Base::is_cap($this->model(), $others_default)) {
85
+			$restrictions[ $this->getCapKey($this->model(), $others_default) ] = $this->othersDefaultRestrictions(
86
+				$others_default
87
+			);
88
+		}
89
+		return $restrictions;
90
+	}
91
+
92
+
93
+	/**
94
+	 * @param EEM_Base $model
95
+	 * @param string   $action
96
+	 * @return string
97
+	 * @since   5.0.0.p
98
+	 */
99
+	private function getCapKey(EEM_Base $model, string $action): string
100
+	{
101
+		return EE_Restriction_Generator_Base::get_cap_name($model, $action);
102
+	}
103
+
104
+
105
+	/**
106
+	 * @param bool $use_default_field_name
107
+	 * @return EE_Default_Where_Conditions
108
+	 * @since   5.0.0.p
109
+	 */
110
+	private function nonDefaultRestrictions(bool $use_default_field_name): EE_Default_Where_Conditions
111
+	{
112
+		return new EE_Default_Where_Conditions([$this->_default_field_name => $use_default_field_name]);
113
+	}
114
+
115
+
116
+	/**
117
+	 * @param string $action
118
+	 * @return EE_Default_Where_Conditions
119
+	 * @throws EE_Error
120
+	 * @since   5.0.0.p
121
+	 */
122
+	private function othersDefaultRestrictions(string $action): EE_Default_Where_Conditions
123
+	{
124
+		return new EE_Default_Where_Conditions(
125
+			[
126
+				// if they don't have the others default cap, they can't access others default items
127
+				// (but they can access their own default items, and non-default items)
128
+				'OR*no_' . $this->getCapKey($this->model(), $action) => [
129
+					'AND'                      => [
130
+						$this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
131
+						$this->_default_field_name                  => true,
132
+					],
133
+					$this->_default_field_name => false,
134
+				],
135
+			]
136
+		);
137
+	}
138
+
139
+
140
+	/**
141
+	 * @param EEM_Event $event_model
142
+	 * @param string    $action
143
+	 * @return EE_Default_Where_Conditions
144
+	 * @since   5.0.0.p
145
+	 */
146
+	private function othersNonDefaultRestrictions(EEM_Event $event_model, string $action): EE_Default_Where_Conditions
147
+	{
148
+		return new EE_Default_Where_Conditions(
149
+			[
150
+				'OR*no_' . $this->getCapKey($event_model, $action) => [
151
+					$this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
152
+				],
153
+				$this->_default_field_name                         => true,
154
+			]
155
+		);
156
+	}
157
+
158
+
159
+	/**
160
+	 * @param EEM_Event $event_model
161
+	 * @param string    $action
162
+	 * @return EE_Default_Where_Conditions
163
+	 * @since   5.0.0.p
164
+	 */
165
+	private function privateRestrictions(EEM_Event $event_model, string $action): EE_Default_Where_Conditions
166
+	{
167
+		return new EE_Default_Where_Conditions(
168
+			[
169
+				'OR*no_' . $this->getCapKey($event_model, $action) => [
170
+					$this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
171
+					$this->_path_to_event_model . 'status'      => ['!=', 'private'],
172
+					$this->_default_field_name                  => true,
173
+				],
174
+			]
175
+		);
176
+	}
177 177
 }
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Restriction_Generator_Protected.strategy.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     {
30 30
         // if there are no standard caps for this model, then for now all we know
31 31
         // if they need the default cap to access this
32
-        if (! $this->model()->cap_slug()) {
32
+        if ( ! $this->model()->cap_slug()) {
33 33
             return [
34 34
                 EE_Restriction_Generator_Base::get_default_restrictions_cap(
35 35
                 ) => new EE_Return_None_Where_Conditions(),
@@ -44,22 +44,22 @@  discard block
 block discarded – undo
44 44
                 $this->action()
45 45
             )
46 46
         ) {
47
-            $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
47
+            $restrictions[EE_Restriction_Generator_Base::get_cap_name(
48 48
                 $this->model(),
49 49
                 $this->action()
50
-            ) ] = new EE_Return_None_Where_Conditions();
50
+            )] = new EE_Return_None_Where_Conditions();
51 51
             // does the others cap exist? (eg 'ee_read_others_registrations')
52 52
             if (
53 53
                 EE_Restriction_Generator_Base::is_cap(
54 54
                     $this->model(),
55
-                    $this->action() . '_others'
55
+                    $this->action().'_others'
56 56
                 )
57 57
             ) {
58 58
                 // both caps exist
59
-                $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
59
+                $restrictions[EE_Restriction_Generator_Base::get_cap_name(
60 60
                     $this->model(),
61
-                    $this->action() . '_others'
62
-                ) ] = new EE_Default_Where_Conditions(
61
+                    $this->action().'_others'
62
+                )] = new EE_Default_Where_Conditions(
63 63
                     [
64 64
                         EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
65 65
                     ]
@@ -68,20 +68,20 @@  discard block
 block discarded – undo
68 68
                 if (
69 69
                     EE_Restriction_Generator_Base::is_cap(
70 70
                         $this->model(),
71
-                        $this->action() . '_private'
71
+                        $this->action().'_private'
72 72
                     ) && $this->model() instanceof EEM_CPT_Base
73 73
                 ) {
74 74
                     // if they have basic and others, but not private,
75 75
                     // restrict them to see theirs and others' that aren't private
76
-                    $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
76
+                    $restrictions[EE_Restriction_Generator_Base::get_cap_name(
77 77
                         $this->model(),
78
-                        $this->action() . '_private'
79
-                    ) ] = new EE_Default_Where_Conditions(
78
+                        $this->action().'_private'
79
+                    )] = new EE_Default_Where_Conditions(
80 80
                         [
81
-                            'OR*no_' .
81
+                            'OR*no_'.
82 82
                             EE_Restriction_Generator_Base::get_cap_name(
83 83
                                 $this->model(),
84
-                                $this->action() . '_private'
84
+                                $this->action().'_private'
85 85
                             ) => [
86 86
                                 EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
87 87
                                 'status'                             => [
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
         } else {
97 97
             // there is no basic cap.
98 98
             // So they can only access this if they have the default admin cap
99
-            $restrictions[ EE_Restriction_Generator_Base::get_default_restrictions_cap(
100
-            ) ] = new EE_Return_None_Where_Conditions();
99
+            $restrictions[EE_Restriction_Generator_Base::get_default_restrictions_cap(
100
+            )] = new EE_Return_None_Where_Conditions();
101 101
         }
102 102
         return $restrictions;
103 103
     }
Please login to merge, or discard this patch.
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -20,84 +20,84 @@
 block discarded – undo
20 20
  */
21 21
 class EE_Restriction_Generator_Protected extends EE_Restriction_Generator_Base
22 22
 {
23
-    /**
24
-     * @return EE_Default_Where_Conditions[]|EE_Return_None_Where_Conditions[]
25
-     * @throws EE_Error
26
-     */
27
-    protected function _generate_restrictions(): array
28
-    {
29
-        // if there are no standard caps for this model, then for now all we know
30
-        // if they need the default cap to access this
31
-        if (! $this->model()->cap_slug()) {
32
-            return [
33
-                EE_Restriction_Generator_Base::get_default_restrictions_cap(
34
-                ) => new EE_Return_None_Where_Conditions(),
35
-            ];
36
-        }
23
+	/**
24
+	 * @return EE_Default_Where_Conditions[]|EE_Return_None_Where_Conditions[]
25
+	 * @throws EE_Error
26
+	 */
27
+	protected function _generate_restrictions(): array
28
+	{
29
+		// if there are no standard caps for this model, then for now all we know
30
+		// if they need the default cap to access this
31
+		if (! $this->model()->cap_slug()) {
32
+			return [
33
+				EE_Restriction_Generator_Base::get_default_restrictions_cap(
34
+				) => new EE_Return_None_Where_Conditions(),
35
+			];
36
+		}
37 37
 
38
-        $restrictions = [];
39
-        // does the basic cap exist? (eg 'ee_read_registrations')
40
-        if (
41
-            EE_Restriction_Generator_Base::is_cap(
42
-                $this->model(),
43
-                $this->action()
44
-            )
45
-        ) {
46
-            $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
47
-                $this->model(),
48
-                $this->action()
49
-            ) ] = new EE_Return_None_Where_Conditions();
50
-            // does the others cap exist? (eg 'ee_read_others_registrations')
51
-            if (
52
-                EE_Restriction_Generator_Base::is_cap(
53
-                    $this->model(),
54
-                    $this->action() . '_others'
55
-                )
56
-            ) {
57
-                // both caps exist
58
-                $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
59
-                    $this->model(),
60
-                    $this->action() . '_others'
61
-                ) ] = new EE_Default_Where_Conditions(
62
-                    [
63
-                        EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
64
-                    ]
65
-                );
66
-                // does the private cap exist (eg 'ee_read_others_private_events')
67
-                if (
68
-                    EE_Restriction_Generator_Base::is_cap(
69
-                        $this->model(),
70
-                        $this->action() . '_private'
71
-                    ) && $this->model() instanceof EEM_CPT_Base
72
-                ) {
73
-                    // if they have basic and others, but not private,
74
-                    // restrict them to see theirs and others' that aren't private
75
-                    $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
76
-                        $this->model(),
77
-                        $this->action() . '_private'
78
-                    ) ] = new EE_Default_Where_Conditions(
79
-                        [
80
-                            'OR*no_' .
81
-                            EE_Restriction_Generator_Base::get_cap_name(
82
-                                $this->model(),
83
-                                $this->action() . '_private'
84
-                            ) => [
85
-                                EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
86
-                                'status'                             => [
87
-                                    '!=',
88
-                                    'private',
89
-                                ],
90
-                            ],
91
-                        ]
92
-                    );
93
-                }
94
-            }
95
-        } else {
96
-            // there is no basic cap.
97
-            // So they can only access this if they have the default admin cap
98
-            $restrictions[ EE_Restriction_Generator_Base::get_default_restrictions_cap(
99
-            ) ] = new EE_Return_None_Where_Conditions();
100
-        }
101
-        return $restrictions;
102
-    }
38
+		$restrictions = [];
39
+		// does the basic cap exist? (eg 'ee_read_registrations')
40
+		if (
41
+			EE_Restriction_Generator_Base::is_cap(
42
+				$this->model(),
43
+				$this->action()
44
+			)
45
+		) {
46
+			$restrictions[ EE_Restriction_Generator_Base::get_cap_name(
47
+				$this->model(),
48
+				$this->action()
49
+			) ] = new EE_Return_None_Where_Conditions();
50
+			// does the others cap exist? (eg 'ee_read_others_registrations')
51
+			if (
52
+				EE_Restriction_Generator_Base::is_cap(
53
+					$this->model(),
54
+					$this->action() . '_others'
55
+				)
56
+			) {
57
+				// both caps exist
58
+				$restrictions[ EE_Restriction_Generator_Base::get_cap_name(
59
+					$this->model(),
60
+					$this->action() . '_others'
61
+				) ] = new EE_Default_Where_Conditions(
62
+					[
63
+						EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
64
+					]
65
+				);
66
+				// does the private cap exist (eg 'ee_read_others_private_events')
67
+				if (
68
+					EE_Restriction_Generator_Base::is_cap(
69
+						$this->model(),
70
+						$this->action() . '_private'
71
+					) && $this->model() instanceof EEM_CPT_Base
72
+				) {
73
+					// if they have basic and others, but not private,
74
+					// restrict them to see theirs and others' that aren't private
75
+					$restrictions[ EE_Restriction_Generator_Base::get_cap_name(
76
+						$this->model(),
77
+						$this->action() . '_private'
78
+					) ] = new EE_Default_Where_Conditions(
79
+						[
80
+							'OR*no_' .
81
+							EE_Restriction_Generator_Base::get_cap_name(
82
+								$this->model(),
83
+								$this->action() . '_private'
84
+							) => [
85
+								EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
86
+								'status'                             => [
87
+									'!=',
88
+									'private',
89
+								],
90
+							],
91
+						]
92
+					);
93
+				}
94
+			}
95
+		} else {
96
+			// there is no basic cap.
97
+			// So they can only access this if they have the default admin cap
98
+			$restrictions[ EE_Restriction_Generator_Base::get_default_restrictions_cap(
99
+			) ] = new EE_Return_None_Where_Conditions();
100
+		}
101
+		return $restrictions;
102
+	}
103 103
 }
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Restriction_Generator_Global.strategy.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     {
49 49
         // if there are no standard caps for this model, then for now
50 50
         // all we know is if they need the default cap to access this
51
-        if (! $this->model()->cap_slug()) {
51
+        if ( ! $this->model()->cap_slug()) {
52 52
             return [
53 53
                 EE_Restriction_Generator_Base::get_default_restrictions_cap(
54 54
                 ) => new EE_Return_None_Where_Conditions(),
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
             ) => new EE_Return_None_Where_Conditions(),
62 62
             EE_Restriction_Generator_Base::get_cap_name(
63 63
                 $this->model(),
64
-                $this->action() . '_others'
64
+                $this->action().'_others'
65 65
             ) => new EE_Default_Where_Conditions(
66 66
                 [
67 67
                     // I need to be the owner, or it must be a global item
68
-                    'OR*no_' .
68
+                    'OR*no_'.
69 69
                     EE_Restriction_Generator_Base::get_cap_name(
70 70
                         $this->model(),
71
-                        $this->action() . '_others'
71
+                        $this->action().'_others'
72 72
                     ) => [
73 73
                         EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
74 74
                         $this->_global_field_name            => true,
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             ),
78 78
             EE_Restriction_Generator_Base::get_cap_name(
79 79
                 $this->model(),
80
-                $this->action() . '_global'
80
+                $this->action().'_global'
81 81
             ) => new EE_Default_Where_Conditions(
82 82
                 [
83 83
                     // it mustn't be global
Please login to merge, or discard this patch.
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -19,70 +19,70 @@
 block discarded – undo
19 19
  */
20 20
 class EE_Restriction_Generator_Global extends EE_Restriction_Generator_Base
21 21
 {
22
-    /**
23
-     * name of the model field that indicates whether or not a model object is
24
-     * "global"
25
-     *
26
-     * @var string
27
-     */
28
-    protected $_global_field_name;
22
+	/**
23
+	 * name of the model field that indicates whether or not a model object is
24
+	 * "global"
25
+	 *
26
+	 * @var string
27
+	 */
28
+	protected $_global_field_name;
29 29
 
30 30
 
31
-    /**
32
-     * @param string $global_field_name name of the model field that indicates
33
-     *                                  whether or not a model object is
34
-     *                                  "global"
35
-     */
36
-    public function __construct(string $global_field_name)
37
-    {
38
-        $this->_global_field_name = $global_field_name;
39
-    }
31
+	/**
32
+	 * @param string $global_field_name name of the model field that indicates
33
+	 *                                  whether or not a model object is
34
+	 *                                  "global"
35
+	 */
36
+	public function __construct(string $global_field_name)
37
+	{
38
+		$this->_global_field_name = $global_field_name;
39
+	}
40 40
 
41 41
 
42
-    /**
43
-     * @return EE_Default_Where_Conditions[]|EE_Return_None_Where_Conditions[]
44
-     * @throws EE_Error
45
-     */
46
-    protected function _generate_restrictions(): array
47
-    {
48
-        // if there are no standard caps for this model, then for now
49
-        // all we know is if they need the default cap to access this
50
-        if (! $this->model()->cap_slug()) {
51
-            return [
52
-                EE_Restriction_Generator_Base::get_default_restrictions_cap(
53
-                ) => new EE_Return_None_Where_Conditions(),
54
-            ];
55
-        }
56
-        return [
57
-            EE_Restriction_Generator_Base::get_cap_name(
58
-                $this->model(),
59
-                $this->action()
60
-            ) => new EE_Return_None_Where_Conditions(),
61
-            EE_Restriction_Generator_Base::get_cap_name(
62
-                $this->model(),
63
-                $this->action() . '_others'
64
-            ) => new EE_Default_Where_Conditions(
65
-                [
66
-                    // I need to be the owner, or it must be a global item
67
-                    'OR*no_' .
68
-                    EE_Restriction_Generator_Base::get_cap_name(
69
-                        $this->model(),
70
-                        $this->action() . '_others'
71
-                    ) => [
72
-                        EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
73
-                        $this->_global_field_name            => true,
74
-                    ],
75
-                ]
76
-            ),
77
-            EE_Restriction_Generator_Base::get_cap_name(
78
-                $this->model(),
79
-                $this->action() . '_global'
80
-            ) => new EE_Default_Where_Conditions(
81
-                [
82
-                    // it mustn't be global
83
-                    $this->_global_field_name => false,
84
-                ]
85
-            ),
86
-        ];
87
-    }
42
+	/**
43
+	 * @return EE_Default_Where_Conditions[]|EE_Return_None_Where_Conditions[]
44
+	 * @throws EE_Error
45
+	 */
46
+	protected function _generate_restrictions(): array
47
+	{
48
+		// if there are no standard caps for this model, then for now
49
+		// all we know is if they need the default cap to access this
50
+		if (! $this->model()->cap_slug()) {
51
+			return [
52
+				EE_Restriction_Generator_Base::get_default_restrictions_cap(
53
+				) => new EE_Return_None_Where_Conditions(),
54
+			];
55
+		}
56
+		return [
57
+			EE_Restriction_Generator_Base::get_cap_name(
58
+				$this->model(),
59
+				$this->action()
60
+			) => new EE_Return_None_Where_Conditions(),
61
+			EE_Restriction_Generator_Base::get_cap_name(
62
+				$this->model(),
63
+				$this->action() . '_others'
64
+			) => new EE_Default_Where_Conditions(
65
+				[
66
+					// I need to be the owner, or it must be a global item
67
+					'OR*no_' .
68
+					EE_Restriction_Generator_Base::get_cap_name(
69
+						$this->model(),
70
+						$this->action() . '_others'
71
+					) => [
72
+						EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
73
+						$this->_global_field_name            => true,
74
+					],
75
+				]
76
+			),
77
+			EE_Restriction_Generator_Base::get_cap_name(
78
+				$this->model(),
79
+				$this->action() . '_global'
80
+			) => new EE_Default_Where_Conditions(
81
+				[
82
+					// it mustn't be global
83
+					$this->_global_field_name => false,
84
+				]
85
+			),
86
+		];
87
+	}
88 88
 }
Please login to merge, or discard this patch.
strategies/EE_Restriction_Generator_Event_Related_Public.strategy.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     {
45 45
         // if there are no standard caps for this model, then for now
46 46
         // all we know if they need the default cap to access this
47
-        if (! $this->model()->cap_slug()) {
47
+        if ( ! $this->model()->cap_slug()) {
48 48
             return [
49 49
                 self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions(),
50 50
             ];
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
             // they can't access others' non-default items
68 68
             self::get_cap_name(
69 69
                 $event_model,
70
-                $this->action() . '_others'
70
+                $this->action().'_others'
71 71
             ) => new EE_Default_Where_Conditions(
72 72
                 [
73
-                    'OR*' . self::get_cap_name(
73
+                    'OR*'.self::get_cap_name(
74 74
                         $event_model,
75
-                        $this->action() . '_others'
75
+                        $this->action().'_others'
76 76
                     ) => $this->addPublishedPostConditions(
77 77
                         [
78
-                            $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
78
+                            $this->_path_to_event_model.'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
79 79
                         ],
80 80
                         true,
81 81
                         $this->_path_to_event_model
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
             ),
85 85
             // if they have basic and others, but not private,
86 86
             // they can't access others' private non-default items
87
-            self::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions(
87
+            self::get_cap_name($event_model, $this->action().'_private') => new EE_Default_Where_Conditions(
88 88
                 [
89
-                    'OR*no_' . self::get_cap_name(
89
+                    'OR*no_'.self::get_cap_name(
90 90
                         $event_model,
91
-                        $this->action() . '_private'
91
+                        $this->action().'_private'
92 92
                     ) => $this->addPublishedPostConditions(
93 93
                         [
94
-                            $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
94
+                            $this->_path_to_event_model.'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
95 95
                         ],
96 96
                         false,
97 97
                         $this->_path_to_event_model
Please login to merge, or discard this patch.
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -13,90 +13,90 @@
 block discarded – undo
13 13
  */
14 14
 class EE_Restriction_Generator_Event_Related_Public extends EE_Restriction_Generator_Base
15 15
 {
16
-    /**
17
-     * Path to the event model from the model this restriction generator will
18
-     * be applied to; including the event model itself. Eg
19
-     * "Ticket.Datetime.Event"
20
-     *
21
-     * @var string
22
-     */
23
-    protected $_path_to_event_model;
16
+	/**
17
+	 * Path to the event model from the model this restriction generator will
18
+	 * be applied to; including the event model itself. Eg
19
+	 * "Ticket.Datetime.Event"
20
+	 *
21
+	 * @var string
22
+	 */
23
+	protected $_path_to_event_model;
24 24
 
25 25
 
26
-    /**
27
-     * @param string $path_to_event_model
28
-     */
29
-    public function __construct(string $path_to_event_model)
30
-    {
31
-        if (substr($path_to_event_model, -1, 1) != '.') {
32
-            $path_to_event_model .= '.';
33
-        }
34
-        $this->_path_to_event_model = $path_to_event_model;
35
-    }
26
+	/**
27
+	 * @param string $path_to_event_model
28
+	 */
29
+	public function __construct(string $path_to_event_model)
30
+	{
31
+		if (substr($path_to_event_model, -1, 1) != '.') {
32
+			$path_to_event_model .= '.';
33
+		}
34
+		$this->_path_to_event_model = $path_to_event_model;
35
+	}
36 36
 
37 37
 
38
-    /**
39
-     * @return EE_Default_Where_Conditions[]|EE_Return_None_Where_Conditions[]
40
-     * @throws EE_Error
41
-     */
42
-    protected function _generate_restrictions(): array
43
-    {
44
-        // if there are no standard caps for this model, then for now
45
-        // all we know if they need the default cap to access this
46
-        if (! $this->model()->cap_slug()) {
47
-            return [
48
-                self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions(),
49
-            ];
50
-        }
38
+	/**
39
+	 * @return EE_Default_Where_Conditions[]|EE_Return_None_Where_Conditions[]
40
+	 * @throws EE_Error
41
+	 */
42
+	protected function _generate_restrictions(): array
43
+	{
44
+		// if there are no standard caps for this model, then for now
45
+		// all we know if they need the default cap to access this
46
+		if (! $this->model()->cap_slug()) {
47
+			return [
48
+				self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions(),
49
+			];
50
+		}
51 51
 
52
-        $event_model = EEM_Event::instance();
53
-        return [
54
-            // first: basically access to non-defaults is essentially
55
-            // controlled by which events are accessible
56
-            // if they don't have the basic event cap,
57
-            // they can only read things for published events
58
-            self::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(
59
-                $this->addPublishedPostConditions(
60
-                    [],
61
-                    true,
62
-                    $this->_path_to_event_model
63
-                )
64
-            ),
65
-            // if they don't have the others event cap,
66
-            // they can't access others' non-default items
67
-            self::get_cap_name(
68
-                $event_model,
69
-                $this->action() . '_others'
70
-            ) => new EE_Default_Where_Conditions(
71
-                [
72
-                    'OR*' . self::get_cap_name(
73
-                        $event_model,
74
-                        $this->action() . '_others'
75
-                    ) => $this->addPublishedPostConditions(
76
-                        [
77
-                            $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
78
-                        ],
79
-                        true,
80
-                        $this->_path_to_event_model
81
-                    ),
82
-                ]
83
-            ),
84
-            // if they have basic and others, but not private,
85
-            // they can't access others' private non-default items
86
-            self::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions(
87
-                [
88
-                    'OR*no_' . self::get_cap_name(
89
-                        $event_model,
90
-                        $this->action() . '_private'
91
-                    ) => $this->addPublishedPostConditions(
92
-                        [
93
-                            $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
94
-                        ],
95
-                        false,
96
-                        $this->_path_to_event_model
97
-                    ),
98
-                ]
99
-            ),
100
-        ];
101
-    }
52
+		$event_model = EEM_Event::instance();
53
+		return [
54
+			// first: basically access to non-defaults is essentially
55
+			// controlled by which events are accessible
56
+			// if they don't have the basic event cap,
57
+			// they can only read things for published events
58
+			self::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(
59
+				$this->addPublishedPostConditions(
60
+					[],
61
+					true,
62
+					$this->_path_to_event_model
63
+				)
64
+			),
65
+			// if they don't have the others event cap,
66
+			// they can't access others' non-default items
67
+			self::get_cap_name(
68
+				$event_model,
69
+				$this->action() . '_others'
70
+			) => new EE_Default_Where_Conditions(
71
+				[
72
+					'OR*' . self::get_cap_name(
73
+						$event_model,
74
+						$this->action() . '_others'
75
+					) => $this->addPublishedPostConditions(
76
+						[
77
+							$this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
78
+						],
79
+						true,
80
+						$this->_path_to_event_model
81
+					),
82
+				]
83
+			),
84
+			// if they have basic and others, but not private,
85
+			// they can't access others' private non-default items
86
+			self::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions(
87
+				[
88
+					'OR*no_' . self::get_cap_name(
89
+						$event_model,
90
+						$this->action() . '_private'
91
+					) => $this->addPublishedPostConditions(
92
+						[
93
+							$this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
94
+						],
95
+						false,
96
+						$this->_path_to_event_model
97
+					),
98
+				]
99
+			),
100
+		];
101
+	}
102 102
 }
Please login to merge, or discard this patch.
db_models/strategies/EE_Restriction_Generator_Default_Public.strategy.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         // if there are no standard caps for this model, then for now all we know
65 65
         // if they need the default cap to access this
66
-        if (! $this->model()->cap_slug()) {
66
+        if ( ! $this->model()->cap_slug()) {
67 67
             return [
68 68
                 self::get_default_restrictions_cap(
69 69
                 ) => new EE_Return_None_Where_Conditions(),
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                 $this->action()
83 83
             ) => new EE_Default_Where_Conditions(
84 84
                 [
85
-                    'OR*no_' .
85
+                    'OR*no_'.
86 86
                     EE_Restriction_Generator_Base::get_cap_name(
87 87
                         $event_model,
88 88
                         $this->action()
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
             // others' that are for published events, or defaults
101 101
             EE_Restriction_Generator_Base::get_cap_name(
102 102
                 $event_model,
103
-                $this->action() . '_others'
103
+                $this->action().'_others'
104 104
             ) => new EE_Default_Where_Conditions(
105 105
                 [
106
-                    'OR*no_' .
106
+                    'OR*no_'.
107 107
                     EE_Restriction_Generator_Base::get_cap_name(
108 108
                         $event_model,
109
-                        $this->action() . '_others'
109
+                        $this->action().'_others'
110 110
                     ) => $this->addPublishedPostConditions(
111 111
                         [
112
-                            $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
112
+                            $this->_path_to_event_model.'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
113 113
                             $this->_default_field_name                  => true,
114 114
                         ],
115 115
                         true,
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
             // and others' that aren't private
123 123
             EE_Restriction_Generator_Base::get_cap_name(
124 124
                 $event_model,
125
-                $this->action() . '_private'
125
+                $this->action().'_private'
126 126
             ) => new EE_Default_Where_Conditions(
127 127
                 [
128
-                    'OR*no_' .
128
+                    'OR*no_'.
129 129
                     EE_Restriction_Generator_Base::get_cap_name(
130 130
                         $event_model,
131
-                        $this->action() . '_private'
131
+                        $this->action().'_private'
132 132
                     ) => $this->addPublishedPostConditions(
133 133
                         [
134
-                            $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
134
+                            $this->_path_to_event_model.'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
135 135
                             $this->_default_field_name                  => true,
136 136
                         ],
137 137
                         false,
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             // restrict access to only non-default items
146 146
             EE_Restriction_Generator_Base::get_cap_name(
147 147
                 $this->model(),
148
-                $this->action() . '_default'
148
+                $this->action().'_default'
149 149
             ) => new EE_Default_Where_Conditions(
150 150
                 [$this->_default_field_name => false]
151 151
             ),
@@ -153,24 +153,24 @@  discard block
 block discarded – undo
153 153
         if (
154 154
             EE_Restriction_Generator_Base::is_cap(
155 155
                 $this->model(),
156
-                $this->action() . '_others_default'
156
+                $this->action().'_others_default'
157 157
             )
158 158
         ) {
159 159
             // if they don't have the "others" default capability,
160 160
             // restrict access to only their default ones, and non-default ones
161
-            $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
161
+            $restrictions[EE_Restriction_Generator_Base::get_cap_name(
162 162
                 $this->model(),
163
-                $this->action() . '_others_default'
164
-            ) ] = new EE_Default_Where_Conditions(
163
+                $this->action().'_others_default'
164
+            )] = new EE_Default_Where_Conditions(
165 165
                 [
166 166
                     // if they don't have the others default cap,
167 167
                     // they can't access others default items
168 168
                     // (but they can access their own default items,
169 169
                     // and non-default items)
170
-                    'OR*no_' .
170
+                    'OR*no_'.
171 171
                     EE_Restriction_Generator_Base::get_cap_name(
172 172
                         $this->model(),
173
-                        $this->action() . '_others_default'
173
+                        $this->action().'_others_default'
174 174
                     ) => [
175 175
                         'AND'                      => [
176 176
                             EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
Please login to merge, or discard this patch.
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -14,172 +14,172 @@
 block discarded – undo
14 14
  */
15 15
 class EE_Restriction_Generator_Default_Public extends EE_Restriction_Generator_Base
16 16
 {
17
-    /**
18
-     * Name of the field on this model (or a related model, including the model
19
-     * chain to it) that is a boolean indicating whether or not a model object
20
-     * is considered "Default" or not
21
-     *
22
-     * @var string
23
-     */
24
-    protected $_default_field_name;
17
+	/**
18
+	 * Name of the field on this model (or a related model, including the model
19
+	 * chain to it) that is a boolean indicating whether or not a model object
20
+	 * is considered "Default" or not
21
+	 *
22
+	 * @var string
23
+	 */
24
+	protected $_default_field_name;
25 25
 
26
-    /**
27
-     * The model chain to follow to get to the event model, including the event
28
-     * model itself. Eg 'Ticket.Datetime.Event'
29
-     *
30
-     * @var string
31
-     */
32
-    protected $_path_to_event_model;
26
+	/**
27
+	 * The model chain to follow to get to the event model, including the event
28
+	 * model itself. Eg 'Ticket.Datetime.Event'
29
+	 *
30
+	 * @var string
31
+	 */
32
+	protected $_path_to_event_model;
33 33
 
34 34
 
35
-    /**
36
-     * @param string $default_field_name  the name of the field Name of the
37
-     *                                    field on this model (or a related
38
-     *                                    model, including the model chain to
39
-     *                                    it) that is a boolean indicating
40
-     *                                    whether or not a model object is
41
-     *                                    considered "Default" or not
42
-     * @param string $path_to_event_model The model chain to follow to get to
43
-     *                                    the event model, including the event
44
-     *                                    model itself. Eg
45
-     *                                    'Ticket.Datetime.Event'
46
-     */
47
-    public function __construct(string $default_field_name, string $path_to_event_model)
48
-    {
49
-        $this->_default_field_name = $default_field_name;
50
-        if (substr($path_to_event_model, -1, 1) != '.') {
51
-            $path_to_event_model .= '.';
52
-        }
53
-        $this->_path_to_event_model = $path_to_event_model;
54
-    }
35
+	/**
36
+	 * @param string $default_field_name  the name of the field Name of the
37
+	 *                                    field on this model (or a related
38
+	 *                                    model, including the model chain to
39
+	 *                                    it) that is a boolean indicating
40
+	 *                                    whether or not a model object is
41
+	 *                                    considered "Default" or not
42
+	 * @param string $path_to_event_model The model chain to follow to get to
43
+	 *                                    the event model, including the event
44
+	 *                                    model itself. Eg
45
+	 *                                    'Ticket.Datetime.Event'
46
+	 */
47
+	public function __construct(string $default_field_name, string $path_to_event_model)
48
+	{
49
+		$this->_default_field_name = $default_field_name;
50
+		if (substr($path_to_event_model, -1, 1) != '.') {
51
+			$path_to_event_model .= '.';
52
+		}
53
+		$this->_path_to_event_model = $path_to_event_model;
54
+	}
55 55
 
56 56
 
57
-    /**
58
-     * @return EE_Default_Where_Conditions[]|EE_Return_None_Where_Conditions[]
59
-     * @throws EE_Error
60
-     */
61
-    protected function _generate_restrictions(): array
62
-    {
63
-        // if there are no standard caps for this model, then for now all we know
64
-        // if they need the default cap to access this
65
-        if (! $this->model()->cap_slug()) {
66
-            return [
67
-                self::get_default_restrictions_cap(
68
-                ) => new EE_Return_None_Where_Conditions(),
69
-            ];
70
-        }
57
+	/**
58
+	 * @return EE_Default_Where_Conditions[]|EE_Return_None_Where_Conditions[]
59
+	 * @throws EE_Error
60
+	 */
61
+	protected function _generate_restrictions(): array
62
+	{
63
+		// if there are no standard caps for this model, then for now all we know
64
+		// if they need the default cap to access this
65
+		if (! $this->model()->cap_slug()) {
66
+			return [
67
+				self::get_default_restrictions_cap(
68
+				) => new EE_Return_None_Where_Conditions(),
69
+			];
70
+		}
71 71
 
72
-        $event_model = EEM_Event::instance();
72
+		$event_model = EEM_Event::instance();
73 73
 
74
-        $restrictions = [
75
-            // first: basically access to non-defaults is essentially
76
-            // controlled by which events are accessible
77
-            // if they don't have the basic event cap,
78
-            // they can't access ANY non-default items
79
-            EE_Restriction_Generator_Base::get_cap_name(
80
-                $event_model,
81
-                $this->action()
82
-            ) => new EE_Default_Where_Conditions(
83
-                [
84
-                    'OR*no_' .
85
-                    EE_Restriction_Generator_Base::get_cap_name(
86
-                        $event_model,
87
-                        $this->action()
88
-                    ) => $this->addPublishedPostConditions(
89
-                        [
90
-                            $this->_default_field_name => true,
91
-                        ],
92
-                        true,
93
-                        $this->_path_to_event_model
94
-                    ),
95
-                ]
96
-            ),
97
-            // if they don't have the others event cap,
98
-            // they can only access their own,
99
-            // others' that are for published events, or defaults
100
-            EE_Restriction_Generator_Base::get_cap_name(
101
-                $event_model,
102
-                $this->action() . '_others'
103
-            ) => new EE_Default_Where_Conditions(
104
-                [
105
-                    'OR*no_' .
106
-                    EE_Restriction_Generator_Base::get_cap_name(
107
-                        $event_model,
108
-                        $this->action() . '_others'
109
-                    ) => $this->addPublishedPostConditions(
110
-                        [
111
-                            $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
112
-                            $this->_default_field_name                  => true,
113
-                        ],
114
-                        true,
115
-                        $this->_path_to_event_model
116
-                    ),
117
-                ]
118
-            ),
119
-            // if they have basic and others, but not private,
120
-            // they can access default, their own,
121
-            // and others' that aren't private
122
-            EE_Restriction_Generator_Base::get_cap_name(
123
-                $event_model,
124
-                $this->action() . '_private'
125
-            ) => new EE_Default_Where_Conditions(
126
-                [
127
-                    'OR*no_' .
128
-                    EE_Restriction_Generator_Base::get_cap_name(
129
-                        $event_model,
130
-                        $this->action() . '_private'
131
-                    ) => $this->addPublishedPostConditions(
132
-                        [
133
-                            $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
134
-                            $this->_default_field_name                  => true,
135
-                        ],
136
-                        false,
137
-                        $this->_path_to_event_model
138
-                    ),
139
-                ]
140
-            ),
141
-            // second: access to defaults is controlled
142
-            // by the default capabilities
143
-            // if they don't have the basic default capability,
144
-            // restrict access to only non-default items
145
-            EE_Restriction_Generator_Base::get_cap_name(
146
-                $this->model(),
147
-                $this->action() . '_default'
148
-            ) => new EE_Default_Where_Conditions(
149
-                [$this->_default_field_name => false]
150
-            ),
151
-        ];
152
-        if (
153
-            EE_Restriction_Generator_Base::is_cap(
154
-                $this->model(),
155
-                $this->action() . '_others_default'
156
-            )
157
-        ) {
158
-            // if they don't have the "others" default capability,
159
-            // restrict access to only their default ones, and non-default ones
160
-            $restrictions[ EE_Restriction_Generator_Base::get_cap_name(
161
-                $this->model(),
162
-                $this->action() . '_others_default'
163
-            ) ] = new EE_Default_Where_Conditions(
164
-                [
165
-                    // if they don't have the others default cap,
166
-                    // they can't access others default items
167
-                    // (but they can access their own default items,
168
-                    // and non-default items)
169
-                    'OR*no_' .
170
-                    EE_Restriction_Generator_Base::get_cap_name(
171
-                        $this->model(),
172
-                        $this->action() . '_others_default'
173
-                    ) => [
174
-                        'AND'                      => [
175
-                            EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
176
-                            $this->_default_field_name           => true
177
-                        ],
178
-                        $this->_default_field_name => false
179
-                    ]
180
-                ]
181
-            );
182
-        }
183
-        return $restrictions;
184
-    }
74
+		$restrictions = [
75
+			// first: basically access to non-defaults is essentially
76
+			// controlled by which events are accessible
77
+			// if they don't have the basic event cap,
78
+			// they can't access ANY non-default items
79
+			EE_Restriction_Generator_Base::get_cap_name(
80
+				$event_model,
81
+				$this->action()
82
+			) => new EE_Default_Where_Conditions(
83
+				[
84
+					'OR*no_' .
85
+					EE_Restriction_Generator_Base::get_cap_name(
86
+						$event_model,
87
+						$this->action()
88
+					) => $this->addPublishedPostConditions(
89
+						[
90
+							$this->_default_field_name => true,
91
+						],
92
+						true,
93
+						$this->_path_to_event_model
94
+					),
95
+				]
96
+			),
97
+			// if they don't have the others event cap,
98
+			// they can only access their own,
99
+			// others' that are for published events, or defaults
100
+			EE_Restriction_Generator_Base::get_cap_name(
101
+				$event_model,
102
+				$this->action() . '_others'
103
+			) => new EE_Default_Where_Conditions(
104
+				[
105
+					'OR*no_' .
106
+					EE_Restriction_Generator_Base::get_cap_name(
107
+						$event_model,
108
+						$this->action() . '_others'
109
+					) => $this->addPublishedPostConditions(
110
+						[
111
+							$this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
112
+							$this->_default_field_name                  => true,
113
+						],
114
+						true,
115
+						$this->_path_to_event_model
116
+					),
117
+				]
118
+			),
119
+			// if they have basic and others, but not private,
120
+			// they can access default, their own,
121
+			// and others' that aren't private
122
+			EE_Restriction_Generator_Base::get_cap_name(
123
+				$event_model,
124
+				$this->action() . '_private'
125
+			) => new EE_Default_Where_Conditions(
126
+				[
127
+					'OR*no_' .
128
+					EE_Restriction_Generator_Base::get_cap_name(
129
+						$event_model,
130
+						$this->action() . '_private'
131
+					) => $this->addPublishedPostConditions(
132
+						[
133
+							$this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
134
+							$this->_default_field_name                  => true,
135
+						],
136
+						false,
137
+						$this->_path_to_event_model
138
+					),
139
+				]
140
+			),
141
+			// second: access to defaults is controlled
142
+			// by the default capabilities
143
+			// if they don't have the basic default capability,
144
+			// restrict access to only non-default items
145
+			EE_Restriction_Generator_Base::get_cap_name(
146
+				$this->model(),
147
+				$this->action() . '_default'
148
+			) => new EE_Default_Where_Conditions(
149
+				[$this->_default_field_name => false]
150
+			),
151
+		];
152
+		if (
153
+			EE_Restriction_Generator_Base::is_cap(
154
+				$this->model(),
155
+				$this->action() . '_others_default'
156
+			)
157
+		) {
158
+			// if they don't have the "others" default capability,
159
+			// restrict access to only their default ones, and non-default ones
160
+			$restrictions[ EE_Restriction_Generator_Base::get_cap_name(
161
+				$this->model(),
162
+				$this->action() . '_others_default'
163
+			) ] = new EE_Default_Where_Conditions(
164
+				[
165
+					// if they don't have the others default cap,
166
+					// they can't access others default items
167
+					// (but they can access their own default items,
168
+					// and non-default items)
169
+					'OR*no_' .
170
+					EE_Restriction_Generator_Base::get_cap_name(
171
+						$this->model(),
172
+						$this->action() . '_others_default'
173
+					) => [
174
+						'AND'                      => [
175
+							EE_QUERY_PLACEHOLDER_USER_FIELD_NAME => EE_QUERY_PLACEHOLDER_CURRENT_USER,
176
+							$this->_default_field_name           => true
177
+						],
178
+						$this->_default_field_name => false
179
+					]
180
+				]
181
+			);
182
+		}
183
+		return $restrictions;
184
+	}
185 185
 }
Please login to merge, or discard this patch.
strategies/EE_Restriction_Generator_Event_Related_Protected.strategy.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     {
90 90
         // if there are no standard caps for this model, then for now
91 91
         // all we know if they need the default cap to access this
92
-        if (! $this->model()->cap_slug()) {
92
+        if ( ! $this->model()->cap_slug()) {
93 93
             return [
94 94
                 self::get_default_restrictions_cap(
95 95
                 ) => new EE_Return_None_Where_Conditions(),
@@ -110,26 +110,26 @@  discard block
 block discarded – undo
110 110
             // they can't access others' non-default items
111 111
             EE_Restriction_Generator_Base::get_cap_name(
112 112
                 $event_model,
113
-                $this->action_for_event() . '_others'
113
+                $this->action_for_event().'_others'
114 114
             ) => new EE_Default_Where_Conditions(
115 115
                 [
116
-                    $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
116
+                    $this->_path_to_event_model.'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
117 117
                 ]
118 118
             ),
119 119
             // if they have basic and others, but not private,
120 120
             // they can't access others' private non-default items
121 121
             EE_Restriction_Generator_Base::get_cap_name(
122 122
                 $event_model,
123
-                $this->action_for_event() . '_private'
123
+                $this->action_for_event().'_private'
124 124
             ) => new EE_Default_Where_Conditions(
125 125
                 [
126
-                    'OR*no_' .
126
+                    'OR*no_'.
127 127
                     EE_Restriction_Generator_Base::get_cap_name(
128 128
                         $event_model,
129
-                        $this->action_for_event() . '_private'
129
+                        $this->action_for_event().'_private'
130 130
                     ) => $this->addPublishedPostConditions(
131 131
                         [
132
-                            $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
132
+                            $this->_path_to_event_model.'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
133 133
                         ],
134 134
                         false,
135 135
                         $this->_path_to_event_model
Please login to merge, or discard this patch.
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -13,128 +13,128 @@
 block discarded – undo
13 13
  */
14 14
 class EE_Restriction_Generator_Event_Related_Protected extends EE_Restriction_Generator_Base
15 15
 {
16
-    /**
17
-     * Path to the event model from the model this restriction generator will
18
-     * be applied to; including the event model itself. Eg
19
-     * "Ticket.Datetime.Event"
20
-     *
21
-     * @var string
22
-     */
23
-    protected $_path_to_event_model = null;
16
+	/**
17
+	 * Path to the event model from the model this restriction generator will
18
+	 * be applied to; including the event model itself. Eg
19
+	 * "Ticket.Datetime.Event"
20
+	 *
21
+	 * @var string
22
+	 */
23
+	protected $_path_to_event_model = null;
24 24
 
25
-    /**
26
-     * Capability context on event model when creating restrictions.
27
-     * Eg, although we may want capability restrictions relating to deleting
28
-     * datetimes, they don't need to be able to DELETE EVENTS, they just need
29
-     * to be able to EDIT EVENTS in order to DELETE DATETIMES.
30
-     *
31
-     * @var string one of EEM_Base::valid_cap_contexts()
32
-     */
33
-    protected $_cap_context_on_event_model = null;
25
+	/**
26
+	 * Capability context on event model when creating restrictions.
27
+	 * Eg, although we may want capability restrictions relating to deleting
28
+	 * datetimes, they don't need to be able to DELETE EVENTS, they just need
29
+	 * to be able to EDIT EVENTS in order to DELETE DATETIMES.
30
+	 *
31
+	 * @var string one of EEM_Base::valid_cap_contexts()
32
+	 */
33
+	protected $_cap_context_on_event_model = null;
34 34
 
35 35
 
36
-    /**
37
-     * @param string $path_to_event_model
38
-     * @param string $cap_context_on_event_model capability context on event
39
-     *                                           model when creating
40
-     *                                           restrictions. Eg, although we
41
-     *                                           may want capability
42
-     *                                           restrictions relating to
43
-     *                                           deleting datetimes, they don't
44
-     *                                           need to be able to DELETE
45
-     *                                           EVENTS, they just need to be
46
-     *                                           able to EDIT EVENTS in order
47
-     *                                           to DELETE DATETIMES. If none
48
-     *                                           if provided, assumed to be the
49
-     *                                           same as on the primary model.
50
-     */
51
-    public function __construct(
52
-        string $path_to_event_model,
53
-        string $cap_context_on_event_model = ''
54
-    ) {
55
-        if (substr($path_to_event_model, -1, 1) != '.') {
56
-            $path_to_event_model .= '.';
57
-        }
58
-        $this->_path_to_event_model = $path_to_event_model;
59
-        $this->_cap_context_on_event_model = $cap_context_on_event_model;
60
-    }
36
+	/**
37
+	 * @param string $path_to_event_model
38
+	 * @param string $cap_context_on_event_model capability context on event
39
+	 *                                           model when creating
40
+	 *                                           restrictions. Eg, although we
41
+	 *                                           may want capability
42
+	 *                                           restrictions relating to
43
+	 *                                           deleting datetimes, they don't
44
+	 *                                           need to be able to DELETE
45
+	 *                                           EVENTS, they just need to be
46
+	 *                                           able to EDIT EVENTS in order
47
+	 *                                           to DELETE DATETIMES. If none
48
+	 *                                           if provided, assumed to be the
49
+	 *                                           same as on the primary model.
50
+	 */
51
+	public function __construct(
52
+		string $path_to_event_model,
53
+		string $cap_context_on_event_model = ''
54
+	) {
55
+		if (substr($path_to_event_model, -1, 1) != '.') {
56
+			$path_to_event_model .= '.';
57
+		}
58
+		$this->_path_to_event_model = $path_to_event_model;
59
+		$this->_cap_context_on_event_model = $cap_context_on_event_model;
60
+	}
61 61
 
62 62
 
63
-    /**
64
-     * Returns `$this->_cap_context_on_event_model`, the relevant action
65
-     * ("read",
66
-     * "read_admin", "edit" or "delete") for the EVENT related to this model.
67
-     *
68
-     * @return string one of EEM_Base::valid_cap_contexts()
69
-     * @throws EE_Error
70
-     * @see EE_Restriction_Generator_Event_Related_Protected::__construct()
71
-     */
72
-    protected function action_for_event(): ?string
73
-    {
74
-        if ($this->_cap_context_on_event_model) {
75
-            return $this->_cap_context_on_event_model;
76
-        } else {
77
-            return $this->action();
78
-        }
79
-    }
63
+	/**
64
+	 * Returns `$this->_cap_context_on_event_model`, the relevant action
65
+	 * ("read",
66
+	 * "read_admin", "edit" or "delete") for the EVENT related to this model.
67
+	 *
68
+	 * @return string one of EEM_Base::valid_cap_contexts()
69
+	 * @throws EE_Error
70
+	 * @see EE_Restriction_Generator_Event_Related_Protected::__construct()
71
+	 */
72
+	protected function action_for_event(): ?string
73
+	{
74
+		if ($this->_cap_context_on_event_model) {
75
+			return $this->_cap_context_on_event_model;
76
+		} else {
77
+			return $this->action();
78
+		}
79
+	}
80 80
 
81 81
 
82
-    /**
83
-     * @return EE_Default_Where_Conditions[]|EE_Return_None_Where_Conditions[]
84
-     * @throws EE_Error
85
-     * @throws EE_Error
86
-     */
87
-    protected function _generate_restrictions(): array
88
-    {
89
-        // if there are no standard caps for this model, then for now
90
-        // all we know if they need the default cap to access this
91
-        if (! $this->model()->cap_slug()) {
92
-            return [
93
-                self::get_default_restrictions_cap(
94
-                ) => new EE_Return_None_Where_Conditions(),
95
-            ];
96
-        }
82
+	/**
83
+	 * @return EE_Default_Where_Conditions[]|EE_Return_None_Where_Conditions[]
84
+	 * @throws EE_Error
85
+	 * @throws EE_Error
86
+	 */
87
+	protected function _generate_restrictions(): array
88
+	{
89
+		// if there are no standard caps for this model, then for now
90
+		// all we know if they need the default cap to access this
91
+		if (! $this->model()->cap_slug()) {
92
+			return [
93
+				self::get_default_restrictions_cap(
94
+				) => new EE_Return_None_Where_Conditions(),
95
+			];
96
+		}
97 97
 
98
-        $event_model = EEM_Event::instance();
99
-        return [
100
-            // first: basically access to non-defaults is essentially
101
-            // controlled by which events are accessible
102
-            // if they don't have the basic event cap,
103
-            // they can't access ANY non-default items
104
-            EE_Restriction_Generator_Base::get_cap_name(
105
-                $event_model,
106
-                $this->action_for_event()
107
-            ) => new EE_Return_None_Where_Conditions(),
108
-            // if they don't have the others event cap,
109
-            // they can't access others' non-default items
110
-            EE_Restriction_Generator_Base::get_cap_name(
111
-                $event_model,
112
-                $this->action_for_event() . '_others'
113
-            ) => new EE_Default_Where_Conditions(
114
-                [
115
-                    $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
116
-                ]
117
-            ),
118
-            // if they have basic and others, but not private,
119
-            // they can't access others' private non-default items
120
-            EE_Restriction_Generator_Base::get_cap_name(
121
-                $event_model,
122
-                $this->action_for_event() . '_private'
123
-            ) => new EE_Default_Where_Conditions(
124
-                [
125
-                    'OR*no_' .
126
-                    EE_Restriction_Generator_Base::get_cap_name(
127
-                        $event_model,
128
-                        $this->action_for_event() . '_private'
129
-                    ) => $this->addPublishedPostConditions(
130
-                        [
131
-                            $this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
132
-                        ],
133
-                        false,
134
-                        $this->_path_to_event_model
135
-                    )
136
-                ]
137
-            ),
138
-        ];
139
-    }
98
+		$event_model = EEM_Event::instance();
99
+		return [
100
+			// first: basically access to non-defaults is essentially
101
+			// controlled by which events are accessible
102
+			// if they don't have the basic event cap,
103
+			// they can't access ANY non-default items
104
+			EE_Restriction_Generator_Base::get_cap_name(
105
+				$event_model,
106
+				$this->action_for_event()
107
+			) => new EE_Return_None_Where_Conditions(),
108
+			// if they don't have the others event cap,
109
+			// they can't access others' non-default items
110
+			EE_Restriction_Generator_Base::get_cap_name(
111
+				$event_model,
112
+				$this->action_for_event() . '_others'
113
+			) => new EE_Default_Where_Conditions(
114
+				[
115
+					$this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
116
+				]
117
+			),
118
+			// if they have basic and others, but not private,
119
+			// they can't access others' private non-default items
120
+			EE_Restriction_Generator_Base::get_cap_name(
121
+				$event_model,
122
+				$this->action_for_event() . '_private'
123
+			) => new EE_Default_Where_Conditions(
124
+				[
125
+					'OR*no_' .
126
+					EE_Restriction_Generator_Base::get_cap_name(
127
+						$event_model,
128
+						$this->action_for_event() . '_private'
129
+					) => $this->addPublishedPostConditions(
130
+						[
131
+							$this->_path_to_event_model . 'EVT_wp_user' => EE_QUERY_PLACEHOLDER_CURRENT_USER,
132
+						],
133
+						false,
134
+						$this->_path_to_event_model
135
+					)
136
+				]
137
+			),
138
+		];
139
+	}
140 140
 }
Please login to merge, or discard this patch.