Completed
Branch BUG/cpt-model-names (731ee5)
by
unknown
06:20 queued 02:58
created
core/domain/entities/custom_post_types/CustomPostTypeDefinitions.php 2 patches
Indentation   +264 added lines, -264 removed lines patch added patch discarded remove patch
@@ -17,288 +17,288 @@
 block discarded – undo
17 17
 class CustomPostTypeDefinitions
18 18
 {
19 19
 
20
-    /**
21
-     * @var EE_Core_Config
22
-     */
23
-    public $core_config;
20
+	/**
21
+	 * @var EE_Core_Config
22
+	 */
23
+	public $core_config;
24 24
 
25
-    /**
26
-     * @var array $custom_post_types
27
-     */
28
-    private $custom_post_types;
25
+	/**
26
+	 * @var array $custom_post_types
27
+	 */
28
+	private $custom_post_types;
29 29
 
30
-    /**
31
-     * @var LoaderInterface $loader
32
-     */
33
-    private $loader;
30
+	/**
31
+	 * @var LoaderInterface $loader
32
+	 */
33
+	private $loader;
34 34
 
35 35
 
36
-    /**
37
-     * EspressoCustomPostTypeDefinitions constructor.
38
-     *
39
-     * @param EE_Core_Config  $core_config
40
-     * @param LoaderInterface $loader
41
-     */
42
-    public function __construct(EE_Core_Config $core_config, LoaderInterface $loader)
43
-    {
44
-        $this->core_config = $core_config;
45
-        $this->loader = $loader;
46
-        $this->setDefinitions();
47
-    }
36
+	/**
37
+	 * EspressoCustomPostTypeDefinitions constructor.
38
+	 *
39
+	 * @param EE_Core_Config  $core_config
40
+	 * @param LoaderInterface $loader
41
+	 */
42
+	public function __construct(EE_Core_Config $core_config, LoaderInterface $loader)
43
+	{
44
+		$this->core_config = $core_config;
45
+		$this->loader = $loader;
46
+		$this->setDefinitions();
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * defines Espresso Custom Post Types
52
-     * NOTE the ['args']['page_templates'] array index is something specific to our CPTs
53
-     * and not part of the WP custom post type api.
54
-     *
55
-     * @return void
56
-     */
57
-    private function setDefinitions()
58
-    {
59
-        $this->custom_post_types = array(
60
-            'espresso_events'    => array(
61
-                'singular_name' => esc_html__('Event', 'event_espresso'),
62
-                'plural_name'   => esc_html__('Events', 'event_espresso'),
63
-                'singular_slug' => esc_html__('event', 'event_espresso'),
64
-                'plural_slug'   => $this->core_config->event_cpt_slug,
65
-                'class_name'    => 'EE_Event',
66
-                'model_name'    => 'EEM_Event',
67
-                'args'          => array(
68
-                    'public'            => true,
69
-                    'show_in_nav_menus' => true,
70
-                    'capability_type'   => 'event',
71
-                    'capabilities'      => array(
72
-                        'edit_post'              => 'ee_edit_event',
73
-                        'read_post'              => 'ee_read_event',
74
-                        'delete_post'            => 'ee_delete_event',
75
-                        'edit_posts'             => 'ee_edit_events',
76
-                        'edit_others_posts'      => 'ee_edit_others_events',
77
-                        'publish_posts'          => 'ee_publish_events',
78
-                        'read_private_posts'     => 'ee_read_private_events',
79
-                        'delete_posts'           => 'ee_delete_events',
80
-                        'delete_private_posts'   => 'ee_delete_private_events',
81
-                        'delete_published_posts' => 'ee_delete_published_events',
82
-                        'delete_others_posts'    => 'ee_delete_others_events',
83
-                        'edit_private_posts'     => 'ee_edit_private_events',
84
-                        'edit_published_posts'   => 'ee_edit_published_events',
85
-                    ),
86
-                    'taxonomies'        => array(
87
-                        'espresso_event_categories',
88
-                        'espresso_event_type',
89
-                        'post_tag',
90
-                    ),
91
-                    'page_templates'    => true,
92
-                ),
93
-            ),
94
-            'espresso_venues'    => array(
95
-                'singular_name' => esc_html__('Venue', 'event_espresso'),
96
-                'plural_name'   => esc_html__('Venues', 'event_espresso'),
97
-                'singular_slug' => esc_html__('venue', 'event_espresso'),
98
-                'plural_slug'   => esc_html__('venues', 'event_espresso'),
99
-                'class_name'    => 'EE_Venue',
100
-                'model_name'    => 'EEM_Venue',
101
-                'args'          => array(
102
-                    'public'            => true,
103
-                    'show_in_nav_menus' => false, // by default this doesn't show for decaf,
104
-                    'capability_type'   => 'venue',
105
-                    'capabilities'      => array(
106
-                        'edit_post'              => 'ee_edit_venue',
107
-                        'read_post'              => 'ee_read_venue',
108
-                        'delete_post'            => 'ee_delete_venue',
109
-                        'edit_posts'             => 'ee_edit_venues',
110
-                        'edit_others_posts'      => 'ee_edit_others_venues',
111
-                        'publish_posts'          => 'ee_publish_venues',
112
-                        'read_private_posts'     => 'ee_read_private_venues',
113
-                        'delete_posts'           => 'ee_delete_venues',
114
-                        'delete_private_posts'   => 'ee_delete_private_venues',
115
-                        'delete_published_posts' => 'ee_delete_published_venues',
116
-                        'delete_others_posts'    => 'ee_edit_others_venues',
117
-                        'edit_private_posts'     => 'ee_edit_private_venues',
118
-                        'edit_published_posts'   => 'ee_edit_published_venues',
119
-                    ),
120
-                    'taxonomies'        => array(
121
-                        'espresso_venue_categories',
122
-                        'post_tag',
123
-                    ),
124
-                    'page_templates'    => true,
125
-                ),
126
-            ),
127
-            'espresso_attendees' => array(
128
-                'singular_name' => esc_html__('Contact', 'event_espresso'),
129
-                'plural_name'   => esc_html__('Contacts', 'event_espresso'),
130
-                'singular_slug' => esc_html__('contact', 'event_espresso'),
131
-                'plural_slug'   => esc_html__('contacts', 'event_espresso'),
132
-                'class_name'    => 'EE_Attendee',
133
-                'model_name'    => 'EEM_Attendee',
134
-                'args'          => array(
135
-                    'public'             => false,
136
-                    'publicly_queryable' => false,
137
-                    'hierarchical'       => false,
138
-                    'has_archive'        => false,
139
-                    'supports'           => array(
140
-                        'editor',
141
-                        'thumbnail',
142
-                        'excerpt',
143
-                        'custom-fields',
144
-                        'comments',
145
-                    ),
146
-                    'taxonomies'         => array('post_tag'),
147
-                    'capability_type'    => 'contact',
148
-                    'capabilities'       => array(
149
-                        'edit_post'              => 'ee_edit_contact',
150
-                        'read_post'              => 'ee_read_contact',
151
-                        'delete_post'            => 'ee_delete_contact',
152
-                        'edit_posts'             => 'ee_edit_contacts',
153
-                        'edit_others_posts'      => 'ee_edit_contacts',
154
-                        'publish_posts'          => 'ee_edit_contacts',
155
-                        'read_private_posts'     => 'ee_edit_contacts',
156
-                        'delete_posts'           => 'ee_delete_contacts',
157
-                        'delete_private_posts'   => 'ee_delete_contacts',
158
-                        'delete_published_posts' => 'ee_delete_contacts',
159
-                        'delete_others_posts'    => 'ee_delete_contacts',
160
-                        'edit_private_posts'     => 'ee_edit_contacts',
161
-                        'edit_published_posts'   => 'ee_edit_contacts',
162
-                    ),
163
-                ),
164
-            ),
165
-        );
166
-    }
50
+	/**
51
+	 * defines Espresso Custom Post Types
52
+	 * NOTE the ['args']['page_templates'] array index is something specific to our CPTs
53
+	 * and not part of the WP custom post type api.
54
+	 *
55
+	 * @return void
56
+	 */
57
+	private function setDefinitions()
58
+	{
59
+		$this->custom_post_types = array(
60
+			'espresso_events'    => array(
61
+				'singular_name' => esc_html__('Event', 'event_espresso'),
62
+				'plural_name'   => esc_html__('Events', 'event_espresso'),
63
+				'singular_slug' => esc_html__('event', 'event_espresso'),
64
+				'plural_slug'   => $this->core_config->event_cpt_slug,
65
+				'class_name'    => 'EE_Event',
66
+				'model_name'    => 'EEM_Event',
67
+				'args'          => array(
68
+					'public'            => true,
69
+					'show_in_nav_menus' => true,
70
+					'capability_type'   => 'event',
71
+					'capabilities'      => array(
72
+						'edit_post'              => 'ee_edit_event',
73
+						'read_post'              => 'ee_read_event',
74
+						'delete_post'            => 'ee_delete_event',
75
+						'edit_posts'             => 'ee_edit_events',
76
+						'edit_others_posts'      => 'ee_edit_others_events',
77
+						'publish_posts'          => 'ee_publish_events',
78
+						'read_private_posts'     => 'ee_read_private_events',
79
+						'delete_posts'           => 'ee_delete_events',
80
+						'delete_private_posts'   => 'ee_delete_private_events',
81
+						'delete_published_posts' => 'ee_delete_published_events',
82
+						'delete_others_posts'    => 'ee_delete_others_events',
83
+						'edit_private_posts'     => 'ee_edit_private_events',
84
+						'edit_published_posts'   => 'ee_edit_published_events',
85
+					),
86
+					'taxonomies'        => array(
87
+						'espresso_event_categories',
88
+						'espresso_event_type',
89
+						'post_tag',
90
+					),
91
+					'page_templates'    => true,
92
+				),
93
+			),
94
+			'espresso_venues'    => array(
95
+				'singular_name' => esc_html__('Venue', 'event_espresso'),
96
+				'plural_name'   => esc_html__('Venues', 'event_espresso'),
97
+				'singular_slug' => esc_html__('venue', 'event_espresso'),
98
+				'plural_slug'   => esc_html__('venues', 'event_espresso'),
99
+				'class_name'    => 'EE_Venue',
100
+				'model_name'    => 'EEM_Venue',
101
+				'args'          => array(
102
+					'public'            => true,
103
+					'show_in_nav_menus' => false, // by default this doesn't show for decaf,
104
+					'capability_type'   => 'venue',
105
+					'capabilities'      => array(
106
+						'edit_post'              => 'ee_edit_venue',
107
+						'read_post'              => 'ee_read_venue',
108
+						'delete_post'            => 'ee_delete_venue',
109
+						'edit_posts'             => 'ee_edit_venues',
110
+						'edit_others_posts'      => 'ee_edit_others_venues',
111
+						'publish_posts'          => 'ee_publish_venues',
112
+						'read_private_posts'     => 'ee_read_private_venues',
113
+						'delete_posts'           => 'ee_delete_venues',
114
+						'delete_private_posts'   => 'ee_delete_private_venues',
115
+						'delete_published_posts' => 'ee_delete_published_venues',
116
+						'delete_others_posts'    => 'ee_edit_others_venues',
117
+						'edit_private_posts'     => 'ee_edit_private_venues',
118
+						'edit_published_posts'   => 'ee_edit_published_venues',
119
+					),
120
+					'taxonomies'        => array(
121
+						'espresso_venue_categories',
122
+						'post_tag',
123
+					),
124
+					'page_templates'    => true,
125
+				),
126
+			),
127
+			'espresso_attendees' => array(
128
+				'singular_name' => esc_html__('Contact', 'event_espresso'),
129
+				'plural_name'   => esc_html__('Contacts', 'event_espresso'),
130
+				'singular_slug' => esc_html__('contact', 'event_espresso'),
131
+				'plural_slug'   => esc_html__('contacts', 'event_espresso'),
132
+				'class_name'    => 'EE_Attendee',
133
+				'model_name'    => 'EEM_Attendee',
134
+				'args'          => array(
135
+					'public'             => false,
136
+					'publicly_queryable' => false,
137
+					'hierarchical'       => false,
138
+					'has_archive'        => false,
139
+					'supports'           => array(
140
+						'editor',
141
+						'thumbnail',
142
+						'excerpt',
143
+						'custom-fields',
144
+						'comments',
145
+					),
146
+					'taxonomies'         => array('post_tag'),
147
+					'capability_type'    => 'contact',
148
+					'capabilities'       => array(
149
+						'edit_post'              => 'ee_edit_contact',
150
+						'read_post'              => 'ee_read_contact',
151
+						'delete_post'            => 'ee_delete_contact',
152
+						'edit_posts'             => 'ee_edit_contacts',
153
+						'edit_others_posts'      => 'ee_edit_contacts',
154
+						'publish_posts'          => 'ee_edit_contacts',
155
+						'read_private_posts'     => 'ee_edit_contacts',
156
+						'delete_posts'           => 'ee_delete_contacts',
157
+						'delete_private_posts'   => 'ee_delete_contacts',
158
+						'delete_published_posts' => 'ee_delete_contacts',
159
+						'delete_others_posts'    => 'ee_delete_contacts',
160
+						'edit_private_posts'     => 'ee_edit_contacts',
161
+						'edit_published_posts'   => 'ee_edit_contacts',
162
+					),
163
+				),
164
+			),
165
+		);
166
+	}
167 167
 
168 168
 
169
-    /**
170
-     * @return array
171
-     */
172
-    public function getDefinitions()
173
-    {
174
-        return (array) apply_filters(
175
-            'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes',
176
-            // legacy filter applied for now,
177
-            // later on we'll run a has_filter($tag) check and throw a doing_it_wrong() notice
178
-            apply_filters(
179
-                'FHEE__EE_Register_CPTs__get_CPTs__cpts',
180
-                $this->custom_post_types
181
-            )
182
-        );
183
-    }
169
+	/**
170
+	 * @return array
171
+	 */
172
+	public function getDefinitions()
173
+	{
174
+		return (array) apply_filters(
175
+			'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes',
176
+			// legacy filter applied for now,
177
+			// later on we'll run a has_filter($tag) check and throw a doing_it_wrong() notice
178
+			apply_filters(
179
+				'FHEE__EE_Register_CPTs__get_CPTs__cpts',
180
+				$this->custom_post_types
181
+			)
182
+		);
183
+	}
184 184
 
185 185
 
186
-    /**
187
-     * @return array
188
-     */
189
-    public function getCustomPostTypeSlugs()
190
-    {
191
-        return array_keys($this->getDefinitions());
192
-    }
186
+	/**
187
+	 * @return array
188
+	 */
189
+	public function getCustomPostTypeSlugs()
190
+	{
191
+		return array_keys($this->getDefinitions());
192
+	}
193 193
 
194 194
 
195
-    /**
196
-     * This basically goes through the CPT array and returns only CPT's
197
-     * that have the ['args']['public'] option set as false
198
-     *
199
-     * @return array
200
-     */
201
-    public function getPrivateCustomPostTypes()
202
-    {
203
-        $private_CPTs = array();
204
-        foreach ($this->getDefinitions() as $CPT => $details) {
205
-            if (empty($details['args']['public'])) {
206
-                $private_CPTs[ $CPT ] = $details;
207
-            }
208
-        }
209
-        return $private_CPTs;
210
-    }
195
+	/**
196
+	 * This basically goes through the CPT array and returns only CPT's
197
+	 * that have the ['args']['public'] option set as false
198
+	 *
199
+	 * @return array
200
+	 */
201
+	public function getPrivateCustomPostTypes()
202
+	{
203
+		$private_CPTs = array();
204
+		foreach ($this->getDefinitions() as $CPT => $details) {
205
+			if (empty($details['args']['public'])) {
206
+				$private_CPTs[ $CPT ] = $details;
207
+			}
208
+		}
209
+		return $private_CPTs;
210
+	}
211 211
 
212 212
 
213
-    /**
214
-     * This returns the corresponding model name for cpts registered by EE.
215
-     *
216
-     * @param string $post_type_slug    If a slug is included, then attempt to retrieve
217
-     *                                  the model name for the given cpt slug.
218
-     *                                  Otherwise if empty, then we'll return
219
-     *                                  all cpt model names for cpts registered in EE.
220
-     * @return array                    Empty array if no matching model names for the given slug
221
-     *                                  or an array of model names indexed by post type slug.
222
-     */
223
-    public function getCustomPostTypeModelNames($post_type_slug = '')
224
-    {
225
-        $cpts = $this->getDefinitions();
226
-        // first if slug passed in...
227
-        if (! empty($post_type_slug)) {
228
-            // check that slug and cpt match
229
-            if (! isset($cpts[ $post_type_slug ])) {
230
-                return array();
231
-            }
232
-            if (
233
-                empty($cpts[ $post_type_slug ]['class_name'])
234
-                && empty($cpts[ $post_type_slug ]['model_name'])
235
-            ) {
236
-                return array();
237
-            }
238
-            // k let's get the model name for this cpt.
239
-            return $this->getCustomPostTypeModelName($post_type_slug, $cpts[ $post_type_slug ]);
240
-        }
241
-        // if we made it here then we're returning an array of cpt model names indexed by post_type_slug.
242
-        $cpt_models = array();
243
-        foreach ($cpts as $slug => $args) {
244
-            $model = $this->getCustomPostTypeModelName($slug, $args);
245
-            if (! empty($model)) {
246
-                $cpt_models[ $slug ] = $model;
247
-            }
248
-        }
249
-        return $cpt_models;
250
-    }
213
+	/**
214
+	 * This returns the corresponding model name for cpts registered by EE.
215
+	 *
216
+	 * @param string $post_type_slug    If a slug is included, then attempt to retrieve
217
+	 *                                  the model name for the given cpt slug.
218
+	 *                                  Otherwise if empty, then we'll return
219
+	 *                                  all cpt model names for cpts registered in EE.
220
+	 * @return array                    Empty array if no matching model names for the given slug
221
+	 *                                  or an array of model names indexed by post type slug.
222
+	 */
223
+	public function getCustomPostTypeModelNames($post_type_slug = '')
224
+	{
225
+		$cpts = $this->getDefinitions();
226
+		// first if slug passed in...
227
+		if (! empty($post_type_slug)) {
228
+			// check that slug and cpt match
229
+			if (! isset($cpts[ $post_type_slug ])) {
230
+				return array();
231
+			}
232
+			if (
233
+				empty($cpts[ $post_type_slug ]['class_name'])
234
+				&& empty($cpts[ $post_type_slug ]['model_name'])
235
+			) {
236
+				return array();
237
+			}
238
+			// k let's get the model name for this cpt.
239
+			return $this->getCustomPostTypeModelName($post_type_slug, $cpts[ $post_type_slug ]);
240
+		}
241
+		// if we made it here then we're returning an array of cpt model names indexed by post_type_slug.
242
+		$cpt_models = array();
243
+		foreach ($cpts as $slug => $args) {
244
+			$model = $this->getCustomPostTypeModelName($slug, $args);
245
+			if (! empty($model)) {
246
+				$cpt_models[ $slug ] = $model;
247
+			}
248
+		}
249
+		return $cpt_models;
250
+	}
251 251
 
252 252
 
253
-    /**
254
-     * @param       $post_type_slug
255
-     * @param array $cpt
256
-     * @return array
257
-     */
258
-    private function getCustomPostTypeModelName($post_type_slug, array $cpt)
259
-    {
260
-        if (! empty($cpt['model_name'])) {
261
-            return array($post_type_slug => $cpt['model_name']);
262
-        }
263
-        if (! empty($cpt['class_name'])) {
264
-            return array(
265
-                $post_type_slug => $this->deriveCptModelNameFromClassName($cpt['class_name']),
266
-            );
267
-        }
268
-        return array();
269
-    }
253
+	/**
254
+	 * @param       $post_type_slug
255
+	 * @param array $cpt
256
+	 * @return array
257
+	 */
258
+	private function getCustomPostTypeModelName($post_type_slug, array $cpt)
259
+	{
260
+		if (! empty($cpt['model_name'])) {
261
+			return array($post_type_slug => $cpt['model_name']);
262
+		}
263
+		if (! empty($cpt['class_name'])) {
264
+			return array(
265
+				$post_type_slug => $this->deriveCptModelNameFromClassName($cpt['class_name']),
266
+			);
267
+		}
268
+		return array();
269
+	}
270 270
 
271 271
 
272
-    /**
273
-     * @param string $class_name
274
-     * @return string
275
-     */
276
-    private function deriveCptModelNameFromClassName($class_name)
277
-    {
278
-        return str_replace('EE', 'EEM', $class_name);
279
-    }
272
+	/**
273
+	 * @param string $class_name
274
+	 * @return string
275
+	 */
276
+	private function deriveCptModelNameFromClassName($class_name)
277
+	{
278
+		return str_replace('EE', 'EEM', $class_name);
279
+	}
280 280
 
281 281
 
282
-    /**
283
-     * This instantiates cpt models related to the cpts registered via EE.
284
-     *
285
-     * @since 4.6.16.rc.000
286
-     * @param string $post_type_slug If valid slug is provided, then will instantiate the model only for
287
-     *                               the cpt matching the given slug.  Otherwise all cpt models will be
288
-     *                               instantiated (if possible).
289
-     * @return EEM_CPT_Base[]        successful instantiation will return an array of successfully instantiated
290
-     *                               EEM models indexed by post slug.
291
-     */
292
-    public function getCustomPostTypeModels($post_type_slug = '')
293
-    {
294
-        $cpt_model_names = $this->getCustomPostTypeModelNames($post_type_slug);
295
-        $instantiated = array();
296
-        foreach ($cpt_model_names as $slug => $model_name) {
297
-            $model = $this->loader->getShared($model_name);
298
-            if ($model instanceof EEM_CPT_Base) {
299
-                $instantiated[ $slug ] = $model;
300
-            }
301
-        }
302
-        return $instantiated;
303
-    }
282
+	/**
283
+	 * This instantiates cpt models related to the cpts registered via EE.
284
+	 *
285
+	 * @since 4.6.16.rc.000
286
+	 * @param string $post_type_slug If valid slug is provided, then will instantiate the model only for
287
+	 *                               the cpt matching the given slug.  Otherwise all cpt models will be
288
+	 *                               instantiated (if possible).
289
+	 * @return EEM_CPT_Base[]        successful instantiation will return an array of successfully instantiated
290
+	 *                               EEM models indexed by post slug.
291
+	 */
292
+	public function getCustomPostTypeModels($post_type_slug = '')
293
+	{
294
+		$cpt_model_names = $this->getCustomPostTypeModelNames($post_type_slug);
295
+		$instantiated = array();
296
+		foreach ($cpt_model_names as $slug => $model_name) {
297
+			$model = $this->loader->getShared($model_name);
298
+			if ($model instanceof EEM_CPT_Base) {
299
+				$instantiated[ $slug ] = $model;
300
+			}
301
+		}
302
+		return $instantiated;
303
+	}
304 304
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         $private_CPTs = array();
204 204
         foreach ($this->getDefinitions() as $CPT => $details) {
205 205
             if (empty($details['args']['public'])) {
206
-                $private_CPTs[ $CPT ] = $details;
206
+                $private_CPTs[$CPT] = $details;
207 207
             }
208 208
         }
209 209
         return $private_CPTs;
@@ -224,26 +224,26 @@  discard block
 block discarded – undo
224 224
     {
225 225
         $cpts = $this->getDefinitions();
226 226
         // first if slug passed in...
227
-        if (! empty($post_type_slug)) {
227
+        if ( ! empty($post_type_slug)) {
228 228
             // check that slug and cpt match
229
-            if (! isset($cpts[ $post_type_slug ])) {
229
+            if ( ! isset($cpts[$post_type_slug])) {
230 230
                 return array();
231 231
             }
232 232
             if (
233
-                empty($cpts[ $post_type_slug ]['class_name'])
234
-                && empty($cpts[ $post_type_slug ]['model_name'])
233
+                empty($cpts[$post_type_slug]['class_name'])
234
+                && empty($cpts[$post_type_slug]['model_name'])
235 235
             ) {
236 236
                 return array();
237 237
             }
238 238
             // k let's get the model name for this cpt.
239
-            return $this->getCustomPostTypeModelName($post_type_slug, $cpts[ $post_type_slug ]);
239
+            return $this->getCustomPostTypeModelName($post_type_slug, $cpts[$post_type_slug]);
240 240
         }
241 241
         // if we made it here then we're returning an array of cpt model names indexed by post_type_slug.
242 242
         $cpt_models = array();
243 243
         foreach ($cpts as $slug => $args) {
244 244
             $model = $this->getCustomPostTypeModelName($slug, $args);
245
-            if (! empty($model)) {
246
-                $cpt_models[ $slug ] = $model;
245
+            if ( ! empty($model)) {
246
+                $cpt_models[$slug] = $model;
247 247
             }
248 248
         }
249 249
         return $cpt_models;
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
      */
258 258
     private function getCustomPostTypeModelName($post_type_slug, array $cpt)
259 259
     {
260
-        if (! empty($cpt['model_name'])) {
260
+        if ( ! empty($cpt['model_name'])) {
261 261
             return array($post_type_slug => $cpt['model_name']);
262 262
         }
263
-        if (! empty($cpt['class_name'])) {
263
+        if ( ! empty($cpt['class_name'])) {
264 264
             return array(
265 265
                 $post_type_slug => $this->deriveCptModelNameFromClassName($cpt['class_name']),
266 266
             );
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         foreach ($cpt_model_names as $slug => $model_name) {
297 297
             $model = $this->loader->getShared($model_name);
298 298
             if ($model instanceof EEM_CPT_Base) {
299
-                $instantiated[ $slug ] = $model;
299
+                $instantiated[$slug] = $model;
300 300
             }
301 301
         }
302 302
         return $instantiated;
Please login to merge, or discard this patch.