Completed
Branch BUG-10738-inconsistency-in-ses... (4fb977)
by
unknown
104:46 queued 94:10
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
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
 /**
7 8
  *
Please login to merge, or discard this patch.
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
 		if( ( isset( $config['model_paths'] ) && ! isset( $config['class_paths'] ) ) ||
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'
@@ -66,42 +66,42 @@  discard block
 block discarded – undo
66 66
         }
67 67
 		self::$_model_registry[$model_id] = $config;
68 68
 
69
-		if( ( isset( $config['model_paths'] ) && ! isset( $config['class_paths'] ) ) ||
70
-				( ! isset( $config['model_paths'] ) && isset( $config['class_paths'] ) ) ){
71
-			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 ) ) ) );
69
+		if ((isset($config['model_paths']) && ! isset($config['class_paths'])) ||
70
+				( ! isset($config['model_paths']) && isset($config['class_paths']))) {
71
+			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))));
72 72
 		}
73
-		if(isset($config['model_paths'])){
73
+		if (isset($config['model_paths'])) {
74 74
 			//make sure they passed in an array
75
-			if( ! is_array( $config['model_paths'] ) ){
76
-				$config['model_paths'] = array( $config['model_paths'] );
75
+			if ( ! is_array($config['model_paths'])) {
76
+				$config['model_paths'] = array($config['model_paths']);
77 77
 			}
78 78
 			//we want to add this as a model folder
79 79
 			//and autoload them all
80 80
 			$class_to_filepath_map = EEH_File::get_contents_of_folders($config['model_paths']);
81 81
 			EEH_Autoloader::register_autoloader($class_to_filepath_map);
82 82
 			$model_name_to_classname_map = array();
83
-			foreach(array_keys($class_to_filepath_map) as $classname){
84
-				$model_name_to_classname_map[str_replace("EEM_","",$classname)] = $classname;
83
+			foreach (array_keys($class_to_filepath_map) as $classname) {
84
+				$model_name_to_classname_map[str_replace("EEM_", "", $classname)] = $classname;
85 85
 			}
86 86
 			self::$_model_name_to_classname_map[$model_id] = $model_name_to_classname_map;
87
-			add_filter('FHEE__EE_System__parse_model_names', array('EE_Register_Model','add_addon_models'));
88
-			add_filter('FHEE__EE_System__parse_implemented_model_names', array('EE_Register_Model','add_addon_models'));
89
-			add_filter('FHEE__EE_Registry__load_model__paths',array('EE_Register_Model','add_model_folders'));
87
+			add_filter('FHEE__EE_System__parse_model_names', array('EE_Register_Model', 'add_addon_models'));
88
+			add_filter('FHEE__EE_System__parse_implemented_model_names', array('EE_Register_Model', 'add_addon_models'));
89
+			add_filter('FHEE__EE_Registry__load_model__paths', array('EE_Register_Model', 'add_model_folders'));
90 90
 			unset($config['model_paths']);
91 91
 		}
92
-		if(isset($config['class_paths'])){
92
+		if (isset($config['class_paths'])) {
93 93
 			//make sure they passed in an array
94
-			if( ! is_array( $config['class_paths'] ) ){
95
-				$config['class_paths'] = array( $config['class_paths'] );
94
+			if ( ! is_array($config['class_paths'])) {
95
+				$config['class_paths'] = array($config['class_paths']);
96 96
 			}
97 97
 			$class_to_filepath_map = EEH_File::get_contents_of_folders($config['class_paths']);
98 98
 			EEH_Autoloader::register_autoloader($class_to_filepath_map);
99
-			add_filter('FHEE__EE_Registry__load_class__paths',array('EE_Register_Model','add_class_folders'));
99
+			add_filter('FHEE__EE_Registry__load_class__paths', array('EE_Register_Model', 'add_class_folders'));
100 100
 			unset($config['class_paths']);
101 101
 		}
102
-		foreach($config as $unknown_key => $unknown_config){
103
-			self::deregister( $model_id );
104
-			throw new EE_Error(sprintf(__("The key '%s' is not a known key for registering a model", "event_espresso"),$unknown_key));
102
+		foreach ($config as $unknown_key => $unknown_config) {
103
+			self::deregister($model_id);
104
+			throw new EE_Error(sprintf(__("The key '%s' is not a known key for registering a model", "event_espresso"), $unknown_key));
105 105
 		}
106 106
 	}
107 107
 
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 	 * @param array $core_models
111 111
 	 * @return array keys are model names (eg 'Event') and values are their classes (eg 'EE_Event')
112 112
 	 */
113
-	public static function add_addon_models( $core_models = array() ){
114
-		foreach(self::$_model_name_to_classname_map as $model_name_to_class_map){
115
-			$core_models = array_merge($core_models,$model_name_to_class_map);
113
+	public static function add_addon_models($core_models = array()) {
114
+		foreach (self::$_model_name_to_classname_map as $model_name_to_class_map) {
115
+			$core_models = array_merge($core_models, $model_name_to_class_map);
116 116
 		}
117 117
 		return $core_models;
118 118
 	}
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 	 * @param array $folders
122 122
 	 * @return array of folder paths
123 123
 	 */
124
-	public static function add_model_folders( $folders = array() ){
125
-		foreach(self::$_model_registry as $config){
126
-			if(isset($config['model_paths'])){
127
-				$folders = array_merge($folders,$config['model_paths']);
124
+	public static function add_model_folders($folders = array()) {
125
+		foreach (self::$_model_registry as $config) {
126
+			if (isset($config['model_paths'])) {
127
+				$folders = array_merge($folders, $config['model_paths']);
128 128
 			}
129 129
 		}
130 130
 		return $folders;
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 	 * @param array $folders
135 135
 	 * @return array of folder paths
136 136
 	 */
137
-	public static function add_class_folders( $folders = array() ){
138
-		foreach(self::$_model_registry as $config){
139
-			if(isset($config['class_paths'])){
140
-				$folders = array_merge( $folders, $config['class_paths'] );
137
+	public static function add_class_folders($folders = array()) {
138
+		foreach (self::$_model_registry as $config) {
139
+			if (isset($config['class_paths'])) {
140
+				$folders = array_merge($folders, $config['class_paths']);
141 141
 			}
142 142
 		}
143 143
 		return $folders;
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
 	 * deregister
150 150
 	 * @param string $model_id
151 151
 	 */
152
-	public static function deregister( $model_id = NULL ){
153
-		if( isset( self::$_model_registry[ $model_id ] ) ){
154
-			unset( self::$_model_registry[ $model_id ] );
155
-			unset( self::$_model_name_to_classname_map[ $model_id ] );
152
+	public static function deregister($model_id = NULL) {
153
+		if (isset(self::$_model_registry[$model_id])) {
154
+			unset(self::$_model_registry[$model_id]);
155
+			unset(self::$_model_name_to_classname_map[$model_id]);
156 156
 		}
157 157
 	}
158 158
 }
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
  *
@@ -98,11 +99,11 @@  discard block
 block discarded – undo
98 99
 			$extending_method = self::extending_method_prefix.$method_called_on_model;
99 100
 			if(method_exists($this, $extending_method)){
100 101
 				return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model);
101
-			}else{
102
+			} else{
102 103
 				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 104
 			}
104 105
 
105
-		}else{
106
+		} else{
106 107
 			throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"),$callback_method_name,get_class($this)));
107 108
 		}
108 109
 	}
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Email_Shortcodes.lib.php 2 patches
Braces   +8 added lines, -4 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
  * Event Espresso
@@ -101,8 +102,9 @@  discard block
 block discarded – undo
101 102
 	private function _get_event_admin_emails( $fancy_headers = TRUE ) {
102 103
 
103 104
 		if ( !empty( $this->_data->admin_email ) ) {
104
-			if ( ! $fancy_headers )
105
-				return $this->_data->admin_email;
105
+			if ( ! $fancy_headers ) {
106
+							return $this->_data->admin_email;
107
+			}
106 108
 			return !empty( $this->_data->fname ) ? $this->_data->fname . ' ' . $this->_data->lname . ' <' . $this->_data->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $this->_data->admin_email . '>';
107 109
 		}
108 110
 
@@ -142,7 +144,9 @@  discard block
 block discarded – undo
142 144
 
143 145
 		foreach ( $admin_details as $admin ) {
144 146
 			//only add an admin email if it is present.
145
-			if ( empty( $admin->email ) || $admin->email == '' ) continue;
147
+			if ( empty( $admin->email ) || $admin->email == '' ) {
148
+				continue;
149
+			}
146 150
 
147 151
 			if ( ! $fancy_headers ) {
148 152
 				$admin_email[] = $admin->email;
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 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,19 +43,19 @@  discard block
 block discarded – undo
43 43
 		$this->description = esc_html__('All shortcodes related to emails', 'event_espresso');
44 44
 		$this->_shortcodes = array(
45 45
 			'[SITE_ADMIN_EMAIL]' => esc_html__('Will be replaced with the admin email for the site that Event Espresso is installed on', 'event_espresso'),
46
-			'[EVENT_AUTHOR_FORMATTED_EMAIL]' => sprintf( esc_html__('This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', 'event_espresso'),'<strong>','</strong>' ),
47
-			'[EVENT_AUTHOR_EMAIL]' => sprintf( esc_html__('This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', 'event_espresso'), '[EVENT_AUTHOR_FORMATTED_EMAIL]' ),
48
-			'[CO_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso' ),
46
+			'[EVENT_AUTHOR_FORMATTED_EMAIL]' => sprintf(esc_html__('This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', 'event_espresso'), '<strong>', '</strong>'),
47
+			'[EVENT_AUTHOR_EMAIL]' => sprintf(esc_html__('This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', 'event_espresso'), '[EVENT_AUTHOR_FORMATTED_EMAIL]'),
48
+			'[CO_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso'),
49 49
 			'[CO_EMAIL]' => esc_html__('This will parse to the email address only for the organization set in Your Organization Settings.', 'event_espresso'),
50
-			'[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso' ),
50
+			'[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso'),
51 51
 			'[ESPRESSO_ADMIN_EMAIL]' => esc_html__('This parses to the email address only for the organization set in Your Organization Settings page.', 'event_espresso')
52 52
 			);
53 53
 	}
54 54
 
55 55
 
56
-	protected function _parser( $shortcode ) {
56
+	protected function _parser($shortcode) {
57 57
 
58
-		switch ( $shortcode ) {
58
+		switch ($shortcode) {
59 59
 
60 60
 			case '[SITE_ADMIN_EMAIL]' :
61 61
 				return $this->_get_site_admin_email();
@@ -66,17 +66,17 @@  discard block
 block discarded – undo
66 66
 				break;
67 67
 
68 68
 			case '[EVENT_AUTHOR_EMAIL]' :
69
-				return $this->_get_event_admin_emails( FALSE );
69
+				return $this->_get_event_admin_emails(FALSE);
70 70
 				break;
71 71
 
72 72
 			case '[CO_FORMATTED_EMAIL]' :
73 73
 			case '[ESPRESSO_ADMIN_FORMATTED_EMAIL]' :
74
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) . '>';
74
+				return EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.EE_Registry::instance()->CFG->organization->get_pretty('email').'>';
75 75
 				break;
76 76
 
77 77
 			case '[CO_EMAIL]' :
78 78
 			case '[ESPRESSO_ADMIN_EMAIL]' :
79
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'email' );
79
+				return EE_Registry::instance()->CFG->organization->get_pretty('email');
80 80
 				break;
81 81
 
82 82
 			default :
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 
101
-	private function _get_event_admin_emails( $fancy_headers = TRUE ) {
101
+	private function _get_event_admin_emails($fancy_headers = TRUE) {
102 102
 
103
-		if ( !empty( $this->_data->admin_email ) ) {
104
-			if ( ! $fancy_headers )
103
+		if ( ! empty($this->_data->admin_email)) {
104
+			if ( ! $fancy_headers)
105 105
 				return $this->_data->admin_email;
106
-			return !empty( $this->_data->fname ) ? $this->_data->fname . ' ' . $this->_data->lname . ' <' . $this->_data->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $this->_data->admin_email . '>';
106
+			return ! empty($this->_data->fname) ? $this->_data->fname.' '.$this->_data->lname.' <'.$this->_data->admin_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$this->_data->admin_email.'>';
107 107
 		}
108 108
 
109 109
 		//k this shortcode has been used else where.  Since we don't know what particular event this is for, let's loop through the events and get an array of event admins for the events.  We'll return the formatted list of admin emails and let the messenger make sure we only pick one if this is for a field that can only have ONE!.
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 		$admin_email = array();
112 112
 
113 113
 		//loop through events and set the list of event_ids to retrieve so we can do ONE query.
114
-		foreach ( $this->_data->events as $event ) {
114
+		foreach ($this->_data->events as $event) {
115 115
 			$ids[] = $event['ID'];
116 116
 		}
117 117
 
118 118
 		//get all the events
119
-		$events = EE_Registry::instance()->load_model('Event')->get_all( array(array('EVT_ID' => array('IN', $ids ) ) ) );
119
+		$events = EE_Registry::instance()->load_model('Event')->get_all(array(array('EVT_ID' => array('IN', $ids))));
120 120
 
121 121
 		//now loop through each event and setup the details
122 122
 		$admin_details = array();
123 123
 		$cnt = 0;
124
-		foreach ( $events as $event ) {
125
-			$user = get_userdata($event->get('EVT_wp_user') );
124
+		foreach ($events as $event) {
125
+			$user = get_userdata($event->get('EVT_wp_user'));
126 126
 			$admin_details[$cnt] = new stdClass();
127 127
 			$admin_details[$cnt]->email = $user->user_email;
128 128
 			$admin_details[$cnt]->first_name = $user->user_firstname;
@@ -131,28 +131,28 @@  discard block
 block discarded – undo
131 131
 		}
132 132
 
133 133
 		//results?
134
-		if ( empty($admin_details) || !is_array($admin_details) ) {
134
+		if (empty($admin_details) || ! is_array($admin_details)) {
135 135
 			$msg[] = esc_html__('The admin details could not be retrieved from the database.', 'event_espresso');
136
-			$msg[] = sprintf( esc_html__('Query: %s', 'event_espresso'), $sql );
137
-			$msg[] = sprintf( esc_html__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, TRUE) );
138
-			$msg[] = sprintf( esc_html__('Event IDS: %s', 'event_espresso'), var_export($ids, TRUE) );
139
-			$msg[] = sprintf( esc_html__('Query Results: %s', 'event_espresso'), var_export($admin_details) );
140
-			do_action( 'AHEE_log', __FILE__, __FUNCTION__, implode( PHP_EOL, $msg ), 'shortcode_parser' );
136
+			$msg[] = sprintf(esc_html__('Query: %s', 'event_espresso'), $sql);
137
+			$msg[] = sprintf(esc_html__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, TRUE));
138
+			$msg[] = sprintf(esc_html__('Event IDS: %s', 'event_espresso'), var_export($ids, TRUE));
139
+			$msg[] = sprintf(esc_html__('Query Results: %s', 'event_espresso'), var_export($admin_details));
140
+			do_action('AHEE_log', __FILE__, __FUNCTION__, implode(PHP_EOL, $msg), 'shortcode_parser');
141 141
 		}
142 142
 
143
-		foreach ( $admin_details as $admin ) {
143
+		foreach ($admin_details as $admin) {
144 144
 			//only add an admin email if it is present.
145
-			if ( empty( $admin->email ) || $admin->email == '' ) continue;
145
+			if (empty($admin->email) || $admin->email == '') continue;
146 146
 
147
-			if ( ! $fancy_headers ) {
147
+			if ( ! $fancy_headers) {
148 148
 				$admin_email[] = $admin->email;
149 149
 				continue;
150 150
 			}
151 151
 
152
-			$admin_email[] = !empty( $admin->first_name ) ? $admin->first_name . ' ' . $admin->last_name . ' <' . $admin->email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $admin->email . '>';
152
+			$admin_email[] = ! empty($admin->first_name) ? $admin->first_name.' '.$admin->last_name.' <'.$admin->email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$admin->email.'>';
153 153
 		}
154 154
 
155
-		$admin_email = implode( ',', $admin_email );
155
+		$admin_email = implode(',', $admin_email);
156 156
 		return $admin_email;
157 157
 	}
158 158
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Event_Author_Shortcodes.lib.php 2 patches
Braces   +5 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
  * Event Espresso
@@ -58,8 +59,9 @@  discard block
 block discarded – undo
58 59
 		//now it's possible that $recipient is not an instance of EE_Messages_Addressee in which case we need to see if $this->_data is an instance of $event.
59 60
 		$event = $this->_data instanceof EE_Event ? $this->_data : NULL;
60 61
 
61
-		if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event )
62
-			return '';
62
+		if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event ) {
63
+					return '';
64
+		}
63 65
 
64 66
 		switch ( $shortcode ) {
65 67
 			case '[EVENT_AUTHOR_FNAME]' :
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 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
 /**
@@ -49,54 +49,54 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 
52
-	protected function _parser( $shortcode ) {
52
+	protected function _parser($shortcode) {
53 53
 		//make sure we end up with a copy of the EE_Messages_Addressee object
54 54
 		$recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL;
55
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient;
56
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient;
55
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient;
56
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient;
57 57
 
58 58
 		//now it's possible that $recipient is not an instance of EE_Messages_Addressee in which case we need to see if $this->_data is an instance of $event.
59 59
 		$event = $this->_data instanceof EE_Event ? $this->_data : NULL;
60 60
 
61
-		if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event )
61
+		if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event)
62 62
 			return '';
63 63
 
64
-		switch ( $shortcode ) {
64
+		switch ($shortcode) {
65 65
 			case '[EVENT_AUTHOR_FNAME]' :
66
-				$fname =  !empty( $recipient ) ? $recipient->fname : NULL;
67
-				if ( empty( $fname ) && !empty( $event ) ) {
68
-					$user = $this->_get_author_for_event( $event );
66
+				$fname = ! empty($recipient) ? $recipient->fname : NULL;
67
+				if (empty($fname) && ! empty($event)) {
68
+					$user = $this->_get_author_for_event($event);
69 69
 					$fname = $user->first_name;
70 70
 				}
71 71
 				return $fname;
72 72
 				break;
73 73
 
74 74
 			case '[EVENT_AUTHOR_LNAME]' :
75
-				$lname =  !empty( $recipient ) ? $recipient->lname : NULL;
76
-				if ( empty( $lname ) && !empty( $event ) ) {
77
-					$user = $this->_get_author_for_event( $event );
75
+				$lname = ! empty($recipient) ? $recipient->lname : NULL;
76
+				if (empty($lname) && ! empty($event)) {
77
+					$user = $this->_get_author_for_event($event);
78 78
 					$lname = $user->last_name;
79 79
 				}
80 80
 				return $lname;
81 81
 				break;
82 82
 
83 83
 			case '[EVENT_AUTHOR_FORMATTED_EMAIL]' :
84
-				if ( !empty( $recipient ) ) {
85
-					$email =  !empty( $recipient->fname ) ? $recipient->fname . ' ' . $recipient->lname . '<' . $recipient->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . '<' . $recipient->admin_email . '>';
84
+				if ( ! empty($recipient)) {
85
+					$email = ! empty($recipient->fname) ? $recipient->fname.' '.$recipient->lname.'<'.$recipient->admin_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').'<'.$recipient->admin_email.'>';
86 86
 				} else {
87 87
 					$email = NULL;
88 88
 				}
89
-				if ( empty( $email ) && ! empty( $event ) ) {
90
-					$user = $this->_get_author_for_event( $event );
91
-					$email = ! empty( $user->first_name ) ? $user->first_name . ' ' . $user->last_name . '<' . $user->user_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . '<' . $user->user_email . '>';
89
+				if (empty($email) && ! empty($event)) {
90
+					$user = $this->_get_author_for_event($event);
91
+					$email = ! empty($user->first_name) ? $user->first_name.' '.$user->last_name.'<'.$user->user_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').'<'.$user->user_email.'>';
92 92
 				}
93 93
 				return $email;
94 94
 				break;
95 95
 
96 96
 			case '[EVENT_AUTHOR_EMAIL]' :
97
-				$email = ! empty( $recipient ) ? $recipient->admin_email : NULL;
98
-				if ( empty( $email ) && !empty( $event ) ) {
99
-					$user = $this->_get_author_for_event( $event );
97
+				$email = ! empty($recipient) ? $recipient->admin_email : NULL;
98
+				if (empty($email) && ! empty($event)) {
99
+					$user = $this->_get_author_for_event($event);
100 100
 					$email = $user->user_email;
101 101
 				}
102 102
 				return $email;
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 	 *
118 118
 	 * @return WP_User
119 119
 	 */
120
-	private function _get_author_for_event( EE_Event $event ) {
120
+	private function _get_author_for_event(EE_Event $event) {
121 121
 		$author_id = $event->wp_user();
122
-		$user_data = get_userdata( (int) $author_id );
122
+		$user_data = get_userdata((int) $author_id);
123 123
 		return $user_data;
124 124
 	}
125 125
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Event_Meta_Shortcodes.lib.php 2 patches
Spacing   +5 added lines, -5 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
 /**
@@ -51,19 +51,19 @@  discard block
 block discarded – undo
51 51
 	 * @param  mixed (array|object) $data      incoming data object/array
52 52
 	 * @return string            parsed code.
53 53
 	 */
54
-	public function parser( $shortcode, $data, $extra_data = array() ) {
54
+	public function parser($shortcode, $data, $extra_data = array()) {
55 55
 		
56 56
 		//all shortcodes will be checked in the post_meta table (assuming the shortcode matches the post_meta key);
57
-		if ( empty( $this->_data['ID'] ) )
57
+		if (empty($this->_data['ID']))
58 58
 			return ''; //need the event id to do anything!
59 59
 
60 60
 		$meta = get_post_meta($this->_data['ID'], $shortcode, true);
61 61
 
62
-		return !empty( $meta ) ? $meta : '';
62
+		return ! empty($meta) ? $meta : '';
63 63
 	}
64 64
 
65 65
 
66
-	protected function _parser( $shortcode ) {}
66
+	protected function _parser($shortcode) {}
67 67
 
68 68
 
69 69
 } //end EE_Event_Meta_Shortcodes class
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +6 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
  * Event Espresso
@@ -54,8 +55,10 @@  discard block
 block discarded – undo
54 55
 	public function parser( $shortcode, $data, $extra_data = array() ) {
55 56
 		
56 57
 		//all shortcodes will be checked in the post_meta table (assuming the shortcode matches the post_meta key);
57
-		if ( empty( $this->_data['ID'] ) )
58
-			return ''; //need the event id to do anything!
58
+		if ( empty( $this->_data['ID'] ) ) {
59
+					return '';
60
+		}
61
+		//need the event id to do anything!
59 62
 
60 63
 		$meta = get_post_meta($this->_data['ID'], $shortcode, true);
61 64
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Line_Item_Shortcodes.lib.php 2 patches
Spacing   +11 added lines, -11 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 messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
10 10
 	exit('NO direct script access allowed');
11 11
 
12 12
 /**
@@ -34,23 +34,23 @@  discard block
 block discarded – undo
34 34
 			'[LINE_ITEM_NAME]' => __('Outputs the line item name.', 'event_espresso'),
35 35
 			'[LINE_ITEM_DESCRIPTION]' => __('Outputs a the description for the line item.', 'event_espresso'),
36 36
 			'[LINE_ITEM_QUANTITY]' => __('Outputs the quantity for this line item.', 'event_espresso'),
37
-			'[LINE_ITEM_AMOUNT]' => __('This will either output the unit price for a line item if its not a percent, or the percent of the line item (if it is percent).', 'event_espresso' ),
37
+			'[LINE_ITEM_AMOUNT]' => __('This will either output the unit price for a line item if its not a percent, or the percent of the line item (if it is percent).', 'event_espresso'),
38 38
 			'[LINE_ITEM_TOTAL]' => __('This outputs the line item total.', 'event_espresso'),
39
-			'[LINE_ITEM_TAXABLE_*]' => __('This attribute type shortcode allows users to indicate what to output if a line item is taxable or not.  One can use the key "symbol=" with the shortcode to indicate what they\'d like to represent a taxable line item.  So doing something like <code>[LINE_ITEM_TAXABLE_* symbol="*"]</code> means that when the line item is parsed, if it\'s taxable the "*" symbol will be returned.  The default symbol if no attribute is included is the "*" symbol.', 'event_espresso' )
39
+			'[LINE_ITEM_TAXABLE_*]' => __('This attribute type shortcode allows users to indicate what to output if a line item is taxable or not.  One can use the key "symbol=" with the shortcode to indicate what they\'d like to represent a taxable line item.  So doing something like <code>[LINE_ITEM_TAXABLE_* symbol="*"]</code> means that when the line item is parsed, if it\'s taxable the "*" symbol will be returned.  The default symbol if no attribute is included is the "*" symbol.', 'event_espresso')
40 40
 			);
41 41
 	}
42 42
 
43 43
 
44 44
 
45
-	protected function _parser( $shortcode ) {
45
+	protected function _parser($shortcode) {
46 46
 		//ensure that the incoming object IS a line item.  If it isn't then bail early.
47
-		if ( ! $this->_data instanceof EE_Line_Item ) {
47
+		if ( ! $this->_data instanceof EE_Line_Item) {
48 48
 			return '';
49 49
 		}
50 50
 
51 51
 		$line_item = $this->_data;
52 52
 
53
-		switch ( $shortcode ) {
53
+		switch ($shortcode) {
54 54
 			case '[LINE_ITEM_NAME]' :
55 55
 				return $line_item->name();
56 56
 				break;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				break;
65 65
 
66 66
 			case '[LINE_ITEM_AMOUNT]' :
67
-				return $line_item->is_percent() ? $line_item->percent() . '%' : $line_item->unit_price_no_code();
67
+				return $line_item->is_percent() ? $line_item->percent().'%' : $line_item->unit_price_no_code();
68 68
 				break;
69 69
 
70 70
 			case '[LINE_ITEM_TOTAL]' :
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 				break;
73 73
 		}
74 74
 
75
-		if ( strpos( $shortcode, '[LINE_ITEM_TAXABLE_*' ) !== FALSE ) {
76
-			$attrs = $this->_get_shortcode_attrs( $shortcode );
77
-			if ( $line_item->is_taxable() ) {
78
-				return !empty( $attrs['symbol'] ) ? $attrs['symbol'] : '*';
75
+		if (strpos($shortcode, '[LINE_ITEM_TAXABLE_*') !== FALSE) {
76
+			$attrs = $this->_get_shortcode_attrs($shortcode);
77
+			if ($line_item->is_taxable()) {
78
+				return ! empty($attrs['symbol']) ? $attrs['symbol'] : '*';
79 79
 			}
80 80
 		}
81 81
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.