Completed
Branch BUG-9583-fix-fetching-term-rel... (646110)
by
unknown
539:15 queued 523:53
created
core/libraries/plugin_api/EE_Register_Messages_Template_Variations.lib.php 3 patches
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -68,38 +68,38 @@  discard block
 block discarded – undo
68 68
 	 * @throws EE_Error
69 69
 	 * @return void
70 70
 	 */
71
-	public static function register( $variation_ref = NULL,  $setup_args = array() ) {
71
+	public static function register($variation_ref = NULL, $setup_args = array()) {
72 72
 
73 73
 		//check for required params
74
-		if ( empty( $variation_ref ) ) {
74
+		if (empty($variation_ref)) {
75 75
 			throw new EE_Error(
76 76
 				__('In order to register variations for a EE_Message_Template_Pack, you must include a value to reference the variations being registered', 'event_espresso')
77 77
 				);
78 78
 		}
79 79
 
80
-		if ( ! is_array( $setup_args ) || empty( $setup_args['variations'] ) || empty( $setup_args['base_path'] ) || empty( $setup_args['base_url'] ) ) {
80
+		if ( ! is_array($setup_args) || empty($setup_args['variations']) || empty($setup_args['base_path']) || empty($setup_args['base_url'])) {
81 81
 			throw new EE_Error(
82 82
 				__('In order to register variations for a EE_Message_Template_Pack, you must include an array containing the following keys: "variations", "base_path", "base_url", "extension"', 'event_espresso')
83 83
 				);
84 84
 		}
85 85
 
86 86
 		//make sure we don't register twice
87
-		if( isset( self::$_registry[ $variation_ref ] ) ){
87
+		if (isset(self::$_registry[$variation_ref])) {
88 88
 			return;
89 89
 		}
90 90
 
91 91
 		//make sure variation ref is unique.
92
-		if ( isset( self::$_registry[$variation_ref] ) ) {
93
-			$variation_ref = uniqid() . '_' . $variation_ref;
92
+		if (isset(self::$_registry[$variation_ref])) {
93
+			$variation_ref = uniqid().'_'.$variation_ref;
94 94
 		}
95 95
 
96 96
 
97 97
 		//make sure this was called in the right place!
98
-		 if ( ! did_action( 'EE_Brewing_Regular___messages_caf' ) || did_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' )) {
98
+		 if ( ! did_action('EE_Brewing_Regular___messages_caf') || did_action('AHEE__EE_System__perform_activations_upgrades_and_migrations')) {
99 99
 			EE_Error::doing_it_wrong(
100 100
 				__METHOD__,
101 101
 				sprintf(
102
-					__('Messages Templates Variations given the reference "%s" has been attempted to be registered with the EE Messages Template Pack System.  It may or may not work because it should be only called on the "EE_Brewing_Regular__messages_caf" hook.','event_espresso'),
102
+					__('Messages Templates Variations given the reference "%s" has been attempted to be registered with the EE Messages Template Pack System.  It may or may not work because it should be only called on the "EE_Brewing_Regular__messages_caf" hook.', 'event_espresso'),
103 103
 					$variation_ref
104 104
 				),
105 105
 				'4.5.0'
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 
116 116
 
117 117
 		//check that no reserved variation names are in use and also checks if there are already existing variation names for a given template pack.  The former will throw an error.  The latter will remove the conflicting variation name but still register the others and will add EE_Error notice.
118
-		$validated = self::_verify_variations( $variation_ref, $validated );
118
+		$validated = self::_verify_variations($variation_ref, $validated);
119 119
 		self::$_registry[$variation_ref] = $validated;
120 120
 
121
-		add_filter( 'FHEE__EE_Messages_Template_Pack__get_variations', array( 'EE_Register_Messages_Template_Variations', 'get_variations' ), 10, 4 );
122
-		add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( 'EE_Register_Messages_Template_Variations', 'get_variation' ), 10, 8 );
121
+		add_filter('FHEE__EE_Messages_Template_Pack__get_variations', array('EE_Register_Messages_Template_Variations', 'get_variations'), 10, 4);
122
+		add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array('EE_Register_Messages_Template_Variations', 'get_variation'), 10, 8);
123 123
 	}
124 124
 
125 125
 
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
 	 * @throws EE_Error
137 137
 	 * @return bool
138 138
 	 */
139
-	private static function _verify_variations( $variation_ref, $validated_variations ) {
140
-		foreach ( self::$_registry as $variation_ref => $settings ) {
141
-			foreach ( $settings['variations'] as $template_pack => $messenger ) {
142
-				foreach ( $messenger as $all_variations ) {
143
-					if ( isset( $all_variations['default'] ) ) {
139
+	private static function _verify_variations($variation_ref, $validated_variations) {
140
+		foreach (self::$_registry as $variation_ref => $settings) {
141
+			foreach ($settings['variations'] as $template_pack => $messenger) {
142
+				foreach ($messenger as $all_variations) {
143
+					if (isset($all_variations['default'])) {
144 144
 						throw new EE_Error(
145
-							sprintf( __('Variations registered through the EE_Register_Messages_Template_Variations api cannot override the default variation for the default template.  Please check the code registering variations with this reference, "%s" and modify.', 'event_espresso' ), $variation_ref )
145
+							sprintf(__('Variations registered through the EE_Register_Messages_Template_Variations api cannot override the default variation for the default template.  Please check the code registering variations with this reference, "%s" and modify.', 'event_espresso'), $variation_ref)
146 146
 							);
147 147
 					}
148 148
 				}
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
 		}
151 151
 
152 152
 		//is there already a variation registered with a given variation slug?
153
-		foreach ( $validated_variations['variations'] as $template_pack => $messenger  ) {
154
-			foreach ( $messenger as $message_type => $variations ) {
155
-				foreach( $variations as $slug => $label ) {
156
-					foreach ( self::$_registry as $registered_var => $reg_settings ) {
157
-						if ( isset( $reg_settings['variations'][$template_pack][$messenger][$message_type][$slug] ) ) {
158
-							unset( $validated_variations['variations'][$template_pack][$messenger][$message_type][$slug] );
159
-							EE_Error::add_error( sprintf( __('Unable to register the %s variation for the %s template pack with the %s messenger and %s message_type because a variation with this slug was already registered for this template pack and messenger and message type by an addon using this key %s.', 'event_espresso' ), $label, $template_pack, $messenger, $message_type, $registered_var  ) );
153
+		foreach ($validated_variations['variations'] as $template_pack => $messenger) {
154
+			foreach ($messenger as $message_type => $variations) {
155
+				foreach ($variations as $slug => $label) {
156
+					foreach (self::$_registry as $registered_var => $reg_settings) {
157
+						if (isset($reg_settings['variations'][$template_pack][$messenger][$message_type][$slug])) {
158
+							unset($validated_variations['variations'][$template_pack][$messenger][$message_type][$slug]);
159
+							EE_Error::add_error(sprintf(__('Unable to register the %s variation for the %s template pack with the %s messenger and %s message_type because a variation with this slug was already registered for this template pack and messenger and message type by an addon using this key %s.', 'event_espresso'), $label, $template_pack, $messenger, $message_type, $registered_var));
160 160
 						}
161 161
 					}
162 162
 				}
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
 	 *
186 186
 	 * @return string                    The path to the requested variation.
187 187
 	 */
188
-	public static function get_variation( $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack ) {
188
+	public static function get_variation($variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack) {
189 189
 
190 190
 		//so let's loop through our registered variations and then pull any details matching the request.
191
-		foreach ( self::$_registry as $registry_slug => $registry_settings ) {
191
+		foreach (self::$_registry as $registry_slug => $registry_settings) {
192 192
 			$base = $url ? $registry_settings['base_url'] : $registry_settings['base_path'];
193
-			$file_string = $messenger . '_' . $type. '_' . $variation . $file_extension;
193
+			$file_string = $messenger.'_'.$type.'_'.$variation.$file_extension;
194 194
 			//see if this file exists
195
-			if ( is_readable( $registry_settings['base_path'] . $file_string ) ) {
196
-				return $base . $file_string;
195
+			if (is_readable($registry_settings['base_path'].$file_string)) {
196
+				return $base.$file_string;
197 197
 			}
198 198
 		}
199 199
 
@@ -217,21 +217,21 @@  discard block
 block discarded – undo
217 217
 	 *
218 218
 	 * @return array                   new variations array (or existing one if nothing registered)
219 219
 	 */
220
-	public static function get_variations( $variations, $messenger,  $message_type, EE_Messages_Template_Pack $template_pack ) {
220
+	public static function get_variations($variations, $messenger, $message_type, EE_Messages_Template_Pack $template_pack) {
221 221
 		//first let's check if we even have registered variations and get out early.
222
-		if ( empty( self::$_registry ) ) {
222
+		if (empty(self::$_registry)) {
223 223
 			return $variations;
224 224
 		}
225 225
 
226 226
 		//do we have any new variations for the given messenger, $message_type, and template packs
227
-		foreach ( self::$_registry as $registry_slug => $registry_settings ) {
227
+		foreach (self::$_registry as $registry_slug => $registry_settings) {
228 228
 			//allow for different conditions.
229
-			if ( empty( $messenger) ) {
230
-				$variations =  array_merge( $registry_settings['variations'], $variations );
231
-			} else if ( ! empty( $messenger ) && empty( $message_type ) && ! empty( $registry_settings['variations'][$template_pack->dbref][$messenger] ) ) {
232
-				$variations =  array_merge( $registry_settings['variations'][$template_pack->dbref][$messenger], $variations );
233
-			} else if ( ! empty( $messenger ) && ! empty( $message_type ) && ! empty( $registry_settings['variations'][$template_pack->dbref][$messenger][$message_type] ) ) {
234
-				$variations = array_merge( $registry_settings['variations'][$template_pack->dbref][$messenger][$message_type], $variations );
229
+			if (empty($messenger)) {
230
+				$variations = array_merge($registry_settings['variations'], $variations);
231
+			} else if ( ! empty($messenger) && empty($message_type) && ! empty($registry_settings['variations'][$template_pack->dbref][$messenger])) {
232
+				$variations = array_merge($registry_settings['variations'][$template_pack->dbref][$messenger], $variations);
233
+			} else if ( ! empty($messenger) && ! empty($message_type) && ! empty($registry_settings['variations'][$template_pack->dbref][$messenger][$message_type])) {
234
+				$variations = array_merge($registry_settings['variations'][$template_pack->dbref][$messenger][$message_type], $variations);
235 235
 			}
236 236
 		}
237 237
 		return $variations;
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 	 *
251 251
 	 * @return void
252 252
 	 */
253
-	public static function deregister( $variation_ref = NULL ) {
254
-		if ( !empty( self::$_registry[$variation_ref] ) ) {
255
-    			unset( self::$_registry[$variation_ref] );
253
+	public static function deregister($variation_ref = NULL) {
254
+		if ( ! empty(self::$_registry[$variation_ref])) {
255
+    			unset(self::$_registry[$variation_ref]);
256 256
     		}
257 257
 	}
258 258
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
  * @subpackage plugin api, messages
6 6
  * @since           4.5.0
7 7
  */
8
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10
+}
9 11
 
10 12
 /**
11 13
  * Use this to register or deregister a new message template pack variation for the EE messages system.
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@
 block discarded – undo
185 185
 	 */
186 186
 	public static function deregister( $variation_ref = NULL ) {
187 187
 		if ( !empty( self::$_registry[$variation_ref] ) ) {
188
-    			unset( self::$_registry[$variation_ref] );
189
-    		}
188
+				unset( self::$_registry[$variation_ref] );
189
+			}
190 190
 	}
191 191
 }
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Model.lib.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		}
56 56
 
57 57
 		if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'FHEE__EE_System__parse_model_names' ) || did_action( 'FHEE__EE_System__parse_implemented_model_names' )) {
58
-            EE_Error::doing_it_wrong(
58
+			EE_Error::doing_it_wrong(
59 59
 				__METHOD__,
60 60
 				sprintf(
61 61
 					__('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.','event_espresso'),
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 				),
64 64
 				'4.5'
65 65
 			);
66
-        }
66
+		}
67 67
 		self::$_model_registry[$model_id] = $config;
68 68
 
69 69
 		EE_Registry::instance()->load_helper('File');
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -43,22 +43,22 @@  discard block
 block discarded – undo
43 43
 	 * }
44 44
 	 * @throws EE_Error
45 45
 	 */
46
-	public static function register( $model_id = NULL, $config = array() ){
46
+	public static function register($model_id = NULL, $config = array()) {
47 47
 		//required fields MUST be present, so let's make sure they are.
48
-		if ( empty( $model_id ) || ! is_array( $config ) || empty( $config['model_paths'] )) {
49
-			throw new EE_Error( __( '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)', 'event_espresso' ));
48
+		if (empty($model_id) || ! is_array($config) || empty($config['model_paths'])) {
49
+			throw new EE_Error(__('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)', 'event_espresso'));
50 50
 		}
51 51
 
52 52
 		//make sure we don't register twice
53
-		if( isset( self::$_model_registry[ $model_id ] ) ){
53
+		if (isset(self::$_model_registry[$model_id])) {
54 54
 			return;
55 55
 		}
56 56
 
57
-		if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'FHEE__EE_System__parse_model_names' ) || did_action( 'FHEE__EE_System__parse_implemented_model_names' )) {
57
+		if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('FHEE__EE_System__parse_model_names') || did_action('FHEE__EE_System__parse_implemented_model_names')) {
58 58
             EE_Error::doing_it_wrong(
59 59
 				__METHOD__,
60 60
 				sprintf(
61
-					__('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.','event_espresso'),
61
+					__('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.', 'event_espresso'),
62 62
 					$model_id
63 63
 				),
64 64
 				'4.5'
@@ -67,42 +67,42 @@  discard block
 block discarded – undo
67 67
 		self::$_model_registry[$model_id] = $config;
68 68
 
69 69
 		EE_Registry::instance()->load_helper('File');
70
-		if( ( isset( $config['model_paths'] ) && ! isset( $config['class_paths'] ) ) ||
71
-				( ! isset( $config['model_paths'] ) && isset( $config['class_paths'] ) ) ){
72
-			throw new EE_Error( sprintf( __( 'You must register both "model_paths" AND "class_paths", not just one or the other You provided %s', 'event_espresso' ), implode(", ", array_keys( $config ) ) ) );
70
+		if ((isset($config['model_paths']) && ! isset($config['class_paths'])) ||
71
+				( ! isset($config['model_paths']) && isset($config['class_paths']))) {
72
+			throw new EE_Error(sprintf(__('You must register both "model_paths" AND "class_paths", not just one or the other You provided %s', 'event_espresso'), implode(", ", array_keys($config))));
73 73
 		}
74
-		if(isset($config['model_paths'])){
74
+		if (isset($config['model_paths'])) {
75 75
 			//make sure they passed in an array
76
-			if( ! is_array( $config['model_paths'] ) ){
77
-				$config['model_paths'] = array( $config['model_paths'] );
76
+			if ( ! is_array($config['model_paths'])) {
77
+				$config['model_paths'] = array($config['model_paths']);
78 78
 			}
79 79
 			//we want to add this as a model folder
80 80
 			//and autoload them all
81 81
 			$class_to_filepath_map = EEH_File::get_contents_of_folders($config['model_paths']);
82 82
 			EEH_Autoloader::register_autoloader($class_to_filepath_map);
83 83
 			$model_name_to_classname_map = array();
84
-			foreach(array_keys($class_to_filepath_map) as $classname){
85
-				$model_name_to_classname_map[str_replace("EEM_","",$classname)] = $classname;
84
+			foreach (array_keys($class_to_filepath_map) as $classname) {
85
+				$model_name_to_classname_map[str_replace("EEM_", "", $classname)] = $classname;
86 86
 			}
87 87
 			self::$_model_name_to_classname_map[$model_id] = $model_name_to_classname_map;
88
-			add_filter('FHEE__EE_System__parse_model_names', array('EE_Register_Model','add_addon_models'));
89
-			add_filter('FHEE__EE_System__parse_implemented_model_names', array('EE_Register_Model','add_addon_models'));
90
-			add_filter('FHEE__EE_Registry__load_model__paths',array('EE_Register_Model','add_model_folders'));
88
+			add_filter('FHEE__EE_System__parse_model_names', array('EE_Register_Model', 'add_addon_models'));
89
+			add_filter('FHEE__EE_System__parse_implemented_model_names', array('EE_Register_Model', 'add_addon_models'));
90
+			add_filter('FHEE__EE_Registry__load_model__paths', array('EE_Register_Model', 'add_model_folders'));
91 91
 			unset($config['model_paths']);
92 92
 		}
93
-		if(isset($config['class_paths'])){
93
+		if (isset($config['class_paths'])) {
94 94
 			//make sure they passed in an array
95
-			if( ! is_array( $config['class_paths'] ) ){
96
-				$config['class_paths'] = array( $config['class_paths'] );
95
+			if ( ! is_array($config['class_paths'])) {
96
+				$config['class_paths'] = array($config['class_paths']);
97 97
 			}
98 98
 			$class_to_filepath_map = EEH_File::get_contents_of_folders($config['class_paths']);
99 99
 			EEH_Autoloader::register_autoloader($class_to_filepath_map);
100
-			add_filter('FHEE__EE_Registry__load_class__paths',array('EE_Register_Model','add_class_folders'));
100
+			add_filter('FHEE__EE_Registry__load_class__paths', array('EE_Register_Model', 'add_class_folders'));
101 101
 			unset($config['class_paths']);
102 102
 		}
103
-		foreach($config as $unknown_key => $unknown_config){
104
-			self::deregister( $model_id );
105
-			throw new EE_Error(sprintf(__("The key '%s' is not a known key for registering a model", "event_espresso"),$unknown_key));
103
+		foreach ($config as $unknown_key => $unknown_config) {
104
+			self::deregister($model_id);
105
+			throw new EE_Error(sprintf(__("The key '%s' is not a known key for registering a model", "event_espresso"), $unknown_key));
106 106
 		}
107 107
 	}
108 108
 
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 	 * @param array $core_models
112 112
 	 * @return array keys are model names (eg 'Event') and values are their classes (eg 'EE_Event')
113 113
 	 */
114
-	public static function add_addon_models( $core_models = array() ){
115
-		foreach(self::$_model_name_to_classname_map as $model_name_to_class_map){
116
-			$core_models = array_merge($core_models,$model_name_to_class_map);
114
+	public static function add_addon_models($core_models = array()) {
115
+		foreach (self::$_model_name_to_classname_map as $model_name_to_class_map) {
116
+			$core_models = array_merge($core_models, $model_name_to_class_map);
117 117
 		}
118 118
 		return $core_models;
119 119
 	}
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
 	 * @param array $folders
123 123
 	 * @return array of folder paths
124 124
 	 */
125
-	public static function add_model_folders( $folders = array() ){
126
-		foreach(self::$_model_registry as $config){
127
-			if(isset($config['model_paths'])){
128
-				$folders = array_merge($folders,$config['model_paths']);
125
+	public static function add_model_folders($folders = array()) {
126
+		foreach (self::$_model_registry as $config) {
127
+			if (isset($config['model_paths'])) {
128
+				$folders = array_merge($folders, $config['model_paths']);
129 129
 			}
130 130
 		}
131 131
 		return $folders;
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
 	 * @param array $folders
136 136
 	 * @return array of folder paths
137 137
 	 */
138
-	public static function add_class_folders( $folders = array() ){
139
-		foreach(self::$_model_registry as $config){
140
-			if(isset($config['class_paths'])){
141
-				$folders = array_merge( $folders, $config['class_paths'] );
138
+	public static function add_class_folders($folders = array()) {
139
+		foreach (self::$_model_registry as $config) {
140
+			if (isset($config['class_paths'])) {
141
+				$folders = array_merge($folders, $config['class_paths']);
142 142
 			}
143 143
 		}
144 144
 		return $folders;
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
 	 * deregister
151 151
 	 * @param string $model_id
152 152
 	 */
153
-	public static function deregister( $model_id = NULL ){
154
-		if( isset( self::$_model_registry[ $model_id ] ) ){
155
-			unset( self::$_model_registry[ $model_id ] );
156
-			unset( self::$_model_name_to_classname_map[ $model_id ] );
153
+	public static function deregister($model_id = NULL) {
154
+		if (isset(self::$_model_registry[$model_id])) {
155
+			unset(self::$_model_registry[$model_id]);
156
+			unset(self::$_model_name_to_classname_map[$model_id]);
157 157
 		}
158 158
 	}
159 159
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 /**
6 7
  * Event Espresso
7 8
  *
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Model_Extensions.lib.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage plugin api
8 8
  */
9
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit('NO direct script access allowed'); }
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('NO direct script access allowed'); }
10 10
 
11 11
 /**
12 12
  * EE_Register_Model_Extensions
@@ -34,26 +34,26 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 * @return void
36 36
 	 */
37
-	public static function register( $model_id = NULL, $config = array() ) {
37
+	public static function register($model_id = NULL, $config = array()) {
38 38
 		//required fields MUST be present, so let's make sure they are.
39
-		if ( empty( $model_id ) || ! is_array( $config ) || ( empty( $config['model_extension_paths'] ) && empty( $config['class_extension_paths'] ) ) ) {
40
-			throw new EE_Error( __( 'In order to register Model extensions with EE_Register_Model_Extensions::register(), you must include a "model_id" (a unique identifier for this set of models), and an array containing the following keys: "model_extension_paths" (an array of full server paths to folders that contain model extensions), and "class_extension_paths" (an array of full server paths to folders that contain class extensions)', 'event_espresso' ));
39
+		if (empty($model_id) || ! is_array($config) || (empty($config['model_extension_paths']) && empty($config['class_extension_paths']))) {
40
+			throw new EE_Error(__('In order to register Model extensions with EE_Register_Model_Extensions::register(), you must include a "model_id" (a unique identifier for this set of models), and an array containing the following keys: "model_extension_paths" (an array of full server paths to folders that contain model extensions), and "class_extension_paths" (an array of full server paths to folders that contain class extensions)', 'event_espresso'));
41 41
 		}
42 42
 
43 43
 		//make sure we don't register twice
44
-		if( isset( self::$_registry[ $model_id ] ) ){
44
+		if (isset(self::$_registry[$model_id])) {
45 45
 			return;
46 46
 		}
47 47
 		//check correct loading
48
-		if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_Admin__loaded'  )) {
48
+		if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_Admin__loaded')) {
49 49
 			EE_Error::doing_it_wrong(
50 50
 				__METHOD__,
51 51
 				sprintf(
52
-					__('An attempt was made to register "%1$s" as a Model extension has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register models.%2$s Hook Status: %2$s "AHEE__EE_System__load_espresso_addons" : %3$s %2$s "AHEE__EE_Admin__loaded" : %4$s%2$s','event_espresso'),
52
+					__('An attempt was made to register "%1$s" as a Model extension has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register models.%2$s Hook Status: %2$s "AHEE__EE_System__load_espresso_addons" : %3$s %2$s "AHEE__EE_Admin__loaded" : %4$s%2$s', 'event_espresso'),
53 53
 					$model_id,
54 54
 					'<br />',
55
-					did_action( 'AHEE__EE_System__load_espresso_addons' ) ? 'action done' : 'action NOT done',
56
-					did_action( 'AHEE__EE_Admin__loaded' ) ? 'action done' : 'action NOT done'
55
+					did_action('AHEE__EE_System__load_espresso_addons') ? 'action done' : 'action NOT done',
56
+					did_action('AHEE__EE_Admin__loaded') ? 'action done' : 'action NOT done'
57 57
 				),
58 58
 				'4.3'
59 59
 			);
@@ -63,26 +63,26 @@  discard block
 block discarded – undo
63 63
 		self::$_extensions[$model_id] = array();
64 64
 		EE_Registry::instance()->load_helper('File');
65 65
 
66
-		if(isset($config['model_extension_paths'])){
66
+		if (isset($config['model_extension_paths'])) {
67 67
 			require_once(EE_LIBRARIES.'plugin_api/db/EEME_Base.lib.php');
68 68
 			$class_to_filepath_map = EEH_File::get_contents_of_folders($config['model_extension_paths']);
69 69
 			EEH_Autoloader::register_autoloader($class_to_filepath_map);
70
-			foreach(array_keys($class_to_filepath_map) as $classname){
70
+			foreach (array_keys($class_to_filepath_map) as $classname) {
71 71
 				self::$_extensions[$model_id]['models'][$classname] = new $classname;
72 72
 			}
73 73
 			unset($config['model_extension_paths']);
74 74
 		}
75
-		if(isset($config['class_extension_paths'])){
75
+		if (isset($config['class_extension_paths'])) {
76 76
 			require_once(EE_LIBRARIES.'plugin_api/db/EEE_Base_Class.lib.php');
77 77
 			$class_to_filepath_map = EEH_File::get_contents_of_folders($config['class_extension_paths']);
78 78
 			EEH_Autoloader::register_autoloader($class_to_filepath_map);
79
-			foreach(array_keys($class_to_filepath_map) as $classname){
79
+			foreach (array_keys($class_to_filepath_map) as $classname) {
80 80
 				self::$_extensions[$model_id]['classes'][$classname] = new $classname;
81 81
 			}
82 82
 			unset($config['class_extension_paths']);
83 83
 		}
84
-		foreach($config as $unknown_key => $unknown_config){
85
-			throw new EE_Error(sprintf(__("The key '%s' is not a known key for registering a model", "event_espresso"),$unknown_key));
84
+		foreach ($config as $unknown_key => $unknown_config) {
85
+			throw new EE_Error(sprintf(__("The key '%s' is not a known key for registering a model", "event_espresso"), $unknown_key));
86 86
 		}
87 87
 	}
88 88
 
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 	 * deregister
92 92
 	 * @param string $model_id
93 93
 	 */
94
-	public static function deregister( $model_id = NULL ){
95
-		if(isset(self::$_registry[$model_id])){
94
+	public static function deregister($model_id = NULL) {
95
+		if (isset(self::$_registry[$model_id])) {
96 96
 			unset(self::$_registry[$model_id]);
97
-			foreach(self::$_extensions[$model_id] as $extension_of_type){
98
-				foreach($extension_of_type as $extension ){
97
+			foreach (self::$_extensions[$model_id] as $extension_of_type) {
98
+				foreach ($extension_of_type as $extension) {
99 99
 					$extension->deregister();
100 100
 				}
101 101
 			}
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Module.lib.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -44,33 +44,33 @@  discard block
 block discarded – undo
44 44
 	 * @type array module_paths 	an array of full server paths to folders containing any EED_Modules, or to the EED_Module files themselves
45 45
 	 * @return void
46 46
 	 */
47
-	public static function register( $module_id = NULL, $setup_args = array()  ) {
47
+	public static function register($module_id = NULL, $setup_args = array()) {
48 48
 
49 49
 		//required fields MUST be present, so let's make sure they are.
50
-		if ( empty( $module_id ) || ! is_array( $setup_args ) || empty( $setup_args['module_paths'] )) {
51
-			throw new EE_Error( __( '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)', 'event_espresso' ));
50
+		if (empty($module_id) || ! is_array($setup_args) || empty($setup_args['module_paths'])) {
51
+			throw new EE_Error(__('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)', 'event_espresso'));
52 52
 		}
53 53
 
54 54
 		//make sure we don't register twice
55
-		if( isset( self::$_settings[ $module_id ] ) ){
55
+		if (isset(self::$_settings[$module_id])) {
56 56
 			return;
57 57
 		}
58 58
 
59 59
 		//make sure this was called in the right place!
60
-		if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' )) {
60
+		if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')) {
61 61
 			EE_Error::doing_it_wrong(
62 62
 				__METHOD__,
63
-				__( '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.','event_espresso'),
63
+				__('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.', 'event_espresso'),
64 64
 				'4.3.0'
65 65
 			);
66 66
 		}
67 67
 		//setup $_settings array from incoming values.
68
-		self::$_settings[ $module_id ] = array(
68
+		self::$_settings[$module_id] = array(
69 69
 			// array of full server paths to any EED_Modules used by the module
70
-			'module_paths'  => isset( $setup_args['module_paths'] ) ? (array)$setup_args['module_paths'] : array(),
70
+			'module_paths'  => isset($setup_args['module_paths']) ? (array) $setup_args['module_paths'] : array(),
71 71
 		);
72 72
 		// add to list of modules to be registered
73
-		add_filter( 'FHEE__EE_Config__register_modules__modules_to_register', array( 'EE_Register_Module', 'add_modules' ));
73
+		add_filter('FHEE__EE_Config__register_modules__modules_to_register', array('EE_Register_Module', 'add_modules'));
74 74
 	}
75 75
 
76 76
 
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 	 * @param array $modules_to_register  array of paths to all modules that require registering
84 84
 	 * @return array
85 85
 	 */
86
-	public static function add_modules( $modules_to_register ){
87
-		foreach( self::$_settings as $settings ) {
88
-			$modules_to_register = array_merge( $modules_to_register, $settings['module_paths'] );
86
+	public static function add_modules($modules_to_register) {
87
+		foreach (self::$_settings as $settings) {
88
+			$modules_to_register = array_merge($modules_to_register, $settings['module_paths']);
89 89
 		}
90 90
 		return $modules_to_register;
91 91
 	}
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 * @param string  $module_id the name for the module that was previously registered
102 102
 	 * @return void
103 103
 	 */
104
-	public static function deregister( $module_id = NULL ) {
105
-		if ( isset( self::$_settings[ $module_id ] )) {
106
-			unset( self::$_settings[ $module_id ] );
104
+	public static function deregister($module_id = NULL) {
105
+		if (isset(self::$_settings[$module_id])) {
106
+			unset(self::$_settings[$module_id]);
107 107
 		}
108 108
 	}
109 109
 
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Payment_Method.lib.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -48,33 +48,33 @@  discard block
 block discarded – undo
48 48
 	 * @type array payment_method_paths 	an array of full server paths to folders containing any EE_PMT_Base children, or to the EED_Module files themselves
49 49
 	 * @return void
50 50
 	 */
51
-	public static function register( $payment_method_id = NULL, $setup_args = array()  ) {
51
+	public static function register($payment_method_id = NULL, $setup_args = array()) {
52 52
 
53 53
 		//required fields MUST be present, so let's make sure they are.
54
-		if ( empty( $payment_method_id ) || ! is_array( $setup_args ) || empty( $setup_args['payment_method_paths'] )) {
55
-			throw new EE_Error( __( 'In order to register Payment Methods with EE_Register_Payment_Method::register(), you must include a "payment_method_id" (a unique identifier for this set of modules), and an array containing the following keys: "payment_method_paths" (an array of full server paths to folders that contain modules, or to the module files themselves)', 'event_espresso' ));
54
+		if (empty($payment_method_id) || ! is_array($setup_args) || empty($setup_args['payment_method_paths'])) {
55
+			throw new EE_Error(__('In order to register Payment Methods with EE_Register_Payment_Method::register(), you must include a "payment_method_id" (a unique identifier for this set of modules), and an array containing the following keys: "payment_method_paths" (an array of full server paths to folders that contain modules, or to the module files themselves)', 'event_espresso'));
56 56
 		}
57 57
 
58 58
 		//make sure we don't register twice
59
-		if( isset( self::$_settings[ $payment_method_id ] ) ){
59
+		if (isset(self::$_settings[$payment_method_id])) {
60 60
 			return;
61 61
 		}
62 62
 
63 63
 		//make sure this was called in the right place!
64
-		if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' )) {
64
+		if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')) {
65 65
 			EE_Error::doing_it_wrong(
66 66
 				__METHOD__,
67
-				__( '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.','event_espresso'),
67
+				__('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.', 'event_espresso'),
68 68
 				'4.3.0'
69 69
 			);
70 70
 		}
71 71
 		//setup $_settings array from incoming values.
72
-		self::$_settings[ $payment_method_id ] = array(
72
+		self::$_settings[$payment_method_id] = array(
73 73
 			// array of full server paths to any EE_PMT_Base children used
74
-			'payment_method_paths'  => isset( $setup_args['payment_method_paths'] ) ? (array)$setup_args['payment_method_paths'] : array(),
74
+			'payment_method_paths'  => isset($setup_args['payment_method_paths']) ? (array) $setup_args['payment_method_paths'] : array(),
75 75
 		);
76 76
 		// add to list of modules to be registered
77
-		add_filter( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array( 'EE_Register_Payment_Method', 'add_payment_methods' ));
77
+		add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array('EE_Register_Payment_Method', 'add_payment_methods'));
78 78
 
79 79
 		/**
80 80
 		 * If EE_Payment_Method_Manager::register_payment_methods has already been called, we need it to be called again
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 		 * will be called only once per payment method from an addon, so going with that assumption we should always do this.
83 83
 		 * If that assumption is false, we should verify this newly-registered paymetn method isn't on the EE_Payment_Method_Manager::_payment_method_types array before calling this (this code should be changed to improve performance)
84 84
 		 */
85
-		if ( did_action( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods' ) ) {
85
+		if (did_action('FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods')) {
86 86
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
87
-			EE_Payment_Method_Manager::instance()->maybe_register_payment_methods( TRUE );
87
+			EE_Payment_Method_Manager::instance()->maybe_register_payment_methods(TRUE);
88 88
 		}
89 89
 	}
90 90
 
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 	 * @param array $payment_method_folders  array of paths to all payment methods that require registering
98 98
 	 * @return array
99 99
 	 */
100
-	public static function add_payment_methods( $payment_method_folders ){
101
-		foreach( self::$_settings as $settings ) {
102
-			$payment_method_folders = array_merge( $payment_method_folders, $settings['payment_method_paths'] );
100
+	public static function add_payment_methods($payment_method_folders) {
101
+		foreach (self::$_settings as $settings) {
102
+			$payment_method_folders = array_merge($payment_method_folders, $settings['payment_method_paths']);
103 103
 		}
104 104
 		return $payment_method_folders;
105 105
 	}
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 	 * @param string  $module_id the name for the module that was previously registered
115 115
 	 * @return void
116 116
 	 */
117
-	public static function deregister( $module_id = NULL ) {
118
-		if ( isset( self::$_settings[ $module_id ] )) {
119
-			unset( self::$_settings[ $module_id ] );
117
+	public static function deregister($module_id = NULL) {
118
+		if (isset(self::$_settings[$module_id])) {
119
+			unset(self::$_settings[$module_id]);
120 120
 		}
121 121
 	}
122 122
 
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Shortcode.lib.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -44,33 +44,33 @@  discard block
 block discarded – undo
44 44
 	 * @throws EE_Error
45 45
 	 * @return void
46 46
 	 */
47
-	public static function register( $shortcode_id = NULL, $setup_args = array()  ) {
47
+	public static function register($shortcode_id = NULL, $setup_args = array()) {
48 48
 
49 49
 		//required fields MUST be present, so let's make sure they are.
50
-		if ( empty( $shortcode_id ) || ! is_array( $setup_args ) || empty( $setup_args['shortcode_paths'] )) {
51
-			throw new EE_Error( __( '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)', 'event_espresso' ));
50
+		if (empty($shortcode_id) || ! is_array($setup_args) || empty($setup_args['shortcode_paths'])) {
51
+			throw new EE_Error(__('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)', 'event_espresso'));
52 52
 		}
53 53
 
54 54
 		//make sure we don't register twice
55
-		if( isset( self::$_settings[ $shortcode_id ] ) ){
55
+		if (isset(self::$_settings[$shortcode_id])) {
56 56
 			return;
57 57
 		}
58 58
 
59 59
 		//make sure this was called in the right place!
60
-		if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' )) {
60
+		if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')) {
61 61
 			EE_Error::doing_it_wrong(
62 62
 				__METHOD__,
63
-				__( '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.','event_espresso'),
63
+				__('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.', 'event_espresso'),
64 64
 				'4.3.0'
65 65
 			);
66 66
 		}
67 67
 		//setup $_settings array from incoming values.
68
-		self::$_settings[ $shortcode_id ] = array(
68
+		self::$_settings[$shortcode_id] = array(
69 69
 			// array of full server paths to any EES_Shortcodes used by the shortcode
70
-			'shortcode_paths'  => isset( $setup_args['shortcode_paths'] ) ? (array)$setup_args['shortcode_paths'] : array(),
70
+			'shortcode_paths'  => isset($setup_args['shortcode_paths']) ? (array) $setup_args['shortcode_paths'] : array(),
71 71
 		);
72 72
 		// add to list of shortcodes to be registered
73
-		add_filter( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', array( 'EE_Register_Shortcode', 'add_shortcodes' ));
73
+		add_filter('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', array('EE_Register_Shortcode', 'add_shortcodes'));
74 74
 	}
75 75
 
76 76
 
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 	 * @param array $shortcodes_to_register  array of paths to all shortcodes that require registering
83 83
 	 * @return array
84 84
 	 */
85
-	public static function add_shortcodes( $shortcodes_to_register ){
86
-		foreach( self::$_settings as $settings ) {
87
-			$shortcodes_to_register = array_merge( $shortcodes_to_register, $settings['shortcode_paths'] );
85
+	public static function add_shortcodes($shortcodes_to_register) {
86
+		foreach (self::$_settings as $settings) {
87
+			$shortcodes_to_register = array_merge($shortcodes_to_register, $settings['shortcode_paths']);
88 88
 		}
89 89
 		return $shortcodes_to_register;
90 90
 	}
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 	 * @param string  $shortcode_id the name for the shortcode that was previously registered
101 101
 	 * @return void
102 102
 	 */
103
-	public static function deregister( $shortcode_id = NULL ) {
104
-		if ( isset( self::$_settings[ $shortcode_id ] )) {
105
-			unset( self::$_settings[ $shortcode_id ] );
103
+	public static function deregister($shortcode_id = NULL) {
104
+		if (isset(self::$_settings[$shortcode_id])) {
105
+			unset(self::$_settings[$shortcode_id]);
106 106
 		}
107 107
 	}
108 108
 
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Widget.lib.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -44,34 +44,34 @@  discard block
 block discarded – undo
44 44
 	 * @throws EE_Error
45 45
 	 * @return void
46 46
 	 */
47
-	public static function register( $widget_id = NULL, $setup_args = array()  ) {
47
+	public static function register($widget_id = NULL, $setup_args = array()) {
48 48
 
49 49
 		//required fields MUST be present, so let's make sure they are.
50
-		if ( empty( $widget_id ) || ! is_array( $setup_args ) || empty( $setup_args['widget_paths'] )) {
51
-			throw new EE_Error( __( 'In order to register Widgets with EE_Register_Widget::register(), you must include a "widget_id" (a unique identifier for this set of widgets), and an array containing the following keys: "widget_paths" (an array of full server paths to folders that contain widgets, or to the widget files themselves)', 'event_espresso' ));
50
+		if (empty($widget_id) || ! is_array($setup_args) || empty($setup_args['widget_paths'])) {
51
+			throw new EE_Error(__('In order to register Widgets with EE_Register_Widget::register(), you must include a "widget_id" (a unique identifier for this set of widgets), and an array containing the following keys: "widget_paths" (an array of full server paths to folders that contain widgets, or to the widget files themselves)', 'event_espresso'));
52 52
 		}
53 53
 
54 54
 		//make sure we don't register twice
55
-		if( isset( self::$_settings[ $widget_id ] ) ){
55
+		if (isset(self::$_settings[$widget_id])) {
56 56
 			return;
57 57
 		}
58 58
 
59 59
 
60 60
 		//make sure this was called in the right place!
61
-		if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' )) {
61
+		if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')) {
62 62
 			EE_Error::doing_it_wrong(
63 63
 				__METHOD__,
64
-				__( 'An attempt to register widgets 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 widgets.','event_espresso'),
64
+				__('An attempt to register widgets 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 widgets.', 'event_espresso'),
65 65
 				'4.3.0'
66 66
 			);
67 67
 		}
68 68
 		//setup $_settings array from incoming values.
69
-		self::$_settings[ $widget_id ] = array(
69
+		self::$_settings[$widget_id] = array(
70 70
 			// array of full server paths to any EED_Widgets used by the widget
71
-			'widget_paths'  => isset( $setup_args['widget_paths'] ) ? (array)$setup_args['widget_paths'] : array(),
71
+			'widget_paths'  => isset($setup_args['widget_paths']) ? (array) $setup_args['widget_paths'] : array(),
72 72
 		);
73 73
 		// add to list of widgets to be registered
74
-		add_filter( 'FHEE__EE_Config__register_widgets__widgets_to_register', array( 'EE_Register_Widget', 'add_widgets' ));
74
+		add_filter('FHEE__EE_Config__register_widgets__widgets_to_register', array('EE_Register_Widget', 'add_widgets'));
75 75
 	}
76 76
 
77 77
 
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 	 * @param array $widgets_to_register  array of paths to all widgets that require registering
84 84
 	 * @return array
85 85
 	 */
86
-	public static function add_widgets( $widgets_to_register = array() ) {
87
-		foreach( self::$_settings as $settings ) {
88
-			$widgets_to_register = array_merge( $widgets_to_register, $settings['widget_paths'] );
86
+	public static function add_widgets($widgets_to_register = array()) {
87
+		foreach (self::$_settings as $settings) {
88
+			$widgets_to_register = array_merge($widgets_to_register, $settings['widget_paths']);
89 89
 		}
90 90
 		return $widgets_to_register;
91 91
 	}
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 * @param string  $widget_id the name for the widget that was previously registered
102 102
 	 * @return void
103 103
 	 */
104
-	public static function deregister( $widget_id = NULL ) {
105
-		if ( isset( self::$_settings[ $widget_id ] )) {
106
-			unset( self::$_settings[ $widget_id ] );
104
+	public static function deregister($widget_id = NULL) {
105
+		if (isset(self::$_settings[$widget_id])) {
106
+			unset(self::$_settings[$widget_id]);
107 107
 		}
108 108
 	}
109 109
 
Please login to merge, or discard this patch.
core/libraries/plugin_api/db/EEE_Base_Class.lib.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	protected $_ = NULL;
49 49
 
50
-	public function __construct(){
51
-		if( ! $this->_model_name_extended){
50
+	public function __construct() {
51
+		if ( ! $this->_model_name_extended) {
52 52
 			throw new EE_Error(sprintf(__("When declaring a class extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", "event_espresso")));
53 53
 		}
54
-		if(did_action('AHEE__EE_'.$this->_model_name_extended.'__construct__end')){
55
-			throw new EE_Error(sprintf(__("Hooked in model object extension '%s' too late! The model object %s has already been used!", "event_espresso"),get_class($this),$this->_model_name_extended));
54
+		if (did_action('AHEE__EE_'.$this->_model_name_extended.'__construct__end')) {
55
+			throw new EE_Error(sprintf(__("Hooked in model object extension '%s' too late! The model object %s has already been used!", "event_espresso"), get_class($this), $this->_model_name_extended));
56 56
 		}
57 57
 		$this->_register_extending_methods();
58 58
 	}
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 	 * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the
62 62
 	 * model extended. (Internally uses filters, and the __call magic method)
63 63
 	 */
64
-	protected function _register_extending_methods(){
64
+	protected function _register_extending_methods() {
65 65
 		$all_methods = get_class_methods(get_class($this));
66
-		foreach($all_methods as $method_name){
67
-			if(strpos($method_name, self::extending_method_prefix) === 0){
66
+		foreach ($all_methods as $method_name) {
67
+			if (strpos($method_name, self::extending_method_prefix) === 0) {
68 68
 				$method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name);
69 69
 				$callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model";
70
-				add_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10,10);
70
+				add_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10, 10);
71 71
 			}
72 72
 		}
73 73
 	}
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
 	 * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the
76 76
 	 * model extended. (Internally uses filters, and the __call magic method)
77 77
 	 */
78
-	public function deregister(){
78
+	public function deregister() {
79 79
 		$all_methods = get_class_methods(get_class($this));
80
-		foreach($all_methods as $method_name){
81
-			if(strpos($method_name, self::extending_method_prefix) === 0){
80
+		foreach ($all_methods as $method_name) {
81
+			if (strpos($method_name, self::extending_method_prefix) === 0) {
82 82
 				$method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name);
83 83
 				$callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model";
84
-				remove_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10);
84
+				remove_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10);
85 85
 			}
86 86
 		}
87 87
 	}
88 88
 
89 89
 
90
-	public function __call($callback_method_name,$args){
91
-		if(strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0){
90
+	public function __call($callback_method_name, $args) {
91
+		if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) {
92 92
 			//it's a dynamic callback for a method name
93 93
 			$method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name);
94 94
 			$original_return_val = $args[0];
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
 			$this->_ = $model_called;
97 97
 			$args_provided_to_method_on_model = $args[2];
98 98
 			$extending_method = self::extending_method_prefix.$method_called_on_model;
99
-			if(method_exists($this, $extending_method)){
100
-				return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model);
101
-			}else{
102
-				throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"),$this->_model_name_extended,get_class($this),$extending_method,$extending_method));
99
+			if (method_exists($this, $extending_method)) {
100
+				return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model);
101
+			} else {
102
+				throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"), $this->_model_name_extended, get_class($this), $extending_method, $extending_method));
103 103
 			}
104 104
 
105
-		}else{
106
-			throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"),$callback_method_name,get_class($this)));
105
+		} else {
106
+			throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"), $callback_method_name, get_class($this)));
107 107
 		}
108 108
 	}
109 109
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  *
@@ -159,11 +160,11 @@  discard block
 block discarded – undo
159 160
 			$extending_method = self::extending_method_prefix.$method_called_on_model;
160 161
 			if(method_exists($this, $extending_method)){
161 162
 				return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model);
162
-			}else{
163
+			} else{
163 164
 				throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"),$this->_model_name_extended,get_class($this),$extending_method,$extending_method));
164 165
 			}
165 166
 
166
-		}else{
167
+		} else{
167 168
 			throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"),$callback_method_name,get_class($this)));
168 169
 		}
169 170
 	}
Please login to merge, or discard this patch.
core/libraries/plugin_api/db/EEME_Base.lib.php 2 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  *
@@ -159,11 +160,11 @@  discard block
 block discarded – undo
159 160
 			$extending_method = self::extending_method_prefix.$method_called_on_model;
160 161
 			if(method_exists($this, $extending_method)){
161 162
 				return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model);
162
-			}else{
163
+			} else{
163 164
 				throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"),$this->_model_name_extended,get_class($this),$extending_method,$extending_method));
164 165
 			}
165 166
 
166
-		}else{
167
+		} else{
167 168
 			throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"),$callback_method_name,get_class($this)));
168 169
 		}
169 170
 	}
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -69,58 +69,58 @@  discard block
 block discarded – undo
69 69
 	/**
70 70
 	 * @throws \EE_Error
71 71
 	 */
72
-	public function __construct(){
73
-		if( ! $this->_model_name_extended){
72
+	public function __construct() {
73
+		if ( ! $this->_model_name_extended) {
74 74
 			throw new EE_Error(sprintf(__("When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", "event_espresso")));
75 75
 		}
76 76
 		$construct_end_action = 'AHEE__EEM_'.$this->_model_name_extended.'__construct__end';
77
-		if ( did_action( $construct_end_action )) {
77
+		if (did_action($construct_end_action)) {
78 78
 			throw new EE_Error(
79 79
 				sprintf(
80
-					__( "Hooked in model extension '%s' too late! The model %s has already been used! We know because the action %s has been fired", "event_espresso"),
80
+					__("Hooked in model extension '%s' too late! The model %s has already been used! We know because the action %s has been fired", "event_espresso"),
81 81
 					get_class($this),
82 82
 					$this->_model_name_extended,
83 83
 					$construct_end_action
84 84
 				)
85 85
 			);
86 86
 		}
87
-		add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables',array($this,'add_extra_tables_on_filter'));
88
-		add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields',array($this,'add_extra_fields_on_filter'));
89
-		add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations',array($this,'add_extra_relations_on_filter'));
87
+		add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables', array($this, 'add_extra_tables_on_filter'));
88
+		add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields', array($this, 'add_extra_fields_on_filter'));
89
+		add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations', array($this, 'add_extra_relations_on_filter'));
90 90
 		$this->_register_extending_methods();
91 91
 	}
92 92
 
93
-	public function add_extra_tables_on_filter( $existing_tables ){
94
-		$tables = array_merge( $existing_tables, $this->_extra_tables );
93
+	public function add_extra_tables_on_filter($existing_tables) {
94
+		$tables = array_merge($existing_tables, $this->_extra_tables);
95 95
 		return $tables;
96 96
 	}
97
-	public function add_extra_fields_on_filter($existing_fields){
98
-		if( $this->_extra_fields){
99
-			foreach($this->_extra_fields as $table_alias => $fields){
100
-				if( ! isset( $existing_fields[ $table_alias ] ) ){
101
-					$existing_fields[ $table_alias ] = array();
97
+	public function add_extra_fields_on_filter($existing_fields) {
98
+		if ($this->_extra_fields) {
99
+			foreach ($this->_extra_fields as $table_alias => $fields) {
100
+				if ( ! isset($existing_fields[$table_alias])) {
101
+					$existing_fields[$table_alias] = array();
102 102
 				}
103
-				$existing_fields[$table_alias] = array_merge($existing_fields[$table_alias],$this->_extra_fields[$table_alias]);
103
+				$existing_fields[$table_alias] = array_merge($existing_fields[$table_alias], $this->_extra_fields[$table_alias]);
104 104
 
105 105
 			}
106 106
 		}
107 107
 		return $existing_fields;
108 108
 	}
109
-	public function add_extra_relations_on_filter($existing_relations){
110
-		$relations =  array_merge($existing_relations,$this->_extra_relations);
109
+	public function add_extra_relations_on_filter($existing_relations) {
110
+		$relations = array_merge($existing_relations, $this->_extra_relations);
111 111
 		return $relations;
112 112
 	}
113 113
 	/**
114 114
 	 * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the
115 115
 	 * model extended. (Internally uses filters, and the __call magic method)
116 116
 	 */
117
-	protected function _register_extending_methods(){
117
+	protected function _register_extending_methods() {
118 118
 		$all_methods = get_class_methods(get_class($this));
119
-		foreach($all_methods as $method_name){
120
-			if(strpos($method_name, self::extending_method_prefix) === 0){
119
+		foreach ($all_methods as $method_name) {
120
+			if (strpos($method_name, self::extending_method_prefix) === 0) {
121 121
 				$method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name);
122 122
 				$callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model";
123
-				add_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10,10);
123
+				add_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10, 10);
124 124
 			}
125 125
 		}
126 126
 	}
@@ -129,27 +129,27 @@  discard block
 block discarded – undo
129 129
 	 * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the
130 130
 	 * model extended. (Internally uses filters, and the __call magic method)
131 131
 	 */
132
-	public function deregister(){
133
-		remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables',array($this,'add_extra_tables_on_filter'));
134
-		remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields',array($this,'add_extra_fields_on_filter'));
135
-		remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations',array($this,'add_extra_relations_on_filter'));
132
+	public function deregister() {
133
+		remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables', array($this, 'add_extra_tables_on_filter'));
134
+		remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields', array($this, 'add_extra_fields_on_filter'));
135
+		remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations', array($this, 'add_extra_relations_on_filter'));
136 136
 		$all_methods = get_class_methods(get_class($this));
137
-		foreach($all_methods as $method_name){
138
-			if(strpos($method_name, self::extending_method_prefix) === 0){
137
+		foreach ($all_methods as $method_name) {
138
+			if (strpos($method_name, self::extending_method_prefix) === 0) {
139 139
 				$method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name);
140 140
 				$callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model";
141
-				remove_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10);
141
+				remove_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10);
142 142
 			}
143 143
 		}
144
-		$model_to_reset = 'EEM_' . $this->_model_name_extended;
145
-		if ( class_exists( $model_to_reset ) ) {
144
+		$model_to_reset = 'EEM_'.$this->_model_name_extended;
145
+		if (class_exists($model_to_reset)) {
146 146
 			$model_to_reset::reset();
147 147
 		}
148 148
 	}
149 149
 
150 150
 
151
-	public function __call($callback_method_name,$args){
152
-		if(strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0){
151
+	public function __call($callback_method_name, $args) {
152
+		if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) {
153 153
 			//it's a dynamic callback for a method name
154 154
 			$method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name);
155 155
 			$original_return_val = $args[0];
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
 			$this->_ = $model_called;
158 158
 			$args_provided_to_method_on_model = $args[2];
159 159
 			$extending_method = self::extending_method_prefix.$method_called_on_model;
160
-			if(method_exists($this, $extending_method)){
161
-				return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model);
162
-			}else{
163
-				throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"),$this->_model_name_extended,get_class($this),$extending_method,$extending_method));
160
+			if (method_exists($this, $extending_method)) {
161
+				return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model);
162
+			} else {
163
+				throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"), $this->_model_name_extended, get_class($this), $extending_method, $extending_method));
164 164
 			}
165 165
 
166
-		}else{
167
-			throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"),$callback_method_name,get_class($this)));
166
+		} else {
167
+			throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"), $callback_method_name, get_class($this)));
168 168
 		}
169 169
 	}
170 170
 
Please login to merge, or discard this patch.