Completed
Branch FET/10766/extract-activation-d... (f6eee0)
by
unknown
13:03 queued 10:52
created
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_Event_Shortcodes.lib.php 2 patches
Braces   +11 added lines, -7 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
@@ -85,8 +86,9 @@  discard block
 block discarded – undo
85 86
 
86 87
 
87 88
 		//If there is no event objecdt by now then get out.
88
-		if ( ! $this->_event instanceof EE_Event )
89
-			return '';
89
+		if ( ! $this->_event instanceof EE_Event ) {
90
+					return '';
91
+		}
90 92
 
91 93
 		switch ( $shortcode ) {
92 94
 
@@ -125,14 +127,16 @@  discard block
 block discarded – undo
125 127
 
126 128
 			case '[VIRTUAL_URL]' :
127 129
 				$venue = $this->_event->get_first_related('Venue');
128
-				if ( empty( $venue ) )
129
-					return '';
130
+				if ( empty( $venue ) ) {
131
+									return '';
132
+				}
130 133
 				return $venue->get('VNU_virtual_url');
131 134
 
132 135
 			case '[VIRTUAL_PHONE]' :
133 136
 				$venue = $this->_event->get_first_related('Venue');
134
-				if ( empty( $venue ) )
135
-					return '';
137
+				if ( empty( $venue ) ) {
138
+									return '';
139
+				}
136 140
 				return $venue->get('VNU_virtual_phone');
137 141
 				break;
138 142
 
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
 /**
@@ -55,38 +55,38 @@  discard block
 block discarded – undo
55 55
 			'[EVENT_NAME]' => __("This also can be used for the name of the event", 'event_espresso'),
56 56
 			'[EVENT_PHONE]' => __('The phone number for the event (usually an info number)', 'event_espresso'),
57 57
 			'[EVENT_DESCRIPTION]' => __('The description of the event', 'event_espresso'),
58
-			'[EVENT_EXCERPT]' => __( 'This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso' ),
58
+			'[EVENT_EXCERPT]' => __('This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso'),
59 59
 			'[EVENT_LINK]' => __('A link associated with the event', 'event_espresso'),
60 60
 			'[EVENT_URL]' => __('A link to the event set up on the host site.', 'event_espresso'),
61 61
 			'[VIRTUAL_URL]' => __('What was used for the "URL of Event" field in the Venue settings', 'event_espresso'),
62 62
 			'[VIRTUAL_PHONE]' => __('An alternate phone number for the event. Typically used as a "call-in" number', 'event_espresso'),
63 63
 			'[EVENT_IMAGE]' => __('This will parse to the Feature image for the event.', 'event_espresso'),
64 64
 			'[EVENT_IMAGE_*]' => sprintf(
65
-				__( 'This will parse to the Feature image for the event, %1$ssize%2$s can be set to determine the size of the image loaded by the shortcode. The %1$swidth%2$s and/or %1$sheight%2$s can also be set to determine the width and height of the image when output. By default the shortcode will load the %1$sthumbnail%2$s image size.', 'event_espresso' ),
65
+				__('This will parse to the Feature image for the event, %1$ssize%2$s can be set to determine the size of the image loaded by the shortcode. The %1$swidth%2$s and/or %1$sheight%2$s can also be set to determine the width and height of the image when output. By default the shortcode will load the %1$sthumbnail%2$s image size.', 'event_espresso'),
66 66
 				'<code>',
67 67
 				'</code>'
68 68
 				),
69 69
 			'[EVENT_TOTAL_AVAILABLE_SPACES_*]' => sprintf(
70
-				__( 'This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event.  There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode).  %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso' ),
70
+				__('This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event.  There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode).  %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso'),
71 71
 				'<code>',
72 72
 				'</code>'
73 73
 				),
74
-			'[EVENT_TOTAL_SPOTS_TAKEN]' => __( 'This shortcode will parse to the output the total approved registrations for this event', 'event_espresso' ),
74
+			'[EVENT_TOTAL_SPOTS_TAKEN]' => __('This shortcode will parse to the output the total approved registrations for this event', 'event_espresso'),
75 75
 			'[EVENT_FACEBOOK_URL]' => __('This will return the Facebook URL for the event if you have it set via custom field in your event, otherwise it will use the Facebook URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_facebook</code> and the value as your facebook url.', 'event_espresso'),
76 76
 			'[EVENT_TWITTER_URL]' => __('This will return the Twitter URL for the event if you have it set via custom field in your event, otherwise it will use the Twitter URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_twitter</code> and the value as your facebook url', 'event_espresso'),
77 77
 			'[EVENT_META_*]' => __('This is a special dynamic shortcode. After the "*", add the exact name for your custom field, if there is a value set for that custom field within the event then it will be output in place of this shortcode.', 'event_espresso'),
78
-			'[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __( 'This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso' ),
78
+			'[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __('This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso'),
79 79
 			);
80 80
 	}
81 81
 
82 82
 
83
-	protected function _parser( $shortcode ) {
83
+	protected function _parser($shortcode) {
84 84
 
85 85
 
86 86
 		$this->_event = $this->_data instanceof EE_Event ? $this->_data : null;
87 87
 
88 88
 		//if no event, then let's see if there is a reg_obj.  If there IS, then we'll try and grab the event from the reg_obj instead.
89
-		if ( empty( $this->_event ) ) {
89
+		if (empty($this->_event)) {
90 90
 			$aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL;
91 91
 			$aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee;
92 92
 
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 
96 96
 
97 97
 		//If there is no event objecdt by now then get out.
98
-		if ( ! $this->_event instanceof EE_Event )
98
+		if ( ! $this->_event instanceof EE_Event)
99 99
 			return '';
100 100
 
101
-		switch ( $shortcode ) {
101
+		switch ($shortcode) {
102 102
 
103 103
 			case '[EVENT_ID]' :
104 104
 				return $this->_event->ID();
@@ -131,41 +131,41 @@  discard block
 block discarded – undo
131 131
 
132 132
 			case '[VIRTUAL_URL]' :
133 133
 				$venue = $this->_event->get_first_related('Venue');
134
-				if ( empty( $venue ) )
134
+				if (empty($venue))
135 135
 					return '';
136 136
 				return $venue->get('VNU_virtual_url');
137 137
 
138 138
 			case '[VIRTUAL_PHONE]' :
139 139
 				$venue = $this->_event->get_first_related('Venue');
140
-				if ( empty( $venue ) )
140
+				if (empty($venue))
141 141
 					return '';
142 142
 				return $venue->get('VNU_virtual_phone');
143 143
 				break;
144 144
 
145 145
 			case '[EVENT_IMAGE]' :
146
-				$image = $this->_event->feature_image_url(array(600,300) );
146
+				$image = $this->_event->feature_image_url(array(600, 300));
147 147
 				// @todo: eventually we should make this an attribute shortcode so that em can send along what size they want returned.
148
-				return ! empty( $image ) ? '<img src="' . $image . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name') ) . '" />' : '';
148
+				return ! empty($image) ? '<img src="'.$image.'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name')).'" />' : '';
149 149
 				break;
150 150
 
151 151
 			case '[EVENT_FACEBOOK_URL]' :
152
-				$facebook_url = $this->_event->get_post_meta('event_facebook', true );
153
-				return empty( $facebook_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : $facebook_url;
152
+				$facebook_url = $this->_event->get_post_meta('event_facebook', true);
153
+				return empty($facebook_url) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : $facebook_url;
154 154
 				break;
155 155
 
156 156
 			case '[EVENT_TWITTER_URL]' :
157 157
 				$twitter_url = $this->_event->get_post_meta('event_twitter', true);
158
-				return empty( $twitter_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : $twitter_url;
158
+				return empty($twitter_url) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : $twitter_url;
159 159
 				break;
160 160
 
161 161
 			case '[EVENT_AUTHOR_EMAIL]' :
162 162
 				$author_id = $this->_event->get('EVT_wp_user');
163
-				$user_data = get_userdata( (int) $author_id );
163
+				$user_data = get_userdata((int) $author_id);
164 164
 				return $user_data->user_email;
165 165
 				break;
166 166
 
167 167
 			case '[EVENT_TOTAL_SPOTS_TAKEN]' :
168
-				return EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true );
168
+				return EEM_Registration::instance()->count(array(array('EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true);
169 169
 				break;
170 170
 
171 171
 			case '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' :
@@ -175,49 +175,49 @@  discard block
 block discarded – undo
175 175
 						'page' => 'espresso_registrations',
176 176
 						'action' => 'default'
177 177
 					),
178
-					admin_url( 'admin.php' ),
178
+					admin_url('admin.php'),
179 179
 					true
180 180
 				);
181 181
 				break;
182 182
 		}
183 183
 
184
-		if ( strpos( $shortcode, '[EVENT_META_*' ) !== false ) {
185
-			$shortcode = str_replace( '[EVENT_META_*', '', $shortcode );
186
-			$shortcode = trim( str_replace( ']', '', $shortcode ) );
184
+		if (strpos($shortcode, '[EVENT_META_*') !== false) {
185
+			$shortcode = str_replace('[EVENT_META_*', '', $shortcode);
186
+			$shortcode = trim(str_replace(']', '', $shortcode));
187 187
 
188 188
 			//pull the meta value from the event post
189
-			$event_meta = $this->_event->get_post_meta( $shortcode, true );
189
+			$event_meta = $this->_event->get_post_meta($shortcode, true);
190 190
 
191
-			return ! empty( $event_meta ) ? $this->_event->get_post_meta( $shortcode, true ) : '';
191
+			return ! empty($event_meta) ? $this->_event->get_post_meta($shortcode, true) : '';
192 192
 
193 193
 		}
194 194
 
195
-		if ( strpos( $shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*' ) !== false ) {
196
-			$attrs = $this->_get_shortcode_attrs( $shortcode );
197
-			$method = empty( $attrs['method'] ) ? 'current' : $attrs['method'];
195
+		if (strpos($shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*') !== false) {
196
+			$attrs = $this->_get_shortcode_attrs($shortcode);
197
+			$method = empty($attrs['method']) ? 'current' : $attrs['method'];
198 198
 			$method = $method === 'current';
199 199
 			$available = $this->_event->total_available_spaces($method);
200 200
 			return $available === EE_INF ? '&infin;' : $available;
201 201
 		}
202 202
 
203
-		if ( strpos( $shortcode, '[EVENT_IMAGE_*' ) !== false ) {
204
-			$attrs = $this->_get_shortcode_attrs( $shortcode );
205
-			$width = empty( $attrs['width'] ) ? '' : ' width="' . $attrs['width'] . '"'; 
206
-			$height = empty( $attrs['height'] ) ? '' : ' height="'. $attrs['height'] .'"'; 
203
+		if (strpos($shortcode, '[EVENT_IMAGE_*') !== false) {
204
+			$attrs = $this->_get_shortcode_attrs($shortcode);
205
+			$width = empty($attrs['width']) ? '' : ' width="'.$attrs['width'].'"'; 
206
+			$height = empty($attrs['height']) ? '' : ' height="'.$attrs['height'].'"'; 
207 207
 
208 208
 			//Size may be set to a string such as 'tumbnail' or "width, height" eg - '200,200'
209
-			if ( ! empty( $attrs['size'] ) ) {
210
-				$size = explode( ',', $attrs['size'] );
211
-				if ( count($size) === 1 ) {
209
+			if ( ! empty($attrs['size'])) {
210
+				$size = explode(',', $attrs['size']);
211
+				if (count($size) === 1) {
212 212
 					$size = $size[0];
213 213
 				}
214 214
 			} else {
215 215
 				$size = 'thumbnail';
216 216
 			}
217 217
 
218
-			$image = $this->_event->feature_image_url( $size );
218
+			$image = $this->_event->feature_image_url($size);
219 219
 
220
-			return ! empty( $image ) ? '<img src="' . $image . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name') ) . '"' . $width . $height . '/>' : '';
220
+			return ! empty($image) ? '<img src="'.$image.'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name')).'"'.$width.$height.'/>' : '';
221 221
 		}
222 222
 
223 223
 		return '';
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
 	 * @param  boolean $full_link if TRUE (default) we return the html for the name of the event linked to the event.  Otherwise we just return the url of the event.
231 231
 	 * @return string
232 232
 	 */
233
-	private function _get_event_link( $event, $full_link = TRUE ) {
233
+	private function _get_event_link($event, $full_link = TRUE) {
234 234
 		$url = get_permalink($event->ID());
235 235
 
236
-		return $full_link ? '<a href="' . $url . '">' . $event->get('EVT_name') . '</a>' : $url;
236
+		return $full_link ? '<a href="'.$url.'">'.$event->get('EVT_name').'</a>' : $url;
237 237
 	}
238 238
 
239 239
 
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.
core/libraries/shortcodes/EE_Messenger_Shortcodes.lib.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage shortcodes library
8 8
  */
9
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10
+	exit('No direct script access allowed');
11
+}
10 12
 /**
11 13
  * EE_Messenger_Shortcodes
12 14
  *
@@ -69,8 +71,9 @@  discard block
 block discarded – undo
69 71
 		$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;
70 72
 		$recipient = ! $recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient;
71 73
 
72
-		if ( ! $recipient instanceof EE_Messages_Addressee )
73
-			return '';
74
+		if ( ! $recipient instanceof EE_Messages_Addressee ) {
75
+					return '';
76
+		}
74 77
 
75 78
 		switch ( $shortcode ) {
76 79
 			case '[DISPLAY_HTML_URL]' :
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -41,22 +41,22 @@  discard block
 block discarded – undo
41 41
 		$this->label = __('Messenger Shortcodes', 'event_espresso');
42 42
 		$this->description = __('All shortcodes that are messenger specific.', 'event_espresso');
43 43
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
44
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
44
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
45 45
 		//add messages about what happens  when the messenger is active.
46 46
 		$this->_active_messengers = $message_resource_manager->active_messengers();
47 47
 
48
-		$this->_shortcodes['[DISPLAY_HTML_URL]'] =__('This will return a link to view the template in a browser if the html messenger is active.', 'event_espresso');
49
-		$this->_shortcodes['[DISPLAY_PDF_URL]'] = __('This will return a link to generate a pdf for the template if the pdf messenger is active.', 'event_espresso' );
48
+		$this->_shortcodes['[DISPLAY_HTML_URL]'] = __('This will return a link to view the template in a browser if the html messenger is active.', 'event_espresso');
49
+		$this->_shortcodes['[DISPLAY_PDF_URL]'] = __('This will return a link to generate a pdf for the template if the pdf messenger is active.', 'event_espresso');
50 50
 		$this->_shortcodes['[DISPLAY_PDF_BUTTON]'] = __('This will return html for a download pdf button trigger if the pdf messenger is active.', 'event_espresso');
51 51
 
52 52
 		//show error message about buttons/urls not working as expected if messenger deactivated.
53
-		if ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'update_message_template' ) {
54
-			if ( ! isset( $this->_active_messengers['pdf'] ) ) {
55
-				EE_Error::add_attention( __('Be aware that the pdf messenger is inactive.  This means that any pdf related shortcodes will parse to an empty string.', 'event_espresso' ) );
53
+		if (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'update_message_template') {
54
+			if ( ! isset($this->_active_messengers['pdf'])) {
55
+				EE_Error::add_attention(__('Be aware that the pdf messenger is inactive.  This means that any pdf related shortcodes will parse to an empty string.', 'event_espresso'));
56 56
 			}
57 57
 
58
-			if ( !isset( $this->_active_messengers['html'] ) ) {
59
-				EE_Error::add_attention( __('Be aware that the html messenger is inactive. This means that any html related shortcodes will parse to an empty string.', 'event_espresso' ) );
58
+			if ( ! isset($this->_active_messengers['html'])) {
59
+				EE_Error::add_attention(__('Be aware that the html messenger is inactive. This means that any html related shortcodes will parse to an empty string.', 'event_espresso'));
60 60
 			}
61 61
 		}
62 62
 
@@ -64,24 +64,24 @@  discard block
 block discarded – undo
64 64
 
65 65
 
66 66
 
67
-	protected function _parser( $shortcode ) {
67
+	protected function _parser($shortcode) {
68 68
 		//make sure we end up with a copy of the EE_Messages_Addressee object
69 69
 		$recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL;
70
-		$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;
71
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient;
70
+		$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;
71
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient;
72 72
 
73
-		if ( ! $recipient instanceof EE_Messages_Addressee )
73
+		if ( ! $recipient instanceof EE_Messages_Addressee)
74 74
 			return '';
75 75
 
76
-		switch ( $shortcode ) {
76
+		switch ($shortcode) {
77 77
 			case '[DISPLAY_HTML_URL]' :
78
-				return  isset( $this->_active_messengers['html'] ) ? $this->_get_url( $recipient, 'html' ) : '';
78
+				return  isset($this->_active_messengers['html']) ? $this->_get_url($recipient, 'html') : '';
79 79
 				break;
80 80
 			case '[DISPLAY_PDF_URL]' :
81
-				return  isset( $this->_active_messengers['pdf'] ) ? $this->_get_url( $recipient, 'pdf' ) : '';
81
+				return  isset($this->_active_messengers['pdf']) ? $this->_get_url($recipient, 'pdf') : '';
82 82
 				break;
83 83
 			case '[DISPLAY_PDF_BUTTON]' :
84
-				return  isset( $this->_active_messengers['pdf'] ) ? $this->_get_button( $recipient, 'pdf' ) : '';
84
+				return  isset($this->_active_messengers['pdf']) ? $this->_get_button($recipient, 'pdf') : '';
85 85
 				break;
86 86
 		}
87 87
 		return '';
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @return string                Generated html
101 101
 	 */
102
-	private function _get_button( EE_Messages_Addressee $recipient, $sending_messenger ) {
103
-		$download_text = $sending_messenger == 'pdf' ? __('Download PDF', 'event_espresso') : __('Show HTML', 'event_espresso' );
102
+	private function _get_button(EE_Messages_Addressee $recipient, $sending_messenger) {
103
+		$download_text = $sending_messenger == 'pdf' ? __('Download PDF', 'event_espresso') : __('Show HTML', 'event_espresso');
104 104
 		$content = '
105
-<form method="post" action="' . $this->_get_url( $recipient, $sending_messenger ) . '" >
106
-	<input class="print_button" type="submit" value="' . $download_text . '" />
105
+<form method="post" action="' . $this->_get_url($recipient, $sending_messenger).'" >
106
+	<input class="print_button" type="submit" value="' . $download_text.'" />
107 107
 </form>
108 108
 		';
109 109
 		return $content;
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
 	 * @return string The generated url for displaying the link.
123 123
 	 * @throws EE_Error
124 124
 	 */
125
-	private function _get_url( EE_Messages_Addressee $recipient, $sending_messenger ) {
125
+	private function _get_url(EE_Messages_Addressee $recipient, $sending_messenger) {
126 126
 
127 127
 		$reg = $recipient->reg_obj;
128 128
 		$reg = ! $reg instanceof EE_Registration ? $recipient->primary_reg_obj : $reg;
129 129
 
130 130
 
131
-		if ( $this->_message_type instanceof EE_message_type && $this->_message instanceof EE_Message ) {
132
-			EE_Registry::instance()->load_helper( 'MSG_Template' );
131
+		if ($this->_message_type instanceof EE_message_type && $this->_message instanceof EE_Message) {
132
+			EE_Registry::instance()->load_helper('MSG_Template');
133 133
 			try {
134
-				return EEH_MSG_Template::get_url_trigger( $this->_message_type, $this->_message, $reg, $sending_messenger );
135
-			} catch( EE_Error $e ) {
136
-				if ( WP_DEBUG ) {
134
+				return EEH_MSG_Template::get_url_trigger($this->_message_type, $this->_message, $reg, $sending_messenger);
135
+			} catch (EE_Error $e) {
136
+				if (WP_DEBUG) {
137 137
 					$e->get_error();
138 138
 				}
139 139
 			}
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Payment_Shortcodes.lib.php 2 patches
Spacing   +9 added lines, -9 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,7 +34,7 @@  discard block
 block discarded – undo
34 34
 			'[PAYMENT_TIMESTAMP]' => __('Outputs the date of the payment (using the default date format).', 'event_espresso'),
35 35
 			'[PAYMENT_METHOD]' => __('Outputs a the payment method.', 'event_espresso'),
36 36
 			'[PAYMENT_AMOUNT]' => __('Outputs the payment amount (with currency symbol).', 'event_espresso'),
37
-			'[PAYMENT_GATEWAY]' => __('Outputs the gateway used for the payment.', 'event_espresso' ),
37
+			'[PAYMENT_GATEWAY]' => __('Outputs the gateway used for the payment.', 'event_espresso'),
38 38
 			'[PAYMENT_GATEWAY_RESPONSE]' => __('Outputs the payment gateway response.', 'event_espresso'),
39 39
 			'[PAYMENT_GATEWAY_TXN_ID]' => __('This will either be the gateway transaction ID, or the manual ID added with payment applied via the admin.', 'event_espresso'),
40 40
 			'[PAYMENT_PO_NUMBER]' => __('Purchase Order number (if present)', 'event_espresso'),
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
 
47 47
 
48 48
 
49
-	protected function _parser( $shortcode ) {
49
+	protected function _parser($shortcode) {
50 50
 		//ensure that the incoming object is an EE_Payment object.  If it isn't then bail early.
51
-		if ( ! $this->_data instanceof EE_Payment ) {
51
+		if ( ! $this->_data instanceof EE_Payment) {
52 52
 			return '';
53 53
 		}
54 54
 
55 55
 		$payment = $this->_data;
56 56
 
57
-		switch ( $shortcode ) {
57
+		switch ($shortcode) {
58 58
 			case '[PAYMENT_TIMESTAMP]' :
59 59
 				return $payment->timestamp();
60 60
 				break;
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 
71 71
 			case '[PAYMENT_GATEWAY]' :
72 72
 				//previously teh column 'PMD_ID' was more-or-less 'PAY_gateway'
73
-				if( $payment->payment_method() instanceof EE_Payment_Method ){
73
+				if ($payment->payment_method() instanceof EE_Payment_Method) {
74 74
 					return $payment->payment_method()->name();
75
-				}else{
76
-					return __( 'Unknown', 'event_espresso' );
75
+				} else {
76
+					return __('Unknown', 'event_espresso');
77 77
 				}
78 78
 				break;
79 79
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 				break;
99 99
 
100 100
 			case '[PAYMENT_STATUS_WITH_ICONS]' :
101
-				return $payment->pretty_status( TRUE );
101
+				return $payment->pretty_status(TRUE);
102 102
 				break;
103 103
 
104 104
 			default :
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@  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 13
 /**
13 14
  *
@@ -72,7 +73,7 @@  discard block
 block discarded – undo
72 73
 				//previously teh column 'PMD_ID' was more-or-less 'PAY_gateway'
73 74
 				if( $payment->payment_method() instanceof EE_Payment_Method ){
74 75
 					return $payment->payment_method()->name();
75
-				}else{
76
+				} else{
76 77
 					return __( 'Unknown', 'event_espresso' );
77 78
 				}
78 79
 				break;
Please login to merge, or discard this patch.