Completed
Branch BUG/fix-table-exists-query (7059df)
by
unknown
09:49 queued 07:55
created
core/libraries/plugin_api/EE_Register_Shortcode.lib.php 2 patches
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -20,157 +20,157 @@
 block discarded – undo
20 20
 class EE_Register_Shortcode implements EEI_Plugin_API
21 21
 {
22 22
 
23
-    /**
24
-     * Holds values for registered shortcodes
25
-     *
26
-     * @var array
27
-     */
28
-    protected static $_settings = [];
23
+	/**
24
+	 * Holds values for registered shortcodes
25
+	 *
26
+	 * @var array
27
+	 */
28
+	protected static $_settings = [];
29 29
 
30 30
 
31
-    /**
32
-     *    Method for registering new EE_Shortcodes
33
-     *
34
-     * @param string $identifier    a unique identifier for this set of modules Required.
35
-     * @param array  $setup_args    an array of arguments provided for registering shortcodes Required.
36
-     * @type array shortcode_paths  an array of full server paths to folders containing any EES_Shortcodes
37
-     * @type array shortcode_fqcns  an array of fully qualified class names for any new shortcode classes to register.
38
-     *                              Shortcode classes should extend EspressoShortcode
39
-     *                              and be properly namespaced so they are autoloaded.
40
-     * @return void
41
-     * @throws EE_Error
42
-     * @since    4.3.0
43
-     * @since    4.9.46.rc.025  for the new `shortcode_fqcns` array argument.
44
-     */
45
-    public static function register($identifier = '', array $setup_args = [])
46
-    {
47
-        // required fields MUST be present, so let's make sure they are.
48
-        if (empty($identifier)
49
-            || ! is_array($setup_args)
50
-            || (
51
-               empty($setup_args['shortcode_paths']))
52
-               && empty($setup_args['shortcode_fqcns'])
53
-        ) {
54
-            throw new EE_Error(
55
-                esc_html__(
56
-                    'In order to register Modules with EE_Register_Shortcode::register(), you must include a "shortcode_id" (a unique identifier for this set of shortcodes), and an array containing the following keys: "shortcode_paths" (an array of full server paths to folders that contain shortcodes, or to the shortcode files themselves)',
57
-                    'event_espresso'
58
-                )
59
-            );
60
-        }
31
+	/**
32
+	 *    Method for registering new EE_Shortcodes
33
+	 *
34
+	 * @param string $identifier    a unique identifier for this set of modules Required.
35
+	 * @param array  $setup_args    an array of arguments provided for registering shortcodes Required.
36
+	 * @type array shortcode_paths  an array of full server paths to folders containing any EES_Shortcodes
37
+	 * @type array shortcode_fqcns  an array of fully qualified class names for any new shortcode classes to register.
38
+	 *                              Shortcode classes should extend EspressoShortcode
39
+	 *                              and be properly namespaced so they are autoloaded.
40
+	 * @return void
41
+	 * @throws EE_Error
42
+	 * @since    4.3.0
43
+	 * @since    4.9.46.rc.025  for the new `shortcode_fqcns` array argument.
44
+	 */
45
+	public static function register($identifier = '', array $setup_args = [])
46
+	{
47
+		// required fields MUST be present, so let's make sure they are.
48
+		if (empty($identifier)
49
+			|| ! is_array($setup_args)
50
+			|| (
51
+			   empty($setup_args['shortcode_paths']))
52
+			   && empty($setup_args['shortcode_fqcns'])
53
+		) {
54
+			throw new EE_Error(
55
+				esc_html__(
56
+					'In order to register Modules with EE_Register_Shortcode::register(), you must include a "shortcode_id" (a unique identifier for this set of shortcodes), and an array containing the following keys: "shortcode_paths" (an array of full server paths to folders that contain shortcodes, or to the shortcode files themselves)',
57
+					'event_espresso'
58
+				)
59
+			);
60
+		}
61 61
 
62
-        // make sure we don't register twice
63
-        if (isset(self::$_settings[ $identifier ])) {
64
-            return;
65
-        }
62
+		// make sure we don't register twice
63
+		if (isset(self::$_settings[ $identifier ])) {
64
+			return;
65
+		}
66 66
 
67
-        // make sure this was called in the right place!
68
-        if (! did_action('AHEE__EE_System__load_espresso_addons')
69
-            || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')
70
-        ) {
71
-            EE_Error::doing_it_wrong(
72
-                __METHOD__,
73
-                esc_html__(
74
-                    'An attempt to register shortcodes has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register shortcodes.',
75
-                    'event_espresso'
76
-                ),
77
-                '4.3.0'
78
-            );
79
-        }
80
-        // setup $_settings array from incoming values.
81
-        self::$_settings[ $identifier ] = [
82
-            // array of full server paths to any EES_Shortcodes used by the shortcode
83
-            'shortcode_paths' => isset($setup_args['shortcode_paths'])
84
-                ? (array) $setup_args['shortcode_paths']
85
-                : [],
86
-            'shortcode_fqcns' => isset($setup_args['shortcode_fqcns'])
87
-                ? (array) $setup_args['shortcode_fqcns']
88
-                : [],
89
-        ];
90
-        // add to list of shortcodes to be registered
91
-        add_filter(
92
-            'FHEE__EE_Config__register_shortcodes__shortcodes_to_register',
93
-            ['EE_Register_Shortcode', 'add_shortcodes']
94
-        );
67
+		// make sure this was called in the right place!
68
+		if (! did_action('AHEE__EE_System__load_espresso_addons')
69
+			|| did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')
70
+		) {
71
+			EE_Error::doing_it_wrong(
72
+				__METHOD__,
73
+				esc_html__(
74
+					'An attempt to register shortcodes has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register shortcodes.',
75
+					'event_espresso'
76
+				),
77
+				'4.3.0'
78
+			);
79
+		}
80
+		// setup $_settings array from incoming values.
81
+		self::$_settings[ $identifier ] = [
82
+			// array of full server paths to any EES_Shortcodes used by the shortcode
83
+			'shortcode_paths' => isset($setup_args['shortcode_paths'])
84
+				? (array) $setup_args['shortcode_paths']
85
+				: [],
86
+			'shortcode_fqcns' => isset($setup_args['shortcode_fqcns'])
87
+				? (array) $setup_args['shortcode_fqcns']
88
+				: [],
89
+		];
90
+		// add to list of shortcodes to be registered
91
+		add_filter(
92
+			'FHEE__EE_Config__register_shortcodes__shortcodes_to_register',
93
+			['EE_Register_Shortcode', 'add_shortcodes']
94
+		);
95 95
 
96
-        add_filter(
97
-            'FHEE__EventEspresso_core_services_shortcodes_ShortcodesManager__registerShortcodes__shortcode_collection',
98
-            ['EE_Register_Shortcode', 'instantiateAndAddToShortcodeCollection']
99
-        );
100
-    }
96
+		add_filter(
97
+			'FHEE__EventEspresso_core_services_shortcodes_ShortcodesManager__registerShortcodes__shortcode_collection',
98
+			['EE_Register_Shortcode', 'instantiateAndAddToShortcodeCollection']
99
+		);
100
+	}
101 101
 
102 102
 
103
-    /**
104
-     * Filters the list of shortcodes to add ours.
105
-     * and they're just full filepaths to FOLDERS containing a shortcode class file. Eg.
106
-     * array('espresso_monkey'=>'/public_html/wonder-site/wp-content/plugins/ee4/shortcodes/espresso_monkey'...)
107
-     *
108
-     * @param array $shortcodes_to_register array of paths to all shortcodes that require registering
109
-     * @return array
110
-     */
111
-    public static function add_shortcodes(array $shortcodes_to_register)
112
-    {
113
-        foreach (self::$_settings as $settings) {
114
-            $shortcodes_to_register = array_merge($shortcodes_to_register, $settings['shortcode_paths']);
115
-        }
116
-        return $shortcodes_to_register;
117
-    }
103
+	/**
104
+	 * Filters the list of shortcodes to add ours.
105
+	 * and they're just full filepaths to FOLDERS containing a shortcode class file. Eg.
106
+	 * array('espresso_monkey'=>'/public_html/wonder-site/wp-content/plugins/ee4/shortcodes/espresso_monkey'...)
107
+	 *
108
+	 * @param array $shortcodes_to_register array of paths to all shortcodes that require registering
109
+	 * @return array
110
+	 */
111
+	public static function add_shortcodes(array $shortcodes_to_register)
112
+	{
113
+		foreach (self::$_settings as $settings) {
114
+			$shortcodes_to_register = array_merge($shortcodes_to_register, $settings['shortcode_paths']);
115
+		}
116
+		return $shortcodes_to_register;
117
+	}
118 118
 
119 119
 
120
-    /**
121
-     * Hooks into
122
-     * FHEE__EventEspresso_core_services_shortcodes_ShortcodesManager__registerShortcodes__shortcode_collection and
123
-     * registers any provided shortcode fully qualified class names.
124
-     *
125
-     * @param CollectionInterface $shortcodes_collection
126
-     * @return CollectionInterface
127
-     * @throws InvalidArgumentException
128
-     * @throws InvalidClassException
129
-     * @throws InvalidDataTypeException
130
-     * @throws InvalidInterfaceException
131
-     */
132
-    public static function instantiateAndAddToShortcodeCollection(CollectionInterface $shortcodes_collection)
133
-    {
134
-        foreach (self::$_settings as $settings) {
135
-            if (! empty($settings['shortcode_fqcns'])) {
136
-                foreach ($settings['shortcode_fqcns'] as $shortcode_fqcn) {
137
-                    if (! class_exists($shortcode_fqcn)) {
138
-                        throw new InvalidClassException(
139
-                            sprintf(
140
-                                esc_html__(
141
-                                    'Are you sure %s is the right fully qualified class name for the shortcode class?',
142
-                                    'event_espresso'
143
-                                ),
144
-                                $shortcode_fqcn
145
-                            )
146
-                        );
147
-                    }
148
-                    if (! EE_Dependency_Map::instance()->has_dependency_for_class($shortcode_fqcn)) {
149
-                        // register dependencies
150
-                        EE_Dependency_Map::register_dependencies(
151
-                            $shortcode_fqcn,
152
-                            [
153
-                                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
154
-                            ]
155
-                        );
156
-                    }
157
-                    $shortcodes_collection->add(LoaderFactory::getLoader()->getShared($shortcode_fqcn));
158
-                }
159
-            }
160
-        }
161
-        return $shortcodes_collection;
162
-    }
120
+	/**
121
+	 * Hooks into
122
+	 * FHEE__EventEspresso_core_services_shortcodes_ShortcodesManager__registerShortcodes__shortcode_collection and
123
+	 * registers any provided shortcode fully qualified class names.
124
+	 *
125
+	 * @param CollectionInterface $shortcodes_collection
126
+	 * @return CollectionInterface
127
+	 * @throws InvalidArgumentException
128
+	 * @throws InvalidClassException
129
+	 * @throws InvalidDataTypeException
130
+	 * @throws InvalidInterfaceException
131
+	 */
132
+	public static function instantiateAndAddToShortcodeCollection(CollectionInterface $shortcodes_collection)
133
+	{
134
+		foreach (self::$_settings as $settings) {
135
+			if (! empty($settings['shortcode_fqcns'])) {
136
+				foreach ($settings['shortcode_fqcns'] as $shortcode_fqcn) {
137
+					if (! class_exists($shortcode_fqcn)) {
138
+						throw new InvalidClassException(
139
+							sprintf(
140
+								esc_html__(
141
+									'Are you sure %s is the right fully qualified class name for the shortcode class?',
142
+									'event_espresso'
143
+								),
144
+								$shortcode_fqcn
145
+							)
146
+						);
147
+					}
148
+					if (! EE_Dependency_Map::instance()->has_dependency_for_class($shortcode_fqcn)) {
149
+						// register dependencies
150
+						EE_Dependency_Map::register_dependencies(
151
+							$shortcode_fqcn,
152
+							[
153
+								'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
154
+							]
155
+						);
156
+					}
157
+					$shortcodes_collection->add(LoaderFactory::getLoader()->getShared($shortcode_fqcn));
158
+				}
159
+			}
160
+		}
161
+		return $shortcodes_collection;
162
+	}
163 163
 
164 164
 
165
-    /**
166
-     * This deregisters a shortcode that was previously registered with a specific $identifier.
167
-     *
168
-     * @param string $identifier the name for the shortcode that was previously registered
169
-     * @return void
170
-     * @since    4.3.0
171
-     */
172
-    public static function deregister($identifier = '')
173
-    {
174
-        unset(self::$_settings[ $identifier ]);
175
-    }
165
+	/**
166
+	 * This deregisters a shortcode that was previously registered with a specific $identifier.
167
+	 *
168
+	 * @param string $identifier the name for the shortcode that was previously registered
169
+	 * @return void
170
+	 * @since    4.3.0
171
+	 */
172
+	public static function deregister($identifier = '')
173
+	{
174
+		unset(self::$_settings[ $identifier ]);
175
+	}
176 176
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
         }
61 61
 
62 62
         // make sure we don't register twice
63
-        if (isset(self::$_settings[ $identifier ])) {
63
+        if (isset(self::$_settings[$identifier])) {
64 64
             return;
65 65
         }
66 66
 
67 67
         // make sure this was called in the right place!
68
-        if (! did_action('AHEE__EE_System__load_espresso_addons')
68
+        if ( ! did_action('AHEE__EE_System__load_espresso_addons')
69 69
             || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')
70 70
         ) {
71 71
             EE_Error::doing_it_wrong(
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             );
79 79
         }
80 80
         // setup $_settings array from incoming values.
81
-        self::$_settings[ $identifier ] = [
81
+        self::$_settings[$identifier] = [
82 82
             // array of full server paths to any EES_Shortcodes used by the shortcode
83 83
             'shortcode_paths' => isset($setup_args['shortcode_paths'])
84 84
                 ? (array) $setup_args['shortcode_paths']
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
     public static function instantiateAndAddToShortcodeCollection(CollectionInterface $shortcodes_collection)
133 133
     {
134 134
         foreach (self::$_settings as $settings) {
135
-            if (! empty($settings['shortcode_fqcns'])) {
135
+            if ( ! empty($settings['shortcode_fqcns'])) {
136 136
                 foreach ($settings['shortcode_fqcns'] as $shortcode_fqcn) {
137
-                    if (! class_exists($shortcode_fqcn)) {
137
+                    if ( ! class_exists($shortcode_fqcn)) {
138 138
                         throw new InvalidClassException(
139 139
                             sprintf(
140 140
                                 esc_html__(
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
                             )
146 146
                         );
147 147
                     }
148
-                    if (! EE_Dependency_Map::instance()->has_dependency_for_class($shortcode_fqcn)) {
148
+                    if ( ! EE_Dependency_Map::instance()->has_dependency_for_class($shortcode_fqcn)) {
149 149
                         // register dependencies
150 150
                         EE_Dependency_Map::register_dependencies(
151 151
                             $shortcode_fqcn,
@@ -171,6 +171,6 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public static function deregister($identifier = '')
173 173
     {
174
-        unset(self::$_settings[ $identifier ]);
174
+        unset(self::$_settings[$identifier]);
175 175
     }
176 176
 }
Please login to merge, or discard this patch.
core/libraries/plugin_api/EEI_Plugin_API.lib.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -18,23 +18,23 @@
 block discarded – undo
18 18
 interface EEI_Plugin_API
19 19
 {
20 20
 
21
-    /**
22
-     * Used to register a component with EE.
23
-     *
24
-     * @param string $identifier a unique name for the component being registered
25
-     * @param array  $setup_args an array of key value pairs of info for registering the component
26
-     * @return void
27
-     * @since 4.3.0
28
-     */
29
-    public static function register($identifier = '', array $setup_args = []);
21
+	/**
22
+	 * Used to register a component with EE.
23
+	 *
24
+	 * @param string $identifier a unique name for the component being registered
25
+	 * @param array  $setup_args an array of key value pairs of info for registering the component
26
+	 * @return void
27
+	 * @since 4.3.0
28
+	 */
29
+	public static function register($identifier = '', array $setup_args = []);
30 30
 
31 31
 
32
-    /**
33
-     * Used to deregister a component with EE.
34
-     *
35
-     * @param string $identifier a unique name for the component being registered
36
-     * @return void
37
-     * @since 4.3.0
38
-     */
39
-    public static function deregister($identifier = '');
32
+	/**
33
+	 * Used to deregister a component with EE.
34
+	 *
35
+	 * @param string $identifier a unique name for the component being registered
36
+	 * @return void
37
+	 * @since 4.3.0
38
+	 */
39
+	public static function deregister($identifier = '');
40 40
 }
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Messages_Template_Pack.lib.php 2 patches
Indentation   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -12,201 +12,201 @@
 block discarded – undo
12 12
 {
13 13
 
14 14
 
15
-    /**
16
-     * Holds values for registered template pack
17
-     *
18
-     * @since 4.5.0
19
-     *
20
-     * @var array
21
-     */
22
-    protected static $_registry = [];
23
-
24
-
25
-    /**
26
-     * Used to register a new template pack with the messages system.
27
-     *
28
-     * Template packs are primarily defined via class extending EE_Messages_Template_Pack and are typically used to
29
-     * change entire layouts for a set of message templates.  This method is used to register the new template pack and
30
-     * automatically have it loaded in the appropriate places.
31
-     *
32
-     * This registry also verifies that there isn't already a template pack registered with the same name and if there
33
-     * is then it will add an EE_Error notice.
34
-     *
35
-     * Note that this only handles registering the your Template Pack class with the message template pack system.
36
-     * However, there is also a naming schema you must follow for templates you are providing with your template pack.
37
-     *
38
-     * @param string $identifier The internal reference used to refer to this template pack.  Note, this is first come,
39
-     *                           first serve.  If there is already a template pack registered with this name then the
40
-     *                           registry will assign a unique reference for it so it can still be activated (but this
41
-     *                           makes it harder to deregister as it will be unique per load - so its best to try to
42
-     *                           make this a unique string!)
43
-     * @param array  $setup_args array {
44
-     *                           An array of required values for registering the template pack.
45
-     * @type string  $path       The path for the new template pack class.
46
-     * @type string  $classname  The name of the new Template Pack Class.
47
-     *                           }
48
-     *
49
-     * @return void
50
-     * @throws EE_Error
51
-     *
52
-     * @see    core/libraries/messages/defaults/default/* for all the example templates the default template pack
53
-     *         supports.
54
-     *
55
-     *
56
-     * @since  4.5.0
57
-     * @see    EE_Messages_Template_Pack_Default for an example class
58
-     */
59
-    public static function register($identifier = '', array $setup_args = [])
60
-    {
61
-
62
-        // check for required params
63
-        if (empty($identifier) || empty($setup_args['path']) || empty($setup_args['classname'])) {
64
-            throw new EE_Error(
65
-                __(
66
-                    'In order to register a new template pack for the EE Messages system, you must include a value to reference the template pack being registered and the setup_args must have the path for the new template pack class as well as the classname for the new Template Pack Class. ',
67
-                    'event_espresso'
68
-                )
69
-            );
70
-        }
71
-
72
-        // make sure we don't register twice
73
-        if (isset(self::$_registry[ $identifier ])) {
74
-            return;
75
-        }
76
-
77
-        // check that incoming $identifier doesn't already exist. If it does then we'll create a unique reference for this template pack.
78
-        if (isset(self::$_registry[ $identifier ])) {
79
-            $identifier = uniqid() . '_' . $identifier;
80
-        }
81
-
82
-
83
-        // make sure this was called in the right place!
84
-        if (! did_action('EE_Brewing_Regular___messages_caf')
85
-            || did_action('AHEE__EE_System__perform_activations_upgrades_and_migrations')
86
-        ) {
87
-            EE_Error::doing_it_wrong(
88
-                __METHOD__,
89
-                sprintf(
90
-                    __(
91
-                        'A EE Messages Template Pack given the reference "%s" has been attempted to be registered with the EE Messages System.  It may or may not work because it should be only called on the "EE_Brewing_Regular__messages_caf" hook.',
92
-                        'event_espresso'
93
-                    ),
94
-                    $identifier
95
-                ),
96
-                '4.5.0'
97
-            );
98
-        }
99
-
100
-        if (self::_verify_class_not_exist($setup_args['classname'])) {
101
-            self::$_registry[ $identifier ] = [
102
-                'path'      => (string) $setup_args['path'],
103
-                'classname' => (string) $setup_args['classname'],
104
-            ];
105
-        }
106
-
107
-        // hook into the system
108
-        add_filter(
109
-            'FHEE__EED_Messages___set_messages_paths___MSG_PATHS',
110
-            ['EE_Register_Messages_Template_Pack', 'set_template_pack_path'],
111
-            10
112
-        );
113
-        add_filter(
114
-            'FHEE__EED_Messages__get_template_packs__template_packs',
115
-            ['EE_Register_Messages_Template_Pack', 'set_template_pack'],
116
-            10
117
-        );
118
-    }
119
-
120
-
121
-    /**
122
-     * Callback for the FHEE__EED_Messages___set_messages_paths___MSG_PATHS filter.  This adds this template packs path
123
-     * to the messages autoloader paths.
124
-     *
125
-     * @param array $paths Array of paths already registered with the messages autoloader
126
-     *
127
-     * @return array
128
-     * @since  4.5.0
129
-     *
130
-     */
131
-    public static function set_template_pack_path(array $paths)
132
-    {
133
-        foreach (self::$_registry as $args) {
134
-            $paths[] = $args['path'];
135
-        }
136
-        return $paths;
137
-    }
138
-
139
-
140
-    /**
141
-     * Callback for the FHEE__EED_Messages__get_template_packs__template_packs filter. This adds the instantiated,
142
-     * registered template pack to the template packs array when requested by client code.
143
-     *
144
-     * @param EE_Messages_Template_Pack[] $template_packs
145
-     * @return EE_Messages_Template_Pack[]
146
-     * @since 4.5.0
147
-     *
148
-     */
149
-    public static function set_template_pack(array $template_packs)
150
-    {
151
-        foreach (self::$_registry as $args) {
152
-            // verify class_exists
153
-            if (! class_exists($args['classname'])) {
154
-                require_once($args['path'] . '/' . $args['classname'] . '.class.php');
155
-            }
156
-
157
-            // check again!
158
-            if (class_exists($args['classname'])) {
159
-                $template_pack                           = new $args['classname'];
160
-                $template_packs[ $template_pack->dbref ] = $template_pack;
161
-            }
162
-        }
163
-
164
-        return $template_packs;
165
-    }
166
-
167
-
168
-    /**
169
-     * This verifies that the classes for each registered template pack are unique  names.
170
-     *
171
-     * @param string $classname The classname being checked
172
-     *
173
-     * @return bool
174
-     */
175
-    private static function _verify_class_not_exist($classname)
176
-    {
177
-        // loop through the existing registry and see if the classname is already present.
178
-        foreach (self::$_registry as $args) {
179
-            if ($args['classname'] == $classname) {
180
-                EE_Error::add_error(
181
-                    sprintf(
182
-                        __(
183
-                            'The %s template pack that you just activated cannot be registered with the messages system because there is already a template pack active using the same classname.  Contact the author of this template pack to let them know of the conflict.  To stop seeing this message you will need to deactivate this template pack.',
184
-                            'event_espresso'
185
-                        ),
186
-                        $classname
187
-                    ),
188
-                    __FILE__,
189
-                    __LINE__,
190
-                    __FUNCTION__
191
-                );
192
-                return false;
193
-            }
194
-        }
195
-        return true;
196
-    }
197
-
198
-
199
-    /**
200
-     * This deregisters a variation set that was previously registered with the given slug.
201
-     *
202
-     * @param string $identifier The name for the variation set that was previously registered.
203
-     *
204
-     * @return void
205
-     * @since 4.5.0
206
-     *
207
-     */
208
-    public static function deregister($identifier = '')
209
-    {
210
-        unset(self::$_registry[ $identifier ]);
211
-    }
15
+	/**
16
+	 * Holds values for registered template pack
17
+	 *
18
+	 * @since 4.5.0
19
+	 *
20
+	 * @var array
21
+	 */
22
+	protected static $_registry = [];
23
+
24
+
25
+	/**
26
+	 * Used to register a new template pack with the messages system.
27
+	 *
28
+	 * Template packs are primarily defined via class extending EE_Messages_Template_Pack and are typically used to
29
+	 * change entire layouts for a set of message templates.  This method is used to register the new template pack and
30
+	 * automatically have it loaded in the appropriate places.
31
+	 *
32
+	 * This registry also verifies that there isn't already a template pack registered with the same name and if there
33
+	 * is then it will add an EE_Error notice.
34
+	 *
35
+	 * Note that this only handles registering the your Template Pack class with the message template pack system.
36
+	 * However, there is also a naming schema you must follow for templates you are providing with your template pack.
37
+	 *
38
+	 * @param string $identifier The internal reference used to refer to this template pack.  Note, this is first come,
39
+	 *                           first serve.  If there is already a template pack registered with this name then the
40
+	 *                           registry will assign a unique reference for it so it can still be activated (but this
41
+	 *                           makes it harder to deregister as it will be unique per load - so its best to try to
42
+	 *                           make this a unique string!)
43
+	 * @param array  $setup_args array {
44
+	 *                           An array of required values for registering the template pack.
45
+	 * @type string  $path       The path for the new template pack class.
46
+	 * @type string  $classname  The name of the new Template Pack Class.
47
+	 *                           }
48
+	 *
49
+	 * @return void
50
+	 * @throws EE_Error
51
+	 *
52
+	 * @see    core/libraries/messages/defaults/default/* for all the example templates the default template pack
53
+	 *         supports.
54
+	 *
55
+	 *
56
+	 * @since  4.5.0
57
+	 * @see    EE_Messages_Template_Pack_Default for an example class
58
+	 */
59
+	public static function register($identifier = '', array $setup_args = [])
60
+	{
61
+
62
+		// check for required params
63
+		if (empty($identifier) || empty($setup_args['path']) || empty($setup_args['classname'])) {
64
+			throw new EE_Error(
65
+				__(
66
+					'In order to register a new template pack for the EE Messages system, you must include a value to reference the template pack being registered and the setup_args must have the path for the new template pack class as well as the classname for the new Template Pack Class. ',
67
+					'event_espresso'
68
+				)
69
+			);
70
+		}
71
+
72
+		// make sure we don't register twice
73
+		if (isset(self::$_registry[ $identifier ])) {
74
+			return;
75
+		}
76
+
77
+		// check that incoming $identifier doesn't already exist. If it does then we'll create a unique reference for this template pack.
78
+		if (isset(self::$_registry[ $identifier ])) {
79
+			$identifier = uniqid() . '_' . $identifier;
80
+		}
81
+
82
+
83
+		// make sure this was called in the right place!
84
+		if (! did_action('EE_Brewing_Regular___messages_caf')
85
+			|| did_action('AHEE__EE_System__perform_activations_upgrades_and_migrations')
86
+		) {
87
+			EE_Error::doing_it_wrong(
88
+				__METHOD__,
89
+				sprintf(
90
+					__(
91
+						'A EE Messages Template Pack given the reference "%s" has been attempted to be registered with the EE Messages System.  It may or may not work because it should be only called on the "EE_Brewing_Regular__messages_caf" hook.',
92
+						'event_espresso'
93
+					),
94
+					$identifier
95
+				),
96
+				'4.5.0'
97
+			);
98
+		}
99
+
100
+		if (self::_verify_class_not_exist($setup_args['classname'])) {
101
+			self::$_registry[ $identifier ] = [
102
+				'path'      => (string) $setup_args['path'],
103
+				'classname' => (string) $setup_args['classname'],
104
+			];
105
+		}
106
+
107
+		// hook into the system
108
+		add_filter(
109
+			'FHEE__EED_Messages___set_messages_paths___MSG_PATHS',
110
+			['EE_Register_Messages_Template_Pack', 'set_template_pack_path'],
111
+			10
112
+		);
113
+		add_filter(
114
+			'FHEE__EED_Messages__get_template_packs__template_packs',
115
+			['EE_Register_Messages_Template_Pack', 'set_template_pack'],
116
+			10
117
+		);
118
+	}
119
+
120
+
121
+	/**
122
+	 * Callback for the FHEE__EED_Messages___set_messages_paths___MSG_PATHS filter.  This adds this template packs path
123
+	 * to the messages autoloader paths.
124
+	 *
125
+	 * @param array $paths Array of paths already registered with the messages autoloader
126
+	 *
127
+	 * @return array
128
+	 * @since  4.5.0
129
+	 *
130
+	 */
131
+	public static function set_template_pack_path(array $paths)
132
+	{
133
+		foreach (self::$_registry as $args) {
134
+			$paths[] = $args['path'];
135
+		}
136
+		return $paths;
137
+	}
138
+
139
+
140
+	/**
141
+	 * Callback for the FHEE__EED_Messages__get_template_packs__template_packs filter. This adds the instantiated,
142
+	 * registered template pack to the template packs array when requested by client code.
143
+	 *
144
+	 * @param EE_Messages_Template_Pack[] $template_packs
145
+	 * @return EE_Messages_Template_Pack[]
146
+	 * @since 4.5.0
147
+	 *
148
+	 */
149
+	public static function set_template_pack(array $template_packs)
150
+	{
151
+		foreach (self::$_registry as $args) {
152
+			// verify class_exists
153
+			if (! class_exists($args['classname'])) {
154
+				require_once($args['path'] . '/' . $args['classname'] . '.class.php');
155
+			}
156
+
157
+			// check again!
158
+			if (class_exists($args['classname'])) {
159
+				$template_pack                           = new $args['classname'];
160
+				$template_packs[ $template_pack->dbref ] = $template_pack;
161
+			}
162
+		}
163
+
164
+		return $template_packs;
165
+	}
166
+
167
+
168
+	/**
169
+	 * This verifies that the classes for each registered template pack are unique  names.
170
+	 *
171
+	 * @param string $classname The classname being checked
172
+	 *
173
+	 * @return bool
174
+	 */
175
+	private static function _verify_class_not_exist($classname)
176
+	{
177
+		// loop through the existing registry and see if the classname is already present.
178
+		foreach (self::$_registry as $args) {
179
+			if ($args['classname'] == $classname) {
180
+				EE_Error::add_error(
181
+					sprintf(
182
+						__(
183
+							'The %s template pack that you just activated cannot be registered with the messages system because there is already a template pack active using the same classname.  Contact the author of this template pack to let them know of the conflict.  To stop seeing this message you will need to deactivate this template pack.',
184
+							'event_espresso'
185
+						),
186
+						$classname
187
+					),
188
+					__FILE__,
189
+					__LINE__,
190
+					__FUNCTION__
191
+				);
192
+				return false;
193
+			}
194
+		}
195
+		return true;
196
+	}
197
+
198
+
199
+	/**
200
+	 * This deregisters a variation set that was previously registered with the given slug.
201
+	 *
202
+	 * @param string $identifier The name for the variation set that was previously registered.
203
+	 *
204
+	 * @return void
205
+	 * @since 4.5.0
206
+	 *
207
+	 */
208
+	public static function deregister($identifier = '')
209
+	{
210
+		unset(self::$_registry[ $identifier ]);
211
+	}
212 212
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -70,18 +70,18 @@  discard block
 block discarded – undo
70 70
         }
71 71
 
72 72
         // make sure we don't register twice
73
-        if (isset(self::$_registry[ $identifier ])) {
73
+        if (isset(self::$_registry[$identifier])) {
74 74
             return;
75 75
         }
76 76
 
77 77
         // check that incoming $identifier doesn't already exist. If it does then we'll create a unique reference for this template pack.
78
-        if (isset(self::$_registry[ $identifier ])) {
79
-            $identifier = uniqid() . '_' . $identifier;
78
+        if (isset(self::$_registry[$identifier])) {
79
+            $identifier = uniqid().'_'.$identifier;
80 80
         }
81 81
 
82 82
 
83 83
         // make sure this was called in the right place!
84
-        if (! did_action('EE_Brewing_Regular___messages_caf')
84
+        if ( ! did_action('EE_Brewing_Regular___messages_caf')
85 85
             || did_action('AHEE__EE_System__perform_activations_upgrades_and_migrations')
86 86
         ) {
87 87
             EE_Error::doing_it_wrong(
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         }
99 99
 
100 100
         if (self::_verify_class_not_exist($setup_args['classname'])) {
101
-            self::$_registry[ $identifier ] = [
101
+            self::$_registry[$identifier] = [
102 102
                 'path'      => (string) $setup_args['path'],
103 103
                 'classname' => (string) $setup_args['classname'],
104 104
             ];
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
     {
151 151
         foreach (self::$_registry as $args) {
152 152
             // verify class_exists
153
-            if (! class_exists($args['classname'])) {
154
-                require_once($args['path'] . '/' . $args['classname'] . '.class.php');
153
+            if ( ! class_exists($args['classname'])) {
154
+                require_once($args['path'].'/'.$args['classname'].'.class.php');
155 155
             }
156 156
 
157 157
             // check again!
158 158
             if (class_exists($args['classname'])) {
159 159
                 $template_pack                           = new $args['classname'];
160
-                $template_packs[ $template_pack->dbref ] = $template_pack;
160
+                $template_packs[$template_pack->dbref] = $template_pack;
161 161
             }
162 162
         }
163 163
 
@@ -207,6 +207,6 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public static function deregister($identifier = '')
209 209
     {
210
-        unset(self::$_registry[ $identifier ]);
210
+        unset(self::$_registry[$identifier]);
211 211
     }
212 212
 }
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Config.lib.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -12,114 +12,114 @@
 block discarded – undo
12 12
 class EE_Register_Config implements EEI_Plugin_API
13 13
 {
14 14
 
15
-    /**
16
-     * Holds registered EE_Config items
17
-     *
18
-     * @var array
19
-     */
20
-    protected static $_ee_config_registry = [];
15
+	/**
16
+	 * Holds registered EE_Config items
17
+	 *
18
+	 * @var array
19
+	 */
20
+	protected static $_ee_config_registry = [];
21 21
 
22 22
 
23
-    /**
24
-     * Handles registering the new config with the EE_Config::instance()->addons property
25
-     *
26
-     * @param string $identifier                          The name of the Config class being registered.
27
-     *                                                    Note this class must extend EE_Config Base and must have
28
-     *                                                    already been registered with an autoloader.
29
-     * @param array  $setup_args                          {
30
-     *
31
-     * @type  string $config_name                         Optional.  by default the new config will be registered to
32
-     *        EE_Config::instance()->addons->{config_class}, but supplying a "config_name" will set the property name
33
-     *        that this variable is accessible by. ie: EE_Config::instance()->addons->{config_name}
34
-     *                            }
35
-     * @return void
36
-     * @throws EE_Error
37
-     *
38
-     * @since    4.3.0
39
-     */
40
-    public static function register($identifier = '', array $setup_args = [])
41
-    {
23
+	/**
24
+	 * Handles registering the new config with the EE_Config::instance()->addons property
25
+	 *
26
+	 * @param string $identifier                          The name of the Config class being registered.
27
+	 *                                                    Note this class must extend EE_Config Base and must have
28
+	 *                                                    already been registered with an autoloader.
29
+	 * @param array  $setup_args                          {
30
+	 *
31
+	 * @type  string $config_name                         Optional.  by default the new config will be registered to
32
+	 *        EE_Config::instance()->addons->{config_class}, but supplying a "config_name" will set the property name
33
+	 *        that this variable is accessible by. ie: EE_Config::instance()->addons->{config_name}
34
+	 *                            }
35
+	 * @return void
36
+	 * @throws EE_Error
37
+	 *
38
+	 * @since    4.3.0
39
+	 */
40
+	public static function register($identifier = '', array $setup_args = [])
41
+	{
42 42
 
43
-        $setup_args['config_name']    = isset($setup_args['config_name']) && ! empty($setup_args['config_name'])
44
-            ? $setup_args['config_name'] : $identifier;
45
-        $setup_args['config_section'] = isset($setup_args['config_section']) && ! empty($setup_args['config_section'])
46
-            ? $setup_args['config_section'] : 'addons';
43
+		$setup_args['config_name']    = isset($setup_args['config_name']) && ! empty($setup_args['config_name'])
44
+			? $setup_args['config_name'] : $identifier;
45
+		$setup_args['config_section'] = isset($setup_args['config_section']) && ! empty($setup_args['config_section'])
46
+			? $setup_args['config_section'] : 'addons';
47 47
 
48
-        // required fields MUST be present, so let's make sure they are.
49
-        if (empty($identifier) || ! is_array($setup_args) || empty($setup_args['config_name'])) {
50
-            throw new EE_Error(
51
-                __(
52
-                    'In order to register a Config Class with EE_Register_Config::register(), you must include a "config_class" (the actual class name for this config class). As well, you can supply an array containing the following keys: "config_section" the main section of the config object the settings will be saved under (by default the new config will be registered under EE_Config::instance()->modules or EE_Config::instance()->addons depending on what type of class is calling this), "config_name" (by default the new config will be registered to EE_Config::instance()->{config_section}->{config_class}, but supplying a "config_name" will set the property name that this variable is accessible by. ie: EE_Config::instance()->{config_section}->{config_name})',
53
-                    'event_espresso'
54
-                )
55
-            );
56
-        }
48
+		// required fields MUST be present, so let's make sure they are.
49
+		if (empty($identifier) || ! is_array($setup_args) || empty($setup_args['config_name'])) {
50
+			throw new EE_Error(
51
+				__(
52
+					'In order to register a Config Class with EE_Register_Config::register(), you must include a "config_class" (the actual class name for this config class). As well, you can supply an array containing the following keys: "config_section" the main section of the config object the settings will be saved under (by default the new config will be registered under EE_Config::instance()->modules or EE_Config::instance()->addons depending on what type of class is calling this), "config_name" (by default the new config will be registered to EE_Config::instance()->{config_section}->{config_class}, but supplying a "config_name" will set the property name that this variable is accessible by. ie: EE_Config::instance()->{config_section}->{config_name})',
53
+					'event_espresso'
54
+				)
55
+			);
56
+		}
57 57
 
58
-        // make sure we don't register twice
59
-        if (isset(self::$_ee_config_registry[ $identifier ])) {
60
-            return;
61
-        }
58
+		// make sure we don't register twice
59
+		if (isset(self::$_ee_config_registry[ $identifier ])) {
60
+			return;
61
+		}
62 62
 
63 63
 
64
-        // first find out if this happened too late.
65
-        if (did_action('AHEE__EE_System__load_core_configuration__begin')) {
66
-            EE_Error::doing_it_wrong(
67
-                __METHOD__,
68
-                sprintf(
69
-                    __(
70
-                        'An attempt to register "%s" as an EE_Config object has failed because it was not registered at the correct hookpoint.  Please register before the "AHEE__EE_System__load_core_configuration__begin" hook has fired',
71
-                        'event_espresso'
72
-                    ),
73
-                    $setup_args['config_name']
74
-                ),
75
-                '4.3'
76
-            );
77
-        }
78
-        // add incoming stuff to our registry property
79
-        self::$_ee_config_registry[ $identifier ] = [
80
-            'section' => $setup_args['config_section'],
81
-            'name'    => $setup_args['config_name'],
82
-        ];
64
+		// first find out if this happened too late.
65
+		if (did_action('AHEE__EE_System__load_core_configuration__begin')) {
66
+			EE_Error::doing_it_wrong(
67
+				__METHOD__,
68
+				sprintf(
69
+					__(
70
+						'An attempt to register "%s" as an EE_Config object has failed because it was not registered at the correct hookpoint.  Please register before the "AHEE__EE_System__load_core_configuration__begin" hook has fired',
71
+						'event_espresso'
72
+					),
73
+					$setup_args['config_name']
74
+				),
75
+				'4.3'
76
+			);
77
+		}
78
+		// add incoming stuff to our registry property
79
+		self::$_ee_config_registry[ $identifier ] = [
80
+			'section' => $setup_args['config_section'],
81
+			'name'    => $setup_args['config_name'],
82
+		];
83 83
 
84
-        add_action('AHEE__EE_Config___load_core_config__end', ['EE_Register_Config', 'set_config'], 15, 1);
85
-        add_action('AHEE__EE_Config__update_espresso_config__end', ['EE_Register_Config', 'set_config'], 15, 1);
86
-    }
84
+		add_action('AHEE__EE_Config___load_core_config__end', ['EE_Register_Config', 'set_config'], 15, 1);
85
+		add_action('AHEE__EE_Config__update_espresso_config__end', ['EE_Register_Config', 'set_config'], 15, 1);
86
+	}
87 87
 
88 88
 
89
-    /**
90
-     * Callback for the AHEE__EE_Config___load_core_config__end hook.
91
-     * basically just calls EE_Config->get_config() which will take care of loading or creating our config object for us
92
-     *
93
-     * @param EE_Config $EE_Config
94
-     * @return void
95
-     * @throws EE_Error
96
-     * @since    4.3.0
97
-     */
98
-    public static function set_config(EE_Config $EE_Config)
99
-    {
100
-        foreach (self::$_ee_config_registry as $identifier => $settings) {
101
-            // first some validation of our incoming class_name.  We'll throw an error early if its' not registered correctly
102
-            if (! class_exists($identifier)) {
103
-                throw new EE_Error(
104
-                    sprintf(
105
-                        __(
106
-                            'The "%s" config class can not be registered with EE_Config because it does not exist.  Verify that an autoloader has been set for this class',
107
-                            'event_espresso'
108
-                        ),
109
-                        $identifier
110
-                    )
111
-                );
112
-            }
113
-            $EE_Config->get_config($settings['section'], $settings['name'], $identifier);
114
-        }
115
-    }
89
+	/**
90
+	 * Callback for the AHEE__EE_Config___load_core_config__end hook.
91
+	 * basically just calls EE_Config->get_config() which will take care of loading or creating our config object for us
92
+	 *
93
+	 * @param EE_Config $EE_Config
94
+	 * @return void
95
+	 * @throws EE_Error
96
+	 * @since    4.3.0
97
+	 */
98
+	public static function set_config(EE_Config $EE_Config)
99
+	{
100
+		foreach (self::$_ee_config_registry as $identifier => $settings) {
101
+			// first some validation of our incoming class_name.  We'll throw an error early if its' not registered correctly
102
+			if (! class_exists($identifier)) {
103
+				throw new EE_Error(
104
+					sprintf(
105
+						__(
106
+							'The "%s" config class can not be registered with EE_Config because it does not exist.  Verify that an autoloader has been set for this class',
107
+							'event_espresso'
108
+						),
109
+						$identifier
110
+					)
111
+				);
112
+			}
113
+			$EE_Config->get_config($settings['section'], $settings['name'], $identifier);
114
+		}
115
+	}
116 116
 
117 117
 
118
-    /**
119
-     * @param string $identifier
120
-     */
121
-    public static function deregister($identifier = '')
122
-    {
123
-        unset(self::$_ee_config_registry[ $identifier ]);
124
-    }
118
+	/**
119
+	 * @param string $identifier
120
+	 */
121
+	public static function deregister($identifier = '')
122
+	{
123
+		unset(self::$_ee_config_registry[ $identifier ]);
124
+	}
125 125
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         }
57 57
 
58 58
         // make sure we don't register twice
59
-        if (isset(self::$_ee_config_registry[ $identifier ])) {
59
+        if (isset(self::$_ee_config_registry[$identifier])) {
60 60
             return;
61 61
         }
62 62
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             );
77 77
         }
78 78
         // add incoming stuff to our registry property
79
-        self::$_ee_config_registry[ $identifier ] = [
79
+        self::$_ee_config_registry[$identifier] = [
80 80
             'section' => $setup_args['config_section'],
81 81
             'name'    => $setup_args['config_name'],
82 82
         ];
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     {
100 100
         foreach (self::$_ee_config_registry as $identifier => $settings) {
101 101
             // first some validation of our incoming class_name.  We'll throw an error early if its' not registered correctly
102
-            if (! class_exists($identifier)) {
102
+            if ( ! class_exists($identifier)) {
103 103
                 throw new EE_Error(
104 104
                     sprintf(
105 105
                         __(
@@ -120,6 +120,6 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public static function deregister($identifier = '')
122 122
     {
123
-        unset(self::$_ee_config_registry[ $identifier ]);
123
+        unset(self::$_ee_config_registry[$identifier]);
124 124
     }
125 125
 }
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_CPT.lib.php 2 patches
Indentation   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -13,255 +13,255 @@
 block discarded – undo
13 13
 class EE_Register_CPT implements EEI_Plugin_API
14 14
 {
15 15
 
16
-    /**
17
-     * Holds values for registered variations
18
-     *
19
-     * @since 4.5.0
20
-     *
21
-     * @var array[][][]
22
-     */
23
-    protected static $_registry = [];
16
+	/**
17
+	 * Holds values for registered variations
18
+	 *
19
+	 * @since 4.5.0
20
+	 *
21
+	 * @var array[][][]
22
+	 */
23
+	protected static $_registry = [];
24 24
 
25 25
 
26
-    /**
27
-     * Used to register new CPTs and Taxonomies.
28
-     *
29
-     * @param string $identifier              reference used for the addon registering cpts and cts
30
-     * @param array  $setup_args              {
31
-     *                                        An array of required values for registering the cpts and taxonomies
32
-     * @type array   $cpts                    {
33
-     *                                        An array of cpts and their arguments.(short example below)
34
-     * @return void
35
-     * @throws  EE_Error
36
-     * @see CustomPostTypeDefinitions::setDefinitions for a more complete example.
37
-     *                                        'people' => array(
38
-     *                                        'singular_name' => __('People', 'event_espresso'),
39
-     *                                        'plural_name' => __('People', 'event_espresso'),
40
-     *                                        'singular_slug' => __('people', 'event_espresso'),
41
-     *                                        'plural_slug' => __('peoples', 'event_espresso'),
42
-     *                                        'class_name' => 'EE_People'
43
-     *                                        )
44
-     *                                        },
45
-     * @type array   $cts                     {
46
-     *                                        An array of custom taxonomies and their arguments (short example below).
47
-     * @see CustomTaxonomyDefinitions::setTaxonomies() for a more complete example.
48
-     *                                        'espresso_people_type' => array(
49
-     *                                        'singular_name' => __('People Type', 'event_espresso'),
50
-     *                                        'plural_name' => __('People Types', 'event_espresso'),
51
-     *                                        'args' => array()
52
-     *                                        )
53
-     *                                        },
54
-     * @type array   $default_terms           {
55
-     *                                        An array of terms to set as the default for a given taxonomy and the
56
-     *                                        custom post types applied to.
57
-     *                                        'taxonomy_name' => array(
58
-     *                                        'term' => array( 'cpt_a_name', 'cpt_b_name' )
59
-     *                                        )
60
-     *                                        }
61
-     *                                        }
62
-     */
63
-    public static function register($identifier = '', array $setup_args = [])
64
-    {
26
+	/**
27
+	 * Used to register new CPTs and Taxonomies.
28
+	 *
29
+	 * @param string $identifier              reference used for the addon registering cpts and cts
30
+	 * @param array  $setup_args              {
31
+	 *                                        An array of required values for registering the cpts and taxonomies
32
+	 * @type array   $cpts                    {
33
+	 *                                        An array of cpts and their arguments.(short example below)
34
+	 * @return void
35
+	 * @throws  EE_Error
36
+	 * @see CustomPostTypeDefinitions::setDefinitions for a more complete example.
37
+	 *                                        'people' => array(
38
+	 *                                        'singular_name' => __('People', 'event_espresso'),
39
+	 *                                        'plural_name' => __('People', 'event_espresso'),
40
+	 *                                        'singular_slug' => __('people', 'event_espresso'),
41
+	 *                                        'plural_slug' => __('peoples', 'event_espresso'),
42
+	 *                                        'class_name' => 'EE_People'
43
+	 *                                        )
44
+	 *                                        },
45
+	 * @type array   $cts                     {
46
+	 *                                        An array of custom taxonomies and their arguments (short example below).
47
+	 * @see CustomTaxonomyDefinitions::setTaxonomies() for a more complete example.
48
+	 *                                        'espresso_people_type' => array(
49
+	 *                                        'singular_name' => __('People Type', 'event_espresso'),
50
+	 *                                        'plural_name' => __('People Types', 'event_espresso'),
51
+	 *                                        'args' => array()
52
+	 *                                        )
53
+	 *                                        },
54
+	 * @type array   $default_terms           {
55
+	 *                                        An array of terms to set as the default for a given taxonomy and the
56
+	 *                                        custom post types applied to.
57
+	 *                                        'taxonomy_name' => array(
58
+	 *                                        'term' => array( 'cpt_a_name', 'cpt_b_name' )
59
+	 *                                        )
60
+	 *                                        }
61
+	 *                                        }
62
+	 */
63
+	public static function register($identifier = '', array $setup_args = [])
64
+	{
65 65
 
66
-        // check for required params
67
-        if (empty($identifier)) {
68
-            throw new EE_Error(
69
-                __(
70
-                    'In order to register custom post types and custom taxonomies, you must include a value to reference what had been registered',
71
-                    'event_espresso'
72
-                )
73
-            );
74
-        }
66
+		// check for required params
67
+		if (empty($identifier)) {
68
+			throw new EE_Error(
69
+				__(
70
+					'In order to register custom post types and custom taxonomies, you must include a value to reference what had been registered',
71
+					'event_espresso'
72
+				)
73
+			);
74
+		}
75 75
 
76
-        if (! is_array($setup_args) || (empty($setup_args['cpts']) && empty($setup_args['cts']))) {
77
-            throw new EE_Error(
78
-                __(
79
-                    'In order to register custom post types or custom taxonomies, you must include an array containing either an array of custom post types to register (key "cpts"), an array of custom taxonomies ("cts") or both.',
80
-                    'event_espresso'
81
-                )
82
-            );
83
-        }
76
+		if (! is_array($setup_args) || (empty($setup_args['cpts']) && empty($setup_args['cts']))) {
77
+			throw new EE_Error(
78
+				__(
79
+					'In order to register custom post types or custom taxonomies, you must include an array containing either an array of custom post types to register (key "cpts"), an array of custom taxonomies ("cts") or both.',
80
+					'event_espresso'
81
+				)
82
+			);
83
+		}
84 84
 
85
-        // make sure we don't register twice
86
-        if (isset(self::$_registry[ $identifier ])) {
87
-            return;
88
-        }
85
+		// make sure we don't register twice
86
+		if (isset(self::$_registry[ $identifier ])) {
87
+			return;
88
+		}
89 89
 
90
-        // make sure cpt ref is unique.
91
-        if (isset(self::$_registry[ $identifier ])) {
92
-            $identifier = uniqid() . '_' . $identifier;
93
-        }
90
+		// make sure cpt ref is unique.
91
+		if (isset(self::$_registry[ $identifier ])) {
92
+			$identifier = uniqid() . '_' . $identifier;
93
+		}
94 94
 
95
-        // make sure this was called in the right place!
96
-        if (did_action('AHEE__EE_System__load_CPTs_and_session__complete')) {
97
-            EE_Error::doing_it_wrong(
98
-                __METHOD__,
99
-                sprintf(
100
-                    __(
101
-                        'EE_Register_CPT has been called and given a reference of "%s".  It may or may not work because it should be called on or before "AHEE__EE_System__load_CPTs_and_session__complete" action hook.',
102
-                        'event_espresso'
103
-                    ),
104
-                    $identifier
105
-                ),
106
-                '4.5.0'
107
-            );
108
-        }
109
-        // validate incoming args
110
-        $validated = [
111
-            'cpts'          => isset($setup_args['cpts'])
112
-                ? (array) $setup_args['cpts']
113
-                : [],
114
-            'cts'           => isset($setup_args['cts'])
115
-                ? (array) $setup_args['cts']
116
-                : [],
117
-            'default_terms' => isset($setup_args['default_terms'])
118
-                ? (array) $setup_args['default_terms']
119
-                : [],
120
-        ];
95
+		// make sure this was called in the right place!
96
+		if (did_action('AHEE__EE_System__load_CPTs_and_session__complete')) {
97
+			EE_Error::doing_it_wrong(
98
+				__METHOD__,
99
+				sprintf(
100
+					__(
101
+						'EE_Register_CPT has been called and given a reference of "%s".  It may or may not work because it should be called on or before "AHEE__EE_System__load_CPTs_and_session__complete" action hook.',
102
+						'event_espresso'
103
+					),
104
+					$identifier
105
+				),
106
+				'4.5.0'
107
+			);
108
+		}
109
+		// validate incoming args
110
+		$validated = [
111
+			'cpts'          => isset($setup_args['cpts'])
112
+				? (array) $setup_args['cpts']
113
+				: [],
114
+			'cts'           => isset($setup_args['cts'])
115
+				? (array) $setup_args['cts']
116
+				: [],
117
+			'default_terms' => isset($setup_args['default_terms'])
118
+				? (array) $setup_args['default_terms']
119
+				: [],
120
+		];
121 121
 
122
-        self::$_registry[ $identifier ] = $validated;
122
+		self::$_registry[ $identifier ] = $validated;
123 123
 
124
-        // hook into to cpt system
125
-        add_filter(
126
-            'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes',
127
-            [__CLASS__, 'filterCustomPostTypeDefinitions'],
128
-            5
129
-        );
130
-        add_filter(
131
-            'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies',
132
-            [__CLASS__, 'filterCustomTaxonomyDefinitions'],
133
-            5
134
-        );
135
-        add_action(
136
-            'AHEE__EventEspresso_core_domain_services_custom_post_types_RegisterCustomTaxonomyTerms__construct_end',
137
-            [__CLASS__, 'registerCustomTaxonomyTerm'],
138
-            5
139
-        );
140
-    }
124
+		// hook into to cpt system
125
+		add_filter(
126
+			'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes',
127
+			[__CLASS__, 'filterCustomPostTypeDefinitions'],
128
+			5
129
+		);
130
+		add_filter(
131
+			'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies',
132
+			[__CLASS__, 'filterCustomTaxonomyDefinitions'],
133
+			5
134
+		);
135
+		add_action(
136
+			'AHEE__EventEspresso_core_domain_services_custom_post_types_RegisterCustomTaxonomyTerms__construct_end',
137
+			[__CLASS__, 'registerCustomTaxonomyTerm'],
138
+			5
139
+		);
140
+	}
141 141
 
142 142
 
143
-    /**
144
-     * Callback for
145
-     * FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes
146
-     * that adds additional custom post types to be registered.
147
-     *
148
-     * @param array $custom_post_type_definitions array of cpts that are already set
149
-     * @return array new array of cpts and their registration information
150
-     */
151
-    public static function filterCustomPostTypeDefinitions(array $custom_post_type_definitions)
152
-    {
153
-        foreach (self::$_registry as $registries) {
154
-            foreach ($registries['cpts'] as $cpt_name => $cpt_settings) {
155
-                $custom_post_type_definitions[ $cpt_name ] = $cpt_settings;
156
-            }
157
-        }
158
-        return $custom_post_type_definitions;
159
-    }
143
+	/**
144
+	 * Callback for
145
+	 * FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes
146
+	 * that adds additional custom post types to be registered.
147
+	 *
148
+	 * @param array $custom_post_type_definitions array of cpts that are already set
149
+	 * @return array new array of cpts and their registration information
150
+	 */
151
+	public static function filterCustomPostTypeDefinitions(array $custom_post_type_definitions)
152
+	{
153
+		foreach (self::$_registry as $registries) {
154
+			foreach ($registries['cpts'] as $cpt_name => $cpt_settings) {
155
+				$custom_post_type_definitions[ $cpt_name ] = $cpt_settings;
156
+			}
157
+		}
158
+		return $custom_post_type_definitions;
159
+	}
160 160
 
161 161
 
162
-    /**
163
-     * Callback for
164
-     * FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies
165
-     * that adds additional custom taxonomies to be registered.
166
-     *
167
-     * @param array $custom_taxonomy_definitions array of cts that are already set.
168
-     * @return array new array of cts and their registration information.
169
-     */
170
-    public static function filterCustomTaxonomyDefinitions(array $custom_taxonomy_definitions)
171
-    {
172
-        foreach (self::$_registry as $registries) {
173
-            foreach ($registries['cts'] as $ct_name => $ct_settings) {
174
-                $custom_taxonomy_definitions[ $ct_name ] = $ct_settings;
175
-            }
176
-        }
177
-        return $custom_taxonomy_definitions;
178
-    }
162
+	/**
163
+	 * Callback for
164
+	 * FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies
165
+	 * that adds additional custom taxonomies to be registered.
166
+	 *
167
+	 * @param array $custom_taxonomy_definitions array of cts that are already set.
168
+	 * @return array new array of cts and their registration information.
169
+	 */
170
+	public static function filterCustomTaxonomyDefinitions(array $custom_taxonomy_definitions)
171
+	{
172
+		foreach (self::$_registry as $registries) {
173
+			foreach ($registries['cts'] as $ct_name => $ct_settings) {
174
+				$custom_taxonomy_definitions[ $ct_name ] = $ct_settings;
175
+			}
176
+		}
177
+		return $custom_taxonomy_definitions;
178
+	}
179 179
 
180 180
 
181
-    /**
182
-     * Callback for
183
-     * AHEE__EventEspresso_core_domain_services_custom_post_types_RegisterCustomTaxonomyTerms__construct_end
184
-     * which is used to set the default terms
185
-     *
186
-     * @param RegisterCustomTaxonomyTerms $register_custom_taxonomy_terms
187
-     * @return void
188
-     */
189
-    public static function registerCustomTaxonomyTerm(RegisterCustomTaxonomyTerms $register_custom_taxonomy_terms)
190
-    {
191
-        foreach (self::$_registry as $registries) {
192
-            foreach ($registries['default_terms'] as $taxonomy => $terms) {
193
-                foreach ($terms as $term => $cpts) {
194
-                    $register_custom_taxonomy_terms->registerCustomTaxonomyTerm(
195
-                        $taxonomy,
196
-                        $term,
197
-                        $cpts
198
-                    );
199
-                }
200
-            }
201
-        }
202
-    }
181
+	/**
182
+	 * Callback for
183
+	 * AHEE__EventEspresso_core_domain_services_custom_post_types_RegisterCustomTaxonomyTerms__construct_end
184
+	 * which is used to set the default terms
185
+	 *
186
+	 * @param RegisterCustomTaxonomyTerms $register_custom_taxonomy_terms
187
+	 * @return void
188
+	 */
189
+	public static function registerCustomTaxonomyTerm(RegisterCustomTaxonomyTerms $register_custom_taxonomy_terms)
190
+	{
191
+		foreach (self::$_registry as $registries) {
192
+			foreach ($registries['default_terms'] as $taxonomy => $terms) {
193
+				foreach ($terms as $term => $cpts) {
194
+					$register_custom_taxonomy_terms->registerCustomTaxonomyTerm(
195
+						$taxonomy,
196
+						$term,
197
+						$cpts
198
+					);
199
+				}
200
+			}
201
+		}
202
+	}
203 203
 
204 204
 
205
-    /**
206
-     * @param array $cpts array of cpts that are already set
207
-     * @return array new array of cpts and their registration information
208
-     * @deprecated 4.9.62.p
209
-     */
210
-    public static function filter_cpts(array $cpts)
211
-    {
212
-        foreach (self::$_registry as $registries) {
213
-            foreach ($registries['cpts'] as $cpt_name => $cpt_settings) {
214
-                $cpts[ $cpt_name ] = $cpt_settings;
215
-            }
216
-        }
217
-        return $cpts;
218
-    }
205
+	/**
206
+	 * @param array $cpts array of cpts that are already set
207
+	 * @return array new array of cpts and their registration information
208
+	 * @deprecated 4.9.62.p
209
+	 */
210
+	public static function filter_cpts(array $cpts)
211
+	{
212
+		foreach (self::$_registry as $registries) {
213
+			foreach ($registries['cpts'] as $cpt_name => $cpt_settings) {
214
+				$cpts[ $cpt_name ] = $cpt_settings;
215
+			}
216
+		}
217
+		return $cpts;
218
+	}
219 219
 
220 220
 
221
-    /**
222
-     * @param array $cts array of cts that are already set.
223
-     * @return array new array of cts and their registration information.
224
-     * @deprecated 4.9.62.p
225
-     */
226
-    public static function filter_cts(array $cts)
227
-    {
228
-        foreach (self::$_registry as $registries) {
229
-            foreach ($registries['cts'] as $ct_name => $ct_settings) {
230
-                $cts[ $ct_name ] = $ct_settings;
231
-            }
232
-        }
233
-        return $cts;
234
-    }
221
+	/**
222
+	 * @param array $cts array of cts that are already set.
223
+	 * @return array new array of cts and their registration information.
224
+	 * @deprecated 4.9.62.p
225
+	 */
226
+	public static function filter_cts(array $cts)
227
+	{
228
+		foreach (self::$_registry as $registries) {
229
+			foreach ($registries['cts'] as $ct_name => $ct_settings) {
230
+				$cts[ $ct_name ] = $ct_settings;
231
+			}
232
+		}
233
+		return $cts;
234
+	}
235 235
 
236 236
 
237
-    /**
238
-     * @param EE_Register_CPTs $cpt_class
239
-     * @return void
240
-     * @deprecated 4.9.62.p
241
-     */
242
-    public static function default_terms(EE_Register_CPTs $cpt_class)
243
-    {
244
-        foreach (self::$_registry as $registries) {
245
-            foreach ($registries['default_terms'] as $taxonomy => $terms) {
246
-                foreach ($terms as $term => $cpts) {
247
-                    $cpt_class->set_default_term($taxonomy, $term, $cpts);
248
-                }
249
-            }
250
-        }
251
-    }
237
+	/**
238
+	 * @param EE_Register_CPTs $cpt_class
239
+	 * @return void
240
+	 * @deprecated 4.9.62.p
241
+	 */
242
+	public static function default_terms(EE_Register_CPTs $cpt_class)
243
+	{
244
+		foreach (self::$_registry as $registries) {
245
+			foreach ($registries['default_terms'] as $taxonomy => $terms) {
246
+				foreach ($terms as $term => $cpts) {
247
+					$cpt_class->set_default_term($taxonomy, $term, $cpts);
248
+				}
249
+			}
250
+		}
251
+	}
252 252
 
253 253
 
254
-    /**
255
-     * This deregisters whats been registered on this class (for the given slug).
256
-     *
257
-     * @param string $identifier The reference for the item registered to be removed.
258
-     *
259
-     * @return void
260
-     * @since 4.5.0
261
-     *
262
-     */
263
-    public static function deregister($identifier = '')
264
-    {
265
-        unset(self::$_registry[ $identifier ]);
266
-    }
254
+	/**
255
+	 * This deregisters whats been registered on this class (for the given slug).
256
+	 *
257
+	 * @param string $identifier The reference for the item registered to be removed.
258
+	 *
259
+	 * @return void
260
+	 * @since 4.5.0
261
+	 *
262
+	 */
263
+	public static function deregister($identifier = '')
264
+	{
265
+		unset(self::$_registry[ $identifier ]);
266
+	}
267 267
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             );
74 74
         }
75 75
 
76
-        if (! is_array($setup_args) || (empty($setup_args['cpts']) && empty($setup_args['cts']))) {
76
+        if ( ! is_array($setup_args) || (empty($setup_args['cpts']) && empty($setup_args['cts']))) {
77 77
             throw new EE_Error(
78 78
                 __(
79 79
                     'In order to register custom post types or custom taxonomies, you must include an array containing either an array of custom post types to register (key "cpts"), an array of custom taxonomies ("cts") or both.',
@@ -83,13 +83,13 @@  discard block
 block discarded – undo
83 83
         }
84 84
 
85 85
         // make sure we don't register twice
86
-        if (isset(self::$_registry[ $identifier ])) {
86
+        if (isset(self::$_registry[$identifier])) {
87 87
             return;
88 88
         }
89 89
 
90 90
         // make sure cpt ref is unique.
91
-        if (isset(self::$_registry[ $identifier ])) {
92
-            $identifier = uniqid() . '_' . $identifier;
91
+        if (isset(self::$_registry[$identifier])) {
92
+            $identifier = uniqid().'_'.$identifier;
93 93
         }
94 94
 
95 95
         // make sure this was called in the right place!
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                 : [],
120 120
         ];
121 121
 
122
-        self::$_registry[ $identifier ] = $validated;
122
+        self::$_registry[$identifier] = $validated;
123 123
 
124 124
         // hook into to cpt system
125 125
         add_filter(
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     {
153 153
         foreach (self::$_registry as $registries) {
154 154
             foreach ($registries['cpts'] as $cpt_name => $cpt_settings) {
155
-                $custom_post_type_definitions[ $cpt_name ] = $cpt_settings;
155
+                $custom_post_type_definitions[$cpt_name] = $cpt_settings;
156 156
             }
157 157
         }
158 158
         return $custom_post_type_definitions;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     {
172 172
         foreach (self::$_registry as $registries) {
173 173
             foreach ($registries['cts'] as $ct_name => $ct_settings) {
174
-                $custom_taxonomy_definitions[ $ct_name ] = $ct_settings;
174
+                $custom_taxonomy_definitions[$ct_name] = $ct_settings;
175 175
             }
176 176
         }
177 177
         return $custom_taxonomy_definitions;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     {
212 212
         foreach (self::$_registry as $registries) {
213 213
             foreach ($registries['cpts'] as $cpt_name => $cpt_settings) {
214
-                $cpts[ $cpt_name ] = $cpt_settings;
214
+                $cpts[$cpt_name] = $cpt_settings;
215 215
             }
216 216
         }
217 217
         return $cpts;
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     {
228 228
         foreach (self::$_registry as $registries) {
229 229
             foreach ($registries['cts'] as $ct_name => $ct_settings) {
230
-                $cts[ $ct_name ] = $ct_settings;
230
+                $cts[$ct_name] = $ct_settings;
231 231
             }
232 232
         }
233 233
         return $cts;
@@ -262,6 +262,6 @@  discard block
 block discarded – undo
262 262
      */
263 263
     public static function deregister($identifier = '')
264 264
     {
265
-        unset(self::$_registry[ $identifier ]);
265
+        unset(self::$_registry[$identifier]);
266 266
     }
267 267
 }
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Model.lib.php 2 patches
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -11,183 +11,183 @@
 block discarded – undo
11 11
  */
12 12
 class EE_Register_Model implements EEI_Plugin_API
13 13
 {
14
-    /**
15
-     *
16
-     * @var array keys are the model_id used to register with, values are the array provided to register them, exactly
17
-     *      like EE_Register_Model::register()'s 2nd arg
18
-     */
19
-    protected static $_model_registry;
14
+	/**
15
+	 *
16
+	 * @var array keys are the model_id used to register with, values are the array provided to register them, exactly
17
+	 *      like EE_Register_Model::register()'s 2nd arg
18
+	 */
19
+	protected static $_model_registry;
20 20
 
21
-    /**
22
-     *
23
-     * @var array keys are model names, values are their class names. Stored on registration and used
24
-     * on a hook
25
-     */
26
-    protected static $_model_name_to_classname_map;
21
+	/**
22
+	 *
23
+	 * @var array keys are model names, values are their class names. Stored on registration and used
24
+	 * on a hook
25
+	 */
26
+	protected static $_model_name_to_classname_map;
27 27
 
28 28
 
29
-    /**
30
-     * @param string $identifier  unique id for it
31
-     * @param array  $setup_args  {
32
-     * @type array   $model_paths array of folders containing DB models, where each file follows the models naming
33
-     *                            convention, which is: EEM_{model_name}.model.php which contains a single class called
34
-     *                            EEM_{model_name}. Eg. you could pass
35
-     *                            "public_html/wp-content/plugins/my_addon/db_models" (with or without trailing slash)
36
-     *                            and in that folder put each of your model files, like "EEM_Food.model.php" which
37
-     *                            contains the class "EEM_Food" and
38
-     *                            "EEM_Monkey.model.php" which contains the class "EEM_Monkey". These will be
39
-     *                            autoloaded and added to the EE registry so they can be used like ordinary models. The
40
-     *                            class contained in each file should extend EEM_Base.
41
-     * @type array   $class_paths array of folders containing DB classes, where each file follows the model class
42
-     *                            naming convention, which is EE_{model_name}.class.php. The class contained in each
43
-     *                            file should extend EE_Base_Class
44
-     *
45
-     * }
46
-     * @throws EE_Error
47
-     */
48
-    public static function register($identifier = '', array $setup_args = [])
49
-    {
50
-        // required fields MUST be present, so let's make sure they are.
51
-        if (empty($identifier) || ! is_array($setup_args) || empty($setup_args['model_paths'])) {
52
-            throw new EE_Error(
53
-                __(
54
-                    'In order to register Models with EE_Register_Model::register(), you must include a "model_id" (a unique identifier for this set of models), and an array containing the following keys: "model_paths" (an array of full server paths to folders that contain models)',
55
-                    'event_espresso'
56
-                )
57
-            );
58
-        }
29
+	/**
30
+	 * @param string $identifier  unique id for it
31
+	 * @param array  $setup_args  {
32
+	 * @type array   $model_paths array of folders containing DB models, where each file follows the models naming
33
+	 *                            convention, which is: EEM_{model_name}.model.php which contains a single class called
34
+	 *                            EEM_{model_name}. Eg. you could pass
35
+	 *                            "public_html/wp-content/plugins/my_addon/db_models" (with or without trailing slash)
36
+	 *                            and in that folder put each of your model files, like "EEM_Food.model.php" which
37
+	 *                            contains the class "EEM_Food" and
38
+	 *                            "EEM_Monkey.model.php" which contains the class "EEM_Monkey". These will be
39
+	 *                            autoloaded and added to the EE registry so they can be used like ordinary models. The
40
+	 *                            class contained in each file should extend EEM_Base.
41
+	 * @type array   $class_paths array of folders containing DB classes, where each file follows the model class
42
+	 *                            naming convention, which is EE_{model_name}.class.php. The class contained in each
43
+	 *                            file should extend EE_Base_Class
44
+	 *
45
+	 * }
46
+	 * @throws EE_Error
47
+	 */
48
+	public static function register($identifier = '', array $setup_args = [])
49
+	{
50
+		// required fields MUST be present, so let's make sure they are.
51
+		if (empty($identifier) || ! is_array($setup_args) || empty($setup_args['model_paths'])) {
52
+			throw new EE_Error(
53
+				__(
54
+					'In order to register Models with EE_Register_Model::register(), you must include a "model_id" (a unique identifier for this set of models), and an array containing the following keys: "model_paths" (an array of full server paths to folders that contain models)',
55
+					'event_espresso'
56
+				)
57
+			);
58
+		}
59 59
 
60
-        // make sure we don't register twice
61
-        if (isset(self::$_model_registry[ $identifier ])) {
62
-            return;
63
-        }
60
+		// make sure we don't register twice
61
+		if (isset(self::$_model_registry[ $identifier ])) {
62
+			return;
63
+		}
64 64
 
65
-        if (! did_action('AHEE__EE_System__load_espresso_addons')
66
-            || did_action('FHEE__EE_System__parse_model_names')
67
-            || did_action('FHEE__EE_System__parse_implemented_model_names')) {
68
-            EE_Error::doing_it_wrong(
69
-                __METHOD__,
70
-                sprintf(
71
-                    __(
72
-                        'An attempt was made to register "%s" as a group models has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register models.',
73
-                        'event_espresso'
74
-                    ),
75
-                    $identifier
76
-                ),
77
-                '4.5'
78
-            );
79
-        }
80
-        self::$_model_registry[ $identifier ] = $setup_args;
65
+		if (! did_action('AHEE__EE_System__load_espresso_addons')
66
+			|| did_action('FHEE__EE_System__parse_model_names')
67
+			|| did_action('FHEE__EE_System__parse_implemented_model_names')) {
68
+			EE_Error::doing_it_wrong(
69
+				__METHOD__,
70
+				sprintf(
71
+					__(
72
+						'An attempt was made to register "%s" as a group models has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register models.',
73
+						'event_espresso'
74
+					),
75
+					$identifier
76
+				),
77
+				'4.5'
78
+			);
79
+		}
80
+		self::$_model_registry[ $identifier ] = $setup_args;
81 81
 
82
-        if ((isset($setup_args['model_paths']) && ! isset($setup_args['class_paths']))
83
-            || (! isset($setup_args['model_paths']) && isset($setup_args['class_paths']))) {
84
-            throw new EE_Error(
85
-                sprintf(
86
-                    __(
87
-                        'You must register both "model_paths" AND "class_paths", not just one or the other You provided %s',
88
-                        'event_espresso'
89
-                    ),
90
-                    implode(", ", array_keys($setup_args))
91
-                )
92
-            );
93
-        }
94
-        if (isset($setup_args['model_paths'])) {
95
-            // make sure they passed in an array
96
-            if (! is_array($setup_args['model_paths'])) {
97
-                $setup_args['model_paths'] = [$setup_args['model_paths']];
98
-            }
99
-            // we want to add this as a model folder
100
-            // and autoload them all
101
-            $class_to_filepath_map = EEH_File::get_contents_of_folders($setup_args['model_paths']);
102
-            EEH_Autoloader::register_autoloader($class_to_filepath_map);
103
-            $model_name_to_classname_map = [];
104
-            foreach (array_keys($class_to_filepath_map) as $classname) {
105
-                $model_name_to_classname_map[ str_replace("EEM_", "", $classname) ] = $classname;
106
-            }
107
-            self::$_model_name_to_classname_map[ $identifier ] = $model_name_to_classname_map;
108
-            add_filter('FHEE__EE_System__parse_model_names', ['EE_Register_Model', 'add_addon_models']);
109
-            add_filter(
110
-                'FHEE__EE_System__parse_implemented_model_names',
111
-                ['EE_Register_Model', 'add_addon_models']
112
-            );
113
-            add_filter('FHEE__EE_Registry__load_model__paths', ['EE_Register_Model', 'add_model_folders']);
114
-            unset($setup_args['model_paths']);
115
-        }
116
-        if (isset($setup_args['class_paths'])) {
117
-            // make sure they passed in an array
118
-            if (! is_array($setup_args['class_paths'])) {
119
-                $setup_args['class_paths'] = [$setup_args['class_paths']];
120
-            }
121
-            $class_to_filepath_map = EEH_File::get_contents_of_folders($setup_args['class_paths']);
122
-            EEH_Autoloader::register_autoloader($class_to_filepath_map);
123
-            add_filter('FHEE__EE_Registry__load_class__paths', ['EE_Register_Model', 'add_class_folders']);
124
-            unset($setup_args['class_paths']);
125
-        }
126
-        foreach ($setup_args as $unknown_key => $unknown_config) {
127
-            self::deregister($identifier);
128
-            throw new EE_Error(
129
-                sprintf(__("The key '%s' is not a known key for registering a model", "event_espresso"), $unknown_key)
130
-            );
131
-        }
132
-    }
82
+		if ((isset($setup_args['model_paths']) && ! isset($setup_args['class_paths']))
83
+			|| (! isset($setup_args['model_paths']) && isset($setup_args['class_paths']))) {
84
+			throw new EE_Error(
85
+				sprintf(
86
+					__(
87
+						'You must register both "model_paths" AND "class_paths", not just one or the other You provided %s',
88
+						'event_espresso'
89
+					),
90
+					implode(", ", array_keys($setup_args))
91
+				)
92
+			);
93
+		}
94
+		if (isset($setup_args['model_paths'])) {
95
+			// make sure they passed in an array
96
+			if (! is_array($setup_args['model_paths'])) {
97
+				$setup_args['model_paths'] = [$setup_args['model_paths']];
98
+			}
99
+			// we want to add this as a model folder
100
+			// and autoload them all
101
+			$class_to_filepath_map = EEH_File::get_contents_of_folders($setup_args['model_paths']);
102
+			EEH_Autoloader::register_autoloader($class_to_filepath_map);
103
+			$model_name_to_classname_map = [];
104
+			foreach (array_keys($class_to_filepath_map) as $classname) {
105
+				$model_name_to_classname_map[ str_replace("EEM_", "", $classname) ] = $classname;
106
+			}
107
+			self::$_model_name_to_classname_map[ $identifier ] = $model_name_to_classname_map;
108
+			add_filter('FHEE__EE_System__parse_model_names', ['EE_Register_Model', 'add_addon_models']);
109
+			add_filter(
110
+				'FHEE__EE_System__parse_implemented_model_names',
111
+				['EE_Register_Model', 'add_addon_models']
112
+			);
113
+			add_filter('FHEE__EE_Registry__load_model__paths', ['EE_Register_Model', 'add_model_folders']);
114
+			unset($setup_args['model_paths']);
115
+		}
116
+		if (isset($setup_args['class_paths'])) {
117
+			// make sure they passed in an array
118
+			if (! is_array($setup_args['class_paths'])) {
119
+				$setup_args['class_paths'] = [$setup_args['class_paths']];
120
+			}
121
+			$class_to_filepath_map = EEH_File::get_contents_of_folders($setup_args['class_paths']);
122
+			EEH_Autoloader::register_autoloader($class_to_filepath_map);
123
+			add_filter('FHEE__EE_Registry__load_class__paths', ['EE_Register_Model', 'add_class_folders']);
124
+			unset($setup_args['class_paths']);
125
+		}
126
+		foreach ($setup_args as $unknown_key => $unknown_config) {
127
+			self::deregister($identifier);
128
+			throw new EE_Error(
129
+				sprintf(__("The key '%s' is not a known key for registering a model", "event_espresso"), $unknown_key)
130
+			);
131
+		}
132
+	}
133 133
 
134 134
 
135
-    /**
136
-     * Filters the core list of models
137
-     *
138
-     * @param array $core_models
139
-     * @return array keys are model names (eg 'Event') and values are their classes (eg 'EE_Event')
140
-     */
141
-    public static function add_addon_models(array $core_models = [])
142
-    {
143
-        foreach (self::$_model_name_to_classname_map as $model_name_to_class_map) {
144
-            $core_models = array_merge($core_models, $model_name_to_class_map);
145
-        }
146
-        return $core_models;
147
-    }
135
+	/**
136
+	 * Filters the core list of models
137
+	 *
138
+	 * @param array $core_models
139
+	 * @return array keys are model names (eg 'Event') and values are their classes (eg 'EE_Event')
140
+	 */
141
+	public static function add_addon_models(array $core_models = [])
142
+	{
143
+		foreach (self::$_model_name_to_classname_map as $model_name_to_class_map) {
144
+			$core_models = array_merge($core_models, $model_name_to_class_map);
145
+		}
146
+		return $core_models;
147
+	}
148 148
 
149 149
 
150
-    /**
151
-     * Filters the list of model folders
152
-     *
153
-     * @param array $folders
154
-     * @return array of folder paths
155
-     */
156
-    public static function add_model_folders(array $folders = [])
157
-    {
158
-        foreach (self::$_model_registry as $setup_args) {
159
-            if (isset($setup_args['model_paths'])) {
160
-                $folders = array_merge($folders, $setup_args['model_paths']);
161
-            }
162
-        }
163
-        return $folders;
164
-    }
150
+	/**
151
+	 * Filters the list of model folders
152
+	 *
153
+	 * @param array $folders
154
+	 * @return array of folder paths
155
+	 */
156
+	public static function add_model_folders(array $folders = [])
157
+	{
158
+		foreach (self::$_model_registry as $setup_args) {
159
+			if (isset($setup_args['model_paths'])) {
160
+				$folders = array_merge($folders, $setup_args['model_paths']);
161
+			}
162
+		}
163
+		return $folders;
164
+	}
165 165
 
166 166
 
167
-    /**
168
-     * Filters the array of model class paths
169
-     *
170
-     * @param array $folders
171
-     * @return array of folder paths
172
-     */
173
-    public static function add_class_folders(array $folders = [])
174
-    {
175
-        foreach (self::$_model_registry as $setup_args) {
176
-            if (isset($setup_args['class_paths'])) {
177
-                $folders = array_merge($folders, $setup_args['class_paths']);
178
-            }
179
-        }
180
-        return $folders;
181
-    }
167
+	/**
168
+	 * Filters the array of model class paths
169
+	 *
170
+	 * @param array $folders
171
+	 * @return array of folder paths
172
+	 */
173
+	public static function add_class_folders(array $folders = [])
174
+	{
175
+		foreach (self::$_model_registry as $setup_args) {
176
+			if (isset($setup_args['class_paths'])) {
177
+				$folders = array_merge($folders, $setup_args['class_paths']);
178
+			}
179
+		}
180
+		return $folders;
181
+	}
182 182
 
183 183
 
184
-    /**
185
-     * deregister
186
-     *
187
-     * @param string $identifier
188
-     */
189
-    public static function deregister($identifier = '')
190
-    {
191
-        unset(self::$_model_registry[ $identifier ], self::$_model_name_to_classname_map[ $identifier ]);
192
-    }
184
+	/**
185
+	 * deregister
186
+	 *
187
+	 * @param string $identifier
188
+	 */
189
+	public static function deregister($identifier = '')
190
+	{
191
+		unset(self::$_model_registry[ $identifier ], self::$_model_name_to_classname_map[ $identifier ]);
192
+	}
193 193
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
         }
59 59
 
60 60
         // make sure we don't register twice
61
-        if (isset(self::$_model_registry[ $identifier ])) {
61
+        if (isset(self::$_model_registry[$identifier])) {
62 62
             return;
63 63
         }
64 64
 
65
-        if (! did_action('AHEE__EE_System__load_espresso_addons')
65
+        if ( ! did_action('AHEE__EE_System__load_espresso_addons')
66 66
             || did_action('FHEE__EE_System__parse_model_names')
67 67
             || did_action('FHEE__EE_System__parse_implemented_model_names')) {
68 68
             EE_Error::doing_it_wrong(
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
                 '4.5'
78 78
             );
79 79
         }
80
-        self::$_model_registry[ $identifier ] = $setup_args;
80
+        self::$_model_registry[$identifier] = $setup_args;
81 81
 
82 82
         if ((isset($setup_args['model_paths']) && ! isset($setup_args['class_paths']))
83
-            || (! isset($setup_args['model_paths']) && isset($setup_args['class_paths']))) {
83
+            || ( ! isset($setup_args['model_paths']) && isset($setup_args['class_paths']))) {
84 84
             throw new EE_Error(
85 85
                 sprintf(
86 86
                     __(
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         }
94 94
         if (isset($setup_args['model_paths'])) {
95 95
             // make sure they passed in an array
96
-            if (! is_array($setup_args['model_paths'])) {
96
+            if ( ! is_array($setup_args['model_paths'])) {
97 97
                 $setup_args['model_paths'] = [$setup_args['model_paths']];
98 98
             }
99 99
             // we want to add this as a model folder
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
             EEH_Autoloader::register_autoloader($class_to_filepath_map);
103 103
             $model_name_to_classname_map = [];
104 104
             foreach (array_keys($class_to_filepath_map) as $classname) {
105
-                $model_name_to_classname_map[ str_replace("EEM_", "", $classname) ] = $classname;
105
+                $model_name_to_classname_map[str_replace("EEM_", "", $classname)] = $classname;
106 106
             }
107
-            self::$_model_name_to_classname_map[ $identifier ] = $model_name_to_classname_map;
107
+            self::$_model_name_to_classname_map[$identifier] = $model_name_to_classname_map;
108 108
             add_filter('FHEE__EE_System__parse_model_names', ['EE_Register_Model', 'add_addon_models']);
109 109
             add_filter(
110 110
                 'FHEE__EE_System__parse_implemented_model_names',
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         }
116 116
         if (isset($setup_args['class_paths'])) {
117 117
             // make sure they passed in an array
118
-            if (! is_array($setup_args['class_paths'])) {
118
+            if ( ! is_array($setup_args['class_paths'])) {
119 119
                 $setup_args['class_paths'] = [$setup_args['class_paths']];
120 120
             }
121 121
             $class_to_filepath_map = EEH_File::get_contents_of_folders($setup_args['class_paths']);
@@ -188,6 +188,6 @@  discard block
 block discarded – undo
188 188
      */
189 189
     public static function deregister($identifier = '')
190 190
     {
191
-        unset(self::$_model_registry[ $identifier ], self::$_model_name_to_classname_map[ $identifier ]);
191
+        unset(self::$_model_registry[$identifier], self::$_model_name_to_classname_map[$identifier]);
192 192
     }
193 193
 }
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Module.lib.php 2 patches
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -15,95 +15,95 @@
 block discarded – undo
15 15
 class EE_Register_Module implements EEI_Plugin_API
16 16
 {
17 17
 
18
-    /**
19
-     * Holds values for registered modules
20
-     *
21
-     * @var array
22
-     */
23
-    protected static $_settings = [];
18
+	/**
19
+	 * Holds values for registered modules
20
+	 *
21
+	 * @var array
22
+	 */
23
+	protected static $_settings = [];
24 24
 
25 25
 
26
-    /**
27
-     *    Method for registering new EED_Modules
28
-     *
29
-     * @param string $identifier a unique identifier for this set of modules Required.
30
-     * @param array  $setup_args an array of full server paths to folders containing any EED_Modules, or to the
31
-     *                           EED_Module files themselves Required.
32
-     * @type    array module_paths    an array of full server paths to folders containing any EED_Modules, or to the
33
-     *                           EED_Module files themselves
34
-     * @return void
35
-     * @throws EE_Error
36
-     * @since    4.3.0
37
-     */
38
-    public static function register($identifier = '', array $setup_args = [])
39
-    {
40
-        // required fields MUST be present, so let's make sure they are.
41
-        if (empty($identifier) || ! is_array($setup_args) || empty($setup_args['module_paths'])) {
42
-            throw new EE_Error(
43
-                __(
44
-                    'In order to register Modules with EE_Register_Module::register(), you must include a "module_id" (a unique identifier for this set of modules), and an array containing the following keys: "module_paths" (an array of full server paths to folders that contain modules, or to the module files themselves)',
45
-                    'event_espresso'
46
-                )
47
-            );
48
-        }
26
+	/**
27
+	 *    Method for registering new EED_Modules
28
+	 *
29
+	 * @param string $identifier a unique identifier for this set of modules Required.
30
+	 * @param array  $setup_args an array of full server paths to folders containing any EED_Modules, or to the
31
+	 *                           EED_Module files themselves Required.
32
+	 * @type    array module_paths    an array of full server paths to folders containing any EED_Modules, or to the
33
+	 *                           EED_Module files themselves
34
+	 * @return void
35
+	 * @throws EE_Error
36
+	 * @since    4.3.0
37
+	 */
38
+	public static function register($identifier = '', array $setup_args = [])
39
+	{
40
+		// required fields MUST be present, so let's make sure they are.
41
+		if (empty($identifier) || ! is_array($setup_args) || empty($setup_args['module_paths'])) {
42
+			throw new EE_Error(
43
+				__(
44
+					'In order to register Modules with EE_Register_Module::register(), you must include a "module_id" (a unique identifier for this set of modules), and an array containing the following keys: "module_paths" (an array of full server paths to folders that contain modules, or to the module files themselves)',
45
+					'event_espresso'
46
+				)
47
+			);
48
+		}
49 49
 
50
-        // make sure we don't register twice
51
-        if (isset(self::$_settings[ $identifier ])) {
52
-            return;
53
-        }
50
+		// make sure we don't register twice
51
+		if (isset(self::$_settings[ $identifier ])) {
52
+			return;
53
+		}
54 54
 
55
-        // make sure this was called in the right place!
56
-        if (! did_action('AHEE__EE_System__load_espresso_addons')
57
-            || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')
58
-        ) {
59
-            EE_Error::doing_it_wrong(
60
-                __METHOD__,
61
-                __(
62
-                    'An attempt to register modules has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register modules.',
63
-                    'event_espresso'
64
-                ),
65
-                '4.3.0'
66
-            );
67
-        }
68
-        // setup $_settings array from incoming values.
69
-        self::$_settings[ $identifier ] = [
70
-            // array of full server paths to any EED_Modules used by the module
71
-            'module_paths' => isset($setup_args['module_paths']) ? (array) $setup_args['module_paths'] : [],
72
-        ];
73
-        // add to list of modules to be registered
74
-        add_filter(
75
-            'FHEE__EE_Config__register_modules__modules_to_register',
76
-            ['EE_Register_Module', 'add_modules']
77
-        );
78
-    }
55
+		// make sure this was called in the right place!
56
+		if (! did_action('AHEE__EE_System__load_espresso_addons')
57
+			|| did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')
58
+		) {
59
+			EE_Error::doing_it_wrong(
60
+				__METHOD__,
61
+				__(
62
+					'An attempt to register modules has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register modules.',
63
+					'event_espresso'
64
+				),
65
+				'4.3.0'
66
+			);
67
+		}
68
+		// setup $_settings array from incoming values.
69
+		self::$_settings[ $identifier ] = [
70
+			// array of full server paths to any EED_Modules used by the module
71
+			'module_paths' => isset($setup_args['module_paths']) ? (array) $setup_args['module_paths'] : [],
72
+		];
73
+		// add to list of modules to be registered
74
+		add_filter(
75
+			'FHEE__EE_Config__register_modules__modules_to_register',
76
+			['EE_Register_Module', 'add_modules']
77
+		);
78
+	}
79 79
 
80 80
 
81
-    /**
82
-     * Filters the list of modules to add ours.
83
-     * and they're just full filepaths to FOLDERS containing a module class file. Eg.
84
-     * array('espresso_monkey'=>'/public_html/wonder-site/wp-content/plugins/ee4/shortcodes/espresso_monkey'...)
85
-     *
86
-     * @param array $modules_to_register array of paths to all modules that require registering
87
-     * @return array
88
-     */
89
-    public static function add_modules(array $modules_to_register)
90
-    {
91
-        foreach (self::$_settings as $settings) {
92
-            $modules_to_register = array_merge($modules_to_register, $settings['module_paths']);
93
-        }
94
-        return $modules_to_register;
95
-    }
81
+	/**
82
+	 * Filters the list of modules to add ours.
83
+	 * and they're just full filepaths to FOLDERS containing a module class file. Eg.
84
+	 * array('espresso_monkey'=>'/public_html/wonder-site/wp-content/plugins/ee4/shortcodes/espresso_monkey'...)
85
+	 *
86
+	 * @param array $modules_to_register array of paths to all modules that require registering
87
+	 * @return array
88
+	 */
89
+	public static function add_modules(array $modules_to_register)
90
+	{
91
+		foreach (self::$_settings as $settings) {
92
+			$modules_to_register = array_merge($modules_to_register, $settings['module_paths']);
93
+		}
94
+		return $modules_to_register;
95
+	}
96 96
 
97 97
 
98
-    /**
99
-     * This deregisters a module that was previously registered with a specific $identifier.
100
-     *
101
-     * @param string $identifier the name for the module that was previously registered
102
-     * @return void
103
-     * @since    4.3.0
104
-     */
105
-    public static function deregister($identifier = '')
106
-    {
107
-        unset(self::$_settings[ $identifier ]);
108
-    }
98
+	/**
99
+	 * This deregisters a module that was previously registered with a specific $identifier.
100
+	 *
101
+	 * @param string $identifier the name for the module that was previously registered
102
+	 * @return void
103
+	 * @since    4.3.0
104
+	 */
105
+	public static function deregister($identifier = '')
106
+	{
107
+		unset(self::$_settings[ $identifier ]);
108
+	}
109 109
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
         }
49 49
 
50 50
         // make sure we don't register twice
51
-        if (isset(self::$_settings[ $identifier ])) {
51
+        if (isset(self::$_settings[$identifier])) {
52 52
             return;
53 53
         }
54 54
 
55 55
         // make sure this was called in the right place!
56
-        if (! did_action('AHEE__EE_System__load_espresso_addons')
56
+        if ( ! did_action('AHEE__EE_System__load_espresso_addons')
57 57
             || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')
58 58
         ) {
59 59
             EE_Error::doing_it_wrong(
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             );
67 67
         }
68 68
         // setup $_settings array from incoming values.
69
-        self::$_settings[ $identifier ] = [
69
+        self::$_settings[$identifier] = [
70 70
             // array of full server paths to any EED_Modules used by the module
71 71
             'module_paths' => isset($setup_args['module_paths']) ? (array) $setup_args['module_paths'] : [],
72 72
         ];
@@ -104,6 +104,6 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public static function deregister($identifier = '')
106 106
     {
107
-        unset(self::$_settings[ $identifier ]);
107
+        unset(self::$_settings[$identifier]);
108 108
     }
109 109
 }
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Message_Type.lib.php 2 patches
Indentation   +447 added lines, -447 removed lines patch added patch discarded remove patch
@@ -12,477 +12,477 @@
 block discarded – undo
12 12
 {
13 13
 
14 14
 
15
-    /**
16
-     * Holds values for registered message types
17
-     *
18
-     * @var array
19
-     */
20
-    protected static $_ee_message_type_registry = [];
15
+	/**
16
+	 * Holds values for registered message types
17
+	 *
18
+	 * @var array
19
+	 */
20
+	protected static $_ee_message_type_registry = [];
21 21
 
22 22
 
23
-    /**
24
-     * Method for registering new message types in the EE_messages system.
25
-     * Note:  All message types must have the following files in order to work:
26
-     * Template files for default templates getting setup.
27
-     * See /core/libraries/messages/defaults/default/ for examples
28
-     * (note that template files match a specific naming schema).
29
-     * These templates will need to be registered with the default template pack.
30
-     * - EE_Messages_Validator extended class(es).  See /core/libraries/messages/validators/email/
31
-     *      for examples.  Note for any new message types, there will need to be a validator for each
32
-     *      messenger combo this message type can activate with.
33
-     * - And of course the main EE_{Message_Type_Name}_message_type class that defines the new
34
-     *      message type and its properties.
35
-     *
36
-     * @param string $identifier    Whatever is defined for the $name property of
37
-     *                              the message type you are registering (eg.
38
-     *                              declined_registration). Required.
39
-     * @param array  $setup_args    An array of arguments provided for registering the message type.
40
-     * @throws EE_Error
41
-     *                              }
42
-     * @see      inline docs in the register method for what can be passed in as arguments.
43
-     * @since    4.3.0
44
-     */
45
-    public static function register($identifier = '', array $setup_args = [])
46
-    {
47
-        // required fields MUST be present, so let's make sure they are.
48
-        if (! isset($identifier)
49
-            || ! is_array($setup_args)
50
-            || empty($setup_args['mtfilename'])
51
-            || empty($setup_args['autoloadpaths'])
52
-        ) {
53
-            throw new EE_Error(
54
-                __(
55
-                    'In order to register a message type with EE_Register_Message_Type::register, you must include a unique name for the message type, plus an array containing the following keys: "mtfilename", "autoloadpaths"',
56
-                    'event_espresso'
57
-                )
58
-            );
59
-        }
23
+	/**
24
+	 * Method for registering new message types in the EE_messages system.
25
+	 * Note:  All message types must have the following files in order to work:
26
+	 * Template files for default templates getting setup.
27
+	 * See /core/libraries/messages/defaults/default/ for examples
28
+	 * (note that template files match a specific naming schema).
29
+	 * These templates will need to be registered with the default template pack.
30
+	 * - EE_Messages_Validator extended class(es).  See /core/libraries/messages/validators/email/
31
+	 *      for examples.  Note for any new message types, there will need to be a validator for each
32
+	 *      messenger combo this message type can activate with.
33
+	 * - And of course the main EE_{Message_Type_Name}_message_type class that defines the new
34
+	 *      message type and its properties.
35
+	 *
36
+	 * @param string $identifier    Whatever is defined for the $name property of
37
+	 *                              the message type you are registering (eg.
38
+	 *                              declined_registration). Required.
39
+	 * @param array  $setup_args    An array of arguments provided for registering the message type.
40
+	 * @throws EE_Error
41
+	 *                              }
42
+	 * @see      inline docs in the register method for what can be passed in as arguments.
43
+	 * @since    4.3.0
44
+	 */
45
+	public static function register($identifier = '', array $setup_args = [])
46
+	{
47
+		// required fields MUST be present, so let's make sure they are.
48
+		if (! isset($identifier)
49
+			|| ! is_array($setup_args)
50
+			|| empty($setup_args['mtfilename'])
51
+			|| empty($setup_args['autoloadpaths'])
52
+		) {
53
+			throw new EE_Error(
54
+				__(
55
+					'In order to register a message type with EE_Register_Message_Type::register, you must include a unique name for the message type, plus an array containing the following keys: "mtfilename", "autoloadpaths"',
56
+					'event_espresso'
57
+				)
58
+			);
59
+		}
60 60
 
61
-        // make sure we don't register twice
62
-        if (isset(self::$_ee_message_type_registry[ $identifier ])) {
63
-            return;
64
-        }
61
+		// make sure we don't register twice
62
+		if (isset(self::$_ee_message_type_registry[ $identifier ])) {
63
+			return;
64
+		}
65 65
 
66
-        // make sure this was called in the right place!
67
-        if (! did_action('EE_Brewing_Regular___messages_caf')
68
-            || did_action('AHEE__EE_System__perform_activations_upgrades_and_migrations')
69
-        ) {
70
-            EE_Error::doing_it_wrong(
71
-                __METHOD__,
72
-                sprintf(
73
-                    __(
74
-                        'A message type named "%s" has been attempted to be registered with the EE Messages System.  It may or may not work because it should be only called on the "EE_Brewing_Regular___messages_caf" hook.',
75
-                        'event_espresso'
76
-                    ),
77
-                    $identifier
78
-                ),
79
-                '4.3.0'
80
-            );
81
-        }
82
-        // setup $__ee_message_type_registry array from incoming values.
83
-        self::$_ee_message_type_registry[ $identifier ] = [
84
-            /**
85
-             * The file name for the message type being registered.
86
-             * Required.
87
-             *
88
-             * @type string
89
-             */
90
-            'mtfilename'                                       => (string) $setup_args['mtfilename'],
91
-            /**
92
-             * Autoload paths for classes used by the message type.
93
-             * Required.
94
-             *
95
-             * @type array
96
-             */
97
-            'autoloadpaths'                                    => (array) $setup_args['autoloadpaths'],
98
-            /**
99
-             * Messengers that the message type should be able to activate with.
100
-             * Use messenger slugs.
101
-             *
102
-             * @type array
103
-             */
104
-            'messengers_to_activate_with'                      => ! empty($setup_args['messengers_to_activate_with'])
105
-                ? (array) $setup_args['messengers_to_activate_with']
106
-                : [],
107
-            /**
108
-             * Messengers that the message type should validate with.
109
-             * Use messenger slugs.
110
-             *
111
-             * @type array
112
-             */
113
-            'messengers_to_validate_with'                      => ! empty($setup_args['messengers_to_validate_with'])
114
-                ? (array) $setup_args['messengers_to_validate_with']
115
-                : [],
116
-            /**
117
-             * Whether to force activate this message type the first time it is registered.
118
-             *
119
-             * @type bool   False means its not activated by default and left up to the end user to activate.
120
-             */
121
-            'force_activation'                                 => ! empty($setup_args['force_activation'])
122
-                                                                  && $setup_args['force_activation'],
123
-            /**
124
-             * What messengers this message type supports the default template pack for.
125
-             * Note: If you do not set this (or any of the following template pack/variation related arguments) to true,
126
-             * then it is expected that the message type being registered is doing its own custom default template
127
-             * pack/variation registration.
128
-             *
129
-             * If this is set and has values, then it is expected that the following arguments are also set in the incoming options
130
-             * $setup_arguments array as well:
131
-             * - 'base_path_for_default_templates'
132
-             *
133
-             * @type array   Expect an array of messengers this supports default template packs for.
134
-             */
135
-            'messengers_supporting_default_template_pack_with' => isset($setup_args['messengers_supporting_default_template_pack_with'])
136
-                ? (array) $setup_args['messengers_supporting_default_template_pack_with']
137
-                : [],
138
-            /**
139
-             * The base path where the default templates for this message type can be found.
140
-             *
141
-             * @type string
142
-             */
143
-            'base_path_for_default_templates'                  => isset($setup_args['base_path_for_default_templates'])
144
-                ? $setup_args['base_path_for_default_templates'] : '',
145
-            /**
146
-             * The base path where the default variations for this message type can be found.
147
-             *
148
-             * @type string
149
-             */
150
-            'base_path_for_default_variation'                  => isset($setup_args['base_path_for_default_variation'])
151
-                ? $setup_args['base_path_for_default_variation'] : '',
152
-            /**
153
-             * The base url for the default variations for this message type.
154
-             *
155
-             * @type string
156
-             */
157
-            'base_url_for_default_variation'                   => isset($setup_args['base_url_for_default_variation'])
158
-                ? $setup_args['base_url_for_default_variation'] : '',
159
-        ];
160
-        // add filters but only if they haven't already been set (these filters only need to be registered ONCE because
161
-        // the callback handles all registered message types.
162
-        if (false === has_filter(
163
-            'FHEE__EED_Messages___set_messages_paths___MSG_PATHS',
164
-            ['EE_Register_Message_Type', 'register_msgs_autoload_paths']
165
-        )) {
166
-            add_filter(
167
-                'FHEE__EED_Messages___set_messages_paths___MSG_PATHS',
168
-                ['EE_Register_Message_Type', 'register_msgs_autoload_paths'],
169
-                10
170
-            );
171
-            add_filter(
172
-                'FHEE__EE_messages__get_installed__messagetype_files',
173
-                ['EE_Register_Message_Type', 'register_messagetype_files'],
174
-                10,
175
-                1
176
-            );
177
-            add_filter(
178
-                'FHEE__EE_messenger__get_default_message_types__default_types',
179
-                ['EE_Register_Message_Type', 'register_messengers_to_activate_mt_with'],
180
-                10,
181
-                2
182
-            );
183
-            add_filter(
184
-                'FHEE__EE_messenger__get_valid_message_types__valid_types',
185
-                ['EE_Register_Message_Type', 'register_messengers_to_validate_mt_with'],
186
-                10,
187
-                2
188
-            );
189
-            // actions
190
-            add_action(
191
-                'AHEE__EE_Addon__initialize_default_data__begin',
192
-                ['EE_Register_Message_Type', 'set_defaults']
193
-            );
66
+		// make sure this was called in the right place!
67
+		if (! did_action('EE_Brewing_Regular___messages_caf')
68
+			|| did_action('AHEE__EE_System__perform_activations_upgrades_and_migrations')
69
+		) {
70
+			EE_Error::doing_it_wrong(
71
+				__METHOD__,
72
+				sprintf(
73
+					__(
74
+						'A message type named "%s" has been attempted to be registered with the EE Messages System.  It may or may not work because it should be only called on the "EE_Brewing_Regular___messages_caf" hook.',
75
+						'event_espresso'
76
+					),
77
+					$identifier
78
+				),
79
+				'4.3.0'
80
+			);
81
+		}
82
+		// setup $__ee_message_type_registry array from incoming values.
83
+		self::$_ee_message_type_registry[ $identifier ] = [
84
+			/**
85
+			 * The file name for the message type being registered.
86
+			 * Required.
87
+			 *
88
+			 * @type string
89
+			 */
90
+			'mtfilename'                                       => (string) $setup_args['mtfilename'],
91
+			/**
92
+			 * Autoload paths for classes used by the message type.
93
+			 * Required.
94
+			 *
95
+			 * @type array
96
+			 */
97
+			'autoloadpaths'                                    => (array) $setup_args['autoloadpaths'],
98
+			/**
99
+			 * Messengers that the message type should be able to activate with.
100
+			 * Use messenger slugs.
101
+			 *
102
+			 * @type array
103
+			 */
104
+			'messengers_to_activate_with'                      => ! empty($setup_args['messengers_to_activate_with'])
105
+				? (array) $setup_args['messengers_to_activate_with']
106
+				: [],
107
+			/**
108
+			 * Messengers that the message type should validate with.
109
+			 * Use messenger slugs.
110
+			 *
111
+			 * @type array
112
+			 */
113
+			'messengers_to_validate_with'                      => ! empty($setup_args['messengers_to_validate_with'])
114
+				? (array) $setup_args['messengers_to_validate_with']
115
+				: [],
116
+			/**
117
+			 * Whether to force activate this message type the first time it is registered.
118
+			 *
119
+			 * @type bool   False means its not activated by default and left up to the end user to activate.
120
+			 */
121
+			'force_activation'                                 => ! empty($setup_args['force_activation'])
122
+																  && $setup_args['force_activation'],
123
+			/**
124
+			 * What messengers this message type supports the default template pack for.
125
+			 * Note: If you do not set this (or any of the following template pack/variation related arguments) to true,
126
+			 * then it is expected that the message type being registered is doing its own custom default template
127
+			 * pack/variation registration.
128
+			 *
129
+			 * If this is set and has values, then it is expected that the following arguments are also set in the incoming options
130
+			 * $setup_arguments array as well:
131
+			 * - 'base_path_for_default_templates'
132
+			 *
133
+			 * @type array   Expect an array of messengers this supports default template packs for.
134
+			 */
135
+			'messengers_supporting_default_template_pack_with' => isset($setup_args['messengers_supporting_default_template_pack_with'])
136
+				? (array) $setup_args['messengers_supporting_default_template_pack_with']
137
+				: [],
138
+			/**
139
+			 * The base path where the default templates for this message type can be found.
140
+			 *
141
+			 * @type string
142
+			 */
143
+			'base_path_for_default_templates'                  => isset($setup_args['base_path_for_default_templates'])
144
+				? $setup_args['base_path_for_default_templates'] : '',
145
+			/**
146
+			 * The base path where the default variations for this message type can be found.
147
+			 *
148
+			 * @type string
149
+			 */
150
+			'base_path_for_default_variation'                  => isset($setup_args['base_path_for_default_variation'])
151
+				? $setup_args['base_path_for_default_variation'] : '',
152
+			/**
153
+			 * The base url for the default variations for this message type.
154
+			 *
155
+			 * @type string
156
+			 */
157
+			'base_url_for_default_variation'                   => isset($setup_args['base_url_for_default_variation'])
158
+				? $setup_args['base_url_for_default_variation'] : '',
159
+		];
160
+		// add filters but only if they haven't already been set (these filters only need to be registered ONCE because
161
+		// the callback handles all registered message types.
162
+		if (false === has_filter(
163
+			'FHEE__EED_Messages___set_messages_paths___MSG_PATHS',
164
+			['EE_Register_Message_Type', 'register_msgs_autoload_paths']
165
+		)) {
166
+			add_filter(
167
+				'FHEE__EED_Messages___set_messages_paths___MSG_PATHS',
168
+				['EE_Register_Message_Type', 'register_msgs_autoload_paths'],
169
+				10
170
+			);
171
+			add_filter(
172
+				'FHEE__EE_messages__get_installed__messagetype_files',
173
+				['EE_Register_Message_Type', 'register_messagetype_files'],
174
+				10,
175
+				1
176
+			);
177
+			add_filter(
178
+				'FHEE__EE_messenger__get_default_message_types__default_types',
179
+				['EE_Register_Message_Type', 'register_messengers_to_activate_mt_with'],
180
+				10,
181
+				2
182
+			);
183
+			add_filter(
184
+				'FHEE__EE_messenger__get_valid_message_types__valid_types',
185
+				['EE_Register_Message_Type', 'register_messengers_to_validate_mt_with'],
186
+				10,
187
+				2
188
+			);
189
+			// actions
190
+			add_action(
191
+				'AHEE__EE_Addon__initialize_default_data__begin',
192
+				['EE_Register_Message_Type', 'set_defaults']
193
+			);
194 194
 
195
-            // default template packs and variations related
196
-            add_filter(
197
-                'FHEE__EE_Messages_Template_Pack_Default__get_supports',
198
-                ['EE_Register_Message_Type', 'register_default_template_pack_supports']
199
-            );
200
-            add_filter(
201
-                'FHEE__EE_Template_Pack___get_specific_template__filtered_base_path',
202
-                ['EE_Register_Message_Type', 'register_base_template_path'],
203
-                10,
204
-                6
205
-            );
206
-            add_filter(
207
-                'FHEE__EE_Messages_Template_Pack__get_variation__base_path_or_url',
208
-                ['EE_Register_Message_Type', 'register_variation_base_path_or_url'],
209
-                10,
210
-                8
211
-            );
212
-            add_filter(
213
-                'FHEE__EE_Messages_Template_Pack__get_variation__base_path',
214
-                ['EE_Register_Message_Type', 'register_variation_base_path_or_url'],
215
-                10,
216
-                8
217
-            );
218
-        }
219
-    }
195
+			// default template packs and variations related
196
+			add_filter(
197
+				'FHEE__EE_Messages_Template_Pack_Default__get_supports',
198
+				['EE_Register_Message_Type', 'register_default_template_pack_supports']
199
+			);
200
+			add_filter(
201
+				'FHEE__EE_Template_Pack___get_specific_template__filtered_base_path',
202
+				['EE_Register_Message_Type', 'register_base_template_path'],
203
+				10,
204
+				6
205
+			);
206
+			add_filter(
207
+				'FHEE__EE_Messages_Template_Pack__get_variation__base_path_or_url',
208
+				['EE_Register_Message_Type', 'register_variation_base_path_or_url'],
209
+				10,
210
+				8
211
+			);
212
+			add_filter(
213
+				'FHEE__EE_Messages_Template_Pack__get_variation__base_path',
214
+				['EE_Register_Message_Type', 'register_variation_base_path_or_url'],
215
+				10,
216
+				8
217
+			);
218
+		}
219
+	}
220 220
 
221 221
 
222
-    /**
223
-     * This just ensures that when an addon registers a message type that on initial activation/reactivation the
224
-     * defaults the addon sets are taken care of.
225
-     *
226
-     * @throws EE_Error
227
-     * @throws ReflectionException
228
-     */
229
-    public static function set_defaults()
230
-    {
231
-        /** @type EE_Message_Resource_Manager $message_resource_manager */
232
-        $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
222
+	/**
223
+	 * This just ensures that when an addon registers a message type that on initial activation/reactivation the
224
+	 * defaults the addon sets are taken care of.
225
+	 *
226
+	 * @throws EE_Error
227
+	 * @throws ReflectionException
228
+	 */
229
+	public static function set_defaults()
230
+	{
231
+		/** @type EE_Message_Resource_Manager $message_resource_manager */
232
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
233 233
 
234
-        // for any message types with force activation, let's ensure they are activated
235
-        foreach (self::$_ee_message_type_registry as $identifier => $settings) {
236
-            if ($settings['force_activation']) {
237
-                foreach ($settings['messengers_to_activate_with'] as $messenger) {
238
-                    // DO not force activation if this message type has already been activated in the system
239
-                    if (! $message_resource_manager->has_message_type_been_activated_for_messenger(
240
-                        $identifier,
241
-                        $messenger
242
-                    )
243
-                    ) {
244
-                        $message_resource_manager->ensure_message_type_is_active($identifier, $messenger);
245
-                    }
246
-                }
247
-            }
248
-        }
249
-    }
234
+		// for any message types with force activation, let's ensure they are activated
235
+		foreach (self::$_ee_message_type_registry as $identifier => $settings) {
236
+			if ($settings['force_activation']) {
237
+				foreach ($settings['messengers_to_activate_with'] as $messenger) {
238
+					// DO not force activation if this message type has already been activated in the system
239
+					if (! $message_resource_manager->has_message_type_been_activated_for_messenger(
240
+						$identifier,
241
+						$messenger
242
+					)
243
+					) {
244
+						$message_resource_manager->ensure_message_type_is_active($identifier, $messenger);
245
+					}
246
+				}
247
+			}
248
+		}
249
+	}
250 250
 
251 251
 
252
-    /**
253
-     * This deregisters a message type that was previously registered with a specific message_type_name.
254
-     *
255
-     * @param string $identifier the name for the message type that was previously registered
256
-     * @return void
257
-     * @throws EE_Error
258
-     * @throws ReflectionException
259
-     * @since    4.3.0
260
-     */
261
-    public static function deregister($identifier = '')
262
-    {
263
-        if (! empty(self::$_ee_message_type_registry[ $identifier ])) {
264
-            // let's make sure that we remove any place this message type was made active
265
-            /** @var EE_Message_Resource_Manager $Message_Resource_Manager */
266
-            $Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
267
-            // ensures that if this message type is registered again that it retains its previous active state vs
268
-            // remaining inactive.
269
-            $Message_Resource_Manager->remove_message_type_has_been_activated_from_all_messengers(
270
-                $identifier,
271
-                true
272
-            );
273
-            $Message_Resource_Manager->deactivate_message_type($identifier, false);
274
-        }
275
-        unset(self::$_ee_message_type_registry[ $identifier ]);
276
-    }
252
+	/**
253
+	 * This deregisters a message type that was previously registered with a specific message_type_name.
254
+	 *
255
+	 * @param string $identifier the name for the message type that was previously registered
256
+	 * @return void
257
+	 * @throws EE_Error
258
+	 * @throws ReflectionException
259
+	 * @since    4.3.0
260
+	 */
261
+	public static function deregister($identifier = '')
262
+	{
263
+		if (! empty(self::$_ee_message_type_registry[ $identifier ])) {
264
+			// let's make sure that we remove any place this message type was made active
265
+			/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
266
+			$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
267
+			// ensures that if this message type is registered again that it retains its previous active state vs
268
+			// remaining inactive.
269
+			$Message_Resource_Manager->remove_message_type_has_been_activated_from_all_messengers(
270
+				$identifier,
271
+				true
272
+			);
273
+			$Message_Resource_Manager->deactivate_message_type($identifier, false);
274
+		}
275
+		unset(self::$_ee_message_type_registry[ $identifier ]);
276
+	}
277 277
 
278 278
 
279
-    /**
280
-     * callback for FHEE__EE_messages__get_installed__messagetype_files filter.
281
-     *
282
-     * @param array $messagetype_files The current array of message type file names
283
-     * @return  array                                 Array of message type file names
284
-     * @since   4.3.0
285
-     */
286
-    public static function register_messagetype_files(array $messagetype_files)
287
-    {
288
-        if (empty(self::$_ee_message_type_registry)) {
289
-            return $messagetype_files;
290
-        }
291
-        foreach (self::$_ee_message_type_registry as $mt_reg) {
292
-            if (empty($mt_reg['mtfilename'])) {
293
-                continue;
294
-            }
295
-            $messagetype_files[] = $mt_reg['mtfilename'];
296
-        }
297
-        return $messagetype_files;
298
-    }
279
+	/**
280
+	 * callback for FHEE__EE_messages__get_installed__messagetype_files filter.
281
+	 *
282
+	 * @param array $messagetype_files The current array of message type file names
283
+	 * @return  array                                 Array of message type file names
284
+	 * @since   4.3.0
285
+	 */
286
+	public static function register_messagetype_files(array $messagetype_files)
287
+	{
288
+		if (empty(self::$_ee_message_type_registry)) {
289
+			return $messagetype_files;
290
+		}
291
+		foreach (self::$_ee_message_type_registry as $mt_reg) {
292
+			if (empty($mt_reg['mtfilename'])) {
293
+				continue;
294
+			}
295
+			$messagetype_files[] = $mt_reg['mtfilename'];
296
+		}
297
+		return $messagetype_files;
298
+	}
299 299
 
300 300
 
301
-    /**
302
-     * callback for FHEE__EED_Messages___set_messages_paths___MSG_PATHS filter.
303
-     *
304
-     * @param array $paths array of paths to be checked by EE_messages autoloader.
305
-     * @return array
306
-     * @since    4.3.0
307
-     */
308
-    public static function register_msgs_autoload_paths(array $paths)
309
-    {
310
-        if (! empty(self::$_ee_message_type_registry)) {
311
-            foreach (self::$_ee_message_type_registry as $mt_reg) {
312
-                if (empty($mt_reg['autoloadpaths'])) {
313
-                    continue;
314
-                }
315
-                $paths = array_merge($paths, $mt_reg['autoloadpaths']);
316
-            }
317
-        }
318
-        return $paths;
319
-    }
301
+	/**
302
+	 * callback for FHEE__EED_Messages___set_messages_paths___MSG_PATHS filter.
303
+	 *
304
+	 * @param array $paths array of paths to be checked by EE_messages autoloader.
305
+	 * @return array
306
+	 * @since    4.3.0
307
+	 */
308
+	public static function register_msgs_autoload_paths(array $paths)
309
+	{
310
+		if (! empty(self::$_ee_message_type_registry)) {
311
+			foreach (self::$_ee_message_type_registry as $mt_reg) {
312
+				if (empty($mt_reg['autoloadpaths'])) {
313
+					continue;
314
+				}
315
+				$paths = array_merge($paths, $mt_reg['autoloadpaths']);
316
+			}
317
+		}
318
+		return $paths;
319
+	}
320 320
 
321 321
 
322
-    /**
323
-     * callback for FHEE__EE_messenger__get_default_message_types__default_types filter.
324
-     *
325
-     * @param array        $default_types   array of message types activated with messenger (
326
-     *                                      corresponds to the $name property of message type)
327
-     * @param EE_messenger $messenger       The EE_messenger the filter is called from.
328
-     * @return array
329
-     * @since  4.3.0
330
-     */
331
-    public static function register_messengers_to_activate_mt_with(array $default_types, EE_messenger $messenger)
332
-    {
333
-        if (empty(self::$_ee_message_type_registry)) {
334
-            return $default_types;
335
-        }
336
-        foreach (self::$_ee_message_type_registry as $identifier => $mt_reg) {
337
-            if (empty($mt_reg['messengers_to_activate_with']) || empty($mt_reg['mtfilename'])) {
338
-                continue;
339
-            }
340
-            // loop through each of the messengers and if it matches the loaded class
341
-            // then we add this message type to the
342
-            foreach ($mt_reg['messengers_to_activate_with'] as $msgr) {
343
-                if ($messenger->name == $msgr) {
344
-                    $default_types[] = $identifier;
345
-                }
346
-            }
347
-        }
322
+	/**
323
+	 * callback for FHEE__EE_messenger__get_default_message_types__default_types filter.
324
+	 *
325
+	 * @param array        $default_types   array of message types activated with messenger (
326
+	 *                                      corresponds to the $name property of message type)
327
+	 * @param EE_messenger $messenger       The EE_messenger the filter is called from.
328
+	 * @return array
329
+	 * @since  4.3.0
330
+	 */
331
+	public static function register_messengers_to_activate_mt_with(array $default_types, EE_messenger $messenger)
332
+	{
333
+		if (empty(self::$_ee_message_type_registry)) {
334
+			return $default_types;
335
+		}
336
+		foreach (self::$_ee_message_type_registry as $identifier => $mt_reg) {
337
+			if (empty($mt_reg['messengers_to_activate_with']) || empty($mt_reg['mtfilename'])) {
338
+				continue;
339
+			}
340
+			// loop through each of the messengers and if it matches the loaded class
341
+			// then we add this message type to the
342
+			foreach ($mt_reg['messengers_to_activate_with'] as $msgr) {
343
+				if ($messenger->name == $msgr) {
344
+					$default_types[] = $identifier;
345
+				}
346
+			}
347
+		}
348 348
 
349
-        return $default_types;
350
-    }
349
+		return $default_types;
350
+	}
351 351
 
352 352
 
353
-    /**
354
-     * callback for FHEE__EE_messenger__get_valid_message_types__default_types filter.
355
-     *
356
-     * @param array        $valid_types     array of message types valid with messenger (
357
-     *                                      corresponds to the $name property of message type)
358
-     * @param EE_messenger $messenger       The EE_messenger the filter is called from.
359
-     * @return  array
360
-     * @since   4.3.0
361
-     */
362
-    public static function register_messengers_to_validate_mt_with(array $valid_types, EE_messenger $messenger)
363
-    {
364
-        if (empty(self::$_ee_message_type_registry)) {
365
-            return $valid_types;
366
-        }
367
-        foreach (self::$_ee_message_type_registry as $identifier => $mt_reg) {
368
-            if (empty($mt_reg['messengers_to_validate_with']) || empty($mt_reg['mtfilename'])) {
369
-                continue;
370
-            }
371
-            // loop through each of the messengers and if it matches the loaded class
372
-            // then we add this message type to the
373
-            foreach ($mt_reg['messengers_to_validate_with'] as $msgr) {
374
-                if ($messenger->name == $msgr) {
375
-                    $valid_types[] = $identifier;
376
-                }
377
-            }
378
-        }
353
+	/**
354
+	 * callback for FHEE__EE_messenger__get_valid_message_types__default_types filter.
355
+	 *
356
+	 * @param array        $valid_types     array of message types valid with messenger (
357
+	 *                                      corresponds to the $name property of message type)
358
+	 * @param EE_messenger $messenger       The EE_messenger the filter is called from.
359
+	 * @return  array
360
+	 * @since   4.3.0
361
+	 */
362
+	public static function register_messengers_to_validate_mt_with(array $valid_types, EE_messenger $messenger)
363
+	{
364
+		if (empty(self::$_ee_message_type_registry)) {
365
+			return $valid_types;
366
+		}
367
+		foreach (self::$_ee_message_type_registry as $identifier => $mt_reg) {
368
+			if (empty($mt_reg['messengers_to_validate_with']) || empty($mt_reg['mtfilename'])) {
369
+				continue;
370
+			}
371
+			// loop through each of the messengers and if it matches the loaded class
372
+			// then we add this message type to the
373
+			foreach ($mt_reg['messengers_to_validate_with'] as $msgr) {
374
+				if ($messenger->name == $msgr) {
375
+					$valid_types[] = $identifier;
376
+				}
377
+			}
378
+		}
379 379
 
380
-        return $valid_types;
381
-    }
380
+		return $valid_types;
381
+	}
382 382
 
383 383
 
384
-    /**
385
-     * Callback for `FHEE__EE_Messages_Template_Pack_Default__get_supports` filter to register this message type as
386
-     * supporting the default template pack
387
-     *
388
-     * @param array $supports
389
-     *
390
-     * @return array
391
-     */
392
-    public static function register_default_template_pack_supports(array $supports)
393
-    {
394
-        foreach (self::$_ee_message_type_registry as $identifier => $mt_reg) {
395
-            if (empty($mt_reg['messengers_supporting_default_template_pack_with'])) {
396
-                continue;
397
-            }
398
-            foreach ($mt_reg['messengers_supporting_default_template_pack_with'] as $messenger_slug) {
399
-                $supports[ $messenger_slug ][] = $identifier;
400
-            }
401
-        }
402
-        return $supports;
403
-    }
384
+	/**
385
+	 * Callback for `FHEE__EE_Messages_Template_Pack_Default__get_supports` filter to register this message type as
386
+	 * supporting the default template pack
387
+	 *
388
+	 * @param array $supports
389
+	 *
390
+	 * @return array
391
+	 */
392
+	public static function register_default_template_pack_supports(array $supports)
393
+	{
394
+		foreach (self::$_ee_message_type_registry as $identifier => $mt_reg) {
395
+			if (empty($mt_reg['messengers_supporting_default_template_pack_with'])) {
396
+				continue;
397
+			}
398
+			foreach ($mt_reg['messengers_supporting_default_template_pack_with'] as $messenger_slug) {
399
+				$supports[ $messenger_slug ][] = $identifier;
400
+			}
401
+		}
402
+		return $supports;
403
+	}
404 404
 
405 405
 
406
-    /**
407
-     * Callback for FHEE__EE_Template_Pack___get_specific_template__filtered_base_path
408
-     *
409
-     * @param string                    $base_path The original base path for message templates
410
-     * @param EE_messenger              $messenger
411
-     * @param EE_message_type           $message_type
412
-     * @param string                    $field     The field requesting a template
413
-     * @param string                    $context   The context requesting a template
414
-     * @param EE_Messages_Template_Pack $template_pack
415
-     *
416
-     * @return string
417
-     */
418
-    public static function register_base_template_path(
419
-        $base_path,
420
-        EE_messenger $messenger,
421
-        EE_message_type $message_type,
422
-        $field,
423
-        $context,
424
-        EE_Messages_Template_Pack $template_pack
425
-    ) {
426
-        if (! $template_pack instanceof EE_Messages_Template_Pack_Default
427
-            || ! $message_type instanceof EE_message_type
428
-        ) {
429
-            return $base_path;
430
-        }
431
-        foreach (self::$_ee_message_type_registry as $identifier => $mt_reg) {
432
-            if ($message_type->name === $identifier
433
-                && ! empty($mt_reg['base_path_for_default_templates'])
434
-            ) {
435
-                return $mt_reg['base_path_for_default_templates'];
436
-            }
437
-        }
438
-        return $base_path;
439
-    }
406
+	/**
407
+	 * Callback for FHEE__EE_Template_Pack___get_specific_template__filtered_base_path
408
+	 *
409
+	 * @param string                    $base_path The original base path for message templates
410
+	 * @param EE_messenger              $messenger
411
+	 * @param EE_message_type           $message_type
412
+	 * @param string                    $field     The field requesting a template
413
+	 * @param string                    $context   The context requesting a template
414
+	 * @param EE_Messages_Template_Pack $template_pack
415
+	 *
416
+	 * @return string
417
+	 */
418
+	public static function register_base_template_path(
419
+		$base_path,
420
+		EE_messenger $messenger,
421
+		EE_message_type $message_type,
422
+		$field,
423
+		$context,
424
+		EE_Messages_Template_Pack $template_pack
425
+	) {
426
+		if (! $template_pack instanceof EE_Messages_Template_Pack_Default
427
+			|| ! $message_type instanceof EE_message_type
428
+		) {
429
+			return $base_path;
430
+		}
431
+		foreach (self::$_ee_message_type_registry as $identifier => $mt_reg) {
432
+			if ($message_type->name === $identifier
433
+				&& ! empty($mt_reg['base_path_for_default_templates'])
434
+			) {
435
+				return $mt_reg['base_path_for_default_templates'];
436
+			}
437
+		}
438
+		return $base_path;
439
+	}
440 440
 
441 441
 
442
-    /**
443
-     * Callback for FHEE__EE_Messages_Template_Pack__get_variation__base_path and
444
-     * FHEE__EE_Messages_Template_Pack__get_variation__base_path_or_url hooks
445
-     *
446
-     * @param string                    $base_path_or_url  The original incoming base url or path
447
-     * @param string                    $messenger_slug    The slug of the messenger the template is being generated
448
-     *                                                     for.
449
-     * @param string                    $message_type_slug The slug of the message type the template is being generated
450
-     *                                                     for.
451
-     * @param string                    $type              The "type" of css being requested.
452
-     * @param string                    $variation         The variation being requested.
453
-     * @param bool                      $url               whether a url or path is being requested.
454
-     * @param string                    $file_extension    What file extension is expected for the variation file.
455
-     * @param EE_Messages_Template_Pack $template_pack
456
-     *
457
-     * @return string
458
-     */
459
-    public static function register_variation_base_path_or_url(
460
-        $base_path_or_url,
461
-        $messenger_slug,
462
-        $message_type_slug,
463
-        $type,
464
-        $variation,
465
-        $url,
466
-        $file_extension,
467
-        EE_Messages_Template_Pack $template_pack
468
-    ) {
469
-        if (! $template_pack instanceof EE_Messages_Template_Pack_Default) {
470
-            return $base_path_or_url;
471
-        }
472
-        foreach (self::$_ee_message_type_registry as $identifier => $mt_reg) {
473
-            if ($identifier === $message_type_slug
474
-            ) {
475
-                if ($url
476
-                    && ! empty($mt_reg['base_url_for_default_variation'])
477
-                ) {
478
-                    return $mt_reg['base_url_for_default_variation'];
479
-                } elseif (! $url
480
-                          && ! empty($mt_reg['base_path_for_default_variation'])
481
-                ) {
482
-                    return $mt_reg['base_path_for_default_variation'];
483
-                }
484
-            }
485
-        }
486
-        return $base_path_or_url;
487
-    }
442
+	/**
443
+	 * Callback for FHEE__EE_Messages_Template_Pack__get_variation__base_path and
444
+	 * FHEE__EE_Messages_Template_Pack__get_variation__base_path_or_url hooks
445
+	 *
446
+	 * @param string                    $base_path_or_url  The original incoming base url or path
447
+	 * @param string                    $messenger_slug    The slug of the messenger the template is being generated
448
+	 *                                                     for.
449
+	 * @param string                    $message_type_slug The slug of the message type the template is being generated
450
+	 *                                                     for.
451
+	 * @param string                    $type              The "type" of css being requested.
452
+	 * @param string                    $variation         The variation being requested.
453
+	 * @param bool                      $url               whether a url or path is being requested.
454
+	 * @param string                    $file_extension    What file extension is expected for the variation file.
455
+	 * @param EE_Messages_Template_Pack $template_pack
456
+	 *
457
+	 * @return string
458
+	 */
459
+	public static function register_variation_base_path_or_url(
460
+		$base_path_or_url,
461
+		$messenger_slug,
462
+		$message_type_slug,
463
+		$type,
464
+		$variation,
465
+		$url,
466
+		$file_extension,
467
+		EE_Messages_Template_Pack $template_pack
468
+	) {
469
+		if (! $template_pack instanceof EE_Messages_Template_Pack_Default) {
470
+			return $base_path_or_url;
471
+		}
472
+		foreach (self::$_ee_message_type_registry as $identifier => $mt_reg) {
473
+			if ($identifier === $message_type_slug
474
+			) {
475
+				if ($url
476
+					&& ! empty($mt_reg['base_url_for_default_variation'])
477
+				) {
478
+					return $mt_reg['base_url_for_default_variation'];
479
+				} elseif (! $url
480
+						  && ! empty($mt_reg['base_path_for_default_variation'])
481
+				) {
482
+					return $mt_reg['base_path_for_default_variation'];
483
+				}
484
+			}
485
+		}
486
+		return $base_path_or_url;
487
+	}
488 488
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     public static function register($identifier = '', array $setup_args = [])
46 46
     {
47 47
         // required fields MUST be present, so let's make sure they are.
48
-        if (! isset($identifier)
48
+        if ( ! isset($identifier)
49 49
             || ! is_array($setup_args)
50 50
             || empty($setup_args['mtfilename'])
51 51
             || empty($setup_args['autoloadpaths'])
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
         }
60 60
 
61 61
         // make sure we don't register twice
62
-        if (isset(self::$_ee_message_type_registry[ $identifier ])) {
62
+        if (isset(self::$_ee_message_type_registry[$identifier])) {
63 63
             return;
64 64
         }
65 65
 
66 66
         // make sure this was called in the right place!
67
-        if (! did_action('EE_Brewing_Regular___messages_caf')
67
+        if ( ! did_action('EE_Brewing_Regular___messages_caf')
68 68
             || did_action('AHEE__EE_System__perform_activations_upgrades_and_migrations')
69 69
         ) {
70 70
             EE_Error::doing_it_wrong(
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             );
81 81
         }
82 82
         // setup $__ee_message_type_registry array from incoming values.
83
-        self::$_ee_message_type_registry[ $identifier ] = [
83
+        self::$_ee_message_type_registry[$identifier] = [
84 84
             /**
85 85
              * The file name for the message type being registered.
86 86
              * Required.
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             if ($settings['force_activation']) {
237 237
                 foreach ($settings['messengers_to_activate_with'] as $messenger) {
238 238
                     // DO not force activation if this message type has already been activated in the system
239
-                    if (! $message_resource_manager->has_message_type_been_activated_for_messenger(
239
+                    if ( ! $message_resource_manager->has_message_type_been_activated_for_messenger(
240 240
                         $identifier,
241 241
                         $messenger
242 242
                     )
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
      */
261 261
     public static function deregister($identifier = '')
262 262
     {
263
-        if (! empty(self::$_ee_message_type_registry[ $identifier ])) {
263
+        if ( ! empty(self::$_ee_message_type_registry[$identifier])) {
264 264
             // let's make sure that we remove any place this message type was made active
265 265
             /** @var EE_Message_Resource_Manager $Message_Resource_Manager */
266 266
             $Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             );
273 273
             $Message_Resource_Manager->deactivate_message_type($identifier, false);
274 274
         }
275
-        unset(self::$_ee_message_type_registry[ $identifier ]);
275
+        unset(self::$_ee_message_type_registry[$identifier]);
276 276
     }
277 277
 
278 278
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
      */
308 308
     public static function register_msgs_autoload_paths(array $paths)
309 309
     {
310
-        if (! empty(self::$_ee_message_type_registry)) {
310
+        if ( ! empty(self::$_ee_message_type_registry)) {
311 311
             foreach (self::$_ee_message_type_registry as $mt_reg) {
312 312
                 if (empty($mt_reg['autoloadpaths'])) {
313 313
                     continue;
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
                 continue;
397 397
             }
398 398
             foreach ($mt_reg['messengers_supporting_default_template_pack_with'] as $messenger_slug) {
399
-                $supports[ $messenger_slug ][] = $identifier;
399
+                $supports[$messenger_slug][] = $identifier;
400 400
             }
401 401
         }
402 402
         return $supports;
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         $context,
424 424
         EE_Messages_Template_Pack $template_pack
425 425
     ) {
426
-        if (! $template_pack instanceof EE_Messages_Template_Pack_Default
426
+        if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default
427 427
             || ! $message_type instanceof EE_message_type
428 428
         ) {
429 429
             return $base_path;
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
         $file_extension,
467 467
         EE_Messages_Template_Pack $template_pack
468 468
     ) {
469
-        if (! $template_pack instanceof EE_Messages_Template_Pack_Default) {
469
+        if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default) {
470 470
             return $base_path_or_url;
471 471
         }
472 472
         foreach (self::$_ee_message_type_registry as $identifier => $mt_reg) {
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
                     && ! empty($mt_reg['base_url_for_default_variation'])
477 477
                 ) {
478 478
                     return $mt_reg['base_url_for_default_variation'];
479
-                } elseif (! $url
479
+                } elseif ( ! $url
480 480
                           && ! empty($mt_reg['base_path_for_default_variation'])
481 481
                 ) {
482 482
                     return $mt_reg['base_path_for_default_variation'];
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -38,103 +38,103 @@
 block discarded – undo
38 38
  * @since           4.0
39 39
  */
40 40
 if (function_exists('espresso_version')) {
41
-    if (! function_exists('espresso_duplicate_plugin_error')) {
42
-        /**
43
-         *    espresso_duplicate_plugin_error
44
-         *    displays if more than one version of EE is activated at the same time
45
-         */
46
-        function espresso_duplicate_plugin_error()
47
-        {
48
-            ?>
41
+	if (! function_exists('espresso_duplicate_plugin_error')) {
42
+		/**
43
+		 *    espresso_duplicate_plugin_error
44
+		 *    displays if more than one version of EE is activated at the same time
45
+		 */
46
+		function espresso_duplicate_plugin_error()
47
+		{
48
+			?>
49 49
             <div class="error">
50 50
                 <p>
51 51
                     <?php
52
-                    echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                    ); ?>
52
+					echo esc_html__(
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+					); ?>
56 56
                 </p>
57 57
             </div>
58 58
             <?php
59
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-        }
61
-    }
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
59
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+		}
61
+	}
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '5.6.2');
65
-    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '5.6.2');
65
+	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                        esc_html__(
79
-                            'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                            'event_espresso'
81
-                        ),
82
-                        EE_MIN_PHP_VER_REQUIRED,
83
-                        PHP_VERSION,
84
-                        '<br/>',
85
-                        '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+						esc_html__(
79
+							'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+							'event_espresso'
81
+						),
82
+						EE_MIN_PHP_VER_REQUIRED,
83
+						PHP_VERSION,
84
+						'<br/>',
85
+						'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
-        /**
98
-         * espresso_version
99
-         * Returns the plugin version
100
-         *
101
-         * @return string
102
-         */
103
-        function espresso_version()
104
-        {
105
-            return apply_filters('FHEE__espresso__espresso_version', '4.10.13.rc.004');
106
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
+		/**
98
+		 * espresso_version
99
+		 * Returns the plugin version
100
+		 *
101
+		 * @return string
102
+		 */
103
+		function espresso_version()
104
+		{
105
+			return apply_filters('FHEE__espresso__espresso_version', '4.10.13.rc.004');
106
+		}
107 107
 
108
-        /**
109
-         * espresso_plugin_activation
110
-         * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
-         */
112
-        function espresso_plugin_activation()
113
-        {
114
-            update_option('ee_espresso_activation', true);
115
-        }
108
+		/**
109
+		 * espresso_plugin_activation
110
+		 * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
+		 */
112
+		function espresso_plugin_activation()
113
+		{
114
+			update_option('ee_espresso_activation', true);
115
+		}
116 116
 
117
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
117
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
118 118
 
119
-        require_once __DIR__ . '/core/bootstrap_espresso.php';
120
-        bootstrap_espresso();
121
-    }
119
+		require_once __DIR__ . '/core/bootstrap_espresso.php';
120
+		bootstrap_espresso();
121
+	}
122 122
 }
123 123
 if (! function_exists('espresso_deactivate_plugin')) {
124
-    /**
125
-     *    deactivate_plugin
126
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
-     *
128
-     * @access public
129
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
-     * @return    void
131
-     */
132
-    function espresso_deactivate_plugin($plugin_basename = '')
133
-    {
134
-        if (! function_exists('deactivate_plugins')) {
135
-            require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
-        }
137
-        unset($_GET['activate'], $_REQUEST['activate']);
138
-        deactivate_plugins($plugin_basename);
139
-    }
124
+	/**
125
+	 *    deactivate_plugin
126
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
+	 *
128
+	 * @access public
129
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
+	 * @return    void
131
+	 */
132
+	function espresso_deactivate_plugin($plugin_basename = '')
133
+	{
134
+		if (! function_exists('deactivate_plugins')) {
135
+			require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
+		}
137
+		unset($_GET['activate'], $_REQUEST['activate']);
138
+		deactivate_plugins($plugin_basename);
139
+	}
140 140
 }
Please login to merge, or discard this patch.